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.
NewEduCoderBuild/p__Paperlibrary__Random__Ex...

394 lines
968 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[196,5,7,8,13],{"+ua5":function(at,$e,z){},"+vTd":function(at,$e,z){at.exports={flex_box_center:"flex_box_center___37CPQ",flex_space_between:"flex_space_between___1yzV5",flex_box_vertical_center:"flex_box_vertical_center___2QH_C",flex_box_center_end:"flex_box_center_end___22kLi",flex_box_column:"flex_box_column___1Y3On",line:"line___-rzSr",b1:"b1___1zz_c",b2:"b2___1dAOW",list:"list___1gpez",title:"title___21uOv",tr:"tr___3kTJL",itemDetail:"itemDetail___8QmqJ",answerWrapper:"answerWrapper___3guKO",decoration:"decoration___1rcYW",row:"row___3uQSh",typeRow:"typeRow___ADZSj",type:"type___2pfNZ",typeName:"typeName___8ZhPv",typeIcon:"typeIcon___1Xniv",unpublished:"unpublished___dTXTI",private:"private___XQiDx",public:"public___iIFou",reviewFlag:"reviewFlag___YP4vk",typeRightAction:"typeRightAction___1PQjp",actionLink:"actionLink___2E5q_",actionIcon:"actionIcon___GCvNK",topicTitle:"topicTitle___3fJds",topicTitleContent:"topicTitleContent___35cf9",judgmentContent:"judgmentContent___SU5rV",programContent:"programContent___3G6-D",otherContent:"otherContent___1JHnX",combinationContent:"combinationContent___6ZXO-",con:"con___1_qCl",otherContentItem:"otherContentItem___18WrV",otehrContentHtml:"otehrContentHtml___LW3nV",difficultyRow:"difficultyRow___3HvT0",updateTimeRow:"updateTimeRow___1dNd0",updateTimeWrap:"updateTimeWrap___2PKks",updateTimeContent:"updateTimeContent___1mNBy",programLanguage:"programLanguage___3CnaJ",updateTimeRowAction:"updateTimeRowAction___1DaMt",bottomAction:"bottomAction___Y-BNC",borderColorBlue:"borderColorBlue___2Xd-0",borderColorRed:"borderColorRed___2zA_q",borderColorFFF:"borderColorFFF___2R5-5",borderColorGray:"borderColorGray___nZnDe",selectIcon:"selectIcon___2byLd",colorGreen:"colorGreen___1iOKR",parseAnswerBorder:"parseAnswerBorder___1LTYn",answer:"answer___2L9lv",answerHtml:"answerHtml___3zrOk",parse:"parse___3d3dm",parseText:"parseText___1C_VL",parseAnswer:"parseAnswer___QMVPC",parseAnswerHtml:"parseAnswerHtml___2TCVz",actionBar:"actionBar___2ItMN",know:"know___y8QKK",menu:"menu___SYdg7",bottom:"bottom___2dFIa",textBtn:"textBtn___1y00f"}},"+z73":function(at,$e,z){at.exports={flex_box_center:"flex_box_center___3WSrc",flex_space_between:"flex_space_between___1fpCp",flex_box_vertical_center:"flex_box_vertical_center___3Wy8W",flex_box_center_end:"flex_box_center_end___3YIs2",flex_box_column:"flex_box_column___3CNwR",pWrap:"pWrap___2jVbQ",few:"few___3Eebn"}},"1vnw":function(at,$e,z){at.exports={list:"list___1dAFk",btns:"btns___1YCLO",name:"name___2XX_F",folderWrapper:"folderWrapper___3sKHr",folderIcon:"folderIcon___Rov4k"}},"5VLF":function(at,$e,z){"use strict";var _e,F;function w(U,S,I){var N=function(k,A){return U.js_beautify(k,A)};return N.js=U.js_beautify,N.css=S.css_beautify,N.html=I.html_beautify,N.js_beautify=U.js_beautify,N.css_beautify=S.css_beautify,N.html_beautify=I.html_beautify,N}!(_e=[z("6UM0"),z("TXwP"),z("psGv")],F=function(U,S,I){return w(U,S,I)}.apply($e,_e),F!==void 0&&(at.exports=F))},"6+eU":function(at,$e,z){"use strict";z.d($e,"a",function(){return p});var _e=z("wx14"),F=z("rePB"),w=z("VTBJ"),U=z("1OyB"),S=z("vuIU"),I=z("Ji7U"),N=z("LK+K"),k=z("q1tI"),A=z.n(k),C=z("TSYQ"),y=z.n(C),h=function(_){var a,c="".concat(_.rootPrefixCls,"-item"),r=y()(c,"".concat(c,"-").concat(_.page),(a={},Object(F.a)(a,"".concat(c,"-active"),_.active),Object(F.a)(a,_.className,!!_.className),Object(F.a)(a,"".concat(c,"-disabled"),!_.page),a)),l=function(){_.onClick(_.page)},v=function(x){_.onKeyPress(x,_.onClick,_.page)};return A.a.createElement("li",{title:_.showTitle?_.page:null,className:r,onClick:l,onKeyPress:v,tabIndex:"0"},_.itemRender(_.page,"page",A.a.createElement("a",{rel:"nofollow"},_.page)))},u=h,o={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},e=function(b){Object(I.a)(a,b);var _=Object(N.a)(a);function a(){var c;Object(U.a)(this,a);for(var r=arguments.length,l=new Array(r),v=0;v<r;v++)l[v]=arguments[v];return c=_.call.apply(_,[this].concat(l)),c.state={goInputText:""},c.buildOptionText=function(f){return"".concat(f," ").concat(c.props.locale.items_per_page)},c.changeSize=function(f){c.props.changeSize(Number(f))},c.handleChange=function(f){c.setState({goInputText:f.target.value})},c.handleBlur=function(f){var x=c.props,R=x.goButton,O=x.quickGo,B=x.rootPrefixCls,j=c.state.goInputText;if(R||j==="")return;if(f.relatedTarget&&(f.relatedTarget.className.indexOf("".concat(B,"-prev"))>=0||f.relatedTarget.className.indexOf("".concat(B,"-next"))>=0))return;c.setState({goInputText:""}),O(c.getValidValue())},c.go=function(f){var x=c.state.goInputText;if(x==="")return;(f.keyCode===o.ENTER||f.type==="click")&&(c.setState({goInputText:""}),c.props.quickGo(c.getValidValue()))},c}return Object(S.a)(a,[{key:"getValidValue",value:function(){var r=this.state,l=r.goInputText,v=r.current;return!l||isNaN(l)?v:Number(l)}},{key:"getPageSizeOptions",value:function(){var r=this.props,l=r.pageSize,v=r.pageSizeOptions;return v.some(function(f){return f.toString()===l.toString()})?v:v.concat([l.toString()]).sort(function(f,x){var R=isNaN(Number(f))?0:Number(f),O=isNaN(Number(x))?0:Number(x);return R-O})}},{key:"render",value:function(){var r=this,l=this.props,v=l.pageSize,f=l.locale,x=l.rootPrefixCls,R=l.changeSize,O=l.quickGo,B=l.goButton,j=l.selectComponentClass,K=l.buildOptionText,L=l.selectPrefixCls,H=l.disabled,Y=this.state.goInputText,ae="".concat(x,"-options"),Z=j,ce=null,de=null,q=null;if(!R&&!O)return null;var te=this.getPageSizeOptions();if(R&&Z){var he=te.map(function(J,X){return A.a.createElement(Z.Option,{key:X,value:J.toString()},(K||r.buildOptionText)(J))});ce=A.a.createElement(Z,{disabled:H,prefixCls:L,showSearch:!1,className:"".concat(ae,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(v||te[0]).toString(),onChange:this.changeSize,getPopupContainer:function(X){return X.parentNode}},he)}return O&&(B&&(q=typeof B=="boolean"?A.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:H,className:"".concat(ae,"-quick-jumper-button")},f.jump_to_confirm):A.a.createElement("span",{onClick:this.go,onKeyUp:this.go},B)),de=A.a.createElement("div",{className:"".concat(ae,"-quick-jumper")},f.jump_to,A.a.createElement("input",{disabled:H,type:"text",value:Y,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),f.page,q)),A.a.createElement("li",{className:"".concat(ae)},ce,de)}}]),a}(A.a.Component);e.defaultProps={pageSizeOptions:["10","20","50","100"]};var d=e,s=z("N2Kk");function t(){}function i(b){return typeof b=="number"&&isFinite(b)&&Math.floor(b)===b}function n(b,_,a){return a}function T(b,_,a){var c=typeof b=="undefined"?_.pageSize:b;return Math.floor((a.total-1)/c)+1}var m=function(b){Object(I.a)(a,b);var _=Object(N.a)(a);function a(c){var r;Object(U.a)(this,a),r=_.call(this,c),r.getJumpPrevPage=function(){return Math.max(1,r.state.current-(r.props.showLessItems?3:5))},r.getJumpNextPage=function(){return Math.min(T(void 0,r.state,r.props),r.state.current+(r.props.showLessItems?3:5))},r.getItemIcon=function(R,O){var B=r.props.prefixCls,j=R||A.a.createElement("button",{type:"button","aria-label":O,className:"".concat(B,"-item-link")});return typeof R=="function"&&(j=A.a.createElement(R,Object(w.a)({},r.props))),j},r.savePaginationNode=function(R){r.paginationNode=R},r.isValid=function(R){return i(R)&&R!==r.state.current},r.shouldDisplayQuickJumper=function(){var R=r.props,O=R.showQuickJumper,B=R.pageSize,j=R.total;return j<=B?!1:O},r.handleKeyDown=function(R){(R.keyCode===o.ARROW_UP||R.keyCode===o.ARROW_DOWN)&&R.preventDefault()},r.handleKeyUp=function(R){var O=r.getValidValue(R),B=r.state.currentInputValue;O!==B&&r.setState({currentInputValue:O}),R.keyCode===o.ENTER?r.handleChange(O):R.keyCode===o.ARROW_UP?r.handleChange(O-1):R.keyCode===o.ARROW_DOWN&&r.handleChange(O+1)},r.changePageSize=function(R){var O=r.state.current,B=T(R,r.state,r.props);O=O>B?B:O,B===0&&(O=r.state.current),typeof R=="number"&&("pageSize"in r.props||r.setState({pageSize:R}),"current"in r.props||r.setState({current:O,currentInputValue:O})),r.props.onShowSizeChange(O,R),"onChange"in r.props&&r.props.onChange&&r.props.onChange(O,R)},r.handleChange=function(R){var O=r.props.disabled,B=R;if(r.isValid(B)&&!O){var j=T(void 0,r.state,r.props);B>j?B=j:B<1&&(B=1),"current"in r.props||r.setState({current:B,currentInputValue:B});var K=r.state.pageSize;return r.props.onChange(B,K),B}return r.state.current},r.prev=function(){r.hasPrev()&&r.handleChange(r.state.current-1)},r.next=function(){r.hasNext()&&r.handleChange(r.state.current+1)},r.jumpPrev=function(){r.handleChange(r.getJumpPrevPage())},r.jumpNext=function(){r.handleChange(r.getJumpNextPage())},r.hasPrev=function(){return r.state.current>1},r.hasNext=function(){return r.state.current<T(void 0,r.state,r.props)},r.runIfEnter=function(R,O){if(R.key==="Enter"||R.charCode===13){for(var B=arguments.length,j=new Array(B>2?B-2:0),K=2;K<B;K++)j[K-2]=arguments[K];O.apply(void 0,j)}},r.runIfEnterPrev=function(R){r.runIfEnter(R,r.prev)},r.runIfEnterNext=function(R){r.runIfEnter(R,r.next)},r.runIfEnterJumpPrev=function(R){r.runIfEnter(R,r.jumpPrev)},r.runIfEnterJumpNext=function(R){r.runIfEnter(R,r.jumpNext)},r.handleGoTO=function(R){(R.keyCode===o.ENTER||R.type==="click")&&r.handleChange(r.state.currentInputValue)};var l=c.onChange!==t,v="current"in c;v&&!l&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var f=c.defaultCurrent;"current"in c&&(f=c.current);var x=c.defaultPageSize;return"pageSize"in c&&(x=c.pageSize),f=Math.min(f,T(x,void 0,c)),r.state={current:f,currentInputValue:f,pageSize:x},r}return Object(S.a)(a,[{key:"componentDidUpdate",value:function(r,l){var v=this.props.prefixCls;if(l.current!==this.state.current&&this.paginationNode){var f=this.paginationNode.querySelector(".".concat(v,"-item-").concat(l.current));f&&document.activeElement===f&&f.blur()}}},{key:"getValidValue",value:function(r){var l=r.target.value,v=T(void 0,this.state,this.props),f=this.state.currentInputValue,x;return l===""?x=l:isNaN(Number(l))?x=f:l>=v?x=v:x=Number(l),x}},{key:"getShowSizeChanger",value:function(){var r=this.props,l=r.showSizeChanger,v=r.total,f=r.totalBoundaryShowSizeChanger;return typeof l!="undefined"?l:v>f}},{key:"renderPrev",value:function(r){var l=this.props,v=l.prevIcon,f=l.itemRender,x=f(r,"prev",this.getItemIcon(v,"prev page")),R=!this.hasPrev();return Object(k.isValidElement)(x)?Object(k.cloneElement)(x,{disabled:R}):x}},{key:"renderNext",value:function(r){var l=this.props,v=l.nextIcon,f=l.itemRender,x=f(r,"next",this.getItemIcon(v,"next page")),R=!this.hasNext();return Object(k.isValidElement)(x)?Object(k.cloneElement)(x,{disabled:R}):x}},{key:"render",value:function(){var r=this,l=this.props,v=l.prefixCls,f=l.className,x=l.style,R=l.disabled,O=l.hideOnSinglePage,B=l.total,j=l.locale,K=l.showQuickJumper,L=l.showLessItems,H=l.showTitle,Y=l.showTotal,ae=l.simple,Z=l.itemRender,ce=l.showPrevNextJumpers,de=l.jumpPrevIcon,q=l.jumpNextIcon,te=l.selectComponentClass,he=l.selectPrefixCls,J=l.pageSizeOptions,X=this.state,ye=X.current,we=X.pageSize,Le=X.currentInputValue;if(O===!0&&B<=we)return null;var xe=T(void 0,this.state,this.props),Re=[],Te=null,Oe=null,Ie=null,Me=null,Ne=null,Be=K&&K.goButton,Pe=L?1:2,Ye=ye-1>0?ye-1:0,Ke=ye+1<xe?ye+1:xe,Se=Object.keys(this.props).reduce(function($,Q){return(Q.substr(0,5)==="data-"||Q.substr(0,5)==="aria-"||Q==="role")&&($[Q]=r.props[Q]),$},{});if(ae)return Be&&(typeof Be=="boolean"?Ne=A.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},j.jump_to_confirm):Ne=A.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},Be),Ne=A.a.createElement("li",{title:H?"".concat(j.jump_to).concat(ye,"/").concat(xe):null,className:"".concat(v,"-simple-pager")},Ne)),A.a.createElement("ul",Object(_e.a)({className:y()(v,"".concat(v,"-simple"),Object(F.a)({},"".concat(v,"-disabled"),R),f),style:x,ref:this.savePaginationNode},Se),A.a.createElement("li",{title:H?j.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:y()("".concat(v,"-prev"),Object(F.a)({},"".concat(v,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(Ye)),A.a.createElement("li",{title:H?"".concat(ye,"/").concat(xe):null,className:"".concat(v,"-simple-pager")},A.a.createElement("input",{type:"text",value:Le,disabled:R,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),A.a.createElement("span",{className:"".concat(v,"-slash")},"/"),xe),A.a.createElement("li",{title:H?j.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:y()("".concat(v,"-next"),Object(F.a)({},"".concat(v,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(Ke)),Ne);if(xe<=3+Pe*2){var je={locale:j,rootPrefixCls:v,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:H,itemRender:Z};xe||Re.push(A.a.createElement(u,Object(_e.a)({},je,{key:"noPager",page:xe,className:"".concat(v,"-disabled")})));for(var et=1;et<=xe;et+=1){var Je=ye===et;Re.push(A.a.createElement(u,Object(_e.a)({},je,{key:et,page:et,active:Je})))}}else{var Ze=L?j.prev_3:j.prev_5,We=L?j.next_3:j.next_5;ce&&(Te=A.a.createElement("li",{title:H?Ze:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:y()("".concat(v,"-jump-prev"),Object(F.a)({},"".concat(v,"-jump-prev-custom-icon"),!!de))},Z(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(de,"prev page"))),Oe=A.a.createElement("li",{title:H?We:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:y()("".concat(v,"-jump-next"),Object(F.a)({},"".concat(v,"-jump-next-custom-icon"),!!q))},Z(this.getJumpNextPage(),"jump-next",this.getItemIcon(q,"next page")))),Me=A.a.createElement(u,{locale:j,last:!0,rootPrefixCls:v,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:xe,page:xe,active:!1,showTitle:H,itemRender:Z}),Ie=A.a.createElement(u,{locale:j,rootPrefixCls:v,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:H,itemRender:Z});var nt=Math.max(1,ye-Pe),qe=Math.min(ye+Pe,xe);ye-1<=Pe&&(qe=1+Pe*2),xe-ye<=Pe&&(nt=xe-Pe*2);for(var De=nt;De<=qe;De+=1){var Ge=ye===De;Re.push(A.a.createElement(u,{locale:j,rootPrefixCls:v,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:De,page:De,active:Ge,showTitle:H,itemRender:Z}))}ye-1>=Pe*2&&ye!==1+2&&(Re[0]=Object(k.cloneElement)(Re[0],{className:"".concat(v,"-item-after-jump-prev")}),Re.unshift(Te)),xe-ye>=Pe*2&&ye!==xe-2&&(Re[Re.length-1]=Object(k.cloneElement)(Re[Re.length-1],{className:"".concat(v,"-item-before-jump-next")}),Re.push(Oe)),nt!==1&&Re.unshift(Ie),qe!==xe&&Re.push(Me)}var ne=null;Y&&(ne=A.a.createElement("li",{className:"".concat(v,"-total-text")},Y(B,[B===0?0:(ye-1)*we+1,ye*we>B?B:ye*we])));var le=!this.hasPrev()||!xe,fe=!this.hasNext()||!xe;return A.a.createElement("ul",Object(_e.a)({className:y()(v,f,Object(F.a)({},"".concat(v,"-disabled"),R)),style:x,unselectable:"unselectable",ref:this.savePaginationNode},Se),ne,A.a.createElement("li",{title:H?j.prev_page:null,onClick:this.prev,tabIndex:le?null:0,onKeyPress:this.runIfEnterPrev,className:y()("".concat(v,"-prev"),Object(F.a)({},"".concat(v,"-disabled"),le)),"aria-disabled":le},this.renderPrev(Ye)),Re,A.a.createElement("li",{title:H?j.next_page:null,onClick:this.next,tabIndex:fe?null:0,onKeyPress:this.runIfEnterNext,className:y()("".concat(v,"-next"),Object(F.a)({},"".concat(v,"-disabled"),fe)),"aria-disabled":fe},this.renderNext(Ke)),A.a.createElement(d,{disabled:R,locale:j,rootPrefixCls:v,selectComponentClass:te,selectPrefixCls:he,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:ye,pageSize:we,pageSizeOptions:J,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:Be}))}}],[{key:"getDerivedStateFromProps",value:function(r,l){var v={};if("current"in r&&(v.current=r.current,r.current!==l.current&&(v.currentInputValue=v.current)),"pageSize"in r&&r.pageSize!==l.pageSize){var f=l.current,x=T(r.pageSize,l,r);f=f>x?x:f,"current"in r||(v.current=f,v.currentInputValue=f),v.pageSize=r.pageSize}return v}}]),a}(A.a.Component);m.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:t,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:t,locale:s.a,style:{},itemRender:n,totalBoundaryShowSizeChanger:50};var p=m},"6UM0":function(at,$e,z){var _e,F;(function(){var w;(function(){"use strict";var S=[function(A,C,y){var h=y(1).Beautifier,u=y(5).Options;function o(e,d){var s=new h(e,d);return s.beautify()}A.exports=o,A.exports.defaultOptions=function(){return new u}},function(A,C,y){var h=y(2).Output,u=y(3).Token,o=y(4),e=y(5).Options,d=y(7).Tokenizer,s=y(7).line_starters,t=y(7).positionable_operators,i=y(7).TOKEN;function n(L,H){return H.indexOf(L)!==-1}function T(L){return L.replace(/^\s+/g,"")}function m(L){for(var H={},Y=0;Y<L.length;Y++)H[L[Y].replace(/-/g,"_")]=L[Y];return H}function p(L,H){return L&&L.type===i.RESERVED&&L.text===H}function b(L,H){return L&&L.type===i.RESERVED&&n(L.text,H)}var _=["case","return","do","if","throw","else","await","break","continue","async"],a=["before-newline","after-newline","preserve-newline"],c=m(a),r=[c.before_newline,c.preserve_newline],l={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function v(L,H){if(H.multiline_frame||H.mode===l.ForInitializer||H.mode===l.Conditional)return;L.remove_indent(H.start_line_index)}function f(L){L=L.replace(o.allLineBreaks,`
`);for(var H=[],Y=L.indexOf(`
`);Y!==-1;)H.push(L.substring(0,Y)),L=L.substring(Y+1),Y=L.indexOf(`
`);return L.length&&H.push(L),H}function x(L){return L===l.ArrayLiteral}function R(L){return n(L,[l.Expression,l.ForInitializer,l.Conditional])}function O(L,H){for(var Y=0;Y<L.length;Y++){var ae=L[Y].trim();if(ae.charAt(0)!==H)return!1}return!0}function B(L,H){for(var Y=0,ae=L.length,Z;Y<ae;Y++)if(Z=L[Y],Z&&Z.indexOf(H)!==0)return!1;return!0}function j(L,H){H=H||{},this._source_text=L||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new e(H)}j.prototype.create_flags=function(L,H){var Y=0;L&&(Y=L.indentation_level,!this._output.just_added_newline()&&L.line_indent_level>Y&&(Y=L.line_indent_level));var ae={mode:H,parent:L,last_token:L?L.last_token:new u(i.START_BLOCK,""),last_word:L?L.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,class_start_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,case_block:!1,indentation_level:Y,alignment:0,line_indent_level:L?L.line_indent_level:Y,start_line_index:this._output.get_line_number(),ternary_depth:0};return ae},j.prototype._reset=function(L){var H=L.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new h(this._options,H),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(l.BlockStatement);var Y=new d(L,this._options);return this._tokens=Y.tokenize(),L},j.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var L,H=this._reset(this._source_text),Y=this._options.eol;this._options.eol==="auto"&&(Y=`
`,H&&o.lineBreak.test(H||"")&&(Y=H.match(o.lineBreak)[0]));for(var ae=this._tokens.next();ae;)this.handle_token(ae),this._last_last_text=this._flags.last_token.text,this._flags.last_token=ae,ae=this._tokens.next();return L=this._output.get_code(Y),L},j.prototype.handle_token=function(L,H){L.type===i.START_EXPR?this.handle_start_expr(L):L.type===i.END_EXPR?this.handle_end_expr(L):L.type===i.START_BLOCK?this.handle_start_block(L):L.type===i.END_BLOCK?this.handle_end_block(L):L.type===i.WORD?this.handle_word(L):L.type===i.RESERVED?this.handle_word(L):L.type===i.SEMICOLON?this.handle_semicolon(L):L.type===i.STRING?this.handle_string(L):L.type===i.EQUALS?this.handle_equals(L):L.type===i.OPERATOR?this.handle_operator(L):L.type===i.COMMA?this.handle_comma(L):L.type===i.BLOCK_COMMENT?this.handle_block_comment(L,H):L.type===i.COMMENT?this.handle_comment(L,H):L.type===i.DOT?this.handle_dot(L):L.type===i.EOF?this.handle_eof(L):L.type===i.UNKNOWN?this.handle_unknown(L,H):this.handle_unknown(L,H)},j.prototype.handle_whitespace_and_comments=function(L,H){var Y=L.newlines,ae=this._options.keep_array_indentation&&x(this._flags.mode);if(L.comments_before)for(var Z=L.comments_before.next();Z;)this.handle_whitespace_and_comments(Z,H),this.handle_token(Z,H),Z=L.comments_before.next();if(ae)for(var ce=0;ce<Y;ce+=1)this.print_newline(ce>0,H);else if(this._options.max_preserve_newlines&&Y>this._options.max_preserve_newlines&&(Y=this._options.max_preserve_newlines),this._options.preserve_newlines&&Y>1){this.print_newline(!1,H);for(var de=1;de<Y;de+=1)this.print_newline(!0,H)}};var K=["async","break","continue","return","throw","yield"];j.prototype.allow_wrap_or_preserved_newline=function(L,H){if(H=H===void 0?!1:H,this._output.just_added_newline())return;var Y=this._options.preserve_newlines&&L.newlines||H,ae=n(this._flags.last_token.text,t)||n(L.text,t);if(ae){var Z=n(this._flags.last_token.text,t)&&n(this._options.operator_position,r)||n(L.text,t);Y=Y&&Z}if(Y)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(b(this._flags.last_token,K))return;this._output.set_wrap_point()}},j.prototype.print_newline=function(L,H){if(!H&&(this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==i.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")))for(var Y=this._tokens.peek();this._flags.mode===l.Statement&&!(this._flags.if_block&&p(Y,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(L)&&(this._flags.multiline_frame=!0)},j.prototype.print_token_line_indentation=function(L){this._output.just_added_newline()&&(this._options.keep_array_indentation&&L.newlines&&(L.text==="["||x(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(L.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},j.prototype.print_token=function(L){if(this._output.raw){this._output.add_raw_token(L);return}if(this._options.comma_first&&L.previous&&L.previous.type===i.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var H=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(H),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(L),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(L),this._output.non_breaking_space=!0,this._output.add_token(L.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},j.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},j.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},j.prototype.set_mode=function(L){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,L),this._flags=this.create_flags(this._previous_flags,L),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},j.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===l.Statement&&v(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},j.prototype.start_of_object_property=function(){return this._flags.parent.mode===l.ObjectLiteral&&this._flags.mode===l.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||b(this._flags.last_token,["get","set"]))},j.prototype.start_of_statement=function(L){var H=!1;return H=H||b(this._flags.last_token,["var","let","const"])&&L.type===i.WORD,H=H||p(this._flags.last_token,"do"),H=H||!(this._flags.parent.mode===l.ObjectLiteral&&this._flags.mode===l.Statement)&&b(this._flags.last_token,K)&&!L.newlines,H=H||p(this._flags.last_token,"else")&&!(p(L,"if")&&!L.comments_before),H=H||this._flags.last_token.type===i.END_EXPR&&(this._previous_flags.mode===l.ForInitializer||this._previous_flags.mode===l.Conditional),H=H||this._flags.last_token.type===i.WORD&&this._flags.mode===l.BlockStatement&&!this._flags.in_case&&!(L.text==="--"||L.text==="++")&&this._last_last_text!=="function"&&L.type!==i.WORD&&L.type!==i.RESERVED,H=H||this._flags.mode===l.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||b(this._flags.last_token,["get","set"])),H?(this.set_mode(l.Statement),this.indent(),this.handle_whitespace_and_comments(L,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(L,b(L,["do","for","if","while"])),!0):!1},j.prototype.handle_start_expr=function(L){this.start_of_statement(L)||this.handle_whitespace_and_comments(L);var H=l.Expression;if(L.text==="["){if(this._flags.last_token.type===i.WORD||this._flags.last_token.text===")"){b(this._flags.last_token,s)&&(this._output.space_before_token=!0),this.print_token(L),this.set_mode(H),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}H=l.ArrayLiteral,x(this._flags.mode)&&((this._flags.last_token.text==="["||this._flags.last_token.text===","&&(this._last_last_text==="]"||this._last_last_text==="}"))&&(this._options.keep_array_indentation||this.print_newline())),n(this._flags.last_token.type,[i.START_EXPR,i.END_EXPR,i.WORD,i.OPERATOR,i.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===i.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,H=l.ForInitializer):n(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,H=l.Conditional):n(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&L.whitespace_before===""?this._output.space_before_token=!1:(n(this._flags.last_token.text,s)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===i.EQUALS||this._flags.last_token.type===i.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(L);else if(this._flags.last_token.type===i.WORD){this._output.space_before_token=!1;var Y=this._tokens.peek(-3);if(this._options.space_after_named_function&&Y){var ae=this._tokens.peek(-4);b(Y,["async","function"])||Y.text==="*"&&b(ae,["async","function"])?this._output.space_before_token=!0:this._flags.mode===l.ObjectLiteral?(Y.text==="{"||Y.text===","||Y.text==="*"&&(ae.text==="{"||ae.text===","))&&(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(L);(this._flags.last_token.type===i.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(n(this._last_last_text,["function","yield"])||this._flags.mode===l.ObjectLiteral&&n(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}this._flags.last_token.text===";"||this._flags.last_token.type===i.START_BLOCK?this.print_newline():(this._flags.last_token.type===i.END_EXPR||this._flags.last_token.type===i.START_EXPR||this._flags.last_token.type===i.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===i.COMMA)&&this.allow_wrap_or_preserved_newline(L,L.newlines),this.print_token(L),this.set_mode(H),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},j.prototype.handle_end_expr=function(L){for(;this._flags.mode===l.Statement;)this.restore_mode();this.handle_whitespace_and_comments(L),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(L,L.text==="]"&&x(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===i.START_EXPR&&!this._options.space_in_empty_paren?(this._output.trim(),this._output.space_before_token=!1):this._output.space_before_token=!0),this.deindent(),this.print_token(L),this.restore_mode(),v(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===l.Conditional&&(this._previous_flags.mode=l.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},j.prototype.handle_start_block=function(L){this.handle_whitespace_and_comments(L);var H=this._tokens.peek(),Y=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===i.END_EXPR?(this.set_mode(l.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(l.BlockStatement):Y&&(n(Y.text,[":",","])&&n(H.type,[i.STRING,i.WORD,i.RESERVED])||n(H.text,["get","set","..."])&&n(Y.type,[i.WORD,i.RESERVED]))?n(this._last_last_text,["class","interface"])&&!n(Y.text,[":",","])?this.set_mode(l.BlockStatement):this.set_mode(l.ObjectLiteral):this._flags.last_token.type===i.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(l.BlockStatement):n(this._flags.last_token.type,[i.EQUALS,i.START_EXPR,i.COMMA,i.OPERATOR])||b(this._flags.last_token,["return","throw","import","default"])?this.set_mode(l.ObjectLiteral):this.set_mode(l.BlockStatement),this._flags.last_token&&(b(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var ae=!H.comments_before&&H.text==="}",Z=ae&&this._flags.last_word==="function"&&this._flags.last_token.type===i.END_EXPR;if(this._options.brace_preserve_inline){var ce=0,de=null;this._flags.inline_frame=!0;do if(ce+=1,de=this._tokens.peek(ce-1),de.newlines){this._flags.inline_frame=!1;break}while(de.type!==i.EOF&&!(de.type===i.END_BLOCK&&de.opened===L))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&L.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==i.OPERATOR&&(Z||this._flags.last_token.type===i.EQUALS||b(this._flags.last_token,_)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(x(this._previous_flags.mode)&&(this._flags.last_token.type===i.START_EXPR||this._flags.last_token.type===i.COMMA)&&((this._flags.last_token.type===i.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===i.COMMA||this._flags.last_token.type===i.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(L),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==i.OPERATOR&&this._flags.last_token.type!==i.START_EXPR&&(this._flags.last_token.type===i.START_BLOCK&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(L),this.indent(),!ae&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},j.prototype.handle_end_block=function(L){for(this.handle_whitespace_and_comments(L);this._flags.mode===l.Statement;)this.restore_mode();var H=this._flags.last_token.type===i.START_BLOCK;this._flags.inline_frame&&!H?this._output.space_before_token=!0:this._options.brace_style==="expand"?H||this.print_newline():H||(x(this._flags.mode)&&this._options.keep_array_indentation?(this._options.keep_array_indentation=!1,this.print_newline(),this._options.keep_array_indentation=!0):this.print_newline()),this.restore_mode(),this.print_token(L)},j.prototype.handle_word=function(L){if(L.type===i.RESERVED){if(n(L.text,["set","get"])&&this._flags.mode!==l.ObjectLiteral)L.type=i.WORD;else if(L.text==="import"&&n(this._tokens.peek().text,["(","."]))L.type=i.WORD;else if(n(L.text,["as","from"])&&!this._flags.import_block)L.type=i.WORD;else if(this._flags.mode===l.ObjectLiteral){var H=this._tokens.peek();H.text===":"&&(L.type=i.WORD)}}if(this.start_of_statement(L)?b(this._flags.last_token,["var","let","const"])&&L.type===i.WORD&&(this._flags.declaration_statement=!0):L.newlines&&!R(this._flags.mode)&&(this._flags.last_token.type!==i.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==i.EQUALS&&(this._options.preserve_newlines||!b(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(L),this.print_newline()):this.handle_whitespace_and_comments(L),this._flags.do_block&&!this._flags.do_while)if(p(L,"while")){this._output.space_before_token=!0,this.print_token(L),this._output.space_before_token=!0,this._flags.do_while=!0;return}else this.print_newline(),this._flags.do_block=!1;if(this._flags.if_block)if(!this._flags.else_block&&p(L,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===l.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&b(L,["case","default"])){this.print_newline(),!this._flags.case_block&&(this._flags.case_body||this._options.jslint_happy)&&this.deindent(),this._flags.case_body=!1,this.print_token(L),this._flags.in_case=!0;return}if((this._flags.last_token.type===i.COMMA||this._flags.last_token.type===i.START_EXPR||this._flags.last_token.type===i.EQUALS||this._flags.last_token.type===i.OPERATOR)&&(this.start_of_object_property()||this.allow_wrap_or_preserved_newline(L)),p(L,"function")){(n(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(n(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===i.OPERATOR))&&(!this._output.just_added_blankline()&&!L.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===i.RESERVED||this._flags.last_token.type===i.WORD?b(this._flags.last_token,["get","set","new","export"])||b(this._flags.last_token,K)?this._output.space_before_token=!0:p(this._flags.last_token,"default")&&this._last_last_text==="export"?this._output.space_before_token=!0:this._flags.last_token.text==="declare"?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===i.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(R(this._flags.mode)||x(this._flags.mode))||this.print_newline(),this.print_token(L),this._flags.last_word=L.text;return}var Y="NONE";if(this._flags.last_token.type===i.END_BLOCK?this._previous_flags.inline_frame?Y="SPACE":b(L,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&L.newlines?Y="NEWLINE":(Y="SPACE",this._output.space_before_token=!0):Y="NEWLINE":this._flags.last_token.type===i.SEMICOLON&&this._flags.mode===l.BlockStatement?Y="NEWLINE":this._flags.last_token.type===i.SEMICOLON&&R(this._flags.mode)?Y="SPACE":this._flags.last_token.type===i.STRING?Y="NEWLINE":this._flags.last_token.type===i.RESERVED||this._flags.last_token.type===i.WORD||this._flags.last_token.text==="*"&&(n(this._last_last_text,["function","yield"])||this._flags.mode===l.ObjectLiteral&&n(this._last_last_text,["{",","]))?Y="SPACE":this._flags.last_token.type===i.START_BLOCK?this._flags.inline_frame?Y="SPACE":Y="NEWLINE":this._flags.last_token.type===i.END_EXPR&&(this._output.space_before_token=!0,Y="NEWLINE"),b(L,s)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?Y="SPACE":Y="NEWLINE"),b(L,["else","catch","finally"]))if((!(this._flags.last_token.type===i.END_BLOCK&&this._previous_flags.mode===l.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&L.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var ae=this._output.current_line;ae.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else Y==="NEWLINE"?b(this._flags.last_token,_)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&b(L,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==i.END_EXPR?(this._flags.last_token.type!==i.START_EXPR||!b(L,["var","let","const"]))&&this._flags.last_token.text!==":"&&(p(L,"if")&&p(L.previous,"else")?this._output.space_before_token=!0:this.print_newline()):b(L,s)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&x(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():Y==="SPACE"&&(this._output.space_before_token=!0);L.previous&&(L.previous.type===i.WORD||L.previous.type===i.RESERVED)&&(this._output.space_before_token=!0),this.print_token(L),this._flags.last_word=L.text,L.type===i.RESERVED&&(L.text==="do"?this._flags.do_block=!0:L.text==="if"?this._flags.if_block=!0:L.text==="import"?this._flags.import_block=!0:this._flags.import_block&&p(L,"from")&&(this._flags.import_block=!1))},j.prototype.handle_semicolon=function(L){this.start_of_statement(L)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(L);for(var H=this._tokens.peek();this._flags.mode===l.Statement&&!(this._flags.if_block&&p(H,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(L)},j.prototype.handle_string=function(L){L.text.startsWith("`")&&L.newlines===0&&L.whitespace_before===""&&(L.previous.text===")"||this._flags.last_token.type===i.WORD)||(this.start_of_statement(L)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(L),this._flags.last_token.type===i.RESERVED||this._flags.last_token.type===i.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===i.COMMA||this._flags.last_token.type===i.START_EXPR||this._flags.last_token.type===i.EQUALS||this._flags.last_token.type===i.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(L):L.text.startsWith("`")&&this._flags.last_token.type===i.END_EXPR&&(L.previous.text==="]"||L.previous.text===")")&&L.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(L)},j.prototype.handle_equals=function(L){this.start_of_statement(L)||this.handle_whitespace_and_comments(L),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(L),this._output.space_before_token=!0},j.prototype.handle_comma=function(L){this.handle_whitespace_and_comments(L,!0),this.print_token(L),this._output.space_before_token=!0,this._flags.declaration_statement?(R(this._flags.parent.mode)&&(this._flags.declaration_assignment=!1),this._flags.declaration_assignment?(this._flags.declaration_assignment=!1,this.print_newline(!1,!0)):this._options.comma_first&&this.allow_wrap_or_preserved_newline(L)):this._flags.mode===l.ObjectLiteral||this._flags.mode===l.Statement&&this._flags.parent.mode===l.ObjectLiteral?(this._flags.mode===l.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(L)},j.prototype.handle_operator=function(L){var H=L.text==="*"&&(b(this._flags.last_token,["function","yield"])||n(this._flags.last_token.type,[i.START_BLOCK,i.COMMA,i.END_BLOCK,i.SEMICOLON])),Y=n(L.text,["-","+"])&&(n(this._flags.last_token.type,[i.START_BLOCK,i.START_EXPR,i.EQUALS,i.OPERATOR])||n(this._flags.last_token.text,s)||this._flags.last_token.text===",");if(!this.start_of_statement(L)){var ae=!H;this.handle_whitespace_and_comments(L,ae)}if(L.text==="*"&&this._flags.last_token.type===i.DOT){this.print_token(L);return}if(L.text==="::"){this.print_token(L);return}if(this._flags.last_token.type===i.OPERATOR&&n(this._options.operator_position,r)&&this.allow_wrap_or_preserved_newline(L),L.text===":"&&this._flags.in_case){this.print_token(L),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==i.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0);return}var Z=!0,ce=!0,de=!1;if(L.text===":"?this._flags.ternary_depth===0?Z=!1:(this._flags.ternary_depth-=1,de=!0):L.text==="?"&&(this._flags.ternary_depth+=1),!Y&&!H&&this._options.preserve_newlines&&n(L.text,t)){var q=L.text===":",te=q&&de,he=q&&!de;switch(this._options.operator_position){case c.before_newline:this._output.space_before_token=!he,this.print_token(L),(!q||te)&&this.allow_wrap_or_preserved_newline(L),this._output.space_before_token=!0;return;case c.after_newline:this._output.space_before_token=!0,!q||te?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(L):this._output.space_before_token=!1,this.print_token(L),this._output.space_before_token=!0;return;case c.preserve_newline:he||this.allow_wrap_or_preserved_newline(L),Z=!(this._output.just_added_newline()||he),this._output.space_before_token=Z,this.print_token(L),this._output.space_before_token=!0;return}}if(H){this.allow_wrap_or_preserved_newline(L),Z=!1;var J=this._tokens.peek();ce=J&&n(J.type,[i.WORD,i.RESERVED])}else if(L.text==="...")this.allow_wrap_or_preserved_newline(L),Z=this._flags.last_token.type===i.START_BLOCK,ce=!1;else if(n(L.text,["--","++","!","~"])||Y){if((this._flags.last_token.type===i.COMMA||this._flags.last_token.type===i.START_EXPR)&&this.allow_wrap_or_preserved_newline(L),Z=!1,ce=!1,L.newlines&&(L.text==="--"||L.text==="++"||L.text==="~")){var X=b(this._flags.last_token,_)&&L.newlines;X&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(X,!0)}this._flags.last_token.text===";"&&R(this._flags.mode)&&(Z=!0),this._flags.last_token.type===i.RESERVED?Z=!0:this._flags.last_token.type===i.END_EXPR?Z=!(this._flags.last_token.text==="]"&&(L.text==="--"||L.text==="++")):this._flags.last_token.type===i.OPERATOR&&(Z=n(L.text,["--","-","++","+"])&&n(this._flags.last_token.text,["--","-","++","+"]),n(L.text,["+","-"])&&n(this._flags.last_token.text,["--","++"])&&(ce=!0)),(this._flags.mode===l.BlockStatement&&!this._flags.inline_frame||this._flags.mode===l.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||Z,this.print_token(L),this._output.space_before_token=ce},j.prototype.handle_block_comment=function(L,H){if(this._output.raw){this._output.add_raw_token(L),L.directives&&L.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(L.directives){this.print_newline(!1,H),this.print_token(L),L.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!o.newline.test(L.text)&&!L.newlines){this._output.space_before_token=!0,this.print_token(L),this._output.space_before_token=!0;return}else this.print_block_commment(L,H)},j.prototype.print_block_commment=function(L,H){var Y=f(L.text),ae,Z=!1,ce=!1,de=L.whitespace_before,q=de.length;if(this.print_newline(!1,H),this.print_token_line_indentation(L),this._output.add_token(Y[0]),this.print_newline(!1,H),Y.length>1){for(Y=Y.slice(1),Z=O(Y,"*"),ce=B(Y,de),Z&&(this._flags.alignment=1),ae=0;ae<Y.length;ae++)Z?(this.print_token_line_indentation(L),this._output.add_token(T(Y[ae]))):ce&&Y[ae]?(this.print_token_line_indentation(L),this._output.add_token(Y[ae].substring(q))):(this._output.current_line.set_indent(-1),this._output.add_token(Y[ae])),this.print_newline(!1,H);this._flags.alignment=0}},j.prototype.handle_comment=function(L,H){L.newlines?this.print_newline(!1,H):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(L),this.print_newline(!1,H)},j.prototype.handle_dot=function(L){this.start_of_statement(L)||this.handle_whitespace_and_comments(L,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),b(this._flags.last_token,_)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(L,this._flags.last_token.text===")"&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(L)},j.prototype.handle_unknown=function(L,H){this.print_token(L),L.text[L.text.length-1]===`
`&&this.print_newline(!1,H)},j.prototype.handle_eof=function(L){for(;this._flags.mode===l.Statement;)this.restore_mode();this.handle_whitespace_and_comments(L)},A.exports.Beautifier=j},function(A){function C(u){this.__parent=u,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}C.prototype.clone_empty=function(){var u=new C(this.__parent);return u.set_indent(this.__indent_count,this.__alignment_count),u},C.prototype.item=function(u){return u<0?this.__items[this.__items.length+u]:this.__items[u]},C.prototype.has_match=function(u){for(var o=this.__items.length-1;o>=0;o--)if(this.__items[o].match(u))return!0;return!1},C.prototype.set_indent=function(u,o){this.is_empty()&&(this.__indent_count=u||0,this.__alignment_count=o||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},C.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},C.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},C.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var u=this.__parent.current_line;return u.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),u.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),u.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,u.__items[0]===" "&&(u.__items.splice(0,1),u.__character_count-=1),!0}return!1},C.prototype.is_empty=function(){return this.__items.length===0},C.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},C.prototype.push=function(u){this.__items.push(u);var o=u.lastIndexOf(`
`);o!==-1?this.__character_count=u.length-o:this.__character_count+=u.length},C.prototype.pop=function(){var u=null;return this.is_empty()||(u=this.__items.pop(),this.__character_count-=u.length),u},C.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},C.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},C.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},C.prototype.toString=function(){var u="";return this.is_empty()?this.__parent.indent_empty_lines&&(u=this.__parent.get_indent_string(this.__indent_count)):(u=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),u+=this.__items.join("")),u};function y(u,o){this.__cache=[""],this.__indent_size=u.indent_size,this.__indent_string=u.indent_char,u.indent_with_tabs||(this.__indent_string=new Array(u.indent_size+1).join(u.indent_char)),o=o||"",u.indent_level>0&&(o=new Array(u.indent_level+1).join(this.__indent_string)),this.__base_string=o,this.__base_string_length=o.length}y.prototype.get_indent_size=function(u,o){var e=this.__base_string_length;return o=o||0,u<0&&(e=0),e+=u*this.__indent_size,e+=o,e},y.prototype.get_indent_string=function(u,o){var e=this.__base_string;return o=o||0,u<0&&(u=0,e=""),o+=u*this.__indent_size,this.__ensure_cache(o),e+=this.__cache[o],e},y.prototype.__ensure_cache=function(u){for(;u>=this.__cache.length;)this.__add_column()},y.prototype.__add_column=function(){var u=this.__cache.length,o=0,e="";this.__indent_size&&u>=this.__indent_size&&(o=Math.floor(u/this.__indent_size),u-=o*this.__indent_size,e=new Array(o+1).join(this.__indent_string)),u&&(e+=new Array(u+1).join(" ")),this.__cache.push(e)};function h(u,o){this.__indent_cache=new y(u,o),this.raw=!1,this._end_with_newline=u.end_with_newline,this.indent_size=u.indent_size,this.wrap_line_length=u.wrap_line_length,this.indent_empty_lines=u.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new C(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}h.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},h.prototype.get_line_number=function(){return this.__lines.length},h.prototype.get_indent_string=function(u,o){return this.__indent_cache.get_indent_string(u,o)},h.prototype.get_indent_size=function(u,o){return this.__indent_cache.get_indent_size(u,o)},h.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},h.prototype.add_new_line=function(u){return this.is_empty()||!u&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},h.prototype.get_code=function(u){this.trim(!0);var o=this.current_line.pop();o&&(o[o.length-1]===`
`&&(o=o.replace(/\n+$/g,"")),this.current_line.push(o)),this._end_with_newline&&this.__add_outputline();var e=this.__lines.join(`
`);return u!==`
`&&(e=e.replace(/[\n]/g,u)),e},h.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},h.prototype.set_indent=function(u,o){return u=u||0,o=o||0,this.next_line.set_indent(u,o),this.__lines.length>1?(this.current_line.set_indent(u,o),!0):(this.current_line.set_indent(),!1)},h.prototype.add_raw_token=function(u){for(var o=0;o<u.newlines;o++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(u.whitespace_before),this.current_line.push(u.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},h.prototype.add_token=function(u){this.__add_space_before_token(),this.current_line.push(u),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},h.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},h.prototype.remove_indent=function(u){for(var o=this.__lines.length;u<o;)this.__lines[u]._remove_indent(),u++;this.current_line._remove_wrap_indent()},h.prototype.trim=function(u){for(u=u===void 0?!1:u,this.current_line.trim();u&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},h.prototype.just_added_newline=function(){return this.current_line.is_empty()},h.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},h.prototype.ensure_empty_line_above=function(u,o){for(var e=this.__lines.length-2;e>=0;){var d=this.__lines[e];if(d.is_empty())break;if(d.item(0).indexOf(u)!==0&&d.item(-1)!==o){this.__lines.splice(e+1,0,new C(this)),this.previous_line=this.__lines[this.__lines.length-2];break}e--}},A.exports.Output=h},function(A){function C(y,h,u,o){this.type=y,this.text=h,this.comments_before=null,this.newlines=u||0,this.whitespace_before=o||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}A.exports.Token=C},function(A,C){var y="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",h="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",u="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc",o="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f",e="(?:\\\\u[0-9a-fA-F]{4}|["+y+u+"])",d="(?:\\\\u[0-9a-fA-F]{4}|["+h+u+o+"])*";C.identifier=new RegExp(e+d,"g"),C.identifierStart=new RegExp(e),C.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+h+u+o+"])+");var s=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;C.newline=/[\n\r\u2028\u2029]/,C.lineBreak=new RegExp(`\r
|`+C.newline.source),C.allLineBreaks=new RegExp(C.lineBreak.source,"g")},function(A,C,y){var h=y(6).Options,u=["before-newline","after-newline","preserve-newline"];function o(e){h.call(this,e,"js");var d=this.raw_options.brace_style||null;d==="expand-strict"?this.raw_options.brace_style="expand":d==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var s=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var t=0;t<s.length;t++)s[t]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=s[t];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",u),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}o.prototype=new h,A.exports.Options=o},function(A){function C(u,o){this.raw_options=y(u,o),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}C.prototype._get_array=function(u,o){var e=this.raw_options[u],d=o||[];return typeof e=="object"?e!==null&&typeof e.concat=="function"&&(d=e.concat()):typeof e=="string"&&(d=e.split(/[^a-zA-Z0-9_\/\-]+/)),d},C.prototype._get_boolean=function(u,o){var e=this.raw_options[u],d=e===void 0?!!o:!!e;return d},C.prototype._get_characters=function(u,o){var e=this.raw_options[u],d=o||"";return typeof e=="string"&&(d=e.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),d},C.prototype._get_number=function(u,o){var e=this.raw_options[u];o=parseInt(o,10),isNaN(o)&&(o=0);var d=parseInt(e,10);return isNaN(d)&&(d=o),d},C.prototype._get_selection=function(u,o,e){var d=this._get_selection_list(u,o,e);if(d.length!==1)throw new Error("Invalid Option Value: The option '"+u+`' can only be one of the following values:
`+o+`
You passed in: '`+this.raw_options[u]+"'");return d[0]},C.prototype._get_selection_list=function(u,o,e){if(!o||o.length===0)throw new Error("Selection list cannot be empty.");if(e=e||[o[0]],!this._is_valid_selection(e,o))throw new Error("Invalid Default Value!");var d=this._get_array(u,e);if(!this._is_valid_selection(d,o))throw new Error("Invalid Option Value: The option '"+u+`' can contain only the following values:
`+o+`
You passed in: '`+this.raw_options[u]+"'");return d},C.prototype._is_valid_selection=function(u,o){return u.length&&o.length&&!u.some(function(e){return o.indexOf(e)===-1})};function y(u,o){var e={};u=h(u);var d;for(d in u)d!==o&&(e[d]=u[d]);if(o&&u[o])for(d in u[o])e[d]=u[o][d];return e}function h(u){var o={},e;for(e in u){var d=e.replace(/-/g,"_");o[d]=u[e]}return o}A.exports.Options=C,A.exports.normalizeOpts=h,A.exports.mergeOpts=y},function(A,C,y){var h=y(8).InputScanner,u=y(9).Tokenizer,o=y(9).TOKEN,e=y(13).Directives,d=y(4),s=y(12).Pattern,t=y(14).TemplatablePattern;function i(O,B){return B.indexOf(O)!==-1}var n={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:o.START,RAW:o.RAW,EOF:o.EOF},T=new e(/\/\*/,/\*\//),m=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,p=/[0-9]/,b=/[^\d\.]/,_=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),a=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";a=a.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),a="\\?\\.(?!\\d) "+a,a=a.replace(/ /g,"|");var c=new RegExp(a),r="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),l=r.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),v=new RegExp("^(?:"+l.join("|")+")$"),f,x=function(O,B){u.call(this,O,B),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var j=new s(this._input),K=new t(this._input).read_options(this._options);this.__patterns={template:K,identifier:K.starting_with(d.identifier).matching(d.identifierMatch),number:j.matching(m),punct:j.matching(c),comment:j.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:j.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:j.matching(/<!--/),html_comment_end:j.matching(/-->/),include:j.starting_with(/#include/).until_after(d.lineBreak),shebang:j.starting_with(/#!/).until_after(d.lineBreak),xml:j.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),single_quote:K.until(/['\\\n\r\u2028\u2029]/),double_quote:K.until(/["\\\n\r\u2028\u2029]/),template_text:K.until(/[`\\$]/),template_expression:K.until(/[`}\\]/)}};x.prototype=new u,x.prototype._is_comment=function(O){return O.type===n.COMMENT||O.type===n.BLOCK_COMMENT||O.type===n.UNKNOWN},x.prototype._is_opening=function(O){return O.type===n.START_BLOCK||O.type===n.START_EXPR},x.prototype._is_closing=function(O,B){return(O.type===n.END_BLOCK||O.type===n.END_EXPR)&&B&&(O.text==="]"&&B.text==="["||O.text===")"&&B.text==="("||O.text==="}"&&B.text==="{")},x.prototype._reset=function(){f=!1},x.prototype._get_next_token=function(O,B){var j=null;this._readWhitespace();var K=this._input.peek();return K===null?this._create_token(n.EOF,""):(j=j||this._read_non_javascript(K),j=j||this._read_string(K),j=j||this._read_word(O),j=j||this._read_singles(K),j=j||this._read_comment(K),j=j||this._read_regexp(K,O),j=j||this._read_xml(K,O),j=j||this._read_punctuation(),j=j||this._create_token(n.UNKNOWN,this._input.next()),j)},x.prototype._read_word=function(O){var B;if(B=this.__patterns.identifier.read(),B!=="")return B=B.replace(d.allLineBreaks,`
`),!(O.type===n.DOT||O.type===n.RESERVED&&(O.text==="set"||O.text==="get"))&&v.test(B)?(B==="in"||B==="of")&&(O.type===n.WORD||O.type===n.STRING)?this._create_token(n.OPERATOR,B):this._create_token(n.RESERVED,B):this._create_token(n.WORD,B);if(B=this.__patterns.number.read(),B!=="")return this._create_token(n.WORD,B)},x.prototype._read_singles=function(O){var B=null;return O==="("||O==="["?B=this._create_token(n.START_EXPR,O):O===")"||O==="]"?B=this._create_token(n.END_EXPR,O):O==="{"?B=this._create_token(n.START_BLOCK,O):O==="}"?B=this._create_token(n.END_BLOCK,O):O===";"?B=this._create_token(n.SEMICOLON,O):O==="."&&b.test(this._input.peek(1))?B=this._create_token(n.DOT,O):O===","&&(B=this._create_token(n.COMMA,O)),B&&this._input.next(),B},x.prototype._read_punctuation=function(){var O=this.__patterns.punct.read();if(O!=="")return O==="="?this._create_token(n.EQUALS,O):O==="?."?this._create_token(n.DOT,O):this._create_token(n.OPERATOR,O)},x.prototype._read_non_javascript=function(O){var B="";if(O==="#"){if(this._is_first_token()&&(B=this.__patterns.shebang.read(),B))return this._create_token(n.UNKNOWN,B.trim()+`
`);if(B=this.__patterns.include.read(),B)return this._create_token(n.UNKNOWN,B.trim()+`
`);O=this._input.next();var j="#";if(this._input.hasNext()&&this._input.testChar(p)){do O=this._input.next(),j+=O;while(this._input.hasNext()&&O!=="#"&&O!=="=");return O==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(j+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(j+="{}",this._input.next(),this._input.next())),this._create_token(n.WORD,j)}this._input.back()}else if(O==="<"&&this._is_first_token()){if(B=this.__patterns.html_comment_start.read(),B){for(;this._input.hasNext()&&!this._input.testChar(d.newline);)B+=this._input.next();return f=!0,this._create_token(n.COMMENT,B)}}else if(f&&O==="-"&&(B=this.__patterns.html_comment_end.read(),B))return f=!1,this._create_token(n.COMMENT,B);return null},x.prototype._read_comment=function(O){var B=null;if(O==="/"){var j="";if(this._input.peek(1)==="*"){j=this.__patterns.block_comment.read();var K=T.get_directives(j);K&&K.ignore==="start"&&(j+=T.readIgnored(this._input)),j=j.replace(d.allLineBreaks,`
`),B=this._create_token(n.BLOCK_COMMENT,j),B.directives=K}else this._input.peek(1)==="/"&&(j=this.__patterns.comment.read(),B=this._create_token(n.COMMENT,j))}return B},x.prototype._read_string=function(O){if(O==="`"||O==="'"||O==='"'){var B=this._input.next();return this.has_char_escapes=!1,O==="`"?B+=this._read_string_recursive("`",!0,"${"):B+=this._read_string_recursive(O),this.has_char_escapes&&this._options.unescape_strings&&(B=R(B)),this._input.peek()===O&&(B+=this._input.next()),B=B.replace(d.allLineBreaks,`
`),this._create_token(n.STRING,B)}return null},x.prototype._allow_regexp_or_xml=function(O){return O.type===n.RESERVED&&i(O.text,["return","case","throw","else","do","typeof","yield"])||O.type===n.END_EXPR&&O.text===")"&&O.opened.previous.type===n.RESERVED&&i(O.opened.previous.text,["if","while","for"])||i(O.type,[n.COMMENT,n.START_EXPR,n.START_BLOCK,n.START,n.END_BLOCK,n.OPERATOR,n.EQUALS,n.EOF,n.SEMICOLON,n.COMMA])},x.prototype._read_regexp=function(O,B){if(O==="/"&&this._allow_regexp_or_xml(B)){for(var j=this._input.next(),K=!1,L=!1;this._input.hasNext()&&(K||L||this._input.peek()!==O)&&!this._input.testChar(d.newline);)j+=this._input.peek(),K?K=!1:(K=this._input.peek()==="\\",this._input.peek()==="["?L=!0:this._input.peek()==="]"&&(L=!1)),this._input.next();return this._input.peek()===O&&(j+=this._input.next(),j+=this._input.read(d.identifier)),this._create_token(n.STRING,j)}return null},x.prototype._read_xml=function(O,B){if(this._options.e4x&&O==="<"&&this._allow_regexp_or_xml(B)){var j="",K=this.__patterns.xml.read_match();if(K){for(var L=K[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),H=L.indexOf("{")===0,Y=0;K;){var ae=!!K[1],Z=K[2],ce=!!K[K.length-1]||Z.slice(0,8)==="![CDATA[";if(!ce&&(Z===L||H&&Z.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(ae?--Y:++Y),j+=K[0],Y<=0)break;K=this.__patterns.xml.read_match()}return K||(j+=this._input.match(/[\s\S]*/g)[0]),j=j.replace(d.allLineBreaks,`
`),this._create_token(n.STRING,j)}}return null};function R(O){for(var B="",j=0,K=new h(O),L=null;K.hasNext();)if(L=K.match(/([\s]|[^\\]|\\\\)+/g),L&&(B+=L[0]),K.peek()==="\\"){if(K.next(),K.peek()==="x")L=K.match(/x([0-9A-Fa-f]{2})/g);else if(K.peek()==="u")L=K.match(/u([0-9A-Fa-f]{4})/g);else{B+="\\",K.hasNext()&&(B+=K.next());continue}if(!L)return O;if(j=parseInt(L[1],16),j>126&&j<=255&&L[0].indexOf("x")===0)return O;if(j>=0&&j<32){B+="\\"+L[0];continue}else j===34||j===39||j===92?B+="\\"+String.fromCharCode(j):B+=String.fromCharCode(j)}return B}x.prototype._read_string_recursive=function(O,B,j){var K,L;O==="'"?L=this.__patterns.single_quote:O==='"'?L=this.__patterns.double_quote:O==="`"?L=this.__patterns.template_text:O==="}"&&(L=this.__patterns.template_expression);for(var H=L.read(),Y="";this._input.hasNext();){if(Y=this._input.next(),Y===O||!B&&d.newline.test(Y)){this._input.back();break}else Y==="\\"&&this._input.hasNext()?(K=this._input.peek(),K==="x"||K==="u"?this.has_char_escapes=!0:K==="\r"&&this._input.peek(1)===`
`&&this._input.next(),Y+=this._input.next()):j&&(j==="${"&&Y==="$"&&this._input.peek()==="{"&&(Y+=this._input.next()),j===Y&&(O==="`"?Y+=this._read_string_recursive("}",B,"`"):Y+=this._read_string_recursive("`",B,"${"),this._input.hasNext()&&(Y+=this._input.next())));Y+=L.read(),H+=Y}return H},A.exports.Tokenizer=x,A.exports.TOKEN=n,A.exports.positionable_operators=_.slice(),A.exports.line_starters=r.slice()},function(A){var C=RegExp.prototype.hasOwnProperty("sticky");function y(h){this.__input=h||"",this.__input_length=this.__input.length,this.__position=0}y.prototype.restart=function(){this.__position=0},y.prototype.back=function(){this.__position>0&&(this.__position-=1)},y.prototype.hasNext=function(){return this.__position<this.__input_length},y.prototype.next=function(){var h=null;return this.hasNext()&&(h=this.__input.charAt(this.__position),this.__position+=1),h},y.prototype.peek=function(h){var u=null;return h=h||0,h+=this.__position,h>=0&&h<this.__input_length&&(u=this.__input.charAt(h)),u},y.prototype.__match=function(h,u){h.lastIndex=u;var o=h.exec(this.__input);return o&&!(C&&h.sticky)&&(o.index!==u&&(o=null)),o},y.prototype.test=function(h,u){return u=u||0,u+=this.__position,u>=0&&u<this.__input_length?!!this.__match(h,u):!1},y.prototype.testChar=function(h,u){var o=this.peek(u);return h.lastIndex=0,o!==null&&h.test(o)},y.prototype.match=function(h){var u=this.__match(h,this.__position);return u?this.__position+=u[0].length:u=null,u},y.prototype.read=function(h,u,o){var e="",d;return h&&(d=this.match(h),d&&(e+=d[0])),u&&(d||!h)&&(e+=this.readUntil(u,o)),e},y.prototype.readUntil=function(h,u){var o="",e=this.__position;h.lastIndex=this.__position;var d=h.exec(this.__input);return d?(e=d.index,u&&(e+=d[0].length)):e=this.__input_length,o=this.__input.substring(this.__position,e),this.__position=e,o},y.prototype.readUntilAfter=function(h){return this.readUntil(h,!0)},y.prototype.get_regexp=function(h,u){var o=null,e="g";return u&&C&&(e="y"),typeof h=="string"&&h!==""?o=new RegExp(h,e):h&&(o=new RegExp(h.source,e)),o},y.prototype.get_literal_regexp=function(h){return RegExp(h.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},y.prototype.peekUntilAfter=function(h){var u=this.__position,o=this.readUntilAfter(h);return this.__position=u,o},y.prototype.lookBack=function(h){var u=this.__position-1;return u>=h.length&&this.__input.substring(u-h.length,u).toLowerCase()===h},A.exports.InputScanner=y},function(A,C,y){var h=y(8).InputScanner,u=y(3).Token,o=y(10).TokenStream,e=y(11).WhitespacePattern,d={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},s=function(t,i){this._input=new h(t),this._options=i||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new e(this._input)};s.prototype.tokenize=function(){this._input.restart(),this.__tokens=new o,this._reset();for(var t,i=new u(d.START,""),n=null,T=[],m=new o;i.type!==d.EOF;){for(t=this._get_next_token(i,n);this._is_comment(t);)m.add(t),t=this._get_next_token(i,n);m.isEmpty()||(t.comments_before=m,m=new o),t.parent=n,this._is_opening(t)?(T.push(n),n=t):n&&this._is_closing(t,n)&&(t.opened=n,n.closed=t,n=T.pop(),t.parent=n),t.previous=i,i.next=t,this.__tokens.add(t),i=t}return this.__tokens},s.prototype._is_first_token=function(){return this.__tokens.isEmpty()},s.prototype._reset=function(){},s.prototype._get_next_token=function(t,i){this._readWhitespace();var n=this._input.read(/.+/g);return n?this._create_token(d.RAW,n):this._create_token(d.EOF,"")},s.prototype._is_comment=function(t){return!1},s.prototype._is_opening=function(t){return!1},s.prototype._is_closing=function(t,i){return!1},s.prototype._create_token=function(t,i){var n=new u(t,i,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return n},s.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},A.exports.Tokenizer=s,A.exports.TOKEN=d},function(A){function C(y){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=y}C.prototype.restart=function(){this.__position=0},C.prototype.isEmpty=function(){return this.__tokens_length===0},C.prototype.hasNext=function(){return this.__position<this.__tokens_length},C.prototype.next=function(){var y=null;return this.hasNext()&&(y=this.__tokens[this.__position],this.__position+=1),y},C.prototype.peek=function(y){var h=null;return y=y||0,y+=this.__position,y>=0&&y<this.__tokens_length&&(h=this.__tokens[y]),h},C.prototype.add=function(y){this.__parent_token&&(y.parent=this.__parent_token),this.__tokens.push(y),this.__tokens_length+=1},A.exports.TokenStream=C},function(A,C,y){var h=y(12).Pattern;function u(o,e){h.call(this,o,e),e?this._line_regexp=this._input.get_regexp(e._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}u.prototype=new h,u.prototype.__set_whitespace_patterns=function(o,e){o+="\\t ",e+="\\n\\r",this._match_pattern=this._input.get_regexp("["+o+e+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+e+"]")},u.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var o=this._input.read(this._match_pattern);if(o===" ")this.whitespace_before_token=" ";else if(o){var e=this.__split(this._newline_regexp,o);this.newline_count=e.length-1,this.whitespace_before_token=e[this.newline_count]}return o},u.prototype.matching=function(o,e){var d=this._create();return d.__set_whitespace_patterns(o,e),d._update(),d},u.prototype._create=function(){return new u(this._input,this)},u.prototype.__split=function(o,e){o.lastIndex=0;for(var d=0,s=[],t=o.exec(e);t;)s.push(e.substring(d,t.index)),d=t.index+t[0].length,t=o.exec(e);return d<e.length?s.push(e.substring(d,e.length)):s.push(""),s},A.exports.WhitespacePattern=u},function(A){function C(y,h){this._input=y,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,h&&(this._starting_pattern=this._input.get_regexp(h._starting_pattern,!0),this._match_pattern=this._input.get_regexp(h._match_pattern,!0),this._until_pattern=this._input.get_regexp(h._until_pattern),this._until_after=h._until_after)}C.prototype.read=function(){var y=this._input.read(this._starting_pattern);return(!this._starting_pattern||y)&&(y+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),y},C.prototype.read_match=function(){return this._input.match(this._match_pattern)},C.prototype.until_after=function(y){var h=this._create();return h._until_after=!0,h._until_pattern=this._input.get_regexp(y),h._update(),h},C.prototype.until=function(y){var h=this._create();return h._until_after=!1,h._until_pattern=this._input.get_regexp(y),h._update(),h},C.prototype.starting_with=function(y){var h=this._create();return h._starting_pattern=this._input.get_regexp(y,!0),h._update(),h},C.prototype.matching=function(y){var h=this._create();return h._match_pattern=this._input.get_regexp(y,!0),h._update(),h},C.prototype._create=function(){return new C(this._input,this)},C.prototype._update=function(){},A.exports.Pattern=C},function(A){function C(y,h){y=typeof y=="string"?y:y.source,h=typeof h=="string"?h:h.source,this.__directives_block_pattern=new RegExp(y+/ beautify( \w+[:]\w+)+ /.source+h,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(y+/\sbeautify\signore:end\s/.source+h,"g")}C.prototype.get_directives=function(y){if(!y.match(this.__directives_block_pattern))return null;var h={};this.__directive_pattern.lastIndex=0;for(var u=this.__directive_pattern.exec(y);u;)h[u[1]]=u[2],u=this.__directive_pattern.exec(y);return h},C.prototype.readIgnored=function(y){return y.readUntilAfter(this.__directives_end_ignore_pattern)},A.exports.Directives=C},function(A,C,y){var h=y(12).Pattern,u={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function o(e,d){h.call(this,e,d),this.__template_pattern=null,this._disabled=Object.assign({},u),this._excluded=Object.assign({},u),d&&(this.__template_pattern=this._input.get_regexp(d.__template_pattern),this._excluded=Object.assign(this._excluded,d._excluded),this._disabled=Object.assign(this._disabled,d._disabled));var s=new h(e);this.__patterns={handlebars_comment:s.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:s.starting_with(/{{{/).until_after(/}}}/),handlebars:s.starting_with(/{{/).until_after(/}}/),php:s.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:s.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:s.starting_with(/{%/).until_after(/%}/),django_value:s.starting_with(/{{/).until_after(/}}/),django_comment:s.starting_with(/{#/).until_after(/#}/),smarty:s.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:s.starting_with(/{\*/).until_after(/\*}/),smarty_literal:s.starting_with(/{literal}/).until_after(/{\/literal}/)}}o.prototype=new h,o.prototype._create=function(){return new o(this._input,this)},o.prototype._update=function(){this.__set_templated_pattern()},o.prototype.disable=function(e){var d=this._create();return d._disabled[e]=!0,d._update(),d},o.prototype.read_options=function(e){var d=this._create();for(var s in u)d._disabled[s]=e.templating.indexOf(s)===-1;return d._update(),d},o.prototype.exclude=function(e){var d=this._create();return d._excluded[e]=!0,d._update(),d},o.prototype.read=function(){var e="";this._match_pattern?e=this._input.read(this._starting_pattern):e=this._input.read(this._starting_pattern,this.__template_pattern);for(var d=this._read_template();d;)this._match_pattern?d+=this._input.read(this._match_pattern):d+=this._input.readUntil(this.__template_pattern),e+=d,d=this._read_template();return this._until_after&&(e+=this._input.readUntilAfter(this._until_pattern)),e},o.prototype.__set_templated_pattern=function(){var e=[];this._disabled.php||e.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||e.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||e.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(e.push(this.__patterns.django._starting_pattern.source),e.push(this.__patterns.django_value._starting_pattern.source),e.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||e.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&e.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+e.join("|")+")")},o.prototype._read_template=function(){var e="",d=this._input.peek();if(d==="<"){var s=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&s==="?"&&(e=e||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&s==="%"&&(e=e||this.__patterns.erb.read())}else d==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(e=e||this.__patterns.handlebars_comment.read(),e=e||this.__patterns.handlebars_unescaped.read(),e=e||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(e=e||this.__patterns.django_value.read()),this._excluded.django||(e=e||this.__patterns.django_comment.read(),e=e||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(e=e||this.__patterns.smarty_comment.read(),e=e||this.__patterns.smarty_literal.read(),e=e||this.__patterns.smarty.read()));return e},A.exports.TemplatablePattern=o}],I={};function N(A){var C=I[A];if(C!==void 0)return C.exports;var y=I[A]={exports:{}};return S[A](y,y.exports,N),y.exports}var k=N(0);w=k})();var U=w;!(_e=[],F=function(){return{js_beautify:U}}.apply($e,_e),F!==void 0&&(at.exports=F))})()},"815F":function(at,$e,z){"use strict";z.d($e,"e",function(){return N}),z.d($e,"c",function(){return A}),z.d($e,"d",function(){return C}),z.d($e,"a",function(){return h}),z.d($e,"f",function(){return u}),z.d($e,"b",function(){return o});var _e=z("KQm4"),F=z("VTBJ"),w=z("Ff2n"),U=z("Zm9Q"),S=z("Kwbf"),I=z("OZM5");function N(e,d){return e!=null?e:d}function k(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],d=new Map;function s(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(t||[]).forEach(function(n){var T=n.key,m=n.children;Object(S.a)(T!=null,"Tree node must have a certain key: [".concat(i).concat(T,"]"));var p=String(T);Object(S.a)(!d.has(p)||T===null||T===void 0,"Same 'key' exist in the Tree: ".concat(p)),d.set(p,!0),s(m,"".concat(i).concat(p," > "))})}s(e)}function A(e){function d(s){var t=Object(U.a)(s);return t.map(function(i){if(!Object(I.i)(i))return Object(S.a)(!i,"Tree/TreeNode can only accept TreeNode as children."),null;var n=i.key,T=i.props,m=T.children,p=Object(w.a)(T,["children"]),b=Object(F.a)({key:n},p),_=d(m);return _.length&&(b.children=_),b}).filter(function(i){return i})}return d(e)}function C(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],s=new Set(d===!0?[]:d),t=[];function i(n){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return n.map(function(m,p){var b=Object(I.h)(T?T.pos:"0",p),_=N(m.key,b),a=Object(F.a)(Object(F.a)({},m),{},{parent:T,pos:b,children:null,data:m,isStart:[].concat(Object(_e.a)(T?T.isStart:[]),[p===0]),isEnd:[].concat(Object(_e.a)(T?T.isEnd:[]),[p===n.length-1])});return t.push(a),d===!0||s.has(_)?a.children=i(m.children||[],a):a.children=[],a})}return i(e),t}function y(e,d,s){var t;s?typeof s=="string"?t=function(T){return T[s]}:typeof s=="function"&&(t=function(T){return s(T)}):t=function(T,m){return N(T.key,m)};function i(n,T,m){var p=n?n.children:e,b=n?Object(I.h)(m.pos,T):"0";if(n){var _=t(n,b),a={node:n,index:T,pos:b,key:_,parentPos:m.node?m.pos:null,level:m.level+1};d(a)}p&&p.forEach(function(c,r){i(c,r,{node:n,pos:b,level:m?m.level+1:-1})})}i(null)}function h(e){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=d.initWrapper,t=d.processEntity,i=d.onProcessFinished,n=arguments.length>2?arguments[2]:void 0,T={},m={},p={posEntities:T,keyEntities:m};return s&&(p=s(p)||p),y(e,function(b){var _=b.node,a=b.index,c=b.pos,r=b.key,l=b.parentPos,v=b.level,f={node:_,index:a,key:r,pos:c,level:v},x=N(r,c);T[c]=f,m[x]=f,f.parent=T[l],f.parent&&(f.parent.children=f.parent.children||[],f.parent.children.push(f)),t&&t(f,p)},n),i&&i(p),p}function u(e,d){var s=d.expandedKeys,t=d.selectedKeys,i=d.loadedKeys,n=d.loadingKeys,T=d.checkedKeys,m=d.halfCheckedKeys,p=d.dragOverNodeKey,b=d.dropPosition,_=d.keyEntities,a=_[e],c={eventKey:e,expanded:s.indexOf(e)!==-1,selected:t.indexOf(e)!==-1,loaded:i.indexOf(e)!==-1,loading:n.indexOf(e)!==-1,checked:T.indexOf(e)!==-1,halfChecked:m.indexOf(e)!==-1,pos:String(a?a.pos:""),dragOver:p===e&&b===0,dragOverGapTop:p===e&&b===-1,dragOverGapBottom:p===e&&b===1};return c}function o(e){var d=e.data,s=e.expanded,t=e.selected,i=e.checked,n=e.loaded,T=e.loading,m=e.halfChecked,p=e.dragOver,b=e.dragOverGapTop,_=e.dragOverGapBottom,a=e.pos,c=e.active,r=Object(F.a)(Object(F.a)({},d),{},{expanded:s,selected:t,checked:i,loaded:n,loading:T,halfChecked:m,dragOver:p,dragOverGapTop:b,dragOverGapBottom:_,pos:a,active:c});return"props"in r||Object.defineProperty(r,"props",{get:function(){return Object(S.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),e}}),r}},"8hTe":function(at,$e,z){at.exports={button:"button___1wy9m"}},"9Bee":function(at,$e,z){"use strict";var _e=z("DYRE"),F=z("zeV3"),w=z("+L6B"),U=z("2/Rp"),S=z("k1fw"),I=z("9og8"),N=z("tJVT"),k=z("WmNS"),A=z.n(k),C=z("q1tI"),y=z.n(C),h=z("vg9a"),u=z("DlQD"),o=z.n(u),e=z("rUJ1");function d(M,g){var E=M.match(/^(\s+)(?:```)/);if(E===null)return g;var D=E[1];return g.split(`
`).map(function(W){var P=W.match(/^\s+/);if(P===null)return W;var pe=Object(N.a)(P,1),Fe=pe[0];return Fe.length>=D.length?W.slice(D.length):W}).join(`
`)}var s=[],t=["<ul>"],i=new o.a.Renderer,n=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function T(){s.length=0,t=["<ul>"]}var m={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function p(M,g,E,D){if(g>=M.length||M[g].level<=E)return g;var W=M[g];D.push("<li><a href='#"+W.anchor+"'>"+W.text+"</a>"),g++;var P=[];return g=p(M,g,W.level,P),P.length>0&&(D.push("<ul>"),P.forEach(function(pe){D.push(pe)}),D.push("</ul>")),D.push("</li>"),g=p(M,g,E,D),g}function b(){return p(s,0,0,t),t.push("</ul>"),t.join("")}var _={heading:function(g){var E=n.exec(g);if(E)return{type:"heading",raw:E[0],depth:E[1].length,text:E[2]}},fences:function(g){var E=this.rules.block.fences.exec(g);if(E){var D=E[0],W=d(D,E[3]||""),P=E[2]?E[2].trim():E[2];if(["latex","katex","math"].indexOf(P)>=0){var pe=r(),Fe=W;W=pe,l[pe]={type:"block",expression:Fe}}return{type:"code",raw:D,lang:P,text:W}}}},a=/(?:\${2})([^\n`]+?)(?:\${2})/gi,c=0,r=function(){return"__special_katext_id_".concat(c++,"__")},l={};function v(){return l}function f(){c=0,l={}}function x(M){return M=M.replace(a,function(g,E){var D=r();return l[D]={type:"inline",expression:E},D}),M}var R=i.listitem;i.listitem=function(M){return R(x(M))};var O=i.paragraph;i.paragraph=function(M){return O(x(M))};var B=i.tablecell;i.tablecell=function(M,g){return B(x(M),g)},i.code=function(M,g,E){var D=(g||"").match(/\S*/)[0];return D?["latex","katex","math"].indexOf(D)>=0?"<p class='editormd-tex'>".concat(M,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(g,'">').concat(E?M:Object(e.escape)(M,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(E?M:Object(e.escape)(M,!0))+"</code></pre>"},i.heading=function(M,g,E){var D=this.options.headerPrefix+E.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return s.push({anchor:D,level:g,text:M}),"<h"+g+' id="'+D+'">'+M+"</h"+g+">"},o.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),o.a.use({tokenizer:_,renderer:i});var j=o.a,K=z("SJMd"),L=z("ulZh"),H=z.n(L),Y=z("m3rI"),ae=z("Oy/b"),Z=z("p5ED"),ce=z("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 de=function(M,g){return(de=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,D){E.__proto__=D}||function(E,D){for(var W in D)Object.prototype.hasOwnProperty.call(D,W)&&(E[W]=D[W])})(M,g)};function q(M,g){function E(){this.constructor=M}de(M,g),M.prototype=g===null?Object.create(g):(E.prototype=g.prototype,new E)}function te(M,g,E,D){return new(E||(E=Promise))(function(W,P){function pe(st){try{it(D.next(st))}catch(He){P(He)}}function Fe(st){try{it(D.throw(st))}catch(He){P(He)}}function it(st){var He;st.done?W(st.value):(He=st.value,He instanceof E?He:new E(function(gt){gt(He)})).then(pe,Fe)}it((D=D.apply(M,g||[])).next())})}function he(M,g){var E,D,W,P,pe={label:0,sent:function(){if(1&W[0])throw W[1];return W[1]},trys:[],ops:[]};return P={next:Fe(0),throw:Fe(1),return:Fe(2)},typeof Symbol=="function"&&(P[Symbol.iterator]=function(){return this}),P;function Fe(it){return function(st){return function(He){if(E)throw new TypeError("Generator is already executing.");for(;pe;)try{if(E=1,D&&(W=2&He[0]?D.return:He[0]?D.throw||((W=D.return)&&W.call(D),0):D.next)&&!(W=W.call(D,He[1])).done)return W;switch(D=0,W&&(He=[2&He[0],W.value]),He[0]){case 0:case 1:W=He;break;case 4:return pe.label++,{value:He[1],done:!1};case 5:pe.label++,D=He[1],He=[0];continue;case 7:He=pe.ops.pop(),pe.trys.pop();continue;default:if(!(W=pe.trys,(W=W.length>0&&W[W.length-1])||He[0]!==6&&He[0]!==2)){pe=0;continue}if(He[0]===3&&(!W||He[1]>W[0]&&He[1]<W[3])){pe.label=He[1];break}if(He[0]===6&&pe.label<W[1]){pe.label=W[1],W=He;break}if(W&&pe.label<W[2]){pe.label=W[2],pe.ops.push(He);break}W[2]&&pe.ops.pop(),pe.trys.pop();continue}He=g.call(M,pe)}catch(gt){He=[6,gt],D=0}finally{E=W=0}if(5&He[0])throw He[1];return{value:He[0]?He[1]:void 0,done:!0}}([it,st])}}}function J(){for(var M=0,g=0,E=arguments.length;g<E;g++)M+=arguments[g].length;var D=Array(M),W=0;for(g=0;g<E;g++)for(var P=arguments[g],pe=0,Fe=P.length;pe<Fe;pe++,W++)D[W]=P[pe];return D}var X=function(){function M(){}return M.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},M.setAttributes=function(g,E){for(var D=0,W=E;D<W.length;D++){var P=W[D],pe=P[0],Fe=P[1];g.setAttribute(pe,Fe)}},M.createRect=function(g,E,D){var W=document.createElementNS("http://www.w3.org/2000/svg","rect");return W.setAttribute("width",g.toString()),W.setAttribute("height",E.toString()),D&&M.setAttributes(W,D),W},M.createLine=function(g,E,D,W,P){var pe=document.createElementNS("http://www.w3.org/2000/svg","line");return pe.setAttribute("x1",g.toString()),pe.setAttribute("y1",E.toString()),pe.setAttribute("x2",D.toString()),pe.setAttribute("y2",W.toString()),P&&M.setAttributes(pe,P),pe},M.createPolygon=function(g,E){var D=document.createElementNS("http://www.w3.org/2000/svg","polygon");return D.setAttribute("points",g),E&&M.setAttributes(D,E),D},M.createCircle=function(g,E){var D=document.createElementNS("http://www.w3.org/2000/svg","circle");return D.setAttribute("cx",(g/2).toString()),D.setAttribute("cy",(g/2).toString()),D.setAttribute("r",g.toString()),E&&M.setAttributes(D,E),D},M.createEllipse=function(g,E,D){var W=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return W.setAttribute("cx",(g/2).toString()),W.setAttribute("cy",(E/2).toString()),W.setAttribute("rx",(g/2).toString()),W.setAttribute("ry",(E/2).toString()),D&&M.setAttributes(W,D),W},M.createGroup=function(g){var E=document.createElementNS("http://www.w3.org/2000/svg","g");return g&&M.setAttributes(E,g),E},M.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},M.createMarker=function(g,E,D,W,P,pe,Fe){var it=document.createElementNS("http://www.w3.org/2000/svg","marker");return M.setAttributes(it,[["id",g],["orient",E],["markerWidth",D.toString()],["markerHeight",W.toString()],["refX",P.toString()],["refY",pe.toString()]]),it.appendChild(Fe),it},M.createText=function(g){var E=document.createElementNS("http://www.w3.org/2000/svg","text");return E.setAttribute("x","0"),E.setAttribute("y","0"),g&&M.setAttributes(E,g),E},M.createTSpan=function(g,E){var D=document.createElementNS("http://www.w3.org/2000/svg","tspan");return D.textContent=g,E&&M.setAttributes(D,E),D},M.createImage=function(g){var E=document.createElementNS("http://www.w3.org/2000/svg","image");return g&&M.setAttributes(E,g),E},M.createPoint=function(g,E){var D=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return D.x=g,D.y=E,D},M.createPath=function(g,E){var D=document.createElementNS("http://www.w3.org/2000/svg","path");return D.setAttribute("d",g),E&&M.setAttributes(D,E),D},M}(),ye=function(){function M(){}return M.addKey=function(g){M.key=g},Object.defineProperty(M,"isLicensed",{get:function(){return!!M.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(M.key)},enumerable:!1,configurable:!0}),M}(),we=function(){function M(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return M.prototype.rasterize=function(g,E,D){var W=this;return new Promise(function(P){var pe=D!==void 0?D:document.createElement("canvas");g===null&&(W.markersOnly=!0,W.naturalSize=!1);var Fe=document.createElementNS("http://www.w3.org/2000/svg","svg");Fe.setAttribute("xmlns","http://www.w3.org/2000/svg"),Fe.setAttribute("width",E.width.baseVal.valueAsString),Fe.setAttribute("height",E.height.baseVal.valueAsString),Fe.setAttribute("viewBox","0 0 "+E.viewBox.baseVal.width.toString()+" "+E.viewBox.baseVal.height.toString()),Fe.innerHTML=E.innerHTML,W.naturalSize===!0?(Fe.width.baseVal.value=g.naturalWidth,Fe.height.baseVal.value=g.naturalHeight):W.width!==void 0&&W.height!==void 0&&(Fe.width.baseVal.value=W.width,Fe.height.baseVal.value=W.height),pe.width=Fe.width.baseVal.value,pe.height=Fe.height.baseVal.value;var it=Fe.outerHTML,st=pe.getContext("2d");W.markersOnly!==!0&&st.drawImage(g,0,0,pe.width,pe.height);var He=window.URL,gt=new Image(pe.width,pe.height);gt.setAttribute("crossOrigin","anonymous");var jt=new Blob([it],{type:"image/svg+xml"}),Yt=He.createObjectURL(jt);gt.onload=function(){st.drawImage(gt,0,0),He.revokeObjectURL(Yt);var Oi=pe.toDataURL(W.imageType,W.imageQuality);P(Oi)},gt.src=Yt})},M}(),Le=function(){},xe=function(){function M(g){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+g+"_"}return Object.defineProperty(M.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(M.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(M.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),M.prototype.addClass=function(g){return this.styleSheet===void 0&&this.addStyleSheet(),g.name=""+this.classNamePrefix+g.localName,this.classes.push(g),this.styleSheet.sheet.insertRule("."+g.name+" {"+g.style+"}",this.styleSheet.sheet.cssRules.length),g},M.prototype.addRule=function(g){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(g),this.styleSheet.sheet.insertRule(g.selector+" {"+g.style+"}",this.styleSheet.sheet.cssRules.length)},M.prototype.addStyleSheet=function(){var g;this.styleSheet=document.createElement("style"),((g=this.styleSheetRoot)!==null&&g!==void 0?g:document.head).appendChild(this.styleSheet),this.addRule(new Re("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Re("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new Re("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new Te("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new Te("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},M.prototype.removeStyleSheet=function(){var g;this.styleSheet&&(((g=this.styleSheetRoot)!==null&&g!==void 0?g:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},M}(),Re=function(M,g){this.selector=M,this.style=g},Te=function(M,g){this.localName=M,this.style=g},Oe=function(){function M(g,E,D,W,P){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=g,this.displayMode=E,this.markerItems=D,this.uiStyleSettings=W,this.styles=P,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return M.prototype.show=function(g){var E=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=g,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var D=document.createElement("div");D.className=this.toolbarBlockStyleClass.name,D.style.whiteSpace="nowrap",this.uiContainer.appendChild(D),this.addActionButton(D,'<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(D,'<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(D,'<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(D,'<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(D,'<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(D,'<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(D,'<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(D,'<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(P){var pe=document.createElement("div");pe.className=""+E.toolbarButtonStyleClass.name,pe.setAttribute("data-type-name",P.typeName),pe.innerHTML=P.icon,pe.addEventListener("click",function(){E.markerToolbarButtonClicked(pe,P)}),E.buttons.push(pe),E.markerButtons.push(pe)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<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 W=document.createElement("div");W.className=this.toolbarBlockStyleClass.name,W.style.whiteSpace="nowrap",W.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(W),this.addActionButton(W,'<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(W,'<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()},M.prototype.addButtonClickListener=function(g){this.buttonClickListeners.push(g)},M.prototype.removeButtonClickListener=function(g){this.buttonClickListeners.indexOf(g)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(g),1)},M.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},M.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var g=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var E=0;E<this.markerButtons.length;E++)E<g||E===g&&this.markerButtons.length-1===g?this.markerButtonBlock.appendChild(this.markerButtons[E]):(E===g&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[E]))}},M.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")},M.prototype.resetButtonStyles=function(){var g=this;this.buttons.forEach(function(E){E.className=E.className.replace(g.uiStyleSettings.toolbarButtonStyleColorsClassName?g.uiStyleSettings.toolbarButtonStyleColorsClassName:g.toolbarButtonStyleColorsClass.name,"").trim(),E.className=E.className.replace(g.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?g.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:g.toolbarActiveButtonStyleColorsClass.name,"").trim(),E.className+=" "+(g.uiStyleSettings.toolbarButtonStyleColorsClassName?g.uiStyleSettings.toolbarButtonStyleColorsClassName:g.toolbarButtonStyleColorsClass.name)})},M.prototype.addActionButton=function(g,E,D){var W=this,P=document.createElement("div");switch(P.className=""+this.toolbarButtonStyleClass.name,P.innerHTML=E,P.setAttribute("data-action",D),P.addEventListener("click",function(){W.actionToolbarButtonClicked(P,D)}),D){case"select":P.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":P.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":P.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":P.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":P.style.fill=this.uiStyleSettings.closeButtonColor}g.appendChild(P),this.buttons.push(P)},M.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Te("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 Te("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Te("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new Te("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 Te("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var g=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Te("toolbar_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.toolbarButtonStyleColorsClass=this.styles.addClass(new Te("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Te("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Re("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new Re("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},M.prototype.markerToolbarButtonClicked=function(g,E){this.setActiveButton(g),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(D){return D("marker",E)}),this.markerButtonOverflowBlock.style.display="none"},M.prototype.actionToolbarButtonClicked=function(g,E){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(D){return D("action",E)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},M.prototype.setActiveButton=function(g){this.resetButtonStyles(),g.className=g.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),g.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},M.prototype.setActiveMarkerButton=function(g){var E=this.markerButtons.find(function(D){return D.getAttribute("data-type-name")===g});E&&this.setActiveButton(E)},M.prototype.setCurrentMarker=function(g){var E=this;this.currentMarker=g,this.buttons.filter(function(D){return/delete|notes/.test(D.getAttribute("data-action"))}).forEach(function(D){E.currentMarker===void 0?(D.style.fillOpacity="0.4",D.style.pointerEvents="none"):(D.style.fillOpacity="1",D.style.pointerEvents="all")})},M}(),Ie=function(){function M(g,E,D,W){this.panels=[],this.panelButtons=[],this.markerjsContainer=g,this.displayMode=E,this.uiStyleSettings=D,this.styles=W,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return M.prototype.addStyles=function(){var g;this.toolboxStyleClass=this.styles.addClass(new Te("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 Te("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var E=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Te("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Te("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Te("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 Te("toolbox-panel-row_colors",`
background-color: `+((g=this.uiStyleSettings.toolboxBackgroundColor)!==null&&g!==void 0?g:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new Te("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*E)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*E)+`px;
padding: `+E+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Te("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Te("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new Re("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Re("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},M.prototype.show=function(g){var E;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=g,this.uiContainer.className=this.toolboxStyleClass.name+" "+((E=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&E!==void 0?E:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},M.prototype.setPanelButtons=function(g){var E,D,W=this;this.panels=g,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((E=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&E!==void 0?E:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((D=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&D!==void 0?D:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(P){var pe;P.uiStyleSettings=W.uiStyleSettings;var Fe=document.createElement("div");Fe.className=W.toolboxButtonStyleClass.name+" "+((pe=W.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&pe!==void 0?pe:W.toolboxButtonStyleColorsClass.name),Fe.innerHTML=P.icon,Fe.title=P.title,Fe.addEventListener("click",function(){W.panelButtonClick(P)}),W.panelButtons.push(Fe),W.buttonRow.appendChild(Fe)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},M.prototype.panelButtonClick=function(g){var E=this,D=-1;if(g!==this.activePanel){D=this.panels.indexOf(g),this.panelRow.innerHTML="";var W=g.getUi();W.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(W),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=g}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){E.displayMode==="inline"?E.panelRow.style.display="none":E.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(P,pe){var Fe,it;P.className=E.toolboxButtonStyleClass.name+" "+(pe===D?""+((Fe=E.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Fe!==void 0?Fe:E.toolboxActiveButtonStyleColorsClass.name):""+((it=E.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&it!==void 0?it:E.toolboxButtonStyleColorsClass.name))})},M}(),Me=function(M,g){this.title=M,this.icon=g},Ne=function(M){function g(E,D,W,P){var pe=M.call(this,E,P||'<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 pe.colors=[],pe.addTransparent=!1,pe.colorBoxes=[],pe.colors=D,pe.currentColor=W,pe.setCurrentColor=pe.setCurrentColor.bind(pe),pe.getColorBox=pe.getColorBox.bind(pe),pe}return q(g,M),g.prototype.getUi=function(){var E=this,D=document.createElement("div");return D.style.overflow="hidden",D.style.whiteSpace="nowrap",this.colors.forEach(function(W){var P=E.getColorBox(W);D.appendChild(P),E.colorBoxes.push(P)}),D},g.prototype.getColorBox=function(E){var D=this,W=this.uiStyleSettings.toolbarHeight/4,P=this.uiStyleSettings.toolbarHeight-W,pe=document.createElement("div");pe.style.display="inline-block",pe.style.boxSizing="content-box",pe.style.width=P-2+"px",pe.style.height=P-2+"px",pe.style.padding="1px",pe.style.marginRight="2px",pe.style.marginBottom="2px",pe.style.borderWidth="2px",pe.style.borderStyle="solid",pe.style.borderRadius=(P+2)/2+"px",pe.style.borderColor=E===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",pe.addEventListener("click",function(){D.setCurrentColor(E,pe)});var Fe=document.createElement("div");return Fe.style.display="inline-block",Fe.style.width=P-2+"px",Fe.style.height=P-2+"px",Fe.style.backgroundColor=E,Fe.style.borderRadius=P/2+"px",E==="transparent"&&(Fe.style.fill=this.uiStyleSettings.toolboxAccentColor,Fe.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>`),pe.appendChild(Fe),pe},g.prototype.setCurrentColor=function(E,D){var W=this;this.currentColor=E,this.colorBoxes.forEach(function(P){P.style.borderColor=P===D?W.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(E)},g}(Me),Be=function(){function M(g,E,D){this._state="new",this._isSelected=!1,this._container=g,this._overlayContainer=E,this.globalSettings=D,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(M.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),M.prototype.ownsTarget=function(g){return!1},Object.defineProperty(M.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),M.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},M.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},M.prototype.pointerDown=function(g,E){},M.prototype.dblClick=function(g,E){},M.prototype.manipulate=function(g){},M.prototype.pointerUp=function(g){this.stateChanged()},M.prototype.dispose=function(){},M.prototype.addMarkerVisualToContainer=function(g){this.container.childNodes.length>0?this.container.insertBefore(g,this.container.childNodes[0]):this.container.appendChild(g)},M.prototype.getState=function(){return{typeName:M.typeName,state:this.state,notes:this.notes}},M.prototype.restoreState=function(g){this._state=g.state,this.notes=g.notes},M.prototype.scale=function(g,E){},M.prototype.colorChanged=function(g){this.onColorChanged&&this.onColorChanged(g),this.stateChanged()},M.prototype.fillColorChanged=function(g){this.onFillColorChanged&&this.onFillColorChanged(g),this.stateChanged()},M.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var g=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),g.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(g)&&this.onStateChanged(this)}},M.typeName="MarkerBase",M}(),Pe=function(){function M(){this.findGripByVisual=this.findGripByVisual.bind(this)}return M.prototype.findGripByVisual=function(g){return this.topLeft.ownsTarget(g)?this.topLeft:this.topCenter.ownsTarget(g)?this.topCenter:this.topRight.ownsTarget(g)?this.topRight:this.centerLeft.ownsTarget(g)?this.centerLeft:this.centerRight.ownsTarget(g)?this.centerRight:this.bottomLeft.ownsTarget(g)?this.bottomLeft:this.bottomCenter.ownsTarget(g)?this.bottomCenter:this.bottomRight.ownsTarget(g)?this.bottomRight:void 0},M}(),Ye=function(){function M(){this.GRIP_SIZE=10,this.visual=X.createGroup(),this.visual.appendChild(X.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(X.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return M.prototype.ownsTarget=function(g){return g===this.visual||g===this.visual.childNodes[0]||g===this.visual.childNodes[1]},M}(),Ke=function(){function M(){}return M.toITransformMatrix=function(g){return{a:g.a,b:g.b,c:g.c,d:g.d,e:g.e,f:g.f}},M.toSVGMatrix=function(g,E){return g.a=E.a,g.b=E.b,g.c=E.c,g.d=E.d,g.e=E.e,g.f=E.f,g},M}(),Se=function(M){function g(E,D,W){var P=M.call(this,E,D,W)||this;return P.left=0,P.top=0,P.width=0,P.height=0,P.defaultSize={x:50,y:20},P.offsetX=0,P.offsetY=0,P.rotationAngle=0,P.CB_DISTANCE=10,P._suppressMarkerCreateEvent=!1,P.container.transform.baseVal.appendItem(X.createTransform()),P.setupControlBox(),P}return q(g,M),Object.defineProperty(g.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"visual",{get:function(){return this._visual},set:function(E){this._visual=E;var D=X.createTransform();this._visual.transform.baseVal.appendItem(D)},enumerable:!1,configurable:!0}),g.prototype.ownsTarget=function(E){return!!M.prototype.ownsTarget.call(this,E)||!!(this.controlGrips.findGripByVisual(E)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(E))},g.prototype.pointerDown=function(E,D){M.prototype.pointerDown.call(this,E,D),this.state==="new"&&(this.left=E.x,this.top=E.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var W=this.unrotatePoint(E);if(this.manipulationStartX=W.x,this.manipulationStartY=W.y,this.offsetX=W.x-this.left,this.offsetY=W.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(D),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(D)){this.activeGrip=this.rotatorGrip;var P=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=P.x-this.width/2,this.top=P.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var pe=this.container.transform.baseVal.getItem(0);pe.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(pe,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},g.prototype.pointerUp=function(E){var D=this.state;M.prototype.pointerUp.call(this,E),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(E),this._state="select",D==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},g.prototype.moveVisual=function(E){this.visual.style.transform="translate("+E.x+"px, "+E.y+"px)"},g.prototype.manipulate=function(E){var D=this.unrotatePoint(E);this.state==="creating"?this.resize(E):this.state==="move"?(this.left=this.manipulationStartLeft+(D.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(D.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(D):this.state==="rotate"&&this.rotate(E)},g.prototype.resize=function(E){var D=this.manipulationStartLeft,W=this.manipulationStartWidth,P=this.manipulationStartTop,pe=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:D=this.manipulationStartLeft+E.x-this.manipulationStartX,W=this.manipulationStartWidth+this.manipulationStartLeft-D;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:W=this.manipulationStartWidth+E.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:P=this.manipulationStartTop+E.y-this.manipulationStartY,pe=this.manipulationStartHeight+this.manipulationStartTop-P;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:pe=this.manipulationStartHeight+E.y-this.manipulationStartY}W>=0?(this.left=D,this.width=W):(this.left=D+W,this.width=-W),pe>=0?(this.top=P,this.height=pe):(this.top=P+pe,this.height=-pe),this.setSize()},g.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},g.prototype.rotate=function(E){if(Math.abs(E.x-this.centerX)>.1){var D=Math.sign(E.x-this.centerX);this.rotationAngle=180*Math.atan((E.y-this.centerY)/(E.x-this.centerX))/Math.PI+90*D,this.applyRotation()}},g.prototype.applyRotation=function(){var E=this.container.transform.baseVal.getItem(0);E.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(E,0)},g.prototype.rotatePoint=function(E){if(this.rotationAngle===0)return E;var D=this.container.getCTM(),W=X.createPoint(E.x,E.y);return{x:(W=W.matrixTransform(D)).x,y:W.y}},g.prototype.unrotatePoint=function(E){if(this.rotationAngle===0)return E;var D=this.container.getCTM();D=D.inverse();var W=X.createPoint(E.x,E.y);return{x:(W=W.matrixTransform(D)).x,y:W.y}},g.prototype.select=function(){M.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},g.prototype.deselect=function(){M.prototype.deselect.call(this),this.controlBox.style.display="none"},g.prototype.setupControlBox=function(){this.controlBox=X.createGroup();var E=X.createTransform();E.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(E),this.container.appendChild(this.controlBox),this.controlRect=X.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=X.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 Pe,this.addControlGrips(),this.controlBox.style.display="none"},g.prototype.adjustControlBox=function(){var E=this.controlBox.transform.baseVal.getItem(0);E.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(E,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},g.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()},g.prototype.createGrip=function(){var E=new Ye;return E.visual.transform.baseVal.appendItem(X.createTransform()),this.controlBox.appendChild(E.visual),E},g.prototype.positionGrips=function(){var E=this.controlGrips.topLeft.GRIP_SIZE,D=-E/2,W=D,P=(this.width+this.CB_DISTANCE)/2-E/2,pe=(this.height+this.CB_DISTANCE)/2-E/2,Fe=this.height+this.CB_DISTANCE-E/2,it=this.width+this.CB_DISTANCE-E/2;this.positionGrip(this.controlGrips.topLeft.visual,D,W),this.positionGrip(this.controlGrips.topCenter.visual,P,W),this.positionGrip(this.controlGrips.topRight.visual,it,W),this.positionGrip(this.controlGrips.centerLeft.visual,D,pe),this.positionGrip(this.controlGrips.centerRight.visual,it,pe),this.positionGrip(this.controlGrips.bottomLeft.visual,D,Fe),this.positionGrip(this.controlGrips.bottomCenter.visual,P,Fe),this.positionGrip(this.controlGrips.bottomRight.visual,it,Fe),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,P,W-3*this.CB_DISTANCE)},g.prototype.positionGrip=function(E,D,W){var P=E.transform.baseVal.getItem(0);P.setTranslate(D,W),E.transform.baseVal.replaceItem(P,0)},g.prototype.hideControlBox=function(){this.controlBox.style.display="none"},g.prototype.showControlBox=function(){this.controlBox.style.display=""},g.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:Ke.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:Ke.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},M.prototype.getState.call(this))},g.prototype.restoreState=function(E){M.prototype.restoreState.call(this,E);var D=E;this.left=D.left,this.top=D.top,this.width=D.width,this.height=D.height,this.rotationAngle=D.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Ke.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,D.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Ke.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,D.containerTransformMatrix))},g.prototype.scale=function(E,D){M.prototype.scale.call(this,E,D);var W=this.rotatePoint({x:this.left,y:this.top}),P=this.unrotatePoint({x:W.x*E,y:W.y*D});this.left=P.x,this.top=P.y,this.width=this.width*E,this.height=this.height*D,this.adjustControlBox()},g}(Be),je=function(M){function g(E,D,W){var P=M.call(this,E,D,W)||this;return P.fillColor="transparent",P.strokeColor="transparent",P.strokeWidth=0,P.strokeDasharray="",P.opacity=1,P.setStrokeColor=P.setStrokeColor.bind(P),P.setFillColor=P.setFillColor.bind(P),P.setStrokeWidth=P.setStrokeWidth.bind(P),P.setStrokeDasharray=P.setStrokeDasharray.bind(P),P.createVisual=P.createVisual.bind(P),P}return q(g,M),g.prototype.ownsTarget=function(E){return!(!M.prototype.ownsTarget.call(this,E)&&E!==this.visual)},g.prototype.createVisual=function(){this.visual=X.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)},g.prototype.pointerDown=function(E,D){M.prototype.pointerDown.call(this,E,D),this.state==="new"&&(this.createVisual(),this.moveVisual(E),this._state="creating")},g.prototype.manipulate=function(E){M.prototype.manipulate.call(this,E)},g.prototype.resize=function(E){M.prototype.resize.call(this,E),this.setSize()},g.prototype.setSize=function(){M.prototype.setSize.call(this),X.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},g.prototype.pointerUp=function(E){M.prototype.pointerUp.call(this,E),this.setSize()},g.prototype.setStrokeColor=function(E){this.strokeColor=E,this.visual&&X.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(E),this.stateChanged()},g.prototype.setFillColor=function(E){this.fillColor=E,this.visual&&X.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},g.prototype.setStrokeWidth=function(E){this.strokeWidth=E,this.visual&&X.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},g.prototype.setStrokeDasharray=function(E){this.strokeDasharray=E,this.visual&&X.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},g.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},M.prototype.getState.call(this))},g.prototype.restoreState=function(E){var D=E;this.fillColor=D.fillColor,this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.opacity=D.opacity,this.createVisual(),M.prototype.restoreState.call(this,E),this.setSize()},g.prototype.scale=function(E,D){M.prototype.scale.call(this,E,D),this.setSize()},g.title="Rectangle marker",g}(Se),et=function(M){function g(E,D,W,P){var pe=M.call(this,E,P||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return pe.widths=[],pe.widthBoxes=[],pe.widths=D,pe.currentWidth=W,pe.setCurrentWidth=pe.setCurrentWidth.bind(pe),pe}return q(g,M),g.prototype.getUi=function(){var E=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",this.widths.forEach(function(W){var P=document.createElement("div");P.style.display="flex",P.style.flexGrow="2",P.style.alignItems="center",P.style.justifyContent="space-between",P.style.padding="5px",P.style.borderWidth="2px",P.style.borderStyle="solid",P.style.borderColor=W===E.currentWidth?E.uiStyleSettings.toolboxAccentColor:"transparent",P.addEventListener("click",function(){E.setCurrentWidth(W,P)}),D.appendChild(P);var pe=document.createElement("div");pe.innerText=W.toString(),pe.style.marginRight="5px",P.appendChild(pe);var Fe=document.createElement("div");Fe.style.minHeight="20px",Fe.style.flexGrow="2",Fe.style.display="flex",Fe.style.alignItems="center";var it=document.createElement("hr");it.style.minWidth="20px",it.style.border="0px",it.style.borderTop=W+"px solid "+E.uiStyleSettings.toolboxColor,it.style.flexGrow="2",Fe.appendChild(it),P.appendChild(Fe),E.widthBoxes.push(P)}),D},g.prototype.setCurrentWidth=function(E,D){var W=this;this.currentWidth=E,this.widthBoxes.forEach(function(P){P.style.borderColor=P===D?W.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},g}(Me),Je=function(M){function g(E,D,W,P){var pe=M.call(this,E,P||'<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 pe.styles=[],pe.styleBoxes=[],pe.styles=D,pe.currentStyle=W,pe.setCurrentStyle=pe.setCurrentStyle.bind(pe),pe}return q(g,M),g.prototype.getUi=function(){var E=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",this.styles.forEach(function(W){var P=document.createElement("div");P.style.display="flex",P.style.alignItems="center",P.style.justifyContent="space-between",P.style.padding="5px",P.style.borderWidth="2px",P.style.borderStyle="solid",P.style.overflow="hidden",P.style.maxWidth=100/E.styles.length-5+"%",P.style.borderColor=W===E.currentStyle?E.uiStyleSettings.toolboxAccentColor:"transparent",P.addEventListener("click",function(){E.setCurrentStyle(W,P)}),D.appendChild(P);var pe=document.createElement("div");pe.style.minHeight="20px",pe.style.flexGrow="2",pe.style.overflow="hidden";var Fe=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+E.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(W!==""?'stroke-dasharray="'+W+'"':"")+` />
</svg>`;pe.innerHTML=Fe,P.appendChild(pe),E.styleBoxes.push(P)}),D},g.prototype.setCurrentStyle=function(E,D){var W=this;this.currentStyle=E,this.styleBoxes.forEach(function(P){P.style.borderColor=P===D?W.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},g}(Me),Ze=function(M){function g(E,D,W){var P=M.call(this,E,D,W)||this;return P.strokeColor=W.defaultColor,P.strokeWidth=W.defaultStrokeWidth,P.strokeDasharray=W.defaultStrokeDasharray,P.strokePanel=new Ne("Line color",W.defaultColorSet,W.defaultColor),P.strokePanel.onColorChanged=P.setStrokeColor,P.strokeWidthPanel=new et("Line width",W.defaultStrokeWidths,W.defaultStrokeWidth),P.strokeWidthPanel.onWidthChanged=P.setStrokeWidth,P.strokeStylePanel=new Je("Line style",W.defaultStrokeDasharrays,W.defaultStrokeDasharray),P.strokeStylePanel.onStyleChanged=P.setStrokeDasharray,P}return q(g,M),Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),g.prototype.getState=function(){var E=M.prototype.getState.call(this);return E.typeName=g.typeName,E},g.typeName="FrameMarker",g.title="Frame marker",g.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',g}(je),We=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},nt=function(M){function g(E,D,W){var P=M.call(this,E,D,W)||this;return P.x1=0,P.y1=0,P.x2=0,P.y2=0,P.defaultLength=50,P.manipulationStartX=0,P.manipulationStartY=0,P.manipulationStartX1=0,P.manipulationStartY1=0,P.manipulationStartX2=0,P.manipulationStartY2=0,P.setupControlBox(),P}return q(g,M),g.prototype.ownsTarget=function(E){return!!M.prototype.ownsTarget.call(this,E)||!(!this.grip1.ownsTarget(E)&&!this.grip2.ownsTarget(E))},g.prototype.pointerDown=function(E,D){M.prototype.pointerDown.call(this,E,D),this.manipulationStartX=E.x,this.manipulationStartY=E.y,this.state==="new"&&(this.x1=E.x,this.y1=E.y,this.x2=E.x,this.y2=E.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(D)?this.activeGrip=this.grip1:this.grip2.ownsTarget(D)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},g.prototype.pointerUp=function(E){var D=this.state;M.prototype.pointerUp.call(this,E),this.state==="creating"&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(E),this._state="select",D==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},g.prototype.adjustVisual=function(){},g.prototype.manipulate=function(E){this.state==="creating"?this.resize(E):this.state==="move"?(this.x1=this.manipulationStartX1+E.x-this.manipulationStartX,this.y1=this.manipulationStartY1+E.y-this.manipulationStartY,this.x2=this.manipulationStartX2+E.x-this.manipulationStartX,this.y2=this.manipulationStartY2+E.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(E)},g.prototype.resize=function(E){switch(this.activeGrip){case this.grip1:this.x1=E.x,this.y1=E.y;break;case this.grip2:case void 0:this.x2=E.x,this.y2=E.y}this.adjustVisual(),this.adjustControlBox()},g.prototype.select=function(){M.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},g.prototype.deselect=function(){M.prototype.deselect.call(this),this.controlBox.style.display="none"},g.prototype.setupControlBox=function(){this.controlBox=X.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},g.prototype.adjustControlBox=function(){this.positionGrips()},g.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},g.prototype.createGrip=function(){var E=new Ye;return E.visual.transform.baseVal.appendItem(X.createTransform()),this.controlBox.appendChild(E.visual),E},g.prototype.positionGrips=function(){var E=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-E/2,this.y1-E/2),this.positionGrip(this.grip2.visual,this.x2-E/2,this.y2-E/2)},g.prototype.positionGrip=function(E,D,W){var P=E.transform.baseVal.getItem(0);P.setTranslate(D,W),E.transform.baseVal.replaceItem(P,0)},g.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},M.prototype.getState.call(this))},g.prototype.restoreState=function(E){M.prototype.restoreState.call(this,E);var D=E;this.x1=D.x1,this.y1=D.y1,this.x2=D.x2,this.y2=D.y2},g.prototype.scale=function(E,D){M.prototype.scale.call(this,E,D),this.x1=this.x1*E,this.y1=this.y1*D,this.x2=this.x2*E,this.y2=this.y2*D,this.adjustVisual(),this.adjustControlBox()},g}(Be),qe=function(M){function g(E,D,W){var P=M.call(this,E,D,W)||this;return P.strokeColor="transparent",P.strokeWidth=0,P.strokeDasharray="",P.setStrokeColor=P.setStrokeColor.bind(P),P.setStrokeWidth=P.setStrokeWidth.bind(P),P.setStrokeDasharray=P.setStrokeDasharray.bind(P),P.strokeColor=W.defaultColor,P.strokeWidth=W.defaultStrokeWidth,P.strokeDasharray=W.defaultStrokeDasharray,P.strokePanel=new Ne("Line color",W.defaultColorSet,W.defaultColor),P.strokePanel.onColorChanged=P.setStrokeColor,P.strokeWidthPanel=new et("Line width",W.defaultStrokeWidths,W.defaultStrokeWidth),P.strokeWidthPanel.onWidthChanged=P.setStrokeWidth,P.strokeStylePanel=new Je("Line style",W.defaultStrokeDasharrays,W.defaultStrokeDasharray),P.strokeStylePanel.onStyleChanged=P.setStrokeDasharray,P}return q(g,M),g.prototype.ownsTarget=function(E){return!(!M.prototype.ownsTarget.call(this,E)&&E!==this.visual&&E!==this.selectorLine&&E!==this.visibleLine)},g.prototype.createVisual=function(){this.visual=X.createGroup(),this.selectorLine=X.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=X.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)},g.prototype.pointerDown=function(E,D){M.prototype.pointerDown.call(this,E,D),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},g.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()),X.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),X.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),X.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},g.prototype.setStrokeColor=function(E){this.strokeColor=E,this.adjustVisual(),this.colorChanged(E)},g.prototype.setStrokeWidth=function(E){this.strokeWidth=E,this.adjustVisual()},g.prototype.setStrokeDasharray=function(E){this.strokeDasharray=E,this.adjustVisual(),this.stateChanged()},Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),g.prototype.getState=function(){var E=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},M.prototype.getState.call(this));return E.typeName=g.typeName,E},g.prototype.restoreState=function(E){M.prototype.restoreState.call(this,E);var D=E;this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.createVisual(),this.adjustVisual()},g.typeName="LineMarker",g.title="Line marker",g.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',g}(nt),De=function(M){function g(E,D,W,P){var pe=M.call(this,E,P||'<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 pe.fonts=[],pe.fontBoxes=[],pe.fonts=D,pe.currentFont=W,pe.setCurrentFont=pe.setCurrentFont.bind(pe),pe}return q(g,M),g.prototype.getUi=function(){var E=this,D=document.createElement("div");return D.style.overflow="hidden",D.style.flexGrow="2",this.fonts.forEach(function(W){var P=document.createElement("div");P.style.display="inline-block",P.style.alignItems="center",P.style.justifyContent="space-between",P.style.padding="5px",P.style.borderWidth="2px",P.style.borderStyle="solid",P.style.overflow="hidden",P.style.maxWidth=100/E.fonts.length-5+"%",P.style.borderColor=W===E.currentFont?E.uiStyleSettings.toolboxAccentColor:"transparent",P.addEventListener("click",function(){E.setCurrentFont(W,P)}),D.appendChild(P);var pe=document.createElement("div");pe.style.display="flex",pe.style.minHeight="20px",pe.style.flexGrow="2",pe.style.fontFamily=W,pe.style.overflow="hidden";var Fe=document.createElement("div");Fe.style.whiteSpace="nowrap",Fe.style.overflow="hidden",Fe.style.textOverflow="ellipsis",Fe.innerHTML="The quick brown fox jumps over the lazy dog",pe.appendChild(Fe),P.appendChild(pe),E.fontBoxes.push(P)}),D},g.prototype.setCurrentFont=function(E,D){var W=this;this.currentFont=E,this.fontBoxes.forEach(function(P){P.style.borderColor=P===D?W.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},g}(Me),Ge=function(M){function g(E,D,W){var P=M.call(this,E,D,W)||this;return P.color="transparent",P.padding=5,P.DEFAULT_TEXT="your text here",P.text=P.DEFAULT_TEXT,P.isMoved=!1,P.color=W.defaultColor,P.fontFamily=W.defaultFontFamily,P.defaultSize={x:100,y:30},P.setColor=P.setColor.bind(P),P.setFont=P.setFont.bind(P),P.renderText=P.renderText.bind(P),P.sizeText=P.sizeText.bind(P),P.textEditDivClicked=P.textEditDivClicked.bind(P),P.showTextEditor=P.showTextEditor.bind(P),P.setSize=P.setSize.bind(P),P.positionTextEditor=P.positionTextEditor.bind(P),P.colorPanel=new Ne("Color",W.defaultColorSet,W.defaultColor),P.colorPanel.onColorChanged=P.setColor,P.fontFamilyPanel=new De("Font",W.defaultFontFamilies,W.defaultFontFamily),P.fontFamilyPanel.onFontChanged=P.setFont,P}return q(g,M),g.prototype.ownsTarget=function(E){if(M.prototype.ownsTarget.call(this,E)||E===this.visual||E===this.textElement||E===this.bgRectangle)return!0;var D=!1;return this.textElement.childNodes.forEach(function(W){W===E&&(D=!0)}),D},g.prototype.createVisual=function(){this.visual=X.createGroup(),this.bgRectangle=X.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=X.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(X.createTransform()),this.textElement.transform.baseVal.appendItem(X.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},g.prototype.pointerDown=function(E,D){M.prototype.pointerDown.call(this,E,D),this.isMoved=!1,this.pointerDownPoint=E,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(E),this._state="creating")},g.prototype.renderText=function(){var E=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(D){E.textElement.appendChild(X.createTSpan(D.trim()===""?" ":D.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},g.prototype.getTextScale=function(){var E=this.textElement.getBBox(),D=1;if(E.width>0&&E.height>0){var W=(1*this.width-this.width*this.padding*2/100)/E.width,P=(1*this.height-this.height*this.padding*2/100)/E.height;D=Math.min(W,P)}return D},g.prototype.getTextPosition=function(E){var D=this.textElement.getBBox(),W=0,P=0;return D.width>0&&D.height>0&&(W=(this.width-D.width*E)/2,P=this.height/2-D.height*E/2),{x:W,y:P}},g.prototype.sizeText=function(){var E=this.textElement.getBBox(),D=this.getTextScale(),W=this.getTextPosition(D);W.y-=E.y*D,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+W.x+"px, "+W.y+"px) scale("+D+", "+D+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(W.x,W.y),this.textElement.transform.baseVal.getItem(1).setScale(D,D))},g.prototype.manipulate=function(E){M.prototype.manipulate.call(this,E),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(E.x-this.pointerDownPoint.x)>5||Math.abs(E.y-this.pointerDownPoint.y)>5)},g.prototype.resize=function(E){M.prototype.resize.call(this,E),this.isMoved=!0,this.setSize(),this.sizeText()},g.prototype.setSize=function(){M.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(X.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),X.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},g.prototype.pointerUp=function(E){var D=this.state;D==="creating"&&(this._suppressMarkerCreateEvent=!0),M.prototype.pointerUp.call(this,E),this.setSize(),(D==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},g.prototype.showTextEditor=function(){var E=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(D){D.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var D=Number.parseFloat(E.textEditor.style.fontSize);E.textEditor.clientWidth>=Number.parseInt(E.textEditor.style.maxWidth)&&D>.9;)D-=.1,E.textEditor.style.fontSize=Math.max(D,.9)+"em"}),this.textEditor.addEventListener("keyup",function(D){D.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(D){if(D.clipboardData){var W=D.clipboardData.getData("text"),P=window.getSelection();if(!P.rangeCount)return!1;P.deleteFromDocument(),P.getRangeAt(0).insertNode(document.createTextNode(W)),D.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){E.textEditDivClicked(E.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},g.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var E=this.getTextScale(),D=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),W=this.textElement.getBBox(),P={x:W.width*E,y:W.height*E};D.x-=P.x/2,D.y-=P.y/2,this.textEditor.style.top=D.y+"px",this.textEditor.style.left=D.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-D.x+"px",this.textEditor.style.fontSize=Math.max(16*E,12)+"px",this.textElement.style.display="none"}},g.prototype.textEditDivClicked=function(E){this.text=E.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},g.prototype.select=function(){M.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},g.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),M.prototype.deselect.call(this)},g.prototype.dblClick=function(E,D){M.prototype.dblClick.call(this,E,D),this.showTextEditor()},g.prototype.setColor=function(E){this.textElement&&X.setAttributes(this.textElement,[["fill",E]]),this.color=E,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(E)},g.prototype.setFont=function(E){this.textElement&&X.setAttributes(this.textElement,[["font-family",E]]),this.fontFamily=E,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},g.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},g.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),g.prototype.getState=function(){var E=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},M.prototype.getState.call(this));return E.typeName=g.typeName,E},g.prototype.restoreState=function(E){var D=E;this.color=D.color,this.fontFamily=D.fontFamily,this.padding=D.padding,this.text=D.text,this.createVisual(),M.prototype.restoreState.call(this,E),this.setSize()},g.prototype.scale=function(E,D){M.prototype.scale.call(this,E,D),this.setSize(),this.sizeText(),this.positionTextEditor()},g.typeName="TextMarker",g.title="Text marker",g.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>',g}(Se),ne=function(M){function g(E,D,W){var P=M.call(this,E,D,W)||this;return P.color="transparent",P.lineWidth=3,P.drawing=!1,P.pixelRatio=1,P.color=W.defaultColor,P.lineWidth=W.defaultStrokeWidth,P.pixelRatio=W.freehandPixelRatio,P.setColor=P.setColor.bind(P),P.addCanvas=P.addCanvas.bind(P),P.finishCreation=P.finishCreation.bind(P),P.setLineWidth=P.setLineWidth.bind(P),P.colorPanel=new Ne("Color",W.defaultColorSet,W.defaultColor),P.colorPanel.onColorChanged=P.setColor,P.lineWidthPanel=new et("Line width",W.defaultStrokeWidths,W.defaultStrokeWidth),P.lineWidthPanel.onWidthChanged=P.setLineWidth,P}return q(g,M),g.prototype.ownsTarget=function(E){return!(!M.prototype.ownsTarget.call(this,E)&&E!==this.visual&&E!==this.drawingImage)},g.prototype.createVisual=function(){this.visual=X.createGroup(),this.drawingImage=X.createImage(),this.visual.appendChild(this.drawingImage);var E=X.createTransform();this.visual.transform.baseVal.appendItem(E),this.addMarkerVisualToContainer(this.visual)},g.prototype.pointerDown=function(E,D){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(E.x,E.y),this.drawing=!0):M.prototype.pointerDown.call(this,E,D)},g.prototype.manipulate=function(E){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(E.x,E.y),this.canvasContext.stroke()):M.prototype.manipulate.call(this,E)},g.prototype.resize=function(E){M.prototype.resize.call(this,E),X.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),X.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},g.prototype.pointerUp=function(E){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):M.prototype.pointerUp.call(this,E)},g.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)},g.prototype.select=function(){this.state==="creating"&&this.finishCreation(),M.prototype.select.call(this)},g.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),M.prototype.deselect.call(this)},g.prototype.finishCreation=function(){for(var E=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),D=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],W=D[0],P=D[1],pe=D[2],Fe=D[3],it=!1,st=0;st<this.canvasElement.height;st++)for(var He=0;He<this.canvasElement.width;He++)E.data[st*this.canvasElement.width*4+4*He+3]>0&&(it=!0,st<P&&(P=st),He<W&&(W=He),st>Fe&&(Fe=st),He>pe&&(pe=He));if(it){this.left=W/this.pixelRatio,this.top=P/this.pixelRatio,this.width=(pe-W)/this.pixelRatio,this.height=(Fe-P)/this.pixelRatio;var gt=document.createElement("canvas");gt.width=pe-W,gt.height=Fe-P,gt.getContext("2d").putImageData(this.canvasContext.getImageData(W,P,pe-W,Fe-P),0,0),this.drawingImgUrl=gt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},g.prototype.setDrawingImage=function(){X.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),X.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},g.prototype.setColor=function(E){this.color=E,this.colorChanged(E)},g.prototype.setLineWidth=function(E){this.lineWidth=E},Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),g.prototype.getState=function(){var E=Object.assign({drawingImgUrl:this.drawingImgUrl},M.prototype.getState.call(this));return E.typeName=g.typeName,E},g.prototype.restoreState=function(E){this.createVisual(),M.prototype.restoreState.call(this,E),this.drawingImgUrl=E.drawingImgUrl,this.setDrawingImage()},g.prototype.scale=function(E,D){M.prototype.scale.call(this,E,D),this.setDrawingImage()},g.typeName="FreehandMarker",g.title="Freehand marker",g.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>',g}(Se),le=function(M){function g(E,D,W){var P=M.call(this,E,W||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return P.typeBoxes=[],P.currentType=D,P.setCurrentType=P.setCurrentType.bind(P),P}return q(g,M),g.prototype.getUi=function(){var E=this,D=document.createElement("div");D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2";for(var W=function(Fe){var it="both";switch(Fe){case 0:it="both";break;case 1:it="start";break;case 2:it="end";break;case 3:it="none"}var st=document.createElement("div");if(st.style.display="flex",st.style.flexGrow="2",st.style.alignItems="center",st.style.justifyContent="space-between",st.style.padding="5px",st.style.borderWidth="2px",st.style.borderStyle="solid",st.style.borderColor=it===P.currentType?P.uiStyleSettings.toolboxAccentColor:"transparent",st.addEventListener("click",function(){E.setCurrentType(it,st)}),D.appendChild(st),it==="both"||it==="start"){var He=document.createElement("div");He.style.display="flex",He.style.alignItems="center",He.style.minHeight="20px",He.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="`+(P.uiStyleSettings!==void 0?P.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,He.style.marginLeft="5px",st.appendChild(He)}var gt=document.createElement("div");gt.style.display="flex",gt.style.alignItems="center",gt.style.minHeight="20px",gt.style.flexGrow="2";var jt=document.createElement("hr");if(jt.style.minWidth="20px",jt.style.border="0px",jt.style.borderTop="3px solid "+(P.uiStyleSettings!==void 0?P.uiStyleSettings.toolboxColor:"#eeeeee"),jt.style.flexGrow="2",gt.appendChild(jt),st.appendChild(gt),it==="both"||it==="end"){var Yt=document.createElement("div");Yt.style.display="flex",Yt.style.alignItems="center",Yt.style.minHeight="20px",Yt.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="`+(P.uiStyleSettings!==void 0?P.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Yt.style.marginRight="5px",st.appendChild(Yt)}P.typeBoxes.push(st)},P=this,pe=0;pe<4;pe++)W(pe);return D},g.prototype.setCurrentType=function(E,D){var W=this;this.currentType=E,this.typeBoxes.forEach(function(P){P.style.borderColor=P===D?W.uiStyleSettings!==void 0?W.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},g}(Me),fe=function(M){function g(E,D,W){var P=M.call(this,E,D,W)||this;return P.arrowType="end",P.arrowBaseHeight=10,P.arrowBaseWidth=10,P.getArrowPoints=P.getArrowPoints.bind(P),P.setArrowType=P.setArrowType.bind(P),P.arrowTypePanel=new le("Arrow type","end"),P.arrowTypePanel.onArrowTypeChanged=P.setArrowType,P}return q(g,M),g.prototype.ownsTarget=function(E){return!(!M.prototype.ownsTarget.call(this,E)&&E!==this.arrow1&&E!==this.arrow2)},g.prototype.getArrowPoints=function(E,D){var W=this.arrowBaseWidth+2*this.strokeWidth,P=this.arrowBaseHeight+2*this.strokeWidth;return E-W/2+","+(D+P/2)+" "+E+","+(D-P/2)+" "+(E+W/2)+","+(D+P/2)},g.prototype.createTips=function(){this.arrow1=X.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(X.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=X.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(X.createTransform()),this.visual.appendChild(this.arrow2)},g.prototype.pointerDown=function(E,D){M.prototype.pointerDown.call(this,E,D),this.state==="creating"&&this.createTips()},g.prototype.adjustVisual=function(){if(M.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",X.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),X.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var E=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),D=this.arrow1.transform.baseVal.getItem(0);D.setRotate(E,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(D,0);var W=this.arrow2.transform.baseVal.getItem(0);W.setRotate(E+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(W,0)}},g.prototype.setArrowType=function(E){this.arrowType=E,this.adjustVisual(),this.stateChanged()},Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),g.prototype.getState=function(){var E=Object.assign({arrowType:this.arrowType},M.prototype.getState.call(this));return E.typeName=g.typeName,E},g.prototype.restoreState=function(E){M.prototype.restoreState.call(this,E);var D=E;this.arrowType=D.arrowType,this.createTips(),this.adjustVisual()},g.typeName="ArrowMarker",g.title="Arrow marker",g.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',g}(qe),$=function(M){function g(E,D,W){var P=M.call(this,E,D,W)||this;return P.fillColor=W.defaultFillColor,P.strokeWidth=0,P.fillPanel=new Ne("Color",W.defaultColorSet,W.defaultFillColor),P.fillPanel.onColorChanged=P.setFillColor,P}return q(g,M),Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),g.prototype.getState=function(){var E=M.prototype.getState.call(this);return E.typeName=g.typeName,E},g.typeName="CoverMarker",g.title="Cover marker",g.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',g}(je),Q=function(M){function g(E,D,W,P){var pe=M.call(this,E,P||'<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 pe.opacities=[],pe.opacityBoxes=[],pe.opacities=D,pe.currentOpacity=W,pe.setCurrentOpacity=pe.setCurrentOpacity.bind(pe),pe}return q(g,M),g.prototype.getUi=function(){var E=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",D.style.justifyContent="space-between",this.opacities.forEach(function(W){var P=document.createElement("div");P.style.display="flex",P.style.alignItems="center",P.style.justifyContent="center",P.style.padding="5px",P.style.borderWidth="2px",P.style.borderStyle="solid",P.style.borderColor=W===E.currentOpacity?E.uiStyleSettings.toolboxAccentColor:"transparent",P.addEventListener("click",function(){E.setCurrentOpacity(W,P)}),D.appendChild(P);var pe=document.createElement("div");pe.innerText=100*W+"%",P.appendChild(pe),E.opacityBoxes.push(P)}),D},g.prototype.setCurrentOpacity=function(E,D){var W=this;this.currentOpacity=E,this.opacityBoxes.forEach(function(P){P.style.borderColor=P===D?W.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},g}(Me),re=function(M){function g(E,D,W){var P=M.call(this,E,D,W)||this;return P.setOpacity=P.setOpacity.bind(P),P.fillColor=W.defaultHighlightColor,P.strokeWidth=0,P.opacity=W.defaultHighlightOpacity,P.fillPanel=new Ne("Color",W.defaultColorSet,P.fillColor),P.fillPanel.onColorChanged=P.setFillColor,P.opacityPanel=new Q("Opacity",W.defaultOpacitySteps,P.opacity),P.opacityPanel.onOpacityChanged=P.setOpacity,P}return q(g,M),g.prototype.setOpacity=function(E){this.opacity=E,this.visual&&X.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),g.prototype.getState=function(){var E=M.prototype.getState.call(this);return E.typeName=g.typeName,E},g.typeName="HighlightMarker",g.title="Highlight marker",g.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>',g}($),me='<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>',Ae=function(M){function g(E,D,W){var P=M.call(this,E,D,W)||this;return P.bgColor="transparent",P.tipPosition={x:0,y:0},P.tipBase1Position={x:0,y:0},P.tipBase2Position={x:0,y:0},P.tipMoving=!1,P.color=W.defaultStrokeColor,P.bgColor=W.defaultFillColor,P.fontFamily=W.defaultFontFamily,P.defaultSize={x:100,y:30},P.setBgColor=P.setBgColor.bind(P),P.getTipPoints=P.getTipPoints.bind(P),P.positionTip=P.positionTip.bind(P),P.setTipPoints=P.setTipPoints.bind(P),P.colorPanel=new Ne("Text color",W.defaultColorSet,P.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>'),P.colorPanel.onColorChanged=P.setColor,P.bgColorPanel=new Ne("Fill color",W.defaultColorSet,P.bgColor,me),P.bgColorPanel.onColorChanged=P.setBgColor,P.fontFamilyPanel=new De("Font",W.defaultFontFamilies,W.defaultFontFamily),P.fontFamilyPanel.onFontChanged=P.setFont,P.tipGrip=new Ye,P.tipGrip.visual.transform.baseVal.appendItem(X.createTransform()),P.controlBox.appendChild(P.tipGrip.visual),P}return q(g,M),g.prototype.ownsTarget=function(E){return M.prototype.ownsTarget.call(this,E)||this.tipGrip.ownsTarget(E)||this.tip===E},g.prototype.createTip=function(){X.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=X.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},g.prototype.pointerDown=function(E,D){this.state==="new"&&M.prototype.pointerDown.call(this,E,D),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(D)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):M.prototype.pointerDown.call(this,E,D)},g.prototype.pointerUp=function(E){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,M.prototype.pointerUp.call(this,E);else{var D=this.state==="creating";M.prototype.pointerUp.call(this,E),this.setTipPoints(D),this.positionTip()}},g.prototype.manipulate=function(E){if(this.tipMoving){var D=this.unrotatePoint(E);this.tipPosition={x:D.x-this.manipulationStartLeft,y:D.y-this.manipulationStartTop},this.positionTip()}else M.prototype.manipulate.call(this,E)},g.prototype.setBgColor=function(E){this.bgRectangle&&this.tip&&(X.setAttributes(this.bgRectangle,[["fill",E]]),X.setAttributes(this.tip,[["fill",E]])),this.bgColor=E,this.fillColorChanged(E)},g.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},g.prototype.setTipPoints=function(E){E===void 0&&(E=!1);var D=Math.min(this.height/2,15),W=this.height/5;E&&(this.tipPosition={x:D+W/2,y:this.height+20});var P=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?P<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(W=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:D,y:0},this.tipBase2Position={x:D+W,y:0}):(this.tipBase1Position={x:0,y:D},this.tipBase2Position={x:0,y:D+W}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?P<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(W=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-D-W,y:0},this.tipBase2Position={x:this.width-D,y:0}):(this.tipBase1Position={x:this.width,y:D},this.tipBase2Position={x:this.width,y:D+W}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?P<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(W=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-D-W,y:this.height},this.tipBase2Position={x:this.width-D,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-D-W},this.tipBase2Position={x:this.width,y:this.height-D}):P<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(W=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:D,y:this.height},this.tipBase2Position={x:D+W,y:this.height}):(this.tipBase1Position={x:0,y:this.height-D},this.tipBase2Position={x:0,y:this.height-D-W})},g.prototype.resize=function(E){M.prototype.resize.call(this,E),this.positionTip()},g.prototype.positionTip=function(){X.setAttributes(this.tip,[["points",this.getTipPoints()]]);var E=this.tipGrip.visual.transform.baseVal.getItem(0);E.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(E,0)},Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),g.prototype.select=function(){this.positionTip(),M.prototype.select.call(this)},g.prototype.getState=function(){var E=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},M.prototype.getState.call(this));return E.typeName=g.typeName,E},g.prototype.restoreState=function(E){var D=E;this.bgColor=D.bgColor,this.tipPosition=D.tipPosition,M.prototype.restoreState.call(this,E),this.createTip(),this.setTipPoints()},g.prototype.scale=function(E,D){M.prototype.scale.call(this,E,D),this.tipPosition={x:this.tipPosition.x*E,y:this.tipPosition.y*D},this.positionTip()},g.typeName="CalloutMarker",g.title="Callout marker",g.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>',g}(Ge),ke=function(M){function g(E,D,W){var P=M.call(this,E,D,W)||this;return P.fillColor="transparent",P.strokeColor="transparent",P.strokeWidth=0,P.strokeDasharray="",P.opacity=1,P.strokeColor=W.defaultColor,P.strokeWidth=W.defaultStrokeWidth,P.strokeDasharray=W.defaultStrokeDasharray,P.fillColor=W.defaultFillColor,P.setStrokeColor=P.setStrokeColor.bind(P),P.setFillColor=P.setFillColor.bind(P),P.setStrokeWidth=P.setStrokeWidth.bind(P),P.setStrokeDasharray=P.setStrokeDasharray.bind(P),P.setOpacity=P.setOpacity.bind(P),P.createVisual=P.createVisual.bind(P),P.strokePanel=new Ne("Line color",J(W.defaultColorSet,["transparent"]),W.defaultColor),P.strokePanel.onColorChanged=P.setStrokeColor,P.fillPanel=new Ne("Fill color",J(W.defaultColorSet,["transparent"]),P.fillColor,me),P.fillPanel.onColorChanged=P.setFillColor,P.strokeWidthPanel=new et("Line width",W.defaultStrokeWidths,W.defaultStrokeWidth),P.strokeWidthPanel.onWidthChanged=P.setStrokeWidth,P.strokeStylePanel=new Je("Line style",W.defaultStrokeDasharrays,W.defaultStrokeDasharray),P.strokeStylePanel.onStyleChanged=P.setStrokeDasharray,P.opacityPanel=new Q("Opacity",W.defaultOpacitySteps,P.opacity),P.opacityPanel.onOpacityChanged=P.setOpacity,P}return q(g,M),g.prototype.ownsTarget=function(E){return!(!M.prototype.ownsTarget.call(this,E)&&E!==this.visual)},g.prototype.createVisual=function(){this.visual=X.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)},g.prototype.pointerDown=function(E,D){M.prototype.pointerDown.call(this,E,D),this.state==="new"&&(this.createVisual(),this.moveVisual(E),this._state="creating")},g.prototype.manipulate=function(E){M.prototype.manipulate.call(this,E)},g.prototype.resize=function(E){M.prototype.resize.call(this,E),this.setSize()},g.prototype.setSize=function(){M.prototype.setSize.call(this),X.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},g.prototype.pointerUp=function(E){M.prototype.pointerUp.call(this,E),this.setSize()},g.prototype.setStrokeColor=function(E){this.strokeColor=E,this.visual&&X.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(E),this.stateChanged()},g.prototype.setFillColor=function(E){this.fillColor=E,this.visual&&X.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(E),this.stateChanged()},g.prototype.setStrokeWidth=function(E){this.strokeWidth=E,this.visual&&X.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},g.prototype.setStrokeDasharray=function(E){this.strokeDasharray=E,this.visual&&X.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},g.prototype.setOpacity=function(E){this.opacity=E,this.visual&&X.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),g.prototype.getState=function(){var E=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},M.prototype.getState.call(this));return E.typeName=g.typeName,E},g.prototype.restoreState=function(E){var D=E;this.fillColor=D.fillColor,this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.opacity=D.opacity,this.createVisual(),M.prototype.restoreState.call(this,E),this.setSize()},g.prototype.scale=function(E,D){M.prototype.scale.call(this,E,D),this.setSize()},g.typeName="EllipseMarker",g.title="Ellipse marker",g.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>',g}(Se),ze=function(M){function g(E,D,W){return M.call(this,E,D,W)||this}return q(g,M),Object.defineProperty(g.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),g.prototype.ownsTarget=function(E){return!(!M.prototype.ownsTarget.call(this,E)&&E!==this.tip1&&E!==this.tip2)},g.prototype.createTips=function(){this.tip1=X.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(X.createTransform()),this.visual.appendChild(this.tip1),this.tip2=X.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(X.createTransform()),this.visual.appendChild(this.tip2)},g.prototype.pointerDown=function(E,D){M.prototype.pointerDown.call(this,E,D),this.state==="creating"&&this.createTips()},g.prototype.adjustVisual=function(){if(M.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(X.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()]]),X.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 E=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),D=this.tip1.transform.baseVal.getItem(0);D.setRotate(E,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(D,0);var W=this.tip2.transform.baseVal.getItem(0);W.setRotate(E+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(W,0)}},Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),g.prototype.getState=function(){var E=M.prototype.getState.call(this);return E.typeName=g.typeName,E},g.prototype.restoreState=function(E){M.prototype.restoreState.call(this,E),this.createTips(),this.adjustVisual()},g.typeName="MeasurementMarker",g.title="Measurement marker",g.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>',g}(qe),lt=function(M){function g(E,D,W){var P=M.call(this,E,D,W)||this;return P.strokePanel.colors=W.defaultColorSet,P.fillColor="transparent",P}return q(g,M),Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),g.prototype.getState=function(){var E=M.prototype.getState.call(this);return E.typeName=g.typeName,E},g.typeName="EllipseFrameMarker",g.title="Ellipse frame marker",g.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>',g}(ke),pt=function(){function M(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(M.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),M.prototype.addUndoStep=function(g){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(g)||(this.undoStack.push(g),JSON.stringify(this.lastRedoStep)!==JSON.stringify(g)&&this.redoStack.splice(0,this.redoStack.length))},M.prototype.replaceLastUndoStep=function(g){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=g)},M.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},M.prototype.undo=function(){if(this.undoStack.length>1){var g=this.undoStack.pop();return g!==void 0&&this.redoStack.push(g),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},M.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},M}(),ct=function(M){function g(E,D,W){var P=M.call(this,E,D,W)||this;return P.strokeColor="transparent",P.strokeWidth=0,P.strokeDasharray="",P.curveX=0,P.curveY=0,P.manipulationStartCurveX=0,P.manipulationStartCurveY=0,P.setStrokeColor=P.setStrokeColor.bind(P),P.setStrokeWidth=P.setStrokeWidth.bind(P),P.setStrokeDasharray=P.setStrokeDasharray.bind(P),P.positionGrips=P.positionGrips.bind(P),P.addControlGrips=P.addControlGrips.bind(P),P.adjustVisual=P.adjustVisual.bind(P),P.setupControlBox=P.setupControlBox.bind(P),P.resize=P.resize.bind(P),P.strokeColor=W.defaultColor,P.strokeWidth=W.defaultStrokeWidth,P.strokeDasharray=W.defaultStrokeDasharray,P.strokePanel=new Ne("Line color",W.defaultColorSet,W.defaultColor),P.strokePanel.onColorChanged=P.setStrokeColor,P.strokeWidthPanel=new et("Line width",W.defaultStrokeWidths,W.defaultStrokeWidth),P.strokeWidthPanel.onWidthChanged=P.setStrokeWidth,P.strokeStylePanel=new Je("Line style",W.defaultStrokeDasharrays,W.defaultStrokeDasharray),P.strokeStylePanel.onStyleChanged=P.setStrokeDasharray,P}return q(g,M),g.prototype.ownsTarget=function(E){return!(!M.prototype.ownsTarget.call(this,E)&&E!==this.visual&&E!==this.selectorCurve&&E!==this.visibleCurve&&!this.curveGrip.ownsTarget(E))},g.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},g.prototype.createVisual=function(){this.visual=X.createGroup(),this.selectorCurve=X.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=X.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)},g.prototype.pointerDown=function(E,D){M.prototype.pointerDown.call(this,E,D),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=E.x,this.curveY=E.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(D)&&(this.activeGrip=this.curveGrip,this._state="resize")},g.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),X.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),X.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),X.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},g.prototype.setupControlBox=function(){M.prototype.setupControlBox.call(this),this.curveControlLine1=X.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=X.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)},g.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,M.prototype.addControlGrips.call(this)},g.prototype.positionGrips=function(){M.prototype.positionGrips.call(this);var E=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-E/2,this.curveY-E/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},g.prototype.manipulate=function(E){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+E.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+E.y-this.manipulationStartY),M.prototype.manipulate.call(this,E)},g.prototype.resize=function(E){this.activeGrip===this.curveGrip&&(this.curveX=E.x,this.curveY=E.y),M.prototype.resize.call(this,E),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},g.prototype.setStrokeColor=function(E){this.strokeColor=E,this.adjustVisual(),this.colorChanged(E)},g.prototype.setStrokeWidth=function(E){this.strokeWidth=E,this.adjustVisual()},g.prototype.setStrokeDasharray=function(E){this.strokeDasharray=E,this.adjustVisual()},g.prototype.scale=function(E,D){this.curveX=this.curveX*E,this.curveY=this.curveY*D,M.prototype.scale.call(this,E,D)},Object.defineProperty(g.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),g.prototype.getState=function(){var E=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},M.prototype.getState.call(this));return E.typeName=g.typeName,E},g.prototype.restoreState=function(E){M.prototype.restoreState.call(this,E);var D=E;this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.curveX=D.curveX,this.curveY=D.curveY,this.createVisual(),this.adjustVisual()},g.typeName="CurveMarker",g.title="Curve marker",g.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>',g}(nt),bt=function(){function M(g,E){E===void 0&&(E=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=g,this.cancelable=E}return Object.defineProperty(M.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),M.prototype.preventDefault=function(){this._defaultPrevented=!0},M}(),St=function(M){function g(E,D,W){var P=M.call(this,E,!1)||this;return P.dataUrl=D,P.state=W,P}return q(g,M),g}(bt),rt=function(M){function g(E,D,W){W===void 0&&(W=!1);var P=M.call(this,E,W)||this;return P.marker=D,P}return q(g,M),g}(bt),Xt=function(){function M(){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 M.prototype.addEventListener=function(g,E){this[g].push(E)},M.prototype.removeEventListener=function(g,E){var D=this[g].indexOf(E);D>-1&&this[g].splice(D,1)},M}(),Pt=function(){function M(g){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new We,this._isOpen=!1,this.undoRedoManager=new pt,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 Xt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=M.instanceCounter++,this.styles=new xe(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=g,this.targetRoot=document.body,this.width=g.clientWidth,this.height=g.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(M.prototype,"ALL_MARKER_TYPES",{get:function(){return[Ze,ne,fe,Ge,lt,ke,re,Ae,ze,$,qe,ct]},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Ze,ne,fe,Ge,ke,re,Ae]},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Ze,ne,fe,Ge,re]},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(g){var E=this;this._availableMarkerTypes.splice(0),g.forEach(function(D){if(typeof D=="string"){var W=E.ALL_MARKER_TYPES.find(function(P){return P.typeName===D});W!==void 0&&E._availableMarkerTypes.push(W)}else E._availableMarkerTypes.push(D)})},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(g){this._zoomLevel=g,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(M.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),M.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),ye.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},M.prototype.show=function(){var g=this;this.styles.styleSheetRoot===void 0&&Le.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=Le.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(E){return E(new bt(g))})},M.prototype.render=function(){return te(this,void 0,void 0,function(){var g;return he(this,function(E){switch(E.label){case 0:return this.setCurrentMarker(),(g=new we).naturalSize=this.renderAtNaturalSize,g.imageType=this.renderImageType,g.imageQuality=this.renderImageQuality,g.markersOnly=this.renderMarkersOnly,g.width=this.renderWidth,g.height=this.renderHeight,[4,g.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return E.sent(),[4,g.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,E.sent()]}})})},M.prototype.close=function(g){var E=this;if(g===void 0&&(g=!1),this.isOpen){var D=!1;g||this.eventListeners.beforeclose.forEach(function(W){var P=new bt(E,!0);W(P),P.defaultPrevented&&(D=!0)}),D||(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(W){return W(new bt(E))}),this.detachEvents(),this._isOpen=!1)}},M.prototype.addMarkersToToolbar=function(){for(var g,E=[],D=0;D<arguments.length;D++)E[D]=arguments[D];(g=this._availableMarkerTypes).push.apply(g,E)},M.prototype.addRenderEventListener=function(g){this.addEventListener("render",function(E){g(E.dataUrl,E.state)})},M.prototype.removeRenderEventListener=function(g){},M.prototype.addCloseEventListener=function(g){this.addEventListener("close",function(){g()})},M.prototype.removeCloseEventListener=function(g){},M.prototype.setupResizeObserver=function(){var g=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){g.resize(g.target.clientWidth,g.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return g.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},M.prototype.onPopupTargetResize=function(){var g=1*this.target.clientWidth/this.target.clientHeight,E=this.editorCanvas.clientWidth/g>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*g:this.editorCanvas.clientWidth,D=E<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/g;this.resize(E,D)},M.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},M.prototype.resize=function(g,E){this._isResizing=!0;var D=g/this.imageWidth,W=E/this.imageHeight;this.imageWidth=Math.round(g),this.imageHeight=Math.round(E),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(D,W),this._isResizing=!1},M.prototype.scaleMarkers=function(g,E){var D,W=this;this._currentMarker&&this._currentMarker instanceof Ge?this._currentMarker.scale(g,E):(D=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(P){P!==W._currentMarker&&P.scale(g,E)}),D!==void 0&&this.setCurrentMarker(D)},M.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"},M.prototype.setTopLeft=function(){var g=this.editingTarget.getBoundingClientRect(),E=this.editorCanvas.getBoundingClientRect();this.left=g.left-E.left,this.top=g.top-E.top},M.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)},M.prototype.addDefs=function(){for(var g,E=[],D=0;D<arguments.length;D++)E[D]=arguments[D];this.defs=X.createDefs(),this.addDefsToImage(),(g=this.defs).append.apply(g,E)},M.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},M.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)},M.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},M.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},M.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)},M.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},M.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)},M.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 g=document.createElement("a");g.href="https://markerjs.com/",g.target="_blank",g.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>',g.title="Powered by marker.js",g.style.display="grid",g.style.alignItems="center",g.style.justifyItems="center",g.style.padding="3px",g.style.width="20px",g.style.height="20px",this.logoUI.appendChild(g),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},M.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")},M.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"},M.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},M.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 g=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=g+"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 Ie(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},M.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},M.prototype.removeMarker=function(g){this.markerImage.removeChild(g.container),this.markers.indexOf(g)>-1&&this.markers.splice(this.markers.indexOf(g),1),g.dispose()},M.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())},M.prototype.toolbarButtonClicked=function(g,E){if(g==="marker"&&E!==void 0)this.createNewMarker(E);else if(g==="action")switch(E){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},M.prototype.deleteSelectedMarker=function(){var g=this;if(this._currentMarker!==void 0){var E=!1;if(this.eventListeners.markerbeforedelete.forEach(function(W){var P=new rt(g,g._currentMarker,!0);W(P),P.defaultPrevented&&(E=!0)}),!E){var D=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(W){return W(new rt(g,D))})}}},M.prototype.clear=function(){var g=this,E=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(pe){var Fe=new rt(g,void 0,!0);pe(Fe),Fe.defaultPrevented&&(E=!0)}),!E)){this.setCurrentMarker();for(var D=function(pe){var Fe=W.markers[pe];W.setCurrentMarker(W.markers[pe]),W._currentMarker.dispose(),W.markerImage.removeChild(W._currentMarker.container),W.markers.splice(W.markers.indexOf(W._currentMarker),1),W.eventListeners.markerdelete.forEach(function(it){return it(new rt(g,Fe))})},W=this,P=this.markers.length-1;P>=0;P--)D(P);this.addUndoStep()}},Object.defineProperty(M.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),M.prototype.showNotesEditor=function(){var g;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=(g=this._currentMarker.notes)!==null&&g!==void 0?g:"",this.overlayContainer.appendChild(this.notesArea))},M.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)},M.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},M.prototype.addUndoStep=function(){var g=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var E=this.getState(),D=this.undoRedoManager.getLastUndoStep();if(!D||D.width===E.width&&D.height===E.height){var W=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(E),W<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(P){return P(new bt(g))})}else this.undoRedoManager.replaceLastUndoStep(E),this.eventListeners.statechange.forEach(function(P){return P(new bt(g))})}},M.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},M.prototype.undoStep=function(){var g=this,E=this.undoRedoManager.undo();E!==void 0&&(this.restoreState(E),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(D){return D(new bt(g))}))},M.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},M.prototype.redoStep=function(){var g=this,E=this.undoRedoManager.redo();E!==void 0&&(this.restoreState(E),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(D){return D(new bt(g))}))},M.prototype.stepZoom=function(){var g=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=g<this.zoomSteps.length-1?this.zoomSteps[g+1]:this.zoomSteps[0]},M.prototype.panTo=function(g){this.contentDiv.scrollBy({left:this.prevPanPoint.x-g.x,top:this.prevPanPoint.y-g.y}),this.prevPanPoint=g},M.prototype.startRenderAndClose=function(){return te(this,void 0,void 0,function(){var g,E,D=this;return he(this,function(W){switch(W.label){case 0:return[4,this.render()];case 1:return g=W.sent(),E=this.getState(),this.eventListeners.render.forEach(function(P){return P(new St(D,g,E))}),this.close(!0),[2]}})})},M.prototype.getState=function(g){g===!0&&this.setCurrentMarker();var E={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(D){return E.markers.push(D.getState())}),E},M.prototype.restoreState=function(g){var E=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);g.markers.forEach(function(D){var W=E._availableMarkerTypes.find(function(pe){return pe.typeName===D.typeName});if(W!==void 0){var P=E.addNewMarker(W);P.restoreState(D),E.markers.push(P)}}),g.width&&g.height&&(g.width!==this.imageWidth||g.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/g.width,this.imageHeight/g.height),this.eventListeners.restorestate.forEach(function(D){return D(new bt(E))})},M.prototype.addNewMarker=function(g){var E=X.createGroup();return this.markerImage.appendChild(E),new g(E,this.overlayContainer,this.settings)},M.prototype.createNewMarker=function(g){var E,D=this;(E=typeof g=="string"?this._availableMarkerTypes.find(function(W){return W.typeName===g}):g)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(E),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(E.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(W){return W(new rt(D,D._currentMarker))}))},M.prototype.markerCreated=function(g){var E=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(g),this.setCurrentMarker(g),g instanceof ne&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(ne):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(D){return D(new rt(E,E._currentMarker))})},M.prototype.colorChanged=function(g){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=g,this.settings.defaultStrokeColor=g)},M.prototype.fillColorChanged=function(g){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=g)},M.prototype.markerStateChanged=function(g){var E=this;this.eventListeners.markerchange.forEach(function(D){return D(new rt(E,g))})},M.prototype.setCurrentMarker=function(g){var E=this;this._currentMarker!==g&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(D){return D(new rt(E,E._currentMarker))})),this._currentMarker=g,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(D){return D(new rt(E,E._currentMarker))}))},M.prototype.onPointerDown=function(g){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||g.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var E=this.markers.find(function(D){return D.ownsTarget(g.target)});E!==void 0?(this.setCurrentMarker(E),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(g.clientX,g.clientY),g.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:g.clientX,y:g.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(g.clientX,g.clientY))},M.prototype.onDblClick=function(g){if(this._isFocused||this.focus(),this.mode==="select"){var E=this.markers.find(function(D){return D.ownsTarget(g.target)});E!==void 0&&E!==this._currentMarker&&this.setCurrentMarker(E),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(g.clientX,g.clientY),g.target):this.setCurrentMarker()}},M.prototype.onPointerMove=function(g){this.touchPoints!==1&&g.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||g.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(g.clientX,g.clientY)):this.zoomLevel>1&&this.panTo({x:g.clientX,y:g.clientY}))},M.prototype.onPointerUp=function(g){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(g.clientX,g.clientY)),this.isDragging=!1,this.addUndoStep()},M.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},M.prototype.onKeyUp=function(g){this._currentMarker===void 0||this.notesArea!==void 0||g.key!=="Delete"&&g.key!=="Backspace"||this.deleteSelectedMarker()},M.prototype.clientToLocalCoordinates=function(g,E){var D=this.markerImage.getBoundingClientRect();return{x:(g-D.left)/this.zoomLevel,y:(E-D.top)/this.zoomLevel}},M.prototype.onWindowResize=function(){this.positionUI()},M.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var g=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=g+"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()},M.prototype.addLicenseKey=function(g){ye.addKey(g)},M.prototype.addEventListener=function(g,E){this.eventListeners.addEventListener(g,E)},M.prototype.removeEventListener=function(g,E){this.eventListeners.removeEventListener(g,E)},M.prototype.renderState=function(g){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(g),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(M.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),M.prototype.focus=function(){var g=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(E){return E(new bt(g))}))},M.prototype.blur=function(){var g=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(E){return E(new bt(g))}))},M.instanceCounter=0,M}();/* **********************************
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 Zt=function(M,g){return(Zt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,D){E.__proto__=D}||function(E,D){for(var W in D)Object.prototype.hasOwnProperty.call(D,W)&&(E[W]=D[W])})(M,g)};function Ht(M,g){if(typeof g!="function"&&g!==null)throw new TypeError("Class extends value "+String(g)+" is not a constructor or null");function E(){this.constructor=M}Zt(M,g),M.prototype=g===null?Object.create(g):(E.prototype=g.prototype,new E)}function Et(M,g,E,D){return new(E||(E=Promise))(function(W,P){function pe(st){try{it(D.next(st))}catch(He){P(He)}}function Fe(st){try{it(D.throw(st))}catch(He){P(He)}}function it(st){var He;st.done?W(st.value):(He=st.value,He instanceof E?He:new E(function(gt){gt(He)})).then(pe,Fe)}it((D=D.apply(M,g||[])).next())})}function Jt(M,g){var E,D,W,P,pe={label:0,sent:function(){if(1&W[0])throw W[1];return W[1]},trys:[],ops:[]};return P={next:Fe(0),throw:Fe(1),return:Fe(2)},typeof Symbol=="function"&&(P[Symbol.iterator]=function(){return this}),P;function Fe(it){return function(st){return function(He){if(E)throw new TypeError("Generator is already executing.");for(;pe;)try{if(E=1,D&&(W=2&He[0]?D.return:He[0]?D.throw||((W=D.return)&&W.call(D),0):D.next)&&!(W=W.call(D,He[1])).done)return W;switch(D=0,W&&(He=[2&He[0],W.value]),He[0]){case 0:case 1:W=He;break;case 4:return pe.label++,{value:He[1],done:!1};case 5:pe.label++,D=He[1],He=[0];continue;case 7:He=pe.ops.pop(),pe.trys.pop();continue;default:if(!(W=pe.trys,(W=W.length>0&&W[W.length-1])||He[0]!==6&&He[0]!==2)){pe=0;continue}if(He[0]===3&&(!W||He[1]>W[0]&&He[1]<W[3])){pe.label=He[1];break}if(He[0]===6&&pe.label<W[1]){pe.label=W[1],W=He;break}if(W&&pe.label<W[2]){pe.label=W[2],pe.ops.push(He);break}W[2]&&pe.ops.pop(),pe.trys.pop();continue}He=g.call(M,pe)}catch(gt){He=[6,gt],D=0}finally{E=W=0}if(5&He[0])throw He[1];return{value:He[0]?He[1]:void 0,done:!0}}([it,st])}}}var li=function(){function M(){}return M.addKey=function(g){M.key=g},Object.defineProperty(M,"isLicensed",{get:function(){return!!M.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(M.key)},enumerable:!1,configurable:!0}),M}(),Qe=function(){function M(){}return M.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},M.setAttributes=function(g,E){for(var D=0,W=E;D<W.length;D++){var P=W[D],pe=P[0],Fe=P[1];g.setAttribute(pe,Fe)}},M.createRect=function(g,E,D){var W=document.createElementNS("http://www.w3.org/2000/svg","rect");return W.setAttribute("width",g.toString()),W.setAttribute("height",E.toString()),D&&M.setAttributes(W,D),W},M.createLine=function(g,E,D,W,P){var pe=document.createElementNS("http://www.w3.org/2000/svg","line");return pe.setAttribute("x1",g.toString()),pe.setAttribute("y1",E.toString()),pe.setAttribute("x2",D.toString()),pe.setAttribute("y2",W.toString()),P&&M.setAttributes(pe,P),pe},M.createPolygon=function(g,E){var D=document.createElementNS("http://www.w3.org/2000/svg","polygon");return D.setAttribute("points",g),E&&M.setAttributes(D,E),D},M.createCircle=function(g,E){var D=document.createElementNS("http://www.w3.org/2000/svg","circle");return D.setAttribute("cx",(g/2).toString()),D.setAttribute("cy",(g/2).toString()),D.setAttribute("r",g.toString()),E&&M.setAttributes(D,E),D},M.createEllipse=function(g,E,D){var W=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return W.setAttribute("cx",(g/2).toString()),W.setAttribute("cy",(E/2).toString()),W.setAttribute("rx",(g/2).toString()),W.setAttribute("ry",(E/2).toString()),D&&M.setAttributes(W,D),W},M.createGroup=function(g){var E=document.createElementNS("http://www.w3.org/2000/svg","g");return g&&M.setAttributes(E,g),E},M.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},M.createMarker=function(g,E,D,W,P,pe,Fe){var it=document.createElementNS("http://www.w3.org/2000/svg","marker");return M.setAttributes(it,[["id",g],["orient",E],["markerWidth",D.toString()],["markerHeight",W.toString()],["refX",P.toString()],["refY",pe.toString()]]),it.appendChild(Fe),it},M.createText=function(g){var E=document.createElementNS("http://www.w3.org/2000/svg","text");return E.setAttribute("x","0"),E.setAttribute("y","0"),g&&M.setAttributes(E,g),E},M.createTSpan=function(g,E){var D=document.createElementNS("http://www.w3.org/2000/svg","tspan");return D.textContent=g,E&&M.setAttributes(D,E),D},M.createImage=function(g){var E=document.createElementNS("http://www.w3.org/2000/svg","image");return g&&M.setAttributes(E,g),E},M.createPoint=function(g,E){var D=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return D.x=g,D.y=E,D},M.createPath=function(g,E){var D=document.createElementNS("http://www.w3.org/2000/svg","path");return D.setAttribute("d",g),E&&M.setAttributes(D,E),D},M.createElement=function(g,E){var D=document.createElementNS("http://www.w3.org/2000/svg",g);return E&&M.setAttributes(D,E),D},M.getHollowRectanglePath=function(g,E,D,W,P,pe,Fe,it){return"M"+g+","+E+"V"+(E+W)+"H"+(g+D)+"V"+E+"H"+P+"V"+pe+"H"+(P+Fe)+"V"+(pe+it)+"H"+P+"V"+E+"Z"},M}(),vt=function(){function M(g){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+g+"_"}return Object.defineProperty(M.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(M.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(M.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),M.prototype.addClass=function(g){return this.styleSheet===void 0&&this.addStyleSheet(),g.name=""+this.classNamePrefix+g.localName,this.classes.push(g),this.styleSheet.sheet.insertRule("."+g.name+" {"+g.style+"}",this.styleSheet.sheet.cssRules.length),g},M.prototype.addRule=function(g){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(g),this.styleSheet.sheet.insertRule(g.selector+" {"+g.style+"}",this.styleSheet.sheet.cssRules.length)},M.prototype.addStyleSheet=function(){var g;this.styleSheet=document.createElement("style"),((g=this.styleSheetRoot)!==null&&g!==void 0?g:document.head).appendChild(this.styleSheet),this.addRule(new _t("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new _t("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new _t("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new yt("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new yt("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},M.prototype.removeStyleSheet=function(){var g;this.styleSheet&&(((g=this.styleSheetRoot)!==null&&g!==void 0?g:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},M}(),_t=function(M,g){this.selector=M,this.style=g},yt=function(M,g){this.localName=M,this.style=g},ii=function(){function M(){this.blocks=[],this.display=""}return M.prototype.addButtonBlock=function(g){g.className=this.blockClassName,g.buttonClassName=this.buttonClassName,g.buttonColorsClassName=this.buttonColorsClassName,g.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(g)},M.prototype.addElementBlock=function(g){g.className===void 0&&(g.className=this.blockClassName),this.blocks.push(g)},M.prototype.getUI=function(){var g=document.createElement("div");return g.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,g.style.display=this.display,this.blocks.forEach(function(E){return g.appendChild(E.getUI())}),g},M}(),gi=function(){function M(){}return M.prototype.getUI=function(){var g=document.createElement("div");if(g.className=this.className,this.minWidth!==void 0&&(g.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":g.style.justifyContent="flex-start";break;case"center":g.style.justifyContent="center";break;case"end":g.style.justifyContent="flex-end"}return g.style.whiteSpace="nowrap",g},M}(),Ti=function(M){function g(){var E=M!==null&&M.apply(this,arguments)||this;return E.buttons=[],E}return Ht(g,M),g.prototype.addButton=function(E){E.className=this.buttonClassName,E.colorsClassName=this.buttonColorsClassName,E.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(E)},g.prototype.getUI=function(){var E=M.prototype.getUI.call(this);return this.buttons.forEach(function(D){return E.appendChild(D.getUI())}),E},g}(gi),ui=function(){function M(g,E){this._isActive=!1,this._isHidden=!1,this._icon=g,this.title=E,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(M.prototype,"icon",{get:function(){return this._icon},set:function(g){this._icon=g,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isActive",{get:function(){return this._isActive},set:function(g){this._isActive=g,this.adjustClassName()},enumerable:!1,configurable:!0}),M.prototype.getUI=function(){var g=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 g.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},M.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,"")))},M.prototype.hide=function(){this._isHidden=!0},M}(),Ii=function(M){function g(){var E=M!==null&&M.apply(this,arguments)||this;return E.elements=[],E}return Ht(g,M),g.prototype.addElement=function(E){this.elements.push(E)},g.prototype.getUI=function(){var E=M.prototype.getUI.call(this);return this.elements.forEach(function(D){return E.appendChild(D)}),E},g}(gi),xi=function(){function M(g,E){this.horizontal=g,this.vertical=E}return Object.defineProperty(M.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),M.prototype.getVerticalLength=function(g){return g/this.ratio},M.prototype.getHorizontalLength=function(g){return g*this.ratio},M}(),Ai=function(){function M(){}return M.getIcon=function(g,E){if(g>0&&E>0){var D=new xi(g,E),W=D.ratio>=1?20:D.getHorizontalLength(20),P=D.ratio<1?20:D.getVerticalLength(20),pe=document.createElementNS("http://www.w3.org/2000/svg","svg");pe.setAttribute("xmlns","http://www.w3.org/2000/svg"),pe.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(pe);var Fe=Qe.createDefs();pe.appendChild(Fe);var it=Qe.createElement("clipPath",[["id","text-bg-clip"]]);Fe.appendChild(it);var st=Qe.createPath(Qe.getHollowRectanglePath((24-W)/2,(24-P)/2,W,P,(24-W)/2+2,(24-P)/2+2,W-4,P-4));pe.appendChild(st);var He=Qe.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);He.appendChild(Qe.createTSpan(g+":"+E)),pe.appendChild(He);var gt=He.getBBox();Qe.setAttributes(He,[["x",((24-gt.width)/2).toString()],["y",((24-gt.height)/2-gt.y).toString()]]);var jt=Qe.createPath(Qe.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(gt.width))/2,(24-Math.ceil(gt.height))/2,Math.ceil(gt.width),Math.ceil(gt.height)));return it.appendChild(jt),Qe.setAttributes(st,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(pe),pe.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>'},M}(),Ji=function(M){function g(E,D,W){var P=M.call(this,E,D)||this;return P.isDropdownOpen=!1,P.onClick=P.dropdownButtonClicked,P.dropdownButtons=W,P}return Ht(g,M),g.prototype.setupDropdown=function(){var E=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(D){D.className=E.className,D.colorsClassName=E.colorsClassName,E.dropdownBlock.appendChild(D.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},g.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},g.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},g.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},g.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},g.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},g}(ui),Ni=function(){function M(g,E){this.GRIP_SIZE=10,this.color=g,this.fillColor=E,this.visual=Qe.createGroup(),this.visual.appendChild(Qe.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Qe.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return M.prototype.ownsTarget=function(g){return g===this.visual||g===this.visual.childNodes[0]||g===this.visual.childNodes[1]},M.prototype.setCenter=function(g,E){this.visual.childNodes.forEach(function(D){return Qe.setAttributes(D,[["cx",g.toString()],["cy",E.toString()]])})},M}(),on=function(){function M(g,E,D,W){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=g,this.canvasHeight=E,this.margin=D,this.container=W,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(M.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(g){this._aspectRatio=g,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(g){this._isGridVisible=g,this.gridContainer&&Qe.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(g){this._zoomFactor=g,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),M.prototype.open=function(){var g=this;this.cropShadeElement=Qe.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Qe.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var E=0;E<this.numberOfGridLines;E++)this.horizontalGridLines.push(Qe.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(Qe.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(D){return g.gridContainer.appendChild(D)}),this.verticalGridLines.forEach(function(D){return g.gridContainer.appendChild(D)}),this.cropRectElement=Qe.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Ni(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Ni(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Ni(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Ni(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},M.prototype.setCropRectangle=function(g){this.cropRect=g;var E=Object.assign({},this.cropRect);this.zoomFactor!==1&&(E.width=this.cropRect.width*this.zoomFactor,E.height=this.cropRect.height*this.zoomFactor,E.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-E.width/2,E.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-E.height/2),Qe.setAttributes(this.cropRectElement,[["x",E.x.toString()],["y",E.y.toString()],["width",E.width.toString()],["height",E.height.toString()]]);var D=E.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(P,pe){var Fe=E.y+D*(pe+1);Qe.setAttributes(P,[["x1",""+E.x],["y1",""+Fe],["x2",""+(E.x+E.width)],["y2",""+Fe]])});var W=E.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(P,pe){var Fe=E.x+W*(pe+1);Qe.setAttributes(P,[["x1",""+Fe],["y1",""+E.y],["x2",""+Fe],["y2",""+(E.y+E.height)]])}),Qe.setAttributes(this.cropShadeElement,[["d",Qe.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,E.x,E.y,E.width,E.height)]]),this.topLeftGrip.setCenter(E.x,E.y),this.topRightGrip.setCenter(E.x+E.width,E.y),this.bottomLeftGrip.setCenter(E.x,E.y+E.height),this.bottomRightGrip.setCenter(E.x+E.width,E.y+E.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},M.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)},M.prototype.clientToLocalCoordinates=function(g,E){var D=this.container.getBoundingClientRect();return{x:g-D.left+this.margin,y:E-D.top+this.margin}},M.prototype.onPointerDown=function(g){this.container.setPointerCapture(g.pointerId),this.previousPoint=this.clientToLocalCoordinates(g.clientX,g.clientY),this.cropRectElement===g.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(g.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(g.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(g.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(g.target)&&(this.activeGrip=this.bottomRightGrip)},M.prototype.onPointerMove=function(g){if(this.isMoving)this.move(this.clientToLocalCoordinates(g.clientX,g.clientY));else if(this.activeGrip){var E=this.clientToLocalCoordinates(g.clientX,g.clientY);this.resize(E)}g.preventDefault()},M.prototype.onPointerUp=function(g){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(g.pointerId)},M.prototype.move=function(g){var E=g.x-this.previousPoint.x,D=g.y-this.previousPoint.y;this.zoomFactor!==1&&(E=-E/this.zoomFactor,D=-D/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+E),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+D),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=g},M.prototype.resize=function(g){var E=Object.assign({},this.cropRect),D=g.x-this.previousPoint.x,W=g.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:E.x+D<this.margin&&(D=this.margin-E.x),E.x+=D,E.width=this.cropRect.x+this.cropRect.width-E.x;break;case this.bottomRightGrip:case this.topRightGrip:E.width+D>this.canvasWidth*this.zoomFactor&&(D=this.canvasWidth*this.zoomFactor-E.width),E.width+=D}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(E.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(D),E.height=this.aspectRatio.getVerticalLength(E.width)):(E.y+=W,E.height=this.cropRect.y+this.cropRect.height-E.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?E.height=this.aspectRatio.getVerticalLength(E.width):E.height+=W}E.width<10&&(E.x=this.cropRect.x,E.width=10),E.height<10&&(E.y=this.cropRect.y,E.height=10),this.previousPoint=g,E.x>=this.margin&&E.y>=this.margin&&E.x-this.margin+E.width<=this.canvasWidth&&E.y-this.margin+E.height<=this.canvasHeight&&(this.cropRect=E,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},M.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var g=this.cropRect.x+this.cropRect.width/2,E=this.cropRect.y+this.cropRect.height/2,D=this.aspectRatio.getHorizontalLength(this.cropRect.height),W=this.aspectRatio.getVerticalLength(this.cropRect.width);D/this.canvasWidth<W/this.canvasHeight?this.cropRect.width=D:this.cropRect.height=W,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=g-this.cropRect.width/2,this.cropRect.y=E-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},M.prototype.getRescaledRect=function(g,E,D,W,P,pe){var Fe=D/g,it=W/E;return{x:(P.x-pe)*Fe+pe,y:(P.y-pe)*it+pe,width:P.width*Fe,height:P.height*it}},M.prototype.scaleCanvas=function(g,E){var D=this.getRescaledRect(this.canvasWidth,this.canvasHeight,g,E,this.cropRect,this.margin);this.canvasWidth=g,this.canvasHeight=E,this.onCropChange&&this.onCropChange(D),this.setCropRectangle(D)},M}(),Xi=function(){function M(g){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=g,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(M.prototype,"angle",{get:function(){return this._angle},set:function(g){this._angle=g,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),M.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},M.prototype.onPointerDown=function(g){this.controlContainer.setPointerCapture(g.pointerId),this.isDragging=!0,this.previousPoint={x:g.clientX,y:g.clientY}},M.prototype.onPointerMove=function(g){this.isDragging&&(this.onAngleChange&&this.onAngleChange((g.clientX-this.previousPoint.x)/5),this.previousPoint.x=g.clientX)},M.prototype.onPointerUp=function(g){this.isDragging&&this.onAngleChange&&this.onAngleChange((g.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(g.pointerId)},M.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var g=this.angleLabelText.getBBox();Qe.setAttributes(this.angleLabelElement,[["x",((this.width-g.width)/2).toString()],["y",(this.height/2).toString()]])}},M.prototype.positionScaleShape=function(){if(this.scaleShape){var g=this.scaleShape.transform.baseVal.getItem(0);g.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(g,0)}},M.prototype.getVisual=function(){var g=document.createElementNS("http://www.w3.org/2000/svg","svg");g.setAttribute("xmlns","http://www.w3.org/2000/svg"),g.setAttribute("width",this.width+"px"),g.setAttribute("height",this.height+"px"),g.setAttribute("viewBox","0 0 "+this.width+" "+this.height),g.style.flexShrink="0",document.body.appendChild(g);for(var E="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,D=1;D<=this.width/5+10;D++){var W=D%5==0?this.height/3:this.height/6;E+="h4v"+-W+"h1v"+W}E+="v1H0Z",this.scaleShape=Qe.createPath(E);var P=Qe.createTransform();this.scaleShape.transform.baseVal.appendItem(P),g.appendChild(this.scaleShape),this.angleLabelElement=Qe.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Qe.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var pe=Qe.createTSpan("");return pe.innerHTML="&deg;",this.angleLabelElement.appendChild(pe),g.appendChild(this.angleLabelElement),document.body.removeChild(g),g},M}(),qi=function(){function M(){this.naturalSize=!1,this.imageType="image/png"}return M.prototype.rasterize=function(g,E,D,W,P,pe,Fe){var it=this;return new Promise(function(st){var He=document.createElement("canvas");He.width=g.width.baseVal.value-2*W,He.height=g.height.baseVal.value-2*W;var gt=1,jt=1;it.naturalSize===!0?(gt=E.naturalWidth/(g.width.baseVal.value-2*W)/pe,jt=E.naturalHeight/(g.height.baseVal.value-2*W)/Fe,He.width=E.naturalWidth/pe,He.height=E.naturalHeight/Fe):it.width!==void 0&&it.height!==void 0&&(gt=it.width/D.width,jt=it.height/D.height,He.width*=gt,He.height*=jt);var Yt=He.getContext("2d");Yt.translate(He.width/2,He.height/2),Yt.rotate(P*Math.PI/180),Yt.scale(pe,Fe),Yt.translate(-He.width/2,-He.height/2),Yt.drawImage(E,0,0,He.width,He.height);var Oi=document.createElement("canvas");Oi.width=D.width*gt,Oi.height=D.height*jt,Oi.getContext("2d").putImageData(Yt.getImageData((D.x-W)*gt,(D.y-W)*jt,D.width*gt,D.height*jt),0,0),st(Oi.toDataURL(it.imageType,it.imageQuality))})},M}(),Fi=function(){function M(g){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=M.instanceCounter++,this.styles=new vt(this.instanceNo),this.target=g,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(M.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(g){this._zoomToCropEnabled=g,g?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(g){this._isGridVisible=g,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"gridLines",{get:function(){return this._gridLines},set:function(g){this._gridLines=g,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(g){this._rotationAngle=g,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"aspectRatio",{get:function(){var g;return(g=this._aspectRatio)!==null&&g!==void 0?g:this.aspectRatios[0]},set:function(g){this._aspectRatio=g},enumerable:!1,configurable:!0}),M.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},M.prototype.show=function(){this.showUI(),this.open()},M.prototype.close=function(g){g===void 0&&(g=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),g||this.closeEventListeners.forEach(function(E){return E()}),this._isOpen=!1)},M.prototype.addRenderEventListener=function(g){this.renderEventListeners.push(g)},M.prototype.removeRenderEventListener=function(g){this.renderEventListeners.indexOf(g)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(g),1)},M.prototype.addCloseEventListener=function(g){this.closeEventListeners.push(g)},M.prototype.removeCloseEventListener=function(g){this.closeEventListeners.indexOf(g)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(g),1)},M.prototype.setupResizeObserver=function(){var g=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){g.resize(g.target.clientWidth,g.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))},M.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var g=1*this.target.clientWidth/this.target.clientHeight,E=this.contentDiv.clientWidth/g>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*g:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,D=E+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/g;this.resize(E,D)}},M.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},M.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",Qe.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},M.prototype.resize=function(g,E){this.imageWidth=Math.round(g),this.imageHeight=Math.round(E),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()},M.prototype.setEditingTarget=function(){var g=document.createElement("canvas");g.width=this.target.naturalWidth,g.height=this.target.naturalHeight,g.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var E=g.toDataURL();Qe.setAttributes(this.editingTarget,[["href",E]]),this.setEditingTargetSize()},M.prototype.setTopLeft=function(){var g=this.target.getBoundingClientRect(),E=this.editorCanvas.getBoundingClientRect();this.left=g.left-E.left-this.CANVAS_MARGIN,this.top=g.top-E.top-this.CANVAS_MARGIN},M.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=Qe.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=Qe.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=Qe.createGroup(),this.editingTargetRotationScaleContainer=Qe.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var g=Qe.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(g);var E=Qe.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(E),this.editingTargetContainer=Qe.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)},M.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},M.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=Qe.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new on(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()},M.prototype.zoomToCrop=function(){if(this.cropRect){var g=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,E=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=g+"px "+E+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-g+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-E+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},M.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)},M.prototype.cropRectChanged=function(g){this.cropRect=g,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},M.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},M.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"},M.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},M.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 g=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,E=this.target.offsetTop>g+this.CANVAS_MARGIN?this.target.offsetTop-(g+this.CANVAS_MARGIN):0;this.coverDiv.style.top=E+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},M.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},M.prototype.addTopToolbar=function(){var g=this;this.topToolbar=new ii,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var E=new Ti;E.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(E);var D=[];this.aspectRatios.forEach(function(jt){var Yt=new ui(Ai.getIcon(jt.horizontal,jt.vertical),jt.horizontal===0&&jt.vertical===0?"FREE":jt.horizontal+":"+jt.vertical);Yt.onClick=function(){return g.ratioButtonClicked(jt)},D.push(Yt)}),this.aspectRatioButton=new Ji(Ai.getIcon(0,0),"Aspect ratio",D),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,E.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var W=new ui('<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");W.isActive=this.isGridVisible,W.onClick=function(){g.isGridVisible=!g.isGridVisible,W.isActive=g.isGridVisible},E.addButton(W);var P=new ui('<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(P.isActive=this.zoomToCropEnabled,P.onClick=function(){g.zoomToCropEnabled=!g.zoomToCropEnabled,P.isActive=g.zoomToCropEnabled},E.addButton(P),!li.isLicensed){var pe=new Ii;this.topToolbar.addElementBlock(pe);var Fe=document.createElement("div");Fe.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var it=document.createElement("a");it.style.color="currentColor",it.href="https://markerjs.com/products/cropro",it.target="_blank",it.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>',Fe.appendChild(it),pe.addElement(Fe)}var st=new Ti;st.minWidth=3*this.toolbarHeight+"px",st.contentAlign="end",this.topToolbar.addButtonBlock(st);var He=new ui('<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");He.onClick=this.startRenderAndClose,st.addButton(He),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(He.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var gt=new ui('<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");gt.onClick=this.close,st.addButton(gt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(gt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},M.prototype.addBottomToolbar=function(){var g=this;this.bottomToolbar=new ii,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var E=new Ti;E.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(E);var D=new ui('<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");D.onClick=this.rotateLeftButtonClicked,E.addButton(D);var W=new ui('<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");W.onClick=this.rotateRightButtonClicked,E.addButton(W);var P=new Ii;P.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(P),this.straightener=new Xi("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(st){g.rotateBy(st),g.straightener.angle=g.rotationAngle},P.addElement(this.straightener.getUI());var pe=new Ti;pe.minWidth=2*this.toolbarHeight+"px",pe.contentAlign="end",this.bottomToolbar.addButtonBlock(pe);var Fe=new ui('<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");Fe.onClick=this.flipHorizontallyButtonClicked,pe.addButton(Fe);var it=new ui('<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");it.onClick=this.flipVerticallyButtonClicked,pe.addButton(it)},M.prototype.ratioButtonClicked=function(g){this.aspectRatio=g,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},M.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Ai.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},M.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new xi(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},M.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},M.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},M.prototype.restoreState=function(g){if(g){var E=this.cropLayer.getRescaledRect(g.width,g.height,this.imageWidth,this.imageHeight,g.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(E),this.cropRectChanged(E),this.flippedHorizontally=g.flippedHorizontally,this.flippedVertically=g.flippedVertically,this.applyFlip(),this.rotationAngle=g.rotationAngle,this.applyRotation()}},M.prototype.clientToLocalCoordinates=function(g,E){var D=this.cropImage.getBoundingClientRect();return{x:g-D.left,y:E-D.top}},M.prototype.onWindowResize=function(){this.positionUI()},M.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var g=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=g+"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()},M.prototype.rotateLeftButtonClicked=function(){var g=this.rotationAngle-90;this.rotationAngle%90!=0&&(g+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(g)},M.prototype.rotateRightButtonClicked=function(){var g=this.rotationAngle+90;this.rotationAngle%90!=0&&(g-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(g)},M.prototype.rotateTo=function(g){g=(g=g>180?g-360:g)<=-180?g+360:g,this.rotationAngle=g,this.applyRotation()},M.prototype.rotateBy=function(g){this.rotateTo((this.rotationAngle+g)%360)},M.prototype.applyRotation=function(){var g=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var E=this.editingTargetRotationContainer.transform.baseVal.getItem(0);E.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(E,0);var D=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/D.width,this.imageHeight/D.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=g},M.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},M.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},M.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},M.prototype.startRenderAndClose=function(){return Et(this,void 0,void 0,function(){var g,E;return Jt(this,function(D){switch(D.label){case 0:return[4,this.render()];case 1:return g=D.sent(),E=this.getState(),this.renderEventListeners.forEach(function(W){return W(g,E)}),this.close(!0),[2]}})})},M.prototype.render=function(){return Et(this,void 0,void 0,function(){var g;return Jt(this,function(E){switch(E.label){case 0:return(g=new qi).naturalSize=this.renderAtNaturalSize,g.imageType=this.renderImageType,g.imageQuality=this.renderImageQuality,g.width=this.renderWidth,g.height=this.renderHeight,this.unzoomFromCrop(),Qe.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,g.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return E.sent(),[4,g.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,E.sent()]}})})},M.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new yt("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 yt("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new yt("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var g=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new yt("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*g)+`px;
height: `+(this.toolbarHeight-2*g)+`px;
padding: `+g+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new yt("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new yt("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new _t("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new _t("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new yt("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 yt("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new yt("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 yt("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*g)+`px;
padding: `+g+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new yt("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},M.instanceCounter=0,M}(),Yi=z("8hTe"),Wi=z.n(Yi),Hi=/<pre[^>]*>/g;function ln(M){var g=document.createElement("div");return g.innerHTML=M,g.childNodes.length===0?"":g.childNodes[0].nodeValue}var di=$e.a=function(M){var g=M.value,E=g===void 0?"":g,D=M.edit,W=D===void 0?!1:D,P=M.className,pe=M.showTextOnly,Fe=M.showLines,it=M.replaces,st=M.zoomImg,He=M.hasMask,gt=M.style,jt=gt===void 0?{}:gt,Yt=M.stylesPrev,Oi=Yt===void 0?{}:Yt,Ui=String(E),ci=Object(C.useRef)(),Mi=Object(C.useRef)(),un=Object(C.useState)(""),$i=Object(N.a)(un,2),Ki=$i[0],Bi=$i[1],en=Object(C.useState)("office"),ut=Object(N.a)(en,2),dt=ut[0],Tt=ut[1],kt=function(){var zt=new Fi(Mi.current);zt.displayMode="popup",zt.addRenderEventListener(function(){var fi=Object(I.a)(A.a.mark(function Ft(Si){var ni;return A.a.wrap(function(_i){for(;;)switch(_i.prev=_i.next){case 0:return ci.current.style.display="none",_i.next=3,Object(ce.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Si}});case 3:ni=_i.sent,ni!=null&&ni.id&&it(Mi.current.getAttribute("src").replace(Y.a.API_SERVER,""),"/api/attachments/".concat(ni==null?void 0:ni.id,"?type=").concat(ni.content_type));case 5:case"end":return _i.stop()}},Ft)}));return function(Ft){return fi.apply(this,arguments)}}()),zt.show()},si=function(){var zt=new Pt(Mi.current);zt.settings.displayMode="popup",zt.addEventListener("render",function(){var fi=Object(I.a)(A.a.mark(function Ft(Si){var ni;return A.a.wrap(function(_i){for(;;)switch(_i.prev=_i.next){case 0:if(ci.current.style.display="none",!Mi.current){_i.next=6;break}return _i.next=4,Object(ce.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Si.dataUrl}});case 4:ni=_i.sent,ni!=null&&ni.id&&it(Mi.current.getAttribute("src").replace(Y.a.API_SERVER,""),"/api/attachments/".concat(ni==null?void 0:ni.id,"?type=").concat(ni.content_type));case 6:case"end":return _i.stop()}},Ft)}));return function(Ft){return fi.apply(this,arguments)}}()),zt.show(),window.markerArea=zt},$t=Object(C.useMemo)(function(){ci.current&&(ci.current.style.zIndex=-1);try{var hi=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,zt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,fi=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Ui=Ui.replace(hi,"("+Y.a.API_SERVER+"/api/attachments/").replace(zt,'"'+Y.a.API_SERVER+"/api/attachments/").replace(fi,'"'+Y.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(nn){}var Ft=j(Ui),Si=v();if(Ui.match(/\[TOC\]/)&&(Ft=Ft.replace("<p>[TOC]</p>",b()),T()),Ft=Ft.replace(/(__special_katext_id_\d+__)/g,function(nn,_i){var dn=Si[_i],Sn=dn.type,Cn=dn.expression;return Object(ae.renderToString)(ln(Cn)||"",{displayMode:Sn==="block",throwOnError:!1,output:"html"})}),Ft=Ft.replace(/▁/g,"\u2581\u2581\u2581"),f(),pe){var ni=document.createElement("div");return ni.innerHTML=Ft,ni.innerText}return setTimeout(function(){return xn()},500),Ft},[Ui]),vi=Object(C.useRef)();m.WebkitLineClamp=Fe,Fe&&(jt=Object(S.a)(Object(S.a)({},jt),m));function tn(hi){var zt=hi.target;if(zt.tagName.toUpperCase()==="IMG"){if(st){var fi=zt.getAttribute("src");Bi(fi),Tt("image")}}else if(zt.tagName.toUpperCase()==="A"){var Ft=zt.getAttribute("href");if(Ft.indexOf("office")>-1)hi.preventDefault(),Bi(Ft),Tt("office");else if(Ft.indexOf("application/pdf")>-1)hi.preventDefault(),Bi(Ft),Tt("pdf");else if(Ft.indexOf("text/html")>-1)hi.preventDefault(),Bi(Ft),Tt("html");else if(Ft.startsWith("#")){hi.preventDefault();var Si=document.getElementById(Ft.replace("#",""));Si&&Si.scrollIntoView(!0)}}}var xn=function(){var zt,fi=(zt=vi.current)===null||zt===void 0?void 0:zt.querySelectorAll("video");fi==null||fi.forEach(function(Ft){if(Ft.oncontextmenu=function(){return!1},Ft.src.indexOf(".m3u8")>-1&&!Ft.canPlayType("application/vnd.apple.mpegurl")){if(H.a.isSupported()){var Si=new H.a;Si.loadSource(Ft.src),Si.attachMedia(Ft)}}})};Object(C.useEffect)(function(){if(vi.current&&$t&&($t.match(Hi)&&window.PR.prettyPrint()),vi.current)return vi.current.addEventListener("click",tn),function(){vi.current.removeEventListener("click",tn),f(),T()}},[$t,vi.current,tn]);var Bn=function(zt){if(!W)return;zt.target.nodeName==="IMG"?(ci.current.style.zIndex=1,ci.current.style.display="flex",ci.current.style.width=zt.target.clientWidth+"px",ci.current.style.height=zt.target.clientHeight+"px",ci.current.style.top=zt.target.offsetTop+"px",ci.current.style.left=zt.target.offsetLeft+"px",Mi.current.src=zt.target.getAttribute("src")):ci.current.style.display="none"};return y.a.createElement("div",{style:{position:"relative"}},y.a.createElement("div",{ref:vi,style:Object(S.a)({},jt),className:"".concat(P||""," markdown-body ").concat(Wi.a.mdBody),onMouseOver:Bn,dangerouslySetInnerHTML:{__html:$t}}),y.a.createElement("div",{ref:ci,className:Wi.a.button},y.a.createElement(F.a,null,y.a.createElement(U.a,{onClick:function(){return kt()}},"\u88C1\u526A"),y.a.createElement(U.a,{onClick:function(){return si()}},"\u7F16\u8F91"))),y.a.createElement("img",{ref:Mi,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),y.a.createElement(Z.a,{close:!0,data:Ki,type:Ki!=null&&Ki.length?dt:"",style:Object(S.a)({},Oi),onClose:function(){return Bi("")}}))}},BU3w:function(at,$e,z){"use strict";z.d($e,"a",function(){return I});var _e=z("MNnm"),F="rc-util-key";function w(N){if(N.attachTo)return N.attachTo;var k=document.querySelector("head");return k||document.body}function U(N){var k,A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(_e.a)())return null;var C=document.createElement("style");if((k=A.csp)===null||k===void 0?void 0:k.nonce){var y;C.nonce=(y=A.csp)===null||y===void 0?void 0:y.nonce}C.innerHTML=N;var h=w(A),u=h.firstChild;return A.prepend&&h.prepend?h.prepend(C):A.prepend&&u?h.insertBefore(C,u):h.appendChild(C),C}var S=new Map;function I(N,k){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},C=w(A);if(!S.has(C)){var y=U("",A),h=y.parentNode;S.set(C,h),h.removeChild(y)}var u=Array.from(S.get(C).children).find(function(t){return t.tagName==="STYLE"&&t[F]===k});if(u){var o,e;if(((o=A.csp)===null||o===void 0?void 0:o.nonce)&&u.nonce!==((e=A.csp)===null||e===void 0?void 0:e.nonce)){var d;u.nonce=(d=A.csp)===null||d===void 0?void 0:d.nonce}return u.innerHTML!==N&&(u.innerHTML=N),u}var s=U(N,A);return s[F]=k,s}},BdwD:function(at,$e,z){"use strict";var _e=z("+L6B"),F=z("2/Rp"),w=z("0Owb"),U=z("k1fw"),S=z("q1tI"),I=z.n(S),N=z("FOrL"),k=z.n(N),A=function(y){var h=y.buttonProps,u=h===void 0?{}:h,o=y.styles,e=o===void 0?{}:o,d=y.customText,s=y.ButtonText,t=y.ButtonClick,i=y.Buttonclass,n=y.ButtonTwo;return I.a.createElement("section",{className:"tc animated fadeIn",style:Object(U.a)(Object(U.a)({},{color:"#999",margin:"200px auto"}),e)},I.a.createElement("img",{src:k.a}),I.a.createElement("p",{className:"mt20 font14"},d||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),s&&I.a.createElement(F.a,Object(w.a)({className:i,onClick:t},u),s),n&&n)};$e.a=A},DlQD:function(at,$e,z){(function(_e,F){at.exports=F()})(this,function(){"use strict";function _e(ne,le){for(var fe=0;fe<le.length;fe++){var $=le[fe];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(ne,$.key,$)}}function F(ne,le,fe){return le&&_e(ne.prototype,le),fe&&_e(ne,fe),ne}function w(ne,le){if(!ne)return;if(typeof ne=="string")return U(ne,le);var fe=Object.prototype.toString.call(ne).slice(8,-1);if(fe==="Object"&&ne.constructor&&(fe=ne.constructor.name),fe==="Map"||fe==="Set")return Array.from(ne);if(fe==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(fe))return U(ne,le)}function U(ne,le){(le==null||le>ne.length)&&(le=ne.length);for(var fe=0,$=new Array(le);fe<le;fe++)$[fe]=ne[fe];return $}function S(ne,le){var fe;if(typeof Symbol=="undefined"||ne[Symbol.iterator]==null){if(Array.isArray(ne)||(fe=w(ne))||le&&ne&&typeof ne.length=="number"){fe&&(ne=fe);var $=0;return function(){return $>=ne.length?{done:!0}:{done:!1,value:ne[$++]}}}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 fe=ne[Symbol.iterator](),fe.next.bind(fe)}function I(ne,le){return le={exports:{}},ne(le,le.exports),le.exports}var N=I(function(ne){function le(){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 fe($){ne.exports.defaults=$}ne.exports={defaults:le(),getDefaults:le,changeDefaults:fe}}),k=N.defaults,A=N.getDefaults,C=N.changeDefaults,y=/[&<>"']/,h=/[&<>"']/g,u=/[<>"']|&(?!#?\w+;)/,o=/[<>"']|&(?!#?\w+;)/g,e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},d=function(le){return e[le]};function s(ne,le){if(le){if(y.test(ne))return ne.replace(h,d)}else if(u.test(ne))return ne.replace(o,d);return ne}var t=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function i(ne){return ne.replace(t,function(le,fe){return fe=fe.toLowerCase(),fe==="colon"?":":fe.charAt(0)==="#"?fe.charAt(1)==="x"?String.fromCharCode(parseInt(fe.substring(2),16)):String.fromCharCode(+fe.substring(1)):""})}var n=/(^|[^\[])\^/g;function T(ne,le){ne=ne.source||ne,le=le||"";var fe={replace:function(Q,re){return re=re.source||re,re=re.replace(n,"$1"),ne=ne.replace(Q,re),fe},getRegex:function(){return new RegExp(ne,le)}};return fe}var m=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function b(ne,le,fe){if(ne){var $;try{$=decodeURIComponent(i(fe)).replace(m,"").toLowerCase()}catch(Q){return null}if($.indexOf("javascript:")===0||$.indexOf("vbscript:")===0||$.indexOf("data:")===0)return null}le&&!p.test(fe)&&(fe=l(le,fe));try{fe=encodeURI(fe).replace(/%25/g,"%")}catch(Q){return null}return fe}var _={},a=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,r=/^([^:]+:\/*[^/]*)[\s\S]*$/;function l(ne,le){_[" "+ne]||(a.test(ne)?_[" "+ne]=ne+"/":_[" "+ne]=R(ne,"/",!0)),ne=_[" "+ne];var fe=ne.indexOf(":")===-1;return le.substring(0,2)==="//"?fe?le:ne.replace(c,"$1")+le:le.charAt(0)==="/"?fe?le:ne.replace(r,"$1")+le:ne+le}var v={exec:function(){}};function f(ne){for(var le=1,fe,$;le<arguments.length;le++){fe=arguments[le];for($ in fe)Object.prototype.hasOwnProperty.call(fe,$)&&(ne[$]=fe[$])}return ne}function x(ne,le){var fe=ne.replace(/\|/g,function(re,me,Ae){for(var ke=!1,ze=me;--ze>=0&&Ae[ze]==="\\";)ke=!ke;return ke?"|":" |"}),$=fe.split(/ \|/),Q=0;if($.length>le)$.splice(le);else for(;$.length<le;)$.push("");for(;Q<$.length;Q++)$[Q]=$[Q].trim().replace(/\\\|/g,"|");return $}function R(ne,le,fe){var $=ne.length;if($===0)return"";for(var Q=0;Q<$;){var re=ne.charAt($-Q-1);if(re===le&&!fe)Q++;else if(re!==le&&fe)Q++;else break}return ne.substr(0,$-Q)}function O(ne,le){if(ne.indexOf(le[1])===-1)return-1;for(var fe=ne.length,$=0,Q=0;Q<fe;Q++)if(ne[Q]==="\\")Q++;else if(ne[Q]===le[0])$++;else if(ne[Q]===le[1]&&($--,$<0))return Q;return-1}function B(ne){ne&&ne.sanitize&&!ne.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 j={escape:s,unescape:i,edit:T,cleanUrl:b,resolveUrl:l,noopTest:v,merge:f,splitCells:x,rtrim:R,findClosingBracket:O,checkSanitizeDeprecation:B},K=N.defaults,L=j.rtrim,H=j.splitCells,Y=j.escape,ae=j.findClosingBracket;function Z(ne,le,fe){var $=le.href,Q=le.title?Y(le.title):null,re=ne[1].replace(/\\([\[\]])/g,"$1");return ne[0].charAt(0)!=="!"?{type:"link",raw:fe,href:$,title:Q,text:re}:{type:"image",raw:fe,href:$,title:Q,text:Y(re)}}function ce(ne,le){var fe=ne.match(/^(\s+)(?:```)/);if(fe===null)return le;var $=fe[1];return le.split(`
`).map(function(Q){var re=Q.match(/^\s+/);if(re===null)return Q;var me=re[0];return me.length>=$.length?Q.slice($.length):Q}).join(`
`)}var de=function(){function ne(fe){this.options=fe||K}var le=ne.prototype;return le.space=function($){var Q=this.rules.block.newline.exec($);if(Q)return Q[0].length>1?{type:"space",raw:Q[0]}:{raw:`
`}},le.code=function($,Q){var re=this.rules.block.code.exec($);if(re){var me=Q[Q.length-1];if(me&&me.type==="paragraph")return{raw:re[0],text:re[0].trimRight()};var Ae=re[0].replace(/^ {4}/gm,"");return{type:"code",raw:re[0],codeBlockStyle:"indented",text:this.options.pedantic?Ae:L(Ae,`
`)}}},le.fences=function($){var Q=this.rules.block.fences.exec($);if(Q){var re=Q[0],me=ce(re,Q[3]||"");return{type:"code",raw:re,lang:Q[2]?Q[2].trim():Q[2],text:me}}},le.heading=function($){var Q=this.rules.block.heading.exec($);if(Q)return{type:"heading",raw:Q[0],depth:Q[1].length,text:Q[2]}},le.nptable=function($){var Q=this.rules.block.nptable.exec($);if(Q){var re={type:"table",header:H(Q[1].replace(/^ *| *\| *$/g,"")),align:Q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Q[3]?Q[3].replace(/\n$/,"").split(`
`):[],raw:Q[0]};if(re.header.length===re.align.length){var me=re.align.length,Ae;for(Ae=0;Ae<me;Ae++)/^ *-+: *$/.test(re.align[Ae])?re.align[Ae]="right":/^ *:-+: *$/.test(re.align[Ae])?re.align[Ae]="center":/^ *:-+ *$/.test(re.align[Ae])?re.align[Ae]="left":re.align[Ae]=null;for(me=re.cells.length,Ae=0;Ae<me;Ae++)re.cells[Ae]=H(re.cells[Ae],re.header.length);return re}}},le.hr=function($){var Q=this.rules.block.hr.exec($);if(Q)return{type:"hr",raw:Q[0]}},le.blockquote=function($){var Q=this.rules.block.blockquote.exec($);if(Q){var re=Q[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Q[0],text:re}}},le.list=function($){var Q=this.rules.block.list.exec($);if(Q){for(var re=Q[0],me=Q[2],Ae=me.length>1,ke=me[me.length-1]===")",ze={type:"list",raw:re,ordered:Ae,start:Ae?+me.slice(0,-1):"",loose:!1,items:[]},lt=Q[0].match(this.rules.block.item),pt=!1,ct,bt,St,rt,Xt,Pt,Zt,Ht=lt.length,Et=0;Et<Ht;Et++)ct=lt[Et],re=ct,bt=ct.length,ct=ct.replace(/^ *([*+-]|\d+[.)]) */,""),~ct.indexOf(`
`)&&(bt-=ct.length,ct=this.options.pedantic?ct.replace(/^ {1,4}/gm,""):ct.replace(new RegExp("^ {1,"+bt+"}","gm"),"")),Et!==Ht-1&&(St=this.rules.block.bullet.exec(lt[Et+1])[0],(Ae?St.length===1||!ke&&St[St.length-1]===")":St.length>1||this.options.smartLists&&St!==me)&&(rt=lt.slice(Et+1).join(`
`),ze.raw=ze.raw.substring(0,ze.raw.length-rt.length),Et=Ht-1)),Xt=pt||/\n\n(?!\s*$)/.test(ct),Et!==Ht-1&&(pt=ct.charAt(ct.length-1)===`
`,Xt||(Xt=pt)),Xt&&(ze.loose=!0),Pt=/^\[[ xX]\] /.test(ct),Zt=void 0,Pt&&(Zt=ct[1]!==" ",ct=ct.replace(/^\[[ xX]\] +/,"")),ze.items.push({type:"list_item",raw:re,task:Pt,checked:Zt,loose:Xt,text:ct});return ze}},le.html=function($){var Q=this.rules.block.html.exec($);if(Q)return{type:this.options.sanitize?"paragraph":"html",raw:Q[0],pre:!this.options.sanitizer&&(Q[1]==="pre"||Q[1]==="script"||Q[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Q[0]):Y(Q[0]):Q[0]}},le.def=function($){var Q=this.rules.block.def.exec($);if(Q){Q[3]&&(Q[3]=Q[3].substring(1,Q[3].length-1));var re=Q[1].toLowerCase().replace(/\s+/g," ");return{tag:re,raw:Q[0],href:Q[2],title:Q[3]}}},le.table=function($){var Q=this.rules.block.table.exec($);if(Q){var re={type:"table",header:H(Q[1].replace(/^ *| *\| *$/g,"")),align:Q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Q[3]?Q[3].replace(/\n$/,"").split(`
`):[]};if(re.header.length===re.align.length){re.raw=Q[0];var me=re.align.length,Ae;for(Ae=0;Ae<me;Ae++)/^ *-+: *$/.test(re.align[Ae])?re.align[Ae]="right":/^ *:-+: *$/.test(re.align[Ae])?re.align[Ae]="center":/^ *:-+ *$/.test(re.align[Ae])?re.align[Ae]="left":re.align[Ae]=null;for(me=re.cells.length,Ae=0;Ae<me;Ae++)re.cells[Ae]=H(re.cells[Ae].replace(/^ *\| *| *\| *$/g,""),re.header.length);return re}}},le.lheading=function($){var Q=this.rules.block.lheading.exec($);if(Q)return{type:"heading",raw:Q[0],depth:Q[2].charAt(0)==="="?1:2,text:Q[1]}},le.paragraph=function($){var Q=this.rules.block.paragraph.exec($);if(Q)return{type:"paragraph",raw:Q[0],text:Q[1].charAt(Q[1].length-1)===`
`?Q[1].slice(0,-1):Q[1]}},le.text=function($,Q){var re=this.rules.block.text.exec($);if(re){var me=Q[Q.length-1];return me&&me.type==="text"?{raw:re[0],text:re[0]}:{type:"text",raw:re[0],text:re[0]}}},le.escape=function($){var Q=this.rules.inline.escape.exec($);if(Q)return{type:"escape",raw:Q[0],text:Y(Q[1])}},le.tag=function($,Q,re){var me=this.rules.inline.tag.exec($);if(me)return!Q&&/^<a /i.test(me[0])?Q=!0:Q&&/^<\/a>/i.test(me[0])&&(Q=!1),!re&&/^<(pre|code|kbd|script)(\s|>)/i.test(me[0])?re=!0:re&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(me[0])&&(re=!1),{type:this.options.sanitize?"text":"html",raw:me[0],inLink:Q,inRawBlock:re,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(me[0]):Y(me[0]):me[0]}},le.link=function($){var Q=this.rules.inline.link.exec($);if(Q){var re=ae(Q[2],"()");if(re>-1){var me=Q[0].indexOf("!")===0?5:4,Ae=me+Q[1].length+re;Q[2]=Q[2].substring(0,re),Q[0]=Q[0].substring(0,Ae).trim(),Q[3]=""}var ke=Q[2],ze="";if(this.options.pedantic){var lt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ke);lt?(ke=lt[1],ze=lt[3]):ze=""}else ze=Q[3]?Q[3].slice(1,-1):"";ke=ke.trim().replace(/^<([\s\S]*)>$/,"$1");var pt=Z(Q,{href:ke&&ke.replace(this.rules.inline._escapes,"$1"),title:ze&&ze.replace(this.rules.inline._escapes,"$1")},Q[0]);return pt}},le.reflink=function($,Q){var re;if((re=this.rules.inline.reflink.exec($))||(re=this.rules.inline.nolink.exec($))){var me=(re[2]||re[1]).replace(/\s+/g," ");if(me=Q[me.toLowerCase()],!me||!me.href){var Ae=re[0].charAt(0);return{type:"text",raw:Ae,text:Ae}}var ke=Z(re,me,re[0]);return ke}},le.strong=function($,Q,re){re===void 0&&(re="");var me=this.rules.inline.strong.start.exec($);if(me&&(!me[1]||me[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){Q=Q.slice(-1*$.length);var Ae=me[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Ae.lastIndex=0;for(var ke;(me=Ae.exec(Q))!=null;)if(ke=this.rules.inline.strong.middle.exec(Q.slice(0,me.index+3)),ke)return{type:"strong",raw:$.slice(0,ke[0].length),text:$.slice(2,ke[0].length-2)}}},le.em=function($,Q,re){re===void 0&&(re="");var me=this.rules.inline.em.start.exec($);if(me&&(!me[1]||me[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){Q=Q.slice(-1*$.length);var Ae=me[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Ae.lastIndex=0;for(var ke;(me=Ae.exec(Q))!=null;)if(ke=this.rules.inline.em.middle.exec(Q.slice(0,me.index+2)),ke)return{type:"em",raw:$.slice(0,ke[0].length),text:$.slice(1,ke[0].length-1)}}},le.codespan=function($){var Q=this.rules.inline.code.exec($);if(Q){var re=Q[2].replace(/\n/g," "),me=/[^ ]/.test(re),Ae=re.startsWith(" ")&&re.endsWith(" ");return me&&Ae&&(re=re.substring(1,re.length-1)),re=Y(re,!0),{type:"codespan",raw:Q[0],text:re}}},le.br=function($){var Q=this.rules.inline.br.exec($);if(Q)return{type:"br",raw:Q[0]}},le.del=function($){var Q=this.rules.inline.del.exec($);if(Q)return{type:"del",raw:Q[0],text:Q[1]}},le.autolink=function($,Q){var re=this.rules.inline.autolink.exec($);if(re){var me,Ae;return re[2]==="@"?(me=Y(this.options.mangle?Q(re[1]):re[1]),Ae="mailto:"+me):(me=Y(re[1]),Ae=me),{type:"link",raw:re[0],text:me,href:Ae,tokens:[{type:"text",raw:me,text:me}]}}},le.url=function($,Q){var re;if(re=this.rules.inline.url.exec($)){var me,Ae;if(re[2]==="@")me=Y(this.options.mangle?Q(re[0]):re[0]),Ae="mailto:"+me;else{var ke;do ke=re[0],re[0]=this.rules.inline._backpedal.exec(re[0])[0];while(ke!==re[0]);me=Y(re[0]),re[1]==="www."?Ae="http://"+me:Ae=me}return{type:"link",raw:re[0],text:me,href:Ae,tokens:[{type:"text",raw:me,text:me}]}}},le.inlineText=function($,Q,re){var me=this.rules.inline.text.exec($);if(me){var Ae;return Q?Ae=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(me[0]):Y(me[0]):me[0]:Ae=Y(this.options.smartypants?re(me[0]):me[0]),{type:"text",raw:me[0],text:Ae}}},ne}(),q=j.noopTest,te=j.edit,he=j.merge,J={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:q,table:q,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};J._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,J._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,J.def=te(J.def).replace("label",J._label).replace("title",J._title).getRegex(),J.bullet=/(?:[*+-]|\d{1,9}[.)])/,J.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,J.item=te(J.item,"gm").replace(/bull/g,J.bullet).getRegex(),J.list=te(J.list).replace(/bull/g,J.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+J.def.source+")").getRegex(),J._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",J._comment=/<!--(?!-?>)[\s\S]*?-->/,J.html=te(J.html,"i").replace("comment",J._comment).replace("tag",J._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),J.paragraph=te(J._paragraph).replace("hr",J.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",J._tag).getRegex(),J.blockquote=te(J.blockquote).replace("paragraph",J.paragraph).getRegex(),J.normal=he({},J),J.gfm=he({},J.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*|$)"}),J.gfm.nptable=te(J.gfm.nptable).replace("hr",J.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",J._tag).getRegex(),J.gfm.table=te(J.gfm.table).replace("hr",J.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",J._tag).getRegex(),J.pedantic=he({},J.normal,{html:te(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",J._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:q,paragraph:te(J.normal._paragraph).replace("hr",J.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",J.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var X={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:q,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:q,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};X._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",X.punctuation=te(X.punctuation).replace(/punctuation/g,X._punctuation).getRegex(),X._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",X._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",X.em.start=te(X.em.start).replace(/punctuation/g,X._punctuation).getRegex(),X.em.middle=te(X.em.middle).replace(/punctuation/g,X._punctuation).replace(/overlapSkip/g,X._overlapSkip).getRegex(),X.em.endAst=te(X.em.endAst,"g").replace(/punctuation/g,X._punctuation).getRegex(),X.em.endUnd=te(X.em.endUnd,"g").replace(/punctuation/g,X._punctuation).getRegex(),X.strong.start=te(X.strong.start).replace(/punctuation/g,X._punctuation).getRegex(),X.strong.middle=te(X.strong.middle).replace(/punctuation/g,X._punctuation).replace(/blockSkip/g,X._blockSkip).getRegex(),X.strong.endAst=te(X.strong.endAst,"g").replace(/punctuation/g,X._punctuation).getRegex(),X.strong.endUnd=te(X.strong.endUnd,"g").replace(/punctuation/g,X._punctuation).getRegex(),X.blockSkip=te(X._blockSkip,"g").getRegex(),X.overlapSkip=te(X._overlapSkip,"g").getRegex(),X._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,X._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,X._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])?)+(?![-_])/,X.autolink=te(X.autolink).replace("scheme",X._scheme).replace("email",X._email).getRegex(),X._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,X.tag=te(X.tag).replace("comment",J._comment).replace("attribute",X._attribute).getRegex(),X._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,X._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,X._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,X.link=te(X.link).replace("label",X._label).replace("href",X._href).replace("title",X._title).getRegex(),X.reflink=te(X.reflink).replace("label",X._label).getRegex(),X.reflinkSearch=te(X.reflinkSearch,"g").replace("reflink",X.reflink).replace("nolink",X.nolink).getRegex(),X.normal=he({},X),X.pedantic=he({},X.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:te(/^!?\[(label)\]\((.*?)\)/).replace("label",X._label).getRegex(),reflink:te(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",X._label).getRegex()}),X.gfm=he({},X.normal,{escape:te(X.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),X.gfm.url=te(X.gfm.url,"i").replace("email",X.gfm._extended_email).getRegex(),X.breaks=he({},X.gfm,{br:te(X.br).replace("{2,}","*").getRegex(),text:te(X.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var ye={block:J,inline:X},we=N.defaults,Le=ye.block,xe=ye.inline;function Re(ne){return ne.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 Te(ne){var le="",fe,$,Q=ne.length;for(fe=0;fe<Q;fe++)$=ne.charCodeAt(fe),Math.random()>.5&&($="x"+$.toString(16)),le+="&#"+$+";";return le}var Oe=function(){function ne(fe){this.tokens=[],this.tokens.links=Object.create(null),this.options=fe||we,this.options.tokenizer=this.options.tokenizer||new de,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var $={block:Le.normal,inline:xe.normal};this.options.pedantic?($.block=Le.pedantic,$.inline=xe.pedantic):this.options.gfm&&($.block=Le.gfm,this.options.breaks?$.inline=xe.breaks:$.inline=xe.gfm),this.tokenizer.rules=$}ne.lex=function($,Q){var re=new ne(Q);return re.lex($)};var le=ne.prototype;return le.lex=function($){return $=$.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens($,this.tokens,!0),this.inline(this.tokens),this.tokens},le.blockTokens=function($,Q,re){Q===void 0&&(Q=[]),re===void 0&&(re=!0),$=$.replace(/^ +$/gm,"");for(var me,Ae,ke,ze;$;){if(me=this.tokenizer.space($)){$=$.substring(me.raw.length),me.type&&Q.push(me);continue}if(me=this.tokenizer.code($,Q)){$=$.substring(me.raw.length),me.type?Q.push(me):(ze=Q[Q.length-1],ze.raw+=`
`+me.raw,ze.text+=`
`+me.text);continue}if(me=this.tokenizer.fences($)){$=$.substring(me.raw.length),Q.push(me);continue}if(me=this.tokenizer.heading($)){$=$.substring(me.raw.length),Q.push(me);continue}if(me=this.tokenizer.nptable($)){$=$.substring(me.raw.length),Q.push(me);continue}if(me=this.tokenizer.hr($)){$=$.substring(me.raw.length),Q.push(me);continue}if(me=this.tokenizer.blockquote($)){$=$.substring(me.raw.length),me.tokens=this.blockTokens(me.text,[],re),Q.push(me);continue}if(me=this.tokenizer.list($)){for($=$.substring(me.raw.length),ke=me.items.length,Ae=0;Ae<ke;Ae++)me.items[Ae].tokens=this.blockTokens(me.items[Ae].text,[],!1);Q.push(me);continue}if(me=this.tokenizer.html($)){$=$.substring(me.raw.length),Q.push(me);continue}if(re&&(me=this.tokenizer.def($))){$=$.substring(me.raw.length),this.tokens.links[me.tag]||(this.tokens.links[me.tag]={href:me.href,title:me.title});continue}if(me=this.tokenizer.table($)){$=$.substring(me.raw.length),Q.push(me);continue}if(me=this.tokenizer.lheading($)){$=$.substring(me.raw.length),Q.push(me);continue}if(re&&(me=this.tokenizer.paragraph($))){$=$.substring(me.raw.length),Q.push(me);continue}if(me=this.tokenizer.text($,Q)){$=$.substring(me.raw.length),me.type?Q.push(me):(ze=Q[Q.length-1],ze.raw+=`
`+me.raw,ze.text+=`
`+me.text);continue}if($){var lt="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(lt);break}else throw new Error(lt)}}return Q},le.inline=function($){var Q,re,me,Ae,ke,ze,lt=$.length;for(Q=0;Q<lt;Q++){ze=$[Q];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:[]},Ae=ze.header.length,re=0;re<Ae;re++)ze.tokens.header[re]=[],this.inlineTokens(ze.header[re],ze.tokens.header[re]);for(Ae=ze.cells.length,re=0;re<Ae;re++)for(ke=ze.cells[re],ze.tokens.cells[re]=[],me=0;me<ke.length;me++)ze.tokens.cells[re][me]=[],this.inlineTokens(ke[me],ze.tokens.cells[re][me]);break}case"blockquote":{this.inline(ze.tokens);break}case"list":{for(Ae=ze.items.length,re=0;re<Ae;re++)this.inline(ze.items[re].tokens);break}}}return $},le.inlineTokens=function($,Q,re,me,Ae){Q===void 0&&(Q=[]),re===void 0&&(re=!1),me===void 0&&(me=!1),Ae===void 0&&(Ae="");var ke,ze=$,lt;if(this.tokens.links){var pt=Object.keys(this.tokens.links);if(pt.length>0)for(;(lt=this.tokenizer.rules.inline.reflinkSearch.exec(ze))!=null;)pt.includes(lt[0].slice(lt[0].lastIndexOf("[")+1,-1))&&(ze=ze.slice(0,lt.index)+"["+"a".repeat(lt[0].length-2)+"]"+ze.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(lt=this.tokenizer.rules.inline.blockSkip.exec(ze))!=null;)ze=ze.slice(0,lt.index)+"["+"a".repeat(lt[0].length-2)+"]"+ze.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;$;){if(ke=this.tokenizer.escape($)){$=$.substring(ke.raw.length),Q.push(ke);continue}if(ke=this.tokenizer.tag($,re,me)){$=$.substring(ke.raw.length),re=ke.inLink,me=ke.inRawBlock,Q.push(ke);continue}if(ke=this.tokenizer.link($)){$=$.substring(ke.raw.length),ke.type==="link"&&(ke.tokens=this.inlineTokens(ke.text,[],!0,me)),Q.push(ke);continue}if(ke=this.tokenizer.reflink($,this.tokens.links)){$=$.substring(ke.raw.length),ke.type==="link"&&(ke.tokens=this.inlineTokens(ke.text,[],!0,me)),Q.push(ke);continue}if(ke=this.tokenizer.strong($,ze,Ae)){$=$.substring(ke.raw.length),ke.tokens=this.inlineTokens(ke.text,[],re,me),Q.push(ke);continue}if(ke=this.tokenizer.em($,ze,Ae)){$=$.substring(ke.raw.length),ke.tokens=this.inlineTokens(ke.text,[],re,me),Q.push(ke);continue}if(ke=this.tokenizer.codespan($)){$=$.substring(ke.raw.length),Q.push(ke);continue}if(ke=this.tokenizer.br($)){$=$.substring(ke.raw.length),Q.push(ke);continue}if(ke=this.tokenizer.del($)){$=$.substring(ke.raw.length),ke.tokens=this.inlineTokens(ke.text,[],re,me),Q.push(ke);continue}if(ke=this.tokenizer.autolink($,Te)){$=$.substring(ke.raw.length),Q.push(ke);continue}if(!re&&(ke=this.tokenizer.url($,Te))){$=$.substring(ke.raw.length),Q.push(ke);continue}if(ke=this.tokenizer.inlineText($,me,Re)){$=$.substring(ke.raw.length),Ae=ke.raw.slice(-1),Q.push(ke);continue}if($){var ct="Infinite loop on byte: "+$.charCodeAt(0);if(this.options.silent){console.error(ct);break}else throw new Error(ct)}}return Q},F(ne,null,[{key:"rules",get:function(){return{block:Le,inline:xe}}}]),ne}(),Ie=N.defaults,Me=j.cleanUrl,Ne=j.escape,Be=function(){function ne(fe){this.options=fe||Ie}var le=ne.prototype;return le.code=function($,Q,re){var me=(Q||"").match(/\S*/)[0];if(this.options.highlight){var Ae=this.options.highlight($,me);Ae!=null&&Ae!==$&&(re=!0,$=Ae)}return me?'<pre><code class="'+this.options.langPrefix+Ne(me,!0)+'">'+(re?$:Ne($,!0))+`</code></pre>
`:"<pre><code>"+(re?$:Ne($,!0))+`</code></pre>
`},le.blockquote=function($){return`<blockquote>
`+$+`</blockquote>
`},le.html=function($){return $},le.heading=function($,Q,re,me){return this.options.headerIds?"<h"+Q+' id="'+this.options.headerPrefix+me.slug(re)+'">'+$+"</h"+Q+`>
`:"<h"+Q+">"+$+"</h"+Q+`>
`},le.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},le.list=function($,Q,re){var me=Q?"ol":"ul",Ae=Q&&re!==1?' start="'+re+'"':"";return"<"+me+Ae+`>
`+$+"</"+me+`>
`},le.listitem=function($){return"<li>"+$+`</li>
`},le.checkbox=function($){return"<input "+($?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},le.paragraph=function($){return"<p>"+$+`</p>
`},le.table=function($,Q){return Q&&(Q="<tbody>"+Q+"</tbody>"),`<table>
<thead>
`+$+`</thead>
`+Q+`</table>
`},le.tablerow=function($){return`<tr>
`+$+`</tr>
`},le.tablecell=function($,Q){var re=Q.header?"th":"td",me=Q.align?"<"+re+' align="'+Q.align+'">':"<"+re+">";return me+$+"</"+re+`>
`},le.strong=function($){return"<strong>"+$+"</strong>"},le.em=function($){return"<em>"+$+"</em>"},le.codespan=function($){return"<code>"+$+"</code>"},le.br=function(){return this.options.xhtml?"<br/>":"<br>"},le.del=function($){return"<del>"+$+"</del>"},le.link=function($,Q,re){if($=Me(this.options.sanitize,this.options.baseUrl,$),$===null)return re;var me='<a href="'+Ne($)+'"';return Q&&(me+=' title="'+Q+'"'),me+=">"+re+"</a>",me},le.image=function($,Q,re){if($=Me(this.options.sanitize,this.options.baseUrl,$),$===null)return re;var me='<img src="'+$+'" alt="'+re+'"';return Q&&(me+=' title="'+Q+'"'),me+=this.options.xhtml?"/>":">",me},le.text=function($){return $},ne}(),Pe=function(){function ne(){}var le=ne.prototype;return le.strong=function($){return $},le.em=function($){return $},le.codespan=function($){return $},le.del=function($){return $},le.html=function($){return $},le.text=function($){return $},le.link=function($,Q,re){return""+re},le.image=function($,Q,re){return""+re},le.br=function(){return""},ne}(),Ye=function(){function ne(){this.seen={}}var le=ne.prototype;return le.slug=function($){var Q=$.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Q)){var re=Q;do this.seen[re]++,Q=re+"-"+this.seen[re];while(this.seen.hasOwnProperty(Q))}return this.seen[Q]=0,Q},ne}(),Ke=N.defaults,Se=j.unescape,je=function(){function ne(fe){this.options=fe||Ke,this.options.renderer=this.options.renderer||new Be,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Pe,this.slugger=new Ye}ne.parse=function($,Q){var re=new ne(Q);return re.parse($)};var le=ne.prototype;return le.parse=function($,Q){Q===void 0&&(Q=!0);var re="",me,Ae,ke,ze,lt,pt,ct,bt,St,rt,Xt,Pt,Zt,Ht,Et,Jt,li,Qe,vt=$.length;for(me=0;me<vt;me++){rt=$[me];switch(rt.type){case"space":continue;case"hr":{re+=this.renderer.hr();continue}case"heading":{re+=this.renderer.heading(this.parseInline(rt.tokens),rt.depth,Se(this.parseInline(rt.tokens,this.textRenderer)),this.slugger);continue}case"code":{re+=this.renderer.code(rt.text,rt.lang,rt.escaped);continue}case"table":{for(bt="",ct="",ze=rt.header.length,Ae=0;Ae<ze;Ae++)ct+=this.renderer.tablecell(this.parseInline(rt.tokens.header[Ae]),{header:!0,align:rt.align[Ae]});for(bt+=this.renderer.tablerow(ct),St="",ze=rt.cells.length,Ae=0;Ae<ze;Ae++){for(pt=rt.tokens.cells[Ae],ct="",lt=pt.length,ke=0;ke<lt;ke++)ct+=this.renderer.tablecell(this.parseInline(pt[ke]),{header:!1,align:rt.align[ke]});St+=this.renderer.tablerow(ct)}re+=this.renderer.table(bt,St);continue}case"blockquote":{St=this.parse(rt.tokens),re+=this.renderer.blockquote(St);continue}case"list":{for(Xt=rt.ordered,Pt=rt.start,Zt=rt.loose,ze=rt.items.length,St="",Ae=0;Ae<ze;Ae++)Et=rt.items[Ae],Jt=Et.checked,li=Et.task,Ht="",Et.task&&(Qe=this.renderer.checkbox(Jt),Zt?Et.tokens.length>0&&Et.tokens[0].type==="text"?(Et.tokens[0].text=Qe+" "+Et.tokens[0].text,Et.tokens[0].tokens&&Et.tokens[0].tokens.length>0&&Et.tokens[0].tokens[0].type==="text"&&(Et.tokens[0].tokens[0].text=Qe+" "+Et.tokens[0].tokens[0].text)):Et.tokens.unshift({type:"text",text:Qe}):Ht+=Qe),Ht+=this.parse(Et.tokens,Zt),St+=this.renderer.listitem(Ht,li,Jt);re+=this.renderer.list(St,Xt,Pt);continue}case"html":{re+=this.renderer.html(rt.text);continue}case"paragraph":{re+=this.renderer.paragraph(this.parseInline(rt.tokens));continue}case"text":{for(St=rt.tokens?this.parseInline(rt.tokens):rt.text;me+1<vt&&$[me+1].type==="text";)rt=$[++me],St+=`
`+(rt.tokens?this.parseInline(rt.tokens):rt.text);re+=Q?this.renderer.paragraph(St):St;continue}default:{var _t='Token with "'+rt.type+'" type was not found.';if(this.options.silent){console.error(_t);return}else throw new Error(_t)}}}return re},le.parseInline=function($,Q){Q=Q||this.renderer;var re="",me,Ae,ke=$.length;for(me=0;me<ke;me++){Ae=$[me];switch(Ae.type){case"escape":{re+=Q.text(Ae.text);break}case"html":{re+=Q.html(Ae.text);break}case"link":{re+=Q.link(Ae.href,Ae.title,this.parseInline(Ae.tokens,Q));break}case"image":{re+=Q.image(Ae.href,Ae.title,Ae.text);break}case"strong":{re+=Q.strong(this.parseInline(Ae.tokens,Q));break}case"em":{re+=Q.em(this.parseInline(Ae.tokens,Q));break}case"codespan":{re+=Q.codespan(Ae.text);break}case"br":{re+=Q.br();break}case"del":{re+=Q.del(this.parseInline(Ae.tokens,Q));break}case"text":{re+=Q.text(Ae.text);break}default:{var ze='Token with "'+Ae.type+'" type was not found.';if(this.options.silent){console.error(ze);return}else throw new Error(ze)}}}return re},ne}(),et=j.merge,Je=j.checkSanitizeDeprecation,Ze=j.escape,We=N.getDefaults,nt=N.changeDefaults,qe=N.defaults;function De(ne,le,fe){if(typeof ne=="undefined"||ne===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ne!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ne)+", string expected");if(typeof le=="function"&&(fe=le,le=null),le=et({},De.defaults,le||{}),Je(le),fe){var $=le.highlight,Q;try{Q=Oe.lex(ne,le)}catch(ke){return fe(ke)}var re=function(ze){var lt;if(!ze)try{lt=je.parse(Q,le)}catch(pt){ze=pt}return le.highlight=$,ze?fe(ze):fe(null,lt)};if(!$||$.length<3)return re();if(delete le.highlight,!Q.length)return re();var me=0;De.walkTokens(Q,function(ke){ke.type==="code"&&(me++,setTimeout(function(){$(ke.text,ke.lang,function(ze,lt){if(ze)return re(ze);lt!=null&&lt!==ke.text&&(ke.text=lt,ke.escaped=!0),me--,me===0&&re()})},0))}),me===0&&re();return}try{var Ae=Oe.lex(ne,le);return le.walkTokens&&De.walkTokens(Ae,le.walkTokens),je.parse(Ae,le)}catch(ke){if(ke.message+=`
Please report this to https://github.com/markedjs/marked.`,le.silent)return"<p>An error occurred:</p><pre>"+Ze(ke.message+"",!0)+"</pre>";throw ke}}De.options=De.setOptions=function(ne){return et(De.defaults,ne),nt(De.defaults),De},De.getDefaults=We,De.defaults=qe,De.use=function(ne){var le=et({},ne);if(ne.renderer&&function(){var $=De.defaults.renderer||new Be,Q=function(Ae){var ke=$[Ae];$[Ae]=function(){for(var ze=arguments.length,lt=new Array(ze),pt=0;pt<ze;pt++)lt[pt]=arguments[pt];var ct=ne.renderer[Ae].apply($,lt);return ct===!1&&(ct=ke.apply($,lt)),ct}};for(var re in ne.renderer)Q(re);le.renderer=$}(),ne.tokenizer&&function(){var $=De.defaults.tokenizer||new de,Q=function(Ae){var ke=$[Ae];$[Ae]=function(){for(var ze=arguments.length,lt=new Array(ze),pt=0;pt<ze;pt++)lt[pt]=arguments[pt];var ct=ne.tokenizer[Ae].apply($,lt);return ct===!1&&(ct=ke.apply($,lt)),ct}};for(var re in ne.tokenizer)Q(re);le.tokenizer=$}(),ne.walkTokens){var fe=De.defaults.walkTokens;le.walkTokens=function($){ne.walkTokens($),fe&&fe($)}}De.setOptions(le)},De.walkTokens=function(ne,le){for(var fe=S(ne),$;!($=fe()).done;){var Q=$.value;le(Q);switch(Q.type){case"table":{for(var re=S(Q.tokens.header),me;!(me=re()).done;){var Ae=me.value;De.walkTokens(Ae,le)}for(var ke=S(Q.tokens.cells),ze;!(ze=ke()).done;)for(var lt=ze.value,pt=S(lt),ct;!(ct=pt()).done;){var bt=ct.value;De.walkTokens(bt,le)}break}case"list":{De.walkTokens(Q.items,le);break}default:Q.tokens&&De.walkTokens(Q.tokens,le)}}},De.Parser=je,De.parser=je.parse,De.Renderer=Be,De.TextRenderer=Pe,De.Lexer=Oe,De.lexer=Oe.lex,De.Tokenizer=de,De.Slugger=Ye,De.parse=De;var Ge=De;return Ge})},EJTS:function(at,$e,z){"use strict";z.d($e,"a",function(){return m});var _e=z("qVdP"),F=z("jsC+"),w=z("lUTK"),U=z("BvKs"),S=z("sRBo"),I=z("kaz8"),N=z("oBTY"),k=z("7Kak"),A=z("9yH6"),C=z("tJVT"),y=z("q1tI"),h=z.n(y),u=z("9Bee"),o=z("+vTd"),e=z.n(o),d=z("xKgJ"),s=z("Is5a"),t=z.n(s),i=["A\uFF0E","B\uFF0E","C\uFF0E","D\uFF0E","E\uFF0E","F\uFF0E","G\uFF0E","H\uFF0E","I\uFF0E","J\uFF0E","K\uFF0E","L\uFF0E","M\uFF0E","N\uFF0E","O\uFF0E","P\uFF0E","Q\uFF0E","R\uFF0E","S\uFF0E","T\uFF0E","U\uFF0E","V\uFF0E","W\uFF0E","X\uFF0E","Y\uFF0E","Z\uFF0E"],n=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],T=function(b){var _,a=b.data,c=b.selectIds,r=b.onSelectCheckBox,l=r===void 0?function(){}:r,v=b.showCheckbox,f=v===void 0?!0:v,x=Object(y.useState)(!1),R=Object(C.a)(x,2),O=R[0],B=R[1],j=function(){if(a.item_type==="JUDGMENT")return h.a.createElement("div",{className:e.a.judgmentContent},a.choices.map(function(ce,de){return h.a.createElement(A.a,{key:de,disabled:!0},ce.choice_text)}));if(a.item_type==="PROGRAM"){var ae;return h.a.createElement("div",{className:e.a.programContent},h.a.createElement(u.a,{value:(ae=a.program_attr)===null||ae===void 0?void 0:ae.description}))}if(a.item_type==="COMBINATION"){var Z;return h.a.createElement("div",{className:e.a.combinationContent},a==null||((Z=a.sub_item_banks)===null||Z===void 0)?void 0:Z.map(function(ce,de){var q,te="(\u9898\u76EE".concat(de+1,"-\u5355\u9009\u9898) ");return h.a.createElement(y.Fragment,null,h.a.createElement("div",{style:{marginTop:10,marginBottom:10}},h.a.createElement(u.a,{value:te+ce.name})),ce.choices.map(function(he,J){return h.a.createElement("div",{key:J,className:e.a.otherContentItem},h.a.createElement("p",null,i[J]),h.a.createElement(u.a,{className:e.a.otehrContentHtml,value:he.choice_text}))}),h.a.createElement("div",{className:e.a.con},h.a.createElement("b",{className:"c-grey-333 font14"}," ","\u7B54\u6848\uFF1A",n==null?void 0:n[ce==null||((q=ce.choices)===null||q===void 0)?void 0:q.findIndex(function(he){return he==null?void 0:he.is_answer})]," "),h.a.createElement("div",null,h.a.createElement("span",null,"\u89E3\u6790\uFF1A"),h.a.createElement(u.a,{className:e.a.parseAnswerHtml,value:ce.analysis||"\u6682\u65E0\u89E3\u6790"}))))}))}return h.a.createElement("div",{className:e.a.otherContent},a.choices.map(function(ce,de){return h.a.createElement("div",{key:de,className:e.a.otherContentItem},h.a.createElement("p",null,i[de]),h.a.createElement(u.a,{className:e.a.otehrContentHtml,value:ce.choice_text}))}))},K=function(){var ae;return h.a.createElement("div",null,(ae=a.standard_answer)===null||ae===void 0?void 0:ae.map(function(Z,ce){return h.a.createElement(u.a,{key:ce,className:e.a.answerHtml,value:"\u7B54\u6848\uFF08\u586B\u7A7A".concat(Z.position,"\uFF09\uFF1A").concat(Z.answer_text.join("\u3001"))})}))},L=function(){var ae,Z,ce,de={SUBJECTIVE:(ae=a.answer_texts)===null||ae===void 0?void 0:ae[0],JUDGMENT:(Z=a.choices)===null||Z===void 0||((ce=Z.find(function(we){return we.is_answer}))===null||ce===void 0)?void 0:ce.choice_text},q=a.choices.map(function(we){return we.is_answer}).findIndex(function(we){return we}),te=q>-1?n[q]:"",he="";a.choices.map(function(we,Le){we.is_answer&&(he+=n[Le])});var J=de[a.item_type],X={SINGLE:h.a.createElement(u.a,{className:e.a.answerHtml,value:"\u7B54\u6848\uFF1A".concat(te||"\u65E0")}),MULTIPLE:h.a.createElement(u.a,{className:e.a.answerHtml,value:"\u7B54\u6848\uFF1A".concat(he||"\u65E0")}),COMPLETION:K()},ye=h.a.createElement(u.a,{className:e.a.answerHtml,value:"\u7B54\u6848\uFF1A".concat(J||"\u65E0")});return X[a.item_type]||ye},H=function(ae){var Z=Object(N.a)(c);ae.target.checked?Z.push(a.id):Z=Z.filter(function(ce){return ce!==a.id}),l(Z)};return h.a.createElement("div",{className:e.a.itemWrap},h.a.createElement("div",{className:e.a.list},f&&h.a.createElement(I.a,{className:"mr10",onChange:H,checked:c.includes(a.id)}),h.a.createElement("div",{className:e.a.title},h.a.createElement(u.a,{key:1,showLines:1,showTextOnly:!0,className:e.a.topicTitleContent,value:a.name})),h.a.createElement("div",{className:e.a.line},h.a.createElement("b",{className:e.a.b1}),h.a.createElement("b",{className:e.a.b2})),h.a.createElement("div",{onClick:function(){return B(!O)},className:e.a.tr},O?"\u6536\u8D77":"\u5C55\u5F00",h.a.createElement("i",{style:{transform:O?"scale(0.5) rotate(-180deg)":"scale(0.5) rotate(0deg)"},className:"iconfont icon-zhankai4"}))),h.a.createElement("aside",{style:O?{display:"block"}:{display:"none"},className:e.a.itemDetail},h.a.createElement("div",{style:{marginBottom:44}},h.a.createElement(u.a,{key:2,className:e.a.topicTitleContent,value:a.name}),h.a.createElement("div",{className:"".concat(e.a.row," mt15")},j()),h.a.createElement("div",{className:e.a.row},h.a.createElement("div",{className:e.a.updateTimeRow},h.a.createElement("div",{className:e.a.updateTimeWrap},a.item_type==="PROGRAM"&&h.a.createElement("p",{className:e.a.programLanguage},"\u7F16\u7A0B\u8BED\u8A00\uFF1A",(_=a.program_attr)===null||_===void 0?void 0:_.language))))),a.item_type!=="PROGRAM"&&a.item_type!=="COMBINATION"&&h.a.createElement("div",{className:e.a.answerWrapper},h.a.createElement("img",{src:t.a,alt:"",className:e.a.decoration}),h.a.createElement("div",{className:e.a.answer},L()),h.a.createElement("div",{className:e.a.parse},h.a.createElement("div",{className:e.a.parseText},"\u89E3\u6790\uFF1A"),h.a.createElement("div",{className:e.a.parseAnswer},a.analysis?h.a.createElement(u.a,{className:e.a.parseAnswerHtml,value:a.analysis}):"\u6682\u65E0\u89E3\u6790")))))},m=function(b){var _,a,c,r,l,v,f,x,R,O,B,j,K,L,H,Y,ae=b.isProblemset,Z=b.data,ce=b.user,de=b.activeTabsKey,q=b.onPublicReview,te=q===void 0?function(){}:q,he=b.onStartExperience,J=he===void 0?function(){}:he,X=b.onSetPrivate,ye=X===void 0?function(){}:X,we=b.onCorrection,Le=we===void 0?function(){}:we,xe=b.onCollect,Re=xe===void 0?function(){}:xe,Te=b.onSetPublic,Oe=Te===void 0?function(){}:Te,Ie=b.onDelete,Me=Ie===void 0?function(){}:Ie,Ne=b.onCancel,Be=Ne===void 0?function(){}:Ne,Pe=b.onSelect,Ye=Pe===void 0?function(){}:Pe,Ke=b.onMoveTo,Se=Ke===void 0?function(){}:Ke,je=b.onSetShare,et=je===void 0?function(){}:je,Je=b.onCancelShare,Ze=Je===void 0?function(){}:Je,We=b.onPublish,nt=We===void 0?function(){}:We,qe=b.onCancelPublish,De=qe===void 0?function(){}:qe,Ge=Z.item_type==="PROGRAM"?"/problems/".concat((_=Z.program_attr)===null||_===void 0?void 0:_.identifier,"/edit"):"/problemset/edit/".concat(Z.id),ne=de==="0"&&!Z.public&&!Z.apply&&(Z.item_type==="PROGRAM"&&((a=Z.program_attr)===null||a===void 0?void 0:a.status)!==0||Z.item_type!=="PROGRAM"),le=h.a.createElement(U.a,{forceSubMenuRender:!0,className:e.a.menu},de==="0"&&!Z.public&&h.a.createElement(U.a.Item,{key:"-1"},h.a.createElement("a",{className:e.a.actionLink,target:"_blank",href:Ge},"\u7F16\u8F91")),(de==="0"||de==="3")&&Z.item_type==="PROGRAM"&&((c=Z.program_attr)===null||c===void 0?void 0:c.status)!==0&&!Z.public&&((r=Z.author)===null||r===void 0?void 0:r.login)===((l=ce.userInfo)===null||l===void 0?void 0:l.login)&&h.a.createElement(U.a.Item,{key:"0"},h.a.createElement("a",{className:e.a.actionLink,onClick:function(){var re;return De(Z==null||((re=Z.program_attr)===null||re===void 0)?void 0:re.identifier)}},"\u64A4\u9500\u53D1\u5E03")),de==="0"&&h.a.createElement(U.a.Item,{key:"1"},h.a.createElement("a",{className:e.a.actionLink,onClick:function(){return Se(Z.id)}},"\u79FB\u52A8\u5230")),de==="0"&&!(Z!=null&&Z.is_share)&&h.a.createElement(U.a.Item,{key:"3"},h.a.createElement("a",{className:e.a.actionLink,onClick:function(){return et(Z.id)}},"\u5171\u4EAB")),(de==="0"&&(Z==null?void 0:Z.is_share)||de==="3"&&((v=Z.author)===null||v===void 0?void 0:v.login)===((f=ce.userInfo)===null||f===void 0?void 0:f.login))&&h.a.createElement(U.a.Item,{key:"3"},h.a.createElement("a",{className:e.a.actionLink,onClick:function(){return Ze(Z.id)}},"\u64A4\u9500\u5171\u4EAB")),ne&&h.a.createElement(U.a.Item,{key:"4"},h.a.createElement("a",{className:e.a.actionLink,onClick:function(){return Oe(Z.id)}},"\u516C\u5F00")),de==="0"&&!Z.public&&Z.apply&&(Z.item_type==="PROGRAM"&&Z.program_attr.status!==0||Z.item_type!=="PROGRAM")&&h.a.createElement(U.a.Item,{key:"5"},h.a.createElement("a",{className:e.a.reviewFlag,onClick:te},"\u5BA1\u6838\u4E2D")),(de==="0"||de==="1")&&Z.public&&((x=Z.author)===null||x===void 0?void 0:x.login)===((R=ce.userInfo)===null||R===void 0?void 0:R.login)&&h.a.createElement(U.a.Item,{key:"6"},h.a.createElement("a",{className:e.a.actionLink,onClick:function(){return ye(Z.id)}},"\u64A4\u9500\u516C\u5F00")),de==="2"&&h.a.createElement(U.a.Item,{key:"7"},h.a.createElement("a",{className:e.a.actionLink,onClick:function(){return Re(Z.id,Z.is_collected)}},"\u53D6\u6D88\u6536\u85CF")),(de==="0"||de==="3")&&Z.item_type==="PROGRAM"&&((O=Z.program_attr)===null||O===void 0?void 0:O.status)===0&&!Z.public&&((B=Z.author)===null||B===void 0?void 0:B.login)===((j=ce.userInfo)===null||j===void 0?void 0:j.login)&&h.a.createElement(U.a.Item,{key:"8"},h.a.createElement("a",{className:e.a.actionLink,onClick:function(){var re;return nt(Z==null||((re=Z.program_attr)===null||re===void 0)?void 0:re.identifier)}},"\u53D1\u5E03")),(de==="1"||de==="3")&&!Object(d.o)()&&!Object(d.m)()&&((K=Z.author)===null||K===void 0?void 0:K.login)!==((L=ce.userInfo)===null||L===void 0?void 0:L.login)&&h.a.createElement(U.a.Item,{key:"9"},h.a.createElement("a",{className:e.a.actionLink,onClick:function(){return Re(Z.id,Z.is_collected)}},Z.is_collected?"\u53D6\u6D88\u6536\u85CF":"\u6536\u85CF")),de!=="0"&&!Object(d.o)()&&!Object(d.m)()&&h.a.createElement(U.a.Item,{key:"10"},h.a.createElement("a",{className:e.a.actionLink,onClick:function(){return Le(Z.id)}},"\u7EA0\u9519")),(de==="0"&&!Z.public||de==="1"&&Object(d.o)()&&((H=Z.author)===null||H===void 0?void 0:H.login)!==((Y=ce.userInfo)===null||Y===void 0?void 0:Y.login))&&h.a.createElement(U.a.Item,{key:"11"},h.a.createElement("a",{className:e.a.actionLink,onClick:function(){return Me(Z.id)}},"\u5220\u9664"))),fe=h.a.createElement(U.a,{forceSubMenuRender:!0,className:e.a.menu},h.a.createElement(U.a.Item,{key:"10"},h.a.createElement("a",{className:e.a.actionLink,onClick:function(){return Le(Z.id)}},"\u7EA0\u9519"))),$=de!=="0"&&!Object(d.o)()&&!Object(d.m)();return h.a.createElement(h.a.Fragment,null,ae?h.a.createElement(h.a.Fragment,null,Z.item_type!=="SUBJECTIVE"&&Z.item_type!=="COMBINATION"&&h.a.createElement("span",{className:e.a.textBtn,style:{cursor:"pointer"},onClick:function(){return J(Z)}},"\u4F53\u9A8C"),h.a.createElement(F.a,{overlay:le},h.a.createElement("span",{style:{cursor:"default"},onClick:function(re){return re.preventDefault()}},h.a.createElement("span",{className:e.a.textBtn},"\u66F4\u591A")))):$?h.a.createElement(F.a,{className:"ml40",overlay:fe},h.a.createElement("span",{style:{cursor:"default"},onClick:function(re){return re.preventDefault()}},h.a.createElement("span",null,"\u66F4\u591A"))):h.a.createElement("span",null))};$e.b=T},FKdj:function(at,$e,z){at.exports={flex_box_center:"flex_box_center___3uXpC",flex_space_between:"flex_space_between___1R5l3",flex_box_vertical_center:"flex_box_vertical_center___2whw-",flex_box_center_end:"flex_box_center_end___Jni7d",flex_box_column:"flex_box_column___bQWh0",page:"page___2wqIC",wrap:"wrap___3ThhU",title:"title___3BwkD",select:"select___2Ozsr",contentWrap:"contentWrap___3srp0",pngIcon:"pngIcon___2ckkq",tabsWrap:"tabsWrap___2Y959",searchWrap:"searchWrap___H9GsL",addQuestionBtn:"addQuestionBtn___1b8s_",search:"search___3d1EJ",searchIcon:"searchIcon___1mrzV",batchWrap:"batchWrap___j1Er3",contentListWrap:"contentListWrap___3pty2",li:"li___2UOPB",bottom:"bottom___I7MVG",actionLeftItem:"actionLeftItem___3bGeH",questionTypeName:"questionTypeName___Aiyux",more:"more___YExtS",btnAdd:"btnAdd___2RrWf",treeWrapper:"treeWrapper___U0OPC",treeHeader:"treeHeader___1LB2p",treeContent:"treeContent___Ckfqx",action:"action___Xn5RP",headerWrapper:"headerWrapper___3ECJD",exportBtn:"exportBtn___35cZE"}},FOrL:function(at,$e,z){at.exports=z.p+"static/nodata.a6b3f948.png"},Is5a:function(at,$e){at.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAACMgAAAA6CAYAAABPwffJAAAAAXNSR0IArs4c6QAAH35JREFUeF7t3Q2MZWV9x/H/c849d17uzL6y7K4M76xLNIAKoiBQak0oRgsiYKyxUEq0LwZLYmqa0hqtpi8xodam1daKRFtbRITYBmlspRBBAXmRaHddsCyO7Bsssztzd2buveec5jl37jC7bN155l7OL7P3ewmZfTnn+Z37+f9nsjn3n+c4W8JrfHx8bGam9ZfNZutif3q1Wrl3YKDyB2NjY+NLWC74FHV+8AVzQlcC6nqr87vC4+RgAXW91fnBYJyAAAIIIIAAAggggAACCCCAAAIIIIAAAggggAACpr6/r86nBcoVUNdbnV+uNmnqevcy34WW84knto0513giz22NWef03P9qb27Vs846a9MrOiSjzg/14vjuBNT1Vud3p8fZoQLqeqvzQ704HgEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBMzU9/fV+fRAuQLqeqvzy9UmTV3vXucHD8g88shj/2zm3ttoNOa7wZmzJEnMnPvqOeec9euvZJuo81/J98baLxdQ11udT0+UK6Cutzq/XG3SEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBBA4OgTU9/fV+UdHFZfPu1DXW52/fCp1dFyput69zg8ekLnvvu8+l+e28XDldM52XHTRW171SpZanf9KvjfWfrmAut7qfHqiXAF1vdX55WqThgACCCCAAAIIIIAAAggggAACCCCAAAIIIIDA0SGgvr+vzj86qrh83oW63ur85VOpo+NK1fXudX7wgMy3v31vnue5NZtNc84sz9sPWkqq1aLCb3vbxcFrhrSGOj/kWjm2ewF1vdX53QuyQoiAut7q/BArjkUAAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAIG2gPr+vjqfPihXQF1vdX652qSp693r/OBhlrvu+ve8PRiTmx+N6QzJtFsjt8sue0fwmiFtpc4PuVaO7V5AXW91fveCrBAioK63Oj/EimMRQAABBBBAAAEEEEAAAQQQQAABBBBAAAEEEECgLaC+v6/Opw/KFVDXW51frjZp6nr3Oj94mOX22+/0kzHWbDaK3WP8yw/JJElSDMxceeXlwWuGtJU6P+RaObZ7AXW91fndC7JCiIC63ur8ECuORQABBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAgbaA+v6+Op8+KFdAXW91frnapKnr3ev84GGWW2/9Smcsptgx5qVdZNq/vuaa9wWvGdJW6vyQa+XY7gXU9Vbndy/ICiEC6nqr80OsOBYBBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAAQTaAur7++p8+qBcAXW91fnlapOmrnev84OHWb7whVvyZrN5UCf4xy055yxJqnb99dcGrxnSVur8kGvl2O4F1PVW53cvyAohAup6q/NDrDgWAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAAEE2gLq+/vqfPqgXAF1vdX55WqTpq53r/ODh1k+85m/yZ05y4vdY/zjldpLFEMy5uyGD/9e8JohbaXOD7lWju1eQF1vdX73gqwQIqCutzo/xIpjEUAAAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAoC2gvr+vzqcPyhVQ11udX642aep69zo/eJjl05+++ZAdZNqPVvKvJEnsIx+5MXjNkLZS54dcK8d2L6Cutzq/e0FWCBFQ11udH2LFsQgggAACCCCAAAIIIIAAAggggAACCCCAAAIIINAWUN/fV+fTB+UKqOutzi9XmzR1vXudHzzM8olPfCrvPFKp/dXvHtNuDL/Yn3zspuA1Q9pKnR9yrRzbvYC63ur87gVZIURAXW91fogVxyKAAAIIIIAAAggggAACCCCAAAIIIIAAAggggEBbQH1/X51PH5QroK63Or9cbdLU9e51fvAwy003fSxvNhsLOuGlJfwOMp/85MeD1wxpK3V+yLVybPcC6nqr87sXZIUQAXW91fkhVhyLAAIIIIAAAggggAACCCCAAAIIIIAAAggggAACbQH1/X11Pn1QroC63ur8crVJU9e71/nBwyw33viR3O8a03nN7x4zt5PMzTd/OnjNkLZS54dcK8d2L6Cutzq/e0FWCBFQ11udH2LFsQgggAACCCCAAAIIIIAAAggggAACCCCAAAIIINAWUN/fV+fTB+UKqOutzi9XmzR1vXudHzzM8qEP3ZC3mi3Lbe65SvM94axaTeyzn/1M8JohbaXOD7lWju1eQF1vdX73gqwQIqCutzo/xIpjEUAAAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAoC2gvr+vzqcPyhVQ11udX642aep69zo/eJjluuuuf2kyxv/KrzD3Nc9zu+WWfwxeM6St1Pkh18qx3Quo663O716QFUIE1PVW54dYcSwCCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAgi0BdT399X59EG5Aup6q/PL1SZNXe9e5wcPs7z//dfkzUbjoP1j/COX/KOWqtWqffnLtwavGdJW6vyQa+XY7gXU9Vbndy/ICiEC6nqr80OsOBYBBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAAQTaAur7++p8+qBcAXW91fnlapOmrnev84OHWa644sp8fsuY+X7obCrj7I47bg9eM6St1Pkh18qx3Quo663O716QFUIE1PVW54dYcSwCCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAgi0BdT399X59EG5Aup6q/PL1SZNXe9e5wcPs7zjHb+Wt1rNYseY9is359z8DjLf/OZdwWuGtJU6P+RaObZ7AXW91fndC7JCiIC63ur8ECuORQABBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAgbaA+v6+Op8+KFdAXW91frnapKnr3ev84GGWSy65NG82m0UnNJuN4muSJMVX/4ilb33r7uA1Q9pKnR9yrRzbvYC63ur87gVZIURAXW91fogVxyKAAAIIIIAAAggggAACCCCAAAIIIIAAAggggEBbQH1/X51PH5QroK63Or9cbdLU9e51fvAwy4UXXpT73WP8kIxzZv43fgeZJKkWu8ncf/99wWuGtJU6P+RaObZ7AXW91fndC7JCiIC63ur8ECuORQABBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAgbaA+v6+Op8+KFdAXW91frnapKnr3ev84GGWN73pzXmr1SoGYzo7yfgdZPyQTKVSse9//3vBa4a0lTo/5Fo5tnsBdb3V+d0LskKIgLre6vwQK45FAAEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQACBtoD6/r46nz4oV0Bdb3V+udqkqevd6/zgYZazzz4nbzQaxXBMsXuM74liB5mk2EXm0UcfCV4zpK3U+SHXyrHdC6jrrc7vXpAVQgTU9Vbnh1hxLAIIIIAAAggggAACCCCAAAIIIIAAAggggAACCLQF1Pf31fn0QbkC6nqr88vVJk1d717nBw+zbN58et7ZOabZbPjpGKtWE/OPXapWq7Zly/8ErxnSVur8kGvl2O4F1PVW53cvyAohAup6q/NDrDgWAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAAEE2gLq+/vqfPqgXAF1vdX55WqTpq53r/ODh1lOOeXUYkCmMyRjls8Px/gBmaeffip4zZC2UueHXCvHdi+grrc6v3tBVggRUNdbnR9ixbEIIIAAAggggAACCCCAAAIIIIAAAggggAACCCDQFlDf31fn0wflCqjrrc4vV5s0db17nR88zOIv4MCBujUafkimYa7zeKVKYsO1mv30p08HrxnSVur8kGvl2O4F1PVW53cvyAohAup6q/NDrDgWAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAAEE2gLq+/vqfPqgXAF1vdX55WqTpq53r/MXNcyS57m75557Vq9atfbCq656951+95h6fWp+F5kkqVqtVrMkSexrX/v65RMTL9x/ySWXvOicy3vRMur8XrwH1li8gLre6vzFS3FkLwTU9Vbn98KQNRBAAAEEEEAAAQQQQAABBBBAAAEEEEAAAQQQ6DcB9f19dX6/1Vv9ftX1Vuer/fstX13vVzL//x2Q8aG+0HfffXd1zbp1v3rssSe8rzay4opzXrc5rtfr1mo1bWpqqthBZnh42DpDMo88vjWtT+2/Y/fuZ/9p754937r00ksbfp3QYRl1fr81ufr9quutzlf791u+ut7q/H6rN+8XAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAIFeCKjv76vze2HIGosXUNdbnb94KY7shYC63mXlH3ZAphN+7733Dqw5ZsONGzae9Ie55aMe9o2vP714tJIfkvE7yZi5YueYzg4yDz+2pfB35iZ37njmz/ZPPP+5Cy64YKL4s0XuKKPO70UDscbiBdT1VucvXoojeyGgrrc6vxeGrIEAAggggAACCCCAAAIIIIAAAggggAACCCCAQL8JqO/vq/P7rd7q96uutzpf7d9v+ep6l5n/sgGZuXD34IMPrhpZsfrP12886beyLI98Ezhndv65ZxSDMX5Ixn/NcysGZKrVavH1gYeeLP7Mv6LIZbuf2/7Fycm9N5x33nmzZpYfaUhGnd9vza5+v+p6q/PV/v2Wr663Or/f6s37RQABBBBAAAEEEEAAAQQQQAABBBBAAAEEEECgFwLq+/vq/F4YssbiBdT1VucvXoojeyGgrnfZ+QcNyCwIHxhdufbGdRtO+NPcD8f4o+amXi6+4Ozi8UqNRntAxr/845Wq1aT4+p37H2nXwU/T5GYuctmenc/+8eS+F24+0pCMOr8XDcQaixdQ11udv3gpjuyFgLre6vxeGLIGAggggAACCCCAAAIIIIAAAggggAACCCCAAAL9JqC+v6/O77d6q9+vut7qfLV/v+Wr663Inx+Q6YT70ZaHH330shNPfM2X8jwfzf2Ui5k1m6nd9i+32q23/MNBu8c45yzP8/kBmWuv+4Bd9Z7fsCSJi/Oc/8+5ye3bf3ztG9/whrv8qM3hdpJR5/dbs6vfr7re6ny1f7/lq+utzu+3evN+EUAAAQQQQAABBBBAAAEEEEAAAQQQQAABBBDohYD6/r46vxeGrLF4AXW91fmLl+LIXgio663KP3RAJnrggQfWbjjutL+t1Ubf7Ydj/MYxrVbLPv93N9vT27batm3bit1j/JxLs9kqvvqdY/zLP2Zp06ZNduqmzfbB37nRKpVKsZGMH5Kp1ye/vvPnT/3u+eef/4KZZYc+amkOQJbfiyZijcULqOutzl+8FEf2QkBdb3V+LwxZAwEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQACBfhNQ399X5/dbvdXvV11vdb7av9/y1fVW5RcDMgumc6IfPP7ku44/YdNXsyyL/XCMP+CuO2+zhx96wOIoth/+8Ilixxj/eCW/e8zc+ZYkSfH7M888y9IstTeee75ddvnVxXYx/rAoitKfPbvtvWe/7oxv+AGZhbvIqPP7rdnV71ddb3W+2r/f8tX1Vuf3W715vwgggAACCCCAAAIIIIAAAggggAACCCCAAAII9EJAfX9fnd8LQ9ZYvIC63ur8xUtxZC8E1PVW5i8ckInMLN761M/+YuWqtb/fGY7ZvXunfeHzf21xHFujMWNbtmwthmOKV95+XtLcnIxVk6q9evMmGxgYsjRN7foP3mDHHrth/ph9Ey/81ebTjv+omaULd5HpTAep8nvRRKyxeAF1vdX5i5fiyF4IqOutzu+FIWsggAACCCCAAAIIIIAAAggggAACCCCAAAIIINBvAur7++r8fqu3+v2q663OV/v3W7663sp8t2A6J37ooR+OverEE2+pxMkv5Zkffsnt3v+6x3705GOWZZkdODBlW7duKwZiGg0/JFOMx8w/Zsn/+aZNp1mtNup3jLHXnvF6u/itlxSPWHKRWStt/vdz27f/5rnnnjk+NyTjF/Avv4gk/9BHPfVb85f9fuk31+n5sun7Mo9+o9/6svF50wgggAACCCCAAAIIIIAAAggggAACCCCAAAJdCfD5Ap8vdNVAgSfTb/RbYMt0dXjf99vC6Zz77ntw8+mvOesbae5OzX0fZpnd/q9ftqmpSZua2metZtOeeeZZm56ents1xhWPW2rvIONscHDQTjrpBKskiY2MrLSRkVG78j3v989XMpc7i13+9JYfP/Guiy46b2tnF5m56hW71yjyGZDp6vsn+GT6jR/wwU3TxQn0G/3WRftwKgIIIIAAAggggAACCCCAAAIIIIAAAggggECfCvD5Ap8vlNn69Bv9Rr+VN5/S2UEmesYs2fPw4284/uTN/2FZXsssszxzdvttXzLnnL3w/K5iGGbHjp02NVW3RmN2buMXX67cqtWqjYyM2MaNG4rdY9asPbb483dfda25KLfIIrPI1Z956keXbHjzOT84ycxvQZN1BmRU+QzIlPntZr6H/DgV/VYue9+m0W/8g6Jvm583jgACCCCAAAIIIIAAAggggAACCCCAAAIIILBkAT5f4POFJTfPEk6k3+i3JbTNkk/p+36bA4jHxy3Z/txD55x2ypl3Z3lWy/PMbyBjd//bbRZFse3e9VzxmKVWq1XsIpOmaTEw419+gMYPxZx88olWqVSK36/fcFxxzNvfebXfQMaciyxyUX3rTx59+yknnP/w2FgxIJPOVU6Wz4DMkr93lnQi/cYP+CU1zhJPot/otyW2DqchgAACCCCAAAIIIIAAAggggAACCCCAAAII9LEAny/w+UKZ7U+/0W/0W3nzKZ0dZCo7dlgyPv74a4874dW35VF+kmX+8Umpfe+737FGs1HsINOYnSlq44dkdu7cbfV6vRiGGR4etg0bjrU4jou/HxgcsrXHrLdqUrU3v+WXzbnYLMrNZe6Znz/7k6vHxl73o40biwGZ1lyxZfkMyJT57Ta/g4ys3vRbufVWp839g4J+UxeCfAQQQAABBBBAAAEEEEAAAQQQQAABBBBAAAEElpEAny8wsFBmu9Jv9Bv9Vt58ih+Qicws3rXLqnv2bD111THHfi6Kquf53WP8DjH/+/SWYjhmdna6+LqY19q16606MGjHrNtgJ596+twOM2ZZ1nhw4vndv71u3ean16+3xsIdZFT5zrnOY54W89Y4pksB+o1+67KFgk6n3+i3oIbhYAQQQAABBBBAAAEEEEAAAQQQQAABBBBAAAEErPiMlM9P6YTSBOg3Ps8qrdn4+ZYeNCATxwdW7Hlx7ydXrlx1XZ47y7LcpqcP2LatT1ilUrXndz9n09P1X1ifoaGarVt/nDWbs7Zp81k2NDRsUeTMudz27Zv44rrVa25K0+H9hxuQUeQzIFPmt9vB/6BQ1Hvu3RYDYYp8+o1+K/PnK/1Wbr+RhgACCCCAAAIIIIAAAggggAACCCCAAAIIIHB0CCwcWFB8nsTnWUdHHy32XdBvDMgstld6cVzf99uhAOPj41esHxv7TJbmsR+Q8bvI7Nr5M5ua3GfORfbC8zts+sDUYe2Hhkds7TEb/dyR1UZW2PoNx8/tHuMsil26a3z8w2NjY3f8ogGZsvP5ALkX30aLX4N+4wf84rul+yPpN/qt+y5iBQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAIF+E+DzBT5fKLPn6Tf6jX4rbz7loB1koqg+umfixROHhoY+lVQGf8UPx3T+f37XuDVbTYvjxOr1/Ta5f681ZmeKWvnHKY2uWGO12grLspbFccXWrR8rhmM6/zdbM/85PT39R+tWrd6eZbXJw+0go8hnQKbMb7eDd5BR1Hvu3RY7yCjy6Tf6rcyfr/Rbuf1GGgIIIIAAAggggAACCCCAAAIIIIAAAggggMDRIbBwYEHxeRKfZx0dfbTYd0G/MSCz2F7pxXF932+5f5aSWWXHDkucm6q14mTV3r3PXX7MqvUfz/J0KM/NMj8ok5pNTu61VnPGXBSbs8hc5E8tNoyxLE8tz1JLqoM2MrLGXGwWFQMy/ms8/fzEro+tWfOqOytpcyLPR+obN1rTzFpzRZTlO//sJ16lCdBv9FtpzdZ+hh4/38oEJwsBBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAgaNAgM8X+DyrzDam3+g3+q28+RS/g4z/ADkeH7fErZwcbh1IVuStxvqZ6ckPrBhddU2aZ1GemWV+CiY1a6Uta7WmLW2llvupGTNzLra4ElulMmSVuGLmh2PMmYvMYhdl+ycnbh0cGv17V6nuqgw39+f7Rg+MjRUDMu0FhPkMyJT57TY/sEC/lcvet2n8fOMfFH3b/LxxBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAgSUL8PkCny8suXmWcCL9Rr8toW2WfErf99scQPSMWbJqwgbr2fRIVk9X5XG64cDU1EdXrFz11jTLoixr7xRTPHLJ/6LYnaHt7neJKb76//xv/K4xfjgmirJ9ExPfGRiMb06ike1RLZ6oRUNTE6ts5iQrBmT8qv4ly2dAZsnfO0s6kX7jB/ySGmeJJ9Fv9NsSW4fTEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBPpYgM8X+HyhzPan3+g3+q28+ZTODjKR38Vlzx6r5nm95lxtdDI9sDprzJyYNqavHhlZ/c4sSwczPyDj+7MzLDPXq85vQuOHZCIz/2v/5KUoimempl78Zjww8JUoGd4xGg+/mOf1Sedq9XXrrDG3e8z8gIwqnwGZMr/d5neQod/KZe/btM4/KFQ/X+bgZf3Oz7e+bX3eOAIIIIAAAggggAACCCCAAAIIIIAAAggggEAXAny+wMBCF+0TfCr9Rr8FN00XJ/R9v80BFI9Z2rHDkrRmg1FrutaaSkctydfMTmfr09bkxQNDtQuTJDkjy/Ko2EEmd/M7yfidY8zlxQ4yUeSyZrP55Ox0/f64MnrvwFC0y5pub2UknswqQ/W4bjMbN84/XmluD5pivEaSzwfIXXz3LOFU+o0f8EtomyWfQr/Rb0tuHk5EAAEEEEAAAQQQQAABBBBAAAEEEEAAAQQQ6FsBPl/g84Uym59+o9/ot/LmU4qHIx06JZSmU0OzrjJSaaUrGlm+Mk3z1ZY1jsvy1utdxZ1eTQbGnEUrnYtq7fOzem7ZvkZzdjxv5VsiV3nMourP49i9WI3cvlYl3j+Qt6bieGR64e4xneEUdX6ZDUcW/UYPlCug/vmizi9XmzQEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBI4OAfX9fXX+0VHF5fMu1PVW5y+fSh0dV6qutzJ/4YBM8ZCkcbOk9qJVm8364OxsZSSKWiNplI3mLh7Nm80VeWYjqbXWZ62sluX5kG+ByLnpqBLVY6vscpFNuSTZ7/J0Ms6iySyrTA0MtKaSpDZTX22NMSt2jyke0nTIgIws/+ho4+XzLhZMQdJvy6dsy/ZK6bdlWzouHAEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABmQCfL8jo+zKYfuvLssvedD/3WzEg418LpnQi/6ilwUFL/JDMdB4Pu9nWUKsa1aJWo+Yq1SFrpYNZ5hLnsrh9bpRGUd60SjyTtxrTWaVarzSyej5QmR5y6QE/HDMzY825Ryv54Zjs0EcbqfNl3denwep6q/P7tOyyt62utzpfBk8wAggggAACCCCAAAIIIIAAAggggAACCCCAAALLWEB9f1+dv4xLtywvXV1vdf6yLNoyvmh1vVX5hw7I+N/7/+MdO6zih2RmZ6eqWTUeTNKhgZmZqcHKUDRQn02r1SiJs3SmGJCJ4sG0kTXT2kDcaE1ns4ODIzPNeHo2aqQzAwMjjbnhmJaZpX6eZuHuMZ2eWTClJMlfxr27LC9dXW91/rIs2jK+aHW91fnLuHRcOgIIIIAAAggggAACCCCAAAIIIIAAAggggAACMgH1/X11vgy+T4PV9Vbn92nZZW9bXW9V/vyAjJc/5CL8428qA3ssnh2wanWmnjQrUdJqumQ4GozrrcmKa7j2I5qqeV6rjLYOZDNpJcmbSStrNgZrzYFZa8yus3TMzA/HFI9VOtxwTKfq6nxZ9/VpsLre6vw+Lbvsbavrrc6XwROMAAIIIIAAAggggAACCCCAAAIIIIAAAggggMAyFlDf31fnL+PSLctLV9dbnb8si7aML1pdb0X+QQMyvnaHXIT/e//IpUqlYlGSWKUeT8Zx3UVx7IrdYzqvNM3TtJZntXQ0bTat1WpZtnHjwYMxv2g4prOOOn8Z9++yvHR1vdX5y7Joy/ii1fVW5y/j0nHpCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAgjIBNT399X5Mvg+DVbXW53fp2WXvW11vcvOf9mAjJefuwj/y84jl6LOr8fHLYpjc1FU/N38K8ssT1PLx8Ze2ilm4a4xxWLO+R1kjvhS5x/xAjmgpwLqeqvze4rJYkcUUNdbnX9EIA5AAAEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQACBlwmo7++r82mJcgXU9Vbnl6tNmrreZeYfdkDGt8CCi/C/7QzKHPrrQ7uleITS3B8u/PWih2M6C6rz+TYoV0Bdb3V+udqkqeutzqcDEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAIFxAfX9fnR8uxhndCKjrrc7vxo5zwwXU9S4r//8dkFlIdsjFdP7q0HNftjvMYneMOVJ51PlHuj7+vrcC6nqr83uryWpHElDXW51/JB/+HgEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBF4uoL6/r86nJ8oVUNdbnV+uNmnqer+S+f8HabRiLm3R4IUAAAAASUVORK5CYII="},"Ix/O":function(at,$e){at.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAAgCAYAAACcuBHKAAAACXBIWXMAAAsSAAALEgHS3X78AAAAAXNSR0IArs4c6QAAAhNJREFUWEftlztLA0EQx/97Z2LAF1ooKhZaCClsVARFLAQbbQTBVFY2NjZiI4KFINjo51DBD2BhI4IQfKAIikJAg48oKD4Kk3usbDabXHSTu1yCucJp5pL5z+zvZm4XllBKVZTZSBriaLIV9HMdBIOoJE22XHEaA8U+zMc19B2HbfV5BByCAeAzDMPB4rJiCt0uBoZDHI5uIv4xUczbFJQbqOFdJNVz6Nm64xB7wVtQf0tBhUohJol7VHX1c4jddr0UNV3VIMoGh9hpKB+EakazIer7gc5FwN/o6qUcJyWegKsV4PUgmZINEVwGfHXyWoQAlALMy0zEmHdi2htwsWSBeFnNjIPVYOuIWuJZrG0XtwOQ5PNOPC+U75tIjyM27wGIu1kdFZXyRupxJGPMMxPPQp8vbo3l0fNxMAhmpgYovt8+15yF3u47EPEceg4RnfHAOG6mPQARmSoeQvUDRsLpYLJ0fBylgBAAAoZ5mTGdFVj1p07M65CzThhxQM2xi6QLOtPzTlyOO4Nw1Wz7pN8QugZU+ACZT54Tlhj7bdXJ4j81LN9qupYax/lY6pxIAIpklmaO/+1fUq4Q9VKed+JsxAPjOB32AMTJkAcgjgY8ABHu/YfI3DtU4+/vHWwDG+o9hwh39+HrYR8Uitut7yqPwESgeTBzIWYg75FNEK3NVcFCk6gvitqOELtMZyAKLVJC/TfVWC6c92hknAAAAABJRU5ErkJggg=="},KMxT:function(at,$e,z){"use strict";z.r($e);var _e=z("DjyN"),F=z("NUBc"),w=z("qVdP"),U=z("jsC+"),S=z("lUTK"),I=z("BvKs"),N=z("T2oS"),k=z("W9HT"),A=z("+L6B"),C=z("2/Rp"),y=z("k1fw"),h=z("9og8"),u=z("tJVT"),o=z("PpiC"),e=z("5NDa"),d=z("5rEg"),s=z("Znn+"),t=z("ZTPi"),i=z("WmNS"),n=z.n(i),T=z("q1tI"),m=z.n(T),p=z("9kvl"),b=z("iris"),_=z("jcZT"),a=z("BdwD"),c=z("SAoR"),r=z("FKdj"),l=z.n(r),v=z("EJTS"),f=z("LE3n"),x=z("xKgJ"),R=z("SVaM"),O=z("xTzM"),B=z.n(O),j=z("1vsH"),K=z("ErOA"),L=t.a.TabPane,H=d.a.Search,Y;(function(Z){Z.Mine="0",Z.Public="1",Z.Collection="2",Z.TeachGroupShare="3"})(Y||(Y={}));var ae=function(ce){var de,q,te,he,J,X,ye,we,Le=ce.classroomList,xe=ce.problemset,Re=ce.user,Te=ce.globalSetting,Oe=ce.loading,Ie=ce.dispatch,Me=ce.match,Ne=ce.shixunHomeworks,Be=Object(o.a)(ce,["classroomList","problemset","user","globalSetting","loading","dispatch","match","shixunHomeworks"]),Pe=Object(j.I)(),Ye=Object(T.useState)({discipline_id:null,sub_discipline_id:null,tag_discipline_id:null,group_id:null,type:"0",item_type:Pe.qtype,difficulty:null,keyword:null,page:1,per_page:20,sort_by:"updated_at",sort_direction:"desc",id:((de=Be.location)===null||de===void 0||((q=de.query)===null||q===void 0)?void 0:q.id)||null,exam_id:(Me==null||((te=Me.params)===null||te===void 0)?void 0:te.id)||null,exercise_id:(Me==null||((he=Me.params)===null||he===void 0)?void 0:he.categoryId)||null}),Ke=Object(u.a)(Ye,2),Se=Ke[0],je=Ke[1],et=Object(T.useState)(0),Je=Object(u.a)(et,2),Ze=Je[0],We=Je[1],nt=Object(T.useState)([]),qe=Object(u.a)(nt,2),De=qe[0],Ge=qe[1],ne=Object(T.useState)(Y.Mine),le=Object(u.a)(ne,2),fe=le[0],$=le[1],Q=Object(T.useState)(-1),re=Object(u.a)(Q,2),me=re[0],Ae=re[1],ke=Object(T.useState)([]),ze=Object(u.a)(ke,2),lt=ze[0],pt=ze[1],ct=Object(T.useState)([]),bt=Object(u.a)(ct,2),St=bt[0],rt=bt[1],Xt=Object(T.useState)(!1),Pt=Object(u.a)(Xt,2),Zt=Pt[0],Ht=Pt[1],Et=Object(T.useRef)(!1),Jt=Object(T.useState)([]),li=Object(u.a)(Jt,2),Qe=li[0],vt=li[1],_t=Object(T.useState)("\u6309\u66F4\u65B0\u65F6\u95F4\u964D\u5E8F"),yt=Object(u.a)(_t,2),ii=yt[0],gi=yt[1],Ti=Object(T.useState)([]),ui=Object(u.a)(Ti,2),Ii=ui[0],xi=ui[1],Ai=Object(T.useRef)(null),Ji=Object(T.useState)(!1),Ni=Object(u.a)(Ji,2),on=Ni[0],Xi=Ni[1],qi=Object(T.useState)(""),Fi=Object(u.a)(qi,2),Yi=Fi[0],Wi=Fi[1],Hi=[{name:"\u6309\u66F4\u65B0\u65F6\u95F4\u5347\u5E8F",type:"updated_at",direction:"asc"},{name:"\u6309\u66F4\u65B0\u65F6\u95F4\u964D\u5E8F",type:"updated_at",direction:"desc"},{name:"\u6309\u4F7F\u7528\u6B21\u6570\u5347\u5E8F",type:"quotes",direction:"asc"},{name:"\u6309\u4F7F\u7528\u6B21\u6570\u964D\u5E8F",type:"quotes",direction:"desc"}];Object(T.useEffect)(function(){return document.body.setAttribute("data-custom","initial"),function(){document.body.removeAttribute("data-custom")}},[]),Object(T.useEffect)(function(){var ut;Ie({type:"problemset/getDisciplines",payload:{source:"question"}});var dt=((ut=Be.location.query)===null||ut===void 0?void 0:ut.group_id)||0;Se.group_id=Number(dt),je(Se),di(Se).then(function(Tt){Tt!=null&&Tt.status||xi(Tt==null?void 0:Tt.item_banks_group),Xi(!1)}),M(),ln()},[]),Object(T.useEffect)(function(){return Ie({type:"globalSetting/onlyShowBackTopToggle",payload:!1}),Ie({type:"globalSetting/onlyShowBackTopIconToggle",payload:!1}),function(){Ie({type:"globalSetting/onlyShowBackTopToggle",payload:!0}),Ie({type:"globalSetting/onlyShowBackTopIconToggle",payload:!0})}},[]),Object(T.useEffect)(function(){return Ie({type:"globalSetting/headerFixedToggle",payload:!0}),function(){Ie({type:"globalSetting/headerFixedToggle",payload:!1})}},[]),Object(T.useEffect)(function(){return Ie({type:"globalSetting/headerFooterToggle",payload:!1}),function(){Ie({type:"globalSetting/headerFooterToggle",payload:!0})}},[]);var ln=function(){var ut=Object(h.a)(n.a.mark(function dt(){return n.a.wrap(function(kt){for(;;)switch(kt.prev=kt.next){case 0:Ie({type:"problemset/getTeachGroupData"});case 1:case"end":return kt.stop()}},dt)}));return function(){return ut.apply(this,arguments)}}(),di=function(){var ut=Object(h.a)(n.a.mark(function dt(Tt){var kt;return n.a.wrap(function($t){for(;;)switch($t.prev=$t.next){case 0:return Tt.item_type=Tt.item_type,Xi(!0),$t.next=4,Ie({type:"problemset/getItemBanks",payload:Tt});case 4:if(kt=$t.sent,!(kt&&kt.status!==403&&kt.status!==401&&kt.status!==500)){$t.next=14;break}return We(kt.items_count||0),Ge(kt.items||[]),pt(kt.tag_disciplines||[]),g(kt.items||[]),vt([]),rt((kt==null?void 0:kt.navigation)||[]),Xi(!1),$t.abrupt("return",kt);case 14:case"end":return $t.stop()}},dt)}));return function(Tt){return ut.apply(this,arguments)}}(),M=function(){Ie({type:"problemset/getBasketList",payload:{}})},g=function(dt){var Tt=dt.every(function(kt){var si;return((si=kt.program_attr)===null||si===void 0?void 0:si.status)===0});Et.current=Tt},E=function(dt,Tt){if(Se.discipline_id=dt||"",Se.sub_discipline_id=Tt||"",Se.tag_discipline_id="",Se.page=1,Se.per_page=20,delete Se.id,Ae(dt===null?-1:null),je(Se),di(Se),dt===null)return},D=function(dt){Se.difficulty=dt||"",Se.page=1,Se.per_page=20,delete Se.id,je(Se),di(Se)},W=function(dt){Se.tag_discipline_id=dt,Se.page=1,Se.per_page=20,delete Se.id,dt===-1&&(Se.discipline_id="",Se.sub_discipline_id="",Se.tag_discipline_id=""),Ae(dt),je(Se),di(Se)},P=Object(T.useState)(!1),pe=Object(u.a)(P,2),Fe=pe[0],it=pe[1],st=function(dt){Ie({type:"problemset/getDisciplines",payload:{source:"question",group_id:0,group_type:dt}}),Se.discipline_id="",Se.sub_discipline_id="",Se.tag_discipline_id="",Se.difficulty=null,Se.type=dt,dt==="0"?Se.group_id=0:Se.group_id=null,dt==="3"?it(!0):it(!1),Se.page=1,Se.per_page=20,delete Se.id,Ae(-1),$(dt),je(Se),di(Se)},He=function(dt,Tt){Se.page=dt,Se.per_page=Tt,je(Se),di(Se)},gt=function(dt){Se.discipline_id="",Se.sub_discipline_id="",Se.tag_discipline_id="",Se.difficulty=null,Se.page=1,Se.keyword=dt,delete Se.id,dt?(Ht(!0),Object(R.a)({name:dt,copywriting:dt,position:"ItemBank"})):Ht(!1),Ae(-1),je(Se),di(Se)},jt=function(){Se.per_page=20,je(Se),di(Se)},Yt=function(){var ut=Object(h.a)(n.a.mark(function dt(Tt){return n.a.wrap(function(si){for(;;)switch(si.prev=si.next){case 0:Ie({type:"problemset/getDisciplines",payload:{source:"question",group_id:Math.abs(Tt),group_type:Y.Mine}}),Se.page=1,Se.per_page=20,Se.group_id=Math.abs(Tt),je(Se),di(Se).then(function($t){return xi($t==null?void 0:$t.item_banks_group)});case 6:case"end":return si.stop()}},dt)}));return function(Tt){return ut.apply(this,arguments)}}(),Oi=function(){Ie({type:"problemset/setActionTabs",payload:{key:"\u65B0\u5EFA\u6587\u4EF6\u5939",params:Se}});return},Ui=function(){Ie({type:"classroomList/setActionTabs",payload:{key:"\u9009\u7528\u5B9E\u8DF5\u9879\u76EE"}})},ci=function(){var ut=Object(h.a)(n.a.mark(function dt(Tt){return n.a.wrap(function(si){for(;;)switch(si.prev=si.next){case 0:Ie({type:"problemset/getDisciplines",payload:{source:"question",group_id:Tt,group_type:Y.TeachGroupShare}}),Se.page=1,Se.group_id=Tt||null,delete Se.id,je(Object(y.a)({},Se)),di(Se);case 6:case"end":return si.stop()}},dt)}));return function(Tt){return ut.apply(this,arguments)}}(),Mi=function(dt){Se.sort_by=dt.type,Se.sort_direction=dt.direction,Se.page=1,Se.per_page=20,gi(dt.name),je(Se),di(Se)},un=function(dt){Se.discipline_id="",Se.sub_discipline_id="",Se.tag_discipline_id="",Se.difficulty=null,Se.page=1,Se.per_page=20,Se.group_id=dt,Ae(-1),je(Se),di(Se).then(function(Tt){return xi(Tt==null?void 0:Tt.item_banks_group)})},$i=function(dt){vt(dt)},Ki=[{type:"SINGLE",name:"\u5355\u9009\u9898"},{type:"MULTIPLE",name:"\u591A\u9009\u9898"},{type:"JUDGMENT",name:"\u5224\u65AD\u9898"},{type:"PROGRAM",name:"\u7F16\u7A0B\u9898"},{type:"SUBJECTIVE",name:"\u7B80\u7B54\u9898"},{type:"COMPLETION",name:"\u586B\u7A7A\u9898"},{type:"COMBINATION",name:"\u7EC4\u5408\u9898"}],Bi={1:"\u7B80\u5355",2:"\u9002\u4E2D",3:"\u56F0\u96BE"},en=function(){var ut=Object(h.a)(n.a.mark(function dt(Tt){var kt;return n.a.wrap(function($t){for(;;)switch($t.prev=$t.next){case 0:if(!(Pe.type==="exercise")){$t.next=6;break}return $t.next=3,Object(K.a)("/api/exercises/".concat(Pe.exerciseid,"/toggle_random_question.json"),{method:"post",body:{question_id:Pe.qid,item_bank_id:Tt}});case 3:return kt=$t.sent,kt!=null&&kt.status||p.d.push(Pe.from),$t.abrupt("return");case 6:case"end":return $t.stop()}},dt)}));return function(Tt){return ut.apply(this,arguments)}}();return m.a.createElement("div",{className:l.a.page},m.a.createElement("section",null,m.a.createElement("div",{className:l.a.wrap},m.a.createElement("div",{className:l.a.title},"\u8BD5\u9898\u5E93"),m.a.createElement("div",{className:l.a.headerWrapper},m.a.createElement("div",{className:l.a.tabsWrap},m.a.createElement(t.a,{activeKey:fe,onChange:st,tabBarExtraContent:m.a.createElement("div",{className:l.a.searchWrap},m.a.createElement(H,{allowClear:!0,suffix:m.a.createElement("i",{className:"iconfont icon-sousuo9 font14 ".concat(l.a.searchIcon),onClick:function(){return gt(Se.keyword)}}),className:l.a.search,placeholder:"\u8BF7\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22",size:"large",value:Se.keyword,onChange:function(dt){Se.keyword=dt.target.value,je(Object(y.a)({},Se))},onSearch:gt}))},m.a.createElement(L,{tab:"\u516C\u5171",key:"1"}),((J=xe.teachGroupData)===null||J===void 0||((X=J.groups)===null||X===void 0)?void 0:X.length)&&m.a.createElement(L,{tab:"\u6211\u7684\u7FA4\u7EC4",key:"3"}),!Object(x.o)()&&!Object(x.m)()&&m.a.createElement(L,{tab:"\u6536\u85CF\u5939",key:"2"}),m.a.createElement(L,{tab:"\u6211\u521B\u5EFA\u7684",key:"0"}))),m.a.createElement(b.a,{showSelectAll:!1,className:l.a.select,disciplinesData:(ye=xe.disciplinesData)===null||ye===void 0?void 0:ye.disciplines,knowledgeData:lt,directionValue:Se.discipline_id,subDisciplineValue:Se.sub_discipline_id,typeValue:Se.item_type,isprogram_homework:!1,showItemType:!1,showKnowledge:!0,name:Yi,setname:Wi,difficultyValue:Se.difficulty,showShixun:!1,onShixunChange:Ui,onDirectionChange:E,onTypeChange:function(){},onDifficultyChange:D,knowledgeValue:me,onKnowledgeChange:W,teachGroupData:(we=xe.teachGroupData)===null||we===void 0?void 0:we.groups,onTeachGroupChange:ci,teachGroupValue:Se.group_id,showTeachGroup:Fe})),m.a.createElement("div",{className:l.a.treeWrapper,style:{display:fe===Y.Mine?"block":"none"}},m.a.createElement("div",{className:l.a.treeHeader},m.a.createElement(c.a,{data:St,onClick:Yt}),m.a.createElement(C.a,{type:"link",onClick:Oi,className:l.a.exportBtn},m.a.createElement("img",{src:B.a,alt:"",className:l.a.pngIcon}),"\u65B0\u5EFA\u6587\u4EF6\u5939")),m.a.createElement(k.a,{spinning:on},m.a.createElement("div",{ref:Ai,className:l.a.treeContent},m.a.createElement(f.a,{isProblemset:!1,reloadData:jt,data:Ii,onShare:function(){},onOpen:Yt})))),m.a.createElement("div",{className:l.a.contentWrap},m.a.createElement("div",{className:l.a.batchWrap},m.a.createElement("div",{style:{flex:1,display:"flex",alignItems:"center"}},m.a.createElement("div",{className:"font14"},m.a.createElement(U.a,{overlay:m.a.createElement(I.a,{selectedKeys:[ii]},Hi==null?void 0:Hi.map(function(ut,dt){return m.a.createElement(I.a.Item,{key:ut.name,onClick:function(){return Mi(ut)}},ut.name)}))},m.a.createElement("span",{style:{color:"#464F66"}},m.a.createElement("i",{className:"iconfont icon-paixu font14 mr5 c-light-primary"}),ii))))),Zt?m.a.createElement("div",null,m.a.createElement(C.a,{style:{paddingLeft:0},onClick:function(){Se.page=1,Se.keyword=null,delete Se.id,je(Se),Ht(!1),di(Se)},type:"link"},m.a.createElement("i",{className:"iconfont icon-fanhui2 font14"}),"\u8FD4\u56DE"),m.a.createElement("span",{className:"font14 mr20 c-grey-333"},"\u641C\u7D22\u201C",Se.keyword,"\u201D")):null,m.a.createElement("div",{className:l.a.contentListWrap},Ze!==0?m.a.createElement(k.a,{size:"large",spinning:Oe["problemset/getItemBanks"]},De.map(function(ut,dt){var Tt,kt;return m.a.createElement("div",{className:l.a.li,key:ut.id},m.a.createElement("div",{className:l.a.top},m.a.createElement(v.b,{showCheckbox:!1,data:ut,selectIds:Qe,onSelectCheckBox:$i})),m.a.createElement("div",{className:l.a.bottom},m.a.createElement("p",{className:"".concat(l.a.actionLeftItem," ").concat(l.a.questionTypeName)},(Tt=Ki.find(function(si){return si.type===ut.item_type}))===null||Tt===void 0?void 0:Tt.name),m.a.createElement("p",{className:l.a.actionLeftItem},Bi[ut.difficulty]),m.a.createElement("p",{className:l.a.actionLeftItem},"\u521B\u5EFA\u8005",m.a.createElement("span",{className:"c-grey-333"},ut==null||((kt=ut.author)===null||kt===void 0)?void 0:kt.name)),m.a.createElement("p",{className:l.a.actionLeftItem},"\u66F4\u65B0",m.a.createElement("span",{className:"c-grey-333"},ut==null?void 0:ut.updated_at)),m.a.createElement("p",{className:l.a.actionLeftItem},"\u4F7F\u7528\u6B21\u6570",m.a.createElement("span",{className:"c-grey-333"},ut==null?void 0:ut.quotes)),m.a.createElement("div",{className:l.a.more},m.a.createElement("span",{className:l.a.btnAdd,onClick:function(){return en(ut.id)}},"\u66FF\u6362"))))})):m.a.createElement(k.a,{size:"large",spinning:Oe["problemset/getItemBanks"]},m.a.createElement(a.a,null))),Ze!==0&&m.a.createElement(F.a,{showQuickJumper:!0,onChange:He,defaultCurrent:1,pageSize:Se==null?void 0:Se.per_page,current:Se.page||1,total:Ze,showTotal:function(dt){return m.a.createElement("span",{className:"mr10"},"\u5171",m.a.createElement("span",{className:"c-light-primary"},dt),"\u6761\u6570\u636E")}}))),m.a.createElement(_.a,{onOk:un})))};$e.default=Object(p.a)(function(Z){var ce=Z.classroomList,de=Z.problemset,q=Z.user,te=Z.loading,he=Z.globalSetting,J=Z.shixunHomeworks;return{classroomList:ce,problemset:de,user:q,globalSetting:he,loading:te.effects,shixunHomeworks:J}})(ae)},LE3n:function(at,$e,z){"use strict";var _e=z("ozfa"),F=z("MJZm"),w=z("k1fw"),U=z("+L6B"),S=z("2/Rp"),I=z("5NDa"),N=z("5rEg"),k=z("2qtc"),A=z("kLXV"),C=z("miYZ"),y=z("tsqr"),h=z("9og8"),u=z("tJVT"),o=z("WmNS"),e=z.n(o),d=z("q1tI"),s=z.n(d),t=z("1vnw"),i=z.n(t),n=z("ErOA"),T=z("Ix/O"),m=z.n(T),p=z("xTzM"),b=z.n(p),_=z("WCUW"),a=z("LvDl"),c=z.n(a),r=function(f){var x=f.isProblemset,R=f.name,O=f.id,B=f.itemBanksCount,j=f.onOpen,K=j===void 0?function(){}:j,L=f.onShare,H=L===void 0?function(){}:L,Y=f.onMove,ae=Y===void 0?function(){}:Y,Z=f.onDeleteOk,ce=Z===void 0?function(){}:Z,de=Object(d.useState)(!1),q=Object(u.a)(de,2),te=q[0],he=q[1],J=Object(d.useState)(R),X=Object(u.a)(J,2),ye=X[0],we=X[1],Le=Object(d.useState)(R),xe=Object(u.a)(Le,2),Re=xe[0],Te=xe[1],Oe=function(){var Me=Object(h.a)(e.a.mark(function Ne(Be){var Pe,Ye,Ke;return e.a.wrap(function(je){for(;;)switch(je.prev=je.next){case 0:if(Pe=["\uFF1F","\u3001","/","\u2572","*","<",">","|"],Re.trim()){je.next=4;break}return y.b.warn("\u8BF7\u8F93\u5165\u6587\u4EF6\u5939\u540D\u79F0"),je.abrupt("return");case 4:if(!(Re.charAt(0)===" ")){je.next=7;break}return y.b.warn("\u9996\u5B57\u7B26\u4E0D\u80FD\u4E3A\u7A7A\u683C"),je.abrupt("return");case 7:Ye=0;case 8:if(!(Ye<Re.length)){je.next=15;break}if(!Pe.includes(Re.charAt(Ye))){je.next=12;break}return y.b.warn("\u6587\u4EF6\u5939\u540D\u79F0\u5305\u542B\u7279\u6B8A\u5B57\u7B26"),je.abrupt("return",!1);case 12:Ye++,je.next=8;break;case 15:return je.next=17,Object(n.a)("/api/item_banks_groups/".concat(Math.abs(Be),".json"),{method:"put",body:{name:Re}});case 17:Ke=je.sent,Ke.status===0&&(he(!1),we(Re));case 19:case"end":return je.stop()}},Ne)}));return function(Be){return Me.apply(this,arguments)}}(),Ie=function(Ne){A.a.confirm({title:"\u63D0\u793A",okText:"\u786E\u8BA4\u5220\u9664",className:"custom-modal-divider ",icon:null,content:s.a.createElement("div",null,s.a.createElement("p",null,"\u672C\u6B21\u5220\u9664\u64CD\u4F5C\u786E\u5B9A\u540E\u5185\u5BB9\u5C06\u65E0\u6CD5\u6062\u590D\uFF0C\u662F\u5426\u7EE7\u7EED\uFF1F"),s.a.createElement("p",null,"\u5220\u9664\u6587\u4EF6\u5939\uFF0C\u5C06\u540C\u6B65\u5220\u9664\u5176\u6240\u5305\u542B\u7684\u5168\u90E8\u5B50\u6587\u4EF6\u5939\u548C\u8BD5\u9898\uFF0C\u8BF7\u614E\u91CD\u64CD\u4F5C\uFF01")),cancelText:"\u53D6\u6D88",onOk:function(){var Be=Object(h.a)(e.a.mark(function Ye(){var Ke;return e.a.wrap(function(je){for(;;)switch(je.prev=je.next){case 0:return je.next=2,Object(n.a)("/api/item_banks_groups/".concat(Math.abs(Ne),".json"),{method:"delete",body:{}});case 2:Ke=je.sent,Ke.status===0&&ce(Ne);case 4:case"end":return je.stop()}},Ye)}));function Pe(){return Be.apply(this,arguments)}return Pe}()})};return s.a.createElement("div",{className:i.a.list},te?s.a.createElement(N.a,{style:{maxWidth:780},value:Re,onChange:function(Ne){return Te(Ne.target.value)}}):s.a.createElement("div",{title:ye,onClick:function(){return K(O)},className:i.a.name},ye),x&&s.a.createElement("div",{className:i.a.btns},te?s.a.createElement(s.a.Fragment,null,s.a.createElement("div",{style:{height:16},onClick:function(){return Oe(O)},className:"ml0"},s.a.createElement("i",{className:"iconfont icon-chenggong1",style:{color:"#33BD8C"}})),s.a.createElement("div",{style:{height:16},onClick:function(){Te(ye),he(!1)},className:"ml10"},s.a.createElement("i",{className:"iconfont icon-qingchu"}))):s.a.createElement(s.a.Fragment,null,s.a.createElement("div",{onClick:function(){return ae(O,"up")},className:"ml0"},s.a.createElement("i",{className:"iconfont icon-shangyi3",style:{transform:"translateY(2px)"}})),s.a.createElement("div",{onClick:function(){return ae(O,"down")},className:"ml10",style:{transform:"rotate(180deg) translateY(1px)"}},s.a.createElement("i",{className:"iconfont icon-shangyi3"}))),s.a.createElement(S.a,{className:"ml10",onClick:function(){if(!B){y.b.warn("\u8BE5\u76EE\u5F55\u4E0B\u6CA1\u6709\u8BD5\u9898");return}H(Math.abs(O))},type:"link"},"\u5171\u4EAB\u5168\u90E8\u8BD5\u9898"),s.a.createElement(S.a,{className:"ml10",onClick:function(){return he(!0)},type:"link"},"\u91CD\u547D\u540D"),s.a.createElement(S.a,{onClick:function(){return Ie(O)},type:"link",danger:!0},"\u5220\u9664")))},l=function(f){var x=f.isProblemset,R=f.data,O=f.onOpen,B=O===void 0?function(){}:O,j=f.onShare,K=j===void 0?function(){}:j,L=f.reloadData,H=Object(d.useState)(),Y=Object(u.a)(H,2),ae=Y[0],Z=Y[1];Object(d.useEffect)(function(){Z(R==null?void 0:R.map(function(ye){return{title:s.a.createElement(r,{isProblemset:x,name:ye.name,id:ye.id,itemBanksCount:ye.item_banks_count,onMove:de,onOpen:B,onShare:K,onDeleteOk:te}),key:ye.id,icon:s.a.createElement("img",{src:m.a,className:i.a.folderIcon}),isLeaf:!1}}))},[R]);var ce=function ye(we,Le,xe){for(var Re=Object(a.cloneDeep)(we),Te=0;Te<Re.length;Te++){if(Re[Te].key===Le){if(xe==="up"){var Oe=[Re[Te],Re[Te-1]];Re[Te-1]=Oe[0],Re[Te]=Oe[1]}else{var Ie=[Re[Te+1],Re[Te]];Re[Te]=Ie[0],Re[Te+1]=Ie[1]}break}Re[Te].children&&(Re[Te].children=ye(Re[Te].children,Le,xe))}return Re},de=function(){var ye=Object(h.a)(e.a.mark(function we(Le,xe){var Re;return e.a.wrap(function(Oe){for(;;)switch(Oe.prev=Oe.next){case 0:if(!(xe==="up")){Oe.next=6;break}return Oe.next=3,Object(_.I)({id:Math.abs(Le)});case 3:Oe.t0=Oe.sent,Oe.next=9;break;case 6:return Oe.next=8,Object(_.H)({id:Math.abs(Le)});case 8:Oe.t0=Oe.sent;case 9:Re=Oe.t0,Re.status===0&&Z(function(Ie){return ce(Ie,Le,xe)});case 11:case"end":return Oe.stop()}},we)}));return function(Le,xe){return ye.apply(this,arguments)}}(),q=function ye(we,Le){return we.filter(function(xe){return xe.key===Le?!1:(xe.children&&(xe.children=ye(xe.children,Le)),!0)})},te=function(we){Z(function(Le){return q(Le,we)}),L()},he=function ye(we,Le,xe){return we.map(function(Re){return Re.key===Le?Object(w.a)(Object(w.a)({},Re),xe):Re.children?Object(w.a)(Object(w.a)({},Re),{},{children:ye(Re.children,Le,xe)}):Re})},J=function(){var ye=Object(h.a)(e.a.mark(function we(Le){var xe,Re,Te,Oe,Ie;return e.a.wrap(function(Ne){for(;;)switch(Ne.prev=Ne.next){case 0:return xe=Le.key,Ne.next=3,Object(_.B)({group_id:Math.abs(xe)});case 3:Re=Ne.sent,Te=Re||{},Oe=Te.item_banks_group,Ie=Te.item_banks_group_count,Ie>0?Z(function(Be){return he(Be,xe,{children:Oe.map(function(Pe){return{title:s.a.createElement(r,{isProblemset:x,name:Pe.name,id:Pe.id,itemBanksCount:Pe.item_banks_count,onMove:de,onOpen:B,onShare:K,onDeleteOk:te}),key:Pe.id,icon:s.a.createElement("img",{src:m.a,className:i.a.folderIcon}),isLeaf:!1}})})}):Z(function(Be){return he(Be,xe,{isLeaf:!0})});case 6:case"end":return Ne.stop()}},we)}));return function(Le){return ye.apply(this,arguments)}}(),X=function(we,Le){var xe=Le.node,Re=Le.expanded;Z(function(Te){return he(Te,xe.key,{icon:Re?s.a.createElement("img",{src:b.a,className:i.a.folderIcon}):s.a.createElement("img",{src:m.a,className:i.a.folderIcon})})})};return(ae==null?void 0:ae.length)>0&&s.a.createElement(F.a,{showLine:{showLeafIcon:!1},showIcon:!0,treeData:ae,loadData:J,onExpand:X,className:i.a.folderWrapper,selectable:!1})};$e.a=l},LdHM:function(at,$e,z){"use strict";z.d($e,"b",function(){return n}),z.d($e,"a",function(){return m});var _e=z("1OyB"),F=z("vuIU"),w=z("Ji7U"),U=z("LK+K"),S=z("q1tI"),I=z("rePB"),N=z("Ff2n"),k=z("ODXe"),A=z("4IlW"),C=z("bX4T"),y=z("YrtM"),h=z("TSYQ"),u=z.n(h),o=z("+nKL"),e=z("8OUc"),d=function(H,Y){var ae=H.prefixCls,Z=H.id,ce=H.flattenOptions,de=H.childrenAsData,q=H.values,te=H.searchValue,he=H.multiple,J=H.defaultActiveFirstOption,X=H.height,ye=H.itemHeight,we=H.notFoundContent,Le=H.open,xe=H.menuItemSelectedIcon,Re=H.virtual,Te=H.onSelect,Oe=H.onToggleOpen,Ie=H.onActiveValue,Me=H.onScroll,Ne=H.onMouseEnter,Be="".concat(ae,"-item"),Pe=Object(y.a)(function(){return ce},[Le,ce],function(Ge,ne){return ne[0]&&Ge[1]!==ne[1]}),Ye=S.useRef(null),Ke=function(ne){ne.preventDefault()},Se=function(ne){Ye.current&&Ye.current.scrollTo({index:ne})},je=function(ne){for(var le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,fe=Pe.length,$=0;$<fe;$+=1){var Q=(ne+$*le+fe)%fe,re=Pe[Q],me=re.group,Ae=re.data;if(!me&&!Ae.disabled)return Q}return-1},et=S.useState(function(){return je(0)}),Je=Object(k.a)(et,2),Ze=Je[0],We=Je[1],nt=function(ne){We(ne);var le=Pe[ne];if(!le){Ie(null,-1);return}Ie(le.data.value,ne)};S.useEffect(function(){nt(J!==!1?je(0):-1)},[Pe.length,te]),S.useEffect(function(){var Ge=setTimeout(function(){if(!he&&Le&&q.size===1){var ne=Array.from(q)[0],le=Pe.findIndex(function(fe){var $=fe.data;return $.value===ne});nt(le),Se(le)}});return function(){return clearTimeout(Ge)}},[Le]);var qe=function(ne){ne!==void 0&&Te(ne,{selected:!q.has(ne)}),he||Oe(!1)};if(S.useImperativeHandle(Y,function(){return{onKeyDown:function(ne){var le=ne.which;switch(le){case A.a.UP:case A.a.DOWN:{var fe=0;if(le===A.a.UP?fe=-1:le===A.a.DOWN&&(fe=1),fe!==0){var $=je(Ze+fe,fe);Se($),nt($)}break}case A.a.ENTER:{var Q=Pe[Ze];Q&&!Q.data.disabled?qe(Q.data.value):qe(void 0),Le&&ne.preventDefault();break}case A.a.ESC:Oe(!1)}},onKeyUp:function(){},scrollTo:function(ne){Se(ne)}}}),Pe.length===0)return S.createElement("div",{role:"listbox",id:"".concat(Z,"_list"),className:"".concat(Be,"-empty"),onMouseDown:Ke},we);function De(Ge){var ne=Pe[Ge];if(!ne)return null;var le=ne.data||{},fe=le.value,$=le.label,Q=le.children,re=Object(C.a)(le,!0),me=de?Q:$;return ne?S.createElement("div",Object.assign({"aria-label":typeof me=="string"?me:null},re,{key:Ge,role:"option",id:"".concat(Z,"_list_").concat(Ge),"aria-selected":q.has(fe)}),fe):null}return S.createElement(S.Fragment,null,S.createElement("div",{role:"listbox",id:"".concat(Z,"_list"),style:{height:0,width:0,overflow:"hidden"}},De(Ze-1),De(Ze),De(Ze+1)),S.createElement(o.a,{itemKey:"key",ref:Ye,data:Pe,height:X,itemHeight:ye,fullHeight:!1,onMouseDown:Ke,onScroll:Me,virtual:Re,onMouseEnter:Ne},function(Ge,ne){var le,fe=Ge.group,$=Ge.groupOption,Q=Ge.data,re=Q.label,me=Q.key;if(fe)return S.createElement("div",{className:u()(Be,"".concat(Be,"-group"))},re!==void 0?re:me);var Ae=Q.disabled,ke=Q.value,ze=Q.title,lt=Q.children,pt=Q.style,ct=Q.className,bt=Object(N.a)(Q,["disabled","value","title","children","style","className"]),St=q.has(ke),rt="".concat(Be,"-option"),Xt=u()(Be,rt,ct,(le={},Object(I.a)(le,"".concat(rt,"-grouped"),$),Object(I.a)(le,"".concat(rt,"-active"),Ze===ne&&!Ae),Object(I.a)(le,"".concat(rt,"-disabled"),Ae),Object(I.a)(le,"".concat(rt,"-selected"),St),le)),Pt=de?lt:re,Zt=!xe||typeof xe=="function"||St;return S.createElement("div",Object.assign({},bt,{"aria-selected":St,className:Xt,title:ze,onMouseMove:function(){if(Ze===ne||Ae)return;nt(ne)},onClick:function(){Ae||qe(ke)},style:pt}),S.createElement("div",{className:"".concat(rt,"-content")},Pt||ke),S.isValidElement(xe)||St,Zt&&S.createElement(e.a,{className:"".concat(Be,"-option-state"),customizeIcon:xe,customizeIconProps:{isSelected:St}},St?"\u2713":null))}))},s=S.forwardRef(d);s.displayName="OptionList";var t=s,i=function(){return null};i.isSelectOption=!0;var n=i,T=function(){return null};T.isSelectOptGroup=!0;var m=T,p=z("VTBJ"),b=z("Zm9Q");function _(L){var H=L.key,Y=L.props,ae=Y.children,Z=Y.value,ce=Object(N.a)(Y,["children","value"]);return Object(p.a)({key:H,value:Z!==void 0?Z:H,children:ae},ce)}function a(L){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(b.a)(L).map(function(Y,ae){if(!S.isValidElement(Y)||!Y.type)return null;var Z=Y.type.isSelectOptGroup,ce=Y.key,de=Y.props,q=de.children,te=Object(N.a)(de,["children"]);return H||!Z?_(Y):Object(p.a)(Object(p.a)({key:"__RC_SELECT_GRP__".concat(ce===null?ae:ce,"__"),label:ce},te),{},{options:a(q)})}).filter(function(Y){return Y})}var c=z("2Qr1"),r=z("qNPg"),l=z("U8pU"),v=z("Kwbf"),f=z("WKfj");function x(L){var H=L.mode,Y=L.options,ae=L.children,Z=L.backfill,ce=L.allowClear,de=L.placeholder,q=L.getInputElement,te=L.showSearch,he=L.onSearch,J=L.defaultOpen,X=L.autoFocus,ye=L.labelInValue,we=L.value,Le=L.inputValue,xe=L.optionLabelProp,Re=H==="multiple"||H==="tags",Te=te!==void 0?te:Re||H==="combobox",Oe=Y||a(ae);if(Object(v.a)(H!=="tags"||Oe.every(function(Be){return!Be.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),H==="tags"||H==="combobox"){var Ie=Oe.some(function(Be){return Be.options?Be.options.some(function(Pe){return typeof("value"in Pe?Pe.value:Pe.key)=="number"}):typeof("value"in Be?Be.value:Be.key)=="number"});Object(v.a)(!Ie,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(v.a)(H!=="combobox"||!xe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(v.a)(H==="combobox"||!Z,"`backfill` only works with `combobox` mode."),Object(v.a)(H==="combobox"||!q,"`getInputElement` only work with `combobox` mode."),Object(v.b)(H!=="combobox"||!q||!ce||!de,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),he&&!Te&&H!=="combobox"&&H!=="tags"&&Object(v.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(v.b)(!J||X,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),we!=null){var Me=Object(f.d)(we);Object(v.a)(!ye||Me.every(function(Be){return Object(l.a)(Be)==="object"&&("key"in Be||"value"in Be)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(v.a)(!Re||Array.isArray(we),"`value` should be array when `mode` is `multiple` or `tags`")}if(ae){var Ne=null;Object(b.a)(ae).some(function(Be){if(!S.isValidElement(Be)||!Be.type)return!1;var Pe=Be.type;if(Pe.isSelectOption)return!1;if(Pe.isSelectOptGroup){var Ye=Object(b.a)(Be.props.children).every(function(Ke){return!S.isValidElement(Ke)||!Be.type||Ke.type.isSelectOption?!0:(Ne=Ke.type,!1)});return!Ye}return Ne=Pe,!0}),Ne&&Object(v.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ne.displayName||Ne.name||Ne,"`.")),Object(v.a)(Le===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var R=x,O=Object(r.a)({prefixCls:"rc-select",components:{optionList:t},convertChildrenToData:a,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:R,fillOptionsWithMissingValue:c.a}),B=function(L){Object(w.a)(Y,L);var H=Object(U.a)(Y);function Y(){var ae;return Object(_e.a)(this,Y),ae=H.apply(this,arguments),ae.selectRef=S.createRef(),ae.focus=function(){ae.selectRef.current.focus()},ae.blur=function(){ae.selectRef.current.blur()},ae}return Object(F.a)(Y,[{key:"render",value:function(){return S.createElement(O,Object.assign({ref:this.selectRef},this.props))}}]),Y}(S.Component);B.Option=n,B.OptGroup=m;var j=B,K=$e.c=j},NvD2:function(at,$e,z){"use strict";z.d($e,"a",function(){return I});var _e=z("Kwbf");function F(N,k){var A=new Set;return N.forEach(function(C){k.has(C)||A.add(C)}),A}function w(N){var k=N||{},A=k.disabled,C=k.disableCheckbox,y=k.checkable;return!!(A||C)||y===!1}function U(N,k,A,C){for(var y=new Set(N),h=new Set,u=0;u<=A;u+=1){var o=k.get(u)||new Set;o.forEach(function(t){var i=t.key,n=t.node,T=t.children,m=T===void 0?[]:T;y.has(i)&&!C(n)&&m.filter(function(p){return!C(p.node)}).forEach(function(p){y.add(p.key)})})}for(var e=new Set,d=A;d>=0;d-=1){var s=k.get(d)||new Set;s.forEach(function(t){var i=t.parent,n=t.node;if(C(n)||!t.parent||e.has(t.parent.key))return;if(C(t.parent.node)){e.add(i.key);return}var T=!0,m=!1;(i.children||[]).filter(function(p){return!C(p.node)}).forEach(function(p){var b=p.key,_=y.has(b);T&&!_&&(T=!1),!m&&(_||h.has(b))&&(m=!0)}),T&&y.add(i.key),m&&h.add(i.key),e.add(i.key)})}return{checkedKeys:Array.from(y),halfCheckedKeys:Array.from(F(h,y))}}function S(N,k,A,C,y){for(var h=new Set(N),u=new Set(k),o=0;o<=C;o+=1){var e=A.get(o)||new Set;e.forEach(function(i){var n=i.key,T=i.node,m=i.children,p=m===void 0?[]:m;!h.has(n)&&!u.has(n)&&!y(T)&&p.filter(function(b){return!y(b.node)}).forEach(function(b){h.delete(b.key)})})}u=new Set;for(var d=new Set,s=C;s>=0;s-=1){var t=A.get(s)||new Set;t.forEach(function(i){var n=i.parent,T=i.node;if(y(T)||!i.parent||d.has(i.parent.key))return;if(y(i.parent.node)){d.add(n.key);return}var m=!0,p=!1;(n.children||[]).filter(function(b){return!y(b.node)}).forEach(function(b){var _=b.key,a=h.has(_);m&&!a&&(m=!1),!p&&(a||u.has(_))&&(p=!0)}),m||h.delete(n.key),p&&u.add(n.key),d.add(n.key)})}return{checkedKeys:Array.from(h),halfCheckedKeys:Array.from(F(u,h))}}function I(N,k,A,C){var y=[],h;C?h=C:h=w;var u=new Set(N.filter(function(s){var t=!!A[s];return t||y.push(s),t})),o=new Map,e=0;Object.keys(A).forEach(function(s){var t=A[s],i=t.level,n=o.get(i);n||(n=new Set,o.set(i,n)),n.add(t),e=Math.max(e,i)}),Object(_e.a)(!y.length,"Tree missing follow keys: ".concat(y.slice(0,100).map(function(s){return"'".concat(s,"'")}).join(", ")));var d;return k===!0?d=U(u,o,e,h):d=S(u,k.halfCheckedKeys,o,e,h),d}},OZM5:function(at,$e,z){"use strict";z.d($e,"b",function(){return C}),z.d($e,"a",function(){return y}),z.d($e,"k",function(){return h}),z.d($e,"h",function(){return u}),z.d($e,"i",function(){return o}),z.d($e,"g",function(){return e}),z.d($e,"c",function(){return d}),z.d($e,"d",function(){return s}),z.d($e,"j",function(){return n}),z.d($e,"e",function(){return T}),z.d($e,"f",function(){return m});var _e=z("KQm4"),F=z("U8pU"),w=z("Ff2n"),U=z("q1tI"),S=z.n(U),I=z("Kwbf"),N=z("WaYH"),k=.25,A=2;function C(p,b){var _=p.slice(),a=_.indexOf(b);return a>=0&&_.splice(a,1),_}function y(p,b){var _=p.slice();return _.indexOf(b)===-1&&_.push(b),_}function h(p){return p.split("-")}function u(p,b){return"".concat(p,"-").concat(b)}function o(p){return p&&p.type&&p.type.isTreeNode}function e(p,b){var _=[p],a=b[p];function c(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];r.forEach(function(l){var v=l.key,f=l.children;_.push(v),c(f)})}return c(a.children),_}function d(p,b){var _=p.clientY,a=b.selectHandle.getBoundingClientRect(),c=a.top,r=a.bottom,l=a.height,v=Math.max(l*k,A);return _<=c+v?-1:_>=r-v?1:0}function s(p,b){if(!p)return;var _=b.multiple;return _?p.slice():p.length?[p[0]]:p}var t=function(b){return b};function i(p,b){if(!p)return[];var _=b||{},a=_.processProps,c=a===void 0?t:a,r=Array.isArray(p)?p:[p];return r.map(function(l){var v=l.children,f=Object(w.a)(l,["children"]),x=i(v,b);return S.a.createElement(N.a,Object.assign({},c(f)),x)})}function n(p){if(!p)return null;var b;if(Array.isArray(p))b={checkedKeys:p,halfCheckedKeys:void 0};else if(Object(F.a)(p)==="object")b={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 b}function T(p,b){var _=new Set;function a(c){if(_.has(c))return;var r=b[c];if(!r)return;_.add(c);var l=r.parent,v=r.node;if(v.disabled)return;l&&a(l.key)}return(p||[]).forEach(function(c){a(c)}),Object(_e.a)(_)}function m(p){var b={};return Object.keys(p).forEach(function(_){(_.startsWith("data-")||_.startsWith("aria-"))&&(b[_]=p[_])}),b}},"P/tu":function(at,$e,z){"use strict";var _e=z("ozfa"),F=z("MJZm"),w=z("0Owb"),U=z("9og8"),S=z("tJVT"),I=z("PpiC"),N=z("WmNS"),k=z.n(N),A=z("q1tI"),C=z.n(A),y=z("WCUW"),h=z("spXi"),u=z.n(h),o=function(d){var s=d.value,t=d.onChange,i=d.defaultValue,n=d.disabled,T=Object(I.a)(d,["value","onChange","defaultValue","disabled"]),m=Object(A.useState)([]),p=Object(S.a)(m,2),b=p[0],_=p[1],a=Object(A.useState)("1"),c=Object(S.a)(a,2),r=c[0],l=c[1];Object(A.useEffect)(function(){v()},[]);var v=function(){var R=Object(U.a)(k.a.mark(function O(){var B,j;return k.a.wrap(function(L){for(;;)switch(L.prev=L.next){case 0:return L.next=2,Object(y.A)({});case 2:B=L.sent,B!=null&&B.data&&(j=[{title:C.a.createElement("div",{title:"\u6839\u76EE\u5F55",className:u.a.name},"\u6839\u76EE\u5F55"),value:0,key:0,icon:C.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:f(B.data||[])}],_(j),l("2"));case 4:case"end":return L.stop()}},O)}));return function(){return R.apply(this,arguments)}}(),f=function(O){function B(j){var K=j.children,L=Array.isArray(K)&&K.length>0,H=j==null?void 0:j.group_id;return{title:C.a.createElement("div",{title:j==null?void 0:j.name,className:u.a.name},j==null?void 0:j.name),value:H,key:H,icon:C.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:L?K==null?void 0:K.map(function(Y){return B(Y)}):[]}}return O==null?void 0:O.map(function(j){return B(j)})},x=i?{defaultExpandedKeys:[0]}:{selectedKeys:s,defaultExpandedKeys:s};return C.a.createElement("div",{className:u.a.customTree},C.a.createElement(F.a,Object(w.a)({key:r},x,{showIcon:!0,treeData:b,onSelect:t,disabled:n},T)))};$e.a=o},Q0Vu:function(at,$e,z){at.exports={flex_box_center:"flex_box_center___3fHaw",flex_space_between:"flex_space_between___1tu3K",flex_box_vertical_center:"flex_box_vertical_center___3kmTT",flex_box_center_end:"flex_box_center_end___19OcD",flex_box_column:"flex_box_column___1aMoy",main:"main___JkLSb",wrap:"wrap___1k_Ib",content:"content___1by-P",programName:"programName___1mMSD",name:"name___2mlTd",directionContentWrap:"directionContentWrap___3qsxQ",directionItem:"directionItem___2aAvu",active:"active___ACZqb",subActive:"subActive___2RkoB",subItem:"subItem___3tJgX",subMenu:"subMenu___Y_7S_",action:"action___xqgFs"}},SAoR:function(at,$e,z){"use strict";var _e=z("Q9mQ"),F=z("diRs"),w=z("q1tI"),U=z.n(w),S=z("+z73"),I=z.n(S),N=function(A){var C=A.data,y=C===void 0?[]:C,h=A.onClick,u=function(){return y.map(function(d,s){return U.a.createElement("div",{key:s,className:I.a.few},U.a.createElement("b",{title:d.name,style:{color:s===0?"#333333":"#999999"},onClick:function(){return h(d.id)}},d.name),s<y.length-1&&U.a.createElement("span",null,"/"))})},o=function(){var d=!0,s=y.slice(2,-2),t=U.a.createElement("div",{className:I.a.pWrap},s.map(function(i){return U.a.createElement("span",{title:i.name,onClick:function(){return h(i.id)},key:i.id},i.name)}));return y.map(function(i,n){var T=null;return n>1&&n<y.length-2?d&&(T=U.a.createElement(F.a,{key:n,placement:"bottom",content:t},U.a.createElement("span",{style:{color:"#999",cursor:"pointer"}},".../")),d=!1):T=U.a.createElement("div",{key:n,className:I.a.few},U.a.createElement("b",{title:i.name,style:{color:n===0?"#333333":"#999999"},onClick:function(){return h(i.id)}},i.name),n<y.length-1&&U.a.createElement("span",null,"/")),T})};return U.a.createElement("aside",{style:{overflowX:"auto"}},(y==null?void 0:y.length)>5?o():u())};$e.a=N},SJMd:function(at,$e){/**
* @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 z,_e,F,w=!1,U,S;window.PR_SHOULD_USE_CONTINUATION=!0;var I,N;(function(){var k=window,A=["break,continue,do,else,for,if,return,while"],C=[A,"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=[C,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],h=[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"],u=[y,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],o=[y,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],e="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",d=[y,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",t=[A,"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"],i=[A,"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"],n=[A,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],T=[h,o,u,d,s,t,i,n],m=/^(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",b="kwd",_="com",a="typ",c="lit",r="pun",l="pln",v="tag",f="dec",x="src",R="atn",O="atv",B="nocode",j="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function K(Te){for(var Oe=0,Ie=!1,Me=!1,Ne=0,Be=Te.length;Ne<Be;++Ne){var Pe=Te[Ne];if(Pe.ignoreCase)Me=!0;else if(/[a-z]/i.test(Pe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ie=!0,Me=!1;break}}var Ye={b:8,t:9,n:10,v:11,f:12,r:13};function Ke(Ze){var We=Ze.charCodeAt(0);if(We!==92)return We;var nt=Ze.charAt(1);return We=Ye[nt],We||("0"<=nt&&nt<="7"?parseInt(Ze.substring(1),8):nt==="u"||nt==="x"?parseInt(Ze.substring(2),16):Ze.charCodeAt(1))}function Se(Ze){if(Ze<32)return(Ze<16?"\\x0":"\\x")+Ze.toString(16);var We=String.fromCharCode(Ze);return We==="\\"||We==="-"||We==="]"||We==="^"?"\\"+We:We}function je(Ze){var We=Ze.substring(1,Ze.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")),nt=[],qe=We[0]==="^",De=["["];qe&&De.push("^");for(var Ge=qe?1:0,ne=We.length;Ge<ne;++Ge){var le=We[Ge];if(/\\[bdsw]/i.test(le))De.push(le);else{var fe=Ke(le),$;Ge+2<ne&&We[Ge+1]==="-"?($=Ke(We[Ge+2]),Ge+=2):$=fe,nt.push([fe,$]),$<65||fe>122||($<65||fe>90||nt.push([Math.max(65,fe)|32,Math.min($,90)|32]),$<97||fe>122||nt.push([Math.max(97,fe)&~32,Math.min($,122)&~32]))}}nt.sort(function(Ae,ke){return Ae[0]-ke[0]||ke[1]-Ae[1]});for(var Q=[],re=[],Ge=0;Ge<nt.length;++Ge){var me=nt[Ge];me[0]<=re[1]+1?re[1]=Math.max(re[1],me[1]):Q.push(re=me)}for(var Ge=0;Ge<Q.length;++Ge){var me=Q[Ge];De.push(Se(me[0])),me[1]>me[0]&&(me[1]+1>me[0]&&De.push("-"),De.push(Se(me[1])))}return De.push("]"),De.join("")}function et(Ze){for(var We=Ze.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")),nt=We.length,qe=[],De=0,Ge=0;De<nt;++De){var ne=We[De];if(ne==="(")++Ge;else if(ne.charAt(0)==="\\"){var le=+ne.substring(1);le&&(le<=Ge?qe[le]=-1:We[De]=Se(le))}}for(var De=1;De<qe.length;++De)qe[De]===-1&&(qe[De]=++Oe);for(var De=0,Ge=0;De<nt;++De){var ne=We[De];if(ne==="(")++Ge,qe[Ge]||(We[De]="(?:");else if(ne.charAt(0)==="\\"){var le=+ne.substring(1);le&&le<=Ge&&(We[De]="\\"+qe[le])}}for(var De=0;De<nt;++De)We[De]==="^"&&We[De+1]!=="^"&&(We[De]="");if(Ze.ignoreCase&&Ie)for(var De=0;De<nt;++De){var ne=We[De],fe=ne.charAt(0);ne.length>=2&&fe==="["?We[De]=je(ne):fe!=="\\"&&(We[De]=ne.replace(/[a-zA-Z]/g,function(re){var me=re.charCodeAt(0);return"["+String.fromCharCode(me&~32,me|32)+"]"}))}return We.join("")}for(var Je=[],Ne=0,Be=Te.length;Ne<Be;++Ne){var Pe=Te[Ne];if(Pe.global||Pe.multiline)throw new Error(""+Pe);Je.push("(?:"+et(Pe)+")")}return new RegExp(Je.join("|"),Me?"gi":"g")}function L(Te,Oe){var Ie=/(?:^|\s)nocode(?:\s|$)/,Me=[],Ne=0,Be=[],Pe=0;function Ye(Ke){var Se=Ke.nodeType;if(Se==1){if(Ie.test(Ke.className))return;for(var je=Ke.firstChild;je;je=je.nextSibling)Ye(je);var et=Ke.nodeName.toLowerCase();(et==="br"||et==="li")&&(Me[Pe]=`
`,Be[Pe<<1]=Ne++,Be[Pe++<<1|1]=Ke)}else if(Se==3||Se==4){var Je=Ke.nodeValue;Je.length&&(Oe?Je=Je.replace(/\r\n?/g,`
`):Je=Je.replace(/[ \t\r\n]+/g," "),Me[Pe]=Je,Be[Pe<<1]=Ne,Ne+=Je.length,Be[Pe++<<1|1]=Ke)}}return Ye(Te),{sourceCode:Me.join("").replace(/\n$/,""),spans:Be}}function H(Te,Oe,Ie,Me,Ne){if(!Ie)return;var Be={sourceNode:Te,pre:1,langExtension:null,numberLines:null,sourceCode:Ie,spans:null,basePos:Oe,decorations:null};Me(Be),Ne.push.apply(Ne,Be.decorations)}var Y=/\S/;function ae(Te){for(var Oe=void 0,Ie=Te.firstChild;Ie;Ie=Ie.nextSibling){var Me=Ie.nodeType;Oe=Me===1?Oe?Te:Ie:Me===3&&Y.test(Ie.nodeValue)?Te:Oe}return Oe===Te?void 0:Oe}function Z(Te,Oe){var Ie={},Me;(function(){for(var Pe=Te.concat(Oe),Ye=[],Ke={},Se=0,je=Pe.length;Se<je;++Se){var et=Pe[Se],Je=et[3];if(Je)for(var Ze=Je.length;--Ze>=0;)Ie[Je.charAt(Ze)]=et;var We=et[1],nt=""+We;Ke.hasOwnProperty(nt)||(Ye.push(We),Ke[nt]=null)}Ye.push(/[\0-\uffff]/),Me=K(Ye)})();var Ne=Oe.length,Be=function(Pe){for(var Ye=Pe.sourceCode,Ke=Pe.basePos,Se=Pe.sourceNode,je=[Ke,l],et=0,Je=Ye.match(Me)||[],Ze={},We=0,nt=Je.length;We<nt;++We){var qe=Je[We],De=Ze[qe],Ge=void 0,ne;if(typeof De=="string")ne=!1;else{var le=Ie[qe.charAt(0)];if(le)Ge=qe.match(le[1]),De=le[0];else{for(var fe=0;fe<Ne;++fe)if(le=Oe[fe],Ge=qe.match(le[1]),Ge){De=le[0];break}Ge||(De=l)}ne=De.length>=5&&De.substring(0,5)==="lang-",ne&&!(Ge&&typeof Ge[1]=="string")&&(ne=!1,De=x),ne||(Ze[qe]=De)}var $=et;if(et+=qe.length,!ne)je.push(Ke+$,De);else{var Q=Ge[1],re=qe.indexOf(Q),me=re+Q.length;Ge[2]&&(me=qe.length-Ge[2].length,re=me-Q.length);var Ae=De.substring(5);H(Se,Ke+$,qe.substring(0,re),Be,je),H(Se,Ke+$+re,Q,X(Ae,Q),je),H(Se,Ke+$+me,qe.substring(me),Be,je)}}Pe.decorations=je};return Be}function ce(Te){var Oe=[],Ie=[];Te.tripleQuotedStrings?Oe.push([p,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Te.multiLineStrings?Oe.push([p,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Oe.push([p,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Te.verbatimStrings&&Ie.push([p,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Me=Te.hashComments;Me&&(Te.cStyleComments?(Me>1?Oe.push([_,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Oe.push([_,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ie.push([p,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Oe.push([_,/^#[^\r\n]*/,null,"#"])),Te.cStyleComments&&(Ie.push([_,/^\/\/[^\r\n]*/,null]),Ie.push([_,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ne=Te.regexLiterals;if(Ne){var Be=Ne>1?"":`
\r`,Pe=Be?".":"[\\S\\s]",Ye="/(?=[^/*"+Be+"])(?:[^/\\x5B\\x5C"+Be+"]|\\x5C"+Pe+"|\\x5B(?:[^\\x5C\\x5D"+Be+"]|\\x5C"+Pe+")*(?:\\x5D|$))+/";Ie.push(["lang-regex",RegExp("^"+j+"("+Ye+")")])}var Ke=Te.types;Ke&&Ie.push([a,Ke]);var Se=(""+Te.keywords).replace(/^ | $/g,"");Se.length&&Ie.push([b,new RegExp("^(?:"+Se.replace(/[\s,]+/g,"|")+")\\b"),null]),Oe.push([l,/^\s+/,null,` \r
\xA0`]);var je="^.[^\\s\\w.$@'\"`/\\\\]*";return Te.regexLiterals&&(je+="(?!s*/)"),Ie.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[a,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[l,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[l,/^\\[\s\S]?/,null],[r,new RegExp(je),null]),Z(Oe,Ie)}var de=ce({keywords:T,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function q(Te,Oe,Ie){for(var Me=/(?:^|\s)nocode(?:\s|$)/,Ne=/\r\n?|\n/,Be=Te.ownerDocument,Pe=Be.createElement("li");Te.firstChild;)Pe.appendChild(Te.firstChild);var Ye=[Pe];function Ke(We){var nt=We.nodeType;if(nt==1&&!Me.test(We.className))if(We.nodeName==="br")Se(We),We.parentNode&&We.parentNode.removeChild(We);else for(var qe=We.firstChild;qe;qe=qe.nextSibling)Ke(qe);else if((nt==3||nt==4)&&Ie){var De=We.nodeValue,Ge=De.match(Ne);if(Ge){var ne=De.substring(0,Ge.index);We.nodeValue=ne;var le=De.substring(Ge.index+Ge[0].length);if(le){var fe=We.parentNode;fe.insertBefore(Be.createTextNode(le),We.nextSibling)}Se(We),ne||We.parentNode.removeChild(We)}}}function Se(We){for(;!We.nextSibling;)if(We=We.parentNode,!We)return;function nt(Ge,ne){var le=ne?Ge.cloneNode(!1):Ge,fe=Ge.parentNode;if(fe){var $=nt(fe,1),Q=Ge.nextSibling;$.appendChild(le);for(var re=Q;re;re=Q)Q=re.nextSibling,$.appendChild(re)}return le}for(var qe=nt(We.nextSibling,0),De;(De=qe.parentNode)&&De.nodeType===1;)qe=De;Ye.push(qe)}for(var je=0;je<Ye.length;++je)Ke(Ye[je]);Oe===(Oe|0)&&Ye[0].setAttribute("value",Oe);var et=Be.createElement("ol");et.className="linenums";for(var Je=Math.max(0,Oe-1|0)||0,je=0,Ze=Ye.length;je<Ze;++je)Pe=Ye[je],Pe.className="L"+(je+Je)%10,Pe.firstChild||Pe.appendChild(Be.createTextNode("\xA0")),et.appendChild(Pe);Te.appendChild(et)}function te(Te){var Oe=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Oe=Oe&&+Oe[1]<=8;var Ie=/\n/g,Me=Te.sourceCode,Ne=Me.length,Be=0,Pe=Te.spans,Ye=Pe.length,Ke=0,Se=Te.decorations,je=Se.length,et=0;Se[je]=Ne;var Je,Ze;for(Ze=Je=0;Ze<je;)Se[Ze]!==Se[Ze+2]?(Se[Je++]=Se[Ze++],Se[Je++]=Se[Ze++]):Ze+=2;for(je=Je,Ze=Je=0;Ze<je;){for(var We=Se[Ze],nt=Se[Ze+1],qe=Ze+2;qe+2<=je&&Se[qe+1]===nt;)qe+=2;Se[Je++]=We,Se[Je++]=nt,Ze=qe}je=Se.length=Je;var De=Te.sourceNode,Ge="";De&&(Ge=De.style.display,De.style.display="none");try{for(var ne=null;Ke<Ye;){var le=Pe[Ke],fe=Pe[Ke+2]||Ne,$=Se[et+2]||Ne,qe=Math.min(fe,$),Q=Pe[Ke+1],re;if(Q.nodeType!==1&&(re=Me.substring(Be,qe))){Oe&&(re=re.replace(Ie,"\r")),Q.nodeValue=re;var me=Q.ownerDocument,Ae=me.createElement("span");Ae.className=Se[et+1];var ke=Q.parentNode;ke.replaceChild(Ae,Q),Ae.appendChild(Q),Be<fe&&(Pe[Ke+1]=Q=me.createTextNode(Me.substring(qe,fe)),ke.insertBefore(Q,Ae.nextSibling))}Be=qe,Be>=fe&&(Ke+=2),Be>=$&&(et+=2)}}finally{De&&(De.style.display=Ge)}}var he={};function J(Te,Oe){for(var Ie=Oe.length;--Ie>=0;){var Me=Oe[Ie];he.hasOwnProperty(Me)?k.console&&console.warn("cannot override language handler %s",Me):he[Me]=Te}}function X(Te,Oe){return Te&&he.hasOwnProperty(Te)||(Te=/^\s*</.test(Oe)?"default-markup":"default-code"),he[Te]}J(de,["default-code"]),J(Z([],[[l,/^[^<?]+/],[f,/^<!\w[^>]*(?:>|$)/],[_,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[r,/^(?:<[%?]|[%?]>)/],["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"]),J(Z([[l,/^[\s]+/,null,` \r
`],[O,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[v,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[R,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[r,/^[=<>\/]+/],["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"]),J(Z([],[[O,/^[\s\S]+/]]),["uq.val"]),J(ce({keywords:h,hashComments:!0,cStyleComments:!0,types:m}),["c","cc","cpp","cxx","cyc","m"]),J(ce({keywords:"null,true,false"}),["json"]),J(ce({keywords:o,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:m}),["cs"]),J(ce({keywords:u,cStyleComments:!0}),["java"]),J(ce({keywords:n,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),J(ce({keywords:t,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),J(ce({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),J(ce({keywords:i,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),J(ce({keywords:d,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),J(ce({keywords:e,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),J(Z([],[[p,/^[\s\S]+/]]),["regex"]);function ye(Te){var Oe=Te.langExtension;try{var Ie=L(Te.sourceNode,Te.pre),Me=Ie.sourceCode;Te.sourceCode=Me,Te.spans=Ie.spans,Te.basePos=0,X(Oe,Me)(Te),te(Te)}catch(Ne){k.console&&console.log(Ne&&Ne.stack||Ne)}}function we(Te,Oe,Ie){var Me=Ie||!1,Ne=Oe||null,Be=document.createElement("div");Be.innerHTML="<pre>"+Te+"</pre>",Be=Be.firstChild,Me&&q(Be,Me,!0);var Pe={langExtension:Ne,numberLines:Me,sourceNode:Be,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return ye(Pe),Be.innerHTML}function Le(Te,Oe){var Ie=Oe||document.body,Me=Ie.ownerDocument||document;function Ne(le){return Ie.getElementsByTagName(le)}for(var Be=[Ne("pre"),Ne("code"),Ne("xmp")],Pe=[],Ye=0;Ye<Be.length;++Ye)for(var Ke=0,Se=Be[Ye].length;Ke<Se;++Ke)Pe.push(Be[Ye][Ke]);Be=null;var je=Date;je.now||(je={now:function(){return+new Date}});var et=0,Je=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ze=/\bprettyprint\b/,We=/\bprettyprinted\b/,nt=/pre|xmp/i,qe=/^code$/i,De=/^(?:pre|code|xmp)$/i,Ge={};function ne(){for(var le=k.PR_SHOULD_USE_CONTINUATION?je.now()+250:Infinity;et<Pe.length&&je.now()<le;et++){for(var fe=Pe[et],$=Ge,Q=fe;Q=Q.previousSibling;){var re=Q.nodeType,me=(re===7||re===8)&&Q.nodeValue;if(me?!/^\??prettify\b/.test(me):re!==3||/\S/.test(Q.nodeValue))break;if(me){$={},me.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Ht,Et,Jt){$[Et]=Jt});break}}var Ae=fe.className;if(($!==Ge||Ze.test(Ae))&&!We.test(Ae)){for(var ke=!1,ze=fe.parentNode;ze;ze=ze.parentNode){var lt=ze.tagName;if(De.test(lt)&&ze.className&&Ze.test(ze.className)){ke=!0;break}}if(!ke){fe.className+=" prettyprinted";var pt=$.lang;if(!pt){pt=Ae.match(Je);var ct;!pt&&(ct=ae(fe))&&qe.test(ct.tagName)&&(pt=ct.className.match(Je)),pt&&(pt=pt[1])}var bt;if(nt.test(fe.tagName))bt=1;else{var St=fe.currentStyle,rt=Me.defaultView,Xt=St?St.whiteSpace:rt&&rt.getComputedStyle?rt.getComputedStyle(fe,null).getPropertyValue("white-space"):0;bt=Xt&&Xt.substring(0,3)==="pre"}var Pt=$.linenums;(Pt=Pt==="true"||+Pt)||(Pt=Ae.match(/\blinenums\b(?::(\d+))?/),Pt=Pt?Pt[1]&&Pt[1].length?+Pt[1]:!0:!1),Pt&&q(fe,Pt,bt);var Zt={langExtension:pt,sourceNode:fe,numberLines:Pt,pre:bt,sourceCode:null,basePos:null,spans:null,decorations:null};ye(Zt)}}}et<Pe.length?k.setTimeout(ne,250):typeof Te=="function"&&Te()}ne()}var xe=k.PR={createSimpleLexer:Z,registerLangHandler:J,sourceDecorator:ce,PR_ATTRIB_NAME:R,PR_ATTRIB_VALUE:O,PR_COMMENT:_,PR_DECLARATION:f,PR_KEYWORD:b,PR_LITERAL:c,PR_NOCODE:B,PR_PLAIN:l,PR_PUNCTUATION:r,PR_SOURCE:x,PR_STRING:p,PR_TAG:v,PR_TYPE:a,prettyPrintOne:w?k.prettyPrintOne=we:I=we,prettyPrint:N=w?k.prettyPrint=Le:N=Le},Re=k.define;typeof Re=="function"&&Re.amd&&Re("google-code-prettify",[],function(){return xe})})()},TXwP:function(at,$e,z){var _e,F;(function(){var w;(function(){"use strict";var S=[,,function(A){function C(u){this.__parent=u,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}C.prototype.clone_empty=function(){var u=new C(this.__parent);return u.set_indent(this.__indent_count,this.__alignment_count),u},C.prototype.item=function(u){return u<0?this.__items[this.__items.length+u]:this.__items[u]},C.prototype.has_match=function(u){for(var o=this.__items.length-1;o>=0;o--)if(this.__items[o].match(u))return!0;return!1},C.prototype.set_indent=function(u,o){this.is_empty()&&(this.__indent_count=u||0,this.__alignment_count=o||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},C.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},C.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},C.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var u=this.__parent.current_line;return u.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),u.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),u.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,u.__items[0]===" "&&(u.__items.splice(0,1),u.__character_count-=1),!0}return!1},C.prototype.is_empty=function(){return this.__items.length===0},C.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},C.prototype.push=function(u){this.__items.push(u);var o=u.lastIndexOf(`
`);o!==-1?this.__character_count=u.length-o:this.__character_count+=u.length},C.prototype.pop=function(){var u=null;return this.is_empty()||(u=this.__items.pop(),this.__character_count-=u.length),u},C.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},C.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},C.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},C.prototype.toString=function(){var u="";return this.is_empty()?this.__parent.indent_empty_lines&&(u=this.__parent.get_indent_string(this.__indent_count)):(u=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),u+=this.__items.join("")),u};function y(u,o){this.__cache=[""],this.__indent_size=u.indent_size,this.__indent_string=u.indent_char,u.indent_with_tabs||(this.__indent_string=new Array(u.indent_size+1).join(u.indent_char)),o=o||"",u.indent_level>0&&(o=new Array(u.indent_level+1).join(this.__indent_string)),this.__base_string=o,this.__base_string_length=o.length}y.prototype.get_indent_size=function(u,o){var e=this.__base_string_length;return o=o||0,u<0&&(e=0),e+=u*this.__indent_size,e+=o,e},y.prototype.get_indent_string=function(u,o){var e=this.__base_string;return o=o||0,u<0&&(u=0,e=""),o+=u*this.__indent_size,this.__ensure_cache(o),e+=this.__cache[o],e},y.prototype.__ensure_cache=function(u){for(;u>=this.__cache.length;)this.__add_column()},y.prototype.__add_column=function(){var u=this.__cache.length,o=0,e="";this.__indent_size&&u>=this.__indent_size&&(o=Math.floor(u/this.__indent_size),u-=o*this.__indent_size,e=new Array(o+1).join(this.__indent_string)),u&&(e+=new Array(u+1).join(" ")),this.__cache.push(e)};function h(u,o){this.__indent_cache=new y(u,o),this.raw=!1,this._end_with_newline=u.end_with_newline,this.indent_size=u.indent_size,this.wrap_line_length=u.wrap_line_length,this.indent_empty_lines=u.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new C(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}h.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},h.prototype.get_line_number=function(){return this.__lines.length},h.prototype.get_indent_string=function(u,o){return this.__indent_cache.get_indent_string(u,o)},h.prototype.get_indent_size=function(u,o){return this.__indent_cache.get_indent_size(u,o)},h.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},h.prototype.add_new_line=function(u){return this.is_empty()||!u&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},h.prototype.get_code=function(u){this.trim(!0);var o=this.current_line.pop();o&&(o[o.length-1]===`
`&&(o=o.replace(/\n+$/g,"")),this.current_line.push(o)),this._end_with_newline&&this.__add_outputline();var e=this.__lines.join(`
`);return u!==`
`&&(e=e.replace(/[\n]/g,u)),e},h.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},h.prototype.set_indent=function(u,o){return u=u||0,o=o||0,this.next_line.set_indent(u,o),this.__lines.length>1?(this.current_line.set_indent(u,o),!0):(this.current_line.set_indent(),!1)},h.prototype.add_raw_token=function(u){for(var o=0;o<u.newlines;o++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(u.whitespace_before),this.current_line.push(u.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},h.prototype.add_token=function(u){this.__add_space_before_token(),this.current_line.push(u),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},h.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},h.prototype.remove_indent=function(u){for(var o=this.__lines.length;u<o;)this.__lines[u]._remove_indent(),u++;this.current_line._remove_wrap_indent()},h.prototype.trim=function(u){for(u=u===void 0?!1:u,this.current_line.trim();u&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},h.prototype.just_added_newline=function(){return this.current_line.is_empty()},h.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},h.prototype.ensure_empty_line_above=function(u,o){for(var e=this.__lines.length-2;e>=0;){var d=this.__lines[e];if(d.is_empty())break;if(d.item(0).indexOf(u)!==0&&d.item(-1)!==o){this.__lines.splice(e+1,0,new C(this)),this.previous_line=this.__lines[this.__lines.length-2];break}e--}},A.exports.Output=h},,,,function(A){function C(u,o){this.raw_options=y(u,o),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}C.prototype._get_array=function(u,o){var e=this.raw_options[u],d=o||[];return typeof e=="object"?e!==null&&typeof e.concat=="function"&&(d=e.concat()):typeof e=="string"&&(d=e.split(/[^a-zA-Z0-9_\/\-]+/)),d},C.prototype._get_boolean=function(u,o){var e=this.raw_options[u],d=e===void 0?!!o:!!e;return d},C.prototype._get_characters=function(u,o){var e=this.raw_options[u],d=o||"";return typeof e=="string"&&(d=e.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),d},C.prototype._get_number=function(u,o){var e=this.raw_options[u];o=parseInt(o,10),isNaN(o)&&(o=0);var d=parseInt(e,10);return isNaN(d)&&(d=o),d},C.prototype._get_selection=function(u,o,e){var d=this._get_selection_list(u,o,e);if(d.length!==1)throw new Error("Invalid Option Value: The option '"+u+`' can only be one of the following values:
`+o+`
You passed in: '`+this.raw_options[u]+"'");return d[0]},C.prototype._get_selection_list=function(u,o,e){if(!o||o.length===0)throw new Error("Selection list cannot be empty.");if(e=e||[o[0]],!this._is_valid_selection(e,o))throw new Error("Invalid Default Value!");var d=this._get_array(u,e);if(!this._is_valid_selection(d,o))throw new Error("Invalid Option Value: The option '"+u+`' can contain only the following values:
`+o+`
You passed in: '`+this.raw_options[u]+"'");return d},C.prototype._is_valid_selection=function(u,o){return u.length&&o.length&&!u.some(function(e){return o.indexOf(e)===-1})};function y(u,o){var e={};u=h(u);var d;for(d in u)d!==o&&(e[d]=u[d]);if(o&&u[o])for(d in u[o])e[d]=u[o][d];return e}function h(u){var o={},e;for(e in u){var d=e.replace(/-/g,"_");o[d]=u[e]}return o}A.exports.Options=C,A.exports.normalizeOpts=h,A.exports.mergeOpts=y},,function(A){var C=RegExp.prototype.hasOwnProperty("sticky");function y(h){this.__input=h||"",this.__input_length=this.__input.length,this.__position=0}y.prototype.restart=function(){this.__position=0},y.prototype.back=function(){this.__position>0&&(this.__position-=1)},y.prototype.hasNext=function(){return this.__position<this.__input_length},y.prototype.next=function(){var h=null;return this.hasNext()&&(h=this.__input.charAt(this.__position),this.__position+=1),h},y.prototype.peek=function(h){var u=null;return h=h||0,h+=this.__position,h>=0&&h<this.__input_length&&(u=this.__input.charAt(h)),u},y.prototype.__match=function(h,u){h.lastIndex=u;var o=h.exec(this.__input);return o&&!(C&&h.sticky)&&(o.index!==u&&(o=null)),o},y.prototype.test=function(h,u){return u=u||0,u+=this.__position,u>=0&&u<this.__input_length?!!this.__match(h,u):!1},y.prototype.testChar=function(h,u){var o=this.peek(u);return h.lastIndex=0,o!==null&&h.test(o)},y.prototype.match=function(h){var u=this.__match(h,this.__position);return u?this.__position+=u[0].length:u=null,u},y.prototype.read=function(h,u,o){var e="",d;return h&&(d=this.match(h),d&&(e+=d[0])),u&&(d||!h)&&(e+=this.readUntil(u,o)),e},y.prototype.readUntil=function(h,u){var o="",e=this.__position;h.lastIndex=this.__position;var d=h.exec(this.__input);return d?(e=d.index,u&&(e+=d[0].length)):e=this.__input_length,o=this.__input.substring(this.__position,e),this.__position=e,o},y.prototype.readUntilAfter=function(h){return this.readUntil(h,!0)},y.prototype.get_regexp=function(h,u){var o=null,e="g";return u&&C&&(e="y"),typeof h=="string"&&h!==""?o=new RegExp(h,e):h&&(o=new RegExp(h.source,e)),o},y.prototype.get_literal_regexp=function(h){return RegExp(h.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},y.prototype.peekUntilAfter=function(h){var u=this.__position,o=this.readUntilAfter(h);return this.__position=u,o},y.prototype.lookBack=function(h){var u=this.__position-1;return u>=h.length&&this.__input.substring(u-h.length,u).toLowerCase()===h},A.exports.InputScanner=y},,,,,function(A){function C(y,h){y=typeof y=="string"?y:y.source,h=typeof h=="string"?h:h.source,this.__directives_block_pattern=new RegExp(y+/ beautify( \w+[:]\w+)+ /.source+h,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(y+/\sbeautify\signore:end\s/.source+h,"g")}C.prototype.get_directives=function(y){if(!y.match(this.__directives_block_pattern))return null;var h={};this.__directive_pattern.lastIndex=0;for(var u=this.__directive_pattern.exec(y);u;)h[u[1]]=u[2],u=this.__directive_pattern.exec(y);return h},C.prototype.readIgnored=function(y){return y.readUntilAfter(this.__directives_end_ignore_pattern)},A.exports.Directives=C},,function(A,C,y){var h=y(16).Beautifier,u=y(17).Options;function o(e,d){var s=new h(e,d);return s.beautify()}A.exports=o,A.exports.defaultOptions=function(){return new u}},function(A,C,y){var h=y(17).Options,u=y(2).Output,o=y(8).InputScanner,e=y(13).Directives,d=new e(/\/\*/,/\*\//),s=/\r\n|[\r\n]/,t=/\r\n|[\r\n]/g,i=/\s/,n=/(?:\s|\n)+/g,T=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,m=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function p(b,_){this._source_text=b||"",this._options=new h(_),this._ch=null,this._input=null,this.NESTED_AT_RULE={"@page":!0,"@font-face":!0,"@keyframes":!0,"@media":!0,"@supports":!0,"@document":!0},this.CONDITIONAL_GROUP_RULE={"@media":!0,"@supports":!0,"@document":!0},this.NON_SEMICOLON_NEWLINE_PROPERTY=["grid-template-areas","grid-template"]}p.prototype.eatString=function(b){var _="";for(this._ch=this._input.next();this._ch;){if(_+=this._ch,this._ch==="\\")_+=this._input.next();else if(b.indexOf(this._ch)!==-1||this._ch===`
`)break;this._ch=this._input.next()}return _},p.prototype.eatWhitespace=function(b){for(var _=i.test(this._input.peek()),a=0;i.test(this._input.peek());)this._ch=this._input.next(),b&&this._ch===`
`&&((a===0||a<this._options.max_preserve_newlines)&&(a++,this._output.add_new_line(!0)));return _},p.prototype.foundNestedPseudoClass=function(){for(var b=0,_=1,a=this._input.peek(_);a;){if(a==="{")return!0;if(a==="(")b+=1;else if(a===")"){if(b===0)return!1;b-=1}else if(a===";"||a==="}")return!1;_++,a=this._input.peek(_)}return!1},p.prototype.print_string=function(b){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(b)},p.prototype.preserveSingleSpace=function(b){b&&(this._output.space_before_token=!0)},p.prototype.indent=function(){this._indentLevel++},p.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},p.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var b=this._source_text,_=this._options.eol;_==="auto"&&(_=`
`,b&&s.test(b||"")&&(_=b.match(s)[0])),b=b.replace(t,`
`);var a=b.match(/^[\t ]*/)[0];this._output=new u(this._options,a),this._input=new o(b),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var c=0,r=!1,l=!1,v=!1,f=!1,x=!1,R=!1,O=this._ch,B=!1,j,K,L;j=this._input.read(n),K=j!=="",L=O,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),O=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var H=this._input.read(T),Y=d.get_directives(H);Y&&Y.ignore==="start"&&(H+=d.readIgnored(this._input)),this.print_string(H),this.eatWhitespace(!0),this._output.add_new_line()}else if(this._ch==="/"&&this._input.peek()==="/")this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(m)),this.eatWhitespace(!0);else if(this._ch==="@"||this._ch==="$")if(this.preserveSingleSpace(K),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var ae=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);ae.match(/[ :]$/)&&(ae=this.eatString(": ").replace(/\s$/,""),this.print_string(ae),this._output.space_before_token=!0),ae=ae.replace(/\s$/,""),ae==="extend"?f=!0:ae==="import"&&(x=!0),ae in this.NESTED_AT_RULE?(this._nestedLevel+=1,ae in this.CONDITIONAL_GROUP_RULE&&(v=!0)):!r&&c===0&&ae.indexOf(":")!==-1&&(l=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(K),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")l&&(l=!1,this.outdent()),v?(v=!1,r=this._indentLevel>=this._nestedLevel):r=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&r&&(this._output.previous_line&&this._output.previous_line.item(-1)!=="{"&&this._output.ensure_empty_line_above("/",",")),this._output.space_before_token=!0,this._options.brace_style==="expand"?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(L==="("?this._output.space_before_token=!1:L!==","&&this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line();else if(this._ch==="}")this.outdent(),this._output.add_new_line(),L==="{"&&this._output.trim(!0),x=!1,f=!1,l&&(this.outdent(),l=!1),this.print_string(this._ch),r=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&(this._input.peek()!=="}"&&this._output.add_new_line(!0)),this._input.peek()===")"&&(this._output.trim(!0),this._options.brace_style==="expand"&&this._output.add_new_line(!0));else if(this._ch===":"){for(var Z=0;Z<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;Z++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[Z])){B=!0;break}(r||v)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!f&&c===0?(this.print_string(":"),l||(l=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var ce=L==='"'||L==="'";this.preserveSingleSpace(ce||K),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")B=!1,c===0?(l&&(this.outdent(),l=!1),f=!1,x=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),c++,this.indent(),this._ch=this._input.next(),this._ch===")"||this._ch==='"'||this._ch==="'"?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),c&&(c--,this.outdent()));else{var de=!1;this._input.lookBack("with")&&(de=!0),this.preserveSingleSpace(K||de),this.print_string(this._ch),l&&L==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),R=!0):(this.eatWhitespace(),c++,this.indent())}else if(this._ch===")")c&&(c--,this.outdent()),R&&this._input.peek()===";"&&this._options.selector_separator_newline&&(R=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!l||R)&&c===0&&!x&&!f?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!l&&c===0)this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&i.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(K),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),i.test(this._ch)&&(this._ch="");else if(this._ch==="!"&&!this._input.lookBack("\\"))this._output.space_before_token=!0,this.print_string(this._ch);else{var q=L==='"'||L==="'";this.preserveSingleSpace(q||K),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
`&&B&&this._output.add_new_line()}var te=this._output.get_code(_);return te},A.exports.Beautifier=p},function(A,C,y){var h=y(6).Options;function u(o){h.call(this,o,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var e=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||e;var d=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var s=0;s<d.length;s++)d[s]!=="expand"?this.brace_style="collapse":this.brace_style=d[s]}u.prototype=new h,A.exports.Options=u}],I={};function N(A){var C=I[A];if(C!==void 0)return C.exports;var y=I[A]={exports:{}};return S[A](y,y.exports,N),y.exports}var k=N(15);w=k})();var U=w;!(_e=[],F=function(){return{css_beautify:U}}.apply($e,_e),F!==void 0&&(at.exports=F))})()},WaYH:function(at,$e,z){"use strict";var _e=z("rePB"),F=z("Ff2n"),w=z("VTBJ"),U=z("1OyB"),S=z("vuIU"),I=z("JX7q"),N=z("Ji7U"),k=z("LK+K"),A=z("q1tI"),C=z("TSYQ"),y=z.n(C),h=z("sboe"),u=z("OZM5"),o=function(b){var _=b.prefixCls,a=b.level,c=b.isStart,r=b.isEnd;if(!a)return null;for(var l="".concat(_,"-indent-unit"),v=[],f=0;f<a;f+=1){var x;v.push(A.createElement("span",{key:f,className:y()(l,(x={},Object(_e.a)(x,"".concat(l,"-start"),c[f+1]),Object(_e.a)(x,"".concat(l,"-end"),r[f+1]),Object(_e.a)(x,"".concat(l,"-end-first-level"),!f&&r[0]),x))}))}return A.createElement("span",{"aria-hidden":"true",className:"".concat(_,"-indent")},v)},e=o,d=z("815F"),s="open",t="close",i="---",n=function(p){Object(N.a)(_,p);var b=Object(k.a)(_);function _(){var a;return Object(U.a)(this,_),a=b.apply(this,arguments),a.state={dragNodeHighlight:!1},a.onSelectorClick=function(c){var r=a.props.context.onNodeClick;r(c,Object(d.b)(a.props)),a.isSelectable()?a.onSelect(c):a.onCheck(c)},a.onSelectorDoubleClick=function(c){var r=a.props.context.onNodeDoubleClick;r(c,Object(d.b)(a.props))},a.onSelect=function(c){if(a.isDisabled())return;var r=a.props.context.onNodeSelect;c.preventDefault(),r(c,Object(d.b)(a.props))},a.onCheck=function(c){if(a.isDisabled())return;var r=a.props,l=r.disableCheckbox,v=r.checked,f=a.props.context.onNodeCheck;if(!a.isCheckable()||l)return;c.preventDefault();var x=!v;f(c,Object(d.b)(a.props),x)},a.onMouseEnter=function(c){var r=a.props.context.onNodeMouseEnter;r(c,Object(d.b)(a.props))},a.onMouseLeave=function(c){var r=a.props.context.onNodeMouseLeave;r(c,Object(d.b)(a.props))},a.onContextMenu=function(c){var r=a.props.context.onNodeContextMenu;r(c,Object(d.b)(a.props))},a.onDragStart=function(c){var r=a.props.context.onNodeDragStart;c.stopPropagation(),a.setState({dragNodeHighlight:!0}),r(c,Object(I.a)(a));try{c.dataTransfer.setData("text/plain","")}catch(l){}},a.onDragEnter=function(c){var r=a.props.context.onNodeDragEnter;c.preventDefault(),c.stopPropagation(),r(c,Object(I.a)(a))},a.onDragOver=function(c){var r=a.props.context.onNodeDragOver;c.preventDefault(),c.stopPropagation(),r(c,Object(I.a)(a))},a.onDragLeave=function(c){var r=a.props.context.onNodeDragLeave;c.stopPropagation(),r(c,Object(I.a)(a))},a.onDragEnd=function(c){var r=a.props.context.onNodeDragEnd;c.stopPropagation(),a.setState({dragNodeHighlight:!1}),r(c,Object(I.a)(a))},a.onDrop=function(c){var r=a.props.context.onNodeDrop;c.preventDefault(),c.stopPropagation(),a.setState({dragNodeHighlight:!1}),r(c,Object(I.a)(a))},a.onExpand=function(c){var r=a.props.context.onNodeExpand;r(c,Object(d.b)(a.props))},a.setSelectHandle=function(c){a.selectHandle=c},a.getNodeState=function(){var c=a.props.expanded;return a.isLeaf()?null:c?s:t},a.hasChildren=function(){var c=a.props.eventKey,r=a.props.context.keyEntities,l=r[c]||{},v=l.children;return!!(v||[]).length},a.isLeaf=function(){var c=a.props,r=c.isLeaf,l=c.loaded,v=a.props.context.loadData,f=a.hasChildren();return r===!1?!1:r||!v&&!f||v&&l&&!f},a.isDisabled=function(){var c=a.props.disabled,r=a.props.context.disabled;return!!(r||c)},a.isCheckable=function(){var c=a.props.checkable,r=a.props.context.checkable;return!r||c===!1?!1:r},a.syncLoadData=function(c){var r=c.expanded,l=c.loading,v=c.loaded,f=a.props.context,x=f.loadData,R=f.onNodeLoad;if(l)return;x&&r&&!a.isLeaf()&&(!a.hasChildren()&&!v&&R(Object(d.b)(a.props)))},a.renderSwitcher=function(){var c=a.props,r=c.expanded,l=c.switcherIcon,v=a.props.context,f=v.prefixCls,x=v.switcherIcon,R=l||x;if(a.isLeaf())return A.createElement("span",{className:y()("".concat(f,"-switcher"),"".concat(f,"-switcher-noop"))},typeof R=="function"?R(Object(w.a)(Object(w.a)({},a.props),{},{isLeaf:!0})):R);var O=y()("".concat(f,"-switcher"),"".concat(f,"-switcher_").concat(r?s:t));return A.createElement("span",{onClick:a.onExpand,className:O},typeof R=="function"?R(Object(w.a)(Object(w.a)({},a.props),{},{isLeaf:!1})):R)},a.renderCheckbox=function(){var c=a.props,r=c.checked,l=c.halfChecked,v=c.disableCheckbox,f=a.props.context.prefixCls,x=a.isDisabled(),R=a.isCheckable();if(!R)return null;var O=typeof R!="boolean"?R:null;return A.createElement("span",{className:y()("".concat(f,"-checkbox"),r&&"".concat(f,"-checkbox-checked"),!r&&l&&"".concat(f,"-checkbox-indeterminate"),(x||v)&&"".concat(f,"-checkbox-disabled")),onClick:a.onCheck},O)},a.renderIcon=function(){var c=a.props.loading,r=a.props.context.prefixCls;return A.createElement("span",{className:y()("".concat(r,"-iconEle"),"".concat(r,"-icon__").concat(a.getNodeState()||"docu"),c&&"".concat(r,"-icon_loading"))})},a.renderSelector=function(){var c=a.state.dragNodeHighlight,r=a.props,l=r.title,v=r.selected,f=r.icon,x=r.loading,R=r.data,O=a.props.context,B=O.prefixCls,j=O.showIcon,K=O.icon,L=O.draggable,H=O.loadData,Y=O.titleRender,ae=a.isDisabled(),Z="".concat(B,"-node-content-wrapper"),ce;if(j){var de=f||K;ce=de?A.createElement("span",{className:y()("".concat(B,"-iconEle"),"".concat(B,"-icon__customize"))},typeof de=="function"?de(a.props):de):a.renderIcon()}else H&&x&&(ce=a.renderIcon());var q;typeof l=="function"?q=l(R):Y?q=Y(R):q=l;var te=A.createElement("span",{className:"".concat(B,"-title")},q);return A.createElement("span",{ref:a.setSelectHandle,title:typeof l=="string"?l:"",className:y()("".concat(Z),"".concat(Z,"-").concat(a.getNodeState()||"normal"),!ae&&(v||c)&&"".concat(B,"-node-selected"),!ae&&L&&"draggable"),draggable:!ae&&L||void 0,"aria-grabbed":!ae&&L||void 0,onMouseEnter:a.onMouseEnter,onMouseLeave:a.onMouseLeave,onContextMenu:a.onContextMenu,onClick:a.onSelectorClick,onDoubleClick:a.onSelectorDoubleClick,onDragStart:L?a.onDragStart:void 0},ce,te)},a}return Object(S.a)(_,[{key:"componentDidMount",value:function(){this.syncLoadData(this.props)}},{key:"componentDidUpdate",value:function(){this.syncLoadData(this.props)}},{key:"isSelectable",value:function(){var c=this.props.selectable,r=this.props.context.selectable;return typeof c=="boolean"?c:r}},{key:"render",value:function(){var c,r=this.props,l=r.eventKey,v=r.className,f=r.style,x=r.dragOver,R=r.dragOverGapTop,O=r.dragOverGapBottom,B=r.isLeaf,j=r.isStart,K=r.isEnd,L=r.expanded,H=r.selected,Y=r.checked,ae=r.halfChecked,Z=r.loading,ce=r.domRef,de=r.active,q=r.onMouseMove,te=Object(F.a)(r,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),he=this.props.context,J=he.prefixCls,X=he.filterTreeNode,ye=he.draggable,we=he.keyEntities,Le=this.isDisabled(),xe=Object(u.f)(te),Re=we[l]||{},Te=Re.level,Oe=K[K.length-1];return A.createElement("div",Object.assign({ref:ce,className:y()(v,"".concat(J,"-treenode"),(c={},Object(_e.a)(c,"".concat(J,"-treenode-disabled"),Le),Object(_e.a)(c,"".concat(J,"-treenode-switcher-").concat(L?"open":"close"),!B),Object(_e.a)(c,"".concat(J,"-treenode-checkbox-checked"),Y),Object(_e.a)(c,"".concat(J,"-treenode-checkbox-indeterminate"),ae),Object(_e.a)(c,"".concat(J,"-treenode-selected"),H),Object(_e.a)(c,"".concat(J,"-treenode-loading"),Z),Object(_e.a)(c,"".concat(J,"-treenode-active"),de),Object(_e.a)(c,"".concat(J,"-treenode-leaf-last"),Oe),Object(_e.a)(c,"drag-over",!Le&&x),Object(_e.a)(c,"drag-over-gap-top",!Le&&R),Object(_e.a)(c,"drag-over-gap-bottom",!Le&&O),Object(_e.a)(c,"filter-node",X&&X(Object(d.b)(this.props))),c)),style:f,onDragEnter:ye?this.onDragEnter:void 0,onDragOver:ye?this.onDragOver:void 0,onDragLeave:ye?this.onDragLeave:void 0,onDrop:ye?this.onDrop:void 0,onDragEnd:ye?this.onDragEnd:void 0,onMouseMove:q},xe),A.createElement(e,{prefixCls:J,level:Te,isStart:j,isEnd:K}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),_}(A.Component),T=function(b){return A.createElement(h.a.Consumer,null,function(_){return A.createElement(n,Object.assign({},b,{context:_}))})};T.displayName="TreeNode",T.defaultProps={title:i},T.isTreeNode=1;var m=$e.a=T},Y1PL:function(at,$e,z){"use strict";z.r($e),z.d($e,"ResizableTextArea",function(){return ae});var _e=z("wx14"),F=z("1OyB"),w=z("vuIU"),U=z("Ji7U"),S=z("LK+K"),I=z("q1tI"),N=z("VTBJ"),k=z("rePB"),A=z("Zm9Q"),C=z("Kwbf"),y=z("c+Xe"),h=z("m+aA"),u=z("bdgK"),o=new Map;function e(de){de.forEach(function(q){var te,he=q.target;(te=o.get(he))===null||te===void 0||te.forEach(function(J){return J(he)})})}var d=new u.default(e),s=null,t=null;function i(de,q){o.has(de)||(o.set(de,new Set),d.observe(de)),o.get(de).add(q)}function n(de,q){o.has(de)&&(o.get(de).delete(q),o.get(de).size||(d.unobserve(de),o.delete(de)))}var T=function(de){Object(U.a)(te,de);var q=Object(S.a)(te);function te(){return Object(F.a)(this,te),q.apply(this,arguments)}return Object(w.a)(te,[{key:"render",value:function(){return this.props.children}}]),te}(I.Component),m=I.createContext(null);function p(de){var q=de.children,te=de.onBatchResize,he=I.useRef(0),J=I.useRef([]),X=I.useContext(m),ye=I.useCallback(function(we,Le,xe){he.current+=1;var Re=he.current;J.current.push({size:we,element:Le,data:xe}),Promise.resolve().then(function(){Re===he.current&&(te==null||te(J.current),J.current=[])}),X==null||X(we,Le,xe)},[te,X]);return I.createElement(m.Provider,{value:ye},q)}function b(de){var q=de.children,te=de.disabled,he=I.useRef(null),J=I.useRef(null),X=I.useContext(m),ye=I.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),we=I.isValidElement(q)&&Object(y.c)(q),Le=we?q.ref:null,xe=I.useMemo(function(){return Object(y.a)(Le,he)},[Le,he]),Re=I.useRef(de);Re.current=de;var Te=I.useCallback(function(Oe){var Ie=Re.current,Me=Ie.onResize,Ne=Ie.data,Be=Oe.getBoundingClientRect(),Pe=Be.width,Ye=Be.height,Ke=Oe.offsetWidth,Se=Oe.offsetHeight,je=Math.floor(Pe),et=Math.floor(Ye);if(ye.current.width!==je||ye.current.height!==et||ye.current.offsetWidth!==Ke||ye.current.offsetHeight!==Se){var Je={width:je,height:et,offsetWidth:Ke,offsetHeight:Se};ye.current=Je;var Ze=Ke===Math.round(Pe)?Pe:Ke,We=Se===Math.round(Ye)?Ye:Se,nt=Object(N.a)(Object(N.a)({},Je),{},{offsetWidth:Ze,offsetHeight:We});X==null||X(nt,Oe,Ne),Me&&Promise.resolve().then(function(){Me(nt,Oe)})}},[]);return I.useEffect(function(){var Oe=Object(h.a)(he.current)||Object(h.a)(J.current);return Oe&&!te&&i(Oe,Te),function(){return n(Oe,Te)}},[he.current,te]),I.createElement(T,{ref:J},we?I.cloneElement(q,{ref:xe}):q)}var _="rc-observer-key";function a(de){var q=de.children,te=Object(A.a)(q);return te.map(function(he,J){var X=(he==null?void 0:he.key)||"".concat(_,"-").concat(J);return I.createElement(b,Object(_e.a)({},de,{key:X}),he)})}a.Collection=p;var c=a,r=z("bT9E"),l=z("TSYQ"),v=z.n(l),f=`
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"],R={},O;function B(de){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,te=de.getAttribute("id")||de.getAttribute("data-reactid")||de.getAttribute("name");if(q&&R[te])return R[te];var he=window.getComputedStyle(de),J=he.getPropertyValue("box-sizing")||he.getPropertyValue("-moz-box-sizing")||he.getPropertyValue("-webkit-box-sizing"),X=parseFloat(he.getPropertyValue("padding-bottom"))+parseFloat(he.getPropertyValue("padding-top")),ye=parseFloat(he.getPropertyValue("border-bottom-width"))+parseFloat(he.getPropertyValue("border-top-width")),we=x.map(function(xe){return"".concat(xe,":").concat(he.getPropertyValue(xe))}).join(";"),Le={sizingStyle:we,paddingSize:X,borderSize:ye,boxSizing:J};return q&&te&&(R[te]=Le),Le}function j(de){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,he=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;O||(O=document.createElement("textarea"),O.setAttribute("tab-index","-1"),O.setAttribute("aria-hidden","true"),document.body.appendChild(O)),de.getAttribute("wrap")?O.setAttribute("wrap",de.getAttribute("wrap")):O.removeAttribute("wrap");var J=B(de,q),X=J.paddingSize,ye=J.borderSize,we=J.boxSizing,Le=J.sizingStyle;O.setAttribute("style","".concat(Le,";").concat(f)),O.value=de.value||de.placeholder||"";var xe=Number.MIN_SAFE_INTEGER,Re=Number.MAX_SAFE_INTEGER,Te=O.scrollHeight,Oe;if(we==="border-box"?Te+=ye:we==="content-box"&&(Te-=X),te!==null||he!==null){O.value=" ";var Ie=O.scrollHeight-X;te!==null&&(xe=Ie*te,we==="border-box"&&(xe=xe+X+ye),Te=Math.max(xe,Te)),he!==null&&(Re=Ie*he,we==="border-box"&&(Re=Re+X+ye),Oe=Te>Re?"":"hidden",Te=Math.min(Re,Te))}return{height:Te,minHeight:xe,maxHeight:Re,overflowY:Oe,resize:"none"}}var K=z("Gytx"),L=z.n(K),H;(function(de){de[de.NONE=0]="NONE",de[de.RESIZING=1]="RESIZING",de[de.RESIZED=2]="RESIZED"})(H||(H={}));var Y=function(de){Object(U.a)(te,de);var q=Object(S.a)(te);function te(he){var J;return Object(F.a)(this,te),J=q.call(this,he),J.nextFrameActionId=void 0,J.resizeFrameId=void 0,J.textArea=void 0,J.saveTextArea=function(X){J.textArea=X},J.handleResize=function(X){var ye=J.state.resizeStatus,we=J.props,Le=we.autoSize,xe=we.onResize;if(ye!==H.NONE)return;typeof xe=="function"&&xe(X),Le&&J.resizeOnNextFrame()},J.resizeOnNextFrame=function(){cancelAnimationFrame(J.nextFrameActionId),J.nextFrameActionId=requestAnimationFrame(J.resizeTextarea)},J.resizeTextarea=function(){var X=J.props.autoSize;if(!X||!J.textArea)return;var ye=X.minRows,we=X.maxRows,Le=j(J.textArea,!1,ye,we);J.setState({textareaStyles:Le,resizeStatus:H.RESIZING},function(){cancelAnimationFrame(J.resizeFrameId),J.resizeFrameId=requestAnimationFrame(function(){J.setState({resizeStatus:H.RESIZED},function(){J.resizeFrameId=requestAnimationFrame(function(){J.setState({resizeStatus:H.NONE}),J.fixFirefoxAutoScroll()})})})})},J.renderTextArea=function(){var X=J.props,ye=X.prefixCls,we=ye===void 0?"rc-textarea":ye,Le=X.autoSize,xe=X.onResize,Re=X.className,Te=X.disabled,Oe=J.state,Ie=Oe.textareaStyles,Me=Oe.resizeStatus,Ne=Object(r.a)(J.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Be=v()(we,Re,Object(k.a)({},"".concat(we,"-disabled"),Te));"value"in Ne&&(Ne.value=Ne.value||"");var Pe=Object(N.a)(Object(N.a)(Object(N.a)({},J.props.style),Ie),Me===H.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return I.createElement(c,{onResize:J.handleResize,disabled:!(Le||xe)},I.createElement("textarea",Object(_e.a)({},Ne,{className:Be,style:Pe,ref:J.saveTextArea})))},J.state={textareaStyles:{},resizeStatus:H.NONE},J}return Object(w.a)(te,[{key:"componentDidUpdate",value:function(J){(J.value!==this.props.value||!L()(J.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 J=this.textArea.selectionStart,X=this.textArea.selectionEnd;this.textArea.setSelectionRange(J,X)}}catch(ye){}}},{key:"render",value:function(){return this.renderTextArea()}}]),te}(I.Component),ae=Y,Z=function(de){Object(U.a)(te,de);var q=Object(S.a)(te);function te(he){var J;Object(F.a)(this,te),J=q.call(this,he),J.resizableTextArea=void 0,J.focus=function(){J.resizableTextArea.textArea.focus()},J.saveTextArea=function(ye){J.resizableTextArea=ye},J.handleChange=function(ye){var we=J.props.onChange;J.setValue(ye.target.value,function(){J.resizableTextArea.resizeTextarea()}),we&&we(ye)},J.handleKeyDown=function(ye){var we=J.props,Le=we.onPressEnter,xe=we.onKeyDown;ye.keyCode===13&&Le&&Le(ye),xe&&xe(ye)};var X=typeof he.value=="undefined"||he.value===null?he.defaultValue:he.value;return J.state={value:X},J}return Object(w.a)(te,[{key:"setValue",value:function(J,X){"value"in this.props||this.setState({value:J},X)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return I.createElement(ae,Object(_e.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(J){return"value"in J?{value:J.value}:null}}]),te}(I.Component),ce=$e.default=Z},ZW9T:function(at,$e,z){"use strict";z.d($e,"a",function(){return j});var _e=z("k1fw"),F=z("miYZ"),w=z("tsqr"),U=z("rAM+"),S=z("tJVT"),I=z("PpiC"),N=z("q1tI"),k=z.n(N),A=z("bdgK"),C=z("oBTY"),y=z("9og8"),h=z("WmNS"),u=z.n(h),o={keywords:["print","auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while"]},e={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},d={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","for","friend","gcnew","generic","goto","if","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`)},{label:"#include",content:'include "$0"'},{label:"printf",content:"printf($0)"},{label:"main",content:["int main () {"," $0","}"].join(`
`)},{label:"for",content:["for( ; ; ){"," $0","}"].join(`
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
`)},{label:"#include <iostream>",content:["#include <iostream>"].join(`
`)},{label:"#include <vector>",content:["#include <vector>"].join(`
`)},{label:"#include <sstream>",content:["#include <sstream>"].join(`
`)},{label:"#include <string>",content:["#include <string>"].join(`
`)},{label:"#include <cmath>",content:["#include <cmath>"].join(`
`)}]},s={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
`)}]},t=z("5VLF"),i=z.n(t),n={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},T=function(L,H){return H.map(function(Y){return{label:Y,kind:L.languages.CompletionItemKind.Keyword,insertText:Y}})},m=function(L){return Object.keys(n.tables).map(function(H){return{label:H,kind:L.languages.CompletionItemKind.Variable,insertText:H}})},p=function(L,H){var Y=n.tables[L];return Y?Y.map(function(ae){return{label:ae,kind:H.languages.CompletionItemKind.Field,insertText:ae}}):[]};function b(K,L,H,Y,ae){var Z=L.getWordUntilPosition(H),ce={startLineNumber:H.lineNumber,endLineNumber:H.lineNumber,startColumn:Z.startColumn,endColumn:Z.endColumn},de=Y.map(function(q){return{label:q,kind:K.languages.CompletionItemKind.Keyword,insertText:q,insertTextRules:K.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:ce}});return ae.map(function(q){de.push(Object(_e.a)(Object(_e.a)({},q),{},{range:ce}))}),de}var _=function(K){n.languages.map(function(ae){return K.languages.registerDocumentFormattingEditProvider(ae,{provideDocumentFormattingEdits:function(ce,de,q){return Object(y.a)(u.a.mark(function te(){var he;return u.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return he=i()(ce.getValue(),{indent_size:"2",indent_char:" ",max_preserve_newlines:"2",preserve_newlines:!0,keep_array_indentation:!0,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:"0",indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1}),X.abrupt("return",[{range:ce.getFullModelRange(),text:he}]);case 2:case"end":return X.stop()}},te)}))()}}),ae});var L=d.quickKey.map(function(ae){return{label:ae.label,kind:K.languages.CompletionItemKind.Method,insertText:ae.content,insertTextRules:K.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),H=s.quickKey.map(function(ae){return{label:ae.label,kind:K.languages.CompletionItemKind.Method,insertText:ae.content,insertTextRules:K.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),Y=e.quickKey.map(function(ae){return{label:ae.label,kind:K.languages.CompletionItemKind.Method,insertText:ae.content,insertTextRules:K.languages.CompletionItemInsertTextRule.InsertAsSnippet}});K.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["."," ","#"].concat(Object(C.a)(d.keywords),Object(C.a)(d.quickKey.map(function(ae){return ae.label}))),provideCompletionItems:function(Z,ce){var de=Z.getValueInRange({startLineNumber:ce.lineNumber,startColumn:1,endLineNumber:ce.lineNumber,endColumn:ce.column}),q=de.match(/cu/gim);console.log("match:",q,ce,de,Z);var te=[],he=ce.lineNumber,J=ce.column,X=Z.getValueInRange({startLineNumber:he,startColumn:0,endLineNumber:he,endColumn:J}),ye=X.trim().split(/\s+/),we=ye[ye.length-1];if(we.endsWith(".")){var Le=we.slice(0,we.length-1);Object.keys(n.tables).includes(Le)&&(te=Object(C.a)(p(Le,K)))}else we==="."?te=[]:te=[].concat(Object(C.a)(m(K)),Object(C.a)(T(K,d.keywords)),Object(C.a)(L));return{suggestions:te}}}),K.languages.registerCompletionItemProvider("c",{triggerCharacters:["."," ","#"].concat(Object(C.a)(o.keywords)),provideCompletionItems:function(Z,ce){var de=Z.getValueInRange({startLineNumber:ce.lineNumber,startColumn:1,endLineNumber:ce.lineNumber,endColumn:ce.column}),q=de.match(/cu/gim);console.log("match:",q,ce,de,Z);var te=[],he=ce.lineNumber,J=ce.column,X=Z.getValueInRange({startLineNumber:he,startColumn:0,endLineNumber:he,endColumn:J}),ye=X.trim().split(/\s+/),we=ye[ye.length-1];if(we.endsWith(".")){var Le=we.slice(0,we.length-1);Object.keys(n.tables).includes(Le)&&(te=Object(C.a)(p(Le,K)))}else we==="."?te=[]:te=[].concat(Object(C.a)(m(K)),Object(C.a)(T(K,o.keywords)));return{suggestions:te}}}),K.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," "].concat(Object(C.a)(e.keywords)),provideCompletionItems:function(Z,ce){var de=[],q=ce.lineNumber,te=ce.column,he=Z.getValueInRange({startLineNumber:q,startColumn:0,endLineNumber:q,endColumn:te}),J=he.trim().split(/\s+/),X=J[J.length-1];if(X.endsWith(".")){var ye=X.slice(0,X.length-1);Object.keys(n.tables).includes(ye)&&(de=Object(C.a)(p(ye,K)))}else X==="."?de=[]:de=[].concat(Object(C.a)(m(K)),Object(C.a)(T(K,e.keywords)),Object(C.a)(Y));return{suggestions:de}}}),K.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "].concat(Object(C.a)(s.keywords)),provideCompletionItems:function(Z,ce){var de=[],q=ce.lineNumber,te=ce.column,he=Z.getValueInRange({startLineNumber:q,startColumn:0,endLineNumber:q,endColumn:te}),J=he.trim().split(/\s+/),X=J[J.length-1];if(X.endsWith(".")){var ye=X.slice(0,X.length-1);Object.keys(n.tables).includes(ye)&&(de=Object(C.a)(p(ye,K)))}else X==="."?de=[]:de=[].concat(Object(C.a)(m(K)),Object(C.a)(T(K,s.keywords)),Object(C.a)(H));return{suggestions:de}}})},a="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",c=z("LvDl"),r=z("+ua5");function l(K){return/^\d+$/.test(K)?"".concat(K,"px"):K}function v(){}var f=!1,x={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function R(){var K=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],L=K;if(Array.isArray(K)){for(var H=0;H<K.length;H++){var Y=x[K[H]];if(Y)return Y}return L[0]}return x[L]||L}var O=null,B=$e.b=function(K){var L=K.width,H=L===void 0?"100%":L,Y=K.height,ae=Y===void 0?"100%":Y,Z=K.value,ce=K.language,de=ce===void 0?"javascript":ce,q=K.style,te=q===void 0?{}:q,he=K.options,J=he===void 0?{}:he,X=K.overrideServices,ye=X===void 0?{}:X,we=K.theme,Le=we===void 0?"vs-dark":we,xe=K.onEditBlur,Re=K.onSave,Te=K.autoHeight,Oe=Te===void 0?!1:Te,Ie=K.forbidCopy,Me=Ie===void 0?!1:Ie,Ne=K.onChange,Be=Ne===void 0?v:Ne,Pe=K.editorDidMount,Ye=Pe===void 0?v:Pe,Ke=K.onFocus,Se=Ke===void 0?v:Ke,je=K.filename,et=je===void 0?"educoder.txt":je,Je=K.errorLine,Ze=K.errorContent,We=Ze===void 0?"":Ze,nt=Object(I.a)(K,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),qe=Object(N.useRef)(),De=Object(N.useRef)({}),Ge=Object(N.useRef)(),ne=Object(N.useRef)(!1),le=Object(N.useRef)(),fe=Object(N.useState)(!1),$=Object(S.a)(fe,2),Q=$[0],re=$[1];function me(){var Qe;return qe.current&&(Qe=new A.default(function(vt){var _t=Object(U.a)(vt),yt;try{for(_t.s();!(yt=_t.n()).done;){var ii=yt.value;(ii.target.offsetHeight>0||ii.target.offsetWidth>0)&&De.current.instance.layout()}}catch(gi){_t.e(gi)}finally{_t.f()}}),Qe.observe(qe.current)),Qe}function Ae(){w.b.warn(decodeURIComponent(a))}var ke=function(){var vt=De.current.instance;if(Z!=null&&vt&&Q){var _t=vt.getModel();_t&&Z!==_t.getValue()&&(f=!0,_t.setValue(Z),vt.layout(),f=!1)}};Object(N.useEffect)(function(){Ge.current&&clearTimeout(Ge.current),Ge.current=setTimeout(function(){ke()},500)},[Z,Q,De.current]),Object(N.useEffect)(function(){if(Je&&De.current&&De.current.instance){var Qe=De.current.instance;Qe.changeViewZones(function(_t){var yt=document.createElement("div");yt.style.padding="10px 20px",yt.style.width="calc(100% - 20px)",yt.className="my-error-line-wrp",yt.innerHTML=We,_t.addZone({afterLineNumber:Je||11,heightInLines:3,domNode:yt})});var vt={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};Qe.addOverlayWidget(vt),Qe.revealPositionInCenter({lineNumber:20,column:1})}},[Je,De.current,Q]);function ze(){var Qe=De.current.instance;if(Qe){var vt=Qe.getSelection(),_t=De.current.pastePos||{},yt=new O.Range(_t.startLineNumber||vt.endLineNumber,_t.startColumn||vt.endColumn,_t.endLineNumber||vt.endLineNumber,_t.endColumn||vt.endColumn);setTimeout(function(){Qe.executeEdits("",[{range:yt,text:""}])},300)}}function lt(Qe){(window.navigator.platform.match("Mac")?Qe.metaKey:Qe.ctrlKey)&&Qe.keyCode==83&&(Qe.preventDefault(),Re())}var pt=function(){if(Oe&&De.current.instance){var vt=De.current.instance.getContentHeight();Jt(vt<ae?ae:vt)}else Jt(ae)};function ct(Qe){var vt=document.createEvent("MouseEvents");vt.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Qe.dispatchEvent(vt)}function bt(Qe,vt){var _t=window.URL||window.webkitURL||window,yt=new Blob([vt]),ii=document.createElementNS("http://www.w3.org/1999/xhtml","a");ii.href=_t.createObjectURL(yt),ii.download=Qe,ct(ii)}Object(N.useEffect)(function(){pt()},[pt]),Object(N.useEffect)(function(){qe.current&&!Q&&z.e(27).then(z.t.bind(null,"M/lh",7)).then(function(Qe){try{O=Qe,De.current.instance=O.editor.create(qe.current,{value:Z,language:R(de),theme:Le,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},ye);var vt=De.current.instance;if(Ye(vt,O),setTimeout(function(){pt(),De.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){bt(et||"educoder.txt",vt.getValue())}})},500),De.current.subscription=vt.onDidChangeModelContent(function(yt){ne.current?clearTimeout(le.current):(pt(),Be(vt.getValue(),yt)),le.current=setTimeout(function(){ne.current=!1},500)}),window.Monaco||_(O),Me&&(vt.addCommand(O.KeyMod.CtrlCmd|O.KeyMod.Shift|O.KeyCode.KEY_V,function(){return Ae(),null}),vt.addCommand(O.KeyMod.CtrlCmd|O.KeyCode.KEY_C,function(){return Ae(),null})),window.Monaco=O,xe&&vt.onDidBlurEditorWidget(function(){xe(vt.getValue())}),Se&&vt.onDidFocusEditorText(function(){Se(vt.getValue())}),Me){vt.addCommand(O.KeyMod.CtrlCmd|O.KeyCode.KEY_V,function(){return Ae(),null}),vt.onDidPaste(function(yt){De.current.pastePos=yt});try{window.addEventListener("paste",ze)}catch(yt){}}var _t=me();return re(!0),function(){var yt=De.current.instance;yt.dispose();var ii=yt.getModel();ii&&ii.dispose(),De.current.subscription&&De.current.subscription.dispose(),Me&&window.removeEventListener("paste",ze),_t.unobserve(qe.current)}}catch(yt){}})},[]),Object(N.useEffect)(function(){var Qe=De.current.instance;if(Qe&&Q)return document.addEventListener("keydown",lt,!1),function(){document.removeEventListener("keydown",lt)}},[Re,Q]),Object(N.useEffect)(function(){var Qe=De.current.instance;if(Qe&&Q){var vt=R(de);O.editor.setModelLanguage(Qe.getModel(),vt),console.log("language:",de,Qe.getModel(),vt)}},[de,Q]),Object(N.useEffect)(function(){var Qe=De.current.instance;Qe&&Q&&O.editor.setTheme(Le)},[Le,Q]),Object(N.useEffect)(function(){var Qe=De.current.instance;Qe&&Q&&(Qe.updateOptions(Object(_e.a)({},J)),setTimeout(function(){Qe.getModel().updateOptions(Object(_e.a)({},J))},200))},[JSON.stringify(J),Q]),Object(N.useEffect)(function(){var Qe=De.current.instance;Qe&&Q&&Qe.layout()},[H,ae,Q]);var St=Object(N.useState)(l(H)),rt=Object(S.a)(St,2),Xt=rt[0],Pt=rt[1],Zt=Object(N.useState)(l(ae)),Ht=Object(S.a)(Zt,2),Et=Ht[0],Jt=Ht[1],li=Object(_e.a)(Object(_e.a)({},te),{},{width:Xt,height:Et});return k.a.createElement("div",{className:"my-monaco-editor",ref:qe,style:li})};function j(K){var L=K.width,H=L===void 0?"100%":L,Y=K.height,ae=Y===void 0?"100%":Y,Z=K.original,ce=K.modified,de=K.language,q=K.options,te=q===void 0?{}:q,he=Object(N.useRef)(),J=Object(N.useState)(null),X=Object(S.a)(J,2),ye=X[0],we=X[1];function Le(Oe){var Ie;return he.current&&(Ie=new A.default(function(Me){var Ne=Object(U.a)(Me),Be;try{for(Ne.s();!(Be=Ne.n()).done;){var Pe=Be.value;(Pe.target.offsetHeight>0||Pe.target.offsetWidth>0)&&Oe.layout()}}catch(Ye){Ne.e(Ye)}finally{Ne.f()}}),Ie.observe(he.current)),Ie}Object(N.useEffect)(function(){he.current&&z.e(27).then(z.t.bind(null,"M/lh",7)).then(function(Oe){O=Oe;var Ie=O.editor.createDiffEditor(he.current,Object(_e.a)(Object(_e.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},te),{},{wordWrap:!0}));we(Ie);var Me=Le(Ie);return function(){Ie.dispose();var Ne=Ie.getModel();Ne&&Ne.dispose(),Me.unobserve(he.current)}})},[]),Object(N.useEffect)(function(){ye&&ye.setModel({original:O.editor.createModel(Z,de),modified:O.editor.createModel(ce,de)})},[Z,ce,de,ye]);var xe=l(H),Re=l(ae),Te={width:xe,height:Re};return k.a.createElement("div",{className:"my-diff-editor",ref:he,style:Te})}},bT9E:function(at,$e,z){"use strict";z.d($e,"a",function(){return F});var _e=z("VTBJ");function F(w,U){var S=Object(_e.a)({},w);return Array.isArray(U)&&U.forEach(function(I){delete S[I]}),S}},d5o6:function(at,$e,z){at.exports={flex_box_center:"flex_box_center___2-Tej",flex_space_between:"flex_space_between___1Q3vH",flex_box_vertical_center:"flex_box_vertical_center___2x9ha",flex_box_center_end:"flex_box_center_end___1fvRI",flex_box_column:"flex_box_column___2RmOE",addModal:"addModal___2Pv06",row:"row___2XmSi",label:"label___1L8pt"}},fAei:function(at,$e,z){"use strict";z.d($e,"a",function(){return n.a});var _e=z("rePB"),F=z("VTBJ"),w=z("KQm4"),U=z("1OyB"),S=z("vuIU"),I=z("Ji7U"),N=z("LK+K"),k=z("q1tI"),A=z("4IlW"),C=z("Kwbf"),y=z("TSYQ"),h=z.n(y),u=z("sboe"),o=z("OZM5"),e=z("815F"),d=z("ODXe"),s=z("Ff2n"),t=z("+nKL"),i=z("8XRh"),n=z("WaYH"),T=function(ce,de){var q=ce.className,te=ce.style,he=ce.motion,J=ce.motionNodes,X=ce.motionType,ye=ce.onMotionStart,we=ce.onMotionEnd,Le=ce.active,xe=ce.treeNodeRequiredProps,Re=Object(s.a)(ce,["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"]),Te=k.useState(!0),Oe=Object(d.a)(Te,2),Ie=Oe[0],Me=Oe[1],Ne=k.useContext(u.a),Be=Ne.prefixCls,Pe=k.useRef(!1),Ye=function(){Pe.current||we(),Pe.current=!0};return Object(k.useEffect)(function(){J&&X==="hide"&&Ie&&Me(!1)},[J]),Object(k.useEffect)(function(){return J&&ye(),function(){J&&Ye()}},[]),J?k.createElement(i.default,Object.assign({ref:de,visible:Ie},he,{motionAppear:X==="show",onAppearEnd:Ye,onLeaveEnd:Ye}),function(Ke,Se){var je=Ke.className,et=Ke.style;return k.createElement("div",{ref:Se,className:h()("".concat(Be,"-treenode-motion"),je),style:et},J.map(function(Je){var Ze=Je.data,We=Ze.key,nt=Object(s.a)(Ze,["key"]),qe=Je.isStart,De=Je.isEnd;delete nt.children;var Ge=Object(e.f)(We,xe);return k.createElement(n.a,Object.assign({},nt,Ge,{active:Le,data:Je.data,key:We,isStart:qe,isEnd:De}))}))}):k.createElement(n.a,Object.assign({domRef:de,className:q,style:te},Re,{active:Le}))};T.displayName="MotionTreeNode";var m=k.forwardRef(T),p=m;function b(){var Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],de=Z.length,q=ce.length;if(Math.abs(de-q)!==1)return{add:!1,key:null};function te(he,J){var X=new Map;he.forEach(function(we){X.set(we,!0)});var ye=J.filter(function(we){return!X.has(we)});return ye.length===1?ye[0]:null}return de<q?{add:!0,key:te(Z,ce)}:{add:!1,key:te(ce,Z)}}function _(Z,ce,de){var q=Z.findIndex(function(X){var ye=X.data;return ye.key===de}),te=Z[q+1],he=ce.findIndex(function(X){var ye=X.data;return ye.key===de});if(te){var J=ce.findIndex(function(X){var ye=X.data;return ye.key===te.data.key});return ce.slice(he+1,J)}return ce.slice(he+1)}var a={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},c=function(){},r="RC_TREE_MOTION_".concat(Math.random()),l={key:r},v={key:r,level:0,index:0,pos:"0",node:l},f={parent:null,children:[],pos:v.pos,data:l,isStart:[],isEnd:[]};function x(Z,ce,de,q){return ce===!1||!de?Z:Z.slice(0,Math.ceil(de/q)+1)}function R(Z){var ce=Z.data.key,de=Z.pos;return Object(e.e)(ce,de)}function O(Z){for(var ce=String(Z.data.key),de=Z;de.parent;)de=de.parent,ce="".concat(de.data.key," > ").concat(ce);return ce}var B=function(ce,de){var q=ce.prefixCls,te=ce.data,he=ce.selectable,J=ce.checkable,X=ce.expandedKeys,ye=ce.selectedKeys,we=ce.checkedKeys,Le=ce.loadedKeys,xe=ce.loadingKeys,Re=ce.halfCheckedKeys,Te=ce.keyEntities,Oe=ce.disabled,Ie=ce.dragging,Me=ce.dragOverNodeKey,Ne=ce.dropPosition,Be=ce.motion,Pe=ce.height,Ye=ce.itemHeight,Ke=ce.virtual,Se=ce.focusable,je=ce.activeItem,et=ce.focused,Je=ce.tabIndex,Ze=ce.onKeyDown,We=ce.onFocus,nt=ce.onBlur,qe=ce.onActiveChange,De=ce.onListChangeStart,Ge=ce.onListChangeEnd,ne=Object(s.a)(ce,["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"]),le=k.useRef(null);k.useImperativeHandle(de,function(){return{scrollTo:function(yt){le.current.scrollTo(yt)}}});var fe=k.useState(X),$=Object(d.a)(fe,2),Q=$[0],re=$[1],me=k.useState(te),Ae=Object(d.a)(me,2),ke=Ae[0],ze=Ae[1],lt=k.useState(te),pt=Object(d.a)(lt,2),ct=pt[0],bt=pt[1],St=k.useState([]),rt=Object(d.a)(St,2),Xt=rt[0],Pt=rt[1],Zt=k.useState(null),Ht=Object(d.a)(Zt,2),Et=Ht[0],Jt=Ht[1];function li(){ze(te),bt(te),Pt([]),Jt(null),Ge()}k.useEffect(function(){re(X);var _t=b(Q,X);if(_t.key!==null)if(_t.add){var yt=ke.findIndex(function(xi){var Ai=xi.data.key;return Ai===_t.key}),ii=x(_(ke,te,_t.key),Ke,Pe,Ye),gi=ke.slice();gi.splice(yt+1,0,f),bt(gi),Pt(ii),Jt("show")}else{var Ti=te.findIndex(function(xi){var Ai=xi.data.key;return Ai===_t.key}),ui=x(_(te,ke,_t.key),Ke,Pe,Ye),Ii=te.slice();Ii.splice(Ti+1,0,f),bt(Ii),Pt(ui),Jt("hide")}else ke!==te&&(ze(te),bt(te))},[X,te]),k.useEffect(function(){Ie||li()},[Ie]);var Qe=Be?ct:te,vt={expandedKeys:X,selectedKeys:ye,loadedKeys:Le,loadingKeys:xe,checkedKeys:we,halfCheckedKeys:Re,dragOverNodeKey:Me,dropPosition:Ne,keyEntities:Te};return k.createElement(k.Fragment,null,et&&je&&k.createElement("span",{style:a,"aria-live":"assertive"},O(je)),k.createElement("div",{role:"tree"},k.createElement("input",{style:a,disabled:Se===!1||Oe,tabIndex:Se!==!1?Je:null,onKeyDown:Ze,onFocus:We,onBlur:nt,value:"",onChange:c})),k.createElement(t.a,Object.assign({},ne,{data:Qe,itemKey:R,height:Pe,fullHeight:!1,virtual:Ke,itemHeight:Ye,prefixCls:"".concat(q,"-list"),ref:le}),function(_t){var yt=_t.pos,ii=_t.data,gi=ii.key,Ti=Object(s.a)(ii,["key"]),ui=_t.isStart,Ii=_t.isEnd,xi=Object(e.e)(gi,yt);delete Ti.children;var Ai=Object(e.f)(xi,vt);return k.createElement(p,Object.assign({},Ti,Ai,{active:je&&gi===je.data.key,pos:yt,data:_t.data,isStart:ui,isEnd:Ii,motion:Be,motionNodes:gi===r?Xt:null,motionType:Et,onMotionStart:De,onMotionEnd:li,treeNodeRequiredProps:vt,onMouseMove:function(){qe(null)}}))}))},j=k.forwardRef(B);j.displayName="NodeList";var K=j,L=z("NvD2"),H=function(Z){Object(I.a)(de,Z);var ce=Object(N.a)(de);function de(){var q;return Object(U.a)(this,de),q=ce.apply(this,arguments),q.destroyed=!1,q.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},q.listRef=k.createRef(),q.onNodeDragStart=function(te,he){var J=q.state,X=J.expandedKeys,ye=J.keyEntities,we=q.props.onDragStart,Le=he.props.eventKey;q.dragNode=he;var xe=Object(o.b)(X,Le);q.setState({dragging:!0,dragNodesKeys:Object(o.g)(Le,ye)}),q.setExpandedKeys(xe),we&&we({event:te,node:Object(e.b)(he.props)})},q.onNodeDragEnter=function(te,he){var J=q.state,X=J.expandedKeys,ye=J.keyEntities,we=J.dragNodesKeys,Le=q.props.onDragEnter,xe=he.props,Re=xe.pos,Te=xe.eventKey;if(!q.dragNode||we.indexOf(Te)!==-1)return;var Oe=Object(o.c)(te,he);if(q.dragNode.props.eventKey===Te&&Oe===0){q.setState({dragOverNodeKey:"",dropPosition:null});return}setTimeout(function(){q.setState({dragOverNodeKey:Te,dropPosition:Oe}),q.delayedDragEnterLogic||(q.delayedDragEnterLogic={}),Object.keys(q.delayedDragEnterLogic).forEach(function(Ie){clearTimeout(q.delayedDragEnterLogic[Ie])}),q.delayedDragEnterLogic[Re]=window.setTimeout(function(){if(!q.state.dragging)return;var Ie=Object(w.a)(X),Me=ye[Te];Me&&(Me.children||[]).length&&(Ie=Object(o.a)(X,Te)),"expandedKeys"in q.props||q.setExpandedKeys(Ie),Le&&Le({event:te,node:Object(e.b)(he.props),expandedKeys:Ie})},400)},0)},q.onNodeDragOver=function(te,he){var J=q.state.dragNodesKeys,X=q.props.onDragOver,ye=he.props.eventKey;if(J.indexOf(ye)!==-1)return;if(q.dragNode&&ye===q.state.dragOverNodeKey){var we=Object(o.c)(te,he);if(we===q.state.dropPosition)return;q.setState({dropPosition:we})}X&&X({event:te,node:Object(e.b)(he.props)})},q.onNodeDragLeave=function(te,he){var J=q.props.onDragLeave;q.setState({dragOverNodeKey:""}),J&&J({event:te,node:Object(e.b)(he.props)})},q.onNodeDragEnd=function(te,he){var J=q.props.onDragEnd;q.setState({dragOverNodeKey:""}),q.cleanDragState(),J&&J({event:te,node:Object(e.b)(he.props)}),q.dragNode=null},q.onNodeDrop=function(te,he){var J=q.state,X=J.dragNodesKeys,ye=X===void 0?[]:X,we=J.dropPosition,Le=q.props.onDrop,xe=he.props,Re=xe.eventKey,Te=xe.pos;if(q.setState({dragOverNodeKey:""}),q.cleanDragState(),ye.indexOf(Re)!==-1){Object(C.a)(!1,"Can not drop to dragNode(include it's children node)");return}var Oe=Object(o.k)(Te),Ie={event:te,node:Object(e.b)(he.props),dragNode:q.dragNode?Object(e.b)(q.dragNode.props):null,dragNodesKeys:ye.slice(),dropPosition:we+Number(Oe[Oe.length-1]),dropToGap:!1};we!==0&&(Ie.dropToGap=!0),Le&&Le(Ie),q.dragNode=null},q.cleanDragState=function(){var te=q.state.dragging;te&&q.setState({dragging:!1})},q.onNodeClick=function(te,he){var J=q.props.onClick;J&&J(te,he)},q.onNodeDoubleClick=function(te,he){var J=q.props.onDoubleClick;J&&J(te,he)},q.onNodeSelect=function(te,he){var J=q.state.selectedKeys,X=q.state.keyEntities,ye=q.props,we=ye.onSelect,Le=ye.multiple,xe=he.selected,Re=he.key,Te=!xe;Te?Le?J=Object(o.a)(J,Re):J=[Re]:J=Object(o.b)(J,Re);var Oe=J.map(function(Ie){var Me=X[Ie];return Me?Me.node:null}).filter(function(Ie){return Ie});q.setUncontrolledState({selectedKeys:J}),we&&we(J,{event:"select",selected:Te,node:he,selectedNodes:Oe,nativeEvent:te.nativeEvent})},q.onNodeCheck=function(te,he,J){var X=q.state,ye=X.keyEntities,we=X.checkedKeys,Le=X.halfCheckedKeys,xe=q.props,Re=xe.checkStrictly,Te=xe.onCheck,Oe=he.key,Ie,Me={event:"check",node:he,checked:J,nativeEvent:te.nativeEvent};if(Re){var Ne=J?Object(o.a)(we,Oe):Object(o.b)(we,Oe),Be=Object(o.b)(Le,Oe);Ie={checked:Ne,halfChecked:Be},Me.checkedNodes=Ne.map(function(et){return ye[et]}).filter(function(et){return et}).map(function(et){return et.node}),q.setUncontrolledState({checkedKeys:Ne})}else{var Pe=Object(L.a)([].concat(Object(w.a)(we),[Oe]),!0,ye),Ye=Pe.checkedKeys,Ke=Pe.halfCheckedKeys;if(!J){var Se=new Set(Ye);Se.delete(Oe);var je=Object(L.a)(Array.from(Se),{checked:!1,halfCheckedKeys:Ke},ye);Ye=je.checkedKeys,Ke=je.halfCheckedKeys}Ie=Ye,Me.checkedNodes=[],Me.checkedNodesPositions=[],Me.halfCheckedKeys=Ke,Ye.forEach(function(et){var Je=ye[et];if(!Je)return;var Ze=Je.node,We=Je.pos;Me.checkedNodes.push(Ze),Me.checkedNodesPositions.push({node:Ze,pos:We})}),q.setUncontrolledState({checkedKeys:Ye},!1,{halfCheckedKeys:Ke})}Te&&Te(Ie,Me)},q.onNodeLoad=function(te){return new Promise(function(he){q.setState(function(J){var X=J.loadedKeys,ye=X===void 0?[]:X,we=J.loadingKeys,Le=we===void 0?[]:we,xe=q.props,Re=xe.loadData,Te=xe.onLoad,Oe=te.key;if(!Re||ye.indexOf(Oe)!==-1||Le.indexOf(Oe)!==-1)return{};var Ie=Re(te);return Ie.then(function(){var Me=q.state,Ne=Me.loadedKeys,Be=Me.loadingKeys,Pe=Object(o.a)(Ne,Oe),Ye=Object(o.b)(Be,Oe);Te&&Te(Pe,{event:"load",node:te}),q.setUncontrolledState({loadedKeys:Pe}),q.setState({loadingKeys:Ye}),he()}),{loadingKeys:Object(o.a)(Le,Oe)}})})},q.onNodeMouseEnter=function(te,he){var J=q.props.onMouseEnter;J&&J({event:te,node:he})},q.onNodeMouseLeave=function(te,he){var J=q.props.onMouseLeave;J&&J({event:te,node:he})},q.onNodeContextMenu=function(te,he){var J=q.props.onRightClick;J&&(te.preventDefault(),J({event:te,node:he}))},q.onFocus=function(){var te=q.props.onFocus;q.setState({focused:!0}),te&&te.apply(void 0,arguments)},q.onBlur=function(){var te=q.props.onBlur;q.setState({focused:!1}),q.onActiveChange(null),te&&te.apply(void 0,arguments)},q.getTreeNodeRequiredProps=function(){var te=q.state,he=te.expandedKeys,J=te.selectedKeys,X=te.loadedKeys,ye=te.loadingKeys,we=te.checkedKeys,Le=te.halfCheckedKeys,xe=te.dragOverNodeKey,Re=te.dropPosition,Te=te.keyEntities;return{expandedKeys:he||[],selectedKeys:J||[],loadedKeys:X||[],loadingKeys:ye||[],checkedKeys:we||[],halfCheckedKeys:Le||[],dragOverNodeKey:xe,dropPosition:Re,keyEntities:Te}},q.setExpandedKeys=function(te){var he=q.state.treeData,J=Object(e.d)(he,te);q.setUncontrolledState({expandedKeys:te,flattenNodes:J},!0)},q.onNodeExpand=function(te,he){var J=q.state.expandedKeys,X=q.state.listChanging,ye=q.props,we=ye.onExpand,Le=ye.loadData,xe=he.key,Re=he.expanded;if(X)return;var Te=J.indexOf(xe),Oe=!Re;if(Object(C.a)(Re&&Te!==-1||!Re&&Te===-1,"Expand state not sync with index check"),Oe?J=Object(o.a)(J,xe):J=Object(o.b)(J,xe),q.setExpandedKeys(J),we&&we(J,{node:he,expanded:Oe,nativeEvent:te.nativeEvent}),Oe&&Le){var Ie=q.onNodeLoad(he);Ie&&Ie.then(function(){var Me=Object(e.d)(q.state.treeData,J);q.setUncontrolledState({flattenNodes:Me})})}},q.onListChangeStart=function(){q.setUncontrolledState({listChanging:!0})},q.onListChangeEnd=function(){setTimeout(function(){q.setUncontrolledState({listChanging:!1})})},q.onActiveChange=function(te){var he=q.state.activeKey,J=q.props.onActiveChange;if(he===te)return;q.setState({activeKey:te}),te!==null&&q.scrollTo({key:te}),J&&J(te)},q.getActiveItem=function(){var te=q.state,he=te.activeKey,J=te.flattenNodes;return he===null?null:J.find(function(X){var ye=X.data.key;return ye===he})||null},q.offsetActiveKey=function(te){var he=q.state,J=he.flattenNodes,X=he.activeKey,ye=J.findIndex(function(xe){var Re=xe.data.key;return Re===X});ye===-1&&te<0&&(ye=J.length),ye=(ye+te+J.length)%J.length;var we=J[ye];if(we){var Le=we.data.key;q.onActiveChange(Le)}else q.onActiveChange(null)},q.onKeyDown=function(te){var he=q.state,J=he.activeKey,X=he.expandedKeys,ye=he.checkedKeys,we=q.props,Le=we.onKeyDown,xe=we.checkable,Re=we.selectable;switch(te.which){case A.a.UP:{q.offsetActiveKey(-1),te.preventDefault();break}case A.a.DOWN:{q.offsetActiveKey(1),te.preventDefault();break}}var Te=q.getActiveItem();if(Te&&Te.data){var Oe=q.getTreeNodeRequiredProps(),Ie=Te.data.isLeaf===!1||!!(Te.data.children||[]).length,Me=Object(e.b)(Object(F.a)(Object(F.a)({},Object(e.f)(J,Oe)),{},{data:Te.data,active:!0}));switch(te.which){case A.a.LEFT:{Ie&&X.includes(J)?q.onNodeExpand({},Me):Te.parent&&q.onActiveChange(Te.parent.data.key),te.preventDefault();break}case A.a.RIGHT:{Ie&&!X.includes(J)?q.onNodeExpand({},Me):Te.children&&Te.children.length&&q.onActiveChange(Te.children[0].data.key),te.preventDefault();break}case A.a.ENTER:case A.a.SPACE:{xe&&!Me.disabled&&Me.checkable!==!1&&!Me.disableCheckbox?q.onNodeCheck({},Me,!ye.includes(J)):!xe&&Re&&!Me.disabled&&Me.selectable!==!1&&q.onNodeSelect({},Me);break}}}Le&&Le(te)},q.setUncontrolledState=function(te){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,J=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(q.destroyed)return;var X=!1,ye=!0,we={};Object.keys(te).forEach(function(Le){if(Le in q.props){ye=!1;return}X=!0,we[Le]=te[Le]}),X&&(!he||ye)&&q.setState(Object(F.a)(Object(F.a)({},we),J))},q.scrollTo=function(te){q.listRef.current.scrollTo(te)},q}return Object(S.a)(de,[{key:"componentWillUnmount",value:function(){this.destroyed=!0}},{key:"render",value:function(){var te,he=this.state,J=he.focused,X=he.flattenNodes,ye=he.keyEntities,we=he.dragging,Le=he.activeKey,xe=this.props,Re=xe.prefixCls,Te=xe.className,Oe=xe.style,Ie=xe.showLine,Me=xe.focusable,Ne=xe.tabIndex,Be=Ne===void 0?0:Ne,Pe=xe.selectable,Ye=xe.showIcon,Ke=xe.icon,Se=xe.switcherIcon,je=xe.draggable,et=xe.checkable,Je=xe.checkStrictly,Ze=xe.disabled,We=xe.motion,nt=xe.loadData,qe=xe.filterTreeNode,De=xe.height,Ge=xe.itemHeight,ne=xe.virtual,le=xe.titleRender,fe=xe.onContextMenu,$=Object(o.f)(this.props);return k.createElement(u.a.Provider,{value:{prefixCls:Re,selectable:Pe,showIcon:Ye,icon:Ke,switcherIcon:Se,draggable:je,checkable:et,checkStrictly:Je,disabled:Ze,keyEntities:ye,loadData:nt,filterTreeNode:qe,titleRender:le,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}},k.createElement("div",{className:h()(Re,Te,(te={},Object(_e.a)(te,"".concat(Re,"-show-line"),Ie),Object(_e.a)(te,"".concat(Re,"-focused"),J),Object(_e.a)(te,"".concat(Re,"-active-focused"),Le!==null),te))},k.createElement(K,Object.assign({ref:this.listRef,prefixCls:Re,style:Oe,data:X,disabled:Ze,selectable:Pe,checkable:!!et,motion:We,dragging:we,height:De,itemHeight:Ge,virtual:ne,focusable:Me,focused:J,tabIndex:Be,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:fe},this.getTreeNodeRequiredProps(),$))))}}],[{key:"getDerivedStateFromProps",value:function(te,he){var J=he.prevProps,X={prevProps:te};function ye(Ke){return!J&&Ke in te||J&&J[Ke]!==te[Ke]}var we;if(ye("treeData")?we=te.treeData:ye("children")&&(Object(C.a)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),we=Object(e.c)(te.children)),we){X.treeData=we;var Le=Object(e.a)(we);X.keyEntities=Object(F.a)(Object(_e.a)({},r,v),Le.keyEntities)}var xe=X.keyEntities||he.keyEntities;if(ye("expandedKeys")||J&&ye("autoExpandParent"))X.expandedKeys=te.autoExpandParent||!J&&te.defaultExpandParent?Object(o.e)(te.expandedKeys,xe):te.expandedKeys;else if(!J&&te.defaultExpandAll){var Re=Object(F.a)({},xe);delete Re[r],X.expandedKeys=Object.keys(Re).map(function(Ke){return Re[Ke].key})}else!J&&te.defaultExpandedKeys&&(X.expandedKeys=te.autoExpandParent||te.defaultExpandParent?Object(o.e)(te.defaultExpandedKeys,xe):te.defaultExpandedKeys);if(X.expandedKeys||delete X.expandedKeys,we||X.expandedKeys){var Te=Object(e.d)(we||he.treeData,X.expandedKeys||he.expandedKeys);X.flattenNodes=Te}if(te.selectable&&(ye("selectedKeys")?X.selectedKeys=Object(o.d)(te.selectedKeys,te):!J&&te.defaultSelectedKeys&&(X.selectedKeys=Object(o.d)(te.defaultSelectedKeys,te))),te.checkable){var Oe;if(ye("checkedKeys")?Oe=Object(o.j)(te.checkedKeys)||{}:!J&&te.defaultCheckedKeys?Oe=Object(o.j)(te.defaultCheckedKeys)||{}:we&&(Oe=Object(o.j)(te.checkedKeys)||{checkedKeys:he.checkedKeys,halfCheckedKeys:he.halfCheckedKeys}),Oe){var Ie=Oe,Me=Ie.checkedKeys,Ne=Me===void 0?[]:Me,Be=Ie.halfCheckedKeys,Pe=Be===void 0?[]:Be;if(!te.checkStrictly){var Ye=Object(L.a)(Ne,!0,xe);Ne=Ye.checkedKeys,Pe=Ye.halfCheckedKeys}X.checkedKeys=Ne,X.halfCheckedKeys=Pe}}return ye("loadedKeys")&&(X.loadedKeys=te.loadedKeys),X}}]),de}(k.Component);H.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:[]},H.TreeNode=n.a;var Y=H,ae=$e.b=Y},iris:function(at,$e,z){"use strict";z.d($e,"a",function(){return u});var _e=z("qVdP"),F=z("jsC+"),w=z("lUTK"),U=z("BvKs"),S=z("tJVT"),I=z("q1tI"),N=z.n(I),k=z("Q0Vu"),A=z.n(k),C=[{name:"\u7F16\u7A0B\u9898",value:"PROGRAM"},{name:"\u5355\u9009\u9898",value:"SINGLE"},{name:"\u591A\u9009\u9898",value:"MULTIPLE"},{name:"\u5224\u65AD\u9898",value:"JUDGMENT"},{name:"\u586B\u7A7A\u9898",value:"COMPLETION"},{name:"\u7B80\u7B54\u9898",value:"SUBJECTIVE"},{name:"\u7EC4\u5408\u9898",value:"COMBINATION"}],y=[{name:"\u7B80\u5355",value:1},{name:"\u9002\u4E2D",value:2},{name:"\u56F0\u96BE",value:3}],h=[{name:"\u968F\u673A\u7EC4\u5377",value:1},{name:"\u4EBA\u5DE5\u7EC4\u5377",value:2}],u=function(e){var d=e.showSelectAll,s=d===void 0?!1:d,t=e.disciplinesData,i=t===void 0?[]:t,n=e.knowledgeData,T=n===void 0?[]:n,m=e.directionValue,p=e.subDisciplineValue,b=e.typeValue,_=e.knowledgeValue,a=e.showKnowledge,c=a===void 0?!1:a,r=e.showRandomType,l=r===void 0?!1:r,v=e.difficultyValue,f=e.randomValue,x=e.selectAll,R=e.languagesvalue,O=e.className,B=e.languages,j=B===void 0?[]:B,K=e.isprogram_homework,L=e.showShixun,H=L===void 0?!1:L,Y=e.showItemType,ae=Y===void 0?!0:Y,Z=e.onShixunChange,ce=Z===void 0?function(){}:Z,de=e.onDirectionChange,q=de===void 0?function(){}:de,te=e.onTypeChange,he=te===void 0?function(){}:te,J=e.onDifficultyChange,X=J===void 0?function(){}:J,ye=e.handlelanguagesChange,we=ye===void 0?function(){}:ye,Le=e.onKnowledgeChange,xe=Le===void 0?function(){}:Le,Re=e.onRandomChange,Te=Re===void 0?function(){}:Re,Oe=e.showTeachGroup,Ie=Oe===void 0?!1:Oe,Me=e.teachGroupData,Ne=Me===void 0?[]:Me,Be=e.onTeachGroupChange,Pe=Be===void 0?function(){}:Be,Ye=e.teachGroupValue,Ke=Object(I.useState)(0),Se=Object(S.a)(Ke,2),je=Se[0],et=Se[1],Je=Object(I.useRef)(null),Ze=Object(I.useState)(0),We=Object(S.a)(Ze,2),nt=We[0],qe=We[1],De=Object(I.useRef)(null);Object(I.useEffect)(function(){if(i.length!==0){var ne;(Je==null||((ne=Je.current)===null||ne===void 0)?void 0:ne.clientHeight)>108?et(1):et(0)}i.length===0&&et(0)},[i]),Object(I.useEffect)(function(){if(console.log(T.length===0,"\u6570\u91CF"),T.length!==0){var ne,le;console.log(De==null||((ne=De.current)===null||ne===void 0)?void 0:ne.clientHeight,"\u9AD8\u5EA6"),(De==null||((le=De.current)===null||le===void 0)?void 0:le.clientHeight)>108?qe(1):qe(0)}T.length===0&&qe(0)},[T]);var Ge=function(){var le=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],fe=arguments.length>1?arguments[1]:void 0;return N.a.createElement(U.a,{className:A.a.subMenu},le.map(function($){return N.a.createElement(U.a.Item,{key:$.id},N.a.createElement("a",{className:"".concat(A.a.subItem," ").concat(p===$.id?A.a.subActive:""),onClick:function(){return q(fe,$.id)}},$.name))}))};return N.a.createElement("aside",{className:O?"".concat(A.a.main," ").concat(O):A.a.main},N.a.createElement("div",{className:A.a.wrap},K&&N.a.createElement("div",{className:A.a.programName},"\u8BD5\u9898\u5E93-\u7F16\u7A0B\u9898"),Ie&&N.a.createElement("div",{className:A.a.content},N.a.createElement("span",{className:A.a.name},"\u56E2\u961F"),N.a.createElement("div",{className:A.a.directionContentWrap},N.a.createElement("li",{className:"".concat(A.a.directionItem," ").concat(Ye?"":A.a.active," "),onClick:function(){return Pe(null)}},"\u5168\u90E8"),Ne==null?void 0:Ne.map(function(ne){return N.a.createElement("li",{key:ne.group_id,className:"".concat(A.a.directionItem," ").concat(Ye===ne.group_id?A.a.active:""," "),onClick:function(){return Pe(ne.group_id)}},ne.name)}))),N.a.createElement("div",{className:A.a.content},N.a.createElement("span",{className:A.a.name},"\u65B9\u5411"),N.a.createElement("span",null),N.a.createElement("div",{className:A.a.directionContentWrap,style:{overflow:"hidden",height:je===1?88:"auto"}},N.a.createElement("li",{className:"".concat(A.a.directionItem," ").concat(m?"":A.a.active," "),onClick:function(){return q(null)}},"\u5168\u90E8"),i.map(function(ne){var le;return N.a.createElement(N.a.Fragment,{key:ne.id},((le=ne.sub_disciplines)===null||le===void 0?void 0:le.length)>0?N.a.createElement(F.a,{placement:"bottomLeft",overlayStyle:{width:600},getPopupContainer:function($){return $.parentNode},overlay:function(){return Ge(ne.sub_disciplines,ne.id)}},N.a.createElement("li",{className:"".concat(A.a.directionItem," ").concat(m===ne.id?A.a.active:""," "),onClick:function(){return q(ne.id)}},ne.name)):N.a.createElement("li",{className:"".concat(A.a.directionItem," ").concat(m===ne.id?A.a.active:""," "),onClick:function(){return q(ne.id)}},ne.name))})),N.a.createElement("div",{className:A.a.directionContentWrap,ref:Je,style:{height:"auto",position:"fixed",left:0,top:0,width:1024,visibility:"hidden"}},i.map(function(ne){var le;return N.a.createElement(N.a.Fragment,{key:ne.id},((le=ne.sub_disciplines)===null||le===void 0?void 0:le.length)>0?N.a.createElement(F.a,{placement:"bottomLeft",overlayStyle:{width:600},getPopupContainer:function($){return $.parentNode},overlay:function(){return Ge(ne.sub_disciplines,ne.id)}},N.a.createElement("li",{className:"".concat(A.a.directionItem," ").concat(m===ne.id?A.a.active:""," "),onClick:function(){return q(ne.id)}},ne.name)):N.a.createElement("li",{className:"".concat(A.a.directionItem," ").concat(m===ne.id?A.a.active:""," "),onClick:function(){return q(ne.id)}},ne.name))})),!!je&&N.a.createElement("div",{className:A.a.action},je===1&&N.a.createElement("span",{onClick:function(){return et(2)}},"\u5C55\u5F00",N.a.createElement("i",{className:"iconfont icon-xiala"})),je===2&&N.a.createElement("span",{onClick:function(){return et(1)}},"\u6536\u8D77",N.a.createElement("i",{style:{transform:"scale(0.5) rotate(180deg) translateY(2px)"},className:"iconfont icon-xiala"})))),c&&N.a.createElement("div",{className:A.a.content},N.a.createElement("span",{className:A.a.name},"\u77E5\u8BC6\u70B9"),N.a.createElement("div",{className:A.a.directionContentWrap,style:{overflow:"hidden",height:nt===1?106:"auto"}},N.a.createElement("li",{className:"".concat(A.a.directionItem," ").concat(_===-1?A.a.active:""," "),onClick:function(){return xe(-1)}},"\u5168\u90E8"),T.map(function(ne){return N.a.createElement("li",{key:ne.id,className:"".concat(A.a.directionItem," ").concat(_===ne.id?A.a.active:""," "),onClick:function(){return xe(ne.id)}},ne.name)})),N.a.createElement("div",{ref:De,className:A.a.directionContentWrap,style:{height:"auto",position:"fixed",left:0,top:0,width:1010,visibility:"hidden"}},T.map(function(ne){return N.a.createElement("li",{key:ne.id,className:"".concat(A.a.directionItem," ").concat(_===ne.id?A.a.active:""," "),onClick:function(){return xe(ne.id)}},ne.name)})),!!nt&&N.a.createElement("div",{className:A.a.action},nt===1&&N.a.createElement("span",{onClick:function(){return qe(2)}},"\u5C55\u5F00",N.a.createElement("i",{className:"iconfont icon-xiala"})),nt===2&&N.a.createElement("span",{onClick:function(){return qe(1)}},"\u6536\u8D77",N.a.createElement("i",{style:{transform:"scale(0.5) rotate(180deg) translateY(2px)"},className:"iconfont icon-xiala"})))),ae&&!K&&N.a.createElement("div",{className:A.a.content},N.a.createElement("span",{className:A.a.name},"\u9898\u578B"),N.a.createElement("li",{className:"".concat(A.a.directionItem," ").concat(b?"":A.a.active," "),onClick:function(){return he(null)}},"\u5168\u90E8"),N.a.createElement("div",{className:A.a.directionContentWrap},C.map(function(ne){return N.a.createElement("li",{key:ne.name,className:"".concat(A.a.directionItem," ").concat(b===ne.value?A.a.active:""," "),onClick:function(){return he(ne.value)}},ne.name)}),H&&N.a.createElement("li",{key:"\u5B9E\u8BAD\u9898",className:A.a.directionItem,onClick:function(){return ce()}},"\u5B9E\u8BAD\u9898"))),N.a.createElement("div",{className:A.a.content},N.a.createElement("span",{className:A.a.name},"\u96BE\u5EA6"),N.a.createElement("li",{className:"".concat(A.a.directionItem," ").concat(v?"":A.a.active," "),onClick:function(){return X(null)}},"\u5168\u90E8"),N.a.createElement("div",{className:A.a.directionContentWrap},y.map(function(ne){return N.a.createElement("li",{key:ne.name,className:"".concat(A.a.directionItem," ").concat(v===ne.value?A.a.active:""," "),onClick:function(){return X(ne.value)}},ne.name)}))),l&&N.a.createElement("div",{className:A.a.content},N.a.createElement("span",{className:A.a.name},"\u7C7B\u578B"),N.a.createElement("li",{className:"".concat(A.a.directionItem," ").concat(f?"":A.a.active," "),onClick:function(){return Te(null)}},"\u5168\u90E8"),N.a.createElement("div",{className:A.a.directionContentWrap},h.map(function(ne){return N.a.createElement("li",{key:ne.name,className:"".concat(A.a.directionItem," ").concat(f===ne.value?A.a.active:""," "),onClick:function(){return Te(ne.value)}},ne.name)})))))}},jcZT:function(at,$e,z){"use strict";var _e=z("2qtc"),F=z("kLXV"),w=z("5NDa"),U=z("5rEg"),S=z("miYZ"),I=z("tsqr"),N=z("9og8"),k=z("tJVT"),A=z("WmNS"),C=z.n(A),y=z("q1tI"),h=z.n(y),u=z("d5o6"),o=z.n(u),e=z("P/tu"),d=z("WCUW"),s=z("9kvl"),t=function(n){var T=n.problemset,m=n.dispatch,p=n.onOk,b=Object(y.useState)(""),_=Object(k.a)(b,2),a=_[0],c=_[1],r=Object(y.useState)([0]),l=Object(k.a)(r,2),v=l[0],f=l[1],x=function(){m({type:"problemset/setActionTabs",payload:{}})};Object(y.useEffect)(function(){if(T.actionTabs.key==="\u65B0\u5EFA\u6587\u4EF6\u5939"){var O,B;f([(O=T.actionTabs)===null||O===void 0||((B=O.params)===null||B===void 0)?void 0:B.group_id]),c("")}},[T.actionTabs.key]);var R=function(){var O=Object(N.a)(C.a.mark(function B(){var j,K,L;return C.a.wrap(function(Y){for(;;)switch(Y.prev=Y.next){case 0:if(j=["\uFF1F","\u3001","/","\u2572","*","<",">","|"],a.trim()){Y.next=4;break}return I.b.warn("\u8BF7\u8F93\u5165\u6587\u4EF6\u5939\u540D\u79F0"),Y.abrupt("return");case 4:if(!(a.charAt(0)===" ")){Y.next=7;break}return I.b.warn("\u9996\u5B57\u7B26\u4E0D\u80FD\u4E3A\u7A7A\u683C"),Y.abrupt("return");case 7:K=0;case 8:if(!(K<a.length)){Y.next=15;break}if(!j.includes(a.charAt(K))){Y.next=12;break}return I.b.warn("\u6587\u4EF6\u5939\u540D\u79F0\u5305\u542B\u7279\u6B8A\u5B57\u7B26"),Y.abrupt("return",!1);case 12:K++,Y.next=8;break;case 15:return Y.next=17,Object(d.p)({parent_id:v.length>0?v[0]:0,name:a});case 17:L=Y.sent,L.status===0&&(x(),p(L==null?void 0:L.id));case 19:case"end":return Y.stop()}},B)}));return function(){return O.apply(this,arguments)}}();return h.a.createElement(F.a,{centered:!0,title:"\u65B0\u5EFA\u6587\u4EF6\u5939",visible:T.actionTabs.key==="\u65B0\u5EFA\u6587\u4EF6\u5939",width:500,onCancel:x,onOk:R,destroyOnClose:!0},h.a.createElement("div",{className:o.a.addModal},h.a.createElement("div",{className:o.a.row},h.a.createElement("span",{className:o.a.label},"\u6587\u4EF6\u5939\u540D\u79F0: "),h.a.createElement(U.a,{placeholder:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5939\u540D\u79F0",value:a,onChange:function(B){return c(B.target.value)}})),h.a.createElement("div",{className:o.a.row,style:{alignItems:"start",maxHeight:500,overflow:"auto"}},h.a.createElement("span",{className:o.a.label},"\u6587\u4EF6\u5939\u4F4D\u7F6E: "),h.a.createElement(e.a,{value:v,onChange:function(B){return f(B)}}))))};$e.a=Object(s.a)(function(i){var n=i.problemset;return{problemset:n}})(t)},k3GJ:function(at,$e,z){"use strict";z.d($e,"a",function(){return $n});var _e=z("rePB"),F=z("ODXe"),w=z("Ff2n"),U=z("VTBJ"),S=z("q1tI"),I=z("TSYQ"),N=z.n(I),k=z("Zm9Q"),A=z("6cGi"),C=z("KQm4"),y=z("xEkU"),h=z.n(y),u=z("t23M");function o(ie){var ge=Object(S.useRef)(),be=Object(S.useRef)(!1);function oe(){for(var G=arguments.length,ee=new Array(G),V=0;V<G;V++)ee[V]=arguments[V];be.current||(h.a.cancel(ge.current),ge.current=h()(function(){ie.apply(void 0,ee)}))}return Object(S.useEffect)(function(){return function(){be.current=!0,h.a.cancel(ge.current)}},[]),oe}function e(ie){var ge=Object(S.useRef)([]),be=Object(S.useState)({}),oe=Object(F.a)(be,2),G=oe[1],ee=Object(S.useRef)(typeof ie=="function"?ie():ie),V=o(function(){var ue=ee.current;ge.current.forEach(function(Ee){ue=Ee(ue)}),ge.current=[],ee.current=ue,G({})});function se(ue){ge.current.push(ue),V()}return[ee.current,se]}var d=z("4IlW");function s(ie,ge){var be,oe=ie.prefixCls,G=ie.id,ee=ie.active,V=ie.rtl,se=ie.tab,ue=se.key,Ee=se.tab,ve=se.disabled,Ce=se.closeIcon,Ue=ie.tabBarGutter,Xe=ie.tabPosition,Ve=ie.closable,tt=ie.renderWrapper,mt=ie.removeAriaLabel,Ot=ie.editable,xt=ie.onClick,Rt=ie.onRemove,wt=ie.onFocus,Ct="".concat(oe,"-tab");S.useEffect(function(){return Rt},[]);var At={};Xe==="top"||Xe==="bottom"?At[V?"marginLeft":"marginRight"]=Ue:At.marginBottom=Ue;var Nt=Ot&&Ve!==!1&&!ve;function It(ft){if(ve)return;xt(ft)}function ri(ft){ft.preventDefault(),ft.stopPropagation(),Ot.onEdit("remove",{key:ue,event:ft})}var Kt=S.createElement("div",{key:ue,ref:ge,className:N()(Ct,(be={},Object(_e.a)(be,"".concat(Ct,"-with-remove"),Nt),Object(_e.a)(be,"".concat(Ct,"-active"),ee),Object(_e.a)(be,"".concat(Ct,"-disabled"),ve),be)),style:At,onClick:It},S.createElement("div",{role:"tab","aria-selected":ee,id:G&&"".concat(G,"-tab-").concat(ue),className:"".concat(Ct,"-btn"),"aria-controls":G&&"".concat(G,"-panel-").concat(ue),"aria-disabled":ve,tabIndex:ve?null:0,onClick:function(ht){ht.stopPropagation(),It(ht)},onKeyDown:function(ht){[d.a.SPACE,d.a.ENTER].includes(ht.which)&&(ht.preventDefault(),It(ht))},onFocus:wt},Ee),Nt&&S.createElement("button",{type:"button","aria-label":mt||"remove",tabIndex:0,className:"".concat(Ct,"-remove"),onClick:function(ht){ht.stopPropagation(),ri(ht)}},Ce||Ot.removeIcon||"\xD7"));return tt&&(Kt=tt(Kt)),Kt}var t=S.forwardRef(s),i={width:0,height:0,left:0,top:0};function n(ie,ge,be){return Object(S.useMemo)(function(){for(var oe,G=new Map,ee=ge.get((oe=ie[0])===null||oe===void 0?void 0:oe.key)||i,V=ee.left+ee.width,se=0;se<ie.length;se+=1){var ue=ie[se].key,Ee=ge.get(ue);if(!Ee){var ve;Ee=ge.get((ve=ie[se-1])===null||ve===void 0?void 0:ve.key)||i}var Ce=G.get(ue)||Object(U.a)({},Ee);Ce.right=V-Ce.left-Ce.width,G.set(ue,Ce)}return G},[ie.map(function(oe){return oe.key}).join("_"),ge,be])}var T={width:0,height:0,left:0,top:0,right:0};function m(ie,ge,be,oe,G){var ee=G.tabs,V=G.tabPosition,se=G.rtl,ue,Ee,ve;["top","bottom"].includes(V)?(ue="width",Ee=se?"right":"left",ve=Math.abs(ge.left)):(ue="height",Ee="top",ve=-ge.top);var Ce=ge[ue],Ue=be[ue],Xe=oe[ue],Ve=Ce;return Ue+Xe>Ce&&(Ve=Ce-Xe),Object(S.useMemo)(function(){if(!ee.length)return[0,0];for(var tt=ee.length,mt=tt,Ot=0;Ot<tt;Ot+=1){var xt=ie.get(ee[Ot].key)||T;if(xt[Ee]+xt[ue]>ve+Ve){mt=Ot-1;break}}for(var Rt=0,wt=tt-1;wt>=0;wt-=1){var Ct=ie.get(ee[wt].key)||T;if(Ct[Ee]<ve){Rt=wt+1;break}}return[Rt,mt]},[ie,ve,Ve,V,ee.map(function(tt){return tt.key}).join("_"),se])}var p=z("wx14"),b=z("1OyB"),_=z("vuIU"),a=z("JX7q"),c=z("Ji7U"),r=z("LK+K"),l=z("I8Z2"),v=z("bT9E"),f=z("2GS6"),x=z("Gytx"),R=z.n(x),O=z("U8pU"),B=/iPhone/i,j=/iPod/i,K=/iPad/i,L=/\bAndroid(?:.+)Mobile\b/i,H=/Android/i,Y=/\bAndroid(?:.+)SD4930UR\b/i,ae=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,Z=/Windows Phone/i,ce=/\bWindows(?:.+)ARM\b/i,de=/BlackBerry/i,q=/BB10/i,te=/Opera Mini/i,he=/\b(CriOS|Chrome)(?:.+)Mobile/i,J=/Mobile(?:.+)Firefox\b/i;function X(ie,ge){return ie.test(ge)}function ye(ie){var ge=ie||(typeof navigator!="undefined"?navigator.userAgent:""),be=(ge||"").split("[FBAN");if(typeof be[1]!="undefined"){var oe=be,G=Object(F.a)(oe,1);ge=G[0]}if(be=ge.split("Twitter"),typeof be[1]!="undefined"){var ee=be,V=Object(F.a)(ee,1);ge=V[0]}var se={apple:{phone:X(B,ge)&&!X(Z,ge),ipod:X(j,ge),tablet:!X(B,ge)&&X(K,ge)&&!X(Z,ge),device:(X(B,ge)||X(j,ge)||X(K,ge))&&!X(Z,ge)},amazon:{phone:X(Y,ge),tablet:!X(Y,ge)&&X(ae,ge),device:X(Y,ge)||X(ae,ge)},android:{phone:!X(Z,ge)&&X(Y,ge)||!X(Z,ge)&&X(L,ge),tablet:!X(Z,ge)&&!X(Y,ge)&&!X(L,ge)&&(X(ae,ge)||X(H,ge)),device:!X(Z,ge)&&(X(Y,ge)||X(ae,ge)||X(L,ge)||X(H,ge))||X(/\bokhttp\b/i,ge)},windows:{phone:X(Z,ge),tablet:X(ce,ge),device:X(Z,ge)||X(ce,ge)},other:{blackberry:X(de,ge),blackberry10:X(q,ge),opera:X(te,ge),firefox:X(J,ge),chrome:X(he,ge),device:X(de,ge)||X(q,ge)||X(te,ge)||X(J,ge)||X(he,ge)},any:null,phone:null,tablet:null};return se.any=se.apple.device||se.android.device||se.windows.device||se.other.device,se.phone=se.apple.phone||se.android.phone||se.windows.phone,se.tablet=se.apple.tablet||se.android.tablet||se.windows.tablet,se}var we=Object(U.a)(Object(U.a)({},ye()),{},{isMobile:ye}),Le=we;function xe(){}function Re(ie,ge,be){var oe=ge||"";return ie.key||"".concat(oe,"item_").concat(be)}function Te(ie){return"".concat(ie,"-menu-")}function Oe(ie,ge){var be=-1;S.Children.forEach(ie,function(oe){be+=1,oe&&oe.type&&oe.type.isMenuItemGroup?S.Children.forEach(oe.props.children,function(G){be+=1,ge(G,be)}):ge(oe,be)})}function Ie(ie,ge,be){if(!ie||be.find)return;S.Children.forEach(ie,function(oe){if(oe){var G=oe.type;if(!G||!(G.isSubMenu||G.isMenuItem||G.isMenuItemGroup))return;ge.indexOf(oe.key)!==-1?be.find=!0:oe.props.children&&Ie(oe.props.children,ge,be)}})}var Me=["defaultSelectedKeys","selectedKeys","defaultOpenKeys","openKeys","mode","getPopupContainer","onSelect","onDeselect","onDestroy","openTransitionName","openAnimation","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","triggerSubMenuAction","level","selectable","multiple","onOpenChange","visible","focusable","defaultActiveFirst","prefixCls","inlineIndent","parentMenu","title","rootPrefixCls","eventKey","active","onItemHover","onTitleMouseEnter","onTitleMouseLeave","onTitleClick","popupAlign","popupOffset","isOpen","renderMenuItem","manualRef","subMenuKey","disabled","index","isSelected","store","activeKey","builtinPlacements","overflowedIndicator","motion","attribute","value","popupClassName","inlineCollapsed","menu","theme","itemIcon","expandIcon"],Ne=function(ge){var be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,oe=ge&&typeof ge.getBoundingClientRect=="function"&&ge.getBoundingClientRect().width;if(oe){if(be){var G=getComputedStyle(ge),ee=G.marginLeft,V=G.marginRight;oe+=+ee.replace("px","")+ +V.replace("px","")}oe=+oe.toFixed(6)}return oe||0},Be=function(ge,be,oe){ge&&Object(O.a)(ge.style)==="object"&&(ge.style[be]=oe)},Pe=function(){return Le.any},Ye=z("bdgK"),Ke=z("i8i4"),Se=z.n(Ke),je=z("wgJM"),et=z("l4aY"),Je=z("m+aA"),Ze=z("c+Xe"),We=z("zT1h"),nt=z("QC+M");function qe(ie,ge,be){return be?ie[0]===ge[0]:ie[0]===ge[0]&&ie[1]===ge[1]}function De(ie,ge,be){var oe=ie[ge]||{};return Object(U.a)(Object(U.a)({},oe),be)}function Ge(ie,ge,be,oe){for(var G=be.points,ee=Object.keys(ie),V=0;V<ee.length;V+=1){var se=ee[V];if(qe(ie[se].points,G,oe))return"".concat(ge,"-placement-").concat(se)}return""}var ne=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var ie=navigator.userAgent||navigator.vendor||window.opera;return!!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(ie)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(ie==null?void 0:ie.substr(0,4)))},le=z("MNnm");function fe(ie,ge){var be={};return be[ie.toLowerCase()]=ge.toLowerCase(),be["Webkit".concat(ie)]="webkit".concat(ge),be["Moz".concat(ie)]="moz".concat(ge),be["ms".concat(ie)]="MS".concat(ge),be["O".concat(ie)]="o".concat(ge.toLowerCase()),be}function $(ie,ge){var be={animationend:fe("Animation","AnimationEnd"),transitionend:fe("Transition","TransitionEnd")};return ie&&("AnimationEvent"in ge||delete be.animationend.animation,"TransitionEvent"in ge||delete be.transitionend.transition),be}var Q=$(Object(le.a)(),typeof window!="undefined"?window:{}),re={};if(Object(le.a)()){var me=document.createElement("div");re=me.style}var Ae={};function ke(ie){if(Ae[ie])return Ae[ie];var ge=Q[ie];if(ge)for(var be=Object.keys(ge),oe=be.length,G=0;G<oe;G+=1){var ee=be[G];if(Object.prototype.hasOwnProperty.call(ge,ee)&&ee in re)return Ae[ie]=ge[ee],Ae[ie]}return""}var ze=ke("animationend"),lt=ke("transitionend"),pt=!!(ze&&lt),ct=ze||"animationend",bt=lt||"transitionend";function St(ie,ge){if(!ie)return null;if(Object(O.a)(ie)==="object"){var be=ge.replace(/-\w/g,function(oe){return oe[1].toUpperCase()});return ie[be]}return"".concat(ie,"-").concat(ge)}var rt="none",Xt="appear",Pt="enter",Zt="leave",Ht="none",Et="prepare",Jt="start",li="active",Qe="end";function vt(ie){var ge=Object(S.useRef)(!1),be=Object(S.useState)(ie),oe=Object(F.a)(be,2),G=oe[0],ee=oe[1];function V(se){ge.current||ee(se)}return Object(S.useEffect)(function(){return function(){ge.current=!0}},[]),[G,V]}var _t=Object(le.a)()?S.useLayoutEffect:S.useEffect,yt=_t,ii=function(){var ie=S.useRef(null);function ge(){je.a.cancel(ie.current)}function be(oe){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;ge();var ee=Object(je.a)(function(){G<=1?oe({isCanceled:function(){return ee!==ie.current}}):be(oe,G-1)});ie.current=ee}return S.useEffect(function(){return function(){ge()}},[]),[be,ge]},gi=[Et,Jt,li,Qe],Ti=!1,ui=!0;function Ii(ie){return ie===li||ie===Qe}var xi=function(ie,ge){var be=S.useState(Ht),oe=Object(F.a)(be,2),G=oe[0],ee=oe[1],V=ii(),se=Object(F.a)(V,2),ue=se[0],Ee=se[1];function ve(){ee(Et)}return yt(function(){if(G!==Ht&&G!==Qe){var Ce=gi.indexOf(G),Ue=gi[Ce+1],Xe=ge(G);Xe===Ti?ee(Ue):ue(function(Ve){function tt(){if(Ve.isCanceled())return;ee(Ue)}Xe===!0?tt():Promise.resolve(Xe).then(tt)})}},[ie,G]),S.useEffect(function(){return function(){Ee()}},[]),[ve,G]},Ai=function(ie){var ge=Object(S.useRef)(),be=Object(S.useRef)(ie);be.current=ie;var oe=S.useCallback(function(V){be.current(V)},[]);function G(V){V&&(V.removeEventListener(bt,oe),V.removeEventListener(ct,oe))}function ee(V){ge.current&&ge.current!==V&&G(ge.current),V&&V!==ge.current&&(V.addEventListener(bt,oe),V.addEventListener(ct,oe),ge.current=V)}return S.useEffect(function(){return function(){G(ge.current)}},[]),[ee,G]};function Ji(ie,ge,be,oe){var G=oe.motionEnter,ee=G===void 0?!0:G,V=oe.motionAppear,se=V===void 0?!0:V,ue=oe.motionLeave,Ee=ue===void 0?!0:ue,ve=oe.motionDeadline,Ce=oe.motionLeaveImmediately,Ue=oe.onAppearPrepare,Xe=oe.onEnterPrepare,Ve=oe.onLeavePrepare,tt=oe.onAppearStart,mt=oe.onEnterStart,Ot=oe.onLeaveStart,xt=oe.onAppearActive,Rt=oe.onEnterActive,wt=oe.onLeaveActive,Ct=oe.onAppearEnd,At=oe.onEnterEnd,Nt=oe.onLeaveEnd,It=oe.onVisibleChanged,ri=vt(),Kt=Object(F.a)(ri,2),ft=Kt[0],ht=Kt[1],Lt=vt(rt),Mt=Object(F.a)(Lt,2),ot=Mt[0],Ut=Mt[1],qt=vt(null),Bt=Object(F.a)(qt,2),Vt=Bt[0],ti=Bt[1],yi=Object(S.useRef)(!1),wi=Object(S.useRef)(null),ai=Object(S.useRef)(!1),Ri=Object(S.useRef)(null);function ki(){var ei=be();return ei||Ri.current}var Li=Object(S.useRef)(!1);function Di(ei){var Wt=ki();if(ei&&!ei.deadline&&ei.target!==Wt)return;var Ei;ot===Xt&&Li.current?Ei=Ct==null?void 0:Ct(Wt,ei):ot===Pt&&Li.current?Ei=At==null?void 0:At(Wt,ei):ot===Zt&&Li.current&&(Ei=Nt==null?void 0:Nt(Wt,ei)),Ei!==!1&&!ai.current&&(Ut(rt),ti(null))}var oi=Ai(Di),Ci=Object(F.a)(oi,1),bi=Ci[0],pi=S.useMemo(function(){var ei,Wt,Ei;switch(ot){case"appear":return ei={},Object(_e.a)(ei,Et,Ue),Object(_e.a)(ei,Jt,tt),Object(_e.a)(ei,li,xt),ei;case"enter":return Wt={},Object(_e.a)(Wt,Et,Xe),Object(_e.a)(Wt,Jt,mt),Object(_e.a)(Wt,li,Rt),Wt;case"leave":return Ei={},Object(_e.a)(Ei,Et,Ve),Object(_e.a)(Ei,Jt,Ot),Object(_e.a)(Ei,li,wt),Ei;default:return{}}},[ot]),Gi=xi(ot,function(ei){if(ei===Et){var Wt=pi[Et];return Wt?Wt(ki()):Ti}if(Qt in pi){var Ei;ti(((Ei=pi[Qt])===null||Ei===void 0?void 0:Ei.call(pi,ki(),null))||null)}return Qt===li&&(bi(ki()),ve>0&&(clearTimeout(wi.current),wi.current=setTimeout(function(){Di({deadline:!0})},ve))),ui}),zi=Object(F.a)(Gi,2),Qi=zi[0],Qt=zi[1],ji=Ii(Qt);Li.current=ji,yt(function(){ht(ge);var ei=yi.current;if(yi.current=!0,!ie)return;var Wt;!ei&&ge&&se&&(Wt=Xt),ei&&ge&&ee&&(Wt=Pt),(ei&&!ge&&Ee||!ei&&Ce&&!ge&&Ee)&&(Wt=Zt),Wt&&(Ut(Wt),Qi())},[ge]),Object(S.useEffect)(function(){(ot===Xt&&!se||ot===Pt&&!ee||ot===Zt&&!Ee)&&Ut(rt)},[se,ee,Ee]),Object(S.useEffect)(function(){return function(){clearTimeout(wi.current),ai.current=!0}},[]),Object(S.useEffect)(function(){ft!==void 0&&ot===rt&&(It==null||It(ft))},[ft,ot]);var Zi=Vt;return pi[Et]&&Qt===Jt&&(Zi=Object(U.a)({transition:"none"},Zi)),[ot,Qt,Zi,ft!=null?ft:ge]}var Ni=function(ie){Object(c.a)(be,ie);var ge=Object(r.a)(be);function be(){return Object(b.a)(this,be),ge.apply(this,arguments)}return Object(_.a)(be,[{key:"render",value:function(){return this.props.children}}]),be}(S.Component),on=Ni;function Xi(ie){var ge=ie;Object(O.a)(ie)==="object"&&(ge=ie.transitionSupport);function be(G){return!!(G.motionName&&ge)}var oe=S.forwardRef(function(G,ee){var V=G.visible,se=V===void 0?!0:V,ue=G.removeOnLeave,Ee=ue===void 0?!0:ue,ve=G.forceRender,Ce=G.children,Ue=G.motionName,Xe=G.leavedClassName,Ve=G.eventProps,tt=be(G),mt=Object(S.useRef)(),Ot=Object(S.useRef)();function xt(){try{return Object(Je.a)(mt.current||Ot.current)}catch(Ut){return null}}var Rt=Ji(tt,se,xt,G),wt=Object(F.a)(Rt,4),Ct=wt[0],At=wt[1],Nt=wt[2],It=wt[3],ri=S.useRef(It);It&&(ri.current=!0);var Kt=Object(S.useRef)(ee);Kt.current=ee;var ft=S.useCallback(function(Ut){mt.current=Ut,Object(Ze.b)(Kt.current,Ut)},[]),ht,Lt=Object(U.a)(Object(U.a)({},Ve),{},{visible:se});if(!Ce)ht=null;else if(Ct===rt||!be(G))It?ht=Ce(Object(U.a)({},Lt),ft):!Ee&&ri.current?ht=Ce(Object(U.a)(Object(U.a)({},Lt),{},{className:Xe}),ft):ve?ht=Ce(Object(U.a)(Object(U.a)({},Lt),{},{style:{display:"none"}}),ft):ht=null;else{var Mt,ot;At===Et?ot="prepare":Ii(At)?ot="active":At===Jt&&(ot="start"),ht=Ce(Object(U.a)(Object(U.a)({},Lt),{},{className:N()(St(Ue,Ct),(Mt={},Object(_e.a)(Mt,St(Ue,"".concat(Ct,"-").concat(ot)),ot),Object(_e.a)(Mt,Ue,typeof Ue=="string"),Mt)),style:Nt}),ft)}return S.createElement(on,{ref:Ot},ht)});return oe.displayName="CSSMotion",oe}var qi=Xi(pt),Fi="add",Yi="keep",Wi="remove",Hi="removed";function ln(ie){var ge;return ie&&Object(O.a)(ie)==="object"&&"key"in ie?ge=ie:ge={key:ie},Object(U.a)(Object(U.a)({},ge),{},{key:String(ge.key)})}function di(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return ie.map(ln)}function M(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],be=[],oe=0,G=ge.length,ee=di(ie),V=di(ge);ee.forEach(function(Ee){for(var ve=!1,Ce=oe;Ce<G;Ce+=1){var Ue=V[Ce];if(Ue.key===Ee.key){oe<Ce&&(be=be.concat(V.slice(oe,Ce).map(function(Xe){return Object(U.a)(Object(U.a)({},Xe),{},{status:Fi})})),oe=Ce),be.push(Object(U.a)(Object(U.a)({},Ue),{},{status:Yi})),oe+=1,ve=!0;break}}ve||be.push(Object(U.a)(Object(U.a)({},Ee),{},{status:Wi}))}),oe<G&&(be=be.concat(V.slice(oe).map(function(Ee){return Object(U.a)(Object(U.a)({},Ee),{},{status:Fi})})));var se={};be.forEach(function(Ee){var ve=Ee.key;se[ve]=(se[ve]||0)+1});var ue=Object.keys(se).filter(function(Ee){return se[Ee]>1});return ue.forEach(function(Ee){be=be.filter(function(ve){var Ce=ve.key,Ue=ve.status;return Ce!==Ee||Ue!==Wi}),be.forEach(function(ve){ve.key===Ee&&(ve.status=Yi)})}),be}var g=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function E(ie){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:qi,be=function(oe){Object(c.a)(ee,oe);var G=Object(r.a)(ee);function ee(){var V;return Object(b.a)(this,ee),V=G.apply(this,arguments),V.state={keyEntities:[]},V.removeKey=function(se){V.setState(function(ue){var Ee=ue.keyEntities;return{keyEntities:Ee.map(function(ve){return ve.key!==se?ve:Object(U.a)(Object(U.a)({},ve),{},{status:Hi})})}})},V}return Object(_.a)(ee,[{key:"render",value:function(){var se=this,ue=this.state.keyEntities,Ee=this.props,ve=Ee.component,Ce=Ee.children,Ue=Ee.onVisibleChanged,Xe=Object(w.a)(Ee,["component","children","onVisibleChanged"]),Ve=ve||S.Fragment,tt={};return g.forEach(function(mt){tt[mt]=Xe[mt],delete Xe[mt]}),delete Xe.keys,S.createElement(Ve,Xe,ue.map(function(mt){var Ot=mt.status,xt=Object(w.a)(mt,["status"]),Rt=Ot===Fi||Ot===Yi;return S.createElement(ge,Object(p.a)({},tt,{key:xt.key,visible:Rt,eventProps:xt,onVisibleChanged:function(Ct){Ue==null||Ue(Ct,{key:xt.key}),Ct||se.removeKey(xt.key)}}),Ce)}))}}],[{key:"getDerivedStateFromProps",value:function(se,ue){var Ee=se.keys,ve=ue.keyEntities,Ce=di(Ee),Ue=M(ve,Ce);return{keyEntities:Ue.filter(function(Xe){var Ve=ve.find(function(tt){var mt=tt.key;return Xe.key===mt});return!(Ve&&Ve.status===Hi&&Xe.status===Wi)})}}}]),ee}(S.Component);return be.defaultProps={component:"div"},be}var D=E(pt),W=qi;function P(ie){var ge=ie.prefixCls,be=ie.motion,oe=ie.animation,G=ie.transitionName;return be||(oe?{motionName:"".concat(ge,"-").concat(oe)}:G?{motionName:G}:null)}function pe(ie){var ge=ie.prefixCls,be=ie.visible,oe=ie.zIndex,G=ie.mask,ee=ie.maskMotion,V=ie.maskAnimation,se=ie.maskTransitionName;if(!G)return null;var ue={};return(ee||se||V)&&(ue=Object(U.a)({motionAppear:!0},P({motion:ee,prefixCls:ge,transitionName:se,animation:V}))),S.createElement(W,Object(p.a)({},ue,{visible:be,removeOnLeave:!0}),function(Ee){var ve=Ee.className;return S.createElement("div",{style:{zIndex:oe},className:N()("".concat(ge,"-mask"),ve)})})}var Fe=z("9mu1"),it=z("o0o1"),st=z.n(it),He=z("HaE+"),gt=["measure","align",null,"motion"],jt=function(ie,ge){var be=Object(S.useState)(null),oe=Object(F.a)(be,2),G=oe[0],ee=oe[1],V=Object(S.useRef)(),se=Object(S.useRef)(!1);function ue(Ce){se.current||ee(Ce)}function Ee(){je.a.cancel(V.current)}function ve(Ce){Ee(),V.current=Object(je.a)(function(){ue(function(Ue){switch(G){case"align":return"motion";case"motion":return"stable";default:}return Ue}),Ce==null||Ce()})}return Object(S.useEffect)(function(){ue("measure")},[ie]),Object(S.useEffect)(function(){switch(G){case"measure":ge();break;default:}G&&(V.current=Object(je.a)(Object(He.a)(st.a.mark(function Ce(){var Ue,Xe;return st.a.wrap(function(tt){for(;;)switch(tt.prev=tt.next){case 0:Ue=gt.indexOf(G),Xe=gt[Ue+1],Xe&&Ue!==-1&&ue(Xe);case 3:case"end":return tt.stop()}},Ce)}))))},[G]),Object(S.useEffect)(function(){return function(){se.current=!0,Ee()}},[]),[G,ve]},Yt=function(ie){var ge=S.useState({width:0,height:0}),be=Object(F.a)(ge,2),oe=be[0],G=be[1];function ee(se){G({width:se.offsetWidth,height:se.offsetHeight})}var V=S.useMemo(function(){var se={};if(ie){var ue=oe.width,Ee=oe.height;ie.indexOf("height")!==-1&&Ee?se.height=Ee:ie.indexOf("minHeight")!==-1&&Ee&&(se.minHeight=Ee),ie.indexOf("width")!==-1&&ue?se.width=ue:ie.indexOf("minWidth")!==-1&&ue&&(se.minWidth=ue)}return se},[ie,oe]);return[V,ee]},Oi=S.forwardRef(function(ie,ge){var be=ie.visible,oe=ie.prefixCls,G=ie.className,ee=ie.style,V=ie.children,se=ie.zIndex,ue=ie.stretch,Ee=ie.destroyPopupOnHide,ve=ie.forceRender,Ce=ie.align,Ue=ie.point,Xe=ie.getRootDomNode,Ve=ie.getClassNameFromAlign,tt=ie.onAlign,mt=ie.onMouseEnter,Ot=ie.onMouseLeave,xt=ie.onMouseDown,Rt=ie.onTouchStart,wt=Object(S.useRef)(),Ct=Object(S.useRef)(),At=Object(S.useState)(),Nt=Object(F.a)(At,2),It=Nt[0],ri=Nt[1],Kt=Yt(ue),ft=Object(F.a)(Kt,2),ht=ft[0],Lt=ft[1];function Mt(){ue&&Lt(Xe())}var ot=jt(be,Mt),Ut=Object(F.a)(ot,2),qt=Ut[0],Bt=Ut[1],Vt=Object(S.useRef)();function ti(){return Ue||Xe}function yi(){var oi;(oi=wt.current)===null||oi===void 0||oi.forceAlign()}function wi(oi,Ci){var bi=Ve(Ci);It!==bi&&ri(bi),qt==="align"&&(It!==bi?Promise.resolve().then(function(){yi()}):Bt(function(){var pi;(pi=Vt.current)===null||pi===void 0||pi.call(Vt)}),tt==null||tt(oi,Ci))}var ai=Object(U.a)({},P(ie));["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach(function(oi){var Ci=ai[oi];ai[oi]=function(bi,pi){return Bt(),Ci==null?void 0:Ci(bi,pi)}});function Ri(){return new Promise(function(oi){Vt.current=oi})}S.useEffect(function(){!ai.motionName&&qt==="motion"&&Bt()},[ai.motionName,qt]),S.useImperativeHandle(ge,function(){return{forceAlign:yi,getElement:function(){return Ct.current}}});var ki=Object(U.a)(Object(U.a)({},ht),{},{zIndex:se,opacity:qt==="motion"||qt==="stable"||!be?void 0:0,pointerEvents:qt==="stable"?void 0:"none"},ee),Li=!0;(Ce==null?void 0:Ce.points)&&(qt==="align"||qt==="stable")&&(Li=!1);var Di=V;return S.Children.count(V)>1&&(Di=S.createElement("div",{className:"".concat(oe,"-content")},V)),S.createElement(W,Object(p.a)({visible:be,ref:Ct,leavedClassName:"".concat(oe,"-hidden")},ai,{onAppearPrepare:Ri,onEnterPrepare:Ri,removeOnLeave:Ee,forceRender:ve}),function(oi,Ci){var bi=oi.className,pi=oi.style,Gi=N()(oe,G,It,bi);return S.createElement(Fe.a,{target:ti(),key:"popup",ref:wt,monitorWindowResize:!0,disabled:Li,align:Ce,onAlign:wi},S.createElement("div",{ref:Ci,className:Gi,onMouseEnter:mt,onMouseLeave:Ot,onMouseDownCapture:xt,onTouchStartCapture:Rt,style:Object(U.a)(Object(U.a)({},pi),ki)},Di))})});Oi.displayName="PopupInner";var Ui=Oi,ci=S.forwardRef(function(ie,ge){var be=ie.prefixCls,oe=ie.visible,G=ie.zIndex,ee=ie.children,V=ie.mobile;V=V===void 0?{}:V;var se=V.popupClassName,ue=V.popupStyle,Ee=V.popupMotion,ve=Ee===void 0?{}:Ee,Ce=V.popupRender,Ue=S.useRef();S.useImperativeHandle(ge,function(){return{forceAlign:function(){},getElement:function(){return Ue.current}}});var Xe=Object(U.a)({zIndex:G},ue),Ve=ee;return S.Children.count(ee)>1&&(Ve=S.createElement("div",{className:"".concat(be,"-content")},ee)),Ce&&(Ve=Ce(Ve)),S.createElement(W,Object(p.a)({visible:oe,ref:Ue,removeOnLeave:!0},ve),function(tt,mt){var Ot=tt.className,xt=tt.style,Rt=N()(be,se,Ot);return S.createElement("div",{ref:mt,className:Rt,style:Object(U.a)(Object(U.a)({},xt),Xe)},Ve)})});ci.displayName="MobilePopupInner";var Mi=ci,un=["visible","mobile"],$i=S.forwardRef(function(ie,ge){var be=ie.visible,oe=ie.mobile,G=Object(w.a)(ie,un),ee=Object(S.useState)(be),V=Object(F.a)(ee,2),se=V[0],ue=V[1],Ee=Object(S.useState)(!1),ve=Object(F.a)(Ee,2),Ce=ve[0],Ue=ve[1],Xe=Object(U.a)(Object(U.a)({},G),{},{visible:se});Object(S.useEffect)(function(){ue(be),be&&oe&&Ue(ne())},[be,oe]);var Ve=Ce?S.createElement(Mi,Object(p.a)({},Xe,{mobile:oe,ref:ge})):S.createElement(Ui,Object(p.a)({},Xe,{ref:ge}));return S.createElement("div",null,S.createElement(pe,Xe),Ve)});$i.displayName="Popup";var Ki=$i,Bi=S.createContext(null),en=Bi;function ut(){}function dt(){return""}function Tt(ie){return ie?ie.ownerDocument:window.document}var kt=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];function si(ie){var ge=function(be){Object(c.a)(G,be);var oe=Object(r.a)(G);function G(ee){var V;Object(b.a)(this,G),V=oe.call(this,ee),V.popupRef=S.createRef(),V.triggerRef=S.createRef(),V.attachId=void 0,V.clickOutsideHandler=void 0,V.touchOutsideHandler=void 0,V.contextMenuOutsideHandler1=void 0,V.contextMenuOutsideHandler2=void 0,V.mouseDownTimeout=void 0,V.focusTime=void 0,V.preClickTime=void 0,V.preTouchTime=void 0,V.delayTimer=void 0,V.hasPopupMouseDown=void 0,V.onMouseEnter=function(ue){var Ee=V.props.mouseEnterDelay;V.fireEvents("onMouseEnter",ue),V.delaySetPopupVisible(!0,Ee,Ee?null:ue)},V.onMouseMove=function(ue){V.fireEvents("onMouseMove",ue),V.setPoint(ue)},V.onMouseLeave=function(ue){V.fireEvents("onMouseLeave",ue),V.delaySetPopupVisible(!1,V.props.mouseLeaveDelay)},V.onPopupMouseEnter=function(){V.clearDelayTimer()},V.onPopupMouseLeave=function(ue){var Ee;if(ue.relatedTarget&&!ue.relatedTarget.setTimeout&&Object(et.a)((Ee=V.popupRef.current)===null||Ee===void 0?void 0:Ee.getElement(),ue.relatedTarget))return;V.delaySetPopupVisible(!1,V.props.mouseLeaveDelay)},V.onFocus=function(ue){V.fireEvents("onFocus",ue),V.clearDelayTimer(),V.isFocusToShow()&&(V.focusTime=Date.now(),V.delaySetPopupVisible(!0,V.props.focusDelay))},V.onMouseDown=function(ue){V.fireEvents("onMouseDown",ue),V.preClickTime=Date.now()},V.onTouchStart=function(ue){V.fireEvents("onTouchStart",ue),V.preTouchTime=Date.now()},V.onBlur=function(ue){V.fireEvents("onBlur",ue),V.clearDelayTimer(),V.isBlurToHide()&&V.delaySetPopupVisible(!1,V.props.blurDelay)},V.onContextMenu=function(ue){ue.preventDefault(),V.fireEvents("onContextMenu",ue),V.setPopupVisible(!0,ue)},V.onContextMenuClose=function(){V.isContextMenuToShow()&&V.close()},V.onClick=function(ue){if(V.fireEvents("onClick",ue),V.focusTime){var Ee;if(V.preClickTime&&V.preTouchTime?Ee=Math.min(V.preClickTime,V.preTouchTime):V.preClickTime?Ee=V.preClickTime:V.preTouchTime&&(Ee=V.preTouchTime),Math.abs(Ee-V.focusTime)<20)return;V.focusTime=0}V.preClickTime=0,V.preTouchTime=0,V.isClickToShow()&&(V.isClickToHide()||V.isBlurToHide())&&ue&&ue.preventDefault&&ue.preventDefault();var ve=!V.state.popupVisible;(V.isClickToHide()&&!ve||ve&&V.isClickToShow())&&V.setPopupVisible(!V.state.popupVisible,ue)},V.onPopupMouseDown=function(){if(V.hasPopupMouseDown=!0,clearTimeout(V.mouseDownTimeout),V.mouseDownTimeout=window.setTimeout(function(){V.hasPopupMouseDown=!1},0),V.context){var ue;(ue=V.context).onPopupMouseDown.apply(ue,arguments)}},V.onDocumentClick=function(ue){if(V.props.mask&&!V.props.maskClosable)return;var Ee=ue.target,ve=V.getRootDomNode(),Ce=V.getPopupDomNode();(!Object(et.a)(ve,Ee)||V.isContextMenuOnly())&&!Object(et.a)(Ce,Ee)&&!V.hasPopupMouseDown&&V.close()},V.getRootDomNode=function(){var ue=V.props.getTriggerDOMNode;if(ue)return ue(V.triggerRef.current);try{var Ee=Object(Je.a)(V.triggerRef.current);if(Ee)return Ee}catch(ve){}return Se.a.findDOMNode(Object(a.a)(V))},V.getPopupClassNameFromAlign=function(ue){var Ee=[],ve=V.props,Ce=ve.popupPlacement,Ue=ve.builtinPlacements,Xe=ve.prefixCls,Ve=ve.alignPoint,tt=ve.getPopupClassNameFromAlign;return Ce&&Ue&&Ee.push(Ge(Ue,Xe,ue,Ve)),tt&&Ee.push(tt(ue)),Ee.join(" ")},V.getComponent=function(){var ue=V.props,Ee=ue.prefixCls,ve=ue.destroyPopupOnHide,Ce=ue.popupClassName,Ue=ue.onPopupAlign,Xe=ue.popupMotion,Ve=ue.popupAnimation,tt=ue.popupTransitionName,mt=ue.popupStyle,Ot=ue.mask,xt=ue.maskAnimation,Rt=ue.maskTransitionName,wt=ue.maskMotion,Ct=ue.zIndex,At=ue.popup,Nt=ue.stretch,It=ue.alignPoint,ri=ue.mobile,Kt=ue.forceRender,ft=V.state,ht=ft.popupVisible,Lt=ft.point,Mt=V.getPopupAlign(),ot={};return V.isMouseEnterToShow()&&(ot.onMouseEnter=V.onPopupMouseEnter),V.isMouseLeaveToHide()&&(ot.onMouseLeave=V.onPopupMouseLeave),ot.onMouseDown=V.onPopupMouseDown,ot.onTouchStart=V.onPopupMouseDown,S.createElement(Ki,Object(p.a)({prefixCls:Ee,destroyPopupOnHide:ve,visible:ht,point:It&&Lt,className:Ce,align:Mt,onAlign:Ue,animation:Ve,getClassNameFromAlign:V.getPopupClassNameFromAlign},ot,{stretch:Nt,getRootDomNode:V.getRootDomNode,style:mt,mask:Ot,zIndex:Ct,transitionName:tt,maskAnimation:xt,maskTransitionName:Rt,maskMotion:wt,ref:V.popupRef,motion:Xe,mobile:ri,forceRender:Kt}),typeof At=="function"?At():At)},V.attachParent=function(ue){je.a.cancel(V.attachId);var Ee=V.props,ve=Ee.getPopupContainer,Ce=Ee.getDocument,Ue=V.getRootDomNode(),Xe;ve?(Ue||ve.length===0)&&(Xe=ve(Ue)):Xe=Ce(V.getRootDomNode()).body,Xe?Xe.appendChild(ue):V.attachId=Object(je.a)(function(){V.attachParent(ue)})},V.getContainer=function(){var ue=V.props.getDocument,Ee=ue(V.getRootDomNode()).createElement("div");return Ee.style.position="absolute",Ee.style.top="0",Ee.style.left="0",Ee.style.width="100%",V.attachParent(Ee),Ee},V.setPoint=function(ue){var Ee=V.props.alignPoint;if(!Ee||!ue)return;V.setState({point:{pageX:ue.pageX,pageY:ue.pageY}})},V.handlePortalUpdate=function(){V.state.prevPopupVisible!==V.state.popupVisible&&V.props.afterPopupVisibleChange(V.state.popupVisible)},V.triggerContextValue={onPopupMouseDown:V.onPopupMouseDown};var se;return"popupVisible"in ee?se=!!ee.popupVisible:se=!!ee.defaultPopupVisible,V.state={prevPopupVisible:se,popupVisible:se},kt.forEach(function(ue){V["fire".concat(ue)]=function(Ee){V.fireEvents(ue,Ee)}}),V}return Object(_.a)(G,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var V=this.props,se=this.state;if(se.popupVisible){var ue;!this.clickOutsideHandler&&(this.isClickToHide()||this.isContextMenuToShow())&&(ue=V.getDocument(this.getRootDomNode()),this.clickOutsideHandler=Object(We.a)(ue,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(ue=ue||V.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Object(We.a)(ue,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(ue=ue||V.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=Object(We.a)(ue,"scroll",this.onContextMenuClose)),!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=Object(We.a)(window,"blur",this.onContextMenuClose));return}this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),je.a.cancel(this.attachId)}},{key:"getPopupDomNode",value:function(){var V;return((V=this.popupRef.current)===null||V===void 0?void 0:V.getElement())||null}},{key:"getPopupAlign",value:function(){var V=this.props,se=V.popupPlacement,ue=V.popupAlign,Ee=V.builtinPlacements;return se&&Ee?De(Ee,se,ue):ue}},{key:"setPopupVisible",value:function(V,se){var ue=this.props.alignPoint,Ee=this.state.popupVisible;this.clearDelayTimer(),Ee!==V&&("popupVisible"in this.props||this.setState({popupVisible:V,prevPopupVisible:Ee}),this.props.onPopupVisibleChange(V)),ue&&se&&V&&this.setPoint(se)}},{key:"delaySetPopupVisible",value:function(V,se,ue){var Ee=this,ve=se*1e3;if(this.clearDelayTimer(),ve){var Ce=ue?{pageX:ue.pageX,pageY:ue.pageY}:null;this.delayTimer=window.setTimeout(function(){Ee.setPopupVisible(V,Ce),Ee.clearDelayTimer()},ve)}else this.setPopupVisible(V,ue)}},{key:"clearDelayTimer",value:function(){this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null)}},{key:"clearOutsideHandler",value:function(){this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.clickOutsideHandler=null),this.contextMenuOutsideHandler1&&(this.contextMenuOutsideHandler1.remove(),this.contextMenuOutsideHandler1=null),this.contextMenuOutsideHandler2&&(this.contextMenuOutsideHandler2.remove(),this.contextMenuOutsideHandler2=null),this.touchOutsideHandler&&(this.touchOutsideHandler.remove(),this.touchOutsideHandler=null)}},{key:"createTwoChains",value:function(V){var se=this.props.children.props,ue=this.props;return se[V]&&ue[V]?this["fire".concat(V)]:se[V]||ue[V]}},{key:"isClickToShow",value:function(){var V=this.props,se=V.action,ue=V.showAction;return se.indexOf("click")!==-1||ue.indexOf("click")!==-1}},{key:"isContextMenuOnly",value:function(){var V=this.props.action;return V==="contextMenu"||V.length===1&&V[0]==="contextMenu"}},{key:"isContextMenuToShow",value:function(){var V=this.props,se=V.action,ue=V.showAction;return se.indexOf("contextMenu")!==-1||ue.indexOf("contextMenu")!==-1}},{key:"isClickToHide",value:function(){var V=this.props,se=V.action,ue=V.hideAction;return se.indexOf("click")!==-1||ue.indexOf("click")!==-1}},{key:"isMouseEnterToShow",value:function(){var V=this.props,se=V.action,ue=V.showAction;return se.indexOf("hover")!==-1||ue.indexOf("mouseEnter")!==-1}},{key:"isMouseLeaveToHide",value:function(){var V=this.props,se=V.action,ue=V.hideAction;return se.indexOf("hover")!==-1||ue.indexOf("mouseLeave")!==-1}},{key:"isFocusToShow",value:function(){var V=this.props,se=V.action,ue=V.showAction;return se.indexOf("focus")!==-1||ue.indexOf("focus")!==-1}},{key:"isBlurToHide",value:function(){var V=this.props,se=V.action,ue=V.hideAction;return se.indexOf("focus")!==-1||ue.indexOf("blur")!==-1}},{key:"forcePopupAlign",value:function(){if(this.state.popupVisible){var V;(V=this.popupRef.current)===null||V===void 0||V.forceAlign()}}},{key:"fireEvents",value:function(V,se){var ue=this.props.children.props[V];ue&&ue(se);var Ee=this.props[V];Ee&&Ee(se)}},{key:"close",value:function(){this.setPopupVisible(!1)}},{key:"render",value:function(){var V=this.state.popupVisible,se=this.props,ue=se.children,Ee=se.forceRender,ve=se.alignPoint,Ce=se.className,Ue=se.autoDestroy,Xe=S.Children.only(ue),Ve={key:"trigger"};this.isContextMenuToShow()?Ve.onContextMenu=this.onContextMenu:Ve.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(Ve.onClick=this.onClick,Ve.onMouseDown=this.onMouseDown,Ve.onTouchStart=this.onTouchStart):(Ve.onClick=this.createTwoChains("onClick"),Ve.onMouseDown=this.createTwoChains("onMouseDown"),Ve.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(Ve.onMouseEnter=this.onMouseEnter,ve&&(Ve.onMouseMove=this.onMouseMove)):Ve.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?Ve.onMouseLeave=this.onMouseLeave:Ve.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(Ve.onFocus=this.onFocus,Ve.onBlur=this.onBlur):(Ve.onFocus=this.createTwoChains("onFocus"),Ve.onBlur=this.createTwoChains("onBlur"));var tt=N()(Xe&&Xe.props&&Xe.props.className,Ce);tt&&(Ve.className=tt);var mt=Object(U.a)({},Ve);Object(Ze.c)(Xe)&&(mt.ref=Object(Ze.a)(this.triggerRef,Xe.ref));var Ot=S.cloneElement(Xe,mt),xt;return(V||this.popupRef.current||Ee)&&(xt=S.createElement(ie,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!V&&Ue&&(xt=null),S.createElement(en.Provider,{value:this.triggerContextValue},Ot,xt)}}],[{key:"getDerivedStateFromProps",value:function(V,se){var ue=V.popupVisible,Ee={};return ue!==void 0&&se.popupVisible!==ue&&(Ee.popupVisible=ue,Ee.prevPopupVisible=se.popupVisible),Ee}}]),G}(S.Component);return ge.contextType=en,ge.defaultProps={prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:dt,getDocument:Tt,onPopupVisibleChange:ut,afterPopupVisibleChange:ut,onPopupAlign:ut,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[],autoDestroy:!1},ge}var $t=si(nt.a),vi={adjustX:1,adjustY:1},tn={topLeft:{points:["bl","tl"],overflow:vi,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:vi,offset:[0,7]},leftTop:{points:["tr","tl"],overflow:vi,offset:[-4,0]},rightTop:{points:["tl","tr"],overflow:vi,offset:[4,0]}},xn={topLeft:{points:["bl","tl"],overflow:vi,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:vi,offset:[0,7]},rightTop:{points:["tr","tl"],overflow:vi,offset:[-4,0]},leftTop:{points:["tl","tr"],overflow:vi,offset:[4,0]}},Bn=tn,hi=0,zt={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"},fi=function(ge,be,oe){var G=Te(be),ee=ge.getState();ge.setState({defaultActiveFirst:Object(U.a)(Object(U.a)({},ee.defaultActiveFirst),{},Object(_e.a)({},G,oe))})},Ft=function(ie){Object(c.a)(be,ie);var ge=Object(r.a)(be);function be(oe){var G;Object(b.a)(this,be),G=ge.call(this,oe),G.onDestroy=function(ve){G.props.onDestroy(ve)},G.onKeyDown=function(ve){var Ce=ve.keyCode,Ue=G.menuInstance,Xe=G.props.store,Ve=G.getVisible();if(Ce===d.a.ENTER)return G.onTitleClick(ve),fi(Xe,G.props.eventKey,!0),!0;if(Ce===d.a.RIGHT)return Ve?Ue.onKeyDown(ve):(G.triggerOpenChange(!0),fi(Xe,G.props.eventKey,!0)),!0;if(Ce===d.a.LEFT){var tt;if(Ve)tt=Ue.onKeyDown(ve);else return;return tt||(G.triggerOpenChange(!1),tt=!0),tt}return Ve&&(Ce===d.a.UP||Ce===d.a.DOWN)?Ue.onKeyDown(ve):void 0},G.onOpenChange=function(ve){G.props.onOpenChange(ve)},G.onPopupVisibleChange=function(ve){G.triggerOpenChange(ve,ve?"mouseenter":"mouseleave")},G.onMouseEnter=function(ve){var Ce=G.props,Ue=Ce.eventKey,Xe=Ce.onMouseEnter,Ve=Ce.store;fi(Ve,G.props.eventKey,!1),Xe({key:Ue,domEvent:ve})},G.onMouseLeave=function(ve){var Ce=G.props,Ue=Ce.parentMenu,Xe=Ce.eventKey,Ve=Ce.onMouseLeave;Ue.subMenuInstance=Object(a.a)(G),Ve({key:Xe,domEvent:ve})},G.onTitleMouseEnter=function(ve){var Ce=G.props,Ue=Ce.eventKey,Xe=Ce.onItemHover,Ve=Ce.onTitleMouseEnter;Xe({key:Ue,hover:!0}),Ve({key:Ue,domEvent:ve})},G.onTitleMouseLeave=function(ve){var Ce=G.props,Ue=Ce.parentMenu,Xe=Ce.eventKey,Ve=Ce.onItemHover,tt=Ce.onTitleMouseLeave;Ue.subMenuInstance=Object(a.a)(G),Ve({key:Xe,hover:!1}),tt({key:Xe,domEvent:ve})},G.onTitleClick=function(ve){var Ce=Object(a.a)(G),Ue=Ce.props;if(Ue.onTitleClick({key:Ue.eventKey,domEvent:ve}),Ue.triggerSubMenuAction==="hover")return;G.triggerOpenChange(!G.getVisible(),"click"),fi(Ue.store,G.props.eventKey,!1)},G.onSubMenuClick=function(ve){typeof G.props.onClick=="function"&&G.props.onClick(G.addKeyPath(ve))},G.onSelect=function(ve){G.props.onSelect(ve)},G.onDeselect=function(ve){G.props.onDeselect(ve)},G.getPrefixCls=function(){return"".concat(G.props.rootPrefixCls,"-submenu")},G.getActiveClassName=function(){return"".concat(G.getPrefixCls(),"-active")},G.getDisabledClassName=function(){return"".concat(G.getPrefixCls(),"-disabled")},G.getSelectedClassName=function(){return"".concat(G.getPrefixCls(),"-selected")},G.getOpenClassName=function(){return"".concat(G.props.rootPrefixCls,"-submenu-open")},G.getVisible=function(){return G.state.isOpen},G.getMode=function(){return G.state.mode},G.saveMenuInstance=function(ve){G.menuInstance=ve},G.addKeyPath=function(ve){return Object(U.a)(Object(U.a)({},ve),{},{keyPath:(ve.keyPath||[]).concat(G.props.eventKey)})},G.triggerOpenChange=function(ve,Ce){var Ue=G.props.eventKey,Xe=function(){G.onOpenChange({key:Ue,item:Object(a.a)(G),trigger:Ce,open:ve})};Ce==="mouseenter"?G.mouseenterTimeout=setTimeout(function(){Xe()},0):Xe()},G.isChildrenSelected=function(){var ve={find:!1};return Ie(G.props.children,G.props.selectedKeys,ve),ve.find},G.isInlineMode=function(){return G.getMode()==="inline"},G.adjustWidth=function(){if(!G.subMenuTitle||!G.menuInstance)return;var ve=Ke.findDOMNode(G.menuInstance);if(ve.offsetWidth>=G.subMenuTitle.offsetWidth)return;ve.style.minWidth="".concat(G.subMenuTitle.offsetWidth,"px")},G.saveSubMenuTitle=function(ve){G.subMenuTitle=ve},G.getBaseProps=function(){var ve=Object(a.a)(G),Ce=ve.props,Ue=G.getMode();return{mode:Ue==="horizontal"?"vertical":Ue,visible:G.getVisible(),level:Ce.level+1,inlineIndent:Ce.inlineIndent,focusable:!1,onClick:G.onSubMenuClick,onSelect:G.onSelect,onDeselect:G.onDeselect,onDestroy:G.onDestroy,selectedKeys:Ce.selectedKeys,eventKey:"".concat(Ce.eventKey,"-menu-"),openKeys:Ce.openKeys,motion:Ce.motion,onOpenChange:G.onOpenChange,subMenuOpenDelay:Ce.subMenuOpenDelay,parentMenu:Object(a.a)(G),subMenuCloseDelay:Ce.subMenuCloseDelay,forceSubMenuRender:Ce.forceSubMenuRender,triggerSubMenuAction:Ce.triggerSubMenuAction,builtinPlacements:Ce.builtinPlacements,defaultActiveFirst:Ce.store.getState().defaultActiveFirst[Te(Ce.eventKey)],multiple:Ce.multiple,prefixCls:Ce.rootPrefixCls,id:G.internalMenuId,manualRef:G.saveMenuInstance,itemIcon:Ce.itemIcon,expandIcon:Ce.expandIcon,direction:Ce.direction}},G.getMotion=function(ve,Ce){var Ue=Object(a.a)(G),Xe=Ue.haveRendered,Ve=G.props,tt=Ve.motion,mt=Ve.rootPrefixCls,Ot=Object(U.a)(Object(U.a)({},tt),{},{leavedClassName:"".concat(mt,"-hidden"),removeOnLeave:!1,motionAppear:Xe||!Ce||ve!=="inline"});return Ot};var ee=oe.store,V=oe.eventKey,se=ee.getState(),ue=se.defaultActiveFirst;G.isRootMenu=!1;var Ee=!1;return ue&&(Ee=ue[V]),fi(ee,V,Ee),G.state={mode:oe.mode,isOpen:oe.isOpen},G}return Object(_.a)(be,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var G=this,ee=this.props,V=ee.mode,se=ee.parentMenu,ue=ee.manualRef,Ee=ee.isOpen,ve=function(){G.setState({mode:V,isOpen:Ee})},Ce=Ee!==this.state.isOpen,Ue=V!==this.state.mode;if((Ue||Ce)&&(je.a.cancel(this.updateStateRaf),Ue?this.updateStateRaf=Object(je.a)(ve):ve()),ue&&ue(this),V!=="horizontal"||!(se==null?void 0:se.isRootMenu)||!Ee)return;this.minWidthTimeout=setTimeout(function(){return G.adjustWidth()},0)}},{key:"componentWillUnmount",value:function(){var G=this.props,ee=G.onDestroy,V=G.eventKey;ee&&ee(V),this.minWidthTimeout&&clearTimeout(this.minWidthTimeout),this.mouseenterTimeout&&clearTimeout(this.mouseenterTimeout),je.a.cancel(this.updateStateRaf)}},{key:"renderPopupMenu",value:function(G,ee){var V=this.getBaseProps();return S.createElement(Fn,Object(p.a)({},V,{id:this.internalMenuId,className:G,style:ee}),this.props.children)}},{key:"renderChildren",value:function(){var G=this,ee=this.getBaseProps(),V=ee.mode,se=ee.visible,ue=ee.forceSubMenuRender,Ee=ee.direction,ve=this.getMotion(V,se);if(this.haveRendered=!0,this.haveOpened=this.haveOpened||se||ue,!this.haveOpened)return S.createElement("div",null);var Ce=N()("".concat(ee.prefixCls,"-sub"),Object(_e.a)({},"".concat(ee.prefixCls,"-rtl"),Ee==="rtl"));return this.isInlineMode()?S.createElement(W,Object(p.a)({visible:ee.visible,forceRender:ue},ve),function(Ue){var Xe=Ue.className,Ve=Ue.style,tt=N()(Ce,Xe);return G.renderPopupMenu(tt,Ve)}):this.renderPopupMenu(Ce)}},{key:"render",value:function(){var G,ee,V,se=Object(U.a)({},this.props),ue=this.getVisible(),Ee=this.getPrefixCls(),ve=this.isInlineMode(),Ce=this.getMode(),Ue=N()(Ee,"".concat(Ee,"-").concat(Ce),(G={},Object(_e.a)(G,se.className,!!se.className),Object(_e.a)(G,this.getOpenClassName(),ue),Object(_e.a)(G,this.getActiveClassName(),se.active||ue&&!ve),Object(_e.a)(G,this.getDisabledClassName(),se.disabled),Object(_e.a)(G,this.getSelectedClassName(),this.isChildrenSelected()),G));this.internalMenuId||(se.eventKey?this.internalMenuId="".concat(se.eventKey,"$Menu"):(hi+=1,this.internalMenuId="$__$".concat(hi,"$Menu")));var Xe={},Ve={},tt={};se.disabled||(Xe={onMouseLeave:this.onMouseLeave,onMouseEnter:this.onMouseEnter},Ve={onClick:this.onTitleClick},tt={onMouseEnter:this.onTitleMouseEnter,onMouseLeave:this.onTitleMouseLeave});var mt={},Ot=se.direction,xt=Ot==="rtl";ve&&(xt?mt.paddingRight=se.inlineIndent*se.level:mt.paddingLeft=se.inlineIndent*se.level);var Rt={};this.getVisible()&&(Rt={"aria-owns":this.internalMenuId});var wt=null;Ce!=="horizontal"&&(wt=this.props.expandIcon,typeof this.props.expandIcon=="function"&&(wt=S.createElement(this.props.expandIcon,Object(U.a)({},this.props))));var Ct=S.createElement("div",Object(p.a)({ref:this.saveSubMenuTitle,style:mt,className:"".concat(Ee,"-title"),role:"button"},tt,Ve,{"aria-expanded":ue},Rt,{"aria-haspopup":"true",title:typeof se.title=="string"?se.title:void 0}),se.title,wt||S.createElement("i",{className:"".concat(Ee,"-arrow")})),At=this.renderChildren(),Nt=((ee=se.parentMenu)===null||ee===void 0?void 0:ee.isRootMenu)?se.parentMenu.props.getPopupContainer:function(ti){return ti.parentNode},It=zt[Ce],ri=se.popupOffset?{offset:se.popupOffset}:{},Kt=N()((V={},Object(_e.a)(V,se.popupClassName,se.popupClassName&&!ve),Object(_e.a)(V,"".concat(Ee,"-rtl"),xt),V)),ft=se.disabled,ht=se.triggerSubMenuAction,Lt=se.subMenuOpenDelay,Mt=se.forceSubMenuRender,ot=se.subMenuCloseDelay,Ut=se.builtinPlacements;Me.forEach(function(ti){return delete se[ti]}),delete se.onClick;var qt=xt?Object(U.a)(Object(U.a)({},xn),Ut):Object(U.a)(Object(U.a)({},tn),Ut);delete se.direction;var Bt=this.getBaseProps(),Vt=ve?null:this.getMotion(Bt.mode,Bt.visible);return S.createElement("li",Object(p.a)({},se,Xe,{className:Ue,role:"menuitem"}),S.createElement($t,{prefixCls:Ee,popupClassName:N()("".concat(Ee,"-popup"),Kt),getPopupContainer:Nt,builtinPlacements:qt,popupPlacement:It,popupVisible:ve?!1:ue,popupAlign:ri,popup:ve?null:At,action:ft||ve?[]:[ht],mouseEnterDelay:Lt,mouseLeaveDelay:ot,onPopupVisibleChange:this.onPopupVisibleChange,forceRender:Mt,popupMotion:Vt},Ct),ve?At:null)}}]),be}(S.Component);Ft.defaultProps={onMouseEnter:xe,onMouseLeave:xe,onTitleMouseEnter:xe,onTitleMouseLeave:xe,onTitleClick:xe,manualRef:xe,mode:"vertical",title:""};var Si=Object(l.b)(function(ie,ge){var be=ie.openKeys,oe=ie.activeKey,G=ie.selectedKeys,ee=ge.eventKey,V=ge.subMenuKey;return{isOpen:be.indexOf(ee)>-1,active:oe[V]===ee,selectedKeys:G}})(Ft);Si.isSubMenu=!0;var ni=Si,nn="menuitem-overflowed",_i=.5,dn=function(ie){Object(c.a)(be,ie);var ge=Object(r.a)(be);function be(){var oe;return Object(b.a)(this,be),oe=ge.apply(this,arguments),oe.resizeObserver=null,oe.mutationObserver=null,oe.originalTotalWidth=0,oe.overflowedItems=[],oe.menuItemSizes=[],oe.cancelFrameId=null,oe.state={lastVisibleIndex:void 0},oe.childRef=S.createRef(),oe.getMenuItemNodes=function(){var G=oe.props.prefixCls,ee=oe.childRef.current;return ee?[].slice.call(ee.children).filter(function(V){return V.className.split(" ").indexOf("".concat(G,"-overflowed-submenu"))<0}):[]},oe.getOverflowedSubMenuItem=function(G,ee,V){var se=oe.props,ue=se.overflowedIndicator,Ee=se.level,ve=se.mode,Ce=se.prefixCls,Ue=se.theme;if(Ee!==1||ve!=="horizontal")return null;var Xe=oe.props.children[0],Ve=Xe.props,tt=Ve.children,mt=Ve.title,Ot=Ve.style,xt=Object(w.a)(Ve,["children","title","style"]),Rt=Object(U.a)({},Ot),wt="".concat(G,"-overflowed-indicator"),Ct="".concat(G,"-overflowed-indicator");ee.length===0&&V!==!0?Rt=Object(U.a)(Object(U.a)({},Rt),{},{display:"none"}):V&&(Rt=Object(U.a)(Object(U.a)({},Rt),{},{visibility:"hidden",position:"absolute"}),wt="".concat(wt,"-placeholder"),Ct="".concat(Ct,"-placeholder"));var At=Ue?"".concat(Ce,"-").concat(Ue):"",Nt={};return Me.forEach(function(It){xt[It]!==void 0&&(Nt[It]=xt[It])}),S.createElement(ni,Object(p.a)({title:ue,className:"".concat(Ce,"-overflowed-submenu"),popupClassName:At},Nt,{key:wt,eventKey:Ct,disabled:!1,style:Rt}),ee)},oe.setChildrenWidthAndResize=function(){if(oe.props.mode!=="horizontal")return;var G=oe.childRef.current;if(!G)return;var ee=G.children;if(!ee||ee.length===0)return;var V=G.children[ee.length-1];Be(V,"display","inline-block");var se=oe.getMenuItemNodes(),ue=se.filter(function(Ee){return Ee.className.split(" ").indexOf(nn)>=0});ue.forEach(function(Ee){Be(Ee,"display","inline-block")}),oe.menuItemSizes=se.map(function(Ee){return Ne(Ee,!0)}),ue.forEach(function(Ee){Be(Ee,"display","none")}),oe.overflowedIndicatorWidth=Ne(G.children[G.children.length-1],!0),oe.originalTotalWidth=oe.menuItemSizes.reduce(function(Ee,ve){return Ee+ve},0),oe.handleResize(),Be(V,"display","none")},oe.handleResize=function(){if(oe.props.mode!=="horizontal")return;var G=oe.childRef.current;if(!G)return;var ee=Ne(G);oe.overflowedItems=[];var V=0,se;oe.originalTotalWidth>ee+_i&&(se=-1,oe.menuItemSizes.forEach(function(ue){V+=ue,V+oe.overflowedIndicatorWidth<=ee&&(se+=1)})),oe.setState({lastVisibleIndex:se})},oe}return Object(_.a)(be,[{key:"componentDidMount",value:function(){var G=this;if(this.setChildrenWidthAndResize(),this.props.level===1&&this.props.mode==="horizontal"){var ee=this.childRef.current;if(!ee)return;this.resizeObserver=new Ye.default(function(V){V.forEach(function(){var se=G.cancelFrameId;cancelAnimationFrame(se),G.cancelFrameId=requestAnimationFrame(G.setChildrenWidthAndResize)})}),[].slice.call(ee.children).concat(ee).forEach(function(V){G.resizeObserver.observe(V)}),typeof MutationObserver!="undefined"&&(this.mutationObserver=new MutationObserver(function(){G.resizeObserver.disconnect(),[].slice.call(ee.children).concat(ee).forEach(function(V){G.resizeObserver.observe(V)}),G.setChildrenWidthAndResize()}),this.mutationObserver.observe(ee,{attributes:!1,childList:!0,subTree:!1}))}}},{key:"componentWillUnmount",value:function(){this.resizeObserver&&this.resizeObserver.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),cancelAnimationFrame(this.cancelFrameId)}},{key:"renderChildren",value:function(G){var ee=this,V=this.state.lastVisibleIndex;return(G||[]).reduce(function(se,ue,Ee){var ve=ue;if(ee.props.mode==="horizontal"){var Ce=ee.getOverflowedSubMenuItem(ue.props.eventKey,[]);V!==void 0&&ee.props.className.indexOf("".concat(ee.props.prefixCls,"-root"))!==-1&&(Ee>V&&(ve=S.cloneElement(ue,{style:{display:"none"},eventKey:"".concat(ue.props.eventKey,"-hidden"),className:"".concat(nn)})),Ee===V+1&&(ee.overflowedItems=G.slice(V+1).map(function(Xe){return S.cloneElement(Xe,{key:Xe.props.eventKey,mode:"vertical-left"})}),Ce=ee.getOverflowedSubMenuItem(ue.props.eventKey,ee.overflowedItems)));var Ue=[].concat(Object(C.a)(se),[Ce,ve]);return Ee===G.length-1&&Ue.push(ee.getOverflowedSubMenuItem(ue.props.eventKey,[],!0)),Ue}return[].concat(Object(C.a)(se),[ve])},[])}},{key:"render",value:function(){var G=this.props,ee=G.visible,V=G.prefixCls,se=G.overflowedIndicator,ue=G.mode,Ee=G.level,ve=G.tag,Ce=G.children,Ue=G.theme,Xe=Object(w.a)(G,["visible","prefixCls","overflowedIndicator","mode","level","tag","children","theme"]),Ve=ve;return S.createElement(Ve,Object(p.a)({ref:this.childRef},Xe),this.renderChildren(Ce))}}]),be}(S.Component);dn.defaultProps={tag:"div",className:""};var Sn=dn;function Cn(ie){return ie.length?ie.every(function(ge){return!!ge.props.disabled}):!0}function yn(ie,ge,be){var oe=ie.getState();ie.setState({activeKey:Object(U.a)(Object(U.a)({},oe.activeKey),{},Object(_e.a)({},ge,be))})}function rn(ie){return ie.eventKey||"0-menu-"}function bn(ie,ge){var be=ge,oe=ie.children,G=ie.eventKey;if(be){var ee;if(Oe(oe,function(V,se){V&&V.props&&!V.props.disabled&&be===Re(V,G,se)&&(ee=!0)}),ee)return be}return be=null,ie.defaultActiveFirst&&Oe(oe,function(V,se){!be&&V&&!V.props.disabled&&(be=Re(V,G,se))}),be}function Tr(ie){if(!ie)return;var ge=this.instanceArray.indexOf(ie);ge!==-1?this.instanceArray[ge]=ie:this.instanceArray.push(ie)}var jn=function(ie){Object(c.a)(be,ie);var ge=Object(r.a)(be);function be(oe){var G;return Object(b.a)(this,be),G=ge.call(this,oe),G.onKeyDown=function(ee,V){var se=ee.keyCode,ue;if(G.getFlatInstanceArray().forEach(function(ve){ve&&ve.props.active&&ve.onKeyDown&&(ue=ve.onKeyDown(ee))}),ue)return 1;var Ee=null;return(se===d.a.UP||se===d.a.DOWN)&&(Ee=G.step(se===d.a.UP?-1:1)),Ee?(ee.preventDefault(),yn(G.props.store,rn(G.props),Ee.props.eventKey),typeof V=="function"&&V(Ee),1):void 0},G.onItemHover=function(ee){var V=ee.key,se=ee.hover;yn(G.props.store,rn(G.props),se?V:null)},G.onDeselect=function(ee){G.props.onDeselect(ee)},G.onSelect=function(ee){G.props.onSelect(ee)},G.onClick=function(ee){G.props.onClick(ee)},G.onOpenChange=function(ee){G.props.onOpenChange(ee)},G.onDestroy=function(ee){G.props.onDestroy(ee)},G.getFlatInstanceArray=function(){return G.instanceArray},G.step=function(ee){var V=G.getFlatInstanceArray(),se=G.props.store.getState().activeKey[rn(G.props)],ue=V.length;if(!ue)return null;ee<0&&(V=V.concat().reverse());var Ee=-1;if(V.every(function(Xe,Ve){return Xe&&Xe.props.eventKey===se?(Ee=Ve,!1):!0}),!G.props.defaultActiveFirst&&Ee!==-1&&Cn(V.slice(Ee,ue-1)))return;var ve=(Ee+1)%ue,Ce=ve;do{var Ue=V[Ce];if(!Ue||Ue.props.disabled)Ce=(Ce+1)%ue;else return Ue}while(Ce!==ve);return null},G.renderCommonMenuItem=function(ee,V,se){var ue=G.props.store.getState(),Ee=Object(a.a)(G),ve=Ee.props,Ce=Re(ee,ve.eventKey,V),Ue=ee.props;if(!Ue||typeof ee.type=="string")return ee;var Xe=Ce===ue.activeKey,Ve=Object(U.a)(Object(U.a)({mode:Ue.mode||ve.mode,level:ve.level,inlineIndent:ve.inlineIndent,renderMenuItem:G.renderMenuItem,rootPrefixCls:ve.prefixCls,index:V,parentMenu:ve.parentMenu,manualRef:Ue.disabled?void 0:Object(f.a)(ee.ref,Tr.bind(Object(a.a)(G))),eventKey:Ce,active:!Ue.disabled&&Xe,multiple:ve.multiple,onClick:function(mt){(Ue.onClick||xe)(mt),G.onClick(mt)},onItemHover:G.onItemHover,motion:ve.motion,subMenuOpenDelay:ve.subMenuOpenDelay,subMenuCloseDelay:ve.subMenuCloseDelay,forceSubMenuRender:ve.forceSubMenuRender,onOpenChange:G.onOpenChange,onDeselect:G.onDeselect,onSelect:G.onSelect,builtinPlacements:ve.builtinPlacements,itemIcon:Ue.itemIcon||G.props.itemIcon,expandIcon:Ue.expandIcon||G.props.expandIcon},se),{},{direction:ve.direction});return(ve.mode==="inline"||Pe())&&(Ve.triggerSubMenuAction="click"),S.cloneElement(ee,Object(U.a)(Object(U.a)({},Ve),{},{key:Ce||V}))},G.renderMenuItem=function(ee,V,se){if(!ee)return null;var ue=G.props.store.getState(),Ee={openKeys:ue.openKeys,selectedKeys:ue.selectedKeys,triggerSubMenuAction:G.props.triggerSubMenuAction,subMenuKey:se};return G.renderCommonMenuItem(ee,V,Ee)},oe.store.setState({activeKey:Object(U.a)(Object(U.a)({},oe.store.getState().activeKey),{},Object(_e.a)({},oe.eventKey,bn(oe,oe.activeKey)))}),G.instanceArray=[],G}return Object(_.a)(be,[{key:"componentDidMount",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"shouldComponentUpdate",value:function(G){return this.props.visible||G.visible||this.props.className!==G.className||!R()(this.props.style,G.style)}},{key:"componentDidUpdate",value:function(G){var ee=this.props,V="activeKey"in ee?ee.activeKey:ee.store.getState().activeKey[rn(ee)],se=bn(ee,V);if(se!==V)yn(ee.store,rn(ee),se);else if("activeKey"in G){var ue=bn(G,G.activeKey);se!==ue&&yn(ee.store,rn(ee),se)}}},{key:"render",value:function(){var G=this,ee=Object(p.a)({},this.props);this.instanceArray=[];var V=N()(ee.prefixCls,ee.className,"".concat(ee.prefixCls,"-").concat(ee.mode)),se={className:V,role:ee.role||"menu"};ee.id&&(se.id=ee.id),ee.focusable&&(se.tabIndex=0,se.onKeyDown=this.onKeyDown);var ue=ee.prefixCls,Ee=ee.eventKey,ve=ee.visible,Ce=ee.level,Ue=ee.mode,Xe=ee.overflowedIndicator,Ve=ee.theme;return Me.forEach(function(tt){return delete ee[tt]}),delete ee.onClick,S.createElement(Sn,Object(p.a)({},ee,{prefixCls:ue,mode:Ue,tag:"ul",level:Ce,theme:Ve,visible:ve,overflowedIndicator:Xe},se),Object(k.a)(ee.children).map(function(tt,mt){return G.renderMenuItem(tt,mt,Ee||"0-menu-")}))}}]),be}(S.Component);jn.defaultProps={prefixCls:"rc-menu",className:"",mode:"vertical",level:1,inlineIndent:24,visible:!0,focusable:!0,style:{},manualRef:xe};var xr=Object(l.b)()(jn),Fn=xr,Sr=z("Kwbf");function Cr(ie,ge,be){var oe=ie.prefixCls,G=ie.motion,ee=ie.defaultMotions,V=ee===void 0?{}:ee,se=ie.openAnimation,ue=ie.openTransitionName,Ee=ge.switchingModeFromInline;if(G)return G;if(Object(O.a)(se)==="object"&&se)Object(Sr.a)(!1,"Object type of `openAnimation` is removed. Please use `motion` instead.");else if(typeof se=="string")return{motionName:"".concat(oe,"-open-").concat(se)};if(ue)return{motionName:ue};var ve=V[be];return ve||(Ee?null:V.other)}var Wn=function(ie){Object(c.a)(be,ie);var ge=Object(r.a)(be);function be(oe){var G;Object(b.a)(this,be),G=ge.call(this,oe),G.onSelect=function(se){var ue=Object(a.a)(G),Ee=ue.props;if(Ee.selectable){var ve=G.store.getState(),Ce=ve.selectedKeys,Ue=se.key;Ee.multiple?Ce=Ce.concat([Ue]):Ce=[Ue],"selectedKeys"in Ee||G.store.setState({selectedKeys:Ce}),Ee.onSelect(Object(U.a)(Object(U.a)({},se),{},{selectedKeys:Ce}))}},G.onClick=function(se){var ue=G.getRealMenuMode(),Ee=Object(a.a)(G),ve=Ee.store,Ce=Ee.props.onOpenChange;ue!=="inline"&&!("openKeys"in G.props)&&(ve.setState({openKeys:[]}),Ce([])),G.props.onClick(se)},G.onKeyDown=function(se,ue){G.innerMenu.getWrappedInstance().onKeyDown(se,ue)},G.onOpenChange=function(se){var ue=Object(a.a)(G),Ee=ue.props,ve=G.store.getState().openKeys.concat(),Ce=!1,Ue=function(Ve){var tt=!1;if(Ve.open)tt=ve.indexOf(Ve.key)===-1,tt&&ve.push(Ve.key);else{var mt=ve.indexOf(Ve.key);tt=mt!==-1,tt&&ve.splice(mt,1)}Ce=Ce||tt};Array.isArray(se)?se.forEach(Ue):Ue(se),Ce&&("openKeys"in G.props||G.store.setState({openKeys:ve}),Ee.onOpenChange(ve))},G.onDeselect=function(se){var ue=Object(a.a)(G),Ee=ue.props;if(Ee.selectable){var ve=G.store.getState().selectedKeys.concat(),Ce=se.key,Ue=ve.indexOf(Ce);Ue!==-1&&ve.splice(Ue,1),"selectedKeys"in Ee||G.store.setState({selectedKeys:ve}),Ee.onDeselect(Object(U.a)(Object(U.a)({},se),{},{selectedKeys:ve}))}},G.onMouseEnter=function(se){G.restoreModeVerticalFromInline();var ue=G.props.onMouseEnter;ue&&ue(se)},G.onTransitionEnd=function(se){var ue=se.propertyName==="width"&&se.target===se.currentTarget,Ee=se.target.className,ve=Object.prototype.toString.call(Ee)==="[object SVGAnimatedString]"?Ee.animVal:Ee,Ce=se.propertyName==="font-size"&&ve.indexOf("anticon")>=0;(ue||Ce)&&G.restoreModeVerticalFromInline()},G.setInnerMenu=function(se){G.innerMenu=se},G.isRootMenu=!0;var ee=oe.defaultSelectedKeys,V=oe.defaultOpenKeys;return"selectedKeys"in oe&&(ee=oe.selectedKeys||[]),"openKeys"in oe&&(V=oe.openKeys||[]),G.store=Object(l.c)({selectedKeys:ee,openKeys:V,activeKey:{"0-menu-":bn(oe,oe.activeKey)}}),G.state={switchingModeFromInline:!1,prevProps:oe,inlineOpenKeys:[],store:G.store},G}return Object(_.a)(be,[{key:"componentDidMount",value:function(){this.updateMiniStore(),this.updateMenuDisplay()}},{key:"componentDidUpdate",value:function(G){var ee=this.props,V=ee.siderCollapsed,se=ee.inlineCollapsed,ue=ee.onOpenChange;(!G.inlineCollapsed&&se||!G.siderCollapsed&&V)&&ue([]),this.updateMiniStore(),this.updateMenuDisplay()}},{key:"updateMenuDisplay",value:function(){var G=this.props.collapsedWidth,ee=this.store,V=this.prevOpenKeys,se=this.getInlineCollapsed()&&(G===0||G==="0"||G==="0px");se?(this.prevOpenKeys=ee.getState().openKeys.concat(),this.store.setState({openKeys:[]})):V&&(this.store.setState({openKeys:V}),this.prevOpenKeys=null)}},{key:"getRealMenuMode",value:function(){var G=this.props.mode,ee=this.state.switchingModeFromInline,V=this.getInlineCollapsed();return ee&&V?"inline":V?"vertical":G}},{key:"getInlineCollapsed",value:function(){var G=this.props,ee=G.inlineCollapsed,V=G.siderCollapsed;return V!==void 0?V:ee}},{key:"restoreModeVerticalFromInline",value:function(){var G=this.state.switchingModeFromInline;G&&this.setState({switchingModeFromInline:!1})}},{key:"updateMiniStore",value:function(){"selectedKeys"in this.props&&this.store.setState({selectedKeys:this.props.selectedKeys||[]}),"openKeys"in this.props&&this.store.setState({openKeys:this.props.openKeys||[]})}},{key:"render",value:function(){var G=Object(U.a)({},Object(v.a)(this.props,["collapsedWidth","siderCollapsed","defaultMotions"])),ee=this.getRealMenuMode();return G.className+=" ".concat(G.prefixCls,"-root"),G.direction==="rtl"&&(G.className+=" ".concat(G.prefixCls,"-rtl")),G=Object(U.a)(Object(U.a)({},G),{},{mode:ee,onClick:this.onClick,onOpenChange:this.onOpenChange,onDeselect:this.onDeselect,onSelect:this.onSelect,onMouseEnter:this.onMouseEnter,onTransitionEnd:this.onTransitionEnd,parentMenu:this,motion:Cr(this.props,this.state,ee)}),delete G.openAnimation,delete G.openTransitionName,S.createElement(l.a,{store:this.store},S.createElement(Fn,Object(p.a)({},G,{ref:this.setInnerMenu}),this.props.children))}}],[{key:"getDerivedStateFromProps",value:function(G,ee){var V=ee.prevProps,se=ee.store,ue=se.getState(),Ee={},ve={prevProps:G};return V.mode==="inline"&&G.mode!=="inline"&&(ve.switchingModeFromInline=!0),"openKeys"in G?Ee.openKeys=G.openKeys||[]:((G.inlineCollapsed&&!V.inlineCollapsed||G.siderCollapsed&&!V.siderCollapsed)&&(ve.switchingModeFromInline=!0,ve.inlineOpenKeys=ue.openKeys,Ee.openKeys=[]),(!G.inlineCollapsed&&V.inlineCollapsed||!G.siderCollapsed&&V.siderCollapsed)&&(Ee.openKeys=ee.inlineOpenKeys,ve.inlineOpenKeys=[])),Object.keys(Ee).length&&se.setState(Ee),ve}}]),be}(S.Component);Wn.defaultProps={selectable:!0,onClick:xe,onSelect:xe,onOpenChange:xe,onDeselect:xe,defaultSelectedKeys:[],defaultOpenKeys:[],subMenuOpenDelay:.1,subMenuCloseDelay:.1,triggerSubMenuAction:"hover",prefixCls:"rc-menu",className:"",mode:"vertical",style:{},builtinPlacements:{},overflowedIndicator:S.createElement("span",null,"\xB7\xB7\xB7")};var Ar=Wn,An=function(ie){Object(c.a)(be,ie);var ge=Object(r.a)(be);function be(){var oe;return Object(b.a)(this,be),oe=ge.apply(this,arguments),oe.onKeyDown=function(G){var ee=G.keyCode;return ee===d.a.ENTER?(oe.onClick(G),!0):void 0},oe.onMouseLeave=function(G){var ee=oe.props,V=ee.eventKey,se=ee.onItemHover,ue=ee.onMouseLeave;se({key:V,hover:!1}),ue({key:V,domEvent:G})},oe.onMouseEnter=function(G){var ee=oe.props,V=ee.eventKey,se=ee.onItemHover,ue=ee.onMouseEnter;se({key:V,hover:!0}),ue({key:V,domEvent:G})},oe.onClick=function(G){var ee=oe.props,V=ee.eventKey,se=ee.multiple,ue=ee.onClick,Ee=ee.onSelect,ve=ee.onDeselect,Ce=ee.isSelected,Ue={key:V,keyPath:[V],item:Object(a.a)(oe),domEvent:G};ue(Ue),se?Ce?ve(Ue):Ee(Ue):Ce||Ee(Ue)},oe.saveNode=function(G){oe.node=G},oe}return Object(_.a)(be,[{key:"componentDidMount",value:function(){this.callRef()}},{key:"componentDidUpdate",value:function(){this.callRef()}},{key:"componentWillUnmount",value:function(){var G=this.props;G.onDestroy&&G.onDestroy(G.eventKey)}},{key:"getPrefixCls",value:function(){return"".concat(this.props.rootPrefixCls,"-item")}},{key:"getActiveClassName",value:function(){return"".concat(this.getPrefixCls(),"-active")}},{key:"getSelectedClassName",value:function(){return"".concat(this.getPrefixCls(),"-selected")}},{key:"getDisabledClassName",value:function(){return"".concat(this.getPrefixCls(),"-disabled")}},{key:"callRef",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"render",value:function(){var G,ee=Object(U.a)({},this.props),V=N()(this.getPrefixCls(),ee.className,(G={},Object(_e.a)(G,this.getActiveClassName(),!ee.disabled&&ee.active),Object(_e.a)(G,this.getSelectedClassName(),ee.isSelected),Object(_e.a)(G,this.getDisabledClassName(),ee.disabled),G)),se=Object(U.a)(Object(U.a)({},ee.attribute),{},{title:typeof ee.title=="string"?ee.title:void 0,className:V,role:ee.role||"menuitem","aria-disabled":ee.disabled});ee.role==="option"?se=Object(U.a)(Object(U.a)({},se),{},{role:"option","aria-selected":ee.isSelected}):(ee.role===null||ee.role==="none")&&(se.role="none");var ue={onClick:ee.disabled?null:this.onClick,onMouseLeave:ee.disabled?null:this.onMouseLeave,onMouseEnter:ee.disabled?null:this.onMouseEnter},Ee=Object(U.a)({},ee.style);ee.mode==="inline"&&(ee.direction==="rtl"?Ee.paddingRight=ee.inlineIndent*ee.level:Ee.paddingLeft=ee.inlineIndent*ee.level),Me.forEach(function(Ce){return delete ee[Ce]}),delete ee.direction;var ve=this.props.itemIcon;return typeof this.props.itemIcon=="function"&&(ve=S.createElement(this.props.itemIcon,this.props)),S.createElement("li",Object(p.a)({},Object(v.a)(ee,["onClick","onMouseEnter","onMouseLeave","onSelect"]),se,ue,{style:Ee,ref:this.saveNode}),ee.children,ve)}}]),be}(S.Component);An.isMenuItem=!0,An.defaultProps={onSelect:xe,onMouseEnter:xe,onMouseLeave:xe,manualRef:xe};var Or=Object(l.b)(function(ie,ge){var be=ie.activeKey,oe=ie.selectedKeys,G=ge.eventKey,ee=ge.subMenuKey;return{active:be[ee]===G,isSelected:Array.isArray(oe)?oe.indexOf(G)!==-1:oe===G}})(An),wr=Or,On=function(ie){Object(c.a)(be,ie);var ge=Object(r.a)(be);function be(){var oe;return Object(b.a)(this,be),oe=ge.apply(this,arguments),oe.renderInnerMenuItem=function(G){var ee=oe.props,V=ee.renderMenuItem,se=ee.index;return V(G,se,oe.props.subMenuKey)},oe}return Object(_.a)(be,[{key:"render",value:function(){var G=Object(p.a)({},this.props),ee=G.className,V=ee===void 0?"":ee,se=G.rootPrefixCls,ue="".concat(se,"-item-group-title"),Ee="".concat(se,"-item-group-list"),ve=G.title,Ce=G.children;return Me.forEach(function(Ue){return delete G[Ue]}),delete G.direction,S.createElement("li",Object(p.a)({},G,{onClick:function(Xe){return Xe.stopPropagation()},className:"".concat(V," ").concat(se,"-item-group")}),S.createElement("div",{className:ue,title:typeof ve=="string"?ve:void 0},ve),S.createElement("ul",{className:Ee},S.Children.map(Ce,this.renderInnerMenuItem)))}}]),be}(S.Component);On.isMenuItemGroup=!0,On.defaultProps={disabled:!0};var fa=On,Hn=function(ge){var be=ge.className,oe=ge.rootPrefixCls,G=ge.style;return S.createElement("li",{className:"".concat(be," ").concat(oe,"-item-divider"),style:G})};Hn.defaultProps={disabled:!0,className:"",style:{}};var pa=Hn,Rr=Ar,Ir=z("eDIo");function Lr(ie,ge){var be=ie.prefixCls,oe=ie.editable,G=ie.locale,ee=ie.style;return!oe||oe.showAdd===!1?null:S.createElement("button",{ref:ge,type:"button",className:"".concat(be,"-nav-add"),style:ee,"aria-label":(G==null?void 0:G.addAriaLabel)||"Add tab",onClick:function(se){oe.onEdit("add",{event:se})}},oe.addIcon||"+")}var Kn=S.forwardRef(Lr);function Dr(ie,ge){var be=ie.prefixCls,oe=ie.id,G=ie.tabs,ee=ie.locale,V=ie.mobile,se=ie.moreIcon,ue=se===void 0?"More":se,Ee=ie.moreTransitionName,ve=ie.style,Ce=ie.className,Ue=ie.editable,Xe=ie.tabBarGutter,Ve=ie.rtl,tt=ie.onTabClick,mt=Object(S.useState)(!1),Ot=Object(F.a)(mt,2),xt=Ot[0],Rt=Ot[1],wt=Object(S.useState)(null),Ct=Object(F.a)(wt,2),At=Ct[0],Nt=Ct[1],It="".concat(oe,"-more-popup"),ri="".concat(be,"-dropdown"),Kt=At!==null?"".concat(It,"-").concat(At):null,ft=ee==null?void 0:ee.dropdownAriaLabel,ht=S.createElement(Rr,{onClick:function(Vt){var ti=Vt.key,yi=Vt.domEvent;tt(ti,yi),Rt(!1)},id:It,tabIndex:-1,role:"listbox","aria-activedescendant":Kt,selectedKeys:[At],"aria-label":ft!==void 0?ft:"expanded dropdown"},G.map(function(Bt){return S.createElement(wr,{key:Bt.key,id:"".concat(It,"-").concat(Bt.key),role:"option","aria-controls":oe&&"".concat(oe,"-panel-").concat(Bt.key),disabled:Bt.disabled},Bt.tab)}));function Lt(Bt){for(var Vt=G.filter(function(Ri){return!Ri.disabled}),ti=Vt.findIndex(function(Ri){return Ri.key===At})||0,yi=Vt.length,wi=0;wi<yi;wi+=1){ti=(ti+Bt+yi)%yi;var ai=Vt[ti];if(!ai.disabled){Nt(ai.key);return}}}function Mt(Bt){var Vt=Bt.which;if(!xt){[d.a.DOWN,d.a.SPACE,d.a.ENTER].includes(Vt)&&(Rt(!0),Bt.preventDefault());return}switch(Vt){case d.a.UP:Lt(-1),Bt.preventDefault();break;case d.a.DOWN:Lt(1),Bt.preventDefault();break;case d.a.ESC:Rt(!1);break;case d.a.SPACE:case d.a.ENTER:At!==null&&tt(At,Bt);break}}Object(S.useEffect)(function(){var Bt=document.getElementById(Kt);Bt&&Bt.scrollIntoView&&Bt.scrollIntoView(!1)},[At]),Object(S.useEffect)(function(){xt||Nt(null)},[xt]);var ot=Object(_e.a)({},Ve?"marginLeft":"marginRight",Xe);G.length||(ot.visibility="hidden",ot.order=1);var Ut=N()(Object(_e.a)({},"".concat(ri,"-rtl"),Ve)),qt=V?null:S.createElement(Ir.a,{prefixCls:ri,overlay:ht,trigger:["hover"],visible:xt,transitionName:Ee,onVisibleChange:Rt,overlayClassName:Ut,mouseEnterDelay:.1,mouseLeaveDelay:.1},S.createElement("button",{type:"button",className:"".concat(be,"-nav-more"),style:ot,tabIndex:-1,"aria-hidden":"true","aria-haspopup":"listbox","aria-controls":It,id:"".concat(oe,"-more"),"aria-expanded":xt,onKeyDown:Mt},ue));return S.createElement("div",{className:N()("".concat(be,"-nav-operations"),Ce),style:ve,ref:ge},qt,S.createElement(Kn,{prefixCls:be,locale:ee,editable:Ue}))}var Pr=S.forwardRef(Dr),wn=Object(S.createContext)(null),Mr=.1,Gn=.01,En=20,zn=Math.pow(.995,En);function kr(){var ie=navigator.userAgent||navigator.vendor||window.opera;return!!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(ie)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(ie.substr(0,4)))}function Nr(ie,ge){var be=Object(S.useState)(),oe=Object(F.a)(be,2),G=oe[0],ee=oe[1],V=Object(S.useState)(0),se=Object(F.a)(V,2),ue=se[0],Ee=se[1],ve=Object(S.useState)(0),Ce=Object(F.a)(ve,2),Ue=Ce[0],Xe=Ce[1],Ve=Object(S.useState)(),tt=Object(F.a)(Ve,2),mt=tt[0],Ot=tt[1],xt=Object(S.useRef)();function Rt(ft){var ht=ft.touches[0],Lt=ht.screenX,Mt=ht.screenY;ee({x:Lt,y:Mt}),window.clearInterval(xt.current)}function wt(ft){if(!G)return;ft.preventDefault();var ht=ft.touches[0],Lt=ht.screenX,Mt=ht.screenY;ee({x:Lt,y:Mt});var ot=Lt-G.x,Ut=Mt-G.y;ge(ot,Ut);var qt=Date.now();Ee(qt),Xe(qt-ue),Ot({x:ot,y:Ut})}function Ct(){if(!G)return;if(ee(null),Ot(null),mt){var ft=mt.x/Ue,ht=mt.y/Ue,Lt=Math.abs(ft),Mt=Math.abs(ht);if(Math.max(Lt,Mt)<Mr)return;var ot=ft,Ut=ht;xt.current=window.setInterval(function(){if(Math.abs(ot)<Gn&&Math.abs(Ut)<Gn){window.clearInterval(xt.current);return}ot*=zn,Ut*=zn,ge(ot*En,Ut*En)},En)}}var At=Object(S.useRef)(0),Nt=Object(S.useRef)(!1),It=Object(S.useRef)();function ri(ft){var ht=ft.deltaX,Lt=ft.deltaY,Mt=0,ot=Math.abs(ht),Ut=Math.abs(Lt);ot===Ut?Mt=It.current==="x"?ht:Lt:ot>Ut?(Mt=ht,It.current="x"):(Mt=Lt,It.current="y");var qt=Date.now();qt-At.current>100&&(Nt.current=!1),(ge(-Mt,-Mt)||Nt.current)&&(ft.preventDefault(),Nt.current=!0),At.current=qt}var Kt=Object(S.useRef)(null);Kt.current={onTouchStart:Rt,onTouchMove:wt,onTouchEnd:Ct,onWheel:ri},S.useEffect(function(){function ft(ot){Kt.current.onTouchStart(ot)}function ht(ot){Kt.current.onTouchMove(ot)}function Lt(ot){Kt.current.onTouchEnd(ot)}function Mt(ot){Kt.current.onWheel(ot)}return document.addEventListener("touchmove",ht,{passive:!1}),document.addEventListener("touchend",Lt,{passive:!1}),ie.current.addEventListener("touchstart",ft,{passive:!1}),ie.current.addEventListener("wheel",Mt),function(){document.removeEventListener("touchmove",ht),document.removeEventListener("touchend",Lt)}},[])}function Ur(){var ie=Object(S.useRef)(new Map);function ge(oe){return ie.current.has(oe)||ie.current.set(oe,S.createRef()),ie.current.get(oe)}function be(oe){ie.current.delete(oe)}return[ge,be]}function Vn(ie,ge){var be=S.useRef(ie),oe=S.useState({}),G=Object(F.a)(oe,2),ee=G[1];function V(se){var ue=typeof se=="function"?se(be.current):se;ue!==be.current&&ge(ue,be.current),be.current=ue,ee({})}return[be.current,V]}var Xn=function(ge){var be=ge.position,oe=ge.prefixCls,G=ge.extra;if(!G)return null;var ee,V=G;return be==="right"&&(ee=V.right||!V.left&&V||null),be==="left"&&(ee=V.left||null),ee?S.createElement("div",{className:"".concat(oe,"-extra-content")},ee):null};function Br(ie,ge){var be,oe=S.useContext(wn),G=oe.prefixCls,ee=oe.tabs,V=ie.className,se=ie.style,ue=ie.id,Ee=ie.animated,ve=ie.activeKey,Ce=ie.rtl,Ue=ie.extra,Xe=ie.editable,Ve=ie.locale,tt=ie.tabPosition,mt=ie.tabBarGutter,Ot=ie.children,xt=ie.onTabClick,Rt=ie.onTabScroll,wt=Object(S.useRef)(),Ct=Object(S.useRef)(),At=Object(S.useRef)(),Nt=Object(S.useRef)(),It=Ur(),ri=Object(F.a)(It,2),Kt=ri[0],ft=ri[1],ht=tt==="top"||tt==="bottom",Lt=Vn(0,function(Gt,Dt){ht&&Rt&&Rt({direction:Gt>Dt?"left":"right"})}),Mt=Object(F.a)(Lt,2),ot=Mt[0],Ut=Mt[1],qt=Vn(0,function(Gt,Dt){!ht&&Rt&&Rt({direction:Gt>Dt?"top":"bottom"})}),Bt=Object(F.a)(qt,2),Vt=Bt[0],ti=Bt[1],yi=Object(S.useState)(0),wi=Object(F.a)(yi,2),ai=wi[0],Ri=wi[1],ki=Object(S.useState)(0),Li=Object(F.a)(ki,2),Di=Li[0],oi=Li[1],Ci=Object(S.useState)(0),bi=Object(F.a)(Ci,2),pi=bi[0],Gi=bi[1],zi=Object(S.useState)(0),Qi=Object(F.a)(zi,2),Qt=Qi[0],ji=Qi[1],Zi=Object(S.useState)(null),ei=Object(F.a)(Zi,2),Wt=ei[0],Ei=ei[1],Kr=Object(S.useState)(null),Jn=Object(F.a)(Kr,2),an=Jn[0],Gr=Jn[1],zr=Object(S.useState)(0),qn=Object(F.a)(zr,2),Vr=qn[0],Xr=qn[1],Yr=Object(S.useState)(0),er=Object(F.a)(Yr,2),$r=er[0],Qr=er[1],Zr=e(new Map),tr=Object(F.a)(Zr,2),Jr=tr[0],qr=tr[1],Tn=n(ee,Jr,ai),ir="".concat(G,"-nav-operations-hidden"),cn=0,hn=0;ht?Ce?(cn=0,hn=Math.max(0,ai-Wt)):(cn=Math.min(0,Wt-ai),hn=0):(cn=Math.min(0,an-Di),hn=0);function Rn(Gt){return Gt<cn?[cn,!1]:Gt>hn?[hn,!1]:[Gt,!0]}var nr=Object(S.useRef)(),ea=Object(S.useState)(),rr=Object(F.a)(ea,2),In=rr[0],ar=rr[1];function Ln(){ar(Date.now())}function Dn(){window.clearTimeout(nr.current)}Nr(wt,function(Gt,Dt){var mi=!1;function Pi(pn,mn){pn(function(gn){var vn=Rn(gn+mn),sn=Object(F.a)(vn,2),Nn=sn[0],Un=sn[1];return mi=Un,Nn})}if(ht){if(Wt>=ai)return mi;Pi(Ut,Gt)}else{if(an>=Di)return mi;Pi(ti,Dt)}return Dn(),Ln(),mi}),Object(S.useEffect)(function(){return Dn(),In&&(nr.current=window.setTimeout(function(){ar(0)},100)),Dn},[In]);function sr(){var Gt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ve,Dt=Tn.get(Gt);if(!Dt)return;if(ht){var mi=ot;Ce?Dt.right<ot?mi=Dt.right:Dt.right+Dt.width>ot+Wt&&(mi=Dt.right+Dt.width-Wt):Dt.left<-ot?mi=-Dt.left:Dt.left+Dt.width>-ot+Wt&&(mi=-(Dt.left+Dt.width-Wt)),ti(0),Ut(Rn(mi)[0])}else{var Pi=Vt;Dt.top<-Vt?Pi=-Dt.top:Dt.top+Dt.height>-Vt+an&&(Pi=-(Dt.top+Dt.height-an)),Ut(0),ti(Rn(Pi)[0])}}var ta=m(Tn,{width:Wt,height:an,left:ot,top:Vt},{width:pi,height:Qt},{width:Vr,height:$r},Object(U.a)(Object(U.a)({},ie),{},{tabs:ee})),or=Object(F.a)(ta,2),ia=or[0],na=or[1],ra=ee.map(function(Gt){var Dt=Gt.key;return S.createElement(t,{id:ue,prefixCls:G,key:Dt,rtl:Ce,tab:Gt,closable:Gt.closable,editable:Xe,active:Dt===ve,tabPosition:tt,tabBarGutter:mt,renderWrapper:Ot,removeAriaLabel:Ve==null?void 0:Ve.removeAriaLabel,ref:Kt(Dt),onClick:function(Pi){xt(Dt,Pi)},onRemove:function(){ft(Dt)},onFocus:function(){sr(Dt),Ln(),Ce||(wt.current.scrollLeft=0),wt.current.scrollTop=0}})}),Pn=o(function(){var Gt,Dt,mi,Pi,pn,mn,gn,vn,sn,Nn=((Gt=wt.current)===null||Gt===void 0?void 0:Gt.offsetWidth)||0,Un=((Dt=wt.current)===null||Dt===void 0?void 0:Dt.offsetHeight)||0,mr=((mi=Nt.current)===null||mi===void 0?void 0:mi.offsetWidth)||0,gr=((Pi=Nt.current)===null||Pi===void 0?void 0:Pi.offsetHeight)||0,da=((pn=At.current)===null||pn===void 0?void 0:pn.offsetWidth)||0,ca=((mn=At.current)===null||mn===void 0?void 0:mn.offsetHeight)||0;Ei(Nn),Gr(Un),Xr(mr),Qr(gr);var vr=(((gn=Ct.current)===null||gn===void 0?void 0:gn.offsetWidth)||0)-mr,_r=(((vn=Ct.current)===null||vn===void 0?void 0:vn.offsetHeight)||0)-gr;Ri(vr),oi(_r);var yr=(sn=At.current)===null||sn===void 0?void 0:sn.className.includes(ir);Gi(vr-(yr?0:da)),ji(_r-(yr?0:ca)),qr(function(){var br=new Map;return ee.forEach(function(ha){var Er=ha.key,_n=Kt(Er).current;_n&&br.set(Er,{width:_n.offsetWidth,height:_n.offsetHeight,left:_n.offsetLeft,top:_n.offsetTop})}),br})}),aa=ee.slice(0,ia),sa=ee.slice(na+1),lr=[].concat(Object(C.a)(aa),Object(C.a)(sa)),oa=Object(S.useState)(),ur=Object(F.a)(oa,2),la=ur[0],ua=ur[1],Vi=Tn.get(ve),dr=Object(S.useRef)();function cr(){h.a.cancel(dr.current)}Object(S.useEffect)(function(){var Gt={};return Vi&&(ht?(Ce?Gt.right=Vi.right:Gt.left=Vi.left,Gt.width=Vi.width):(Gt.top=Vi.top,Gt.height=Vi.height)),cr(),dr.current=h()(function(){ua(Gt)}),cr},[Vi,ht,Ce]),Object(S.useEffect)(function(){sr()},[ve,Vi,Tn,ht]),Object(S.useEffect)(function(){Pn()},[Ce,mt,ve,ee.map(function(Gt){return Gt.key}).join("_")]);var hr=!!lr.length,fn="".concat(G,"-nav-wrap"),Mn,kn,fr,pr;return ht?Ce?(kn=ot>0,Mn=ot+Wt<ai):(Mn=ot<0,kn=-ot+Wt<ai):(fr=Vt<0,pr=-Vt+an<Di),S.createElement("div",{ref:ge,role:"tablist",className:N()("".concat(G,"-nav"),V),style:se,onKeyDown:function(){Ln()}},S.createElement(Xn,{position:"left",extra:Ue,prefixCls:G}),S.createElement(u.a,{onResize:Pn},S.createElement("div",{className:N()(fn,(be={},Object(_e.a)(be,"".concat(fn,"-ping-left"),Mn),Object(_e.a)(be,"".concat(fn,"-ping-right"),kn),Object(_e.a)(be,"".concat(fn,"-ping-top"),fr),Object(_e.a)(be,"".concat(fn,"-ping-bottom"),pr),be)),ref:wt},S.createElement(u.a,{onResize:Pn},S.createElement("div",{ref:Ct,className:"".concat(G,"-nav-list"),style:{transform:"translate(".concat(ot,"px, ").concat(Vt,"px)"),transition:In?"none":void 0}},ra,S.createElement(Kn,{ref:Nt,prefixCls:G,locale:Ve,editable:Xe,style:{visibility:hr?"hidden":null}}),S.createElement("div",{className:N()("".concat(G,"-ink-bar"),Object(_e.a)({},"".concat(G,"-ink-bar-animated"),Ee.inkBar)),style:la}))))),S.createElement(Pr,Object.assign({},ie,{ref:At,prefixCls:G,tabs:lr,className:!hr&&ir})),S.createElement(Xn,{position:"right",extra:Ue,prefixCls:G}))}var Yn=S.forwardRef(Br);function jr(ie){var ge=ie.id,be=ie.activeKey,oe=ie.animated,G=ie.tabPosition,ee=ie.rtl,V=ie.destroyInactiveTabPane,se=S.useContext(wn),ue=se.prefixCls,Ee=se.tabs,ve=oe.tabPane,Ce=Ee.findIndex(function(Ue){return Ue.key===be});return S.createElement("div",{className:N()("".concat(ue,"-content-holder"))},S.createElement("div",{className:N()("".concat(ue,"-content"),"".concat(ue,"-content-").concat(G),Object(_e.a)({},"".concat(ue,"-content-animated"),ve)),style:Ce&&ve?Object(_e.a)({},ee?"marginRight":"marginLeft","-".concat(Ce,"00%")):null},Ee.map(function(Ue){return S.cloneElement(Ue.node,{key:Ue.key,prefixCls:ue,tabKey:Ue.key,id:ge,animated:ve,active:Ue.key===be,destroyInactiveTabPane:V})})))}function $n(ie){var ge=ie.prefixCls,be=ie.forceRender,oe=ie.className,G=ie.style,ee=ie.id,V=ie.active,se=ie.animated,ue=ie.destroyInactiveTabPane,Ee=ie.tabKey,ve=ie.children,Ce=S.useState(be),Ue=Object(F.a)(Ce,2),Xe=Ue[0],Ve=Ue[1];S.useEffect(function(){V?Ve(!0):ue&&Ve(!1)},[V,ue]);var tt={};return V||(se?(tt.visibility="hidden",tt.height=0,tt.overflowY="hidden"):tt.display="none"),S.createElement("div",{id:ee&&"".concat(ee,"-panel-").concat(Ee),role:"tabpanel",tabIndex:V?0:-1,"aria-labelledby":ee&&"".concat(ee,"-tab-").concat(Ee),"aria-hidden":!V,style:Object(U.a)(Object(U.a)({},tt),G),className:N()("".concat(ge,"-tabpane"),V&&"".concat(ge,"-tabpane-active"),oe)},(V||Xe||be)&&ve)}var Qn=0;function Fr(ie){return Object(k.a)(ie).map(function(ge){if(S.isValidElement(ge)){var be=ge.key!==void 0?String(ge.key):void 0;return Object(U.a)(Object(U.a)({key:be},ge.props),{},{node:ge})}return null}).filter(function(ge){return ge})}function Wr(ie,ge){var be,oe=ie.id,G=ie.prefixCls,ee=G===void 0?"rc-tabs":G,V=ie.className,se=ie.children,ue=ie.direction,Ee=ie.activeKey,ve=ie.defaultActiveKey,Ce=ie.editable,Ue=ie.animated,Xe=ie.tabPosition,Ve=Xe===void 0?"top":Xe,tt=ie.tabBarGutter,mt=ie.tabBarStyle,Ot=ie.tabBarExtraContent,xt=ie.locale,Rt=ie.moreIcon,wt=ie.moreTransitionName,Ct=ie.destroyInactiveTabPane,At=ie.renderTabBar,Nt=ie.onChange,It=ie.onTabClick,ri=ie.onTabScroll,Kt=Object(w.a)(ie,["id","prefixCls","className","children","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","moreIcon","moreTransitionName","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll"]),ft=Fr(se),ht=ue==="rtl",Lt;Ue===!1?Lt={inkBar:!1,tabPane:!1}:Lt=Object(U.a)({inkBar:!0,tabPane:!1},Ue!==!0?Ue:null);var Mt=Object(S.useState)(!1),ot=Object(F.a)(Mt,2),Ut=ot[0],qt=ot[1];Object(S.useEffect)(function(){qt(kr())},[]);var Bt=Object(A.a)(function(){var Qt;return(Qt=ft[0])===null||Qt===void 0?void 0:Qt.key},{value:Ee,defaultValue:ve}),Vt=Object(F.a)(Bt,2),ti=Vt[0],yi=Vt[1],wi=Object(S.useState)(function(){return ft.findIndex(function(Qt){return Qt.key===ti})}),ai=Object(F.a)(wi,2),Ri=ai[0],ki=ai[1];Object(S.useEffect)(function(){var Qt=ft.findIndex(function(Zi){return Zi.key===ti});if(Qt===-1){var ji;Qt=Math.max(0,Math.min(Ri,ft.length-1)),yi((ji=ft[Qt])===null||ji===void 0?void 0:ji.key)}ki(Qt)},[ft.map(function(Qt){return Qt.key}).join("_"),ti,Ri]);var Li=Object(A.a)(null,{value:oe}),Di=Object(F.a)(Li,2),oi=Di[0],Ci=Di[1],bi=Ve;Ut&&!["left","right"].includes(Ve)&&(bi="top"),Object(S.useEffect)(function(){oe||(Ci("rc-tabs-".concat(Qn)),Qn+=1)},[]);function pi(Qt,ji){It==null||It(Qt,ji),yi(Qt),Nt==null||Nt(Qt)}var Gi={id:oi,activeKey:ti,animated:Lt,tabPosition:bi,rtl:ht,mobile:Ut},zi,Qi=Object(U.a)(Object(U.a)({},Gi),{},{editable:Ce,locale:xt,moreIcon:Rt,moreTransitionName:wt,tabBarGutter:tt,onTabClick:pi,onTabScroll:ri,extra:Ot,style:mt,panes:se});return At?zi=At(Qi,Yn):zi=S.createElement(Yn,Object.assign({},Qi)),S.createElement(wn.Provider,{value:{tabs:ft,prefixCls:ee}},S.createElement("div",Object.assign({ref:ge,id:oe,className:N()(ee,"".concat(ee,"-").concat(bi),(be={},Object(_e.a)(be,"".concat(ee,"-mobile"),Ut),Object(_e.a)(be,"".concat(ee,"-editable"),Ce),Object(_e.a)(be,"".concat(ee,"-rtl"),ht),be),V)},Kt),zi,S.createElement(jr,Object.assign({destroyInactiveTabPane:Ct},Gi,{animated:Lt}))))}var Zn=S.forwardRef(Wr);Zn.TabPane=$n;var Hr=Zn,ma=$e.b=Hr},p5ED:function(at,$e,z){"use strict";var _e=z("+L6B"),F=z("2/Rp"),w=z("5Dmo"),U=z("3S7+"),S=z("k1fw"),I=z("tJVT"),N=z("q1tI"),k=z.n(N),A=z("vHTk"),C=z.n(A),y=z("yEEn"),h=z("ZW9T"),u=z("1vsH");$e.a=function(o){var e=o.name,d=o.data,s=o.theme,t=o.type,i=o.filename,n=o.monacoEditor,T=o.className,m=o.style,p=o.close,b=o.onClose,_=o.hasMask,a=Object(N.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),c=Object(I.a)(a,2),r=c[0],l=c[1],v=Object(N.useState)(""),f=Object(I.a)(v,2),x=f[0],R=f[1],O,B=1024*1024,j=10*B,K=Object(N.useRef)();t==="office"&&(O=Object(u.T)(d).filesize,O>j&&(t="other")),i&&(n.filename=i),Object(N.useEffect)(function(){var Y,ae,Z=(Y=document.cookie)===null||Y===void 0||((ae=Y.replace(/\s/g,""))===null||ae===void 0)?void 0:ae.split(";");Z==null||Z.map(function(ce){var de=ce.split("=");de[0]==="_educoder_session"&&R(de[1])})},[]);var L=function(){if(d.startsWith("http")||d.startsWith("/")){H();return}Object(u.z)(i||"educoder",d,i)},H=function(){Object(u.x)(i||e,d)};return console.log("data:",d,"fileanme:",i," name:",e),k.a.createElement("div",{style:Object(S.a)({},m||{}),className:"".concat(_&&C.a.bgBlack," ").concat(t?C.a.wrp:"hide")},p&&k.a.createElement("div",{className:C.a.close,ref:K},k.a.createElement(U.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return K.current}},k.a.createElement("span",{onClick:H},k.a.createElement("i",{className:"icon-quxiaozhiding"}))),k.a.createElement(U.a,{title:"\u5173\u95ED",getPopupContainer:function(){return K.current}},k.a.createElement("span",{className:"",onClick:b},k.a.createElement("i",{className:"icon-guanbi1"})))),k.a.createElement("div",{className:"".concat(C.a[T]," ").concat(T," ").concat(C.a.monaco," ").concat(t==="txt"?"show":"hide")},t==="txt"&&k.a.createElement(h.b,n)),t==="audio"&&k.a.createElement("audio",{src:"".concat(d!=null&&d.startsWith("/")||(d==null?void 0:d.indexOf("https://"))>-1?d:"data:audio/mp3;base64,").concat(d),autoPlay:!0}),t==="video"&&k.a.createElement(k.a.Fragment,null,d!=null&&d.startsWith("/")?k.a.createElement("video",{controls:!0,src:"".concat(d),autoPlay:!0}):k.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(d),autoPlay:!0})),t==="html"&&k.a.createElement("iframe",{src:d+"&disposition=inline"}),t==="pdf"&&k.a.createElement("embed",{className:C.a.embed,src:d}),t==="image"&&k.a.createElement(k.a.Fragment,null,k.a.createElement("img",{src:"".concat(d!=null&&d.startsWith("/")||(d==null?void 0:d.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(d)})),t==="other"&&k.a.createElement("div",null,k.a.createElement(F.a,{type:"primary",size:"large",onClick:L},k.a.createElement(y.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(t==="download"||t==="office")&&k.a.createElement(F.a,{type:"primary",size:"large",onClick:L},k.a.createElement(y.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},psGv:function(at,$e,z){var _e,F;(function(){var w;(function(){"use strict";var N=[,,function(y){function h(e){this.__parent=e,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}h.prototype.clone_empty=function(){var e=new h(this.__parent);return e.set_indent(this.__indent_count,this.__alignment_count),e},h.prototype.item=function(e){return e<0?this.__items[this.__items.length+e]:this.__items[e]},h.prototype.has_match=function(e){for(var d=this.__items.length-1;d>=0;d--)if(this.__items[d].match(e))return!0;return!1},h.prototype.set_indent=function(e,d){this.is_empty()&&(this.__indent_count=e||0,this.__alignment_count=d||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},h.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},h.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},h.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var e=this.__parent.current_line;return e.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),e.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),e.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,e.__items[0]===" "&&(e.__items.splice(0,1),e.__character_count-=1),!0}return!1},h.prototype.is_empty=function(){return this.__items.length===0},h.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},h.prototype.push=function(e){this.__items.push(e);var d=e.lastIndexOf(`
`);d!==-1?this.__character_count=e.length-d:this.__character_count+=e.length},h.prototype.pop=function(){var e=null;return this.is_empty()||(e=this.__items.pop(),this.__character_count-=e.length),e},h.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},h.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},h.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},h.prototype.toString=function(){var e="";return this.is_empty()?this.__parent.indent_empty_lines&&(e=this.__parent.get_indent_string(this.__indent_count)):(e=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),e+=this.__items.join("")),e};function u(e,d){this.__cache=[""],this.__indent_size=e.indent_size,this.__indent_string=e.indent_char,e.indent_with_tabs||(this.__indent_string=new Array(e.indent_size+1).join(e.indent_char)),d=d||"",e.indent_level>0&&(d=new Array(e.indent_level+1).join(this.__indent_string)),this.__base_string=d,this.__base_string_length=d.length}u.prototype.get_indent_size=function(e,d){var s=this.__base_string_length;return d=d||0,e<0&&(s=0),s+=e*this.__indent_size,s+=d,s},u.prototype.get_indent_string=function(e,d){var s=this.__base_string;return d=d||0,e<0&&(e=0,s=""),d+=e*this.__indent_size,this.__ensure_cache(d),s+=this.__cache[d],s},u.prototype.__ensure_cache=function(e){for(;e>=this.__cache.length;)this.__add_column()},u.prototype.__add_column=function(){var e=this.__cache.length,d=0,s="";this.__indent_size&&e>=this.__indent_size&&(d=Math.floor(e/this.__indent_size),e-=d*this.__indent_size,s=new Array(d+1).join(this.__indent_string)),e&&(s+=new Array(e+1).join(" ")),this.__cache.push(s)};function o(e,d){this.__indent_cache=new u(e,d),this.raw=!1,this._end_with_newline=e.end_with_newline,this.indent_size=e.indent_size,this.wrap_line_length=e.wrap_line_length,this.indent_empty_lines=e.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new h(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}o.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},o.prototype.get_line_number=function(){return this.__lines.length},o.prototype.get_indent_string=function(e,d){return this.__indent_cache.get_indent_string(e,d)},o.prototype.get_indent_size=function(e,d){return this.__indent_cache.get_indent_size(e,d)},o.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},o.prototype.add_new_line=function(e){return this.is_empty()||!e&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},o.prototype.get_code=function(e){this.trim(!0);var d=this.current_line.pop();d&&(d[d.length-1]===`
`&&(d=d.replace(/\n+$/g,"")),this.current_line.push(d)),this._end_with_newline&&this.__add_outputline();var s=this.__lines.join(`
`);return e!==`
`&&(s=s.replace(/[\n]/g,e)),s},o.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},o.prototype.set_indent=function(e,d){return e=e||0,d=d||0,this.next_line.set_indent(e,d),this.__lines.length>1?(this.current_line.set_indent(e,d),!0):(this.current_line.set_indent(),!1)},o.prototype.add_raw_token=function(e){for(var d=0;d<e.newlines;d++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(e.whitespace_before),this.current_line.push(e.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},o.prototype.add_token=function(e){this.__add_space_before_token(),this.current_line.push(e),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},o.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},o.prototype.remove_indent=function(e){for(var d=this.__lines.length;e<d;)this.__lines[e]._remove_indent(),e++;this.current_line._remove_wrap_indent()},o.prototype.trim=function(e){for(e=e===void 0?!1:e,this.current_line.trim();e&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},o.prototype.just_added_newline=function(){return this.current_line.is_empty()},o.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},o.prototype.ensure_empty_line_above=function(e,d){for(var s=this.__lines.length-2;s>=0;){var t=this.__lines[s];if(t.is_empty())break;if(t.item(0).indexOf(e)!==0&&t.item(-1)!==d){this.__lines.splice(s+1,0,new h(this)),this.previous_line=this.__lines[this.__lines.length-2];break}s--}},y.exports.Output=o},function(y){function h(u,o,e,d){this.type=u,this.text=o,this.comments_before=null,this.newlines=e||0,this.whitespace_before=d||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}y.exports.Token=h},,,function(y){function h(e,d){this.raw_options=u(e,d),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}h.prototype._get_array=function(e,d){var s=this.raw_options[e],t=d||[];return typeof s=="object"?s!==null&&typeof s.concat=="function"&&(t=s.concat()):typeof s=="string"&&(t=s.split(/[^a-zA-Z0-9_\/\-]+/)),t},h.prototype._get_boolean=function(e,d){var s=this.raw_options[e],t=s===void 0?!!d:!!s;return t},h.prototype._get_characters=function(e,d){var s=this.raw_options[e],t=d||"";return typeof s=="string"&&(t=s.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),t},h.prototype._get_number=function(e,d){var s=this.raw_options[e];d=parseInt(d,10),isNaN(d)&&(d=0);var t=parseInt(s,10);return isNaN(t)&&(t=d),t},h.prototype._get_selection=function(e,d,s){var t=this._get_selection_list(e,d,s);if(t.length!==1)throw new Error("Invalid Option Value: The option '"+e+`' can only be one of the following values:
`+d+`
You passed in: '`+this.raw_options[e]+"'");return t[0]},h.prototype._get_selection_list=function(e,d,s){if(!d||d.length===0)throw new Error("Selection list cannot be empty.");if(s=s||[d[0]],!this._is_valid_selection(s,d))throw new Error("Invalid Default Value!");var t=this._get_array(e,s);if(!this._is_valid_selection(t,d))throw new Error("Invalid Option Value: The option '"+e+`' can contain only the following values:
`+d+`
You passed in: '`+this.raw_options[e]+"'");return t},h.prototype._is_valid_selection=function(e,d){return e.length&&d.length&&!e.some(function(s){return d.indexOf(s)===-1})};function u(e,d){var s={};e=o(e);var t;for(t in e)t!==d&&(s[t]=e[t]);if(d&&e[d])for(t in e[d])s[t]=e[d][t];return s}function o(e){var d={},s;for(s in e){var t=s.replace(/-/g,"_");d[t]=e[s]}return d}y.exports.Options=h,y.exports.normalizeOpts=o,y.exports.mergeOpts=u},,function(y){var h=RegExp.prototype.hasOwnProperty("sticky");function u(o){this.__input=o||"",this.__input_length=this.__input.length,this.__position=0}u.prototype.restart=function(){this.__position=0},u.prototype.back=function(){this.__position>0&&(this.__position-=1)},u.prototype.hasNext=function(){return this.__position<this.__input_length},u.prototype.next=function(){var o=null;return this.hasNext()&&(o=this.__input.charAt(this.__position),this.__position+=1),o},u.prototype.peek=function(o){var e=null;return o=o||0,o+=this.__position,o>=0&&o<this.__input_length&&(e=this.__input.charAt(o)),e},u.prototype.__match=function(o,e){o.lastIndex=e;var d=o.exec(this.__input);return d&&!(h&&o.sticky)&&(d.index!==e&&(d=null)),d},u.prototype.test=function(o,e){return e=e||0,e+=this.__position,e>=0&&e<this.__input_length?!!this.__match(o,e):!1},u.prototype.testChar=function(o,e){var d=this.peek(e);return o.lastIndex=0,d!==null&&o.test(d)},u.prototype.match=function(o){var e=this.__match(o,this.__position);return e?this.__position+=e[0].length:e=null,e},u.prototype.read=function(o,e,d){var s="",t;return o&&(t=this.match(o),t&&(s+=t[0])),e&&(t||!o)&&(s+=this.readUntil(e,d)),s},u.prototype.readUntil=function(o,e){var d="",s=this.__position;o.lastIndex=this.__position;var t=o.exec(this.__input);return t?(s=t.index,e&&(s+=t[0].length)):s=this.__input_length,d=this.__input.substring(this.__position,s),this.__position=s,d},u.prototype.readUntilAfter=function(o){return this.readUntil(o,!0)},u.prototype.get_regexp=function(o,e){var d=null,s="g";return e&&h&&(s="y"),typeof o=="string"&&o!==""?d=new RegExp(o,s):o&&(d=new RegExp(o.source,s)),d},u.prototype.get_literal_regexp=function(o){return RegExp(o.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},u.prototype.peekUntilAfter=function(o){var e=this.__position,d=this.readUntilAfter(o);return this.__position=e,d},u.prototype.lookBack=function(o){var e=this.__position-1;return e>=o.length&&this.__input.substring(e-o.length,e).toLowerCase()===o},y.exports.InputScanner=u},function(y,h,u){var o=u(8).InputScanner,e=u(3).Token,d=u(10).TokenStream,s=u(11).WhitespacePattern,t={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},i=function(n,T){this._input=new o(n),this._options=T||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new s(this._input)};i.prototype.tokenize=function(){this._input.restart(),this.__tokens=new d,this._reset();for(var n,T=new e(t.START,""),m=null,p=[],b=new d;T.type!==t.EOF;){for(n=this._get_next_token(T,m);this._is_comment(n);)b.add(n),n=this._get_next_token(T,m);b.isEmpty()||(n.comments_before=b,b=new d),n.parent=m,this._is_opening(n)?(p.push(m),m=n):m&&this._is_closing(n,m)&&(n.opened=m,m.closed=n,m=p.pop(),n.parent=m),n.previous=T,T.next=n,this.__tokens.add(n),T=n}return this.__tokens},i.prototype._is_first_token=function(){return this.__tokens.isEmpty()},i.prototype._reset=function(){},i.prototype._get_next_token=function(n,T){this._readWhitespace();var m=this._input.read(/.+/g);return m?this._create_token(t.RAW,m):this._create_token(t.EOF,"")},i.prototype._is_comment=function(n){return!1},i.prototype._is_opening=function(n){return!1},i.prototype._is_closing=function(n,T){return!1},i.prototype._create_token=function(n,T){var m=new e(n,T,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return m},i.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},y.exports.Tokenizer=i,y.exports.TOKEN=t},function(y){function h(u){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=u}h.prototype.restart=function(){this.__position=0},h.prototype.isEmpty=function(){return this.__tokens_length===0},h.prototype.hasNext=function(){return this.__position<this.__tokens_length},h.prototype.next=function(){var u=null;return this.hasNext()&&(u=this.__tokens[this.__position],this.__position+=1),u},h.prototype.peek=function(u){var o=null;return u=u||0,u+=this.__position,u>=0&&u<this.__tokens_length&&(o=this.__tokens[u]),o},h.prototype.add=function(u){this.__parent_token&&(u.parent=this.__parent_token),this.__tokens.push(u),this.__tokens_length+=1},y.exports.TokenStream=h},function(y,h,u){var o=u(12).Pattern;function e(d,s){o.call(this,d,s),s?this._line_regexp=this._input.get_regexp(s._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}e.prototype=new o,e.prototype.__set_whitespace_patterns=function(d,s){d+="\\t ",s+="\\n\\r",this._match_pattern=this._input.get_regexp("["+d+s+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+s+"]")},e.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var d=this._input.read(this._match_pattern);if(d===" ")this.whitespace_before_token=" ";else if(d){var s=this.__split(this._newline_regexp,d);this.newline_count=s.length-1,this.whitespace_before_token=s[this.newline_count]}return d},e.prototype.matching=function(d,s){var t=this._create();return t.__set_whitespace_patterns(d,s),t._update(),t},e.prototype._create=function(){return new e(this._input,this)},e.prototype.__split=function(d,s){d.lastIndex=0;for(var t=0,i=[],n=d.exec(s);n;)i.push(s.substring(t,n.index)),t=n.index+n[0].length,n=d.exec(s);return t<s.length?i.push(s.substring(t,s.length)):i.push(""),i},y.exports.WhitespacePattern=e},function(y){function h(u,o){this._input=u,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,o&&(this._starting_pattern=this._input.get_regexp(o._starting_pattern,!0),this._match_pattern=this._input.get_regexp(o._match_pattern,!0),this._until_pattern=this._input.get_regexp(o._until_pattern),this._until_after=o._until_after)}h.prototype.read=function(){var u=this._input.read(this._starting_pattern);return(!this._starting_pattern||u)&&(u+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),u},h.prototype.read_match=function(){return this._input.match(this._match_pattern)},h.prototype.until_after=function(u){var o=this._create();return o._until_after=!0,o._until_pattern=this._input.get_regexp(u),o._update(),o},h.prototype.until=function(u){var o=this._create();return o._until_after=!1,o._until_pattern=this._input.get_regexp(u),o._update(),o},h.prototype.starting_with=function(u){var o=this._create();return o._starting_pattern=this._input.get_regexp(u,!0),o._update(),o},h.prototype.matching=function(u){var o=this._create();return o._match_pattern=this._input.get_regexp(u,!0),o._update(),o},h.prototype._create=function(){return new h(this._input,this)},h.prototype._update=function(){},y.exports.Pattern=h},function(y){function h(u,o){u=typeof u=="string"?u:u.source,o=typeof o=="string"?o:o.source,this.__directives_block_pattern=new RegExp(u+/ beautify( \w+[:]\w+)+ /.source+o,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(u+/\sbeautify\signore:end\s/.source+o,"g")}h.prototype.get_directives=function(u){if(!u.match(this.__directives_block_pattern))return null;var o={};this.__directive_pattern.lastIndex=0;for(var e=this.__directive_pattern.exec(u);e;)o[e[1]]=e[2],e=this.__directive_pattern.exec(u);return o},h.prototype.readIgnored=function(u){return u.readUntilAfter(this.__directives_end_ignore_pattern)},y.exports.Directives=h},function(y,h,u){var o=u(12).Pattern,e={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function d(s,t){o.call(this,s,t),this.__template_pattern=null,this._disabled=Object.assign({},e),this._excluded=Object.assign({},e),t&&(this.__template_pattern=this._input.get_regexp(t.__template_pattern),this._excluded=Object.assign(this._excluded,t._excluded),this._disabled=Object.assign(this._disabled,t._disabled));var i=new o(s);this.__patterns={handlebars_comment:i.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:i.starting_with(/{{{/).until_after(/}}}/),handlebars:i.starting_with(/{{/).until_after(/}}/),php:i.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:i.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:i.starting_with(/{%/).until_after(/%}/),django_value:i.starting_with(/{{/).until_after(/}}/),django_comment:i.starting_with(/{#/).until_after(/#}/),smarty:i.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:i.starting_with(/{\*/).until_after(/\*}/),smarty_literal:i.starting_with(/{literal}/).until_after(/{\/literal}/)}}d.prototype=new o,d.prototype._create=function(){return new d(this._input,this)},d.prototype._update=function(){this.__set_templated_pattern()},d.prototype.disable=function(s){var t=this._create();return t._disabled[s]=!0,t._update(),t},d.prototype.read_options=function(s){var t=this._create();for(var i in e)t._disabled[i]=s.templating.indexOf(i)===-1;return t._update(),t},d.prototype.exclude=function(s){var t=this._create();return t._excluded[s]=!0,t._update(),t},d.prototype.read=function(){var s="";this._match_pattern?s=this._input.read(this._starting_pattern):s=this._input.read(this._starting_pattern,this.__template_pattern);for(var t=this._read_template();t;)this._match_pattern?t+=this._input.read(this._match_pattern):t+=this._input.readUntil(this.__template_pattern),s+=t,t=this._read_template();return this._until_after&&(s+=this._input.readUntilAfter(this._until_pattern)),s},d.prototype.__set_templated_pattern=function(){var s=[];this._disabled.php||s.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||s.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||s.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(s.push(this.__patterns.django._starting_pattern.source),s.push(this.__patterns.django_value._starting_pattern.source),s.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||s.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&s.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+s.join("|")+")")},d.prototype._read_template=function(){var s="",t=this._input.peek();if(t==="<"){var i=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&i==="?"&&(s=s||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&i==="%"&&(s=s||this.__patterns.erb.read())}else t==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(s=s||this.__patterns.handlebars_comment.read(),s=s||this.__patterns.handlebars_unescaped.read(),s=s||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(s=s||this.__patterns.django_value.read()),this._excluded.django||(s=s||this.__patterns.django_comment.read(),s=s||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(s=s||this.__patterns.smarty_comment.read(),s=s||this.__patterns.smarty_literal.read(),s=s||this.__patterns.smarty.read()));return s},y.exports.TemplatablePattern=d},,,,function(y,h,u){var o=u(19).Beautifier,e=u(20).Options;function d(s,t,i,n){var T=new o(s,t,i,n);return T.beautify()}y.exports=d,y.exports.defaultOptions=function(){return new e}},function(y,h,u){var o=u(20).Options,e=u(2).Output,d=u(21).Tokenizer,s=u(21).TOKEN,t=/\r\n|[\r\n]/,i=/\r\n|[\r\n]/g,n=function(v,f){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=v.max_preserve_newlines,this.preserve_newlines=v.preserve_newlines,this._output=new e(v,f)};n.prototype.current_line_has_match=function(v){return this._output.current_line.has_match(v)},n.prototype.set_space_before_token=function(v,f){this._output.space_before_token=v,this._output.non_breaking_space=f},n.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},n.prototype.add_raw_token=function(v){this._output.add_raw_token(v)},n.prototype.print_preserved_newlines=function(v){var f=0;v.type!==s.TEXT&&v.previous.type!==s.TEXT&&(f=v.newlines?1:0),this.preserve_newlines&&(f=v.newlines<this.max_preserve_newlines+1?v.newlines:this.max_preserve_newlines+1);for(var x=0;x<f;x++)this.print_newline(x>0);return f!==0},n.prototype.traverse_whitespace=function(v){return v.whitespace_before||v.newlines?(this.print_preserved_newlines(v)||(this._output.space_before_token=!0),!0):!1},n.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},n.prototype.print_newline=function(v){this._output.add_new_line(v)},n.prototype.print_token=function(v){v.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(v.text))},n.prototype.indent=function(){this.indent_level++},n.prototype.get_full_indent=function(v){return v=this.indent_level+(v||0),v<1?"":this._output.get_indent_string(v)};var T=function(v){for(var f=null,x=v.next;x.type!==s.EOF&&v.closed!==x;){if(x.type===s.ATTRIBUTE&&x.text==="type"){x.next&&x.next.type===s.EQUALS&&x.next.next&&x.next.next.type===s.VALUE&&(f=x.next.next.text);break}x=x.next}return f},m=function(v,f){var x=null,R=null;return f.closed?(v==="script"?x="text/javascript":v==="style"&&(x="text/css"),x=T(f)||x,x.search("text/css")>-1?R="css":x.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?R="javascript":x.search(/(text|application|dojo)\/(x-)?(html)/)>-1?R="html":x.search(/test\/null/)>-1&&(R="null"),R):null};function p(v,f){return f.indexOf(v)!==-1}function b(v,f,x){this.parent=v||null,this.tag=f?f.tag_name:"",this.indent_level=x||0,this.parser_token=f||null}function _(v){this._printer=v,this._current_frame=null}_.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},_.prototype.record_tag=function(v){var f=new b(this._current_frame,v,this._printer.indent_level);this._current_frame=f},_.prototype._try_pop_frame=function(v){var f=null;return v&&(f=v.parser_token,this._printer.indent_level=v.indent_level,this._current_frame=v.parent),f},_.prototype._get_frame=function(v,f){for(var x=this._current_frame;x&&!(v.indexOf(x.tag)!==-1);){if(f&&f.indexOf(x.tag)!==-1){x=null;break}x=x.parent}return x},_.prototype.try_pop=function(v,f){var x=this._get_frame([v],f);return this._try_pop_frame(x)},_.prototype.indent_to_tag=function(v){var f=this._get_frame(v);f&&(this._printer.indent_level=f.indent_level)};function a(v,f,x,R){this._source_text=v||"",f=f||{},this._js_beautify=x,this._css_beautify=R,this._tag_stack=null;var O=new o(f,"html");this._options=O,this._is_wrap_attributes_force=this._options.wrap_attributes.substr(0,"force".length)==="force",this._is_wrap_attributes_force_expand_multiline=this._options.wrap_attributes==="force-expand-multiline",this._is_wrap_attributes_force_aligned=this._options.wrap_attributes==="force-aligned",this._is_wrap_attributes_aligned_multiple=this._options.wrap_attributes==="aligned-multiple",this._is_wrap_attributes_preserve=this._options.wrap_attributes.substr(0,"preserve".length)==="preserve",this._is_wrap_attributes_preserve_aligned=this._options.wrap_attributes==="preserve-aligned"}a.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var v=this._source_text,f=this._options.eol;this._options.eol==="auto"&&(f=`
`,v&&t.test(v)&&(f=v.match(t)[0])),v=v.replace(i,`
`);var x=v.match(/^[\t ]*/)[0],R={text:"",type:""},O=new c,B=new n(this._options,x),j=new d(v,this._options).tokenize();this._tag_stack=new _(B);for(var K=null,L=j.next();L.type!==s.EOF;)L.type===s.TAG_OPEN||L.type===s.COMMENT?(K=this._handle_tag_open(B,L,O,R),O=K):L.type===s.ATTRIBUTE||L.type===s.EQUALS||L.type===s.VALUE||L.type===s.TEXT&&!O.tag_complete?K=this._handle_inside_tag(B,L,O,j):L.type===s.TAG_CLOSE?K=this._handle_tag_close(B,L,O):L.type===s.TEXT?K=this._handle_text(B,L,O):B.add_raw_token(L),R=K,L=j.next();var H=B._output.get_code(f);return H},a.prototype._handle_tag_close=function(v,f,x){var R={text:f.text,type:f.type};return v.alignment_size=0,x.tag_complete=!0,v.set_space_before_token(f.newlines||f.whitespace_before!=="",!0),x.is_unformatted?v.add_raw_token(f):(x.tag_start_char==="<"&&(v.set_space_before_token(f.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&x.has_wrapped_attrs&&v.print_newline(!1)),v.print_token(f)),x.indent_content&&!(x.is_unformatted||x.is_content_unformatted)&&(v.indent(),x.indent_content=!1),!x.is_inline_element&&!(x.is_unformatted||x.is_content_unformatted)&&v.set_wrap_point(),R},a.prototype._handle_inside_tag=function(v,f,x,R){var O=x.has_wrapped_attrs,B={text:f.text,type:f.type};if(v.set_space_before_token(f.newlines||f.whitespace_before!=="",!0),x.is_unformatted)v.add_raw_token(f);else if(x.tag_start_char==="{"&&f.type===s.TEXT)v.print_preserved_newlines(f)?(f.newlines=0,v.add_raw_token(f)):v.print_token(f);else{if(f.type===s.ATTRIBUTE?(v.set_space_before_token(!0),x.attr_count+=1):(f.type===s.EQUALS||f.type===s.VALUE&&f.previous.type===s.EQUALS)&&v.set_space_before_token(!1),f.type===s.ATTRIBUTE&&x.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(v.traverse_whitespace(f),O=O||f.newlines!==0),this._is_wrap_attributes_force)){var j=x.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&x.attr_count===1){var K=!0,L=0,H;do{if(H=R.peek(L),H.type===s.ATTRIBUTE){K=!1;break}L+=1}while(L<4&&H.type!==s.EOF&&H.type!==s.TAG_CLOSE);j=!K}j&&(v.print_newline(!1),O=!0)}v.print_token(f),O=O||v.previous_token_wrapped(),x.has_wrapped_attrs=O}return B},a.prototype._handle_text=function(v,f,x){var R={text:f.text,type:"TK_CONTENT"};return x.custom_beautifier_name?this._print_custom_beatifier_text(v,f,x):x.is_unformatted||x.is_content_unformatted?v.add_raw_token(f):(v.traverse_whitespace(f),v.print_token(f)),R},a.prototype._print_custom_beatifier_text=function(v,f,x){var R=this;if(f.text!==""){var O=f.text,B,j=1,K="",L="";x.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?B=this._js_beautify:x.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?B=this._css_beautify:x.custom_beautifier_name==="html"&&(B=function(de,q){var te=new a(de,q,R._js_beautify,R._css_beautify);return te.beautify()}),this._options.indent_scripts==="keep"?j=0:this._options.indent_scripts==="separate"&&(j=-v.indent_level);var H=v.get_full_indent(j);if(O=O.replace(/\n[ \t]*$/,""),x.custom_beautifier_name!=="html"&&O[0]==="<"&&O.match(/^(<!--|<!\[CDATA\[)/)){var Y=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(O);if(!Y){v.add_raw_token(f);return}K=H+Y[1]+`
`,O=Y[4],Y[5]&&(L=H+Y[5]),O=O.replace(/\n[ \t]*$/,""),(Y[2]||Y[3].indexOf(`
`)!==-1)&&(Y=Y[3].match(/[ \t]+$/),Y&&(f.whitespace_before=Y[0]))}if(O)if(B){var ae=function(){this.eol=`
`};ae.prototype=this._options.raw_options;var Z=new ae;O=B(H+O,Z)}else{var ce=f.whitespace_before;ce&&(O=O.replace(new RegExp(`
(`+ce+")?","g"),`
`)),O=H+O.replace(/\n/g,`
`+H)}K&&(O?O=K+O+`
`+L:O=K+L),v.print_newline(!1),O&&(f.text=O,f.whitespace_before="",f.newlines=0,v.add_raw_token(f),v.print_newline(!0))}},a.prototype._handle_tag_open=function(v,f,x,R){var O=this._get_tag_open_token(f);return(x.is_unformatted||x.is_content_unformatted)&&!x.is_empty_element&&f.type===s.TAG_OPEN&&f.text.indexOf("</")===0?(v.add_raw_token(f),O.start_tag_token=this._tag_stack.try_pop(O.tag_name)):(v.traverse_whitespace(f),this._set_tag_position(v,f,O,x,R),O.is_inline_element||v.set_wrap_point(),v.print_token(f)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(O.alignment_size=f.text.length+1),!O.tag_complete&&!O.is_unformatted&&(v.alignment_size=O.alignment_size),O};var c=function(v,f){if(this.parent=v||null,this.text="",this.type="TK_TAG_OPEN",this.tag_name="",this.is_inline_element=!1,this.is_unformatted=!1,this.is_content_unformatted=!1,this.is_empty_element=!1,this.is_start_tag=!1,this.is_end_tag=!1,this.indent_content=!1,this.multiline_content=!1,this.custom_beautifier_name=null,this.start_tag_token=null,this.attr_count=0,this.has_wrapped_attrs=!1,this.alignment_size=0,this.tag_complete=!1,this.tag_start_char="",this.tag_check="",!f)this.tag_complete=!0;else{var x;this.tag_start_char=f.text[0],this.text=f.text,this.tag_start_char==="<"?(x=f.text.match(/^<([^\s>]*)/),this.tag_check=x?x[1]:""):(x=f.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=x?x[1]:"",(f.text.startsWith("{{#>")||f.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&f.next!==null?this.tag_check=f.next.text.split(" ")[0]:this.tag_check=f.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),f.type===s.COMMENT&&(this.tag_complete=!0),this.is_start_tag=this.tag_check.charAt(0)!=="/",this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||f.closed&&f.closed.text==="/>";var R=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(R=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(R)))}};a.prototype._get_tag_open_token=function(v){var f=new c(this._tag_stack.get_parser_token(),v);return f.alignment_size=this._options.wrap_attributes_indent_size,f.is_end_tag=f.is_end_tag||p(f.tag_check,this._options.void_elements),f.is_empty_element=f.tag_complete||f.is_start_tag&&f.is_end_tag,f.is_unformatted=!f.tag_complete&&p(f.tag_check,this._options.unformatted),f.is_content_unformatted=!f.is_empty_element&&p(f.tag_check,this._options.content_unformatted),f.is_inline_element=p(f.tag_name,this._options.inline)||f.tag_name.includes("-")||f.tag_start_char==="{",f},a.prototype._set_tag_position=function(v,f,x,R,O){if(x.is_empty_element||(x.is_end_tag?x.start_tag_token=this._tag_stack.try_pop(x.tag_name):(this._do_optional_end_element(x)&&(x.is_inline_element||v.print_newline(!1)),this._tag_stack.record_tag(x),(x.tag_name==="script"||x.tag_name==="style")&&!(x.is_unformatted||x.is_content_unformatted)&&(x.custom_beautifier_name=m(x.tag_check,f)))),p(x.tag_check,this._options.extra_liners)&&(v.print_newline(!1),v._output.just_added_blankline()||v.print_newline(!0)),x.is_empty_element){if(x.tag_start_char==="{"&&x.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),x.indent_content=!0;var B=v.current_line_has_match(/{{#if/);B||v.print_newline(!1)}x.tag_name==="!--"&&O.type===s.TAG_CLOSE&&R.is_end_tag&&x.text.indexOf(`
`)===-1||(x.is_inline_element||x.is_unformatted||v.print_newline(!1),this._calcluate_parent_multiline(v,x))}else if(x.is_end_tag){var j=!1;j=x.start_tag_token&&x.start_tag_token.multiline_content,j=j||!x.is_inline_element&&!(R.is_inline_element||R.is_unformatted)&&!(O.type===s.TAG_CLOSE&&x.start_tag_token===R)&&O.type!=="TK_CONTENT",(x.is_content_unformatted||x.is_unformatted)&&(j=!1),j&&v.print_newline(!1)}else x.indent_content=!x.custom_beautifier_name,x.tag_start_char==="<"&&(x.tag_name==="html"?x.indent_content=this._options.indent_inner_html:x.tag_name==="head"?x.indent_content=this._options.indent_head_inner_html:x.tag_name==="body"&&(x.indent_content=this._options.indent_body_inner_html)),!(x.is_inline_element||x.is_unformatted)&&(O.type!=="TK_CONTENT"||x.is_content_unformatted)&&v.print_newline(!1),this._calcluate_parent_multiline(v,x)},a.prototype._calcluate_parent_multiline=function(v,f){f.parent&&v._output.just_added_newline()&&!((f.is_inline_element||f.is_unformatted)&&f.parent.is_inline_element)&&(f.parent.multiline_content=!0)};var r=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","nav","ol","p","pre","section","table","ul"],l=["a","audio","del","ins","map","noscript","video"];a.prototype._do_optional_end_element=function(v){var f=null;if(v.is_empty_element||!v.is_start_tag||!v.parent)return;if(v.tag_name==="body")f=f||this._tag_stack.try_pop("head");else if(v.tag_name==="li")f=f||this._tag_stack.try_pop("li",["ol","ul"]);else if(v.tag_name==="dd"||v.tag_name==="dt")f=f||this._tag_stack.try_pop("dt",["dl"]),f=f||this._tag_stack.try_pop("dd",["dl"]);else if(v.parent.tag_name==="p"&&r.indexOf(v.tag_name)!==-1){var x=v.parent.parent;(!x||l.indexOf(x.tag_name)===-1)&&(f=f||this._tag_stack.try_pop("p"))}else v.tag_name==="rp"||v.tag_name==="rt"?(f=f||this._tag_stack.try_pop("rt",["ruby","rtc"]),f=f||this._tag_stack.try_pop("rp",["ruby","rtc"])):v.tag_name==="optgroup"?f=f||this._tag_stack.try_pop("optgroup",["select"]):v.tag_name==="option"?f=f||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):v.tag_name==="colgroup"?f=f||this._tag_stack.try_pop("caption",["table"]):v.tag_name==="thead"?(f=f||this._tag_stack.try_pop("caption",["table"]),f=f||this._tag_stack.try_pop("colgroup",["table"])):v.tag_name==="tbody"||v.tag_name==="tfoot"?(f=f||this._tag_stack.try_pop("caption",["table"]),f=f||this._tag_stack.try_pop("colgroup",["table"]),f=f||this._tag_stack.try_pop("thead",["table"]),f=f||this._tag_stack.try_pop("tbody",["table"])):v.tag_name==="tr"?(f=f||this._tag_stack.try_pop("caption",["table"]),f=f||this._tag_stack.try_pop("colgroup",["table"]),f=f||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(v.tag_name==="th"||v.tag_name==="td")&&(f=f||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),f=f||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return v.parent=this._tag_stack.get_parser_token(),f},y.exports.Beautifier=a},function(y,h,u){var o=u(6).Options;function e(d){o.call(this,d,"html"),this.templating.length===1&&this.templating[0]==="auto"&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}e.prototype=new o,y.exports.Options=e},function(y,h,u){var o=u(9).Tokenizer,e=u(9).TOKEN,d=u(13).Directives,s=u(14).TemplatablePattern,t=u(12).Pattern,i={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:e.START,RAW:e.RAW,EOF:e.EOF},n=new d(/<\!--/,/-->/),T=function(m,p){o.call(this,m,p),this._current_tag_name="";var b=new s(this._input).read_options(this._options),_=new t(this._input);if(this.__patterns={word:b.until(/[\n\r\t <]/),single_quote:b.until_after(/'/),double_quote:b.until_after(/"/),attribute:b.until(/[\n\r\t =>]|\/>/),element_name:b.until(/[\n\r\t >\/]/),handlebars_comment:_.starting_with(/{{!--/).until_after(/--}}/),handlebars:_.starting_with(/{{/).until_after(/}}/),handlebars_open:_.until(/[\n\r\t }]/),handlebars_raw_close:_.until(/}}/),comment:_.starting_with(/<!--/).until_after(/-->/),cdata:_.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:_.starting_with(/<!\[/).until_after(/]>/),processing:_.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var a=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=_.matching(a).until_after(a)}};T.prototype=new o,T.prototype._is_comment=function(m){return!1},T.prototype._is_opening=function(m){return m.type===i.TAG_OPEN},T.prototype._is_closing=function(m,p){return m.type===i.TAG_CLOSE&&p&&((m.text===">"||m.text==="/>")&&p.text[0]==="<"||m.text==="}}"&&p.text[0]==="{"&&p.text[1]==="{")},T.prototype._reset=function(){this._current_tag_name=""},T.prototype._get_next_token=function(m,p){var b=null;this._readWhitespace();var _=this._input.peek();return _===null?this._create_token(i.EOF,""):(b=b||this._read_open_handlebars(_,p),b=b||this._read_attribute(_,m,p),b=b||this._read_close(_,p),b=b||this._read_raw_content(_,m,p),b=b||this._read_content_word(_),b=b||this._read_comment_or_cdata(_),b=b||this._read_processing(_),b=b||this._read_open(_,p),b=b||this._create_token(i.UNKNOWN,this._input.next()),b)},T.prototype._read_comment_or_cdata=function(m){var p=null,b=null,_=null;if(m==="<"){var a=this._input.peek(1);a==="!"&&(b=this.__patterns.comment.read(),b?(_=n.get_directives(b),_&&_.ignore==="start"&&(b+=n.readIgnored(this._input))):b=this.__patterns.cdata.read()),b&&(p=this._create_token(i.COMMENT,b),p.directives=_)}return p},T.prototype._read_processing=function(m){var p=null,b=null,_=null;if(m==="<"){var a=this._input.peek(1);(a==="!"||a==="?")&&(b=this.__patterns.conditional_comment.read(),b=b||this.__patterns.processing.read()),b&&(p=this._create_token(i.COMMENT,b),p.directives=_)}return p},T.prototype._read_open=function(m,p){var b=null,_=null;return p||m==="<"&&(b=this._input.next(),this._input.peek()==="/"&&(b+=this._input.next()),b+=this.__patterns.element_name.read(),_=this._create_token(i.TAG_OPEN,b)),_},T.prototype._read_open_handlebars=function(m,p){var b=null,_=null;return p||this._options.indent_handlebars&&m==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(b=this.__patterns.handlebars_comment.read(),b=b||this.__patterns.handlebars.read(),_=this._create_token(i.COMMENT,b)):(b=this.__patterns.handlebars_open.read(),_=this._create_token(i.TAG_OPEN,b))),_},T.prototype._read_close=function(m,p){var b=null,_=null;return p&&(p.text[0]==="<"&&(m===">"||m==="/"&&this._input.peek(1)===">")?(b=this._input.next(),m==="/"&&(b+=this._input.next()),_=this._create_token(i.TAG_CLOSE,b)):p.text[0]==="{"&&m==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),_=this._create_token(i.TAG_CLOSE,"}}"))),_},T.prototype._read_attribute=function(m,p,b){var _=null,a="";if(b&&b.text[0]==="<")if(m==="=")_=this._create_token(i.EQUALS,this._input.next());else if(m==='"'||m==="'"){var c=this._input.next();m==='"'?c+=this.__patterns.double_quote.read():c+=this.__patterns.single_quote.read(),_=this._create_token(i.VALUE,c)}else a=this.__patterns.attribute.read(),a&&(p.type===i.EQUALS?_=this._create_token(i.VALUE,a):_=this._create_token(i.ATTRIBUTE,a));return _},T.prototype._is_content_unformatted=function(m){return this._options.void_elements.indexOf(m)===-1&&(this._options.content_unformatted.indexOf(m)!==-1||this._options.unformatted.indexOf(m)!==-1)},T.prototype._read_raw_content=function(m,p,b){var _="";if(b&&b.text[0]==="{")_=this.__patterns.handlebars_raw_close.read();else if(p.type===i.TAG_CLOSE&&p.opened.text[0]==="<"&&p.text[0]!=="/"){var a=p.opened.text.substr(1).toLowerCase();if(a==="script"||a==="style"){var c=this._read_comment_or_cdata(m);if(c)return c.type=i.TEXT,c;_=this._input.readUntil(new RegExp("</"+a+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(a)&&(_=this._input.readUntil(new RegExp("</"+a+"[\\n\\r\\t ]*?>","ig")))}return _?this._create_token(i.TEXT,_):null},T.prototype._read_content_word=function(m){var p="";if(this._options.unformatted_content_delimiter&&(m===this._options.unformatted_content_delimiter[0]&&(p=this.__patterns.unformatted_content_delimiter.read())),p||(p=this.__patterns.word.read()),p)return this._create_token(i.TEXT,p)},y.exports.Tokenizer=T,y.exports.TOKEN=i}],k={};function A(y){var h=k[y];if(h!==void 0)return h.exports;var u=k[y]={exports:{}};return N[y](u,u.exports,A),u.exports}var C=A(18);w=C})();var U=w;if(!0)!(_e=[z,z("6UM0"),z("TXwP")],F=function(N){var k=z("6UM0"),A=z("TXwP");return{html_beautify:function(C,y){return U(C,y,k.js_beautify,A.css_beautify)}}}.apply($e,_e),F!==void 0&&(at.exports=F));else var S,I})()},"rAM+":function(at,$e,z){"use strict";z.d($e,"a",function(){return F});var _e=z("Qw5x");function F(w,U){var S;if(typeof Symbol=="undefined"||w[Symbol.iterator]==null){if(Array.isArray(w)||(S=Object(_e.a)(w))||U&&w&&typeof w.length=="number"){S&&(w=S);var I=0,N=function(){};return{s:N,n:function(){return I>=w.length?{done:!0}:{done:!1,value:w[I++]}},e:function(h){throw h},f:N}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var k=!0,A=!1,C;return{s:function(){S=w[Symbol.iterator]()},n:function(){var h=S.next();return k=h.done,h},e:function(h){A=!0,C=h},f:function(){try{!k&&S.return!=null&&S.return()}finally{if(A)throw C}}}}},rUJ1:function(at,$e){const z=/[&<>"']/,_e=/[&<>"']/g,F=/[<>"']|&(?!#?\w+;)/,w=/[<>"']|&(?!#?\w+;)/g,U={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},S=_=>U[_];function I(_,a){if(a){if(z.test(_))return _.replace(_e,S)}else if(F.test(_))return _.replace(w,S);return _}const N=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function k(_){return _.replace(N,(a,c)=>(c=c.toLowerCase(),c==="colon"?":":c.charAt(0)==="#"?c.charAt(1)==="x"?String.fromCharCode(parseInt(c.substring(2),16)):String.fromCharCode(+c.substring(1)):""))}const A=/(^|[^\[])\^/g;function C(_,a){_=_.source||_,a=a||"";const c={replace:(r,l)=>(l=l.source||l,l=l.replace(A,"$1"),_=_.replace(r,l),c),getRegex:()=>new RegExp(_,a)};return c}const y=/[^\w:]/g,h=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function u(_,a,c){if(_){let r;try{r=decodeURIComponent(k(c)).replace(y,"").toLowerCase()}catch(l){return null}if(r.indexOf("javascript:")===0||r.indexOf("vbscript:")===0||r.indexOf("data:")===0)return null}a&&!h.test(c)&&(c=t(a,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(r){return null}return c}const o={},e=/^[^:]+:\/*[^/]*$/,d=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function t(_,a){o[" "+_]||(e.test(_)?o[" "+_]=_+"/":o[" "+_]=m(_,"/",!0)),_=o[" "+_];const c=_.indexOf(":")===-1;return a.substring(0,2)==="//"?c?a:_.replace(d,"$1")+a:a.charAt(0)==="/"?c?a:_.replace(s,"$1")+a:_+a}const i={exec:function(){}};function n(_){let a=1,c,r;for(;a<arguments.length;a++){c=arguments[a];for(r in c)Object.prototype.hasOwnProperty.call(c,r)&&(_[r]=c[r])}return _}function T(_,a){const c=_.replace(/\|/g,(v,f,x)=>{let R=!1,O=f;for(;--O>=0&&x[O]==="\\";)R=!R;return R?"|":" |"}),r=c.split(/ \|/);let l=0;if(r.length>a)r.splice(a);else for(;r.length<a;)r.push("");for(;l<r.length;l++)r[l]=r[l].trim().replace(/\\\|/g,"|");return r}function m(_,a,c){const r=_.length;if(r===0)return"";let l=0;for(;l<r;){const v=_.charAt(r-l-1);if(v===a&&!c)l++;else if(v!==a&&c)l++;else break}return _.substr(0,r-l)}function p(_,a){if(_.indexOf(a[1])===-1)return-1;const c=_.length;let r=0,l=0;for(;l<c;l++)if(_[l]==="\\")l++;else if(_[l]===a[0])r++;else if(_[l]===a[1]&&(r--,r<0))return l;return-1}function b(_){_&&_.sanitize&&!_.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")}at.exports={escape:I,unescape:k,edit:C,cleanUrl:u,resolveUrl:t,noopTest:i,merge:n,splitCells:T,rtrim:m,findClosingBracket:p,checkSanitizeDeprecation:b}},sboe:function(at,$e,z){"use strict";z.d($e,"a",function(){return w});var _e=z("q1tI"),F=z.n(_e),w=_e.createContext(null)},spXi:function(at,$e,z){at.exports={flex_box_center:"flex_box_center___2B_Y7",flex_space_between:"flex_space_between___2olzC",flex_box_vertical_center:"flex_box_vertical_center___2Z4dV",flex_box_center_end:"flex_box_center_end___3FiwX",flex_box_column:"flex_box_column___8kyK-",customTree:"customTree___1KOYx",name:"name___3pqs4"}},t23M:function(at,$e,z){"use strict";var _e=z("VTBJ"),F=z("1OyB"),w=z("vuIU"),U=z("Ji7U"),S=z("LK+K"),I=z("q1tI"),N=z.n(I),k=z("m+aA"),A=z("Zm9Q"),C=z("Kwbf"),y=z("c+Xe"),h=z("bdgK"),u="rc-observer-key",o=function(e){Object(U.a)(s,e);var d=Object(S.a)(s);function s(){var t;return Object(F.a)(this,s),t=d.apply(this,arguments),t.resizeObserver=null,t.childNode=null,t.currentElement=null,t.state={width:0,height:0,offsetHeight:0,offsetWidth:0},t.onResize=function(i){var n=t.props.onResize,T=i[0].target,m=T.getBoundingClientRect(),p=m.width,b=m.height,_=T.offsetWidth,a=T.offsetHeight,c=Math.floor(p),r=Math.floor(b);if(t.state.width!==c||t.state.height!==r||t.state.offsetWidth!==_||t.state.offsetHeight!==a){var l={width:c,height:r,offsetWidth:_,offsetHeight:a};t.setState(l),n&&Promise.resolve().then(function(){n(Object(_e.a)(Object(_e.a)({},l),{},{offsetWidth:_,offsetHeight:a}))})}},t.setChildNode=function(i){t.childNode=i},t}return Object(w.a)(s,[{key:"componentDidMount",value:function(){this.onComponentUpdated()}},{key:"componentDidUpdate",value:function(){this.onComponentUpdated()}},{key:"componentWillUnmount",value:function(){this.destroyObserver()}},{key:"onComponentUpdated",value:function(){var i=this.props.disabled;if(i){this.destroyObserver();return}var n=Object(k.a)(this.childNode||this),T=n!==this.currentElement;T&&(this.destroyObserver(),this.currentElement=n),!this.resizeObserver&&n&&(this.resizeObserver=new h.default(this.onResize),this.resizeObserver.observe(n))}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var i=this.props.children,n=Object(A.a)(i);if(n.length>1)Object(C.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(n.length===0)return Object(C.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var T=n[0];if(I.isValidElement(T)&&Object(y.c)(T)){var m=T.ref;n[0]=I.cloneElement(T,{ref:Object(y.a)(m,this.setChildNode)})}return n.length===1?n[0]:n.map(function(p,b){return!I.isValidElement(p)||"key"in p&&p.key!==null?p:I.cloneElement(p,{key:"".concat(u,"-").concat(b)})})}}]),s}(I.Component);o.displayName="ResizeObserver",$e.a=o},ulZh:function(at,$e,z){typeof window!="undefined"&&function(F,w){at.exports=w()}(this,function(){return function(_e){var F={};function w(U){if(F[U])return F[U].exports;var S=F[U]={i:U,l:!1,exports:{}};return _e[U].call(S.exports,S,S.exports,w),S.l=!0,S.exports}return w.m=_e,w.c=F,w.d=function(U,S,I){w.o(U,S)||Object.defineProperty(U,S,{enumerable:!0,get:I})},w.r=function(U){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(U,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(U,"__esModule",{value:!0})},w.t=function(U,S){if(S&1&&(U=w(U)),S&8)return U;if(S&4&&typeof U=="object"&&U&&U.__esModule)return U;var I=Object.create(null);if(w.r(I),Object.defineProperty(I,"default",{enumerable:!0,value:U}),S&2&&typeof U!="string")for(var N in U)w.d(I,N,function(k){return U[k]}.bind(null,N));return I},w.n=function(U){var S=U&&U.__esModule?function(){return U.default}:function(){return U};return w.d(S,"a",S),S},w.o=function(U,S){return Object.prototype.hasOwnProperty.call(U,S)},w.p="/dist/",w(w.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(_e,F,w){"use strict";var U=Object.prototype.hasOwnProperty,S="~";function I(){}Object.create&&(I.prototype=Object.create(null),new I().__proto__||(S=!1));function N(y,h,u){this.fn=y,this.context=h,this.once=u||!1}function k(y,h,u,o,e){if(typeof u!="function")throw new TypeError("The listener must be a function");var d=new N(u,o||y,e),s=S?S+h:h;return y._events[s]?y._events[s].fn?y._events[s]=[y._events[s],d]:y._events[s].push(d):(y._events[s]=d,y._eventsCount++),y}function A(y,h){--y._eventsCount===0?y._events=new I:delete y._events[h]}function C(){this._events=new I,this._eventsCount=0}C.prototype.eventNames=function(){var h=[],u,o;if(this._eventsCount===0)return h;for(o in u=this._events)U.call(u,o)&&h.push(S?o.slice(1):o);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(u)):h},C.prototype.listeners=function(h){var u=S?S+h:h,o=this._events[u];if(!o)return[];if(o.fn)return[o.fn];for(var e=0,d=o.length,s=new Array(d);e<d;e++)s[e]=o[e].fn;return s},C.prototype.listenerCount=function(h){var u=S?S+h:h,o=this._events[u];return o?o.fn?1:o.length:0},C.prototype.emit=function(h,u,o,e,d,s){var t=S?S+h:h;if(!this._events[t])return!1;var i=this._events[t],n=arguments.length,T,m;if(i.fn){i.once&&this.removeListener(h,i.fn,void 0,!0);switch(n){case 1:return i.fn.call(i.context),!0;case 2:return i.fn.call(i.context,u),!0;case 3:return i.fn.call(i.context,u,o),!0;case 4:return i.fn.call(i.context,u,o,e),!0;case 5:return i.fn.call(i.context,u,o,e,d),!0;case 6:return i.fn.call(i.context,u,o,e,d,s),!0}for(m=1,T=new Array(n-1);m<n;m++)T[m-1]=arguments[m];i.fn.apply(i.context,T)}else{var p=i.length,b;for(m=0;m<p;m++){i[m].once&&this.removeListener(h,i[m].fn,void 0,!0);switch(n){case 1:i[m].fn.call(i[m].context);break;case 2:i[m].fn.call(i[m].context,u);break;case 3:i[m].fn.call(i[m].context,u,o);break;case 4:i[m].fn.call(i[m].context,u,o,e);break;default:if(!T)for(b=1,T=new Array(n-1);b<n;b++)T[b-1]=arguments[b];i[m].fn.apply(i[m].context,T)}}}return!0},C.prototype.on=function(h,u,o){return k(this,h,u,o,!1)},C.prototype.once=function(h,u,o){return k(this,h,u,o,!0)},C.prototype.removeListener=function(h,u,o,e){var d=S?S+h:h;if(!this._events[d])return this;if(!u)return A(this,d),this;var s=this._events[d];if(s.fn)s.fn===u&&(!e||s.once)&&(!o||s.context===o)&&A(this,d);else{for(var t=0,i=[],n=s.length;t<n;t++)(s[t].fn!==u||e&&!s[t].once||o&&s[t].context!==o)&&i.push(s[t]);i.length?this._events[d]=i.length===1?i[0]:i:A(this,d)}return this},C.prototype.removeAllListeners=function(h){var u;return h?(u=S?S+h:h,this._events[u]&&A(this,u)):(this._events=new I,this._eventsCount=0),this},C.prototype.off=C.prototype.removeListener,C.prototype.addListener=C.prototype.on,C.prefixed=S,C.EventEmitter=C,_e.exports=C},"./node_modules/url-toolkit/src/url-toolkit.js":function(_e,F,w){(function(U){var S=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,I=/^([^\/?#]*)([^]*)$/,N=/(?:\/|^)\.(?=\/)/g,k=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,A={buildAbsoluteURL:function(C,y,h){if(h=h||{},C=C.trim(),y=y.trim(),!y){if(!h.alwaysNormalize)return C;var u=A.parseURL(C);if(!u)throw new Error("Error trying to parse base URL.");return u.path=A.normalizePath(u.path),A.buildURLFromParts(u)}var o=A.parseURL(y);if(!o)throw new Error("Error trying to parse relative URL.");if(o.scheme)return h.alwaysNormalize?(o.path=A.normalizePath(o.path),A.buildURLFromParts(o)):y;var e=A.parseURL(C);if(!e)throw new Error("Error trying to parse base URL.");if(!e.netLoc&&e.path&&e.path[0]!=="/"){var d=I.exec(e.path);e.netLoc=d[1],e.path=d[2]}e.netLoc&&!e.path&&(e.path="/");var s={scheme:e.scheme,netLoc:o.netLoc,path:null,params:o.params,query:o.query,fragment:o.fragment};if(!o.netLoc&&(s.netLoc=e.netLoc,o.path[0]!=="/"))if(!o.path)s.path=e.path,o.params||(s.params=e.params,o.query||(s.query=e.query));else{var t=e.path,i=t.substring(0,t.lastIndexOf("/")+1)+o.path;s.path=A.normalizePath(i)}return s.path===null&&(s.path=h.alwaysNormalize?A.normalizePath(o.path):o.path),A.buildURLFromParts(s)},parseURL:function(C){var y=S.exec(C);return y?{scheme:y[1]||"",netLoc:y[2]||"",path:y[3]||"",params:y[4]||"",query:y[5]||"",fragment:y[6]||""}:null},normalizePath:function(C){for(C=C.split("").reverse().join("").replace(N,"");C.length!==(C=C.replace(k,"")).length;);return C.split("").reverse().join("")},buildURLFromParts:function(C){return C.scheme+C.netLoc+C.path+C.params+C.query+C.fragment}};_e.exports=A})(this)},"./node_modules/webworkify-webpack/index.js":function(_e,F,w){function U(h){var u={};function o(d){if(u[d])return u[d].exports;var s=u[d]={i:d,l:!1,exports:{}};return h[d].call(s.exports,s,s.exports,o),s.l=!0,s.exports}o.m=h,o.c=u,o.i=function(d){return d},o.d=function(d,s,t){o.o(d,s)||Object.defineProperty(d,s,{configurable:!1,enumerable:!0,get:t})},o.r=function(d){Object.defineProperty(d,"__esModule",{value:!0})},o.n=function(d){var s=d&&d.__esModule?function(){return d.default}:function(){return d};return o.d(s,"a",s),s},o.o=function(d,s){return Object.prototype.hasOwnProperty.call(d,s)},o.p="/",o.oe=function(d){throw console.error(d),d};var e=o(o.s=ENTRY_MODULE);return e.default||e}var S="[\\.|\\-|\\+|\\w|/|@]+",I="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+S+").*?\\)";function N(h){return(h+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function k(h){return!isNaN(1*h)}function A(h,u,o){var e={};e[o]=[];var d=u.toString(),s=d.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!s)return e;for(var t=s[1],i=new RegExp("(\\\\n|\\W)"+N(t)+I,"g"),n;n=i.exec(d);){if(n[3]==="dll-reference")continue;e[o].push(n[3])}for(i=new RegExp("\\("+N(t)+'\\("(dll-reference\\s('+S+'))"\\)\\)'+I,"g");n=i.exec(d);)h[n[2]]||(e[o].push(n[1]),h[n[2]]=w(n[1]).m),e[n[2]]=e[n[2]]||[],e[n[2]].push(n[4]);for(var T=Object.keys(e),m=0;m<T.length;m++)for(var p=0;p<e[T[m]].length;p++)k(e[T[m]][p])&&(e[T[m]][p]=1*e[T[m]][p]);return e}function C(h){var u=Object.keys(h);return u.reduce(function(o,e){return o||h[e].length>0},!1)}function y(h,u){for(var o={main:[u]},e={main:[]},d={main:{}};C(o);)for(var s=Object.keys(o),t=0;t<s.length;t++){var i=s[t],n=o[i],T=n.pop();if(d[i]=d[i]||{},d[i][T]||!h[i][T])continue;d[i][T]=!0,e[i]=e[i]||[],e[i].push(T);for(var m=A(h,h[i][T],i),p=Object.keys(m),b=0;b<p.length;b++)o[p[b]]=o[p[b]]||[],o[p[b]]=o[p[b]].concat(m[p[b]])}return e}_e.exports=function(h,u){u=u||{};var o={main:w.m},e=u.all?{main:Object.keys(o.main)}:y(o,h),d="";Object.keys(e).filter(function(T){return T!=="main"}).forEach(function(T){for(var m=0;e[T][m];)m++;e[T].push(m),o[T][m]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",d=d+"var "+T+" = ("+U.toString().replace("ENTRY_MODULE",JSON.stringify(m))+")({"+e[T].map(function(p){return""+JSON.stringify(p)+": "+o[T][p].toString()}).join(",")+`});
`}),d=d+"new (("+U.toString().replace("ENTRY_MODULE",JSON.stringify(h))+")({"+e.main.map(function(T){return""+JSON.stringify(T)+": "+o.main[T].toString()}).join(",")+"}))(self);";var s=new window.Blob([d],{type:"text/javascript"});if(u.bare)return s;var t=window.URL||window.webkitURL||window.mozURL||window.msURL,i=t.createObjectURL(s),n=new window.Worker(i);return n.objectURL=i,n}},"./src/config.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"hlsDefaultConfig",function(){return b}),w.d(F,"mergeConfig",function(){return a}),w.d(F,"enableStreamingMode",function(){return c});var U=w("./src/controller/abr-controller.ts"),S=w("./src/controller/audio-stream-controller.ts"),I=w("./src/controller/audio-track-controller.ts"),N=w("./src/controller/subtitle-stream-controller.ts"),k=w("./src/controller/subtitle-track-controller.ts"),A=w("./src/controller/buffer-controller.ts"),C=w("./src/controller/timeline-controller.ts"),y=w("./src/controller/cap-level-controller.ts"),h=w("./src/controller/fps-controller.ts"),u=w("./src/controller/eme-controller.ts"),o=w("./src/controller/cmcd-controller.ts"),e=w("./src/utils/xhr-loader.ts"),d=w("./src/utils/fetch-loader.ts"),s=w("./src/utils/cues.ts"),t=w("./src/utils/mediakeys-helper.ts"),i=w("./src/utils/logger.ts");function n(){return n=Object.assign||function(r){for(var l=1;l<arguments.length;l++){var v=arguments[l];for(var f in v)Object.prototype.hasOwnProperty.call(v,f)&&(r[f]=v[f])}return r},n.apply(this,arguments)}function T(r,l){var v=Object.keys(r);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(r);l&&(f=f.filter(function(x){return Object.getOwnPropertyDescriptor(r,x).enumerable})),v.push.apply(v,f)}return v}function m(r){for(var l=1;l<arguments.length;l++){var v=arguments[l]!=null?arguments[l]:{};l%2?T(Object(v),!0).forEach(function(f){p(r,f,v[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(v)):T(Object(v)).forEach(function(f){Object.defineProperty(r,f,Object.getOwnPropertyDescriptor(v,f))})}return r}function p(r,l,v){return l in r?Object.defineProperty(r,l,{value:v,enumerable:!0,configurable:!0,writable:!0}):r[l]=v,r}var b=m(m({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:e.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:U.default,bufferController:A.default,capLevelController:y.default,fpsController:h.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:t.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},_()),{},{subtitleStreamController:N.SubtitleStreamController,subtitleTrackController:k.default,timelineController:C.TimelineController,audioStreamController:S.default,audioTrackController:I.default,emeController:u.default,cmcdController:o.default});function _(){return{cueHandler:s.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function a(r,l){if((l.liveSyncDurationCount||l.liveMaxLatencyDurationCount)&&(l.liveSyncDuration||l.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(l.liveMaxLatencyDurationCount!==void 0&&(l.liveSyncDurationCount===void 0||l.liveMaxLatencyDurationCount<=l.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(l.liveMaxLatencyDuration!==void 0&&(l.liveSyncDuration===void 0||l.liveMaxLatencyDuration<=l.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return n({},r,l)}function c(r){var l=r.loader;if(l!==d.default&&l!==e.default)i.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),r.progressive=!1;else{var v=Object(d.fetchSupported)();v&&(r.loader=d.default,r.progressive=!0,r.enableSoftwareAES=!0,i.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(_e,F,w){"use strict";w.r(F);var U=w("./src/polyfills/number.ts"),S=w("./src/utils/ewma-bandwidth-estimator.ts"),I=w("./src/events.ts"),N=w("./src/utils/buffer-helper.ts"),k=w("./src/errors.ts"),A=w("./src/types/loader.ts"),C=w("./src/utils/logger.ts");function y(o,e){for(var d=0;d<e.length;d++){var s=e[d];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(o,s.key,s)}}function h(o,e,d){return e&&y(o.prototype,e),d&&y(o,d),o}var u=function(){function o(d){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=d;var s=d.config;this.bwEstimator=new S.default(s.abrEwmaSlowVoD,s.abrEwmaFastVoD,s.abrEwmaDefaultEstimate),this.registerListeners()}var e=o.prototype;return e.registerListeners=function(){var s=this.hls;s.on(I.Events.FRAG_LOADING,this.onFragLoading,this),s.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(I.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.on(I.Events.ERROR,this.onError,this)},e.unregisterListeners=function(){var s=this.hls;s.off(I.Events.FRAG_LOADING,this.onFragLoading,this),s.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(I.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.off(I.Events.ERROR,this.onError,this)},e.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},e.onFragLoading=function(s,t){var i=t.frag;if(i.type===A.PlaylistLevelType.MAIN&&!this.timer){var n;this.fragCurrent=i,this.partCurrent=(n=t.part)!=null?n:null,this.timer=self.setInterval(this.onCheck,100)}},e.onLevelLoaded=function(s,t){var i=this.hls.config;t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)},e._abandonRulesCheck=function(){var s=this.fragCurrent,t=this.partCurrent,i=this.hls,n=i.autoLevelEnabled,T=i.config,m=i.media;if(!s||!m)return;var p=t?t.stats:s.stats,b=t?t.duration:s.duration;if(p.aborted){C.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!n||m.paused||!m.playbackRate||!m.readyState)return;var _=performance.now()-p.loading.start,a=Math.abs(m.playbackRate);if(_<=500*b/a)return;var c=i.levels,r=i.minAutoLevel,l=c[s.level],v=p.total||Math.max(p.loaded,Math.round(b*l.maxBitrate/8)),f=Math.max(1,p.bwEstimate?p.bwEstimate/8:p.loaded*1e3/_),x=(v-p.loaded)/f,R=m.currentTime,O=(N.BufferHelper.bufferInfo(m,R,T.maxBufferHole).end-R)/a;if(O>=2*b/a||x<=O)return;var B=Number.POSITIVE_INFINITY,j;for(j=s.level-1;j>r;j--){var K=c[j].maxBitrate;if(B=b*K/(8*.8*f),B<O)break}if(B>=x)return;var L=this.bwEstimator.getEstimate();C.logger.warn("Fragment "+s.sn+(t?" part "+t.index:"")+" of level "+s.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+j+`
Current BW estimate: `+(Object(U.isFiniteNumber)(L)?(L/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+x.toFixed(3)+` s
Estimated load time for the next fragment: `+B.toFixed(3)+` s
Time to underbuffer: `+O.toFixed(3)+" s"),i.nextLoadLevel=j,this.bwEstimator.sample(_,p.loaded),this.clearTimer(),s.loader&&(this.fragCurrent=this.partCurrent=null,s.loader.abort()),i.trigger(I.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:s,part:t,stats:p})},e.onFragLoaded=function(s,t){var i=t.frag,n=t.part;if(i.type===A.PlaylistLevelType.MAIN&&Object(U.isFiniteNumber)(i.sn)){var T=n?n.stats:i.stats,m=n?n.duration:i.duration;if(this.clearTimer(),this.lastLoadedFragLevel=i.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var p=this.hls.levels[i.level],b=(p.loaded?p.loaded.bytes:0)+T.loaded,_=(p.loaded?p.loaded.duration:0)+m;p.loaded={bytes:b,duration:_},p.realBitrate=Math.round(8*b/_)}if(i.bitrateTest){var a={stats:T,frag:i,part:n,id:i.type};this.onFragBuffered(I.Events.FRAG_BUFFERED,a),i.bitrateTest=!1}}},e.onFragBuffered=function(s,t){var i=t.frag,n=t.part,T=n?n.stats:i.stats;if(T.aborted)return;if(i.type!==A.PlaylistLevelType.MAIN||i.sn==="initSegment")return;var m=T.parsing.end-T.loading.start;this.bwEstimator.sample(m,T.loaded),T.bwEstimate=this.bwEstimator.getEstimate(),i.bitrateTest?this.bitrateTestDelay=m/1e3:this.bitrateTestDelay=0},e.onError=function(s,t){switch(t.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},e.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},e.getNextABRAutoLevel=function(){var s=this.fragCurrent,t=this.partCurrent,i=this.hls,n=i.maxAutoLevel,T=i.config,m=i.minAutoLevel,p=i.media,b=t?t.duration:s?s.duration:0,_=p?p.currentTime:0,a=p&&p.playbackRate!==0?Math.abs(p.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():T.abrEwmaDefaultEstimate,r=(N.BufferHelper.bufferInfo(p,_,T.maxBufferHole).end-_)/a,l=this.findBestLevel(c,m,n,r,T.abrBandWidthFactor,T.abrBandWidthUpFactor);if(l>=0)return l;C.logger.trace((r?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var v=b?Math.min(b,T.maxStarvationDelay):T.maxStarvationDelay,f=T.abrBandWidthFactor,x=T.abrBandWidthUpFactor;if(!r){var R=this.bitrateTestDelay;if(R){var O=b?Math.min(b,T.maxLoadingDelay):T.maxLoadingDelay;v=O-R,C.logger.trace("bitrate test took "+Math.round(1e3*R)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*v)+" ms"),f=x=1}}return l=this.findBestLevel(c,m,n,r+v,f,x),Math.max(l,0)},e.findBestLevel=function(s,t,i,n,T,m){for(var p,b=this.fragCurrent,_=this.partCurrent,a=this.lastLoadedFragLevel,c=this.hls.levels,r=c[a],l=!!(r!=null&&(p=r.details)!==null&&p!==void 0&&p.live),v=r==null?void 0:r.codecSet,f=_?_.duration:b?b.duration:0,x=i;x>=t;x--){var R=c[x];if(!R||v&&R.codecSet!==v)continue;var O=R.details,B=(_?O==null?void 0:O.partTarget:O==null?void 0:O.averagetargetduration)||f,j=void 0;x<=a?j=T*s:j=m*s;var K=c[x].maxBitrate,L=K*B/j;if(C.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+x+"/"+Math.round(j)+"/"+K+"/"+B+"/"+n+"/"+L),j>K&&(!L||l&&!this.bitrateTestDelay||L<n))return x}return-1},h(o,[{key:"nextAutoLevel",get:function(){var s=this._nextAutoLevel,t=this.bwEstimator;if(s!==-1&&(!t||!t.canEstimate()))return s;var i=this.getNextABRAutoLevel();return s!==-1&&(i=Math.min(s,i)),i},set:function(s){this._nextAutoLevel=s}}]),o}();F.default=u},"./src/controller/audio-stream-controller.ts":function(_e,F,w){"use strict";w.r(F);var U=w("./src/polyfills/number.ts"),S=w("./src/controller/base-stream-controller.ts"),I=w("./src/events.ts"),N=w("./src/utils/buffer-helper.ts"),k=w("./src/controller/fragment-tracker.ts"),A=w("./src/types/level.ts"),C=w("./src/types/loader.ts"),y=w("./src/loader/fragment.ts"),h=w("./src/demux/chunk-cache.ts"),u=w("./src/demux/transmuxer-interface.ts"),o=w("./src/types/transmuxer.ts"),e=w("./src/controller/fragment-finders.ts"),d=w("./src/utils/discontinuities.ts"),s=w("./src/errors.ts"),t=w("./src/utils/logger.ts");function i(){return i=Object.assign||function(b){for(var _=1;_<arguments.length;_++){var a=arguments[_];for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c])}return b},i.apply(this,arguments)}function n(b,_){b.prototype=Object.create(_.prototype),b.prototype.constructor=b,T(b,_)}function T(b,_){return T=Object.setPrototypeOf||function(c,r){return c.__proto__=r,c},T(b,_)}var m=100,p=function(b){n(_,b);function _(c,r){var l;return l=b.call(this,c,r,"[audio-stream-controller]")||this,l.videoBuffer=null,l.videoTrackCC=-1,l.waitingVideoCC=-1,l.audioSwitch=!1,l.trackId=-1,l.waitingData=null,l.mainDetails=null,l.bufferFlushed=!1,l._registerListeners(),l}var a=_.prototype;return a.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},a._registerListeners=function(){var r=this.hls;r.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.on(I.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),r.on(I.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),r.on(I.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),r.on(I.Events.ERROR,this.onError,this),r.on(I.Events.BUFFER_RESET,this.onBufferReset,this),r.on(I.Events.BUFFER_CREATED,this.onBufferCreated,this),r.on(I.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),r.on(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),r.on(I.Events.FRAG_BUFFERED,this.onFragBuffered,this)},a._unregisterListeners=function(){var r=this.hls;r.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.off(I.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),r.off(I.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),r.off(I.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),r.off(I.Events.ERROR,this.onError,this),r.off(I.Events.BUFFER_RESET,this.onBufferReset,this),r.off(I.Events.BUFFER_CREATED,this.onBufferCreated,this),r.off(I.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),r.off(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),r.off(I.Events.FRAG_BUFFERED,this.onFragBuffered,this)},a.onInitPtsFound=function(r,l){var v=l.frag,f=l.id,x=l.initPTS;if(f==="main"){var R=v.cc;this.initPTS[v.cc]=x,this.log("InitPTS for cc: "+R+" found from main: "+x),this.videoTrackCC=R,this.state===S.State.WAITING_INIT_PTS&&this.tick()}},a.startLoad=function(r){if(!this.levels){this.startPosition=r,this.state=S.State.STOPPED;return}var l=this.lastCurrentTime;this.stopLoad(),this.setInterval(m),this.fragLoadError=0,l>0&&r===-1?(this.log("Override startPosition with lastCurrentTime @"+l.toFixed(3)),this.state=S.State.IDLE):(this.loadedmetadata=!1,this.state=S.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=r,this.tick()},a.doTick=function(){switch(this.state){case S.State.IDLE:this.doTickIdle();break;case S.State.WAITING_TRACK:{var r,l=this.levels,v=this.trackId,f=l==null||((r=l[v])===null||r===void 0)?void 0:r.details;if(f){if(this.waitForCdnTuneIn(f))break;this.state=S.State.WAITING_INIT_PTS}break}case S.State.FRAG_LOADING_WAITING_RETRY:{var x,R=performance.now(),O=this.retryDate;(!O||R>=O||(x=this.media)!==null&&x!==void 0&&x.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=S.State.IDLE);break}case S.State.WAITING_INIT_PTS:{var B=this.waitingData;if(B){var j=B.frag,K=B.part,L=B.cache,H=B.complete;if(this.initPTS[j.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=S.State.FRAG_LOADING;var Y=L.flush(),ae={frag:j,part:K,payload:Y,networkDetails:null};this._handleFragmentLoadProgress(ae),H&&b.prototype._handleFragmentLoadComplete.call(this,ae)}else if(this.videoTrackCC!==this.waitingVideoCC)t.logger.log("Waiting fragment cc ("+j.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var Z=this.getLoadPosition(),ce=N.BufferHelper.bufferInfo(this.mediaBuffer,Z,this.config.maxBufferHole),de=Object(e.fragmentWithinToleranceTest)(ce.end,this.config.maxFragLookUpTolerance,j);de<0&&(t.logger.log("Waiting fragment cc ("+j.cc+") @ "+j.start+" cancelled because another fragment at "+ce.end+" is needed"),this.clearWaitingFragment())}}else this.state=S.State.IDLE}}this.onTickEnd()},a.clearWaitingFragment=function(){var r=this.waitingData;r&&(this.fragmentTracker.removeFragment(r.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=S.State.IDLE)},a.onTickEnd=function(){var r=this.media;if(!r||!r.readyState)return;var l=this.mediaBuffer?this.mediaBuffer:r,v=l.buffered;!this.loadedmetadata&&v.length&&(this.loadedmetadata=!0),this.lastCurrentTime=r.currentTime},a.doTickIdle=function(){var r,l,v=this.hls,f=this.levels,x=this.media,R=this.trackId,O=v.config;if(!f||!f[R])return;if(!x&&(this.startFragRequested||!O.startFragPrefetch))return;var B=f[R],j=B.details;if(!j||j.live&&this.levelLastLoaded!==R||this.waitForCdnTuneIn(j)){this.state=S.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,y.ElementaryStreamTypes.AUDIO,C.PlaylistLevelType.AUDIO));var K=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,C.PlaylistLevelType.AUDIO);if(K===null)return;var L=K.len,H=this.getMaxBufferLength(),Y=this.audioSwitch;if(L>=H&&!Y)return;if(!Y&&this._streamEnded(K,j)){v.trigger(I.Events.BUFFER_EOS,{type:"audio"}),this.state=S.State.ENDED;return}var ae=j.fragments,Z=ae[0].start,ce=K.end;if(Y){var de=this.getLoadPosition();ce=de,j.PTSKnown&&de<Z&&((K.end>Z||K.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),x.currentTime=Z+.05))}var q=this.getNextFragment(ce,j);if(!q){this.bufferFlushed=!0;return}((r=q.decryptdata)===null||r===void 0?void 0:r.keyFormat)==="identity"&&!((l=q.decryptdata)!==null&&l!==void 0&&l.key)?this.loadKey(q,j):this.loadFragment(q,j,ce)},a.getMaxBufferLength=function(){var r=b.prototype.getMaxBufferLength.call(this),l=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,C.PlaylistLevelType.MAIN);return l===null?r:Math.max(r,l.len)},a.onMediaDetaching=function(){this.videoBuffer=null,b.prototype.onMediaDetaching.call(this)},a.onAudioTracksUpdated=function(r,l){var v=l.audioTracks;this.resetTransmuxer(),this.levels=v.map(function(f){return new A.Level(f)})},a.onAudioTrackSwitching=function(r,l){var v=!!l.url;this.trackId=l.id;var f=this.fragCurrent;f!=null&&f.loader&&f.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),v?this.setInterval(m):this.resetTransmuxer(),v?(this.audioSwitch=!0,this.state=S.State.IDLE):this.state=S.State.STOPPED,this.tick()},a.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},a.onLevelLoaded=function(r,l){this.mainDetails=l.details},a.onAudioTrackLoaded=function(r,l){var v,f=this.levels,x=l.details,R=l.id;if(!f){this.warn("Audio tracks were reset while loading level "+R);return}this.log("Track "+R+" loaded ["+x.startSN+","+x.endSN+"],duration:"+x.totalduration);var O=f[R],B=0;if(x.live||(v=O.details)!==null&&v!==void 0&&v.live){var j=this.mainDetails;if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed||!j)return;!O.details&&x.hasProgramDateTime&&j.hasProgramDateTime?(Object(d.alignMediaPlaylistByPDT)(x,j),B=x.fragments[0].start):B=this.alignPlaylists(x,O.details)}O.details=x,this.levelLastLoaded=R,!this.startFragRequested&&(this.mainDetails||!x.live)&&this.setStartPosition(O.details,B),this.state===S.State.WAITING_TRACK&&!this.waitForCdnTuneIn(x)&&(this.state=S.State.IDLE),this.tick()},a._handleFragmentLoadProgress=function(r){var l,v=r.frag,f=r.part,x=r.payload,R=this.config,O=this.trackId,B=this.levels;if(!B){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+v.sn+" of level "+v.level+" will not be buffered");return}var j=B[O];console.assert(j,"Audio track is defined on fragment load progress");var K=j.details;console.assert(K,"Audio track details are defined on fragment load progress");var L=R.defaultAudioCodec||j.audioCodec||"mp4a.40.2",H=this.transmuxer;H||(H=this.transmuxer=new u.default(this.hls,C.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Y=this.initPTS[v.cc],ae=(l=v.initSegment)===null||l===void 0?void 0:l.data;if(Y!==void 0){var Z=!1,ce=f?f.index:-1,de=ce!==-1,q=new o.ChunkMetadata(v.level,v.sn,v.stats.chunkCount,x.byteLength,ce,de);H.push(x,ae,L,"",v,f,K.totalduration,Z,q,Y)}else{t.logger.log("Unknown video PTS for cc "+v.cc+", waiting for video PTS before demuxing audio frag "+v.sn+" of ["+K.startSN+" ,"+K.endSN+"],track "+O);var te=this.waitingData=this.waitingData||{frag:v,part:f,cache:new h.default,complete:!1},he=te.cache;he.push(new Uint8Array(x)),this.waitingVideoCC=this.videoTrackCC,this.state=S.State.WAITING_INIT_PTS}},a._handleFragmentLoadComplete=function(r){if(this.waitingData){this.waitingData.complete=!0;return}b.prototype._handleFragmentLoadComplete.call(this,r)},a.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},a.onBufferCreated=function(r,l){var v=l.tracks.audio;v&&(this.mediaBuffer=v.buffer),l.tracks.video&&(this.videoBuffer=l.tracks.video.buffer)},a.onFragBuffered=function(r,l){var v=l.frag,f=l.part;if(v.type!==C.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(v)){this.warn("Fragment "+v.sn+(f?" p: "+f.index:"")+" of level "+v.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}v.sn!=="initSegment"&&(this.fragPrevious=v,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(I.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(v,f)},a.onError=function(r,l){switch(l.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:case s.ErrorDetails.KEY_LOAD_ERROR:case s.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(C.PlaylistLevelType.AUDIO,l);break;case s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==S.State.ERROR&&this.state!==S.State.STOPPED&&(this.state=l.fatal?S.State.ERROR:S.State.IDLE,this.warn(l.details+" while loading frag, switching to "+this.state+" state"));break;case s.ErrorDetails.BUFFER_FULL_ERROR:if(l.parent==="audio"&&(this.state===S.State.PARSING||this.state===S.State.PARSED)){var v=!0,f=this.getFwdBufferInfo(this.mediaBuffer,C.PlaylistLevelType.AUDIO);f&&f.len>.5&&(v=!this.reduceMaxBufferLength(f.len)),v&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,b.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},a.onBufferFlushed=function(r,l){var v=l.type;v===y.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},a._handleTransmuxComplete=function(r){var l,v="audio",f=this.hls,x=r.remuxResult,R=r.chunkMeta,O=this.getCurrentContext(R);if(!O){this.warn("The loading context changed while buffering fragment "+R.sn+" of level "+R.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(R.level);return}var B=O.frag,j=O.part,K=x.audio,L=x.text,H=x.id3,Y=x.initSegment;if(this.fragContextChanged(B))return;if(this.state=S.State.PARSING,this.audioSwitch&&K&&this.completeAudioSwitch(),Y!=null&&Y.tracks&&(this._bufferInitSegment(Y.tracks,B,R),f.trigger(I.Events.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:v,tracks:Y.tracks})),K){var ae=K.startPTS,Z=K.endPTS,ce=K.startDTS,de=K.endDTS;j&&(j.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:ae,endPTS:Z,startDTS:ce,endDTS:de}),B.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,ae,Z,ce,de),this.bufferFragmentData(K,B,j,R)}if(H!=null&&(l=H.samples)!==null&&l!==void 0&&l.length){var q=i({frag:B,id:v},H);f.trigger(I.Events.FRAG_PARSING_METADATA,q)}if(L){var te=i({frag:B,id:v},L);f.trigger(I.Events.FRAG_PARSING_USERDATA,te)}},a._bufferInitSegment=function(r,l,v){if(this.state!==S.State.PARSING)return;r.video&&delete r.video;var f=r.audio;if(!f)return;f.levelCodec=f.codec,f.id="audio",this.log("Init audio buffer, container:"+f.container+", codecs[parsed]=["+f.codec+"]"),this.hls.trigger(I.Events.BUFFER_CODECS,r);var x=f.initSegment;if(x!=null&&x.byteLength){var R={type:"audio",frag:l,part:null,chunkMeta:v,parent:l.type,data:x};this.hls.trigger(I.Events.BUFFER_APPENDING,R)}this.tick()},a.loadFragment=function(r,l,v){var f=this.fragmentTracker.getState(r);this.fragCurrent=r,(this.audioSwitch||f===k.FragmentState.NOT_LOADED||f===k.FragmentState.PARTIAL)&&(r.sn==="initSegment"?this._loadInitSegment(r):l.live&&!Object(U.isFiniteNumber)(this.initPTS[r.cc])?(this.log("Waiting for video PTS in continuity counter "+r.cc+" of live stream before loading audio fragment "+r.sn+" of level "+this.trackId),this.state=S.State.WAITING_INIT_PTS):(this.startFragRequested=!0,b.prototype.loadFragment.call(this,r,l,v)))},a.completeAudioSwitch=function(){var r=this.hls,l=this.media,v=this.trackId;l&&(this.log("Switching audio track : flushing all audio"),b.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,r.trigger(I.Events.AUDIO_TRACK_SWITCHED,{id:v})},_}(S.default);F.default=p},"./src/controller/audio-track-controller.ts":function(_e,F,w){"use strict";w.r(F);var U=w("./src/events.ts"),S=w("./src/errors.ts"),I=w("./src/controller/base-playlist-controller.ts"),N=w("./src/types/loader.ts");function k(u,o){for(var e=0;e<o.length;e++){var d=o[e];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(u,d.key,d)}}function A(u,o,e){return o&&k(u.prototype,o),e&&k(u,e),u}function C(u,o){u.prototype=Object.create(o.prototype),u.prototype.constructor=u,y(u,o)}function y(u,o){return y=Object.setPrototypeOf||function(d,s){return d.__proto__=s,d},y(u,o)}var h=function(u){C(o,u);function o(d){var s;return s=u.call(this,d,"[audio-track-controller]")||this,s.tracks=[],s.groupId=null,s.tracksInGroup=[],s.trackId=-1,s.trackName="",s.selectDefaultTrack=!0,s.registerListeners(),s}var e=o.prototype;return e.registerListeners=function(){var s=this.hls;s.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),s.on(U.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.on(U.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.on(U.Events.ERROR,this.onError,this)},e.unregisterListeners=function(){var s=this.hls;s.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off(U.Events.LEVEL_LOADING,this.onLevelLoading,this),s.off(U.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.off(U.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.off(U.Events.ERROR,this.onError,this)},e.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,u.prototype.destroy.call(this)},e.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},e.onManifestParsed=function(s,t){this.tracks=t.audioTracks||[]},e.onAudioTrackLoaded=function(s,t){var i=t.id,n=t.details,T=this.tracksInGroup[i];if(!T){this.warn("Invalid audio track id "+i);return}var m=T.details;T.details=t.details,this.log("audioTrack "+i+" loaded ["+n.startSN+"-"+n.endSN+"]"),i===this.trackId&&(this.retryCount=0,this.playlistLoaded(i,t,m))},e.onLevelLoading=function(s,t){this.switchLevel(t.level)},e.onLevelSwitching=function(s,t){this.switchLevel(t.level)},e.switchLevel=function(s){var t=this.hls.levels[s];if(!(t!=null&&t.audioGroupIds))return;var i=t.audioGroupIds[t.urlId];if(this.groupId!==i){this.groupId=i;var n=this.tracks.filter(function(m){return!i||m.groupId===i});this.selectDefaultTrack&&!n.some(function(m){return m.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=n;var T={audioTracks:n};this.log("Updating audio tracks, "+n.length+' track(s) found in "'+i+'" group-id'),this.hls.trigger(U.Events.AUDIO_TRACKS_UPDATED,T),this.selectInitialTrack()}},e.onError=function(s,t){if(u.prototype.onError.call(this,s,t),t.fatal||!t.context)return;t.context.type===N.PlaylistContextType.AUDIO_TRACK&&t.context.id===this.trackId&&t.context.groupId===this.groupId&&this.retryLoadingOrFail(t)},e.setAudioTrack=function(s){var t=this.tracksInGroup;if(s<0||s>=t.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var i=t[this.trackId];this.log("Now switching to audio-track index "+s);var n=t[s],T=n.id,m=n.groupId,p=m===void 0?"":m,b=n.name,_=n.type,a=n.url;if(this.trackId=s,this.trackName=b,this.selectDefaultTrack=!1,this.hls.trigger(U.Events.AUDIO_TRACK_SWITCHING,{id:T,groupId:p,name:b,type:_,url:a}),n.details&&!n.details.live)return;var c=this.switchParams(n.url,i==null?void 0:i.details);this.loadPlaylist(c)},e.selectInitialTrack=function(){var s=this.tracksInGroup;console.assert(s.length,"Initial audio track should be selected when tracks are known");var t=this.trackName,i=this.findTrackId(t)||this.findTrackId();i!==-1?this.setAudioTrack(i):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(U.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},e.findTrackId=function(s){for(var t=this.tracksInGroup,i=0;i<t.length;i++){var n=t[i];if((!this.selectDefaultTrack||n.default)&&(!s||s===n.name))return n.id}return-1},e.loadPlaylist=function(s){var t=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(t)){var i=t.id,n=t.groupId,T=t.url;if(s)try{T=s.addDirectives(T)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("loading audio-track playlist for id: "+i),this.clearTimer(),this.hls.trigger(U.Events.AUDIO_TRACK_LOADING,{url:T,id:i,groupId:n,deliveryDirectives:s||null})}},A(o,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(s){this.selectDefaultTrack=!1,this.setAudioTrack(s)}}]),o}(I.default);F.default=h},"./src/controller/base-playlist-controller.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"default",function(){return A});var U=w("./src/polyfills/number.ts"),S=w("./src/types/level.ts"),I=w("./src/controller/level-helper.ts"),N=w("./src/utils/logger.ts"),k=w("./src/errors.ts"),A=function(){function C(h,u){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=N.logger.log.bind(N.logger,u+":"),this.warn=N.logger.warn.bind(N.logger,u+":"),this.hls=h}var y=C.prototype;return y.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},y.onError=function(u,o){o.fatal&&o.type===k.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(u,o){var e=o==null?void 0:o.renditionReports;if(e)for(var d=0;d<e.length;d++){var s=e[d],t=""+s.URI;if(t===u.substr(-t.length)){var i=parseInt(s["LAST-MSN"]),n=parseInt(s["LAST-PART"]);if(o&&this.hls.config.lowLatencyMode){var T=Math.min(o.age-o.partTarget,o.targetduration);n!==void 0&&T>o.partTarget&&(n+=1)}if(Object(U.isFiniteNumber)(i))return new S.HlsUrlParameters(i,Object(U.isFiniteNumber)(n)?n:void 0,S.HlsSkip.No)}}},y.loadPlaylist=function(u){},y.shouldLoadTrack=function(u){return this.canLoad&&u&&!!u.url&&(!u.details||u.details.live)},y.playlistLoaded=function(u,o,e){var d=this,s=o.details,t=o.stats,i=t.loading.end?Math.max(0,self.performance.now()-t.loading.end):0;if(s.advancedDateTime=Date.now()-i,s.live||e!=null&&e.live){if(s.reloaded(e),e&&this.log("live playlist "+u+" "+(s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:"MISSED")),e&&s.fragments.length>0&&Object(I.mergeDetails)(e,s),!this.canLoad||!s.live)return;var n,T=void 0,m=void 0;if(s.canBlockReload&&s.endSN&&s.advanced){var p=this.hls.config.lowLatencyMode,b=s.lastPartSn,_=s.endSN,a=s.lastPartIndex,c=a!==-1,r=b===_,l=p?0:a;c?(T=r?_+1:b,m=r?l:a+1):T=_+1;var v=s.age,f=v+s.ageHeader,x=Math.min(f-s.partTarget,s.targetduration*1.5);if(x>0){if(e&&x>e.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+e.tuneInGoal+" to: "+x+" with playlist age: "+s.age),x=0;else{var R=Math.floor(x/s.targetduration);if(T+=R,m!==void 0){var O=Math.round(x%s.targetduration/s.partTarget);m+=O}this.log("CDN Tune-in age: "+s.ageHeader+"s last advanced "+v.toFixed(2)+"s goal: "+x+" skip sn "+R+" to part "+m)}s.tuneInGoal=x}if(n=this.getDeliveryDirectives(s,o.deliveryDirectives,T,m),p||!r){this.loadPlaylist(n);return}}else n=this.getDeliveryDirectives(s,o.deliveryDirectives,T,m);var B=Object(I.computeReloadInterval)(s,t);T!==void 0&&s.canBlockReload&&(B-=s.partTarget||1),this.log("reload live playlist "+u+" in "+Math.round(B)+" ms"),this.timer=self.setTimeout(function(){return d.loadPlaylist(n)},B)}else this.clearTimer()},y.getDeliveryDirectives=function(u,o,e,d){var s=Object(S.getSkipValue)(u,e);return o!=null&&o.skip&&u.deltaUpdateFailed&&(e=o.msn,d=o.part,s=S.HlsSkip.No),new S.HlsUrlParameters(e,d,s)},y.retryLoadingOrFail=function(u){var o=this,e=this.hls.config,d=this.retryCount<e.levelLoadingMaxRetry;if(d){var s;if(this.retryCount++,u.details.indexOf("LoadTimeOut")>-1&&(s=u.context)!==null&&s!==void 0&&s.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+u.details+'"'),this.loadPlaylist();else{var t=Math.min(Math.pow(2,this.retryCount)*e.levelLoadingRetryDelay,e.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return o.loadPlaylist()},t),this.warn("retry playlist loading #"+this.retryCount+" in "+t+' ms after "'+u.details+'"')}}else this.warn('cannot recover from error "'+u.details+'"'),this.clearTimer(),u.fatal=!0;return d},C}()},"./src/controller/base-stream-controller.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"State",function(){return _}),w.d(F,"default",function(){return a});var U=w("./src/polyfills/number.ts"),S=w("./src/task-loop.ts"),I=w("./src/controller/fragment-tracker.ts"),N=w("./src/utils/buffer-helper.ts"),k=w("./src/utils/logger.ts"),A=w("./src/events.ts"),C=w("./src/errors.ts"),y=w("./src/types/transmuxer.ts"),h=w("./src/utils/mp4-tools.ts"),u=w("./src/utils/discontinuities.ts"),o=w("./src/controller/fragment-finders.ts"),e=w("./src/controller/level-helper.ts"),d=w("./src/loader/fragment-loader.ts"),s=w("./src/crypt/decrypter.ts"),t=w("./src/utils/time-ranges.ts"),i=w("./src/types/loader.ts");function n(c,r){for(var l=0;l<r.length;l++){var v=r[l];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(c,v.key,v)}}function T(c,r,l){return r&&n(c.prototype,r),l&&n(c,l),c}function m(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function p(c,r){c.prototype=Object.create(r.prototype),c.prototype.constructor=c,b(c,r)}function b(c,r){return b=Object.setPrototypeOf||function(v,f){return v.__proto__=f,v},b(c,r)}var _={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"},a=function(c){p(r,c);function r(v,f,x){var R;return R=c.call(this)||this,R.hls=void 0,R.fragPrevious=null,R.fragCurrent=null,R.fragmentTracker=void 0,R.transmuxer=null,R._state=_.STOPPED,R.media=void 0,R.mediaBuffer=void 0,R.config=void 0,R.bitrateTest=!1,R.lastCurrentTime=0,R.nextLoadPosition=0,R.startPosition=0,R.loadedmetadata=!1,R.fragLoadError=0,R.retryDate=0,R.levels=null,R.fragmentLoader=void 0,R.levelLastLoaded=null,R.startFragRequested=!1,R.decrypter=void 0,R.initPTS=[],R.onvseeking=null,R.onvended=null,R.logPrefix="",R.log=void 0,R.warn=void 0,R.logPrefix=x,R.log=k.logger.log.bind(k.logger,x+":"),R.warn=k.logger.warn.bind(k.logger,x+":"),R.hls=v,R.fragmentLoader=new d.default(v.config),R.fragmentTracker=f,R.config=v.config,R.decrypter=new s.default(v,v.config),v.on(A.Events.KEY_LOADED,R.onKeyLoaded,m(R)),R}var l=r.prototype;return l.doTick=function(){this.onTickEnd()},l.onTickEnd=function(){},l.startLoad=function(f){},l.stopLoad=function(){this.fragmentLoader.abort();var f=this.fragCurrent;f&&this.fragmentTracker.removeFragment(f),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=_.STOPPED},l._streamEnded=function(f,x){var R=this.fragCurrent,O=this.fragmentTracker;if(!x.live&&R&&R.sn===x.endSN&&!f.nextStart){var B=O.getState(R);return B===I.FragmentState.PARTIAL||B===I.FragmentState.OK}return!1},l.onMediaAttached=function(f,x){var R=this.media=this.mediaBuffer=x.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),R.addEventListener("seeking",this.onvseeking),R.addEventListener("ended",this.onvended);var O=this.config;this.levels&&O.autoStartLoad&&this.state===_.STOPPED&&this.startLoad(O.startPosition)},l.onMediaDetaching=function(){var f=this.media;f!=null&&f.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),f&&(f.removeEventListener("seeking",this.onvseeking),f.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},l.onMediaSeeking=function(){var f=this.config,x=this.fragCurrent,R=this.media,O=this.mediaBuffer,B=this.state,j=R?R.currentTime:0,K=N.BufferHelper.bufferInfo(O||R,j,f.maxBufferHole);if(this.log("media seeking to "+(Object(U.isFiniteNumber)(j)?j.toFixed(3):j)+", state: "+B),B===_.ENDED)this.resetLoadingState();else if(x&&!K.len){var L=f.maxFragLookUpTolerance,H=x.start-L,Y=x.start+x.duration+L,ae=j>Y;(j<H||ae)&&(ae&&x.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),x.loader.abort()),this.resetLoadingState())}R&&(this.lastCurrentTime=j),!this.loadedmetadata&&!K.len&&(this.nextLoadPosition=this.startPosition=j),this.tickImmediate()},l.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},l.onKeyLoaded=function(f,x){if(this.state!==_.KEY_LOADING||x.frag!==this.fragCurrent||!this.levels)return;this.state=_.IDLE;var R=this.levels[x.frag.level].details;R&&this.loadFragment(x.frag,R,x.frag.start)},l.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},l.onHandlerDestroyed=function(){this.state=_.STOPPED,this.hls.off(A.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,c.prototype.onHandlerDestroyed.call(this)},l.loadKey=function(f,x){this.log("Loading key for "+f.sn+" of ["+x.startSN+"-"+x.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+f.level),this.state=_.KEY_LOADING,this.fragCurrent=f,this.hls.trigger(A.Events.KEY_LOADING,{frag:f})},l.loadFragment=function(f,x,R){this._loadFragForPlayback(f,x,R)},l._loadFragForPlayback=function(f,x,R){var O=this,B=function(K){if(O.fragContextChanged(f)){O.warn("Fragment "+f.sn+(K.part?" p: "+K.part.index:"")+" of level "+f.level+" was dropped during download."),O.fragmentTracker.removeFragment(f);return}f.stats.chunkCount++,O._handleFragmentLoadProgress(K)};this._doFragLoad(f,x,R,B).then(function(j){if(!j)return;O.fragLoadError=0;var K=O.state;if(O.fragContextChanged(f)){(K===_.FRAG_LOADING||K===_.BACKTRACKING||!O.fragCurrent&&K===_.PARSING)&&(O.fragmentTracker.removeFragment(f),O.state=_.IDLE);return}if("payload"in j&&(O.log("Loaded fragment "+f.sn+" of level "+f.level),O.hls.trigger(A.Events.FRAG_LOADED,j),O.state===_.BACKTRACKING)){O.fragmentTracker.backtrack(f,j),O.resetFragmentLoading(f);return}O._handleFragmentLoadComplete(j)}).catch(function(j){O.warn(j),O.resetFragmentLoading(f)})},l.flushMainBuffer=function(f,x,R){if(R===void 0&&(R=null),!(f-x))return;var O={startOffset:f,endOffset:x,type:R};this.fragLoadError=0,this.hls.trigger(A.Events.BUFFER_FLUSHING,O)},l._loadInitSegment=function(f){var x=this;this._doFragLoad(f).then(function(R){if(!R||x.fragContextChanged(f)||!x.levels)throw new Error("init load aborted");return R}).then(function(R){var O=x.hls,B=R.payload,j=f.decryptdata;if(B&&B.byteLength>0&&j&&j.key&&j.iv&&j.method==="AES-128"){var K=self.performance.now();return x.decrypter.webCryptoDecrypt(new Uint8Array(B),j.key.buffer,j.iv.buffer).then(function(L){var H=self.performance.now();return O.trigger(A.Events.FRAG_DECRYPTED,{frag:f,payload:L,stats:{tstart:K,tdecrypt:H}}),R.payload=L,R})}return R}).then(function(R){var O=x.fragCurrent,B=x.hls,j=x.levels;if(!j)throw new Error("init load aborted, missing levels");var K=j[f.level].details;console.assert(K,"Level details are defined when init segment is loaded");var L=f.stats;x.state=_.IDLE,x.fragLoadError=0,f.data=new Uint8Array(R.payload),L.parsing.start=L.buffering.start=self.performance.now(),L.parsing.end=L.buffering.end=self.performance.now(),R.frag===O&&B.trigger(A.Events.FRAG_BUFFERED,{stats:L,frag:O,part:null,id:f.type}),x.tick()}).catch(function(R){x.warn(R),x.resetFragmentLoading(f)})},l.fragContextChanged=function(f){var x=this.fragCurrent;return!f||!x||f.level!==x.level||f.sn!==x.sn||f.urlId!==x.urlId},l.fragBufferedComplete=function(f,x){var R=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+f.type+" sn: "+f.sn+(x?" part: "+x.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+f.level+" "+t.default.toString(N.BufferHelper.getBuffered(R))),this.state=_.IDLE,this.tick()},l._handleFragmentLoadComplete=function(f){var x=this.transmuxer;if(!x)return;var R=f.frag,O=f.part,B=f.partsLoaded,j=!B||B.length===0||B.some(function(L){return!L}),K=new y.ChunkMetadata(R.level,R.sn,R.stats.chunkCount+1,0,O?O.index:-1,!j);x.flush(K)},l._handleFragmentLoadProgress=function(f){},l._doFragLoad=function(f,x,R,O){var B=this;if(R===void 0&&(R=null),!this.levels)throw new Error("frag load aborted, missing levels");if(R=Math.max(f.start,R||0),this.config.lowLatencyMode&&x){var j=x.partList;if(j&&O){R>f.end&&x.fragmentHint&&(f=x.fragmentHint);var K=this.getNextPart(j,f,R);if(K>-1){var L=j[K];return this.log("Loading part sn: "+f.sn+" p: "+L.index+" cc: "+f.cc+" of playlist ["+x.startSN+"-"+x.endSN+"] parts [0-"+K+"-"+(j.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+f.level+", target: "+parseFloat(R.toFixed(3))),this.nextLoadPosition=L.start+L.duration,this.state=_.FRAG_LOADING,this.hls.trigger(A.Events.FRAG_LOADING,{frag:f,part:j[K],targetBufferTime:R}),this.doFragPartsLoad(f,j,K,O).catch(function(H){return B.handleFragLoadError(H)})}else if(!f.url||this.loadedEndOfParts(j,R))return Promise.resolve(null)}}return this.log("Loading fragment "+f.sn+" cc: "+f.cc+" "+(x?"of ["+x.startSN+"-"+x.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+f.level+", target: "+parseFloat(R.toFixed(3))),Object(U.isFiniteNumber)(f.sn)&&!this.bitrateTest&&(this.nextLoadPosition=f.start+f.duration),this.state=_.FRAG_LOADING,this.hls.trigger(A.Events.FRAG_LOADING,{frag:f,targetBufferTime:R}),this.fragmentLoader.load(f,O).catch(function(H){return B.handleFragLoadError(H)})},l.doFragPartsLoad=function(f,x,R,O){var B=this;return new Promise(function(j,K){var L=[],H=function Y(ae){var Z=x[ae];B.fragmentLoader.loadPart(f,Z,O).then(function(ce){L[Z.index]=ce;var de=ce.part;B.hls.trigger(A.Events.FRAG_LOADED,ce);var q=x[ae+1];if(q&&q.fragment===f)Y(ae+1);else return j({frag:f,part:de,partsLoaded:L})}).catch(K)};H(R)})},l.handleFragLoadError=function(f){var x=f.data;return x&&x.details===C.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(x.frag,x.part):this.hls.trigger(A.Events.ERROR,x),null},l._handleTransmuxerFlush=function(f){var x=this.getCurrentContext(f);if(!x||this.state!==_.PARSING){this.fragCurrent||(this.state=_.IDLE);return}var R=x.frag,O=x.part,B=x.level,j=self.performance.now();R.stats.parsing.end=j,O&&(O.stats.parsing.end=j),this.updateLevelTiming(R,O,B,f.partial)},l.getCurrentContext=function(f){var x=this.levels,R=f.level,O=f.sn,B=f.part;if(!x||!x[R])return this.warn("Levels object was unset while buffering fragment "+O+" of level "+R+". The current chunk will not be buffered."),null;var j=x[R],K=B>-1?Object(e.getPartWith)(j,O,B):null,L=K?K.fragment:Object(e.getFragmentWithSN)(j,O,this.fragCurrent);return L?{frag:L,part:K,level:j}:null},l.bufferFragmentData=function(f,x,R,O){if(!f||this.state!==_.PARSING)return;var B=f.data1,j=f.data2,K=B;if(B&&j&&(K=Object(h.appendUint8Array)(B,j)),!K||!K.length)return;var L={type:f.type,frag:x,part:R,chunkMeta:O,parent:x.type,data:K};this.hls.trigger(A.Events.BUFFER_APPENDING,L),f.dropped&&f.independent&&!R&&this.flushBufferGap(x)},l.flushBufferGap=function(f){var x=this.media;if(!x)return;if(!N.BufferHelper.isBuffered(x,x.currentTime)){this.flushMainBuffer(0,f.start);return}var R=x.currentTime,O=N.BufferHelper.bufferInfo(x,R,0),B=f.duration,j=Math.min(this.config.maxFragLookUpTolerance*2,B*.25),K=Math.max(Math.min(f.start-j,O.end-j),R+j);f.start-K>j&&this.flushMainBuffer(K,f.start)},l.getFwdBufferInfo=function(f,x){var R=this.config,O=this.getLoadPosition();if(!Object(U.isFiniteNumber)(O))return null;var B=N.BufferHelper.bufferInfo(f,O,R.maxBufferHole);if(B.len===0&&B.nextStart!==void 0){var j=this.fragmentTracker.getBufferedFrag(O,x);if(j&&B.nextStart<j.end)return N.BufferHelper.bufferInfo(f,O,Math.max(B.nextStart,R.maxBufferHole))}return B},l.getMaxBufferLength=function(f){var x=this.config,R;return f?R=Math.max(8*x.maxBufferSize/f,x.maxBufferLength):R=x.maxBufferLength,Math.min(R,x.maxMaxBufferLength)},l.reduceMaxBufferLength=function(f){var x=this.config,R=f||x.maxBufferLength;return x.maxMaxBufferLength>=R?(x.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+x.maxMaxBufferLength+"s"),!0):!1},l.getNextFragment=function(f,x){var R,O,B=x.fragments,j=B.length;if(!j)return null;var K=this.config,L=B[0].start,H;if(x.live){var Y=K.initialLiveManifestSize;if(j<Y)return this.warn("Not enough fragments to start playback (have: "+j+", need: "+Y+")"),null;!x.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(H=this.getInitialLiveFragment(x,B),this.startPosition=H?this.hls.liveSyncPosition||H.start:f)}else f<=L&&(H=B[0]);if(!H){var ae=K.lowLatencyMode?x.partEnd:x.fragmentEnd;H=this.getFragmentAtPosition(f,ae,x)}return(R=H)!==null&&R!==void 0&&R.initSegment&&!((O=H)!==null&&O!==void 0&&O.initSegment.data)&&!this.bitrateTest&&(H=H.initSegment),H},l.getNextPart=function(f,x,R){for(var O=-1,B=!1,j=!0,K=0,L=f.length;K<L;K++){var H=f[K];if(j=j&&!H.independent,O>-1&&R<H.start)break;var Y=H.loaded;!Y&&(B||H.independent||j)&&H.fragment===x&&(O=K),B=Y}return O},l.loadedEndOfParts=function(f,x){var R=f[f.length-1];return R&&x>R.start&&R.loaded},l.getInitialLiveFragment=function(f,x){var R=this.fragPrevious,O=null;if(R){if(f.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+R.programDateTime),O=Object(o.findFragmentByPDT)(x,R.endProgramDateTime,this.config.maxFragLookUpTolerance)),!O){var B=R.sn+1;if(B>=f.startSN&&B<=f.endSN){var j=x[B-f.startSN];R.cc===j.cc&&(O=j,this.log("Live playlist, switching playlist, load frag with next SN: "+O.sn))}O||(O=Object(o.findFragWithCC)(x,R.cc),O&&this.log("Live playlist, switching playlist, load frag with same CC: "+O.sn))}}else{var K=this.hls.liveSyncPosition;K!==null&&(O=this.getFragmentAtPosition(K,this.bitrateTest?f.fragmentEnd:f.edge,f))}return O},l.getFragmentAtPosition=function(f,x,R){var O=this.config,B=this.fragPrevious,j=R.fragments,K=R.endSN,L=R.fragmentHint,H=O.maxFragLookUpTolerance,Y=!!(O.lowLatencyMode&&R.partList&&L);Y&&L&&!this.bitrateTest&&(j=j.concat(L),K=L.sn);var ae;if(f<x){var Z=f>x-H?0:H;ae=Object(o.findFragmentByPTS)(B,j,f,Z)}else ae=j[j.length-1];if(ae){var ce=ae.sn-R.startSN,de=B&&ae.level===B.level,q=j[ce+1],te=this.fragmentTracker.getState(ae);if(te===I.FragmentState.BACKTRACKED){ae=null;for(var he=ce;j[he]&&this.fragmentTracker.getState(j[he])===I.FragmentState.BACKTRACKED;)B?ae=j[he--]:ae=j[--he];ae||(ae=q)}else B&&ae.sn===B.sn&&!Y&&(de&&(ae.sn<K&&this.fragmentTracker.getState(q)!==I.FragmentState.OK?(this.log("SN "+ae.sn+" just loaded, load next one: "+q.sn),ae=q):ae=null))}return ae},l.synchronizeToLiveEdge=function(f){var x=this.config,R=this.media;if(!R)return;var O=this.hls.liveSyncPosition,B=R.currentTime,j=f.fragments[0].start,K=f.edge,L=B>=j-x.maxFragLookUpTolerance&&B<=K;if(O!==null&&R.duration>O&&(B<O||!L)){var H=x.liveMaxLatencyDuration!==void 0?x.liveMaxLatencyDuration:x.liveMaxLatencyDurationCount*f.targetduration;(!L&&R.readyState<4||B<K-H)&&(this.loadedmetadata||(this.nextLoadPosition=O),R.readyState&&(this.warn("Playback: "+B.toFixed(3)+" is located too far from the end of live sliding playlist: "+K+", reset currentTime to : "+O.toFixed(3)),R.currentTime=O))}},l.alignPlaylists=function(f,x){var R=this.levels,O=this.levelLastLoaded,B=this.fragPrevious,j=O!==null?R[O]:null,K=f.fragments.length;if(!K)return this.warn("No fragments in live playlist"),0;var L=f.fragments[0].start,H=!x,Y=f.alignedSliding&&Object(U.isFiniteNumber)(L);if(H||!Y&&!L){Object(u.alignStream)(B,j,f);var ae=f.fragments[0].start;return this.log("Live playlist sliding: "+ae.toFixed(2)+" start-sn: "+(x?x.startSN:"na")+"->"+f.startSN+" prev-sn: "+(B?B.sn:"na")+" fragments: "+K),ae}return L},l.waitForCdnTuneIn=function(f){var x=3;return f.live&&f.canBlockReload&&f.tuneInGoal>Math.max(f.partHoldBack,f.partTarget*x)},l.setStartPosition=function(f,x){var R=this.startPosition;if(R<x&&(R=-1),R===-1||this.lastCurrentTime===-1){var O=f.startTimeOffset;Object(U.isFiniteNumber)(O)?(R=x+O,O<0&&(R+=f.totalduration),R=Math.min(Math.max(x,R),x+f.totalduration),this.log("Start time offset "+O+" found in playlist, adjust startPosition to "+R),this.startPosition=R):f.live?R=this.hls.liveSyncPosition||x:this.startPosition=R=0,this.lastCurrentTime=R}this.nextLoadPosition=R},l.getLoadPosition=function(){var f=this.media,x=0;return this.loadedmetadata&&f?x=f.currentTime:this.nextLoadPosition&&(x=this.nextLoadPosition),x},l.handleFragLoadAborted=function(f,x){this.transmuxer&&f.sn!=="initSegment"&&f.stats.aborted&&(this.warn("Fragment "+f.sn+(x?" part"+x.index:"")+" of level "+f.level+" was aborted"),this.resetFragmentLoading(f))},l.resetFragmentLoading=function(f){(!this.fragCurrent||!this.fragContextChanged(f))&&(this.state=_.IDLE)},l.onFragmentOrKeyLoadError=function(f,x){if(x.fatal)return;var R=x.frag;if(!R||R.type!==f)return;var O=this.fragCurrent;console.assert(O&&R.sn===O.sn&&R.level===O.level&&R.urlId===O.urlId,"Frag load error must match current frag to retry");var B=this.config;if(this.fragLoadError+1<=B.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(R.level))return;var j=Math.min(Math.pow(2,this.fragLoadError)*B.fragLoadingRetryDelay,B.fragLoadingMaxRetryTimeout);this.warn("Fragment "+R.sn+" of "+f+" "+R.level+" failed to load, retrying in "+j+"ms"),this.retryDate=self.performance.now()+j,this.fragLoadError++,this.state=_.FRAG_LOADING_WAITING_RETRY}else x.levelRetry?(f===i.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=_.IDLE):(k.logger.error(x.details+" reaches max retry, redispatch as fatal ..."),x.fatal=!0,this.hls.stopLoad(),this.state=_.ERROR)},l.afterBufferFlushed=function(f,x,R){if(!f)return;var O=N.BufferHelper.getBuffered(f);this.fragmentTracker.detectEvictedFragments(x,O,R),this.state===_.ENDED&&this.resetLoadingState()},l.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=_.IDLE},l.resetLiveStartWhenNotLoaded=function(f){if(!this.loadedmetadata){this.startFragRequested=!1;var x=this.levels?this.levels[f].details:null;if(x!=null&&x.live)return this.startPosition=-1,this.setStartPosition(x,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},l.updateLevelTiming=function(f,x,R,O){var B=this,j=R.details;console.assert(!!j,"level.details must be defined");var K=Object.keys(f.elementaryStreams).reduce(function(L,H){var Y=f.elementaryStreams[H];if(Y){var ae=Y.endPTS-Y.startPTS;if(ae<=0)return B.warn("Could not parse fragment "+f.sn+" "+H+" duration reliably ("+ae+") resetting transmuxer to fallback to playlist timing"),B.resetTransmuxer(),L||!1;var Z=O?0:Object(e.updateFragPTSDTS)(j,f,Y.startPTS,Y.endPTS,Y.startDTS,Y.endDTS);return B.hls.trigger(A.Events.LEVEL_PTS_UPDATED,{details:j,level:R,drift:Z,type:H,frag:f,start:Y.startPTS,end:Y.endPTS}),!0}return L},!1);K?(this.state=_.PARSED,this.hls.trigger(A.Events.FRAG_PARSED,{frag:f,part:x})):this.resetLoadingState()},l.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},T(r,[{key:"state",get:function(){return this._state},set:function(f){var x=this._state;x!==f&&(this._state=f,this.log(x+"->"+f))}}]),r}(S.default)},"./src/controller/buffer-controller.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"default",function(){return o});var U=w("./src/polyfills/number.ts"),S=w("./src/events.ts"),I=w("./src/utils/logger.ts"),N=w("./src/errors.ts"),k=w("./src/utils/buffer-helper.ts"),A=w("./src/utils/mediasource-helper.ts"),C=w("./src/loader/fragment.ts"),y=w("./src/controller/buffer-operation-queue.ts"),h=Object(A.getMediaSource)(),u=/([ha]vc.)(?:\.[^.,]+)+/,o=function(){function e(s){var t=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 i=t.hls,n=t.media,T=t.mediaSource;I.logger.log("[buffer-controller]: Media source opened"),n&&(t.updateMediaElementDuration(),i.trigger(S.Events.MEDIA_ATTACHED,{media:n})),T&&T.removeEventListener("sourceopen",t._onMediaSourceOpen),t.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=s,this._initSourceBuffer(),this.registerListeners()}var d=e.prototype;return d.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},d.destroy=function(){this.unregisterListeners(),this.details=null},d.registerListeners=function(){var t=this.hls;t.on(S.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(S.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(S.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(S.Events.BUFFER_RESET,this.onBufferReset,this),t.on(S.Events.BUFFER_APPENDING,this.onBufferAppending,this),t.on(S.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.on(S.Events.BUFFER_EOS,this.onBufferEos,this),t.on(S.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(S.Events.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(S.Events.FRAG_PARSED,this.onFragParsed,this),t.on(S.Events.FRAG_CHANGED,this.onFragChanged,this)},d.unregisterListeners=function(){var t=this.hls;t.off(S.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(S.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(S.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(S.Events.BUFFER_RESET,this.onBufferReset,this),t.off(S.Events.BUFFER_APPENDING,this.onBufferAppending,this),t.off(S.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.off(S.Events.BUFFER_EOS,this.onBufferEos,this),t.off(S.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(S.Events.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(S.Events.FRAG_PARSED,this.onFragParsed,this),t.off(S.Events.FRAG_CHANGED,this.onFragChanged,this)},d._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new y.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},d.onManifestParsed=function(t,i){var n=2;(i.audio&&!i.video||!i.altAudio)&&(n=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=n,this.details=null,I.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},d.onMediaAttaching=function(t,i){var n=this.media=i.media;if(n&&h){var T=this.mediaSource=new h;T.addEventListener("sourceopen",this._onMediaSourceOpen),T.addEventListener("sourceended",this._onMediaSourceEnded),T.addEventListener("sourceclose",this._onMediaSourceClose),n.src=self.URL.createObjectURL(T),this._objectUrl=n.src}},d.onMediaDetaching=function(){var t=this.media,i=this.mediaSource,n=this._objectUrl;if(i){if(I.logger.log("[buffer-controller]: media source detaching"),i.readyState==="open")try{i.endOfStream()}catch(T){I.logger.warn("[buffer-controller]: onMediaDetaching: "+T.message+" while calling endOfStream")}this.onBufferReset(),i.removeEventListener("sourceopen",this._onMediaSourceOpen),i.removeEventListener("sourceended",this._onMediaSourceEnded),i.removeEventListener("sourceclose",this._onMediaSourceClose),t&&(n&&self.URL.revokeObjectURL(n),t.src===n?(t.removeAttribute("src"),t.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(S.Events.MEDIA_DETACHED,void 0)},d.onBufferReset=function(){var t=this;this.getSourceBufferTypes().forEach(function(i){var n=t.sourceBuffer[i];try{n&&(t.removeBufferListeners(i),t.mediaSource&&t.mediaSource.removeSourceBuffer(n),t.sourceBuffer[i]=void 0)}catch(T){I.logger.warn("[buffer-controller]: Failed to reset the "+i+" buffer",T)}}),this._initSourceBuffer()},d.onBufferCodecs=function(t,i){var n=this,T=this.getSourceBufferTypes().length;if(Object.keys(i).forEach(function(m){if(T){var p=n.tracks[m];if(p&&typeof p.buffer.changeType=="function"){var b=i[m],_=b.codec,a=b.levelCodec,c=b.container,r=(p.levelCodec||p.codec).replace(u,"$1"),l=(a||_).replace(u,"$1");if(r!==l){var v=c+";codecs="+(a||_);n.appendChangeType(m,v)}}}else n.pendingTracks[m]=i[m]}),T)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},d.appendChangeType=function(t,i){var n=this,T=this.operationQueue,m={execute:function(){var b=n.sourceBuffer[t];b&&(I.logger.log("[buffer-controller]: changing "+t+" sourceBuffer type to "+i),b.changeType(i)),T.shiftAndExecuteNext(t)},onStart:function(){},onComplete:function(){},onError:function(b){I.logger.warn("[buffer-controller]: Failed to change "+t+" SourceBuffer type",b)}};T.append(m,t)},d.onBufferAppending=function(t,i){var n=this,T=this.hls,m=this.operationQueue,p=this.tracks,b=i.data,_=i.type,a=i.frag,c=i.part,r=i.chunkMeta,l=r.buffering[_],v=self.performance.now();l.start=v;var f=a.stats.buffering,x=c?c.stats.buffering:null;f.start===0&&(f.start=v),x&&x.start===0&&(x.start=v);var R=p.audio,O=_==="audio"&&r.id===1&&(R==null?void 0:R.container)==="audio/mpeg",B={execute:function(){if(l.executeStart=self.performance.now(),O){var K=n.sourceBuffer[_];if(K){var L=a.start-K.timestampOffset;Math.abs(L)>=.1&&(I.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+a.start+" (delta: "+L+") sn: "+a.sn+")"),K.timestampOffset=a.start)}}n.appendExecutor(b,_)},onStart:function(){},onComplete:function(){var K=self.performance.now();l.executeEnd=l.end=K,f.first===0&&(f.first=K),x&&x.first===0&&(x.first=K);var L=n.sourceBuffer,H={};for(var Y in L)H[Y]=k.BufferHelper.getBuffered(L[Y]);n.appendError=0,n.hls.trigger(S.Events.BUFFER_APPENDED,{type:_,frag:a,part:c,chunkMeta:r,parent:a.type,timeRanges:H})},onError:function(K){I.logger.error("[buffer-controller]: Error encountered while trying to append to the "+_+" SourceBuffer",K);var L={type:N.ErrorTypes.MEDIA_ERROR,parent:a.type,details:N.ErrorDetails.BUFFER_APPEND_ERROR,err:K,fatal:!1};K.code===DOMException.QUOTA_EXCEEDED_ERR?L.details=N.ErrorDetails.BUFFER_FULL_ERROR:(n.appendError++,L.details=N.ErrorDetails.BUFFER_APPEND_ERROR,n.appendError>T.config.appendErrorMaxRetry&&(I.logger.error("[buffer-controller]: Failed "+T.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),L.fatal=!0)),T.trigger(S.Events.ERROR,L)}};m.append(B,_)},d.onBufferFlushing=function(t,i){var n=this,T=this.operationQueue,m=function(b){return{execute:n.removeExecutor.bind(n,b,i.startOffset,i.endOffset),onStart:function(){},onComplete:function(){n.hls.trigger(S.Events.BUFFER_FLUSHED,{type:b})},onError:function(a){I.logger.warn("[buffer-controller]: Failed to remove from "+b+" SourceBuffer",a)}}};i.type?T.append(m(i.type),i.type):this.getSourceBufferTypes().forEach(function(p){T.append(m(p),p)})},d.onFragParsed=function(t,i){var n=this,T=i.frag,m=i.part,p=[],b=m?m.elementaryStreams:T.elementaryStreams;b[C.ElementaryStreamTypes.AUDIOVIDEO]?p.push("audiovideo"):(b[C.ElementaryStreamTypes.AUDIO]&&p.push("audio"),b[C.ElementaryStreamTypes.VIDEO]&&p.push("video"));var _=function(){var c=self.performance.now();T.stats.buffering.end=c,m&&(m.stats.buffering.end=c);var r=m?m.stats:T.stats;n.hls.trigger(S.Events.FRAG_BUFFERED,{frag:T,part:m,stats:r,id:T.type})};p.length===0&&I.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+T.type+" level: "+T.level+" sn: "+T.sn),this.blockBuffers(_,p)},d.onFragChanged=function(t,i){this.flushBackBuffer()},d.onBufferEos=function(t,i){var n=this,T=this.getSourceBufferTypes().reduce(function(m,p){var b=n.sourceBuffer[p];return(!i.type||i.type===p)&&(b&&!b.ended&&(b.ended=!0,I.logger.log("[buffer-controller]: "+p+" sourceBuffer now EOS"))),m&&!!(!b||b.ended)},!0);T&&this.blockBuffers(function(){var m=n.mediaSource;if(!m||m.readyState!=="open")return;m.endOfStream()})},d.onLevelUpdated=function(t,i){var n=i.details;if(!n.fragments.length)return;this.details=n,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},d.flushBackBuffer=function(){var t=this.hls,i=this.details,n=this.media,T=this.sourceBuffer;if(!n||i===null)return;var m=this.getSourceBufferTypes();if(!m.length)return;var p=i.live&&t.config.liveBackBufferLength!==null?t.config.liveBackBufferLength:t.config.backBufferLength;if(!Object(U.isFiniteNumber)(p)||p<0)return;var b=n.currentTime,_=i.levelTargetDuration,a=Math.max(p,_),c=Math.floor(b/_)*_-a;m.forEach(function(r){var l=T[r];if(l){var v=k.BufferHelper.getBuffered(l);v.length>0&&c>v.start(0)&&(t.trigger(S.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),i.live&&t.trigger(S.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),t.trigger(S.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:r}))}})},d.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var t=this.details,i=this.hls,n=this.media,T=this.mediaSource,m=t.fragments[0].start+t.totalduration,p=n.duration,b=Object(U.isFiniteNumber)(T.duration)?T.duration:0;t.live&&i.config.liveDurationInfinity?(I.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),T.duration=Infinity,this.updateSeekableRange(t)):(m>b&&m>p||!Object(U.isFiniteNumber)(p))&&(I.logger.log("[buffer-controller]: Updating Media Source duration to "+m.toFixed(3)),T.duration=m)},d.updateSeekableRange=function(t){var i=this.mediaSource,n=t.fragments,T=n.length;if(T&&t.live&&i!==null&&i!==void 0&&i.setLiveSeekableRange){var m=Math.max(0,n[0].start),p=Math.max(m,m+t.totalduration);i.setLiveSeekableRange(m,p)}},d.checkPendingTracks=function(){var t=this.bufferCodecEventsExpected,i=this.operationQueue,n=this.pendingTracks,T=Object.keys(n).length;if(T&&!t||T===2){this.createSourceBuffers(n),this.pendingTracks={};var m=this.getSourceBufferTypes();if(m.length===0){this.hls.trigger(S.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}m.forEach(function(p){i.executeNext(p)})}},d.createSourceBuffers=function(t){var i=this.sourceBuffer,n=this.mediaSource;if(!n)throw Error("createSourceBuffers called when mediaSource was null");var T=0;for(var m in t)if(!i[m]){var p=t[m];if(!p)throw Error("source buffer exists for track "+m+", however track does not");var b=p.levelCodec||p.codec,_=p.container+";codecs="+b;I.logger.log("[buffer-controller]: creating sourceBuffer("+_+")");try{var a=i[m]=n.addSourceBuffer(_),c=m;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[m]={buffer:a,codec:b,container:p.container,levelCodec:p.levelCodec,id:p.id},T++}catch(r){I.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+r.message),this.hls.trigger(S.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:r,mimeType:_})}}T&&this.hls.trigger(S.Events.BUFFER_CREATED,{tracks:this.tracks})},d._onSBUpdateStart=function(t){var i=this.operationQueue,n=i.current(t);n.onStart()},d._onSBUpdateEnd=function(t){var i=this.operationQueue,n=i.current(t);n.onComplete(),i.shiftAndExecuteNext(t)},d._onSBUpdateError=function(t,i){I.logger.error("[buffer-controller]: "+t+" SourceBuffer error",i),this.hls.trigger(S.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var n=this.operationQueue.current(t);n&&n.onError(i)},d.removeExecutor=function(t,i,n){var T=this.media,m=this.mediaSource,p=this.operationQueue,b=this.sourceBuffer,_=b[t];if(!T||!m||!_){I.logger.warn("[buffer-controller]: Attempting to remove from the "+t+" SourceBuffer, but it does not exist"),p.shiftAndExecuteNext(t);return}var a=Object(U.isFiniteNumber)(T.duration)?T.duration:Infinity,c=Object(U.isFiniteNumber)(m.duration)?m.duration:Infinity,r=Math.max(0,i),l=Math.min(n,a,c);l>r?(I.logger.log("[buffer-controller]: Removing ["+r+","+l+"] from the "+t+" SourceBuffer"),console.assert(!_.updating,t+" sourceBuffer must not be updating"),_.remove(r,l)):p.shiftAndExecuteNext(t)},d.appendExecutor=function(t,i){var n=this.operationQueue,T=this.sourceBuffer,m=T[i];if(!m){I.logger.warn("[buffer-controller]: Attempting to append to the "+i+" SourceBuffer, but it does not exist"),n.shiftAndExecuteNext(i);return}m.ended=!1,console.assert(!m.updating,i+" sourceBuffer must not be updating"),m.appendBuffer(t)},d.blockBuffers=function(t,i){var n=this;if(i===void 0&&(i=this.getSourceBufferTypes()),!i.length){I.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(t);return}var T=this.operationQueue,m=i.map(function(p){return T.appendBlocker(p)});Promise.all(m).then(function(){t(),i.forEach(function(p){var b=n.sourceBuffer[p];(!b||!b.updating)&&T.shiftAndExecuteNext(p)})})},d.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},d.addBufferListener=function(t,i,n){var T=this.sourceBuffer[t];if(!T)return;var m=n.bind(this,t);this.listeners[t].push({event:i,listener:m}),T.addEventListener(i,m)},d.removeBufferListeners=function(t){var i=this.sourceBuffer[t];if(!i)return;this.listeners[t].forEach(function(n){i.removeEventListener(n.event,n.listener)})},e}()},"./src/controller/buffer-operation-queue.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"default",function(){return S});var U=w("./src/utils/logger.ts"),S=function(){function I(k){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=k}var N=I.prototype;return N.append=function(A,C){var y=this.queues[C];y.push(A),y.length===1&&this.buffers[C]&&this.executeNext(C)},N.insertAbort=function(A,C){var y=this.queues[C];y.unshift(A),this.executeNext(C)},N.appendBlocker=function(A){var C,y=new Promise(function(u){C=u}),h={execute:C,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(h,A),y},N.executeNext=function(A){var C=this.buffers,y=this.queues,h=C[A],u=y[A];if(u.length){var o=u[0];try{o.execute()}catch(e){U.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),o.onError(e),(!h||!h.updating)&&(u.shift(),this.executeNext(A))}}},N.shiftAndExecuteNext=function(A){this.queues[A].shift(),this.executeNext(A)},N.current=function(A){return this.queues[A][0]},I}()},"./src/controller/cap-level-controller.ts":function(_e,F,w){"use strict";w.r(F);var U=w("./src/events.ts");function S(k,A){for(var C=0;C<A.length;C++){var y=A[C];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(k,y.key,y)}}function I(k,A,C){return A&&S(k.prototype,A),C&&S(k,C),k}var N=function(){function k(C){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=C,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var A=k.prototype;return A.setStreamController=function(y){this.streamController=y},A.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},A.registerListeners=function(){var y=this.hls;y.on(U.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.on(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},A.unregisterListener=function(){var y=this.hls;y.off(U.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.off(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},A.onFpsDropLevelCapping=function(y,h){k.isLevelAllowed(h.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(h.droppedLevel)},A.onMediaAttaching=function(y,h){this.media=h.media instanceof HTMLVideoElement?h.media:null},A.onManifestParsed=function(y,h){var u=this.hls;this.restrictedLevels=[],this.firstLevel=h.firstLevel,u.config.capLevelToPlayerSize&&h.video&&this.startCapping()},A.onBufferCodecs=function(y,h){var u=this.hls;u.config.capLevelToPlayerSize&&h.video&&this.startCapping()},A.onMediaDetaching=function(){this.stopCapping()},A.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var y=this.hls.levels;if(y.length){var h=this.hls;h.autoLevelCapping=this.getMaxLevel(y.length-1),h.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=h.autoLevelCapping}}},A.getMaxLevel=function(y){var h=this,u=this.hls.levels;if(!u.length)return-1;var o=u.filter(function(e,d){return k.isLevelAllowed(d,h.restrictedLevels)&&d<=y});return this.clientRect=null,k.getMaxLevelByMediaSize(o,this.mediaWidth,this.mediaHeight)},A.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()},A.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},A.getDimensions=function(){if(this.clientRect)return this.clientRect;var y=this.media,h={width:0,height:0};if(y){var u=y.getBoundingClientRect();h.width=u.width,h.height=u.height,!h.width&&!h.height&&(h.width=u.right-u.left||y.width||0,h.height=u.bottom-u.top||y.height||0)}return this.clientRect=h,h},k.isLevelAllowed=function(y,h){return h===void 0&&(h=[]),h.indexOf(y)===-1},k.getMaxLevelByMediaSize=function(y,h,u){if(!y||!y.length)return-1;for(var o=function(i,n){return n?i.width!==n.width||i.height!==n.height:!0},e=y.length-1,d=0;d<y.length;d+=1){var s=y[d];if((s.width>=h||s.height>=u)&&o(s,y[d+1])){e=d;break}}return e},I(k,[{key:"mediaWidth",get:function(){return this.getDimensions().width*k.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*k.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var y=1;try{y=self.devicePixelRatio}catch(h){}return y}}]),k}();F.default=N},"./src/controller/cmcd-controller.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"default",function(){return o});var U=w("./src/events.ts"),S=w("./src/types/cmcd.ts"),I=w("./src/utils/buffer-helper.ts"),N=w("./src/utils/logger.ts");function k(e,d){for(var s=0;s<d.length;s++){var t=d[s];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}function A(e,d,s){return d&&k(e.prototype,d),s&&k(e,s),e}function C(e,d){var s=typeof Symbol!="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(s)return(s=s.call(e)).next.bind(s);if(Array.isArray(e)||(s=y(e))||d&&e&&typeof e.length=="number"){s&&(e=s);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}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(e,d){if(!e)return;if(typeof e=="string")return h(e,d);var s=Object.prototype.toString.call(e).slice(8,-1);if(s==="Object"&&e.constructor&&(s=e.constructor.name),s==="Map"||s==="Set")return Array.from(e);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return h(e,d)}function h(e,d){(d==null||d>e.length)&&(d=e.length);for(var s=0,t=new Array(d);s<d;s++)t[s]=e[s];return t}function u(){return u=Object.assign||function(e){for(var d=1;d<arguments.length;d++){var s=arguments[d];for(var t in s)Object.prototype.hasOwnProperty.call(s,t)&&(e[t]=s[t])}return e},u.apply(this,arguments)}var o=function(){function e(s){var t=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(){t.initialized&&(t.starved=!0),t.buffering=!0},this.onPlaying=function(){t.initialized||(t.initialized=!0),t.buffering=!1},this.applyPlaylistData=function(T){try{t.apply(T,{ot:S.CMCDObjectType.MANIFEST,su:!t.initialized})}catch(m){N.logger.warn("Could not generate manifest CMCD data.",m)}},this.applyFragmentData=function(T){try{var m=T.frag,p=t.hls.levels[m.level],b=t.getObjectType(m),_={d:m.duration*1e3,ot:b};(b===S.CMCDObjectType.VIDEO||b===S.CMCDObjectType.AUDIO||b==S.CMCDObjectType.MUXED)&&(_.br=p.bitrate/1e3,_.tb=t.getTopBandwidth(b),_.bl=t.getBufferLength(b)),t.apply(T,_)}catch(a){N.logger.warn("Could not generate segment CMCD data.",a)}},this.hls=s;var i=this.config=s.config,n=i.cmcd;n!=null&&(i.pLoader=this.createPlaylistLoader(),i.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||e.uuid(),this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.registerListeners())}var d=e.prototype;return d.registerListeners=function(){var t=this.hls;t.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(U.Events.MEDIA_DETACHED,this.onMediaDetached,this),t.on(U.Events.BUFFER_CREATED,this.onBufferCreated,this)},d.unregisterListeners=function(){var t=this.hls;t.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(U.Events.MEDIA_DETACHED,this.onMediaDetached,this),t.off(U.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},d.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},d.onMediaAttached=function(t,i){this.media=i.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},d.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},d.onBufferCreated=function(t,i){var n,T;this.audioBuffer=(n=i.tracks.audio)===null||n===void 0?void 0:n.buffer,this.videoBuffer=(T=i.tracks.video)===null||T===void 0?void 0:T.buffer},d.createData=function(){var t;return{v:S.CMCDVersion,sf:S.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(t=this.media)===null||t===void 0?void 0:t.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},d.apply=function(t,i){i===void 0&&(i={}),u(i,this.createData());var n=i.ot===S.CMCDObjectType.INIT||i.ot===S.CMCDObjectType.VIDEO||i.ot===S.CMCDObjectType.MUXED;if(this.starved&&n&&(i.bs=!0,i.su=!0,this.starved=!1),i.su==null&&(i.su=this.buffering),this.useHeaders){var T=e.toHeaders(i);if(!Object.keys(T).length)return;t.headers||(t.headers={}),u(t.headers,T)}else{var m=e.toQuery(i);if(!m)return;t.url=e.appendQueryToUri(t.url,m)}},d.getObjectType=function(t){var i=t.type;return i==="subtitle"?S.CMCDObjectType.TIMED_TEXT:t.sn==="initSegment"?S.CMCDObjectType.INIT:i==="audio"?S.CMCDObjectType.AUDIO:i==="main"?this.hls.audioTracks.length?S.CMCDObjectType.VIDEO:S.CMCDObjectType.MUXED:void 0},d.getTopBandwidth=function(t){for(var i=0,n=t===S.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,T=C(n),m;!(m=T()).done;){var p=m.value;p.bitrate>i&&(i=p.bitrate)}return i>0?i:NaN},d.getBufferLength=function(t){var i=this.hls.media,n=t===S.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!n||!i)return NaN;var T=I.BufferHelper.bufferInfo(n,i.currentTime,this.config.maxBufferHole);return T.len*1e3},d.createPlaylistLoader=function(){var t=this.config.pLoader,i=this.applyPlaylistData,n=t||this.config.loader;return function(){function T(p){this.loader=void 0,this.loader=new n(p)}var m=T.prototype;return m.destroy=function(){this.loader.destroy()},m.abort=function(){this.loader.abort()},m.load=function(b,_,a){i(b),this.loader.load(b,_,a)},A(T,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),T}()},d.createFragmentLoader=function(){var t=this.config.fLoader,i=this.applyFragmentData,n=t||this.config.loader;return function(){function T(p){this.loader=void 0,this.loader=new n(p)}var m=T.prototype;return m.destroy=function(){this.loader.destroy()},m.abort=function(){this.loader.abort()},m.load=function(b,_,a){i(b),this.loader.load(b,_,a)},A(T,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),T}()},e.uuid=function(){var t=URL.createObjectURL(new Blob),i=t.toString();return URL.revokeObjectURL(t),i.substr(i.lastIndexOf("/")+1)},e.serialize=function(t){for(var i=[],n=function(O){return!Number.isNaN(O)&&O!=null&&O!==""&&O!==!1},T=function(O){return Math.round(O)},m=function(O){return T(O/100)*100},p=function(O){return encodeURIComponent(O)},b={br:T,d:T,bl:m,dl:m,mtp:m,nor:p,rtp:m,tb:T},_=Object.keys(t||{}).sort(),a=C(_),c;!(c=a()).done;){var r=c.value,l=t[r];if(!n(l))continue;if(r==="v"&&l===1)continue;if(r=="pr"&&l===1)continue;var v=b[r];v&&(l=v(l));var f=typeof l,x=void 0;r==="ot"||r==="sf"||r==="st"?x=r+"="+l:f==="boolean"?x=r:f==="number"?x=r+"="+l:x=r+"="+JSON.stringify(l),i.push(x)}return i.join(",")},e.toHeaders=function(t){for(var i=Object.keys(t),n={},T=["Object","Request","Session","Status"],m=[{},{},{},{}],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},b=0,_=i;b<_.length;b++){var a=_[b],c=p[a]!=null?p[a]:1;m[c][a]=t[a]}for(var r=0;r<m.length;r++){var l=e.serialize(m[r]);l&&(n["CMCD-"+T[r]]=l)}return n},e.toQuery=function(t){return"CMCD="+encodeURIComponent(e.serialize(t))},e.appendQueryToUri=function(t,i){if(!i)return t;var n=t.includes("?")?"&":"?";return""+t+n+i},e}()},"./src/controller/eme-controller.ts":function(_e,F,w){"use strict";w.r(F);var U=w("./src/events.ts"),S=w("./src/errors.ts"),I=w("./src/utils/logger.ts"),N=w("./src/utils/mediakeys-helper.ts");function k(o,e){for(var d=0;d<e.length;d++){var s=e[d];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(o,s.key,s)}}function A(o,e,d){return e&&k(o.prototype,e),d&&k(o,d),o}var C=3,y=function(e,d,s){var t={audioCapabilities:[],videoCapabilities:[]};return e.forEach(function(i){t.audioCapabilities.push({contentType:'audio/mp4; codecs="'+i+'"',robustness:s.audioRobustness||""})}),d.forEach(function(i){t.videoCapabilities.push({contentType:'video/mp4; codecs="'+i+'"',robustness:s.videoRobustness||""})}),[t]},h=function(e,d,s,t){switch(e){case N.KeySystems.WIDEVINE:return y(d,s,t);default:throw new Error("Unknown key-system: "+e)}},u=function(){function o(d){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=d,this._config=d.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 e=o.prototype;return e.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},e._registerListeners=function(){this.hls.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(U.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this)},e._unregisterListeners=function(){this.hls.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(U.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this)},e.getLicenseServerUrl=function(s){switch(s){case N.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+s+'"')},e._attemptKeySystemAccess=function(s,t,i){var n=this,T=h(s,t,i,this._drmSystemOptions);I.logger.log("Requesting encrypted media key-system access");var m=this.requestMediaKeySystemAccess(s,T);this.mediaKeysPromise=m.then(function(p){return n._onMediaKeySystemAccessObtained(s,p)}),m.catch(function(p){I.logger.error('Failed to obtain key-system "'+s+'" access:',p)})},e._onMediaKeySystemAccessObtained=function(s,t){var i=this;I.logger.log('Access for key-system "'+s+'" obtained');var n={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:t,mediaKeySystemDomain:s};this._mediaKeysList.push(n);var T=Promise.resolve().then(function(){return t.createMediaKeys()}).then(function(m){return n.mediaKeys=m,I.logger.log('Media-keys created for key-system "'+s+'"'),i._onMediaKeysCreated(),m});return T.catch(function(m){I.logger.error("Failed to create media-keys:",m)}),T},e._onMediaKeysCreated=function(){var s=this;this._mediaKeysList.forEach(function(t){t.mediaKeysSession||(t.mediaKeysSession=t.mediaKeys.createSession(),s._onNewMediaKeySession(t.mediaKeysSession))})},e._onNewMediaKeySession=function(s){var t=this;I.logger.log("New key-system session "+s.sessionId),s.addEventListener("message",function(i){t._onKeySessionMessage(s,i.message)},!1)},e._onKeySessionMessage=function(s,t){I.logger.log("Got EME message event, creating license request"),this._requestLicense(t,function(i){I.logger.log("Received license data (length: "+(i&&i.byteLength)+"), updating key-session"),s.update(i)})},e.onMediaEncrypted=function(s){var t=this;if(I.logger.log('Media is encrypted using "'+s.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(U.Events.ERROR,{type:S.ErrorTypes.KEY_SYSTEM_ERROR,details:S.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var i=function(T){if(!t._media)return;t._attemptSetMediaKeys(T),t._generateRequestWithPreferredKeySession(s.initDataType,s.initData)};this.mediaKeysPromise.then(i).catch(i)},e._attemptSetMediaKeys=function(s){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var t=this._mediaKeysList[0];if(!t||!t.mediaKeys){I.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(U.Events.ERROR,{type:S.ErrorTypes.KEY_SYSTEM_ERROR,details:S.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}I.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(t.mediaKeys),this._hasSetMediaKeys=!0}},e._generateRequestWithPreferredKeySession=function(s,t){var i=this,n=this._mediaKeysList[0];if(!n){I.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(U.Events.ERROR,{type:S.ErrorTypes.KEY_SYSTEM_ERROR,details:S.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(n.mediaKeysSessionInitialized){I.logger.warn("Key-Session already initialized but requested again");return}var T=n.mediaKeysSession;if(!T){I.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(U.Events.ERROR,{type:S.ErrorTypes.KEY_SYSTEM_ERROR,details:S.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!t){I.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(U.Events.ERROR,{type:S.ErrorTypes.KEY_SYSTEM_ERROR,details:S.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}I.logger.log('Generating key-session request for "'+s+'" init data type'),n.mediaKeysSessionInitialized=!0,T.generateRequest(s,t).then(function(){I.logger.debug("Key-session generation succeeded")}).catch(function(m){I.logger.error("Error generating key-session request:",m),i.hls.trigger(U.Events.ERROR,{type:S.ErrorTypes.KEY_SYSTEM_ERROR,details:S.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},e._createLicenseXhr=function(s,t,i){var n=new XMLHttpRequest;n.responseType="arraybuffer",n.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,n,s,t,i);var T=this._licenseXhrSetup;if(T)try{T.call(this.hls,n,s),T=void 0}catch(m){I.logger.error(m)}try{n.readyState||n.open("POST",s,!0),T&&T.call(this.hls,n,s)}catch(m){throw new Error("issue setting up KeySystem license XHR "+m)}return n},e._onLicenseRequestReadyStageChange=function(s,t,i,n){switch(s.readyState){case 4:if(s.status===200){this._requestLicenseFailureCount=0,I.logger.log("License request succeeded");var T=s.response,m=this._licenseResponseCallback;if(m)try{T=m.call(this.hls,s,t)}catch(b){I.logger.error(b)}n(T)}else{if(I.logger.error("License Request XHR failed ("+t+"). Status: "+s.status+" ("+s.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>C){this.hls.trigger(U.Events.ERROR,{type:S.ErrorTypes.KEY_SYSTEM_ERROR,details:S.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var p=C-this._requestLicenseFailureCount+1;I.logger.warn("Retrying license request, "+p+" attempts left"),this._requestLicense(i,n)}break}},e._generateLicenseRequestChallenge=function(s,t){switch(s.mediaKeySystemDomain){case N.KeySystems.WIDEVINE:return t}throw new Error("unsupported key-system: "+s.mediaKeySystemDomain)},e._requestLicense=function(s,t){I.logger.log("Requesting content license for key-system");var i=this._mediaKeysList[0];if(!i){I.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(U.Events.ERROR,{type:S.ErrorTypes.KEY_SYSTEM_ERROR,details:S.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var n=this.getLicenseServerUrl(i.mediaKeySystemDomain),T=this._createLicenseXhr(n,s,t);I.logger.log("Sending license request to URL: "+n);var m=this._generateLicenseRequestChallenge(i,s);T.send(m)}catch(p){I.logger.error("Failure requesting DRM license: "+p),this.hls.trigger(U.Events.ERROR,{type:S.ErrorTypes.KEY_SYSTEM_ERROR,details:S.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},e.onMediaAttached=function(s,t){if(!this._emeEnabled)return;var i=t.media;this._media=i,i.addEventListener("encrypted",this._onMediaEncrypted)},e.onMediaDetached=function(){var s=this._media,t=this._mediaKeysList;if(!s)return;s.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(t.map(function(i){if(i.mediaKeysSession)return i.mediaKeysSession.close().catch(function(){})})).then(function(){return s.setMediaKeys(null)}).catch(function(){})},e.onManifestParsed=function(s,t){if(!this._emeEnabled)return;var i=t.levels.map(function(T){return T.audioCodec}).filter(function(T){return!!T}),n=t.levels.map(function(T){return T.videoCodec}).filter(function(T){return!!T});this._attemptKeySystemAccess(N.KeySystems.WIDEVINE,i,n)},A(o,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),o}();F.default=u},"./src/controller/fps-controller.ts":function(_e,F,w){"use strict";w.r(F);var U=w("./src/events.ts"),S=w("./src/utils/logger.ts"),I=function(){function N(A){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=A,this.registerListeners()}var k=N.prototype;return k.setStreamController=function(C){this.streamController=C},k.registerListeners=function(){this.hls.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},k.unregisterListeners=function(){this.hls.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching)},k.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},k.onMediaAttaching=function(C,y){var h=this.hls.config;if(h.capLevelOnFPSDrop){var u=y.media instanceof self.HTMLVideoElement?y.media:null;this.media=u,u&&typeof u.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),h.fpsDroppedMonitoringPeriod)}},k.checkFPS=function(C,y,h){var u=performance.now();if(y){if(this.lastTime){var o=u-this.lastTime,e=h-this.lastDroppedFrames,d=y-this.lastDecodedFrames,s=1e3*e/o,t=this.hls;if(t.trigger(U.Events.FPS_DROP,{currentDropped:e,currentDecoded:d,totalDroppedFrames:h}),s>0&&e>t.config.fpsDroppedMonitoringThreshold*d){var i=t.currentLevel;S.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+i),i>0&&(t.autoLevelCapping===-1||t.autoLevelCapping>=i)&&(i=i-1,t.trigger(U.Events.FPS_DROP_LEVEL_CAPPING,{level:i,droppedLevel:t.currentLevel}),t.autoLevelCapping=i,this.streamController.nextLevelSwitch())}}this.lastTime=u,this.lastDroppedFrames=h,this.lastDecodedFrames=y}},k.checkFPSInterval=function(){var C=this.media;if(C)if(this.isVideoPlaybackQualityAvailable){var y=C.getVideoPlaybackQuality();this.checkFPS(C,y.totalVideoFrames,y.droppedVideoFrames)}else this.checkFPS(C,C.webkitDecodedFrameCount,C.webkitDroppedFrameCount)},N}();F.default=I},"./src/controller/fragment-finders.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"findFragmentByPDT",function(){return I}),w.d(F,"findFragmentByPTS",function(){return N}),w.d(F,"fragmentWithinToleranceTest",function(){return k}),w.d(F,"pdtWithinToleranceTest",function(){return A}),w.d(F,"findFragWithCC",function(){return C});var U=w("./src/polyfills/number.ts"),S=w("./src/utils/binary-search.ts");function I(y,h,u){if(h===null||!Array.isArray(y)||!y.length||!Object(U.isFiniteNumber)(h))return null;var o=y[0].programDateTime;if(h<(o||0))return null;var e=y[y.length-1].endProgramDateTime;if(h>=(e||0))return null;u=u||0;for(var d=0;d<y.length;++d){var s=y[d];if(A(h,u,s))return s}return null}function N(y,h,u,o){u===void 0&&(u=0),o===void 0&&(o=0);var e=null;if(y?e=h[y.sn-h[0].sn+1]||null:u===0&&h[0].start===0&&(e=h[0]),e&&k(u,o,e)===0)return e;var d=S.default.search(h,k.bind(null,u,o));return d||e}function k(y,h,u){y===void 0&&(y=0),h===void 0&&(h=0);var o=Math.min(h,u.duration+(u.deltaPTS?u.deltaPTS:0));return u.start+u.duration-o<=y?1:u.start-o>y&&u.start?-1:0}function A(y,h,u){var o=Math.min(h,u.duration+(u.deltaPTS?u.deltaPTS:0))*1e3,e=u.endProgramDateTime||0;return e-o>y}function C(y,h){return S.default.search(y,function(u){return u.cc<h?1:u.cc>h?-1:0})}},"./src/controller/fragment-tracker.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"FragmentState",function(){return I}),w.d(F,"FragmentTracker",function(){return N});var U=w("./src/events.ts"),S=w("./src/types/loader.ts"),I;(function(C){C.NOT_LOADED="NOT_LOADED",C.BACKTRACKED="BACKTRACKED",C.APPENDING="APPENDING",C.PARTIAL="PARTIAL",C.OK="OK"})(I||(I={}));var N=function(){function C(h){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=h,this._registerListeners()}var y=C.prototype;return y._registerListeners=function(){var u=this.hls;u.on(U.Events.BUFFER_APPENDED,this.onBufferAppended,this),u.on(U.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.on(U.Events.FRAG_LOADED,this.onFragLoaded,this)},y._unregisterListeners=function(){var u=this.hls;u.off(U.Events.BUFFER_APPENDED,this.onBufferAppended,this),u.off(U.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.off(U.Events.FRAG_LOADED,this.onFragLoaded,this)},y.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},y.getAppendedFrag=function(u,o){if(o===S.PlaylistLevelType.MAIN){var e=this.activeFragment,d=this.activeParts;if(!e)return null;if(d)for(var s=d.length;s--;){var t=d[s],i=t?t.end:e.appendedPTS;if(t.start<=u&&i!==void 0&&u<=i)return s>9&&(this.activeParts=d.slice(s-9)),t}else if(e.start<=u&&e.appendedPTS!==void 0&&u<=e.appendedPTS)return e}return this.getBufferedFrag(u,o)},y.getBufferedFrag=function(u,o){for(var e=this.fragments,d=Object.keys(e),s=d.length;s--;){var t=e[d[s]];if((t==null?void 0:t.body.type)===o&&t.buffered){var i=t.body;if(i.start<=u&&u<=i.end)return i}}return null},y.detectEvictedFragments=function(u,o,e){var d=this;Object.keys(this.fragments).forEach(function(s){var t=d.fragments[s];if(!t)return;if(!t.buffered){t.body.type===e&&d.removeFragment(t.body);return}var i=t.range[u];if(!i)return;i.time.some(function(n){var T=!d.isTimeBuffered(n.startPTS,n.endPTS,o);return T&&d.removeFragment(t.body),T})})},y.detectPartialFragments=function(u){var o=this,e=this.timeRanges,d=u.frag,s=u.part;if(!e||d.sn==="initSegment")return;var t=A(d),i=this.fragments[t];if(!i)return;Object.keys(e).forEach(function(n){var T=d.elementaryStreams[n];if(!T)return;var m=e[n],p=s!==null||T.partial===!0;i.range[n]=o.getBufferedTimes(d,s,p,m)}),i.backtrack=i.loaded=null,Object.keys(i.range).length?i.buffered=!0:this.removeFragment(i.body)},y.fragBuffered=function(u){var o=A(u),e=this.fragments[o];e&&(e.backtrack=e.loaded=null,e.buffered=!0)},y.getBufferedTimes=function(u,o,e,d){for(var s={time:[],partial:e},t=o?o.start:u.start,i=o?o.end:u.end,n=u.minEndPTS||i,T=u.maxStartPTS||t,m=0;m<d.length;m++){var p=d.start(m)-this.bufferPadding,b=d.end(m)+this.bufferPadding;if(T>=p&&n<=b){s.time.push({startPTS:Math.max(t,d.start(m)),endPTS:Math.min(i,d.end(m))});break}else if(t<b&&i>p)s.partial=!0,s.time.push({startPTS:Math.max(t,d.start(m)),endPTS:Math.min(i,d.end(m))});else if(i<=p)break}return s},y.getPartialFragment=function(u){var o=null,e,d,s,t=0,i=this.bufferPadding,n=this.fragments;return Object.keys(n).forEach(function(T){var m=n[T];if(!m)return;k(m)&&(d=m.body.start-i,s=m.body.end+i,u>=d&&u<=s&&(e=Math.min(u-d,s-u),t<=e&&(o=m.body,t=e)))}),o},y.getState=function(u){var o=A(u),e=this.fragments[o];return e?e.buffered?k(e)?I.PARTIAL:I.OK:e.backtrack?I.BACKTRACKED:I.APPENDING:I.NOT_LOADED},y.backtrack=function(u,o){var e=A(u),d=this.fragments[e];if(!d||d.backtrack)return null;var s=d.backtrack=o||d.loaded;return d.loaded=null,s},y.getBacktrackData=function(u){var o=A(u),e=this.fragments[o];if(e){var d,s=e.backtrack;if(s!=null&&(d=s.payload)!==null&&d!==void 0&&d.byteLength)return s;this.removeFragment(u)}return null},y.isTimeBuffered=function(u,o,e){for(var d,s,t=0;t<e.length;t++){if(d=e.start(t)-this.bufferPadding,s=e.end(t)+this.bufferPadding,u>=d&&o<=s)return!0;if(o<=d)return!1}return!1},y.onFragLoaded=function(u,o){var e=o.frag,d=o.part;if(e.sn==="initSegment"||e.bitrateTest||d)return;var s=A(e);this.fragments[s]={body:e,loaded:o,backtrack:null,buffered:!1,range:Object.create(null)}},y.onBufferAppended=function(u,o){var e=this,d=o.frag,s=o.part,t=o.timeRanges;if(d.type===S.PlaylistLevelType.MAIN)if(this.activeFragment=d,s){var i=this.activeParts;i||(this.activeParts=i=[]),i.push(s)}else this.activeParts=null;this.timeRanges=t,Object.keys(t).forEach(function(n){var T=t[n];if(e.detectEvictedFragments(n,T),!s)for(var m=0;m<T.length;m++)d.appendedPTS=Math.max(T.end(m),d.appendedPTS||0)})},y.onFragBuffered=function(u,o){this.detectPartialFragments(o)},y.hasFragment=function(u){var o=A(u);return!!this.fragments[o]},y.removeFragmentsInRange=function(u,o,e){var d=this;Object.keys(this.fragments).forEach(function(s){var t=d.fragments[s];if(!t)return;if(t.buffered){var i=t.body;i.type===e&&i.start<o&&i.end>u&&d.removeFragment(i)}})},y.removeFragment=function(u){var o=A(u);u.stats.loaded=0,u.clearElementaryStreamInfo(),delete this.fragments[o]},y.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},C}();function k(C){var y,h;return C.buffered&&(((y=C.range.video)===null||y===void 0?void 0:y.partial)||((h=C.range.audio)===null||h===void 0?void 0:h.partial))}function A(C){return C.type+"_"+C.level+"_"+C.urlId+"_"+C.sn}},"./src/controller/gap-controller.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"STALL_MINIMUM_DURATION_MS",function(){return k}),w.d(F,"MAX_START_GAP_JUMP",function(){return A}),w.d(F,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return C}),w.d(F,"SKIP_BUFFER_RANGE_START",function(){return y}),w.d(F,"default",function(){return h});var U=w("./src/utils/buffer-helper.ts"),S=w("./src/errors.ts"),I=w("./src/events.ts"),N=w("./src/utils/logger.ts"),k=250,A=2,C=.1,y=.05,h=function(){function u(e,d,s,t){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=e,this.media=d,this.fragmentTracker=s,this.hls=t}var o=u.prototype;return o.destroy=function(){this.hls=this.fragmentTracker=this.media=null},o.poll=function(d){var s=this.config,t=this.media,i=this.stalled,n=t.currentTime,T=t.seeking,m=this.seeking&&!T,p=!this.seeking&&T;if(this.seeking=T,n!==d){if(this.moved=!0,i!==null){if(this.stallReported){var b=self.performance.now()-i;N.logger.warn("playback not stuck anymore @"+n+", after "+Math.round(b)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((p||m)&&(this.stalled=null),t.paused||t.ended||t.playbackRate===0||!U.BufferHelper.getBuffered(t).length)return;var _=U.BufferHelper.bufferInfo(t,n,0),a=_.len>0,c=_.nextStart||0;if(!a&&!c)return;if(T){var r=_.len>A,l=!c||c-n>A&&!this.fragmentTracker.getPartialFragment(n);if(r||l)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var v,f=Math.max(c,_.start||0)-n,x=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,R=x==null||((v=x.details)===null||v===void 0)?void 0:v.live,O=R?x.details.targetduration*2:A;if(f>0&&f<=O){this._trySkipBufferHole(null);return}}var B=self.performance.now();if(i===null){this.stalled=B;return}var j=B-i;!T&&j>=k&&this._reportStall(_.len);var K=U.BufferHelper.bufferInfo(t,n,s.maxBufferHole);this._tryFixBufferStall(K,j)},o._tryFixBufferStall=function(d,s){var t=this.config,i=this.fragmentTracker,n=this.media,T=n.currentTime,m=i.getPartialFragment(T);if(m){var p=this._trySkipBufferHole(m);if(p)return}d.len>t.maxBufferHole&&s>t.highBufferWatchdogPeriod*1e3&&(N.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},o._reportStall=function(d){var s=this.hls,t=this.media,i=this.stallReported;i||(this.stallReported=!0,N.logger.warn("Playback stalling at @"+t.currentTime+" due to low buffer (buffer="+d+")"),s.trigger(I.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:d}))},o._trySkipBufferHole=function(d){for(var s=this.config,t=this.hls,i=this.media,n=i.currentTime,T=0,m=U.BufferHelper.getBuffered(i),p=0;p<m.length;p++){var b=m.start(p);if(n+s.maxBufferHole>=T&&n<b){var _=Math.max(b+y,i.currentTime+C);return N.logger.warn("skipping hole, adjusting currentTime from "+n+" to "+_),this.moved=!0,this.stalled=null,i.currentTime=_,d&&t.trigger(I.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+n+" to "+_,frag:d}),_}T=m.end(p)}return 0},o._tryNudgeBuffer=function(){var d=this.config,s=this.hls,t=this.media,i=t.currentTime,n=(this.nudgeRetry||0)+1;if(this.nudgeRetry=n,n<d.nudgeMaxRetry){var T=i+n*d.nudgeOffset;N.logger.warn("Nudging 'currentTime' from "+i+" to "+T),t.currentTime=T,s.trigger(I.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else N.logger.error("Playhead still not moving while enough data buffered @"+i+" after "+d.nudgeMaxRetry+" nudges"),s.trigger(I.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},u}()},"./src/controller/id3-track-controller.ts":function(_e,F,w){"use strict";w.r(F);var U=w("./src/events.ts"),S=w("./src/utils/texttrack-utils.ts"),I=w("./src/demux/id3.ts"),N=.25,k=function(){function A(y){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=y,this._registerListeners()}var C=A.prototype;return C.destroy=function(){this._unregisterListeners()},C._registerListeners=function(){var h=this.hls;h.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(U.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),h.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},C._unregisterListeners=function(){var h=this.hls;h.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(U.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),h.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},C.onMediaAttached=function(h,u){this.media=u.media},C.onMediaDetaching=function(){if(!this.id3Track)return;Object(S.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},C.getID3Track=function(h){if(!this.media)return;for(var u=0;u<h.length;u++){var o=h[u];if(o.kind==="metadata"&&o.label==="id3")return Object(S.sendAddTrackEvent)(o,this.media),o}return this.media.addTextTrack("metadata","id3")},C.onFragParsingMetadata=function(h,u){if(!this.media)return;var o=u.frag,e=u.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var d=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,s=0;s<e.length;s++){var t=I.getID3Frames(e[s].data);if(t){var i=e[s].pts,n=s<e.length-1?e[s+1].pts:o.end,T=n-i;T<=0&&(n=i+N);for(var m=0;m<t.length;m++){var p=t[m];if(!I.isTimeStampFrame(p)){var b=new d(i,n,"");b.value=p,this.id3Track.addCue(b)}}}}},C.onBufferFlushing=function(h,u){var o=u.startOffset,e=u.endOffset,d=u.type;if(!d||d==="audio"){var s=this.id3Track;s&&Object(S.removeCuesInRange)(s,o,e)}},A}();F.default=k},"./src/controller/latency-controller.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"default",function(){return A});var U=w("./src/errors.ts"),S=w("./src/events.ts"),I=w("./src/utils/logger.ts");function N(C,y){for(var h=0;h<y.length;h++){var u=y[h];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(C,u.key,u)}}function k(C,y,h){return y&&N(C.prototype,y),h&&N(C,h),C}var A=function(){function C(h){var u=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 u.timeupdate()},this.hls=h,this.config=h.config,this.registerListeners()}var y=C.prototype;return y.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},y.registerListeners=function(){this.hls.on(S.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(S.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(S.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(S.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(S.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){this.hls.off(S.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(S.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(S.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(S.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(S.Events.ERROR,this.onError)},y.onMediaAttached=function(u,o){this.media=o.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},y.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},y.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},y.onLevelUpdated=function(u,o){var e=o.details;this.levelDetails=e,e.advanced&&this.timeupdate(),!e.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},y.onError=function(u,o){if(o.details!==U.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,I.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},y.timeupdate=function(){var u=this.media,o=this.levelDetails;if(!u||!o)return;this.currentTime=u.currentTime;var e=this.computeLatency();if(e===null)return;this._latency=e;var d=this.config,s=d.lowLatencyMode,t=d.maxLiveSyncPlaybackRate;if(!s||t===1)return;var i=this.targetLatency;if(i===null)return;var n=e-i,T=Math.min(this.maxLatency,i+o.targetduration),m=n<T;if(o.live&&m&&n>.05&&this.forwardBufferLength>1){var p=Math.min(2,Math.max(1,t)),b=Math.round(2/(1+Math.exp(-.75*n-this.edgeStalled))*20)/20;u.playbackRate=Math.min(p,Math.max(1,b))}else u.playbackRate!==1&&u.playbackRate!==0&&(u.playbackRate=1)},y.estimateLiveEdge=function(){var u=this.levelDetails;return u===null?null:u.edge+u.age},y.computeLatency=function(){var u=this.estimateLiveEdge();return u===null?null:u-this.currentTime},k(C,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var u=this.config,o=this.levelDetails;return u.liveMaxLatencyDuration!==void 0?u.liveMaxLatencyDuration:o?u.liveMaxLatencyDurationCount*o.targetduration:0}},{key:"targetLatency",get:function(){var u=this.levelDetails;if(u===null)return null;var o=u.holdBack,e=u.partHoldBack,d=u.targetduration,s=this.config,t=s.liveSyncDuration,i=s.liveSyncDurationCount,n=s.lowLatencyMode,T=this.hls.userConfig,m=n&&e||o;(T.liveSyncDuration||T.liveSyncDurationCount||m===0)&&(m=t!==void 0?t:i*d);var p=d,b=1;return m+Math.min(this.stallCount*b,p)}},{key:"liveSyncPosition",get:function(){var u=this.estimateLiveEdge(),o=this.targetLatency,e=this.levelDetails;if(u===null||o===null||e===null)return null;var d=e.edge,s=u-o-this.edgeStalled,t=d-e.totalduration,i=d-(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.min(Math.max(t,s),i)}},{key:"drift",get:function(){var u=this.levelDetails;return u===null?1:u.drift}},{key:"edgeStalled",get:function(){var u=this.levelDetails;if(u===null)return 0;var o=(this.config.lowLatencyMode&&u.partTarget||u.targetduration)*3;return Math.max(u.age-o,0)}},{key:"forwardBufferLength",get:function(){var u=this.media,o=this.levelDetails;if(!u||!o)return 0;var e=u.buffered.length;return e?u.buffered.end(e-1):o.edge-this.currentTime}}]),C}()},"./src/controller/level-controller.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"default",function(){return s});var U=w("./src/types/level.ts"),S=w("./src/events.ts"),I=w("./src/errors.ts"),N=w("./src/utils/codecs.ts"),k=w("./src/controller/level-helper.ts"),A=w("./src/controller/base-playlist-controller.ts"),C=w("./src/types/loader.ts");function y(){return y=Object.assign||function(t){for(var i=1;i<arguments.length;i++){var n=arguments[i];for(var T in n)Object.prototype.hasOwnProperty.call(n,T)&&(t[T]=n[T])}return t},y.apply(this,arguments)}function h(t,i){for(var n=0;n<i.length;n++){var T=i[n];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(t,T.key,T)}}function u(t,i,n){return i&&h(t.prototype,i),n&&h(t,n),t}function o(t,i){t.prototype=Object.create(i.prototype),t.prototype.constructor=t,e(t,i)}function e(t,i){return e=Object.setPrototypeOf||function(T,m){return T.__proto__=m,T},e(t,i)}var d=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),s=function(t){o(i,t);function i(T){var m;return m=t.call(this,T,"[level-controller]")||this,m._levels=[],m._firstLevel=-1,m._startLevel=void 0,m.currentLevelIndex=-1,m.manualLevelIndex=-1,m.onParsedComplete=void 0,m._registerListeners(),m}var n=i.prototype;return n._registerListeners=function(){var m=this.hls;m.on(S.Events.MANIFEST_LOADED,this.onManifestLoaded,this),m.on(S.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.on(S.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.on(S.Events.FRAG_LOADED,this.onFragLoaded,this),m.on(S.Events.ERROR,this.onError,this)},n._unregisterListeners=function(){var m=this.hls;m.off(S.Events.MANIFEST_LOADED,this.onManifestLoaded,this),m.off(S.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.off(S.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.off(S.Events.FRAG_LOADED,this.onFragLoaded,this),m.off(S.Events.ERROR,this.onError,this)},n.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,t.prototype.destroy.call(this)},n.startLoad=function(){var m=this._levels;m.forEach(function(p){p.loadError=0}),t.prototype.startLoad.call(this)},n.onManifestLoaded=function(m,p){var b=[],_=[],a=[],c,r={},l,v=!1,f=!1,x=!1;if(p.levels.forEach(function(j){var K=j.attrs;v=v||!!(j.width&&j.height),f=f||!!j.videoCodec,x=x||!!j.audioCodec,d&&j.audioCodec&&j.audioCodec.indexOf("mp4a.40.34")!==-1&&(j.audioCodec=void 0);var L=j.bitrate+"-"+j.attrs.RESOLUTION+"-"+j.attrs.CODECS;l=r[L],l?l.url.push(j.url):(l=new U.Level(j),r[L]=l,b.push(l)),K&&(K.AUDIO&&Object(k.addGroupId)(l,"audio",K.AUDIO),K.SUBTITLES&&Object(k.addGroupId)(l,"text",K.SUBTITLES))}),(v||f)&&x&&(b=b.filter(function(j){var K=j.videoCodec,L=j.width,H=j.height;return!!K||!!(L&&H)})),b=b.filter(function(j){var K=j.audioCodec,L=j.videoCodec;return(!K||Object(N.isCodecSupportedInMp4)(K,"audio"))&&(!L||Object(N.isCodecSupportedInMp4)(L,"video"))}),p.audioTracks&&(_=p.audioTracks.filter(function(j){return!j.audioCodec||Object(N.isCodecSupportedInMp4)(j.audioCodec,"audio")}),Object(k.assignTrackIdsByGroup)(_)),p.subtitles&&(a=p.subtitles,Object(k.assignTrackIdsByGroup)(a)),b.length>0){c=b[0].bitrate,b.sort(function(j,K){return j.bitrate-K.bitrate}),this._levels=b;for(var R=0;R<b.length;R++)if(b[R].bitrate===c){this._firstLevel=R,this.log("manifest loaded, "+b.length+" level(s) found, first bitrate: "+c);break}var O=x&&!f,B={levels:b,audioTracks:_,subtitleTracks:a,firstLevel:this._firstLevel,stats:p.stats,audio:x,video:f,altAudio:!O&&_.some(function(j){return!!j.url})};this.hls.trigger(S.Events.MANIFEST_PARSED,B),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(S.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"})},n.onError=function(m,p){if(t.prototype.onError.call(this,m,p),p.fatal)return;var b=p.context,_=this._levels[this.currentLevelIndex];if(b&&(b.type===C.PlaylistContextType.AUDIO_TRACK&&_.audioGroupIds&&b.groupId===_.audioGroupIds[_.urlId]||b.type===C.PlaylistContextType.SUBTITLE_TRACK&&_.textGroupIds&&b.groupId===_.textGroupIds[_.urlId])){this.redundantFailover(this.currentLevelIndex);return}var a=!1,c=!0,r;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 l=this._levels[p.frag.level];l?(l.fragmentError++,l.fragmentError>this.hls.config.fragLoadingMaxRetry&&(r=p.frag.level)):r=p.frag.level}break;case I.ErrorDetails.LEVEL_LOAD_ERROR:case I.ErrorDetails.LEVEL_LOAD_TIMEOUT:b&&(b.deliveryDirectives&&(c=!1),r=b.level),a=!0;break;case I.ErrorDetails.REMUX_ALLOC_ERROR:r=p.level,a=!0;break}r!==void 0&&this.recoverLevel(p,r,a,c)},n.recoverLevel=function(m,p,b,_){var a=m.details,c=this._levels[p];if(c.loadError++,b){var r=this.retryLoadingOrFail(m);if(r)m.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(_){var l=c.url.length;if(l>1&&c.loadError<l)m.levelRetry=!0,this.redundantFailover(p);else if(this.manualLevelIndex===-1){var v=p===0?this._levels.length-1:p-1;this.currentLevelIndex!==v&&this._levels[v].loadError===0&&(this.warn(a+": switch to "+v),m.levelRetry=!0,this.hls.nextAutoLevel=v)}}},n.redundantFailover=function(m){var p=this._levels[m],b=p.url.length;if(b>1){var _=(p.urlId+1)%b;this.warn("Switching to redundant URL-id "+_),this._levels.forEach(function(a){a.urlId=_}),this.level=m}},n.onFragLoaded=function(m,p){var b=p.frag;if(b!==void 0&&b.type===C.PlaylistLevelType.MAIN){var _=this._levels[b.level];_!==void 0&&(_.fragmentError=0,_.loadError=0)}},n.onLevelLoaded=function(m,p){var b,_=p.level,a=p.details,c=this._levels[_];if(!c){var r;this.warn("Invalid level index "+_),(r=p.deliveryDirectives)!==null&&r!==void 0&&r.skip&&(a.deltaUpdateFailed=!0);return}_===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(_,p,c.details)):(b=p.deliveryDirectives)!==null&&b!==void 0&&b.skip&&(a.deltaUpdateFailed=!0)},n.onAudioTrackSwitched=function(m,p){var b=this.hls.levels[this.currentLevelIndex];if(!b)return;if(b.audioGroupIds){for(var _=-1,a=this.hls.audioTracks[p.id].groupId,c=0;c<b.audioGroupIds.length;c++)if(b.audioGroupIds[c]===a){_=c;break}_!==b.urlId&&(b.urlId=_,this.startLoad())}},n.loadPlaylist=function(m){var p=this.currentLevelIndex,b=this._levels[p];if(this.canLoad&&b&&b.url.length>0){var _=b.urlId,a=b.url[_];if(m)try{a=m.addDirectives(a)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+p+(m?" at sn "+m.msn+" part "+m.part:"")+" with URL-id "+_+" "+a),this.clearTimer(),this.hls.trigger(S.Events.LEVEL_LOADING,{url:a,level:p,id:_,deliveryDirectives:m||null})}},n.removeLevel=function(m,p){var b=function(c,r){return r!==p},_=this._levels.filter(function(a,c){return c!==m?!0:a.url.length>1&&p!==void 0?(a.url=a.url.filter(b),a.audioGroupIds&&(a.audioGroupIds=a.audioGroupIds.filter(b)),a.textGroupIds&&(a.textGroupIds=a.textGroupIds.filter(b)),a.urlId=0,!0):!1}).map(function(a,c){var r=a.details;return r!=null&&r.fragments&&r.fragments.forEach(function(l){l.level=c}),a});this._levels=_,this.hls.trigger(S.Events.LEVELS_UPDATED,{levels:_})},u(i,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(m){var p,b=this._levels;if(b.length===0)return;if(this.currentLevelIndex===m&&(p=b[m])!==null&&p!==void 0&&p.details)return;if(m<0||m>=b.length){var _=m<0;if(this.hls.trigger(S.Events.ERROR,{type:I.ErrorTypes.OTHER_ERROR,details:I.ErrorDetails.LEVEL_SWITCH_ERROR,level:m,fatal:_,reason:"invalid level idx"}),_)return;m=Math.min(m,b.length-1)}this.clearTimer();var a=this.currentLevelIndex,c=b[a],r=b[m];this.log("switching to level "+m+" from "+a),this.currentLevelIndex=m;var l=y({},r,{level:m,maxBitrate:r.maxBitrate,uri:r.uri,urlId:r.urlId});delete l._urlId,this.hls.trigger(S.Events.LEVEL_SWITCHING,l);var v=r.details;if(!v||v.live){var f=this.switchParams(r.uri,c==null?void 0:c.details);this.loadPlaylist(f)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(m){this.manualLevelIndex=m,this._startLevel===void 0&&(this._startLevel=m),m!==-1&&(this.level=m)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(m){this._firstLevel=m}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var m=this.hls.config.startLevel;return m!==void 0?m:this._firstLevel}else return this._startLevel},set:function(m){this._startLevel=m}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(m){this.level=m,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=m)}}]),i}(A.default)},"./src/controller/level-helper.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"addGroupId",function(){return I}),w.d(F,"assignTrackIdsByGroup",function(){return N}),w.d(F,"updatePTS",function(){return k}),w.d(F,"updateFragPTSDTS",function(){return C}),w.d(F,"mergeDetails",function(){return y}),w.d(F,"mapPartIntersection",function(){return h}),w.d(F,"mapFragmentIntersection",function(){return u}),w.d(F,"adjustSliding",function(){return o}),w.d(F,"addSliding",function(){return e}),w.d(F,"computeReloadInterval",function(){return d}),w.d(F,"getFragmentWithSN",function(){return s}),w.d(F,"getPartWith",function(){return t});var U=w("./src/polyfills/number.ts"),S=w("./src/utils/logger.ts");function I(i,n,T){switch(n){case"audio":i.audioGroupIds||(i.audioGroupIds=[]),i.audioGroupIds.push(T);break;case"text":i.textGroupIds||(i.textGroupIds=[]),i.textGroupIds.push(T);break}}function N(i){var n={};i.forEach(function(T){var m=T.groupId||"";T.id=n[m]=n[m]||0,n[m]++})}function k(i,n,T){var m=i[n],p=i[T];A(m,p)}function A(i,n){var T=n.startPTS;if(Object(U.isFiniteNumber)(T)){var m=0,p;n.sn>i.sn?(m=T-i.start,p=i):(m=i.start-T,p=n),p.duration!==m&&(p.duration=m)}else if(n.sn>i.sn){var b=i.cc===n.cc;b&&i.minEndPTS?n.start=i.start+(i.minEndPTS-i.start):n.start=i.start+i.duration}else n.start=Math.max(i.start-n.duration,0)}function C(i,n,T,m,p,b){var _=m-T;_<=0&&(S.logger.warn("Fragment should have a positive duration",n),m=T+n.duration,b=p+n.duration);var a=T,c=m,r=n.startPTS,l=n.endPTS;if(Object(U.isFiniteNumber)(r)){var v=Math.abs(r-T);Object(U.isFiniteNumber)(n.deltaPTS)?n.deltaPTS=Math.max(v,n.deltaPTS):n.deltaPTS=v,a=Math.max(T,r),T=Math.min(T,r),p=Math.min(p,n.startDTS),c=Math.min(m,l),m=Math.max(m,l),b=Math.max(b,n.endDTS)}n.duration=m-T;var f=T-n.start;n.appendedPTS=m,n.start=n.startPTS=T,n.maxStartPTS=a,n.startDTS=p,n.endPTS=m,n.minEndPTS=c,n.endDTS=b;var x=n.sn;if(!i||x<i.startSN||x>i.endSN)return 0;var R,O=x-i.startSN,B=i.fragments;for(B[O]=n,R=O;R>0;R--)A(B[R],B[R-1]);for(R=O;R<B.length-1;R++)A(B[R],B[R+1]);return i.fragmentHint&&A(B[B.length-1],i.fragmentHint),i.PTSKnown=i.alignedSliding=!0,f}function y(i,n){for(var T=null,m=i.fragments,p=m.length-1;p>=0;p--){var b=m[p].initSegment;if(b){T=b;break}}i.fragmentHint&&delete i.fragmentHint.endPTS;var _=0,a;if(u(i,n,function(R,O){R.relurl&&(_=R.cc-O.cc),Object(U.isFiniteNumber)(R.startPTS)&&Object(U.isFiniteNumber)(R.endPTS)&&(O.start=O.startPTS=R.startPTS,O.startDTS=R.startDTS,O.appendedPTS=R.appendedPTS,O.maxStartPTS=R.maxStartPTS,O.endPTS=R.endPTS,O.endDTS=R.endDTS,O.minEndPTS=R.minEndPTS,O.duration=R.endPTS-R.startPTS,O.duration&&(a=O),n.PTSKnown=n.alignedSliding=!0),O.elementaryStreams=R.elementaryStreams,O.loader=R.loader,O.stats=R.stats,O.urlId=R.urlId,R.initSegment&&(O.initSegment=R.initSegment,T=R.initSegment)}),T){var c=n.fragmentHint?n.fragments.concat(n.fragmentHint):n.fragments;c.forEach(function(R){var O;(!R.initSegment||R.initSegment.relurl===((O=T)===null||O===void 0?void 0:O.relurl))&&(R.initSegment=T)})}if(n.skippedSegments&&(n.deltaUpdateFailed=n.fragments.some(function(R){return!R}),n.deltaUpdateFailed)){S.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var r=n.skippedSegments;r--;)n.fragments.shift();n.startSN=n.fragments[0].sn,n.startCC=n.fragments[0].cc}var l=n.fragments;if(_){S.logger.warn("discontinuity sliding from playlist, take drift into account");for(var v=0;v<l.length;v++)l[v].cc+=_}n.skippedSegments&&(n.startCC=n.fragments[0].cc),h(i.partList,n.partList,function(R,O){O.elementaryStreams=R.elementaryStreams,O.stats=R.stats}),a?C(n,a,a.startPTS,a.endPTS,a.startDTS,a.endDTS):o(i,n),l.length&&(n.totalduration=n.edge-l[0].start),n.driftStartTime=i.driftStartTime,n.driftStart=i.driftStart;var f=n.advancedDateTime;if(n.advanced&&f){var x=n.edge;n.driftStart||(n.driftStartTime=f,n.driftStart=x),n.driftEndTime=f,n.driftEnd=x}else n.driftEndTime=i.driftEndTime,n.driftEnd=i.driftEnd,n.advancedDateTime=i.advancedDateTime}function h(i,n,T){if(i&&n)for(var m=0,p=0,b=i.length;p<=b;p++){var _=i[p],a=n[p+m];_&&a&&_.index===a.index&&_.fragment.sn===a.fragment.sn?T(_,a):m--}}function u(i,n,T){for(var m=n.skippedSegments,p=Math.max(i.startSN,n.startSN)-n.startSN,b=(i.fragmentHint?1:0)+(m?n.endSN:Math.min(i.endSN,n.endSN))-n.startSN,_=n.startSN-i.startSN,a=n.fragmentHint?n.fragments.concat(n.fragmentHint):n.fragments,c=i.fragmentHint?i.fragments.concat(i.fragmentHint):i.fragments,r=p;r<=b;r++){var l=c[_+r],v=a[r];m&&!v&&r<m&&(v=n.fragments[r]=l),l&&v&&T(l,v)}}function o(i,n){var T=n.startSN+n.skippedSegments-i.startSN,m=i.fragments;if(T<0||T>=m.length)return;e(n,m[T].start)}function e(i,n){if(n){for(var T=i.fragments,m=i.skippedSegments;m<T.length;m++)T[m].start+=n;i.fragmentHint&&(i.fragmentHint.start+=n)}}function d(i,n){var T=1e3*i.levelTargetDuration,m=T/2,p=i.age,b=p>0&&p<T*3,_=n.loading.end-n.loading.start,a,c=i.availabilityDelay;if(i.updated===!1)if(b){var r=333*i.misses;a=Math.max(Math.min(m,_*2),r),i.availabilityDelay=(i.availabilityDelay||0)+a}else a=m;else b?(c=Math.min(c||T/2,p),i.availabilityDelay=c,a=c+T-p):a=T-_;return Math.round(a)}function s(i,n,T){if(!i||!i.details)return null;var m=i.details,p=m.fragments[n-m.startSN];return p||(p=m.fragmentHint,p&&p.sn===n?p:n<m.startSN&&T&&T.sn===n?T:null)}function t(i,n,T){if(!i||!i.details)return null;var m=i.details.partList;if(m)for(var p=m.length;p--;){var b=m[p];if(b.index===T&&b.fragment.sn===n)return b}return null}},"./src/controller/stream-controller.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"default",function(){return m});var U=w("./src/polyfills/number.ts"),S=w("./src/controller/base-stream-controller.ts"),I=w("./src/is-supported.ts"),N=w("./src/events.ts"),k=w("./src/utils/buffer-helper.ts"),A=w("./src/controller/fragment-tracker.ts"),C=w("./src/types/loader.ts"),y=w("./src/loader/fragment.ts"),h=w("./src/demux/transmuxer-interface.ts"),u=w("./src/types/transmuxer.ts"),o=w("./src/controller/gap-controller.ts"),e=w("./src/errors.ts"),d=w("./src/utils/logger.ts");function s(p,b){for(var _=0;_<b.length;_++){var a=b[_];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(p,a.key,a)}}function t(p,b,_){return b&&s(p.prototype,b),_&&s(p,_),p}function i(p,b){p.prototype=Object.create(b.prototype),p.prototype.constructor=p,n(p,b)}function n(p,b){return n=Object.setPrototypeOf||function(a,c){return a.__proto__=c,a},n(p,b)}var T=100,m=function(p){i(b,p);function b(a,c){var r;return r=p.call(this,a,c,"[stream-controller]")||this,r.audioCodecSwap=!1,r.gapController=null,r.level=-1,r._forceStartLoad=!1,r.altAudio=!1,r.audioOnly=!1,r.fragPlaying=null,r.onvplaying=null,r.onvseeked=null,r.fragLastKbps=0,r.stalled=!1,r.couldBacktrack=!1,r.audioCodecSwitch=!1,r.videoBuffer=null,r._registerListeners(),r}var _=b.prototype;return _._registerListeners=function(){var c=this.hls;c.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(N.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(N.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(N.Events.ERROR,this.onError,this),c.on(N.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(N.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(N.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(N.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(N.Events.FRAG_BUFFERED,this.onFragBuffered,this)},_._unregisterListeners=function(){var c=this.hls;c.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(N.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(N.Events.ERROR,this.onError,this),c.off(N.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(N.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(N.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(N.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(N.Events.FRAG_BUFFERED,this.onFragBuffered,this)},_.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},_.startLoad=function(c){if(this.levels){var r=this.lastCurrentTime,l=this.hls;if(this.stopLoad(),this.setInterval(T),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var v=l.startLevel;v===-1&&(l.config.testBandwidth?(v=0,this.bitrateTest=!0):v=l.nextAutoLevel),this.level=l.nextLoadLevel=v,this.loadedmetadata=!1}r>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+r.toFixed(3)),c=r),this.state=S.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=S.State.STOPPED},_.stopLoad=function(){this._forceStartLoad=!1,p.prototype.stopLoad.call(this)},_.doTick=function(){switch(this.state){case S.State.IDLE:this.doTickIdle();break;case S.State.WAITING_LEVEL:{var c,r=this.levels,l=this.level,v=r==null||((c=r[l])===null||c===void 0)?void 0:c.details;if(v&&(!v.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(v))break;this.state=S.State.IDLE;break}break}case S.State.FRAG_LOADING_WAITING_RETRY:{var f,x=self.performance.now(),R=this.retryDate;(!R||x>=R||(f=this.media)!==null&&f!==void 0&&f.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=S.State.IDLE)}break;default:break}this.onTickEnd()},_.onTickEnd=function(){p.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},_.doTickIdle=function(){var c,r,l=this.hls,v=this.levelLastLoaded,f=this.levels,x=this.media,R=l.config,O=l.nextLoadLevel;if(v===null||!x&&(this.startFragRequested||!R.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!f||!f[O])return;var B=f[O];this.level=l.nextLoadLevel=O;var j=B.details;if(!j||this.state===S.State.WAITING_LEVEL||j.live&&this.levelLastLoaded!==O){this.state=S.State.WAITING_LEVEL;return}var K=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:x,C.PlaylistLevelType.MAIN);if(K===null)return;var L=K.len,H=this.getMaxBufferLength(B.maxBitrate);if(L>=H)return;if(this._streamEnded(K,j)){var Y={};this.altAudio&&(Y.type="video"),this.hls.trigger(N.Events.BUFFER_EOS,Y),this.state=S.State.ENDED;return}var ae=K.end,Z=this.getNextFragment(ae,j);if(this.couldBacktrack&&!this.fragPrevious&&Z&&Z.sn!=="initSegment"){var ce=Z.sn-j.startSN;ce>1&&(Z=j.fragments[ce-1],this.fragmentTracker.removeFragment(Z))}if(Z&&this.fragmentTracker.getState(Z)===A.FragmentState.OK&&this.nextLoadPosition>ae){var de=this.audioOnly&&!this.altAudio?y.ElementaryStreamTypes.AUDIO:y.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(x,de,C.PlaylistLevelType.MAIN),Z=this.getNextFragment(this.nextLoadPosition,j)}if(!Z)return;Z.initSegment&&!Z.initSegment.data&&!this.bitrateTest&&(Z=Z.initSegment),((c=Z.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((r=Z.decryptdata)!==null&&r!==void 0&&r.key)?this.loadKey(Z,j):this.loadFragment(Z,j,ae)},_.loadFragment=function(c,r,l){var v,f=this.fragmentTracker.getState(c);if(this.fragCurrent=c,f===A.FragmentState.BACKTRACKED){var x=this.fragmentTracker.getBacktrackData(c);if(x){this._handleFragmentLoadProgress(x),this._handleFragmentLoadComplete(x);return}else f=A.FragmentState.NOT_LOADED}f===A.FragmentState.NOT_LOADED||f===A.FragmentState.PARTIAL?c.sn==="initSegment"?this._loadInitSegment(c):this.bitrateTest?(c.bitrateTest=!0,this.log("Fragment "+c.sn+" of level "+c.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(c)):(this.startFragRequested=!0,p.prototype.loadFragment.call(this,c,r,l)):f===A.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((v=this.media)===null||v===void 0?void 0:v.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},_.getAppendedFrag=function(c){var r=this.fragmentTracker.getAppendedFrag(c,C.PlaylistLevelType.MAIN);return r&&"fragment"in r?r.fragment:r},_.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,C.PlaylistLevelType.MAIN)},_.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},_.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},_.nextLevelSwitch=function(){var c=this.levels,r=this.media;if(r!=null&&r.readyState){var l,v=this.getAppendedFrag(r.currentTime);if(v&&v.start>1&&this.flushMainBuffer(0,v.start-1),!r.paused&&c){var f=this.hls.nextLoadLevel,x=c[f],R=this.fragLastKbps;R&&this.fragCurrent?l=this.fragCurrent.duration*x.maxBitrate/(1e3*R)+1:l=0}else l=0;var O=this.getBufferedFrag(r.currentTime+l);if(O){var B=this.followingBufferedFrag(O);if(B){this.abortCurrentFrag();var j=B.maxStartPTS?B.maxStartPTS:B.start,K=B.duration,L=Math.max(O.end,j+Math.min(Math.max(K-this.config.maxFragLookUpTolerance,K*.5),K*.75));this.flushMainBuffer(L,Number.POSITIVE_INFINITY)}}}},_.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===S.State.KEY_LOADING&&(this.state=S.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},_.flushMainBuffer=function(c,r){p.prototype.flushMainBuffer.call(this,c,r,this.altAudio?"video":null)},_.onMediaAttached=function(c,r){p.prototype.onMediaAttached.call(this,c,r);var l=r.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),l.addEventListener("playing",this.onvplaying),l.addEventListener("seeked",this.onvseeked),this.gapController=new o.default(this.config,l,this.fragmentTracker,this.hls)},_.onMediaDetaching=function(){var c=this.media;c&&(c.removeEventListener("playing",this.onvplaying),c.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)},_.onMediaPlaying=function(){this.tick()},_.onMediaSeeked=function(){var c=this.media,r=c?c.currentTime:null;Object(U.isFiniteNumber)(r)&&this.log("Media seeked to "+r.toFixed(3)),this.tick()},_.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(N.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},_.onManifestParsed=function(c,r){var l=!1,v=!1,f;r.levels.forEach(function(x){f=x.audioCodec,f&&(f.indexOf("mp4a.40.2")!==-1&&(l=!0),f.indexOf("mp4a.40.5")!==-1&&(v=!0))}),this.audioCodecSwitch=l&&v&&!Object(I.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=r.levels,this.startFragRequested=!1},_.onLevelLoading=function(c,r){var l=this.levels;if(!l||this.state!==S.State.IDLE)return;var v=l[r.level];(!v.details||v.details.live&&this.levelLastLoaded!==r.level||this.waitForCdnTuneIn(v.details))&&(this.state=S.State.WAITING_LEVEL)},_.onLevelLoaded=function(c,r){var l,v=this.levels,f=r.level,x=r.details,R=x.totalduration;if(!v){this.warn("Levels were reset while loading level "+f);return}this.log("Level "+f+" loaded ["+x.startSN+","+x.endSN+"], cc ["+x.startCC+", "+x.endCC+"] duration:"+R);var O=this.fragCurrent;O&&(this.state===S.State.FRAG_LOADING||this.state===S.State.FRAG_LOADING_WAITING_RETRY)&&(O.level!==r.level&&O.loader&&(this.state=S.State.IDLE,O.loader.abort()));var B=v[f],j=0;if(x.live||(l=B.details)!==null&&l!==void 0&&l.live){if(x.fragments[0]||(x.deltaUpdateFailed=!0),x.deltaUpdateFailed)return;j=this.alignPlaylists(x,B.details)}if(B.details=x,this.levelLastLoaded=f,this.hls.trigger(N.Events.LEVEL_UPDATED,{details:x,level:f}),this.state===S.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(x))return;this.state=S.State.IDLE}this.startFragRequested?x.live&&this.synchronizeToLiveEdge(x):this.setStartPosition(x,j),this.tick()},_._handleFragmentLoadProgress=function(c){var r,l=c.frag,v=c.part,f=c.payload,x=this.levels;if(!x){this.warn("Levels were reset while fragment load was in progress. Fragment "+l.sn+" of level "+l.level+" will not be buffered");return}var R=x[l.level],O=R.details;if(!O){this.warn("Dropping fragment "+l.sn+" of level "+l.level+" after level details were reset");return}var B=R.videoCodec,j=O.PTSKnown||!O.live,K=(r=l.initSegment)===null||r===void 0?void 0:r.data,L=this._getAudioCodec(R),H=this.transmuxer=this.transmuxer||new h.default(this.hls,C.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Y=v?v.index:-1,ae=Y!==-1,Z=new u.ChunkMetadata(l.level,l.sn,l.stats.chunkCount,f.byteLength,Y,ae),ce=this.initPTS[l.cc];H.push(f,K,L,B,l,v,O.totalduration,j,Z,ce)},_.onAudioTrackSwitching=function(c,r){var l=this.altAudio,v=!!r.url,f=r.id;if(!v){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 R=this.hls;l&&R.trigger(N.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),R.trigger(N.Events.AUDIO_TRACK_SWITCHED,{id:f})}},_.onAudioTrackSwitched=function(c,r){var l=r.id,v=!!this.hls.audioTracks[l].url;if(v){var f=this.videoBuffer;f&&this.mediaBuffer!==f&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=f)}this.altAudio=v,this.tick()},_.onBufferCreated=function(c,r){var l=r.tracks,v,f,x=!1;for(var R in l){var O=l[R];if(O.id==="main"){if(f=R,v=O,R==="video"){var B=l[R];B&&(this.videoBuffer=B.buffer)}}else x=!0}x&&v?(this.log("Alternate track found, use "+f+".buffered to schedule main fragment loading"),this.mediaBuffer=v.buffer):this.mediaBuffer=this.media},_.onFragBuffered=function(c,r){var l=r.frag,v=r.part;if(l&&l.type!==C.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(l)){this.warn("Fragment "+l.sn+(v?" p: "+v.index:"")+" of level "+l.level+" finished buffering, but was aborted. state: "+this.state),this.state===S.State.PARSED&&(this.state=S.State.IDLE);return}var f=v?v.stats:l.stats;this.fragLastKbps=Math.round(8*f.total/(f.buffering.end-f.loading.first)),l.sn!=="initSegment"&&(this.fragPrevious=l),this.fragBufferedComplete(l,v)},_.onError=function(c,r){switch(r.details){case e.ErrorDetails.FRAG_LOAD_ERROR:case e.ErrorDetails.FRAG_LOAD_TIMEOUT:case e.ErrorDetails.KEY_LOAD_ERROR:case e.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(C.PlaylistLevelType.MAIN,r);break;case e.ErrorDetails.LEVEL_LOAD_ERROR:case e.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==S.State.ERROR&&(r.fatal?(this.warn(""+r.details),this.state=S.State.ERROR):!r.levelRetry&&this.state===S.State.WAITING_LEVEL&&(this.state=S.State.IDLE));break;case e.ErrorDetails.BUFFER_FULL_ERROR:if(r.parent==="main"&&(this.state===S.State.PARSING||this.state===S.State.PARSED)){var l=!0,v=this.getFwdBufferInfo(this.media,C.PlaylistLevelType.MAIN);v&&v.len>.5&&(l=!this.reduceMaxBufferLength(v.len)),l&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},_.checkBuffer=function(){var c=this.media,r=this.gapController;if(!c||!r||!c.readyState)return;var l=k.BufferHelper.getBuffered(c);!this.loadedmetadata&&l.length?(this.loadedmetadata=!0,this.seekToStartPos()):r.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},_.onFragLoadEmergencyAborted=function(){this.state=S.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},_.onBufferFlushed=function(c,r){var l=r.type;if(l!==y.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var v=(l===y.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(v,l,C.PlaylistLevelType.MAIN)}},_.onLevelsUpdated=function(c,r){this.levels=r.levels},_.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},_.seekToStartPos=function(){var c=this.media,r=c.currentTime,l=this.startPosition;if(l>=0&&r<l){if(c.seeking){d.logger.log("could not seek to "+l+", already seeking at "+r);return}var v=k.BufferHelper.getBuffered(c),f=v.length?v.start(0):0,x=f-l;x>0&&(x<this.config.maxBufferHole||x<this.config.maxFragLookUpTolerance)&&(d.logger.log("adjusting start position by "+x+" to match buffer start"),l+=x,this.startPosition=l),this.log("seek to target start position "+l+" from current time "+r),c.currentTime=l}},_._getAudioCodec=function(c){var r=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&r&&(this.log("Swapping audio codec"),r.indexOf("mp4a.40.5")!==-1?r="mp4a.40.2":r="mp4a.40.5"),r},_._loadBitrateTestFrag=function(c){var r=this;this._doFragLoad(c).then(function(l){var v=r.hls;if(!l||v.nextLoadLevel||r.fragContextChanged(c))return;r.fragLoadError=0,r.state=S.State.IDLE,r.startFragRequested=!1,r.bitrateTest=!1;var f=c.stats;f.parsing.start=f.parsing.end=f.buffering.start=f.buffering.end=self.performance.now(),v.trigger(N.Events.FRAG_LOADED,l)})},_._handleTransmuxComplete=function(c){var r,l="main",v=this.hls,f=c.remuxResult,x=c.chunkMeta,R=this.getCurrentContext(x);if(!R){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 O=R.frag,B=R.part,j=R.level,K=f.video,L=f.text,H=f.id3,Y=f.initSegment,ae=this.altAudio?void 0:f.audio;if(this.fragContextChanged(O))return;if(this.state=S.State.PARSING,Y){Y.tracks&&(this._bufferInitSegment(j,Y.tracks,O,x),v.trigger(N.Events.FRAG_PARSING_INIT_SEGMENT,{frag:O,id:l,tracks:Y.tracks}));var Z=Y.initPTS,ce=Y.timescale;Object(U.isFiniteNumber)(Z)&&(this.initPTS[O.cc]=Z,v.trigger(N.Events.INIT_PTS_FOUND,{frag:O,id:l,initPTS:Z,timescale:ce}))}if(K&&f.independent!==!1){if(j.details){var de=K.startPTS,q=K.endPTS,te=K.startDTS,he=K.endDTS;if(B)B.elementaryStreams[K.type]={startPTS:de,endPTS:q,startDTS:te,endDTS:he};else if(K.firstKeyFrame&&K.independent&&(this.couldBacktrack=!0),K.dropped&&K.independent){var J=this.getLoadPosition()+this.config.maxBufferHole;if(J<de){this.backtrack(O);return}O.setElementaryStreamInfo(K.type,O.start,q,O.start,he,!0)}O.setElementaryStreamInfo(K.type,de,q,te,he),this.bufferFragmentData(K,O,B,x)}}else if(f.independent===!1){this.backtrack(O);return}if(ae){var X=ae.startPTS,ye=ae.endPTS,we=ae.startDTS,Le=ae.endDTS;B&&(B.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:X,endPTS:ye,startDTS:we,endDTS:Le}),O.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,X,ye,we,Le),this.bufferFragmentData(ae,O,B,x)}if(H!=null&&(r=H.samples)!==null&&r!==void 0&&r.length){var xe={frag:O,id:l,samples:H.samples};v.trigger(N.Events.FRAG_PARSING_METADATA,xe)}if(L){var Re={frag:O,id:l,samples:L.samples};v.trigger(N.Events.FRAG_PARSING_USERDATA,Re)}},_._bufferInitSegment=function(c,r,l,v){var f=this;if(this.state!==S.State.PARSING)return;this.audioOnly=!!r.audio&&!r.video,this.altAudio&&!this.audioOnly&&delete r.audio;var x=r.audio,R=r.video,O=r.audiovideo;if(x){var B=c.audioCodec,j=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(B&&(B.indexOf("mp4a.40.5")!==-1?B="mp4a.40.2":B="mp4a.40.5"),x.metadata.channelCount!==1&&j.indexOf("firefox")===-1&&(B="mp4a.40.5")),j.indexOf("android")!==-1&&x.container!=="audio/mpeg"&&(B="mp4a.40.2",this.log("Android: force audio codec to "+B)),c.audioCodec&&c.audioCodec!==B&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+B+'"'),x.levelCodec=B,x.id="main",this.log("Init audio buffer, container:"+x.container+", codecs[selected/level/parsed]=["+(B||"")+"/"+(c.audioCodec||"")+"/"+x.codec+"]")}R&&(R.levelCodec=c.videoCodec,R.id="main",this.log("Init video buffer, container:"+R.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+R.codec+"]")),O&&this.log("Init audiovideo buffer, container:"+O.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+O.codec+"]"),this.hls.trigger(N.Events.BUFFER_CODECS,r),Object.keys(r).forEach(function(K){var L=r[K],H=L.initSegment;H!=null&&H.byteLength&&f.hls.trigger(N.Events.BUFFER_APPENDING,{type:K,data:H,frag:l,part:null,chunkMeta:v,parent:l.type})}),this.tick()},_.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var r=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,r?this.resetFragmentLoading(c):this.state=S.State.BACKTRACKING},_.checkFragmentChanged=function(){var c=this.media,r=null;if(c&&c.readyState>1&&c.seeking===!1){var l=c.currentTime;if(k.BufferHelper.isBuffered(c,l)?r=this.getAppendedFrag(l):k.BufferHelper.isBuffered(c,l+.1)&&(r=this.getAppendedFrag(l+.1)),r){var v=this.fragPlaying,f=r.level;(!v||r.sn!==v.sn||v.level!==f||r.urlId!==v.urlId)&&(this.hls.trigger(N.Events.FRAG_CHANGED,{frag:r}),(!v||v.level!==f)&&this.hls.trigger(N.Events.LEVEL_SWITCHED,{level:f}),this.fragPlaying=r)}}},t(b,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var r=this.getAppendedFrag(c.currentTime);if(r)return r.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var r=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(r)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),b}(S.default)},"./src/controller/subtitle-stream-controller.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"SubtitleStreamController",function(){return i});var U=w("./src/events.ts"),S=w("./src/utils/logger.ts"),I=w("./src/utils/buffer-helper.ts"),N=w("./src/controller/fragment-finders.ts"),k=w("./src/utils/discontinuities.ts"),A=w("./src/controller/level-helper.ts"),C=w("./src/controller/fragment-tracker.ts"),y=w("./src/controller/base-stream-controller.ts"),h=w("./src/types/loader.ts"),u=w("./src/types/level.ts");function o(n,T){for(var m=0;m<T.length;m++){var p=T[m];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(n,p.key,p)}}function e(n,T,m){return T&&o(n.prototype,T),m&&o(n,m),n}function d(n,T){n.prototype=Object.create(T.prototype),n.prototype.constructor=n,s(n,T)}function s(n,T){return s=Object.setPrototypeOf||function(p,b){return p.__proto__=b,p},s(n,T)}var t=500,i=function(n){d(T,n);function T(p,b){var _;return _=n.call(this,p,b,"[subtitle-stream-controller]")||this,_.levels=[],_.currentTrackId=-1,_.tracksBuffered=[],_.mainDetails=null,_._registerListeners(),_}var m=T.prototype;return m.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},m._registerListeners=function(){var b=this.hls;b.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),b.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),b.on(U.Events.ERROR,this.onError,this),b.on(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),b.on(U.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),b.on(U.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),b.on(U.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),b.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},m._unregisterListeners=function(){var b=this.hls;b.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),b.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),b.off(U.Events.ERROR,this.onError,this),b.off(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),b.off(U.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),b.off(U.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),b.off(U.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),b.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},m.startLoad=function(){this.stopLoad(),this.state=y.State.IDLE,this.setInterval(t),this.tick()},m.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},m.onLevelLoaded=function(b,_){this.mainDetails=_.details},m.onSubtitleFragProcessed=function(b,_){var a=_.frag,c=_.success;if(this.fragPrevious=a,this.state=y.State.IDLE,!c)return;var r=this.tracksBuffered[this.currentTrackId];if(!r)return;for(var l,v=a.start,f=0;f<r.length;f++)if(v>=r[f].start&&v<=r[f].end){l=r[f];break}var x=a.start+a.duration;l?l.end=x:(l={start:v,end:x},r.push(l)),this.fragmentTracker.fragBuffered(a)},m.onBufferFlushing=function(b,_){var a=_.startOffset,c=_.endOffset;if(a===0&&c!==Number.POSITIVE_INFINITY){var r=this.currentTrackId,l=this.levels;if(!l.length||!l[r]||!l[r].details)return;var v=l[r].details,f=v.targetduration,x=c-f;if(x<=0)return;_.endOffsetSubtitles=Math.max(0,x),this.tracksBuffered.forEach(function(R){for(var O=0;O<R.length;){if(R[O].end<=x){R.shift();continue}else if(R[O].start<x)R[O].start=x;else break;O++}}),this.fragmentTracker.removeFragmentsInRange(a,x,h.PlaylistLevelType.SUBTITLE)}},m.onError=function(b,_){var a,c=_.frag;if(!c||c.type!==h.PlaylistLevelType.SUBTITLE)return;(a=this.fragCurrent)!==null&&a!==void 0&&a.loader&&this.fragCurrent.loader.abort(),this.state=y.State.IDLE},m.onSubtitleTracksUpdated=function(b,_){var a=this,c=_.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(r){return new u.Level(r)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(r){a.tracksBuffered[r.id]=[]}),this.mediaBuffer=null},m.onSubtitleTrackSwitch=function(b,_){if(this.currentTrackId=_.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var a=this.levels[this.currentTrackId];a!=null&&a.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,a&&this.setInterval(t)},m.onSubtitleTrackLoaded=function(b,_){var a,c=_.details,r=_.id,l=this.currentTrackId,v=this.levels;if(!v.length)return;var f=v[l];if(r>=v.length||r!==l||!f)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(a=f.details)!==null&&a!==void 0&&a.live){var x=this.mainDetails;if(c.deltaUpdateFailed||!x)return;var R=x.fragments[0];if(!f.details)c.hasProgramDateTime&&x.hasProgramDateTime?Object(k.alignMediaPlaylistByPDT)(c,x):R&&Object(A.addSliding)(c,R.start);else{var O=this.alignPlaylists(c,f.details);O===0&&R&&Object(A.addSliding)(c,R.start)}}if(f.details=c,this.levelLastLoaded=r,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===y.State.IDLE){var B=Object(N.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);B||(this.warn("Subtitle playlist not aligned with playback"),f.details=void 0)}},m._handleFragmentLoadComplete=function(b){var _=b.frag,a=b.payload,c=_.decryptdata,r=this.hls;if(this.fragContextChanged(_))return;if(a&&a.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var l=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(a),c.key.buffer,c.iv.buffer).then(function(v){var f=performance.now();r.trigger(U.Events.FRAG_DECRYPTED,{frag:_,payload:v,stats:{tstart:l,tdecrypt:f}})})}},m.doTick=function(){if(!this.media){this.state=y.State.IDLE;return}if(this.state===y.State.IDLE){var b,_=this.currentTrackId,a=this.levels;if(!a.length||!a[_]||!a[_].details)return;var c=a[_].details,r=c.targetduration,l=this.config,v=this.media,f=I.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,v.currentTime-r,l.maxBufferHole),x=f.end,R=f.len,O=this.getMaxBufferLength()+r;if(R>O)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var B=c.fragments,j=B.length,K=c.edge,L,H=this.fragPrevious;if(x<K){var Y=l.maxFragLookUpTolerance;H&&c.hasProgramDateTime&&(L=Object(N.findFragmentByPDT)(B,H.endProgramDateTime,Y)),L||(L=Object(N.findFragmentByPTS)(H,B,x,Y),!L&&H&&H.start<B[0].start&&(L=B[0]))}else L=B[j-1];(b=L)!==null&&b!==void 0&&b.encrypted?(S.logger.log("Loading key for "+L.sn),this.state=y.State.KEY_LOADING,this.hls.trigger(U.Events.KEY_LOADING,{frag:L})):L&&this.fragmentTracker.getState(L)===C.FragmentState.NOT_LOADED&&this.loadFragment(L,c,x)}},m.loadFragment=function(b,_,a){this.fragCurrent=b,n.prototype.loadFragment.call(this,b,_,a)},e(T,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),T}(y.default)},"./src/controller/subtitle-track-controller.ts":function(_e,F,w){"use strict";w.r(F);var U=w("./src/events.ts"),S=w("./src/utils/texttrack-utils.ts"),I=w("./src/controller/base-playlist-controller.ts"),N=w("./src/types/loader.ts");function k(o,e){for(var d=0;d<e.length;d++){var s=e[d];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(o,s.key,s)}}function A(o,e,d){return e&&k(o.prototype,e),d&&k(o,d),o}function C(o,e){o.prototype=Object.create(e.prototype),o.prototype.constructor=o,y(o,e)}function y(o,e){return y=Object.setPrototypeOf||function(s,t){return s.__proto__=t,s},y(o,e)}var h=function(o){C(e,o);function e(s){var t;return t=o.call(this,s,"[subtitle-track-controller]")||this,t.media=null,t.tracks=[],t.groupId=null,t.tracksInGroup=[],t.trackId=-1,t.selectDefaultTrack=!0,t.queuedDefaultTrack=-1,t.trackChangeListener=function(){return t.onTextTracksChanged()},t.asyncPollTrackChange=function(){return t.pollTrackChange(0)},t.useTextTrackPolling=!1,t.subtitlePollingInterval=-1,t.subtitleDisplay=!0,t.registerListeners(),t}var d=e.prototype;return d.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,o.prototype.destroy.call(this)},d.registerListeners=function(){var t=this.hls;t.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),t.on(U.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(U.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(U.Events.ERROR,this.onError,this)},d.unregisterListeners=function(){var t=this.hls;t.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(U.Events.LEVEL_LOADING,this.onLevelLoading,this),t.off(U.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(U.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(U.Events.ERROR,this.onError,this)},d.onMediaAttached=function(t,i){if(this.media=i.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)},d.pollTrackChange=function(t){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,t)},d.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 t=u(this.media.textTracks);t.forEach(function(i){Object(S.clearCurrentCues)(i)}),this.subtitleTrack=-1,this.media=null},d.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},d.onManifestParsed=function(t,i){this.tracks=i.subtitleTracks},d.onSubtitleTrackLoaded=function(t,i){var n=i.id,T=i.details,m=this.trackId,p=this.tracksInGroup[m];if(!p){this.warn("Invalid subtitle track id "+n);return}var b=p.details;p.details=i.details,this.log("subtitle track "+n+" loaded ["+T.startSN+"-"+T.endSN+"]"),n===this.trackId&&(this.retryCount=0,this.playlistLoaded(n,i,b))},d.onLevelLoading=function(t,i){this.switchLevel(i.level)},d.onLevelSwitching=function(t,i){this.switchLevel(i.level)},d.switchLevel=function(t){var i=this.hls.levels[t];if(!(i!=null&&i.textGroupIds))return;var n=i.textGroupIds[i.urlId];if(this.groupId!==n){var T=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,m=this.tracks.filter(function(_){return!n||_.groupId===n});this.tracksInGroup=m;var p=this.findTrackId(T==null?void 0:T.name)||this.findTrackId();this.groupId=n;var b={subtitleTracks:m};this.log("Updating subtitle tracks, "+m.length+' track(s) found in "'+n+'" group-id'),this.hls.trigger(U.Events.SUBTITLE_TRACKS_UPDATED,b),p!==-1&&this.setSubtitleTrack(p,T)}},d.findTrackId=function(t){for(var i=this.tracksInGroup,n=0;n<i.length;n++){var T=i[n];if((!this.selectDefaultTrack||T.default)&&(!t||t===T.name))return T.id}return-1},d.onError=function(t,i){if(o.prototype.onError.call(this,t,i),i.fatal||!i.context)return;i.context.type===N.PlaylistContextType.SUBTITLE_TRACK&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&this.retryLoadingOrFail(i)},d.loadPlaylist=function(t){var i=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(i)){var n=i.id,T=i.groupId,m=i.url;if(t)try{m=t.addDirectives(m)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("Loading subtitle playlist for id "+n),this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADING,{url:m,id:n,groupId:T,deliveryDirectives:t||null})}},d.toggleTrackModes=function(t){var i=this,n=this.media,T=this.subtitleDisplay,m=this.trackId;if(!n)return;var p=u(n.textTracks),b=p.filter(function(c){return c.groupId===i.groupId});if(t===-1)[].slice.call(p).forEach(function(c){c.mode="disabled"});else{var _=b[m];_&&(_.mode="disabled")}var a=b[t];a&&(a.mode=T?"showing":"hidden")},d.setSubtitleTrack=function(t,i){var n,T=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=t;return}if(this.trackId!==t&&this.toggleTrackModes(t),this.trackId===t&&(t===-1||(n=T[t])!==null&&n!==void 0&&n.details)||t<-1||t>=T.length)return;this.clearTimer();var m=T[t];if(this.log("Switching to subtitle track "+t),this.trackId=t,m){var p=m.id,b=m.groupId,_=b===void 0?"":b,a=m.name,c=m.type,r=m.url;this.hls.trigger(U.Events.SUBTITLE_TRACK_SWITCH,{id:p,groupId:_,name:a,type:c,url:r});var l=this.switchParams(m.url,i==null?void 0:i.details);this.loadPlaylist(l)}else this.hls.trigger(U.Events.SUBTITLE_TRACK_SWITCH,{id:t})},d.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var t=-1,i=u(this.media.textTracks),n=0;n<i.length;n++)if(i[n].mode==="hidden")t=n;else if(i[n].mode==="showing"){t=n;break}this.subtitleTrack!==t&&(this.subtitleTrack=t)},A(e,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1;var i=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(t,i)}}]),e}(I.default);function u(o){for(var e=[],d=0;d<o.length;d++){var s=o[d];s.kind==="subtitles"&&s.label&&e.push(o[d])}return e}F.default=h},"./src/controller/timeline-controller.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"TimelineController",function(){return u});var U=w("./src/polyfills/number.ts"),S=w("./src/events.ts"),I=w("./src/utils/cea-608-parser.ts"),N=w("./src/utils/output-filter.ts"),k=w("./src/utils/webvtt-parser.ts"),A=w("./src/utils/texttrack-utils.ts"),C=w("./src/utils/imsc1-ttml-parser.ts"),y=w("./src/types/loader.ts"),h=w("./src/utils/logger.ts"),u=function(){function s(i){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=d(),this.captionsProperties=void 0,this.hls=i,this.config=i.config,this.Cues=i.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 n=new N.default(this,"textTrack1"),T=new N.default(this,"textTrack2"),m=new N.default(this,"textTrack3"),p=new N.default(this,"textTrack4");this.cea608Parser1=new I.default(1,n,T),this.cea608Parser2=new I.default(3,m,p)}i.on(S.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.on(S.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(S.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(S.Events.MANIFEST_LOADED,this.onManifestLoaded,this),i.on(S.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),i.on(S.Events.FRAG_LOADING,this.onFragLoading,this),i.on(S.Events.FRAG_LOADED,this.onFragLoaded,this),i.on(S.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),i.on(S.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),i.on(S.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),i.on(S.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),i.on(S.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var t=s.prototype;return t.destroy=function(){var n=this.hls;n.off(S.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),n.off(S.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(S.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(S.Events.MANIFEST_LOADED,this.onManifestLoaded,this),n.off(S.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),n.off(S.Events.FRAG_LOADING,this.onFragLoading,this),n.off(S.Events.FRAG_LOADED,this.onFragLoaded,this),n.off(S.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),n.off(S.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),n.off(S.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),n.off(S.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),n.off(S.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},t.addCues=function(n,T,m,p,b){for(var _=!1,a=b.length;a--;){var c=b[a],r=e(c[0],c[1],T,m);if(r>=0&&(c[0]=Math.min(c[0],T),c[1]=Math.max(c[1],m),_=!0,r/(m-T)>.5))return}if(_||b.push([T,m]),this.config.renderTextTracksNatively){var l=this.captionsTracks[n];this.Cues.newCue(l,T,m,p)}else{var v=this.Cues.newCue(null,T,m,p);this.hls.trigger(S.Events.CUES_PARSED,{type:"captions",cues:v,track:n})}},t.onInitPtsFound=function(n,T){var m=this,p=T.frag,b=T.id,_=T.initPTS,a=T.timescale,c=this.unparsedVttFrags;b==="main"&&(this.initPTS[p.cc]=_,this.timescale[p.cc]=a),c.length&&(this.unparsedVttFrags=[],c.forEach(function(r){m.onFragLoaded(S.Events.FRAG_LOADED,r)}))},t.getExistingTrack=function(n){var T=this.media;if(T)for(var m=0;m<T.textTracks.length;m++){var p=T.textTracks[m];if(p[n])return p}return null},t.createCaptionsTrack=function(n){this.config.renderTextTracksNatively?this.createNativeTrack(n):this.createNonNativeTrack(n)},t.createNativeTrack=function(n){if(this.captionsTracks[n])return;var T=this.captionsProperties,m=this.captionsTracks,p=this.media,b=T[n],_=b.label,a=b.languageCode,c=this.getExistingTrack(n);if(c)m[n]=c,Object(A.clearCurrentCues)(m[n]),Object(A.sendAddTrackEvent)(m[n],p);else{var r=this.createTextTrack("captions",_,a);r&&(r[n]=!0,m[n]=r)}},t.createNonNativeTrack=function(n){if(this.nonNativeCaptionsTracks[n])return;var T=this.captionsProperties[n];if(!T)return;var m=T.label,p={_id:n,label:m,kind:"captions",default:T.media?!!T.media.default:!1,closedCaptions:T.media};this.nonNativeCaptionsTracks[n]=p,this.hls.trigger(S.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[p]})},t.createTextTrack=function(n,T,m){var p=this.media;return p?p.addTextTrack(n,T,m):void 0},t.onMediaAttaching=function(n,T){this.media=T.media,this._cleanTracks()},t.onMediaDetaching=function(){var n=this.captionsTracks;Object.keys(n).forEach(function(T){Object(A.clearCurrentCues)(n[T]),delete n[T]}),this.nonNativeCaptionsTracks={}},t.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=d(),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())},t._cleanTracks=function(){var n=this.media;if(!n)return;var T=n.textTracks;if(T)for(var m=0;m<T.length;m++)Object(A.clearCurrentCues)(T[m])},t.onSubtitleTracksUpdated=function(n,T){var m=this;this.textTracks=[];var p=T.subtitleTracks||[],b=p.some(function(r){return r.textCodec===C.IMSC1_CODEC});if(this.config.enableWebVTT||b&&this.config.enableIMSC1){var _=this.tracks&&p&&this.tracks.length===p.length;if(this.tracks=p||[],this.config.renderTextTracksNatively){var a=this.media?this.media.textTracks:[];this.tracks.forEach(function(r,l){var v;if(l<a.length){for(var f=null,x=0;x<a.length;x++)if(o(a[x],r)){f=a[x];break}f&&(v=f)}v?Object(A.clearCurrentCues)(v):(v=m.createTextTrack("subtitles",r.name,r.lang),v&&(v.mode="disabled")),v&&(v.groupId=r.groupId,m.textTracks.push(v))})}else if(!_&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(r){return{label:r.name,kind:r.type.toLowerCase(),default:r.default,subtitleTrack:r}});this.hls.trigger(S.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},t.onManifestLoaded=function(n,T){var m=this;this.config.enableCEA708Captions&&T.captions&&T.captions.forEach(function(p){var b=/(?:CC|SERVICE)([1-4])/.exec(p.instreamId);if(!b)return;var _="textTrack"+b[1],a=m.captionsProperties[_];if(!a)return;a.label=p.name,p.lang&&(a.languageCode=p.lang),a.media=p})},t.onFragLoading=function(n,T){var m=this.cea608Parser1,p=this.cea608Parser2,b=this.lastSn,_=this.lastPartIndex;if(!this.enabled||!(m&&p))return;if(T.frag.type===y.PlaylistLevelType.MAIN){var a,c,r=T.frag.sn,l=(a=T==null||((c=T.part)===null||c===void 0)?void 0:c.index)!=null?a:-1;r===b+1||r===b&&l===_+1||(m.reset(),p.reset()),this.lastSn=r,this.lastPartIndex=l}},t.onFragLoaded=function(n,T){var m=T.frag,p=T.payload,b=this.initPTS,_=this.unparsedVttFrags;if(m.type===y.PlaylistLevelType.SUBTITLE)if(p.byteLength){if(!Object(U.isFiniteNumber)(b[m.cc])){_.push(T),b.length&&this.hls.trigger(S.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:m,error:new Error("Missing initial subtitle PTS")});return}var a=m.decryptdata;if(a==null||a.key==null||a.method!=="AES-128"){var c=this.tracks[m.level],r=this.vttCCs;r[m.cc]||(r[m.cc]={start:m.start,prevCC:this.prevCC,new:!0},this.prevCC=m.cc),c&&c.textCodec===C.IMSC1_CODEC?this._parseIMSC1(m,p):this._parseVTTs(m,p,r)}}else this.hls.trigger(S.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:m,error:new Error("Empty subtitle payload")})},t._parseIMSC1=function(n,T){var m=this,p=this.hls;Object(C.parseIMSC1)(T,this.initPTS[n.cc],this.timescale[n.cc],function(b){m._appendCues(b,n.level),p.trigger(S.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},function(b){h.logger.log("Failed to parse IMSC1: "+b),p.trigger(S.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:b})})},t._parseVTTs=function(n,T,m){var p=this,b=this.hls;Object(k.parseWebVTT)(T,this.initPTS[n.cc],this.timescale[n.cc],m,n.cc,n.start,function(_){p._appendCues(_,n.level),b.trigger(S.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},function(_){p._fallbackToIMSC1(n,T),h.logger.log("Failed to parse VTT cue: "+_),b.trigger(S.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:_})})},t._fallbackToIMSC1=function(n,T){var m=this,p=this.tracks[n.level];p.textCodec||Object(C.parseIMSC1)(T,this.initPTS[n.cc],this.timescale[n.cc],function(){p.textCodec=C.IMSC1_CODEC,m._parseIMSC1(n,T)},function(){p.textCodec="wvtt"})},t._appendCues=function(n,T){var m=this.hls;if(this.config.renderTextTracksNatively){var p=this.textTracks[T];if(p.mode==="disabled")return;n.forEach(function(a){return Object(A.addCueToTrack)(p,a)})}else{var b=this.tracks[T],_=b.default?"default":"subtitles"+T;m.trigger(S.Events.CUES_PARSED,{type:"subtitles",cues:n,track:_})}},t.onFragDecrypted=function(n,T){var m=T.frag;if(m.type===y.PlaylistLevelType.SUBTITLE){if(!Object(U.isFiniteNumber)(this.initPTS[m.cc])){this.unparsedVttFrags.push(T);return}this.onFragLoaded(S.Events.FRAG_LOADED,T)}},t.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},t.onFragParsingUserdata=function(n,T){var m=this.cea608Parser1,p=this.cea608Parser2;if(!this.enabled||!(m&&p))return;for(var b=0;b<T.samples.length;b++){var _=T.samples[b].bytes;if(_){var a=this.extractCea608Data(_);m.addData(T.samples[b].pts,a[0]),p.addData(T.samples[b].pts,a[1])}}},t.onBufferFlushing=function(n,T){var m=T.startOffset,p=T.endOffset,b=T.endOffsetSubtitles,_=T.type,a=this.media;if(!a||a.currentTime<p)return;if(!_||_==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(l){return Object(A.removeCuesInRange)(c[l],m,p)})}if(this.config.renderTextTracksNatively&&(m===0&&b!==void 0)){var r=this.textTracks;Object.keys(r).forEach(function(l){return Object(A.removeCuesInRange)(r[l],m,b)})}},t.extractCea608Data=function(n){for(var T=n[0]&31,m=2,p=[[],[]],b=0;b<T;b++){var _=n[m++],a=127&n[m++],c=127&n[m++],r=(4&_)!==0,l=3&_;if(a===0&&c===0)continue;r&&((l===0||l===1)&&(p[l].push(a),p[l].push(c)))}return p},s}();function o(s,t){return s&&s.label===t.name&&!(s.textTrack1||s.textTrack2)}function e(s,t,i,n){return Math.min(t,n)-Math.max(s,i)}function d(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"default",function(){return U});var U=function(){function S(N,k){this.subtle=void 0,this.aesIV=void 0,this.subtle=N,this.aesIV=k}var I=S.prototype;return I.decrypt=function(k,A){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},A,k)},S}()},"./src/crypt/aes-decryptor.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"removePadding",function(){return S}),w.d(F,"default",function(){return I});var U=w("./src/utils/typed-array.ts");function S(N){var k=N.byteLength,A=k&&new DataView(N.buffer).getUint8(k-1);return A?Object(U.sliceUint8)(N,0,k-A):N}var I=function(){function N(){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 k=N.prototype;return k.uint8ArrayToUint32Array_=function(C){for(var y=new DataView(C),h=new Uint32Array(4),u=0;u<4;u++)h[u]=y.getUint32(u*4);return h},k.initTable=function(){var C=this.sBox,y=this.invSBox,h=this.subMix,u=h[0],o=h[1],e=h[2],d=h[3],s=this.invSubMix,t=s[0],i=s[1],n=s[2],T=s[3],m=new Uint32Array(256),p=0,b=0,_=0;for(_=0;_<256;_++)_<128?m[_]=_<<1:m[_]=_<<1^283;for(_=0;_<256;_++){var a=b^b<<1^b<<2^b<<3^b<<4;a=a>>>8^a&255^99,C[p]=a,y[a]=p;var c=m[p],r=m[c],l=m[r],v=m[a]*257^a*16843008;u[p]=v<<24|v>>>8,o[p]=v<<16|v>>>16,e[p]=v<<8|v>>>24,d[p]=v,v=l*16843009^r*65537^c*257^p*16843008,t[a]=v<<24|v>>>8,i[a]=v<<16|v>>>16,n[a]=v<<8|v>>>24,T[a]=v,p?(p=c^m[m[m[l^c]]],b^=m[m[b]]):p=b=1}},k.expandKey=function(C){for(var y=this.uint8ArrayToUint32Array_(C),h=!0,u=0;u<y.length&&h;)h=y[u]===this.key[u],u++;if(h)return;this.key=y;var o=this.keySize=y.length;if(o!==4&&o!==6&&o!==8)throw new Error("Invalid aes key size="+o);var e=this.ksRows=(o+6+1)*4,d,s,t=this.keySchedule=new Uint32Array(e),i=this.invKeySchedule=new Uint32Array(e),n=this.sBox,T=this.rcon,m=this.invSubMix,p=m[0],b=m[1],_=m[2],a=m[3],c,r;for(d=0;d<e;d++){if(d<o){c=t[d]=y[d];continue}r=c,d%o===0?(r=r<<8|r>>>24,r=n[r>>>24]<<24|n[r>>>16&255]<<16|n[r>>>8&255]<<8|n[r&255],r^=T[d/o|0]<<24):o>6&&d%o===4&&(r=n[r>>>24]<<24|n[r>>>16&255]<<16|n[r>>>8&255]<<8|n[r&255]),t[d]=c=(t[d-o]^r)>>>0}for(s=0;s<e;s++)d=e-s,s&3?r=t[d]:r=t[d-4],s<4||d<=4?i[s]=r:i[s]=p[n[r>>>24]]^b[n[r>>>16&255]]^_[n[r>>>8&255]]^a[n[r&255]],i[s]=i[s]>>>0},k.networkToHostOrderSwap=function(C){return C<<24|(C&65280)<<8|(C&16711680)>>8|C>>>24},k.decrypt=function(C,y,h){for(var u=this.keySize+6,o=this.invKeySchedule,e=this.invSBox,d=this.invSubMix,s=d[0],t=d[1],i=d[2],n=d[3],T=this.uint8ArrayToUint32Array_(h),m=T[0],p=T[1],b=T[2],_=T[3],a=new Int32Array(C),c=new Int32Array(a.length),r,l,v,f,x,R,O,B,j,K,L,H,Y,ae,Z=this.networkToHostOrderSwap;y<a.length;){for(j=Z(a[y]),K=Z(a[y+1]),L=Z(a[y+2]),H=Z(a[y+3]),x=j^o[0],R=H^o[1],O=L^o[2],B=K^o[3],Y=4,ae=1;ae<u;ae++)r=s[x>>>24]^t[R>>16&255]^i[O>>8&255]^n[B&255]^o[Y],l=s[R>>>24]^t[O>>16&255]^i[B>>8&255]^n[x&255]^o[Y+1],v=s[O>>>24]^t[B>>16&255]^i[x>>8&255]^n[R&255]^o[Y+2],f=s[B>>>24]^t[x>>16&255]^i[R>>8&255]^n[O&255]^o[Y+3],x=r,R=l,O=v,B=f,Y=Y+4;r=e[x>>>24]<<24^e[R>>16&255]<<16^e[O>>8&255]<<8^e[B&255]^o[Y],l=e[R>>>24]<<24^e[O>>16&255]<<16^e[B>>8&255]<<8^e[x&255]^o[Y+1],v=e[O>>>24]<<24^e[B>>16&255]<<16^e[x>>8&255]<<8^e[R&255]^o[Y+2],f=e[B>>>24]<<24^e[x>>16&255]<<16^e[R>>8&255]<<8^e[O&255]^o[Y+3],c[y]=Z(r^m),c[y+1]=Z(f^p),c[y+2]=Z(v^b),c[y+3]=Z(l^_),m=j,p=K,b=L,_=H,y=y+4}return c.buffer},N}()},"./src/crypt/decrypter.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"default",function(){return y});var U=w("./src/crypt/aes-crypto.ts"),S=w("./src/crypt/fast-aes-key.ts"),I=w("./src/crypt/aes-decryptor.ts"),N=w("./src/utils/logger.ts"),k=w("./src/utils/mp4-tools.ts"),A=w("./src/utils/typed-array.ts"),C=16,y=function(){function h(o,e,d){var s=d===void 0?{}:d,t=s.removePKCS7Padding,i=t===void 0?!0:t;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=o,this.config=e,this.removePKCS7Padding=i,i)try{var n=self.crypto;n&&(this.subtle=n.subtle||n.webkitSubtle)}catch(T){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var u=h.prototype;return u.destroy=function(){this.observer=null},u.isSync=function(){return this.config.enableSoftwareAES},u.flush=function(){var e=this.currentResult;if(!e){this.reset();return}var d=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?Object(I.removePadding)(d):d},u.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},u.decrypt=function(e,d,s,t){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(e),d,s);var i=this.flush();i&&t(i.buffer)}else this.webCryptoDecrypt(new Uint8Array(e),d,s).then(t)},u.softwareDecrypt=function(e,d,s){var t=this.currentIV,i=this.currentResult,n=this.remainderData;this.logOnce("JS AES decrypt"),n&&(e=Object(k.appendUint8Array)(n,e),this.remainderData=null);var T=this.getValidChunk(e);if(!T.length)return null;t&&(s=t);var m=this.softwareDecrypter;m||(m=this.softwareDecrypter=new I.default),m.expandKey(d);var p=i;return this.currentResult=m.decrypt(T.buffer,0,s),this.currentIV=Object(A.sliceUint8)(T,-16).buffer,p||null},u.webCryptoDecrypt=function(e,d,s){var t=this,i=this.subtle;return(this.key!==d||!this.fastAesKey)&&(this.key=d,this.fastAesKey=new S.default(i,d)),this.fastAesKey.expandKey().then(function(n){if(!i)return Promise.reject(new Error("web crypto not initialized"));var T=new U.default(i,s);return T.decrypt(e.buffer,n)}).catch(function(n){return t.onWebCryptoError(n,e,d,s)})},u.onWebCryptoError=function(e,d,s,t){return N.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",e),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(d,s,t)},u.getValidChunk=function(e){var d=e,s=e.length-e.length%C;return s!==e.length&&(d=Object(A.sliceUint8)(e,0,s),this.remainderData=Object(A.sliceUint8)(e,s)),d},u.logOnce=function(e){if(!this.logEnabled)return;N.logger.log("[decrypter.ts]: "+e),this.logEnabled=!1},h}()},"./src/crypt/fast-aes-key.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"default",function(){return U});var U=function(){function S(N,k){this.subtle=void 0,this.key=void 0,this.subtle=N,this.key=k}var I=S.prototype;return I.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},S}()},"./src/demux/aacdemuxer.ts":function(_e,F,w){"use strict";w.r(F);var U=w("./src/demux/base-audio-demuxer.ts"),S=w("./src/demux/adts.ts"),I=w("./src/utils/logger.ts"),N=w("./src/demux/id3.ts");function k(y,h){y.prototype=Object.create(h.prototype),y.prototype.constructor=y,A(y,h)}function A(y,h){return A=Object.setPrototypeOf||function(o,e){return o.__proto__=e,o},A(y,h)}var C=function(y){k(h,y);function h(o,e){var d;return d=y.call(this)||this,d.observer=void 0,d.config=void 0,d.observer=o,d.config=e,d}var u=h.prototype;return u.resetInitSegment=function(e,d,s){y.prototype.resetInitSegment.call(this,e,d,s),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:e,duration:s,inputTimeScale:9e4,dropped:0}},h.probe=function(e){if(!e)return!1;for(var d=N.getID3Data(e,0)||[],s=d.length,t=e.length;s<t;s++)if(S.probe(e,s))return I.logger.log("ADTS sync word found !"),!0;return!1},u.canParse=function(e,d){return S.canParse(e,d)},u.appendFrame=function(e,d,s){S.initTrackConfig(e,this.observer,d,s,e.manifestCodec);var t=S.appendFrame(e,d,s,this.initPTS,this.frameIndex);if(t&&t.missing===0)return t},h}(U.default);C.minProbeByteLength=9,F.default=C},"./src/demux/adts.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"getAudioConfig",function(){return N}),w.d(F,"isHeaderPattern",function(){return k}),w.d(F,"getHeaderLength",function(){return A}),w.d(F,"getFullFrameLength",function(){return C}),w.d(F,"canGetFrameLength",function(){return y}),w.d(F,"isHeader",function(){return h}),w.d(F,"canParse",function(){return u}),w.d(F,"probe",function(){return o}),w.d(F,"initTrackConfig",function(){return e}),w.d(F,"getFrameDuration",function(){return d}),w.d(F,"parseFrameHeader",function(){return s}),w.d(F,"appendFrame",function(){return t});var U=w("./src/utils/logger.ts"),S=w("./src/errors.ts"),I=w("./src/events.ts");function N(i,n,T,m){var p,b,_,a,c=navigator.userAgent.toLowerCase(),r=m,l=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];p=((n[T+2]&192)>>>6)+1;var v=(n[T+2]&60)>>>2;if(v>l.length-1){i.trigger(I.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+v});return}return _=(n[T+2]&1)<<2,_|=(n[T+3]&192)>>>6,U.logger.log("manifest codec:"+m+", ADTS type:"+p+", samplingIndex:"+v),/firefox/i.test(c)?v>=6?(p=5,a=new Array(4),b=v-3):(p=2,a=new Array(2),b=v):c.indexOf("android")!==-1?(p=2,a=new Array(2),b=v):(p=5,a=new Array(4),m&&(m.indexOf("mp4a.40.29")!==-1||m.indexOf("mp4a.40.5")!==-1)||!m&&v>=6?b=v-3:((m&&m.indexOf("mp4a.40.2")!==-1&&(v>=6&&_===1||/vivaldi/i.test(c))||!m&&_===1)&&(p=2,a=new Array(2)),b=v)),a[0]=p<<3,a[0]|=(v&14)>>1,a[1]|=(v&1)<<7,a[1]|=_<<3,p===5&&(a[1]|=(b&14)>>1,a[2]=(b&1)<<7,a[2]|=2<<2,a[3]=0),{config:a,samplerate:l[v],channelCount:_,codec:"mp4a.40."+p,manifestCodec:r}}function k(i,n){return i[n]===255&&(i[n+1]&246)===240}function A(i,n){return i[n+1]&1?7:9}function C(i,n){return(i[n+3]&3)<<11|i[n+4]<<3|(i[n+5]&224)>>>5}function y(i,n){return n+5<i.length}function h(i,n){return n+1<i.length&&k(i,n)}function u(i,n){return y(i,n)&&k(i,n)&&C(i,n)<=i.length-n}function o(i,n){if(h(i,n)){var T=A(i,n);if(n+T>=i.length)return!1;var m=C(i,n);if(m<=T)return!1;var p=n+m;return p===i.length||h(i,p)}return!1}function e(i,n,T,m,p){if(!i.samplerate){var b=N(n,T,m,p);if(!b)return;i.config=b.config,i.samplerate=b.samplerate,i.channelCount=b.channelCount,i.codec=b.codec,i.manifestCodec=b.manifestCodec,U.logger.log("parsed codec:"+i.codec+", rate:"+b.samplerate+", channels:"+b.channelCount)}}function d(i){return 1024*9e4/i}function s(i,n,T,m,p){var b=A(i,n),_=C(i,n);if(_-=b,_>0){var a=T+m*p;return{headerLength:b,frameLength:_,stamp:a}}}function t(i,n,T,m,p){var b=d(i.samplerate),_=s(n,T,m,p,b);if(_){var a=_.frameLength,c=_.headerLength,r=_.stamp,l=c+a,v=Math.max(0,T+l-n.length),f;v?(f=new Uint8Array(l-c),f.set(n.subarray(T+c,n.length),0)):f=n.subarray(T+c,T+l);var x={unit:f,pts:r};return v||i.samples.push(x),{sample:x,length:l,missing:v}}}},"./src/demux/base-audio-demuxer.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"initPTSFn",function(){return C});var U=w("./src/polyfills/number.ts"),S=w("./src/demux/id3.ts"),I=w("./src/demux/dummy-demuxed-track.ts"),N=w("./src/utils/mp4-tools.ts"),k=w("./src/utils/typed-array.ts"),A=function(){function y(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var h=y.prototype;return h.resetInitSegment=function(o,e,d){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},h.resetTimeStamp=function(){},h.resetContiguity=function(){},h.canParse=function(o,e){return!1},h.appendFrame=function(o,e,d){},h.demux=function(o,e){this.cachedData&&(o=Object(N.appendUint8Array)(this.cachedData,o),this.cachedData=null);var d=S.getID3Data(o,0),s=d?d.length:0,t,i,n=this._audioTrack,T=this._id3Track,m=d?S.getTimeStamp(d):void 0,p=o.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=C(m,e)),d&&d.length>0&&T.samples.push({pts:this.initPTS,dts:this.initPTS,data:d}),i=this.initPTS;s<p;){if(this.canParse(o,s)){var b=this.appendFrame(n,o,s);b?(this.frameIndex++,i=b.sample.pts,s+=b.length,t=s):s=p}else S.canParse(o,s)?(d=S.getID3Data(o,s),T.samples.push({pts:i,dts:i,data:d}),s+=d.length,t=s):s++;if(s===p&&t!==p){var _=Object(k.sliceUint8)(o,t);this.cachedData?this.cachedData=Object(N.appendUint8Array)(this.cachedData,_):this.cachedData=_}}return{audioTrack:n,avcTrack:Object(I.dummyTrack)(),id3Track:T,textTrack:Object(I.dummyTrack)()}},h.demuxSampleAes=function(o,e,d){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},h.flush=function(o){var e=this.cachedData;return e&&(this.cachedData=null,this.demux(e,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(I.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(I.dummyTrack)()}},h.destroy=function(){},y}(),C=function(h,u){return Object(U.isFiniteNumber)(h)?h*90:u*9e4};F.default=A},"./src/demux/chunk-cache.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"default",function(){return U});var U=function(){function I(){this.chunks=[],this.dataLength=0}var N=I.prototype;return N.push=function(A){this.chunks.push(A),this.dataLength+=A.length},N.flush=function(){var A=this.chunks,C=this.dataLength,y;if(A.length)A.length===1?y=A[0]:y=S(A,C);else return new Uint8Array(0);return this.reset(),y},N.reset=function(){this.chunks.length=0,this.dataLength=0},I}();function S(I,N){for(var k=new Uint8Array(N),A=0,C=0;C<I.length;C++){var y=I[C];k.set(y,A),A+=y.length}return k}},"./src/demux/dummy-demuxed-track.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"dummyTrack",function(){return U});function U(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(_e,F,w){"use strict";w.r(F);var U=w("./src/utils/logger.ts"),S=function(){function I(k){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=k,this.bytesAvailable=k.byteLength,this.word=0,this.bitsAvailable=0}var N=I.prototype;return N.loadWord=function(){var A=this.data,C=this.bytesAvailable,y=A.byteLength-C,h=new Uint8Array(4),u=Math.min(4,C);if(u===0)throw new Error("no bytes available");h.set(A.subarray(y,y+u)),this.word=new DataView(h.buffer).getUint32(0),this.bitsAvailable=u*8,this.bytesAvailable-=u},N.skipBits=function(A){var C;this.bitsAvailable>A?(this.word<<=A,this.bitsAvailable-=A):(A-=this.bitsAvailable,C=A>>3,A-=C>>3,this.bytesAvailable-=C,this.loadWord(),this.word<<=A,this.bitsAvailable-=A)},N.readBits=function(A){var C=Math.min(this.bitsAvailable,A),y=this.word>>>32-C;return A>32&&U.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=C,this.bitsAvailable>0?this.word<<=C:this.bytesAvailable>0&&this.loadWord(),C=A-C,C>0&&this.bitsAvailable?y<<C|this.readBits(C):y},N.skipLZ=function(){var A;for(A=0;A<this.bitsAvailable;++A)if((this.word&2147483648>>>A)!==0)return this.word<<=A,this.bitsAvailable-=A,A;return this.loadWord(),A+this.skipLZ()},N.skipUEG=function(){this.skipBits(1+this.skipLZ())},N.skipEG=function(){this.skipBits(1+this.skipLZ())},N.readUEG=function(){var A=this.skipLZ();return this.readBits(A+1)-1},N.readEG=function(){var A=this.readUEG();return 1&A?1+A>>>1:-1*(A>>>1)},N.readBoolean=function(){return this.readBits(1)===1},N.readUByte=function(){return this.readBits(8)},N.readUShort=function(){return this.readBits(16)},N.readUInt=function(){return this.readBits(32)},N.skipScalingList=function(A){for(var C=8,y=8,h,u=0;u<A;u++)y!==0&&(h=this.readEG(),y=(C+h+256)%256),C=y===0?C:y},N.readSPS=function(){var A=0,C=0,y=0,h=0,u,o,e,d=this.readUByte.bind(this),s=this.readBits.bind(this),t=this.readUEG.bind(this),i=this.readBoolean.bind(this),n=this.skipBits.bind(this),T=this.skipEG.bind(this),m=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);d();var b=d();if(s(5),n(3),d(),m(),b===100||b===110||b===122||b===244||b===44||b===83||b===86||b===118||b===128){var _=t();if(_===3&&n(1),m(),m(),n(1),i())for(o=_!==3?8:12,e=0;e<o;e++)i()&&(e<6?p(16):p(64))}m();var a=t();if(a===0)t();else if(a===1)for(n(1),T(),T(),u=t(),e=0;e<u;e++)T();m(),n(1);var c=t(),r=t(),l=s(1);l===0&&n(1),n(1),i()&&(A=t(),C=t(),y=t(),h=t());var v=[1,1];if(i()&&i()){var f=d();switch(f){case 1:v=[1,1];break;case 2:v=[12,11];break;case 3:v=[10,11];break;case 4:v=[16,11];break;case 5:v=[40,33];break;case 6:v=[24,11];break;case 7:v=[20,11];break;case 8:v=[32,11];break;case 9:v=[80,33];break;case 10:v=[18,11];break;case 11:v=[15,11];break;case 12:v=[64,33];break;case 13:v=[160,99];break;case 14:v=[4,3];break;case 15:v=[3,2];break;case 16:v=[2,1];break;case 255:{v=[d()<<8|d(),d()<<8|d()];break}}}return{width:Math.ceil((c+1)*16-A*2-C*2),height:(2-l)*(r+1)*16-(l?2:4)*(y+h),pixelRatio:v}},N.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},I}();F.default=S},"./src/demux/id3.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"isHeader",function(){return U}),w.d(F,"isFooter",function(){return S}),w.d(F,"getID3Data",function(){return I}),w.d(F,"canParse",function(){return k}),w.d(F,"getTimeStamp",function(){return A}),w.d(F,"isTimeStampFrame",function(){return C}),w.d(F,"getID3Frames",function(){return h}),w.d(F,"decodeFrame",function(){return u}),w.d(F,"utf8ArrayToStr",function(){return t}),w.d(F,"testables",function(){return i});var U=function(p,b){return b+10<=p.length&&(p[b]===73&&p[b+1]===68&&p[b+2]===51&&(p[b+3]<255&&p[b+4]<255&&(p[b+6]<128&&p[b+7]<128&&p[b+8]<128&&p[b+9]<128)))},S=function(p,b){return b+10<=p.length&&(p[b]===51&&p[b+1]===68&&p[b+2]===73&&(p[b+3]<255&&p[b+4]<255&&(p[b+6]<128&&p[b+7]<128&&p[b+8]<128&&p[b+9]<128)))},I=function(p,b){for(var _=b,a=0;U(p,b);){a+=10;var c=N(p,b+6);a+=c,S(p,b+10)&&(a+=10),b+=a}return a>0?p.subarray(_,_+a):void 0},N=function(p,b){var _=0;return _=(p[b]&127)<<21,_|=(p[b+1]&127)<<14,_|=(p[b+2]&127)<<7,_|=p[b+3]&127,_},k=function(p,b){return U(p,b)&&N(p,b+6)+10<=p.length-b},A=function(p){for(var b=h(p),_=0;_<b.length;_++){var a=b[_];if(C(a))return s(a)}return},C=function(p){return p&&p.key==="PRIV"&&p.info==="com.apple.streaming.transportStreamTimestamp"},y=function(p){var b=String.fromCharCode(p[0],p[1],p[2],p[3]),_=N(p,4),a=10;return{type:b,size:_,data:p.subarray(a,a+_)}},h=function(p){for(var b=0,_=[];U(p,b);){var a=N(p,b+6);b+=10;for(var c=b+a;b+8<c;){var r=y(p.subarray(b)),l=u(r);l&&_.push(l),b+=r.size+10}S(p,b)&&(b+=10)}return _},u=function(p){return p.type==="PRIV"?o(p):p.type[0]==="W"?d(p):e(p)},o=function(p){if(p.size<2)return;var b=t(p.data,!0),_=new Uint8Array(p.data.subarray(b.length+1));return{key:p.type,info:b,data:_.buffer}},e=function(p){if(p.size<2)return;if(p.type==="TXXX"){var b=1,_=t(p.data.subarray(b),!0);b+=_.length+1;var a=t(p.data.subarray(b));return{key:p.type,info:_,data:a}}var c=t(p.data.subarray(1));return{key:p.type,data:c}},d=function(p){if(p.type==="WXXX"){if(p.size<2)return;var b=1,_=t(p.data.subarray(b),!0);b+=_.length+1;var a=t(p.data.subarray(b));return{key:p.type,info:_,data:a}}var c=t(p.data);return{key:p.type,data:c}},s=function(p){if(p.data.byteLength===8){var b=new Uint8Array(p.data),_=b[3]&1,a=(b[4]<<23)+(b[5]<<15)+(b[6]<<7)+b[7];return a/=45,_&&(a+=4772185884e-2),Math.round(a)}return},t=function(p,b){b===void 0&&(b=!1);var _=T();if(_){var a=_.decode(p);if(b){var c=a.indexOf("\0");return c!==-1?a.substring(0,c):a}return a.replace(/\0/g,"")}for(var r=p.length,l,v,f,x="",R=0;R<r;){if(l=p[R++],l===0&&b)return x;if(l===0||l===3)continue;switch(l>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:x+=String.fromCharCode(l);break;case 12:case 13:v=p[R++],x+=String.fromCharCode((l&31)<<6|v&63);break;case 14:v=p[R++],f=p[R++],x+=String.fromCharCode((l&15)<<12|(v&63)<<6|(f&63)<<0);break;default:}}return x},i={decodeTextFrame:e},n;function T(){return!n&&typeof self.TextDecoder!="undefined"&&(n=new self.TextDecoder("utf-8")),n}},"./src/demux/mp3demuxer.ts":function(_e,F,w){"use strict";w.r(F);var U=w("./src/demux/base-audio-demuxer.ts"),S=w("./src/demux/id3.ts"),I=w("./src/utils/logger.ts"),N=w("./src/demux/mpegaudio.ts");function k(y,h){y.prototype=Object.create(h.prototype),y.prototype.constructor=y,A(y,h)}function A(y,h){return A=Object.setPrototypeOf||function(o,e){return o.__proto__=e,o},A(y,h)}var C=function(y){k(h,y);function h(){return y.apply(this,arguments)||this}var u=h.prototype;return u.resetInitSegment=function(e,d,s){y.prototype.resetInitSegment.call(this,e,d,s),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:e,duration:s,inputTimeScale:9e4,dropped:0}},h.probe=function(e){if(!e)return!1;for(var d=S.getID3Data(e,0)||[],s=d.length,t=e.length;s<t;s++)if(N.probe(e,s))return I.logger.log("MPEG Audio sync word found !"),!0;return!1},u.canParse=function(e,d){return N.canParse(e,d)},u.appendFrame=function(e,d,s){return this.initPTS===null?void 0:N.appendFrame(e,d,s,this.initPTS,this.frameIndex)},h}(U.default);C.minProbeByteLength=4,F.default=C},"./src/demux/mp4demuxer.ts":function(_e,F,w){"use strict";w.r(F);var U=w("./src/utils/mp4-tools.ts"),S=w("./src/demux/dummy-demuxed-track.ts"),I=function(){function N(A,C){this.remainderData=null,this.config=void 0,this.config=C}var k=N.prototype;return k.resetTimeStamp=function(){},k.resetInitSegment=function(){},k.resetContiguity=function(){},N.probe=function(C){return Object(U.findBox)({data:C,start:0,end:Math.min(C.length,16384)},["moof"]).length>0},k.demux=function(C){var y=C,h=Object(S.dummyTrack)();if(this.config.progressive){this.remainderData&&(y=Object(U.appendUint8Array)(this.remainderData,C));var u=Object(U.segmentValidRange)(y);this.remainderData=u.remainder,h.samples=u.valid||new Uint8Array}else h.samples=y;return{audioTrack:Object(S.dummyTrack)(),avcTrack:h,id3Track:Object(S.dummyTrack)(),textTrack:Object(S.dummyTrack)()}},k.flush=function(){var C=Object(S.dummyTrack)();return C.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(S.dummyTrack)(),avcTrack:C,id3Track:Object(S.dummyTrack)(),textTrack:Object(S.dummyTrack)()}},k.demuxSampleAes=function(C,y,h){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},k.destroy=function(){},N}();I.minProbeByteLength=1024,F.default=I},"./src/demux/mpegaudio.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"appendFrame",function(){return A}),w.d(F,"parseHeader",function(){return C}),w.d(F,"isHeaderPattern",function(){return y}),w.d(F,"isHeader",function(){return h}),w.d(F,"canParse",function(){return u}),w.d(F,"probe",function(){return o});var U=null,S=[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],N=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],k=[0,1,1,4];function A(e,d,s,t,i){if(s+24>d.length)return;var n=C(d,s);if(n&&s+n.frameLength<=d.length){var T=n.samplesPerFrame*9e4/n.sampleRate,m=t+i*T,p={unit:d.subarray(s,s+n.frameLength),pts:m,dts:m};return e.config=[],e.channelCount=n.channelCount,e.samplerate=n.sampleRate,e.samples.push(p),{sample:p,length:n.frameLength,missing:0}}}function C(e,d){var s=e[d+1]>>3&3,t=e[d+1]>>1&3,i=e[d+2]>>4&15,n=e[d+2]>>2&3;if(s!==1&&i!==0&&i!==15&&n!==3){var T=e[d+2]>>1&1,m=e[d+3]>>6,p=s===3?3-t:t===3?3:4,b=S[p*14+i-1]*1e3,_=s===3?0:s===2?1:2,a=I[_*3+n],c=m===3?1:2,r=N[s][t],l=k[t],v=r*8*l,f=Math.floor(r*b/a+T)*l;if(U===null){var x=navigator.userAgent||"",R=x.match(/Chrome\/(\d+)/i);U=R?parseInt(R[1]):0}var O=!!U&&U<=87;return O&&t===2&&b>=224e3&&m===0&&(e[d+3]=e[d+3]|128),{sampleRate:a,channelCount:c,frameLength:f,samplesPerFrame:v}}}function y(e,d){return e[d]===255&&(e[d+1]&224)===224&&(e[d+1]&6)!==0}function h(e,d){return d+1<e.length&&y(e,d)}function u(e,d){var s=4;return y(e,d)&&s<=e.length-d}function o(e,d){if(d+1<e.length&&y(e,d)){var s=4,t=C(e,d),i=s;t!=null&&t.frameLength&&(i=t.frameLength);var n=d+i;return n===e.length||h(e,n)}return!1}},"./src/demux/sample-aes.ts":function(_e,F,w){"use strict";w.r(F);var U=w("./src/crypt/decrypter.ts"),S=w("./src/demux/tsdemuxer.ts"),I=function(){function N(A,C,y){this.keyData=void 0,this.decrypter=void 0,this.keyData=y,this.decrypter=new U.default(A,C,{removePKCS7Padding:!1})}var k=N.prototype;return k.decryptBuffer=function(C,y){this.decrypter.decrypt(C,this.keyData.key.buffer,this.keyData.iv.buffer,y)},k.decryptAacSample=function(C,y,h,u){var o=C[y].unit,e=o.subarray(16,o.length-o.length%16),d=e.buffer.slice(e.byteOffset,e.byteOffset+e.length),s=this;this.decryptBuffer(d,function(t){var i=new Uint8Array(t);o.set(i,16),u||s.decryptAacSamples(C,y+1,h)})},k.decryptAacSamples=function(C,y,h){for(;;y++){if(y>=C.length){h();return}if(C[y].unit.length<32)continue;var u=this.decrypter.isSync();if(this.decryptAacSample(C,y,h,u),!u)return}},k.getAvcEncryptedData=function(C){for(var y=Math.floor((C.length-48)/160)*16+16,h=new Int8Array(y),u=0,o=32;o<=C.length-16;o+=160,u+=16)h.set(C.subarray(o,o+16),u);return h},k.getAvcDecryptedUnit=function(C,y){for(var h=new Uint8Array(y),u=0,o=32;o<=C.length-16;o+=160,u+=16)C.set(h.subarray(u,u+16),o);return C},k.decryptAvcSample=function(C,y,h,u,o,e){var d=Object(S.discardEPB)(o.data),s=this.getAvcEncryptedData(d),t=this;this.decryptBuffer(s.buffer,function(i){o.data=t.getAvcDecryptedUnit(d,i),e||t.decryptAvcSamples(C,y,h+1,u)})},k.decryptAvcSamples=function(C,y,h,u){if(C instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;y++,h=0){if(y>=C.length){u();return}for(var o=C[y].units;!(h>=o.length);h++){var e=o[h];if(e.data.length<=48||e.type!==1&&e.type!==5)continue;var d=this.decrypter.isSync();if(this.decryptAvcSample(C,y,h,u,e,d),!d)return}}},N}();F.default=I},"./src/demux/transmuxer-interface.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"default",function(){return o});var U=w("./node_modules/webworkify-webpack/index.js"),S=w.n(U),I=w("./src/events.ts"),N=w("./src/demux/transmuxer.ts"),k=w("./src/utils/logger.ts"),A=w("./src/errors.ts"),C=w("./src/utils/mediasource-helper.ts"),y=w("./node_modules/eventemitter3/index.js"),h=w.n(y),u=Object(C.getMediaSource)()||{isTypeSupported:function(){return!1}},o=function(){function e(s,t,i,n){var T=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=s,this.id=t,this.onTransmuxComplete=i,this.onFlush=n;var m=s.config,p=function(r,l){l=l||{},l.frag=T.frag,l.id=T.id,s.trigger(r,l)};this.observer=new y.EventEmitter,this.observer.on(I.Events.FRAG_DECRYPTED,p),this.observer.on(I.Events.ERROR,p);var b={mp4:u.isTypeSupported("video/mp4"),mpeg:u.isTypeSupported("audio/mpeg"),mp3:u.isTypeSupported('audio/mp4; codecs="mp3"')},_=navigator.vendor;if(m.enableWorker&&typeof Worker!="undefined"){k.logger.log("demuxing in webworker");var a;try{a=this.worker=U("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),a.addEventListener("message",this.onwmsg),a.onerror=function(c){s.trigger(I.Events.ERROR,{type:A.ErrorTypes.OTHER_ERROR,details:A.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},a.postMessage({cmd:"init",typeSupported:b,vendor:_,id:t,config:JSON.stringify(m)})}catch(c){k.logger.warn("Error in worker:",c),k.logger.error("Error while initializing DemuxerWorker, fallback to inline"),a&&self.URL.revokeObjectURL(a.objectURL),this.transmuxer=new N.default(this.observer,b,m,_,t),this.worker=null}}else this.transmuxer=new N.default(this.observer,b,m,_,t)}var d=e.prototype;return d.destroy=function(){var t=this.worker;if(t)t.removeEventListener("message",this.onwmsg),t.terminate(),this.worker=null;else{var i=this.transmuxer;i&&(i.destroy(),this.transmuxer=null)}var n=this.observer;n&&n.removeAllListeners(),this.observer=null},d.push=function(t,i,n,T,m,p,b,_,a,c){var r=this;a.transmuxing.start=self.performance.now();var l=this.transmuxer,v=this.worker,f=p?p.start:m.start,x=m.decryptdata,R=this.frag,O=!(R&&m.cc===R.cc),B=!(R&&a.level===R.level),j=R?a.sn-R.sn:-1,K=this.part?a.part-this.part.index:1,L=!B&&(j===1||j===0&&K===1),H=self.performance.now();(B||j||m.stats.parsing.start===0)&&(m.stats.parsing.start=H),p&&(K||!L)&&(p.stats.parsing.start=H);var Y=new N.TransmuxState(O,L,_,B,f);if(!L||O){k.logger.log("[transmuxer-interface, "+m.type+"]: Starting new transmux session for sn: "+a.sn+" p: "+a.part+" level: "+a.level+" id: "+a.id+`
discontinuity: `+O+`
trackSwitch: `+B+`
contiguous: `+L+`
accurateTimeOffset: `+_+`
timeOffset: `+f);var ae=new N.TransmuxConfig(n,T,i,b,c);this.configureTransmuxer(ae)}if(this.frag=m,this.part=p,v)v.postMessage({cmd:"demux",data:t,decryptdata:x,chunkMeta:a,state:Y},t instanceof ArrayBuffer?[t]:[]);else if(l){var Z=l.push(t,x,a,Y);Object(N.isPromise)(Z)?Z.then(function(ce){r.handleTransmuxComplete(ce)}):this.handleTransmuxComplete(Z)}},d.flush=function(t){var i=this;t.transmuxing.start=self.performance.now();var n=this.transmuxer,T=this.worker;if(T)T.postMessage({cmd:"flush",chunkMeta:t});else if(n){var m=n.flush(t);Object(N.isPromise)(m)?m.then(function(p){i.handleFlushResult(p,t)}):this.handleFlushResult(m,t)}},d.handleFlushResult=function(t,i){var n=this;t.forEach(function(T){n.handleTransmuxComplete(T)}),this.onFlush(i)},d.onWorkerMessage=function(t){var i=t.data,n=this.hls;switch(i.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(i.data);break}case"flush":{this.onFlush(i.data);break}default:{i.data=i.data||{},i.data.frag=this.frag,i.data.id=this.id,n.trigger(i.event,i.data);break}}},d.configureTransmuxer=function(t){var i=this.worker,n=this.transmuxer;i?i.postMessage({cmd:"configure",config:t}):n&&n.configure(t)},d.handleTransmuxComplete=function(t){t.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(t)},e}()},"./src/demux/transmuxer-worker.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"default",function(){return A});var U=w("./src/demux/transmuxer.ts"),S=w("./src/events.ts"),I=w("./src/utils/logger.ts"),N=w("./node_modules/eventemitter3/index.js"),k=w.n(N);function A(o){var e=new N.EventEmitter,d=function(t,i){o.postMessage({event:t,data:i})};e.on(S.Events.FRAG_DECRYPTED,d),e.on(S.Events.ERROR,d),o.addEventListener("message",function(s){var t=s.data;switch(t.cmd){case"init":{var i=JSON.parse(t.config);o.transmuxer=new U.default(e,t.typeSupported,i,t.vendor,t.id),Object(I.enableLogs)(i.debug),d("init",null);break}case"configure":{o.transmuxer.configure(t.config);break}case"demux":{var n=o.transmuxer.push(t.data,t.decryptdata,t.chunkMeta,t.state);Object(U.isPromise)(n)?n.then(function(p){C(o,p)}):C(o,n);break}case"flush":{var T=t.chunkMeta,m=o.transmuxer.flush(T);Object(U.isPromise)(m)?m.then(function(p){h(o,p,T)}):h(o,m,T);break}default:break}})}function C(o,e){if(u(e.remuxResult))return;var d=[],s=e.remuxResult,t=s.audio,i=s.video;t&&y(d,t),i&&y(d,i),o.postMessage({event:"transmuxComplete",data:e},d)}function y(o,e){e.data1&&o.push(e.data1.buffer),e.data2&&o.push(e.data2.buffer)}function h(o,e,d){e.forEach(function(s){C(o,s)}),o.postMessage({event:"flush",data:d})}function u(o){return!o.audio&&!o.video&&!o.text&&!o.id3&&!o.initSegment}},"./src/demux/transmuxer.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"default",function(){return i}),w.d(F,"isPromise",function(){return m}),w.d(F,"TransmuxConfig",function(){return p}),w.d(F,"TransmuxState",function(){return b});var U=w("./src/events.ts"),S=w("./src/errors.ts"),I=w("./src/crypt/decrypter.ts"),N=w("./src/demux/aacdemuxer.ts"),k=w("./src/demux/mp4demuxer.ts"),A=w("./src/demux/tsdemuxer.ts"),C=w("./src/demux/mp3demuxer.ts"),y=w("./src/remux/mp4-remuxer.ts"),h=w("./src/remux/passthrough-remuxer.ts"),u=w("./src/demux/chunk-cache.ts"),o=w("./src/utils/mp4-tools.ts"),e=w("./src/utils/logger.ts"),d;try{d=self.performance.now.bind(self.performance)}catch(_){e.logger.debug("Unable to use Performance API on this environment"),d=self.Date.now}var s=[{demux:A.default,remux:y.default},{demux:k.default,remux:h.default},{demux:N.default,remux:y.default},{demux:C.default,remux:y.default}],t=1024;s.forEach(function(_){var a=_.demux;t=Math.max(t,a.minProbeByteLength)});var i=function(){function _(c,r,l,v,f){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 u.default,this.observer=c,this.typeSupported=r,this.config=l,this.vendor=v,this.id=f}var a=_.prototype;return a.configure=function(r){this.transmuxConfig=r,this.decrypter&&this.decrypter.reset()},a.push=function(r,l,v,f){var x=this,R=v.transmuxing;R.executeStart=d();var O=new Uint8Array(r),B=this.cache,j=this.config,K=this.currentTransmuxState,L=this.transmuxConfig;f&&(this.currentTransmuxState=f);var H=n(O,l);if(H&&H.method==="AES-128"){var Y=this.getDecrypter();if(j.enableSoftwareAES){var ae=Y.softwareDecrypt(O,H.key.buffer,H.iv.buffer);if(!ae)return R.executeEnd=d(),T(v);O=new Uint8Array(ae)}else return this.decryptionPromise=Y.webCryptoDecrypt(O,H.key.buffer,H.iv.buffer).then(function(Oe){var Ie=x.push(Oe,null,v);return x.decryptionPromise=null,Ie}),this.decryptionPromise}var Z=f||K,ce=Z.contiguous,de=Z.discontinuity,q=Z.trackSwitch,te=Z.accurateTimeOffset,he=Z.timeOffset,J=L.audioCodec,X=L.videoCodec,ye=L.defaultInitPts,we=L.duration,Le=L.initSegmentData;if((de||q)&&this.resetInitSegment(Le,J,X,we),de&&this.resetInitialTimestamp(ye),ce||this.resetContiguity(),this.needsProbing(O,de,q)){if(B.dataLength){var xe=B.flush();O=Object(o.appendUint8Array)(xe,O)}this.configureTransmuxer(O,L)}var Re=this.transmux(O,H,he,te,v),Te=this.currentTransmuxState;return Te.contiguous=!0,Te.discontinuity=!1,Te.trackSwitch=!1,R.executeEnd=d(),Re},a.flush=function(r){var l=this,v=r.transmuxing;v.executeStart=d();var f=this.decrypter,x=this.cache,R=this.currentTransmuxState,O=this.decryptionPromise;if(O)return O.then(function(){return l.flush(r)});var B=[],j=R.timeOffset;if(f){var K=f.flush();K&&B.push(this.push(K,null,r))}var L=x.dataLength;x.reset();var H=this.demuxer,Y=this.remuxer;if(!H||!Y)return L>=t&&this.observer.emit(U.Events.ERROR,U.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),v.executeEnd=d(),[T(r)];var ae=H.flush(j);return m(ae)?ae.then(function(Z){return l.flushRemux(B,Z,r),B}):(this.flushRemux(B,ae,r),B)},a.flushRemux=function(r,l,v){var f=l.audioTrack,x=l.avcTrack,R=l.id3Track,O=l.textTrack,B=this.currentTransmuxState,j=B.accurateTimeOffset,K=B.timeOffset;e.logger.log("[transmuxer.ts]: Flushed fragment "+v.sn+(v.part>-1?" p: "+v.part:"")+" of level "+v.level);var L=this.remuxer.remux(f,x,R,O,K,j,!0,this.id);r.push({remuxResult:L,chunkMeta:v}),v.transmuxing.executeEnd=d()},a.resetInitialTimestamp=function(r){var l=this.demuxer,v=this.remuxer;if(!l||!v)return;l.resetTimeStamp(r),v.resetTimeStamp(r)},a.resetContiguity=function(){var r=this.demuxer,l=this.remuxer;if(!r||!l)return;r.resetContiguity(),l.resetNextTimestamp()},a.resetInitSegment=function(r,l,v,f){var x=this.demuxer,R=this.remuxer;if(!x||!R)return;x.resetInitSegment(l,v,f),R.resetInitSegment(r,l,v)},a.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},a.transmux=function(r,l,v,f,x){var R;return l&&l.method==="SAMPLE-AES"?R=this.transmuxSampleAes(r,l,v,f,x):R=this.transmuxUnencrypted(r,v,f,x),R},a.transmuxUnencrypted=function(r,l,v,f){var x=this.demuxer.demux(r,l,!1,!this.config.progressive),R=x.audioTrack,O=x.avcTrack,B=x.id3Track,j=x.textTrack,K=this.remuxer.remux(R,O,B,j,l,v,!1,this.id);return{remuxResult:K,chunkMeta:f}},a.transmuxSampleAes=function(r,l,v,f,x){var R=this;return this.demuxer.demuxSampleAes(r,l,v).then(function(O){var B=R.remuxer.remux(O.audioTrack,O.avcTrack,O.id3Track,O.textTrack,v,f,!1,R.id);return{remuxResult:B,chunkMeta:x}})},a.configureTransmuxer=function(r,l){for(var v=this.config,f=this.observer,x=this.typeSupported,R=this.vendor,O=l.audioCodec,B=l.defaultInitPts,j=l.duration,K=l.initSegmentData,L=l.videoCodec,H,Y=0,ae=s.length;Y<ae;Y++)if(s[Y].demux.probe(r)){H=s[Y];break}H||(e.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),H={demux:k.default,remux:h.default});var Z=this.demuxer,ce=this.remuxer,de=H.remux,q=H.demux;(!ce||!(ce instanceof de))&&(this.remuxer=new de(f,v,x,R)),(!Z||!(Z instanceof q))&&(this.demuxer=new q(f,v,x),this.probe=q.probe),this.resetInitSegment(K,O,L,j),this.resetInitialTimestamp(B)},a.needsProbing=function(r,l,v){return!this.demuxer||!this.remuxer||l||v},a.getDecrypter=function(){var r=this.decrypter;return r||(r=this.decrypter=new I.default(this.observer,this.config)),r},_}();function n(_,a){var c=null;return _.byteLength>0&&a!=null&&a.key!=null&&a.iv!==null&&a.method!=null&&(c=a),c}var T=function(a){return{remuxResult:{},chunkMeta:a}};function m(_){return"then"in _&&_.then instanceof Function}var p=function(a,c,r,l,v){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=a,this.videoCodec=c,this.initSegmentData=r,this.duration=l,this.defaultInitPts=v},b=function(a,c,r,l,v){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=a,this.contiguous=c,this.accurateTimeOffset=r,this.trackSwitch=l,this.timeOffset=v}},"./src/demux/tsdemuxer.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"discardEPB",function(){return T});var U=w("./src/demux/adts.ts"),S=w("./src/demux/mpegaudio.ts"),I=w("./src/demux/exp-golomb.ts"),N=w("./src/demux/id3.ts"),k=w("./src/demux/sample-aes.ts"),A=w("./src/events.ts"),C=w("./src/utils/mp4-tools.ts"),y=w("./src/utils/logger.ts"),h=w("./src/errors.ts"),u={video:1,audio:2,id3:3,text:4},o=function(){function m(b,_,a){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=b,this.config=_,this.typeSupported=a}m.probe=function(_){var a=m.syncOffset(_);return a<0?!1:(a&&y.logger.warn("MPEG2-TS detected but first sync word found @ offset "+a+", junk ahead ?"),!0)},m.syncOffset=function(_){for(var a=Math.min(1e3,_.length-3*188),c=0;c<a;){if(_[c]===71&&_[c+188]===71&&_[c+2*188]===71)return c;c++}return-1},m.createTrack=function(_,a){return{container:_==="video"||_==="audio"?"video/mp2t":void 0,type:_,id:u[_],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:_==="audio"?a:void 0}};var p=m.prototype;return p.resetInitSegment=function(_,a,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=m.createTrack("video",c),this._audioTrack=m.createTrack("audio",c),this._id3Track=m.createTrack("id3",c),this._txtTrack=m.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=_,this.videoCodec=a,this._duration=c},p.resetTimeStamp=function(){},p.resetContiguity=function(){var _=this._audioTrack,a=this._avcTrack,c=this._id3Track;_&&(_.pesData=null),a&&(a.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},p.demux=function(_,a,c,r){c===void 0&&(c=!1),r===void 0&&(r=!1),c||(this.sampleAes=null);var l,v=this._avcTrack,f=this._audioTrack,x=this._id3Track,R=v.pid,O=v.pesData,B=f.pid,j=x.pid,K=f.pesData,L=x.pesData,H=!1,Y=this.pmtParsed,ae=this._pmtId,Z=_.length;if(this.remainderData&&(_=Object(C.appendUint8Array)(this.remainderData,_),Z=_.length,this.remainderData=null),Z<188&&!r)return this.remainderData=_,{audioTrack:f,avcTrack:v,id3Track:x,textTrack:this._txtTrack};var ce=Math.max(0,m.syncOffset(_));Z-=(Z+ce)%188,Z<_.byteLength&&!r&&(this.remainderData=new Uint8Array(_.buffer,Z,_.buffer.byteLength-Z));for(var de=ce;de<Z;de+=188)if(_[de]===71){var q=!!(_[de+1]&64),te=((_[de+1]&31)<<8)+_[de+2],he=(_[de+3]&48)>>4,J=void 0;if(he>1){if(J=de+5+_[de+4],J===de+188)continue}else J=de+4;switch(te){case R:q&&(O&&(l=t(O))&&this.parseAVCPES(l,!1),O={data:[],size:0}),O&&(O.data.push(_.subarray(J,de+188)),O.size+=de+188-J);break;case B:q&&(K&&(l=t(K))&&(f.isAAC?this.parseAACPES(l):this.parseMPEGPES(l)),K={data:[],size:0}),K&&(K.data.push(_.subarray(J,de+188)),K.size+=de+188-J);break;case j:q&&(L&&(l=t(L))&&this.parseID3PES(l),L={data:[],size:0}),L&&(L.data.push(_.subarray(J,de+188)),L.size+=de+188-J);break;case 0:q&&(J+=_[J]+1),ae=this._pmtId=d(_,J);break;case ae:{q&&(J+=_[J]+1);var X=s(_,J,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);R=X.avc,R>0&&(v.pid=R),B=X.audio,B>0&&(f.pid=B,f.isAAC=X.isAAC),j=X.id3,j>0&&(x.pid=j),H&&!Y&&(y.logger.log("reparse from beginning"),H=!1,de=ce-188),Y=this.pmtParsed=!0;break}case 17:case 8191:break;default:H=!0;break}}else this.observer.emit(A.Events.ERROR,A.Events.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});v.pesData=O,f.pesData=K,x.pesData=L;var ye={audioTrack:f,avcTrack:v,id3Track:x,textTrack:this._txtTrack};return r&&this.extractRemainingSamples(ye),ye},p.flush=function(){var _=this.remainderData;this.remainderData=null;var a;return _?a=this.demux(_,-1,!1,!0):a={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(a),this.sampleAes?this.decrypt(a,this.sampleAes):a},p.extractRemainingSamples=function(_){var a=_.audioTrack,c=_.avcTrack,r=_.id3Track,l=c.pesData,v=a.pesData,f=r.pesData,x;l&&(x=t(l))?(this.parseAVCPES(x,!0),c.pesData=null):c.pesData=l,v&&(x=t(v))?(a.isAAC?this.parseAACPES(x):this.parseMPEGPES(x),a.pesData=null):(v!=null&&v.size&&y.logger.log("last AAC PES packet truncated,might overlap between fragments"),a.pesData=v),f&&(x=t(f))?(this.parseID3PES(x),r.pesData=null):r.pesData=f},p.demuxSampleAes=function(_,a,c){var r=this.demux(_,c,!0,!this.config.progressive),l=this.sampleAes=new k.default(this.observer,this.config,a);return this.decrypt(r,l)},p.decrypt=function(_,a){return new Promise(function(c){var r=_.audioTrack,l=_.avcTrack;r.samples&&r.isAAC?a.decryptAacSamples(r.samples,0,function(){l.samples?a.decryptAvcSamples(l.samples,0,0,function(){c(_)}):c(_)}):l.samples&&a.decryptAvcSamples(l.samples,0,0,function(){c(_)})})},p.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},p.parseAVCPES=function(_,a){var c=this,r=this._avcTrack,l=this.parseAVCNALu(_.data),v=!1,f=this.avcSample,x,R=!1;_.data=null,f&&l.length&&!r.audFound&&(i(f,r),f=this.avcSample=e(!1,_.pts,_.dts,"")),l.forEach(function(O){switch(O.type){case 1:{x=!0,f||(f=c.avcSample=e(!0,_.pts,_.dts,"")),v&&(f.debug+="NDR "),f.frame=!0;var B=O.data;if(R&&B.length>4){var j=new I.default(B).readSliceType();(j===2||j===4||j===7||j===9)&&(f.key=!0)}break}case 5:x=!0,f||(f=c.avcSample=e(!0,_.pts,_.dts,"")),v&&(f.debug+="IDR "),f.key=!0,f.frame=!0;break;case 6:{x=!0,v&&f&&(f.debug+="SEI ");var K=new I.default(T(O.data));K.readUByte();for(var L=0,H=0,Y=!1,ae=0;!Y&&K.bytesAvailable>1;){L=0;do ae=K.readUByte(),L+=ae;while(ae===255);H=0;do ae=K.readUByte(),H+=ae;while(ae===255);if(L===4&&K.bytesAvailable!==0){Y=!0;var Z=K.readUByte();if(Z===181){var ce=K.readUShort();if(ce===49){var de=K.readUInt();if(de===1195456820){var q=K.readUByte();if(q===3){for(var te=K.readUByte(),he=K.readUByte(),J=31&te,X=[te,he],ye=0;ye<J;ye++)X.push(K.readUByte()),X.push(K.readUByte()),X.push(K.readUByte());n(c._txtTrack.samples,{type:3,pts:_.pts,bytes:X})}}}}}else if(L===5&&K.bytesAvailable!==0){if(Y=!0,H>16){for(var we=[],Le=0;Le<16;Le++)we.push(K.readUByte().toString(16)),(Le===3||Le===5||Le===7||Le===9)&&we.push("-");for(var xe=H-16,Re=new Uint8Array(xe),Te=0;Te<xe;Te++)Re[Te]=K.readUByte();n(c._txtTrack.samples,{pts:_.pts,payloadType:L,uuid:we.join(""),userData:Object(N.utf8ArrayToStr)(Re),userDataBytes:Re})}}else if(H<K.bytesAvailable)for(var Oe=0;Oe<H;Oe++)K.readUByte()}break}case 7:if(x=!0,R=!0,v&&f&&(f.debug+="SPS "),!r.sps){var Ie=new I.default(O.data),Me=Ie.readSPS();r.width=Me.width,r.height=Me.height,r.pixelRatio=Me.pixelRatio,r.sps=[O.data],r.duration=c._duration;for(var Ne=O.data.subarray(1,4),Be="avc1.",Pe=0;Pe<3;Pe++){var Ye=Ne[Pe].toString(16);Ye.length<2&&(Ye="0"+Ye),Be+=Ye}r.codec=Be}break;case 8:x=!0,v&&f&&(f.debug+="PPS "),r.pps||(r.pps=[O.data]);break;case 9:x=!1,r.audFound=!0,f&&i(f,r),f=c.avcSample=e(!1,_.pts,_.dts,v?"AUD ":"");break;case 12:x=!1;break;default:x=!1,f&&(f.debug+="unknown NAL "+O.type+" ");break}if(f&&x){var Ke=f.units;Ke.push(O)}}),a&&f&&(i(f,r),this.avcSample=null)},p.getLastNalUnit=function(){var _,a=this.avcSample,c;if(!a||a.units.length===0){var r=this._avcTrack.samples;a=r[r.length-1]}if((_=a)!==null&&_!==void 0&&_.units){var l=a.units;c=l[l.length-1]}return c},p.parseAVCNALu=function(_){var a=_.byteLength,c=this._avcTrack,r=c.naluState||0,l=r,v=[],f=0,x,R,O,B=-1,j=0;for(r===-1&&(B=0,j=_[0]&31,r=0,f=1);f<a;){if(x=_[f++],!r){r=x?0:1;continue}if(r===1){r=x?0:2;continue}if(!x)r=3;else if(x===1){if(B>=0){var K={data:_.subarray(B,f-r-1),type:j};v.push(K)}else{var L=this.getLastNalUnit();if(L&&(l&&f<=4-l&&(L.state&&(L.data=L.data.subarray(0,L.data.byteLength-l))),R=f-r-1,R>0)){var H=new Uint8Array(L.data.byteLength+R);H.set(L.data,0),H.set(_.subarray(0,R),L.data.byteLength),L.data=H,L.state=0}}f<a?(O=_[f]&31,B=f,j=O,r=0):r=-1}else r=0}if(B>=0&&r>=0){var Y={data:_.subarray(B,a),type:j,state:r};v.push(Y)}if(v.length===0){var ae=this.getLastNalUnit();if(ae){var Z=new Uint8Array(ae.data.byteLength+_.byteLength);Z.set(ae.data,0),Z.set(_,ae.data.byteLength),ae.data=Z}}return c.naluState=r,v},p.parseAACPES=function(_){var a=0,c=this._audioTrack,r=this.aacOverFlow,l=_.data;if(r){this.aacOverFlow=null;var v=r.sample.unit.byteLength,f=Math.min(r.missing,v),x=v-f;r.sample.unit.set(l.subarray(0,f),x),c.samples.push(r.sample),a=r.missing}var R,O;for(R=a,O=l.length;R<O-1&&!U.isHeader(l,R);R++);if(R!==a){var B,j;if(R<O-1?(B="AAC PES did not start with ADTS header,offset:"+R,j=!1):(B="no ADTS header found in AAC PES",j=!0),y.logger.warn("parsing error:"+B),this.observer.emit(A.Events.ERROR,A.Events.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.FRAG_PARSING_ERROR,fatal:j,reason:B}),j)return}U.initTrackConfig(c,this.observer,l,R,this.audioCodec);var K;if(_.pts!==void 0)K=_.pts;else if(r){var L=U.getFrameDuration(c.samplerate);K=r.sample.pts+L}else{y.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var H=0;R<O;)if(U.isHeader(l,R)){if(R+5<O){var Y=U.appendFrame(c,l,R,K,H);if(Y)if(Y.missing)this.aacOverFlow=Y;else{R+=Y.length,H++;continue}}break}else R++},p.parseMPEGPES=function(_){var a=_.data,c=a.length,r=0,l=0,v=_.pts;if(v===void 0){y.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;l<c;)if(S.isHeader(a,l)){var f=S.appendFrame(this._audioTrack,a,l,v,r);if(f)l+=f.length,r++;else break}else l++},p.parseID3PES=function(_){if(_.pts===void 0){y.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(_)},m}();o.minProbeByteLength=188;function e(m,p,b,_){return{key:m,frame:!1,pts:p,dts:b,units:[],debug:_,length:0}}function d(m,p){return(m[p+10]&31)<<8|m[p+11]}function s(m,p,b,_){var a={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(m[p+1]&15)<<8|m[p+2],r=p+3+c-4,l=(m[p+10]&15)<<8|m[p+11];for(p+=12+l;p<r;){var v=(m[p+1]&31)<<8|m[p+2];switch(m[p]){case 207:if(!_){y.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:a.audio===-1&&(a.audio=v);break;case 21:a.id3===-1&&(a.id3=v);break;case 219:if(!_){y.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:a.avc===-1&&(a.avc=v);break;case 3:case 4:b?a.audio===-1&&(a.audio=v,a.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+=((m[p+3]&15)<<8|m[p+4])+5}return a}function t(m){var p=0,b,_,a,c,r,l=m.data;if(!m||m.size===0)return null;for(;l[0].length<19&&l.length>1;){var v=new Uint8Array(l[0].length+l[1].length);v.set(l[0]),v.set(l[1],l[0].length),l[0]=v,l.splice(1,1)}b=l[0];var f=(b[0]<<16)+(b[1]<<8)+b[2];if(f===1){if(_=(b[4]<<8)+b[5],_&&_>m.size-6)return null;var x=b[7];x&192&&(c=(b[9]&14)*536870912+(b[10]&255)*4194304+(b[11]&254)*16384+(b[12]&255)*128+(b[13]&254)/2,x&64?(r=(b[14]&14)*536870912+(b[15]&255)*4194304+(b[16]&254)*16384+(b[17]&255)*128+(b[18]&254)/2,c-r>60*9e4&&(y.logger.warn(Math.round((c-r)/9e4)+"s delta between PTS and DTS, align them"),c=r)):r=c),a=b[8];var R=a+9;if(m.size<=R)return null;m.size-=R;for(var O=new Uint8Array(m.size),B=0,j=l.length;B<j;B++){b=l[B];var K=b.byteLength;if(R)if(R>K){R-=K;continue}else b=b.subarray(R),K-=R,R=0;O.set(b,p),p+=K}return _&&(_-=a+3),{data:O,pts:c,dts:r,len:_}}return null}function i(m,p){if(m.units.length&&m.frame){if(m.pts===void 0){var b=p.samples,_=b.length;if(_){var a=b[_-1];m.pts=a.pts,m.dts=a.dts}else{p.dropped++;return}}p.samples.push(m)}m.debug.length&&y.logger.log(m.pts+"/"+m.dts+":"+m.debug)}function n(m,p){var b=m.length;if(b>0){if(p.pts>=m[b-1].pts)m.push(p);else for(var _=b-1;_>=0;_--)if(p.pts<m[_].pts){m.splice(_,0,p);break}}else m.push(p)}function T(m){for(var p=m.byteLength,b=[],_=1;_<p-2;)m[_]===0&&m[_+1]===0&&m[_+2]===3?(b.push(_+2),_+=2):_++;if(b.length===0)return m;var a=p-b.length,c=new Uint8Array(a),r=0;for(_=0;_<a;r++,_++)r===b[0]&&(r++,b.shift()),c[_]=m[r];return c}F.default=o},"./src/errors.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"ErrorTypes",function(){return U}),w.d(F,"ErrorDetails",function(){return S});var U;(function(I){I.NETWORK_ERROR="networkError",I.MEDIA_ERROR="mediaError",I.KEY_SYSTEM_ERROR="keySystemError",I.MUX_ERROR="muxError",I.OTHER_ERROR="otherError"})(U||(U={}));var S;(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"})(S||(S={}))},"./src/events.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"Events",function(){return U});var U;(function(S){S.MEDIA_ATTACHING="hlsMediaAttaching",S.MEDIA_ATTACHED="hlsMediaAttached",S.MEDIA_DETACHING="hlsMediaDetaching",S.MEDIA_DETACHED="hlsMediaDetached",S.BUFFER_RESET="hlsBufferReset",S.BUFFER_CODECS="hlsBufferCodecs",S.BUFFER_CREATED="hlsBufferCreated",S.BUFFER_APPENDING="hlsBufferAppending",S.BUFFER_APPENDED="hlsBufferAppended",S.BUFFER_EOS="hlsBufferEos",S.BUFFER_FLUSHING="hlsBufferFlushing",S.BUFFER_FLUSHED="hlsBufferFlushed",S.MANIFEST_LOADING="hlsManifestLoading",S.MANIFEST_LOADED="hlsManifestLoaded",S.MANIFEST_PARSED="hlsManifestParsed",S.LEVEL_SWITCHING="hlsLevelSwitching",S.LEVEL_SWITCHED="hlsLevelSwitched",S.LEVEL_LOADING="hlsLevelLoading",S.LEVEL_LOADED="hlsLevelLoaded",S.LEVEL_UPDATED="hlsLevelUpdated",S.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",S.LEVELS_UPDATED="hlsLevelsUpdated",S.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",S.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",S.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",S.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",S.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",S.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",S.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",S.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",S.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",S.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",S.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",S.CUES_PARSED="hlsCuesParsed",S.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",S.INIT_PTS_FOUND="hlsInitPtsFound",S.FRAG_LOADING="hlsFragLoading",S.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",S.FRAG_LOADED="hlsFragLoaded",S.FRAG_DECRYPTED="hlsFragDecrypted",S.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",S.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",S.FRAG_PARSING_METADATA="hlsFragParsingMetadata",S.FRAG_PARSED="hlsFragParsed",S.FRAG_BUFFERED="hlsFragBuffered",S.FRAG_CHANGED="hlsFragChanged",S.FPS_DROP="hlsFpsDrop",S.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",S.ERROR="hlsError",S.DESTROYING="hlsDestroying",S.KEY_LOADING="hlsKeyLoading",S.KEY_LOADED="hlsKeyLoaded",S.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",S.BACK_BUFFER_REACHED="hlsBackBufferReached"})(U||(U={}))},"./src/hls.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"default",function(){return m});var U=w("./node_modules/url-toolkit/src/url-toolkit.js"),S=w.n(U),I=w("./src/loader/playlist-loader.ts"),N=w("./src/loader/key-loader.ts"),k=w("./src/controller/id3-track-controller.ts"),A=w("./src/controller/latency-controller.ts"),C=w("./src/controller/level-controller.ts"),y=w("./src/controller/fragment-tracker.ts"),h=w("./src/controller/stream-controller.ts"),u=w("./src/is-supported.ts"),o=w("./src/utils/logger.ts"),e=w("./src/config.ts"),d=w("./node_modules/eventemitter3/index.js"),s=w.n(d),t=w("./src/events.ts"),i=w("./src/errors.ts");function n(p,b){for(var _=0;_<b.length;_++){var a=b[_];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(p,a.key,a)}}function T(p,b,_){return b&&n(p.prototype,b),_&&n(p,_),p}var m=function(){p.isSupported=function(){return Object(u.isSupported)()};function p(_){_===void 0&&(_={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new d.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 a=this.config=Object(e.mergeConfig)(p.DefaultConfig,_);this.userConfig=_,Object(o.enableLogs)(a.debug),this._autoLevelCapping=-1,a.progressive&&Object(e.enableStreamingMode)(a);var c=a.abrController,r=a.bufferController,l=a.capLevelController,v=a.fpsController,f=this.abrController=new c(this),x=this.bufferController=new r(this),R=this.capLevelController=new l(this),O=new v(this),B=new I.default(this),j=new N.default(this),K=new k.default(this),L=this.levelController=new C.default(this),H=new y.FragmentTracker(this),Y=this.streamController=new h.default(this,H);R.setStreamController(Y),O.setStreamController(Y);var ae=[L,Y];this.networkControllers=ae;var Z=[B,j,f,x,R,O,K,H];this.audioTrackController=this.createController(a.audioTrackController,null,ae),this.createController(a.audioStreamController,H,ae),this.subtitleTrackController=this.createController(a.subtitleTrackController,null,ae),this.createController(a.subtitleStreamController,H,ae),this.createController(a.timelineController,null,Z),this.emeController=this.createController(a.emeController,null,Z),this.cmcdController=this.createController(a.cmcdController,null,Z),this.latencyController=this.createController(A.default,null,Z),this.coreComponents=Z}var b=p.prototype;return b.createController=function(a,c,r){if(a){var l=c?new a(this,c):new a(this);return r&&r.push(l),l}return null},b.on=function(a,c,r){r===void 0&&(r=this),this._emitter.on(a,c,r)},b.once=function(a,c,r){r===void 0&&(r=this),this._emitter.once(a,c,r)},b.removeAllListeners=function(a){this._emitter.removeAllListeners(a)},b.off=function(a,c,r,l){r===void 0&&(r=this),this._emitter.off(a,c,r,l)},b.listeners=function(a){return this._emitter.listeners(a)},b.emit=function(a,c,r){return this._emitter.emit(a,c,r)},b.trigger=function(a,c){if(this.config.debug)return this.emit(a,a,c);try{return this.emit(a,a,c)}catch(r){o.logger.error("An internal error happened while handling event "+a+'. Error message: "'+r.message+'". Here is a stacktrace:',r),this.trigger(t.Events.ERROR,{type:i.ErrorTypes.OTHER_ERROR,details:i.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:a,error:r})}return!1},b.listenerCount=function(a){return this._emitter.listenerCount(a)},b.destroy=function(){o.logger.log("destroy"),this.trigger(t.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(a){return a.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(a){return a.destroy()}),this.coreComponents.length=0},b.attachMedia=function(a){o.logger.log("attachMedia"),this._media=a,this.trigger(t.Events.MEDIA_ATTACHING,{media:a})},b.detachMedia=function(){o.logger.log("detachMedia"),this.trigger(t.Events.MEDIA_DETACHING,void 0),this._media=null},b.loadSource=function(a){this.stopLoad();var c=this.media,r=this.url,l=this.url=U.buildAbsoluteURL(self.location.href,a,{alwaysNormalize:!0});o.logger.log("loadSource:"+l),c&&r&&r!==l&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(t.Events.MANIFEST_LOADING,{url:a})},b.startLoad=function(a){a===void 0&&(a=-1),o.logger.log("startLoad("+a+")"),this.networkControllers.forEach(function(c){c.startLoad(a)})},b.stopLoad=function(){o.logger.log("stopLoad"),this.networkControllers.forEach(function(a){a.stopLoad()})},b.swapAudioCodec=function(){o.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},b.recoverMediaError=function(){o.logger.log("recoverMediaError");var a=this._media;this.detachMedia(),a&&this.attachMedia(a)},b.removeLevel=function(a,c){c===void 0&&(c=0),this.levelController.removeLevel(a,c)},T(p,[{key:"levels",get:function(){var a=this.levelController.levels;return a||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(a){o.logger.log("set currentLevel:"+a),this.loadLevel=a,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(a){o.logger.log("set nextLevel:"+a),this.levelController.manualLevel=a,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(a){o.logger.log("set loadLevel:"+a),this.levelController.manualLevel=a}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(a){this.levelController.nextLoadLevel=a}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(a){o.logger.log("set firstLevel:"+a),this.levelController.firstLevel=a}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(a){o.logger.log("set startLevel:"+a),a!==-1&&(a=Math.max(a,this.minAutoLevel)),this.levelController.startLevel=a}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(a){var c=!!a;c!==this.config.capLevelToPlayerSize&&(c?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=c)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(a){this._autoLevelCapping!==a&&(o.logger.log("set autoLevelCapping:"+a),this._autoLevelCapping=a)}},{key:"bandwidthEstimate",get:function(){var a=this.abrController.bwEstimator;return a?a.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var a=this.levels,c=this.config.minAutoBitrate;if(!a)return 0;for(var r=a.length,l=0;l<r;l++)if(a[l].maxBitrate>c)return l;return 0}},{key:"maxAutoLevel",get:function(){var a=this.levels,c=this.autoLevelCapping,r;return c===-1&&a&&a.length?r=a.length-1:r=c,r}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(a){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,a)}},{key:"audioTracks",get:function(){var a=this.audioTrackController;return a?a.audioTracks:[]}},{key:"audioTrack",get:function(){var a=this.audioTrackController;return a?a.audioTrack:-1},set:function(a){var c=this.audioTrackController;c&&(c.audioTrack=a)}},{key:"subtitleTracks",get:function(){var a=this.subtitleTrackController;return a?a.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var a=this.subtitleTrackController;return a?a.subtitleTrack:-1},set:function(a){var c=this.subtitleTrackController;c&&(c.subtitleTrack=a)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var a=this.subtitleTrackController;return a?a.subtitleDisplay:!1},set:function(a){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=a)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(a){this.config.lowLatencyMode=a}},{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 t.Events}},{key:"ErrorTypes",get:function(){return i.ErrorTypes}},{key:"ErrorDetails",get:function(){return i.ErrorDetails}},{key:"DefaultConfig",get:function(){return p.defaultConfig?p.defaultConfig:e.hlsDefaultConfig},set:function(a){p.defaultConfig=a}}]),p}();m.defaultConfig=void 0},"./src/is-supported.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"isSupported",function(){return I}),w.d(F,"changeTypeSupported",function(){return N});var U=w("./src/utils/mediasource-helper.ts");function S(){return self.SourceBuffer||self.WebKitSourceBuffer}function I(){var k=Object(U.getMediaSource)();if(!k)return!1;var A=S(),C=k&&typeof k.isTypeSupported=="function"&&k.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),y=!A||A.prototype&&typeof A.prototype.appendBuffer=="function"&&typeof A.prototype.remove=="function";return!!C&&!!y}function N(){var k,A=S();return typeof(A==null||((k=A.prototype)===null||k===void 0)?void 0:k.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"default",function(){return o}),w.d(F,"LoadError",function(){return d});var U=w("./src/polyfills/number.ts"),S=w("./src/errors.ts");function I(s,t){s.prototype=Object.create(t.prototype),s.prototype.constructor=s,y(s,t)}function N(s){var t=typeof Map=="function"?new Map:void 0;return N=function(n){if(n===null||!C(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t!="undefined"){if(t.has(n))return t.get(n);t.set(n,T)}function T(){return k(n,arguments,h(this).constructor)}return T.prototype=Object.create(n.prototype,{constructor:{value:T,enumerable:!1,writable:!0,configurable:!0}}),y(T,n)},N(s)}function k(s,t,i){return A()?k=Reflect.construct:k=function(T,m,p){var b=[null];b.push.apply(b,m);var _=Function.bind.apply(T,b),a=new _;return p&&y(a,p.prototype),a},k.apply(null,arguments)}function A(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(s){return!1}}function C(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function y(s,t){return y=Object.setPrototypeOf||function(n,T){return n.__proto__=T,n},y(s,t)}function h(s){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(i){return i.__proto__||Object.getPrototypeOf(i)},h(s)}var u=Math.pow(2,17),o=function(){function s(i){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=i}var t=s.prototype;return t.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},t.abort=function(){this.loader&&this.loader.abort()},t.load=function(n,T){var m=this,p=n.url;if(!p)return Promise.reject(new d({type:S.ErrorTypes.NETWORK_ERROR,details:S.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:n,networkDetails:null},"Fragment does not have a "+(p?"part list":"url")));this.abort();var b=this.config,_=b.fLoader,a=b.loader;return new Promise(function(c,r){m.loader&&m.loader.destroy();var l=m.loader=n.loader=_?new _(b):new a(b),v=e(n),f={timeout:b.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:b.fragLoadingMaxRetryTimeout,highWaterMark:u};n.stats=l.stats,l.load(v,f,{onSuccess:function(R,O,B,j){m.resetLoader(n,l),c({frag:n,part:null,payload:R.data,networkDetails:j})},onError:function(R,O,B){m.resetLoader(n,l),r(new d({type:S.ErrorTypes.NETWORK_ERROR,details:S.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:n,response:R,networkDetails:B}))},onAbort:function(R,O,B){m.resetLoader(n,l),r(new d({type:S.ErrorTypes.NETWORK_ERROR,details:S.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:n,networkDetails:B}))},onTimeout:function(R,O,B){m.resetLoader(n,l),r(new d({type:S.ErrorTypes.NETWORK_ERROR,details:S.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:n,networkDetails:B}))},onProgress:function(R,O,B,j){T&&T({frag:n,part:null,payload:B,networkDetails:j})}})})},t.loadPart=function(n,T,m){var p=this;this.abort();var b=this.config,_=b.fLoader,a=b.loader;return new Promise(function(c,r){p.loader&&p.loader.destroy();var l=p.loader=n.loader=_?new _(b):new a(b),v=e(n,T),f={timeout:b.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:b.fragLoadingMaxRetryTimeout,highWaterMark:u};T.stats=l.stats,l.load(v,f,{onSuccess:function(R,O,B,j){p.resetLoader(n,l),p.updateStatsFromPart(n,T);var K={frag:n,part:T,payload:R.data,networkDetails:j};m(K),c(K)},onError:function(R,O,B){p.resetLoader(n,l),r(new d({type:S.ErrorTypes.NETWORK_ERROR,details:S.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:n,part:T,response:R,networkDetails:B}))},onAbort:function(R,O,B){n.stats.aborted=T.stats.aborted,p.resetLoader(n,l),r(new d({type:S.ErrorTypes.NETWORK_ERROR,details:S.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:n,part:T,networkDetails:B}))},onTimeout:function(R,O,B){p.resetLoader(n,l),r(new d({type:S.ErrorTypes.NETWORK_ERROR,details:S.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:n,part:T,networkDetails:B}))}})})},t.updateStatsFromPart=function(n,T){var m=n.stats,p=T.stats,b=p.total;if(m.loaded+=p.loaded,b){var _=Math.round(n.duration/T.duration),a=Math.min(Math.round(m.loaded/b),_),c=_-a,r=c*Math.round(m.loaded/a);m.total=m.loaded+r}else m.total=Math.max(m.loaded,m.total);var l=m.loading,v=p.loading;l.start?l.first+=v.first-v.start:(l.start=v.start,l.first=v.first),l.end=v.end},t.resetLoader=function(n,T){n.loader=null,this.loader===T&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),T.destroy()},s}();function e(s,t){t===void 0&&(t=null);var i=t||s,n={frag:s,part:t,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},T=i.byteRangeStartOffset,m=i.byteRangeEndOffset;return Object(U.isFiniteNumber)(T)&&Object(U.isFiniteNumber)(m)&&(n.rangeStart=T,n.rangeEnd=m),n}var d=function(s){I(t,s);function t(i){for(var n,T=arguments.length,m=new Array(T>1?T-1:0),p=1;p<T;p++)m[p-1]=arguments[p];return n=s.call.apply(s,[this].concat(m))||this,n.data=void 0,n.data=i,n}return t}(N(Error))},"./src/loader/fragment.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"ElementaryStreamTypes",function(){return o}),w.d(F,"BaseSegment",function(){return e}),w.d(F,"Fragment",function(){return d}),w.d(F,"Part",function(){return s});var U=w("./src/polyfills/number.ts"),S=w("./node_modules/url-toolkit/src/url-toolkit.js"),I=w.n(S),N=w("./src/utils/logger.ts"),k=w("./src/loader/level-key.ts"),A=w("./src/loader/load-stats.ts");function C(t,i){t.prototype=Object.create(i.prototype),t.prototype.constructor=t,y(t,i)}function y(t,i){return y=Object.setPrototypeOf||function(T,m){return T.__proto__=m,T},y(t,i)}function h(t,i){for(var n=0;n<i.length;n++){var T=i[n];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(t,T.key,T)}}function u(t,i,n){return i&&h(t.prototype,i),n&&h(t,n),t}var o;(function(t){t.AUDIO="audio",t.VIDEO="video",t.AUDIOVIDEO="audiovideo"})(o||(o={}));var e=function(){function t(n){var T;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(T={},T[o.AUDIO]=null,T[o.VIDEO]=null,T[o.AUDIOVIDEO]=null,T),this.baseurl=n}var i=t.prototype;return i.setByteRange=function(T,m){var p=T.split("@",2),b=[];p.length===1?b[0]=m?m.byteRangeEndOffset:0:b[0]=parseInt(p[1]),b[1]=parseInt(p[0])+b[0],this._byteRange=b},u(t,[{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(S.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(T){this._url=T}}]),t}(),d=function(t){C(i,t);function i(T,m){var p;return p=t.call(this,m)||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 A.LoadStats,p.urlId=0,p.data=void 0,p.bitrateTest=!1,p.title=null,p.initSegment=null,p.type=T,p}var n=i.prototype;return n.createInitializationVector=function(m){for(var p=new Uint8Array(16),b=12;b<16;b++)p[b]=m>>8*(15-b)&255;return p},n.setDecryptDataFromLevelKey=function(m,p){var b=m;return(m==null?void 0:m.method)==="AES-128"&&m.uri&&!m.iv&&(b=k.LevelKey.fromURI(m.uri),b.method=m.method,b.iv=this.createInitializationVector(p),b.keyFormat="identity"),b},n.setElementaryStreamInfo=function(m,p,b,_,a,c){c===void 0&&(c=!1);var r=this.elementaryStreams,l=r[m];if(!l){r[m]={startPTS:p,endPTS:b,startDTS:_,endDTS:a,partial:c};return}l.startPTS=Math.min(l.startPTS,p),l.endPTS=Math.max(l.endPTS,b),l.startDTS=Math.min(l.startDTS,_),l.endDTS=Math.max(l.endDTS,a)},n.clearElementaryStreamInfo=function(){var m=this.elementaryStreams;m[o.AUDIO]=null,m[o.VIDEO]=null,m[o.AUDIOVIDEO]=null},u(i,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var m=this.sn;typeof m!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&N.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),m=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,m)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(U.isFiniteNumber)(this.programDateTime))return null;var m=Object(U.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+m*1e3}},{key:"encrypted",get:function(){var m;return!!((m=this.decryptdata)!==null&&m!==void 0&&m.keyFormat&&this.decryptdata.uri)}}]),i}(e),s=function(t){C(i,t);function i(n,T,m,p,b){var _;_=t.call(this,m)||this,_.fragOffset=0,_.duration=0,_.gap=!1,_.independent=!1,_.relurl=void 0,_.fragment=void 0,_.index=void 0,_.stats=new A.LoadStats,_.duration=n.decimalFloatingPoint("DURATION"),_.gap=n.bool("GAP"),_.independent=n.bool("INDEPENDENT"),_.relurl=n.enumeratedString("URI"),_.fragment=T,_.index=p;var a=n.enumeratedString("BYTERANGE");return a&&_.setByteRange(a,b),b&&(_.fragOffset=b.fragOffset+b.duration),_}return u(i,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var T=this.elementaryStreams;return!!(T.audio||T.video||T.audiovideo)}}]),i}(e)},"./src/loader/key-loader.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"default",function(){return N});var U=w("./src/events.ts"),S=w("./src/errors.ts"),I=w("./src/utils/logger.ts"),N=function(){function k(C){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=C,this._registerListeners()}var A=k.prototype;return A._registerListeners=function(){this.hls.on(U.Events.KEY_LOADING,this.onKeyLoading,this)},A._unregisterListeners=function(){this.hls.off(U.Events.KEY_LOADING,this.onKeyLoading)},A.destroy=function(){this._unregisterListeners();for(var y in this.loaders){var h=this.loaders[y];h&&h.destroy()}this.loaders={}},A.onKeyLoading=function(y,h){var u=h.frag,o=u.type,e=this.loaders[o];if(!u.decryptdata){I.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var d=u.decryptdata.uri;if(d!==this.decrypturl||this.decryptkey===null){var s=this.hls.config;if(e&&(I.logger.warn("abort previous key loader for type:"+o),e.abort()),!d){I.logger.warn("key uri is falsy");return}var t=s.loader,i=u.loader=this.loaders[o]=new t(s);this.decrypturl=d,this.decryptkey=null;var n={url:d,frag:u,responseType:"arraybuffer"},T={timeout:s.fragLoadingTimeOut,maxRetry:0,retryDelay:s.fragLoadingRetryDelay,maxRetryDelay:s.fragLoadingMaxRetryTimeout,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};i.load(n,T,m)}else this.decryptkey&&(u.decryptdata.key=this.decryptkey,this.hls.trigger(U.Events.KEY_LOADED,{frag:u}))},A.loadsuccess=function(y,h,u){var o=u.frag;if(!o.decryptdata){I.logger.error("after key load, decryptdata unset");return}this.decryptkey=o.decryptdata.key=new Uint8Array(y.data),o.loader=null,delete this.loaders[o.type],this.hls.trigger(U.Events.KEY_LOADED,{frag:o})},A.loaderror=function(y,h){var u=h.frag,o=u.loader;o&&o.abort(),delete this.loaders[u.type],this.hls.trigger(U.Events.ERROR,{type:S.ErrorTypes.NETWORK_ERROR,details:S.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:u,response:y})},A.loadtimeout=function(y,h){var u=h.frag,o=u.loader;o&&o.abort(),delete this.loaders[u.type],this.hls.trigger(U.Events.ERROR,{type:S.ErrorTypes.NETWORK_ERROR,details:S.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:u})},k}()},"./src/loader/level-details.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"LevelDetails",function(){return k});var U=w("./src/polyfills/number.ts");function S(A,C){for(var y=0;y<C.length;y++){var h=C[y];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(A,h.key,h)}}function I(A,C,y){return C&&S(A.prototype,C),y&&S(A,y),A}var N=10,k=function(){function A(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 C=A.prototype;return C.reloaded=function(h){if(!h){this.advanced=!0,this.updated=!0;return}var u=this.lastPartSn-h.lastPartSn,o=this.lastPartIndex-h.lastPartIndex;this.updated=this.endSN!==h.endSN||!!o||!!u,this.advanced=this.endSN>h.endSN||u>0||u===0&&o>0,this.updated||this.advanced?this.misses=Math.floor(h.misses*.6):this.misses=h.misses+1,this.availabilityDelay=h.availabilityDelay},I(A,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(U.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||N}},{key:"drift",get:function(){var h=this.driftEndTime-this.driftStartTime;if(h>0){var u=this.driftEnd-this.driftStart;return u*1e3/h}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var h;return(h=this.partList)!==null&&h!==void 0&&h.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var h;return(h=this.fragments)!==null&&h!==void 0&&h.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var h;return(h=this.partList)!==null&&h!==void 0&&h.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var h;return(h=this.partList)!==null&&h!==void 0&&h.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),A}()},"./src/loader/level-key.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"LevelKey",function(){return k});var U=w("./node_modules/url-toolkit/src/url-toolkit.js"),S=w.n(U);function I(A,C){for(var y=0;y<C.length;y++){var h=C[y];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(A,h.key,h)}}function N(A,C,y){return C&&I(A.prototype,C),y&&I(A,y),A}var k=function(){A.fromURL=function(y,h){return new A(y,h)},A.fromURI=function(y){return new A(y)};function A(C,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(U.buildAbsoluteURL)(C,y,{alwaysNormalize:!0}):this._uri=C}return N(A,[{key:"uri",get:function(){return this._uri}}]),A}()},"./src/loader/load-stats.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"LoadStats",function(){return U});var U=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(_e,F,w){"use strict";w.r(F),w.d(F,"default",function(){return i});var U=w("./src/polyfills/number.ts"),S=w("./node_modules/url-toolkit/src/url-toolkit.js"),I=w.n(S),N=w("./src/loader/fragment.ts"),k=w("./src/loader/level-details.ts"),A=w("./src/loader/level-key.ts"),C=w("./src/utils/attr-list.ts"),y=w("./src/utils/logger.ts"),h=w("./src/utils/codecs.ts"),u=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,o=/#EXT-X-MEDIA:(.*)/g,e=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),d=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),s=/\.(mp4|m4s|m4v|m4a)$/i;function t(b){var _,a;return s.test((_=(a=S.parseURL(b))===null||a===void 0?void 0:a.path)!=null?_:"")}var i=function(){function b(){}return b.findGroup=function(a,c){for(var r=0;r<a.length;r++){var l=a[r];if(l.id===c)return l}},b.convertAVC1ToAVCOTI=function(a){var c=a.split(".");if(c.length>2){var r=c.shift()+".";return r+=parseInt(c.shift()).toString(16),r+=("000"+parseInt(c.shift()).toString(16)).substr(-4),r}return a},b.resolve=function(a,c){return S.buildAbsoluteURL(c,a,{alwaysNormalize:!0})},b.parseMasterPlaylist=function(a,c){var r=[],l={},v=!1;u.lastIndex=0;for(var f;(f=u.exec(a))!=null;)if(f[1]){var x=new C.AttrList(f[1]),R={attrs:x,bitrate:x.decimalInteger("AVERAGE-BANDWIDTH")||x.decimalInteger("BANDWIDTH"),name:x.NAME,url:b.resolve(f[2],c)},O=x.decimalResolution("RESOLUTION");O&&(R.width=O.width,R.height=O.height),n((x.CODECS||"").split(/[ ,]+/).filter(function(j){return j}),R),R.videoCodec&&R.videoCodec.indexOf("avc1")!==-1&&(R.videoCodec=b.convertAVC1ToAVCOTI(R.videoCodec)),r.push(R)}else if(f[3]){var B=new C.AttrList(f[3]);B["DATA-ID"]&&(v=!0,l[B["DATA-ID"]]=B)}return{levels:r,sessionData:v?l:null}},b.parseMasterPlaylistMedia=function(a,c,r,l){l===void 0&&(l=[]);var v,f=[],x=0;for(o.lastIndex=0;(v=o.exec(a))!==null;){var R=new C.AttrList(v[1]);if(R.TYPE===r){var O={attrs:R,bitrate:0,id:x++,groupId:R["GROUP-ID"],instreamId:R["INSTREAM-ID"],name:R.NAME||R.LANGUAGE||"",type:r,default:R.bool("DEFAULT"),autoselect:R.bool("AUTOSELECT"),forced:R.bool("FORCED"),lang:R.LANGUAGE,url:R.URI?b.resolve(R.URI,c):""};if(l.length){var B=b.findGroup(l,O.groupId)||l[0];T(O,B,"audioCodec"),T(O,B,"textCodec")}f.push(O)}}return f},b.parseLevelPlaylist=function(a,c,r,l,v){var f=new k.LevelDetails(c),x=f.fragments,R=null,O=0,B=0,j=0,K=0,L=null,H=new N.Fragment(l,c),Y,ae,Z,ce=-1,de=!1;for(e.lastIndex=0,f.m3u8=a;(Y=e.exec(a))!==null;){de&&(de=!1,H=new N.Fragment(l,c),H.start=j,H.sn=O,H.cc=K,H.level=r,R&&(H.initSegment=R,H.rawProgramDateTime=R.rawProgramDateTime));var q=Y[1];if(q){H.duration=parseFloat(q);var te=(" "+Y[2]).slice(1);H.title=te||null,H.tagList.push(te?["INF",q,te]:["INF",q])}else if(Y[3])Object(U.isFiniteNumber)(H.duration)&&(H.start=j,Z&&(H.levelkey=Z),H.sn=O,H.level=r,H.cc=K,H.urlId=v,x.push(H),H.relurl=(" "+Y[3]).slice(1),p(H,L),L=H,j+=H.duration,O++,B=0,de=!0);else if(Y[4]){var he=(" "+Y[4]).slice(1);L?H.setByteRange(he,L):H.setByteRange(he)}else if(Y[5])H.rawProgramDateTime=(" "+Y[5]).slice(1),H.tagList.push(["PROGRAM-DATE-TIME",H.rawProgramDateTime]),ce===-1&&(ce=x.length);else{if(Y=Y[0].match(d),!Y){y.logger.warn("No matches on slow regex match for level playlist!");continue}for(ae=1;ae<Y.length&&!(typeof Y[ae]!="undefined");ae++);var J=(" "+Y[ae]).slice(1),X=(" "+Y[ae+1]).slice(1),ye=Y[ae+2]?(" "+Y[ae+2]).slice(1):"";switch(J){case"PLAYLIST-TYPE":f.type=X.toUpperCase();break;case"MEDIA-SEQUENCE":O=f.startSN=parseInt(X);break;case"SKIP":{var we=new C.AttrList(X),Le=we.decimalInteger("SKIPPED-SEGMENTS");if(Object(U.isFiniteNumber)(Le)){f.skippedSegments=Le;for(var xe=Le;xe--;)x.unshift(null);O+=Le}var Re=we.enumeratedString("RECENTLY-REMOVED-DATERANGES");Re&&(f.recentlyRemovedDateranges=Re.split(" "));break}case"TARGETDURATION":f.targetduration=parseFloat(X);break;case"VERSION":f.version=parseInt(X);break;case"EXTM3U":break;case"ENDLIST":f.live=!1;break;case"#":(X||ye)&&H.tagList.push(ye?[X,ye]:[X]);break;case"DIS":K++;case"GAP":H.tagList.push([J]);break;case"BITRATE":H.tagList.push([J,X]);break;case"DISCONTINUITY-SEQ":K=parseInt(X);break;case"KEY":{var Te,Oe=new C.AttrList(X),Ie=Oe.enumeratedString("METHOD"),Me=Oe.URI,Ne=Oe.hexadecimalInteger("IV"),Be=Oe.enumeratedString("KEYFORMATVERSIONS"),Pe=Oe.enumeratedString("KEYID"),Ye=(Te=Oe.enumeratedString("KEYFORMAT"))!=null?Te:"identity",Ke=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ke.indexOf(Ye)>-1){y.logger.warn("Keyformat "+Ye+" is not supported from the manifest");continue}else if(Ye!=="identity")continue;Ie&&(Z=A.LevelKey.fromURL(c,Me),Me&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ie)>=0&&(Z.method=Ie,Z.keyFormat=Ye,Pe&&(Z.keyID=Pe),Be&&(Z.keyFormatVersions=Be),Z.iv=Ne));break}case"START":{var Se=new C.AttrList(X),je=Se.decimalFloatingPoint("TIME-OFFSET");Object(U.isFiniteNumber)(je)&&(f.startTimeOffset=je);break}case"MAP":{var et=new C.AttrList(X);H.relurl=et.URI,et.BYTERANGE&&H.setByteRange(et.BYTERANGE),H.level=r,H.sn="initSegment",Z&&(H.levelkey=Z),H.initSegment=null,R=H,de=!0;break}case"SERVER-CONTROL":{var Je=new C.AttrList(X);f.canBlockReload=Je.bool("CAN-BLOCK-RELOAD"),f.canSkipUntil=Je.optionalFloat("CAN-SKIP-UNTIL",0),f.canSkipDateRanges=f.canSkipUntil>0&&Je.bool("CAN-SKIP-DATERANGES"),f.partHoldBack=Je.optionalFloat("PART-HOLD-BACK",0),f.holdBack=Je.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ze=new C.AttrList(X);f.partTarget=Ze.decimalFloatingPoint("PART-TARGET");break}case"PART":{var We=f.partList;We||(We=f.partList=[]);var nt=B>0?We[We.length-1]:void 0,qe=B++,De=new N.Part(new C.AttrList(X),H,c,qe,nt);We.push(De),H.duration+=De.duration;break}case"PRELOAD-HINT":{var Ge=new C.AttrList(X);f.preloadHint=Ge;break}case"RENDITION-REPORT":{var ne=new C.AttrList(X);f.renditionReports=f.renditionReports||[],f.renditionReports.push(ne);break}default:y.logger.warn("line parsed but not handled: "+Y);break}}}L&&!L.relurl?(x.pop(),j-=L.duration,f.partList&&(f.fragmentHint=L)):f.partList&&(p(H,L),H.cc=K,f.fragmentHint=H);var le=x.length,fe=x[0],$=x[le-1];if(j+=f.skippedSegments*f.targetduration,j>0&&le&&$){f.averagetargetduration=j/le;var Q=$.sn;f.endSN=Q!=="initSegment"?Q:0,fe&&(f.startCC=fe.cc,fe.initSegment||f.fragments.every(function(re){return re.relurl&&t(re.relurl)})&&(y.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),H=new N.Fragment(l,c),H.relurl=$.relurl,H.level=r,H.sn="initSegment",fe.initSegment=H,f.needSidxRanges=!0))}else f.endSN=0,f.startCC=0;return f.fragmentHint&&(j+=f.fragmentHint.duration),f.totalduration=j,f.endCC=K,ce>0&&m(x,ce),f},b}();function n(b,_){["video","audio","text"].forEach(function(a){var c=b.filter(function(l){return Object(h.isCodecType)(l,a)});if(c.length){var r=c.filter(function(l){return l.lastIndexOf("avc1",0)===0||l.lastIndexOf("mp4a",0)===0});_[a+"Codec"]=r.length>0?r[0]:c[0],b=b.filter(function(l){return c.indexOf(l)===-1})}}),_.unknownCodecs=b}function T(b,_,a){var c=_[a];c&&(b[a]=c)}function m(b,_){for(var a=b[_],c=_;c--;){var r=b[c];if(!r)return;r.programDateTime=a.programDateTime-r.duration*1e3,a=r}}function p(b,_){b.rawProgramDateTime?b.programDateTime=Date.parse(b.rawProgramDateTime):_!=null&&_.programDateTime&&(b.programDateTime=_.endProgramDateTime),Object(U.isFiniteNumber)(b.programDateTime)||(b.programDateTime=null,b.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(_e,F,w){"use strict";w.r(F);var U=w("./src/polyfills/number.ts"),S=w("./src/events.ts"),I=w("./src/errors.ts"),N=w("./src/utils/logger.ts"),k=w("./src/utils/mp4-tools.ts"),A=w("./src/loader/m3u8-parser.ts"),C=w("./src/types/loader.ts"),y=w("./src/utils/attr-list.ts");function h(e){var d=e.type;switch(d){case C.PlaylistContextType.AUDIO_TRACK:return C.PlaylistLevelType.AUDIO;case C.PlaylistContextType.SUBTITLE_TRACK:return C.PlaylistLevelType.SUBTITLE;default:return C.PlaylistLevelType.MAIN}}function u(e,d){var s=e.url;return(s===void 0||s.indexOf("data:")===0)&&(s=d.url),s}var o=function(){function e(s){this.hls=void 0,this.loaders=Object.create(null),this.hls=s,this.registerListeners()}var d=e.prototype;return d.registerListeners=function(){var t=this.hls;t.on(S.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.Events.LEVEL_LOADING,this.onLevelLoading,this),t.on(S.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.on(S.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},d.unregisterListeners=function(){var t=this.hls;t.off(S.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.Events.LEVEL_LOADING,this.onLevelLoading,this),t.off(S.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.off(S.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},d.createInternalLoader=function(t){var i=this.hls.config,n=i.pLoader,T=i.loader,m=n||T,p=new m(i);return t.loader=p,this.loaders[t.type]=p,p},d.getInternalLoader=function(t){return this.loaders[t.type]},d.resetInternalLoader=function(t){this.loaders[t]&&delete this.loaders[t]},d.destroyInternalLoaders=function(){for(var t in this.loaders){var i=this.loaders[t];i&&i.destroy(),this.resetInternalLoader(t)}},d.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},d.onManifestLoading=function(t,i){var n=i.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:C.PlaylistContextType.MANIFEST,url:n,deliveryDirectives:null})},d.onLevelLoading=function(t,i){var n=i.id,T=i.level,m=i.url,p=i.deliveryDirectives;this.load({id:n,groupId:null,level:T,responseType:"text",type:C.PlaylistContextType.LEVEL,url:m,deliveryDirectives:p})},d.onAudioTrackLoading=function(t,i){var n=i.id,T=i.groupId,m=i.url,p=i.deliveryDirectives;this.load({id:n,groupId:T,level:null,responseType:"text",type:C.PlaylistContextType.AUDIO_TRACK,url:m,deliveryDirectives:p})},d.onSubtitleTrackLoading=function(t,i){var n=i.id,T=i.groupId,m=i.url,p=i.deliveryDirectives;this.load({id:n,groupId:T,level:null,responseType:"text",type:C.PlaylistContextType.SUBTITLE_TRACK,url:m,deliveryDirectives:p})},d.load=function(t){var i,n=this.hls.config,T=this.getInternalLoader(t);if(T){var m=T.context;if(m&&m.url===t.url){N.logger.trace("[playlist-loader]: playlist request ongoing");return}N.logger.log("[playlist-loader]: aborting previous loader for type: "+t.type),T.abort()}var p,b,_,a;switch(t.type){case C.PlaylistContextType.MANIFEST:p=n.manifestLoadingMaxRetry,b=n.manifestLoadingTimeOut,_=n.manifestLoadingRetryDelay,a=n.manifestLoadingMaxRetryTimeout;break;case C.PlaylistContextType.LEVEL:case C.PlaylistContextType.AUDIO_TRACK:case C.PlaylistContextType.SUBTITLE_TRACK:p=0,b=n.levelLoadingTimeOut;break;default:p=n.levelLoadingMaxRetry,b=n.levelLoadingTimeOut,_=n.levelLoadingRetryDelay,a=n.levelLoadingMaxRetryTimeout;break}if(T=this.createInternalLoader(t),(i=t.deliveryDirectives)!==null&&i!==void 0&&i.part){var c;if(t.type===C.PlaylistContextType.LEVEL&&t.level!==null?c=this.hls.levels[t.level].details:t.type===C.PlaylistContextType.AUDIO_TRACK&&t.id!==null?c=this.hls.audioTracks[t.id].details:t.type===C.PlaylistContextType.SUBTITLE_TRACK&&t.id!==null&&(c=this.hls.subtitleTracks[t.id].details),c){var r=c.partTarget,l=c.targetduration;r&&l&&(b=Math.min(Math.max(r*3,l*.8)*1e3,b))}}var v={timeout:b,maxRetry:p,retryDelay:_,maxRetryDelay:a,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};T.load(t,v,f)},d.loadsuccess=function(t,i,n,T){if(T===void 0&&(T=null),n.isSidxRequest){this.handleSidxRequest(t,n),this.handlePlaylistLoaded(t,i,n,T);return}this.resetInternalLoader(n.type);var m=t.data;if(m.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(t,n,"no EXTM3U delimiter",T);return}i.parsing.start=performance.now(),m.indexOf("#EXTINF:")>0||m.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(t,i,n,T):this.handleMasterPlaylist(t,i,n,T)},d.loaderror=function(t,i,n){n===void 0&&(n=null),this.handleNetworkError(i,n,!1,t)},d.loadtimeout=function(t,i,n){n===void 0&&(n=null),this.handleNetworkError(i,n,!0)},d.handleMasterPlaylist=function(t,i,n,T){var m=this.hls,p=t.data,b=u(t,n),_=A.default.parseMasterPlaylist(p,b),a=_.levels,c=_.sessionData;if(!a.length){this.handleManifestParsingError(t,n,"no level found in manifest",T);return}var r=a.map(function(O){return{id:O.attrs.AUDIO,audioCodec:O.audioCodec}}),l=a.map(function(O){return{id:O.attrs.SUBTITLES,textCodec:O.textCodec}}),v=A.default.parseMasterPlaylistMedia(p,b,"AUDIO",r),f=A.default.parseMasterPlaylistMedia(p,b,"SUBTITLES",l),x=A.default.parseMasterPlaylistMedia(p,b,"CLOSED-CAPTIONS");if(v.length){var R=v.some(function(O){return!O.url});!R&&a[0].audioCodec&&!a[0].attrs.AUDIO&&(N.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),v.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new y.AttrList({}),bitrate:0,url:""}))}m.trigger(S.Events.MANIFEST_LOADED,{levels:a,audioTracks:v,subtitles:f,captions:x,url:b,stats:i,networkDetails:T,sessionData:c})},d.handleTrackOrLevelPlaylist=function(t,i,n,T){var m=this.hls,p=n.id,b=n.level,_=n.type,a=u(t,n),c=Object(U.isFiniteNumber)(p)?p:0,r=Object(U.isFiniteNumber)(b)?b:c,l=h(n),v=A.default.parseLevelPlaylist(t.data,a,r,l,c);if(!v.fragments.length){m.trigger(S.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:a,reason:"no fragments found in level",level:typeof n.level=="number"?n.level:void 0});return}if(_===C.PlaylistContextType.MANIFEST){var f={attrs:new y.AttrList({}),bitrate:0,details:v,name:"",url:a};m.trigger(S.Events.MANIFEST_LOADED,{levels:[f],audioTracks:[],url:a,stats:i,networkDetails:T,sessionData:null})}if(i.parsing.end=performance.now(),v.needSidxRanges){var x,R=(x=v.fragments[0].initSegment)===null||x===void 0?void 0:x.url;this.load({url:R,isSidxRequest:!0,type:_,level:b,levelDetails:v,id:p,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}n.levelDetails=v,this.handlePlaylistLoaded(t,i,n,T)},d.handleSidxRequest=function(t,i){var n=Object(k.parseSegmentIndex)(new Uint8Array(t.data));if(!n)return;var T=n.references,m=i.levelDetails;T.forEach(function(p,b){var _=p.info,a=m.fragments[b];a.byteRange.length===0&&a.setByteRange(String(1+_.end-_.start)+"@"+String(_.start)),a.initSegment&&a.initSegment.setByteRange(String(n.moovEndOffset)+"@0")})},d.handleManifestParsingError=function(t,i,n,T){this.hls.trigger(S.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:i.type===C.PlaylistContextType.MANIFEST,url:t.url,reason:n,response:t,context:i,networkDetails:T})},d.handleNetworkError=function(t,i,n,T){n===void 0&&(n=!1),N.logger.warn("[playlist-loader]: A network "+(n?"timeout":"error")+" occurred while loading "+t.type+" level: "+t.level+" id: "+t.id+' group-id: "'+t.groupId+'"');var m=I.ErrorDetails.UNKNOWN,p=!1,b=this.getInternalLoader(t);switch(t.type){case C.PlaylistContextType.MANIFEST:m=n?I.ErrorDetails.MANIFEST_LOAD_TIMEOUT:I.ErrorDetails.MANIFEST_LOAD_ERROR,p=!0;break;case C.PlaylistContextType.LEVEL:m=n?I.ErrorDetails.LEVEL_LOAD_TIMEOUT:I.ErrorDetails.LEVEL_LOAD_ERROR,p=!1;break;case C.PlaylistContextType.AUDIO_TRACK:m=n?I.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,p=!1;break;case C.PlaylistContextType.SUBTITLE_TRACK:m=n?I.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:I.ErrorDetails.SUBTITLE_LOAD_ERROR,p=!1;break}b&&this.resetInternalLoader(t.type);var _={type:I.ErrorTypes.NETWORK_ERROR,details:m,fatal:p,url:t.url,loader:b,context:t,networkDetails:i};T&&(_.response=T),this.hls.trigger(S.Events.ERROR,_)},d.handlePlaylistLoaded=function(t,i,n,T){var m=n.type,p=n.level,b=n.id,_=n.groupId,a=n.loader,c=n.levelDetails,r=n.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(t,n,"invalid target duration",T);return}if(!a)return;c.live&&(a.getCacheAge&&(c.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(m){case C.PlaylistContextType.MANIFEST:case C.PlaylistContextType.LEVEL:this.hls.trigger(S.Events.LEVEL_LOADED,{details:c,level:p||0,id:b||0,stats:i,networkDetails:T,deliveryDirectives:r});break;case C.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(S.Events.AUDIO_TRACK_LOADED,{details:c,id:b||0,groupId:_||"",stats:i,networkDetails:T,deliveryDirectives:r});break;case C.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(S.Events.SUBTITLE_TRACK_LOADED,{details:c,id:b||0,groupId:_||"",stats:i,networkDetails:T,deliveryDirectives:r});break}},e}();F.default=o},"./src/polyfills/number.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"isFiniteNumber",function(){return U}),w.d(F,"MAX_SAFE_INTEGER",function(){return S});var U=Number.isFinite||function(I){return typeof I=="number"&&isFinite(I)},S=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(_e,F,w){"use strict";w.r(F);var U=function(){function S(){}return S.getSilentFrame=function(N,k){switch(N){case"mp4a.40.2":if(k===1)return new Uint8Array([0,200,0,128,35,128]);if(k===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(k===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(k===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(k===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(k===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(k===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(k===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(k===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},S}();F.default=U},"./src/remux/mp4-generator.ts":function(_e,F,w){"use strict";w.r(F);var U=Math.pow(2,32)-1,S=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 k;for(k in I.types)I.types.hasOwnProperty(k)&&(I.types[k]=[k.charCodeAt(0),k.charCodeAt(1),k.charCodeAt(2),k.charCodeAt(3)]);var A=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]),C=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:A,audio:C};var y=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),h=new Uint8Array([0,0,0,0,0,0,0,0]);I.STTS=I.STSC=I.STCO=h,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 u=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),e=new Uint8Array([0,0,0,1]);I.FTYP=I.box(I.types.ftyp,u,e,u,o),I.DINF=I.box(I.types.dinf,I.box(I.types.dref,y))},I.box=function(k){for(var A=8,C=arguments.length,y=new Array(C>1?C-1:0),h=1;h<C;h++)y[h-1]=arguments[h];for(var u=y.length,o=u;u--;)A+=y[u].byteLength;var e=new Uint8Array(A);for(e[0]=A>>24&255,e[1]=A>>16&255,e[2]=A>>8&255,e[3]=A&255,e.set(k,4),u=0,A=8;u<o;u++)e.set(y[u],A),A+=y[u].byteLength;return e},I.hdlr=function(k){return I.box(I.types.hdlr,I.HDLR_TYPES[k])},I.mdat=function(k){return I.box(I.types.mdat,k)},I.mdhd=function(k,A){A*=k;var C=Math.floor(A/(U+1)),y=Math.floor(A%(U+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,k>>24&255,k>>16&255,k>>8&255,k&255,C>>24,C>>16&255,C>>8&255,C&255,y>>24,y>>16&255,y>>8&255,y&255,85,196,0,0]))},I.mdia=function(k){return I.box(I.types.mdia,I.mdhd(k.timescale,k.duration),I.hdlr(k.type),I.minf(k))},I.mfhd=function(k){return I.box(I.types.mfhd,new Uint8Array([0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255]))},I.minf=function(k){return k.type==="audio"?I.box(I.types.minf,I.box(I.types.smhd,I.SMHD),I.DINF,I.stbl(k)):I.box(I.types.minf,I.box(I.types.vmhd,I.VMHD),I.DINF,I.stbl(k))},I.moof=function(k,A,C){return I.box(I.types.moof,I.mfhd(k),I.traf(C,A))},I.moov=function(k){for(var A=k.length,C=[];A--;)C[A]=I.trak(k[A]);return I.box.apply(null,[I.types.moov,I.mvhd(k[0].timescale,k[0].duration)].concat(C).concat(I.mvex(k)))},I.mvex=function(k){for(var A=k.length,C=[];A--;)C[A]=I.trex(k[A]);return I.box.apply(null,[I.types.mvex].concat(C))},I.mvhd=function(k,A){A*=k;var C=Math.floor(A/(U+1)),y=Math.floor(A%(U+1)),h=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,C>>24,C>>16&255,C>>8&255,C&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,h)},I.sdtp=function(k){var A=k.samples||[],C=new Uint8Array(4+A.length),y,h;for(y=0;y<A.length;y++)h=A[y].flags,C[y+4]=h.dependsOn<<4|h.isDependedOn<<2|h.hasRedundancy;return I.box(I.types.sdtp,C)},I.stbl=function(k){return I.box(I.types.stbl,I.stsd(k),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(k){var A=[],C=[],y,h,u;for(y=0;y<k.sps.length;y++)h=k.sps[y],u=h.byteLength,A.push(u>>>8&255),A.push(u&255),A=A.concat(Array.prototype.slice.call(h));for(y=0;y<k.pps.length;y++)h=k.pps[y],u=h.byteLength,C.push(u>>>8&255),C.push(u&255),C=C.concat(Array.prototype.slice.call(h));var o=I.box(I.types.avcC,new Uint8Array([1,A[3],A[4],A[5],252|3,224|k.sps.length].concat(A).concat([k.pps.length]).concat(C))),e=k.width,d=k.height,s=k.pixelRatio[0],t=k.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,e>>8&255,e&255,d>>8&255,d&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,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([s>>24,s>>16&255,s>>8&255,s&255,t>>24,t>>16&255,t>>8&255,t&255])))},I.esds=function(k){var A=k.config.length;return new Uint8Array([0,0,0,0,3,23+A,0,1,0,4,15+A,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([A]).concat(k.config).concat([6,1,2]))},I.mp4a=function(k){var A=k.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,k.channelCount,0,16,0,0,0,0,A>>8&255,A&255,0,0]),I.box(I.types.esds,I.esds(k)))},I.mp3=function(k){var A=k.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,k.channelCount,0,16,0,0,0,0,A>>8&255,A&255,0,0]))},I.stsd=function(k){return k.type==="audio"?!k.isAAC&&k.codec==="mp3"?I.box(I.types.stsd,I.STSD,I.mp3(k)):I.box(I.types.stsd,I.STSD,I.mp4a(k)):I.box(I.types.stsd,I.STSD,I.avc1(k))},I.tkhd=function(k){var A=k.id,C=k.duration*k.timescale,y=k.width,h=k.height,u=Math.floor(C/(U+1)),o=Math.floor(C%(U+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,A>>24&255,A>>16&255,A>>8&255,A&255,0,0,0,0,u>>24,u>>16&255,u>>8&255,u&255,o>>24,o>>16&255,o>>8&255,o&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,y>>8&255,y&255,0,0,h>>8&255,h&255,0,0]))},I.traf=function(k,A){var C=I.sdtp(k),y=k.id,h=Math.floor(A/(U+1)),u=Math.floor(A%(U+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,h>>24,h>>16&255,h>>8&255,h&255,u>>24,u>>16&255,u>>8&255,u&255])),I.trun(k,C.length+16+20+8+16+8+8),C)},I.trak=function(k){return k.duration=k.duration||4294967295,I.box(I.types.trak,I.tkhd(k),I.mdia(k))},I.trex=function(k){var A=k.id;return I.box(I.types.trex,new Uint8Array([0,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},I.trun=function(k,A){var C=k.samples||[],y=C.length,h=12+16*y,u=new Uint8Array(h),o,e,d,s,t,i;for(A+=8+h,u.set([0,0,15,1,y>>>24&255,y>>>16&255,y>>>8&255,y&255,A>>>24&255,A>>>16&255,A>>>8&255,A&255],0),o=0;o<y;o++)e=C[o],d=e.duration,s=e.size,t=e.flags,i=e.cts,u.set([d>>>24&255,d>>>16&255,d>>>8&255,d&255,s>>>24&255,s>>>16&255,s>>>8&255,s&255,t.isLeading<<2|t.dependsOn,t.isDependedOn<<6|t.hasRedundancy<<4|t.paddingValue<<1|t.isNonSync,t.degradPrio&240<<8,t.degradPrio&15,i>>>24&255,i>>>16&255,i>>>8&255,i&255],12+16*o);return I.box(I.types.trun,u)},I.initSegment=function(k){I.types||I.init();var A=I.moov(k),C=new Uint8Array(I.FTYP.byteLength+A.byteLength);return C.set(I.FTYP),C.set(A,I.FTYP.byteLength),C},I}();S.types=void 0,S.HDLR_TYPES=void 0,S.STTS=void 0,S.STSC=void 0,S.STCO=void 0,S.STSZ=void 0,S.VMHD=void 0,S.SMHD=void 0,S.STSD=void 0,S.FTYP=void 0,S.DINF=void 0,F.default=S},"./src/remux/mp4-remuxer.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"default",function(){return i}),w.d(F,"normalizePts",function(){return n});var U=w("./src/polyfills/number.ts"),S=w("./src/remux/aac-helper.ts"),I=w("./src/remux/mp4-generator.ts"),N=w("./src/events.ts"),k=w("./src/errors.ts"),A=w("./src/utils/logger.ts"),C=w("./src/types/loader.ts"),y=w("./src/utils/timescale-conversion.ts");function h(){return h=Object.assign||function(b){for(var _=1;_<arguments.length;_++){var a=arguments[_];for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c])}return b},h.apply(this,arguments)}var u=10*1e3,o=1024,e=1152,d=null,s=null,t=!1,i=function(){function b(a,c,r,l){if(l===void 0&&(l=""),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=a,this.config=c,this.typeSupported=r,this.ISGenerated=!1,d===null){var v=navigator.userAgent||"",f=v.match(/Chrome\/(\d+)/i);d=f?parseInt(f[1]):0}if(s===null){var x=navigator.userAgent.match(/Safari\/(\d+)/i);s=x?parseInt(x[1]):0}t=!!d&&d<75||!!s&&s<600}var _=b.prototype;return _.destroy=function(){},_.resetTimeStamp=function(c){A.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},_.resetNextTimestamp=function(){A.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},_.resetInitSegment=function(){A.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},_.getVideoStartPts=function(c){var r=!1,l=c.reduce(function(v,f){var x=f.pts-v;return x<-4294967296?(r=!0,n(v,f.pts)):x>0?v:f.pts},c[0].pts);return r&&A.logger.debug("PTS rollover detected"),l},_.remux=function(c,r,l,v,f,x,R,O){var B,j,K,L,H,Y,ae=f,Z=f,ce=c.pid>-1,de=r.pid>-1,q=r.samples.length,te=c.samples.length>0,he=q>1,J=(!ce||te)&&(!de||he)||this.ISGenerated||R;if(J){this.ISGenerated||(K=this.generateIS(c,r,f));var X=this.isVideoContiguous,ye=-1;if(he&&(ye=T(r.samples),!X&&this.config.forceKeyFrameOnDiscontinuity))if(Y=!0,ye>0){A.logger.warn("[mp4-remuxer]: Dropped "+ye+" out of "+q+" video samples due to a missing keyframe");var we=this.getVideoStartPts(r.samples);r.samples=r.samples.slice(ye),r.dropped+=ye,Z+=(r.samples[0].pts-we)/(r.timescale||9e4)}else ye===-1&&(A.logger.warn("[mp4-remuxer]: No keyframe found out of "+q+" video samples"),Y=!1);if(this.ISGenerated){if(te&&he){var Le=this.getVideoStartPts(r.samples),xe=n(c.samples[0].pts,Le)-Le,Re=xe/r.inputTimeScale;ae+=Math.max(0,Re),Z+=Math.max(0,-Re)}if(te){if(c.samplerate||(A.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),K=this.generateIS(c,r,f)),j=this.remuxAudio(c,ae,this.isAudioContiguous,x,de||he||O===C.PlaylistLevelType.AUDIO?Z:void 0),he){var Te=j?j.endPTS-j.startPTS:0;r.inputTimeScale||(A.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),K=this.generateIS(c,r,f)),B=this.remuxVideo(r,Z,X,Te)}}else he&&(B=this.remuxVideo(r,Z,X,0));B&&(B.firstKeyFrame=ye,B.independent=ye!==-1)}}return this.ISGenerated&&(l.samples.length&&(H=this.remuxID3(l,f)),v.samples.length&&(L=this.remuxText(v,f))),{audio:j,video:B,initSegment:K,independent:Y,text:L,id3:H}},_.generateIS=function(c,r,l){var v=c.samples,f=r.samples,x=this.typeSupported,R={},O=!Object(U.isFiniteNumber)(this._initPTS),B="audio/mp4",j,K,L;if(O&&(j=K=Infinity),c.config&&v.length&&(c.timescale=c.samplerate,c.isAAC||(x.mpeg?(B="audio/mpeg",c.codec=""):x.mp3&&(c.codec="mp3")),R.audio={id:"audio",container:B,codec:c.codec,initSegment:!c.isAAC&&x.mpeg?new Uint8Array(0):I.default.initSegment([c]),metadata:{channelCount:c.channelCount}},O&&(L=c.inputTimeScale,j=K=v[0].pts-Math.round(L*l))),r.sps&&r.pps&&f.length&&(r.timescale=r.inputTimeScale,R.video={id:"main",container:"video/mp4",codec:r.codec,initSegment:I.default.initSegment([r]),metadata:{width:r.width,height:r.height}},O)){L=r.inputTimeScale;var H=this.getVideoStartPts(f),Y=Math.round(L*l);K=Math.min(K,n(f[0].dts,H)-Y),j=Math.min(j,H-Y)}if(Object.keys(R).length)return this.ISGenerated=!0,O&&(this._initPTS=j,this._initDTS=K),{tracks:R,initPTS:j,timescale:L}},_.remuxVideo=function(c,r,l,v){var f=c.inputTimeScale,x=c.samples,R=[],O=x.length,B=this._initPTS,j=this.nextAvcDts,K=8,L,H,Y,ae=Number.POSITIVE_INFINITY,Z=Number.NEGATIVE_INFINITY,ce=0,de=!1;if(!l||j===null){var q=r*f,te=x[0].pts-n(x[0].dts,x[0].pts);j=q-te}for(var he=0;he<O;he++){var J=x[he];if(J.pts=n(J.pts-B,j),J.dts=n(J.dts-B,j),J.dts>J.pts){var X=9e4*.2;ce=Math.max(Math.min(ce,J.pts-J.dts),-1*X)}J.dts<x[he>0?he-1:he].dts&&(de=!0)}de&&x.sort(function(bt,St){var rt=bt.dts-St.dts,Xt=bt.pts-St.pts;return rt||Xt}),H=x[0].dts,Y=x[x.length-1].dts;var ye=Math.round((Y-H)/(O-1));if(ce<0){if(ce<ye*-2){A.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(y.toMsFromMpegTsClock)(-ye,!0)+" ms");for(var we=ce,Le=0;Le<O;Le++)x[Le].dts=we=Math.max(we,x[Le].pts-ye),x[Le].pts=Math.max(we,x[Le].pts)}else{A.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(y.toMsFromMpegTsClock)(ce,!0)+" ms to overcome this issue");for(var xe=0;xe<O;xe++)x[xe].dts=x[xe].dts+ce}H=x[0].dts}if(l){var Re=H-j,Te=Re>ye,Oe=Re<-1;if(Te||Oe){Te?A.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(Re,!0)+" ms ("+Re+"dts) hole between fragments detected, filling it"):A.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(-Re,!0)+" ms ("+Re+"dts) overlapping between fragments detected"),H=j;var Ie=x[0].pts-Re;x[0].dts=H,x[0].pts=Ie,A.logger.log("Video: First PTS/DTS adjusted: "+Object(y.toMsFromMpegTsClock)(Ie,!0)+"/"+Object(y.toMsFromMpegTsClock)(H,!0)+", delta: "+Object(y.toMsFromMpegTsClock)(Re,!0)+" ms")}}t&&(H=Math.max(0,H));for(var Me=0,Ne=0,Be=0;Be<O;Be++){for(var Pe=x[Be],Ye=Pe.units,Ke=Ye.length,Se=0,je=0;je<Ke;je++)Se+=Ye[je].data.length;Ne+=Se,Me+=Ke,Pe.length=Se,Pe.dts=Math.max(Pe.dts,H),Pe.pts=Math.max(Pe.pts,Pe.dts,0),ae=Math.min(Pe.pts,ae),Z=Math.max(Pe.pts,Z)}Y=x[O-1].dts;var et=Ne+4*Me+8,Je;try{Je=new Uint8Array(et)}catch(bt){this.observer.emit(N.Events.ERROR,N.Events.ERROR,{type:k.ErrorTypes.MUX_ERROR,details:k.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:et,reason:"fail allocating video mdat "+et});return}var Ze=new DataView(Je.buffer);Ze.setUint32(0,et),Je.set(I.default.types.mdat,4);for(var We=0;We<O;We++){for(var nt=x[We],qe=nt.units,De=0,Ge=0,ne=qe.length;Ge<ne;Ge++){var le=qe[Ge],fe=le.data,$=le.data.byteLength;Ze.setUint32(K,$),K+=4,Je.set(fe,K),K+=$,De+=4+$}if(We<O-1)L=x[We+1].dts-nt.dts;else{var Q=this.config,re=nt.dts-x[We>0?We-1:We].dts;if(Q.stretchShortVideoTrack&&this.nextAudioPts!==null){var me=Math.floor(Q.maxBufferHole*f),Ae=(v?ae+v*f:this.nextAudioPts)-nt.pts;Ae>me?(L=Ae-re,L<0&&(L=re),A.logger.log("[mp4-remuxer]: It is approximately "+Ae/90+" ms to the next segment; using duration "+L/90+" ms for the last video frame.")):L=re}else L=re}var ke=Math.round(nt.pts-nt.dts);R.push(new m(nt.key,L,De,ke))}if(R.length&&d&&d<70){var ze=R[0].flags;ze.dependsOn=2,ze.isNonSync=0}console.assert(L!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=j=Y+L,this.isVideoContiguous=!0;var lt=I.default.moof(c.sequenceNumber++,H,h({},c,{samples:R})),pt="video",ct={data1:lt,data2:Je,startPTS:ae/f,endPTS:(Z+L)/f,startDTS:H/f,endDTS:j/f,type:pt,hasAudio:!1,hasVideo:!0,nb:R.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(Je.length,"MDAT length must not be zero"),ct},_.remuxAudio=function(c,r,l,v,f){var x=c.inputTimeScale,R=c.samplerate?c.samplerate:x,O=x/R,B=c.isAAC?o:e,j=B*O,K=this._initPTS,L=!c.isAAC&&this.typeSupported.mpeg,H=[],Y=c.samples,ae=L?0:8,Z=this.nextAudioPts||-1,ce=r*x;if(this.isAudioContiguous=l=l||Y.length&&Z>0&&(v&&Math.abs(ce-Z)<9e3||Math.abs(n(Y[0].pts-K,ce)-Z)<20*j),Y.forEach(function(fe){fe.pts=n(fe.pts-K,ce)}),!l||Z<0){if(Y=Y.filter(function(fe){return fe.pts>=0}),!Y.length)return;f===0?Z=0:v?Z=Math.max(0,ce):Z=Y[0].pts}if(c.isAAC)for(var de=f!==void 0,q=this.config.maxAudioFramesDrift,te=0,he=Z;te<Y.length;te++){var J=Y[te],X=J.pts,ye=X-he,we=Math.abs(1e3*ye/x);if(ye<=-q*j&&de)te===0&&(A.logger.warn("Audio frame @ "+(X/x).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*ye/x)+" ms."),this.nextAudioPts=Z=he=X);else if(ye>=q*j&&we<u&&de){var Le=Math.round(ye/j);he=X-Le*j,he<0&&(Le--,he+=j),te===0&&(this.nextAudioPts=Z=he),A.logger.warn("[mp4-remuxer]: Injecting "+Le+" audio frame @ "+(he/x).toFixed(3)+"s due to "+Math.round(1e3*ye/x)+" ms gap.");for(var xe=0;xe<Le;xe++){var Re=Math.max(he,0),Te=S.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);Te||(A.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Te=J.unit.subarray()),Y.splice(te,0,{unit:Te,pts:Re}),he+=j,te++}}J.pts=he,he+=j}for(var Oe=null,Ie=null,Me,Ne=0,Be=Y.length;Be--;)Ne+=Y[Be].unit.byteLength;for(var Pe=0,Ye=Y.length;Pe<Ye;Pe++){var Ke=Y[Pe],Se=Ke.unit,je=Ke.pts;if(Ie!==null){var et=H[Pe-1];et.duration=Math.round((je-Ie)/O)}else if(l&&c.isAAC&&(je=Z),Oe=je,Ne>0){Ne+=ae;try{Me=new Uint8Array(Ne)}catch(fe){this.observer.emit(N.Events.ERROR,N.Events.ERROR,{type:k.ErrorTypes.MUX_ERROR,details:k.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ne,reason:"fail allocating audio mdat "+Ne});return}if(!L){var Je=new DataView(Me.buffer);Je.setUint32(0,Ne),Me.set(I.default.types.mdat,4)}}else return;Me.set(Se,ae);var Ze=Se.byteLength;ae+=Ze,H.push(new m(!0,B,Ze,0)),Ie=je}var We=H.length;if(!We)return;var nt=H[H.length-1];this.nextAudioPts=Z=Ie+O*nt.duration;var qe=L?new Uint8Array(0):I.default.moof(c.sequenceNumber++,Oe/O,h({},c,{samples:H}));c.samples=[];var De=Oe/x,Ge=Z/x,ne="audio",le={data1:qe,data2:Me,startPTS:De,endPTS:Ge,startDTS:De,endDTS:Ge,type:ne,hasAudio:!0,hasVideo:!1,nb:We};return this.isAudioContiguous=!0,console.assert(Me.length,"MDAT length must not be zero"),le},_.remuxEmptyAudio=function(c,r,l,v){var f=c.inputTimeScale,x=c.samplerate?c.samplerate:f,R=f/x,O=this.nextAudioPts,B=(O!==null?O:v.startDTS*f)+this._initDTS,j=v.endDTS*f+this._initDTS,K=R*o,L=Math.ceil((j-B)/K),H=S.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(A.logger.warn("[mp4-remuxer]: remux empty Audio"),!H){A.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Y=[],ae=0;ae<L;ae++){var Z=B+ae*K;Y.push({unit:H,pts:Z,dts:Z})}return c.samples=Y,this.remuxAudio(c,r,l,!1)},_.remuxID3=function(c,r){var l=c.samples.length;if(!l)return;for(var v=c.inputTimeScale,f=this._initPTS,x=this._initDTS,R=0;R<l;R++){var O=c.samples[R];O.pts=n(O.pts-f,r*v)/v,O.dts=n(O.dts-x,r*v)/v}var B=c.samples;return c.samples=[],{samples:B}},_.remuxText=function(c,r){var l=c.samples.length;if(!l)return;for(var v=c.inputTimeScale,f=this._initPTS,x=0;x<l;x++){var R=c.samples[x];R.pts=n(R.pts-f,r*v)/v}c.samples.sort(function(B,j){return B.pts-j.pts});var O=c.samples;return c.samples=[],{samples:O}},b}();function n(b,_){var a;if(_===null)return b;for(_<b?a=-8589934592:a=8589934592;Math.abs(b-_)>4294967296;)b+=a;return b}function T(b){for(var _=0;_<b.length;_++)if(b[_].key)return _;return-1}var m=function(_,a,c,r){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=a,this.size=c,this.cts=r,this.flags=new p(_)},p=function(_){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=_?2:1,this.isNonSync=_?0:1}},"./src/remux/passthrough-remuxer.ts":function(_e,F,w){"use strict";w.r(F);var U=w("./src/polyfills/number.ts"),S=w("./src/utils/mp4-tools.ts"),I=w("./src/loader/fragment.ts"),N=w("./src/utils/logger.ts"),k=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 h=y.prototype;return h.destroy=function(){},h.resetTimeStamp=function(o){this.initPTS=o,this.lastEndDTS=null},h.resetNextTimestamp=function(){this.lastEndDTS=null},h.resetInitSegment=function(o,e,d){this.audioCodec=e,this.videoCodec=d,this.generateInitSegment(o),this.emitInitSegment=!0},h.generateInitSegment=function(o){var e=this.audioCodec,d=this.videoCodec;if(!o||!o.byteLength){this.initTracks=void 0,this.initData=void 0;return}var s=this.initData=Object(S.parseInitSegment)(o);e||(e=C(s.audio,I.ElementaryStreamTypes.AUDIO)),d||(d=C(s.video,I.ElementaryStreamTypes.VIDEO));var t={};s.audio&&s.video?t.audiovideo={container:"video/mp4",codec:e+","+d,initSegment:o,id:"main"}:s.audio?t.audio={container:"audio/mp4",codec:e,initSegment:o,id:"audio"}:s.video?t.video={container:"video/mp4",codec:d,initSegment:o,id:"main"}:N.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=t},h.remux=function(o,e,d,s,t){var i=this.initPTS,n=this.lastEndDTS,T={audio:void 0,video:void 0,text:s,id3:d,initSegment:void 0};Object(U.isFiniteNumber)(n)||(n=this.lastEndDTS=t||0);var m=e.samples;if(!m||!m.length)return T;var p={initPTS:void 0,timescale:1},b=this.initData;if((!b||!b.length)&&(this.generateInitSegment(m),b=this.initData),!b||!b.length)return N.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),T;this.emitInitSegment&&(p.tracks=this.initTracks,this.emitInitSegment=!1),Object(U.isFiniteNumber)(i)||(this.initPTS=p.initPTS=i=A(b,m,n));var _=Object(S.getDuration)(m,b),a=n,c=_+a;Object(S.offsetStartDTS)(b,m,i),_>0?this.lastEndDTS=c:(N.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var r=!!b.audio,l=!!b.video,v="";r&&(v+="audio"),l&&(v+="video");var f={data1:m,startPTS:a,startDTS:a,endPTS:c,endDTS:c,type:v,hasAudio:r,hasVideo:l,nb:1,dropped:0};return T.audio=f.type==="audio"?f:void 0,T.video=f.type!=="audio"?f:void 0,T.text=s,T.id3=d,T.initSegment=p,T},y}(),A=function(h,u,o){return Object(S.getStartDTS)(h,u)-o};function C(y,h){var u=y==null?void 0:y.codec;return u&&u.length>4?u:u==="hvc1"?"hvc1.1.c.L120.90":u==="av01"?"av01.0.04M.08":u==="avc1"||h===I.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}F.default=k},"./src/task-loop.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"default",function(){return U});var U=function(){function S(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var I=S.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(k){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,k),!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(){},S}()},"./src/types/cmcd.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"CMCDVersion",function(){return U}),w.d(F,"CMCDObjectType",function(){return S}),w.d(F,"CMCDStreamingFormat",function(){return I}),w.d(F,"CMCDStreamType",function(){return N});var U=1,S;(function(k){k.MANIFEST="m",k.AUDIO="a",k.VIDEO="v",k.MUXED="av",k.INIT="i",k.CAPTION="c",k.TIMED_TEXT="tt",k.KEY="k",k.OTHER="o"})(S||(S={}));var I;(function(k){k.DASH="d",k.HLS="h",k.SMOOTH="s",k.OTHER="o"})(I||(I={}));var N;(function(k){k.VOD="v",k.LIVE="l"})(N||(N={}))},"./src/types/level.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"HlsSkip",function(){return I}),w.d(F,"getSkipValue",function(){return N}),w.d(F,"HlsUrlParameters",function(){return k}),w.d(F,"Level",function(){return A});function U(C,y){for(var h=0;h<y.length;h++){var u=y[h];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(C,u.key,u)}}function S(C,y,h){return y&&U(C.prototype,y),h&&U(C,h),C}var I;(function(C){C.No="",C.Yes="YES",C.v2="v2"})(I||(I={}));function N(C,y){var h=C.canSkipUntil,u=C.canSkipDateRanges,o=C.endSN,e=y!==void 0?y-o:0;return h&&e<h?u?I.v2:I.Yes:I.No}var k=function(){function C(h,u,o){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=h,this.part=u,this.skip=o}var y=C.prototype;return y.addDirectives=function(u){var o=new self.URL(u);return this.msn!==void 0&&o.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&o.searchParams.set("_HLS_part",this.part.toString()),this.skip&&o.searchParams.set("_HLS_skip",this.skip),o.toString()},C}(),A=function(){function C(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(h){return h}).join(",").replace(/\.[^.,]+/g,"")}return S(C,[{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(h){var u=h%this.url.length;this._urlId!==u&&(this.details=void 0,this._urlId=u)}}]),C}()},"./src/types/loader.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"PlaylistContextType",function(){return U}),w.d(F,"PlaylistLevelType",function(){return S});var U;(function(I){I.MANIFEST="manifest",I.LEVEL="level",I.AUDIO_TRACK="audioTrack",I.SUBTITLE_TRACK="subtitleTrack"})(U||(U={}));var S;(function(I){I.MAIN="main",I.AUDIO="audio",I.SUBTITLE="subtitle"})(S||(S={}))},"./src/types/transmuxer.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"ChunkMetadata",function(){return U});var U=function(N,k,A,C,y,h){C===void 0&&(C=0),y===void 0&&(y=-1),h===void 0&&(h=!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=S(),this.buffering={audio:S(),video:S(),audiovideo:S()},this.level=N,this.sn=k,this.id=A,this.size=C,this.part=y,this.partial=h};function S(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"AttrList",function(){return I});var U=/^(\d+)x(\d+)$/,S=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,I=function(){function N(A){typeof A=="string"&&(A=N.parseAttrList(A));for(var C in A)A.hasOwnProperty(C)&&(this[C]=A[C])}var k=N.prototype;return k.decimalInteger=function(C){var y=parseInt(this[C],10);return y>Number.MAX_SAFE_INTEGER?Infinity:y},k.hexadecimalInteger=function(C){if(this[C]){var y=(this[C]||"0x").slice(2);y=(y.length&1?"0":"")+y;for(var h=new Uint8Array(y.length/2),u=0;u<y.length/2;u++)h[u]=parseInt(y.slice(u*2,u*2+2),16);return h}else return null},k.hexadecimalIntegerAsNumber=function(C){var y=parseInt(this[C],16);return y>Number.MAX_SAFE_INTEGER?Infinity:y},k.decimalFloatingPoint=function(C){return parseFloat(this[C])},k.optionalFloat=function(C,y){var h=this[C];return h?parseFloat(h):y},k.enumeratedString=function(C){return this[C]},k.bool=function(C){return this[C]==="YES"},k.decimalResolution=function(C){var y=U.exec(this[C]);return y===null?void 0:{width:parseInt(y[1],10),height:parseInt(y[2],10)}},N.parseAttrList=function(C){var y,h={},u='"';for(S.lastIndex=0;(y=S.exec(C))!==null;){var o=y[2];o.indexOf(u)===0&&o.lastIndexOf(u)===o.length-1&&(o=o.slice(1,-1)),h[y[1]]=o}return h},N}()},"./src/utils/binary-search.ts":function(_e,F,w){"use strict";w.r(F);var U={search:function(I,N){for(var k=0,A=I.length-1,C=null,y=null;k<=A;){C=(k+A)/2|0,y=I[C];var h=N(y);if(h>0)k=C+1;else if(h<0)A=C-1;else return y}return null}};F.default=U},"./src/utils/buffer-helper.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"BufferHelper",function(){return I});var U=w("./src/utils/logger.ts"),S={length:0,start:function(){return 0},end:function(){return 0}},I=function(){function N(){}return N.isBuffered=function(A,C){try{if(A){for(var y=N.getBuffered(A),h=0;h<y.length;h++)if(C>=y.start(h)&&C<=y.end(h))return!0}}catch(u){}return!1},N.bufferInfo=function(A,C,y){try{if(A){var h=N.getBuffered(A),u=[],o;for(o=0;o<h.length;o++)u.push({start:h.start(o),end:h.end(o)});return this.bufferedInfo(u,C,y)}}catch(e){}return{len:0,start:C,end:C,nextStart:void 0}},N.bufferedInfo=function(A,C,y){C=Math.max(0,C),A.sort(function(p,b){var _=p.start-b.start;return _||b.end-p.end});var h=[];if(y)for(var u=0;u<A.length;u++){var o=h.length;if(o){var e=h[o-1].end;A[u].start-e<y?A[u].end>e&&(h[o-1].end=A[u].end):h.push(A[u])}else h.push(A[u])}else h=A;for(var d=0,s,t=C,i=C,n=0;n<h.length;n++){var T=h[n].start,m=h[n].end;if(C+y>=T&&C<m)t=T,i=m,d=i-C;else if(C+y<T){s=T;break}}return{len:d,start:t||0,end:i||0,nextStart:s}},N.getBuffered=function(A){try{return A.buffered}catch(C){return U.logger.log("failed to get media.buffered",C),S}},N}()},"./src/utils/cea-608-parser.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"Row",function(){return i}),w.d(F,"CaptionScreen",function(){return n});var U=w("./src/utils/logger.ts"),S={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(c){var r=c;return S.hasOwnProperty(c)&&(r=S[c]),String.fromCharCode(r)},N=15,k=100,A={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},C={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},h={25:2,26:4,29:6,30:8,31:10,27:13,28:15},u=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],o;(function(a){a[a.ERROR=0]="ERROR",a[a.TEXT=1]="TEXT",a[a.WARNING=2]="WARNING",a[a.INFO=2]="INFO",a[a.DEBUG=3]="DEBUG",a[a.DATA=3]="DATA"})(o||(o={}));var e=function(){function a(){this.time=null,this.verboseLevel=o.ERROR}var c=a.prototype;return c.log=function(l,v){this.verboseLevel>=l&&U.logger.log(this.time+" ["+l+"] "+v)},a}(),d=function(c){for(var r=[],l=0;l<c.length;l++)r.push(c[l].toString(16));return r},s=function(){function a(r,l,v,f,x){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=r||"white",this.underline=l||!1,this.italics=v||!1,this.background=f||"black",this.flash=x||!1}var c=a.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(l){for(var v=["foreground","underline","italics","background","flash"],f=0;f<v.length;f++){var x=v[f];l.hasOwnProperty(x)&&(this[x]=l[x])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(l){return this.foreground===l.foreground&&this.underline===l.underline&&this.italics===l.italics&&this.background===l.background&&this.flash===l.flash},c.copy=function(l){this.foreground=l.foreground,this.underline=l.underline,this.italics=l.italics,this.background=l.background,this.flash=l.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},a}(),t=function(){function a(r,l,v,f,x,R){this.uchar=void 0,this.penState=void 0,this.uchar=r||" ",this.penState=new s(l,v,f,x,R)}var c=a.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(l,v){this.uchar=l,this.penState.copy(v)},c.setPenState=function(l){this.penState.copy(l)},c.equals=function(l){return this.uchar===l.uchar&&this.penState.equals(l.penState)},c.copy=function(l){this.uchar=l.uchar,this.penState.copy(l.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},a}(),i=function(){function a(r){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var l=0;l<k;l++)this.chars.push(new t);this.logger=r,this.pos=0,this.currPenState=new s}var c=a.prototype;return c.equals=function(l){for(var v=!0,f=0;f<k;f++)if(!this.chars[f].equals(l.chars[f])){v=!1;break}return v},c.copy=function(l){for(var v=0;v<k;v++)this.chars[v].copy(l.chars[v])},c.isEmpty=function(){for(var l=!0,v=0;v<k;v++)if(!this.chars[v].isEmpty()){l=!1;break}return l},c.setCursor=function(l){this.pos!==l&&(this.pos=l),this.pos<0?(this.logger.log(o.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>k&&(this.logger.log(o.DEBUG,"Too large cursor position "+this.pos),this.pos=k)},c.moveCursor=function(l){var v=this.pos+l;if(l>1)for(var f=this.pos+1;f<v+1;f++)this.chars[f].setPenState(this.currPenState);this.setCursor(v)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(l){l>=144&&this.backSpace();var v=I(l);if(this.pos>=k){this.logger.log(o.ERROR,"Cannot insert "+l.toString(16)+" ("+v+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(v,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(l){var v;for(v=l;v<k;v++)this.chars[v].reset()},c.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},c.clearToEndOfRow=function(){this.clearFromPos(this.pos)},c.getTextString=function(){for(var l=[],v=!0,f=0;f<k;f++){var x=this.chars[f].uchar;x!==" "&&(v=!1),l.push(x)}return v?"":l.join("")},c.setPenStyles=function(l){this.currPenState.setStyles(l);var v=this.chars[this.pos];v.setPenState(this.currPenState)},a}(),n=function(){function a(r){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var l=0;l<N;l++)this.rows.push(new i(r));this.logger=r,this.currRow=N-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=a.prototype;return c.reset=function(){for(var l=0;l<N;l++)this.rows[l].clear();this.currRow=N-1},c.equals=function(l){for(var v=!0,f=0;f<N;f++)if(!this.rows[f].equals(l.rows[f])){v=!1;break}return v},c.copy=function(l){for(var v=0;v<N;v++)this.rows[v].copy(l.rows[v])},c.isEmpty=function(){for(var l=!0,v=0;v<N;v++)if(!this.rows[v].isEmpty()){l=!1;break}return l},c.backSpace=function(){var l=this.rows[this.currRow];l.backSpace()},c.clearToEndOfRow=function(){var l=this.rows[this.currRow];l.clearToEndOfRow()},c.insertChar=function(l){var v=this.rows[this.currRow];v.insertChar(l)},c.setPen=function(l){var v=this.rows[this.currRow];v.setPenStyles(l)},c.moveCursor=function(l){var v=this.rows[this.currRow];v.moveCursor(l)},c.setCursor=function(l){this.logger.log(o.INFO,"setCursor: "+l);var v=this.rows[this.currRow];v.setCursor(l)},c.setPAC=function(l){this.logger.log(o.INFO,"pacData = "+JSON.stringify(l));var v=l.row-1;if(this.nrRollUpRows&&v<this.nrRollUpRows-1&&(v=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==v){for(var f=0;f<N;f++)this.rows[f].clear();var x=this.currRow+1-this.nrRollUpRows,R=this.lastOutputScreen;if(R){var O=R.rows[x].cueStartTime,B=this.logger.time;if(O&&B!==null&&O<B)for(var j=0;j<this.nrRollUpRows;j++)this.rows[v-this.nrRollUpRows+j+1].copy(R.rows[x+j])}}this.currRow=v;var K=this.rows[this.currRow];if(l.indent!==null){var L=l.indent,H=Math.max(L-1,0);K.setCursor(l.indent),l.color=K.chars[H].penState.foreground}var Y={foreground:l.color,underline:l.underline,italics:l.italics,background:"black",flash:!1};this.setPen(Y)},c.setBkgData=function(l){this.logger.log(o.INFO,"bkgData = "+JSON.stringify(l)),this.backSpace(),this.setPen(l),this.insertChar(32)},c.setRollUpRows=function(l){this.nrRollUpRows=l},c.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(o.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(o.TEXT,this.getDisplayText());var l=this.currRow+1-this.nrRollUpRows,v=this.rows.splice(l,1)[0];v.clear(),this.rows.splice(this.currRow,0,v),this.logger.log(o.INFO,"Rolling up")},c.getDisplayText=function(l){l=l||!1;for(var v=[],f="",x=-1,R=0;R<N;R++){var O=this.rows[R].getTextString();O&&(x=R+1,l?v.push("Row "+x+": '"+O+"'"):v.push(O.trim()))}return v.length>0&&(l?f="["+v.join(" | ")+"]":f=v.join(`
`)),f},c.getTextAndFormat=function(){return this.rows},a}(),T=function(){function a(r,l,v){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=r,this.outputFilter=l,this.mode=null,this.verbose=0,this.displayedMemory=new n(v),this.nonDisplayedMemory=new n(v),this.lastOutputScreen=new n(v),this.currRollUpRow=this.displayedMemory.rows[N-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=v}var c=a.prototype;return c.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[N-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(l){this.outputFilter=l},c.setPAC=function(l){this.writeScreen.setPAC(l)},c.setBkgData=function(l){this.writeScreen.setBkgData(l)},c.setMode=function(l){if(l===this.mode)return;this.mode=l,this.logger.log(o.INFO,"MODE="+l),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=l},c.insertChars=function(l){for(var v=0;v<l.length;v++)this.writeScreen.insertChar(l[v]);var f=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(o.INFO,f+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(o.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(o.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(o.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},c.ccAOF=function(){},c.ccAON=function(){},c.ccDER=function(){this.logger.log(o.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(l){this.logger.log(o.INFO,"RU("+l+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(l)},c.ccFON=function(){this.logger.log(o.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(o.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(o.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(o.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(o.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(o.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(o.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(o.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var l=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=l,this.writeScreen=this.nonDisplayedMemory,this.logger.log(o.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(l){this.logger.log(o.INFO,"TO("+l+") - Tab Offset"),this.writeScreen.moveCursor(l)},c.ccMIDROW=function(l){var v={flash:!1};if(v.underline=l%2===1,v.italics=l>=46,v.italics)v.foreground="white";else{var f=Math.floor(l/2)-16,x=["white","green","blue","cyan","red","yellow","magenta"];v.foreground=x[f]}this.logger.log(o.INFO,"MIDROW: "+JSON.stringify(v)),this.writeScreen.setPen(v)},c.outputDataUpdate=function(l){l===void 0&&(l=!1);var v=this.logger.time;if(v===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=v:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,v,this.lastOutputScreen),l&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:v),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(l){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,l,this.displayedMemory),this.cueStartTime=l))},a}(),m=function(){function a(r,l,v){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var f=new e;this.channels=[null,new T(r,l,f),new T(r+1,v,f)],this.cmdHistory=_(),this.logger=f}var c=a.prototype;return c.getHandler=function(l){return this.channels[l].getHandler()},c.setHandler=function(l,v){this.channels[l].setHandler(v)},c.addData=function(l,v){var f,x,R,O=!1;this.logger.time=l;for(var B=0;B<v.length;B+=2){if(x=v[B]&127,R=v[B+1]&127,x===0&&R===0)continue;if(this.logger.log(o.DATA,"["+d([v[B],v[B+1]])+"] -> ("+d([x,R])+")"),f=this.parseCmd(x,R),f||(f=this.parseMidrow(x,R)),f||(f=this.parsePAC(x,R)),f||(f=this.parseBackgroundAttributes(x,R)),!f&&(O=this.parseChars(x,R),O)){var j=this.currentChannel;if(j&&j>0){var K=this.channels[j];K.insertChars(O)}else this.logger.log(o.WARNING,"No channel found yet. TEXT-MODE?")}!f&&!O&&this.logger.log(o.WARNING,"Couldn't parse cleaned data "+d([x,R])+" orig: "+d([v[B],v[B+1]]))}},c.parseCmd=function(l,v){var f=this.cmdHistory,x=(l===20||l===28||l===21||l===29)&&v>=32&&v<=47,R=(l===23||l===31)&&v>=33&&v<=35;if(!(x||R))return!1;if(b(l,v,f))return p(null,null,f),this.logger.log(o.DEBUG,"Repeated command ("+d([l,v])+") is dropped"),!0;var O=l===20||l===21||l===23?1:2,B=this.channels[O];return l===20||l===21||l===28||l===29?v===32?B.ccRCL():v===33?B.ccBS():v===34?B.ccAOF():v===35?B.ccAON():v===36?B.ccDER():v===37?B.ccRU(2):v===38?B.ccRU(3):v===39?B.ccRU(4):v===40?B.ccFON():v===41?B.ccRDC():v===42?B.ccTR():v===43?B.ccRTD():v===44?B.ccEDM():v===45?B.ccCR():v===46?B.ccENM():v===47&&B.ccEOC():B.ccTO(v-32),p(l,v,f),this.currentChannel=O,!0},c.parseMidrow=function(l,v){var f=0;if((l===17||l===25)&&v>=32&&v<=47){if(l===17?f=1:f=2,f!==this.currentChannel)return this.logger.log(o.ERROR,"Mismatch channel in midrow parsing"),!1;var x=this.channels[f];return x?(x.ccMIDROW(v),this.logger.log(o.DEBUG,"MIDROW ("+d([l,v])+")"),!0):!1}return!1},c.parsePAC=function(l,v){var f,x=this.cmdHistory,R=(l>=17&&l<=23||l>=25&&l<=31)&&v>=64&&v<=127,O=(l===16||l===24)&&v>=64&&v<=95;if(!(R||O))return!1;if(b(l,v,x))return p(null,null,x),!0;var B=l<=23?1:2;v>=64&&v<=95?f=B===1?A[l]:y[l]:f=B===1?C[l]:h[l];var j=this.channels[B];return j?(j.setPAC(this.interpretPAC(f,v)),p(l,v,x),this.currentChannel=B,!0):!1},c.interpretPAC=function(l,v){var f,x={color:null,italics:!1,indent:null,underline:!1,row:l};return v>95?f=v-96:f=v-64,x.underline=(f&1)===1,f<=13?x.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(f/2)]:f<=15?(x.italics=!0,x.color="white"):x.indent=Math.floor((f-16)/2)*4,x},c.parseChars=function(l,v){var f,x=null,R=null;if(l>=25?(f=2,R=l-8):(f=1,R=l),R>=17&&R<=19){var O;R===17?O=v+80:R===18?O=v+112:O=v+144,this.logger.log(o.INFO,"Special char '"+I(O)+"' in channel "+f),x=[O]}else l>=32&&l<=127&&(x=v===0?[l]:[l,v]);if(x){var B=d(x);this.logger.log(o.DEBUG,"Char codes = "+B.join(",")),p(l,v,this.cmdHistory)}return x},c.parseBackgroundAttributes=function(l,v){var f=(l===16||l===24)&&v>=32&&v<=47,x=(l===23||l===31)&&v>=45&&v<=47;if(!(f||x))return!1;var R,O={};l===16||l===24?(R=Math.floor((v-32)/2),O.background=u[R],v%2===1&&(O.background=O.background+"_semi")):v===45?O.background="transparent":(O.foreground="black",v===47&&(O.underline=!0));var B=l<=23?1:2,j=this.channels[B];return j.setBkgData(O),p(l,v,this.cmdHistory),!0},c.reset=function(){for(var l=0;l<Object.keys(this.channels).length;l++){var v=this.channels[l];v&&v.reset()}this.cmdHistory=_()},c.cueSplitAtTime=function(l){for(var v=0;v<this.channels.length;v++){var f=this.channels[v];f&&f.cueSplitAtTime(l)}},a}();function p(a,c,r){r.a=a,r.b=c}function b(a,c,r){return r.a===a&&r.b===c}function _(){return{a:null,b:null}}F.default=m},"./src/utils/codecs.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"isCodecType",function(){return S}),w.d(F,"isCodecSupportedInMp4",function(){return I});var U={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 S(N,k){var A=U[k];return!!A&&A[N.slice(0,4)]===!0}function I(N,k){return MediaSource.isTypeSupported((k||"video")+'/mp4;codecs="'+N+'"')}},"./src/utils/cues.ts":function(_e,F,w){"use strict";w.r(F);var U=w("./src/utils/vttparser.ts"),S=w("./src/utils/webvtt-parser.ts"),I=w("./src/utils/texttrack-utils.ts"),N=/\s/,k={newCue:function(C,y,h,u){for(var o=[],e,d,s,t,i,n=self.VTTCue||self.TextTrackCue,T=0;T<u.rows.length;T++)if(e=u.rows[T],s=!0,t=0,i="",!e.isEmpty()){for(var m=0;m<e.chars.length;m++)N.test(e.chars[m].uchar)&&s?t++:(i+=e.chars[m].uchar,s=!1);e.cueStartTime=y,y===h&&(h+=1e-4),t>=16?t--:t++;var p=Object(U.fixLineBreaks)(i.trim()),b=Object(S.generateCueId)(y,h,p);(!C||!C.cues||!C.cues.getCueById(b))&&(d=new n(y,h,p),d.id=b,d.line=T+1,d.align="left",d.position=10+Math.min(80,Math.floor(t*8/32)*10),o.push(d))}return C&&o.length&&(o.sort(function(_,a){return _.line==="auto"||a.line==="auto"?0:_.line>8&&a.line>8?a.line-_.line:_.line-a.line}),o.forEach(function(_){return Object(I.addCueToTrack)(C,_)})),o}};F.default=k},"./src/utils/discontinuities.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"findFirstFragWithCC",function(){return N}),w.d(F,"shouldAlignOnDiscontinuities",function(){return k}),w.d(F,"findDiscontinuousReferenceFrag",function(){return A}),w.d(F,"adjustSlidingStart",function(){return y}),w.d(F,"alignStream",function(){return h}),w.d(F,"alignPDT",function(){return o}),w.d(F,"alignFragmentByPDTDelta",function(){return e}),w.d(F,"alignMediaPlaylistByPDT",function(){return d});var U=w("./src/polyfills/number.ts"),S=w("./src/utils/logger.ts"),I=w("./src/controller/level-helper.ts");function N(s,t){for(var i=null,n=0,T=s.length;n<T;n++){var m=s[n];if(m&&m.cc===t){i=m;break}}return i}function k(s,t,i){return!!(t.details&&(i.endCC>i.startCC||s&&s.cc<i.startCC))}function A(s,t){var i=s.fragments,n=t.fragments;if(!n.length||!i.length){S.logger.log("No fragments to align");return}var T=N(i,n[0].cc);if(!T||T&&!T.startPTS){S.logger.log("No frag in previous level to align on");return}return T}function C(s,t){if(s){var i=s.start+t;s.start=s.startPTS=i,s.endPTS=i+s.duration}}function y(s,t){for(var i=t.fragments,n=0,T=i.length;n<T;n++)C(i[n],s);t.fragmentHint&&C(t.fragmentHint,s),t.alignedSliding=!0}function h(s,t,i){if(!t)return;u(s,i,t),!i.alignedSliding&&t.details&&o(i,t.details),!i.alignedSliding&&t.details&&!i.skippedSegments&&Object(I.adjustSliding)(t.details,i)}function u(s,t,i){if(k(s,i,t)){var n=A(i.details,t);n&&Object(U.isFiniteNumber)(n.start)&&(S.logger.log("Adjusting PTS using last level due to CC increase within current level "+t.url),y(n.start,t))}}function o(s,t){if(!t.fragments.length||!s.hasProgramDateTime||!t.hasProgramDateTime)return;var i=t.fragments[0].programDateTime,n=s.fragments[0].programDateTime,T=(n-i)/1e3+t.fragments[0].start;T&&Object(U.isFiniteNumber)(T)&&(S.logger.log("Adjusting PTS using programDateTime delta "+(n-i)+"ms, sliding:"+T.toFixed(3)+" "+s.url+" "),y(T,s))}function e(s,t){var i=s.programDateTime;if(!i)return;var n=(i-t)/1e3;s.start=s.startPTS=n,s.endPTS=n+s.duration}function d(s,t){if(!t.fragments.length||!s.hasProgramDateTime||!t.hasProgramDateTime)return;var i=t.fragments[0].programDateTime,n=t.fragments[0].start,T=i-n*1e3;s.fragments.forEach(function(m){e(m,T)}),s.fragmentHint&&e(s.fragmentHint,T),s.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(_e,F,w){"use strict";w.r(F);var U=w("./src/utils/ewma.ts"),S=function(){function I(k,A,C){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=C,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new U.default(k),this.fast_=new U.default(A)}var N=I.prototype;return N.update=function(A,C){var y=this.slow_,h=this.fast_;this.slow_.halfLife!==A&&(this.slow_=new U.default(A,y.getEstimate(),y.getTotalWeight())),this.fast_.halfLife!==C&&(this.fast_=new U.default(C,h.getEstimate(),h.getTotalWeight()))},N.sample=function(A,C){A=Math.max(A,this.minDelayMs_);var y=8*C,h=A/1e3,u=y/h;this.fast_.sample(h,u),this.slow_.sample(h,u)},N.canEstimate=function(){var A=this.fast_;return A&&A.getTotalWeight()>=this.minWeight_},N.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},N.destroy=function(){},I}();F.default=S},"./src/utils/ewma.ts":function(_e,F,w){"use strict";w.r(F);var U=function(){function S(N,k,A){k===void 0&&(k=0),A===void 0&&(A=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=N,this.alpha_=N?Math.exp(Math.log(.5)/N):0,this.estimate_=k,this.totalWeight_=A}var I=S.prototype;return I.sample=function(k,A){var C=Math.pow(this.alpha_,k);this.estimate_=A*(1-C)+C*this.estimate_,this.totalWeight_+=k},I.getTotalWeight=function(){return this.totalWeight_},I.getEstimate=function(){if(this.alpha_){var k=1-Math.pow(this.alpha_,this.totalWeight_);if(k)return this.estimate_/k}return this.estimate_},S}();F.default=U},"./src/utils/fetch-loader.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"fetchSupported",function(){return e});var U=w("./src/polyfills/number.ts"),S=w("./src/loader/load-stats.ts"),I=w("./src/demux/chunk-cache.ts");function N(n,T){n.prototype=Object.create(T.prototype),n.prototype.constructor=n,h(n,T)}function k(n){var T=typeof Map=="function"?new Map:void 0;return k=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 T!="undefined"){if(T.has(p))return T.get(p);T.set(p,b)}function b(){return A(p,arguments,u(this).constructor)}return b.prototype=Object.create(p.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),h(b,p)},k(n)}function A(n,T,m){return C()?A=Reflect.construct:A=function(b,_,a){var c=[null];c.push.apply(c,_);var r=Function.bind.apply(b,c),l=new r;return a&&h(l,a.prototype),l},A.apply(null,arguments)}function C(){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(n){return!1}}function y(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function h(n,T){return h=Object.setPrototypeOf||function(p,b){return p.__proto__=b,p},h(n,T)}function u(n){return u=Object.setPrototypeOf?Object.getPrototypeOf:function(m){return m.__proto__||Object.getPrototypeOf(m)},u(n)}function o(){return o=Object.assign||function(n){for(var T=1;T<arguments.length;T++){var m=arguments[T];for(var p in m)Object.prototype.hasOwnProperty.call(m,p)&&(n[p]=m[p])}return n},o.apply(this,arguments)}function e(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(n){}return!1}var d=function(){function n(m){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=m.fetchSetup||t,this.controller=new self.AbortController,this.stats=new S.LoadStats}var T=n.prototype;return T.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},T.abortInternal=function(){var p=this.response;(!p||!p.ok)&&(this.stats.aborted=!0,this.controller.abort())},T.abort=function(){var p;this.abortInternal(),(p=this.callbacks)!==null&&p!==void 0&&p.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},T.load=function(p,b,_){var a=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var r=s(p,this.controller.signal),l=_.onProgress,v=p.responseType==="arraybuffer",f=v?"byteLength":"length";this.context=p,this.config=b,this.callbacks=_,this.request=this.fetchSetup(p,r),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){a.abortInternal(),_.onTimeout(c,p,a.response)},b.timeout),self.fetch(this.request).then(function(x){if(a.response=a.loader=x,!x.ok){var R=x.status,O=x.statusText;throw new i(O||"fetch, bad network response",R,x)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(x.headers.get("Content-Length")||"0"),l&&Object(U.isFiniteNumber)(b.highWaterMark)?a.loadProgressively(x,c,p,b.highWaterMark,l):v?x.arrayBuffer():x.text()}).then(function(x){var R=a.response;self.clearTimeout(a.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=x[f];var O={url:R.url,data:x};l&&!Object(U.isFiniteNumber)(b.highWaterMark)&&l(c,p,x,R),_.onSuccess(O,c,p,R)}).catch(function(x){if(self.clearTimeout(a.requestTimeout),c.aborted)return;var R=x.code||0;_.onError({code:R,text:x.message},p,x.details)})},T.getCacheAge=function(){var p=null;if(this.response){var b=this.response.headers.get("age");p=b?parseFloat(b):null}return p},T.loadProgressively=function(p,b,_,a,c){a===void 0&&(a=0);var r=new I.default,l=p.body.getReader(),v=function f(){return l.read().then(function(x){if(x.done)return r.dataLength&&c(b,_,r.flush(),p),Promise.resolve(new ArrayBuffer(0));var R=x.value,O=R.length;return b.loaded+=O,O<a||r.dataLength?(r.push(R),r.dataLength>=a&&c(b,_,r.flush(),p)):c(b,_,R,p),f()}).catch(function(){return Promise.reject()})};return v()},n}();function s(n,T){var m={method:"GET",mode:"cors",credentials:"same-origin",signal:T,headers:new self.Headers(o({},n.headers))};return n.rangeEnd&&m.headers.set("Range","bytes="+n.rangeStart+"-"+String(n.rangeEnd-1)),m}function t(n,T){return new self.Request(n.url,T)}var i=function(n){N(T,n);function T(m,p,b){var _;return _=n.call(this,m)||this,_.code=void 0,_.details=void 0,_.code=p,_.details=b,_}return T}(k(Error));F.default=d},"./src/utils/imsc1-ttml-parser.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"IMSC1_CODEC",function(){return y}),w.d(F,"parseIMSC1",function(){return e});var U=w("./src/utils/mp4-tools.ts"),S=w("./src/utils/vttparser.ts"),I=w("./src/utils/vttcue.ts"),N=w("./src/demux/id3.ts"),k=w("./src/utils/timescale-conversion.ts"),A=w("./src/utils/webvtt-parser.ts");function C(){return C=Object.assign||function(a){for(var c=1;c<arguments.length;c++){var r=arguments[c];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(a[l]=r[l])}return a},C.apply(this,arguments)}var y="stpp.ttml.im1t",h=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,u=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,o={left:"start",center:"center",right:"end",start:"start",end:"end"};function e(a,c,r,l,v){var f=Object(U.findBox)(new Uint8Array(a),["mdat"]);if(f.length===0){v(new Error("Could not parse IMSC1 mdat"));return}var x=f[0],R=Object(N.utf8ArrayToStr)(new Uint8Array(a,x.start,x.end-x.start)),O=Object(k.toTimescaleFromScale)(c,1,r);try{l(d(R,O))}catch(B){v(B)}}function d(a,c){var r=new DOMParser,l=r.parseFromString(a,"text/xml"),v=l.getElementsByTagName("tt")[0];if(!v)throw new Error("Invalid ttml");var f={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},x=Object.keys(f).reduce(function(K,L){return K[L]=v.getAttribute("ttp:"+L)||f[L],K},{}),R=v.getAttribute("xml:space")!=="preserve",O=t(s(v,"styling","style")),B=t(s(v,"layout","region")),j=s(v,"body","[begin]");return[].map.call(j,function(K){var L=i(K,R);if(!L||!K.hasAttribute("begin"))return null;var H=p(K.getAttribute("begin"),x),Y=p(K.getAttribute("dur"),x),ae=p(K.getAttribute("end"),x);if(H===null)throw m(K);if(ae===null){if(Y===null)throw m(K);ae=H+Y}var Z=new I.default(H-c,ae-c,L);Z.id=Object(A.generateCueId)(Z.startTime,Z.endTime,Z.text);var ce=B[K.getAttribute("region")],de=O[K.getAttribute("style")];Z.position=10,Z.size=80;var q=n(ce,de),te=q.textAlign;if(te){var he=o[te];he&&(Z.lineAlign=he),Z.align=te}return C(Z,q),Z}).filter(function(K){return K!==null})}function s(a,c,r){var l=a.getElementsByTagName(c)[0];return l?[].slice.call(l.querySelectorAll(r)):[]}function t(a){return a.reduce(function(c,r){var l=r.getAttribute("xml:id");return l&&(c[l]=r),c},{})}function i(a,c){return[].slice.call(a.childNodes).reduce(function(r,l,v){var f;return l.nodeName==="br"&&v?r+`
`:(f=l.childNodes)!==null&&f!==void 0&&f.length?i(l,c):c?r+l.textContent.trim().replace(/\s+/g," "):r+l.textContent},"")}function n(a,c){var r="http://www.w3.org/ns/ttml#styling",l=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return l.reduce(function(v,f){var x=T(c,r,f)||T(a,r,f);return x&&(v[f]=x),v},{})}function T(a,c,r){return a.hasAttributeNS(c,r)?a.getAttributeNS(c,r):null}function m(a){return new Error("Could not parse ttml timestamp "+a)}function p(a,c){if(!a)return null;var r=Object(S.parseTimeStamp)(a);return r===null&&(h.test(a)?r=b(a,c):u.test(a)&&(r=_(a,c))),r}function b(a,c){var r=h.exec(a),l=(r[4]|0)+(r[5]|0)/c.subFrameRate;return(r[1]|0)*3600+(r[2]|0)*60+(r[3]|0)+l/c.frameRate}function _(a,c){var r=u.exec(a),l=Number(r[1]),v=r[2];switch(v){case"h":return l*3600;case"m":return l*60;case"ms":return l*1e3;case"f":return l/c.frameRate;case"t":return l/c.tickRate}return l}},"./src/utils/logger.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"enableLogs",function(){return A}),w.d(F,"logger",function(){return C});var U=function(){},S={trace:U,debug:U,log:U,warn:U,info:U,error:U},I=S;function N(y){var h=self.console[y];return h?h.bind(self.console,"["+y+"] >"):U}function k(y){for(var h=arguments.length,u=new Array(h>1?h-1:0),o=1;o<h;o++)u[o-1]=arguments[o];u.forEach(function(e){I[e]=y[e]?y[e].bind(y):N(e)})}function A(y){if(self.console&&y===!0||typeof y=="object"){k(y,"debug","log","info","warn","error");try{I.log()}catch(h){I=S}}else I=S}var C=I},"./src/utils/mediakeys-helper.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"KeySystems",function(){return U}),w.d(F,"requestMediaKeySystemAccess",function(){return S});var U;(function(I){I.WIDEVINE="com.widevine.alpha",I.PLAYREADY="com.microsoft.playready"})(U||(U={}));var S=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"getMediaSource",function(){return U});function U(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"bin2str",function(){return k}),w.d(F,"readUint16",function(){return A}),w.d(F,"readUint32",function(){return C}),w.d(F,"writeUint32",function(){return y}),w.d(F,"findBox",function(){return h}),w.d(F,"parseSegmentIndex",function(){return u}),w.d(F,"parseInitSegment",function(){return o}),w.d(F,"getStartDTS",function(){return e}),w.d(F,"getDuration",function(){return d}),w.d(F,"computeRawDurationFromSamples",function(){return s}),w.d(F,"offsetStartDTS",function(){return t}),w.d(F,"segmentValidRange",function(){return i}),w.d(F,"appendUint8Array",function(){return n});var U=w("./src/utils/typed-array.ts"),S=w("./src/loader/fragment.ts"),I=Math.pow(2,32)-1,N=[].push;function k(T){return String.fromCharCode.apply(null,T)}function A(T,m){"data"in T&&(m+=T.start,T=T.data);var p=T[m]<<8|T[m+1];return p<0?65536+p:p}function C(T,m){"data"in T&&(m+=T.start,T=T.data);var p=T[m]<<24|T[m+1]<<16|T[m+2]<<8|T[m+3];return p<0?4294967296+p:p}function y(T,m,p){"data"in T&&(m+=T.start,T=T.data),T[m]=p>>24,T[m+1]=p>>16&255,T[m+2]=p>>8&255,T[m+3]=p&255}function h(T,m){var p=[];if(!m.length)return p;var b,_,a;"data"in T?(b=T.data,_=T.start,a=T.end):(b=T,_=0,a=b.byteLength);for(var c=_;c<a;){var r=C(b,c),l=k(b.subarray(c+4,c+8)),v=r>1?c+r:a;if(l===m[0])if(m.length===1)p.push({data:b,start:c+8,end:v});else{var f=h({data:b,start:c+8,end:v},m.slice(1));f.length&&N.apply(p,f)}c=v}return p}function u(T){var m=h(T,["moov"]),p=m[0],b=p?p.end:null,_=h(T,["sidx"]);if(!_||!_[0])return null;var a=[],c=_[0],r=c.data[0],l=r===0?8:16,v=C(c,l);l+=4;var f=0,x=0;r===0?l+=8:l+=16,l+=2;var R=c.end+x,O=A(c,l);l+=2;for(var B=0;B<O;B++){var j=l,K=C(c,j);j+=4;var L=K&2147483647,H=(K&2147483648)>>>31;if(H===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Y=C(c,j);j+=4,a.push({referenceSize:L,subsegmentDuration:Y,info:{duration:Y/v,start:R,end:R+L-1}}),R+=L,j+=4,l=j}return{earliestPresentationTime:f,timescale:v,version:r,referencesCount:O,references:a,moovEndOffset:b}}function o(T){for(var m=[],p=h(T,["moov","trak"]),b=0;b<p.length;b++){var _=p[b],a=h(_,["tkhd"])[0];if(a){var c=a.data[a.start],r=c===0?12:20,l=C(a,r),v=h(_,["mdia","mdhd"])[0];if(v){c=v.data[v.start],r=c===0?12:20;var f=C(v,r),x=h(_,["mdia","hdlr"])[0];if(x){var R=k(x.data.subarray(x.start+8,x.start+12)),O={soun:S.ElementaryStreamTypes.AUDIO,vide:S.ElementaryStreamTypes.VIDEO}[R];if(O){var B=h(_,["mdia","minf","stbl","stsd"])[0],j=void 0;B&&(j=k(B.data.subarray(B.start+12,B.start+16))),m[l]={timescale:f,type:O},m[O]={timescale:f,id:l,codec:j}}}}}}var K=h(T,["moov","mvex","trex"]);return K.forEach(function(L){var H=C(L,4),Y=m[H];Y&&(Y.default={duration:C(L,12),flags:C(L,20)})}),m}function e(T,m){return h(m,["moof","traf"]).reduce(function(p,b){var _=h(b,["tfdt"])[0],a=_.data[_.start],c=h(b,["tfhd"]).reduce(function(r,l){var v=C(l,4),f=T[v];if(f){var x=C(_,4);a===1&&(x*=Math.pow(2,32),x+=C(_,8));var R=f.timescale||9e4,O=x/R;if(isFinite(O)&&(r===null||O<r))return O}return r},null);return c!==null&&isFinite(c)&&(p===null||c<p)?c:p},null)||0}function d(T,m){for(var p=0,b=0,_=0,a=h(T,["moof","traf"]),c=0;c<a.length;c++){var r=a[c],l=h(r,["tfhd"])[0],v=C(l,4),f=m[v];if(!f)continue;var x=f.default,R=C(l,0)|(x==null?void 0:x.flags),O=x==null?void 0:x.duration;R&8&&(R&2?O=C(l,12):O=C(l,8));for(var B=f.timescale||9e4,j=h(r,["trun"]),K=0;K<j.length;K++){if(O){var L=C(j[K],4);p=O*L}else p=s(j[K]);f.type===S.ElementaryStreamTypes.VIDEO?b+=p/B:f.type===S.ElementaryStreamTypes.AUDIO&&(_+=p/B)}}if(b===0&&_===0){var H=u(T);if(H!=null&&H.references)return H.references.reduce(function(Y,ae){return Y+ae.info.duration||0},0)}return b||_}function s(T){var m=C(T,0),p=8;m&1&&(p+=4),m&4&&(p+=4);for(var b=0,_=C(T,4),a=0;a<_;a++){if(m&256){var c=C(T,p);b+=c,p+=4}m&512&&(p+=4),m&1024&&(p+=4),m&2048&&(p+=4)}return b}function t(T,m,p){h(m,["moof","traf"]).forEach(function(b){h(b,["tfhd"]).forEach(function(_){var a=C(_,4),c=T[a];if(!c)return;var r=c.timescale||9e4;h(b,["tfdt"]).forEach(function(l){var v=l.data[l.start],f=C(l,4);if(v===0)y(l,4,f-p*r);else{f*=Math.pow(2,32),f+=C(l,8),f-=p*r,f=Math.max(f,0);var x=Math.floor(f/(I+1)),R=Math.floor(f%(I+1));y(l,4,x),y(l,8,R)}})})})}function i(T){var m={valid:null,remainder:null},p=h(T,["moof"]);if(p){if(p.length<2)return m.remainder=T,m}else return m;var b=p[p.length-1];return m.valid=Object(U.sliceUint8)(T,0,b.start-8),m.remainder=Object(U.sliceUint8)(T,b.start-8),m}function n(T,m){var p=new Uint8Array(T.length+m.length);return p.set(T),p.set(m,T.length),p}},"./src/utils/output-filter.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"default",function(){return U});var U=function(){function S(N,k){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=N,this.trackName=k}var I=S.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(k,A,C){(this.startTime===null||this.startTime>k)&&(this.startTime=k),this.endTime=A,this.screen=C,this.timelineController.createCaptionsTrack(this.trackName)},I.reset=function(){this.cueRanges=[]},S}()},"./src/utils/texttrack-utils.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"sendAddTrackEvent",function(){return S}),w.d(F,"addCueToTrack",function(){return I}),w.d(F,"clearCurrentCues",function(){return N}),w.d(F,"removeCuesInRange",function(){return k}),w.d(F,"getCuesInRange",function(){return C});var U=w("./src/utils/logger.ts");function S(y,h){var u;try{u=new Event("addtrack")}catch(o){u=document.createEvent("Event"),u.initEvent("addtrack",!1,!1)}u.track=y,h.dispatchEvent(u)}function I(y,h){var u=y.mode;if(u==="disabled"&&(y.mode="hidden"),y.cues&&!y.cues.getCueById(h.id))try{if(y.addCue(h),!y.cues.getCueById(h.id))throw new Error("addCue is failed for: "+h)}catch(e){U.logger.debug("[texttrack-utils]: "+e);var o=new self.TextTrackCue(h.startTime,h.endTime,h.text);o.id=h.id,y.addCue(o)}u==="disabled"&&(y.mode=u)}function N(y){var h=y.mode;if(h==="disabled"&&(y.mode="hidden"),y.cues)for(var u=y.cues.length;u--;)y.removeCue(y.cues[u]);h==="disabled"&&(y.mode=h)}function k(y,h,u){var o=y.mode;if(o==="disabled"&&(y.mode="hidden"),y.cues&&y.cues.length>0)for(var e=C(y.cues,h,u),d=0;d<e.length;d++)y.removeCue(e[d]);o==="disabled"&&(y.mode=o)}function A(y,h){if(h<y[0].startTime)return 0;var u=y.length-1;if(h>y[u].endTime)return-1;for(var o=0,e=u;o<=e;){var d=Math.floor((e+o)/2);if(h<y[d].startTime)e=d-1;else if(h>y[d].startTime&&o<u)o=d+1;else return d}return y[o].startTime-h<h-y[e].startTime?o:e}function C(y,h,u){var o=[],e=A(y,h);if(e>-1)for(var d=e,s=y.length;d<s;d++){var t=y[d];if(t.startTime>=h&&t.endTime<=u)o.push(t);else if(t.startTime>u)return o}return o}},"./src/utils/time-ranges.ts":function(_e,F,w){"use strict";w.r(F);var U={toString:function(I){for(var N="",k=I.length,A=0;A<k;A++)N+="["+I.start(A).toFixed(3)+","+I.end(A).toFixed(3)+"]";return N}};F.default=U},"./src/utils/timescale-conversion.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"toTimescaleFromBase",function(){return S}),w.d(F,"toTimescaleFromScale",function(){return I}),w.d(F,"toMsFromMpegTsClock",function(){return N}),w.d(F,"toMpegTsClockFromTimescale",function(){return k});var U=9e4;function S(A,C,y,h){y===void 0&&(y=1),h===void 0&&(h=!1);var u=A*C*y;return h?Math.round(u):u}function I(A,C,y,h){return y===void 0&&(y=1),h===void 0&&(h=!1),S(A,C,1/y,h)}function N(A,C){return C===void 0&&(C=!1),S(A,1e3,1/U,C)}function k(A,C){return C===void 0&&(C=1),S(A,U,1/C)}},"./src/utils/typed-array.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"sliceUint8",function(){return U});function U(S,I,N){return Uint8Array.prototype.slice?S.slice(I,N):new Uint8Array(Array.prototype.slice.call(S,I,N))}},"./src/utils/vttcue.ts":function(_e,F,w){"use strict";w.r(F),F.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var U=["","lr","rl"],S=["start","middle","end","left","right"];function I(y,h){if(typeof h!="string")return!1;if(!Array.isArray(y))return!1;var u=h.toLowerCase();return~y.indexOf(u)?u:!1}function N(y){return I(U,y)}function k(y){return I(S,y)}function A(y){for(var h=arguments.length,u=new Array(h>1?h-1:0),o=1;o<h;o++)u[o-1]=arguments[o];for(var e=1;e<arguments.length;e++){var d=arguments[e];for(var s in d)y[s]=d[s]}return y}function C(y,h,u){var o=this,e={enumerable:!0};o.hasBeenReset=!1;var d="",s=!1,t=y,i=h,n=u,T=null,m="",p=!0,b="auto",_="start",a=50,c="middle",r=50,l="middle";Object.defineProperty(o,"id",A({},e,{get:function(){return d},set:function(f){d=""+f}})),Object.defineProperty(o,"pauseOnExit",A({},e,{get:function(){return s},set:function(f){s=!!f}})),Object.defineProperty(o,"startTime",A({},e,{get:function(){return t},set:function(f){if(typeof f!="number")throw new TypeError("Start time must be set to a number.");t=f,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",A({},e,{get:function(){return i},set:function(f){if(typeof f!="number")throw new TypeError("End time must be set to a number.");i=f,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",A({},e,{get:function(){return n},set:function(f){n=""+f,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",A({},e,{get:function(){return T},set:function(f){T=f,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",A({},e,{get:function(){return m},set:function(f){var x=N(f);if(x===!1)throw new SyntaxError("An invalid or illegal string was specified.");m=x,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",A({},e,{get:function(){return p},set:function(f){p=!!f,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",A({},e,{get:function(){return b},set:function(f){if(typeof f!="number"&&f!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");b=f,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",A({},e,{get:function(){return _},set:function(f){var x=k(f);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");_=x,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",A({},e,{get:function(){return a},set:function(f){if(f<0||f>100)throw new Error("Position must be between 0 and 100.");a=f,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",A({},e,{get:function(){return c},set:function(f){var x=k(f);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");c=x,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",A({},e,{get:function(){return r},set:function(f){if(f<0||f>100)throw new Error("Size must be between 0 and 100.");r=f,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",A({},e,{get:function(){return l},set:function(f){var x=k(f);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");l=x,this.hasBeenReset=!0}})),o.displayState=void 0}return C.prototype.getCueAsHTML=function(){var y=self.WebVTT;return y.convertCueToDOMTree(self,this.text)},C}()},"./src/utils/vttparser.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"parseTimeStamp",function(){return I}),w.d(F,"fixLineBreaks",function(){return h}),w.d(F,"VTTParser",function(){return u});var U=w("./src/utils/vttcue.ts"),S=function(){function o(){}var e=o.prototype;return e.decode=function(s,t){if(!s)return"";if(typeof s!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(s))},o}();function I(o){function e(s,t,i,n){return(s|0)*3600+(t|0)*60+(i|0)+parseFloat(n||0)}var d=o.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return d?parseFloat(d[2])>59?e(d[2],d[3],0,d[4]):e(d[1],d[2],d[3],d[4]):null}var N=function(){function o(){this.values=Object.create(null)}var e=o.prototype;return e.set=function(s,t){!this.get(s)&&t!==""&&(this.values[s]=t)},e.get=function(s,t,i){return i?this.has(s)?this.values[s]:t[i]:this.has(s)?this.values[s]:t},e.has=function(s){return s in this.values},e.alt=function(s,t,i){for(var n=0;n<i.length;++n)if(t===i[n]){this.set(s,t);break}},e.integer=function(s,t){/^-?\d+$/.test(t)&&this.set(s,parseInt(t,10))},e.percent=function(s,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){var i=parseFloat(t);if(i>=0&&i<=100)return this.set(s,i),!0}return!1},o}();function k(o,e,d,s){var t=s?o.split(s):[o];for(var i in t){if(typeof t[i]!="string")continue;var n=t[i].split(d);if(n.length!==2)continue;var T=n[0],m=n[1];e(T,m)}}var A=new U.default(0,0,""),C=A.align==="middle"?"middle":"center";function y(o,e,d){var s=o;function t(){var T=I(o);if(T===null)throw new Error("Malformed timestamp: "+s);return o=o.replace(/^[^\sa-zA-Z-]+/,""),T}function i(T,m){var p=new N;k(T,function(a,c){var r;switch(a){case"region":for(var l=d.length-1;l>=0;l--)if(d[l].id===c){p.set(a,d[l].region);break}break;case"vertical":p.alt(a,c,["rl","lr"]);break;case"line":r=c.split(","),p.integer(a,r[0]),p.percent(a,r[0])&&p.set("snapToLines",!1),p.alt(a,r[0],["auto"]),r.length===2&&p.alt("lineAlign",r[1],["start",C,"end"]);break;case"position":r=c.split(","),p.percent(a,r[0]),r.length===2&&p.alt("positionAlign",r[1],["start",C,"end","line-left","line-right","auto"]);break;case"size":p.percent(a,c);break;case"align":p.alt(a,c,["start",C,"end","left","right"]);break}},/:/,/\s/),m.region=p.get("region",null),m.vertical=p.get("vertical","");var b=p.get("line","auto");b==="auto"&&A.line===-1&&(b=-1),m.line=b,m.lineAlign=p.get("lineAlign","start"),m.snapToLines=p.get("snapToLines",!0),m.size=p.get("size",100),m.align=p.get("align",C);var _=p.get("position","auto");_==="auto"&&A.position===50&&(_=m.align==="start"||m.align==="left"?0:m.align==="end"||m.align==="right"?100:50),m.position=_}function n(){o=o.replace(/^\s+/,"")}if(n(),e.startTime=t(),n(),o.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+s);o=o.substr(3),n(),e.endTime=t(),n(),i(o,e)}function h(o){return o.replace(/<br(?: \/)?>/gi,`
`)}var u=function(){function o(){this.state="INITIAL",this.buffer="",this.decoder=new S,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var e=o.prototype;return e.parse=function(s){var t=this;s&&(t.buffer+=t.decoder.decode(s,{stream:!0}));function i(){var _=t.buffer,a=0;for(_=h(_);a<_.length&&_[a]!=="\r"&&_[a]!==`
`;)++a;var c=_.substr(0,a);return _[a]==="\r"&&++a,_[a]===`
`&&++a,t.buffer=_.substr(a),c}function n(_){k(_,function(a,c){},/:/)}try{var T="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;T=i();var m=T.match(/^()?WEBVTT([ \t].*)?$/);if(!m||!m[0])throw new Error("Malformed WebVTT signature.");t.state="HEADER"}for(var p=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;p?p=!1:T=i();switch(t.state){case"HEADER":/:/.test(T)?n(T):T||(t.state="ID");continue;case"NOTE":T||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(T)){t.state="NOTE";break}if(!T)continue;if(t.cue=new U.default(0,0,""),t.state="CUE",T.indexOf("-->")===-1){t.cue.id=T;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{y(T,t.cue,t.regionList)}catch(_){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{var b=T.indexOf("-->")!==-1;if(!T||b&&(p=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=`
`),t.cue.text+=T}continue;case"BADCUE":T||(t.state="ID")}}}catch(_){t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},e.flush=function(){var s=this;try{if((s.cue||s.state==="HEADER")&&(s.buffer+=`
`,s.parse()),s.state==="INITIAL"||s.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){s.onparsingerror&&s.onparsingerror(t)}return s.onflush&&s.onflush(),this},o}()},"./src/utils/webvtt-parser.ts":function(_e,F,w){"use strict";w.r(F),w.d(F,"generateCueId",function(){return u}),w.d(F,"parseWebVTT",function(){return e});var U=w("./src/polyfills/number.ts"),S=w("./src/utils/vttparser.ts"),I=w("./src/demux/id3.ts"),N=w("./src/utils/timescale-conversion.ts"),k=w("./src/remux/mp4-remuxer.ts"),A=/\r\n|\n\r|\n|\r/g,C=function(s,t,i){return i===void 0&&(i=0),s.substr(i,t.length)===t},y=function(s){var t=parseInt(s.substr(-3)),i=parseInt(s.substr(-6,2)),n=parseInt(s.substr(-9,2)),T=s.length>9?parseInt(s.substr(0,s.indexOf(":"))):0;if(!Object(U.isFiniteNumber)(t)||!Object(U.isFiniteNumber)(i)||!Object(U.isFiniteNumber)(n)||!Object(U.isFiniteNumber)(T))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+s);return t+=1e3*i,t+=60*1e3*n,t+=60*60*1e3*T,t},h=function(s){for(var t=5381,i=s.length;i;)t=t*33^s.charCodeAt(--i);return(t>>>0).toString()};function u(d,s,t){return h(d.toString())+h(s.toString())+h(t)}var o=function(s,t,i){var n=s[t],T=s[n.prevCC];if(!T||!T.new&&n.new){s.ccOffset=s.presentationOffset=n.start,n.new=!1;return}for(;(m=T)!==null&&m!==void 0&&m.new;){var m;s.ccOffset+=n.start-T.start,n.new=!1,n=T,T=s[n.prevCC]}s.presentationOffset=i};function e(d,s,t,i,n,T,m,p){var b=new S.VTTParser,_=Object(I.utf8ArrayToStr)(new Uint8Array(d)).trim().replace(A,`
`).split(`
`),a=[],c=Object(N.toMpegTsClockFromTimescale)(s,t),r="00:00.000",l=0,v=0,f,x=!0,R=!1;b.oncue=function(O){var B=i[n],j=i.ccOffset,K=(l-c)/9e4;if(B!=null&&B.new&&(v!==void 0?j=i.ccOffset=B.start:o(i,n,K)),K&&(j=K-i.presentationOffset),R){var L=O.endTime-O.startTime,H=Object(k.normalizePts)((O.startTime+j-v)*9e4,T*9e4)/9e4;O.startTime=H,O.endTime=H+L}var Y=O.text.trim();O.text=decodeURIComponent(encodeURIComponent(Y)),O.id||(O.id=u(O.startTime,O.endTime,Y)),O.endTime>0&&a.push(O)},b.onparsingerror=function(O){f=O},b.onflush=function(){if(f){p(f);return}m(a)},_.forEach(function(O){if(x)if(C(O,"X-TIMESTAMP-MAP=")){x=!1,R=!0,O.substr(16).split(",").forEach(function(B){C(B,"LOCAL:")?r=B.substr(6):C(B,"MPEGTS:")&&(l=parseInt(B.substr(7)))});try{v=y(r)/1e3}catch(B){R=!1,f=B}return}else O===""&&(x=!1);b.parse(O+`
`)}),b.flush()}},"./src/utils/xhr-loader.ts":function(_e,F,w){"use strict";w.r(F);var U=w("./src/utils/logger.ts"),S=w("./src/loader/load-stats.ts"),I=/^age:\s*[\d.]+\s*$/m,N=function(){function k(C){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=C?C.xhrSetup:null,this.stats=new S.LoadStats,this.retryDelay=0}var A=k.prototype;return A.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},A.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()))},A.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},A.load=function(y,h,u){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=h,this.callbacks=u,this.retryDelay=h.retryDelay,this.loadInternal()},A.loadInternal=function(){var y=this.config,h=this.context;if(!y)return;var u=this.loader=new self.XMLHttpRequest,o=this.stats;o.loading.first=0,o.loaded=0;var e=this.xhrSetup;try{if(e)try{e(u,h.url)}catch(t){u.open("GET",h.url,!0),e(u,h.url)}u.readyState||u.open("GET",h.url,!0);var d=this.context.headers;if(d)for(var s in d)u.setRequestHeader(s,d[s])}catch(t){this.callbacks.onError({code:u.status,text:t.message},h,u);return}h.rangeEnd&&u.setRequestHeader("Range","bytes="+h.rangeStart+"-"+(h.rangeEnd-1)),u.onreadystatechange=this.readystatechange.bind(this),u.onprogress=this.loadprogress.bind(this),u.responseType=h.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout),u.send()},A.readystatechange=function(){var y=this.context,h=this.loader,u=this.stats;if(!y||!h)return;var o=h.readyState,e=this.config;if(u.aborted)return;if(o>=2)if(self.clearTimeout(this.requestTimeout),u.loading.first===0&&(u.loading.first=Math.max(self.performance.now(),u.loading.start)),o===4){h.onreadystatechange=null,h.onprogress=null;var d=h.status;if(d>=200&&d<300){u.loading.end=Math.max(self.performance.now(),u.loading.first);var s,t;if(y.responseType==="arraybuffer"?(s=h.response,t=s.byteLength):(s=h.responseText,t=s.length),u.loaded=u.total=t,!this.callbacks)return;var i=this.callbacks.onProgress;if(i&&i(u,y,s,h),!this.callbacks)return;var n={url:h.responseURL,data:s};this.callbacks.onSuccess(n,u,y,h)}else u.retry>=e.maxRetry||d>=400&&d<499?(U.logger.error(d+" while loading "+y.url),this.callbacks.onError({code:d,text:h.statusText},y,h)):(U.logger.warn(d+" 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,e.maxRetryDelay),u.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),e.timeout)},A.loadtimeout=function(){U.logger.warn("timeout while loading "+this.context.url);var y=this.callbacks;y&&(this.abortInternal(),y.onTimeout(this.stats,this.context,this.loader))},A.loadprogress=function(y){var h=this.stats;h.loaded=y.loaded,y.lengthComputable&&(h.total=y.total)},A.getCacheAge=function(){var y=null;if(this.loader&&I.test(this.loader.getAllResponseHeaders())){var h=this.loader.getResponseHeader("age");y=h?parseFloat(h):null}return y},k}();F.default=N}}).default})},vHTk:function(at,$e,z){at.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},xTzM:function(at,$e){at.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAAhCAYAAAC1ONkWAAAACXBIWXMAAAsSAAALEgHS3X78AAAAAXNSR0IArs4c6QAAAqRJREFUWEfNmE1o02AYx/9JzJaltHatZRVR5hSRXHYYbCpMmTIRexAsDD0L8+Rphx10DIQddvDowbugCB68iWOKDqeb7tKD+MGKA8vo3Nzch7ZLlsibJjPrkjRvE8hySUiej9/7/PO+b54wmqZx2IMH4wqWv3kIS19HIcTOgVUP1uRX2XmUVl+DxX10vHpX097FwBmMQC3kP4JtSFElYPiKefnLGJrSd+sFdAb70PMQm8o1KiirMR8D5FXv7pzwE5wyjuSJQbQ9KDiDvWwrgIu2eI8ckOXWWhGtvZ3OYONHlYBS0YeJtT52BnueVMAYMTVAvyZnu8N85mS/67kGMAygGQHNa/PcEC+6gCUqFUueBaQRgD9AP3IaD3kR+HQbWHqje9UG63wE7GumSVG/rbIMTF+nAKs/Fb2nd7An9MH9eEz3eaxY11O39dmYEUHNEgBTWY9gp575GT+97/srFrDl0QGo6h1Ai9JH8lFQNQXwJ3cG2Aab7T+CaPNcoEBUwY4Bje3/PSYvGRUjYGIkPDAmDjRdNsBUYBuMfI9968tBbJGoBhqksXgV4Iy3aPKi5R37nB1CJDUcZC6qWEIHIJ6puEx0W8EyEoR0Tt+7nPYwqkyGsdd4wn4gesMGjNwicrKN4cmZ7Af4RFXFCBiRk+PDkzN+oSLnDil1sIwERsjVo1ggPmIKSNyyATPl3PwbnpyHh6qWC3PIRE55Izw501lgZtBmryRylkvhyjn7wmETJ7NzvRienL/m9O5q9xcskXNjPhw5VRlQSsDvgh1YRsLaQnhybpWBP+sOzchU+1toWlfNnaB6ZaddN6zdEfE14ynymH0zMtNzGivfJ8CH1FpGjnc7d0lkhi7m76H8o5e2EL7sGW4E51eG3f/2+Mrgz3nPgv0D9Cc+LoUg84gAAAAASUVORK5CYII="}}]);