You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
367 lines
1.0 MiB
367 lines
1.0 MiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[206,6,7,21],{"+NIl":function(Et,rt,re){(function(he){he(re("VrN/"))})(function(he){"use strict";he.defineMode("stex",function($,O){"use strict";function Z(k,C){k.cmdState.push(C)}function F(k){return k.cmdState.length>0?k.cmdState[k.cmdState.length-1]:null}function I(k){var C=k.cmdState.pop();C&&C.closeBracket()}function K(k){for(var C=k.cmdState,E=C.length-1;E>=0;E--){var h=C[E];if(h.name=="DEFAULT")continue;return h}return{styleIdentifier:function(){return null}}}function B(k,C,E){return function(){this.name=k,this.bracketNo=0,this.style=C,this.styles=E,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var P={};P.importmodule=B("importmodule","tag",["string","builtin"]),P.documentclass=B("documentclass","tag",["","atom"]),P.usepackage=B("usepackage","tag",["atom"]),P.begin=B("begin","tag",["atom"]),P.end=B("end","tag",["atom"]),P.label=B("label","tag",["atom"]),P.ref=B("ref","tag",["atom"]),P.eqref=B("eqref","tag",["atom"]),P.cite=B("cite","tag",["atom"]),P.bibitem=B("bibitem","tag",["atom"]),P.Bibitem=B("Bibitem","tag",["atom"]),P.RBibitem=B("RBibitem","tag",["atom"]),P.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function R(k,C){k.f=C}function y(k,C){var E;if(k.match(/^\\[a-zA-Z@]+/)){var h=k.current().slice(1);return E=P.hasOwnProperty(h)?P[h]:P.DEFAULT,E=new E,Z(C,E),R(C,_),E.style}if(k.match(/^\\[$&%#{}_]/))return"tag";if(k.match(/^\\[,;!\/\\]/))return"tag";if(k.match("\\["))return R(C,function(l,d){return A(l,d,"\\]")}),"keyword";if(k.match("\\("))return R(C,function(l,d){return A(l,d,"\\)")}),"keyword";if(k.match("$$"))return R(C,function(l,d){return A(l,d,"$$")}),"keyword";if(k.match("$"))return R(C,function(l,d){return A(l,d,"$")}),"keyword";var o=k.next();if(o=="%")return k.skipToEnd(),"comment";if(o=="}"||o=="]"){if(E=F(C),E)E.closeBracket(o),R(C,_);else return"error";return"bracket"}else return o=="{"||o=="["?(E=P.DEFAULT,E=new E,Z(C,E),"bracket"):/\d/.test(o)?(k.eatWhile(/[\w.%]/),"atom"):(k.eatWhile(/[\w\-_]/),E=K(C),E.name=="begin"&&(E.argument=k.current()),E.styleIdentifier())}function A(k,C,E){if(k.eatSpace())return null;if(E&&k.match(E))return R(C,y),"keyword";if(k.match(/^\\[a-zA-Z@]+/))return"tag";if(k.match(/^[a-zA-Z]+/))return"variable-2";if(k.match(/^\\[$&%#{}_]/))return"tag";if(k.match(/^\\[,;!\/]/))return"tag";if(k.match(/^[\^_&]/))return"tag";if(k.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(k.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var h=k.next();return h=="{"||h=="}"||h=="["||h=="]"||h=="("||h==")"?"bracket":h=="%"?(k.skipToEnd(),"comment"):"error"}function _(k,C){var E=k.peek(),h;return E=="{"||E=="["?(h=F(C),h.openBracket(E),k.eat(E),R(C,y),"bracket"):/[ \t\r]/.test(E)?(k.eat(E),null):(R(C,y),I(C),y(k,C))}return{startState:function(){var k=O.inMathMode?function(C,E){return A(C,E)}:y;return{cmdState:[],f:k}},copyState:function(k){return{cmdState:k.cmdState.slice(),f:k.f}},token:function(k,C){return C.f(k,C)},blankLine:function(k){k.f=y,k.cmdState.length=0},lineComment:"%"}}),he.defineMIME("text/x-stex","stex"),he.defineMIME("text/x-latex","stex")})},"19Vz":function(Et,rt,re){(function(he){he(re("VrN/"))})(function(he){he.defineOption("placeholder","",function(B,P,R){var y=R&&R!=he.Init;if(P&&!y)B.on("blur",F),B.on("change",I),B.on("swapDoc",I),he.on(B.getInputField(),"compositionupdate",B.state.placeholderCompose=function(){Z(B)}),I(B);else if(!P&&y){B.off("blur",F),B.off("change",I),B.off("swapDoc",I),he.off(B.getInputField(),"compositionupdate",B.state.placeholderCompose),$(B);var A=B.getWrapperElement();A.className=A.className.replace(" CodeMirror-empty","")}P&&!B.hasFocus()&&F(B)});function $(B){B.state.placeholder&&(B.state.placeholder.parentNode.removeChild(B.state.placeholder),B.state.placeholder=null)}function O(B){$(B);var P=B.state.placeholder=document.createElement("pre");P.style.cssText="height: 0; overflow: visible",P.style.direction=B.getOption("direction"),P.className="CodeMirror-placeholder CodeMirror-line-like";var R=B.getOption("placeholder");typeof R=="string"&&(R=document.createTextNode(R)),P.appendChild(R),B.display.lineSpace.insertBefore(P,B.display.lineSpace.firstChild)}function Z(B){setTimeout(function(){var P=!1,R=B.getInputField();R.nodeName=="TEXTAREA"?P=!R.value:B.lineCount()==1&&(P=!/[^\u200b]/.test(R.querySelector(".CodeMirror-line").textContent)),P?O(B):$(B)},20)}function F(B){K(B)&&O(B)}function I(B){var P=B.getWrapperElement(),R=K(B);P.className=P.className.replace(" CodeMirror-empty","")+(R?" CodeMirror-empty":""),R?O(B):$(B)}function K(B){return B.lineCount()===1&&B.getLine(0)===""}})},"1eCo":function(Et,rt,re){(function(he){he(re("VrN/"))})(function(he){"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};he.defineMode("xml",function(Z,F){var I=Z.indentUnit,K={},B=F.htmlMode?$:O;for(var P in B)K[P]=B[P];for(var P in F)K[P]=F[P];var R,y;function A(a,T){function m(j){return T.tokenize=j,j(a,T)}var x=a.next();if(x=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?m(C("atom","]]>")):null:a.match("--")?m(C("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),m(E(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),T.tokenize=C("meta","?>"),"meta"):(R=a.eat("/")?"closeTag":"openTag",T.tokenize=_,"tag bracket");if(x=="&"){var D;return a.eat("#")?a.eat("x")?D=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):D=a.eatWhile(/[\d]/)&&a.eat(";"):D=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),D?"atom":"error"}else return a.eatWhile(/[^&<]/),null}A.isInText=!0;function _(a,T){var m=a.next();if(m==">"||m=="/"&&a.eat(">"))return T.tokenize=A,R=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return R="equals",null;if(m=="<"){T.tokenize=A,T.state=d,T.tagName=T.tagStart=null;var x=T.tokenize(a,T);return x?x+" tag error":"tag error"}else return/[\'\"]/.test(m)?(T.tokenize=k(m),T.stringStartCol=a.column(),T.tokenize(a,T)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function k(a){var T=function(m,x){for(;!m.eol();)if(m.next()==a){x.tokenize=_;break}return"string"};return T.isInAttribute=!0,T}function C(a,T){return function(m,x){for(;!m.eol();){if(m.match(T)){x.tokenize=A;break}m.next()}return a}}function E(a){return function(T,m){for(var x;(x=T.next())!=null;){if(x=="<")return m.tokenize=E(a+1),m.tokenize(T,m);if(x==">")if(a==1){m.tokenize=A;break}else return m.tokenize=E(a-1),m.tokenize(T,m)}return"meta"}}function h(a,T,m){this.prev=a.context,this.tagName=T,this.indent=a.indented,this.startOfLine=m,(K.doNotIndent.hasOwnProperty(T)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function l(a,T){for(var m;;){if(!a.context)return;if(m=a.context.tagName,!K.contextGrabbers.hasOwnProperty(m)||!K.contextGrabbers[m].hasOwnProperty(T))return;o(a)}}function d(a,T,m){return a=="openTag"?(m.tagStart=T.column(),S):a=="closeTag"?v:d}function S(a,T,m){return a=="word"?(m.tagName=T.current(),y="tag",b):K.allowMissingTagName&&a=="endTag"?(y="tag bracket",b(a,T,m)):(y="error",S)}function v(a,T,m){if(a=="word"){var x=T.current();return m.context&&m.context.tagName!=x&&K.implicitlyClosed.hasOwnProperty(m.context.tagName)&&o(m),m.context&&m.context.tagName==x||K.matchClosing===!1?(y="tag",p):(y="tag error",w)}else return K.allowMissingTagName&&a=="endTag"?(y="tag bracket",p(a,T,m)):(y="error",w)}function p(a,T,m){return a!="endTag"?(y="error",p):(o(m),d)}function w(a,T,m){return y="error",p(a,T,m)}function b(a,T,m){if(a=="word")return y="attribute",u;if(a=="endTag"||a=="selfcloseTag"){var x=m.tagName,D=m.tagStart;return m.tagName=m.tagStart=null,a=="selfcloseTag"||K.autoSelfClosers.hasOwnProperty(x)?l(m,x):(l(m,x),m.context=new h(m,x,D==m.indented)),d}return y="error",b}function u(a,T,m){return a=="equals"?f:(K.allowMissing||(y="error"),b(a,T,m))}function f(a,T,m){return a=="string"?s:a=="word"&&K.allowUnquoted?(y="string",b):(y="error",b(a,T,m))}function s(a,T,m){return a=="string"?s:b(a,T,m)}return{startState:function(a){var T={tokenize:A,state:d,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(T.baseIndent=a),T},token:function(a,T){if(!T.tagName&&a.sol()&&(T.indented=a.indentation()),a.eatSpace())return null;R=null;var m=T.tokenize(a,T);return(m||R)&&m!="comment"&&(y=null,T.state=T.state(R||m,a,T),y&&(m=y=="error"?m+" error":y)),m},indent:function(a,T,m){var x=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+I;if(x&&x.noIndent)return he.Pass;if(a.tokenize!=_&&a.tokenize!=A)return m?m.match(/^(\s*)/)[0].length:0;if(a.tagName)return K.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+I*(K.multilineTagIndentFactor||1);if(K.alignCDATA&&/<!\[CDATA\[/.test(T))return 0;var D=T&&/^<(\/)?([\w_:\.-]*)/.exec(T);if(D&&D[1])for(;x;)if(x.tagName==D[2]){x=x.prev;break}else if(K.implicitlyClosed.hasOwnProperty(x.tagName))x=x.prev;else break;else if(D)for(;x;){var j=K.contextGrabbers[x.tagName];if(j&&j.hasOwnProperty(D[2]))x=x.prev;else break}for(;x&&x.prev&&!x.startOfLine;)x=x.prev;return x?x.indent+I:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:K.htmlMode?"html":"xml",helperType:K.htmlMode?"html":"xml",skipAttribute:function(a){a.state==f&&(a.state=b)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var T=[],m=a.context;m;m=m.prev)m.tagName&&T.push(m.tagName);return T.reverse()}}}),he.defineMIME("text/xml","xml"),he.defineMIME("application/xml","xml"),he.mimeModes.hasOwnProperty("text/html")||he.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"7Cbv":function(Et,rt,re){"use strict";var he=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),$=new Uint8Array(16);function O(){if(!he)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return he($)}var Z=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function F(_){return typeof _=="string"&&Z.test(_)}for(var I=F,K=[],B=0;B<256;++B)K.push((B+256).toString(16).substr(1));function P(_){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,C=(K[_[k+0]]+K[_[k+1]]+K[_[k+2]]+K[_[k+3]]+"-"+K[_[k+4]]+K[_[k+5]]+"-"+K[_[k+6]]+K[_[k+7]]+"-"+K[_[k+8]]+K[_[k+9]]+"-"+K[_[k+10]]+K[_[k+11]]+K[_[k+12]]+K[_[k+13]]+K[_[k+14]]+K[_[k+15]]).toLowerCase();if(!I(C))throw TypeError("Stringified UUID is invalid");return C}var R=P;function y(_,k,C){_=_||{};var E=_.random||(_.rng||O)();if(E[6]=E[6]&15|64,E[8]=E[8]&63|128,k){C=C||0;for(var h=0;h<16;++h)k[C+h]=E[h];return k}return R(E)}var A=rt.a=y},"7ahc":function(Et,rt,re){"use strict";re.d(rt,"a",function(){return S});var he=re("k1fw"),$=re("0Owb"),O=re("+L6B"),Z=re("2/Rp"),F=re("y8nQ"),I=re("Vl3Y"),K=re("tJVT"),B=re("OaEy"),P=re("2fM7"),R=re("q1tI"),y=re.n(R),A=re("VrN/"),_=re.n(A),k=re("p77/"),C=re.n(k),E=re("c5Ni"),h=re.n(E),o=P.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},d={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};rt.b=function(v){var p=v.callback,w=v.onCancel,b=Object(R.useState)("python"),u=Object(K.a)(b,2),f=u[0],s=u[1];function a(m){s(d[m][1])}function T(m){p(m)}return y.a.createElement(I.a,Object($.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:T}),y.a.createElement(I.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},y.a.createElement(P.a,{onChange:a},Object.keys(d).map(function(m){return y.a.createElement(o,{key:m,value:m},d[m][0])}))),y.a.createElement(I.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},y.a.createElement(S,{mode:f})),y.a.createElement("div",{className:"flex-container flex-end"},y.a.createElement(Z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),y.a.createElement(Z.a,{type:"ghost",onClick:w},"\u53D6\u6D88")))};function S(v){var p=v.value,w=v.onChange,b=v.mode,u=v.options,f=u===void 0?{}:u,s=Object(R.useRef)(),a=Object(R.useState)(),T=Object(K.a)(a,2),m=T[0],x=T[1];return Object(R.useEffect)(function(){if(m){function D(j){var z=j.getValue();w&&w(z)}return m.on("change",D),function(){m.off("change",D)}}},[m,w]),Object(R.useEffect)(function(){m&&m.setOption("mode",b)},[m,b]),Object(R.useEffect)(function(){m&&((p!==m.getValue()||p==="")&&setTimeout(function(){m.setValue(p||" ")},300))},[m,p]),Object(R.useEffect)(function(){if(s.current&&!m){var D=_.a.fromTextArea(s.current,Object(he.a)({mode:b,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},f));x(D)}},[s.current,m]),y.a.createElement("div",{className:"my-codemirror-container"},y.a.createElement("textarea",{ref:s}))}},"7ixt":function(Et,rt,re){"use strict";re.d(rt,"a",function(){return O});var he={adjustX:1,adjustY:1},$=[0,0],O={left:{points:["cr","cl"],overflow:he,offset:[-4,0],targetOffset:$},right:{points:["cl","cr"],overflow:he,offset:[4,0],targetOffset:$},top:{points:["bc","tc"],overflow:he,offset:[0,-4],targetOffset:$},bottom:{points:["tc","bc"],overflow:he,offset:[0,4],targetOffset:$},topLeft:{points:["bl","tl"],overflow:he,offset:[0,-4],targetOffset:$},leftTop:{points:["tr","tl"],overflow:he,offset:[-4,0],targetOffset:$},topRight:{points:["br","tr"],overflow:he,offset:[0,-4],targetOffset:$},rightTop:{points:["tl","tr"],overflow:he,offset:[4,0],targetOffset:$},bottomRight:{points:["tr","br"],overflow:he,offset:[0,4],targetOffset:$},rightBottom:{points:["bl","br"],overflow:he,offset:[4,0],targetOffset:$},bottomLeft:{points:["tl","bl"],overflow:he,offset:[0,4],targetOffset:$},leftBottom:{points:["br","bl"],overflow:he,offset:[-4,0],targetOffset:$}},Z=O},"815F":function(Et,rt,re){"use strict";re.d(rt,"e",function(){return K}),re.d(rt,"c",function(){return P}),re.d(rt,"d",function(){return R}),re.d(rt,"a",function(){return A}),re.d(rt,"f",function(){return _}),re.d(rt,"b",function(){return k});var he=re("KQm4"),$=re("VTBJ"),O=re("Ff2n"),Z=re("Zm9Q"),F=re("Kwbf"),I=re("OZM5");function K(C,E){return C!=null?C:E}function B(){var C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],E=new Map;function h(o){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(o||[]).forEach(function(d){var S=d.key,v=d.children;Object(F.a)(S!=null,"Tree node must have a certain key: [".concat(l).concat(S,"]"));var p=String(S);Object(F.a)(!E.has(p)||S===null||S===void 0,"Same 'key' exist in the Tree: ".concat(p)),E.set(p,!0),h(v,"".concat(l).concat(p," > "))})}h(C)}function P(C){function E(h){var o=Object(Z.a)(h);return o.map(function(l){if(!Object(I.i)(l))return Object(F.a)(!l,"Tree/TreeNode can only accept TreeNode as children."),null;var d=l.key,S=l.props,v=S.children,p=Object(O.a)(S,["children"]),w=Object($.a)({key:d},p),b=E(v);return b.length&&(w.children=b),w}).filter(function(l){return l})}return E(C)}function R(){var C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],h=new Set(E===!0?[]:E),o=[];function l(d){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return d.map(function(v,p){var w=Object(I.h)(S?S.pos:"0",p),b=K(v.key,w),u=Object($.a)(Object($.a)({},v),{},{parent:S,pos:w,children:null,data:v,isStart:[].concat(Object(he.a)(S?S.isStart:[]),[p===0]),isEnd:[].concat(Object(he.a)(S?S.isEnd:[]),[p===d.length-1])});return o.push(u),E===!0||h.has(b)?u.children=l(v.children||[],u):u.children=[],u})}return l(C),o}function y(C,E,h){var o;h?typeof h=="string"?o=function(S){return S[h]}:typeof h=="function"&&(o=function(S){return h(S)}):o=function(S,v){return K(S.key,v)};function l(d,S,v){var p=d?d.children:C,w=d?Object(I.h)(v.pos,S):"0";if(d){var b=o(d,w),u={node:d,index:S,pos:w,key:b,parentPos:v.node?v.pos:null,level:v.level+1};E(u)}p&&p.forEach(function(f,s){l(f,s,{node:d,pos:w,level:v?v.level+1:-1})})}l(null)}function A(C){var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h=E.initWrapper,o=E.processEntity,l=E.onProcessFinished,d=arguments.length>2?arguments[2]:void 0,S={},v={},p={posEntities:S,keyEntities:v};return h&&(p=h(p)||p),y(C,function(w){var b=w.node,u=w.index,f=w.pos,s=w.key,a=w.parentPos,T=w.level,m={node:b,index:u,key:s,pos:f,level:T},x=K(s,f);S[f]=m,v[x]=m,m.parent=S[a],m.parent&&(m.parent.children=m.parent.children||[],m.parent.children.push(m)),o&&o(m,p)},d),l&&l(p),p}function _(C,E){var h=E.expandedKeys,o=E.selectedKeys,l=E.loadedKeys,d=E.loadingKeys,S=E.checkedKeys,v=E.halfCheckedKeys,p=E.dragOverNodeKey,w=E.dropPosition,b=E.keyEntities,u=b[C],f={eventKey:C,expanded:h.indexOf(C)!==-1,selected:o.indexOf(C)!==-1,loaded:l.indexOf(C)!==-1,loading:d.indexOf(C)!==-1,checked:S.indexOf(C)!==-1,halfChecked:v.indexOf(C)!==-1,pos:String(u?u.pos:""),dragOver:p===C&&w===0,dragOverGapTop:p===C&&w===-1,dragOverGapBottom:p===C&&w===1};return f}function k(C){var E=C.data,h=C.expanded,o=C.selected,l=C.checked,d=C.loaded,S=C.loading,v=C.halfChecked,p=C.dragOver,w=C.dragOverGapTop,b=C.dragOverGapBottom,u=C.pos,f=C.active,s=Object($.a)(Object($.a)({},E),{},{expanded:h,selected:o,checked:l,loaded:d,loading:S,halfChecked:v,dragOver:p,dragOverGapTop:w,dragOverGapBottom:b,pos:u,active:f});return"props"in s||Object.defineProperty(s,"props",{get:function(){return Object(F.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),C}}),s}},"8EBN":function(Et,rt,re){(function(he){he(re("VrN/"))})(function(he){"use strict";he.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;$<he.modeInfo.length;$++){var O=he.modeInfo[$];O.mimes&&(O.mime=O.mimes[0])}he.findModeByMIME=function(Z){Z=Z.toLowerCase();for(var F=0;F<he.modeInfo.length;F++){var I=he.modeInfo[F];if(I.mime==Z)return I;if(I.mimes){for(var K=0;K<I.mimes.length;K++)if(I.mimes[K]==Z)return I}}if(/\+xml$/.test(Z))return he.findModeByMIME("application/xml");if(/\+json$/.test(Z))return he.findModeByMIME("application/json")},he.findModeByExtension=function(Z){Z=Z.toLowerCase();for(var F=0;F<he.modeInfo.length;F++){var I=he.modeInfo[F];if(I.ext){for(var K=0;K<I.ext.length;K++)if(I.ext[K]==Z)return I}}},he.findModeByFileName=function(Z){for(var F=0;F<he.modeInfo.length;F++){var I=he.modeInfo[F];if(I.file&&I.file.test(Z))return I}var K=Z.lastIndexOf("."),B=K>-1&&Z.substring(K+1,Z.length);if(B)return he.findModeByExtension(B)},he.findModeByName=function(Z){Z=Z.toLowerCase();for(var F=0;F<he.modeInfo.length;F++){var I=he.modeInfo[F];if(I.name.toLowerCase()==Z)return I;if(I.alias){for(var K=0;K<I.alias.length;K++)if(I.alias[K].toLowerCase()==Z)return I}}}})},"8Jsi":function(Et,rt,re){"use strict";re.d(rt,"d",function(){return a}),re.d(rt,"a",function(){return ie}),re.d(rt,"b",function(){return Ae}),re.d(rt,"c",function(){return fe});var he=re("1OyB"),$=re("vuIU"),O=re("Ji7U"),Z=re("LK+K"),F=re("KQm4"),I=re("U8pU"),K=re("ODXe"),B=re("VTBJ"),P=re("q1tI"),R=re("qNPg"),y=re("2Qr1"),A=re("815F"),_=re("NvD2"),k=re("wPlo"),C=re("6cGi"),E=re("Kwbf"),h=re("4IlW"),o=re("YrtM"),l=re("fAei"),d=P.createContext(null);function S(De,Ne){if(!De)return!0;var Be=De.data,ze=Be.disabled,Ge=Be.disableCheckbox;switch(Ne){case"select":return ze;case"checkbox":return ze||Ge}return!1}function v(De,Ne){var Be=P.useCallback(function(Ge){var Ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"select",Re=arguments.length>2?arguments[2]:void 0,Qe=De.get(Ge);return!Re&&S(Qe,Ve)?null:Qe},[De]),ze=P.useCallback(function(Ge){var Ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"select",Re=arguments.length>2?arguments[2]:void 0,Qe=Ne.get(Ge);return!Re&&S(Qe,Ve)?null:Qe},[Ne]);return[Be,ze]}function p(De){return P.useMemo(function(){var Ne=new Map,Be=new Map;return De.forEach(function(ze){Ne.set(ze.key,ze),Be.set(ze.data.value,ze)}),[Ne,Be]},[De])}var w={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},b=function(Ne,Be){var ze=Ne.prefixCls,Ge=Ne.height,Ve=Ne.itemHeight,Re=Ne.virtual,Qe=Ne.options,$e=Ne.flattenOptions,Me=Ne.multiple,We=Ne.searchValue,Se=Ne.onSelect,ye=Ne.onToggleOpen,xe=Ne.open,le=Ne.notFoundContent,ue=Ne.onMouseEnter,me=P.useContext(d),Ee=me.checkable,we=me.checkedKeys,Ie=me.halfCheckedKeys,Ze=me.treeExpandedKeys,at=me.treeDefaultExpandAll,ht=me.treeDefaultExpandedKeys,ut=me.onTreeExpand,xt=me.treeIcon,Ct=me.showTreeIcon,st=me.switcherIcon,Mt=me.treeLine,Lt=me.treeNodeFilterProp,kt=me.loadData,Dt=me.treeLoadedKeys,Tt=me.treeMotion,Bt=me.onTreeLoad,Qt=P.useRef(),yt=Object(o.a)(function(){return Qe},[xe,Qe],function(lt,Xe){return Xe[0]&<[1]!==Xe[1]}),pr=p($e),jt=Object(K.a)(pr,2),tr=jt[0],ur=jt[1],nr=v(tr,ur),vr=Object(K.a)(nr,2),Ut=vr[0],ft=vr[1],sr=P.useMemo(function(){return we.map(function(lt){var Xe=ft(lt);return Xe?Xe.key:null})},[we]),Tr=P.useMemo(function(){return Ee?{checked:sr,halfChecked:Ie}:null},[sr,Ie,Ee]);P.useEffect(function(){if(xe&&!Me&&sr.length){var lt;(lt=Qt.current)===null||lt===void 0||lt.scrollTo({key:sr[0]})}},[xe]);var gr=String(We).toLowerCase(),Pt=function(Xe){return gr?String(Xe[Lt]).toLowerCase().includes(gr):!1},yr=P.useState(ht),dr=Object(K.a)(yr,2),qr=dr[0],et=dr[1],wt=P.useState(null),zr=Object(K.a)(wt,2),Ir=zr[0],Zr=zr[1],Wr=P.useMemo(function(){return Ze?Object(F.a)(Ze):We?Ir:qr},[qr,Ir,gr,Ze]);P.useEffect(function(){We&&Zr($e.map(function(lt){return lt.key}))},[We]);var G=function(Xe){et(Xe),Zr(Xe),ut&&ut(Xe)},c=function(Xe){Xe.preventDefault()},g=function(Xe,pt){var mt=pt.node.key,It=Ut(mt,Ee?"checkbox":"select");It!==null&&Se(It.data.value,{selected:!we.includes(It.data.value)}),Me||ye(!1)},U=P.useState(null),q=Object(K.a)(U,2),H=q[0],Ce=q[1],Ye=Ut(H);if(P.useImperativeHandle(Be,function(){return{onKeyDown:function(Xe){var pt,mt=Xe.which;switch(mt){case h.a.UP:case h.a.DOWN:case h.a.LEFT:case h.a.RIGHT:(pt=Qt.current)===null||pt===void 0||pt.onKeyDown(Xe);break;case h.a.ENTER:{Ye!==null&&g(null,{node:{key:H},selected:!we.includes(Ye.data.value)});break}case h.a.ESC:ye(!1)}},onKeyUp:function(){}}}),yt.length===0)return P.createElement("div",{role:"listbox",className:"".concat(ze,"-empty"),onMouseDown:c},le);var nt={};return Dt&&(nt.loadedKeys=Dt),Wr&&(nt.expandedKeys=Wr),P.createElement("div",{onMouseDown:c,onMouseEnter:ue},Ye&&xe&&P.createElement("span",{style:w,"aria-live":"assertive"},Ye.data.value),P.createElement(l.b,Object.assign({ref:Qt,focusable:!1,prefixCls:"".concat(ze,"-tree"),treeData:yt,height:Ge,itemHeight:Ve,virtual:Re,multiple:Me,icon:xt,showIcon:Ct,switcherIcon:st,showLine:Mt,loadData:We?null:kt,motion:Tt,checkable:Ee,checkStrictly:!0,checkedKeys:Tr,selectedKeys:Ee?[]:sr,defaultExpandAll:at},nt,{onActiveChange:Ce,onSelect:g,onCheck:g,onExpand:G,onLoad:Bt,filterTreeNode:Pt})))},u=P.forwardRef(b);u.displayName="OptionList";var f=u,s=function(){return null},a=s,T=re("Ff2n"),m=re("Zm9Q");function x(De){return Object(m.a)(De).map(function(Ne){if(!P.isValidElement(Ne)||!Ne.type)return null;var Be=Ne.key,ze=Ne.props,Ge=ze.children,Ve=ze.value,Re=Object(T.a)(ze,["children","value"]),Qe=Object(B.a)({key:Be,value:Ve},Re),$e=x(Ge);return $e.length&&(Qe.children=$e),Qe}).filter(function(Ne){return Ne})}function D(De){if(!De)return De;var Ne=Object(B.a)({},De);return"props"in Ne||Object.defineProperty(Ne,"props",{get:function(){return Object(E.a)(!1,"New `rc-tree-select` not support return node instance as argument anymore. Please consider to remove `props` access."),Ne}}),Ne}function j(De,Ne,Be,ze,Ge){var Ve=null,Re=null;function Qe(){function $e(Me){var We=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"0",Se=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return Me.map(function(ye,xe){var le="".concat(We,"-").concat(xe),ue=Be.includes(ye.value),me=$e(ye.children||[],le,ue),Ee=P.createElement(a,Object.assign({},ye),me.map(function(Ie){return Ie.node}));if(Ne===ye.value&&(Ve=Ee),ue){var we={pos:le,node:Ee,children:me};return Se||Re.push(we),we}return null}).filter(function(ye){return ye})}Re||(Re=[],$e(ze),Re.sort(function(Me,We){var Se=Me.node.props.value,ye=We.node.props.value,xe=Be.indexOf(Se),le=Be.indexOf(ye);return xe-le}))}Object.defineProperty(De,"triggerNode",{get:function(){return Object(E.a)(!1,"`triggerNode` is deprecated. Please consider decoupling data with node."),Qe(),Ve}}),Object.defineProperty(De,"allCheckedNodes",{get:function(){return Object(E.a)(!1,"`allCheckedNodes` is deprecated. Please consider decoupling data with node."),Qe(),Ge?Re:Re.map(function(Me){var We=Me.node;return We})}})}function z(De){return Array.isArray(De)?De:De!==void 0?[De]:[]}function V(De,Ne){var Be=new Map;return Ne.forEach(function(ze){var Ge=ze.data;Be.set(Ge.value,Ge)}),De.map(function(ze){return D(Be.get(ze))})}function M(De,Ne){var Be=V([De],Ne)[0];return Be?Be.disabled:!1}function N(De){return De.disabled||De.disableCheckbox||De.checkable===!1}function Y(De){for(var Ne=De.parent,Be=0,ze=Ne;ze;)ze=ze.parent,Be+=1;return Be}function oe(De){function Ne(ze){return(ze||[]).map(function(Ge){var Ve=Ge.value,Re=Ge.key,Qe=Ge.children,$e=Object(B.a)(Object(B.a)({},Ge),{},{key:"key"in Ge?Re:Ve});return Qe&&($e.children=Ne(Qe)),$e})}var Be=Object(A.d)(Ne(De),!0);return Be.map(function(ze){return{key:ze.data.key,data:ze.data,level:Y(ze)}})}function pe(De){return function(Ne,Be){var ze=Be[De];return String(ze).toLowerCase().includes(String(Ne).toLowerCase())}}function ve(De,Ne,Be){var ze=Be.optionFilterProp,Ge=Be.filterOption;if(Ge===!1)return Ne;var Ve;typeof Ge=="function"?Ve=Ge:Ve=pe(ze);function Re(Qe){var $e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Qe.map(function(Me){var We=Me.children,Se=$e||Ve(De,D(Me)),ye=Re(We||[],Se);return Se||ye.length?Object(B.a)(Object(B.a)({},Me),{},{children:ye}):null}).filter(function(Me){return Me})}return Re(Ne)}function Le(De,Ne,Be,ze){var Ge=new Map;return z(Ne).forEach(function(Ve){Ve&&Object(I.a)(Ve)==="object"&&"value"in Ve&&Ge.set(Ve.value,Ve)}),De.map(function(Ve){var Re={value:Ve},Qe=Be(Ve,"select",!0),$e=Qe?ze(Qe.data):Ve;if(Ge.has(Ve)){var Me=Ge.get(Ve);Re.label="label"in Me?Me.label:$e,"halfChecked"in Me&&(Re.halfChecked=Me.halfChecked)}else Re.label=$e;return Re})}function ke(De,Ne){var Be=new Set(De);return Be.add(Ne),Array.from(Be)}function ce(De,Ne){var Be=new Set(De);return Be.delete(Ne),Array.from(Be)}function ae(De){var Ne=De.searchPlaceholder,Be=De.treeCheckStrictly,ze=De.treeCheckable,Ge=De.labelInValue,Ve=De.value,Re=De.multiple;Object(E.a)(!Ne,"`searchPlaceholder` has been removed."),Be&&Ge===!1&&Object(E.a)(!1,"`treeCheckStrictly` will force set `labelInValue` to `true`."),(Ge||Be)&&Object(E.a)(z(Ve).every(function(Qe){return Qe&&Object(I.a)(Qe)==="object"&&"value"in Qe}),"Invalid prop `value` supplied to `TreeSelect`. You should use { label: string, value: string | number } or [{ label: string, value: string | number }] instead."),Be||Re||ze?Object(E.a)(!Ve||Array.isArray(Ve),"`value` should be an array when `TreeSelect` is checkable or multiple."):Object(E.a)(!Array.isArray(Ve),"`value` should not be array when `TreeSelect` is single mode.")}var de=ae,ne=10;function se(De,Ne){var Be=Ne.id,ze=Ne.pId,Ge=Ne.rootPId,Ve={},Re=[],Qe=De.map(function($e){var Me=Object(B.a)({},$e),We=Me[Be];return Ve[We]=Me,Me.key=Me.key||We,Me});return Qe.forEach(function($e){var Me=$e[ze],We=Ve[Me];We&&(We.children=We.children||[],We.children.push($e)),(Me===Ge||!We&&Ge===null)&&Re.push($e)}),Re}function J(De,Ne){var Be=0,ze=new Set;function Ge(Ve){return(Ve||[]).map(function(Re){var Qe=Re.key,$e=Re.value,Me=Re.children,We=Object(T.a)(Re,["key","value","children"]),Se="value"in Re?$e:Qe,ye=Object(B.a)(Object(B.a)({},We),{},{key:Qe!=null?Qe:Se,value:Se,title:Ne(Re)});return"children"in Re&&(ye.children=Ge(Me)),ye})}return Ge(De)}function ee(De,Ne,Be){var ze=Be.getLabelProp,Ge=Be.simpleMode,Ve=P.useRef({});return De?(Ve.current.formatTreeData=Ve.current.treeData===De?Ve.current.formatTreeData:J(Ge?se(De,Object(B.a)({id:"id",pId:"pId",rootPId:null},Ge!==!0?Ge:{})):De,ze),Ve.current.treeData=De):Ve.current.formatTreeData=Ve.current.children===Ne?Ve.current.formatTreeData:J(x(Ne),ze),Ve.current.formatTreeData}var ie="SHOW_ALL",fe="SHOW_PARENT",Ae="SHOW_CHILD";function ge(De,Ne,Be){var ze=new Set(De);return Ne===Ae?De.filter(function(Ge){var Ve=Be[Ge];return!(Ve&&Ve.children&&Ve.children.every(function(Re){var Qe=Re.node;return N(Qe)||ze.has(Qe.key)}))}):Ne===fe?De.filter(function(Ge){var Ve=Be[Ge],Re=Ve?Ve.parent:null;return!(Re&&!N(Re.node)&&ze.has(Re.node.key))}):De}function Oe(De,Ne){var Be=Ne.value,ze=Ne.getEntityByValue,Ge=Ne.getEntityByKey,Ve=Ne.treeConduction,Re=Ne.showCheckedStrategy,Qe=Ne.conductKeyEntities,$e=Ne.getLabelProp;return P.useMemo(function(){var Me=De;if(Ve){var We=ge(De.map(function(Se){var ye=ze(Se);return ye?ye.key:Se}),Re,Qe);Me=We.map(function(Se){var ye=Ge(Se);return ye?ye.data.value:Se})}return Le(Me,Be,ze,$e)},[De,Be,Ve,Re,ze])}var Pe=["expandedKeys","treeData","treeCheckable","showCheckedStrategy","searchPlaceholder","treeLine","treeIcon","showTreeIcon","switcherIcon","treeNodeFilterProp","filterTreeNode","dropdownPopupAlign","treeDefaultExpandAll","treeCheckStrictly","treeExpandedKeys","treeLoadedKeys","treeMotion","onTreeExpand","onTreeLoad","loadData","treeDataSimpleMode","treeNodeLabelProp","treeDefaultExpandedKeys"],je=Object(R.a)({prefixCls:"rc-tree-select",components:{optionList:f},convertChildrenToData:function(){return null},flattenOptions:oe,getLabeledValue:y.e,filterOptions:ve,isValueDisabled:M,findValueOption:V,omitDOMProps:function(Ne){var Be=Object(B.a)({},Ne);return Pe.forEach(function(ze){delete Be[ze]}),Be}});je.displayName="Select";var Ke=P.forwardRef(function(De,Ne){var Be=De.multiple,ze=De.treeCheckable,Ge=De.treeCheckStrictly,Ve=De.showCheckedStrategy,Re=Ve===void 0?"SHOW_CHILD":Ve,Qe=De.labelInValue,$e=De.loadData,Me=De.treeLoadedKeys,We=De.treeNodeFilterProp,Se=We===void 0?"value":We,ye=De.treeNodeLabelProp,xe=De.treeDataSimpleMode,le=De.treeData,ue=De.treeExpandedKeys,me=De.treeDefaultExpandedKeys,Ee=De.treeDefaultExpandAll,we=De.children,Ie=De.treeIcon,Ze=De.showTreeIcon,at=De.switcherIcon,ht=De.treeLine,ut=De.treeMotion,xt=De.filterTreeNode,Ct=De.dropdownPopupAlign,st=De.onChange,Mt=De.onTreeExpand,Lt=De.onTreeLoad,kt=De.onDropdownVisibleChange,Dt=De.onSelect,Tt=De.onDeselect,Bt=ze||Ge,Qt=Be||Bt,yt=ze&&!Ge,pr=Ge||Qe,jt=P.useRef(null);P.useImperativeHandle(Ne,function(){return{focus:jt.current.focus,blur:jt.current.blur}});var tr=function(mt){return le&&mt.label||mt.title},ur=function(mt){return ye?mt[ye]:tr(mt)},nr=ee(le,we,{getLabelProp:tr,simpleMode:xe}),vr=Object(P.useMemo)(function(){return oe(nr)},[nr]),Ut=p(vr),ft=Object(K.a)(Ut,2),sr=ft[0],Tr=ft[1],gr=v(sr,Tr),Pt=Object(K.a)(gr,2),yr=Pt[0],dr=Pt[1],qr=Object(P.useMemo)(function(){return yt?Object(A.a)(nr):{keyEntities:null}},[nr,ze,Ge]),et=qr.keyEntities,wt=Object(C.a)(De.defaultValue,{value:De.value}),zr=Object(K.a)(wt,2),Ir=zr[0],Zr=zr[1],Wr=function(mt){var It=[],lr=[];return mt.forEach(function($t){dr($t)?lr.push($t):It.push($t)}),{missingRawValues:It,existRawValues:lr}},G=Object(P.useMemo)(function(){var pt=[],mt=[];if(z(Ir).forEach(function(Xt){if(Xt&&Object(I.a)(Xt)==="object"&&"value"in Xt)if(Xt.halfChecked&&Ge){var wr=dr(Xt.value);pt.push(wr?wr.key:Xt.value)}else mt.push(Xt.value);else mt.push(Xt)}),yt){var It=Wr(mt),lr=It.missingRawValues,$t=It.existRawValues,rr=$t.map(function(Xt){return dr(Xt).key}),xr=Object(_.a)(rr,!0,et),Nr=xr.checkedKeys,ir=xr.halfCheckedKeys;return[[].concat(Object(F.a)(lr),Object(F.a)(Nr.map(function(Xt){return yr(Xt).data.value}))),ir]}return[mt,pt]},[Ir,Qt,pr,ze,Ge]),c=Object(K.a)(G,2),g=c[0],U=c[1],q=Oe(g,{treeConduction:yt,value:Ir,showCheckedStrategy:Re,conductKeyEntities:et,getEntityByValue:dr,getEntityByKey:yr,getLabelProp:ur}),H=function(mt,It,lr){if(Zr(Qt?mt:mt[0]),st){var $t=mt;if(yt&&Re!=="SHOW_ALL"){var rr=mt.map(function(Ar){var _r=dr(Ar);return _r?_r.key:Ar}),xr=ge(rr,Re,et);$t=xr.map(function(Ar){var _r=yr(Ar);return _r?_r.data.value:Ar})}var Nr=It||{triggerValue:void 0,selected:void 0},ir=Nr.triggerValue,Xt=Nr.selected,wr=pr?Le($t,Ir,dr,ur):$t;if(Ge){var Hr=U.map(function(Ar){var _r=yr(Ar);return _r?_r.data.value:Ar}).filter(function(Ar){return!$t.includes(Ar)});wr=[].concat(Object(F.a)(wr),Object(F.a)(Le(Hr,Ir,dr,ur)))}var ar={preValue:q,triggerValue:ir},yn=!0;(Ge||lr==="selection"&&!Xt)&&(yn=!1),j(ar,ir,mt,nr,yn),Bt?ar.checked=Xt:ar.selected=Xt,st(Qt?wr:wr[0],pr?null:$t.map(function(Ar){var _r=dr(Ar);return _r?ur(_r.data):null}),ar)}},Ce=function(mt,It,lr){var $t=mt;if(!Qt)H([mt],{selected:!0,triggerValue:mt},lr);else{var rr=ke(g,mt);if(yt){var xr=Wr(rr),Nr=xr.missingRawValues,ir=xr.existRawValues,Xt=ir.map(function(ar){return dr(ar).key}),wr=Object(_.a)(Xt,!0,et),Hr=wr.checkedKeys;rr=[].concat(Object(F.a)(Nr),Object(F.a)(Hr.map(function(ar){return yr(ar).data.value})))}H(rr,{selected:!0,triggerValue:mt},lr)}Dt&&Dt($t,It)},Ye=function(mt,It,lr){var $t=mt,rr=ce(g,mt);if(yt){var xr=Wr(rr),Nr=xr.missingRawValues,ir=xr.existRawValues,Xt=ir.map(function(ar){return dr(ar).key}),wr=Object(_.a)(Xt,{checked:!1,halfCheckedKeys:U},et),Hr=wr.checkedKeys;rr=[].concat(Object(F.a)(Nr),Object(F.a)(Hr.map(function(ar){return yr(ar).data.value})))}H(rr,{selected:!1,triggerValue:mt},lr),Tt&&Tt($t,It)},nt=function(){H([],null,"clear")},lt=P.useCallback(function(pt){if(kt){var mt={};Object.defineProperty(mt,"documentClickClose",{get:function(){return Object(E.a)(!1,"Second param of `onDropdownVisibleChange` has been removed."),!1}}),kt(pt,mt)}},[kt]),Xe={optionLabelProp:null,optionFilterProp:Se,dropdownAlign:Ct,internalProps:{mark:k.a,onClear:nt,skipTriggerChange:!0,skipTriggerSelect:!0,onRawSelect:Ce,onRawDeselect:Ye}};return"filterTreeNode"in De&&(Xe.filterOption=xt),P.createElement(d.Provider,{value:{checkable:Bt,loadData:$e,treeLoadedKeys:Me,onTreeLoad:Lt,checkedKeys:g,halfCheckedKeys:U,treeDefaultExpandAll:Ee,treeExpandedKeys:ue,treeDefaultExpandedKeys:me,onTreeExpand:Mt,treeIcon:Ie,treeMotion:ut,showTreeIcon:Ze,switcherIcon:at,treeLine:ht,treeNodeFilterProp:Se}},P.createElement(je,Object.assign({ref:jt,mode:Qt?"multiple":null},De,Xe,{value:q,labelInValue:!0,options:nr,onChange:null,onSelect:null,onDeselect:null,onDropdownVisibleChange:lt})))}),He=function(De){Object(O.a)(Be,De);var Ne=Object(Z.a)(Be);function Be(){var ze;return Object(he.a)(this,Be),ze=Ne.apply(this,arguments),ze.selectRef=P.createRef(),ze.focus=function(){ze.selectRef.current.focus()},ze.blur=function(){ze.selectRef.current.blur()},ze}return Object($.a)(Be,[{key:"render",value:function(){return P.createElement(Ke,Object.assign({ref:this.selectRef},this.props))}}]),Be}(P.Component);He.TreeNode=a,He.SHOW_ALL=ie,He.SHOW_PARENT=fe,He.SHOW_CHILD=Ae;var Fe=He,qe=rt.e=Fe},"8hTe":function(Et,rt,re){Et.exports={button:"button___1wy9m"}},"8pgt":function(Et,rt,re){Et.exports={flexRow:"flexRow___2kcn2",flexColumn:"flexColumn___2bS_0",formWrap:"formWrap___3t-wi",example:"example___2J2YZ",footerWrap:"footerWrap___3u6gg"}},"9Bee":function(Et,rt,re){"use strict";var he=re("DYRE"),$=re("zeV3"),O=re("+L6B"),Z=re("2/Rp"),F=re("k1fw"),I=re("9og8"),K=re("tJVT"),B=re("WmNS"),P=re.n(B),R=re("q1tI"),y=re.n(R),A=re("vg9a"),_=re("DlQD"),k=re.n(_),C=re("rUJ1");function E(G,c){var g=G.match(/^(\s+)(?:```)/);if(g===null)return c;var U=g[1];return c.split(`
|
|
`).map(function(q){var H=q.match(/^\s+/);if(H===null)return q;var Ce=Object(K.a)(H,1),Ye=Ce[0];return Ye.length>=U.length?q.slice(U.length):q}).join(`
|
|
`)}var h=[],o=["<ul>"],l=new k.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function S(){h.length=0,o=["<ul>"]}var v={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function p(G,c,g,U){if(c>=G.length||G[c].level<=g)return c;var q=G[c];U.push("<li><a href='#"+q.anchor+"'>"+q.text+"</a>"),c++;var H=[];return c=p(G,c,q.level,H),H.length>0&&(U.push("<ul>"),H.forEach(function(Ce){U.push(Ce)}),U.push("</ul>")),U.push("</li>"),c=p(G,c,g,U),c}function w(){return p(h,0,0,o),o.push("</ul>"),o.join("")}var b={heading:function(c){var g=d.exec(c);if(g)return{type:"heading",raw:g[0],depth:g[1].length,text:g[2]}},fences:function(c){var g=this.rules.block.fences.exec(c);if(g){var U=g[0],q=E(U,g[3]||""),H=g[2]?g[2].trim():g[2];if(["latex","katex","math"].indexOf(H)>=0){var Ce=s(),Ye=q;q=Ce,a[Ce]={type:"block",expression:Ye}}return{type:"code",raw:U,lang:H,text:q}}}},u=/(?:\${2})([^\n`]+?)(?:\${2})/gi,f=0,s=function(){return"__special_katext_id_".concat(f++,"__")},a={};function T(){return a}function m(){f=0,a={}}function x(G){return G=G.replace(u,function(c,g){var U=s();return a[U]={type:"inline",expression:g},U}),G}var D=l.listitem;l.listitem=function(G){return D(x(G))};var j=l.paragraph;l.paragraph=function(G){return j(x(G))};var z=l.tablecell;l.tablecell=function(G,c){return z(x(G),c)},l.code=function(G,c,g){var U=(c||"").match(/\S*/)[0];return U?["latex","katex","math"].indexOf(U)>=0?"<p class='editormd-tex'>".concat(G,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(c,'">').concat(g?G:Object(C.escape)(G,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(g?G:Object(C.escape)(G,!0))+"</code></pre>"},l.heading=function(G,c,g){var U=this.options.headerPrefix+g.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return h.push({anchor:U,level:c,text:G}),"<h"+c+' id="'+U+'">'+G+"</h"+c+">"},k.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),k.a.use({tokenizer:b,renderer:l});var V=k.a,M=re("SJMd"),N=re("ulZh"),Y=re.n(N),oe=re("m3rI"),pe=re("Oy/b"),ve=re("p5ED"),Le=re("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 ke=function(G,c){return(ke=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,U){g.__proto__=U}||function(g,U){for(var q in U)Object.prototype.hasOwnProperty.call(U,q)&&(g[q]=U[q])})(G,c)};function ce(G,c){function g(){this.constructor=G}ke(G,c),G.prototype=c===null?Object.create(c):(g.prototype=c.prototype,new g)}function ae(G,c,g,U){return new(g||(g=Promise))(function(q,H){function Ce(lt){try{nt(U.next(lt))}catch(Xe){H(Xe)}}function Ye(lt){try{nt(U.throw(lt))}catch(Xe){H(Xe)}}function nt(lt){var Xe;lt.done?q(lt.value):(Xe=lt.value,Xe instanceof g?Xe:new g(function(pt){pt(Xe)})).then(Ce,Ye)}nt((U=U.apply(G,c||[])).next())})}function de(G,c){var g,U,q,H,Ce={label:0,sent:function(){if(1&q[0])throw q[1];return q[1]},trys:[],ops:[]};return H={next:Ye(0),throw:Ye(1),return:Ye(2)},typeof Symbol=="function"&&(H[Symbol.iterator]=function(){return this}),H;function Ye(nt){return function(lt){return function(Xe){if(g)throw new TypeError("Generator is already executing.");for(;Ce;)try{if(g=1,U&&(q=2&Xe[0]?U.return:Xe[0]?U.throw||((q=U.return)&&q.call(U),0):U.next)&&!(q=q.call(U,Xe[1])).done)return q;switch(U=0,q&&(Xe=[2&Xe[0],q.value]),Xe[0]){case 0:case 1:q=Xe;break;case 4:return Ce.label++,{value:Xe[1],done:!1};case 5:Ce.label++,U=Xe[1],Xe=[0];continue;case 7:Xe=Ce.ops.pop(),Ce.trys.pop();continue;default:if(!(q=Ce.trys,(q=q.length>0&&q[q.length-1])||Xe[0]!==6&&Xe[0]!==2)){Ce=0;continue}if(Xe[0]===3&&(!q||Xe[1]>q[0]&&Xe[1]<q[3])){Ce.label=Xe[1];break}if(Xe[0]===6&&Ce.label<q[1]){Ce.label=q[1],q=Xe;break}if(q&&Ce.label<q[2]){Ce.label=q[2],Ce.ops.push(Xe);break}q[2]&&Ce.ops.pop(),Ce.trys.pop();continue}Xe=c.call(G,Ce)}catch(pt){Xe=[6,pt],U=0}finally{g=q=0}if(5&Xe[0])throw Xe[1];return{value:Xe[0]?Xe[1]:void 0,done:!0}}([nt,lt])}}}function ne(){for(var G=0,c=0,g=arguments.length;c<g;c++)G+=arguments[c].length;var U=Array(G),q=0;for(c=0;c<g;c++)for(var H=arguments[c],Ce=0,Ye=H.length;Ce<Ye;Ce++,q++)U[q]=H[Ce];return U}var se=function(){function G(){}return G.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},G.setAttributes=function(c,g){for(var U=0,q=g;U<q.length;U++){var H=q[U],Ce=H[0],Ye=H[1];c.setAttribute(Ce,Ye)}},G.createRect=function(c,g,U){var q=document.createElementNS("http://www.w3.org/2000/svg","rect");return q.setAttribute("width",c.toString()),q.setAttribute("height",g.toString()),U&&G.setAttributes(q,U),q},G.createLine=function(c,g,U,q,H){var Ce=document.createElementNS("http://www.w3.org/2000/svg","line");return Ce.setAttribute("x1",c.toString()),Ce.setAttribute("y1",g.toString()),Ce.setAttribute("x2",U.toString()),Ce.setAttribute("y2",q.toString()),H&&G.setAttributes(Ce,H),Ce},G.createPolygon=function(c,g){var U=document.createElementNS("http://www.w3.org/2000/svg","polygon");return U.setAttribute("points",c),g&&G.setAttributes(U,g),U},G.createCircle=function(c,g){var U=document.createElementNS("http://www.w3.org/2000/svg","circle");return U.setAttribute("cx",(c/2).toString()),U.setAttribute("cy",(c/2).toString()),U.setAttribute("r",c.toString()),g&&G.setAttributes(U,g),U},G.createEllipse=function(c,g,U){var q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return q.setAttribute("cx",(c/2).toString()),q.setAttribute("cy",(g/2).toString()),q.setAttribute("rx",(c/2).toString()),q.setAttribute("ry",(g/2).toString()),U&&G.setAttributes(q,U),q},G.createGroup=function(c){var g=document.createElementNS("http://www.w3.org/2000/svg","g");return c&&G.setAttributes(g,c),g},G.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},G.createMarker=function(c,g,U,q,H,Ce,Ye){var nt=document.createElementNS("http://www.w3.org/2000/svg","marker");return G.setAttributes(nt,[["id",c],["orient",g],["markerWidth",U.toString()],["markerHeight",q.toString()],["refX",H.toString()],["refY",Ce.toString()]]),nt.appendChild(Ye),nt},G.createText=function(c){var g=document.createElementNS("http://www.w3.org/2000/svg","text");return g.setAttribute("x","0"),g.setAttribute("y","0"),c&&G.setAttributes(g,c),g},G.createTSpan=function(c,g){var U=document.createElementNS("http://www.w3.org/2000/svg","tspan");return U.textContent=c,g&&G.setAttributes(U,g),U},G.createImage=function(c){var g=document.createElementNS("http://www.w3.org/2000/svg","image");return c&&G.setAttributes(g,c),g},G.createPoint=function(c,g){var U=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return U.x=c,U.y=g,U},G.createPath=function(c,g){var U=document.createElementNS("http://www.w3.org/2000/svg","path");return U.setAttribute("d",c),g&&G.setAttributes(U,g),U},G}(),J=function(){function G(){}return G.addKey=function(c){G.key=c},Object.defineProperty(G,"isLicensed",{get:function(){return!!G.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(G.key)},enumerable:!1,configurable:!0}),G}(),ee=function(){function G(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return G.prototype.rasterize=function(c,g,U){var q=this;return new Promise(function(H){var Ce=U!==void 0?U:document.createElement("canvas");c===null&&(q.markersOnly=!0,q.naturalSize=!1);var Ye=document.createElementNS("http://www.w3.org/2000/svg","svg");Ye.setAttribute("xmlns","http://www.w3.org/2000/svg"),Ye.setAttribute("width",g.width.baseVal.valueAsString),Ye.setAttribute("height",g.height.baseVal.valueAsString),Ye.setAttribute("viewBox","0 0 "+g.viewBox.baseVal.width.toString()+" "+g.viewBox.baseVal.height.toString()),Ye.innerHTML=g.innerHTML,q.naturalSize===!0?(Ye.width.baseVal.value=c.naturalWidth,Ye.height.baseVal.value=c.naturalHeight):q.width!==void 0&&q.height!==void 0&&(Ye.width.baseVal.value=q.width,Ye.height.baseVal.value=q.height),Ce.width=Ye.width.baseVal.value,Ce.height=Ye.height.baseVal.value;var nt=Ye.outerHTML,lt=Ce.getContext("2d");q.markersOnly!==!0&<.drawImage(c,0,0,Ce.width,Ce.height);var Xe=window.URL,pt=new Image(Ce.width,Ce.height);pt.setAttribute("crossOrigin","anonymous");var mt=new Blob([nt],{type:"image/svg+xml"}),It=Xe.createObjectURL(mt);pt.onload=function(){lt.drawImage(pt,0,0),Xe.revokeObjectURL(It);var lr=Ce.toDataURL(q.imageType,q.imageQuality);H(lr)},pt.src=It})},G}(),ie=function(){},fe=function(){function G(c){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+c+"_"}return Object.defineProperty(G.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),G.prototype.addClass=function(c){return this.styleSheet===void 0&&this.addStyleSheet(),c.name=""+this.classNamePrefix+c.localName,this.classes.push(c),this.styleSheet.sheet.insertRule("."+c.name+" {"+c.style+"}",this.styleSheet.sheet.cssRules.length),c},G.prototype.addRule=function(c){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(c),this.styleSheet.sheet.insertRule(c.selector+" {"+c.style+"}",this.styleSheet.sheet.cssRules.length)},G.prototype.addStyleSheet=function(){var c;this.styleSheet=document.createElement("style"),((c=this.styleSheetRoot)!==null&&c!==void 0?c:document.head).appendChild(this.styleSheet),this.addRule(new Ae("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Ae("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new Ae("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new ge("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new ge("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},G.prototype.removeStyleSheet=function(){var c;this.styleSheet&&(((c=this.styleSheetRoot)!==null&&c!==void 0?c:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},G}(),Ae=function(G,c){this.selector=G,this.style=c},ge=function(G,c){this.localName=G,this.style=c},Oe=function(){function G(c,g,U,q,H){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=c,this.displayMode=g,this.markerItems=U,this.uiStyleSettings=q,this.styles=H,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return G.prototype.show=function(c){var g=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=c,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var U=document.createElement("div");U.className=this.toolbarBlockStyleClass.name,U.style.whiteSpace="nowrap",this.uiContainer.appendChild(U),this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(H){var Ce=document.createElement("div");Ce.className=""+g.toolbarButtonStyleClass.name,Ce.setAttribute("data-type-name",H.typeName),Ce.innerHTML=H.icon,Ce.addEventListener("click",function(){g.markerToolbarButtonClicked(Ce,H)}),g.buttons.push(Ce),g.markerButtons.push(Ce)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var q=document.createElement("div");q.className=this.toolbarBlockStyleClass.name,q.style.whiteSpace="nowrap",q.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(q),this.addActionButton(q,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(q,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},G.prototype.addButtonClickListener=function(c){this.buttonClickListeners.push(c)},G.prototype.removeButtonClickListener=function(c){this.buttonClickListeners.indexOf(c)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(c),1)},G.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},G.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 g=0;g<this.markerButtons.length;g++)g<c||g===c&&this.markerButtons.length-1===c?this.markerButtonBlock.appendChild(this.markerButtons[g]):(g===c&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[g]))}},G.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},G.prototype.resetButtonStyles=function(){var c=this;this.buttons.forEach(function(g){g.className=g.className.replace(c.uiStyleSettings.toolbarButtonStyleColorsClassName?c.uiStyleSettings.toolbarButtonStyleColorsClassName:c.toolbarButtonStyleColorsClass.name,"").trim(),g.className=g.className.replace(c.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?c.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:c.toolbarActiveButtonStyleColorsClass.name,"").trim(),g.className+=" "+(c.uiStyleSettings.toolbarButtonStyleColorsClassName?c.uiStyleSettings.toolbarButtonStyleColorsClassName:c.toolbarButtonStyleColorsClass.name)})},G.prototype.addActionButton=function(c,g,U){var q=this,H=document.createElement("div");switch(H.className=""+this.toolbarButtonStyleClass.name,H.innerHTML=g,H.setAttribute("data-action",U),H.addEventListener("click",function(){q.actionToolbarButtonClicked(H,U)}),U){case"select":H.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":H.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":H.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":H.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":H.style.fill=this.uiStyleSettings.closeButtonColor}c.appendChild(H),this.buttons.push(H)},G.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new ge("toolbar",`
|
|
width: 100%;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
height: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
box-sizing: content-box;
|
|
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
overflow: hidden;
|
|
`)),this.toolbarStyleColorsClass=this.styles.addClass(new ge("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new ge("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new ge("toolbar-overflow-block",`
|
|
position: absolute;
|
|
top: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
|
|
z-index: 10;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new ge("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var c=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new ge("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*c)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*c)+`px;
|
|
padding: `+c+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new ge("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new ge("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new Ae("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new Ae("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},G.prototype.markerToolbarButtonClicked=function(c,g){this.setActiveButton(c),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(U){return U("marker",g)}),this.markerButtonOverflowBlock.style.display="none"},G.prototype.actionToolbarButtonClicked=function(c,g){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(U){return U("action",g)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},G.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)},G.prototype.setActiveMarkerButton=function(c){var g=this.markerButtons.find(function(U){return U.getAttribute("data-type-name")===c});g&&this.setActiveButton(g)},G.prototype.setCurrentMarker=function(c){var g=this;this.currentMarker=c,this.buttons.filter(function(U){return/delete|notes/.test(U.getAttribute("data-action"))}).forEach(function(U){g.currentMarker===void 0?(U.style.fillOpacity="0.4",U.style.pointerEvents="none"):(U.style.fillOpacity="1",U.style.pointerEvents="all")})},G}(),Pe=function(){function G(c,g,U,q){this.panels=[],this.panelButtons=[],this.markerjsContainer=c,this.displayMode=g,this.uiStyleSettings=U,this.styles=q,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return G.prototype.addStyles=function(){var c;this.toolboxStyleClass=this.styles.addClass(new ge("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 ge("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var g=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new ge("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new ge("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new ge("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 ge("toolbox-panel-row_colors",`
|
|
background-color: `+((c=this.uiStyleSettings.toolboxBackgroundColor)!==null&&c!==void 0?c:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new ge("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*g)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*g)+`px;
|
|
padding: `+g+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new ge("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new ge("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new Ae("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new Ae("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},G.prototype.show=function(c){var g;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=c,this.uiContainer.className=this.toolboxStyleClass.name+" "+((g=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&g!==void 0?g:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},G.prototype.setPanelButtons=function(c){var g,U,q=this;this.panels=c,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((g=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&g!==void 0?g:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((U=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&U!==void 0?U:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(H){var Ce;H.uiStyleSettings=q.uiStyleSettings;var Ye=document.createElement("div");Ye.className=q.toolboxButtonStyleClass.name+" "+((Ce=q.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Ce!==void 0?Ce:q.toolboxButtonStyleColorsClass.name),Ye.innerHTML=H.icon,Ye.title=H.title,Ye.addEventListener("click",function(){q.panelButtonClick(H)}),q.panelButtons.push(Ye),q.buttonRow.appendChild(Ye)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},G.prototype.panelButtonClick=function(c){var g=this,U=-1;if(c!==this.activePanel){U=this.panels.indexOf(c),this.panelRow.innerHTML="";var q=c.getUi();q.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(q),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=c}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){g.displayMode==="inline"?g.panelRow.style.display="none":g.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(H,Ce){var Ye,nt;H.className=g.toolboxButtonStyleClass.name+" "+(Ce===U?""+((Ye=g.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Ye!==void 0?Ye:g.toolboxActiveButtonStyleColorsClass.name):""+((nt=g.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&nt!==void 0?nt:g.toolboxButtonStyleColorsClass.name))})},G}(),je=function(G,c){this.title=G,this.icon=c},Ke=function(G){function c(g,U,q,H){var Ce=G.call(this,g,H||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return Ce.colors=[],Ce.addTransparent=!1,Ce.colorBoxes=[],Ce.colors=U,Ce.currentColor=q,Ce.setCurrentColor=Ce.setCurrentColor.bind(Ce),Ce.getColorBox=Ce.getColorBox.bind(Ce),Ce}return ce(c,G),c.prototype.getUi=function(){var g=this,U=document.createElement("div");return U.style.overflow="hidden",U.style.whiteSpace="nowrap",this.colors.forEach(function(q){var H=g.getColorBox(q);U.appendChild(H),g.colorBoxes.push(H)}),U},c.prototype.getColorBox=function(g){var U=this,q=this.uiStyleSettings.toolbarHeight/4,H=this.uiStyleSettings.toolbarHeight-q,Ce=document.createElement("div");Ce.style.display="inline-block",Ce.style.boxSizing="content-box",Ce.style.width=H-2+"px",Ce.style.height=H-2+"px",Ce.style.padding="1px",Ce.style.marginRight="2px",Ce.style.marginBottom="2px",Ce.style.borderWidth="2px",Ce.style.borderStyle="solid",Ce.style.borderRadius=(H+2)/2+"px",Ce.style.borderColor=g===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",Ce.addEventListener("click",function(){U.setCurrentColor(g,Ce)});var Ye=document.createElement("div");return Ye.style.display="inline-block",Ye.style.width=H-2+"px",Ye.style.height=H-2+"px",Ye.style.backgroundColor=g,Ye.style.borderRadius=H/2+"px",g==="transparent"&&(Ye.style.fill=this.uiStyleSettings.toolboxAccentColor,Ye.innerHTML=`<svg viewBox="0 0 24 24">
|
|
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
|
|
</svg>`),Ce.appendChild(Ye),Ce},c.prototype.setCurrentColor=function(g,U){var q=this;this.currentColor=g,this.colorBoxes.forEach(function(H){H.style.borderColor=H===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(g)},c}(je),He=function(){function G(c,g,U){this._state="new",this._isSelected=!1,this._container=c,this._overlayContainer=g,this.globalSettings=U,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(G.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),G.prototype.ownsTarget=function(c){return!1},Object.defineProperty(G.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),G.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},G.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},G.prototype.pointerDown=function(c,g){},G.prototype.dblClick=function(c,g){},G.prototype.manipulate=function(c){},G.prototype.pointerUp=function(c){this.stateChanged()},G.prototype.dispose=function(){},G.prototype.addMarkerVisualToContainer=function(c){this.container.childNodes.length>0?this.container.insertBefore(c,this.container.childNodes[0]):this.container.appendChild(c)},G.prototype.getState=function(){return{typeName:G.typeName,state:this.state,notes:this.notes}},G.prototype.restoreState=function(c){this._state=c.state,this.notes=c.notes},G.prototype.scale=function(c,g){},G.prototype.colorChanged=function(c){this.onColorChanged&&this.onColorChanged(c),this.stateChanged()},G.prototype.fillColorChanged=function(c){this.onFillColorChanged&&this.onFillColorChanged(c),this.stateChanged()},G.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)}},G.typeName="MarkerBase",G}(),Fe=function(){function G(){this.findGripByVisual=this.findGripByVisual.bind(this)}return G.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},G}(),qe=function(){function G(){this.GRIP_SIZE=10,this.visual=se.createGroup(),this.visual.appendChild(se.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(se.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return G.prototype.ownsTarget=function(c){return c===this.visual||c===this.visual.childNodes[0]||c===this.visual.childNodes[1]},G}(),De=function(){function G(){}return G.toITransformMatrix=function(c){return{a:c.a,b:c.b,c:c.c,d:c.d,e:c.e,f:c.f}},G.toSVGMatrix=function(c,g){return c.a=g.a,c.b=g.b,c.c=g.c,c.d=g.d,c.e=g.e,c.f=g.f,c},G}(),Ne=function(G){function c(g,U,q){var H=G.call(this,g,U,q)||this;return H.left=0,H.top=0,H.width=0,H.height=0,H.defaultSize={x:50,y:20},H.offsetX=0,H.offsetY=0,H.rotationAngle=0,H.CB_DISTANCE=10,H._suppressMarkerCreateEvent=!1,H.container.transform.baseVal.appendItem(se.createTransform()),H.setupControlBox(),H}return ce(c,G),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(g){this._visual=g;var U=se.createTransform();this._visual.transform.baseVal.appendItem(U)},enumerable:!1,configurable:!0}),c.prototype.ownsTarget=function(g){return!!G.prototype.ownsTarget.call(this,g)||!!(this.controlGrips.findGripByVisual(g)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(g))},c.prototype.pointerDown=function(g,U){G.prototype.pointerDown.call(this,g,U),this.state==="new"&&(this.left=g.x,this.top=g.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var q=this.unrotatePoint(g);if(this.manipulationStartX=q.x,this.manipulationStartY=q.y,this.offsetX=q.x-this.left,this.offsetY=q.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(U),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(U)){this.activeGrip=this.rotatorGrip;var H=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=H.x-this.width/2,this.top=H.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var Ce=this.container.transform.baseVal.getItem(0);Ce.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(Ce,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},c.prototype.pointerUp=function(g){var U=this.state;G.prototype.pointerUp.call(this,g),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(g),this._state="select",U==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},c.prototype.moveVisual=function(g){this.visual.style.transform="translate("+g.x+"px, "+g.y+"px)"},c.prototype.manipulate=function(g){var U=this.unrotatePoint(g);this.state==="creating"?this.resize(g):this.state==="move"?(this.left=this.manipulationStartLeft+(U.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(U.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(U):this.state==="rotate"&&this.rotate(g)},c.prototype.resize=function(g){var U=this.manipulationStartLeft,q=this.manipulationStartWidth,H=this.manipulationStartTop,Ce=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:U=this.manipulationStartLeft+g.x-this.manipulationStartX,q=this.manipulationStartWidth+this.manipulationStartLeft-U;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:q=this.manipulationStartWidth+g.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:H=this.manipulationStartTop+g.y-this.manipulationStartY,Ce=this.manipulationStartHeight+this.manipulationStartTop-H;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:Ce=this.manipulationStartHeight+g.y-this.manipulationStartY}q>=0?(this.left=U,this.width=q):(this.left=U+q,this.width=-q),Ce>=0?(this.top=H,this.height=Ce):(this.top=H+Ce,this.height=-Ce),this.setSize()},c.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},c.prototype.rotate=function(g){if(Math.abs(g.x-this.centerX)>.1){var U=Math.sign(g.x-this.centerX);this.rotationAngle=180*Math.atan((g.y-this.centerY)/(g.x-this.centerX))/Math.PI+90*U,this.applyRotation()}},c.prototype.applyRotation=function(){var g=this.container.transform.baseVal.getItem(0);g.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(g,0)},c.prototype.rotatePoint=function(g){if(this.rotationAngle===0)return g;var U=this.container.getCTM(),q=se.createPoint(g.x,g.y);return{x:(q=q.matrixTransform(U)).x,y:q.y}},c.prototype.unrotatePoint=function(g){if(this.rotationAngle===0)return g;var U=this.container.getCTM();U=U.inverse();var q=se.createPoint(g.x,g.y);return{x:(q=q.matrixTransform(U)).x,y:q.y}},c.prototype.select=function(){G.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},c.prototype.deselect=function(){G.prototype.deselect.call(this),this.controlBox.style.display="none"},c.prototype.setupControlBox=function(){this.controlBox=se.createGroup();var g=se.createTransform();g.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(g),this.container.appendChild(this.controlBox),this.controlRect=se.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=se.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new Fe,this.addControlGrips(),this.controlBox.style.display="none"},c.prototype.adjustControlBox=function(){var g=this.controlBox.transform.baseVal.getItem(0);g.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(g,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 g=new qe;return g.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(g.visual),g},c.prototype.positionGrips=function(){var g=this.controlGrips.topLeft.GRIP_SIZE,U=-g/2,q=U,H=(this.width+this.CB_DISTANCE)/2-g/2,Ce=(this.height+this.CB_DISTANCE)/2-g/2,Ye=this.height+this.CB_DISTANCE-g/2,nt=this.width+this.CB_DISTANCE-g/2;this.positionGrip(this.controlGrips.topLeft.visual,U,q),this.positionGrip(this.controlGrips.topCenter.visual,H,q),this.positionGrip(this.controlGrips.topRight.visual,nt,q),this.positionGrip(this.controlGrips.centerLeft.visual,U,Ce),this.positionGrip(this.controlGrips.centerRight.visual,nt,Ce),this.positionGrip(this.controlGrips.bottomLeft.visual,U,Ye),this.positionGrip(this.controlGrips.bottomCenter.visual,H,Ye),this.positionGrip(this.controlGrips.bottomRight.visual,nt,Ye),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,H,q-3*this.CB_DISTANCE)},c.prototype.positionGrip=function(g,U,q){var H=g.transform.baseVal.getItem(0);H.setTranslate(U,q),g.transform.baseVal.replaceItem(H,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:De.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:De.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},G.prototype.getState.call(this))},c.prototype.restoreState=function(g){G.prototype.restoreState.call(this,g);var U=g;this.left=U.left,this.top=U.top,this.width=U.width,this.height=U.height,this.rotationAngle=U.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(De.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,U.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(De.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,U.containerTransformMatrix))},c.prototype.scale=function(g,U){G.prototype.scale.call(this,g,U);var q=this.rotatePoint({x:this.left,y:this.top}),H=this.unrotatePoint({x:q.x*g,y:q.y*U});this.left=H.x,this.top=H.y,this.width=this.width*g,this.height=this.height*U,this.adjustControlBox()},c}(He),Be=function(G){function c(g,U,q){var H=G.call(this,g,U,q)||this;return H.fillColor="transparent",H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.opacity=1,H.setStrokeColor=H.setStrokeColor.bind(H),H.setFillColor=H.setFillColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.createVisual=H.createVisual.bind(H),H}return ce(c,G),c.prototype.ownsTarget=function(g){return!(!G.prototype.ownsTarget.call(this,g)&&g!==this.visual)},c.prototype.createVisual=function(){this.visual=se.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},c.prototype.pointerDown=function(g,U){G.prototype.pointerDown.call(this,g,U),this.state==="new"&&(this.createVisual(),this.moveVisual(g),this._state="creating")},c.prototype.manipulate=function(g){G.prototype.manipulate.call(this,g)},c.prototype.resize=function(g){G.prototype.resize.call(this,g),this.setSize()},c.prototype.setSize=function(){G.prototype.setSize.call(this),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},c.prototype.pointerUp=function(g){G.prototype.pointerUp.call(this,g),this.setSize()},c.prototype.setStrokeColor=function(g){this.strokeColor=g,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(g),this.stateChanged()},c.prototype.setFillColor=function(g){this.fillColor=g,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},c.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},c.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.visual&&se.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},G.prototype.getState.call(this))},c.prototype.restoreState=function(g){var U=g;this.fillColor=U.fillColor,this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.opacity=U.opacity,this.createVisual(),G.prototype.restoreState.call(this,g),this.setSize()},c.prototype.scale=function(g,U){G.prototype.scale.call(this,g,U),this.setSize()},c.title="Rectangle marker",c}(Ne),ze=function(G){function c(g,U,q,H){var Ce=G.call(this,g,H||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return Ce.widths=[],Ce.widthBoxes=[],Ce.widths=U,Ce.currentWidth=q,Ce.setCurrentWidth=Ce.setCurrentWidth.bind(Ce),Ce}return ce(c,G),c.prototype.getUi=function(){var g=this,U=document.createElement("div");return U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2",this.widths.forEach(function(q){var H=document.createElement("div");H.style.display="flex",H.style.flexGrow="2",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.borderColor=q===g.currentWidth?g.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){g.setCurrentWidth(q,H)}),U.appendChild(H);var Ce=document.createElement("div");Ce.innerText=q.toString(),Ce.style.marginRight="5px",H.appendChild(Ce);var Ye=document.createElement("div");Ye.style.minHeight="20px",Ye.style.flexGrow="2",Ye.style.display="flex",Ye.style.alignItems="center";var nt=document.createElement("hr");nt.style.minWidth="20px",nt.style.border="0px",nt.style.borderTop=q+"px solid "+g.uiStyleSettings.toolboxColor,nt.style.flexGrow="2",Ye.appendChild(nt),H.appendChild(Ye),g.widthBoxes.push(H)}),U},c.prototype.setCurrentWidth=function(g,U){var q=this;this.currentWidth=g,this.widthBoxes.forEach(function(H){H.style.borderColor=H===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},c}(je),Ge=function(G){function c(g,U,q,H){var Ce=G.call(this,g,H||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return Ce.styles=[],Ce.styleBoxes=[],Ce.styles=U,Ce.currentStyle=q,Ce.setCurrentStyle=Ce.setCurrentStyle.bind(Ce),Ce}return ce(c,G),c.prototype.getUi=function(){var g=this,U=document.createElement("div");return U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2",this.styles.forEach(function(q){var H=document.createElement("div");H.style.display="flex",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.overflow="hidden",H.style.maxWidth=100/g.styles.length-5+"%",H.style.borderColor=q===g.currentStyle?g.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){g.setCurrentStyle(q,H)}),U.appendChild(H);var Ce=document.createElement("div");Ce.style.minHeight="20px",Ce.style.flexGrow="2",Ce.style.overflow="hidden";var Ye=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+g.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(q!==""?'stroke-dasharray="'+q+'"':"")+` />
|
|
</svg>`;Ce.innerHTML=Ye,H.appendChild(Ce),g.styleBoxes.push(H)}),U},c.prototype.setCurrentStyle=function(g,U){var q=this;this.currentStyle=g,this.styleBoxes.forEach(function(H){H.style.borderColor=H===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},c}(je),Ve=function(G){function c(g,U,q){var H=G.call(this,g,U,q)||this;return H.strokeColor=q.defaultColor,H.strokeWidth=q.defaultStrokeWidth,H.strokeDasharray=q.defaultStrokeDasharray,H.strokePanel=new Ke("Line color",q.defaultColorSet,q.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new ze("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Ge("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return ce(c,G),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var g=G.prototype.getState.call(this);return g.typeName=c.typeName,g},c.typeName="FrameMarker",c.title="Frame marker",c.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',c}(Be),Re=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1},Qe=function(G){function c(g,U,q){var H=G.call(this,g,U,q)||this;return H.x1=0,H.y1=0,H.x2=0,H.y2=0,H.defaultLength=50,H.manipulationStartX=0,H.manipulationStartY=0,H.manipulationStartX1=0,H.manipulationStartY1=0,H.manipulationStartX2=0,H.manipulationStartY2=0,H.setupControlBox(),H}return ce(c,G),c.prototype.ownsTarget=function(g){return!!G.prototype.ownsTarget.call(this,g)||!(!this.grip1.ownsTarget(g)&&!this.grip2.ownsTarget(g))},c.prototype.pointerDown=function(g,U){G.prototype.pointerDown.call(this,g,U),this.manipulationStartX=g.x,this.manipulationStartY=g.y,this.state==="new"&&(this.x1=g.x,this.y1=g.y,this.x2=g.x,this.y2=g.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(U)?this.activeGrip=this.grip1:this.grip2.ownsTarget(U)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},c.prototype.pointerUp=function(g){var U=this.state;G.prototype.pointerUp.call(this,g),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(g),this._state="select",U==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},c.prototype.adjustVisual=function(){},c.prototype.manipulate=function(g){this.state==="creating"?this.resize(g):this.state==="move"?(this.x1=this.manipulationStartX1+g.x-this.manipulationStartX,this.y1=this.manipulationStartY1+g.y-this.manipulationStartY,this.x2=this.manipulationStartX2+g.x-this.manipulationStartX,this.y2=this.manipulationStartY2+g.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(g)},c.prototype.resize=function(g){switch(this.activeGrip){case this.grip1:this.x1=g.x,this.y1=g.y;break;case this.grip2:case void 0:this.x2=g.x,this.y2=g.y}this.adjustVisual(),this.adjustControlBox()},c.prototype.select=function(){G.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},c.prototype.deselect=function(){G.prototype.deselect.call(this),this.controlBox.style.display="none"},c.prototype.setupControlBox=function(){this.controlBox=se.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 g=new qe;return g.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(g.visual),g},c.prototype.positionGrips=function(){var g=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-g/2,this.y1-g/2),this.positionGrip(this.grip2.visual,this.x2-g/2,this.y2-g/2)},c.prototype.positionGrip=function(g,U,q){var H=g.transform.baseVal.getItem(0);H.setTranslate(U,q),g.transform.baseVal.replaceItem(H,0)},c.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},G.prototype.getState.call(this))},c.prototype.restoreState=function(g){G.prototype.restoreState.call(this,g);var U=g;this.x1=U.x1,this.y1=U.y1,this.x2=U.x2,this.y2=U.y2},c.prototype.scale=function(g,U){G.prototype.scale.call(this,g,U),this.x1=this.x1*g,this.y1=this.y1*U,this.x2=this.x2*g,this.y2=this.y2*U,this.adjustVisual(),this.adjustControlBox()},c}(He),$e=function(G){function c(g,U,q){var H=G.call(this,g,U,q)||this;return H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.setStrokeColor=H.setStrokeColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.strokeColor=q.defaultColor,H.strokeWidth=q.defaultStrokeWidth,H.strokeDasharray=q.defaultStrokeDasharray,H.strokePanel=new Ke("Line color",q.defaultColorSet,q.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new ze("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Ge("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return ce(c,G),c.prototype.ownsTarget=function(g){return!(!G.prototype.ownsTarget.call(this,g)&&g!==this.visual&&g!==this.selectorLine&&g!==this.visibleLine)},c.prototype.createVisual=function(){this.visual=se.createGroup(),this.selectorLine=se.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=se.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},c.prototype.pointerDown=function(g,U){G.prototype.pointerDown.call(this,g,U),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()),se.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},c.prototype.setStrokeColor=function(g){this.strokeColor=g,this.adjustVisual(),this.colorChanged(g)},c.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.adjustVisual()},c.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,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 g=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},G.prototype.getState.call(this));return g.typeName=c.typeName,g},c.prototype.restoreState=function(g){G.prototype.restoreState.call(this,g);var U=g;this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.createVisual(),this.adjustVisual()},c.typeName="LineMarker",c.title="Line marker",c.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',c}(Qe),Me=function(G){function c(g,U,q,H){var Ce=G.call(this,g,H||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return Ce.fonts=[],Ce.fontBoxes=[],Ce.fonts=U,Ce.currentFont=q,Ce.setCurrentFont=Ce.setCurrentFont.bind(Ce),Ce}return ce(c,G),c.prototype.getUi=function(){var g=this,U=document.createElement("div");return U.style.overflow="hidden",U.style.flexGrow="2",this.fonts.forEach(function(q){var H=document.createElement("div");H.style.display="inline-block",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.overflow="hidden",H.style.maxWidth=100/g.fonts.length-5+"%",H.style.borderColor=q===g.currentFont?g.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){g.setCurrentFont(q,H)}),U.appendChild(H);var Ce=document.createElement("div");Ce.style.display="flex",Ce.style.minHeight="20px",Ce.style.flexGrow="2",Ce.style.fontFamily=q,Ce.style.overflow="hidden";var Ye=document.createElement("div");Ye.style.whiteSpace="nowrap",Ye.style.overflow="hidden",Ye.style.textOverflow="ellipsis",Ye.innerHTML="The quick brown fox jumps over the lazy dog",Ce.appendChild(Ye),H.appendChild(Ce),g.fontBoxes.push(H)}),U},c.prototype.setCurrentFont=function(g,U){var q=this;this.currentFont=g,this.fontBoxes.forEach(function(H){H.style.borderColor=H===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},c}(je),We=function(G){function c(g,U,q){var H=G.call(this,g,U,q)||this;return H.color="transparent",H.padding=5,H.DEFAULT_TEXT="your text here",H.text=H.DEFAULT_TEXT,H.isMoved=!1,H.color=q.defaultColor,H.fontFamily=q.defaultFontFamily,H.defaultSize={x:100,y:30},H.setColor=H.setColor.bind(H),H.setFont=H.setFont.bind(H),H.renderText=H.renderText.bind(H),H.sizeText=H.sizeText.bind(H),H.textEditDivClicked=H.textEditDivClicked.bind(H),H.showTextEditor=H.showTextEditor.bind(H),H.setSize=H.setSize.bind(H),H.positionTextEditor=H.positionTextEditor.bind(H),H.colorPanel=new Ke("Color",q.defaultColorSet,q.defaultColor),H.colorPanel.onColorChanged=H.setColor,H.fontFamilyPanel=new Me("Font",q.defaultFontFamilies,q.defaultFontFamily),H.fontFamilyPanel.onFontChanged=H.setFont,H}return ce(c,G),c.prototype.ownsTarget=function(g){if(G.prototype.ownsTarget.call(this,g)||g===this.visual||g===this.textElement||g===this.bgRectangle)return!0;var U=!1;return this.textElement.childNodes.forEach(function(q){q===g&&(U=!0)}),U},c.prototype.createVisual=function(){this.visual=se.createGroup(),this.bgRectangle=se.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=se.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},c.prototype.pointerDown=function(g,U){G.prototype.pointerDown.call(this,g,U),this.isMoved=!1,this.pointerDownPoint=g,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(g),this._state="creating")},c.prototype.renderText=function(){var g=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(U){g.textElement.appendChild(se.createTSpan(U.trim()===""?" ":U.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},c.prototype.getTextScale=function(){var g=this.textElement.getBBox(),U=1;if(g.width>0&&g.height>0){var q=(1*this.width-this.width*this.padding*2/100)/g.width,H=(1*this.height-this.height*this.padding*2/100)/g.height;U=Math.min(q,H)}return U},c.prototype.getTextPosition=function(g){var U=this.textElement.getBBox(),q=0,H=0;return U.width>0&&U.height>0&&(q=(this.width-U.width*g)/2,H=this.height/2-U.height*g/2),{x:q,y:H}},c.prototype.sizeText=function(){var g=this.textElement.getBBox(),U=this.getTextScale(),q=this.getTextPosition(U);q.y-=g.y*U,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+q.x+"px, "+q.y+"px) scale("+U+", "+U+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(q.x,q.y),this.textElement.transform.baseVal.getItem(1).setScale(U,U))},c.prototype.manipulate=function(g){G.prototype.manipulate.call(this,g),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(g.x-this.pointerDownPoint.x)>5||Math.abs(g.y-this.pointerDownPoint.y)>5)},c.prototype.resize=function(g){G.prototype.resize.call(this,g),this.isMoved=!0,this.setSize(),this.sizeText()},c.prototype.setSize=function(){G.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},c.prototype.pointerUp=function(g){var U=this.state;U==="creating"&&(this._suppressMarkerCreateEvent=!0),G.prototype.pointerUp.call(this,g),this.setSize(),(U==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},c.prototype.showTextEditor=function(){var g=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(U){U.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var U=Number.parseFloat(g.textEditor.style.fontSize);g.textEditor.clientWidth>=Number.parseInt(g.textEditor.style.maxWidth)&&U>.9;)U-=.1,g.textEditor.style.fontSize=Math.max(U,.9)+"em"}),this.textEditor.addEventListener("keyup",function(U){U.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(U){if(U.clipboardData){var q=U.clipboardData.getData("text"),H=window.getSelection();if(!H.rangeCount)return!1;H.deleteFromDocument(),H.getRangeAt(0).insertNode(document.createTextNode(q)),U.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){g.textEditDivClicked(g.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 g=this.getTextScale(),U=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),q=this.textElement.getBBox(),H={x:q.width*g,y:q.height*g};U.x-=H.x/2,U.y-=H.y/2,this.textEditor.style.top=U.y+"px",this.textEditor.style.left=U.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-U.x+"px",this.textEditor.style.fontSize=Math.max(16*g,12)+"px",this.textElement.style.display="none"}},c.prototype.textEditDivClicked=function(g){this.text=g.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},c.prototype.select=function(){G.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},c.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),G.prototype.deselect.call(this)},c.prototype.dblClick=function(g,U){G.prototype.dblClick.call(this,g,U),this.showTextEditor()},c.prototype.setColor=function(g){this.textElement&&se.setAttributes(this.textElement,[["fill",g]]),this.color=g,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(g)},c.prototype.setFont=function(g){this.textElement&&se.setAttributes(this.textElement,[["font-family",g]]),this.fontFamily=g,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 g=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},G.prototype.getState.call(this));return g.typeName=c.typeName,g},c.prototype.restoreState=function(g){var U=g;this.color=U.color,this.fontFamily=U.fontFamily,this.padding=U.padding,this.text=U.text,this.createVisual(),G.prototype.restoreState.call(this,g),this.setSize()},c.prototype.scale=function(g,U){G.prototype.scale.call(this,g,U),this.setSize(),this.sizeText(),this.positionTextEditor()},c.typeName="TextMarker",c.title="Text marker",c.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',c}(Ne),Se=function(G){function c(g,U,q){var H=G.call(this,g,U,q)||this;return H.color="transparent",H.lineWidth=3,H.drawing=!1,H.pixelRatio=1,H.color=q.defaultColor,H.lineWidth=q.defaultStrokeWidth,H.pixelRatio=q.freehandPixelRatio,H.setColor=H.setColor.bind(H),H.addCanvas=H.addCanvas.bind(H),H.finishCreation=H.finishCreation.bind(H),H.setLineWidth=H.setLineWidth.bind(H),H.colorPanel=new Ke("Color",q.defaultColorSet,q.defaultColor),H.colorPanel.onColorChanged=H.setColor,H.lineWidthPanel=new ze("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),H.lineWidthPanel.onWidthChanged=H.setLineWidth,H}return ce(c,G),c.prototype.ownsTarget=function(g){return!(!G.prototype.ownsTarget.call(this,g)&&g!==this.visual&&g!==this.drawingImage)},c.prototype.createVisual=function(){this.visual=se.createGroup(),this.drawingImage=se.createImage(),this.visual.appendChild(this.drawingImage);var g=se.createTransform();this.visual.transform.baseVal.appendItem(g),this.addMarkerVisualToContainer(this.visual)},c.prototype.pointerDown=function(g,U){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(g.x,g.y),this.drawing=!0):G.prototype.pointerDown.call(this,g,U)},c.prototype.manipulate=function(g){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(g.x,g.y),this.canvasContext.stroke()):G.prototype.manipulate.call(this,g)},c.prototype.resize=function(g){G.prototype.resize.call(this,g),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},c.prototype.pointerUp=function(g){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):G.prototype.pointerUp.call(this,g)},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(),G.prototype.select.call(this)},c.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),G.prototype.deselect.call(this)},c.prototype.finishCreation=function(){for(var g=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),U=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],q=U[0],H=U[1],Ce=U[2],Ye=U[3],nt=!1,lt=0;lt<this.canvasElement.height;lt++)for(var Xe=0;Xe<this.canvasElement.width;Xe++)g.data[lt*this.canvasElement.width*4+4*Xe+3]>0&&(nt=!0,lt<H&&(H=lt),Xe<q&&(q=Xe),lt>Ye&&(Ye=lt),Xe>Ce&&(Ce=Xe));if(nt){this.left=q/this.pixelRatio,this.top=H/this.pixelRatio,this.width=(Ce-q)/this.pixelRatio,this.height=(Ye-H)/this.pixelRatio;var pt=document.createElement("canvas");pt.width=Ce-q,pt.height=Ye-H,pt.getContext("2d").putImageData(this.canvasContext.getImageData(q,H,Ce-q,Ye-H),0,0),this.drawingImgUrl=pt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},c.prototype.setDrawingImage=function(){se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},c.prototype.setColor=function(g){this.color=g,this.colorChanged(g)},c.prototype.setLineWidth=function(g){this.lineWidth=g},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 g=Object.assign({drawingImgUrl:this.drawingImgUrl},G.prototype.getState.call(this));return g.typeName=c.typeName,g},c.prototype.restoreState=function(g){this.createVisual(),G.prototype.restoreState.call(this,g),this.drawingImgUrl=g.drawingImgUrl,this.setDrawingImage()},c.prototype.scale=function(g,U){G.prototype.scale.call(this,g,U),this.setDrawingImage()},c.typeName="FreehandMarker",c.title="Freehand marker",c.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',c}(Ne),ye=function(G){function c(g,U,q){var H=G.call(this,g,q||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return H.typeBoxes=[],H.currentType=U,H.setCurrentType=H.setCurrentType.bind(H),H}return ce(c,G),c.prototype.getUi=function(){var g=this,U=document.createElement("div");U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2";for(var q=function(Ye){var nt="both";switch(Ye){case 0:nt="both";break;case 1:nt="start";break;case 2:nt="end";break;case 3:nt="none"}var lt=document.createElement("div");if(lt.style.display="flex",lt.style.flexGrow="2",lt.style.alignItems="center",lt.style.justifyContent="space-between",lt.style.padding="5px",lt.style.borderWidth="2px",lt.style.borderStyle="solid",lt.style.borderColor=nt===H.currentType?H.uiStyleSettings.toolboxAccentColor:"transparent",lt.addEventListener("click",function(){g.setCurrentType(nt,lt)}),U.appendChild(lt),nt==="both"||nt==="start"){var Xe=document.createElement("div");Xe.style.display="flex",Xe.style.alignItems="center",Xe.style.minHeight="20px",Xe.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,5 10,0 10,10" fill="`+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Xe.style.marginLeft="5px",lt.appendChild(Xe)}var pt=document.createElement("div");pt.style.display="flex",pt.style.alignItems="center",pt.style.minHeight="20px",pt.style.flexGrow="2";var mt=document.createElement("hr");if(mt.style.minWidth="20px",mt.style.border="0px",mt.style.borderTop="3px solid "+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee"),mt.style.flexGrow="2",pt.appendChild(mt),lt.appendChild(pt),nt==="both"||nt==="end"){var It=document.createElement("div");It.style.display="flex",It.style.alignItems="center",It.style.minHeight="20px",It.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,0 10,5 0,10" fill="`+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,It.style.marginRight="5px",lt.appendChild(It)}H.typeBoxes.push(lt)},H=this,Ce=0;Ce<4;Ce++)q(Ce);return U},c.prototype.setCurrentType=function(g,U){var q=this;this.currentType=g,this.typeBoxes.forEach(function(H){H.style.borderColor=H===U?q.uiStyleSettings!==void 0?q.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},c}(je),xe=function(G){function c(g,U,q){var H=G.call(this,g,U,q)||this;return H.arrowType="end",H.arrowBaseHeight=10,H.arrowBaseWidth=10,H.getArrowPoints=H.getArrowPoints.bind(H),H.setArrowType=H.setArrowType.bind(H),H.arrowTypePanel=new ye("Arrow type","end"),H.arrowTypePanel.onArrowTypeChanged=H.setArrowType,H}return ce(c,G),c.prototype.ownsTarget=function(g){return!(!G.prototype.ownsTarget.call(this,g)&&g!==this.arrow1&&g!==this.arrow2)},c.prototype.getArrowPoints=function(g,U){var q=this.arrowBaseWidth+2*this.strokeWidth,H=this.arrowBaseHeight+2*this.strokeWidth;return g-q/2+","+(U+H/2)+" "+g+","+(U-H/2)+" "+(g+q/2)+","+(U+H/2)},c.prototype.createTips=function(){this.arrow1=se.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=se.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow2)},c.prototype.pointerDown=function(g,U){G.prototype.pointerDown.call(this,g,U),this.state==="creating"&&this.createTips()},c.prototype.adjustVisual=function(){if(G.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",se.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),se.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var g=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),U=this.arrow1.transform.baseVal.getItem(0);U.setRotate(g,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(U,0);var q=this.arrow2.transform.baseVal.getItem(0);q.setRotate(g+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(q,0)}},c.prototype.setArrowType=function(g){this.arrowType=g,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 g=Object.assign({arrowType:this.arrowType},G.prototype.getState.call(this));return g.typeName=c.typeName,g},c.prototype.restoreState=function(g){G.prototype.restoreState.call(this,g);var U=g;this.arrowType=U.arrowType,this.createTips(),this.adjustVisual()},c.typeName="ArrowMarker",c.title="Arrow marker",c.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',c}($e),le=function(G){function c(g,U,q){var H=G.call(this,g,U,q)||this;return H.fillColor=q.defaultFillColor,H.strokeWidth=0,H.fillPanel=new Ke("Color",q.defaultColorSet,q.defaultFillColor),H.fillPanel.onColorChanged=H.setFillColor,H}return ce(c,G),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var g=G.prototype.getState.call(this);return g.typeName=c.typeName,g},c.typeName="CoverMarker",c.title="Cover marker",c.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',c}(Be),ue=function(G){function c(g,U,q,H){var Ce=G.call(this,g,H||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return Ce.opacities=[],Ce.opacityBoxes=[],Ce.opacities=U,Ce.currentOpacity=q,Ce.setCurrentOpacity=Ce.setCurrentOpacity.bind(Ce),Ce}return ce(c,G),c.prototype.getUi=function(){var g=this,U=document.createElement("div");return U.style.display="flex",U.style.overflow="hidden",U.style.flexGrow="2",U.style.justifyContent="space-between",this.opacities.forEach(function(q){var H=document.createElement("div");H.style.display="flex",H.style.alignItems="center",H.style.justifyContent="center",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.borderColor=q===g.currentOpacity?g.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){g.setCurrentOpacity(q,H)}),U.appendChild(H);var Ce=document.createElement("div");Ce.innerText=100*q+"%",H.appendChild(Ce),g.opacityBoxes.push(H)}),U},c.prototype.setCurrentOpacity=function(g,U){var q=this;this.currentOpacity=g,this.opacityBoxes.forEach(function(H){H.style.borderColor=H===U?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},c}(je),me=function(G){function c(g,U,q){var H=G.call(this,g,U,q)||this;return H.setOpacity=H.setOpacity.bind(H),H.fillColor=q.defaultHighlightColor,H.strokeWidth=0,H.opacity=q.defaultHighlightOpacity,H.fillPanel=new Ke("Color",q.defaultColorSet,H.fillColor),H.fillPanel.onColorChanged=H.setFillColor,H.opacityPanel=new ue("Opacity",q.defaultOpacitySteps,H.opacity),H.opacityPanel.onOpacityChanged=H.setOpacity,H}return ce(c,G),c.prototype.setOpacity=function(g){this.opacity=g,this.visual&&se.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 g=G.prototype.getState.call(this);return g.typeName=c.typeName,g},c.typeName="HighlightMarker",c.title="Highlight marker",c.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',c}(le),Ee='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',we=function(G){function c(g,U,q){var H=G.call(this,g,U,q)||this;return H.bgColor="transparent",H.tipPosition={x:0,y:0},H.tipBase1Position={x:0,y:0},H.tipBase2Position={x:0,y:0},H.tipMoving=!1,H.color=q.defaultStrokeColor,H.bgColor=q.defaultFillColor,H.fontFamily=q.defaultFontFamily,H.defaultSize={x:100,y:30},H.setBgColor=H.setBgColor.bind(H),H.getTipPoints=H.getTipPoints.bind(H),H.positionTip=H.positionTip.bind(H),H.setTipPoints=H.setTipPoints.bind(H),H.colorPanel=new Ke("Text color",q.defaultColorSet,H.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),H.colorPanel.onColorChanged=H.setColor,H.bgColorPanel=new Ke("Fill color",q.defaultColorSet,H.bgColor,Ee),H.bgColorPanel.onColorChanged=H.setBgColor,H.fontFamilyPanel=new Me("Font",q.defaultFontFamilies,q.defaultFontFamily),H.fontFamilyPanel.onFontChanged=H.setFont,H.tipGrip=new qe,H.tipGrip.visual.transform.baseVal.appendItem(se.createTransform()),H.controlBox.appendChild(H.tipGrip.visual),H}return ce(c,G),c.prototype.ownsTarget=function(g){return G.prototype.ownsTarget.call(this,g)||this.tipGrip.ownsTarget(g)||this.tip===g},c.prototype.createTip=function(){se.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=se.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},c.prototype.pointerDown=function(g,U){this.state==="new"&&G.prototype.pointerDown.call(this,g,U),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(U)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):G.prototype.pointerDown.call(this,g,U)},c.prototype.pointerUp=function(g){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,G.prototype.pointerUp.call(this,g);else{var U=this.state==="creating";G.prototype.pointerUp.call(this,g),this.setTipPoints(U),this.positionTip()}},c.prototype.manipulate=function(g){if(this.tipMoving){var U=this.unrotatePoint(g);this.tipPosition={x:U.x-this.manipulationStartLeft,y:U.y-this.manipulationStartTop},this.positionTip()}else G.prototype.manipulate.call(this,g)},c.prototype.setBgColor=function(g){this.bgRectangle&&this.tip&&(se.setAttributes(this.bgRectangle,[["fill",g]]),se.setAttributes(this.tip,[["fill",g]])),this.bgColor=g,this.fillColorChanged(g)},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(g){g===void 0&&(g=!1);var U=Math.min(this.height/2,15),q=this.height/5;g&&(this.tipPosition={x:U+q/2,y:this.height+20});var H=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?H<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(q=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:U,y:0},this.tipBase2Position={x:U+q,y:0}):(this.tipBase1Position={x:0,y:U},this.tipBase2Position={x:0,y:U+q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?H<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(q=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-U-q,y:0},this.tipBase2Position={x:this.width-U,y:0}):(this.tipBase1Position={x:this.width,y:U},this.tipBase2Position={x:this.width,y:U+q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?H<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(q=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-U-q,y:this.height},this.tipBase2Position={x:this.width-U,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-U-q},this.tipBase2Position={x:this.width,y:this.height-U}):H<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(q=this.width/5,U=Math.min(this.width/2,15),this.tipBase1Position={x:U,y:this.height},this.tipBase2Position={x:U+q,y:this.height}):(this.tipBase1Position={x:0,y:this.height-U},this.tipBase2Position={x:0,y:this.height-U-q})},c.prototype.resize=function(g){G.prototype.resize.call(this,g),this.positionTip()},c.prototype.positionTip=function(){se.setAttributes(this.tip,[["points",this.getTipPoints()]]);var g=this.tipGrip.visual.transform.baseVal.getItem(0);g.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(g,0)},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),c.prototype.select=function(){this.positionTip(),G.prototype.select.call(this)},c.prototype.getState=function(){var g=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},G.prototype.getState.call(this));return g.typeName=c.typeName,g},c.prototype.restoreState=function(g){var U=g;this.bgColor=U.bgColor,this.tipPosition=U.tipPosition,G.prototype.restoreState.call(this,g),this.createTip(),this.setTipPoints()},c.prototype.scale=function(g,U){G.prototype.scale.call(this,g,U),this.tipPosition={x:this.tipPosition.x*g,y:this.tipPosition.y*U},this.positionTip()},c.typeName="CalloutMarker",c.title="Callout marker",c.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',c}(We),Ie=function(G){function c(g,U,q){var H=G.call(this,g,U,q)||this;return H.fillColor="transparent",H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.opacity=1,H.strokeColor=q.defaultColor,H.strokeWidth=q.defaultStrokeWidth,H.strokeDasharray=q.defaultStrokeDasharray,H.fillColor=q.defaultFillColor,H.setStrokeColor=H.setStrokeColor.bind(H),H.setFillColor=H.setFillColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.setOpacity=H.setOpacity.bind(H),H.createVisual=H.createVisual.bind(H),H.strokePanel=new Ke("Line color",ne(q.defaultColorSet,["transparent"]),q.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.fillPanel=new Ke("Fill color",ne(q.defaultColorSet,["transparent"]),H.fillColor,Ee),H.fillPanel.onColorChanged=H.setFillColor,H.strokeWidthPanel=new ze("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Ge("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H.opacityPanel=new ue("Opacity",q.defaultOpacitySteps,H.opacity),H.opacityPanel.onOpacityChanged=H.setOpacity,H}return ce(c,G),c.prototype.ownsTarget=function(g){return!(!G.prototype.ownsTarget.call(this,g)&&g!==this.visual)},c.prototype.createVisual=function(){this.visual=se.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},c.prototype.pointerDown=function(g,U){G.prototype.pointerDown.call(this,g,U),this.state==="new"&&(this.createVisual(),this.moveVisual(g),this._state="creating")},c.prototype.manipulate=function(g){G.prototype.manipulate.call(this,g)},c.prototype.resize=function(g){G.prototype.resize.call(this,g),this.setSize()},c.prototype.setSize=function(){G.prototype.setSize.call(this),se.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},c.prototype.pointerUp=function(g){G.prototype.pointerUp.call(this,g),this.setSize()},c.prototype.setStrokeColor=function(g){this.strokeColor=g,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(g),this.stateChanged()},c.prototype.setFillColor=function(g){this.fillColor=g,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(g),this.stateChanged()},c.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},c.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.visual&&se.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},c.prototype.setOpacity=function(g){this.opacity=g,this.visual&&se.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var g=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},G.prototype.getState.call(this));return g.typeName=c.typeName,g},c.prototype.restoreState=function(g){var U=g;this.fillColor=U.fillColor,this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.opacity=U.opacity,this.createVisual(),G.prototype.restoreState.call(this,g),this.setSize()},c.prototype.scale=function(g,U){G.prototype.scale.call(this,g,U),this.setSize()},c.typeName="EllipseMarker",c.title="Ellipse marker",c.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',c}(Ne),Ze=function(G){function c(g,U,q){return G.call(this,g,U,q)||this}return ce(c,G),Object.defineProperty(c.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),c.prototype.ownsTarget=function(g){return!(!G.prototype.ownsTarget.call(this,g)&&g!==this.tip1&&g!==this.tip2)},c.prototype.createTips=function(){this.tip1=se.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.tip1),this.tip2=se.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.tip2)},c.prototype.pointerDown=function(g,U){G.prototype.pointerDown.call(this,g,U),this.state==="creating"&&this.createTips()},c.prototype.adjustVisual=function(){if(G.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(se.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var g=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),U=this.tip1.transform.baseVal.getItem(0);U.setRotate(g,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(U,0);var q=this.tip2.transform.baseVal.getItem(0);q.setRotate(g+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(q,0)}},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var g=G.prototype.getState.call(this);return g.typeName=c.typeName,g},c.prototype.restoreState=function(g){G.prototype.restoreState.call(this,g),this.createTips(),this.adjustVisual()},c.typeName="MeasurementMarker",c.title="Measurement marker",c.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',c}($e),at=function(G){function c(g,U,q){var H=G.call(this,g,U,q)||this;return H.strokePanel.colors=q.defaultColorSet,H.fillColor="transparent",H}return ce(c,G),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var g=G.prototype.getState.call(this);return g.typeName=c.typeName,g},c.typeName="EllipseFrameMarker",c.title="Ellipse frame marker",c.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',c}(Ie),ht=function(){function G(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(G.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),G.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))},G.prototype.replaceLastUndoStep=function(c){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=c)},G.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},G.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}},G.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},G}(),ut=function(G){function c(g,U,q){var H=G.call(this,g,U,q)||this;return H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.curveX=0,H.curveY=0,H.manipulationStartCurveX=0,H.manipulationStartCurveY=0,H.setStrokeColor=H.setStrokeColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.positionGrips=H.positionGrips.bind(H),H.addControlGrips=H.addControlGrips.bind(H),H.adjustVisual=H.adjustVisual.bind(H),H.setupControlBox=H.setupControlBox.bind(H),H.resize=H.resize.bind(H),H.strokeColor=q.defaultColor,H.strokeWidth=q.defaultStrokeWidth,H.strokeDasharray=q.defaultStrokeDasharray,H.strokePanel=new Ke("Line color",q.defaultColorSet,q.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new ze("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Ge("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return ce(c,G),c.prototype.ownsTarget=function(g){return!(!G.prototype.ownsTarget.call(this,g)&&g!==this.visual&&g!==this.selectorCurve&&g!==this.visibleCurve&&!this.curveGrip.ownsTarget(g))},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=se.createGroup(),this.selectorCurve=se.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=se.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},c.prototype.pointerDown=function(g,U){G.prototype.pointerDown.call(this,g,U),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=g.x,this.curveY=g.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(U)&&(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()),se.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},c.prototype.setupControlBox=function(){G.prototype.setupControlBox.call(this),this.curveControlLine1=se.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=se.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},c.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,G.prototype.addControlGrips.call(this)},c.prototype.positionGrips=function(){G.prototype.positionGrips.call(this);var g=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-g/2,this.curveY-g/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(g){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+g.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+g.y-this.manipulationStartY),G.prototype.manipulate.call(this,g)},c.prototype.resize=function(g){this.activeGrip===this.curveGrip&&(this.curveX=g.x,this.curveY=g.y),G.prototype.resize.call(this,g),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(g){this.strokeColor=g,this.adjustVisual(),this.colorChanged(g)},c.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.adjustVisual()},c.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.adjustVisual()},c.prototype.scale=function(g,U){this.curveX=this.curveX*g,this.curveY=this.curveY*U,G.prototype.scale.call(this,g,U)},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var g=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},G.prototype.getState.call(this));return g.typeName=c.typeName,g},c.prototype.restoreState=function(g){G.prototype.restoreState.call(this,g);var U=g;this.strokeColor=U.strokeColor,this.strokeWidth=U.strokeWidth,this.strokeDasharray=U.strokeDasharray,this.curveX=U.curveX,this.curveY=U.curveY,this.createVisual(),this.adjustVisual()},c.typeName="CurveMarker",c.title="Curve marker",c.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',c}(Qe),xt=function(){function G(c,g){g===void 0&&(g=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=c,this.cancelable=g}return Object.defineProperty(G.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),G.prototype.preventDefault=function(){this._defaultPrevented=!0},G}(),Ct=function(G){function c(g,U,q){var H=G.call(this,g,!1)||this;return H.dataUrl=U,H.state=q,H}return ce(c,G),c}(xt),st=function(G){function c(g,U,q){q===void 0&&(q=!1);var H=G.call(this,g,q)||this;return H.marker=U,H}return ce(c,G),c}(xt),Mt=function(){function G(){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 G.prototype.addEventListener=function(c,g){this[c].push(g)},G.prototype.removeEventListener=function(c,g){var U=this[c].indexOf(g);U>-1&&this[c].splice(U,1)},G}(),Lt=function(){function G(c){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Re,this._isOpen=!1,this.undoRedoManager=new ht,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 Mt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=G.instanceCounter++,this.styles=new fe(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(G.prototype,"ALL_MARKER_TYPES",{get:function(){return[Ve,Se,xe,We,at,Ie,me,we,Ze,le,$e,ut]},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Ve,Se,xe,We,Ie,me,we]},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Ve,Se,xe,We,me]},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(c){var g=this;this._availableMarkerTypes.splice(0),c.forEach(function(U){if(typeof U=="string"){var q=g.ALL_MARKER_TYPES.find(function(H){return H.typeName===U});q!==void 0&&g._availableMarkerTypes.push(q)}else g._availableMarkerTypes.push(U)})},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(G.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(G.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),G.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),J.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},G.prototype.show=function(){var c=this;this.styles.styleSheetRoot===void 0&&ie.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=ie.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(g){return g(new xt(c))})},G.prototype.render=function(){return ae(this,void 0,void 0,function(){var c;return de(this,function(g){switch(g.label){case 0:return this.setCurrentMarker(),(c=new ee).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 g.sent(),[4,c.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,g.sent()]}})})},G.prototype.close=function(c){var g=this;if(c===void 0&&(c=!1),this.isOpen){var U=!1;c||this.eventListeners.beforeclose.forEach(function(q){var H=new xt(g,!0);q(H),H.defaultPrevented&&(U=!0)}),U||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(q){return q(new xt(g))}),this.detachEvents(),this._isOpen=!1)}},G.prototype.addMarkersToToolbar=function(){for(var c,g=[],U=0;U<arguments.length;U++)g[U]=arguments[U];(c=this._availableMarkerTypes).push.apply(c,g)},G.prototype.addRenderEventListener=function(c){this.addEventListener("render",function(g){c(g.dataUrl,g.state)})},G.prototype.removeRenderEventListener=function(c){},G.prototype.addCloseEventListener=function(c){this.addEventListener("close",function(){c()})},G.prototype.removeCloseEventListener=function(c){},G.prototype.setupResizeObserver=function(){var c=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){c.resize(c.target.clientWidth,c.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return c.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},G.prototype.onPopupTargetResize=function(){var c=1*this.target.clientWidth/this.target.clientHeight,g=this.editorCanvas.clientWidth/c>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*c:this.editorCanvas.clientWidth,U=g<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/c;this.resize(g,U)},G.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},G.prototype.resize=function(c,g){this._isResizing=!0;var U=c/this.imageWidth,q=g/this.imageHeight;this.imageWidth=Math.round(c),this.imageHeight=Math.round(g),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(U,q),this._isResizing=!1},G.prototype.scaleMarkers=function(c,g){var U,q=this;this._currentMarker&&this._currentMarker instanceof We?this._currentMarker.scale(c,g):(U=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(H){H!==q._currentMarker&&H.scale(c,g)}),U!==void 0&&this.setCurrentMarker(U)},G.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},G.prototype.setTopLeft=function(){var c=this.editingTarget.getBoundingClientRect(),g=this.editorCanvas.getBoundingClientRect();this.left=c.left-g.left,this.top=c.top-g.top},G.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},G.prototype.addDefs=function(){for(var c,g=[],U=0;U<arguments.length;U++)g[U]=arguments[U];this.defs=se.createDefs(),this.addDefsToImage(),(c=this.defs).append.apply(c,g)},G.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},G.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},G.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},G.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},G.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},G.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},G.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},G.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var c=document.createElement("a");c.href="https://markerjs.com/",c.target="_blank",c.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',c.title="Powered by marker.js",c.style.display="grid",c.style.alignItems="center",c.style.justifyItems="center",c.style.padding="3px",c.style.width="20px",c.style.height="20px",this.logoUI.appendChild(c),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},G.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")},G.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"},G.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},G.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 Oe(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new Pe(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},G.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},G.prototype.removeMarker=function(c){this.markerImage.removeChild(c.container),this.markers.indexOf(c)>-1&&this.markers.splice(this.markers.indexOf(c),1),c.dispose()},G.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())},G.prototype.toolbarButtonClicked=function(c,g){if(c==="marker"&&g!==void 0)this.createNewMarker(g);else if(c==="action")switch(g){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()}},G.prototype.deleteSelectedMarker=function(){var c=this;if(this._currentMarker!==void 0){var g=!1;if(this.eventListeners.markerbeforedelete.forEach(function(q){var H=new st(c,c._currentMarker,!0);q(H),H.defaultPrevented&&(g=!0)}),!g){var U=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(q){return q(new st(c,U))})}}},G.prototype.clear=function(){var c=this,g=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(Ce){var Ye=new st(c,void 0,!0);Ce(Ye),Ye.defaultPrevented&&(g=!0)}),!g)){this.setCurrentMarker();for(var U=function(Ce){var Ye=q.markers[Ce];q.setCurrentMarker(q.markers[Ce]),q._currentMarker.dispose(),q.markerImage.removeChild(q._currentMarker.container),q.markers.splice(q.markers.indexOf(q._currentMarker),1),q.eventListeners.markerdelete.forEach(function(nt){return nt(new st(c,Ye))})},q=this,H=this.markers.length-1;H>=0;H--)U(H);this.addUndoStep()}},Object.defineProperty(G.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),G.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))},G.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)},G.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},G.prototype.addUndoStep=function(){var c=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var g=this.getState(),U=this.undoRedoManager.getLastUndoStep();if(!U||U.width===g.width&&U.height===g.height){var q=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(g),q<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(H){return H(new xt(c))})}else this.undoRedoManager.replaceLastUndoStep(g),this.eventListeners.statechange.forEach(function(H){return H(new xt(c))})}},G.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},G.prototype.undoStep=function(){var c=this,g=this.undoRedoManager.undo();g!==void 0&&(this.restoreState(g),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(U){return U(new xt(c))}))},G.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},G.prototype.redoStep=function(){var c=this,g=this.undoRedoManager.redo();g!==void 0&&(this.restoreState(g),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(U){return U(new xt(c))}))},G.prototype.stepZoom=function(){var c=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=c<this.zoomSteps.length-1?this.zoomSteps[c+1]:this.zoomSteps[0]},G.prototype.panTo=function(c){this.contentDiv.scrollBy({left:this.prevPanPoint.x-c.x,top:this.prevPanPoint.y-c.y}),this.prevPanPoint=c},G.prototype.startRenderAndClose=function(){return ae(this,void 0,void 0,function(){var c,g,U=this;return de(this,function(q){switch(q.label){case 0:return[4,this.render()];case 1:return c=q.sent(),g=this.getState(),this.eventListeners.render.forEach(function(H){return H(new Ct(U,c,g))}),this.close(!0),[2]}})})},G.prototype.getState=function(c){c===!0&&this.setCurrentMarker();var g={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(U){return g.markers.push(U.getState())}),g},G.prototype.restoreState=function(c){var g=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);c.markers.forEach(function(U){var q=g._availableMarkerTypes.find(function(Ce){return Ce.typeName===U.typeName});if(q!==void 0){var H=g.addNewMarker(q);H.restoreState(U),g.markers.push(H)}}),c.width&&c.height&&(c.width!==this.imageWidth||c.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/c.width,this.imageHeight/c.height),this.eventListeners.restorestate.forEach(function(U){return U(new xt(g))})},G.prototype.addNewMarker=function(c){var g=se.createGroup();return this.markerImage.appendChild(g),new c(g,this.overlayContainer,this.settings)},G.prototype.createNewMarker=function(c){var g,U=this;(g=typeof c=="string"?this._availableMarkerTypes.find(function(q){return q.typeName===c}):c)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(g),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(g.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(q){return q(new st(U,U._currentMarker))}))},G.prototype.markerCreated=function(c){var g=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(c),this.setCurrentMarker(c),c instanceof Se&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Se):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(U){return U(new st(g,g._currentMarker))})},G.prototype.colorChanged=function(c){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=c,this.settings.defaultStrokeColor=c)},G.prototype.fillColorChanged=function(c){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=c)},G.prototype.markerStateChanged=function(c){var g=this;this.eventListeners.markerchange.forEach(function(U){return U(new st(g,c))})},G.prototype.setCurrentMarker=function(c){var g=this;this._currentMarker!==c&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(U){return U(new st(g,g._currentMarker))})),this._currentMarker=c,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(U){return U(new st(g,g._currentMarker))}))},G.prototype.onPointerDown=function(c){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||c.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var g=this.markers.find(function(U){return U.ownsTarget(c.target)});g!==void 0?(this.setCurrentMarker(g),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(c.clientX,c.clientY),c.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:c.clientX,y:c.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(c.clientX,c.clientY))},G.prototype.onDblClick=function(c){if(this._isFocused||this.focus(),this.mode==="select"){var g=this.markers.find(function(U){return U.ownsTarget(c.target)});g!==void 0&&g!==this._currentMarker&&this.setCurrentMarker(g),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(c.clientX,c.clientY),c.target):this.setCurrentMarker()}},G.prototype.onPointerMove=function(c){this.touchPoints!==1&&c.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||c.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(c.clientX,c.clientY)):this.zoomLevel>1&&this.panTo({x:c.clientX,y:c.clientY}))},G.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()},G.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},G.prototype.onKeyUp=function(c){this._currentMarker===void 0||this.notesArea!==void 0||c.key!=="Delete"&&c.key!=="Backspace"||this.deleteSelectedMarker()},G.prototype.clientToLocalCoordinates=function(c,g){var U=this.markerImage.getBoundingClientRect();return{x:(c-U.left)/this.zoomLevel,y:(g-U.top)/this.zoomLevel}},G.prototype.onWindowResize=function(){this.positionUI()},G.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()},G.prototype.addLicenseKey=function(c){J.addKey(c)},G.prototype.addEventListener=function(c,g){this.eventListeners.addEventListener(c,g)},G.prototype.removeEventListener=function(c,g){this.eventListeners.removeEventListener(c,g)},G.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(G.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),G.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(g){return g(new xt(c))}))},G.prototype.blur=function(){var c=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(g){return g(new xt(c))}))},G.instanceCounter=0,G}();/* **********************************
|
|
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 kt=function(G,c){return(kt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,U){g.__proto__=U}||function(g,U){for(var q in U)Object.prototype.hasOwnProperty.call(U,q)&&(g[q]=U[q])})(G,c)};function Dt(G,c){if(typeof c!="function"&&c!==null)throw new TypeError("Class extends value "+String(c)+" is not a constructor or null");function g(){this.constructor=G}kt(G,c),G.prototype=c===null?Object.create(c):(g.prototype=c.prototype,new g)}function Tt(G,c,g,U){return new(g||(g=Promise))(function(q,H){function Ce(lt){try{nt(U.next(lt))}catch(Xe){H(Xe)}}function Ye(lt){try{nt(U.throw(lt))}catch(Xe){H(Xe)}}function nt(lt){var Xe;lt.done?q(lt.value):(Xe=lt.value,Xe instanceof g?Xe:new g(function(pt){pt(Xe)})).then(Ce,Ye)}nt((U=U.apply(G,c||[])).next())})}function Bt(G,c){var g,U,q,H,Ce={label:0,sent:function(){if(1&q[0])throw q[1];return q[1]},trys:[],ops:[]};return H={next:Ye(0),throw:Ye(1),return:Ye(2)},typeof Symbol=="function"&&(H[Symbol.iterator]=function(){return this}),H;function Ye(nt){return function(lt){return function(Xe){if(g)throw new TypeError("Generator is already executing.");for(;Ce;)try{if(g=1,U&&(q=2&Xe[0]?U.return:Xe[0]?U.throw||((q=U.return)&&q.call(U),0):U.next)&&!(q=q.call(U,Xe[1])).done)return q;switch(U=0,q&&(Xe=[2&Xe[0],q.value]),Xe[0]){case 0:case 1:q=Xe;break;case 4:return Ce.label++,{value:Xe[1],done:!1};case 5:Ce.label++,U=Xe[1],Xe=[0];continue;case 7:Xe=Ce.ops.pop(),Ce.trys.pop();continue;default:if(!(q=Ce.trys,(q=q.length>0&&q[q.length-1])||Xe[0]!==6&&Xe[0]!==2)){Ce=0;continue}if(Xe[0]===3&&(!q||Xe[1]>q[0]&&Xe[1]<q[3])){Ce.label=Xe[1];break}if(Xe[0]===6&&Ce.label<q[1]){Ce.label=q[1],q=Xe;break}if(q&&Ce.label<q[2]){Ce.label=q[2],Ce.ops.push(Xe);break}q[2]&&Ce.ops.pop(),Ce.trys.pop();continue}Xe=c.call(G,Ce)}catch(pt){Xe=[6,pt],U=0}finally{g=q=0}if(5&Xe[0])throw Xe[1];return{value:Xe[0]?Xe[1]:void 0,done:!0}}([nt,lt])}}}var Qt=function(){function G(){}return G.addKey=function(c){G.key=c},Object.defineProperty(G,"isLicensed",{get:function(){return!!G.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(G.key)},enumerable:!1,configurable:!0}),G}(),yt=function(){function G(){}return G.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},G.setAttributes=function(c,g){for(var U=0,q=g;U<q.length;U++){var H=q[U],Ce=H[0],Ye=H[1];c.setAttribute(Ce,Ye)}},G.createRect=function(c,g,U){var q=document.createElementNS("http://www.w3.org/2000/svg","rect");return q.setAttribute("width",c.toString()),q.setAttribute("height",g.toString()),U&&G.setAttributes(q,U),q},G.createLine=function(c,g,U,q,H){var Ce=document.createElementNS("http://www.w3.org/2000/svg","line");return Ce.setAttribute("x1",c.toString()),Ce.setAttribute("y1",g.toString()),Ce.setAttribute("x2",U.toString()),Ce.setAttribute("y2",q.toString()),H&&G.setAttributes(Ce,H),Ce},G.createPolygon=function(c,g){var U=document.createElementNS("http://www.w3.org/2000/svg","polygon");return U.setAttribute("points",c),g&&G.setAttributes(U,g),U},G.createCircle=function(c,g){var U=document.createElementNS("http://www.w3.org/2000/svg","circle");return U.setAttribute("cx",(c/2).toString()),U.setAttribute("cy",(c/2).toString()),U.setAttribute("r",c.toString()),g&&G.setAttributes(U,g),U},G.createEllipse=function(c,g,U){var q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return q.setAttribute("cx",(c/2).toString()),q.setAttribute("cy",(g/2).toString()),q.setAttribute("rx",(c/2).toString()),q.setAttribute("ry",(g/2).toString()),U&&G.setAttributes(q,U),q},G.createGroup=function(c){var g=document.createElementNS("http://www.w3.org/2000/svg","g");return c&&G.setAttributes(g,c),g},G.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},G.createMarker=function(c,g,U,q,H,Ce,Ye){var nt=document.createElementNS("http://www.w3.org/2000/svg","marker");return G.setAttributes(nt,[["id",c],["orient",g],["markerWidth",U.toString()],["markerHeight",q.toString()],["refX",H.toString()],["refY",Ce.toString()]]),nt.appendChild(Ye),nt},G.createText=function(c){var g=document.createElementNS("http://www.w3.org/2000/svg","text");return g.setAttribute("x","0"),g.setAttribute("y","0"),c&&G.setAttributes(g,c),g},G.createTSpan=function(c,g){var U=document.createElementNS("http://www.w3.org/2000/svg","tspan");return U.textContent=c,g&&G.setAttributes(U,g),U},G.createImage=function(c){var g=document.createElementNS("http://www.w3.org/2000/svg","image");return c&&G.setAttributes(g,c),g},G.createPoint=function(c,g){var U=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return U.x=c,U.y=g,U},G.createPath=function(c,g){var U=document.createElementNS("http://www.w3.org/2000/svg","path");return U.setAttribute("d",c),g&&G.setAttributes(U,g),U},G.createElement=function(c,g){var U=document.createElementNS("http://www.w3.org/2000/svg",c);return g&&G.setAttributes(U,g),U},G.getHollowRectanglePath=function(c,g,U,q,H,Ce,Ye,nt){return"M"+c+","+g+"V"+(g+q)+"H"+(c+U)+"V"+g+"H"+H+"V"+Ce+"H"+(H+Ye)+"V"+(Ce+nt)+"H"+H+"V"+g+"Z"},G}(),pr=function(){function G(c){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+c+"_"}return Object.defineProperty(G.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),G.prototype.addClass=function(c){return this.styleSheet===void 0&&this.addStyleSheet(),c.name=""+this.classNamePrefix+c.localName,this.classes.push(c),this.styleSheet.sheet.insertRule("."+c.name+" {"+c.style+"}",this.styleSheet.sheet.cssRules.length),c},G.prototype.addRule=function(c){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(c),this.styleSheet.sheet.insertRule(c.selector+" {"+c.style+"}",this.styleSheet.sheet.cssRules.length)},G.prototype.addStyleSheet=function(){var c;this.styleSheet=document.createElement("style"),((c=this.styleSheetRoot)!==null&&c!==void 0?c:document.head).appendChild(this.styleSheet),this.addRule(new jt("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new jt("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new jt("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new tr("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new tr("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},G.prototype.removeStyleSheet=function(){var c;this.styleSheet&&(((c=this.styleSheetRoot)!==null&&c!==void 0?c:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},G}(),jt=function(G,c){this.selector=G,this.style=c},tr=function(G,c){this.localName=G,this.style=c},ur=function(){function G(){this.blocks=[],this.display=""}return G.prototype.addButtonBlock=function(c){c.className=this.blockClassName,c.buttonClassName=this.buttonClassName,c.buttonColorsClassName=this.buttonColorsClassName,c.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(c)},G.prototype.addElementBlock=function(c){c.className===void 0&&(c.className=this.blockClassName),this.blocks.push(c)},G.prototype.getUI=function(){var c=document.createElement("div");return c.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,c.style.display=this.display,this.blocks.forEach(function(g){return c.appendChild(g.getUI())}),c},G}(),nr=function(){function G(){}return G.prototype.getUI=function(){var c=document.createElement("div");if(c.className=this.className,this.minWidth!==void 0&&(c.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":c.style.justifyContent="flex-start";break;case"center":c.style.justifyContent="center";break;case"end":c.style.justifyContent="flex-end"}return c.style.whiteSpace="nowrap",c},G}(),vr=function(G){function c(){var g=G!==null&&G.apply(this,arguments)||this;return g.buttons=[],g}return Dt(c,G),c.prototype.addButton=function(g){g.className=this.buttonClassName,g.colorsClassName=this.buttonColorsClassName,g.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(g)},c.prototype.getUI=function(){var g=G.prototype.getUI.call(this);return this.buttons.forEach(function(U){return g.appendChild(U.getUI())}),g},c}(nr),Ut=function(){function G(c,g){this._isActive=!1,this._isHidden=!1,this._icon=c,this.title=g,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(G.prototype,"icon",{get:function(){return this._icon},set:function(c){this._icon=c,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isActive",{get:function(){return this._isActive},set:function(c){this._isActive=c,this.adjustClassName()},enumerable:!1,configurable:!0}),G.prototype.getUI=function(){var c=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return c.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},G.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},G.prototype.hide=function(){this._isHidden=!0},G}(),ft=function(G){function c(){var g=G!==null&&G.apply(this,arguments)||this;return g.elements=[],g}return Dt(c,G),c.prototype.addElement=function(g){this.elements.push(g)},c.prototype.getUI=function(){var g=G.prototype.getUI.call(this);return this.elements.forEach(function(U){return g.appendChild(U)}),g},c}(nr),sr=function(){function G(c,g){this.horizontal=c,this.vertical=g}return Object.defineProperty(G.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),G.prototype.getVerticalLength=function(c){return c/this.ratio},G.prototype.getHorizontalLength=function(c){return c*this.ratio},G}(),Tr=function(){function G(){}return G.getIcon=function(c,g){if(c>0&&g>0){var U=new sr(c,g),q=U.ratio>=1?20:U.getHorizontalLength(20),H=U.ratio<1?20:U.getVerticalLength(20),Ce=document.createElementNS("http://www.w3.org/2000/svg","svg");Ce.setAttribute("xmlns","http://www.w3.org/2000/svg"),Ce.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(Ce);var Ye=yt.createDefs();Ce.appendChild(Ye);var nt=yt.createElement("clipPath",[["id","text-bg-clip"]]);Ye.appendChild(nt);var lt=yt.createPath(yt.getHollowRectanglePath((24-q)/2,(24-H)/2,q,H,(24-q)/2+2,(24-H)/2+2,q-4,H-4));Ce.appendChild(lt);var Xe=yt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Xe.appendChild(yt.createTSpan(c+":"+g)),Ce.appendChild(Xe);var pt=Xe.getBBox();yt.setAttributes(Xe,[["x",((24-pt.width)/2).toString()],["y",((24-pt.height)/2-pt.y).toString()]]);var mt=yt.createPath(yt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(pt.width))/2,(24-Math.ceil(pt.height))/2,Math.ceil(pt.width),Math.ceil(pt.height)));return nt.appendChild(mt),yt.setAttributes(lt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(Ce),Ce.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},G}(),gr=function(G){function c(g,U,q){var H=G.call(this,g,U)||this;return H.isDropdownOpen=!1,H.onClick=H.dropdownButtonClicked,H.dropdownButtons=q,H}return Dt(c,G),c.prototype.setupDropdown=function(){var g=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(U){U.className=g.className,U.colorsClassName=g.colorsClassName,g.dropdownBlock.appendChild(U.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}(Ut),Pt=function(){function G(c,g){this.GRIP_SIZE=10,this.color=c,this.fillColor=g,this.visual=yt.createGroup(),this.visual.appendChild(yt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(yt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return G.prototype.ownsTarget=function(c){return c===this.visual||c===this.visual.childNodes[0]||c===this.visual.childNodes[1]},G.prototype.setCenter=function(c,g){this.visual.childNodes.forEach(function(U){return yt.setAttributes(U,[["cx",c.toString()],["cy",g.toString()]])})},G}(),yr=function(){function G(c,g,U,q){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=c,this.canvasHeight=g,this.margin=U,this.container=q,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(G.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(G.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(c){this._isGridVisible=c,this.gridContainer&&yt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(c){this._zoomFactor=c,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),G.prototype.open=function(){var c=this;this.cropShadeElement=yt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=yt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var g=0;g<this.numberOfGridLines;g++)this.horizontalGridLines.push(yt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(yt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(U){return c.gridContainer.appendChild(U)}),this.verticalGridLines.forEach(function(U){return c.gridContainer.appendChild(U)}),this.cropRectElement=yt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Pt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Pt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Pt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Pt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},G.prototype.setCropRectangle=function(c){this.cropRect=c;var g=Object.assign({},this.cropRect);this.zoomFactor!==1&&(g.width=this.cropRect.width*this.zoomFactor,g.height=this.cropRect.height*this.zoomFactor,g.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-g.width/2,g.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-g.height/2),yt.setAttributes(this.cropRectElement,[["x",g.x.toString()],["y",g.y.toString()],["width",g.width.toString()],["height",g.height.toString()]]);var U=g.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(H,Ce){var Ye=g.y+U*(Ce+1);yt.setAttributes(H,[["x1",""+g.x],["y1",""+Ye],["x2",""+(g.x+g.width)],["y2",""+Ye]])});var q=g.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(H,Ce){var Ye=g.x+q*(Ce+1);yt.setAttributes(H,[["x1",""+Ye],["y1",""+g.y],["x2",""+Ye],["y2",""+(g.y+g.height)]])}),yt.setAttributes(this.cropShadeElement,[["d",yt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,g.x,g.y,g.width,g.height)]]),this.topLeftGrip.setCenter(g.x,g.y),this.topRightGrip.setCenter(g.x+g.width,g.y),this.bottomLeftGrip.setCenter(g.x,g.y+g.height),this.bottomRightGrip.setCenter(g.x+g.width,g.y+g.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},G.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)},G.prototype.clientToLocalCoordinates=function(c,g){var U=this.container.getBoundingClientRect();return{x:c-U.left+this.margin,y:g-U.top+this.margin}},G.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)},G.prototype.onPointerMove=function(c){if(this.isMoving)this.move(this.clientToLocalCoordinates(c.clientX,c.clientY));else if(this.activeGrip){var g=this.clientToLocalCoordinates(c.clientX,c.clientY);this.resize(g)}c.preventDefault()},G.prototype.onPointerUp=function(c){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(c.pointerId)},G.prototype.move=function(c){var g=c.x-this.previousPoint.x,U=c.y-this.previousPoint.y;this.zoomFactor!==1&&(g=-g/this.zoomFactor,U=-U/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+g),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+U),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=c},G.prototype.resize=function(c){var g=Object.assign({},this.cropRect),U=c.x-this.previousPoint.x,q=c.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:g.x+U<this.margin&&(U=this.margin-g.x),g.x+=U,g.width=this.cropRect.x+this.cropRect.width-g.x;break;case this.bottomRightGrip:case this.topRightGrip:g.width+U>this.canvasWidth*this.zoomFactor&&(U=this.canvasWidth*this.zoomFactor-g.width),g.width+=U}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(g.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(U),g.height=this.aspectRatio.getVerticalLength(g.width)):(g.y+=q,g.height=this.cropRect.y+this.cropRect.height-g.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?g.height=this.aspectRatio.getVerticalLength(g.width):g.height+=q}g.width<10&&(g.x=this.cropRect.x,g.width=10),g.height<10&&(g.y=this.cropRect.y,g.height=10),this.previousPoint=c,g.x>=this.margin&&g.y>=this.margin&&g.x-this.margin+g.width<=this.canvasWidth&&g.y-this.margin+g.height<=this.canvasHeight&&(this.cropRect=g,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},G.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,g=this.cropRect.y+this.cropRect.height/2,U=this.aspectRatio.getHorizontalLength(this.cropRect.height),q=this.aspectRatio.getVerticalLength(this.cropRect.width);U/this.canvasWidth<q/this.canvasHeight?this.cropRect.width=U:this.cropRect.height=q,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=c-this.cropRect.width/2,this.cropRect.y=g-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)}},G.prototype.getRescaledRect=function(c,g,U,q,H,Ce){var Ye=U/c,nt=q/g;return{x:(H.x-Ce)*Ye+Ce,y:(H.y-Ce)*nt+Ce,width:H.width*Ye,height:H.height*nt}},G.prototype.scaleCanvas=function(c,g){var U=this.getRescaledRect(this.canvasWidth,this.canvasHeight,c,g,this.cropRect,this.margin);this.canvasWidth=c,this.canvasHeight=g,this.onCropChange&&this.onCropChange(U),this.setCropRectangle(U)},G}(),dr=function(){function G(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(G.prototype,"angle",{get:function(){return this._angle},set:function(c){this._angle=c,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),G.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},G.prototype.onPointerDown=function(c){this.controlContainer.setPointerCapture(c.pointerId),this.isDragging=!0,this.previousPoint={x:c.clientX,y:c.clientY}},G.prototype.onPointerMove=function(c){this.isDragging&&(this.onAngleChange&&this.onAngleChange((c.clientX-this.previousPoint.x)/5),this.previousPoint.x=c.clientX)},G.prototype.onPointerUp=function(c){this.isDragging&&this.onAngleChange&&this.onAngleChange((c.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(c.pointerId)},G.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var c=this.angleLabelText.getBBox();yt.setAttributes(this.angleLabelElement,[["x",((this.width-c.width)/2).toString()],["y",(this.height/2).toString()]])}},G.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)}},G.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 g="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,U=1;U<=this.width/5+10;U++){var q=U%5==0?this.height/3:this.height/6;g+="h4v"+-q+"h1v"+q}g+="v1H0Z",this.scaleShape=yt.createPath(g);var H=yt.createTransform();this.scaleShape.transform.baseVal.appendItem(H),c.appendChild(this.scaleShape),this.angleLabelElement=yt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=yt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var Ce=yt.createTSpan("");return Ce.innerHTML="°",this.angleLabelElement.appendChild(Ce),c.appendChild(this.angleLabelElement),document.body.removeChild(c),c},G}(),qr=function(){function G(){this.naturalSize=!1,this.imageType="image/png"}return G.prototype.rasterize=function(c,g,U,q,H,Ce,Ye){var nt=this;return new Promise(function(lt){var Xe=document.createElement("canvas");Xe.width=c.width.baseVal.value-2*q,Xe.height=c.height.baseVal.value-2*q;var pt=1,mt=1;nt.naturalSize===!0?(pt=g.naturalWidth/(c.width.baseVal.value-2*q)/Ce,mt=g.naturalHeight/(c.height.baseVal.value-2*q)/Ye,Xe.width=g.naturalWidth/Ce,Xe.height=g.naturalHeight/Ye):nt.width!==void 0&&nt.height!==void 0&&(pt=nt.width/U.width,mt=nt.height/U.height,Xe.width*=pt,Xe.height*=mt);var It=Xe.getContext("2d");It.translate(Xe.width/2,Xe.height/2),It.rotate(H*Math.PI/180),It.scale(Ce,Ye),It.translate(-Xe.width/2,-Xe.height/2),It.drawImage(g,0,0,Xe.width,Xe.height);var lr=document.createElement("canvas");lr.width=U.width*pt,lr.height=U.height*mt,lr.getContext("2d").putImageData(It.getImageData((U.x-q)*pt,(U.y-q)*mt,U.width*pt,U.height*mt),0,0),lt(lr.toDataURL(nt.imageType,nt.imageQuality))})},G}(),et=function(){function G(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=G.instanceCounter++,this.styles=new pr(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(G.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(c){this._zoomToCropEnabled=c,c?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(G.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(G.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(G.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(G.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(G.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}),G.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},G.prototype.show=function(){this.showUI(),this.open()},G.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(g){return g()}),this._isOpen=!1)},G.prototype.addRenderEventListener=function(c){this.renderEventListeners.push(c)},G.prototype.removeRenderEventListener=function(c){this.renderEventListeners.indexOf(c)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(c),1)},G.prototype.addCloseEventListener=function(c){this.closeEventListeners.push(c)},G.prototype.removeCloseEventListener=function(c){this.closeEventListeners.indexOf(c)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(c),1)},G.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))},G.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var c=1*this.target.clientWidth/this.target.clientHeight,g=this.contentDiv.clientWidth/c>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*c:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,U=g+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/c;this.resize(g,U)}},G.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},G.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",yt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},G.prototype.resize=function(c,g){this.imageWidth=Math.round(c),this.imageHeight=Math.round(g),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},G.prototype.setEditingTarget=function(){var c=document.createElement("canvas");c.width=this.target.naturalWidth,c.height=this.target.naturalHeight,c.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var g=c.toDataURL();yt.setAttributes(this.editingTarget,[["href",g]]),this.setEditingTargetSize()},G.prototype.setTopLeft=function(){var c=this.target.getBoundingClientRect(),g=this.editorCanvas.getBoundingClientRect();this.left=c.left-g.left-this.CANVAS_MARGIN,this.top=c.top-g.top-this.CANVAS_MARGIN},G.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=yt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=yt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=yt.createGroup(),this.editingTargetRotationScaleContainer=yt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var c=yt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(c);var g=yt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(g),this.editingTargetContainer=yt.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},G.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},G.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=yt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new yr(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},G.prototype.zoomToCrop=function(){if(this.cropRect){var c=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,g=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=c+"px "+g+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-c+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-g+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},G.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},G.prototype.cropRectChanged=function(c){this.cropRect=c,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},G.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},G.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"},G.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},G.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var c=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,g=this.target.offsetTop>c+this.CANVAS_MARGIN?this.target.offsetTop-(c+this.CANVAS_MARGIN):0;this.coverDiv.style.top=g+"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},G.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},G.prototype.addTopToolbar=function(){var c=this;this.topToolbar=new ur,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 g=new vr;g.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(g);var U=[];this.aspectRatios.forEach(function(mt){var It=new Ut(Tr.getIcon(mt.horizontal,mt.vertical),mt.horizontal===0&&mt.vertical===0?"FREE":mt.horizontal+":"+mt.vertical);It.onClick=function(){return c.ratioButtonClicked(mt)},U.push(It)}),this.aspectRatioButton=new gr(Tr.getIcon(0,0),"Aspect ratio",U),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,g.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var q=new Ut('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");q.isActive=this.isGridVisible,q.onClick=function(){c.isGridVisible=!c.isGridVisible,q.isActive=c.isGridVisible},g.addButton(q);var H=new Ut('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(H.isActive=this.zoomToCropEnabled,H.onClick=function(){c.zoomToCropEnabled=!c.zoomToCropEnabled,H.isActive=c.zoomToCropEnabled},g.addButton(H),!Qt.isLicensed){var Ce=new ft;this.topToolbar.addElementBlock(Ce);var Ye=document.createElement("div");Ye.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='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',Ye.appendChild(nt),Ce.addElement(Ye)}var lt=new vr;lt.minWidth=3*this.toolbarHeight+"px",lt.contentAlign="end",this.topToolbar.addButtonBlock(lt);var Xe=new Ut('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");Xe.onClick=this.startRenderAndClose,lt.addButton(Xe),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Xe.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var pt=new Ut('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");pt.onClick=this.close,lt.addButton(pt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(pt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},G.prototype.addBottomToolbar=function(){var c=this;this.bottomToolbar=new ur,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 g=new vr;g.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(g);var U=new Ut('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");U.onClick=this.rotateLeftButtonClicked,g.addButton(U);var q=new Ut('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");q.onClick=this.rotateRightButtonClicked,g.addButton(q);var H=new ft;H.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(H),this.straightener=new dr("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(lt){c.rotateBy(lt),c.straightener.angle=c.rotationAngle},H.addElement(this.straightener.getUI());var Ce=new vr;Ce.minWidth=2*this.toolbarHeight+"px",Ce.contentAlign="end",this.bottomToolbar.addButtonBlock(Ce);var Ye=new Ut('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");Ye.onClick=this.flipHorizontallyButtonClicked,Ce.addButton(Ye);var nt=new Ut('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");nt.onClick=this.flipVerticallyButtonClicked,Ce.addButton(nt)},G.prototype.ratioButtonClicked=function(c){this.aspectRatio=c,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},G.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Tr.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},G.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new sr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},G.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},G.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},G.prototype.restoreState=function(c){if(c){var g=this.cropLayer.getRescaledRect(c.width,c.height,this.imageWidth,this.imageHeight,c.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(g),this.cropRectChanged(g),this.flippedHorizontally=c.flippedHorizontally,this.flippedVertically=c.flippedVertically,this.applyFlip(),this.rotationAngle=c.rotationAngle,this.applyRotation()}},G.prototype.clientToLocalCoordinates=function(c,g){var U=this.cropImage.getBoundingClientRect();return{x:c-U.left,y:g-U.top}},G.prototype.onWindowResize=function(){this.positionUI()},G.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()},G.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)},G.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)},G.prototype.rotateTo=function(c){c=(c=c>180?c-360:c)<=-180?c+360:c,this.rotationAngle=c,this.applyRotation()},G.prototype.rotateBy=function(c){this.rotateTo((this.rotationAngle+c)%360)},G.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 g=this.editingTargetRotationContainer.transform.baseVal.getItem(0);g.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(g,0);var U=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/U.width,this.imageHeight/U.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=c},G.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},G.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},G.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},G.prototype.startRenderAndClose=function(){return Tt(this,void 0,void 0,function(){var c,g;return Bt(this,function(U){switch(U.label){case 0:return[4,this.render()];case 1:return c=U.sent(),g=this.getState(),this.renderEventListeners.forEach(function(q){return q(c,g)}),this.close(!0),[2]}})})},G.prototype.render=function(){return Tt(this,void 0,void 0,function(){var c;return Bt(this,function(g){switch(g.label){case 0:return(c=new qr).naturalSize=this.renderAtNaturalSize,c.imageType=this.renderImageType,c.imageQuality=this.renderImageQuality,c.width=this.renderWidth,c.height=this.renderHeight,this.unzoomFromCrop(),yt.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 g.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,g.sent()]}})})},G.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new tr("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 tr("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new tr("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var c=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new tr("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 tr("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new tr("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new jt("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new jt("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new tr("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 tr("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new tr("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 tr("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 tr("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},G.instanceCounter=0,G}(),wt=re("8hTe"),zr=re.n(wt),Ir=/<pre[^>]*>/g;function Zr(G){var c=document.createElement("div");return c.innerHTML=G,c.childNodes.length===0?"":c.childNodes[0].nodeValue}var Wr=rt.a=function(G){var c=G.value,g=c===void 0?"":c,U=G.edit,q=U===void 0?!1:U,H=G.className,Ce=G.showTextOnly,Ye=G.showLines,nt=G.replaces,lt=G.zoomImg,Xe=G.hasMask,pt=G.style,mt=pt===void 0?{}:pt,It=G.stylesPrev,lr=It===void 0?{}:It,$t=String(g),rr=Object(R.useRef)(),xr=Object(R.useRef)(),Nr=Object(R.useState)(""),ir=Object(K.a)(Nr,2),Xt=ir[0],wr=ir[1],Hr=Object(R.useState)("office"),ar=Object(K.a)(Hr,2),yn=ar[0],Ar=ar[1],_r=function(){var Ht=new et(xr.current);Ht.displayMode="popup",Ht.addRenderEventListener(function(){var br=Object(I.a)(P.a.mark(function Ft(cr){var zt;return P.a.wrap(function(mr){for(;;)switch(mr.prev=mr.next){case 0:return rr.current.style.display="none",mr.next=3,Object(Le.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:cr}});case 3:zt=mr.sent,zt!=null&&zt.id&&nt(xr.current.getAttribute("src").replace(oe.a.API_SERVER,""),"/api/attachments/".concat(zt==null?void 0:zt.id,"?type=").concat(zt.content_type));case 5:case"end":return mr.stop()}},Ft)}));return function(Ft){return br.apply(this,arguments)}}()),Ht.show()},Rn=function(){var Ht=new Lt(xr.current);Ht.settings.displayMode="popup",Ht.addEventListener("render",function(){var br=Object(I.a)(P.a.mark(function Ft(cr){var zt;return P.a.wrap(function(mr){for(;;)switch(mr.prev=mr.next){case 0:if(rr.current.style.display="none",!xr.current){mr.next=6;break}return mr.next=4,Object(Le.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:cr.dataUrl}});case 4:zt=mr.sent,zt!=null&&zt.id&&nt(xr.current.getAttribute("src").replace(oe.a.API_SERVER,""),"/api/attachments/".concat(zt==null?void 0:zt.id,"?type=").concat(zt.content_type));case 6:case"end":return mr.stop()}},Ft)}));return function(Ft){return br.apply(this,arguments)}}()),Ht.show(),window.markerArea=Ht},Nt=Object(R.useMemo)(function(){rr.current&&(rr.current.style.zIndex=-1);try{var Zt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Ht=/\"\/api\/attachments\/|\"\/attachments\/download\//g,br=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;$t=$t.replace(Zt,"("+oe.a.API_SERVER+"/api/attachments/").replace(Ht,'"'+oe.a.API_SERVER+"/api/attachments/").replace(br,'"'+oe.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`)}catch(Vr){}var Ft=V($t),cr=T();if($t.match(/\[TOC\]/)&&(Ft=Ft.replace("<p>[TOC]</p>",w()),S()),Ft=Ft.replace(/(__special_katext_id_\d+__)/g,function(Vr,mr){var Lr=cr[mr],ln=Lr.type,pn=Lr.expression;return Object(pe.renderToString)(Zr(pn)||"",{displayMode:ln==="block",throwOnError:!1,output:"html"})}),Ft=Ft.replace(/▁/g,"\u2581\u2581\u2581"),m(),Ce){var zt=document.createElement("div");return zt.innerHTML=Ft,zt.innerText}return setTimeout(function(){return Cr()},500),Ft},[$t]),vt=Object(R.useRef)();v.WebkitLineClamp=Ye,Ye&&(mt=Object(F.a)(Object(F.a)({},mt),v));function ot(Zt){var Ht=Zt.target;if(Ht.tagName.toUpperCase()==="IMG"){if(lt){var br=Ht.getAttribute("src");wr(br),Ar("image")}}else if(Ht.tagName.toUpperCase()==="A"){var Ft=Ht.getAttribute("href");if(Ft.indexOf("office")>-1)Zt.preventDefault(),wr(Ft),Ar("office");else if(Ft.indexOf("application/pdf")>-1)Zt.preventDefault(),wr(Ft),Ar("pdf");else if(Ft.indexOf("text/html")>-1)Zt.preventDefault(),wr(Ft),Ar("html");else if(Ft.startsWith("#")){Zt.preventDefault();var cr=document.getElementById(Ft.replace("#",""));cr&&cr.scrollIntoView(!0)}}}var Cr=function(){var Ht,br=(Ht=vt.current)===null||Ht===void 0?void 0:Ht.querySelectorAll("video");br==null||br.forEach(function(Ft){if(Ft.oncontextmenu=function(){return!1},Ft.src.indexOf(".m3u8")>-1&&!Ft.canPlayType("application/vnd.apple.mpegurl")){if(Y.a.isSupported()){var cr=new Y.a;cr.loadSource(Ft.src),cr.attachMedia(Ft)}}})};Object(R.useEffect)(function(){if(vt.current&&Nt&&(Nt.match(Ir)&&window.PR.prettyPrint()),vt.current)return vt.current.addEventListener("click",ot),function(){vt.current.removeEventListener("click",ot),m(),S()}},[Nt,vt.current,ot]);var Yt=function(Ht){if(!q)return;Ht.target.nodeName==="IMG"?(rr.current.style.zIndex=1,rr.current.style.display="flex",rr.current.style.width=Ht.target.clientWidth+"px",rr.current.style.height=Ht.target.clientHeight+"px",rr.current.style.top=Ht.target.offsetTop+"px",rr.current.style.left=Ht.target.offsetLeft+"px",xr.current.src=Ht.target.getAttribute("src")):rr.current.style.display="none"};return y.a.createElement("div",{style:{position:"relative"}},y.a.createElement("div",{ref:vt,style:Object(F.a)({},mt),className:"".concat(H||""," markdown-body ").concat(zr.a.mdBody),onMouseOver:Yt,dangerouslySetInnerHTML:{__html:Nt}}),y.a.createElement("div",{ref:rr,className:zr.a.button},y.a.createElement($.a,null,y.a.createElement(Z.a,{onClick:function(){return _r()}},"\u88C1\u526A"),y.a.createElement(Z.a,{onClick:function(){return Rn()}},"\u7F16\u8F91"))),y.a.createElement("img",{ref:xr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),y.a.createElement(ve.a,{close:!0,data:Xt,type:Xt!=null&&Xt.length?yn:"",style:Object(F.a)({},lr),onClose:function(){return wr("")}}))}},"9VGf":function(Et,rt,re){"use strict";re.d(rt,"a",function(){return O});var he=re("q1tI"),$=re.n(he);function O(Z,F){var I=Object(he.useRef)();Object(he.useEffect)(function(){I.current=Z}),Object(he.useEffect)(function(){function K(){I.current()}if(F!==null){var B=setInterval(K,F);return function(){return clearInterval(B)}}},[F])}},Bd2K:function(Et,rt,re){(function(he){he(re("VrN/"),re("osHv"))})(function(he){he.defineOption("autoCloseTags",!1,function(P,R,y){if(y!=he.Init&&y&&P.removeKeyMap("autoCloseTags"),!R)return;var A={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(A["'/'"]=function(_){return I(_)}),(typeof R!="object"||R.whenOpening!==!1)&&(A["'>'"]=function(_){return Z(_)}),P.addKeyMap(A)});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 Z(P){if(P.getOption("disableInput"))return he.Pass;for(var R=P.listSelections(),y=[],A=P.getOption("autoCloseTags"),_=0;_<R.length;_++){if(!R[_].empty())return he.Pass;var k=R[_].head,C=P.getTokenAt(k),E=he.innerMode(P.getMode(),C.state),h=E.state,o=E.mode.xmlCurrentTag&&E.mode.xmlCurrentTag(h),l=o&&o.name;if(!l)return he.Pass;var d=E.mode.configuration=="html",S=typeof A=="object"&&A.dontCloseTags||d&&$,v=typeof A=="object"&&A.indentTags||d&&O;C.end>k.ch&&(l=l.slice(0,l.length-C.end+k.ch));var p=l.toLowerCase();if(!l||C.type=="string"&&(C.end!=k.ch||!/[\"\']/.test(C.string.charAt(C.string.length-1))||C.string.length==1)||C.type=="tag"&&o.close||C.string.indexOf("/")==k.ch-C.start-1||S&&K(S,p)>-1||B(P,E.mode.xmlCurrentContext&&E.mode.xmlCurrentContext(h)||[],l,k,!0))return he.Pass;var w=typeof A=="object"&&A.emptyTags;if(w&&K(w,l)>-1){y[_]={text:"/>",newPos:he.Pos(k.line,k.ch+2)};continue}var b=v&&K(v,p)>-1;y[_]={indent:b,text:">"+(b?`
|
|
|
|
`:"")+"</"+l+">",newPos:b?he.Pos(k.line+1,0):he.Pos(k.line,k.ch+1)}}for(var u=typeof A=="object"&&A.dontIndentOnAutoClose,_=R.length-1;_>=0;_--){var f=y[_];P.replaceRange(f.text,R[_].head,R[_].anchor,"+insert");var s=P.listSelections().slice(0);s[_]={head:f.newPos,anchor:f.newPos},P.setSelections(s),!u&&f.indent&&(P.indentLine(f.newPos.line,null,!0),P.indentLine(f.newPos.line+1,null,!0))}}function F(P,R){for(var y=P.listSelections(),A=[],_=R?"/":"</",k=P.getOption("autoCloseTags"),C=typeof k=="object"&&k.dontIndentOnSlash,E=0;E<y.length;E++){if(!y[E].empty())return he.Pass;var h=y[E].head,o=P.getTokenAt(h),l=he.innerMode(P.getMode(),o.state),d=l.state;if(R&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=h.ch-1))return he.Pass;var S,v=l.mode.name!="xml"&&P.getMode().name=="htmlmixed";if(v&&l.mode.name=="javascript")S=_+"script";else if(v&&l.mode.name=="css")S=_+"style";else{var p=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(d);if(!p||p.length&&B(P,p,p[p.length-1],h))return he.Pass;S=_+p[p.length-1]}P.getLine(h.line).charAt(o.end)!=">"&&(S+=">"),A[E]=S}if(P.replaceSelections(A),y=P.listSelections(),!C)for(var E=0;E<y.length;E++)(E==y.length-1||y[E].head.line<y[E+1].head.line)&&P.indentLine(y[E].head.line)}function I(P){return P.getOption("disableInput")?he.Pass:F(P,!0)}he.commands.closeTag=function(P){return F(P)};function K(P,R){if(P.indexOf)return P.indexOf(R);for(var y=0,A=P.length;y<A;++y)if(P[y]==R)return y;return-1}function B(P,R,y,A,_){if(!he.scanForClosingTag)return!1;var k=Math.min(P.lastLine()+1,A.line+500),C=he.scanForClosingTag(P,A,null,k);if(!C||C.tag!=y)return!1;for(var E=_?1:0,h=R.length-1;h>=0&&R[h]==y;h--)++E;A=C.to;for(var h=1;h<E;h++){var o=he.scanForClosingTag(P,A,null,k);if(!o||o.tag!=y)return!1;A=o.to}return!0}})},BjJ7:function(Et,rt,re){"use strict";re.d(rt,"d",function(){return $}),re.d(rt,"c",function(){return O}),re.d(rt,"e",function(){return Z}),re.d(rt,"b",function(){return F}),re.d(rt,"a",function(){return K});var he=re("m3rI");function $(B){var P=!0;if(B.length>0){for(var R=0;R<B.length;R++)if(B[R].compile_success==0||!B[R].compile_success){P=!1;break}}else P=!1;return P}function O(B){for(var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",R=[],y=0;y<B.length;y++){var A=B[y],_=P?"".concat(P,"/").concat(A.name):"".concat(A.name);R.push({title:A.name,isLeaf:!(A.type==="tree"),key:_})}return R}function Z(B,P,R){for(var y=0;y<B.length;y++){var A=B[y];if(A.key===P){A.children=R;break}A.children&&Z(A.children,P,R)}return B}function F(B,P,R){var y;return function(){var A=this,_=arguments,k=function(){y=null,R||B.apply(A,_)},C=R&&!y;clearTimeout(y),y=setTimeout(k,P),C&&B.apply(A,_)}}var I=!0,K=he.a.API_SERVER},"C+DQ":function(Et,rt,re){},DlQD:function(Et,rt,re){(function(he,$){Et.exports=$()})(this,function(){"use strict";function he(Se,ye){for(var xe=0;xe<ye.length;xe++){var le=ye[xe];le.enumerable=le.enumerable||!1,le.configurable=!0,"value"in le&&(le.writable=!0),Object.defineProperty(Se,le.key,le)}}function $(Se,ye,xe){return ye&&he(Se.prototype,ye),xe&&he(Se,xe),Se}function O(Se,ye){if(!Se)return;if(typeof Se=="string")return Z(Se,ye);var xe=Object.prototype.toString.call(Se).slice(8,-1);if(xe==="Object"&&Se.constructor&&(xe=Se.constructor.name),xe==="Map"||xe==="Set")return Array.from(Se);if(xe==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(xe))return Z(Se,ye)}function Z(Se,ye){(ye==null||ye>Se.length)&&(ye=Se.length);for(var xe=0,le=new Array(ye);xe<ye;xe++)le[xe]=Se[xe];return le}function F(Se,ye){var xe;if(typeof Symbol=="undefined"||Se[Symbol.iterator]==null){if(Array.isArray(Se)||(xe=O(Se))||ye&&Se&&typeof Se.length=="number"){xe&&(Se=xe);var le=0;return function(){return le>=Se.length?{done:!0}:{done:!1,value:Se[le++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return xe=Se[Symbol.iterator](),xe.next.bind(xe)}function I(Se,ye){return ye={exports:{}},Se(ye,ye.exports),ye.exports}var K=I(function(Se){function ye(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function xe(le){Se.exports.defaults=le}Se.exports={defaults:ye(),getDefaults:ye,changeDefaults:xe}}),B=K.defaults,P=K.getDefaults,R=K.changeDefaults,y=/[&<>"']/,A=/[&<>"']/g,_=/[<>"']|&(?!#?\w+;)/,k=/[<>"']|&(?!#?\w+;)/g,C={"&":"&","<":"<",">":">",'"':""","'":"'"},E=function(ye){return C[ye]};function h(Se,ye){if(ye){if(y.test(Se))return Se.replace(A,E)}else if(_.test(Se))return Se.replace(k,E);return Se}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(Se){return Se.replace(o,function(ye,xe){return xe=xe.toLowerCase(),xe==="colon"?":":xe.charAt(0)==="#"?xe.charAt(1)==="x"?String.fromCharCode(parseInt(xe.substring(2),16)):String.fromCharCode(+xe.substring(1)):""})}var d=/(^|[^\[])\^/g;function S(Se,ye){Se=Se.source||Se,ye=ye||"";var xe={replace:function(ue,me){return me=me.source||me,me=me.replace(d,"$1"),Se=Se.replace(ue,me),xe},getRegex:function(){return new RegExp(Se,ye)}};return xe}var v=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function w(Se,ye,xe){if(Se){var le;try{le=decodeURIComponent(l(xe)).replace(v,"").toLowerCase()}catch(ue){return null}if(le.indexOf("javascript:")===0||le.indexOf("vbscript:")===0||le.indexOf("data:")===0)return null}ye&&!p.test(xe)&&(xe=a(ye,xe));try{xe=encodeURI(xe).replace(/%25/g,"%")}catch(ue){return null}return xe}var b={},u=/^[^:]+:\/*[^/]*$/,f=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(Se,ye){b[" "+Se]||(u.test(Se)?b[" "+Se]=Se+"/":b[" "+Se]=D(Se,"/",!0)),Se=b[" "+Se];var xe=Se.indexOf(":")===-1;return ye.substring(0,2)==="//"?xe?ye:Se.replace(f,"$1")+ye:ye.charAt(0)==="/"?xe?ye:Se.replace(s,"$1")+ye:Se+ye}var T={exec:function(){}};function m(Se){for(var ye=1,xe,le;ye<arguments.length;ye++){xe=arguments[ye];for(le in xe)Object.prototype.hasOwnProperty.call(xe,le)&&(Se[le]=xe[le])}return Se}function x(Se,ye){var xe=Se.replace(/\|/g,function(me,Ee,we){for(var Ie=!1,Ze=Ee;--Ze>=0&&we[Ze]==="\\";)Ie=!Ie;return Ie?"|":" |"}),le=xe.split(/ \|/),ue=0;if(le.length>ye)le.splice(ye);else for(;le.length<ye;)le.push("");for(;ue<le.length;ue++)le[ue]=le[ue].trim().replace(/\\\|/g,"|");return le}function D(Se,ye,xe){var le=Se.length;if(le===0)return"";for(var ue=0;ue<le;){var me=Se.charAt(le-ue-1);if(me===ye&&!xe)ue++;else if(me!==ye&&xe)ue++;else break}return Se.substr(0,le-ue)}function j(Se,ye){if(Se.indexOf(ye[1])===-1)return-1;for(var xe=Se.length,le=0,ue=0;ue<xe;ue++)if(Se[ue]==="\\")ue++;else if(Se[ue]===ye[0])le++;else if(Se[ue]===ye[1]&&(le--,le<0))return ue;return-1}function z(Se){Se&&Se.sanitize&&!Se.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var V={escape:h,unescape:l,edit:S,cleanUrl:w,resolveUrl:a,noopTest:T,merge:m,splitCells:x,rtrim:D,findClosingBracket:j,checkSanitizeDeprecation:z},M=K.defaults,N=V.rtrim,Y=V.splitCells,oe=V.escape,pe=V.findClosingBracket;function ve(Se,ye,xe){var le=ye.href,ue=ye.title?oe(ye.title):null,me=Se[1].replace(/\\([\[\]])/g,"$1");return Se[0].charAt(0)!=="!"?{type:"link",raw:xe,href:le,title:ue,text:me}:{type:"image",raw:xe,href:le,title:ue,text:oe(me)}}function Le(Se,ye){var xe=Se.match(/^(\s+)(?:```)/);if(xe===null)return ye;var le=xe[1];return ye.split(`
|
|
`).map(function(ue){var me=ue.match(/^\s+/);if(me===null)return ue;var Ee=me[0];return Ee.length>=le.length?ue.slice(le.length):ue}).join(`
|
|
`)}var ke=function(){function Se(xe){this.options=xe||M}var ye=Se.prototype;return ye.space=function(le){var ue=this.rules.block.newline.exec(le);if(ue)return ue[0].length>1?{type:"space",raw:ue[0]}:{raw:`
|
|
`}},ye.code=function(le,ue){var me=this.rules.block.code.exec(le);if(me){var Ee=ue[ue.length-1];if(Ee&&Ee.type==="paragraph")return{raw:me[0],text:me[0].trimRight()};var we=me[0].replace(/^ {4}/gm,"");return{type:"code",raw:me[0],codeBlockStyle:"indented",text:this.options.pedantic?we:N(we,`
|
|
`)}}},ye.fences=function(le){var ue=this.rules.block.fences.exec(le);if(ue){var me=ue[0],Ee=Le(me,ue[3]||"");return{type:"code",raw:me,lang:ue[2]?ue[2].trim():ue[2],text:Ee}}},ye.heading=function(le){var ue=this.rules.block.heading.exec(le);if(ue)return{type:"heading",raw:ue[0],depth:ue[1].length,text:ue[2]}},ye.nptable=function(le){var ue=this.rules.block.nptable.exec(le);if(ue){var me={type:"table",header:Y(ue[1].replace(/^ *| *\| *$/g,"")),align:ue[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ue[3]?ue[3].replace(/\n$/,"").split(`
|
|
`):[],raw:ue[0]};if(me.header.length===me.align.length){var Ee=me.align.length,we;for(we=0;we<Ee;we++)/^ *-+: *$/.test(me.align[we])?me.align[we]="right":/^ *:-+: *$/.test(me.align[we])?me.align[we]="center":/^ *:-+ *$/.test(me.align[we])?me.align[we]="left":me.align[we]=null;for(Ee=me.cells.length,we=0;we<Ee;we++)me.cells[we]=Y(me.cells[we],me.header.length);return me}}},ye.hr=function(le){var ue=this.rules.block.hr.exec(le);if(ue)return{type:"hr",raw:ue[0]}},ye.blockquote=function(le){var ue=this.rules.block.blockquote.exec(le);if(ue){var me=ue[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ue[0],text:me}}},ye.list=function(le){var ue=this.rules.block.list.exec(le);if(ue){for(var me=ue[0],Ee=ue[2],we=Ee.length>1,Ie=Ee[Ee.length-1]===")",Ze={type:"list",raw:me,ordered:we,start:we?+Ee.slice(0,-1):"",loose:!1,items:[]},at=ue[0].match(this.rules.block.item),ht=!1,ut,xt,Ct,st,Mt,Lt,kt,Dt=at.length,Tt=0;Tt<Dt;Tt++)ut=at[Tt],me=ut,xt=ut.length,ut=ut.replace(/^ *([*+-]|\d+[.)]) */,""),~ut.indexOf(`
|
|
`)&&(xt-=ut.length,ut=this.options.pedantic?ut.replace(/^ {1,4}/gm,""):ut.replace(new RegExp("^ {1,"+xt+"}","gm"),"")),Tt!==Dt-1&&(Ct=this.rules.block.bullet.exec(at[Tt+1])[0],(we?Ct.length===1||!Ie&&Ct[Ct.length-1]===")":Ct.length>1||this.options.smartLists&&Ct!==Ee)&&(st=at.slice(Tt+1).join(`
|
|
`),Ze.raw=Ze.raw.substring(0,Ze.raw.length-st.length),Tt=Dt-1)),Mt=ht||/\n\n(?!\s*$)/.test(ut),Tt!==Dt-1&&(ht=ut.charAt(ut.length-1)===`
|
|
`,Mt||(Mt=ht)),Mt&&(Ze.loose=!0),Lt=/^\[[ xX]\] /.test(ut),kt=void 0,Lt&&(kt=ut[1]!==" ",ut=ut.replace(/^\[[ xX]\] +/,"")),Ze.items.push({type:"list_item",raw:me,task:Lt,checked:kt,loose:Mt,text:ut});return Ze}},ye.html=function(le){var ue=this.rules.block.html.exec(le);if(ue)return{type:this.options.sanitize?"paragraph":"html",raw:ue[0],pre:!this.options.sanitizer&&(ue[1]==="pre"||ue[1]==="script"||ue[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ue[0]):oe(ue[0]):ue[0]}},ye.def=function(le){var ue=this.rules.block.def.exec(le);if(ue){ue[3]&&(ue[3]=ue[3].substring(1,ue[3].length-1));var me=ue[1].toLowerCase().replace(/\s+/g," ");return{tag:me,raw:ue[0],href:ue[2],title:ue[3]}}},ye.table=function(le){var ue=this.rules.block.table.exec(le);if(ue){var me={type:"table",header:Y(ue[1].replace(/^ *| *\| *$/g,"")),align:ue[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ue[3]?ue[3].replace(/\n$/,"").split(`
|
|
`):[]};if(me.header.length===me.align.length){me.raw=ue[0];var Ee=me.align.length,we;for(we=0;we<Ee;we++)/^ *-+: *$/.test(me.align[we])?me.align[we]="right":/^ *:-+: *$/.test(me.align[we])?me.align[we]="center":/^ *:-+ *$/.test(me.align[we])?me.align[we]="left":me.align[we]=null;for(Ee=me.cells.length,we=0;we<Ee;we++)me.cells[we]=Y(me.cells[we].replace(/^ *\| *| *\| *$/g,""),me.header.length);return me}}},ye.lheading=function(le){var ue=this.rules.block.lheading.exec(le);if(ue)return{type:"heading",raw:ue[0],depth:ue[2].charAt(0)==="="?1:2,text:ue[1]}},ye.paragraph=function(le){var ue=this.rules.block.paragraph.exec(le);if(ue)return{type:"paragraph",raw:ue[0],text:ue[1].charAt(ue[1].length-1)===`
|
|
`?ue[1].slice(0,-1):ue[1]}},ye.text=function(le,ue){var me=this.rules.block.text.exec(le);if(me){var Ee=ue[ue.length-1];return Ee&&Ee.type==="text"?{raw:me[0],text:me[0]}:{type:"text",raw:me[0],text:me[0]}}},ye.escape=function(le){var ue=this.rules.inline.escape.exec(le);if(ue)return{type:"escape",raw:ue[0],text:oe(ue[1])}},ye.tag=function(le,ue,me){var Ee=this.rules.inline.tag.exec(le);if(Ee)return!ue&&/^<a /i.test(Ee[0])?ue=!0:ue&&/^<\/a>/i.test(Ee[0])&&(ue=!1),!me&&/^<(pre|code|kbd|script)(\s|>)/i.test(Ee[0])?me=!0:me&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(Ee[0])&&(me=!1),{type:this.options.sanitize?"text":"html",raw:Ee[0],inLink:ue,inRawBlock:me,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Ee[0]):oe(Ee[0]):Ee[0]}},ye.link=function(le){var ue=this.rules.inline.link.exec(le);if(ue){var me=pe(ue[2],"()");if(me>-1){var Ee=ue[0].indexOf("!")===0?5:4,we=Ee+ue[1].length+me;ue[2]=ue[2].substring(0,me),ue[0]=ue[0].substring(0,we).trim(),ue[3]=""}var Ie=ue[2],Ze="";if(this.options.pedantic){var at=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ie);at?(Ie=at[1],Ze=at[3]):Ze=""}else Ze=ue[3]?ue[3].slice(1,-1):"";Ie=Ie.trim().replace(/^<([\s\S]*)>$/,"$1");var ht=ve(ue,{href:Ie&&Ie.replace(this.rules.inline._escapes,"$1"),title:Ze&&Ze.replace(this.rules.inline._escapes,"$1")},ue[0]);return ht}},ye.reflink=function(le,ue){var me;if((me=this.rules.inline.reflink.exec(le))||(me=this.rules.inline.nolink.exec(le))){var Ee=(me[2]||me[1]).replace(/\s+/g," ");if(Ee=ue[Ee.toLowerCase()],!Ee||!Ee.href){var we=me[0].charAt(0);return{type:"text",raw:we,text:we}}var Ie=ve(me,Ee,me[0]);return Ie}},ye.strong=function(le,ue,me){me===void 0&&(me="");var Ee=this.rules.inline.strong.start.exec(le);if(Ee&&(!Ee[1]||Ee[1]&&(me===""||this.rules.inline.punctuation.exec(me)))){ue=ue.slice(-1*le.length);var we=Ee[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;we.lastIndex=0;for(var Ie;(Ee=we.exec(ue))!=null;)if(Ie=this.rules.inline.strong.middle.exec(ue.slice(0,Ee.index+3)),Ie)return{type:"strong",raw:le.slice(0,Ie[0].length),text:le.slice(2,Ie[0].length-2)}}},ye.em=function(le,ue,me){me===void 0&&(me="");var Ee=this.rules.inline.em.start.exec(le);if(Ee&&(!Ee[1]||Ee[1]&&(me===""||this.rules.inline.punctuation.exec(me)))){ue=ue.slice(-1*le.length);var we=Ee[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;we.lastIndex=0;for(var Ie;(Ee=we.exec(ue))!=null;)if(Ie=this.rules.inline.em.middle.exec(ue.slice(0,Ee.index+2)),Ie)return{type:"em",raw:le.slice(0,Ie[0].length),text:le.slice(1,Ie[0].length-1)}}},ye.codespan=function(le){var ue=this.rules.inline.code.exec(le);if(ue){var me=ue[2].replace(/\n/g," "),Ee=/[^ ]/.test(me),we=me.startsWith(" ")&&me.endsWith(" ");return Ee&&we&&(me=me.substring(1,me.length-1)),me=oe(me,!0),{type:"codespan",raw:ue[0],text:me}}},ye.br=function(le){var ue=this.rules.inline.br.exec(le);if(ue)return{type:"br",raw:ue[0]}},ye.del=function(le){var ue=this.rules.inline.del.exec(le);if(ue)return{type:"del",raw:ue[0],text:ue[1]}},ye.autolink=function(le,ue){var me=this.rules.inline.autolink.exec(le);if(me){var Ee,we;return me[2]==="@"?(Ee=oe(this.options.mangle?ue(me[1]):me[1]),we="mailto:"+Ee):(Ee=oe(me[1]),we=Ee),{type:"link",raw:me[0],text:Ee,href:we,tokens:[{type:"text",raw:Ee,text:Ee}]}}},ye.url=function(le,ue){var me;if(me=this.rules.inline.url.exec(le)){var Ee,we;if(me[2]==="@")Ee=oe(this.options.mangle?ue(me[0]):me[0]),we="mailto:"+Ee;else{var Ie;do Ie=me[0],me[0]=this.rules.inline._backpedal.exec(me[0])[0];while(Ie!==me[0]);Ee=oe(me[0]),me[1]==="www."?we="http://"+Ee:we=Ee}return{type:"link",raw:me[0],text:Ee,href:we,tokens:[{type:"text",raw:Ee,text:Ee}]}}},ye.inlineText=function(le,ue,me){var Ee=this.rules.inline.text.exec(le);if(Ee){var we;return ue?we=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Ee[0]):oe(Ee[0]):Ee[0]:we=oe(this.options.smartypants?me(Ee[0]):Ee[0]),{type:"text",raw:Ee[0],text:we}}},Se}(),ce=V.noopTest,ae=V.edit,de=V.merge,ne={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:ce,table:ce,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ne._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ne._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ne.def=ae(ne.def).replace("label",ne._label).replace("title",ne._title).getRegex(),ne.bullet=/(?:[*+-]|\d{1,9}[.)])/,ne.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ne.item=ae(ne.item,"gm").replace(/bull/g,ne.bullet).getRegex(),ne.list=ae(ne.list).replace(/bull/g,ne.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ne.def.source+")").getRegex(),ne._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",ne._comment=/<!--(?!-?>)[\s\S]*?-->/,ne.html=ae(ne.html,"i").replace("comment",ne._comment).replace("tag",ne._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ne.paragraph=ae(ne._paragraph).replace("hr",ne.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ne._tag).getRegex(),ne.blockquote=ae(ne.blockquote).replace("paragraph",ne.paragraph).getRegex(),ne.normal=de({},ne),ne.gfm=de({},ne.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*|$)"}),ne.gfm.nptable=ae(ne.gfm.nptable).replace("hr",ne.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ne._tag).getRegex(),ne.gfm.table=ae(ne.gfm.table).replace("hr",ne.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ne._tag).getRegex(),ne.pedantic=de({},ne.normal,{html:ae(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ne._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:ce,paragraph:ae(ne.normal._paragraph).replace("hr",ne.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ne.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var se={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ce,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:ce,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};se._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",se.punctuation=ae(se.punctuation).replace(/punctuation/g,se._punctuation).getRegex(),se._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",se._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",se.em.start=ae(se.em.start).replace(/punctuation/g,se._punctuation).getRegex(),se.em.middle=ae(se.em.middle).replace(/punctuation/g,se._punctuation).replace(/overlapSkip/g,se._overlapSkip).getRegex(),se.em.endAst=ae(se.em.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.em.endUnd=ae(se.em.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.start=ae(se.strong.start).replace(/punctuation/g,se._punctuation).getRegex(),se.strong.middle=ae(se.strong.middle).replace(/punctuation/g,se._punctuation).replace(/blockSkip/g,se._blockSkip).getRegex(),se.strong.endAst=ae(se.strong.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.endUnd=ae(se.strong.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.blockSkip=ae(se._blockSkip,"g").getRegex(),se.overlapSkip=ae(se._overlapSkip,"g").getRegex(),se._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,se._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,se._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,se.autolink=ae(se.autolink).replace("scheme",se._scheme).replace("email",se._email).getRegex(),se._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,se.tag=ae(se.tag).replace("comment",ne._comment).replace("attribute",se._attribute).getRegex(),se._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,se._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,se._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,se.link=ae(se.link).replace("label",se._label).replace("href",se._href).replace("title",se._title).getRegex(),se.reflink=ae(se.reflink).replace("label",se._label).getRegex(),se.reflinkSearch=ae(se.reflinkSearch,"g").replace("reflink",se.reflink).replace("nolink",se.nolink).getRegex(),se.normal=de({},se),se.pedantic=de({},se.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:ae(/^!?\[(label)\]\((.*?)\)/).replace("label",se._label).getRegex(),reflink:ae(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",se._label).getRegex()}),se.gfm=de({},se.normal,{escape:ae(se.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),se.gfm.url=ae(se.gfm.url,"i").replace("email",se.gfm._extended_email).getRegex(),se.breaks=de({},se.gfm,{br:ae(se.br).replace("{2,}","*").getRegex(),text:ae(se.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var J={block:ne,inline:se},ee=K.defaults,ie=J.block,fe=J.inline;function Ae(Se){return Se.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function ge(Se){var ye="",xe,le,ue=Se.length;for(xe=0;xe<ue;xe++)le=Se.charCodeAt(xe),Math.random()>.5&&(le="x"+le.toString(16)),ye+="&#"+le+";";return ye}var Oe=function(){function Se(xe){this.tokens=[],this.tokens.links=Object.create(null),this.options=xe||ee,this.options.tokenizer=this.options.tokenizer||new ke,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var le={block:ie.normal,inline:fe.normal};this.options.pedantic?(le.block=ie.pedantic,le.inline=fe.pedantic):this.options.gfm&&(le.block=ie.gfm,this.options.breaks?le.inline=fe.breaks:le.inline=fe.gfm),this.tokenizer.rules=le}Se.lex=function(le,ue){var me=new Se(ue);return me.lex(le)};var ye=Se.prototype;return ye.lex=function(le){return le=le.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(le,this.tokens,!0),this.inline(this.tokens),this.tokens},ye.blockTokens=function(le,ue,me){ue===void 0&&(ue=[]),me===void 0&&(me=!0),le=le.replace(/^ +$/gm,"");for(var Ee,we,Ie,Ze;le;){if(Ee=this.tokenizer.space(le)){le=le.substring(Ee.raw.length),Ee.type&&ue.push(Ee);continue}if(Ee=this.tokenizer.code(le,ue)){le=le.substring(Ee.raw.length),Ee.type?ue.push(Ee):(Ze=ue[ue.length-1],Ze.raw+=`
|
|
`+Ee.raw,Ze.text+=`
|
|
`+Ee.text);continue}if(Ee=this.tokenizer.fences(le)){le=le.substring(Ee.raw.length),ue.push(Ee);continue}if(Ee=this.tokenizer.heading(le)){le=le.substring(Ee.raw.length),ue.push(Ee);continue}if(Ee=this.tokenizer.nptable(le)){le=le.substring(Ee.raw.length),ue.push(Ee);continue}if(Ee=this.tokenizer.hr(le)){le=le.substring(Ee.raw.length),ue.push(Ee);continue}if(Ee=this.tokenizer.blockquote(le)){le=le.substring(Ee.raw.length),Ee.tokens=this.blockTokens(Ee.text,[],me),ue.push(Ee);continue}if(Ee=this.tokenizer.list(le)){for(le=le.substring(Ee.raw.length),Ie=Ee.items.length,we=0;we<Ie;we++)Ee.items[we].tokens=this.blockTokens(Ee.items[we].text,[],!1);ue.push(Ee);continue}if(Ee=this.tokenizer.html(le)){le=le.substring(Ee.raw.length),ue.push(Ee);continue}if(me&&(Ee=this.tokenizer.def(le))){le=le.substring(Ee.raw.length),this.tokens.links[Ee.tag]||(this.tokens.links[Ee.tag]={href:Ee.href,title:Ee.title});continue}if(Ee=this.tokenizer.table(le)){le=le.substring(Ee.raw.length),ue.push(Ee);continue}if(Ee=this.tokenizer.lheading(le)){le=le.substring(Ee.raw.length),ue.push(Ee);continue}if(me&&(Ee=this.tokenizer.paragraph(le))){le=le.substring(Ee.raw.length),ue.push(Ee);continue}if(Ee=this.tokenizer.text(le,ue)){le=le.substring(Ee.raw.length),Ee.type?ue.push(Ee):(Ze=ue[ue.length-1],Ze.raw+=`
|
|
`+Ee.raw,Ze.text+=`
|
|
`+Ee.text);continue}if(le){var at="Infinite loop on byte: "+le.charCodeAt(0);if(this.options.silent){console.error(at);break}else throw new Error(at)}}return ue},ye.inline=function(le){var ue,me,Ee,we,Ie,Ze,at=le.length;for(ue=0;ue<at;ue++){Ze=le[ue];switch(Ze.type){case"paragraph":case"text":case"heading":{Ze.tokens=[],this.inlineTokens(Ze.text,Ze.tokens);break}case"table":{for(Ze.tokens={header:[],cells:[]},we=Ze.header.length,me=0;me<we;me++)Ze.tokens.header[me]=[],this.inlineTokens(Ze.header[me],Ze.tokens.header[me]);for(we=Ze.cells.length,me=0;me<we;me++)for(Ie=Ze.cells[me],Ze.tokens.cells[me]=[],Ee=0;Ee<Ie.length;Ee++)Ze.tokens.cells[me][Ee]=[],this.inlineTokens(Ie[Ee],Ze.tokens.cells[me][Ee]);break}case"blockquote":{this.inline(Ze.tokens);break}case"list":{for(we=Ze.items.length,me=0;me<we;me++)this.inline(Ze.items[me].tokens);break}}}return le},ye.inlineTokens=function(le,ue,me,Ee,we){ue===void 0&&(ue=[]),me===void 0&&(me=!1),Ee===void 0&&(Ee=!1),we===void 0&&(we="");var Ie,Ze=le,at;if(this.tokens.links){var ht=Object.keys(this.tokens.links);if(ht.length>0)for(;(at=this.tokenizer.rules.inline.reflinkSearch.exec(Ze))!=null;)ht.includes(at[0].slice(at[0].lastIndexOf("[")+1,-1))&&(Ze=Ze.slice(0,at.index)+"["+"a".repeat(at[0].length-2)+"]"+Ze.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(at=this.tokenizer.rules.inline.blockSkip.exec(Ze))!=null;)Ze=Ze.slice(0,at.index)+"["+"a".repeat(at[0].length-2)+"]"+Ze.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;le;){if(Ie=this.tokenizer.escape(le)){le=le.substring(Ie.raw.length),ue.push(Ie);continue}if(Ie=this.tokenizer.tag(le,me,Ee)){le=le.substring(Ie.raw.length),me=Ie.inLink,Ee=Ie.inRawBlock,ue.push(Ie);continue}if(Ie=this.tokenizer.link(le)){le=le.substring(Ie.raw.length),Ie.type==="link"&&(Ie.tokens=this.inlineTokens(Ie.text,[],!0,Ee)),ue.push(Ie);continue}if(Ie=this.tokenizer.reflink(le,this.tokens.links)){le=le.substring(Ie.raw.length),Ie.type==="link"&&(Ie.tokens=this.inlineTokens(Ie.text,[],!0,Ee)),ue.push(Ie);continue}if(Ie=this.tokenizer.strong(le,Ze,we)){le=le.substring(Ie.raw.length),Ie.tokens=this.inlineTokens(Ie.text,[],me,Ee),ue.push(Ie);continue}if(Ie=this.tokenizer.em(le,Ze,we)){le=le.substring(Ie.raw.length),Ie.tokens=this.inlineTokens(Ie.text,[],me,Ee),ue.push(Ie);continue}if(Ie=this.tokenizer.codespan(le)){le=le.substring(Ie.raw.length),ue.push(Ie);continue}if(Ie=this.tokenizer.br(le)){le=le.substring(Ie.raw.length),ue.push(Ie);continue}if(Ie=this.tokenizer.del(le)){le=le.substring(Ie.raw.length),Ie.tokens=this.inlineTokens(Ie.text,[],me,Ee),ue.push(Ie);continue}if(Ie=this.tokenizer.autolink(le,ge)){le=le.substring(Ie.raw.length),ue.push(Ie);continue}if(!me&&(Ie=this.tokenizer.url(le,ge))){le=le.substring(Ie.raw.length),ue.push(Ie);continue}if(Ie=this.tokenizer.inlineText(le,Ee,Ae)){le=le.substring(Ie.raw.length),we=Ie.raw.slice(-1),ue.push(Ie);continue}if(le){var ut="Infinite loop on byte: "+le.charCodeAt(0);if(this.options.silent){console.error(ut);break}else throw new Error(ut)}}return ue},$(Se,null,[{key:"rules",get:function(){return{block:ie,inline:fe}}}]),Se}(),Pe=K.defaults,je=V.cleanUrl,Ke=V.escape,He=function(){function Se(xe){this.options=xe||Pe}var ye=Se.prototype;return ye.code=function(le,ue,me){var Ee=(ue||"").match(/\S*/)[0];if(this.options.highlight){var we=this.options.highlight(le,Ee);we!=null&&we!==le&&(me=!0,le=we)}return Ee?'<pre><code class="'+this.options.langPrefix+Ke(Ee,!0)+'">'+(me?le:Ke(le,!0))+`</code></pre>
|
|
`:"<pre><code>"+(me?le:Ke(le,!0))+`</code></pre>
|
|
`},ye.blockquote=function(le){return`<blockquote>
|
|
`+le+`</blockquote>
|
|
`},ye.html=function(le){return le},ye.heading=function(le,ue,me,Ee){return this.options.headerIds?"<h"+ue+' id="'+this.options.headerPrefix+Ee.slug(me)+'">'+le+"</h"+ue+`>
|
|
`:"<h"+ue+">"+le+"</h"+ue+`>
|
|
`},ye.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},ye.list=function(le,ue,me){var Ee=ue?"ol":"ul",we=ue&&me!==1?' start="'+me+'"':"";return"<"+Ee+we+`>
|
|
`+le+"</"+Ee+`>
|
|
`},ye.listitem=function(le){return"<li>"+le+`</li>
|
|
`},ye.checkbox=function(le){return"<input "+(le?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ye.paragraph=function(le){return"<p>"+le+`</p>
|
|
`},ye.table=function(le,ue){return ue&&(ue="<tbody>"+ue+"</tbody>"),`<table>
|
|
<thead>
|
|
`+le+`</thead>
|
|
`+ue+`</table>
|
|
`},ye.tablerow=function(le){return`<tr>
|
|
`+le+`</tr>
|
|
`},ye.tablecell=function(le,ue){var me=ue.header?"th":"td",Ee=ue.align?"<"+me+' align="'+ue.align+'">':"<"+me+">";return Ee+le+"</"+me+`>
|
|
`},ye.strong=function(le){return"<strong>"+le+"</strong>"},ye.em=function(le){return"<em>"+le+"</em>"},ye.codespan=function(le){return"<code>"+le+"</code>"},ye.br=function(){return this.options.xhtml?"<br/>":"<br>"},ye.del=function(le){return"<del>"+le+"</del>"},ye.link=function(le,ue,me){if(le=je(this.options.sanitize,this.options.baseUrl,le),le===null)return me;var Ee='<a href="'+Ke(le)+'"';return ue&&(Ee+=' title="'+ue+'"'),Ee+=">"+me+"</a>",Ee},ye.image=function(le,ue,me){if(le=je(this.options.sanitize,this.options.baseUrl,le),le===null)return me;var Ee='<img src="'+le+'" alt="'+me+'"';return ue&&(Ee+=' title="'+ue+'"'),Ee+=this.options.xhtml?"/>":">",Ee},ye.text=function(le){return le},Se}(),Fe=function(){function Se(){}var ye=Se.prototype;return ye.strong=function(le){return le},ye.em=function(le){return le},ye.codespan=function(le){return le},ye.del=function(le){return le},ye.html=function(le){return le},ye.text=function(le){return le},ye.link=function(le,ue,me){return""+me},ye.image=function(le,ue,me){return""+me},ye.br=function(){return""},Se}(),qe=function(){function Se(){this.seen={}}var ye=Se.prototype;return ye.slug=function(le){var ue=le.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ue)){var me=ue;do this.seen[me]++,ue=me+"-"+this.seen[me];while(this.seen.hasOwnProperty(ue))}return this.seen[ue]=0,ue},Se}(),De=K.defaults,Ne=V.unescape,Be=function(){function Se(xe){this.options=xe||De,this.options.renderer=this.options.renderer||new He,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Fe,this.slugger=new qe}Se.parse=function(le,ue){var me=new Se(ue);return me.parse(le)};var ye=Se.prototype;return ye.parse=function(le,ue){ue===void 0&&(ue=!0);var me="",Ee,we,Ie,Ze,at,ht,ut,xt,Ct,st,Mt,Lt,kt,Dt,Tt,Bt,Qt,yt,pr=le.length;for(Ee=0;Ee<pr;Ee++){st=le[Ee];switch(st.type){case"space":continue;case"hr":{me+=this.renderer.hr();continue}case"heading":{me+=this.renderer.heading(this.parseInline(st.tokens),st.depth,Ne(this.parseInline(st.tokens,this.textRenderer)),this.slugger);continue}case"code":{me+=this.renderer.code(st.text,st.lang,st.escaped);continue}case"table":{for(xt="",ut="",Ze=st.header.length,we=0;we<Ze;we++)ut+=this.renderer.tablecell(this.parseInline(st.tokens.header[we]),{header:!0,align:st.align[we]});for(xt+=this.renderer.tablerow(ut),Ct="",Ze=st.cells.length,we=0;we<Ze;we++){for(ht=st.tokens.cells[we],ut="",at=ht.length,Ie=0;Ie<at;Ie++)ut+=this.renderer.tablecell(this.parseInline(ht[Ie]),{header:!1,align:st.align[Ie]});Ct+=this.renderer.tablerow(ut)}me+=this.renderer.table(xt,Ct);continue}case"blockquote":{Ct=this.parse(st.tokens),me+=this.renderer.blockquote(Ct);continue}case"list":{for(Mt=st.ordered,Lt=st.start,kt=st.loose,Ze=st.items.length,Ct="",we=0;we<Ze;we++)Tt=st.items[we],Bt=Tt.checked,Qt=Tt.task,Dt="",Tt.task&&(yt=this.renderer.checkbox(Bt),kt?Tt.tokens.length>0&&Tt.tokens[0].type==="text"?(Tt.tokens[0].text=yt+" "+Tt.tokens[0].text,Tt.tokens[0].tokens&&Tt.tokens[0].tokens.length>0&&Tt.tokens[0].tokens[0].type==="text"&&(Tt.tokens[0].tokens[0].text=yt+" "+Tt.tokens[0].tokens[0].text)):Tt.tokens.unshift({type:"text",text:yt}):Dt+=yt),Dt+=this.parse(Tt.tokens,kt),Ct+=this.renderer.listitem(Dt,Qt,Bt);me+=this.renderer.list(Ct,Mt,Lt);continue}case"html":{me+=this.renderer.html(st.text);continue}case"paragraph":{me+=this.renderer.paragraph(this.parseInline(st.tokens));continue}case"text":{for(Ct=st.tokens?this.parseInline(st.tokens):st.text;Ee+1<pr&&le[Ee+1].type==="text";)st=le[++Ee],Ct+=`
|
|
`+(st.tokens?this.parseInline(st.tokens):st.text);me+=ue?this.renderer.paragraph(Ct):Ct;continue}default:{var jt='Token with "'+st.type+'" type was not found.';if(this.options.silent){console.error(jt);return}else throw new Error(jt)}}}return me},ye.parseInline=function(le,ue){ue=ue||this.renderer;var me="",Ee,we,Ie=le.length;for(Ee=0;Ee<Ie;Ee++){we=le[Ee];switch(we.type){case"escape":{me+=ue.text(we.text);break}case"html":{me+=ue.html(we.text);break}case"link":{me+=ue.link(we.href,we.title,this.parseInline(we.tokens,ue));break}case"image":{me+=ue.image(we.href,we.title,we.text);break}case"strong":{me+=ue.strong(this.parseInline(we.tokens,ue));break}case"em":{me+=ue.em(this.parseInline(we.tokens,ue));break}case"codespan":{me+=ue.codespan(we.text);break}case"br":{me+=ue.br();break}case"del":{me+=ue.del(this.parseInline(we.tokens,ue));break}case"text":{me+=ue.text(we.text);break}default:{var Ze='Token with "'+we.type+'" type was not found.';if(this.options.silent){console.error(Ze);return}else throw new Error(Ze)}}}return me},Se}(),ze=V.merge,Ge=V.checkSanitizeDeprecation,Ve=V.escape,Re=K.getDefaults,Qe=K.changeDefaults,$e=K.defaults;function Me(Se,ye,xe){if(typeof Se=="undefined"||Se===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Se!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Se)+", string expected");if(typeof ye=="function"&&(xe=ye,ye=null),ye=ze({},Me.defaults,ye||{}),Ge(ye),xe){var le=ye.highlight,ue;try{ue=Oe.lex(Se,ye)}catch(Ie){return xe(Ie)}var me=function(Ze){var at;if(!Ze)try{at=Be.parse(ue,ye)}catch(ht){Ze=ht}return ye.highlight=le,Ze?xe(Ze):xe(null,at)};if(!le||le.length<3)return me();if(delete ye.highlight,!ue.length)return me();var Ee=0;Me.walkTokens(ue,function(Ie){Ie.type==="code"&&(Ee++,setTimeout(function(){le(Ie.text,Ie.lang,function(Ze,at){if(Ze)return me(Ze);at!=null&&at!==Ie.text&&(Ie.text=at,Ie.escaped=!0),Ee--,Ee===0&&me()})},0))}),Ee===0&&me();return}try{var we=Oe.lex(Se,ye);return ye.walkTokens&&Me.walkTokens(we,ye.walkTokens),Be.parse(we,ye)}catch(Ie){if(Ie.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ye.silent)return"<p>An error occurred:</p><pre>"+Ve(Ie.message+"",!0)+"</pre>";throw Ie}}Me.options=Me.setOptions=function(Se){return ze(Me.defaults,Se),Qe(Me.defaults),Me},Me.getDefaults=Re,Me.defaults=$e,Me.use=function(Se){var ye=ze({},Se);if(Se.renderer&&function(){var le=Me.defaults.renderer||new He,ue=function(we){var Ie=le[we];le[we]=function(){for(var Ze=arguments.length,at=new Array(Ze),ht=0;ht<Ze;ht++)at[ht]=arguments[ht];var ut=Se.renderer[we].apply(le,at);return ut===!1&&(ut=Ie.apply(le,at)),ut}};for(var me in Se.renderer)ue(me);ye.renderer=le}(),Se.tokenizer&&function(){var le=Me.defaults.tokenizer||new ke,ue=function(we){var Ie=le[we];le[we]=function(){for(var Ze=arguments.length,at=new Array(Ze),ht=0;ht<Ze;ht++)at[ht]=arguments[ht];var ut=Se.tokenizer[we].apply(le,at);return ut===!1&&(ut=Ie.apply(le,at)),ut}};for(var me in Se.tokenizer)ue(me);ye.tokenizer=le}(),Se.walkTokens){var xe=Me.defaults.walkTokens;ye.walkTokens=function(le){Se.walkTokens(le),xe&&xe(le)}}Me.setOptions(ye)},Me.walkTokens=function(Se,ye){for(var xe=F(Se),le;!(le=xe()).done;){var ue=le.value;ye(ue);switch(ue.type){case"table":{for(var me=F(ue.tokens.header),Ee;!(Ee=me()).done;){var we=Ee.value;Me.walkTokens(we,ye)}for(var Ie=F(ue.tokens.cells),Ze;!(Ze=Ie()).done;)for(var at=Ze.value,ht=F(at),ut;!(ut=ht()).done;){var xt=ut.value;Me.walkTokens(xt,ye)}break}case"list":{Me.walkTokens(ue.items,ye);break}default:ue.tokens&&Me.walkTokens(ue.tokens,ye)}}},Me.Parser=Be,Me.parser=Be.parse,Me.Renderer=He,Me.TextRenderer=Fe,Me.Lexer=Oe,Me.lexer=Oe.lex,Me.Tokenizer=ke,Me.Slugger=qe,Me.parse=Me;var We=Me;return We})},ELLl:function(Et,rt,re){(function(he){he(re("VrN/"))})(function(he){var $={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},O=he.Pos;he.defineOption("autoCloseBrackets",!1,function(C,E,h){h&&h!=he.Init&&(C.removeKeyMap(F),C.state.closeBrackets=null),E&&(I(Z(E,"pairs")),C.state.closeBrackets=E,C.addKeyMap(F))});function Z(C,E){return E=="pairs"&&typeof C=="string"?C:typeof C=="object"&&C[E]!=null?C[E]:$[E]}var F={Backspace:P,Enter:R};function I(C){for(var E=0;E<C.length;E++){var h=C.charAt(E),o="'"+h+"'";F[o]||(F[o]=K(h))}}I($.pairs+"`");function K(C){return function(E){return A(E,C)}}function B(C){var E=C.state.closeBrackets;if(!E||E.override)return E;var h=C.getModeAt(C.getCursor());return h.closeBrackets||E}function P(C){var E=B(C);if(!E||C.getOption("disableInput"))return he.Pass;for(var h=Z(E,"pairs"),o=C.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return he.Pass;var d=_(C,o[l].head);if(!d||h.indexOf(d)%2!=0)return he.Pass}for(var l=o.length-1;l>=0;l--){var S=o[l].head;C.replaceRange("",O(S.line,S.ch-1),O(S.line,S.ch+1),"+delete")}}function R(C){var E=B(C),h=E&&Z(E,"explode");if(!h||C.getOption("disableInput"))return he.Pass;for(var o=C.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return he.Pass;var d=_(C,o[l].head);if(!d||h.indexOf(d)%2!=0)return he.Pass}C.operation(function(){var S=C.lineSeparator()||`
|
|
`;C.replaceSelection(S+S,null),C.execCommand("goCharLeft"),o=C.listSelections();for(var v=0;v<o.length;v++){var p=o[v].head.line;C.indentLine(p,null,!0),C.indentLine(p+1,null,!0)}})}function y(C){var E=he.cmpPos(C.anchor,C.head)>0;return{anchor:new O(C.anchor.line,C.anchor.ch+(E?-1:1)),head:new O(C.head.line,C.head.ch+(E?1:-1))}}function A(C,E){var h=B(C);if(!h||C.getOption("disableInput"))return he.Pass;var o=Z(h,"pairs"),l=o.indexOf(E);if(l==-1)return he.Pass;for(var d=Z(h,"closeBefore"),S=Z(h,"triples"),v=o.charAt(l+1)==E,p=C.listSelections(),w=l%2==0,b,u=0;u<p.length;u++){var f=p[u],s=f.head,a,T=C.getRange(s,O(s.line,s.ch+1));if(w&&!f.empty())a="surround";else if((v||!w)&&T==E)v&&k(C,s)?a="both":S.indexOf(E)>=0&&C.getRange(s,O(s.line,s.ch+3))==E+E+E?a="skipThree":a="skip";else if(v&&s.ch>1&&S.indexOf(E)>=0&&C.getRange(O(s.line,s.ch-2),s)==E+E){if(s.ch>2&&/\bstring/.test(C.getTokenTypeAt(O(s.line,s.ch-2))))return he.Pass;a="addFour"}else if(v){var m=s.ch==0?" ":C.getRange(O(s.line,s.ch-1),s);if(!he.isWordChar(T)&&m!=E&&!he.isWordChar(m))a="both";else return he.Pass}else if(w&&(T.length===0||/\s/.test(T)||d.indexOf(T)>-1))a="both";else return he.Pass;if(!b)b=a;else if(b!=a)return he.Pass}var x=l%2?o.charAt(l-1):E,D=l%2?E:o.charAt(l+1);C.operation(function(){if(b=="skip")C.execCommand("goCharRight");else if(b=="skipThree")for(var j=0;j<3;j++)C.execCommand("goCharRight");else if(b=="surround"){for(var z=C.getSelections(),j=0;j<z.length;j++)z[j]=x+z[j]+D;C.replaceSelections(z,"around"),z=C.listSelections().slice();for(var j=0;j<z.length;j++)z[j]=y(z[j]);C.setSelections(z)}else b=="both"?(C.replaceSelection(x+D,null),C.triggerElectric(x+D),C.execCommand("goCharLeft")):b=="addFour"&&(C.replaceSelection(x+x+x+x,"before"),C.execCommand("goCharRight"))})}function _(C,E){var h=C.getRange(O(E.line,E.ch-1),O(E.line,E.ch+1));return h.length==2?h:null}function k(C,E){var h=C.getTokenAt(O(E.line,E.ch+1));return/\bstring/.test(h.type)&&h.start==E.ch&&(E.ch==0||!/\bstring/.test(C.getTokenTypeAt(E)))}})},GfqC:function(Et,rt,re){"use strict";var he=re("q1tI"),$=re.n(he),O=re("TSYQ"),Z=re.n(O);function F(V,M){var N="cannot "+V.method+" "+V.action+" "+M.status+"'",Y=new Error(N);return Y.status=M.status,Y.method=V.method,Y.url=V.action,Y}function I(V){var M=V.responseText||V.response;if(!M)return M;try{return JSON.parse(M)}catch(N){return M}}function K(V){var M=new XMLHttpRequest;V.onProgress&&M.upload&&(M.upload.onprogress=function(pe){pe.total>0&&(pe.percent=pe.loaded/pe.total*100),V.onProgress(pe)});var N=new FormData;V.data&&Object.keys(V.data).forEach(function(oe){var pe=V.data[oe];if(Array.isArray(pe)){pe.forEach(function(ve){N.append(oe+"[]",ve)});return}N.append(oe,V.data[oe])}),V.file instanceof Blob?N.append(V.filename,V.file,V.file.name):N.append(V.filename,V.file),M.onerror=function(pe){V.onError(pe)},M.onload=function(){return M.status<200||M.status>=300?V.onError(F(V,M),I(M)):V.onSuccess(I(M),M)},M.open(V.method,V.action,!0),V.withCredentials&&"withCredentials"in M&&(M.withCredentials=!0);var Y=V.headers||{};return Y["X-Requested-With"]!==null&&M.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(Y).forEach(function(oe){Y[oe]!==null&&M.setRequestHeader(oe,Y[oe])}),M.send(N),{abort:function(){M.abort()}}}var B=+new Date,P=0;function R(){return"rc-upload-"+B+"-"+ ++P}function y(V,M){return V.indexOf(M,V.length-M.length)!==-1}var A=function(V,M){if(V&&M){var N=Array.isArray(M)?M:M.split(","),Y=V.name||"",oe=V.type||"",pe=oe.replace(/\/.*$/,"");return N.some(function(ve){var Le=ve.trim();return Le.charAt(0)==="."?y(Y.toLowerCase(),Le.toLowerCase()):/\/\*$/.test(Le)?pe===Le.replace(/\/.*$/,""):oe===Le})}return!0};function _(V,M){var N=V.createReader(),Y=[];function oe(){N.readEntries(function(pe){var ve=Array.prototype.slice.apply(pe);Y=Y.concat(ve);var Le=!ve.length;Le?M(Y):oe()})}oe()}var k=function(M,N,Y){var oe=function pe(ve,Le){Le=Le||"",ve.isFile?ve.file(function(ke){Y(ke)&&(ve.fullPath&&!ke.webkitRelativePath&&(Object.defineProperties(ke,{webkitRelativePath:{writable:!0}}),ke.webkitRelativePath=ve.fullPath.replace(/^\//,""),Object.defineProperties(ke,{webkitRelativePath:{writable:!1}})),N([ke]))}):ve.isDirectory&&_(ve,function(ke){ke.forEach(function(ce){pe(ce,""+Le+ve.name+"/")})})};M.forEach(function(pe){oe(pe.webkitGetAsEntry())})},C=k,E=Object.assign||function(V){for(var M=1;M<arguments.length;M++){var N=arguments[M];for(var Y in N)Object.prototype.hasOwnProperty.call(N,Y)&&(V[Y]=N[Y])}return V},h=function(){function V(M,N){var Y=[],oe=!0,pe=!1,ve=void 0;try{for(var Le=M[Symbol.iterator](),ke;!(oe=(ke=Le.next()).done)&&!(Y.push(ke.value),N&&Y.length===N);oe=!0);}catch(ce){pe=!0,ve=ce}finally{try{!oe&&Le.return&&Le.return()}finally{if(pe)throw ve}}return Y}return function(M,N){if(Array.isArray(M))return M;if(Symbol.iterator in Object(M))return V(M,N);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function V(M,N){for(var Y=0;Y<N.length;Y++){var oe=N[Y];oe.enumerable=oe.enumerable||!1,oe.configurable=!0,"value"in oe&&(oe.writable=!0),Object.defineProperty(M,oe.key,oe)}}return function(M,N,Y){return N&&V(M.prototype,N),Y&&V(M,Y),M}}();function l(V,M,N){return M in V?Object.defineProperty(V,M,{value:N,enumerable:!0,configurable:!0,writable:!0}):V[M]=N,V}function d(V,M){var N={};for(var Y in V){if(M.indexOf(Y)>=0)continue;if(!Object.prototype.hasOwnProperty.call(V,Y))continue;N[Y]=V[Y]}return N}function S(V,M){if(!(V instanceof M))throw new TypeError("Cannot call a class as a function")}function v(V,M){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:V}function p(V,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);V.prototype=Object.create(M&&M.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(V,M):V.__proto__=M)}var w=function(M){return Object.keys(M).reduce(function(N,Y){return(Y.substr(0,5)==="data-"||Y.substr(0,5)==="aria-"||Y==="role")&&(N[Y]=M[Y]),N},{})},b=function(V){p(M,V);function M(){var N,Y,oe,pe;S(this,M);for(var ve=arguments.length,Le=Array(ve),ke=0;ke<ve;ke++)Le[ke]=arguments[ke];return pe=(Y=(oe=v(this,(N=M.__proto__||Object.getPrototypeOf(M)).call.apply(N,[this].concat(Le))),oe),oe.state={uid:R()},oe.reqs={},oe.onChange=function(ce){var ae=ce.target.files;oe.uploadFiles(ae),oe.reset()},oe.onClick=function(ce){var ae=oe.fileInput;if(!ae)return;var de=oe.props,ne=de.children,se=de.onClick;ne&&ne.type==="button"&&(ae.parentNode.focus(),ae.parentNode.querySelector("button").blur()),ae.click(),se&&se(ce)},oe.onKeyDown=function(ce){ce.key==="Enter"&&oe.onClick()},oe.onFileDrop=function(ce){var ae=oe.props.multiple;if(ce.preventDefault(),ce.type==="dragover")return;if(oe.props.directory)C(Array.prototype.slice.call(ce.dataTransfer.items),oe.uploadFiles,function(ne){return A(ne,oe.props.accept)});else{var de=Array.prototype.slice.call(ce.dataTransfer.files).filter(function(ne){return A(ne,oe.props.accept)});ae===!1&&(de=de.slice(0,1)),oe.uploadFiles(de)}},oe.uploadFiles=function(ce){var ae=Array.prototype.slice.call(ce);ae.map(function(de){return de.uid=R(),de}).forEach(function(de){oe.upload(de,ae)})},oe.saveFileInput=function(ce){oe.fileInput=ce},Y),v(oe,pe)}return o(M,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(Y,oe){var pe=this,ve=this.props;if(!ve.beforeUpload)return setTimeout(function(){return pe.post(Y)},0);var Le=ve.beforeUpload(Y,oe);Le&&Le.then?Le.then(function(ke){var ce=Object.prototype.toString.call(ke);return ce==="[object File]"||ce==="[object Blob]"?pe.post(ke):pe.post(Y)}).catch(function(ke){console.log(ke)}):Le!==!1&&setTimeout(function(){return pe.post(Y)},0);return}},{key:"post",value:function(Y){var oe=this;if(!this._isMounted)return;var pe=this.props,ve=pe.onStart,Le=pe.onProgress,ke=pe.transformFile,ce=ke===void 0?function(ae){return ae}:ke;new Promise(function(ae){var de=pe.action;return typeof de=="function"&&(de=de(Y)),ae(de)}).then(function(ae){var de=Y.uid,ne=pe.customRequest||K,se=Promise.resolve(ce(Y)).then(function(J){var ee=pe.data;return typeof ee=="function"&&(ee=ee(J)),Promise.all([J,ee])}).catch(function(J){console.error(J)});se.then(function(J){var ee=h(J,2),ie=ee[0],fe=ee[1],Ae={action:ae,filename:pe.name,data:fe,file:ie,headers:pe.headers,withCredentials:pe.withCredentials,method:pe.method||"post",onProgress:Le?function(ge){Le(ge,Y)}:null,onSuccess:function(Oe,Pe){delete oe.reqs[de],pe.onSuccess(Oe,Y,Pe)},onError:function(Oe,Pe){delete oe.reqs[de],pe.onError(Oe,Pe,Y)}};ve(Y),oe.reqs[de]=ne(Ae)})})}},{key:"reset",value:function(){this.setState({uid:R()})}},{key:"abort",value:function(Y){var oe=this.reqs;if(Y){var pe=Y;Y&&Y.uid&&(pe=Y.uid),oe[pe]&&oe[pe].abort&&oe[pe].abort(),delete oe[pe]}else Object.keys(oe).forEach(function(ve){oe[ve]&&oe[ve].abort&&oe[ve].abort(),delete oe[ve]})}},{key:"render",value:function(){var Y,oe=this.props,pe=oe.component,ve=oe.prefixCls,Le=oe.className,ke=oe.disabled,ce=oe.id,ae=oe.style,de=oe.multiple,ne=oe.accept,se=oe.children,J=oe.directory,ee=oe.openFileDialogOnClick,ie=oe.onMouseEnter,fe=oe.onMouseLeave,Ae=d(oe,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),ge=Z()((Y={},l(Y,ve,!0),l(Y,ve+"-disabled",ke),l(Y,Le,Le),Y)),Oe=ke?{}:{onClick:ee?this.onClick:function(){},onKeyDown:ee?this.onKeyDown:function(){},onMouseEnter:ie,onMouseLeave:fe,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return $.a.createElement(pe,E({},Oe,{className:ge,role:"button",style:ae}),$.a.createElement("input",E({},w(Ae),{id:ce,type:"file",ref:this.saveFileInput,onClick:function(je){return je.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ne,directory:J?"directory":null,webkitdirectory:J?"webkitdirectory":null,multiple:de,onChange:this.onChange})),se)}}]),M}(he.Component),u=b,f=Object.assign||function(V){for(var M=1;M<arguments.length;M++){var N=arguments[M];for(var Y in N)Object.prototype.hasOwnProperty.call(N,Y)&&(V[Y]=N[Y])}return V},s=function(){function V(M,N){for(var Y=0;Y<N.length;Y++){var oe=N[Y];oe.enumerable=oe.enumerable||!1,oe.configurable=!0,"value"in oe&&(oe.writable=!0),Object.defineProperty(M,oe.key,oe)}}return function(M,N,Y){return N&&V(M.prototype,N),Y&&V(M,Y),M}}();function a(V,M){if(!(V instanceof M))throw new TypeError("Cannot call a class as a function")}function T(V,M){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:V}function m(V,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);V.prototype=Object.create(M&&M.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(V,M):V.__proto__=M)}function x(){}var D=function(V){m(M,V);function M(){var N,Y,oe,pe;a(this,M);for(var ve=arguments.length,Le=Array(ve),ke=0;ke<ve;ke++)Le[ke]=arguments[ke];return pe=(Y=(oe=T(this,(N=M.__proto__||Object.getPrototypeOf(M)).call.apply(N,[this].concat(Le))),oe),oe.saveUploader=function(ce){oe.uploader=ce},Y),T(oe,pe)}return s(M,[{key:"abort",value:function(Y){this.uploader.abort(Y)}},{key:"render",value:function(){return $.a.createElement(u,f({},this.props,{ref:this.saveUploader}))}}]),M}(he.Component);D.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:x,onError:x,onSuccess:x,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var j=D,z=rt.a=j},Gytx:function(Et,rt){Et.exports=function(he,$,O,Z){var F=O?O.call(Z,he,$):void 0;if(F!==void 0)return!!F;if(he===$)return!0;if(typeof he!="object"||!he||typeof $!="object"||!$)return!1;var I=Object.keys(he),K=Object.keys($);if(I.length!==K.length)return!1;for(var B=Object.prototype.hasOwnProperty.bind($),P=0;P<I.length;P++){var R=I[P];if(!B(R))return!1;var y=he[R],A=$[R];if(F=O?O.call(Z,y,A,R):void 0,F===!1||F===void 0&&y!==A)return!1}return!0}},HmJG:function(Et,rt,re){},LdHM:function(Et,rt,re){"use strict";re.d(rt,"b",function(){return d}),re.d(rt,"a",function(){return v});var he=re("1OyB"),$=re("vuIU"),O=re("Ji7U"),Z=re("LK+K"),F=re("q1tI"),I=re("rePB"),K=re("Ff2n"),B=re("ODXe"),P=re("4IlW"),R=re("bX4T"),y=re("YrtM"),A=re("TSYQ"),_=re.n(A),k=re("+nKL"),C=re("8OUc"),E=function(Y,oe){var pe=Y.prefixCls,ve=Y.id,Le=Y.flattenOptions,ke=Y.childrenAsData,ce=Y.values,ae=Y.searchValue,de=Y.multiple,ne=Y.defaultActiveFirstOption,se=Y.height,J=Y.itemHeight,ee=Y.notFoundContent,ie=Y.open,fe=Y.menuItemSelectedIcon,Ae=Y.virtual,ge=Y.onSelect,Oe=Y.onToggleOpen,Pe=Y.onActiveValue,je=Y.onScroll,Ke=Y.onMouseEnter,He="".concat(pe,"-item"),Fe=Object(y.a)(function(){return Le},[ie,Le],function(We,Se){return Se[0]&&We[1]!==Se[1]}),qe=F.useRef(null),De=function(Se){Se.preventDefault()},Ne=function(Se){qe.current&&qe.current.scrollTo({index:Se})},Be=function(Se){for(var ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,xe=Fe.length,le=0;le<xe;le+=1){var ue=(Se+le*ye+xe)%xe,me=Fe[ue],Ee=me.group,we=me.data;if(!Ee&&!we.disabled)return ue}return-1},ze=F.useState(function(){return Be(0)}),Ge=Object(B.a)(ze,2),Ve=Ge[0],Re=Ge[1],Qe=function(Se){Re(Se);var ye=Fe[Se];if(!ye){Pe(null,-1);return}Pe(ye.data.value,Se)};F.useEffect(function(){Qe(ne!==!1?Be(0):-1)},[Fe.length,ae]),F.useEffect(function(){var We=setTimeout(function(){if(!de&&ie&&ce.size===1){var Se=Array.from(ce)[0],ye=Fe.findIndex(function(xe){var le=xe.data;return le.value===Se});Qe(ye),Ne(ye)}});return function(){return clearTimeout(We)}},[ie]);var $e=function(Se){Se!==void 0&&ge(Se,{selected:!ce.has(Se)}),de||Oe(!1)};if(F.useImperativeHandle(oe,function(){return{onKeyDown:function(Se){var ye=Se.which;switch(ye){case P.a.UP:case P.a.DOWN:{var xe=0;if(ye===P.a.UP?xe=-1:ye===P.a.DOWN&&(xe=1),xe!==0){var le=Be(Ve+xe,xe);Ne(le),Qe(le)}break}case P.a.ENTER:{var ue=Fe[Ve];ue&&!ue.data.disabled?$e(ue.data.value):$e(void 0),ie&&Se.preventDefault();break}case P.a.ESC:Oe(!1)}},onKeyUp:function(){},scrollTo:function(Se){Ne(Se)}}}),Fe.length===0)return F.createElement("div",{role:"listbox",id:"".concat(ve,"_list"),className:"".concat(He,"-empty"),onMouseDown:De},ee);function Me(We){var Se=Fe[We];if(!Se)return null;var ye=Se.data||{},xe=ye.value,le=ye.label,ue=ye.children,me=Object(R.a)(ye,!0),Ee=ke?ue:le;return Se?F.createElement("div",Object.assign({"aria-label":typeof Ee=="string"?Ee:null},me,{key:We,role:"option",id:"".concat(ve,"_list_").concat(We),"aria-selected":ce.has(xe)}),xe):null}return F.createElement(F.Fragment,null,F.createElement("div",{role:"listbox",id:"".concat(ve,"_list"),style:{height:0,width:0,overflow:"hidden"}},Me(Ve-1),Me(Ve),Me(Ve+1)),F.createElement(k.a,{itemKey:"key",ref:qe,data:Fe,height:se,itemHeight:J,fullHeight:!1,onMouseDown:De,onScroll:je,virtual:Ae,onMouseEnter:Ke},function(We,Se){var ye,xe=We.group,le=We.groupOption,ue=We.data,me=ue.label,Ee=ue.key;if(xe)return F.createElement("div",{className:_()(He,"".concat(He,"-group"))},me!==void 0?me:Ee);var we=ue.disabled,Ie=ue.value,Ze=ue.title,at=ue.children,ht=ue.style,ut=ue.className,xt=Object(K.a)(ue,["disabled","value","title","children","style","className"]),Ct=ce.has(Ie),st="".concat(He,"-option"),Mt=_()(He,st,ut,(ye={},Object(I.a)(ye,"".concat(st,"-grouped"),le),Object(I.a)(ye,"".concat(st,"-active"),Ve===Se&&!we),Object(I.a)(ye,"".concat(st,"-disabled"),we),Object(I.a)(ye,"".concat(st,"-selected"),Ct),ye)),Lt=ke?at:me,kt=!fe||typeof fe=="function"||Ct;return F.createElement("div",Object.assign({},xt,{"aria-selected":Ct,className:Mt,title:Ze,onMouseMove:function(){if(Ve===Se||we)return;Qe(Se)},onClick:function(){we||$e(Ie)},style:ht}),F.createElement("div",{className:"".concat(st,"-content")},Lt||Ie),F.isValidElement(fe)||Ct,kt&&F.createElement(C.a,{className:"".concat(He,"-option-state"),customizeIcon:fe,customizeIconProps:{isSelected:Ct}},Ct?"\u2713":null))}))},h=F.forwardRef(E);h.displayName="OptionList";var o=h,l=function(){return null};l.isSelectOption=!0;var d=l,S=function(){return null};S.isSelectOptGroup=!0;var v=S,p=re("VTBJ"),w=re("Zm9Q");function b(N){var Y=N.key,oe=N.props,pe=oe.children,ve=oe.value,Le=Object(K.a)(oe,["children","value"]);return Object(p.a)({key:Y,value:ve!==void 0?ve:Y,children:pe},Le)}function u(N){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(w.a)(N).map(function(oe,pe){if(!F.isValidElement(oe)||!oe.type)return null;var ve=oe.type.isSelectOptGroup,Le=oe.key,ke=oe.props,ce=ke.children,ae=Object(K.a)(ke,["children"]);return Y||!ve?b(oe):Object(p.a)(Object(p.a)({key:"__RC_SELECT_GRP__".concat(Le===null?pe:Le,"__"),label:Le},ae),{},{options:u(ce)})}).filter(function(oe){return oe})}var f=re("2Qr1"),s=re("qNPg"),a=re("U8pU"),T=re("Kwbf"),m=re("WKfj");function x(N){var Y=N.mode,oe=N.options,pe=N.children,ve=N.backfill,Le=N.allowClear,ke=N.placeholder,ce=N.getInputElement,ae=N.showSearch,de=N.onSearch,ne=N.defaultOpen,se=N.autoFocus,J=N.labelInValue,ee=N.value,ie=N.inputValue,fe=N.optionLabelProp,Ae=Y==="multiple"||Y==="tags",ge=ae!==void 0?ae:Ae||Y==="combobox",Oe=oe||u(pe);if(Object(T.a)(Y!=="tags"||Oe.every(function(He){return!He.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),Y==="tags"||Y==="combobox"){var Pe=Oe.some(function(He){return He.options?He.options.some(function(Fe){return typeof("value"in Fe?Fe.value:Fe.key)=="number"}):typeof("value"in He?He.value:He.key)=="number"});Object(T.a)(!Pe,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(T.a)(Y!=="combobox"||!fe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(T.a)(Y==="combobox"||!ve,"`backfill` only works with `combobox` mode."),Object(T.a)(Y==="combobox"||!ce,"`getInputElement` only work with `combobox` mode."),Object(T.b)(Y!=="combobox"||!ce||!Le||!ke,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),de&&!ge&&Y!=="combobox"&&Y!=="tags"&&Object(T.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(T.b)(!ne||se,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ee!=null){var je=Object(m.d)(ee);Object(T.a)(!J||je.every(function(He){return Object(a.a)(He)==="object"&&("key"in He||"value"in He)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(T.a)(!Ae||Array.isArray(ee),"`value` should be array when `mode` is `multiple` or `tags`")}if(pe){var Ke=null;Object(w.a)(pe).some(function(He){if(!F.isValidElement(He)||!He.type)return!1;var Fe=He.type;if(Fe.isSelectOption)return!1;if(Fe.isSelectOptGroup){var qe=Object(w.a)(He.props.children).every(function(De){return!F.isValidElement(De)||!He.type||De.type.isSelectOption?!0:(Ke=De.type,!1)});return!qe}return Ke=Fe,!0}),Ke&&Object(T.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ke.displayName||Ke.name||Ke,"`.")),Object(T.a)(ie===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var D=x,j=Object(s.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:u,flattenOptions:f.d,getLabeledValue:f.e,filterOptions:f.b,isValueDisabled:f.g,findValueOption:f.c,warningProps:D,fillOptionsWithMissingValue:f.a}),z=function(N){Object(O.a)(oe,N);var Y=Object(Z.a)(oe);function oe(){var pe;return Object(he.a)(this,oe),pe=Y.apply(this,arguments),pe.selectRef=F.createRef(),pe.focus=function(){pe.selectRef.current.focus()},pe.blur=function(){pe.selectRef.current.blur()},pe}return Object($.a)(oe,[{key:"render",value:function(){return F.createElement(j,Object.assign({ref:this.selectRef},this.props))}}]),oe}(F.Component);z.Option=d,z.OptGroup=v;var V=z,M=rt.c=V},M8RZ:function(Et,rt,re){"use strict";re.d(rt,"a",function(){return P});var he=re("fWQN"),$=re("mtLc"),O=re("yKVA"),Z=re("879j"),F=re("q1tI"),I=re.n(F),K=re("i8i4"),B=re.n(K),P=function(R){Object(O.a)(A,R);var y=Object(Z.a)(A);function A(_){var k;Object(he.a)(this,A),k=y.call(this,_);var C=window.document;return k.node=C.createElement("div"),C.body.appendChild(k.node),k}return Object($.a)(A,[{key:"render",value:function(){var k=this.props.children;return Object(K.createPortal)(k,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),A}(I.a.Component)},NvD2:function(Et,rt,re){"use strict";re.d(rt,"a",function(){return I});var he=re("Kwbf");function $(K,B){var P=new Set;return K.forEach(function(R){B.has(R)||P.add(R)}),P}function O(K){var B=K||{},P=B.disabled,R=B.disableCheckbox,y=B.checkable;return!!(P||R)||y===!1}function Z(K,B,P,R){for(var y=new Set(K),A=new Set,_=0;_<=P;_+=1){var k=B.get(_)||new Set;k.forEach(function(o){var l=o.key,d=o.node,S=o.children,v=S===void 0?[]:S;y.has(l)&&!R(d)&&v.filter(function(p){return!R(p.node)}).forEach(function(p){y.add(p.key)})})}for(var C=new Set,E=P;E>=0;E-=1){var h=B.get(E)||new Set;h.forEach(function(o){var l=o.parent,d=o.node;if(R(d)||!o.parent||C.has(o.parent.key))return;if(R(o.parent.node)){C.add(l.key);return}var S=!0,v=!1;(l.children||[]).filter(function(p){return!R(p.node)}).forEach(function(p){var w=p.key,b=y.has(w);S&&!b&&(S=!1),!v&&(b||A.has(w))&&(v=!0)}),S&&y.add(l.key),v&&A.add(l.key),C.add(l.key)})}return{checkedKeys:Array.from(y),halfCheckedKeys:Array.from($(A,y))}}function F(K,B,P,R,y){for(var A=new Set(K),_=new Set(B),k=0;k<=R;k+=1){var C=P.get(k)||new Set;C.forEach(function(l){var d=l.key,S=l.node,v=l.children,p=v===void 0?[]:v;!A.has(d)&&!_.has(d)&&!y(S)&&p.filter(function(w){return!y(w.node)}).forEach(function(w){A.delete(w.key)})})}_=new Set;for(var E=new Set,h=R;h>=0;h-=1){var o=P.get(h)||new Set;o.forEach(function(l){var d=l.parent,S=l.node;if(y(S)||!l.parent||E.has(l.parent.key))return;if(y(l.parent.node)){E.add(d.key);return}var v=!0,p=!1;(d.children||[]).filter(function(w){return!y(w.node)}).forEach(function(w){var b=w.key,u=A.has(b);v&&!u&&(v=!1),!p&&(u||_.has(b))&&(p=!0)}),v||A.delete(d.key),p&&_.add(d.key),E.add(d.key)})}return{checkedKeys:Array.from(A),halfCheckedKeys:Array.from($(_,A))}}function I(K,B,P,R){var y=[],A;R?A=R:A=O;var _=new Set(K.filter(function(h){var o=!!P[h];return o||y.push(h),o})),k=new Map,C=0;Object.keys(P).forEach(function(h){var o=P[h],l=o.level,d=k.get(l);d||(d=new Set,k.set(l,d)),d.add(o),C=Math.max(C,l)}),Object(he.a)(!y.length,"Tree missing follow keys: ".concat(y.slice(0,100).map(function(h){return"'".concat(h,"'")}).join(", ")));var E;return B===!0?E=Z(_,k,C,A):E=F(_,B.halfCheckedKeys,k,C,A),E}},OLES:function(Et,rt,re){"use strict";var he=re("U8pU"),$=re("VTBJ"),O=re("Ff2n"),Z=re("q1tI"),F=re("uciX"),I=re("7ixt"),K=function(_){var k=_.overlay,C=_.prefixCls,E=_.id,h=_.overlayInnerStyle;return Z.createElement("div",{className:"".concat(C,"-inner"),id:E,role:"tooltip",style:h},typeof k=="function"?k():k)},B=K,P=function(_,k){var C=_.overlayClassName,E=_.trigger,h=E===void 0?["hover"]:E,o=_.mouseEnterDelay,l=o===void 0?0:o,d=_.mouseLeaveDelay,S=d===void 0?.1:d,v=_.overlayStyle,p=_.prefixCls,w=p===void 0?"rc-tooltip":p,b=_.children,u=_.onVisibleChange,f=_.afterVisibleChange,s=_.transitionName,a=_.animation,T=_.placement,m=T===void 0?"right":T,x=_.align,D=x===void 0?{}:x,j=_.destroyTooltipOnHide,z=j===void 0?!1:j,V=_.defaultVisible,M=_.getTooltipContainer,N=_.overlayInnerStyle,Y=Object(O.a)(_,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),oe=Object(Z.useRef)(null);Object(Z.useImperativeHandle)(k,function(){return oe.current});var pe=Object($.a)({},Y);"visible"in _&&(pe.popupVisible=_.visible);var ve=function(){var de=_.arrowContent,ne=de===void 0?null:de,se=_.overlay,J=_.id;return[Z.createElement("div",{className:"".concat(w,"-arrow"),key:"arrow"},ne),Z.createElement(B,{key:"content",prefixCls:w,id:J,overlay:se,overlayInnerStyle:N})]},Le=!1,ke=!1;if(typeof z=="boolean")Le=z;else if(z&&Object(he.a)(z)==="object"){var ce=z.keepParent;Le=ce===!0,ke=ce===!1}return Z.createElement(F.a,Object.assign({popupClassName:C,prefixCls:w,popup:ve,action:h,builtinPlacements:I.a,popupPlacement:m,ref:oe,popupAlign:D,getPopupContainer:M,onPopupVisibleChange:u,afterPopupVisibleChange:f,popupTransitionName:s,popupAnimation:a,defaultPopupVisible:V,destroyPopupOnHide:Le,autoDestroy:ke,mouseLeaveDelay:S,popupStyle:v,mouseEnterDelay:l},pe),b)},R=Object(Z.forwardRef)(P),y=rt.a=R},OZM5:function(Et,rt,re){"use strict";re.d(rt,"b",function(){return R}),re.d(rt,"a",function(){return y}),re.d(rt,"k",function(){return A}),re.d(rt,"h",function(){return _}),re.d(rt,"i",function(){return k}),re.d(rt,"g",function(){return C}),re.d(rt,"c",function(){return E}),re.d(rt,"d",function(){return h}),re.d(rt,"j",function(){return d}),re.d(rt,"e",function(){return S}),re.d(rt,"f",function(){return v});var he=re("KQm4"),$=re("U8pU"),O=re("Ff2n"),Z=re("q1tI"),F=re.n(Z),I=re("Kwbf"),K=re("WaYH"),B=.25,P=2;function R(p,w){var b=p.slice(),u=b.indexOf(w);return u>=0&&b.splice(u,1),b}function y(p,w){var b=p.slice();return b.indexOf(w)===-1&&b.push(w),b}function A(p){return p.split("-")}function _(p,w){return"".concat(p,"-").concat(w)}function k(p){return p&&p.type&&p.type.isTreeNode}function C(p,w){var b=[p],u=w[p];function f(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];s.forEach(function(a){var T=a.key,m=a.children;b.push(T),f(m)})}return f(u.children),b}function E(p,w){var b=p.clientY,u=w.selectHandle.getBoundingClientRect(),f=u.top,s=u.bottom,a=u.height,T=Math.max(a*B,P);return b<=f+T?-1:b>=s-T?1:0}function h(p,w){if(!p)return;var b=w.multiple;return b?p.slice():p.length?[p[0]]:p}var o=function(w){return w};function l(p,w){if(!p)return[];var b=w||{},u=b.processProps,f=u===void 0?o:u,s=Array.isArray(p)?p:[p];return s.map(function(a){var T=a.children,m=Object(O.a)(a,["children"]),x=l(T,w);return F.a.createElement(K.a,Object.assign({},f(m)),x)})}function d(p){if(!p)return null;var w;if(Array.isArray(p))w={checkedKeys:p,halfCheckedKeys:void 0};else if(Object($.a)(p)==="object")w={checkedKeys:p.checked||void 0,halfCheckedKeys:p.halfChecked||void 0};else return Object(I.a)(!1,"`checkedKeys` is not an array or an object"),null;return w}function S(p,w){var b=new Set;function u(f){if(b.has(f))return;var s=w[f];if(!s)return;b.add(f);var a=s.parent,T=s.node;if(T.disabled)return;a&&u(a.key)}return(p||[]).forEach(function(f){u(f)}),Object(he.a)(b)}function v(p){var w={};return Object.keys(p).forEach(function(b){(b.startsWith("data-")||b.startsWith("aria-"))&&(w[b]=p[b])}),w}},Ot1p:function(Et,rt,re){"use strict";var he=re("2qtc"),$=re("kLXV"),O=re("rAM+"),Z=re("miYZ"),F=re("tsqr"),I=re("9og8"),K=re("tJVT"),B=re("jrin"),P=re("WmNS"),R=re.n(P),y=re("q1tI"),A=re.n(y),_=re("VrN/"),k=re.n(_),C=re("bdgK"),E=re("p77/"),h=re("Bd2K"),o=re("ELLl"),l=re("19Vz"),d=re("lZu9"),S=re("+NIl"),v=re("kSUc"),p=re("9Bee"),w=function(we){var Ie=we.value,Ze=Ie===void 0?"":Ie,at=we.className,ht=we.showTextOnly,ut=we.showLines,xt=we.style,Ct=xt===void 0?{}:xt,st=Object(y.useMemo)(function(){return""},[Ze]);return A.a.createElement(A.a.Fragment,null,A.a.createElement("div",{dangerouslySetInnerHTML:{__html:st}}))},b=re("0Owb"),u=re("dejd"),f=re("C+DQ"),s=re("1vsH"),a=re("m3rI"),T=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function m(we){var Ie=we.onActionCallback,Ze=we.title,at=we.icon,ht=we.actionName,ut=we.className,xt=ut===void 0?"":ut,Ct=we.children;function st(){Ie(ht)}return A.a.createElement("a",{title:Ze,className:xt,onClick:st},A.a.createElement("i",{className:"md-iconfont ".concat(at)}),Ct)}var x=function(we){var Ie=we.watch,Ze=we.showNullButton,at=we.onActionCallback,ht=we.fullScreen,ut=we.insertTemp,xt=we.hidetoolBar,Ct=we.uuid,st=we.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(s.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(s.F)("_educoder_session"),"&key=").concat(Ct,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var Mt=[].concat(T,[{title:"".concat(Ie?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ie?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return A.a.createElement("ul",{className:"markdown-toolbar-container"},!xt&&Mt.map(function(Lt,kt){return A.a.createElement("li",{key:kt},Lt.actionName?A.a.createElement(m,Object(b.a)({},Lt,{onActionCallback:at})):A.a.createElement("span",{className:"v-line"}))}),Ze?A.a.createElement("li",null,A.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:at},A.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,ut&&A.a.createElement("li",null,A.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(ut),onActionCallback:at},A.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),A.a.createElement("li",{className:"btn-full-screen"},A.a.createElement(m,{icon:"".concat(ht?"icon-shrink":"icon-enlarge"),title:ht?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:at})))},D=re("M8RZ"),j=re("+L6B"),z=re("2/Rp"),V=re("y8nQ"),M=re("Vl3Y"),N=re("5NDa"),Y=re("5rEg"),oe={labelCol:{span:4},wrapperCol:{span:20}},pe=function(we){var Ie=we.callback,Ze=we.onCancel;function at(ht){Ie(ht)}return A.a.createElement(M.a,Object(b.a)({},oe,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:at}),A.a.createElement(M.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},A.a.createElement(Y.a,null)),A.a.createElement(M.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},A.a.createElement(Y.a,null)),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(z.a,{type:"ghost",onClick:Ze},"\u53D6\u6D88")))},ve=re("7ahc"),Le=re("HmJG"),ke=re("BjJ7"),ce=M.a.useForm,ae={width:280,marginRight:10},de={labelCol:{span:5},wrapperCol:{span:19}},ne=function(we){var Ie=we.callback,Ze=we.onCancel,at=ce(),ht=Object(K.a)(at,1),ut=ht[0];function xt(Mt){Ie(Mt)}function Ct(Mt,Lt){if(Mt.status===-1){F.b.error(Mt.message);return}ut.setFieldsValue({src:"/api/attachments/".concat(Mt.id),type:Lt.type})}function st(Mt){var Lt=Mt.target.files[0];J(Lt,Ct)}return A.a.createElement(M.a,Object(b.a)({form:ut},de,{className:"upload-image-panel",onFinish:xt}),A.a.createElement(M.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},A.a.createElement("div",{className:"flex-container"},A.a.createElement(M.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},A.a.createElement(Y.a,{style:ae})),A.a.createElement(se,{onFileChange:st}))),A.a.createElement(M.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},A.a.createElement(Y.a,{style:{width:264}})),A.a.createElement(M.a.Item,{style:{textAlign:"right"}},A.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(z.a,{type:"ghost",onClick:Ze},"\u53D6\u6D88")))};function se(we){var Ie=we.onFileChange;return A.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",A.a.createElement("input",{type:"file",onChange:Ie}))}function J(we,Ie){if(!we)throw new String("\u6CA1\u6709\u6587\u4EF6");var Ze=new FormData;Ze.append("editormd-image-file",we),Ze.append("file_param_name","editormd-image-file"),Ze.append("byxhr","true");var at=new window.XMLHttpRequest;at.withCredentials=!0,at.addEventListener("load",function(ht){Ie(JSON.parse(ht.target.responseText),we)},!1),at.addEventListener("error",function(ht){console.error(ht)},!1),at.open("POST","".concat(ke.a,"/api/attachments.json")),at.send(Ze)}var ee=re("giR+"),ie=re("fyUT"),fe=re("7Kak"),Ae=re("9yH6"),ge=Ae.a.Group,Oe={margin:"0 8px"},Pe=function(we){var Ie=we.callback,Ze=we.onCancel;function at(ht){Ie(ht)}return A.a.createElement(M.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:at},A.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},A.a.createElement("span",{style:Oe},"\u5355\u5143\u683C\u6570\uFF1A"),A.a.createElement("span",{style:Oe},"\u884C\u6570"),A.a.createElement(M.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},A.a.createElement(ie.a,null)),A.a.createElement("span",{style:Oe},"\u5217\u6570"),A.a.createElement(M.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},A.a.createElement(ie.a,null))),A.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},A.a.createElement("span",{style:Oe},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),A.a.createElement(M.a.Item,{name:"align"},A.a.createElement(ge,null,A.a.createElement(Ae.a,{value:"default"},A.a.createElement("i",{className:"fa fa-align-justify"})),A.a.createElement(Ae.a,{value:"left"},A.a.createElement("i",{className:"fa fa-align-left"})),A.a.createElement(Ae.a,{value:"center"},A.a.createElement("i",{className:"fa fa-align-center"})),A.a.createElement(Ae.a,{value:"right"},A.a.createElement("i",{className:"fa fa-align-right"}))))),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(z.a,{type:"ghost",onClick:Ze},"\u53D6\u6D88")))},je=re("ErOA"),Ke=re("7Cbv"),He="link",Fe="upload-image",qe="code-block",De="add-table",Ne="------------",Be={default:Ne,left:":".concat(Ne),center:":".concat(Ne,":"),right:"".concat(Ne,":")},ze=re("9VGf"),Ge,Ve;function Re(){}var Qe=0,$e=1e4,Me="\u2581",We=`
|
|
**\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 Se(we){return/^\d+$/.test(we)?"".concat(we,"px"):we}var ye=navigator.platform.toUpperCase().indexOf("MAC")>=0,xe=ye?"Cmd":"Ctrl",le=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],ue=(Ge={},Object(B.a)(Ge,xe+"-B","bold"),Object(B.a)(Ge,xe+"-I","italic"),Ge),me=(Ve={},Object(B.a)(Ve,He,"\u6DFB\u52A0\u94FE\u63A5"),Object(B.a)(Ve,qe,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(B.a)(Ve,Fe,"\u6DFB\u52A0\u6587\u4EF6"),Object(B.a)(Ve,De,"\u6DFB\u52A0\u8868\u683C"),Ve),Ee=rt.a=function(we){var Ie=we.defaultValue,Ze=Ie===void 0?"":Ie,at=we.onChange,ht=we.width,ut=ht===void 0?"100%":ht,xt=we.height,Ct=xt===void 0?400:xt,st=we.miniToolbar,Mt=st===void 0?!1:st,Lt=we.isFocus,kt=Lt===void 0?!1:Lt,Dt=we.watch,Tt=we.insertTemp,Bt=we.mode,Qt=Bt===void 0?"markdown":Bt,yt=we.id,pr=yt===void 0?"markdown-editor-id":yt,jt=we.showResizeBar,tr=jt===void 0?!1:jt,ur=we.noStorage,nr=ur===void 0?!1:ur,vr=we.showNullButton,Ut=vr===void 0?!1:vr,ft=we.hidetoolBar,sr=ft===void 0?!1:ft,Tr=we.fullScreen,gr=Tr===void 0?!1:Tr,Pt=we.onBlur,yr=we.onCMBeforeChange,dr=we.onFullScreen,qr=we.className,et=qr===void 0?"":qr,wt=we.disablePaste,zr=wt===void 0?!1:wt,Ir=we.placeholder,Zr=Ir===void 0?"":Ir,Wr=we.values,G=Wr===void 0?"":Wr,c=Object(y.useState)(null),g=Object(K.a)(c,2),U=g[0],q=g[1],H=Object(y.useState)(Ze),Ce=Object(K.a)(H,2),Ye=Ce[0],nt=Ce[1],lt=Object(y.useState)(Dt),Xe=Object(K.a)(lt,2),pt=Xe[0],mt=Xe[1],It=Object(y.useState)(gr),lr=Object(K.a)(It,2),$t=lr[0],rr=lr[1],xr=Object(y.useState)(""),Nr=Object(K.a)(xr,2),ir=Nr[0],Xt=Nr[1],wr=Object(y.useState)(0),Hr=Object(K.a)(wr,2),ar=Hr[0],yn=Hr[1],Ar=Object(y.useState)(Ct),_r=Object(K.a)(Ar,2),Rn=_r[0],Nt=_r[1],vt=Object(y.useState)(!1),ot=Object(K.a)(vt,2),Cr=ot[0],Yt=ot[1],Zt=Object(y.useRef)(Object(Ke.a)()),Ht=Object(y.useRef)(!1),br=Object(y.useRef)(),Ft=Object(y.useRef)(),cr=Object(y.useRef)(),zt=Object(y.useRef)(),Vr=Object(y.useRef)(),mr=function(){var St=Object(I.a)(R.a.mark(function _t(){var Ot,Kt;return R.a.wrap(function(hr){for(;;)switch(hr.prev=hr.next){case 0:return hr.next=2,Object(je.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Zt.current}});case 2:Kt=hr.sent,Kt!=null&&(Ot=Kt.attachments)!==null&&Ot!==void 0&&Ot.length&&(console.log("cm:",U,Ft),Kt.attachments.map(function(Vt){Vt.content_type.indexOf("image")>-1?U.replaceSelection(".concat(Vt.content_type,")")):Vt.content_type.indexOf("video")>-1?U.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Vt.content_type.indexOf("pdf")>-1?U.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Vt.id,"?type=").concat(Vt.content_type,'&disposition=inline" target="_blank">').concat(Vt.name,"</a>")):U.replaceSelection("[".concat(Vt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Vt.id,"?type=").concat(Vt.content_type,")"))}));case 4:case"end":return hr.stop()}},_t)}));return function(){return St.apply(this,arguments)}}();Object(y.useEffect)(function(){nt(G),U==null||U.setValue(G)},[G]),Object(y.useEffect)(function(){dr==null||dr($t)},[$t]),Object(y.useEffect)(function(){if(Ft.current){var St=k.a.fromTextArea(Ft.current,{mode:Qt,lineNumbers:!Mt,lineWrapping:!0,value:Ze,autoCloseTags:!0,autoCloseBrackets:!0});kt&&St.focus();function _t(Ot,Kt){if(zr){Kt.preventDefault();return}var Jt=Kt.clipboardData;if(Jt){var hr=Jt.types.toString(),Vt=Jt.items;if(hr==="Files"||Jt.types.indexOf("Files")>-1){if(Kt.preventDefault(),Qt=="stex")return;try{var Pr,en=Vt[1];((Pr=Vt[0])===null||Pr===void 0?void 0:Pr.kind)==="file"&&(en=Vt[0]);var Gt=en.getAsFile(),Ln=Gt.name.split(".").pop();J(Gt,function(qt){if(qt.id){var tn,Xr,bn;(Gt==null||((tn=Gt.type)===null||tn===void 0)?void 0:tn.indexOf("image"))>-1?St.replaceSelection(".concat(qt.content_type,")")):(Gt==null||((Xr=Gt.type)===null||Xr===void 0)?void 0:Xr.indexOf("video"))>-1?St.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(qt.id,'"></video>')):(Gt==null||((bn=Gt.type)===null||bn===void 0)?void 0:bn.indexOf("pdf"))>-1?St.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(qt.id,"?type=").concat(Gt.type,'&disposition=inline" target="_blank">').concat(Gt.name,"</a>")):le.includes(Ln)?St.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(qt.id,'?type=office&disposition=inline" target="_blank">').concat(Gt.name,"</a>")):St.replaceSelection("[".concat(Gt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(qt.id,"?type=").concat(qt.content_type,")"))}else(qt==null?void 0:qt.status)===401&&(document.location.href="/user/login")})}catch(qt){F.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return St.on("paste",_t),St.on("dragleave",function(Ot,Kt){cr.current.classList.remove("mouse-hover-md")}),St.on("dragover",function(Ot,Kt){cr.current.classList.add("mouse-hover-md")}),St.on("drop",function(Ot,Kt){cr.current.classList.add("mouse-hover-md");var Jt;if(Jt=Kt.dataTransfer.files,Jt.length>0){Kt.preventDefault(),Kt.stopPropagation();for(var hr=function(en){var Gt=Jt[en],Ln=Gt.name.split(".").pop();J(Gt,function(qt){if(qt.id){var tn,Xr,bn;(Gt==null||((tn=Gt.type)===null||tn===void 0)?void 0:tn.indexOf("image"))>-1?St.replaceSelection(".concat(qt.content_type,")")):(Gt==null||((Xr=Gt.type)===null||Xr===void 0)?void 0:Xr.indexOf("video"))>-1?St.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(qt.id,'"></video>')):(Gt==null||((bn=Gt.type)===null||bn===void 0)?void 0:bn.indexOf("pdf"))>-1?St.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(qt.id,"?type=").concat(Gt.type,'&disposition=inline" target="_blank">').concat(Gt.name,"</a>")):le.includes(Ln)?St.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(qt.id,'?type=office&disposition=inline" target="_blank">').concat(Gt.name,"</a>")):St.replaceSelection("[".concat(Gt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(qt.id,"?type=").concat(qt.content_type,")"))}else(qt==null?void 0:qt.status)===401&&(document.location.href="/user/login")})},Vt=0;Vt<Jt.length;Vt++)hr(Vt)}}),q(St),function(){St.off("paste",_t)}}},[]);var Lr=Object(y.useCallback)(function(){if(cr.current)try{}catch(St){console.log(St,"---- to set md editor body height")}},[Rn,cr,$t]);Object(y.useEffect)(function(){function St(){var Ot=new C.default(function(Kt){var Jt=Object(O.a)(Kt),hr;try{for(Jt.s();!(hr=Jt.n()).done;){var Vt=hr.value;(Vt.target.offsetHeight>0||Vt.target.offsetWidth>0)&&(Lr(),U.setSize("100%","100%"),U.refresh())}}catch(Pr){Jt.e(Pr)}finally{Jt.f()}});return Ot.observe(Ft.current.parentElement),Ot}if(U){var _t=St();return function(){_t.unobserve(Ft.current.parentElement)}}},[U,Lr]),Object(y.useEffect)(function(){if(U){for(var St=[],_t=function(){var Vt=Kt[Ot];Jt=Object(K.a)(Vt,2);var Pr=Jt[0],en=Jt[1],Gt=Object(B.a)({},Pr,function(){ln(en)});St.push(Gt),U.addKeyMap(Gt)},Ot=0,Kt=Object.entries(ue);Ot<Kt.length;Ot++){var Jt;_t()}return br.current=setInterval(function(){Ht.current&&mr()},4e3),function(){clearInterval(br.current);var hr=Object(O.a)(St),Vt;try{for(hr.s();!(Vt=hr.n()).done;){var Pr=Vt.value;U.removeKeyMap(Pr)}}catch(en){hr.e(en)}finally{hr.f()}}}},[U]),Object(y.useEffect)(function(){gr!==$t&&rr(gr)},[gr]),Object(ze.a)(function(){if(!nr&&ar>0){var St=new Date().getTime(),_t=window.sessionStorage.getItem(pr);St>=ar+$e&&(!_t||_t!==Ye)&&(window.sessionStorage.setItem(pr,Ye),Yt(!0))}},$e),Object(y.useEffect)(function(){mt(Dt)},[U,Dt]),Object(y.useEffect)(function(){U&&(kt&&U.focus())},[U,kt]),Object(y.useEffect)(function(){if(pt&&U){var St=U.getScrollerElement();function _t(Ot){var Kt=Ot.target;if(Vr.current){var Jt=Kt.scrollTop/Kt.scrollHeight;Vr.current.scrollTop=Vr.current.scrollHeight*Jt}}return St.addEventListener("scroll",_t),function(){St.removeEventListener("scroll",_t)}}},[U,pt]),Object(y.useEffect)(function(){if(U&&yr){function St(_t,Ot){yr(_t,Ot)}return U.on("beforeChange",St),function(){U.off("beforeChange",St)}}},[U,yr]),Object(y.useEffect)(function(){if(U&&Pt){function St(){Pt(U.getValue())}return U.on("blur",St),function(){U.off("blur",St)}}},[U,Pt]),Object(y.useEffect)(function(){if(U){function St(_t){var Ot=_t.getValue();nt(Ot),yn(new Date().getTime()),_t.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),at&&at(Ot)}return U.on("change",St),function(){U.off("change",St)}}},[U,at]),Object(y.useEffect)(function(){U&&(Ze==null?(U.setValue(""),nt("")):Ze!==U.getValue()&&(U.setValue(Ze),nt(Ze),U.setCursor(U.lineCount(),0)))},[U,Ze]);var ln=Object(y.useCallback)(function(St){var _t=U.getCursor(),Ot=U.getSelection(),Kt=Ot.split(`
|
|
`);switch(St){case"bold":return U.replaceSelection("**"+Ot+"**"),Ot===""&&U.setCursor(_t.line,_t.ch+2),U.focus();case"italic":return U.replaceSelection("*"+Ot+"*"),Ot===""&&U.setCursor(_t.line,_t.ch+1),U.focus();case"code":return U.replaceSelection("`"+Ot+"`"),Ot===""&&U.setCursor(_t.line,_t.ch+1),U.focus();case"inline-latex":return U.replaceSelection("`$$"+Ot+"$$`"),Ot===""&&U.setCursor(_t.line,_t.ch+3),U.focus();case"latex":return U.replaceSelection("```latex\n"+Ot+"\n```"),U.setCursor(_t.line+1,Ot.length+1),U.focus();case"line-break":return U.replaceSelection(`<br/>
|
|
`),U.focus();case"list-ul":return Ot===""?U.replaceSelection("- "+Ot):U.replaceSelection(Kt.map(function(Jt){return Jt===""?"":"- ".concat(Jt)}).join(`
|
|
`)),U.focus();case"list-ol":return Ot===""?U.replaceSelection("1. "+Ot):U.replaceSelection(Kt.map(function(Jt,hr){return Jt===""?"":"".concat(hr+1,". ").concat(Jt)}).join(`
|
|
`)),U.focus();case"add-null-ch":return Ot===""&&U.setCursor(_t.line,_t.ch+1),U.replaceSelection(Me),U.focus();case"inster-template-1":return Ot===""&&U.setCursor(_t.line,_t.ch),U.replaceSelection(We),U.focus();case"eraser":return U.setValue(""),U.focus();case"trigger-watch":return mt(!pt),U.focus();case"trigger-full-screen":return rr(!$t),U.focus();case He:Xt(He);return;case qe:Xt(qe);return;case Fe:Xt(Fe);return;case De:Xt(De);return;default:throw new Error}},[U,pt,$t]),pn=Object(y.useCallback)(function(St){Xt("");switch(ir){case He:var _t=St.title,Ot=St.link;return U.replaceSelection("[".concat(_t,"](").concat(Ot,")")),U.focus();case qe:var Kt=St.language,Jt=St.content;return U.replaceSelection(["```"+Kt,Jt,"```"].join(`
|
|
`)),U.focus();case Fe:var hr=St.src,Vt=St.alt;return Vt?U.replaceSelection(".concat(hr,' "').concat(Vt,'" )')):U.replaceSelection("")),U.focus();case De:for(var Pr=St.row,en=St.col,Gt=St.align,Ln=`
|
|
`,qt=0;qt<Pr;qt++){for(var tn=[],Xr=[],bn=0;bn<en;bn++)qt===1&&Xr.push(Be[Gt]),tn.push(" ");qt===1&&(Ln+="| ".concat(Xr.join(" | "),` |
|
|
`)),Ln+="| ".concat(tn.join(en===1?"":" | "),` |
|
|
`)}return U.replaceSelection(Ln+`
|
|
`),U.focus();default:throw new Error}},[U,ir]),un=Object(y.useMemo)(function(){switch(ir){case He:return A.a.createElement(pe,{callback:pn,onCancel:dn});case qe:return A.a.createElement(ve.b,{callback:pn,onCancel:dn});case Fe:return A.a.createElement(ne,{callback:pn,onCancel:dn});case De:return A.a.createElement(Pe,{callback:pn,onCancel:dn});default:return null}},[ir]);function dn(){Xt("")}Object(y.useEffect)(function(){if(zt.current){var St=zt.current,_t=!1,Ot=0;function Kt(Vt){_t=!0,Ot=Vt.pageY}function Jt(){_t=!1}function hr(Vt){if(_t){var Pr=Vt.pageY-Ot;Pr<0&&(Pr=0),Pr>300&&(Pr=300);var en=Ct+Pr+"px";Nt(en)}}return St.addEventListener("mousedown",Kt),document.addEventListener("mousemove",hr),document.addEventListener("mouseup",Jt),function(){St.removeEventListener("mousedown",Kt),document.removeEventListener("mousemove",hr),document.removeEventListener("mouseup",Jt)}}},[U,zt]),Object(y.useEffect)(function(){Nt(Ct)},[Ct]);var En=Se(ut),mn=Se(Rn),cn={width:En,height:mn},pi=Object(y.useMemo)(function(){if(ar){var St=new Date(ar),_t=St.getHours(),Ot=St.getMinutes(),Kt=St.getSeconds();return _t=_t<10?"0"+_t:_t,Ot=Ot<10?"0"+Ot:Ot,Kt=Kt<10?"0"+Kt:Kt,"".concat(_t,":").concat(Ot,":").concat(Kt)}return 0},[ar]);function ji(){window.sessionStorage.removeItem(pr),Yt(!1),yn(0)}function jn(){Yt(!1),yn(0),U.setValue(window.sessionStorage.getItem(pr))}function ua(St,_t){var Ot=U.getValue();Ot=Ot.replace(St,_t),nt(Ot),U==null||U.setValue(Ot)}return A.a.createElement(y.Fragment,null,A.a.createElement("div",{className:"markdown-editor-wrapper",ref:cr},A.a.createElement("div",{className:"markdown-editor-container ".concat(et," ").concat(pt?"on-preview":""," ").concat(Mt?"mini":""," ").concat($t?"full-screen":""),style:cn},A.a.createElement(x,{insertTemp:Tt,watch:pt,fullScreen:$t,showNullButton:Ut,onActionCallback:ln,hidetoolBar:sr,uuid:Zt.current,setOpenPhones:function(){Ht.current=!0}}),A.a.createElement("div",{className:"markdown-editor-body"},A.a.createElement("div",{className:"codemirror-container"},A.a.createElement("textarea",{ref:Ft,placeholder:Zr})),pt?A.a.createElement("div",{ref:Vr,className:"preview-container"},Qt==="stex"&&A.a.createElement(w,{value:Ye}),Qt!=="stex"&&A.a.createElement(p.a,{edit:!0,value:Ye,replaces:ua})):null))),tr?A.a.createElement("a",{ref:zt,className:"editor-resize"}):null,A.a.createElement(D.a,null,me[ir]?A.a.createElement($.a,{centered:!0,title:me[ir],visible:!0,onCancel:dn,footer:null,className:"markdown-popup-form"},un):null))}},RxwV:function(Et,rt,re){"use strict";var he=re("q1tI"),$=re("uciX"),O=re("2W6z"),Z=re.n(O),F=re("4IlW"),I=re("uK0f"),K=re.n(I);function B(ae,de){if(ae===de)return!0;if(!ae||!de)return!1;var ne=ae.length;if(de.length!==ne)return!1;for(var se=0;se<ne;se++)if(ae[se]!==de[se])return!1;return!0}function P(ae){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?P=function(ne){return typeof ne}:P=function(ne){return ne&&typeof Symbol=="function"&&ne.constructor===Symbol&&ne!==Symbol.prototype?"symbol":typeof ne},P(ae)}function R(ae,de){if(!(ae instanceof de))throw new TypeError("Cannot call a class as a function")}function y(ae,de){for(var ne=0;ne<de.length;ne++){var se=de[ne];se.enumerable=se.enumerable||!1,se.configurable=!0,"value"in se&&(se.writable=!0),Object.defineProperty(ae,se.key,se)}}function A(ae,de,ne){return de&&y(ae.prototype,de),ne&&y(ae,ne),ae}function _(ae,de){if(typeof de!="function"&&de!==null)throw new TypeError("Super expression must either be null or a function");ae.prototype=Object.create(de&&de.prototype,{constructor:{value:ae,writable:!0,configurable:!0}}),de&&k(ae,de)}function k(ae,de){return k=Object.setPrototypeOf||function(se,J){return se.__proto__=J,se},k(ae,de)}function C(ae){var de=o();return function(){var ne=l(ae),se;if(de){var J=l(this).constructor;se=Reflect.construct(ne,arguments,J)}else se=ne.apply(this,arguments);return E(this,se)}}function E(ae,de){return de&&(P(de)==="object"||typeof de=="function")?de:h(ae)}function h(ae){if(ae===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return ae}function o(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(ae){return!1}}function l(ae){return l=Object.setPrototypeOf?Object.getPrototypeOf:function(ne){return ne.__proto__||Object.getPrototypeOf(ne)},l(ae)}var d=function(){var ae=function(de){_(se,de);var ne=C(se);function se(){var J;return R(this,se),J=ne.apply(this,arguments),J.menuItems={},J.saveMenuItem=function(ee){return function(ie){J.menuItems[ee]=ie}},J}return A(se,[{key:"componentDidMount",value:function(){this.scrollActiveItemToView()}},{key:"componentDidUpdate",value:function(ee){!ee.visible&&this.props.visible&&this.scrollActiveItemToView()}},{key:"getFieldName",value:function(ee){var ie=this.props,fe=ie.fieldNames,Ae=ie.defaultFieldNames;return fe[ee]||Ae[ee]}},{key:"getOption",value:function(ee,ie){var fe=this.props,Ae=fe.prefixCls,ge=fe.expandTrigger,Oe=fe.expandIcon,Pe=fe.loadingIcon,je=this.props.onSelect.bind(this,ee,ie),Ke=this.props.onItemDoubleClick.bind(this,ee,ie),He={onClick:je,onDoubleClick:Ke},Fe="".concat(Ae,"-menu-item"),qe=null,De=ee[this.getFieldName("children")]&&ee[this.getFieldName("children")].length>0;(De||ee.isLeaf===!1)&&(Fe+=" ".concat(Ae,"-menu-item-expand"),ee.loading||(qe=he.createElement("span",{className:"".concat(Ae,"-menu-item-expand-icon")},Oe))),ge==="hover"&&(De||ee.isLeaf===!1)&&(He={onMouseEnter:this.delayOnSelect.bind(this,je),onMouseLeave:this.delayOnSelect.bind(this),onClick:je}),this.isActiveOption(ee,ie)&&(Fe+=" ".concat(Ae,"-menu-item-active"),He.ref=this.saveMenuItem(ie)),ee.disabled&&(Fe+=" ".concat(Ae,"-menu-item-disabled"));var Ne=null;ee.loading&&(Fe+=" ".concat(Ae,"-menu-item-loading"),Ne=Pe||null);var Be="";return"title"in ee?Be=ee.title:typeof ee[this.getFieldName("label")]=="string"&&(Be=ee[this.getFieldName("label")]),he.createElement("li",Object.assign({key:ee[this.getFieldName("value")],className:Fe,title:Be},He,{role:"menuitem",onMouseDown:function(Ge){return Ge.preventDefault()}}),ee[this.getFieldName("label")],qe,Ne)}},{key:"getActiveOptions",value:function(ee){var ie=this,fe=this.props.options,Ae=ee||this.props.activeValue;return K()(fe,function(ge,Oe){return ge[ie.getFieldName("value")]===Ae[Oe]},{childrenKeyName:this.getFieldName("children")})}},{key:"getShowOptions",value:function(){var ee=this,ie=this.props.options,fe=this.getActiveOptions().map(function(Ae){return Ae[ee.getFieldName("children")]}).filter(function(Ae){return!!Ae});return fe.unshift(ie),fe}},{key:"delayOnSelect",value:function(ee){for(var ie=this,fe=arguments.length,Ae=new Array(fe>1?fe-1:0),ge=1;ge<fe;ge++)Ae[ge-1]=arguments[ge];this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null),typeof ee=="function"&&(this.delayTimer=window.setTimeout(function(){ee(Ae),ie.delayTimer=null},150))}},{key:"scrollActiveItemToView",value:function(){for(var ee=this.getShowOptions().length,ie=0;ie<ee;ie++){var fe=this.menuItems[ie];fe&&fe.parentElement&&(fe.parentElement.scrollTop=fe.offsetTop)}}},{key:"isActiveOption",value:function(ee,ie){var fe=this.props.activeValue,Ae=fe===void 0?[]:fe;return Ae[ie]===ee[this.getFieldName("value")]}},{key:"render",value:function(){var ee=this,ie=this.props,fe=ie.prefixCls,Ae=ie.dropdownMenuColumnStyle;return he.createElement("div",null,this.getShowOptions().map(function(ge,Oe){return he.createElement("ul",{className:"".concat(fe,"-menu"),key:Oe,style:Ae},ge.map(function(Pe){return ee.getOption(Pe,Oe)}))}))}}]),se}(he.Component);return ae.defaultProps={options:[],value:[],activeValue:[],onSelect:function(){},prefixCls:"rc-cascader-menus",visible:!1,expandTrigger:"click"},ae}(),S=d,v={bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},topLeft:{points:["bl","tl"],offset:[0,-4],overflow:{adjustX:1,adjustY:1}},bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},topRight:{points:["br","tr"],offset:[0,-4],overflow:{adjustX:1,adjustY:1}}},p=v;function w(ae){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?w=function(ne){return typeof ne}:w=function(ne){return ne&&typeof Symbol=="function"&&ne.constructor===Symbol&&ne!==Symbol.prototype?"symbol":typeof ne},w(ae)}function b(ae,de){if(ae==null)return{};var ne=u(ae,de),se,J;if(Object.getOwnPropertySymbols){var ee=Object.getOwnPropertySymbols(ae);for(J=0;J<ee.length;J++){if(se=ee[J],de.indexOf(se)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(ae,se))continue;ne[se]=ae[se]}}return ne}function u(ae,de){if(ae==null)return{};var ne={},se=Object.keys(ae),J,ee;for(ee=0;ee<se.length;ee++){if(J=se[ee],de.indexOf(J)>=0)continue;ne[J]=ae[J]}return ne}function f(ae){return m(ae)||T(ae)||a(ae)||s()}function s(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function a(ae,de){if(!ae)return;if(typeof ae=="string")return x(ae,de);var ne=Object.prototype.toString.call(ae).slice(8,-1);if(ne==="Object"&&ae.constructor&&(ne=ae.constructor.name),ne==="Map"||ne==="Set")return Array.from(ae);if(ne==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ne))return x(ae,de)}function T(ae){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(ae))return Array.from(ae)}function m(ae){if(Array.isArray(ae))return x(ae)}function x(ae,de){(de==null||de>ae.length)&&(de=ae.length);for(var ne=0,se=new Array(de);ne<de;ne++)se[ne]=ae[ne];return se}function D(ae,de){if(!(ae instanceof de))throw new TypeError("Cannot call a class as a function")}function j(ae,de){for(var ne=0;ne<de.length;ne++){var se=de[ne];se.enumerable=se.enumerable||!1,se.configurable=!0,"value"in se&&(se.writable=!0),Object.defineProperty(ae,se.key,se)}}function z(ae,de,ne){return de&&j(ae.prototype,de),ne&&j(ae,ne),ae}function V(ae,de){if(typeof de!="function"&&de!==null)throw new TypeError("Super expression must either be null or a function");ae.prototype=Object.create(de&&de.prototype,{constructor:{value:ae,writable:!0,configurable:!0}}),de&&M(ae,de)}function M(ae,de){return M=Object.setPrototypeOf||function(se,J){return se.__proto__=J,se},M(ae,de)}function N(ae){var de=pe();return function(){var ne=ve(ae),se;if(de){var J=ve(this).constructor;se=Reflect.construct(ne,arguments,J)}else se=ne.apply(this,arguments);return Y(this,se)}}function Y(ae,de){return de&&(w(de)==="object"||typeof de=="function")?de:oe(ae)}function oe(ae){if(ae===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return ae}function pe(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(ae){return!1}}function ve(ae){return ve=Object.setPrototypeOf?Object.getPrototypeOf:function(ne){return ne.__proto__||Object.getPrototypeOf(ne)},ve(ae)}var Le=function(){var ae=function(de){V(se,de);var ne=N(se);function se(J){var ee;D(this,se),ee=ne.call(this,J),ee.setPopupVisible=function(fe){var Ae=ee.state.value;"popupVisible"in ee.props||ee.setState({popupVisible:fe}),fe&&!ee.state.popupVisible&&ee.setState({activeValue:Ae}),ee.props.onPopupVisibleChange(fe)},ee.handleChange=function(fe,Ae,ge){var Oe=Ae.visible;(ge.type!=="keydown"||ge.keyCode===F.a.ENTER)&&(ee.props.onChange(fe.map(function(Pe){return Pe[ee.getFieldName("value")]}),fe),ee.setPopupVisible(Oe))},ee.handlePopupVisibleChange=function(fe){ee.setPopupVisible(fe)},ee.handleMenuSelect=function(fe,Ae,ge){var Oe=ee.trigger.getRootDomNode();Oe&&Oe.focus&&Oe.focus();var Pe=ee.props,je=Pe.changeOnSelect,Ke=Pe.loadData,He=Pe.expandTrigger;if(!fe||fe.disabled)return;var Fe=ee.state.activeValue;Fe=Fe.slice(0,Ae+1),Fe[Ae]=fe[ee.getFieldName("value")];var qe=ee.getActiveOptions(Fe);if(fe.isLeaf===!1&&!fe[ee.getFieldName("children")]&&Ke){je&&ee.handleChange(qe,{visible:!0},ge),ee.setState({activeValue:Fe}),Ke(qe);return}var De={};!fe[ee.getFieldName("children")]||!fe[ee.getFieldName("children")].length?(ee.handleChange(qe,{visible:!1},ge),De.value=Fe):je&&(ge.type==="click"||ge.type==="keydown")&&(He==="hover"?ee.handleChange(qe,{visible:!1},ge):ee.handleChange(qe,{visible:!0},ge),De.value=Fe),De.activeValue=Fe,("value"in ee.props||ge.type==="keydown"&&ge.keyCode!==F.a.ENTER)&&delete De.value,ee.setState(De)},ee.handleItemDoubleClick=function(){var fe=ee.props.changeOnSelect;fe&&ee.setPopupVisible(!1)},ee.handleKeyDown=function(fe){var Ae=ee.props.children;if(Ae&&Ae.props.onKeyDown){Ae.props.onKeyDown(fe);return}var ge=f(ee.state.activeValue),Oe=ge.length-1<0?0:ge.length-1,Pe=ee.getCurrentLevelOptions(),je=Pe.map(function(qe){return qe[ee.getFieldName("value")]}).indexOf(ge[Oe]);if(fe.keyCode!==F.a.DOWN&&fe.keyCode!==F.a.UP&&fe.keyCode!==F.a.LEFT&&fe.keyCode!==F.a.RIGHT&&fe.keyCode!==F.a.ENTER&&fe.keyCode!==F.a.SPACE&&fe.keyCode!==F.a.BACKSPACE&&fe.keyCode!==F.a.ESC&&fe.keyCode!==F.a.TAB)return;if(!ee.state.popupVisible&&fe.keyCode!==F.a.BACKSPACE&&fe.keyCode!==F.a.LEFT&&fe.keyCode!==F.a.RIGHT&&fe.keyCode!==F.a.ESC&&fe.keyCode!==F.a.TAB){ee.setPopupVisible(!0);return}if(fe.keyCode===F.a.DOWN||fe.keyCode===F.a.UP){fe.preventDefault();var Ke=je;Ke!==-1?fe.keyCode===F.a.DOWN?(Ke+=1,Ke=Ke>=Pe.length?0:Ke):(Ke-=1,Ke=Ke<0?Pe.length-1:Ke):Ke=0,ge[Oe]=Pe[Ke][ee.getFieldName("value")]}else if(fe.keyCode===F.a.LEFT||fe.keyCode===F.a.BACKSPACE)fe.preventDefault(),ge.splice(ge.length-1,1);else if(fe.keyCode===F.a.RIGHT)fe.preventDefault(),Pe[je]&&Pe[je][ee.getFieldName("children")]&&ge.push(Pe[je][ee.getFieldName("children")][0][ee.getFieldName("value")]);else if(fe.keyCode===F.a.ESC||fe.keyCode===F.a.TAB){ee.setPopupVisible(!1);return}(!ge||ge.length===0)&&ee.setPopupVisible(!1);var He=ee.getActiveOptions(ge),Fe=He[He.length-1];ee.handleMenuSelect(Fe,He.length-1,fe),ee.props.onKeyDown&&ee.props.onKeyDown(fe)},ee.saveTrigger=function(fe){ee.trigger=fe};var ie=[];return"value"in J?ie=J.value||[]:"defaultValue"in J&&(ie=J.defaultValue||[]),Z()(!("filedNames"in J),"`filedNames` of Cascader is a typo usage and deprecated, please use `fieldNames` instead."),ee.state={popupVisible:J.popupVisible,activeValue:ie,value:ie,prevProps:J},ee.defaultFieldNames={label:"label",value:"value",children:"children"},ee}return z(se,[{key:"getPopupDOMNode",value:function(){return this.trigger.getPopupDomNode()}},{key:"getFieldName",value:function(ee){var ie=this.defaultFieldNames,fe=this.props,Ae=fe.fieldNames,ge=fe.filedNames;return"filedNames"in this.props?ge[ee]||ie[ee]:Ae[ee]||ie[ee]}},{key:"getFieldNames",value:function(){var ee=this.props,ie=ee.fieldNames,fe=ee.filedNames;return"filedNames"in this.props?fe:ie}},{key:"getCurrentLevelOptions",value:function(){var ee=this,ie=this.props.options,fe=ie===void 0?[]:ie,Ae=this.state.activeValue,ge=Ae===void 0?[]:Ae,Oe=K()(fe,function(Pe,je){return Pe[ee.getFieldName("value")]===ge[je]},{childrenKeyName:this.getFieldName("children")});return Oe[Oe.length-2]?Oe[Oe.length-2][this.getFieldName("children")]:f(fe).filter(function(Pe){return!Pe.disabled})}},{key:"getActiveOptions",value:function(ee){var ie=this;return K()(this.props.options||[],function(fe,Ae){return fe[ie.getFieldName("value")]===ee[Ae]},{childrenKeyName:this.getFieldName("children")})}},{key:"render",value:function(){var ee=this.props,ie=ee.prefixCls,fe=ee.transitionName,Ae=ee.popupClassName,ge=ee.options,Oe=ge===void 0?[]:ge,Pe=ee.disabled,je=ee.builtinPlacements,Ke=ee.popupPlacement,He=ee.children,Fe=ee.dropdownRender,qe=b(ee,["prefixCls","transitionName","popupClassName","options","disabled","builtinPlacements","popupPlacement","children","dropdownRender"]),De=he.createElement("div",null),Ne="";Oe&&Oe.length>0?De=he.createElement(S,Object.assign({},this.props,{fieldNames:this.getFieldNames(),defaultFieldNames:this.defaultFieldNames,activeValue:this.state.activeValue,onSelect:this.handleMenuSelect,onItemDoubleClick:this.handleItemDoubleClick,visible:this.state.popupVisible})):Ne=" ".concat(ie,"-menus-empty");var Be=De;return Fe&&(Be=Fe(De)),he.createElement($.a,Object.assign({ref:this.saveTrigger},qe,{popupPlacement:Ke,builtinPlacements:je,popupTransitionName:fe,action:Pe?[]:["click"],popupVisible:Pe?!1:this.state.popupVisible,onPopupVisibleChange:this.handlePopupVisibleChange,prefixCls:"".concat(ie,"-menus"),popupClassName:Ae+Ne,popup:Be}),he.cloneElement(He,{onKeyDown:this.handleKeyDown,tabIndex:Pe?void 0:0}))}}],[{key:"getDerivedStateFromProps",value:function(ee,ie){var fe=ie.prevProps,Ae=fe===void 0?{}:fe,ge={prevProps:ee};return"value"in ee&&!B(Ae.value,ee.value)&&(ge.value=ee.value||[],"loadData"in ee||(ge.activeValue=ee.value||[])),"popupVisible"in ee&&(ge.popupVisible=ee.popupVisible),ge}}]),se}(he.Component);return ae.defaultProps={onChange:function(){},onPopupVisibleChange:function(){},disabled:!1,transitionName:"",prefixCls:"rc-cascader",popupClassName:"",popupPlacement:"bottomLeft",builtinPlacements:p,expandTrigger:"click",fieldNames:{label:"label",value:"value",children:"children"},expandIcon:">"},ae}(),ke=Le,ce=rt.a=ke},SJMd:function(Et,rt){/**
|
|
* @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 re,he,$,O=!1,Z,F;window.PR_SHOULD_USE_CONTINUATION=!0;var I,K;(function(){var B=window,P=["break,continue,do,else,for,if,return,while"],R=[P,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],y=[R,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],A=[y,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],_=[y,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],k=[y,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],C="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",E=[y,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],h="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[P,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],l=[P,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],d=[P,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],S=[A,k,_,E,h,o,l,d],v=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,p="str",w="kwd",b="com",u="typ",f="lit",s="pun",a="pln",T="tag",m="dec",x="src",D="atn",j="atv",z="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function M(ge){for(var Oe=0,Pe=!1,je=!1,Ke=0,He=ge.length;Ke<He;++Ke){var Fe=ge[Ke];if(Fe.ignoreCase)je=!0;else if(/[a-z]/i.test(Fe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Pe=!0,je=!1;break}}var qe={b:8,t:9,n:10,v:11,f:12,r:13};function De(Ve){var Re=Ve.charCodeAt(0);if(Re!==92)return Re;var Qe=Ve.charAt(1);return Re=qe[Qe],Re||("0"<=Qe&&Qe<="7"?parseInt(Ve.substring(1),8):Qe==="u"||Qe==="x"?parseInt(Ve.substring(2),16):Ve.charCodeAt(1))}function Ne(Ve){if(Ve<32)return(Ve<16?"\\x0":"\\x")+Ve.toString(16);var Re=String.fromCharCode(Ve);return Re==="\\"||Re==="-"||Re==="]"||Re==="^"?"\\"+Re:Re}function Be(Ve){var Re=Ve.substring(1,Ve.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),Qe=[],$e=Re[0]==="^",Me=["["];$e&&Me.push("^");for(var We=$e?1:0,Se=Re.length;We<Se;++We){var ye=Re[We];if(/\\[bdsw]/i.test(ye))Me.push(ye);else{var xe=De(ye),le;We+2<Se&&Re[We+1]==="-"?(le=De(Re[We+2]),We+=2):le=xe,Qe.push([xe,le]),le<65||xe>122||(le<65||xe>90||Qe.push([Math.max(65,xe)|32,Math.min(le,90)|32]),le<97||xe>122||Qe.push([Math.max(97,xe)&~32,Math.min(le,122)&~32]))}}Qe.sort(function(we,Ie){return we[0]-Ie[0]||Ie[1]-we[1]});for(var ue=[],me=[],We=0;We<Qe.length;++We){var Ee=Qe[We];Ee[0]<=me[1]+1?me[1]=Math.max(me[1],Ee[1]):ue.push(me=Ee)}for(var We=0;We<ue.length;++We){var Ee=ue[We];Me.push(Ne(Ee[0])),Ee[1]>Ee[0]&&(Ee[1]+1>Ee[0]&&Me.push("-"),Me.push(Ne(Ee[1])))}return Me.push("]"),Me.join("")}function ze(Ve){for(var Re=Ve.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")),Qe=Re.length,$e=[],Me=0,We=0;Me<Qe;++Me){var Se=Re[Me];if(Se==="(")++We;else if(Se.charAt(0)==="\\"){var ye=+Se.substring(1);ye&&(ye<=We?$e[ye]=-1:Re[Me]=Ne(ye))}}for(var Me=1;Me<$e.length;++Me)$e[Me]===-1&&($e[Me]=++Oe);for(var Me=0,We=0;Me<Qe;++Me){var Se=Re[Me];if(Se==="(")++We,$e[We]||(Re[Me]="(?:");else if(Se.charAt(0)==="\\"){var ye=+Se.substring(1);ye&&ye<=We&&(Re[Me]="\\"+$e[ye])}}for(var Me=0;Me<Qe;++Me)Re[Me]==="^"&&Re[Me+1]!=="^"&&(Re[Me]="");if(Ve.ignoreCase&&Pe)for(var Me=0;Me<Qe;++Me){var Se=Re[Me],xe=Se.charAt(0);Se.length>=2&&xe==="["?Re[Me]=Be(Se):xe!=="\\"&&(Re[Me]=Se.replace(/[a-zA-Z]/g,function(me){var Ee=me.charCodeAt(0);return"["+String.fromCharCode(Ee&~32,Ee|32)+"]"}))}return Re.join("")}for(var Ge=[],Ke=0,He=ge.length;Ke<He;++Ke){var Fe=ge[Ke];if(Fe.global||Fe.multiline)throw new Error(""+Fe);Ge.push("(?:"+ze(Fe)+")")}return new RegExp(Ge.join("|"),je?"gi":"g")}function N(ge,Oe){var Pe=/(?:^|\s)nocode(?:\s|$)/,je=[],Ke=0,He=[],Fe=0;function qe(De){var Ne=De.nodeType;if(Ne==1){if(Pe.test(De.className))return;for(var Be=De.firstChild;Be;Be=Be.nextSibling)qe(Be);var ze=De.nodeName.toLowerCase();(ze==="br"||ze==="li")&&(je[Fe]=`
|
|
`,He[Fe<<1]=Ke++,He[Fe++<<1|1]=De)}else if(Ne==3||Ne==4){var Ge=De.nodeValue;Ge.length&&(Oe?Ge=Ge.replace(/\r\n?/g,`
|
|
`):Ge=Ge.replace(/[ \t\r\n]+/g," "),je[Fe]=Ge,He[Fe<<1]=Ke,Ke+=Ge.length,He[Fe++<<1|1]=De)}}return qe(ge),{sourceCode:je.join("").replace(/\n$/,""),spans:He}}function Y(ge,Oe,Pe,je,Ke){if(!Pe)return;var He={sourceNode:ge,pre:1,langExtension:null,numberLines:null,sourceCode:Pe,spans:null,basePos:Oe,decorations:null};je(He),Ke.push.apply(Ke,He.decorations)}var oe=/\S/;function pe(ge){for(var Oe=void 0,Pe=ge.firstChild;Pe;Pe=Pe.nextSibling){var je=Pe.nodeType;Oe=je===1?Oe?ge:Pe:je===3&&oe.test(Pe.nodeValue)?ge:Oe}return Oe===ge?void 0:Oe}function ve(ge,Oe){var Pe={},je;(function(){for(var Fe=ge.concat(Oe),qe=[],De={},Ne=0,Be=Fe.length;Ne<Be;++Ne){var ze=Fe[Ne],Ge=ze[3];if(Ge)for(var Ve=Ge.length;--Ve>=0;)Pe[Ge.charAt(Ve)]=ze;var Re=ze[1],Qe=""+Re;De.hasOwnProperty(Qe)||(qe.push(Re),De[Qe]=null)}qe.push(/[\0-\uffff]/),je=M(qe)})();var Ke=Oe.length,He=function(Fe){for(var qe=Fe.sourceCode,De=Fe.basePos,Ne=Fe.sourceNode,Be=[De,a],ze=0,Ge=qe.match(je)||[],Ve={},Re=0,Qe=Ge.length;Re<Qe;++Re){var $e=Ge[Re],Me=Ve[$e],We=void 0,Se;if(typeof Me=="string")Se=!1;else{var ye=Pe[$e.charAt(0)];if(ye)We=$e.match(ye[1]),Me=ye[0];else{for(var xe=0;xe<Ke;++xe)if(ye=Oe[xe],We=$e.match(ye[1]),We){Me=ye[0];break}We||(Me=a)}Se=Me.length>=5&&Me.substring(0,5)==="lang-",Se&&!(We&&typeof We[1]=="string")&&(Se=!1,Me=x),Se||(Ve[$e]=Me)}var le=ze;if(ze+=$e.length,!Se)Be.push(De+le,Me);else{var ue=We[1],me=$e.indexOf(ue),Ee=me+ue.length;We[2]&&(Ee=$e.length-We[2].length,me=Ee-ue.length);var we=Me.substring(5);Y(Ne,De+le,$e.substring(0,me),He,Be),Y(Ne,De+le+me,ue,se(we,ue),Be),Y(Ne,De+le+Ee,$e.substring(Ee),He,Be)}}Fe.decorations=Be};return He}function Le(ge){var Oe=[],Pe=[];ge.tripleQuotedStrings?Oe.push([p,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ge.multiLineStrings?Oe.push([p,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Oe.push([p,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ge.verbatimStrings&&Pe.push([p,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var je=ge.hashComments;je&&(ge.cStyleComments?(je>1?Oe.push([b,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Oe.push([b,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Pe.push([p,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Oe.push([b,/^#[^\r\n]*/,null,"#"])),ge.cStyleComments&&(Pe.push([b,/^\/\/[^\r\n]*/,null]),Pe.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ke=ge.regexLiterals;if(Ke){var He=Ke>1?"":`
|
|
\r`,Fe=He?".":"[\\S\\s]",qe="/(?=[^/*"+He+"])(?:[^/\\x5B\\x5C"+He+"]|\\x5C"+Fe+"|\\x5B(?:[^\\x5C\\x5D"+He+"]|\\x5C"+Fe+")*(?:\\x5D|$))+/";Pe.push(["lang-regex",RegExp("^"+V+"("+qe+")")])}var De=ge.types;De&&Pe.push([u,De]);var Ne=(""+ge.keywords).replace(/^ | $/g,"");Ne.length&&Pe.push([w,new RegExp("^(?:"+Ne.replace(/[\s,]+/g,"|")+")\\b"),null]),Oe.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var Be="^.[^\\s\\w.$@'\"`/\\\\]*";return ge.regexLiterals&&(Be+="(?!s*/)"),Pe.push([f,/^@[a-z_$][a-z_$@0-9]*/i,null],[u,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[f,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[s,new RegExp(Be),null]),ve(Oe,Pe)}var ke=Le({keywords:S,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function ce(ge,Oe,Pe){for(var je=/(?:^|\s)nocode(?:\s|$)/,Ke=/\r\n?|\n/,He=ge.ownerDocument,Fe=He.createElement("li");ge.firstChild;)Fe.appendChild(ge.firstChild);var qe=[Fe];function De(Re){var Qe=Re.nodeType;if(Qe==1&&!je.test(Re.className))if(Re.nodeName==="br")Ne(Re),Re.parentNode&&Re.parentNode.removeChild(Re);else for(var $e=Re.firstChild;$e;$e=$e.nextSibling)De($e);else if((Qe==3||Qe==4)&&Pe){var Me=Re.nodeValue,We=Me.match(Ke);if(We){var Se=Me.substring(0,We.index);Re.nodeValue=Se;var ye=Me.substring(We.index+We[0].length);if(ye){var xe=Re.parentNode;xe.insertBefore(He.createTextNode(ye),Re.nextSibling)}Ne(Re),Se||Re.parentNode.removeChild(Re)}}}function Ne(Re){for(;!Re.nextSibling;)if(Re=Re.parentNode,!Re)return;function Qe(We,Se){var ye=Se?We.cloneNode(!1):We,xe=We.parentNode;if(xe){var le=Qe(xe,1),ue=We.nextSibling;le.appendChild(ye);for(var me=ue;me;me=ue)ue=me.nextSibling,le.appendChild(me)}return ye}for(var $e=Qe(Re.nextSibling,0),Me;(Me=$e.parentNode)&&Me.nodeType===1;)$e=Me;qe.push($e)}for(var Be=0;Be<qe.length;++Be)De(qe[Be]);Oe===(Oe|0)&&qe[0].setAttribute("value",Oe);var ze=He.createElement("ol");ze.className="linenums";for(var Ge=Math.max(0,Oe-1|0)||0,Be=0,Ve=qe.length;Be<Ve;++Be)Fe=qe[Be],Fe.className="L"+(Be+Ge)%10,Fe.firstChild||Fe.appendChild(He.createTextNode("\xA0")),ze.appendChild(Fe);ge.appendChild(ze)}function ae(ge){var Oe=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Oe=Oe&&+Oe[1]<=8;var Pe=/\n/g,je=ge.sourceCode,Ke=je.length,He=0,Fe=ge.spans,qe=Fe.length,De=0,Ne=ge.decorations,Be=Ne.length,ze=0;Ne[Be]=Ke;var Ge,Ve;for(Ve=Ge=0;Ve<Be;)Ne[Ve]!==Ne[Ve+2]?(Ne[Ge++]=Ne[Ve++],Ne[Ge++]=Ne[Ve++]):Ve+=2;for(Be=Ge,Ve=Ge=0;Ve<Be;){for(var Re=Ne[Ve],Qe=Ne[Ve+1],$e=Ve+2;$e+2<=Be&&Ne[$e+1]===Qe;)$e+=2;Ne[Ge++]=Re,Ne[Ge++]=Qe,Ve=$e}Be=Ne.length=Ge;var Me=ge.sourceNode,We="";Me&&(We=Me.style.display,Me.style.display="none");try{for(var Se=null;De<qe;){var ye=Fe[De],xe=Fe[De+2]||Ke,le=Ne[ze+2]||Ke,$e=Math.min(xe,le),ue=Fe[De+1],me;if(ue.nodeType!==1&&(me=je.substring(He,$e))){Oe&&(me=me.replace(Pe,"\r")),ue.nodeValue=me;var Ee=ue.ownerDocument,we=Ee.createElement("span");we.className=Ne[ze+1];var Ie=ue.parentNode;Ie.replaceChild(we,ue),we.appendChild(ue),He<xe&&(Fe[De+1]=ue=Ee.createTextNode(je.substring($e,xe)),Ie.insertBefore(ue,we.nextSibling))}He=$e,He>=xe&&(De+=2),He>=le&&(ze+=2)}}finally{Me&&(Me.style.display=We)}}var de={};function ne(ge,Oe){for(var Pe=Oe.length;--Pe>=0;){var je=Oe[Pe];de.hasOwnProperty(je)?B.console&&console.warn("cannot override language handler %s",je):de[je]=ge}}function se(ge,Oe){return ge&&de.hasOwnProperty(ge)||(ge=/^\s*</.test(Oe)?"default-markup":"default-code"),de[ge]}ne(ke,["default-code"]),ne(ve([],[[a,/^[^<?]+/],[m,/^<!\w[^>]*(?:>|$)/],[b,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[s,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ne(ve([[a,/^[\s]+/,null,` \r
|
|
`],[j,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[T,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[D,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[s,/^[=<>\/]+/],["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"]),ne(ve([],[[j,/^[\s\S]+/]]),["uq.val"]),ne(Le({keywords:A,hashComments:!0,cStyleComments:!0,types:v}),["c","cc","cpp","cxx","cyc","m"]),ne(Le({keywords:"null,true,false"}),["json"]),ne(Le({keywords:k,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:v}),["cs"]),ne(Le({keywords:_,cStyleComments:!0}),["java"]),ne(Le({keywords:d,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ne(Le({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ne(Le({keywords:h,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ne(Le({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ne(Le({keywords:E,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ne(Le({keywords:C,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ne(ve([],[[p,/^[\s\S]+/]]),["regex"]);function J(ge){var Oe=ge.langExtension;try{var Pe=N(ge.sourceNode,ge.pre),je=Pe.sourceCode;ge.sourceCode=je,ge.spans=Pe.spans,ge.basePos=0,se(Oe,je)(ge),ae(ge)}catch(Ke){B.console&&console.log(Ke&&Ke.stack||Ke)}}function ee(ge,Oe,Pe){var je=Pe||!1,Ke=Oe||null,He=document.createElement("div");He.innerHTML="<pre>"+ge+"</pre>",He=He.firstChild,je&&ce(He,je,!0);var Fe={langExtension:Ke,numberLines:je,sourceNode:He,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return J(Fe),He.innerHTML}function ie(ge,Oe){var Pe=Oe||document.body,je=Pe.ownerDocument||document;function Ke(ye){return Pe.getElementsByTagName(ye)}for(var He=[Ke("pre"),Ke("code"),Ke("xmp")],Fe=[],qe=0;qe<He.length;++qe)for(var De=0,Ne=He[qe].length;De<Ne;++De)Fe.push(He[qe][De]);He=null;var Be=Date;Be.now||(Be={now:function(){return+new Date}});var ze=0,Ge=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ve=/\bprettyprint\b/,Re=/\bprettyprinted\b/,Qe=/pre|xmp/i,$e=/^code$/i,Me=/^(?:pre|code|xmp)$/i,We={};function Se(){for(var ye=B.PR_SHOULD_USE_CONTINUATION?Be.now()+250:Infinity;ze<Fe.length&&Be.now()<ye;ze++){for(var xe=Fe[ze],le=We,ue=xe;ue=ue.previousSibling;){var me=ue.nodeType,Ee=(me===7||me===8)&&ue.nodeValue;if(Ee?!/^\??prettify\b/.test(Ee):me!==3||/\S/.test(ue.nodeValue))break;if(Ee){le={},Ee.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Dt,Tt,Bt){le[Tt]=Bt});break}}var we=xe.className;if((le!==We||Ve.test(we))&&!Re.test(we)){for(var Ie=!1,Ze=xe.parentNode;Ze;Ze=Ze.parentNode){var at=Ze.tagName;if(Me.test(at)&&Ze.className&&Ve.test(Ze.className)){Ie=!0;break}}if(!Ie){xe.className+=" prettyprinted";var ht=le.lang;if(!ht){ht=we.match(Ge);var ut;!ht&&(ut=pe(xe))&&$e.test(ut.tagName)&&(ht=ut.className.match(Ge)),ht&&(ht=ht[1])}var xt;if(Qe.test(xe.tagName))xt=1;else{var Ct=xe.currentStyle,st=je.defaultView,Mt=Ct?Ct.whiteSpace:st&&st.getComputedStyle?st.getComputedStyle(xe,null).getPropertyValue("white-space"):0;xt=Mt&&Mt.substring(0,3)==="pre"}var Lt=le.linenums;(Lt=Lt==="true"||+Lt)||(Lt=we.match(/\blinenums\b(?::(\d+))?/),Lt=Lt?Lt[1]&&Lt[1].length?+Lt[1]:!0:!1),Lt&&ce(xe,Lt,xt);var kt={langExtension:ht,sourceNode:xe,numberLines:Lt,pre:xt,sourceCode:null,basePos:null,spans:null,decorations:null};J(kt)}}}ze<Fe.length?B.setTimeout(Se,250):typeof ge=="function"&&ge()}Se()}var fe=B.PR={createSimpleLexer:ve,registerLangHandler:ne,sourceDecorator:Le,PR_ATTRIB_NAME:D,PR_ATTRIB_VALUE:j,PR_COMMENT:b,PR_DECLARATION:m,PR_KEYWORD:w,PR_LITERAL:f,PR_NOCODE:z,PR_PLAIN:a,PR_PUNCTUATION:s,PR_SOURCE:x,PR_STRING:p,PR_TAG:T,PR_TYPE:u,prettyPrintOne:O?B.prettyPrintOne=ee:I=ee,prettyPrint:K=O?B.prettyPrint=ie:K=ie},Ae=B.define;typeof Ae=="function"&&Ae.amd&&Ae("google-code-prettify",[],function(){return fe})})()},"VrN/":function(Et,rt,re){(function(he,$){Et.exports=$()})(this,function(){"use strict";var he=navigator.userAgent,$=navigator.platform,O=/gecko\/\d/i.test(he),Z=/MSIE \d/.test(he),F=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(he),I=/Edge\/(\d+)/.exec(he),K=Z||F||I,B=K&&(Z?document.documentMode||6:+(I||F)[1]),P=!I&&/WebKit\//.test(he),R=P&&/Qt\/\d+\.\d+/.test(he),y=!I&&/Chrome\//.test(he),A=/Opera\//.test(he),_=/Apple Computer/.test(navigator.vendor),k=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(he),C=/PhantomJS/.test(he),E=!I&&/AppleWebKit/.test(he)&&/Mobile\/\w+/.test(he),h=/Android/.test(he),o=E||h||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(he),l=E||/Mac/.test($),d=/\bCrOS\b/.test(he),S=/win/i.test($),v=A&&he.match(/Version\/(\d*\.\d*)/);v&&(v=Number(v[1])),v&&v>=15&&(A=!1,P=!0);var p=l&&(R||A&&(v==null||v<12.11)),w=O||K&&B>=9;function b(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var u=function(e,t){var n=e.className,r=b(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function f(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function s(e,t){return f(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var L=0;L<t.length;++L)i.appendChild(t[L]);return i}function T(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var m;document.createRange?m=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:m=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function x(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function D(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function j(e,t){var n=e.className;b(t).test(n)||(e.className+=(n?" ":"")+t)}function z(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!b(n[r]).test(t)&&(t+=" "+n[r]);return t}var V=function(e){e.select()};E?V=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:K&&(V=function(e){try{e.select()}catch(t){}});function M(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function N(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function Y(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var L=r||0,W=i||0;;){var X=e.indexOf(" ",L);if(X<0||X>=t)return W+(t-L);W+=X-L,W+=n-W%n,L=X+1}}var oe=function(){this.id=null,this.f=null,this.time=0,this.handler=M(this.onTimeout,this)};oe.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},oe.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function pe(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var ve=50,Le={toString:function(){return"CodeMirror.Pass"}},ke={scroll:!1},ce={origin:"*mouse"},ae={origin:"+move"};function de(e,t,n){for(var r=0,i=0;;){var L=e.indexOf(" ",r);L==-1&&(L=e.length);var W=L-r;if(L==e.length||i+W>=t)return r+Math.min(W,t-i);if(i+=L-r,i+=n-i%n,r=L+1,i>=t)return r}}var ne=[""];function se(e){for(;ne.length<=e;)ne.push(J(ne)+" ");return ne[e]}function J(e){return e[e.length-1]}function ee(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function ie(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function fe(){}function Ae(e,t){var n;return Object.create?n=Object.create(e):(fe.prototype=e,n=new fe),t&&N(t,n),n}var ge=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Oe(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ge.test(e))}function Pe(e,t){return t?t.source.indexOf("\\w")>-1&&Oe(e)?!0:t.test(e):Oe(e)}function je(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ke=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function He(e){return e.charCodeAt(0)>=768&&Ke.test(e)}function Fe(e,t,n){for(;(n<0?t>0:t<e.length)&&He(e.charAt(t));)t+=n;return t}function qe(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,L=r<0?Math.ceil(i):Math.floor(i);if(L==t)return e(L)?t:n;e(L)?n=L:t=L+r}}function De(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,L=0;L<e.length;++L){var W=e[L];(W.from<n&&W.to>t||t==n&&W.to==t)&&(r(Math.max(W.from,t),Math.min(W.to,n),W.level==1?"rtl":"ltr",L),i=!0)}i||r(t,n,"ltr")}var Ne=null;function Be(e,t,n){var r;Ne=null;for(var i=0;i<e.length;++i){var L=e[i];if(L.from<t&&L.to>t)return i;L.to==t&&(L.from!=L.to&&n=="before"?r=i:Ne=i),L.from==t&&(L.from!=L.to&&n!="before"?r=i:Ne=i)}return r!=null?r:Ne}var ze=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(te){return te<=247?e.charAt(te):1424<=te&&te<=1524?"R":1536<=te&&te<=1785?t.charAt(te-1536):1774<=te&&te<=2220?"r":8192<=te&&te<=8203?"w":te==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,L=/[LRr]/,W=/[Lb1n]/,X=/[1n]/;function Q(te,be,Te){this.level=te,this.from=be,this.to=Te}return function(te,be){var Te=be=="ltr"?"L":"R";if(te.length==0||be=="ltr"&&!r.test(te))return!1;for(var Ue=te.length,_e=[],Je=0;Je<Ue;++Je)_e.push(n(te.charCodeAt(Je)));for(var tt=0,it=Te;tt<Ue;++tt){var dt=_e[tt];dt=="m"?_e[tt]=it:it=dt}for(var gt=0,ct=Te;gt<Ue;++gt){var bt=_e[gt];bt=="1"&&ct=="r"?_e[gt]="n":L.test(bt)&&(ct=bt,bt=="r"&&(_e[gt]="R"))}for(var Rt=1,At=_e[0];Rt<Ue-1;++Rt){var Wt=_e[Rt];Wt=="+"&&At=="1"&&_e[Rt+1]=="1"?_e[Rt]="1":Wt==","&&At==_e[Rt+1]&&(At=="1"||At=="n")&&(_e[Rt]=At),At=Wt}for(var fr=0;fr<Ue;++fr){var Br=_e[fr];if(Br==",")_e[fr]="N";else if(Br=="%"){var Sr=void 0;for(Sr=fr+1;Sr<Ue&&_e[Sr]=="%";++Sr);for(var fn=fr&&_e[fr-1]=="!"||Sr<Ue&&_e[Sr]=="1"?"1":"N",an=fr;an<Sr;++an)_e[an]=fn;fr=Sr-1}}for(var Or=0,on=Te;Or<Ue;++Or){var Gr=_e[Or];on=="L"&&Gr=="1"?_e[Or]="L":L.test(Gr)&&(on=Gr)}for(var Mr=0;Mr<Ue;++Mr)if(i.test(_e[Mr])){var Rr=void 0;for(Rr=Mr+1;Rr<Ue&&i.test(_e[Rr]);++Rr);for(var kr=(Mr?_e[Mr-1]:Te)=="L",sn=(Rr<Ue?_e[Rr]:Te)=="L",hi=kr==sn?kr?"L":"R":Te,Bn=Mr;Bn<Rr;++Bn)_e[Bn]=hi;Mr=Rr-1}for(var $r=[],An,jr=0;jr<Ue;)if(W.test(_e[jr])){var Va=jr;for(++jr;jr<Ue&&W.test(_e[jr]);++jr);$r.push(new Q(0,Va,jr))}else{var On=jr,$n=$r.length,Zn=be=="rtl"?1:0;for(++jr;jr<Ue&&_e[jr]!="L";++jr);for(var Qr=On;Qr<jr;)if(X.test(_e[Qr])){On<Qr&&($r.splice($n,0,new Q(1,On,Qr)),$n+=Zn);var fi=Qr;for(++Qr;Qr<jr&&X.test(_e[Qr]);++Qr);$r.splice($n,0,new Q(2,fi,Qr)),$n+=Zn,On=Qr}else++Qr;On<jr&&$r.splice($n,0,new Q(1,On,jr))}return be=="ltr"&&($r[0].level==1&&(An=te.match(/^\s+/))&&($r[0].from=An[0].length,$r.unshift(new Q(0,0,An[0].length))),J($r).level==1&&(An=te.match(/\s+$/))&&(J($r).to-=An[0].length,$r.push(new Q(0,Ue-An[0].length,Ue)))),be=="rtl"?$r.reverse():$r}}();function Ge(e,t){var n=e.order;return n==null&&(n=e.order=ze(e.text,t)),n}var Ve=[],Re=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Ve).concat(n)}};function Qe(e,t){return e._handlers&&e._handlers[t]||Ve}function $e(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var L=pe(i,n);L>-1&&(r[t]=i.slice(0,L).concat(i.slice(L+1)))}}}function Me(e,t){var n=Qe(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function We(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Me(e,n||t.type,e,t),me(t)||t.codemirrorIgnore}function Se(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)pe(n,t[r])==-1&&n.push(t[r])}function ye(e,t){return Qe(e,t).length>0}function xe(e){e.prototype.on=function(t,n){Re(this,t,n)},e.prototype.off=function(t,n){$e(this,t,n)}}function le(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ue(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function me(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Ee(e){le(e),ue(e)}function we(e){return e.target||e.srcElement}function Ie(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),l&&e.ctrlKey&&t==1&&(t=3),t}var Ze=function(){if(K&&B<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),at;function ht(e){if(at==null){var t=a("span","\u200B");s(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(at=t.offsetWidth<=1&&t.offsetHeight>2&&!(K&&B<8))}var n=at?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var ut;function xt(e){if(ut!=null)return ut;var t=s(e,document.createTextNode("A\u062EA")),n=m(t,0,1).getBoundingClientRect(),r=m(t,1,2).getBoundingClientRect();return f(e),!n||n.left==n.right?!1:ut=r.right-n.right<3}var Ct=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
|
|
`,t);i==-1&&(i=e.length);var L=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),W=L.indexOf("\r");W!=-1?(n.push(L.slice(0,W)),t+=W+1):(n.push(L),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},st=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},Mt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Lt=null;function kt(e){if(Lt!=null)return Lt;var t=s(e,a("span","x")),n=t.getBoundingClientRect(),r=m(t,0,1).getBoundingClientRect();return Lt=Math.abs(n.left-r.left)>1}var Dt={},Tt={};function Bt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Dt[e]=t}function Qt(e,t){Tt[e]=t}function yt(e){if(typeof e=="string"&&Tt.hasOwnProperty(e))e=Tt[e];else if(e&&typeof e.name=="string"&&Tt.hasOwnProperty(e.name)){var t=Tt[e.name];typeof t=="string"&&(t={name:t}),e=Ae(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return yt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return yt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function pr(e,t){t=yt(t);var n=Dt[t.name];if(!n)return pr(e,"text/plain");var r=n(e,t);if(jt.hasOwnProperty(t.name)){var i=jt[t.name];for(var L in i){if(!i.hasOwnProperty(L))continue;r.hasOwnProperty(L)&&(r["_"+L]=r[L]),r[L]=i[L]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var W in t.modeProps)r[W]=t.modeProps[W];return r}var jt={};function tr(e,t){var n=jt.hasOwnProperty(e)?jt[e]:jt[e]={};N(t,n)}function ur(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function nr(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 vr(e,t,n){return e.startState?e.startState(t,n):!0}var Ut=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};Ut.prototype.eol=function(){return this.pos>=this.string.length},Ut.prototype.sol=function(){return this.pos==this.lineStart},Ut.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ut.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ut.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},Ut.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ut.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ut.prototype.skipToEnd=function(){this.pos=this.string.length},Ut.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ut.prototype.backUp=function(e){this.pos-=e},Ut.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Y(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Y(this.string,this.lineStart,this.tabSize):0)},Ut.prototype.indentation=function(){return Y(this.string,null,this.tabSize)-(this.lineStart?Y(this.string,this.lineStart,this.tabSize):0)},Ut.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(W){return n?W.toLowerCase():W},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var L=this.string.slice(this.pos).match(e);return L&&L.index>0?null:(L&&t!==!1&&(this.pos+=L[0].length),L)}},Ut.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ut.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ut.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ut.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ft(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],L=i.chunkSize();if(t<L){n=i;break}t-=L}return n.lines[t]}function sr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(L){var W=L.text;i==n.line&&(W=W.slice(0,n.ch)),i==t.line&&(W=W.slice(t.ch)),r.push(W),++i}),r}function Tr(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function gr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Pt(e){if(e.parent==null)return null;for(var t=e.parent,n=pe(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;!(r.children[i]==t);++i)n+=r.children[i].chunkSize();return n+t.first}function yr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],L=i.height;if(t<L){e=i;continue e}t-=L,n+=i.chunkSize()}return n}while(!e.lines);for(var W=0;W<e.lines.length;++W){var X=e.lines[W],Q=X.height;if(t<Q)break;t-=Q}return n+W}function dr(e,t){return t>=e.first&&t<e.first+e.size}function qr(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function et(e,t,n){if(n===void 0&&(n=null),!(this instanceof et))return new et(e,t,n);this.line=e,this.ch=t,this.sticky=n}function wt(e,t){return e.line-t.line||e.ch-t.ch}function zr(e,t){return e.sticky==t.sticky&&wt(e,t)==0}function Ir(e){return et(e.line,e.ch)}function Zr(e,t){return wt(e,t)<0?t:e}function Wr(e,t){return wt(e,t)<0?e:t}function G(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function c(e,t){if(t.line<e.first)return et(e.first,0);var n=e.first+e.size-1;return t.line>n?et(n,ft(e,n).text.length):g(t,ft(e,t.line).text.length)}function g(e,t){var n=e.ch;return n==null||n>t?et(e.line,t):n<0?et(e.line,0):e}function U(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=c(e,t[r]);return n}var q=function(e,t){this.state=e,this.lookAhead=t},H=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};H.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},H.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}},H.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},H.fromSaved=function(e,t,n){return t instanceof q?new H(e,ur(e.mode,t.state),n,t.lookAhead):new H(e,ur(e.mode,t),n)},H.prototype.save=function(e){var t=e!==!1?ur(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new q(t,this.maxLookAhead):t};function Ce(e,t,n,r){var i=[e.state.modeGen],L={};$t(e,t.text,e.doc.mode,n,function(te,be){return i.push(te,be)},L,r);for(var W=n.state,X=function(te){n.baseTokens=i;var be=e.state.overlays[te],Te=1,Ue=0;n.state=!0,$t(e,t.text,be.mode,n,function(_e,Je){for(var tt=Te;Ue<_e;){var it=i[Te];it>_e&&i.splice(Te,1,_e,i[Te+1],it),Te+=2,Ue=Math.min(_e,it)}if(!Je)return;if(be.opaque)i.splice(tt,Te-tt,_e,"overlay "+Je),Te=tt+2;else for(;tt<Te;tt+=2){var dt=i[tt+1];i[tt+1]=(dt?dt+" ":"")+"overlay "+Je}},L),n.state=W,n.baseTokens=null,n.baseTokenPos=1},Q=0;Q<e.state.overlays.length;++Q)X(Q);return{styles:i,classes:L.bgClass||L.textClass?L:null}}function Ye(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=nt(e,Pt(t)),i=t.text.length>e.options.maxHighlightLength&&ur(e.doc.mode,r.state),L=Ce(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=L.styles,L.classes?t.styleClasses=L.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function nt(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new H(r,!0,t);var L=rr(e,t,n),W=L>r.first&&ft(r,L-1).stateAfter,X=W?H.fromSaved(r,W,L):new H(r,vr(r.mode),L);return r.iter(L,t,function(Q){lt(e,Q.text,X);var te=X.line;Q.stateAfter=te==t-1||te%5==0||te>=i.viewFrom&&te<i.viewTo?X.save():null,X.nextLine()}),n&&(r.modeFrontier=X.line),X}function lt(e,t,n,r){var i=e.doc.mode,L=new Ut(t,e.options.tabSize,n);for(L.start=L.pos=r||0,t==""&&Xe(i,n.state);!L.eol();)pt(i,L,n.state),L.start=L.pos}function Xe(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=nr(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function pt(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=nr(e,n).mode);var L=e.token(t,n);if(t.pos>t.start)return L}throw new Error("Mode "+e.name+" failed to advance stream.")}var mt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function It(e,t,n,r){var i=e.doc,L=i.mode,W;t=c(i,t);var X=ft(i,t.line),Q=nt(e,t.line,n),te=new Ut(X.text,e.options.tabSize,Q),be;for(r&&(be=[]);(r||te.pos<t.ch)&&!te.eol();)te.start=te.pos,W=pt(L,te,Q.state),r&&be.push(new mt(te,W,ur(i.mode,Q.state)));return r?be:new mt(te,W,Q.state)}function lr(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function $t(e,t,n,r,i,L,W){var X=n.flattenSpans;X==null&&(X=e.options.flattenSpans);var Q=0,te=null,be=new Ut(t,e.options.tabSize,r),Te,Ue=e.options.addModeClass&&[null];for(t==""&&lr(Xe(n,r.state),L);!be.eol();){if(be.pos>e.options.maxHighlightLength?(X=!1,W&<(e,t,r,be.pos),be.pos=t.length,Te=null):Te=lr(pt(n,be,r.state,Ue),L),Ue){var _e=Ue[0].name;_e&&(Te="m-"+(Te?_e+" "+Te:_e))}if(!X||te!=Te){for(;Q<be.start;)Q=Math.min(be.start,Q+5e3),i(Q,te);te=Te}be.start=be.pos}for(;Q<be.pos;){var Je=Math.min(be.pos,Q+5e3);i(Je,te),Q=Je}}function rr(e,t,n){for(var r,i,L=e.doc,W=n?-1:t-(e.doc.mode.innerMode?1e3:100),X=t;X>W;--X){if(X<=L.first)return L.first;var Q=ft(L,X-1),te=Q.stateAfter;if(te&&(!n||X+(te instanceof q?te.lookAhead:0)<=L.modeFrontier))return X;var be=Y(Q.text,null,e.options.tabSize);(i==null||r>be)&&(i=X-1,r=be)}return i}function xr(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,r=t-1;r>n;r--){var i=ft(e,r).stateAfter;if(i&&(!(i instanceof q)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Nr=!1,ir=!1;function Xt(){Nr=!0}function wr(){ir=!0}function Hr(e,t,n){this.marker=e,this.from=t,this.to=n}function ar(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function yn(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Ar(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function _r(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var L=e[i],W=L.marker,X=L.from==null||(W.inclusiveLeft?L.from<=t:L.from<t);if(X||L.from==t&&W.type=="bookmark"&&(!n||!L.marker.insertLeft)){var Q=L.to==null||(W.inclusiveRight?L.to>=t:L.to>t);(r||(r=[])).push(new Hr(W,L.from,Q?null:L.to))}}return r}function Rn(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var L=e[i],W=L.marker,X=L.to==null||(W.inclusiveRight?L.to>=t:L.to>t);if(X||L.from==t&&W.type=="bookmark"&&(!n||L.marker.insertLeft)){var Q=L.from==null||(W.inclusiveLeft?L.from<=t:L.from<t);(r||(r=[])).push(new Hr(W,Q?null:L.from-t,L.to==null?null:L.to-t))}}return r}function Nt(e,t){if(t.full)return null;var n=dr(e,t.from.line)&&ft(e,t.from.line).markedSpans,r=dr(e,t.to.line)&&ft(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,L=t.to.ch,W=wt(t.from,t.to)==0,X=_r(n,i,W),Q=Rn(r,L,W),te=t.text.length==1,be=J(t.text).length+(te?i:0);if(X)for(var Te=0;Te<X.length;++Te){var Ue=X[Te];if(Ue.to==null){var _e=ar(Q,Ue.marker);_e?te&&(Ue.to=_e.to==null?null:_e.to+be):Ue.to=i}}if(Q)for(var Je=0;Je<Q.length;++Je){var tt=Q[Je];if(tt.to!=null&&(tt.to+=be),tt.from==null){var it=ar(X,tt.marker);it||(tt.from=be,te&&(X||(X=[])).push(tt))}else tt.from+=be,te&&(X||(X=[])).push(tt)}X&&(X=vt(X)),Q&&Q!=X&&(Q=vt(Q));var dt=[X];if(!te){var gt=t.text.length-2,ct;if(gt>0&&X)for(var bt=0;bt<X.length;++bt)X[bt].to==null&&(ct||(ct=[])).push(new Hr(X[bt].marker,null,null));for(var Rt=0;Rt<gt;++Rt)dt.push(ct);dt.push(Q)}return dt}function vt(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function ot(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(_e){if(_e.markedSpans)for(var Je=0;Je<_e.markedSpans.length;++Je){var tt=_e.markedSpans[Je].marker;tt.readOnly&&(!r||pe(r,tt)==-1)&&(r||(r=[])).push(tt)}}),!r)return null;for(var i=[{from:t,to:n}],L=0;L<r.length;++L)for(var W=r[L],X=W.find(0),Q=0;Q<i.length;++Q){var te=i[Q];if(wt(te.to,X.from)<0||wt(te.from,X.to)>0)continue;var be=[Q,1],Te=wt(te.from,X.from),Ue=wt(te.to,X.to);(Te<0||!W.inclusiveLeft&&!Te)&&be.push({from:te.from,to:X.from}),(Ue>0||!W.inclusiveRight&&!Ue)&&be.push({from:X.to,to:te.to}),i.splice.apply(i,be),Q+=be.length-3}return i}function Cr(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function Yt(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function Zt(e){return e.inclusiveLeft?-1:0}function Ht(e){return e.inclusiveRight?1:0}function br(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),L=wt(r.from,i.from)||Zt(e)-Zt(t);if(L)return-L;var W=wt(r.to,i.to)||Ht(e)-Ht(t);return W||t.id-e.id}function Ft(e,t){var n=ir&&e.markedSpans,r;if(n)for(var i=void 0,L=0;L<n.length;++L)i=n[L],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||br(r,i.marker)<0)&&(r=i.marker);return r}function cr(e){return Ft(e,!0)}function zt(e){return Ft(e,!1)}function Vr(e,t){var n=ir&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var L=n[i];L.marker.collapsed&&(L.from==null||L.from<t)&&(L.to==null||L.to>t)&&(!r||br(r,L.marker)<0)&&(r=L.marker)}return r}function mr(e,t,n,r,i){var L=ft(e,t),W=ir&&L.markedSpans;if(W)for(var X=0;X<W.length;++X){var Q=W[X];if(!Q.marker.collapsed)continue;var te=Q.marker.find(0),be=wt(te.from,n)||Zt(Q.marker)-Zt(i),Te=wt(te.to,r)||Ht(Q.marker)-Ht(i);if(be>=0&&Te<=0||be<=0&&Te>=0)continue;if(be<=0&&(Q.marker.inclusiveRight&&i.inclusiveLeft?wt(te.to,n)>=0:wt(te.to,n)>0)||be>=0&&(Q.marker.inclusiveRight&&i.inclusiveLeft?wt(te.from,r)<=0:wt(te.from,r)<0))return!0}}function Lr(e){for(var t;t=cr(e);)e=t.find(-1,!0).line;return e}function ln(e){for(var t;t=zt(e);)e=t.find(1,!0).line;return e}function pn(e){for(var t,n;t=zt(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function un(e,t){var n=ft(e,t),r=Lr(n);return n==r?t:Pt(r)}function dn(e,t){if(t>e.lastLine())return t;var n=ft(e,t),r;if(!En(e,n))return t;for(;r=zt(n);)n=r.find(1,!0).line;return Pt(n)+1}function En(e,t){var n=ir&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i){if(r=n[i],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&mn(e,t,r))return!0}}function mn(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return mn(e,r.line,ar(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,L=0;L<t.markedSpans.length;++L)if(i=t.markedSpans[L],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&mn(e,t,i))return!0}function cn(e){e=Lr(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var L=n.parent;L;n=L,L=n.parent)for(var W=0;W<L.children.length;++W){var X=L.children[W];if(X==n)break;t+=X.height}return t}function pi(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=cr(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=zt(r);){var L=n.find(0,!0);t-=r.text.length-L.from.ch,r=L.to.line,t+=r.text.length-L.to.ch}return t}function ji(e){var t=e.display,n=e.doc;t.maxLine=ft(n,n.first),t.maxLineLength=pi(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=pi(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var jn=function(e,t,n){this.text=e,Yt(this,t),this.height=n?n(this):1};jn.prototype.lineNo=function(){return Pt(this)},xe(jn);function ua(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Cr(e),Yt(e,n);var i=r?r(e):1;i!=e.height&&gr(e,i)}function St(e){e.parent=null,Cr(e)}var _t={},Ot={};function Kt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Ot:_t;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Jt(e,t){var n=T("span",null,null,P?"padding-right: .1px":null),r={pre:T("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var L=i?t.rest[i-1]:t.line,W=void 0;r.pos=0,r.addToken=Vt,xt(e.display.measure)&&(W=Ge(L,e.doc.direction))&&(r.addToken=en(r.addToken,W)),r.map=[];var X=t!=e.display.externalMeasured&&Pt(L);Ln(L,r,Ye(e,L,X)),L.styleClasses&&(L.styleClasses.bgClass&&(r.bgClass=z(L.styleClasses.bgClass,r.bgClass||"")),L.styleClasses.textClass&&(r.textClass=z(L.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ht(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(P){var Q=r.content.lastChild;(/\bcm-tab\b/.test(Q.className)||Q.querySelector&&Q.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Me(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=z(r.pre.className,r.textClass||"")),r}function hr(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Vt(e,t,n,r,i,L,W){if(!t)return;var X=e.splitSpaces?Pr(t,e.trailingSpace):t,Q=e.cm.state.specialChars,te=!1,be;if(!Q.test(t))e.col+=t.length,be=document.createTextNode(X),e.map.push(e.pos,e.pos+t.length,be),K&&B<9&&(te=!0),e.pos+=t.length;else{be=document.createDocumentFragment();for(var Te=0;;){Q.lastIndex=Te;var Ue=Q.exec(t),_e=Ue?Ue.index-Te:t.length-Te;if(_e){var Je=document.createTextNode(X.slice(Te,Te+_e));K&&B<9?be.appendChild(a("span",[Je])):be.appendChild(Je),e.map.push(e.pos,e.pos+_e,Je),e.col+=_e,e.pos+=_e}if(!Ue)break;Te+=_e+1;var tt=void 0;if(Ue[0]==" "){var it=e.cm.options.tabSize,dt=it-e.col%it;tt=be.appendChild(a("span",se(dt),"cm-tab")),tt.setAttribute("role","presentation"),tt.setAttribute("cm-text"," "),e.col+=dt}else Ue[0]=="\r"||Ue[0]==`
|
|
`?(tt=be.appendChild(a("span",Ue[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),tt.setAttribute("cm-text",Ue[0]),e.col+=1):(tt=e.cm.options.specialCharPlaceholder(Ue[0]),tt.setAttribute("cm-text",Ue[0]),K&&B<9?be.appendChild(a("span",[tt])):be.appendChild(tt),e.col+=1);e.map.push(e.pos,e.pos+1,tt),e.pos++}}if(e.trailingSpace=X.charCodeAt(t.length-1)==32,n||r||i||te||L||W){var gt=n||"";r&&(gt+=r),i&&(gt+=i);var ct=a("span",[be],gt,L);if(W)for(var bt in W)W.hasOwnProperty(bt)&&bt!="style"&&bt!="class"&&ct.setAttribute(bt,W[bt]);return e.content.appendChild(ct)}e.content.appendChild(be)}function Pr(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var L=e.charAt(i);L==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(L="\xA0"),r+=L,n=L==" "}return r}function en(e,t){return function(n,r,i,L,W,X,Q){i=i?i+" cm-force-border":"cm-force-border";for(var te=n.pos,be=te+r.length;;){for(var Te=void 0,Ue=0;Ue<t.length&&!(Te=t[Ue],Te.to>te&&Te.from<=te);Ue++);if(Te.to>=be)return e(n,r,i,L,W,X,Q);e(n,r.slice(0,Te.to-te),i,L,null,X,Q),L=null,r=r.slice(Te.to-te),te=Te.to}}}function Gt(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Ln(e,t,n){var r=e.markedSpans,i=e.text,L=0;if(!r){for(var W=1;W<n.length;W+=2)t.addToken(t,i.slice(L,L=n[W]),Kt(n[W+1],t.cm.options));return}for(var X=i.length,Q=0,te=1,be="",Te,Ue,_e=0,Je,tt,it,dt,gt;;){if(_e==Q){Je=tt=it=Ue="",gt=null,dt=null,_e=Infinity;for(var ct=[],bt=void 0,Rt=0;Rt<r.length;++Rt){var At=r[Rt],Wt=At.marker;if(Wt.type=="bookmark"&&At.from==Q&&Wt.widgetNode)ct.push(Wt);else if(At.from<=Q&&(At.to==null||At.to>Q||Wt.collapsed&&At.to==Q&&At.from==Q)){if(At.to!=null&&At.to!=Q&&_e>At.to&&(_e=At.to,tt=""),Wt.className&&(Je+=" "+Wt.className),Wt.css&&(Ue=(Ue?Ue+";":"")+Wt.css),Wt.startStyle&&At.from==Q&&(it+=" "+Wt.startStyle),Wt.endStyle&&At.to==_e&&(bt||(bt=[])).push(Wt.endStyle,At.to),Wt.title&&((gt||(gt={})).title=Wt.title),Wt.attributes)for(var fr in Wt.attributes)(gt||(gt={}))[fr]=Wt.attributes[fr];Wt.collapsed&&(!dt||br(dt.marker,Wt)<0)&&(dt=At)}else At.from>Q&&_e>At.from&&(_e=At.from)}if(bt)for(var Br=0;Br<bt.length;Br+=2)bt[Br+1]==_e&&(tt+=" "+bt[Br]);if(!dt||dt.from==Q)for(var Sr=0;Sr<ct.length;++Sr)Gt(t,0,ct[Sr]);if(dt&&(dt.from||0)==Q){if(Gt(t,(dt.to==null?X+1:dt.to)-Q,dt.marker,dt.from==null),dt.to==null)return;dt.to==Q&&(dt=!1)}}if(Q>=X)break;for(var fn=Math.min(X,_e);;){if(be){var an=Q+be.length;if(!dt){var Or=an>fn?be.slice(0,fn-Q):be;t.addToken(t,Or,Te?Te+Je:Je,it,Q+Or.length==_e?tt:"",Ue,gt)}if(an>=fn){be=be.slice(fn-Q),Q=fn;break}Q=an,it=""}be=i.slice(L,L=n[te++]),Te=Kt(n[te++],t.cm.options)}}}function qt(e,t,n){this.line=t,this.rest=pn(t),this.size=this.rest?Pt(J(this.rest))-n+1:1,this.node=this.text=null,this.hidden=En(e,t)}function tn(e,t,n){for(var r=[],i,L=t;L<n;L=i){var W=new qt(e.doc,ft(e.doc,L),L);i=L+W.size,r.push(W)}return r}var Xr=null;function bn(e){Xr?Xr.ops.push(e):e.ownsGroup=Xr={ops:[e],delayedCallbacks:[]}}function Os(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Rs(e,t){var n=e.ownsGroup;if(!n)return;try{Os(n)}finally{Xr=null,t(n)}}var mi=null;function Kr(e,t){var n=Qe(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Xr?i=Xr.delayedCallbacks:mi?i=mi:(i=mi=[],setTimeout(_s,0));for(var L=function(X){i.push(function(){return n[X].apply(null,r)})},W=0;W<n.length;++W)L(W)}function _s(){var e=mi;mi=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,n,r){for(var i=0;i<t.changes.length;i++){var L=t.changes[i];L=="text"?Ms(e,t):L=="gutter"?Za(e,t,n,r):L=="class"?da(e,t):L=="widget"&&Is(e,t,r)}t.changes=null}function gi(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),K&&B<8&&(e.node.style.zIndex=2)),e.node}function Ps(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=gi(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Jt(e,t)}function Ms(e,t){var n=t.text.className,r=$a(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,da(e,t)):n&&(t.text.className=n)}function da(e,t){Ps(e,t),t.line.wrapClass?gi(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Za(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=gi(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var L=t.line.gutterMarkers;if(e.options.lineNumbers||L){var W=gi(t),X=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(X),W.insertBefore(X,t.text),t.line.gutterClass&&(X.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!L||!L["CodeMirror-linenumbers"])&&(t.lineNumber=X.appendChild(a("div",qr(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),L)for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var te=e.display.gutterSpecs[Q].className,be=L.hasOwnProperty(te)&&L[te];be&&X.appendChild(a("div",[be],"CodeMirror-gutter-elt","left: "+r.gutterLeft[te]+"px; width: "+r.gutterWidth[te]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=b("CodeMirror-linewidget"),i=t.node.firstChild,L=void 0;i;i=L)L=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Ja(e,t,n)}function Ns(e,t,n,r){var i=$a(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),da(e,t),Za(e,t,n,r),Ja(e,t,r),t.node}function Ja(e,t,n){if(Qa(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Qa(e,t.rest[r],t,n,!1)}function Qa(e,t,n,r,i){if(!t.widgets)return;for(var L=gi(n),W=0,X=t.widgets;W<X.length;++W){var Q=X[W],te=a("div",[Q.node],"CodeMirror-linewidget"+(Q.className?" "+Q.className:""));Q.handleMouseEvents||te.setAttribute("cm-ignore-events","true"),Us(Q,te,n,r),e.display.input.setUneditable(te),i&&Q.above?L.insertBefore(te,n.gutter||n.text):L.appendChild(te),Kr(Q,"redraw")}}function Us(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function vi(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!x(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),s(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function kn(e,t){for(var n=we(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Wi(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=s(e.measure,a("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Tn(e){return ve-e.display.nativeBarWidth}function Wn(e){return e.display.scroller.clientWidth-Tn(e)-e.display.barWidth}function ha(e){return e.display.scroller.clientHeight-Tn(e)-e.display.barHeight}function Fs(e,t,n){var r=e.options.lineWrapping,i=r&&Wn(e);if(!t.measure.heights||r&&t.measure.width!=i){var L=t.measure.heights=[];if(r){t.measure.width=i;for(var W=t.text.firstChild.getClientRects(),X=0;X<W.length-1;X++){var Q=W[X],te=W[X+1];Math.abs(Q.bottom-te.bottom)>2&&L.push((Q.bottom+te.top)/2-n.top)}}L.push(n.bottom-n.top)}}function eo(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(Pt(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=Lr(t);var n=Pt(t),r=e.display.externalMeasured=new qt(e.doc,t,n);r.lineN=n;var i=r.built=Jt(e,r);return r.text=i.pre,s(e.display.lineMeasure,i.pre),r}function to(e,t,n,r){return wn(e,Jn(e,t),n,r)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Gn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Jn(e,t){var n=Pt(t),r=fa(e,n);r&&!r.text?r=null:r&&r.changes&&(Ya(e,r,n,ba(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=eo(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function wn(e,t,n,r,i){t.before&&(n=-1);var L=n+(r||""),W;return t.cache.hasOwnProperty(L)?W=t.cache[L]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Fs(e,t.view,t.rect),t.hasHeights=!0),W=Ws(e,t,n,r),W.bogus||(t.cache[L]=W)),{left:W.left,right:W.right,top:i?W.rtop:W.top,bottom:i?W.rbottom:W.bottom}}var ro={left:0,right:0,top:0,bottom:0};function no(e,t,n){for(var r,i,L,W,X,Q,te=0;te<e.length;te+=3)if(X=e[te],Q=e[te+1],t<X?(i=0,L=1,W="left"):t<Q?(i=t-X,L=i+1):(te==e.length-3||t==Q&&e[te+3]>t)&&(L=Q-X,i=L-1,t>=Q&&(W="right")),i!=null){if(r=e[te+2],X==Q&&n==(r.insertLeft?"left":"right")&&(W=n),n=="left"&&i==0)for(;te&&e[te-2]==e[te-3]&&e[te-1].insertLeft;)r=e[(te-=3)+2],W="left";if(n=="right"&&i==Q-X)for(;te<e.length-3&&e[te+3]==e[te+4]&&!e[te+5].insertLeft;)r=e[(te+=3)+2],W="right";break}return{node:r,start:i,end:L,collapse:W,coverStart:X,coverEnd:Q}}function js(e,t){var n=ro;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function Ws(e,t,n,r){var i=no(t.map,n,r),L=i.node,W=i.start,X=i.end,Q=i.collapse,te;if(L.nodeType==3){for(var be=0;be<4;be++){for(;W&&He(t.line.text.charAt(i.coverStart+W));)--W;for(;i.coverStart+X<i.coverEnd&&He(t.line.text.charAt(i.coverStart+X));)++X;if(K&&B<9&&W==0&&X==i.coverEnd-i.coverStart?te=L.parentNode.getBoundingClientRect():te=js(m(L,W,X).getClientRects(),r),te.left||te.right||W==0)break;X=W,W=W-1,Q="right"}K&&B<11&&(te=Hs(e.display.measure,te))}else{W>0&&(Q=r="right");var Te;e.options.lineWrapping&&(Te=L.getClientRects()).length>1?te=Te[r=="right"?Te.length-1:0]:te=L.getBoundingClientRect()}if(K&&B<9&&!W&&(!te||!te.left&&!te.right)){var Ue=L.parentNode.getClientRects()[0];Ue?te={left:Ue.left,right:Ue.left+qn(e.display),top:Ue.top,bottom:Ue.bottom}:te=ro}for(var _e=te.top-t.rect.top,Je=te.bottom-t.rect.top,tt=(_e+Je)/2,it=t.view.measure.heights,dt=0;dt<it.length-1&&!(tt<it[dt]);dt++);var gt=dt?it[dt-1]:0,ct=it[dt],bt={left:(Q=="right"?te.right:te.left)-t.rect.left,right:(Q=="left"?te.left:te.right)-t.rect.left,top:gt,bottom:ct};return!te.left&&!te.right&&(bt.bogus=!0),e.options.singleCursorHeightPerLine||(bt.rtop=_e,bt.rbottom=Je),bt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!kt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function io(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function ao(e){e.display.externalMeasure=null,f(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)io(e.display.view[t])}function yi(e){ao(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function oo(){return y&&h?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return y&&h?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=vi(e.widgets[n]));return t}function Hi(e,t,n,r,i){if(!i){var L=pa(t);n.top+=L,n.bottom+=L}if(r=="line")return n;r||(r="local");var W=cn(t);if(r=="local"?W+=Wi(e.display):W-=e.display.viewOffset,r=="page"||r=="window"){var X=e.display.lineSpace.getBoundingClientRect();W+=X.top+(r=="window"?0:so());var Q=X.left+(r=="window"?0:oo());n.left+=Q,n.right+=Q}return n.top+=W,n.bottom+=W,n}function lo(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=oo(),i-=so();else if(n=="local"||!n){var L=e.display.sizer.getBoundingClientRect();r+=L.left,i+=L.top}var W=e.display.lineSpace.getBoundingClientRect();return{left:r-W.left,top:i-W.top}}function ma(e,t,n,r,i){return r||(r=ft(e.doc,t.line)),Hi(e,r,to(e,r,t.ch,i),n)}function xn(e,t,n,r,i,L){r=r||ft(e.doc,t.line),i||(i=Jn(e,r));function W(Je,tt){var it=wn(e,i,Je,tt?"right":"left",L);return tt?it.left=it.right:it.right=it.left,Hi(e,r,it,n)}var X=Ge(r,e.doc.direction),Q=t.ch,te=t.sticky;if(Q>=r.text.length?(Q=r.text.length,te="before"):Q<=0&&(Q=0,te="after"),!X)return W(te=="before"?Q-1:Q,te=="before");function be(Je,tt,it){var dt=X[tt],gt=dt.level==1;return W(it?Je-1:Je,gt!=it)}var Te=Be(X,Q,te),Ue=Ne,_e=be(Q,Te,te=="before");return Ue!=null&&(_e.other=be(Q,Ue,te!="before")),_e}function uo(e,t){var n=0;t=c(e.doc,t),e.options.lineWrapping||(n=qn(e.display)*t.ch);var r=ft(e.doc,t.line),i=cn(r)+Wi(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function ga(e,t,n,r,i){var L=et(e,t,n);return L.xRel=i,r&&(L.outside=r),L}function va(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return ga(r.first,0,null,-1,-1);var i=yr(r,n),L=r.first+r.size-1;if(i>L)return ga(r.first+r.size-1,ft(r,L).text.length,null,1,1);t<0&&(t=0);for(var W=ft(r,i);;){var X=Ks(e,W,i,t,n),Q=Vr(W,X.ch+(X.xRel>0||X.outside>0?1:0));if(!Q)return X;var te=Q.find(1);if(te.line==i)return te;W=ft(r,i=te.line)}}function co(e,t,n,r){r-=pa(t);var i=t.text.length,L=qe(function(W){return wn(e,n,W-1).bottom<=r},i,0);return i=qe(function(W){return wn(e,n,W).top>r},L,i),{begin:L,end:i}}function ho(e,t,n,r){n||(n=Jn(e,t));var i=Hi(e,t,wn(e,n,r),"line").top;return co(e,t,n,i)}function ya(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ks(e,t,n,r,i){i-=cn(t);var L=Jn(e,t),W=pa(t),X=0,Q=t.text.length,te=!0,be=Ge(t,e.doc.direction);if(be){var Te=(e.options.lineWrapping?zs:Gs)(e,t,n,L,be,r,i);te=Te.level!=1,X=te?Te.from:Te.to-1,Q=te?Te.to:Te.from-1}var Ue=null,_e=null,Je=qe(function(Rt){var At=wn(e,L,Rt);return At.top+=W,At.bottom+=W,ya(At,r,i,!1)?(At.top<=i&&At.left<=r&&(Ue=Rt,_e=At),!0):!1},X,Q),tt,it,dt=!1;if(_e){var gt=r-_e.left<_e.right-r,ct=gt==te;Je=Ue+(ct?0:1),it=ct?"after":"before",tt=gt?_e.left:_e.right}else{!te&&(Je==Q||Je==X)&&Je++,it=Je==0?"after":Je==t.text.length?"before":wn(e,L,Je-(te?1:0)).bottom+W<=i==te?"after":"before";var bt=xn(e,et(n,Je,it),"line",t,L);tt=bt.left,dt=i<bt.top?-1:i>=bt.bottom?1:0}return Je=Fe(t.text,Je,1),ga(n,Je,it,dt,r-tt)}function Gs(e,t,n,r,i,L,W){var X=qe(function(Te){var Ue=i[Te],_e=Ue.level!=1;return ya(xn(e,et(n,_e?Ue.to:Ue.from,_e?"before":"after"),"line",t,r),L,W,!0)},0,i.length-1),Q=i[X];if(X>0){var te=Q.level!=1,be=xn(e,et(n,te?Q.from:Q.to,te?"after":"before"),"line",t,r);ya(be,L,W,!0)&&be.top>W&&(Q=i[X-1])}return Q}function zs(e,t,n,r,i,L,W){var X=co(e,t,r,W),Q=X.begin,te=X.end;/\s/.test(t.text.charAt(te-1))&&te--;for(var be=null,Te=null,Ue=0;Ue<i.length;Ue++){var _e=i[Ue];if(_e.from>=te||_e.to<=Q)continue;var Je=_e.level!=1,tt=wn(e,r,Je?Math.min(te,_e.to)-1:Math.max(Q,_e.from)).right,it=tt<L?L-tt+1e9:tt-L;(!be||Te>it)&&(be=_e,Te=it)}return be||(be=i[i.length-1]),be.from<Q&&(be={from:Q,to:be.to,level:be.level}),be.to>te&&(be={from:be.from,to:te,level:be.level}),be}var Hn;function Qn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Hn==null){Hn=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Hn.appendChild(document.createTextNode("x")),Hn.appendChild(a("br"));Hn.appendChild(document.createTextNode("x"))}s(e.measure,Hn);var n=Hn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),f(e.measure),n||1}function qn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");s(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function ba(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,L=t.gutters.firstChild,W=0;L;L=L.nextSibling,++W){var X=e.display.gutterSpecs[W].className;n[X]=L.offsetLeft+L.clientLeft+i,r[X]=L.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 fo(e){var t=Qn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/qn(e.display)-3);return function(i){if(En(e.doc,i))return 0;var L=0;if(i.widgets)for(var W=0;W<i.widgets.length;W++)i.widgets[W].height&&(L+=i.widgets[W].height);return n?L+(Math.ceil(i.text.length/r)||1)*t:L+t}}function xa(e){var t=e.doc,n=fo(e);t.iter(function(r){var i=n(r);i!=r.height&&gr(r,i)})}function Kn(e,t,n,r){var i=e.display;if(!n&&we(t).getAttribute("cm-not-content")=="true")return null;var L,W,X=i.lineSpace.getBoundingClientRect();try{L=t.clientX-X.left,W=t.clientY-X.top}catch(Te){return null}var Q=va(e,L,W),te;if(r&&Q.xRel>0&&(te=ft(e.doc,Q.line).text).length==Q.ch){var be=Y(te,te.length,e.options.tabSize)-te.length;Q=et(Q.line,Math.max(0,Math.round((L-qa(e.display).left)/qn(e.display))-be))}return Q}function Gn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function rn(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)ir&&un(e.doc,t)<i.viewTo&&Pn(e);else if(n<=i.viewFrom)ir&&dn(e.doc,n+r)>i.viewFrom?Pn(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Pn(e);else if(t<=i.viewFrom){var L=Ki(e,n,n+r,1);L?(i.view=i.view.slice(L.index),i.viewFrom=L.lineN,i.viewTo+=r):Pn(e)}else if(n>=i.viewTo){var W=Ki(e,t,t,-1);W?(i.view=i.view.slice(0,W.index),i.viewTo=W.lineN):Pn(e)}else{var X=Ki(e,t,t,-1),Q=Ki(e,n,n+r,1);X&&Q?(i.view=i.view.slice(0,X.index).concat(tn(e,X.lineN,Q.lineN)).concat(i.view.slice(Q.index)),i.viewTo+=r):Pn(e)}var te=i.externalMeasured;te&&(n<te.lineN?te.lineN+=r:t<te.lineN+te.size&&(i.externalMeasured=null))}function _n(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var L=r.view[Gn(e,t)];if(L.node==null)return;var W=L.changes||(L.changes=[]);pe(W,n)==-1&&W.push(n)}function Pn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ki(e,t,n,r){var i=Gn(e,t),L,W=e.display.view;if(!ir||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var X=e.display.viewFrom,Q=0;Q<i;Q++)X+=W[Q].size;if(X!=t){if(r>0){if(i==W.length-1)return null;L=X+W[i].size-t,i++}else L=X-t;t+=L,n+=L}for(;un(e.doc,n)!=n;){if(i==(r<0?0:W.length-1))return null;n+=r*W[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=tn(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=tn(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Gn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(tn(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Gn(e,n)))),r.viewTo=n}function po(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function bi(e){e.display.input.showSelection(e.display.input.prepareSelection())}function mo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),L=r.selection=document.createDocumentFragment(),W=0;W<n.sel.ranges.length;W++){if(!t&&W==n.sel.primIndex)continue;var X=n.sel.ranges[W];if(X.from().line>=e.display.viewTo||X.to().line<e.display.viewFrom)continue;var Q=X.empty();(Q||e.options.showCursorWhenSelecting)&&go(e,X.head,i),Q||Xs(e,X,L)}return r}function go(e,t,n){var r=xn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(a("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var L=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));L.style.display="",L.style.left=r.other.left+"px",L.style.top=r.other.top+"px",L.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Gi(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,L=document.createDocumentFragment(),W=qa(e.display),X=W.left,Q=Math.max(r.sizerWidth,Wn(e)-r.sizer.offsetLeft)-W.right,te=i.direction=="ltr";function be(ct,bt,Rt,At){bt<0&&(bt=0),bt=Math.round(bt),At=Math.round(At),L.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+ct+`px;
|
|
top: `+bt+"px; width: "+(Rt==null?Q-ct:Rt)+`px;
|
|
height: `+(At-bt)+"px"))}function Te(ct,bt,Rt){var At=ft(i,ct),Wt=At.text.length,fr,Br;function Sr(Or,on){return ma(e,et(ct,Or),"div",At,on)}function fn(Or,on,Gr){var Mr=ho(e,At,null,Or),Rr=on=="ltr"==(Gr=="after")?"left":"right",kr=Gr=="after"?Mr.begin:Mr.end-(/\s/.test(At.text.charAt(Mr.end-1))?2:1);return Sr(kr,Rr)[Rr]}var an=Ge(At,i.direction);return De(an,bt||0,Rt==null?Wt:Rt,function(Or,on,Gr,Mr){var Rr=Gr=="ltr",kr=Sr(Or,Rr?"left":"right"),sn=Sr(on-1,Rr?"right":"left"),hi=bt==null&&Or==0,Bn=Rt==null&&on==Wt,$r=Mr==0,An=!an||Mr==an.length-1;if(sn.top-kr.top<=3){var jr=(te?hi:Bn)&&$r,Va=(te?Bn:hi)&&An,On=jr?X:(Rr?kr:sn).left,$n=Va?Q:(Rr?sn:kr).right;be(On,kr.top,$n-On,kr.bottom)}else{var Zn,Qr,fi,Xa;Rr?(Zn=te&&hi&&$r?X:kr.left,Qr=te?Q:fn(Or,Gr,"before"),fi=te?X:fn(on,Gr,"after"),Xa=te&&Bn&&An?Q:sn.right):(Zn=te?fn(Or,Gr,"before"):X,Qr=!te&&hi&&$r?Q:kr.right,fi=!te&&Bn&&An?X:sn.left,Xa=te?fn(on,Gr,"after"):Q),be(Zn,kr.top,Qr-Zn,kr.bottom),kr.bottom<sn.top&&be(X,kr.bottom,null,sn.top),be(fi,sn.top,Xa-fi,sn.bottom)}(!fr||Gi(kr,fr)<0)&&(fr=kr),Gi(sn,fr)<0&&(fr=sn),(!Br||Gi(kr,Br)<0)&&(Br=kr),Gi(sn,Br)<0&&(Br=sn)}),{start:fr,end:Br}}var Ue=t.from(),_e=t.to();if(Ue.line==_e.line)Te(Ue.line,Ue.ch,_e.ch);else{var Je=ft(i,Ue.line),tt=ft(i,_e.line),it=Lr(Je)==Lr(tt),dt=Te(Ue.line,Ue.ch,it?Je.text.length+1:null).end,gt=Te(_e.line,it?0:null,_e.ch).start;it&&(dt.top<gt.top-2?(be(dt.right,dt.top,null,dt.bottom),be(X,gt.top,gt.left,gt.bottom)):be(dt.right,dt.top,gt.left-dt.right,dt.bottom)),dt.bottom<gt.top&&be(X,dt.bottom,null,gt.top)}n.appendChild(L)}function Ca(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||ei(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function vo(e){e.state.focused||(e.display.input.focus(),Sa(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,ei(e))},100)}function Sa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Me(e,"focus",e,t),e.state.focused=!0,j(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),P&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ca(e)}function ei(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Me(e,"blur",e,t),e.state.focused=!1,u(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function zi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],L=e.options.lineWrapping,W=void 0,X=0;if(i.hidden)continue;if(K&&B<8){var Q=i.node.offsetTop+i.node.offsetHeight;W=Q-n,n=Q}else{var te=i.node.getBoundingClientRect();W=te.bottom-te.top,!L&&i.text.firstChild&&(X=i.text.firstChild.getBoundingClientRect().right-te.left-1)}var be=i.line.height-W;if((be>.005||be<-.005)&&(gr(i.line,W),bo(i.line),i.rest))for(var Te=0;Te<i.rest.length;Te++)bo(i.rest[Te]);if(X>e.display.sizerWidth){var Ue=Math.ceil(X/qn(e.display));Ue>e.display.maxLineLength&&(e.display.maxLineLength=Ue,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function bo(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Vi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Wi(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,L=yr(t,r),W=yr(t,i);if(n&&n.ensure){var X=n.ensure.from.line,Q=n.ensure.to.line;X<L?(L=X,W=yr(t,cn(ft(t,X))+e.wrapper.clientHeight)):Math.min(Q,t.lastLine())>=W&&(L=yr(t,cn(ft(t,Q))-e.wrapper.clientHeight),W=Q)}return{from:L,to:Math.max(W,L+1)}}function Ys(e,t){if(We(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!C){var L=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Wi(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Tn(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(L),L.scrollIntoView(i),e.display.lineSpace.removeChild(L)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?et(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?et(t.line,t.ch+1,"before"):t);for(var L=0;L<5;L++){var W=!1,X=xn(e,t),Q=!n||n==t?X:xn(e,n);i={left:Math.min(X.left,Q.left),top:Math.min(X.top,Q.top)-r,right:Math.max(X.left,Q.left),bottom:Math.max(X.bottom,Q.bottom)+r};var te=Ta(e,i),be=e.doc.scrollTop,Te=e.doc.scrollLeft;if(te.scrollTop!=null&&(xi(e,te.scrollTop),Math.abs(e.doc.scrollTop-be)>1&&(W=!0)),te.scrollLeft!=null&&(zn(e,te.scrollLeft),Math.abs(e.doc.scrollLeft-Te)>1&&(W=!0)),!W)break}return i}function Zs(e,t){var n=Ta(e,t);n.scrollTop!=null&&xi(e,n.scrollTop),n.scrollLeft!=null&&zn(e,n.scrollLeft)}function Ta(e,t){var n=e.display,r=Qn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,L=ha(e),W={};t.bottom-t.top>L&&(t.bottom=t.top+L);var X=e.doc.height+ca(n),Q=t.top<r,te=t.bottom>X-r;if(t.top<i)W.scrollTop=Q?0:t.top;else if(t.bottom>i+L){var be=Math.min(t.top,(te?X:t.bottom)-L);be!=i&&(W.scrollTop=be)}var Te=e.options.fixedGutter?0:n.gutters.offsetWidth,Ue=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-Te,_e=Wn(e)-n.gutters.offsetWidth,Je=t.right-t.left>_e;return Je&&(t.right=t.left+_e),t.left<10?W.scrollLeft=0:t.left<Ue?W.scrollLeft=Math.max(0,t.left+Te-(Je?0:10)):t.right>_e+Ue-3&&(W.scrollLeft=t.right+(Je?0:10)-_e),W}function wa(e,t){if(t==null)return;Xi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function ti(e){Xi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Ei(e,t,n){(t!=null||n!=null)&&Xi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Js(e,t){Xi(e),e.curOp.scrollToPos=t}function Xi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=uo(e,t.from),r=uo(e,t.to);Eo(e,n,r,t.margin)}}function Eo(e,t,n,r){var i=Ta(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});Ei(e,i.scrollLeft,i.scrollTop)}function xi(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;O||La(e,{top:t}),xo(e,t,!0),O&&La(e),Ti(e,100)}function xo(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 zn(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,Ao(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Ci(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+Tn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Vn=function(e,t,n){this.cm=n;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Re(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Re(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,K&&B<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Vn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var L=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+L)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Vn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Vn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Vn.prototype.zeroWidthHack=function(){var e=l&&!k?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new oe,this.disableVert=new oe},Vn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),L=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);L!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Vn.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 ri(e,t){t||(t=Ci(e));var n=e.display.barWidth,r=e.display.barHeight;Co(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&zi(e),Co(e,Ci(e)),n=e.display.barWidth,r=e.display.barHeight}function Co(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 So={native:Vn,null:Si};function To(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&u(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new So[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Re(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?zn(e,t):xi(e,t)},e),e.display.scrollbars.addClass&&j(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function Xn(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},bn(e.curOp)}function Yn(e){var t=e.curOp;t&&Rs(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;qs(n)})}function qs(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var r=0;r<t.length;r++)tl(t[r]);for(var i=0;i<t.length;i++)rl(t[i]);for(var L=0;L<t.length;L++)nl(t[L]);for(var W=0;W<t.length;W++)il(t[W])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&ji(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Yi(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&&zi(t),e.barMeasure=Ci(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=to(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+Tn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Wn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&zn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==D();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&ri(t,e.barMeasure),e.updatedDisplay&&Da(t,e.barMeasure),e.selectionChanged&&Ca(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&vo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&wo(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&xo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&zn(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,c(r,e.scrollToPos.from),c(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var L=e.maybeHiddenMarkers,W=e.maybeUnhiddenMarkers;if(L)for(var X=0;X<L.length;++X)L[X].lines.length||Me(L[X],"hide");if(W)for(var Q=0;Q<W.length;++Q)W[Q].lines.length&&Me(W[Q],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Me(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function hn(e,t){if(e.curOp)return t();Xn(e);try{return t()}finally{Yn(e)}}function Ur(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Xn(e);try{return t.apply(e,arguments)}finally{Yn(e)}}}function Jr(e){return function(){if(this.curOp)return e.apply(this,arguments);Xn(this);try{return e.apply(this,arguments)}finally{Yn(this)}}}function Fr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Xn(t);try{return e.apply(this,arguments)}finally{Yn(t)}}}function Ti(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,M(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=nt(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(L){if(r.line>=e.display.viewFrom){var W=L.styles,X=L.text.length>e.options.maxHighlightLength?ur(t.mode,r.state):null,Q=Ce(e,L,r,!0);X&&(r.state=X),L.styles=Q.styles;var te=L.styleClasses,be=Q.classes;be?L.styleClasses=be:te&&(L.styleClasses=null);for(var Te=!W||W.length!=L.styles.length||te!=be&&(!te||!be||te.bgClass!=be.bgClass||te.textClass!=be.textClass),Ue=0;!Te&&Ue<W.length;++Ue)Te=W[Ue]!=L.styles[Ue];Te&&i.push(r.line),L.stateAfter=r.save(),r.nextLine()}else L.text.length<=e.options.maxHighlightLength&<(e,L.text,r),L.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return Ti(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&hn(e,function(){for(var L=0;L<i.length;L++)_n(e,i[L],"text")})}var Yi=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Vi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Wn(e),this.force=n,this.dims=ba(e),this.events=[]};Yi.prototype.signal=function(e,t){ye(e,t)&&this.events.push(arguments)},Yi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Me.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Tn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Tn(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=D();if(!t||!x(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&x(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==D())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&x(document.body,e.anchorNode)&&x(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function Aa(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Pn(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&po(e)==0)return!1;Lo(e)&&(Pn(e),t.dims=ba(e));var i=r.first+r.size,L=Math.max(t.visible.from-e.options.viewportMargin,r.first),W=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<L&&L-n.viewFrom<20&&(L=Math.max(r.first,n.viewFrom)),n.viewTo>W&&n.viewTo-W<20&&(W=Math.min(i,n.viewTo)),ir&&(L=un(e.doc,L),W=dn(e.doc,W));var X=L!=n.viewFrom||W!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,L,W),n.viewOffset=cn(ft(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var Q=po(e);if(!X&&Q==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var te=sl(e);return Q>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),Q>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(te),f(n.cursorDiv),f(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,X&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Ti(e,400)),n.updateLineNumbers=null,!0}function wo(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Wn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ca(e.display)-ha(e),n.top)}),t.visible=Vi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Vi(e.display,e.doc,n));if(!Aa(e,t))break;zi(e);var i=Ci(e);bi(e),ri(e,i),Da(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function La(e,t){var n=new Yi(e,t);if(Aa(e,n)){zi(e),wo(e,n);var r=Ci(e);bi(e),ri(e,r),Da(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,L=r.lineDiv,W=L.firstChild;function X(Je){var tt=Je.nextSibling;return P&&l&&e.display.currentWheelTarget==Je?Je.style.display="none":Je.parentNode.removeChild(Je),tt}for(var Q=r.view,te=r.viewFrom,be=0;be<Q.length;be++){var Te=Q[be];if(!Te.hidden)if(!Te.node||Te.node.parentNode!=L){var Ue=Ns(e,Te,te,n);L.insertBefore(Ue,W)}else{for(;W!=Te.node;)W=X(W);var _e=i&&t!=null&&t<=te&&Te.lineNumber;Te.changes&&(pe(Te.changes,"gutter")>-1&&(_e=!1),Ya(e,Te,te,n)),_e&&(f(Te.lineNumber),Te.lineNumber.appendChild(document.createTextNode(qr(e.options,te)))),W=Te.node.nextSibling}te+=Te.size}for(;W;)W=X(W)}function ka(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Da(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+Tn(e)+"px"}function Ao(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,i=t.gutters.offsetWidth,L=r+"px",W=0;W<n.length;W++)if(!n[W].hidden){e.options.fixedGutter&&(n[W].gutter&&(n[W].gutter.style.left=L),n[W].gutterBackground&&(n[W].gutterBackground.style.left=L));var X=n[W].alignable;if(X)for(var Q=0;Q<X.length;Q++)X[Q].style.left=L}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Lo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=qr(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(a("div",[a("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),L=i.firstChild.offsetWidth,W=i.offsetWidth-L;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(L,r.lineGutter.offsetWidth-W)+1,r.lineNumWidth=r.lineNumInnerWidth+W,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",ka(e.display),!0}return!1}function Oa(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var L=e[i],W=null;if(typeof L!="string"&&(W=L.style,L=L.className),L=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:L,style:W})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function ko(e){var t=e.gutters,n=e.gutterSpecs;f(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],L=i.className,W=i.style,X=t.appendChild(a("div",null,"CodeMirror-gutter "+L));W&&(X.style.cssText=W),L=="CodeMirror-linenumbers"&&(e.lineGutter=X,X.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",ka(e)}function wi(e){ko(e.display),rn(e),Ao(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=T("div",null,"CodeMirror-code"),i.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=a("div",null,"CodeMirror-cursors"),i.measure=a("div",null,"CodeMirror-measure"),i.lineMeasure=a("div",null,"CodeMirror-measure"),i.lineSpace=T("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var L=T("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[L],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+ve+"px; width: 1px;"),i.gutters=a("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=a("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=a("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),K&&B<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!P&&!(O&&o)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=Oa(r.gutters,r.lineNumbers),ko(i),n.init(i)}var $i=0,gn=null;K?gn=-.53:O?gn=15:y?gn=-.7:_&&(gn=-1/3);function Do(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function cl(e){var t=Do(e);return t.x*=gn,t.y*=gn,t}function Oo(e,t){var n=Do(t),r=n.x,i=n.y,L=e.display,W=L.scroller,X=W.scrollWidth>W.clientWidth,Q=W.scrollHeight>W.clientHeight;if(!(r&&X||i&&Q))return;if(i&&l&&P){e:for(var te=t.target,be=L.view;te!=W;te=te.parentNode)for(var Te=0;Te<be.length;Te++)if(be[Te].node==te){e.display.currentWheelTarget=te;break e}}if(r&&!O&&!A&&gn!=null){i&&Q&&xi(e,Math.max(0,W.scrollTop+i*gn)),zn(e,Math.max(0,W.scrollLeft+r*gn)),(!i||i&&Q)&&le(t),L.wheelStartX=null;return}if(i&&gn!=null){var Ue=i*gn,_e=e.doc.scrollTop,Je=_e+L.wrapper.clientHeight;Ue<0?_e=Math.max(0,_e+Ue-50):Je=Math.min(e.doc.height,Je+Ue+50),La(e,{top:_e,bottom:Je})}$i<20&&(L.wheelStartX==null?(L.wheelStartX=W.scrollLeft,L.wheelStartY=W.scrollTop,L.wheelDX=r,L.wheelDY=i,setTimeout(function(){if(L.wheelStartX==null)return;var tt=W.scrollLeft-L.wheelStartX,it=W.scrollTop-L.wheelStartY,dt=it&&L.wheelDY&&it/L.wheelDY||tt&&L.wheelDX&&tt/L.wheelDX;if(L.wheelStartX=L.wheelStartY=null,!dt)return;gn=(gn*$i+dt)/($i+1),++$i},200)):(L.wheelDX+=r,L.wheelDY+=i))}var vn=function(e,t){this.ranges=e,this.primIndex=t};vn.prototype.primary=function(){return this.ranges[this.primIndex]},vn.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!zr(n.anchor,r.anchor)||!zr(n.head,r.head))return!1}return!0},vn.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new er(Ir(this.ranges[t].anchor),Ir(this.ranges[t].head));return new vn(e,this.primIndex)},vn.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},vn.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(wt(t,r.from())>=0&&wt(e,r.to())<=0)return n}return-1};var er=function(e,t){this.anchor=e,this.head=t};er.prototype.from=function(){return Wr(this.anchor,this.head)},er.prototype.to=function(){return Zr(this.anchor,this.head)},er.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Cn(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(Ue,_e){return wt(Ue.from(),_e.from())}),n=pe(t,i);for(var L=1;L<t.length;L++){var W=t[L],X=t[L-1],Q=wt(X.to(),W.from());if(r&&!W.empty()?Q>0:Q>=0){var te=Wr(X.from(),W.from()),be=Zr(X.to(),W.to()),Te=X.empty()?W.from()==W.head:X.from()==X.head;L<=n&&--n,t.splice(--L,2,new er(Te?be:te,Te?te:be))}}return new vn(t,n)}function Mn(e,t){return new vn([new er(e,t||e)],0)}function In(e){return e.text?et(e.from.line+e.text.length-1,J(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ro(e,t){if(wt(e,t.from)<0)return e;if(wt(e,t.to)<=0)return In(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+=In(t).ch-t.to.ch),et(n,r)}function Ra(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new er(Ro(i.anchor,t),Ro(i.head,t)))}return Cn(e.cm,n,e.sel.primIndex)}function _o(e,t,n){return e.line==t.line?et(n.line,e.ch-t.ch+n.ch):et(n.line+(e.line-t.line),e.ch)}function hl(e,t,n){for(var r=[],i=et(e.first,0),L=i,W=0;W<t.length;W++){var X=t[W],Q=_o(X.from,i,L),te=_o(In(X),i,L);if(i=X.to,L=te,n=="around"){var be=e.sel.ranges[W],Te=wt(be.head,be.anchor)<0;r[W]=new er(Te?te:Q,Te?Q:te)}else r[W]=new er(Q,Q)}return new vn(r,e.sel.primIndex)}function _a(e){e.doc.mode=pr(e.options,e.doc.modeOption),Ai(e)}function Ai(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,Ti(e,100),e.state.modeGen++,e.curOp&&rn(e)}function Po(e,t){return t.from.ch==0&&t.to.ch==0&&J(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Pa(e,t,n,r){function i(gt){return n?n[gt]:null}function L(gt,ct,bt){ua(gt,ct,bt,r),Kr(gt,"change",gt,t)}function W(gt,ct){for(var bt=[],Rt=gt;Rt<ct;++Rt)bt.push(new jn(te[Rt],i(Rt),r));return bt}var X=t.from,Q=t.to,te=t.text,be=ft(e,X.line),Te=ft(e,Q.line),Ue=J(te),_e=i(te.length-1),Je=Q.line-X.line;if(t.full)e.insert(0,W(0,te.length)),e.remove(te.length,e.size-te.length);else if(Po(e,t)){var tt=W(0,te.length-1);L(Te,Te.text,_e),Je&&e.remove(X.line,Je),tt.length&&e.insert(X.line,tt)}else if(be==Te)if(te.length==1)L(be,be.text.slice(0,X.ch)+Ue+be.text.slice(Q.ch),_e);else{var it=W(1,te.length-1);it.push(new jn(Ue+be.text.slice(Q.ch),_e,r)),L(be,be.text.slice(0,X.ch)+te[0],i(0)),e.insert(X.line+1,it)}else if(te.length==1)L(be,be.text.slice(0,X.ch)+te[0]+Te.text.slice(Q.ch),i(0)),e.remove(X.line+1,Je);else{L(be,be.text.slice(0,X.ch)+te[0],i(0)),L(Te,Ue+Te.text.slice(Q.ch),_e);var dt=W(1,te.length-1);Je>1&&e.remove(X.line+1,Je-1),e.insert(X.line+1,dt)}Kr(e,"change",e,t)}function Nn(e,t,n){function r(i,L,W){if(i.linked)for(var X=0;X<i.linked.length;++X){var Q=i.linked[X];if(Q.doc==L)continue;var te=W&&Q.sharedHist;if(n&&!te)continue;t(Q.doc,te),r(Q.doc,i,te)}}r(e,null,!0)}function Mo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,xa(e),_a(e),Io(e),e.options.lineWrapping||ji(e),e.options.mode=t.modeOption,rn(e)}function Io(e){(e.doc.direction=="rtl"?j:u)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){hn(e,function(){Io(e),rn(e)})}function Zi(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ma(e,t){var n={from:Ir(t.from),to:In(t),text:sr(e,t.from,t.to)};return Fo(e,n,t.from.line,t.to.line+1),Nn(e,function(r){return Fo(r,n,t.from.line,t.to.line+1)},!0),n}function No(e){for(;e.length;){var t=J(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return No(e.done),J(e.done);if(e.done.length&&!J(e.done).ranges)return J(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),J(e.done)}function Uo(e,t,n,r){var i=e.history;i.undone.length=0;var L=+new Date,W,X;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>L-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(W=pl(i,i.lastOp==r)))X=J(W.changes),wt(t.from,t.to)==0&&wt(t.from,X.to)==0?X.to=In(t):W.changes.push(Ma(e,t));else{var Q=J(i.done);for((!Q||!Q.ranges)&&Ji(e.sel,i.done),W={changes:[Ma(e,t)],generation:i.generation},i.done.push(W);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=L,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,X||Me(e,"historyAdded")}function ml(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var i=e.history,L=r&&r.origin;n==i.lastSelOp||L&&i.lastSelOrigin==L&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==L||ml(e,L,J(i.done),t))?i.done[i.done.length-1]=t:Ji(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=L,i.lastSelOp=n,r&&r.clearRedo!==!1&&No(i.undone)}function Ji(e,t){var n=J(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Fo(e,t,n,r){var i=t["spans_"+e.id],L=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(W){W.markedSpans&&((i||(i=t["spans_"+e.id]={}))[L]=W.markedSpans),++L})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(vl(n[i]));return r}function Bo(e,t){var n=yl(e,t),r=Nt(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var L=n[i],W=r[i];if(L&&W){e:for(var X=0;X<W.length;++X){for(var Q=W[X],te=0;te<L.length;++te)if(L[te].marker==Q.marker)continue e;L.push(Q)}}else W&&(n[i]=W)}return n}function ni(e,t,n){for(var r=[],i=0;i<e.length;++i){var L=e[i];if(L.ranges){r.push(n?vn.prototype.deepCopy.call(L):L);continue}var W=L.changes,X=[];r.push({changes:X});for(var Q=0;Q<W.length;++Q){var te=W[Q],be=void 0;if(X.push({from:te.from,to:te.to,text:te.text}),t)for(var Te in te)(be=Te.match(/^spans_(\d+)$/))&&(pe(t,Number(be[1]))>-1&&(J(X)[Te]=te[Te],delete te[Te]))}}return r}function Ia(e,t,n,r){if(r){var i=e.anchor;if(n){var L=wt(t,i)<0;L!=wt(n,i)<0?(i=t,t=n):L!=wt(t,n)<0&&(t=n)}return new er(i,t)}else return new er(n||t,t)}function Qi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Yr(e,new vn([Ia(e.sel.primary(),t,n,i)],0),r)}function jo(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),L=0;L<e.sel.ranges.length;L++)r[L]=Ia(e.sel.ranges[L],t[L],null,i);var W=Cn(e.cm,r,e.sel.primIndex);Yr(e,W,n)}function Na(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Yr(e,Cn(e.cm,i,e.sel.primIndex),r)}function Wo(e,t,n,r){Yr(e,Mn(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var L=0;L<i.length;L++)this.ranges[L]=new er(c(e,i[L].anchor),c(e,i[L].head))},origin:n&&n.origin};return Me(e,"beforeSelectionChange",e,r),e.cm&&Me(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Cn(e.cm,r.ranges,r.ranges.length-1):t}function Ho(e,t,n){var r=e.history.done,i=J(r);i&&i.ranges?(r[r.length-1]=t,qi(e,t,n)):Yr(e,t,n)}function Yr(e,t,n){qi(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function qi(e,t,n){(ye(e,"beforeSelectionChange")||e.cm&&ye(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(wt(t.primary().head,e.sel.primary().head)<0?-1:1);Ko(e,zo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&ti(e.cm)}function Ko(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Se(e.cm)),Kr(e,"cursorActivity",e)}function Go(e){Ko(e,zo(e,e.sel,null,!1))}function zo(e,t,n,r){for(var i,L=0;L<t.ranges.length;L++){var W=t.ranges[L],X=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[L],Q=ea(e,W.anchor,X&&X.anchor,n,r),te=ea(e,W.head,X&&X.head,n,r);(i||Q!=W.anchor||te!=W.head)&&(i||(i=t.ranges.slice(0,L)),i[L]=new er(Q,te))}return i?Cn(e.cm,i,t.primIndex):t}function ii(e,t,n,r,i){var L=ft(e,t.line);if(L.markedSpans)for(var W=0;W<L.markedSpans.length;++W){var X=L.markedSpans[W],Q=X.marker,te="selectLeft"in Q?!Q.selectLeft:Q.inclusiveLeft,be="selectRight"in Q?!Q.selectRight:Q.inclusiveRight;if((X.from==null||(te?X.from<=t.ch:X.from<t.ch))&&(X.to==null||(be?X.to>=t.ch:X.to>t.ch))){if(i&&(Me(Q,"beforeCursorEnter"),Q.explicitlyCleared))if(L.markedSpans){--W;continue}else break;if(!Q.atomic)continue;if(n){var Te=Q.find(r<0?1:-1),Ue=void 0;if((r<0?be:te)&&(Te=Vo(e,Te,-r,Te&&Te.line==t.line?L:null)),Te&&Te.line==t.line&&(Ue=wt(Te,n))&&(r<0?Ue<0:Ue>0))return ii(e,Te,t,r,i)}var _e=Q.find(r<0?-1:1);return(r<0?te:be)&&(_e=Vo(e,_e,r,_e.line==t.line?L:null)),_e?ii(e,_e,t,r,i):null}}return t}function ea(e,t,n,r,i){var L=r||1,W=ii(e,t,n,L,i)||!i&&ii(e,t,n,L,!0)||ii(e,t,n,-L,i)||!i&&ii(e,t,n,-L,!0);return W||(e.cantEdit=!0,et(e.first,0))}function Vo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?c(e,et(t.line-1)):null:n>0&&t.ch==(r||ft(e,t.line)).text.length?t.line<e.first+e.size-1?et(t.line+1,0):null:new et(t.line,t.ch+n)}function Xo(e){e.setSelection(et(e.firstLine(),0),et(e.lastLine()),ke)}function Yo(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,L,W,X){i&&(r.from=c(e,i)),L&&(r.to=c(e,L)),W&&(r.text=W),X!==void 0&&(r.origin=X)}),Me(e,"beforeChange",e,r),e.cm&&Me(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function ai(e,t,n){if(e.cm){if(!e.cm.curOp)return Ur(e.cm,ai)(e,t,n);if(e.cm.state.suppressEdits)return}if((ye(e,"beforeChange")||e.cm&&ye(e.cm,"beforeChange"))&&(t=Yo(e,t,!0),!t))return;var r=Nr&&!n&&ot(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)$o(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else $o(e,t)}function $o(e,t){if(t.text.length==1&&t.text[0]==""&&wt(t.from,t.to)==0)return;var n=Ra(e,t);Uo(e,t,n,e.cm?e.cm.curOp.id:NaN),Li(e,t,n,Nt(e,t));var r=[];Nn(e,function(i,L){!L&&pe(r,i.history)==-1&&(qo(i.history,t),r.push(i.history)),Li(i,t,null,Nt(i,t))})}function ta(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,L,W=e.sel,X=t=="undo"?i.done:i.undone,Q=t=="undo"?i.undone:i.done,te=0;te<X.length&&!(L=X[te],n?L.ranges&&!L.equals(e.sel):!L.ranges);te++);if(te==X.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(L=X.pop(),L.ranges){if(Ji(L,Q),n&&!L.equals(e.sel)){Yr(e,L,{clearRedo:!1});return}W=L}else if(r){X.push(L);return}else break;var be=[];Ji(W,Q),Q.push({changes:be,generation:i.generation}),i.generation=L.generation||++i.maxGeneration;for(var Te=ye(e,"beforeChange")||e.cm&&ye(e.cm,"beforeChange"),Ue=function(tt){var it=L.changes[tt];if(it.origin=t,Te&&!Yo(e,it,!1))return X.length=0,{};be.push(Ma(e,it));var dt=tt?Ra(e,it):J(X);Li(e,it,dt,Bo(e,it)),!tt&&e.cm&&e.cm.scrollIntoView({from:it.from,to:In(it)});var gt=[];Nn(e,function(ct,bt){!bt&&pe(gt,ct.history)==-1&&(qo(ct.history,it),gt.push(ct.history)),Li(ct,it,null,Bo(ct,it))})},_e=L.changes.length-1;_e>=0;--_e){var Je=Ue(_e);if(Je)return Je.v}}function Zo(e,t){if(t==0)return;if(e.first+=t,e.sel=new vn(ee(e.sel.ranges,function(i){return new er(et(i.anchor.line+t,i.anchor.ch),et(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){rn(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)_n(e.cm,r,"gutter")}}function Li(e,t,n,r){if(e.cm&&!e.cm.curOp)return Ur(e.cm,Li)(e,t,n,r);if(t.to.line<e.first){Zo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Zo(e,i),t={from:et(e.first,0),to:et(t.to.line+i,t.to.ch),text:[J(t.text)],origin:t.origin}}var L=e.lastLine();t.to.line>L&&(t={from:t.from,to:et(L,ft(e,L).text.length),text:[t.text[0]],origin:t.origin}),t.removed=sr(e,t.from,t.to),n||(n=Ra(e,t)),e.cm?El(e.cm,t,r):Pa(e,t,r),qi(e,n,ke),e.cantEdit&&ea(e,et(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,L=t.from,W=t.to,X=!1,Q=L.line;e.options.lineWrapping||(Q=Pt(Lr(ft(r,L.line))),r.iter(Q,W.line+1,function(_e){if(_e==i.maxLine)return X=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Se(e),Pa(r,t,n,fo(e)),e.options.lineWrapping||(r.iter(Q,L.line+t.text.length,function(_e){var Je=pi(_e);Je>i.maxLineLength&&(i.maxLine=_e,i.maxLineLength=Je,i.maxLineChanged=!0,X=!1)}),X&&(e.curOp.updateMaxLine=!0)),xr(r,L.line),Ti(e,400);var te=t.text.length-(W.line-L.line)-1;t.full?rn(e):L.line==W.line&&t.text.length==1&&!Po(e.doc,t)?_n(e,L.line,"text"):rn(e,L.line,W.line+1,te);var be=ye(e,"changes"),Te=ye(e,"change");if(Te||be){var Ue={from:L,to:W,text:t.text,removed:t.removed,origin:t.origin};Te&&Kr(e,"change",e,Ue),be&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Ue)}e.display.selForContextMenu=null}function oi(e,t,n,r,i){var L;r||(r=n),wt(r,n)<0&&(L=[r,n],n=L[0],r=L[1]),typeof t=="string"&&(t=e.splitLines(t)),ai(e,{from:n,to:r,text:t,origin:i})}function Jo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Qo(e,t,n,r){for(var i=0;i<e.length;++i){var L=e[i],W=!0;if(L.ranges){L.copied||(L=e[i]=L.deepCopy(),L.copied=!0);for(var X=0;X<L.ranges.length;X++)Jo(L.ranges[X].anchor,t,n,r),Jo(L.ranges[X].head,t,n,r);continue}for(var Q=0;Q<L.changes.length;++Q){var te=L.changes[Q];if(n<te.from.line)te.from=et(te.from.line+r,te.from.ch),te.to=et(te.to.line+r,te.to.ch);else if(t<=te.to.line){W=!1;break}}W||(e.splice(0,i+1),i=0)}}function qo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Qo(e.done,n,r,i),Qo(e.undone,n,r,i)}function ki(e,t,n,r){var i=t,L=t;return typeof t=="number"?L=ft(e,G(e,t)):i=Pt(t),i==null?null:(r(L,i)&&e.cm&&_n(e.cm,i,n),L)}function Di(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}Di.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,St(i),Kr(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function Oi(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}Oi.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var L=Math.min(t,i-e),W=r.height;if(r.removeInner(e,L),this.height-=W-r.height,i==L&&(this.children.splice(n--,1),r.parent=null),(t-=L)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Di))){var X=[];this.collapse(X),this.children=[new Di(X)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],L=i.chunkSize();if(e<=L){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var W=i.lines.length%25+25,X=W;X<i.lines.length;){var Q=new Di(i.lines.slice(X,X+=25));i.height-=Q.height,this.children.splice(++r,0,Q),Q.parent=this}i.lines=i.lines.slice(0,W),this.maybeSpill()}break}e-=L}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new Oi(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=pe(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new Oi(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],L=i.chunkSize();if(e<L){var W=Math.min(t,L-e);if(i.iterN(e,W,n))return!0;if((t-=W)==0)break;e=0}else e-=L}}};var Ri=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};Ri.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Pt(n);if(r==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var L=vi(this);gr(n,Math.max(0,n.height-L)),e&&(hn(e,function(){es(e,n,-L),_n(e,r,"widget")}),Kr(e,"lineWidgetCleared",e,this,r))},Ri.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=vi(this)-t;if(!i)return;En(this.doc,r)||gr(r,r.height+i),n&&hn(n,function(){n.curOp.forceUpdate=!0,es(n,r,i),Kr(n,"lineWidgetChanged",n,e,Pt(r))})},xe(Ri);function es(e,t,n){cn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&wa(e,n)}function xl(e,t,n,r){var i=new Ri(e,n,r),L=e.cm;return L&&i.noHScroll&&(L.display.alignWidgets=!0),ki(e,t,"widget",function(W){var X=W.widgets||(W.widgets=[]);if(i.insertAt==null?X.push(i):X.splice(Math.min(X.length-1,Math.max(0,i.insertAt)),0,i),i.line=W,L&&!En(e,W)){var Q=cn(W)<e.scrollTop;gr(W,W.height+vi(i)),Q&&wa(L,i.height),L.curOp.forceUpdate=!0}return!0}),L&&Kr(L,"lineWidgetAdded",L,i,typeof t=="number"?t:Pt(t)),i}var ts=0,Un=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ts};Un.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Xn(e),ye(this,"clear")){var n=this.find();n&&Kr(this,"clear",n.from,n.to)}for(var r=null,i=null,L=0;L<this.lines.length;++L){var W=this.lines[L],X=ar(W.markedSpans,this);e&&!this.collapsed?_n(e,Pt(W),"text"):e&&(X.to!=null&&(i=Pt(W)),X.from!=null&&(r=Pt(W))),W.markedSpans=yn(W.markedSpans,X),X.from==null&&this.collapsed&&!En(this.doc,W)&&e&&gr(W,Qn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var Q=0;Q<this.lines.length;++Q){var te=Lr(this.lines[Q]),be=pi(te);be>e.display.maxLineLength&&(e.display.maxLine=te,e.display.maxLineLength=be,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&rn(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Go(e.doc)),e&&Kr(e,"markerCleared",e,this,r,i),t&&Yn(e),this.parent&&this.parent.clear()},Un.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var L=this.lines[i],W=ar(L.markedSpans,this);if(W.from!=null&&(n=et(t?L:Pt(L),W.from),e==-1))return n;if(W.to!=null&&(r=et(t?L:Pt(L),W.to),e==1))return r}return n&&{from:n,to:r}},Un.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;hn(r,function(){var i=t.line,L=Pt(t.line),W=fa(r,L);if(W&&(io(W),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!En(n.doc,i)&&n.height!=null){var X=n.height;n.height=null;var Q=vi(n)-X;Q&&gr(i,i.height+Q)}Kr(r,"markerChanged",r,e)})},Un.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||pe(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Un.prototype.detachLine=function(e){if(this.lines.splice(pe(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},xe(Un);function si(e,t,n,r,i){if(r&&r.shared)return Cl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Ur(e.cm,si)(e,t,n,r,i);var L=new Un(e,i),W=wt(t,n);if(r&&N(r,L,!1),W>0||W==0&&L.clearWhenEmpty!==!1)return L;if(L.replacedWith&&(L.collapsed=!0,L.widgetNode=T("span",[L.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||L.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(L.widgetNode.insertLeft=!0)),L.collapsed){if(mr(e,t.line,t,n,L)||t.line!=n.line&&mr(e,n.line,t,n,L))throw new Error("Inserting collapsed marker partially overlapping an existing one");wr()}L.addToHistory&&Uo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var X=t.line,Q=e.cm,te;if(e.iter(X,n.line+1,function(Te){Q&&L.collapsed&&!Q.options.lineWrapping&&Lr(Te)==Q.display.maxLine&&(te=!0),L.collapsed&&X!=t.line&&gr(Te,0),Ar(Te,new Hr(L,X==t.line?t.ch:null,X==n.line?n.ch:null)),++X}),L.collapsed&&e.iter(t.line,n.line+1,function(Te){En(e,Te)&&gr(Te,0)}),L.clearOnEnter&&Re(L,"beforeCursorEnter",function(){return L.clear()}),L.readOnly&&(Xt(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),L.collapsed&&(L.id=++ts,L.atomic=!0),Q){if(te&&(Q.curOp.updateMaxLine=!0),L.collapsed)rn(Q,t.line,n.line+1);else if(L.className||L.startStyle||L.endStyle||L.css||L.attributes||L.title)for(var be=t.line;be<=n.line;be++)_n(Q,be,"text");L.atomic&&Go(Q.doc),Kr(Q,"markerAdded",Q,L)}return L}var _i=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};_i.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Kr(this,"clear")},_i.prototype.find=function(e,t){return this.primary.find(e,t)},xe(_i);function Cl(e,t,n,r,i){r=N(r),r.shared=!1;var L=[si(e,t,n,r,i)],W=L[0],X=r.widgetNode;return Nn(e,function(Q){X&&(r.widgetNode=X.cloneNode(!0)),L.push(si(Q,c(Q,t),c(Q,n),r,i));for(var te=0;te<Q.linked.length;++te)if(Q.linked[te].isParent)return;W=J(L)}),new _i(L,W)}function rs(e){return e.findMarks(et(e.first,0),e.clipPos(et(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),L=e.clipPos(i.from),W=e.clipPos(i.to);if(wt(L,W)){var X=si(e,L,W,r.primary,r.primary.type);r.markers.push(X),X.parent=r}}}function Tl(e){for(var t=function(r){var i=e[r],L=[i.primary.doc];Nn(i.primary.doc,function(Q){return L.push(Q)});for(var W=0;W<i.markers.length;W++){var X=i.markers[W];pe(L,X.doc)==-1&&(X.parent=null,i.markers.splice(W--,1))}},n=0;n<e.length;n++)t(n)}var wl=0,nn=function(e,t,n,r,i){if(!(this instanceof nn))return new nn(e,t,n,r,i);n==null&&(n=0),Oi.call(this,[new Di([new jn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var L=et(n,0);this.sel=Mn(L),this.history=new Zi(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Pa(this,{from:L,to:L,text:e}),Yr(this,Mn(L),ke)};nn.prototype=Ae(Oi.prototype,{constructor:nn,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Tr(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Fr(function(e){var t=et(this.first,0),n=this.first+this.size-1;ai(this,{from:t,to:et(n,ft(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Ei(this.cm,0,0),Yr(this,Mn(t),ke)}),replaceRange:function(e,t,n,r){t=c(this,t),n=n?c(this,n):t,oi(this,e,t,n,r)},getRange:function(e,t,n){var r=sr(this,c(this,e),c(this,t));return n===!1?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(dr(this,e))return ft(this,e)},getLineNumber:function(e){return Pt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=ft(this,e)),Lr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return c(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Fr(function(e,t,n){Wo(this,c(this,typeof e=="number"?et(e,t||0):e),null,n)}),setSelection:Fr(function(e,t,n){Wo(this,c(this,e),c(this,t||e),n)}),extendSelection:Fr(function(e,t,n){Qi(this,c(this,e),t&&c(this,t),n)}),extendSelections:Fr(function(e,t){jo(this,U(this,e),t)}),extendSelectionsBy:Fr(function(e,t){var n=ee(this.sel.ranges,e);jo(this,U(this,n),t)}),setSelections:Fr(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new er(c(this,e[i].anchor),c(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Yr(this,Cn(this.cm,r,t),n)}),addSelection:Fr(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new er(c(this,e),c(this,t||e))),Yr(this,Cn(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=sr(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=sr(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Fr(function(e,t,n){for(var r=[],i=this.sel,L=0;L<i.ranges.length;L++){var W=i.ranges[L];r[L]={from:W.from(),to:W.to(),text:this.splitLines(e[L]),origin:n}}for(var X=t&&t!="end"&&hl(this,r,t),Q=r.length-1;Q>=0;Q--)ai(this,r[Q]);X?Ho(this,X):this.cm&&ti(this.cm)}),undo:Fr(function(){ta(this,"undo")}),redo:Fr(function(){ta(this,"redo")}),undoSelection:Fr(function(){ta(this,"undo",!0)}),redoSelection:Fr(function(){ta(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Zi(this.history.maxGeneration),Nn(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:ni(this.history.done),undone:ni(this.history.undone)}},setHistory:function(e){var t=this.history=new Zi(this.history.maxGeneration);t.done=ni(e.done.slice(0),null,!0),t.undone=ni(e.undone.slice(0),null,!0)},setGutterMarker:Fr(function(e,t,n){return ki(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&je(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Fr(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&ki(t,n,"gutter",function(){return n.gutterMarkers[e]=null,je(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!dr(this,e))return null;if(t=e,e=ft(this,e),!e)return null}else if(t=Pt(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Fr(function(e,t,n){return ki(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(b(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Fr(function(e,t,n){return ki(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",L=r[i];if(L)if(n==null)r[i]=null;else{var W=L.match(b(n));if(!W)return!1;var X=W.index+W[0].length;r[i]=L.slice(0,W.index)+(!W.index||X==L.length?"":" ")+L.slice(X)||null}else return!1;return!0})}),addLineWidget:Fr(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return si(this,c(this,e),c(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=c(this,e),si(this,e,e,n,"bookmark")},findMarksAt:function(e){e=c(this,e);var t=[],n=ft(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=c(this,e),t=c(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(L){var W=L.markedSpans;if(W)for(var X=0;X<W.length;X++){var Q=W[X];!(Q.to!=null&&i==e.line&&e.ch>=Q.to||Q.from==null&&i!=e.line||Q.from!=null&&i==t.line&&Q.from>=t.ch)&&(!n||n(Q.marker))&&r.push(Q.marker.parent||Q.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var L=i.text.length+r;if(L>e)return t=e,!0;e-=L,++n}),c(this,et(n,t))},indexFromPos:function(e){e=c(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new nn(Tr(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new nn(Tr(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(r,rs(this)),r},unlinkDoc:function(e){if(e instanceof Er&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Tl(rs(this));break}if(e.history==this.history){var r=[e.id];Nn(e,function(i){return r.push(i.id)},!0),e.history=new Zi(null),e.history.done=ni(this.history.done,r),e.history.undone=ni(this.history.undone,r)}},iterLinkedDocs:function(e){Nn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Ct(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Fr(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&fl(this.cm)})}),nn.prototype.eachLine=nn.prototype.iter;var ns=0;function Al(e){var t=this;if(is(t),We(t,e)||kn(t.display,e))return;le(e),K&&(ns=+new Date);var n=Kn(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,L=Array(i),W=0,X=function(){++W==i&&Ur(t,function(){n=c(t.doc,n);var _e={from:n,to:n,text:t.doc.splitLines(L.filter(function(Je){return Je!=null}).join(t.doc.lineSeparator())),origin:"paste"};ai(t.doc,_e),Ho(t.doc,Mn(c(t.doc,n),c(t.doc,In(_e))))})()},Q=function(_e,Je){if(t.options.allowDropFileTypes&&pe(t.options.allowDropFileTypes,_e.type)==-1){X();return}var tt=new FileReader;tt.onerror=function(){return X()},tt.onload=function(){var it=tt.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(it)){X();return}L[Je]=it,X()},tt.readAsText(_e)},te=0;te<r.length;te++)Q(r[te],te);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var be=e.dataTransfer.getData("Text");if(be){var Te;if(t.state.draggingText&&!t.state.draggingText.copy&&(Te=t.listSelections()),qi(t.doc,Mn(n,n)),Te)for(var Ue=0;Ue<Te.length;++Ue)oi(t.doc,"",Te[Ue].anchor,Te[Ue].head,"drag");t.replaceSelection(be,"around","paste"),t.display.input.focus()}}catch(_e){}}}function Ll(e,t){if(K&&(!e.state.draggingText||+new Date-ns<100)){Ee(t);return}if(We(e,t)||kn(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!_){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",A&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),A&&n.parentNode.removeChild(n)}}function kl(e,t){var n=Kn(e,t);if(!n)return;var r=document.createDocumentFragment();go(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),s(e.display.dragCursor,r)}function is(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function as(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var L=0;L<n.length;L++)e(n[L])})}var os=!1;function Dl(){if(os)return;Ol(),os=!0}function Ol(){var e;Re(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(Rl)},100))}),Re(window,"blur",function(){return as(ei)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Fn={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Pi=0;Pi<10;Pi++)Fn[Pi+48]=Fn[Pi+96]=String(Pi);for(var ra=65;ra<=90;ra++)Fn[ra]=String.fromCharCode(ra);for(var Mi=1;Mi<=12;Mi++)Fn[Mi+111]=Fn[Mi+63235]="F"+Mi;var Dn={};Dn.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Dn.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Dn.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Dn.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Dn.default=l?Dn.macDefault:Dn.pcDefault;function _l(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,L,W=0;W<t.length-1;W++){var X=t[W];if(/^(cmd|meta|m)$/i.test(X))L=!0;else if(/^a(lt)?$/i.test(X))n=!0;else if(/^(c|ctrl|control)$/i.test(X))r=!0;else if(/^s(hift)?$/i.test(X))i=!0;else throw new Error("Unrecognized modifier name: "+X)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),L&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Pl(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=ee(n.split(" "),_l),L=0;L<i.length;L++){var W=void 0,X=void 0;L==i.length-1?(X=i.join(" "),W=r):(X=i.slice(0,L+1).join(" "),W="...");var Q=t[X];if(!Q)t[X]=W;else if(Q!=W)throw new Error("Inconsistent bindings for "+X)}delete e[n]}for(var te in t)e[te]=t[te];return e}function li(e,t,n,r){t=na(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return li(e,t.fallthrough,n,r);for(var L=0;L<t.fallthrough.length;L++){var W=li(e,t.fallthrough[L],n,r);if(W)return W}}}function ss(e){var t=typeof e=="string"?e:Fn[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ls(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(p?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(p?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function us(e,t){if(A&&e.keyCode==34&&e.char)return!1;var n=Fn[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),ls(n,e,t))}function na(e){return typeof e=="string"?Dn[e]:e}function ui(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var L=t(n[i]);r.length&&wt(L.from,J(r).to)<=0;){var W=r.pop();if(wt(W.from,L.from)<0){L.from=W.from;break}}r.push(L)}hn(e,function(){for(var X=r.length-1;X>=0;X--)oi(e.doc,"",r[X].from,r[X].to,"+delete");ti(e)})}function Ua(e,t,n){var r=Fe(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Fa(e,t,n){var r=Ua(e,t.ch,n);return r==null?null:new et(t.line,r,n<0?"after":"before")}function Ba(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var L=Ge(n,t.doc.direction);if(L){var W=i<0?J(L):L[0],X=i<0==(W.level==1),Q=X?"after":"before",te;if(W.level>0||t.doc.direction=="rtl"){var be=Jn(t,n);te=i<0?n.text.length-1:0;var Te=wn(t,be,te).top;te=qe(function(Ue){return wn(t,be,Ue).top==Te},i<0==(W.level==1)?W.from:W.to-1,te),Q=="before"&&(te=Ua(n,te,1))}else te=i<0?W.to:W.from;return new et(r,te,Q)}}return new et(r,i<0?n.text.length:0,i<0?"before":"after")}function Ml(e,t,n,r){var i=Ge(t,e.doc.direction);if(!i)return Fa(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var L=Be(i,n.ch,n.sticky),W=i[L];if(e.doc.direction=="ltr"&&W.level%2==0&&(r>0?W.to>n.ch:W.from<n.ch))return Fa(t,n,r);var X=function(dt,gt){return Ua(t,dt instanceof et?dt.ch:dt,gt)},Q,te=function(dt){return e.options.lineWrapping?(Q=Q||Jn(e,t),ho(e,t,Q,dt)):{begin:0,end:t.text.length}},be=te(n.sticky=="before"?X(n,-1):n.ch);if(e.doc.direction=="rtl"||W.level==1){var Te=W.level==1==r<0,Ue=X(n,Te?1:-1);if(Ue!=null&&(Te?Ue<=W.to&&Ue<=be.end:Ue>=W.from&&Ue>=be.begin)){var _e=Te?"before":"after";return new et(n.line,Ue,_e)}}var Je=function(dt,gt,ct){for(var bt=function(fr,Br){return Br?new et(n.line,X(fr,1),"before"):new et(n.line,fr,"after")};dt>=0&&dt<i.length;dt+=gt){var Rt=i[dt],At=gt>0==(Rt.level!=1),Wt=At?ct.begin:X(ct.end,-1);if(Rt.from<=Wt&&Wt<Rt.to)return bt(Wt,At);if(Wt=At?Rt.from:X(Rt.to,-1),ct.begin<=Wt&&Wt<ct.end)return bt(Wt,At)}},tt=Je(L+r,r,be);if(tt)return tt;var it=r>0?be.end:X(be.begin,-1);return it!=null&&!(r>0&&it==t.text.length)&&(tt=Je(r>0?0:i.length-1,r,te(it)),tt)?tt:null}var Ii={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ke)},killLine:function(e){return ui(e,function(t){if(t.empty()){var n=ft(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:et(t.head.line+1,0)}:{from:t.head,to:et(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return ui(e,function(t){return{from:et(t.from().line,0),to:c(e.doc,et(t.to().line+1,0))}})},delLineLeft:function(e){return ui(e,function(t){return{from:et(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return ui(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return ui(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(et(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(et(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return ds(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return cs(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},ae)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},ae)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?cs(e,t.head):r},ae)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var L=n[i].from(),W=Y(e.getLine(L.line),L.ch,r);t.push(se(r-W%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return hn(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,L=ft(e.doc,i.line).text;if(L){if(i.ch==L.length&&(i=new et(i.line,i.ch-1)),i.ch>0)i=new et(i.line,i.ch+1),e.replaceRange(L.charAt(i.ch-1)+L.charAt(i.ch-2),et(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var W=ft(e.doc,i.line-1).text;W&&(i=new et(i.line,1),e.replaceRange(L.charAt(0)+e.doc.lineSeparator()+W.charAt(W.length-1),et(i.line-1,W.length-1),i,"+transpose"))}}n.push(new er(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return hn(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);ti(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ds(e,t){var n=ft(e.doc,t),r=Lr(n);return r!=n&&(t=Pt(r)),Ba(!0,e,r,t,1)}function Il(e,t){var n=ft(e.doc,t),r=ln(n);return r!=n&&(t=Pt(r)),Ba(!0,e,n,t,-1)}function cs(e,t){var n=ds(e,t.line),r=ft(e.doc,n.line),i=Ge(r,e.doc.direction);if(!i||i[0].level==0){var L=Math.max(n.ch,r.text.search(/\S/)),W=t.line==n.line&&t.ch<=L&&t.ch;return et(n.line,W?0:L,n.sticky)}return n}function ia(e,t,n){if(typeof t=="string"&&(t=Ii[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Le}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Nl(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=li(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&li(t,e.options.extraKeys,n,e)||li(t,e.options.keyMap,n,e)}var Ul=new oe;function Ni(e,t,n,r){var i=e.state.keySeq;if(i){if(ss(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),hs(e,i+" "+t,n,r))return!0}return hs(e,t,n,r)}function hs(e,t,n,r){var i=Nl(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Kr(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(le(n),Ca(e)),!!i}function fs(e,t){var n=us(t,!0);return n?t.shiftKey&&!e.state.keySeq?Ni(e,"Shift-"+n,t,function(r){return ia(e,r,!0)})||Ni(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return ia(e,r)}):Ni(e,n,t,function(r){return ia(e,r)}):!1}function Fl(e,t,n){return Ni(e,"'"+n+"'",t,function(r){return ia(e,r,!0)})}var ja=null;function ps(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=D(),We(t,e))return;K&&B<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=fs(t,e);A&&(ja=r?n:null,!r&&n==88&&!Mt&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),O&&!l&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;j(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(u(t,"CodeMirror-crosshair"),$e(document,"keyup",n),$e(document,"mouseover",n))}Re(document,"keyup",n),Re(document,"mouseover",n)}function ms(e){e.keyCode==16&&(this.doc.sel.shift=!1),We(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(kn(t.display,e)||We(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(A&&n==ja){ja=null,le(e);return}if(A&&(!e.which||e.which<10)&&fs(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Fl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Wa=function(e,t,n){this.time=e,this.pos=t,this.button=n};Wa.prototype.compare=function(e,t,n){return this.time+jl>e&&wt(t,this.pos)==0&&n==this.button};var Ui,Fi;function Wl(e,t){var n=+new Date;return Fi&&Fi.compare(n,e,t)?(Ui=Fi=null,"triple"):Ui&&Ui.compare(n,e,t)?(Fi=new Wa(n,e,t),Ui=null,"double"):(Ui=new Wa(n,e,t),Fi=null,"single")}function vs(e){var t=this,n=t.display;if(We(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,kn(n,e)){P||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=Kn(t,e),i=Ie(e),L=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,L,e))return;i==1?r?Gl(t,r,L,e):we(e)==n.scroller&&le(e):i==2?(r&&Qi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(w?t.display.input.onContextMenu(e):yo(t))}function Hl(e,t,n,r,i){var L="Click";return r=="double"?L="Double"+L:r=="triple"&&(L="Triple"+L),L=(t==1?"Left":t==2?"Middle":"Right")+L,Ni(e,ls(L,i),i,function(W){if(typeof W=="string"&&(W=Ii[W]),!W)return!1;var X=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),X=W(e,n)!=Le}finally{e.state.suppressEdits=!1}return X})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var L=d?n.shiftKey&&n.metaKey:n.altKey;i.unit=L?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=l?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(l?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){K?setTimeout(M(vo,e),0):e.curOp.focus=D();var i=Kl(e,n,r),L=e.doc.sel,W;e.options.dragDrop&&Ze&&!e.isReadOnly()&&n=="single"&&(W=L.contains(t))>-1&&(wt((W=L.ranges[W]).from(),t)<0||t.xRel>0)&&(wt(W.to(),t)>0||t.xRel<0)?zl(e,r,t,i):Vl(e,r,t,i)}function zl(e,t,n,r){var i=e.display,L=!1,W=Ur(e,function(te){P&&(i.scroller.draggable=!1),e.state.draggingText=!1,$e(i.wrapper.ownerDocument,"mouseup",W),$e(i.wrapper.ownerDocument,"mousemove",X),$e(i.scroller,"dragstart",Q),$e(i.scroller,"drop",W),L||(le(te),r.addNew||Qi(e.doc,n,null,null,r.extend),P&&!_||K&&B==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),X=function(te){L=L||Math.abs(t.clientX-te.clientX)+Math.abs(t.clientY-te.clientY)>=10},Q=function(){return L=!0};P&&(i.scroller.draggable=!0),e.state.draggingText=W,W.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Re(i.wrapper.ownerDocument,"mouseup",W),Re(i.wrapper.ownerDocument,"mousemove",X),Re(i.scroller,"dragstart",Q),Re(i.scroller,"drop",W),yo(e),setTimeout(function(){return i.input.focus()},20)}function ys(e,t,n){if(n=="char")return new er(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new er(et(t.line,0),c(e.doc,et(t.line+1,0)));var r=n(e,t);return new er(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,L=e.doc;le(t);var W,X,Q=L.sel,te=Q.ranges;if(r.addNew&&!r.extend?(X=L.sel.contains(n),X>-1?W=te[X]:W=new er(n,n)):(W=L.sel.primary(),X=L.sel.primIndex),r.unit=="rectangle")r.addNew||(W=new er(n,n)),n=Kn(e,t,!0,!0),X=-1;else{var be=ys(e,n,r.unit);r.extend?W=Ia(W,be.anchor,be.head,r.extend):W=be}r.addNew?X==-1?(X=te.length,Yr(L,Cn(e,te.concat([W]),X),{scroll:!1,origin:"*mouse"})):te.length>1&&te[X].empty()&&r.unit=="char"&&!r.extend?(Yr(L,Cn(e,te.slice(0,X).concat(te.slice(X+1)),0),{scroll:!1,origin:"*mouse"}),Q=L.sel):Na(L,X,W,ce):(X=0,Yr(L,new vn([W],0),ce),Q=L.sel);var Te=n;function Ue(ct){if(wt(Te,ct)==0)return;if(Te=ct,r.unit=="rectangle"){for(var bt=[],Rt=e.options.tabSize,At=Y(ft(L,n.line).text,n.ch,Rt),Wt=Y(ft(L,ct.line).text,ct.ch,Rt),fr=Math.min(At,Wt),Br=Math.max(At,Wt),Sr=Math.min(n.line,ct.line),fn=Math.min(e.lastLine(),Math.max(n.line,ct.line));Sr<=fn;Sr++){var an=ft(L,Sr).text,Or=de(an,fr,Rt);fr==Br?bt.push(new er(et(Sr,Or),et(Sr,Or))):an.length>Or&&bt.push(new er(et(Sr,Or),et(Sr,de(an,Br,Rt))))}bt.length||bt.push(new er(n,n)),Yr(L,Cn(e,Q.ranges.slice(0,X).concat(bt),X),{origin:"*mouse",scroll:!1}),e.scrollIntoView(ct)}else{var on=W,Gr=ys(e,ct,r.unit),Mr=on.anchor,Rr;wt(Gr.anchor,Mr)>0?(Rr=Gr.head,Mr=Wr(on.from(),Gr.anchor)):(Rr=Gr.anchor,Mr=Zr(on.to(),Gr.head));var kr=Q.ranges.slice(0);kr[X]=Xl(e,new er(c(L,Mr),Rr)),Yr(L,Cn(e,kr,X),ce)}}var _e=i.wrapper.getBoundingClientRect(),Je=0;function tt(ct){var bt=++Je,Rt=Kn(e,ct,!0,r.unit=="rectangle");if(!Rt)return;if(wt(Rt,Te)!=0){e.curOp.focus=D(),Ue(Rt);var At=Vi(i,L);(Rt.line>=At.to||Rt.line<At.from)&&setTimeout(Ur(e,function(){Je==bt&&tt(ct)}),150)}else{var Wt=ct.clientY<_e.top?-20:ct.clientY>_e.bottom?20:0;Wt&&setTimeout(Ur(e,function(){if(Je!=bt)return;i.scroller.scrollTop+=Wt,tt(ct)}),50)}}function it(ct){e.state.selectingText=!1,Je=Infinity,ct&&(le(ct),i.input.focus()),$e(i.wrapper.ownerDocument,"mousemove",dt),$e(i.wrapper.ownerDocument,"mouseup",gt),L.history.lastSelOrigin=null}var dt=Ur(e,function(ct){ct.buttons===0||!Ie(ct)?it(ct):tt(ct)}),gt=Ur(e,it);e.state.selectingText=gt,Re(i.wrapper.ownerDocument,"mousemove",dt),Re(i.wrapper.ownerDocument,"mouseup",gt)}function Xl(e,t){var n=t.anchor,r=t.head,i=ft(e.doc,n.line);if(wt(n,r)==0&&n.sticky==r.sticky)return t;var L=Ge(i);if(!L)return t;var W=Be(L,n.ch,n.sticky),X=L[W];if(X.from!=n.ch&&X.to!=n.ch)return t;var Q=W+(X.from==n.ch==(X.level!=1)?0:1);if(Q==0||Q==L.length)return t;var te;if(r.line!=n.line)te=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var be=Be(L,r.ch,r.sticky),Te=be-W||(r.ch-n.ch)*(X.level==1?-1:1);be==Q-1||be==Q?te=Te<0:te=Te>0}var Ue=L[Q+(te?-1:0)],_e=te==(Ue.level==1),Je=_e?Ue.from:Ue.to,tt=_e?"after":"before";return n.ch==Je&&n.sticky==tt?t:new er(new et(n.line,Je,tt),r)}function bs(e,t,n,r){var i,L;if(t.touches)i=t.touches[0].clientX,L=t.touches[0].clientY;else try{i=t.clientX,L=t.clientY}catch(Ue){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&le(t);var W=e.display,X=W.lineDiv.getBoundingClientRect();if(L>X.bottom||!ye(e,n))return me(t);L-=X.top-W.viewOffset;for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var te=W.gutters.childNodes[Q];if(te&&te.getBoundingClientRect().right>=i){var be=yr(e.doc,L),Te=e.display.gutterSpecs[Q];return Me(e,n,e,be,Te.className,t),me(t)}}}function Ha(e,t){return bs(e,t,"gutterClick",!0)}function Es(e,t){if(kn(e.display,t)||Yl(e,t))return;if(We(e,t,"contextmenu"))return;w||e.display.input.onContextMenu(t)}function Yl(e,t){return ye(e,"gutterContextMenu")?bs(e,t,"gutterContextMenu",!1):!1}function xs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),yi(e)}var di={toString:function(){return"CodeMirror.Init"}},Cs={},aa={};function $l(e){var t=e.optionHandlers;function n(r,i,L,W){e.defaults[r]=i,L&&(t[r]=W?function(X,Q,te){te!=di&&L(X,Q,te)}:L)}e.defineOption=n,e.Init=di,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,_a(r)},!0),n("indentUnit",2,_a,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){Ai(r),yi(r),rn(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var L=[],W=r.doc.first;r.doc.iter(function(Q){for(var te=0;;){var be=Q.text.indexOf(i,te);if(be==-1)break;te=be+i.length,L.push(et(W,be))}W++});for(var X=L.length-1;X>=0;X--)oi(r.doc,i,L[X],et(L[X].line,L[X].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,L){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),L!=di&&r.refresh()}),n("specialCharPlaceholder",hr,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!S),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){xs(r),wi(r)},!0),n("keyMap","default",function(r,i,L){var W=na(i),X=L!=di&&na(L);X&&X.detach&&X.detach(r,W),W.attach&&W.attach(r,X||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Oa(i,r.options.lineNumbers),wi(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Ea(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return ri(r)},!0),n("scrollbarStyle","native",function(r){To(r),ri(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=Oa(r.options.gutters,i),wi(r)},!0),n("firstLineNumber",1,wi,!0),n("lineNumberFormatter",function(r){return r},wi,!0),n("showCursorWhenSelecting",!1,bi,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(ei(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Zl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,bi,!0),n("singleCursorHeightPerLine",!0,bi,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Ai,!0),n("addModeClass",!1,Ai,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,Ai,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Zl(e,t,n){var r=n&&n!=di;if(!t!=!r){var i=e.display.dragFunctions,L=t?Re:$e;L(e.display.scroller,"dragstart",i.start),L(e.display.scroller,"dragenter",i.enter),L(e.display.scroller,"dragover",i.over),L(e.display.scroller,"dragleave",i.leave),L(e.display.scroller,"drop",i.drop)}}function Jl(e){e.options.lineWrapping?(j(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(u(e.display.wrapper,"CodeMirror-wrap"),ji(e)),xa(e),rn(e),yi(e),setTimeout(function(){return ri(e)},100)}function Er(e,t){var n=this;if(!(this instanceof Er))return new Er(e,t);this.options=t=t?N(t):{},N(Cs,t,!1);var r=t.value;typeof r=="string"?r=new nn(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Er.inputStyles[t.inputStyle](this),L=this.display=new dl(e,r,i,t);L.wrapper.CodeMirror=this,xs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),To(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 oe,keySeq:null,specialChars:null},t.autofocus&&!o&&L.input.focus(),K&&B<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Ql(this),Dl(),Xn(this),this.curOp.forceUpdate=!0,Mo(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Sa(n)},20):ei(this);for(var W in aa)aa.hasOwnProperty(W)&&aa[W](this,t[W],di);Lo(this),t.finishInit&&t.finishInit(this);for(var X=0;X<Ka.length;++X)Ka[X](this);Yn(this),P&&t.lineWrapping&&getComputedStyle(L.lineDiv).textRendering=="optimizelegibility"&&(L.lineDiv.style.textRendering="auto")}Er.defaults=Cs,Er.optionHandlers=aa;function Ql(e){var t=e.display;Re(t.scroller,"mousedown",Ur(e,vs)),K&&B<11?Re(t.scroller,"dblclick",Ur(e,function(Q){if(We(e,Q))return;var te=Kn(e,Q);if(!te||Ha(e,Q)||kn(e.display,Q))return;le(Q);var be=e.findWordAt(te);Qi(e.doc,be.anchor,be.head)})):Re(t.scroller,"dblclick",function(Q){return We(e,Q)||le(Q)}),Re(t.scroller,"contextmenu",function(Q){return Es(e,Q)}),Re(t.input.getField(),"contextmenu",function(Q){t.scroller.contains(Q.target)||Es(e,Q)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function L(Q){if(Q.touches.length!=1)return!1;var te=Q.touches[0];return te.radiusX<=1&&te.radiusY<=1}function W(Q,te){if(te.left==null)return!0;var be=te.left-Q.left,Te=te.top-Q.top;return be*be+Te*Te>20*20}Re(t.scroller,"touchstart",function(Q){if(!We(e,Q)&&!L(Q)&&!Ha(e,Q)){t.input.ensurePolled(),clearTimeout(n);var te=+new Date;t.activeTouch={start:te,moved:!1,prev:te-r.end<=300?r:null},Q.touches.length==1&&(t.activeTouch.left=Q.touches[0].pageX,t.activeTouch.top=Q.touches[0].pageY)}}),Re(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Re(t.scroller,"touchend",function(Q){var te=t.activeTouch;if(te&&!kn(t,Q)&&te.left!=null&&!te.moved&&new Date-te.start<300){var be=e.coordsChar(t.activeTouch,"page"),Te;!te.prev||W(te,te.prev)?Te=new er(be,be):!te.prev.prev||W(te,te.prev.prev)?Te=e.findWordAt(be):Te=new er(et(be.line,0),c(e.doc,et(be.line+1,0))),e.setSelection(Te.anchor,Te.head),e.focus(),le(Q)}i()}),Re(t.scroller,"touchcancel",i),Re(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xi(e,t.scroller.scrollTop),zn(e,t.scroller.scrollLeft,!0),Me(e,"scroll",e))}),Re(t.scroller,"mousewheel",function(Q){return Oo(e,Q)}),Re(t.scroller,"DOMMouseScroll",function(Q){return Oo(e,Q)}),Re(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Q){We(e,Q)||Ee(Q)},over:function(Q){We(e,Q)||(kl(e,Q),Ee(Q))},start:function(Q){return Ll(e,Q)},drop:Ur(e,Al),leave:function(Q){We(e,Q)||is(e)}};var X=t.input.getField();Re(X,"keyup",function(Q){return ms.call(e,Q)}),Re(X,"keydown",Ur(e,ps)),Re(X,"keypress",Ur(e,gs)),Re(X,"focus",function(Q){return Sa(e,Q)}),Re(X,"blur",function(Q){return ei(e,Q)})}var Ka=[];Er.defineInitHook=function(e){return Ka.push(e)};function Bi(e,t,n,r){var i=e.doc,L;n==null&&(n="add"),n=="smart"&&(i.mode.indent?L=nt(e,t).state:n="prev");var W=e.options.tabSize,X=ft(i,t),Q=Y(X.text,null,W);X.stateAfter&&(X.stateAfter=null);var te=X.text.match(/^\s*/)[0],be;if(!r&&!/\S/.test(X.text))be=0,n="not";else if(n=="smart"&&(be=i.mode.indent(L,X.text.slice(te.length),X.text),be==Le||be>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?be=Y(ft(i,t-1).text,null,W):be=0:n=="add"?be=Q+e.options.indentUnit:n=="subtract"?be=Q-e.options.indentUnit:typeof n=="number"&&(be=Q+n),be=Math.max(0,be);var Te="",Ue=0;if(e.options.indentWithTabs)for(var _e=Math.floor(be/W);_e;--_e)Ue+=W,Te+=" ";if(Ue<be&&(Te+=se(be-Ue)),Te!=te)return oi(i,Te,et(t,0),et(t,te.length),"+input"),X.stateAfter=null,!0;for(var Je=0;Je<i.sel.ranges.length;Je++){var tt=i.sel.ranges[Je];if(tt.head.line==t&&tt.head.ch<te.length){var it=et(t,te.length);Na(i,Je,new er(it,it));break}}}var Sn=null;function oa(e){Sn=e}function Ga(e,t,n,r,i){var L=e.doc;e.display.shift=!1,r||(r=L.sel);var W=+new Date-200,X=i=="paste"||e.state.pasteIncoming>W,Q=Ct(t),te=null;if(X&&r.ranges.length>1)if(Sn&&Sn.text.join(`
|
|
`)==t){if(r.ranges.length%Sn.text.length==0){te=[];for(var be=0;be<Sn.text.length;be++)te.push(L.splitLines(Sn.text[be]))}}else Q.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(te=ee(Q,function(dt){return[dt]}));for(var Te=e.curOp.updateInput,Ue=r.ranges.length-1;Ue>=0;Ue--){var _e=r.ranges[Ue],Je=_e.from(),tt=_e.to();_e.empty()&&(n&&n>0?Je=et(Je.line,Je.ch-n):e.state.overwrite&&!X?tt=et(tt.line,Math.min(ft(L,tt.line).text.length,tt.ch+J(Q).length)):X&&Sn&&Sn.lineWise&&Sn.text.join(`
|
|
`)==Q.join(`
|
|
`)&&(Je=tt=et(Je.line,0)));var it={from:Je,to:tt,text:te?te[Ue%te.length]:Q,origin:i||(X?"paste":e.state.cutIncoming>W?"cut":"+input")};ai(e.doc,it),Kr(e,"inputRead",e,it)}t&&!X&&Ts(e,t),ti(e),e.curOp.updateInput<2&&(e.curOp.updateInput=Te),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ss(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&hn(t,function(){return Ga(t,n,0,null,"paste")}),!0}function Ts(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var L=e.getModeAt(i.head),W=!1;if(L.electricChars){for(var X=0;X<L.electricChars.length;X++)if(t.indexOf(L.electricChars.charAt(X))>-1){W=Bi(e,i.head.line,"smart");break}}else L.electricInput&&(L.electricInput.test(ft(e.doc,i.head.line).text.slice(0,i.head.ch))&&(W=Bi(e,i.head.line,"smart")));W&&Kr(e,"electricInput",e,i.head.line)}}function ws(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,L={anchor:et(i,0),head:et(i+1,0)};n.push(L),t.push(e.getRange(L.anchor,L.head))}return{text:t,ranges:n}}function As(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Ls(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return P?e.style.width="1000px":e.setAttribute("wrap","off"),E&&(e.style.border="1px solid black"),As(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var L=this.options,W=L[r];if(L[r]==i&&r!="mode")return;L[r]=i,t.hasOwnProperty(r)&&Ur(this,t[r])(this,i,W),Me(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](na(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,L=0;L<i.length;++L)if(i[L]==r||i[L].name==r)return i.splice(L,1),!0},addOverlay:Jr(function(r,i){var L=r.token?r:e.getMode(this.options,r);if(L.startState)throw new Error("Overlays may not be stateful.");ie(this.state.overlays,{mode:L,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(W){return W.priority}),this.state.modeGen++,rn(this)}),removeOverlay:Jr(function(r){for(var i=this.state.overlays,L=0;L<i.length;++L){var W=i[L].modeSpec;if(W==r||typeof r=="string"&&W.name==r){i.splice(L,1),this.state.modeGen++,rn(this);return}}}),indentLine:Jr(function(r,i,L){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),dr(this.doc,r)&&Bi(this,r,i,L)}),indentSelection:Jr(function(r){for(var i=this.doc.sel.ranges,L=-1,W=0;W<i.length;W++){var X=i[W];if(X.empty())X.head.line>L&&(Bi(this,X.head.line,r,!0),L=X.head.line,W==this.doc.sel.primIndex&&ti(this));else{var Q=X.from(),te=X.to(),be=Math.max(L,Q.line);L=Math.min(this.lastLine(),te.line-(te.ch?0:1))+1;for(var Te=be;Te<L;++Te)Bi(this,Te,r);var Ue=this.doc.sel.ranges;Q.ch==0&&i.length==Ue.length&&Ue[W].from().ch>0&&Na(this.doc,W,new er(Q,Ue[W].to()),ke)}}}),getTokenAt:function(r,i){return It(this,r,i)},getLineTokens:function(r,i){return It(this,et(r),i,!0)},getTokenTypeAt:function(r){r=c(this.doc,r);var i=Ye(this,ft(this.doc,r.line)),L=0,W=(i.length-1)/2,X=r.ch,Q;if(X==0)Q=i[2];else for(;;){var te=L+W>>1;if((te?i[te*2-1]:0)>=X)W=te;else if(i[te*2+1]<X)L=te+1;else{Q=i[te*2+2];break}}var be=Q?Q.indexOf("overlay "):-1;return be<0?Q:be==0?null:Q.slice(0,be-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var L=[];if(!n.hasOwnProperty(i))return L;var W=n[i],X=this.getModeAt(r);if(typeof X[i]=="string")W[X[i]]&&L.push(W[X[i]]);else if(X[i])for(var Q=0;Q<X[i].length;Q++){var te=W[X[i][Q]];te&&L.push(te)}else X.helperType&&W[X.helperType]?L.push(W[X.helperType]):W[X.name]&&L.push(W[X.name]);for(var be=0;be<W._global.length;be++){var Te=W._global[be];Te.pred(X,this)&&pe(L,Te.val)==-1&&L.push(Te.val)}return L},getStateAfter:function(r,i){var L=this.doc;return r=G(L,r==null?L.first+L.size-1:r),nt(this,r+1,i).state},cursorCoords:function(r,i){var L,W=this.doc.sel.primary();return r==null?L=W.head:typeof r=="object"?L=c(this.doc,r):L=r?W.from():W.to(),xn(this,L,i||"page")},charCoords:function(r,i){return ma(this,c(this.doc,r),i||"page")},coordsChar:function(r,i){return r=lo(this,r,i||"page"),va(this,r.left,r.top)},lineAtHeight:function(r,i){return r=lo(this,{top:r,left:0},i||"page").top,yr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,L){var W=!1,X;if(typeof r=="number"){var Q=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>Q&&(r=Q,W=!0),X=ft(this.doc,r)}else X=r;return Hi(this,X,{top:0,left:0},i||"page",L||W).top+(W?this.doc.height-cn(X):0)},defaultTextHeight:function(){return Qn(this.display)},defaultCharWidth:function(){return qn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,L,W,X){var Q=this.display;r=xn(this,c(this.doc,r));var te=r.bottom,be=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),Q.sizer.appendChild(i),W=="over")te=r.top;else if(W=="above"||W=="near"){var Te=Math.max(Q.wrapper.clientHeight,this.doc.height),Ue=Math.max(Q.sizer.clientWidth,Q.lineSpace.clientWidth);(W=="above"||r.bottom+i.offsetHeight>Te)&&r.top>i.offsetHeight?te=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=Te&&(te=r.bottom),be+i.offsetWidth>Ue&&(be=Ue-i.offsetWidth)}i.style.top=te+"px",i.style.left=i.style.right="",X=="right"?(be=Q.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(X=="left"?be=0:X=="middle"&&(be=(Q.sizer.clientWidth-i.offsetWidth)/2),i.style.left=be+"px"),L&&Zs(this,{left:be,top:te,right:be+i.offsetWidth,bottom:te+i.offsetHeight})},triggerOnKeyDown:Jr(ps),triggerOnKeyPress:Jr(gs),triggerOnKeyUp:ms,triggerOnMouseDown:Jr(vs),execCommand:function(r){if(Ii.hasOwnProperty(r))return Ii[r].call(null,this)},triggerElectric:Jr(function(r){Ts(this,r)}),findPosH:function(r,i,L,W){var X=1;i<0&&(X=-1,i=-i);for(var Q=c(this.doc,r),te=0;te<i&&!(Q=za(this.doc,Q,X,L,W),Q.hitSide);++te);return Q},moveH:Jr(function(r,i){var L=this;this.extendSelectionsBy(function(W){return L.display.shift||L.doc.extend||W.empty()?za(L.doc,W.head,r,i,L.options.rtlMoveVisually):r<0?W.from():W.to()},ae)}),deleteH:Jr(function(r,i){var L=this.doc.sel,W=this.doc;L.somethingSelected()?W.replaceSelection("",null,"+delete"):ui(this,function(X){var Q=za(W,X.head,r,i,!1);return r<0?{from:Q,to:X.head}:{from:X.head,to:Q}})}),findPosV:function(r,i,L,W){var X=1,Q=W;i<0&&(X=-1,i=-i);for(var te=c(this.doc,r),be=0;be<i;++be){var Te=xn(this,te,"div");if(Q==null?Q=Te.left:Te.left=Q,te=ks(this,Te,X,L),te.hitSide)break}return te},moveV:Jr(function(r,i){var L=this,W=this.doc,X=[],Q=!this.display.shift&&!W.extend&&W.sel.somethingSelected();if(W.extendSelectionsBy(function(be){if(Q)return r<0?be.from():be.to();var Te=xn(L,be.head,"div");be.goalColumn!=null&&(Te.left=be.goalColumn),X.push(Te.left);var Ue=ks(L,Te,r,i);return i=="page"&&be==W.sel.primary()&&wa(L,ma(L,Ue,"div").top-Te.top),Ue},ae),X.length)for(var te=0;te<W.sel.ranges.length;te++)W.sel.ranges[te].goalColumn=X[te]}),findWordAt:function(r){var i=this.doc,L=ft(i,r.line).text,W=r.ch,X=r.ch;if(L){var Q=this.getHelper(r,"wordChars");(r.sticky=="before"||X==L.length)&&W?--W:++X;for(var te=L.charAt(W),be=Pe(te,Q)?function(Te){return Pe(Te,Q)}:/\s/.test(te)?function(Te){return/\s/.test(Te)}:function(Te){return!/\s/.test(Te)&&!Pe(Te)};W>0&&be(L.charAt(W-1));)--W;for(;X<L.length&&be(L.charAt(X));)++X}return new er(et(r.line,W),et(r.line,X))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?j(this.display.cursorDiv,"CodeMirror-overwrite"):u(this.display.cursorDiv,"CodeMirror-overwrite"),Me(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==D()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Jr(function(r,i){Ei(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Tn(this)-this.display.barHeight,width:r.scrollWidth-Tn(this)-this.display.barWidth,clientHeight:ha(this),clientWidth:Wn(this)}},scrollIntoView:Jr(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from:et(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?Js(this,r):Eo(this,r.from,r.to,r.margin)}),setSize:Jr(function(r,i){var L=this,W=function(Q){return typeof Q=="number"||/^\d+$/.test(String(Q))?Q+"px":Q};r!=null&&(this.display.wrapper.style.width=W(r)),i!=null&&(this.display.wrapper.style.height=W(i)),this.options.lineWrapping&&ao(this);var X=this.display.viewFrom;this.doc.iter(X,this.display.viewTo,function(Q){if(Q.widgets){for(var te=0;te<Q.widgets.length;te++)if(Q.widgets[te].noHScroll){_n(L,X,"widget");break}}++X}),this.curOp.forceUpdate=!0,Me(this,"refresh",this)}),operation:function(r){return hn(this,r)},startOperation:function(){return Xn(this)},endOperation:function(){return Yn(this)},refresh:Jr(function(){var r=this.display.cachedTextHeight;rn(this),this.curOp.forceUpdate=!0,yi(this),Ei(this,this.doc.scrollLeft,this.doc.scrollTop),ka(this.display),(r==null||Math.abs(r-Qn(this.display))>.5||this.options.lineWrapping)&&xa(this),Me(this,"refresh",this)}),swapDoc:Jr(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Mo(this,r),yi(this),this.display.input.reset(),Ei(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Kr(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},xe(e),e.registerHelper=function(r,i,L){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=L},e.registerGlobalHelper=function(r,i,L,W){e.registerHelper(r,i,W),n[r]._global.push({pred:L,val:W})}}function za(e,t,n,r,i){var L=t,W=n,X=ft(e,t.line),Q=i&&e.direction=="rtl"?-n:n;function te(){var gt=t.line+Q;return gt<e.first||gt>=e.first+e.size?!1:(t=new et(gt,t.ch,t.sticky),X=ft(e,gt))}function be(gt){var ct;if(r=="codepoint"){var bt=X.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(bt)?ct=null:ct=new et(t.line,Math.max(0,Math.min(X.text.length,t.ch+n*(bt>=55296&&bt<56320?2:1))),-n)}else i?ct=Ml(e.cm,X,t,n):ct=Fa(X,t,n);if(ct==null)if(!gt&&te())t=Ba(i,e.cm,X,t.line,Q);else return!1;else t=ct;return!0}if(r=="char"||r=="codepoint")be();else if(r=="column")be(!0);else if(r=="word"||r=="group")for(var Te=null,Ue=r=="group",_e=e.cm&&e.cm.getHelper(t,"wordChars"),Je=!0;!(n<0&&!be(!Je));Je=!1){var tt=X.text.charAt(t.ch)||`
|
|
`,it=Pe(tt,_e)?"w":Ue&&tt==`
|
|
`?"n":!Ue||/\s/.test(tt)?null:"p";if(Ue&&!Je&&!it&&(it="s"),Te&&Te!=it){n<0&&(n=1,be(),t.sticky="after");break}if(it&&(Te=it),n>0&&!be(!Je))break}var dt=ea(e,t,L,W,!0);return zr(L,dt)&&(dt.hitSide=!0),dt}function ks(e,t,n,r){var i=e.doc,L=t.left,W;if(r=="page"){var X=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Q=Math.max(X-.5*Qn(e.display),3);W=(n>0?t.bottom:t.top)+n*Q}else r=="line"&&(W=n>0?t.bottom+3:t.top-3);for(var te;!(te=va(e,L,W),!te.outside);){if(n<0?W<=0:W>=i.height){te.hitSide=!0;break}W+=n*5}return te}var or=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new oe,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};or.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;As(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function L(X){for(var Q=X.target;Q;Q=Q.parentNode){if(Q==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(Q.className))break}return!1}Re(i,"paste",function(X){if(!L(X)||We(r,X)||Ss(X,r))return;B<=11&&setTimeout(Ur(r,function(){return t.updateFromDOM()}),20)}),Re(i,"compositionstart",function(X){t.composing={data:X.data,done:!1}}),Re(i,"compositionupdate",function(X){t.composing||(t.composing={data:X.data,done:!1})}),Re(i,"compositionend",function(X){t.composing&&(X.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Re(i,"touchstart",function(){return n.forceCompositionEnd()}),Re(i,"input",function(){t.composing||t.readFromDOMSoon()});function W(X){if(!L(X)||We(r,X))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()}),X.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var Q=ws(r);oa({lineWise:!0,text:Q.text}),X.type=="cut"&&r.operation(function(){r.setSelections(Q.ranges,0,ke),r.replaceSelection("",null,"cut")})}else return;if(X.clipboardData){X.clipboardData.clearData();var te=Sn.text.join(`
|
|
`);if(X.clipboardData.setData("Text",te),X.clipboardData.getData("Text")==te){X.preventDefault();return}}var be=Ls(),Te=be.firstChild;r.display.lineSpace.insertBefore(be,r.display.lineSpace.firstChild),Te.value=Sn.text.join(`
|
|
`);var Ue=document.activeElement;V(Te),setTimeout(function(){r.display.lineSpace.removeChild(be),Ue.focus(),Ue==i&&n.showPrimarySelection()},50)}Re(i,"copy",W),Re(i,"cut",W)},or.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},or.prototype.prepareSelection=function(){var e=mo(this.cm,!1);return e.focus=document.activeElement==this.div,e},or.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},or.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},or.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var L=sa(t,e.anchorNode,e.anchorOffset),W=sa(t,e.focusNode,e.focusOffset);if(L&&!L.bad&&W&&!W.bad&&wt(Wr(L,W),r)==0&&wt(Zr(L,W),i)==0)return;var X=t.display.view,Q=r.line>=t.display.viewFrom&&Ds(t,r)||{node:X[0].measure.map[2],offset:0},te=i.line<t.display.viewTo&&Ds(t,i);if(!te){var be=X[X.length-1].measure,Te=be.maps?be.maps[be.maps.length-1]:be.map;te={node:Te[Te.length-1],offset:Te[Te.length-2]-Te[Te.length-3]}}if(!Q||!te){e.removeAllRanges();return}var Ue=e.rangeCount&&e.getRangeAt(0),_e;try{_e=m(Q.node,Q.offset,te.offset,te.node)}catch(Je){}_e&&(!O&&t.state.focused?(e.collapse(Q.node,Q.offset),_e.collapsed||(e.removeAllRanges(),e.addRange(_e))):(e.removeAllRanges(),e.addRange(_e)),Ue&&e.anchorNode==null?e.addRange(Ue):O&&this.startGracePeriod()),this.rememberSelection()},or.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},or.prototype.showMultipleSelections=function(e){s(this.cm.display.cursorDiv,e.cursors),s(this.cm.display.selectionDiv,e.selection)},or.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},or.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return x(this.div,t)},or.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},or.prototype.blur=function(){this.div.blur()},or.prototype.getField=function(){return this.div},or.prototype.supportsTouch=function(){return!0},or.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():hn(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},or.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},or.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(h&&y&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=sa(t,e.anchorNode,e.anchorOffset),r=sa(t,e.focusNode,e.focusOffset);n&&r&&hn(t,function(){Yr(t.doc,Mn(n,r),ke),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},or.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=et(r.line-1,ft(e.doc,r.line-1).length)),i.ch==ft(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=et(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var L,W,X;r.line==t.viewFrom||(L=Gn(e,r.line))==0?(W=Pt(t.view[0].line),X=t.view[0].node):(W=Pt(t.view[L].line),X=t.view[L-1].node.nextSibling);var Q=Gn(e,i.line),te,be;if(Q==t.view.length-1?(te=t.viewTo-1,be=t.lineDiv.lastChild):(te=Pt(t.view[Q+1].line)-1,be=t.view[Q+1].node.previousSibling),!X)return!1;for(var Te=e.doc.splitLines(tu(e,X,be,W,te)),Ue=sr(e.doc,et(W,0),et(te,ft(e.doc,te).text.length));Te.length>1&&Ue.length>1;)if(J(Te)==J(Ue))Te.pop(),Ue.pop(),te--;else if(Te[0]==Ue[0])Te.shift(),Ue.shift(),W++;else break;for(var _e=0,Je=0,tt=Te[0],it=Ue[0],dt=Math.min(tt.length,it.length);_e<dt&&tt.charCodeAt(_e)==it.charCodeAt(_e);)++_e;for(var gt=J(Te),ct=J(Ue),bt=Math.min(gt.length-(Te.length==1?_e:0),ct.length-(Ue.length==1?_e:0));Je<bt&>.charCodeAt(gt.length-Je-1)==ct.charCodeAt(ct.length-Je-1);)++Je;if(Te.length==1&&Ue.length==1&&W==r.line)for(;_e&&_e>r.ch&>.charCodeAt(gt.length-Je-1)==ct.charCodeAt(ct.length-Je-1);)_e--,Je++;Te[Te.length-1]=gt.slice(0,gt.length-Je).replace(/^\u200b+/,""),Te[0]=Te[0].slice(_e).replace(/\u200b+$/,"");var Rt=et(W,_e),At=et(te,Ue.length?J(Ue).length-Je:0);if(Te.length>1||Te[0]||wt(Rt,At))return oi(e.doc,Te,Rt,At,"+input"),!0},or.prototype.ensurePolled=function(){this.forceCompositionEnd()},or.prototype.reset=function(){this.forceCompositionEnd()},or.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},or.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)},or.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&hn(this.cm,function(){return rn(e.cm)})},or.prototype.setUneditable=function(e){e.contentEditable="false"},or.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Ur(this.cm,Ga)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},or.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},or.prototype.onContextMenu=function(){},or.prototype.resetPosition=function(){},or.prototype.needsContentAttribute=!0;function Ds(e,t){var n=fa(e,t.line);if(!n||n.hidden)return null;var r=ft(e.doc,t.line),i=eo(n,r,t.line),L=Ge(r,e.doc.direction),W="left";if(L){var X=Be(L,t.ch);W=X%2?"right":"left"}var Q=no(i.map,t.ch,W);return Q.offset=Q.collapse=="right"?Q.end:Q.start,Q}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function ci(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var L="",W=!1,X=e.doc.lineSeparator(),Q=!1;function te(_e){return function(Je){return Je.id==_e}}function be(){W&&(L+=X,Q&&(L+=X),W=Q=!1)}function Te(_e){_e&&(be(),L+=_e)}function Ue(_e){if(_e.nodeType==1){var Je=_e.getAttribute("cm-text");if(Je){Te(Je);return}var tt=_e.getAttribute("cm-marker"),it;if(tt){var dt=e.findMarks(et(r,0),et(i+1,0),te(+tt));dt.length&&(it=dt[0].find(0))&&Te(sr(e.doc,it.from,it.to).join(X));return}if(_e.getAttribute("contenteditable")=="false")return;var gt=/^(pre|div|p|li|table|br)$/i.test(_e.nodeName);if(!/^br$/i.test(_e.nodeName)&&_e.textContent.length==0)return;gt&&be();for(var ct=0;ct<_e.childNodes.length;ct++)Ue(_e.childNodes[ct]);/^(pre|p)$/i.test(_e.nodeName)&&(Q=!0),gt&&(W=!0)}else _e.nodeType==3&&Te(_e.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Ue(t),t==n);)t=t.nextSibling,Q=!1;return L}function sa(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return ci(e.clipPos(et(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var L=e.display.view[i];if(L.node==r)return ru(L,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!x(r,t))return ci(et(Pt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var L=e.rest?J(e.rest):e.line;return ci(et(Pt(L),L.text.length),i)}var W=t.nodeType==3?t:null,X=t;for(!W&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(W=t.firstChild,n&&(n=W.nodeValue.length));X.parentNode!=r;)X=X.parentNode;var Q=e.measure,te=Q.maps;function be(it,dt,gt){for(var ct=-1;ct<(te?te.length:0);ct++)for(var bt=ct<0?Q.map:te[ct],Rt=0;Rt<bt.length;Rt+=3){var At=bt[Rt+2];if(At==it||At==dt){var Wt=Pt(ct<0?e.line:e.rest[ct]),fr=bt[Rt]+gt;return(gt<0||At!=it)&&(fr=bt[Rt+(gt?1:0)]),et(Wt,fr)}}}var Te=be(W,X,n);if(Te)return ci(Te,i);for(var Ue=X.nextSibling,_e=W?W.nodeValue.length-n:0;Ue;Ue=Ue.nextSibling){if(Te=be(Ue,Ue.firstChild,0),Te)return ci(et(Te.line,Te.ch-_e),i);_e+=Ue.textContent.length}for(var Je=X.previousSibling,tt=n;Je;Je=Je.previousSibling){if(Te=be(Je,Je.firstChild,-1),Te)return ci(et(Te.line,Te.ch+tt),i);tt+=Je.textContent.length}}var Dr=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new oe,this.hasSelection=!1,this.composing=null};Dr.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),E&&(i.style.width="0px"),Re(i,"input",function(){K&&B>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Re(i,"paste",function(W){if(We(r,W)||Ss(W,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function L(W){if(We(r,W))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var X=ws(r);oa({lineWise:!0,text:X.text}),W.type=="cut"?r.setSelections(X.ranges,null,ke):(n.prevInput="",i.value=X.text.join(`
|
|
`),V(i))}else return;W.type=="cut"&&(r.state.cutIncoming=+new Date)}Re(i,"cut",L),Re(i,"copy",L),Re(e.scroller,"paste",function(W){if(kn(e,W)||We(r,W))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var X=new Event("paste");X.clipboardData=W.clipboardData,i.dispatchEvent(X)}),Re(e.lineSpace,"selectstart",function(W){kn(e,W)||le(W)}),Re(i,"compositionstart",function(){var W=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:W,range:r.markText(W,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Re(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Dr.prototype.createField=function(e){this.wrapper=Ls(),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=mo(e);if(e.options.moveInputWithCursor){var i=xn(e,n.sel.primary().head,"div"),L=t.wrapper.getBoundingClientRect(),W=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+W.top-L.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+W.left-L.left))}return r},Dr.prototype.showSelection=function(e){var t=this.cm,n=t.display;s(n.cursorDiv,e.cursors),s(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&&V(this.textarea),K&&B>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",K&&B>=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"&&(!o||D()!=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||st(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(K&&B>=9&&this.hasSelection===i||l&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var L=i.charCodeAt(0);if(L==8203&&!r&&(r="\u200B"),L==8666)return this.reset(),this.cm.execCommand("undo")}for(var W=0,X=Math.min(r.length,i.length);W<X&&r.charCodeAt(W)==i.charCodeAt(W);)++W;return hn(t,function(){Ga(t,i.slice(W),r.length-W,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
|
|
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Dr.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Dr.prototype.onKeyPress=function(){K&&B>=9&&(this.hasSelection=null),this.fastPoll()},Dr.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var L=Kn(n,e),W=r.scroller.scrollTop;if(!L||A)return;var X=n.options.resetSelectionOnContextMenu;X&&n.doc.sel.contains(L)==-1&&Ur(n,Yr)(n.doc,Mn(L),ke);var Q=i.style.cssText,te=t.wrapper.style.cssText,be=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-be.top-5)+"px; left: "+(e.clientX-be.left-5)+`px;
|
|
z-index: 1000; background: `+(K?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var Te;P&&(Te=window.scrollY),r.input.focus(),P&&window.scrollTo(null,Te),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=_e,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function Ue(){if(i.selectionStart!=null){var tt=n.somethingSelected(),it="\u200B"+(tt?i.value:"");i.value="\u21DA",i.value=it,t.prevInput=tt?"":"\u200B",i.selectionStart=1,i.selectionEnd=it.length,r.selForContextMenu=n.doc.sel}}function _e(){if(t.contextMenuPending!=_e)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=te,i.style.cssText=Q,K&&B<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=W),i.selectionStart!=null){(!K||K&&B<9)&&Ue();var tt=0,it=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Ur(n,Xo)(n):tt++<10?r.detectingSelectAll=setTimeout(it,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(it,200)}}if(K&&B>=9&&Ue(),w){Ee(e);var Je=function(){$e(window,"mouseup",Je),setTimeout(_e,20)};Re(window,"mouseup",Je)}else setTimeout(_e,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?N(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=D();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=X.getValue()}var i;if(e.form&&(Re(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var L=e.form;i=L.submit;try{var W=L.submit=function(){r(),L.submit=i,L.submit(),L.submit=W}}catch(Q){}}t.finishInit=function(Q){Q.save=r,Q.getTextArea=function(){return e},Q.toTextArea=function(){Q.toTextArea=isNaN,r(),e.parentNode.removeChild(Q.getWrapperElement()),e.style.display="",e.form&&($e(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var X=Er(function(Q){return e.parentNode.insertBefore(Q,e.nextSibling)},t);return X}function iu(e){e.off=$e,e.on=Re,e.wheelEventPixels=cl,e.Doc=nn,e.splitLines=Ct,e.countColumn=Y,e.findColumn=de,e.isWordChar=Oe,e.Pass=Le,e.signal=Me,e.Line=jn,e.changeEnd=In,e.scrollbarModel=So,e.Pos=et,e.cmpPos=wt,e.modes=Dt,e.mimeModes=Tt,e.resolveMode=yt,e.getMode=pr,e.modeExtensions=jt,e.extendMode=tr,e.copyState=ur,e.startState=vr,e.innerMode=nr,e.commands=Ii,e.keyMap=Dn,e.keyName=us,e.isModifierKey=ss,e.lookupKey=li,e.normalizeKeyMap=Pl,e.StringStream=Ut,e.SharedTextMarker=_i,e.TextMarker=Un,e.LineWidget=Ri,e.e_preventDefault=le,e.e_stopPropagation=ue,e.e_stop=Ee,e.addClass=j,e.contains=x,e.rmClass=u,e.keyNames=Fn}$l(Er),ql(Er);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in nn.prototype)nn.prototype.hasOwnProperty(la)&&pe(au,la)<0&&(Er.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(nn.prototype[la]));return xe(nn),Er.inputStyles={textarea:Dr,contenteditable:or},Er.defineMode=function(e){!Er.defaults.mode&&e!="null"&&(Er.defaults.mode=e),Bt.apply(this,arguments)},Er.defineMIME=Qt,Er.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Er.defineMIME("text/plain","null"),Er.defineExtension=function(e,t){Er.prototype[e]=t},Er.defineDocExtension=function(e,t){nn.prototype[e]=t},Er.fromTextArea=nu,iu(Er),Er.version="5.58.2",Er})},WaYH:function(Et,rt,re){"use strict";var he=re("rePB"),$=re("Ff2n"),O=re("VTBJ"),Z=re("1OyB"),F=re("vuIU"),I=re("JX7q"),K=re("Ji7U"),B=re("LK+K"),P=re("q1tI"),R=re("TSYQ"),y=re.n(R),A=re("sboe"),_=re("OZM5"),k=function(w){var b=w.prefixCls,u=w.level,f=w.isStart,s=w.isEnd;if(!u)return null;for(var a="".concat(b,"-indent-unit"),T=[],m=0;m<u;m+=1){var x;T.push(P.createElement("span",{key:m,className:y()(a,(x={},Object(he.a)(x,"".concat(a,"-start"),f[m+1]),Object(he.a)(x,"".concat(a,"-end"),s[m+1]),Object(he.a)(x,"".concat(a,"-end-first-level"),!m&&s[0]),x))}))}return P.createElement("span",{"aria-hidden":"true",className:"".concat(b,"-indent")},T)},C=k,E=re("815F"),h="open",o="close",l="---",d=function(p){Object(K.a)(b,p);var w=Object(B.a)(b);function b(){var u;return Object(Z.a)(this,b),u=w.apply(this,arguments),u.state={dragNodeHighlight:!1},u.onSelectorClick=function(f){var s=u.props.context.onNodeClick;s(f,Object(E.b)(u.props)),u.isSelectable()?u.onSelect(f):u.onCheck(f)},u.onSelectorDoubleClick=function(f){var s=u.props.context.onNodeDoubleClick;s(f,Object(E.b)(u.props))},u.onSelect=function(f){if(u.isDisabled())return;var s=u.props.context.onNodeSelect;f.preventDefault(),s(f,Object(E.b)(u.props))},u.onCheck=function(f){if(u.isDisabled())return;var s=u.props,a=s.disableCheckbox,T=s.checked,m=u.props.context.onNodeCheck;if(!u.isCheckable()||a)return;f.preventDefault();var x=!T;m(f,Object(E.b)(u.props),x)},u.onMouseEnter=function(f){var s=u.props.context.onNodeMouseEnter;s(f,Object(E.b)(u.props))},u.onMouseLeave=function(f){var s=u.props.context.onNodeMouseLeave;s(f,Object(E.b)(u.props))},u.onContextMenu=function(f){var s=u.props.context.onNodeContextMenu;s(f,Object(E.b)(u.props))},u.onDragStart=function(f){var s=u.props.context.onNodeDragStart;f.stopPropagation(),u.setState({dragNodeHighlight:!0}),s(f,Object(I.a)(u));try{f.dataTransfer.setData("text/plain","")}catch(a){}},u.onDragEnter=function(f){var s=u.props.context.onNodeDragEnter;f.preventDefault(),f.stopPropagation(),s(f,Object(I.a)(u))},u.onDragOver=function(f){var s=u.props.context.onNodeDragOver;f.preventDefault(),f.stopPropagation(),s(f,Object(I.a)(u))},u.onDragLeave=function(f){var s=u.props.context.onNodeDragLeave;f.stopPropagation(),s(f,Object(I.a)(u))},u.onDragEnd=function(f){var s=u.props.context.onNodeDragEnd;f.stopPropagation(),u.setState({dragNodeHighlight:!1}),s(f,Object(I.a)(u))},u.onDrop=function(f){var s=u.props.context.onNodeDrop;f.preventDefault(),f.stopPropagation(),u.setState({dragNodeHighlight:!1}),s(f,Object(I.a)(u))},u.onExpand=function(f){var s=u.props.context.onNodeExpand;s(f,Object(E.b)(u.props))},u.setSelectHandle=function(f){u.selectHandle=f},u.getNodeState=function(){var f=u.props.expanded;return u.isLeaf()?null:f?h:o},u.hasChildren=function(){var f=u.props.eventKey,s=u.props.context.keyEntities,a=s[f]||{},T=a.children;return!!(T||[]).length},u.isLeaf=function(){var f=u.props,s=f.isLeaf,a=f.loaded,T=u.props.context.loadData,m=u.hasChildren();return s===!1?!1:s||!T&&!m||T&&a&&!m},u.isDisabled=function(){var f=u.props.disabled,s=u.props.context.disabled;return!!(s||f)},u.isCheckable=function(){var f=u.props.checkable,s=u.props.context.checkable;return!s||f===!1?!1:s},u.syncLoadData=function(f){var s=f.expanded,a=f.loading,T=f.loaded,m=u.props.context,x=m.loadData,D=m.onNodeLoad;if(a)return;x&&s&&!u.isLeaf()&&(!u.hasChildren()&&!T&&D(Object(E.b)(u.props)))},u.renderSwitcher=function(){var f=u.props,s=f.expanded,a=f.switcherIcon,T=u.props.context,m=T.prefixCls,x=T.switcherIcon,D=a||x;if(u.isLeaf())return P.createElement("span",{className:y()("".concat(m,"-switcher"),"".concat(m,"-switcher-noop"))},typeof D=="function"?D(Object(O.a)(Object(O.a)({},u.props),{},{isLeaf:!0})):D);var j=y()("".concat(m,"-switcher"),"".concat(m,"-switcher_").concat(s?h:o));return P.createElement("span",{onClick:u.onExpand,className:j},typeof D=="function"?D(Object(O.a)(Object(O.a)({},u.props),{},{isLeaf:!1})):D)},u.renderCheckbox=function(){var f=u.props,s=f.checked,a=f.halfChecked,T=f.disableCheckbox,m=u.props.context.prefixCls,x=u.isDisabled(),D=u.isCheckable();if(!D)return null;var j=typeof D!="boolean"?D:null;return P.createElement("span",{className:y()("".concat(m,"-checkbox"),s&&"".concat(m,"-checkbox-checked"),!s&&a&&"".concat(m,"-checkbox-indeterminate"),(x||T)&&"".concat(m,"-checkbox-disabled")),onClick:u.onCheck},j)},u.renderIcon=function(){var f=u.props.loading,s=u.props.context.prefixCls;return P.createElement("span",{className:y()("".concat(s,"-iconEle"),"".concat(s,"-icon__").concat(u.getNodeState()||"docu"),f&&"".concat(s,"-icon_loading"))})},u.renderSelector=function(){var f=u.state.dragNodeHighlight,s=u.props,a=s.title,T=s.selected,m=s.icon,x=s.loading,D=s.data,j=u.props.context,z=j.prefixCls,V=j.showIcon,M=j.icon,N=j.draggable,Y=j.loadData,oe=j.titleRender,pe=u.isDisabled(),ve="".concat(z,"-node-content-wrapper"),Le;if(V){var ke=m||M;Le=ke?P.createElement("span",{className:y()("".concat(z,"-iconEle"),"".concat(z,"-icon__customize"))},typeof ke=="function"?ke(u.props):ke):u.renderIcon()}else Y&&x&&(Le=u.renderIcon());var ce;typeof a=="function"?ce=a(D):oe?ce=oe(D):ce=a;var ae=P.createElement("span",{className:"".concat(z,"-title")},ce);return P.createElement("span",{ref:u.setSelectHandle,title:typeof a=="string"?a:"",className:y()("".concat(ve),"".concat(ve,"-").concat(u.getNodeState()||"normal"),!pe&&(T||f)&&"".concat(z,"-node-selected"),!pe&&N&&"draggable"),draggable:!pe&&N||void 0,"aria-grabbed":!pe&&N||void 0,onMouseEnter:u.onMouseEnter,onMouseLeave:u.onMouseLeave,onContextMenu:u.onContextMenu,onClick:u.onSelectorClick,onDoubleClick:u.onSelectorDoubleClick,onDragStart:N?u.onDragStart:void 0},Le,ae)},u}return Object(F.a)(b,[{key:"componentDidMount",value:function(){this.syncLoadData(this.props)}},{key:"componentDidUpdate",value:function(){this.syncLoadData(this.props)}},{key:"isSelectable",value:function(){var f=this.props.selectable,s=this.props.context.selectable;return typeof f=="boolean"?f:s}},{key:"render",value:function(){var f,s=this.props,a=s.eventKey,T=s.className,m=s.style,x=s.dragOver,D=s.dragOverGapTop,j=s.dragOverGapBottom,z=s.isLeaf,V=s.isStart,M=s.isEnd,N=s.expanded,Y=s.selected,oe=s.checked,pe=s.halfChecked,ve=s.loading,Le=s.domRef,ke=s.active,ce=s.onMouseMove,ae=Object($.a)(s,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),de=this.props.context,ne=de.prefixCls,se=de.filterTreeNode,J=de.draggable,ee=de.keyEntities,ie=this.isDisabled(),fe=Object(_.f)(ae),Ae=ee[a]||{},ge=Ae.level,Oe=M[M.length-1];return P.createElement("div",Object.assign({ref:Le,className:y()(T,"".concat(ne,"-treenode"),(f={},Object(he.a)(f,"".concat(ne,"-treenode-disabled"),ie),Object(he.a)(f,"".concat(ne,"-treenode-switcher-").concat(N?"open":"close"),!z),Object(he.a)(f,"".concat(ne,"-treenode-checkbox-checked"),oe),Object(he.a)(f,"".concat(ne,"-treenode-checkbox-indeterminate"),pe),Object(he.a)(f,"".concat(ne,"-treenode-selected"),Y),Object(he.a)(f,"".concat(ne,"-treenode-loading"),ve),Object(he.a)(f,"".concat(ne,"-treenode-active"),ke),Object(he.a)(f,"".concat(ne,"-treenode-leaf-last"),Oe),Object(he.a)(f,"drag-over",!ie&&x),Object(he.a)(f,"drag-over-gap-top",!ie&&D),Object(he.a)(f,"drag-over-gap-bottom",!ie&&j),Object(he.a)(f,"filter-node",se&&se(Object(E.b)(this.props))),f)),style:m,onDragEnter:J?this.onDragEnter:void 0,onDragOver:J?this.onDragOver:void 0,onDragLeave:J?this.onDragLeave:void 0,onDrop:J?this.onDrop:void 0,onDragEnd:J?this.onDragEnd:void 0,onMouseMove:ce},fe),P.createElement(C,{prefixCls:ne,level:ge,isStart:V,isEnd:M}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),b}(P.Component),S=function(w){return P.createElement(A.a.Consumer,null,function(b){return P.createElement(d,Object.assign({},w,{context:b}))})};S.displayName="TreeNode",S.defaultProps={title:l},S.isTreeNode=1;var v=rt.a=S},X8EC:function(Et,rt,re){"use strict";re.r(rt);var he=re("+L6B"),$=re("2/Rp"),O=re("DZo9"),Z=re("8z0m"),F=re("oBTY"),I=re("sRBo"),K=re("kaz8"),B=re("7Kak"),P=re("9yH6"),R=re("BoS7"),y=re("Sdc0"),A=re("14J3"),_=re("BMrR"),k=re("jCWc"),C=re("kPKH"),E=re("O3gP"),h=re("lrIw"),o=re("k1fw"),l=re("miYZ"),d=re("tsqr"),S=re("9og8"),v=re("y8nQ"),p=re("Vl3Y"),w=re("tJVT"),b=re("PpiC"),u=re("nRaC"),f=re("5RzL"),s=re("5NDa"),a=re("5rEg"),T=re("WmNS"),m=re.n(T),x=re("q1tI"),D=re.n(x),j=re("9kvl"),z=re("Ot1p"),V=re("hxT0"),M=re.n(V),N=re("1vsH"),Y=re("m3rI"),oe=re("ErOA"),pe=re("jrin"),ve=re("R9oj"),Le=re("ECub"),ke=re("YNHc"),ce=re.n(ke),ae=re("4i/N"),de=re("UESt"),ne=Object(x.createRef)(),se=function($e){var Me=$e.dataSource,We=$e.placeholder,Se=$e.defaultValue,ye=$e.onChange,xe=Object(x.useState)(!1),le=Object(w.a)(xe,2),ue=le[0],me=le[1],Ee=Object(x.useState)({data:[],objData:{},ids:[]}),we=Object(w.a)(Ee,2),Ie=we[0],Ze=we[1],at=Object(x.useState)({}),ht=Object(w.a)(at,2),ut=ht[0],xt=ht[1];Object(x.useEffect)(function(){window.addEventListener("click",function(){me(!1),xt({})})},[]),Object(x.useEffect)(function(){if(Se){var kt={},Dt=[];Se.forEach(function(Tt){var Bt=Tt.sub_discipline,Qt=Object(b.a)(Tt,["sub_discipline"]);Bt&&(kt[Bt.id]=Object(o.a)(Object(o.a)({},Qt),{},{sub_disciplines:[Bt]}),Dt.push(Bt.id))}),Ze({ids:Dt,data:Object.values(kt),objData:kt}),ye(Dt)}},[Se]);var Ct=function(){return D.a.createElement("div",{className:ce.a.emptyWrap},D.a.createElement(Le.a,{image:Le.a.PRESENTED_IMAGE_SIMPLE}))},st=function(Dt){if(Ie.ids.includes(Dt.id))return!1;var Tt=ut.sub_disciplines,Bt=Object(b.a)(ut,["sub_disciplines"]),Qt=Object(o.a)(Object(o.a)({},Ie.objData),{},Object(pe.a)({},Dt.id,Object(o.a)(Object(o.a)({},Bt),{},{sub_disciplines:[Dt]})));Ze({ids:[].concat(Object(F.a)(Ie.ids),[Dt.id]),data:Object.values(Qt),objData:Qt}),ye([].concat(Object(F.a)(Ie.ids),[Dt.id]))},Mt=function(Dt){var Tt=Ie.objData;delete Tt[Dt];var Bt=Ie.ids.filter(function(Qt){return Qt!==Dt});Ze({data:Object.values(Tt),objData:Tt,ids:Bt}),ye(Bt)},Lt=45;return ne&&ne.current&&ne.current.clientHeight>45&&(Lt=ne.current.clientHeight+5),D.a.createElement("div",{className:ce.a.cascaderContainer,onClick:function(Dt){Dt.stopPropagation()}},D.a.createElement("div",{ref:ne,className:ce.a.valueWrap,onClick:function(){return me(!ue)}},Ie.data.length===0&&D.a.createElement("span",{className:ce.a.placeholder},We||"\u8BF7\u9009\u62E9\u65B9\u5411&\u8BFE\u7A0B"),Ie.data.map(function(kt){return D.a.createElement("div",{className:ce.a.valueItem,key:kt.id},D.a.createElement("span",null,kt.name),D.a.createElement("span",null,"/"),D.a.createElement("span",null,kt.sub_disciplines[0].name),D.a.createElement("span",{onClick:function(Tt){Tt.stopPropagation(),Tt.preventDefault(),Mt(kt.sub_disciplines[0].id)}},D.a.createElement(ae.a,null)))})),ue&&D.a.createElement("div",{className:ce.a.modalWrap,style:{top:Lt}},D.a.createElement("div",{className:ce.a.left},Me.length===0&&Ct(),Me.length>0&&Me.map(function(kt){return D.a.createElement("div",{key:kt.id,onClick:function(){return xt(kt)}},D.a.createElement("span",null,kt.name),D.a.createElement("span",null,D.a.createElement(de.a,null)))})),ut.sub_disciplines&&D.a.createElement("div",{className:ce.a.right},ut.sub_disciplines.length===0&&Ct(),ut.sub_disciplines.length>0&&ut.sub_disciplines.map(function(kt){var Dt=Ie.ids.includes(kt.id);return D.a.createElement("div",{key:kt.id,className:Dt?ce.a.disabled:"",onClick:function(){return st(kt)}},kt.name)}))))},J=se,ee=re("2qtc"),ie=re("kLXV"),fe=re("6UJt"),Ae=re("DFOY"),ge=re("wd/R"),Oe=re.n(ge),Pe=re("jO45"),je=re("jN4g"),Ke=re("gJ3r"),He=re("8pgt"),Fe=re.n(He),qe=function($e,Me){return Me.some(function(We){return We.label.toLowerCase().indexOf($e.toLowerCase())>-1})},De=a.a.TextArea,Ne=function($e){var Me=$e.newCourse,We=$e.globalSetting,Se=$e.loading,ye=$e.dispatch,xe=$e.schoolName,le=$e.onSuccess,ue=le===void 0?function(){}:le,me=Object(b.a)($e,["newCourse","globalSetting","loading","dispatch","schoolName","onSuccess"]),Ee=p.a.useForm(),we=Object(w.a)(Ee,1),Ie=we[0];Object(x.useEffect)(function(){Ie.setFieldsValue({name:xe})},[xe]);var Ze=function(){var at=Object(S.a)(m.a.mark(function ht(ut){var xt,Ct,st,Mt,Lt,kt,Dt;return m.a.wrap(function(Bt){for(;;)switch(Bt.prev=Bt.next){case 0:return xt=ut||{},Ct=xt.name,st=xt.city,Mt=st===void 0?[]:st,Lt=xt.address,kt=xt.remarks,Bt.next=3,ye({type:"newCourse/appplySchool",payload:{name:Ct,province:Mt[0],city:Mt[1],address:Lt,remarks:kt}});case 3:Dt=Bt.sent,ye({type:"newCourse/setActionTabs",payload:{}}),Dt&&(d.b.success("\u65B0\u589E\u53D1\u5E03\u5355\u4F4D\u6210\u529F\uFF01"),ue(Ct));case 6:case"end":return Bt.stop()}},ht)}));return function(ut){return at.apply(this,arguments)}}();return D.a.createElement(ie.a,{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,visible:Me.actionTabs.key==="NewCourse-AppplySchool",title:"\u7533\u8BF7\u53D1\u5E03\u5355\u4F4D",width:"600px",footer:null},D.a.createElement(p.a,{className:Fe.a.formWrap,form:Ie,labelCol:{span:4},wrapperCol:{span:20},onFinish:Ze},D.a.createElement(p.a.Item,{label:"\u53D1\u5E03\u5355\u4F4D\uFF1A",name:"name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5B66\u6821\u6216\u5DE5\u4F5C\u5355\u4F4D"}]},D.a.createElement(a.a,{placeholder:"\u8BF7\u8F93\u5165\u53D1\u5E03\u5355\u4F4D"})),D.a.createElement("div",{className:"".concat(Fe.a.flexRow," ").concat(Fe.a.example)},D.a.createElement("div",null,"\u793A\u4F8B\uFF1A"),D.a.createElement("div",{className:Fe.a.flexColumn},D.a.createElement("div",null,D.a.createElement(Pe.a,{style:{color:"rgb(82, 196, 26)"}}),D.a.createElement("span",{className:"font14 ml5"},"\u6B63\u786E\u793A\u4F8B\uFF1A\u6570\u636E\u7ED3\u6784")),D.a.createElement("div",null,D.a.createElement(je.a,{style:{color:"red"}}),D.a.createElement("span",{className:"font14 ml5"},"\u9519\u8BEF\u793A\u4F8B\uFF1A\u6570\u636E\u7ED3\u6784",Oe()().format("YYYY"),"\u6625")))),D.a.createElement(p.a.Item,{label:"\u5730\u533A\uFF1A",name:"city"},D.a.createElement(Ae.a,{allowClear:!0,size:"large",options:Ke.a,placeholder:"\u8BF7\u9009\u62E9\u6240\u5728\u5730",showSearch:{matchInputWidth:!0,filter:qe}})),D.a.createElement(p.a.Item,{label:"\u8BE6\u7EC6\u5730\u5740\uFF1A",name:"address"},D.a.createElement(a.a,{placeholder:"\u8BF7\u586B\u5199\u5B8C\u6574\u7684\u5730\u5740\u4FE1\u606F"})),D.a.createElement(p.a.Item,{label:"\u8BF4\u660E\uFF1A",name:"remarks"},D.a.createElement(De,{placeholder:"\u518D\u6B21\u8BF4\u660E\u7279\u522B\u60C5\u51B5\uFF08\u9009\u586B\uFF09"})),D.a.createElement("div",{className:Fe.a.footerWrap},D.a.createElement(p.a.Item,null,D.a.createElement($.a,{className:"mr5",size:"large",onClick:function(){ye({type:"newCourse/setActionTabs",payload:{}})}},"\u53D6\u6D88"),D.a.createElement($.a,{size:"large",type:"primary",htmlType:"submit",loading:Se["newCourse/appplySchool"]},"\u4FDD\u5B58")))))},Be=Object(j.a)(function(Qe){var $e=Qe.newCourse,Me=Qe.loading,We=Qe.globalSetting;return{newCourse:$e,globalSetting:We,loading:Me.effects}})(Ne),ze=a.a.TextArea,Ge=f.a.TreeNode,Ve=function($e){var Me,We,Se=$e.user,ye=$e.newCourse,xe=$e.globalSetting,le=$e.loading,ue=$e.dispatch,me=Object(b.a)($e,["user","newCourse","globalSetting","loading","dispatch"]),Ee=p.a.useForm(),we=Object(w.a)(Ee,1),Ie=we[0],Ze=Object(x.useState)({}),at=Object(w.a)(Ze,2),ht=at[0],ut=at[1],xt=Object(x.useState)(),Ct=Object(w.a)(xt,2),st=Ct[0],Mt=Ct[1],Lt=Object(x.useRef)(),kt=Object(x.useState)(!0),Dt=Object(w.a)(kt,2),Tt=Dt[0],Bt=Dt[1],Qt=Object(x.useState)(!1),yt=Object(w.a)(Qt,2),pr=yt[0],jt=yt[1],tr=Object(x.useState)(),ur=Object(w.a)(tr,2),nr=ur[0],vr=ur[1],Ut=Object(x.useState)(!0),ft=Object(w.a)(Ut,2),sr=ft[0],Tr=ft[1],gr=Object(x.useState)(!1),Pt=Object(w.a)(gr,2),yr=Pt[0],dr=Pt[1],qr=Object(x.useState)(!1),et=Object(w.a)(qr,2),wt=et[0],zr=et[1],Ir=Object(x.useState)(-1),Zr=Object(w.a)(Ir,2),Wr=Zr[0],G=Zr[1],c=Object(x.useState)(!0),g=Object(w.a)(c,2),U=g[0],q=g[1],H=Object(x.useState)([]),Ce=Object(w.a)(H,2),Ye=Ce[0],nt=Ce[1],lt=Object(x.useState)([]),Xe=Object(w.a)(lt,2),pt=Xe[0],mt=Xe[1],It=Object(x.useState)([]),lr=Object(w.a)(It,2),$t=lr[0],rr=lr[1],xr=Object(x.useState)([]),Nr=Object(w.a)(xr,2),ir=Nr[0],Xt=Nr[1];Object(x.useEffect)(function(){var Nt,vt;wr(),Hr(),Lt.current=(Nt=me.match.params)===null||Nt===void 0?void 0:Nt.pathId,Mt(!!Lt.current),Object(N.X)(xe==null||((vt=xe.setting)===null||vt===void 0)?void 0:vt.name),Ie.setFieldsValue({learning_notes_title:"\u8BFE\u7A0B\u987B\u77E5"}),Lt.current&&yn()},[]);var wr=function(){var Nt=Object(S.a)(m.a.mark(function vt(){var ot;return m.a.wrap(function(Yt){for(;;)switch(Yt.prev=Yt.next){case 0:return Yt.next=2,Object(oe.a)("/api/disciplines.json",{method:"get",params:{source:"subject"}});case 2:ot=Yt.sent,rr(ot.disciplines);case 4:case"end":return Yt.stop()}},vt)}));return function(){return Nt.apply(this,arguments)}}(),Hr=function(){var Nt=Object(S.a)(m.a.mark(function vt(){var ot;return m.a.wrap(function(Yt){for(;;)switch(Yt.prev=Yt.next){case 0:return q(!0),Yt.next=3,ue({type:"newCourse/getSchoolOption"});case 3:ot=Yt.sent,q(!1),nt(ot==null?void 0:ot.schools),mt(ot==null?void 0:ot.schools);case 7:case"end":return Yt.stop()}},vt)}));return function(){return Nt.apply(this,arguments)}}(),ar=function(){var vt,ot;if(me!=null&&(vt=me.location)!==null&&vt!==void 0&&(ot=vt.query)!==null&&ot!==void 0&&ot.username){var Cr,Yt;j.d.push("/users/".concat(me==null||((Cr=me.location)===null||Cr===void 0||((Yt=Cr.query)===null||Yt===void 0))?void 0:Yt.username,"/paths"));return}j.d.push(st?"/paths/".concat(Lt.current):"/paths")},yn=function(){var Nt=Object(S.a)(m.a.mark(function vt(){var ot,Cr,Yt,Zt,Ht,br,Ft,cr,zt,Vr,mr,Lr,ln;return m.a.wrap(function(un){for(;;)switch(un.prev=un.next){case 0:return un.next=2,ue({type:"newCourse/getEditCourseData",payload:{id:Lt.current}});case 2:ot=un.sent,ot&&(Ft={name:ot.name,name_en:ot.name_en,intro:ot.description,content:ot==null||((Cr=ot.toast)===null||Cr===void 0)?void 0:Cr.content,notice:ot.learning_notes,school_id:ot==null?void 0:ot.school,learning_notes_title:ot.learning_notes_title||"\u8BFE\u7A0B\u987B\u77E5"},ot.disciplines&&ot.disciplines.length>0&&Xt(ot.disciplines),Ie.setFieldsValue(Ft),zr(ot==null||((Yt=ot.toast)===null||Yt===void 0)?void 0:Yt.is_open),G(ot==null||((Zt=ot.toast)===null||Zt===void 0)?void 0:Zt.open_num),Bt(ot==null?void 0:ot.cust_seq),jt(ot==null?void 0:ot.show_spoc),dr(ot==null?void 0:ot.show_history),Tr(ot==null?void 0:ot.show_tag),(ot==null||((Ht=ot.attachments)===null||Ht===void 0)?void 0:Ht.length)>0&&vr([{uid:ot==null||((cr=ot.attachments)===null||cr===void 0||((zt=cr[0])===null||zt===void 0))?void 0:zt.id,name:ot==null||((Vr=ot.attachments)===null||Vr===void 0||((mr=Vr[0])===null||mr===void 0))?void 0:mr.title,response:{id:ot==null||((Lr=ot.attachments)===null||Lr===void 0||((ln=Lr[0])===null||ln===void 0))?void 0:ln.id}}]),ut({name:ot.name,intro:ot.description,notice:ot.learning_notes,content:ot==null||((br=ot.toast)===null||br===void 0)?void 0:br.content}));case 4:case"end":return un.stop()}},vt)}));return function(){return Nt.apply(this,arguments)}}(),Ar=function(){var Nt=Object(S.a)(m.a.mark(function vt(ot){var Cr,Yt,Zt,Ht,br,Ft,cr,zt,Vr,mr,Lr,ln,pn,un,dn;return m.a.wrap(function(mn){for(;;)switch(mn.prev=mn.next){case 0:if(Zt=ot||{},Ht=Zt.name,br=Zt.intro,Ft=Zt.notice,cr=Zt.name_en,zt=Zt.learning_notes_title,Vr=Zt.sub_discipline_ids,mr=Zt.school_id,Lr=st?"newCourse/editCourse":"newCourse/submitCourse",ln=!1,pn=null,Ye.map(function(cn){mr===cn.name&&(ln=!0,pn=cn.id)}),ln){mn.next=7;break}return mn.abrupt("return",d.b.error("\u672A\u627E\u5230\u5305\u542B'".concat(mr,"'\u7684\u53D1\u5E03\u5355\u4F4D")));case 7:return un={id:Lt.current,name:Ht,name_en:cr,description:br,learning_notes:Ft,cust_seq:Tt,show_spoc:pr,school_id:pn,show_tag:sr,show_history:yr,learning_notes_title:zt,attachment_ids:[nr==null||((Cr=nr[0])===null||Cr===void 0||((Yt=Cr.response)===null||Yt===void 0))?void 0:Yt.id],sub_discipline_ids:Vr,subject_toast_attributes:{is_open:wt,open_num:Wr,content:ot.content}},mn.next=10,ue({type:Lr,payload:Object(o.a)({},un)});case 10:dn=mn.sent,(dn==null?void 0:dn.subject_id)&&j.d.push("/paths/".concat(dn.subject_id));case 12:case"end":return mn.stop()}},vt)}));return function(ot){return Nt.apply(this,arguments)}}(),_r=function(){ue({type:"newCourse/setActionTabs",payload:{key:"NewCourse-AppplySchool"}})},Rn=function(vt){Hr(),ut(Object(o.a)({},Ie.getFieldsValue()))};return Object(x.useEffect)(function(){var Nt;Ie.setFieldsValue({school_id:(Nt=Ye[0])===null||Nt===void 0?void 0:Nt.name})},[Ye]),D.a.createElement("div",{className:M.a.wrap},D.a.createElement("div",{className:M.a.bg},D.a.createElement("div",{className:M.a.crumbs},D.a.createElement("span",null,"\u5B9E\u8DF5\u8BFE\u7A0B"),D.a.createElement("i",{className:"iconfont icon-zhankai1"}),D.a.createElement("b",null,st?"\u7F16\u8F91":"\u521B\u5EFA","\u5B9E\u8DF5\u8BFE\u7A0B")),D.a.createElement("div",{className:M.a.titleWrap},D.a.createElement("span",null,st?"\u7F16\u8F91":"\u521B\u5EFA","\u5B9E\u8DF5\u8BFE\u7A0B"),D.a.createElement("b",{onClick:ar},"\u8FD4\u56DE")),D.a.createElement(p.a,{form:Ie,className:M.a.formWrap,scrollToFirstError:!0,layout:"vertical",colon:!1,onValuesChange:function(){var vt=Ie.getFieldsValue();"school_id"in vt&&mt(Ye.filter(function(ot){return ot.name.includes(vt.school_id)})),ut(Object(o.a)({},vt))},onFinish:Ar},D.a.createElement("div",{className:M.a.fieldWrap},D.a.createElement(p.a.Item,{extra:D.a.createElement("div",{className:"tr c-grey-333 font12 mt3"},"".concat(((Me=ht.name)===null||Me===void 0?void 0:Me.length)||0,"/60")),name:"name",label:"\u5B9E\u8DF5\u8BFE\u7A0B\u540D\u79F0",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5B9E\u8DF5\u8BFE\u7A0B\u540D\u79F0"}]},D.a.createElement(ze,{maxLength:60,placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"})),D.a.createElement(p.a.Item,{name:"name_en",label:"\u82F1\u6587\u8BFE\u7A0B\u540D\u79F0",rules:[{message:"\u8BF7\u8F93\u5165\u82F1\u6587\u8BFE\u7A0B\u540D\u79F0"}]},D.a.createElement(a.a,{maxLength:200,placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A",addonAfter:"".concat(((We=ht.name_en)===null||We===void 0?void 0:We.length)||0,"/200")})),D.a.createElement(p.a.Item,{name:"sub_discipline_ids",label:"\u65B9\u5411&\u8BFE\u7A0B"},D.a.createElement(J,{defaultValue:ir,dataSource:$t,onChange:function(vt){return Ie.setFieldsValue({sub_discipline_ids:vt})}})),D.a.createElement(p.a.Item,{label:"\u53D1\u5E03\u5355\u4F4D",name:"school_id",wrapperCol:{span:24},extra:!U&&ht.school_id&&!(Ye!=null&&Ye.find(function(Nt){return Nt.name===ht.school_id}))&&D.a.createElement("div",{className:M.a.schoolHintWrap},D.a.createElement("span",{className:M.a.colorCDCDCD},"\u672A\u627E\u5230\u5305\u542B\u201C",ht.school_id,"\u201D\u7684\u53D1\u5E03\u5355\u4F4D\uFF0C"),D.a.createElement("span",{className:"".concat(M.a.color0152d9),onClick:_r},"\u7533\u8BF7\u65B0\u589E")),rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u53D1\u5E03\u5355\u4F4D"}]},D.a.createElement(h.a,{placeholder:"\u8BF7\u8F93\u5165\u53D1\u5E03\u5355\u4F4D",showSearch:!0,size:"large",options:pt==null?void 0:pt.map(function(Nt){return{value:Nt.name}})}))),D.a.createElement("div",{className:M.a.mdWrap},D.a.createElement(p.a.Item,{name:"intro",label:"\u7B80\u4ECB",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5B9E\u8DF5\u8BFE\u7A0B\u7684\u7B80\u4ECB"},{max:8e3,message:"\u5B9E\u8DF5\u8BFE\u7A0B\u7684\u7B80\u4ECB\u6700\u5927\u9650\u52368000\u4E2A\u5B57\u7B26"}]},D.a.createElement(z.a,{watch:!0,defaultValue:ht.intro}))),D.a.createElement("div",{className:M.a.mdWrap},D.a.createElement(_.a,{align:"top",className:"mb10 mt10"},D.a.createElement(C.a,null,D.a.createElement("span",{className:"c-red mr10"},"*")),D.a.createElement(C.a,{flex:"1"},D.a.createElement(p.a.Item,{name:"learning_notes_title",label:"",style:{marginBottom:0},rules:[{required:!0,message:"\u8BF7\u8F93\u8BFE\u7A0B\u987B\u77E5\u6807\u9898"},{max:15,message:"\u8BF7\u8F93\u8BFE\u7A0B\u987B\u77E5\u6807\u9898\u6700\u5927\u9650\u523615\u4E2A\u5B57\u7B26"}]},D.a.createElement(a.a,{style:{height:38},placeholder:"\u8BF7\u8F93\u5165"})))),D.a.createElement(p.a.Item,{name:"notice",label:"",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5B9E\u8DF5\u8BFE\u7A0B\u7684\u8BFE\u7A0B\u987B\u77E5"},{max:1e4,message:"\u5B9E\u8DF5\u8BFE\u7A0B\u7684\u8BFE\u7A0B\u987B\u77E5\u6700\u5927\u9650\u523610000\u4E2A\u5B57\u7B26"}]},D.a.createElement(z.a,{insertTemp:"1",watch:!0,defaultValue:ht.notice}))),D.a.createElement("div",{className:M.a.mdWrap},D.a.createElement("div",{style:{display:"flex",alignItems:"center"}},D.a.createElement(y.a,{checked:wt,style:{marginRight:11,minWidth:32},onChange:function(vt){zr(vt)}}),D.a.createElement("span",{className:M.a.spanText},"\u8BFE\u7A0B\u63D0\u793A",D.a.createElement("span",null,"\uFF08\u8FDB\u5165\u8BFE\u7A0B\u8BE6\u60C5\u9875\uFF0C\u63D0\u793A\u5185\u5BB9\u4EE5\u5F39\u7A97\u7684\u5F62\u5F0F\u8FDB\u884C\u5C55\u793A\uFF09"))),wt&&D.a.createElement(p.a.Item,{style:{marginTop:10},name:"content",label:"",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5B9E\u8DF5\u8BFE\u7A0B\u7684\u8BFE\u7A0B\u63D0\u793A"},{max:1e4,message:"\u5B9E\u8DF5\u8BFE\u7A0B\u7684\u8BFE\u7A0B\u63D0\u793A\u6700\u5927\u9650\u523610000\u4E2A\u5B57\u7B26"}]},D.a.createElement(z.a,{insertTemp:"1",watch:!0,defaultValue:ht.content})),wt&&D.a.createElement("div",{style:{marginTop:20,borderBottom:"1px solid #DBDCE0",paddingBottom:7}},D.a.createElement("label",{style:{color:"#000",marginRight:10}},"\u63D0\u793A\u6B21\u6570"),D.a.createElement(P.a.Group,{value:Wr,onChange:function(vt){G(vt.target.value)}},D.a.createElement(P.a,{className:"c-black",value:-1},"\u6BCF\u6B21"),D.a.createElement(P.a,{className:"ml20 c-black",value:1},"\u4E00\u6B21")))),D.a.createElement("div",{className:M.a.mdWrap,style:{marginTop:25}},D.a.createElement(K.a,{checked:Tt,onChange:function(vt){Bt(vt==null?void 0:vt.target.checked)}},D.a.createElement("span",{className:M.a.spanText},"\u5C55\u793A\u9ED8\u8BA4\u7AE0\u8282\u5E8F\u53F7",D.a.createElement("span",null,"\uFF08\u9009\u4E2D\u5219\u6309\u5E8F\u5C55\u793A\u6240\u7AE0\u8282\u5E8F\u53F7\uFF0C\u4E0D\u9009\u4E2D\u5219\u9690\u85CF\u9ED8\u8BA4\u6392\u5E8F\uFF09"))),D.a.createElement("br",null),D.a.createElement(K.a,{style:{marginTop:"10px"},checked:pr,onChange:function(vt){return jt(vt==null?void 0:vt.target.checked)}},D.a.createElement("span",{className:M.a.spanText},"\u81EA\u9009\u5E76\u5C55\u793ASPOC\u8BFE\u5802",D.a.createElement("span",null,"\uFF08\u9009\u4E2D\u5219\u7ED9\u51FASPOC\u8BFE\u5802\u5C55\u793A\u533A\u57DF\uFF0C\u8BFE\u7A0B\u521B\u5EFA\u8005/\u5408\u4F5C\u8005\u53EF\u4EE5\u81EA\u4E3B\u6DFB\u52A0\u9700\u8981\u5C55\u793A\u7684\u8BFE\u5802\uFF09"))),D.a.createElement("br",null),D.a.createElement(K.a,{style:{marginTop:"10px"},checked:sr,onChange:function(vt){return Tr(vt==null?void 0:vt.target.checked)}},D.a.createElement("span",{className:M.a.spanText},"\u5C55\u793A\u6280\u672F\u6807\u7B7E\u6A21\u5757",D.a.createElement("span",null,"\uFF08\u9009\u4E2D\u540E\uFF0C\u5C55\u793A\u8BFE\u7A0B\u7684\u6280\u80FD\u6807\u7B7E\uFF0C\u4E0D\u9009\u4E2D\u5219\u4E0D\u5C55\u793A\u8BE5\u6A21\u5757\uFF09"))),D.a.createElement("br",null),D.a.createElement(K.a,{style:{marginTop:"10px"},checked:yr,onChange:function(vt){return dr(vt==null?void 0:vt.target.checked)}},D.a.createElement("span",{className:M.a.spanText},"\u5C55\u793A\u5386\u53F2\u8BFE\u5802\u6A21\u5757",D.a.createElement("span",null,"\uFF08\u9009\u4E2D\u540E\uFF0C\u5C55\u793A\u8BFE\u7A0B\u7684\u5386\u53F2\u8BFE\u5802\uFF0C\u4E0D\u9009\u4E2D\u5219\u4E0D\u5C55\u793A\u8BE5\u6A21\u5757\uFF09"))),D.a.createElement("br",null),D.a.createElement("div",{className:"mt10"},D.a.createElement("div",{className:"c-black mb10"},"\u81EA\u5B9A\u4E49\u9876\u90E8\u80CC\u666F\u56FE"),D.a.createElement(Z.a,{action:Y.a.API_SERVER+"/api/attachments.json",withCredentials:!0,fileList:nr,onChange:function(vt){var ot,Cr=(vt==null?void 0:vt.file.size)/1024/1024<2;if(!((ot=vt.fileList)!==null&&ot!==void 0&&ot.length))return!1;if(!Cr)vr(Object(F.a)(nr));else{var Yt;vr(vt==null||((Yt=vt.fileList)===null||Yt===void 0)?void 0:Yt.slice(-1))}},beforeUpload:function(vt){var ot=vt.type==="image/jpeg"||vt.type==="image/png";if(!ot)return d.b.error("\u53EA\u80FD\u4E0A\u4F20jpg \u6216\u8005png\u56FE\u7247"),!1;var Cr=vt.size/1024/1024<2;return Cr?ot&&Cr:(d.b.error("\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u5927\u4E8E2m"),!1)},onRemove:function(vt){vr([])}},D.a.createElement("div",{className:M.a.aBtn},"\u4E0A\u4F20\u56FE\u7247"),D.a.createElement("span",{style:{color:"#5F6367",pointerEvents:"none"}},"\uFF08\u672C\u9879\u975E\u5FC5\u9700\u3002\u5982\u4E0D\u4E0A\u4F20\uFF0C\u5219\u4F7F\u7528\u7CFB\u7EDF\u9ED8\u8BA4\u56FE\u7247\uFF1B\u5982\u4E0A\u4F20\uFF0C\u8BF7\u9009\u62E9jpg\u3001png\u683C\u5F0F\uFF0C\u5927\u5C0F\u4E0D\u8D85\u8FC72M\uFF0C\u5EFA\u8BAE\u5C3A\u5BF81920*240\u50CF\u7D20\uFF09")))),D.a.createElement("div",{className:M.a.backgroundFa},D.a.createElement("div",{className:M.a.bBtn,onClick:ar},"\u53D6\u6D88"),D.a.createElement($.a,{className:M.a.cBtn,onClick:function(){return Ie.submit()},loading:le["newCourse/editCourse"]||le["newCourse/submitCourse"]},"\u63D0\u4EA4"," "))),D.a.createElement(Be,{schoolName:ht.school_id,onSuccess:Rn})))},Re=rt.default=Object(j.a)(function(Qe){var $e=Qe.user,Me=Qe.newCourse,We=Qe.loading,Se=Qe.globalSetting;return{user:$e,newCourse:Me,globalSetting:Se,loading:We.effects}})(Ve)},XIdC:function(Et,rt,re){"use strict";var he=re("rePB"),$=re("ODXe"),O=re("Ff2n"),Z=re("q1tI"),F=re.n(Z),I=re("TSYQ"),K=re.n(I),B=re("6cGi"),P=re("4IlW"),R=Z.forwardRef(function(y,A){var _,k=y.prefixCls,C=k===void 0?"rc-switch":k,E=y.className,h=y.checked,o=y.defaultChecked,l=y.disabled,d=y.loadingIcon,S=y.checkedChildren,v=y.unCheckedChildren,p=y.onClick,w=y.onChange,b=y.onKeyDown,u=Object(O.a)(y,["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"]),f=Object(B.a)(!1,{value:h,defaultValue:o}),s=Object($.a)(f,2),a=s[0],T=s[1];function m(z,V){var M=a;return l||(M=z,T(M),w==null||w(M,V)),M}function x(z){z.which===P.a.LEFT?m(!1,z):z.which===P.a.RIGHT&&m(!0,z),b==null||b(z)}function D(z){var V=m(!a,z);p==null||p(V,z)}var j=K()(C,E,(_={},Object(he.a)(_,"".concat(C,"-checked"),a),Object(he.a)(_,"".concat(C,"-disabled"),l),_));return Z.createElement("button",Object.assign({},u,{type:"button",role:"switch","aria-checked":a,disabled:l,className:j,ref:A,onKeyDown:x,onClick:D}),d,Z.createElement("span",{className:"".concat(C,"-inner")},a?S:v))});R.displayName="Switch",rt.a=R},Y1PL:function(Et,rt,re){"use strict";re.r(rt),re.d(rt,"ResizableTextArea",function(){return pe});var he=re("wx14"),$=re("1OyB"),O=re("vuIU"),Z=re("Ji7U"),F=re("LK+K"),I=re("q1tI"),K=re("VTBJ"),B=re("rePB"),P=re("Zm9Q"),R=re("Kwbf"),y=re("c+Xe"),A=re("m+aA"),_=re("bdgK"),k=new Map;function C(ke){ke.forEach(function(ce){var ae,de=ce.target;(ae=k.get(de))===null||ae===void 0||ae.forEach(function(ne){return ne(de)})})}var E=new _.default(C),h=null,o=null;function l(ke,ce){k.has(ke)||(k.set(ke,new Set),E.observe(ke)),k.get(ke).add(ce)}function d(ke,ce){k.has(ke)&&(k.get(ke).delete(ce),k.get(ke).size||(E.unobserve(ke),k.delete(ke)))}var S=function(ke){Object(Z.a)(ae,ke);var ce=Object(F.a)(ae);function ae(){return Object($.a)(this,ae),ce.apply(this,arguments)}return Object(O.a)(ae,[{key:"render",value:function(){return this.props.children}}]),ae}(I.Component),v=I.createContext(null);function p(ke){var ce=ke.children,ae=ke.onBatchResize,de=I.useRef(0),ne=I.useRef([]),se=I.useContext(v),J=I.useCallback(function(ee,ie,fe){de.current+=1;var Ae=de.current;ne.current.push({size:ee,element:ie,data:fe}),Promise.resolve().then(function(){Ae===de.current&&(ae==null||ae(ne.current),ne.current=[])}),se==null||se(ee,ie,fe)},[ae,se]);return I.createElement(v.Provider,{value:J},ce)}function w(ke){var ce=ke.children,ae=ke.disabled,de=I.useRef(null),ne=I.useRef(null),se=I.useContext(v),J=I.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ee=I.isValidElement(ce)&&Object(y.c)(ce),ie=ee?ce.ref:null,fe=I.useMemo(function(){return Object(y.a)(ie,de)},[ie,de]),Ae=I.useRef(ke);Ae.current=ke;var ge=I.useCallback(function(Oe){var Pe=Ae.current,je=Pe.onResize,Ke=Pe.data,He=Oe.getBoundingClientRect(),Fe=He.width,qe=He.height,De=Oe.offsetWidth,Ne=Oe.offsetHeight,Be=Math.floor(Fe),ze=Math.floor(qe);if(J.current.width!==Be||J.current.height!==ze||J.current.offsetWidth!==De||J.current.offsetHeight!==Ne){var Ge={width:Be,height:ze,offsetWidth:De,offsetHeight:Ne};J.current=Ge;var Ve=De===Math.round(Fe)?Fe:De,Re=Ne===Math.round(qe)?qe:Ne,Qe=Object(K.a)(Object(K.a)({},Ge),{},{offsetWidth:Ve,offsetHeight:Re});se==null||se(Qe,Oe,Ke),je&&Promise.resolve().then(function(){je(Qe,Oe)})}},[]);return I.useEffect(function(){var Oe=Object(A.a)(de.current)||Object(A.a)(ne.current);return Oe&&!ae&&l(Oe,ge),function(){return d(Oe,ge)}},[de.current,ae]),I.createElement(S,{ref:ne},ee?I.cloneElement(ce,{ref:fe}):ce)}var b="rc-observer-key";function u(ke){var ce=ke.children,ae=Object(P.a)(ce);return ae.map(function(de,ne){var se=(de==null?void 0:de.key)||"".concat(b,"-").concat(ne);return I.createElement(w,Object(he.a)({},ke,{key:se}),de)})}u.Collection=p;var f=u,s=re("bT9E"),a=re("TSYQ"),T=re.n(a),m=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,x=["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"],D={},j;function z(ke){var ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ae=ke.getAttribute("id")||ke.getAttribute("data-reactid")||ke.getAttribute("name");if(ce&&D[ae])return D[ae];var de=window.getComputedStyle(ke),ne=de.getPropertyValue("box-sizing")||de.getPropertyValue("-moz-box-sizing")||de.getPropertyValue("-webkit-box-sizing"),se=parseFloat(de.getPropertyValue("padding-bottom"))+parseFloat(de.getPropertyValue("padding-top")),J=parseFloat(de.getPropertyValue("border-bottom-width"))+parseFloat(de.getPropertyValue("border-top-width")),ee=x.map(function(fe){return"".concat(fe,":").concat(de.getPropertyValue(fe))}).join(";"),ie={sizingStyle:ee,paddingSize:se,borderSize:J,boxSizing:ne};return ce&&ae&&(D[ae]=ie),ie}function V(ke){var ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ae=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,de=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;j||(j=document.createElement("textarea"),j.setAttribute("tab-index","-1"),j.setAttribute("aria-hidden","true"),document.body.appendChild(j)),ke.getAttribute("wrap")?j.setAttribute("wrap",ke.getAttribute("wrap")):j.removeAttribute("wrap");var ne=z(ke,ce),se=ne.paddingSize,J=ne.borderSize,ee=ne.boxSizing,ie=ne.sizingStyle;j.setAttribute("style","".concat(ie,";").concat(m)),j.value=ke.value||ke.placeholder||"";var fe=Number.MIN_SAFE_INTEGER,Ae=Number.MAX_SAFE_INTEGER,ge=j.scrollHeight,Oe;if(ee==="border-box"?ge+=J:ee==="content-box"&&(ge-=se),ae!==null||de!==null){j.value=" ";var Pe=j.scrollHeight-se;ae!==null&&(fe=Pe*ae,ee==="border-box"&&(fe=fe+se+J),ge=Math.max(fe,ge)),de!==null&&(Ae=Pe*de,ee==="border-box"&&(Ae=Ae+se+J),Oe=ge>Ae?"":"hidden",ge=Math.min(Ae,ge))}return{height:ge,minHeight:fe,maxHeight:Ae,overflowY:Oe,resize:"none"}}var M=re("Gytx"),N=re.n(M),Y;(function(ke){ke[ke.NONE=0]="NONE",ke[ke.RESIZING=1]="RESIZING",ke[ke.RESIZED=2]="RESIZED"})(Y||(Y={}));var oe=function(ke){Object(Z.a)(ae,ke);var ce=Object(F.a)(ae);function ae(de){var ne;return Object($.a)(this,ae),ne=ce.call(this,de),ne.nextFrameActionId=void 0,ne.resizeFrameId=void 0,ne.textArea=void 0,ne.saveTextArea=function(se){ne.textArea=se},ne.handleResize=function(se){var J=ne.state.resizeStatus,ee=ne.props,ie=ee.autoSize,fe=ee.onResize;if(J!==Y.NONE)return;typeof fe=="function"&&fe(se),ie&&ne.resizeOnNextFrame()},ne.resizeOnNextFrame=function(){cancelAnimationFrame(ne.nextFrameActionId),ne.nextFrameActionId=requestAnimationFrame(ne.resizeTextarea)},ne.resizeTextarea=function(){var se=ne.props.autoSize;if(!se||!ne.textArea)return;var J=se.minRows,ee=se.maxRows,ie=V(ne.textArea,!1,J,ee);ne.setState({textareaStyles:ie,resizeStatus:Y.RESIZING},function(){cancelAnimationFrame(ne.resizeFrameId),ne.resizeFrameId=requestAnimationFrame(function(){ne.setState({resizeStatus:Y.RESIZED},function(){ne.resizeFrameId=requestAnimationFrame(function(){ne.setState({resizeStatus:Y.NONE}),ne.fixFirefoxAutoScroll()})})})})},ne.renderTextArea=function(){var se=ne.props,J=se.prefixCls,ee=J===void 0?"rc-textarea":J,ie=se.autoSize,fe=se.onResize,Ae=se.className,ge=se.disabled,Oe=ne.state,Pe=Oe.textareaStyles,je=Oe.resizeStatus,Ke=Object(s.a)(ne.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),He=T()(ee,Ae,Object(B.a)({},"".concat(ee,"-disabled"),ge));"value"in Ke&&(Ke.value=Ke.value||"");var Fe=Object(K.a)(Object(K.a)(Object(K.a)({},ne.props.style),Pe),je===Y.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return I.createElement(f,{onResize:ne.handleResize,disabled:!(ie||fe)},I.createElement("textarea",Object(he.a)({},Ke,{className:He,style:Fe,ref:ne.saveTextArea})))},ne.state={textareaStyles:{},resizeStatus:Y.NONE},ne}return Object(O.a)(ae,[{key:"componentDidUpdate",value:function(ne){(ne.value!==this.props.value||!N()(ne.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 ne=this.textArea.selectionStart,se=this.textArea.selectionEnd;this.textArea.setSelectionRange(ne,se)}}catch(J){}}},{key:"render",value:function(){return this.renderTextArea()}}]),ae}(I.Component),pe=oe,ve=function(ke){Object(Z.a)(ae,ke);var ce=Object(F.a)(ae);function ae(de){var ne;Object($.a)(this,ae),ne=ce.call(this,de),ne.resizableTextArea=void 0,ne.focus=function(){ne.resizableTextArea.textArea.focus()},ne.saveTextArea=function(J){ne.resizableTextArea=J},ne.handleChange=function(J){var ee=ne.props.onChange;ne.setValue(J.target.value,function(){ne.resizableTextArea.resizeTextarea()}),ee&&ee(J)},ne.handleKeyDown=function(J){var ee=ne.props,ie=ee.onPressEnter,fe=ee.onKeyDown;J.keyCode===13&&ie&&ie(J),fe&&fe(J)};var se=typeof de.value=="undefined"||de.value===null?de.defaultValue:de.value;return ne.state={value:se},ne}return Object(O.a)(ae,[{key:"setValue",value:function(ne,se){"value"in this.props||this.setState({value:ne},se)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return I.createElement(pe,Object(he.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ne){return"value"in ne?{value:ne.value}:null}}]),ae}(I.Component),Le=rt.default=ve},YNHc:function(Et,rt,re){Et.exports={cascaderContainer:"cascaderContainer___3XtEo",valueWrap:"valueWrap___3ID8a",valueItem:"valueItem___yKIZs",placeholder:"placeholder___MxiA7",modalWrap:"modalWrap___1ge9B",left:"left___10iyZ",right:"right___KVnmg",disabled:"disabled___2c8qt",emptyWrap:"emptyWrap___dYSJ0"}},ZpRC:function(Et,rt,re){"use strict";function he(y){return typeof y=="object"&&y!=null&&y.nodeType===1}function $(y,A){return(!A||y!=="hidden")&&y!=="visible"&&y!=="clip"}function O(y,A){if(y.clientHeight<y.scrollHeight||y.clientWidth<y.scrollWidth){var _=getComputedStyle(y,null);return $(_.overflowY,A)||$(_.overflowX,A)||function(k){var C=function(E){if(!E.ownerDocument||!E.ownerDocument.defaultView)return null;try{return E.ownerDocument.defaultView.frameElement}catch(h){return null}}(k);return!!C&&(C.clientHeight<k.scrollHeight||C.clientWidth<k.scrollWidth)}(y)}return!1}function Z(y,A,_,k,C,E,h,o){return E<y&&h>A||E>y&&h<A?0:E<=y&&o<=_||h>=A&&o>=_?E-y-k:h>A&&o<_||E<y&&o>_?h-A+C:0}var F=function(y,A){var _=window,k=A.scrollMode,C=A.block,E=A.inline,h=A.boundary,o=A.skipOverflowHiddenElements,l=typeof h=="function"?h:function(Pe){return Pe!==h};if(!he(y))throw new TypeError("Invalid target");for(var d=document.scrollingElement||document.documentElement,S=[],v=y;he(v)&&l(v);){if((v=v.parentElement)===d){S.push(v);break}v!=null&&v===document.body&&O(v)&&!O(document.documentElement)||v!=null&&O(v,o)&&S.push(v)}for(var p=_.visualViewport?_.visualViewport.width:innerWidth,w=_.visualViewport?_.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,u=window.scrollY||pageYOffset,f=y.getBoundingClientRect(),s=f.height,a=f.width,T=f.top,m=f.right,x=f.bottom,D=f.left,j=C==="start"||C==="nearest"?T:C==="end"?x:T+s/2,z=E==="center"?D+a/2:E==="end"?m:D,V=[],M=0;M<S.length;M++){var N=S[M],Y=N.getBoundingClientRect(),oe=Y.height,pe=Y.width,ve=Y.top,Le=Y.right,ke=Y.bottom,ce=Y.left;if(k==="if-needed"&&T>=0&&D>=0&&x<=w&&m<=p&&T>=ve&&x<=ke&&D>=ce&&m<=Le)return V;var ae=getComputedStyle(N),de=parseInt(ae.borderLeftWidth,10),ne=parseInt(ae.borderTopWidth,10),se=parseInt(ae.borderRightWidth,10),J=parseInt(ae.borderBottomWidth,10),ee=0,ie=0,fe="offsetWidth"in N?N.offsetWidth-N.clientWidth-de-se:0,Ae="offsetHeight"in N?N.offsetHeight-N.clientHeight-ne-J:0;if(d===N)ee=C==="start"?j:C==="end"?j-w:C==="nearest"?Z(u,u+w,w,ne,J,u+j,u+j+s,s):j-w/2,ie=E==="start"?z:E==="center"?z-p/2:E==="end"?z-p:Z(b,b+p,p,de,se,b+z,b+z+a,a),ee=Math.max(0,ee+u),ie=Math.max(0,ie+b);else{ee=C==="start"?j-ve-ne:C==="end"?j-ke+J+Ae:C==="nearest"?Z(ve,ke,oe,ne,J+Ae,j,j+s,s):j-(ve+oe/2)+Ae/2,ie=E==="start"?z-ce-de:E==="center"?z-(ce+pe/2)+fe/2:E==="end"?z-Le+se+fe:Z(ce,Le,pe,de,se+fe,z,z+a,a);var ge=N.scrollLeft,Oe=N.scrollTop;j+=Oe-(ee=Math.max(0,Math.min(Oe+ee,N.scrollHeight-oe+Ae))),z+=ge-(ie=Math.max(0,Math.min(ge+ie,N.scrollWidth-pe+fe)))}V.push({el:N,top:ee,left:ie})}return V};function I(y){return y===Object(y)&&Object.keys(y).length!==0}function K(y,A){A===void 0&&(A="auto");var _="scrollBehavior"in document.body.style;y.forEach(function(k){var C=k.el,E=k.top,h=k.left;C.scroll&&_?C.scroll({top:E,left:h,behavior:A}):(C.scrollTop=E,C.scrollLeft=h)})}function B(y){return y===!1?{block:"end",inline:"nearest"}:I(y)?y:{block:"start",inline:"nearest"}}function P(y,A){var _=!y.ownerDocument.documentElement.contains(y);if(I(A)&&typeof A.behavior=="function")return A.behavior(_?[]:F(y,A));if(_)return;var k=B(A);return K(F(y,k),k.behavior)}var R=rt.a=P},Zss7:function(Et,rt,re){var he;(function($){var O=/^\s+/,Z=/\s+$/,F=0,I=$.round,K=$.min,B=$.max,P=$.random;function R(J,ee){if(J=J||"",ee=ee||{},J instanceof R)return J;if(!(this instanceof R))return new R(J,ee);var ie=y(J);this._originalInput=J,this._r=ie.r,this._g=ie.g,this._b=ie.b,this._a=ie.a,this._roundA=I(100*this._a)/100,this._format=ee.format||ie.format,this._gradientType=ee.gradientType,this._r<1&&(this._r=I(this._r)),this._g<1&&(this._g=I(this._g)),this._b<1&&(this._b=I(this._b)),this._ok=ie.ok,this._tc_id=F++}R.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var J=this.toRgb();return(J.r*299+J.g*587+J.b*114)/1e3},getLuminance:function(){var J=this.toRgb(),ee,ie,fe,Ae,ge,Oe;return ee=J.r/255,ie=J.g/255,fe=J.b/255,ee<=.03928?Ae=ee/12.92:Ae=$.pow((ee+.055)/1.055,2.4),ie<=.03928?ge=ie/12.92:ge=$.pow((ie+.055)/1.055,2.4),fe<=.03928?Oe=fe/12.92:Oe=$.pow((fe+.055)/1.055,2.4),.2126*Ae+.7152*ge+.0722*Oe},setAlpha:function(J){return this._a=V(J),this._roundA=I(100*this._a)/100,this},toHsv:function(){var J=C(this._r,this._g,this._b);return{h:J.h*360,s:J.s,v:J.v,a:this._a}},toHsvString:function(){var J=C(this._r,this._g,this._b),ee=I(J.h*360),ie=I(J.s*100),fe=I(J.v*100);return this._a==1?"hsv("+ee+", "+ie+"%, "+fe+"%)":"hsva("+ee+", "+ie+"%, "+fe+"%, "+this._roundA+")"},toHsl:function(){var J=_(this._r,this._g,this._b);return{h:J.h*360,s:J.s,l:J.l,a:this._a}},toHslString:function(){var J=_(this._r,this._g,this._b),ee=I(J.h*360),ie=I(J.s*100),fe=I(J.l*100);return this._a==1?"hsl("+ee+", "+ie+"%, "+fe+"%)":"hsla("+ee+", "+ie+"%, "+fe+"%, "+this._roundA+")"},toHex:function(J){return h(this._r,this._g,this._b,J)},toHexString:function(J){return"#"+this.toHex(J)},toHex8:function(J){return o(this._r,this._g,this._b,this._a,J)},toHex8String:function(J){return"#"+this.toHex8(J)},toRgb:function(){return{r:I(this._r),g:I(this._g),b:I(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+I(this._r)+", "+I(this._g)+", "+I(this._b)+")":"rgba("+I(this._r)+", "+I(this._g)+", "+I(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:I(M(this._r,255)*100)+"%",g:I(M(this._g,255)*100)+"%",b:I(M(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+I(M(this._r,255)*100)+"%, "+I(M(this._g,255)*100)+"%, "+I(M(this._b,255)*100)+"%)":"rgba("+I(M(this._r,255)*100)+"%, "+I(M(this._g,255)*100)+"%, "+I(M(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:j[h(this._r,this._g,this._b,!0)]||!1},toFilter:function(J){var ee="#"+l(this._r,this._g,this._b,this._a),ie=ee,fe=this._gradientType?"GradientType = 1, ":"";if(J){var Ae=R(J);ie="#"+l(Ae._r,Ae._g,Ae._b,Ae._a)}return"progid:DXImageTransform.Microsoft.gradient("+fe+"startColorstr="+ee+",endColorstr="+ie+")"},toString:function(J){var ee=!!J;J=J||this._format;var ie=!1,fe=this._a<1&&this._a>=0,Ae=!ee&&fe&&(J==="hex"||J==="hex6"||J==="hex3"||J==="hex4"||J==="hex8"||J==="name");return Ae?J==="name"&&this._a===0?this.toName():this.toRgbString():(J==="rgb"&&(ie=this.toRgbString()),J==="prgb"&&(ie=this.toPercentageRgbString()),(J==="hex"||J==="hex6")&&(ie=this.toHexString()),J==="hex3"&&(ie=this.toHexString(!0)),J==="hex4"&&(ie=this.toHex8String(!0)),J==="hex8"&&(ie=this.toHex8String()),J==="name"&&(ie=this.toName()),J==="hsl"&&(ie=this.toHslString()),J==="hsv"&&(ie=this.toHsvString()),ie||this.toHexString())},clone:function(){return R(this.toString())},_applyModification:function(J,ee){var ie=J.apply(null,[this].concat([].slice.call(ee)));return this._r=ie._r,this._g=ie._g,this._b=ie._b,this.setAlpha(ie._a),this},lighten:function(){return this._applyModification(p,arguments)},brighten:function(){return this._applyModification(w,arguments)},darken:function(){return this._applyModification(b,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(S,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(u,arguments)},_applyCombination:function(J,ee){return J.apply(null,[this].concat([].slice.call(ee)))},analogous:function(){return this._applyCombination(m,arguments)},complement:function(){return this._applyCombination(f,arguments)},monochromatic:function(){return this._applyCombination(x,arguments)},splitcomplement:function(){return this._applyCombination(T,arguments)},triad:function(){return this._applyCombination(s,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},R.fromRatio=function(J,ee){if(typeof J=="object"){var ie={};for(var fe in J)J.hasOwnProperty(fe)&&(fe==="a"?ie[fe]=J[fe]:ie[fe]=Le(J[fe]));J=ie}return R(J,ee)};function y(J){var ee={r:0,g:0,b:0},ie=1,fe=null,Ae=null,ge=null,Oe=!1,Pe=!1;return typeof J=="string"&&(J=ne(J)),typeof J=="object"&&(de(J.r)&&de(J.g)&&de(J.b)?(ee=A(J.r,J.g,J.b),Oe=!0,Pe=String(J.r).substr(-1)==="%"?"prgb":"rgb"):de(J.h)&&de(J.s)&&de(J.v)?(fe=Le(J.s),Ae=Le(J.v),ee=E(J.h,fe,Ae),Oe=!0,Pe="hsv"):de(J.h)&&de(J.s)&&de(J.l)&&(fe=Le(J.s),ge=Le(J.l),ee=k(J.h,fe,ge),Oe=!0,Pe="hsl"),J.hasOwnProperty("a")&&(ie=J.a)),ie=V(ie),{ok:Oe,format:J.format||Pe,r:K(255,B(ee.r,0)),g:K(255,B(ee.g,0)),b:K(255,B(ee.b,0)),a:ie}}function A(J,ee,ie){return{r:M(J,255)*255,g:M(ee,255)*255,b:M(ie,255)*255}}function _(J,ee,ie){J=M(J,255),ee=M(ee,255),ie=M(ie,255);var fe=B(J,ee,ie),Ae=K(J,ee,ie),ge,Oe,Pe=(fe+Ae)/2;if(fe==Ae)ge=Oe=0;else{var je=fe-Ae;Oe=Pe>.5?je/(2-fe-Ae):je/(fe+Ae);switch(fe){case J:ge=(ee-ie)/je+(ee<ie?6:0);break;case ee:ge=(ie-J)/je+2;break;case ie:ge=(J-ee)/je+4;break}ge/=6}return{h:ge,s:Oe,l:Pe}}function k(J,ee,ie){var fe,Ae,ge;J=M(J,360),ee=M(ee,100),ie=M(ie,100);function Oe(Ke,He,Fe){return Fe<0&&(Fe+=1),Fe>1&&(Fe-=1),Fe<1/6?Ke+(He-Ke)*6*Fe:Fe<1/2?He:Fe<2/3?Ke+(He-Ke)*(2/3-Fe)*6:Ke}if(ee===0)fe=Ae=ge=ie;else{var Pe=ie<.5?ie*(1+ee):ie+ee-ie*ee,je=2*ie-Pe;fe=Oe(je,Pe,J+1/3),Ae=Oe(je,Pe,J),ge=Oe(je,Pe,J-1/3)}return{r:fe*255,g:Ae*255,b:ge*255}}function C(J,ee,ie){J=M(J,255),ee=M(ee,255),ie=M(ie,255);var fe=B(J,ee,ie),Ae=K(J,ee,ie),ge,Oe,Pe=fe,je=fe-Ae;if(Oe=fe===0?0:je/fe,fe==Ae)ge=0;else{switch(fe){case J:ge=(ee-ie)/je+(ee<ie?6:0);break;case ee:ge=(ie-J)/je+2;break;case ie:ge=(J-ee)/je+4;break}ge/=6}return{h:ge,s:Oe,v:Pe}}function E(J,ee,ie){J=M(J,360)*6,ee=M(ee,100),ie=M(ie,100);var fe=$.floor(J),Ae=J-fe,ge=ie*(1-ee),Oe=ie*(1-Ae*ee),Pe=ie*(1-(1-Ae)*ee),je=fe%6,Ke=[ie,Oe,ge,ge,Pe,ie][je],He=[Pe,ie,ie,Oe,ge,ge][je],Fe=[ge,ge,Pe,ie,ie,Oe][je];return{r:Ke*255,g:He*255,b:Fe*255}}function h(J,ee,ie,fe){var Ae=[ve(I(J).toString(16)),ve(I(ee).toString(16)),ve(I(ie).toString(16))];return fe&&Ae[0].charAt(0)==Ae[0].charAt(1)&&Ae[1].charAt(0)==Ae[1].charAt(1)&&Ae[2].charAt(0)==Ae[2].charAt(1)?Ae[0].charAt(0)+Ae[1].charAt(0)+Ae[2].charAt(0):Ae.join("")}function o(J,ee,ie,fe,Ae){var ge=[ve(I(J).toString(16)),ve(I(ee).toString(16)),ve(I(ie).toString(16)),ve(ke(fe))];return Ae&&ge[0].charAt(0)==ge[0].charAt(1)&&ge[1].charAt(0)==ge[1].charAt(1)&&ge[2].charAt(0)==ge[2].charAt(1)&&ge[3].charAt(0)==ge[3].charAt(1)?ge[0].charAt(0)+ge[1].charAt(0)+ge[2].charAt(0)+ge[3].charAt(0):ge.join("")}function l(J,ee,ie,fe){var Ae=[ve(ke(fe)),ve(I(J).toString(16)),ve(I(ee).toString(16)),ve(I(ie).toString(16))];return Ae.join("")}R.equals=function(J,ee){return!J||!ee?!1:R(J).toRgbString()==R(ee).toRgbString()},R.random=function(){return R.fromRatio({r:P(),g:P(),b:P()})};function d(J,ee){ee=ee===0?0:ee||10;var ie=R(J).toHsl();return ie.s-=ee/100,ie.s=N(ie.s),R(ie)}function S(J,ee){ee=ee===0?0:ee||10;var ie=R(J).toHsl();return ie.s+=ee/100,ie.s=N(ie.s),R(ie)}function v(J){return R(J).desaturate(100)}function p(J,ee){ee=ee===0?0:ee||10;var ie=R(J).toHsl();return ie.l+=ee/100,ie.l=N(ie.l),R(ie)}function w(J,ee){ee=ee===0?0:ee||10;var ie=R(J).toRgb();return ie.r=B(0,K(255,ie.r-I(255*-(ee/100)))),ie.g=B(0,K(255,ie.g-I(255*-(ee/100)))),ie.b=B(0,K(255,ie.b-I(255*-(ee/100)))),R(ie)}function b(J,ee){ee=ee===0?0:ee||10;var ie=R(J).toHsl();return ie.l-=ee/100,ie.l=N(ie.l),R(ie)}function u(J,ee){var ie=R(J).toHsl(),fe=(ie.h+ee)%360;return ie.h=fe<0?360+fe:fe,R(ie)}function f(J){var ee=R(J).toHsl();return ee.h=(ee.h+180)%360,R(ee)}function s(J){var ee=R(J).toHsl(),ie=ee.h;return[R(J),R({h:(ie+120)%360,s:ee.s,l:ee.l}),R({h:(ie+240)%360,s:ee.s,l:ee.l})]}function a(J){var ee=R(J).toHsl(),ie=ee.h;return[R(J),R({h:(ie+90)%360,s:ee.s,l:ee.l}),R({h:(ie+180)%360,s:ee.s,l:ee.l}),R({h:(ie+270)%360,s:ee.s,l:ee.l})]}function T(J){var ee=R(J).toHsl(),ie=ee.h;return[R(J),R({h:(ie+72)%360,s:ee.s,l:ee.l}),R({h:(ie+216)%360,s:ee.s,l:ee.l})]}function m(J,ee,ie){ee=ee||6,ie=ie||30;var fe=R(J).toHsl(),Ae=360/ie,ge=[R(J)];for(fe.h=(fe.h-(Ae*ee>>1)+720)%360;--ee;)fe.h=(fe.h+Ae)%360,ge.push(R(fe));return ge}function x(J,ee){ee=ee||6;for(var ie=R(J).toHsv(),fe=ie.h,Ae=ie.s,ge=ie.v,Oe=[],Pe=1/ee;ee--;)Oe.push(R({h:fe,s:Ae,v:ge})),ge=(ge+Pe)%1;return Oe}R.mix=function(J,ee,ie){ie=ie===0?0:ie||50;var fe=R(J).toRgb(),Ae=R(ee).toRgb(),ge=ie/100,Oe={r:(Ae.r-fe.r)*ge+fe.r,g:(Ae.g-fe.g)*ge+fe.g,b:(Ae.b-fe.b)*ge+fe.b,a:(Ae.a-fe.a)*ge+fe.a};return R(Oe)},R.readability=function(J,ee){var ie=R(J),fe=R(ee);return($.max(ie.getLuminance(),fe.getLuminance())+.05)/($.min(ie.getLuminance(),fe.getLuminance())+.05)},R.isReadable=function(J,ee,ie){var fe=R.readability(J,ee),Ae,ge;ge=!1,Ae=se(ie);switch(Ae.level+Ae.size){case"AAsmall":case"AAAlarge":ge=fe>=4.5;break;case"AAlarge":ge=fe>=3;break;case"AAAsmall":ge=fe>=7;break}return ge},R.mostReadable=function(J,ee,ie){var fe=null,Ae=0,ge,Oe,Pe,je;ie=ie||{},Oe=ie.includeFallbackColors,Pe=ie.level,je=ie.size;for(var Ke=0;Ke<ee.length;Ke++)ge=R.readability(J,ee[Ke]),ge>Ae&&(Ae=ge,fe=R(ee[Ke]));return R.isReadable(J,fe,{level:Pe,size:je})||!Oe?fe:(ie.includeFallbackColors=!1,R.mostReadable(J,["#fff","#000"],ie))};var D=R.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},j=R.hexNames=z(D);function z(J){var ee={};for(var ie in J)J.hasOwnProperty(ie)&&(ee[J[ie]]=ie);return ee}function V(J){return J=parseFloat(J),(isNaN(J)||J<0||J>1)&&(J=1),J}function M(J,ee){oe(J)&&(J="100%");var ie=pe(J);return J=K(ee,B(0,parseFloat(J))),ie&&(J=parseInt(J*ee,10)/100),$.abs(J-ee)<1e-6?1:J%ee/parseFloat(ee)}function N(J){return K(1,B(0,J))}function Y(J){return parseInt(J,16)}function oe(J){return typeof J=="string"&&J.indexOf(".")!=-1&&parseFloat(J)===1}function pe(J){return typeof J=="string"&&J.indexOf("%")!=-1}function ve(J){return J.length==1?"0"+J:""+J}function Le(J){return J<=1&&(J=J*100+"%"),J}function ke(J){return $.round(parseFloat(J)*255).toString(16)}function ce(J){return Y(J)/255}var ae=function(){var J="[-\\+]?\\d+%?",ee="[-\\+]?\\d*\\.\\d+%?",ie="(?:"+ee+")|(?:"+J+")",fe="[\\s|\\(]+("+ie+")[,|\\s]+("+ie+")[,|\\s]+("+ie+")\\s*\\)?",Ae="[\\s|\\(]+("+ie+")[,|\\s]+("+ie+")[,|\\s]+("+ie+")[,|\\s]+("+ie+")\\s*\\)?";return{CSS_UNIT:new RegExp(ie),rgb:new RegExp("rgb"+fe),rgba:new RegExp("rgba"+Ae),hsl:new RegExp("hsl"+fe),hsla:new RegExp("hsla"+Ae),hsv:new RegExp("hsv"+fe),hsva:new RegExp("hsva"+Ae),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function de(J){return!!ae.CSS_UNIT.exec(J)}function ne(J){J=J.replace(O,"").replace(Z,"").toLowerCase();var ee=!1;if(D[J])J=D[J],ee=!0;else if(J=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ie;return(ie=ae.rgb.exec(J))?{r:ie[1],g:ie[2],b:ie[3]}:(ie=ae.rgba.exec(J))?{r:ie[1],g:ie[2],b:ie[3],a:ie[4]}:(ie=ae.hsl.exec(J))?{h:ie[1],s:ie[2],l:ie[3]}:(ie=ae.hsla.exec(J))?{h:ie[1],s:ie[2],l:ie[3],a:ie[4]}:(ie=ae.hsv.exec(J))?{h:ie[1],s:ie[2],v:ie[3]}:(ie=ae.hsva.exec(J))?{h:ie[1],s:ie[2],v:ie[3],a:ie[4]}:(ie=ae.hex8.exec(J))?{r:Y(ie[1]),g:Y(ie[2]),b:Y(ie[3]),a:ce(ie[4]),format:ee?"name":"hex8"}:(ie=ae.hex6.exec(J))?{r:Y(ie[1]),g:Y(ie[2]),b:Y(ie[3]),format:ee?"name":"hex"}:(ie=ae.hex4.exec(J))?{r:Y(ie[1]+""+ie[1]),g:Y(ie[2]+""+ie[2]),b:Y(ie[3]+""+ie[3]),a:ce(ie[4]+""+ie[4]),format:ee?"name":"hex8"}:(ie=ae.hex3.exec(J))?{r:Y(ie[1]+""+ie[1]),g:Y(ie[2]+""+ie[2]),b:Y(ie[3]+""+ie[3]),format:ee?"name":"hex"}:!1}function se(J){var ee,ie;return J=J||{level:"AA",size:"small"},ee=(J.level||"AA").toUpperCase(),ie=(J.size||"small").toLowerCase(),ee!=="AA"&&ee!=="AAA"&&(ee="AA"),ie!=="small"&&ie!=="large"&&(ie="small"),{level:ee,size:ie}}Et.exports?Et.exports=R:!(he=function(){return R}.call(rt,re,rt,Et),he!==void 0&&(Et.exports=he))})(Math)},bT9E:function(Et,rt,re){"use strict";re.d(rt,"a",function(){return $});var he=re("VTBJ");function $(O,Z){var F=Object(he.a)({},O);return Array.isArray(Z)&&Z.forEach(function(I){delete F[I]}),F}},c5Ni:function(Et,rt,re){},dejd:function(Et,rt,re){},dmUQ:function(Et,rt,re){"use strict";var he=re("Ff2n"),$=re("rePB"),O=re("1OyB"),Z=re("vuIU"),F=re("Ji7U"),I=re("md7G"),K=re("foSv"),B=re("q1tI"),P=re.n(B),R=re("TSYQ"),y=re.n(R),A=re("4IlW");function _(s,a){var T=Object.keys(s);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(s);a&&(m=m.filter(function(x){return Object.getOwnPropertyDescriptor(s,x).enumerable})),T.push.apply(T,m)}return T}function k(s){for(var a=1;a<arguments.length;a++){var T=arguments[a]!=null?arguments[a]:{};a%2?_(Object(T),!0).forEach(function(m){Object($.a)(s,m,T[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(T)):_(Object(T)).forEach(function(m){Object.defineProperty(s,m,Object.getOwnPropertyDescriptor(T,m))})}return s}function C(s){var a=E();return function(){var m=Object(K.a)(s),x;if(a){var D=Object(K.a)(this).constructor;x=Reflect.construct(m,arguments,D)}else x=m.apply(this,arguments);return Object(I.a)(this,x)}}function E(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(s){return!1}}function h(){}function o(s){s.preventDefault()}var l=function(a){return a.replace(/[^\w.-]+/g,"")},d=200,S=600,v=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,p=function(a){return a!=null},w=function(a,T){return T===a||typeof T=="number"&&typeof a=="number"&&isNaN(T)&&isNaN(a)},b=function(s){Object(F.a)(T,s);var a=C(T);function T(m){var x;Object(O.a)(this,T),x=a.call(this,m),x.onKeyDown=function(z){var V=x.props,M=V.onKeyDown,N=V.onPressEnter;if(z.keyCode===A.a.UP){var Y=x.getRatio(z);x.up(z,Y,null),x.stop()}else if(z.keyCode===A.a.DOWN){var oe=x.getRatio(z);x.down(z,oe,null),x.stop()}else z.keyCode===A.a.ENTER&&N&&N(z);if(x.recordCursorPosition(),x.lastKeyCode=z.keyCode,M){for(var pe=arguments.length,ve=new Array(pe>1?pe-1:0),Le=1;Le<pe;Le++)ve[Le-1]=arguments[Le];M.apply(void 0,[z].concat(ve))}},x.onKeyUp=function(z){var V=x.props.onKeyUp;if(x.stop(),x.recordCursorPosition(),V){for(var M=arguments.length,N=new Array(M>1?M-1:0),Y=1;Y<M;Y++)N[Y-1]=arguments[Y];V.apply(void 0,[z].concat(N))}},x.onChange=function(z){var V=x.props.onChange;x.state.focused&&(x.inputting=!0),x.rawInput=x.props.parser(x.getValueFromEvent(z)),x.setState({inputValue:x.rawInput}),V(x.toNumber(x.rawInput))},x.onMouseUp=function(){var z=x.props.onMouseUp;x.recordCursorPosition(),z&&z.apply(void 0,arguments)},x.onFocus=function(){var z;x.setState({focused:!0}),(z=x.props).onFocus.apply(z,arguments)},x.onBlur=function(){var z=x.props.onBlur;x.inputting=!1,x.setState({focused:!1});var V=x.getCurrentValidValue(x.state.inputValue),M=x.setValue(V,h);if(z){var N=x.input.value,Y=x.getInputDisplayValue({focus:!1,value:M});x.input.value=Y&&Number(Y),z.apply(void 0,arguments),x.input.value=N}},x.getRatio=function(z){var V=1;return z.metaKey||z.ctrlKey?V=.1:z.shiftKey&&(V=10),V},x.getFullNum=function(z){return isNaN(z)?z:/e/i.test(String(z))?Number(z).toFixed(18).replace(/\.?0+$/,""):z},x.getPrecision=function(z){if(p(x.props.precision))return x.props.precision;var V=String(z);if(V.indexOf("e-")>=0)return parseInt(V.slice(V.indexOf("e-")+2),10);var M=0;return V.indexOf(".")>=0&&(M=V.length-V.indexOf(".")-1),M},x.getInputDisplayValue=function(z){var V=z||x.state,M=V.focused,N=V.inputValue,Y=V.value,oe;M?oe=N:oe=x.toPrecisionAsStep(Y),oe==null&&(oe="");var pe=x.formatWrapper(oe);return p(x.props.decimalSeparator)&&(pe=pe.toString().replace(".",x.props.decimalSeparator)),pe},x.recordCursorPosition=function(){try{x.cursorStart=x.input.selectionStart,x.cursorEnd=x.input.selectionEnd,x.currentValue=x.input.value,x.cursorBefore=x.input.value.substring(0,x.cursorStart),x.cursorAfter=x.input.value.substring(x.cursorEnd)}catch(z){}},x.restoreByAfter=function(z){if(z===void 0)return!1;var V=x.input.value,M=V.lastIndexOf(z);if(M===-1)return!1;var N=x.cursorBefore.length;return x.lastKeyCode===A.a.DELETE&&x.cursorBefore.charAt(N-1)===z[0]?(x.fixCaret(N,N),!0):M+z.length===V.length?(x.fixCaret(M,M),!0):!1},x.partRestoreByAfter=function(z){return z===void 0?!1:Array.prototype.some.call(z,function(V,M){var N=z.substring(M);return x.restoreByAfter(N)})},x.isNotCompleteNumber=function(z){return isNaN(z)||z===""||z===null||z&&z.toString().indexOf(".")===z.toString().length-1},x.stop=function(){x.autoStepTimer&&clearTimeout(x.autoStepTimer)},x.down=function(z,V,M){x.pressingUpOrDown=!0,x.step("down",z,V,M)},x.up=function(z,V,M){x.pressingUpOrDown=!0,x.step("up",z,V,M)},x.saveInput=function(z){x.input=z};var D=m.value;D===void 0&&(D=m.defaultValue),x.state={focused:m.autoFocus};var j=x.getValidValue(x.toNumber(D));return x.state=k(k({},x.state),{},{inputValue:x.toPrecisionAsStep(j),value:j}),x}return Object(Z.a)(T,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(x){var D=this.props,j=D.value,z=D.onChange,V=D.max,M=D.min,N=this.state.focused;if(x){if(!w(x.value,j)||!w(x.max,V)||!w(x.min,M)){var Y=N?j:this.getValidValue(j),oe;this.pressingUpOrDown?oe=Y:this.inputting?oe=this.rawInput:oe=this.toPrecisionAsStep(Y),this.setState({value:Y,inputValue:oe})}var pe="value"in this.props?j:this.state.value;"max"in this.props&&x.max!==V&&typeof pe=="number"&&pe>V&&z&&z(V),"min"in this.props&&x.min!==M&&typeof pe=="number"&&pe<M&&z&&z(M)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ve=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===A.a.BACKSPACE?ve=this.cursorStart-1:this.lastKeyCode===A.a.DELETE&&(ve=this.cursorStart):ve=this.input.value.length,this.fixCaret(ve,ve)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case A.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case A.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Le){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(x){var D=x;return D===""?D="":this.isNotCompleteNumber(parseFloat(D))?D=this.state.value:D=this.getValidValue(D),this.toNumber(D)}},{key:"getValueFromEvent",value:function(x){var D=x.target.value.trim().replace(/。/g,".");return p(this.props.decimalSeparator)&&(D=D.replace(this.props.decimalSeparator,".")),D}},{key:"getValidValue",value:function(x){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,z=parseFloat(x);return isNaN(z)?x:(z<D&&(z=D),z>j&&(z=j),z)}},{key:"setValue",value:function(x,D){var j=this.props.precision,z=this.isNotCompleteNumber(parseFloat(x))?null:parseFloat(x),V=this.state.value,M=V===void 0?null:V,N=this.state.inputValue,Y=N===void 0?null:N,oe=typeof z=="number"?z.toFixed(j):"".concat(z),pe=z!==M||oe!=="".concat(Y);return"value"in this.props?(Y=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:Y},D)):this.setState({value:z,inputValue:this.toPrecisionAsStep(x)},D),pe&&this.props.onChange(z),z}},{key:"getMaxPrecision",value:function(x){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,j=this.props,z=j.precision,V=j.step;if(p(z))return z;var M=this.getPrecision(D),N=this.getPrecision(V),Y=this.getPrecision(x);return x?Math.max(Y,M+N):M+N}},{key:"getPrecisionFactor",value:function(x){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,j=this.getMaxPrecision(x,D);return Math.pow(10,j)}},{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(x){return this.props.formatter?this.props.formatter(x):x}},{key:"toPrecisionAsStep",value:function(x){if(this.isNotCompleteNumber(x)||x==="")return x;var D=Math.abs(this.getMaxPrecision(x));return isNaN(D)?x.toString():Number(x).toFixed(D)}},{key:"toNumber",value:function(x){var D=this.props.precision,j=this.state.focused,z=x&&x.length>16&&j;return this.isNotCompleteNumber(x)||z?x:p(D)?Math.round(x*Math.pow(10,D))/Math.pow(10,D):Number(x)}},{key:"upStep",value:function(x,D){var j=this.props.step,z=this.getPrecisionFactor(x,D),V=Math.abs(this.getMaxPrecision(x,D)),M=((z*x+z*j*D)/z).toFixed(V);return this.toNumber(M)}},{key:"downStep",value:function(x,D){var j=this.props.step,z=this.getPrecisionFactor(x,D),V=Math.abs(this.getMaxPrecision(x,D)),M=((z*x-z*j*D)/z).toFixed(V);return this.toNumber(M)}},{key:"step",value:function(x,D){var j=this,z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),D&&(D.persist(),D.preventDefault());var M=this.props;if(M.disabled)return;var N=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(N))return;var Y=this["".concat(x,"Step")](N,z),oe=Y>M.max||Y<M.min;if(Y>M.max?Y=M.max:Y<M.min&&(Y=M.min),this.setValue(Y,null),this.setState({focused:!0},function(){j.pressingUpOrDown=!1}),oe)return;this.autoStepTimer=setTimeout(function(){j[x](D,z,!0)},V?d:S)}},{key:"fixCaret",value:function(x,D){if(x===void 0||D===void 0||!this.input||!this.input.value)return;try{var j=this.input.selectionStart,z=this.input.selectionEnd;(x!==j||D!==z)&&this.input.setSelectionRange(x,D)}catch(V){}}},{key:"render",value:function(){var x,D=this.props,j=D.prefixCls,z=D.disabled,V=D.readOnly,M=D.useTouch,N=D.autoComplete,Y=D.upHandler,oe=D.downHandler,pe=D.className,ve=D.max,Le=D.min,ke=D.style,ce=D.title,ae=D.onMouseEnter,de=D.onMouseLeave,ne=D.onMouseOver,se=D.onMouseOut,J=D.required,ee=D.onClick,ie=D.tabIndex,fe=D.type,Ae=D.placeholder,ge=D.id,Oe=D.inputMode,Pe=D.pattern,je=D.step,Ke=D.maxLength,He=D.autoFocus,Fe=D.name,qe=D.onPaste,De=D.onInput,Ne=Object(he.a)(D,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Be=this.state,ze=Be.value,Ge=Be.focused,Ve=y()(j,(x={},Object($.a)(x,pe,!!pe),Object($.a)(x,"".concat(j,"-disabled"),z),Object($.a)(x,"".concat(j,"-focused"),Ge),x)),Re={};Object.keys(Ne).forEach(function(Ee){(Ee.substr(0,5)==="data-"||Ee.substr(0,5)==="aria-"||Ee==="role")&&(Re[Ee]=Ne[Ee])});var Qe=!V&&!z,$e=this.getInputDisplayValue(null),Me=(ze||ze===0)&&(isNaN(ze)||Number(ze)>=ve),We=(ze||ze===0)&&(isNaN(ze)||Number(ze)<=Le),Se=Me||z||V,ye=We||z||V,xe=y()("".concat(j,"-handler"),"".concat(j,"-handler-up"),Object($.a)({},"".concat(j,"-handler-up-disabled"),Se)),le=y()("".concat(j,"-handler"),"".concat(j,"-handler-down"),Object($.a)({},"".concat(j,"-handler-down-disabled"),ye)),ue=M?{onTouchStart:Se?h:this.up,onTouchEnd:this.stop}:{onMouseDown:Se?h:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},me=M?{onTouchStart:ye?h:this.down,onTouchEnd:this.stop}:{onMouseDown:ye?h:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return P.a.createElement("div",{className:Ve,style:ke,title:ce,onMouseEnter:ae,onMouseLeave:de,onMouseOver:ne,onMouseOut:se,onFocus:function(){return null},onBlur:function(){return null}},P.a.createElement("div",{className:"".concat(j,"-handler-wrap")},P.a.createElement("span",Object.assign({unselectable:"on"},ue,{role:"button","aria-label":"Increase Value","aria-disabled":Se,className:xe}),Y||P.a.createElement("span",{unselectable:"on",className:"".concat(j,"-handler-up-inner"),onClick:o})),P.a.createElement("span",Object.assign({unselectable:"on"},me,{role:"button","aria-label":"Decrease Value","aria-disabled":ye,className:le}),oe||P.a.createElement("span",{unselectable:"on",className:"".concat(j,"-handler-down-inner"),onClick:o}))),P.a.createElement("div",{className:"".concat(j,"-input-wrap")},P.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Le,"aria-valuemax":ve,"aria-valuenow":ze,required:J,type:fe,placeholder:Ae,onPaste:qe,onClick:ee,onMouseUp:this.onMouseUp,className:"".concat(j,"-input"),tabIndex:ie,autoComplete:N,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Qe?this.onKeyDown:h,onKeyUp:Qe?this.onKeyUp:h,autoFocus:He,maxLength:Ke,readOnly:V,disabled:z,max:ve,min:Le,step:je,name:Fe,title:ce,id:ge,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum($e),pattern:Pe,inputMode:Oe,onInput:De},Re))))}}]),T}(P.a.Component);b.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:v,min:-v,step:1,style:{},onChange:h,onKeyDown:h,onPressEnter:h,onFocus:h,onBlur:h,parser:l,required:!1,autoComplete:"off"};var u=b,f=rt.a=u},fAei:function(Et,rt,re){"use strict";re.d(rt,"a",function(){return d.a});var he=re("rePB"),$=re("VTBJ"),O=re("KQm4"),Z=re("1OyB"),F=re("vuIU"),I=re("Ji7U"),K=re("LK+K"),B=re("q1tI"),P=re("4IlW"),R=re("Kwbf"),y=re("TSYQ"),A=re.n(y),_=re("sboe"),k=re("OZM5"),C=re("815F"),E=re("ODXe"),h=re("Ff2n"),o=re("+nKL"),l=re("8XRh"),d=re("WaYH"),S=function(Le,ke){var ce=Le.className,ae=Le.style,de=Le.motion,ne=Le.motionNodes,se=Le.motionType,J=Le.onMotionStart,ee=Le.onMotionEnd,ie=Le.active,fe=Le.treeNodeRequiredProps,Ae=Object(h.a)(Le,["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"]),ge=B.useState(!0),Oe=Object(E.a)(ge,2),Pe=Oe[0],je=Oe[1],Ke=B.useContext(_.a),He=Ke.prefixCls,Fe=B.useRef(!1),qe=function(){Fe.current||ee(),Fe.current=!0};return Object(B.useEffect)(function(){ne&&se==="hide"&&Pe&&je(!1)},[ne]),Object(B.useEffect)(function(){return ne&&J(),function(){ne&&qe()}},[]),ne?B.createElement(l.default,Object.assign({ref:ke,visible:Pe},de,{motionAppear:se==="show",onAppearEnd:qe,onLeaveEnd:qe}),function(De,Ne){var Be=De.className,ze=De.style;return B.createElement("div",{ref:Ne,className:A()("".concat(He,"-treenode-motion"),Be),style:ze},ne.map(function(Ge){var Ve=Ge.data,Re=Ve.key,Qe=Object(h.a)(Ve,["key"]),$e=Ge.isStart,Me=Ge.isEnd;delete Qe.children;var We=Object(C.f)(Re,fe);return B.createElement(d.a,Object.assign({},Qe,We,{active:ie,data:Ge.data,key:Re,isStart:$e,isEnd:Me}))}))}):B.createElement(d.a,Object.assign({domRef:ke,className:ce,style:ae},Ae,{active:ie}))};S.displayName="MotionTreeNode";var v=B.forwardRef(S),p=v;function w(){var ve=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],ke=ve.length,ce=Le.length;if(Math.abs(ke-ce)!==1)return{add:!1,key:null};function ae(de,ne){var se=new Map;de.forEach(function(ee){se.set(ee,!0)});var J=ne.filter(function(ee){return!se.has(ee)});return J.length===1?J[0]:null}return ke<ce?{add:!0,key:ae(ve,Le)}:{add:!1,key:ae(Le,ve)}}function b(ve,Le,ke){var ce=ve.findIndex(function(se){var J=se.data;return J.key===ke}),ae=ve[ce+1],de=Le.findIndex(function(se){var J=se.data;return J.key===ke});if(ae){var ne=Le.findIndex(function(se){var J=se.data;return J.key===ae.data.key});return Le.slice(de+1,ne)}return Le.slice(de+1)}var u={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},f=function(){},s="RC_TREE_MOTION_".concat(Math.random()),a={key:s},T={key:s,level:0,index:0,pos:"0",node:a},m={parent:null,children:[],pos:T.pos,data:a,isStart:[],isEnd:[]};function x(ve,Le,ke,ce){return Le===!1||!ke?ve:ve.slice(0,Math.ceil(ke/ce)+1)}function D(ve){var Le=ve.data.key,ke=ve.pos;return Object(C.e)(Le,ke)}function j(ve){for(var Le=String(ve.data.key),ke=ve;ke.parent;)ke=ke.parent,Le="".concat(ke.data.key," > ").concat(Le);return Le}var z=function(Le,ke){var ce=Le.prefixCls,ae=Le.data,de=Le.selectable,ne=Le.checkable,se=Le.expandedKeys,J=Le.selectedKeys,ee=Le.checkedKeys,ie=Le.loadedKeys,fe=Le.loadingKeys,Ae=Le.halfCheckedKeys,ge=Le.keyEntities,Oe=Le.disabled,Pe=Le.dragging,je=Le.dragOverNodeKey,Ke=Le.dropPosition,He=Le.motion,Fe=Le.height,qe=Le.itemHeight,De=Le.virtual,Ne=Le.focusable,Be=Le.activeItem,ze=Le.focused,Ge=Le.tabIndex,Ve=Le.onKeyDown,Re=Le.onFocus,Qe=Le.onBlur,$e=Le.onActiveChange,Me=Le.onListChangeStart,We=Le.onListChangeEnd,Se=Object(h.a)(Le,["prefixCls","data","selectable","checkable","expandedKeys","selectedKeys","checkedKeys","loadedKeys","loadingKeys","halfCheckedKeys","keyEntities","disabled","dragging","dragOverNodeKey","dropPosition","motion","height","itemHeight","virtual","focusable","activeItem","focused","tabIndex","onKeyDown","onFocus","onBlur","onActiveChange","onListChangeStart","onListChangeEnd"]),ye=B.useRef(null);B.useImperativeHandle(ke,function(){return{scrollTo:function(tr){ye.current.scrollTo(tr)}}});var xe=B.useState(se),le=Object(E.a)(xe,2),ue=le[0],me=le[1],Ee=B.useState(ae),we=Object(E.a)(Ee,2),Ie=we[0],Ze=we[1],at=B.useState(ae),ht=Object(E.a)(at,2),ut=ht[0],xt=ht[1],Ct=B.useState([]),st=Object(E.a)(Ct,2),Mt=st[0],Lt=st[1],kt=B.useState(null),Dt=Object(E.a)(kt,2),Tt=Dt[0],Bt=Dt[1];function Qt(){Ze(ae),xt(ae),Lt([]),Bt(null),We()}B.useEffect(function(){me(se);var jt=w(ue,se);if(jt.key!==null)if(jt.add){var tr=Ie.findIndex(function(sr){var Tr=sr.data.key;return Tr===jt.key}),ur=x(b(Ie,ae,jt.key),De,Fe,qe),nr=Ie.slice();nr.splice(tr+1,0,m),xt(nr),Lt(ur),Bt("show")}else{var vr=ae.findIndex(function(sr){var Tr=sr.data.key;return Tr===jt.key}),Ut=x(b(ae,Ie,jt.key),De,Fe,qe),ft=ae.slice();ft.splice(vr+1,0,m),xt(ft),Lt(Ut),Bt("hide")}else Ie!==ae&&(Ze(ae),xt(ae))},[se,ae]),B.useEffect(function(){Pe||Qt()},[Pe]);var yt=He?ut:ae,pr={expandedKeys:se,selectedKeys:J,loadedKeys:ie,loadingKeys:fe,checkedKeys:ee,halfCheckedKeys:Ae,dragOverNodeKey:je,dropPosition:Ke,keyEntities:ge};return B.createElement(B.Fragment,null,ze&&Be&&B.createElement("span",{style:u,"aria-live":"assertive"},j(Be)),B.createElement("div",{role:"tree"},B.createElement("input",{style:u,disabled:Ne===!1||Oe,tabIndex:Ne!==!1?Ge:null,onKeyDown:Ve,onFocus:Re,onBlur:Qe,value:"",onChange:f})),B.createElement(o.a,Object.assign({},Se,{data:yt,itemKey:D,height:Fe,fullHeight:!1,virtual:De,itemHeight:qe,prefixCls:"".concat(ce,"-list"),ref:ye}),function(jt){var tr=jt.pos,ur=jt.data,nr=ur.key,vr=Object(h.a)(ur,["key"]),Ut=jt.isStart,ft=jt.isEnd,sr=Object(C.e)(nr,tr);delete vr.children;var Tr=Object(C.f)(sr,pr);return B.createElement(p,Object.assign({},vr,Tr,{active:Be&&nr===Be.data.key,pos:tr,data:jt.data,isStart:Ut,isEnd:ft,motion:He,motionNodes:nr===s?Mt:null,motionType:Tt,onMotionStart:Me,onMotionEnd:Qt,treeNodeRequiredProps:pr,onMouseMove:function(){$e(null)}}))}))},V=B.forwardRef(z);V.displayName="NodeList";var M=V,N=re("NvD2"),Y=function(ve){Object(I.a)(ke,ve);var Le=Object(K.a)(ke);function ke(){var ce;return Object(Z.a)(this,ke),ce=Le.apply(this,arguments),ce.destroyed=!1,ce.state={keyEntities:{},selectedKeys:[],checkedKeys:[],halfCheckedKeys:[],loadedKeys:[],loadingKeys:[],expandedKeys:[],dragging:!1,dragNodesKeys:[],dragOverNodeKey:null,dropPosition:null,treeData:[],flattenNodes:[],focused:!1,activeKey:null,listChanging:!1,prevProps:null},ce.listRef=B.createRef(),ce.onNodeDragStart=function(ae,de){var ne=ce.state,se=ne.expandedKeys,J=ne.keyEntities,ee=ce.props.onDragStart,ie=de.props.eventKey;ce.dragNode=de;var fe=Object(k.b)(se,ie);ce.setState({dragging:!0,dragNodesKeys:Object(k.g)(ie,J)}),ce.setExpandedKeys(fe),ee&&ee({event:ae,node:Object(C.b)(de.props)})},ce.onNodeDragEnter=function(ae,de){var ne=ce.state,se=ne.expandedKeys,J=ne.keyEntities,ee=ne.dragNodesKeys,ie=ce.props.onDragEnter,fe=de.props,Ae=fe.pos,ge=fe.eventKey;if(!ce.dragNode||ee.indexOf(ge)!==-1)return;var Oe=Object(k.c)(ae,de);if(ce.dragNode.props.eventKey===ge&&Oe===0){ce.setState({dragOverNodeKey:"",dropPosition:null});return}setTimeout(function(){ce.setState({dragOverNodeKey:ge,dropPosition:Oe}),ce.delayedDragEnterLogic||(ce.delayedDragEnterLogic={}),Object.keys(ce.delayedDragEnterLogic).forEach(function(Pe){clearTimeout(ce.delayedDragEnterLogic[Pe])}),ce.delayedDragEnterLogic[Ae]=window.setTimeout(function(){if(!ce.state.dragging)return;var Pe=Object(O.a)(se),je=J[ge];je&&(je.children||[]).length&&(Pe=Object(k.a)(se,ge)),"expandedKeys"in ce.props||ce.setExpandedKeys(Pe),ie&&ie({event:ae,node:Object(C.b)(de.props),expandedKeys:Pe})},400)},0)},ce.onNodeDragOver=function(ae,de){var ne=ce.state.dragNodesKeys,se=ce.props.onDragOver,J=de.props.eventKey;if(ne.indexOf(J)!==-1)return;if(ce.dragNode&&J===ce.state.dragOverNodeKey){var ee=Object(k.c)(ae,de);if(ee===ce.state.dropPosition)return;ce.setState({dropPosition:ee})}se&&se({event:ae,node:Object(C.b)(de.props)})},ce.onNodeDragLeave=function(ae,de){var ne=ce.props.onDragLeave;ce.setState({dragOverNodeKey:""}),ne&&ne({event:ae,node:Object(C.b)(de.props)})},ce.onNodeDragEnd=function(ae,de){var ne=ce.props.onDragEnd;ce.setState({dragOverNodeKey:""}),ce.cleanDragState(),ne&&ne({event:ae,node:Object(C.b)(de.props)}),ce.dragNode=null},ce.onNodeDrop=function(ae,de){var ne=ce.state,se=ne.dragNodesKeys,J=se===void 0?[]:se,ee=ne.dropPosition,ie=ce.props.onDrop,fe=de.props,Ae=fe.eventKey,ge=fe.pos;if(ce.setState({dragOverNodeKey:""}),ce.cleanDragState(),J.indexOf(Ae)!==-1){Object(R.a)(!1,"Can not drop to dragNode(include it's children node)");return}var Oe=Object(k.k)(ge),Pe={event:ae,node:Object(C.b)(de.props),dragNode:ce.dragNode?Object(C.b)(ce.dragNode.props):null,dragNodesKeys:J.slice(),dropPosition:ee+Number(Oe[Oe.length-1]),dropToGap:!1};ee!==0&&(Pe.dropToGap=!0),ie&&ie(Pe),ce.dragNode=null},ce.cleanDragState=function(){var ae=ce.state.dragging;ae&&ce.setState({dragging:!1})},ce.onNodeClick=function(ae,de){var ne=ce.props.onClick;ne&&ne(ae,de)},ce.onNodeDoubleClick=function(ae,de){var ne=ce.props.onDoubleClick;ne&&ne(ae,de)},ce.onNodeSelect=function(ae,de){var ne=ce.state.selectedKeys,se=ce.state.keyEntities,J=ce.props,ee=J.onSelect,ie=J.multiple,fe=de.selected,Ae=de.key,ge=!fe;ge?ie?ne=Object(k.a)(ne,Ae):ne=[Ae]:ne=Object(k.b)(ne,Ae);var Oe=ne.map(function(Pe){var je=se[Pe];return je?je.node:null}).filter(function(Pe){return Pe});ce.setUncontrolledState({selectedKeys:ne}),ee&&ee(ne,{event:"select",selected:ge,node:de,selectedNodes:Oe,nativeEvent:ae.nativeEvent})},ce.onNodeCheck=function(ae,de,ne){var se=ce.state,J=se.keyEntities,ee=se.checkedKeys,ie=se.halfCheckedKeys,fe=ce.props,Ae=fe.checkStrictly,ge=fe.onCheck,Oe=de.key,Pe,je={event:"check",node:de,checked:ne,nativeEvent:ae.nativeEvent};if(Ae){var Ke=ne?Object(k.a)(ee,Oe):Object(k.b)(ee,Oe),He=Object(k.b)(ie,Oe);Pe={checked:Ke,halfChecked:He},je.checkedNodes=Ke.map(function(ze){return J[ze]}).filter(function(ze){return ze}).map(function(ze){return ze.node}),ce.setUncontrolledState({checkedKeys:Ke})}else{var Fe=Object(N.a)([].concat(Object(O.a)(ee),[Oe]),!0,J),qe=Fe.checkedKeys,De=Fe.halfCheckedKeys;if(!ne){var Ne=new Set(qe);Ne.delete(Oe);var Be=Object(N.a)(Array.from(Ne),{checked:!1,halfCheckedKeys:De},J);qe=Be.checkedKeys,De=Be.halfCheckedKeys}Pe=qe,je.checkedNodes=[],je.checkedNodesPositions=[],je.halfCheckedKeys=De,qe.forEach(function(ze){var Ge=J[ze];if(!Ge)return;var Ve=Ge.node,Re=Ge.pos;je.checkedNodes.push(Ve),je.checkedNodesPositions.push({node:Ve,pos:Re})}),ce.setUncontrolledState({checkedKeys:qe},!1,{halfCheckedKeys:De})}ge&&ge(Pe,je)},ce.onNodeLoad=function(ae){return new Promise(function(de){ce.setState(function(ne){var se=ne.loadedKeys,J=se===void 0?[]:se,ee=ne.loadingKeys,ie=ee===void 0?[]:ee,fe=ce.props,Ae=fe.loadData,ge=fe.onLoad,Oe=ae.key;if(!Ae||J.indexOf(Oe)!==-1||ie.indexOf(Oe)!==-1)return{};var Pe=Ae(ae);return Pe.then(function(){var je=ce.state,Ke=je.loadedKeys,He=je.loadingKeys,Fe=Object(k.a)(Ke,Oe),qe=Object(k.b)(He,Oe);ge&&ge(Fe,{event:"load",node:ae}),ce.setUncontrolledState({loadedKeys:Fe}),ce.setState({loadingKeys:qe}),de()}),{loadingKeys:Object(k.a)(ie,Oe)}})})},ce.onNodeMouseEnter=function(ae,de){var ne=ce.props.onMouseEnter;ne&&ne({event:ae,node:de})},ce.onNodeMouseLeave=function(ae,de){var ne=ce.props.onMouseLeave;ne&&ne({event:ae,node:de})},ce.onNodeContextMenu=function(ae,de){var ne=ce.props.onRightClick;ne&&(ae.preventDefault(),ne({event:ae,node:de}))},ce.onFocus=function(){var ae=ce.props.onFocus;ce.setState({focused:!0}),ae&&ae.apply(void 0,arguments)},ce.onBlur=function(){var ae=ce.props.onBlur;ce.setState({focused:!1}),ce.onActiveChange(null),ae&&ae.apply(void 0,arguments)},ce.getTreeNodeRequiredProps=function(){var ae=ce.state,de=ae.expandedKeys,ne=ae.selectedKeys,se=ae.loadedKeys,J=ae.loadingKeys,ee=ae.checkedKeys,ie=ae.halfCheckedKeys,fe=ae.dragOverNodeKey,Ae=ae.dropPosition,ge=ae.keyEntities;return{expandedKeys:de||[],selectedKeys:ne||[],loadedKeys:se||[],loadingKeys:J||[],checkedKeys:ee||[],halfCheckedKeys:ie||[],dragOverNodeKey:fe,dropPosition:Ae,keyEntities:ge}},ce.setExpandedKeys=function(ae){var de=ce.state.treeData,ne=Object(C.d)(de,ae);ce.setUncontrolledState({expandedKeys:ae,flattenNodes:ne},!0)},ce.onNodeExpand=function(ae,de){var ne=ce.state.expandedKeys,se=ce.state.listChanging,J=ce.props,ee=J.onExpand,ie=J.loadData,fe=de.key,Ae=de.expanded;if(se)return;var ge=ne.indexOf(fe),Oe=!Ae;if(Object(R.a)(Ae&&ge!==-1||!Ae&&ge===-1,"Expand state not sync with index check"),Oe?ne=Object(k.a)(ne,fe):ne=Object(k.b)(ne,fe),ce.setExpandedKeys(ne),ee&&ee(ne,{node:de,expanded:Oe,nativeEvent:ae.nativeEvent}),Oe&&ie){var Pe=ce.onNodeLoad(de);Pe&&Pe.then(function(){var je=Object(C.d)(ce.state.treeData,ne);ce.setUncontrolledState({flattenNodes:je})})}},ce.onListChangeStart=function(){ce.setUncontrolledState({listChanging:!0})},ce.onListChangeEnd=function(){setTimeout(function(){ce.setUncontrolledState({listChanging:!1})})},ce.onActiveChange=function(ae){var de=ce.state.activeKey,ne=ce.props.onActiveChange;if(de===ae)return;ce.setState({activeKey:ae}),ae!==null&&ce.scrollTo({key:ae}),ne&&ne(ae)},ce.getActiveItem=function(){var ae=ce.state,de=ae.activeKey,ne=ae.flattenNodes;return de===null?null:ne.find(function(se){var J=se.data.key;return J===de})||null},ce.offsetActiveKey=function(ae){var de=ce.state,ne=de.flattenNodes,se=de.activeKey,J=ne.findIndex(function(fe){var Ae=fe.data.key;return Ae===se});J===-1&&ae<0&&(J=ne.length),J=(J+ae+ne.length)%ne.length;var ee=ne[J];if(ee){var ie=ee.data.key;ce.onActiveChange(ie)}else ce.onActiveChange(null)},ce.onKeyDown=function(ae){var de=ce.state,ne=de.activeKey,se=de.expandedKeys,J=de.checkedKeys,ee=ce.props,ie=ee.onKeyDown,fe=ee.checkable,Ae=ee.selectable;switch(ae.which){case P.a.UP:{ce.offsetActiveKey(-1),ae.preventDefault();break}case P.a.DOWN:{ce.offsetActiveKey(1),ae.preventDefault();break}}var ge=ce.getActiveItem();if(ge&&ge.data){var Oe=ce.getTreeNodeRequiredProps(),Pe=ge.data.isLeaf===!1||!!(ge.data.children||[]).length,je=Object(C.b)(Object($.a)(Object($.a)({},Object(C.f)(ne,Oe)),{},{data:ge.data,active:!0}));switch(ae.which){case P.a.LEFT:{Pe&&se.includes(ne)?ce.onNodeExpand({},je):ge.parent&&ce.onActiveChange(ge.parent.data.key),ae.preventDefault();break}case P.a.RIGHT:{Pe&&!se.includes(ne)?ce.onNodeExpand({},je):ge.children&&ge.children.length&&ce.onActiveChange(ge.children[0].data.key),ae.preventDefault();break}case P.a.ENTER:case P.a.SPACE:{fe&&!je.disabled&&je.checkable!==!1&&!je.disableCheckbox?ce.onNodeCheck({},je,!J.includes(ne)):!fe&&Ae&&!je.disabled&&je.selectable!==!1&&ce.onNodeSelect({},je);break}}}ie&&ie(ae)},ce.setUncontrolledState=function(ae){var de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(ce.destroyed)return;var se=!1,J=!0,ee={};Object.keys(ae).forEach(function(ie){if(ie in ce.props){J=!1;return}se=!0,ee[ie]=ae[ie]}),se&&(!de||J)&&ce.setState(Object($.a)(Object($.a)({},ee),ne))},ce.scrollTo=function(ae){ce.listRef.current.scrollTo(ae)},ce}return Object(F.a)(ke,[{key:"componentWillUnmount",value:function(){this.destroyed=!0}},{key:"render",value:function(){var ae,de=this.state,ne=de.focused,se=de.flattenNodes,J=de.keyEntities,ee=de.dragging,ie=de.activeKey,fe=this.props,Ae=fe.prefixCls,ge=fe.className,Oe=fe.style,Pe=fe.showLine,je=fe.focusable,Ke=fe.tabIndex,He=Ke===void 0?0:Ke,Fe=fe.selectable,qe=fe.showIcon,De=fe.icon,Ne=fe.switcherIcon,Be=fe.draggable,ze=fe.checkable,Ge=fe.checkStrictly,Ve=fe.disabled,Re=fe.motion,Qe=fe.loadData,$e=fe.filterTreeNode,Me=fe.height,We=fe.itemHeight,Se=fe.virtual,ye=fe.titleRender,xe=fe.onContextMenu,le=Object(k.f)(this.props);return B.createElement(_.a.Provider,{value:{prefixCls:Ae,selectable:Fe,showIcon:qe,icon:De,switcherIcon:Ne,draggable:Be,checkable:ze,checkStrictly:Ge,disabled:Ve,keyEntities:J,loadData:Qe,filterTreeNode:$e,titleRender:ye,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop}},B.createElement("div",{className:A()(Ae,ge,(ae={},Object(he.a)(ae,"".concat(Ae,"-show-line"),Pe),Object(he.a)(ae,"".concat(Ae,"-focused"),ne),Object(he.a)(ae,"".concat(Ae,"-active-focused"),ie!==null),ae))},B.createElement(M,Object.assign({ref:this.listRef,prefixCls:Ae,style:Oe,data:se,disabled:Ve,selectable:Fe,checkable:!!ze,motion:Re,dragging:ee,height:Me,itemHeight:We,virtual:Se,focusable:je,focused:ne,tabIndex:He,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:xe},this.getTreeNodeRequiredProps(),le))))}}],[{key:"getDerivedStateFromProps",value:function(ae,de){var ne=de.prevProps,se={prevProps:ae};function J(De){return!ne&&De in ae||ne&&ne[De]!==ae[De]}var ee;if(J("treeData")?ee=ae.treeData:J("children")&&(Object(R.a)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),ee=Object(C.c)(ae.children)),ee){se.treeData=ee;var ie=Object(C.a)(ee);se.keyEntities=Object($.a)(Object(he.a)({},s,T),ie.keyEntities)}var fe=se.keyEntities||de.keyEntities;if(J("expandedKeys")||ne&&J("autoExpandParent"))se.expandedKeys=ae.autoExpandParent||!ne&&ae.defaultExpandParent?Object(k.e)(ae.expandedKeys,fe):ae.expandedKeys;else if(!ne&&ae.defaultExpandAll){var Ae=Object($.a)({},fe);delete Ae[s],se.expandedKeys=Object.keys(Ae).map(function(De){return Ae[De].key})}else!ne&&ae.defaultExpandedKeys&&(se.expandedKeys=ae.autoExpandParent||ae.defaultExpandParent?Object(k.e)(ae.defaultExpandedKeys,fe):ae.defaultExpandedKeys);if(se.expandedKeys||delete se.expandedKeys,ee||se.expandedKeys){var ge=Object(C.d)(ee||de.treeData,se.expandedKeys||de.expandedKeys);se.flattenNodes=ge}if(ae.selectable&&(J("selectedKeys")?se.selectedKeys=Object(k.d)(ae.selectedKeys,ae):!ne&&ae.defaultSelectedKeys&&(se.selectedKeys=Object(k.d)(ae.defaultSelectedKeys,ae))),ae.checkable){var Oe;if(J("checkedKeys")?Oe=Object(k.j)(ae.checkedKeys)||{}:!ne&&ae.defaultCheckedKeys?Oe=Object(k.j)(ae.defaultCheckedKeys)||{}:ee&&(Oe=Object(k.j)(ae.checkedKeys)||{checkedKeys:de.checkedKeys,halfCheckedKeys:de.halfCheckedKeys}),Oe){var Pe=Oe,je=Pe.checkedKeys,Ke=je===void 0?[]:je,He=Pe.halfCheckedKeys,Fe=He===void 0?[]:He;if(!ae.checkStrictly){var qe=Object(N.a)(Ke,!0,fe);Ke=qe.checkedKeys,Fe=qe.halfCheckedKeys}se.checkedKeys=Ke,se.halfCheckedKeys=Fe}}return J("loadedKeys")&&(se.loadedKeys=ae.loadedKeys),se}}]),ke}(B.Component);Y.defaultProps={prefixCls:"rc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[]},Y.TreeNode=d.a;var oe=Y,pe=rt.b=oe},gJ3r:function(Et,rt,re){"use strict";re.d(rt,"a",function(){return he});var he=[{value:"\u5317\u4EAC",label:"\u5317\u4EAC",children:[{value:"\u4E1C\u57CE",label:"\u4E1C\u57CE"},{value:"\u897F\u57CE",label:"\u897F\u57CE"},{value:"\u671D\u9633",label:"\u671D\u9633"},{value:"\u4E30\u53F0",label:"\u4E30\u53F0"},{value:"\u77F3\u666F\u5C71",label:"\u77F3\u666F\u5C71"},{value:"\u6D77\u6DC0",label:"\u6D77\u6DC0"},{value:"\u95E8\u5934\u6C9F",label:"\u95E8\u5934\u6C9F"},{value:"\u623F\u5C71",label:"\u623F\u5C71"},{value:"\u901A\u5DDE",label:"\u901A\u5DDE"},{value:"\u987A\u4E49",label:"\u987A\u4E49"},{value:"\u660C\u5E73",label:"\u660C\u5E73"},{value:"\u5927\u5174",label:"\u5927\u5174"},{value:"\u5E73\u8C37",label:"\u5E73\u8C37"},{value:"\u6000\u67D4",label:"\u6000\u67D4"},{value:"\u5BC6\u4E91",label:"\u5BC6\u4E91"},{value:"\u5EF6\u5E86",label:"\u5EF6\u5E86"}]},{value:"\u4E0A\u6D77",label:"\u4E0A\u6D77",children:[{value:"\u5D07\u660E",label:"\u5D07\u660E"},{value:"\u9EC4\u6D66",label:"\u9EC4\u6D66"},{value:"\u5362\u6E7E",label:"\u5362\u6E7E"},{value:"\u5F90\u6C47",label:"\u5F90\u6C47"},{value:"\u957F\u5B81",label:"\u957F\u5B81"},{value:"\u9759\u5B89",label:"\u9759\u5B89"},{value:"\u666E\u9640",label:"\u666E\u9640"},{value:"\u95F8\u5317",label:"\u95F8\u5317"},{value:"\u8679\u53E3",label:"\u8679\u53E3"},{value:"\u6768\u6D66",label:"\u6768\u6D66"},{value:"\u95F5\u884C",label:"\u95F5\u884C"},{value:"\u5B9D\u5C71",label:"\u5B9D\u5C71"},{value:"\u5609\u5B9A",label:"\u5609\u5B9A"},{value:"\u6D66\u4E1C",label:"\u6D66\u4E1C"},{value:"\u91D1\u5C71",label:"\u91D1\u5C71"},{value:"\u677E\u6C5F",label:"\u677E\u6C5F"},{value:"\u9752\u6D66",label:"\u9752\u6D66"},{value:"\u5357\u6C47",label:"\u5357\u6C47"},{value:"\u5949\u8D24",label:"\u5949\u8D24"}]},{value:"\u5E7F\u4E1C",label:"\u5E7F\u4E1C",children:[{value:"\u5E7F\u5DDE",label:"\u5E7F\u5DDE"},{value:"\u6DF1\u5733",label:"\u6DF1\u5733"},{value:"\u73E0\u6D77",label:"\u73E0\u6D77"},{value:"\u4E1C\u839E",label:"\u4E1C\u839E"},{value:"\u4E2D\u5C71",label:"\u4E2D\u5C71"},{value:"\u4F5B\u5C71",label:"\u4F5B\u5C71"},{value:"\u60E0\u5DDE",label:"\u60E0\u5DDE"},{value:"\u6CB3\u6E90",label:"\u6CB3\u6E90"},{value:"\u6F6E\u5DDE",label:"\u6F6E\u5DDE"},{value:"\u6C5F\u95E8",label:"\u6C5F\u95E8"},{value:"\u63ED\u9633",label:"\u63ED\u9633"},{value:"\u8302\u540D",label:"\u8302\u540D"},{value:"\u6885\u5DDE",label:"\u6885\u5DDE"},{value:"\u6E05\u8FDC",label:"\u6E05\u8FDC"},{value:"\u6C55\u5934",label:"\u6C55\u5934"},{value:"\u6C55\u5C3E",label:"\u6C55\u5C3E"},{value:"\u97F6\u5173",label:"\u97F6\u5173"},{value:"\u987A\u5FB7",label:"\u987A\u5FB7"},{value:"\u9633\u6C5F",label:"\u9633\u6C5F"},{value:"\u4E91\u6D6E",label:"\u4E91\u6D6E"},{value:"\u6E5B\u6C5F",label:"\u6E5B\u6C5F"},{value:"\u8087\u5E86",label:"\u8087\u5E86"}]},{value:"\u6C5F\u82CF",label:"\u6C5F\u82CF",children:[{value:"\u5357\u4EAC",label:"\u5357\u4EAC"},{value:"\u5E38\u719F",label:"\u5E38\u719F"},{value:"\u5E38\u5DDE",label:"\u5E38\u5DDE"},{value:"\u6D77\u95E8",label:"\u6D77\u95E8"},{value:"\u6DEE\u5B89",label:"\u6DEE\u5B89"},{value:"\u6C5F\u90FD",label:"\u6C5F\u90FD"},{value:"\u6C5F\u9634",label:"\u6C5F\u9634"},{value:"\u6606\u5C71",label:"\u6606\u5C71"},{value:"\u8FDE\u4E91\u6E2F",label:"\u8FDE\u4E91\u6E2F"},{value:"\u5357\u901A",label:"\u5357\u901A"},{value:"\u542F\u4E1C",label:"\u542F\u4E1C"},{value:"\u6CAD\u9633",label:"\u6CAD\u9633"},{value:"\u5BBF\u8FC1",label:"\u5BBF\u8FC1"},{value:"\u82CF\u5DDE",label:"\u82CF\u5DDE"},{value:"\u592A\u4ED3",label:"\u592A\u4ED3"},{value:"\u6CF0\u5DDE",label:"\u6CF0\u5DDE"},{value:"\u540C\u91CC",label:"\u540C\u91CC"},{value:"\u65E0\u9521",label:"\u65E0\u9521"},{value:"\u5F90\u5DDE",label:"\u5F90\u5DDE"},{value:"\u76D0\u57CE",label:"\u76D0\u57CE"},{value:"\u626C\u5DDE",label:"\u626C\u5DDE"},{value:"\u5B9C\u5174",label:"\u5B9C\u5174"},{value:"\u4EEA\u5F81",label:"\u4EEA\u5F81"},{value:"\u5F20\u5BB6\u6E2F",label:"\u5F20\u5BB6\u6E2F"},{value:"\u9547\u6C5F",label:"\u9547\u6C5F"}]},{value:"\u91CD\u5E86",label:"\u91CD\u5E86",children:[{value:"\u4E07\u5DDE",label:"\u4E07\u5DDE"},{value:"\u6DAA\u9675",label:"\u6DAA\u9675"},{value:"\u6E1D\u4E2D",label:"\u6E1D\u4E2D"},{value:"\u5927\u6E21\u53E3",label:"\u5927\u6E21\u53E3"},{value:"\u6C5F\u5317",label:"\u6C5F\u5317"},{value:"\u6C99\u576A\u575D",label:"\u6C99\u576A\u575D"},{value:"\u4E5D\u9F99\u5761",label:"\u4E5D\u9F99\u5761"},{value:"\u5357\u5CB8",label:"\u5357\u5CB8"},{value:"\u5317\u789A",label:"\u5317\u789A"},{value:"\u4E07\u76DB",label:"\u4E07\u76DB"},{value:"\u53CC\u6322",label:"\u53CC\u6322"},{value:"\u6E1D\u5317",label:"\u6E1D\u5317"},{value:"\u5DF4\u5357",label:"\u5DF4\u5357"},{value:"\u9ED4\u6C5F",label:"\u9ED4\u6C5F"},{value:"\u957F\u5BFF",label:"\u957F\u5BFF"},{value:"\u7DA6\u6C5F",label:"\u7DA6\u6C5F"},{value:"\u6F7C\u5357",label:"\u6F7C\u5357"},{value:"\u94DC\u6881",label:"\u94DC\u6881"},{value:"\u5927\u8DB3",label:"\u5927\u8DB3"},{value:"\u8363\u660C",label:"\u8363\u660C"},{value:"\u58C1\u5C71",label:"\u58C1\u5C71"},{value:"\u6881\u5E73",label:"\u6881\u5E73"},{value:"\u57CE\u53E3",label:"\u57CE\u53E3"},{value:"\u4E30\u90FD",label:"\u4E30\u90FD"},{value:"\u57AB\u6C5F",label:"\u57AB\u6C5F"},{value:"\u6B66\u9686",label:"\u6B66\u9686"},{value:"\u5FE0\u53BF",label:"\u5FE0\u53BF"},{value:"\u5F00\u53BF",label:"\u5F00\u53BF"},{value:"\u4E91\u9633",label:"\u4E91\u9633"},{value:"\u5949\u8282",label:"\u5949\u8282"},{value:"\u5DEB\u5C71",label:"\u5DEB\u5C71"},{value:"\u5DEB\u6EAA",label:"\u5DEB\u6EAA"},{value:"\u77F3\u67F1",label:"\u77F3\u67F1"},{value:"\u79C0\u5C71",label:"\u79C0\u5C71"},{value:"\u9149\u9633",label:"\u9149\u9633"},{value:"\u5F6D\u6C34",label:"\u5F6D\u6C34"},{value:"\u6C5F\u6D25",label:"\u6C5F\u6D25"},{value:"\u5408\u5DDD",label:"\u5408\u5DDD"},{value:"\u6C38\u5DDD",label:"\u6C38\u5DDD"},{value:"\u5357\u5DDD",label:"\u5357\u5DDD"}]},{value:"\u5B89\u5FBD",label:"\u5B89\u5FBD",children:[{value:"\u5408\u80A5",label:"\u5408\u80A5"},{value:"\u5B89\u5E86",label:"\u5B89\u5E86"},{value:"\u868C\u57E0",label:"\u868C\u57E0"},{value:"\u4EB3\u5DDE",label:"\u4EB3\u5DDE"},{value:"\u5DE2\u6E56",label:"\u5DE2\u6E56"},{value:"\u6EC1\u5DDE",label:"\u6EC1\u5DDE"},{value:"\u961C\u9633",label:"\u961C\u9633"},{value:"\u8D35\u6C60",label:"\u8D35\u6C60"},{value:"\u6DEE\u5317",label:"\u6DEE\u5317"},{value:"\u6DEE\u5316",label:"\u6DEE\u5316"},{value:"\u6DEE\u5357",label:"\u6DEE\u5357"},{value:"\u9EC4\u5C71",label:"\u9EC4\u5C71"},{value:"\u4E5D\u534E\u5C71",label:"\u4E5D\u534E\u5C71"},{value:"\u516D\u5B89",label:"\u516D\u5B89"},{value:"\u9A6C\u978D\u5C71",label:"\u9A6C\u978D\u5C71"},{value:"\u5BBF\u5DDE",label:"\u5BBF\u5DDE"},{value:"\u94DC\u9675",label:"\u94DC\u9675"},{value:"\u5C6F\u6EAA",label:"\u5C6F\u6EAA"},{value:"\u829C\u6E56",label:"\u829C\u6E56"},{value:"\u5BA3\u57CE",label:"\u5BA3\u57CE"}]},{value:"\u798F\u5EFA",label:"\u798F\u5EFA",children:[{value:"\u798F\u5DDE",label:"\u798F\u5DDE"},{value:"\u53A6\u95E8",label:"\u53A6\u95E8"},{value:"\u6CC9\u5DDE",label:"\u6CC9\u5DDE"},{value:"\u6F33\u5DDE",label:"\u6F33\u5DDE"},{value:"\u9F99\u5CA9",label:"\u9F99\u5CA9"},{value:"\u5357\u5E73",label:"\u5357\u5E73"},{value:"\u5B81\u5FB7",label:"\u5B81\u5FB7"},{value:"\u8386\u7530",label:"\u8386\u7530"},{value:"\u4E09\u660E",label:"\u4E09\u660E"}]},{value:"\u7518\u8083",label:"\u7518\u8083",children:[{value:"\u5170\u5DDE",label:"\u5170\u5DDE"},{value:"\u5609\u5CEA\u5173",label:"\u5609\u5CEA\u5173"},{value:"\u767D\u94F6",label:"\u767D\u94F6"},{value:"\u5B9A\u897F",label:"\u5B9A\u897F"},{value:"\u6566\u714C",label:"\u6566\u714C"},{value:"\u7518\u5357",label:"\u7518\u5357"},{value:"\u91D1\u660C",label:"\u91D1\u660C"},{value:"\u9152\u6CC9",label:"\u9152\u6CC9"},{value:"\u4E34\u590F",label:"\u4E34\u590F"},{value:"\u5E73\u51C9",label:"\u5E73\u51C9"},{value:"\u5929\u6C34",label:"\u5929\u6C34"},{value:"\u9647\u5357",label:"\u9647\u5357"},{value:"\u6B66\u5A01",label:"\u6B66\u5A01"},{value:"\u897F\u5CF0",label:"\u897F\u5CF0"},{value:"\u5F20\u6396",label:"\u5F20\u6396"}]},{value:"\u5E7F\u897F",label:"\u5E7F\u897F",children:[{value:"\u5357\u5B81",label:"\u5357\u5B81"},{value:"\u6765\u5BBE",label:"\u6765\u5BBE"},{value:"\u767E\u8272",label:"\u767E\u8272"},{value:"\u5317\u6D77",label:"\u5317\u6D77"},{value:"\u6842\u6797",label:"\u6842\u6797"},{value:"\u9632\u57CE\u6E2F",label:"\u9632\u57CE\u6E2F"},{value:"\u8D35\u6E2F",label:"\u8D35\u6E2F"},{value:"\u6CB3\u6C60",label:"\u6CB3\u6C60"},{value:"\u8D3A\u5DDE",label:"\u8D3A\u5DDE"},{value:"\u67F3\u5DDE",label:"\u67F3\u5DDE"},{value:"\u94A6\u5DDE",label:"\u94A6\u5DDE"},{value:"\u68A7\u5DDE",label:"\u68A7\u5DDE"},{value:"\u7389\u6797",label:"\u7389\u6797"}]},{value:"\u8D35\u5DDE",label:"\u8D35\u5DDE",children:[{value:"\u8D35\u9633",label:"\u8D35\u9633"},{value:"\u5B89\u987A",label:"\u5B89\u987A"},{value:"\u6BD5\u8282",label:"\u6BD5\u8282"},{value:"\u90FD\u5300",label:"\u90FD\u5300"},{value:"\u51EF\u91CC",label:"\u51EF\u91CC"},{value:"\u516D\u76D8\u6C34",label:"\u516D\u76D8\u6C34"},{value:"\u94DC\u4EC1",label:"\u94DC\u4EC1"},{value:"\u5174\u4E49",label:"\u5174\u4E49"},{value:"\u7389\u5C4F",label:"\u7389\u5C4F"},{value:"\u9075\u4E49",label:"\u9075\u4E49"}]},{value:"\u6D77\u5357",label:"\u6D77\u5357",children:[{value:"\u6D77\u53E3",label:"\u6D77\u53E3"},{value:"\u510B\u53BF",label:"\u510B\u53BF"},{value:"\u9675\u6C34",label:"\u9675\u6C34"},{value:"\u743C\u6D77",label:"\u743C\u6D77"},{value:"\u4E09\u4E9A",label:"\u4E09\u4E9A"},{value:"\u901A\u4EC0",label:"\u901A\u4EC0"},{value:"\u4E07\u5B81",label:"\u4E07\u5B81"}]},{value:"\u6CB3\u5317",label:"\u6CB3\u5317",children:[{value:"\u77F3\u5BB6\u5E84",label:"\u77F3\u5BB6\u5E84"},{value:"\u4FDD\u5B9A",label:"\u4FDD\u5B9A"},{value:"\u5317\u6234\u6CB3",label:"\u5317\u6234\u6CB3"},{value:"\u6CA7\u5DDE",label:"\u6CA7\u5DDE"},{value:"\u627F\u5FB7",label:"\u627F\u5FB7"},{value:"\u4E30\u6DA6",label:"\u4E30\u6DA6"},{value:"\u90AF\u90F8",label:"\u90AF\u90F8"},{value:"\u8861\u6C34",label:"\u8861\u6C34"},{value:"\u5ECA\u574A",label:"\u5ECA\u574A"},{value:"\u5357\u6234\u6CB3",label:"\u5357\u6234\u6CB3"},{value:"\u79E6\u7687\u5C9B",label:"\u79E6\u7687\u5C9B"},{value:"\u5510\u5C71",label:"\u5510\u5C71"},{value:"\u65B0\u57CE",label:"\u65B0\u57CE"},{value:"\u90A2\u53F0",label:"\u90A2\u53F0"},{value:"\u5F20\u5BB6\u53E3",label:"\u5F20\u5BB6\u53E3"}]},{value:"\u9ED1\u9F99\u6C5F",label:"\u9ED1\u9F99\u6C5F",children:[{value:"\u54C8\u5C14\u6EE8",label:"\u54C8\u5C14\u6EE8"},{value:"\u5317\u5B89",label:"\u5317\u5B89"},{value:"\u5927\u5E86",label:"\u5927\u5E86"},{value:"\u5927\u5174\u5B89\u5CAD",label:"\u5927\u5174\u5B89\u5CAD"},{value:"\u9E64\u5C97",label:"\u9E64\u5C97"},{value:"\u9ED1\u6CB3",label:"\u9ED1\u6CB3"},{value:"\u4F73\u6728\u65AF",label:"\u4F73\u6728\u65AF"},{value:"\u9E21\u897F",label:"\u9E21\u897F"},{value:"\u7261\u4E39\u6C5F",label:"\u7261\u4E39\u6C5F"},{value:"\u9F50\u9F50\u54C8\u5C14",label:"\u9F50\u9F50\u54C8\u5C14"},{value:"\u4E03\u53F0\u6CB3",label:"\u4E03\u53F0\u6CB3"},{value:"\u53CC\u9E2D\u5C71",label:"\u53CC\u9E2D\u5C71"},{value:"\u7EE5\u5316",label:"\u7EE5\u5316"},{value:"\u4F0A\u6625",label:"\u4F0A\u6625"}]},{value:"\u6CB3\u5357",label:"\u6CB3\u5357",children:[{value:"\u90D1\u5DDE",label:"\u90D1\u5DDE"},{value:"\u5B89\u9633",label:"\u5B89\u9633"},{value:"\u9E64\u58C1",label:"\u9E64\u58C1"},{value:"\u6F62\u5DDD",label:"\u6F62\u5DDD"},{value:"\u7126\u4F5C",label:"\u7126\u4F5C"},{value:"\u6D4E\u6E90",label:"\u6D4E\u6E90"},{value:"\u5F00\u5C01",label:"\u5F00\u5C01"},{value:"\u6F2F\u6CB3",label:"\u6F2F\u6CB3"},{value:"\u6D1B\u9633",label:"\u6D1B\u9633"},{value:"\u5357\u9633",label:"\u5357\u9633"},{value:"\u5E73\u9876\u5C71",label:"\u5E73\u9876\u5C71"},{value:"\u6FEE\u9633",label:"\u6FEE\u9633"},{value:"\u4E09\u95E8\u5CE1",label:"\u4E09\u95E8\u5CE1"},{value:"\u5546\u4E18",label:"\u5546\u4E18"},{value:"\u65B0\u4E61",label:"\u65B0\u4E61"},{value:"\u4FE1\u9633",label:"\u4FE1\u9633"},{value:"\u8BB8\u660C",label:"\u8BB8\u660C"},{value:"\u5468\u53E3",label:"\u5468\u53E3"},{value:"\u9A7B\u9A6C\u5E97",label:"\u9A7B\u9A6C\u5E97"}]},{value:"\u9999\u6E2F",label:"\u9999\u6E2F",children:[{value:"\u9999\u6E2F",label:"\u9999\u6E2F"},{value:"\u4E5D\u9F99",label:"\u4E5D\u9F99"},{value:"\u65B0\u754C",label:"\u65B0\u754C"}]},{value:"\u6E56\u5317",label:"\u6E56\u5317",children:[{value:"\u6B66\u6C49",label:"\u6B66\u6C49"},{value:"\u5929\u95E8",label:"\u5929\u95E8"},{value:"\u6069\u65BD",label:"\u6069\u65BD"},{value:"\u9102\u5DDE",label:"\u9102\u5DDE"},{value:"\u9EC4\u5188",label:"\u9EC4\u5188"},{value:"\u9EC4\u77F3",label:"\u9EC4\u77F3"},{value:"\u8346\u95E8",label:"\u8346\u95E8"},{value:"\u8346\u5DDE",label:"\u8346\u5DDE"},{value:"\u6F5C\u6C5F",label:"\u6F5C\u6C5F"},{value:"\u5341\u5830",label:"\u5341\u5830"},{value:"\u968F\u5DDE",label:"\u968F\u5DDE"},{value:"\u6B66\u7A74",label:"\u6B66\u7A74"},{value:"\u4ED9\u6843",label:"\u4ED9\u6843"},{value:"\u54B8\u5B81",label:"\u54B8\u5B81"},{value:"\u8944\u9633",label:"\u8944\u9633"},{value:"\u8944\u6A0A",label:"\u8944\u6A0A"},{value:"\u5B5D\u611F",label:"\u5B5D\u611F"},{value:"\u5B9C\u660C",label:"\u5B9C\u660C"}]},{value:"\u6E56\u5357",label:"\u6E56\u5357",children:[{value:"\u957F\u6C99",label:"\u957F\u6C99"},{value:"\u5E38\u5FB7",label:"\u5E38\u5FB7"},{value:"\u90F4\u5DDE",label:"\u90F4\u5DDE"},{value:"\u8861\u9633",label:"\u8861\u9633"},{value:"\u6000\u5316",label:"\u6000\u5316"},{value:"\u5409\u9996",label:"\u5409\u9996"},{value:"\u5A04\u5E95",label:"\u5A04\u5E95"},{value:"\u90B5\u9633",label:"\u90B5\u9633"},{value:"\u6E58\u6F6D",label:"\u6E58\u6F6D"},{value:"\u76CA\u9633",label:"\u76CA\u9633"},{value:"\u5CB3\u9633",label:"\u5CB3\u9633"},{value:"\u6C38\u5DDE",label:"\u6C38\u5DDE"},{value:"\u5F20\u5BB6\u754C",label:"\u5F20\u5BB6\u754C"},{value:"\u682A\u6D32",label:"\u682A\u6D32"}]},{value:"\u6C5F\u897F",label:"\u6C5F\u897F",children:[{value:"\u5357\u660C",label:"\u5357\u660C"},{value:"\u629A\u5DDE",label:"\u629A\u5DDE"},{value:"\u8D63\u5DDE",label:"\u8D63\u5DDE"},{value:"\u5409\u5B89",label:"\u5409\u5B89"},{value:"\u666F\u5FB7\u9547",label:"\u666F\u5FB7\u9547"},{value:"\u4E95\u5188\u5C71",label:"\u4E95\u5188\u5C71"},{value:"\u4E5D\u6C5F",label:"\u4E5D\u6C5F"},{value:"\u5E90\u5C71",label:"\u5E90\u5C71"},{value:"\u840D\u4E61",label:"\u840D\u4E61"},{value:"\u4E0A\u9976",label:"\u4E0A\u9976"},{value:"\u65B0\u4F59",label:"\u65B0\u4F59"},{value:"\u5B9C\u6625",label:"\u5B9C\u6625"},{value:"\u9E70\u6F6D",label:"\u9E70\u6F6D"}]},{value:"\u5409\u6797",label:"\u5409\u6797",children:[{value:"\u957F\u6625",label:"\u957F\u6625"},{value:"\u5409\u6797",label:"\u5409\u6797"},{value:"\u767D\u57CE",label:"\u767D\u57CE"},{value:"\u767D\u5C71",label:"\u767D\u5C71"},{value:"\u73F2\u6625",label:"\u73F2\u6625"},{value:"\u8FBD\u6E90",label:"\u8FBD\u6E90"},{value:"\u6885\u6CB3",label:"\u6885\u6CB3"},{value:"\u56DB\u5E73",label:"\u56DB\u5E73"},{value:"\u677E\u539F",label:"\u677E\u539F"},{value:"\u901A\u5316",label:"\u901A\u5316"},{value:"\u5EF6\u5409",label:"\u5EF6\u5409"}]},{value:"\u8FBD\u5B81",label:"\u8FBD\u5B81",children:[{value:"\u6C88\u9633",label:"\u6C88\u9633"},{value:"\u978D\u5C71",label:"\u978D\u5C71"},{value:"\u672C\u6EAA",label:"\u672C\u6EAA"},{value:"\u671D\u9633",label:"\u671D\u9633"},{value:"\u5927\u8FDE",label:"\u5927\u8FDE"},{value:"\u4E39\u4E1C",label:"\u4E39\u4E1C"},{value:"\u629A\u987A",label:"\u629A\u987A"},{value:"\u961C\u65B0",label:"\u961C\u65B0"},{value:"\u846B\u82A6\u5C9B",label:"\u846B\u82A6\u5C9B"},{value:"\u9526\u5DDE",label:"\u9526\u5DDE"},{value:"\u8FBD\u9633",label:"\u8FBD\u9633"},{value:"\u76D8\u9526",label:"\u76D8\u9526"},{value:"\u94C1\u5CAD",label:"\u94C1\u5CAD"},{value:"\u8425\u53E3",label:"\u8425\u53E3"}]},{value:"\u6FB3\u95E8",label:"\u6FB3\u95E8",children:[{value:"\u6FB3\u95E8",label:"\u6FB3\u95E8"}]},{value:"\u5185\u8499\u53E4",label:"\u5185\u8499\u53E4",children:[{value:"\u547C\u548C\u6D69\u7279",label:"\u547C\u548C\u6D69\u7279"},{value:"\u963F\u62C9\u5584\u76DF",label:"\u963F\u62C9\u5584\u76DF"},{value:"\u5305\u5934",label:"\u5305\u5934"},{value:"\u8D64\u5CF0",label:"\u8D64\u5CF0"},{value:"\u4E1C\u80DC",label:"\u4E1C\u80DC"},{value:"\u6D77\u62C9\u5C14",label:"\u6D77\u62C9\u5C14"},{value:"\u96C6\u5B81",label:"\u96C6\u5B81"},{value:"\u4E34\u6CB3",label:"\u4E34\u6CB3"},{value:"\u901A\u8FBD",label:"\u901A\u8FBD"},{value:"\u4E4C\u6D77",label:"\u4E4C\u6D77"},{value:"\u4E4C\u5170\u6D69\u7279",label:"\u4E4C\u5170\u6D69\u7279"},{value:"\u9521\u6797\u6D69\u7279",label:"\u9521\u6797\u6D69\u7279"}]},{value:"\u5B81\u590F",label:"\u5B81\u590F",children:[{value:"\u94F6\u5DDD",label:"\u94F6\u5DDD"},{value:"\u56FA\u6E90",label:"\u56FA\u6E90"},{value:"\u77F3\u5634\u5C71",label:"\u77F3\u5634\u5C71"},{value:"\u5434\u5FE0",label:"\u5434\u5FE0"}]},{value:"\u9752\u6D77",label:"\u9752\u6D77",children:[{value:"\u897F\u5B81",label:"\u897F\u5B81"},{value:"\u5FB7\u4EE4\u54C8",label:"\u5FB7\u4EE4\u54C8"},{value:"\u683C\u5C14\u6728",label:"\u683C\u5C14\u6728"},{value:"\u5171\u548C",label:"\u5171\u548C"},{value:"\u6D77\u4E1C",label:"\u6D77\u4E1C"},{value:"\u6D77\u664F",label:"\u6D77\u664F"},{value:"\u739B\u6C81",label:"\u739B\u6C81"},{value:"\u540C\u4EC1",label:"\u540C\u4EC1"},{value:"\u7389\u6811",label:"\u7389\u6811"}]},{value:"\u5C71\u4E1C",label:"\u5C71\u4E1C",children:[{value:"\u6D4E\u5357",label:"\u6D4E\u5357"},{value:"\u6EE8\u5DDE",label:"\u6EE8\u5DDE"},{value:"\u5156\u5DDE",label:"\u5156\u5DDE"},{value:"\u5FB7\u5DDE",label:"\u5FB7\u5DDE"},{value:"\u4E1C\u8425",label:"\u4E1C\u8425"},{value:"\u83CF\u6CFD",label:"\u83CF\u6CFD"},{value:"\u6D4E\u5B81",label:"\u6D4E\u5B81"},{value:"\u83B1\u829C",label:"\u83B1\u829C"},{value:"\u804A\u57CE",label:"\u804A\u57CE"},{value:"\u4E34\u6C82",label:"\u4E34\u6C82"},{value:"\u84EC\u83B1",label:"\u84EC\u83B1"},{value:"\u9752\u5C9B",label:"\u9752\u5C9B"},{value:"\u66F2\u961C",label:"\u66F2\u961C"},{value:"\u65E5\u7167",label:"\u65E5\u7167"},{value:"\u6CF0\u5B89",label:"\u6CF0\u5B89"},{value:"\u6F4D\u574A",label:"\u6F4D\u574A"},{value:"\u5A01\u6D77",label:"\u5A01\u6D77"},{value:"\u70DF\u53F0",label:"\u70DF\u53F0"},{value:"\u67A3\u5E84",label:"\u67A3\u5E84"},{value:"\u6DC4\u535A",label:"\u6DC4\u535A"}]},{value:"\u5C71\u897F",label:"\u5C71\u897F",children:[{value:"\u592A\u539F",label:"\u592A\u539F"},{value:"\u5415\u6881",label:"\u5415\u6881"},{value:"\u957F\u6CBB",label:"\u957F\u6CBB"},{value:"\u5927\u540C",label:"\u5927\u540C"},{value:"\u5019\u9A6C",label:"\u5019\u9A6C"},{value:"\u664B\u57CE",label:"\u664B\u57CE"},{value:"\u79BB\u77F3",label:"\u79BB\u77F3"},{value:"\u4E34\u6C7E",label:"\u4E34\u6C7E"},{value:"\u5B81\u6B66",label:"\u5B81\u6B66"},{value:"\u6714\u5DDE",label:"\u6714\u5DDE"},{value:"\u5FFB\u5DDE",label:"\u5FFB\u5DDE"},{value:"\u9633\u6CC9",label:"\u9633\u6CC9"},{value:"\u6986\u6B21",label:"\u6986\u6B21"},{value:"\u664B\u4E2D",label:"\u664B\u4E2D"},{value:"\u8FD0\u57CE",label:"\u8FD0\u57CE"}]},{value:"\u9655\u897F",label:"\u9655\u897F",children:[{value:"\u897F\u5B89",label:"\u897F\u5B89"},{value:"\u5B89\u5EB7",label:"\u5B89\u5EB7"},{value:"\u5B9D\u9E21",label:"\u5B9D\u9E21"},{value:"\u6C49\u4E2D",label:"\u6C49\u4E2D"},{value:"\u6E2D\u5357",label:"\u6E2D\u5357"},{value:"\u5546\u5DDE",label:"\u5546\u5DDE"},{value:"\u7EE5\u5FB7",label:"\u7EE5\u5FB7"},{value:"\u94DC\u5DDD",label:"\u94DC\u5DDD"},{value:"\u54B8\u9633",label:"\u54B8\u9633"},{value:"\u5EF6\u5B89",label:"\u5EF6\u5B89"},{value:"\u6986\u6797",label:"\u6986\u6797"}]},{value:"\u56DB\u5DDD",label:"\u56DB\u5DDD",children:[{value:"\u6210\u90FD",label:"\u6210\u90FD"},{value:"\u5DF4\u4E2D",label:"\u5DF4\u4E2D"},{value:"\u8FBE\u5DDD",label:"\u8FBE\u5DDD"},{value:"\u5FB7\u9633",label:"\u5FB7\u9633"},{value:"\u90FD\u6C5F\u5830",label:"\u90FD\u6C5F\u5830"},{value:"\u5CE8\u7709\u5C71",label:"\u5CE8\u7709\u5C71"},{value:"\u6DAA\u9675",label:"\u6DAA\u9675"},{value:"\u5E7F\u5B89",label:"\u5E7F\u5B89"},{value:"\u5E7F\u5143",label:"\u5E7F\u5143"},{value:"\u4E5D\u5BE8\u6C9F",label:"\u4E5D\u5BE8\u6C9F"},{value:"\u5EB7\u5B9A",label:"\u5EB7\u5B9A"},{value:"\u4E50\u5C71",label:"\u4E50\u5C71"},{value:"\u6CF8\u5DDE",label:"\u6CF8\u5DDE"},{value:"\u9A6C\u5C14\u5EB7",label:"\u9A6C\u5C14\u5EB7"},{value:"\u7EF5\u9633",label:"\u7EF5\u9633"},{value:"\u7709\u5C71",label:"\u7709\u5C71"},{value:"\u5357\u5145",label:"\u5357\u5145"},{value:"\u5185\u6C5F",label:"\u5185\u6C5F"},{value:"\u6500\u679D\u82B1",label:"\u6500\u679D\u82B1"},{value:"\u9042\u5B81",label:"\u9042\u5B81"},{value:"\u6C76\u5DDD",label:"\u6C76\u5DDD"},{value:"\u897F\u660C",label:"\u897F\u660C"},{value:"\u96C5\u5B89",label:"\u96C5\u5B89"},{value:"\u5B9C\u5BBE",label:"\u5B9C\u5BBE"},{value:"\u81EA\u8D21",label:"\u81EA\u8D21"},{value:"\u8D44\u9633",label:"\u8D44\u9633"}]},{value:"\u53F0\u6E7E",label:"\u53F0\u6E7E",children:[{value:"\u53F0\u5317",label:"\u53F0\u5317"},{value:"\u57FA\u9686",label:"\u57FA\u9686"},{value:"\u53F0\u5357",label:"\u53F0\u5357"},{value:"\u53F0\u4E2D",label:"\u53F0\u4E2D"},{value:"\u9AD8\u96C4",label:"\u9AD8\u96C4"},{value:"\u5C4F\u4E1C",label:"\u5C4F\u4E1C"},{value:"\u5357\u6295",label:"\u5357\u6295"},{value:"\u4E91\u6797",label:"\u4E91\u6797"},{value:"\u65B0\u7AF9",label:"\u65B0\u7AF9"},{value:"\u5F70\u5316",label:"\u5F70\u5316"},{value:"\u82D7\u6817",label:"\u82D7\u6817"},{value:"\u5609\u4E49",label:"\u5609\u4E49"},{value:"\u6843\u56ED",label:"\u6843\u56ED"},{value:"\u5B9C\u5170",label:"\u5B9C\u5170"},{value:"\u53F0\u4E1C",label:"\u53F0\u4E1C"},{value:"\u91D1\u95E8",label:"\u91D1\u95E8"},{value:"\u9A6C\u7956",label:"\u9A6C\u7956"},{value:"\u6F8E\u6E56",label:"\u6F8E\u6E56"}]},{value:"\u5929\u6D25",label:"\u5929\u6D25",children:[{value:"\u5929\u6D25",label:"\u5929\u6D25"},{value:"\u548C\u5E73",label:"\u548C\u5E73"},{value:"\u4E1C\u4E3D",label:"\u4E1C\u4E3D"},{value:"\u6CB3\u4E1C",label:"\u6CB3\u4E1C"},{value:"\u897F\u9752",label:"\u897F\u9752"},{value:"\u6CB3\u897F",label:"\u6CB3\u897F"},{value:"\u6D25\u5357",label:"\u6D25\u5357"},{value:"\u5357\u5F00",label:"\u5357\u5F00"},{value:"\u5317\u8FB0",label:"\u5317\u8FB0"},{value:"\u6CB3\u5317",label:"\u6CB3\u5317"},{value:"\u6B66\u6E05",label:"\u6B66\u6E05"},{value:"\u7EA2\u6322",label:"\u7EA2\u6322"},{value:"\u5858\u6CBD",label:"\u5858\u6CBD"},{value:"\u6C49\u6CBD",label:"\u6C49\u6CBD"},{value:"\u5927\u6E2F",label:"\u5927\u6E2F"},{value:"\u5B81\u6CB3",label:"\u5B81\u6CB3"},{value:"\u9759\u6D77",label:"\u9759\u6D77"},{value:"\u5B9D\u577B",label:"\u5B9D\u577B"},{value:"\u84DF\u53BF",label:"\u84DF\u53BF"}]},{value:"\u65B0\u7586",label:"\u65B0\u7586",children:[{value:"\u4E4C\u9C81\u6728\u9F50",label:"\u4E4C\u9C81\u6728\u9F50"},{value:"\u963F\u514B\u82CF",label:"\u963F\u514B\u82CF"},{value:"\u963F\u52D2\u6CF0",label:"\u963F\u52D2\u6CF0"},{value:"\u963F\u56FE\u4EC0",label:"\u963F\u56FE\u4EC0"},{value:"\u535A\u4E50",label:"\u535A\u4E50"},{value:"\u660C\u5409",label:"\u660C\u5409"},{value:"\u4E1C\u5C71",label:"\u4E1C\u5C71"},{value:"\u54C8\u5BC6",label:"\u54C8\u5BC6"},{value:"\u548C\u7530",label:"\u548C\u7530"},{value:"\u5580\u4EC0",label:"\u5580\u4EC0"},{value:"\u514B\u62C9\u739B\u4F9D",label:"\u514B\u62C9\u739B\u4F9D"},{value:"\u5E93\u8F66",label:"\u5E93\u8F66"},{value:"\u5E93\u5C14\u52D2",label:"\u5E93\u5C14\u52D2"},{value:"\u594E\u5C6F",label:"\u594E\u5C6F"},{value:"\u77F3\u6CB3\u5B50",label:"\u77F3\u6CB3\u5B50"},{value:"\u5854\u57CE",label:"\u5854\u57CE"},{value:"\u5410\u9C81\u756A",label:"\u5410\u9C81\u756A"},{value:"\u4F0A\u5B81",label:"\u4F0A\u5B81"}]},{value:"\u897F\u85CF",label:"\u897F\u85CF",children:[{value:"\u62C9\u8428",label:"\u62C9\u8428"},{value:"\u963F\u91CC",label:"\u963F\u91CC"},{value:"\u660C\u90FD",label:"\u660C\u90FD"},{value:"\u6797\u829D",label:"\u6797\u829D"},{value:"\u90A3\u66F2",label:"\u90A3\u66F2"},{value:"\u65E5\u5580\u5219",label:"\u65E5\u5580\u5219"},{value:"\u5C71\u5357",label:"\u5C71\u5357"}]},{value:"\u4E91\u5357",label:"\u4E91\u5357",children:[{value:"\u6606\u660E",label:"\u6606\u660E"},{value:"\u5927\u7406",label:"\u5927\u7406"},{value:"\u4FDD\u5C71",label:"\u4FDD\u5C71"},{value:"\u695A\u96C4",label:"\u695A\u96C4"},{value:"\u5927\u7406",label:"\u5927\u7406"},{value:"\u4E1C\u5DDD",label:"\u4E1C\u5DDD"},{value:"\u4E2A\u65E7",label:"\u4E2A\u65E7"},{value:"\u666F\u6D2A",label:"\u666F\u6D2A"},{value:"\u5F00\u8FDC",label:"\u5F00\u8FDC"},{value:"\u4E34\u6CA7",label:"\u4E34\u6CA7"},{value:"\u4E3D\u6C5F",label:"\u4E3D\u6C5F"},{value:"\u516D\u5E93",label:"\u516D\u5E93"},{value:"\u6F5E\u897F",label:"\u6F5E\u897F"},{value:"\u66F2\u9756",label:"\u66F2\u9756"},{value:"\u601D\u8305",label:"\u601D\u8305"},{value:"\u6587\u5C71",label:"\u6587\u5C71"},{value:"\u897F\u53CC\u7248\u7EB3",label:"\u897F\u53CC\u7248\u7EB3"},{value:"\u7389\u6EAA",label:"\u7389\u6EAA"},{value:"\u4E2D\u7538",label:"\u4E2D\u7538"},{value:"\u662D\u901A",label:"\u662D\u901A"}]},{value:"\u6D59\u6C5F",label:"\u6D59\u6C5F",children:[{value:"\u676D\u5DDE",label:"\u676D\u5DDE"},{value:"\u6E29\u5DDE",label:"\u6E29\u5DDE"},{value:"\u5B89\u5409",label:"\u5B89\u5409"},{value:"\u6148\u6EAA",label:"\u6148\u6EAA"},{value:"\u5B9A\u6D77",label:"\u5B9A\u6D77"},{value:"\u5949\u5316",label:"\u5949\u5316"},{value:"\u6D77\u76D0",label:"\u6D77\u76D0"},{value:"\u9EC4\u5CA9",label:"\u9EC4\u5CA9"},{value:"\u6E56\u5DDE",label:"\u6E56\u5DDE"},{value:"\u5609\u5174",label:"\u5609\u5174"},{value:"\u91D1\u534E",label:"\u91D1\u534E"},{value:"\u4E34\u5B89",label:"\u4E34\u5B89"},{value:"\u4E34\u6D77",label:"\u4E34\u6D77"},{value:"\u4E3D\u6C34",label:"\u4E3D\u6C34"},{value:"\u5B81\u6CE2",label:"\u5B81\u6CE2"},{value:"\u74EF\u6D77",label:"\u74EF\u6D77"},{value:"\u5E73\u6E56",label:"\u5E73\u6E56"},{value:"\u5343\u5C9B\u6E56",label:"\u5343\u5C9B\u6E56"},{value:"\u8862\u5DDE",label:"\u8862\u5DDE"},{value:"\u6C5F\u5C71",label:"\u6C5F\u5C71"},{value:"\u745E\u5B89",label:"\u745E\u5B89"},{value:"\u7ECD\u5174",label:"\u7ECD\u5174"},{value:"\u5D4A\u5DDE",label:"\u5D4A\u5DDE"},{value:"\u53F0\u5DDE",label:"\u53F0\u5DDE"},{value:"\u6E29\u5CAD",label:"\u6E29\u5CAD"},{value:"\u4F59\u59DA",label:"\u4F59\u59DA"},{value:"\u821F\u5C71",label:"\u821F\u5C71"}]},{value:"\u6D77\u5916",label:"\u6D77\u5916",children:[{value:"\u7F8E\u56FD",label:"\u7F8E\u56FD"},{value:"\u65E5\u672C",label:"\u65E5\u672C"},{value:"\u82F1\u56FD",label:"\u82F1\u56FD"},{value:"\u6CD5\u56FD",label:"\u6CD5\u56FD"},{value:"\u5FB7\u56FD",label:"\u5FB7\u56FD"},{value:"\u5176\u4ED6",label:"\u5176\u4ED6"}]}]},h78n:function(Et,rt,re){"use strict";re.d(rt,"a",function(){return x});var he=re("q1tI"),$=re.n(he),O=re("TSYQ"),Z=re.n(O),F={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},I=function(z){var V=z.map(function(){return Object(he.useRef)()}),M=Object(he.useRef)();return Object(he.useEffect)(function(){var N=Date.now(),Y=!1;Object.keys(V).forEach(function(oe){var pe=V[oe].current;if(!pe)return;Y=!0;var ve=pe.style;ve.transitionDuration=".3s, .3s, .3s, .06s",M.current&&N-M.current<100&&(ve.transitionDuration="0s, 0s")}),Y&&(M.current=Date.now())}),[V]};function K(){return K=Object.assign||function(j){for(var z=1;z<arguments.length;z++){var V=arguments[z];for(var M in V)Object.prototype.hasOwnProperty.call(V,M)&&(j[M]=V[M])}return j},K.apply(this,arguments)}function B(j,z){return _(j)||A(j,z)||R(j,z)||P()}function P(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function R(j,z){if(!j)return;if(typeof j=="string")return y(j,z);var V=Object.prototype.toString.call(j).slice(8,-1);if(V==="Object"&&j.constructor&&(V=j.constructor.name),V==="Map"||V==="Set")return Array.from(j);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return y(j,z)}function y(j,z){(z==null||z>j.length)&&(z=j.length);for(var V=0,M=new Array(z);V<z;V++)M[V]=j[V];return M}function A(j,z){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(j)))return;var V=[],M=!0,N=!1,Y=void 0;try{for(var oe=j[Symbol.iterator](),pe;!(M=(pe=oe.next()).done)&&!(V.push(pe.value),z&&V.length===z);M=!0);}catch(ve){N=!0,Y=ve}finally{try{!M&&oe.return!=null&&oe.return()}finally{if(N)throw Y}}return V}function _(j){if(Array.isArray(j))return j}function k(j,z){if(j==null)return{};var V=C(j,z),M,N;if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(j);for(N=0;N<Y.length;N++){if(M=Y[N],z.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(j,M))continue;V[M]=j[M]}}return V}function C(j,z){if(j==null)return{};var V={},M=Object.keys(j),N,Y;for(Y=0;Y<M.length;Y++){if(N=M[Y],z.indexOf(N)>=0)continue;V[N]=j[N]}return V}var E=function(z){var V=z.className,M=z.percent,N=z.prefixCls,Y=z.strokeColor,oe=z.strokeLinecap,pe=z.strokeWidth,ve=z.style,Le=z.trailColor,ke=z.trailWidth,ce=z.transition,ae=k(z,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete ae.gapPosition;var de=Array.isArray(M)?M:[M],ne=Array.isArray(Y)?Y:[Y],se=I(de),J=B(se,1),ee=J[0],ie=pe/2,fe=100-pe/2,Ae="M ".concat(oe==="round"?ie:0,",").concat(ie,`
|
|
L `).concat(oe==="round"?fe:100,",").concat(ie),ge="0 0 100 ".concat(pe),Oe=0;return $.a.createElement("svg",K({className:Z()("".concat(N,"-line"),V),viewBox:ge,preserveAspectRatio:"none",style:ve},ae),$.a.createElement("path",{className:"".concat(N,"-line-trail"),d:Ae,strokeLinecap:oe,stroke:Le,strokeWidth:ke||pe,fillOpacity:"0"}),de.map(function(Pe,je){var Ke={strokeDasharray:"".concat(Pe,"px, 100px"),strokeDashoffset:"-".concat(Oe,"px"),transition:ce||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},He=ne[je]||ne[ne.length-1];return Oe+=Pe,$.a.createElement("path",{key:je,className:"".concat(N,"-line-path"),d:Ae,strokeLinecap:oe,stroke:He,strokeWidth:pe,fillOpacity:"0",ref:ee[je],style:Ke})}))};E.defaultProps=F;var h=E;function o(){return o=Object.assign||function(j){for(var z=1;z<arguments.length;z++){var V=arguments[z];for(var M in V)Object.prototype.hasOwnProperty.call(V,M)&&(j[M]=V[M])}return j},o.apply(this,arguments)}function l(j,z){return w(j)||p(j,z)||S(j,z)||d()}function d(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function S(j,z){if(!j)return;if(typeof j=="string")return v(j,z);var V=Object.prototype.toString.call(j).slice(8,-1);if(V==="Object"&&j.constructor&&(V=j.constructor.name),V==="Map"||V==="Set")return Array.from(j);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return v(j,z)}function v(j,z){(z==null||z>j.length)&&(z=j.length);for(var V=0,M=new Array(z);V<z;V++)M[V]=j[V];return M}function p(j,z){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(j)))return;var V=[],M=!0,N=!1,Y=void 0;try{for(var oe=j[Symbol.iterator](),pe;!(M=(pe=oe.next()).done)&&!(V.push(pe.value),z&&V.length===z);M=!0);}catch(ve){N=!0,Y=ve}finally{try{!M&&oe.return!=null&&oe.return()}finally{if(N)throw Y}}return V}function w(j){if(Array.isArray(j))return j}function b(j,z){if(j==null)return{};var V=u(j,z),M,N;if(Object.getOwnPropertySymbols){var Y=Object.getOwnPropertySymbols(j);for(N=0;N<Y.length;N++){if(M=Y[N],z.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(j,M))continue;V[M]=j[M]}}return V}function u(j,z){if(j==null)return{};var V={},M=Object.keys(j),N,Y;for(Y=0;Y<M.length;Y++){if(N=M[Y],z.indexOf(N)>=0)continue;V[N]=j[N]}return V}var f=0;function s(j){return+j.replace("%","")}function a(j){return Array.isArray(j)?j:[j]}function T(j,z,V,M){var N=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,Y=arguments.length>5?arguments[5]:void 0,oe=50-M/2,pe=0,ve=-oe,Le=0,ke=-2*oe;switch(Y){case"left":pe=-oe,ve=0,Le=2*oe,ke=0;break;case"right":pe=oe,ve=0,Le=-2*oe,ke=0;break;case"bottom":ve=oe,ke=2*oe;break;default:}var ce="M 50,50 m ".concat(pe,",").concat(ve,`
|
|
a `).concat(oe,",").concat(oe," 0 1 1 ").concat(Le,",").concat(-ke,`
|
|
a `).concat(oe,",").concat(oe," 0 1 1 ").concat(-Le,",").concat(ke),ae=Math.PI*2*oe,de={stroke:V,strokeDasharray:"".concat(z/100*(ae-N),"px ").concat(ae,"px"),strokeDashoffset:"-".concat(N/2+j/100*(ae-N),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:ce,pathStyle:de}}var m=function(z){var V=z.prefixCls,M=z.strokeWidth,N=z.trailWidth,Y=z.gapDegree,oe=z.gapPosition,pe=z.trailColor,ve=z.strokeLinecap,Le=z.style,ke=z.className,ce=z.strokeColor,ae=z.percent,de=b(z,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ne=Object(he.useMemo)(function(){return f+=1,f},[]),se=T(0,100,pe,M,Y,oe),J=se.pathString,ee=se.pathStyle,ie=a(ae),fe=a(ce),Ae=fe.find(function(Ke){return Object.prototype.toString.call(Ke)==="[object Object]"}),ge=I(ie),Oe=l(ge,1),Pe=Oe[0],je=function(){var He=0;return ie.map(function(Fe,qe){var De=fe[qe]||fe[fe.length-1],Ne=Object.prototype.toString.call(De)==="[object Object]"?"url(#".concat(V,"-gradient-").concat(ne,")"):"",Be=T(He,Fe,De,M,Y,oe);return He+=Fe,$.a.createElement("path",{key:qe,className:"".concat(V,"-circle-path"),d:Be.pathString,stroke:Ne,strokeLinecap:ve,strokeWidth:M,opacity:Fe===0?0:1,fillOpacity:"0",style:Be.pathStyle,ref:Pe[qe]})})};return $.a.createElement("svg",o({className:Z()("".concat(V,"-circle"),ke),viewBox:"0 0 100 100",style:Le},de),Ae&&$.a.createElement("defs",null,$.a.createElement("linearGradient",{id:"".concat(V,"-gradient-").concat(ne),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Ae).sort(function(Ke,He){return s(Ke)-s(He)}).map(function(Ke,He){return $.a.createElement("stop",{key:He,offset:Ke,stopColor:Ae[Ke]})}))),$.a.createElement("path",{className:"".concat(V,"-circle-trail"),d:J,stroke:pe,strokeLinecap:ve,strokeWidth:N||M,fillOpacity:"0",style:ee}),je().reverse())};m.defaultProps=F;var x=m,D={Line:h,Circle:x}},hxT0:function(Et,rt,re){Et.exports={bg:"bg___2samk",wrap:"wrap___1kw4T",crumbs:"crumbs___1aICA",titleWrap:"titleWrap___3U2TN",flexRow:"flexRow___2Ocys",flexJustifyCenter:"flexJustifyCenter___14s6l",flexAlignEnd:"flexAlignEnd___1lHt8",flexAlignCenter:"flexAlignCenter___2PtCV",flexColumn:"flexColumn___2Ssa4",formWrap:"formWrap___3Fcg8",fieldWrap:"fieldWrap___3K6pg",mdWrap:"mdWrap___3o_rf",backgroundFa:"backgroundFa___3dwFi",aBtn:"aBtn___12lxK",bBtn:"bBtn___18QB-",cascaderWrap:"cascaderWrap___ETHsj",listItem:"listItem___C62yl",right:"right___1iif8",one:"one___2Qd4F",schoolHintWrap:"schoolHintWrap___34WkA",colorCDCDCD:"colorCDCDCD___HqcpR",color0152d9:"color0152d9___cQ4G4",spanText:"spanText___1YP81"}},kSUc:function(Et,rt,re){},lZu9:function(Et,rt,re){(function(he){he(re("VrN/"),re("1eCo"),re("8EBN"))})(function(he){"use strict";he.defineMode("markdown",function($,O){var Z=he.getMode($,"text/html"),F=Z.name=="null";function I(M){if(he.findModeByName){var N=he.findModeByName(M);N&&(M=N.mime||N.mimes[0])}var Y=he.getMode($,M);return Y.name=="null"?null:Y}O.highlightFormatting===void 0&&(O.highlightFormatting=!1),O.maxBlockquoteDepth===void 0&&(O.maxBlockquoteDepth=0),O.taskLists===void 0&&(O.taskLists=!1),O.strikethrough===void 0&&(O.strikethrough=!1),O.emoji===void 0&&(O.emoji=!1),O.fencedCodeBlockHighlighting===void 0&&(O.fencedCodeBlockHighlighting=!0),O.fencedCodeBlockDefaultMode===void 0&&(O.fencedCodeBlockDefaultMode="text/plain"),O.xml===void 0&&(O.xml=!0),O.tokenTypeOverrides===void 0&&(O.tokenTypeOverrides={});var K={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var B in K)K.hasOwnProperty(B)&&O.tokenTypeOverrides[B]&&(K[B]=O.tokenTypeOverrides[B]);var P=/^([*\-_])(?:\s*\1){2,}\s*$/,R=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,y=/^\[(x| )\](?=\s)/i,A=O.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,_=/^ {0,3}(?:\={1,}|-{2,})\s*$/,k=/^[^#!\[\]*_\\<>` "'(~:]+/,C=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,E=/^\s*\[[^\]]+?\]:.*$/,h=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function l(M,N,Y){return N.f=N.inline=Y,Y(M,N)}function d(M,N,Y){return N.f=N.block=Y,Y(M,N)}function S(M){return!M||!/\S/.test(M.string)}function v(M){if(M.linkTitle=!1,M.linkHref=!1,M.linkText=!1,M.em=!1,M.strong=!1,M.strikethrough=!1,M.quote=0,M.indentedCode=!1,M.f==w){var N=F;if(!N){var Y=he.innerMode(Z,M.htmlState);N=Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText}N&&(M.f=s,M.block=p,M.htmlState=null)}return M.trailingSpace=0,M.trailingSpaceNewLine=!1,M.prevLine=M.thisLine,M.thisLine={stream:null},null}function p(M,N){var Y=M.column()===N.indentation,oe=S(N.prevLine.stream),pe=N.indentedCode,ve=N.prevLine.hr,Le=N.list!==!1,ke=(N.listStack[N.listStack.length-1]||0)+3;N.indentedCode=!1;var ce=N.indentation;if(N.indentationDiff===null&&(N.indentationDiff=N.indentation,Le)){for(N.list=null;ce<N.listStack[N.listStack.length-1];)N.listStack.pop(),N.listStack.length?N.indentation=N.listStack[N.listStack.length-1]:N.list=!1;N.list!==!1&&(N.indentationDiff=ce-N.listStack[N.listStack.length-1])}var ae=!oe&&!ve&&!N.prevLine.header&&(!Le||!pe)&&!N.prevLine.fencedCodeEnd,de=(N.list===!1||ve||oe)&&N.indentation<=ke&&M.match(P),ne=null;if(N.indentationDiff>=4&&(pe||N.prevLine.fencedCodeEnd||N.prevLine.header||oe))return M.skipToEnd(),N.indentedCode=!0,K.code;if(M.eatSpace())return null;if(Y&&N.indentation<=ke&&(ne=M.match(A))&&ne[1].length<=6)return N.quote=0,N.header=ne[1].length,N.thisLine.header=!0,O.highlightFormatting&&(N.formatting="header"),N.f=N.inline,u(N);if(N.indentation<=ke&&M.eat(">"))return N.quote=Y?1:N.quote+1,O.highlightFormatting&&(N.formatting="quote"),M.eatSpace(),u(N);if(!de&&!N.setext&&Y&&N.indentation<=ke&&(ne=M.match(R))){var se=ne[1]?"ol":"ul";return N.indentation=ce+M.current().length,N.list=!0,N.quote=0,N.listStack.push(N.indentation),N.em=!1,N.strong=!1,N.code=!1,N.strikethrough=!1,O.taskLists&&M.match(y,!1)&&(N.taskList=!0),N.f=N.inline,O.highlightFormatting&&(N.formatting=["list","list-"+se]),u(N)}else{if(Y&&N.indentation<=ke&&(ne=M.match(C,!0)))return N.quote=0,N.fencedEndRE=new RegExp(ne[1]+"+ *$"),N.localMode=O.fencedCodeBlockHighlighting&&I(ne[2]||O.fencedCodeBlockDefaultMode),N.localMode&&(N.localState=he.startState(N.localMode)),N.f=N.block=b,O.highlightFormatting&&(N.formatting="code-block"),N.code=-1,u(N);if(N.setext||(!ae||!Le)&&!N.quote&&N.list===!1&&!N.code&&!de&&!E.test(M.string)&&(ne=M.lookAhead(1))&&(ne=ne.match(_)))return N.setext?(N.header=N.setext,N.setext=0,M.skipToEnd(),O.highlightFormatting&&(N.formatting="header")):(N.header=ne[0].charAt(0)=="="?1:2,N.setext=N.header),N.thisLine.header=!0,N.f=N.inline,u(N);if(de)return M.skipToEnd(),N.hr=!0,N.thisLine.hr=!0,K.hr;if(M.peek()==="[")return l(M,N,D)}return l(M,N,N.inline)}function w(M,N){var Y=Z.token(M,N.htmlState);if(!F){var oe=he.innerMode(Z,N.htmlState);(oe.mode.name=="xml"&&oe.state.tagStart===null&&!oe.state.context&&oe.state.tokenize.isInText||N.md_inside&&M.current().indexOf(">")>-1)&&(N.f=s,N.block=p,N.htmlState=null)}return Y}function b(M,N){var Y=N.listStack[N.listStack.length-1]||0,oe=N.indentation<Y,pe=Y+3;if(N.fencedEndRE&&N.indentation<=pe&&(oe||M.match(N.fencedEndRE))){O.highlightFormatting&&(N.formatting="code-block");var ve;return oe||(ve=u(N)),N.localMode=N.localState=null,N.block=p,N.f=s,N.fencedEndRE=null,N.code=0,N.thisLine.fencedCodeEnd=!0,oe?d(M,N,N.block):ve}else return N.localMode?N.localMode.token(M,N.localState):(M.skipToEnd(),K.code)}function u(M){var N=[];if(M.formatting){N.push(K.formatting),typeof M.formatting=="string"&&(M.formatting=[M.formatting]);for(var Y=0;Y<M.formatting.length;Y++)N.push(K.formatting+"-"+M.formatting[Y]),M.formatting[Y]==="header"&&N.push(K.formatting+"-"+M.formatting[Y]+"-"+M.header),M.formatting[Y]==="quote"&&(!O.maxBlockquoteDepth||O.maxBlockquoteDepth>=M.quote?N.push(K.formatting+"-"+M.formatting[Y]+"-"+M.quote):N.push("error"))}if(M.taskOpen)return N.push("meta"),N.length?N.join(" "):null;if(M.taskClosed)return N.push("property"),N.length?N.join(" "):null;if(M.linkHref?N.push(K.linkHref,"url"):(M.strong&&N.push(K.strong),M.em&&N.push(K.em),M.strikethrough&&N.push(K.strikethrough),M.emoji&&N.push(K.emoji),M.linkText&&N.push(K.linkText),M.code&&N.push(K.code),M.image&&N.push(K.image),M.imageAltText&&N.push(K.imageAltText,"link"),M.imageMarker&&N.push(K.imageMarker)),M.header&&N.push(K.header,K.header+"-"+M.header),M.quote&&(N.push(K.quote),!O.maxBlockquoteDepth||O.maxBlockquoteDepth>=M.quote?N.push(K.quote+"-"+M.quote):N.push(K.quote+"-"+O.maxBlockquoteDepth)),M.list!==!1){var oe=(M.listStack.length-1)%3;oe?oe===1?N.push(K.list2):N.push(K.list3):N.push(K.list1)}return M.trailingSpaceNewLine?N.push("trailing-space-new-line"):M.trailingSpace&&N.push("trailing-space-"+(M.trailingSpace%2?"a":"b")),N.length?N.join(" "):null}function f(M,N){return M.match(k,!0)?u(N):void 0}function s(M,N){var Y=N.text(M,N);if(typeof Y!="undefined")return Y;if(N.list)return N.list=null,u(N);if(N.taskList){var oe=M.match(y,!0)[1]===" ";return oe?N.taskOpen=!0:N.taskClosed=!0,O.highlightFormatting&&(N.formatting="task"),N.taskList=!1,u(N)}if(N.taskOpen=!1,N.taskClosed=!1,N.header&&M.match(/^#+$/,!0))return O.highlightFormatting&&(N.formatting="header"),u(N);var pe=M.next();if(N.linkTitle){N.linkTitle=!1;var ve=pe;pe==="("&&(ve=")"),ve=(ve+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Le="^\\s*(?:[^"+ve+"\\\\]+|\\\\\\\\|\\\\.)"+ve;if(M.match(new RegExp(Le),!0))return K.linkHref}if(pe==="`"){var ke=N.formatting;O.highlightFormatting&&(N.formatting="code"),M.eatWhile("`");var ce=M.current().length;if(N.code==0&&(!N.quote||ce==1))return N.code=ce,u(N);if(ce==N.code){var ae=u(N);return N.code=0,ae}else return N.formatting=ke,u(N)}else if(N.code)return u(N);if(pe==="\\"&&(M.next(),O.highlightFormatting)){var de=u(N),ne=K.formatting+"-escape";return de?de+" "+ne:ne}if(pe==="!"&&M.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return N.imageMarker=!0,N.image=!0,O.highlightFormatting&&(N.formatting="image"),u(N);if(pe==="["&&N.imageMarker&&M.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return N.imageMarker=!1,N.imageAltText=!0,O.highlightFormatting&&(N.formatting="image"),u(N);if(pe==="]"&&N.imageAltText){O.highlightFormatting&&(N.formatting="image");var de=u(N);return N.imageAltText=!1,N.image=!1,N.inline=N.f=T,de}if(pe==="["&&!N.image)return N.linkText&&M.match(/^.*?\]/)||(N.linkText=!0,O.highlightFormatting&&(N.formatting="link")),u(N);if(pe==="]"&&N.linkText){O.highlightFormatting&&(N.formatting="link");var de=u(N);return N.linkText=!1,N.inline=N.f=M.match(/\(.*?\)| ?\[.*?\]/,!1)?T:s,de}if(pe==="<"&&M.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=a,O.highlightFormatting&&(N.formatting="link");var de=u(N);return de?de+=" ":de="",de+K.linkInline}if(pe==="<"&&M.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=a,O.highlightFormatting&&(N.formatting="link");var de=u(N);return de?de+=" ":de="",de+K.linkEmail}if(O.xml&&pe==="<"&&M.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var se=M.string.indexOf(">",M.pos);if(se!=-1){var J=M.string.substring(M.start,se);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(J)&&(N.md_inside=!0)}return M.backUp(1),N.htmlState=he.startState(Z),d(M,N,w)}if(O.xml&&pe==="<"&&M.match(/^\/\w*?>/))return N.md_inside=!1,"tag";if(pe==="*"||pe==="_"){for(var ee=1,ie=M.pos==1?" ":M.string.charAt(M.pos-2);ee<3&&M.eat(pe);)ee++;var fe=M.peek()||" ",Ae=!/\s/.test(fe)&&(!h.test(fe)||/\s/.test(ie)||h.test(ie)),ge=!/\s/.test(ie)&&(!h.test(ie)||/\s/.test(fe)||h.test(fe)),Oe=null,Pe=null;if(ee%2&&(!N.em&&Ae&&(pe==="*"||!ge||h.test(ie))?Oe=!0:N.em==pe&&ge&&(pe==="*"||!Ae||h.test(fe))&&(Oe=!1)),ee>1&&(!N.strong&&Ae&&(pe==="*"||!ge||h.test(ie))?Pe=!0:N.strong==pe&&ge&&(pe==="*"||!Ae||h.test(fe))&&(Pe=!1)),Pe!=null||Oe!=null){O.highlightFormatting&&(N.formatting=Oe==null?"strong":Pe==null?"em":"strong em"),Oe===!0&&(N.em=pe),Pe===!0&&(N.strong=pe);var ae=u(N);return Oe===!1&&(N.em=!1),Pe===!1&&(N.strong=!1),ae}}else if(pe===" "&&(M.eat("*")||M.eat("_"))){if(M.peek()===" ")return u(N);M.backUp(1)}if(O.strikethrough){if(pe==="~"&&M.eatWhile(pe)){if(N.strikethrough){O.highlightFormatting&&(N.formatting="strikethrough");var ae=u(N);return N.strikethrough=!1,ae}else if(M.match(/^[^\s]/,!1))return N.strikethrough=!0,O.highlightFormatting&&(N.formatting="strikethrough"),u(N)}else if(pe===" "&&M.match(/^~~/,!0)){if(M.peek()===" ")return u(N);M.backUp(2)}}if(O.emoji&&pe===":"&&M.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){N.emoji=!0,O.highlightFormatting&&(N.formatting="emoji");var je=u(N);return N.emoji=!1,je}return pe===" "&&(M.match(/^ +$/,!1)?N.trailingSpace++:N.trailingSpace&&(N.trailingSpaceNewLine=!0)),u(N)}function a(M,N){var Y=M.next();if(Y===">"){N.f=N.inline=s,O.highlightFormatting&&(N.formatting="link");var oe=u(N);return oe?oe+=" ":oe="",oe+K.linkInline}return M.match(/^[^>]+/,!0),K.linkInline}function T(M,N){if(M.eatSpace())return null;var Y=M.next();return Y==="("||Y==="["?(N.f=N.inline=x(Y==="("?")":"]"),O.highlightFormatting&&(N.formatting="link-string"),N.linkHref=!0,u(N)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function x(M){return function(N,Y){var oe=N.next();if(oe===M){Y.f=Y.inline=s,O.highlightFormatting&&(Y.formatting="link-string");var pe=u(Y);return Y.linkHref=!1,pe}return N.match(m[M]),Y.linkHref=!0,u(Y)}}function D(M,N){return M.match(/^([^\]\\]|\\.)*\]:/,!1)?(N.f=j,M.next(),O.highlightFormatting&&(N.formatting="link"),N.linkText=!0,u(N)):l(M,N,s)}function j(M,N){if(M.match(/^\]:/,!0)){N.f=N.inline=z,O.highlightFormatting&&(N.formatting="link");var Y=u(N);return N.linkText=!1,Y}return M.match(/^([^\]\\]|\\.)+/,!0),K.linkText}function z(M,N){return M.eatSpace()?null:(M.match(/^[^\s]+/,!0),M.peek()===void 0?N.linkTitle=!0:M.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),N.f=N.inline=s,K.linkHref+" url")}var V={startState:function(){return{f:p,prevLine:{stream:null},thisLine:{stream:null},block:p,htmlState:null,indentation:0,inline:s,text:f,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(M){return{f:M.f,prevLine:M.prevLine,thisLine:M.thisLine,block:M.block,htmlState:M.htmlState&&he.copyState(Z,M.htmlState),indentation:M.indentation,localMode:M.localMode,localState:M.localMode?he.copyState(M.localMode,M.localState):null,inline:M.inline,text:M.text,formatting:!1,linkText:M.linkText,linkTitle:M.linkTitle,linkHref:M.linkHref,code:M.code,em:M.em,strong:M.strong,strikethrough:M.strikethrough,emoji:M.emoji,header:M.header,setext:M.setext,hr:M.hr,taskList:M.taskList,list:M.list,listStack:M.listStack.slice(0),quote:M.quote,indentedCode:M.indentedCode,trailingSpace:M.trailingSpace,trailingSpaceNewLine:M.trailingSpaceNewLine,md_inside:M.md_inside,fencedEndRE:M.fencedEndRE}},token:function(M,N){if(N.formatting=!1,M!=N.thisLine.stream){if(N.header=0,N.hr=!1,M.match(/^\s*$/,!0))return v(N),null;if(N.prevLine=N.thisLine,N.thisLine={stream:M},N.taskList=!1,N.trailingSpace=0,N.trailingSpaceNewLine=!1,!N.localState&&(N.f=N.block,N.f!=w)){var Y=M.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(N.indentation=Y,N.indentationDiff=null,Y>0)return null}}return N.f(M,N)},innerMode:function(M){return M.block==w?{state:M.htmlState,mode:Z}:M.localState?{state:M.localState,mode:M.localMode}:{state:M,mode:V}},indent:function(M,N,Y){return M.block==w&&Z.indent?Z.indent(M.htmlState,N,Y):M.localState&&M.localMode.indent?M.localMode.indent(M.localState,N,Y):he.Pass},blankLine:v,getType:u,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),he.defineMIME("text/markdown","markdown"),he.defineMIME("text/x-markdown","markdown")})},osHv:function(Et,rt,re){(function(he){he(re("VrN/"))})(function(he){"use strict";var $=he.Pos;function O(h,o){return h.line-o.line||h.ch-o.ch}var Z="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",F=Z+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",I=new RegExp("<(/?)(["+Z+"]["+F+"]*)","g");function K(h,o,l,d){this.line=o,this.ch=l,this.cm=h,this.text=h.getLine(o),this.min=d?Math.max(d.from,h.firstLine()):h.firstLine(),this.max=d?Math.min(d.to-1,h.lastLine()):h.lastLine()}function B(h,o){var l=h.cm.getTokenTypeAt($(h.line,o));return l&&/\btag\b/.test(l)}function P(h){return h.line>=h.max?void 0:(h.ch=0,h.text=h.cm.getLine(++h.line),!0)}function R(h){return h.line<=h.min?void 0:(h.text=h.cm.getLine(--h.line),h.ch=h.text.length,!0)}function y(h){for(;;){var o=h.text.indexOf(">",h.ch);if(o==-1){if(P(h))continue;return}if(!B(h,o+1)){h.ch=o+1;continue}var l=h.text.lastIndexOf("/",o),d=l>-1&&!/\S/.test(h.text.slice(l+1,o));return h.ch=o+1,d?"selfClose":"regular"}}function A(h){for(;;){var o=h.ch?h.text.lastIndexOf("<",h.ch-1):-1;if(o==-1){if(R(h))continue;return}if(!B(h,o+1)){h.ch=o;continue}I.lastIndex=o,h.ch=o;var l=I.exec(h.text);if(l&&l.index==o)return l}}function _(h){for(;;){I.lastIndex=h.ch;var o=I.exec(h.text);if(!o){if(P(h))continue;return}if(!B(h,o.index+1)){h.ch=o.index+1;continue}return h.ch=o.index+o[0].length,o}}function k(h){for(;;){var o=h.ch?h.text.lastIndexOf(">",h.ch-1):-1;if(o==-1){if(R(h))continue;return}if(!B(h,o+1)){h.ch=o;continue}var l=h.text.lastIndexOf("/",o),d=l>-1&&!/\S/.test(h.text.slice(l+1,o));return h.ch=o+1,d?"selfClose":"regular"}}function C(h,o){for(var l=[];;){var d=_(h),S,v=h.line,p=h.ch-(d?d[0].length:0);if(!d||!(S=y(h)))return;if(S=="selfClose")continue;if(d[1]){for(var w=l.length-1;w>=0;--w)if(l[w]==d[2]){l.length=w;break}if(w<0&&(!o||o==d[2]))return{tag:d[2],from:$(v,p),to:$(h.line,h.ch)}}else l.push(d[2])}}function E(h,o){for(var l=[];;){var d=k(h);if(!d)return;if(d=="selfClose"){A(h);continue}var S=h.line,v=h.ch,p=A(h);if(!p)return;if(p[1])l.push(p[2]);else{for(var w=l.length-1;w>=0;--w)if(l[w]==p[2]){l.length=w;break}if(w<0&&(!o||o==p[2]))return{tag:p[2],from:$(h.line,h.ch),to:$(S,v)}}}}he.registerHelper("fold","xml",function(h,o){for(var l=new K(h,o.line,0);;){var d=_(l);if(!d||l.line!=o.line)return;var S=y(l);if(!S)return;if(!d[1]&&S!="selfClose"){var v=$(l.line,l.ch),p=C(l,d[2]);return p&&O(p.from,v)>0?{from:v,to:p.from}:null}}}),he.findMatchingTag=function(h,o,l){var d=new K(h,o.line,o.ch,l);if(d.text.indexOf(">")==-1&&d.text.indexOf("<")==-1)return;var S=y(d),v=S&&$(d.line,d.ch),p=S&&A(d);if(!S||!p||O(d,o)>0)return;var w={from:$(d.line,d.ch),to:v,tag:p[2]};return S=="selfClose"?{open:w,close:null,at:"open"}:p[1]?{open:E(d,p[2]),close:w,at:"close"}:(d=new K(h,v.line,v.ch,l),{open:w,close:C(d,p[2]),at:"open"})},he.findEnclosingTag=function(h,o,l,d){for(var S=new K(h,o.line,o.ch,l);;){var v=E(S,d);if(!v)break;var p=new K(h,o.line,o.ch,l),w=C(p,v.tag);if(w)return{open:v,close:w}}},he.scanForClosingTag=function(h,o,l,d){var S=new K(h,o.line,o.ch,d?{from:0,to:d}:null);return C(S,l)}})},p5ED:function(Et,rt,re){"use strict";var he=re("+L6B"),$=re("2/Rp"),O=re("5Dmo"),Z=re("3S7+"),F=re("k1fw"),I=re("9og8"),K=re("tJVT"),B=re("WmNS"),P=re.n(B),R=re("q1tI"),y=re.n(R),A=re("vHTk"),_=re.n(A),k=re("yEEn"),C=re("ZW9T"),E=re("1vsH"),h=re("V0Rq"),o=re("m3rI");rt.a=function(l){var d,S,v,p,w,b,u,f=l.editOffice,s=f===void 0?"view":f,a=l.data,T=l.theme,m=l.type,x=l.filename,D=l.monacoEditor,j=l.className,z=l.style,V=l.close,M=l.onClose,N=l.hasMask,Y=l.disabledDownload,oe=Object(R.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),pe=Object(K.a)(oe,2),ve=pe[0],Le=pe[1],ke=Object(R.useState)(""),ce=Object(K.a)(ke,2),ae=ce[0],de=ce[1],ne=Object(R.useState)(),se=Object(K.a)(ne,2),J=se[0],ee=se[1],ie=window.ENV==="build"?"/react/build":"",fe=o.a.PROXY_SERVER||location.origin,Ae,ge=1024*1024,Oe=10*ge,Pe=Object(R.useRef)();(d=a)!==null&&d!==void 0&&d.startsWith("/api")&&m!=="txt"&&(a=o.a.API_SERVER+a),m==="office"&&(Ae=Object(E.T)(a).filesize,Ae>Oe&&(m="other")),x&&D&&(D.filename=x),Object(R.useEffect)(function(){var Fe,qe,De=(Fe=document.cookie)===null||Fe===void 0||((qe=Fe.replace(/\s/g,""))===null||qe===void 0)?void 0:qe.split(";");De==null||De.map(function(Ne){var Be=Ne.split("=");Be[0]==="_educoder_session"&&de(Be[1])})},[]),Object(R.useEffect)(function(){m==="office"&&je()},[m,a]);var je=function(){var Fe=Object(I.a)(P.a.mark(function qe(){var De,Ne,Be;return P.a.wrap(function(Ge){for(;;)switch(Ge.prev=Ge.next){case 0:return console.log("data:",a),De=a,a.startsWith("http")||(De=location.origin+De),Ne=new URL(De).pathname.split("/").pop(),Ge.next=6,Object(h.V)({attachment_id:Ne});case 6:Be=Ge.sent,ee(Be);case 8:case"end":return Ge.stop()}},qe)}));return function(){return Fe.apply(this,arguments)}}(),Ke=function(){if(a.startsWith("http")||a.startsWith("blob:")){He();return}Object(E.z)(x||"educoder",a,x)},He=function(){Object(E.x)(x||"educoder",decodeURIComponent(a))};return y.a.createElement("div",{style:Object(F.a)({},z||{}),className:"".concat(N&&_.a.bgBlack," ").concat(m?_.a.wrp:"hide")},V&&y.a.createElement("div",{className:_.a.close,ref:Pe},!Y&&y.a.createElement(Z.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return Pe.current}},y.a.createElement("span",{onClick:He},y.a.createElement("i",{className:"icon-quxiaozhiding"}))),y.a.createElement(Z.a,{title:"\u5173\u95ED",getPopupContainer:function(){return Pe.current}},y.a.createElement("span",{className:"",onClick:M},y.a.createElement("i",{className:"icon-guanbi1"})))),y.a.createElement("div",{className:"".concat(_.a[j]," ").concat(j," ").concat(_.a.monaco," ").concat(m==="txt"?"show":"hide")},m==="txt"&&y.a.createElement(C.b,D)),m==="audio"&&y.a.createElement("audio",{src:"".concat(((S=a)===null||S===void 0?void 0:S.indexOf("http://"))>-1||((v=a)===null||v===void 0?void 0:v.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(a),autoPlay:!0}),m==="video"&&y.a.createElement(y.a.Fragment,null,((p=a)===null||p===void 0?void 0:p.indexOf("http"))>-1?y.a.createElement("video",{controls:!0,src:"".concat(a),autoPlay:!0}):y.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(a),autoPlay:!0})),m==="office"&&J&&y.a.createElement("iframe",{src:"".concat(ie,"/office.html?key=").concat(J.key,"&url=").concat(fe+J.url,"&callbackUrl=").concat(fe+J.callbackUrl,"&fileType=").concat(J.fileType,"&title=").concat(J.title,"&model=").concat(s,"&officeServer=").concat(o.a.OFFICE_SERVER,"&disabledDownload=").concat(!!Y)}),m==="html"&&y.a.createElement("iframe",{src:a+"&disposition=inline"}),m==="pdf"&&y.a.createElement("iframe",{src:"".concat(ie,"/js/pdfview/index.html?url=").concat(a,"&disabledDownload=").concat(!!Y)}),m==="image"&&y.a.createElement("img",{src:"".concat(((w=a)===null||w===void 0?void 0:w.indexOf("http://"))>-1||((b=a)===null||b===void 0?void 0:b.indexOf("https://"))>-1||(u=a)!==null&&u!==void 0&&u.startsWith("/api")?"":"data:image/png;base64,").concat(a)}),m==="other"&&y.a.createElement("div",null,y.a.createElement($.a,{type:"primary",size:"large",onClick:Ke},y.a.createElement(k.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),m==="download"&&y.a.createElement($.a,{type:"primary",size:"large",onClick:Ke},y.a.createElement(k.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(Et,rt,re){},rUJ1:function(Et,rt){const re=/[&<>"']/,he=/[&<>"']/g,$=/[<>"']|&(?!#?\w+;)/,O=/[<>"']|&(?!#?\w+;)/g,Z={"&":"&","<":"<",">":">",'"':""","'":"'"},F=b=>Z[b];function I(b,u){if(u){if(re.test(b))return b.replace(he,F)}else if($.test(b))return b.replace(O,F);return b}const K=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function B(b){return b.replace(K,(u,f)=>(f=f.toLowerCase(),f==="colon"?":":f.charAt(0)==="#"?f.charAt(1)==="x"?String.fromCharCode(parseInt(f.substring(2),16)):String.fromCharCode(+f.substring(1)):""))}const P=/(^|[^\[])\^/g;function R(b,u){b=b.source||b,u=u||"";const f={replace:(s,a)=>(a=a.source||a,a=a.replace(P,"$1"),b=b.replace(s,a),f),getRegex:()=>new RegExp(b,u)};return f}const y=/[^\w:]/g,A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function _(b,u,f){if(b){let s;try{s=decodeURIComponent(B(f)).replace(y,"").toLowerCase()}catch(a){return null}if(s.indexOf("javascript:")===0||s.indexOf("vbscript:")===0||s.indexOf("data:")===0)return null}u&&!A.test(f)&&(f=o(u,f));try{f=encodeURI(f).replace(/%25/g,"%")}catch(s){return null}return f}const k={},C=/^[^:]+:\/*[^/]*$/,E=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(b,u){k[" "+b]||(C.test(b)?k[" "+b]=b+"/":k[" "+b]=v(b,"/",!0)),b=k[" "+b];const f=b.indexOf(":")===-1;return u.substring(0,2)==="//"?f?u:b.replace(E,"$1")+u:u.charAt(0)==="/"?f?u:b.replace(h,"$1")+u:b+u}const l={exec:function(){}};function d(b){let u=1,f,s;for(;u<arguments.length;u++){f=arguments[u];for(s in f)Object.prototype.hasOwnProperty.call(f,s)&&(b[s]=f[s])}return b}function S(b,u){const f=b.replace(/\|/g,(T,m,x)=>{let D=!1,j=m;for(;--j>=0&&x[j]==="\\";)D=!D;return D?"|":" |"}),s=f.split(/ \|/);let a=0;if(s.length>u)s.splice(u);else for(;s.length<u;)s.push("");for(;a<s.length;a++)s[a]=s[a].trim().replace(/\\\|/g,"|");return s}function v(b,u,f){const s=b.length;if(s===0)return"";let a=0;for(;a<s;){const T=b.charAt(s-a-1);if(T===u&&!f)a++;else if(T!==u&&f)a++;else break}return b.substr(0,s-a)}function p(b,u){if(b.indexOf(u[1])===-1)return-1;const f=b.length;let s=0,a=0;for(;a<f;a++)if(b[a]==="\\")a++;else if(b[a]===u[0])s++;else if(b[a]===u[1]&&(s--,s<0))return a;return-1}function w(b){b&&b.sanitize&&!b.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}Et.exports={escape:I,unescape:B,edit:R,cleanUrl:_,resolveUrl:o,noopTest:l,merge:d,splitCells:S,rtrim:v,findClosingBracket:p,checkSanitizeDeprecation:w}},sboe:function(Et,rt,re){"use strict";re.d(rt,"a",function(){return O});var he=re("q1tI"),$=re.n(he),O=he.createContext(null)},uK0f:function(Et,rt,re){(function(he,$){Et.exports=$()})(this,function(){"use strict";function he($,O,Z){Z=Z||{},Z.childrenKeyName=Z.childrenKeyName||"children";var F=$||[],I=[],K=0;do{var B=F.filter(function(P){return O(P,K)})[0];if(!B)break;I.push(B),F=B[Z.childrenKeyName]||[],K+=1}while(F.length>0);return I}return he})},ulZh:function(Et,rt,re){typeof window!="undefined"&&function($,O){Et.exports=O()}(this,function(){return function(he){var $={};function O(Z){if($[Z])return $[Z].exports;var F=$[Z]={i:Z,l:!1,exports:{}};return he[Z].call(F.exports,F,F.exports,O),F.l=!0,F.exports}return O.m=he,O.c=$,O.d=function(Z,F,I){O.o(Z,F)||Object.defineProperty(Z,F,{enumerable:!0,get:I})},O.r=function(Z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Z,"__esModule",{value:!0})},O.t=function(Z,F){if(F&1&&(Z=O(Z)),F&8)return Z;if(F&4&&typeof Z=="object"&&Z&&Z.__esModule)return Z;var I=Object.create(null);if(O.r(I),Object.defineProperty(I,"default",{enumerable:!0,value:Z}),F&2&&typeof Z!="string")for(var K in Z)O.d(I,K,function(B){return Z[B]}.bind(null,K));return I},O.n=function(Z){var F=Z&&Z.__esModule?function(){return Z.default}:function(){return Z};return O.d(F,"a",F),F},O.o=function(Z,F){return Object.prototype.hasOwnProperty.call(Z,F)},O.p="/dist/",O(O.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(he,$,O){"use strict";var Z=Object.prototype.hasOwnProperty,F="~";function I(){}Object.create&&(I.prototype=Object.create(null),new I().__proto__||(F=!1));function K(y,A,_){this.fn=y,this.context=A,this.once=_||!1}function B(y,A,_,k,C){if(typeof _!="function")throw new TypeError("The listener must be a function");var E=new K(_,k||y,C),h=F?F+A:A;return y._events[h]?y._events[h].fn?y._events[h]=[y._events[h],E]:y._events[h].push(E):(y._events[h]=E,y._eventsCount++),y}function P(y,A){--y._eventsCount===0?y._events=new I:delete y._events[A]}function R(){this._events=new I,this._eventsCount=0}R.prototype.eventNames=function(){var A=[],_,k;if(this._eventsCount===0)return A;for(k in _=this._events)Z.call(_,k)&&A.push(F?k.slice(1):k);return Object.getOwnPropertySymbols?A.concat(Object.getOwnPropertySymbols(_)):A},R.prototype.listeners=function(A){var _=F?F+A:A,k=this._events[_];if(!k)return[];if(k.fn)return[k.fn];for(var C=0,E=k.length,h=new Array(E);C<E;C++)h[C]=k[C].fn;return h},R.prototype.listenerCount=function(A){var _=F?F+A:A,k=this._events[_];return k?k.fn?1:k.length:0},R.prototype.emit=function(A,_,k,C,E,h){var o=F?F+A:A;if(!this._events[o])return!1;var l=this._events[o],d=arguments.length,S,v;if(l.fn){l.once&&this.removeListener(A,l.fn,void 0,!0);switch(d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,_),!0;case 3:return l.fn.call(l.context,_,k),!0;case 4:return l.fn.call(l.context,_,k,C),!0;case 5:return l.fn.call(l.context,_,k,C,E),!0;case 6:return l.fn.call(l.context,_,k,C,E,h),!0}for(v=1,S=new Array(d-1);v<d;v++)S[v-1]=arguments[v];l.fn.apply(l.context,S)}else{var p=l.length,w;for(v=0;v<p;v++){l[v].once&&this.removeListener(A,l[v].fn,void 0,!0);switch(d){case 1:l[v].fn.call(l[v].context);break;case 2:l[v].fn.call(l[v].context,_);break;case 3:l[v].fn.call(l[v].context,_,k);break;case 4:l[v].fn.call(l[v].context,_,k,C);break;default:if(!S)for(w=1,S=new Array(d-1);w<d;w++)S[w-1]=arguments[w];l[v].fn.apply(l[v].context,S)}}}return!0},R.prototype.on=function(A,_,k){return B(this,A,_,k,!1)},R.prototype.once=function(A,_,k){return B(this,A,_,k,!0)},R.prototype.removeListener=function(A,_,k,C){var E=F?F+A:A;if(!this._events[E])return this;if(!_)return P(this,E),this;var h=this._events[E];if(h.fn)h.fn===_&&(!C||h.once)&&(!k||h.context===k)&&P(this,E);else{for(var o=0,l=[],d=h.length;o<d;o++)(h[o].fn!==_||C&&!h[o].once||k&&h[o].context!==k)&&l.push(h[o]);l.length?this._events[E]=l.length===1?l[0]:l:P(this,E)}return this},R.prototype.removeAllListeners=function(A){var _;return A?(_=F?F+A:A,this._events[_]&&P(this,_)):(this._events=new I,this._eventsCount=0),this},R.prototype.off=R.prototype.removeListener,R.prototype.addListener=R.prototype.on,R.prefixed=F,R.EventEmitter=R,he.exports=R},"./node_modules/url-toolkit/src/url-toolkit.js":function(he,$,O){(function(Z){var F=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,I=/^([^\/?#]*)([^]*)$/,K=/(?:\/|^)\.(?=\/)/g,B=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,P={buildAbsoluteURL:function(R,y,A){if(A=A||{},R=R.trim(),y=y.trim(),!y){if(!A.alwaysNormalize)return R;var _=P.parseURL(R);if(!_)throw new Error("Error trying to parse base URL.");return _.path=P.normalizePath(_.path),P.buildURLFromParts(_)}var k=P.parseURL(y);if(!k)throw new Error("Error trying to parse relative URL.");if(k.scheme)return A.alwaysNormalize?(k.path=P.normalizePath(k.path),P.buildURLFromParts(k)):y;var C=P.parseURL(R);if(!C)throw new Error("Error trying to parse base URL.");if(!C.netLoc&&C.path&&C.path[0]!=="/"){var E=I.exec(C.path);C.netLoc=E[1],C.path=E[2]}C.netLoc&&!C.path&&(C.path="/");var h={scheme:C.scheme,netLoc:k.netLoc,path:null,params:k.params,query:k.query,fragment:k.fragment};if(!k.netLoc&&(h.netLoc=C.netLoc,k.path[0]!=="/"))if(!k.path)h.path=C.path,k.params||(h.params=C.params,k.query||(h.query=C.query));else{var o=C.path,l=o.substring(0,o.lastIndexOf("/")+1)+k.path;h.path=P.normalizePath(l)}return h.path===null&&(h.path=A.alwaysNormalize?P.normalizePath(k.path):k.path),P.buildURLFromParts(h)},parseURL:function(R){var y=F.exec(R);return y?{scheme:y[1]||"",netLoc:y[2]||"",path:y[3]||"",params:y[4]||"",query:y[5]||"",fragment:y[6]||""}:null},normalizePath:function(R){for(R=R.split("").reverse().join("").replace(K,"");R.length!==(R=R.replace(B,"")).length;);return R.split("").reverse().join("")},buildURLFromParts:function(R){return R.scheme+R.netLoc+R.path+R.params+R.query+R.fragment}};he.exports=P})(this)},"./node_modules/webworkify-webpack/index.js":function(he,$,O){function Z(A){var _={};function k(E){if(_[E])return _[E].exports;var h=_[E]={i:E,l:!1,exports:{}};return A[E].call(h.exports,h,h.exports,k),h.l=!0,h.exports}k.m=A,k.c=_,k.i=function(E){return E},k.d=function(E,h,o){k.o(E,h)||Object.defineProperty(E,h,{configurable:!1,enumerable:!0,get:o})},k.r=function(E){Object.defineProperty(E,"__esModule",{value:!0})},k.n=function(E){var h=E&&E.__esModule?function(){return E.default}:function(){return E};return k.d(h,"a",h),h},k.o=function(E,h){return Object.prototype.hasOwnProperty.call(E,h)},k.p="/",k.oe=function(E){throw console.error(E),E};var C=k(k.s=ENTRY_MODULE);return C.default||C}var F="[\\.|\\-|\\+|\\w|/|@]+",I="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+F+").*?\\)";function K(A){return(A+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function B(A){return!isNaN(1*A)}function P(A,_,k){var C={};C[k]=[];var E=_.toString(),h=E.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!h)return C;for(var o=h[1],l=new RegExp("(\\\\n|\\W)"+K(o)+I,"g"),d;d=l.exec(E);){if(d[3]==="dll-reference")continue;C[k].push(d[3])}for(l=new RegExp("\\("+K(o)+'\\("(dll-reference\\s('+F+'))"\\)\\)'+I,"g");d=l.exec(E);)A[d[2]]||(C[k].push(d[1]),A[d[2]]=O(d[1]).m),C[d[2]]=C[d[2]]||[],C[d[2]].push(d[4]);for(var S=Object.keys(C),v=0;v<S.length;v++)for(var p=0;p<C[S[v]].length;p++)B(C[S[v]][p])&&(C[S[v]][p]=1*C[S[v]][p]);return C}function R(A){var _=Object.keys(A);return _.reduce(function(k,C){return k||A[C].length>0},!1)}function y(A,_){for(var k={main:[_]},C={main:[]},E={main:{}};R(k);)for(var h=Object.keys(k),o=0;o<h.length;o++){var l=h[o],d=k[l],S=d.pop();if(E[l]=E[l]||{},E[l][S]||!A[l][S])continue;E[l][S]=!0,C[l]=C[l]||[],C[l].push(S);for(var v=P(A,A[l][S],l),p=Object.keys(v),w=0;w<p.length;w++)k[p[w]]=k[p[w]]||[],k[p[w]]=k[p[w]].concat(v[p[w]])}return C}he.exports=function(A,_){_=_||{};var k={main:O.m},C=_.all?{main:Object.keys(k.main)}:y(k,A),E="";Object.keys(C).filter(function(S){return S!=="main"}).forEach(function(S){for(var v=0;C[S][v];)v++;C[S].push(v),k[S][v]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",E=E+"var "+S+" = ("+Z.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+C[S].map(function(p){return""+JSON.stringify(p)+": "+k[S][p].toString()}).join(",")+`});
|
|
`}),E=E+"new (("+Z.toString().replace("ENTRY_MODULE",JSON.stringify(A))+")({"+C.main.map(function(S){return""+JSON.stringify(S)+": "+k.main[S].toString()}).join(",")+"}))(self);";var h=new window.Blob([E],{type:"text/javascript"});if(_.bare)return h;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,l=o.createObjectURL(h),d=new window.Worker(l);return d.objectURL=l,d}},"./src/config.ts":function(he,$,O){"use strict";O.r($),O.d($,"hlsDefaultConfig",function(){return w}),O.d($,"mergeConfig",function(){return u}),O.d($,"enableStreamingMode",function(){return f});var Z=O("./src/controller/abr-controller.ts"),F=O("./src/controller/audio-stream-controller.ts"),I=O("./src/controller/audio-track-controller.ts"),K=O("./src/controller/subtitle-stream-controller.ts"),B=O("./src/controller/subtitle-track-controller.ts"),P=O("./src/controller/buffer-controller.ts"),R=O("./src/controller/timeline-controller.ts"),y=O("./src/controller/cap-level-controller.ts"),A=O("./src/controller/fps-controller.ts"),_=O("./src/controller/eme-controller.ts"),k=O("./src/controller/cmcd-controller.ts"),C=O("./src/utils/xhr-loader.ts"),E=O("./src/utils/fetch-loader.ts"),h=O("./src/utils/cues.ts"),o=O("./src/utils/mediakeys-helper.ts"),l=O("./src/utils/logger.ts");function d(){return d=Object.assign||function(s){for(var a=1;a<arguments.length;a++){var T=arguments[a];for(var m in T)Object.prototype.hasOwnProperty.call(T,m)&&(s[m]=T[m])}return s},d.apply(this,arguments)}function S(s,a){var T=Object.keys(s);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(s);a&&(m=m.filter(function(x){return Object.getOwnPropertyDescriptor(s,x).enumerable})),T.push.apply(T,m)}return T}function v(s){for(var a=1;a<arguments.length;a++){var T=arguments[a]!=null?arguments[a]:{};a%2?S(Object(T),!0).forEach(function(m){p(s,m,T[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(T)):S(Object(T)).forEach(function(m){Object.defineProperty(s,m,Object.getOwnPropertyDescriptor(T,m))})}return s}function p(s,a,T){return a in s?Object.defineProperty(s,a,{value:T,enumerable:!0,configurable:!0,writable:!0}):s[a]=T,s}var w=v(v({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:C.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Z.default,bufferController:P.default,capLevelController:y.default,fpsController:A.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},b()),{},{subtitleStreamController:K.SubtitleStreamController,subtitleTrackController:B.default,timelineController:R.TimelineController,audioStreamController:F.default,audioTrackController:I.default,emeController:_.default,cmcdController:k.default});function b(){return{cueHandler:h.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function u(s,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return d({},s,a)}function f(s){var a=s.loader;if(a!==E.default&&a!==C.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1;else{var T=Object(E.fetchSupported)();T&&(s.loader=E.default,s.progressive=!0,s.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(he,$,O){"use strict";O.r($);var Z=O("./src/polyfills/number.ts"),F=O("./src/utils/ewma-bandwidth-estimator.ts"),I=O("./src/events.ts"),K=O("./src/utils/buffer-helper.ts"),B=O("./src/errors.ts"),P=O("./src/types/loader.ts"),R=O("./src/utils/logger.ts");function y(k,C){for(var E=0;E<C.length;E++){var h=C[E];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(k,h.key,h)}}function A(k,C,E){return C&&y(k.prototype,C),E&&y(k,E),k}var _=function(){function k(E){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=E;var h=E.config;this.bwEstimator=new F.default(h.abrEwmaSlowVoD,h.abrEwmaFastVoD,h.abrEwmaDefaultEstimate),this.registerListeners()}var C=k.prototype;return C.registerListeners=function(){var h=this.hls;h.on(I.Events.FRAG_LOADING,this.onFragLoading,this),h.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),h.on(I.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(I.Events.ERROR,this.onError,this)},C.unregisterListeners=function(){var h=this.hls;h.off(I.Events.FRAG_LOADING,this.onFragLoading,this),h.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(I.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(I.Events.ERROR,this.onError,this)},C.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},C.onFragLoading=function(h,o){var l=o.frag;if(l.type===P.PlaylistLevelType.MAIN&&!this.timer){var d;this.fragCurrent=l,this.partCurrent=(d=o.part)!=null?d:null,this.timer=self.setInterval(this.onCheck,100)}},C.onLevelLoaded=function(h,o){var l=this.hls.config;o.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},C._abandonRulesCheck=function(){var h=this.fragCurrent,o=this.partCurrent,l=this.hls,d=l.autoLevelEnabled,S=l.config,v=l.media;if(!h||!v)return;var p=o?o.stats:h.stats,w=o?o.duration:h.duration;if(p.aborted){R.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!d||v.paused||!v.playbackRate||!v.readyState)return;var b=performance.now()-p.loading.start,u=Math.abs(v.playbackRate);if(b<=500*w/u)return;var f=l.levels,s=l.minAutoLevel,a=f[h.level],T=p.total||Math.max(p.loaded,Math.round(w*a.maxBitrate/8)),m=Math.max(1,p.bwEstimate?p.bwEstimate/8:p.loaded*1e3/b),x=(T-p.loaded)/m,D=v.currentTime,j=(K.BufferHelper.bufferInfo(v,D,S.maxBufferHole).end-D)/u;if(j>=2*w/u||x<=j)return;var z=Number.POSITIVE_INFINITY,V;for(V=h.level-1;V>s;V--){var M=f[V].maxBitrate;if(z=w*M/(8*.8*m),z<j)break}if(z>=x)return;var N=this.bwEstimator.getEstimate();R.logger.warn("Fragment "+h.sn+(o?" part "+o.index:"")+" of level "+h.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+`
|
|
Current BW estimate: `+(Object(Z.isFiniteNumber)(N)?(N/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+x.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+z.toFixed(3)+` s
|
|
Time to underbuffer: `+j.toFixed(3)+" s"),l.nextLoadLevel=V,this.bwEstimator.sample(b,p.loaded),this.clearTimer(),h.loader&&(this.fragCurrent=this.partCurrent=null,h.loader.abort()),l.trigger(I.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:h,part:o,stats:p})},C.onFragLoaded=function(h,o){var l=o.frag,d=o.part;if(l.type===P.PlaylistLevelType.MAIN&&Object(Z.isFiniteNumber)(l.sn)){var S=d?d.stats:l.stats,v=d?d.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var p=this.hls.levels[l.level],w=(p.loaded?p.loaded.bytes:0)+S.loaded,b=(p.loaded?p.loaded.duration:0)+v;p.loaded={bytes:w,duration:b},p.realBitrate=Math.round(8*w/b)}if(l.bitrateTest){var u={stats:S,frag:l,part:d,id:l.type};this.onFragBuffered(I.Events.FRAG_BUFFERED,u),l.bitrateTest=!1}}},C.onFragBuffered=function(h,o){var l=o.frag,d=o.part,S=d?d.stats:l.stats;if(S.aborted)return;if(l.type!==P.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var v=S.parsing.end-S.loading.start;this.bwEstimator.sample(v,S.loaded),S.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=v/1e3:this.bitrateTestDelay=0},C.onError=function(h,o){switch(o.details){case B.ErrorDetails.FRAG_LOAD_ERROR:case B.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},C.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},C.getNextABRAutoLevel=function(){var h=this.fragCurrent,o=this.partCurrent,l=this.hls,d=l.maxAutoLevel,S=l.config,v=l.minAutoLevel,p=l.media,w=o?o.duration:h?h.duration:0,b=p?p.currentTime:0,u=p&&p.playbackRate!==0?Math.abs(p.playbackRate):1,f=this.bwEstimator?this.bwEstimator.getEstimate():S.abrEwmaDefaultEstimate,s=(K.BufferHelper.bufferInfo(p,b,S.maxBufferHole).end-b)/u,a=this.findBestLevel(f,v,d,s,S.abrBandWidthFactor,S.abrBandWidthUpFactor);if(a>=0)return a;R.logger.trace((s?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var T=w?Math.min(w,S.maxStarvationDelay):S.maxStarvationDelay,m=S.abrBandWidthFactor,x=S.abrBandWidthUpFactor;if(!s){var D=this.bitrateTestDelay;if(D){var j=w?Math.min(w,S.maxLoadingDelay):S.maxLoadingDelay;T=j-D,R.logger.trace("bitrate test took "+Math.round(1e3*D)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*T)+" ms"),m=x=1}}return a=this.findBestLevel(f,v,d,s+T,m,x),Math.max(a,0)},C.findBestLevel=function(h,o,l,d,S,v){for(var p,w=this.fragCurrent,b=this.partCurrent,u=this.lastLoadedFragLevel,f=this.hls.levels,s=f[u],a=!!(s!=null&&(p=s.details)!==null&&p!==void 0&&p.live),T=s==null?void 0:s.codecSet,m=b?b.duration:w?w.duration:0,x=l;x>=o;x--){var D=f[x];if(!D||T&&D.codecSet!==T)continue;var j=D.details,z=(b?j==null?void 0:j.partTarget:j==null?void 0:j.averagetargetduration)||m,V=void 0;x<=u?V=S*h:V=v*h;var M=f[x].maxBitrate,N=M*z/V;if(R.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+x+"/"+Math.round(V)+"/"+M+"/"+z+"/"+d+"/"+N),V>M&&(!N||a&&!this.bitrateTestDelay||N<d))return x}return-1},A(k,[{key:"nextAutoLevel",get:function(){var h=this._nextAutoLevel,o=this.bwEstimator;if(h!==-1&&(!o||!o.canEstimate()))return h;var l=this.getNextABRAutoLevel();return h!==-1&&(l=Math.min(h,l)),l},set:function(h){this._nextAutoLevel=h}}]),k}();$.default=_},"./src/controller/audio-stream-controller.ts":function(he,$,O){"use strict";O.r($);var Z=O("./src/polyfills/number.ts"),F=O("./src/controller/base-stream-controller.ts"),I=O("./src/events.ts"),K=O("./src/utils/buffer-helper.ts"),B=O("./src/controller/fragment-tracker.ts"),P=O("./src/types/level.ts"),R=O("./src/types/loader.ts"),y=O("./src/loader/fragment.ts"),A=O("./src/demux/chunk-cache.ts"),_=O("./src/demux/transmuxer-interface.ts"),k=O("./src/types/transmuxer.ts"),C=O("./src/controller/fragment-finders.ts"),E=O("./src/utils/discontinuities.ts"),h=O("./src/errors.ts"),o=O("./src/utils/logger.ts");function l(){return l=Object.assign||function(w){for(var b=1;b<arguments.length;b++){var u=arguments[b];for(var f in u)Object.prototype.hasOwnProperty.call(u,f)&&(w[f]=u[f])}return w},l.apply(this,arguments)}function d(w,b){w.prototype=Object.create(b.prototype),w.prototype.constructor=w,S(w,b)}function S(w,b){return S=Object.setPrototypeOf||function(f,s){return f.__proto__=s,f},S(w,b)}var v=100,p=function(w){d(b,w);function b(f,s){var a;return a=w.call(this,f,s,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var u=b.prototype;return u.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},u._registerListeners=function(){var s=this.hls;s.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.on(I.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.on(I.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.on(I.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.on(I.Events.ERROR,this.onError,this),s.on(I.Events.BUFFER_RESET,this.onBufferReset,this),s.on(I.Events.BUFFER_CREATED,this.onBufferCreated,this),s.on(I.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.on(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(I.Events.FRAG_BUFFERED,this.onFragBuffered,this)},u._unregisterListeners=function(){var s=this.hls;s.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.off(I.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.off(I.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.off(I.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.off(I.Events.ERROR,this.onError,this),s.off(I.Events.BUFFER_RESET,this.onBufferReset,this),s.off(I.Events.BUFFER_CREATED,this.onBufferCreated,this),s.off(I.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.off(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(I.Events.FRAG_BUFFERED,this.onFragBuffered,this)},u.onInitPtsFound=function(s,a){var T=a.frag,m=a.id,x=a.initPTS;if(m==="main"){var D=T.cc;this.initPTS[T.cc]=x,this.log("InitPTS for cc: "+D+" found from main: "+x),this.videoTrackCC=D,this.state===F.State.WAITING_INIT_PTS&&this.tick()}},u.startLoad=function(s){if(!this.levels){this.startPosition=s,this.state=F.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(v),this.fragLoadError=0,a>0&&s===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=F.State.IDLE):(this.loadedmetadata=!1,this.state=F.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=s,this.tick()},u.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_TRACK:{var s,a=this.levels,T=this.trackId,m=a==null||((s=a[T])===null||s===void 0)?void 0:s.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=F.State.WAITING_INIT_PTS}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var x,D=performance.now(),j=this.retryDate;(!j||D>=j||(x=this.media)!==null&&x!==void 0&&x.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=F.State.IDLE);break}case F.State.WAITING_INIT_PTS:{var z=this.waitingData;if(z){var V=z.frag,M=z.part,N=z.cache,Y=z.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.FRAG_LOADING;var oe=N.flush(),pe={frag:V,part:M,payload:oe,networkDetails:null};this._handleFragmentLoadProgress(pe),Y&&w.prototype._handleFragmentLoadComplete.call(this,pe)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+V.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ve=this.getLoadPosition(),Le=K.BufferHelper.bufferInfo(this.mediaBuffer,ve,this.config.maxBufferHole),ke=Object(C.fragmentWithinToleranceTest)(Le.end,this.config.maxFragLookUpTolerance,V);ke<0&&(o.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+Le.end+" is needed"),this.clearWaitingFragment())}}else this.state=F.State.IDLE}}this.onTickEnd()},u.clearWaitingFragment=function(){var s=this.waitingData;s&&(this.fragmentTracker.removeFragment(s.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.IDLE)},u.onTickEnd=function(){var s=this.media;if(!s||!s.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:s,T=a.buffered;!this.loadedmetadata&&T.length&&(this.loadedmetadata=!0),this.lastCurrentTime=s.currentTime},u.doTickIdle=function(){var s,a,T=this.hls,m=this.levels,x=this.media,D=this.trackId,j=T.config;if(!m||!m[D])return;if(!x&&(this.startFragRequested||!j.startFragPrefetch))return;var z=m[D],V=z.details;if(!V||V.live&&this.levelLastLoaded!==D||this.waitForCdnTuneIn(V)){this.state=F.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,y.ElementaryStreamTypes.AUDIO,R.PlaylistLevelType.AUDIO));var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,R.PlaylistLevelType.AUDIO);if(M===null)return;var N=M.len,Y=this.getMaxBufferLength(),oe=this.audioSwitch;if(N>=Y&&!oe)return;if(!oe&&this._streamEnded(M,V)){T.trigger(I.Events.BUFFER_EOS,{type:"audio"}),this.state=F.State.ENDED;return}var pe=V.fragments,ve=pe[0].start,Le=M.end;if(oe){var ke=this.getLoadPosition();Le=ke,V.PTSKnown&&ke<ve&&((M.end>ve||M.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),x.currentTime=ve+.05))}var ce=this.getNextFragment(Le,V);if(!ce){this.bufferFlushed=!0;return}((s=ce.decryptdata)===null||s===void 0?void 0:s.keyFormat)==="identity"&&!((a=ce.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(ce,V):this.loadFragment(ce,V,Le)},u.getMaxBufferLength=function(){var s=w.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,R.PlaylistLevelType.MAIN);return a===null?s:Math.max(s,a.len)},u.onMediaDetaching=function(){this.videoBuffer=null,w.prototype.onMediaDetaching.call(this)},u.onAudioTracksUpdated=function(s,a){var T=a.audioTracks;this.resetTransmuxer(),this.levels=T.map(function(m){return new P.Level(m)})},u.onAudioTrackSwitching=function(s,a){var T=!!a.url;this.trackId=a.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),T?this.setInterval(v):this.resetTransmuxer(),T?(this.audioSwitch=!0,this.state=F.State.IDLE):this.state=F.State.STOPPED,this.tick()},u.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},u.onLevelLoaded=function(s,a){this.mainDetails=a.details},u.onAudioTrackLoaded=function(s,a){var T,m=this.levels,x=a.details,D=a.id;if(!m){this.warn("Audio tracks were reset while loading level "+D);return}this.log("Track "+D+" loaded ["+x.startSN+","+x.endSN+"],duration:"+x.totalduration);var j=m[D],z=0;if(x.live||(T=j.details)!==null&&T!==void 0&&T.live){var V=this.mainDetails;if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed||!V)return;!j.details&&x.hasProgramDateTime&&V.hasProgramDateTime?(Object(E.alignMediaPlaylistByPDT)(x,V),z=x.fragments[0].start):z=this.alignPlaylists(x,j.details)}j.details=x,this.levelLastLoaded=D,!this.startFragRequested&&(this.mainDetails||!x.live)&&this.setStartPosition(j.details,z),this.state===F.State.WAITING_TRACK&&!this.waitForCdnTuneIn(x)&&(this.state=F.State.IDLE),this.tick()},u._handleFragmentLoadProgress=function(s){var a,T=s.frag,m=s.part,x=s.payload,D=this.config,j=this.trackId,z=this.levels;if(!z){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+T.sn+" of level "+T.level+" will not be buffered");return}var V=z[j];console.assert(V,"Audio track is defined on fragment load progress");var M=V.details;console.assert(M,"Audio track details are defined on fragment load progress");var N=D.defaultAudioCodec||V.audioCodec||"mp4a.40.2",Y=this.transmuxer;Y||(Y=this.transmuxer=new _.default(this.hls,R.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var oe=this.initPTS[T.cc],pe=(a=T.initSegment)===null||a===void 0?void 0:a.data;if(oe!==void 0){var ve=!1,Le=m?m.index:-1,ke=Le!==-1,ce=new k.ChunkMetadata(T.level,T.sn,T.stats.chunkCount,x.byteLength,Le,ke);Y.push(x,pe,N,"",T,m,M.totalduration,ve,ce,oe)}else{o.logger.log("Unknown video PTS for cc "+T.cc+", waiting for video PTS before demuxing audio frag "+T.sn+" of ["+M.startSN+" ,"+M.endSN+"],track "+j);var ae=this.waitingData=this.waitingData||{frag:T,part:m,cache:new A.default,complete:!1},de=ae.cache;de.push(new Uint8Array(x)),this.waitingVideoCC=this.videoTrackCC,this.state=F.State.WAITING_INIT_PTS}},u._handleFragmentLoadComplete=function(s){if(this.waitingData){this.waitingData.complete=!0;return}w.prototype._handleFragmentLoadComplete.call(this,s)},u.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},u.onBufferCreated=function(s,a){var T=a.tracks.audio;T&&(this.mediaBuffer=T.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},u.onFragBuffered=function(s,a){var T=a.frag,m=a.part;if(T.type!==R.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(T)){this.warn("Fragment "+T.sn+(m?" p: "+m.index:"")+" of level "+T.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}T.sn!=="initSegment"&&(this.fragPrevious=T,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(I.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(T,m)},u.onError=function(s,a){switch(a.details){case h.ErrorDetails.FRAG_LOAD_ERROR:case h.ErrorDetails.FRAG_LOAD_TIMEOUT:case h.ErrorDetails.KEY_LOAD_ERROR:case h.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.AUDIO,a);break;case h.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case h.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==F.State.ERROR&&this.state!==F.State.STOPPED&&(this.state=a.fatal?F.State.ERROR:F.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case h.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var T=!0,m=this.getFwdBufferInfo(this.mediaBuffer,R.PlaylistLevelType.AUDIO);m&&m.len>.5&&(T=!this.reduceMaxBufferLength(m.len)),T&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,w.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},u.onBufferFlushed=function(s,a){var T=a.type;T===y.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},u._handleTransmuxComplete=function(s){var a,T="audio",m=this.hls,x=s.remuxResult,D=s.chunkMeta,j=this.getCurrentContext(D);if(!j){this.warn("The loading context changed while buffering fragment "+D.sn+" of level "+D.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(D.level);return}var z=j.frag,V=j.part,M=x.audio,N=x.text,Y=x.id3,oe=x.initSegment;if(this.fragContextChanged(z))return;if(this.state=F.State.PARSING,this.audioSwitch&&M&&this.completeAudioSwitch(),oe!=null&&oe.tracks&&(this._bufferInitSegment(oe.tracks,z,D),m.trigger(I.Events.FRAG_PARSING_INIT_SEGMENT,{frag:z,id:T,tracks:oe.tracks})),M){var pe=M.startPTS,ve=M.endPTS,Le=M.startDTS,ke=M.endDTS;V&&(V.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:pe,endPTS:ve,startDTS:Le,endDTS:ke}),z.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,pe,ve,Le,ke),this.bufferFragmentData(M,z,V,D)}if(Y!=null&&(a=Y.samples)!==null&&a!==void 0&&a.length){var ce=l({frag:z,id:T},Y);m.trigger(I.Events.FRAG_PARSING_METADATA,ce)}if(N){var ae=l({frag:z,id:T},N);m.trigger(I.Events.FRAG_PARSING_USERDATA,ae)}},u._bufferInitSegment=function(s,a,T){if(this.state!==F.State.PARSING)return;s.video&&delete s.video;var m=s.audio;if(!m)return;m.levelCodec=m.codec,m.id="audio",this.log("Init audio buffer, container:"+m.container+", codecs[parsed]=["+m.codec+"]"),this.hls.trigger(I.Events.BUFFER_CODECS,s);var x=m.initSegment;if(x!=null&&x.byteLength){var D={type:"audio",frag:a,part:null,chunkMeta:T,parent:a.type,data:x};this.hls.trigger(I.Events.BUFFER_APPENDING,D)}this.tick()},u.loadFragment=function(s,a,T){var m=this.fragmentTracker.getState(s);this.fragCurrent=s,(this.audioSwitch||m===B.FragmentState.NOT_LOADED||m===B.FragmentState.PARTIAL)&&(s.sn==="initSegment"?this._loadInitSegment(s):a.live&&!Object(Z.isFiniteNumber)(this.initPTS[s.cc])?(this.log("Waiting for video PTS in continuity counter "+s.cc+" of live stream before loading audio fragment "+s.sn+" of level "+this.trackId),this.state=F.State.WAITING_INIT_PTS):(this.startFragRequested=!0,w.prototype.loadFragment.call(this,s,a,T)))},u.completeAudioSwitch=function(){var s=this.hls,a=this.media,T=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),w.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,s.trigger(I.Events.AUDIO_TRACK_SWITCHED,{id:T})},b}(F.default);$.default=p},"./src/controller/audio-track-controller.ts":function(he,$,O){"use strict";O.r($);var Z=O("./src/events.ts"),F=O("./src/errors.ts"),I=O("./src/controller/base-playlist-controller.ts"),K=O("./src/types/loader.ts");function B(_,k){for(var C=0;C<k.length;C++){var E=k[C];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(_,E.key,E)}}function P(_,k,C){return k&&B(_.prototype,k),C&&B(_,C),_}function R(_,k){_.prototype=Object.create(k.prototype),_.prototype.constructor=_,y(_,k)}function y(_,k){return y=Object.setPrototypeOf||function(E,h){return E.__proto__=h,E},y(_,k)}var A=function(_){R(k,_);function k(E){var h;return h=_.call(this,E,"[audio-track-controller]")||this,h.tracks=[],h.groupId=null,h.tracksInGroup=[],h.trackId=-1,h.trackName="",h.selectDefaultTrack=!0,h.registerListeners(),h}var C=k.prototype;return C.registerListeners=function(){var h=this.hls;h.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.on(Z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.on(Z.Events.ERROR,this.onError,this)},C.unregisterListeners=function(){var h=this.hls;h.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),h.off(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.off(Z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.off(Z.Events.ERROR,this.onError,this)},C.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,_.prototype.destroy.call(this)},C.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},C.onManifestParsed=function(h,o){this.tracks=o.audioTracks||[]},C.onAudioTrackLoaded=function(h,o){var l=o.id,d=o.details,S=this.tracksInGroup[l];if(!S){this.warn("Invalid audio track id "+l);return}var v=S.details;S.details=o.details,this.log("audioTrack "+l+" loaded ["+d.startSN+"-"+d.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,o,v))},C.onLevelLoading=function(h,o){this.switchLevel(o.level)},C.onLevelSwitching=function(h,o){this.switchLevel(o.level)},C.switchLevel=function(h){var o=this.hls.levels[h];if(!(o!=null&&o.audioGroupIds))return;var l=o.audioGroupIds[o.urlId];if(this.groupId!==l){this.groupId=l;var d=this.tracks.filter(function(v){return!l||v.groupId===l});this.selectDefaultTrack&&!d.some(function(v){return v.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=d;var S={audioTracks:d};this.log("Updating audio tracks, "+d.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(Z.Events.AUDIO_TRACKS_UPDATED,S),this.selectInitialTrack()}},C.onError=function(h,o){if(_.prototype.onError.call(this,h,o),o.fatal||!o.context)return;o.context.type===K.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},C.setAudioTrack=function(h){var o=this.tracksInGroup;if(h<0||h>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=o[this.trackId];this.log("Now switching to audio-track index "+h);var d=o[h],S=d.id,v=d.groupId,p=v===void 0?"":v,w=d.name,b=d.type,u=d.url;if(this.trackId=h,this.trackName=w,this.selectDefaultTrack=!1,this.hls.trigger(Z.Events.AUDIO_TRACK_SWITCHING,{id:S,groupId:p,name:w,type:b,url:u}),d.details&&!d.details.live)return;var f=this.switchParams(d.url,l==null?void 0:l.details);this.loadPlaylist(f)},C.selectInitialTrack=function(){var h=this.tracksInGroup;console.assert(h.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,l=this.findTrackId(o)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},C.findTrackId=function(h){for(var o=this.tracksInGroup,l=0;l<o.length;l++){var d=o[l];if((!this.selectDefaultTrack||d.default)&&(!h||h===d.name))return d.id}return-1},C.loadPlaylist=function(h){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var l=o.id,d=o.groupId,S=o.url;if(h)try{S=h.addDirectives(S)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(Z.Events.AUDIO_TRACK_LOADING,{url:S,id:l,groupId:d,deliveryDirectives:h||null})}},P(k,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(h){this.selectDefaultTrack=!1,this.setAudioTrack(h)}}]),k}(I.default);$.default=A},"./src/controller/base-playlist-controller.ts":function(he,$,O){"use strict";O.r($),O.d($,"default",function(){return P});var Z=O("./src/polyfills/number.ts"),F=O("./src/types/level.ts"),I=O("./src/controller/level-helper.ts"),K=O("./src/utils/logger.ts"),B=O("./src/errors.ts"),P=function(){function R(A,_){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=K.logger.log.bind(K.logger,_+":"),this.warn=K.logger.warn.bind(K.logger,_+":"),this.hls=A}var y=R.prototype;return y.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},y.onError=function(_,k){k.fatal&&k.type===B.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},y.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},y.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},y.stopLoad=function(){this.canLoad=!1,this.clearTimer()},y.switchParams=function(_,k){var C=k==null?void 0:k.renditionReports;if(C)for(var E=0;E<C.length;E++){var h=C[E],o=""+h.URI;if(o===_.substr(-o.length)){var l=parseInt(h["LAST-MSN"]),d=parseInt(h["LAST-PART"]);if(k&&this.hls.config.lowLatencyMode){var S=Math.min(k.age-k.partTarget,k.targetduration);d!==void 0&&S>k.partTarget&&(d+=1)}if(Object(Z.isFiniteNumber)(l))return new F.HlsUrlParameters(l,Object(Z.isFiniteNumber)(d)?d:void 0,F.HlsSkip.No)}}},y.loadPlaylist=function(_){},y.shouldLoadTrack=function(_){return this.canLoad&&_&&!!_.url&&(!_.details||_.details.live)},y.playlistLoaded=function(_,k,C){var E=this,h=k.details,o=k.stats,l=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(h.advancedDateTime=Date.now()-l,h.live||C!=null&&C.live){if(h.reloaded(C),C&&this.log("live playlist "+_+" "+(h.advanced?"REFRESHED "+h.lastPartSn+"-"+h.lastPartIndex:"MISSED")),C&&h.fragments.length>0&&Object(I.mergeDetails)(C,h),!this.canLoad||!h.live)return;var d,S=void 0,v=void 0;if(h.canBlockReload&&h.endSN&&h.advanced){var p=this.hls.config.lowLatencyMode,w=h.lastPartSn,b=h.endSN,u=h.lastPartIndex,f=u!==-1,s=w===b,a=p?0:u;f?(S=s?b+1:w,v=s?a:u+1):S=b+1;var T=h.age,m=T+h.ageHeader,x=Math.min(m-h.partTarget,h.targetduration*1.5);if(x>0){if(C&&x>C.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+C.tuneInGoal+" to: "+x+" with playlist age: "+h.age),x=0;else{var D=Math.floor(x/h.targetduration);if(S+=D,v!==void 0){var j=Math.round(x%h.targetduration/h.partTarget);v+=j}this.log("CDN Tune-in age: "+h.ageHeader+"s last advanced "+T.toFixed(2)+"s goal: "+x+" skip sn "+D+" to part "+v)}h.tuneInGoal=x}if(d=this.getDeliveryDirectives(h,k.deliveryDirectives,S,v),p||!s){this.loadPlaylist(d);return}}else d=this.getDeliveryDirectives(h,k.deliveryDirectives,S,v);var z=Object(I.computeReloadInterval)(h,o);S!==void 0&&h.canBlockReload&&(z-=h.partTarget||1),this.log("reload live playlist "+_+" in "+Math.round(z)+" ms"),this.timer=self.setTimeout(function(){return E.loadPlaylist(d)},z)}else this.clearTimer()},y.getDeliveryDirectives=function(_,k,C,E){var h=Object(F.getSkipValue)(_,C);return k!=null&&k.skip&&_.deltaUpdateFailed&&(C=k.msn,E=k.part,h=F.HlsSkip.No),new F.HlsUrlParameters(C,E,h)},y.retryLoadingOrFail=function(_){var k=this,C=this.hls.config,E=this.retryCount<C.levelLoadingMaxRetry;if(E){var h;if(this.retryCount++,_.details.indexOf("LoadTimeOut")>-1&&(h=_.context)!==null&&h!==void 0&&h.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+_.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*C.levelLoadingRetryDelay,C.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return k.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+_.details+'"')}}else this.warn('cannot recover from error "'+_.details+'"'),this.clearTimer(),_.fatal=!0;return E},R}()},"./src/controller/base-stream-controller.ts":function(he,$,O){"use strict";O.r($),O.d($,"State",function(){return b}),O.d($,"default",function(){return u});var Z=O("./src/polyfills/number.ts"),F=O("./src/task-loop.ts"),I=O("./src/controller/fragment-tracker.ts"),K=O("./src/utils/buffer-helper.ts"),B=O("./src/utils/logger.ts"),P=O("./src/events.ts"),R=O("./src/errors.ts"),y=O("./src/types/transmuxer.ts"),A=O("./src/utils/mp4-tools.ts"),_=O("./src/utils/discontinuities.ts"),k=O("./src/controller/fragment-finders.ts"),C=O("./src/controller/level-helper.ts"),E=O("./src/loader/fragment-loader.ts"),h=O("./src/crypt/decrypter.ts"),o=O("./src/utils/time-ranges.ts"),l=O("./src/types/loader.ts");function d(f,s){for(var a=0;a<s.length;a++){var T=s[a];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(f,T.key,T)}}function S(f,s,a){return s&&d(f.prototype,s),a&&d(f,a),f}function v(f){if(f===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f}function p(f,s){f.prototype=Object.create(s.prototype),f.prototype.constructor=f,w(f,s)}function w(f,s){return w=Object.setPrototypeOf||function(T,m){return T.__proto__=m,T},w(f,s)}var b={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},u=function(f){p(s,f);function s(T,m,x){var D;return D=f.call(this)||this,D.hls=void 0,D.fragPrevious=null,D.fragCurrent=null,D.fragmentTracker=void 0,D.transmuxer=null,D._state=b.STOPPED,D.media=void 0,D.mediaBuffer=void 0,D.config=void 0,D.bitrateTest=!1,D.lastCurrentTime=0,D.nextLoadPosition=0,D.startPosition=0,D.loadedmetadata=!1,D.fragLoadError=0,D.retryDate=0,D.levels=null,D.fragmentLoader=void 0,D.levelLastLoaded=null,D.startFragRequested=!1,D.decrypter=void 0,D.initPTS=[],D.onvseeking=null,D.onvended=null,D.logPrefix="",D.log=void 0,D.warn=void 0,D.logPrefix=x,D.log=B.logger.log.bind(B.logger,x+":"),D.warn=B.logger.warn.bind(B.logger,x+":"),D.hls=T,D.fragmentLoader=new E.default(T.config),D.fragmentTracker=m,D.config=T.config,D.decrypter=new h.default(T,T.config),T.on(P.Events.KEY_LOADED,D.onKeyLoaded,v(D)),D}var a=s.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(m){},a.stopLoad=function(){this.fragmentLoader.abort();var m=this.fragCurrent;m&&this.fragmentTracker.removeFragment(m),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=b.STOPPED},a._streamEnded=function(m,x){var D=this.fragCurrent,j=this.fragmentTracker;if(!x.live&&D&&D.sn===x.endSN&&!m.nextStart){var z=j.getState(D);return z===I.FragmentState.PARTIAL||z===I.FragmentState.OK}return!1},a.onMediaAttached=function(m,x){var D=this.media=this.mediaBuffer=x.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),D.addEventListener("seeking",this.onvseeking),D.addEventListener("ended",this.onvended);var j=this.config;this.levels&&j.autoStartLoad&&this.state===b.STOPPED&&this.startLoad(j.startPosition)},a.onMediaDetaching=function(){var m=this.media;m!=null&&m.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),m&&(m.removeEventListener("seeking",this.onvseeking),m.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var m=this.config,x=this.fragCurrent,D=this.media,j=this.mediaBuffer,z=this.state,V=D?D.currentTime:0,M=K.BufferHelper.bufferInfo(j||D,V,m.maxBufferHole);if(this.log("media seeking to "+(Object(Z.isFiniteNumber)(V)?V.toFixed(3):V)+", state: "+z),z===b.ENDED)this.resetLoadingState();else if(x&&!M.len){var N=m.maxFragLookUpTolerance,Y=x.start-N,oe=x.start+x.duration+N,pe=V>oe;(V<Y||pe)&&(pe&&x.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),x.loader.abort()),this.resetLoadingState())}D&&(this.lastCurrentTime=V),!this.loadedmetadata&&!M.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(m,x){if(this.state!==b.KEY_LOADING||x.frag!==this.fragCurrent||!this.levels)return;this.state=b.IDLE;var D=this.levels[x.frag.level].details;D&&this.loadFragment(x.frag,D,x.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),f.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=b.STOPPED,this.hls.off(P.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,f.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(m,x){this.log("Loading key for "+m.sn+" of ["+x.startSN+"-"+x.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level),this.state=b.KEY_LOADING,this.fragCurrent=m,this.hls.trigger(P.Events.KEY_LOADING,{frag:m})},a.loadFragment=function(m,x,D){this._loadFragForPlayback(m,x,D)},a._loadFragForPlayback=function(m,x,D){var j=this,z=function(M){if(j.fragContextChanged(m)){j.warn("Fragment "+m.sn+(M.part?" p: "+M.part.index:"")+" of level "+m.level+" was dropped during download."),j.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,j._handleFragmentLoadProgress(M)};this._doFragLoad(m,x,D,z).then(function(V){if(!V)return;j.fragLoadError=0;var M=j.state;if(j.fragContextChanged(m)){(M===b.FRAG_LOADING||M===b.BACKTRACKING||!j.fragCurrent&&M===b.PARSING)&&(j.fragmentTracker.removeFragment(m),j.state=b.IDLE);return}if("payload"in V&&(j.log("Loaded fragment "+m.sn+" of level "+m.level),j.hls.trigger(P.Events.FRAG_LOADED,V),j.state===b.BACKTRACKING)){j.fragmentTracker.backtrack(m,V),j.resetFragmentLoading(m);return}j._handleFragmentLoadComplete(V)}).catch(function(V){j.warn(V),j.resetFragmentLoading(m)})},a.flushMainBuffer=function(m,x,D){if(D===void 0&&(D=null),!(m-x))return;var j={startOffset:m,endOffset:x,type:D};this.fragLoadError=0,this.hls.trigger(P.Events.BUFFER_FLUSHING,j)},a._loadInitSegment=function(m){var x=this;this._doFragLoad(m).then(function(D){if(!D||x.fragContextChanged(m)||!x.levels)throw new Error("init load aborted");return D}).then(function(D){var j=x.hls,z=D.payload,V=m.decryptdata;if(z&&z.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var M=self.performance.now();return x.decrypter.webCryptoDecrypt(new Uint8Array(z),V.key.buffer,V.iv.buffer).then(function(N){var Y=self.performance.now();return j.trigger(P.Events.FRAG_DECRYPTED,{frag:m,payload:N,stats:{tstart:M,tdecrypt:Y}}),D.payload=N,D})}return D}).then(function(D){var j=x.fragCurrent,z=x.hls,V=x.levels;if(!V)throw new Error("init load aborted, missing levels");var M=V[m.level].details;console.assert(M,"Level details are defined when init segment is loaded");var N=m.stats;x.state=b.IDLE,x.fragLoadError=0,m.data=new Uint8Array(D.payload),N.parsing.start=N.buffering.start=self.performance.now(),N.parsing.end=N.buffering.end=self.performance.now(),D.frag===j&&z.trigger(P.Events.FRAG_BUFFERED,{stats:N,frag:j,part:null,id:m.type}),x.tick()}).catch(function(D){x.warn(D),x.resetFragmentLoading(m)})},a.fragContextChanged=function(m){var x=this.fragCurrent;return!m||!x||m.level!==x.level||m.sn!==x.sn||m.urlId!==x.urlId},a.fragBufferedComplete=function(m,x){var D=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(x?" part: "+x.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+o.default.toString(K.BufferHelper.getBuffered(D))),this.state=b.IDLE,this.tick()},a._handleFragmentLoadComplete=function(m){var x=this.transmuxer;if(!x)return;var D=m.frag,j=m.part,z=m.partsLoaded,V=!z||z.length===0||z.some(function(N){return!N}),M=new y.ChunkMetadata(D.level,D.sn,D.stats.chunkCount+1,0,j?j.index:-1,!V);x.flush(M)},a._handleFragmentLoadProgress=function(m){},a._doFragLoad=function(m,x,D,j){var z=this;if(D===void 0&&(D=null),!this.levels)throw new Error("frag load aborted, missing levels");if(D=Math.max(m.start,D||0),this.config.lowLatencyMode&&x){var V=x.partList;if(V&&j){D>m.end&&x.fragmentHint&&(m=x.fragmentHint);var M=this.getNextPart(V,m,D);if(M>-1){var N=V[M];return this.log("Loading part sn: "+m.sn+" p: "+N.index+" cc: "+m.cc+" of playlist ["+x.startSN+"-"+x.endSN+"] parts [0-"+M+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(D.toFixed(3))),this.nextLoadPosition=N.start+N.duration,this.state=b.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:m,part:V[M],targetBufferTime:D}),this.doFragPartsLoad(m,V,M,j).catch(function(Y){return z.handleFragLoadError(Y)})}else if(!m.url||this.loadedEndOfParts(V,D))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(x?"of ["+x.startSN+"-"+x.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(D.toFixed(3))),Object(Z.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=b.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:m,targetBufferTime:D}),this.fragmentLoader.load(m,j).catch(function(Y){return z.handleFragLoadError(Y)})},a.doFragPartsLoad=function(m,x,D,j){var z=this;return new Promise(function(V,M){var N=[],Y=function oe(pe){var ve=x[pe];z.fragmentLoader.loadPart(m,ve,j).then(function(Le){N[ve.index]=Le;var ke=Le.part;z.hls.trigger(P.Events.FRAG_LOADED,Le);var ce=x[pe+1];if(ce&&ce.fragment===m)oe(pe+1);else return V({frag:m,part:ke,partsLoaded:N})}).catch(M)};Y(D)})},a.handleFragLoadError=function(m){var x=m.data;return x&&x.details===R.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(x.frag,x.part):this.hls.trigger(P.Events.ERROR,x),null},a._handleTransmuxerFlush=function(m){var x=this.getCurrentContext(m);if(!x||this.state!==b.PARSING){this.fragCurrent||(this.state=b.IDLE);return}var D=x.frag,j=x.part,z=x.level,V=self.performance.now();D.stats.parsing.end=V,j&&(j.stats.parsing.end=V),this.updateLevelTiming(D,j,z,m.partial)},a.getCurrentContext=function(m){var x=this.levels,D=m.level,j=m.sn,z=m.part;if(!x||!x[D])return this.warn("Levels object was unset while buffering fragment "+j+" of level "+D+". The current chunk will not be buffered."),null;var V=x[D],M=z>-1?Object(C.getPartWith)(V,j,z):null,N=M?M.fragment:Object(C.getFragmentWithSN)(V,j,this.fragCurrent);return N?{frag:N,part:M,level:V}:null},a.bufferFragmentData=function(m,x,D,j){if(!m||this.state!==b.PARSING)return;var z=m.data1,V=m.data2,M=z;if(z&&V&&(M=Object(A.appendUint8Array)(z,V)),!M||!M.length)return;var N={type:m.type,frag:x,part:D,chunkMeta:j,parent:x.type,data:M};this.hls.trigger(P.Events.BUFFER_APPENDING,N),m.dropped&&m.independent&&!D&&this.flushBufferGap(x)},a.flushBufferGap=function(m){var x=this.media;if(!x)return;if(!K.BufferHelper.isBuffered(x,x.currentTime)){this.flushMainBuffer(0,m.start);return}var D=x.currentTime,j=K.BufferHelper.bufferInfo(x,D,0),z=m.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,z*.25),M=Math.max(Math.min(m.start-V,j.end-V),D+V);m.start-M>V&&this.flushMainBuffer(M,m.start)},a.getFwdBufferInfo=function(m,x){var D=this.config,j=this.getLoadPosition();if(!Object(Z.isFiniteNumber)(j))return null;var z=K.BufferHelper.bufferInfo(m,j,D.maxBufferHole);if(z.len===0&&z.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(j,x);if(V&&z.nextStart<V.end)return K.BufferHelper.bufferInfo(m,j,Math.max(z.nextStart,D.maxBufferHole))}return z},a.getMaxBufferLength=function(m){var x=this.config,D;return m?D=Math.max(8*x.maxBufferSize/m,x.maxBufferLength):D=x.maxBufferLength,Math.min(D,x.maxMaxBufferLength)},a.reduceMaxBufferLength=function(m){var x=this.config,D=m||x.maxBufferLength;return x.maxMaxBufferLength>=D?(x.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+x.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(m,x){var D,j,z=x.fragments,V=z.length;if(!V)return null;var M=this.config,N=z[0].start,Y;if(x.live){var oe=M.initialLiveManifestSize;if(V<oe)return this.warn("Not enough fragments to start playback (have: "+V+", need: "+oe+")"),null;!x.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(Y=this.getInitialLiveFragment(x,z),this.startPosition=Y?this.hls.liveSyncPosition||Y.start:m)}else m<=N&&(Y=z[0]);if(!Y){var pe=M.lowLatencyMode?x.partEnd:x.fragmentEnd;Y=this.getFragmentAtPosition(m,pe,x)}return(D=Y)!==null&&D!==void 0&&D.initSegment&&!((j=Y)!==null&&j!==void 0&&j.initSegment.data)&&!this.bitrateTest&&(Y=Y.initSegment),Y},a.getNextPart=function(m,x,D){for(var j=-1,z=!1,V=!0,M=0,N=m.length;M<N;M++){var Y=m[M];if(V=V&&!Y.independent,j>-1&&D<Y.start)break;var oe=Y.loaded;!oe&&(z||Y.independent||V)&&Y.fragment===x&&(j=M),z=oe}return j},a.loadedEndOfParts=function(m,x){var D=m[m.length-1];return D&&x>D.start&&D.loaded},a.getInitialLiveFragment=function(m,x){var D=this.fragPrevious,j=null;if(D){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+D.programDateTime),j=Object(k.findFragmentByPDT)(x,D.endProgramDateTime,this.config.maxFragLookUpTolerance)),!j){var z=D.sn+1;if(z>=m.startSN&&z<=m.endSN){var V=x[z-m.startSN];D.cc===V.cc&&(j=V,this.log("Live playlist, switching playlist, load frag with next SN: "+j.sn))}j||(j=Object(k.findFragWithCC)(x,D.cc),j&&this.log("Live playlist, switching playlist, load frag with same CC: "+j.sn))}}else{var M=this.hls.liveSyncPosition;M!==null&&(j=this.getFragmentAtPosition(M,this.bitrateTest?m.fragmentEnd:m.edge,m))}return j},a.getFragmentAtPosition=function(m,x,D){var j=this.config,z=this.fragPrevious,V=D.fragments,M=D.endSN,N=D.fragmentHint,Y=j.maxFragLookUpTolerance,oe=!!(j.lowLatencyMode&&D.partList&&N);oe&&N&&!this.bitrateTest&&(V=V.concat(N),M=N.sn);var pe;if(m<x){var ve=m>x-Y?0:Y;pe=Object(k.findFragmentByPTS)(z,V,m,ve)}else pe=V[V.length-1];if(pe){var Le=pe.sn-D.startSN,ke=z&&pe.level===z.level,ce=V[Le+1],ae=this.fragmentTracker.getState(pe);if(ae===I.FragmentState.BACKTRACKED){pe=null;for(var de=Le;V[de]&&this.fragmentTracker.getState(V[de])===I.FragmentState.BACKTRACKED;)z?pe=V[de--]:pe=V[--de];pe||(pe=ce)}else z&&pe.sn===z.sn&&!oe&&(ke&&(pe.sn<M&&this.fragmentTracker.getState(ce)!==I.FragmentState.OK?(this.log("SN "+pe.sn+" just loaded, load next one: "+ce.sn),pe=ce):pe=null))}return pe},a.synchronizeToLiveEdge=function(m){var x=this.config,D=this.media;if(!D)return;var j=this.hls.liveSyncPosition,z=D.currentTime,V=m.fragments[0].start,M=m.edge,N=z>=V-x.maxFragLookUpTolerance&&z<=M;if(j!==null&&D.duration>j&&(z<j||!N)){var Y=x.liveMaxLatencyDuration!==void 0?x.liveMaxLatencyDuration:x.liveMaxLatencyDurationCount*m.targetduration;(!N&&D.readyState<4||z<M-Y)&&(this.loadedmetadata||(this.nextLoadPosition=j),D.readyState&&(this.warn("Playback: "+z.toFixed(3)+" is located too far from the end of live sliding playlist: "+M+", reset currentTime to : "+j.toFixed(3)),D.currentTime=j))}},a.alignPlaylists=function(m,x){var D=this.levels,j=this.levelLastLoaded,z=this.fragPrevious,V=j!==null?D[j]:null,M=m.fragments.length;if(!M)return this.warn("No fragments in live playlist"),0;var N=m.fragments[0].start,Y=!x,oe=m.alignedSliding&&Object(Z.isFiniteNumber)(N);if(Y||!oe&&!N){Object(_.alignStream)(z,V,m);var pe=m.fragments[0].start;return this.log("Live playlist sliding: "+pe.toFixed(2)+" start-sn: "+(x?x.startSN:"na")+"->"+m.startSN+" prev-sn: "+(z?z.sn:"na")+" fragments: "+M),pe}return N},a.waitForCdnTuneIn=function(m){var x=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*x)},a.setStartPosition=function(m,x){var D=this.startPosition;if(D<x&&(D=-1),D===-1||this.lastCurrentTime===-1){var j=m.startTimeOffset;Object(Z.isFiniteNumber)(j)?(D=x+j,j<0&&(D+=m.totalduration),D=Math.min(Math.max(x,D),x+m.totalduration),this.log("Start time offset "+j+" found in playlist, adjust startPosition to "+D),this.startPosition=D):m.live?D=this.hls.liveSyncPosition||x:this.startPosition=D=0,this.lastCurrentTime=D}this.nextLoadPosition=D},a.getLoadPosition=function(){var m=this.media,x=0;return this.loadedmetadata&&m?x=m.currentTime:this.nextLoadPosition&&(x=this.nextLoadPosition),x},a.handleFragLoadAborted=function(m,x){this.transmuxer&&m.sn!=="initSegment"&&m.stats.aborted&&(this.warn("Fragment "+m.sn+(x?" part"+x.index:"")+" of level "+m.level+" was aborted"),this.resetFragmentLoading(m))},a.resetFragmentLoading=function(m){(!this.fragCurrent||!this.fragContextChanged(m))&&(this.state=b.IDLE)},a.onFragmentOrKeyLoadError=function(m,x){if(x.fatal)return;var D=x.frag;if(!D||D.type!==m)return;var j=this.fragCurrent;console.assert(j&&D.sn===j.sn&&D.level===j.level&&D.urlId===j.urlId,"Frag load error must match current frag to retry");var z=this.config;if(this.fragLoadError+1<=z.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(D.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*z.fragLoadingRetryDelay,z.fragLoadingMaxRetryTimeout);this.warn("Fragment "+D.sn+" of "+m+" "+D.level+" failed to load, retrying in "+V+"ms"),this.retryDate=self.performance.now()+V,this.fragLoadError++,this.state=b.FRAG_LOADING_WAITING_RETRY}else x.levelRetry?(m===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=b.IDLE):(B.logger.error(x.details+" reaches max retry, redispatch as fatal ..."),x.fatal=!0,this.hls.stopLoad(),this.state=b.ERROR)},a.afterBufferFlushed=function(m,x,D){if(!m)return;var j=K.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(x,j,D),this.state===b.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=b.IDLE},a.resetLiveStartWhenNotLoaded=function(m){if(!this.loadedmetadata){this.startFragRequested=!1;var x=this.levels?this.levels[m].details:null;if(x!=null&&x.live)return this.startPosition=-1,this.setStartPosition(x,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(m,x,D,j){var z=this,V=D.details;console.assert(!!V,"level.details must be defined");var M=Object.keys(m.elementaryStreams).reduce(function(N,Y){var oe=m.elementaryStreams[Y];if(oe){var pe=oe.endPTS-oe.startPTS;if(pe<=0)return z.warn("Could not parse fragment "+m.sn+" "+Y+" duration reliably ("+pe+") resetting transmuxer to fallback to playlist timing"),z.resetTransmuxer(),N||!1;var ve=j?0:Object(C.updateFragPTSDTS)(V,m,oe.startPTS,oe.endPTS,oe.startDTS,oe.endDTS);return z.hls.trigger(P.Events.LEVEL_PTS_UPDATED,{details:V,level:D,drift:ve,type:Y,frag:m,start:oe.startPTS,end:oe.endPTS}),!0}return N},!1);M?(this.state=b.PARSED,this.hls.trigger(P.Events.FRAG_PARSED,{frag:m,part:x})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},S(s,[{key:"state",get:function(){return this._state},set:function(m){var x=this._state;x!==m&&(this._state=m,this.log(x+"->"+m))}}]),s}(F.default)},"./src/controller/buffer-controller.ts":function(he,$,O){"use strict";O.r($),O.d($,"default",function(){return k});var Z=O("./src/polyfills/number.ts"),F=O("./src/events.ts"),I=O("./src/utils/logger.ts"),K=O("./src/errors.ts"),B=O("./src/utils/buffer-helper.ts"),P=O("./src/utils/mediasource-helper.ts"),R=O("./src/loader/fragment.ts"),y=O("./src/controller/buffer-operation-queue.ts"),A=Object(P.getMediaSource)(),_=/([ha]vc.)(?:\.[^.,]+)+/,k=function(){function C(h){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var l=o.hls,d=o.media,S=o.mediaSource;I.logger.log("[buffer-controller]: Media source opened"),d&&(o.updateMediaElementDuration(),l.trigger(F.Events.MEDIA_ATTACHED,{media:d})),S&&S.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){I.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){I.logger.log("[buffer-controller]: Media source ended")},this.hls=h,this._initSourceBuffer(),this.registerListeners()}var E=C.prototype;return E.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},E.destroy=function(){this.unregisterListeners(),this.details=null},E.registerListeners=function(){var o=this.hls;o.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(F.Events.BUFFER_RESET,this.onBufferReset,this),o.on(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(F.Events.BUFFER_EOS,this.onBufferEos,this),o.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(F.Events.FRAG_PARSED,this.onFragParsed,this),o.on(F.Events.FRAG_CHANGED,this.onFragChanged,this)},E.unregisterListeners=function(){var o=this.hls;o.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(F.Events.BUFFER_RESET,this.onBufferReset,this),o.off(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(F.Events.BUFFER_EOS,this.onBufferEos,this),o.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(F.Events.FRAG_PARSED,this.onFragParsed,this),o.off(F.Events.FRAG_CHANGED,this.onFragChanged,this)},E._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new y.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},E.onManifestParsed=function(o,l){var d=2;(l.audio&&!l.video||!l.altAudio)&&(d=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=d,this.details=null,I.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},E.onMediaAttaching=function(o,l){var d=this.media=l.media;if(d&&A){var S=this.mediaSource=new A;S.addEventListener("sourceopen",this._onMediaSourceOpen),S.addEventListener("sourceended",this._onMediaSourceEnded),S.addEventListener("sourceclose",this._onMediaSourceClose),d.src=self.URL.createObjectURL(S),this._objectUrl=d.src}},E.onMediaDetaching=function(){var o=this.media,l=this.mediaSource,d=this._objectUrl;if(l){if(I.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(S){I.logger.warn("[buffer-controller]: onMediaDetaching: "+S.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(d&&self.URL.revokeObjectURL(d),o.src===d?(o.removeAttribute("src"),o.load()):I.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(F.Events.MEDIA_DETACHED,void 0)},E.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(l){var d=o.sourceBuffer[l];try{d&&(o.removeBufferListeners(l),o.mediaSource&&o.mediaSource.removeSourceBuffer(d),o.sourceBuffer[l]=void 0)}catch(S){I.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",S)}}),this._initSourceBuffer()},E.onBufferCodecs=function(o,l){var d=this,S=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(v){if(S){var p=d.tracks[v];if(p&&typeof p.buffer.changeType=="function"){var w=l[v],b=w.codec,u=w.levelCodec,f=w.container,s=(p.levelCodec||p.codec).replace(_,"$1"),a=(u||b).replace(_,"$1");if(s!==a){var T=f+";codecs="+(u||b);d.appendChangeType(v,T)}}}else d.pendingTracks[v]=l[v]}),S)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},E.appendChangeType=function(o,l){var d=this,S=this.operationQueue,v={execute:function(){var w=d.sourceBuffer[o];w&&(I.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+l),w.changeType(l)),S.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(w){I.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",w)}};S.append(v,o)},E.onBufferAppending=function(o,l){var d=this,S=this.hls,v=this.operationQueue,p=this.tracks,w=l.data,b=l.type,u=l.frag,f=l.part,s=l.chunkMeta,a=s.buffering[b],T=self.performance.now();a.start=T;var m=u.stats.buffering,x=f?f.stats.buffering:null;m.start===0&&(m.start=T),x&&x.start===0&&(x.start=T);var D=p.audio,j=b==="audio"&&s.id===1&&(D==null?void 0:D.container)==="audio/mpeg",z={execute:function(){if(a.executeStart=self.performance.now(),j){var M=d.sourceBuffer[b];if(M){var N=u.start-M.timestampOffset;Math.abs(N)>=.1&&(I.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+u.start+" (delta: "+N+") sn: "+u.sn+")"),M.timestampOffset=u.start)}}d.appendExecutor(w,b)},onStart:function(){},onComplete:function(){var M=self.performance.now();a.executeEnd=a.end=M,m.first===0&&(m.first=M),x&&x.first===0&&(x.first=M);var N=d.sourceBuffer,Y={};for(var oe in N)Y[oe]=B.BufferHelper.getBuffered(N[oe]);d.appendError=0,d.hls.trigger(F.Events.BUFFER_APPENDED,{type:b,frag:u,part:f,chunkMeta:s,parent:u.type,timeRanges:Y})},onError:function(M){I.logger.error("[buffer-controller]: Error encountered while trying to append to the "+b+" SourceBuffer",M);var N={type:K.ErrorTypes.MEDIA_ERROR,parent:u.type,details:K.ErrorDetails.BUFFER_APPEND_ERROR,err:M,fatal:!1};M.code===DOMException.QUOTA_EXCEEDED_ERR?N.details=K.ErrorDetails.BUFFER_FULL_ERROR:(d.appendError++,N.details=K.ErrorDetails.BUFFER_APPEND_ERROR,d.appendError>S.config.appendErrorMaxRetry&&(I.logger.error("[buffer-controller]: Failed "+S.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),N.fatal=!0)),S.trigger(F.Events.ERROR,N)}};v.append(z,b)},E.onBufferFlushing=function(o,l){var d=this,S=this.operationQueue,v=function(w){return{execute:d.removeExecutor.bind(d,w,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){d.hls.trigger(F.Events.BUFFER_FLUSHED,{type:w})},onError:function(u){I.logger.warn("[buffer-controller]: Failed to remove from "+w+" SourceBuffer",u)}}};l.type?S.append(v(l.type),l.type):this.getSourceBufferTypes().forEach(function(p){S.append(v(p),p)})},E.onFragParsed=function(o,l){var d=this,S=l.frag,v=l.part,p=[],w=v?v.elementaryStreams:S.elementaryStreams;w[R.ElementaryStreamTypes.AUDIOVIDEO]?p.push("audiovideo"):(w[R.ElementaryStreamTypes.AUDIO]&&p.push("audio"),w[R.ElementaryStreamTypes.VIDEO]&&p.push("video"));var b=function(){var f=self.performance.now();S.stats.buffering.end=f,v&&(v.stats.buffering.end=f);var s=v?v.stats:S.stats;d.hls.trigger(F.Events.FRAG_BUFFERED,{frag:S,part:v,stats:s,id:S.type})};p.length===0&&I.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+S.type+" level: "+S.level+" sn: "+S.sn),this.blockBuffers(b,p)},E.onFragChanged=function(o,l){this.flushBackBuffer()},E.onBufferEos=function(o,l){var d=this,S=this.getSourceBufferTypes().reduce(function(v,p){var w=d.sourceBuffer[p];return(!l.type||l.type===p)&&(w&&!w.ended&&(w.ended=!0,I.logger.log("[buffer-controller]: "+p+" sourceBuffer now EOS"))),v&&!!(!w||w.ended)},!0);S&&this.blockBuffers(function(){var v=d.mediaSource;if(!v||v.readyState!=="open")return;v.endOfStream()})},E.onLevelUpdated=function(o,l){var d=l.details;if(!d.fragments.length)return;this.details=d,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},E.flushBackBuffer=function(){var o=this.hls,l=this.details,d=this.media,S=this.sourceBuffer;if(!d||l===null)return;var v=this.getSourceBufferTypes();if(!v.length)return;var p=l.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(Z.isFiniteNumber)(p)||p<0)return;var w=d.currentTime,b=l.levelTargetDuration,u=Math.max(p,b),f=Math.floor(w/b)*b-u;v.forEach(function(s){var a=S[s];if(a){var T=B.BufferHelper.getBuffered(a);T.length>0&&f>T.start(0)&&(o.trigger(F.Events.BACK_BUFFER_REACHED,{bufferEnd:f}),l.live&&o.trigger(F.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:f}),o.trigger(F.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:f,type:s}))}})},E.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,l=this.hls,d=this.media,S=this.mediaSource,v=o.fragments[0].start+o.totalduration,p=d.duration,w=Object(Z.isFiniteNumber)(S.duration)?S.duration:0;o.live&&l.config.liveDurationInfinity?(I.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),S.duration=Infinity,this.updateSeekableRange(o)):(v>w&&v>p||!Object(Z.isFiniteNumber)(p))&&(I.logger.log("[buffer-controller]: Updating Media Source duration to "+v.toFixed(3)),S.duration=v)},E.updateSeekableRange=function(o){var l=this.mediaSource,d=o.fragments,S=d.length;if(S&&o.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var v=Math.max(0,d[0].start),p=Math.max(v,v+o.totalduration);l.setLiveSeekableRange(v,p)}},E.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,l=this.operationQueue,d=this.pendingTracks,S=Object.keys(d).length;if(S&&!o||S===2){this.createSourceBuffers(d),this.pendingTracks={};var v=this.getSourceBufferTypes();if(v.length===0){this.hls.trigger(F.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}v.forEach(function(p){l.executeNext(p)})}},E.createSourceBuffers=function(o){var l=this.sourceBuffer,d=this.mediaSource;if(!d)throw Error("createSourceBuffers called when mediaSource was null");var S=0;for(var v in o)if(!l[v]){var p=o[v];if(!p)throw Error("source buffer exists for track "+v+", however track does not");var w=p.levelCodec||p.codec,b=p.container+";codecs="+w;I.logger.log("[buffer-controller]: creating sourceBuffer("+b+")");try{var u=l[v]=d.addSourceBuffer(b),f=v;this.addBufferListener(f,"updatestart",this._onSBUpdateStart),this.addBufferListener(f,"updateend",this._onSBUpdateEnd),this.addBufferListener(f,"error",this._onSBUpdateError),this.tracks[v]={buffer:u,codec:w,container:p.container,levelCodec:p.levelCodec,id:p.id},S++}catch(s){I.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+s.message),this.hls.trigger(F.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:s,mimeType:b})}}S&&this.hls.trigger(F.Events.BUFFER_CREATED,{tracks:this.tracks})},E._onSBUpdateStart=function(o){var l=this.operationQueue,d=l.current(o);d.onStart()},E._onSBUpdateEnd=function(o){var l=this.operationQueue,d=l.current(o);d.onComplete(),l.shiftAndExecuteNext(o)},E._onSBUpdateError=function(o,l){I.logger.error("[buffer-controller]: "+o+" SourceBuffer error",l),this.hls.trigger(F.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var d=this.operationQueue.current(o);d&&d.onError(l)},E.removeExecutor=function(o,l,d){var S=this.media,v=this.mediaSource,p=this.operationQueue,w=this.sourceBuffer,b=w[o];if(!S||!v||!b){I.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),p.shiftAndExecuteNext(o);return}var u=Object(Z.isFiniteNumber)(S.duration)?S.duration:Infinity,f=Object(Z.isFiniteNumber)(v.duration)?v.duration:Infinity,s=Math.max(0,l),a=Math.min(d,u,f);a>s?(I.logger.log("[buffer-controller]: Removing ["+s+","+a+"] from the "+o+" SourceBuffer"),console.assert(!b.updating,o+" sourceBuffer must not be updating"),b.remove(s,a)):p.shiftAndExecuteNext(o)},E.appendExecutor=function(o,l){var d=this.operationQueue,S=this.sourceBuffer,v=S[l];if(!v){I.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),d.shiftAndExecuteNext(l);return}v.ended=!1,console.assert(!v.updating,l+" sourceBuffer must not be updating"),v.appendBuffer(o)},E.blockBuffers=function(o,l){var d=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){I.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var S=this.operationQueue,v=l.map(function(p){return S.appendBlocker(p)});Promise.all(v).then(function(){o(),l.forEach(function(p){var w=d.sourceBuffer[p];(!w||!w.updating)&&S.shiftAndExecuteNext(p)})})},E.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},E.addBufferListener=function(o,l,d){var S=this.sourceBuffer[o];if(!S)return;var v=d.bind(this,o);this.listeners[o].push({event:l,listener:v}),S.addEventListener(l,v)},E.removeBufferListeners=function(o){var l=this.sourceBuffer[o];if(!l)return;this.listeners[o].forEach(function(d){l.removeEventListener(d.event,d.listener)})},C}()},"./src/controller/buffer-operation-queue.ts":function(he,$,O){"use strict";O.r($),O.d($,"default",function(){return F});var Z=O("./src/utils/logger.ts"),F=function(){function I(B){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=B}var K=I.prototype;return K.append=function(P,R){var y=this.queues[R];y.push(P),y.length===1&&this.buffers[R]&&this.executeNext(R)},K.insertAbort=function(P,R){var y=this.queues[R];y.unshift(P),this.executeNext(R)},K.appendBlocker=function(P){var R,y=new Promise(function(_){R=_}),A={execute:R,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(A,P),y},K.executeNext=function(P){var R=this.buffers,y=this.queues,A=R[P],_=y[P];if(_.length){var k=_[0];try{k.execute()}catch(C){Z.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),k.onError(C),(!A||!A.updating)&&(_.shift(),this.executeNext(P))}}},K.shiftAndExecuteNext=function(P){this.queues[P].shift(),this.executeNext(P)},K.current=function(P){return this.queues[P][0]},I}()},"./src/controller/cap-level-controller.ts":function(he,$,O){"use strict";O.r($);var Z=O("./src/events.ts");function F(B,P){for(var R=0;R<P.length;R++){var y=P[R];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(B,y.key,y)}}function I(B,P,R){return P&&F(B.prototype,P),R&&F(B,R),B}var K=function(){function B(R){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=R,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var P=B.prototype;return P.setStreamController=function(y){this.streamController=y},P.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},P.registerListeners=function(){var y=this.hls;y.on(Z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.on(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.on(Z.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.unregisterListener=function(){var y=this.hls;y.off(Z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.off(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.off(Z.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.onFpsDropLevelCapping=function(y,A){B.isLevelAllowed(A.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(A.droppedLevel)},P.onMediaAttaching=function(y,A){this.media=A.media instanceof HTMLVideoElement?A.media:null},P.onManifestParsed=function(y,A){var _=this.hls;this.restrictedLevels=[],this.firstLevel=A.firstLevel,_.config.capLevelToPlayerSize&&A.video&&this.startCapping()},P.onBufferCodecs=function(y,A){var _=this.hls;_.config.capLevelToPlayerSize&&A.video&&this.startCapping()},P.onMediaDetaching=function(){this.stopCapping()},P.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var y=this.hls.levels;if(y.length){var A=this.hls;A.autoLevelCapping=this.getMaxLevel(y.length-1),A.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=A.autoLevelCapping}}},P.getMaxLevel=function(y){var A=this,_=this.hls.levels;if(!_.length)return-1;var k=_.filter(function(C,E){return B.isLevelAllowed(E,A.restrictedLevels)&&E<=y});return this.clientRect=null,B.getMaxLevelByMediaSize(k,this.mediaWidth,this.mediaHeight)},P.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},P.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},P.getDimensions=function(){if(this.clientRect)return this.clientRect;var y=this.media,A={width:0,height:0};if(y){var _=y.getBoundingClientRect();A.width=_.width,A.height=_.height,!A.width&&!A.height&&(A.width=_.right-_.left||y.width||0,A.height=_.bottom-_.top||y.height||0)}return this.clientRect=A,A},B.isLevelAllowed=function(y,A){return A===void 0&&(A=[]),A.indexOf(y)===-1},B.getMaxLevelByMediaSize=function(y,A,_){if(!y||!y.length)return-1;for(var k=function(l,d){return d?l.width!==d.width||l.height!==d.height:!0},C=y.length-1,E=0;E<y.length;E+=1){var h=y[E];if((h.width>=A||h.height>=_)&&k(h,y[E+1])){C=E;break}}return C},I(B,[{key:"mediaWidth",get:function(){return this.getDimensions().width*B.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*B.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var y=1;try{y=self.devicePixelRatio}catch(A){}return y}}]),B}();$.default=K},"./src/controller/cmcd-controller.ts":function(he,$,O){"use strict";O.r($),O.d($,"default",function(){return k});var Z=O("./src/events.ts"),F=O("./src/types/cmcd.ts"),I=O("./src/utils/buffer-helper.ts"),K=O("./src/utils/logger.ts");function B(C,E){for(var h=0;h<E.length;h++){var o=E[h];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(C,o.key,o)}}function P(C,E,h){return E&&B(C.prototype,E),h&&B(C,h),C}function R(C,E){var h=typeof Symbol!="undefined"&&C[Symbol.iterator]||C["@@iterator"];if(h)return(h=h.call(C)).next.bind(h);if(Array.isArray(C)||(h=y(C))||E&&C&&typeof C.length=="number"){h&&(C=h);var o=0;return function(){return o>=C.length?{done:!0}:{done:!1,value:C[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y(C,E){if(!C)return;if(typeof C=="string")return A(C,E);var h=Object.prototype.toString.call(C).slice(8,-1);if(h==="Object"&&C.constructor&&(h=C.constructor.name),h==="Map"||h==="Set")return Array.from(C);if(h==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h))return A(C,E)}function A(C,E){(E==null||E>C.length)&&(E=C.length);for(var h=0,o=new Array(E);h<E;h++)o[h]=C[h];return o}function _(){return _=Object.assign||function(C){for(var E=1;E<arguments.length;E++){var h=arguments[E];for(var o in h)Object.prototype.hasOwnProperty.call(h,o)&&(C[o]=h[o])}return C},_.apply(this,arguments)}var k=function(){function C(h){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(S){try{o.apply(S,{ot:F.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(v){K.logger.warn("Could not generate manifest CMCD data.",v)}},this.applyFragmentData=function(S){try{var v=S.frag,p=o.hls.levels[v.level],w=o.getObjectType(v),b={d:v.duration*1e3,ot:w};(w===F.CMCDObjectType.VIDEO||w===F.CMCDObjectType.AUDIO||w==F.CMCDObjectType.MUXED)&&(b.br=p.bitrate/1e3,b.tb=o.getTopBandwidth(w),b.bl=o.getBufferLength(w)),o.apply(S,b)}catch(u){K.logger.warn("Could not generate segment CMCD data.",u)}},this.hls=h;var l=this.config=h.config,d=l.cmcd;d!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=d.sessionId||C.uuid(),this.cid=d.contentId,this.useHeaders=d.useHeaders===!0,this.registerListeners())}var E=C.prototype;return E.registerListeners=function(){var o=this.hls;o.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(Z.Events.BUFFER_CREATED,this.onBufferCreated,this)},E.unregisterListeners=function(){var o=this.hls;o.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(Z.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},E.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},E.onMediaAttached=function(o,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},E.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},E.onBufferCreated=function(o,l){var d,S;this.audioBuffer=(d=l.tracks.audio)===null||d===void 0?void 0:d.buffer,this.videoBuffer=(S=l.tracks.video)===null||S===void 0?void 0:S.buffer},E.createData=function(){var o;return{v:F.CMCDVersion,sf:F.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},E.apply=function(o,l){l===void 0&&(l={}),_(l,this.createData());var d=l.ot===F.CMCDObjectType.INIT||l.ot===F.CMCDObjectType.VIDEO||l.ot===F.CMCDObjectType.MUXED;if(this.starved&&d&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var S=C.toHeaders(l);if(!Object.keys(S).length)return;o.headers||(o.headers={}),_(o.headers,S)}else{var v=C.toQuery(l);if(!v)return;o.url=C.appendQueryToUri(o.url,v)}},E.getObjectType=function(o){var l=o.type;return l==="subtitle"?F.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?F.CMCDObjectType.INIT:l==="audio"?F.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?F.CMCDObjectType.VIDEO:F.CMCDObjectType.MUXED:void 0},E.getTopBandwidth=function(o){for(var l=0,d=o===F.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,S=R(d),v;!(v=S()).done;){var p=v.value;p.bitrate>l&&(l=p.bitrate)}return l>0?l:NaN},E.getBufferLength=function(o){var l=this.hls.media,d=o===F.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!d||!l)return NaN;var S=I.BufferHelper.bufferInfo(d,l.currentTime,this.config.maxBufferHole);return S.len*1e3},E.createPlaylistLoader=function(){var o=this.config.pLoader,l=this.applyPlaylistData,d=o||this.config.loader;return function(){function S(p){this.loader=void 0,this.loader=new d(p)}var v=S.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(w,b,u){l(w),this.loader.load(w,b,u)},P(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},E.createFragmentLoader=function(){var o=this.config.fLoader,l=this.applyFragmentData,d=o||this.config.loader;return function(){function S(p){this.loader=void 0,this.loader=new d(p)}var v=S.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(w,b,u){l(w),this.loader.load(w,b,u)},P(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},C.uuid=function(){var o=URL.createObjectURL(new Blob),l=o.toString();return URL.revokeObjectURL(o),l.substr(l.lastIndexOf("/")+1)},C.serialize=function(o){for(var l=[],d=function(j){return!Number.isNaN(j)&&j!=null&&j!==""&&j!==!1},S=function(j){return Math.round(j)},v=function(j){return S(j/100)*100},p=function(j){return encodeURIComponent(j)},w={br:S,d:S,bl:v,dl:v,mtp:v,nor:p,rtp:v,tb:S},b=Object.keys(o||{}).sort(),u=R(b),f;!(f=u()).done;){var s=f.value,a=o[s];if(!d(a))continue;if(s==="v"&&a===1)continue;if(s=="pr"&&a===1)continue;var T=w[s];T&&(a=T(a));var m=typeof a,x=void 0;s==="ot"||s==="sf"||s==="st"?x=s+"="+a:m==="boolean"?x=s:m==="number"?x=s+"="+a:x=s+"="+JSON.stringify(a),l.push(x)}return l.join(",")},C.toHeaders=function(o){for(var l=Object.keys(o),d={},S=["Object","Request","Session","Status"],v=[{},{},{},{}],p={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},w=0,b=l;w<b.length;w++){var u=b[w],f=p[u]!=null?p[u]:1;v[f][u]=o[u]}for(var s=0;s<v.length;s++){var a=C.serialize(v[s]);a&&(d["CMCD-"+S[s]]=a)}return d},C.toQuery=function(o){return"CMCD="+encodeURIComponent(C.serialize(o))},C.appendQueryToUri=function(o,l){if(!l)return o;var d=o.includes("?")?"&":"?";return""+o+d+l},C}()},"./src/controller/eme-controller.ts":function(he,$,O){"use strict";O.r($);var Z=O("./src/events.ts"),F=O("./src/errors.ts"),I=O("./src/utils/logger.ts"),K=O("./src/utils/mediakeys-helper.ts");function B(k,C){for(var E=0;E<C.length;E++){var h=C[E];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(k,h.key,h)}}function P(k,C,E){return C&&B(k.prototype,C),E&&B(k,E),k}var R=3,y=function(C,E,h){var o={audioCapabilities:[],videoCapabilities:[]};return C.forEach(function(l){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:h.audioRobustness||""})}),E.forEach(function(l){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:h.videoRobustness||""})}),[o]},A=function(C,E,h,o){switch(C){case K.KeySystems.WIDEVINE:return y(E,h,o);default:throw new Error("Unknown key-system: "+C)}},_=function(){function k(E){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=E,this._config=E.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var C=k.prototype;return C.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},C._registerListeners=function(){this.hls.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},C._unregisterListeners=function(){this.hls.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},C.getLicenseServerUrl=function(h){switch(h){case K.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+h+'"')},C._attemptKeySystemAccess=function(h,o,l){var d=this,S=A(h,o,l,this._drmSystemOptions);I.logger.log("Requesting encrypted media key-system access");var v=this.requestMediaKeySystemAccess(h,S);this.mediaKeysPromise=v.then(function(p){return d._onMediaKeySystemAccessObtained(h,p)}),v.catch(function(p){I.logger.error('Failed to obtain key-system "'+h+'" access:',p)})},C._onMediaKeySystemAccessObtained=function(h,o){var l=this;I.logger.log('Access for key-system "'+h+'" obtained');var d={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:h};this._mediaKeysList.push(d);var S=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(v){return d.mediaKeys=v,I.logger.log('Media-keys created for key-system "'+h+'"'),l._onMediaKeysCreated(),v});return S.catch(function(v){I.logger.error("Failed to create media-keys:",v)}),S},C._onMediaKeysCreated=function(){var h=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),h._onNewMediaKeySession(o.mediaKeysSession))})},C._onNewMediaKeySession=function(h){var o=this;I.logger.log("New key-system session "+h.sessionId),h.addEventListener("message",function(l){o._onKeySessionMessage(h,l.message)},!1)},C._onKeySessionMessage=function(h,o){I.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(l){I.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),h.update(l)})},C.onMediaEncrypted=function(h){var o=this;if(I.logger.log('Media is encrypted using "'+h.initDataType+'" init data type'),!this.mediaKeysPromise){I.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(S){if(!o._media)return;o._attemptSetMediaKeys(S),o._generateRequestWithPreferredKeySession(h.initDataType,h.initData)};this.mediaKeysPromise.then(l).catch(l)},C._attemptSetMediaKeys=function(h){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){I.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}I.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},C._generateRequestWithPreferredKeySession=function(h,o){var l=this,d=this._mediaKeysList[0];if(!d){I.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(d.mediaKeysSessionInitialized){I.logger.warn("Key-Session already initialized but requested again");return}var S=d.mediaKeysSession;if(!S){I.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){I.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}I.logger.log('Generating key-session request for "'+h+'" init data type'),d.mediaKeysSessionInitialized=!0,S.generateRequest(h,o).then(function(){I.logger.debug("Key-session generation succeeded")}).catch(function(v){I.logger.error("Error generating key-session request:",v),l.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},C._createLicenseXhr=function(h,o,l){var d=new XMLHttpRequest;d.responseType="arraybuffer",d.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,d,h,o,l);var S=this._licenseXhrSetup;if(S)try{S.call(this.hls,d,h),S=void 0}catch(v){I.logger.error(v)}try{d.readyState||d.open("POST",h,!0),S&&S.call(this.hls,d,h)}catch(v){throw new Error("issue setting up KeySystem license XHR "+v)}return d},C._onLicenseRequestReadyStageChange=function(h,o,l,d){switch(h.readyState){case 4:if(h.status===200){this._requestLicenseFailureCount=0,I.logger.log("License request succeeded");var S=h.response,v=this._licenseResponseCallback;if(v)try{S=v.call(this.hls,h,o)}catch(w){I.logger.error(w)}d(S)}else{if(I.logger.error("License Request XHR failed ("+o+"). Status: "+h.status+" ("+h.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>R){this.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var p=R-this._requestLicenseFailureCount+1;I.logger.warn("Retrying license request, "+p+" attempts left"),this._requestLicense(l,d)}break}},C._generateLicenseRequestChallenge=function(h,o){switch(h.mediaKeySystemDomain){case K.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+h.mediaKeySystemDomain)},C._requestLicense=function(h,o){I.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){I.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var d=this.getLicenseServerUrl(l.mediaKeySystemDomain),S=this._createLicenseXhr(d,h,o);I.logger.log("Sending license request to URL: "+d);var v=this._generateLicenseRequestChallenge(l,h);S.send(v)}catch(p){I.logger.error("Failure requesting DRM license: "+p),this.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},C.onMediaAttached=function(h,o){if(!this._emeEnabled)return;var l=o.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},C.onMediaDetached=function(){var h=this._media,o=this._mediaKeysList;if(!h)return;h.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return h.setMediaKeys(null)}).catch(function(){})},C.onManifestParsed=function(h,o){if(!this._emeEnabled)return;var l=o.levels.map(function(S){return S.audioCodec}).filter(function(S){return!!S}),d=o.levels.map(function(S){return S.videoCodec}).filter(function(S){return!!S});this._attemptKeySystemAccess(K.KeySystems.WIDEVINE,l,d)},P(k,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),k}();$.default=_},"./src/controller/fps-controller.ts":function(he,$,O){"use strict";O.r($);var Z=O("./src/events.ts"),F=O("./src/utils/logger.ts"),I=function(){function K(P){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=P,this.registerListeners()}var B=K.prototype;return B.setStreamController=function(R){this.streamController=R},B.registerListeners=function(){this.hls.on(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},B.unregisterListeners=function(){this.hls.off(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching)},B.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},B.onMediaAttaching=function(R,y){var A=this.hls.config;if(A.capLevelOnFPSDrop){var _=y.media instanceof self.HTMLVideoElement?y.media:null;this.media=_,_&&typeof _.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),A.fpsDroppedMonitoringPeriod)}},B.checkFPS=function(R,y,A){var _=performance.now();if(y){if(this.lastTime){var k=_-this.lastTime,C=A-this.lastDroppedFrames,E=y-this.lastDecodedFrames,h=1e3*C/k,o=this.hls;if(o.trigger(Z.Events.FPS_DROP,{currentDropped:C,currentDecoded:E,totalDroppedFrames:A}),h>0&&C>o.config.fpsDroppedMonitoringThreshold*E){var l=o.currentLevel;F.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=l)&&(l=l-1,o.trigger(Z.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:o.currentLevel}),o.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=_,this.lastDroppedFrames=A,this.lastDecodedFrames=y}},B.checkFPSInterval=function(){var R=this.media;if(R)if(this.isVideoPlaybackQualityAvailable){var y=R.getVideoPlaybackQuality();this.checkFPS(R,y.totalVideoFrames,y.droppedVideoFrames)}else this.checkFPS(R,R.webkitDecodedFrameCount,R.webkitDroppedFrameCount)},K}();$.default=I},"./src/controller/fragment-finders.ts":function(he,$,O){"use strict";O.r($),O.d($,"findFragmentByPDT",function(){return I}),O.d($,"findFragmentByPTS",function(){return K}),O.d($,"fragmentWithinToleranceTest",function(){return B}),O.d($,"pdtWithinToleranceTest",function(){return P}),O.d($,"findFragWithCC",function(){return R});var Z=O("./src/polyfills/number.ts"),F=O("./src/utils/binary-search.ts");function I(y,A,_){if(A===null||!Array.isArray(y)||!y.length||!Object(Z.isFiniteNumber)(A))return null;var k=y[0].programDateTime;if(A<(k||0))return null;var C=y[y.length-1].endProgramDateTime;if(A>=(C||0))return null;_=_||0;for(var E=0;E<y.length;++E){var h=y[E];if(P(A,_,h))return h}return null}function K(y,A,_,k){_===void 0&&(_=0),k===void 0&&(k=0);var C=null;if(y?C=A[y.sn-A[0].sn+1]||null:_===0&&A[0].start===0&&(C=A[0]),C&&B(_,k,C)===0)return C;var E=F.default.search(A,B.bind(null,_,k));return E||C}function B(y,A,_){y===void 0&&(y=0),A===void 0&&(A=0);var k=Math.min(A,_.duration+(_.deltaPTS?_.deltaPTS:0));return _.start+_.duration-k<=y?1:_.start-k>y&&_.start?-1:0}function P(y,A,_){var k=Math.min(A,_.duration+(_.deltaPTS?_.deltaPTS:0))*1e3,C=_.endProgramDateTime||0;return C-k>y}function R(y,A){return F.default.search(y,function(_){return _.cc<A?1:_.cc>A?-1:0})}},"./src/controller/fragment-tracker.ts":function(he,$,O){"use strict";O.r($),O.d($,"FragmentState",function(){return I}),O.d($,"FragmentTracker",function(){return K});var Z=O("./src/events.ts"),F=O("./src/types/loader.ts"),I;(function(R){R.NOT_LOADED="NOT_LOADED",R.BACKTRACKED="BACKTRACKED",R.APPENDING="APPENDING",R.PARTIAL="PARTIAL",R.OK="OK"})(I||(I={}));var K=function(){function R(A){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=A,this._registerListeners()}var y=R.prototype;return y._registerListeners=function(){var _=this.hls;_.on(Z.Events.BUFFER_APPENDED,this.onBufferAppended,this),_.on(Z.Events.FRAG_BUFFERED,this.onFragBuffered,this),_.on(Z.Events.FRAG_LOADED,this.onFragLoaded,this)},y._unregisterListeners=function(){var _=this.hls;_.off(Z.Events.BUFFER_APPENDED,this.onBufferAppended,this),_.off(Z.Events.FRAG_BUFFERED,this.onFragBuffered,this),_.off(Z.Events.FRAG_LOADED,this.onFragLoaded,this)},y.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},y.getAppendedFrag=function(_,k){if(k===F.PlaylistLevelType.MAIN){var C=this.activeFragment,E=this.activeParts;if(!C)return null;if(E)for(var h=E.length;h--;){var o=E[h],l=o?o.end:C.appendedPTS;if(o.start<=_&&l!==void 0&&_<=l)return h>9&&(this.activeParts=E.slice(h-9)),o}else if(C.start<=_&&C.appendedPTS!==void 0&&_<=C.appendedPTS)return C}return this.getBufferedFrag(_,k)},y.getBufferedFrag=function(_,k){for(var C=this.fragments,E=Object.keys(C),h=E.length;h--;){var o=C[E[h]];if((o==null?void 0:o.body.type)===k&&o.buffered){var l=o.body;if(l.start<=_&&_<=l.end)return l}}return null},y.detectEvictedFragments=function(_,k,C){var E=this;Object.keys(this.fragments).forEach(function(h){var o=E.fragments[h];if(!o)return;if(!o.buffered){o.body.type===C&&E.removeFragment(o.body);return}var l=o.range[_];if(!l)return;l.time.some(function(d){var S=!E.isTimeBuffered(d.startPTS,d.endPTS,k);return S&&E.removeFragment(o.body),S})})},y.detectPartialFragments=function(_){var k=this,C=this.timeRanges,E=_.frag,h=_.part;if(!C||E.sn==="initSegment")return;var o=P(E),l=this.fragments[o];if(!l)return;Object.keys(C).forEach(function(d){var S=E.elementaryStreams[d];if(!S)return;var v=C[d],p=h!==null||S.partial===!0;l.range[d]=k.getBufferedTimes(E,h,p,v)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},y.fragBuffered=function(_){var k=P(_),C=this.fragments[k];C&&(C.backtrack=C.loaded=null,C.buffered=!0)},y.getBufferedTimes=function(_,k,C,E){for(var h={time:[],partial:C},o=k?k.start:_.start,l=k?k.end:_.end,d=_.minEndPTS||l,S=_.maxStartPTS||o,v=0;v<E.length;v++){var p=E.start(v)-this.bufferPadding,w=E.end(v)+this.bufferPadding;if(S>=p&&d<=w){h.time.push({startPTS:Math.max(o,E.start(v)),endPTS:Math.min(l,E.end(v))});break}else if(o<w&&l>p)h.partial=!0,h.time.push({startPTS:Math.max(o,E.start(v)),endPTS:Math.min(l,E.end(v))});else if(l<=p)break}return h},y.getPartialFragment=function(_){var k=null,C,E,h,o=0,l=this.bufferPadding,d=this.fragments;return Object.keys(d).forEach(function(S){var v=d[S];if(!v)return;B(v)&&(E=v.body.start-l,h=v.body.end+l,_>=E&&_<=h&&(C=Math.min(_-E,h-_),o<=C&&(k=v.body,o=C)))}),k},y.getState=function(_){var k=P(_),C=this.fragments[k];return C?C.buffered?B(C)?I.PARTIAL:I.OK:C.backtrack?I.BACKTRACKED:I.APPENDING:I.NOT_LOADED},y.backtrack=function(_,k){var C=P(_),E=this.fragments[C];if(!E||E.backtrack)return null;var h=E.backtrack=k||E.loaded;return E.loaded=null,h},y.getBacktrackData=function(_){var k=P(_),C=this.fragments[k];if(C){var E,h=C.backtrack;if(h!=null&&(E=h.payload)!==null&&E!==void 0&&E.byteLength)return h;this.removeFragment(_)}return null},y.isTimeBuffered=function(_,k,C){for(var E,h,o=0;o<C.length;o++){if(E=C.start(o)-this.bufferPadding,h=C.end(o)+this.bufferPadding,_>=E&&k<=h)return!0;if(k<=E)return!1}return!1},y.onFragLoaded=function(_,k){var C=k.frag,E=k.part;if(C.sn==="initSegment"||C.bitrateTest||E)return;var h=P(C);this.fragments[h]={body:C,loaded:k,backtrack:null,buffered:!1,range:Object.create(null)}},y.onBufferAppended=function(_,k){var C=this,E=k.frag,h=k.part,o=k.timeRanges;if(E.type===F.PlaylistLevelType.MAIN)if(this.activeFragment=E,h){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(h)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(d){var S=o[d];if(C.detectEvictedFragments(d,S),!h)for(var v=0;v<S.length;v++)E.appendedPTS=Math.max(S.end(v),E.appendedPTS||0)})},y.onFragBuffered=function(_,k){this.detectPartialFragments(k)},y.hasFragment=function(_){var k=P(_);return!!this.fragments[k]},y.removeFragmentsInRange=function(_,k,C){var E=this;Object.keys(this.fragments).forEach(function(h){var o=E.fragments[h];if(!o)return;if(o.buffered){var l=o.body;l.type===C&&l.start<k&&l.end>_&&E.removeFragment(l)}})},y.removeFragment=function(_){var k=P(_);_.stats.loaded=0,_.clearElementaryStreamInfo(),delete this.fragments[k]},y.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},R}();function B(R){var y,A;return R.buffered&&(((y=R.range.video)===null||y===void 0?void 0:y.partial)||((A=R.range.audio)===null||A===void 0?void 0:A.partial))}function P(R){return R.type+"_"+R.level+"_"+R.urlId+"_"+R.sn}},"./src/controller/gap-controller.ts":function(he,$,O){"use strict";O.r($),O.d($,"STALL_MINIMUM_DURATION_MS",function(){return B}),O.d($,"MAX_START_GAP_JUMP",function(){return P}),O.d($,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return R}),O.d($,"SKIP_BUFFER_RANGE_START",function(){return y}),O.d($,"default",function(){return A});var Z=O("./src/utils/buffer-helper.ts"),F=O("./src/errors.ts"),I=O("./src/events.ts"),K=O("./src/utils/logger.ts"),B=250,P=2,R=.1,y=.05,A=function(){function _(C,E,h,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=C,this.media=E,this.fragmentTracker=h,this.hls=o}var k=_.prototype;return k.destroy=function(){this.hls=this.fragmentTracker=this.media=null},k.poll=function(E){var h=this.config,o=this.media,l=this.stalled,d=o.currentTime,S=o.seeking,v=this.seeking&&!S,p=!this.seeking&&S;if(this.seeking=S,d!==E){if(this.moved=!0,l!==null){if(this.stallReported){var w=self.performance.now()-l;K.logger.warn("playback not stuck anymore @"+d+", after "+Math.round(w)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((p||v)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!Z.BufferHelper.getBuffered(o).length)return;var b=Z.BufferHelper.bufferInfo(o,d,0),u=b.len>0,f=b.nextStart||0;if(!u&&!f)return;if(S){var s=b.len>P,a=!f||f-d>P&&!this.fragmentTracker.getPartialFragment(d);if(s||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var T,m=Math.max(f,b.start||0)-d,x=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,D=x==null||((T=x.details)===null||T===void 0)?void 0:T.live,j=D?x.details.targetduration*2:P;if(m>0&&m<=j){this._trySkipBufferHole(null);return}}var z=self.performance.now();if(l===null){this.stalled=z;return}var V=z-l;!S&&V>=B&&this._reportStall(b.len);var M=Z.BufferHelper.bufferInfo(o,d,h.maxBufferHole);this._tryFixBufferStall(M,V)},k._tryFixBufferStall=function(E,h){var o=this.config,l=this.fragmentTracker,d=this.media,S=d.currentTime,v=l.getPartialFragment(S);if(v){var p=this._trySkipBufferHole(v);if(p)return}E.len>o.maxBufferHole&&h>o.highBufferWatchdogPeriod*1e3&&(K.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},k._reportStall=function(E){var h=this.hls,o=this.media,l=this.stallReported;l||(this.stallReported=!0,K.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+E+")"),h.trigger(I.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:E}))},k._trySkipBufferHole=function(E){for(var h=this.config,o=this.hls,l=this.media,d=l.currentTime,S=0,v=Z.BufferHelper.getBuffered(l),p=0;p<v.length;p++){var w=v.start(p);if(d+h.maxBufferHole>=S&&d<w){var b=Math.max(w+y,l.currentTime+R);return K.logger.warn("skipping hole, adjusting currentTime from "+d+" to "+b),this.moved=!0,this.stalled=null,l.currentTime=b,E&&o.trigger(I.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+d+" to "+b,frag:E}),b}S=v.end(p)}return 0},k._tryNudgeBuffer=function(){var E=this.config,h=this.hls,o=this.media,l=o.currentTime,d=(this.nudgeRetry||0)+1;if(this.nudgeRetry=d,d<E.nudgeMaxRetry){var S=l+d*E.nudgeOffset;K.logger.warn("Nudging 'currentTime' from "+l+" to "+S),o.currentTime=S,h.trigger(I.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else K.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+E.nudgeMaxRetry+" nudges"),h.trigger(I.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},_}()},"./src/controller/id3-track-controller.ts":function(he,$,O){"use strict";O.r($);var Z=O("./src/events.ts"),F=O("./src/utils/texttrack-utils.ts"),I=O("./src/demux/id3.ts"),K=.25,B=function(){function P(y){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=y,this._registerListeners()}var R=P.prototype;return R.destroy=function(){this._unregisterListeners()},R._registerListeners=function(){var A=this.hls;A.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(Z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.on(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R._unregisterListeners=function(){var A=this.hls;A.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(Z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.off(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R.onMediaAttached=function(A,_){this.media=_.media},R.onMediaDetaching=function(){if(!this.id3Track)return;Object(F.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},R.getID3Track=function(A){if(!this.media)return;for(var _=0;_<A.length;_++){var k=A[_];if(k.kind==="metadata"&&k.label==="id3")return Object(F.sendAddTrackEvent)(k,this.media),k}return this.media.addTextTrack("metadata","id3")},R.onFragParsingMetadata=function(A,_){if(!this.media)return;var k=_.frag,C=_.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var E=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,h=0;h<C.length;h++){var o=I.getID3Frames(C[h].data);if(o){var l=C[h].pts,d=h<C.length-1?C[h+1].pts:k.end,S=d-l;S<=0&&(d=l+K);for(var v=0;v<o.length;v++){var p=o[v];if(!I.isTimeStampFrame(p)){var w=new E(l,d,"");w.value=p,this.id3Track.addCue(w)}}}}},R.onBufferFlushing=function(A,_){var k=_.startOffset,C=_.endOffset,E=_.type;if(!E||E==="audio"){var h=this.id3Track;h&&Object(F.removeCuesInRange)(h,k,C)}},P}();$.default=B},"./src/controller/latency-controller.ts":function(he,$,O){"use strict";O.r($),O.d($,"default",function(){return P});var Z=O("./src/errors.ts"),F=O("./src/events.ts"),I=O("./src/utils/logger.ts");function K(R,y){for(var A=0;A<y.length;A++){var _=y[A];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(R,_.key,_)}}function B(R,y,A){return y&&K(R.prototype,y),A&&K(R,A),R}var P=function(){function R(A){var _=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return _.timeupdate()},this.hls=A,this.config=A.config,this.registerListeners()}var y=R.prototype;return y.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},y.registerListeners=function(){this.hls.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(F.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){this.hls.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(F.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(F.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(F.Events.ERROR,this.onError)},y.onMediaAttached=function(_,k){this.media=k.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},y.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},y.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},y.onLevelUpdated=function(_,k){var C=k.details;this.levelDetails=C,C.advanced&&this.timeupdate(),!C.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},y.onError=function(_,k){if(k.details!==Z.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,I.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},y.timeupdate=function(){var _=this.media,k=this.levelDetails;if(!_||!k)return;this.currentTime=_.currentTime;var C=this.computeLatency();if(C===null)return;this._latency=C;var E=this.config,h=E.lowLatencyMode,o=E.maxLiveSyncPlaybackRate;if(!h||o===1)return;var l=this.targetLatency;if(l===null)return;var d=C-l,S=Math.min(this.maxLatency,l+k.targetduration),v=d<S;if(k.live&&v&&d>.05&&this.forwardBufferLength>1){var p=Math.min(2,Math.max(1,o)),w=Math.round(2/(1+Math.exp(-.75*d-this.edgeStalled))*20)/20;_.playbackRate=Math.min(p,Math.max(1,w))}else _.playbackRate!==1&&_.playbackRate!==0&&(_.playbackRate=1)},y.estimateLiveEdge=function(){var _=this.levelDetails;return _===null?null:_.edge+_.age},y.computeLatency=function(){var _=this.estimateLiveEdge();return _===null?null:_-this.currentTime},B(R,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var _=this.config,k=this.levelDetails;return _.liveMaxLatencyDuration!==void 0?_.liveMaxLatencyDuration:k?_.liveMaxLatencyDurationCount*k.targetduration:0}},{key:"targetLatency",get:function(){var _=this.levelDetails;if(_===null)return null;var k=_.holdBack,C=_.partHoldBack,E=_.targetduration,h=this.config,o=h.liveSyncDuration,l=h.liveSyncDurationCount,d=h.lowLatencyMode,S=this.hls.userConfig,v=d&&C||k;(S.liveSyncDuration||S.liveSyncDurationCount||v===0)&&(v=o!==void 0?o:l*E);var p=E,w=1;return v+Math.min(this.stallCount*w,p)}},{key:"liveSyncPosition",get:function(){var _=this.estimateLiveEdge(),k=this.targetLatency,C=this.levelDetails;if(_===null||k===null||C===null)return null;var E=C.edge,h=_-k-this.edgeStalled,o=E-C.totalduration,l=E-(this.config.lowLatencyMode&&C.partTarget||C.targetduration);return Math.min(Math.max(o,h),l)}},{key:"drift",get:function(){var _=this.levelDetails;return _===null?1:_.drift}},{key:"edgeStalled",get:function(){var _=this.levelDetails;if(_===null)return 0;var k=(this.config.lowLatencyMode&&_.partTarget||_.targetduration)*3;return Math.max(_.age-k,0)}},{key:"forwardBufferLength",get:function(){var _=this.media,k=this.levelDetails;if(!_||!k)return 0;var C=_.buffered.length;return C?_.buffered.end(C-1):k.edge-this.currentTime}}]),R}()},"./src/controller/level-controller.ts":function(he,$,O){"use strict";O.r($),O.d($,"default",function(){return h});var Z=O("./src/types/level.ts"),F=O("./src/events.ts"),I=O("./src/errors.ts"),K=O("./src/utils/codecs.ts"),B=O("./src/controller/level-helper.ts"),P=O("./src/controller/base-playlist-controller.ts"),R=O("./src/types/loader.ts");function y(){return y=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var d=arguments[l];for(var S in d)Object.prototype.hasOwnProperty.call(d,S)&&(o[S]=d[S])}return o},y.apply(this,arguments)}function A(o,l){for(var d=0;d<l.length;d++){var S=l[d];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(o,S.key,S)}}function _(o,l,d){return l&&A(o.prototype,l),d&&A(o,d),o}function k(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,C(o,l)}function C(o,l){return C=Object.setPrototypeOf||function(S,v){return S.__proto__=v,S},C(o,l)}var E=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),h=function(o){k(l,o);function l(S){var v;return v=o.call(this,S,"[level-controller]")||this,v._levels=[],v._firstLevel=-1,v._startLevel=void 0,v.currentLevelIndex=-1,v.manualLevelIndex=-1,v.onParsedComplete=void 0,v._registerListeners(),v}var d=l.prototype;return d._registerListeners=function(){var v=this.hls;v.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.on(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),v.on(F.Events.ERROR,this.onError,this)},d._unregisterListeners=function(){var v=this.hls;v.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.off(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),v.off(F.Events.ERROR,this.onError,this)},d.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},d.startLoad=function(){var v=this._levels;v.forEach(function(p){p.loadError=0}),o.prototype.startLoad.call(this)},d.onManifestLoaded=function(v,p){var w=[],b=[],u=[],f,s={},a,T=!1,m=!1,x=!1;if(p.levels.forEach(function(V){var M=V.attrs;T=T||!!(V.width&&V.height),m=m||!!V.videoCodec,x=x||!!V.audioCodec,E&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var N=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;a=s[N],a?a.url.push(V.url):(a=new Z.Level(V),s[N]=a,w.push(a)),M&&(M.AUDIO&&Object(B.addGroupId)(a,"audio",M.AUDIO),M.SUBTITLES&&Object(B.addGroupId)(a,"text",M.SUBTITLES))}),(T||m)&&x&&(w=w.filter(function(V){var M=V.videoCodec,N=V.width,Y=V.height;return!!M||!!(N&&Y)})),w=w.filter(function(V){var M=V.audioCodec,N=V.videoCodec;return(!M||Object(K.isCodecSupportedInMp4)(M,"audio"))&&(!N||Object(K.isCodecSupportedInMp4)(N,"video"))}),p.audioTracks&&(b=p.audioTracks.filter(function(V){return!V.audioCodec||Object(K.isCodecSupportedInMp4)(V.audioCodec,"audio")}),Object(B.assignTrackIdsByGroup)(b)),p.subtitles&&(u=p.subtitles,Object(B.assignTrackIdsByGroup)(u)),w.length>0){f=w[0].bitrate,w.sort(function(V,M){return V.bitrate-M.bitrate}),this._levels=w;for(var D=0;D<w.length;D++)if(w[D].bitrate===f){this._firstLevel=D,this.log("manifest loaded, "+w.length+" level(s) found, first bitrate: "+f);break}var j=x&&!m,z={levels:w,audioTracks:b,subtitleTracks:u,firstLevel:this._firstLevel,stats:p.stats,audio:x,video:m,altAudio:!j&&b.some(function(V){return!!V.url})};this.hls.trigger(F.Events.MANIFEST_PARSED,z),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(F.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:p.url,reason:"no level with compatible codecs found in manifest"})},d.onError=function(v,p){if(o.prototype.onError.call(this,v,p),p.fatal)return;var w=p.context,b=this._levels[this.currentLevelIndex];if(w&&(w.type===R.PlaylistContextType.AUDIO_TRACK&&b.audioGroupIds&&w.groupId===b.audioGroupIds[b.urlId]||w.type===R.PlaylistContextType.SUBTITLE_TRACK&&b.textGroupIds&&w.groupId===b.textGroupIds[b.urlId])){this.redundantFailover(this.currentLevelIndex);return}var u=!1,f=!0,s;switch(p.details){case I.ErrorDetails.FRAG_LOAD_ERROR:case I.ErrorDetails.FRAG_LOAD_TIMEOUT:case I.ErrorDetails.KEY_LOAD_ERROR:case I.ErrorDetails.KEY_LOAD_TIMEOUT:if(p.frag){var a=this._levels[p.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(s=p.frag.level)):s=p.frag.level}break;case I.ErrorDetails.LEVEL_LOAD_ERROR:case I.ErrorDetails.LEVEL_LOAD_TIMEOUT:w&&(w.deliveryDirectives&&(f=!1),s=w.level),u=!0;break;case I.ErrorDetails.REMUX_ALLOC_ERROR:s=p.level,u=!0;break}s!==void 0&&this.recoverLevel(p,s,u,f)},d.recoverLevel=function(v,p,w,b){var u=v.details,f=this._levels[p];if(f.loadError++,w){var s=this.retryLoadingOrFail(v);if(s)v.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(b){var a=f.url.length;if(a>1&&f.loadError<a)v.levelRetry=!0,this.redundantFailover(p);else if(this.manualLevelIndex===-1){var T=p===0?this._levels.length-1:p-1;this.currentLevelIndex!==T&&this._levels[T].loadError===0&&(this.warn(u+": switch to "+T),v.levelRetry=!0,this.hls.nextAutoLevel=T)}}},d.redundantFailover=function(v){var p=this._levels[v],w=p.url.length;if(w>1){var b=(p.urlId+1)%w;this.warn("Switching to redundant URL-id "+b),this._levels.forEach(function(u){u.urlId=b}),this.level=v}},d.onFragLoaded=function(v,p){var w=p.frag;if(w!==void 0&&w.type===R.PlaylistLevelType.MAIN){var b=this._levels[w.level];b!==void 0&&(b.fragmentError=0,b.loadError=0)}},d.onLevelLoaded=function(v,p){var w,b=p.level,u=p.details,f=this._levels[b];if(!f){var s;this.warn("Invalid level index "+b),(s=p.deliveryDirectives)!==null&&s!==void 0&&s.skip&&(u.deltaUpdateFailed=!0);return}b===this.currentLevelIndex?(f.fragmentError===0&&(f.loadError=0,this.retryCount=0),this.playlistLoaded(b,p,f.details)):(w=p.deliveryDirectives)!==null&&w!==void 0&&w.skip&&(u.deltaUpdateFailed=!0)},d.onAudioTrackSwitched=function(v,p){var w=this.hls.levels[this.currentLevelIndex];if(!w)return;if(w.audioGroupIds){for(var b=-1,u=this.hls.audioTracks[p.id].groupId,f=0;f<w.audioGroupIds.length;f++)if(w.audioGroupIds[f]===u){b=f;break}b!==w.urlId&&(w.urlId=b,this.startLoad())}},d.loadPlaylist=function(v){var p=this.currentLevelIndex,w=this._levels[p];if(this.canLoad&&w&&w.url.length>0){var b=w.urlId,u=w.url[b];if(v)try{u=v.addDirectives(u)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Attempt loading level index "+p+(v?" at sn "+v.msn+" part "+v.part:"")+" with URL-id "+b+" "+u),this.clearTimer(),this.hls.trigger(F.Events.LEVEL_LOADING,{url:u,level:p,id:b,deliveryDirectives:v||null})}},d.removeLevel=function(v,p){var w=function(f,s){return s!==p},b=this._levels.filter(function(u,f){return f!==v?!0:u.url.length>1&&p!==void 0?(u.url=u.url.filter(w),u.audioGroupIds&&(u.audioGroupIds=u.audioGroupIds.filter(w)),u.textGroupIds&&(u.textGroupIds=u.textGroupIds.filter(w)),u.urlId=0,!0):!1}).map(function(u,f){var s=u.details;return s!=null&&s.fragments&&s.fragments.forEach(function(a){a.level=f}),u});this._levels=b,this.hls.trigger(F.Events.LEVELS_UPDATED,{levels:b})},_(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(v){var p,w=this._levels;if(w.length===0)return;if(this.currentLevelIndex===v&&(p=w[v])!==null&&p!==void 0&&p.details)return;if(v<0||v>=w.length){var b=v<0;if(this.hls.trigger(F.Events.ERROR,{type:I.ErrorTypes.OTHER_ERROR,details:I.ErrorDetails.LEVEL_SWITCH_ERROR,level:v,fatal:b,reason:"invalid level idx"}),b)return;v=Math.min(v,w.length-1)}this.clearTimer();var u=this.currentLevelIndex,f=w[u],s=w[v];this.log("switching to level "+v+" from "+u),this.currentLevelIndex=v;var a=y({},s,{level:v,maxBitrate:s.maxBitrate,uri:s.uri,urlId:s.urlId});delete a._urlId,this.hls.trigger(F.Events.LEVEL_SWITCHING,a);var T=s.details;if(!T||T.live){var m=this.switchParams(s.uri,f==null?void 0:f.details);this.loadPlaylist(m)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(v){this.manualLevelIndex=v,this._startLevel===void 0&&(this._startLevel=v),v!==-1&&(this.level=v)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(v){this._firstLevel=v}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var v=this.hls.config.startLevel;return v!==void 0?v:this._firstLevel}else return this._startLevel},set:function(v){this._startLevel=v}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(v){this.level=v,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=v)}}]),l}(P.default)},"./src/controller/level-helper.ts":function(he,$,O){"use strict";O.r($),O.d($,"addGroupId",function(){return I}),O.d($,"assignTrackIdsByGroup",function(){return K}),O.d($,"updatePTS",function(){return B}),O.d($,"updateFragPTSDTS",function(){return R}),O.d($,"mergeDetails",function(){return y}),O.d($,"mapPartIntersection",function(){return A}),O.d($,"mapFragmentIntersection",function(){return _}),O.d($,"adjustSliding",function(){return k}),O.d($,"addSliding",function(){return C}),O.d($,"computeReloadInterval",function(){return E}),O.d($,"getFragmentWithSN",function(){return h}),O.d($,"getPartWith",function(){return o});var Z=O("./src/polyfills/number.ts"),F=O("./src/utils/logger.ts");function I(l,d,S){switch(d){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(S);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(S);break}}function K(l){var d={};l.forEach(function(S){var v=S.groupId||"";S.id=d[v]=d[v]||0,d[v]++})}function B(l,d,S){var v=l[d],p=l[S];P(v,p)}function P(l,d){var S=d.startPTS;if(Object(Z.isFiniteNumber)(S)){var v=0,p;d.sn>l.sn?(v=S-l.start,p=l):(v=l.start-S,p=d),p.duration!==v&&(p.duration=v)}else if(d.sn>l.sn){var w=l.cc===d.cc;w&&l.minEndPTS?d.start=l.start+(l.minEndPTS-l.start):d.start=l.start+l.duration}else d.start=Math.max(l.start-d.duration,0)}function R(l,d,S,v,p,w){var b=v-S;b<=0&&(F.logger.warn("Fragment should have a positive duration",d),v=S+d.duration,w=p+d.duration);var u=S,f=v,s=d.startPTS,a=d.endPTS;if(Object(Z.isFiniteNumber)(s)){var T=Math.abs(s-S);Object(Z.isFiniteNumber)(d.deltaPTS)?d.deltaPTS=Math.max(T,d.deltaPTS):d.deltaPTS=T,u=Math.max(S,s),S=Math.min(S,s),p=Math.min(p,d.startDTS),f=Math.min(v,a),v=Math.max(v,a),w=Math.max(w,d.endDTS)}d.duration=v-S;var m=S-d.start;d.appendedPTS=v,d.start=d.startPTS=S,d.maxStartPTS=u,d.startDTS=p,d.endPTS=v,d.minEndPTS=f,d.endDTS=w;var x=d.sn;if(!l||x<l.startSN||x>l.endSN)return 0;var D,j=x-l.startSN,z=l.fragments;for(z[j]=d,D=j;D>0;D--)P(z[D],z[D-1]);for(D=j;D<z.length-1;D++)P(z[D],z[D+1]);return l.fragmentHint&&P(z[z.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,m}function y(l,d){for(var S=null,v=l.fragments,p=v.length-1;p>=0;p--){var w=v[p].initSegment;if(w){S=w;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var b=0,u;if(_(l,d,function(D,j){D.relurl&&(b=D.cc-j.cc),Object(Z.isFiniteNumber)(D.startPTS)&&Object(Z.isFiniteNumber)(D.endPTS)&&(j.start=j.startPTS=D.startPTS,j.startDTS=D.startDTS,j.appendedPTS=D.appendedPTS,j.maxStartPTS=D.maxStartPTS,j.endPTS=D.endPTS,j.endDTS=D.endDTS,j.minEndPTS=D.minEndPTS,j.duration=D.endPTS-D.startPTS,j.duration&&(u=j),d.PTSKnown=d.alignedSliding=!0),j.elementaryStreams=D.elementaryStreams,j.loader=D.loader,j.stats=D.stats,j.urlId=D.urlId,D.initSegment&&(j.initSegment=D.initSegment,S=D.initSegment)}),S){var f=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments;f.forEach(function(D){var j;(!D.initSegment||D.initSegment.relurl===((j=S)===null||j===void 0?void 0:j.relurl))&&(D.initSegment=S)})}if(d.skippedSegments&&(d.deltaUpdateFailed=d.fragments.some(function(D){return!D}),d.deltaUpdateFailed)){F.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var s=d.skippedSegments;s--;)d.fragments.shift();d.startSN=d.fragments[0].sn,d.startCC=d.fragments[0].cc}var a=d.fragments;if(b){F.logger.warn("discontinuity sliding from playlist, take drift into account");for(var T=0;T<a.length;T++)a[T].cc+=b}d.skippedSegments&&(d.startCC=d.fragments[0].cc),A(l.partList,d.partList,function(D,j){j.elementaryStreams=D.elementaryStreams,j.stats=D.stats}),u?R(d,u,u.startPTS,u.endPTS,u.startDTS,u.endDTS):k(l,d),a.length&&(d.totalduration=d.edge-a[0].start),d.driftStartTime=l.driftStartTime,d.driftStart=l.driftStart;var m=d.advancedDateTime;if(d.advanced&&m){var x=d.edge;d.driftStart||(d.driftStartTime=m,d.driftStart=x),d.driftEndTime=m,d.driftEnd=x}else d.driftEndTime=l.driftEndTime,d.driftEnd=l.driftEnd,d.advancedDateTime=l.advancedDateTime}function A(l,d,S){if(l&&d)for(var v=0,p=0,w=l.length;p<=w;p++){var b=l[p],u=d[p+v];b&&u&&b.index===u.index&&b.fragment.sn===u.fragment.sn?S(b,u):v--}}function _(l,d,S){for(var v=d.skippedSegments,p=Math.max(l.startSN,d.startSN)-d.startSN,w=(l.fragmentHint?1:0)+(v?d.endSN:Math.min(l.endSN,d.endSN))-d.startSN,b=d.startSN-l.startSN,u=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments,f=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,s=p;s<=w;s++){var a=f[b+s],T=u[s];v&&!T&&s<v&&(T=d.fragments[s]=a),a&&T&&S(a,T)}}function k(l,d){var S=d.startSN+d.skippedSegments-l.startSN,v=l.fragments;if(S<0||S>=v.length)return;C(d,v[S].start)}function C(l,d){if(d){for(var S=l.fragments,v=l.skippedSegments;v<S.length;v++)S[v].start+=d;l.fragmentHint&&(l.fragmentHint.start+=d)}}function E(l,d){var S=1e3*l.levelTargetDuration,v=S/2,p=l.age,w=p>0&&p<S*3,b=d.loading.end-d.loading.start,u,f=l.availabilityDelay;if(l.updated===!1)if(w){var s=333*l.misses;u=Math.max(Math.min(v,b*2),s),l.availabilityDelay=(l.availabilityDelay||0)+u}else u=v;else w?(f=Math.min(f||S/2,p),l.availabilityDelay=f,u=f+S-p):u=S-b;return Math.round(u)}function h(l,d,S){if(!l||!l.details)return null;var v=l.details,p=v.fragments[d-v.startSN];return p||(p=v.fragmentHint,p&&p.sn===d?p:d<v.startSN&&S&&S.sn===d?S:null)}function o(l,d,S){if(!l||!l.details)return null;var v=l.details.partList;if(v)for(var p=v.length;p--;){var w=v[p];if(w.index===S&&w.fragment.sn===d)return w}return null}},"./src/controller/stream-controller.ts":function(he,$,O){"use strict";O.r($),O.d($,"default",function(){return v});var Z=O("./src/polyfills/number.ts"),F=O("./src/controller/base-stream-controller.ts"),I=O("./src/is-supported.ts"),K=O("./src/events.ts"),B=O("./src/utils/buffer-helper.ts"),P=O("./src/controller/fragment-tracker.ts"),R=O("./src/types/loader.ts"),y=O("./src/loader/fragment.ts"),A=O("./src/demux/transmuxer-interface.ts"),_=O("./src/types/transmuxer.ts"),k=O("./src/controller/gap-controller.ts"),C=O("./src/errors.ts"),E=O("./src/utils/logger.ts");function h(p,w){for(var b=0;b<w.length;b++){var u=w[b];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(p,u.key,u)}}function o(p,w,b){return w&&h(p.prototype,w),b&&h(p,b),p}function l(p,w){p.prototype=Object.create(w.prototype),p.prototype.constructor=p,d(p,w)}function d(p,w){return d=Object.setPrototypeOf||function(u,f){return u.__proto__=f,u},d(p,w)}var S=100,v=function(p){l(w,p);function w(u,f){var s;return s=p.call(this,u,f,"[stream-controller]")||this,s.audioCodecSwap=!1,s.gapController=null,s.level=-1,s._forceStartLoad=!1,s.altAudio=!1,s.audioOnly=!1,s.fragPlaying=null,s.onvplaying=null,s.onvseeked=null,s.fragLastKbps=0,s.stalled=!1,s.couldBacktrack=!1,s.audioCodecSwitch=!1,s.videoBuffer=null,s._registerListeners(),s}var b=w.prototype;return b._registerListeners=function(){var f=this.hls;f.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),f.on(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(K.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.on(K.Events.ERROR,this.onError,this),f.on(K.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.on(K.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(K.Events.BUFFER_CREATED,this.onBufferCreated,this),f.on(K.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.on(K.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.on(K.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var f=this.hls;f.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.off(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(K.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.off(K.Events.ERROR,this.onError,this),f.off(K.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.off(K.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(K.Events.BUFFER_CREATED,this.onBufferCreated,this),f.off(K.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.off(K.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.off(K.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(f){if(this.levels){var s=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(S),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var T=a.startLevel;T===-1&&(a.config.testBandwidth?(T=0,this.bitrateTest=!0):T=a.nextAutoLevel),this.level=a.nextLoadLevel=T,this.loadedmetadata=!1}s>0&&f===-1&&(this.log("Override startPosition with lastCurrentTime @"+s.toFixed(3)),f=s),this.state=F.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=f,this.tick()}else this._forceStartLoad=!0,this.state=F.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,p.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_LEVEL:{var f,s=this.levels,a=this.level,T=s==null||((f=s[a])===null||f===void 0)?void 0:f.details;if(T&&(!T.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(T))break;this.state=F.State.IDLE;break}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var m,x=self.performance.now(),D=this.retryDate;(!D||x>=D||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=F.State.IDLE)}break;default:break}this.onTickEnd()},b.onTickEnd=function(){p.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var f,s,a=this.hls,T=this.levelLastLoaded,m=this.levels,x=this.media,D=a.config,j=a.nextLoadLevel;if(T===null||!x&&(this.startFragRequested||!D.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[j])return;var z=m[j];this.level=a.nextLoadLevel=j;var V=z.details;if(!V||this.state===F.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==j){this.state=F.State.WAITING_LEVEL;return}var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:x,R.PlaylistLevelType.MAIN);if(M===null)return;var N=M.len,Y=this.getMaxBufferLength(z.maxBitrate);if(N>=Y)return;if(this._streamEnded(M,V)){var oe={};this.altAudio&&(oe.type="video"),this.hls.trigger(K.Events.BUFFER_EOS,oe),this.state=F.State.ENDED;return}var pe=M.end,ve=this.getNextFragment(pe,V);if(this.couldBacktrack&&!this.fragPrevious&&ve&&ve.sn!=="initSegment"){var Le=ve.sn-V.startSN;Le>1&&(ve=V.fragments[Le-1],this.fragmentTracker.removeFragment(ve))}if(ve&&this.fragmentTracker.getState(ve)===P.FragmentState.OK&&this.nextLoadPosition>pe){var ke=this.audioOnly&&!this.altAudio?y.ElementaryStreamTypes.AUDIO:y.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(x,ke,R.PlaylistLevelType.MAIN),ve=this.getNextFragment(this.nextLoadPosition,V)}if(!ve)return;ve.initSegment&&!ve.initSegment.data&&!this.bitrateTest&&(ve=ve.initSegment),((f=ve.decryptdata)===null||f===void 0?void 0:f.keyFormat)==="identity"&&!((s=ve.decryptdata)!==null&&s!==void 0&&s.key)?this.loadKey(ve,V):this.loadFragment(ve,V,pe)},b.loadFragment=function(f,s,a){var T,m=this.fragmentTracker.getState(f);if(this.fragCurrent=f,m===P.FragmentState.BACKTRACKED){var x=this.fragmentTracker.getBacktrackData(f);if(x){this._handleFragmentLoadProgress(x),this._handleFragmentLoadComplete(x);return}else m=P.FragmentState.NOT_LOADED}m===P.FragmentState.NOT_LOADED||m===P.FragmentState.PARTIAL?f.sn==="initSegment"?this._loadInitSegment(f):this.bitrateTest?(f.bitrateTest=!0,this.log("Fragment "+f.sn+" of level "+f.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(f)):(this.startFragRequested=!0,p.prototype.loadFragment.call(this,f,s,a)):m===P.FragmentState.APPENDING?this.reduceMaxBufferLength(f.duration)&&this.fragmentTracker.removeFragment(f):((T=this.media)===null||T===void 0?void 0:T.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(f){var s=this.fragmentTracker.getAppendedFrag(f,R.PlaylistLevelType.MAIN);return s&&"fragment"in s?s.fragment:s},b.getBufferedFrag=function(f){return this.fragmentTracker.getBufferedFrag(f,R.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(f){return f?this.getBufferedFrag(f.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var f=this.levels,s=this.media;if(s!=null&&s.readyState){var a,T=this.getAppendedFrag(s.currentTime);if(T&&T.start>1&&this.flushMainBuffer(0,T.start-1),!s.paused&&f){var m=this.hls.nextLoadLevel,x=f[m],D=this.fragLastKbps;D&&this.fragCurrent?a=this.fragCurrent.duration*x.maxBitrate/(1e3*D)+1:a=0}else a=0;var j=this.getBufferedFrag(s.currentTime+a);if(j){var z=this.followingBufferedFrag(j);if(z){this.abortCurrentFrag();var V=z.maxStartPTS?z.maxStartPTS:z.start,M=z.duration,N=Math.max(j.end,V+Math.min(Math.max(M-this.config.maxFragLookUpTolerance,M*.5),M*.75));this.flushMainBuffer(N,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var f=this.fragCurrent;this.fragCurrent=null,f!=null&&f.loader&&f.loader.abort(),this.state===F.State.KEY_LOADING&&(this.state=F.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(f,s){p.prototype.flushMainBuffer.call(this,f,s,this.altAudio?"video":null)},b.onMediaAttached=function(f,s){p.prototype.onMediaAttached.call(this,f,s);var a=s.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new k.default(this.config,a,this.fragmentTracker,this.hls)},b.onMediaDetaching=function(){var f=this.media;f&&(f.removeEventListener("playing",this.onvplaying),f.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),p.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var f=this.media,s=f?f.currentTime:null;Object(Z.isFiniteNumber)(s)&&this.log("Media seeked to "+s.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(K.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},b.onManifestParsed=function(f,s){var a=!1,T=!1,m;s.levels.forEach(function(x){m=x.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(a=!0),m.indexOf("mp4a.40.5")!==-1&&(T=!0))}),this.audioCodecSwitch=a&&T&&!Object(I.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=s.levels,this.startFragRequested=!1},b.onLevelLoading=function(f,s){var a=this.levels;if(!a||this.state!==F.State.IDLE)return;var T=a[s.level];(!T.details||T.details.live&&this.levelLastLoaded!==s.level||this.waitForCdnTuneIn(T.details))&&(this.state=F.State.WAITING_LEVEL)},b.onLevelLoaded=function(f,s){var a,T=this.levels,m=s.level,x=s.details,D=x.totalduration;if(!T){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+x.startSN+","+x.endSN+"], cc ["+x.startCC+", "+x.endCC+"] duration:"+D);var j=this.fragCurrent;j&&(this.state===F.State.FRAG_LOADING||this.state===F.State.FRAG_LOADING_WAITING_RETRY)&&(j.level!==s.level&&j.loader&&(this.state=F.State.IDLE,j.loader.abort()));var z=T[m],V=0;if(x.live||(a=z.details)!==null&&a!==void 0&&a.live){if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed)return;V=this.alignPlaylists(x,z.details)}if(z.details=x,this.levelLastLoaded=m,this.hls.trigger(K.Events.LEVEL_UPDATED,{details:x,level:m}),this.state===F.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(x))return;this.state=F.State.IDLE}this.startFragRequested?x.live&&this.synchronizeToLiveEdge(x):this.setStartPosition(x,V),this.tick()},b._handleFragmentLoadProgress=function(f){var s,a=f.frag,T=f.part,m=f.payload,x=this.levels;if(!x){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var D=x[a.level],j=D.details;if(!j){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var z=D.videoCodec,V=j.PTSKnown||!j.live,M=(s=a.initSegment)===null||s===void 0?void 0:s.data,N=this._getAudioCodec(D),Y=this.transmuxer=this.transmuxer||new A.default(this.hls,R.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),oe=T?T.index:-1,pe=oe!==-1,ve=new _.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,m.byteLength,oe,pe),Le=this.initPTS[a.cc];Y.push(m,M,N,z,a,T,j.totalduration,V,ve,Le)},b.onAudioTrackSwitching=function(f,s){var a=this.altAudio,T=!!s.url,m=s.id;if(!T){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var x=this.fragCurrent;x!=null&&x.loader&&(this.log("Switching to main audio track, cancel main fragment load"),x.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var D=this.hls;a&&D.trigger(K.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),D.trigger(K.Events.AUDIO_TRACK_SWITCHED,{id:m})}},b.onAudioTrackSwitched=function(f,s){var a=s.id,T=!!this.hls.audioTracks[a].url;if(T){var m=this.videoBuffer;m&&this.mediaBuffer!==m&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=m)}this.altAudio=T,this.tick()},b.onBufferCreated=function(f,s){var a=s.tracks,T,m,x=!1;for(var D in a){var j=a[D];if(j.id==="main"){if(m=D,T=j,D==="video"){var z=a[D];z&&(this.videoBuffer=z.buffer)}}else x=!0}x&&T?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=T.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(f,s){var a=s.frag,T=s.part;if(a&&a.type!==R.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(T?" p: "+T.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===F.State.PARSED&&(this.state=F.State.IDLE);return}var m=T?T.stats:a.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,T)},b.onError=function(f,s){switch(s.details){case C.ErrorDetails.FRAG_LOAD_ERROR:case C.ErrorDetails.FRAG_LOAD_TIMEOUT:case C.ErrorDetails.KEY_LOAD_ERROR:case C.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.MAIN,s);break;case C.ErrorDetails.LEVEL_LOAD_ERROR:case C.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==F.State.ERROR&&(s.fatal?(this.warn(""+s.details),this.state=F.State.ERROR):!s.levelRetry&&this.state===F.State.WAITING_LEVEL&&(this.state=F.State.IDLE));break;case C.ErrorDetails.BUFFER_FULL_ERROR:if(s.parent==="main"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var a=!0,T=this.getFwdBufferInfo(this.media,R.PlaylistLevelType.MAIN);T&&T.len>.5&&(a=!this.reduceMaxBufferLength(T.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},b.checkBuffer=function(){var f=this.media,s=this.gapController;if(!f||!s||!f.readyState)return;var a=B.BufferHelper.getBuffered(f);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):s.poll(this.lastCurrentTime),this.lastCurrentTime=f.currentTime},b.onFragLoadEmergencyAborted=function(){this.state=F.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},b.onBufferFlushed=function(f,s){var a=s.type;if(a!==y.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var T=(a===y.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(T,a,R.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(f,s){this.levels=s.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var f=this.media,s=f.currentTime,a=this.startPosition;if(a>=0&&s<a){if(f.seeking){E.logger.log("could not seek to "+a+", already seeking at "+s);return}var T=B.BufferHelper.getBuffered(f),m=T.length?T.start(0):0,x=m-a;x>0&&(x<this.config.maxBufferHole||x<this.config.maxFragLookUpTolerance)&&(E.logger.log("adjusting start position by "+x+" to match buffer start"),a+=x,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+s),f.currentTime=a}},b._getAudioCodec=function(f){var s=this.config.defaultAudioCodec||f.audioCodec;return this.audioCodecSwap&&s&&(this.log("Swapping audio codec"),s.indexOf("mp4a.40.5")!==-1?s="mp4a.40.2":s="mp4a.40.5"),s},b._loadBitrateTestFrag=function(f){var s=this;this._doFragLoad(f).then(function(a){var T=s.hls;if(!a||T.nextLoadLevel||s.fragContextChanged(f))return;s.fragLoadError=0,s.state=F.State.IDLE,s.startFragRequested=!1,s.bitrateTest=!1;var m=f.stats;m.parsing.start=m.parsing.end=m.buffering.start=m.buffering.end=self.performance.now(),T.trigger(K.Events.FRAG_LOADED,a)})},b._handleTransmuxComplete=function(f){var s,a="main",T=this.hls,m=f.remuxResult,x=f.chunkMeta,D=this.getCurrentContext(x);if(!D){this.warn("The loading context changed while buffering fragment "+x.sn+" of level "+x.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(x.level);return}var j=D.frag,z=D.part,V=D.level,M=m.video,N=m.text,Y=m.id3,oe=m.initSegment,pe=this.altAudio?void 0:m.audio;if(this.fragContextChanged(j))return;if(this.state=F.State.PARSING,oe){oe.tracks&&(this._bufferInitSegment(V,oe.tracks,j,x),T.trigger(K.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:a,tracks:oe.tracks}));var ve=oe.initPTS,Le=oe.timescale;Object(Z.isFiniteNumber)(ve)&&(this.initPTS[j.cc]=ve,T.trigger(K.Events.INIT_PTS_FOUND,{frag:j,id:a,initPTS:ve,timescale:Le}))}if(M&&m.independent!==!1){if(V.details){var ke=M.startPTS,ce=M.endPTS,ae=M.startDTS,de=M.endDTS;if(z)z.elementaryStreams[M.type]={startPTS:ke,endPTS:ce,startDTS:ae,endDTS:de};else if(M.firstKeyFrame&&M.independent&&(this.couldBacktrack=!0),M.dropped&&M.independent){var ne=this.getLoadPosition()+this.config.maxBufferHole;if(ne<ke){this.backtrack(j);return}j.setElementaryStreamInfo(M.type,j.start,ce,j.start,de,!0)}j.setElementaryStreamInfo(M.type,ke,ce,ae,de),this.bufferFragmentData(M,j,z,x)}}else if(m.independent===!1){this.backtrack(j);return}if(pe){var se=pe.startPTS,J=pe.endPTS,ee=pe.startDTS,ie=pe.endDTS;z&&(z.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:se,endPTS:J,startDTS:ee,endDTS:ie}),j.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,se,J,ee,ie),this.bufferFragmentData(pe,j,z,x)}if(Y!=null&&(s=Y.samples)!==null&&s!==void 0&&s.length){var fe={frag:j,id:a,samples:Y.samples};T.trigger(K.Events.FRAG_PARSING_METADATA,fe)}if(N){var Ae={frag:j,id:a,samples:N.samples};T.trigger(K.Events.FRAG_PARSING_USERDATA,Ae)}},b._bufferInitSegment=function(f,s,a,T){var m=this;if(this.state!==F.State.PARSING)return;this.audioOnly=!!s.audio&&!s.video,this.altAudio&&!this.audioOnly&&delete s.audio;var x=s.audio,D=s.video,j=s.audiovideo;if(x){var z=f.audioCodec,V=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(z&&(z.indexOf("mp4a.40.5")!==-1?z="mp4a.40.2":z="mp4a.40.5"),x.metadata.channelCount!==1&&V.indexOf("firefox")===-1&&(z="mp4a.40.5")),V.indexOf("android")!==-1&&x.container!=="audio/mpeg"&&(z="mp4a.40.2",this.log("Android: force audio codec to "+z)),f.audioCodec&&f.audioCodec!==z&&this.log('Swapping manifest audio codec "'+f.audioCodec+'" for "'+z+'"'),x.levelCodec=z,x.id="main",this.log("Init audio buffer, container:"+x.container+", codecs[selected/level/parsed]=["+(z||"")+"/"+(f.audioCodec||"")+"/"+x.codec+"]")}D&&(D.levelCodec=f.videoCodec,D.id="main",this.log("Init video buffer, container:"+D.container+", codecs[level/parsed]=["+(f.videoCodec||"")+"/"+D.codec+"]")),j&&this.log("Init audiovideo buffer, container:"+j.container+", codecs[level/parsed]=["+(f.attrs.CODECS||"")+"/"+j.codec+"]"),this.hls.trigger(K.Events.BUFFER_CODECS,s),Object.keys(s).forEach(function(M){var N=s[M],Y=N.initSegment;Y!=null&&Y.byteLength&&m.hls.trigger(K.Events.BUFFER_APPENDING,{type:M,data:Y,frag:a,part:null,chunkMeta:T,parent:a.type})}),this.tick()},b.backtrack=function(f){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(f);var s=this.fragmentTracker.backtrack(f);this.fragPrevious=null,this.nextLoadPosition=f.start,s?this.resetFragmentLoading(f):this.state=F.State.BACKTRACKING},b.checkFragmentChanged=function(){var f=this.media,s=null;if(f&&f.readyState>1&&f.seeking===!1){var a=f.currentTime;if(B.BufferHelper.isBuffered(f,a)?s=this.getAppendedFrag(a):B.BufferHelper.isBuffered(f,a+.1)&&(s=this.getAppendedFrag(a+.1)),s){var T=this.fragPlaying,m=s.level;(!T||s.sn!==T.sn||T.level!==m||s.urlId!==T.urlId)&&(this.hls.trigger(K.Events.FRAG_CHANGED,{frag:s}),(!T||T.level!==m)&&this.hls.trigger(K.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=s)}}},o(w,[{key:"nextLevel",get:function(){var f=this.nextBufferedFrag;return f?f.level:-1}},{key:"currentLevel",get:function(){var f=this.media;if(f){var s=this.getAppendedFrag(f.currentTime);if(s)return s.level}return-1}},{key:"nextBufferedFrag",get:function(){var f=this.media;if(f){var s=this.getAppendedFrag(f.currentTime);return this.followingBufferedFrag(s)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),w}(F.default)},"./src/controller/subtitle-stream-controller.ts":function(he,$,O){"use strict";O.r($),O.d($,"SubtitleStreamController",function(){return l});var Z=O("./src/events.ts"),F=O("./src/utils/logger.ts"),I=O("./src/utils/buffer-helper.ts"),K=O("./src/controller/fragment-finders.ts"),B=O("./src/utils/discontinuities.ts"),P=O("./src/controller/level-helper.ts"),R=O("./src/controller/fragment-tracker.ts"),y=O("./src/controller/base-stream-controller.ts"),A=O("./src/types/loader.ts"),_=O("./src/types/level.ts");function k(d,S){for(var v=0;v<S.length;v++){var p=S[v];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(d,p.key,p)}}function C(d,S,v){return S&&k(d.prototype,S),v&&k(d,v),d}function E(d,S){d.prototype=Object.create(S.prototype),d.prototype.constructor=d,h(d,S)}function h(d,S){return h=Object.setPrototypeOf||function(p,w){return p.__proto__=w,p},h(d,S)}var o=500,l=function(d){E(S,d);function S(p,w){var b;return b=d.call(this,p,w,"[subtitle-stream-controller]")||this,b.levels=[],b.currentTrackId=-1,b.tracksBuffered=[],b.mainDetails=null,b._registerListeners(),b}var v=S.prototype;return v.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},v._registerListeners=function(){var w=this.hls;w.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.on(Z.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.on(Z.Events.ERROR,this.onError,this),w.on(Z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),w.on(Z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),w.on(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),w.on(Z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),w.on(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v._unregisterListeners=function(){var w=this.hls;w.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.off(Z.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.off(Z.Events.ERROR,this.onError,this),w.off(Z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),w.off(Z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),w.off(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),w.off(Z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),w.off(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v.startLoad=function(){this.stopLoad(),this.state=y.State.IDLE,this.setInterval(o),this.tick()},v.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},v.onLevelLoaded=function(w,b){this.mainDetails=b.details},v.onSubtitleFragProcessed=function(w,b){var u=b.frag,f=b.success;if(this.fragPrevious=u,this.state=y.State.IDLE,!f)return;var s=this.tracksBuffered[this.currentTrackId];if(!s)return;for(var a,T=u.start,m=0;m<s.length;m++)if(T>=s[m].start&&T<=s[m].end){a=s[m];break}var x=u.start+u.duration;a?a.end=x:(a={start:T,end:x},s.push(a)),this.fragmentTracker.fragBuffered(u)},v.onBufferFlushing=function(w,b){var u=b.startOffset,f=b.endOffset;if(u===0&&f!==Number.POSITIVE_INFINITY){var s=this.currentTrackId,a=this.levels;if(!a.length||!a[s]||!a[s].details)return;var T=a[s].details,m=T.targetduration,x=f-m;if(x<=0)return;b.endOffsetSubtitles=Math.max(0,x),this.tracksBuffered.forEach(function(D){for(var j=0;j<D.length;){if(D[j].end<=x){D.shift();continue}else if(D[j].start<x)D[j].start=x;else break;j++}}),this.fragmentTracker.removeFragmentsInRange(u,x,A.PlaylistLevelType.SUBTITLE)}},v.onError=function(w,b){var u,f=b.frag;if(!f||f.type!==A.PlaylistLevelType.SUBTITLE)return;(u=this.fragCurrent)!==null&&u!==void 0&&u.loader&&this.fragCurrent.loader.abort(),this.state=y.State.IDLE},v.onSubtitleTracksUpdated=function(w,b){var u=this,f=b.subtitleTracks;this.tracksBuffered=[],this.levels=f.map(function(s){return new _.Level(s)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(s){u.tracksBuffered[s.id]=[]}),this.mediaBuffer=null},v.onSubtitleTrackSwitch=function(w,b){if(this.currentTrackId=b.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var u=this.levels[this.currentTrackId];u!=null&&u.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,u&&this.setInterval(o)},v.onSubtitleTrackLoaded=function(w,b){var u,f=b.details,s=b.id,a=this.currentTrackId,T=this.levels;if(!T.length)return;var m=T[a];if(s>=T.length||s!==a||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,f.live||(u=m.details)!==null&&u!==void 0&&u.live){var x=this.mainDetails;if(f.deltaUpdateFailed||!x)return;var D=x.fragments[0];if(!m.details)f.hasProgramDateTime&&x.hasProgramDateTime?Object(B.alignMediaPlaylistByPDT)(f,x):D&&Object(P.addSliding)(f,D.start);else{var j=this.alignPlaylists(f,m.details);j===0&&D&&Object(P.addSliding)(f,D.start)}}if(m.details=f,this.levelLastLoaded=s,this.tick(),f.live&&!this.fragCurrent&&this.media&&this.state===y.State.IDLE){var z=Object(K.findFragmentByPTS)(null,f.fragments,this.media.currentTime,0);z||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},v._handleFragmentLoadComplete=function(w){var b=w.frag,u=w.payload,f=b.decryptdata,s=this.hls;if(this.fragContextChanged(b))return;if(u&&u.byteLength>0&&f&&f.key&&f.iv&&f.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(u),f.key.buffer,f.iv.buffer).then(function(T){var m=performance.now();s.trigger(Z.Events.FRAG_DECRYPTED,{frag:b,payload:T,stats:{tstart:a,tdecrypt:m}})})}},v.doTick=function(){if(!this.media){this.state=y.State.IDLE;return}if(this.state===y.State.IDLE){var w,b=this.currentTrackId,u=this.levels;if(!u.length||!u[b]||!u[b].details)return;var f=u[b].details,s=f.targetduration,a=this.config,T=this.media,m=I.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,T.currentTime-s,a.maxBufferHole),x=m.end,D=m.len,j=this.getMaxBufferLength()+s;if(D>j)return;console.assert(f,"Subtitle track details are defined on idle subtitle stream controller tick");var z=f.fragments,V=z.length,M=f.edge,N,Y=this.fragPrevious;if(x<M){var oe=a.maxFragLookUpTolerance;Y&&f.hasProgramDateTime&&(N=Object(K.findFragmentByPDT)(z,Y.endProgramDateTime,oe)),N||(N=Object(K.findFragmentByPTS)(Y,z,x,oe),!N&&Y&&Y.start<z[0].start&&(N=z[0]))}else N=z[V-1];(w=N)!==null&&w!==void 0&&w.encrypted?(F.logger.log("Loading key for "+N.sn),this.state=y.State.KEY_LOADING,this.hls.trigger(Z.Events.KEY_LOADING,{frag:N})):N&&this.fragmentTracker.getState(N)===R.FragmentState.NOT_LOADED&&this.loadFragment(N,f,x)}},v.loadFragment=function(w,b,u){this.fragCurrent=w,d.prototype.loadFragment.call(this,w,b,u)},C(S,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),S}(y.default)},"./src/controller/subtitle-track-controller.ts":function(he,$,O){"use strict";O.r($);var Z=O("./src/events.ts"),F=O("./src/utils/texttrack-utils.ts"),I=O("./src/controller/base-playlist-controller.ts"),K=O("./src/types/loader.ts");function B(k,C){for(var E=0;E<C.length;E++){var h=C[E];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(k,h.key,h)}}function P(k,C,E){return C&&B(k.prototype,C),E&&B(k,E),k}function R(k,C){k.prototype=Object.create(C.prototype),k.prototype.constructor=k,y(k,C)}function y(k,C){return y=Object.setPrototypeOf||function(h,o){return h.__proto__=o,h},y(k,C)}var A=function(k){R(C,k);function C(h){var o;return o=k.call(this,h,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var E=C.prototype;return E.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,k.prototype.destroy.call(this)},E.registerListeners=function(){var o=this.hls;o.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(Z.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){var o=this.hls;o.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(Z.Events.ERROR,this.onError,this)},E.onMediaAttached=function(o,l){if(this.media=l.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},E.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},E.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=_(this.media.textTracks);o.forEach(function(l){Object(F.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},E.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},E.onManifestParsed=function(o,l){this.tracks=l.subtitleTracks},E.onSubtitleTrackLoaded=function(o,l){var d=l.id,S=l.details,v=this.trackId,p=this.tracksInGroup[v];if(!p){this.warn("Invalid subtitle track id "+d);return}var w=p.details;p.details=l.details,this.log("subtitle track "+d+" loaded ["+S.startSN+"-"+S.endSN+"]"),d===this.trackId&&(this.retryCount=0,this.playlistLoaded(d,l,w))},E.onLevelLoading=function(o,l){this.switchLevel(l.level)},E.onLevelSwitching=function(o,l){this.switchLevel(l.level)},E.switchLevel=function(o){var l=this.hls.levels[o];if(!(l!=null&&l.textGroupIds))return;var d=l.textGroupIds[l.urlId];if(this.groupId!==d){var S=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,v=this.tracks.filter(function(b){return!d||b.groupId===d});this.tracksInGroup=v;var p=this.findTrackId(S==null?void 0:S.name)||this.findTrackId();this.groupId=d;var w={subtitleTracks:v};this.log("Updating subtitle tracks, "+v.length+' track(s) found in "'+d+'" group-id'),this.hls.trigger(Z.Events.SUBTITLE_TRACKS_UPDATED,w),p!==-1&&this.setSubtitleTrack(p,S)}},E.findTrackId=function(o){for(var l=this.tracksInGroup,d=0;d<l.length;d++){var S=l[d];if((!this.selectDefaultTrack||S.default)&&(!o||o===S.name))return S.id}return-1},E.onError=function(o,l){if(k.prototype.onError.call(this,o,l),l.fatal||!l.context)return;l.context.type===K.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},E.loadPlaylist=function(o){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var d=l.id,S=l.groupId,v=l.url;if(o)try{v=o.addDirectives(v)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("Loading subtitle playlist for id "+d),this.hls.trigger(Z.Events.SUBTITLE_TRACK_LOADING,{url:v,id:d,groupId:S,deliveryDirectives:o||null})}},E.toggleTrackModes=function(o){var l=this,d=this.media,S=this.subtitleDisplay,v=this.trackId;if(!d)return;var p=_(d.textTracks),w=p.filter(function(f){return f.groupId===l.groupId});if(o===-1)[].slice.call(p).forEach(function(f){f.mode="disabled"});else{var b=w[v];b&&(b.mode="disabled")}var u=w[o];u&&(u.mode=S?"showing":"hidden")},E.setSubtitleTrack=function(o,l){var d,S=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(d=S[o])!==null&&d!==void 0&&d.details)||o<-1||o>=S.length)return;this.clearTimer();var v=S[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,v){var p=v.id,w=v.groupId,b=w===void 0?"":w,u=v.name,f=v.type,s=v.url;this.hls.trigger(Z.Events.SUBTITLE_TRACK_SWITCH,{id:p,groupId:b,name:u,type:f,url:s});var a=this.switchParams(v.url,l==null?void 0:l.details);this.loadPlaylist(a)}else this.hls.trigger(Z.Events.SUBTITLE_TRACK_SWITCH,{id:o})},E.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,l=_(this.media.textTracks),d=0;d<l.length;d++)if(l[d].mode==="hidden")o=d;else if(l[d].mode==="showing"){o=d;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},P(C,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,l)}}]),C}(I.default);function _(k){for(var C=[],E=0;E<k.length;E++){var h=k[E];h.kind==="subtitles"&&h.label&&C.push(k[E])}return C}$.default=A},"./src/controller/timeline-controller.ts":function(he,$,O){"use strict";O.r($),O.d($,"TimelineController",function(){return _});var Z=O("./src/polyfills/number.ts"),F=O("./src/events.ts"),I=O("./src/utils/cea-608-parser.ts"),K=O("./src/utils/output-filter.ts"),B=O("./src/utils/webvtt-parser.ts"),P=O("./src/utils/texttrack-utils.ts"),R=O("./src/utils/imsc1-ttml-parser.ts"),y=O("./src/types/loader.ts"),A=O("./src/utils/logger.ts"),_=function(){function h(l){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=E(),this.captionsProperties=void 0,this.hls=l,this.config=l.config,this.Cues=l.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var d=new K.default(this,"textTrack1"),S=new K.default(this,"textTrack2"),v=new K.default(this,"textTrack3"),p=new K.default(this,"textTrack4");this.cea608Parser1=new I.default(1,d,S),this.cea608Parser2=new I.default(3,v,p)}l.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(F.Events.FRAG_LOADING,this.onFragLoading,this),l.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=h.prototype;return o.destroy=function(){var d=this.hls;d.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),d.off(F.Events.FRAG_LOADING,this.onFragLoading,this),d.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),d.off(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),d.off(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),d.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(d,S,v,p,w){for(var b=!1,u=w.length;u--;){var f=w[u],s=C(f[0],f[1],S,v);if(s>=0&&(f[0]=Math.min(f[0],S),f[1]=Math.max(f[1],v),b=!0,s/(v-S)>.5))return}if(b||w.push([S,v]),this.config.renderTextTracksNatively){var a=this.captionsTracks[d];this.Cues.newCue(a,S,v,p)}else{var T=this.Cues.newCue(null,S,v,p);this.hls.trigger(F.Events.CUES_PARSED,{type:"captions",cues:T,track:d})}},o.onInitPtsFound=function(d,S){var v=this,p=S.frag,w=S.id,b=S.initPTS,u=S.timescale,f=this.unparsedVttFrags;w==="main"&&(this.initPTS[p.cc]=b,this.timescale[p.cc]=u),f.length&&(this.unparsedVttFrags=[],f.forEach(function(s){v.onFragLoaded(F.Events.FRAG_LOADED,s)}))},o.getExistingTrack=function(d){var S=this.media;if(S)for(var v=0;v<S.textTracks.length;v++){var p=S.textTracks[v];if(p[d])return p}return null},o.createCaptionsTrack=function(d){this.config.renderTextTracksNatively?this.createNativeTrack(d):this.createNonNativeTrack(d)},o.createNativeTrack=function(d){if(this.captionsTracks[d])return;var S=this.captionsProperties,v=this.captionsTracks,p=this.media,w=S[d],b=w.label,u=w.languageCode,f=this.getExistingTrack(d);if(f)v[d]=f,Object(P.clearCurrentCues)(v[d]),Object(P.sendAddTrackEvent)(v[d],p);else{var s=this.createTextTrack("captions",b,u);s&&(s[d]=!0,v[d]=s)}},o.createNonNativeTrack=function(d){if(this.nonNativeCaptionsTracks[d])return;var S=this.captionsProperties[d];if(!S)return;var v=S.label,p={_id:d,label:v,kind:"captions",default:S.media?!!S.media.default:!1,closedCaptions:S.media};this.nonNativeCaptionsTracks[d]=p,this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[p]})},o.createTextTrack=function(d,S,v){var p=this.media;return p?p.addTextTrack(d,S,v):void 0},o.onMediaAttaching=function(d,S){this.media=S.media,this._cleanTracks()},o.onMediaDetaching=function(){var d=this.captionsTracks;Object.keys(d).forEach(function(S){Object(P.clearCurrentCues)(d[S]),delete d[S]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=E(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var d=this.media;if(!d)return;var S=d.textTracks;if(S)for(var v=0;v<S.length;v++)Object(P.clearCurrentCues)(S[v])},o.onSubtitleTracksUpdated=function(d,S){var v=this;this.textTracks=[];var p=S.subtitleTracks||[],w=p.some(function(s){return s.textCodec===R.IMSC1_CODEC});if(this.config.enableWebVTT||w&&this.config.enableIMSC1){var b=this.tracks&&p&&this.tracks.length===p.length;if(this.tracks=p||[],this.config.renderTextTracksNatively){var u=this.media?this.media.textTracks:[];this.tracks.forEach(function(s,a){var T;if(a<u.length){for(var m=null,x=0;x<u.length;x++)if(k(u[x],s)){m=u[x];break}m&&(T=m)}T?Object(P.clearCurrentCues)(T):(T=v.createTextTrack("subtitles",s.name,s.lang),T&&(T.mode="disabled")),T&&(T.groupId=s.groupId,v.textTracks.push(T))})}else if(!b&&this.tracks&&this.tracks.length){var f=this.tracks.map(function(s){return{label:s.name,kind:s.type.toLowerCase(),default:s.default,subtitleTrack:s}});this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:f})}}},o.onManifestLoaded=function(d,S){var v=this;this.config.enableCEA708Captions&&S.captions&&S.captions.forEach(function(p){var w=/(?:CC|SERVICE)([1-4])/.exec(p.instreamId);if(!w)return;var b="textTrack"+w[1],u=v.captionsProperties[b];if(!u)return;u.label=p.name,p.lang&&(u.languageCode=p.lang),u.media=p})},o.onFragLoading=function(d,S){var v=this.cea608Parser1,p=this.cea608Parser2,w=this.lastSn,b=this.lastPartIndex;if(!this.enabled||!(v&&p))return;if(S.frag.type===y.PlaylistLevelType.MAIN){var u,f,s=S.frag.sn,a=(u=S==null||((f=S.part)===null||f===void 0)?void 0:f.index)!=null?u:-1;s===w+1||s===w&&a===b+1||(v.reset(),p.reset()),this.lastSn=s,this.lastPartIndex=a}},o.onFragLoaded=function(d,S){var v=S.frag,p=S.payload,w=this.initPTS,b=this.unparsedVttFrags;if(v.type===y.PlaylistLevelType.SUBTITLE)if(p.byteLength){if(!Object(Z.isFiniteNumber)(w[v.cc])){b.push(S),w.length&&this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Missing initial subtitle PTS")});return}var u=v.decryptdata;if(u==null||u.key==null||u.method!=="AES-128"){var f=this.tracks[v.level],s=this.vttCCs;s[v.cc]||(s[v.cc]={start:v.start,prevCC:this.prevCC,new:!0},this.prevCC=v.cc),f&&f.textCodec===R.IMSC1_CODEC?this._parseIMSC1(v,p):this._parseVTTs(v,p,s)}}else this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(d,S){var v=this,p=this.hls;Object(R.parseIMSC1)(S,this.initPTS[d.cc],this.timescale[d.cc],function(w){v._appendCues(w,d.level),p.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(w){A.logger.log("Failed to parse IMSC1: "+w),p.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:w})})},o._parseVTTs=function(d,S,v){var p=this,w=this.hls;Object(B.parseWebVTT)(S,this.initPTS[d.cc],this.timescale[d.cc],v,d.cc,d.start,function(b){p._appendCues(b,d.level),w.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(b){p._fallbackToIMSC1(d,S),A.logger.log("Failed to parse VTT cue: "+b),w.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:b})})},o._fallbackToIMSC1=function(d,S){var v=this,p=this.tracks[d.level];p.textCodec||Object(R.parseIMSC1)(S,this.initPTS[d.cc],this.timescale[d.cc],function(){p.textCodec=R.IMSC1_CODEC,v._parseIMSC1(d,S)},function(){p.textCodec="wvtt"})},o._appendCues=function(d,S){var v=this.hls;if(this.config.renderTextTracksNatively){var p=this.textTracks[S];if(p.mode==="disabled")return;d.forEach(function(u){return Object(P.addCueToTrack)(p,u)})}else{var w=this.tracks[S],b=w.default?"default":"subtitles"+S;v.trigger(F.Events.CUES_PARSED,{type:"subtitles",cues:d,track:b})}},o.onFragDecrypted=function(d,S){var v=S.frag;if(v.type===y.PlaylistLevelType.SUBTITLE){if(!Object(Z.isFiniteNumber)(this.initPTS[v.cc])){this.unparsedVttFrags.push(S);return}this.onFragLoaded(F.Events.FRAG_LOADED,S)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(d,S){var v=this.cea608Parser1,p=this.cea608Parser2;if(!this.enabled||!(v&&p))return;for(var w=0;w<S.samples.length;w++){var b=S.samples[w].bytes;if(b){var u=this.extractCea608Data(b);v.addData(S.samples[w].pts,u[0]),p.addData(S.samples[w].pts,u[1])}}},o.onBufferFlushing=function(d,S){var v=S.startOffset,p=S.endOffset,w=S.endOffsetSubtitles,b=S.type,u=this.media;if(!u||u.currentTime<p)return;if(!b||b==="video"){var f=this.captionsTracks;Object.keys(f).forEach(function(a){return Object(P.removeCuesInRange)(f[a],v,p)})}if(this.config.renderTextTracksNatively&&(v===0&&w!==void 0)){var s=this.textTracks;Object.keys(s).forEach(function(a){return Object(P.removeCuesInRange)(s[a],v,w)})}},o.extractCea608Data=function(d){for(var S=d[0]&31,v=2,p=[[],[]],w=0;w<S;w++){var b=d[v++],u=127&d[v++],f=127&d[v++],s=(4&b)!==0,a=3&b;if(u===0&&f===0)continue;s&&((a===0||a===1)&&(p[a].push(u),p[a].push(f)))}return p},h}();function k(h,o){return h&&h.label===o.name&&!(h.textTrack1||h.textTrack2)}function C(h,o,l,d){return Math.min(o,d)-Math.max(h,l)}function E(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(he,$,O){"use strict";O.r($),O.d($,"default",function(){return Z});var Z=function(){function F(K,B){this.subtle=void 0,this.aesIV=void 0,this.subtle=K,this.aesIV=B}var I=F.prototype;return I.decrypt=function(B,P){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},P,B)},F}()},"./src/crypt/aes-decryptor.ts":function(he,$,O){"use strict";O.r($),O.d($,"removePadding",function(){return F}),O.d($,"default",function(){return I});var Z=O("./src/utils/typed-array.ts");function F(K){var B=K.byteLength,P=B&&new DataView(K.buffer).getUint8(B-1);return P?Object(Z.sliceUint8)(K,0,B-P):K}var I=function(){function K(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var B=K.prototype;return B.uint8ArrayToUint32Array_=function(R){for(var y=new DataView(R),A=new Uint32Array(4),_=0;_<4;_++)A[_]=y.getUint32(_*4);return A},B.initTable=function(){var R=this.sBox,y=this.invSBox,A=this.subMix,_=A[0],k=A[1],C=A[2],E=A[3],h=this.invSubMix,o=h[0],l=h[1],d=h[2],S=h[3],v=new Uint32Array(256),p=0,w=0,b=0;for(b=0;b<256;b++)b<128?v[b]=b<<1:v[b]=b<<1^283;for(b=0;b<256;b++){var u=w^w<<1^w<<2^w<<3^w<<4;u=u>>>8^u&255^99,R[p]=u,y[u]=p;var f=v[p],s=v[f],a=v[s],T=v[u]*257^u*16843008;_[p]=T<<24|T>>>8,k[p]=T<<16|T>>>16,C[p]=T<<8|T>>>24,E[p]=T,T=a*16843009^s*65537^f*257^p*16843008,o[u]=T<<24|T>>>8,l[u]=T<<16|T>>>16,d[u]=T<<8|T>>>24,S[u]=T,p?(p=f^v[v[v[a^f]]],w^=v[v[w]]):p=w=1}},B.expandKey=function(R){for(var y=this.uint8ArrayToUint32Array_(R),A=!0,_=0;_<y.length&&A;)A=y[_]===this.key[_],_++;if(A)return;this.key=y;var k=this.keySize=y.length;if(k!==4&&k!==6&&k!==8)throw new Error("Invalid aes key size="+k);var C=this.ksRows=(k+6+1)*4,E,h,o=this.keySchedule=new Uint32Array(C),l=this.invKeySchedule=new Uint32Array(C),d=this.sBox,S=this.rcon,v=this.invSubMix,p=v[0],w=v[1],b=v[2],u=v[3],f,s;for(E=0;E<C;E++){if(E<k){f=o[E]=y[E];continue}s=f,E%k===0?(s=s<<8|s>>>24,s=d[s>>>24]<<24|d[s>>>16&255]<<16|d[s>>>8&255]<<8|d[s&255],s^=S[E/k|0]<<24):k>6&&E%k===4&&(s=d[s>>>24]<<24|d[s>>>16&255]<<16|d[s>>>8&255]<<8|d[s&255]),o[E]=f=(o[E-k]^s)>>>0}for(h=0;h<C;h++)E=C-h,h&3?s=o[E]:s=o[E-4],h<4||E<=4?l[h]=s:l[h]=p[d[s>>>24]]^w[d[s>>>16&255]]^b[d[s>>>8&255]]^u[d[s&255]],l[h]=l[h]>>>0},B.networkToHostOrderSwap=function(R){return R<<24|(R&65280)<<8|(R&16711680)>>8|R>>>24},B.decrypt=function(R,y,A){for(var _=this.keySize+6,k=this.invKeySchedule,C=this.invSBox,E=this.invSubMix,h=E[0],o=E[1],l=E[2],d=E[3],S=this.uint8ArrayToUint32Array_(A),v=S[0],p=S[1],w=S[2],b=S[3],u=new Int32Array(R),f=new Int32Array(u.length),s,a,T,m,x,D,j,z,V,M,N,Y,oe,pe,ve=this.networkToHostOrderSwap;y<u.length;){for(V=ve(u[y]),M=ve(u[y+1]),N=ve(u[y+2]),Y=ve(u[y+3]),x=V^k[0],D=Y^k[1],j=N^k[2],z=M^k[3],oe=4,pe=1;pe<_;pe++)s=h[x>>>24]^o[D>>16&255]^l[j>>8&255]^d[z&255]^k[oe],a=h[D>>>24]^o[j>>16&255]^l[z>>8&255]^d[x&255]^k[oe+1],T=h[j>>>24]^o[z>>16&255]^l[x>>8&255]^d[D&255]^k[oe+2],m=h[z>>>24]^o[x>>16&255]^l[D>>8&255]^d[j&255]^k[oe+3],x=s,D=a,j=T,z=m,oe=oe+4;s=C[x>>>24]<<24^C[D>>16&255]<<16^C[j>>8&255]<<8^C[z&255]^k[oe],a=C[D>>>24]<<24^C[j>>16&255]<<16^C[z>>8&255]<<8^C[x&255]^k[oe+1],T=C[j>>>24]<<24^C[z>>16&255]<<16^C[x>>8&255]<<8^C[D&255]^k[oe+2],m=C[z>>>24]<<24^C[x>>16&255]<<16^C[D>>8&255]<<8^C[j&255]^k[oe+3],f[y]=ve(s^v),f[y+1]=ve(m^p),f[y+2]=ve(T^w),f[y+3]=ve(a^b),v=V,p=M,w=N,b=Y,y=y+4}return f.buffer},K}()},"./src/crypt/decrypter.ts":function(he,$,O){"use strict";O.r($),O.d($,"default",function(){return y});var Z=O("./src/crypt/aes-crypto.ts"),F=O("./src/crypt/fast-aes-key.ts"),I=O("./src/crypt/aes-decryptor.ts"),K=O("./src/utils/logger.ts"),B=O("./src/utils/mp4-tools.ts"),P=O("./src/utils/typed-array.ts"),R=16,y=function(){function A(k,C,E){var h=E===void 0?{}:E,o=h.removePKCS7Padding,l=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=k,this.config=C,this.removePKCS7Padding=l,l)try{var d=self.crypto;d&&(this.subtle=d.subtle||d.webkitSubtle)}catch(S){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var _=A.prototype;return _.destroy=function(){this.observer=null},_.isSync=function(){return this.config.enableSoftwareAES},_.flush=function(){var C=this.currentResult;if(!C){this.reset();return}var E=new Uint8Array(C);return this.reset(),this.removePKCS7Padding?Object(I.removePadding)(E):E},_.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},_.decrypt=function(C,E,h,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(C),E,h);var l=this.flush();l&&o(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(C),E,h).then(o)},_.softwareDecrypt=function(C,E,h){var o=this.currentIV,l=this.currentResult,d=this.remainderData;this.logOnce("JS AES decrypt"),d&&(C=Object(B.appendUint8Array)(d,C),this.remainderData=null);var S=this.getValidChunk(C);if(!S.length)return null;o&&(h=o);var v=this.softwareDecrypter;v||(v=this.softwareDecrypter=new I.default),v.expandKey(E);var p=l;return this.currentResult=v.decrypt(S.buffer,0,h),this.currentIV=Object(P.sliceUint8)(S,-16).buffer,p||null},_.webCryptoDecrypt=function(C,E,h){var o=this,l=this.subtle;return(this.key!==E||!this.fastAesKey)&&(this.key=E,this.fastAesKey=new F.default(l,E)),this.fastAesKey.expandKey().then(function(d){if(!l)return Promise.reject(new Error("web crypto not initialized"));var S=new Z.default(l,h);return S.decrypt(C.buffer,d)}).catch(function(d){return o.onWebCryptoError(d,C,E,h)})},_.onWebCryptoError=function(C,E,h,o){return K.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",C),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(E,h,o)},_.getValidChunk=function(C){var E=C,h=C.length-C.length%R;return h!==C.length&&(E=Object(P.sliceUint8)(C,0,h),this.remainderData=Object(P.sliceUint8)(C,h)),E},_.logOnce=function(C){if(!this.logEnabled)return;K.logger.log("[decrypter.ts]: "+C),this.logEnabled=!1},A}()},"./src/crypt/fast-aes-key.ts":function(he,$,O){"use strict";O.r($),O.d($,"default",function(){return Z});var Z=function(){function F(K,B){this.subtle=void 0,this.key=void 0,this.subtle=K,this.key=B}var I=F.prototype;return I.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},F}()},"./src/demux/aacdemuxer.ts":function(he,$,O){"use strict";O.r($);var Z=O("./src/demux/base-audio-demuxer.ts"),F=O("./src/demux/adts.ts"),I=O("./src/utils/logger.ts"),K=O("./src/demux/id3.ts");function B(y,A){y.prototype=Object.create(A.prototype),y.prototype.constructor=y,P(y,A)}function P(y,A){return P=Object.setPrototypeOf||function(k,C){return k.__proto__=C,k},P(y,A)}var R=function(y){B(A,y);function A(k,C){var E;return E=y.call(this)||this,E.observer=void 0,E.config=void 0,E.observer=k,E.config=C,E}var _=A.prototype;return _.resetInitSegment=function(C,E,h){y.prototype.resetInitSegment.call(this,C,E,h),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:C,duration:h,inputTimeScale:9e4,dropped:0}},A.probe=function(C){if(!C)return!1;for(var E=K.getID3Data(C,0)||[],h=E.length,o=C.length;h<o;h++)if(F.probe(C,h))return I.logger.log("ADTS sync word found !"),!0;return!1},_.canParse=function(C,E){return F.canParse(C,E)},_.appendFrame=function(C,E,h){F.initTrackConfig(C,this.observer,E,h,C.manifestCodec);var o=F.appendFrame(C,E,h,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},A}(Z.default);R.minProbeByteLength=9,$.default=R},"./src/demux/adts.ts":function(he,$,O){"use strict";O.r($),O.d($,"getAudioConfig",function(){return K}),O.d($,"isHeaderPattern",function(){return B}),O.d($,"getHeaderLength",function(){return P}),O.d($,"getFullFrameLength",function(){return R}),O.d($,"canGetFrameLength",function(){return y}),O.d($,"isHeader",function(){return A}),O.d($,"canParse",function(){return _}),O.d($,"probe",function(){return k}),O.d($,"initTrackConfig",function(){return C}),O.d($,"getFrameDuration",function(){return E}),O.d($,"parseFrameHeader",function(){return h}),O.d($,"appendFrame",function(){return o});var Z=O("./src/utils/logger.ts"),F=O("./src/errors.ts"),I=O("./src/events.ts");function K(l,d,S,v){var p,w,b,u,f=navigator.userAgent.toLowerCase(),s=v,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];p=((d[S+2]&192)>>>6)+1;var T=(d[S+2]&60)>>>2;if(T>a.length-1){l.trigger(I.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+T});return}return b=(d[S+2]&1)<<2,b|=(d[S+3]&192)>>>6,Z.logger.log("manifest codec:"+v+", ADTS type:"+p+", samplingIndex:"+T),/firefox/i.test(f)?T>=6?(p=5,u=new Array(4),w=T-3):(p=2,u=new Array(2),w=T):f.indexOf("android")!==-1?(p=2,u=new Array(2),w=T):(p=5,u=new Array(4),v&&(v.indexOf("mp4a.40.29")!==-1||v.indexOf("mp4a.40.5")!==-1)||!v&&T>=6?w=T-3:((v&&v.indexOf("mp4a.40.2")!==-1&&(T>=6&&b===1||/vivaldi/i.test(f))||!v&&b===1)&&(p=2,u=new Array(2)),w=T)),u[0]=p<<3,u[0]|=(T&14)>>1,u[1]|=(T&1)<<7,u[1]|=b<<3,p===5&&(u[1]|=(w&14)>>1,u[2]=(w&1)<<7,u[2]|=2<<2,u[3]=0),{config:u,samplerate:a[T],channelCount:b,codec:"mp4a.40."+p,manifestCodec:s}}function B(l,d){return l[d]===255&&(l[d+1]&246)===240}function P(l,d){return l[d+1]&1?7:9}function R(l,d){return(l[d+3]&3)<<11|l[d+4]<<3|(l[d+5]&224)>>>5}function y(l,d){return d+5<l.length}function A(l,d){return d+1<l.length&&B(l,d)}function _(l,d){return y(l,d)&&B(l,d)&&R(l,d)<=l.length-d}function k(l,d){if(A(l,d)){var S=P(l,d);if(d+S>=l.length)return!1;var v=R(l,d);if(v<=S)return!1;var p=d+v;return p===l.length||A(l,p)}return!1}function C(l,d,S,v,p){if(!l.samplerate){var w=K(d,S,v,p);if(!w)return;l.config=w.config,l.samplerate=w.samplerate,l.channelCount=w.channelCount,l.codec=w.codec,l.manifestCodec=w.manifestCodec,Z.logger.log("parsed codec:"+l.codec+", rate:"+w.samplerate+", channels:"+w.channelCount)}}function E(l){return 1024*9e4/l}function h(l,d,S,v,p){var w=P(l,d),b=R(l,d);if(b-=w,b>0){var u=S+v*p;return{headerLength:w,frameLength:b,stamp:u}}}function o(l,d,S,v,p){var w=E(l.samplerate),b=h(d,S,v,p,w);if(b){var u=b.frameLength,f=b.headerLength,s=b.stamp,a=f+u,T=Math.max(0,S+a-d.length),m;T?(m=new Uint8Array(a-f),m.set(d.subarray(S+f,d.length),0)):m=d.subarray(S+f,S+a);var x={unit:m,pts:s};return T||l.samples.push(x),{sample:x,length:a,missing:T}}}},"./src/demux/base-audio-demuxer.ts":function(he,$,O){"use strict";O.r($),O.d($,"initPTSFn",function(){return R});var Z=O("./src/polyfills/number.ts"),F=O("./src/demux/id3.ts"),I=O("./src/demux/dummy-demuxed-track.ts"),K=O("./src/utils/mp4-tools.ts"),B=O("./src/utils/typed-array.ts"),P=function(){function y(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var A=y.prototype;return A.resetInitSegment=function(k,C,E){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},A.resetTimeStamp=function(){},A.resetContiguity=function(){},A.canParse=function(k,C){return!1},A.appendFrame=function(k,C,E){},A.demux=function(k,C){this.cachedData&&(k=Object(K.appendUint8Array)(this.cachedData,k),this.cachedData=null);var E=F.getID3Data(k,0),h=E?E.length:0,o,l,d=this._audioTrack,S=this._id3Track,v=E?F.getTimeStamp(E):void 0,p=k.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=R(v,C)),E&&E.length>0&&S.samples.push({pts:this.initPTS,dts:this.initPTS,data:E}),l=this.initPTS;h<p;){if(this.canParse(k,h)){var w=this.appendFrame(d,k,h);w?(this.frameIndex++,l=w.sample.pts,h+=w.length,o=h):h=p}else F.canParse(k,h)?(E=F.getID3Data(k,h),S.samples.push({pts:l,dts:l,data:E}),h+=E.length,o=h):h++;if(h===p&&o!==p){var b=Object(B.sliceUint8)(k,o);this.cachedData?this.cachedData=Object(K.appendUint8Array)(this.cachedData,b):this.cachedData=b}}return{audioTrack:d,avcTrack:Object(I.dummyTrack)(),id3Track:S,textTrack:Object(I.dummyTrack)()}},A.demuxSampleAes=function(k,C,E){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},A.flush=function(k){var C=this.cachedData;return C&&(this.cachedData=null,this.demux(C,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(I.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(I.dummyTrack)()}},A.destroy=function(){},y}(),R=function(A,_){return Object(Z.isFiniteNumber)(A)?A*90:_*9e4};$.default=P},"./src/demux/chunk-cache.ts":function(he,$,O){"use strict";O.r($),O.d($,"default",function(){return Z});var Z=function(){function I(){this.chunks=[],this.dataLength=0}var K=I.prototype;return K.push=function(P){this.chunks.push(P),this.dataLength+=P.length},K.flush=function(){var P=this.chunks,R=this.dataLength,y;if(P.length)P.length===1?y=P[0]:y=F(P,R);else return new Uint8Array(0);return this.reset(),y},K.reset=function(){this.chunks.length=0,this.dataLength=0},I}();function F(I,K){for(var B=new Uint8Array(K),P=0,R=0;R<I.length;R++){var y=I[R];B.set(y,P),P+=y.length}return B}},"./src/demux/dummy-demuxed-track.ts":function(he,$,O){"use strict";O.r($),O.d($,"dummyTrack",function(){return Z});function Z(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(he,$,O){"use strict";O.r($);var Z=O("./src/utils/logger.ts"),F=function(){function I(B){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=B,this.bytesAvailable=B.byteLength,this.word=0,this.bitsAvailable=0}var K=I.prototype;return K.loadWord=function(){var P=this.data,R=this.bytesAvailable,y=P.byteLength-R,A=new Uint8Array(4),_=Math.min(4,R);if(_===0)throw new Error("no bytes available");A.set(P.subarray(y,y+_)),this.word=new DataView(A.buffer).getUint32(0),this.bitsAvailable=_*8,this.bytesAvailable-=_},K.skipBits=function(P){var R;this.bitsAvailable>P?(this.word<<=P,this.bitsAvailable-=P):(P-=this.bitsAvailable,R=P>>3,P-=R>>3,this.bytesAvailable-=R,this.loadWord(),this.word<<=P,this.bitsAvailable-=P)},K.readBits=function(P){var R=Math.min(this.bitsAvailable,P),y=this.word>>>32-R;return P>32&&Z.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=R,this.bitsAvailable>0?this.word<<=R:this.bytesAvailable>0&&this.loadWord(),R=P-R,R>0&&this.bitsAvailable?y<<R|this.readBits(R):y},K.skipLZ=function(){var P;for(P=0;P<this.bitsAvailable;++P)if((this.word&2147483648>>>P)!==0)return this.word<<=P,this.bitsAvailable-=P,P;return this.loadWord(),P+this.skipLZ()},K.skipUEG=function(){this.skipBits(1+this.skipLZ())},K.skipEG=function(){this.skipBits(1+this.skipLZ())},K.readUEG=function(){var P=this.skipLZ();return this.readBits(P+1)-1},K.readEG=function(){var P=this.readUEG();return 1&P?1+P>>>1:-1*(P>>>1)},K.readBoolean=function(){return this.readBits(1)===1},K.readUByte=function(){return this.readBits(8)},K.readUShort=function(){return this.readBits(16)},K.readUInt=function(){return this.readBits(32)},K.skipScalingList=function(P){for(var R=8,y=8,A,_=0;_<P;_++)y!==0&&(A=this.readEG(),y=(R+A+256)%256),R=y===0?R:y},K.readSPS=function(){var P=0,R=0,y=0,A=0,_,k,C,E=this.readUByte.bind(this),h=this.readBits.bind(this),o=this.readUEG.bind(this),l=this.readBoolean.bind(this),d=this.skipBits.bind(this),S=this.skipEG.bind(this),v=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);E();var w=E();if(h(5),d(3),E(),v(),w===100||w===110||w===122||w===244||w===44||w===83||w===86||w===118||w===128){var b=o();if(b===3&&d(1),v(),v(),d(1),l())for(k=b!==3?8:12,C=0;C<k;C++)l()&&(C<6?p(16):p(64))}v();var u=o();if(u===0)o();else if(u===1)for(d(1),S(),S(),_=o(),C=0;C<_;C++)S();v(),d(1);var f=o(),s=o(),a=h(1);a===0&&d(1),d(1),l()&&(P=o(),R=o(),y=o(),A=o());var T=[1,1];if(l()&&l()){var m=E();switch(m){case 1:T=[1,1];break;case 2:T=[12,11];break;case 3:T=[10,11];break;case 4:T=[16,11];break;case 5:T=[40,33];break;case 6:T=[24,11];break;case 7:T=[20,11];break;case 8:T=[32,11];break;case 9:T=[80,33];break;case 10:T=[18,11];break;case 11:T=[15,11];break;case 12:T=[64,33];break;case 13:T=[160,99];break;case 14:T=[4,3];break;case 15:T=[3,2];break;case 16:T=[2,1];break;case 255:{T=[E()<<8|E(),E()<<8|E()];break}}}return{width:Math.ceil((f+1)*16-P*2-R*2),height:(2-a)*(s+1)*16-(a?2:4)*(y+A),pixelRatio:T}},K.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},I}();$.default=F},"./src/demux/id3.ts":function(he,$,O){"use strict";O.r($),O.d($,"isHeader",function(){return Z}),O.d($,"isFooter",function(){return F}),O.d($,"getID3Data",function(){return I}),O.d($,"canParse",function(){return B}),O.d($,"getTimeStamp",function(){return P}),O.d($,"isTimeStampFrame",function(){return R}),O.d($,"getID3Frames",function(){return A}),O.d($,"decodeFrame",function(){return _}),O.d($,"utf8ArrayToStr",function(){return o}),O.d($,"testables",function(){return l});var Z=function(p,w){return w+10<=p.length&&(p[w]===73&&p[w+1]===68&&p[w+2]===51&&(p[w+3]<255&&p[w+4]<255&&(p[w+6]<128&&p[w+7]<128&&p[w+8]<128&&p[w+9]<128)))},F=function(p,w){return w+10<=p.length&&(p[w]===51&&p[w+1]===68&&p[w+2]===73&&(p[w+3]<255&&p[w+4]<255&&(p[w+6]<128&&p[w+7]<128&&p[w+8]<128&&p[w+9]<128)))},I=function(p,w){for(var b=w,u=0;Z(p,w);){u+=10;var f=K(p,w+6);u+=f,F(p,w+10)&&(u+=10),w+=u}return u>0?p.subarray(b,b+u):void 0},K=function(p,w){var b=0;return b=(p[w]&127)<<21,b|=(p[w+1]&127)<<14,b|=(p[w+2]&127)<<7,b|=p[w+3]&127,b},B=function(p,w){return Z(p,w)&&K(p,w+6)+10<=p.length-w},P=function(p){for(var w=A(p),b=0;b<w.length;b++){var u=w[b];if(R(u))return h(u)}return},R=function(p){return p&&p.key==="PRIV"&&p.info==="com.apple.streaming.transportStreamTimestamp"},y=function(p){var w=String.fromCharCode(p[0],p[1],p[2],p[3]),b=K(p,4),u=10;return{type:w,size:b,data:p.subarray(u,u+b)}},A=function(p){for(var w=0,b=[];Z(p,w);){var u=K(p,w+6);w+=10;for(var f=w+u;w+8<f;){var s=y(p.subarray(w)),a=_(s);a&&b.push(a),w+=s.size+10}F(p,w)&&(w+=10)}return b},_=function(p){return p.type==="PRIV"?k(p):p.type[0]==="W"?E(p):C(p)},k=function(p){if(p.size<2)return;var w=o(p.data,!0),b=new Uint8Array(p.data.subarray(w.length+1));return{key:p.type,info:w,data:b.buffer}},C=function(p){if(p.size<2)return;if(p.type==="TXXX"){var w=1,b=o(p.data.subarray(w),!0);w+=b.length+1;var u=o(p.data.subarray(w));return{key:p.type,info:b,data:u}}var f=o(p.data.subarray(1));return{key:p.type,data:f}},E=function(p){if(p.type==="WXXX"){if(p.size<2)return;var w=1,b=o(p.data.subarray(w),!0);w+=b.length+1;var u=o(p.data.subarray(w));return{key:p.type,info:b,data:u}}var f=o(p.data);return{key:p.type,data:f}},h=function(p){if(p.data.byteLength===8){var w=new Uint8Array(p.data),b=w[3]&1,u=(w[4]<<23)+(w[5]<<15)+(w[6]<<7)+w[7];return u/=45,b&&(u+=4772185884e-2),Math.round(u)}return},o=function(p,w){w===void 0&&(w=!1);var b=S();if(b){var u=b.decode(p);if(w){var f=u.indexOf("\0");return f!==-1?u.substring(0,f):u}return u.replace(/\0/g,"")}for(var s=p.length,a,T,m,x="",D=0;D<s;){if(a=p[D++],a===0&&w)return x;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:x+=String.fromCharCode(a);break;case 12:case 13:T=p[D++],x+=String.fromCharCode((a&31)<<6|T&63);break;case 14:T=p[D++],m=p[D++],x+=String.fromCharCode((a&15)<<12|(T&63)<<6|(m&63)<<0);break;default:}}return x},l={decodeTextFrame:C},d;function S(){return!d&&typeof self.TextDecoder!="undefined"&&(d=new self.TextDecoder("utf-8")),d}},"./src/demux/mp3demuxer.ts":function(he,$,O){"use strict";O.r($);var Z=O("./src/demux/base-audio-demuxer.ts"),F=O("./src/demux/id3.ts"),I=O("./src/utils/logger.ts"),K=O("./src/demux/mpegaudio.ts");function B(y,A){y.prototype=Object.create(A.prototype),y.prototype.constructor=y,P(y,A)}function P(y,A){return P=Object.setPrototypeOf||function(k,C){return k.__proto__=C,k},P(y,A)}var R=function(y){B(A,y);function A(){return y.apply(this,arguments)||this}var _=A.prototype;return _.resetInitSegment=function(C,E,h){y.prototype.resetInitSegment.call(this,C,E,h),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:C,duration:h,inputTimeScale:9e4,dropped:0}},A.probe=function(C){if(!C)return!1;for(var E=F.getID3Data(C,0)||[],h=E.length,o=C.length;h<o;h++)if(K.probe(C,h))return I.logger.log("MPEG Audio sync word found !"),!0;return!1},_.canParse=function(C,E){return K.canParse(C,E)},_.appendFrame=function(C,E,h){return this.initPTS===null?void 0:K.appendFrame(C,E,h,this.initPTS,this.frameIndex)},A}(Z.default);R.minProbeByteLength=4,$.default=R},"./src/demux/mp4demuxer.ts":function(he,$,O){"use strict";O.r($);var Z=O("./src/utils/mp4-tools.ts"),F=O("./src/demux/dummy-demuxed-track.ts"),I=function(){function K(P,R){this.remainderData=null,this.config=void 0,this.config=R}var B=K.prototype;return B.resetTimeStamp=function(){},B.resetInitSegment=function(){},B.resetContiguity=function(){},K.probe=function(R){return Object(Z.findBox)({data:R,start:0,end:Math.min(R.length,16384)},["moof"]).length>0},B.demux=function(R){var y=R,A=Object(F.dummyTrack)();if(this.config.progressive){this.remainderData&&(y=Object(Z.appendUint8Array)(this.remainderData,R));var _=Object(Z.segmentValidRange)(y);this.remainderData=_.remainder,A.samples=_.valid||new Uint8Array}else A.samples=y;return{audioTrack:Object(F.dummyTrack)(),avcTrack:A,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},B.flush=function(){var R=Object(F.dummyTrack)();return R.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(F.dummyTrack)(),avcTrack:R,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},B.demuxSampleAes=function(R,y,A){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},B.destroy=function(){},K}();I.minProbeByteLength=1024,$.default=I},"./src/demux/mpegaudio.ts":function(he,$,O){"use strict";O.r($),O.d($,"appendFrame",function(){return P}),O.d($,"parseHeader",function(){return R}),O.d($,"isHeaderPattern",function(){return y}),O.d($,"isHeader",function(){return A}),O.d($,"canParse",function(){return _}),O.d($,"probe",function(){return k});var Z=null,F=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],I=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],K=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],B=[0,1,1,4];function P(C,E,h,o,l){if(h+24>E.length)return;var d=R(E,h);if(d&&h+d.frameLength<=E.length){var S=d.samplesPerFrame*9e4/d.sampleRate,v=o+l*S,p={unit:E.subarray(h,h+d.frameLength),pts:v,dts:v};return C.config=[],C.channelCount=d.channelCount,C.samplerate=d.sampleRate,C.samples.push(p),{sample:p,length:d.frameLength,missing:0}}}function R(C,E){var h=C[E+1]>>3&3,o=C[E+1]>>1&3,l=C[E+2]>>4&15,d=C[E+2]>>2&3;if(h!==1&&l!==0&&l!==15&&d!==3){var S=C[E+2]>>1&1,v=C[E+3]>>6,p=h===3?3-o:o===3?3:4,w=F[p*14+l-1]*1e3,b=h===3?0:h===2?1:2,u=I[b*3+d],f=v===3?1:2,s=K[h][o],a=B[o],T=s*8*a,m=Math.floor(s*w/u+S)*a;if(Z===null){var x=navigator.userAgent||"",D=x.match(/Chrome\/(\d+)/i);Z=D?parseInt(D[1]):0}var j=!!Z&&Z<=87;return j&&o===2&&w>=224e3&&v===0&&(C[E+3]=C[E+3]|128),{sampleRate:u,channelCount:f,frameLength:m,samplesPerFrame:T}}}function y(C,E){return C[E]===255&&(C[E+1]&224)===224&&(C[E+1]&6)!==0}function A(C,E){return E+1<C.length&&y(C,E)}function _(C,E){var h=4;return y(C,E)&&h<=C.length-E}function k(C,E){if(E+1<C.length&&y(C,E)){var h=4,o=R(C,E),l=h;o!=null&&o.frameLength&&(l=o.frameLength);var d=E+l;return d===C.length||A(C,d)}return!1}},"./src/demux/sample-aes.ts":function(he,$,O){"use strict";O.r($);var Z=O("./src/crypt/decrypter.ts"),F=O("./src/demux/tsdemuxer.ts"),I=function(){function K(P,R,y){this.keyData=void 0,this.decrypter=void 0,this.keyData=y,this.decrypter=new Z.default(P,R,{removePKCS7Padding:!1})}var B=K.prototype;return B.decryptBuffer=function(R,y){this.decrypter.decrypt(R,this.keyData.key.buffer,this.keyData.iv.buffer,y)},B.decryptAacSample=function(R,y,A,_){var k=R[y].unit,C=k.subarray(16,k.length-k.length%16),E=C.buffer.slice(C.byteOffset,C.byteOffset+C.length),h=this;this.decryptBuffer(E,function(o){var l=new Uint8Array(o);k.set(l,16),_||h.decryptAacSamples(R,y+1,A)})},B.decryptAacSamples=function(R,y,A){for(;;y++){if(y>=R.length){A();return}if(R[y].unit.length<32)continue;var _=this.decrypter.isSync();if(this.decryptAacSample(R,y,A,_),!_)return}},B.getAvcEncryptedData=function(R){for(var y=Math.floor((R.length-48)/160)*16+16,A=new Int8Array(y),_=0,k=32;k<=R.length-16;k+=160,_+=16)A.set(R.subarray(k,k+16),_);return A},B.getAvcDecryptedUnit=function(R,y){for(var A=new Uint8Array(y),_=0,k=32;k<=R.length-16;k+=160,_+=16)R.set(A.subarray(_,_+16),k);return R},B.decryptAvcSample=function(R,y,A,_,k,C){var E=Object(F.discardEPB)(k.data),h=this.getAvcEncryptedData(E),o=this;this.decryptBuffer(h.buffer,function(l){k.data=o.getAvcDecryptedUnit(E,l),C||o.decryptAvcSamples(R,y,A+1,_)})},B.decryptAvcSamples=function(R,y,A,_){if(R instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;y++,A=0){if(y>=R.length){_();return}for(var k=R[y].units;!(A>=k.length);A++){var C=k[A];if(C.data.length<=48||C.type!==1&&C.type!==5)continue;var E=this.decrypter.isSync();if(this.decryptAvcSample(R,y,A,_,C,E),!E)return}}},K}();$.default=I},"./src/demux/transmuxer-interface.ts":function(he,$,O){"use strict";O.r($),O.d($,"default",function(){return k});var Z=O("./node_modules/webworkify-webpack/index.js"),F=O.n(Z),I=O("./src/events.ts"),K=O("./src/demux/transmuxer.ts"),B=O("./src/utils/logger.ts"),P=O("./src/errors.ts"),R=O("./src/utils/mediasource-helper.ts"),y=O("./node_modules/eventemitter3/index.js"),A=O.n(y),_=Object(R.getMediaSource)()||{isTypeSupported:function(){return!1}},k=function(){function C(h,o,l,d){var S=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=h,this.id=o,this.onTransmuxComplete=l,this.onFlush=d;var v=h.config,p=function(s,a){a=a||{},a.frag=S.frag,a.id=S.id,h.trigger(s,a)};this.observer=new y.EventEmitter,this.observer.on(I.Events.FRAG_DECRYPTED,p),this.observer.on(I.Events.ERROR,p);var w={mp4:_.isTypeSupported("video/mp4"),mpeg:_.isTypeSupported("audio/mpeg"),mp3:_.isTypeSupported('audio/mp4; codecs="mp3"')},b=navigator.vendor;if(v.enableWorker&&typeof Worker!="undefined"){B.logger.log("demuxing in webworker");var u;try{u=this.worker=Z("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),u.addEventListener("message",this.onwmsg),u.onerror=function(f){h.trigger(I.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(f.message+" ("+f.filename+":"+f.lineno+")")})},u.postMessage({cmd:"init",typeSupported:w,vendor:b,id:o,config:JSON.stringify(v)})}catch(f){B.logger.warn("Error in worker:",f),B.logger.error("Error while initializing DemuxerWorker, fallback to inline"),u&&self.URL.revokeObjectURL(u.objectURL),this.transmuxer=new K.default(this.observer,w,v,b,o),this.worker=null}}else this.transmuxer=new K.default(this.observer,w,v,b,o)}var E=C.prototype;return E.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var d=this.observer;d&&d.removeAllListeners(),this.observer=null},E.push=function(o,l,d,S,v,p,w,b,u,f){var s=this;u.transmuxing.start=self.performance.now();var a=this.transmuxer,T=this.worker,m=p?p.start:v.start,x=v.decryptdata,D=this.frag,j=!(D&&v.cc===D.cc),z=!(D&&u.level===D.level),V=D?u.sn-D.sn:-1,M=this.part?u.part-this.part.index:1,N=!z&&(V===1||V===0&&M===1),Y=self.performance.now();(z||V||v.stats.parsing.start===0)&&(v.stats.parsing.start=Y),p&&(M||!N)&&(p.stats.parsing.start=Y);var oe=new K.TransmuxState(j,N,b,z,m);if(!N||j){B.logger.log("[transmuxer-interface, "+v.type+"]: Starting new transmux session for sn: "+u.sn+" p: "+u.part+" level: "+u.level+" id: "+u.id+`
|
|
discontinuity: `+j+`
|
|
trackSwitch: `+z+`
|
|
contiguous: `+N+`
|
|
accurateTimeOffset: `+b+`
|
|
timeOffset: `+m);var pe=new K.TransmuxConfig(d,S,l,w,f);this.configureTransmuxer(pe)}if(this.frag=v,this.part=p,T)T.postMessage({cmd:"demux",data:o,decryptdata:x,chunkMeta:u,state:oe},o instanceof ArrayBuffer?[o]:[]);else if(a){var ve=a.push(o,x,u,oe);Object(K.isPromise)(ve)?ve.then(function(Le){s.handleTransmuxComplete(Le)}):this.handleTransmuxComplete(ve)}},E.flush=function(o){var l=this;o.transmuxing.start=self.performance.now();var d=this.transmuxer,S=this.worker;if(S)S.postMessage({cmd:"flush",chunkMeta:o});else if(d){var v=d.flush(o);Object(K.isPromise)(v)?v.then(function(p){l.handleFlushResult(p,o)}):this.handleFlushResult(v,o)}},E.handleFlushResult=function(o,l){var d=this;o.forEach(function(S){d.handleTransmuxComplete(S)}),this.onFlush(l)},E.onWorkerMessage=function(o){var l=o.data,d=this.hls;switch(l.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.id=this.id,d.trigger(l.event,l.data);break}}},E.configureTransmuxer=function(o){var l=this.worker,d=this.transmuxer;l?l.postMessage({cmd:"configure",config:o}):d&&d.configure(o)},E.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},C}()},"./src/demux/transmuxer-worker.ts":function(he,$,O){"use strict";O.r($),O.d($,"default",function(){return P});var Z=O("./src/demux/transmuxer.ts"),F=O("./src/events.ts"),I=O("./src/utils/logger.ts"),K=O("./node_modules/eventemitter3/index.js"),B=O.n(K);function P(k){var C=new K.EventEmitter,E=function(o,l){k.postMessage({event:o,data:l})};C.on(F.Events.FRAG_DECRYPTED,E),C.on(F.Events.ERROR,E),k.addEventListener("message",function(h){var o=h.data;switch(o.cmd){case"init":{var l=JSON.parse(o.config);k.transmuxer=new Z.default(C,o.typeSupported,l,o.vendor,o.id),Object(I.enableLogs)(l.debug),E("init",null);break}case"configure":{k.transmuxer.configure(o.config);break}case"demux":{var d=k.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(Z.isPromise)(d)?d.then(function(p){R(k,p)}):R(k,d);break}case"flush":{var S=o.chunkMeta,v=k.transmuxer.flush(S);Object(Z.isPromise)(v)?v.then(function(p){A(k,p,S)}):A(k,v,S);break}default:break}})}function R(k,C){if(_(C.remuxResult))return;var E=[],h=C.remuxResult,o=h.audio,l=h.video;o&&y(E,o),l&&y(E,l),k.postMessage({event:"transmuxComplete",data:C},E)}function y(k,C){C.data1&&k.push(C.data1.buffer),C.data2&&k.push(C.data2.buffer)}function A(k,C,E){C.forEach(function(h){R(k,h)}),k.postMessage({event:"flush",data:E})}function _(k){return!k.audio&&!k.video&&!k.text&&!k.id3&&!k.initSegment}},"./src/demux/transmuxer.ts":function(he,$,O){"use strict";O.r($),O.d($,"default",function(){return l}),O.d($,"isPromise",function(){return v}),O.d($,"TransmuxConfig",function(){return p}),O.d($,"TransmuxState",function(){return w});var Z=O("./src/events.ts"),F=O("./src/errors.ts"),I=O("./src/crypt/decrypter.ts"),K=O("./src/demux/aacdemuxer.ts"),B=O("./src/demux/mp4demuxer.ts"),P=O("./src/demux/tsdemuxer.ts"),R=O("./src/demux/mp3demuxer.ts"),y=O("./src/remux/mp4-remuxer.ts"),A=O("./src/remux/passthrough-remuxer.ts"),_=O("./src/demux/chunk-cache.ts"),k=O("./src/utils/mp4-tools.ts"),C=O("./src/utils/logger.ts"),E;try{E=self.performance.now.bind(self.performance)}catch(b){C.logger.debug("Unable to use Performance API on this environment"),E=self.Date.now}var h=[{demux:P.default,remux:y.default},{demux:B.default,remux:A.default},{demux:K.default,remux:y.default},{demux:R.default,remux:y.default}],o=1024;h.forEach(function(b){var u=b.demux;o=Math.max(o,u.minProbeByteLength)});var l=function(){function b(f,s,a,T,m){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new _.default,this.observer=f,this.typeSupported=s,this.config=a,this.vendor=T,this.id=m}var u=b.prototype;return u.configure=function(s){this.transmuxConfig=s,this.decrypter&&this.decrypter.reset()},u.push=function(s,a,T,m){var x=this,D=T.transmuxing;D.executeStart=E();var j=new Uint8Array(s),z=this.cache,V=this.config,M=this.currentTransmuxState,N=this.transmuxConfig;m&&(this.currentTransmuxState=m);var Y=d(j,a);if(Y&&Y.method==="AES-128"){var oe=this.getDecrypter();if(V.enableSoftwareAES){var pe=oe.softwareDecrypt(j,Y.key.buffer,Y.iv.buffer);if(!pe)return D.executeEnd=E(),S(T);j=new Uint8Array(pe)}else return this.decryptionPromise=oe.webCryptoDecrypt(j,Y.key.buffer,Y.iv.buffer).then(function(Oe){var Pe=x.push(Oe,null,T);return x.decryptionPromise=null,Pe}),this.decryptionPromise}var ve=m||M,Le=ve.contiguous,ke=ve.discontinuity,ce=ve.trackSwitch,ae=ve.accurateTimeOffset,de=ve.timeOffset,ne=N.audioCodec,se=N.videoCodec,J=N.defaultInitPts,ee=N.duration,ie=N.initSegmentData;if((ke||ce)&&this.resetInitSegment(ie,ne,se,ee),ke&&this.resetInitialTimestamp(J),Le||this.resetContiguity(),this.needsProbing(j,ke,ce)){if(z.dataLength){var fe=z.flush();j=Object(k.appendUint8Array)(fe,j)}this.configureTransmuxer(j,N)}var Ae=this.transmux(j,Y,de,ae,T),ge=this.currentTransmuxState;return ge.contiguous=!0,ge.discontinuity=!1,ge.trackSwitch=!1,D.executeEnd=E(),Ae},u.flush=function(s){var a=this,T=s.transmuxing;T.executeStart=E();var m=this.decrypter,x=this.cache,D=this.currentTransmuxState,j=this.decryptionPromise;if(j)return j.then(function(){return a.flush(s)});var z=[],V=D.timeOffset;if(m){var M=m.flush();M&&z.push(this.push(M,null,s))}var N=x.dataLength;x.reset();var Y=this.demuxer,oe=this.remuxer;if(!Y||!oe)return N>=o&&this.observer.emit(Z.Events.ERROR,Z.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),T.executeEnd=E(),[S(s)];var pe=Y.flush(V);return v(pe)?pe.then(function(ve){return a.flushRemux(z,ve,s),z}):(this.flushRemux(z,pe,s),z)},u.flushRemux=function(s,a,T){var m=a.audioTrack,x=a.avcTrack,D=a.id3Track,j=a.textTrack,z=this.currentTransmuxState,V=z.accurateTimeOffset,M=z.timeOffset;C.logger.log("[transmuxer.ts]: Flushed fragment "+T.sn+(T.part>-1?" p: "+T.part:"")+" of level "+T.level);var N=this.remuxer.remux(m,x,D,j,M,V,!0,this.id);s.push({remuxResult:N,chunkMeta:T}),T.transmuxing.executeEnd=E()},u.resetInitialTimestamp=function(s){var a=this.demuxer,T=this.remuxer;if(!a||!T)return;a.resetTimeStamp(s),T.resetTimeStamp(s)},u.resetContiguity=function(){var s=this.demuxer,a=this.remuxer;if(!s||!a)return;s.resetContiguity(),a.resetNextTimestamp()},u.resetInitSegment=function(s,a,T,m){var x=this.demuxer,D=this.remuxer;if(!x||!D)return;x.resetInitSegment(a,T,m),D.resetInitSegment(s,a,T)},u.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},u.transmux=function(s,a,T,m,x){var D;return a&&a.method==="SAMPLE-AES"?D=this.transmuxSampleAes(s,a,T,m,x):D=this.transmuxUnencrypted(s,T,m,x),D},u.transmuxUnencrypted=function(s,a,T,m){var x=this.demuxer.demux(s,a,!1,!this.config.progressive),D=x.audioTrack,j=x.avcTrack,z=x.id3Track,V=x.textTrack,M=this.remuxer.remux(D,j,z,V,a,T,!1,this.id);return{remuxResult:M,chunkMeta:m}},u.transmuxSampleAes=function(s,a,T,m,x){var D=this;return this.demuxer.demuxSampleAes(s,a,T).then(function(j){var z=D.remuxer.remux(j.audioTrack,j.avcTrack,j.id3Track,j.textTrack,T,m,!1,D.id);return{remuxResult:z,chunkMeta:x}})},u.configureTransmuxer=function(s,a){for(var T=this.config,m=this.observer,x=this.typeSupported,D=this.vendor,j=a.audioCodec,z=a.defaultInitPts,V=a.duration,M=a.initSegmentData,N=a.videoCodec,Y,oe=0,pe=h.length;oe<pe;oe++)if(h[oe].demux.probe(s)){Y=h[oe];break}Y||(C.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),Y={demux:B.default,remux:A.default});var ve=this.demuxer,Le=this.remuxer,ke=Y.remux,ce=Y.demux;(!Le||!(Le instanceof ke))&&(this.remuxer=new ke(m,T,x,D)),(!ve||!(ve instanceof ce))&&(this.demuxer=new ce(m,T,x),this.probe=ce.probe),this.resetInitSegment(M,j,N,V),this.resetInitialTimestamp(z)},u.needsProbing=function(s,a,T){return!this.demuxer||!this.remuxer||a||T},u.getDecrypter=function(){var s=this.decrypter;return s||(s=this.decrypter=new I.default(this.observer,this.config)),s},b}();function d(b,u){var f=null;return b.byteLength>0&&u!=null&&u.key!=null&&u.iv!==null&&u.method!=null&&(f=u),f}var S=function(u){return{remuxResult:{},chunkMeta:u}};function v(b){return"then"in b&&b.then instanceof Function}var p=function(u,f,s,a,T){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=u,this.videoCodec=f,this.initSegmentData=s,this.duration=a,this.defaultInitPts=T},w=function(u,f,s,a,T){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=u,this.contiguous=f,this.accurateTimeOffset=s,this.trackSwitch=a,this.timeOffset=T}},"./src/demux/tsdemuxer.ts":function(he,$,O){"use strict";O.r($),O.d($,"discardEPB",function(){return S});var Z=O("./src/demux/adts.ts"),F=O("./src/demux/mpegaudio.ts"),I=O("./src/demux/exp-golomb.ts"),K=O("./src/demux/id3.ts"),B=O("./src/demux/sample-aes.ts"),P=O("./src/events.ts"),R=O("./src/utils/mp4-tools.ts"),y=O("./src/utils/logger.ts"),A=O("./src/errors.ts"),_={video:1,audio:2,id3:3,text:4},k=function(){function v(w,b,u){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=w,this.config=b,this.typeSupported=u}v.probe=function(b){var u=v.syncOffset(b);return u<0?!1:(u&&y.logger.warn("MPEG2-TS detected but first sync word found @ offset "+u+", junk ahead ?"),!0)},v.syncOffset=function(b){for(var u=Math.min(1e3,b.length-3*188),f=0;f<u;){if(b[f]===71&&b[f+188]===71&&b[f+2*188]===71)return f;f++}return-1},v.createTrack=function(b,u){return{container:b==="video"||b==="audio"?"video/mp2t":void 0,type:b,id:_[b],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:b==="audio"?u:void 0}};var p=v.prototype;return p.resetInitSegment=function(b,u,f){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=v.createTrack("video",f),this._audioTrack=v.createTrack("audio",f),this._id3Track=v.createTrack("id3",f),this._txtTrack=v.createTrack("text",f),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=b,this.videoCodec=u,this._duration=f},p.resetTimeStamp=function(){},p.resetContiguity=function(){var b=this._audioTrack,u=this._avcTrack,f=this._id3Track;b&&(b.pesData=null),u&&(u.pesData=null),f&&(f.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},p.demux=function(b,u,f,s){f===void 0&&(f=!1),s===void 0&&(s=!1),f||(this.sampleAes=null);var a,T=this._avcTrack,m=this._audioTrack,x=this._id3Track,D=T.pid,j=T.pesData,z=m.pid,V=x.pid,M=m.pesData,N=x.pesData,Y=!1,oe=this.pmtParsed,pe=this._pmtId,ve=b.length;if(this.remainderData&&(b=Object(R.appendUint8Array)(this.remainderData,b),ve=b.length,this.remainderData=null),ve<188&&!s)return this.remainderData=b,{audioTrack:m,avcTrack:T,id3Track:x,textTrack:this._txtTrack};var Le=Math.max(0,v.syncOffset(b));ve-=(ve+Le)%188,ve<b.byteLength&&!s&&(this.remainderData=new Uint8Array(b.buffer,ve,b.buffer.byteLength-ve));for(var ke=Le;ke<ve;ke+=188)if(b[ke]===71){var ce=!!(b[ke+1]&64),ae=((b[ke+1]&31)<<8)+b[ke+2],de=(b[ke+3]&48)>>4,ne=void 0;if(de>1){if(ne=ke+5+b[ke+4],ne===ke+188)continue}else ne=ke+4;switch(ae){case D:ce&&(j&&(a=o(j))&&this.parseAVCPES(a,!1),j={data:[],size:0}),j&&(j.data.push(b.subarray(ne,ke+188)),j.size+=ke+188-ne);break;case z:ce&&(M&&(a=o(M))&&(m.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),M={data:[],size:0}),M&&(M.data.push(b.subarray(ne,ke+188)),M.size+=ke+188-ne);break;case V:ce&&(N&&(a=o(N))&&this.parseID3PES(a),N={data:[],size:0}),N&&(N.data.push(b.subarray(ne,ke+188)),N.size+=ke+188-ne);break;case 0:ce&&(ne+=b[ne]+1),pe=this._pmtId=E(b,ne);break;case pe:{ce&&(ne+=b[ne]+1);var se=h(b,ne,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,f);D=se.avc,D>0&&(T.pid=D),z=se.audio,z>0&&(m.pid=z,m.isAAC=se.isAAC),V=se.id3,V>0&&(x.pid=V),Y&&!oe&&(y.logger.log("reparse from beginning"),Y=!1,ke=Le-188),oe=this.pmtParsed=!0;break}case 17:case 8191:break;default:Y=!0;break}}else this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});T.pesData=j,m.pesData=M,x.pesData=N;var J={audioTrack:m,avcTrack:T,id3Track:x,textTrack:this._txtTrack};return s&&this.extractRemainingSamples(J),J},p.flush=function(){var b=this.remainderData;this.remainderData=null;var u;return b?u=this.demux(b,-1,!1,!0):u={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(u),this.sampleAes?this.decrypt(u,this.sampleAes):u},p.extractRemainingSamples=function(b){var u=b.audioTrack,f=b.avcTrack,s=b.id3Track,a=f.pesData,T=u.pesData,m=s.pesData,x;a&&(x=o(a))?(this.parseAVCPES(x,!0),f.pesData=null):f.pesData=a,T&&(x=o(T))?(u.isAAC?this.parseAACPES(x):this.parseMPEGPES(x),u.pesData=null):(T!=null&&T.size&&y.logger.log("last AAC PES packet truncated,might overlap between fragments"),u.pesData=T),m&&(x=o(m))?(this.parseID3PES(x),s.pesData=null):s.pesData=m},p.demuxSampleAes=function(b,u,f){var s=this.demux(b,f,!0,!this.config.progressive),a=this.sampleAes=new B.default(this.observer,this.config,u);return this.decrypt(s,a)},p.decrypt=function(b,u){return new Promise(function(f){var s=b.audioTrack,a=b.avcTrack;s.samples&&s.isAAC?u.decryptAacSamples(s.samples,0,function(){a.samples?u.decryptAvcSamples(a.samples,0,0,function(){f(b)}):f(b)}):a.samples&&u.decryptAvcSamples(a.samples,0,0,function(){f(b)})})},p.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},p.parseAVCPES=function(b,u){var f=this,s=this._avcTrack,a=this.parseAVCNALu(b.data),T=!1,m=this.avcSample,x,D=!1;b.data=null,m&&a.length&&!s.audFound&&(l(m,s),m=this.avcSample=C(!1,b.pts,b.dts,"")),a.forEach(function(j){switch(j.type){case 1:{x=!0,m||(m=f.avcSample=C(!0,b.pts,b.dts,"")),T&&(m.debug+="NDR "),m.frame=!0;var z=j.data;if(D&&z.length>4){var V=new I.default(z).readSliceType();(V===2||V===4||V===7||V===9)&&(m.key=!0)}break}case 5:x=!0,m||(m=f.avcSample=C(!0,b.pts,b.dts,"")),T&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{x=!0,T&&m&&(m.debug+="SEI ");var M=new I.default(S(j.data));M.readUByte();for(var N=0,Y=0,oe=!1,pe=0;!oe&&M.bytesAvailable>1;){N=0;do pe=M.readUByte(),N+=pe;while(pe===255);Y=0;do pe=M.readUByte(),Y+=pe;while(pe===255);if(N===4&&M.bytesAvailable!==0){oe=!0;var ve=M.readUByte();if(ve===181){var Le=M.readUShort();if(Le===49){var ke=M.readUInt();if(ke===1195456820){var ce=M.readUByte();if(ce===3){for(var ae=M.readUByte(),de=M.readUByte(),ne=31&ae,se=[ae,de],J=0;J<ne;J++)se.push(M.readUByte()),se.push(M.readUByte()),se.push(M.readUByte());d(f._txtTrack.samples,{type:3,pts:b.pts,bytes:se})}}}}}else if(N===5&&M.bytesAvailable!==0){if(oe=!0,Y>16){for(var ee=[],ie=0;ie<16;ie++)ee.push(M.readUByte().toString(16)),(ie===3||ie===5||ie===7||ie===9)&&ee.push("-");for(var fe=Y-16,Ae=new Uint8Array(fe),ge=0;ge<fe;ge++)Ae[ge]=M.readUByte();d(f._txtTrack.samples,{pts:b.pts,payloadType:N,uuid:ee.join(""),userData:Object(K.utf8ArrayToStr)(Ae),userDataBytes:Ae})}}else if(Y<M.bytesAvailable)for(var Oe=0;Oe<Y;Oe++)M.readUByte()}break}case 7:if(x=!0,D=!0,T&&m&&(m.debug+="SPS "),!s.sps){var Pe=new I.default(j.data),je=Pe.readSPS();s.width=je.width,s.height=je.height,s.pixelRatio=je.pixelRatio,s.sps=[j.data],s.duration=f._duration;for(var Ke=j.data.subarray(1,4),He="avc1.",Fe=0;Fe<3;Fe++){var qe=Ke[Fe].toString(16);qe.length<2&&(qe="0"+qe),He+=qe}s.codec=He}break;case 8:x=!0,T&&m&&(m.debug+="PPS "),s.pps||(s.pps=[j.data]);break;case 9:x=!1,s.audFound=!0,m&&l(m,s),m=f.avcSample=C(!1,b.pts,b.dts,T?"AUD ":"");break;case 12:x=!1;break;default:x=!1,m&&(m.debug+="unknown NAL "+j.type+" ");break}if(m&&x){var De=m.units;De.push(j)}}),u&&m&&(l(m,s),this.avcSample=null)},p.getLastNalUnit=function(){var b,u=this.avcSample,f;if(!u||u.units.length===0){var s=this._avcTrack.samples;u=s[s.length-1]}if((b=u)!==null&&b!==void 0&&b.units){var a=u.units;f=a[a.length-1]}return f},p.parseAVCNALu=function(b){var u=b.byteLength,f=this._avcTrack,s=f.naluState||0,a=s,T=[],m=0,x,D,j,z=-1,V=0;for(s===-1&&(z=0,V=b[0]&31,s=0,m=1);m<u;){if(x=b[m++],!s){s=x?0:1;continue}if(s===1){s=x?0:2;continue}if(!x)s=3;else if(x===1){if(z>=0){var M={data:b.subarray(z,m-s-1),type:V};T.push(M)}else{var N=this.getLastNalUnit();if(N&&(a&&m<=4-a&&(N.state&&(N.data=N.data.subarray(0,N.data.byteLength-a))),D=m-s-1,D>0)){var Y=new Uint8Array(N.data.byteLength+D);Y.set(N.data,0),Y.set(b.subarray(0,D),N.data.byteLength),N.data=Y,N.state=0}}m<u?(j=b[m]&31,z=m,V=j,s=0):s=-1}else s=0}if(z>=0&&s>=0){var oe={data:b.subarray(z,u),type:V,state:s};T.push(oe)}if(T.length===0){var pe=this.getLastNalUnit();if(pe){var ve=new Uint8Array(pe.data.byteLength+b.byteLength);ve.set(pe.data,0),ve.set(b,pe.data.byteLength),pe.data=ve}}return f.naluState=s,T},p.parseAACPES=function(b){var u=0,f=this._audioTrack,s=this.aacOverFlow,a=b.data;if(s){this.aacOverFlow=null;var T=s.sample.unit.byteLength,m=Math.min(s.missing,T),x=T-m;s.sample.unit.set(a.subarray(0,m),x),f.samples.push(s.sample),u=s.missing}var D,j;for(D=u,j=a.length;D<j-1&&!Z.isHeader(a,D);D++);if(D!==u){var z,V;if(D<j-1?(z="AAC PES did not start with ADTS header,offset:"+D,V=!1):(z="no ADTS header found in AAC PES",V=!0),y.logger.warn("parsing error:"+z),this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:V,reason:z}),V)return}Z.initTrackConfig(f,this.observer,a,D,this.audioCodec);var M;if(b.pts!==void 0)M=b.pts;else if(s){var N=Z.getFrameDuration(f.samplerate);M=s.sample.pts+N}else{y.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var Y=0;D<j;)if(Z.isHeader(a,D)){if(D+5<j){var oe=Z.appendFrame(f,a,D,M,Y);if(oe)if(oe.missing)this.aacOverFlow=oe;else{D+=oe.length,Y++;continue}}break}else D++},p.parseMPEGPES=function(b){var u=b.data,f=u.length,s=0,a=0,T=b.pts;if(T===void 0){y.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<f;)if(F.isHeader(u,a)){var m=F.appendFrame(this._audioTrack,u,a,T,s);if(m)a+=m.length,s++;else break}else a++},p.parseID3PES=function(b){if(b.pts===void 0){y.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(b)},v}();k.minProbeByteLength=188;function C(v,p,w,b){return{key:v,frame:!1,pts:p,dts:w,units:[],debug:b,length:0}}function E(v,p){return(v[p+10]&31)<<8|v[p+11]}function h(v,p,w,b){var u={audio:-1,avc:-1,id3:-1,isAAC:!0},f=(v[p+1]&15)<<8|v[p+2],s=p+3+f-4,a=(v[p+10]&15)<<8|v[p+11];for(p+=12+a;p<s;){var T=(v[p+1]&31)<<8|v[p+2];switch(v[p]){case 207:if(!b){y.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:u.audio===-1&&(u.audio=T);break;case 21:u.id3===-1&&(u.id3=T);break;case 219:if(!b){y.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:u.avc===-1&&(u.avc=T);break;case 3:case 4:w?u.audio===-1&&(u.audio=T,u.isAAC=!1):y.logger.log("MPEG audio found, not supported in this browser");break;case 36:y.logger.warn("Unsupported HEVC stream type found");break;default:break}p+=((v[p+3]&15)<<8|v[p+4])+5}return u}function o(v){var p=0,w,b,u,f,s,a=v.data;if(!v||v.size===0)return null;for(;a[0].length<19&&a.length>1;){var T=new Uint8Array(a[0].length+a[1].length);T.set(a[0]),T.set(a[1],a[0].length),a[0]=T,a.splice(1,1)}w=a[0];var m=(w[0]<<16)+(w[1]<<8)+w[2];if(m===1){if(b=(w[4]<<8)+w[5],b&&b>v.size-6)return null;var x=w[7];x&192&&(f=(w[9]&14)*536870912+(w[10]&255)*4194304+(w[11]&254)*16384+(w[12]&255)*128+(w[13]&254)/2,x&64?(s=(w[14]&14)*536870912+(w[15]&255)*4194304+(w[16]&254)*16384+(w[17]&255)*128+(w[18]&254)/2,f-s>60*9e4&&(y.logger.warn(Math.round((f-s)/9e4)+"s delta between PTS and DTS, align them"),f=s)):s=f),u=w[8];var D=u+9;if(v.size<=D)return null;v.size-=D;for(var j=new Uint8Array(v.size),z=0,V=a.length;z<V;z++){w=a[z];var M=w.byteLength;if(D)if(D>M){D-=M;continue}else w=w.subarray(D),M-=D,D=0;j.set(w,p),p+=M}return b&&(b-=u+3),{data:j,pts:f,dts:s,len:b}}return null}function l(v,p){if(v.units.length&&v.frame){if(v.pts===void 0){var w=p.samples,b=w.length;if(b){var u=w[b-1];v.pts=u.pts,v.dts=u.dts}else{p.dropped++;return}}p.samples.push(v)}v.debug.length&&y.logger.log(v.pts+"/"+v.dts+":"+v.debug)}function d(v,p){var w=v.length;if(w>0){if(p.pts>=v[w-1].pts)v.push(p);else for(var b=w-1;b>=0;b--)if(p.pts<v[b].pts){v.splice(b,0,p);break}}else v.push(p)}function S(v){for(var p=v.byteLength,w=[],b=1;b<p-2;)v[b]===0&&v[b+1]===0&&v[b+2]===3?(w.push(b+2),b+=2):b++;if(w.length===0)return v;var u=p-w.length,f=new Uint8Array(u),s=0;for(b=0;b<u;s++,b++)s===w[0]&&(s++,w.shift()),f[b]=v[s];return f}$.default=k},"./src/errors.ts":function(he,$,O){"use strict";O.r($),O.d($,"ErrorTypes",function(){return Z}),O.d($,"ErrorDetails",function(){return F});var Z;(function(I){I.NETWORK_ERROR="networkError",I.MEDIA_ERROR="mediaError",I.KEY_SYSTEM_ERROR="keySystemError",I.MUX_ERROR="muxError",I.OTHER_ERROR="otherError"})(Z||(Z={}));var F;(function(I){I.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",I.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",I.KEY_SYSTEM_NO_SESSION="keySystemNoSession",I.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",I.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",I.MANIFEST_LOAD_ERROR="manifestLoadError",I.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",I.MANIFEST_PARSING_ERROR="manifestParsingError",I.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",I.LEVEL_EMPTY_ERROR="levelEmptyError",I.LEVEL_LOAD_ERROR="levelLoadError",I.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",I.LEVEL_SWITCH_ERROR="levelSwitchError",I.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",I.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",I.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",I.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",I.FRAG_LOAD_ERROR="fragLoadError",I.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",I.FRAG_DECRYPT_ERROR="fragDecryptError",I.FRAG_PARSING_ERROR="fragParsingError",I.REMUX_ALLOC_ERROR="remuxAllocError",I.KEY_LOAD_ERROR="keyLoadError",I.KEY_LOAD_TIMEOUT="keyLoadTimeOut",I.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",I.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",I.BUFFER_APPEND_ERROR="bufferAppendError",I.BUFFER_APPENDING_ERROR="bufferAppendingError",I.BUFFER_STALLED_ERROR="bufferStalledError",I.BUFFER_FULL_ERROR="bufferFullError",I.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",I.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",I.INTERNAL_EXCEPTION="internalException",I.INTERNAL_ABORTED="aborted",I.UNKNOWN="unknown"})(F||(F={}))},"./src/events.ts":function(he,$,O){"use strict";O.r($),O.d($,"Events",function(){return Z});var Z;(function(F){F.MEDIA_ATTACHING="hlsMediaAttaching",F.MEDIA_ATTACHED="hlsMediaAttached",F.MEDIA_DETACHING="hlsMediaDetaching",F.MEDIA_DETACHED="hlsMediaDetached",F.BUFFER_RESET="hlsBufferReset",F.BUFFER_CODECS="hlsBufferCodecs",F.BUFFER_CREATED="hlsBufferCreated",F.BUFFER_APPENDING="hlsBufferAppending",F.BUFFER_APPENDED="hlsBufferAppended",F.BUFFER_EOS="hlsBufferEos",F.BUFFER_FLUSHING="hlsBufferFlushing",F.BUFFER_FLUSHED="hlsBufferFlushed",F.MANIFEST_LOADING="hlsManifestLoading",F.MANIFEST_LOADED="hlsManifestLoaded",F.MANIFEST_PARSED="hlsManifestParsed",F.LEVEL_SWITCHING="hlsLevelSwitching",F.LEVEL_SWITCHED="hlsLevelSwitched",F.LEVEL_LOADING="hlsLevelLoading",F.LEVEL_LOADED="hlsLevelLoaded",F.LEVEL_UPDATED="hlsLevelUpdated",F.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",F.LEVELS_UPDATED="hlsLevelsUpdated",F.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",F.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",F.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",F.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",F.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",F.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",F.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",F.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",F.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",F.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",F.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",F.CUES_PARSED="hlsCuesParsed",F.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",F.INIT_PTS_FOUND="hlsInitPtsFound",F.FRAG_LOADING="hlsFragLoading",F.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",F.FRAG_LOADED="hlsFragLoaded",F.FRAG_DECRYPTED="hlsFragDecrypted",F.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",F.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",F.FRAG_PARSING_METADATA="hlsFragParsingMetadata",F.FRAG_PARSED="hlsFragParsed",F.FRAG_BUFFERED="hlsFragBuffered",F.FRAG_CHANGED="hlsFragChanged",F.FPS_DROP="hlsFpsDrop",F.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",F.ERROR="hlsError",F.DESTROYING="hlsDestroying",F.KEY_LOADING="hlsKeyLoading",F.KEY_LOADED="hlsKeyLoaded",F.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",F.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Z||(Z={}))},"./src/hls.ts":function(he,$,O){"use strict";O.r($),O.d($,"default",function(){return v});var Z=O("./node_modules/url-toolkit/src/url-toolkit.js"),F=O.n(Z),I=O("./src/loader/playlist-loader.ts"),K=O("./src/loader/key-loader.ts"),B=O("./src/controller/id3-track-controller.ts"),P=O("./src/controller/latency-controller.ts"),R=O("./src/controller/level-controller.ts"),y=O("./src/controller/fragment-tracker.ts"),A=O("./src/controller/stream-controller.ts"),_=O("./src/is-supported.ts"),k=O("./src/utils/logger.ts"),C=O("./src/config.ts"),E=O("./node_modules/eventemitter3/index.js"),h=O.n(E),o=O("./src/events.ts"),l=O("./src/errors.ts");function d(p,w){for(var b=0;b<w.length;b++){var u=w[b];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(p,u.key,u)}}function S(p,w,b){return w&&d(p.prototype,w),b&&d(p,b),p}var v=function(){p.isSupported=function(){return Object(_.isSupported)()};function p(b){b===void 0&&(b={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new E.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var u=this.config=Object(C.mergeConfig)(p.DefaultConfig,b);this.userConfig=b,Object(k.enableLogs)(u.debug),this._autoLevelCapping=-1,u.progressive&&Object(C.enableStreamingMode)(u);var f=u.abrController,s=u.bufferController,a=u.capLevelController,T=u.fpsController,m=this.abrController=new f(this),x=this.bufferController=new s(this),D=this.capLevelController=new a(this),j=new T(this),z=new I.default(this),V=new K.default(this),M=new B.default(this),N=this.levelController=new R.default(this),Y=new y.FragmentTracker(this),oe=this.streamController=new A.default(this,Y);D.setStreamController(oe),j.setStreamController(oe);var pe=[N,oe];this.networkControllers=pe;var ve=[z,V,m,x,D,j,M,Y];this.audioTrackController=this.createController(u.audioTrackController,null,pe),this.createController(u.audioStreamController,Y,pe),this.subtitleTrackController=this.createController(u.subtitleTrackController,null,pe),this.createController(u.subtitleStreamController,Y,pe),this.createController(u.timelineController,null,ve),this.emeController=this.createController(u.emeController,null,ve),this.cmcdController=this.createController(u.cmcdController,null,ve),this.latencyController=this.createController(P.default,null,ve),this.coreComponents=ve}var w=p.prototype;return w.createController=function(u,f,s){if(u){var a=f?new u(this,f):new u(this);return s&&s.push(a),a}return null},w.on=function(u,f,s){s===void 0&&(s=this),this._emitter.on(u,f,s)},w.once=function(u,f,s){s===void 0&&(s=this),this._emitter.once(u,f,s)},w.removeAllListeners=function(u){this._emitter.removeAllListeners(u)},w.off=function(u,f,s,a){s===void 0&&(s=this),this._emitter.off(u,f,s,a)},w.listeners=function(u){return this._emitter.listeners(u)},w.emit=function(u,f,s){return this._emitter.emit(u,f,s)},w.trigger=function(u,f){if(this.config.debug)return this.emit(u,u,f);try{return this.emit(u,u,f)}catch(s){k.logger.error("An internal error happened while handling event "+u+'. Error message: "'+s.message+'". Here is a stacktrace:',s),this.trigger(o.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:u,error:s})}return!1},w.listenerCount=function(u){return this._emitter.listenerCount(u)},w.destroy=function(){k.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(u){return u.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(u){return u.destroy()}),this.coreComponents.length=0},w.attachMedia=function(u){k.logger.log("attachMedia"),this._media=u,this.trigger(o.Events.MEDIA_ATTACHING,{media:u})},w.detachMedia=function(){k.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},w.loadSource=function(u){this.stopLoad();var f=this.media,s=this.url,a=this.url=Z.buildAbsoluteURL(self.location.href,u,{alwaysNormalize:!0});k.logger.log("loadSource:"+a),f&&s&&s!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(f)),this.trigger(o.Events.MANIFEST_LOADING,{url:u})},w.startLoad=function(u){u===void 0&&(u=-1),k.logger.log("startLoad("+u+")"),this.networkControllers.forEach(function(f){f.startLoad(u)})},w.stopLoad=function(){k.logger.log("stopLoad"),this.networkControllers.forEach(function(u){u.stopLoad()})},w.swapAudioCodec=function(){k.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},w.recoverMediaError=function(){k.logger.log("recoverMediaError");var u=this._media;this.detachMedia(),u&&this.attachMedia(u)},w.removeLevel=function(u,f){f===void 0&&(f=0),this.levelController.removeLevel(u,f)},S(p,[{key:"levels",get:function(){var u=this.levelController.levels;return u||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(u){k.logger.log("set currentLevel:"+u),this.loadLevel=u,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(u){k.logger.log("set nextLevel:"+u),this.levelController.manualLevel=u,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(u){k.logger.log("set loadLevel:"+u),this.levelController.manualLevel=u}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(u){this.levelController.nextLoadLevel=u}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(u){k.logger.log("set firstLevel:"+u),this.levelController.firstLevel=u}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(u){k.logger.log("set startLevel:"+u),u!==-1&&(u=Math.max(u,this.minAutoLevel)),this.levelController.startLevel=u}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(u){var f=!!u;f!==this.config.capLevelToPlayerSize&&(f?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=f)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(u){this._autoLevelCapping!==u&&(k.logger.log("set autoLevelCapping:"+u),this._autoLevelCapping=u)}},{key:"bandwidthEstimate",get:function(){var u=this.abrController.bwEstimator;return u?u.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var u=this.levels,f=this.config.minAutoBitrate;if(!u)return 0;for(var s=u.length,a=0;a<s;a++)if(u[a].maxBitrate>f)return a;return 0}},{key:"maxAutoLevel",get:function(){var u=this.levels,f=this.autoLevelCapping,s;return f===-1&&u&&u.length?s=u.length-1:s=f,s}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(u){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,u)}},{key:"audioTracks",get:function(){var u=this.audioTrackController;return u?u.audioTracks:[]}},{key:"audioTrack",get:function(){var u=this.audioTrackController;return u?u.audioTrack:-1},set:function(u){var f=this.audioTrackController;f&&(f.audioTrack=u)}},{key:"subtitleTracks",get:function(){var u=this.subtitleTrackController;return u?u.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var u=this.subtitleTrackController;return u?u.subtitleTrack:-1},set:function(u){var f=this.subtitleTrackController;f&&(f.subtitleTrack=u)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var u=this.subtitleTrackController;return u?u.subtitleDisplay:!1},set:function(u){var f=this.subtitleTrackController;f&&(f.subtitleDisplay=u)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(u){this.config.lowLatencyMode=u}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return p.defaultConfig?p.defaultConfig:C.hlsDefaultConfig},set:function(u){p.defaultConfig=u}}]),p}();v.defaultConfig=void 0},"./src/is-supported.ts":function(he,$,O){"use strict";O.r($),O.d($,"isSupported",function(){return I}),O.d($,"changeTypeSupported",function(){return K});var Z=O("./src/utils/mediasource-helper.ts");function F(){return self.SourceBuffer||self.WebKitSourceBuffer}function I(){var B=Object(Z.getMediaSource)();if(!B)return!1;var P=F(),R=B&&typeof B.isTypeSupported=="function"&&B.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),y=!P||P.prototype&&typeof P.prototype.appendBuffer=="function"&&typeof P.prototype.remove=="function";return!!R&&!!y}function K(){var B,P=F();return typeof(P==null||((B=P.prototype)===null||B===void 0)?void 0:B.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(he,$,O){"use strict";O.r($),O.d($,"default",function(){return k}),O.d($,"LoadError",function(){return E});var Z=O("./src/polyfills/number.ts"),F=O("./src/errors.ts");function I(h,o){h.prototype=Object.create(o.prototype),h.prototype.constructor=h,y(h,o)}function K(h){var o=typeof Map=="function"?new Map:void 0;return K=function(d){if(d===null||!R(d))return d;if(typeof d!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(d))return o.get(d);o.set(d,S)}function S(){return B(d,arguments,A(this).constructor)}return S.prototype=Object.create(d.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),y(S,d)},K(h)}function B(h,o,l){return P()?B=Reflect.construct:B=function(S,v,p){var w=[null];w.push.apply(w,v);var b=Function.bind.apply(S,w),u=new b;return p&&y(u,p.prototype),u},B.apply(null,arguments)}function P(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(h){return!1}}function R(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function y(h,o){return y=Object.setPrototypeOf||function(d,S){return d.__proto__=S,d},y(h,o)}function A(h){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},A(h)}var _=Math.pow(2,17),k=function(){function h(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var o=h.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(d,S){var v=this,p=d.url;if(!p)return Promise.reject(new E({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,networkDetails:null},"Fragment does not have a "+(p?"part list":"url")));this.abort();var w=this.config,b=w.fLoader,u=w.loader;return new Promise(function(f,s){v.loader&&v.loader.destroy();var a=v.loader=d.loader=b?new b(w):new u(w),T=C(d),m={timeout:w.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:w.fragLoadingMaxRetryTimeout,highWaterMark:_};d.stats=a.stats,a.load(T,m,{onSuccess:function(D,j,z,V){v.resetLoader(d,a),f({frag:d,part:null,payload:D.data,networkDetails:V})},onError:function(D,j,z){v.resetLoader(d,a),s(new E({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,response:D,networkDetails:z}))},onAbort:function(D,j,z){v.resetLoader(d,a),s(new E({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,networkDetails:z}))},onTimeout:function(D,j,z){v.resetLoader(d,a),s(new E({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,networkDetails:z}))},onProgress:function(D,j,z,V){S&&S({frag:d,part:null,payload:z,networkDetails:V})}})})},o.loadPart=function(d,S,v){var p=this;this.abort();var w=this.config,b=w.fLoader,u=w.loader;return new Promise(function(f,s){p.loader&&p.loader.destroy();var a=p.loader=d.loader=b?new b(w):new u(w),T=C(d,S),m={timeout:w.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:w.fragLoadingMaxRetryTimeout,highWaterMark:_};S.stats=a.stats,a.load(T,m,{onSuccess:function(D,j,z,V){p.resetLoader(d,a),p.updateStatsFromPart(d,S);var M={frag:d,part:S,payload:D.data,networkDetails:V};v(M),f(M)},onError:function(D,j,z){p.resetLoader(d,a),s(new E({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,part:S,response:D,networkDetails:z}))},onAbort:function(D,j,z){d.stats.aborted=S.stats.aborted,p.resetLoader(d,a),s(new E({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,part:S,networkDetails:z}))},onTimeout:function(D,j,z){p.resetLoader(d,a),s(new E({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,part:S,networkDetails:z}))}})})},o.updateStatsFromPart=function(d,S){var v=d.stats,p=S.stats,w=p.total;if(v.loaded+=p.loaded,w){var b=Math.round(d.duration/S.duration),u=Math.min(Math.round(v.loaded/w),b),f=b-u,s=f*Math.round(v.loaded/u);v.total=v.loaded+s}else v.total=Math.max(v.loaded,v.total);var a=v.loading,T=p.loading;a.start?a.first+=T.first-T.start:(a.start=T.start,a.first=T.first),a.end=T.end},o.resetLoader=function(d,S){d.loader=null,this.loader===S&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),S.destroy()},h}();function C(h,o){o===void 0&&(o=null);var l=o||h,d={frag:h,part:o,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},S=l.byteRangeStartOffset,v=l.byteRangeEndOffset;return Object(Z.isFiniteNumber)(S)&&Object(Z.isFiniteNumber)(v)&&(d.rangeStart=S,d.rangeEnd=v),d}var E=function(h){I(o,h);function o(l){for(var d,S=arguments.length,v=new Array(S>1?S-1:0),p=1;p<S;p++)v[p-1]=arguments[p];return d=h.call.apply(h,[this].concat(v))||this,d.data=void 0,d.data=l,d}return o}(K(Error))},"./src/loader/fragment.ts":function(he,$,O){"use strict";O.r($),O.d($,"ElementaryStreamTypes",function(){return k}),O.d($,"BaseSegment",function(){return C}),O.d($,"Fragment",function(){return E}),O.d($,"Part",function(){return h});var Z=O("./src/polyfills/number.ts"),F=O("./node_modules/url-toolkit/src/url-toolkit.js"),I=O.n(F),K=O("./src/utils/logger.ts"),B=O("./src/loader/level-key.ts"),P=O("./src/loader/load-stats.ts");function R(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,y(o,l)}function y(o,l){return y=Object.setPrototypeOf||function(S,v){return S.__proto__=v,S},y(o,l)}function A(o,l){for(var d=0;d<l.length;d++){var S=l[d];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(o,S.key,S)}}function _(o,l,d){return l&&A(o.prototype,l),d&&A(o,d),o}var k;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(k||(k={}));var C=function(){function o(d){var S;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(S={},S[k.AUDIO]=null,S[k.VIDEO]=null,S[k.AUDIOVIDEO]=null,S),this.baseurl=d}var l=o.prototype;return l.setByteRange=function(S,v){var p=S.split("@",2),w=[];p.length===1?w[0]=v?v.byteRangeEndOffset:0:w[0]=parseInt(p[1]),w[1]=parseInt(p[0])+w[0],this._byteRange=w},_(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(F.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(S){this._url=S}}]),o}(),E=function(o){R(l,o);function l(S,v){var p;return p=o.call(this,v)||this,p._decryptdata=null,p.rawProgramDateTime=null,p.programDateTime=null,p.tagList=[],p.duration=0,p.sn=0,p.levelkey=void 0,p.type=void 0,p.loader=null,p.level=-1,p.cc=0,p.startPTS=void 0,p.endPTS=void 0,p.appendedPTS=void 0,p.startDTS=void 0,p.endDTS=void 0,p.start=0,p.deltaPTS=void 0,p.maxStartPTS=void 0,p.minEndPTS=void 0,p.stats=new P.LoadStats,p.urlId=0,p.data=void 0,p.bitrateTest=!1,p.title=null,p.initSegment=null,p.type=S,p}var d=l.prototype;return d.createInitializationVector=function(v){for(var p=new Uint8Array(16),w=12;w<16;w++)p[w]=v>>8*(15-w)&255;return p},d.setDecryptDataFromLevelKey=function(v,p){var w=v;return(v==null?void 0:v.method)==="AES-128"&&v.uri&&!v.iv&&(w=B.LevelKey.fromURI(v.uri),w.method=v.method,w.iv=this.createInitializationVector(p),w.keyFormat="identity"),w},d.setElementaryStreamInfo=function(v,p,w,b,u,f){f===void 0&&(f=!1);var s=this.elementaryStreams,a=s[v];if(!a){s[v]={startPTS:p,endPTS:w,startDTS:b,endDTS:u,partial:f};return}a.startPTS=Math.min(a.startPTS,p),a.endPTS=Math.max(a.endPTS,w),a.startDTS=Math.min(a.startDTS,b),a.endDTS=Math.max(a.endDTS,u)},d.clearElementaryStreamInfo=function(){var v=this.elementaryStreams;v[k.AUDIO]=null,v[k.VIDEO]=null,v[k.AUDIOVIDEO]=null},_(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var v=this.sn;typeof v!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&K.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),v=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,v)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(Z.isFiniteNumber)(this.programDateTime))return null;var v=Object(Z.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+v*1e3}},{key:"encrypted",get:function(){var v;return!!((v=this.decryptdata)!==null&&v!==void 0&&v.keyFormat&&this.decryptdata.uri)}}]),l}(C),h=function(o){R(l,o);function l(d,S,v,p,w){var b;b=o.call(this,v)||this,b.fragOffset=0,b.duration=0,b.gap=!1,b.independent=!1,b.relurl=void 0,b.fragment=void 0,b.index=void 0,b.stats=new P.LoadStats,b.duration=d.decimalFloatingPoint("DURATION"),b.gap=d.bool("GAP"),b.independent=d.bool("INDEPENDENT"),b.relurl=d.enumeratedString("URI"),b.fragment=S,b.index=p;var u=d.enumeratedString("BYTERANGE");return u&&b.setByteRange(u,w),w&&(b.fragOffset=w.fragOffset+w.duration),b}return _(l,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var S=this.elementaryStreams;return!!(S.audio||S.video||S.audiovideo)}}]),l}(C)},"./src/loader/key-loader.ts":function(he,$,O){"use strict";O.r($),O.d($,"default",function(){return K});var Z=O("./src/events.ts"),F=O("./src/errors.ts"),I=O("./src/utils/logger.ts"),K=function(){function B(R){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=R,this._registerListeners()}var P=B.prototype;return P._registerListeners=function(){this.hls.on(Z.Events.KEY_LOADING,this.onKeyLoading,this)},P._unregisterListeners=function(){this.hls.off(Z.Events.KEY_LOADING,this.onKeyLoading)},P.destroy=function(){this._unregisterListeners();for(var y in this.loaders){var A=this.loaders[y];A&&A.destroy()}this.loaders={}},P.onKeyLoading=function(y,A){var _=A.frag,k=_.type,C=this.loaders[k];if(!_.decryptdata){I.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var E=_.decryptdata.uri;if(E!==this.decrypturl||this.decryptkey===null){var h=this.hls.config;if(C&&(I.logger.warn("abort previous key loader for type:"+k),C.abort()),!E){I.logger.warn("key uri is falsy");return}var o=h.loader,l=_.loader=this.loaders[k]=new o(h);this.decrypturl=E,this.decryptkey=null;var d={url:E,frag:_,responseType:"arraybuffer"},S={timeout:h.fragLoadingTimeOut,maxRetry:0,retryDelay:h.fragLoadingRetryDelay,maxRetryDelay:h.fragLoadingMaxRetryTimeout,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(d,S,v)}else this.decryptkey&&(_.decryptdata.key=this.decryptkey,this.hls.trigger(Z.Events.KEY_LOADED,{frag:_}))},P.loadsuccess=function(y,A,_){var k=_.frag;if(!k.decryptdata){I.logger.error("after key load, decryptdata unset");return}this.decryptkey=k.decryptdata.key=new Uint8Array(y.data),k.loader=null,delete this.loaders[k.type],this.hls.trigger(Z.Events.KEY_LOADED,{frag:k})},P.loaderror=function(y,A){var _=A.frag,k=_.loader;k&&k.abort(),delete this.loaders[_.type],this.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:_,response:y})},P.loadtimeout=function(y,A){var _=A.frag,k=_.loader;k&&k.abort(),delete this.loaders[_.type],this.hls.trigger(Z.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:_})},B}()},"./src/loader/level-details.ts":function(he,$,O){"use strict";O.r($),O.d($,"LevelDetails",function(){return B});var Z=O("./src/polyfills/number.ts");function F(P,R){for(var y=0;y<R.length;y++){var A=R[y];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(P,A.key,A)}}function I(P,R,y){return R&&F(P.prototype,R),y&&F(P,y),P}var K=10,B=function(){function P(y){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=y}var R=P.prototype;return R.reloaded=function(A){if(!A){this.advanced=!0,this.updated=!0;return}var _=this.lastPartSn-A.lastPartSn,k=this.lastPartIndex-A.lastPartIndex;this.updated=this.endSN!==A.endSN||!!k||!!_,this.advanced=this.endSN>A.endSN||_>0||_===0&&k>0,this.updated||this.advanced?this.misses=Math.floor(A.misses*.6):this.misses=A.misses+1,this.availabilityDelay=A.availabilityDelay},I(P,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Z.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||K}},{key:"drift",get:function(){var A=this.driftEndTime-this.driftStartTime;if(A>0){var _=this.driftEnd-this.driftStart;return _*1e3/A}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var A;return(A=this.fragments)!==null&&A!==void 0&&A.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),P}()},"./src/loader/level-key.ts":function(he,$,O){"use strict";O.r($),O.d($,"LevelKey",function(){return B});var Z=O("./node_modules/url-toolkit/src/url-toolkit.js"),F=O.n(Z);function I(P,R){for(var y=0;y<R.length;y++){var A=R[y];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(P,A.key,A)}}function K(P,R,y){return R&&I(P.prototype,R),y&&I(P,y),P}var B=function(){P.fromURL=function(y,A){return new P(y,A)},P.fromURI=function(y){return new P(y)};function P(R,y){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,y?this._uri=Object(Z.buildAbsoluteURL)(R,y,{alwaysNormalize:!0}):this._uri=R}return K(P,[{key:"uri",get:function(){return this._uri}}]),P}()},"./src/loader/load-stats.ts":function(he,$,O){"use strict";O.r($),O.d($,"LoadStats",function(){return Z});var Z=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(he,$,O){"use strict";O.r($),O.d($,"default",function(){return l});var Z=O("./src/polyfills/number.ts"),F=O("./node_modules/url-toolkit/src/url-toolkit.js"),I=O.n(F),K=O("./src/loader/fragment.ts"),B=O("./src/loader/level-details.ts"),P=O("./src/loader/level-key.ts"),R=O("./src/utils/attr-list.ts"),y=O("./src/utils/logger.ts"),A=O("./src/utils/codecs.ts"),_=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,k=/#EXT-X-MEDIA:(.*)/g,C=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),E=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),h=/\.(mp4|m4s|m4v|m4a)$/i;function o(w){var b,u;return h.test((b=(u=F.parseURL(w))===null||u===void 0?void 0:u.path)!=null?b:"")}var l=function(){function w(){}return w.findGroup=function(u,f){for(var s=0;s<u.length;s++){var a=u[s];if(a.id===f)return a}},w.convertAVC1ToAVCOTI=function(u){var f=u.split(".");if(f.length>2){var s=f.shift()+".";return s+=parseInt(f.shift()).toString(16),s+=("000"+parseInt(f.shift()).toString(16)).substr(-4),s}return u},w.resolve=function(u,f){return F.buildAbsoluteURL(f,u,{alwaysNormalize:!0})},w.parseMasterPlaylist=function(u,f){var s=[],a={},T=!1;_.lastIndex=0;for(var m;(m=_.exec(u))!=null;)if(m[1]){var x=new R.AttrList(m[1]),D={attrs:x,bitrate:x.decimalInteger("AVERAGE-BANDWIDTH")||x.decimalInteger("BANDWIDTH"),name:x.NAME,url:w.resolve(m[2],f)},j=x.decimalResolution("RESOLUTION");j&&(D.width=j.width,D.height=j.height),d((x.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),D),D.videoCodec&&D.videoCodec.indexOf("avc1")!==-1&&(D.videoCodec=w.convertAVC1ToAVCOTI(D.videoCodec)),s.push(D)}else if(m[3]){var z=new R.AttrList(m[3]);z["DATA-ID"]&&(T=!0,a[z["DATA-ID"]]=z)}return{levels:s,sessionData:T?a:null}},w.parseMasterPlaylistMedia=function(u,f,s,a){a===void 0&&(a=[]);var T,m=[],x=0;for(k.lastIndex=0;(T=k.exec(u))!==null;){var D=new R.AttrList(T[1]);if(D.TYPE===s){var j={attrs:D,bitrate:0,id:x++,groupId:D["GROUP-ID"],instreamId:D["INSTREAM-ID"],name:D.NAME||D.LANGUAGE||"",type:s,default:D.bool("DEFAULT"),autoselect:D.bool("AUTOSELECT"),forced:D.bool("FORCED"),lang:D.LANGUAGE,url:D.URI?w.resolve(D.URI,f):""};if(a.length){var z=w.findGroup(a,j.groupId)||a[0];S(j,z,"audioCodec"),S(j,z,"textCodec")}m.push(j)}}return m},w.parseLevelPlaylist=function(u,f,s,a,T){var m=new B.LevelDetails(f),x=m.fragments,D=null,j=0,z=0,V=0,M=0,N=null,Y=new K.Fragment(a,f),oe,pe,ve,Le=-1,ke=!1;for(C.lastIndex=0,m.m3u8=u;(oe=C.exec(u))!==null;){ke&&(ke=!1,Y=new K.Fragment(a,f),Y.start=V,Y.sn=j,Y.cc=M,Y.level=s,D&&(Y.initSegment=D,Y.rawProgramDateTime=D.rawProgramDateTime));var ce=oe[1];if(ce){Y.duration=parseFloat(ce);var ae=(" "+oe[2]).slice(1);Y.title=ae||null,Y.tagList.push(ae?["INF",ce,ae]:["INF",ce])}else if(oe[3])Object(Z.isFiniteNumber)(Y.duration)&&(Y.start=V,ve&&(Y.levelkey=ve),Y.sn=j,Y.level=s,Y.cc=M,Y.urlId=T,x.push(Y),Y.relurl=(" "+oe[3]).slice(1),p(Y,N),N=Y,V+=Y.duration,j++,z=0,ke=!0);else if(oe[4]){var de=(" "+oe[4]).slice(1);N?Y.setByteRange(de,N):Y.setByteRange(de)}else if(oe[5])Y.rawProgramDateTime=(" "+oe[5]).slice(1),Y.tagList.push(["PROGRAM-DATE-TIME",Y.rawProgramDateTime]),Le===-1&&(Le=x.length);else{if(oe=oe[0].match(E),!oe){y.logger.warn("No matches on slow regex match for level playlist!");continue}for(pe=1;pe<oe.length&&!(typeof oe[pe]!="undefined");pe++);var ne=(" "+oe[pe]).slice(1),se=(" "+oe[pe+1]).slice(1),J=oe[pe+2]?(" "+oe[pe+2]).slice(1):"";switch(ne){case"PLAYLIST-TYPE":m.type=se.toUpperCase();break;case"MEDIA-SEQUENCE":j=m.startSN=parseInt(se);break;case"SKIP":{var ee=new R.AttrList(se),ie=ee.decimalInteger("SKIPPED-SEGMENTS");if(Object(Z.isFiniteNumber)(ie)){m.skippedSegments=ie;for(var fe=ie;fe--;)x.unshift(null);j+=ie}var Ae=ee.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ae&&(m.recentlyRemovedDateranges=Ae.split(" "));break}case"TARGETDURATION":m.targetduration=parseFloat(se);break;case"VERSION":m.version=parseInt(se);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(se||J)&&Y.tagList.push(J?[se,J]:[se]);break;case"DIS":M++;case"GAP":Y.tagList.push([ne]);break;case"BITRATE":Y.tagList.push([ne,se]);break;case"DISCONTINUITY-SEQ":M=parseInt(se);break;case"KEY":{var ge,Oe=new R.AttrList(se),Pe=Oe.enumeratedString("METHOD"),je=Oe.URI,Ke=Oe.hexadecimalInteger("IV"),He=Oe.enumeratedString("KEYFORMATVERSIONS"),Fe=Oe.enumeratedString("KEYID"),qe=(ge=Oe.enumeratedString("KEYFORMAT"))!=null?ge:"identity",De=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(De.indexOf(qe)>-1){y.logger.warn("Keyformat "+qe+" is not supported from the manifest");continue}else if(qe!=="identity")continue;Pe&&(ve=P.LevelKey.fromURL(f,je),je&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Pe)>=0&&(ve.method=Pe,ve.keyFormat=qe,Fe&&(ve.keyID=Fe),He&&(ve.keyFormatVersions=He),ve.iv=Ke));break}case"START":{var Ne=new R.AttrList(se),Be=Ne.decimalFloatingPoint("TIME-OFFSET");Object(Z.isFiniteNumber)(Be)&&(m.startTimeOffset=Be);break}case"MAP":{var ze=new R.AttrList(se);Y.relurl=ze.URI,ze.BYTERANGE&&Y.setByteRange(ze.BYTERANGE),Y.level=s,Y.sn="initSegment",ve&&(Y.levelkey=ve),Y.initSegment=null,D=Y,ke=!0;break}case"SERVER-CONTROL":{var Ge=new R.AttrList(se);m.canBlockReload=Ge.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=Ge.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&Ge.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=Ge.optionalFloat("PART-HOLD-BACK",0),m.holdBack=Ge.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ve=new R.AttrList(se);m.partTarget=Ve.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Re=m.partList;Re||(Re=m.partList=[]);var Qe=z>0?Re[Re.length-1]:void 0,$e=z++,Me=new K.Part(new R.AttrList(se),Y,f,$e,Qe);Re.push(Me),Y.duration+=Me.duration;break}case"PRELOAD-HINT":{var We=new R.AttrList(se);m.preloadHint=We;break}case"RENDITION-REPORT":{var Se=new R.AttrList(se);m.renditionReports=m.renditionReports||[],m.renditionReports.push(Se);break}default:y.logger.warn("line parsed but not handled: "+oe);break}}}N&&!N.relurl?(x.pop(),V-=N.duration,m.partList&&(m.fragmentHint=N)):m.partList&&(p(Y,N),Y.cc=M,m.fragmentHint=Y);var ye=x.length,xe=x[0],le=x[ye-1];if(V+=m.skippedSegments*m.targetduration,V>0&&ye&&le){m.averagetargetduration=V/ye;var ue=le.sn;m.endSN=ue!=="initSegment"?ue:0,xe&&(m.startCC=xe.cc,xe.initSegment||m.fragments.every(function(me){return me.relurl&&o(me.relurl)})&&(y.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),Y=new K.Fragment(a,f),Y.relurl=le.relurl,Y.level=s,Y.sn="initSegment",xe.initSegment=Y,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(V+=m.fragmentHint.duration),m.totalduration=V,m.endCC=M,Le>0&&v(x,Le),m},w}();function d(w,b){["video","audio","text"].forEach(function(u){var f=w.filter(function(a){return Object(A.isCodecType)(a,u)});if(f.length){var s=f.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});b[u+"Codec"]=s.length>0?s[0]:f[0],w=w.filter(function(a){return f.indexOf(a)===-1})}}),b.unknownCodecs=w}function S(w,b,u){var f=b[u];f&&(w[u]=f)}function v(w,b){for(var u=w[b],f=b;f--;){var s=w[f];if(!s)return;s.programDateTime=u.programDateTime-s.duration*1e3,u=s}}function p(w,b){w.rawProgramDateTime?w.programDateTime=Date.parse(w.rawProgramDateTime):b!=null&&b.programDateTime&&(w.programDateTime=b.endProgramDateTime),Object(Z.isFiniteNumber)(w.programDateTime)||(w.programDateTime=null,w.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(he,$,O){"use strict";O.r($);var Z=O("./src/polyfills/number.ts"),F=O("./src/events.ts"),I=O("./src/errors.ts"),K=O("./src/utils/logger.ts"),B=O("./src/utils/mp4-tools.ts"),P=O("./src/loader/m3u8-parser.ts"),R=O("./src/types/loader.ts"),y=O("./src/utils/attr-list.ts");function A(C){var E=C.type;switch(E){case R.PlaylistContextType.AUDIO_TRACK:return R.PlaylistLevelType.AUDIO;case R.PlaylistContextType.SUBTITLE_TRACK:return R.PlaylistLevelType.SUBTITLE;default:return R.PlaylistLevelType.MAIN}}function _(C,E){var h=C.url;return(h===void 0||h.indexOf("data:")===0)&&(h=E.url),h}var k=function(){function C(h){this.hls=void 0,this.loaders=Object.create(null),this.hls=h,this.registerListeners()}var E=C.prototype;return E.registerListeners=function(){var o=this.hls;o.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(F.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},E.unregisterListeners=function(){var o=this.hls;o.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(F.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},E.createInternalLoader=function(o){var l=this.hls.config,d=l.pLoader,S=l.loader,v=d||S,p=new v(l);return o.loader=p,this.loaders[o.type]=p,p},E.getInternalLoader=function(o){return this.loaders[o.type]},E.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},E.destroyInternalLoaders=function(){for(var o in this.loaders){var l=this.loaders[o];l&&l.destroy(),this.resetInternalLoader(o)}},E.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},E.onManifestLoading=function(o,l){var d=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:R.PlaylistContextType.MANIFEST,url:d,deliveryDirectives:null})},E.onLevelLoading=function(o,l){var d=l.id,S=l.level,v=l.url,p=l.deliveryDirectives;this.load({id:d,groupId:null,level:S,responseType:"text",type:R.PlaylistContextType.LEVEL,url:v,deliveryDirectives:p})},E.onAudioTrackLoading=function(o,l){var d=l.id,S=l.groupId,v=l.url,p=l.deliveryDirectives;this.load({id:d,groupId:S,level:null,responseType:"text",type:R.PlaylistContextType.AUDIO_TRACK,url:v,deliveryDirectives:p})},E.onSubtitleTrackLoading=function(o,l){var d=l.id,S=l.groupId,v=l.url,p=l.deliveryDirectives;this.load({id:d,groupId:S,level:null,responseType:"text",type:R.PlaylistContextType.SUBTITLE_TRACK,url:v,deliveryDirectives:p})},E.load=function(o){var l,d=this.hls.config,S=this.getInternalLoader(o);if(S){var v=S.context;if(v&&v.url===o.url){K.logger.trace("[playlist-loader]: playlist request ongoing");return}K.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),S.abort()}var p,w,b,u;switch(o.type){case R.PlaylistContextType.MANIFEST:p=d.manifestLoadingMaxRetry,w=d.manifestLoadingTimeOut,b=d.manifestLoadingRetryDelay,u=d.manifestLoadingMaxRetryTimeout;break;case R.PlaylistContextType.LEVEL:case R.PlaylistContextType.AUDIO_TRACK:case R.PlaylistContextType.SUBTITLE_TRACK:p=0,w=d.levelLoadingTimeOut;break;default:p=d.levelLoadingMaxRetry,w=d.levelLoadingTimeOut,b=d.levelLoadingRetryDelay,u=d.levelLoadingMaxRetryTimeout;break}if(S=this.createInternalLoader(o),(l=o.deliveryDirectives)!==null&&l!==void 0&&l.part){var f;if(o.type===R.PlaylistContextType.LEVEL&&o.level!==null?f=this.hls.levels[o.level].details:o.type===R.PlaylistContextType.AUDIO_TRACK&&o.id!==null?f=this.hls.audioTracks[o.id].details:o.type===R.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(f=this.hls.subtitleTracks[o.id].details),f){var s=f.partTarget,a=f.targetduration;s&&a&&(w=Math.min(Math.max(s*3,a*.8)*1e3,w))}}var T={timeout:w,maxRetry:p,retryDelay:b,maxRetryDelay:u,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};S.load(o,T,m)},E.loadsuccess=function(o,l,d,S){if(S===void 0&&(S=null),d.isSidxRequest){this.handleSidxRequest(o,d),this.handlePlaylistLoaded(o,l,d,S);return}this.resetInternalLoader(d.type);var v=o.data;if(v.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,d,"no EXTM3U delimiter",S);return}l.parsing.start=performance.now(),v.indexOf("#EXTINF:")>0||v.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,l,d,S):this.handleMasterPlaylist(o,l,d,S)},E.loaderror=function(o,l,d){d===void 0&&(d=null),this.handleNetworkError(l,d,!1,o)},E.loadtimeout=function(o,l,d){d===void 0&&(d=null),this.handleNetworkError(l,d,!0)},E.handleMasterPlaylist=function(o,l,d,S){var v=this.hls,p=o.data,w=_(o,d),b=P.default.parseMasterPlaylist(p,w),u=b.levels,f=b.sessionData;if(!u.length){this.handleManifestParsingError(o,d,"no level found in manifest",S);return}var s=u.map(function(j){return{id:j.attrs.AUDIO,audioCodec:j.audioCodec}}),a=u.map(function(j){return{id:j.attrs.SUBTITLES,textCodec:j.textCodec}}),T=P.default.parseMasterPlaylistMedia(p,w,"AUDIO",s),m=P.default.parseMasterPlaylistMedia(p,w,"SUBTITLES",a),x=P.default.parseMasterPlaylistMedia(p,w,"CLOSED-CAPTIONS");if(T.length){var D=T.some(function(j){return!j.url});!D&&u[0].audioCodec&&!u[0].attrs.AUDIO&&(K.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),T.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new y.AttrList({}),bitrate:0,url:""}))}v.trigger(F.Events.MANIFEST_LOADED,{levels:u,audioTracks:T,subtitles:m,captions:x,url:w,stats:l,networkDetails:S,sessionData:f})},E.handleTrackOrLevelPlaylist=function(o,l,d,S){var v=this.hls,p=d.id,w=d.level,b=d.type,u=_(o,d),f=Object(Z.isFiniteNumber)(p)?p:0,s=Object(Z.isFiniteNumber)(w)?w:f,a=A(d),T=P.default.parseLevelPlaylist(o.data,u,s,a,f);if(!T.fragments.length){v.trigger(F.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:u,reason:"no fragments found in level",level:typeof d.level=="number"?d.level:void 0});return}if(b===R.PlaylistContextType.MANIFEST){var m={attrs:new y.AttrList({}),bitrate:0,details:T,name:"",url:u};v.trigger(F.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:u,stats:l,networkDetails:S,sessionData:null})}if(l.parsing.end=performance.now(),T.needSidxRanges){var x,D=(x=T.fragments[0].initSegment)===null||x===void 0?void 0:x.url;this.load({url:D,isSidxRequest:!0,type:b,level:w,levelDetails:T,id:p,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}d.levelDetails=T,this.handlePlaylistLoaded(o,l,d,S)},E.handleSidxRequest=function(o,l){var d=Object(B.parseSegmentIndex)(new Uint8Array(o.data));if(!d)return;var S=d.references,v=l.levelDetails;S.forEach(function(p,w){var b=p.info,u=v.fragments[w];u.byteRange.length===0&&u.setByteRange(String(1+b.end-b.start)+"@"+String(b.start)),u.initSegment&&u.initSegment.setByteRange(String(d.moovEndOffset)+"@0")})},E.handleManifestParsingError=function(o,l,d,S){this.hls.trigger(F.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===R.PlaylistContextType.MANIFEST,url:o.url,reason:d,response:o,context:l,networkDetails:S})},E.handleNetworkError=function(o,l,d,S){d===void 0&&(d=!1),K.logger.warn("[playlist-loader]: A network "+(d?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var v=I.ErrorDetails.UNKNOWN,p=!1,w=this.getInternalLoader(o);switch(o.type){case R.PlaylistContextType.MANIFEST:v=d?I.ErrorDetails.MANIFEST_LOAD_TIMEOUT:I.ErrorDetails.MANIFEST_LOAD_ERROR,p=!0;break;case R.PlaylistContextType.LEVEL:v=d?I.ErrorDetails.LEVEL_LOAD_TIMEOUT:I.ErrorDetails.LEVEL_LOAD_ERROR,p=!1;break;case R.PlaylistContextType.AUDIO_TRACK:v=d?I.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,p=!1;break;case R.PlaylistContextType.SUBTITLE_TRACK:v=d?I.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:I.ErrorDetails.SUBTITLE_LOAD_ERROR,p=!1;break}w&&this.resetInternalLoader(o.type);var b={type:I.ErrorTypes.NETWORK_ERROR,details:v,fatal:p,url:o.url,loader:w,context:o,networkDetails:l};S&&(b.response=S),this.hls.trigger(F.Events.ERROR,b)},E.handlePlaylistLoaded=function(o,l,d,S){var v=d.type,p=d.level,w=d.id,b=d.groupId,u=d.loader,f=d.levelDetails,s=d.deliveryDirectives;if(!(f!=null&&f.targetduration)){this.handleManifestParsingError(o,d,"invalid target duration",S);return}if(!u)return;f.live&&(u.getCacheAge&&(f.ageHeader=u.getCacheAge()||0),(!u.getCacheAge||isNaN(f.ageHeader))&&(f.ageHeader=0));switch(v){case R.PlaylistContextType.MANIFEST:case R.PlaylistContextType.LEVEL:this.hls.trigger(F.Events.LEVEL_LOADED,{details:f,level:p||0,id:w||0,stats:l,networkDetails:S,deliveryDirectives:s});break;case R.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(F.Events.AUDIO_TRACK_LOADED,{details:f,id:w||0,groupId:b||"",stats:l,networkDetails:S,deliveryDirectives:s});break;case R.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(F.Events.SUBTITLE_TRACK_LOADED,{details:f,id:w||0,groupId:b||"",stats:l,networkDetails:S,deliveryDirectives:s});break}},C}();$.default=k},"./src/polyfills/number.ts":function(he,$,O){"use strict";O.r($),O.d($,"isFiniteNumber",function(){return Z}),O.d($,"MAX_SAFE_INTEGER",function(){return F});var Z=Number.isFinite||function(I){return typeof I=="number"&&isFinite(I)},F=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(he,$,O){"use strict";O.r($);var Z=function(){function F(){}return F.getSilentFrame=function(K,B){switch(K){case"mp4a.40.2":if(B===1)return new Uint8Array([0,200,0,128,35,128]);if(B===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(B===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(B===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(B===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(B===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(B===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(B===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(B===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},F}();$.default=Z},"./src/remux/mp4-generator.ts":function(he,$,O){"use strict";O.r($);var Z=Math.pow(2,32)-1,F=function(){function I(){}return I.init=function(){I.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var B;for(B in I.types)I.types.hasOwnProperty(B)&&(I.types[B]=[B.charCodeAt(0),B.charCodeAt(1),B.charCodeAt(2),B.charCodeAt(3)]);var P=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),R=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);I.HDLR_TYPES={video:P,audio:R};var y=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),A=new Uint8Array([0,0,0,0,0,0,0,0]);I.STTS=I.STSC=I.STCO=A,I.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),I.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),I.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),I.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var _=new Uint8Array([105,115,111,109]),k=new Uint8Array([97,118,99,49]),C=new Uint8Array([0,0,0,1]);I.FTYP=I.box(I.types.ftyp,_,C,_,k),I.DINF=I.box(I.types.dinf,I.box(I.types.dref,y))},I.box=function(B){for(var P=8,R=arguments.length,y=new Array(R>1?R-1:0),A=1;A<R;A++)y[A-1]=arguments[A];for(var _=y.length,k=_;_--;)P+=y[_].byteLength;var C=new Uint8Array(P);for(C[0]=P>>24&255,C[1]=P>>16&255,C[2]=P>>8&255,C[3]=P&255,C.set(B,4),_=0,P=8;_<k;_++)C.set(y[_],P),P+=y[_].byteLength;return C},I.hdlr=function(B){return I.box(I.types.hdlr,I.HDLR_TYPES[B])},I.mdat=function(B){return I.box(I.types.mdat,B)},I.mdhd=function(B,P){P*=B;var R=Math.floor(P/(Z+1)),y=Math.floor(P%(Z+1));return I.box(I.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,B>>24&255,B>>16&255,B>>8&255,B&255,R>>24,R>>16&255,R>>8&255,R&255,y>>24,y>>16&255,y>>8&255,y&255,85,196,0,0]))},I.mdia=function(B){return I.box(I.types.mdia,I.mdhd(B.timescale,B.duration),I.hdlr(B.type),I.minf(B))},I.mfhd=function(B){return I.box(I.types.mfhd,new Uint8Array([0,0,0,0,B>>24,B>>16&255,B>>8&255,B&255]))},I.minf=function(B){return B.type==="audio"?I.box(I.types.minf,I.box(I.types.smhd,I.SMHD),I.DINF,I.stbl(B)):I.box(I.types.minf,I.box(I.types.vmhd,I.VMHD),I.DINF,I.stbl(B))},I.moof=function(B,P,R){return I.box(I.types.moof,I.mfhd(B),I.traf(R,P))},I.moov=function(B){for(var P=B.length,R=[];P--;)R[P]=I.trak(B[P]);return I.box.apply(null,[I.types.moov,I.mvhd(B[0].timescale,B[0].duration)].concat(R).concat(I.mvex(B)))},I.mvex=function(B){for(var P=B.length,R=[];P--;)R[P]=I.trex(B[P]);return I.box.apply(null,[I.types.mvex].concat(R))},I.mvhd=function(B,P){P*=B;var R=Math.floor(P/(Z+1)),y=Math.floor(P%(Z+1)),A=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,B>>24&255,B>>16&255,B>>8&255,B&255,R>>24,R>>16&255,R>>8&255,R&255,y>>24,y>>16&255,y>>8&255,y&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return I.box(I.types.mvhd,A)},I.sdtp=function(B){var P=B.samples||[],R=new Uint8Array(4+P.length),y,A;for(y=0;y<P.length;y++)A=P[y].flags,R[y+4]=A.dependsOn<<4|A.isDependedOn<<2|A.hasRedundancy;return I.box(I.types.sdtp,R)},I.stbl=function(B){return I.box(I.types.stbl,I.stsd(B),I.box(I.types.stts,I.STTS),I.box(I.types.stsc,I.STSC),I.box(I.types.stsz,I.STSZ),I.box(I.types.stco,I.STCO))},I.avc1=function(B){var P=[],R=[],y,A,_;for(y=0;y<B.sps.length;y++)A=B.sps[y],_=A.byteLength,P.push(_>>>8&255),P.push(_&255),P=P.concat(Array.prototype.slice.call(A));for(y=0;y<B.pps.length;y++)A=B.pps[y],_=A.byteLength,R.push(_>>>8&255),R.push(_&255),R=R.concat(Array.prototype.slice.call(A));var k=I.box(I.types.avcC,new Uint8Array([1,P[3],P[4],P[5],252|3,224|B.sps.length].concat(P).concat([B.pps.length]).concat(R))),C=B.width,E=B.height,h=B.pixelRatio[0],o=B.pixelRatio[1];return I.box(I.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,C>>8&255,C&255,E>>8&255,E&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]),k,I.box(I.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),I.box(I.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,o>>24,o>>16&255,o>>8&255,o&255])))},I.esds=function(B){var P=B.config.length;return new Uint8Array([0,0,0,0,3,23+P,0,1,0,4,15+P,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([P]).concat(B.config).concat([6,1,2]))},I.mp4a=function(B){var P=B.samplerate;return I.box(I.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,B.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]),I.box(I.types.esds,I.esds(B)))},I.mp3=function(B){var P=B.samplerate;return I.box(I.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,B.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]))},I.stsd=function(B){return B.type==="audio"?!B.isAAC&&B.codec==="mp3"?I.box(I.types.stsd,I.STSD,I.mp3(B)):I.box(I.types.stsd,I.STSD,I.mp4a(B)):I.box(I.types.stsd,I.STSD,I.avc1(B))},I.tkhd=function(B){var P=B.id,R=B.duration*B.timescale,y=B.width,A=B.height,_=Math.floor(R/(Z+1)),k=Math.floor(R%(Z+1));return I.box(I.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,P>>24&255,P>>16&255,P>>8&255,P&255,0,0,0,0,_>>24,_>>16&255,_>>8&255,_&255,k>>24,k>>16&255,k>>8&255,k&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,y>>8&255,y&255,0,0,A>>8&255,A&255,0,0]))},I.traf=function(B,P){var R=I.sdtp(B),y=B.id,A=Math.floor(P/(Z+1)),_=Math.floor(P%(Z+1));return I.box(I.types.traf,I.box(I.types.tfhd,new Uint8Array([0,0,0,0,y>>24,y>>16&255,y>>8&255,y&255])),I.box(I.types.tfdt,new Uint8Array([1,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,_>>24,_>>16&255,_>>8&255,_&255])),I.trun(B,R.length+16+20+8+16+8+8),R)},I.trak=function(B){return B.duration=B.duration||4294967295,I.box(I.types.trak,I.tkhd(B),I.mdia(B))},I.trex=function(B){var P=B.id;return I.box(I.types.trex,new Uint8Array([0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},I.trun=function(B,P){var R=B.samples||[],y=R.length,A=12+16*y,_=new Uint8Array(A),k,C,E,h,o,l;for(P+=8+A,_.set([0,0,15,1,y>>>24&255,y>>>16&255,y>>>8&255,y&255,P>>>24&255,P>>>16&255,P>>>8&255,P&255],0),k=0;k<y;k++)C=R[k],E=C.duration,h=C.size,o=C.flags,l=C.cts,_.set([E>>>24&255,E>>>16&255,E>>>8&255,E&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*k);return I.box(I.types.trun,_)},I.initSegment=function(B){I.types||I.init();var P=I.moov(B),R=new Uint8Array(I.FTYP.byteLength+P.byteLength);return R.set(I.FTYP),R.set(P,I.FTYP.byteLength),R},I}();F.types=void 0,F.HDLR_TYPES=void 0,F.STTS=void 0,F.STSC=void 0,F.STCO=void 0,F.STSZ=void 0,F.VMHD=void 0,F.SMHD=void 0,F.STSD=void 0,F.FTYP=void 0,F.DINF=void 0,$.default=F},"./src/remux/mp4-remuxer.ts":function(he,$,O){"use strict";O.r($),O.d($,"default",function(){return l}),O.d($,"normalizePts",function(){return d});var Z=O("./src/polyfills/number.ts"),F=O("./src/remux/aac-helper.ts"),I=O("./src/remux/mp4-generator.ts"),K=O("./src/events.ts"),B=O("./src/errors.ts"),P=O("./src/utils/logger.ts"),R=O("./src/types/loader.ts"),y=O("./src/utils/timescale-conversion.ts");function A(){return A=Object.assign||function(w){for(var b=1;b<arguments.length;b++){var u=arguments[b];for(var f in u)Object.prototype.hasOwnProperty.call(u,f)&&(w[f]=u[f])}return w},A.apply(this,arguments)}var _=10*1e3,k=1024,C=1152,E=null,h=null,o=!1,l=function(){function w(u,f,s,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=u,this.config=f,this.typeSupported=s,this.ISGenerated=!1,E===null){var T=navigator.userAgent||"",m=T.match(/Chrome\/(\d+)/i);E=m?parseInt(m[1]):0}if(h===null){var x=navigator.userAgent.match(/Safari\/(\d+)/i);h=x?parseInt(x[1]):0}o=!!E&&E<75||!!h&&h<600}var b=w.prototype;return b.destroy=function(){},b.resetTimeStamp=function(f){P.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=f},b.resetNextTimestamp=function(){P.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},b.resetInitSegment=function(){P.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},b.getVideoStartPts=function(f){var s=!1,a=f.reduce(function(T,m){var x=m.pts-T;return x<-4294967296?(s=!0,d(T,m.pts)):x>0?T:m.pts},f[0].pts);return s&&P.logger.debug("PTS rollover detected"),a},b.remux=function(f,s,a,T,m,x,D,j){var z,V,M,N,Y,oe,pe=m,ve=m,Le=f.pid>-1,ke=s.pid>-1,ce=s.samples.length,ae=f.samples.length>0,de=ce>1,ne=(!Le||ae)&&(!ke||de)||this.ISGenerated||D;if(ne){this.ISGenerated||(M=this.generateIS(f,s,m));var se=this.isVideoContiguous,J=-1;if(de&&(J=S(s.samples),!se&&this.config.forceKeyFrameOnDiscontinuity))if(oe=!0,J>0){P.logger.warn("[mp4-remuxer]: Dropped "+J+" out of "+ce+" video samples due to a missing keyframe");var ee=this.getVideoStartPts(s.samples);s.samples=s.samples.slice(J),s.dropped+=J,ve+=(s.samples[0].pts-ee)/(s.timescale||9e4)}else J===-1&&(P.logger.warn("[mp4-remuxer]: No keyframe found out of "+ce+" video samples"),oe=!1);if(this.ISGenerated){if(ae&&de){var ie=this.getVideoStartPts(s.samples),fe=d(f.samples[0].pts,ie)-ie,Ae=fe/s.inputTimeScale;pe+=Math.max(0,Ae),ve+=Math.max(0,-Ae)}if(ae){if(f.samplerate||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),M=this.generateIS(f,s,m)),V=this.remuxAudio(f,pe,this.isAudioContiguous,x,ke||de||j===R.PlaylistLevelType.AUDIO?ve:void 0),de){var ge=V?V.endPTS-V.startPTS:0;s.inputTimeScale||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),M=this.generateIS(f,s,m)),z=this.remuxVideo(s,ve,se,ge)}}else de&&(z=this.remuxVideo(s,ve,se,0));z&&(z.firstKeyFrame=J,z.independent=J!==-1)}}return this.ISGenerated&&(a.samples.length&&(Y=this.remuxID3(a,m)),T.samples.length&&(N=this.remuxText(T,m))),{audio:V,video:z,initSegment:M,independent:oe,text:N,id3:Y}},b.generateIS=function(f,s,a){var T=f.samples,m=s.samples,x=this.typeSupported,D={},j=!Object(Z.isFiniteNumber)(this._initPTS),z="audio/mp4",V,M,N;if(j&&(V=M=Infinity),f.config&&T.length&&(f.timescale=f.samplerate,f.isAAC||(x.mpeg?(z="audio/mpeg",f.codec=""):x.mp3&&(f.codec="mp3")),D.audio={id:"audio",container:z,codec:f.codec,initSegment:!f.isAAC&&x.mpeg?new Uint8Array(0):I.default.initSegment([f]),metadata:{channelCount:f.channelCount}},j&&(N=f.inputTimeScale,V=M=T[0].pts-Math.round(N*a))),s.sps&&s.pps&&m.length&&(s.timescale=s.inputTimeScale,D.video={id:"main",container:"video/mp4",codec:s.codec,initSegment:I.default.initSegment([s]),metadata:{width:s.width,height:s.height}},j)){N=s.inputTimeScale;var Y=this.getVideoStartPts(m),oe=Math.round(N*a);M=Math.min(M,d(m[0].dts,Y)-oe),V=Math.min(V,Y-oe)}if(Object.keys(D).length)return this.ISGenerated=!0,j&&(this._initPTS=V,this._initDTS=M),{tracks:D,initPTS:V,timescale:N}},b.remuxVideo=function(f,s,a,T){var m=f.inputTimeScale,x=f.samples,D=[],j=x.length,z=this._initPTS,V=this.nextAvcDts,M=8,N,Y,oe,pe=Number.POSITIVE_INFINITY,ve=Number.NEGATIVE_INFINITY,Le=0,ke=!1;if(!a||V===null){var ce=s*m,ae=x[0].pts-d(x[0].dts,x[0].pts);V=ce-ae}for(var de=0;de<j;de++){var ne=x[de];if(ne.pts=d(ne.pts-z,V),ne.dts=d(ne.dts-z,V),ne.dts>ne.pts){var se=9e4*.2;Le=Math.max(Math.min(Le,ne.pts-ne.dts),-1*se)}ne.dts<x[de>0?de-1:de].dts&&(ke=!0)}ke&&x.sort(function(xt,Ct){var st=xt.dts-Ct.dts,Mt=xt.pts-Ct.pts;return st||Mt}),Y=x[0].dts,oe=x[x.length-1].dts;var J=Math.round((oe-Y)/(j-1));if(Le<0){if(Le<J*-2){P.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(y.toMsFromMpegTsClock)(-J,!0)+" ms");for(var ee=Le,ie=0;ie<j;ie++)x[ie].dts=ee=Math.max(ee,x[ie].pts-J),x[ie].pts=Math.max(ee,x[ie].pts)}else{P.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(y.toMsFromMpegTsClock)(Le,!0)+" ms to overcome this issue");for(var fe=0;fe<j;fe++)x[fe].dts=x[fe].dts+Le}Y=x[0].dts}if(a){var Ae=Y-V,ge=Ae>J,Oe=Ae<-1;if(ge||Oe){ge?P.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(Ae,!0)+" ms ("+Ae+"dts) hole between fragments detected, filling it"):P.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(-Ae,!0)+" ms ("+Ae+"dts) overlapping between fragments detected"),Y=V;var Pe=x[0].pts-Ae;x[0].dts=Y,x[0].pts=Pe,P.logger.log("Video: First PTS/DTS adjusted: "+Object(y.toMsFromMpegTsClock)(Pe,!0)+"/"+Object(y.toMsFromMpegTsClock)(Y,!0)+", delta: "+Object(y.toMsFromMpegTsClock)(Ae,!0)+" ms")}}o&&(Y=Math.max(0,Y));for(var je=0,Ke=0,He=0;He<j;He++){for(var Fe=x[He],qe=Fe.units,De=qe.length,Ne=0,Be=0;Be<De;Be++)Ne+=qe[Be].data.length;Ke+=Ne,je+=De,Fe.length=Ne,Fe.dts=Math.max(Fe.dts,Y),Fe.pts=Math.max(Fe.pts,Fe.dts,0),pe=Math.min(Fe.pts,pe),ve=Math.max(Fe.pts,ve)}oe=x[j-1].dts;var ze=Ke+4*je+8,Ge;try{Ge=new Uint8Array(ze)}catch(xt){this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:B.ErrorTypes.MUX_ERROR,details:B.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ze,reason:"fail allocating video mdat "+ze});return}var Ve=new DataView(Ge.buffer);Ve.setUint32(0,ze),Ge.set(I.default.types.mdat,4);for(var Re=0;Re<j;Re++){for(var Qe=x[Re],$e=Qe.units,Me=0,We=0,Se=$e.length;We<Se;We++){var ye=$e[We],xe=ye.data,le=ye.data.byteLength;Ve.setUint32(M,le),M+=4,Ge.set(xe,M),M+=le,Me+=4+le}if(Re<j-1)N=x[Re+1].dts-Qe.dts;else{var ue=this.config,me=Qe.dts-x[Re>0?Re-1:Re].dts;if(ue.stretchShortVideoTrack&&this.nextAudioPts!==null){var Ee=Math.floor(ue.maxBufferHole*m),we=(T?pe+T*m:this.nextAudioPts)-Qe.pts;we>Ee?(N=we-me,N<0&&(N=me),P.logger.log("[mp4-remuxer]: It is approximately "+we/90+" ms to the next segment; using duration "+N/90+" ms for the last video frame.")):N=me}else N=me}var Ie=Math.round(Qe.pts-Qe.dts);D.push(new v(Qe.key,N,Me,Ie))}if(D.length&&E&&E<70){var Ze=D[0].flags;Ze.dependsOn=2,Ze.isNonSync=0}console.assert(N!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=oe+N,this.isVideoContiguous=!0;var at=I.default.moof(f.sequenceNumber++,Y,A({},f,{samples:D})),ht="video",ut={data1:at,data2:Ge,startPTS:pe/m,endPTS:(ve+N)/m,startDTS:Y/m,endDTS:V/m,type:ht,hasAudio:!1,hasVideo:!0,nb:D.length,dropped:f.dropped};return f.samples=[],f.dropped=0,console.assert(Ge.length,"MDAT length must not be zero"),ut},b.remuxAudio=function(f,s,a,T,m){var x=f.inputTimeScale,D=f.samplerate?f.samplerate:x,j=x/D,z=f.isAAC?k:C,V=z*j,M=this._initPTS,N=!f.isAAC&&this.typeSupported.mpeg,Y=[],oe=f.samples,pe=N?0:8,ve=this.nextAudioPts||-1,Le=s*x;if(this.isAudioContiguous=a=a||oe.length&&ve>0&&(T&&Math.abs(Le-ve)<9e3||Math.abs(d(oe[0].pts-M,Le)-ve)<20*V),oe.forEach(function(xe){xe.pts=d(xe.pts-M,Le)}),!a||ve<0){if(oe=oe.filter(function(xe){return xe.pts>=0}),!oe.length)return;m===0?ve=0:T?ve=Math.max(0,Le):ve=oe[0].pts}if(f.isAAC)for(var ke=m!==void 0,ce=this.config.maxAudioFramesDrift,ae=0,de=ve;ae<oe.length;ae++){var ne=oe[ae],se=ne.pts,J=se-de,ee=Math.abs(1e3*J/x);if(J<=-ce*V&&ke)ae===0&&(P.logger.warn("Audio frame @ "+(se/x).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*J/x)+" ms."),this.nextAudioPts=ve=de=se);else if(J>=ce*V&&ee<_&&ke){var ie=Math.round(J/V);de=se-ie*V,de<0&&(ie--,de+=V),ae===0&&(this.nextAudioPts=ve=de),P.logger.warn("[mp4-remuxer]: Injecting "+ie+" audio frame @ "+(de/x).toFixed(3)+"s due to "+Math.round(1e3*J/x)+" ms gap.");for(var fe=0;fe<ie;fe++){var Ae=Math.max(de,0),ge=F.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);ge||(P.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ge=ne.unit.subarray()),oe.splice(ae,0,{unit:ge,pts:Ae}),de+=V,ae++}}ne.pts=de,de+=V}for(var Oe=null,Pe=null,je,Ke=0,He=oe.length;He--;)Ke+=oe[He].unit.byteLength;for(var Fe=0,qe=oe.length;Fe<qe;Fe++){var De=oe[Fe],Ne=De.unit,Be=De.pts;if(Pe!==null){var ze=Y[Fe-1];ze.duration=Math.round((Be-Pe)/j)}else if(a&&f.isAAC&&(Be=ve),Oe=Be,Ke>0){Ke+=pe;try{je=new Uint8Array(Ke)}catch(xe){this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:B.ErrorTypes.MUX_ERROR,details:B.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ke,reason:"fail allocating audio mdat "+Ke});return}if(!N){var Ge=new DataView(je.buffer);Ge.setUint32(0,Ke),je.set(I.default.types.mdat,4)}}else return;je.set(Ne,pe);var Ve=Ne.byteLength;pe+=Ve,Y.push(new v(!0,z,Ve,0)),Pe=Be}var Re=Y.length;if(!Re)return;var Qe=Y[Y.length-1];this.nextAudioPts=ve=Pe+j*Qe.duration;var $e=N?new Uint8Array(0):I.default.moof(f.sequenceNumber++,Oe/j,A({},f,{samples:Y}));f.samples=[];var Me=Oe/x,We=ve/x,Se="audio",ye={data1:$e,data2:je,startPTS:Me,endPTS:We,startDTS:Me,endDTS:We,type:Se,hasAudio:!0,hasVideo:!1,nb:Re};return this.isAudioContiguous=!0,console.assert(je.length,"MDAT length must not be zero"),ye},b.remuxEmptyAudio=function(f,s,a,T){var m=f.inputTimeScale,x=f.samplerate?f.samplerate:m,D=m/x,j=this.nextAudioPts,z=(j!==null?j:T.startDTS*m)+this._initDTS,V=T.endDTS*m+this._initDTS,M=D*k,N=Math.ceil((V-z)/M),Y=F.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);if(P.logger.warn("[mp4-remuxer]: remux empty Audio"),!Y){P.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var oe=[],pe=0;pe<N;pe++){var ve=z+pe*M;oe.push({unit:Y,pts:ve,dts:ve})}return f.samples=oe,this.remuxAudio(f,s,a,!1)},b.remuxID3=function(f,s){var a=f.samples.length;if(!a)return;for(var T=f.inputTimeScale,m=this._initPTS,x=this._initDTS,D=0;D<a;D++){var j=f.samples[D];j.pts=d(j.pts-m,s*T)/T,j.dts=d(j.dts-x,s*T)/T}var z=f.samples;return f.samples=[],{samples:z}},b.remuxText=function(f,s){var a=f.samples.length;if(!a)return;for(var T=f.inputTimeScale,m=this._initPTS,x=0;x<a;x++){var D=f.samples[x];D.pts=d(D.pts-m,s*T)/T}f.samples.sort(function(z,V){return z.pts-V.pts});var j=f.samples;return f.samples=[],{samples:j}},w}();function d(w,b){var u;if(b===null)return w;for(b<w?u=-8589934592:u=8589934592;Math.abs(w-b)>4294967296;)w+=u;return w}function S(w){for(var b=0;b<w.length;b++)if(w[b].key)return b;return-1}var v=function(b,u,f,s){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=u,this.size=f,this.cts=s,this.flags=new p(b)},p=function(b){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=b?2:1,this.isNonSync=b?0:1}},"./src/remux/passthrough-remuxer.ts":function(he,$,O){"use strict";O.r($);var Z=O("./src/polyfills/number.ts"),F=O("./src/utils/mp4-tools.ts"),I=O("./src/loader/fragment.ts"),K=O("./src/utils/logger.ts"),B=function(){function y(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var A=y.prototype;return A.destroy=function(){},A.resetTimeStamp=function(k){this.initPTS=k,this.lastEndDTS=null},A.resetNextTimestamp=function(){this.lastEndDTS=null},A.resetInitSegment=function(k,C,E){this.audioCodec=C,this.videoCodec=E,this.generateInitSegment(k),this.emitInitSegment=!0},A.generateInitSegment=function(k){var C=this.audioCodec,E=this.videoCodec;if(!k||!k.byteLength){this.initTracks=void 0,this.initData=void 0;return}var h=this.initData=Object(F.parseInitSegment)(k);C||(C=R(h.audio,I.ElementaryStreamTypes.AUDIO)),E||(E=R(h.video,I.ElementaryStreamTypes.VIDEO));var o={};h.audio&&h.video?o.audiovideo={container:"video/mp4",codec:C+","+E,initSegment:k,id:"main"}:h.audio?o.audio={container:"audio/mp4",codec:C,initSegment:k,id:"audio"}:h.video?o.video={container:"video/mp4",codec:E,initSegment:k,id:"main"}:K.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},A.remux=function(k,C,E,h,o){var l=this.initPTS,d=this.lastEndDTS,S={audio:void 0,video:void 0,text:h,id3:E,initSegment:void 0};Object(Z.isFiniteNumber)(d)||(d=this.lastEndDTS=o||0);var v=C.samples;if(!v||!v.length)return S;var p={initPTS:void 0,timescale:1},w=this.initData;if((!w||!w.length)&&(this.generateInitSegment(v),w=this.initData),!w||!w.length)return K.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),S;this.emitInitSegment&&(p.tracks=this.initTracks,this.emitInitSegment=!1),Object(Z.isFiniteNumber)(l)||(this.initPTS=p.initPTS=l=P(w,v,d));var b=Object(F.getDuration)(v,w),u=d,f=b+u;Object(F.offsetStartDTS)(w,v,l),b>0?this.lastEndDTS=f:(K.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var s=!!w.audio,a=!!w.video,T="";s&&(T+="audio"),a&&(T+="video");var m={data1:v,startPTS:u,startDTS:u,endPTS:f,endDTS:f,type:T,hasAudio:s,hasVideo:a,nb:1,dropped:0};return S.audio=m.type==="audio"?m:void 0,S.video=m.type!=="audio"?m:void 0,S.text=h,S.id3=E,S.initSegment=p,S},y}(),P=function(A,_,k){return Object(F.getStartDTS)(A,_)-k};function R(y,A){var _=y==null?void 0:y.codec;return _&&_.length>4?_:_==="hvc1"?"hvc1.1.c.L120.90":_==="av01"?"av01.0.04M.08":_==="avc1"||A===I.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}$.default=B},"./src/task-loop.ts":function(he,$,O){"use strict";O.r($),O.d($,"default",function(){return Z});var Z=function(){function F(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var I=F.prototype;return I.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},I.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},I.onHandlerDestroyed=function(){},I.hasInterval=function(){return!!this._tickInterval},I.hasNextTick=function(){return!!this._tickTimer},I.setInterval=function(B){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,B),!0)},I.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},I.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},I.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},I.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},I.doTick=function(){},F}()},"./src/types/cmcd.ts":function(he,$,O){"use strict";O.r($),O.d($,"CMCDVersion",function(){return Z}),O.d($,"CMCDObjectType",function(){return F}),O.d($,"CMCDStreamingFormat",function(){return I}),O.d($,"CMCDStreamType",function(){return K});var Z=1,F;(function(B){B.MANIFEST="m",B.AUDIO="a",B.VIDEO="v",B.MUXED="av",B.INIT="i",B.CAPTION="c",B.TIMED_TEXT="tt",B.KEY="k",B.OTHER="o"})(F||(F={}));var I;(function(B){B.DASH="d",B.HLS="h",B.SMOOTH="s",B.OTHER="o"})(I||(I={}));var K;(function(B){B.VOD="v",B.LIVE="l"})(K||(K={}))},"./src/types/level.ts":function(he,$,O){"use strict";O.r($),O.d($,"HlsSkip",function(){return I}),O.d($,"getSkipValue",function(){return K}),O.d($,"HlsUrlParameters",function(){return B}),O.d($,"Level",function(){return P});function Z(R,y){for(var A=0;A<y.length;A++){var _=y[A];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(R,_.key,_)}}function F(R,y,A){return y&&Z(R.prototype,y),A&&Z(R,A),R}var I;(function(R){R.No="",R.Yes="YES",R.v2="v2"})(I||(I={}));function K(R,y){var A=R.canSkipUntil,_=R.canSkipDateRanges,k=R.endSN,C=y!==void 0?y-k:0;return A&&C<A?_?I.v2:I.Yes:I.No}var B=function(){function R(A,_,k){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=A,this.part=_,this.skip=k}var y=R.prototype;return y.addDirectives=function(_){var k=new self.URL(_);return this.msn!==void 0&&k.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&k.searchParams.set("_HLS_part",this.part.toString()),this.skip&&k.searchParams.set("_HLS_skip",this.skip),k.toString()},R}(),P=function(){function R(y){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[y.url],this.attrs=y.attrs,this.bitrate=y.bitrate,y.details&&(this.details=y.details),this.id=y.id||0,this.name=y.name,this.width=y.width||0,this.height=y.height||0,this.audioCodec=y.audioCodec,this.videoCodec=y.videoCodec,this.unknownCodecs=y.unknownCodecs,this.codecSet=[y.videoCodec,y.audioCodec].filter(function(A){return A}).join(",").replace(/\.[^.,]+/g,"")}return F(R,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(A){var _=A%this.url.length;this._urlId!==_&&(this.details=void 0,this._urlId=_)}}]),R}()},"./src/types/loader.ts":function(he,$,O){"use strict";O.r($),O.d($,"PlaylistContextType",function(){return Z}),O.d($,"PlaylistLevelType",function(){return F});var Z;(function(I){I.MANIFEST="manifest",I.LEVEL="level",I.AUDIO_TRACK="audioTrack",I.SUBTITLE_TRACK="subtitleTrack"})(Z||(Z={}));var F;(function(I){I.MAIN="main",I.AUDIO="audio",I.SUBTITLE="subtitle"})(F||(F={}))},"./src/types/transmuxer.ts":function(he,$,O){"use strict";O.r($),O.d($,"ChunkMetadata",function(){return Z});var Z=function(K,B,P,R,y,A){R===void 0&&(R=0),y===void 0&&(y=-1),A===void 0&&(A=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=F(),this.buffering={audio:F(),video:F(),audiovideo:F()},this.level=K,this.sn=B,this.id=P,this.size=R,this.part=y,this.partial=A};function F(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(he,$,O){"use strict";O.r($),O.d($,"AttrList",function(){return I});var Z=/^(\d+)x(\d+)$/,F=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,I=function(){function K(P){typeof P=="string"&&(P=K.parseAttrList(P));for(var R in P)P.hasOwnProperty(R)&&(this[R]=P[R])}var B=K.prototype;return B.decimalInteger=function(R){var y=parseInt(this[R],10);return y>Number.MAX_SAFE_INTEGER?Infinity:y},B.hexadecimalInteger=function(R){if(this[R]){var y=(this[R]||"0x").slice(2);y=(y.length&1?"0":"")+y;for(var A=new Uint8Array(y.length/2),_=0;_<y.length/2;_++)A[_]=parseInt(y.slice(_*2,_*2+2),16);return A}else return null},B.hexadecimalIntegerAsNumber=function(R){var y=parseInt(this[R],16);return y>Number.MAX_SAFE_INTEGER?Infinity:y},B.decimalFloatingPoint=function(R){return parseFloat(this[R])},B.optionalFloat=function(R,y){var A=this[R];return A?parseFloat(A):y},B.enumeratedString=function(R){return this[R]},B.bool=function(R){return this[R]==="YES"},B.decimalResolution=function(R){var y=Z.exec(this[R]);return y===null?void 0:{width:parseInt(y[1],10),height:parseInt(y[2],10)}},K.parseAttrList=function(R){var y,A={},_='"';for(F.lastIndex=0;(y=F.exec(R))!==null;){var k=y[2];k.indexOf(_)===0&&k.lastIndexOf(_)===k.length-1&&(k=k.slice(1,-1)),A[y[1]]=k}return A},K}()},"./src/utils/binary-search.ts":function(he,$,O){"use strict";O.r($);var Z={search:function(I,K){for(var B=0,P=I.length-1,R=null,y=null;B<=P;){R=(B+P)/2|0,y=I[R];var A=K(y);if(A>0)B=R+1;else if(A<0)P=R-1;else return y}return null}};$.default=Z},"./src/utils/buffer-helper.ts":function(he,$,O){"use strict";O.r($),O.d($,"BufferHelper",function(){return I});var Z=O("./src/utils/logger.ts"),F={length:0,start:function(){return 0},end:function(){return 0}},I=function(){function K(){}return K.isBuffered=function(P,R){try{if(P){for(var y=K.getBuffered(P),A=0;A<y.length;A++)if(R>=y.start(A)&&R<=y.end(A))return!0}}catch(_){}return!1},K.bufferInfo=function(P,R,y){try{if(P){var A=K.getBuffered(P),_=[],k;for(k=0;k<A.length;k++)_.push({start:A.start(k),end:A.end(k)});return this.bufferedInfo(_,R,y)}}catch(C){}return{len:0,start:R,end:R,nextStart:void 0}},K.bufferedInfo=function(P,R,y){R=Math.max(0,R),P.sort(function(p,w){var b=p.start-w.start;return b||w.end-p.end});var A=[];if(y)for(var _=0;_<P.length;_++){var k=A.length;if(k){var C=A[k-1].end;P[_].start-C<y?P[_].end>C&&(A[k-1].end=P[_].end):A.push(P[_])}else A.push(P[_])}else A=P;for(var E=0,h,o=R,l=R,d=0;d<A.length;d++){var S=A[d].start,v=A[d].end;if(R+y>=S&&R<v)o=S,l=v,E=l-R;else if(R+y<S){h=S;break}}return{len:E,start:o||0,end:l||0,nextStart:h}},K.getBuffered=function(P){try{return P.buffered}catch(R){return Z.logger.log("failed to get media.buffered",R),F}},K}()},"./src/utils/cea-608-parser.ts":function(he,$,O){"use strict";O.r($),O.d($,"Row",function(){return l}),O.d($,"CaptionScreen",function(){return d});var Z=O("./src/utils/logger.ts"),F={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},I=function(f){var s=f;return F.hasOwnProperty(f)&&(s=F[f]),String.fromCharCode(s)},K=15,B=100,P={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},R={17:2,18:4,21:6,22:8,23:10,19:13,20:15},y={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},A={25:2,26:4,29:6,30:8,31:10,27:13,28:15},_=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],k;(function(u){u[u.ERROR=0]="ERROR",u[u.TEXT=1]="TEXT",u[u.WARNING=2]="WARNING",u[u.INFO=2]="INFO",u[u.DEBUG=3]="DEBUG",u[u.DATA=3]="DATA"})(k||(k={}));var C=function(){function u(){this.time=null,this.verboseLevel=k.ERROR}var f=u.prototype;return f.log=function(a,T){this.verboseLevel>=a&&Z.logger.log(this.time+" ["+a+"] "+T)},u}(),E=function(f){for(var s=[],a=0;a<f.length;a++)s.push(f[a].toString(16));return s},h=function(){function u(s,a,T,m,x){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=s||"white",this.underline=a||!1,this.italics=T||!1,this.background=m||"black",this.flash=x||!1}var f=u.prototype;return f.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},f.setStyles=function(a){for(var T=["foreground","underline","italics","background","flash"],m=0;m<T.length;m++){var x=T[m];a.hasOwnProperty(x)&&(this[x]=a[x])}},f.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},f.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},f.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},f.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},u}(),o=function(){function u(s,a,T,m,x,D){this.uchar=void 0,this.penState=void 0,this.uchar=s||" ",this.penState=new h(a,T,m,x,D)}var f=u.prototype;return f.reset=function(){this.uchar=" ",this.penState.reset()},f.setChar=function(a,T){this.uchar=a,this.penState.copy(T)},f.setPenState=function(a){this.penState.copy(a)},f.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},f.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},f.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},u}(),l=function(){function u(s){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<B;a++)this.chars.push(new o);this.logger=s,this.pos=0,this.currPenState=new h}var f=u.prototype;return f.equals=function(a){for(var T=!0,m=0;m<B;m++)if(!this.chars[m].equals(a.chars[m])){T=!1;break}return T},f.copy=function(a){for(var T=0;T<B;T++)this.chars[T].copy(a.chars[T])},f.isEmpty=function(){for(var a=!0,T=0;T<B;T++)if(!this.chars[T].isEmpty()){a=!1;break}return a},f.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(k.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>B&&(this.logger.log(k.DEBUG,"Too large cursor position "+this.pos),this.pos=B)},f.moveCursor=function(a){var T=this.pos+a;if(a>1)for(var m=this.pos+1;m<T+1;m++)this.chars[m].setPenState(this.currPenState);this.setCursor(T)},f.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},f.insertChar=function(a){a>=144&&this.backSpace();var T=I(a);if(this.pos>=B){this.logger.log(k.ERROR,"Cannot insert "+a.toString(16)+" ("+T+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(T,this.currPenState),this.moveCursor(1)},f.clearFromPos=function(a){var T;for(T=a;T<B;T++)this.chars[T].reset()},f.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},f.clearToEndOfRow=function(){this.clearFromPos(this.pos)},f.getTextString=function(){for(var a=[],T=!0,m=0;m<B;m++){var x=this.chars[m].uchar;x!==" "&&(T=!1),a.push(x)}return T?"":a.join("")},f.setPenStyles=function(a){this.currPenState.setStyles(a);var T=this.chars[this.pos];T.setPenState(this.currPenState)},u}(),d=function(){function u(s){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<K;a++)this.rows.push(new l(s));this.logger=s,this.currRow=K-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var f=u.prototype;return f.reset=function(){for(var a=0;a<K;a++)this.rows[a].clear();this.currRow=K-1},f.equals=function(a){for(var T=!0,m=0;m<K;m++)if(!this.rows[m].equals(a.rows[m])){T=!1;break}return T},f.copy=function(a){for(var T=0;T<K;T++)this.rows[T].copy(a.rows[T])},f.isEmpty=function(){for(var a=!0,T=0;T<K;T++)if(!this.rows[T].isEmpty()){a=!1;break}return a},f.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},f.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},f.insertChar=function(a){var T=this.rows[this.currRow];T.insertChar(a)},f.setPen=function(a){var T=this.rows[this.currRow];T.setPenStyles(a)},f.moveCursor=function(a){var T=this.rows[this.currRow];T.moveCursor(a)},f.setCursor=function(a){this.logger.log(k.INFO,"setCursor: "+a);var T=this.rows[this.currRow];T.setCursor(a)},f.setPAC=function(a){this.logger.log(k.INFO,"pacData = "+JSON.stringify(a));var T=a.row-1;if(this.nrRollUpRows&&T<this.nrRollUpRows-1&&(T=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==T){for(var m=0;m<K;m++)this.rows[m].clear();var x=this.currRow+1-this.nrRollUpRows,D=this.lastOutputScreen;if(D){var j=D.rows[x].cueStartTime,z=this.logger.time;if(j&&z!==null&&j<z)for(var V=0;V<this.nrRollUpRows;V++)this.rows[T-this.nrRollUpRows+V+1].copy(D.rows[x+V])}}this.currRow=T;var M=this.rows[this.currRow];if(a.indent!==null){var N=a.indent,Y=Math.max(N-1,0);M.setCursor(a.indent),a.color=M.chars[Y].penState.foreground}var oe={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(oe)},f.setBkgData=function(a){this.logger.log(k.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},f.setRollUpRows=function(a){this.nrRollUpRows=a},f.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(k.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(k.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,T=this.rows.splice(a,1)[0];T.clear(),this.rows.splice(this.currRow,0,T),this.logger.log(k.INFO,"Rolling up")},f.getDisplayText=function(a){a=a||!1;for(var T=[],m="",x=-1,D=0;D<K;D++){var j=this.rows[D].getTextString();j&&(x=D+1,a?T.push("Row "+x+": '"+j+"'"):T.push(j.trim()))}return T.length>0&&(a?m="["+T.join(" | ")+"]":m=T.join(`
|
|
`)),m},f.getTextAndFormat=function(){return this.rows},u}(),S=function(){function u(s,a,T){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=s,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new d(T),this.nonDisplayedMemory=new d(T),this.lastOutputScreen=new d(T),this.currRollUpRow=this.displayedMemory.rows[K-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=T}var f=u.prototype;return f.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[K-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},f.getHandler=function(){return this.outputFilter},f.setHandler=function(a){this.outputFilter=a},f.setPAC=function(a){this.writeScreen.setPAC(a)},f.setBkgData=function(a){this.writeScreen.setBkgData(a)},f.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(k.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},f.insertChars=function(a){for(var T=0;T<a.length;T++)this.writeScreen.insertChar(a[T]);var m=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(k.INFO,m+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(k.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},f.ccRCL=function(){this.logger.log(k.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},f.ccBS=function(){if(this.logger.log(k.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},f.ccAOF=function(){},f.ccAON=function(){},f.ccDER=function(){this.logger.log(k.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},f.ccRU=function(a){this.logger.log(k.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},f.ccFON=function(){this.logger.log(k.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},f.ccRDC=function(){this.logger.log(k.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},f.ccTR=function(){this.logger.log(k.INFO,"TR"),this.setMode("MODE_TEXT")},f.ccRTD=function(){this.logger.log(k.INFO,"RTD"),this.setMode("MODE_TEXT")},f.ccEDM=function(){this.logger.log(k.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},f.ccCR=function(){this.logger.log(k.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},f.ccENM=function(){this.logger.log(k.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},f.ccEOC=function(){if(this.logger.log(k.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(k.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},f.ccTO=function(a){this.logger.log(k.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},f.ccMIDROW=function(a){var T={flash:!1};if(T.underline=a%2===1,T.italics=a>=46,T.italics)T.foreground="white";else{var m=Math.floor(a/2)-16,x=["white","green","blue","cyan","red","yellow","magenta"];T.foreground=x[m]}this.logger.log(k.INFO,"MIDROW: "+JSON.stringify(T)),this.writeScreen.setPen(T)},f.outputDataUpdate=function(a){a===void 0&&(a=!1);var T=this.logger.time;if(T===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=T:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,T,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:T),this.lastOutputScreen.copy(this.displayedMemory))},f.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},u}(),v=function(){function u(s,a,T){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new C;this.channels=[null,new S(s,a,m),new S(s+1,T,m)],this.cmdHistory=b(),this.logger=m}var f=u.prototype;return f.getHandler=function(a){return this.channels[a].getHandler()},f.setHandler=function(a,T){this.channels[a].setHandler(T)},f.addData=function(a,T){var m,x,D,j=!1;this.logger.time=a;for(var z=0;z<T.length;z+=2){if(x=T[z]&127,D=T[z+1]&127,x===0&&D===0)continue;if(this.logger.log(k.DATA,"["+E([T[z],T[z+1]])+"] -> ("+E([x,D])+")"),m=this.parseCmd(x,D),m||(m=this.parseMidrow(x,D)),m||(m=this.parsePAC(x,D)),m||(m=this.parseBackgroundAttributes(x,D)),!m&&(j=this.parseChars(x,D),j)){var V=this.currentChannel;if(V&&V>0){var M=this.channels[V];M.insertChars(j)}else this.logger.log(k.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!j&&this.logger.log(k.WARNING,"Couldn't parse cleaned data "+E([x,D])+" orig: "+E([T[z],T[z+1]]))}},f.parseCmd=function(a,T){var m=this.cmdHistory,x=(a===20||a===28||a===21||a===29)&&T>=32&&T<=47,D=(a===23||a===31)&&T>=33&&T<=35;if(!(x||D))return!1;if(w(a,T,m))return p(null,null,m),this.logger.log(k.DEBUG,"Repeated command ("+E([a,T])+") is dropped"),!0;var j=a===20||a===21||a===23?1:2,z=this.channels[j];return a===20||a===21||a===28||a===29?T===32?z.ccRCL():T===33?z.ccBS():T===34?z.ccAOF():T===35?z.ccAON():T===36?z.ccDER():T===37?z.ccRU(2):T===38?z.ccRU(3):T===39?z.ccRU(4):T===40?z.ccFON():T===41?z.ccRDC():T===42?z.ccTR():T===43?z.ccRTD():T===44?z.ccEDM():T===45?z.ccCR():T===46?z.ccENM():T===47&&z.ccEOC():z.ccTO(T-32),p(a,T,m),this.currentChannel=j,!0},f.parseMidrow=function(a,T){var m=0;if((a===17||a===25)&&T>=32&&T<=47){if(a===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(k.ERROR,"Mismatch channel in midrow parsing"),!1;var x=this.channels[m];return x?(x.ccMIDROW(T),this.logger.log(k.DEBUG,"MIDROW ("+E([a,T])+")"),!0):!1}return!1},f.parsePAC=function(a,T){var m,x=this.cmdHistory,D=(a>=17&&a<=23||a>=25&&a<=31)&&T>=64&&T<=127,j=(a===16||a===24)&&T>=64&&T<=95;if(!(D||j))return!1;if(w(a,T,x))return p(null,null,x),!0;var z=a<=23?1:2;T>=64&&T<=95?m=z===1?P[a]:y[a]:m=z===1?R[a]:A[a];var V=this.channels[z];return V?(V.setPAC(this.interpretPAC(m,T)),p(a,T,x),this.currentChannel=z,!0):!1},f.interpretPAC=function(a,T){var m,x={color:null,italics:!1,indent:null,underline:!1,row:a};return T>95?m=T-96:m=T-64,x.underline=(m&1)===1,m<=13?x.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(x.italics=!0,x.color="white"):x.indent=Math.floor((m-16)/2)*4,x},f.parseChars=function(a,T){var m,x=null,D=null;if(a>=25?(m=2,D=a-8):(m=1,D=a),D>=17&&D<=19){var j;D===17?j=T+80:D===18?j=T+112:j=T+144,this.logger.log(k.INFO,"Special char '"+I(j)+"' in channel "+m),x=[j]}else a>=32&&a<=127&&(x=T===0?[a]:[a,T]);if(x){var z=E(x);this.logger.log(k.DEBUG,"Char codes = "+z.join(",")),p(a,T,this.cmdHistory)}return x},f.parseBackgroundAttributes=function(a,T){var m=(a===16||a===24)&&T>=32&&T<=47,x=(a===23||a===31)&&T>=45&&T<=47;if(!(m||x))return!1;var D,j={};a===16||a===24?(D=Math.floor((T-32)/2),j.background=_[D],T%2===1&&(j.background=j.background+"_semi")):T===45?j.background="transparent":(j.foreground="black",T===47&&(j.underline=!0));var z=a<=23?1:2,V=this.channels[z];return V.setBkgData(j),p(a,T,this.cmdHistory),!0},f.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var T=this.channels[a];T&&T.reset()}this.cmdHistory=b()},f.cueSplitAtTime=function(a){for(var T=0;T<this.channels.length;T++){var m=this.channels[T];m&&m.cueSplitAtTime(a)}},u}();function p(u,f,s){s.a=u,s.b=f}function w(u,f,s){return s.a===u&&s.b===f}function b(){return{a:null,b:null}}$.default=v},"./src/utils/codecs.ts":function(he,$,O){"use strict";O.r($),O.d($,"isCodecType",function(){return F}),O.d($,"isCodecSupportedInMp4",function(){return I});var Z={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function F(K,B){var P=Z[B];return!!P&&P[K.slice(0,4)]===!0}function I(K,B){return MediaSource.isTypeSupported((B||"video")+'/mp4;codecs="'+K+'"')}},"./src/utils/cues.ts":function(he,$,O){"use strict";O.r($);var Z=O("./src/utils/vttparser.ts"),F=O("./src/utils/webvtt-parser.ts"),I=O("./src/utils/texttrack-utils.ts"),K=/\s/,B={newCue:function(R,y,A,_){for(var k=[],C,E,h,o,l,d=self.VTTCue||self.TextTrackCue,S=0;S<_.rows.length;S++)if(C=_.rows[S],h=!0,o=0,l="",!C.isEmpty()){for(var v=0;v<C.chars.length;v++)K.test(C.chars[v].uchar)&&h?o++:(l+=C.chars[v].uchar,h=!1);C.cueStartTime=y,y===A&&(A+=1e-4),o>=16?o--:o++;var p=Object(Z.fixLineBreaks)(l.trim()),w=Object(F.generateCueId)(y,A,p);(!R||!R.cues||!R.cues.getCueById(w))&&(E=new d(y,A,p),E.id=w,E.line=S+1,E.align="left",E.position=10+Math.min(80,Math.floor(o*8/32)*10),k.push(E))}return R&&k.length&&(k.sort(function(b,u){return b.line==="auto"||u.line==="auto"?0:b.line>8&&u.line>8?u.line-b.line:b.line-u.line}),k.forEach(function(b){return Object(I.addCueToTrack)(R,b)})),k}};$.default=B},"./src/utils/discontinuities.ts":function(he,$,O){"use strict";O.r($),O.d($,"findFirstFragWithCC",function(){return K}),O.d($,"shouldAlignOnDiscontinuities",function(){return B}),O.d($,"findDiscontinuousReferenceFrag",function(){return P}),O.d($,"adjustSlidingStart",function(){return y}),O.d($,"alignStream",function(){return A}),O.d($,"alignPDT",function(){return k}),O.d($,"alignFragmentByPDTDelta",function(){return C}),O.d($,"alignMediaPlaylistByPDT",function(){return E});var Z=O("./src/polyfills/number.ts"),F=O("./src/utils/logger.ts"),I=O("./src/controller/level-helper.ts");function K(h,o){for(var l=null,d=0,S=h.length;d<S;d++){var v=h[d];if(v&&v.cc===o){l=v;break}}return l}function B(h,o,l){return!!(o.details&&(l.endCC>l.startCC||h&&h.cc<l.startCC))}function P(h,o){var l=h.fragments,d=o.fragments;if(!d.length||!l.length){F.logger.log("No fragments to align");return}var S=K(l,d[0].cc);if(!S||S&&!S.startPTS){F.logger.log("No frag in previous level to align on");return}return S}function R(h,o){if(h){var l=h.start+o;h.start=h.startPTS=l,h.endPTS=l+h.duration}}function y(h,o){for(var l=o.fragments,d=0,S=l.length;d<S;d++)R(l[d],h);o.fragmentHint&&R(o.fragmentHint,h),o.alignedSliding=!0}function A(h,o,l){if(!o)return;_(h,l,o),!l.alignedSliding&&o.details&&k(l,o.details),!l.alignedSliding&&o.details&&!l.skippedSegments&&Object(I.adjustSliding)(o.details,l)}function _(h,o,l){if(B(h,l,o)){var d=P(l.details,o);d&&Object(Z.isFiniteNumber)(d.start)&&(F.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),y(d.start,o))}}function k(h,o){if(!o.fragments.length||!h.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,d=h.fragments[0].programDateTime,S=(d-l)/1e3+o.fragments[0].start;S&&Object(Z.isFiniteNumber)(S)&&(F.logger.log("Adjusting PTS using programDateTime delta "+(d-l)+"ms, sliding:"+S.toFixed(3)+" "+h.url+" "),y(S,h))}function C(h,o){var l=h.programDateTime;if(!l)return;var d=(l-o)/1e3;h.start=h.startPTS=d,h.endPTS=d+h.duration}function E(h,o){if(!o.fragments.length||!h.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,d=o.fragments[0].start,S=l-d*1e3;h.fragments.forEach(function(v){C(v,S)}),h.fragmentHint&&C(h.fragmentHint,S),h.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(he,$,O){"use strict";O.r($);var Z=O("./src/utils/ewma.ts"),F=function(){function I(B,P,R){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=R,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Z.default(B),this.fast_=new Z.default(P)}var K=I.prototype;return K.update=function(P,R){var y=this.slow_,A=this.fast_;this.slow_.halfLife!==P&&(this.slow_=new Z.default(P,y.getEstimate(),y.getTotalWeight())),this.fast_.halfLife!==R&&(this.fast_=new Z.default(R,A.getEstimate(),A.getTotalWeight()))},K.sample=function(P,R){P=Math.max(P,this.minDelayMs_);var y=8*R,A=P/1e3,_=y/A;this.fast_.sample(A,_),this.slow_.sample(A,_)},K.canEstimate=function(){var P=this.fast_;return P&&P.getTotalWeight()>=this.minWeight_},K.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},K.destroy=function(){},I}();$.default=F},"./src/utils/ewma.ts":function(he,$,O){"use strict";O.r($);var Z=function(){function F(K,B,P){B===void 0&&(B=0),P===void 0&&(P=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=K,this.alpha_=K?Math.exp(Math.log(.5)/K):0,this.estimate_=B,this.totalWeight_=P}var I=F.prototype;return I.sample=function(B,P){var R=Math.pow(this.alpha_,B);this.estimate_=P*(1-R)+R*this.estimate_,this.totalWeight_+=B},I.getTotalWeight=function(){return this.totalWeight_},I.getEstimate=function(){if(this.alpha_){var B=1-Math.pow(this.alpha_,this.totalWeight_);if(B)return this.estimate_/B}return this.estimate_},F}();$.default=Z},"./src/utils/fetch-loader.ts":function(he,$,O){"use strict";O.r($),O.d($,"fetchSupported",function(){return C});var Z=O("./src/polyfills/number.ts"),F=O("./src/loader/load-stats.ts"),I=O("./src/demux/chunk-cache.ts");function K(d,S){d.prototype=Object.create(S.prototype),d.prototype.constructor=d,A(d,S)}function B(d){var S=typeof Map=="function"?new Map:void 0;return B=function(p){if(p===null||!y(p))return p;if(typeof p!="function")throw new TypeError("Super expression must either be null or a function");if(typeof S!="undefined"){if(S.has(p))return S.get(p);S.set(p,w)}function w(){return P(p,arguments,_(this).constructor)}return w.prototype=Object.create(p.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),A(w,p)},B(d)}function P(d,S,v){return R()?P=Reflect.construct:P=function(w,b,u){var f=[null];f.push.apply(f,b);var s=Function.bind.apply(w,f),a=new s;return u&&A(a,u.prototype),a},P.apply(null,arguments)}function R(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function y(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function A(d,S){return A=Object.setPrototypeOf||function(p,w){return p.__proto__=w,p},A(d,S)}function _(d){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},_(d)}function k(){return k=Object.assign||function(d){for(var S=1;S<arguments.length;S++){var v=arguments[S];for(var p in v)Object.prototype.hasOwnProperty.call(v,p)&&(d[p]=v[p])}return d},k.apply(this,arguments)}function C(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(d){}return!1}var E=function(){function d(v){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=v.fetchSetup||o,this.controller=new self.AbortController,this.stats=new F.LoadStats}var S=d.prototype;return S.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},S.abortInternal=function(){var p=this.response;(!p||!p.ok)&&(this.stats.aborted=!0,this.controller.abort())},S.abort=function(){var p;this.abortInternal(),(p=this.callbacks)!==null&&p!==void 0&&p.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},S.load=function(p,w,b){var u=this,f=this.stats;if(f.loading.start)throw new Error("Loader can only be used once.");f.loading.start=self.performance.now();var s=h(p,this.controller.signal),a=b.onProgress,T=p.responseType==="arraybuffer",m=T?"byteLength":"length";this.context=p,this.config=w,this.callbacks=b,this.request=this.fetchSetup(p,s),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){u.abortInternal(),b.onTimeout(f,p,u.response)},w.timeout),self.fetch(this.request).then(function(x){if(u.response=u.loader=x,!x.ok){var D=x.status,j=x.statusText;throw new l(j||"fetch, bad network response",D,x)}return f.loading.first=Math.max(self.performance.now(),f.loading.start),f.total=parseInt(x.headers.get("Content-Length")||"0"),a&&Object(Z.isFiniteNumber)(w.highWaterMark)?u.loadProgressively(x,f,p,w.highWaterMark,a):T?x.arrayBuffer():x.text()}).then(function(x){var D=u.response;self.clearTimeout(u.requestTimeout),f.loading.end=Math.max(self.performance.now(),f.loading.first),f.loaded=f.total=x[m];var j={url:D.url,data:x};a&&!Object(Z.isFiniteNumber)(w.highWaterMark)&&a(f,p,x,D),b.onSuccess(j,f,p,D)}).catch(function(x){if(self.clearTimeout(u.requestTimeout),f.aborted)return;var D=x.code||0;b.onError({code:D,text:x.message},p,x.details)})},S.getCacheAge=function(){var p=null;if(this.response){var w=this.response.headers.get("age");p=w?parseFloat(w):null}return p},S.loadProgressively=function(p,w,b,u,f){u===void 0&&(u=0);var s=new I.default,a=p.body.getReader(),T=function m(){return a.read().then(function(x){if(x.done)return s.dataLength&&f(w,b,s.flush(),p),Promise.resolve(new ArrayBuffer(0));var D=x.value,j=D.length;return w.loaded+=j,j<u||s.dataLength?(s.push(D),s.dataLength>=u&&f(w,b,s.flush(),p)):f(w,b,D,p),m()}).catch(function(){return Promise.reject()})};return T()},d}();function h(d,S){var v={method:"GET",mode:"cors",credentials:"same-origin",signal:S,headers:new self.Headers(k({},d.headers))};return d.rangeEnd&&v.headers.set("Range","bytes="+d.rangeStart+"-"+String(d.rangeEnd-1)),v}function o(d,S){return new self.Request(d.url,S)}var l=function(d){K(S,d);function S(v,p,w){var b;return b=d.call(this,v)||this,b.code=void 0,b.details=void 0,b.code=p,b.details=w,b}return S}(B(Error));$.default=E},"./src/utils/imsc1-ttml-parser.ts":function(he,$,O){"use strict";O.r($),O.d($,"IMSC1_CODEC",function(){return y}),O.d($,"parseIMSC1",function(){return C});var Z=O("./src/utils/mp4-tools.ts"),F=O("./src/utils/vttparser.ts"),I=O("./src/utils/vttcue.ts"),K=O("./src/demux/id3.ts"),B=O("./src/utils/timescale-conversion.ts"),P=O("./src/utils/webvtt-parser.ts");function R(){return R=Object.assign||function(u){for(var f=1;f<arguments.length;f++){var s=arguments[f];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(u[a]=s[a])}return u},R.apply(this,arguments)}var y="stpp.ttml.im1t",A=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,_=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,k={left:"start",center:"center",right:"end",start:"start",end:"end"};function C(u,f,s,a,T){var m=Object(Z.findBox)(new Uint8Array(u),["mdat"]);if(m.length===0){T(new Error("Could not parse IMSC1 mdat"));return}var x=m[0],D=Object(K.utf8ArrayToStr)(new Uint8Array(u,x.start,x.end-x.start)),j=Object(B.toTimescaleFromScale)(f,1,s);try{a(E(D,j))}catch(z){T(z)}}function E(u,f){var s=new DOMParser,a=s.parseFromString(u,"text/xml"),T=a.getElementsByTagName("tt")[0];if(!T)throw new Error("Invalid ttml");var m={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},x=Object.keys(m).reduce(function(M,N){return M[N]=T.getAttribute("ttp:"+N)||m[N],M},{}),D=T.getAttribute("xml:space")!=="preserve",j=o(h(T,"styling","style")),z=o(h(T,"layout","region")),V=h(T,"body","[begin]");return[].map.call(V,function(M){var N=l(M,D);if(!N||!M.hasAttribute("begin"))return null;var Y=p(M.getAttribute("begin"),x),oe=p(M.getAttribute("dur"),x),pe=p(M.getAttribute("end"),x);if(Y===null)throw v(M);if(pe===null){if(oe===null)throw v(M);pe=Y+oe}var ve=new I.default(Y-f,pe-f,N);ve.id=Object(P.generateCueId)(ve.startTime,ve.endTime,ve.text);var Le=z[M.getAttribute("region")],ke=j[M.getAttribute("style")];ve.position=10,ve.size=80;var ce=d(Le,ke),ae=ce.textAlign;if(ae){var de=k[ae];de&&(ve.lineAlign=de),ve.align=ae}return R(ve,ce),ve}).filter(function(M){return M!==null})}function h(u,f,s){var a=u.getElementsByTagName(f)[0];return a?[].slice.call(a.querySelectorAll(s)):[]}function o(u){return u.reduce(function(f,s){var a=s.getAttribute("xml:id");return a&&(f[a]=s),f},{})}function l(u,f){return[].slice.call(u.childNodes).reduce(function(s,a,T){var m;return a.nodeName==="br"&&T?s+`
|
|
`:(m=a.childNodes)!==null&&m!==void 0&&m.length?l(a,f):f?s+a.textContent.trim().replace(/\s+/g," "):s+a.textContent},"")}function d(u,f){var s="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(T,m){var x=S(f,s,m)||S(u,s,m);return x&&(T[m]=x),T},{})}function S(u,f,s){return u.hasAttributeNS(f,s)?u.getAttributeNS(f,s):null}function v(u){return new Error("Could not parse ttml timestamp "+u)}function p(u,f){if(!u)return null;var s=Object(F.parseTimeStamp)(u);return s===null&&(A.test(u)?s=w(u,f):_.test(u)&&(s=b(u,f))),s}function w(u,f){var s=A.exec(u),a=(s[4]|0)+(s[5]|0)/f.subFrameRate;return(s[1]|0)*3600+(s[2]|0)*60+(s[3]|0)+a/f.frameRate}function b(u,f){var s=_.exec(u),a=Number(s[1]),T=s[2];switch(T){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/f.frameRate;case"t":return a/f.tickRate}return a}},"./src/utils/logger.ts":function(he,$,O){"use strict";O.r($),O.d($,"enableLogs",function(){return P}),O.d($,"logger",function(){return R});var Z=function(){},F={trace:Z,debug:Z,log:Z,warn:Z,info:Z,error:Z},I=F;function K(y){var A=self.console[y];return A?A.bind(self.console,"["+y+"] >"):Z}function B(y){for(var A=arguments.length,_=new Array(A>1?A-1:0),k=1;k<A;k++)_[k-1]=arguments[k];_.forEach(function(C){I[C]=y[C]?y[C].bind(y):K(C)})}function P(y){if(self.console&&y===!0||typeof y=="object"){B(y,"debug","log","info","warn","error");try{I.log()}catch(A){I=F}}else I=F}var R=I},"./src/utils/mediakeys-helper.ts":function(he,$,O){"use strict";O.r($),O.d($,"KeySystems",function(){return Z}),O.d($,"requestMediaKeySystemAccess",function(){return F});var Z;(function(I){I.WIDEVINE="com.widevine.alpha",I.PLAYREADY="com.microsoft.playready"})(Z||(Z={}));var F=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(he,$,O){"use strict";O.r($),O.d($,"getMediaSource",function(){return Z});function Z(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(he,$,O){"use strict";O.r($),O.d($,"bin2str",function(){return B}),O.d($,"readUint16",function(){return P}),O.d($,"readUint32",function(){return R}),O.d($,"writeUint32",function(){return y}),O.d($,"findBox",function(){return A}),O.d($,"parseSegmentIndex",function(){return _}),O.d($,"parseInitSegment",function(){return k}),O.d($,"getStartDTS",function(){return C}),O.d($,"getDuration",function(){return E}),O.d($,"computeRawDurationFromSamples",function(){return h}),O.d($,"offsetStartDTS",function(){return o}),O.d($,"segmentValidRange",function(){return l}),O.d($,"appendUint8Array",function(){return d});var Z=O("./src/utils/typed-array.ts"),F=O("./src/loader/fragment.ts"),I=Math.pow(2,32)-1,K=[].push;function B(S){return String.fromCharCode.apply(null,S)}function P(S,v){"data"in S&&(v+=S.start,S=S.data);var p=S[v]<<8|S[v+1];return p<0?65536+p:p}function R(S,v){"data"in S&&(v+=S.start,S=S.data);var p=S[v]<<24|S[v+1]<<16|S[v+2]<<8|S[v+3];return p<0?4294967296+p:p}function y(S,v,p){"data"in S&&(v+=S.start,S=S.data),S[v]=p>>24,S[v+1]=p>>16&255,S[v+2]=p>>8&255,S[v+3]=p&255}function A(S,v){var p=[];if(!v.length)return p;var w,b,u;"data"in S?(w=S.data,b=S.start,u=S.end):(w=S,b=0,u=w.byteLength);for(var f=b;f<u;){var s=R(w,f),a=B(w.subarray(f+4,f+8)),T=s>1?f+s:u;if(a===v[0])if(v.length===1)p.push({data:w,start:f+8,end:T});else{var m=A({data:w,start:f+8,end:T},v.slice(1));m.length&&K.apply(p,m)}f=T}return p}function _(S){var v=A(S,["moov"]),p=v[0],w=p?p.end:null,b=A(S,["sidx"]);if(!b||!b[0])return null;var u=[],f=b[0],s=f.data[0],a=s===0?8:16,T=R(f,a);a+=4;var m=0,x=0;s===0?a+=8:a+=16,a+=2;var D=f.end+x,j=P(f,a);a+=2;for(var z=0;z<j;z++){var V=a,M=R(f,V);V+=4;var N=M&2147483647,Y=(M&2147483648)>>>31;if(Y===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var oe=R(f,V);V+=4,u.push({referenceSize:N,subsegmentDuration:oe,info:{duration:oe/T,start:D,end:D+N-1}}),D+=N,V+=4,a=V}return{earliestPresentationTime:m,timescale:T,version:s,referencesCount:j,references:u,moovEndOffset:w}}function k(S){for(var v=[],p=A(S,["moov","trak"]),w=0;w<p.length;w++){var b=p[w],u=A(b,["tkhd"])[0];if(u){var f=u.data[u.start],s=f===0?12:20,a=R(u,s),T=A(b,["mdia","mdhd"])[0];if(T){f=T.data[T.start],s=f===0?12:20;var m=R(T,s),x=A(b,["mdia","hdlr"])[0];if(x){var D=B(x.data.subarray(x.start+8,x.start+12)),j={soun:F.ElementaryStreamTypes.AUDIO,vide:F.ElementaryStreamTypes.VIDEO}[D];if(j){var z=A(b,["mdia","minf","stbl","stsd"])[0],V=void 0;z&&(V=B(z.data.subarray(z.start+12,z.start+16))),v[a]={timescale:m,type:j},v[j]={timescale:m,id:a,codec:V}}}}}}var M=A(S,["moov","mvex","trex"]);return M.forEach(function(N){var Y=R(N,4),oe=v[Y];oe&&(oe.default={duration:R(N,12),flags:R(N,20)})}),v}function C(S,v){return A(v,["moof","traf"]).reduce(function(p,w){var b=A(w,["tfdt"])[0],u=b.data[b.start],f=A(w,["tfhd"]).reduce(function(s,a){var T=R(a,4),m=S[T];if(m){var x=R(b,4);u===1&&(x*=Math.pow(2,32),x+=R(b,8));var D=m.timescale||9e4,j=x/D;if(isFinite(j)&&(s===null||j<s))return j}return s},null);return f!==null&&isFinite(f)&&(p===null||f<p)?f:p},null)||0}function E(S,v){for(var p=0,w=0,b=0,u=A(S,["moof","traf"]),f=0;f<u.length;f++){var s=u[f],a=A(s,["tfhd"])[0],T=R(a,4),m=v[T];if(!m)continue;var x=m.default,D=R(a,0)|(x==null?void 0:x.flags),j=x==null?void 0:x.duration;D&8&&(D&2?j=R(a,12):j=R(a,8));for(var z=m.timescale||9e4,V=A(s,["trun"]),M=0;M<V.length;M++){if(j){var N=R(V[M],4);p=j*N}else p=h(V[M]);m.type===F.ElementaryStreamTypes.VIDEO?w+=p/z:m.type===F.ElementaryStreamTypes.AUDIO&&(b+=p/z)}}if(w===0&&b===0){var Y=_(S);if(Y!=null&&Y.references)return Y.references.reduce(function(oe,pe){return oe+pe.info.duration||0},0)}return w||b}function h(S){var v=R(S,0),p=8;v&1&&(p+=4),v&4&&(p+=4);for(var w=0,b=R(S,4),u=0;u<b;u++){if(v&256){var f=R(S,p);w+=f,p+=4}v&512&&(p+=4),v&1024&&(p+=4),v&2048&&(p+=4)}return w}function o(S,v,p){A(v,["moof","traf"]).forEach(function(w){A(w,["tfhd"]).forEach(function(b){var u=R(b,4),f=S[u];if(!f)return;var s=f.timescale||9e4;A(w,["tfdt"]).forEach(function(a){var T=a.data[a.start],m=R(a,4);if(T===0)y(a,4,m-p*s);else{m*=Math.pow(2,32),m+=R(a,8),m-=p*s,m=Math.max(m,0);var x=Math.floor(m/(I+1)),D=Math.floor(m%(I+1));y(a,4,x),y(a,8,D)}})})})}function l(S){var v={valid:null,remainder:null},p=A(S,["moof"]);if(p){if(p.length<2)return v.remainder=S,v}else return v;var w=p[p.length-1];return v.valid=Object(Z.sliceUint8)(S,0,w.start-8),v.remainder=Object(Z.sliceUint8)(S,w.start-8),v}function d(S,v){var p=new Uint8Array(S.length+v.length);return p.set(S),p.set(v,S.length),p}},"./src/utils/output-filter.ts":function(he,$,O){"use strict";O.r($),O.d($,"default",function(){return Z});var Z=function(){function F(K,B){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=K,this.trackName=B}var I=F.prototype;return I.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},I.newCue=function(B,P,R){(this.startTime===null||this.startTime>B)&&(this.startTime=B),this.endTime=P,this.screen=R,this.timelineController.createCaptionsTrack(this.trackName)},I.reset=function(){this.cueRanges=[]},F}()},"./src/utils/texttrack-utils.ts":function(he,$,O){"use strict";O.r($),O.d($,"sendAddTrackEvent",function(){return F}),O.d($,"addCueToTrack",function(){return I}),O.d($,"clearCurrentCues",function(){return K}),O.d($,"removeCuesInRange",function(){return B}),O.d($,"getCuesInRange",function(){return R});var Z=O("./src/utils/logger.ts");function F(y,A){var _;try{_=new Event("addtrack")}catch(k){_=document.createEvent("Event"),_.initEvent("addtrack",!1,!1)}_.track=y,A.dispatchEvent(_)}function I(y,A){var _=y.mode;if(_==="disabled"&&(y.mode="hidden"),y.cues&&!y.cues.getCueById(A.id))try{if(y.addCue(A),!y.cues.getCueById(A.id))throw new Error("addCue is failed for: "+A)}catch(C){Z.logger.debug("[texttrack-utils]: "+C);var k=new self.TextTrackCue(A.startTime,A.endTime,A.text);k.id=A.id,y.addCue(k)}_==="disabled"&&(y.mode=_)}function K(y){var A=y.mode;if(A==="disabled"&&(y.mode="hidden"),y.cues)for(var _=y.cues.length;_--;)y.removeCue(y.cues[_]);A==="disabled"&&(y.mode=A)}function B(y,A,_){var k=y.mode;if(k==="disabled"&&(y.mode="hidden"),y.cues&&y.cues.length>0)for(var C=R(y.cues,A,_),E=0;E<C.length;E++)y.removeCue(C[E]);k==="disabled"&&(y.mode=k)}function P(y,A){if(A<y[0].startTime)return 0;var _=y.length-1;if(A>y[_].endTime)return-1;for(var k=0,C=_;k<=C;){var E=Math.floor((C+k)/2);if(A<y[E].startTime)C=E-1;else if(A>y[E].startTime&&k<_)k=E+1;else return E}return y[k].startTime-A<A-y[C].startTime?k:C}function R(y,A,_){var k=[],C=P(y,A);if(C>-1)for(var E=C,h=y.length;E<h;E++){var o=y[E];if(o.startTime>=A&&o.endTime<=_)k.push(o);else if(o.startTime>_)return k}return k}},"./src/utils/time-ranges.ts":function(he,$,O){"use strict";O.r($);var Z={toString:function(I){for(var K="",B=I.length,P=0;P<B;P++)K+="["+I.start(P).toFixed(3)+","+I.end(P).toFixed(3)+"]";return K}};$.default=Z},"./src/utils/timescale-conversion.ts":function(he,$,O){"use strict";O.r($),O.d($,"toTimescaleFromBase",function(){return F}),O.d($,"toTimescaleFromScale",function(){return I}),O.d($,"toMsFromMpegTsClock",function(){return K}),O.d($,"toMpegTsClockFromTimescale",function(){return B});var Z=9e4;function F(P,R,y,A){y===void 0&&(y=1),A===void 0&&(A=!1);var _=P*R*y;return A?Math.round(_):_}function I(P,R,y,A){return y===void 0&&(y=1),A===void 0&&(A=!1),F(P,R,1/y,A)}function K(P,R){return R===void 0&&(R=!1),F(P,1e3,1/Z,R)}function B(P,R){return R===void 0&&(R=1),F(P,Z,1/R)}},"./src/utils/typed-array.ts":function(he,$,O){"use strict";O.r($),O.d($,"sliceUint8",function(){return Z});function Z(F,I,K){return Uint8Array.prototype.slice?F.slice(I,K):new Uint8Array(Array.prototype.slice.call(F,I,K))}},"./src/utils/vttcue.ts":function(he,$,O){"use strict";O.r($),$.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Z=["","lr","rl"],F=["start","middle","end","left","right"];function I(y,A){if(typeof A!="string")return!1;if(!Array.isArray(y))return!1;var _=A.toLowerCase();return~y.indexOf(_)?_:!1}function K(y){return I(Z,y)}function B(y){return I(F,y)}function P(y){for(var A=arguments.length,_=new Array(A>1?A-1:0),k=1;k<A;k++)_[k-1]=arguments[k];for(var C=1;C<arguments.length;C++){var E=arguments[C];for(var h in E)y[h]=E[h]}return y}function R(y,A,_){var k=this,C={enumerable:!0};k.hasBeenReset=!1;var E="",h=!1,o=y,l=A,d=_,S=null,v="",p=!0,w="auto",b="start",u=50,f="middle",s=50,a="middle";Object.defineProperty(k,"id",P({},C,{get:function(){return E},set:function(m){E=""+m}})),Object.defineProperty(k,"pauseOnExit",P({},C,{get:function(){return h},set:function(m){h=!!m}})),Object.defineProperty(k,"startTime",P({},C,{get:function(){return o},set:function(m){if(typeof m!="number")throw new TypeError("Start time must be set to a number.");o=m,this.hasBeenReset=!0}})),Object.defineProperty(k,"endTime",P({},C,{get:function(){return l},set:function(m){if(typeof m!="number")throw new TypeError("End time must be set to a number.");l=m,this.hasBeenReset=!0}})),Object.defineProperty(k,"text",P({},C,{get:function(){return d},set:function(m){d=""+m,this.hasBeenReset=!0}})),Object.defineProperty(k,"region",P({},C,{get:function(){return S},set:function(m){S=m,this.hasBeenReset=!0}})),Object.defineProperty(k,"vertical",P({},C,{get:function(){return v},set:function(m){var x=K(m);if(x===!1)throw new SyntaxError("An invalid or illegal string was specified.");v=x,this.hasBeenReset=!0}})),Object.defineProperty(k,"snapToLines",P({},C,{get:function(){return p},set:function(m){p=!!m,this.hasBeenReset=!0}})),Object.defineProperty(k,"line",P({},C,{get:function(){return w},set:function(m){if(typeof m!="number"&&m!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");w=m,this.hasBeenReset=!0}})),Object.defineProperty(k,"lineAlign",P({},C,{get:function(){return b},set:function(m){var x=B(m);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");b=x,this.hasBeenReset=!0}})),Object.defineProperty(k,"position",P({},C,{get:function(){return u},set:function(m){if(m<0||m>100)throw new Error("Position must be between 0 and 100.");u=m,this.hasBeenReset=!0}})),Object.defineProperty(k,"positionAlign",P({},C,{get:function(){return f},set:function(m){var x=B(m);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");f=x,this.hasBeenReset=!0}})),Object.defineProperty(k,"size",P({},C,{get:function(){return s},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");s=m,this.hasBeenReset=!0}})),Object.defineProperty(k,"align",P({},C,{get:function(){return a},set:function(m){var x=B(m);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");a=x,this.hasBeenReset=!0}})),k.displayState=void 0}return R.prototype.getCueAsHTML=function(){var y=self.WebVTT;return y.convertCueToDOMTree(self,this.text)},R}()},"./src/utils/vttparser.ts":function(he,$,O){"use strict";O.r($),O.d($,"parseTimeStamp",function(){return I}),O.d($,"fixLineBreaks",function(){return A}),O.d($,"VTTParser",function(){return _});var Z=O("./src/utils/vttcue.ts"),F=function(){function k(){}var C=k.prototype;return C.decode=function(h,o){if(!h)return"";if(typeof h!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(h))},k}();function I(k){function C(h,o,l,d){return(h|0)*3600+(o|0)*60+(l|0)+parseFloat(d||0)}var E=k.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return E?parseFloat(E[2])>59?C(E[2],E[3],0,E[4]):C(E[1],E[2],E[3],E[4]):null}var K=function(){function k(){this.values=Object.create(null)}var C=k.prototype;return C.set=function(h,o){!this.get(h)&&o!==""&&(this.values[h]=o)},C.get=function(h,o,l){return l?this.has(h)?this.values[h]:o[l]:this.has(h)?this.values[h]:o},C.has=function(h){return h in this.values},C.alt=function(h,o,l){for(var d=0;d<l.length;++d)if(o===l[d]){this.set(h,o);break}},C.integer=function(h,o){/^-?\d+$/.test(o)&&this.set(h,parseInt(o,10))},C.percent=function(h,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var l=parseFloat(o);if(l>=0&&l<=100)return this.set(h,l),!0}return!1},k}();function B(k,C,E,h){var o=h?k.split(h):[k];for(var l in o){if(typeof o[l]!="string")continue;var d=o[l].split(E);if(d.length!==2)continue;var S=d[0],v=d[1];C(S,v)}}var P=new Z.default(0,0,""),R=P.align==="middle"?"middle":"center";function y(k,C,E){var h=k;function o(){var S=I(k);if(S===null)throw new Error("Malformed timestamp: "+h);return k=k.replace(/^[^\sa-zA-Z-]+/,""),S}function l(S,v){var p=new K;B(S,function(u,f){var s;switch(u){case"region":for(var a=E.length-1;a>=0;a--)if(E[a].id===f){p.set(u,E[a].region);break}break;case"vertical":p.alt(u,f,["rl","lr"]);break;case"line":s=f.split(","),p.integer(u,s[0]),p.percent(u,s[0])&&p.set("snapToLines",!1),p.alt(u,s[0],["auto"]),s.length===2&&p.alt("lineAlign",s[1],["start",R,"end"]);break;case"position":s=f.split(","),p.percent(u,s[0]),s.length===2&&p.alt("positionAlign",s[1],["start",R,"end","line-left","line-right","auto"]);break;case"size":p.percent(u,f);break;case"align":p.alt(u,f,["start",R,"end","left","right"]);break}},/:/,/\s/),v.region=p.get("region",null),v.vertical=p.get("vertical","");var w=p.get("line","auto");w==="auto"&&P.line===-1&&(w=-1),v.line=w,v.lineAlign=p.get("lineAlign","start"),v.snapToLines=p.get("snapToLines",!0),v.size=p.get("size",100),v.align=p.get("align",R);var b=p.get("position","auto");b==="auto"&&P.position===50&&(b=v.align==="start"||v.align==="left"?0:v.align==="end"||v.align==="right"?100:50),v.position=b}function d(){k=k.replace(/^\s+/,"")}if(d(),C.startTime=o(),d(),k.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+h);k=k.substr(3),d(),C.endTime=o(),d(),l(k,C)}function A(k){return k.replace(/<br(?: \/)?>/gi,`
|
|
`)}var _=function(){function k(){this.state="INITIAL",this.buffer="",this.decoder=new F,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var C=k.prototype;return C.parse=function(h){var o=this;h&&(o.buffer+=o.decoder.decode(h,{stream:!0}));function l(){var b=o.buffer,u=0;for(b=A(b);u<b.length&&b[u]!=="\r"&&b[u]!==`
|
|
`;)++u;var f=b.substr(0,u);return b[u]==="\r"&&++u,b[u]===`
|
|
`&&++u,o.buffer=b.substr(u),f}function d(b){B(b,function(u,f){},/:/)}try{var S="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;S=l();var v=S.match(/^()?WEBVTT([ \t].*)?$/);if(!v||!v[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var p=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;p?p=!1:S=l();switch(o.state){case"HEADER":/:/.test(S)?d(S):S||(o.state="ID");continue;case"NOTE":S||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(S)){o.state="NOTE";break}if(!S)continue;if(o.cue=new Z.default(0,0,""),o.state="CUE",S.indexOf("-->")===-1){o.cue.id=S;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{y(S,o.cue,o.regionList)}catch(b){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var w=S.indexOf("-->")!==-1;if(!S||w&&(p=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
|
|
`),o.cue.text+=S}continue;case"BADCUE":S||(o.state="ID")}}}catch(b){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},C.flush=function(){var h=this;try{if((h.cue||h.state==="HEADER")&&(h.buffer+=`
|
|
|
|
`,h.parse()),h.state==="INITIAL"||h.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){h.onparsingerror&&h.onparsingerror(o)}return h.onflush&&h.onflush(),this},k}()},"./src/utils/webvtt-parser.ts":function(he,$,O){"use strict";O.r($),O.d($,"generateCueId",function(){return _}),O.d($,"parseWebVTT",function(){return C});var Z=O("./src/polyfills/number.ts"),F=O("./src/utils/vttparser.ts"),I=O("./src/demux/id3.ts"),K=O("./src/utils/timescale-conversion.ts"),B=O("./src/remux/mp4-remuxer.ts"),P=/\r\n|\n\r|\n|\r/g,R=function(h,o,l){return l===void 0&&(l=0),h.substr(l,o.length)===o},y=function(h){var o=parseInt(h.substr(-3)),l=parseInt(h.substr(-6,2)),d=parseInt(h.substr(-9,2)),S=h.length>9?parseInt(h.substr(0,h.indexOf(":"))):0;if(!Object(Z.isFiniteNumber)(o)||!Object(Z.isFiniteNumber)(l)||!Object(Z.isFiniteNumber)(d)||!Object(Z.isFiniteNumber)(S))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+h);return o+=1e3*l,o+=60*1e3*d,o+=60*60*1e3*S,o},A=function(h){for(var o=5381,l=h.length;l;)o=o*33^h.charCodeAt(--l);return(o>>>0).toString()};function _(E,h,o){return A(E.toString())+A(h.toString())+A(o)}var k=function(h,o,l){var d=h[o],S=h[d.prevCC];if(!S||!S.new&&d.new){h.ccOffset=h.presentationOffset=d.start,d.new=!1;return}for(;(v=S)!==null&&v!==void 0&&v.new;){var v;h.ccOffset+=d.start-S.start,d.new=!1,d=S,S=h[d.prevCC]}h.presentationOffset=l};function C(E,h,o,l,d,S,v,p){var w=new F.VTTParser,b=Object(I.utf8ArrayToStr)(new Uint8Array(E)).trim().replace(P,`
|
|
`).split(`
|
|
`),u=[],f=Object(K.toMpegTsClockFromTimescale)(h,o),s="00:00.000",a=0,T=0,m,x=!0,D=!1;w.oncue=function(j){var z=l[d],V=l.ccOffset,M=(a-f)/9e4;if(z!=null&&z.new&&(T!==void 0?V=l.ccOffset=z.start:k(l,d,M)),M&&(V=M-l.presentationOffset),D){var N=j.endTime-j.startTime,Y=Object(B.normalizePts)((j.startTime+V-T)*9e4,S*9e4)/9e4;j.startTime=Y,j.endTime=Y+N}var oe=j.text.trim();j.text=decodeURIComponent(encodeURIComponent(oe)),j.id||(j.id=_(j.startTime,j.endTime,oe)),j.endTime>0&&u.push(j)},w.onparsingerror=function(j){m=j},w.onflush=function(){if(m){p(m);return}v(u)},b.forEach(function(j){if(x)if(R(j,"X-TIMESTAMP-MAP=")){x=!1,D=!0,j.substr(16).split(",").forEach(function(z){R(z,"LOCAL:")?s=z.substr(6):R(z,"MPEGTS:")&&(a=parseInt(z.substr(7)))});try{T=y(s)/1e3}catch(z){D=!1,m=z}return}else j===""&&(x=!1);w.parse(j+`
|
|
`)}),w.flush()}},"./src/utils/xhr-loader.ts":function(he,$,O){"use strict";O.r($);var Z=O("./src/utils/logger.ts"),F=O("./src/loader/load-stats.ts"),I=/^age:\s*[\d.]+\s*$/m,K=function(){function B(R){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=R?R.xhrSetup:null,this.stats=new F.LoadStats,this.retryDelay=0}var P=B.prototype;return P.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},P.abortInternal=function(){var y=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),y&&(y.onreadystatechange=null,y.onprogress=null,y.readyState!==4&&(this.stats.aborted=!0,y.abort()))},P.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},P.load=function(y,A,_){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=y,this.config=A,this.callbacks=_,this.retryDelay=A.retryDelay,this.loadInternal()},P.loadInternal=function(){var y=this.config,A=this.context;if(!y)return;var _=this.loader=new self.XMLHttpRequest,k=this.stats;k.loading.first=0,k.loaded=0;var C=this.xhrSetup;try{if(C)try{C(_,A.url)}catch(o){_.open("GET",A.url,!0),C(_,A.url)}_.readyState||_.open("GET",A.url,!0);var E=this.context.headers;if(E)for(var h in E)_.setRequestHeader(h,E[h])}catch(o){this.callbacks.onError({code:_.status,text:o.message},A,_);return}A.rangeEnd&&_.setRequestHeader("Range","bytes="+A.rangeStart+"-"+(A.rangeEnd-1)),_.onreadystatechange=this.readystatechange.bind(this),_.onprogress=this.loadprogress.bind(this),_.responseType=A.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout),_.send()},P.readystatechange=function(){var y=this.context,A=this.loader,_=this.stats;if(!y||!A)return;var k=A.readyState,C=this.config;if(_.aborted)return;if(k>=2)if(self.clearTimeout(this.requestTimeout),_.loading.first===0&&(_.loading.first=Math.max(self.performance.now(),_.loading.start)),k===4){A.onreadystatechange=null,A.onprogress=null;var E=A.status;if(E>=200&&E<300){_.loading.end=Math.max(self.performance.now(),_.loading.first);var h,o;if(y.responseType==="arraybuffer"?(h=A.response,o=h.byteLength):(h=A.responseText,o=h.length),_.loaded=_.total=o,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(_,y,h,A),!this.callbacks)return;var d={url:A.responseURL,data:h};this.callbacks.onSuccess(d,_,y,A)}else _.retry>=C.maxRetry||E>=400&&E<499?(Z.logger.error(E+" while loading "+y.url),this.callbacks.onError({code:E,text:A.statusText},y,A)):(Z.logger.warn(E+" while loading "+y.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,C.maxRetryDelay),_.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),C.timeout)},P.loadtimeout=function(){Z.logger.warn("timeout while loading "+this.context.url);var y=this.callbacks;y&&(this.abortInternal(),y.onTimeout(this.stats,this.context,this.loader))},P.loadprogress=function(y){var A=this.stats;A.loaded=y.loaded,y.lengthComputable&&(A.total=y.total)},P.getCacheAge=function(){var y=null;if(this.loader&&I.test(this.loader.getAllResponseHeaders())){var A=this.loader.getResponseHeader("age");y=A?parseFloat(A):null}return y},B}();$.default=K}}).default})},vHTk:function(Et,rt,re){Et.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|