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__Question__Index.92952303...

801 lines
849 KiB

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

(window.webpackJsonp=window.webpackJsonp||[]).push([[201,5,7,8,10],{"+92d":
/*!*******************************************!*\
!*** ./src/assets/images/question/b1.svg ***!
\*******************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,i){t.exports=i.p+"static/b1.8d46544a.svg"},"+RDj":
/*!********************************************!*\
!*** ./src/assets/images/question/dau.svg ***!
\********************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,i){t.exports=i.p+"static/dau.0c862b4c.svg"},"3SPk":
/*!******************************************!*\
!*** ./src/assets/images/question/c.svg ***!
\******************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,i){t.exports=i.p+"static/c.893027ce.svg"},"5A5F":
/*!*****************************************************!*\
!*** ./src/pages/Question/Index/index.less?modules ***!
\*****************************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,i){t.exports={flex_box_center:"flex_box_center___3fvo9",flex_space_between:"flex_space_between___2dIWe",flex_box_vertical_center:"flex_box_vertical_center___213Et",flex_box_center_end:"flex_box_center_end___1GXlY",flex_box_column:"flex_box_column___2XTWO",wrap:"wrap___1JbzU",bg:"bg___Dxa5l",btnWrap:"btnWrap___1CEeA",text:"text___ufYpy",btn:"btn___33IXa",content:"content___2Crhb",left:"left___12ObT",filterPoint:"filterPoint___1wSyY",btnWarp:"btnWarp___XLUgV",btnActive:"btnActive___2vIUq",action:"action___m_eZE",btnMask:"btnMask___epWeB",filterOrigin:"filterOrigin___OKol4",line:"line___psQHn",control:"control___1SAJX",table:"table___1Q9AI",tabWarp:"tabWarp___3884f",tabWarp2:"tabWarp2___1f1Zo",customTable:"customTable___6Ubut","btn-style-1":"btn-style-1___m4kGi","btn-style-2":"btn-style-2___2uJ8s","btn-style-3":"btn-style-3___3kuYl",right:"right___Ie2u1",title:"title___1uK2v",sort:"sort___1hyjY",titles:"titles___1i-V6",li:"li___3lR-W",titleWarp:"titleWarp___t0Zdh",hov:"hov___30B5q",hovBtn:"hovBtn___3ciGX",tag:"tag___hllWE",problemsclose:"problemsclose___1X9HB",imgsrc:"imgsrc___3koep"}},"6+eU":
/*!************************************************************!*\
!*** ./node_modules/rc-pagination/es/index.js + 4 modules ***!
\************************************************************/
/*! exports provided: default */
/*! exports used: default */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createSuper.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/extends.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-pagination/es/locale/zh_CN.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(t,e,i){"use strict";i.d(e,"a",(function(){return w}));var r=i("wx14"),n=i("rePB"),s=i("VTBJ"),a=i("1OyB"),o=i("vuIU"),l=i("Ji7U"),c=i("LK+K"),u=i("q1tI"),h=i.n(u),d=i("TSYQ"),f=i.n(d),p=function(t){var e,i="".concat(t.rootPrefixCls,"-item"),r=f()(i,"".concat(i,"-").concat(t.page),(e={},Object(n.a)(e,"".concat(i,"-active"),t.active),Object(n.a)(e,t.className,!!t.className),Object(n.a)(e,"".concat(i,"-disabled"),!t.page),e));return h.a.createElement("li",{title:t.showTitle?t.page:null,className:r,onClick:function(){t.onClick(t.page)},onKeyPress:function(e){t.onKeyPress(e,t.onClick,t.page)},tabIndex:"0"},t.itemRender(t.page,"page",h.a.createElement("a",{rel:"nofollow"},t.page)))},g=13,v=38,m=40,y=function(t){Object(l.a)(i,t);var e=Object(c.a)(i);function i(){var t;Object(a.a)(this,i);for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];return(t=e.call.apply(e,[this].concat(n))).state={goInputText:""},t.buildOptionText=function(e){return"".concat(e," ").concat(t.props.locale.items_per_page)},t.changeSize=function(e){t.props.changeSize(Number(e))},t.handleChange=function(e){t.setState({goInputText:e.target.value})},t.handleBlur=function(e){var i=t.props,r=i.goButton,n=i.quickGo,s=i.rootPrefixCls,a=t.state.goInputText;r||""===a||e.relatedTarget&&(e.relatedTarget.className.indexOf("".concat(s,"-prev"))>=0||e.relatedTarget.className.indexOf("".concat(s,"-next"))>=0)||(t.setState({goInputText:""}),n(t.getValidValue()))},t.go=function(e){""!==t.state.goInputText&&(e.keyCode!==g&&"click"!==e.type||(t.setState({goInputText:""}),t.props.quickGo(t.getValidValue())))},t}return Object(o.a)(i,[{key:"getValidValue",value:function(){var t=this.state,e=t.goInputText,i=t.current;return!e||isNaN(e)?i:Number(e)}},{key:"getPageSizeOptions",value:function(){var t=this.props,e=t.pageSize,i=t.pageSizeOptions;return i.some((function(t){return t.toString()===e.toString()}))?i:i.concat([e.toString()]).sort((function(t,e){return(isNaN(Number(t))?0:Number(t))-(isNaN(Number(e))?0:Number(e))}))}},{key:"render",value:function(){var t=this,e=this.props,i=e.pageSize,r=e.locale,n=e.rootPrefixCls,s=e.changeSize,a=e.quickGo,o=e.goButton,l=e.selectComponentClass,c=e.buildOptionText,u=e.selectPrefixCls,d=e.disabled,f=this.state.goInputText,p="".concat(n,"-options"),g=l,v=null,m=null,y=null;if(!s&&!a)return null;var b=this.getPageSizeOptions();if(s&&g){var E=b.map((function(e,i){return h.a.createElement(g.Option,{key:i,value:e.toString()},(c||t.buildOptionText)(e))}));v=h.a.createElement(g,{disabled:d,prefixCls:u,showSearch:!1,className:"".concat(p,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(i||b[0]).toString(),onChange:this.changeSize,getPopupContainer:function(t){return t.parentNode}},E)}return a&&(o&&(y="boolean"==typeof o?h.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:d,className:"".concat(p,"-quick-jumper-button")},r.jump_to_confirm):h.a.createElement("span",{onClick:this.go,onKeyUp:this.go},o)),m=h.a.createElement("div",{className:"".concat(p,"-quick-jumper")},r.jump_to,h.a.createElement("input",{disabled:d,type:"text",value:f,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),r.page,y)),h.a.createElement("li",{className:"".concat(p)},v,m)}}]),i}(h.a.Component);y.defaultProps={pageSizeOptions:["10","20","50","100"]};var b=y,E=i("N2Kk");function S(){}function C(t,e,i){var r=void 0===t?e.pageSize:t;return Math.floor((i.total-1)/r)+1}var k=function(t){Object(l.a)(i,t);var e=Object(c.a)(i);function i(t){var r;Object(a.a)(this,i),(r=e.call(this,t)).getJumpPrevPage=function(){return Math.max(1,r.state.current-(r.props.showLessItems?3:5))},r.getJumpNextPage=function(){return Math.min(C(void 0,r.state,r.props),r.state.current+(r.props.showLessItems?3:5))},r.getItemIcon=function(t,e){var i=r.props.prefixCls,n=t||h.a.createElement("button",{type:"button","aria-label":e,className:"".concat(i,"-item-link")});return"function"==typeof t&&(n=h.a.createElement(t,Object(s.a)({},r.props))),n},r.savePaginationNode=function(t){r.paginationNode=t},r.isValid=function(t){return"number"==typeof(e=t)&&isFinite(e)&&Math.floor(e)===e&&t!==r.state.current;var e},r.shouldDisplayQuickJumper=function(){var t=r.props,e=t.showQuickJumper,i=t.pageSize;return!(t.total<=i)&&e},r.handleKeyDown=function(t){t.keyCode!==v&&t.keyCode!==m||t.preventDefault()},r.handleKeyUp=function(t){var e=r.getValidValue(t);e!==r.state.currentInputValue&&r.setState({currentInputValue:e}),t.keyCode===g?r.handleChange(e):t.keyCode===v?r.handleChange(e-1):t.keyCode===m&&r.handleChange(e+1)},r.changePageSize=function(t){var e=r.state.current,i=C(t,r.state,r.props);e=e>i?i:e,0===i&&(e=r.state.current),"number"==typeof t&&("pageSize"in r.props||r.setState({pageSize:t}),"current"in r.props||r.setState({current:e,currentInputValue:e})),r.props.onShowSizeChange(e,t),"onChange"in r.props&&r.props.onChange&&r.props.onChange(e,t)},r.handleChange=function(t){var e=r.props.disabled,i=t;if(r.isValid(i)&&!e){var n=C(void 0,r.state,r.props);i>n?i=n:i<1&&(i=1),"current"in r.props||r.setState({current:i,currentInputValue:i});var s=r.state.pageSize;return r.props.onChange(i,s),i}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<C(void 0,r.state,r.props)},r.runIfEnter=function(t,e){if("Enter"===t.key||13===t.charCode){for(var i=arguments.length,r=new Array(i>2?i-2:0),n=2;n<i;n++)r[n-2]=arguments[n];e.apply(void 0,r)}},r.runIfEnterPrev=function(t){r.runIfEnter(t,r.prev)},r.runIfEnterNext=function(t){r.runIfEnter(t,r.next)},r.runIfEnterJumpPrev=function(t){r.runIfEnter(t,r.jumpPrev)},r.runIfEnterJumpNext=function(t){r.runIfEnter(t,r.jumpNext)},r.handleGoTO=function(t){t.keyCode!==g&&"click"!==t.type||r.handleChange(r.state.currentInputValue)};var n=t.onChange!==S;"current"in t&&!n&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var o=t.defaultCurrent;"current"in t&&(o=t.current);var l=t.defaultPageSize;return"pageSize"in t&&(l=t.pageSize),o=Math.min(o,C(l,void 0,t)),r.state={current:o,currentInputValue:o,pageSize:l},r}return Object(o.a)(i,[{key:"componentDidUpdate",value:function(t,e){var i=this.props.prefixCls;if(e.current!==this.state.current&&this.paginationNode){var r=this.paginationNode.querySelector(".".concat(i,"-item-").concat(e.current));r&&document.activeElement===r&&r.blur()}}},{key:"getValidValue",value:function(t){var e=t.target.value,i=C(void 0,this.state,this.props),r=this.state.currentInputValue;return""===e?e:isNaN(Number(e))?r:e>=i?i:Number(e)}},{key:"getShowSizeChanger",value:function(){var t=this.props,e=t.showSizeChanger,i=t.total,r=t.totalBoundaryShowSizeChanger;return void 0!==e?e:i>r}},{key:"renderPrev",value:function(t){var e=this.props,i=e.prevIcon,r=(0,e.itemRender)(t,"prev",this.getItemIcon(i,"prev page")),n=!this.hasPrev();return Object(u.isValidElement)(r)?Object(u.cloneElement)(r,{disabled:n}):r}},{key:"renderNext",value:function(t){var e=this.props,i=e.nextIcon,r=(0,e.itemRender)(t,"next",this.getItemIcon(i,"next page")),n=!this.hasNext();return Object(u.isValidElement)(r)?Object(u.cloneElement)(r,{disabled:n}):r}},{key:"render",value:function(){var t=this,e=this.props,i=e.prefixCls,s=e.className,a=e.style,o=e.disabled,l=e.hideOnSinglePage,c=e.total,d=e.locale,g=e.showQuickJumper,v=e.showLessItems,m=e.showTitle,y=e.showTotal,E=e.simple,S=e.itemRender,k=e.showPrevNextJumpers,w=e.jumpPrevIcon,x=e.jumpNextIcon,T=e.selectComponentClass,O=e.selectPrefixCls,A=e.pageSizeOptions,L=this.state,R=L.current,_=L.pageSize,D=L.currentInputValue;if(!0===l&&c<=_)return null;var I=C(void 0,this.state,this.props),M=[],P=null,N=null,j=null,B=null,F=null,U=g&&g.goButton,G=v?1:2,H=R-1>0?R-1:0,z=R+1<I?R+1:I,V=Object.keys(this.props).reduce((function(e,i){return"data-"!==i.substr(0,5)&&"aria-"!==i.substr(0,5)&&"role"!==i||(e[i]=t.props[i]),e}),{});if(E)return U&&(F="boolean"==typeof U?h.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},d.jump_to_confirm):h.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},U),F=h.a.createElement("li",{title:m?"".concat(d.jump_to).concat(R,"/").concat(I):null,className:"".concat(i,"-simple-pager")},F)),h.a.createElement("ul",Object(r.a)({className:f()(i,"".concat(i,"-simple"),Object(n.a)({},"".concat(i,"-disabled"),o),s),style:a,ref:this.savePaginationNode},V),h.a.createElement("li",{title:m?d.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:f()("".concat(i,"-prev"),Object(n.a)({},"".concat(i,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(H)),h.a.createElement("li",{title:m?"".concat(R,"/").concat(I):null,className:"".concat(i,"-simple-pager")},h.a.createElement("input",{type:"text",value:D,disabled:o,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),h.a.createElement("span",{className:"".concat(i,"-slash")},"/"),I),h.a.createElement("li",{title:m?d.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:f()("".concat(i,"-next"),Object(n.a)({},"".concat(i,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(z)),F);if(I<=3+2*G){var K={locale:d,rootPrefixCls:i,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:m,itemRender:S};I||M.push(h.a.createElement(p,Object(r.a)({},K,{key:"noPager",page:I,className:"".concat(i,"-disabled")})));for(var W=1;W<=I;W+=1){var Y=R===W;M.push(h.a.createElement(p,Object(r.a)({},K,{key:W,page:W,active:Y})))}}else{var X=v?d.prev_3:d.prev_5,q=v?d.next_3:d.next_5;k&&(P=h.a.createElement("li",{title:m?X:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:f()("".concat(i,"-jump-prev"),Object(n.a)({},"".concat(i,"-jump-prev-custom-icon"),!!w))},S(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(w,"prev page"))),N=h.a.createElement("li",{title:m?q:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:f()("".concat(i,"-jump-next"),Object(n.a)({},"".concat(i,"-jump-next-custom-icon"),!!x))},S(this.getJumpNextPage(),"jump-next",this.getItemIcon(x,"next page")))),B=h.a.createElement(p,{locale:d,last:!0,rootPrefixCls:i,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:I,page:I,active:!1,showTitle:m,itemRender:S}),j=h.a.createElement(p,{locale:d,rootPrefixCls:i,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:m,itemRender:S});var $=Math.max(1,R-G),J=Math.min(R+G,I);R-1<=G&&(J=1+2*G),I-R<=G&&($=I-2*G);for(var Q=$;Q<=J;Q+=1){var Z=R===Q;M.push(h.a.createElement(p,{locale:d,rootPrefixCls:i,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:Q,page:Q,active:Z,showTitle:m,itemRender:S}))}R-1>=2*G&&3!==R&&(M[0]=Object(u.cloneElement)(M[0],{className:"".concat(i,"-item-after-jump-prev")}),M.unshift(P)),I-R>=2*G&&R!==I-2&&(M[M.length-1]=Object(u.cloneElement)(M[M.length-1],{className:"".concat(i,"-item-before-jump-next")}),M.push(N)),1!==$&&M.unshift(j),J!==I&&M.push(B)}var tt=null;y&&(tt=h.a.createElement("li",{className:"".concat(i,"-total-text")},y(c,[0===c?0:(R-1)*_+1,R*_>c?c:R*_])));var et=!this.hasPrev()||!I,it=!this.hasNext()||!I;return h.a.createElement("ul",Object(r.a)({className:f()(i,s,Object(n.a)({},"".concat(i,"-disabled"),o)),style:a,unselectable:"unselectable",ref:this.savePaginationNode},V),tt,h.a.createElement("li",{title:m?d.prev_page:null,onClick:this.prev,tabIndex:et?null:0,onKeyPress:this.runIfEnterPrev,className:f()("".concat(i,"-prev"),Object(n.a)({},"".concat(i,"-disabled"),et)),"aria-disabled":et},this.renderPrev(H)),M,h.a.createElement("li",{title:m?d.next_page:null,onClick:this.next,tabIndex:it?null:0,onKeyPress:this.runIfEnterNext,className:f()("".concat(i,"-next"),Object(n.a)({},"".concat(i,"-disabled"),it)),"aria-disabled":it},this.renderNext(z)),h.a.createElement(b,{disabled:o,locale:d,rootPrefixCls:i,selectComponentClass:T,selectPrefixCls:O,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:R,pageSize:_,pageSizeOptions:A,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:U}))}}],[{key:"getDerivedStateFromProps",value:function(t,e){var i={};if("current"in t&&(i.current=t.current,t.current!==e.current&&(i.currentInputValue=i.current)),"pageSize"in t&&t.pageSize!==e.pageSize){var r=e.current,n=C(t.pageSize,e,t);r=r>n?n:r,"current"in t||(i.current=r,i.currentInputValue=r),i.pageSize=t.pageSize}return i}}]),i}(h.a.Component);k.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:S,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:S,locale:E.a,style:{},itemRender:function(t,e,i){return i},totalBoundaryShowSizeChanger:50};var w=k},"6RRn":
/*!*******************************************!*\
!*** ./node_modules/rc-table/es/index.js ***!
\*******************************************/
/*! exports provided: Summary, Column, ColumnGroup, INTERNAL_COL_DEFINE, default */
/*! exports used: INTERNAL_COL_DEFINE, Summary, default */function(t,e,i){"use strict";var r=i(/*! ./Table */"wCXF"),n=i(/*! ./Footer */"n6Qo");i.d(e,"b",(function(){return n.a}));i(/*! ./sugar/Column */"IBYe"),i(/*! ./sugar/ColumnGroup */"6eGT");var s=i(/*! ./utils/legacyUtil */"hW8S");i.d(e,"a",(function(){return s.a})),e.c=r.b},"6eGT":
/*!*******************************************************!*\
!*** ./node_modules/rc-table/es/sugar/ColumnGroup.js ***!
\*******************************************************/
/*! exports provided: default */
/*! exports used: default */function(t,e,i){"use strict";e.a=function(t){return null}},"815F":
/*!***************************************************!*\
!*** ./node_modules/rc-tree/es/utils/treeUtil.js ***!
\***************************************************/
/*! exports provided: getKey, warningWithoutKey, convertTreeToData, flattenTreeData, traverseDataNodes, convertDataToEntities, getTreeNodeProps, convertNodePropsToEventData */
/*! exports used: convertDataToEntities, convertNodePropsToEventData, convertTreeToData, flattenTreeData, getKey, getTreeNodeProps */function(t,e,i){"use strict";i.d(e,"e",(function(){return c})),i.d(e,"c",(function(){return u})),i.d(e,"d",(function(){return h})),i.d(e,"a",(function(){return f})),i.d(e,"f",(function(){return p})),i.d(e,"b",(function(){return g}));var r=i(/*! @babel/runtime/helpers/esm/toConsumableArray */"KQm4"),n=i(/*! @babel/runtime/helpers/esm/objectSpread2 */"VTBJ"),s=i(/*! @babel/runtime/helpers/esm/objectWithoutProperties */"Ff2n"),a=i(/*! rc-util/es/Children/toArray */"Zm9Q"),o=i(/*! rc-util/es/warning */"Kwbf"),l=i(/*! ../util */"OZM5");function c(t,e){return null!=t?t:e}function u(t){return function t(e){return Object(a.a)(e).map((function(e){if(!Object(l.i)(e))return Object(o.a)(!e,"Tree/TreeNode can only accept TreeNode as children."),null;var i=e.key,r=e.props,a=r.children,c=Object(s.a)(r,["children"]),u=Object(n.a)({key:i},c),h=t(a);return h.length&&(u.children=h),u})).filter((function(t){return t}))}(t)}function h(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=new Set(!0===e?[]:e),s=[];function a(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t.map((function(u,h){var d=Object(l.h)(o?o.pos:"0",h),f=c(u.key,d),p=Object(n.a)(Object(n.a)({},u),{},{parent:o,pos:d,children:null,data:u,isStart:[].concat(Object(r.a)(o?o.isStart:[]),[0===h]),isEnd:[].concat(Object(r.a)(o?o.isEnd:[]),[h===t.length-1])});return s.push(p),!0===e||i.has(f)?p.children=a(u.children||[],p):p.children=[],p}))}return a(t),s}function d(t,e,i){var r;i?"string"==typeof i?r=function(t){return t[i]}:"function"==typeof i&&(r=function(t){return i(t)}):r=function(t,e){return c(t.key,e)},function i(n,s,a){var o=n?n.children:t,c=n?Object(l.h)(a.pos,s):"0";if(n){var u=r(n,c),h={node:n,index:s,pos:c,key:u,parentPos:a.node?a.pos:null,level:a.level+1};e(h)}o&&o.forEach((function(t,e){i(t,e,{node:n,pos:c,level:a?a.level+1:-1})}))}(null)}function f(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.initWrapper,r=e.processEntity,n=e.onProcessFinished,s=arguments.length>2?arguments[2]:void 0,a={},o={},l={posEntities:a,keyEntities:o};return i&&(l=i(l)||l),d(t,(function(t){var e=t.node,i=t.index,n=t.pos,s=t.key,u=t.parentPos,h={node:e,index:i,key:s,pos:n,level:t.level},d=c(s,n);a[n]=h,o[d]=h,h.parent=a[u],h.parent&&(h.parent.children=h.parent.children||[],h.parent.children.push(h)),r&&r(h,l)}),s),n&&n(l),l}function p(t,e){var i=e.expandedKeys,r=e.selectedKeys,n=e.loadedKeys,s=e.loadingKeys,a=e.checkedKeys,o=e.halfCheckedKeys,l=e.dragOverNodeKey,c=e.dropPosition,u=e.keyEntities[t];return{eventKey:t,expanded:-1!==i.indexOf(t),selected:-1!==r.indexOf(t),loaded:-1!==n.indexOf(t),loading:-1!==s.indexOf(t),checked:-1!==a.indexOf(t),halfChecked:-1!==o.indexOf(t),pos:String(u?u.pos:""),dragOver:l===t&&0===c,dragOverGapTop:l===t&&-1===c,dragOverGapBottom:l===t&&1===c}}function g(t){var e=t.data,i=t.expanded,r=t.selected,s=t.checked,a=t.loaded,l=t.loading,c=t.halfChecked,u=t.dragOver,h=t.dragOverGapTop,d=t.dragOverGapBottom,f=t.pos,p=t.active,g=Object(n.a)(Object(n.a)({},e),{},{expanded:i,selected:r,checked:s,loaded:a,loading:l,halfChecked:c,dragOver:u,dragOverGapTop:h,dragOverGapBottom:d,pos:f,active:p});return"props"in g||Object.defineProperty(g,"props",{get:function(){return Object(o.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),t}}),g}},"8hTe":
/*!******************************************************!*\
!*** ./src/components/RenderHtml/index.less?modules ***!
\******************************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,i){t.exports={button:"button___1wy9m"}},"9Bee":
/*!*********************************************************!*\
!*** ./src/components/RenderHtml/index.tsx + 3 modules ***!
\*********************************************************/
/*! exports provided: default */
/*! exports used: default */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/regenerator/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/RenderHtml/index.less?modules (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/PreviewAll/index.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/env.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/fetch.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/button/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/button/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/space/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/space/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/hls.js/dist/hls.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/katex/dist/katex.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/marked/lib/marked.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/marked/src/helpers.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(t,e,i){"use strict";i("DYRE");var r=i("zeV3"),n=(i("+L6B"),i("2/Rp")),s=i("k1fw"),a=i("9og8"),o=i("tJVT"),l=i("WmNS"),c=i.n(l),u=i("q1tI"),h=i.n(u),d=(i("vg9a"),i("DlQD")),f=i.n(d),p=i("rUJ1");var g=[],v=["<ul>"],m=new f.a.Renderer,y=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function b(){g.length=0,v=["<ul>"]}var E={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function S(){return function t(e,i,r,n){if(i>=e.length||e[i].level<=r)return i;var s=e[i];n.push("<li><a href='#"+s.anchor+"'>"+s.text+"</a>");var a=[];return i=t(e,++i,s.level,a),a.length>0&&(n.push("<ul>"),a.forEach((function(t){n.push(t)})),n.push("</ul>")),n.push("</li>"),i=t(e,i,r,n)}(g,0,0,v),v.push("</ul>"),v.join("")}var C={heading:function(t){var e=y.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[1].length,text:e[2]}},fences:function(t){var e=this.rules.block.fences.exec(t);if(e){var i=e[0],r=function(t,e){var i=t.match(/^(\s+)(?:```)/);if(null===i)return e;var r=i[1];return e.split("\n").map((function(t){var e=t.match(/^\s+/);return null===e?t:Object(o.a)(e,1)[0].length>=r.length?t.slice(r.length):t})).join("\n")}(i,e[3]||""),n=e[2]?e[2].trim():e[2];if(["latex","katex","math"].indexOf(n)>=0){var s=x(),a=r;r=s,T[s]={type:"block",expression:a}}return{type:"code",raw:i,lang:n,text:r}}}},k=/(?:\${2})([^\n`]+?)(?:\${2})/gi,w=0,x=function(){return"__special_katext_id_".concat(w++,"__")},T={};function O(){w=0,T={}}function A(t){return t=t.replace(k,(function(t,e){var i=x();return T[i]={type:"inline",expression:e},i}))}var L=m.listitem;m.listitem=function(t){return L(A(t))};var R=m.paragraph;m.paragraph=function(t){return R(A(t))};var _=m.tablecell;m.tablecell=function(t,e){return _(A(t),e)},m.code=function(t,e,i){var r=(e||"").match(/\S*/)[0];return r?["latex","katex","math"].indexOf(r)>=0?"<p class='editormd-tex'>".concat(t,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(e,'">').concat(i?t:Object(p.escape)(t,!0),"</code></pre>\n"):'<pre class="prettyprint linenums"><code>'+(i?t:Object(p.escape)(t,!0))+"</code></pre>"},m.heading=function(t,e,i){var r=this.options.headerPrefix+i.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return g.push({anchor:r,level:e,text:t}),"<h"+e+' id="'+r+'">'+t+"</h"+e+">"},f.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),f.a.use({tokenizer:C,renderer:m});var D=f.a,I=(i("SJMd"),i("ulZh")),M=i.n(I),P=i("m3rI"),N=i("Oy/b"),j=i("p5ED"),B=i("ErOA"),F=function(t,e){return(F=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(t,e)};function U(t,e){function i(){this.constructor=t}F(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function G(t,e,i,r){return new(i||(i=Promise))((function(n,s){function a(t){try{l(r.next(t))}catch(t){s(t)}}function o(t){try{l(r.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((r=r.apply(t,e||[])).next())}))}function H(t,e){var i,r,n,s,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function o(s){return function(o){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,r&&(n=2&s[0]?r.return:s[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;switch(r=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((n=(n=a.trys).length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{i=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,o])}}}function z(){for(var t=0,e=0,i=arguments.length;e<i;e++)t+=arguments[e].length;var r=Array(t),n=0;for(e=0;e<i;e++)for(var s=arguments[e],a=0,o=s.length;a<o;a++,n++)r[n]=s[a];return r}var V=function(){function t(){}return t.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},t.setAttributes=function(t,e){for(var i=0,r=e;i<r.length;i++){var n=r[i],s=n[0],a=n[1];t.setAttribute(s,a)}},t.createRect=function(e,i,r){var n=document.createElementNS("http://www.w3.org/2000/svg","rect");return n.setAttribute("width",e.toString()),n.setAttribute("height",i.toString()),r&&t.setAttributes(n,r),n},t.createLine=function(e,i,r,n,s){var a=document.createElementNS("http://www.w3.org/2000/svg","line");return a.setAttribute("x1",e.toString()),a.setAttribute("y1",i.toString()),a.setAttribute("x2",r.toString()),a.setAttribute("y2",n.toString()),s&&t.setAttributes(a,s),a},t.createPolygon=function(e,i){var r=document.createElementNS("http://www.w3.org/2000/svg","polygon");return r.setAttribute("points",e),i&&t.setAttributes(r,i),r},t.createCircle=function(e,i){var r=document.createElementNS("http://www.w3.org/2000/svg","circle");return r.setAttribute("cx",(e/2).toString()),r.setAttribute("cy",(e/2).toString()),r.setAttribute("r",e.toString()),i&&t.setAttributes(r,i),r},t.createEllipse=function(e,i,r){var n=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return n.setAttribute("cx",(e/2).toString()),n.setAttribute("cy",(i/2).toString()),n.setAttribute("rx",(e/2).toString()),n.setAttribute("ry",(i/2).toString()),r&&t.setAttributes(n,r),n},t.createGroup=function(e){var i=document.createElementNS("http://www.w3.org/2000/svg","g");return e&&t.setAttributes(i,e),i},t.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},t.createMarker=function(e,i,r,n,s,a,o){var l=document.createElementNS("http://www.w3.org/2000/svg","marker");return t.setAttributes(l,[["id",e],["orient",i],["markerWidth",r.toString()],["markerHeight",n.toString()],["refX",s.toString()],["refY",a.toString()]]),l.appendChild(o),l},t.createText=function(e){var i=document.createElementNS("http://www.w3.org/2000/svg","text");return i.setAttribute("x","0"),i.setAttribute("y","0"),e&&t.setAttributes(i,e),i},t.createTSpan=function(e,i){var r=document.createElementNS("http://www.w3.org/2000/svg","tspan");return r.textContent=e,i&&t.setAttributes(r,i),r},t.createImage=function(e){var i=document.createElementNS("http://www.w3.org/2000/svg","image");return e&&t.setAttributes(i,e),i},t.createPoint=function(t,e){var i=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return i.x=t,i.y=e,i},t.createPath=function(e,i){var r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",e),i&&t.setAttributes(r,i),r},t}(),K=function(){function t(){}return t.addKey=function(e){t.key=e},Object.defineProperty(t,"isLicensed",{get:function(){return!!t.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(t.key)},enumerable:!1,configurable:!0}),t}(),W=function(){function t(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return t.prototype.rasterize=function(t,e,i){var r=this;return new Promise((function(n){var s=void 0!==i?i:document.createElement("canvas");null===t&&(r.markersOnly=!0,r.naturalSize=!1);var a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("xmlns","http://www.w3.org/2000/svg"),a.setAttribute("width",e.width.baseVal.valueAsString),a.setAttribute("height",e.height.baseVal.valueAsString),a.setAttribute("viewBox","0 0 "+e.viewBox.baseVal.width.toString()+" "+e.viewBox.baseVal.height.toString()),a.innerHTML=e.innerHTML,!0===r.naturalSize?(a.width.baseVal.value=t.naturalWidth,a.height.baseVal.value=t.naturalHeight):void 0!==r.width&&void 0!==r.height&&(a.width.baseVal.value=r.width,a.height.baseVal.value=r.height),s.width=a.width.baseVal.value,s.height=a.height.baseVal.value;var o=a.outerHTML,l=s.getContext("2d");!0!==r.markersOnly&&l.drawImage(t,0,0,s.width,s.height);var c=window.URL,u=new Image(s.width,s.height);u.setAttribute("crossOrigin","anonymous");var h=new Blob([o],{type:"image/svg+xml"}),d=c.createObjectURL(h);u.onload=function(){l.drawImage(u,0,0),c.revokeObjectURL(d);var t=s.toDataURL(r.imageType,r.imageQuality);n(t)},u.src=d}))},t}(),Y=function(){},X=function(){function t(t){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+t+"_"}return Object.defineProperty(t.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(t.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(t.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),t.prototype.addClass=function(t){return void 0===this.styleSheet&&this.addStyleSheet(),t.name=""+this.classNamePrefix+t.localName,this.classes.push(t),this.styleSheet.sheet.insertRule("."+t.name+" {"+t.style+"}",this.styleSheet.sheet.cssRules.length),t},t.prototype.addRule=function(t){void 0===this.styleSheet&&this.addStyleSheet(),this.rules.push(t),this.styleSheet.sheet.insertRule(t.selector+" {"+t.style+"}",this.styleSheet.sheet.cssRules.length)},t.prototype.addStyleSheet=function(){var t;this.styleSheet=document.createElement("style"),(null!==(t=this.styleSheetRoot)&&void 0!==t?t:document.head).appendChild(this.styleSheet),this.addRule(new q("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new q("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames","\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n ")),this.addRule(new q("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames","\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n ")),this.addClass(new $("fade_in","\n animation-duration: 0.3s;\n animation-name: "+this.classNamePrefix+"_fade_in_animation_frames;\n ")),this.addClass(new $("fade_out","\n animation-duration: 0.3s;\n animation-name: "+this.classNamePrefix+"_fade_out_animation_frames;\n "))},t.prototype.removeStyleSheet=function(){var t;this.styleSheet&&((null!==(t=this.styleSheetRoot)&&void 0!==t?t:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},t}(),q=function(t,e){this.selector=t,this.style=e},$=function(t,e){this.localName=t,this.style=e},J=function(){function t(t,e,i,r,n){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=t,this.displayMode=e,this.markerItems=i,this.uiStyleSettings=r,this.styles=n,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return t.prototype.show=function(t){var e=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=t,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var i=document.createElement("div");i.className=this.toolbarBlockStyleClass.name,i.style.whiteSpace="nowrap",this.uiContainer.appendChild(i),this.addActionButton(i,'<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(i,'<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(i,'<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(i,'<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(i,'<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(i,'<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(i,'<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(i,'<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(t){var i=document.createElement("div");i.className=""+e.toolbarButtonStyleClass.name,i.setAttribute("data-type-name",t.typeName),i.innerHTML=t.icon,i.addEventListener("click",(function(){e.markerToolbarButtonClicked(i,t)})),e.buttons.push(i),e.markerButtons.push(i)})),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 r=document.createElement("div");r.className=this.toolbarBlockStyleClass.name,r.style.whiteSpace="nowrap",r.style.display=!1!==this.uiStyleSettings.resultButtonBlockVisible?"":"none",this.uiContainer.appendChild(r),this.addActionButton(r,'<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(r,'<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()},t.prototype.addButtonClickListener=function(t){this.buttonClickListeners.push(t)},t.prototype.removeButtonClickListener=function(t){this.buttonClickListeners.indexOf(t)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(t),1)},t.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},t.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var t=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<t||e===t&&this.markerButtons.length-1===t?this.markerButtonBlock.appendChild(this.markerButtons[e]):(e===t&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[e]))}},t.prototype.overflowButtonClicked=function(){"none"!==this.markerButtonOverflowBlock.style.display?(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")},t.prototype.resetButtonStyles=function(){var t=this;this.buttons.forEach((function(e){e.className=e.className.replace(t.uiStyleSettings.toolbarButtonStyleColorsClassName?t.uiStyleSettings.toolbarButtonStyleColorsClassName:t.toolbarButtonStyleColorsClass.name,"").trim(),e.className=e.className.replace(t.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?t.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:t.toolbarActiveButtonStyleColorsClass.name,"").trim(),e.className+=" "+(t.uiStyleSettings.toolbarButtonStyleColorsClassName?t.uiStyleSettings.toolbarButtonStyleColorsClassName:t.toolbarButtonStyleColorsClass.name)}))},t.prototype.addActionButton=function(t,e,i){var r=this,n=document.createElement("div");switch(n.className=""+this.toolbarButtonStyleClass.name,n.innerHTML=e,n.setAttribute("data-action",i),n.addEventListener("click",(function(){r.actionToolbarButtonClicked(n,i)})),i){case"select":n.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":n.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":n.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":n.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":n.style.fill=this.uiStyleSettings.closeButtonColor}t.appendChild(n),this.buttons.push(n)},t.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new $("toolbar","\n width: 100%;\n flex-shrink: 0;\n display: flex;\n flex-direction: row;\n justify-content: space-between; \n height: "+this.uiStyleSettings.toolbarHeight+"px;\n box-sizing: content-box;\n "+("inline"===this.displayMode?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+"\n "+("inline"===this.displayMode?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+"\n overflow: hidden;\n ")),this.toolbarStyleColorsClass=this.styles.addClass(new $("toolbar_colors","\n background-color: "+this.uiStyleSettings.toolbarBackgroundColor+";\n box-shadow: 0px 3px rgba(33, 33, 33, 0.1);\n ")),this.toolbarBlockStyleClass=this.styles.addClass(new $("toolbar-block","\n display: inline-block;\n box-sizing: content-box;\n ")),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new $("toolbar-overflow-block","\n position: absolute;\n top: "+this.uiStyleSettings.toolbarHeight+"px;\n max-width: "+2*this.uiStyleSettings.toolbarHeight+"px;\n z-index: 10;\n box-sizing: content-box;\n ")),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new $("toolbar-overflow-block_colors","\n background-color: "+this.uiStyleSettings.toolbarBackgroundColor+";\n "));var t=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new $("toolbar_button","\n display: inline-block;\n width: "+(this.uiStyleSettings.toolbarHeight-2*t)+"px;\n height: "+(this.uiStyleSettings.toolbarHeight-2*t)+"px;\n padding: "+t+"px;\n box-sizing: content-box;\n ")),this.toolbarButtonStyleColorsClass=this.styles.addClass(new $("toolbar_button_colors","\n fill: "+this.uiStyleSettings.toolbarColor+";\n ")),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new $("toolbar_active_button","\n fill: "+this.uiStyleSettings.toolbarColor+";\n background-color: "+this.uiStyleSettings.toolbarBackgroundHoverColor+"\n ")),this.styles.addRule(new q("."+this.toolbarButtonStyleClass.name+" svg","\n height: "+this.uiStyleSettings.toolbarHeight/2+"px;\n ")),this.styles.addRule(new q("."+this.toolbarButtonStyleColorsClass.name+":hover","\n background-color: "+this.uiStyleSettings.toolbarBackgroundHoverColor+"\n "))},t.prototype.markerToolbarButtonClicked=function(t,e){this.setActiveButton(t),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach((function(t){return t("marker",e)})),this.markerButtonOverflowBlock.style.display="none"},t.prototype.actionToolbarButtonClicked=function(t,e){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach((function(t){return t("action",e)})),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},t.prototype.setActiveButton=function(t){this.resetButtonStyles(),t.className=t.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),t.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},t.prototype.setActiveMarkerButton=function(t){var e=this.markerButtons.find((function(e){return e.getAttribute("data-type-name")===t}));e&&this.setActiveButton(e)},t.prototype.setCurrentMarker=function(t){var e=this;this.currentMarker=t,this.buttons.filter((function(t){return/delete|notes/.test(t.getAttribute("data-action"))})).forEach((function(t){void 0===e.currentMarker?(t.style.fillOpacity="0.4",t.style.pointerEvents="none"):(t.style.fillOpacity="1",t.style.pointerEvents="all")}))},t}(),Q=function(){function t(t,e,i,r){this.panels=[],this.panelButtons=[],this.markerjsContainer=t,this.displayMode=e,this.uiStyleSettings=i,this.styles=r,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return t.prototype.addStyles=function(){var t;this.toolboxStyleClass=this.styles.addClass(new $("toolbox","\n width: 100%;\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n font-family: sans-serif;\n "+("popup"===this.displayMode?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+"\n box-sizing: content-box;\n "+("popup"===this.displayMode?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+"\n "+("inline"===this.displayMode?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+"\n "+("inline"===this.displayMode?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+"\n overflow: hidden;\n ")),this.toolboxStyleColorsClass=this.styles.addClass(new $("toolbox_colors","\n color: "+this.uiStyleSettings.toolboxColor+";\n "));var e=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new $("toolbox-button-row","\n display: flex;\n cursor: default;\n box-sizing: content-box;\n ")),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new $("toolbox-button-row_colors","\n background-color: "+this.uiStyleSettings.toolbarBackgroundColor+";\n ")),this.toolboxPanelRowStyleClass=this.styles.addClass(new $("toolbox-panel-row","\n display: flex;\n "+("inline"===this.displayMode?"position: absolute;":"")+"\n "+("inline"===this.displayMode?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+"\n cursor: default;\n height: "+1.5*this.uiStyleSettings.toolbarHeight+"px;\n "+("inline"===this.displayMode?"width: 100%;":"")+"\n box-sizing: content-box;\n ")),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new $("toolbox-panel-row_colors","\n background-color: "+(null!==(t=this.uiStyleSettings.toolboxBackgroundColor)&&void 0!==t?t:this.uiStyleSettings.toolbarBackgroundHoverColor)+";\n ")),this.toolboxButtonStyleClass=this.styles.addClass(new $("toolbox_button","\n display: inline-block;\n width: "+(this.uiStyleSettings.toolbarHeight-2*e)+"px;\n height: "+(this.uiStyleSettings.toolbarHeight-2*e)+"px;\n padding: "+e+"px;\n box-sizing: content-box;\n ")),this.toolboxButtonStyleColorsClass=this.styles.addClass(new $("toolbox-button_colors","\n fill: "+this.uiStyleSettings.toolbarColor+";\n ")),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new $("toolbox-active-button_colors","\n background-color: "+this.uiStyleSettings.toolbarBackgroundHoverColor+";\n fill: "+this.uiStyleSettings.toolbarColor+";\n ")),this.styles.addRule(new q("."+this.toolboxButtonStyleColorsClass.name+":hover","\n background-color: "+this.uiStyleSettings.toolbarBackgroundHoverColor+"\n ")),this.styles.addRule(new q("."+this.toolboxButtonStyleClass.name+" svg","\n height: "+this.uiStyleSettings.toolbarHeight/2+"px;\n "))},t.prototype.show=function(t){var e;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=t,this.uiContainer.className=this.toolboxStyleClass.name+" "+(null!==(e=this.uiStyleSettings.toolboxStyleColorsClassName)&&void 0!==e?e:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},t.prototype.setPanelButtons=function(t){var e,i,r=this;this.panels=t,void 0!==this.uiContainer&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+(null!==(e=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)&&void 0!==e?e:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+(null!==(i=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)&&void 0!==i?i:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach((function(t){var e;t.uiStyleSettings=r.uiStyleSettings;var i=document.createElement("div");i.className=r.toolboxButtonStyleClass.name+" "+(null!==(e=r.uiStyleSettings.toolboxButtonStyleColorsClassName)&&void 0!==e?e:r.toolboxButtonStyleColorsClass.name),i.innerHTML=t.icon,i.title=t.title,i.addEventListener("click",(function(){r.panelButtonClick(t)})),r.panelButtons.push(i),r.buttonRow.appendChild(i)})),"inline"===this.displayMode?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},t.prototype.panelButtonClick=function(t){var e=this,i=-1;if(t!==this.activePanel){i=this.panels.indexOf(t),this.panelRow.innerHTML="";var r=t.getUi();r.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(r),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=t}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout((function(){"inline"===e.displayMode?e.panelRow.style.display="none":e.panelRow.style.visibility="hidden"}),200);this.panelButtons.forEach((function(t,r){var n,s;t.className=e.toolboxButtonStyleClass.name+" "+(r===i?""+(null!==(n=e.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)&&void 0!==n?n:e.toolboxActiveButtonStyleColorsClass.name):""+(null!==(s=e.uiStyleSettings.toolboxButtonStyleColorsClassName)&&void 0!==s?s:e.toolboxButtonStyleColorsClass.name))}))},t}(),Z=function(t,e){this.title=t,this.icon=e},tt=function(t){function e(e,i,r,n){var s=t.call(this,e,n||'<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 s.colors=[],s.addTransparent=!1,s.colorBoxes=[],s.colors=i,s.currentColor=r,s.setCurrentColor=s.setCurrentColor.bind(s),s.getColorBox=s.getColorBox.bind(s),s}return U(e,t),e.prototype.getUi=function(){var t=this,e=document.createElement("div");return e.style.overflow="hidden",e.style.whiteSpace="nowrap",this.colors.forEach((function(i){var r=t.getColorBox(i);e.appendChild(r),t.colorBoxes.push(r)})),e},e.prototype.getColorBox=function(t){var e=this,i=this.uiStyleSettings.toolbarHeight/4,r=this.uiStyleSettings.toolbarHeight-i,n=document.createElement("div");n.style.display="inline-block",n.style.boxSizing="content-box",n.style.width=r-2+"px",n.style.height=r-2+"px",n.style.padding="1px",n.style.marginRight="2px",n.style.marginBottom="2px",n.style.borderWidth="2px",n.style.borderStyle="solid",n.style.borderRadius=(r+2)/2+"px",n.style.borderColor=t===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",n.addEventListener("click",(function(){e.setCurrentColor(t,n)}));var s=document.createElement("div");return s.style.display="inline-block",s.style.width=r-2+"px",s.style.height=r-2+"px",s.style.backgroundColor=t,s.style.borderRadius=r/2+"px","transparent"===t&&(s.style.fill=this.uiStyleSettings.toolboxAccentColor,s.innerHTML='<svg viewBox="0 0 24 24">\n <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" />\n </svg>'),n.appendChild(s),n},e.prototype.setCurrentColor=function(t,e){var i=this;this.currentColor=t,this.colorBoxes.forEach((function(t){t.style.borderColor=t===e?i.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onColorChanged&&this.onColorChanged(t)},e}(Z),et=function(){function t(t,e,i){this._state="new",this._isSelected=!1,this._container=t,this._overlayContainer=e,this.globalSettings=i,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(t.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),t.prototype.ownsTarget=function(t){return!1},Object.defineProperty(t.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),t.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},t.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},t.prototype.pointerDown=function(t,e){},t.prototype.dblClick=function(t,e){},t.prototype.manipulate=function(t){},t.prototype.pointerUp=function(t){this.stateChanged()},t.prototype.dispose=function(){},t.prototype.addMarkerVisualToContainer=function(t){this.container.childNodes.length>0?this.container.insertBefore(t,this.container.childNodes[0]):this.container.appendChild(t)},t.prototype.getState=function(){return{typeName:t.typeName,state:this.state,notes:this.notes}},t.prototype.restoreState=function(t){this._state=t.state,this.notes=t.notes},t.prototype.scale=function(t,e){},t.prototype.colorChanged=function(t){this.onColorChanged&&this.onColorChanged(t),this.stateChanged()},t.prototype.fillColorChanged=function(t){this.onFillColorChanged&&this.onFillColorChanged(t),this.stateChanged()},t.prototype.stateChanged=function(){if(this.onStateChanged&&"creating"!==this.state&&"new"!==this.state){var t=this.getState();void 0!==this.manipulationStartState&&(this.manipulationStartState.state="select"),t.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(t)&&this.onStateChanged(this)}},t.typeName="MarkerBase",t}(),it=function(){function t(){this.findGripByVisual=this.findGripByVisual.bind(this)}return t.prototype.findGripByVisual=function(t){return this.topLeft.ownsTarget(t)?this.topLeft:this.topCenter.ownsTarget(t)?this.topCenter:this.topRight.ownsTarget(t)?this.topRight:this.centerLeft.ownsTarget(t)?this.centerLeft:this.centerRight.ownsTarget(t)?this.centerRight:this.bottomLeft.ownsTarget(t)?this.bottomLeft:this.bottomCenter.ownsTarget(t)?this.bottomCenter:this.bottomRight.ownsTarget(t)?this.bottomRight:void 0},t}(),rt=function(){function t(){this.GRIP_SIZE=10,this.visual=V.createGroup(),this.visual.appendChild(V.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(V.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return t.prototype.ownsTarget=function(t){return t===this.visual||t===this.visual.childNodes[0]||t===this.visual.childNodes[1]},t}(),nt=function(){function t(){}return t.toITransformMatrix=function(t){return{a:t.a,b:t.b,c:t.c,d:t.d,e:t.e,f:t.f}},t.toSVGMatrix=function(t,e){return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f,t},t}(),st=function(t){function e(e,i,r){var n=t.call(this,e,i,r)||this;return n.left=0,n.top=0,n.width=0,n.height=0,n.defaultSize={x:50,y:20},n.offsetX=0,n.offsetY=0,n.rotationAngle=0,n.CB_DISTANCE=10,n._suppressMarkerCreateEvent=!1,n.container.transform.baseVal.appendItem(V.createTransform()),n.setupControlBox(),n}return U(e,t),Object.defineProperty(e.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"visual",{get:function(){return this._visual},set:function(t){this._visual=t;var e=V.createTransform();this._visual.transform.baseVal.appendItem(e)},enumerable:!1,configurable:!0}),e.prototype.ownsTarget=function(e){return!!t.prototype.ownsTarget.call(this,e)||!!(void 0!==this.controlGrips.findGripByVisual(e)||void 0!==this.rotatorGrip&&this.rotatorGrip.ownsTarget(e))},e.prototype.pointerDown=function(e,i){t.prototype.pointerDown.call(this,e,i),"new"===this.state&&(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 r=this.unrotatePoint(e);if(this.manipulationStartX=r.x,this.manipulationStartY=r.y,this.offsetX=r.x-this.left,this.offsetY=r.y-this.top,"new"!==this.state)if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(i),void 0!==this.activeGrip)this._state="resize";else if(void 0!==this.rotatorGrip&&this.rotatorGrip.ownsTarget(i)){this.activeGrip=this.rotatorGrip;var n=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=n.x-this.width/2,this.top=n.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var s=this.container.transform.baseVal.getItem(0);s.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(s,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},e.prototype.pointerUp=function(e){var i=this.state;t.prototype.pointerUp.call(this,e),"creating"===this.state&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(e),this._state="select","creating"===i&&this.onMarkerCreated&&!1===this._suppressMarkerCreateEvent&&this.onMarkerCreated(this)},e.prototype.moveVisual=function(t){this.visual.style.transform="translate("+t.x+"px, "+t.y+"px)"},e.prototype.manipulate=function(t){var e=this.unrotatePoint(t);"creating"===this.state?this.resize(t):"move"===this.state?(this.left=this.manipulationStartLeft+(e.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(e.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):"resize"===this.state?this.resize(e):"rotate"===this.state&&this.rotate(t)},e.prototype.resize=function(t){var e=this.manipulationStartLeft,i=this.manipulationStartWidth,r=this.manipulationStartTop,n=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:e=this.manipulationStartLeft+t.x-this.manipulationStartX,i=this.manipulationStartWidth+this.manipulationStartLeft-e;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:i=this.manipulationStartWidth+t.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:r=this.manipulationStartTop+t.y-this.manipulationStartY,n=this.manipulationStartHeight+this.manipulationStartTop-r;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:n=this.manipulationStartHeight+t.y-this.manipulationStartY}i>=0?(this.left=e,this.width=i):(this.left=e+i,this.width=-i),n>=0?(this.top=r,this.height=n):(this.top=r+n,this.height=-n),this.setSize()},e.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},e.prototype.rotate=function(t){if(Math.abs(t.x-this.centerX)>.1){var e=Math.sign(t.x-this.centerX);this.rotationAngle=180*Math.atan((t.y-this.centerY)/(t.x-this.centerX))/Math.PI+90*e,this.applyRotation()}},e.prototype.applyRotation=function(){var t=this.container.transform.baseVal.getItem(0);t.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(t,0)},e.prototype.rotatePoint=function(t){if(0===this.rotationAngle)return t;var e=this.container.getCTM(),i=V.createPoint(t.x,t.y);return{x:(i=i.matrixTransform(e)).x,y:i.y}},e.prototype.unrotatePoint=function(t){if(0===this.rotationAngle)return t;var e=this.container.getCTM();e=e.inverse();var i=V.createPoint(t.x,t.y);return{x:(i=i.matrixTransform(e)).x,y:i.y}},e.prototype.select=function(){t.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},e.prototype.deselect=function(){t.prototype.deselect.call(this),this.controlBox.style.display="none"},e.prototype.setupControlBox=function(){this.controlBox=V.createGroup();var t=V.createTransform();t.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(t),this.container.appendChild(this.controlBox),this.controlRect=V.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),!0!==this.globalSettings.disableRotation&&(this.rotatorGripLine=V.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 it,this.addControlGrips(),this.controlBox.style.display="none"},e.prototype.adjustControlBox=function(){var t=this.controlBox.transform.baseVal.getItem(0);t.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(t,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),void 0!==this.rotatorGripLine&&(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()},e.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(),!0!==this.globalSettings.disableRotation&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},e.prototype.createGrip=function(){var t=new rt;return t.visual.transform.baseVal.appendItem(V.createTransform()),this.controlBox.appendChild(t.visual),t},e.prototype.positionGrips=function(){var t=this.controlGrips.topLeft.GRIP_SIZE,e=-t/2,i=e,r=(this.width+this.CB_DISTANCE)/2-t/2,n=(this.height+this.CB_DISTANCE)/2-t/2,s=this.height+this.CB_DISTANCE-t/2,a=this.width+this.CB_DISTANCE-t/2;this.positionGrip(this.controlGrips.topLeft.visual,e,i),this.positionGrip(this.controlGrips.topCenter.visual,r,i),this.positionGrip(this.controlGrips.topRight.visual,a,i),this.positionGrip(this.controlGrips.centerLeft.visual,e,n),this.positionGrip(this.controlGrips.centerRight.visual,a,n),this.positionGrip(this.controlGrips.bottomLeft.visual,e,s),this.positionGrip(this.controlGrips.bottomCenter.visual,r,s),this.positionGrip(this.controlGrips.bottomRight.visual,a,s),void 0!==this.rotatorGrip&&this.positionGrip(this.rotatorGrip.visual,r,i-3*this.CB_DISTANCE)},e.prototype.positionGrip=function(t,e,i){var r=t.transform.baseVal.getItem(0);r.setTranslate(e,i),t.transform.baseVal.replaceItem(r,0)},e.prototype.hideControlBox=function(){this.controlBox.style.display="none"},e.prototype.showControlBox=function(){this.controlBox.style.display=""},e.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:nt.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:nt.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},t.prototype.getState.call(this))},e.prototype.restoreState=function(e){t.prototype.restoreState.call(this,e);var i=e;this.left=i.left,this.top=i.top,this.width=i.width,this.height=i.height,this.rotationAngle=i.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(nt.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,i.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(nt.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,i.containerTransformMatrix))},e.prototype.scale=function(e,i){t.prototype.scale.call(this,e,i);var r=this.rotatePoint({x:this.left,y:this.top}),n=this.unrotatePoint({x:r.x*e,y:r.y*i});this.left=n.x,this.top=n.y,this.width=this.width*e,this.height=this.height*i,this.adjustControlBox()},e}(et),at=function(t){function e(e,i,r){var n=t.call(this,e,i,r)||this;return n.fillColor="transparent",n.strokeColor="transparent",n.strokeWidth=0,n.strokeDasharray="",n.opacity=1,n.setStrokeColor=n.setStrokeColor.bind(n),n.setFillColor=n.setFillColor.bind(n),n.setStrokeWidth=n.setStrokeWidth.bind(n),n.setStrokeDasharray=n.setStrokeDasharray.bind(n),n.createVisual=n.createVisual.bind(n),n}return U(e,t),e.prototype.ownsTarget=function(e){return!(!t.prototype.ownsTarget.call(this,e)&&e!==this.visual)},e.prototype.createVisual=function(){this.visual=V.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)},e.prototype.pointerDown=function(e,i){t.prototype.pointerDown.call(this,e,i),"new"===this.state&&(this.createVisual(),this.moveVisual(e),this._state="creating")},e.prototype.manipulate=function(e){t.prototype.manipulate.call(this,e)},e.prototype.resize=function(e){t.prototype.resize.call(this,e),this.setSize()},e.prototype.setSize=function(){t.prototype.setSize.call(this),V.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},e.prototype.pointerUp=function(e){t.prototype.pointerUp.call(this,e),this.setSize()},e.prototype.setStrokeColor=function(t){this.strokeColor=t,this.visual&&V.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(t),this.stateChanged()},e.prototype.setFillColor=function(t){this.fillColor=t,this.visual&&V.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},e.prototype.setStrokeWidth=function(t){this.strokeWidth=t,this.visual&&V.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},e.prototype.setStrokeDasharray=function(t){this.strokeDasharray=t,this.visual&&V.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},e.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},t.prototype.getState.call(this))},e.prototype.restoreState=function(e){var i=e;this.fillColor=i.fillColor,this.strokeColor=i.strokeColor,this.strokeWidth=i.strokeWidth,this.strokeDasharray=i.strokeDasharray,this.opacity=i.opacity,this.createVisual(),t.prototype.restoreState.call(this,e),this.setSize()},e.prototype.scale=function(e,i){t.prototype.scale.call(this,e,i),this.setSize()},e.title="Rectangle marker",e}(st),ot=function(t){function e(e,i,r,n){var s=t.call(this,e,n||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return s.widths=[],s.widthBoxes=[],s.widths=i,s.currentWidth=r,s.setCurrentWidth=s.setCurrentWidth.bind(s),s}return U(e,t),e.prototype.getUi=function(){var t=this,e=document.createElement("div");return e.style.display="flex",e.style.overflow="hidden",e.style.flexGrow="2",this.widths.forEach((function(i){var r=document.createElement("div");r.style.display="flex",r.style.flexGrow="2",r.style.alignItems="center",r.style.justifyContent="space-between",r.style.padding="5px",r.style.borderWidth="2px",r.style.borderStyle="solid",r.style.borderColor=i===t.currentWidth?t.uiStyleSettings.toolboxAccentColor:"transparent",r.addEventListener("click",(function(){t.setCurrentWidth(i,r)})),e.appendChild(r);var n=document.createElement("div");n.innerText=i.toString(),n.style.marginRight="5px",r.appendChild(n);var s=document.createElement("div");s.style.minHeight="20px",s.style.flexGrow="2",s.style.display="flex",s.style.alignItems="center";var a=document.createElement("hr");a.style.minWidth="20px",a.style.border="0px",a.style.borderTop=i+"px solid "+t.uiStyleSettings.toolboxColor,a.style.flexGrow="2",s.appendChild(a),r.appendChild(s),t.widthBoxes.push(r)})),e},e.prototype.setCurrentWidth=function(t,e){var i=this;this.currentWidth=t,this.widthBoxes.forEach((function(t){t.style.borderColor=t===e?i.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},e}(Z),lt=function(t){function e(e,i,r,n){var s=t.call(this,e,n||'<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 s.styles=[],s.styleBoxes=[],s.styles=i,s.currentStyle=r,s.setCurrentStyle=s.setCurrentStyle.bind(s),s}return U(e,t),e.prototype.getUi=function(){var t=this,e=document.createElement("div");return e.style.display="flex",e.style.overflow="hidden",e.style.flexGrow="2",this.styles.forEach((function(i){var r=document.createElement("div");r.style.display="flex",r.style.alignItems="center",r.style.justifyContent="space-between",r.style.padding="5px",r.style.borderWidth="2px",r.style.borderStyle="solid",r.style.overflow="hidden",r.style.maxWidth=100/t.styles.length-5+"%",r.style.borderColor=i===t.currentStyle?t.uiStyleSettings.toolboxAccentColor:"transparent",r.addEventListener("click",(function(){t.setCurrentStyle(i,r)})),e.appendChild(r);var n=document.createElement("div");n.style.minHeight="20px",n.style.flexGrow="2",n.style.overflow="hidden";var s='<svg width="100" height="20">\n <line x1="0" y1="10" x2="100" y2="10" stroke="'+t.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(""!==i?'stroke-dasharray="'+i+'"':"")+" />\n </svg>";n.innerHTML=s,r.appendChild(n),t.styleBoxes.push(r)})),e},e.prototype.setCurrentStyle=function(t,e){var i=this;this.currentStyle=t,this.styleBoxes.forEach((function(t){t.style.borderColor=t===e?i.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},e}(Z),ct=function(t){function e(e,i,r){var n=t.call(this,e,i,r)||this;return n.strokeColor=r.defaultColor,n.strokeWidth=r.defaultStrokeWidth,n.strokeDasharray=r.defaultStrokeDasharray,n.strokePanel=new tt("Line color",r.defaultColorSet,r.defaultColor),n.strokePanel.onColorChanged=n.setStrokeColor,n.strokeWidthPanel=new ot("Line width",r.defaultStrokeWidths,r.defaultStrokeWidth),n.strokeWidthPanel.onWidthChanged=n.setStrokeWidth,n.strokeStylePanel=new lt("Line style",r.defaultStrokeDasharrays,r.defaultStrokeDasharray),n.strokeStylePanel.onStyleChanged=n.setStrokeDasharray,n}return U(e,t),Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var i=t.prototype.getState.call(this);return i.typeName=e.typeName,i},e.typeName="FrameMarker",e.title="Frame marker",e.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',e}(at),ut=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},ht=function(t){function e(e,i,r){var n=t.call(this,e,i,r)||this;return n.x1=0,n.y1=0,n.x2=0,n.y2=0,n.defaultLength=50,n.manipulationStartX=0,n.manipulationStartY=0,n.manipulationStartX1=0,n.manipulationStartY1=0,n.manipulationStartX2=0,n.manipulationStartY2=0,n.setupControlBox(),n}return U(e,t),e.prototype.ownsTarget=function(e){return!!t.prototype.ownsTarget.call(this,e)||!(!this.grip1.ownsTarget(e)&&!this.grip2.ownsTarget(e))},e.prototype.pointerDown=function(e,i){t.prototype.pointerDown.call(this,e,i),this.manipulationStartX=e.x,this.manipulationStartY=e.y,"new"===this.state&&(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,"new"!==this.state&&(this.select(),this.grip1.ownsTarget(i)?this.activeGrip=this.grip1:this.grip2.ownsTarget(i)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},e.prototype.pointerUp=function(e){var i=this.state;t.prototype.pointerUp.call(this,e),"creating"===this.state&&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","creating"===i&&this.onMarkerCreated&&this.onMarkerCreated(this)},e.prototype.adjustVisual=function(){},e.prototype.manipulate=function(t){"creating"===this.state?this.resize(t):"move"===this.state?(this.x1=this.manipulationStartX1+t.x-this.manipulationStartX,this.y1=this.manipulationStartY1+t.y-this.manipulationStartY,this.x2=this.manipulationStartX2+t.x-this.manipulationStartX,this.y2=this.manipulationStartY2+t.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):"resize"===this.state&&this.resize(t)},e.prototype.resize=function(t){switch(this.activeGrip){case this.grip1:this.x1=t.x,this.y1=t.y;break;case this.grip2:case void 0:this.x2=t.x,this.y2=t.y}this.adjustVisual(),this.adjustControlBox()},e.prototype.select=function(){t.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},e.prototype.deselect=function(){t.prototype.deselect.call(this),this.controlBox.style.display="none"},e.prototype.setupControlBox=function(){this.controlBox=V.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},e.prototype.adjustControlBox=function(){this.positionGrips()},e.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},e.prototype.createGrip=function(){var t=new rt;return t.visual.transform.baseVal.appendItem(V.createTransform()),this.controlBox.appendChild(t.visual),t},e.prototype.positionGrips=function(){var t=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-t/2,this.y1-t/2),this.positionGrip(this.grip2.visual,this.x2-t/2,this.y2-t/2)},e.prototype.positionGrip=function(t,e,i){var r=t.transform.baseVal.getItem(0);r.setTranslate(e,i),t.transform.baseVal.replaceItem(r,0)},e.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},t.prototype.getState.call(this))},e.prototype.restoreState=function(e){t.prototype.restoreState.call(this,e);var i=e;this.x1=i.x1,this.y1=i.y1,this.x2=i.x2,this.y2=i.y2},e.prototype.scale=function(e,i){t.prototype.scale.call(this,e,i),this.x1=this.x1*e,this.y1=this.y1*i,this.x2=this.x2*e,this.y2=this.y2*i,this.adjustVisual(),this.adjustControlBox()},e}(et),dt=function(t){function e(e,i,r){var n=t.call(this,e,i,r)||this;return n.strokeColor="transparent",n.strokeWidth=0,n.strokeDasharray="",n.setStrokeColor=n.setStrokeColor.bind(n),n.setStrokeWidth=n.setStrokeWidth.bind(n),n.setStrokeDasharray=n.setStrokeDasharray.bind(n),n.strokeColor=r.defaultColor,n.strokeWidth=r.defaultStrokeWidth,n.strokeDasharray=r.defaultStrokeDasharray,n.strokePanel=new tt("Line color",r.defaultColorSet,r.defaultColor),n.strokePanel.onColorChanged=n.setStrokeColor,n.strokeWidthPanel=new ot("Line width",r.defaultStrokeWidths,r.defaultStrokeWidth),n.strokeWidthPanel.onWidthChanged=n.setStrokeWidth,n.strokeStylePanel=new lt("Line style",r.defaultStrokeDasharrays,r.defaultStrokeDasharray),n.strokeStylePanel.onStyleChanged=n.setStrokeDasharray,n}return U(e,t),e.prototype.ownsTarget=function(e){return!(!t.prototype.ownsTarget.call(this,e)&&e!==this.visual&&e!==this.selectorLine&&e!==this.visibleLine)},e.prototype.createVisual=function(){this.visual=V.createGroup(),this.selectorLine=V.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=V.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)},e.prototype.pointerDown=function(e,i){t.prototype.pointerDown.call(this,e,i),"new"===this.state&&(this.createVisual(),this.adjustVisual(),this._state="creating")},e.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()),V.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),V.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),V.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},e.prototype.setStrokeColor=function(t){this.strokeColor=t,this.adjustVisual(),this.colorChanged(t)},e.prototype.setStrokeWidth=function(t){this.strokeWidth=t,this.adjustVisual()},e.prototype.setStrokeDasharray=function(t){this.strokeDasharray=t,this.adjustVisual(),this.stateChanged()},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var i=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},t.prototype.getState.call(this));return i.typeName=e.typeName,i},e.prototype.restoreState=function(e){t.prototype.restoreState.call(this,e);var i=e;this.strokeColor=i.strokeColor,this.strokeWidth=i.strokeWidth,this.strokeDasharray=i.strokeDasharray,this.createVisual(),this.adjustVisual()},e.typeName="LineMarker",e.title="Line marker",e.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',e}(ht),ft=function(t){function e(e,i,r,n){var s=t.call(this,e,n||'<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 s.fonts=[],s.fontBoxes=[],s.fonts=i,s.currentFont=r,s.setCurrentFont=s.setCurrentFont.bind(s),s}return U(e,t),e.prototype.getUi=function(){var t=this,e=document.createElement("div");return e.style.overflow="hidden",e.style.flexGrow="2",this.fonts.forEach((function(i){var r=document.createElement("div");r.style.display="inline-block",r.style.alignItems="center",r.style.justifyContent="space-between",r.style.padding="5px",r.style.borderWidth="2px",r.style.borderStyle="solid",r.style.overflow="hidden",r.style.maxWidth=100/t.fonts.length-5+"%",r.style.borderColor=i===t.currentFont?t.uiStyleSettings.toolboxAccentColor:"transparent",r.addEventListener("click",(function(){t.setCurrentFont(i,r)})),e.appendChild(r);var n=document.createElement("div");n.style.display="flex",n.style.minHeight="20px",n.style.flexGrow="2",n.style.fontFamily=i,n.style.overflow="hidden";var s=document.createElement("div");s.style.whiteSpace="nowrap",s.style.overflow="hidden",s.style.textOverflow="ellipsis",s.innerHTML="The quick brown fox jumps over the lazy dog",n.appendChild(s),r.appendChild(n),t.fontBoxes.push(r)})),e},e.prototype.setCurrentFont=function(t,e){var i=this;this.currentFont=t,this.fontBoxes.forEach((function(t){t.style.borderColor=t===e?i.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onFontChanged&&this.onFontChanged(this.currentFont)},e}(Z),pt=function(t){function e(e,i,r){var n=t.call(this,e,i,r)||this;return n.color="transparent",n.padding=5,n.DEFAULT_TEXT="your text here",n.text=n.DEFAULT_TEXT,n.isMoved=!1,n.color=r.defaultColor,n.fontFamily=r.defaultFontFamily,n.defaultSize={x:100,y:30},n.setColor=n.setColor.bind(n),n.setFont=n.setFont.bind(n),n.renderText=n.renderText.bind(n),n.sizeText=n.sizeText.bind(n),n.textEditDivClicked=n.textEditDivClicked.bind(n),n.showTextEditor=n.showTextEditor.bind(n),n.setSize=n.setSize.bind(n),n.positionTextEditor=n.positionTextEditor.bind(n),n.colorPanel=new tt("Color",r.defaultColorSet,r.defaultColor),n.colorPanel.onColorChanged=n.setColor,n.fontFamilyPanel=new ft("Font",r.defaultFontFamilies,r.defaultFontFamily),n.fontFamilyPanel.onFontChanged=n.setFont,n}return U(e,t),e.prototype.ownsTarget=function(e){if(t.prototype.ownsTarget.call(this,e)||e===this.visual||e===this.textElement||e===this.bgRectangle)return!0;var i=!1;return this.textElement.childNodes.forEach((function(t){t===e&&(i=!0)})),i},e.prototype.createVisual=function(){this.visual=V.createGroup(),this.bgRectangle=V.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=V.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(V.createTransform()),this.textElement.transform.baseVal.appendItem(V.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},e.prototype.pointerDown=function(e,i){t.prototype.pointerDown.call(this,e,i),this.isMoved=!1,this.pointerDownPoint=e,this.pointerDownTimestamp=Date.now(),"new"===this.state&&(this.createVisual(),this.moveVisual(e),this._state="creating")},e.prototype.renderText=function(){var t=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(e){t.textElement.appendChild(V.createTSpan(""===e.trim()?" ":e.trim(),[["x","0"],["dy","1.2em"]]))})),setTimeout(this.sizeText,10)}},e.prototype.getTextScale=function(){var t=this.textElement.getBBox(),e=1;if(t.width>0&&t.height>0){var i=(1*this.width-this.width*this.padding*2/100)/t.width,r=(1*this.height-this.height*this.padding*2/100)/t.height;e=Math.min(i,r)}return e},e.prototype.getTextPosition=function(t){var e=this.textElement.getBBox(),i=0,r=0;return e.width>0&&e.height>0&&(i=(this.width-e.width*t)/2,r=this.height/2-e.height*t/2),{x:i,y:r}},e.prototype.sizeText=function(){var t=this.textElement.getBBox(),e=this.getTextScale(),i=this.getTextPosition(e);i.y-=t.y*e,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+i.x+"px, "+i.y+"px) scale("+e+", "+e+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(i.x,i.y),this.textElement.transform.baseVal.getItem(1).setScale(e,e))},e.prototype.manipulate=function(e){t.prototype.manipulate.call(this,e),void 0!==this.pointerDownPoint&&(this.isMoved=Math.abs(e.x-this.pointerDownPoint.x)>5||Math.abs(e.y-this.pointerDownPoint.y)>5)},e.prototype.resize=function(e){t.prototype.resize.call(this,e),this.isMoved=!0,this.setSize(),this.sizeText()},e.prototype.setSize=function(){t.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(V.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),V.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},e.prototype.pointerUp=function(e){var i=this.state;"creating"===i&&(this._suppressMarkerCreateEvent=!0),t.prototype.pointerUp.call(this,e),this.setSize(),("creating"===i||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},e.prototype.showTextEditor=function(){var t=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(t){t.stopPropagation()})),this.textEditor.addEventListener("input",(function(){for(var e=Number.parseFloat(t.textEditor.style.fontSize);t.textEditor.clientWidth>=Number.parseInt(t.textEditor.style.maxWidth)&&e>.9;)e-=.1,t.textEditor.style.fontSize=Math.max(e,.9)+"em"})),this.textEditor.addEventListener("keyup",(function(t){t.cancelBubble=!0})),this.textEditor.addEventListener("paste",(function(t){if(t.clipboardData){var e=t.clipboardData.getData("text"),i=window.getSelection();if(!i.rangeCount)return!1;i.deleteFromDocument(),i.getRangeAt(0).insertNode(document.createTextNode(e)),t.preventDefault()}})),this.textEditDiv.addEventListener("pointerup",(function(){t.textEditDivClicked(t.textEditor.innerText)})),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},e.prototype.positionTextEditor=function(){if("edit"===this.state)if(void 0===this.textEditor)this.showTextEditor();else{this.textElement.style.display="";var t=this.getTextScale(),e=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),i=this.textElement.getBBox(),r={x:i.width*t,y:i.height*t};e.x-=r.x/2,e.y-=r.y/2,this.textEditor.style.top=e.y+"px",this.textEditor.style.left=e.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-e.x+"px",this.textEditor.style.fontSize=Math.max(16*t,12)+"px",this.textElement.style.display="none"}},e.prototype.textEditDivClicked=function(t){this.text=t.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},e.prototype.select=function(){t.prototype.select.call(this),"edit"===this.state&&this.textEditDivClicked(this.textEditor.innerText)},e.prototype.deselect=function(){"edit"===this.state&&this.textEditDivClicked(this.textEditor.innerText),t.prototype.deselect.call(this)},e.prototype.dblClick=function(e,i){t.prototype.dblClick.call(this,e,i),this.showTextEditor()},e.prototype.setColor=function(t){this.textElement&&V.setAttributes(this.textElement,[["fill",t]]),this.color=t,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(t)},e.prototype.setFont=function(t){this.textElement&&V.setAttributes(this.textElement,[["font-family",t]]),this.fontFamily=t,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},e.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},e.prototype.showVisual=function(){"edit"===this.state&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var i=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},t.prototype.getState.call(this));return i.typeName=e.typeName,i},e.prototype.restoreState=function(e){var i=e;this.color=i.color,this.fontFamily=i.fontFamily,this.padding=i.padding,this.text=i.text,this.createVisual(),t.prototype.restoreState.call(this,e),this.setSize()},e.prototype.scale=function(e,i){t.prototype.scale.call(this,e,i),this.setSize(),this.sizeText(),this.positionTextEditor()},e.typeName="TextMarker",e.title="Text marker",e.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>',e}(st),gt=function(t){function e(e,i,r){var n=t.call(this,e,i,r)||this;return n.color="transparent",n.lineWidth=3,n.drawing=!1,n.pixelRatio=1,n.color=r.defaultColor,n.lineWidth=r.defaultStrokeWidth,n.pixelRatio=r.freehandPixelRatio,n.setColor=n.setColor.bind(n),n.addCanvas=n.addCanvas.bind(n),n.finishCreation=n.finishCreation.bind(n),n.setLineWidth=n.setLineWidth.bind(n),n.colorPanel=new tt("Color",r.defaultColorSet,r.defaultColor),n.colorPanel.onColorChanged=n.setColor,n.lineWidthPanel=new ot("Line width",r.defaultStrokeWidths,r.defaultStrokeWidth),n.lineWidthPanel.onWidthChanged=n.setLineWidth,n}return U(e,t),e.prototype.ownsTarget=function(e){return!(!t.prototype.ownsTarget.call(this,e)&&e!==this.visual&&e!==this.drawingImage)},e.prototype.createVisual=function(){this.visual=V.createGroup(),this.drawingImage=V.createImage(),this.visual.appendChild(this.drawingImage);var t=V.createTransform();this.visual.transform.baseVal.appendItem(t),this.addMarkerVisualToContainer(this.visual)},e.prototype.pointerDown=function(e,i){"new"===this.state&&(this.addCanvas(),this.createVisual(),this._state="creating"),"creating"===this.state?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(e.x,e.y),this.drawing=!0):t.prototype.pointerDown.call(this,e,i)},e.prototype.manipulate=function(e){"creating"===this.state?this.drawing&&(this.canvasContext.lineTo(e.x,e.y),this.canvasContext.stroke()):t.prototype.manipulate.call(this,e)},e.prototype.resize=function(e){t.prototype.resize.call(this,e),V.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),V.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},e.prototype.pointerUp=function(e){"creating"===this._state?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):t.prototype.pointerUp.call(this,e)},e.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)},e.prototype.select=function(){"creating"===this.state&&this.finishCreation(),t.prototype.select.call(this)},e.prototype.deselect=function(){"creating"===this.state&&this.finishCreation(),t.prototype.deselect.call(this)},e.prototype.finishCreation=function(){for(var t=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),e=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],i=e[0],r=e[1],n=e[2],s=e[3],a=!1,o=0;o<this.canvasElement.height;o++)for(var l=0;l<this.canvasElement.width;l++)t.data[o*this.canvasElement.width*4+4*l+3]>0&&(a=!0,o<r&&(r=o),l<i&&(i=l),o>s&&(s=o),l>n&&(n=l));if(a){this.left=i/this.pixelRatio,this.top=r/this.pixelRatio,this.width=(n-i)/this.pixelRatio,this.height=(s-r)/this.pixelRatio;var c=document.createElement("canvas");c.width=n-i,c.height=s-r,c.getContext("2d").putImageData(this.canvasContext.getImageData(i,r,n-i,s-r),0,0),this.drawingImgUrl=c.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},e.prototype.setDrawingImage=function(){V.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),V.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},e.prototype.setColor=function(t){this.color=t,this.colorChanged(t)},e.prototype.setLineWidth=function(t){this.lineWidth=t},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return"new"===this.state||"creating"===this.state?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var i=Object.assign({drawingImgUrl:this.drawingImgUrl},t.prototype.getState.call(this));return i.typeName=e.typeName,i},e.prototype.restoreState=function(e){this.createVisual(),t.prototype.restoreState.call(this,e),this.drawingImgUrl=e.drawingImgUrl,this.setDrawingImage()},e.prototype.scale=function(e,i){t.prototype.scale.call(this,e,i),this.setDrawingImage()},e.typeName="FreehandMarker",e.title="Freehand marker",e.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>',e}(st),vt=function(t){function e(e,i,r){var n=t.call(this,e,r||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return n.typeBoxes=[],n.currentType=i,n.setCurrentType=n.setCurrentType.bind(n),n}return U(e,t),e.prototype.getUi=function(){var t=this,e=document.createElement("div");e.style.display="flex",e.style.overflow="hidden",e.style.flexGrow="2";for(var i=function(i){var n="both";switch(i){case 0:n="both";break;case 1:n="start";break;case 2:n="end";break;case 3:n="none"}var s=document.createElement("div");if(s.style.display="flex",s.style.flexGrow="2",s.style.alignItems="center",s.style.justifyContent="space-between",s.style.padding="5px",s.style.borderWidth="2px",s.style.borderStyle="solid",s.style.borderColor=n===r.currentType?r.uiStyleSettings.toolboxAccentColor:"transparent",s.addEventListener("click",(function(){t.setCurrentType(n,s)})),e.appendChild(s),"both"===n||"start"===n){var a=document.createElement("div");a.style.display="flex",a.style.alignItems="center",a.style.minHeight="20px",a.innerHTML='<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">\n <polygon points="0,5 10,0 10,10" fill="'+(void 0!==r.uiStyleSettings?r.uiStyleSettings.toolboxColor:"#eeeeee")+'" />\n </svg>',a.style.marginLeft="5px",s.appendChild(a)}var o=document.createElement("div");o.style.display="flex",o.style.alignItems="center",o.style.minHeight="20px",o.style.flexGrow="2";var l=document.createElement("hr");if(l.style.minWidth="20px",l.style.border="0px",l.style.borderTop="3px solid "+(void 0!==r.uiStyleSettings?r.uiStyleSettings.toolboxColor:"#eeeeee"),l.style.flexGrow="2",o.appendChild(l),s.appendChild(o),"both"===n||"end"===n){var c=document.createElement("div");c.style.display="flex",c.style.alignItems="center",c.style.minHeight="20px",c.innerHTML='<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">\n <polygon points="0,0 10,5 0,10" fill="'+(void 0!==r.uiStyleSettings?r.uiStyleSettings.toolboxColor:"#eeeeee")+'" />\n </svg>',c.style.marginRight="5px",s.appendChild(c)}r.typeBoxes.push(s)},r=this,n=0;n<4;n++)i(n);return e},e.prototype.setCurrentType=function(t,e){var i=this;this.currentType=t,this.typeBoxes.forEach((function(t){t.style.borderColor=t===e?void 0!==i.uiStyleSettings?i.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"})),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},e}(Z),mt=function(t){function e(e,i,r){var n=t.call(this,e,i,r)||this;return n.arrowType="end",n.arrowBaseHeight=10,n.arrowBaseWidth=10,n.getArrowPoints=n.getArrowPoints.bind(n),n.setArrowType=n.setArrowType.bind(n),n.arrowTypePanel=new vt("Arrow type","end"),n.arrowTypePanel.onArrowTypeChanged=n.setArrowType,n}return U(e,t),e.prototype.ownsTarget=function(e){return!(!t.prototype.ownsTarget.call(this,e)&&e!==this.arrow1&&e!==this.arrow2)},e.prototype.getArrowPoints=function(t,e){var i=this.arrowBaseWidth+2*this.strokeWidth,r=this.arrowBaseHeight+2*this.strokeWidth;return t-i/2+","+(e+r/2)+" "+t+","+(e-r/2)+" "+(t+i/2)+","+(e+r/2)},e.prototype.createTips=function(){this.arrow1=V.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(V.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=V.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(V.createTransform()),this.visual.appendChild(this.arrow2)},e.prototype.pointerDown=function(e,i){t.prototype.pointerDown.call(this,e,i),"creating"===this.state&&this.createTips()},e.prototype.adjustVisual=function(){if(t.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display="both"===this.arrowType||"start"===this.arrowType?"":"none",this.arrow2.style.display="both"===this.arrowType||"end"===this.arrowType?"":"none",V.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),V.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),i=this.arrow1.transform.baseVal.getItem(0);i.setRotate(e,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(i,0);var r=this.arrow2.transform.baseVal.getItem(0);r.setRotate(e+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(r,0)}},e.prototype.setArrowType=function(t){this.arrowType=t,this.adjustVisual(),this.stateChanged()},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var i=Object.assign({arrowType:this.arrowType},t.prototype.getState.call(this));return i.typeName=e.typeName,i},e.prototype.restoreState=function(e){t.prototype.restoreState.call(this,e);var i=e;this.arrowType=i.arrowType,this.createTips(),this.adjustVisual()},e.typeName="ArrowMarker",e.title="Arrow marker",e.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',e}(dt),yt=function(t){function e(e,i,r){var n=t.call(this,e,i,r)||this;return n.fillColor=r.defaultFillColor,n.strokeWidth=0,n.fillPanel=new tt("Color",r.defaultColorSet,r.defaultFillColor),n.fillPanel.onColorChanged=n.setFillColor,n}return U(e,t),Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var i=t.prototype.getState.call(this);return i.typeName=e.typeName,i},e.typeName="CoverMarker",e.title="Cover marker",e.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',e}(at),bt=function(t){function e(e,i,r,n){var s=t.call(this,e,n||'<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 s.opacities=[],s.opacityBoxes=[],s.opacities=i,s.currentOpacity=r,s.setCurrentOpacity=s.setCurrentOpacity.bind(s),s}return U(e,t),e.prototype.getUi=function(){var t=this,e=document.createElement("div");return e.style.display="flex",e.style.overflow="hidden",e.style.flexGrow="2",e.style.justifyContent="space-between",this.opacities.forEach((function(i){var r=document.createElement("div");r.style.display="flex",r.style.alignItems="center",r.style.justifyContent="center",r.style.padding="5px",r.style.borderWidth="2px",r.style.borderStyle="solid",r.style.borderColor=i===t.currentOpacity?t.uiStyleSettings.toolboxAccentColor:"transparent",r.addEventListener("click",(function(){t.setCurrentOpacity(i,r)})),e.appendChild(r);var n=document.createElement("div");n.innerText=100*i+"%",r.appendChild(n),t.opacityBoxes.push(r)})),e},e.prototype.setCurrentOpacity=function(t,e){var i=this;this.currentOpacity=t,this.opacityBoxes.forEach((function(t){t.style.borderColor=t===e?i.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},e}(Z),Et=function(t){function e(e,i,r){var n=t.call(this,e,i,r)||this;return n.setOpacity=n.setOpacity.bind(n),n.fillColor=r.defaultHighlightColor,n.strokeWidth=0,n.opacity=r.defaultHighlightOpacity,n.fillPanel=new tt("Color",r.defaultColorSet,n.fillColor),n.fillPanel.onColorChanged=n.setFillColor,n.opacityPanel=new bt("Opacity",r.defaultOpacitySteps,n.opacity),n.opacityPanel.onOpacityChanged=n.setOpacity,n}return U(e,t),e.prototype.setOpacity=function(t){this.opacity=t,this.visual&&V.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var i=t.prototype.getState.call(this);return i.typeName=e.typeName,i},e.typeName="HighlightMarker",e.title="Highlight marker",e.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>',e}(yt),St='<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>',Ct=function(t){function e(e,i,r){var n=t.call(this,e,i,r)||this;return n.bgColor="transparent",n.tipPosition={x:0,y:0},n.tipBase1Position={x:0,y:0},n.tipBase2Position={x:0,y:0},n.tipMoving=!1,n.color=r.defaultStrokeColor,n.bgColor=r.defaultFillColor,n.fontFamily=r.defaultFontFamily,n.defaultSize={x:100,y:30},n.setBgColor=n.setBgColor.bind(n),n.getTipPoints=n.getTipPoints.bind(n),n.positionTip=n.positionTip.bind(n),n.setTipPoints=n.setTipPoints.bind(n),n.colorPanel=new tt("Text color",r.defaultColorSet,n.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>'),n.colorPanel.onColorChanged=n.setColor,n.bgColorPanel=new tt("Fill color",r.defaultColorSet,n.bgColor,St),n.bgColorPanel.onColorChanged=n.setBgColor,n.fontFamilyPanel=new ft("Font",r.defaultFontFamilies,r.defaultFontFamily),n.fontFamilyPanel.onFontChanged=n.setFont,n.tipGrip=new rt,n.tipGrip.visual.transform.baseVal.appendItem(V.createTransform()),n.controlBox.appendChild(n.tipGrip.visual),n}return U(e,t),e.prototype.ownsTarget=function(e){return t.prototype.ownsTarget.call(this,e)||this.tipGrip.ownsTarget(e)||this.tip===e},e.prototype.createTip=function(){V.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=V.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},e.prototype.pointerDown=function(e,i){"new"===this.state&&t.prototype.pointerDown.call(this,e,i),"creating"===this.state?this.createTip():this.tipGrip.ownsTarget(i)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):t.prototype.pointerDown.call(this,e,i)},e.prototype.pointerUp=function(e){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,t.prototype.pointerUp.call(this,e);else{var i="creating"===this.state;t.prototype.pointerUp.call(this,e),this.setTipPoints(i),this.positionTip()}},e.prototype.manipulate=function(e){if(this.tipMoving){var i=this.unrotatePoint(e);this.tipPosition={x:i.x-this.manipulationStartLeft,y:i.y-this.manipulationStartTop},this.positionTip()}else t.prototype.manipulate.call(this,e)},e.prototype.setBgColor=function(t){this.bgRectangle&&this.tip&&(V.setAttributes(this.bgRectangle,[["fill",t]]),V.setAttributes(this.tip,[["fill",t]])),this.bgColor=t,this.fillColorChanged(t)},e.prototype.getTipPoints=function(){return this.setTipPoints("creating"===this.state),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},e.prototype.setTipPoints=function(t){void 0===t&&(t=!1);var e=Math.min(this.height/2,15),i=this.height/5;t&&(this.tipPosition={x:e+i/2,y:this.height+20});var r=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?r<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(i=this.width/5,e=Math.min(this.width/2,15),this.tipBase1Position={x:e,y:0},this.tipBase2Position={x:e+i,y:0}):(this.tipBase1Position={x:0,y:e},this.tipBase2Position={x:0,y:e+i}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?r<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(i=this.width/5,e=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-e-i,y:0},this.tipBase2Position={x:this.width-e,y:0}):(this.tipBase1Position={x:this.width,y:e},this.tipBase2Position={x:this.width,y:e+i}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?r<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(i=this.width/5,e=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-e-i,y:this.height},this.tipBase2Position={x:this.width-e,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-e-i},this.tipBase2Position={x:this.width,y:this.height-e}):r<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(i=this.width/5,e=Math.min(this.width/2,15),this.tipBase1Position={x:e,y:this.height},this.tipBase2Position={x:e+i,y:this.height}):(this.tipBase1Position={x:0,y:this.height-e},this.tipBase2Position={x:0,y:this.height-e-i})},e.prototype.resize=function(e){t.prototype.resize.call(this,e),this.positionTip()},e.prototype.positionTip=function(){V.setAttributes(this.tip,[["points",this.getTipPoints()]]);var t=this.tipGrip.visual.transform.baseVal.getItem(0);t.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(t,0)},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),e.prototype.select=function(){this.positionTip(),t.prototype.select.call(this)},e.prototype.getState=function(){var i=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},t.prototype.getState.call(this));return i.typeName=e.typeName,i},e.prototype.restoreState=function(e){var i=e;this.bgColor=i.bgColor,this.tipPosition=i.tipPosition,t.prototype.restoreState.call(this,e),this.createTip(),this.setTipPoints()},e.prototype.scale=function(e,i){t.prototype.scale.call(this,e,i),this.tipPosition={x:this.tipPosition.x*e,y:this.tipPosition.y*i},this.positionTip()},e.typeName="CalloutMarker",e.title="Callout marker",e.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>',e}(pt),kt=function(t){function e(e,i,r){var n=t.call(this,e,i,r)||this;return n.fillColor="transparent",n.strokeColor="transparent",n.strokeWidth=0,n.strokeDasharray="",n.opacity=1,n.strokeColor=r.defaultColor,n.strokeWidth=r.defaultStrokeWidth,n.strokeDasharray=r.defaultStrokeDasharray,n.fillColor=r.defaultFillColor,n.setStrokeColor=n.setStrokeColor.bind(n),n.setFillColor=n.setFillColor.bind(n),n.setStrokeWidth=n.setStrokeWidth.bind(n),n.setStrokeDasharray=n.setStrokeDasharray.bind(n),n.setOpacity=n.setOpacity.bind(n),n.createVisual=n.createVisual.bind(n),n.strokePanel=new tt("Line color",z(r.defaultColorSet,["transparent"]),r.defaultColor),n.strokePanel.onColorChanged=n.setStrokeColor,n.fillPanel=new tt("Fill color",z(r.defaultColorSet,["transparent"]),n.fillColor,St),n.fillPanel.onColorChanged=n.setFillColor,n.strokeWidthPanel=new ot("Line width",r.defaultStrokeWidths,r.defaultStrokeWidth),n.strokeWidthPanel.onWidthChanged=n.setStrokeWidth,n.strokeStylePanel=new lt("Line style",r.defaultStrokeDasharrays,r.defaultStrokeDasharray),n.strokeStylePanel.onStyleChanged=n.setStrokeDasharray,n.opacityPanel=new bt("Opacity",r.defaultOpacitySteps,n.opacity),n.opacityPanel.onOpacityChanged=n.setOpacity,n}return U(e,t),e.prototype.ownsTarget=function(e){return!(!t.prototype.ownsTarget.call(this,e)&&e!==this.visual)},e.prototype.createVisual=function(){this.visual=V.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)},e.prototype.pointerDown=function(e,i){t.prototype.pointerDown.call(this,e,i),"new"===this.state&&(this.createVisual(),this.moveVisual(e),this._state="creating")},e.prototype.manipulate=function(e){t.prototype.manipulate.call(this,e)},e.prototype.resize=function(e){t.prototype.resize.call(this,e),this.setSize()},e.prototype.setSize=function(){t.prototype.setSize.call(this),V.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},e.prototype.pointerUp=function(e){t.prototype.pointerUp.call(this,e),this.setSize()},e.prototype.setStrokeColor=function(t){this.strokeColor=t,this.visual&&V.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(t),this.stateChanged()},e.prototype.setFillColor=function(t){this.fillColor=t,this.visual&&V.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(t),this.stateChanged()},e.prototype.setStrokeWidth=function(t){this.strokeWidth=t,this.visual&&V.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},e.prototype.setStrokeDasharray=function(t){this.strokeDasharray=t,this.visual&&V.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},e.prototype.setOpacity=function(t){this.opacity=t,this.visual&&V.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var i=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},t.prototype.getState.call(this));return i.typeName=e.typeName,i},e.prototype.restoreState=function(e){var i=e;this.fillColor=i.fillColor,this.strokeColor=i.strokeColor,this.strokeWidth=i.strokeWidth,this.strokeDasharray=i.strokeDasharray,this.opacity=i.opacity,this.createVisual(),t.prototype.restoreState.call(this,e),this.setSize()},e.prototype.scale=function(e,i){t.prototype.scale.call(this,e,i),this.setSize()},e.typeName="EllipseMarker",e.title="Ellipse marker",e.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>',e}(st),wt=function(t){function e(e,i,r){return t.call(this,e,i,r)||this}return U(e,t),Object.defineProperty(e.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),e.prototype.ownsTarget=function(e){return!(!t.prototype.ownsTarget.call(this,e)&&e!==this.tip1&&e!==this.tip2)},e.prototype.createTips=function(){this.tip1=V.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(V.createTransform()),this.visual.appendChild(this.tip1),this.tip2=V.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(V.createTransform()),this.visual.appendChild(this.tip2)},e.prototype.pointerDown=function(e,i){t.prototype.pointerDown.call(this,e,i),"creating"===this.state&&this.createTips()},e.prototype.adjustVisual=function(){if(t.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(V.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()]]),V.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),i=this.tip1.transform.baseVal.getItem(0);i.setRotate(e,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(i,0);var r=this.tip2.transform.baseVal.getItem(0);r.setRotate(e+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(r,0)}},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var i=t.prototype.getState.call(this);return i.typeName=e.typeName,i},e.prototype.restoreState=function(e){t.prototype.restoreState.call(this,e),this.createTips(),this.adjustVisual()},e.typeName="MeasurementMarker",e.title="Measurement marker",e.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>',e}(dt),xt=function(t){function e(e,i,r){var n=t.call(this,e,i,r)||this;return n.strokePanel.colors=r.defaultColorSet,n.fillColor="transparent",n}return U(e,t),Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var i=t.prototype.getState.call(this);return i.typeName=e.typeName,i},e.typeName="EllipseFrameMarker",e.title="Ellipse frame marker",e.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>',e}(kt),Tt=function(){function t(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(t.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),t.prototype.addUndoStep=function(t){0!==this.undoStack.length&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(t)||(this.undoStack.push(t),JSON.stringify(this.lastRedoStep)!==JSON.stringify(t)&&this.redoStack.splice(0,this.redoStack.length))},t.prototype.replaceLastUndoStep=function(t){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=t)},t.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},t.prototype.undo=function(){if(this.undoStack.length>1){var t=this.undoStack.pop();return void 0!==t&&this.redoStack.push(t),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},t.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},t}(),Ot=function(t){function e(e,i,r){var n=t.call(this,e,i,r)||this;return n.strokeColor="transparent",n.strokeWidth=0,n.strokeDasharray="",n.curveX=0,n.curveY=0,n.manipulationStartCurveX=0,n.manipulationStartCurveY=0,n.setStrokeColor=n.setStrokeColor.bind(n),n.setStrokeWidth=n.setStrokeWidth.bind(n),n.setStrokeDasharray=n.setStrokeDasharray.bind(n),n.positionGrips=n.positionGrips.bind(n),n.addControlGrips=n.addControlGrips.bind(n),n.adjustVisual=n.adjustVisual.bind(n),n.setupControlBox=n.setupControlBox.bind(n),n.resize=n.resize.bind(n),n.strokeColor=r.defaultColor,n.strokeWidth=r.defaultStrokeWidth,n.strokeDasharray=r.defaultStrokeDasharray,n.strokePanel=new tt("Line color",r.defaultColorSet,r.defaultColor),n.strokePanel.onColorChanged=n.setStrokeColor,n.strokeWidthPanel=new ot("Line width",r.defaultStrokeWidths,r.defaultStrokeWidth),n.strokeWidthPanel.onWidthChanged=n.setStrokeWidth,n.strokeStylePanel=new lt("Line style",r.defaultStrokeDasharrays,r.defaultStrokeDasharray),n.strokeStylePanel.onStyleChanged=n.setStrokeDasharray,n}return U(e,t),e.prototype.ownsTarget=function(e){return!(!t.prototype.ownsTarget.call(this,e)&&e!==this.visual&&e!==this.selectorCurve&&e!==this.visibleCurve&&!this.curveGrip.ownsTarget(e))},e.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},e.prototype.createVisual=function(){this.visual=V.createGroup(),this.selectorCurve=V.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=V.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)},e.prototype.pointerDown=function(e,i){t.prototype.pointerDown.call(this,e,i),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,"new"===this.state&&(this.curveX=e.x,this.curveY=e.y),"new"===this.state?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(i)&&(this.activeGrip=this.curveGrip,this._state="resize")},e.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),V.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),V.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),V.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},e.prototype.setupControlBox=function(){t.prototype.setupControlBox.call(this),this.curveControlLine1=V.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=V.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)},e.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,t.prototype.addControlGrips.call(this)},e.prototype.positionGrips=function(){t.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()))},e.prototype.manipulate=function(e){"move"===this.state&&(this.curveX=this.manipulationStartCurveX+e.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+e.y-this.manipulationStartY),t.prototype.manipulate.call(this,e)},e.prototype.resize=function(e){this.activeGrip===this.curveGrip&&(this.curveX=e.x,this.curveY=e.y),t.prototype.resize.call(this,e),"creating"===this.state&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},e.prototype.setStrokeColor=function(t){this.strokeColor=t,this.adjustVisual(),this.colorChanged(t)},e.prototype.setStrokeWidth=function(t){this.strokeWidth=t,this.adjustVisual()},e.prototype.setStrokeDasharray=function(t){this.strokeDasharray=t,this.adjustVisual()},e.prototype.scale=function(e,i){this.curveX=this.curveX*e,this.curveY=this.curveY*i,t.prototype.scale.call(this,e,i)},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var i=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},t.prototype.getState.call(this));return i.typeName=e.typeName,i},e.prototype.restoreState=function(e){t.prototype.restoreState.call(this,e);var i=e;this.strokeColor=i.strokeColor,this.strokeWidth=i.strokeWidth,this.strokeDasharray=i.strokeDasharray,this.curveX=i.curveX,this.curveY=i.curveY,this.createVisual(),this.adjustVisual()},e.typeName="CurveMarker",e.title="Curve marker",e.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>',e}(ht),At=function(){function t(t,e){void 0===e&&(e=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=t,this.cancelable=e}return Object.defineProperty(t.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),t.prototype.preventDefault=function(){this._defaultPrevented=!0},t}(),Lt=function(t){function e(e,i,r){var n=t.call(this,e,!1)||this;return n.dataUrl=i,n.state=r,n}return U(e,t),e}(At),Rt=function(t){function e(e,i,r){void 0===r&&(r=!1);var n=t.call(this,e,r)||this;return n.marker=i,n}return U(e,t),e}(At),_t=function(){function t(){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 t.prototype.addEventListener=function(t,e){this[t].push(e)},t.prototype.removeEventListener=function(t,e){var i=this[t].indexOf(e);i>-1&&this[t].splice(i,1)},t}(),Dt=function(){function t(e){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new ut,this._isOpen=!1,this.undoRedoManager=new Tt,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 _t,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=t.instanceCounter++,this.styles=new X(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=e,this.targetRoot=document.body,this.width=e.clientWidth,this.height=e.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(t.prototype,"ALL_MARKER_TYPES",{get:function(){return[ct,gt,mt,pt,xt,kt,Et,Ct,wt,yt,dt,Ot]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[ct,gt,mt,pt,kt,Et,Ct]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"BASIC_MARKER_TYPES",{get:function(){return[ct,gt,mt,pt,Et]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(t){var e=this;this._availableMarkerTypes.splice(0),t.forEach((function(t){if("string"==typeof t){var i=e.ALL_MARKER_TYPES.find((function(e){return e.typeName===t}));void 0!==i&&e._availableMarkerTypes.push(i)}else e._availableMarkerTypes.push(t)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(t){this._zoomLevel=t,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(t.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),t.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),"popup"===this.settings.displayMode&&this.onPopupTargetResize(),K.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},t.prototype.show=function(){var t=this;void 0===this.styles.styleSheetRoot&&void 0!==Y.styleSheetRoot&&(this.styles.styleSheetRoot=Y.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach((function(e){return e(new At(t))}))},t.prototype.render=function(){return G(this,void 0,void 0,(function(){var t;return H(this,(function(e){switch(e.label){case 0:return this.setCurrentMarker(),(t=new W).naturalSize=this.renderAtNaturalSize,t.imageType=this.renderImageType,t.imageQuality=this.renderImageQuality,t.markersOnly=this.renderMarkersOnly,t.width=this.renderWidth,t.height=this.renderHeight,[4,t.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return e.sent(),[4,t.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,e.sent()]}}))}))},t.prototype.close=function(t){var e=this;if(void 0===t&&(t=!1),this.isOpen){var i=!1;t||this.eventListeners.beforeclose.forEach((function(t){var r=new At(e,!0);t(r),r.defaultPrevented&&(i=!0)})),i||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),"popup"===this.settings.displayMode&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach((function(t){return t(new At(e))})),this.detachEvents(),this._isOpen=!1)}},t.prototype.addMarkersToToolbar=function(){for(var t,e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];(t=this._availableMarkerTypes).push.apply(t,e)},t.prototype.addRenderEventListener=function(t){this.addEventListener("render",(function(e){t(e.dataUrl,e.state)}))},t.prototype.removeRenderEventListener=function(t){},t.prototype.addCloseEventListener=function(t){this.addEventListener("close",(function(){t()}))},t.prototype.removeCloseEventListener=function(t){},t.prototype.setupResizeObserver=function(){var t=this;"inline"===this.settings.displayMode?window.ResizeObserver&&(this.targetObserver=new ResizeObserver((function(){t.resize(t.target.clientWidth,t.target.clientHeight)})),this.targetObserver.observe(this.target)):"popup"===this.settings.displayMode&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver((function(){return t.onPopupTargetResize()})),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},t.prototype.onPopupTargetResize=function(){var t=1*this.target.clientWidth/this.target.clientHeight,e=this.editorCanvas.clientWidth/t>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*t:this.editorCanvas.clientWidth,i=e<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/t;this.resize(e,i)},t.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},t.prototype.resize=function(t,e){this._isResizing=!0;var i=t/this.imageWidth,r=e/this.imageHeight;this.imageWidth=Math.round(t),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","popup"!==this.settings.displayMode?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),void 0!==this.toolbar&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(i,r),this._isResizing=!1},t.prototype.scaleMarkers=function(t,e){var i,r=this;this._currentMarker&&this._currentMarker instanceof pt?this._currentMarker.scale(t,e):(i=this._currentMarker,this.setCurrentMarker()),this.markers.forEach((function(i){i!==r._currentMarker&&i.scale(t,e)})),void 0!==i&&this.setCurrentMarker(i)},t.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"},t.prototype.setTopLeft=function(){var t=this.editingTarget.getBoundingClientRect(),e=this.editorCanvas.getBoundingClientRect();this.left=t.left-e.left,this.top=t.top-e.top},t.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)},t.prototype.addDefs=function(){for(var t,e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];this.defs=V.createDefs(),this.addDefsToImage(),(t=this.defs).append.apply(t,e)},t.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},t.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)},t.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},t.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},t.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)},t.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},t.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)},t.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 t=document.createElement("a");t.href="https://markerjs.com/",t.target="_blank",t.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>',t.title="Powered by marker.js",t.style.display="grid",t.style.alignItems="center",t.style.justifyItems="center",t.style.padding="3px",t.style.width="20px",t.style.height="20px",this.logoUI.appendChild(t),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},t.prototype.positionLogo=function(){this.logoUI&&("right"!==this.uiStyleSettings.logoPosition?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")},t.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"},t.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},t.prototype.showUI=function(){switch("popup"===this.settings.displayMode&&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 t=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=t+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=void 0!==this.uiStyleSettings.zIndex?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=void 0!==this.uiStyleSettings.zIndex?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="popup"===this.settings.displayMode?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new J(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","popup"===this.settings.displayMode&&(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","popup"===this.settings.displayMode&&(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 Q(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},t.prototype.closeUI=function(){"popup"===this.settings.displayMode&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},t.prototype.removeMarker=function(t){this.markerImage.removeChild(t.container),this.markers.indexOf(t)>-1&&this.markers.splice(this.markers.indexOf(t),1),t.dispose()},t.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),void 0!==this._currentMarker&&("new"!==this._currentMarker.state?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},t.prototype.toolbarButtonClicked=function(t,e){if("marker"===t&&void 0!==e)this.createNewMarker(e);else if("action"===t)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":void 0===this.notesArea?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},t.prototype.deleteSelectedMarker=function(){var t=this;if(void 0!==this._currentMarker){var e=!1;if(this.eventListeners.markerbeforedelete.forEach((function(i){var r=new Rt(t,t._currentMarker,!0);i(r),r.defaultPrevented&&(e=!0)})),!e){var i=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(e){return e(new Rt(t,i))}))}}},t.prototype.clear=function(){var t=this,e=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach((function(i){var r=new Rt(t,void 0,!0);i(r),r.defaultPrevented&&(e=!0)})),!e)){this.setCurrentMarker();for(var i=function(e){var i=r.markers[e];r.setCurrentMarker(r.markers[e]),r._currentMarker.dispose(),r.markerImage.removeChild(r._currentMarker.container),r.markers.splice(r.markers.indexOf(r._currentMarker),1),r.eventListeners.markerdelete.forEach((function(e){return e(new Rt(t,i))}))},r=this,n=this.markers.length-1;n>=0;n--)i(n);this.addUndoStep()}},Object.defineProperty(t.prototype,"isNotesAreaOpen",{get:function(){return void 0!==this.notesArea},enumerable:!1,configurable:!0}),t.prototype.showNotesEditor=function(){var t;void 0!==this._currentMarker&&(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=null!==(t=this._currentMarker.notes)&&void 0!==t?t:"",this.overlayContainer.appendChild(this.notesArea))},t.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(void 0!==this._currentMarker&&(this._currentMarker.notes=""!==this.notesArea.value.trim()?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},t.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},t.prototype.addUndoStep=function(){var t=this;if(void 0===this._currentMarker||"edit"!==this._currentMarker.state){var e=this.getState(),i=this.undoRedoManager.getLastUndoStep();if(!i||i.width===e.width&&i.height===e.height){var r=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(e),r<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach((function(e){return e(new At(t))}))}else this.undoRedoManager.replaceLastUndoStep(e),this.eventListeners.statechange.forEach((function(e){return e(new At(t))}))}},t.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},t.prototype.undoStep=function(){var t=this,e=this.undoRedoManager.undo();void 0!==e&&(this.restoreState(e),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach((function(e){return e(new At(t))})))},t.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},t.prototype.redoStep=function(){var t=this,e=this.undoRedoManager.redo();void 0!==e&&(this.restoreState(e),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach((function(e){return e(new At(t))})))},t.prototype.stepZoom=function(){var t=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=t<this.zoomSteps.length-1?this.zoomSteps[t+1]:this.zoomSteps[0]},t.prototype.panTo=function(t){this.contentDiv.scrollBy({left:this.prevPanPoint.x-t.x,top:this.prevPanPoint.y-t.y}),this.prevPanPoint=t},t.prototype.startRenderAndClose=function(){return G(this,void 0,void 0,(function(){var t,e,i=this;return H(this,(function(r){switch(r.label){case 0:return[4,this.render()];case 1:return t=r.sent(),e=this.getState(),this.eventListeners.render.forEach((function(r){return r(new Lt(i,t,e))})),this.close(!0),[2]}}))}))},t.prototype.getState=function(t){!0===t&&this.setCurrentMarker();var e={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach((function(t){return e.markers.push(t.getState())})),e},t.prototype.restoreState=function(t){var e=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);t.markers.forEach((function(t){var i=e._availableMarkerTypes.find((function(e){return e.typeName===t.typeName}));if(void 0!==i){var r=e.addNewMarker(i);r.restoreState(t),e.markers.push(r)}})),t.width&&t.height&&(t.width!==this.imageWidth||t.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/t.width,this.imageHeight/t.height),this.eventListeners.restorestate.forEach((function(t){return t(new At(e))}))},t.prototype.addNewMarker=function(t){var e=V.createGroup();return this.markerImage.appendChild(e),new t(e,this.overlayContainer,this.settings)},t.prototype.createNewMarker=function(t){var e,i=this;(e="string"==typeof t?this._availableMarkerTypes.find((function(e){return e.typeName===t})):t)&&(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(t){return t(new Rt(i,i._currentMarker))})))},t.prototype.markerCreated=function(t){var e=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(t),this.setCurrentMarker(t),t instanceof gt&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(gt):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach((function(t){return t(new Rt(e,e._currentMarker))}))},t.prototype.colorChanged=function(t){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=t,this.settings.defaultStrokeColor=t)},t.prototype.fillColorChanged=function(t){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=t)},t.prototype.markerStateChanged=function(t){var e=this;this.eventListeners.markerchange.forEach((function(i){return i(new Rt(e,t))}))},t.prototype.setCurrentMarker=function(t){var e=this;this._currentMarker!==t&&void 0!==this._currentMarker&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach((function(t){return t(new Rt(e,e._currentMarker))}))),this._currentMarker=t,void 0===this._currentMarker||this._currentMarker.isSelected||("new"!==this._currentMarker.state&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach((function(t){return t(new Rt(e,e._currentMarker))})))},t.prototype.onPointerDown=function(t){if(this._isFocused||this.focus(),this.touchPoints++,1===this.touchPoints||"touch"!==t.pointerType)if(void 0===this._currentMarker||"new"!==this._currentMarker.state&&"creating"!==this._currentMarker.state){if("select"===this.mode){var e=this.markers.find((function(e){return e.ownsTarget(t.target)}));void 0!==e?(this.setCurrentMarker(e),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(t.clientX,t.clientY),t.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:t.clientX,y:t.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(t.clientX,t.clientY))},t.prototype.onDblClick=function(t){if(this._isFocused||this.focus(),"select"===this.mode){var e=this.markers.find((function(e){return e.ownsTarget(t.target)}));void 0!==e&&e!==this._currentMarker&&this.setCurrentMarker(e),void 0!==this._currentMarker?this._currentMarker.dblClick(this.clientToLocalCoordinates(t.clientX,t.clientY),t.target):this.setCurrentMarker()}},t.prototype.onPointerMove=function(t){1!==this.touchPoints&&"touch"===t.pointerType||(void 0!==this._currentMarker||this.isDragging)&&(void 0!==this._currentMarker&&"edit"===this._currentMarker.state||t.preventDefault(),void 0!==this._currentMarker?this._currentMarker.manipulate(this.clientToLocalCoordinates(t.clientX,t.clientY)):this.zoomLevel>1&&this.panTo({x:t.clientX,y:t.clientY}))},t.prototype.onPointerUp=function(t){this.touchPoints>0&&this.touchPoints--,0===this.touchPoints&&this.isDragging&&void 0!==this._currentMarker&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(t.clientX,t.clientY)),this.isDragging=!1,this.addUndoStep()},t.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},t.prototype.onKeyUp=function(t){void 0===this._currentMarker||void 0!==this.notesArea||"Delete"!==t.key&&"Backspace"!==t.key||this.deleteSelectedMarker()},t.prototype.clientToLocalCoordinates=function(t,e){var i=this.markerImage.getBoundingClientRect();return{x:(t-i.left)/this.zoomLevel,y:(e-i.top)/this.zoomLevel}},t.prototype.onWindowResize=function(){this.positionUI()},t.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var t=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=t+"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()},t.prototype.addLicenseKey=function(t){K.addKey(t)},t.prototype.addEventListener=function(t,e){this.eventListeners.addEventListener(t,e)},t.prototype.removeEventListener=function(t,e){this.eventListeners.removeEventListener(t,e)},t.prototype.renderState=function(t){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(t),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(t.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),t.prototype.focus=function(){var t=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,void 0!==this._previousCurrentMarker&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach((function(e){return e(new At(t))})))},t.prototype.blur=function(){var t=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach((function(e){return e(new At(t))})))},t.instanceCounter=0,t}(),It=function(t,e){return(It=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(t,e)};
/* **********************************
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.
***************************************************************************** */function Mt(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}It(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function Pt(t,e,i,r){return new(i||(i=Promise))((function(n,s){function a(t){try{l(r.next(t))}catch(t){s(t)}}function o(t){try{l(r.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((r=r.apply(t,e||[])).next())}))}function Nt(t,e){var i,r,n,s,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function o(s){return function(o){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,r&&(n=2&s[0]?r.return:s[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;switch(r=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((n=(n=a.trys).length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{i=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,o])}}}var jt=function(){function t(){}return t.addKey=function(e){t.key=e},Object.defineProperty(t,"isLicensed",{get:function(){return!!t.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(t.key)},enumerable:!1,configurable:!0}),t}(),Bt=function(){function t(){}return t.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},t.setAttributes=function(t,e){for(var i=0,r=e;i<r.length;i++){var n=r[i],s=n[0],a=n[1];t.setAttribute(s,a)}},t.createRect=function(e,i,r){var n=document.createElementNS("http://www.w3.org/2000/svg","rect");return n.setAttribute("width",e.toString()),n.setAttribute("height",i.toString()),r&&t.setAttributes(n,r),n},t.createLine=function(e,i,r,n,s){var a=document.createElementNS("http://www.w3.org/2000/svg","line");return a.setAttribute("x1",e.toString()),a.setAttribute("y1",i.toString()),a.setAttribute("x2",r.toString()),a.setAttribute("y2",n.toString()),s&&t.setAttributes(a,s),a},t.createPolygon=function(e,i){var r=document.createElementNS("http://www.w3.org/2000/svg","polygon");return r.setAttribute("points",e),i&&t.setAttributes(r,i),r},t.createCircle=function(e,i){var r=document.createElementNS("http://www.w3.org/2000/svg","circle");return r.setAttribute("cx",(e/2).toString()),r.setAttribute("cy",(e/2).toString()),r.setAttribute("r",e.toString()),i&&t.setAttributes(r,i),r},t.createEllipse=function(e,i,r){var n=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return n.setAttribute("cx",(e/2).toString()),n.setAttribute("cy",(i/2).toString()),n.setAttribute("rx",(e/2).toString()),n.setAttribute("ry",(i/2).toString()),r&&t.setAttributes(n,r),n},t.createGroup=function(e){var i=document.createElementNS("http://www.w3.org/2000/svg","g");return e&&t.setAttributes(i,e),i},t.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},t.createMarker=function(e,i,r,n,s,a,o){var l=document.createElementNS("http://www.w3.org/2000/svg","marker");return t.setAttributes(l,[["id",e],["orient",i],["markerWidth",r.toString()],["markerHeight",n.toString()],["refX",s.toString()],["refY",a.toString()]]),l.appendChild(o),l},t.createText=function(e){var i=document.createElementNS("http://www.w3.org/2000/svg","text");return i.setAttribute("x","0"),i.setAttribute("y","0"),e&&t.setAttributes(i,e),i},t.createTSpan=function(e,i){var r=document.createElementNS("http://www.w3.org/2000/svg","tspan");return r.textContent=e,i&&t.setAttributes(r,i),r},t.createImage=function(e){var i=document.createElementNS("http://www.w3.org/2000/svg","image");return e&&t.setAttributes(i,e),i},t.createPoint=function(t,e){var i=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return i.x=t,i.y=e,i},t.createPath=function(e,i){var r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",e),i&&t.setAttributes(r,i),r},t.createElement=function(e,i){var r=document.createElementNS("http://www.w3.org/2000/svg",e);return i&&t.setAttributes(r,i),r},t.getHollowRectanglePath=function(t,e,i,r,n,s,a,o){return"M"+t+","+e+"V"+(e+r)+"H"+(t+i)+"V"+e+"H"+n+"V"+s+"H"+(n+a)+"V"+(s+o)+"H"+n+"V"+e+"Z"},t}(),Ft=function(){function t(t){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+t+"_"}return Object.defineProperty(t.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(t.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(t.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),t.prototype.addClass=function(t){return void 0===this.styleSheet&&this.addStyleSheet(),t.name=""+this.classNamePrefix+t.localName,this.classes.push(t),this.styleSheet.sheet.insertRule("."+t.name+" {"+t.style+"}",this.styleSheet.sheet.cssRules.length),t},t.prototype.addRule=function(t){void 0===this.styleSheet&&this.addStyleSheet(),this.rules.push(t),this.styleSheet.sheet.insertRule(t.selector+" {"+t.style+"}",this.styleSheet.sheet.cssRules.length)},t.prototype.addStyleSheet=function(){var t;this.styleSheet=document.createElement("style"),(null!==(t=this.styleSheetRoot)&&void 0!==t?t:document.head).appendChild(this.styleSheet),this.addRule(new Ut("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Ut("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames","\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n ")),this.addRule(new Ut("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames","\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n ")),this.addClass(new Gt("_fade_in","\n animation-duration: 0.3s;\n animation-name: "+this.classNamePrefix+"_fade_in_animation_frames;\n ")),this.addClass(new Gt("_fade_out","\n animation-duration: 0.3s;\n animation-name: "+this.classNamePrefix+"_fade_out_animation_frames;\n "))},t.prototype.removeStyleSheet=function(){var t;this.styleSheet&&((null!==(t=this.styleSheetRoot)&&void 0!==t?t:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},t}(),Ut=function(t,e){this.selector=t,this.style=e},Gt=function(t,e){this.localName=t,this.style=e},Ht=function(){function t(){this.blocks=[],this.display=""}return t.prototype.addButtonBlock=function(t){t.className=this.blockClassName,t.buttonClassName=this.buttonClassName,t.buttonColorsClassName=this.buttonColorsClassName,t.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(t)},t.prototype.addElementBlock=function(t){void 0===t.className&&(t.className=this.blockClassName),this.blocks.push(t)},t.prototype.getUI=function(){var t=document.createElement("div");return t.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,t.style.display=this.display,this.blocks.forEach((function(e){return t.appendChild(e.getUI())})),t},t}(),zt=function(){function t(){}return t.prototype.getUI=function(){var t=document.createElement("div");if(t.className=this.className,void 0!==this.minWidth&&(t.style.minWidth=this.minWidth),void 0!==this.contentAlign)switch(this.contentAlign){case"start":t.style.justifyContent="flex-start";break;case"center":t.style.justifyContent="center";break;case"end":t.style.justifyContent="flex-end"}return t.style.whiteSpace="nowrap",t},t}(),Vt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.buttons=[],e}return Mt(e,t),e.prototype.addButton=function(t){t.className=this.buttonClassName,t.colorsClassName=this.buttonColorsClassName,t.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(t)},e.prototype.getUI=function(){var e=t.prototype.getUI.call(this);return this.buttons.forEach((function(t){return e.appendChild(t.getUI())})),e},e}(zt),Kt=function(){function t(t,e){this._isActive=!1,this._isHidden=!1,this._icon=t,this.title=e,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(t.prototype,"icon",{get:function(){return this._icon},set:function(t){this._icon=t,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isActive",{get:function(){return this._isActive},set:function(t){this._isActive=t,this.adjustClassName()},enumerable:!1,configurable:!0}),t.prototype.getUI=function(){var t=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 t.onClick()})),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},t.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,"")))},t.prototype.hide=function(){this._isHidden=!0},t}(),Wt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.elements=[],e}return Mt(e,t),e.prototype.addElement=function(t){this.elements.push(t)},e.prototype.getUI=function(){var e=t.prototype.getUI.call(this);return this.elements.forEach((function(t){return e.appendChild(t)})),e},e}(zt),Yt=function(){function t(t,e){this.horizontal=t,this.vertical=e}return Object.defineProperty(t.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),t.prototype.getVerticalLength=function(t){return t/this.ratio},t.prototype.getHorizontalLength=function(t){return t*this.ratio},t}(),Xt=function(){function t(){}return t.getIcon=function(t,e){if(t>0&&e>0){var i=new Yt(t,e),r=i.ratio>=1?20:i.getHorizontalLength(20),n=i.ratio<1?20:i.getVerticalLength(20),s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(s);var a=Bt.createDefs();s.appendChild(a);var o=Bt.createElement("clipPath",[["id","text-bg-clip"]]);a.appendChild(o);var l=Bt.createPath(Bt.getHollowRectanglePath((24-r)/2,(24-n)/2,r,n,(24-r)/2+2,(24-n)/2+2,r-4,n-4));s.appendChild(l);var c=Bt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);c.appendChild(Bt.createTSpan(t+":"+e)),s.appendChild(c);var u=c.getBBox();Bt.setAttributes(c,[["x",((24-u.width)/2).toString()],["y",((24-u.height)/2-u.y).toString()]]);var h=Bt.createPath(Bt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(u.width))/2,(24-Math.ceil(u.height))/2,Math.ceil(u.width),Math.ceil(u.height)));return o.appendChild(h),Bt.setAttributes(l,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(s),s.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>'},t}(),qt=function(t){function e(e,i,r){var n=t.call(this,e,i)||this;return n.isDropdownOpen=!1,n.onClick=n.dropdownButtonClicked,n.dropdownButtons=r,n}return Mt(e,t),e.prototype.setupDropdown=function(){var t=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach((function(e){e.className=t.className,e.colorsClassName=t.colorsClassName,t.dropdownBlock.appendChild(e.getUI())})),this.uiContainer.appendChild(this.dropdownBlock)},e.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},e.prototype.dropdownButtonClicked=function(){void 0===this.dropdownBlock&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},e.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},e.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},e.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},e}(Kt),$t=function(){function t(t,e){this.GRIP_SIZE=10,this.color=t,this.fillColor=e,this.visual=Bt.createGroup(),this.visual.appendChild(Bt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Bt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return t.prototype.ownsTarget=function(t){return t===this.visual||t===this.visual.childNodes[0]||t===this.visual.childNodes[1]},t.prototype.setCenter=function(t,e){this.visual.childNodes.forEach((function(i){return Bt.setAttributes(i,[["cx",t.toString()],["cy",e.toString()]])}))},t}(),Jt=function(){function t(t,e,i,r){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=t,this.canvasHeight=e,this.margin=i,this.container=r,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(t.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(t){this._aspectRatio=t,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(t){this._isGridVisible=t,this.gridContainer&&Bt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(t){this._zoomFactor=t,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),t.prototype.open=function(){var t=this;this.cropShadeElement=Bt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Bt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var e=0;e<this.numberOfGridLines;e++)this.horizontalGridLines.push(Bt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(Bt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach((function(e){return t.gridContainer.appendChild(e)})),this.verticalGridLines.forEach((function(e){return t.gridContainer.appendChild(e)})),this.cropRectElement=Bt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new $t(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new $t(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new $t(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new $t(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},t.prototype.setCropRectangle=function(t){this.cropRect=t;var e=Object.assign({},this.cropRect);1!==this.zoomFactor&&(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),Bt.setAttributes(this.cropRectElement,[["x",e.x.toString()],["y",e.y.toString()],["width",e.width.toString()],["height",e.height.toString()]]);var i=e.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach((function(t,r){var n=e.y+i*(r+1);Bt.setAttributes(t,[["x1",""+e.x],["y1",""+n],["x2",""+(e.x+e.width)],["y2",""+n]])}));var r=e.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach((function(t,i){var n=e.x+r*(i+1);Bt.setAttributes(t,[["x1",""+n],["y1",""+e.y],["x2",""+n],["y2",""+(e.y+e.height)]])})),Bt.setAttributes(this.cropShadeElement,[["d",Bt.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},t.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)},t.prototype.clientToLocalCoordinates=function(t,e){var i=this.container.getBoundingClientRect();return{x:t-i.left+this.margin,y:e-i.top+this.margin}},t.prototype.onPointerDown=function(t){this.container.setPointerCapture(t.pointerId),this.previousPoint=this.clientToLocalCoordinates(t.clientX,t.clientY),this.cropRectElement===t.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(t.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(t.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(t.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(t.target)&&(this.activeGrip=this.bottomRightGrip)},t.prototype.onPointerMove=function(t){if(this.isMoving)this.move(this.clientToLocalCoordinates(t.clientX,t.clientY));else if(this.activeGrip){var e=this.clientToLocalCoordinates(t.clientX,t.clientY);this.resize(e)}t.preventDefault()},t.prototype.onPointerUp=function(t){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(t.pointerId)},t.prototype.move=function(t){var e=t.x-this.previousPoint.x,i=t.y-this.previousPoint.y;1!==this.zoomFactor&&(e=-e/this.zoomFactor,i=-i/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+i),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=t},t.prototype.resize=function(t){var e=Object.assign({},this.cropRect),i=t.x-this.previousPoint.x,r=t.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:e.x+i<this.margin&&(i=this.margin-e.x),e.x+=i,e.width=this.cropRect.x+this.cropRect.width-e.x;break;case this.bottomRightGrip:case this.topRightGrip:e.width+i>this.canvasWidth*this.zoomFactor&&(i=this.canvasWidth*this.zoomFactor-e.width),e.width+=i}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(i),e.height=this.aspectRatio.getVerticalLength(e.width)):(e.y+=r,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+=r}e.width<10&&(e.x=this.cropRect.x,e.width=10),e.height<10&&(e.y=this.cropRect.y,e.height=10),this.previousPoint=t,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))},t.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var t=this.cropRect.x+this.cropRect.width/2,e=this.cropRect.y+this.cropRect.height/2,i=this.aspectRatio.getHorizontalLength(this.cropRect.height),r=this.aspectRatio.getVerticalLength(this.cropRect.width);i/this.canvasWidth<r/this.canvasHeight?this.cropRect.width=i:this.cropRect.height=r,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=t-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)}},t.prototype.getRescaledRect=function(t,e,i,r,n,s){var a=i/t,o=r/e;return{x:(n.x-s)*a+s,y:(n.y-s)*o+s,width:n.width*a,height:n.height*o}},t.prototype.scaleCanvas=function(t,e){var i=this.getRescaledRect(this.canvasWidth,this.canvasHeight,t,e,this.cropRect,this.margin);this.canvasWidth=t,this.canvasHeight=e,this.onCropChange&&this.onCropChange(i),this.setCropRectangle(i)},t}(),Qt=function(){function t(t){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=t,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(t.prototype,"angle",{get:function(){return this._angle},set:function(t){this._angle=t,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),t.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},t.prototype.onPointerDown=function(t){this.controlContainer.setPointerCapture(t.pointerId),this.isDragging=!0,this.previousPoint={x:t.clientX,y:t.clientY}},t.prototype.onPointerMove=function(t){this.isDragging&&(this.onAngleChange&&this.onAngleChange((t.clientX-this.previousPoint.x)/5),this.previousPoint.x=t.clientX)},t.prototype.onPointerUp=function(t){this.isDragging&&this.onAngleChange&&this.onAngleChange((t.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(t.pointerId)},t.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var t=this.angleLabelText.getBBox();Bt.setAttributes(this.angleLabelElement,[["x",((this.width-t.width)/2).toString()],["y",(this.height/2).toString()]])}},t.prototype.positionScaleShape=function(){if(this.scaleShape){var t=this.scaleShape.transform.baseVal.getItem(0);t.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(t,0)}},t.prototype.getVisual=function(){var t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("xmlns","http://www.w3.org/2000/svg"),t.setAttribute("width",this.width+"px"),t.setAttribute("height",this.height+"px"),t.setAttribute("viewBox","0 0 "+this.width+" "+this.height),t.style.flexShrink="0",document.body.appendChild(t);for(var e="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,i=1;i<=this.width/5+10;i++){var r=i%5==0?this.height/3:this.height/6;e+="h4v"+-r+"h1v"+r}e+="v1H0Z",this.scaleShape=Bt.createPath(e);var n=Bt.createTransform();this.scaleShape.transform.baseVal.appendItem(n),t.appendChild(this.scaleShape),this.angleLabelElement=Bt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Bt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var s=Bt.createTSpan("");return s.innerHTML="&deg;",this.angleLabelElement.appendChild(s),t.appendChild(this.angleLabelElement),document.body.removeChild(t),t},t}(),Zt=function(){function t(){this.naturalSize=!1,this.imageType="image/png"}return t.prototype.rasterize=function(t,e,i,r,n,s,a){var o=this;return new Promise((function(l){var c=document.createElement("canvas");c.width=t.width.baseVal.value-2*r,c.height=t.height.baseVal.value-2*r;var u=1,h=1;!0===o.naturalSize?(u=e.naturalWidth/(t.width.baseVal.value-2*r)/s,h=e.naturalHeight/(t.height.baseVal.value-2*r)/a,c.width=e.naturalWidth/s,c.height=e.naturalHeight/a):void 0!==o.width&&void 0!==o.height&&(u=o.width/i.width,h=o.height/i.height,c.width*=u,c.height*=h);var d=c.getContext("2d");d.translate(c.width/2,c.height/2),d.rotate(n*Math.PI/180),d.scale(s,a),d.translate(-c.width/2,-c.height/2),d.drawImage(e,0,0,c.width,c.height);var f=document.createElement("canvas");f.width=i.width*u,f.height=i.height*h,f.getContext("2d").putImageData(d.getImageData((i.x-r)*u,(i.y-r)*h,i.width*u,i.height*h),0,0),l(f.toDataURL(o.imageType,o.imageQuality))}))},t}(),te=function(){function t(e){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=t.instanceCounter++,this.styles=new Ft(this.instanceNo),this.target=e,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(t.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(t){this._zoomToCropEnabled=t,t?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(t){this._isGridVisible=t,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gridLines",{get:function(){return this._gridLines},set:function(t){this._gridLines=t,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(t){this._rotationAngle=t,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"aspectRatio",{get:function(){var t;return null!==(t=this._aspectRatio)&&void 0!==t?t:this.aspectRatios[0]},set:function(t){this._aspectRatio=t},enumerable:!1,configurable:!0}),t.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(),"popup"===this.displayMode&&this.onPopupResize(),this._isOpen=!0},t.prototype.show=function(){this.showUI(),this.open()},t.prototype.close=function(t){void 0===t&&(t=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),"popup"===this.displayMode&&window.removeEventListener("resize",this.setWindowHeight),t||this.closeEventListeners.forEach((function(t){return t()})),this._isOpen=!1)},t.prototype.addRenderEventListener=function(t){this.renderEventListeners.push(t)},t.prototype.removeRenderEventListener=function(t){this.renderEventListeners.indexOf(t)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(t),1)},t.prototype.addCloseEventListener=function(t){this.closeEventListeners.push(t)},t.prototype.removeCloseEventListener=function(t){this.closeEventListeners.indexOf(t)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(t),1)},t.prototype.setupResizeObserver=function(){var t=this;"inline"===this.displayMode?window.ResizeObserver&&(this.targetObserver=new ResizeObserver((function(){t.resize(t.target.clientWidth,t.target.clientHeight)})),this.targetObserver.observe(this.target)):"popup"===this.displayMode&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},t.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var t=1*this.target.clientWidth/this.target.clientHeight,e=this.contentDiv.clientWidth/t>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*t:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,i=e+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/t;this.resize(e,i)}},t.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},t.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",Bt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},t.prototype.resize=function(t,e){this.imageWidth=Math.round(t),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","popup"!==this.displayMode?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},t.prototype.setEditingTarget=function(){var t=document.createElement("canvas");t.width=this.target.naturalWidth,t.height=this.target.naturalHeight,t.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var e=t.toDataURL();Bt.setAttributes(this.editingTarget,[["href",e]]),this.setEditingTargetSize()},t.prototype.setTopLeft=function(){var t=this.target.getBoundingClientRect(),e=this.editorCanvas.getBoundingClientRect();this.left=t.left-e.left-this.CANVAS_MARGIN,this.top=t.top-e.top-this.CANVAS_MARGIN},t.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=Bt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=Bt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=Bt.createGroup(),this.editingTargetRotationScaleContainer=Bt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var t=Bt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(t);var e=Bt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(e),this.editingTargetContainer=Bt.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)},t.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},t.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=Bt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Jt(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()},t.prototype.zoomToCrop=function(){if(this.cropRect){var t=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=t+"px "+e+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-t+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-e+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},t.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)},t.prototype.cropRectChanged=function(t){this.cropRect=t,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},t.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},t.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"},t.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},t.prototype.showUI=function(){switch(this.addStyles(),"popup"===this.displayMode&&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 t=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,e=this.target.offsetTop>t+this.CANVAS_MARGIN?this.target.offsetTop-(t+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=void 0!==this.styles.settings.zIndex?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=void 0!==this.styles.settings.zIndex?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="popup"===this.displayMode?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,"popup"===this.displayMode&&(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","popup"===this.displayMode&&(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},t.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},t.prototype.addTopToolbar=function(){var t=this;this.topToolbar=new Ht,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 Vt;e.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(e);var i=[];this.aspectRatios.forEach((function(e){var r=new Kt(Xt.getIcon(e.horizontal,e.vertical),0===e.horizontal&&0===e.vertical?"FREE":e.horizontal+":"+e.vertical);r.onClick=function(){return t.ratioButtonClicked(e)},i.push(r)})),this.aspectRatioButton=new qt(Xt.getIcon(0,0),"Aspect ratio",i),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 r=new Kt('<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");r.isActive=this.isGridVisible,r.onClick=function(){t.isGridVisible=!t.isGridVisible,r.isActive=t.isGridVisible},e.addButton(r);var n=new Kt('<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(n.isActive=this.zoomToCropEnabled,n.onClick=function(){t.zoomToCropEnabled=!t.zoomToCropEnabled,n.isActive=t.zoomToCropEnabled},e.addButton(n),!jt.isLicensed){var s=new Wt;this.topToolbar.addElementBlock(s);var a=document.createElement("div");a.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var o=document.createElement("a");o.style.color="currentColor",o.href="https://markerjs.com/products/cropro",o.target="_blank",o.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>',a.appendChild(o),s.addElement(a)}var l=new Vt;l.minWidth=3*this.toolbarHeight+"px",l.contentAlign="end",this.topToolbar.addButtonBlock(l);var c=new Kt('<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");c.onClick=this.startRenderAndClose,l.addButton(c),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(c.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var u=new Kt('<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");u.onClick=this.close,l.addButton(u),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(u.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},t.prototype.addBottomToolbar=function(){var t=this;this.bottomToolbar=new Ht,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 Vt;e.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(e);var i=new Kt('<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");i.onClick=this.rotateLeftButtonClicked,e.addButton(i);var r=new Kt('<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");r.onClick=this.rotateRightButtonClicked,e.addButton(r);var n=new Wt;n.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(n),this.straightener=new Qt("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(e){t.rotateBy(e),t.straightener.angle=t.rotationAngle},n.addElement(this.straightener.getUI());var s=new Vt;s.minWidth=2*this.toolbarHeight+"px",s.contentAlign="end",this.bottomToolbar.addButtonBlock(s);var a=new Kt('<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");a.onClick=this.flipHorizontallyButtonClicked,s.addButton(a);var o=new Kt('<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");o.onClick=this.flipVerticallyButtonClicked,s.addButton(o)},t.prototype.ratioButtonClicked=function(t){this.aspectRatio=t,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},t.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Xt.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},t.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&0!==this.aspectRatio.horizontal&&0!==this.aspectRatio.vertical?this.cropLayer.aspectRatio=new Yt(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},t.prototype.closeUI=function(){"popup"===this.displayMode&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},t.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},t.prototype.restoreState=function(t){if(t){var e=this.cropLayer.getRescaledRect(t.width,t.height,this.imageWidth,this.imageHeight,t.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(e),this.cropRectChanged(e),this.flippedHorizontally=t.flippedHorizontally,this.flippedVertically=t.flippedVertically,this.applyFlip(),this.rotationAngle=t.rotationAngle,this.applyRotation()}},t.prototype.clientToLocalCoordinates=function(t,e){var i=this.cropImage.getBoundingClientRect();return{x:t-i.left,y:e-i.top}},t.prototype.onWindowResize=function(){this.positionUI()},t.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var t=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=t+"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()},t.prototype.rotateLeftButtonClicked=function(){var t=this.rotationAngle-90;this.rotationAngle%90!=0&&(t+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(t)},t.prototype.rotateRightButtonClicked=function(){var t=this.rotationAngle+90;this.rotationAngle%90!=0&&(t-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(t)},t.prototype.rotateTo=function(t){t=(t=t>180?t-360:t)<=-180?t+360:t,this.rotationAngle=t,this.applyRotation()},t.prototype.rotateBy=function(t){this.rotateTo((this.rotationAngle+t)%360)},t.prototype.applyRotation=function(){var t=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 i=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/i.width,this.imageHeight/i.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=t},t.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},t.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},t.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},t.prototype.startRenderAndClose=function(){return Pt(this,void 0,void 0,(function(){var t,e;return Nt(this,(function(i){switch(i.label){case 0:return[4,this.render()];case 1:return t=i.sent(),e=this.getState(),this.renderEventListeners.forEach((function(i){return i(t,e)})),this.close(!0),[2]}}))}))},t.prototype.render=function(){return Pt(this,void 0,void 0,(function(){var t;return Nt(this,(function(e){switch(e.label){case 0:return(t=new Zt).naturalSize=this.renderAtNaturalSize,t.imageType=this.renderImageType,t.imageQuality=this.renderImageQuality,t.width=this.renderWidth,t.height=this.renderHeight,this.unzoomFromCrop(),Bt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,t.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,t.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()]}}))}))},t.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Gt("toolbar","\n width: "+("inline"===this.displayMode?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+";\n flex-shrink: 0;\n display: flex;\n flex-direction: row;\n justify-content: space-between; \n height: "+this.toolbarHeight+"px;\n box-sizing: content-box;\n overflow: hidden;\n line-height: 0px;\n ")),this.toolbarStyleColorsClass=this.styles.addClass(new Gt("toolbar_colors","\n background-color: "+this.styles.settings.toolbarBackgroundColor+";\n ")),this.toolbarBlockStyleClass=this.styles.addClass(new Gt("toolbar-block","\n display: flex;\n align-items: center;\n box-sizing: content-box;\n "));var t=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Gt("toolbar_button","\n display: inline-block;\n width: "+(this.toolbarHeight-2*t)+"px;\n height: "+(this.toolbarHeight-2*t)+"px;\n padding: "+t+"px;\n cursor: default;\n user-select: none;\n box-sizing: content-box;\n ")),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Gt("toolbar_button_colors","\n color: "+this.styles.settings.toolbarColor+";\n fill: currentColor;\n ")),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Gt("toolbar_active_button","\n color: "+this.styles.settings.toolbarColor+";\n fill: currentColor;\n background-color: "+this.styles.settings.toolbarBackgroundActiveColor+"\n ")),this.styles.addRule(new Ut("."+this.toolbarButtonStyleClass.name+" svg","\n height: "+this.toolbarHeight/2+"px;\n ")),this.styles.addRule(new Ut("."+this.toolbarButtonStyleColorsClass.name+":hover","\n background-color: "+this.styles.settings.toolbarBackgroundHoverColor+"\n ")),this.toolbarDropdownStyleClass=this.styles.addClass(new Gt("toolbar_dropdown","\n position: absolute;\n max-width: "+4*this.toolbarHeight+"px;\n z-index: 20;\n white-space: normal;\n box-sizing: content-box;\n box-shadow: 3px 3px rgba(33, 33, 33, 0.1);\n margin: "+("inline"===this.displayMode?"0":this.popupMargin)+"px;\n line-height: 0px;\n ")),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new Gt("toolbar_dropdown_colors","\n background-color: "+this.styles.settings.toolbarBackgroundColor+";\n ")),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Gt("toolbar_straightener_block","\n display: flex;\n overflow: hidden;\n justify-content: center;\n -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%);\n ")),this.toolbarStraightenerStyleClass=this.styles.addClass(new Gt("toolbar_straightener","\n display: flex;\n overflow: hidden;\n justify-content: center;\n height: "+(this.toolbarHeight-2*t)+"px;\n padding: "+t+"px;\n cursor: default;\n user-select: none;\n box-sizing: content-box;\n ")),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Gt("toolbar_straightener_colors","\n color: "+this.styles.settings.toolbarColor+";\n fill: currentColor;\n "))},t.instanceCounter=0,t}(),ee=i("8hTe"),ie=i.n(ee),re=/<pre[^>]*>/g;e.a=function(t){var e=t.value,i=void 0===e?"":e,l=t.edit,d=void 0!==l&&l,f=t.className,p=t.showTextOnly,g=t.showLines,v=t.replaces,m=t.zoomImg,y=t.hasMask,C=t.style,k=void 0===C?{}:C,w=t.stylesPrev,x=void 0===w?{}:w,A=String(i),L=Object(u.useRef)(),R=Object(u.useRef)(),_=Object(u.useState)(""),I=Object(o.a)(_,2),F=I[0],U=I[1],G=Object(u.useState)("office"),H=Object(o.a)(G,2),z=H[0],V=H[1],K=Object(u.useMemo)((function(){try{A=(A=A.replace(/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,"("+P.a.API_SERVER+"/api/attachments/").replace(/\"\/api\/attachments\/|\"\/attachments\/download\//g,'"'+P.a.API_SERVER+"/api/attachments/").replace(/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g,'"'+P.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,"\n")).replace(new RegExp("(?<!\\n)\\n(?!\\n)","g")," \n")}catch(t){}var t=D(A),e=T;if(A.match(/\[TOC\]/)&&(t=t.replace("<p>[TOC]</p>",S()),b()),t=(t=t.replace(/(__special_katext_id_\d+__)/g,(function(t,i){var r=e[i],n=r.type,s=r.expression;return Object(N.renderToString)(function(t){var e=document.createElement("div");return e.innerHTML=t,0===e.childNodes.length?"":e.childNodes[0].nodeValue}(s)||"",{displayMode:"block"===n,throwOnError:!1,output:"html"})}))).replace(/▁/g,"▁▁▁"),O(),p){var i=document.createElement("div");return i.innerHTML=t,i.innerText}return setTimeout((function(){return X()}),500),t}),[A]),W=Object(u.useRef)();function Y(t){var e=t.target;if("IMG"===e.tagName.toUpperCase()){if(m){var i=e.getAttribute("src");U(i),V("image")}}else if("A"===e.tagName.toUpperCase()){var r=e.getAttribute("href");if(r.indexOf("office")>-1)t.preventDefault(),U(r),V("office");else if(r.indexOf("application/pdf")>-1)t.preventDefault(),U(r),V("pdf");else if(r.indexOf("type=text")>-1)t.preventDefault(),U(r),V("html");else if(r.startsWith("#")){t.preventDefault();var n=document.getElementById(r.replace("#",""));n&&n.scrollIntoView(!0)}}}E.WebkitLineClamp=g,g&&(k=Object(s.a)(Object(s.a)({},k),E));var X=function(){var t,e=null===(t=W.current)||void 0===t?void 0:t.querySelectorAll("video");null==e||e.forEach((function(t){if(t.oncontextmenu=function(){return!1},t.src.indexOf(".m3u8")>-1)if(t.canPlayType("application/vnd.apple.mpegurl"));else if(M.a.isSupported()){var e=new M.a;e.loadSource(t.src),e.attachMedia(t)}}))};Object(u.useEffect)((function(){if(W.current&&K&&K.match(re)&&window.PR.prettyPrint(),W.current)return W.current.addEventListener("click",Y),function(){W.current.removeEventListener("click",Y),O(),b()}}),[K,W.current,Y]);return h.a.createElement("div",{style:{position:"relative"}},h.a.createElement("div",{ref:W,style:Object(s.a)({},k),className:"".concat(f||""," markdown-body ").concat(ie.a.mdBody),onMouseOver:function(t){d&&("IMG"===t.target.nodeName?(L.current.style.display="flex",L.current.style.width=t.target.clientWidth+"px",L.current.style.height=t.target.clientHeight+"px",L.current.style.top=t.target.offsetTop+"px",L.current.style.left=t.target.offsetLeft+"px",R.current.src=t.target.getAttribute("src")):L.current.style.display="none")},dangerouslySetInnerHTML:{__html:K}}),h.a.createElement("div",{ref:L,className:ie.a.button},h.a.createElement(r.a,null,h.a.createElement(n.a,{onClick:function(){return(t=new te(R.current)).displayMode="popup",t.addRenderEventListener(function(){var t=Object(a.a)(c.a.mark((function t(e){var i;return c.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return L.current.style.display="none",t.next=3,Object(B.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:e}});case 3:null!=(i=t.sent)&&i.id&&v(R.current.getAttribute("src").replace(P.a.API_SERVER,""),"/api/attachments/".concat(null==i?void 0:i.id,"?type=").concat(i.content_type));case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),void t.show();var t}},"裁剪"),h.a.createElement(n.a,{onClick:function(){return(t=new Dt(R.current)).settings.displayMode="popup",t.addEventListener("render",function(){var t=Object(a.a)(c.a.mark((function t(e){var i;return c.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(L.current.style.display="none",!R.current){t.next=6;break}return t.next=4,Object(B.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:e.dataUrl}});case 4:null!=(i=t.sent)&&i.id&&v(R.current.getAttribute("src").replace(P.a.API_SERVER,""),"/api/attachments/".concat(null==i?void 0:i.id,"?type=").concat(i.content_type));case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),t.show(),void(window.markerArea=t);var t}},"编辑"))),h.a.createElement("img",{ref:R,src:"https://ali-cdn.educoder.net/images/avatars/PortalImage/170?t=1659681136",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),h.a.createElement(j.a,{close:!0,data:F,hasMask:y,type:null!=F&&F.length?z:"",style:Object(s.a)({},x),onClose:function(){return U("")}}))}},BJfS:
/*!*****************************************************!*\
!*** ./node_modules/string-convert/camel2hyphen.js ***!
\*****************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e){t.exports=function(t){return t.replace(/[A-Z]/g,(function(t){return"-"+t.toLowerCase()})).toLowerCase()}},BU3w:
/*!***************************************************!*\
!*** ./node_modules/rc-util/es/Dom/dynamicCSS.js ***!
\***************************************************/
/*! exports provided: injectCSS, updateCSS */
/*! exports used: updateCSS */function(t,e,i){"use strict";i.d(e,"a",(function(){return o}));var r=i(/*! ./canUseDom */"MNnm");function n(t){return t.attachTo?t.attachTo:document.querySelector("head")||document.body}function s(t){var e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Object(r.a)())return null;var s,a=document.createElement("style");(null===(e=i.csp)||void 0===e?void 0:e.nonce)&&(a.nonce=null===(s=i.csp)||void 0===s?void 0:s.nonce);a.innerHTML=t;var o=n(i),l=o.firstChild;return i.prepend&&o.prepend?o.prepend(a):i.prepend&&l?o.insertBefore(a,l):o.appendChild(a),a}var a=new Map;function o(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n(i);if(!a.has(r)){var o=s("",i),l=o.parentNode;a.set(r,l),l.removeChild(o)}var c=Array.from(a.get(r).children).find((function(t){return"STYLE"===t.tagName&&t["rc-util-key"]===e}));if(c){var u,h,d;if((null===(u=i.csp)||void 0===u?void 0:u.nonce)&&c.nonce!==(null===(h=i.csp)||void 0===h?void 0:h.nonce))c.nonce=null===(d=i.csp)||void 0===d?void 0:d.nonce;return c.innerHTML!==t&&(c.innerHTML=t),c}var f=s(t,i);return f["rc-util-key"]=e,f}},DlQD:
/*!*******************************************!*\
!*** ./node_modules/marked/lib/marked.js ***!
\*******************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,i){t.exports=function(){"use strict";function t(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=new Array(e);i<e;i++)r[i]=t[i];return r}function i(t,i){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,i){if(t){if("string"==typeof t)return e(t,i);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,i):void 0}}(t))||i&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=t[Symbol.iterator]()).next.bind(r)}var r=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t){function e(){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}}t.exports={defaults:{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},getDefaults:e,changeDefaults:function(e){t.exports.defaults=e}}})),n=(r.defaults,r.getDefaults,r.changeDefaults,/[&<>"']/),s=/[&<>"']/g,a=/[<>"']|&(?!#?\w+;)/,o=/[<>"']|&(?!#?\w+;)/g,l={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},c=function(t){return l[t]},u=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function h(t){return t.replace(u,(function(t,e){return"colon"===(e=e.toLowerCase())?":":"#"===e.charAt(0)?"x"===e.charAt(1)?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""}))}var d=/(^|[^\[])\^/g,f=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i,g={},v=/^[^:]+:\/*[^/]*$/,m=/^([^:]+:)[\s\S]*$/,y=/^([^:]+:\/*[^/]*)[\s\S]*$/;function b(t,e){g[" "+t]||(v.test(t)?g[" "+t]=t+"/":g[" "+t]=E(t,"/",!0));var i=-1===(t=g[" "+t]).indexOf(":");return"//"===e.substring(0,2)?i?e:t.replace(m,"$1")+e:"/"===e.charAt(0)?i?e:t.replace(y,"$1")+e:t+e}function E(t,e,i){var r=t.length;if(0===r)return"";for(var n=0;n<r;){var s=t.charAt(r-n-1);if(s!==e||i){if(s===e||!i)break;n++}else n++}return t.substr(0,r-n)}var S=function(t,e){if(e){if(n.test(t))return t.replace(s,c)}else if(a.test(t))return t.replace(o,c);return t},C=h,k=function(t,e){t=t.source||t,e=e||"";var i={replace:function(e,r){return r=(r=r.source||r).replace(d,"$1"),t=t.replace(e,r),i},getRegex:function(){return new RegExp(t,e)}};return i},w=function(t,e,i){if(t){var r;try{r=decodeURIComponent(h(i)).replace(f,"").toLowerCase()}catch(t){return null}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:")||0===r.indexOf("data:"))return null}e&&!p.test(i)&&(i=b(e,i));try{i=encodeURI(i).replace(/%25/g,"%")}catch(t){return null}return i},x={exec:function(){}},T=function(t){for(var e,i,r=1;r<arguments.length;r++)for(i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},O=function(t,e){var i=t.replace(/\|/g,(function(t,e,i){for(var r=!1,n=e;--n>=0&&"\\"===i[n];)r=!r;return r?"|":" |"})).split(/ \|/),r=0;if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;r<i.length;r++)i[r]=i[r].trim().replace(/\\\|/g,"|");return i},A=E,L=function(t,e){if(-1===t.indexOf(e[1]))return-1;for(var i=t.length,r=0,n=0;n<i;n++)if("\\"===t[n])n++;else if(t[n]===e[0])r++;else if(t[n]===e[1]&&--r<0)return n;return-1},R=function(t){t&&t.sanitize&&!t.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")},_=r.defaults,D=A,I=O,M=S,P=L;function N(t,e,i){var r=e.href,n=e.title?M(e.title):null,s=t[1].replace(/\\([\[\]])/g,"$1");return"!"!==t[0].charAt(0)?{type:"link",raw:i,href:r,title:n,text:s}:{type:"image",raw:i,href:r,title:n,text:M(s)}}var j=function(){function t(t){this.options=t||_}var e=t.prototype;return e.space=function(t){var e=this.rules.block.newline.exec(t);if(e)return e[0].length>1?{type:"space",raw:e[0]}:{raw:"\n"}},e.code=function(t,e){var i=this.rules.block.code.exec(t);if(i){var r=e[e.length-1];if(r&&"paragraph"===r.type)return{raw:i[0],text:i[0].trimRight()};var n=i[0].replace(/^ {4}/gm,"");return{type:"code",raw:i[0],codeBlockStyle:"indented",text:this.options.pedantic?n:D(n,"\n")}}},e.fences=function(t){var e=this.rules.block.fences.exec(t);if(e){var i=e[0],r=function(t,e){var i=t.match(/^(\s+)(?:```)/);if(null===i)return e;var r=i[1];return e.split("\n").map((function(t){var e=t.match(/^\s+/);return null===e?t:e[0].length>=r.length?t.slice(r.length):t})).join("\n")}(i,e[3]||"");return{type:"code",raw:i,lang:e[2]?e[2].trim():e[2],text:r}}},e.heading=function(t){var e=this.rules.block.heading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[1].length,text:e[2]}},e.nptable=function(t){var e=this.rules.block.nptable.exec(t);if(e){var i={type:"table",header:I(e[1].replace(/^ *| *\| *$/g,"")),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:e[3]?e[3].replace(/\n$/,"").split("\n"):[],raw:e[0]};if(i.header.length===i.align.length){var r,n=i.align.length;for(r=0;r<n;r++)/^ *-+: *$/.test(i.align[r])?i.align[r]="right":/^ *:-+: *$/.test(i.align[r])?i.align[r]="center":/^ *:-+ *$/.test(i.align[r])?i.align[r]="left":i.align[r]=null;for(n=i.cells.length,r=0;r<n;r++)i.cells[r]=I(i.cells[r],i.header.length);return i}}},e.hr=function(t){var e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:e[0]}},e.blockquote=function(t){var e=this.rules.block.blockquote.exec(t);if(e){var i=e[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:e[0],text:i}}},e.list=function(t){var e=this.rules.block.list.exec(t);if(e){for(var i,r,n,s,a,o,l,c=e[0],u=e[2],h=u.length>1,d=")"===u[u.length-1],f={type:"list",raw:c,ordered:h,start:h?+u.slice(0,-1):"",loose:!1,items:[]},p=e[0].match(this.rules.block.item),g=!1,v=p.length,m=0;m<v;m++)c=i=p[m],r=i.length,~(i=i.replace(/^ *([*+-]|\d+[.)]) */,"")).indexOf("\n ")&&(r-=i.length,i=this.options.pedantic?i.replace(/^ {1,4}/gm,""):i.replace(new RegExp("^ {1,"+r+"}","gm"),"")),m!==v-1&&(n=this.rules.block.bullet.exec(p[m+1])[0],(h?1===n.length||!d&&")"===n[n.length-1]:n.length>1||this.options.smartLists&&n!==u)&&(s=p.slice(m+1).join("\n"),f.raw=f.raw.substring(0,f.raw.length-s.length),m=v-1)),a=g||/\n\n(?!\s*$)/.test(i),m!==v-1&&(g="\n"===i.charAt(i.length-1),a||(a=g)),a&&(f.loose=!0),l=void 0,(o=/^\[[ xX]\] /.test(i))&&(l=" "!==i[1],i=i.replace(/^\[[ xX]\] +/,"")),f.items.push({type:"list_item",raw:c,task:o,checked:l,loose:a,text:i});return f}},e.html=function(t){var e=this.rules.block.html.exec(t);if(e)return{type:this.options.sanitize?"paragraph":"html",raw:e[0],pre:!this.options.sanitizer&&("pre"===e[1]||"script"===e[1]||"style"===e[1]),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):M(e[0]):e[0]}},e.def=function(t){var e=this.rules.block.def.exec(t);if(e)return e[3]&&(e[3]=e[3].substring(1,e[3].length-1)),{tag:e[1].toLowerCase().replace(/\s+/g," "),raw:e[0],href:e[2],title:e[3]}},e.table=function(t){var e=this.rules.block.table.exec(t);if(e){var i={type:"table",header:I(e[1].replace(/^ *| *\| *$/g,"")),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:e[3]?e[3].replace(/\n$/,"").split("\n"):[]};if(i.header.length===i.align.length){i.raw=e[0];var r,n=i.align.length;for(r=0;r<n;r++)/^ *-+: *$/.test(i.align[r])?i.align[r]="right":/^ *:-+: *$/.test(i.align[r])?i.align[r]="center":/^ *:-+ *$/.test(i.align[r])?i.align[r]="left":i.align[r]=null;for(n=i.cells.length,r=0;r<n;r++)i.cells[r]=I(i.cells[r].replace(/^ *\| *| *\| *$/g,""),i.header.length);return i}}},e.lheading=function(t){var e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:"="===e[2].charAt(0)?1:2,text:e[1]}},e.paragraph=function(t){var e=this.rules.block.paragraph.exec(t);if(e)return{type:"paragraph",raw:e[0],text:"\n"===e[1].charAt(e[1].length-1)?e[1].slice(0,-1):e[1]}},e.text=function(t,e){var i=this.rules.block.text.exec(t);if(i){var r=e[e.length-1];return r&&"text"===r.type?{raw:i[0],text:i[0]}:{type:"text",raw:i[0],text:i[0]}}},e.escape=function(t){var e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:M(e[1])}},e.tag=function(t,e,i){var r=this.rules.inline.tag.exec(t);if(r)return!e&&/^<a /i.test(r[0])?e=!0:e&&/^<\/a>/i.test(r[0])&&(e=!1),!i&&/^<(pre|code|kbd|script)(\s|>)/i.test(r[0])?i=!0:i&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(r[0])&&(i=!1),{type:this.options.sanitize?"text":"html",raw:r[0],inLink:e,inRawBlock:i,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(r[0]):M(r[0]):r[0]}},e.link=function(t){var e=this.rules.inline.link.exec(t);if(e){var i=P(e[2],"()");if(i>-1){var r=(0===e[0].indexOf("!")?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,r).trim(),e[3]=""}var n=e[2],s="";if(this.options.pedantic){var a=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);a?(n=a[1],s=a[3]):s=""}else s=e[3]?e[3].slice(1,-1):"";return N(e,{href:(n=n.trim().replace(/^<([\s\S]*)>$/,"$1"))?n.replace(this.rules.inline._escapes,"$1"):n,title:s?s.replace(this.rules.inline._escapes,"$1"):s},e[0])}},e.reflink=function(t,e){var i;if((i=this.rules.inline.reflink.exec(t))||(i=this.rules.inline.nolink.exec(t))){var r=(i[2]||i[1]).replace(/\s+/g," ");if(!(r=e[r.toLowerCase()])||!r.href){var n=i[0].charAt(0);return{type:"text",raw:n,text:n}}return N(i,r,i[0])}},e.strong=function(t,e,i){void 0===i&&(i="");var r=this.rules.inline.strong.start.exec(t);if(r&&(!r[1]||r[1]&&(""===i||this.rules.inline.punctuation.exec(i)))){e=e.slice(-1*t.length);var n,s="**"===r[0]?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;for(s.lastIndex=0;null!=(r=s.exec(e));)if(n=this.rules.inline.strong.middle.exec(e.slice(0,r.index+3)))return{type:"strong",raw:t.slice(0,n[0].length),text:t.slice(2,n[0].length-2)}}},e.em=function(t,e,i){void 0===i&&(i="");var r=this.rules.inline.em.start.exec(t);if(r&&(!r[1]||r[1]&&(""===i||this.rules.inline.punctuation.exec(i)))){e=e.slice(-1*t.length);var n,s="*"===r[0]?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;for(s.lastIndex=0;null!=(r=s.exec(e));)if(n=this.rules.inline.em.middle.exec(e.slice(0,r.index+2)))return{type:"em",raw:t.slice(0,n[0].length),text:t.slice(1,n[0].length-1)}}},e.codespan=function(t){var e=this.rules.inline.code.exec(t);if(e){var i=e[2].replace(/\n/g," "),r=/[^ ]/.test(i),n=i.startsWith(" ")&&i.endsWith(" ");return r&&n&&(i=i.substring(1,i.length-1)),i=M(i,!0),{type:"codespan",raw:e[0],text:i}}},e.br=function(t){var e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}},e.del=function(t){var e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[1]}},e.autolink=function(t,e){var i,r,n=this.rules.inline.autolink.exec(t);if(n)return r="@"===n[2]?"mailto:"+(i=M(this.options.mangle?e(n[1]):n[1])):i=M(n[1]),{type:"link",raw:n[0],text:i,href:r,tokens:[{type:"text",raw:i,text:i}]}},e.url=function(t,e){var i;if(i=this.rules.inline.url.exec(t)){var r,n;if("@"===i[2])n="mailto:"+(r=M(this.options.mangle?e(i[0]):i[0]));else{var s;do{s=i[0],i[0]=this.rules.inline._backpedal.exec(i[0])[0]}while(s!==i[0]);r=M(i[0]),n="www."===i[1]?"http://"+r:r}return{type:"link",raw:i[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}}},e.inlineText=function(t,e,i){var r,n=this.rules.inline.text.exec(t);if(n)return r=e?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):M(n[0]):n[0]:M(this.options.smartypants?i(n[0]):n[0]),{type:"text",raw:n[0],text:r}},t}(),B=x,F=k,U=T,G={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:B,table:B,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};G.def=F(G.def).replace("label",G._label).replace("title",G._title).getRegex(),G.bullet=/(?:[*+-]|\d{1,9}[.)])/,G.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,G.item=F(G.item,"gm").replace(/bull/g,G.bullet).getRegex(),G.list=F(G.list).replace(/bull/g,G.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+G.def.source+")").getRegex(),G._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",G._comment=/<!--(?!-?>)[\s\S]*?-->/,G.html=F(G.html,"i").replace("comment",G._comment).replace("tag",G._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),G.paragraph=F(G._paragraph).replace("hr",G.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",G._tag).getRegex(),G.blockquote=F(G.blockquote).replace("paragraph",G.paragraph).getRegex(),G.normal=U({},G),G.gfm=U({},G.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*|$)"}),G.gfm.nptable=F(G.gfm.nptable).replace("hr",G.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",G._tag).getRegex(),G.gfm.table=F(G.gfm.table).replace("hr",G.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",G._tag).getRegex(),G.pedantic=U({},G.normal,{html:F("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",G._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:B,paragraph:F(G.normal._paragraph).replace("hr",G.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",G.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var H={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:B,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:B,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/,_punctuation:"!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~"};H.punctuation=F(H.punctuation).replace(/punctuation/g,H._punctuation).getRegex(),H._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",H._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",H.em.start=F(H.em.start).replace(/punctuation/g,H._punctuation).getRegex(),H.em.middle=F(H.em.middle).replace(/punctuation/g,H._punctuation).replace(/overlapSkip/g,H._overlapSkip).getRegex(),H.em.endAst=F(H.em.endAst,"g").replace(/punctuation/g,H._punctuation).getRegex(),H.em.endUnd=F(H.em.endUnd,"g").replace(/punctuation/g,H._punctuation).getRegex(),H.strong.start=F(H.strong.start).replace(/punctuation/g,H._punctuation).getRegex(),H.strong.middle=F(H.strong.middle).replace(/punctuation/g,H._punctuation).replace(/blockSkip/g,H._blockSkip).getRegex(),H.strong.endAst=F(H.strong.endAst,"g").replace(/punctuation/g,H._punctuation).getRegex(),H.strong.endUnd=F(H.strong.endUnd,"g").replace(/punctuation/g,H._punctuation).getRegex(),H.blockSkip=F(H._blockSkip,"g").getRegex(),H.overlapSkip=F(H._overlapSkip,"g").getRegex(),H._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,H._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,H._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])?)+(?![-_])/,H.autolink=F(H.autolink).replace("scheme",H._scheme).replace("email",H._email).getRegex(),H._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,H.tag=F(H.tag).replace("comment",G._comment).replace("attribute",H._attribute).getRegex(),H._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,H._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,H._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,H.link=F(H.link).replace("label",H._label).replace("href",H._href).replace("title",H._title).getRegex(),H.reflink=F(H.reflink).replace("label",H._label).getRegex(),H.reflinkSearch=F(H.reflinkSearch,"g").replace("reflink",H.reflink).replace("nolink",H.nolink).getRegex(),H.normal=U({},H),H.pedantic=U({},H.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:F(/^!?\[(label)\]\((.*?)\)/).replace("label",H._label).getRegex(),reflink:F(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",H._label).getRegex()}),H.gfm=U({},H.normal,{escape:F(H.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),H.gfm.url=F(H.gfm.url,"i").replace("email",H.gfm._extended_email).getRegex(),H.breaks=U({},H.gfm,{br:F(H.br).replace("{2,}","*").getRegex(),text:F(H.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var z={block:G,inline:H},V=r.defaults,K=z.block,W=z.inline;function Y(t){return t.replace(/---/g,"—").replace(/--/g,"").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1").replace(/'/g,"").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}function X(t){var e,i,r="",n=t.length;for(e=0;e<n;e++)i=t.charCodeAt(e),Math.random()>.5&&(i="x"+i.toString(16)),r+="&#"+i+";";return r}var q=function(){function e(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||V,this.options.tokenizer=this.options.tokenizer||new j,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var e={block:K.normal,inline:W.normal};this.options.pedantic?(e.block=K.pedantic,e.inline=W.pedantic):this.options.gfm&&(e.block=K.gfm,this.options.breaks?e.inline=W.breaks:e.inline=W.gfm),this.tokenizer.rules=e}e.lex=function(t,i){return new e(i).lex(t)};var i,r,n,s=e.prototype;return s.lex=function(t){return t=t.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(t,this.tokens,!0),this.inline(this.tokens),this.tokens},s.blockTokens=function(t,e,i){var r,n,s,a;for(void 0===e&&(e=[]),void 0===i&&(i=!0),t=t.replace(/^ +$/gm,"");t;)if(r=this.tokenizer.space(t))t=t.substring(r.raw.length),r.type&&e.push(r);else if(r=this.tokenizer.code(t,e))t=t.substring(r.raw.length),r.type?e.push(r):((a=e[e.length-1]).raw+="\n"+r.raw,a.text+="\n"+r.text);else if(r=this.tokenizer.fences(t))t=t.substring(r.raw.length),e.push(r);else if(r=this.tokenizer.heading(t))t=t.substring(r.raw.length),e.push(r);else if(r=this.tokenizer.nptable(t))t=t.substring(r.raw.length),e.push(r);else if(r=this.tokenizer.hr(t))t=t.substring(r.raw.length),e.push(r);else if(r=this.tokenizer.blockquote(t))t=t.substring(r.raw.length),r.tokens=this.blockTokens(r.text,[],i),e.push(r);else if(r=this.tokenizer.list(t)){for(t=t.substring(r.raw.length),s=r.items.length,n=0;n<s;n++)r.items[n].tokens=this.blockTokens(r.items[n].text,[],!1);e.push(r)}else if(r=this.tokenizer.html(t))t=t.substring(r.raw.length),e.push(r);else if(i&&(r=this.tokenizer.def(t)))t=t.substring(r.raw.length),this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title});else if(r=this.tokenizer.table(t))t=t.substring(r.raw.length),e.push(r);else if(r=this.tokenizer.lheading(t))t=t.substring(r.raw.length),e.push(r);else if(i&&(r=this.tokenizer.paragraph(t)))t=t.substring(r.raw.length),e.push(r);else if(r=this.tokenizer.text(t,e))t=t.substring(r.raw.length),r.type?e.push(r):((a=e[e.length-1]).raw+="\n"+r.raw,a.text+="\n"+r.text);else if(t){var o="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(o);break}throw new Error(o)}return e},s.inline=function(t){var e,i,r,n,s,a,o=t.length;for(e=0;e<o;e++)switch((a=t[e]).type){case"paragraph":case"text":case"heading":a.tokens=[],this.inlineTokens(a.text,a.tokens);break;case"table":for(a.tokens={header:[],cells:[]},n=a.header.length,i=0;i<n;i++)a.tokens.header[i]=[],this.inlineTokens(a.header[i],a.tokens.header[i]);for(n=a.cells.length,i=0;i<n;i++)for(s=a.cells[i],a.tokens.cells[i]=[],r=0;r<s.length;r++)a.tokens.cells[i][r]=[],this.inlineTokens(s[r],a.tokens.cells[i][r]);break;case"blockquote":this.inline(a.tokens);break;case"list":for(n=a.items.length,i=0;i<n;i++)this.inline(a.items[i].tokens)}return t},s.inlineTokens=function(t,e,i,r,n){var s;void 0===e&&(e=[]),void 0===i&&(i=!1),void 0===r&&(r=!1),void 0===n&&(n="");var a,o=t;if(this.tokens.links){var l=Object.keys(this.tokens.links);if(l.length>0)for(;null!=(a=this.tokenizer.rules.inline.reflinkSearch.exec(o));)l.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(a=this.tokenizer.rules.inline.blockSkip.exec(o));)o=o.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;t;)if(s=this.tokenizer.escape(t))t=t.substring(s.raw.length),e.push(s);else if(s=this.tokenizer.tag(t,i,r))t=t.substring(s.raw.length),i=s.inLink,r=s.inRawBlock,e.push(s);else if(s=this.tokenizer.link(t))t=t.substring(s.raw.length),"link"===s.type&&(s.tokens=this.inlineTokens(s.text,[],!0,r)),e.push(s);else if(s=this.tokenizer.reflink(t,this.tokens.links))t=t.substring(s.raw.length),"link"===s.type&&(s.tokens=this.inlineTokens(s.text,[],!0,r)),e.push(s);else if(s=this.tokenizer.strong(t,o,n))t=t.substring(s.raw.length),s.tokens=this.inlineTokens(s.text,[],i,r),e.push(s);else if(s=this.tokenizer.em(t,o,n))t=t.substring(s.raw.length),s.tokens=this.inlineTokens(s.text,[],i,r),e.push(s);else if(s=this.tokenizer.codespan(t))t=t.substring(s.raw.length),e.push(s);else if(s=this.tokenizer.br(t))t=t.substring(s.raw.length),e.push(s);else if(s=this.tokenizer.del(t))t=t.substring(s.raw.length),s.tokens=this.inlineTokens(s.text,[],i,r),e.push(s);else if(s=this.tokenizer.autolink(t,X))t=t.substring(s.raw.length),e.push(s);else if(i||!(s=this.tokenizer.url(t,X))){if(s=this.tokenizer.inlineText(t,r,Y))t=t.substring(s.raw.length),n=s.raw.slice(-1),e.push(s);else if(t){var c="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(c);break}throw new Error(c)}}else t=t.substring(s.raw.length),e.push(s);return e},i=e,n=[{key:"rules",get:function(){return{block:K,inline:W}}}],(r=null)&&t(i.prototype,r),n&&t(i,n),e}(),$=r.defaults,J=w,Q=S,Z=function(){function t(t){this.options=t||$}var e=t.prototype;return e.code=function(t,e,i){var r=(e||"").match(/\S*/)[0];if(this.options.highlight){var n=this.options.highlight(t,r);null!=n&&n!==t&&(i=!0,t=n)}return r?'<pre><code class="'+this.options.langPrefix+Q(r,!0)+'">'+(i?t:Q(t,!0))+"</code></pre>\n":"<pre><code>"+(i?t:Q(t,!0))+"</code></pre>\n"},e.blockquote=function(t){return"<blockquote>\n"+t+"</blockquote>\n"},e.html=function(t){return t},e.heading=function(t,e,i,r){return this.options.headerIds?"<h"+e+' id="'+this.options.headerPrefix+r.slug(i)+'">'+t+"</h"+e+">\n":"<h"+e+">"+t+"</h"+e+">\n"},e.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},e.list=function(t,e,i){var r=e?"ol":"ul";return"<"+r+(e&&1!==i?' start="'+i+'"':"")+">\n"+t+"</"+r+">\n"},e.listitem=function(t){return"<li>"+t+"</li>\n"},e.checkbox=function(t){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},e.paragraph=function(t){return"<p>"+t+"</p>\n"},e.table=function(t,e){return e&&(e="<tbody>"+e+"</tbody>"),"<table>\n<thead>\n"+t+"</thead>\n"+e+"</table>\n"},e.tablerow=function(t){return"<tr>\n"+t+"</tr>\n"},e.tablecell=function(t,e){var i=e.header?"th":"td";return(e.align?"<"+i+' align="'+e.align+'">':"<"+i+">")+t+"</"+i+">\n"},e.strong=function(t){return"<strong>"+t+"</strong>"},e.em=function(t){return"<em>"+t+"</em>"},e.codespan=function(t){return"<code>"+t+"</code>"},e.br=function(){return this.options.xhtml?"<br/>":"<br>"},e.del=function(t){return"<del>"+t+"</del>"},e.link=function(t,e,i){if(null===(t=J(this.options.sanitize,this.options.baseUrl,t)))return i;var r='<a href="'+Q(t)+'"';return e&&(r+=' title="'+e+'"'),r+=">"+i+"</a>"},e.image=function(t,e,i){if(null===(t=J(this.options.sanitize,this.options.baseUrl,t)))return i;var r='<img src="'+t+'" alt="'+i+'"';return e&&(r+=' title="'+e+'"'),r+=this.options.xhtml?"/>":">"},e.text=function(t){return t},t}(),tt=function(){function t(){}var e=t.prototype;return e.strong=function(t){return t},e.em=function(t){return t},e.codespan=function(t){return t},e.del=function(t){return t},e.html=function(t){return t},e.text=function(t){return t},e.link=function(t,e,i){return""+i},e.image=function(t,e,i){return""+i},e.br=function(){return""},t}(),et=function(){function t(){this.seen={}}return t.prototype.slug=function(t){var e=t.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(e)){var i=e;do{this.seen[i]++,e=i+"-"+this.seen[i]}while(this.seen.hasOwnProperty(e))}return this.seen[e]=0,e},t}(),it=r.defaults,rt=C,nt=function(){function t(t){this.options=t||it,this.options.renderer=this.options.renderer||new Z,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new tt,this.slugger=new et}t.parse=function(e,i){return new t(i).parse(e)};var e=t.prototype;return e.parse=function(t,e){void 0===e&&(e=!0);var i,r,n,s,a,o,l,c,u,h,d,f,p,g,v,m,y,b,E="",S=t.length;for(i=0;i<S;i++)switch((h=t[i]).type){case"space":continue;case"hr":E+=this.renderer.hr();continue;case"heading":E+=this.renderer.heading(this.parseInline(h.tokens),h.depth,rt(this.parseInline(h.tokens,this.textRenderer)),this.slugger);continue;case"code":E+=this.renderer.code(h.text,h.lang,h.escaped);continue;case"table":for(c="",l="",s=h.header.length,r=0;r<s;r++)l+=this.renderer.tablecell(this.parseInline(h.tokens.header[r]),{header:!0,align:h.align[r]});for(c+=this.renderer.tablerow(l),u="",s=h.cells.length,r=0;r<s;r++){for(l="",a=(o=h.tokens.cells[r]).length,n=0;n<a;n++)l+=this.renderer.tablecell(this.parseInline(o[n]),{header:!1,align:h.align[n]});u+=this.renderer.tablerow(l)}E+=this.renderer.table(c,u);continue;case"blockquote":u=this.parse(h.tokens),E+=this.renderer.blockquote(u);continue;case"list":for(d=h.ordered,f=h.start,p=h.loose,s=h.items.length,u="",r=0;r<s;r++)m=(v=h.items[r]).checked,y=v.task,g="",v.task&&(b=this.renderer.checkbox(m),p?v.tokens.length>0&&"text"===v.tokens[0].type?(v.tokens[0].text=b+" "+v.tokens[0].text,v.tokens[0].tokens&&v.tokens[0].tokens.length>0&&"text"===v.tokens[0].tokens[0].type&&(v.tokens[0].tokens[0].text=b+" "+v.tokens[0].tokens[0].text)):v.tokens.unshift({type:"text",text:b}):g+=b),g+=this.parse(v.tokens,p),u+=this.renderer.listitem(g,y,m);E+=this.renderer.list(u,d,f);continue;case"html":E+=this.renderer.html(h.text);continue;case"paragraph":E+=this.renderer.paragraph(this.parseInline(h.tokens));continue;case"text":for(u=h.tokens?this.parseInline(h.tokens):h.text;i+1<S&&"text"===t[i+1].type;)u+="\n"+((h=t[++i]).tokens?this.parseInline(h.tokens):h.text);E+=e?this.renderer.paragraph(u):u;continue;default:var C='Token with "'+h.type+'" type was not found.';if(this.options.silent)return void console.error(C);throw new Error(C)}return E},e.parseInline=function(t,e){e=e||this.renderer;var i,r,n="",s=t.length;for(i=0;i<s;i++)switch((r=t[i]).type){case"escape":n+=e.text(r.text);break;case"html":n+=e.html(r.text);break;case"link":n+=e.link(r.href,r.title,this.parseInline(r.tokens,e));break;case"image":n+=e.image(r.href,r.title,r.text);break;case"strong":n+=e.strong(this.parseInline(r.tokens,e));break;case"em":n+=e.em(this.parseInline(r.tokens,e));break;case"codespan":n+=e.codespan(r.text);break;case"br":n+=e.br();break;case"del":n+=e.del(this.parseInline(r.tokens,e));break;case"text":n+=e.text(r.text);break;default:var a='Token with "'+r.type+'" type was not found.';if(this.options.silent)return void console.error(a);throw new Error(a)}return n},t}(),st=T,at=R,ot=S,lt=r.getDefaults,ct=r.changeDefaults,ut=r.defaults;function ht(t,e,i){if(null==t)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof t)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected");if("function"==typeof e&&(i=e,e=null),e=st({},ht.defaults,e||{}),at(e),i){var r,n=e.highlight;try{r=q.lex(t,e)}catch(t){return i(t)}var s=function(t){var s;if(!t)try{s=nt.parse(r,e)}catch(e){t=e}return e.highlight=n,t?i(t):i(null,s)};if(!n||n.length<3)return s();if(delete e.highlight,!r.length)return s();var a=0;return ht.walkTokens(r,(function(t){"code"===t.type&&(a++,setTimeout((function(){n(t.text,t.lang,(function(e,i){if(e)return s(e);null!=i&&i!==t.text&&(t.text=i,t.escaped=!0),0==--a&&s()}))}),0))})),void(0===a&&s())}try{var o=q.lex(t,e);return e.walkTokens&&ht.walkTokens(o,e.walkTokens),nt.parse(o,e)}catch(t){if(t.message+="\nPlease report this to https://github.com/markedjs/marked.",e.silent)return"<p>An error occurred:</p><pre>"+ot(t.message+"",!0)+"</pre>";throw t}}return ht.options=ht.setOptions=function(t){return st(ht.defaults,t),ct(ht.defaults),ht},ht.getDefaults=lt,ht.defaults=ut,ht.use=function(t){var e=st({},t);if(t.renderer&&function(){var i=ht.defaults.renderer||new Z,r=function(e){var r=i[e];i[e]=function(){for(var n=arguments.length,s=new Array(n),a=0;a<n;a++)s[a]=arguments[a];var o=t.renderer[e].apply(i,s);return!1===o&&(o=r.apply(i,s)),o}};for(var n in t.renderer)r(n);e.renderer=i}(),t.tokenizer&&function(){var i=ht.defaults.tokenizer||new j,r=function(e){var r=i[e];i[e]=function(){for(var n=arguments.length,s=new Array(n),a=0;a<n;a++)s[a]=arguments[a];var o=t.tokenizer[e].apply(i,s);return!1===o&&(o=r.apply(i,s)),o}};for(var n in t.tokenizer)r(n);e.tokenizer=i}(),t.walkTokens){var i=ht.defaults.walkTokens;e.walkTokens=function(e){t.walkTokens(e),i&&i(e)}}ht.setOptions(e)},ht.walkTokens=function(t,e){for(var r,n=i(t);!(r=n()).done;){var s=r.value;switch(e(s),s.type){case"table":for(var a,o=i(s.tokens.header);!(a=o()).done;){var l=a.value;ht.walkTokens(l,e)}for(var c,u=i(s.tokens.cells);!(c=u()).done;)for(var h,d=i(c.value);!(h=d()).done;){var f=h.value;ht.walkTokens(f,e)}break;case"list":ht.walkTokens(s.items,e);break;default:s.tokens&&ht.walkTokens(s.tokens,e)}}},ht.Parser=nt,ht.parser=nt.parse,ht.Renderer=Z,ht.TextRenderer=tt,ht.Lexer=q,ht.lexer=q.lex,ht.Tokenizer=j,ht.Slugger=et,ht.parse=ht,ht}()},IBYe:
/*!**************************************************!*\
!*** ./node_modules/rc-table/es/sugar/Column.js ***!
\**************************************************/
/*! exports provided: default */
/*! exports used: default */function(t,e,i){"use strict";e.a=function(t){return null}},LdHM:
/*!********************************************************!*\
!*** ./node_modules/rc-select/es/index.js + 6 modules ***!
\********************************************************/
/*! exports provided: Option, OptGroup, default */
/*! exports used: OptGroup, Option, default */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createSuper.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/typeof.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/TransBtn.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/generate.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/utils/commonUtil.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/utils/valueUtil.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Children/toArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/KeyCode.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/hooks/useMemo.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/pickAttrs.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/warning.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-virtual-list/es/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(t,e,i){"use strict";i.d(e,"b",(function(){return S})),i.d(e,"a",(function(){return k}));var r=i("1OyB"),n=i("vuIU"),s=i("Ji7U"),a=i("LK+K"),o=i("q1tI"),l=i("rePB"),c=i("Ff2n"),u=i("ODXe"),h=i("4IlW"),d=i("bX4T"),f=i("YrtM"),p=i("TSYQ"),g=i.n(p),v=i("+nKL"),m=i("8OUc"),y=o.forwardRef((function(t,e){var i=t.prefixCls,r=t.id,n=t.flattenOptions,s=t.childrenAsData,a=t.values,p=t.searchValue,y=t.multiple,b=t.defaultActiveFirstOption,E=t.height,S=t.itemHeight,C=t.notFoundContent,k=t.open,w=t.menuItemSelectedIcon,x=t.virtual,T=t.onSelect,O=t.onToggleOpen,A=t.onActiveValue,L=t.onScroll,R=t.onMouseEnter,_="".concat(i,"-item"),D=Object(f.a)((function(){return n}),[k,n],(function(t,e){return e[0]&&t[1]!==e[1]})),I=o.useRef(null),M=function(t){t.preventDefault()},P=function(t){I.current&&I.current.scrollTo({index:t})},N=function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=D.length,r=0;r<i;r+=1){var n=(t+r*e+i)%i,s=D[n],a=s.group,o=s.data;if(!a&&!o.disabled)return n}return-1},j=o.useState((function(){return N(0)})),B=Object(u.a)(j,2),F=B[0],U=B[1],G=function(t){U(t);var e=D[t];e?A(e.data.value,t):A(null,-1)};o.useEffect((function(){G(!1!==b?N(0):-1)}),[D.length,p]),o.useEffect((function(){var t=setTimeout((function(){if(!y&&k&&1===a.size){var t=Array.from(a)[0],e=D.findIndex((function(e){return e.data.value===t}));G(e),P(e)}}));return function(){return clearTimeout(t)}}),[k]);var H=function(t){void 0!==t&&T(t,{selected:!a.has(t)}),y||O(!1)};if(o.useImperativeHandle(e,(function(){return{onKeyDown:function(t){var e=t.which;switch(e){case h.a.UP:case h.a.DOWN:var i=0;if(e===h.a.UP?i=-1:e===h.a.DOWN&&(i=1),0!==i){var r=N(F+i,i);P(r),G(r)}break;case h.a.ENTER:var n=D[F];n&&!n.data.disabled?H(n.data.value):H(void 0),k&&t.preventDefault();break;case h.a.ESC:O(!1)}},onKeyUp:function(){},scrollTo:function(t){P(t)}}})),0===D.length)return o.createElement("div",{role:"listbox",id:"".concat(r,"_list"),className:"".concat(_,"-empty"),onMouseDown:M},C);function z(t){var e=D[t];if(!e)return null;var i=e.data||{},n=i.value,l=i.label,c=i.children,u=Object(d.a)(i,!0),h=s?c:l;return e?o.createElement("div",Object.assign({"aria-label":"string"==typeof h?h:null},u,{key:t,role:"option",id:"".concat(r,"_list_").concat(t),"aria-selected":a.has(n)}),n):null}return o.createElement(o.Fragment,null,o.createElement("div",{role:"listbox",id:"".concat(r,"_list"),style:{height:0,width:0,overflow:"hidden"}},z(F-1),z(F),z(F+1)),o.createElement(v.a,{itemKey:"key",ref:I,data:D,height:E,itemHeight:S,fullHeight:!1,onMouseDown:M,onScroll:L,virtual:x,onMouseEnter:R},(function(t,e){var i,r=t.group,n=t.groupOption,u=t.data,h=u.label,d=u.key;if(r)return o.createElement("div",{className:g()(_,"".concat(_,"-group"))},void 0!==h?h:d);var f=u.disabled,p=u.value,v=u.title,y=u.children,b=u.style,E=u.className,S=Object(c.a)(u,["disabled","value","title","children","style","className"]),C=a.has(p),k="".concat(_,"-option"),x=g()(_,k,E,(i={},Object(l.a)(i,"".concat(k,"-grouped"),n),Object(l.a)(i,"".concat(k,"-active"),F===e&&!f),Object(l.a)(i,"".concat(k,"-disabled"),f),Object(l.a)(i,"".concat(k,"-selected"),C),i)),T=s?y:h,O=!w||"function"==typeof w||C;return o.createElement("div",Object.assign({},S,{"aria-selected":C,className:x,title:v,onMouseMove:function(){F===e||f||G(e)},onClick:function(){f||H(p)},style:b}),o.createElement("div",{className:"".concat(k,"-content")},T||p),o.isValidElement(w)||C,O&&o.createElement(m.a,{className:"".concat(_,"-option-state"),customizeIcon:w,customizeIconProps:{isSelected:C}},C?"✓":null))})))}));y.displayName="OptionList";var b=y,E=function(){return null};E.isSelectOption=!0;var S=E,C=function(){return null};C.isSelectOptGroup=!0;var k=C,w=i("VTBJ"),x=i("Zm9Q");function T(t){var e=t.key,i=t.props,r=i.children,n=i.value,s=Object(c.a)(i,["children","value"]);return Object(w.a)({key:e,value:void 0!==n?n:e,children:r},s)}function O(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Object(x.a)(t).map((function(t,i){if(!o.isValidElement(t)||!t.type)return null;var r=t.type.isSelectOptGroup,n=t.key,s=t.props,a=s.children,l=Object(c.a)(s,["children"]);return e||!r?T(t):Object(w.a)(Object(w.a)({key:"__RC_SELECT_GRP__".concat(null===n?i:n,"__"),label:n},l),{},{options:O(a)})})).filter((function(t){return t}))}var A=i("2Qr1"),L=i("qNPg"),R=i("U8pU"),_=i("Kwbf"),D=i("WKfj");var I=function(t){var e=t.mode,i=t.options,r=t.children,n=t.backfill,s=t.allowClear,a=t.placeholder,l=t.getInputElement,c=t.showSearch,u=t.onSearch,h=t.defaultOpen,d=t.autoFocus,f=t.labelInValue,p=t.value,g=t.inputValue,v=t.optionLabelProp,m="multiple"===e||"tags"===e,y=void 0!==c?c:m||"combobox"===e,b=i||O(r);if(Object(_.a)("tags"!==e||b.every((function(t){return!t.disabled})),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),"tags"===e||"combobox"===e){var E=b.some((function(t){return t.options?t.options.some((function(t){return"number"==typeof("value"in t?t.value:t.key)})):"number"==typeof("value"in t?t.value:t.key)}));Object(_.a)(!E,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(_.a)("combobox"!==e||!v,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(_.a)("combobox"===e||!n,"`backfill` only works with `combobox` mode."),Object(_.a)("combobox"===e||!l,"`getInputElement` only work with `combobox` mode."),Object(_.b)("combobox"!==e||!l||!s||!a,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),u&&!y&&"combobox"!==e&&"tags"!==e&&Object(_.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(_.b)(!h||d,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),null!=p){var S=Object(D.d)(p);Object(_.a)(!f||S.every((function(t){return"object"===Object(R.a)(t)&&("key"in t||"value"in t)})),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(_.a)(!m||Array.isArray(p),"`value` should be array when `mode` is `multiple` or `tags`")}if(r){var C=null;Object(x.a)(r).some((function(t){if(!o.isValidElement(t)||!t.type)return!1;var e=t.type;return!e.isSelectOption&&(e.isSelectOptGroup?!Object(x.a)(t.props.children).every((function(e){return!(o.isValidElement(e)&&t.type&&!e.type.isSelectOption)||(C=e.type,!1)})):(C=e,!0))})),C&&Object(_.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(C.displayName||C.name||C,"`.")),Object(_.a)(void 0===g,"`inputValue` is deprecated, please use `searchValue` instead.")}},M=Object(L.a)({prefixCls:"rc-select",components:{optionList:b},convertChildrenToData:O,flattenOptions:A.d,getLabeledValue:A.e,filterOptions:A.b,isValueDisabled:A.g,findValueOption:A.c,warningProps:I,fillOptionsWithMissingValue:A.a}),P=function(t){Object(s.a)(i,t);var e=Object(a.a)(i);function i(){var t;return Object(r.a)(this,i),(t=e.apply(this,arguments)).selectRef=o.createRef(),t.focus=function(){t.selectRef.current.focus()},t.blur=function(){t.selectRef.current.blur()},t}return Object(n.a)(i,[{key:"render",value:function(){return o.createElement(M,Object.assign({ref:this.selectRef},this.props))}}]),i}(o.Component);P.Option=S,P.OptGroup=k;var N=P;e.c=N},NvD2:
/*!******************************************************!*\
!*** ./node_modules/rc-tree/es/utils/conductUtil.js ***!
\******************************************************/
/*! exports provided: isCheckDisabled, conductCheck */
/*! exports used: conductCheck */function(t,e,i){"use strict";i.d(e,"a",(function(){return a}));var r=i(/*! rc-util/es/warning */"Kwbf");function n(t,e){var i=new Set;return t.forEach((function(t){e.has(t)||i.add(t)})),i}function s(t){var e=t||{},i=e.disabled,r=e.disableCheckbox,n=e.checkable;return!(!i&&!r)||!1===n}function a(t,e,i,a){var o,l=[];o=a||s;var c=new Set(t.filter((function(t){var e=!!i[t];return e||l.push(t),e}))),u=new Map,h=0;return Object.keys(i).forEach((function(t){var e=i[t],r=e.level,n=u.get(r);n||(n=new Set,u.set(r,n)),n.add(e),h=Math.max(h,r)})),Object(r.a)(!l.length,"Tree missing follow keys: ".concat(l.slice(0,100).map((function(t){return"'".concat(t,"'")})).join(", "))),!0===e?function(t,e,i,r){for(var s=new Set(t),a=new Set,o=0;o<=i;o+=1){(e.get(o)||new Set).forEach((function(t){var e=t.key,i=t.node,n=t.children,a=void 0===n?[]:n;s.has(e)&&!r(i)&&a.filter((function(t){return!r(t.node)})).forEach((function(t){s.add(t.key)}))}))}for(var l=new Set,c=i;c>=0;c-=1){(e.get(c)||new Set).forEach((function(t){var e=t.parent,i=t.node;if(!r(i)&&t.parent&&!l.has(t.parent.key))if(r(t.parent.node))l.add(e.key);else{var n=!0,o=!1;(e.children||[]).filter((function(t){return!r(t.node)})).forEach((function(t){var e=t.key,i=s.has(e);n&&!i&&(n=!1),o||!i&&!a.has(e)||(o=!0)})),n&&s.add(e.key),o&&a.add(e.key),l.add(e.key)}}))}return{checkedKeys:Array.from(s),halfCheckedKeys:Array.from(n(a,s))}}(c,u,h,o):function(t,e,i,r,s){for(var a=new Set(t),o=new Set(e),l=0;l<=r;l+=1){(i.get(l)||new Set).forEach((function(t){var e=t.key,i=t.node,r=t.children,n=void 0===r?[]:r;a.has(e)||o.has(e)||s(i)||n.filter((function(t){return!s(t.node)})).forEach((function(t){a.delete(t.key)}))}))}o=new Set;for(var c=new Set,u=r;u>=0;u-=1){(i.get(u)||new Set).forEach((function(t){var e=t.parent,i=t.node;if(!s(i)&&t.parent&&!c.has(t.parent.key))if(s(t.parent.node))c.add(e.key);else{var r=!0,n=!1;(e.children||[]).filter((function(t){return!s(t.node)})).forEach((function(t){var e=t.key,i=a.has(e);r&&!i&&(r=!1),n||!i&&!o.has(e)||(n=!0)})),r||a.delete(e.key),n&&o.add(e.key),c.add(e.key)}}))}return{checkedKeys:Array.from(a),halfCheckedKeys:Array.from(n(o,a))}}(c,e.halfCheckedKeys,u,h,o)}},OZM5:
/*!*****************************************!*\
!*** ./node_modules/rc-tree/es/util.js ***!
\*****************************************/
/*! exports provided: arrDel, arrAdd, posToArr, getPosition, isTreeNode, getDragNodesKeys, calcDropPosition, calcSelectedKeys, convertDataToTree, parseCheckedKeys, conductExpandParent, getDataAndAria */
/*! exports used: arrAdd, arrDel, calcDropPosition, calcSelectedKeys, conductExpandParent, getDataAndAria, getDragNodesKeys, getPosition, isTreeNode, parseCheckedKeys, posToArr */function(t,e,i){"use strict";i.d(e,"b",(function(){return a})),i.d(e,"a",(function(){return o})),i.d(e,"k",(function(){return l})),i.d(e,"h",(function(){return c})),i.d(e,"i",(function(){return u})),i.d(e,"g",(function(){return h})),i.d(e,"c",(function(){return d})),i.d(e,"d",(function(){return f})),i.d(e,"j",(function(){return p})),i.d(e,"e",(function(){return g})),i.d(e,"f",(function(){return v}));var r=i(/*! @babel/runtime/helpers/esm/toConsumableArray */"KQm4"),n=i(/*! @babel/runtime/helpers/esm/typeof */"U8pU"),s=(i(/*! @babel/runtime/helpers/esm/objectWithoutProperties */"Ff2n"),i(/*! react */"q1tI"),i(/*! rc-util/es/warning */"Kwbf"));i(/*! ./TreeNode */"WaYH");function a(t,e){var i=t.slice(),r=i.indexOf(e);return r>=0&&i.splice(r,1),i}function o(t,e){var i=t.slice();return-1===i.indexOf(e)&&i.push(e),i}function l(t){return t.split("-")}function c(t,e){return"".concat(t,"-").concat(e)}function u(t){return t&&t.type&&t.type.isTreeNode}function h(t,e){var i=[t];return function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach((function(e){var r=e.key,n=e.children;i.push(r),t(n)}))}(e[t].children),i}function d(t,e){var i=t.clientY,r=e.selectHandle.getBoundingClientRect(),n=r.top,s=r.bottom,a=r.height,o=Math.max(.25*a,2);return i<=n+o?-1:i>=s-o?1:0}function f(t,e){if(t)return e.multiple?t.slice():t.length?[t[0]]:t}function p(t){if(!t)return null;var e;if(Array.isArray(t))e={checkedKeys:t,halfCheckedKeys:void 0};else{if("object"!==Object(n.a)(t))return Object(s.a)(!1,"`checkedKeys` is not an array or an object"),null;e={checkedKeys:t.checked||void 0,halfCheckedKeys:t.halfChecked||void 0}}return e}function g(t,e){var i=new Set;return(t||[]).forEach((function(t){!function t(r){if(!i.has(r)){var n=e[r];if(n){i.add(r);var s=n.parent;n.node.disabled||s&&t(s.key)}}}(t)})),Object(r.a)(i)}function v(t){var e={};return Object.keys(t).forEach((function(i){(i.startsWith("data-")||i.startsWith("aria-"))&&(e[i]=t[i])})),e}},"SA+Z":
/*!********************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/toArray.js ***!
\********************************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,i){var r=i(/*! ./arrayWithHoles.js */"wTVA"),n=i(/*! ./iterableToArray.js */"EbDI"),s=i(/*! ./unsupportedIterableToArray.js */"ZhPi"),a=i(/*! ./nonIterableRest.js */"wkBT");t.exports=function(t){return r(t)||n(t)||s(t)||a()},t.exports.__esModule=!0,t.exports.default=t.exports},SJMd:
/*!****************************************************!*\
!*** ./node_modules/code-prettify/src/prettify.js ***!
\****************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e){window.PR_SHOULD_USE_CONTINUATION=!0,function(){var t=window,e=["break,continue,do,else,for,if,return,while"],i=[[e,"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"],"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],r=[i,"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"],n=[i,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],s=[i,"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"],a=[i,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],o="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",l=[e,"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"],c=[e,"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"],u=[e,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],h=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/;function d(t,e,i,r,n){if(i){var s={sourceNode:t,pre:1,langExtension:null,numberLines:null,sourceCode:i,spans:null,basePos:e,decorations:null};r(s),n.push.apply(n,s.decorations)}}var f=/\S/;function p(t){for(var e=void 0,i=t.firstChild;i;i=i.nextSibling){var r=i.nodeType;e=1===r?e?t:i:3===r&&f.test(i.nodeValue)?t:e}return e===t?void 0:e}function g(t,e){var i,r={};!function(){for(var n=t.concat(e),s=[],a={},o=0,l=n.length;o<l;++o){var c=n[o],u=c[3];if(u)for(var h=u.length;--h>=0;)r[u.charAt(h)]=c;var d=c[1],f=""+d;a.hasOwnProperty(f)||(s.push(d),a[f]=null)}s.push(/[\0-\uffff]/),i=function(t){for(var e=0,i=!1,r=!1,n=0,s=t.length;n<s;++n){if((d=t[n]).ignoreCase)r=!0;else if(/[a-z]/i.test(d.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){i=!0,r=!1;break}}var a={b:8,t:9,n:10,v:11,f:12,r:13};function o(t){var e=t.charCodeAt(0);if(92!==e)return e;var i=t.charAt(1);return(e=a[i])||("0"<=i&&i<="7"?parseInt(t.substring(1),8):"u"===i||"x"===i?parseInt(t.substring(2),16):t.charCodeAt(1))}function l(t){if(t<32)return(t<16?"\\x0":"\\x")+t.toString(16);var e=String.fromCharCode(t);return"\\"===e||"-"===e||"]"===e||"^"===e?"\\"+e:e}function c(t){var e=t.substring(1,t.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")),i=[],r="^"===e[0],n=["["];r&&n.push("^");for(var s=r?1:0,a=e.length;s<a;++s){var c=e[s];if(/\\[bdsw]/i.test(c))n.push(c);else{var u,h=o(c);s+2<a&&"-"===e[s+1]?(u=o(e[s+2]),s+=2):u=h,i.push([h,u]),u<65||h>122||(u<65||h>90||i.push([32|Math.max(65,h),32|Math.min(u,90)]),u<97||h>122||i.push([-33&Math.max(97,h),-33&Math.min(u,122)]))}}i.sort((function(t,e){return t[0]-e[0]||e[1]-t[1]}));var d=[],f=[];for(s=0;s<i.length;++s){(p=i[s])[0]<=f[1]+1?f[1]=Math.max(f[1],p[1]):d.push(f=p)}for(s=0;s<d.length;++s){var p=d[s];n.push(l(p[0])),p[1]>p[0]&&(p[1]+1>p[0]&&n.push("-"),n.push(l(p[1])))}return n.push("]"),n.join("")}function u(t){for(var r=t.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")),n=r.length,s=[],a=0,o=0;a<n;++a){if("("===(h=r[a]))++o;else if("\\"===h.charAt(0)){(u=+h.substring(1))&&(u<=o?s[u]=-1:r[a]=l(u))}}for(a=1;a<s.length;++a)-1===s[a]&&(s[a]=++e);for(a=0,o=0;a<n;++a){if("("===(h=r[a]))s[++o]||(r[a]="(?:");else if("\\"===h.charAt(0)){var u;(u=+h.substring(1))&&u<=o&&(r[a]="\\"+s[u])}}for(a=0;a<n;++a)"^"===r[a]&&"^"!==r[a+1]&&(r[a]="");if(t.ignoreCase&&i)for(a=0;a<n;++a){var h,d=(h=r[a]).charAt(0);h.length>=2&&"["===d?r[a]=c(h):"\\"!==d&&(r[a]=h.replace(/[a-zA-Z]/g,(function(t){var e=t.charCodeAt(0);return"["+String.fromCharCode(-33&e,32|e)+"]"})))}return r.join("")}var h=[];for(n=0,s=t.length;n<s;++n){var d;if((d=t[n]).global||d.multiline)throw new Error(""+d);h.push("(?:"+u(d)+")")}return new RegExp(h.join("|"),r?"gi":"g")}(s)}();var n=e.length,s=function(t){for(var a=t.sourceCode,o=t.basePos,l=t.sourceNode,c=[o,"pln"],u=0,h=a.match(i)||[],f={},p=0,g=h.length;p<g;++p){var v,m=h[p],y=f[m],b=void 0;if("string"==typeof y)v=!1;else{var E=r[m.charAt(0)];if(E)b=m.match(E[1]),y=E[0];else{for(var C=0;C<n;++C)if(E=e[C],b=m.match(E[1])){y=E[0];break}b||(y="pln")}!(v=y.length>=5&&"lang-"===y.substring(0,5))||b&&"string"==typeof b[1]||(v=!1,y="src"),v||(f[m]=y)}var k=u;if(u+=m.length,v){var w=b[1],x=m.indexOf(w),T=x+w.length;b[2]&&(x=(T=m.length-b[2].length)-w.length);var O=y.substring(5);d(l,o+k,m.substring(0,x),s,c),d(l,o+k+x,w,S(O,w),c),d(l,o+k+T,m.substring(T),s,c)}else c.push(o+k,y)}t.decorations=c};return s}function v(t){var e=[],i=[];t.tripleQuotedStrings?e.push(["str",/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""]):t.multiLineStrings?e.push(["str",/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):e.push(["str",/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"]),t.verbatimStrings&&i.push(["str",/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var r=t.hashComments;r&&(t.cStyleComments?(r>1?e.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):e.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),i.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):e.push(["com",/^#[^\r\n]*/,null,"#"])),t.cStyleComments&&(i.push(["com",/^\/\/[^\r\n]*/,null]),i.push(["com",/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var n=t.regexLiterals;if(n){var s=n>1?"":"\n\r",a=s?".":"[\\S\\s]",o="/(?=[^/*"+s+"])(?:[^/\\x5B\\x5C"+s+"]|\\x5C"+a+"|\\x5B(?:[^\\x5C\\x5D"+s+"]|\\x5C"+a+")*(?:\\x5D|$))+/";i.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+o+")")])}var l=t.types;l&&i.push(["typ",l]);var c=(""+t.keywords).replace(/^ | $/g,"");c.length&&i.push(["kwd",new RegExp("^(?:"+c.replace(/[\s,]+/g,"|")+")\\b"),null]),e.push(["pln",/^\s+/,null," \r\n\t "]);var u="^.[^\\s\\w.$@'\"`/\\\\]*";return t.regexLiterals&&(u+="(?!s*/)"),i.push(["lit",/^@[a-z_$][a-z_$@0-9]*/i,null],["typ",/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],["pln",/^[a-z_$][a-z_$@0-9]*/i,null],["lit",new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],["pln",/^\\[\s\S]?/,null],["pun",new RegExp(u),null]),g(e,i)}var m=v({keywords:[r,s,n,a,o,l,c,u],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function y(t,e,i){for(var r=/(?:^|\s)nocode(?:\s|$)/,n=/\r\n?|\n/,s=t.ownerDocument,a=s.createElement("li");t.firstChild;)a.appendChild(t.firstChild);var o=[a];function l(t){var e=t.nodeType;if(1!=e||r.test(t.className)){if((3==e||4==e)&&i){var a=t.nodeValue,o=a.match(n);if(o){var u=a.substring(0,o.index);t.nodeValue=u;var h=a.substring(o.index+o[0].length);if(h)t.parentNode.insertBefore(s.createTextNode(h),t.nextSibling);c(t),u||t.parentNode.removeChild(t)}}}else if("br"===t.nodeName)c(t),t.parentNode&&t.parentNode.removeChild(t);else for(var d=t.firstChild;d;d=d.nextSibling)l(d)}function c(t){for(;!t.nextSibling;)if(!(t=t.parentNode))return;for(var e,i=function t(e,i){var r=i?e.cloneNode(!1):e,n=e.parentNode;if(n){var s=t(n,1),a=e.nextSibling;s.appendChild(r);for(var o=a;o;o=a)a=o.nextSibling,s.appendChild(o)}return r}(t.nextSibling,0);(e=i.parentNode)&&1===e.nodeType;)i=e;o.push(i)}for(var u=0;u<o.length;++u)l(o[u]);e===(0|e)&&o[0].setAttribute("value",e);var h=s.createElement("ol");h.className="linenums";for(var d=Math.max(0,e-1|0)||0,f=(u=0,o.length);u<f;++u)(a=o[u]).className="L"+(u+d)%10,a.firstChild||a.appendChild(s.createTextNode(" ")),h.appendChild(a);t.appendChild(h)}var b={};function E(e,i){for(var r=i.length;--r>=0;){var n=i[r];b.hasOwnProperty(n)?t.console&&console.warn("cannot override language handler %s",n):b[n]=e}}function S(t,e){return t&&b.hasOwnProperty(t)||(t=/^\s*</.test(e)?"default-markup":"default-code"),b[t]}function C(e){var i,r,n,s,a,o,l,c=e.langExtension;try{var u=(i=e.sourceNode,r=e.pre,n=/(?:^|\s)nocode(?:\s|$)/,s=[],a=0,o=[],l=0,function t(e){var i=e.nodeType;if(1==i){if(n.test(e.className))return;for(var c=e.firstChild;c;c=c.nextSibling)t(c);var u=e.nodeName.toLowerCase();"br"!==u&&"li"!==u||(s[l]="\n",o[l<<1]=a++,o[l++<<1|1]=e)}else if(3==i||4==i){var h=e.nodeValue;h.length&&(h=r?h.replace(/\r\n?/g,"\n"):h.replace(/[ \t\r\n]+/g," "),s[l]=h,o[l<<1]=a,a+=h.length,o[l++<<1|1]=e)}}(i),{sourceCode:s.join("").replace(/\n$/,""),spans:o}),h=u.sourceCode;e.sourceCode=h,e.spans=u.spans,e.basePos=0,S(c,h)(e),function(t){var e=/\bMSIE\s(\d+)/.exec(navigator.userAgent);e=e&&+e[1]<=8;var i,r,n=/\n/g,s=t.sourceCode,a=s.length,o=0,l=t.spans,c=l.length,u=0,h=t.decorations,d=h.length,f=0;for(h[d]=a,r=i=0;r<d;)h[r]!==h[r+2]?(h[i++]=h[r++],h[i++]=h[r++]):r+=2;for(d=i,r=i=0;r<d;){for(var p=h[r],g=h[r+1],v=r+2;v+2<=d&&h[v+1]===g;)v+=2;h[i++]=p,h[i++]=g,r=v}d=h.length=i;var m=t.sourceNode,y="";m&&(y=m.style.display,m.style.display="none");try{for(;u<c;){l[u];var b,E=l[u+2]||a,S=h[f+2]||a,C=(v=Math.min(E,S),l[u+1]);if(1!==C.nodeType&&(b=s.substring(o,v))){e&&(b=b.replace(n,"\r")),C.nodeValue=b;var k=C.ownerDocument,w=k.createElement("span");w.className=h[f+1];var x=C.parentNode;x.replaceChild(w,C),w.appendChild(C),o<E&&(l[u+1]=C=k.createTextNode(s.substring(v,E)),x.insertBefore(C,w.nextSibling))}(o=v)>=E&&(u+=2),o>=S&&(f+=2)}}finally{m&&(m.style.display=y)}}(e)}catch(e){t.console&&console.log(e&&e.stack||e)}}function k(t,e,i){var r=i||!1,n=e||null,s=document.createElement("div");return s.innerHTML="<pre>"+t+"</pre>",s=s.firstChild,r&&y(s,r,!0),C({langExtension:n,numberLines:r,sourceNode:s,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null}),s.innerHTML}function w(e,i){var r=i||document.body,n=r.ownerDocument||document;function s(t){return r.getElementsByTagName(t)}for(var a=[s("pre"),s("code"),s("xmp")],o=[],l=0;l<a.length;++l)for(var c=0,u=a[l].length;c<u;++c)o.push(a[l][c]);a=null;var h=Date;h.now||(h={now:function(){return+new Date}});var d=0,f=/\blang(?:uage)?-([\w.]+)(?!\S)/,g=/\bprettyprint\b/,v=/\bprettyprinted\b/,m=/pre|xmp/i,b=/^code$/i,E=/^(?:pre|code|xmp)$/i,S={};!function i(){for(var r=t.PR_SHOULD_USE_CONTINUATION?h.now()+250:1/0;d<o.length&&h.now()<r;d++){for(var s=o[d],a=S,l=s;l=l.previousSibling;){var c=l.nodeType,u=(7===c||8===c)&&l.nodeValue;if(u?!/^\??prettify\b/.test(u):3!==c||/\S/.test(l.nodeValue))break;if(u){a={},u.replace(/\b(\w+)=([\w:.%+-]+)/g,(function(t,e,i){a[e]=i}));break}}var k=s.className;if((a!==S||g.test(k))&&!v.test(k)){for(var w=!1,x=s.parentNode;x;x=x.parentNode){var T=x.tagName;if(E.test(T)&&x.className&&g.test(x.className)){w=!0;break}}if(!w){s.className+=" prettyprinted";var O,A,L=a.lang;if(!L)!(L=k.match(f))&&(O=p(s))&&b.test(O.tagName)&&(L=O.className.match(f)),L&&(L=L[1]);if(m.test(s.tagName))A=1;else{var R=s.currentStyle,_=n.defaultView,D=R?R.whiteSpace:_&&_.getComputedStyle?_.getComputedStyle(s,null).getPropertyValue("white-space"):0;A=D&&"pre"===D.substring(0,3)}var I=a.linenums;(I="true"===I||+I)||(I=!!(I=k.match(/\blinenums\b(?::(\d+))?/))&&(!I[1]||!I[1].length||+I[1])),I&&y(s,I,A),C({langExtension:L,sourceNode:s,numberLines:I,pre:A,sourceCode:null,basePos:null,spans:null,decorations:null})}}}d<o.length?t.setTimeout(i,250):"function"==typeof e&&e()}()}E(m,["default-code"]),E(g([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["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"]),E(g([["pln",/^[\s]+/,null," \t\r\n"],["atv",/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],["pun",/^[=<>\/]+/],["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"]),E(g([],[["atv",/^[\s\S]+/]]),["uq.val"]),E(v({keywords:r,hashComments:!0,cStyleComments:!0,types:h}),["c","cc","cpp","cxx","cyc","m"]),E(v({keywords:"null,true,false"}),["json"]),E(v({keywords:s,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:h}),["cs"]),E(v({keywords:n,cStyleComments:!0}),["java"]),E(v({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),E(v({keywords:l,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),E(v({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),E(v({keywords:c,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),E(v({keywords:a,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),E(v({keywords:"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",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),E(g([],[["str",/^[\s\S]+/]]),["regex"]);var x=t.PR={createSimpleLexer:g,registerLangHandler:E,sourceDecorator:v,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:k,prettyPrint:w},T=t.define;"function"==typeof T&&T.amd&&T("google-code-prettify",[],(function(){return x}))}()},WaYH:
/*!*********************************************************!*\
!*** ./node_modules/rc-tree/es/TreeNode.js + 1 modules ***!
\*********************************************************/
/*! exports provided: InternalTreeNode, default */
/*! exports used: default */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createSuper.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/contextTypes.js because of ./node_modules/rc-tree/es/Tree.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/util.js because of ./node_modules/antd/es/table/hooks/useSelection.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tree/es/utils/treeUtil.js because of ./node_modules/antd/es/table/hooks/useSelection.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(t,e,i){"use strict";var r=i("rePB"),n=i("Ff2n"),s=i("VTBJ"),a=i("1OyB"),o=i("vuIU"),l=i("JX7q"),c=i("Ji7U"),u=i("LK+K"),h=i("q1tI"),d=i("TSYQ"),f=i.n(d),p=i("sboe"),g=i("OZM5"),v=function(t){var e=t.prefixCls,i=t.level,n=t.isStart,s=t.isEnd;if(!i)return null;for(var a="".concat(e,"-indent-unit"),o=[],l=0;l<i;l+=1){var c;o.push(h.createElement("span",{key:l,className:f()(a,(c={},Object(r.a)(c,"".concat(a,"-start"),n[l+1]),Object(r.a)(c,"".concat(a,"-end"),s[l+1]),Object(r.a)(c,"".concat(a,"-end-first-level"),!l&&s[0]),c))}))}return h.createElement("span",{"aria-hidden":"true",className:"".concat(e,"-indent")},o)},m=i("815F"),y=function(t){Object(c.a)(i,t);var e=Object(u.a)(i);function i(){var t;return Object(a.a)(this,i),(t=e.apply(this,arguments)).state={dragNodeHighlight:!1},t.onSelectorClick=function(e){(0,t.props.context.onNodeClick)(e,Object(m.b)(t.props)),t.isSelectable()?t.onSelect(e):t.onCheck(e)},t.onSelectorDoubleClick=function(e){(0,t.props.context.onNodeDoubleClick)(e,Object(m.b)(t.props))},t.onSelect=function(e){if(!t.isDisabled()){var i=t.props.context.onNodeSelect;e.preventDefault(),i(e,Object(m.b)(t.props))}},t.onCheck=function(e){if(!t.isDisabled()){var i=t.props,r=i.disableCheckbox,n=i.checked,s=t.props.context.onNodeCheck;if(t.isCheckable()&&!r){e.preventDefault();var a=!n;s(e,Object(m.b)(t.props),a)}}},t.onMouseEnter=function(e){(0,t.props.context.onNodeMouseEnter)(e,Object(m.b)(t.props))},t.onMouseLeave=function(e){(0,t.props.context.onNodeMouseLeave)(e,Object(m.b)(t.props))},t.onContextMenu=function(e){(0,t.props.context.onNodeContextMenu)(e,Object(m.b)(t.props))},t.onDragStart=function(e){var i=t.props.context.onNodeDragStart;e.stopPropagation(),t.setState({dragNodeHighlight:!0}),i(e,Object(l.a)(t));try{e.dataTransfer.setData("text/plain","")}catch(t){}},t.onDragEnter=function(e){var i=t.props.context.onNodeDragEnter;e.preventDefault(),e.stopPropagation(),i(e,Object(l.a)(t))},t.onDragOver=function(e){var i=t.props.context.onNodeDragOver;e.preventDefault(),e.stopPropagation(),i(e,Object(l.a)(t))},t.onDragLeave=function(e){var i=t.props.context.onNodeDragLeave;e.stopPropagation(),i(e,Object(l.a)(t))},t.onDragEnd=function(e){var i=t.props.context.onNodeDragEnd;e.stopPropagation(),t.setState({dragNodeHighlight:!1}),i(e,Object(l.a)(t))},t.onDrop=function(e){var i=t.props.context.onNodeDrop;e.preventDefault(),e.stopPropagation(),t.setState({dragNodeHighlight:!1}),i(e,Object(l.a)(t))},t.onExpand=function(e){(0,t.props.context.onNodeExpand)(e,Object(m.b)(t.props))},t.setSelectHandle=function(e){t.selectHandle=e},t.getNodeState=function(){var e=t.props.expanded;return t.isLeaf()?null:e?"open":"close"},t.hasChildren=function(){var e=t.props.eventKey;return!!((t.props.context.keyEntities[e]||{}).children||[]).length},t.isLeaf=function(){var e=t.props,i=e.isLeaf,r=e.loaded,n=t.props.context.loadData,s=t.hasChildren();return!1!==i&&(i||!n&&!s||n&&r&&!s)},t.isDisabled=function(){var e=t.props.disabled;return!(!t.props.context.disabled&&!e)},t.isCheckable=function(){var e=t.props.checkable,i=t.props.context.checkable;return!(!i||!1===e)&&i},t.syncLoadData=function(e){var i=e.expanded,r=e.loading,n=e.loaded,s=t.props.context,a=s.loadData,o=s.onNodeLoad;r||a&&i&&!t.isLeaf()&&(t.hasChildren()||n||o(Object(m.b)(t.props)))},t.renderSwitcher=function(){var e=t.props,i=e.expanded,r=e.switcherIcon,n=t.props.context,a=n.prefixCls,o=n.switcherIcon,l=r||o;if(t.isLeaf())return h.createElement("span",{className:f()("".concat(a,"-switcher"),"".concat(a,"-switcher-noop"))},"function"==typeof l?l(Object(s.a)(Object(s.a)({},t.props),{},{isLeaf:!0})):l);var c=f()("".concat(a,"-switcher"),"".concat(a,"-switcher_").concat(i?"open":"close"));return h.createElement("span",{onClick:t.onExpand,className:c},"function"==typeof l?l(Object(s.a)(Object(s.a)({},t.props),{},{isLeaf:!1})):l)},t.renderCheckbox=function(){var e=t.props,i=e.checked,r=e.halfChecked,n=e.disableCheckbox,s=t.props.context.prefixCls,a=t.isDisabled(),o=t.isCheckable();if(!o)return null;var l="boolean"!=typeof o?o:null;return h.createElement("span",{className:f()("".concat(s,"-checkbox"),i&&"".concat(s,"-checkbox-checked"),!i&&r&&"".concat(s,"-checkbox-indeterminate"),(a||n)&&"".concat(s,"-checkbox-disabled")),onClick:t.onCheck},l)},t.renderIcon=function(){var e=t.props.loading,i=t.props.context.prefixCls;return h.createElement("span",{className:f()("".concat(i,"-iconEle"),"".concat(i,"-icon__").concat(t.getNodeState()||"docu"),e&&"".concat(i,"-icon_loading"))})},t.renderSelector=function(){var e,i,r=t.state.dragNodeHighlight,n=t.props,s=n.title,a=n.selected,o=n.icon,l=n.loading,c=n.data,u=t.props.context,d=u.prefixCls,p=u.showIcon,g=u.icon,v=u.draggable,m=u.loadData,y=u.titleRender,b=t.isDisabled(),E="".concat(d,"-node-content-wrapper");if(p){var S=o||g;e=S?h.createElement("span",{className:f()("".concat(d,"-iconEle"),"".concat(d,"-icon__customize"))},"function"==typeof S?S(t.props):S):t.renderIcon()}else m&&l&&(e=t.renderIcon());i="function"==typeof s?s(c):y?y(c):s;var C=h.createElement("span",{className:"".concat(d,"-title")},i);return h.createElement("span",{ref:t.setSelectHandle,title:"string"==typeof s?s:"",className:f()("".concat(E),"".concat(E,"-").concat(t.getNodeState()||"normal"),!b&&(a||r)&&"".concat(d,"-node-selected"),!b&&v&&"draggable"),draggable:!b&&v||void 0,"aria-grabbed":!b&&v||void 0,onMouseEnter:t.onMouseEnter,onMouseLeave:t.onMouseLeave,onContextMenu:t.onContextMenu,onClick:t.onSelectorClick,onDoubleClick:t.onSelectorDoubleClick,onDragStart:v?t.onDragStart:void 0},e,C)},t}return Object(o.a)(i,[{key:"componentDidMount",value:function(){this.syncLoadData(this.props)}},{key:"componentDidUpdate",value:function(){this.syncLoadData(this.props)}},{key:"isSelectable",value:function(){var t=this.props.selectable,e=this.props.context.selectable;return"boolean"==typeof t?t:e}},{key:"render",value:function(){var t,e=this.props,i=e.eventKey,s=e.className,a=e.style,o=e.dragOver,l=e.dragOverGapTop,c=e.dragOverGapBottom,u=e.isLeaf,d=e.isStart,p=e.isEnd,y=e.expanded,b=e.selected,E=e.checked,S=e.halfChecked,C=e.loading,k=e.domRef,w=e.active,x=e.onMouseMove,T=Object(n.a)(e,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),O=this.props.context,A=O.prefixCls,L=O.filterTreeNode,R=O.draggable,_=O.keyEntities,D=this.isDisabled(),I=Object(g.f)(T),M=(_[i]||{}).level,P=p[p.length-1];return h.createElement("div",Object.assign({ref:k,className:f()(s,"".concat(A,"-treenode"),(t={},Object(r.a)(t,"".concat(A,"-treenode-disabled"),D),Object(r.a)(t,"".concat(A,"-treenode-switcher-").concat(y?"open":"close"),!u),Object(r.a)(t,"".concat(A,"-treenode-checkbox-checked"),E),Object(r.a)(t,"".concat(A,"-treenode-checkbox-indeterminate"),S),Object(r.a)(t,"".concat(A,"-treenode-selected"),b),Object(r.a)(t,"".concat(A,"-treenode-loading"),C),Object(r.a)(t,"".concat(A,"-treenode-active"),w),Object(r.a)(t,"".concat(A,"-treenode-leaf-last"),P),Object(r.a)(t,"drag-over",!D&&o),Object(r.a)(t,"drag-over-gap-top",!D&&l),Object(r.a)(t,"drag-over-gap-bottom",!D&&c),Object(r.a)(t,"filter-node",L&&L(Object(m.b)(this.props))),t)),style:a,onDragEnter:R?this.onDragEnter:void 0,onDragOver:R?this.onDragOver:void 0,onDragLeave:R?this.onDragLeave:void 0,onDrop:R?this.onDrop:void 0,onDragEnd:R?this.onDragEnd:void 0,onMouseMove:x},I),h.createElement(v,{prefixCls:A,level:M,isStart:d,isEnd:p}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),i}(h.Component),b=function(t){return h.createElement(p.a.Consumer,null,(function(e){return h.createElement(y,Object.assign({},t,{context:e}))}))};b.displayName="TreeNode",b.defaultProps={title:"---"},b.isTreeNode=1;e.a=b},Y1PL:
/*!**********************************************************!*\
!*** ./node_modules/rc-textarea/es/index.js + 7 modules ***!
\**********************************************************/
/*! exports provided: ResizableTextArea, default */
/*! all exports used */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createSuper.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/extends.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Children/toArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Dom/findDOMNode.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/omit.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/ref.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/warning.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js (<- Module uses injected variables (global)) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/shallowequal/index.js (<- Module is not an ECMAScript module) */function(t,e,i){"use strict";i.r(e),i.d(e,"ResizableTextArea",(function(){return I}));var r=i("wx14"),n=i("1OyB"),s=i("vuIU"),a=i("Ji7U"),o=i("LK+K"),l=i("q1tI"),c=i("VTBJ"),u=i("rePB"),h=i("Zm9Q"),d=(i("Kwbf"),i("c+Xe")),f=i("m+aA"),p=i("bdgK"),g=new Map;var v=new p.default((function(t){t.forEach((function(t){var e,i=t.target;null===(e=g.get(i))||void 0===e||e.forEach((function(t){return t(i)}))}))}));var m=function(t){Object(a.a)(i,t);var e=Object(o.a)(i);function i(){return Object(n.a)(this,i),e.apply(this,arguments)}return Object(s.a)(i,[{key:"render",value:function(){return this.props.children}}]),i}(l.Component),y=l.createContext(null);function b(t){var e=t.children,i=t.disabled,r=l.useRef(null),n=l.useRef(null),s=l.useContext(y),a=l.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),o=l.isValidElement(e)&&Object(d.c)(e),u=o?e.ref:null,h=l.useMemo((function(){return Object(d.a)(u,r)}),[u,r]),p=l.useRef(t);p.current=t;var b=l.useCallback((function(t){var e=p.current,i=e.onResize,r=e.data,n=t.getBoundingClientRect(),o=n.width,l=n.height,u=t.offsetWidth,h=t.offsetHeight,d=Math.floor(o),f=Math.floor(l);if(a.current.width!==d||a.current.height!==f||a.current.offsetWidth!==u||a.current.offsetHeight!==h){var g={width:d,height:f,offsetWidth:u,offsetHeight:h};a.current=g;var v=u===Math.round(o)?o:u,m=h===Math.round(l)?l:h,y=Object(c.a)(Object(c.a)({},g),{},{offsetWidth:v,offsetHeight:m});null==s||s(y,t,r),i&&Promise.resolve().then((function(){i(y,t)}))}}),[]);return l.useEffect((function(){var t,e,s=Object(f.a)(r.current)||Object(f.a)(n.current);return s&&!i&&(t=s,e=b,g.has(t)||(g.set(t,new Set),v.observe(t)),g.get(t).add(e)),function(){return function(t,e){g.has(t)&&(g.get(t).delete(e),g.get(t).size||(v.unobserve(t),g.delete(t)))}(s,b)}}),[r.current,i]),l.createElement(m,{ref:n},o?l.cloneElement(e,{ref:h}):e)}function E(t){var e=t.children;return Object(h.a)(e).map((function(e,i){var n=(null==e?void 0:e.key)||"".concat("rc-observer-key","-").concat(i);return l.createElement(b,Object(r.a)({},t,{key:n}),e)}))}E.Collection=function(t){var e=t.children,i=t.onBatchResize,r=l.useRef(0),n=l.useRef([]),s=l.useContext(y),a=l.useCallback((function(t,e,a){r.current+=1;var o=r.current;n.current.push({size:t,element:e,data:a}),Promise.resolve().then((function(){o===r.current&&(null==i||i(n.current),n.current=[])})),null==s||s(t,e,a)}),[i,s]);return l.createElement(y.Provider,{value:a},e)};var S,C=E,k=i("bT9E"),w=i("TSYQ"),x=i.n(w),T="\n min-height:0 !important;\n max-height:none !important;\n height:0 !important;\n visibility:hidden !important;\n overflow:hidden !important;\n position:absolute !important;\n z-index:-1000 !important;\n top:0 !important;\n right:0 !important\n",O=["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"],A={};function L(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=t.getAttribute("id")||t.getAttribute("data-reactid")||t.getAttribute("name");if(e&&A[i])return A[i];var r=window.getComputedStyle(t),n=r.getPropertyValue("box-sizing")||r.getPropertyValue("-moz-box-sizing")||r.getPropertyValue("-webkit-box-sizing"),s=parseFloat(r.getPropertyValue("padding-bottom"))+parseFloat(r.getPropertyValue("padding-top")),a=parseFloat(r.getPropertyValue("border-bottom-width"))+parseFloat(r.getPropertyValue("border-top-width")),o=O.map((function(t){return"".concat(t,":").concat(r.getPropertyValue(t))})).join(";"),l={sizingStyle:o,paddingSize:s,borderSize:a,boxSizing:n};return e&&i&&(A[i]=l),l}var R,_=i("Gytx"),D=i.n(_);!function(t){t[t.NONE=0]="NONE",t[t.RESIZING=1]="RESIZING",t[t.RESIZED=2]="RESIZED"}(R||(R={}));var I=function(t){Object(a.a)(i,t);var e=Object(o.a)(i);function i(t){var s;return Object(n.a)(this,i),(s=e.call(this,t)).nextFrameActionId=void 0,s.resizeFrameId=void 0,s.textArea=void 0,s.saveTextArea=function(t){s.textArea=t},s.handleResize=function(t){var e=s.state.resizeStatus,i=s.props,r=i.autoSize,n=i.onResize;e===R.NONE&&("function"==typeof n&&n(t),r&&s.resizeOnNextFrame())},s.resizeOnNextFrame=function(){cancelAnimationFrame(s.nextFrameActionId),s.nextFrameActionId=requestAnimationFrame(s.resizeTextarea)},s.resizeTextarea=function(){var t=s.props.autoSize;if(t&&s.textArea){var e=t.minRows,i=t.maxRows,r=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;S||((S=document.createElement("textarea")).setAttribute("tab-index","-1"),S.setAttribute("aria-hidden","true"),document.body.appendChild(S)),t.getAttribute("wrap")?S.setAttribute("wrap",t.getAttribute("wrap")):S.removeAttribute("wrap");var n=L(t,e),s=n.paddingSize,a=n.borderSize,o=n.boxSizing,l=n.sizingStyle;S.setAttribute("style","".concat(l,";").concat(T)),S.value=t.value||t.placeholder||"";var c,u=Number.MIN_SAFE_INTEGER,h=Number.MAX_SAFE_INTEGER,d=S.scrollHeight;if("border-box"===o?d+=a:"content-box"===o&&(d-=s),null!==i||null!==r){S.value=" ";var f=S.scrollHeight-s;null!==i&&(u=f*i,"border-box"===o&&(u=u+s+a),d=Math.max(u,d)),null!==r&&(h=f*r,"border-box"===o&&(h=h+s+a),c=d>h?"":"hidden",d=Math.min(h,d))}return{height:d,minHeight:u,maxHeight:h,overflowY:c,resize:"none"}}(s.textArea,!1,e,i);s.setState({textareaStyles:r,resizeStatus:R.RESIZING},(function(){cancelAnimationFrame(s.resizeFrameId),s.resizeFrameId=requestAnimationFrame((function(){s.setState({resizeStatus:R.RESIZED},(function(){s.resizeFrameId=requestAnimationFrame((function(){s.setState({resizeStatus:R.NONE}),s.fixFirefoxAutoScroll()}))}))}))}))}},s.renderTextArea=function(){var t=s.props,e=t.prefixCls,i=void 0===e?"rc-textarea":e,n=t.autoSize,a=t.onResize,o=t.className,h=t.disabled,d=s.state,f=d.textareaStyles,p=d.resizeStatus,g=Object(k.a)(s.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),v=x()(i,o,Object(u.a)({},"".concat(i,"-disabled"),h));"value"in g&&(g.value=g.value||"");var m=Object(c.a)(Object(c.a)(Object(c.a)({},s.props.style),f),p===R.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return l.createElement(C,{onResize:s.handleResize,disabled:!(n||a)},l.createElement("textarea",Object(r.a)({},g,{className:v,style:m,ref:s.saveTextArea})))},s.state={textareaStyles:{},resizeStatus:R.NONE},s}return Object(s.a)(i,[{key:"componentDidUpdate",value:function(t){t.value===this.props.value&&D()(t.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 t=this.textArea.selectionStart,e=this.textArea.selectionEnd;this.textArea.setSelectionRange(t,e)}}catch(t){}}},{key:"render",value:function(){return this.renderTextArea()}}]),i}(l.Component),M=function(t){Object(a.a)(i,t);var e=Object(o.a)(i);function i(t){var r;Object(n.a)(this,i),(r=e.call(this,t)).resizableTextArea=void 0,r.focus=function(){r.resizableTextArea.textArea.focus()},r.saveTextArea=function(t){r.resizableTextArea=t},r.handleChange=function(t){var e=r.props.onChange;r.setValue(t.target.value,(function(){r.resizableTextArea.resizeTextarea()})),e&&e(t)},r.handleKeyDown=function(t){var e=r.props,i=e.onPressEnter,n=e.onKeyDown;13===t.keyCode&&i&&i(t),n&&n(t)};var s=void 0===t.value||null===t.value?t.defaultValue:t.value;return r.state={value:s},r}return Object(s.a)(i,[{key:"setValue",value:function(t,e){"value"in this.props||this.setState({value:t},e)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return l.createElement(I,Object(r.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(t){return"value"in t?{value:t.value}:null}}]),i}(l.Component);e.default=M},ZW9T:
/*!************************************************************!*\
!*** ./src/components/monaco-editor/index.jsx + 1 modules ***!
\************************************************************/
/*! exports provided: getLanguageByMirrorName, default, DiffEditor */
/*! exports used: DiffEditor, default */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js (<- Module uses injected variables (global)) */function(t,e,i){"use strict";i.d(e,"a",(function(){return m}));var r=i("k1fw"),n=(i("miYZ"),i("tsqr")),s=i("rAM+"),a=i("tJVT"),o=i("PpiC"),l=i("q1tI"),c=i.n(l),u=i("bdgK");function h(t,e,i,n,s){var a=e.getWordUntilPosition(i),o={startLineNumber:i.lineNumber,endLineNumber:i.lineNumber,startColumn:a.startColumn,endColumn:a.endColumn},l=n.map((function(e){return{label:e,kind:t.languages.CompletionItemKind.Keyword,insertText:e,insertTextRules:t.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:o}}));return s.map((function(t){l.push(Object(r.a)(Object(r.a)({},t),{},{range:o}))})),l}i("LvDl");function d(t){return/^\d+$/.test(t)?"".concat(t,"px"):t}function f(){}var p={"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 g(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=t;if(Array.isArray(t)){for(var i=0;i<t.length;i++){var r=p[t[i]];if(r)return r}return e[0]}return p[e]||e}var v=null;e.b=function(t){var e=t.width,p=void 0===e?"100%":e,m=t.height,y=void 0===m?"100%":m,b=t.value,E=t.language,S=void 0===E?"javascript":E,C=t.style,k=void 0===C?{}:C,w=t.options,x=void 0===w?{}:w,T=t.overrideServices,O=void 0===T?{}:T,A=t.theme,L=void 0===A?"vs-dark":A,R=t.onEditBlur,_=t.onSave,D=t.autoHeight,I=void 0!==D&&D,M=t.forbidCopy,P=void 0!==M&&M,N=t.onChange,j=void 0===N?f:N,B=t.editorDidMount,F=void 0===B?f:B,U=t.onFocus,G=void 0===U?f:U,H=t.filename,z=void 0===H?"educoder.txt":H,V=(Object(o.a)(t,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),Object(l.useRef)()),K=Object(l.useRef)({}),W=Object(l.useRef)(),Y=Object(l.useRef)(!1),X=Object(l.useRef)(),q=Object(l.useState)(!1),$=Object(a.a)(q,2),J=$[0],Q=$[1];function Z(){n.b.warn(decodeURIComponent("该任务关卡设置了禁止复制粘贴,请手动输入代码。"))}function tt(){var t=K.current.instance;if(t){var e=t.getSelection(),i=K.current.pastePos||{},r=new v.Range(i.startLineNumber||e.endLineNumber,i.startColumn||e.endColumn,i.endLineNumber||e.endLineNumber,i.endColumn||e.endColumn);setTimeout((function(){t.executeEdits("",[{range:r,text:""}])}),300)}}function et(t){(window.navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)&&83==t.keyCode&&(t.preventDefault(),_())}Object(l.useEffect)((function(){W.current&&clearTimeout(W.current),W.current=setTimeout((function(){!function(){var t=K.current.instance;if(null!=b&&t&&J){var e=t.getModel();e&&b!==e.getValue()&&(!0,e.setValue(b),t.layout(),!1)}}()}),500)}),[b,J,K.current]);var it=function(){if(I&&K.current.instance){var t=K.current.instance.getContentHeight();ut(t<y?y:t)}else ut(y)};function rt(t,e){var i,r,n=window.URL||window.webkitURL||window,s=new Blob([e]),a=document.createElementNS("http://www.w3.org/1999/xhtml","a");a.href=n.createObjectURL(s),a.download=t,i=a,(r=document.createEvent("MouseEvents")).initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),i.dispatchEvent(r)}Object(l.useEffect)((function(){it()}),[it]),Object(l.useEffect)((function(){V.current&&!J&&i.e(/*! import() | monaco-editor */27).then(i.t.bind(null,/*! monaco-editor/esm/vs/editor/editor.api.js */"M/lh",7)).then((function(t){try{v=t,K.current.instance=v.editor.create(V.current,{value:b,language:g(S),theme:L,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},O);var e=K.current.instance;if(F(e,v),setTimeout((function(){it(),K.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){rt(z||"educoder.txt",e.getValue())}})}),500),K.current.subscription=e.onDidChangeModelContent((function(t){Y.current?clearTimeout(X.current):(it(),j(e.getValue(),t)),X.current=setTimeout((function(){Y.current=!1}),500)})),window.Monaco||function(t){var e={label:"ifelse",kind:t.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {","\t$0","} else {","\t","}"].join("\n"),insertTextRules:t.languages.CompletionItemInsertTextRule.InsertAsSnippet},i=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];t.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(r,n){return{suggestions:h(t,r,n,i,[e])}}});var r=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];t.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(e,i){var n=[{label:"print",kind:t.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join("\n"),insertTextRules:t.languages.CompletionItemInsertTextRule.InsertAsSnippet}];return{suggestions:h(t,e,i,r,n)}}});var n=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];t.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(i,r){var s=[e,{label:"main",kind:t.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {","\t$0","}"].join("\n"),insertTextRules:t.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:t.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join("\n"),insertTextRules:t.languages.CompletionItemInsertTextRule.InsertAsSnippet}];return{suggestions:h(t,i,r,n,s)}}})}(v),P&&(e.addCommand(v.KeyMod.CtrlCmd|v.KeyMod.Shift|v.KeyCode.KEY_V,(function(){return Z(),null})),e.addCommand(v.KeyMod.CtrlCmd|v.KeyCode.KEY_C,(function(){return Z(),null}))),window.Monaco=v,R&&e.onDidBlurEditorWidget((function(){R(e.getValue())})),G&&e.onDidFocusEditorText((function(){G(e.getValue())})),P){e.addCommand(v.KeyMod.CtrlCmd|v.KeyCode.KEY_V,(function(){return Z(),null})),e.onDidPaste((function(t){K.current.pastePos=t}));try{window.addEventListener("paste",tt)}catch(t){}}var i=function(){var t;return V.current&&(t=new u.default((function(t){var e,i=Object(s.a)(t);try{for(i.s();!(e=i.n()).done;){var r=e.value;(r.target.offsetHeight>0||r.target.offsetWidth>0)&&K.current.instance.layout()}}catch(t){i.e(t)}finally{i.f()}}))).observe(V.current),t}();return Q(!0),function(){var t=K.current.instance;t.dispose();var e=t.getModel();e&&e.dispose(),K.current.subscription&&K.current.subscription.dispose(),P&&window.removeEventListener("paste",tt),i.unobserve(V.current)}}catch(t){}}))}),[]),Object(l.useEffect)((function(){if(K.current.instance&&J)return document.addEventListener("keydown",et,!1),function(){document.removeEventListener("keydown",et)}}),[_,J]),Object(l.useEffect)((function(){var t=K.current.instance;if(t&&J){var e=g(S);v.editor.setModelLanguage(t.getModel(),e),console.log("language:",S,t.getModel(),e)}}),[S,J]),Object(l.useEffect)((function(){K.current.instance&&J&&v.editor.setTheme(L)}),[L,J]),Object(l.useEffect)((function(){var t=K.current.instance;t&&J&&(t.updateOptions(Object(r.a)({},x)),setTimeout((function(){t.getModel().updateOptions(Object(r.a)({},x))}),200))}),[JSON.stringify(x),J]),Object(l.useEffect)((function(){var t=K.current.instance;t&&J&&t.layout()}),[p,y,J]);var nt=Object(l.useState)(d(p)),st=Object(a.a)(nt,2),at=st[0],ot=(st[1],Object(l.useState)(d(y))),lt=Object(a.a)(ot,2),ct=lt[0],ut=lt[1],ht=Object(r.a)(Object(r.a)({},k),{},{width:at,height:ct});return c.a.createElement("div",{className:"my-monaco-editor",ref:V,style:ht})};function m(t){var e=t.width,n=void 0===e?"100%":e,o=t.height,h=void 0===o?"100%":o,f=t.original,p=t.modified,g=t.language,m=t.options,y=void 0===m?{}:m,b=Object(l.useRef)(),E=Object(l.useState)(null),S=Object(a.a)(E,2),C=S[0],k=S[1];Object(l.useEffect)((function(){b.current&&i.e(/*! import() | monaco-editor */27).then(i.t.bind(null,/*! monaco-editor/esm/vs/editor/editor.api.js */"M/lh",7)).then((function(t){var e=(v=t).editor.createDiffEditor(b.current,Object(r.a)(Object(r.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},y),{},{wordWrap:!0}));k(e);var i=function(t){var e;return b.current&&(e=new u.default((function(e){var i,r=Object(s.a)(e);try{for(r.s();!(i=r.n()).done;){var n=i.value;(n.target.offsetHeight>0||n.target.offsetWidth>0)&&t.layout()}}catch(t){r.e(t)}finally{r.f()}}))).observe(b.current),e}(e);return function(){e.dispose();var t=e.getModel();t&&t.dispose(),i.unobserve(b.current)}}))}),[]),Object(l.useEffect)((function(){C&&C.setModel({original:v.editor.createModel(f,g),modified:v.editor.createModel(p,g)})}),[f,p,g,C]);var w={width:d(n),height:d(h)};return c.a.createElement("div",{className:"my-diff-editor",ref:b,style:w})}},bT9E:
/*!*****************************************!*\
!*** ./node_modules/rc-util/es/omit.js ***!
\*****************************************/
/*! exports provided: default */
/*! exports used: default */function(t,e,i){"use strict";i.d(e,"a",(function(){return n}));var r=i(/*! @babel/runtime/helpers/esm/objectSpread2 */"VTBJ");function n(t,e){var i=Object(r.a)({},t);return Array.isArray(e)&&e.forEach((function(t){delete i[t]})),i}},biw7:
/*!**********************************************************!*\
!*** ./node_modules/rc-table/es/context/TableContext.js ***!
\**********************************************************/
/*! exports provided: default */
/*! exports used: default */function(t,e,i){"use strict";var r=i(/*! react */"q1tI"),n=r.createContext(null);e.a=n},eZjB:
/*!*******************************************!*\
!*** ./src/assets/images/question/a1.svg ***!
\*******************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,i){t.exports=i.p+"static/a1.80c95864.svg"},fyJ8:
/*!************************************************!*\
!*** ./node_modules/rc-table/es/Cell/index.js ***!
\************************************************/
/*! exports provided: default */
/*! exports used: default */function(t,e,i){"use strict";var r=i(/*! @babel/runtime/helpers/esm/defineProperty */"rePB"),n=i(/*! @babel/runtime/helpers/esm/objectSpread2 */"VTBJ"),s=i(/*! @babel/runtime/helpers/esm/objectWithoutProperties */"Ff2n"),a=i(/*! @babel/runtime/helpers/esm/typeof */"U8pU"),o=i(/*! react */"q1tI"),l=i(/*! classnames */"TSYQ"),c=i.n(l),u=i(/*! rc-util/es/ref */"c+Xe"),h=i(/*! ../utils/valueUtil */"sR1s");var d=o.forwardRef((function(t,e){var i,l,d,f,p=t.prefixCls,g=t.className,v=t.record,m=t.index,y=t.dataIndex,b=t.render,E=t.children,S=t.component,C=void 0===S?"td":S,k=t.colSpan,w=t.rowSpan,x=t.fixLeft,T=t.fixRight,O=t.firstFixLeft,A=t.lastFixLeft,L=t.firstFixRight,R=t.lastFixRight,_=t.appendNode,D=t.additionalProps,I=void 0===D?{}:D,M=t.ellipsis,P=t.align,N=t.rowType,j=t.isSticky,B="".concat(p,"-cell");if(E)d=E;else{var F=Object(h.b)(v,y);if(d=F,b){var U=b(F,v,m);!(f=U)||"object"!==Object(a.a)(f)||Array.isArray(f)||o.isValidElement(f)?d=U:(d=U.children,l=U.props)}}"object"!==Object(a.a)(d)||Array.isArray(d)||o.isValidElement(d)||(d=null),M&&(A||L)&&(d=o.createElement("span",{className:"".concat(B,"-content")},d));var G=l||{},H=G.colSpan,z=G.rowSpan,V=G.style,K=G.className,W=Object(s.a)(G,["colSpan","rowSpan","style","className"]),Y=void 0!==H?H:k,X=void 0!==z?z:w;if(0===Y||0===X)return null;var q={},$="number"==typeof x,J="number"==typeof T;$&&(q.position="sticky",q.left=x),J&&(q.position="sticky",q.right=T);var Q,Z={};P&&(Z.textAlign=P);var tt=!0===M?{showTitle:!0}:M;tt&&(tt.showTitle||"header"===N)&&("string"==typeof d||"number"==typeof d?Q=d.toString():o.isValidElement(d)&&"string"==typeof d.props.children&&(Q=d.props.children));var et,it=Object(n.a)(Object(n.a)(Object(n.a)({title:Q},W),I),{},{colSpan:Y&&1!==Y?Y:null,rowSpan:X&&1!==X?X:null,className:c()(B,g,(i={},Object(r.a)(i,"".concat(B,"-fix-left"),$),Object(r.a)(i,"".concat(B,"-fix-left-first"),O),Object(r.a)(i,"".concat(B,"-fix-left-last"),A),Object(r.a)(i,"".concat(B,"-fix-right"),J),Object(r.a)(i,"".concat(B,"-fix-right-first"),L),Object(r.a)(i,"".concat(B,"-fix-right-last"),R),Object(r.a)(i,"".concat(B,"-ellipsis"),M),Object(r.a)(i,"".concat(B,"-with-append"),_),Object(r.a)(i,"".concat(B,"-fix-sticky"),($||J)&&j),i),I.className,K),style:Object(n.a)(Object(n.a)(Object(n.a)(Object(n.a)({},I.style),Z),q),V),ref:(et=C,"string"==typeof et||Object(u.c)(et)?e:null)});return o.createElement(C,Object.assign({},it),_,d)}));d.displayName="Cell";var f=o.memo(d,(function(t,e){return!!e.shouldCellUpdate&&!e.shouldCellUpdate(e.record,t.record)}));e.a=f},hW8S:
/*!******************************************************!*\
!*** ./node_modules/rc-table/es/utils/legacyUtil.js ***!
\******************************************************/
/*! exports provided: INTERNAL_COL_DEFINE, getExpandableProps, getDataAndAriaProps */
/*! exports used: INTERNAL_COL_DEFINE, getDataAndAriaProps, getExpandableProps */function(t,e,i){"use strict";i.d(e,"a",(function(){return s})),i.d(e,"c",(function(){return a})),i.d(e,"b",(function(){return o}));var r=i(/*! @babel/runtime/helpers/esm/objectSpread2 */"VTBJ"),n=i(/*! @babel/runtime/helpers/esm/objectWithoutProperties */"Ff2n"),s=(i(/*! rc-util/es/warning */"Kwbf"),"RC_TABLE_INTERNAL_COL_DEFINE");function a(t){var e=t.expandable,i=Object(n.a)(t,["expandable"]);return"expandable"in t?Object(r.a)(Object(r.a)({},i),e):i}function o(t){return Object.keys(t).reduce((function(e,i){return"data-"!==i.substr(0,5)&&"aria-"!==i.substr(0,5)||(e[i]=t[i]),e}),{})}},k3GJ:
/*!*******************************************************!*\
!*** ./node_modules/rc-tabs/es/index.js + 50 modules ***!
\*******************************************************/
/*! exports provided: TabPane, default */
/*! exports used: TabPane, default */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createSuper.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/extends.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/typeof.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/regenerator/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/mini-store/esm/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/raf/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-align/es/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-dropdown/es/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-resize-observer/es/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Children/toArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Dom/addEventListener.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Dom/canUseDom.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Dom/contains.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Dom/findDOMNode.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/KeyCode.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Portal.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/createChainedFunction.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/hooks/useMergedState.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/omit.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/raf.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/ref.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/warning.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react-dom/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js (<- Module uses injected variables (global)) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/shallowequal/index.js (<- Module is not an ECMAScript module) */function(t,e,i){"use strict";i.d(e,"a",(function(){return Ke}));var r=i("rePB"),n=i("ODXe"),s=i("Ff2n"),a=i("VTBJ"),o=i("q1tI"),l=i("TSYQ"),c=i.n(l),u=i("Zm9Q"),h=i("6cGi"),d=i("KQm4"),f=i("xEkU"),p=i.n(f),g=i("t23M");function v(t){var e=Object(o.useRef)(),i=Object(o.useRef)(!1);return Object(o.useEffect)((function(){return function(){i.current=!0,p.a.cancel(e.current)}}),[]),function(){for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];i.current||(p.a.cancel(e.current),e.current=p()((function(){t.apply(void 0,n)})))}}var m=i("4IlW");var y=o.forwardRef((function(t,e){var i,n=t.prefixCls,s=t.id,a=t.active,l=t.rtl,u=t.tab,h=u.key,d=u.tab,f=u.disabled,p=u.closeIcon,g=t.tabBarGutter,v=t.tabPosition,y=t.closable,b=t.renderWrapper,E=t.removeAriaLabel,S=t.editable,C=t.onClick,k=t.onRemove,w=t.onFocus,x="".concat(n,"-tab");o.useEffect((function(){return k}),[]);var T={};"top"===v||"bottom"===v?T[l?"marginLeft":"marginRight"]=g:T.marginBottom=g;var O=S&&!1!==y&&!f;function A(t){f||C(t)}var L=o.createElement("div",{key:h,ref:e,className:c()(x,(i={},Object(r.a)(i,"".concat(x,"-with-remove"),O),Object(r.a)(i,"".concat(x,"-active"),a),Object(r.a)(i,"".concat(x,"-disabled"),f),i)),style:T,onClick:A},o.createElement("div",{role:"tab","aria-selected":a,id:s&&"".concat(s,"-tab-").concat(h),className:"".concat(x,"-btn"),"aria-controls":s&&"".concat(s,"-panel-").concat(h),"aria-disabled":f,tabIndex:f?null:0,onClick:function(t){t.stopPropagation(),A(t)},onKeyDown:function(t){[m.a.SPACE,m.a.ENTER].includes(t.which)&&(t.preventDefault(),A(t))},onFocus:w},d),O&&o.createElement("button",{type:"button","aria-label":E||"remove",tabIndex:0,className:"".concat(x,"-remove"),onClick:function(t){var e;t.stopPropagation(),(e=t).preventDefault(),e.stopPropagation(),S.onEdit("remove",{key:h,event:e})}},p||S.removeIcon||"×"));return b&&(L=b(L)),L})),b={width:0,height:0,left:0,top:0};var E={width:0,height:0,left:0,top:0,right:0};var S=i("wx14"),C=i("1OyB"),k=i("vuIU"),w=i("JX7q"),x=i("Ji7U"),T=i("LK+K"),O=i("I8Z2"),A=i("bT9E"),L=i("2GS6"),R=i("Gytx"),_=i.n(R),D=i("U8pU"),I=/iPhone/i,M=/iPod/i,P=/iPad/i,N=/\bAndroid(?:.+)Mobile\b/i,j=/Android/i,B=/\bAndroid(?:.+)SD4930UR\b/i,F=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,U=/Windows Phone/i,G=/\bWindows(?:.+)ARM\b/i,H=/BlackBerry/i,z=/BB10/i,V=/Opera Mini/i,K=/\b(CriOS|Chrome)(?:.+)Mobile/i,W=/Mobile(?:.+)Firefox\b/i;function Y(t,e){return t.test(e)}function X(t){var e=t||("undefined"!=typeof navigator?navigator.userAgent:""),i=(e||"").split("[FBAN");if(void 0!==i[1]){var r=i;e=Object(n.a)(r,1)[0]}if(void 0!==(i=e.split("Twitter"))[1]){var s=i;e=Object(n.a)(s,1)[0]}var a={apple:{phone:Y(I,e)&&!Y(U,e),ipod:Y(M,e),tablet:!Y(I,e)&&Y(P,e)&&!Y(U,e),device:(Y(I,e)||Y(M,e)||Y(P,e))&&!Y(U,e)},amazon:{phone:Y(B,e),tablet:!Y(B,e)&&Y(F,e),device:Y(B,e)||Y(F,e)},android:{phone:!Y(U,e)&&Y(B,e)||!Y(U,e)&&Y(N,e),tablet:!Y(U,e)&&!Y(B,e)&&!Y(N,e)&&(Y(F,e)||Y(j,e)),device:!Y(U,e)&&(Y(B,e)||Y(F,e)||Y(N,e)||Y(j,e))||Y(/\bokhttp\b/i,e)},windows:{phone:Y(U,e),tablet:Y(G,e),device:Y(U,e)||Y(G,e)},other:{blackberry:Y(H,e),blackberry10:Y(z,e),opera:Y(V,e),firefox:Y(W,e),chrome:Y(K,e),device:Y(H,e)||Y(z,e)||Y(V,e)||Y(W,e)||Y(K,e)},any:null,phone:null,tablet:null};return a.any=a.apple.device||a.android.device||a.windows.device||a.other.device,a.phone=a.apple.phone||a.android.phone||a.windows.phone,a.tablet=a.apple.tablet||a.android.tablet||a.windows.tablet,a}var q=Object(a.a)(Object(a.a)({},X()),{},{isMobile:X});function $(){}function J(t,e,i){var r=e||"";return t.key||"".concat(r,"item_").concat(i)}function Q(t){return"".concat(t,"-menu-")}function Z(t,e){var i=-1;o.Children.forEach(t,(function(t){i+=1,t&&t.type&&t.type.isMenuItemGroup?o.Children.forEach(t.props.children,(function(t){e(t,i+=1)})):e(t,i)}))}var tt=["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"],et=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=t&&"function"==typeof t.getBoundingClientRect&&t.getBoundingClientRect().width;if(i){if(e){var r=getComputedStyle(t),n=r.marginLeft,s=r.marginRight;i+=+n.replace("px","")+ +s.replace("px","")}i=+i.toFixed(6)}return i||0},it=function(t,e,i){t&&"object"===Object(D.a)(t.style)&&(t.style[e]=i)},rt=i("bdgK"),nt=i("i8i4"),st=i.n(nt),at=i("wgJM"),ot=i("l4aY"),lt=i("m+aA"),ct=i("c+Xe"),ut=i("zT1h"),ht=i("QC+M");function dt(t,e,i){return i?t[0]===e[0]:t[0]===e[0]&&t[1]===e[1]}var ft=i("MNnm");function pt(t,e){var i={};return i[t.toLowerCase()]=e.toLowerCase(),i["Webkit".concat(t)]="webkit".concat(e),i["Moz".concat(t)]="moz".concat(e),i["ms".concat(t)]="MS".concat(e),i["O".concat(t)]="o".concat(e.toLowerCase()),i}var gt,vt,mt,yt=(gt=Object(ft.a)(),vt="undefined"!=typeof window?window:{},mt={animationend:pt("Animation","AnimationEnd"),transitionend:pt("Transition","TransitionEnd")},gt&&("AnimationEvent"in vt||delete mt.animationend.animation,"TransitionEvent"in vt||delete mt.transitionend.transition),mt),bt={};if(Object(ft.a)()){var Et=document.createElement("div");bt=Et.style}var St={};function Ct(t){if(St[t])return St[t];var e=yt[t];if(e)for(var i=Object.keys(e),r=i.length,n=0;n<r;n+=1){var s=i[n];if(Object.prototype.hasOwnProperty.call(e,s)&&s in bt)return St[t]=e[s],St[t]}return""}var kt=Ct("animationend"),wt=Ct("transitionend"),xt=!(!kt||!wt),Tt=kt||"animationend",Ot=wt||"transitionend";function At(t,e){return t?"object"===Object(D.a)(t)?t[e.replace(/-\w/g,(function(t){return t[1].toUpperCase()}))]:"".concat(t,"-").concat(e):null}function Lt(t){var e=Object(o.useRef)(!1),i=Object(o.useState)(t),r=Object(n.a)(i,2),s=r[0],a=r[1];return Object(o.useEffect)((function(){return function(){e.current=!0}}),[]),[s,function(t){e.current||a(t)}]}var Rt=Object(ft.a)()?o.useLayoutEffect:o.useEffect,_t=["prepare","start","active","end"];function Dt(t){return"active"===t||"end"===t}var It=function(t,e){var i=o.useState("none"),r=Object(n.a)(i,2),s=r[0],a=r[1],l=function(){var t=o.useRef(null);function e(){at.a.cancel(t.current)}return o.useEffect((function(){return function(){e()}}),[]),[function i(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;e();var s=Object(at.a)((function(){n<=1?r({isCanceled:function(){return s!==t.current}}):i(r,n-1)}));t.current=s},e]}(),c=Object(n.a)(l,2),u=c[0],h=c[1];return Rt((function(){if("none"!==s&&"end"!==s){var t=_t.indexOf(s),i=_t[t+1],r=e(s);!1===r?a(i):u((function(t){function e(){t.isCanceled()||a(i)}!0===r?e():Promise.resolve(r).then(e)}))}}),[t,s]),o.useEffect((function(){return function(){h()}}),[]),[function(){a("prepare")},s]};function Mt(t,e,i,s){var l=s.motionEnter,c=void 0===l||l,u=s.motionAppear,h=void 0===u||u,d=s.motionLeave,f=void 0===d||d,p=s.motionDeadline,g=s.motionLeaveImmediately,v=s.onAppearPrepare,m=s.onEnterPrepare,y=s.onLeavePrepare,b=s.onAppearStart,E=s.onEnterStart,S=s.onLeaveStart,C=s.onAppearActive,k=s.onEnterActive,w=s.onLeaveActive,x=s.onAppearEnd,T=s.onEnterEnd,O=s.onLeaveEnd,A=s.onVisibleChanged,L=Lt(),R=Object(n.a)(L,2),_=R[0],D=R[1],I=Lt("none"),M=Object(n.a)(I,2),P=M[0],N=M[1],j=Lt(null),B=Object(n.a)(j,2),F=B[0],U=B[1],G=Object(o.useRef)(!1),H=Object(o.useRef)(null),z=Object(o.useRef)(!1),V=Object(o.useRef)(null);function K(){return i()||V.current}var W=Object(o.useRef)(!1);function Y(t){var e,i=K();t&&!t.deadline&&t.target!==i||("appear"===P&&W.current?e=null==x?void 0:x(i,t):"enter"===P&&W.current?e=null==T?void 0:T(i,t):"leave"===P&&W.current&&(e=null==O?void 0:O(i,t)),!1===e||z.current||(N("none"),U(null)))}var X=function(t){var e=Object(o.useRef)(),i=Object(o.useRef)(t);i.current=t;var r=o.useCallback((function(t){i.current(t)}),[]);function n(t){t&&(t.removeEventListener(Ot,r),t.removeEventListener(Tt,r))}return o.useEffect((function(){return function(){n(e.current)}}),[]),[function(t){e.current&&e.current!==t&&n(e.current),t&&t!==e.current&&(t.addEventListener(Ot,r),t.addEventListener(Tt,r),e.current=t)},n]}(Y),q=Object(n.a)(X,1)[0],$=o.useMemo((function(){var t,e,i;switch(P){case"appear":return t={},Object(r.a)(t,"prepare",v),Object(r.a)(t,"start",b),Object(r.a)(t,"active",C),t;case"enter":return e={},Object(r.a)(e,"prepare",m),Object(r.a)(e,"start",E),Object(r.a)(e,"active",k),e;case"leave":return i={},Object(r.a)(i,"prepare",y),Object(r.a)(i,"start",S),Object(r.a)(i,"active",w),i;default:return{}}}),[P]),J=It(P,(function(t){if("prepare"===t){var e=$.prepare;return!!e&&e(K())}var i;tt in $&&U((null===(i=$[tt])||void 0===i?void 0:i.call($,K(),null))||null);return"active"===tt&&(q(K()),p>0&&(clearTimeout(H.current),H.current=setTimeout((function(){Y({deadline:!0})}),p))),!0})),Q=Object(n.a)(J,2),Z=Q[0],tt=Q[1],et=Dt(tt);W.current=et,Rt((function(){D(e);var i,r=G.current;(G.current=!0,t)&&(!r&&e&&h&&(i="appear"),r&&e&&c&&(i="enter"),(r&&!e&&f||!r&&g&&!e&&f)&&(i="leave"),i&&(N(i),Z()))}),[e]),Object(o.useEffect)((function(){("appear"===P&&!h||"enter"===P&&!c||"leave"===P&&!f)&&N("none")}),[h,c,f]),Object(o.useEffect)((function(){return function(){clearTimeout(H.current),z.current=!0}}),[]),Object(o.useEffect)((function(){void 0!==_&&"none"===P&&(null==A||A(_))}),[_,P]);var it=F;return $.prepare&&"start"===tt&&(it=Object(a.a)({transition:"none"},it)),[P,tt,it,null!=_?_:e]}var Pt=function(t){Object(x.a)(i,t);var e=Object(T.a)(i);function i(){return Object(C.a)(this,i),e.apply(this,arguments)}return Object(k.a)(i,[{key:"render",value:function(){return this.props.children}}]),i}(o.Component);var Nt=function(t){var e=t;function i(t){return!(!t.motionName||!e)}"object"===Object(D.a)(t)&&(e=t.transitionSupport);var s=o.forwardRef((function(t,e){var s=t.visible,l=void 0===s||s,u=t.removeOnLeave,h=void 0===u||u,d=t.forceRender,f=t.children,p=t.motionName,g=t.leavedClassName,v=t.eventProps,m=i(t),y=Object(o.useRef)(),b=Object(o.useRef)();var E=Mt(m,l,(function(){try{return Object(lt.a)(y.current||b.current)}catch(t){return null}}),t),S=Object(n.a)(E,4),C=S[0],k=S[1],w=S[2],x=S[3],T=o.useRef(x);x&&(T.current=!0);var O=Object(o.useRef)(e);O.current=e;var A,L=o.useCallback((function(t){y.current=t,Object(ct.b)(O.current,t)}),[]),R=Object(a.a)(Object(a.a)({},v),{},{visible:l});if(f)if("none"!==C&&i(t)){var _,D;"prepare"===k?D="prepare":Dt(k)?D="active":"start"===k&&(D="start"),A=f(Object(a.a)(Object(a.a)({},R),{},{className:c()(At(p,C),(_={},Object(r.a)(_,At(p,"".concat(C,"-").concat(D)),D),Object(r.a)(_,p,"string"==typeof p),_)),style:w}),L)}else A=x?f(Object(a.a)({},R),L):!h&&T.current?f(Object(a.a)(Object(a.a)({},R),{},{className:g}),L):d?f(Object(a.a)(Object(a.a)({},R),{},{style:{display:"none"}}),L):null;else A=null;return o.createElement(Pt,{ref:b},A)}));return s.displayName="CSSMotion",s}(xt);function jt(t){var e;return e=t&&"object"===Object(D.a)(t)&&"key"in t?t:{key:t},Object(a.a)(Object(a.a)({},e),{},{key:String(e.key)})}function Bt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return t.map(jt)}function Ft(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=[],r=0,n=e.length,s=Bt(t),o=Bt(e);s.forEach((function(t){for(var e=!1,s=r;s<n;s+=1){var l=o[s];if(l.key===t.key){r<s&&(i=i.concat(o.slice(r,s).map((function(t){return Object(a.a)(Object(a.a)({},t),{},{status:"add"})}))),r=s),i.push(Object(a.a)(Object(a.a)({},l),{},{status:"keep"})),r+=1,e=!0;break}}e||i.push(Object(a.a)(Object(a.a)({},t),{},{status:"remove"}))})),r<n&&(i=i.concat(o.slice(r).map((function(t){return Object(a.a)(Object(a.a)({},t),{},{status:"add"})}))));var l={};i.forEach((function(t){var e=t.key;l[e]=(l[e]||0)+1}));var c=Object.keys(l).filter((function(t){return l[t]>1}));return c.forEach((function(t){(i=i.filter((function(e){var i=e.key,r=e.status;return i!==t||"remove"!==r}))).forEach((function(e){e.key===t&&(e.status="keep")}))})),i}var Ut=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];!function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Nt,i=function(t){Object(x.a)(r,t);var i=Object(T.a)(r);function r(){var t;return Object(C.a)(this,r),(t=i.apply(this,arguments)).state={keyEntities:[]},t.removeKey=function(e){t.setState((function(t){return{keyEntities:t.keyEntities.map((function(t){return t.key!==e?t:Object(a.a)(Object(a.a)({},t),{},{status:"removed"})}))}}))},t}return Object(k.a)(r,[{key:"render",value:function(){var t=this,i=this.state.keyEntities,r=this.props,n=r.component,a=r.children,l=r.onVisibleChanged,c=Object(s.a)(r,["component","children","onVisibleChanged"]),u=n||o.Fragment,h={};return Ut.forEach((function(t){h[t]=c[t],delete c[t]})),delete c.keys,o.createElement(u,c,i.map((function(i){var r=i.status,n=Object(s.a)(i,["status"]),c="add"===r||"keep"===r;return o.createElement(e,Object(S.a)({},h,{key:n.key,visible:c,eventProps:n,onVisibleChanged:function(e){null==l||l(e,{key:n.key}),e||t.removeKey(n.key)}}),a)})))}}],[{key:"getDerivedStateFromProps",value:function(t,e){var i=t.keys,r=e.keyEntities,n=Bt(i);return{keyEntities:Ft(r,n).filter((function(t){var e=r.find((function(e){var i=e.key;return t.key===i}));return!e||"removed"!==e.status||"remove"!==t.status}))}}}]),r}(o.Component);i.defaultProps={component:"div"}}(xt);var Gt=Nt;function Ht(t){var e=t.prefixCls,i=t.motion,r=t.animation,n=t.transitionName;return i||(r?{motionName:"".concat(e,"-").concat(r)}:n?{motionName:n}:null)}function zt(t){var e=t.prefixCls,i=t.visible,r=t.zIndex,n=t.mask,s=t.maskMotion,l=t.maskAnimation,u=t.maskTransitionName;if(!n)return null;var h={};return(s||u||l)&&(h=Object(a.a)({motionAppear:!0},Ht({motion:s,prefixCls:e,transitionName:u,animation:l}))),o.createElement(Gt,Object(S.a)({},h,{visible:i,removeOnLeave:!0}),(function(t){var i=t.className;return o.createElement("div",{style:{zIndex:r},className:c()("".concat(e,"-mask"),i)})}))}var Vt=i("9mu1"),Kt=i("o0o1"),Wt=i.n(Kt),Yt=i("HaE+"),Xt=["measure","align",null,"motion"],qt=o.forwardRef((function(t,e){var i=t.visible,r=t.prefixCls,s=t.className,l=t.style,u=t.children,h=t.zIndex,d=t.stretch,f=t.destroyPopupOnHide,p=t.forceRender,g=t.align,v=t.point,m=t.getRootDomNode,y=t.getClassNameFromAlign,b=t.onAlign,E=t.onMouseEnter,C=t.onMouseLeave,k=t.onMouseDown,w=t.onTouchStart,x=Object(o.useRef)(),T=Object(o.useRef)(),O=Object(o.useState)(),A=Object(n.a)(O,2),L=A[0],R=A[1],_=function(t){var e=o.useState({width:0,height:0}),i=Object(n.a)(e,2),r=i[0],s=i[1];return[o.useMemo((function(){var e={};if(t){var i=r.width,n=r.height;-1!==t.indexOf("height")&&n?e.height=n:-1!==t.indexOf("minHeight")&&n&&(e.minHeight=n),-1!==t.indexOf("width")&&i?e.width=i:-1!==t.indexOf("minWidth")&&i&&(e.minWidth=i)}return e}),[t,r]),function(t){s({width:t.offsetWidth,height:t.offsetHeight})}]}(d),D=Object(n.a)(_,2),I=D[0],M=D[1];var P=function(t,e){var i=Object(o.useState)(null),r=Object(n.a)(i,2),s=r[0],a=r[1],l=Object(o.useRef)(),c=Object(o.useRef)(!1);function u(t){c.current||a(t)}function h(){at.a.cancel(l.current)}return Object(o.useEffect)((function(){u("measure")}),[t]),Object(o.useEffect)((function(){switch(s){case"measure":e()}s&&(l.current=Object(at.a)(Object(Yt.a)(Wt.a.mark((function t(){var e,i;return Wt.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=Xt.indexOf(s),(i=Xt[e+1])&&-1!==e&&u(i);case 3:case"end":return t.stop()}}),t)})))))}),[s]),Object(o.useEffect)((function(){return function(){c.current=!0,h()}}),[]),[s,function(t){h(),l.current=Object(at.a)((function(){u((function(t){switch(s){case"align":return"motion";case"motion":return"stable"}return t})),null==t||t()}))}]}(i,(function(){d&&M(m())})),N=Object(n.a)(P,2),j=N[0],B=N[1],F=Object(o.useRef)();function U(){var t;null===(t=x.current)||void 0===t||t.forceAlign()}function G(t,e){var i=y(e);L!==i&&R(i),"align"===j&&(L!==i?Promise.resolve().then((function(){U()})):B((function(){var t;null===(t=F.current)||void 0===t||t.call(F)})),null==b||b(t,e))}var H=Object(a.a)({},Ht(t));function z(){return new Promise((function(t){F.current=t}))}["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach((function(t){var e=H[t];H[t]=function(t,i){return B(),null==e?void 0:e(t,i)}})),o.useEffect((function(){H.motionName||"motion"!==j||B()}),[H.motionName,j]),o.useImperativeHandle(e,(function(){return{forceAlign:U,getElement:function(){return T.current}}}));var V=Object(a.a)(Object(a.a)({},I),{},{zIndex:h,opacity:"motion"!==j&&"stable"!==j&&i?0:void 0,pointerEvents:"stable"===j?void 0:"none"},l),K=!0;!(null==g?void 0:g.points)||"align"!==j&&"stable"!==j||(K=!1);var W=u;return o.Children.count(u)>1&&(W=o.createElement("div",{className:"".concat(r,"-content")},u)),o.createElement(Gt,Object(S.a)({visible:i,ref:T,leavedClassName:"".concat(r,"-hidden")},H,{onAppearPrepare:z,onEnterPrepare:z,removeOnLeave:f,forceRender:p}),(function(t,e){var i=t.className,n=t.style,l=c()(r,s,L,i);return o.createElement(Vt.a,{target:v||m,key:"popup",ref:x,monitorWindowResize:!0,disabled:K,align:g,onAlign:G},o.createElement("div",{ref:e,className:l,onMouseEnter:E,onMouseLeave:C,onMouseDownCapture:k,onTouchStartCapture:w,style:Object(a.a)(Object(a.a)({},n),V)},W))}))}));qt.displayName="PopupInner";var $t=qt,Jt=o.forwardRef((function(t,e){var i=t.prefixCls,r=t.visible,n=t.zIndex,s=t.children,l=t.mobile,u=(l=void 0===l?{}:l).popupClassName,h=l.popupStyle,d=l.popupMotion,f=void 0===d?{}:d,p=l.popupRender,g=o.useRef();o.useImperativeHandle(e,(function(){return{forceAlign:function(){},getElement:function(){return g.current}}}));var v=Object(a.a)({zIndex:n},h),m=s;return o.Children.count(s)>1&&(m=o.createElement("div",{className:"".concat(i,"-content")},s)),p&&(m=p(m)),o.createElement(Gt,Object(S.a)({visible:r,ref:g,removeOnLeave:!0},f),(function(t,e){var r=t.className,n=t.style,s=c()(i,u,r);return o.createElement("div",{ref:e,className:s,style:Object(a.a)(Object(a.a)({},n),v)},m)}))}));Jt.displayName="MobilePopupInner";var Qt=Jt,Zt=["visible","mobile"],te=o.forwardRef((function(t,e){var i=t.visible,r=t.mobile,l=Object(s.a)(t,Zt),c=Object(o.useState)(i),u=Object(n.a)(c,2),h=u[0],d=u[1],f=Object(o.useState)(!1),p=Object(n.a)(f,2),g=p[0],v=p[1],m=Object(a.a)(Object(a.a)({},l),{},{visible:h});Object(o.useEffect)((function(){d(i),i&&r&&v(function(){if("undefined"==typeof navigator||"undefined"==typeof window)return!1;var t=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(t)&&!/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(null==t?void 0:t.substr(0,4)))}())}),[i,r]);var y=g?o.createElement(Qt,Object(S.a)({},m,{mobile:r,ref:e})):o.createElement($t,Object(S.a)({},m,{ref:e}));return o.createElement("div",null,o.createElement(zt,m),y)}));te.displayName="Popup";var ee=te,ie=o.createContext(null);function re(){}function ne(){return""}function se(t){return t?t.ownerDocument:window.document}var ae=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];var oe,le,ce=(oe=ht.a,(le=function(t){Object(x.a)(i,t);var e=Object(T.a)(i);function i(t){var r,n;return Object(C.a)(this,i),(r=e.call(this,t)).popupRef=o.createRef(),r.triggerRef=o.createRef(),r.attachId=void 0,r.clickOutsideHandler=void 0,r.touchOutsideHandler=void 0,r.contextMenuOutsideHandler1=void 0,r.contextMenuOutsideHandler2=void 0,r.mouseDownTimeout=void 0,r.focusTime=void 0,r.preClickTime=void 0,r.preTouchTime=void 0,r.delayTimer=void 0,r.hasPopupMouseDown=void 0,r.onMouseEnter=function(t){var e=r.props.mouseEnterDelay;r.fireEvents("onMouseEnter",t),r.delaySetPopupVisible(!0,e,e?null:t)},r.onMouseMove=function(t){r.fireEvents("onMouseMove",t),r.setPoint(t)},r.onMouseLeave=function(t){r.fireEvents("onMouseLeave",t),r.delaySetPopupVisible(!1,r.props.mouseLeaveDelay)},r.onPopupMouseEnter=function(){r.clearDelayTimer()},r.onPopupMouseLeave=function(t){var e;t.relatedTarget&&!t.relatedTarget.setTimeout&&Object(ot.a)(null===(e=r.popupRef.current)||void 0===e?void 0:e.getElement(),t.relatedTarget)||r.delaySetPopupVisible(!1,r.props.mouseLeaveDelay)},r.onFocus=function(t){r.fireEvents("onFocus",t),r.clearDelayTimer(),r.isFocusToShow()&&(r.focusTime=Date.now(),r.delaySetPopupVisible(!0,r.props.focusDelay))},r.onMouseDown=function(t){r.fireEvents("onMouseDown",t),r.preClickTime=Date.now()},r.onTouchStart=function(t){r.fireEvents("onTouchStart",t),r.preTouchTime=Date.now()},r.onBlur=function(t){r.fireEvents("onBlur",t),r.clearDelayTimer(),r.isBlurToHide()&&r.delaySetPopupVisible(!1,r.props.blurDelay)},r.onContextMenu=function(t){t.preventDefault(),r.fireEvents("onContextMenu",t),r.setPopupVisible(!0,t)},r.onContextMenuClose=function(){r.isContextMenuToShow()&&r.close()},r.onClick=function(t){if(r.fireEvents("onClick",t),r.focusTime){var e;if(r.preClickTime&&r.preTouchTime?e=Math.min(r.preClickTime,r.preTouchTime):r.preClickTime?e=r.preClickTime:r.preTouchTime&&(e=r.preTouchTime),Math.abs(e-r.focusTime)<20)return;r.focusTime=0}r.preClickTime=0,r.preTouchTime=0,r.isClickToShow()&&(r.isClickToHide()||r.isBlurToHide())&&t&&t.preventDefault&&t.preventDefault();var i=!r.state.popupVisible;(r.isClickToHide()&&!i||i&&r.isClickToShow())&&r.setPopupVisible(!r.state.popupVisible,t)},r.onPopupMouseDown=function(){var t;r.hasPopupMouseDown=!0,clearTimeout(r.mouseDownTimeout),r.mouseDownTimeout=window.setTimeout((function(){r.hasPopupMouseDown=!1}),0),r.context&&(t=r.context).onPopupMouseDown.apply(t,arguments)},r.onDocumentClick=function(t){if(!r.props.mask||r.props.maskClosable){var e=t.target,i=r.getRootDomNode(),n=r.getPopupDomNode();Object(ot.a)(i,e)&&!r.isContextMenuOnly()||Object(ot.a)(n,e)||r.hasPopupMouseDown||r.close()}},r.getRootDomNode=function(){var t=r.props.getTriggerDOMNode;if(t)return t(r.triggerRef.current);try{var e=Object(lt.a)(r.triggerRef.current);if(e)return e}catch(t){}return st.a.findDOMNode(Object(w.a)(r))},r.getPopupClassNameFromAlign=function(t){var e=[],i=r.props,n=i.popupPlacement,s=i.builtinPlacements,a=i.prefixCls,o=i.alignPoint,l=i.getPopupClassNameFromAlign;return n&&s&&e.push(function(t,e,i,r){for(var n=i.points,s=Object.keys(t),a=0;a<s.length;a+=1){var o=s[a];if(dt(t[o].points,n,r))return"".concat(e,"-placement-").concat(o)}return""}(s,a,t,o)),l&&e.push(l(t)),e.join(" ")},r.getComponent=function(){var t=r.props,e=t.prefixCls,i=t.destroyPopupOnHide,n=t.popupClassName,s=t.onPopupAlign,a=t.popupMotion,l=t.popupAnimation,c=t.popupTransitionName,u=t.popupStyle,h=t.mask,d=t.maskAnimation,f=t.maskTransitionName,p=t.maskMotion,g=t.zIndex,v=t.popup,m=t.stretch,y=t.alignPoint,b=t.mobile,E=t.forceRender,C=r.state,k=C.popupVisible,w=C.point,x=r.getPopupAlign(),T={};return r.isMouseEnterToShow()&&(T.onMouseEnter=r.onPopupMouseEnter),r.isMouseLeaveToHide()&&(T.onMouseLeave=r.onPopupMouseLeave),T.onMouseDown=r.onPopupMouseDown,T.onTouchStart=r.onPopupMouseDown,o.createElement(ee,Object(S.a)({prefixCls:e,destroyPopupOnHide:i,visible:k,point:y&&w,className:n,align:x,onAlign:s,animation:l,getClassNameFromAlign:r.getPopupClassNameFromAlign},T,{stretch:m,getRootDomNode:r.getRootDomNode,style:u,mask:h,zIndex:g,transitionName:c,maskAnimation:d,maskTransitionName:f,maskMotion:p,ref:r.popupRef,motion:a,mobile:b,forceRender:E}),"function"==typeof v?v():v)},r.attachParent=function(t){at.a.cancel(r.attachId);var e,i=r.props,n=i.getPopupContainer,s=i.getDocument,a=r.getRootDomNode();n?(a||0===n.length)&&(e=n(a)):e=s(r.getRootDomNode()).body,e?e.appendChild(t):r.attachId=Object(at.a)((function(){r.attachParent(t)}))},r.getContainer=function(){var t=(0,r.props.getDocument)(r.getRootDomNode()).createElement("div");return t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.width="100%",r.attachParent(t),t},r.setPoint=function(t){r.props.alignPoint&&t&&r.setState({point:{pageX:t.pageX,pageY:t.pageY}})},r.handlePortalUpdate=function(){r.state.prevPopupVisible!==r.state.popupVisible&&r.props.afterPopupVisibleChange(r.state.popupVisible)},r.triggerContextValue={onPopupMouseDown:r.onPopupMouseDown},n="popupVisible"in t?!!t.popupVisible:!!t.defaultPopupVisible,r.state={prevPopupVisible:n,popupVisible:n},ae.forEach((function(t){r["fire".concat(t)]=function(e){r.fireEvents(t,e)}})),r}return Object(k.a)(i,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var t,e=this.props;if(this.state.popupVisible)return this.clickOutsideHandler||!this.isClickToHide()&&!this.isContextMenuToShow()||(t=e.getDocument(this.getRootDomNode()),this.clickOutsideHandler=Object(ut.a)(t,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(t=t||e.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Object(ut.a)(t,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(t=t||e.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=Object(ut.a)(t,"scroll",this.onContextMenuClose)),void(!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=Object(ut.a)(window,"blur",this.onContextMenuClose)));this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),at.a.cancel(this.attachId)}},{key:"getPopupDomNode",value:function(){var t;return(null===(t=this.popupRef.current)||void 0===t?void 0:t.getElement())||null}},{key:"getPopupAlign",value:function(){var t=this.props,e=t.popupPlacement,i=t.popupAlign,r=t.builtinPlacements;return e&&r?function(t,e,i){var r=t[e]||{};return Object(a.a)(Object(a.a)({},r),i)}(r,e,i):i}},{key:"setPopupVisible",value:function(t,e){var i=this.props.alignPoint,r=this.state.popupVisible;this.clearDelayTimer(),r!==t&&("popupVisible"in this.props||this.setState({popupVisible:t,prevPopupVisible:r}),this.props.onPopupVisibleChange(t)),i&&e&&t&&this.setPoint(e)}},{key:"delaySetPopupVisible",value:function(t,e,i){var r=this,n=1e3*e;if(this.clearDelayTimer(),n){var s=i?{pageX:i.pageX,pageY:i.pageY}:null;this.delayTimer=window.setTimeout((function(){r.setPopupVisible(t,s),r.clearDelayTimer()}),n)}else this.setPopupVisible(t,i)}},{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(t){var e=this.props.children.props,i=this.props;return e[t]&&i[t]?this["fire".concat(t)]:e[t]||i[t]}},{key:"isClickToShow",value:function(){var t=this.props,e=t.action,i=t.showAction;return-1!==e.indexOf("click")||-1!==i.indexOf("click")}},{key:"isContextMenuOnly",value:function(){var t=this.props.action;return"contextMenu"===t||1===t.length&&"contextMenu"===t[0]}},{key:"isContextMenuToShow",value:function(){var t=this.props,e=t.action,i=t.showAction;return-1!==e.indexOf("contextMenu")||-1!==i.indexOf("contextMenu")}},{key:"isClickToHide",value:function(){var t=this.props,e=t.action,i=t.hideAction;return-1!==e.indexOf("click")||-1!==i.indexOf("click")}},{key:"isMouseEnterToShow",value:function(){var t=this.props,e=t.action,i=t.showAction;return-1!==e.indexOf("hover")||-1!==i.indexOf("mouseEnter")}},{key:"isMouseLeaveToHide",value:function(){var t=this.props,e=t.action,i=t.hideAction;return-1!==e.indexOf("hover")||-1!==i.indexOf("mouseLeave")}},{key:"isFocusToShow",value:function(){var t=this.props,e=t.action,i=t.showAction;return-1!==e.indexOf("focus")||-1!==i.indexOf("focus")}},{key:"isBlurToHide",value:function(){var t=this.props,e=t.action,i=t.hideAction;return-1!==e.indexOf("focus")||-1!==i.indexOf("blur")}},{key:"forcePopupAlign",value:function(){var t;this.state.popupVisible&&(null===(t=this.popupRef.current)||void 0===t||t.forceAlign())}},{key:"fireEvents",value:function(t,e){var i=this.props.children.props[t];i&&i(e);var r=this.props[t];r&&r(e)}},{key:"close",value:function(){this.setPopupVisible(!1)}},{key:"render",value:function(){var t=this.state.popupVisible,e=this.props,i=e.children,r=e.forceRender,n=e.alignPoint,s=e.className,l=e.autoDestroy,u=o.Children.only(i),h={key:"trigger"};this.isContextMenuToShow()?h.onContextMenu=this.onContextMenu:h.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(h.onClick=this.onClick,h.onMouseDown=this.onMouseDown,h.onTouchStart=this.onTouchStart):(h.onClick=this.createTwoChains("onClick"),h.onMouseDown=this.createTwoChains("onMouseDown"),h.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(h.onMouseEnter=this.onMouseEnter,n&&(h.onMouseMove=this.onMouseMove)):h.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?h.onMouseLeave=this.onMouseLeave:h.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(h.onFocus=this.onFocus,h.onBlur=this.onBlur):(h.onFocus=this.createTwoChains("onFocus"),h.onBlur=this.createTwoChains("onBlur"));var d=c()(u&&u.props&&u.props.className,s);d&&(h.className=d);var f=Object(a.a)({},h);Object(ct.c)(u)&&(f.ref=Object(ct.a)(this.triggerRef,u.ref));var p,g=o.cloneElement(u,f);return(t||this.popupRef.current||r)&&(p=o.createElement(oe,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!t&&l&&(p=null),o.createElement(ie.Provider,{value:this.triggerContextValue},g,p)}}],[{key:"getDerivedStateFromProps",value:function(t,e){var i=t.popupVisible,r={};return void 0!==i&&e.popupVisible!==i&&(r.popupVisible=i,r.prevPopupVisible=e.popupVisible),r}}]),i}(o.Component)).contextType=ie,le.defaultProps={prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:ne,getDocument:se,onPopupVisibleChange:re,afterPopupVisibleChange:re,onPopupAlign:re,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[],autoDestroy:!1},le),ue={adjustX:1,adjustY:1},he={topLeft:{points:["bl","tl"],overflow:ue,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:ue,offset:[0,7]},leftTop:{points:["tr","tl"],overflow:ue,offset:[-4,0]},rightTop:{points:["tl","tr"],overflow:ue,offset:[4,0]}},de={topLeft:{points:["bl","tl"],overflow:ue,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:ue,offset:[0,7]},rightTop:{points:["tr","tl"],overflow:ue,offset:[-4,0]},leftTop:{points:["tl","tr"],overflow:ue,offset:[4,0]}},fe=0,pe={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"},ge=function(t,e,i){var n=Q(e),s=t.getState();t.setState({defaultActiveFirst:Object(a.a)(Object(a.a)({},s.defaultActiveFirst),{},Object(r.a)({},n,i))})},ve=function(t){Object(x.a)(i,t);var e=Object(T.a)(i);function i(t){var r;Object(C.a)(this,i),(r=e.call(this,t)).onDestroy=function(t){r.props.onDestroy(t)},r.onKeyDown=function(t){var e=t.keyCode,i=r.menuInstance,n=r.props.store,s=r.getVisible();if(e===m.a.ENTER)return r.onTitleClick(t),ge(n,r.props.eventKey,!0),!0;if(e===m.a.RIGHT)return s?i.onKeyDown(t):(r.triggerOpenChange(!0),ge(n,r.props.eventKey,!0)),!0;if(e===m.a.LEFT){var a;if(!s)return;return(a=i.onKeyDown(t))||(r.triggerOpenChange(!1),a=!0),a}return!s||e!==m.a.UP&&e!==m.a.DOWN?void 0:i.onKeyDown(t)},r.onOpenChange=function(t){r.props.onOpenChange(t)},r.onPopupVisibleChange=function(t){r.triggerOpenChange(t,t?"mouseenter":"mouseleave")},r.onMouseEnter=function(t){var e=r.props,i=e.eventKey,n=e.onMouseEnter,s=e.store;ge(s,r.props.eventKey,!1),n({key:i,domEvent:t})},r.onMouseLeave=function(t){var e=r.props,i=e.parentMenu,n=e.eventKey,s=e.onMouseLeave;i.subMenuInstance=Object(w.a)(r),s({key:n,domEvent:t})},r.onTitleMouseEnter=function(t){var e=r.props,i=e.eventKey,n=e.onItemHover,s=e.onTitleMouseEnter;n({key:i,hover:!0}),s({key:i,domEvent:t})},r.onTitleMouseLeave=function(t){var e=r.props,i=e.parentMenu,n=e.eventKey,s=e.onItemHover,a=e.onTitleMouseLeave;i.subMenuInstance=Object(w.a)(r),s({key:n,hover:!1}),a({key:n,domEvent:t})},r.onTitleClick=function(t){var e=Object(w.a)(r).props;e.onTitleClick({key:e.eventKey,domEvent:t}),"hover"!==e.triggerSubMenuAction&&(r.triggerOpenChange(!r.getVisible(),"click"),ge(e.store,r.props.eventKey,!1))},r.onSubMenuClick=function(t){"function"==typeof r.props.onClick&&r.props.onClick(r.addKeyPath(t))},r.onSelect=function(t){r.props.onSelect(t)},r.onDeselect=function(t){r.props.onDeselect(t)},r.getPrefixCls=function(){return"".concat(r.props.rootPrefixCls,"-submenu")},r.getActiveClassName=function(){return"".concat(r.getPrefixCls(),"-active")},r.getDisabledClassName=function(){return"".concat(r.getPrefixCls(),"-disabled")},r.getSelectedClassName=function(){return"".concat(r.getPrefixCls(),"-selected")},r.getOpenClassName=function(){return"".concat(r.props.rootPrefixCls,"-submenu-open")},r.getVisible=function(){return r.state.isOpen},r.getMode=function(){return r.state.mode},r.saveMenuInstance=function(t){r.menuInstance=t},r.addKeyPath=function(t){return Object(a.a)(Object(a.a)({},t),{},{keyPath:(t.keyPath||[]).concat(r.props.eventKey)})},r.triggerOpenChange=function(t,e){var i=r.props.eventKey,n=function(){r.onOpenChange({key:i,item:Object(w.a)(r),trigger:e,open:t})};"mouseenter"===e?r.mouseenterTimeout=setTimeout((function(){n()}),0):n()},r.isChildrenSelected=function(){var t={find:!1};return function t(e,i,r){e&&!r.find&&o.Children.forEach(e,(function(e){if(e){var n=e.type;if(!n||!(n.isSubMenu||n.isMenuItem||n.isMenuItemGroup))return;-1!==i.indexOf(e.key)?r.find=!0:e.props.children&&t(e.props.children,i,r)}}))}(r.props.children,r.props.selectedKeys,t),t.find},r.isInlineMode=function(){return"inline"===r.getMode()},r.adjustWidth=function(){if(r.subMenuTitle&&r.menuInstance){var t=nt.findDOMNode(r.menuInstance);t.offsetWidth>=r.subMenuTitle.offsetWidth||(t.style.minWidth="".concat(r.subMenuTitle.offsetWidth,"px"))}},r.saveSubMenuTitle=function(t){r.subMenuTitle=t},r.getBaseProps=function(){var t=Object(w.a)(r).props,e=r.getMode();return{mode:"horizontal"===e?"vertical":e,visible:r.getVisible(),level:t.level+1,inlineIndent:t.inlineIndent,focusable:!1,onClick:r.onSubMenuClick,onSelect:r.onSelect,onDeselect:r.onDeselect,onDestroy:r.onDestroy,selectedKeys:t.selectedKeys,eventKey:"".concat(t.eventKey,"-menu-"),openKeys:t.openKeys,motion:t.motion,onOpenChange:r.onOpenChange,subMenuOpenDelay:t.subMenuOpenDelay,parentMenu:Object(w.a)(r),subMenuCloseDelay:t.subMenuCloseDelay,forceSubMenuRender:t.forceSubMenuRender,triggerSubMenuAction:t.triggerSubMenuAction,builtinPlacements:t.builtinPlacements,defaultActiveFirst:t.store.getState().defaultActiveFirst[Q(t.eventKey)],multiple:t.multiple,prefixCls:t.rootPrefixCls,id:r.internalMenuId,manualRef:r.saveMenuInstance,itemIcon:t.itemIcon,expandIcon:t.expandIcon,direction:t.direction}},r.getMotion=function(t,e){var i=Object(w.a)(r).haveRendered,n=r.props,s=n.motion,o=n.rootPrefixCls;return Object(a.a)(Object(a.a)({},s),{},{leavedClassName:"".concat(o,"-hidden"),removeOnLeave:!1,motionAppear:i||!e||"inline"!==t})};var n=t.store,s=t.eventKey,l=n.getState().defaultActiveFirst;r.isRootMenu=!1;var c=!1;return l&&(c=l[s]),ge(n,s,c),r.state={mode:t.mode,isOpen:t.isOpen},r}return Object(k.a)(i,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var t=this,e=this.props,i=e.mode,r=e.parentMenu,n=e.manualRef,s=e.isOpen,a=function(){t.setState({mode:i,isOpen:s})},o=s!==this.state.isOpen,l=i!==this.state.mode;(l||o)&&(at.a.cancel(this.updateStateRaf),l?this.updateStateRaf=Object(at.a)(a):a()),n&&n(this),"horizontal"===i&&(null==r?void 0:r.isRootMenu)&&s&&(this.minWidthTimeout=setTimeout((function(){return t.adjustWidth()}),0))}},{key:"componentWillUnmount",value:function(){var t=this.props,e=t.onDestroy,i=t.eventKey;e&&e(i),this.minWidthTimeout&&clearTimeout(this.minWidthTimeout),this.mouseenterTimeout&&clearTimeout(this.mouseenterTimeout),at.a.cancel(this.updateStateRaf)}},{key:"renderPopupMenu",value:function(t,e){var i=this.getBaseProps();return o.createElement(Te,Object(S.a)({},i,{id:this.internalMenuId,className:t,style:e}),this.props.children)}},{key:"renderChildren",value:function(){var t=this,e=this.getBaseProps(),i=e.mode,n=e.visible,s=e.forceSubMenuRender,a=e.direction,l=this.getMotion(i,n);if(this.haveRendered=!0,this.haveOpened=this.haveOpened||n||s,!this.haveOpened)return o.createElement("div",null);var u=c()("".concat(e.prefixCls,"-sub"),Object(r.a)({},"".concat(e.prefixCls,"-rtl"),"rtl"===a));return this.isInlineMode()?o.createElement(Gt,Object(S.a)({visible:e.visible,forceRender:s},l),(function(e){var i=e.className,r=e.style,n=c()(u,i);return t.renderPopupMenu(n,r)})):this.renderPopupMenu(u)}},{key:"render",value:function(){var t,e,i,n=Object(a.a)({},this.props),s=this.getVisible(),l=this.getPrefixCls(),u=this.isInlineMode(),h=this.getMode(),d=c()(l,"".concat(l,"-").concat(h),(t={},Object(r.a)(t,n.className,!!n.className),Object(r.a)(t,this.getOpenClassName(),s),Object(r.a)(t,this.getActiveClassName(),n.active||s&&!u),Object(r.a)(t,this.getDisabledClassName(),n.disabled),Object(r.a)(t,this.getSelectedClassName(),this.isChildrenSelected()),t));this.internalMenuId||(n.eventKey?this.internalMenuId="".concat(n.eventKey,"$Menu"):(fe+=1,this.internalMenuId="$__$".concat(fe,"$Menu")));var f={},p={},g={};n.disabled||(f={onMouseLeave:this.onMouseLeave,onMouseEnter:this.onMouseEnter},p={onClick:this.onTitleClick},g={onMouseEnter:this.onTitleMouseEnter,onMouseLeave:this.onTitleMouseLeave});var v={},m="rtl"===n.direction;u&&(m?v.paddingRight=n.inlineIndent*n.level:v.paddingLeft=n.inlineIndent*n.level);var y={};this.getVisible()&&(y={"aria-owns":this.internalMenuId});var b=null;"horizontal"!==h&&(b=this.props.expandIcon,"function"==typeof this.props.expandIcon&&(b=o.createElement(this.props.expandIcon,Object(a.a)({},this.props))));var E=o.createElement("div",Object(S.a)({ref:this.saveSubMenuTitle,style:v,className:"".concat(l,"-title"),role:"button"},g,p,{"aria-expanded":s},y,{"aria-haspopup":"true",title:"string"==typeof n.title?n.title:void 0}),n.title,b||o.createElement("i",{className:"".concat(l,"-arrow")})),C=this.renderChildren(),k=(null===(e=n.parentMenu)||void 0===e?void 0:e.isRootMenu)?n.parentMenu.props.getPopupContainer:function(t){return t.parentNode},w=pe[h],x=n.popupOffset?{offset:n.popupOffset}:{},T=c()((i={},Object(r.a)(i,n.popupClassName,n.popupClassName&&!u),Object(r.a)(i,"".concat(l,"-rtl"),m),i)),O=n.disabled,A=n.triggerSubMenuAction,L=n.subMenuOpenDelay,R=n.forceSubMenuRender,_=n.subMenuCloseDelay,D=n.builtinPlacements;tt.forEach((function(t){return delete n[t]})),delete n.onClick;var I=m?Object(a.a)(Object(a.a)({},de),D):Object(a.a)(Object(a.a)({},he),D);delete n.direction;var M=this.getBaseProps(),P=u?null:this.getMotion(M.mode,M.visible);return o.createElement("li",Object(S.a)({},n,f,{className:d,role:"menuitem"}),o.createElement(ce,{prefixCls:l,popupClassName:c()("".concat(l,"-popup"),T),getPopupContainer:k,builtinPlacements:I,popupPlacement:w,popupVisible:!u&&s,popupAlign:x,popup:u?null:C,action:O||u?[]:[A],mouseEnterDelay:L,mouseLeaveDelay:_,onPopupVisibleChange:this.onPopupVisibleChange,forceRender:R,popupMotion:P},E),u?C:null)}}]),i}(o.Component);ve.defaultProps={onMouseEnter:$,onMouseLeave:$,onTitleMouseEnter:$,onTitleMouseLeave:$,onTitleClick:$,manualRef:$,mode:"vertical",title:""};var me=Object(O.b)((function(t,e){var i=t.openKeys,r=t.activeKey,n=t.selectedKeys,s=e.eventKey,a=e.subMenuKey;return{isOpen:i.indexOf(s)>-1,active:r[a]===s,selectedKeys:n}}))(ve);me.isSubMenu=!0;var ye=me,be=function(t){Object(x.a)(i,t);var e=Object(T.a)(i);function i(){var t;return Object(C.a)(this,i),(t=e.apply(this,arguments)).resizeObserver=null,t.mutationObserver=null,t.originalTotalWidth=0,t.overflowedItems=[],t.menuItemSizes=[],t.cancelFrameId=null,t.state={lastVisibleIndex:void 0},t.childRef=o.createRef(),t.getMenuItemNodes=function(){var e=t.props.prefixCls,i=t.childRef.current;return i?[].slice.call(i.children).filter((function(t){return t.className.split(" ").indexOf("".concat(e,"-overflowed-submenu"))<0})):[]},t.getOverflowedSubMenuItem=function(e,i,r){var n=t.props,l=n.overflowedIndicator,c=n.level,u=n.mode,h=n.prefixCls,d=n.theme;if(1!==c||"horizontal"!==u)return null;var f=t.props.children[0].props,p=(f.children,f.title,f.style),g=Object(s.a)(f,["children","title","style"]),v=Object(a.a)({},p),m="".concat(e,"-overflowed-indicator"),y="".concat(e,"-overflowed-indicator");0===i.length&&!0!==r?v=Object(a.a)(Object(a.a)({},v),{},{display:"none"}):r&&(v=Object(a.a)(Object(a.a)({},v),{},{visibility:"hidden",position:"absolute"}),m="".concat(m,"-placeholder"),y="".concat(y,"-placeholder"));var b=d?"".concat(h,"-").concat(d):"",E={};return tt.forEach((function(t){void 0!==g[t]&&(E[t]=g[t])})),o.createElement(ye,Object(S.a)({title:l,className:"".concat(h,"-overflowed-submenu"),popupClassName:b},E,{key:m,eventKey:y,disabled:!1,style:v}),i)},t.setChildrenWidthAndResize=function(){if("horizontal"===t.props.mode){var e=t.childRef.current;if(e){var i=e.children;if(i&&0!==i.length){var r=e.children[i.length-1];it(r,"display","inline-block");var n=t.getMenuItemNodes(),s=n.filter((function(t){return t.className.split(" ").indexOf("menuitem-overflowed")>=0}));s.forEach((function(t){it(t,"display","inline-block")})),t.menuItemSizes=n.map((function(t){return et(t,!0)})),s.forEach((function(t){it(t,"display","none")})),t.overflowedIndicatorWidth=et(e.children[e.children.length-1],!0),t.originalTotalWidth=t.menuItemSizes.reduce((function(t,e){return t+e}),0),t.handleResize(),it(r,"display","none")}}}},t.handleResize=function(){if("horizontal"===t.props.mode){var e=t.childRef.current;if(e){var i=et(e);t.overflowedItems=[];var r,n=0;t.originalTotalWidth>i+.5&&(r=-1,t.menuItemSizes.forEach((function(e){(n+=e)+t.overflowedIndicatorWidth<=i&&(r+=1)}))),t.setState({lastVisibleIndex:r})}}},t}return Object(k.a)(i,[{key:"componentDidMount",value:function(){var t=this;if(this.setChildrenWidthAndResize(),1===this.props.level&&"horizontal"===this.props.mode){var e=this.childRef.current;if(!e)return;this.resizeObserver=new rt.default((function(e){e.forEach((function(){var e=t.cancelFrameId;cancelAnimationFrame(e),t.cancelFrameId=requestAnimationFrame(t.setChildrenWidthAndResize)}))})),[].slice.call(e.children).concat(e).forEach((function(e){t.resizeObserver.observe(e)})),"undefined"!=typeof MutationObserver&&(this.mutationObserver=new MutationObserver((function(){t.resizeObserver.disconnect(),[].slice.call(e.children).concat(e).forEach((function(e){t.resizeObserver.observe(e)})),t.setChildrenWidthAndResize()})),this.mutationObserver.observe(e,{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(t){var e=this,i=this.state.lastVisibleIndex;return(t||[]).reduce((function(r,n,s){var a=n;if("horizontal"===e.props.mode){var l=e.getOverflowedSubMenuItem(n.props.eventKey,[]);void 0!==i&&-1!==e.props.className.indexOf("".concat(e.props.prefixCls,"-root"))&&(s>i&&(a=o.cloneElement(n,{style:{display:"none"},eventKey:"".concat(n.props.eventKey,"-hidden"),className:"".concat("menuitem-overflowed")})),s===i+1&&(e.overflowedItems=t.slice(i+1).map((function(t){return o.cloneElement(t,{key:t.props.eventKey,mode:"vertical-left"})})),l=e.getOverflowedSubMenuItem(n.props.eventKey,e.overflowedItems)));var c=[].concat(Object(d.a)(r),[l,a]);return s===t.length-1&&c.push(e.getOverflowedSubMenuItem(n.props.eventKey,[],!0)),c}return[].concat(Object(d.a)(r),[a])}),[])}},{key:"render",value:function(){var t=this.props,e=(t.visible,t.prefixCls,t.overflowedIndicator,t.mode,t.level,t.tag),i=t.children,r=(t.theme,Object(s.a)(t,["visible","prefixCls","overflowedIndicator","mode","level","tag","children","theme"])),n=e;return o.createElement(n,Object(S.a)({ref:this.childRef},r),this.renderChildren(i))}}]),i}(o.Component);be.defaultProps={tag:"div",className:""};var Ee=be;function Se(t,e,i){var n=t.getState();t.setState({activeKey:Object(a.a)(Object(a.a)({},n.activeKey),{},Object(r.a)({},e,i))})}function Ce(t){return t.eventKey||"0-menu-"}function ke(t,e){var i,r=e,n=t.children,s=t.eventKey;if(r&&(Z(n,(function(t,e){t&&t.props&&!t.props.disabled&&r===J(t,s,e)&&(i=!0)})),i))return r;return r=null,t.defaultActiveFirst?(Z(n,(function(t,e){r||!t||t.props.disabled||(r=J(t,s,e))})),r):r}function we(t){if(t){var e=this.instanceArray.indexOf(t);-1!==e?this.instanceArray[e]=t:this.instanceArray.push(t)}}var xe=function(t){Object(x.a)(i,t);var e=Object(T.a)(i);function i(t){var n;return Object(C.a)(this,i),(n=e.call(this,t)).onKeyDown=function(t,e){var i,r=t.keyCode;if(n.getFlatInstanceArray().forEach((function(e){e&&e.props.active&&e.onKeyDown&&(i=e.onKeyDown(t))})),i)return 1;var s=null;return r!==m.a.UP&&r!==m.a.DOWN||(s=n.step(r===m.a.UP?-1:1)),s?(t.preventDefault(),Se(n.props.store,Ce(n.props),s.props.eventKey),"function"==typeof e&&e(s),1):void 0},n.onItemHover=function(t){var e=t.key,i=t.hover;Se(n.props.store,Ce(n.props),i?e:null)},n.onDeselect=function(t){n.props.onDeselect(t)},n.onSelect=function(t){n.props.onSelect(t)},n.onClick=function(t){n.props.onClick(t)},n.onOpenChange=function(t){n.props.onOpenChange(t)},n.onDestroy=function(t){n.props.onDestroy(t)},n.getFlatInstanceArray=function(){return n.instanceArray},n.step=function(t){var e=n.getFlatInstanceArray(),i=n.props.store.getState().activeKey[Ce(n.props)],r=e.length;if(!r)return null;t<0&&(e=e.concat().reverse());var s=-1;if(e.every((function(t,e){return!t||t.props.eventKey!==i||(s=e,!1)})),n.props.defaultActiveFirst||-1===s||(a=e.slice(s,r-1)).length&&!a.every((function(t){return!!t.props.disabled}))){var a,o=(s+1)%r,l=o;do{var c=e[l];if(c&&!c.props.disabled)return c;l=(l+1)%r}while(l!==o);return null}},n.renderCommonMenuItem=function(t,e,i){var r=n.props.store.getState(),s=Object(w.a)(n).props,l=J(t,s.eventKey,e),c=t.props;if(!c||"string"==typeof t.type)return t;var u=l===r.activeKey,h=Object(a.a)(Object(a.a)({mode:c.mode||s.mode,level:s.level,inlineIndent:s.inlineIndent,renderMenuItem:n.renderMenuItem,rootPrefixCls:s.prefixCls,index:e,parentMenu:s.parentMenu,manualRef:c.disabled?void 0:Object(L.a)(t.ref,we.bind(Object(w.a)(n))),eventKey:l,active:!c.disabled&&u,multiple:s.multiple,onClick:function(t){(c.onClick||$)(t),n.onClick(t)},onItemHover:n.onItemHover,motion:s.motion,subMenuOpenDelay:s.subMenuOpenDelay,subMenuCloseDelay:s.subMenuCloseDelay,forceSubMenuRender:s.forceSubMenuRender,onOpenChange:n.onOpenChange,onDeselect:n.onDeselect,onSelect:n.onSelect,builtinPlacements:s.builtinPlacements,itemIcon:c.itemIcon||n.props.itemIcon,expandIcon:c.expandIcon||n.props.expandIcon},i),{},{direction:s.direction});return("inline"===s.mode||q.any)&&(h.triggerSubMenuAction="click"),o.cloneElement(t,Object(a.a)(Object(a.a)({},h),{},{key:l||e}))},n.renderMenuItem=function(t,e,i){if(!t)return null;var r=n.props.store.getState(),s={openKeys:r.openKeys,selectedKeys:r.selectedKeys,triggerSubMenuAction:n.props.triggerSubMenuAction,subMenuKey:i};return n.renderCommonMenuItem(t,e,s)},t.store.setState({activeKey:Object(a.a)(Object(a.a)({},t.store.getState().activeKey),{},Object(r.a)({},t.eventKey,ke(t,t.activeKey)))}),n.instanceArray=[],n}return Object(k.a)(i,[{key:"componentDidMount",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"shouldComponentUpdate",value:function(t){return this.props.visible||t.visible||this.props.className!==t.className||!_()(this.props.style,t.style)}},{key:"componentDidUpdate",value:function(t){var e=this.props,i="activeKey"in e?e.activeKey:e.store.getState().activeKey[Ce(e)],r=ke(e,i);if(r!==i)Se(e.store,Ce(e),r);else if("activeKey"in t){r!==ke(t,t.activeKey)&&Se(e.store,Ce(e),r)}}},{key:"render",value:function(){var t=this,e=Object(S.a)({},this.props);this.instanceArray=[];var i={className:c()(e.prefixCls,e.className,"".concat(e.prefixCls,"-").concat(e.mode)),role:e.role||"menu"};e.id&&(i.id=e.id),e.focusable&&(i.tabIndex=0,i.onKeyDown=this.onKeyDown);var r=e.prefixCls,n=e.eventKey,s=e.visible,a=e.level,l=e.mode,h=e.overflowedIndicator,d=e.theme;return tt.forEach((function(t){return delete e[t]})),delete e.onClick,o.createElement(Ee,Object(S.a)({},e,{prefixCls:r,mode:l,tag:"ul",level:a,theme:d,visible:s,overflowedIndicator:h},i),Object(u.a)(e.children).map((function(e,i){return t.renderMenuItem(e,i,n||"0-menu-")})))}}]),i}(o.Component);xe.defaultProps={prefixCls:"rc-menu",className:"",mode:"vertical",level:1,inlineIndent:24,visible:!0,focusable:!0,style:{},manualRef:$};var Te=Object(O.b)()(xe),Oe=i("Kwbf");function Ae(t,e,i){var r=t.prefixCls,n=t.motion,s=t.defaultMotions,a=void 0===s?{}:s,o=t.openAnimation,l=t.openTransitionName,c=e.switchingModeFromInline;if(n)return n;if("object"===Object(D.a)(o)&&o)Object(Oe.a)(!1,"Object type of `openAnimation` is removed. Please use `motion` instead.");else if("string"==typeof o)return{motionName:"".concat(r,"-open-").concat(o)};if(l)return{motionName:l};var u=a[i];return u||(c?null:a.other)}var Le=function(t){Object(x.a)(i,t);var e=Object(T.a)(i);function i(t){var r;Object(C.a)(this,i),(r=e.call(this,t)).onSelect=function(t){var e=Object(w.a)(r).props;if(e.selectable){var i=r.store.getState().selectedKeys,n=t.key;i=e.multiple?i.concat([n]):[n],"selectedKeys"in e||r.store.setState({selectedKeys:i}),e.onSelect(Object(a.a)(Object(a.a)({},t),{},{selectedKeys:i}))}},r.onClick=function(t){var e=r.getRealMenuMode(),i=Object(w.a)(r),n=i.store,s=i.props.onOpenChange;"inline"===e||"openKeys"in r.props||(n.setState({openKeys:[]}),s([])),r.props.onClick(t)},r.onKeyDown=function(t,e){r.innerMenu.getWrappedInstance().onKeyDown(t,e)},r.onOpenChange=function(t){var e=Object(w.a)(r).props,i=r.store.getState().openKeys.concat(),n=!1,s=function(t){var e=!1;if(t.open)(e=-1===i.indexOf(t.key))&&i.push(t.key);else{var r=i.indexOf(t.key);(e=-1!==r)&&i.splice(r,1)}n=n||e};Array.isArray(t)?t.forEach(s):s(t),n&&("openKeys"in r.props||r.store.setState({openKeys:i}),e.onOpenChange(i))},r.onDeselect=function(t){var e=Object(w.a)(r).props;if(e.selectable){var i=r.store.getState().selectedKeys.concat(),n=t.key,s=i.indexOf(n);-1!==s&&i.splice(s,1),"selectedKeys"in e||r.store.setState({selectedKeys:i}),e.onDeselect(Object(a.a)(Object(a.a)({},t),{},{selectedKeys:i}))}},r.onMouseEnter=function(t){r.restoreModeVerticalFromInline();var e=r.props.onMouseEnter;e&&e(t)},r.onTransitionEnd=function(t){var e="width"===t.propertyName&&t.target===t.currentTarget,i=t.target.className,n="[object SVGAnimatedString]"===Object.prototype.toString.call(i)?i.animVal:i,s="font-size"===t.propertyName&&n.indexOf("anticon")>=0;(e||s)&&r.restoreModeVerticalFromInline()},r.setInnerMenu=function(t){r.innerMenu=t},r.isRootMenu=!0;var n=t.defaultSelectedKeys,s=t.defaultOpenKeys;return"selectedKeys"in t&&(n=t.selectedKeys||[]),"openKeys"in t&&(s=t.openKeys||[]),r.store=Object(O.c)({selectedKeys:n,openKeys:s,activeKey:{"0-menu-":ke(t,t.activeKey)}}),r.state={switchingModeFromInline:!1,prevProps:t,inlineOpenKeys:[],store:r.store},r}return Object(k.a)(i,[{key:"componentDidMount",value:function(){this.updateMiniStore(),this.updateMenuDisplay()}},{key:"componentDidUpdate",value:function(t){var e=this.props,i=e.siderCollapsed,r=e.inlineCollapsed,n=e.onOpenChange;(!t.inlineCollapsed&&r||!t.siderCollapsed&&i)&&n([]),this.updateMiniStore(),this.updateMenuDisplay()}},{key:"updateMenuDisplay",value:function(){var t=this.props.collapsedWidth,e=this.store,i=this.prevOpenKeys;this.getInlineCollapsed()&&(0===t||"0"===t||"0px"===t)?(this.prevOpenKeys=e.getState().openKeys.concat(),this.store.setState({openKeys:[]})):i&&(this.store.setState({openKeys:i}),this.prevOpenKeys=null)}},{key:"getRealMenuMode",value:function(){var t=this.props.mode,e=this.state.switchingModeFromInline,i=this.getInlineCollapsed();return e&&i?"inline":i?"vertical":t}},{key:"getInlineCollapsed",value:function(){var t=this.props,e=t.inlineCollapsed,i=t.siderCollapsed;return void 0!==i?i:e}},{key:"restoreModeVerticalFromInline",value:function(){this.state.switchingModeFromInline&&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 t=Object(a.a)({},Object(A.a)(this.props,["collapsedWidth","siderCollapsed","defaultMotions"])),e=this.getRealMenuMode();return t.className+=" ".concat(t.prefixCls,"-root"),"rtl"===t.direction&&(t.className+=" ".concat(t.prefixCls,"-rtl")),delete(t=Object(a.a)(Object(a.a)({},t),{},{mode:e,onClick:this.onClick,onOpenChange:this.onOpenChange,onDeselect:this.onDeselect,onSelect:this.onSelect,onMouseEnter:this.onMouseEnter,onTransitionEnd:this.onTransitionEnd,parentMenu:this,motion:Ae(this.props,this.state,e)})).openAnimation,delete t.openTransitionName,o.createElement(O.a,{store:this.store},o.createElement(Te,Object(S.a)({},t,{ref:this.setInnerMenu}),this.props.children))}}],[{key:"getDerivedStateFromProps",value:function(t,e){var i=e.prevProps,r=e.store,n=r.getState(),s={},a={prevProps:t};return"inline"===i.mode&&"inline"!==t.mode&&(a.switchingModeFromInline=!0),"openKeys"in t?s.openKeys=t.openKeys||[]:((t.inlineCollapsed&&!i.inlineCollapsed||t.siderCollapsed&&!i.siderCollapsed)&&(a.switchingModeFromInline=!0,a.inlineOpenKeys=n.openKeys,s.openKeys=[]),(!t.inlineCollapsed&&i.inlineCollapsed||!t.siderCollapsed&&i.siderCollapsed)&&(s.openKeys=e.inlineOpenKeys,a.inlineOpenKeys=[])),Object.keys(s).length&&r.setState(s),a}}]),i}(o.Component);Le.defaultProps={selectable:!0,onClick:$,onSelect:$,onOpenChange:$,onDeselect:$,defaultSelectedKeys:[],defaultOpenKeys:[],subMenuOpenDelay:.1,subMenuCloseDelay:.1,triggerSubMenuAction:"hover",prefixCls:"rc-menu",className:"",mode:"vertical",style:{},builtinPlacements:{},overflowedIndicator:o.createElement("span",null,"···")};var Re=Le,_e=function(t){Object(x.a)(i,t);var e=Object(T.a)(i);function i(){var t;return Object(C.a)(this,i),(t=e.apply(this,arguments)).onKeyDown=function(e){if(e.keyCode===m.a.ENTER)return t.onClick(e),!0},t.onMouseLeave=function(e){var i=t.props,r=i.eventKey,n=i.onItemHover,s=i.onMouseLeave;n({key:r,hover:!1}),s({key:r,domEvent:e})},t.onMouseEnter=function(e){var i=t.props,r=i.eventKey,n=i.onItemHover,s=i.onMouseEnter;n({key:r,hover:!0}),s({key:r,domEvent:e})},t.onClick=function(e){var i=t.props,r=i.eventKey,n=i.multiple,s=i.onClick,a=i.onSelect,o=i.onDeselect,l=i.isSelected,c={key:r,keyPath:[r],item:Object(w.a)(t),domEvent:e};s(c),n?l?o(c):a(c):l||a(c)},t.saveNode=function(e){t.node=e},t}return Object(k.a)(i,[{key:"componentDidMount",value:function(){this.callRef()}},{key:"componentDidUpdate",value:function(){this.callRef()}},{key:"componentWillUnmount",value:function(){var t=this.props;t.onDestroy&&t.onDestroy(t.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 t,e=Object(a.a)({},this.props),i=c()(this.getPrefixCls(),e.className,(t={},Object(r.a)(t,this.getActiveClassName(),!e.disabled&&e.active),Object(r.a)(t,this.getSelectedClassName(),e.isSelected),Object(r.a)(t,this.getDisabledClassName(),e.disabled),t)),n=Object(a.a)(Object(a.a)({},e.attribute),{},{title:"string"==typeof e.title?e.title:void 0,className:i,role:e.role||"menuitem","aria-disabled":e.disabled});"option"===e.role?n=Object(a.a)(Object(a.a)({},n),{},{role:"option","aria-selected":e.isSelected}):null!==e.role&&"none"!==e.role||(n.role="none");var s={onClick:e.disabled?null:this.onClick,onMouseLeave:e.disabled?null:this.onMouseLeave,onMouseEnter:e.disabled?null:this.onMouseEnter},l=Object(a.a)({},e.style);"inline"===e.mode&&("rtl"===e.direction?l.paddingRight=e.inlineIndent*e.level:l.paddingLeft=e.inlineIndent*e.level),tt.forEach((function(t){return delete e[t]})),delete e.direction;var u=this.props.itemIcon;return"function"==typeof this.props.itemIcon&&(u=o.createElement(this.props.itemIcon,this.props)),o.createElement("li",Object(S.a)({},Object(A.a)(e,["onClick","onMouseEnter","onMouseLeave","onSelect"]),n,s,{style:l,ref:this.saveNode}),e.children,u)}}]),i}(o.Component);_e.isMenuItem=!0,_e.defaultProps={onSelect:$,onMouseEnter:$,onMouseLeave:$,manualRef:$};var De=Object(O.b)((function(t,e){var i=t.activeKey,r=t.selectedKeys,n=e.eventKey;return{active:i[e.subMenuKey]===n,isSelected:Array.isArray(r)?-1!==r.indexOf(n):r===n}}))(_e),Ie=function(t){Object(x.a)(i,t);var e=Object(T.a)(i);function i(){var t;return Object(C.a)(this,i),(t=e.apply(this,arguments)).renderInnerMenuItem=function(e){var i=t.props;return(0,i.renderMenuItem)(e,i.index,t.props.subMenuKey)},t}return Object(k.a)(i,[{key:"render",value:function(){var t=Object(S.a)({},this.props),e=t.className,i=void 0===e?"":e,r=t.rootPrefixCls,n="".concat(r,"-item-group-title"),s="".concat(r,"-item-group-list"),a=t.title,l=t.children;return tt.forEach((function(e){return delete t[e]})),delete t.direction,o.createElement("li",Object(S.a)({},t,{onClick:function(t){return t.stopPropagation()},className:"".concat(i," ").concat(r,"-item-group")}),o.createElement("div",{className:n,title:"string"==typeof a?a:void 0},a),o.createElement("ul",{className:s},o.Children.map(l,this.renderInnerMenuItem)))}}]),i}(o.Component);Ie.isMenuItemGroup=!0,Ie.defaultProps={disabled:!0};var Me=function(t){var e=t.className,i=t.rootPrefixCls,r=t.style;return o.createElement("li",{className:"".concat(e," ").concat(i,"-item-divider"),style:r})};Me.defaultProps={disabled:!0,className:"",style:{}};var Pe=Re,Ne=i("eDIo");var je=o.forwardRef((function(t,e){var i=t.prefixCls,r=t.editable,n=t.locale,s=t.style;return r&&!1!==r.showAdd?o.createElement("button",{ref:e,type:"button",className:"".concat(i,"-nav-add"),style:s,"aria-label":(null==n?void 0:n.addAriaLabel)||"Add tab",onClick:function(t){r.onEdit("add",{event:t})}},r.addIcon||"+"):null}));var Be=o.forwardRef((function(t,e){var i=t.prefixCls,s=t.id,a=t.tabs,l=t.locale,u=t.mobile,h=t.moreIcon,d=void 0===h?"More":h,f=t.moreTransitionName,p=t.style,g=t.className,v=t.editable,y=t.tabBarGutter,b=t.rtl,E=t.onTabClick,S=Object(o.useState)(!1),C=Object(n.a)(S,2),k=C[0],w=C[1],x=Object(o.useState)(null),T=Object(n.a)(x,2),O=T[0],A=T[1],L="".concat(s,"-more-popup"),R="".concat(i,"-dropdown"),_=null!==O?"".concat(L,"-").concat(O):null,D=null==l?void 0:l.dropdownAriaLabel,I=o.createElement(Pe,{onClick:function(t){var e=t.key,i=t.domEvent;E(e,i),w(!1)},id:L,tabIndex:-1,role:"listbox","aria-activedescendant":_,selectedKeys:[O],"aria-label":void 0!==D?D:"expanded dropdown"},a.map((function(t){return o.createElement(De,{key:t.key,id:"".concat(L,"-").concat(t.key),role:"option","aria-controls":s&&"".concat(s,"-panel-").concat(t.key),disabled:t.disabled},t.tab)})));function M(t){for(var e=a.filter((function(t){return!t.disabled})),i=e.findIndex((function(t){return t.key===O}))||0,r=e.length,n=0;n<r;n+=1){var s=e[i=(i+t+r)%r];if(!s.disabled)return void A(s.key)}}Object(o.useEffect)((function(){var t=document.getElementById(_);t&&t.scrollIntoView&&t.scrollIntoView(!1)}),[O]),Object(o.useEffect)((function(){k||A(null)}),[k]);var P=Object(r.a)({},b?"marginLeft":"marginRight",y);a.length||(P.visibility="hidden",P.order=1);var N=c()(Object(r.a)({},"".concat(R,"-rtl"),b)),j=u?null:o.createElement(Ne.a,{prefixCls:R,overlay:I,trigger:["hover"],visible:k,transitionName:f,onVisibleChange:w,overlayClassName:N,mouseEnterDelay:.1,mouseLeaveDelay:.1},o.createElement("button",{type:"button",className:"".concat(i,"-nav-more"),style:P,tabIndex:-1,"aria-hidden":"true","aria-haspopup":"listbox","aria-controls":L,id:"".concat(s,"-more"),"aria-expanded":k,onKeyDown:function(t){var e=t.which;if(k)switch(e){case m.a.UP:M(-1),t.preventDefault();break;case m.a.DOWN:M(1),t.preventDefault();break;case m.a.ESC:w(!1);break;case m.a.SPACE:case m.a.ENTER:null!==O&&E(O,t)}else[m.a.DOWN,m.a.SPACE,m.a.ENTER].includes(e)&&(w(!0),t.preventDefault())}},d));return o.createElement("div",{className:c()("".concat(i,"-nav-operations"),g),style:p,ref:e},j,o.createElement(je,{prefixCls:i,locale:l,editable:v}))})),Fe=Object(o.createContext)(null),Ue=Math.pow(.995,20);function Ge(t,e){var i=o.useRef(t),r=o.useState({}),s=Object(n.a)(r,2)[1];return[i.current,function(t){var r="function"==typeof t?t(i.current):t;r!==i.current&&e(r,i.current),i.current=r,s({})}]}var He=function(t){var e,i=t.position,r=t.prefixCls,n=t.extra;if(!n)return null;var s=n;return"right"===i&&(e=s.right||!s.left&&s||null),"left"===i&&(e=s.left||null),e?o.createElement("div",{className:"".concat(r,"-extra-content")},e):null};var ze=o.forwardRef((function(t,e){var i,s,l=o.useContext(Fe),u=l.prefixCls,h=l.tabs,f=t.className,m=t.style,S=t.id,C=t.animated,k=t.activeKey,w=t.rtl,x=t.extra,T=t.editable,O=t.locale,A=t.tabPosition,L=t.tabBarGutter,R=t.children,_=t.onTabClick,D=t.onTabScroll,I=Object(o.useRef)(),M=Object(o.useRef)(),P=Object(o.useRef)(),N=Object(o.useRef)(),j=(s=Object(o.useRef)(new Map),[function(t){return s.current.has(t)||s.current.set(t,o.createRef()),s.current.get(t)},function(t){s.current.delete(t)}]),B=Object(n.a)(j,2),F=B[0],U=B[1],G="top"===A||"bottom"===A,H=Ge(0,(function(t,e){G&&D&&D({direction:t>e?"left":"right"})})),z=Object(n.a)(H,2),V=z[0],K=z[1],W=Ge(0,(function(t,e){!G&&D&&D({direction:t>e?"top":"bottom"})})),Y=Object(n.a)(W,2),X=Y[0],q=Y[1],$=Object(o.useState)(0),J=Object(n.a)($,2),Q=J[0],Z=J[1],tt=Object(o.useState)(0),et=Object(n.a)(tt,2),it=et[0],rt=et[1],nt=Object(o.useState)(0),st=Object(n.a)(nt,2),at=st[0],ot=st[1],lt=Object(o.useState)(0),ct=Object(n.a)(lt,2),ut=ct[0],ht=ct[1],dt=Object(o.useState)(null),ft=Object(n.a)(dt,2),pt=ft[0],gt=ft[1],vt=Object(o.useState)(null),mt=Object(n.a)(vt,2),yt=mt[0],bt=mt[1],Et=Object(o.useState)(0),St=Object(n.a)(Et,2),Ct=St[0],kt=St[1],wt=Object(o.useState)(0),xt=Object(n.a)(wt,2),Tt=xt[0],Ot=xt[1],At=function(t){var e=Object(o.useRef)([]),i=Object(o.useState)({}),r=Object(n.a)(i,2)[1],s=Object(o.useRef)("function"==typeof t?t():t),a=v((function(){var t=s.current;e.current.forEach((function(e){t=e(t)})),e.current=[],s.current=t,r({})}));return[s.current,function(t){e.current.push(t),a()}]}(new Map),Lt=Object(n.a)(At,2),Rt=Lt[0],_t=Lt[1],Dt=function(t,e,i){return Object(o.useMemo)((function(){for(var i,r=new Map,n=e.get(null===(i=t[0])||void 0===i?void 0:i.key)||b,s=n.left+n.width,o=0;o<t.length;o+=1){var l,c=t[o].key,u=e.get(c);if(!u)u=e.get(null===(l=t[o-1])||void 0===l?void 0:l.key)||b;var h=r.get(c)||Object(a.a)({},u);h.right=s-h.left-h.width,r.set(c,h)}return r}),[t.map((function(t){return t.key})).join("_"),e,i])}(h,Rt,Q),It="".concat(u,"-nav-operations-hidden"),Mt=0,Pt=0;function Nt(t){return t<Mt?[Mt,!1]:t>Pt?[Pt,!1]:[t,!0]}G?w?(Mt=0,Pt=Math.max(0,Q-pt)):(Mt=Math.min(0,pt-Q),Pt=0):(Mt=Math.min(0,yt-it),Pt=0);var jt=Object(o.useRef)(),Bt=Object(o.useState)(),Ft=Object(n.a)(Bt,2),Ut=Ft[0],Gt=Ft[1];function Ht(){Gt(Date.now())}function zt(){window.clearTimeout(jt.current)}function Vt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:k,e=Dt.get(t);if(e)if(G){var i=V;w?e.right<V?i=e.right:e.right+e.width>V+pt&&(i=e.right+e.width-pt):e.left<-V?i=-e.left:e.left+e.width>-V+pt&&(i=-(e.left+e.width-pt)),q(0),K(Nt(i)[0])}else{var r=X;e.top<-X?r=-e.top:e.top+e.height>-X+yt&&(r=-(e.top+e.height-yt)),K(0),q(Nt(r)[0])}}!function(t,e){var i=Object(o.useState)(),r=Object(n.a)(i,2),s=r[0],a=r[1],l=Object(o.useState)(0),c=Object(n.a)(l,2),u=c[0],h=c[1],d=Object(o.useState)(0),f=Object(n.a)(d,2),p=f[0],g=f[1],v=Object(o.useState)(),m=Object(n.a)(v,2),y=m[0],b=m[1],E=Object(o.useRef)(),S=Object(o.useRef)(0),C=Object(o.useRef)(!1),k=Object(o.useRef)(),w=Object(o.useRef)(null);w.current={onTouchStart:function(t){var e=t.touches[0],i=e.screenX,r=e.screenY;a({x:i,y:r}),window.clearInterval(E.current)},onTouchMove:function(t){if(s){t.preventDefault();var i=t.touches[0],r=i.screenX,n=i.screenY;a({x:r,y:n});var o=r-s.x,l=n-s.y;e(o,l);var c=Date.now();h(c),g(c-u),b({x:o,y:l})}},onTouchEnd:function(){if(s&&(a(null),b(null),y)){var t=y.x/p,i=y.y/p,r=Math.abs(t),n=Math.abs(i);if(Math.max(r,n)<.1)return;var o=t,l=i;E.current=window.setInterval((function(){Math.abs(o)<.01&&Math.abs(l)<.01?window.clearInterval(E.current):e(20*(o*=Ue),20*(l*=Ue))}),20)}},onWheel:function(t){var i=t.deltaX,r=t.deltaY,n=0,s=Math.abs(i),a=Math.abs(r);s===a?n="x"===k.current?i:r:s>a?(n=i,k.current="x"):(n=r,k.current="y");var o=Date.now();o-S.current>100&&(C.current=!1),(e(-n,-n)||C.current)&&(t.preventDefault(),C.current=!0),S.current=o}},o.useEffect((function(){function e(t){w.current.onTouchMove(t)}function i(t){w.current.onTouchEnd(t)}return document.addEventListener("touchmove",e,{passive:!1}),document.addEventListener("touchend",i,{passive:!1}),t.current.addEventListener("touchstart",(function(t){w.current.onTouchStart(t)}),{passive:!1}),t.current.addEventListener("wheel",(function(t){w.current.onWheel(t)})),function(){document.removeEventListener("touchmove",e),document.removeEventListener("touchend",i)}}),[])}(I,(function(t,e){var i=!1;function r(t,e){t((function(t){var r=Nt(t+e),s=Object(n.a)(r,2),a=s[0],o=s[1];return i=o,a}))}if(G){if(pt>=Q)return i;r(K,t)}else{if(yt>=it)return i;r(q,e)}return zt(),Ht(),i})),Object(o.useEffect)((function(){return zt(),Ut&&(jt.current=window.setTimeout((function(){Gt(0)}),100)),zt}),[Ut]);var Kt=function(t,e,i,r,n){var s,a,l,c=n.tabs,u=n.tabPosition,h=n.rtl;["top","bottom"].includes(u)?(s="width",a=h?"right":"left",l=Math.abs(e.left)):(s="height",a="top",l=-e.top);var d=e[s],f=i[s],p=r[s],g=d;return f+p>d&&(g=d-p),Object(o.useMemo)((function(){if(!c.length)return[0,0];for(var e=c.length,i=e,r=0;r<e;r+=1){var n=t.get(c[r].key)||E;if(n[a]+n[s]>l+g){i=r-1;break}}for(var o=0,u=e-1;u>=0;u-=1){if((t.get(c[u].key)||E)[a]<l){o=u+1;break}}return[o,i]}),[t,l,g,u,c.map((function(t){return t.key})).join("_"),h])}(Dt,{width:pt,height:yt,left:V,top:X},{width:at,height:ut},{width:Ct,height:Tt},Object(a.a)(Object(a.a)({},t),{},{tabs:h})),Wt=Object(n.a)(Kt,2),Yt=Wt[0],Xt=Wt[1],qt=h.map((function(t){var e=t.key;return o.createElement(y,{id:S,prefixCls:u,key:e,rtl:w,tab:t,closable:t.closable,editable:T,active:e===k,tabPosition:A,tabBarGutter:L,renderWrapper:R,removeAriaLabel:null==O?void 0:O.removeAriaLabel,ref:F(e),onClick:function(t){_(e,t)},onRemove:function(){U(e)},onFocus:function(){Vt(e),Ht(),w||(I.current.scrollLeft=0),I.current.scrollTop=0}})})),$t=v((function(){var t,e,i,r,n,s,a,o,l,c=(null===(t=I.current)||void 0===t?void 0:t.offsetWidth)||0,u=(null===(e=I.current)||void 0===e?void 0:e.offsetHeight)||0,d=(null===(i=N.current)||void 0===i?void 0:i.offsetWidth)||0,f=(null===(r=N.current)||void 0===r?void 0:r.offsetHeight)||0,p=(null===(n=P.current)||void 0===n?void 0:n.offsetWidth)||0,g=(null===(s=P.current)||void 0===s?void 0:s.offsetHeight)||0;gt(c),bt(u),kt(d),Ot(f);var v=((null===(a=M.current)||void 0===a?void 0:a.offsetWidth)||0)-d,m=((null===(o=M.current)||void 0===o?void 0:o.offsetHeight)||0)-f;Z(v),rt(m);var y=null===(l=P.current)||void 0===l?void 0:l.className.includes(It);ot(v-(y?0:p)),ht(m-(y?0:g)),_t((function(){var t=new Map;return h.forEach((function(e){var i=e.key,r=F(i).current;r&&t.set(i,{width:r.offsetWidth,height:r.offsetHeight,left:r.offsetLeft,top:r.offsetTop})})),t}))})),Jt=h.slice(0,Yt),Qt=h.slice(Xt+1),Zt=[].concat(Object(d.a)(Jt),Object(d.a)(Qt)),te=Object(o.useState)(),ee=Object(n.a)(te,2),ie=ee[0],re=ee[1],ne=Dt.get(k),se=Object(o.useRef)();function ae(){p.a.cancel(se.current)}Object(o.useEffect)((function(){var t={};return ne&&(G?(w?t.right=ne.right:t.left=ne.left,t.width=ne.width):(t.top=ne.top,t.height=ne.height)),ae(),se.current=p()((function(){re(t)})),ae}),[ne,G,w]),Object(o.useEffect)((function(){Vt()}),[k,ne,Dt,G]),Object(o.useEffect)((function(){$t()}),[w,L,k,h.map((function(t){return t.key})).join("_")]);var oe,le,ce,ue,he=!!Zt.length,de="".concat(u,"-nav-wrap");return G?w?(le=V>0,oe=V+pt<Q):(oe=V<0,le=-V+pt<Q):(ce=X<0,ue=-X+yt<it),o.createElement("div",{ref:e,role:"tablist",className:c()("".concat(u,"-nav"),f),style:m,onKeyDown:function(){Ht()}},o.createElement(He,{position:"left",extra:x,prefixCls:u}),o.createElement(g.a,{onResize:$t},o.createElement("div",{className:c()(de,(i={},Object(r.a)(i,"".concat(de,"-ping-left"),oe),Object(r.a)(i,"".concat(de,"-ping-right"),le),Object(r.a)(i,"".concat(de,"-ping-top"),ce),Object(r.a)(i,"".concat(de,"-ping-bottom"),ue),i)),ref:I},o.createElement(g.a,{onResize:$t},o.createElement("div",{ref:M,className:"".concat(u,"-nav-list"),style:{transform:"translate(".concat(V,"px, ").concat(X,"px)"),transition:Ut?"none":void 0}},qt,o.createElement(je,{ref:N,prefixCls:u,locale:O,editable:T,style:{visibility:he?"hidden":null}}),o.createElement("div",{className:c()("".concat(u,"-ink-bar"),Object(r.a)({},"".concat(u,"-ink-bar-animated"),C.inkBar)),style:ie}))))),o.createElement(Be,Object.assign({},t,{ref:P,prefixCls:u,tabs:Zt,className:!he&&It})),o.createElement(He,{position:"right",extra:x,prefixCls:u}))}));function Ve(t){var e=t.id,i=t.activeKey,n=t.animated,s=t.tabPosition,a=t.rtl,l=t.destroyInactiveTabPane,u=o.useContext(Fe),h=u.prefixCls,d=u.tabs,f=n.tabPane,p=d.findIndex((function(t){return t.key===i}));return o.createElement("div",{className:c()("".concat(h,"-content-holder"))},o.createElement("div",{className:c()("".concat(h,"-content"),"".concat(h,"-content-").concat(s),Object(r.a)({},"".concat(h,"-content-animated"),f)),style:p&&f?Object(r.a)({},a?"marginRight":"marginLeft","-".concat(p,"00%")):null},d.map((function(t){return o.cloneElement(t.node,{key:t.key,prefixCls:h,tabKey:t.key,id:e,animated:f,active:t.key===i,destroyInactiveTabPane:l})}))))}function Ke(t){var e=t.prefixCls,i=t.forceRender,r=t.className,s=t.style,l=t.id,u=t.active,h=t.animated,d=t.destroyInactiveTabPane,f=t.tabKey,p=t.children,g=o.useState(i),v=Object(n.a)(g,2),m=v[0],y=v[1];o.useEffect((function(){u?y(!0):d&&y(!1)}),[u,d]);var b={};return u||(h?(b.visibility="hidden",b.height=0,b.overflowY="hidden"):b.display="none"),o.createElement("div",{id:l&&"".concat(l,"-panel-").concat(f),role:"tabpanel",tabIndex:u?0:-1,"aria-labelledby":l&&"".concat(l,"-tab-").concat(f),"aria-hidden":!u,style:Object(a.a)(Object(a.a)({},b),s),className:c()("".concat(e,"-tabpane"),u&&"".concat(e,"-tabpane-active"),r)},(u||m||i)&&p)}var We=0;var Ye=o.forwardRef((function(t,e){var i,l,d=t.id,f=t.prefixCls,p=void 0===f?"rc-tabs":f,g=t.className,v=t.children,m=t.direction,y=t.activeKey,b=t.defaultActiveKey,E=t.editable,S=t.animated,C=t.tabPosition,k=void 0===C?"top":C,w=t.tabBarGutter,x=t.tabBarStyle,T=t.tabBarExtraContent,O=t.locale,A=t.moreIcon,L=t.moreTransitionName,R=t.destroyInactiveTabPane,_=t.renderTabBar,D=t.onChange,I=t.onTabClick,M=t.onTabScroll,P=Object(s.a)(t,["id","prefixCls","className","children","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","moreIcon","moreTransitionName","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll"]),N=function(t){return Object(u.a)(t).map((function(t){if(o.isValidElement(t)){var e=void 0!==t.key?String(t.key):void 0;return Object(a.a)(Object(a.a)({key:e},t.props),{},{node:t})}return null})).filter((function(t){return t}))}(v),j="rtl"===m;l=!1===S?{inkBar:!1,tabPane:!1}:Object(a.a)({inkBar:!0,tabPane:!1},!0!==S?S:null);var B=Object(o.useState)(!1),F=Object(n.a)(B,2),U=F[0],G=F[1];Object(o.useEffect)((function(){var t;G((t=navigator.userAgent||navigator.vendor||window.opera,!(!/(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(t)&&!/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(t.substr(0,4)))))}),[]);var H=Object(h.a)((function(){var t;return null===(t=N[0])||void 0===t?void 0:t.key}),{value:y,defaultValue:b}),z=Object(n.a)(H,2),V=z[0],K=z[1],W=Object(o.useState)((function(){return N.findIndex((function(t){return t.key===V}))})),Y=Object(n.a)(W,2),X=Y[0],q=Y[1];Object(o.useEffect)((function(){var t,e=N.findIndex((function(t){return t.key===V}));-1===e&&(e=Math.max(0,Math.min(X,N.length-1)),K(null===(t=N[e])||void 0===t?void 0:t.key));q(e)}),[N.map((function(t){return t.key})).join("_"),V,X]);var $=Object(h.a)(null,{value:d}),J=Object(n.a)($,2),Q=J[0],Z=J[1],tt=k;U&&!["left","right"].includes(k)&&(tt="top"),Object(o.useEffect)((function(){d||(Z("rc-tabs-".concat(We)),We+=1)}),[]);var et,it={id:Q,activeKey:V,animated:l,tabPosition:tt,rtl:j,mobile:U},rt=Object(a.a)(Object(a.a)({},it),{},{editable:E,locale:O,moreIcon:A,moreTransitionName:L,tabBarGutter:w,onTabClick:function(t,e){null==I||I(t,e),K(t),null==D||D(t)},onTabScroll:M,extra:T,style:x,panes:v});return et=_?_(rt,ze):o.createElement(ze,Object.assign({},rt)),o.createElement(Fe.Provider,{value:{tabs:N,prefixCls:p}},o.createElement("div",Object.assign({ref:e,id:d,className:c()(p,"".concat(p,"-").concat(tt),(i={},Object(r.a)(i,"".concat(p,"-mobile"),U),Object(r.a)(i,"".concat(p,"-editable"),E),Object(r.a)(i,"".concat(p,"-rtl"),j),i),g)},P),et,o.createElement(Ve,Object.assign({destroyInactiveTabPane:R},it,{animated:l}))))}));Ye.TabPane=Ke;var Xe=Ye;e.b=Xe},n6Qo:
/*!**************************************************************!*\
!*** ./node_modules/rc-table/es/Footer/index.js + 2 modules ***!
\**************************************************************/
/*! exports provided: default, FooterComponents */
/*! exports used: FooterComponents, default */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/Cell/index.js because of ./node_modules/antd/es/table/Table.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/context/TableContext.js because of ./node_modules/antd/es/table/Table.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(t,e,i){"use strict";i.d(e,"a",(function(){return a}));var r=i("q1tI"),n=i("biw7"),s=i("fyJ8");e.b=function(t){var e=t.children,i=r.useContext(n.a).prefixCls;return r.createElement("tfoot",{className:"".concat(i,"-summary")},e)};var a={Cell:function(t){var e=t.className,i=t.index,a=t.children,o=t.colSpan,l=t.rowSpan,c=r.useContext(n.a),u=c.prefixCls,h=c.fixedInfoList[i];return r.createElement(s.a,Object.assign({className:e,index:i,component:"td",prefixCls:u,record:null,dataIndex:null,render:function(){return{children:a,props:{colSpan:o,rowSpan:l}}}},h))},Row:function(t){return r.createElement("tr",Object.assign({},t))}}},p5ED:
/*!*********************************************!*\
!*** ./src/components/PreviewAll/index.tsx ***!
\*********************************************/
/*! exports provided: default */
/*! exports used: default */function(t,e,i){"use strict";i(/*! antd/es/button/style */"+L6B");var r=i(/*! antd/es/button */"2/Rp"),n=(i(/*! antd/es/tooltip/style */"5Dmo"),i(/*! antd/es/tooltip */"3S7+")),s=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2 */"k1fw"),a=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray */"tJVT"),o=i(/*! react */"q1tI"),l=i.n(o),c=i(/*! ./index.less?modules */"vHTk"),u=i.n(c),h=i(/*! @ant-design/icons */"yEEn"),d=i(/*! @/components/monaco-editor */"ZW9T"),f=i(/*! @/utils/util */"1vsH");e.a=function(t){var e=t.name,i=t.data,c=(t.theme,t.type),p=t.filename,g=t.monacoEditor,v=t.className,m=t.style,y=t.close,b=t.onClose,E=t.hasMask,S=Object(o.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),C=Object(a.a)(S,2),k=(C[0],C[1],Object(o.useState)("")),w=Object(a.a)(k,2),x=(w[0],w[1]),T=Object(o.useRef)();p&&(g.filename=p),Object(o.useEffect)((function(){var t,e,i=null===(t=document.cookie)||void 0===t||null===(e=t.replace(/\s/g,""))||void 0===e?void 0:e.split(";");null==i||i.map((function(t){var e=t.split("=");"_educoder_session"===e[0]&&x(e[1])}))}),[]);var O=function(){i.startsWith("http")||i.startsWith("/")?A():Object(f.x)(p||"educoder",i,p)},A=function(){Object(f.v)(p||e,i)};return console.log("data:",i,"fileanme:",p," name:",e),l.a.createElement("div",{style:Object(s.a)({},m||{}),className:"".concat(E&&u.a.bgBlack," ").concat(c?u.a.wrp:"hide")},y&&l.a.createElement("div",{className:u.a.close,ref:T},l.a.createElement(n.a,{title:"点击下载此文件",getPopupContainer:function(){return T.current}},l.a.createElement("span",{onClick:A},l.a.createElement("i",{className:"icon-quxiaozhiding"}))),l.a.createElement(n.a,{title:"关闭",getPopupContainer:function(){return T.current}},l.a.createElement("span",{className:"",onClick:b},l.a.createElement("i",{className:"icon-guanbi1"})))),l.a.createElement("div",{className:"".concat(u.a[v]," ").concat(v," ").concat(u.a.monaco," ").concat("txt"===c?"show":"hide")},"txt"===c&&l.a.createElement(d.b,g)),"audio"===c&&l.a.createElement("audio",{src:"".concat(null!=i&&i.startsWith("/")||(null==i?void 0:i.indexOf("https://"))>-1?i:"data:audio/mp3;base64,").concat(i),autoPlay:!0}),"video"===c&&l.a.createElement(l.a.Fragment,null,null!=i&&i.startsWith("/")?l.a.createElement("video",{controls:!0,src:"".concat(i),autoPlay:!0}):l.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(i),autoPlay:!0})),"html"===c&&l.a.createElement("iframe",{src:i+"&disposition=inline"}),"pdf"===c&&l.a.createElement("embed",{className:u.a.embed,src:i}),"pdfeditor"===c&&l.a.createElement("div",null,l.a.createElement("iframe",{src:"https://a1office.co/solutions/editor/pdf-editor/查重文档1-8839d79b81e8bda0d298ca058913ab88.pdf"}),l.a.createElement("div",{style:{position:"absolute",left:"1px",top:"1px",width:180,height:60,background:"#f9f9f9"}})),"image"===c&&l.a.createElement(l.a.Fragment,null,l.a.createElement("img",{src:"".concat(null!=i&&i.startsWith("/")||(null==i?void 0:i.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(i)})),"other"===c&&l.a.createElement("div",null,l.a.createElement(r.a,{type:"primary",size:"large",onClick:O},l.a.createElement(h.a,null),"点击下载")),("download"===c||"office"===c)&&l.a.createElement(r.a,{type:"primary",size:"large",onClick:O},l.a.createElement(h.a,null),"点击下载"))}},pIsd:
/*!***************************************!*\
!*** ./node_modules/json2mq/index.js ***!
\***************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,i){var r=i(/*! string-convert/camel2hyphen */"BJfS"),n=function(t){var e="",i=Object.keys(t);return i.forEach((function(n,s){var a=t[n];(function(t){return/[height|width]$/.test(t)})(n=r(n))&&"number"==typeof a&&(a+="px"),e+=!0===a?n:!1===a?"not "+n:"("+n+": "+a+")",s<i.length-1&&(e+=" and ")})),e};t.exports=function(t){var e="";return"string"==typeof t?t:t instanceof Array?(t.forEach((function(i,r){e+=n(i),r<t.length-1&&(e+=", ")})),e):n(t)}},"rAM+":
/*!*******************************************************************************************************************!*\
!*** ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js ***!
\*******************************************************************************************************************/
/*! exports provided: default */
/*! exports used: default */function(t,e,i){"use strict";i.d(e,"a",(function(){return n}));var r=i(/*! @babel/runtime/helpers/esm/unsupportedIterableToArray */"Qw5x");function n(t,e){var i;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(i=Object(r.a)(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,s=function(){};return{s:s,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,l=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return o=t.done,t},e:function(t){l=!0,a=t},f:function(){try{o||null==i.return||i.return()}finally{if(l)throw a}}}}},rUJ1:
/*!********************************************!*\
!*** ./node_modules/marked/src/helpers.js ***!
\********************************************/
/*! no static exports found */
/*! exports used: escape */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e){const i=/[&<>"']/,r=/[&<>"']/g,n=/[<>"']|&(?!#?\w+;)/,s=/[<>"']|&(?!#?\w+;)/g,a={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},o=t=>a[t];const l=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function c(t){return t.replace(l,(t,e)=>"colon"===(e=e.toLowerCase())?":":"#"===e.charAt(0)?"x"===e.charAt(1)?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):"")}const u=/(^|[^\[])\^/g;const h=/[^\w:]/g,d=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;const f={},p=/^[^:]+:\/*[^/]*$/,g=/^([^:]+:)[\s\S]*$/,v=/^([^:]+:\/*[^/]*)[\s\S]*$/;function m(t,e){f[" "+t]||(p.test(t)?f[" "+t]=t+"/":f[" "+t]=y(t,"/",!0));const i=-1===(t=f[" "+t]).indexOf(":");return"//"===e.substring(0,2)?i?e:t.replace(g,"$1")+e:"/"===e.charAt(0)?i?e:t.replace(v,"$1")+e:t+e}function y(t,e,i){const r=t.length;if(0===r)return"";let n=0;for(;n<r;){const s=t.charAt(r-n-1);if(s!==e||i){if(s===e||!i)break;n++}else n++}return t.substr(0,r-n)}t.exports={escape:function(t,e){if(e){if(i.test(t))return t.replace(r,o)}else if(n.test(t))return t.replace(s,o);return t},unescape:c,edit:function(t,e){t=t.source||t,e=e||"";const i={replace:(e,r)=>(r=(r=r.source||r).replace(u,"$1"),t=t.replace(e,r),i),getRegex:()=>new RegExp(t,e)};return i},cleanUrl:function(t,e,i){if(t){let t;try{t=decodeURIComponent(c(i)).replace(h,"").toLowerCase()}catch(t){return null}if(0===t.indexOf("javascript:")||0===t.indexOf("vbscript:")||0===t.indexOf("data:"))return null}e&&!d.test(i)&&(i=m(e,i));try{i=encodeURI(i).replace(/%25/g,"%")}catch(t){return null}return i},resolveUrl:m,noopTest:{exec:function(){}},merge:function(t){let e,i,r=1;for(;r<arguments.length;r++)for(i in e=arguments[r],e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},splitCells:function(t,e){const i=t.replace(/\|/g,(t,e,i)=>{let r=!1,n=e;for(;--n>=0&&"\\"===i[n];)r=!r;return r?"|":" |"}).split(/ \|/);let r=0;if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;r<i.length;r++)i[r]=i[r].trim().replace(/\\\|/g,"|");return i},rtrim:y,findClosingBracket:function(t,e){if(-1===t.indexOf(e[1]))return-1;const i=t.length;let r=0,n=0;for(;n<i;n++)if("\\"===t[n])n++;else if(t[n]===e[0])r++;else if(t[n]===e[1]&&(r--,r<0))return n;return-1},checkSanitizeDeprecation:function(t){t&&t.sanitize&&!t.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")}}},sR1s:
/*!*****************************************************!*\
!*** ./node_modules/rc-table/es/utils/valueUtil.js ***!
\*****************************************************/
/*! exports provided: getPathValue, getColumnsKey, mergeObject, validateValue */
/*! exports used: getColumnsKey, getPathValue, mergeObject, validateValue */function(t,e,i){"use strict";i.d(e,"b",(function(){return s})),i.d(e,"a",(function(){return a})),i.d(e,"c",(function(){return o})),i.d(e,"d",(function(){return l}));var r=i(/*! @babel/runtime/helpers/esm/typeof */"U8pU");function n(t){return null==t?[]:Array.isArray(t)?t:[t]}function s(t,e){if(!e&&"number"!=typeof e)return t;for(var i=n(e),r=t,s=0;s<i.length;s+=1){if(!r)return null;r=r[i[s]]}return r}function a(t){var e=[],i={};return t.forEach((function(t){for(var r=t||{},s=r.key,a=r.dataIndex,o=s||n(a).join("-")||"RC_TABLE_KEY";i[o];)o="".concat(o,"_next");i[o]=!0,e.push(o)})),e}function o(){var t={};function e(t,i){i&&Object.keys(i).forEach((function(n){var s=i[n];s&&"object"===Object(r.a)(s)?(t[n]=t[n]||{},e(t[n],s)):t[n]=s}))}for(var i=arguments.length,n=new Array(i),s=0;s<i;s++)n[s]=arguments[s];return n.forEach((function(i){e(t,i)})),t}function l(t){return null!=t}},sboe:
/*!*************************************************!*\
!*** ./node_modules/rc-tree/es/contextTypes.js ***!
\*************************************************/
/*! exports provided: TreeContext */
/*! exports used: TreeContext */function(t,e,i){"use strict";i.d(e,"a",(function(){return n}));var r=i(/*! react */"q1tI"),n=r.createContext(null)},t23M:
/*!*****************************************************!*\
!*** ./node_modules/rc-resize-observer/es/index.js ***!
\*****************************************************/
/*! exports provided: default */
/*! exports used: default */function(t,e,i){"use strict";var r=i(/*! @babel/runtime/helpers/esm/objectSpread2 */"VTBJ"),n=i(/*! @babel/runtime/helpers/esm/classCallCheck */"1OyB"),s=i(/*! @babel/runtime/helpers/esm/createClass */"vuIU"),a=i(/*! @babel/runtime/helpers/esm/inherits */"Ji7U"),o=i(/*! @babel/runtime/helpers/esm/createSuper */"LK+K"),l=i(/*! react */"q1tI"),c=i(/*! rc-util/es/Dom/findDOMNode */"m+aA"),u=i(/*! rc-util/es/Children/toArray */"Zm9Q"),h=i(/*! rc-util/es/warning */"Kwbf"),d=i(/*! rc-util/es/ref */"c+Xe"),f=i(/*! resize-observer-polyfill */"bdgK"),p=function(t){Object(a.a)(i,t);var e=Object(o.a)(i);function i(){var t;return Object(n.a)(this,i),(t=e.apply(this,arguments)).resizeObserver=null,t.childNode=null,t.currentElement=null,t.state={width:0,height:0,offsetHeight:0,offsetWidth:0},t.onResize=function(e){var i=t.props.onResize,n=e[0].target,s=n.getBoundingClientRect(),a=s.width,o=s.height,l=n.offsetWidth,c=n.offsetHeight,u=Math.floor(a),h=Math.floor(o);if(t.state.width!==u||t.state.height!==h||t.state.offsetWidth!==l||t.state.offsetHeight!==c){var d={width:u,height:h,offsetWidth:l,offsetHeight:c};t.setState(d),i&&Promise.resolve().then((function(){i(Object(r.a)(Object(r.a)({},d),{},{offsetWidth:l,offsetHeight:c}))}))}},t.setChildNode=function(e){t.childNode=e},t}return Object(s.a)(i,[{key:"componentDidMount",value:function(){this.onComponentUpdated()}},{key:"componentDidUpdate",value:function(){this.onComponentUpdated()}},{key:"componentWillUnmount",value:function(){this.destroyObserver()}},{key:"onComponentUpdated",value:function(){if(this.props.disabled)this.destroyObserver();else{var t=Object(c.a)(this.childNode||this);t!==this.currentElement&&(this.destroyObserver(),this.currentElement=t),!this.resizeObserver&&t&&(this.resizeObserver=new f.default(this.onResize),this.resizeObserver.observe(t))}}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var t=this.props.children,e=Object(u.a)(t);if(e.length>1)Object(h.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(0===e.length)return Object(h.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var i=e[0];if(l.isValidElement(i)&&Object(d.c)(i)){var r=i.ref;e[0]=l.cloneElement(i,{ref:Object(d.a)(r,this.setChildNode)})}return 1===e.length?e[0]:e.map((function(t,e){return!l.isValidElement(t)||"key"in t&&null!==t.key?t:l.cloneElement(t,{key:"".concat("rc-observer-key","-").concat(e)})}))}}]),i}(l.Component);p.displayName="ResizeObserver",e.a=p},t6v1:
/*!*******************************************!*\
!*** ./src/assets/images/question/a2.svg ***!
\*******************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,i){t.exports=i.p+"static/a2.d632a3a4.svg"},uf8j:
/*!******************************************!*\
!*** ./src/assets/images/question/a.svg ***!
\******************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,i){t.exports=i.p+"static/a.2d0eaf1f.svg"},ulZh:
/*!*****************************************!*\
!*** ./node_modules/hls.js/dist/hls.js ***!
\*****************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,i){var r;"undefined"!=typeof window&&(r=function(){return function(t){var e={};function i(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(r,n,function(e){return t[e]}.bind(null,n));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/dist/",i(i.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":
/*!*********************************************!*\
!*** ./node_modules/eventemitter3/index.js ***!
\*********************************************/
/*! no static exports found */function(t,e,i){"use strict";var r=Object.prototype.hasOwnProperty,n="~";function s(){}function a(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function o(t,e,i,r,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");var o=new a(i,r||t,s),l=n?n+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function l(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function c(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(n=!1)),c.prototype.eventNames=function(){var t,e,i=[];if(0===this._eventsCount)return i;for(e in t=this._events)r.call(t,e)&&i.push(n?e.slice(1):e);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},c.prototype.listeners=function(t){var e=n?n+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,s=i.length,a=new Array(s);r<s;r++)a[r]=i[r].fn;return a},c.prototype.listenerCount=function(t){var e=n?n+t:t,i=this._events[e];return i?i.fn?1:i.length:0},c.prototype.emit=function(t,e,i,r,s,a){var o=n?n+t:t;if(!this._events[o])return!1;var l,c,u=this._events[o],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,i),!0;case 4:return u.fn.call(u.context,e,i,r),!0;case 5:return u.fn.call(u.context,e,i,r,s),!0;case 6:return u.fn.call(u.context,e,i,r,s,a),!0}for(c=1,l=new Array(h-1);c<h;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var d,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(t,u[c].fn,void 0,!0),h){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,e);break;case 3:u[c].fn.call(u[c].context,e,i);break;case 4:u[c].fn.call(u[c].context,e,i,r);break;default:if(!l)for(d=1,l=new Array(h-1);d<h;d++)l[d-1]=arguments[d];u[c].fn.apply(u[c].context,l)}}return!0},c.prototype.on=function(t,e,i){return o(this,t,e,i,!1)},c.prototype.once=function(t,e,i){return o(this,t,e,i,!0)},c.prototype.removeListener=function(t,e,i,r){var s=n?n+t:t;if(!this._events[s])return this;if(!e)return l(this,s),this;var a=this._events[s];if(a.fn)a.fn!==e||r&&!a.once||i&&a.context!==i||l(this,s);else{for(var o=0,c=[],u=a.length;o<u;o++)(a[o].fn!==e||r&&!a[o].once||i&&a[o].context!==i)&&c.push(a[o]);c.length?this._events[s]=1===c.length?c[0]:c:l(this,s)}return this},c.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&l(this,e)):(this._events=new s,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=n,c.EventEmitter=c,t.exports=c},"./node_modules/url-toolkit/src/url-toolkit.js":
/*!*****************************************************!*\
!*** ./node_modules/url-toolkit/src/url-toolkit.js ***!
\*****************************************************/
/*! no static exports found */function(t,e,i){var r,n,s,a,o;r=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,n=/^([^\/?#]*)([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(t,e,i){if(i=i||{},t=t.trim(),!(e=e.trim())){if(!i.alwaysNormalize)return t;var r=o.parseURL(t);if(!r)throw new Error("Error trying to parse base URL.");return r.path=o.normalizePath(r.path),o.buildURLFromParts(r)}var s=o.parseURL(e);if(!s)throw new Error("Error trying to parse relative URL.");if(s.scheme)return i.alwaysNormalize?(s.path=o.normalizePath(s.path),o.buildURLFromParts(s)):e;var a=o.parseURL(t);if(!a)throw new Error("Error trying to parse base URL.");if(!a.netLoc&&a.path&&"/"!==a.path[0]){var l=n.exec(a.path);a.netLoc=l[1],a.path=l[2]}a.netLoc&&!a.path&&(a.path="/");var c={scheme:a.scheme,netLoc:s.netLoc,path:null,params:s.params,query:s.query,fragment:s.fragment};if(!s.netLoc&&(c.netLoc=a.netLoc,"/"!==s.path[0]))if(s.path){var u=a.path,h=u.substring(0,u.lastIndexOf("/")+1)+s.path;c.path=o.normalizePath(h)}else c.path=a.path,s.params||(c.params=a.params,s.query||(c.query=a.query));return null===c.path&&(c.path=i.alwaysNormalize?o.normalizePath(s.path):s.path),o.buildURLFromParts(c)},parseURL:function(t){var e=r.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(s,"");t.length!==(t=t.replace(a,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}},t.exports=o},"./node_modules/webworkify-webpack/index.js":
/*!**************************************************!*\
!*** ./node_modules/webworkify-webpack/index.js ***!
\**************************************************/
/*! no static exports found */function(t,e,i){function r(t){var e={};function i(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=t,i.c=e,i.i=function(t){return t},i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},i.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/",i.oe=function(t){throw console.error(t),t};var r=i(i.s=ENTRY_MODULE);return r.default||r}function n(t){return(t+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function s(t,e,r){var s={};s[r]=[];var a=e.toString(),o=a.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!o)return s;for(var l,c=o[1],u=new RegExp("(\\\\n|\\W)"+n(c)+"\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)","g");l=u.exec(a);)"dll-reference"!==l[3]&&s[r].push(l[3]);for(u=new RegExp("\\("+n(c)+'\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)',"g");l=u.exec(a);)t[l[2]]||(s[r].push(l[1]),t[l[2]]=i(l[1]).m),s[l[2]]=s[l[2]]||[],s[l[2]].push(l[4]);for(var h,d=Object.keys(s),f=0;f<d.length;f++)for(var p=0;p<s[d[f]].length;p++)h=s[d[f]][p],isNaN(1*h)||(s[d[f]][p]=1*s[d[f]][p]);return s}function a(t){return Object.keys(t).reduce((function(e,i){return e||t[i].length>0}),!1)}t.exports=function(t,e){e=e||{};var n={main:i.m},o=e.all?{main:Object.keys(n.main)}:function(t,e){for(var i={main:[e]},r={main:[]},n={main:{}};a(i);)for(var o=Object.keys(i),l=0;l<o.length;l++){var c=o[l],u=i[c].pop();if(n[c]=n[c]||{},!n[c][u]&&t[c][u]){n[c][u]=!0,r[c]=r[c]||[],r[c].push(u);for(var h=s(t,t[c][u],c),d=Object.keys(h),f=0;f<d.length;f++)i[d[f]]=i[d[f]]||[],i[d[f]]=i[d[f]].concat(h[d[f]])}}return r}(n,t),l="";Object.keys(o).filter((function(t){return"main"!==t})).forEach((function(t){for(var e=0;o[t][e];)e++;o[t].push(e),n[t][e]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",l=l+"var "+t+" = ("+r.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+o[t].map((function(e){return JSON.stringify(e)+": "+n[t][e].toString()})).join(",")+"});\n"})),l=l+"new (("+r.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+o.main.map((function(t){return JSON.stringify(t)+": "+n.main[t].toString()})).join(",")+"}))(self);";var c=new window.Blob([l],{type:"text/javascript"});if(e.bare)return c;var u=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(c),h=new window.Worker(u);return h.objectURL=u,h}},"./src/config.ts":
/*!***********************!*\
!*** ./src/config.ts ***!
\***********************/
/*! exports provided: hlsDefaultConfig, mergeConfig, enableStreamingMode */function(t,e,i){"use strict";i.r(e),i.d(e,"hlsDefaultConfig",(function(){return k})),i.d(e,"mergeConfig",(function(){return w})),i.d(e,"enableStreamingMode",(function(){return x}));var r=i(/*! ./controller/abr-controller */"./src/controller/abr-controller.ts"),n=i(/*! ./controller/audio-stream-controller */"./src/controller/audio-stream-controller.ts"),s=i(/*! ./controller/audio-track-controller */"./src/controller/audio-track-controller.ts"),a=i(/*! ./controller/subtitle-stream-controller */"./src/controller/subtitle-stream-controller.ts"),o=i(/*! ./controller/subtitle-track-controller */"./src/controller/subtitle-track-controller.ts"),l=i(/*! ./controller/buffer-controller */"./src/controller/buffer-controller.ts"),c=i(/*! ./controller/timeline-controller */"./src/controller/timeline-controller.ts"),u=i(/*! ./controller/cap-level-controller */"./src/controller/cap-level-controller.ts"),h=i(/*! ./controller/fps-controller */"./src/controller/fps-controller.ts"),d=i(/*! ./controller/eme-controller */"./src/controller/eme-controller.ts"),f=i(/*! ./controller/cmcd-controller */"./src/controller/cmcd-controller.ts"),p=i(/*! ./utils/xhr-loader */"./src/utils/xhr-loader.ts"),g=i(/*! ./utils/fetch-loader */"./src/utils/fetch-loader.ts"),v=i(/*! ./utils/cues */"./src/utils/cues.ts"),m=i(/*! ./utils/mediakeys-helper */"./src/utils/mediakeys-helper.ts"),y=i(/*! ./utils/logger */"./src/utils/logger.ts");function b(){return(b=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t}).apply(this,arguments)}function E(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function S(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?E(Object(i),!0).forEach((function(e){C(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):E(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function C(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var k=S(S({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,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:p.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:r.default,bufferController:l.default,capLevelController:u.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:m.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},{cueHandler:v.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}),{},{subtitleStreamController:a.SubtitleStreamController,subtitleTrackController:o.default,timelineController:c.TimelineController,audioStreamController:n.default,audioTrackController:s.default,emeController:d.default,cmcdController:f.default});function w(t,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==e.liveMaxLatencyDurationCount&&(void 0===e.liveSyncDurationCount||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==e.liveMaxLatencyDuration&&(void 0===e.liveSyncDuration||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return b({},t,e)}function x(t){var e=t.loader;e!==g.default&&e!==p.default?(y.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),t.progressive=!1):Object(g.fetchSupported)()&&(t.loader=g.default,t.progressive=!0,t.enableSoftwareAES=!0,y.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}},"./src/controller/abr-controller.ts":
/*!******************************************!*\
!*** ./src/controller/abr-controller.ts ***!
\******************************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e);var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ../utils/ewma-bandwidth-estimator */"./src/utils/ewma-bandwidth-estimator.ts"),s=i(/*! ../events */"./src/events.ts"),a=i(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),o=i(/*! ../errors */"./src/errors.ts"),l=i(/*! ../types/loader */"./src/types/loader.ts"),c=i(/*! ../utils/logger */"./src/utils/logger.ts");function u(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var h=function(){function t(t){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=t;var e=t.config;this.bwEstimator=new n.default(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate),this.registerListeners()}var e,i,h,d=t.prototype;return d.registerListeners=function(){var t=this.hls;t.on(s.Events.FRAG_LOADING,this.onFragLoading,this),t.on(s.Events.FRAG_LOADED,this.onFragLoaded,this),t.on(s.Events.FRAG_BUFFERED,this.onFragBuffered,this),t.on(s.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.on(s.Events.ERROR,this.onError,this)},d.unregisterListeners=function(){var t=this.hls;t.off(s.Events.FRAG_LOADING,this.onFragLoading,this),t.off(s.Events.FRAG_LOADED,this.onFragLoaded,this),t.off(s.Events.FRAG_BUFFERED,this.onFragBuffered,this),t.off(s.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.off(s.Events.ERROR,this.onError,this)},d.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},d.onFragLoading=function(t,e){var i,r=e.frag;r.type===l.PlaylistLevelType.MAIN&&(this.timer||(this.fragCurrent=r,this.partCurrent=null!=(i=e.part)?i:null,this.timer=self.setInterval(this.onCheck,100)))},d.onLevelLoaded=function(t,e){var i=this.hls.config;e.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)},d._abandonRulesCheck=function(){var t=this.fragCurrent,e=this.partCurrent,i=this.hls,n=i.autoLevelEnabled,o=i.config,l=i.media;if(t&&l){var u=e?e.stats:t.stats,h=e?e.duration:t.duration;if(u.aborted)return c.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),void(this._nextAutoLevel=-1);if(n&&!l.paused&&l.playbackRate&&l.readyState){var d=performance.now()-u.loading.start,f=Math.abs(l.playbackRate);if(!(d<=500*h/f)){var p=i.levels,g=i.minAutoLevel,v=p[t.level],m=u.total||Math.max(u.loaded,Math.round(h*v.maxBitrate/8)),y=Math.max(1,u.bwEstimate?u.bwEstimate/8:1e3*u.loaded/d),b=(m-u.loaded)/y,E=l.currentTime,S=(a.BufferHelper.bufferInfo(l,E,o.maxBufferHole).end-E)/f;if(!(S>=2*h/f||b<=S)){var C,k=Number.POSITIVE_INFINITY;for(C=t.level-1;C>g&&!((k=h*p[C].maxBitrate/(6.4*y))<S);C--);if(!(k>=b)){var w=this.bwEstimator.getEstimate();c.logger.warn("Fragment "+t.sn+(e?" part "+e.index:"")+" of level "+t.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+C+"\n Current BW estimate: "+(Object(r.isFiniteNumber)(w)?(w/1024).toFixed(3):"Unknown")+" Kb/s\n Estimated load time for current fragment: "+b.toFixed(3)+" s\n Estimated load time for the next fragment: "+k.toFixed(3)+" s\n Time to underbuffer: "+S.toFixed(3)+" s"),i.nextLoadLevel=C,this.bwEstimator.sample(d,u.loaded),this.clearTimer(),t.loader&&(this.fragCurrent=this.partCurrent=null,t.loader.abort()),i.trigger(s.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:e,stats:u})}}}}}},d.onFragLoaded=function(t,e){var i=e.frag,n=e.part;if(i.type===l.PlaylistLevelType.MAIN&&Object(r.isFiniteNumber)(i.sn)){var a=n?n.stats:i.stats,o=n?n.duration:i.duration;if(this.clearTimer(),this.lastLoadedFragLevel=i.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var c=this.hls.levels[i.level],u=(c.loaded?c.loaded.bytes:0)+a.loaded,h=(c.loaded?c.loaded.duration:0)+o;c.loaded={bytes:u,duration:h},c.realBitrate=Math.round(8*u/h)}if(i.bitrateTest){var d={stats:a,frag:i,part:n,id:i.type};this.onFragBuffered(s.Events.FRAG_BUFFERED,d),i.bitrateTest=!1}}},d.onFragBuffered=function(t,e){var i=e.frag,r=e.part,n=r?r.stats:i.stats;if(!n.aborted&&i.type===l.PlaylistLevelType.MAIN&&"initSegment"!==i.sn){var s=n.parsing.end-n.loading.start;this.bwEstimator.sample(s,n.loaded),n.bwEstimate=this.bwEstimator.getEstimate(),i.bitrateTest?this.bitrateTestDelay=s/1e3:this.bitrateTestDelay=0}},d.onError=function(t,e){switch(e.details){case o.ErrorDetails.FRAG_LOAD_ERROR:case o.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}},d.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},d.getNextABRAutoLevel=function(){var t=this.fragCurrent,e=this.partCurrent,i=this.hls,r=i.maxAutoLevel,n=i.config,s=i.minAutoLevel,o=i.media,l=e?e.duration:t?t.duration:0,u=o?o.currentTime:0,h=o&&0!==o.playbackRate?Math.abs(o.playbackRate):1,d=this.bwEstimator?this.bwEstimator.getEstimate():n.abrEwmaDefaultEstimate,f=(a.BufferHelper.bufferInfo(o,u,n.maxBufferHole).end-u)/h,p=this.findBestLevel(d,s,r,f,n.abrBandWidthFactor,n.abrBandWidthUpFactor);if(p>=0)return p;c.logger.trace((f?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var g=l?Math.min(l,n.maxStarvationDelay):n.maxStarvationDelay,v=n.abrBandWidthFactor,m=n.abrBandWidthUpFactor;if(!f){var y=this.bitrateTestDelay;y&&(g=(l?Math.min(l,n.maxLoadingDelay):n.maxLoadingDelay)-y,c.logger.trace("bitrate test took "+Math.round(1e3*y)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*g)+" ms"),v=m=1)}return p=this.findBestLevel(d,s,r,f+g,v,m),Math.max(p,0)},d.findBestLevel=function(t,e,i,r,n,s){for(var a,o=this.fragCurrent,l=this.partCurrent,u=this.lastLoadedFragLevel,h=this.hls.levels,d=h[u],f=!(null==d||null===(a=d.details)||void 0===a||!a.live),p=null==d?void 0:d.codecSet,g=l?l.duration:o?o.duration:0,v=i;v>=e;v--){var m=h[v];if(m&&(!p||m.codecSet===p)){var y=m.details,b=(l?null==y?void 0:y.partTarget:null==y?void 0:y.averagetargetduration)||g,E=void 0;E=v<=u?n*t:s*t;var S=h[v].maxBitrate,C=S*b/E;if(c.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+v+"/"+Math.round(E)+"/"+S+"/"+b+"/"+r+"/"+C),E>S&&(!C||f&&!this.bitrateTestDelay||C<r))return v}}return-1},e=t,(i=[{key:"nextAutoLevel",get:function(){var t=this._nextAutoLevel,e=this.bwEstimator;if(!(-1===t||e&&e.canEstimate()))return t;var i=this.getNextABRAutoLevel();return-1!==t&&(i=Math.min(t,i)),i},set:function(t){this._nextAutoLevel=t}}])&&u(e.prototype,i),h&&u(e,h),t}();e.default=h},"./src/controller/audio-stream-controller.ts":
/*!***************************************************!*\
!*** ./src/controller/audio-stream-controller.ts ***!
\***************************************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e);var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ./base-stream-controller */"./src/controller/base-stream-controller.ts"),s=i(/*! ../events */"./src/events.ts"),a=i(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),o=i(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),l=i(/*! ../types/level */"./src/types/level.ts"),c=i(/*! ../types/loader */"./src/types/loader.ts"),u=i(/*! ../loader/fragment */"./src/loader/fragment.ts"),h=i(/*! ../demux/chunk-cache */"./src/demux/chunk-cache.ts"),d=i(/*! ../demux/transmuxer-interface */"./src/demux/transmuxer-interface.ts"),f=i(/*! ../types/transmuxer */"./src/types/transmuxer.ts"),p=i(/*! ./fragment-finders */"./src/controller/fragment-finders.ts"),g=i(/*! ../utils/discontinuities */"./src/utils/discontinuities.ts"),v=i(/*! ../errors */"./src/errors.ts"),m=i(/*! ../utils/logger */"./src/utils/logger.ts");function y(){return(y=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t}).apply(this,arguments)}function b(t,e){return(b=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var E=function(t){var e,i;function E(e,i){var r;return(r=t.call(this,e,i,"[audio-stream-controller]")||this).videoBuffer=null,r.videoTrackCC=-1,r.waitingVideoCC=-1,r.audioSwitch=!1,r.trackId=-1,r.waitingData=null,r.mainDetails=null,r.bufferFlushed=!1,r._registerListeners(),r}i=t,(e=E).prototype=Object.create(i.prototype),e.prototype.constructor=e,b(e,i);var S=E.prototype;return S.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},S._registerListeners=function(){var t=this.hls;t.on(s.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(s.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(s.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(s.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.on(s.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(s.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(s.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(s.Events.ERROR,this.onError,this),t.on(s.Events.BUFFER_RESET,this.onBufferReset,this),t.on(s.Events.BUFFER_CREATED,this.onBufferCreated,this),t.on(s.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(s.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(s.Events.FRAG_BUFFERED,this.onFragBuffered,this)},S._unregisterListeners=function(){var t=this.hls;t.off(s.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(s.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(s.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(s.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.off(s.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(s.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(s.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(s.Events.ERROR,this.onError,this),t.off(s.Events.BUFFER_RESET,this.onBufferReset,this),t.off(s.Events.BUFFER_CREATED,this.onBufferCreated,this),t.off(s.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(s.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(s.Events.FRAG_BUFFERED,this.onFragBuffered,this)},S.onInitPtsFound=function(t,e){var i=e.frag,r=e.id,s=e.initPTS;if("main"===r){var a=i.cc;this.initPTS[i.cc]=s,this.log("InitPTS for cc: "+a+" found from main: "+s),this.videoTrackCC=a,this.state===n.State.WAITING_INIT_PTS&&this.tick()}},S.startLoad=function(t){if(!this.levels)return this.startPosition=t,void(this.state=n.State.STOPPED);var e=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),this.fragLoadError=0,e>0&&-1===t?(this.log("Override startPosition with lastCurrentTime @"+e.toFixed(3)),this.state=n.State.IDLE):(this.loadedmetadata=!1,this.state=n.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()},S.doTick=function(){switch(this.state){case n.State.IDLE:this.doTickIdle();break;case n.State.WAITING_TRACK:var e,i=this.levels,r=this.trackId,s=null==i||null===(e=i[r])||void 0===e?void 0:e.details;if(s){if(this.waitForCdnTuneIn(s))break;this.state=n.State.WAITING_INIT_PTS}break;case n.State.FRAG_LOADING_WAITING_RETRY:var o,l=performance.now(),c=this.retryDate;(!c||l>=c||null!==(o=this.media)&&void 0!==o&&o.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=n.State.IDLE);break;case n.State.WAITING_INIT_PTS:var u=this.waitingData;if(u){var h=u.frag,d=u.part,f=u.cache,g=u.complete;if(void 0!==this.initPTS[h.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=n.State.FRAG_LOADING;var v={frag:h,part:d,payload:f.flush(),networkDetails:null};this._handleFragmentLoadProgress(v),g&&t.prototype._handleFragmentLoadComplete.call(this,v)}else if(this.videoTrackCC!==this.waitingVideoCC)m.logger.log("Waiting fragment cc ("+h.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var y=this.getLoadPosition(),b=a.BufferHelper.bufferInfo(this.mediaBuffer,y,this.config.maxBufferHole);Object(p.fragmentWithinToleranceTest)(b.end,this.config.maxFragLookUpTolerance,h)<0&&(m.logger.log("Waiting fragment cc ("+h.cc+") @ "+h.start+" cancelled because another fragment at "+b.end+" is needed"),this.clearWaitingFragment())}}else this.state=n.State.IDLE}this.onTickEnd()},S.clearWaitingFragment=function(){var t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=n.State.IDLE)},S.onTickEnd=function(){var t=this.media;if(t&&t.readyState){var e=(this.mediaBuffer?this.mediaBuffer:t).buffered;!this.loadedmetadata&&e.length&&(this.loadedmetadata=!0),this.lastCurrentTime=t.currentTime}},S.doTickIdle=function(){var t,e,i=this.hls,r=this.levels,a=this.media,o=this.trackId,l=i.config;if(r&&r[o]&&(a||!this.startFragRequested&&l.startFragPrefetch)){var h=r[o].details;if(!h||h.live&&this.levelLastLoaded!==o||this.waitForCdnTuneIn(h))this.state=n.State.WAITING_TRACK;else{this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,u.ElementaryStreamTypes.AUDIO,c.PlaylistLevelType.AUDIO));var d=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,c.PlaylistLevelType.AUDIO);if(null!==d){var f=d.len,p=this.getMaxBufferLength(),g=this.audioSwitch;if(!(f>=p)||g){if(!g&&this._streamEnded(d,h))return i.trigger(s.Events.BUFFER_EOS,{type:"audio"}),void(this.state=n.State.ENDED);var v=h.fragments[0].start,m=d.end;if(g){var y=this.getLoadPosition();m=y,h.PTSKnown&&y<v&&(d.end>v||d.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),a.currentTime=v+.05)}var b=this.getNextFragment(m,h);b?"identity"!==(null===(t=b.decryptdata)||void 0===t?void 0:t.keyFormat)||null!==(e=b.decryptdata)&&void 0!==e&&e.key?this.loadFragment(b,h,m):this.loadKey(b,h):this.bufferFlushed=!0}}}}},S.getMaxBufferLength=function(){var e=t.prototype.getMaxBufferLength.call(this),i=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,c.PlaylistLevelType.MAIN);return null===i?e:Math.max(e,i.len)},S.onMediaDetaching=function(){this.videoBuffer=null,t.prototype.onMediaDetaching.call(this)},S.onAudioTracksUpdated=function(t,e){var i=e.audioTracks;this.resetTransmuxer(),this.levels=i.map((function(t){return new l.Level(t)}))},S.onAudioTrackSwitching=function(t,e){var i=!!e.url;this.trackId=e.id;var r=this.fragCurrent;null!=r&&r.loader&&r.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),i?this.setInterval(100):this.resetTransmuxer(),i?(this.audioSwitch=!0,this.state=n.State.IDLE):this.state=n.State.STOPPED,this.tick()},S.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},S.onLevelLoaded=function(t,e){this.mainDetails=e.details},S.onAudioTrackLoaded=function(t,e){var i,r=this.levels,s=e.details,a=e.id;if(r){this.log("Track "+a+" loaded ["+s.startSN+","+s.endSN+"],duration:"+s.totalduration);var o=r[a],l=0;if(s.live||null!==(i=o.details)&&void 0!==i&&i.live){var c=this.mainDetails;if(s.fragments[0]||(s.deltaUpdateFailed=!0),s.deltaUpdateFailed||!c)return;!o.details&&s.hasProgramDateTime&&c.hasProgramDateTime?(Object(g.alignMediaPlaylistByPDT)(s,c),l=s.fragments[0].start):l=this.alignPlaylists(s,o.details)}o.details=s,this.levelLastLoaded=a,this.startFragRequested||!this.mainDetails&&s.live||this.setStartPosition(o.details,l),this.state!==n.State.WAITING_TRACK||this.waitForCdnTuneIn(s)||(this.state=n.State.IDLE),this.tick()}else this.warn("Audio tracks were reset while loading level "+a)},S._handleFragmentLoadProgress=function(t){var e,i=t.frag,r=t.part,s=t.payload,a=this.config,o=this.trackId,l=this.levels;if(l){var u=l[o];console.assert(u,"Audio track is defined on fragment load progress");var p=u.details;console.assert(p,"Audio track details are defined on fragment load progress");var g=a.defaultAudioCodec||u.audioCodec||"mp4a.40.2",v=this.transmuxer;v||(v=this.transmuxer=new d.default(this.hls,c.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var y=this.initPTS[i.cc],b=null===(e=i.initSegment)||void 0===e?void 0:e.data;if(void 0!==y){var E=r?r.index:-1,S=-1!==E,C=new f.ChunkMetadata(i.level,i.sn,i.stats.chunkCount,s.byteLength,E,S);v.push(s,b,g,"",i,r,p.totalduration,!1,C,y)}else m.logger.log("Unknown video PTS for cc "+i.cc+", waiting for video PTS before demuxing audio frag "+i.sn+" of ["+p.startSN+" ,"+p.endSN+"],track "+o),(this.waitingData=this.waitingData||{frag:i,part:r,cache:new h.default,complete:!1}).cache.push(new Uint8Array(s)),this.waitingVideoCC=this.videoTrackCC,this.state=n.State.WAITING_INIT_PTS}else this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+i.sn+" of level "+i.level+" will not be buffered")},S._handleFragmentLoadComplete=function(e){this.waitingData?this.waitingData.complete=!0:t.prototype._handleFragmentLoadComplete.call(this,e)},S.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},S.onBufferCreated=function(t,e){var i=e.tracks.audio;i&&(this.mediaBuffer=i.buffer),e.tracks.video&&(this.videoBuffer=e.tracks.video.buffer)},S.onFragBuffered=function(t,e){var i=e.frag,r=e.part;i.type===c.PlaylistLevelType.AUDIO&&(this.fragContextChanged(i)?this.warn("Fragment "+i.sn+(r?" p: "+r.index:"")+" of level "+i.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch):("initSegment"!==i.sn&&(this.fragPrevious=i,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(s.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(i,r)))},S.onError=function(e,i){switch(i.details){case v.ErrorDetails.FRAG_LOAD_ERROR:case v.ErrorDetails.FRAG_LOAD_TIMEOUT:case v.ErrorDetails.KEY_LOAD_ERROR:case v.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(c.PlaylistLevelType.AUDIO,i);break;case v.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case v.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==n.State.ERROR&&this.state!==n.State.STOPPED&&(this.state=i.fatal?n.State.ERROR:n.State.IDLE,this.warn(i.details+" while loading frag, switching to "+this.state+" state"));break;case v.ErrorDetails.BUFFER_FULL_ERROR:if("audio"===i.parent&&(this.state===n.State.PARSING||this.state===n.State.PARSED)){var r=!0,s=this.getFwdBufferInfo(this.mediaBuffer,c.PlaylistLevelType.AUDIO);s&&s.len>.5&&(r=!this.reduceMaxBufferLength(s.len)),r&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,t.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}}},S.onBufferFlushed=function(t,e){e.type===u.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},S._handleTransmuxComplete=function(t){var e,i="audio",r=this.hls,a=t.remuxResult,o=t.chunkMeta,l=this.getCurrentContext(o);if(!l)return this.warn("The loading context changed while buffering fragment "+o.sn+" of level "+o.level+". This chunk will not be buffered."),void this.resetLiveStartWhenNotLoaded(o.level);var c=l.frag,h=l.part,d=a.audio,f=a.text,p=a.id3,g=a.initSegment;if(!this.fragContextChanged(c)){if(this.state=n.State.PARSING,this.audioSwitch&&d&&this.completeAudioSwitch(),null!=g&&g.tracks&&(this._bufferInitSegment(g.tracks,c,o),r.trigger(s.Events.FRAG_PARSING_INIT_SEGMENT,{frag:c,id:i,tracks:g.tracks})),d){var v=d.startPTS,m=d.endPTS,b=d.startDTS,E=d.endDTS;h&&(h.elementaryStreams[u.ElementaryStreamTypes.AUDIO]={startPTS:v,endPTS:m,startDTS:b,endDTS:E}),c.setElementaryStreamInfo(u.ElementaryStreamTypes.AUDIO,v,m,b,E),this.bufferFragmentData(d,c,h,o)}if(null!=p&&null!==(e=p.samples)&&void 0!==e&&e.length){var S=y({frag:c,id:i},p);r.trigger(s.Events.FRAG_PARSING_METADATA,S)}if(f){var C=y({frag:c,id:i},f);r.trigger(s.Events.FRAG_PARSING_USERDATA,C)}}},S._bufferInitSegment=function(t,e,i){if(this.state===n.State.PARSING){t.video&&delete t.video;var r=t.audio;if(r){r.levelCodec=r.codec,r.id="audio",this.log("Init audio buffer, container:"+r.container+", codecs[parsed]=["+r.codec+"]"),this.hls.trigger(s.Events.BUFFER_CODECS,t);var a=r.initSegment;if(null!=a&&a.byteLength){var o={type:"audio",frag:e,part:null,chunkMeta:i,parent:e.type,data:a};this.hls.trigger(s.Events.BUFFER_APPENDING,o)}this.tick()}}},S.loadFragment=function(e,i,s){var a=this.fragmentTracker.getState(e);this.fragCurrent=e,(this.audioSwitch||a===o.FragmentState.NOT_LOADED||a===o.FragmentState.PARTIAL)&&("initSegment"===e.sn?this._loadInitSegment(e):i.live&&!Object(r.isFiniteNumber)(this.initPTS[e.cc])?(this.log("Waiting for video PTS in continuity counter "+e.cc+" of live stream before loading audio fragment "+e.sn+" of level "+this.trackId),this.state=n.State.WAITING_INIT_PTS):(this.startFragRequested=!0,t.prototype.loadFragment.call(this,e,i,s)))},S.completeAudioSwitch=function(){var e=this.hls,i=this.media,r=this.trackId;i&&(this.log("Switching audio track : flushing all audio"),t.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,e.trigger(s.Events.AUDIO_TRACK_SWITCHED,{id:r})},E}(n.default);e.default=E},"./src/controller/audio-track-controller.ts":
/*!**************************************************!*\
!*** ./src/controller/audio-track-controller.ts ***!
\**************************************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e);var r=i(/*! ../events */"./src/events.ts"),n=i(/*! ../errors */"./src/errors.ts"),s=i(/*! ./base-playlist-controller */"./src/controller/base-playlist-controller.ts"),a=i(/*! ../types/loader */"./src/types/loader.ts");function o(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var c=function(t){var e,i;function s(e){var i;return(i=t.call(this,e,"[audio-track-controller]")||this).tracks=[],i.groupId=null,i.tracksInGroup=[],i.trackId=-1,i.trackName="",i.selectDefaultTrack=!0,i.registerListeners(),i}i=t,(e=s).prototype=Object.create(i.prototype),e.prototype.constructor=e,l(e,i);var c,u,h,d=s.prototype;return d.registerListeners=function(){var t=this.hls;t.on(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(r.Events.LEVEL_LOADING,this.onLevelLoading,this),t.on(r.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(r.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(r.Events.ERROR,this.onError,this)},d.unregisterListeners=function(){var t=this.hls;t.off(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(r.Events.LEVEL_LOADING,this.onLevelLoading,this),t.off(r.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(r.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(r.Events.ERROR,this.onError,this)},d.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,t.prototype.destroy.call(this)},d.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},d.onManifestParsed=function(t,e){this.tracks=e.audioTracks||[]},d.onAudioTrackLoaded=function(t,e){var i=e.id,r=e.details,n=this.tracksInGroup[i];if(n){var s=n.details;n.details=e.details,this.log("audioTrack "+i+" loaded ["+r.startSN+"-"+r.endSN+"]"),i===this.trackId&&(this.retryCount=0,this.playlistLoaded(i,e,s))}else this.warn("Invalid audio track id "+i)},d.onLevelLoading=function(t,e){this.switchLevel(e.level)},d.onLevelSwitching=function(t,e){this.switchLevel(e.level)},d.switchLevel=function(t){var e=this.hls.levels[t];if(null!=e&&e.audioGroupIds){var i=e.audioGroupIds[e.urlId];if(this.groupId!==i){this.groupId=i;var n=this.tracks.filter((function(t){return!i||t.groupId===i}));this.selectDefaultTrack&&!n.some((function(t){return t.default}))&&(this.selectDefaultTrack=!1),this.tracksInGroup=n;var s={audioTracks:n};this.log("Updating audio tracks, "+n.length+' track(s) found in "'+i+'" group-id'),this.hls.trigger(r.Events.AUDIO_TRACKS_UPDATED,s),this.selectInitialTrack()}}},d.onError=function(e,i){t.prototype.onError.call(this,e,i),!i.fatal&&i.context&&i.context.type===a.PlaylistContextType.AUDIO_TRACK&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&this.retryLoadingOrFail(i)},d.setAudioTrack=function(t){var e=this.tracksInGroup;if(t<0||t>=e.length)this.warn("Invalid id passed to audio-track controller");else{this.clearTimer();var i=e[this.trackId];this.log("Now switching to audio-track index "+t);var n=e[t],s=n.id,a=n.groupId,o=void 0===a?"":a,l=n.name,c=n.type,u=n.url;if(this.trackId=t,this.trackName=l,this.selectDefaultTrack=!1,this.hls.trigger(r.Events.AUDIO_TRACK_SWITCHING,{id:s,groupId:o,name:l,type:c,url:u}),!n.details||n.details.live){var h=this.switchParams(n.url,null==i?void 0:i.details);this.loadPlaylist(h)}}},d.selectInitialTrack=function(){var t=this.tracksInGroup;console.assert(t.length,"Initial audio track should be selected when tracks are known");var e=this.trackName,i=this.findTrackId(e)||this.findTrackId();-1!==i?this.setAudioTrack(i):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},d.findTrackId=function(t){for(var e=this.tracksInGroup,i=0;i<e.length;i++){var r=e[i];if((!this.selectDefaultTrack||r.default)&&(!t||t===r.name))return r.id}return-1},d.loadPlaylist=function(t){var e=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(e)){var i=e.id,n=e.groupId,s=e.url;if(t)try{s=t.addDirectives(s)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: "+t)}this.log("loading audio-track playlist for id: "+i),this.clearTimer(),this.hls.trigger(r.Events.AUDIO_TRACK_LOADING,{url:s,id:i,groupId:n,deliveryDirectives:t||null})}},c=s,(u=[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1,this.setAudioTrack(t)}}])&&o(c.prototype,u),h&&o(c,h),s}(s.default);e.default=c},"./src/controller/base-playlist-controller.ts":
/*!****************************************************!*\
!*** ./src/controller/base-playlist-controller.ts ***!
\****************************************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return l}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ../types/level */"./src/types/level.ts"),s=i(/*! ./level-helper */"./src/controller/level-helper.ts"),a=i(/*! ../utils/logger */"./src/utils/logger.ts"),o=i(/*! ../errors */"./src/errors.ts"),l=function(){function t(t,e){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=a.logger.log.bind(a.logger,e+":"),this.warn=a.logger.warn.bind(a.logger,e+":"),this.hls=t}var e=t.prototype;return e.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},e.onError=function(t,e){e.fatal&&e.type===o.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},e.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},e.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},e.stopLoad=function(){this.canLoad=!1,this.clearTimer()},e.switchParams=function(t,e){var i=null==e?void 0:e.renditionReports;if(i)for(var s=0;s<i.length;s++){var a=i[s],o=""+a.URI;if(o===t.substr(-o.length)){var l=parseInt(a["LAST-MSN"]),c=parseInt(a["LAST-PART"]);if(e&&this.hls.config.lowLatencyMode){var u=Math.min(e.age-e.partTarget,e.targetduration);void 0!==c&&u>e.partTarget&&(c+=1)}if(Object(r.isFiniteNumber)(l))return new n.HlsUrlParameters(l,Object(r.isFiniteNumber)(c)?c:void 0,n.HlsSkip.No)}}},e.loadPlaylist=function(t){},e.shouldLoadTrack=function(t){return this.canLoad&&t&&!!t.url&&(!t.details||t.details.live)},e.playlistLoaded=function(t,e,i){var r=this,n=e.details,a=e.stats,o=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(n.advancedDateTime=Date.now()-o,n.live||null!=i&&i.live){if(n.reloaded(i),i&&this.log("live playlist "+t+" "+(n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:"MISSED")),i&&n.fragments.length>0&&Object(s.mergeDetails)(i,n),!this.canLoad||!n.live)return;var l,c=void 0,u=void 0;if(n.canBlockReload&&n.endSN&&n.advanced){var h=this.hls.config.lowLatencyMode,d=n.lastPartSn,f=n.endSN,p=n.lastPartIndex,g=d===f;-1!==p?(c=g?f+1:d,u=g?h?0:p:p+1):c=f+1;var v=n.age,m=v+n.ageHeader,y=Math.min(m-n.partTarget,1.5*n.targetduration);if(y>0){if(i&&y>i.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+i.tuneInGoal+" to: "+y+" with playlist age: "+n.age),y=0;else{var b=Math.floor(y/n.targetduration);c+=b,void 0!==u&&(u+=Math.round(y%n.targetduration/n.partTarget)),this.log("CDN Tune-in age: "+n.ageHeader+"s last advanced "+v.toFixed(2)+"s goal: "+y+" skip sn "+b+" to part "+u)}n.tuneInGoal=y}if(l=this.getDeliveryDirectives(n,e.deliveryDirectives,c,u),h||!g)return void this.loadPlaylist(l)}else l=this.getDeliveryDirectives(n,e.deliveryDirectives,c,u);var E=Object(s.computeReloadInterval)(n,a);void 0!==c&&n.canBlockReload&&(E-=n.partTarget||1),this.log("reload live playlist "+t+" in "+Math.round(E)+" ms"),this.timer=self.setTimeout((function(){return r.loadPlaylist(l)}),E)}else this.clearTimer()},e.getDeliveryDirectives=function(t,e,i,r){var s=Object(n.getSkipValue)(t,i);return null!=e&&e.skip&&t.deltaUpdateFailed&&(i=e.msn,r=e.part,s=n.HlsSkip.No),new n.HlsUrlParameters(i,r,s)},e.retryLoadingOrFail=function(t){var e,i=this,r=this.hls.config,n=this.retryCount<r.levelLoadingMaxRetry;if(n)if(this.retryCount++,t.details.indexOf("LoadTimeOut")>-1&&null!==(e=t.context)&&void 0!==e&&e.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+t.details+'"'),this.loadPlaylist();else{var s=Math.min(Math.pow(2,this.retryCount)*r.levelLoadingRetryDelay,r.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout((function(){return i.loadPlaylist()}),s),this.warn("retry playlist loading #"+this.retryCount+" in "+s+' ms after "'+t.details+'"')}else this.warn('cannot recover from error "'+t.details+'"'),this.clearTimer(),t.fatal=!0;return n},t}()},"./src/controller/base-stream-controller.ts":
/*!**************************************************!*\
!*** ./src/controller/base-stream-controller.ts ***!
\**************************************************/
/*! exports provided: State, default */function(t,e,i){"use strict";i.r(e),i.d(e,"State",(function(){return S})),i.d(e,"default",(function(){return C}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ../task-loop */"./src/task-loop.ts"),s=i(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),a=i(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),o=i(/*! ../utils/logger */"./src/utils/logger.ts"),l=i(/*! ../events */"./src/events.ts"),c=i(/*! ../errors */"./src/errors.ts"),u=i(/*! ../types/transmuxer */"./src/types/transmuxer.ts"),h=i(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),d=i(/*! ../utils/discontinuities */"./src/utils/discontinuities.ts"),f=i(/*! ./fragment-finders */"./src/controller/fragment-finders.ts"),p=i(/*! ./level-helper */"./src/controller/level-helper.ts"),g=i(/*! ../loader/fragment-loader */"./src/loader/fragment-loader.ts"),v=i(/*! ../crypt/decrypter */"./src/crypt/decrypter.ts"),m=i(/*! ../utils/time-ranges */"./src/utils/time-ranges.ts"),y=i(/*! ../types/loader */"./src/types/loader.ts");function b(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function E(t,e){return(E=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var S={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},C=function(t){var e,i;function n(e,i,r){var n;return(n=t.call(this)||this).hls=void 0,n.fragPrevious=null,n.fragCurrent=null,n.fragmentTracker=void 0,n.transmuxer=null,n._state=S.STOPPED,n.media=void 0,n.mediaBuffer=void 0,n.config=void 0,n.bitrateTest=!1,n.lastCurrentTime=0,n.nextLoadPosition=0,n.startPosition=0,n.loadedmetadata=!1,n.fragLoadError=0,n.retryDate=0,n.levels=null,n.fragmentLoader=void 0,n.levelLastLoaded=null,n.startFragRequested=!1,n.decrypter=void 0,n.initPTS=[],n.onvseeking=null,n.onvended=null,n.logPrefix="",n.log=void 0,n.warn=void 0,n.logPrefix=r,n.log=o.logger.log.bind(o.logger,r+":"),n.warn=o.logger.warn.bind(o.logger,r+":"),n.hls=e,n.fragmentLoader=new g.default(e.config),n.fragmentTracker=i,n.config=e.config,n.decrypter=new v.default(e,e.config),e.on(l.Events.KEY_LOADED,n.onKeyLoaded,function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(n)),n}i=t,(e=n).prototype=Object.create(i.prototype),e.prototype.constructor=e,E(e,i);var C,k,w,x=n.prototype;return x.doTick=function(){this.onTickEnd()},x.onTickEnd=function(){},x.startLoad=function(t){},x.stopLoad=function(){this.fragmentLoader.abort();var t=this.fragCurrent;t&&this.fragmentTracker.removeFragment(t),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=S.STOPPED},x._streamEnded=function(t,e){var i=this.fragCurrent,r=this.fragmentTracker;if(!e.live&&i&&i.sn===e.endSN&&!t.nextStart){var n=r.getState(i);return n===s.FragmentState.PARTIAL||n===s.FragmentState.OK}return!1},x.onMediaAttached=function(t,e){var i=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),i.addEventListener("seeking",this.onvseeking),i.addEventListener("ended",this.onvended);var r=this.config;this.levels&&r.autoStartLoad&&this.state===S.STOPPED&&this.startLoad(r.startPosition)},x.onMediaDetaching=function(){var t=this.media;null!=t&&t.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),t&&(t.removeEventListener("seeking",this.onvseeking),t.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},x.onMediaSeeking=function(){var t=this.config,e=this.fragCurrent,i=this.media,n=this.mediaBuffer,s=this.state,o=i?i.currentTime:0,l=a.BufferHelper.bufferInfo(n||i,o,t.maxBufferHole);if(this.log("media seeking to "+(Object(r.isFiniteNumber)(o)?o.toFixed(3):o)+", state: "+s),s===S.ENDED)this.resetLoadingState();else if(e&&!l.len){var c=t.maxFragLookUpTolerance,u=e.start-c,h=o>e.start+e.duration+c;(o<u||h)&&(h&&e.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),e.loader.abort()),this.resetLoadingState())}i&&(this.lastCurrentTime=o),this.loadedmetadata||l.len||(this.nextLoadPosition=this.startPosition=o),this.tickImmediate()},x.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},x.onKeyLoaded=function(t,e){if(this.state===S.KEY_LOADING&&e.frag===this.fragCurrent&&this.levels){this.state=S.IDLE;var i=this.levels[e.frag.level].details;i&&this.loadFragment(e.frag,i,e.frag.start)}},x.onHandlerDestroying=function(){this.stopLoad(),t.prototype.onHandlerDestroying.call(this)},x.onHandlerDestroyed=function(){this.state=S.STOPPED,this.hls.off(l.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,t.prototype.onHandlerDestroyed.call(this)},x.loadKey=function(t,e){this.log("Loading key for "+t.sn+" of ["+e.startSN+"-"+e.endSN+"], "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+t.level),this.state=S.KEY_LOADING,this.fragCurrent=t,this.hls.trigger(l.Events.KEY_LOADING,{frag:t})},x.loadFragment=function(t,e,i){this._loadFragForPlayback(t,e,i)},x._loadFragForPlayback=function(t,e,i){var r=this;this._doFragLoad(t,e,i,(function(e){if(r.fragContextChanged(t))return r.warn("Fragment "+t.sn+(e.part?" p: "+e.part.index:"")+" of level "+t.level+" was dropped during download."),void r.fragmentTracker.removeFragment(t);t.stats.chunkCount++,r._handleFragmentLoadProgress(e)})).then((function(e){if(e){r.fragLoadError=0;var i=r.state;if(!r.fragContextChanged(t))return"payload"in e&&(r.log("Loaded fragment "+t.sn+" of level "+t.level),r.hls.trigger(l.Events.FRAG_LOADED,e),r.state===S.BACKTRACKING)?(r.fragmentTracker.backtrack(t,e),void r.resetFragmentLoading(t)):void r._handleFragmentLoadComplete(e);(i===S.FRAG_LOADING||i===S.BACKTRACKING||!r.fragCurrent&&i===S.PARSING)&&(r.fragmentTracker.removeFragment(t),r.state=S.IDLE)}})).catch((function(e){r.warn(e),r.resetFragmentLoading(t)}))},x.flushMainBuffer=function(t,e,i){if(void 0===i&&(i=null),t-e){var r={startOffset:t,endOffset:e,type:i};this.fragLoadError=0,this.hls.trigger(l.Events.BUFFER_FLUSHING,r)}},x._loadInitSegment=function(t){var e=this;this._doFragLoad(t).then((function(i){if(!i||e.fragContextChanged(t)||!e.levels)throw new Error("init load aborted");return i})).then((function(i){var r=e.hls,n=i.payload,s=t.decryptdata;if(n&&n.byteLength>0&&s&&s.key&&s.iv&&"AES-128"===s.method){var a=self.performance.now();return e.decrypter.webCryptoDecrypt(new Uint8Array(n),s.key.buffer,s.iv.buffer).then((function(e){var n=self.performance.now();return r.trigger(l.Events.FRAG_DECRYPTED,{frag:t,payload:e,stats:{tstart:a,tdecrypt:n}}),i.payload=e,i}))}return i})).then((function(i){var r=e.fragCurrent,n=e.hls,s=e.levels;if(!s)throw new Error("init load aborted, missing levels");var a=s[t.level].details;console.assert(a,"Level details are defined when init segment is loaded");var o=t.stats;e.state=S.IDLE,e.fragLoadError=0,t.data=new Uint8Array(i.payload),o.parsing.start=o.buffering.start=self.performance.now(),o.parsing.end=o.buffering.end=self.performance.now(),i.frag===r&&n.trigger(l.Events.FRAG_BUFFERED,{stats:o,frag:r,part:null,id:t.type}),e.tick()})).catch((function(i){e.warn(i),e.resetFragmentLoading(t)}))},x.fragContextChanged=function(t){var e=this.fragCurrent;return!t||!e||t.level!==e.level||t.sn!==e.sn||t.urlId!==e.urlId},x.fragBufferedComplete=function(t,e){var i=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+t.type+" sn: "+t.sn+(e?" part: "+e.index:"")+" of "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+t.level+" "+m.default.toString(a.BufferHelper.getBuffered(i))),this.state=S.IDLE,this.tick()},x._handleFragmentLoadComplete=function(t){var e=this.transmuxer;if(e){var i=t.frag,r=t.part,n=t.partsLoaded,s=!n||0===n.length||n.some((function(t){return!t})),a=new u.ChunkMetadata(i.level,i.sn,i.stats.chunkCount+1,0,r?r.index:-1,!s);e.flush(a)}},x._handleFragmentLoadProgress=function(t){},x._doFragLoad=function(t,e,i,n){var s=this;if(void 0===i&&(i=null),!this.levels)throw new Error("frag load aborted, missing levels");if(i=Math.max(t.start,i||0),this.config.lowLatencyMode&&e){var a=e.partList;if(a&&n){i>t.end&&e.fragmentHint&&(t=e.fragmentHint);var o=this.getNextPart(a,t,i);if(o>-1){var c=a[o];return this.log("Loading part sn: "+t.sn+" p: "+c.index+" cc: "+t.cc+" of playlist ["+e.startSN+"-"+e.endSN+"] parts [0-"+o+"-"+(a.length-1)+"] "+("[stream-controller]"===this.logPrefix?"level":"track")+": "+t.level+", target: "+parseFloat(i.toFixed(3))),this.nextLoadPosition=c.start+c.duration,this.state=S.FRAG_LOADING,this.hls.trigger(l.Events.FRAG_LOADING,{frag:t,part:a[o],targetBufferTime:i}),this.doFragPartsLoad(t,a,o,n).catch((function(t){return s.handleFragLoadError(t)}))}if(!t.url||this.loadedEndOfParts(a,i))return Promise.resolve(null)}}return this.log("Loading fragment "+t.sn+" cc: "+t.cc+" "+(e?"of ["+e.startSN+"-"+e.endSN+"] ":"")+("[stream-controller]"===this.logPrefix?"level":"track")+": "+t.level+", target: "+parseFloat(i.toFixed(3))),Object(r.isFiniteNumber)(t.sn)&&!this.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),this.state=S.FRAG_LOADING,this.hls.trigger(l.Events.FRAG_LOADING,{frag:t,targetBufferTime:i}),this.fragmentLoader.load(t,n).catch((function(t){return s.handleFragLoadError(t)}))},x.doFragPartsLoad=function(t,e,i,r){var n=this;return new Promise((function(s,a){var o=[];!function i(c){var u=e[c];n.fragmentLoader.loadPart(t,u,r).then((function(r){o[u.index]=r;var a=r.part;n.hls.trigger(l.Events.FRAG_LOADED,r);var h=e[c+1];if(!h||h.fragment!==t)return s({frag:t,part:a,partsLoaded:o});i(c+1)})).catch(a)}(i)}))},x.handleFragLoadError=function(t){var e=t.data;return e&&e.details===c.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(e.frag,e.part):this.hls.trigger(l.Events.ERROR,e),null},x._handleTransmuxerFlush=function(t){var e=this.getCurrentContext(t);if(e&&this.state===S.PARSING){var i=e.frag,r=e.part,n=e.level,s=self.performance.now();i.stats.parsing.end=s,r&&(r.stats.parsing.end=s),this.updateLevelTiming(i,r,n,t.partial)}else this.fragCurrent||(this.state=S.IDLE)},x.getCurrentContext=function(t){var e=this.levels,i=t.level,r=t.sn,n=t.part;if(!e||!e[i])return this.warn("Levels object was unset while buffering fragment "+r+" of level "+i+". The current chunk will not be buffered."),null;var s=e[i],a=n>-1?Object(p.getPartWith)(s,r,n):null,o=a?a.fragment:Object(p.getFragmentWithSN)(s,r,this.fragCurrent);return o?{frag:o,part:a,level:s}:null},x.bufferFragmentData=function(t,e,i,r){if(t&&this.state===S.PARSING){var n=t.data1,s=t.data2,a=n;if(n&&s&&(a=Object(h.appendUint8Array)(n,s)),a&&a.length){var o={type:t.type,frag:e,part:i,chunkMeta:r,parent:e.type,data:a};this.hls.trigger(l.Events.BUFFER_APPENDING,o),t.dropped&&t.independent&&!i&&this.flushBufferGap(e)}}},x.flushBufferGap=function(t){var e=this.media;if(e)if(a.BufferHelper.isBuffered(e,e.currentTime)){var i=e.currentTime,r=a.BufferHelper.bufferInfo(e,i,0),n=t.duration,s=Math.min(2*this.config.maxFragLookUpTolerance,.25*n),o=Math.max(Math.min(t.start-s,r.end-s),i+s);t.start-o>s&&this.flushMainBuffer(o,t.start)}else this.flushMainBuffer(0,t.start)},x.getFwdBufferInfo=function(t,e){var i=this.config,n=this.getLoadPosition();if(!Object(r.isFiniteNumber)(n))return null;var s=a.BufferHelper.bufferInfo(t,n,i.maxBufferHole);if(0===s.len&&void 0!==s.nextStart){var o=this.fragmentTracker.getBufferedFrag(n,e);if(o&&s.nextStart<o.end)return a.BufferHelper.bufferInfo(t,n,Math.max(s.nextStart,i.maxBufferHole))}return s},x.getMaxBufferLength=function(t){var e,i=this.config;return e=t?Math.max(8*i.maxBufferSize/t,i.maxBufferLength):i.maxBufferLength,Math.min(e,i.maxMaxBufferLength)},x.reduceMaxBufferLength=function(t){var e=this.config,i=t||e.maxBufferLength;return e.maxMaxBufferLength>=i&&(e.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+e.maxMaxBufferLength+"s"),!0)},x.getNextFragment=function(t,e){var i,r,n=e.fragments,s=n.length;if(!s)return null;var a,o=this.config,l=n[0].start;if(e.live){var c=o.initialLiveManifestSize;if(s<c)return this.warn("Not enough fragments to start playback (have: "+s+", need: "+c+")"),null;e.PTSKnown||this.startFragRequested||-1!==this.startPosition||(a=this.getInitialLiveFragment(e,n),this.startPosition=a?this.hls.liveSyncPosition||a.start:t)}else t<=l&&(a=n[0]);if(!a){var u=o.lowLatencyMode?e.partEnd:e.fragmentEnd;a=this.getFragmentAtPosition(t,u,e)}return null===(i=a)||void 0===i||!i.initSegment||null!==(r=a)&&void 0!==r&&r.initSegment.data||this.bitrateTest||(a=a.initSegment),a},x.getNextPart=function(t,e,i){for(var r=-1,n=!1,s=!0,a=0,o=t.length;a<o;a++){var l=t[a];if(s=s&&!l.independent,r>-1&&i<l.start)break;var c=l.loaded;!c&&(n||l.independent||s)&&l.fragment===e&&(r=a),n=c}return r},x.loadedEndOfParts=function(t,e){var i=t[t.length-1];return i&&e>i.start&&i.loaded},x.getInitialLiveFragment=function(t,e){var i=this.fragPrevious,r=null;if(i){if(t.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+i.programDateTime),r=Object(f.findFragmentByPDT)(e,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){var n=i.sn+1;if(n>=t.startSN&&n<=t.endSN){var s=e[n-t.startSN];i.cc===s.cc&&(r=s,this.log("Live playlist, switching playlist, load frag with next SN: "+r.sn))}r||(r=Object(f.findFragWithCC)(e,i.cc))&&this.log("Live playlist, switching playlist, load frag with same CC: "+r.sn)}}else{var a=this.hls.liveSyncPosition;null!==a&&(r=this.getFragmentAtPosition(a,this.bitrateTest?t.fragmentEnd:t.edge,t))}return r},x.getFragmentAtPosition=function(t,e,i){var r,n=this.config,a=this.fragPrevious,o=i.fragments,l=i.endSN,c=i.fragmentHint,u=n.maxFragLookUpTolerance,h=!!(n.lowLatencyMode&&i.partList&&c);if(h&&c&&!this.bitrateTest&&(o=o.concat(c),l=c.sn),t<e){var d=t>e-u?0:u;r=Object(f.findFragmentByPTS)(a,o,t,d)}else r=o[o.length-1];if(r){var p=r.sn-i.startSN,g=a&&r.level===a.level,v=o[p+1];if(this.fragmentTracker.getState(r)===s.FragmentState.BACKTRACKED){r=null;for(var m=p;o[m]&&this.fragmentTracker.getState(o[m])===s.FragmentState.BACKTRACKED;)r=a?o[m--]:o[--m];r||(r=v)}else a&&r.sn===a.sn&&!h&&g&&(r.sn<l&&this.fragmentTracker.getState(v)!==s.FragmentState.OK?(this.log("SN "+r.sn+" just loaded, load next one: "+v.sn),r=v):r=null)}return r},x.synchronizeToLiveEdge=function(t){var e=this.config,i=this.media;if(i){var r=this.hls.liveSyncPosition,n=i.currentTime,s=t.fragments[0].start,a=t.edge,o=n>=s-e.maxFragLookUpTolerance&&n<=a;if(null!==r&&i.duration>r&&(n<r||!o)){var l=void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:e.liveMaxLatencyDurationCount*t.targetduration;(!o&&i.readyState<4||n<a-l)&&(this.loadedmetadata||(this.nextLoadPosition=r),i.readyState&&(this.warn("Playback: "+n.toFixed(3)+" is located too far from the end of live sliding playlist: "+a+", reset currentTime to : "+r.toFixed(3)),i.currentTime=r))}}},x.alignPlaylists=function(t,e){var i=this.levels,n=this.levelLastLoaded,s=this.fragPrevious,a=null!==n?i[n]:null,o=t.fragments.length;if(!o)return this.warn("No fragments in live playlist"),0;var l=t.fragments[0].start,c=!e,u=t.alignedSliding&&Object(r.isFiniteNumber)(l);if(c||!u&&!l){Object(d.alignStream)(s,a,t);var h=t.fragments[0].start;return this.log("Live playlist sliding: "+h.toFixed(2)+" start-sn: "+(e?e.startSN:"na")+"->"+t.startSN+" prev-sn: "+(s?s.sn:"na")+" fragments: "+o),h}return l},x.waitForCdnTuneIn=function(t){return t.live&&t.canBlockReload&&t.tuneInGoal>Math.max(t.partHoldBack,3*t.partTarget)},x.setStartPosition=function(t,e){var i=this.startPosition;if(i<e&&(i=-1),-1===i||-1===this.lastCurrentTime){var n=t.startTimeOffset;Object(r.isFiniteNumber)(n)?(i=e+n,n<0&&(i+=t.totalduration),i=Math.min(Math.max(e,i),e+t.totalduration),this.log("Start time offset "+n+" found in playlist, adjust startPosition to "+i),this.startPosition=i):t.live?i=this.hls.liveSyncPosition||e:this.startPosition=i=0,this.lastCurrentTime=i}this.nextLoadPosition=i},x.getLoadPosition=function(){var t=this.media,e=0;return this.loadedmetadata&&t?e=t.currentTime:this.nextLoadPosition&&(e=this.nextLoadPosition),e},x.handleFragLoadAborted=function(t,e){this.transmuxer&&"initSegment"!==t.sn&&t.stats.aborted&&(this.warn("Fragment "+t.sn+(e?" part"+e.index:"")+" of level "+t.level+" was aborted"),this.resetFragmentLoading(t))},x.resetFragmentLoading=function(t){this.fragCurrent&&this.fragContextChanged(t)||(this.state=S.IDLE)},x.onFragmentOrKeyLoadError=function(t,e){if(!e.fatal){var i=e.frag;if(i&&i.type===t){var r=this.fragCurrent;console.assert(r&&i.sn===r.sn&&i.level===r.level&&i.urlId===r.urlId,"Frag load error must match current frag to retry");var n=this.config;if(this.fragLoadError+1<=n.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(i.level))return;var s=Math.min(Math.pow(2,this.fragLoadError)*n.fragLoadingRetryDelay,n.fragLoadingMaxRetryTimeout);this.warn("Fragment "+i.sn+" of "+t+" "+i.level+" failed to load, retrying in "+s+"ms"),this.retryDate=self.performance.now()+s,this.fragLoadError++,this.state=S.FRAG_LOADING_WAITING_RETRY}else e.levelRetry?(t===y.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=S.IDLE):(o.logger.error(e.details+" reaches max retry, redispatch as fatal ..."),e.fatal=!0,this.hls.stopLoad(),this.state=S.ERROR)}}},x.afterBufferFlushed=function(t,e,i){if(t){var r=a.BufferHelper.getBuffered(t);this.fragmentTracker.detectEvictedFragments(e,r,i),this.state===S.ENDED&&this.resetLoadingState()}},x.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=S.IDLE},x.resetLiveStartWhenNotLoaded=function(t){if(!this.loadedmetadata){this.startFragRequested=!1;var e=this.levels?this.levels[t].details:null;if(null!=e&&e.live)return this.startPosition=-1,this.setStartPosition(e,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},x.updateLevelTiming=function(t,e,i,r){var n=this,s=i.details;console.assert(!!s,"level.details must be defined"),Object.keys(t.elementaryStreams).reduce((function(e,a){var o=t.elementaryStreams[a];if(o){var c=o.endPTS-o.startPTS;if(c<=0)return n.warn("Could not parse fragment "+t.sn+" "+a+" duration reliably ("+c+") resetting transmuxer to fallback to playlist timing"),n.resetTransmuxer(),e||!1;var u=r?0:Object(p.updateFragPTSDTS)(s,t,o.startPTS,o.endPTS,o.startDTS,o.endDTS);return n.hls.trigger(l.Events.LEVEL_PTS_UPDATED,{details:s,level:i,drift:u,type:a,frag:t,start:o.startPTS,end:o.endPTS}),!0}return e}),!1)?(this.state=S.PARSED,this.hls.trigger(l.Events.FRAG_PARSED,{frag:t,part:e})):this.resetLoadingState()},x.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},C=n,(k=[{key:"state",get:function(){return this._state},set:function(t){var e=this._state;e!==t&&(this._state=t,this.log(e+"->"+t))}}])&&b(C.prototype,k),w&&b(C,w),n}(n.default)},"./src/controller/buffer-controller.ts":
/*!*********************************************!*\
!*** ./src/controller/buffer-controller.ts ***!
\*********************************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return f}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ../events */"./src/events.ts"),s=i(/*! ../utils/logger */"./src/utils/logger.ts"),a=i(/*! ../errors */"./src/errors.ts"),o=i(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),l=i(/*! ../utils/mediasource-helper */"./src/utils/mediasource-helper.ts"),c=i(/*! ../loader/fragment */"./src/loader/fragment.ts"),u=i(/*! ./buffer-operation-queue */"./src/controller/buffer-operation-queue.ts"),h=Object(l.getMediaSource)(),d=/([ha]vc.)(?:\.[^.,]+)+/,f=function(){function t(t){var e=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 t=e.hls,i=e.media,r=e.mediaSource;s.logger.log("[buffer-controller]: Media source opened"),i&&(e.updateMediaElementDuration(),t.trigger(n.Events.MEDIA_ATTACHED,{media:i})),r&&r.removeEventListener("sourceopen",e._onMediaSourceOpen),e.checkPendingTracks()},this._onMediaSourceClose=function(){s.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){s.logger.log("[buffer-controller]: Media source ended")},this.hls=t,this._initSourceBuffer(),this.registerListeners()}var e=t.prototype;return e.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},e.destroy=function(){this.unregisterListeners(),this.details=null},e.registerListeners=function(){var t=this.hls;t.on(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(n.Events.BUFFER_RESET,this.onBufferReset,this),t.on(n.Events.BUFFER_APPENDING,this.onBufferAppending,this),t.on(n.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.on(n.Events.BUFFER_EOS,this.onBufferEos,this),t.on(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(n.Events.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(n.Events.FRAG_PARSED,this.onFragParsed,this),t.on(n.Events.FRAG_CHANGED,this.onFragChanged,this)},e.unregisterListeners=function(){var t=this.hls;t.off(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(n.Events.BUFFER_RESET,this.onBufferReset,this),t.off(n.Events.BUFFER_APPENDING,this.onBufferAppending,this),t.off(n.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.off(n.Events.BUFFER_EOS,this.onBufferEos,this),t.off(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(n.Events.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(n.Events.FRAG_PARSED,this.onFragParsed,this),t.off(n.Events.FRAG_CHANGED,this.onFragChanged,this)},e._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new u.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},e.onManifestParsed=function(t,e){var i=2;(e.audio&&!e.video||!e.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.details=null,s.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},e.onMediaAttaching=function(t,e){var i=this.media=e.media;if(i&&h){var r=this.mediaSource=new h;r.addEventListener("sourceopen",this._onMediaSourceOpen),r.addEventListener("sourceended",this._onMediaSourceEnded),r.addEventListener("sourceclose",this._onMediaSourceClose),i.src=self.URL.createObjectURL(r),this._objectUrl=i.src}},e.onMediaDetaching=function(){var t=this.media,e=this.mediaSource,i=this._objectUrl;if(e){if(s.logger.log("[buffer-controller]: media source detaching"),"open"===e.readyState)try{e.endOfStream()}catch(t){s.logger.warn("[buffer-controller]: onMediaDetaching: "+t.message+" while calling endOfStream")}this.onBufferReset(),e.removeEventListener("sourceopen",this._onMediaSourceOpen),e.removeEventListener("sourceended",this._onMediaSourceEnded),e.removeEventListener("sourceclose",this._onMediaSourceClose),t&&(i&&self.URL.revokeObjectURL(i),t.src===i?(t.removeAttribute("src"),t.load()):s.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(n.Events.MEDIA_DETACHED,void 0)},e.onBufferReset=function(){var t=this;this.getSourceBufferTypes().forEach((function(e){var i=t.sourceBuffer[e];try{i&&(t.removeBufferListeners(e),t.mediaSource&&t.mediaSource.removeSourceBuffer(i),t.sourceBuffer[e]=void 0)}catch(t){s.logger.warn("[buffer-controller]: Failed to reset the "+e+" buffer",t)}})),this._initSourceBuffer()},e.onBufferCodecs=function(t,e){var i=this,r=this.getSourceBufferTypes().length;Object.keys(e).forEach((function(t){if(r){var n=i.tracks[t];if(n&&"function"==typeof n.buffer.changeType){var s=e[t],a=s.codec,o=s.levelCodec,l=s.container;if((n.levelCodec||n.codec).replace(d,"$1")!==(o||a).replace(d,"$1")){var c=l+";codecs="+(o||a);i.appendChangeType(t,c)}}}else i.pendingTracks[t]=e[t]})),r||(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks())},e.appendChangeType=function(t,e){var i=this,r=this.operationQueue,n={execute:function(){var n=i.sourceBuffer[t];n&&(s.logger.log("[buffer-controller]: changing "+t+" sourceBuffer type to "+e),n.changeType(e)),r.shiftAndExecuteNext(t)},onStart:function(){},onComplete:function(){},onError:function(e){s.logger.warn("[buffer-controller]: Failed to change "+t+" SourceBuffer type",e)}};r.append(n,t)},e.onBufferAppending=function(t,e){var i=this,r=this.hls,l=this.operationQueue,c=this.tracks,u=e.data,h=e.type,d=e.frag,f=e.part,p=e.chunkMeta,g=p.buffering[h],v=self.performance.now();g.start=v;var m=d.stats.buffering,y=f?f.stats.buffering:null;0===m.start&&(m.start=v),y&&0===y.start&&(y.start=v);var b=c.audio,E="audio"===h&&1===p.id&&"audio/mpeg"===(null==b?void 0:b.container),S={execute:function(){if(g.executeStart=self.performance.now(),E){var t=i.sourceBuffer[h];if(t){var e=d.start-t.timestampOffset;Math.abs(e)>=.1&&(s.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+d.start+" (delta: "+e+") sn: "+d.sn+")"),t.timestampOffset=d.start)}}i.appendExecutor(u,h)},onStart:function(){},onComplete:function(){var t=self.performance.now();g.executeEnd=g.end=t,0===m.first&&(m.first=t),y&&0===y.first&&(y.first=t);var e=i.sourceBuffer,r={};for(var s in e)r[s]=o.BufferHelper.getBuffered(e[s]);i.appendError=0,i.hls.trigger(n.Events.BUFFER_APPENDED,{type:h,frag:d,part:f,chunkMeta:p,parent:d.type,timeRanges:r})},onError:function(t){s.logger.error("[buffer-controller]: Error encountered while trying to append to the "+h+" SourceBuffer",t);var e={type:a.ErrorTypes.MEDIA_ERROR,parent:d.type,details:a.ErrorDetails.BUFFER_APPEND_ERROR,err:t,fatal:!1};t.code===DOMException.QUOTA_EXCEEDED_ERR?e.details=a.ErrorDetails.BUFFER_FULL_ERROR:(i.appendError++,e.details=a.ErrorDetails.BUFFER_APPEND_ERROR,i.appendError>r.config.appendErrorMaxRetry&&(s.logger.error("[buffer-controller]: Failed "+r.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),e.fatal=!0)),r.trigger(n.Events.ERROR,e)}};l.append(S,h)},e.onBufferFlushing=function(t,e){var i=this,r=this.operationQueue,a=function(t){return{execute:i.removeExecutor.bind(i,t,e.startOffset,e.endOffset),onStart:function(){},onComplete:function(){i.hls.trigger(n.Events.BUFFER_FLUSHED,{type:t})},onError:function(e){s.logger.warn("[buffer-controller]: Failed to remove from "+t+" SourceBuffer",e)}}};e.type?r.append(a(e.type),e.type):this.getSourceBufferTypes().forEach((function(t){r.append(a(t),t)}))},e.onFragParsed=function(t,e){var i=this,r=e.frag,a=e.part,o=[],l=a?a.elementaryStreams:r.elementaryStreams;l[c.ElementaryStreamTypes.AUDIOVIDEO]?o.push("audiovideo"):(l[c.ElementaryStreamTypes.AUDIO]&&o.push("audio"),l[c.ElementaryStreamTypes.VIDEO]&&o.push("video")),0===o.length&&s.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+r.type+" level: "+r.level+" sn: "+r.sn),this.blockBuffers((function(){var t=self.performance.now();r.stats.buffering.end=t,a&&(a.stats.buffering.end=t);var e=a?a.stats:r.stats;i.hls.trigger(n.Events.FRAG_BUFFERED,{frag:r,part:a,stats:e,id:r.type})}),o)},e.onFragChanged=function(t,e){this.flushBackBuffer()},e.onBufferEos=function(t,e){var i=this;this.getSourceBufferTypes().reduce((function(t,r){var n=i.sourceBuffer[r];return e.type&&e.type!==r||n&&!n.ended&&(n.ended=!0,s.logger.log("[buffer-controller]: "+r+" sourceBuffer now EOS")),t&&!(n&&!n.ended)}),!0)&&this.blockBuffers((function(){var t=i.mediaSource;t&&"open"===t.readyState&&t.endOfStream()}))},e.onLevelUpdated=function(t,e){var i=e.details;i.fragments.length&&(this.details=i,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},e.flushBackBuffer=function(){var t=this.hls,e=this.details,i=this.media,s=this.sourceBuffer;if(i&&null!==e){var a=this.getSourceBufferTypes();if(a.length){var l=e.live&&null!==t.config.liveBackBufferLength?t.config.liveBackBufferLength:t.config.backBufferLength;if(Object(r.isFiniteNumber)(l)&&!(l<0)){var c=i.currentTime,u=e.levelTargetDuration,h=Math.max(l,u),d=Math.floor(c/u)*u-h;a.forEach((function(i){var r=s[i];if(r){var a=o.BufferHelper.getBuffered(r);a.length>0&&d>a.start(0)&&(t.trigger(n.Events.BACK_BUFFER_REACHED,{bufferEnd:d}),e.live&&t.trigger(n.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:d}),t.trigger(n.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:d,type:i}))}}))}}}},e.updateMediaElementDuration=function(){if(this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState){var t=this.details,e=this.hls,i=this.media,n=this.mediaSource,a=t.fragments[0].start+t.totalduration,o=i.duration,l=Object(r.isFiniteNumber)(n.duration)?n.duration:0;t.live&&e.config.liveDurationInfinity?(s.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),n.duration=1/0,this.updateSeekableRange(t)):(a>l&&a>o||!Object(r.isFiniteNumber)(o))&&(s.logger.log("[buffer-controller]: Updating Media Source duration to "+a.toFixed(3)),n.duration=a)}},e.updateSeekableRange=function(t){var e=this.mediaSource,i=t.fragments;if(i.length&&t.live&&null!=e&&e.setLiveSeekableRange){var r=Math.max(0,i[0].start),n=Math.max(r,r+t.totalduration);e.setLiveSeekableRange(r,n)}},e.checkPendingTracks=function(){var t=this.bufferCodecEventsExpected,e=this.operationQueue,i=this.pendingTracks,r=Object.keys(i).length;if(r&&!t||2===r){this.createSourceBuffers(i),this.pendingTracks={};var s=this.getSourceBufferTypes();if(0===s.length)return void this.hls.trigger(n.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});s.forEach((function(t){e.executeNext(t)}))}},e.createSourceBuffers=function(t){var e=this.sourceBuffer,i=this.mediaSource;if(!i)throw Error("createSourceBuffers called when mediaSource was null");var r=0;for(var o in t)if(!e[o]){var l=t[o];if(!l)throw Error("source buffer exists for track "+o+", however track does not");var c=l.levelCodec||l.codec,u=l.container+";codecs="+c;s.logger.log("[buffer-controller]: creating sourceBuffer("+u+")");try{var h=e[o]=i.addSourceBuffer(u),d=o;this.addBufferListener(d,"updatestart",this._onSBUpdateStart),this.addBufferListener(d,"updateend",this._onSBUpdateEnd),this.addBufferListener(d,"error",this._onSBUpdateError),this.tracks[o]={buffer:h,codec:c,container:l.container,levelCodec:l.levelCodec,id:l.id},r++}catch(t){s.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+t.message),this.hls.trigger(n.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:t,mimeType:u})}}r&&this.hls.trigger(n.Events.BUFFER_CREATED,{tracks:this.tracks})},e._onSBUpdateStart=function(t){this.operationQueue.current(t).onStart()},e._onSBUpdateEnd=function(t){var e=this.operationQueue;e.current(t).onComplete(),e.shiftAndExecuteNext(t)},e._onSBUpdateError=function(t,e){s.logger.error("[buffer-controller]: "+t+" SourceBuffer error",e),this.hls.trigger(n.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var i=this.operationQueue.current(t);i&&i.onError(e)},e.removeExecutor=function(t,e,i){var n=this.media,a=this.mediaSource,o=this.operationQueue,l=this.sourceBuffer[t];if(!n||!a||!l)return s.logger.warn("[buffer-controller]: Attempting to remove from the "+t+" SourceBuffer, but it does not exist"),void o.shiftAndExecuteNext(t);var c=Object(r.isFiniteNumber)(n.duration)?n.duration:1/0,u=Object(r.isFiniteNumber)(a.duration)?a.duration:1/0,h=Math.max(0,e),d=Math.min(i,c,u);d>h?(s.logger.log("[buffer-controller]: Removing ["+h+","+d+"] from the "+t+" SourceBuffer"),console.assert(!l.updating,t+" sourceBuffer must not be updating"),l.remove(h,d)):o.shiftAndExecuteNext(t)},e.appendExecutor=function(t,e){var i=this.operationQueue,r=this.sourceBuffer[e];if(!r)return s.logger.warn("[buffer-controller]: Attempting to append to the "+e+" SourceBuffer, but it does not exist"),void i.shiftAndExecuteNext(e);r.ended=!1,console.assert(!r.updating,e+" sourceBuffer must not be updating"),r.appendBuffer(t)},e.blockBuffers=function(t,e){var i=this;if(void 0===e&&(e=this.getSourceBufferTypes()),!e.length)return s.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve(t);var r=this.operationQueue,n=e.map((function(t){return r.appendBlocker(t)}));Promise.all(n).then((function(){t(),e.forEach((function(t){var e=i.sourceBuffer[t];e&&e.updating||r.shiftAndExecuteNext(t)}))}))},e.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},e.addBufferListener=function(t,e,i){var r=this.sourceBuffer[t];if(r){var n=i.bind(this,t);this.listeners[t].push({event:e,listener:n}),r.addEventListener(e,n)}},e.removeBufferListeners=function(t){var e=this.sourceBuffer[t];e&&this.listeners[t].forEach((function(t){e.removeEventListener(t.event,t.listener)}))},t}()},"./src/controller/buffer-operation-queue.ts":
/*!**************************************************!*\
!*** ./src/controller/buffer-operation-queue.ts ***!
\**************************************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return n}));var r=i(/*! ../utils/logger */"./src/utils/logger.ts"),n=function(){function t(t){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=t}var e=t.prototype;return e.append=function(t,e){var i=this.queues[e];i.push(t),1===i.length&&this.buffers[e]&&this.executeNext(e)},e.insertAbort=function(t,e){this.queues[e].unshift(t),this.executeNext(e)},e.appendBlocker=function(t){var e,i=new Promise((function(t){e=t})),r={execute:e,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(r,t),i},e.executeNext=function(t){var e=this.buffers,i=this.queues,n=e[t],s=i[t];if(s.length){var a=s[0];try{a.execute()}catch(e){r.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),a.onError(e),n&&n.updating||(s.shift(),this.executeNext(t))}}},e.shiftAndExecuteNext=function(t){this.queues[t].shift(),this.executeNext(t)},e.current=function(t){return this.queues[t][0]},t}()},"./src/controller/cap-level-controller.ts":
/*!************************************************!*\
!*** ./src/controller/cap-level-controller.ts ***!
\************************************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e);var r=i(/*! ../events */"./src/events.ts");function n(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var s=function(){function t(t){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=t,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var e,i,s,a=t.prototype;return a.setStreamController=function(t){this.streamController=t},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 t=this.hls;t.on(r.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.on(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(r.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},a.unregisterListener=function(){var t=this.hls;t.off(r.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.off(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(r.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},a.onFpsDropLevelCapping=function(e,i){t.isLevelAllowed(i.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(i.droppedLevel)},a.onMediaAttaching=function(t,e){this.media=e.media instanceof HTMLVideoElement?e.media:null},a.onManifestParsed=function(t,e){var i=this.hls;this.restrictedLevels=[],this.firstLevel=e.firstLevel,i.config.capLevelToPlayerSize&&e.video&&this.startCapping()},a.onBufferCodecs=function(t,e){this.hls.config.capLevelToPlayerSize&&e.video&&this.startCapping()},a.onMediaDetaching=function(){this.stopCapping()},a.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var t=this.hls.levels;if(t.length){var e=this.hls;e.autoLevelCapping=this.getMaxLevel(t.length-1),e.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=e.autoLevelCapping}}},a.getMaxLevel=function(e){var i=this,r=this.hls.levels;if(!r.length)return-1;var n=r.filter((function(r,n){return t.isLevelAllowed(n,i.restrictedLevels)&&n<=e}));return this.clientRect=null,t.getMaxLevelByMediaSize(n,this.mediaWidth,this.mediaHeight)},a.startCapping=function(){this.timer||(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 t=this.media,e={width:0,height:0};if(t){var i=t.getBoundingClientRect();e.width=i.width,e.height=i.height,e.width||e.height||(e.width=i.right-i.left||t.width||0,e.height=i.bottom-i.top||t.height||0)}return this.clientRect=e,e},t.isLevelAllowed=function(t,e){return void 0===e&&(e=[]),-1===e.indexOf(t)},t.getMaxLevelByMediaSize=function(t,e,i){if(!t||!t.length)return-1;for(var r,n,s=t.length-1,a=0;a<t.length;a+=1){var o=t[a];if((o.width>=e||o.height>=i)&&(r=o,!(n=t[a+1])||r.width!==n.width||r.height!==n.height)){s=a;break}}return s},e=t,s=[{key:"contentScaleFactor",get:function(){var t=1;try{t=self.devicePixelRatio}catch(t){}return t}}],(i=[{key:"mediaWidth",get:function(){return this.getDimensions().width*t.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*t.contentScaleFactor}}])&&n(e.prototype,i),s&&n(e,s),t}();e.default=s},"./src/controller/cmcd-controller.ts":
/*!*******************************************!*\
!*** ./src/controller/cmcd-controller.ts ***!
\*******************************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return d}));var r=i(/*! ../events */"./src/events.ts"),n=i(/*! ../types/cmcd */"./src/types/cmcd.ts"),s=i(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),a=i(/*! ../utils/logger */"./src/utils/logger.ts");function o(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e,i){return e&&o(t.prototype,e),i&&o(t,i),t}function c(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return u(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?u(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=new Array(e);i<e;i++)r[i]=t[i];return r}function h(){return(h=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t}).apply(this,arguments)}var d=function(){function t(e){var i=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(){i.initialized&&(i.starved=!0),i.buffering=!0},this.onPlaying=function(){i.initialized||(i.initialized=!0),i.buffering=!1},this.applyPlaylistData=function(t){try{i.apply(t,{ot:n.CMCDObjectType.MANIFEST,su:!i.initialized})}catch(t){a.logger.warn("Could not generate manifest CMCD data.",t)}},this.applyFragmentData=function(t){try{var e=t.frag,r=i.hls.levels[e.level],s=i.getObjectType(e),o={d:1e3*e.duration,ot:s};s!==n.CMCDObjectType.VIDEO&&s!==n.CMCDObjectType.AUDIO&&s!=n.CMCDObjectType.MUXED||(o.br=r.bitrate/1e3,o.tb=i.getTopBandwidth(s),o.bl=i.getBufferLength(s)),i.apply(t,o)}catch(t){a.logger.warn("Could not generate segment CMCD data.",t)}},this.hls=e;var r=this.config=e.config,s=r.cmcd;null!=s&&(r.pLoader=this.createPlaylistLoader(),r.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||t.uuid(),this.cid=s.contentId,this.useHeaders=!0===s.useHeaders,this.registerListeners())}var e=t.prototype;return e.registerListeners=function(){var t=this.hls;t.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(r.Events.MEDIA_DETACHED,this.onMediaDetached,this),t.on(r.Events.BUFFER_CREATED,this.onBufferCreated,this)},e.unregisterListeners=function(){var t=this.hls;t.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(r.Events.MEDIA_DETACHED,this.onMediaDetached,this),t.off(r.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},e.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},e.onMediaAttached=function(t,e){this.media=e.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},e.onMediaDetached=function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},e.onBufferCreated=function(t,e){var i,r;this.audioBuffer=null===(i=e.tracks.audio)||void 0===i?void 0:i.buffer,this.videoBuffer=null===(r=e.tracks.video)||void 0===r?void 0:r.buffer},e.createData=function(){var t;return{v:n.CMCDVersion,sf:n.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:null===(t=this.media)||void 0===t?void 0:t.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},e.apply=function(e,i){void 0===i&&(i={}),h(i,this.createData());var r=i.ot===n.CMCDObjectType.INIT||i.ot===n.CMCDObjectType.VIDEO||i.ot===n.CMCDObjectType.MUXED;if(this.starved&&r&&(i.bs=!0,i.su=!0,this.starved=!1),null==i.su&&(i.su=this.buffering),this.useHeaders){var s=t.toHeaders(i);if(!Object.keys(s).length)return;e.headers||(e.headers={}),h(e.headers,s)}else{var a=t.toQuery(i);if(!a)return;e.url=t.appendQueryToUri(e.url,a)}},e.getObjectType=function(t){var e=t.type;return"subtitle"===e?n.CMCDObjectType.TIMED_TEXT:"initSegment"===t.sn?n.CMCDObjectType.INIT:"audio"===e?n.CMCDObjectType.AUDIO:"main"===e?this.hls.audioTracks.length?n.CMCDObjectType.VIDEO:n.CMCDObjectType.MUXED:void 0},e.getTopBandwidth=function(t){for(var e,i=0,r=c(t===n.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels);!(e=r()).done;){var s=e.value;s.bitrate>i&&(i=s.bitrate)}return i>0?i:NaN},e.getBufferLength=function(t){var e=this.hls.media,i=t===n.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;return i&&e?1e3*s.BufferHelper.bufferInfo(i,e.currentTime,this.config.maxBufferHole).len:NaN},e.createPlaylistLoader=function(){var t=this.config.pLoader,e=this.applyPlaylistData,i=t||this.config.loader;return function(){function t(t){this.loader=void 0,this.loader=new i(t)}var r=t.prototype;return r.destroy=function(){this.loader.destroy()},r.abort=function(){this.loader.abort()},r.load=function(t,i,r){e(t),this.loader.load(t,i,r)},l(t,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),t}()},e.createFragmentLoader=function(){var t=this.config.fLoader,e=this.applyFragmentData,i=t||this.config.loader;return function(){function t(t){this.loader=void 0,this.loader=new i(t)}var r=t.prototype;return r.destroy=function(){this.loader.destroy()},r.abort=function(){this.loader.abort()},r.load=function(t,i,r){e(t),this.loader.load(t,i,r)},l(t,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),t}()},t.uuid=function(){var t=URL.createObjectURL(new Blob),e=t.toString();return URL.revokeObjectURL(t),e.substr(e.lastIndexOf("/")+1)},t.serialize=function(t){for(var e,i=[],r=function(t){return!Number.isNaN(t)&&null!=t&&""!==t&&!1!==t},n=function(t){return Math.round(t)},s=function(t){return 100*n(t/100)},a={br:n,d:n,bl:s,dl:s,mtp:s,nor:function(t){return encodeURIComponent(t)},rtp:s,tb:n},o=c(Object.keys(t||{}).sort());!(e=o()).done;){var l=e.value,u=t[l];if(r(u)&&!("v"===l&&1===u||"pr"==l&&1===u)){var h=a[l];h&&(u=h(u));var d=typeof u,f=void 0;f="ot"===l||"sf"===l||"st"===l?l+"="+u:"boolean"===d?l:"number"===d?l+"="+u:l+"="+JSON.stringify(u),i.push(f)}}return i.join(",")},t.toHeaders=function(e){for(var i={},r=["Object","Request","Session","Status"],n=[{},{},{},{}],s={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},a=0,o=Object.keys(e);a<o.length;a++){var l=o[a];n[null!=s[l]?s[l]:1][l]=e[l]}for(var c=0;c<n.length;c++){var u=t.serialize(n[c]);u&&(i["CMCD-"+r[c]]=u)}return i},t.toQuery=function(e){return"CMCD="+encodeURIComponent(t.serialize(e))},t.appendQueryToUri=function(t,e){if(!e)return t;var i=t.includes("?")?"&":"?";return""+t+i+e},t}()},"./src/controller/eme-controller.ts":
/*!******************************************!*\
!*** ./src/controller/eme-controller.ts ***!
\******************************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e);var r=i(/*! ../events */"./src/events.ts"),n=i(/*! ../errors */"./src/errors.ts"),s=i(/*! ../utils/logger */"./src/utils/logger.ts"),a=i(/*! ../utils/mediakeys-helper */"./src/utils/mediakeys-helper.ts");function o(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var l=function(){function t(t){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=t,this._config=t.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,i,l,c=t.prototype;return c.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},c._registerListeners=function(){this.hls.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(r.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(r.Events.MANIFEST_PARSED,this.onManifestParsed,this)},c._unregisterListeners=function(){this.hls.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(r.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(r.Events.MANIFEST_PARSED,this.onManifestParsed,this)},c.getLicenseServerUrl=function(t){switch(t){case a.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+t+'"')},c._attemptKeySystemAccess=function(t,e,i){var r=this,n=function(t,e,i,r){switch(t){case a.KeySystems.WIDEVINE:return function(t,e,i){var r={audioCapabilities:[],videoCapabilities:[]};return t.forEach((function(t){r.audioCapabilities.push({contentType:'audio/mp4; codecs="'+t+'"',robustness:i.audioRobustness||""})})),e.forEach((function(t){r.videoCapabilities.push({contentType:'video/mp4; codecs="'+t+'"',robustness:i.videoRobustness||""})})),[r]}(e,i,r);default:throw new Error("Unknown key-system: "+t)}}(t,e,i,this._drmSystemOptions);s.logger.log("Requesting encrypted media key-system access");var o=this.requestMediaKeySystemAccess(t,n);this.mediaKeysPromise=o.then((function(e){return r._onMediaKeySystemAccessObtained(t,e)})),o.catch((function(e){s.logger.error('Failed to obtain key-system "'+t+'" access:',e)}))},c._onMediaKeySystemAccessObtained=function(t,e){var i=this;s.logger.log('Access for key-system "'+t+'" obtained');var r={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:e,mediaKeySystemDomain:t};this._mediaKeysList.push(r);var n=Promise.resolve().then((function(){return e.createMediaKeys()})).then((function(e){return r.mediaKeys=e,s.logger.log('Media-keys created for key-system "'+t+'"'),i._onMediaKeysCreated(),e}));return n.catch((function(t){s.logger.error("Failed to create media-keys:",t)})),n},c._onMediaKeysCreated=function(){var t=this;this._mediaKeysList.forEach((function(e){e.mediaKeysSession||(e.mediaKeysSession=e.mediaKeys.createSession(),t._onNewMediaKeySession(e.mediaKeysSession))}))},c._onNewMediaKeySession=function(t){var e=this;s.logger.log("New key-system session "+t.sessionId),t.addEventListener("message",(function(i){e._onKeySessionMessage(t,i.message)}),!1)},c._onKeySessionMessage=function(t,e){s.logger.log("Got EME message event, creating license request"),this._requestLicense(e,(function(e){s.logger.log("Received license data (length: "+(e?e.byteLength:e)+"), updating key-session"),t.update(e)}))},c.onMediaEncrypted=function(t){var e=this;if(s.logger.log('Media is encrypted using "'+t.initDataType+'" init data type'),!this.mediaKeysPromise)return s.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),void this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});var i=function(i){e._media&&(e._attemptSetMediaKeys(i),e._generateRequestWithPreferredKeySession(t.initDataType,t.initData))};this.mediaKeysPromise.then(i).catch(i)},c._attemptSetMediaKeys=function(t){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var e=this._mediaKeysList[0];if(!e||!e.mediaKeys)return s.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),void this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});s.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(e.mediaKeys),this._hasSetMediaKeys=!0}},c._generateRequestWithPreferredKeySession=function(t,e){var i=this,a=this._mediaKeysList[0];if(!a)return s.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),void this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});if(a.mediaKeysSessionInitialized)s.logger.warn("Key-Session already initialized but requested again");else{var o=a.mediaKeysSession;if(!o)return s.logger.error("Fatal: Media is encrypted but no key-session existing"),void this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});if(!e)return s.logger.warn("Fatal: initData required for generating a key session is null"),void this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});s.logger.log('Generating key-session request for "'+t+'" init data type'),a.mediaKeysSessionInitialized=!0,o.generateRequest(t,e).then((function(){s.logger.debug("Key-session generation succeeded")})).catch((function(t){s.logger.error("Error generating key-session request:",t),i.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})}))}},c._createLicenseXhr=function(t,e,i){var r=new XMLHttpRequest;r.responseType="arraybuffer",r.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,r,t,e,i);var n=this._licenseXhrSetup;if(n)try{n.call(this.hls,r,t),n=void 0}catch(t){s.logger.error(t)}try{r.readyState||r.open("POST",t,!0),n&&n.call(this.hls,r,t)}catch(t){throw new Error("issue setting up KeySystem license XHR "+t)}return r},c._onLicenseRequestReadyStageChange=function(t,e,i,a){switch(t.readyState){case 4:if(200===t.status){this._requestLicenseFailureCount=0,s.logger.log("License request succeeded");var o=t.response,l=this._licenseResponseCallback;if(l)try{o=l.call(this.hls,t,e)}catch(t){s.logger.error(t)}a(o)}else{if(s.logger.error("License Request XHR failed ("+e+"). Status: "+t.status+" ("+t.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>3)return void this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});var c=3-this._requestLicenseFailureCount+1;s.logger.warn("Retrying license request, "+c+" attempts left"),this._requestLicense(i,a)}}},c._generateLicenseRequestChallenge=function(t,e){switch(t.mediaKeySystemDomain){case a.KeySystems.WIDEVINE:return e}throw new Error("unsupported key-system: "+t.mediaKeySystemDomain)},c._requestLicense=function(t,e){s.logger.log("Requesting content license for key-system");var i=this._mediaKeysList[0];if(!i)return s.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),void this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});try{var a=this.getLicenseServerUrl(i.mediaKeySystemDomain),o=this._createLicenseXhr(a,t,e);s.logger.log("Sending license request to URL: "+a);var l=this._generateLicenseRequestChallenge(i,t);o.send(l)}catch(t){s.logger.error("Failure requesting DRM license: "+t),this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},c.onMediaAttached=function(t,e){if(this._emeEnabled){var i=e.media;this._media=i,i.addEventListener("encrypted",this._onMediaEncrypted)}},c.onMediaDetached=function(){var t=this._media,e=this._mediaKeysList;t&&(t.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(e.map((function(t){if(t.mediaKeysSession)return t.mediaKeysSession.close().catch((function(){}))}))).then((function(){return t.setMediaKeys(null)})).catch((function(){})))},c.onManifestParsed=function(t,e){if(this._emeEnabled){var i=e.levels.map((function(t){return t.audioCodec})).filter((function(t){return!!t})),r=e.levels.map((function(t){return t.videoCodec})).filter((function(t){return!!t}));this._attemptKeySystemAccess(a.KeySystems.WIDEVINE,i,r)}},e=t,(i=[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}])&&o(e.prototype,i),l&&o(e,l),t}();e.default=l},"./src/controller/fps-controller.ts":
/*!******************************************!*\
!*** ./src/controller/fps-controller.ts ***!
\******************************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e);var r=i(/*! ../events */"./src/events.ts"),n=i(/*! ../utils/logger */"./src/utils/logger.ts"),s=function(){function t(t){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=t,this.registerListeners()}var e=t.prototype;return e.setStreamController=function(t){this.streamController=t},e.registerListeners=function(){this.hls.on(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},e.unregisterListeners=function(){this.hls.off(r.Events.MEDIA_ATTACHING,this.onMediaAttaching)},e.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},e.onMediaAttaching=function(t,e){var i=this.hls.config;if(i.capLevelOnFPSDrop){var r=e.media instanceof self.HTMLVideoElement?e.media:null;this.media=r,r&&"function"==typeof r.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}},e.checkFPS=function(t,e,i){var s=performance.now();if(e){if(this.lastTime){var a=s-this.lastTime,o=i-this.lastDroppedFrames,l=e-this.lastDecodedFrames,c=1e3*o/a,u=this.hls;if(u.trigger(r.Events.FPS_DROP,{currentDropped:o,currentDecoded:l,totalDroppedFrames:i}),c>0&&o>u.config.fpsDroppedMonitoringThreshold*l){var h=u.currentLevel;n.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+h),h>0&&(-1===u.autoLevelCapping||u.autoLevelCapping>=h)&&(h-=1,u.trigger(r.Events.FPS_DROP_LEVEL_CAPPING,{level:h,droppedLevel:u.currentLevel}),u.autoLevelCapping=h,this.streamController.nextLevelSwitch())}}this.lastTime=s,this.lastDroppedFrames=i,this.lastDecodedFrames=e}},e.checkFPSInterval=function(){var t=this.media;if(t)if(this.isVideoPlaybackQualityAvailable){var e=t.getVideoPlaybackQuality();this.checkFPS(t,e.totalVideoFrames,e.droppedVideoFrames)}else this.checkFPS(t,t.webkitDecodedFrameCount,t.webkitDroppedFrameCount)},t}();e.default=s},"./src/controller/fragment-finders.ts":
/*!********************************************!*\
!*** ./src/controller/fragment-finders.ts ***!
\********************************************/
/*! exports provided: findFragmentByPDT, findFragmentByPTS, fragmentWithinToleranceTest, pdtWithinToleranceTest, findFragWithCC */function(t,e,i){"use strict";i.r(e),i.d(e,"findFragmentByPDT",(function(){return s})),i.d(e,"findFragmentByPTS",(function(){return a})),i.d(e,"fragmentWithinToleranceTest",(function(){return o})),i.d(e,"pdtWithinToleranceTest",(function(){return l})),i.d(e,"findFragWithCC",(function(){return c}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ../utils/binary-search */"./src/utils/binary-search.ts");function s(t,e,i){if(null===e||!Array.isArray(t)||!t.length||!Object(r.isFiniteNumber)(e))return null;if(e<(t[0].programDateTime||0))return null;if(e>=(t[t.length-1].endProgramDateTime||0))return null;i=i||0;for(var n=0;n<t.length;++n){var s=t[n];if(l(e,i,s))return s}return null}function a(t,e,i,r){void 0===i&&(i=0),void 0===r&&(r=0);var s=null;if(t?s=e[t.sn-e[0].sn+1]||null:0===i&&0===e[0].start&&(s=e[0]),s&&0===o(i,r,s))return s;var a=n.default.search(e,o.bind(null,i,r));return a||s}function o(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0);var r=Math.min(e,i.duration+(i.deltaPTS?i.deltaPTS:0));return i.start+i.duration-r<=t?1:i.start-r>t&&i.start?-1:0}function l(t,e,i){var r=1e3*Math.min(e,i.duration+(i.deltaPTS?i.deltaPTS:0));return(i.endProgramDateTime||0)-r>t}function c(t,e){return n.default.search(t,(function(t){return t.cc<e?1:t.cc>e?-1:0}))}},"./src/controller/fragment-tracker.ts":
/*!********************************************!*\
!*** ./src/controller/fragment-tracker.ts ***!
\********************************************/
/*! exports provided: FragmentState, FragmentTracker */function(t,e,i){"use strict";i.r(e),i.d(e,"FragmentState",(function(){return r})),i.d(e,"FragmentTracker",(function(){return a}));var r,n=i(/*! ../events */"./src/events.ts"),s=i(/*! ../types/loader */"./src/types/loader.ts");!function(t){t.NOT_LOADED="NOT_LOADED",t.BACKTRACKED="BACKTRACKED",t.APPENDING="APPENDING",t.PARTIAL="PARTIAL",t.OK="OK"}(r||(r={}));var a=function(){function t(t){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=t,this._registerListeners()}var e=t.prototype;return e._registerListeners=function(){var t=this.hls;t.on(n.Events.BUFFER_APPENDED,this.onBufferAppended,this),t.on(n.Events.FRAG_BUFFERED,this.onFragBuffered,this),t.on(n.Events.FRAG_LOADED,this.onFragLoaded,this)},e._unregisterListeners=function(){var t=this.hls;t.off(n.Events.BUFFER_APPENDED,this.onBufferAppended,this),t.off(n.Events.FRAG_BUFFERED,this.onFragBuffered,this),t.off(n.Events.FRAG_LOADED,this.onFragLoaded,this)},e.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},e.getAppendedFrag=function(t,e){if(e===s.PlaylistLevelType.MAIN){var i=this.activeFragment,r=this.activeParts;if(!i)return null;if(r)for(var n=r.length;n--;){var a=r[n],o=a?a.end:i.appendedPTS;if(a.start<=t&&void 0!==o&&t<=o)return n>9&&(this.activeParts=r.slice(n-9)),a}else if(i.start<=t&&void 0!==i.appendedPTS&&t<=i.appendedPTS)return i}return this.getBufferedFrag(t,e)},e.getBufferedFrag=function(t,e){for(var i=this.fragments,r=Object.keys(i),n=r.length;n--;){var s=i[r[n]];if((null==s?void 0:s.body.type)===e&&s.buffered){var a=s.body;if(a.start<=t&&t<=a.end)return a}}return null},e.detectEvictedFragments=function(t,e,i){var r=this;Object.keys(this.fragments).forEach((function(n){var s=r.fragments[n];if(s)if(s.buffered){var a=s.range[t];a&&a.time.some((function(t){var i=!r.isTimeBuffered(t.startPTS,t.endPTS,e);return i&&r.removeFragment(s.body),i}))}else s.body.type===i&&r.removeFragment(s.body)}))},e.detectPartialFragments=function(t){var e=this,i=this.timeRanges,r=t.frag,n=t.part;if(i&&"initSegment"!==r.sn){var s=l(r),a=this.fragments[s];a&&(Object.keys(i).forEach((function(t){var s=r.elementaryStreams[t];if(s){var o=i[t],l=null!==n||!0===s.partial;a.range[t]=e.getBufferedTimes(r,n,l,o)}})),a.backtrack=a.loaded=null,Object.keys(a.range).length?a.buffered=!0:this.removeFragment(a.body))}},e.fragBuffered=function(t){var e=l(t),i=this.fragments[e];i&&(i.backtrack=i.loaded=null,i.buffered=!0)},e.getBufferedTimes=function(t,e,i,r){for(var n={time:[],partial:i},s=e?e.start:t.start,a=e?e.end:t.end,o=t.minEndPTS||a,l=t.maxStartPTS||s,c=0;c<r.length;c++){var u=r.start(c)-this.bufferPadding,h=r.end(c)+this.bufferPadding;if(l>=u&&o<=h){n.time.push({startPTS:Math.max(s,r.start(c)),endPTS:Math.min(a,r.end(c))});break}if(s<h&&a>u)n.partial=!0,n.time.push({startPTS:Math.max(s,r.start(c)),endPTS:Math.min(a,r.end(c))});else if(a<=u)break}return n},e.getPartialFragment=function(t){var e,i,r,n=null,s=0,a=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach((function(c){var u=l[c];u&&o(u)&&(i=u.body.start-a,r=u.body.end+a,t>=i&&t<=r&&(e=Math.min(t-i,r-t),s<=e&&(n=u.body,s=e)))})),n},e.getState=function(t){var e=l(t),i=this.fragments[e];return i?i.buffered?o(i)?r.PARTIAL:r.OK:i.backtrack?r.BACKTRACKED:r.APPENDING:r.NOT_LOADED},e.backtrack=function(t,e){var i=l(t),r=this.fragments[i];if(!r||r.backtrack)return null;var n=r.backtrack=e||r.loaded;return r.loaded=null,n},e.getBacktrackData=function(t){var e=l(t),i=this.fragments[e];if(i){var r,n=i.backtrack;if(null!=n&&null!==(r=n.payload)&&void 0!==r&&r.byteLength)return n;this.removeFragment(t)}return null},e.isTimeBuffered=function(t,e,i){for(var r,n,s=0;s<i.length;s++){if(r=i.start(s)-this.bufferPadding,n=i.end(s)+this.bufferPadding,t>=r&&e<=n)return!0;if(e<=r)return!1}return!1},e.onFragLoaded=function(t,e){var i=e.frag,r=e.part;if("initSegment"!==i.sn&&!i.bitrateTest&&!r){var n=l(i);this.fragments[n]={body:i,loaded:e,backtrack:null,buffered:!1,range:Object.create(null)}}},e.onBufferAppended=function(t,e){var i=this,r=e.frag,n=e.part,a=e.timeRanges;if(r.type===s.PlaylistLevelType.MAIN)if(this.activeFragment=r,n){var o=this.activeParts;o||(this.activeParts=o=[]),o.push(n)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach((function(t){var e=a[t];if(i.detectEvictedFragments(t,e),!n)for(var s=0;s<e.length;s++)r.appendedPTS=Math.max(e.end(s),r.appendedPTS||0)}))},e.onFragBuffered=function(t,e){this.detectPartialFragments(e)},e.hasFragment=function(t){var e=l(t);return!!this.fragments[e]},e.removeFragmentsInRange=function(t,e,i){var r=this;Object.keys(this.fragments).forEach((function(n){var s=r.fragments[n];if(s&&s.buffered){var a=s.body;a.type===i&&a.start<e&&a.end>t&&r.removeFragment(a)}}))},e.removeFragment=function(t){var e=l(t);t.stats.loaded=0,t.clearElementaryStreamInfo(),delete this.fragments[e]},e.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},t}();function o(t){var e,i;return t.buffered&&((null===(e=t.range.video)||void 0===e?void 0:e.partial)||(null===(i=t.range.audio)||void 0===i?void 0:i.partial))}function l(t){return t.type+"_"+t.level+"_"+t.urlId+"_"+t.sn}},"./src/controller/gap-controller.ts":
/*!******************************************!*\
!*** ./src/controller/gap-controller.ts ***!
\******************************************/
/*! exports provided: STALL_MINIMUM_DURATION_MS, MAX_START_GAP_JUMP, SKIP_BUFFER_HOLE_STEP_SECONDS, SKIP_BUFFER_RANGE_START, default */function(t,e,i){"use strict";i.r(e),i.d(e,"STALL_MINIMUM_DURATION_MS",(function(){return o})),i.d(e,"MAX_START_GAP_JUMP",(function(){return l})),i.d(e,"SKIP_BUFFER_HOLE_STEP_SECONDS",(function(){return c})),i.d(e,"SKIP_BUFFER_RANGE_START",(function(){return u})),i.d(e,"default",(function(){return h}));var r=i(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),n=i(/*! ../errors */"./src/errors.ts"),s=i(/*! ../events */"./src/events.ts"),a=i(/*! ../utils/logger */"./src/utils/logger.ts"),o=250,l=2,c=.1,u=.05,h=function(){function t(t,e,i,r){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=t,this.media=e,this.fragmentTracker=i,this.hls=r}var e=t.prototype;return e.destroy=function(){this.hls=this.fragmentTracker=this.media=null},e.poll=function(t){var e=this.config,i=this.media,n=this.stalled,s=i.currentTime,c=i.seeking,u=this.seeking&&!c,h=!this.seeking&&c;if(this.seeking=c,s===t){if((h||u)&&(this.stalled=null),!i.paused&&!i.ended&&0!==i.playbackRate&&r.BufferHelper.getBuffered(i).length){var d=r.BufferHelper.bufferInfo(i,s,0),f=d.len>0,p=d.nextStart||0;if(f||p){if(c){var g=d.len>l,v=!p||p-s>l&&!this.fragmentTracker.getPartialFragment(s);if(g||v)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var m,y=Math.max(p,d.start||0)-s,b=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,E=(null==b||null===(m=b.details)||void 0===m?void 0:m.live)?2*b.details.targetduration:l;if(y>0&&y<=E)return void this._trySkipBufferHole(null)}var S=self.performance.now();if(null!==n){var C=S-n;!c&&C>=o&&this._reportStall(d.len);var k=r.BufferHelper.bufferInfo(i,s,e.maxBufferHole);this._tryFixBufferStall(k,C)}else this.stalled=S}}}else if(this.moved=!0,null!==n){if(this.stallReported){var w=self.performance.now()-n;a.logger.warn("playback not stuck anymore @"+s+", after "+Math.round(w)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}},e._tryFixBufferStall=function(t,e){var i=this.config,r=this.fragmentTracker,n=this.media.currentTime,s=r.getPartialFragment(n);s&&this._trySkipBufferHole(s)||t.len>i.maxBufferHole&&e>1e3*i.highBufferWatchdogPeriod&&(a.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},e._reportStall=function(t){var e=this.hls,i=this.media;this.stallReported||(this.stallReported=!0,a.logger.warn("Playback stalling at @"+i.currentTime+" due to low buffer (buffer="+t+")"),e.trigger(s.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:t}))},e._trySkipBufferHole=function(t){for(var e=this.config,i=this.hls,o=this.media,l=o.currentTime,h=0,d=r.BufferHelper.getBuffered(o),f=0;f<d.length;f++){var p=d.start(f);if(l+e.maxBufferHole>=h&&l<p){var g=Math.max(p+u,o.currentTime+c);return a.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+g),this.moved=!0,this.stalled=null,o.currentTime=g,t&&i.trigger(s.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+l+" to "+g,frag:t}),g}h=d.end(f)}return 0},e._tryNudgeBuffer=function(){var t=this.config,e=this.hls,i=this.media,r=i.currentTime,o=(this.nudgeRetry||0)+1;if(this.nudgeRetry=o,o<t.nudgeMaxRetry){var l=r+o*t.nudgeOffset;a.logger.warn("Nudging 'currentTime' from "+r+" to "+l),i.currentTime=l,e.trigger(s.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else a.logger.error("Playhead still not moving while enough data buffered @"+r+" after "+t.nudgeMaxRetry+" nudges"),e.trigger(s.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},t}()},"./src/controller/id3-track-controller.ts":
/*!************************************************!*\
!*** ./src/controller/id3-track-controller.ts ***!
\************************************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e);var r=i(/*! ../events */"./src/events.ts"),n=i(/*! ../utils/texttrack-utils */"./src/utils/texttrack-utils.ts"),s=i(/*! ../demux/id3 */"./src/demux/id3.ts"),a=function(){function t(t){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=t,this._registerListeners()}var e=t.prototype;return e.destroy=function(){this._unregisterListeners()},e._registerListeners=function(){var t=this.hls;t.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(r.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.on(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},e._unregisterListeners=function(){var t=this.hls;t.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(r.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.off(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},e.onMediaAttached=function(t,e){this.media=e.media},e.onMediaDetaching=function(){this.id3Track&&(Object(n.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null)},e.getID3Track=function(t){if(this.media){for(var e=0;e<t.length;e++){var i=t[e];if("metadata"===i.kind&&"id3"===i.label)return Object(n.sendAddTrackEvent)(i,this.media),i}return this.media.addTextTrack("metadata","id3")}},e.onFragParsingMetadata=function(t,e){if(this.media){var i=e.frag,r=e.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var n=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,a=0;a<r.length;a++){var o=s.getID3Frames(r[a].data);if(o){var l=r[a].pts,c=a<r.length-1?r[a+1].pts:i.end;c-l<=0&&(c=l+.25);for(var u=0;u<o.length;u++){var h=o[u];if(!s.isTimeStampFrame(h)){var d=new n(l,c,"");d.value=h,this.id3Track.addCue(d)}}}}}},e.onBufferFlushing=function(t,e){var i=e.startOffset,r=e.endOffset,s=e.type;if(!s||"audio"===s){var a=this.id3Track;a&&Object(n.removeCuesInRange)(a,i,r)}},t}();e.default=a},"./src/controller/latency-controller.ts":
/*!**********************************************!*\
!*** ./src/controller/latency-controller.ts ***!
\**********************************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return o}));var r=i(/*! ../errors */"./src/errors.ts"),n=i(/*! ../events */"./src/events.ts"),s=i(/*! ../utils/logger */"./src/utils/logger.ts");function a(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=function(){function t(t){var e=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 e.timeupdate()},this.hls=t,this.config=t.config,this.registerListeners()}var e,i,o,l=t.prototype;return l.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},l.registerListeners=function(){this.hls.on(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(n.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(n.Events.ERROR,this.onError,this)},l.unregisterListeners=function(){this.hls.off(n.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(n.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(n.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(n.Events.ERROR,this.onError)},l.onMediaAttached=function(t,e){this.media=e.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},l.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},l.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},l.onLevelUpdated=function(t,e){var i=e.details;this.levelDetails=i,i.advanced&&this.timeupdate(),!i.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},l.onError=function(t,e){e.details===r.ErrorDetails.BUFFER_STALLED_ERROR&&(this.stallCount++,s.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))},l.timeupdate=function(){var t=this.media,e=this.levelDetails;if(t&&e){this.currentTime=t.currentTime;var i=this.computeLatency();if(null!==i){this._latency=i;var r=this.config,n=r.lowLatencyMode,s=r.maxLiveSyncPlaybackRate;if(n&&1!==s){var a=this.targetLatency;if(null!==a){var o=i-a,l=o<Math.min(this.maxLatency,a+e.targetduration);if(e.live&&l&&o>.05&&this.forwardBufferLength>1){var c=Math.min(2,Math.max(1,s)),u=Math.round(2/(1+Math.exp(-.75*o-this.edgeStalled))*20)/20;t.playbackRate=Math.min(c,Math.max(1,u))}else 1!==t.playbackRate&&0!==t.playbackRate&&(t.playbackRate=1)}}}}},l.estimateLiveEdge=function(){var t=this.levelDetails;return null===t?null:t.edge+t.age},l.computeLatency=function(){var t=this.estimateLiveEdge();return null===t?null:t-this.currentTime},e=t,(i=[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var t=this.config,e=this.levelDetails;return void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:e?t.liveMaxLatencyDurationCount*e.targetduration:0}},{key:"targetLatency",get:function(){var t=this.levelDetails;if(null===t)return null;var e=t.holdBack,i=t.partHoldBack,r=t.targetduration,n=this.config,s=n.liveSyncDuration,a=n.liveSyncDurationCount,o=n.lowLatencyMode,l=this.hls.userConfig,c=o&&i||e;(l.liveSyncDuration||l.liveSyncDurationCount||0===c)&&(c=void 0!==s?s:a*r);var u=r;return c+Math.min(1*this.stallCount,u)}},{key:"liveSyncPosition",get:function(){var t=this.estimateLiveEdge(),e=this.targetLatency,i=this.levelDetails;if(null===t||null===e||null===i)return null;var r=i.edge,n=t-e-this.edgeStalled,s=r-i.totalduration,a=r-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(s,n),a)}},{key:"drift",get:function(){var t=this.levelDetails;return null===t?1:t.drift}},{key:"edgeStalled",get:function(){var t=this.levelDetails;if(null===t)return 0;var e=3*(this.config.lowLatencyMode&&t.partTarget||t.targetduration);return Math.max(t.age-e,0)}},{key:"forwardBufferLength",get:function(){var t=this.media,e=this.levelDetails;if(!t||!e)return 0;var i=t.buffered.length;return i?t.buffered.end(i-1):e.edge-this.currentTime}}])&&a(e.prototype,i),o&&a(e,o),t}()},"./src/controller/level-controller.ts":
/*!********************************************!*\
!*** ./src/controller/level-controller.ts ***!
\********************************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return p}));var r=i(/*! ../types/level */"./src/types/level.ts"),n=i(/*! ../events */"./src/events.ts"),s=i(/*! ../errors */"./src/errors.ts"),a=i(/*! ../utils/codecs */"./src/utils/codecs.ts"),o=i(/*! ./level-helper */"./src/controller/level-helper.ts"),l=i(/*! ./base-playlist-controller */"./src/controller/base-playlist-controller.ts"),c=i(/*! ../types/loader */"./src/types/loader.ts");function u(){return(u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t}).apply(this,arguments)}function h(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function d(t,e){return(d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var f=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),p=function(t){var e,i;function l(e){var i;return(i=t.call(this,e,"[level-controller]")||this)._levels=[],i._firstLevel=-1,i._startLevel=void 0,i.currentLevelIndex=-1,i.manualLevelIndex=-1,i.onParsedComplete=void 0,i._registerListeners(),i}i=t,(e=l).prototype=Object.create(i.prototype),e.prototype.constructor=e,d(e,i);var p,g,v,m=l.prototype;return m._registerListeners=function(){var t=this.hls;t.on(n.Events.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(n.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.on(n.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(n.Events.FRAG_LOADED,this.onFragLoaded,this),t.on(n.Events.ERROR,this.onError,this)},m._unregisterListeners=function(){var t=this.hls;t.off(n.Events.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(n.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.off(n.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(n.Events.FRAG_LOADED,this.onFragLoaded,this),t.off(n.Events.ERROR,this.onError,this)},m.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,t.prototype.destroy.call(this)},m.startLoad=function(){this._levels.forEach((function(t){t.loadError=0})),t.prototype.startLoad.call(this)},m.onManifestLoaded=function(t,e){var i,l,c=[],u=[],h=[],d={},p=!1,g=!1,v=!1;if(e.levels.forEach((function(t){var e=t.attrs;p=p||!(!t.width||!t.height),g=g||!!t.videoCodec,v=v||!!t.audioCodec,f&&t.audioCodec&&-1!==t.audioCodec.indexOf("mp4a.40.34")&&(t.audioCodec=void 0);var i=t.bitrate+"-"+t.attrs.RESOLUTION+"-"+t.attrs.CODECS;(l=d[i])?l.url.push(t.url):(l=new r.Level(t),d[i]=l,c.push(l)),e&&(e.AUDIO&&Object(o.addGroupId)(l,"audio",e.AUDIO),e.SUBTITLES&&Object(o.addGroupId)(l,"text",e.SUBTITLES))})),(p||g)&&v&&(c=c.filter((function(t){var e=t.videoCodec,i=t.width,r=t.height;return!!e||!(!i||!r)}))),c=c.filter((function(t){var e=t.audioCodec,i=t.videoCodec;return(!e||Object(a.isCodecSupportedInMp4)(e,"audio"))&&(!i||Object(a.isCodecSupportedInMp4)(i,"video"))})),e.audioTracks&&(u=e.audioTracks.filter((function(t){return!t.audioCodec||Object(a.isCodecSupportedInMp4)(t.audioCodec,"audio")})),Object(o.assignTrackIdsByGroup)(u)),e.subtitles&&(h=e.subtitles,Object(o.assignTrackIdsByGroup)(h)),c.length>0){i=c[0].bitrate,c.sort((function(t,e){return t.bitrate-e.bitrate})),this._levels=c;for(var m=0;m<c.length;m++)if(c[m].bitrate===i){this._firstLevel=m,this.log("manifest loaded, "+c.length+" level(s) found, first bitrate: "+i);break}var y=v&&!g,b={levels:c,audioTracks:u,subtitleTracks:h,firstLevel:this._firstLevel,stats:e.stats,audio:v,video:g,altAudio:!y&&u.some((function(t){return!!t.url}))};this.hls.trigger(n.Events.MANIFEST_PARSED,b),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(n.Events.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:e.url,reason:"no level with compatible codecs found in manifest"})},m.onError=function(e,i){if(t.prototype.onError.call(this,e,i),!i.fatal){var r=i.context,n=this._levels[this.currentLevelIndex];if(r&&(r.type===c.PlaylistContextType.AUDIO_TRACK&&n.audioGroupIds&&r.groupId===n.audioGroupIds[n.urlId]||r.type===c.PlaylistContextType.SUBTITLE_TRACK&&n.textGroupIds&&r.groupId===n.textGroupIds[n.urlId]))this.redundantFailover(this.currentLevelIndex);else{var a,o=!1,l=!0;switch(i.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:if(i.frag){var u=this._levels[i.frag.level];u?(u.fragmentError++,u.fragmentError>this.hls.config.fragLoadingMaxRetry&&(a=i.frag.level)):a=i.frag.level}break;case s.ErrorDetails.LEVEL_LOAD_ERROR:case s.ErrorDetails.LEVEL_LOAD_TIMEOUT:r&&(r.deliveryDirectives&&(l=!1),a=r.level),o=!0;break;case s.ErrorDetails.REMUX_ALLOC_ERROR:a=i.level,o=!0}void 0!==a&&this.recoverLevel(i,a,o,l)}}},m.recoverLevel=function(t,e,i,r){var n=t.details,s=this._levels[e];if(s.loadError++,i){if(!this.retryLoadingOrFail(t))return void(this.currentLevelIndex=-1);t.levelRetry=!0}if(r){var a=s.url.length;if(a>1&&s.loadError<a)t.levelRetry=!0,this.redundantFailover(e);else if(-1===this.manualLevelIndex){var o=0===e?this._levels.length-1:e-1;this.currentLevelIndex!==o&&0===this._levels[o].loadError&&(this.warn(n+": switch to "+o),t.levelRetry=!0,this.hls.nextAutoLevel=o)}}},m.redundantFailover=function(t){var e=this._levels[t],i=e.url.length;if(i>1){var r=(e.urlId+1)%i;this.warn("Switching to redundant URL-id "+r),this._levels.forEach((function(t){t.urlId=r})),this.level=t}},m.onFragLoaded=function(t,e){var i=e.frag;if(void 0!==i&&i.type===c.PlaylistLevelType.MAIN){var r=this._levels[i.level];void 0!==r&&(r.fragmentError=0,r.loadError=0)}},m.onLevelLoaded=function(t,e){var i,r,n=e.level,s=e.details,a=this._levels[n];if(!a)return this.warn("Invalid level index "+n),void(null!==(r=e.deliveryDirectives)&&void 0!==r&&r.skip&&(s.deltaUpdateFailed=!0));n===this.currentLevelIndex?(0===a.fragmentError&&(a.loadError=0,this.retryCount=0),this.playlistLoaded(n,e,a.details)):null!==(i=e.deliveryDirectives)&&void 0!==i&&i.skip&&(s.deltaUpdateFailed=!0)},m.onAudioTrackSwitched=function(t,e){var i=this.hls.levels[this.currentLevelIndex];if(i&&i.audioGroupIds){for(var r=-1,n=this.hls.audioTracks[e.id].groupId,s=0;s<i.audioGroupIds.length;s++)if(i.audioGroupIds[s]===n){r=s;break}r!==i.urlId&&(i.urlId=r,this.startLoad())}},m.loadPlaylist=function(t){var e=this.currentLevelIndex,i=this._levels[e];if(this.canLoad&&i&&i.url.length>0){var r=i.urlId,s=i.url[r];if(t)try{s=t.addDirectives(s)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: "+t)}this.log("Attempt loading level index "+e+(t?" at sn "+t.msn+" part "+t.part:"")+" with URL-id "+r+" "+s),this.clearTimer(),this.hls.trigger(n.Events.LEVEL_LOADING,{url:s,level:e,id:r,deliveryDirectives:t||null})}},m.removeLevel=function(t,e){var i=function(t,i){return i!==e},r=this._levels.filter((function(r,n){return n!==t||r.url.length>1&&void 0!==e&&(r.url=r.url.filter(i),r.audioGroupIds&&(r.audioGroupIds=r.audioGroupIds.filter(i)),r.textGroupIds&&(r.textGroupIds=r.textGroupIds.filter(i)),r.urlId=0,!0)})).map((function(t,e){var i=t.details;return null!=i&&i.fragments&&i.fragments.forEach((function(t){t.level=e})),t}));this._levels=r,this.hls.trigger(n.Events.LEVELS_UPDATED,{levels:r})},p=l,(g=[{key:"levels",get:function(){return 0===this._levels.length?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(t){var e,i=this._levels;if(0!==i.length&&(this.currentLevelIndex!==t||null===(e=i[t])||void 0===e||!e.details)){if(t<0||t>=i.length){var r=t<0;if(this.hls.trigger(n.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.LEVEL_SWITCH_ERROR,level:t,fatal:r,reason:"invalid level idx"}),r)return;t=Math.min(t,i.length-1)}this.clearTimer();var a=this.currentLevelIndex,o=i[a],l=i[t];this.log("switching to level "+t+" from "+a),this.currentLevelIndex=t;var c=u({},l,{level:t,maxBitrate:l.maxBitrate,uri:l.uri,urlId:l.urlId});delete c._urlId,this.hls.trigger(n.Events.LEVEL_SWITCHING,c);var h=l.details;if(!h||h.live){var d=this.switchParams(l.uri,null==o?void 0:o.details);this.loadPlaylist(d)}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(t){this.manualLevelIndex=t,void 0===this._startLevel&&(this._startLevel=t),-1!==t&&(this.level=t)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(t){this._firstLevel=t}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var t=this.hls.config.startLevel;return void 0!==t?t:this._firstLevel}return this._startLevel},set:function(t){this._startLevel=t}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(t){this.level=t,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=t)}}])&&h(p.prototype,g),v&&h(p,v),l}(l.default)},"./src/controller/level-helper.ts":
/*!****************************************!*\
!*** ./src/controller/level-helper.ts ***!
\****************************************/
/*! exports provided: addGroupId, assignTrackIdsByGroup, updatePTS, updateFragPTSDTS, mergeDetails, mapPartIntersection, mapFragmentIntersection, adjustSliding, addSliding, computeReloadInterval, getFragmentWithSN, getPartWith */function(t,e,i){"use strict";i.r(e),i.d(e,"addGroupId",(function(){return s})),i.d(e,"assignTrackIdsByGroup",(function(){return a})),i.d(e,"updatePTS",(function(){return o})),i.d(e,"updateFragPTSDTS",(function(){return c})),i.d(e,"mergeDetails",(function(){return u})),i.d(e,"mapPartIntersection",(function(){return h})),i.d(e,"mapFragmentIntersection",(function(){return d})),i.d(e,"adjustSliding",(function(){return f})),i.d(e,"addSliding",(function(){return p})),i.d(e,"computeReloadInterval",(function(){return g})),i.d(e,"getFragmentWithSN",(function(){return v})),i.d(e,"getPartWith",(function(){return m}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ../utils/logger */"./src/utils/logger.ts");function s(t,e,i){switch(e){case"audio":t.audioGroupIds||(t.audioGroupIds=[]),t.audioGroupIds.push(i);break;case"text":t.textGroupIds||(t.textGroupIds=[]),t.textGroupIds.push(i)}}function a(t){var e={};t.forEach((function(t){var i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++}))}function o(t,e,i){l(t[e],t[i])}function l(t,e){var i=e.startPTS;if(Object(r.isFiniteNumber)(i)){var n,s=0;e.sn>t.sn?(s=i-t.start,n=t):(s=t.start-i,n=e),n.duration!==s&&(n.duration=s)}else e.sn>t.sn?t.cc===e.cc&&t.minEndPTS?e.start=t.start+(t.minEndPTS-t.start):e.start=t.start+t.duration:e.start=Math.max(t.start-e.duration,0)}function c(t,e,i,s,a,o){s-i<=0&&(n.logger.warn("Fragment should have a positive duration",e),s=i+e.duration,o=a+e.duration);var c=i,u=s,h=e.startPTS,d=e.endPTS;if(Object(r.isFiniteNumber)(h)){var f=Math.abs(h-i);Object(r.isFiniteNumber)(e.deltaPTS)?e.deltaPTS=Math.max(f,e.deltaPTS):e.deltaPTS=f,c=Math.max(i,h),i=Math.min(i,h),a=Math.min(a,e.startDTS),u=Math.min(s,d),s=Math.max(s,d),o=Math.max(o,e.endDTS)}e.duration=s-i;var p=i-e.start;e.appendedPTS=s,e.start=e.startPTS=i,e.maxStartPTS=c,e.startDTS=a,e.endPTS=s,e.minEndPTS=u,e.endDTS=o;var g,v=e.sn;if(!t||v<t.startSN||v>t.endSN)return 0;var m=v-t.startSN,y=t.fragments;for(y[m]=e,g=m;g>0;g--)l(y[g],y[g-1]);for(g=m;g<y.length-1;g++)l(y[g],y[g+1]);return t.fragmentHint&&l(y[y.length-1],t.fragmentHint),t.PTSKnown=t.alignedSliding=!0,p}function u(t,e){for(var i=null,s=t.fragments,a=s.length-1;a>=0;a--){var o=s[a].initSegment;if(o){i=o;break}}t.fragmentHint&&delete t.fragmentHint.endPTS;var l,u=0;if(d(t,e,(function(t,n){t.relurl&&(u=t.cc-n.cc),Object(r.isFiniteNumber)(t.startPTS)&&Object(r.isFiniteNumber)(t.endPTS)&&(n.start=n.startPTS=t.startPTS,n.startDTS=t.startDTS,n.appendedPTS=t.appendedPTS,n.maxStartPTS=t.maxStartPTS,n.endPTS=t.endPTS,n.endDTS=t.endDTS,n.minEndPTS=t.minEndPTS,n.duration=t.endPTS-t.startPTS,n.duration&&(l=n),e.PTSKnown=e.alignedSliding=!0),n.elementaryStreams=t.elementaryStreams,n.loader=t.loader,n.stats=t.stats,n.urlId=t.urlId,t.initSegment&&(n.initSegment=t.initSegment,i=t.initSegment)})),i&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach((function(t){var e;t.initSegment&&t.initSegment.relurl!==(null===(e=i)||void 0===e?void 0:e.relurl)||(t.initSegment=i)})),e.skippedSegments&&(e.deltaUpdateFailed=e.fragments.some((function(t){return!t})),e.deltaUpdateFailed)){n.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var p=e.skippedSegments;p--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}var g=e.fragments;if(u){n.logger.warn("discontinuity sliding from playlist, take drift into account");for(var v=0;v<g.length;v++)g[v].cc+=u}e.skippedSegments&&(e.startCC=e.fragments[0].cc),h(t.partList,e.partList,(function(t,e){e.elementaryStreams=t.elementaryStreams,e.stats=t.stats})),l?c(e,l,l.startPTS,l.endPTS,l.startDTS,l.endDTS):f(t,e),g.length&&(e.totalduration=e.edge-g[0].start),e.driftStartTime=t.driftStartTime,e.driftStart=t.driftStart;var m=e.advancedDateTime;if(e.advanced&&m){var y=e.edge;e.driftStart||(e.driftStartTime=m,e.driftStart=y),e.driftEndTime=m,e.driftEnd=y}else e.driftEndTime=t.driftEndTime,e.driftEnd=t.driftEnd,e.advancedDateTime=t.advancedDateTime}function h(t,e,i){if(t&&e)for(var r=0,n=0,s=t.length;n<=s;n++){var a=t[n],o=e[n+r];a&&o&&a.index===o.index&&a.fragment.sn===o.fragment.sn?i(a,o):r--}}function d(t,e,i){for(var r=e.skippedSegments,n=Math.max(t.startSN,e.startSN)-e.startSN,s=(t.fragmentHint?1:0)+(r?e.endSN:Math.min(t.endSN,e.endSN))-e.startSN,a=e.startSN-t.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,c=n;c<=s;c++){var u=l[a+c],h=o[c];r&&!h&&c<r&&(h=e.fragments[c]=u),u&&h&&i(u,h)}}function f(t,e){var i=e.startSN+e.skippedSegments-t.startSN,r=t.fragments;i<0||i>=r.length||p(e,r[i].start)}function p(t,e){if(e){for(var i=t.fragments,r=t.skippedSegments;r<i.length;r++)i[r].start+=e;t.fragmentHint&&(t.fragmentHint.start+=e)}}function g(t,e){var i,r=1e3*t.levelTargetDuration,n=r/2,s=t.age,a=s>0&&s<3*r,o=e.loading.end-e.loading.start,l=t.availabilityDelay;if(!1===t.updated)if(a){var c=333*t.misses;i=Math.max(Math.min(n,2*o),c),t.availabilityDelay=(t.availabilityDelay||0)+i}else i=n;else a?(l=Math.min(l||r/2,s),t.availabilityDelay=l,i=l+r-s):i=r-o;return Math.round(i)}function v(t,e,i){if(!t||!t.details)return null;var r=t.details,n=r.fragments[e-r.startSN];return n||((n=r.fragmentHint)&&n.sn===e?n:e<r.startSN&&i&&i.sn===e?i:null)}function m(t,e,i){if(!t||!t.details)return null;var r=t.details.partList;if(r)for(var n=r.length;n--;){var s=r[n];if(s.index===i&&s.fragment.sn===e)return s}return null}},"./src/controller/stream-controller.ts":
/*!*********************************************!*\
!*** ./src/controller/stream-controller.ts ***!
\*********************************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return y}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ./base-stream-controller */"./src/controller/base-stream-controller.ts"),s=i(/*! ../is-supported */"./src/is-supported.ts"),a=i(/*! ../events */"./src/events.ts"),o=i(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),l=i(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),c=i(/*! ../types/loader */"./src/types/loader.ts"),u=i(/*! ../loader/fragment */"./src/loader/fragment.ts"),h=i(/*! ../demux/transmuxer-interface */"./src/demux/transmuxer-interface.ts"),d=i(/*! ../types/transmuxer */"./src/types/transmuxer.ts"),f=i(/*! ./gap-controller */"./src/controller/gap-controller.ts"),p=i(/*! ../errors */"./src/errors.ts"),g=i(/*! ../utils/logger */"./src/utils/logger.ts");function v(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function m(t,e){return(m=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var y=function(t){var e,i;function y(e,i){var r;return(r=t.call(this,e,i,"[stream-controller]")||this).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}i=t,(e=y).prototype=Object.create(i.prototype),e.prototype.constructor=e,m(e,i);var b,E,S,C=y.prototype;return C._registerListeners=function(){var t=this.hls;t.on(a.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(a.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(a.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(a.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(a.Events.LEVEL_LOADING,this.onLevelLoading,this),t.on(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.on(a.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.on(a.Events.ERROR,this.onError,this),t.on(a.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(a.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(a.Events.BUFFER_CREATED,this.onBufferCreated,this),t.on(a.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(a.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(a.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C._unregisterListeners=function(){var t=this.hls;t.off(a.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(a.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(a.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(a.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.off(a.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.off(a.Events.ERROR,this.onError,this),t.off(a.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(a.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(a.Events.BUFFER_CREATED,this.onBufferCreated,this),t.off(a.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(a.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(a.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},C.startLoad=function(t){if(this.levels){var e=this.lastCurrentTime,i=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var r=i.startLevel;-1===r&&(i.config.testBandwidth?(r=0,this.bitrateTest=!0):r=i.nextAutoLevel),this.level=i.nextLoadLevel=r,this.loadedmetadata=!1}e>0&&-1===t&&(this.log("Override startPosition with lastCurrentTime @"+e.toFixed(3)),t=e),this.state=n.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}else this._forceStartLoad=!0,this.state=n.State.STOPPED},C.stopLoad=function(){this._forceStartLoad=!1,t.prototype.stopLoad.call(this)},C.doTick=function(){switch(this.state){case n.State.IDLE:this.doTickIdle();break;case n.State.WAITING_LEVEL:var t,e=this.levels,i=this.level,r=null==e||null===(t=e[i])||void 0===t?void 0:t.details;if(r&&(!r.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(r))break;this.state=n.State.IDLE;break}break;case n.State.FRAG_LOADING_WAITING_RETRY:var s,a=self.performance.now(),o=this.retryDate;(!o||a>=o||null!==(s=this.media)&&void 0!==s&&s.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=n.State.IDLE)}this.onTickEnd()},C.onTickEnd=function(){t.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},C.doTickIdle=function(){var t,e,i=this.hls,r=this.levelLastLoaded,s=this.levels,o=this.media,h=i.config,d=i.nextLoadLevel;if(null!==r&&(o||!this.startFragRequested&&h.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&s&&s[d]){var f=s[d];this.level=i.nextLoadLevel=d;var p=f.details;if(!p||this.state===n.State.WAITING_LEVEL||p.live&&this.levelLastLoaded!==d)this.state=n.State.WAITING_LEVEL;else{var g=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:o,c.PlaylistLevelType.MAIN);if(null!==g&&!(g.len>=this.getMaxBufferLength(f.maxBitrate))){if(this._streamEnded(g,p)){var v={};return this.altAudio&&(v.type="video"),this.hls.trigger(a.Events.BUFFER_EOS,v),void(this.state=n.State.ENDED)}var m=g.end,y=this.getNextFragment(m,p);if(this.couldBacktrack&&!this.fragPrevious&&y&&"initSegment"!==y.sn){var b=y.sn-p.startSN;b>1&&(y=p.fragments[b-1],this.fragmentTracker.removeFragment(y))}if(y&&this.fragmentTracker.getState(y)===l.FragmentState.OK&&this.nextLoadPosition>m){var E=this.audioOnly&&!this.altAudio?u.ElementaryStreamTypes.AUDIO:u.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(o,E,c.PlaylistLevelType.MAIN),y=this.getNextFragment(this.nextLoadPosition,p)}y&&(!y.initSegment||y.initSegment.data||this.bitrateTest||(y=y.initSegment),"identity"!==(null===(t=y.decryptdata)||void 0===t?void 0:t.keyFormat)||null!==(e=y.decryptdata)&&void 0!==e&&e.key?this.loadFragment(y,p,m):this.loadKey(y,p))}}}},C.loadFragment=function(e,i,r){var n,s=this.fragmentTracker.getState(e);if(this.fragCurrent=e,s===l.FragmentState.BACKTRACKED){var a=this.fragmentTracker.getBacktrackData(e);if(a)return this._handleFragmentLoadProgress(a),void this._handleFragmentLoadComplete(a);s=l.FragmentState.NOT_LOADED}s===l.FragmentState.NOT_LOADED||s===l.FragmentState.PARTIAL?"initSegment"===e.sn?this._loadInitSegment(e):this.bitrateTest?(e.bitrateTest=!0,this.log("Fragment "+e.sn+" of level "+e.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(e)):(this.startFragRequested=!0,t.prototype.loadFragment.call(this,e,i,r)):s===l.FragmentState.APPENDING?this.reduceMaxBufferLength(e.duration)&&this.fragmentTracker.removeFragment(e):0===(null===(n=this.media)||void 0===n?void 0:n.buffered.length)&&this.fragmentTracker.removeAllFragments()},C.getAppendedFrag=function(t){var e=this.fragmentTracker.getAppendedFrag(t,c.PlaylistLevelType.MAIN);return e&&"fragment"in e?e.fragment:e},C.getBufferedFrag=function(t){return this.fragmentTracker.getBufferedFrag(t,c.PlaylistLevelType.MAIN)},C.followingBufferedFrag=function(t){return t?this.getBufferedFrag(t.end+.5):null},C.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},C.nextLevelSwitch=function(){var t=this.levels,e=this.media;if(null!=e&&e.readyState){var i,r=this.getAppendedFrag(e.currentTime);if(r&&r.start>1&&this.flushMainBuffer(0,r.start-1),!e.paused&&t){var n=t[this.hls.nextLoadLevel],s=this.fragLastKbps;i=s&&this.fragCurrent?this.fragCurrent.duration*n.maxBitrate/(1e3*s)+1:0}else i=0;var a=this.getBufferedFrag(e.currentTime+i);if(a){var o=this.followingBufferedFrag(a);if(o){this.abortCurrentFrag();var l=o.maxStartPTS?o.maxStartPTS:o.start,c=o.duration,u=Math.max(a.end,l+Math.min(Math.max(c-this.config.maxFragLookUpTolerance,.5*c),.75*c));this.flushMainBuffer(u,Number.POSITIVE_INFINITY)}}}},C.abortCurrentFrag=function(){var t=this.fragCurrent;this.fragCurrent=null,null!=t&&t.loader&&t.loader.abort(),this.state===n.State.KEY_LOADING&&(this.state=n.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},C.flushMainBuffer=function(e,i){t.prototype.flushMainBuffer.call(this,e,i,this.altAudio?"video":null)},C.onMediaAttached=function(e,i){t.prototype.onMediaAttached.call(this,e,i);var r=i.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),r.addEventListener("playing",this.onvplaying),r.addEventListener("seeked",this.onvseeked),this.gapController=new f.default(this.config,r,this.fragmentTracker,this.hls)},C.onMediaDetaching=function(){var e=this.media;e&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),t.prototype.onMediaDetaching.call(this)},C.onMediaPlaying=function(){this.tick()},C.onMediaSeeked=function(){var t=this.media,e=t?t.currentTime:null;Object(r.isFiniteNumber)(e)&&this.log("Media seeked to "+e.toFixed(3)),this.tick()},C.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(a.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},C.onManifestParsed=function(t,e){var i,r=!1,n=!1;e.levels.forEach((function(t){(i=t.audioCodec)&&(-1!==i.indexOf("mp4a.40.2")&&(r=!0),-1!==i.indexOf("mp4a.40.5")&&(n=!0))})),this.audioCodecSwitch=r&&n&&!Object(s.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=e.levels,this.startFragRequested=!1},C.onLevelLoading=function(t,e){var i=this.levels;if(i&&this.state===n.State.IDLE){var r=i[e.level];(!r.details||r.details.live&&this.levelLastLoaded!==e.level||this.waitForCdnTuneIn(r.details))&&(this.state=n.State.WAITING_LEVEL)}},C.onLevelLoaded=function(t,e){var i,r=this.levels,s=e.level,o=e.details,l=o.totalduration;if(r){this.log("Level "+s+" loaded ["+o.startSN+","+o.endSN+"], cc ["+o.startCC+", "+o.endCC+"] duration:"+l);var c=this.fragCurrent;!c||this.state!==n.State.FRAG_LOADING&&this.state!==n.State.FRAG_LOADING_WAITING_RETRY||c.level!==e.level&&c.loader&&(this.state=n.State.IDLE,c.loader.abort());var u=r[s],h=0;if(o.live||null!==(i=u.details)&&void 0!==i&&i.live){if(o.fragments[0]||(o.deltaUpdateFailed=!0),o.deltaUpdateFailed)return;h=this.alignPlaylists(o,u.details)}if(u.details=o,this.levelLastLoaded=s,this.hls.trigger(a.Events.LEVEL_UPDATED,{details:o,level:s}),this.state===n.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=n.State.IDLE}this.startFragRequested?o.live&&this.synchronizeToLiveEdge(o):this.setStartPosition(o,h),this.tick()}else this.warn("Levels were reset while loading level "+s)},C._handleFragmentLoadProgress=function(t){var e,i=t.frag,r=t.part,n=t.payload,s=this.levels;if(s){var a=s[i.level],o=a.details;if(o){var l=a.videoCodec,u=o.PTSKnown||!o.live,f=null===(e=i.initSegment)||void 0===e?void 0:e.data,p=this._getAudioCodec(a),g=this.transmuxer=this.transmuxer||new h.default(this.hls,c.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),v=r?r.index:-1,m=-1!==v,y=new d.ChunkMetadata(i.level,i.sn,i.stats.chunkCount,n.byteLength,v,m),b=this.initPTS[i.cc];g.push(n,f,p,l,i,r,o.totalduration,u,y,b)}else this.warn("Dropping fragment "+i.sn+" of level "+i.level+" after level details were reset")}else this.warn("Levels were reset while fragment load was in progress. Fragment "+i.sn+" of level "+i.level+" will not be buffered")},C.onAudioTrackSwitching=function(t,e){var i=this.altAudio,r=!!e.url,n=e.id;if(!r){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var s=this.fragCurrent;null!=s&&s.loader&&(this.log("Switching to main audio track, cancel main fragment load"),s.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var o=this.hls;i&&o.trigger(a.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),o.trigger(a.Events.AUDIO_TRACK_SWITCHED,{id:n})}},C.onAudioTrackSwitched=function(t,e){var i=e.id,r=!!this.hls.audioTracks[i].url;if(r){var n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=r,this.tick()},C.onBufferCreated=function(t,e){var i,r,n=e.tracks,s=!1;for(var a in n){var o=n[a];if("main"===o.id){if(r=a,i=o,"video"===a){var l=n[a];l&&(this.videoBuffer=l.buffer)}}else s=!0}s&&i?(this.log("Alternate track found, use "+r+".buffered to schedule main fragment loading"),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media},C.onFragBuffered=function(t,e){var i=e.frag,r=e.part;if(!i||i.type===c.PlaylistLevelType.MAIN){if(this.fragContextChanged(i))return this.warn("Fragment "+i.sn+(r?" p: "+r.index:"")+" of level "+i.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===n.State.PARSED&&(this.state=n.State.IDLE));var s=r?r.stats:i.stats;this.fragLastKbps=Math.round(8*s.total/(s.buffering.end-s.loading.first)),"initSegment"!==i.sn&&(this.fragPrevious=i),this.fragBufferedComplete(i,r)}},C.onError=function(t,e){switch(e.details){case p.ErrorDetails.FRAG_LOAD_ERROR:case p.ErrorDetails.FRAG_LOAD_TIMEOUT:case p.ErrorDetails.KEY_LOAD_ERROR:case p.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(c.PlaylistLevelType.MAIN,e);break;case p.ErrorDetails.LEVEL_LOAD_ERROR:case p.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==n.State.ERROR&&(e.fatal?(this.warn(""+e.details),this.state=n.State.ERROR):e.levelRetry||this.state!==n.State.WAITING_LEVEL||(this.state=n.State.IDLE));break;case p.ErrorDetails.BUFFER_FULL_ERROR:if("main"===e.parent&&(this.state===n.State.PARSING||this.state===n.State.PARSED)){var i=!0,r=this.getFwdBufferInfo(this.media,c.PlaylistLevelType.MAIN);r&&r.len>.5&&(i=!this.reduceMaxBufferLength(r.len)),i&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}}},C.checkBuffer=function(){var t=this.media,e=this.gapController;if(t&&e&&t.readyState){var i=o.BufferHelper.getBuffered(t);!this.loadedmetadata&&i.length?(this.loadedmetadata=!0,this.seekToStartPos()):e.poll(this.lastCurrentTime),this.lastCurrentTime=t.currentTime}},C.onFragLoadEmergencyAborted=function(){this.state=n.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},C.onBufferFlushed=function(t,e){var i=e.type;if(i!==u.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var r=(i===u.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(r,i,c.PlaylistLevelType.MAIN)}},C.onLevelsUpdated=function(t,e){this.levels=e.levels},C.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},C.seekToStartPos=function(){var t=this.media,e=t.currentTime,i=this.startPosition;if(i>=0&&e<i){if(t.seeking)return void g.logger.log("could not seek to "+i+", already seeking at "+e);var r=o.BufferHelper.getBuffered(t),n=(r.length?r.start(0):0)-i;n>0&&(n<this.config.maxBufferHole||n<this.config.maxFragLookUpTolerance)&&(g.logger.log("adjusting start position by "+n+" to match buffer start"),i+=n,this.startPosition=i),this.log("seek to target start position "+i+" from current time "+e),t.currentTime=i}},C._getAudioCodec=function(t){var e=this.config.defaultAudioCodec||t.audioCodec;return this.audioCodecSwap&&e&&(this.log("Swapping audio codec"),e=-1!==e.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),e},C._loadBitrateTestFrag=function(t){var e=this;this._doFragLoad(t).then((function(i){var r=e.hls;if(i&&!r.nextLoadLevel&&!e.fragContextChanged(t)){e.fragLoadError=0,e.state=n.State.IDLE,e.startFragRequested=!1,e.bitrateTest=!1;var s=t.stats;s.parsing.start=s.parsing.end=s.buffering.start=s.buffering.end=self.performance.now(),r.trigger(a.Events.FRAG_LOADED,i)}}))},C._handleTransmuxComplete=function(t){var e,i="main",s=this.hls,o=t.remuxResult,l=t.chunkMeta,c=this.getCurrentContext(l);if(!c)return this.warn("The loading context changed while buffering fragment "+l.sn+" of level "+l.level+". This chunk will not be buffered."),void this.resetLiveStartWhenNotLoaded(l.level);var h=c.frag,d=c.part,f=c.level,p=o.video,g=o.text,v=o.id3,m=o.initSegment,y=this.altAudio?void 0:o.audio;if(!this.fragContextChanged(h)){if(this.state=n.State.PARSING,m){m.tracks&&(this._bufferInitSegment(f,m.tracks,h,l),s.trigger(a.Events.FRAG_PARSING_INIT_SEGMENT,{frag:h,id:i,tracks:m.tracks}));var b=m.initPTS,E=m.timescale;Object(r.isFiniteNumber)(b)&&(this.initPTS[h.cc]=b,s.trigger(a.Events.INIT_PTS_FOUND,{frag:h,id:i,initPTS:b,timescale:E}))}if(p&&!1!==o.independent){if(f.details){var S=p.startPTS,C=p.endPTS,k=p.startDTS,w=p.endDTS;if(d)d.elementaryStreams[p.type]={startPTS:S,endPTS:C,startDTS:k,endDTS:w};else if(p.firstKeyFrame&&p.independent&&(this.couldBacktrack=!0),p.dropped&&p.independent){if(this.getLoadPosition()+this.config.maxBufferHole<S)return void this.backtrack(h);h.setElementaryStreamInfo(p.type,h.start,C,h.start,w,!0)}h.setElementaryStreamInfo(p.type,S,C,k,w),this.bufferFragmentData(p,h,d,l)}}else if(!1===o.independent)return void this.backtrack(h);if(y){var x=y.startPTS,T=y.endPTS,O=y.startDTS,A=y.endDTS;d&&(d.elementaryStreams[u.ElementaryStreamTypes.AUDIO]={startPTS:x,endPTS:T,startDTS:O,endDTS:A}),h.setElementaryStreamInfo(u.ElementaryStreamTypes.AUDIO,x,T,O,A),this.bufferFragmentData(y,h,d,l)}if(null!=v&&null!==(e=v.samples)&&void 0!==e&&e.length){var L={frag:h,id:i,samples:v.samples};s.trigger(a.Events.FRAG_PARSING_METADATA,L)}if(g){var R={frag:h,id:i,samples:g.samples};s.trigger(a.Events.FRAG_PARSING_USERDATA,R)}}},C._bufferInitSegment=function(t,e,i,r){var s=this;if(this.state===n.State.PARSING){this.audioOnly=!!e.audio&&!e.video,this.altAudio&&!this.audioOnly&&delete e.audio;var o=e.audio,l=e.video,c=e.audiovideo;if(o){var u=t.audioCodec,h=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(u&&(u=-1!==u.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),1!==o.metadata.channelCount&&-1===h.indexOf("firefox")&&(u="mp4a.40.5")),-1!==h.indexOf("android")&&"audio/mpeg"!==o.container&&(u="mp4a.40.2",this.log("Android: force audio codec to "+u)),t.audioCodec&&t.audioCodec!==u&&this.log('Swapping manifest audio codec "'+t.audioCodec+'" for "'+u+'"'),o.levelCodec=u,o.id="main",this.log("Init audio buffer, container:"+o.container+", codecs[selected/level/parsed]=["+(u||"")+"/"+(t.audioCodec||"")+"/"+o.codec+"]")}l&&(l.levelCodec=t.videoCodec,l.id="main",this.log("Init video buffer, container:"+l.container+", codecs[level/parsed]=["+(t.videoCodec||"")+"/"+l.codec+"]")),c&&this.log("Init audiovideo buffer, container:"+c.container+", codecs[level/parsed]=["+(t.attrs.CODECS||"")+"/"+c.codec+"]"),this.hls.trigger(a.Events.BUFFER_CODECS,e),Object.keys(e).forEach((function(t){var n=e[t].initSegment;null!=n&&n.byteLength&&s.hls.trigger(a.Events.BUFFER_APPENDING,{type:t,data:n,frag:i,part:null,chunkMeta:r,parent:i.type})})),this.tick()}},C.backtrack=function(t){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(t);var e=this.fragmentTracker.backtrack(t);this.fragPrevious=null,this.nextLoadPosition=t.start,e?this.resetFragmentLoading(t):this.state=n.State.BACKTRACKING},C.checkFragmentChanged=function(){var t=this.media,e=null;if(t&&t.readyState>1&&!1===t.seeking){var i=t.currentTime;if(o.BufferHelper.isBuffered(t,i)?e=this.getAppendedFrag(i):o.BufferHelper.isBuffered(t,i+.1)&&(e=this.getAppendedFrag(i+.1)),e){var r=this.fragPlaying,n=e.level;r&&e.sn===r.sn&&r.level===n&&e.urlId===r.urlId||(this.hls.trigger(a.Events.FRAG_CHANGED,{frag:e}),r&&r.level===n||this.hls.trigger(a.Events.LEVEL_SWITCHED,{level:n}),this.fragPlaying=e)}}},b=y,(E=[{key:"nextLevel",get:function(){var t=this.nextBufferedFrag;return t?t.level:-1}},{key:"currentLevel",get:function(){var t=this.media;if(t){var e=this.getAppendedFrag(t.currentTime);if(e)return e.level}return-1}},{key:"nextBufferedFrag",get:function(){var t=this.media;if(t){var e=this.getAppendedFrag(t.currentTime);return this.followingBufferedFrag(e)}return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}])&&v(b.prototype,E),S&&v(b,S),y}(n.default)},"./src/controller/subtitle-stream-controller.ts":
/*!******************************************************!*\
!*** ./src/controller/subtitle-stream-controller.ts ***!
\******************************************************/
/*! exports provided: SubtitleStreamController */function(t,e,i){"use strict";i.r(e),i.d(e,"SubtitleStreamController",(function(){return g}));var r=i(/*! ../events */"./src/events.ts"),n=i(/*! ../utils/logger */"./src/utils/logger.ts"),s=i(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),a=i(/*! ./fragment-finders */"./src/controller/fragment-finders.ts"),o=i(/*! ../utils/discontinuities */"./src/utils/discontinuities.ts"),l=i(/*! ./level-helper */"./src/controller/level-helper.ts"),c=i(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),u=i(/*! ./base-stream-controller */"./src/controller/base-stream-controller.ts"),h=i(/*! ../types/loader */"./src/types/loader.ts"),d=i(/*! ../types/level */"./src/types/level.ts");function f(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function p(t,e){return(p=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var g=function(t){var e,i;function g(e,i){var r;return(r=t.call(this,e,i,"[subtitle-stream-controller]")||this).levels=[],r.currentTrackId=-1,r.tracksBuffered=[],r.mainDetails=null,r._registerListeners(),r}i=t,(e=g).prototype=Object.create(i.prototype),e.prototype.constructor=e,p(e,i);var v,m,y,b=g.prototype;return b.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},b._registerListeners=function(){var t=this.hls;t.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(r.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.on(r.Events.ERROR,this.onError,this),t.on(r.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(r.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(r.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(r.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.on(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},b._unregisterListeners=function(){var t=this.hls;t.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(r.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.off(r.Events.ERROR,this.onError,this),t.off(r.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(r.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(r.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(r.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.off(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},b.startLoad=function(){this.stopLoad(),this.state=u.State.IDLE,this.setInterval(500),this.tick()},b.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},b.onLevelLoaded=function(t,e){this.mainDetails=e.details},b.onSubtitleFragProcessed=function(t,e){var i=e.frag,r=e.success;if(this.fragPrevious=i,this.state=u.State.IDLE,r){var n=this.tracksBuffered[this.currentTrackId];if(n){for(var s,a=i.start,o=0;o<n.length;o++)if(a>=n[o].start&&a<=n[o].end){s=n[o];break}var l=i.start+i.duration;s?s.end=l:(s={start:a,end:l},n.push(s)),this.fragmentTracker.fragBuffered(i)}}},b.onBufferFlushing=function(t,e){var i=e.startOffset,r=e.endOffset;if(0===i&&r!==Number.POSITIVE_INFINITY){var n=this.currentTrackId,s=this.levels;if(!s.length||!s[n]||!s[n].details)return;var a=r-s[n].details.targetduration;if(a<=0)return;e.endOffsetSubtitles=Math.max(0,a),this.tracksBuffered.forEach((function(t){for(var e=0;e<t.length;)if(t[e].end<=a)t.shift();else{if(!(t[e].start<a))break;t[e].start=a,e++}})),this.fragmentTracker.removeFragmentsInRange(i,a,h.PlaylistLevelType.SUBTITLE)}},b.onError=function(t,e){var i,r=e.frag;r&&r.type===h.PlaylistLevelType.SUBTITLE&&(null!==(i=this.fragCurrent)&&void 0!==i&&i.loader&&this.fragCurrent.loader.abort(),this.state=u.State.IDLE)},b.onSubtitleTracksUpdated=function(t,e){var i=this,r=e.subtitleTracks;this.tracksBuffered=[],this.levels=r.map((function(t){return new d.Level(t)})),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach((function(t){i.tracksBuffered[t.id]=[]})),this.mediaBuffer=null},b.onSubtitleTrackSwitch=function(t,e){if(this.currentTrackId=e.id,this.levels.length&&-1!==this.currentTrackId){var i=this.levels[this.currentTrackId];null!=i&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.setInterval(500)}else this.clearInterval()},b.onSubtitleTrackLoaded=function(t,e){var i,r=e.details,n=e.id,s=this.currentTrackId,c=this.levels;if(c.length){var h=c[s];if(!(n>=c.length||n!==s)&&h){if(this.mediaBuffer=this.mediaBufferTimeRanges,r.live||null!==(i=h.details)&&void 0!==i&&i.live){var d=this.mainDetails;if(r.deltaUpdateFailed||!d)return;var f=d.fragments[0];h.details?0===this.alignPlaylists(r,h.details)&&f&&Object(l.addSliding)(r,f.start):r.hasProgramDateTime&&d.hasProgramDateTime?Object(o.alignMediaPlaylistByPDT)(r,d):f&&Object(l.addSliding)(r,f.start)}h.details=r,this.levelLastLoaded=n,this.tick(),r.live&&!this.fragCurrent&&this.media&&this.state===u.State.IDLE&&(Object(a.findFragmentByPTS)(null,r.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),h.details=void 0))}}},b._handleFragmentLoadComplete=function(t){var e=t.frag,i=t.payload,n=e.decryptdata,s=this.hls;if(!this.fragContextChanged(e)&&i&&i.byteLength>0&&n&&n.key&&n.iv&&"AES-128"===n.method){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(i),n.key.buffer,n.iv.buffer).then((function(t){var i=performance.now();s.trigger(r.Events.FRAG_DECRYPTED,{frag:e,payload:t,stats:{tstart:a,tdecrypt:i}})}))}},b.doTick=function(){if(this.media){if(this.state===u.State.IDLE){var t,e=this.currentTrackId,i=this.levels;if(!i.length||!i[e]||!i[e].details)return;var o=i[e].details,l=o.targetduration,h=this.config,d=this.media,f=s.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,d.currentTime-l,h.maxBufferHole),p=f.end;if(f.len>this.getMaxBufferLength()+l)return;console.assert(o,"Subtitle track details are defined on idle subtitle stream controller tick");var g,v=o.fragments,m=v.length,y=o.edge,b=this.fragPrevious;if(p<y){var E=h.maxFragLookUpTolerance;b&&o.hasProgramDateTime&&(g=Object(a.findFragmentByPDT)(v,b.endProgramDateTime,E)),g||!(g=Object(a.findFragmentByPTS)(b,v,p,E))&&b&&b.start<v[0].start&&(g=v[0])}else g=v[m-1];null!==(t=g)&&void 0!==t&&t.encrypted?(n.logger.log("Loading key for "+g.sn),this.state=u.State.KEY_LOADING,this.hls.trigger(r.Events.KEY_LOADING,{frag:g})):g&&this.fragmentTracker.getState(g)===c.FragmentState.NOT_LOADED&&this.loadFragment(g,o,p)}}else this.state=u.State.IDLE},b.loadFragment=function(e,i,r){this.fragCurrent=e,t.prototype.loadFragment.call(this,e,i,r)},v=g,(m=[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}])&&f(v.prototype,m),y&&f(v,y),g}(u.default)},"./src/controller/subtitle-track-controller.ts":
/*!*****************************************************!*\
!*** ./src/controller/subtitle-track-controller.ts ***!
\*****************************************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e);var r=i(/*! ../events */"./src/events.ts"),n=i(/*! ../utils/texttrack-utils */"./src/utils/texttrack-utils.ts"),s=i(/*! ./base-playlist-controller */"./src/controller/base-playlist-controller.ts"),a=i(/*! ../types/loader */"./src/types/loader.ts");function o(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var c=function(t){var e,i;function s(e){var i;return(i=t.call(this,e,"[subtitle-track-controller]")||this).media=null,i.tracks=[],i.groupId=null,i.tracksInGroup=[],i.trackId=-1,i.selectDefaultTrack=!0,i.queuedDefaultTrack=-1,i.trackChangeListener=function(){return i.onTextTracksChanged()},i.asyncPollTrackChange=function(){return i.pollTrackChange(0)},i.useTextTrackPolling=!1,i.subtitlePollingInterval=-1,i.subtitleDisplay=!0,i.registerListeners(),i}i=t,(e=s).prototype=Object.create(i.prototype),e.prototype.constructor=e,l(e,i);var c,h,d,f=s.prototype;return f.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,t.prototype.destroy.call(this)},f.registerListeners=function(){var t=this.hls;t.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(r.Events.LEVEL_LOADING,this.onLevelLoading,this),t.on(r.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(r.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(r.Events.ERROR,this.onError,this)},f.unregisterListeners=function(){var t=this.hls;t.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(r.Events.LEVEL_LOADING,this.onLevelLoading,this),t.off(r.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(r.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(r.Events.ERROR,this.onError,this)},f.onMediaAttached=function(t,e){this.media=e.media,this.media&&(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))},f.pollTrackChange=function(t){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,t)},f.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),u(this.media.textTracks).forEach((function(t){Object(n.clearCurrentCues)(t)})),this.subtitleTrack=-1,this.media=null)},f.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},f.onManifestParsed=function(t,e){this.tracks=e.subtitleTracks},f.onSubtitleTrackLoaded=function(t,e){var i=e.id,r=e.details,n=this.trackId,s=this.tracksInGroup[n];if(s){var a=s.details;s.details=e.details,this.log("subtitle track "+i+" loaded ["+r.startSN+"-"+r.endSN+"]"),i===this.trackId&&(this.retryCount=0,this.playlistLoaded(i,e,a))}else this.warn("Invalid subtitle track id "+i)},f.onLevelLoading=function(t,e){this.switchLevel(e.level)},f.onLevelSwitching=function(t,e){this.switchLevel(e.level)},f.switchLevel=function(t){var e=this.hls.levels[t];if(null!=e&&e.textGroupIds){var i=e.textGroupIds[e.urlId];if(this.groupId!==i){var n=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,s=this.tracks.filter((function(t){return!i||t.groupId===i}));this.tracksInGroup=s;var a=this.findTrackId(null==n?void 0:n.name)||this.findTrackId();this.groupId=i;var o={subtitleTracks:s};this.log("Updating subtitle tracks, "+s.length+' track(s) found in "'+i+'" group-id'),this.hls.trigger(r.Events.SUBTITLE_TRACKS_UPDATED,o),-1!==a&&this.setSubtitleTrack(a,n)}}},f.findTrackId=function(t){for(var e=this.tracksInGroup,i=0;i<e.length;i++){var r=e[i];if((!this.selectDefaultTrack||r.default)&&(!t||t===r.name))return r.id}return-1},f.onError=function(e,i){t.prototype.onError.call(this,e,i),!i.fatal&&i.context&&i.context.type===a.PlaylistContextType.SUBTITLE_TRACK&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&this.retryLoadingOrFail(i)},f.loadPlaylist=function(t){var e=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(e)){var i=e.id,n=e.groupId,s=e.url;if(t)try{s=t.addDirectives(s)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: "+t)}this.log("Loading subtitle playlist for id "+i),this.hls.trigger(r.Events.SUBTITLE_TRACK_LOADING,{url:s,id:i,groupId:n,deliveryDirectives:t||null})}},f.toggleTrackModes=function(t){var e=this,i=this.media,r=this.subtitleDisplay,n=this.trackId;if(i){var s=u(i.textTracks),a=s.filter((function(t){return t.groupId===e.groupId}));if(-1===t)[].slice.call(s).forEach((function(t){t.mode="disabled"}));else{var o=a[n];o&&(o.mode="disabled")}var l=a[t];l&&(l.mode=r?"showing":"hidden")}},f.setSubtitleTrack=function(t,e){var i,n=this.tracksInGroup;if(this.media){if(this.trackId!==t&&this.toggleTrackModes(t),!(this.trackId===t&&(-1===t||null!==(i=n[t])&&void 0!==i&&i.details)||t<-1||t>=n.length)){this.clearTimer();var s=n[t];if(this.log("Switching to subtitle track "+t),this.trackId=t,s){var a=s.id,o=s.groupId,l=void 0===o?"":o,c=s.name,u=s.type,h=s.url;this.hls.trigger(r.Events.SUBTITLE_TRACK_SWITCH,{id:a,groupId:l,name:c,type:u,url:h});var d=this.switchParams(s.url,null==e?void 0:e.details);this.loadPlaylist(d)}else this.hls.trigger(r.Events.SUBTITLE_TRACK_SWITCH,{id:t})}}else this.queuedDefaultTrack=t},f.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),this.media&&this.hls.config.renderTextTracksNatively){for(var t=-1,e=u(this.media.textTracks),i=0;i<e.length;i++)if("hidden"===e[i].mode)t=i;else if("showing"===e[i].mode){t=i;break}this.subtitleTrack!==t&&(this.subtitleTrack=t)}},c=s,(h=[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1;var e=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(t,e)}}])&&o(c.prototype,h),d&&o(c,d),s}(s.default);function u(t){for(var e=[],i=0;i<t.length;i++){var r=t[i];"subtitles"===r.kind&&r.label&&e.push(t[i])}return e}e.default=c},"./src/controller/timeline-controller.ts":
/*!***********************************************!*\
!*** ./src/controller/timeline-controller.ts ***!
\***********************************************/
/*! exports provided: TimelineController */function(t,e,i){"use strict";i.r(e),i.d(e,"TimelineController",(function(){return d}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ../events */"./src/events.ts"),s=i(/*! ../utils/cea-608-parser */"./src/utils/cea-608-parser.ts"),a=i(/*! ../utils/output-filter */"./src/utils/output-filter.ts"),o=i(/*! ../utils/webvtt-parser */"./src/utils/webvtt-parser.ts"),l=i(/*! ../utils/texttrack-utils */"./src/utils/texttrack-utils.ts"),c=i(/*! ../utils/imsc1-ttml-parser */"./src/utils/imsc1-ttml-parser.ts"),u=i(/*! ../types/loader */"./src/types/loader.ts"),h=i(/*! ../utils/logger */"./src/utils/logger.ts"),d=function(){function t(t){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={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}},this.captionsProperties=void 0,this.hls=t,this.config=t.config,this.Cues=t.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 e=new a.default(this,"textTrack1"),i=new a.default(this,"textTrack2"),r=new a.default(this,"textTrack3"),o=new a.default(this,"textTrack4");this.cea608Parser1=new s.default(1,e,i),this.cea608Parser2=new s.default(3,r,o)}t.on(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(n.Events.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(n.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(n.Events.FRAG_LOADING,this.onFragLoading,this),t.on(n.Events.FRAG_LOADED,this.onFragLoaded,this),t.on(n.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on(n.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on(n.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(n.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var e=t.prototype;return e.destroy=function(){var t=this.hls;t.off(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(n.Events.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(n.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(n.Events.FRAG_LOADING,this.onFragLoading,this),t.off(n.Events.FRAG_LOADED,this.onFragLoaded,this),t.off(n.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.off(n.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),t.off(n.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(n.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.off(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},e.addCues=function(t,e,i,r,s){for(var a,o,l,c,u=!1,h=s.length;h--;){var d=s[h],f=(a=d[0],o=d[1],l=e,c=i,Math.min(o,c)-Math.max(a,l));if(f>=0&&(d[0]=Math.min(d[0],e),d[1]=Math.max(d[1],i),u=!0,f/(i-e)>.5))return}if(u||s.push([e,i]),this.config.renderTextTracksNatively){var p=this.captionsTracks[t];this.Cues.newCue(p,e,i,r)}else{var g=this.Cues.newCue(null,e,i,r);this.hls.trigger(n.Events.CUES_PARSED,{type:"captions",cues:g,track:t})}},e.onInitPtsFound=function(t,e){var i=this,r=e.frag,s=e.id,a=e.initPTS,o=e.timescale,l=this.unparsedVttFrags;"main"===s&&(this.initPTS[r.cc]=a,this.timescale[r.cc]=o),l.length&&(this.unparsedVttFrags=[],l.forEach((function(t){i.onFragLoaded(n.Events.FRAG_LOADED,t)})))},e.getExistingTrack=function(t){var e=this.media;if(e)for(var i=0;i<e.textTracks.length;i++){var r=e.textTracks[i];if(r[t])return r}return null},e.createCaptionsTrack=function(t){this.config.renderTextTracksNatively?this.createNativeTrack(t):this.createNonNativeTrack(t)},e.createNativeTrack=function(t){if(!this.captionsTracks[t]){var e=this.captionsProperties,i=this.captionsTracks,r=this.media,n=e[t],s=n.label,a=n.languageCode,o=this.getExistingTrack(t);if(o)i[t]=o,Object(l.clearCurrentCues)(i[t]),Object(l.sendAddTrackEvent)(i[t],r);else{var c=this.createTextTrack("captions",s,a);c&&(c[t]=!0,i[t]=c)}}},e.createNonNativeTrack=function(t){if(!this.nonNativeCaptionsTracks[t]){var e=this.captionsProperties[t];if(e){var i={_id:t,label:e.label,kind:"captions",default:!!e.media&&!!e.media.default,closedCaptions:e.media};this.nonNativeCaptionsTracks[t]=i,this.hls.trigger(n.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}}},e.createTextTrack=function(t,e,i){var r=this.media;if(r)return r.addTextTrack(t,e,i)},e.onMediaAttaching=function(t,e){this.media=e.media,this._cleanTracks()},e.onMediaDetaching=function(){var t=this.captionsTracks;Object.keys(t).forEach((function(e){Object(l.clearCurrentCues)(t[e]),delete t[e]})),this.nonNativeCaptionsTracks={}},e.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}},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())},e._cleanTracks=function(){var t=this.media;if(t){var e=t.textTracks;if(e)for(var i=0;i<e.length;i++)Object(l.clearCurrentCues)(e[i])}},e.onSubtitleTracksUpdated=function(t,e){var i=this;this.textTracks=[];var r=e.subtitleTracks||[],s=r.some((function(t){return t.textCodec===c.IMSC1_CODEC}));if(this.config.enableWebVTT||s&&this.config.enableIMSC1){var a=this.tracks&&r&&this.tracks.length===r.length;if(this.tracks=r||[],this.config.renderTextTracksNatively){var o=this.media?this.media.textTracks:[];this.tracks.forEach((function(t,e){var r;if(e<o.length){for(var n=null,s=0;s<o.length;s++)if(f(o[s],t)){n=o[s];break}n&&(r=n)}r?Object(l.clearCurrentCues)(r):(r=i.createTextTrack("subtitles",t.name,t.lang))&&(r.mode="disabled"),r&&(r.groupId=t.groupId,i.textTracks.push(r))}))}else if(!a&&this.tracks&&this.tracks.length){var u=this.tracks.map((function(t){return{label:t.name,kind:t.type.toLowerCase(),default:t.default,subtitleTrack:t}}));this.hls.trigger(n.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:u})}}},e.onManifestLoaded=function(t,e){var i=this;this.config.enableCEA708Captions&&e.captions&&e.captions.forEach((function(t){var e=/(?:CC|SERVICE)([1-4])/.exec(t.instreamId);if(e){var r="textTrack"+e[1],n=i.captionsProperties[r];n&&(n.label=t.name,t.lang&&(n.languageCode=t.lang),n.media=t)}}))},e.onFragLoading=function(t,e){var i=this.cea608Parser1,r=this.cea608Parser2,n=this.lastSn,s=this.lastPartIndex;if(this.enabled&&i&&r&&e.frag.type===u.PlaylistLevelType.MAIN){var a,o,l=e.frag.sn,c=null!=(a=null==e||null===(o=e.part)||void 0===o?void 0:o.index)?a:-1;l===n+1||l===n&&c===s+1||(i.reset(),r.reset()),this.lastSn=l,this.lastPartIndex=c}},e.onFragLoaded=function(t,e){var i=e.frag,s=e.payload,a=this.initPTS,o=this.unparsedVttFrags;if(i.type===u.PlaylistLevelType.SUBTITLE)if(s.byteLength){if(!Object(r.isFiniteNumber)(a[i.cc]))return o.push(e),void(a.length&&this.hls.trigger(n.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Missing initial subtitle PTS")}));var l=i.decryptdata;if(null==l||null==l.key||"AES-128"!==l.method){var h=this.tracks[i.level],d=this.vttCCs;d[i.cc]||(d[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),h&&h.textCodec===c.IMSC1_CODEC?this._parseIMSC1(i,s):this._parseVTTs(i,s,d)}}else this.hls.trigger(n.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})},e._parseIMSC1=function(t,e){var i=this,r=this.hls;Object(c.parseIMSC1)(e,this.initPTS[t.cc],this.timescale[t.cc],(function(e){i._appendCues(e,t.level),r.trigger(n.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})}),(function(e){h.logger.log("Failed to parse IMSC1: "+e),r.trigger(n.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:e})}))},e._parseVTTs=function(t,e,i){var r=this,s=this.hls;Object(o.parseWebVTT)(e,this.initPTS[t.cc],this.timescale[t.cc],i,t.cc,t.start,(function(e){r._appendCues(e,t.level),s.trigger(n.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})}),(function(i){r._fallbackToIMSC1(t,e),h.logger.log("Failed to parse VTT cue: "+i),s.trigger(n.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:i})}))},e._fallbackToIMSC1=function(t,e){var i=this,r=this.tracks[t.level];r.textCodec||Object(c.parseIMSC1)(e,this.initPTS[t.cc],this.timescale[t.cc],(function(){r.textCodec=c.IMSC1_CODEC,i._parseIMSC1(t,e)}),(function(){r.textCodec="wvtt"}))},e._appendCues=function(t,e){var i=this.hls;if(this.config.renderTextTracksNatively){var r=this.textTracks[e];if("disabled"===r.mode)return;t.forEach((function(t){return Object(l.addCueToTrack)(r,t)}))}else{var s=this.tracks[e].default?"default":"subtitles"+e;i.trigger(n.Events.CUES_PARSED,{type:"subtitles",cues:t,track:s})}},e.onFragDecrypted=function(t,e){var i=e.frag;if(i.type===u.PlaylistLevelType.SUBTITLE){if(!Object(r.isFiniteNumber)(this.initPTS[i.cc]))return void this.unparsedVttFrags.push(e);this.onFragLoaded(n.Events.FRAG_LOADED,e)}},e.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},e.onFragParsingUserdata=function(t,e){var i=this.cea608Parser1,r=this.cea608Parser2;if(this.enabled&&i&&r)for(var n=0;n<e.samples.length;n++){var s=e.samples[n].bytes;if(s){var a=this.extractCea608Data(s);i.addData(e.samples[n].pts,a[0]),r.addData(e.samples[n].pts,a[1])}}},e.onBufferFlushing=function(t,e){var i=e.startOffset,r=e.endOffset,n=e.endOffsetSubtitles,s=e.type,a=this.media;if(a&&!(a.currentTime<r)){if(!s||"video"===s){var o=this.captionsTracks;Object.keys(o).forEach((function(t){return Object(l.removeCuesInRange)(o[t],i,r)}))}if(this.config.renderTextTracksNatively&&0===i&&void 0!==n){var c=this.textTracks;Object.keys(c).forEach((function(t){return Object(l.removeCuesInRange)(c[t],i,n)}))}}},e.extractCea608Data=function(t){for(var e=31&t[0],i=2,r=[[],[]],n=0;n<e;n++){var s=t[i++],a=127&t[i++],o=127&t[i++],l=3&s;0===a&&0===o||0!=(4&s)&&(0!==l&&1!==l||(r[l].push(a),r[l].push(o)))}return r},t}();function f(t,e){return t&&t.label===e.name&&!(t.textTrack1||t.textTrack2)}},"./src/crypt/aes-crypto.ts":
/*!*********************************!*\
!*** ./src/crypt/aes-crypto.ts ***!
\*********************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return r}));var r=function(){function t(t,e){this.subtle=void 0,this.aesIV=void 0,this.subtle=t,this.aesIV=e}return t.prototype.decrypt=function(t,e){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,t)},t}()},"./src/crypt/aes-decryptor.ts":
/*!************************************!*\
!*** ./src/crypt/aes-decryptor.ts ***!
\************************************/
/*! exports provided: removePadding, default */function(t,e,i){"use strict";i.r(e),i.d(e,"removePadding",(function(){return n})),i.d(e,"default",(function(){return s}));var r=i(/*! ../utils/typed-array */"./src/utils/typed-array.ts");function n(t){var e=t.byteLength,i=e&&new DataView(t.buffer).getUint8(e-1);return i?Object(r.sliceUint8)(t,0,e-i):t}var s=function(){function t(){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 e=t.prototype;return e.uint8ArrayToUint32Array_=function(t){for(var e=new DataView(t),i=new Uint32Array(4),r=0;r<4;r++)i[r]=e.getUint32(4*r);return i},e.initTable=function(){var t=this.sBox,e=this.invSBox,i=this.subMix,r=i[0],n=i[1],s=i[2],a=i[3],o=this.invSubMix,l=o[0],c=o[1],u=o[2],h=o[3],d=new Uint32Array(256),f=0,p=0,g=0;for(g=0;g<256;g++)d[g]=g<128?g<<1:g<<1^283;for(g=0;g<256;g++){var v=p^p<<1^p<<2^p<<3^p<<4;v=v>>>8^255&v^99,t[f]=v,e[v]=f;var m=d[f],y=d[m],b=d[y],E=257*d[v]^16843008*v;r[f]=E<<24|E>>>8,n[f]=E<<16|E>>>16,s[f]=E<<8|E>>>24,a[f]=E,E=16843009*b^65537*y^257*m^16843008*f,l[v]=E<<24|E>>>8,c[v]=E<<16|E>>>16,u[v]=E<<8|E>>>24,h[v]=E,f?(f=m^d[d[d[b^m]]],p^=d[d[p]]):f=p=1}},e.expandKey=function(t){for(var e=this.uint8ArrayToUint32Array_(t),i=!0,r=0;r<e.length&&i;)i=e[r]===this.key[r],r++;if(!i){this.key=e;var n=this.keySize=e.length;if(4!==n&&6!==n&&8!==n)throw new Error("Invalid aes key size="+n);var s,a,o,l,c=this.ksRows=4*(n+6+1),u=this.keySchedule=new Uint32Array(c),h=this.invKeySchedule=new Uint32Array(c),d=this.sBox,f=this.rcon,p=this.invSubMix,g=p[0],v=p[1],m=p[2],y=p[3];for(s=0;s<c;s++)s<n?o=u[s]=e[s]:(l=o,s%n==0?(l=d[(l=l<<8|l>>>24)>>>24]<<24|d[l>>>16&255]<<16|d[l>>>8&255]<<8|d[255&l],l^=f[s/n|0]<<24):n>6&&s%n==4&&(l=d[l>>>24]<<24|d[l>>>16&255]<<16|d[l>>>8&255]<<8|d[255&l]),u[s]=o=(u[s-n]^l)>>>0);for(a=0;a<c;a++)s=c-a,l=3&a?u[s]:u[s-4],h[a]=a<4||s<=4?l:g[d[l>>>24]]^v[d[l>>>16&255]]^m[d[l>>>8&255]]^y[d[255&l]],h[a]=h[a]>>>0}},e.networkToHostOrderSwap=function(t){return t<<24|(65280&t)<<8|(16711680&t)>>8|t>>>24},e.decrypt=function(t,e,i){for(var r,n,s,a,o,l,c,u,h,d,f,p,g,v,m=this.keySize+6,y=this.invKeySchedule,b=this.invSBox,E=this.invSubMix,S=E[0],C=E[1],k=E[2],w=E[3],x=this.uint8ArrayToUint32Array_(i),T=x[0],O=x[1],A=x[2],L=x[3],R=new Int32Array(t),_=new Int32Array(R.length),D=this.networkToHostOrderSwap;e<R.length;){for(h=D(R[e]),d=D(R[e+1]),f=D(R[e+2]),p=D(R[e+3]),o=h^y[0],l=p^y[1],c=f^y[2],u=d^y[3],g=4,v=1;v<m;v++)r=S[o>>>24]^C[l>>16&255]^k[c>>8&255]^w[255&u]^y[g],n=S[l>>>24]^C[c>>16&255]^k[u>>8&255]^w[255&o]^y[g+1],s=S[c>>>24]^C[u>>16&255]^k[o>>8&255]^w[255&l]^y[g+2],a=S[u>>>24]^C[o>>16&255]^k[l>>8&255]^w[255&c]^y[g+3],o=r,l=n,c=s,u=a,g+=4;r=b[o>>>24]<<24^b[l>>16&255]<<16^b[c>>8&255]<<8^b[255&u]^y[g],n=b[l>>>24]<<24^b[c>>16&255]<<16^b[u>>8&255]<<8^b[255&o]^y[g+1],s=b[c>>>24]<<24^b[u>>16&255]<<16^b[o>>8&255]<<8^b[255&l]^y[g+2],a=b[u>>>24]<<24^b[o>>16&255]<<16^b[l>>8&255]<<8^b[255&c]^y[g+3],_[e]=D(r^T),_[e+1]=D(a^O),_[e+2]=D(s^A),_[e+3]=D(n^L),T=h,O=d,A=f,L=p,e+=4}return _.buffer},t}()},"./src/crypt/decrypter.ts":
/*!********************************!*\
!*** ./src/crypt/decrypter.ts ***!
\********************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return c}));var r=i(/*! ./aes-crypto */"./src/crypt/aes-crypto.ts"),n=i(/*! ./fast-aes-key */"./src/crypt/fast-aes-key.ts"),s=i(/*! ./aes-decryptor */"./src/crypt/aes-decryptor.ts"),a=i(/*! ../utils/logger */"./src/utils/logger.ts"),o=i(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),l=i(/*! ../utils/typed-array */"./src/utils/typed-array.ts"),c=function(){function t(t,e,i){var r=(void 0===i?{}:i).removePKCS7Padding,n=void 0===r||r;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=t,this.config=e,this.removePKCS7Padding=n,n)try{var s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch(t){}null===this.subtle&&(this.config.enableSoftwareAES=!0)}var e=t.prototype;return e.destroy=function(){this.observer=null},e.isSync=function(){return this.config.enableSoftwareAES},e.flush=function(){var t=this.currentResult;if(t){var e=new Uint8Array(t);return this.reset(),this.removePKCS7Padding?Object(s.removePadding)(e):e}this.reset()},e.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},e.decrypt=function(t,e,i,r){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(t),e,i);var n=this.flush();n&&r(n.buffer)}else this.webCryptoDecrypt(new Uint8Array(t),e,i).then(r)},e.softwareDecrypt=function(t,e,i){var r=this.currentIV,n=this.currentResult,a=this.remainderData;this.logOnce("JS AES decrypt"),a&&(t=Object(o.appendUint8Array)(a,t),this.remainderData=null);var c=this.getValidChunk(t);if(!c.length)return null;r&&(i=r);var u=this.softwareDecrypter;u||(u=this.softwareDecrypter=new s.default),u.expandKey(e);var h=n;return this.currentResult=u.decrypt(c.buffer,0,i),this.currentIV=Object(l.sliceUint8)(c,-16).buffer,h||null},e.webCryptoDecrypt=function(t,e,i){var s=this,a=this.subtle;return this.key===e&&this.fastAesKey||(this.key=e,this.fastAesKey=new n.default(a,e)),this.fastAesKey.expandKey().then((function(e){return a?new r.default(a,i).decrypt(t.buffer,e):Promise.reject(new Error("web crypto not initialized"))})).catch((function(r){return s.onWebCryptoError(r,t,e,i)}))},e.onWebCryptoError=function(t,e,i,r){return a.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",t),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(e,i,r)},e.getValidChunk=function(t){var e=t,i=t.length-t.length%16;return i!==t.length&&(e=Object(l.sliceUint8)(t,0,i),this.remainderData=Object(l.sliceUint8)(t,i)),e},e.logOnce=function(t){this.logEnabled&&(a.logger.log("[decrypter.ts]: "+t),this.logEnabled=!1)},t}()},"./src/crypt/fast-aes-key.ts":
/*!***********************************!*\
!*** ./src/crypt/fast-aes-key.ts ***!
\***********************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return r}));var r=function(){function t(t,e){this.subtle=void 0,this.key=void 0,this.subtle=t,this.key=e}return t.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},t}()},"./src/demux/aacdemuxer.ts":
/*!*********************************!*\
!*** ./src/demux/aacdemuxer.ts ***!
\*********************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e);var r=i(/*! ./base-audio-demuxer */"./src/demux/base-audio-demuxer.ts"),n=i(/*! ./adts */"./src/demux/adts.ts"),s=i(/*! ../utils/logger */"./src/utils/logger.ts"),a=i(/*! ../demux/id3 */"./src/demux/id3.ts");function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var l=function(t){var e,i;function r(e,i){var r;return(r=t.call(this)||this).observer=void 0,r.config=void 0,r.observer=e,r.config=i,r}i=t,(e=r).prototype=Object.create(i.prototype),e.prototype.constructor=e,o(e,i);var l=r.prototype;return l.resetInitSegment=function(e,i,r){t.prototype.resetInitSegment.call(this,e,i,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:e,duration:r,inputTimeScale:9e4,dropped:0}},r.probe=function(t){if(!t)return!1;for(var e=(a.getID3Data(t,0)||[]).length,i=t.length;e<i;e++)if(n.probe(t,e))return s.logger.log("ADTS sync word found !"),!0;return!1},l.canParse=function(t,e){return n.canParse(t,e)},l.appendFrame=function(t,e,i){n.initTrackConfig(t,this.observer,e,i,t.manifestCodec);var r=n.appendFrame(t,e,i,this.initPTS,this.frameIndex);if(r&&0===r.missing)return r},r}(r.default);l.minProbeByteLength=9,e.default=l},"./src/demux/adts.ts":
/*!***************************!*\
!*** ./src/demux/adts.ts ***!
\***************************/
/*! exports provided: getAudioConfig, isHeaderPattern, getHeaderLength, getFullFrameLength, canGetFrameLength, isHeader, canParse, probe, initTrackConfig, getFrameDuration, parseFrameHeader, appendFrame */function(t,e,i){"use strict";i.r(e),i.d(e,"getAudioConfig",(function(){return a})),i.d(e,"isHeaderPattern",(function(){return o})),i.d(e,"getHeaderLength",(function(){return l})),i.d(e,"getFullFrameLength",(function(){return c})),i.d(e,"canGetFrameLength",(function(){return u})),i.d(e,"isHeader",(function(){return h})),i.d(e,"canParse",(function(){return d})),i.d(e,"probe",(function(){return f})),i.d(e,"initTrackConfig",(function(){return p})),i.d(e,"getFrameDuration",(function(){return g})),i.d(e,"parseFrameHeader",(function(){return v})),i.d(e,"appendFrame",(function(){return m}));var r=i(/*! ../utils/logger */"./src/utils/logger.ts"),n=i(/*! ../errors */"./src/errors.ts"),s=i(/*! ../events */"./src/events.ts");function a(t,e,i,a){var o,l,c,u,h=navigator.userAgent.toLowerCase(),d=a,f=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];o=1+((192&e[i+2])>>>6);var p=(60&e[i+2])>>>2;if(!(p>f.length-1))return c=(1&e[i+2])<<2,c|=(192&e[i+3])>>>6,r.logger.log("manifest codec:"+a+", ADTS type:"+o+", samplingIndex:"+p),/firefox/i.test(h)?p>=6?(o=5,u=new Array(4),l=p-3):(o=2,u=new Array(2),l=p):-1!==h.indexOf("android")?(o=2,u=new Array(2),l=p):(o=5,u=new Array(4),a&&(-1!==a.indexOf("mp4a.40.29")||-1!==a.indexOf("mp4a.40.5"))||!a&&p>=6?l=p-3:((a&&-1!==a.indexOf("mp4a.40.2")&&(p>=6&&1===c||/vivaldi/i.test(h))||!a&&1===c)&&(o=2,u=new Array(2)),l=p)),u[0]=o<<3,u[0]|=(14&p)>>1,u[1]|=(1&p)<<7,u[1]|=c<<3,5===o&&(u[1]|=(14&l)>>1,u[2]=(1&l)<<7,u[2]|=8,u[3]=0),{config:u,samplerate:f[p],channelCount:c,codec:"mp4a.40."+o,manifestCodec:d};t.trigger(s.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+p})}function o(t,e){return 255===t[e]&&240==(246&t[e+1])}function l(t,e){return 1&t[e+1]?7:9}function c(t,e){return(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5}function u(t,e){return e+5<t.length}function h(t,e){return e+1<t.length&&o(t,e)}function d(t,e){return u(t,e)&&o(t,e)&&c(t,e)<=t.length-e}function f(t,e){if(h(t,e)){var i=l(t,e);if(e+i>=t.length)return!1;var r=c(t,e);if(r<=i)return!1;var n=e+r;return n===t.length||h(t,n)}return!1}function p(t,e,i,n,s){if(!t.samplerate){var o=a(e,i,n,s);if(!o)return;t.config=o.config,t.samplerate=o.samplerate,t.channelCount=o.channelCount,t.codec=o.codec,t.manifestCodec=o.manifestCodec,r.logger.log("parsed codec:"+t.codec+", rate:"+o.samplerate+", channels:"+o.channelCount)}}function g(t){return 9216e4/t}function v(t,e,i,r,n){var s=l(t,e),a=c(t,e);if((a-=s)>0)return{headerLength:s,frameLength:a,stamp:i+r*n}}function m(t,e,i,r,n){var s=v(e,i,r,n,g(t.samplerate));if(s){var a,o=s.frameLength,l=s.headerLength,c=s.stamp,u=l+o,h=Math.max(0,i+u-e.length);h?(a=new Uint8Array(u-l)).set(e.subarray(i+l,e.length),0):a=e.subarray(i+l,i+u);var d={unit:a,pts:c};return h||t.samples.push(d),{sample:d,length:u,missing:h}}}},"./src/demux/base-audio-demuxer.ts":
/*!*****************************************!*\
!*** ./src/demux/base-audio-demuxer.ts ***!
\*****************************************/
/*! exports provided: initPTSFn, default */function(t,e,i){"use strict";i.r(e),i.d(e,"initPTSFn",(function(){return c}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ../demux/id3 */"./src/demux/id3.ts"),s=i(/*! ./dummy-demuxed-track */"./src/demux/dummy-demuxed-track.ts"),a=i(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),o=i(/*! ../utils/typed-array */"./src/utils/typed-array.ts"),l=function(){function t(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var e=t.prototype;return e.resetInitSegment=function(t,e,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},e.resetTimeStamp=function(){},e.resetContiguity=function(){},e.canParse=function(t,e){return!1},e.appendFrame=function(t,e,i){},e.demux=function(t,e){this.cachedData&&(t=Object(a.appendUint8Array)(this.cachedData,t),this.cachedData=null);var i,r,l=n.getID3Data(t,0),u=l?l.length:0,h=this._audioTrack,d=this._id3Track,f=l?n.getTimeStamp(l):void 0,p=t.length;for(0!==this.frameIndex&&null!==this.initPTS||(this.initPTS=c(f,e)),l&&l.length>0&&d.samples.push({pts:this.initPTS,dts:this.initPTS,data:l}),r=this.initPTS;u<p;){if(this.canParse(t,u)){var g=this.appendFrame(h,t,u);g?(this.frameIndex++,r=g.sample.pts,i=u+=g.length):u=p}else n.canParse(t,u)?(l=n.getID3Data(t,u),d.samples.push({pts:r,dts:r,data:l}),i=u+=l.length):u++;if(u===p&&i!==p){var v=Object(o.sliceUint8)(t,i);this.cachedData?this.cachedData=Object(a.appendUint8Array)(this.cachedData,v):this.cachedData=v}}return{audioTrack:h,avcTrack:Object(s.dummyTrack)(),id3Track:d,textTrack:Object(s.dummyTrack)()}},e.demuxSampleAes=function(t,e,i){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},e.flush=function(t){var e=this.cachedData;return e&&(this.cachedData=null,this.demux(e,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(s.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(s.dummyTrack)()}},e.destroy=function(){},t}(),c=function(t,e){return Object(r.isFiniteNumber)(t)?90*t:9e4*e};e.default=l},"./src/demux/chunk-cache.ts":
/*!**********************************!*\
!*** ./src/demux/chunk-cache.ts ***!
\**********************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return r}));var r=function(){function t(){this.chunks=[],this.dataLength=0}var e=t.prototype;return e.push=function(t){this.chunks.push(t),this.dataLength+=t.length},e.flush=function(){var t,e=this.chunks,i=this.dataLength;return e.length?(t=1===e.length?e[0]:function(t,e){for(var i=new Uint8Array(e),r=0,n=0;n<t.length;n++){var s=t[n];i.set(s,r),r+=s.length}return i}(e,i),this.reset(),t):new Uint8Array(0)},e.reset=function(){this.chunks.length=0,this.dataLength=0},t}()},"./src/demux/dummy-demuxed-track.ts":
/*!******************************************!*\
!*** ./src/demux/dummy-demuxed-track.ts ***!
\******************************************/
/*! exports provided: dummyTrack */function(t,e,i){"use strict";function r(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}i.r(e),i.d(e,"dummyTrack",(function(){return r}))},"./src/demux/exp-golomb.ts":
/*!*********************************!*\
!*** ./src/demux/exp-golomb.ts ***!
\*********************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e);var r=i(/*! ../utils/logger */"./src/utils/logger.ts"),n=function(){function t(t){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=t,this.bytesAvailable=t.byteLength,this.word=0,this.bitsAvailable=0}var e=t.prototype;return e.loadWord=function(){var t=this.data,e=this.bytesAvailable,i=t.byteLength-e,r=new Uint8Array(4),n=Math.min(4,e);if(0===n)throw new Error("no bytes available");r.set(t.subarray(i,i+n)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=8*n,this.bytesAvailable-=n},e.skipBits=function(t){var e;this.bitsAvailable>t?(this.word<<=t,this.bitsAvailable-=t):(t-=this.bitsAvailable,t-=(e=t>>3)>>3,this.bytesAvailable-=e,this.loadWord(),this.word<<=t,this.bitsAvailable-=t)},e.readBits=function(t){var e=Math.min(this.bitsAvailable,t),i=this.word>>>32-e;return t>32&&r.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0?this.word<<=e:this.bytesAvailable>0&&this.loadWord(),(e=t-e)>0&&this.bitsAvailable?i<<e|this.readBits(e):i},e.skipLZ=function(){var t;for(t=0;t<this.bitsAvailable;++t)if(0!=(this.word&2147483648>>>t))return this.word<<=t,this.bitsAvailable-=t,t;return this.loadWord(),t+this.skipLZ()},e.skipUEG=function(){this.skipBits(1+this.skipLZ())},e.skipEG=function(){this.skipBits(1+this.skipLZ())},e.readUEG=function(){var t=this.skipLZ();return this.readBits(t+1)-1},e.readEG=function(){var t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)},e.readBoolean=function(){return 1===this.readBits(1)},e.readUByte=function(){return this.readBits(8)},e.readUShort=function(){return this.readBits(16)},e.readUInt=function(){return this.readBits(32)},e.skipScalingList=function(t){for(var e=8,i=8,r=0;r<t;r++)0!==i&&(i=(e+this.readEG()+256)%256),e=0===i?e:i},e.readSPS=function(){var t,e,i,r=0,n=0,s=0,a=0,o=this.readUByte.bind(this),l=this.readBits.bind(this),c=this.readUEG.bind(this),u=this.readBoolean.bind(this),h=this.skipBits.bind(this),d=this.skipEG.bind(this),f=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);o();var g=o();if(l(5),h(3),o(),f(),100===g||110===g||122===g||244===g||44===g||83===g||86===g||118===g||128===g){var v=c();if(3===v&&h(1),f(),f(),h(1),u())for(e=3!==v?8:12,i=0;i<e;i++)u()&&p(i<6?16:64)}f();var m=c();if(0===m)c();else if(1===m)for(h(1),d(),d(),t=c(),i=0;i<t;i++)d();f(),h(1);var y=c(),b=c(),E=l(1);0===E&&h(1),h(1),u()&&(r=c(),n=c(),s=c(),a=c());var S=[1,1];if(u()&&u())switch(o()){case 1:S=[1,1];break;case 2:S=[12,11];break;case 3:S=[10,11];break;case 4:S=[16,11];break;case 5:S=[40,33];break;case 6:S=[24,11];break;case 7:S=[20,11];break;case 8:S=[32,11];break;case 9:S=[80,33];break;case 10:S=[18,11];break;case 11:S=[15,11];break;case 12:S=[64,33];break;case 13:S=[160,99];break;case 14:S=[4,3];break;case 15:S=[3,2];break;case 16:S=[2,1];break;case 255:S=[o()<<8|o(),o()<<8|o()]}return{width:Math.ceil(16*(y+1)-2*r-2*n),height:(2-E)*(b+1)*16-(E?2:4)*(s+a),pixelRatio:S}},e.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},t}();e.default=n},"./src/demux/id3.ts":
/*!**************************!*\
!*** ./src/demux/id3.ts ***!
\**************************/
/*! exports provided: isHeader, isFooter, getID3Data, canParse, getTimeStamp, isTimeStampFrame, getID3Frames, decodeFrame, utf8ArrayToStr, testables */function(t,e,i){"use strict";i.r(e),i.d(e,"isHeader",(function(){return n})),i.d(e,"isFooter",(function(){return s})),i.d(e,"getID3Data",(function(){return a})),i.d(e,"canParse",(function(){return l})),i.d(e,"getTimeStamp",(function(){return c})),i.d(e,"isTimeStampFrame",(function(){return u})),i.d(e,"getID3Frames",(function(){return d})),i.d(e,"decodeFrame",(function(){return f})),i.d(e,"utf8ArrayToStr",(function(){return y})),i.d(e,"testables",(function(){return b}));var r,n=function(t,e){return e+10<=t.length&&73===t[e]&&68===t[e+1]&&51===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128},s=function(t,e){return e+10<=t.length&&51===t[e]&&68===t[e+1]&&73===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128},a=function(t,e){for(var i=e,r=0;n(t,e);)r+=10,r+=o(t,e+6),s(t,e+10)&&(r+=10),e+=r;if(r>0)return t.subarray(i,i+r)},o=function(t,e){var i=0;return i=(127&t[e])<<21,i|=(127&t[e+1])<<14,i|=(127&t[e+2])<<7,i|=127&t[e+3]},l=function(t,e){return n(t,e)&&o(t,e+6)+10<=t.length-e},c=function(t){for(var e=d(t),i=0;i<e.length;i++){var r=e[i];if(u(r))return m(r)}},u=function(t){return t&&"PRIV"===t.key&&"com.apple.streaming.transportStreamTimestamp"===t.info},h=function(t){var e=String.fromCharCode(t[0],t[1],t[2],t[3]),i=o(t,4);return{type:e,size:i,data:t.subarray(10,10+i)}},d=function(t){for(var e=0,i=[];n(t,e);){for(var r=o(t,e+6),a=(e+=10)+r;e+8<a;){var l=h(t.subarray(e)),c=f(l);c&&i.push(c),e+=l.size+10}s(t,e)&&(e+=10)}return i},f=function(t){return"PRIV"===t.type?p(t):"W"===t.type[0]?v(t):g(t)},p=function(t){if(!(t.size<2)){var e=y(t.data,!0),i=new Uint8Array(t.data.subarray(e.length+1));return{key:t.type,info:e,data:i.buffer}}},g=function(t){if(!(t.size<2)){if("TXXX"===t.type){var e=1,i=y(t.data.subarray(e),!0);e+=i.length+1;var r=y(t.data.subarray(e));return{key:t.type,info:i,data:r}}var n=y(t.data.subarray(1));return{key:t.type,data:n}}},v=function(t){if("WXXX"===t.type){if(t.size<2)return;var e=1,i=y(t.data.subarray(e),!0);e+=i.length+1;var r=y(t.data.subarray(e));return{key:t.type,info:i,data:r}}var n=y(t.data);return{key:t.type,data:n}},m=function(t){if(8===t.data.byteLength){var e=new Uint8Array(t.data),i=1&e[3],r=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return r/=45,i&&(r+=47721858.84),Math.round(r)}},y=function(t,e){void 0===e&&(e=!1);var i=E();if(i){var r=i.decode(t);if(e){var n=r.indexOf("\0");return-1!==n?r.substring(0,n):r}return r.replace(/\0/g,"")}for(var s,a,o,l=t.length,c="",u=0;u<l;){if(0===(s=t[u++])&&e)return c;if(0!==s&&3!==s)switch(s>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:c+=String.fromCharCode(s);break;case 12:case 13:a=t[u++],c+=String.fromCharCode((31&s)<<6|63&a);break;case 14:a=t[u++],o=t[u++],c+=String.fromCharCode((15&s)<<12|(63&a)<<6|(63&o)<<0)}}return c},b={decodeTextFrame:g};function E(){return r||void 0===self.TextDecoder||(r=new self.TextDecoder("utf-8")),r}},"./src/demux/mp3demuxer.ts":
/*!*********************************!*\
!*** ./src/demux/mp3demuxer.ts ***!
\*********************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e);var r=i(/*! ./base-audio-demuxer */"./src/demux/base-audio-demuxer.ts"),n=i(/*! ../demux/id3 */"./src/demux/id3.ts"),s=i(/*! ../utils/logger */"./src/utils/logger.ts"),a=i(/*! ./mpegaudio */"./src/demux/mpegaudio.ts");function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var l=function(t){var e,i;function r(){return t.apply(this,arguments)||this}i=t,(e=r).prototype=Object.create(i.prototype),e.prototype.constructor=e,o(e,i);var l=r.prototype;return l.resetInitSegment=function(e,i,r){t.prototype.resetInitSegment.call(this,e,i,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:e,duration:r,inputTimeScale:9e4,dropped:0}},r.probe=function(t){if(!t)return!1;for(var e=(n.getID3Data(t,0)||[]).length,i=t.length;e<i;e++)if(a.probe(t,e))return s.logger.log("MPEG Audio sync word found !"),!0;return!1},l.canParse=function(t,e){return a.canParse(t,e)},l.appendFrame=function(t,e,i){if(null!==this.initPTS)return a.appendFrame(t,e,i,this.initPTS,this.frameIndex)},r}(r.default);l.minProbeByteLength=4,e.default=l},"./src/demux/mp4demuxer.ts":
/*!*********************************!*\
!*** ./src/demux/mp4demuxer.ts ***!
\*********************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e);var r=i(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),n=i(/*! ./dummy-demuxed-track */"./src/demux/dummy-demuxed-track.ts"),s=function(){function t(t,e){this.remainderData=null,this.config=void 0,this.config=e}var e=t.prototype;return e.resetTimeStamp=function(){},e.resetInitSegment=function(){},e.resetContiguity=function(){},t.probe=function(t){return Object(r.findBox)({data:t,start:0,end:Math.min(t.length,16384)},["moof"]).length>0},e.demux=function(t){var e=t,i=Object(n.dummyTrack)();if(this.config.progressive){this.remainderData&&(e=Object(r.appendUint8Array)(this.remainderData,t));var s=Object(r.segmentValidRange)(e);this.remainderData=s.remainder,i.samples=s.valid||new Uint8Array}else i.samples=e;return{audioTrack:Object(n.dummyTrack)(),avcTrack:i,id3Track:Object(n.dummyTrack)(),textTrack:Object(n.dummyTrack)()}},e.flush=function(){var t=Object(n.dummyTrack)();return t.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(n.dummyTrack)(),avcTrack:t,id3Track:Object(n.dummyTrack)(),textTrack:Object(n.dummyTrack)()}},e.demuxSampleAes=function(t,e,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},e.destroy=function(){},t}();s.minProbeByteLength=1024,e.default=s},"./src/demux/mpegaudio.ts":
/*!********************************!*\
!*** ./src/demux/mpegaudio.ts ***!
\********************************/
/*! exports provided: appendFrame, parseHeader, isHeaderPattern, isHeader, canParse, probe */function(t,e,i){"use strict";i.r(e),i.d(e,"appendFrame",(function(){return l})),i.d(e,"parseHeader",(function(){return c})),i.d(e,"isHeaderPattern",(function(){return u})),i.d(e,"isHeader",(function(){return h})),i.d(e,"canParse",(function(){return d})),i.d(e,"probe",(function(){return f}));var r=null,n=[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],s=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],a=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],o=[0,1,1,4];function l(t,e,i,r,n){if(!(i+24>e.length)){var s=c(e,i);if(s&&i+s.frameLength<=e.length){var a=r+n*(9e4*s.samplesPerFrame/s.sampleRate),o={unit:e.subarray(i,i+s.frameLength),pts:a,dts:a};return t.config=[],t.channelCount=s.channelCount,t.samplerate=s.sampleRate,t.samples.push(o),{sample:o,length:s.frameLength,missing:0}}}}function c(t,e){var i=t[e+1]>>3&3,l=t[e+1]>>1&3,c=t[e+2]>>4&15,u=t[e+2]>>2&3;if(1!==i&&0!==c&&15!==c&&3!==u){var h=t[e+2]>>1&1,d=t[e+3]>>6,f=1e3*n[14*(3===i?3-l:3===l?3:4)+c-1],p=s[3*(3===i?0:2===i?1:2)+u],g=3===d?1:2,v=a[i][l],m=o[l],y=8*v*m,b=Math.floor(v*f/p+h)*m;if(null===r){var E=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);r=E?parseInt(E[1]):0}return!!r&&r<=87&&2===l&&f>=224e3&&0===d&&(t[e+3]=128|t[e+3]),{sampleRate:p,channelCount:g,frameLength:b,samplesPerFrame:y}}}function u(t,e){return 255===t[e]&&224==(224&t[e+1])&&0!=(6&t[e+1])}function h(t,e){return e+1<t.length&&u(t,e)}function d(t,e){return u(t,e)&&4<=t.length-e}function f(t,e){if(e+1<t.length&&u(t,e)){var i=c(t,e),r=4;null!=i&&i.frameLength&&(r=i.frameLength);var n=e+r;return n===t.length||h(t,n)}return!1}},"./src/demux/sample-aes.ts":
/*!*********************************!*\
!*** ./src/demux/sample-aes.ts ***!
\*********************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e);var r=i(/*! ../crypt/decrypter */"./src/crypt/decrypter.ts"),n=i(/*! ./tsdemuxer */"./src/demux/tsdemuxer.ts"),s=function(){function t(t,e,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new r.default(t,e,{removePKCS7Padding:!1})}var e=t.prototype;return e.decryptBuffer=function(t,e){this.decrypter.decrypt(t,this.keyData.key.buffer,this.keyData.iv.buffer,e)},e.decryptAacSample=function(t,e,i,r){var n=t[e].unit,s=n.subarray(16,n.length-n.length%16),a=s.buffer.slice(s.byteOffset,s.byteOffset+s.length),o=this;this.decryptBuffer(a,(function(s){var a=new Uint8Array(s);n.set(a,16),r||o.decryptAacSamples(t,e+1,i)}))},e.decryptAacSamples=function(t,e,i){for(;;e++){if(e>=t.length)return void i();if(!(t[e].unit.length<32)){var r=this.decrypter.isSync();if(this.decryptAacSample(t,e,i,r),!r)return}}},e.getAvcEncryptedData=function(t){for(var e=16*Math.floor((t.length-48)/160)+16,i=new Int8Array(e),r=0,n=32;n<=t.length-16;n+=160,r+=16)i.set(t.subarray(n,n+16),r);return i},e.getAvcDecryptedUnit=function(t,e){for(var i=new Uint8Array(e),r=0,n=32;n<=t.length-16;n+=160,r+=16)t.set(i.subarray(r,r+16),n);return t},e.decryptAvcSample=function(t,e,i,r,s,a){var o=Object(n.discardEPB)(s.data),l=this.getAvcEncryptedData(o),c=this;this.decryptBuffer(l.buffer,(function(n){s.data=c.getAvcDecryptedUnit(o,n),a||c.decryptAvcSamples(t,e,i+1,r)}))},e.decryptAvcSamples=function(t,e,i,r){if(t instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;e++,i=0){if(e>=t.length)return void r();for(var n=t[e].units;!(i>=n.length);i++){var s=n[i];if(!(s.data.length<=48||1!==s.type&&5!==s.type)){var a=this.decrypter.isSync();if(this.decryptAvcSample(t,e,i,r,s,a),!a)return}}}},t}();e.default=s},"./src/demux/transmuxer-interface.ts":
/*!*******************************************!*\
!*** ./src/demux/transmuxer-interface.ts ***!
\*******************************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return h}));var r=i(/*! webworkify-webpack */"./node_modules/webworkify-webpack/index.js"),n=i(/*! ../events */"./src/events.ts"),s=i(/*! ../demux/transmuxer */"./src/demux/transmuxer.ts"),a=i(/*! ../utils/logger */"./src/utils/logger.ts"),o=i(/*! ../errors */"./src/errors.ts"),l=i(/*! ../utils/mediasource-helper */"./src/utils/mediasource-helper.ts"),c=i(/*! eventemitter3 */"./node_modules/eventemitter3/index.js"),u=Object(l.getMediaSource)()||{isTypeSupported:function(){return!1}},h=function(){function t(t,e,i,l){var h=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=t,this.id=e,this.onTransmuxComplete=i,this.onFlush=l;var d=t.config,f=function(e,i){(i=i||{}).frag=h.frag,i.id=h.id,t.trigger(e,i)};this.observer=new c.EventEmitter,this.observer.on(n.Events.FRAG_DECRYPTED,f),this.observer.on(n.Events.ERROR,f);var p={mp4:u.isTypeSupported("video/mp4"),mpeg:u.isTypeSupported("audio/mpeg"),mp3:u.isTypeSupported('audio/mp4; codecs="mp3"')},g=navigator.vendor;if(d.enableWorker&&"undefined"!=typeof Worker){var v;a.logger.log("demuxing in webworker");try{v=this.worker=r(/*! ../demux/transmuxer-worker.ts */"./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),v.addEventListener("message",this.onwmsg),v.onerror=function(e){t.trigger(n.Events.ERROR,{type:o.ErrorTypes.OTHER_ERROR,details:o.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(e.message+" ("+e.filename+":"+e.lineno+")")})},v.postMessage({cmd:"init",typeSupported:p,vendor:g,id:e,config:JSON.stringify(d)})}catch(t){a.logger.warn("Error in worker:",t),a.logger.error("Error while initializing DemuxerWorker, fallback to inline"),v&&self.URL.revokeObjectURL(v.objectURL),this.transmuxer=new s.default(this.observer,p,d,g,e),this.worker=null}}else this.transmuxer=new s.default(this.observer,p,d,g,e)}var e=t.prototype;return e.destroy=function(){var t=this.worker;if(t)t.removeEventListener("message",this.onwmsg),t.terminate(),this.worker=null;else{var e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}var i=this.observer;i&&i.removeAllListeners(),this.observer=null},e.push=function(t,e,i,r,n,o,l,c,u,h){var d=this;u.transmuxing.start=self.performance.now();var f=this.transmuxer,p=this.worker,g=o?o.start:n.start,v=n.decryptdata,m=this.frag,y=!(m&&n.cc===m.cc),b=!(m&&u.level===m.level),E=m?u.sn-m.sn:-1,S=this.part?u.part-this.part.index:1,C=!b&&(1===E||0===E&&1===S),k=self.performance.now();(b||E||0===n.stats.parsing.start)&&(n.stats.parsing.start=k),!o||!S&&C||(o.stats.parsing.start=k);var w=new s.TransmuxState(y,C,c,b,g);if(!C||y){a.logger.log("[transmuxer-interface, "+n.type+"]: Starting new transmux session for sn: "+u.sn+" p: "+u.part+" level: "+u.level+" id: "+u.id+"\n discontinuity: "+y+"\n trackSwitch: "+b+"\n contiguous: "+C+"\n accurateTimeOffset: "+c+"\n timeOffset: "+g);var x=new s.TransmuxConfig(i,r,e,l,h);this.configureTransmuxer(x)}if(this.frag=n,this.part=o,p)p.postMessage({cmd:"demux",data:t,decryptdata:v,chunkMeta:u,state:w},t instanceof ArrayBuffer?[t]:[]);else if(f){var T=f.push(t,v,u,w);Object(s.isPromise)(T)?T.then((function(t){d.handleTransmuxComplete(t)})):this.handleTransmuxComplete(T)}},e.flush=function(t){var e=this;t.transmuxing.start=self.performance.now();var i=this.transmuxer,r=this.worker;if(r)r.postMessage({cmd:"flush",chunkMeta:t});else if(i){var n=i.flush(t);Object(s.isPromise)(n)?n.then((function(i){e.handleFlushResult(i,t)})):this.handleFlushResult(n,t)}},e.handleFlushResult=function(t,e){var i=this;t.forEach((function(t){i.handleTransmuxComplete(t)})),this.onFlush(e)},e.onWorkerMessage=function(t){var e=t.data,i=this.hls;switch(e.event){case"init":self.URL.revokeObjectURL(this.worker.objectURL);break;case"transmuxComplete":this.handleTransmuxComplete(e.data);break;case"flush":this.onFlush(e.data);break;default:e.data=e.data||{},e.data.frag=this.frag,e.data.id=this.id,i.trigger(e.event,e.data)}},e.configureTransmuxer=function(t){var e=this.worker,i=this.transmuxer;e?e.postMessage({cmd:"configure",config:t}):i&&i.configure(t)},e.handleTransmuxComplete=function(t){t.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(t)},t}()},"./src/demux/transmuxer-worker.ts":
/*!****************************************!*\
!*** ./src/demux/transmuxer-worker.ts ***!
\****************************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return o}));var r=i(/*! ../demux/transmuxer */"./src/demux/transmuxer.ts"),n=i(/*! ../events */"./src/events.ts"),s=i(/*! ../utils/logger */"./src/utils/logger.ts"),a=i(/*! eventemitter3 */"./node_modules/eventemitter3/index.js");function o(t){var e=new a.EventEmitter,i=function(e,i){t.postMessage({event:e,data:i})};e.on(n.Events.FRAG_DECRYPTED,i),e.on(n.Events.ERROR,i),t.addEventListener("message",(function(n){var a=n.data;switch(a.cmd){case"init":var o=JSON.parse(a.config);t.transmuxer=new r.default(e,a.typeSupported,o,a.vendor,a.id),Object(s.enableLogs)(o.debug),i("init",null);break;case"configure":t.transmuxer.configure(a.config);break;case"demux":var c=t.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(r.isPromise)(c)?c.then((function(e){l(t,e)})):l(t,c);break;case"flush":var h=a.chunkMeta,d=t.transmuxer.flush(h);Object(r.isPromise)(d)?d.then((function(e){u(t,e,h)})):u(t,d,h)}}))}function l(t,e){if((i=e.remuxResult).audio||i.video||i.text||i.id3||i.initSegment){var i,r=[],n=e.remuxResult,s=n.audio,a=n.video;s&&c(r,s),a&&c(r,a),t.postMessage({event:"transmuxComplete",data:e},r)}}function c(t,e){e.data1&&t.push(e.data1.buffer),e.data2&&t.push(e.data2.buffer)}function u(t,e,i){e.forEach((function(e){l(t,e)})),t.postMessage({event:"flush",data:i})}},"./src/demux/transmuxer.ts":
/*!*********************************!*\
!*** ./src/demux/transmuxer.ts ***!
\*********************************/
/*! exports provided: default, isPromise, TransmuxConfig, TransmuxState */function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return y})),i.d(e,"isPromise",(function(){return E})),i.d(e,"TransmuxConfig",(function(){return S})),i.d(e,"TransmuxState",(function(){return C}));var r,n=i(/*! ../events */"./src/events.ts"),s=i(/*! ../errors */"./src/errors.ts"),a=i(/*! ../crypt/decrypter */"./src/crypt/decrypter.ts"),o=i(/*! ../demux/aacdemuxer */"./src/demux/aacdemuxer.ts"),l=i(/*! ../demux/mp4demuxer */"./src/demux/mp4demuxer.ts"),c=i(/*! ../demux/tsdemuxer */"./src/demux/tsdemuxer.ts"),u=i(/*! ../demux/mp3demuxer */"./src/demux/mp3demuxer.ts"),h=i(/*! ../remux/mp4-remuxer */"./src/remux/mp4-remuxer.ts"),d=i(/*! ../remux/passthrough-remuxer */"./src/remux/passthrough-remuxer.ts"),f=i(/*! ./chunk-cache */"./src/demux/chunk-cache.ts"),p=i(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),g=i(/*! ../utils/logger */"./src/utils/logger.ts");try{r=self.performance.now.bind(self.performance)}catch(t){g.logger.debug("Unable to use Performance API on this environment"),r=self.Date.now}var v=[{demux:c.default,remux:h.default},{demux:l.default,remux:d.default},{demux:o.default,remux:h.default},{demux:u.default,remux:h.default}],m=1024;v.forEach((function(t){var e=t.demux;m=Math.max(m,e.minProbeByteLength)}));var y=function(){function t(t,e,i,r,n){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 f.default,this.observer=t,this.typeSupported=e,this.config=i,this.vendor=r,this.id=n}var e=t.prototype;return e.configure=function(t){this.transmuxConfig=t,this.decrypter&&this.decrypter.reset()},e.push=function(t,e,i,n){var s=this,a=i.transmuxing;a.executeStart=r();var o=new Uint8Array(t),l=this.cache,c=this.config,u=this.currentTransmuxState,h=this.transmuxConfig;n&&(this.currentTransmuxState=n);var d=function(t,e){var i=null;return t.byteLength>0&&null!=e&&null!=e.key&&null!==e.iv&&null!=e.method&&(i=e),i}(o,e);if(d&&"AES-128"===d.method){var f=this.getDecrypter();if(!c.enableSoftwareAES)return this.decryptionPromise=f.webCryptoDecrypt(o,d.key.buffer,d.iv.buffer).then((function(t){var e=s.push(t,null,i);return s.decryptionPromise=null,e})),this.decryptionPromise;var g=f.softwareDecrypt(o,d.key.buffer,d.iv.buffer);if(!g)return a.executeEnd=r(),b(i);o=new Uint8Array(g)}var v=n||u,m=v.contiguous,y=v.discontinuity,E=v.trackSwitch,S=v.accurateTimeOffset,C=v.timeOffset,k=h.audioCodec,w=h.videoCodec,x=h.defaultInitPts,T=h.duration,O=h.initSegmentData;if((y||E)&&this.resetInitSegment(O,k,w,T),y&&this.resetInitialTimestamp(x),m||this.resetContiguity(),this.needsProbing(o,y,E)){if(l.dataLength){var A=l.flush();o=Object(p.appendUint8Array)(A,o)}this.configureTransmuxer(o,h)}var L=this.transmux(o,d,C,S,i),R=this.currentTransmuxState;return R.contiguous=!0,R.discontinuity=!1,R.trackSwitch=!1,a.executeEnd=r(),L},e.flush=function(t){var e=this,i=t.transmuxing;i.executeStart=r();var a=this.decrypter,o=this.cache,l=this.currentTransmuxState,c=this.decryptionPromise;if(c)return c.then((function(){return e.flush(t)}));var u=[],h=l.timeOffset;if(a){var d=a.flush();d&&u.push(this.push(d,null,t))}var f=o.dataLength;o.reset();var p=this.demuxer,g=this.remuxer;if(!p||!g)return f>=m&&this.observer.emit(n.Events.ERROR,n.Events.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),i.executeEnd=r(),[b(t)];var v=p.flush(h);return E(v)?v.then((function(i){return e.flushRemux(u,i,t),u})):(this.flushRemux(u,v,t),u)},e.flushRemux=function(t,e,i){var n=e.audioTrack,s=e.avcTrack,a=e.id3Track,o=e.textTrack,l=this.currentTransmuxState,c=l.accurateTimeOffset,u=l.timeOffset;g.logger.log("[transmuxer.ts]: Flushed fragment "+i.sn+(i.part>-1?" p: "+i.part:"")+" of level "+i.level);var h=this.remuxer.remux(n,s,a,o,u,c,!0,this.id);t.push({remuxResult:h,chunkMeta:i}),i.transmuxing.executeEnd=r()},e.resetInitialTimestamp=function(t){var e=this.demuxer,i=this.remuxer;e&&i&&(e.resetTimeStamp(t),i.resetTimeStamp(t))},e.resetContiguity=function(){var t=this.demuxer,e=this.remuxer;t&&e&&(t.resetContiguity(),e.resetNextTimestamp())},e.resetInitSegment=function(t,e,i,r){var n=this.demuxer,s=this.remuxer;n&&s&&(n.resetInitSegment(e,i,r),s.resetInitSegment(t,e,i))},e.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},e.transmux=function(t,e,i,r,n){return e&&"SAMPLE-AES"===e.method?this.transmuxSampleAes(t,e,i,r,n):this.transmuxUnencrypted(t,i,r,n)},e.transmuxUnencrypted=function(t,e,i,r){var n=this.demuxer.demux(t,e,!1,!this.config.progressive),s=n.audioTrack,a=n.avcTrack,o=n.id3Track,l=n.textTrack;return{remuxResult:this.remuxer.remux(s,a,o,l,e,i,!1,this.id),chunkMeta:r}},e.transmuxSampleAes=function(t,e,i,r,n){var s=this;return this.demuxer.demuxSampleAes(t,e,i).then((function(t){return{remuxResult:s.remuxer.remux(t.audioTrack,t.avcTrack,t.id3Track,t.textTrack,i,r,!1,s.id),chunkMeta:n}}))},e.configureTransmuxer=function(t,e){for(var i,r=this.config,n=this.observer,s=this.typeSupported,a=this.vendor,o=e.audioCodec,c=e.defaultInitPts,u=e.duration,h=e.initSegmentData,f=e.videoCodec,p=0,m=v.length;p<m;p++)if(v[p].demux.probe(t)){i=v[p];break}i||(g.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),i={demux:l.default,remux:d.default});var y=this.demuxer,b=this.remuxer,E=i.remux,S=i.demux;b&&b instanceof E||(this.remuxer=new E(n,r,s,a)),y&&y instanceof S||(this.demuxer=new S(n,r,s),this.probe=S.probe),this.resetInitSegment(h,o,f,u),this.resetInitialTimestamp(c)},e.needsProbing=function(t,e,i){return!this.demuxer||!this.remuxer||e||i},e.getDecrypter=function(){var t=this.decrypter;return t||(t=this.decrypter=new a.default(this.observer,this.config)),t},t}(),b=function(t){return{remuxResult:{},chunkMeta:t}};function E(t){return"then"in t&&t.then instanceof Function}var S=function(t,e,i,r,n){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=t,this.videoCodec=e,this.initSegmentData=i,this.duration=r,this.defaultInitPts=n},C=function(t,e,i,r,n){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=t,this.contiguous=e,this.accurateTimeOffset=i,this.trackSwitch=r,this.timeOffset=n}},"./src/demux/tsdemuxer.ts":
/*!********************************!*\
!*** ./src/demux/tsdemuxer.ts ***!
\********************************/
/*! exports provided: discardEPB, default */function(t,e,i){"use strict";i.r(e),i.d(e,"discardEPB",(function(){return E}));var r=i(/*! ./adts */"./src/demux/adts.ts"),n=i(/*! ./mpegaudio */"./src/demux/mpegaudio.ts"),s=i(/*! ./exp-golomb */"./src/demux/exp-golomb.ts"),a=i(/*! ./id3 */"./src/demux/id3.ts"),o=i(/*! ./sample-aes */"./src/demux/sample-aes.ts"),l=i(/*! ../events */"./src/events.ts"),c=i(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),u=i(/*! ../utils/logger */"./src/utils/logger.ts"),h=i(/*! ../errors */"./src/errors.ts"),d={video:1,audio:2,id3:3,text:4},f=function(){function t(t,e,i){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=t,this.config=e,this.typeSupported=i}t.probe=function(e){var i=t.syncOffset(e);return!(i<0||(i&&u.logger.warn("MPEG2-TS detected but first sync word found @ offset "+i+", junk ahead ?"),0))},t.syncOffset=function(t){for(var e=Math.min(1e3,t.length-564),i=0;i<e;){if(71===t[i]&&71===t[i+188]&&71===t[i+376])return i;i++}return-1},t.createTrack=function(t,e){return{container:"video"===t||"audio"===t?"video/mp2t":void 0,type:t,id:d[t],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===t?e:void 0}};var e=t.prototype;return e.resetInitSegment=function(e,i,r){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=t.createTrack("video",r),this._audioTrack=t.createTrack("audio",r),this._id3Track=t.createTrack("id3",r),this._txtTrack=t.createTrack("text",r),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=e,this.videoCodec=i,this._duration=r},e.resetTimeStamp=function(){},e.resetContiguity=function(){var t=this._audioTrack,e=this._avcTrack,i=this._id3Track;t&&(t.pesData=null),e&&(e.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},e.demux=function(e,i,r,n){var s;void 0===r&&(r=!1),void 0===n&&(n=!1),r||(this.sampleAes=null);var a=this._avcTrack,o=this._audioTrack,d=this._id3Track,f=a.pid,p=a.pesData,y=o.pid,b=d.pid,E=o.pesData,S=d.pesData,C=!1,k=this.pmtParsed,w=this._pmtId,x=e.length;if(this.remainderData&&(x=(e=Object(c.appendUint8Array)(this.remainderData,e)).length,this.remainderData=null),x<188&&!n)return this.remainderData=e,{audioTrack:o,avcTrack:a,id3Track:d,textTrack:this._txtTrack};var T=Math.max(0,t.syncOffset(e));(x-=(x+T)%188)<e.byteLength&&!n&&(this.remainderData=new Uint8Array(e.buffer,x,e.buffer.byteLength-x));for(var O=T;O<x;O+=188)if(71===e[O]){var A=!!(64&e[O+1]),L=((31&e[O+1])<<8)+e[O+2],R=void 0;if((48&e[O+3])>>4>1){if((R=O+5+e[O+4])===O+188)continue}else R=O+4;switch(L){case f:A&&(p&&(s=m(p))&&this.parseAVCPES(s,!1),p={data:[],size:0}),p&&(p.data.push(e.subarray(R,O+188)),p.size+=O+188-R);break;case y:A&&(E&&(s=m(E))&&(o.isAAC?this.parseAACPES(s):this.parseMPEGPES(s)),E={data:[],size:0}),E&&(E.data.push(e.subarray(R,O+188)),E.size+=O+188-R);break;case b:A&&(S&&(s=m(S))&&this.parseID3PES(s),S={data:[],size:0}),S&&(S.data.push(e.subarray(R,O+188)),S.size+=O+188-R);break;case 0:A&&(R+=e[R]+1),w=this._pmtId=g(e,R);break;case w:A&&(R+=e[R]+1);var _=v(e,R,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,r);(f=_.avc)>0&&(a.pid=f),(y=_.audio)>0&&(o.pid=y,o.isAAC=_.isAAC),(b=_.id3)>0&&(d.pid=b),C&&!k&&(u.logger.log("reparse from beginning"),C=!1,O=T-188),k=this.pmtParsed=!0;break;case 17:case 8191:break;default:C=!0}}else this.observer.emit(l.Events.ERROR,l.Events.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});a.pesData=p,o.pesData=E,d.pesData=S;var D={audioTrack:o,avcTrack:a,id3Track:d,textTrack:this._txtTrack};return n&&this.extractRemainingSamples(D),D},e.flush=function(){var t,e=this.remainderData;return this.remainderData=null,t=e?this.demux(e,-1,!1,!0):{audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t},e.extractRemainingSamples=function(t){var e,i=t.audioTrack,r=t.avcTrack,n=t.id3Track,s=r.pesData,a=i.pesData,o=n.pesData;s&&(e=m(s))?(this.parseAVCPES(e,!0),r.pesData=null):r.pesData=s,a&&(e=m(a))?(i.isAAC?this.parseAACPES(e):this.parseMPEGPES(e),i.pesData=null):(null!=a&&a.size&&u.logger.log("last AAC PES packet truncated,might overlap between fragments"),i.pesData=a),o&&(e=m(o))?(this.parseID3PES(e),n.pesData=null):n.pesData=o},e.demuxSampleAes=function(t,e,i){var r=this.demux(t,i,!0,!this.config.progressive),n=this.sampleAes=new o.default(this.observer,this.config,e);return this.decrypt(r,n)},e.decrypt=function(t,e){return new Promise((function(i){var r=t.audioTrack,n=t.avcTrack;r.samples&&r.isAAC?e.decryptAacSamples(r.samples,0,(function(){n.samples?e.decryptAvcSamples(n.samples,0,0,(function(){i(t)})):i(t)})):n.samples&&e.decryptAvcSamples(n.samples,0,0,(function(){i(t)}))}))},e.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},e.parseAVCPES=function(t,e){var i,r=this,n=this._avcTrack,o=this.parseAVCNALu(t.data),l=this.avcSample,c=!1;t.data=null,l&&o.length&&!n.audFound&&(y(l,n),l=this.avcSample=p(!1,t.pts,t.dts,"")),o.forEach((function(e){switch(e.type){case 1:i=!0,l||(l=r.avcSample=p(!0,t.pts,t.dts,"")),l.frame=!0;var o=e.data;if(c&&o.length>4){var u=new s.default(o).readSliceType();2!==u&&4!==u&&7!==u&&9!==u||(l.key=!0)}break;case 5:i=!0,l||(l=r.avcSample=p(!0,t.pts,t.dts,"")),l.key=!0,l.frame=!0;break;case 6:i=!0;var h=new s.default(E(e.data));h.readUByte();for(var d=0,f=0,g=!1,v=0;!g&&h.bytesAvailable>1;){d=0;do{d+=v=h.readUByte()}while(255===v);f=0;do{f+=v=h.readUByte()}while(255===v);if(4===d&&0!==h.bytesAvailable){if(g=!0,181===h.readUByte()&&49===h.readUShort()&&1195456820===h.readUInt()&&3===h.readUByte()){for(var m=h.readUByte(),S=31&m,C=[m,h.readUByte()],k=0;k<S;k++)C.push(h.readUByte()),C.push(h.readUByte()),C.push(h.readUByte());b(r._txtTrack.samples,{type:3,pts:t.pts,bytes:C})}}else if(5===d&&0!==h.bytesAvailable){if(g=!0,f>16){for(var w=[],x=0;x<16;x++)w.push(h.readUByte().toString(16)),3!==x&&5!==x&&7!==x&&9!==x||w.push("-");for(var T=f-16,O=new Uint8Array(T),A=0;A<T;A++)O[A]=h.readUByte();b(r._txtTrack.samples,{pts:t.pts,payloadType:d,uuid:w.join(""),userData:Object(a.utf8ArrayToStr)(O),userDataBytes:O})}}else if(f<h.bytesAvailable)for(var L=0;L<f;L++)h.readUByte()}break;case 7:if(i=!0,c=!0,!n.sps){var R=new s.default(e.data).readSPS();n.width=R.width,n.height=R.height,n.pixelRatio=R.pixelRatio,n.sps=[e.data],n.duration=r._duration;for(var _=e.data.subarray(1,4),D="avc1.",I=0;I<3;I++){var M=_[I].toString(16);M.length<2&&(M="0"+M),D+=M}n.codec=D}break;case 8:i=!0,n.pps||(n.pps=[e.data]);break;case 9:i=!1,n.audFound=!0,l&&y(l,n),l=r.avcSample=p(!1,t.pts,t.dts,"");break;case 12:i=!1;break;default:i=!1,l&&(l.debug+="unknown NAL "+e.type+" ")}l&&i&&l.units.push(e)})),e&&l&&(y(l,n),this.avcSample=null)},e.getLastNalUnit=function(){var t,e,i=this.avcSample;if(!i||0===i.units.length){var r=this._avcTrack.samples;i=r[r.length-1]}if(null!==(t=i)&&void 0!==t&&t.units){var n=i.units;e=n[n.length-1]}return e},e.parseAVCNALu=function(t){var e,i,r=t.byteLength,n=this._avcTrack,s=n.naluState||0,a=s,o=[],l=0,c=-1,u=0;for(-1===s&&(c=0,u=31&t[0],s=0,l=1);l<r;)if(e=t[l++],s)if(1!==s)if(e)if(1===e){if(c>=0){var h={data:t.subarray(c,l-s-1),type:u};o.push(h)}else{var d=this.getLastNalUnit();if(d&&(a&&l<=4-a&&d.state&&(d.data=d.data.subarray(0,d.data.byteLength-a)),(i=l-s-1)>0)){var f=new Uint8Array(d.data.byteLength+i);f.set(d.data,0),f.set(t.subarray(0,i),d.data.byteLength),d.data=f,d.state=0}}l<r?(c=l,u=31&t[l],s=0):s=-1}else s=0;else s=3;else s=e?0:2;else s=e?0:1;if(c>=0&&s>=0){var p={data:t.subarray(c,r),type:u,state:s};o.push(p)}if(0===o.length){var g=this.getLastNalUnit();if(g){var v=new Uint8Array(g.data.byteLength+t.byteLength);v.set(g.data,0),v.set(t,g.data.byteLength),g.data=v}}return n.naluState=s,o},e.parseAACPES=function(t){var e,i,n,s,a,o=0,c=this._audioTrack,d=this.aacOverFlow,f=t.data;if(d){this.aacOverFlow=null;var p=d.sample.unit.byteLength,g=Math.min(d.missing,p),v=p-g;d.sample.unit.set(f.subarray(0,g),v),c.samples.push(d.sample),o=d.missing}for(e=o,i=f.length;e<i-1&&!r.isHeader(f,e);e++);if(e===o||(e<i-1?(n="AAC PES did not start with ADTS header,offset:"+e,s=!1):(n="no ADTS header found in AAC PES",s=!0),u.logger.warn("parsing error:"+n),this.observer.emit(l.Events.ERROR,l.Events.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.FRAG_PARSING_ERROR,fatal:s,reason:n}),!s)){if(r.initTrackConfig(c,this.observer,f,e,this.audioCodec),void 0!==t.pts)a=t.pts;else{if(!d)return void u.logger.warn("[tsdemuxer]: AAC PES unknown PTS");var m=r.getFrameDuration(c.samplerate);a=d.sample.pts+m}for(var y=0;e<i;){if(r.isHeader(f,e)){if(e+5<i){var b=r.appendFrame(c,f,e,a,y);if(b){if(!b.missing){e+=b.length,y++;continue}this.aacOverFlow=b}}break}e++}}},e.parseMPEGPES=function(t){var e=t.data,i=e.length,r=0,s=0,a=t.pts;if(void 0!==a)for(;s<i;)if(n.isHeader(e,s)){var o=n.appendFrame(this._audioTrack,e,s,a,r);if(!o)break;s+=o.length,r++}else s++;else u.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")},e.parseID3PES=function(t){void 0!==t.pts?this._id3Track.samples.push(t):u.logger.warn("[tsdemuxer]: ID3 PES unknown PTS")},t}();function p(t,e,i,r){return{key:t,frame:!1,pts:e,dts:i,units:[],debug:r,length:0}}function g(t,e){return(31&t[e+10])<<8|t[e+11]}function v(t,e,i,r){var n={audio:-1,avc:-1,id3:-1,isAAC:!0},s=e+3+((15&t[e+1])<<8|t[e+2])-4;for(e+=12+((15&t[e+10])<<8|t[e+11]);e<s;){var a=(31&t[e+1])<<8|t[e+2];switch(t[e]){case 207:if(!r){u.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:-1===n.audio&&(n.audio=a);break;case 21:-1===n.id3&&(n.id3=a);break;case 219:if(!r){u.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:-1===n.avc&&(n.avc=a);break;case 3:case 4:i?-1===n.audio&&(n.audio=a,n.isAAC=!1):u.logger.log("MPEG audio found, not supported in this browser");break;case 36:u.logger.warn("Unsupported HEVC stream type found")}e+=5+((15&t[e+3])<<8|t[e+4])}return n}function m(t){var e,i,r,n,s,a=0,o=t.data;if(!t||0===t.size)return null;for(;o[0].length<19&&o.length>1;){var l=new Uint8Array(o[0].length+o[1].length);l.set(o[0]),l.set(o[1],o[0].length),o[0]=l,o.splice(1,1)}if(1===((e=o[0])[0]<<16)+(e[1]<<8)+e[2]){if((i=(e[4]<<8)+e[5])&&i>t.size-6)return null;var c=e[7];192&c&&(n=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&c?n-(s=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2)>54e5&&(u.logger.warn(Math.round((n-s)/9e4)+"s delta between PTS and DTS, align them"),n=s):s=n);var h=(r=e[8])+9;if(t.size<=h)return null;t.size-=h;for(var d=new Uint8Array(t.size),f=0,p=o.length;f<p;f++){var g=(e=o[f]).byteLength;if(h){if(h>g){h-=g;continue}e=e.subarray(h),g-=h,h=0}d.set(e,a),a+=g}return i&&(i-=r+3),{data:d,pts:n,dts:s,len:i}}return null}function y(t,e){if(t.units.length&&t.frame){if(void 0===t.pts){var i=e.samples,r=i.length;if(!r)return void e.dropped++;var n=i[r-1];t.pts=n.pts,t.dts=n.dts}e.samples.push(t)}t.debug.length&&u.logger.log(t.pts+"/"+t.dts+":"+t.debug)}function b(t,e){var i=t.length;if(i>0){if(e.pts>=t[i-1].pts)t.push(e);else for(var r=i-1;r>=0;r--)if(e.pts<t[r].pts){t.splice(r,0,e);break}}else t.push(e)}function E(t){for(var e=t.byteLength,i=[],r=1;r<e-2;)0===t[r]&&0===t[r+1]&&3===t[r+2]?(i.push(r+2),r+=2):r++;if(0===i.length)return t;var n=e-i.length,s=new Uint8Array(n),a=0;for(r=0;r<n;a++,r++)a===i[0]&&(a++,i.shift()),s[r]=t[a];return s}f.minProbeByteLength=188,e.default=f},"./src/errors.ts":
/*!***********************!*\
!*** ./src/errors.ts ***!
\***********************/
/*! exports provided: ErrorTypes, ErrorDetails */function(t,e,i){"use strict";var r,n;i.r(e),i.d(e,"ErrorTypes",(function(){return r})),i.d(e,"ErrorDetails",(function(){return n})),function(t){t.NETWORK_ERROR="networkError",t.MEDIA_ERROR="mediaError",t.KEY_SYSTEM_ERROR="keySystemError",t.MUX_ERROR="muxError",t.OTHER_ERROR="otherError"}(r||(r={})),function(t){t.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",t.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",t.KEY_SYSTEM_NO_SESSION="keySystemNoSession",t.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",t.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",t.MANIFEST_LOAD_ERROR="manifestLoadError",t.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",t.MANIFEST_PARSING_ERROR="manifestParsingError",t.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",t.LEVEL_EMPTY_ERROR="levelEmptyError",t.LEVEL_LOAD_ERROR="levelLoadError",t.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",t.LEVEL_SWITCH_ERROR="levelSwitchError",t.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",t.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",t.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",t.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",t.FRAG_LOAD_ERROR="fragLoadError",t.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",t.FRAG_DECRYPT_ERROR="fragDecryptError",t.FRAG_PARSING_ERROR="fragParsingError",t.REMUX_ALLOC_ERROR="remuxAllocError",t.KEY_LOAD_ERROR="keyLoadError",t.KEY_LOAD_TIMEOUT="keyLoadTimeOut",t.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",t.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",t.BUFFER_APPEND_ERROR="bufferAppendError",t.BUFFER_APPENDING_ERROR="bufferAppendingError",t.BUFFER_STALLED_ERROR="bufferStalledError",t.BUFFER_FULL_ERROR="bufferFullError",t.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",t.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",t.INTERNAL_EXCEPTION="internalException",t.INTERNAL_ABORTED="aborted",t.UNKNOWN="unknown"}(n||(n={}))},"./src/events.ts":
/*!***********************!*\
!*** ./src/events.ts ***!
\***********************/
/*! exports provided: Events */function(t,e,i){"use strict";var r;i.r(e),i.d(e,"Events",(function(){return r})),function(t){t.MEDIA_ATTACHING="hlsMediaAttaching",t.MEDIA_ATTACHED="hlsMediaAttached",t.MEDIA_DETACHING="hlsMediaDetaching",t.MEDIA_DETACHED="hlsMediaDetached",t.BUFFER_RESET="hlsBufferReset",t.BUFFER_CODECS="hlsBufferCodecs",t.BUFFER_CREATED="hlsBufferCreated",t.BUFFER_APPENDING="hlsBufferAppending",t.BUFFER_APPENDED="hlsBufferAppended",t.BUFFER_EOS="hlsBufferEos",t.BUFFER_FLUSHING="hlsBufferFlushing",t.BUFFER_FLUSHED="hlsBufferFlushed",t.MANIFEST_LOADING="hlsManifestLoading",t.MANIFEST_LOADED="hlsManifestLoaded",t.MANIFEST_PARSED="hlsManifestParsed",t.LEVEL_SWITCHING="hlsLevelSwitching",t.LEVEL_SWITCHED="hlsLevelSwitched",t.LEVEL_LOADING="hlsLevelLoading",t.LEVEL_LOADED="hlsLevelLoaded",t.LEVEL_UPDATED="hlsLevelUpdated",t.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",t.LEVELS_UPDATED="hlsLevelsUpdated",t.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",t.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",t.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",t.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",t.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",t.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",t.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",t.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",t.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",t.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",t.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",t.CUES_PARSED="hlsCuesParsed",t.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",t.INIT_PTS_FOUND="hlsInitPtsFound",t.FRAG_LOADING="hlsFragLoading",t.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",t.FRAG_LOADED="hlsFragLoaded",t.FRAG_DECRYPTED="hlsFragDecrypted",t.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",t.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",t.FRAG_PARSING_METADATA="hlsFragParsingMetadata",t.FRAG_PARSED="hlsFragParsed",t.FRAG_BUFFERED="hlsFragBuffered",t.FRAG_CHANGED="hlsFragChanged",t.FPS_DROP="hlsFpsDrop",t.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",t.ERROR="hlsError",t.DESTROYING="hlsDestroying",t.KEY_LOADING="hlsKeyLoading",t.KEY_LOADED="hlsKeyLoaded",t.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",t.BACK_BUFFER_REACHED="hlsBackBufferReached"}(r||(r={}))},"./src/hls.ts":
/*!********************!*\
!*** ./src/hls.ts ***!
\********************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return y}));var r=i(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js"),n=i(/*! ./loader/playlist-loader */"./src/loader/playlist-loader.ts"),s=i(/*! ./loader/key-loader */"./src/loader/key-loader.ts"),a=i(/*! ./controller/id3-track-controller */"./src/controller/id3-track-controller.ts"),o=i(/*! ./controller/latency-controller */"./src/controller/latency-controller.ts"),l=i(/*! ./controller/level-controller */"./src/controller/level-controller.ts"),c=i(/*! ./controller/fragment-tracker */"./src/controller/fragment-tracker.ts"),u=i(/*! ./controller/stream-controller */"./src/controller/stream-controller.ts"),h=i(/*! ./is-supported */"./src/is-supported.ts"),d=i(/*! ./utils/logger */"./src/utils/logger.ts"),f=i(/*! ./config */"./src/config.ts"),p=i(/*! eventemitter3 */"./node_modules/eventemitter3/index.js"),g=i(/*! ./events */"./src/events.ts"),v=i(/*! ./errors */"./src/errors.ts");function m(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var y=function(){function t(e){void 0===e&&(e={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new p.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 i=this.config=Object(f.mergeConfig)(t.DefaultConfig,e);this.userConfig=e,Object(d.enableLogs)(i.debug),this._autoLevelCapping=-1,i.progressive&&Object(f.enableStreamingMode)(i);var r=i.abrController,h=i.bufferController,g=i.capLevelController,v=i.fpsController,m=this.abrController=new r(this),y=this.bufferController=new h(this),b=this.capLevelController=new g(this),E=new v(this),S=new n.default(this),C=new s.default(this),k=new a.default(this),w=this.levelController=new l.default(this),x=new c.FragmentTracker(this),T=this.streamController=new u.default(this,x);b.setStreamController(T),E.setStreamController(T);var O=[w,T];this.networkControllers=O;var A=[S,C,m,y,b,E,k,x];this.audioTrackController=this.createController(i.audioTrackController,null,O),this.createController(i.audioStreamController,x,O),this.subtitleTrackController=this.createController(i.subtitleTrackController,null,O),this.createController(i.subtitleStreamController,x,O),this.createController(i.timelineController,null,A),this.emeController=this.createController(i.emeController,null,A),this.cmcdController=this.createController(i.cmcdController,null,A),this.latencyController=this.createController(o.default,null,A),this.coreComponents=A}t.isSupported=function(){return Object(h.isSupported)()};var e,i,y,b=t.prototype;return b.createController=function(t,e,i){if(t){var r=e?new t(this,e):new t(this);return i&&i.push(r),r}return null},b.on=function(t,e,i){void 0===i&&(i=this),this._emitter.on(t,e,i)},b.once=function(t,e,i){void 0===i&&(i=this),this._emitter.once(t,e,i)},b.removeAllListeners=function(t){this._emitter.removeAllListeners(t)},b.off=function(t,e,i,r){void 0===i&&(i=this),this._emitter.off(t,e,i,r)},b.listeners=function(t){return this._emitter.listeners(t)},b.emit=function(t,e,i){return this._emitter.emit(t,e,i)},b.trigger=function(t,e){if(this.config.debug)return this.emit(t,t,e);try{return this.emit(t,t,e)}catch(e){d.logger.error("An internal error happened while handling event "+t+'. Error message: "'+e.message+'". Here is a stacktrace:',e),this.trigger(g.Events.ERROR,{type:v.ErrorTypes.OTHER_ERROR,details:v.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:t,error:e})}return!1},b.listenerCount=function(t){return this._emitter.listenerCount(t)},b.destroy=function(){d.logger.log("destroy"),this.trigger(g.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach((function(t){return t.destroy()})),this.networkControllers.length=0,this.coreComponents.forEach((function(t){return t.destroy()})),this.coreComponents.length=0},b.attachMedia=function(t){d.logger.log("attachMedia"),this._media=t,this.trigger(g.Events.MEDIA_ATTACHING,{media:t})},b.detachMedia=function(){d.logger.log("detachMedia"),this.trigger(g.Events.MEDIA_DETACHING,void 0),this._media=null},b.loadSource=function(t){this.stopLoad();var e=this.media,i=this.url,n=this.url=r.buildAbsoluteURL(self.location.href,t,{alwaysNormalize:!0});d.logger.log("loadSource:"+n),e&&i&&i!==n&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(e)),this.trigger(g.Events.MANIFEST_LOADING,{url:t})},b.startLoad=function(t){void 0===t&&(t=-1),d.logger.log("startLoad("+t+")"),this.networkControllers.forEach((function(e){e.startLoad(t)}))},b.stopLoad=function(){d.logger.log("stopLoad"),this.networkControllers.forEach((function(t){t.stopLoad()}))},b.swapAudioCodec=function(){d.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},b.recoverMediaError=function(){d.logger.log("recoverMediaError");var t=this._media;this.detachMedia(),t&&this.attachMedia(t)},b.removeLevel=function(t,e){void 0===e&&(e=0),this.levelController.removeLevel(t,e)},e=t,y=[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return g.Events}},{key:"ErrorTypes",get:function(){return v.ErrorTypes}},{key:"ErrorDetails",get:function(){return v.ErrorDetails}},{key:"DefaultConfig",get:function(){return t.defaultConfig?t.defaultConfig:f.hlsDefaultConfig},set:function(e){t.defaultConfig=e}}],(i=[{key:"levels",get:function(){var t=this.levelController.levels;return t||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(t){d.logger.log("set currentLevel:"+t),this.loadLevel=t,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(t){d.logger.log("set nextLevel:"+t),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(t){d.logger.log("set loadLevel:"+t),this.levelController.manualLevel=t}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(t){this.levelController.nextLoadLevel=t}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(t){d.logger.log("set firstLevel:"+t),this.levelController.firstLevel=t}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(t){d.logger.log("set startLevel:"+t),-1!==t&&(t=Math.max(t,this.minAutoLevel)),this.levelController.startLevel=t}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(t){var e=!!t;e!==this.config.capLevelToPlayerSize&&(e?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=e)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(t){this._autoLevelCapping!==t&&(d.logger.log("set autoLevelCapping:"+t),this._autoLevelCapping=t)}},{key:"bandwidthEstimate",get:function(){var t=this.abrController.bwEstimator;return t?t.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var t=this.levels,e=this.config.minAutoBitrate;if(!t)return 0;for(var i=t.length,r=0;r<i;r++)if(t[r].maxBitrate>e)return r;return 0}},{key:"maxAutoLevel",get:function(){var t=this.levels,e=this.autoLevelCapping;return-1===e&&t&&t.length?t.length-1:e}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(t){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,t)}},{key:"audioTracks",get:function(){var t=this.audioTrackController;return t?t.audioTracks:[]}},{key:"audioTrack",get:function(){var t=this.audioTrackController;return t?t.audioTrack:-1},set:function(t){var e=this.audioTrackController;e&&(e.audioTrack=t)}},{key:"subtitleTracks",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTrack:-1},set:function(t){var e=this.subtitleTrackController;e&&(e.subtitleTrack=t)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var t=this.subtitleTrackController;return!!t&&t.subtitleDisplay},set:function(t){var e=this.subtitleTrackController;e&&(e.subtitleDisplay=t)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(t){this.config.lowLatencyMode=t}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}])&&m(e.prototype,i),y&&m(e,y),t}();y.defaultConfig=void 0},"./src/is-supported.ts":
/*!*****************************!*\
!*** ./src/is-supported.ts ***!
\*****************************/
/*! exports provided: isSupported, changeTypeSupported */function(t,e,i){"use strict";i.r(e),i.d(e,"isSupported",(function(){return s})),i.d(e,"changeTypeSupported",(function(){return a}));var r=i(/*! ./utils/mediasource-helper */"./src/utils/mediasource-helper.ts");function n(){return self.SourceBuffer||self.WebKitSourceBuffer}function s(){var t=Object(r.getMediaSource)();if(!t)return!1;var e=n(),i=t&&"function"==typeof t.isTypeSupported&&t.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),s=!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove;return!!i&&!!s}function a(){var t,e=n();return"function"==typeof(null==e||null===(t=e.prototype)||void 0===t?void 0:t.changeType)}},"./src/loader/fragment-loader.ts":
/*!***************************************!*\
!*** ./src/loader/fragment-loader.ts ***!
\***************************************/
/*! exports provided: default, LoadError */function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return h})),i.d(e,"LoadError",(function(){return f}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ../errors */"./src/errors.ts");function s(t){var e="function"==typeof Map?new Map:void 0;return(s=function(t){if(null===t||(i=t,-1===Function.toString.call(i).indexOf("[native code]")))return t;var i;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return a(t,arguments,c(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,t)})(t)}function a(t,e,i){return(a=o()?Reflect.construct:function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&l(n,i.prototype),n}).apply(null,arguments)}function o(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var u=Math.pow(2,17),h=function(){function t(t){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=t}var e=t.prototype;return e.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},e.abort=function(){this.loader&&this.loader.abort()},e.load=function(t,e){var i=this,r=t.url;if(!r)return Promise.reject(new f({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t,networkDetails:null},"Fragment does not have a "+(r?"part list":"url")));this.abort();var s=this.config,a=s.fLoader,o=s.loader;return new Promise((function(r,l){i.loader&&i.loader.destroy();var c=i.loader=t.loader=a?new a(s):new o(s),h=d(t),p={timeout:s.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:s.fragLoadingMaxRetryTimeout,highWaterMark:u};t.stats=c.stats,c.load(h,p,{onSuccess:function(e,n,s,a){i.resetLoader(t,c),r({frag:t,part:null,payload:e.data,networkDetails:a})},onError:function(e,r,s){i.resetLoader(t,c),l(new f({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t,response:e,networkDetails:s}))},onAbort:function(e,r,s){i.resetLoader(t,c),l(new f({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:t,networkDetails:s}))},onTimeout:function(e,r,s){i.resetLoader(t,c),l(new f({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,networkDetails:s}))},onProgress:function(i,r,n,s){e&&e({frag:t,part:null,payload:n,networkDetails:s})}})}))},e.loadPart=function(t,e,i){var r=this;this.abort();var s=this.config,a=s.fLoader,o=s.loader;return new Promise((function(l,c){r.loader&&r.loader.destroy();var h=r.loader=t.loader=a?new a(s):new o(s),p=d(t,e),g={timeout:s.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:s.fragLoadingMaxRetryTimeout,highWaterMark:u};e.stats=h.stats,h.load(p,g,{onSuccess:function(n,s,a,o){r.resetLoader(t,h),r.updateStatsFromPart(t,e);var c={frag:t,part:e,payload:n.data,networkDetails:o};i(c),l(c)},onError:function(i,s,a){r.resetLoader(t,h),c(new f({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t,part:e,response:i,networkDetails:a}))},onAbort:function(i,s,a){t.stats.aborted=e.stats.aborted,r.resetLoader(t,h),c(new f({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:t,part:e,networkDetails:a}))},onTimeout:function(i,s,a){r.resetLoader(t,h),c(new f({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,part:e,networkDetails:a}))}})}))},e.updateStatsFromPart=function(t,e){var i=t.stats,r=e.stats,n=r.total;if(i.loaded+=r.loaded,n){var s=Math.round(t.duration/e.duration),a=Math.min(Math.round(i.loaded/n),s),o=(s-a)*Math.round(i.loaded/a);i.total=i.loaded+o}else i.total=Math.max(i.loaded,i.total);var l=i.loading,c=r.loading;l.start?l.first+=c.first-c.start:(l.start=c.start,l.first=c.first),l.end=c.end},e.resetLoader=function(t,e){t.loader=null,this.loader===e&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),e.destroy()},t}();function d(t,e){void 0===e&&(e=null);var i=e||t,n={frag:t,part:e,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},s=i.byteRangeStartOffset,a=i.byteRangeEndOffset;return Object(r.isFiniteNumber)(s)&&Object(r.isFiniteNumber)(a)&&(n.rangeStart=s,n.rangeEnd=a),n}var f=function(t){var e,i;function r(e){for(var i,r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return(i=t.call.apply(t,[this].concat(n))||this).data=void 0,i.data=e,i}return i=t,(e=r).prototype=Object.create(i.prototype),e.prototype.constructor=e,l(e,i),r}(s(Error))},"./src/loader/fragment.ts":
/*!********************************!*\
!*** ./src/loader/fragment.ts ***!
\********************************/
/*! exports provided: ElementaryStreamTypes, BaseSegment, Fragment, Part */function(t,e,i){"use strict";i.r(e),i.d(e,"ElementaryStreamTypes",(function(){return r})),i.d(e,"BaseSegment",(function(){return f})),i.d(e,"Fragment",(function(){return p})),i.d(e,"Part",(function(){return g}));var r,n=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),s=i(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js"),a=i(/*! ../utils/logger */"./src/utils/logger.ts"),o=i(/*! ./level-key */"./src/loader/level-key.ts"),l=i(/*! ./load-stats */"./src/loader/load-stats.ts");function c(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,u(t,e)}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function h(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function d(t,e,i){return e&&h(t.prototype,e),i&&h(t,i),t}!function(t){t.AUDIO="audio",t.VIDEO="video",t.AUDIOVIDEO="audiovideo"}(r||(r={}));var f=function(){function t(t){var e;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((e={})[r.AUDIO]=null,e[r.VIDEO]=null,e[r.AUDIOVIDEO]=null,e),this.baseurl=t}return t.prototype.setByteRange=function(t,e){var i=t.split("@",2),r=[];1===i.length?r[0]=e?e.byteRangeEndOffset:0:r[0]=parseInt(i[1]),r[1]=parseInt(i[0])+r[0],this._byteRange=r},d(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}(),p=function(t){function e(e,i){var r;return(r=t.call(this,i)||this)._decryptdata=null,r.rawProgramDateTime=null,r.programDateTime=null,r.tagList=[],r.duration=0,r.sn=0,r.levelkey=void 0,r.type=void 0,r.loader=null,r.level=-1,r.cc=0,r.startPTS=void 0,r.endPTS=void 0,r.appendedPTS=void 0,r.startDTS=void 0,r.endDTS=void 0,r.start=0,r.deltaPTS=void 0,r.maxStartPTS=void 0,r.minEndPTS=void 0,r.stats=new l.LoadStats,r.urlId=0,r.data=void 0,r.bitrateTest=!1,r.title=null,r.initSegment=null,r.type=e,r}c(e,t);var i=e.prototype;return i.createInitializationVector=function(t){for(var e=new Uint8Array(16),i=12;i<16;i++)e[i]=t>>8*(15-i)&255;return e},i.setDecryptDataFromLevelKey=function(t,e){var i=t;return"AES-128"===(null==t?void 0:t.method)&&t.uri&&!t.iv&&((i=o.LevelKey.fromURI(t.uri)).method=t.method,i.iv=this.createInitializationVector(e),i.keyFormat="identity"),i},i.setElementaryStreamInfo=function(t,e,i,r,n,s){void 0===s&&(s=!1);var a=this.elementaryStreams,o=a[t];o?(o.startPTS=Math.min(o.startPTS,e),o.endPTS=Math.max(o.endPTS,i),o.startDTS=Math.min(o.startDTS,r),o.endDTS=Math.max(o.endDTS,n)):a[t]={startPTS:e,endPTS:i,startDTS:r,endDTS:n,partial:s}},i.clearElementaryStreamInfo=function(){var t=this.elementaryStreams;t[r.AUDIO]=null,t[r.VIDEO]=null,t[r.AUDIOVIDEO]=null},d(e,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var t=this.sn;"number"!=typeof t&&(this.levelkey&&"AES-128"===this.levelkey.method&&!this.levelkey.iv&&a.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),t=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,t)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(null===this.programDateTime)return null;if(!Object(n.isFiniteNumber)(this.programDateTime))return null;var t=Object(n.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+1e3*t}},{key:"encrypted",get:function(){var t;return!(null===(t=this.decryptdata)||void 0===t||!t.keyFormat||!this.decryptdata.uri)}}]),e}(f),g=function(t){function e(e,i,r,n,s){var a;(a=t.call(this,r)||this).fragOffset=0,a.duration=0,a.gap=!1,a.independent=!1,a.relurl=void 0,a.fragment=void 0,a.index=void 0,a.stats=new l.LoadStats,a.duration=e.decimalFloatingPoint("DURATION"),a.gap=e.bool("GAP"),a.independent=e.bool("INDEPENDENT"),a.relurl=e.enumeratedString("URI"),a.fragment=i,a.index=n;var o=e.enumeratedString("BYTERANGE");return o&&a.setByteRange(o,s),s&&(a.fragOffset=s.fragOffset+s.duration),a}return c(e,t),d(e,[{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)}}]),e}(f)},"./src/loader/key-loader.ts":
/*!**********************************!*\
!*** ./src/loader/key-loader.ts ***!
\**********************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return a}));var r=i(/*! ../events */"./src/events.ts"),n=i(/*! ../errors */"./src/errors.ts"),s=i(/*! ../utils/logger */"./src/utils/logger.ts"),a=function(){function t(t){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=t,this._registerListeners()}var e=t.prototype;return e._registerListeners=function(){this.hls.on(r.Events.KEY_LOADING,this.onKeyLoading,this)},e._unregisterListeners=function(){this.hls.off(r.Events.KEY_LOADING,this.onKeyLoading)},e.destroy=function(){for(var t in this._unregisterListeners(),this.loaders){var e=this.loaders[t];e&&e.destroy()}this.loaders={}},e.onKeyLoading=function(t,e){var i=e.frag,n=i.type,a=this.loaders[n];if(i.decryptdata){var o=i.decryptdata.uri;if(o!==this.decrypturl||null===this.decryptkey){var l=this.hls.config;if(a&&(s.logger.warn("abort previous key loader for type:"+n),a.abort()),!o)return void s.logger.warn("key uri is falsy");var c=l.loader,u=i.loader=this.loaders[n]=new c(l);this.decrypturl=o,this.decryptkey=null;var h={url:o,frag:i,responseType:"arraybuffer"},d={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(h,d,f)}else this.decryptkey&&(i.decryptdata.key=this.decryptkey,this.hls.trigger(r.Events.KEY_LOADED,{frag:i}))}else s.logger.warn("Missing decryption data on fragment in onKeyLoading")},e.loadsuccess=function(t,e,i){var n=i.frag;n.decryptdata?(this.decryptkey=n.decryptdata.key=new Uint8Array(t.data),n.loader=null,delete this.loaders[n.type],this.hls.trigger(r.Events.KEY_LOADED,{frag:n})):s.logger.error("after key load, decryptdata unset")},e.loaderror=function(t,e){var i=e.frag,s=i.loader;s&&s.abort(),delete this.loaders[i.type],this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:i,response:t})},e.loadtimeout=function(t,e){var i=e.frag,s=i.loader;s&&s.abort(),delete this.loaders[i.type],this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:i})},t}()},"./src/loader/level-details.ts":
/*!*************************************!*\
!*** ./src/loader/level-details.ts ***!
\*************************************/
/*! exports provided: LevelDetails */function(t,e,i){"use strict";i.r(e),i.d(e,"LevelDetails",(function(){return s}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts");function n(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var s=function(){function t(t){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=t}var e,i,s;return t.prototype.reloaded=function(t){if(!t)return this.advanced=!0,void(this.updated=!0);var e=this.lastPartSn-t.lastPartSn,i=this.lastPartIndex-t.lastPartIndex;this.updated=this.endSN!==t.endSN||!!i||!!e,this.advanced=this.endSN>t.endSN||e>0||0===e&&i>0,this.updated||this.advanced?this.misses=Math.floor(.6*t.misses):this.misses=t.misses+1,this.availabilityDelay=t.availabilityDelay},e=t,(i=[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&Object(r.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||10}},{key:"drift",get:function(){var t=this.driftEndTime-this.driftStartTime;return t>0?1e3*(this.driftEnd-this.driftStart)/t:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var t;return null!==(t=this.partList)&&void 0!==t&&t.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var t;return null!==(t=this.fragments)&&void 0!==t&&t.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var t;return null!==(t=this.partList)&&void 0!==t&&t.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var t;return null!==(t=this.partList)&&void 0!==t&&t.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}])&&n(e.prototype,i),s&&n(e,s),t}()},"./src/loader/level-key.ts":
/*!*********************************!*\
!*** ./src/loader/level-key.ts ***!
\*********************************/
/*! exports provided: LevelKey */function(t,e,i){"use strict";i.r(e),i.d(e,"LevelKey",(function(){return s}));var r=i(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js");function n(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var s=function(){function t(t,e){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,this._uri=e?Object(r.buildAbsoluteURL)(t,e,{alwaysNormalize:!0}):t}var e,i,s;return t.fromURL=function(e,i){return new t(e,i)},t.fromURI=function(e){return new t(e)},e=t,(i=[{key:"uri",get:function(){return this._uri}}])&&n(e.prototype,i),s&&n(e,s),t}()},"./src/loader/load-stats.ts":
/*!**********************************!*\
!*** ./src/loader/load-stats.ts ***!
\**********************************/
/*! exports provided: LoadStats */function(t,e,i){"use strict";i.r(e),i.d(e,"LoadStats",(function(){return r}));var r=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":
/*!***********************************!*\
!*** ./src/loader/m3u8-parser.ts ***!
\***********************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return v}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js"),s=i(/*! ./fragment */"./src/loader/fragment.ts"),a=i(/*! ./level-details */"./src/loader/level-details.ts"),o=i(/*! ./level-key */"./src/loader/level-key.ts"),l=i(/*! ../utils/attr-list */"./src/utils/attr-list.ts"),c=i(/*! ../utils/logger */"./src/utils/logger.ts"),u=i(/*! ../utils/codecs */"./src/utils/codecs.ts"),h=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,d=/#EXT-X-MEDIA:(.*)/g,f=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),p=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("|")),g=/\.(mp4|m4s|m4v|m4a)$/i,v=function(){function t(){}return t.findGroup=function(t,e){for(var i=0;i<t.length;i++){var r=t[i];if(r.id===e)return r}},t.convertAVC1ToAVCOTI=function(t){var e=t.split(".");if(e.length>2){var i=e.shift()+".";return i+=parseInt(e.shift()).toString(16),i+=("000"+parseInt(e.shift()).toString(16)).substr(-4)}return t},t.resolve=function(t,e){return n.buildAbsoluteURL(e,t,{alwaysNormalize:!0})},t.parseMasterPlaylist=function(e,i){var r,n=[],s={},a=!1;for(h.lastIndex=0;null!=(r=h.exec(e));)if(r[1]){var o=new l.AttrList(r[1]),c={attrs:o,bitrate:o.decimalInteger("AVERAGE-BANDWIDTH")||o.decimalInteger("BANDWIDTH"),name:o.NAME,url:t.resolve(r[2],i)},u=o.decimalResolution("RESOLUTION");u&&(c.width=u.width,c.height=u.height),m((o.CODECS||"").split(/[ ,]+/).filter((function(t){return t})),c),c.videoCodec&&-1!==c.videoCodec.indexOf("avc1")&&(c.videoCodec=t.convertAVC1ToAVCOTI(c.videoCodec)),n.push(c)}else if(r[3]){var d=new l.AttrList(r[3]);d["DATA-ID"]&&(a=!0,s[d["DATA-ID"]]=d)}return{levels:n,sessionData:a?s:null}},t.parseMasterPlaylistMedia=function(e,i,r,n){var s;void 0===n&&(n=[]);var a=[],o=0;for(d.lastIndex=0;null!==(s=d.exec(e));){var c=new l.AttrList(s[1]);if(c.TYPE===r){var u={attrs:c,bitrate:0,id:o++,groupId:c["GROUP-ID"],instreamId:c["INSTREAM-ID"],name:c.NAME||c.LANGUAGE||"",type:r,default:c.bool("DEFAULT"),autoselect:c.bool("AUTOSELECT"),forced:c.bool("FORCED"),lang:c.LANGUAGE,url:c.URI?t.resolve(c.URI,i):""};if(n.length){var h=t.findGroup(n,u.groupId)||n[0];y(u,h,"audioCodec"),y(u,h,"textCodec")}a.push(u)}}return a},t.parseLevelPlaylist=function(t,e,i,u,h){var d,v,m,y=new a.LevelDetails(e),E=y.fragments,S=null,C=0,k=0,w=0,x=0,T=null,O=new s.Fragment(u,e),A=-1,L=!1;for(f.lastIndex=0,y.m3u8=t;null!==(d=f.exec(t));){L&&(L=!1,(O=new s.Fragment(u,e)).start=w,O.sn=C,O.cc=x,O.level=i,S&&(O.initSegment=S,O.rawProgramDateTime=S.rawProgramDateTime));var R=d[1];if(R){O.duration=parseFloat(R);var _=(" "+d[2]).slice(1);O.title=_||null,O.tagList.push(_?["INF",R,_]:["INF",R])}else if(d[3])Object(r.isFiniteNumber)(O.duration)&&(O.start=w,m&&(O.levelkey=m),O.sn=C,O.level=i,O.cc=x,O.urlId=h,E.push(O),O.relurl=(" "+d[3]).slice(1),b(O,T),T=O,w+=O.duration,C++,k=0,L=!0);else if(d[4]){var D=(" "+d[4]).slice(1);T?O.setByteRange(D,T):O.setByteRange(D)}else if(d[5])O.rawProgramDateTime=(" "+d[5]).slice(1),O.tagList.push(["PROGRAM-DATE-TIME",O.rawProgramDateTime]),-1===A&&(A=E.length);else{if(!(d=d[0].match(p))){c.logger.warn("No matches on slow regex match for level playlist!");continue}for(v=1;v<d.length&&void 0===d[v];v++);var I=(" "+d[v]).slice(1),M=(" "+d[v+1]).slice(1),P=d[v+2]?(" "+d[v+2]).slice(1):"";switch(I){case"PLAYLIST-TYPE":y.type=M.toUpperCase();break;case"MEDIA-SEQUENCE":C=y.startSN=parseInt(M);break;case"SKIP":var N=new l.AttrList(M),j=N.decimalInteger("SKIPPED-SEGMENTS");if(Object(r.isFiniteNumber)(j)){y.skippedSegments=j;for(var B=j;B--;)E.unshift(null);C+=j}var F=N.enumeratedString("RECENTLY-REMOVED-DATERANGES");F&&(y.recentlyRemovedDateranges=F.split("\t"));break;case"TARGETDURATION":y.targetduration=parseFloat(M);break;case"VERSION":y.version=parseInt(M);break;case"EXTM3U":break;case"ENDLIST":y.live=!1;break;case"#":(M||P)&&O.tagList.push(P?[M,P]:[M]);break;case"DIS":x++;case"GAP":O.tagList.push([I]);break;case"BITRATE":O.tagList.push([I,M]);break;case"DISCONTINUITY-SEQ":x=parseInt(M);break;case"KEY":var U,G=new l.AttrList(M),H=G.enumeratedString("METHOD"),z=G.URI,V=G.hexadecimalInteger("IV"),K=G.enumeratedString("KEYFORMATVERSIONS"),W=G.enumeratedString("KEYID"),Y=null!=(U=G.enumeratedString("KEYFORMAT"))?U:"identity";if(["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"].indexOf(Y)>-1){c.logger.warn("Keyformat "+Y+" is not supported from the manifest");continue}if("identity"!==Y)continue;H&&(m=o.LevelKey.fromURL(e,z),z&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(H)>=0&&(m.method=H,m.keyFormat=Y,W&&(m.keyID=W),K&&(m.keyFormatVersions=K),m.iv=V));break;case"START":var X=new l.AttrList(M).decimalFloatingPoint("TIME-OFFSET");Object(r.isFiniteNumber)(X)&&(y.startTimeOffset=X);break;case"MAP":var q=new l.AttrList(M);O.relurl=q.URI,q.BYTERANGE&&O.setByteRange(q.BYTERANGE),O.level=i,O.sn="initSegment",m&&(O.levelkey=m),O.initSegment=null,S=O,L=!0;break;case"SERVER-CONTROL":var $=new l.AttrList(M);y.canBlockReload=$.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=$.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&$.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=$.optionalFloat("PART-HOLD-BACK",0),y.holdBack=$.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var J=new l.AttrList(M);y.partTarget=J.decimalFloatingPoint("PART-TARGET");break;case"PART":var Q=y.partList;Q||(Q=y.partList=[]);var Z=k>0?Q[Q.length-1]:void 0,tt=k++,et=new s.Part(new l.AttrList(M),O,e,tt,Z);Q.push(et),O.duration+=et.duration;break;case"PRELOAD-HINT":var it=new l.AttrList(M);y.preloadHint=it;break;case"RENDITION-REPORT":var rt=new l.AttrList(M);y.renditionReports=y.renditionReports||[],y.renditionReports.push(rt);break;default:c.logger.warn("line parsed but not handled: "+d)}}}T&&!T.relurl?(E.pop(),w-=T.duration,y.partList&&(y.fragmentHint=T)):y.partList&&(b(O,T),O.cc=x,y.fragmentHint=O);var nt=E.length,st=E[0],at=E[nt-1];if((w+=y.skippedSegments*y.targetduration)>0&&nt&&at){y.averagetargetduration=w/nt;var ot=at.sn;y.endSN="initSegment"!==ot?ot:0,st&&(y.startCC=st.cc,st.initSegment||y.fragments.every((function(t){return t.relurl&&(e=t.relurl,g.test(null!=(i=null===(r=n.parseURL(e))||void 0===r?void 0:r.path)?i:""));var e,i,r}))&&(c.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),(O=new s.Fragment(u,e)).relurl=at.relurl,O.level=i,O.sn="initSegment",st.initSegment=O,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&(w+=y.fragmentHint.duration),y.totalduration=w,y.endCC=x,A>0&&function(t,e){for(var i=t[e],r=e;r--;){var n=t[r];if(!n)return;n.programDateTime=i.programDateTime-1e3*n.duration,i=n}}(E,A),y},t}();function m(t,e){["video","audio","text"].forEach((function(i){var r=t.filter((function(t){return Object(u.isCodecType)(t,i)}));if(r.length){var n=r.filter((function(t){return 0===t.lastIndexOf("avc1",0)||0===t.lastIndexOf("mp4a",0)}));e[i+"Codec"]=n.length>0?n[0]:r[0],t=t.filter((function(t){return-1===r.indexOf(t)}))}})),e.unknownCodecs=t}function y(t,e,i){var r=e[i];r&&(t[i]=r)}function b(t,e){t.rawProgramDateTime?t.programDateTime=Date.parse(t.rawProgramDateTime):null!=e&&e.programDateTime&&(t.programDateTime=e.endProgramDateTime),Object(r.isFiniteNumber)(t.programDateTime)||(t.programDateTime=null,t.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":
/*!***************************************!*\
!*** ./src/loader/playlist-loader.ts ***!
\***************************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e);var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ../events */"./src/events.ts"),s=i(/*! ../errors */"./src/errors.ts"),a=i(/*! ../utils/logger */"./src/utils/logger.ts"),o=i(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),l=i(/*! ./m3u8-parser */"./src/loader/m3u8-parser.ts"),c=i(/*! ../types/loader */"./src/types/loader.ts"),u=i(/*! ../utils/attr-list */"./src/utils/attr-list.ts");function h(t,e){var i=t.url;return void 0!==i&&0!==i.indexOf("data:")||(i=e.url),i}var d=function(){function t(t){this.hls=void 0,this.loaders=Object.create(null),this.hls=t,this.registerListeners()}var e=t.prototype;return e.registerListeners=function(){var t=this.hls;t.on(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(n.Events.LEVEL_LOADING,this.onLevelLoading,this),t.on(n.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.on(n.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},e.unregisterListeners=function(){var t=this.hls;t.off(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(n.Events.LEVEL_LOADING,this.onLevelLoading,this),t.off(n.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.off(n.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},e.createInternalLoader=function(t){var e=this.hls.config,i=e.pLoader,r=e.loader,n=new(i||r)(e);return t.loader=n,this.loaders[t.type]=n,n},e.getInternalLoader=function(t){return this.loaders[t.type]},e.resetInternalLoader=function(t){this.loaders[t]&&delete this.loaders[t]},e.destroyInternalLoaders=function(){for(var t in this.loaders){var e=this.loaders[t];e&&e.destroy(),this.resetInternalLoader(t)}},e.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},e.onManifestLoading=function(t,e){var i=e.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:c.PlaylistContextType.MANIFEST,url:i,deliveryDirectives:null})},e.onLevelLoading=function(t,e){var i=e.id,r=e.level,n=e.url,s=e.deliveryDirectives;this.load({id:i,groupId:null,level:r,responseType:"text",type:c.PlaylistContextType.LEVEL,url:n,deliveryDirectives:s})},e.onAudioTrackLoading=function(t,e){var i=e.id,r=e.groupId,n=e.url,s=e.deliveryDirectives;this.load({id:i,groupId:r,level:null,responseType:"text",type:c.PlaylistContextType.AUDIO_TRACK,url:n,deliveryDirectives:s})},e.onSubtitleTrackLoading=function(t,e){var i=e.id,r=e.groupId,n=e.url,s=e.deliveryDirectives;this.load({id:i,groupId:r,level:null,responseType:"text",type:c.PlaylistContextType.SUBTITLE_TRACK,url:n,deliveryDirectives:s})},e.load=function(t){var e,i,r,n,s,o,l=this.hls.config,u=this.getInternalLoader(t);if(u){var h=u.context;if(h&&h.url===t.url)return void a.logger.trace("[playlist-loader]: playlist request ongoing");a.logger.log("[playlist-loader]: aborting previous loader for type: "+t.type),u.abort()}switch(t.type){case c.PlaylistContextType.MANIFEST:i=l.manifestLoadingMaxRetry,r=l.manifestLoadingTimeOut,n=l.manifestLoadingRetryDelay,s=l.manifestLoadingMaxRetryTimeout;break;case c.PlaylistContextType.LEVEL:case c.PlaylistContextType.AUDIO_TRACK:case c.PlaylistContextType.SUBTITLE_TRACK:i=0,r=l.levelLoadingTimeOut;break;default:i=l.levelLoadingMaxRetry,r=l.levelLoadingTimeOut,n=l.levelLoadingRetryDelay,s=l.levelLoadingMaxRetryTimeout}if(u=this.createInternalLoader(t),null!==(e=t.deliveryDirectives)&&void 0!==e&&e.part&&(t.type===c.PlaylistContextType.LEVEL&&null!==t.level?o=this.hls.levels[t.level].details:t.type===c.PlaylistContextType.AUDIO_TRACK&&null!==t.id?o=this.hls.audioTracks[t.id].details:t.type===c.PlaylistContextType.SUBTITLE_TRACK&&null!==t.id&&(o=this.hls.subtitleTracks[t.id].details),o)){var d=o.partTarget,f=o.targetduration;d&&f&&(r=Math.min(1e3*Math.max(3*d,.8*f),r))}var p={timeout:r,maxRetry:i,retryDelay:n,maxRetryDelay:s,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(t,p,g)},e.loadsuccess=function(t,e,i,r){if(void 0===r&&(r=null),i.isSidxRequest)return this.handleSidxRequest(t,i),void this.handlePlaylistLoaded(t,e,i,r);this.resetInternalLoader(i.type);var n=t.data;0===n.indexOf("#EXTM3U")?(e.parsing.start=performance.now(),n.indexOf("#EXTINF:")>0||n.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(t,e,i,r):this.handleMasterPlaylist(t,e,i,r)):this.handleManifestParsingError(t,i,"no EXTM3U delimiter",r)},e.loaderror=function(t,e,i){void 0===i&&(i=null),this.handleNetworkError(e,i,!1,t)},e.loadtimeout=function(t,e,i){void 0===i&&(i=null),this.handleNetworkError(e,i,!0)},e.handleMasterPlaylist=function(t,e,i,r){var s=this.hls,o=t.data,c=h(t,i),d=l.default.parseMasterPlaylist(o,c),f=d.levels,p=d.sessionData;if(f.length){var g=f.map((function(t){return{id:t.attrs.AUDIO,audioCodec:t.audioCodec}})),v=f.map((function(t){return{id:t.attrs.SUBTITLES,textCodec:t.textCodec}})),m=l.default.parseMasterPlaylistMedia(o,c,"AUDIO",g),y=l.default.parseMasterPlaylistMedia(o,c,"SUBTITLES",v),b=l.default.parseMasterPlaylistMedia(o,c,"CLOSED-CAPTIONS");m.length&&(m.some((function(t){return!t.url}))||!f[0].audioCodec||f[0].attrs.AUDIO||(a.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),m.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new u.AttrList({}),bitrate:0,url:""}))),s.trigger(n.Events.MANIFEST_LOADED,{levels:f,audioTracks:m,subtitles:y,captions:b,url:c,stats:e,networkDetails:r,sessionData:p})}else this.handleManifestParsingError(t,i,"no level found in manifest",r)},e.handleTrackOrLevelPlaylist=function(t,e,i,a){var o=this.hls,d=i.id,f=i.level,p=i.type,g=h(t,i),v=Object(r.isFiniteNumber)(d)?d:0,m=Object(r.isFiniteNumber)(f)?f:v,y=function(t){switch(t.type){case c.PlaylistContextType.AUDIO_TRACK:return c.PlaylistLevelType.AUDIO;case c.PlaylistContextType.SUBTITLE_TRACK:return c.PlaylistLevelType.SUBTITLE;default:return c.PlaylistLevelType.MAIN}}(i),b=l.default.parseLevelPlaylist(t.data,g,m,y,v);if(b.fragments.length){if(p===c.PlaylistContextType.MANIFEST){var E={attrs:new u.AttrList({}),bitrate:0,details:b,name:"",url:g};o.trigger(n.Events.MANIFEST_LOADED,{levels:[E],audioTracks:[],url:g,stats:e,networkDetails:a,sessionData:null})}if(e.parsing.end=performance.now(),b.needSidxRanges){var S,C=null===(S=b.fragments[0].initSegment)||void 0===S?void 0:S.url;this.load({url:C,isSidxRequest:!0,type:p,level:f,levelDetails:b,id:d,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null})}else i.levelDetails=b,this.handlePlaylistLoaded(t,e,i,a)}else o.trigger(n.Events.ERROR,{type:s.ErrorTypes.NETWORK_ERROR,details:s.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:g,reason:"no fragments found in level",level:"number"==typeof i.level?i.level:void 0})},e.handleSidxRequest=function(t,e){var i=Object(o.parseSegmentIndex)(new Uint8Array(t.data));if(i){var r=i.references,n=e.levelDetails;r.forEach((function(t,e){var r=t.info,s=n.fragments[e];0===s.byteRange.length&&s.setByteRange(String(1+r.end-r.start)+"@"+String(r.start)),s.initSegment&&s.initSegment.setByteRange(String(i.moovEndOffset)+"@0")}))}},e.handleManifestParsingError=function(t,e,i,r){this.hls.trigger(n.Events.ERROR,{type:s.ErrorTypes.NETWORK_ERROR,details:s.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:e.type===c.PlaylistContextType.MANIFEST,url:t.url,reason:i,response:t,context:e,networkDetails:r})},e.handleNetworkError=function(t,e,i,r){void 0===i&&(i=!1),a.logger.warn("[playlist-loader]: A network "+(i?"timeout":"error")+" occurred while loading "+t.type+" level: "+t.level+" id: "+t.id+' group-id: "'+t.groupId+'"');var o=s.ErrorDetails.UNKNOWN,l=!1,u=this.getInternalLoader(t);switch(t.type){case c.PlaylistContextType.MANIFEST:o=i?s.ErrorDetails.MANIFEST_LOAD_TIMEOUT:s.ErrorDetails.MANIFEST_LOAD_ERROR,l=!0;break;case c.PlaylistContextType.LEVEL:o=i?s.ErrorDetails.LEVEL_LOAD_TIMEOUT:s.ErrorDetails.LEVEL_LOAD_ERROR,l=!1;break;case c.PlaylistContextType.AUDIO_TRACK:o=i?s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case c.PlaylistContextType.SUBTITLE_TRACK:o=i?s.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:s.ErrorDetails.SUBTITLE_LOAD_ERROR,l=!1}u&&this.resetInternalLoader(t.type);var h={type:s.ErrorTypes.NETWORK_ERROR,details:o,fatal:l,url:t.url,loader:u,context:t,networkDetails:e};r&&(h.response=r),this.hls.trigger(n.Events.ERROR,h)},e.handlePlaylistLoaded=function(t,e,i,r){var s=i.type,a=i.level,o=i.id,l=i.groupId,u=i.loader,h=i.levelDetails,d=i.deliveryDirectives;if(null!=h&&h.targetduration){if(u)switch(h.live&&(u.getCacheAge&&(h.ageHeader=u.getCacheAge()||0),u.getCacheAge&&!isNaN(h.ageHeader)||(h.ageHeader=0)),s){case c.PlaylistContextType.MANIFEST:case c.PlaylistContextType.LEVEL:this.hls.trigger(n.Events.LEVEL_LOADED,{details:h,level:a||0,id:o||0,stats:e,networkDetails:r,deliveryDirectives:d});break;case c.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(n.Events.AUDIO_TRACK_LOADED,{details:h,id:o||0,groupId:l||"",stats:e,networkDetails:r,deliveryDirectives:d});break;case c.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(n.Events.SUBTITLE_TRACK_LOADED,{details:h,id:o||0,groupId:l||"",stats:e,networkDetails:r,deliveryDirectives:d})}}else this.handleManifestParsingError(t,i,"invalid target duration",r)},t}();e.default=d},"./src/polyfills/number.ts":
/*!*********************************!*\
!*** ./src/polyfills/number.ts ***!
\*********************************/
/*! exports provided: isFiniteNumber, MAX_SAFE_INTEGER */function(t,e,i){"use strict";i.r(e),i.d(e,"isFiniteNumber",(function(){return r})),i.d(e,"MAX_SAFE_INTEGER",(function(){return n}));var r=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},n=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":
/*!*********************************!*\
!*** ./src/remux/aac-helper.ts ***!
\*********************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e);var r=function(){function t(){}return t.getSilentFrame=function(t,e){switch(t){case"mp4a.40.2":if(1===e)return new Uint8Array([0,200,0,128,35,128]);if(2===e)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===e)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(6===e)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(1===e)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(2===e)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(3===e)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])}},t}();e.default=r},"./src/remux/mp4-generator.ts":
/*!************************************!*\
!*** ./src/remux/mp4-generator.ts ***!
\************************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e);var r=Math.pow(2,32)-1,n=function(){function t(){}return t.init=function(){var e;for(e in t.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:[]},t.types)t.types.hasOwnProperty(e)&&(t.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);var i=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),r=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);t.HDLR_TYPES={video:i,audio:r};var n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),s=new Uint8Array([0,0,0,0,0,0,0,0]);t.STTS=t.STSC=t.STCO=s,t.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),t.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),t.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),t.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var a=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);t.FTYP=t.box(t.types.ftyp,a,l,a,o),t.DINF=t.box(t.types.dinf,t.box(t.types.dref,n))},t.box=function(t){for(var e=8,i=arguments.length,r=new Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];for(var s=r.length,a=s;s--;)e+=r[s].byteLength;var o=new Uint8Array(e);for(o[0]=e>>24&255,o[1]=e>>16&255,o[2]=e>>8&255,o[3]=255&e,o.set(t,4),s=0,e=8;s<a;s++)o.set(r[s],e),e+=r[s].byteLength;return o},t.hdlr=function(e){return t.box(t.types.hdlr,t.HDLR_TYPES[e])},t.mdat=function(e){return t.box(t.types.mdat,e)},t.mdhd=function(e,i){i*=e;var n=Math.floor(i/(r+1)),s=Math.floor(i%(r+1));return t.box(t.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,n>>24,n>>16&255,n>>8&255,255&n,s>>24,s>>16&255,s>>8&255,255&s,85,196,0,0]))},t.mdia=function(e){return t.box(t.types.mdia,t.mdhd(e.timescale,e.duration),t.hdlr(e.type),t.minf(e))},t.mfhd=function(e){return t.box(t.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))},t.minf=function(e){return"audio"===e.type?t.box(t.types.minf,t.box(t.types.smhd,t.SMHD),t.DINF,t.stbl(e)):t.box(t.types.minf,t.box(t.types.vmhd,t.VMHD),t.DINF,t.stbl(e))},t.moof=function(e,i,r){return t.box(t.types.moof,t.mfhd(e),t.traf(r,i))},t.moov=function(e){for(var i=e.length,r=[];i--;)r[i]=t.trak(e[i]);return t.box.apply(null,[t.types.moov,t.mvhd(e[0].timescale,e[0].duration)].concat(r).concat(t.mvex(e)))},t.mvex=function(e){for(var i=e.length,r=[];i--;)r[i]=t.trex(e[i]);return t.box.apply(null,[t.types.mvex].concat(r))},t.mvhd=function(e,i){i*=e;var n=Math.floor(i/(r+1)),s=Math.floor(i%(r+1)),a=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,n>>24,n>>16&255,n>>8&255,255&n,s>>24,s>>16&255,s>>8&255,255&s,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 t.box(t.types.mvhd,a)},t.sdtp=function(e){var i,r,n=e.samples||[],s=new Uint8Array(4+n.length);for(i=0;i<n.length;i++)r=n[i].flags,s[i+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return t.box(t.types.sdtp,s)},t.stbl=function(e){return t.box(t.types.stbl,t.stsd(e),t.box(t.types.stts,t.STTS),t.box(t.types.stsc,t.STSC),t.box(t.types.stsz,t.STSZ),t.box(t.types.stco,t.STCO))},t.avc1=function(e){var i,r,n,s=[],a=[];for(i=0;i<e.sps.length;i++)n=(r=e.sps[i]).byteLength,s.push(n>>>8&255),s.push(255&n),s=s.concat(Array.prototype.slice.call(r));for(i=0;i<e.pps.length;i++)n=(r=e.pps[i]).byteLength,a.push(n>>>8&255),a.push(255&n),a=a.concat(Array.prototype.slice.call(r));var o=t.box(t.types.avcC,new Uint8Array([1,s[3],s[4],s[5],255,224|e.sps.length].concat(s).concat([e.pps.length]).concat(a))),l=e.width,c=e.height,u=e.pixelRatio[0],h=e.pixelRatio[1];return t.box(t.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,l>>8&255,255&l,c>>8&255,255&c,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,t.box(t.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),t.box(t.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,h>>24,h>>16&255,h>>8&255,255&h])))},t.esds=function(t){var e=t.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(t.config).concat([6,1,2]))},t.mp4a=function(e){var i=e.samplerate;return t.box(t.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,i>>8&255,255&i,0,0]),t.box(t.types.esds,t.esds(e)))},t.mp3=function(e){var i=e.samplerate;return t.box(t.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,i>>8&255,255&i,0,0]))},t.stsd=function(e){return"audio"===e.type?e.isAAC||"mp3"!==e.codec?t.box(t.types.stsd,t.STSD,t.mp4a(e)):t.box(t.types.stsd,t.STSD,t.mp3(e)):t.box(t.types.stsd,t.STSD,t.avc1(e))},t.tkhd=function(e){var i=e.id,n=e.duration*e.timescale,s=e.width,a=e.height,o=Math.floor(n/(r+1)),l=Math.floor(n%(r+1));return t.box(t.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,i>>24&255,i>>16&255,i>>8&255,255&i,0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,l>>24,l>>16&255,l>>8&255,255&l,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,s>>8&255,255&s,0,0,a>>8&255,255&a,0,0]))},t.traf=function(e,i){var n=t.sdtp(e),s=e.id,a=Math.floor(i/(r+1)),o=Math.floor(i%(r+1));return t.box(t.types.traf,t.box(t.types.tfhd,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s])),t.box(t.types.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,o>>24,o>>16&255,o>>8&255,255&o])),t.trun(e,n.length+16+20+8+16+8+8),n)},t.trak=function(e){return e.duration=e.duration||4294967295,t.box(t.types.trak,t.tkhd(e),t.mdia(e))},t.trex=function(e){var i=e.id;return t.box(t.types.trex,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},t.trun=function(e,i){var r,n,s,a,o,l,c=e.samples||[],u=c.length,h=12+16*u,d=new Uint8Array(h);for(i+=8+h,d.set([0,0,15,1,u>>>24&255,u>>>16&255,u>>>8&255,255&u,i>>>24&255,i>>>16&255,i>>>8&255,255&i],0),r=0;r<u;r++)s=(n=c[r]).duration,a=n.size,o=n.flags,l=n.cts,d.set([s>>>24&255,s>>>16&255,s>>>8&255,255&s,a>>>24&255,a>>>16&255,a>>>8&255,255&a,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,61440&o.degradPrio,15&o.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*r);return t.box(t.types.trun,d)},t.initSegment=function(e){t.types||t.init();var i=t.moov(e),r=new Uint8Array(t.FTYP.byteLength+i.byteLength);return r.set(t.FTYP),r.set(i,t.FTYP.byteLength),r},t}();n.types=void 0,n.HDLR_TYPES=void 0,n.STTS=void 0,n.STSC=void 0,n.STCO=void 0,n.STSZ=void 0,n.VMHD=void 0,n.SMHD=void 0,n.STSD=void 0,n.FTYP=void 0,n.DINF=void 0,e.default=n},"./src/remux/mp4-remuxer.ts":
/*!**********************************!*\
!*** ./src/remux/mp4-remuxer.ts ***!
\**********************************/
/*! exports provided: default, normalizePts */function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return g})),i.d(e,"normalizePts",(function(){return v}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ./aac-helper */"./src/remux/aac-helper.ts"),s=i(/*! ./mp4-generator */"./src/remux/mp4-generator.ts"),a=i(/*! ../events */"./src/events.ts"),o=i(/*! ../errors */"./src/errors.ts"),l=i(/*! ../utils/logger */"./src/utils/logger.ts"),c=i(/*! ../types/loader */"./src/types/loader.ts"),u=i(/*! ../utils/timescale-conversion */"./src/utils/timescale-conversion.ts");function h(){return(h=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t}).apply(this,arguments)}var d=null,f=null,p=!1,g=function(){function t(t,e,i,r){if(void 0===r&&(r=""),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=t,this.config=e,this.typeSupported=i,this.ISGenerated=!1,null===d){var n=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);d=n?parseInt(n[1]):0}if(null===f){var s=navigator.userAgent.match(/Safari\/(\d+)/i);f=s?parseInt(s[1]):0}p=!!d&&d<75||!!f&&f<600}var e=t.prototype;return e.destroy=function(){},e.resetTimeStamp=function(t){l.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=t},e.resetNextTimestamp=function(){l.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},e.resetInitSegment=function(){l.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},e.getVideoStartPts=function(t){var e=!1,i=t.reduce((function(t,i){var r=i.pts-t;return r<-4294967296?(e=!0,v(t,i.pts)):r>0?t:i.pts}),t[0].pts);return e&&l.logger.debug("PTS rollover detected"),i},e.remux=function(t,e,i,r,n,s,a,o){var u,h,d,f,p,g,m=n,y=n,b=t.pid>-1,E=e.pid>-1,S=e.samples.length,C=t.samples.length>0,k=S>1;if((!b||C)&&(!E||k)||this.ISGenerated||a){this.ISGenerated||(d=this.generateIS(t,e,n));var w=this.isVideoContiguous,x=-1;if(k&&(x=function(t){for(var e=0;e<t.length;e++)if(t[e].key)return e;return-1}(e.samples),!w&&this.config.forceKeyFrameOnDiscontinuity))if(g=!0,x>0){l.logger.warn("[mp4-remuxer]: Dropped "+x+" out of "+S+" video samples due to a missing keyframe");var T=this.getVideoStartPts(e.samples);e.samples=e.samples.slice(x),e.dropped+=x,y+=(e.samples[0].pts-T)/(e.timescale||9e4)}else-1===x&&(l.logger.warn("[mp4-remuxer]: No keyframe found out of "+S+" video samples"),g=!1);if(this.ISGenerated){if(C&&k){var O=this.getVideoStartPts(e.samples),A=(v(t.samples[0].pts,O)-O)/e.inputTimeScale;m+=Math.max(0,A),y+=Math.max(0,-A)}if(C){if(t.samplerate||(l.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),d=this.generateIS(t,e,n)),h=this.remuxAudio(t,m,this.isAudioContiguous,s,E||k||o===c.PlaylistLevelType.AUDIO?y:void 0),k){var L=h?h.endPTS-h.startPTS:0;e.inputTimeScale||(l.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),d=this.generateIS(t,e,n)),u=this.remuxVideo(e,y,w,L)}}else k&&(u=this.remuxVideo(e,y,w,0));u&&(u.firstKeyFrame=x,u.independent=-1!==x)}}return this.ISGenerated&&(i.samples.length&&(p=this.remuxID3(i,n)),r.samples.length&&(f=this.remuxText(r,n))),{audio:h,video:u,initSegment:d,independent:g,text:f,id3:p}},e.generateIS=function(t,e,i){var n,a,o,l=t.samples,c=e.samples,u=this.typeSupported,h={},d=!Object(r.isFiniteNumber)(this._initPTS),f="audio/mp4";if(d&&(n=a=1/0),t.config&&l.length&&(t.timescale=t.samplerate,t.isAAC||(u.mpeg?(f="audio/mpeg",t.codec=""):u.mp3&&(t.codec="mp3")),h.audio={id:"audio",container:f,codec:t.codec,initSegment:!t.isAAC&&u.mpeg?new Uint8Array(0):s.default.initSegment([t]),metadata:{channelCount:t.channelCount}},d&&(o=t.inputTimeScale,n=a=l[0].pts-Math.round(o*i))),e.sps&&e.pps&&c.length&&(e.timescale=e.inputTimeScale,h.video={id:"main",container:"video/mp4",codec:e.codec,initSegment:s.default.initSegment([e]),metadata:{width:e.width,height:e.height}},d)){o=e.inputTimeScale;var p=this.getVideoStartPts(c),g=Math.round(o*i);a=Math.min(a,v(c[0].dts,p)-g),n=Math.min(n,p-g)}if(Object.keys(h).length)return this.ISGenerated=!0,d&&(this._initPTS=n,this._initDTS=a),{tracks:h,initPTS:n,timescale:o}},e.remuxVideo=function(t,e,i,r){var n,c,f,g=t.inputTimeScale,y=t.samples,b=[],E=y.length,S=this._initPTS,C=this.nextAvcDts,k=8,w=Number.POSITIVE_INFINITY,x=Number.NEGATIVE_INFINITY,T=0,O=!1;i&&null!==C||(C=e*g-(y[0].pts-v(y[0].dts,y[0].pts)));for(var A=0;A<E;A++){var L=y[A];L.pts=v(L.pts-S,C),L.dts=v(L.dts-S,C),L.dts>L.pts&&(T=Math.max(Math.min(T,L.pts-L.dts),-18e3)),L.dts<y[A>0?A-1:A].dts&&(O=!0)}O&&y.sort((function(t,e){var i=t.dts-e.dts,r=t.pts-e.pts;return i||r})),c=y[0].dts,f=y[y.length-1].dts;var R=Math.round((f-c)/(E-1));if(T<0){if(T<-2*R){l.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(u.toMsFromMpegTsClock)(-R,!0)+" ms");for(var _=T,D=0;D<E;D++)y[D].dts=_=Math.max(_,y[D].pts-R),y[D].pts=Math.max(_,y[D].pts)}else{l.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(u.toMsFromMpegTsClock)(T,!0)+" ms to overcome this issue");for(var I=0;I<E;I++)y[I].dts=y[I].dts+T}c=y[0].dts}if(i){var M=c-C,P=M>R;if(P||M<-1){P?l.logger.warn("AVC: "+Object(u.toMsFromMpegTsClock)(M,!0)+" ms ("+M+"dts) hole between fragments detected, filling it"):l.logger.warn("AVC: "+Object(u.toMsFromMpegTsClock)(-M,!0)+" ms ("+M+"dts) overlapping between fragments detected"),c=C;var N=y[0].pts-M;y[0].dts=c,y[0].pts=N,l.logger.log("Video: First PTS/DTS adjusted: "+Object(u.toMsFromMpegTsClock)(N,!0)+"/"+Object(u.toMsFromMpegTsClock)(c,!0)+", delta: "+Object(u.toMsFromMpegTsClock)(M,!0)+" ms")}}p&&(c=Math.max(0,c));for(var j=0,B=0,F=0;F<E;F++){for(var U=y[F],G=U.units,H=G.length,z=0,V=0;V<H;V++)z+=G[V].data.length;B+=z,j+=H,U.length=z,U.dts=Math.max(U.dts,c),U.pts=Math.max(U.pts,U.dts,0),w=Math.min(U.pts,w),x=Math.max(U.pts,x)}f=y[E-1].dts;var K,W=B+4*j+8;try{K=new Uint8Array(W)}catch(t){return void this.observer.emit(a.Events.ERROR,a.Events.ERROR,{type:o.ErrorTypes.MUX_ERROR,details:o.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:W,reason:"fail allocating video mdat "+W})}var Y=new DataView(K.buffer);Y.setUint32(0,W),K.set(s.default.types.mdat,4);for(var X=0;X<E;X++){for(var q=y[X],$=q.units,J=0,Q=0,Z=$.length;Q<Z;Q++){var tt=$[Q],et=tt.data,it=tt.data.byteLength;Y.setUint32(k,it),k+=4,K.set(et,k),k+=it,J+=4+it}if(X<E-1)n=y[X+1].dts-q.dts;else{var rt=this.config,nt=q.dts-y[X>0?X-1:X].dts;if(rt.stretchShortVideoTrack&&null!==this.nextAudioPts){var st=Math.floor(rt.maxBufferHole*g),at=(r?w+r*g:this.nextAudioPts)-q.pts;at>st?((n=at-nt)<0&&(n=nt),l.logger.log("[mp4-remuxer]: It is approximately "+at/90+" ms to the next segment; using duration "+n/90+" ms for the last video frame.")):n=nt}else n=nt}var ot=Math.round(q.pts-q.dts);b.push(new m(q.key,n,J,ot))}if(b.length&&d&&d<70){var lt=b[0].flags;lt.dependsOn=2,lt.isNonSync=0}console.assert(void 0!==n,"mp4SampleDuration must be computed"),this.nextAvcDts=C=f+n,this.isVideoContiguous=!0;var ct={data1:s.default.moof(t.sequenceNumber++,c,h({},t,{samples:b})),data2:K,startPTS:w/g,endPTS:(x+n)/g,startDTS:c/g,endDTS:C/g,type:"video",hasAudio:!1,hasVideo:!0,nb:b.length,dropped:t.dropped};return t.samples=[],t.dropped=0,console.assert(K.length,"MDAT length must not be zero"),ct},e.remuxAudio=function(t,e,i,r,c){var u=t.inputTimeScale,d=u/(t.samplerate?t.samplerate:u),f=t.isAAC?1024:1152,p=f*d,g=this._initPTS,y=!t.isAAC&&this.typeSupported.mpeg,b=[],E=t.samples,S=y?0:8,C=this.nextAudioPts||-1,k=e*u;if(this.isAudioContiguous=i=i||E.length&&C>0&&(r&&Math.abs(k-C)<9e3||Math.abs(v(E[0].pts-g,k)-C)<20*p),E.forEach((function(t){t.pts=v(t.pts-g,k)})),!i||C<0){if(!(E=E.filter((function(t){return t.pts>=0}))).length)return;C=0===c?0:r?Math.max(0,k):E[0].pts}if(t.isAAC)for(var w=void 0!==c,x=this.config.maxAudioFramesDrift,T=0,O=C;T<E.length;T++){var A=E[T],L=A.pts,R=L-O,_=Math.abs(1e3*R/u);if(R<=-x*p&&w)0===T&&(l.logger.warn("Audio frame @ "+(L/u).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*R/u)+" ms."),this.nextAudioPts=C=O=L);else if(R>=x*p&&_<1e4&&w){var D=Math.round(R/p);(O=L-D*p)<0&&(D--,O+=p),0===T&&(this.nextAudioPts=C=O),l.logger.warn("[mp4-remuxer]: Injecting "+D+" audio frame @ "+(O/u).toFixed(3)+"s due to "+Math.round(1e3*R/u)+" ms gap.");for(var I=0;I<D;I++){var M=Math.max(O,0),P=n.default.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);P||(l.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),P=A.unit.subarray()),E.splice(T,0,{unit:P,pts:M}),O+=p,T++}}A.pts=O,O+=p}for(var N,j=null,B=null,F=0,U=E.length;U--;)F+=E[U].unit.byteLength;for(var G=0,H=E.length;G<H;G++){var z=E[G],V=z.unit,K=z.pts;if(null!==B)b[G-1].duration=Math.round((K-B)/d);else{if(i&&t.isAAC&&(K=C),j=K,!(F>0))return;F+=S;try{N=new Uint8Array(F)}catch(t){return void this.observer.emit(a.Events.ERROR,a.Events.ERROR,{type:o.ErrorTypes.MUX_ERROR,details:o.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:F,reason:"fail allocating audio mdat "+F})}y||(new DataView(N.buffer).setUint32(0,F),N.set(s.default.types.mdat,4))}N.set(V,S);var W=V.byteLength;S+=W,b.push(new m(!0,f,W,0)),B=K}var Y=b.length;if(Y){var X=b[b.length-1];this.nextAudioPts=C=B+d*X.duration;var q=y?new Uint8Array(0):s.default.moof(t.sequenceNumber++,j/d,h({},t,{samples:b}));t.samples=[];var $=j/u,J=C/u,Q={data1:q,data2:N,startPTS:$,endPTS:J,startDTS:$,endDTS:J,type:"audio",hasAudio:!0,hasVideo:!1,nb:Y};return this.isAudioContiguous=!0,console.assert(N.length,"MDAT length must not be zero"),Q}},e.remuxEmptyAudio=function(t,e,i,r){var s=t.inputTimeScale,a=s/(t.samplerate?t.samplerate:s),o=this.nextAudioPts,c=(null!==o?o:r.startDTS*s)+this._initDTS,u=r.endDTS*s+this._initDTS,h=1024*a,d=Math.ceil((u-c)/h),f=n.default.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);if(l.logger.warn("[mp4-remuxer]: remux empty Audio"),f){for(var p=[],g=0;g<d;g++){var v=c+g*h;p.push({unit:f,pts:v,dts:v})}return t.samples=p,this.remuxAudio(t,e,i,!1)}l.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},e.remuxID3=function(t,e){var i=t.samples.length;if(i){for(var r=t.inputTimeScale,n=this._initPTS,s=this._initDTS,a=0;a<i;a++){var o=t.samples[a];o.pts=v(o.pts-n,e*r)/r,o.dts=v(o.dts-s,e*r)/r}var l=t.samples;return t.samples=[],{samples:l}}},e.remuxText=function(t,e){var i=t.samples.length;if(i){for(var r=t.inputTimeScale,n=this._initPTS,s=0;s<i;s++){var a=t.samples[s];a.pts=v(a.pts-n,e*r)/r}t.samples.sort((function(t,e){return t.pts-e.pts}));var o=t.samples;return t.samples=[],{samples:o}}},t}();function v(t,e){var i;if(null===e)return t;for(i=e<t?-8589934592:8589934592;Math.abs(t-e)>4294967296;)t+=i;return t}var m=function(t,e,i,r){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=e,this.size=i,this.cts=r,this.flags=new y(t)},y=function(t){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=t?2:1,this.isNonSync=t?0:1}},"./src/remux/passthrough-remuxer.ts":
/*!******************************************!*\
!*** ./src/remux/passthrough-remuxer.ts ***!
\******************************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e);var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),s=i(/*! ../loader/fragment */"./src/loader/fragment.ts"),a=i(/*! ../utils/logger */"./src/utils/logger.ts"),o=function(){function t(){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 e=t.prototype;return e.destroy=function(){},e.resetTimeStamp=function(t){this.initPTS=t,this.lastEndDTS=null},e.resetNextTimestamp=function(){this.lastEndDTS=null},e.resetInitSegment=function(t,e,i){this.audioCodec=e,this.videoCodec=i,this.generateInitSegment(t),this.emitInitSegment=!0},e.generateInitSegment=function(t){var e=this.audioCodec,i=this.videoCodec;if(!t||!t.byteLength)return this.initTracks=void 0,void(this.initData=void 0);var r=this.initData=Object(n.parseInitSegment)(t);e||(e=c(r.audio,s.ElementaryStreamTypes.AUDIO)),i||(i=c(r.video,s.ElementaryStreamTypes.VIDEO));var o={};r.audio&&r.video?o.audiovideo={container:"video/mp4",codec:e+","+i,initSegment:t,id:"main"}:r.audio?o.audio={container:"audio/mp4",codec:e,initSegment:t,id:"audio"}:r.video?o.video={container:"video/mp4",codec:i,initSegment:t,id:"main"}:a.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},e.remux=function(t,e,i,s,o){var c=this.initPTS,u=this.lastEndDTS,h={audio:void 0,video:void 0,text:s,id3:i,initSegment:void 0};Object(r.isFiniteNumber)(u)||(u=this.lastEndDTS=o||0);var d=e.samples;if(!d||!d.length)return h;var f={initPTS:void 0,timescale:1},p=this.initData;if(p&&p.length||(this.generateInitSegment(d),p=this.initData),!p||!p.length)return a.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),h;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1),Object(r.isFiniteNumber)(c)||(this.initPTS=f.initPTS=c=l(p,d,u));var g=Object(n.getDuration)(d,p),v=u,m=g+v;Object(n.offsetStartDTS)(p,d,c),g>0?this.lastEndDTS=m:(a.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var y=!!p.audio,b=!!p.video,E="";y&&(E+="audio"),b&&(E+="video");var S={data1:d,startPTS:v,startDTS:v,endPTS:m,endDTS:m,type:E,hasAudio:y,hasVideo:b,nb:1,dropped:0};return h.audio="audio"===S.type?S:void 0,h.video="audio"!==S.type?S:void 0,h.text=s,h.id3=i,h.initSegment=f,h},t}(),l=function(t,e,i){return Object(n.getStartDTS)(t,e)-i};function c(t,e){var i=null==t?void 0:t.codec;return i&&i.length>4?i:"hvc1"===i?"hvc1.1.c.L120.90":"av01"===i?"av01.0.04M.08":"avc1"===i||e===s.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}e.default=o},"./src/task-loop.ts":
/*!**************************!*\
!*** ./src/task-loop.ts ***!
\**************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return r}));var r=function(){function t(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var e=t.prototype;return e.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},e.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},e.onHandlerDestroyed=function(){},e.hasInterval=function(){return!!this._tickInterval},e.hasNextTick=function(){return!!this._tickTimer},e.setInterval=function(t){return!this._tickInterval&&(this._tickInterval=self.setInterval(this._boundTick,t),!0)},e.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},e.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},e.tick=function(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},e.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},e.doTick=function(){},t}()},"./src/types/cmcd.ts":
/*!***************************!*\
!*** ./src/types/cmcd.ts ***!
\***************************/
/*! exports provided: CMCDVersion, CMCDObjectType, CMCDStreamingFormat, CMCDStreamType */function(t,e,i){"use strict";i.r(e),i.d(e,"CMCDVersion",(function(){return a})),i.d(e,"CMCDObjectType",(function(){return r})),i.d(e,"CMCDStreamingFormat",(function(){return n})),i.d(e,"CMCDStreamType",(function(){return s}));var r,n,s,a=1;!function(t){t.MANIFEST="m",t.AUDIO="a",t.VIDEO="v",t.MUXED="av",t.INIT="i",t.CAPTION="c",t.TIMED_TEXT="tt",t.KEY="k",t.OTHER="o"}(r||(r={})),function(t){t.DASH="d",t.HLS="h",t.SMOOTH="s",t.OTHER="o"}(n||(n={})),function(t){t.VOD="v",t.LIVE="l"}(s||(s={}))},"./src/types/level.ts":
/*!****************************!*\
!*** ./src/types/level.ts ***!
\****************************/
/*! exports provided: HlsSkip, getSkipValue, HlsUrlParameters, Level */function(t,e,i){"use strict";function r(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var n;function s(t,e){var i=t.canSkipUntil,r=t.canSkipDateRanges,s=t.endSN;return i&&(void 0!==e?e-s:0)<i?r?n.v2:n.Yes:n.No}i.r(e),i.d(e,"HlsSkip",(function(){return n})),i.d(e,"getSkipValue",(function(){return s})),i.d(e,"HlsUrlParameters",(function(){return a})),i.d(e,"Level",(function(){return o})),function(t){t.No="",t.Yes="YES",t.v2="v2"}(n||(n={}));var a=function(){function t(t,e,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=t,this.part=e,this.skip=i}return t.prototype.addDirectives=function(t){var e=new self.URL(t);return void 0!==this.msn&&e.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&e.searchParams.set("_HLS_part",this.part.toString()),this.skip&&e.searchParams.set("_HLS_skip",this.skip),e.toString()},t}(),o=function(){function t(t){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=[t.url],this.attrs=t.attrs,this.bitrate=t.bitrate,t.details&&(this.details=t.details),this.id=t.id||0,this.name=t.name,this.width=t.width||0,this.height=t.height||0,this.audioCodec=t.audioCodec,this.videoCodec=t.videoCodec,this.unknownCodecs=t.unknownCodecs,this.codecSet=[t.videoCodec,t.audioCodec].filter((function(t){return t})).join(",").replace(/\.[^.,]+/g,"")}var e,i,n;return e=t,(i=[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(t){var e=t%this.url.length;this._urlId!==e&&(this.details=void 0,this._urlId=e)}}])&&r(e.prototype,i),n&&r(e,n),t}()},"./src/types/loader.ts":
/*!*****************************!*\
!*** ./src/types/loader.ts ***!
\*****************************/
/*! exports provided: PlaylistContextType, PlaylistLevelType */function(t,e,i){"use strict";var r,n;i.r(e),i.d(e,"PlaylistContextType",(function(){return r})),i.d(e,"PlaylistLevelType",(function(){return n})),function(t){t.MANIFEST="manifest",t.LEVEL="level",t.AUDIO_TRACK="audioTrack",t.SUBTITLE_TRACK="subtitleTrack"}(r||(r={})),function(t){t.MAIN="main",t.AUDIO="audio",t.SUBTITLE="subtitle"}(n||(n={}))},"./src/types/transmuxer.ts":
/*!*********************************!*\
!*** ./src/types/transmuxer.ts ***!
\*********************************/
/*! exports provided: ChunkMetadata */function(t,e,i){"use strict";i.r(e),i.d(e,"ChunkMetadata",(function(){return r}));var r=function(t,e,i,r,n,s){void 0===r&&(r=0),void 0===n&&(n=-1),void 0===s&&(s=!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={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=t,this.sn=e,this.id=i,this.size=r,this.part=n,this.partial=s}},"./src/utils/attr-list.ts":
/*!********************************!*\
!*** ./src/utils/attr-list.ts ***!
\********************************/
/*! exports provided: AttrList */function(t,e,i){"use strict";i.r(e),i.d(e,"AttrList",(function(){return s}));var r=/^(\d+)x(\d+)$/,n=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,s=function(){function t(e){for(var i in"string"==typeof e&&(e=t.parseAttrList(e)),e)e.hasOwnProperty(i)&&(this[i]=e[i])}var e=t.prototype;return e.decimalInteger=function(t){var e=parseInt(this[t],10);return e>Number.MAX_SAFE_INTEGER?1/0:e},e.hexadecimalInteger=function(t){if(this[t]){var e=(this[t]||"0x").slice(2);e=(1&e.length?"0":"")+e;for(var i=new Uint8Array(e.length/2),r=0;r<e.length/2;r++)i[r]=parseInt(e.slice(2*r,2*r+2),16);return i}return null},e.hexadecimalIntegerAsNumber=function(t){var e=parseInt(this[t],16);return e>Number.MAX_SAFE_INTEGER?1/0:e},e.decimalFloatingPoint=function(t){return parseFloat(this[t])},e.optionalFloat=function(t,e){var i=this[t];return i?parseFloat(i):e},e.enumeratedString=function(t){return this[t]},e.bool=function(t){return"YES"===this[t]},e.decimalResolution=function(t){var e=r.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}},t.parseAttrList=function(t){var e,i={};for(n.lastIndex=0;null!==(e=n.exec(t));){var r=e[2];0===r.indexOf('"')&&r.lastIndexOf('"')===r.length-1&&(r=r.slice(1,-1)),i[e[1]]=r}return i},t}()},"./src/utils/binary-search.ts":
/*!************************************!*\
!*** ./src/utils/binary-search.ts ***!
\************************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e),e.default={search:function(t,e){for(var i=0,r=t.length-1,n=null,s=null;i<=r;){var a=e(s=t[n=(i+r)/2|0]);if(a>0)i=n+1;else{if(!(a<0))return s;r=n-1}}return null}}},"./src/utils/buffer-helper.ts":
/*!************************************!*\
!*** ./src/utils/buffer-helper.ts ***!
\************************************/
/*! exports provided: BufferHelper */function(t,e,i){"use strict";i.r(e),i.d(e,"BufferHelper",(function(){return s}));var r=i(/*! ./logger */"./src/utils/logger.ts"),n={length:0,start:function(){return 0},end:function(){return 0}},s=function(){function t(){}return t.isBuffered=function(e,i){try{if(e)for(var r=t.getBuffered(e),n=0;n<r.length;n++)if(i>=r.start(n)&&i<=r.end(n))return!0}catch(t){}return!1},t.bufferInfo=function(e,i,r){try{if(e){var n,s=t.getBuffered(e),a=[];for(n=0;n<s.length;n++)a.push({start:s.start(n),end:s.end(n)});return this.bufferedInfo(a,i,r)}}catch(t){}return{len:0,start:i,end:i,nextStart:void 0}},t.bufferedInfo=function(t,e,i){e=Math.max(0,e),t.sort((function(t,e){var i=t.start-e.start;return i||e.end-t.end}));var r=[];if(i)for(var n=0;n<t.length;n++){var s=r.length;if(s){var a=r[s-1].end;t[n].start-a<i?t[n].end>a&&(r[s-1].end=t[n].end):r.push(t[n])}else r.push(t[n])}else r=t;for(var o,l=0,c=e,u=e,h=0;h<r.length;h++){var d=r[h].start,f=r[h].end;if(e+i>=d&&e<f)c=d,l=(u=f)-e;else if(e+i<d){o=d;break}}return{len:l,start:c||0,end:u||0,nextStart:o}},t.getBuffered=function(t){try{return t.buffered}catch(t){return r.logger.log("failed to get media.buffered",t),n}},t}()},"./src/utils/cea-608-parser.ts":
/*!*************************************!*\
!*** ./src/utils/cea-608-parser.ts ***!
\*************************************/
/*! exports provided: Row, CaptionScreen, default */function(t,e,i){"use strict";i.r(e),i.d(e,"Row",(function(){return v})),i.d(e,"CaptionScreen",(function(){return m}));var r,n=i(/*! ../utils/logger */"./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},a=function(t){var e=t;return s.hasOwnProperty(t)&&(e=s[t]),String.fromCharCode(e)},o={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},l={17:2,18:4,21:6,22:8,23:10,19:13,20:15},c={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},u={25:2,26:4,29:6,30:8,31:10,27:13,28:15},h=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];!function(t){t[t.ERROR=0]="ERROR",t[t.TEXT=1]="TEXT",t[t.WARNING=2]="WARNING",t[t.INFO=2]="INFO",t[t.DEBUG=3]="DEBUG",t[t.DATA=3]="DATA"}(r||(r={}));var d=function(){function t(){this.time=null,this.verboseLevel=r.ERROR}return t.prototype.log=function(t,e){this.verboseLevel>=t&&n.logger.log(this.time+" ["+t+"] "+e)},t}(),f=function(t){for(var e=[],i=0;i<t.length;i++)e.push(t[i].toString(16));return e},p=function(){function t(t,e,i,r,n){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=t||"white",this.underline=e||!1,this.italics=i||!1,this.background=r||"black",this.flash=n||!1}var e=t.prototype;return e.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},e.setStyles=function(t){for(var e=["foreground","underline","italics","background","flash"],i=0;i<e.length;i++){var r=e[i];t.hasOwnProperty(r)&&(this[r]=t[r])}},e.isDefault=function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash},e.equals=function(t){return this.foreground===t.foreground&&this.underline===t.underline&&this.italics===t.italics&&this.background===t.background&&this.flash===t.flash},e.copy=function(t){this.foreground=t.foreground,this.underline=t.underline,this.italics=t.italics,this.background=t.background,this.flash=t.flash},e.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},t}(),g=function(){function t(t,e,i,r,n,s){this.uchar=void 0,this.penState=void 0,this.uchar=t||" ",this.penState=new p(e,i,r,n,s)}var e=t.prototype;return e.reset=function(){this.uchar=" ",this.penState.reset()},e.setChar=function(t,e){this.uchar=t,this.penState.copy(e)},e.setPenState=function(t){this.penState.copy(t)},e.equals=function(t){return this.uchar===t.uchar&&this.penState.equals(t.penState)},e.copy=function(t){this.uchar=t.uchar,this.penState.copy(t.penState)},e.isEmpty=function(){return" "===this.uchar&&this.penState.isDefault()},t}(),v=function(){function t(t){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var e=0;e<100;e++)this.chars.push(new g);this.logger=t,this.pos=0,this.currPenState=new p}var e=t.prototype;return e.equals=function(t){for(var e=!0,i=0;i<100;i++)if(!this.chars[i].equals(t.chars[i])){e=!1;break}return e},e.copy=function(t){for(var e=0;e<100;e++)this.chars[e].copy(t.chars[e])},e.isEmpty=function(){for(var t=!0,e=0;e<100;e++)if(!this.chars[e].isEmpty()){t=!1;break}return t},e.setCursor=function(t){this.pos!==t&&(this.pos=t),this.pos<0?(this.logger.log(r.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>100&&(this.logger.log(r.DEBUG,"Too large cursor position "+this.pos),this.pos=100)},e.moveCursor=function(t){var e=this.pos+t;if(t>1)for(var i=this.pos+1;i<e+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(e)},e.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},e.insertChar=function(t){t>=144&&this.backSpace();var e=a(t);this.pos>=100?this.logger.log(r.ERROR,"Cannot insert "+t.toString(16)+" ("+e+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(e,this.currPenState),this.moveCursor(1))},e.clearFromPos=function(t){var e;for(e=t;e<100;e++)this.chars[e].reset()},e.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},e.clearToEndOfRow=function(){this.clearFromPos(this.pos)},e.getTextString=function(){for(var t=[],e=!0,i=0;i<100;i++){var r=this.chars[i].uchar;" "!==r&&(e=!1),t.push(r)}return e?"":t.join("")},e.setPenStyles=function(t){this.currPenState.setStyles(t),this.chars[this.pos].setPenState(this.currPenState)},t}(),m=function(){function t(t){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var e=0;e<15;e++)this.rows.push(new v(t));this.logger=t,this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var e=t.prototype;return e.reset=function(){for(var t=0;t<15;t++)this.rows[t].clear();this.currRow=14},e.equals=function(t){for(var e=!0,i=0;i<15;i++)if(!this.rows[i].equals(t.rows[i])){e=!1;break}return e},e.copy=function(t){for(var e=0;e<15;e++)this.rows[e].copy(t.rows[e])},e.isEmpty=function(){for(var t=!0,e=0;e<15;e++)if(!this.rows[e].isEmpty()){t=!1;break}return t},e.backSpace=function(){this.rows[this.currRow].backSpace()},e.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},e.insertChar=function(t){this.rows[this.currRow].insertChar(t)},e.setPen=function(t){this.rows[this.currRow].setPenStyles(t)},e.moveCursor=function(t){this.rows[this.currRow].moveCursor(t)},e.setCursor=function(t){this.logger.log(r.INFO,"setCursor: "+t),this.rows[this.currRow].setCursor(t)},e.setPAC=function(t){this.logger.log(r.INFO,"pacData = "+JSON.stringify(t));var e=t.row-1;if(this.nrRollUpRows&&e<this.nrRollUpRows-1&&(e=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==e){for(var i=0;i<15;i++)this.rows[i].clear();var n=this.currRow+1-this.nrRollUpRows,s=this.lastOutputScreen;if(s){var a=s.rows[n].cueStartTime,o=this.logger.time;if(a&&null!==o&&a<o)for(var l=0;l<this.nrRollUpRows;l++)this.rows[e-this.nrRollUpRows+l+1].copy(s.rows[n+l])}}this.currRow=e;var c=this.rows[this.currRow];if(null!==t.indent){var u=t.indent,h=Math.max(u-1,0);c.setCursor(t.indent),t.color=c.chars[h].penState.foreground}var d={foreground:t.color,underline:t.underline,italics:t.italics,background:"black",flash:!1};this.setPen(d)},e.setBkgData=function(t){this.logger.log(r.INFO,"bkgData = "+JSON.stringify(t)),this.backSpace(),this.setPen(t),this.insertChar(32)},e.setRollUpRows=function(t){this.nrRollUpRows=t},e.rollUp=function(){if(null!==this.nrRollUpRows){this.logger.log(r.TEXT,this.getDisplayText());var t=this.currRow+1-this.nrRollUpRows,e=this.rows.splice(t,1)[0];e.clear(),this.rows.splice(this.currRow,0,e),this.logger.log(r.INFO,"Rolling up")}else this.logger.log(r.DEBUG,"roll_up but nrRollUpRows not set yet")},e.getDisplayText=function(t){t=t||!1;for(var e=[],i="",r=-1,n=0;n<15;n++){var s=this.rows[n].getTextString();s&&(r=n+1,t?e.push("Row "+r+": '"+s+"'"):e.push(s.trim()))}return e.length>0&&(i=t?"["+e.join(" | ")+"]":e.join("\n")),i},e.getTextAndFormat=function(){return this.rows},t}(),y=function(){function t(t,e,i){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=t,this.outputFilter=e,this.mode=null,this.verbose=0,this.displayedMemory=new m(i),this.nonDisplayedMemory=new m(i),this.lastOutputScreen=new m(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}var e=t.prototype;return e.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},e.getHandler=function(){return this.outputFilter},e.setHandler=function(t){this.outputFilter=t},e.setPAC=function(t){this.writeScreen.setPAC(t)},e.setBkgData=function(t){this.writeScreen.setBkgData(t)},e.setMode=function(t){t!==this.mode&&(this.mode=t,this.logger.log(r.INFO,"MODE="+t),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=t)},e.insertChars=function(t){for(var e=0;e<t.length;e++)this.writeScreen.insertChar(t[e]);var i=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(r.INFO,i+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(r.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},e.ccRCL=function(){this.logger.log(r.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},e.ccBS=function(){this.logger.log(r.INFO,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},e.ccAOF=function(){},e.ccAON=function(){},e.ccDER=function(){this.logger.log(r.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},e.ccRU=function(t){this.logger.log(r.INFO,"RU("+t+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(t)},e.ccFON=function(){this.logger.log(r.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},e.ccRDC=function(){this.logger.log(r.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},e.ccTR=function(){this.logger.log(r.INFO,"TR"),this.setMode("MODE_TEXT")},e.ccRTD=function(){this.logger.log(r.INFO,"RTD"),this.setMode("MODE_TEXT")},e.ccEDM=function(){this.logger.log(r.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},e.ccCR=function(){this.logger.log(r.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},e.ccENM=function(){this.logger.log(r.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},e.ccEOC=function(){if(this.logger.log(r.INFO,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){var t=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=t,this.writeScreen=this.nonDisplayedMemory,this.logger.log(r.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},e.ccTO=function(t){this.logger.log(r.INFO,"TO("+t+") - Tab Offset"),this.writeScreen.moveCursor(t)},e.ccMIDROW=function(t){var e={flash:!1};if(e.underline=t%2==1,e.italics=t>=46,e.italics)e.foreground="white";else{var i=Math.floor(t/2)-16;e.foreground=["white","green","blue","cyan","red","yellow","magenta"][i]}this.logger.log(r.INFO,"MIDROW: "+JSON.stringify(e)),this.writeScreen.setPen(e)},e.outputDataUpdate=function(t){void 0===t&&(t=!1);var e=this.logger.time;null!==e&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,e,this.lastOutputScreen),t&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:e):this.cueStartTime=e,this.lastOutputScreen.copy(this.displayedMemory))},e.cueSplitAtTime=function(t){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,t,this.displayedMemory),this.cueStartTime=t))},t}(),b=function(){function t(t,e,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var r=new d;this.channels=[null,new y(t,e,r),new y(t+1,i,r)],this.cmdHistory={a:null,b:null},this.logger=r}var e=t.prototype;return e.getHandler=function(t){return this.channels[t].getHandler()},e.setHandler=function(t,e){this.channels[t].setHandler(e)},e.addData=function(t,e){var i,n,s,a=!1;this.logger.time=t;for(var o=0;o<e.length;o+=2)if(n=127&e[o],s=127&e[o+1],0!==n||0!==s){if(this.logger.log(r.DATA,"["+f([e[o],e[o+1]])+"] -> ("+f([n,s])+")"),(i=this.parseCmd(n,s))||(i=this.parseMidrow(n,s)),i||(i=this.parsePAC(n,s)),i||(i=this.parseBackgroundAttributes(n,s)),!i&&(a=this.parseChars(n,s))){var l=this.currentChannel;l&&l>0?this.channels[l].insertChars(a):this.logger.log(r.WARNING,"No channel found yet. TEXT-MODE?")}i||a||this.logger.log(r.WARNING,"Couldn't parse cleaned data "+f([n,s])+" orig: "+f([e[o],e[o+1]]))}},e.parseCmd=function(t,e){var i=this.cmdHistory;if(!((20===t||28===t||21===t||29===t)&&e>=32&&e<=47||(23===t||31===t)&&e>=33&&e<=35))return!1;if(S(t,e,i))return E(null,null,i),this.logger.log(r.DEBUG,"Repeated command ("+f([t,e])+") is dropped"),!0;var n=20===t||21===t||23===t?1:2,s=this.channels[n];return 20===t||21===t||28===t||29===t?32===e?s.ccRCL():33===e?s.ccBS():34===e?s.ccAOF():35===e?s.ccAON():36===e?s.ccDER():37===e?s.ccRU(2):38===e?s.ccRU(3):39===e?s.ccRU(4):40===e?s.ccFON():41===e?s.ccRDC():42===e?s.ccTR():43===e?s.ccRTD():44===e?s.ccEDM():45===e?s.ccCR():46===e?s.ccENM():47===e&&s.ccEOC():s.ccTO(e-32),E(t,e,i),this.currentChannel=n,!0},e.parseMidrow=function(t,e){var i=0;if((17===t||25===t)&&e>=32&&e<=47){if((i=17===t?1:2)!==this.currentChannel)return this.logger.log(r.ERROR,"Mismatch channel in midrow parsing"),!1;var n=this.channels[i];return!!n&&(n.ccMIDROW(e),this.logger.log(r.DEBUG,"MIDROW ("+f([t,e])+")"),!0)}return!1},e.parsePAC=function(t,e){var i,r=this.cmdHistory;if(!((t>=17&&t<=23||t>=25&&t<=31)&&e>=64&&e<=127||(16===t||24===t)&&e>=64&&e<=95))return!1;if(S(t,e,r))return E(null,null,r),!0;var n=t<=23?1:2;i=e>=64&&e<=95?1===n?o[t]:c[t]:1===n?l[t]:u[t];var s=this.channels[n];return!!s&&(s.setPAC(this.interpretPAC(i,e)),E(t,e,r),this.currentChannel=n,!0)},e.interpretPAC=function(t,e){var i,r={color:null,italics:!1,indent:null,underline:!1,row:t};return i=e>95?e-96:e-64,r.underline=1==(1&i),i<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(r.italics=!0,r.color="white"):r.indent=4*Math.floor((i-16)/2),r},e.parseChars=function(t,e){var i,n,s=null,o=null;if(t>=25?(i=2,o=t-8):(i=1,o=t),o>=17&&o<=19?(n=17===o?e+80:18===o?e+112:e+144,this.logger.log(r.INFO,"Special char '"+a(n)+"' in channel "+i),s=[n]):t>=32&&t<=127&&(s=0===e?[t]:[t,e]),s){var l=f(s);this.logger.log(r.DEBUG,"Char codes = "+l.join(",")),E(t,e,this.cmdHistory)}return s},e.parseBackgroundAttributes=function(t,e){var i;if(!((16===t||24===t)&&e>=32&&e<=47||(23===t||31===t)&&e>=45&&e<=47))return!1;var r={};16===t||24===t?(i=Math.floor((e-32)/2),r.background=h[i],e%2==1&&(r.background=r.background+"_semi")):45===e?r.background="transparent":(r.foreground="black",47===e&&(r.underline=!0));var n=t<=23?1:2;return this.channels[n].setBkgData(r),E(t,e,this.cmdHistory),!0},e.reset=function(){for(var t=0;t<Object.keys(this.channels).length;t++){var e=this.channels[t];e&&e.reset()}this.cmdHistory={a:null,b:null}},e.cueSplitAtTime=function(t){for(var e=0;e<this.channels.length;e++){var i=this.channels[e];i&&i.cueSplitAtTime(t)}},t}();function E(t,e,i){i.a=t,i.b=e}function S(t,e,i){return i.a===t&&i.b===e}e.default=b},"./src/utils/codecs.ts":
/*!*****************************!*\
!*** ./src/utils/codecs.ts ***!
\*****************************/
/*! exports provided: isCodecType, isCodecSupportedInMp4 */function(t,e,i){"use strict";i.r(e),i.d(e,"isCodecType",(function(){return n})),i.d(e,"isCodecSupportedInMp4",(function(){return s}));var r={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 n(t,e){var i=r[e];return!!i&&!0===i[t.slice(0,4)]}function s(t,e){return MediaSource.isTypeSupported((e||"video")+'/mp4;codecs="'+t+'"')}},"./src/utils/cues.ts":
/*!***************************!*\
!*** ./src/utils/cues.ts ***!
\***************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e);var r=i(/*! ./vttparser */"./src/utils/vttparser.ts"),n=i(/*! ./webvtt-parser */"./src/utils/webvtt-parser.ts"),s=i(/*! ./texttrack-utils */"./src/utils/texttrack-utils.ts"),a=/\s/,o={newCue:function(t,e,i,o){for(var l,c,u,h,d,f=[],p=self.VTTCue||self.TextTrackCue,g=0;g<o.rows.length;g++)if(u=!0,h=0,d="",!(l=o.rows[g]).isEmpty()){for(var v=0;v<l.chars.length;v++)a.test(l.chars[v].uchar)&&u?h++:(d+=l.chars[v].uchar,u=!1);l.cueStartTime=e,e===i&&(i+=1e-4),h>=16?h--:h++;var m=Object(r.fixLineBreaks)(d.trim()),y=Object(n.generateCueId)(e,i,m);t&&t.cues&&t.cues.getCueById(y)||((c=new p(e,i,m)).id=y,c.line=g+1,c.align="left",c.position=10+Math.min(80,10*Math.floor(8*h/32)),f.push(c))}return t&&f.length&&(f.sort((function(t,e){return"auto"===t.line||"auto"===e.line?0:t.line>8&&e.line>8?e.line-t.line:t.line-e.line})),f.forEach((function(e){return Object(s.addCueToTrack)(t,e)}))),f}};e.default=o},"./src/utils/discontinuities.ts":
/*!**************************************!*\
!*** ./src/utils/discontinuities.ts ***!
\**************************************/
/*! exports provided: findFirstFragWithCC, shouldAlignOnDiscontinuities, findDiscontinuousReferenceFrag, adjustSlidingStart, alignStream, alignPDT, alignFragmentByPDTDelta, alignMediaPlaylistByPDT */function(t,e,i){"use strict";i.r(e),i.d(e,"findFirstFragWithCC",(function(){return a})),i.d(e,"shouldAlignOnDiscontinuities",(function(){return o})),i.d(e,"findDiscontinuousReferenceFrag",(function(){return l})),i.d(e,"adjustSlidingStart",(function(){return u})),i.d(e,"alignStream",(function(){return h})),i.d(e,"alignPDT",(function(){return d})),i.d(e,"alignFragmentByPDTDelta",(function(){return f})),i.d(e,"alignMediaPlaylistByPDT",(function(){return p}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ./logger */"./src/utils/logger.ts"),s=i(/*! ../controller/level-helper */"./src/controller/level-helper.ts");function a(t,e){for(var i=null,r=0,n=t.length;r<n;r++){var s=t[r];if(s&&s.cc===e){i=s;break}}return i}function o(t,e,i){return!(!e.details||!(i.endCC>i.startCC||t&&t.cc<i.startCC))}function l(t,e){var i=t.fragments,r=e.fragments;if(r.length&&i.length){var s=a(i,r[0].cc);if(s&&(!s||s.startPTS))return s;n.logger.log("No frag in previous level to align on")}else n.logger.log("No fragments to align")}function c(t,e){if(t){var i=t.start+e;t.start=t.startPTS=i,t.endPTS=i+t.duration}}function u(t,e){for(var i=e.fragments,r=0,n=i.length;r<n;r++)c(i[r],t);e.fragmentHint&&c(e.fragmentHint,t),e.alignedSliding=!0}function h(t,e,i){e&&(function(t,e,i){if(o(t,i,e)){var s=l(i.details,e);s&&Object(r.isFiniteNumber)(s.start)&&(n.logger.log("Adjusting PTS using last level due to CC increase within current level "+e.url),u(s.start,e))}}(t,i,e),!i.alignedSliding&&e.details&&d(i,e.details),i.alignedSliding||!e.details||i.skippedSegments||Object(s.adjustSliding)(e.details,i))}function d(t,e){if(e.fragments.length&&t.hasProgramDateTime&&e.hasProgramDateTime){var i=e.fragments[0].programDateTime,s=t.fragments[0].programDateTime,a=(s-i)/1e3+e.fragments[0].start;a&&Object(r.isFiniteNumber)(a)&&(n.logger.log("Adjusting PTS using programDateTime delta "+(s-i)+"ms, sliding:"+a.toFixed(3)+" "+t.url+" "),u(a,t))}}function f(t,e){var i=t.programDateTime;if(i){var r=(i-e)/1e3;t.start=t.startPTS=r,t.endPTS=r+t.duration}}function p(t,e){if(e.fragments.length&&t.hasProgramDateTime&&e.hasProgramDateTime){var i=e.fragments[0].programDateTime-1e3*e.fragments[0].start;t.fragments.forEach((function(t){f(t,i)})),t.fragmentHint&&f(t.fragmentHint,i),t.alignedSliding=!0}}},"./src/utils/ewma-bandwidth-estimator.ts":
/*!***********************************************!*\
!*** ./src/utils/ewma-bandwidth-estimator.ts ***!
\***********************************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e);var r=i(/*! ../utils/ewma */"./src/utils/ewma.ts"),n=function(){function t(t,e,i){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new r.default(t),this.fast_=new r.default(e)}var e=t.prototype;return e.update=function(t,e){var i=this.slow_,n=this.fast_;this.slow_.halfLife!==t&&(this.slow_=new r.default(t,i.getEstimate(),i.getTotalWeight())),this.fast_.halfLife!==e&&(this.fast_=new r.default(e,n.getEstimate(),n.getTotalWeight()))},e.sample=function(t,e){var i=(t=Math.max(t,this.minDelayMs_))/1e3,r=8*e/i;this.fast_.sample(i,r),this.slow_.sample(i,r)},e.canEstimate=function(){var t=this.fast_;return t&&t.getTotalWeight()>=this.minWeight_},e.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},e.destroy=function(){},t}();e.default=n},"./src/utils/ewma.ts":
/*!***************************!*\
!*** ./src/utils/ewma.ts ***!
\***************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e);var r=function(){function t(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=t,this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=e,this.totalWeight_=i}var e=t.prototype;return e.sample=function(t,e){var i=Math.pow(this.alpha_,t);this.estimate_=e*(1-i)+i*this.estimate_,this.totalWeight_+=t},e.getTotalWeight=function(){return this.totalWeight_},e.getEstimate=function(){if(this.alpha_){var t=1-Math.pow(this.alpha_,this.totalWeight_);if(t)return this.estimate_/t}return this.estimate_},t}();e.default=r},"./src/utils/fetch-loader.ts":
/*!***********************************!*\
!*** ./src/utils/fetch-loader.ts ***!
\***********************************/
/*! exports provided: fetchSupported, default */function(t,e,i){"use strict";i.r(e),i.d(e,"fetchSupported",(function(){return d}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ../loader/load-stats */"./src/loader/load-stats.ts"),s=i(/*! ../demux/chunk-cache */"./src/demux/chunk-cache.ts");function a(t){var e="function"==typeof Map?new Map:void 0;return(a=function(t){if(null===t||(i=t,-1===Function.toString.call(i).indexOf("[native code]")))return t;var i;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return o(t,arguments,u(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),c(r,t)})(t)}function o(t,e,i){return(o=l()?Reflect.construct:function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&c(n,i.prototype),n}).apply(null,arguments)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function h(){return(h=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t}).apply(this,arguments)}function d(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(t){}return!1}var f=function(){function t(t){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=t.fetchSetup||p,this.controller=new self.AbortController,this.stats=new n.LoadStats}var e=t.prototype;return e.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},e.abortInternal=function(){var t=this.response;t&&t.ok||(this.stats.aborted=!0,this.controller.abort())},e.abort=function(){var t;this.abortInternal(),null!==(t=this.callbacks)&&void 0!==t&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},e.load=function(t,e,i){var n=this,s=this.stats;if(s.loading.start)throw new Error("Loader can only be used once.");s.loading.start=self.performance.now();var a=function(t,e){var i={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(h({},t.headers))};return t.rangeEnd&&i.headers.set("Range","bytes="+t.rangeStart+"-"+String(t.rangeEnd-1)),i}(t,this.controller.signal),o=i.onProgress,l="arraybuffer"===t.responseType,c=l?"byteLength":"length";this.context=t,this.config=e,this.callbacks=i,this.request=this.fetchSetup(t,a),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout((function(){n.abortInternal(),i.onTimeout(s,t,n.response)}),e.timeout),self.fetch(this.request).then((function(i){if(n.response=n.loader=i,!i.ok){var a=i.status,c=i.statusText;throw new g(c||"fetch, bad network response",a,i)}return s.loading.first=Math.max(self.performance.now(),s.loading.start),s.total=parseInt(i.headers.get("Content-Length")||"0"),o&&Object(r.isFiniteNumber)(e.highWaterMark)?n.loadProgressively(i,s,t,e.highWaterMark,o):l?i.arrayBuffer():i.text()})).then((function(a){var l=n.response;self.clearTimeout(n.requestTimeout),s.loading.end=Math.max(self.performance.now(),s.loading.first),s.loaded=s.total=a[c];var u={url:l.url,data:a};o&&!Object(r.isFiniteNumber)(e.highWaterMark)&&o(s,t,a,l),i.onSuccess(u,s,t,l)})).catch((function(e){if(self.clearTimeout(n.requestTimeout),!s.aborted){var r=e.code||0;i.onError({code:r,text:e.message},t,e.details)}}))},e.getCacheAge=function(){var t=null;if(this.response){var e=this.response.headers.get("age");t=e?parseFloat(e):null}return t},e.loadProgressively=function(t,e,i,r,n){void 0===r&&(r=0);var a=new s.default,o=t.body.getReader();return function s(){return o.read().then((function(o){if(o.done)return a.dataLength&&n(e,i,a.flush(),t),Promise.resolve(new ArrayBuffer(0));var l=o.value,c=l.length;return e.loaded+=c,c<r||a.dataLength?(a.push(l),a.dataLength>=r&&n(e,i,a.flush(),t)):n(e,i,l,t),s()})).catch((function(){return Promise.reject()}))}()},t}();function p(t,e){return new self.Request(t.url,e)}var g=function(t){var e,i;function r(e,i,r){var n;return(n=t.call(this,e)||this).code=void 0,n.details=void 0,n.code=i,n.details=r,n}return i=t,(e=r).prototype=Object.create(i.prototype),e.prototype.constructor=e,c(e,i),r}(a(Error));e.default=f},"./src/utils/imsc1-ttml-parser.ts":
/*!****************************************!*\
!*** ./src/utils/imsc1-ttml-parser.ts ***!
\****************************************/
/*! exports provided: IMSC1_CODEC, parseIMSC1 */function(t,e,i){"use strict";i.r(e),i.d(e,"IMSC1_CODEC",(function(){return u})),i.d(e,"parseIMSC1",(function(){return p}));var r=i(/*! ./mp4-tools */"./src/utils/mp4-tools.ts"),n=i(/*! ./vttparser */"./src/utils/vttparser.ts"),s=i(/*! ./vttcue */"./src/utils/vttcue.ts"),a=i(/*! ../demux/id3 */"./src/demux/id3.ts"),o=i(/*! ./timescale-conversion */"./src/utils/timescale-conversion.ts"),l=i(/*! ./webvtt-parser */"./src/utils/webvtt-parser.ts");function c(){return(c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t}).apply(this,arguments)}var u="stpp.ttml.im1t",h=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,d=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,f={left:"start",center:"center",right:"end",start:"start",end:"end"};function p(t,e,i,n,u){var h=Object(r.findBox)(new Uint8Array(t),["mdat"]);if(0!==h.length){var d=h[0],p=Object(a.utf8ArrayToStr)(new Uint8Array(t,d.start,d.end-d.start)),E=Object(o.toTimescaleFromScale)(e,1,i);try{n(function(t,e){var i=(new DOMParser).parseFromString(t,"text/xml").getElementsByTagName("tt")[0];if(!i)throw new Error("Invalid ttml");var r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},n=Object.keys(r).reduce((function(t,e){return t[e]=i.getAttribute("ttp:"+e)||r[e],t}),{}),a="preserve"!==i.getAttribute("xml:space"),o=v(g(i,"styling","style")),u=v(g(i,"layout","region")),h=g(i,"body","[begin]");return[].map.call(h,(function(t){var i=function t(e,i){return[].slice.call(e.childNodes).reduce((function(e,r,n){var s;return"br"===r.nodeName&&n?e+"\n":null!==(s=r.childNodes)&&void 0!==s&&s.length?t(r,i):i?e+r.textContent.trim().replace(/\s+/g," "):e+r.textContent}),"")}(t,a);if(!i||!t.hasAttribute("begin"))return null;var r=b(t.getAttribute("begin"),n),h=b(t.getAttribute("dur"),n),d=b(t.getAttribute("end"),n);if(null===r)throw y(t);if(null===d){if(null===h)throw y(t);d=r+h}var p=new s.default(r-e,d-e,i);p.id=Object(l.generateCueId)(p.startTime,p.endTime,p.text);var g=u[t.getAttribute("region")],v=o[t.getAttribute("style")];p.position=10,p.size=80;var E=function(t,e){var i="http://www.w3.org/ns/ttml#styling";return["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"].reduce((function(r,n){var s=m(e,i,n)||m(t,i,n);return s&&(r[n]=s),r}),{})}(g,v),S=E.textAlign;if(S){var C=f[S];C&&(p.lineAlign=C),p.align=S}return c(p,E),p})).filter((function(t){return null!==t}))}(p,E))}catch(t){u(t)}}else u(new Error("Could not parse IMSC1 mdat"))}function g(t,e,i){var r=t.getElementsByTagName(e)[0];return r?[].slice.call(r.querySelectorAll(i)):[]}function v(t){return t.reduce((function(t,e){var i=e.getAttribute("xml:id");return i&&(t[i]=e),t}),{})}function m(t,e,i){return t.hasAttributeNS(e,i)?t.getAttributeNS(e,i):null}function y(t){return new Error("Could not parse ttml timestamp "+t)}function b(t,e){if(!t)return null;var i=Object(n.parseTimeStamp)(t);return null===i&&(h.test(t)?i=function(t,e){var i=h.exec(t),r=(0|i[4])+(0|i[5])/e.subFrameRate;return 3600*(0|i[1])+60*(0|i[2])+(0|i[3])+r/e.frameRate}(t,e):d.test(t)&&(i=function(t,e){var i=d.exec(t),r=Number(i[1]);switch(i[2]){case"h":return 3600*r;case"m":return 60*r;case"ms":return 1e3*r;case"f":return r/e.frameRate;case"t":return r/e.tickRate}return r}(t,e))),i}},"./src/utils/logger.ts":
/*!*****************************!*\
!*** ./src/utils/logger.ts ***!
\*****************************/
/*! exports provided: enableLogs, logger */function(t,e,i){"use strict";i.r(e),i.d(e,"enableLogs",(function(){return o})),i.d(e,"logger",(function(){return l}));var r=function(){},n={trace:r,debug:r,log:r,warn:r,info:r,error:r},s=n;function a(t){var e=self.console[t];return e?e.bind(self.console,"["+t+"] >"):r}function o(t){if(self.console&&!0===t||"object"==typeof t){!function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];i.forEach((function(e){s[e]=t[e]?t[e].bind(t):a(e)}))}(t,"debug","log","info","warn","error");try{s.log()}catch(t){s=n}}else s=n}var l=n},"./src/utils/mediakeys-helper.ts":
/*!***************************************!*\
!*** ./src/utils/mediakeys-helper.ts ***!
\***************************************/
/*! exports provided: KeySystems, requestMediaKeySystemAccess */function(t,e,i){"use strict";var r;i.r(e),i.d(e,"KeySystems",(function(){return r})),i.d(e,"requestMediaKeySystemAccess",(function(){return n})),function(t){t.WIDEVINE="com.widevine.alpha",t.PLAYREADY="com.microsoft.playready"}(r||(r={}));var n="undefined"!=typeof self&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null},"./src/utils/mediasource-helper.ts":
/*!*****************************************!*\
!*** ./src/utils/mediasource-helper.ts ***!
\*****************************************/
/*! exports provided: getMediaSource */function(t,e,i){"use strict";function r(){return self.MediaSource||self.WebKitMediaSource}i.r(e),i.d(e,"getMediaSource",(function(){return r}))},"./src/utils/mp4-tools.ts":
/*!********************************!*\
!*** ./src/utils/mp4-tools.ts ***!
\********************************/
/*! exports provided: bin2str, readUint16, readUint32, writeUint32, findBox, parseSegmentIndex, parseInitSegment, getStartDTS, getDuration, computeRawDurationFromSamples, offsetStartDTS, segmentValidRange, appendUint8Array */function(t,e,i){"use strict";i.r(e),i.d(e,"bin2str",(function(){return o})),i.d(e,"readUint16",(function(){return l})),i.d(e,"readUint32",(function(){return c})),i.d(e,"writeUint32",(function(){return u})),i.d(e,"findBox",(function(){return h})),i.d(e,"parseSegmentIndex",(function(){return d})),i.d(e,"parseInitSegment",(function(){return f})),i.d(e,"getStartDTS",(function(){return p})),i.d(e,"getDuration",(function(){return g})),i.d(e,"computeRawDurationFromSamples",(function(){return v})),i.d(e,"offsetStartDTS",(function(){return m})),i.d(e,"segmentValidRange",(function(){return y})),i.d(e,"appendUint8Array",(function(){return b}));var r=i(/*! ./typed-array */"./src/utils/typed-array.ts"),n=i(/*! ../loader/fragment */"./src/loader/fragment.ts"),s=Math.pow(2,32)-1,a=[].push;function o(t){return String.fromCharCode.apply(null,t)}function l(t,e){"data"in t&&(e+=t.start,t=t.data);var i=t[e]<<8|t[e+1];return i<0?65536+i:i}function c(t,e){"data"in t&&(e+=t.start,t=t.data);var i=t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3];return i<0?4294967296+i:i}function u(t,e,i){"data"in t&&(e+=t.start,t=t.data),t[e]=i>>24,t[e+1]=i>>16&255,t[e+2]=i>>8&255,t[e+3]=255&i}function h(t,e){var i,r,n,s=[];if(!e.length)return s;"data"in t?(i=t.data,r=t.start,n=t.end):(r=0,n=(i=t).byteLength);for(var l=r;l<n;){var u=c(i,l),d=u>1?l+u:n;if(o(i.subarray(l+4,l+8))===e[0])if(1===e.length)s.push({data:i,start:l+8,end:d});else{var f=h({data:i,start:l+8,end:d},e.slice(1));f.length&&a.apply(s,f)}l=d}return s}function d(t){var e=h(t,["moov"])[0],i=e?e.end:null,r=h(t,["sidx"]);if(!r||!r[0])return null;var n=[],s=r[0],a=s.data[0],o=0===a?8:16,u=c(s,o);o+=4,o+=0===a?8:16,o+=2;var d=s.end+0,f=l(s,o);o+=2;for(var p=0;p<f;p++){var g=o,v=c(s,g);g+=4;var m=2147483647&v;if(1==(2147483648&v)>>>31)return console.warn("SIDX has hierarchical references (not supported)"),null;var y=c(s,g);g+=4,n.push({referenceSize:m,subsegmentDuration:y,info:{duration:y/u,start:d,end:d+m-1}}),d+=m,o=g+=4}return{earliestPresentationTime:0,timescale:u,version:a,referencesCount:f,references:n,moovEndOffset:i}}function f(t){for(var e=[],i=h(t,["moov","trak"]),r=0;r<i.length;r++){var s=i[r],a=h(s,["tkhd"])[0];if(a){var l=a.data[a.start],u=0===l?12:20,d=c(a,u),f=h(s,["mdia","mdhd"])[0];if(f){var p=c(f,u=0===(l=f.data[f.start])?12:20),g=h(s,["mdia","hdlr"])[0];if(g){var v=o(g.data.subarray(g.start+8,g.start+12)),m={soun:n.ElementaryStreamTypes.AUDIO,vide:n.ElementaryStreamTypes.VIDEO}[v];if(m){var y=h(s,["mdia","minf","stbl","stsd"])[0],b=void 0;y&&(b=o(y.data.subarray(y.start+12,y.start+16))),e[d]={timescale:p,type:m},e[m]={timescale:p,id:d,codec:b}}}}}}return h(t,["moov","mvex","trex"]).forEach((function(t){var i=c(t,4),r=e[i];r&&(r.default={duration:c(t,12),flags:c(t,20)})})),e}function p(t,e){return h(e,["moof","traf"]).reduce((function(e,i){var r=h(i,["tfdt"])[0],n=r.data[r.start],s=h(i,["tfhd"]).reduce((function(e,i){var s=c(i,4),a=t[s];if(a){var o=c(r,4);1===n&&(o*=Math.pow(2,32),o+=c(r,8));var l=o/(a.timescale||9e4);if(isFinite(l)&&(null===e||l<e))return l}return e}),null);return null!==s&&isFinite(s)&&(null===e||s<e)?s:e}),null)||0}function g(t,e){for(var i=0,r=0,s=0,a=h(t,["moof","traf"]),o=0;o<a.length;o++){var l=a[o],u=h(l,["tfhd"])[0],f=e[c(u,4)];if(f){var p=f.default,g=c(u,0)|(null==p?void 0:p.flags),m=null==p?void 0:p.duration;8&g&&(m=c(u,2&g?12:8));for(var y=f.timescale||9e4,b=h(l,["trun"]),E=0;E<b.length;E++)i=m?m*c(b[E],4):v(b[E]),f.type===n.ElementaryStreamTypes.VIDEO?r+=i/y:f.type===n.ElementaryStreamTypes.AUDIO&&(s+=i/y)}}if(0===r&&0===s){var S=d(t);if(null!=S&&S.references)return S.references.reduce((function(t,e){return t+e.info.duration||0}),0)}return r||s}function v(t){var e=c(t,0),i=8;1&e&&(i+=4),4&e&&(i+=4);for(var r=0,n=c(t,4),s=0;s<n;s++)256&e&&(r+=c(t,i),i+=4),512&e&&(i+=4),1024&e&&(i+=4),2048&e&&(i+=4);return r}function m(t,e,i){h(e,["moof","traf"]).forEach((function(e){h(e,["tfhd"]).forEach((function(r){var n=c(r,4),a=t[n];if(a){var o=a.timescale||9e4;h(e,["tfdt"]).forEach((function(t){var e=t.data[t.start],r=c(t,4);if(0===e)u(t,4,r-i*o);else{r*=Math.pow(2,32),r+=c(t,8),r-=i*o,r=Math.max(r,0);var n=Math.floor(r/(s+1)),a=Math.floor(r%(s+1));u(t,4,n),u(t,8,a)}}))}}))}))}function y(t){var e={valid:null,remainder:null},i=h(t,["moof"]);if(!i)return e;if(i.length<2)return e.remainder=t,e;var n=i[i.length-1];return e.valid=Object(r.sliceUint8)(t,0,n.start-8),e.remainder=Object(r.sliceUint8)(t,n.start-8),e}function b(t,e){var i=new Uint8Array(t.length+e.length);return i.set(t),i.set(e,t.length),i}},"./src/utils/output-filter.ts":
/*!************************************!*\
!*** ./src/utils/output-filter.ts ***!
\************************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return r}));var r=function(){function t(t,e){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=t,this.trackName=e}var e=t.prototype;return e.dispatchCue=function(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},e.newCue=function(t,e,i){(null===this.startTime||this.startTime>t)&&(this.startTime=t),this.endTime=e,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)},e.reset=function(){this.cueRanges=[]},t}()},"./src/utils/texttrack-utils.ts":
/*!**************************************!*\
!*** ./src/utils/texttrack-utils.ts ***!
\**************************************/
/*! exports provided: sendAddTrackEvent, addCueToTrack, clearCurrentCues, removeCuesInRange, getCuesInRange */function(t,e,i){"use strict";i.r(e),i.d(e,"sendAddTrackEvent",(function(){return n})),i.d(e,"addCueToTrack",(function(){return s})),i.d(e,"clearCurrentCues",(function(){return a})),i.d(e,"removeCuesInRange",(function(){return o})),i.d(e,"getCuesInRange",(function(){return l}));var r=i(/*! ./logger */"./src/utils/logger.ts");function n(t,e){var i;try{i=new Event("addtrack")}catch(t){(i=document.createEvent("Event")).initEvent("addtrack",!1,!1)}i.track=t,e.dispatchEvent(i)}function s(t,e){var i=t.mode;if("disabled"===i&&(t.mode="hidden"),t.cues&&!t.cues.getCueById(e.id))try{if(t.addCue(e),!t.cues.getCueById(e.id))throw new Error("addCue is failed for: "+e)}catch(i){r.logger.debug("[texttrack-utils]: "+i);var n=new self.TextTrackCue(e.startTime,e.endTime,e.text);n.id=e.id,t.addCue(n)}"disabled"===i&&(t.mode=i)}function a(t){var e=t.mode;if("disabled"===e&&(t.mode="hidden"),t.cues)for(var i=t.cues.length;i--;)t.removeCue(t.cues[i]);"disabled"===e&&(t.mode=e)}function o(t,e,i){var r=t.mode;if("disabled"===r&&(t.mode="hidden"),t.cues&&t.cues.length>0)for(var n=l(t.cues,e,i),s=0;s<n.length;s++)t.removeCue(n[s]);"disabled"===r&&(t.mode=r)}function l(t,e,i){var r=[],n=function(t,e){if(e<t[0].startTime)return 0;var i=t.length-1;if(e>t[i].endTime)return-1;for(var r=0,n=i;r<=n;){var s=Math.floor((n+r)/2);if(e<t[s].startTime)n=s-1;else{if(!(e>t[s].startTime&&r<i))return s;r=s+1}}return t[r].startTime-e<e-t[n].startTime?r:n}(t,e);if(n>-1)for(var s=n,a=t.length;s<a;s++){var o=t[s];if(o.startTime>=e&&o.endTime<=i)r.push(o);else if(o.startTime>i)return r}return r}},"./src/utils/time-ranges.ts":
/*!**********************************!*\
!*** ./src/utils/time-ranges.ts ***!
\**********************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e),e.default={toString:function(t){for(var e="",i=t.length,r=0;r<i;r++)e+="["+t.start(r).toFixed(3)+","+t.end(r).toFixed(3)+"]";return e}}},"./src/utils/timescale-conversion.ts":
/*!*******************************************!*\
!*** ./src/utils/timescale-conversion.ts ***!
\*******************************************/
/*! exports provided: toTimescaleFromBase, toTimescaleFromScale, toMsFromMpegTsClock, toMpegTsClockFromTimescale */function(t,e,i){"use strict";function r(t,e,i,r){void 0===i&&(i=1),void 0===r&&(r=!1);var n=t*e*i;return r?Math.round(n):n}function n(t,e,i,n){return void 0===i&&(i=1),void 0===n&&(n=!1),r(t,e,1/i,n)}function s(t,e){return void 0===e&&(e=!1),r(t,1e3,1/9e4,e)}function a(t,e){return void 0===e&&(e=1),r(t,9e4,1/e)}i.r(e),i.d(e,"toTimescaleFromBase",(function(){return r})),i.d(e,"toTimescaleFromScale",(function(){return n})),i.d(e,"toMsFromMpegTsClock",(function(){return s})),i.d(e,"toMpegTsClockFromTimescale",(function(){return a}))},"./src/utils/typed-array.ts":
/*!**********************************!*\
!*** ./src/utils/typed-array.ts ***!
\**********************************/
/*! exports provided: sliceUint8 */function(t,e,i){"use strict";function r(t,e,i){return Uint8Array.prototype.slice?t.slice(e,i):new Uint8Array(Array.prototype.slice.call(t,e,i))}i.r(e),i.d(e,"sliceUint8",(function(){return r}))},"./src/utils/vttcue.ts":
/*!*****************************!*\
!*** ./src/utils/vttcue.ts ***!
\*****************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e),e.default=function(){if("undefined"!=typeof self&&self.VTTCue)return self.VTTCue;var t=["","lr","rl"],e=["start","middle","end","left","right"];function i(t,e){if("string"!=typeof e)return!1;if(!Array.isArray(t))return!1;var i=e.toLowerCase();return!!~t.indexOf(i)&&i}function r(t){return i(e,t)}function n(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];for(var n=1;n<arguments.length;n++){var s=arguments[n];for(var a in s)t[a]=s[a]}return t}function s(e,s,a){var o=this,l={enumerable:!0};o.hasBeenReset=!1;var c="",u=!1,h=e,d=s,f=a,p=null,g="",v=!0,m="auto",y="start",b=50,E="middle",S=50,C="middle";Object.defineProperty(o,"id",n({},l,{get:function(){return c},set:function(t){c=""+t}})),Object.defineProperty(o,"pauseOnExit",n({},l,{get:function(){return u},set:function(t){u=!!t}})),Object.defineProperty(o,"startTime",n({},l,{get:function(){return h},set:function(t){if("number"!=typeof t)throw new TypeError("Start time must be set to a number.");h=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",n({},l,{get:function(){return d},set:function(t){if("number"!=typeof t)throw new TypeError("End time must be set to a number.");d=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",n({},l,{get:function(){return f},set:function(t){f=""+t,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",n({},l,{get:function(){return p},set:function(t){p=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",n({},l,{get:function(){return g},set:function(e){var r=function(e){return i(t,e)}(e);if(!1===r)throw new SyntaxError("An invalid or illegal string was specified.");g=r,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",n({},l,{get:function(){return v},set:function(t){v=!!t,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",n({},l,{get:function(){return m},set:function(t){if("number"!=typeof t&&"auto"!==t)throw new SyntaxError("An invalid number or illegal string was specified.");m=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",n({},l,{get:function(){return y},set:function(t){var e=r(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");y=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",n({},l,{get:function(){return b},set:function(t){if(t<0||t>100)throw new Error("Position must be between 0 and 100.");b=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",n({},l,{get:function(){return E},set:function(t){var e=r(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");E=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",n({},l,{get:function(){return S},set:function(t){if(t<0||t>100)throw new Error("Size must be between 0 and 100.");S=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",n({},l,{get:function(){return C},set:function(t){var e=r(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");C=e,this.hasBeenReset=!0}})),o.displayState=void 0}return s.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},s}()},"./src/utils/vttparser.ts":
/*!********************************!*\
!*** ./src/utils/vttparser.ts ***!
\********************************/
/*! exports provided: parseTimeStamp, fixLineBreaks, VTTParser */function(t,e,i){"use strict";i.r(e),i.d(e,"parseTimeStamp",(function(){return s})),i.d(e,"fixLineBreaks",(function(){return h})),i.d(e,"VTTParser",(function(){return d}));var r=i(/*! ./vttcue */"./src/utils/vttcue.ts"),n=function(){function t(){}return t.prototype.decode=function(t,e){if(!t)return"";if("string"!=typeof t)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))},t}();function s(t){function e(t,e,i,r){return 3600*(0|t)+60*(0|e)+(0|i)+parseFloat(r||0)}var i=t.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return i?parseFloat(i[2])>59?e(i[2],i[3],0,i[4]):e(i[1],i[2],i[3],i[4]):null}var a=function(){function t(){this.values=Object.create(null)}var e=t.prototype;return e.set=function(t,e){this.get(t)||""===e||(this.values[t]=e)},e.get=function(t,e,i){return i?this.has(t)?this.values[t]:e[i]:this.has(t)?this.values[t]:e},e.has=function(t){return t in this.values},e.alt=function(t,e,i){for(var r=0;r<i.length;++r)if(e===i[r]){this.set(t,e);break}},e.integer=function(t,e){/^-?\d+$/.test(e)&&this.set(t,parseInt(e,10))},e.percent=function(t,e){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(e)){var i=parseFloat(e);if(i>=0&&i<=100)return this.set(t,i),!0}return!1},t}();function o(t,e,i,r){var n=r?t.split(r):[t];for(var s in n)if("string"==typeof n[s]){var a=n[s].split(i);2===a.length&&e(a[0],a[1])}}var l=new r.default(0,0,""),c="middle"===l.align?"middle":"center";function u(t,e,i){var r=t;function n(){var e=s(t);if(null===e)throw new Error("Malformed timestamp: "+r);return t=t.replace(/^[^\sa-zA-Z-]+/,""),e}function u(){t=t.replace(/^\s+/,"")}if(u(),e.startTime=n(),u(),"--\x3e"!==t.substr(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+r);t=t.substr(3),u(),e.endTime=n(),u(),function(t,e){var r=new a;o(t,(function(t,e){var n;switch(t){case"region":for(var s=i.length-1;s>=0;s--)if(i[s].id===e){r.set(t,i[s].region);break}break;case"vertical":r.alt(t,e,["rl","lr"]);break;case"line":n=e.split(","),r.integer(t,n[0]),r.percent(t,n[0])&&r.set("snapToLines",!1),r.alt(t,n[0],["auto"]),2===n.length&&r.alt("lineAlign",n[1],["start",c,"end"]);break;case"position":n=e.split(","),r.percent(t,n[0]),2===n.length&&r.alt("positionAlign",n[1],["start",c,"end","line-left","line-right","auto"]);break;case"size":r.percent(t,e);break;case"align":r.alt(t,e,["start",c,"end","left","right"])}}),/:/,/\s/),e.region=r.get("region",null),e.vertical=r.get("vertical","");var n=r.get("line","auto");"auto"===n&&-1===l.line&&(n=-1),e.line=n,e.lineAlign=r.get("lineAlign","start"),e.snapToLines=r.get("snapToLines",!0),e.size=r.get("size",100),e.align=r.get("align",c);var s=r.get("position","auto");"auto"===s&&50===l.position&&(s="start"===e.align||"left"===e.align?0:"end"===e.align||"right"===e.align?100:50),e.position=s}(t,e)}function h(t){return t.replace(/<br(?: \/)?>/gi,"\n")}var d=function(){function t(){this.state="INITIAL",this.buffer="",this.decoder=new n,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var e=t.prototype;return e.parse=function(t){var e=this;function i(){var t=e.buffer,i=0;for(t=h(t);i<t.length&&"\r"!==t[i]&&"\n"!==t[i];)++i;var r=t.substr(0,i);return"\r"===t[i]&&++i,"\n"===t[i]&&++i,e.buffer=t.substr(i),r}t&&(e.buffer+=e.decoder.decode(t,{stream:!0}));try{var n="";if("INITIAL"===e.state){if(!/\r\n|\n/.test(e.buffer))return this;var s=(n=i()).match(/^()?WEBVTT([ \t].*)?$/);if(!s||!s[0])throw new Error("Malformed WebVTT signature.");e.state="HEADER"}for(var a=!1;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;switch(a?a=!1:n=i(),e.state){case"HEADER":/:/.test(n)?o(n,(function(t,e){}),/:/):n||(e.state="ID");continue;case"NOTE":n||(e.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(n)){e.state="NOTE";break}if(!n)continue;if(e.cue=new r.default(0,0,""),e.state="CUE",-1===n.indexOf("--\x3e")){e.cue.id=n;continue}case"CUE":if(!e.cue){e.state="BADCUE";continue}try{u(n,e.cue,e.regionList)}catch(t){e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":var l=-1!==n.indexOf("--\x3e");if(!n||l&&(a=!0)){e.oncue&&e.cue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}if(null===e.cue)continue;e.cue.text&&(e.cue.text+="\n"),e.cue.text+=n;continue;case"BADCUE":n||(e.state="ID")}}}catch(t){"CUETEXT"===e.state&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state="INITIAL"===e.state?"BADWEBVTT":"BADCUE"}return this},e.flush=function(){try{if((this.cue||"HEADER"===this.state)&&(this.buffer+="\n\n",this.parse()),"INITIAL"===this.state||"BADWEBVTT"===this.state)throw new Error("Malformed WebVTT signature.")}catch(t){this.onparsingerror&&this.onparsingerror(t)}return this.onflush&&this.onflush(),this},t}()},"./src/utils/webvtt-parser.ts":
/*!************************************!*\
!*** ./src/utils/webvtt-parser.ts ***!
\************************************/
/*! exports provided: generateCueId, parseWebVTT */function(t,e,i){"use strict";i.r(e),i.d(e,"generateCueId",(function(){return h})),i.d(e,"parseWebVTT",(function(){return d}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ./vttparser */"./src/utils/vttparser.ts"),s=i(/*! ../demux/id3 */"./src/demux/id3.ts"),a=i(/*! ./timescale-conversion */"./src/utils/timescale-conversion.ts"),o=i(/*! ../remux/mp4-remuxer */"./src/remux/mp4-remuxer.ts"),l=/\r\n|\n\r|\n|\r/g,c=function(t,e,i){return void 0===i&&(i=0),t.substr(i,e.length)===e},u=function(t){for(var e=5381,i=t.length;i;)e=33*e^t.charCodeAt(--i);return(e>>>0).toString()};function h(t,e,i){return u(t.toString())+u(e.toString())+u(i)}function d(t,e,i,u,d,f,p,g){var v,m=new n.VTTParser,y=Object(s.utf8ArrayToStr)(new Uint8Array(t)).trim().replace(l,"\n").split("\n"),b=[],E=Object(a.toMpegTsClockFromTimescale)(e,i),S="00:00.000",C=0,k=0,w=!0,x=!1;m.oncue=function(t){var e=u[d],i=u.ccOffset,r=(C-E)/9e4;if(null!=e&&e.new&&(void 0!==k?i=u.ccOffset=e.start:function(t,e,i){var r=t[e],n=t[r.prevCC];if(!n||!n.new&&r.new)return t.ccOffset=t.presentationOffset=r.start,void(r.new=!1);for(;null!==(s=n)&&void 0!==s&&s.new;){var s;t.ccOffset+=r.start-n.start,r.new=!1,n=t[(r=n).prevCC]}t.presentationOffset=i}(u,d,r)),r&&(i=r-u.presentationOffset),x){var n=t.endTime-t.startTime,s=Object(o.normalizePts)(9e4*(t.startTime+i-k),9e4*f)/9e4;t.startTime=s,t.endTime=s+n}var a=t.text.trim();t.text=decodeURIComponent(encodeURIComponent(a)),t.id||(t.id=h(t.startTime,t.endTime,a)),t.endTime>0&&b.push(t)},m.onparsingerror=function(t){v=t},m.onflush=function(){v?g(v):p(b)},y.forEach((function(t){if(w){if(c(t,"X-TIMESTAMP-MAP=")){w=!1,x=!0,t.substr(16).split(",").forEach((function(t){c(t,"LOCAL:")?S=t.substr(6):c(t,"MPEGTS:")&&(C=parseInt(t.substr(7)))}));try{k=function(t){var e=parseInt(t.substr(-3)),i=parseInt(t.substr(-6,2)),n=parseInt(t.substr(-9,2)),s=t.length>9?parseInt(t.substr(0,t.indexOf(":"))):0;if(!(Object(r.isFiniteNumber)(e)&&Object(r.isFiniteNumber)(i)&&Object(r.isFiniteNumber)(n)&&Object(r.isFiniteNumber)(s)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+t);return e+=1e3*i,e+=6e4*n,e+=36e5*s}(S)/1e3}catch(t){x=!1,v=t}return}""===t&&(w=!1)}m.parse(t+"\n")})),m.flush()}},"./src/utils/xhr-loader.ts":
/*!*********************************!*\
!*** ./src/utils/xhr-loader.ts ***!
\*********************************/
/*! exports provided: default */function(t,e,i){"use strict";i.r(e);var r=i(/*! ../utils/logger */"./src/utils/logger.ts"),n=i(/*! ../loader/load-stats */"./src/loader/load-stats.ts"),s=/^age:\s*[\d.]+\s*$/m,a=function(){function t(t){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=t?t.xhrSetup:null,this.stats=new n.LoadStats,this.retryDelay=0}var e=t.prototype;return e.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},e.abortInternal=function(){var t=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),t&&(t.onreadystatechange=null,t.onprogress=null,4!==t.readyState&&(this.stats.aborted=!0,t.abort()))},e.abort=function(){var t;this.abortInternal(),null!==(t=this.callbacks)&&void 0!==t&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},e.load=function(t,e,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=t,this.config=e,this.callbacks=i,this.retryDelay=e.retryDelay,this.loadInternal()},e.loadInternal=function(){var t=this.config,e=this.context;if(t){var i=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0;var n=this.xhrSetup;try{if(n)try{n(i,e.url)}catch(t){i.open("GET",e.url,!0),n(i,e.url)}i.readyState||i.open("GET",e.url,!0);var s=this.context.headers;if(s)for(var a in s)i.setRequestHeader(a,s[a])}catch(t){return void this.callbacks.onError({code:i.status,text:t.message},e,i)}e.rangeEnd&&i.setRequestHeader("Range","bytes="+e.rangeStart+"-"+(e.rangeEnd-1)),i.onreadystatechange=this.readystatechange.bind(this),i.onprogress=this.loadprogress.bind(this),i.responseType=e.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),t.timeout),i.send()}},e.readystatechange=function(){var t=this.context,e=this.loader,i=this.stats;if(t&&e){var n=e.readyState,s=this.config;if(!i.aborted&&n>=2)if(self.clearTimeout(this.requestTimeout),0===i.loading.first&&(i.loading.first=Math.max(self.performance.now(),i.loading.start)),4===n){e.onreadystatechange=null,e.onprogress=null;var a=e.status;if(a>=200&&a<300){var o,l;if(i.loading.end=Math.max(self.performance.now(),i.loading.first),l="arraybuffer"===t.responseType?(o=e.response).byteLength:(o=e.responseText).length,i.loaded=i.total=l,!this.callbacks)return;var c=this.callbacks.onProgress;if(c&&c(i,t,o,e),!this.callbacks)return;var u={url:e.responseURL,data:o};this.callbacks.onSuccess(u,i,t,e)}else i.retry>=s.maxRetry||a>=400&&a<499?(r.logger.error(a+" while loading "+t.url),this.callbacks.onError({code:a,text:e.statusText},t,e)):(r.logger.warn(a+" while loading "+t.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,s.maxRetryDelay),i.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout)}},e.loadtimeout=function(){r.logger.warn("timeout while loading "+this.context.url);var t=this.callbacks;t&&(this.abortInternal(),t.onTimeout(this.stats,this.context,this.loader))},e.loadprogress=function(t){var e=this.stats;e.loaded=t.loaded,t.lengthComputable&&(e.total=t.total)},e.getCacheAge=function(){var t=null;if(this.loader&&s.test(this.loader.getAllResponseHeaders())){var e=this.loader.getResponseHeader("age");t=e?parseFloat(e):null}return t},t}();e.default=a}}).default},t.exports=r())},vHTk:
/*!******************************************************!*\
!*** ./src/components/PreviewAll/index.less?modules ***!
\******************************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,i){t.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wCXF:
/*!********************************************************!*\
!*** ./node_modules/rc-table/es/Table.js + 17 modules ***!
\********************************************************/
/*! exports provided: INTERNAL_HOOKS, default */
/*! exports used: INTERNAL_HOOKS, default */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/typeof.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/raf/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-resize-observer/es/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/Cell/index.js because of ./node_modules/antd/es/table/Table.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/Footer/index.js because of ./node_modules/antd/es/table/Table.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/context/TableContext.js because of ./node_modules/antd/es/table/Table.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/hooks/useColumns.js because of ./node_modules/antd/es/table/Table.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/sugar/Column.js because of ./node_modules/antd/es/table/Table.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/sugar/ColumnGroup.js because of ./node_modules/antd/es/table/Table.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/utils/legacyUtil.js because of ./node_modules/antd/es/table/Table.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-table/es/utils/valueUtil.js because of ./node_modules/antd/es/table/Table.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Dom/addEventListener.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Dom/css.js because of ./node_modules/rc-image/es/Image.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/getScrollBarSize.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/ref.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/warning.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/shallowequal/index.js (<- Module is not an ECMAScript module) */function(t,e,i){"use strict";i.d(e,"a",(function(){return Q}));var r=i("rePB"),n=i("VTBJ"),s=i("KQm4"),a=i("U8pU"),o=i("ODXe"),l=i("q1tI"),c=i("TSYQ"),u=i.n(c),h=i("Gytx"),d=i.n(h),f=i("Kwbf"),p=i("t23M"),g=i("qx4F"),v=i("6eGT"),m=i("IBYe"),y=i("Ff2n"),b=i("c+Xe"),E=i("fyJ8"),S=i("biw7");function C(t,e,i,r,n){var s,a,o=i[t]||{},l=i[e]||{};"left"===o.fixed?s=r.left[t]:"right"===l.fixed&&(a=r.right[e]);var c=!1,u=!1,h=!1,d=!1,f=i[e+1],p=i[t-1];if("rtl"===n){if(void 0!==s)d=!(p&&"left"===p.fixed);else if(void 0!==a){h=!(f&&"right"===f.fixed)}}else if(void 0!==s){c=!(f&&"left"===f.fixed)}else if(void 0!==a){u=!(p&&"right"===p.fixed)}return{fixLeft:s,fixRight:a,lastFixLeft:c,firstFixRight:u,lastFixRight:h,firstFixLeft:d,isSticky:r.isSticky}}var k=i("sR1s");function w(t){var e,i=t.cells,r=t.stickyOffsets,n=t.flattenColumns,s=t.rowComponent,a=t.cellComponent,o=t.onHeaderRow,c=t.index,u=l.useContext(S.a),h=u.prefixCls,d=u.direction;o&&(e=o(i.map((function(t){return t.column})),c));var f=Object(k.a)(i.map((function(t){return t.column})));return l.createElement(s,Object.assign({},e),i.map((function(t,e){var i,s=t.column,o=C(t.colStart,t.colEnd,n,r,d);return s&&s.onHeaderCell&&(i=t.column.onHeaderCell(s)),l.createElement(E.a,Object.assign({},t,{ellipsis:s.ellipsis,align:s.align,component:a,prefixCls:h,key:f[e]},o,{additionalProps:i,rowType:"header"}))})))}w.displayName="HeaderRow";var x=w;var T=function(t){var e=t.stickyOffsets,i=t.columns,r=t.flattenColumns,n=t.onHeaderRow,s=l.useContext(S.a),a=s.prefixCls,o=s.getComponent,c=l.useMemo((function(){return function(t){var e=[];!function t(i,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;e[n]=e[n]||[];var s=r,a=i.filter(Boolean).map((function(i){var r={key:i.key,className:i.className||"",children:i.title,column:i,colStart:s},a=1,o=i.children;return o&&o.length>0&&(a=t(o,s,n+1).reduce((function(t,e){return t+e}),0),r.hasSubColumns=!0),"colSpan"in i&&(a=i.colSpan),"rowSpan"in i&&(r.rowSpan=i.rowSpan),r.colSpan=a,r.colEnd=r.colStart+a-1,e[n].push(r),s+=a,a}));return a}(t,0);for(var i=e.length,r=function(t){e[t].forEach((function(e){"rowSpan"in e||e.hasSubColumns||(e.rowSpan=i-t)}))},n=0;n<i;n+=1)r(n);return e}(i)}),[i]),u=o(["header","wrapper"],"thead"),h=o(["header","row"],"tr"),d=o(["header","cell"],"th");return l.createElement(u,{className:"".concat(a,"-thead")},c.map((function(t,i){return l.createElement(x,{key:i,flattenColumns:r,cells:t,stickyOffsets:e,rowComponent:h,cellComponent:d,onHeaderRow:n,index:i})})))},O=i("hW8S");var A=function(t){for(var e=t.colWidths,i=t.columns,r=[],n=!1,s=(t.columCount||i.length)-1;s>=0;s-=1){var a=e[s],o=i&&i[s],c=o&&o[O.a];(a||c||n)&&(r.unshift(l.createElement("col",Object.assign({key:s,style:{width:a,minWidth:a}},c))),n=!0)}return l.createElement("colgroup",null,r)};var L=l.forwardRef((function(t,e){var i=t.noData,a=t.columns,o=t.flattenColumns,c=t.colWidths,h=t.columCount,d=t.stickyOffsets,f=t.direction,p=t.fixHeader,g=t.offsetHeader,v=t.stickyClassName,m=t.onScroll,E=Object(y.a)(t,["noData","columns","flattenColumns","colWidths","columCount","stickyOffsets","direction","fixHeader","offsetHeader","stickyClassName","onScroll"]),C=l.useContext(S.a),k=C.prefixCls,w=C.scrollbarSize,x=C.isSticky,O=x&&!p?0:w,L=l.useRef(null),R=l.useCallback((function(t){Object(b.b)(e,t),Object(b.b)(L,t)}),[]);l.useEffect((function(){var t;function e(t){var e=t.currentTarget,i=t.deltaX;i&&(m({currentTarget:e,scrollLeft:e.scrollLeft+i}),t.preventDefault())}return null===(t=L.current)||void 0===t||t.addEventListener("wheel",e),function(){var t;null===(t=L.current)||void 0===t||t.removeEventListener("wheel",e)}}),[]);var _=o[o.length-1],D={fixed:_?_.fixed:null,onHeaderCell:function(){return{className:"".concat(k,"-cell-scrollbar")}}},I=Object(l.useMemo)((function(){return O?[].concat(Object(s.a)(a),[D]):a}),[O,a]),M=Object(l.useMemo)((function(){return O?[].concat(Object(s.a)(o),[D]):o}),[O,o]),P=Object(l.useMemo)((function(){var t=d.right,e=d.left;return Object(n.a)(Object(n.a)({},d),{},{left:"rtl"===f?[].concat(Object(s.a)(e.map((function(t){return t+O}))),[0]):e,right:"rtl"===f?t:[].concat(Object(s.a)(t.map((function(t){return t+O}))),[0]),isSticky:x})}),[O,d,x]),N=function(t,e){return Object(l.useMemo)((function(){for(var i=[],r=0;r<e;r+=1){var n=t[r];if(void 0===n)return null;i[r]=n}return i}),[t.join("_"),e])}(c,h);return l.createElement("div",{style:Object(n.a)({overflow:"hidden"},x?{top:g}:{}),ref:R,className:u()("".concat(k,"-header"),Object(r.a)({},v,!!v))},l.createElement("table",{style:{tableLayout:"fixed",visibility:i||N?null:"hidden"}},l.createElement(A,{colWidths:N?[].concat(Object(s.a)(N),[O]):[],columCount:h+1,columns:M}),l.createElement(T,Object.assign({},E,{stickyOffsets:P,columns:I,flattenColumns:M}))))}));L.displayName="FixedHeader";var R=L,_=l.createContext(null);var D=function(t){var e=t.prefixCls,i=t.children,r=t.component,n=t.cellComponent,s=t.fixHeader,a=t.fixColumn,o=t.horizonScroll,c=t.className,u=t.expanded,h=t.componentWidth,d=t.colSpan,f=l.useContext(S.a).scrollbarSize;return l.useMemo((function(){var t=i;return a&&(t=l.createElement("div",{style:{width:h-(s?f:0),position:"sticky",left:0,overflow:"hidden"},className:"".concat(e,"-expanded-row-fixed")},t)),l.createElement(r,{className:c,style:{display:u?null:"none"}},l.createElement(E.a,{component:n,prefixCls:e,colSpan:d},t))}),[i,r,s,o,c,u,h,d,f])};function I(t){var e=t.className,i=t.style,r=t.record,s=t.index,a=t.rowKey,c=t.getRowKey,h=t.rowExpandable,d=t.expandedKeys,f=t.onRow,p=t.indent,g=void 0===p?0:p,v=t.rowComponent,m=t.cellComponent,y=t.childrenColumnName,b=l.useContext(S.a),C=b.prefixCls,w=b.fixedInfoList,x=l.useContext(_),T=x.fixHeader,O=x.fixColumn,A=x.horizonScroll,L=x.componentWidth,R=x.flattenColumns,M=x.expandableType,P=x.expandRowByClick,N=x.onTriggerExpand,j=x.rowClassName,B=x.expandedRowClassName,F=x.indentSize,U=x.expandIcon,G=x.expandedRowRender,H=x.expandIconColumnIndex,z=l.useState(!1),V=Object(o.a)(z,2),K=V[0],W=V[1],Y=d&&d.has(t.recordKey);l.useEffect((function(){Y&&W(!0)}),[Y]);var X,q="row"===M&&(!h||h(r)),$="nest"===M,J=y&&r&&r[y],Q=q||$;f&&(X=f(r,s));var Z;"string"==typeof j?Z=j:"function"==typeof j&&(Z=j(r,s,g));var tt,et,it=Object(k.a)(R),rt=l.createElement(v,Object.assign({},X,{"data-row-key":a,className:u()(e,"".concat(C,"-row"),"".concat(C,"-row-level-").concat(g),Z,X&&X.className),style:Object(n.a)(Object(n.a)({},i),X?X.style:null),onClick:function(t){if(P&&Q&&N(r,t),X&&X.onClick){for(var e,i=arguments.length,n=new Array(i>1?i-1:0),s=1;s<i;s++)n[s-1]=arguments[s];(e=X).onClick.apply(e,[t].concat(n))}}}),R.map((function(t,e){var i,n,a=t.render,o=t.dataIndex,c=t.className,u=it[e],h=w[e];return e===(H||0)&&$&&(i=l.createElement(l.Fragment,null,l.createElement("span",{style:{paddingLeft:"".concat(F*g,"px")},className:"".concat(C,"-row-indent indent-level-").concat(g)}),U({prefixCls:C,expanded:Y,expandable:J,record:r,onExpand:N}))),t.onCell&&(n=t.onCell(r,s)),l.createElement(E.a,Object.assign({className:c,ellipsis:t.ellipsis,align:t.align,component:m,prefixCls:C,key:u,record:r,index:s,dataIndex:o,render:a,shouldCellUpdate:t.shouldCellUpdate},h,{appendNode:i,additionalProps:n}))})));if(q&&(K||Y)){var nt=G(r,s,g+1,Y),st=B&&B(r,s,g);tt=l.createElement(D,{expanded:Y,className:u()("".concat(C,"-expanded-row"),"".concat(C,"-expanded-row-level-").concat(g+1),st),prefixCls:C,fixHeader:T,fixColumn:O,horizonScroll:A,component:v,componentWidth:L,cellComponent:m,colSpan:R.length},nt)}return J&&Y&&(et=(r[y]||[]).map((function(e,i){var r=c(e,i);return l.createElement(I,Object.assign({},t,{key:r,rowKey:r,record:e,recordKey:r,index:i,indent:g+1}))}))),l.createElement(l.Fragment,null,rt,tt,et)}I.displayName="BodyRow";var M=I,P=l.createContext(null);function N(t){var e=t.columnKey,i=t.onColumnResize,r=l.useRef();return l.useEffect((function(){r.current&&i(e,r.current.offsetWidth)}),[]),l.createElement(p.a,{onResize:function(t){var r=t.offsetWidth;i(e,r)}},l.createElement("td",{ref:r,style:{padding:0,border:0,height:0}},l.createElement("div",{style:{height:0,overflow:"hidden"}}," ")))}var j=l.memo((function(t){var e=t.data,i=t.getRowKey,r=t.measureColumnWidth,n=t.expandedKeys,s=t.onRow,a=t.rowExpandable,o=t.emptyNode,c=t.childrenColumnName,u=l.useContext(P).onColumnResize,h=l.useContext(S.a),d=h.prefixCls,f=h.getComponent,p=l.useContext(_),g=p.fixHeader,v=p.horizonScroll,m=p.flattenColumns,y=p.componentWidth;return l.useMemo((function(){var t,h=f(["body","wrapper"],"tbody"),p=f(["body","row"],"tr"),b=f(["body","cell"],"td");t=e.length?e.map((function(t,e){var r=i(t,e);return l.createElement(M,{key:r,rowKey:r,record:t,recordKey:r,index:e,rowComponent:p,cellComponent:b,expandedKeys:n,onRow:s,getRowKey:i,rowExpandable:a,childrenColumnName:c})})):l.createElement(D,{expanded:!0,className:"".concat(d,"-placeholder"),prefixCls:d,fixHeader:g,fixColumn:v,horizonScroll:v,component:p,componentWidth:y,cellComponent:b,colSpan:m.length},o);var E=Object(k.a)(m);return l.createElement(h,{className:"".concat(d,"-tbody")},r&&l.createElement("tr",{"aria-hidden":"true",className:"".concat(d,"-measure-row"),style:{height:0}},E.map((function(t){return l.createElement(N,{key:t,columnKey:t,onColumnResize:u})}))),t)}),[e,d,s,r,n,i,f,y,o,m])}));j.displayName="Body";var B=j,F=i("wRmb"),U=i("xEkU"),G=i.n(U);function H(t){var e=Object(l.useRef)(t),i=Object(l.useState)({}),r=Object(o.a)(i,2)[1],n=Object(l.useRef)(null),s=Object(l.useRef)([]);return Object(l.useEffect)((function(){return function(){G.a.cancel(n.current)}}),[]),[e.current,function(t){null===n.current&&(s.current=[],n.current=G()((function(){s.current.forEach((function(t){e.current=t(e.current)})),n.current=null,r({})}))),s.current.push(t)}]}var z=function(t,e,i){return Object(l.useMemo)((function(){for(var r=[],n=[],s=0,a=0,o=0;o<e;o+=1)if("rtl"===i){n[o]=a,a+=t[o]||0;var l=e-o-1;r[l]=s,s+=t[l]||0}else{r[o]=s,s+=t[o]||0;var c=e-o-1;n[c]=a,a+=t[c]||0}return{left:r,right:n}}),[t,e,i])};var V=function(t){var e=t.className,i=t.children;return l.createElement("div",{className:e},i)},K=i("n6Qo");function W(t){var e,i=t.prefixCls,n=t.record,s=t.onExpand,a=t.expanded,o=t.expandable,c="".concat(i,"-row-expand-icon");if(!o)return l.createElement("span",{className:u()(c,"".concat(i,"-row-spaced"))});return l.createElement("span",{className:u()(c,(e={},Object(r.a)(e,"".concat(i,"-row-expanded"),a),Object(r.a)(e,"".concat(i,"-row-collapsed"),!a),e)),onClick:function(t){s(n,t),t.stopPropagation()}})}var Y=i("zT1h"),X=i("y0+3"),q=l.forwardRef((function(t,e){var i,s,a=t.scrollBodyRef,c=t.onScroll,h=t.offsetScroll,d=l.useContext(S.a).prefixCls,f=(null===(i=a.current)||void 0===i?void 0:i.scrollWidth)||0,p=(null===(s=a.current)||void 0===s?void 0:s.clientWidth)||0,v=f&&p*(p/f),m=l.useRef(),y=H({scrollLeft:0,isHiddenScrollBar:!1}),b=Object(o.a)(y,2),E=b[0],C=b[1],k=l.useRef({delta:0,x:0}),w=l.useState(!1),x=Object(o.a)(w,2),T=x[0],O=x[1],A=function(){O(!1)},L=function(t){var e,i=(t||(null===(e=window)||void 0===e?void 0:e.event)).buttons;if(T&&0!==i){var r=k.current.x+t.pageX-k.current.x-k.current.delta;r<=0&&(r=0),r+v>=p&&(r=p-v),c({scrollLeft:r/p*(f+2)}),k.current.x=t.pageX}else T&&O(!1)},R=function(){var t=Object(X.b)(a.current).top,e=t+a.current.offsetHeight,i=document.documentElement.scrollTop+window.innerHeight;e-Object(g.a)()<=i||t>=i-h?C((function(t){return Object(n.a)(Object(n.a)({},t),{},{isHiddenScrollBar:!0})})):C((function(t){return Object(n.a)(Object(n.a)({},t),{},{isHiddenScrollBar:!1})}))},_=function(t){C((function(e){return Object(n.a)(Object(n.a)({},e),{},{scrollLeft:t/f*p||0})}))};return l.useImperativeHandle(e,(function(){return{setScrollLeft:_}})),l.useEffect((function(){var t=Object(Y.a)(document.body,"mouseup",A,!1),e=Object(Y.a)(document.body,"mousemove",L,!1);return R(),function(){t.remove(),e.remove()}}),[v,T]),l.useEffect((function(){var t=Object(Y.a)(window,"scroll",R,!1),e=Object(Y.a)(window,"resize",R,!1);return function(){t.remove(),e.remove()}}),[]),l.useEffect((function(){E.isHiddenScrollBar||C((function(t){var e,i;return Object(n.a)(Object(n.a)({},t),{},{scrollLeft:a.current.scrollLeft/(null===(e=a.current)||void 0===e?void 0:e.scrollWidth)*(null===(i=a.current)||void 0===i?void 0:i.clientWidth)})}))}),[E.isHiddenScrollBar]),f<=p||!v||E.isHiddenScrollBar?null:l.createElement("div",{style:{height:Object(g.a)(),width:p,bottom:h},className:"".concat(d,"-sticky-scroll")},l.createElement("div",{onMouseDown:function(t){t.persist(),k.current.delta=t.pageX-E.scrollLeft,k.current.x=0,O(!0),t.preventDefault()},ref:m,className:u()("".concat(d,"-sticky-scroll-bar"),Object(r.a)({},"".concat(d,"-sticky-scroll-bar-active"),T)),style:{width:"".concat(v,"px"),transform:"translate3d(".concat(E.scrollLeft,"px, 0, 0)")}}))}));var $=[],J={},Q="rc-table-internal-hook",Z=l.memo((function(t){return t.children}),(function(t,e){return!!d()(t.props,e.props)&&(t.pingLeft!==e.pingLeft||t.pingRight!==e.pingRight)}));function tt(t){var e,i=t.prefixCls,c=t.className,h=t.rowClassName,d=t.style,v=t.data,m=t.rowKey,y=t.scroll,b=t.tableLayout,E=t.direction,w=t.title,x=t.footer,L=t.summary,D=t.id,I=t.showHeader,M=t.components,N=t.emptyText,j=t.onRow,U=t.onHeaderRow,G=t.internalHooks,Y=t.transformColumns,X=t.internalRefs,tt=t.sticky,et=v||$,it=!!et.length,rt=l.useState(0),nt=Object(o.a)(rt,2),st=nt[0],at=nt[1];l.useEffect((function(){at(Object(g.a)())}));var ot,lt,ct,ut=l.useMemo((function(){return Object(k.c)(M,{})}),[M]),ht=l.useCallback((function(t,e){return Object(k.b)(ut,t)||e}),[ut]),dt=l.useMemo((function(){return"function"==typeof m?m:function(t){return t&&t[m]}}),[m]),ft=Object(O.c)(t),pt=ft.expandIcon,gt=ft.expandedRowKeys,vt=ft.defaultExpandedRowKeys,mt=ft.defaultExpandAllRows,yt=ft.expandedRowRender,bt=ft.onExpand,Et=ft.onExpandedRowsChange,St=ft.expandRowByClick,Ct=ft.rowExpandable,kt=ft.expandIconColumnIndex,wt=ft.expandedRowClassName,xt=ft.childrenColumnName,Tt=ft.indentSize,Ot=pt||W,At=xt||"children",Lt=l.useMemo((function(){return yt?"row":!!(t.expandable&&G===Q&&t.expandable.__PARENT_RENDER_ICON__||et.some((function(t){return t&&"object"===Object(a.a)(t)&&t[At]})))&&"nest"}),[!!yt,et]),Rt=l.useState((function(){return vt||(mt?function(t,e,i){var r=[];return function t(n){(n||[]).forEach((function(n,s){r.push(e(n,s)),t(n[i])}))}(t),r}(et,dt,At):[])})),_t=Object(o.a)(Rt,2),Dt=_t[0],It=_t[1],Mt=l.useMemo((function(){return new Set(gt||Dt||[])}),[gt,Dt]),Pt=l.useCallback((function(t){var e,i=dt(t,et.indexOf(t)),r=Mt.has(i);r?(Mt.delete(i),e=Object(s.a)(Mt)):e=[].concat(Object(s.a)(Mt),[i]),It(e),bt&&bt(!r,t),Et&&Et(e)}),[dt,Mt,et,bt,Et]),Nt=l.useState(0),jt=Object(o.a)(Nt,2),Bt=jt[0],Ft=jt[1],Ut=Object(F.b)(Object(n.a)(Object(n.a)(Object(n.a)({},t),ft),{},{expandable:!!yt,expandedKeys:Mt,getRowKey:dt,onTriggerExpand:Pt,expandIcon:Ot,expandIconColumnIndex:kt,direction:E}),G===Q?Y:null),Gt=Object(o.a)(Ut,2),Ht=Gt[0],zt=Gt[1],Vt=l.useMemo((function(){return{columns:Ht,flattenColumns:zt}}),[Ht,zt]),Kt=l.useRef(),Wt=l.useRef(),Yt=l.useRef(),Xt=l.useState(!1),qt=Object(o.a)(Xt,2),$t=qt[0],Jt=qt[1],Qt=l.useState(!1),Zt=Object(o.a)(Qt,2),te=Zt[0],ee=Zt[1],ie=H(new Map),re=Object(o.a)(ie,2),ne=re[0],se=re[1],ae=Object(k.a)(zt).map((function(t){return ne.get(t)})),oe=l.useMemo((function(){return ae}),[ae.join("_")]),le=z(oe,zt.length,E),ce=y&&Object(k.d)(y.y),ue=y&&Object(k.d)(y.x),he=ue&&zt.some((function(t){return t.fixed})),de=l.useRef(),fe=function(t,e){return l.useMemo((function(){var i=!!t;return{isSticky:i,stickyClassName:i?"".concat(e,"-sticky-header"):"",offsetHeader:"object"===Object(a.a)(t)&&t.offsetHeader||0,offsetScroll:"object"===Object(a.a)(t)&&t.offsetScroll||0}}),[t,e])}(tt,i),pe=fe.isSticky,ge=fe.offsetHeader,ve=fe.offsetScroll,me=fe.stickyClassName;ce&&(lt={overflowY:"scroll",maxHeight:y.y}),ue&&(ot={overflowX:"auto"},ce||(lt={overflowY:"hidden"}),ct={width:!0===y.x?"auto":y.x,minWidth:"100%"});var ye=l.useCallback((function(t,e){se((function(i){var r=new Map(i);return r.set(t,e),r}))}),[]),be=function(t){var e=Object(l.useRef)(t),i=Object(l.useRef)(null);function r(){window.clearTimeout(i.current)}return Object(l.useEffect)((function(){return r}),[]),[function(t){e.current=t,r(),i.current=window.setTimeout((function(){e.current=null,i.current=null}),100)},function(){return e.current}]}(null),Ee=Object(o.a)(be,2),Se=Ee[0],Ce=Ee[1];function ke(t,e){e&&("function"==typeof e?e(t):e.scrollLeft!==t&&(e.scrollLeft=t))}var we=function(t){var e,i=t.currentTarget,r=t.scrollLeft,n="number"==typeof r?r:i.scrollLeft,s=i||J;Ce()&&Ce()!==s||(Se(s),ke(n,Wt.current),ke(n,Yt.current),ke(n,null===(e=de.current)||void 0===e?void 0:e.setScrollLeft));if(i){var a=i.scrollWidth,o=i.clientWidth;Jt(n>0),ee(n<a-o)}},xe=function(){Yt.current&&we({currentTarget:Yt.current})};l.useEffect((function(){return xe}),[]),l.useEffect((function(){ue&&xe()}),[ue]),l.useEffect((function(){G===Q&&X&&(X.body.current=Yt.current)}));var Te,Oe,Ae=ht(["table"],"table"),Le=l.useMemo((function(){return b||(he?"max-content"===y.x?"auto":"fixed":ce||zt.some((function(t){return t.ellipsis}))?"fixed":"auto")}),[ce,he,zt,b]),Re={colWidths:oe,columCount:zt.length,stickyOffsets:le,onHeaderRow:U,fixHeader:ce},_e=l.useMemo((function(){return it?null:"function"==typeof N?N():N}),[it,N]),De=l.createElement(B,{data:et,measureColumnWidth:ce||ue||pe,expandedKeys:Mt,rowExpandable:Ct,getRowKey:dt,onRow:j,emptyNode:_e,childrenColumnName:At}),Ie=l.createElement(A,{colWidths:zt.map((function(t){return t.width})),columns:zt}),Me=L&&l.createElement(K.b,null,L(et)),Pe=ht(["body"]);ce||pe?("function"==typeof Pe?(Oe=Pe(et,{scrollbarSize:st,ref:Yt,onScroll:we}),Re.colWidths=zt.map((function(t,e){var i=t.width,r=e===Ht.length-1?i-st:i;return"number"!=typeof r||Number.isNaN(r)?(Object(f.a)(!1,"When use `components.body` with render props. Each column should have a fixed value."),0):r}))):Oe=l.createElement("div",{style:Object(n.a)(Object(n.a)({},ot),lt),onScroll:we,ref:Yt,className:u()("".concat(i,"-body"))},l.createElement(Ae,{style:Object(n.a)(Object(n.a)({},ct),{},{tableLayout:Le})},Ie,De,Me),pe&&l.createElement(q,{ref:de,offsetScroll:ve,scrollBodyRef:Yt,onScroll:we})),Te=l.createElement(l.Fragment,null,!1!==I&&l.createElement(R,Object.assign({noData:!et.length},Re,Vt,{direction:E,offsetHeader:ge,stickyClassName:me,ref:Wt,onScroll:we})),Oe)):Te=l.createElement("div",{style:Object(n.a)(Object(n.a)({},ot),lt),className:u()("".concat(i,"-content")),onScroll:we,ref:Yt},l.createElement(Ae,{style:Object(n.a)(Object(n.a)({},ct),{},{tableLayout:Le})},Ie,!1!==I&&l.createElement(T,Object.assign({},Re,Vt)),De,Me));var Ne=Object(O.b)(t),je=l.createElement("div",Object.assign({className:u()(i,c,(e={},Object(r.a)(e,"".concat(i,"-rtl"),"rtl"===E),Object(r.a)(e,"".concat(i,"-ping-left"),$t),Object(r.a)(e,"".concat(i,"-ping-right"),te),Object(r.a)(e,"".concat(i,"-layout-fixed"),"fixed"===b),Object(r.a)(e,"".concat(i,"-fixed-header"),ce),Object(r.a)(e,"".concat(i,"-fixed-column"),he),Object(r.a)(e,"".concat(i,"-scroll-horizontal"),ue),Object(r.a)(e,"".concat(i,"-has-fix-left"),zt[0]&&zt[0].fixed),Object(r.a)(e,"".concat(i,"-has-fix-right"),zt[zt.length-1]&&"right"===zt[zt.length-1].fixed),e)),style:d,id:D,ref:Kt},Ne),l.createElement(Z,{pingLeft:$t,pingRight:te,props:Object(n.a)(Object(n.a)({},t),{},{stickyOffsets:le,mergedExpandedKeys:Mt})},w&&l.createElement(V,{className:"".concat(i,"-title")},w(et)),l.createElement("div",{className:"".concat(i,"-container")},Te),x&&l.createElement(V,{className:"".concat(i,"-footer")},x(et))));ue&&(je=l.createElement(p.a,{onResize:function(t){var e=t.width;xe(),Ft(Kt.current?Kt.current.offsetWidth:e)}},je));var Be=l.useMemo((function(){return{prefixCls:i,getComponent:ht,scrollbarSize:st,direction:E,fixedInfoList:zt.map((function(t,e){return C(e,e,zt,le,E)})),isSticky:pe}}),[i,ht,st,E,zt,le,E,pe]),Fe=l.useMemo((function(){return Object(n.a)(Object(n.a)({},Vt),{},{tableLayout:Le,rowClassName:h,expandedRowClassName:wt,componentWidth:Bt,fixHeader:ce,fixColumn:he,horizonScroll:ue,expandIcon:Ot,expandableType:Lt,expandRowByClick:St,expandedRowRender:yt,onTriggerExpand:Pt,expandIconColumnIndex:kt,indentSize:Tt})}),[Vt,Le,h,wt,Bt,ce,he,ue,Ot,Lt,St,yt,Pt,kt,Tt]),Ue=l.useMemo((function(){return{onColumnResize:ye}}),[ye]);return l.createElement(S.a.Provider,{value:Be},l.createElement(_.Provider,{value:Fe},l.createElement(P.Provider,{value:Ue},je)))}tt.Column=m.a,tt.ColumnGroup=v.a,tt.Summary=K.a,tt.defaultProps={rowKey:"key",prefixCls:"rc-table",emptyText:function(){return"No Data"}};e.b=tt},wRmb:
/*!******************************************************!*\
!*** ./node_modules/rc-table/es/hooks/useColumns.js ***!
\******************************************************/
/*! exports provided: convertChildrenToColumns, default */
/*! exports used: convertChildrenToColumns, default */function(t,e,i){"use strict";i.d(e,"a",(function(){return u}));var r=i(/*! @babel/runtime/helpers/esm/defineProperty */"rePB"),n=i(/*! @babel/runtime/helpers/esm/toConsumableArray */"KQm4"),s=i(/*! @babel/runtime/helpers/esm/objectSpread2 */"VTBJ"),a=i(/*! @babel/runtime/helpers/esm/objectWithoutProperties */"Ff2n"),o=i(/*! react */"q1tI"),l=(i(/*! rc-util/es/warning */"Kwbf"),i(/*! rc-util/es/Children/toArray */"Zm9Q")),c=i(/*! ../utils/legacyUtil */"hW8S");function u(t){return Object(l.a)(t).filter((function(t){return o.isValidElement(t)})).map((function(t){var e=t.key,i=t.props,r=i.children,n=Object(a.a)(i,["children"]),o=Object(s.a)({key:e},n);return r&&(o.children=u(r)),o}))}function h(t){return t.reduce((function(t,e){var i=e.fixed,r=!0===i?"left":i,a=e.children;return a&&a.length>0?[].concat(Object(n.a)(t),Object(n.a)(h(a).map((function(t){return Object(s.a)({fixed:r},t)})))):[].concat(Object(n.a)(t),[Object(s.a)(Object(s.a)({},e),{},{fixed:r})])}),[])}e.b=function(t,e){var i=t.prefixCls,n=t.columns,l=t.children,d=t.expandable,f=t.expandedKeys,p=t.getRowKey,g=t.onTriggerExpand,v=t.expandIcon,m=t.rowExpandable,y=t.expandIconColumnIndex,b=t.direction,E=t.expandRowByClick,S=o.useMemo((function(){return n||u(l)}),[n,l]),C=o.useMemo((function(){if(d){var t,e=y||0,n=S[e],s=(t={},Object(r.a)(t,c.a,{className:"".concat(i,"-expand-icon-col")}),Object(r.a)(t,"title",""),Object(r.a)(t,"fixed",n?n.fixed:null),Object(r.a)(t,"className","".concat(i,"-row-expand-icon-cell")),Object(r.a)(t,"render",(function(t,e,r){var n=p(e,r),s=f.has(n),a=!m||m(e),l=v({prefixCls:i,expanded:s,expandable:a,record:e,onExpand:g});return E?o.createElement("span",{onClick:function(t){return t.stopPropagation()}},l):l})),t),a=S.slice();return e>=0&&a.splice(e,0,s),a}return S}),[d,S,p,f,v,b]),k=o.useMemo((function(){var t=C;return e&&(t=e(t)),t.length||(t=[{render:function(){return null}}]),t}),[e,C,b]),w=o.useMemo((function(){return"rtl"===b?function(t){return t.map((function(t){var e=t.fixed,i=Object(a.a)(t,["fixed"]),r=e;return"left"===e?r="right":"right"===e&&(r="left"),Object(s.a)({fixed:r},i)}))}(h(k)):h(k)}),[k,b]);return[k,w]}},wwSX:
/*!*******************************************!*\
!*** ./src/assets/images/question/b2.svg ***!
\*******************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,i){t.exports=i.p+"static/b2.2c844a2a.svg"},"y0+3":
/*!********************************************!*\
!*** ./node_modules/rc-util/es/Dom/css.js ***!
\********************************************/
/*! exports provided: get, set, getOuterWidth, getOuterHeight, getDocSize, getClientSize, getScroll, getOffset */
/*! exports used: getClientSize, getOffset */function(t,e,i){"use strict";i.d(e,"a",(function(){return r})),i.d(e,"b",(function(){return n}));function r(){return{width:document.documentElement.clientWidth,height:window.innerHeight||document.documentElement.clientHeight}}function n(t){var e=t.getBoundingClientRect(),i=document.documentElement;return{left:e.left+(window.pageXOffset||i.scrollLeft)-(i.clientLeft||document.body.clientLeft||0),top:e.top+(window.pageYOffset||i.scrollTop)-(i.clientTop||document.body.clientTop||0)}}},y3Jh:
/*!********************************************!*\
!*** ./src/pages/Question/Index/index.tsx ***!
\********************************************/
/*! exports provided: default */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: ./src/.umi-production/core/routes.ts (referenced with import()) */function(t,e,i){"use strict";i.r(e);i(/*! antd/es/carousel/style */"fV52");var r=i(/*! antd/es/carousel */"3I+P"),n=(i(/*! antd/es/table/style */"g9YV"),i(/*! antd/es/table */"wCAj")),s=(i(/*! antd/es/tabs/style */"Znn+"),i(/*! antd/es/tabs */"ZTPi")),a=(i(/*! antd/es/input/style */"5NDa"),i(/*! antd/es/input */"5rEg")),o=(i(/*! antd/es/select/style */"OaEy"),i(/*! antd/es/select */"2fM7")),l=(i(/*! antd/es/menu/style */"lUTK"),i(/*! antd/es/menu */"BvKs")),c=(i(/*! antd/es/modal/style */"2qtc"),i(/*! antd/es/modal */"kLXV")),u=(i(/*! antd/es/message/style */"miYZ"),i(/*! antd/es/message */"tsqr")),h=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2 */"k1fw"),d=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/toConsumableArray */"oBTY"),f=(i(/*! antd/es/button/style */"+L6B"),i(/*! antd/es/button */"2/Rp")),p=(i(/*! antd/es/dropdown/style */"qVdP"),i(/*! antd/es/dropdown */"jsC+")),g=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/asyncToGenerator */"9og8"),v=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray */"tJVT"),m=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties */"PpiC"),y=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/regenerator */"WmNS"),b=i.n(y),E=i(/*! react */"q1tI"),S=i.n(E),C=i(/*! umi */"Ty5D"),k=i(/*! umi */"9kvl"),w=i(/*! @/components/RenderHtml */"9Bee"),x=i(/*! moment */"wd/R"),T=i.n(x),O=i(/*! @/utils/env */"m3rI"),A=i(/*! @/utils/fetch */"ErOA"),L=i(/*! ./index.less?modules */"5A5F"),R=i.n(L),_=i(/*! @/utils/authority */"xKgJ"),D=i(/*! @/assets/images/question/v.svg */"zqRK"),I=i.n(D),M=i(/*! @/assets/images/question/a.svg */"uf8j"),P=i.n(M),N=i(/*! @/assets/images/question/b.svg */"yR49"),j=i.n(N),B=i(/*! @/assets/images/question/c.svg */"3SPk"),F=i.n(B),U=i(/*! @/assets/images/question/a1.svg */"eZjB"),G=i.n(U),H=i(/*! @/assets/images/question/a2.svg */"t6v1"),z=i.n(H),V=i(/*! @/assets/images/question/b1.svg */"+92d"),K=i.n(V),W=i(/*! @/assets/images/question/b2.svg */"wwSX"),Y=i.n(W),X=i(/*! @/assets/images/question/b3.svg */"zlzj"),q=i.n(X),$=i(/*! @/assets/images/question/dau.svg */"+RDj"),J=i.n($),Q=i(/*! lodash */"LvDl"),Z=i.n(Q),tt=i(/*! @/utils/util */"1vsH"),et=i(/*! @/assets/images/pclose.png */"yDOu"),it=i.n(et);e.default=Object(k.a)((function(t){return{user:t.user,globalSetting:t.globalSetting}}))((function(t){var e,i,y,x,L,D,M,N,B,U,H,V,W,X,$,Q,et,rt=t.globalSetting,nt=t.user,st=t.dispatch,at=(Object(m.a)(t,["globalSetting","user","dispatch"]),Object(C.h)()),ot={page:1,per_page:30,tag_discipline_id:[-1],source_discipline_id:[-1],status:null,difficulty:null,search:"",save_search:"",sort_by:null,sort_direction:null,filter:(null==at||null===(e=at.query)||void 0===e?void 0:e.tab)||"public"},lt=Object(E.useState)(0),ct=Object(v.a)(lt,2),ut=ct[0],ht=ct[1],dt=Object(E.useState)(0),ft=Object(v.a)(dt,2),pt=ft[0],gt=ft[1],vt=Object(E.useState)(0),mt=Object(v.a)(vt,2),yt=mt[0],bt=mt[1],Et=Object(E.useState)([]),St=Object(v.a)(Et,2),Ct=St[0],kt=St[1],wt=Object(E.useState)([]),xt=Object(v.a)(wt,2),Tt=xt[0],Ot=xt[1],At=Object(E.useState)({}),Lt=Object(v.a)(At,2),Rt=Lt[0],_t=Lt[1],Dt=Object(E.useState)(!1),It=Object(v.a)(Dt,2),Mt=It[0],Pt=It[1],Nt=Object(E.useState)([]),jt=Object(v.a)(Nt,2),Bt=jt[0],Ft=jt[1],Ut=Object(E.useState)(!0),Gt=Object(v.a)(Ut,2),Ht=Gt[0],zt=Gt[1],Vt=Object(E.useState)(null),Kt=Object(v.a)(Vt,2),Wt=Kt[0],Yt=Kt[1],Xt=Object(E.useState)(ot),qt=Object(v.a)(Xt,2),$t=qt[0],Jt=qt[1],Qt=Object(E.useRef)(null),Zt=Object(E.useRef)(null),te=Object(E.useState)([]),ee=Object(v.a)(te,2),ie=ee[0],re=ee[1],ne=Object(E.useMemo)((function(){return["not_reviewed","under_review","review_finished"].includes($t.filter)}),[$t.filter]),se=Object(E.useState)(!1),ae=Object(v.a)(se,2),oe=ae[0],le=ae[1],ce=Object(E.useState)(!1),ue=Object(v.a)(ce,2),he=ue[0],de=ue[1],fe=Object(E.useState)(""),pe=Object(v.a)(fe,2),ge=pe[0],ve=pe[1],me=Object(E.useState)([]),ye=Object(v.a)(me,2),be=ye[0],Ee=ye[1],Se=Object(E.useState)(!1),Ce=Object(v.a)(Se,2),ke=Ce[0],we=Ce[1],xe=Object(E.useState)([]),Te=Object(v.a)(xe,2),Oe=Te[0],Ae=Te[1],Le=function(){var t=Object(g.a)(b.a.mark((function t(e,i,r){var n,s,a,o,l;return b.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.persist(),null!=e&&null!==(n=e.target)&&void 0!==n&&null!==(s=n.style)&&void 0!==s&&s.pointerEvents&&(e.target.style.pointerEvents="none"),t.next=4,Object(A.a)("/api/practices/".concat(i.identifier,"/start"),{method:"get"});case 4:if(0!==(null==(l=t.sent)?void 0:l.status)){t.next=10;break}if(!r){t.next=9;break}return Object(tt.Q)("/problems/".concat(null==l?void 0:l.identifier,"/oj/").concat(null==i?void 0:i.identifier,"?tab=3")),t.abrupt("return");case 9:Object(tt.Q)("/problems/".concat(null==l?void 0:l.identifier,"/oj/").concat(null==i?void 0:i.identifier));case 10:null!=e&&null!==(a=e.target)&&void 0!==a&&null!==(o=a.style)&&void 0!==o&&o.pointerEvents&&(e.target.style.pointerEvents="auto");case 11:case"end":return t.stop()}}),t)})));return function(e,i,r){return t.apply(this,arguments)}}();Object(E.useEffect)((function(){var t=T()().add(0,"days").unix(),e=localStorage.getItem("problemsclose");e?t>parseInt(e)&&we(!0):we(!0)}),[]);var Re=["未发布","已公开","未审核","审核中","未公开","未通过"],_e=[{title:"题目名称",dataIndex:"name",ellipsis:!0,render:function(t,e){return S.a.createElement("div",{className:R.a.titleWarp},"mine"===(null==$t?void 0:$t.filter)?S.a.createElement("span",{className:R.a.tag},Re[e.practice_status]):null,S.a.createElement("span",{title:t,className:R.a.hov,onClick:function(t){return Le(t,e)}},t))}},"public"===(null==$t?void 0:$t.filter)?{title:"题解",dataIndex:"solution_count",width:100,sorter:!0,render:function(t,e){return S.a.createElement("span",{style:{display:"flex"}},S.a.createElement("span",{onClick:function(t){return Le(t,e,!0)},className:"current"},t),(null==e?void 0:e.has_video_solution)&&S.a.createElement("img",{className:"ml5",src:I.a}))}}:null,"public"===(null==$t?void 0:$t.filter)?{title:"通过率",dataIndex:"pass_ratio",sorter:!0,width:90}:null,{title:"难度",dataIndex:"difficulty",sorter:!0,align:"center",width:90,render:function(t){return S.a.createElement(S.a.Fragment,null,1===t&&S.a.createElement("span",{className:R.a["btn-style-1"]},"简单"),2===t&&S.a.createElement("span",{className:R.a["btn-style-2"]},"适中"),3===t&&S.a.createElement("span",{className:R.a["btn-style-3"]},"困难"))}},"public"===(null==$t?void 0:$t.filter)?{title:"人数",dataIndex:"user_count",align:"center",sorter:!0,width:80}:null,"public"===(null==$t?void 0:$t.filter)?{title:"状态",dataIndex:"status",width:90,render:function(t,e){return Object(_.p)()?S.a.createElement(S.a.Fragment,null,Wt===(null==e?void 0:e.identifier)?S.a.createElement("span",{className:R.a.hovBtn,onClick:function(t){return Le(t,e)}},"开启刷题"):S.a.createElement(S.a.Fragment,null,0===t&&S.a.createElement("span",{style:{color:"#666666"}},"未开启"),1===t&&S.a.createElement("span",{style:{color:"#666666"}},"进行中"),2===t&&S.a.createElement("span",{style:{color:"#666666"}},"已通过"))):"-"}}:null,"public"!==(null==$t?void 0:$t.filter)?{title:"知识点",dataIndex:"tag_disciplines_name",ellipsis:!0,width:200,render:function(t){return S.a.createElement("span",null,null==t?void 0:t.join("、"))}}:null,"all"===(null==$t?void 0:$t.filter)?{title:"创建者",dataIndex:"creator",ellipsis:!0,width:100}:null,"public"!==(null==$t?void 0:$t.filter)?{title:"更新时间",dataIndex:"updated_at",sorter:!0,width:180}:null,Object(_.v)()?{title:"操作",dataIndex:"action",key:"action",align:"center",width:80,render:function(t,e){return S.a.createElement(p.a,{className:"ml10",overlay:Ve(null==e?void 0:e.identifier,e)},S.a.createElement("span",{style:{cursor:"default"},onClick:function(t){return t.preventDefault()}},S.a.createElement("span",{className:"c-grey-666"},"更多"),S.a.createElement("i",{style:{display:"inline-block",transform:"scale(0.6)",fontSize:12},className:"c-grey-c iconfont icon-xiajiantou1"})))}}:Mt&&"public"!==(null==$t?void 0:$t.filter)?{title:"操作",dataIndex:"action",key:"action",align:"center",width:80,render:function(t,e){return null!=e&&e.is_self&&1!==(null==e?void 0:e.practice_status)?S.a.createElement(p.a,{className:"ml10",overlay:Ke(null==e?void 0:e.identifier,e)},S.a.createElement("span",{style:{cursor:"default"},onClick:function(t){return t.preventDefault()}},S.a.createElement("span",{className:"c-grey-666"},"更多"),S.a.createElement("i",{style:{display:"inline-block",transform:"scale(0.6)",fontSize:12},className:"c-grey-c iconfont icon-xiajiantou1"}))):"-"}}:null].filter((function(t){return!!t})),De=[{title:"题目名称",dataIndex:"name",ellipsis:!0,render:function(t,e){return S.a.createElement("span",{className:R.a.hov,onClick:function(t){return Le(t,e)}},t)}},{title:"难度",dataIndex:"difficulty",sorter:!0,align:"center",width:90,render:function(t){return S.a.createElement(S.a.Fragment,null,1===t&&S.a.createElement("span",{className:R.a["btn-style-1"]},"简单"),2===t&&S.a.createElement("span",{className:R.a["btn-style-2"]},"适中"),3===t&&S.a.createElement("span",{className:R.a["btn-style-3"]},"困难"))}},"not_reviewed"===(null==$t?void 0:$t.filter)?{title:"创建者",dataIndex:"creator",ellipsis:!0,width:100}:{title:"审核者",dataIndex:"reviewer",ellipsis:!0,width:100},"not_reviewed"===(null==$t?void 0:$t.filter)?{title:"发布时间",dataIndex:"submit_time",width:180}:null,"under_review"===(null==$t?void 0:$t.filter)?{title:"开始审核时间",dataIndex:"start_review_time",width:180}:null,"review_finished"===(null==$t?void 0:$t.filter)?{title:"最后审核时间",dataIndex:"review_time",width:180}:null,{title:"操作",dataIndex:"action",key:"action",align:"center",width:120,render:function(t,e){var i;switch(null==$t?void 0:$t.filter){case"under_review":i=S.a.createElement("div",{style:{display:"flex"}},S.a.createElement(f.a,{type:"link",size:"small",onClick:function(t){return Le(t,e)}},"审核"),S.a.createElement(f.a,{type:"link",style:{color:"#666"},size:"small",onClick:function(t){return Ne({e:t,record:e,op:"release"})}},"移出"));break;case"review_finished":i=S.a.createElement(f.a,{type:"link",size:"small",onClick:function(t){le(!0),Ie(e)}},"审核记录");break;default:i=S.a.createElement(f.a,{type:"link",block:!0,onClick:function(t){return Ne({e:t,record:e,op:"claim"})}},"开始审核")}return i}}].filter((function(t){return!!t})),Ie=function(){var t=Object(g.a)(b.a.mark((function t(e){var i;return b.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return Ee([]),t.next=3,Object(A.a)("/api/practices/".concat(e.identifier,"/review_list"),{method:"get"});case 3:i=t.sent,Ee(null==i?void 0:i.reviews_list);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),Me=[{title:"审核时间",dataIndex:"review_time",key:"review_time",render:function(t,e){return S.a.createElement("span",null,T()(t).format("YYYY-MM-DD HH:mm:ss"))}},{title:"审核者",dataIndex:"reviewer",key:"reviewer"},{title:"审核结果",dataIndex:"status",width:120,key:"status",render:function(t,e){return"5"===t||5===t?S.a.createElement("div",{style:{display:"flex",alignItems:"center"}},S.a.createElement("div",{style:{color:"#333333",marginRight:"5px",whiteSpace:"nowrap"}},"未通过"),S.a.createElement("div",{style:{color:"#0152d9",whiteSpace:"nowrap",cursor:"pointer"},onClick:function(){ve(e.description),de(!0)}},"查看原因")):S.a.createElement("span",null,"已通过")}}];Object(E.useEffect)((function(){Be(),Pe($t)}),[]),Object(E.useEffect)((function(){var t;0!==Ct.length&&((null==Qt||null===(t=Qt.current)||void 0===t?void 0:t.clientHeight)>92&&ht(1))}),[Ct]),Object(E.useEffect)((function(){var t;0!==Tt.length&&((null==Zt||null===(t=Zt.current)||void 0===t?void 0:t.clientHeight)>92&&gt(1))}),[Tt]),Object(E.useEffect)((function(){return st({type:"globalSetting/onlyShowBackTopToggle",payload:!0}),st({type:"globalSetting/setShowQuestionBackTop",payload:!0}),function(){st({type:"globalSetting/onlyShowBackTopToggle",payload:!1}),st({type:"globalSetting/setShowQuestionBackTop",payload:!1})}}),[]),Object(E.useEffect)((function(){var t;("人工智能科研服务平台"===document.title||"首页"===document.title||"实践教学平台"===document.title||null!==(t=document.title)&&void 0!==t&&t.includes("img"))&&(document.title="在线刷题")}),[rt]),Object(E.useEffect)((function(){return document.body.setAttribute("data-custom","initial"),function(){document.body.removeAttribute("data-custom")}}),[]);var Pe=function(){var t=Object(g.a)(b.a.mark((function t(e){var i,r,n,s;return b.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(n=Z.a.cloneDeep(e)).tag_discipline_id=null!==(i=n.tag_discipline_id)&&void 0!==i&&i.includes(-1)?[]:n.tag_discipline_id,n.source_discipline_id=null!==(r=n.source_discipline_id)&&void 0!==r&&r.includes(-1)?[]:n.source_discipline_id,console.log(n,"sendData"),zt(!0),Ft([]),t.next=8,Object(A.a)("/api/practices.json",{method:"get",params:n});case 8:s=t.sent,re([]),zt(!1),bt(null==s?void 0:s.practices_count),Ft(null==s?void 0:s.practices_list),Ae((null==s?void 0:s.recommend_subjects)||[]);case 14:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),Ne=function(){var t=Object(g.a)(b.a.mark((function t(e){var i,r,n,s,a,o;return b.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=e.op,r=e.description,n=e.record,s=e.e,a={op:i,description:r},zt(!0),t.next=5,Object(A.a)("/api/practices/".concat(n.identifier,"/review"),{method:"post",body:a});case 5:o=t.sent,zt(!1),"claim"!==i||0!==o.status&&"0"!==o.status||Le(s,n),Pe($t);case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),je=function(){var t=Object(g.a)(b.a.mark((function t(e){return b.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return zt(!0),t.next=3,Object(A.a)("/api/practices/".concat(e.identifier,"/publish"),{method:"post"});case 3:t.sent,zt(!1),Pe($t);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),Be=function(){var t=Object(g.a)(b.a.mark((function t(){var e,i,r,n,s,a;return b.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(A.a)("/api/tag_disciplines.json",{method:"get",params:{target:"practice",position:"index"}});case 2:return i=t.sent,t.next=5,Object(A.a)("/api/tag_disciplines.json",{method:"get",params:{target:"practice_source",position:"index"}});case 5:return r=t.sent,t.next=8,Object(A.a)("/api/mypractices/rank_list",{method:"get",params:{}});case 8:n=t.sent,null!=i&&i.tag_disciplines&&(s=[{id:-1,name:"全部",count:null==i?void 0:i.totalCount}].concat(Object(d.a)(null==i?void 0:i.tag_disciplines)),kt(s)),null!=r&&r.tag_disciplines&&(a=[{id:-1,name:"全部",count:null==r?void 0:r.totalCount}].concat(Object(d.a)(null==r?void 0:r.tag_disciplines)),Ot(a)),_t(n||{}),Pt(null==n||null===(e=n.my_record)||void 0===e?void 0:e.outsource);case 13:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),Fe=function(t,e){var i;$t.page=1;var r=$t["".concat(e,"_discipline_id")];null!==(i=$t["".concat(e,"_discipline_id")])&&void 0!==i&&i.includes(t)?r=r.filter((function(e){return e!==t})):r.push(t),-1===t?r=[-1]:(r=r.filter((function(t){return-1!==t}))).length||(r=[-1]),$t["".concat(e,"_discipline_id")]=r,Jt(Object(h.a)({},$t)),Pe($t)},Ue=function(t,e){$t.page=1,$t[e]="number"==typeof t?t:null,Jt(Object(h.a)({},$t)),Pe($t)},Ge=function(t){$t.page=1,$t.filter=t,$t.status=null,$t.practice_status=null,Jt(Object(h.a)({},$t)),Pe($t)},He=function(t,e){if(0!==(null==e?void 0:e.length)){var i=function(){var i=Object(g.a)(b.a.mark((function i(){var r,n;return b.a.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,Object(A.a)("/api/practices/batch_op.json",{method:"post",body:{identifier:e,op:t}});case 2:0===(null==(r=i.sent)?void 0:r.status)&&(n=1===Bt.length&&1!==$t.page?$t.page-1:$t.page,$t.page=n,Jt(Object(h.a)({},$t)),Pe($t));case 4:case"end":return i.stop()}}),i)})));return function(){return i.apply(this,arguments)}}();-1!==t?i():c.a.confirm({centered:!0,width:500,okText:"确定",cancelText:"取消",title:"删除确认",icon:null,className:"custom-modal-divider",content:"删除后题目将不可再找回。",onOk:i})}else u.b.warn("请选择试题")},ze=S.a.createElement(l.a,null,"public"===(null==$t?void 0:$t.filter)?S.a.createElement(l.a.Item,{onClick:function(){return He(0,ie)}},"批量移出公共"):[S.a.createElement(l.a.Item,{key:2,onClick:function(){return He(1,ie)}},"批量移入公共"),S.a.createElement(l.a.Item,{key:1,onClick:function(){return He(0,ie)}},"批量移出公共")],"public"!==(null==$t?void 0:$t.filter)&&S.a.createElement(l.a.Item,{onClick:function(){return He(-1,ie)}},"批量删除")),Ve=function(t,e){return S.a.createElement(l.a,null,1===(null==e?void 0:e.practice_status)?S.a.createElement(l.a.Item,{onClick:function(){return He(0,[t])}},"移出公共"):S.a.createElement(l.a.Item,{onClick:function(){return He(1,[t])}},"移入公共"),"mine"===(null==$t?void 0:$t.filter)?S.a.createElement(l.a.Item,{onClick:function(){return je(e)},disabled:![0,4,5].includes(e.practice_status)},[0,4,5].includes(e.practice_status)?"发布审核":"已发布审核"):null,S.a.createElement(l.a.Item,{onClick:function(){return Object(tt.Q)("/problems/".concat(t,"/ojedit"))}},"编辑"),"public"!==(null==$t?void 0:$t.filter)&&S.a.createElement(l.a.Item,{onClick:function(){return He(-1,[t])}},"删除"))},Ke=function(t,e){return S.a.createElement(l.a,null,S.a.createElement(l.a.Item,{onClick:function(){return je(e)},disabled:![0,4,5].includes(e.practice_status)},[0,4,5].includes(e.practice_status)?"发布审核":"已发布审核"),S.a.createElement(l.a.Item,{onClick:function(){return Object(tt.Q)("/problems/".concat(t,"/ojedit"))}},"编辑"),S.a.createElement(l.a.Item,{onClick:function(){return He(-1,[t])}},"删除"))},We={selectedRowKeys:ie,columnWidth:40,onChange:function(t){re(t)}};return S.a.createElement("section",{className:R.a.wrap},S.a.createElement("div",{className:R.a.bg},S.a.createElement("div",{className:R.a.btnWrap},S.a.createElement("div",{className:R.a.text},S.a.createElement("span",null,"在线刷题"),S.a.createElement("span",null,"快速提高编程能力")),S.a.createElement(p.a,{className:"ml10",overlay:S.a.createElement(l.a,null,S.a.createElement(l.a.Item,{key:1,onClick:function(){k.d.push("/problems/add")}},"新建题目"),S.a.createElement(l.a.Item,{key:2,onClick:function(){k.d.push("/problems/batchAdd")}},"批量导入题目"))},S.a.createElement("div",{className:R.a.btn,style:{visibility:Object(_.v)()||Mt?"visible":"hidden"}},S.a.createElement("i",{className:"iconfont icon-a-hao font12 mr5"}),S.a.createElement("span",null,"新建题目"))))),S.a.createElement("div",{className:R.a.content},S.a.createElement("div",{className:R.a.left},S.a.createElement("div",{className:R.a.filterPoint},S.a.createElement("div",{className:R.a.btnWarp,ref:Qt,style:ut>0?{height:1===ut?92:"auto"}:{}},null==Ct?void 0:Ct.map((function(t){var e;return S.a.createElement("div",{onClick:function(){return Fe(t.id,"tag")},key:t.id,className:null!=$t&&null!==(e=$t.tag_discipline_id)&&void 0!==e&&e.includes(t.id)?R.a.btnActive:R.a.btn},S.a.createElement("span",{title:t.name},t.name),S.a.createElement("span",{style:{display:t.count?"block":"none"}},t.count))})),!!ut&&S.a.createElement(S.a.Fragment,null,1===ut?S.a.createElement("div",{onClick:function(){return ht(2)},className:R.a.action},"展开",S.a.createElement("i",{style:{transform:"scale(0.7)"},className:"iconfont icon-xiala"})):S.a.createElement("div",{onClick:function(){return ht(1)},className:R.a.action},"收起",S.a.createElement("i",{style:{transform:"rotate(180deg) translateY(1px) scale(0.7)"},className:"iconfont icon-xiala"}))))),!!Tt.length&&S.a.createElement(S.a.Fragment,null,S.a.createElement("div",{className:R.a.line}),S.a.createElement("div",{className:R.a.filterOrigin},S.a.createElement("div",{className:R.a.btnWarp,ref:Zt,style:pt>0?{height:1===pt?92:"auto"}:{}},null==Tt?void 0:Tt.map((function(t){var e;return S.a.createElement("div",{onClick:function(){return Fe(t.id,"source")},key:t.id,className:null!=$t&&null!==(e=$t.source_discipline_id)&&void 0!==e&&e.includes(t.id)?R.a.btnActive:R.a.btn},S.a.createElement("span",{title:t.name},t.name),S.a.createElement("span",null,t.count))})),!!pt&&S.a.createElement(S.a.Fragment,null,1===pt?S.a.createElement("div",{onClick:function(){return gt(2)},className:R.a.action},"展开",S.a.createElement("i",{style:{transform:"scale(0.7)"},className:"iconfont icon-xiala"})):S.a.createElement("div",{onClick:function(){return gt(1)},className:R.a.action},"收起",S.a.createElement("i",{style:{transform:"rotate(180deg) translateY(1px) scale(0.7)"},className:"iconfont icon-xiala"})))))),S.a.createElement("div",{className:R.a.control},S.a.createElement(o.a,{allowClear:!0,placeholder:"难度",value:null==$t?void 0:$t.difficulty,onChange:function(t){return Ue(t,"difficulty")}},S.a.createElement(o.a.Option,{value:1},"简单"),S.a.createElement(o.a.Option,{value:2},"适中"),S.a.createElement(o.a.Option,{value:3},"困难")),Object(_.p)()&&"public"===$t.filter&&S.a.createElement(o.a,{allowClear:!0,placeholder:"状态",value:null==$t?void 0:$t.status,onChange:function(t){return Ue(t,"status")}},S.a.createElement(o.a.Option,{value:0},"未开启"),S.a.createElement(o.a.Option,{value:1},"进行中"),S.a.createElement(o.a.Option,{value:2},"已通过")),Object(_.p)()&&"mine"===$t.filter&&S.a.createElement(o.a,{allowClear:!0,placeholder:"状态",value:null==$t?void 0:$t.practice_status,onChange:function(t){return Ue(t,"practice_status")}},S.a.createElement(o.a.Option,{value:0},"未发布"),S.a.createElement(o.a.Option,{value:1},"已公开"),S.a.createElement(o.a.Option,{value:2},"未审核"),S.a.createElement(o.a.Option,{value:3},"审核中"),S.a.createElement(o.a.Option,{value:4},"未公开"),S.a.createElement(o.a.Option,{value:5},"未通过")),Object(_.p)()&&"all"===$t.filter&&S.a.createElement(o.a,{allowClear:!0,placeholder:"状态",value:null==$t?void 0:$t.practice_status,onChange:function(t){return Ue(t,"practice_status")}},S.a.createElement(o.a.Option,{value:0},"未发布"),S.a.createElement(o.a.Option,{value:1},"已公开"),S.a.createElement(o.a.Option,{value:2},"未审核"),S.a.createElement(o.a.Option,{value:3},"审核中"),S.a.createElement(o.a.Option,{value:4},"未公开"),S.a.createElement(o.a.Option,{value:5},"未通过")),S.a.createElement(a.a.Search,{placeholder:Object(_.v)()?"请输入题目名称、创建者搜索":"请输入题目名称搜索",value:null==$t?void 0:$t.save_search,onChange:function(t){return e=t.target.value,$t.page=1,$t.save_search=e,void Jt(Object(h.a)({},$t));var e},onSearch:function(){$t.page=1,$t.search=$t.save_search,Jt(Object(h.a)({},$t)),Pe($t)}})),S.a.createElement("div",{className:R.a.table},S.a.createElement("div",{className:R.a.tabWarp,style:Object(_.v)()||Mt?{}:{height:10,border:0}},Object(_.v)()?S.a.createElement(s.a,{className:R.a.tab,activeKey:ne?"not_reviewed":$t.filter,onChange:Ge},S.a.createElement(s.a.TabPane,{tab:"公共",key:"public"}),S.a.createElement(s.a.TabPane,{tab:"全部",key:"all"}),S.a.createElement(s.a.TabPane,{tab:"我创建的",key:"mine"}),S.a.createElement(s.a.TabPane,{tab:"审核列表",key:"not_reviewed"})):Mt?S.a.createElement(s.a,{className:R.a.tab,activeKey:ne?"not_reviewed":$t.filter,onChange:Ge},S.a.createElement(s.a.TabPane,{tab:"公共",key:"public"}),S.a.createElement(s.a.TabPane,{tab:"我创建的",key:"mine"}),S.a.createElement(s.a.TabPane,{tab:"审核列表",key:"not_reviewed"})):null,Object(_.v)()&&!ne&&S.a.createElement(p.a,{overlay:ze},S.a.createElement("span",{className:"ant-dropdown-link font14 current",onClick:function(t){return t.preventDefault()}},"批量操作 ",S.a.createElement("i",{style:{display:"inline-block",transform:"scale(0.6)",fontSize:12},className:"iconfont icon-xiajiantou1"})))),ne?S.a.createElement("div",{className:R.a.tabWarp2,style:Object(_.v)()||Mt?{}:{height:10,border:0}},S.a.createElement(s.a,{className:R.a.tab,activeKey:$t.filter,onChange:Ge},S.a.createElement(s.a.TabPane,{tab:"待审核",key:"not_reviewed"}),S.a.createElement(s.a.TabPane,{tab:"审核中",key:"under_review"}),S.a.createElement(s.a.TabPane,{tab:"已审核",key:"review_finished"}))):null,S.a.createElement(n.a,{rowSelection:Object(_.v)()?We:void 0,className:R.a.customTable,dataSource:Bt,bordered:!1,rowKey:function(t){return t.identifier},columns:ne?De:_e,rowClassName:R.a.row,loading:Ht,onRow:function(t){return{onMouseEnter:function(e){Yt(null==t?void 0:t.identifier)},onMouseLeave:function(t){Yt(null)}}},onChange:function(t,e,i){$t.page=null==t?void 0:t.current,$t.per_page=null==t?void 0:t.pageSize,null!=i&&i.order?($t.sort_by=null==i?void 0:i.field,$t.sort_direction="ascend"===(null==i?void 0:i.order)?"asc":"desc"):($t.sort_by=null,$t.sort_direction=null),Jt(Object(h.a)({},$t)),Pe($t)},pagination:{pageSize:$t.per_page,total:yt,current:$t.page,showQuickJumper:!0,hideOnSinglePage:!0,showSizeChanger:!1,position:["bottomCenter"],showTotal:function(t){return S.a.createElement("span",{className:"mr10"},"共",S.a.createElement("span",{className:"c-orange"},t),"条数据")}}}))),S.a.createElement("div",{className:R.a.right},S.a.createElement("div",{className:R.a.title},S.a.createElement("img",{src:Object(_.p)()?O.a.IMG_SERVER+"/images/"+(null==Rt||null===(i=Rt.my_record)||void 0===i?void 0:i.image_url):J.a}),S.a.createElement("span",null,"我的刷题统计")),S.a.createElement("ul",null,S.a.createElement("li",null,S.a.createElement("div",null,S.a.createElement("span",null,"通过率"),Object(_.p)()?S.a.createElement("span",null,(null==Rt||null===(y=Rt.my_record)||void 0===y?void 0:y.passed_ratio)||0,"%"):S.a.createElement("span",null,"-")),S.a.createElement("img",{src:P.a})),S.a.createElement("li",null,S.a.createElement("div",null,S.a.createElement("span",null,"刷题数"),Object(_.p)()?S.a.createElement("span",null,(null==Rt||null===(x=Rt.my_record)||void 0===x?void 0:x.passed_count)||0):S.a.createElement("span",null,"-")),S.a.createElement("img",{src:j.a})),S.a.createElement("li",null,S.a.createElement("div",null,S.a.createElement("span",null,"时长(h)"),Object(_.p)()?S.a.createElement("span",null,null==Rt||null===(L=Rt.my_record)||void 0===L||null===(D=L.time_count)||void 0===D?void 0:D.toFixed(2)):S.a.createElement("span",null,"-")),S.a.createElement("img",{src:F.a}))),!(null==Rt||null===(M=Rt.rank_list)||void 0===M||!M.length)&&S.a.createElement(S.a.Fragment,null,S.a.createElement("div",{className:R.a.line}),2!=(null===(N=nt.userInfo)||void 0===N?void 0:N.user_id)&&Object(_.m)()&&(null==rt||null===(B=rt.setting)||void 0===B?void 0:B.main_site)&&ke&&(null==Oe?void 0:Oe.length)>0&&S.a.createElement("div",{className:R.a.problemsclose,style:{position:"relative"}},S.a.createElement(r.a,{autoplay:!0,pauseOnDotsHover:!0,style:{width:292,height:170,marginBottom:"10px",overflow:"hidden"}},null==Oe?void 0:Oe.map((function(t,e){return S.a.createElement("div",{style:{display:"flex"},key:e},S.a.createElement("a",{href:"/paths/".concat(t.identifier)},S.a.createElement("img",{style:{width:"292px",height:"170px",borderRadius:"4px"},src:O.a.IMG_SERVER+"/"+t.image_url})))}))),S.a.createElement("img",{className:R.a.imgsrc,onClick:function(){localStorage.setItem("problemsclose",T()().add(1,"days").unix()+""),we(!1)},src:it.a})),S.a.createElement("div",{className:R.a.sort},S.a.createElement("div",{className:R.a.titles},S.a.createElement("img",{src:G.a}),S.a.createElement("span",null,"排行榜")),!(null==Rt||null===(U=Rt.my_record)||void 0===U||!U.rank)&&S.a.createElement("div",{className:R.a.li,style:{background:"#D3EAFF"}},S.a.createElement("span",null,S.a.createElement("span",{style:{fontWeight:600,color:"#0152d9"}},(null==Rt||null===(H=Rt.my_record)||void 0===H?void 0:H.rank)>999?"999+":null==Rt||null===(V=Rt.my_record)||void 0===V?void 0:V.rank)),S.a.createElement("img",{className:"ml10 mr10",style:{borderRadius:"50%"},width:26,height:26,src:O.a.IMG_SERVER+"/images/"+(null==Rt||null===(W=Rt.my_record)||void 0===W?void 0:W.image_url)}),S.a.createElement("span",{title:null==Rt||null===(X=Rt.my_record)||void 0===X?void 0:X.nickname,style:{color:"#656F87",maxWidth:96,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"}},null==Rt||null===($=Rt.my_record)||void 0===$?void 0:$.nickname),S.a.createElement("img",{className:"ml10",src:z.a}),S.a.createElement("span",{style:{marginLeft:"auto",color:"#0152d9"}},null==Rt||null===(Q=Rt.my_record)||void 0===Q?void 0:Q.passed_count,"题")),null==Rt||null===(et=Rt.rank_list)||void 0===et?void 0:et.map((function(t,e){var i=e+1;return 0===e&&(i=K.a),1===e&&(i=Y.a),2===e&&(i=q.a),S.a.createElement("div",{className:R.a.li},S.a.createElement("span",null,"number"==typeof i?S.a.createElement("span",{style:{fontWeight:600}},i):S.a.createElement("img",{src:i})),S.a.createElement("img",{className:"ml10 mr10",style:{borderRadius:"50%"},width:26,height:26,src:O.a.IMG_SERVER+"/images/"+(null==t?void 0:t.image_url)}),S.a.createElement("span",{title:null==t?void 0:t.nickname,style:{color:"#656F87",width:96,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"}},null==t?void 0:t.nickname),S.a.createElement("span",{style:{marginLeft:"auto"}},t.passed_count,"题"))})))))),S.a.createElement(c.a,{title:"审核记录",visible:oe,onOk:function(){},onCancel:function(){le(!1)},footer:null,closable:!0},S.a.createElement(n.a,{dataSource:be,columns:Me})),S.a.createElement(c.a,{title:"未通过原因",visible:he,onOk:function(){},onCancel:function(){de(!1)},footer:null,closable:!0},S.a.createElement(w.a,{value:ge})))}))},yDOu:
/*!**************************************!*\
!*** ./src/assets/images/pclose.png ***!
\**************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e){t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABZlJREFUaEPtmd1rXNUah5/1tfdkkrSNMdWO+C0pp6mKYhURURRFvPFGiwj+A4p44Y30pngj5+ZcHET/AUGkeuONiKIoIqJVRO0UDdpzPAen2hhTm2Qye68vWdlOmYQ2M/2gYaQDw2K+f8/7/t53r/WOYMhvYsj1cxFgszN4MQN/mwzEGM8om0KIeD7gz+hH1//getEvvDBYU9i/nzXizwXmrAB6hXdFN3dV4mcOV2urtRam0ahEN3dV68zhau2FORuQMwI4nfAkurUDsXC0Er00j1hZXAswMk4cm6xET+wgNo4SE8y5ggwM0BXfG/Gu8P8fQibBUxOIzjKi2ILY2l4L8EedmJ8g1kaJcwvEBHTlbsLpQAbNxkAA68V/CHJ6B2JV+CRivIWsaWQxhmgfR47VEbZYC2By4lKbWN9GyJeIHUdYbBBG5iuQ2aPEeyH02moQiIEBegpUNkEmm4xpJAVqSSGlQ3UkMpNIbxG1HOFsBaENsVMQlSGWgVALhKDxY55Ajl9yhGSvmQrgJMR5AeiNfor8FMi5/yLHM6TYhpIlatGitnhUO6BkjvIeoQUy+ApAKqKLBKWIocDXJf6Ewo8bfMjw8Th+sSRMXUOYg5Ay0S3ufhB9M5AAUvRTl5lYQCbb6AKVxPtFdNBo4VFRoaNFC4MSAeUE0oQKwEqijoQo8dHihcEJj4sKLx1OjeMShMvxyU4LE4RU3AninAC60d+7Fzkzg/hsHpVsUxh0V7yJGBcxUaJ1gXnwXhq7ruPqiS1sN4aRVQDLysIJjh0+wk/vfkjL5VgRcFpgrcB2IXKLS3a6YxLfbBIPHKjstBHEhhlYH/3Zo6ipY2iboQuPSeJLR6YzzC3TXPLw3dyxZZTLfED5gOy98ClJUMk6y/z69sd89tUsv7sSm2nKBJErrClxc9tx0zvwg2ZhIIBk4xT9ZB2Xo8uAySMGQS4V2f17uOK+27lHCEasR4VkqYg8iRBSFAlS4Y3Cx8jKB5/z0fsH+Tl4SiJFIbCZxOoCl6yUspAKup+NTgtw0j5vIJP3e6MvOmQdQwbkt+3k0kcf4KEYqTuPDin6EeUdSvz17TGC0ngl8FLitcIJQfvN93jni+/5DShqljLWKNdn4cBjG9toQ4Bu8XIYxR+o5P3lZTJtyYQkN4Havqd5cHSERmkxLqC9Q6c1ZSDGqoiFSMVI0BKnNC6tmcEur9B68WXetZJODBTOUI6OUqZaYCueXfh+xdwXoNc+K2BMXkU+3R++k6vvu537O5bMO4x1mD27eWL+OP9pHuEb/gJAEGeu46bJbVx78BCvGY1VGlszlB98zvtvf8pPKQvpbgvKEbCD2mhgAJ+j6w7T7pAhybVg5LknuWvqEnYWJZkLmNKSTV/Fnssv5ZbWHN8e+oFvUwZ238CNjSlu/OU3vpr9HwczQ6klNs8o537n+3+9yicuskKgqNco2wmwwA1SB30BWi3UbImaqqPbEaMyMueoOcHIP5/iESGZtJYsiU8QzmP+cS23JsGtYzQTQGM7MwnouyN8mSxkFGXKgjGUMTD//Cu8pSMrWtPxJWVdYOfauOkM32jgNyrkMwaIgjwEakZTe/FZHneeuvVktiRLLdV7jA/o3ddzcxK+urU+RvPQj3ytUg2oqnWajDKBaEV737953To6UtIRkeLCATzD4y6eI4Cgve+lCwgwdBbqdqGhLeLz2UYntnLll00OXNA2unrWHdYLWeogezdjK5Fa6J3Vhu6stxJJfHc3OpSbuV6A7mFmKLfTqzYa1gPNqbIwVEfKLkBa09Z6KA/164p5dcgwVGOV9VlIj4dusHUqiNSZhma02J0uDPVwt3dEMrTj9V6IXlt1nx+aPzjWg5wK5lTv6X2u38iw3+e7r/edjQ76RZv1vosAmxX5ixba7Mj/bTLwJ/OqjXyXcOSkAAAAAElFTkSuQmCC"},yR49:
/*!******************************************!*\
!*** ./src/assets/images/question/b.svg ***!
\******************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,i){t.exports=i.p+"static/b.3edd9583.svg"},zlzj:
/*!*******************************************!*\
!*** ./src/assets/images/question/b3.svg ***!
\*******************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,i){t.exports=i.p+"static/b3.30079151.svg"},zqRK:
/*!******************************************!*\
!*** ./src/assets/images/question/v.svg ***!
\******************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,i){t.exports=i.p+"static/v.7a1274ca.svg"}}]);