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__Problemset__index.7f1ccd...

330 lines
914 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[190,5,7,8,10],{"+vTd":function(Pt,Ye,W){Pt.exports={flex_box_center:"flex_box_center___37CPQ",flex_space_between:"flex_space_between___1yzV5",flex_box_vertical_center:"flex_box_vertical_center___2QH_C",flex_box_center_end:"flex_box_center_end___22kLi",flex_box_column:"flex_box_column___1Y3On",list:"list___1gpez",row:"row___3uQSh",typeRow:"typeRow___ADZSj",type:"type___2pfNZ",typeName:"typeName___8ZhPv",typeIcon:"typeIcon___1Xniv",unpublished:"unpublished___dTXTI",private:"private___XQiDx",public:"public___iIFou",reviewFlag:"reviewFlag___YP4vk",typeRightAction:"typeRightAction___1PQjp",actionLink:"actionLink___2E5q_",actionIcon:"actionIcon___GCvNK",topicTitle:"topicTitle___3fJds",topicTitleContent:"topicTitleContent___35cf9",judgmentContent:"judgmentContent___SU5rV",programContent:"programContent___3G6-D",otherContent:"otherContent___1JHnX",combinationContent:"combinationContent___6ZXO-",con:"con___1_qCl",otherContentItem:"otherContentItem___18WrV",otehrContentHtml:"otehrContentHtml___LW3nV",difficultyRow:"difficultyRow___3HvT0",updateTimeRow:"updateTimeRow___1dNd0",updateTimeWrap:"updateTimeWrap___2PKks",updateTimeContent:"updateTimeContent___1mNBy",programLanguage:"programLanguage___3CnaJ",updateTimeRowAction:"updateTimeRowAction___1DaMt",bottomAction:"bottomAction___Y-BNC",borderColorBlue:"borderColorBlue___2Xd-0",borderColorRed:"borderColorRed___2zA_q",borderColorFFF:"borderColorFFF___2R5-5",borderColorGray:"borderColorGray___nZnDe",selectIcon:"selectIcon___2byLd",colorGreen:"colorGreen___1iOKR",parseAnswerBorder:"parseAnswerBorder___1LTYn",answer:"answer___2L9lv",answerHtml:"answerHtml___3zrOk",parse:"parse___3d3dm",parseText:"parseText___1C_VL",parseAnswer:"parseAnswer___QMVPC",parseAnswerHtml:"parseAnswerHtml___2TCVz",actionBar:"actionBar___2ItMN",line:"line___-rzSr",know:"know___y8QKK",title:"title___21uOv",tr:"tr___3kTJL",menu:"menu___SYdg7",bottom:"bottom___2dFIa"}},"+z73":function(Pt,Ye,W){Pt.exports={flex_box_center:"flex_box_center___3WSrc",flex_space_between:"flex_space_between___1fpCp",flex_box_vertical_center:"flex_box_vertical_center___3Wy8W",flex_box_center_end:"flex_box_center_end___3YIs2",flex_box_column:"flex_box_column___3CNwR",pWrap:"pWrap___2jVbQ",few:"few___3Eebn"}},"1ZF9":function(Pt,Ye,W){Pt.exports=W.p+"static/Authorize.cc9c212f.png"},"6+eU":function(Pt,Ye,W){"use strict";W.d(Ye,"a",function(){return u});var Ee=W("wx14"),j=W("rePB"),w=W("VTBJ"),N=W("1OyB"),E=W("vuIU"),R=W("Ji7U"),I=W("LK+K"),M=W("q1tI"),T=W.n(M),P=W("TSYQ"),_=W.n(P),S=function(h){var a,r="".concat(h.rootPrefixCls,"-item"),e=_()(r,"".concat(r,"-").concat(h.page),(a={},Object(j.a)(a,"".concat(r,"-active"),h.active),Object(j.a)(a,h.className,!!h.className),Object(j.a)(a,"".concat(r,"-disabled"),!h.page),a)),i=function(){h.onClick(h.page)},v=function(y){h.onKeyPress(y,h.onClick,h.page)};return T.a.createElement("li",{title:h.showTitle?h.page:null,className:e,onClick:i,onKeyPress:v,tabIndex:"0"},h.itemRender(h.page,"page",T.a.createElement("a",{rel:"nofollow"},h.page)))},O=S,C={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},x=function(m){Object(R.a)(a,m);var h=Object(I.a)(a);function a(){var r;Object(N.a)(this,a);for(var e=arguments.length,i=new Array(e),v=0;v<e;v++)i[v]=arguments[v];return r=h.call.apply(h,[this].concat(i)),r.state={goInputText:""},r.buildOptionText=function(f){return"".concat(f," ").concat(r.props.locale.items_per_page)},r.changeSize=function(f){r.props.changeSize(Number(f))},r.handleChange=function(f){r.setState({goInputText:f.target.value})},r.handleBlur=function(f){var y=r.props,t=y.goButton,A=y.quickGo,U=y.rootPrefixCls,F=r.state.goInputText;if(t||F==="")return;if(f.relatedTarget&&(f.relatedTarget.className.indexOf("".concat(U,"-prev"))>=0||f.relatedTarget.className.indexOf("".concat(U,"-next"))>=0))return;r.setState({goInputText:""}),A(r.getValidValue())},r.go=function(f){var y=r.state.goInputText;if(y==="")return;(f.keyCode===C.ENTER||f.type==="click")&&(r.setState({goInputText:""}),r.props.quickGo(r.getValidValue()))},r}return Object(E.a)(a,[{key:"getValidValue",value:function(){var e=this.state,i=e.goInputText,v=e.current;return!i||isNaN(i)?v:Number(i)}},{key:"getPageSizeOptions",value:function(){var e=this.props,i=e.pageSize,v=e.pageSizeOptions;return v.some(function(f){return f.toString()===i.toString()})?v:v.concat([i.toString()]).sort(function(f,y){var t=isNaN(Number(f))?0:Number(f),A=isNaN(Number(y))?0:Number(y);return t-A})}},{key:"render",value:function(){var e=this,i=this.props,v=i.pageSize,f=i.locale,y=i.rootPrefixCls,t=i.changeSize,A=i.quickGo,U=i.goButton,F=i.selectComponentClass,H=i.buildOptionText,J=i.selectPrefixCls,B=i.disabled,Z=this.state.goInputText,re="".concat(y,"-options"),ie=F,ve=null,de=null,q=null;if(!t&&!A)return null;var ee=this.getPageSizeOptions();if(t&&ie){var pe=ee.map(function(Q,V){return T.a.createElement(ie.Option,{key:V,value:Q.toString()},(H||e.buildOptionText)(Q))});ve=T.a.createElement(ie,{disabled:B,prefixCls:J,showSearch:!1,className:"".concat(re,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(v||ee[0]).toString(),onChange:this.changeSize,getPopupContainer:function(V){return V.parentNode}},pe)}return A&&(U&&(q=typeof U=="boolean"?T.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:B,className:"".concat(re,"-quick-jumper-button")},f.jump_to_confirm):T.a.createElement("span",{onClick:this.go,onKeyUp:this.go},U)),de=T.a.createElement("div",{className:"".concat(re,"-quick-jumper")},f.jump_to,T.a.createElement("input",{disabled:B,type:"text",value:Z,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),f.page,q)),T.a.createElement("li",{className:"".concat(re)},ve,de)}}]),a}(T.a.Component);x.defaultProps={pageSizeOptions:["10","20","50","100"]};var b=x,p=W("N2Kk");function n(){}function l(m){return typeof m=="number"&&isFinite(m)&&Math.floor(m)===m}function s(m,h,a){return a}function g(m,h,a){var r=typeof m=="undefined"?h.pageSize:m;return Math.floor((a.total-1)/r)+1}var d=function(m){Object(R.a)(a,m);var h=Object(I.a)(a);function a(r){var e;Object(N.a)(this,a),e=h.call(this,r),e.getJumpPrevPage=function(){return Math.max(1,e.state.current-(e.props.showLessItems?3:5))},e.getJumpNextPage=function(){return Math.min(g(void 0,e.state,e.props),e.state.current+(e.props.showLessItems?3:5))},e.getItemIcon=function(t,A){var U=e.props.prefixCls,F=t||T.a.createElement("button",{type:"button","aria-label":A,className:"".concat(U,"-item-link")});return typeof t=="function"&&(F=T.a.createElement(t,Object(w.a)({},e.props))),F},e.savePaginationNode=function(t){e.paginationNode=t},e.isValid=function(t){return l(t)&&t!==e.state.current},e.shouldDisplayQuickJumper=function(){var t=e.props,A=t.showQuickJumper,U=t.pageSize,F=t.total;return F<=U?!1:A},e.handleKeyDown=function(t){(t.keyCode===C.ARROW_UP||t.keyCode===C.ARROW_DOWN)&&t.preventDefault()},e.handleKeyUp=function(t){var A=e.getValidValue(t),U=e.state.currentInputValue;A!==U&&e.setState({currentInputValue:A}),t.keyCode===C.ENTER?e.handleChange(A):t.keyCode===C.ARROW_UP?e.handleChange(A-1):t.keyCode===C.ARROW_DOWN&&e.handleChange(A+1)},e.changePageSize=function(t){var A=e.state.current,U=g(t,e.state,e.props);A=A>U?U:A,U===0&&(A=e.state.current),typeof t=="number"&&("pageSize"in e.props||e.setState({pageSize:t}),"current"in e.props||e.setState({current:A,currentInputValue:A})),e.props.onShowSizeChange(A,t),"onChange"in e.props&&e.props.onChange&&e.props.onChange(A,t)},e.handleChange=function(t){var A=e.props.disabled,U=t;if(e.isValid(U)&&!A){var F=g(void 0,e.state,e.props);U>F?U=F:U<1&&(U=1),"current"in e.props||e.setState({current:U,currentInputValue:U});var H=e.state.pageSize;return e.props.onChange(U,H),U}return e.state.current},e.prev=function(){e.hasPrev()&&e.handleChange(e.state.current-1)},e.next=function(){e.hasNext()&&e.handleChange(e.state.current+1)},e.jumpPrev=function(){e.handleChange(e.getJumpPrevPage())},e.jumpNext=function(){e.handleChange(e.getJumpNextPage())},e.hasPrev=function(){return e.state.current>1},e.hasNext=function(){return e.state.current<g(void 0,e.state,e.props)},e.runIfEnter=function(t,A){if(t.key==="Enter"||t.charCode===13){for(var U=arguments.length,F=new Array(U>2?U-2:0),H=2;H<U;H++)F[H-2]=arguments[H];A.apply(void 0,F)}},e.runIfEnterPrev=function(t){e.runIfEnter(t,e.prev)},e.runIfEnterNext=function(t){e.runIfEnter(t,e.next)},e.runIfEnterJumpPrev=function(t){e.runIfEnter(t,e.jumpPrev)},e.runIfEnterJumpNext=function(t){e.runIfEnter(t,e.jumpNext)},e.handleGoTO=function(t){(t.keyCode===C.ENTER||t.type==="click")&&e.handleChange(e.state.currentInputValue)};var i=r.onChange!==n,v="current"in r;v&&!i&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var f=r.defaultCurrent;"current"in r&&(f=r.current);var y=r.defaultPageSize;return"pageSize"in r&&(y=r.pageSize),f=Math.min(f,g(y,void 0,r)),e.state={current:f,currentInputValue:f,pageSize:y},e}return Object(E.a)(a,[{key:"componentDidUpdate",value:function(e,i){var v=this.props.prefixCls;if(i.current!==this.state.current&&this.paginationNode){var f=this.paginationNode.querySelector(".".concat(v,"-item-").concat(i.current));f&&document.activeElement===f&&f.blur()}}},{key:"getValidValue",value:function(e){var i=e.target.value,v=g(void 0,this.state,this.props),f=this.state.currentInputValue,y;return i===""?y=i:isNaN(Number(i))?y=f:i>=v?y=v:y=Number(i),y}},{key:"getShowSizeChanger",value:function(){var e=this.props,i=e.showSizeChanger,v=e.total,f=e.totalBoundaryShowSizeChanger;return typeof i!="undefined"?i:v>f}},{key:"renderPrev",value:function(e){var i=this.props,v=i.prevIcon,f=i.itemRender,y=f(e,"prev",this.getItemIcon(v,"prev page")),t=!this.hasPrev();return Object(M.isValidElement)(y)?Object(M.cloneElement)(y,{disabled:t}):y}},{key:"renderNext",value:function(e){var i=this.props,v=i.nextIcon,f=i.itemRender,y=f(e,"next",this.getItemIcon(v,"next page")),t=!this.hasNext();return Object(M.isValidElement)(y)?Object(M.cloneElement)(y,{disabled:t}):y}},{key:"render",value:function(){var e=this,i=this.props,v=i.prefixCls,f=i.className,y=i.style,t=i.disabled,A=i.hideOnSinglePage,U=i.total,F=i.locale,H=i.showQuickJumper,J=i.showLessItems,B=i.showTitle,Z=i.showTotal,re=i.simple,ie=i.itemRender,ve=i.showPrevNextJumpers,de=i.jumpPrevIcon,q=i.jumpNextIcon,ee=i.selectComponentClass,pe=i.selectPrefixCls,Q=i.pageSizeOptions,V=this.state,Ce=V.current,ke=V.pageSize,Ue=V.currentInputValue;if(A===!0&&U<=ke)return null;var we=g(void 0,this.state,this.props),De=[],Oe=null,Le=null,Ke=null,Fe=null,He=null,Ne=H&&H.goButton,xe=J?1:2,Ge=Ce-1>0?Ce-1:0,qe=Ce+1<we?Ce+1:we,lt=Object.keys(this.props).reduce(function(X,$){return($.substr(0,5)==="data-"||$.substr(0,5)==="aria-"||$==="role")&&(X[$]=e.props[$]),X},{});if(re)return Ne&&(typeof Ne=="boolean"?He=T.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},F.jump_to_confirm):He=T.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},Ne),He=T.a.createElement("li",{title:B?"".concat(F.jump_to).concat(Ce,"/").concat(we):null,className:"".concat(v,"-simple-pager")},He)),T.a.createElement("ul",Object(Ee.a)({className:_()(v,"".concat(v,"-simple"),Object(j.a)({},"".concat(v,"-disabled"),t),f),style:y,ref:this.savePaginationNode},lt),T.a.createElement("li",{title:B?F.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:_()("".concat(v,"-prev"),Object(j.a)({},"".concat(v,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(Ge)),T.a.createElement("li",{title:B?"".concat(Ce,"/").concat(we):null,className:"".concat(v,"-simple-pager")},T.a.createElement("input",{type:"text",value:Ue,disabled:t,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),T.a.createElement("span",{className:"".concat(v,"-slash")},"/"),we),T.a.createElement("li",{title:B?F.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:_()("".concat(v,"-next"),Object(j.a)({},"".concat(v,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(qe)),He);if(we<=3+xe*2){var ot={locale:F,rootPrefixCls:v,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:B,itemRender:ie};we||De.push(T.a.createElement(O,Object(Ee.a)({},ot,{key:"noPager",page:we,className:"".concat(v,"-disabled")})));for(var bt=1;bt<=we;bt+=1){var ht=Ce===bt;De.push(T.a.createElement(O,Object(Ee.a)({},ot,{key:bt,page:bt,active:ht})))}}else{var ut=J?F.prev_3:F.prev_5,Ze=J?F.next_3:F.next_5;ve&&(Oe=T.a.createElement("li",{title:B?ut:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:_()("".concat(v,"-jump-prev"),Object(j.a)({},"".concat(v,"-jump-prev-custom-icon"),!!de))},ie(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(de,"prev page"))),Le=T.a.createElement("li",{title:B?Ze:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:_()("".concat(v,"-jump-next"),Object(j.a)({},"".concat(v,"-jump-next-custom-icon"),!!q))},ie(this.getJumpNextPage(),"jump-next",this.getItemIcon(q,"next page")))),Fe=T.a.createElement(O,{locale:F,last:!0,rootPrefixCls:v,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:we,page:we,active:!1,showTitle:B,itemRender:ie}),Ke=T.a.createElement(O,{locale:F,rootPrefixCls:v,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:B,itemRender:ie});var Et=Math.max(1,Ce-xe),St=Math.min(Ce+xe,we);Ce-1<=xe&&(St=1+xe*2),we-Ce<=xe&&(Et=we-xe*2);for(var We=Et;We<=St;We+=1){var it=Ce===We;De.push(T.a.createElement(O,{locale:F,rootPrefixCls:v,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:We,page:We,active:it,showTitle:B,itemRender:ie}))}Ce-1>=xe*2&&Ce!==1+2&&(De[0]=Object(M.cloneElement)(De[0],{className:"".concat(v,"-item-after-jump-prev")}),De.unshift(Oe)),we-Ce>=xe*2&&Ce!==we-2&&(De[De.length-1]=Object(M.cloneElement)(De[De.length-1],{className:"".concat(v,"-item-before-jump-next")}),De.push(Le)),Et!==1&&De.unshift(Ke),St!==we&&De.push(Fe)}var ye=null;Z&&(ye=T.a.createElement("li",{className:"".concat(v,"-total-text")},Z(U,[U===0?0:(Ce-1)*ke+1,Ce*ke>U?U:Ce*ke])));var he=!this.hasPrev()||!we,fe=!this.hasNext()||!we;return T.a.createElement("ul",Object(Ee.a)({className:_()(v,f,Object(j.a)({},"".concat(v,"-disabled"),t)),style:y,unselectable:"unselectable",ref:this.savePaginationNode},lt),ye,T.a.createElement("li",{title:B?F.prev_page:null,onClick:this.prev,tabIndex:he?null:0,onKeyPress:this.runIfEnterPrev,className:_()("".concat(v,"-prev"),Object(j.a)({},"".concat(v,"-disabled"),he)),"aria-disabled":he},this.renderPrev(Ge)),De,T.a.createElement("li",{title:B?F.next_page:null,onClick:this.next,tabIndex:fe?null:0,onKeyPress:this.runIfEnterNext,className:_()("".concat(v,"-next"),Object(j.a)({},"".concat(v,"-disabled"),fe)),"aria-disabled":fe},this.renderNext(qe)),T.a.createElement(b,{disabled:t,locale:F,rootPrefixCls:v,selectComponentClass:ee,selectPrefixCls:pe,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:Ce,pageSize:ke,pageSizeOptions:Q,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:Ne}))}}],[{key:"getDerivedStateFromProps",value:function(e,i){var v={};if("current"in e&&(v.current=e.current,e.current!==i.current&&(v.currentInputValue=v.current)),"pageSize"in e&&e.pageSize!==i.pageSize){var f=i.current,y=g(e.pageSize,i,e);f=f>y?y:f,"current"in e||(v.current=f,v.currentInputValue=f),v.pageSize=e.pageSize}return v}}]),a}(T.a.Component);d.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:n,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:n,locale:p.a,style:{},itemRender:s,totalBoundaryShowSizeChanger:50};var u=d},"815F":function(Pt,Ye,W){"use strict";W.d(Ye,"e",function(){return I}),W.d(Ye,"c",function(){return T}),W.d(Ye,"d",function(){return P}),W.d(Ye,"a",function(){return S}),W.d(Ye,"f",function(){return O}),W.d(Ye,"b",function(){return C});var Ee=W("KQm4"),j=W("VTBJ"),w=W("Ff2n"),N=W("Zm9Q"),E=W("Kwbf"),R=W("OZM5");function I(x,b){return x!=null?x:b}function M(){var x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],b=new Map;function p(n){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(n||[]).forEach(function(s){var g=s.key,d=s.children;Object(E.a)(g!=null,"Tree node must have a certain key: [".concat(l).concat(g,"]"));var u=String(g);Object(E.a)(!b.has(u)||g===null||g===void 0,"Same 'key' exist in the Tree: ".concat(u)),b.set(u,!0),p(d,"".concat(l).concat(u," > "))})}p(x)}function T(x){function b(p){var n=Object(N.a)(p);return n.map(function(l){if(!Object(R.i)(l))return Object(E.a)(!l,"Tree/TreeNode can only accept TreeNode as children."),null;var s=l.key,g=l.props,d=g.children,u=Object(w.a)(g,["children"]),m=Object(j.a)({key:s},u),h=b(d);return h.length&&(m.children=h),m}).filter(function(l){return l})}return b(x)}function P(){var x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],p=new Set(b===!0?[]:b),n=[];function l(s){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return s.map(function(d,u){var m=Object(R.h)(g?g.pos:"0",u),h=I(d.key,m),a=Object(j.a)(Object(j.a)({},d),{},{parent:g,pos:m,children:null,data:d,isStart:[].concat(Object(Ee.a)(g?g.isStart:[]),[u===0]),isEnd:[].concat(Object(Ee.a)(g?g.isEnd:[]),[u===s.length-1])});return n.push(a),b===!0||p.has(h)?a.children=l(d.children||[],a):a.children=[],a})}return l(x),n}function _(x,b,p){var n;p?typeof p=="string"?n=function(g){return g[p]}:typeof p=="function"&&(n=function(g){return p(g)}):n=function(g,d){return I(g.key,d)};function l(s,g,d){var u=s?s.children:x,m=s?Object(R.h)(d.pos,g):"0";if(s){var h=n(s,m),a={node:s,index:g,pos:m,key:h,parentPos:d.node?d.pos:null,level:d.level+1};b(a)}u&&u.forEach(function(r,e){l(r,e,{node:s,pos:m,level:d?d.level+1:-1})})}l(null)}function S(x){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p=b.initWrapper,n=b.processEntity,l=b.onProcessFinished,s=arguments.length>2?arguments[2]:void 0,g={},d={},u={posEntities:g,keyEntities:d};return p&&(u=p(u)||u),_(x,function(m){var h=m.node,a=m.index,r=m.pos,e=m.key,i=m.parentPos,v=m.level,f={node:h,index:a,key:e,pos:r,level:v},y=I(e,r);g[r]=f,d[y]=f,f.parent=g[i],f.parent&&(f.parent.children=f.parent.children||[],f.parent.children.push(f)),n&&n(f,u)},s),l&&l(u),u}function O(x,b){var p=b.expandedKeys,n=b.selectedKeys,l=b.loadedKeys,s=b.loadingKeys,g=b.checkedKeys,d=b.halfCheckedKeys,u=b.dragOverNodeKey,m=b.dropPosition,h=b.keyEntities,a=h[x],r={eventKey:x,expanded:p.indexOf(x)!==-1,selected:n.indexOf(x)!==-1,loaded:l.indexOf(x)!==-1,loading:s.indexOf(x)!==-1,checked:g.indexOf(x)!==-1,halfChecked:d.indexOf(x)!==-1,pos:String(a?a.pos:""),dragOver:u===x&&m===0,dragOverGapTop:u===x&&m===-1,dragOverGapBottom:u===x&&m===1};return r}function C(x){var b=x.data,p=x.expanded,n=x.selected,l=x.checked,s=x.loaded,g=x.loading,d=x.halfChecked,u=x.dragOver,m=x.dragOverGapTop,h=x.dragOverGapBottom,a=x.pos,r=x.active,e=Object(j.a)(Object(j.a)({},b),{},{expanded:p,selected:n,checked:l,loaded:s,loading:g,halfChecked:d,dragOver:u,dragOverGapTop:m,dragOverGapBottom:h,pos:a,active:r});return"props"in e||Object.defineProperty(e,"props",{get:function(){return Object(E.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),x}}),e}},"8hTe":function(Pt,Ye,W){Pt.exports={button:"button___1wy9m"}},"9Bee":function(Pt,Ye,W){"use strict";var Ee=W("DYRE"),j=W("zeV3"),w=W("+L6B"),N=W("2/Rp"),E=W("k1fw"),R=W("9og8"),I=W("tJVT"),M=W("WmNS"),T=W.n(M),P=W("q1tI"),_=W.n(P),S=W("vg9a"),O=W("DlQD"),C=W.n(O),x=W("rUJ1");function b(L,o){var c=L.match(/^(\s+)(?:```)/);if(c===null)return o;var D=c[1];return o.split(`
`).map(function(K){var k=K.match(/^\s+/);if(k===null)return K;var ce=Object(I.a)(k,1),ze=ce[0];return ze.length>=D.length?K.slice(D.length):K}).join(`
`)}var p=[],n=["<ul>"],l=new C.a.Renderer,s=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function g(){p.length=0,n=["<ul>"]}var d={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function u(L,o,c,D){if(o>=L.length||L[o].level<=c)return o;var K=L[o];D.push("<li><a href='#"+K.anchor+"'>"+K.text+"</a>"),o++;var k=[];return o=u(L,o,K.level,k),k.length>0&&(D.push("<ul>"),k.forEach(function(ce){D.push(ce)}),D.push("</ul>")),D.push("</li>"),o=u(L,o,c,D),o}function m(){return u(p,0,0,n),n.push("</ul>"),n.join("")}var h={heading:function(o){var c=s.exec(o);if(c)return{type:"heading",raw:c[0],depth:c[1].length,text:c[2]}},fences:function(o){var c=this.rules.block.fences.exec(o);if(c){var D=c[0],K=b(D,c[3]||""),k=c[2]?c[2].trim():c[2];if(["latex","katex","math"].indexOf(k)>=0){var ce=e(),ze=K;K=ce,i[ce]={type:"block",expression:ze}}return{type:"code",raw:D,lang:k,text:K}}}},a=/(?:\${2})([^\n`]+?)(?:\${2})/gi,r=0,e=function(){return"__special_katext_id_".concat(r++,"__")},i={};function v(){return i}function f(){r=0,i={}}function y(L){return L=L.replace(a,function(o,c){var D=e();return i[D]={type:"inline",expression:c},D}),L}var t=l.listitem;l.listitem=function(L){return t(y(L))};var A=l.paragraph;l.paragraph=function(L){return A(y(L))};var U=l.tablecell;l.tablecell=function(L,o){return U(y(L),o)},l.code=function(L,o,c){var D=(o||"").match(/\S*/)[0];return D?["latex","katex","math"].indexOf(D)>=0?"<p class='editormd-tex'>".concat(L,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(o,'">').concat(c?L:Object(x.escape)(L,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(c?L:Object(x.escape)(L,!0))+"</code></pre>"},l.heading=function(L,o,c){var D=this.options.headerPrefix+c.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return p.push({anchor:D,level:o,text:L}),"<h"+o+' id="'+D+'">'+L+"</h"+o+">"},C.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),C.a.use({tokenizer:h,renderer:l});var F=C.a,H=W("SJMd"),J=W("ulZh"),B=W.n(J),Z=W("m3rI"),re=W("Oy/b"),ie=W("p5ED"),ve=W("ErOA");/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var de=function(L,o){return(de=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,D){c.__proto__=D}||function(c,D){for(var K in D)Object.prototype.hasOwnProperty.call(D,K)&&(c[K]=D[K])})(L,o)};function q(L,o){function c(){this.constructor=L}de(L,o),L.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}function ee(L,o,c,D){return new(c||(c=Promise))(function(K,k){function ce(Nt){try{gt(D.next(Nt))}catch(Xe){k(Xe)}}function ze(Nt){try{gt(D.throw(Nt))}catch(Xe){k(Xe)}}function gt(Nt){var Xe;Nt.done?K(Nt.value):(Xe=Nt.value,Xe instanceof c?Xe:new c(function(Jt){Jt(Xe)})).then(ce,ze)}gt((D=D.apply(L,o||[])).next())})}function pe(L,o){var c,D,K,k,ce={label:0,sent:function(){if(1&K[0])throw K[1];return K[1]},trys:[],ops:[]};return k={next:ze(0),throw:ze(1),return:ze(2)},typeof Symbol=="function"&&(k[Symbol.iterator]=function(){return this}),k;function ze(gt){return function(Nt){return function(Xe){if(c)throw new TypeError("Generator is already executing.");for(;ce;)try{if(c=1,D&&(K=2&Xe[0]?D.return:Xe[0]?D.throw||((K=D.return)&&K.call(D),0):D.next)&&!(K=K.call(D,Xe[1])).done)return K;switch(D=0,K&&(Xe=[2&Xe[0],K.value]),Xe[0]){case 0:case 1:K=Xe;break;case 4:return ce.label++,{value:Xe[1],done:!1};case 5:ce.label++,D=Xe[1],Xe=[0];continue;case 7:Xe=ce.ops.pop(),ce.trys.pop();continue;default:if(!(K=ce.trys,(K=K.length>0&&K[K.length-1])||Xe[0]!==6&&Xe[0]!==2)){ce=0;continue}if(Xe[0]===3&&(!K||Xe[1]>K[0]&&Xe[1]<K[3])){ce.label=Xe[1];break}if(Xe[0]===6&&ce.label<K[1]){ce.label=K[1],K=Xe;break}if(K&&ce.label<K[2]){ce.label=K[2],ce.ops.push(Xe);break}K[2]&&ce.ops.pop(),ce.trys.pop();continue}Xe=o.call(L,ce)}catch(Jt){Xe=[6,Jt],D=0}finally{c=K=0}if(5&Xe[0])throw Xe[1];return{value:Xe[0]?Xe[1]:void 0,done:!0}}([gt,Nt])}}}function Q(){for(var L=0,o=0,c=arguments.length;o<c;o++)L+=arguments[o].length;var D=Array(L),K=0;for(o=0;o<c;o++)for(var k=arguments[o],ce=0,ze=k.length;ce<ze;ce++,K++)D[K]=k[ce];return D}var V=function(){function L(){}return L.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},L.setAttributes=function(o,c){for(var D=0,K=c;D<K.length;D++){var k=K[D],ce=k[0],ze=k[1];o.setAttribute(ce,ze)}},L.createRect=function(o,c,D){var K=document.createElementNS("http://www.w3.org/2000/svg","rect");return K.setAttribute("width",o.toString()),K.setAttribute("height",c.toString()),D&&L.setAttributes(K,D),K},L.createLine=function(o,c,D,K,k){var ce=document.createElementNS("http://www.w3.org/2000/svg","line");return ce.setAttribute("x1",o.toString()),ce.setAttribute("y1",c.toString()),ce.setAttribute("x2",D.toString()),ce.setAttribute("y2",K.toString()),k&&L.setAttributes(ce,k),ce},L.createPolygon=function(o,c){var D=document.createElementNS("http://www.w3.org/2000/svg","polygon");return D.setAttribute("points",o),c&&L.setAttributes(D,c),D},L.createCircle=function(o,c){var D=document.createElementNS("http://www.w3.org/2000/svg","circle");return D.setAttribute("cx",(o/2).toString()),D.setAttribute("cy",(o/2).toString()),D.setAttribute("r",o.toString()),c&&L.setAttributes(D,c),D},L.createEllipse=function(o,c,D){var K=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return K.setAttribute("cx",(o/2).toString()),K.setAttribute("cy",(c/2).toString()),K.setAttribute("rx",(o/2).toString()),K.setAttribute("ry",(c/2).toString()),D&&L.setAttributes(K,D),K},L.createGroup=function(o){var c=document.createElementNS("http://www.w3.org/2000/svg","g");return o&&L.setAttributes(c,o),c},L.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},L.createMarker=function(o,c,D,K,k,ce,ze){var gt=document.createElementNS("http://www.w3.org/2000/svg","marker");return L.setAttributes(gt,[["id",o],["orient",c],["markerWidth",D.toString()],["markerHeight",K.toString()],["refX",k.toString()],["refY",ce.toString()]]),gt.appendChild(ze),gt},L.createText=function(o){var c=document.createElementNS("http://www.w3.org/2000/svg","text");return c.setAttribute("x","0"),c.setAttribute("y","0"),o&&L.setAttributes(c,o),c},L.createTSpan=function(o,c){var D=document.createElementNS("http://www.w3.org/2000/svg","tspan");return D.textContent=o,c&&L.setAttributes(D,c),D},L.createImage=function(o){var c=document.createElementNS("http://www.w3.org/2000/svg","image");return o&&L.setAttributes(c,o),c},L.createPoint=function(o,c){var D=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return D.x=o,D.y=c,D},L.createPath=function(o,c){var D=document.createElementNS("http://www.w3.org/2000/svg","path");return D.setAttribute("d",o),c&&L.setAttributes(D,c),D},L}(),Ce=function(){function L(){}return L.addKey=function(o){L.key=o},Object.defineProperty(L,"isLicensed",{get:function(){return!!L.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(L.key)},enumerable:!1,configurable:!0}),L}(),ke=function(){function L(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return L.prototype.rasterize=function(o,c,D){var K=this;return new Promise(function(k){var ce=D!==void 0?D:document.createElement("canvas");o===null&&(K.markersOnly=!0,K.naturalSize=!1);var ze=document.createElementNS("http://www.w3.org/2000/svg","svg");ze.setAttribute("xmlns","http://www.w3.org/2000/svg"),ze.setAttribute("width",c.width.baseVal.valueAsString),ze.setAttribute("height",c.height.baseVal.valueAsString),ze.setAttribute("viewBox","0 0 "+c.viewBox.baseVal.width.toString()+" "+c.viewBox.baseVal.height.toString()),ze.innerHTML=c.innerHTML,K.naturalSize===!0?(ze.width.baseVal.value=o.naturalWidth,ze.height.baseVal.value=o.naturalHeight):K.width!==void 0&&K.height!==void 0&&(ze.width.baseVal.value=K.width,ze.height.baseVal.value=K.height),ce.width=ze.width.baseVal.value,ce.height=ze.height.baseVal.value;var gt=ze.outerHTML,Nt=ce.getContext("2d");K.markersOnly!==!0&&Nt.drawImage(o,0,0,ce.width,ce.height);var Xe=window.URL,Jt=new Image(ce.width,ce.height);Jt.setAttribute("crossOrigin","anonymous");var Pn=new Blob([gt],{type:"image/svg+xml"}),Bn=Xe.createObjectURL(Pn);Jt.onload=function(){Nt.drawImage(Jt,0,0),Xe.revokeObjectURL(Bn);var jr=ce.toDataURL(K.imageType,K.imageQuality);k(jr)},Jt.src=Bn})},L}(),Ue=function(){},we=function(){function L(o){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+o+"_"}return Object.defineProperty(L.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(L.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(L.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),L.prototype.addClass=function(o){return this.styleSheet===void 0&&this.addStyleSheet(),o.name=""+this.classNamePrefix+o.localName,this.classes.push(o),this.styleSheet.sheet.insertRule("."+o.name+" {"+o.style+"}",this.styleSheet.sheet.cssRules.length),o},L.prototype.addRule=function(o){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(o),this.styleSheet.sheet.insertRule(o.selector+" {"+o.style+"}",this.styleSheet.sheet.cssRules.length)},L.prototype.addStyleSheet=function(){var o;this.styleSheet=document.createElement("style"),((o=this.styleSheetRoot)!==null&&o!==void 0?o:document.head).appendChild(this.styleSheet),this.addRule(new De("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new De("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new De("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new Oe("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new Oe("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},L.prototype.removeStyleSheet=function(){var o;this.styleSheet&&(((o=this.styleSheetRoot)!==null&&o!==void 0?o:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},L}(),De=function(L,o){this.selector=L,this.style=o},Oe=function(L,o){this.localName=L,this.style=o},Le=function(){function L(o,c,D,K,k){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=o,this.displayMode=c,this.markerItems=D,this.uiStyleSettings=K,this.styles=k,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return L.prototype.show=function(o){var c=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=o,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var D=document.createElement("div");D.className=this.toolbarBlockStyleClass.name,D.style.whiteSpace="nowrap",this.uiContainer.appendChild(D),this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(D,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(k){var ce=document.createElement("div");ce.className=""+c.toolbarButtonStyleClass.name,ce.setAttribute("data-type-name",k.typeName),ce.innerHTML=k.icon,ce.addEventListener("click",function(){c.markerToolbarButtonClicked(ce,k)}),c.buttons.push(ce),c.markerButtons.push(ce)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var K=document.createElement("div");K.className=this.toolbarBlockStyleClass.name,K.style.whiteSpace="nowrap",K.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(K),this.addActionButton(K,'<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(K,'<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()},L.prototype.addButtonClickListener=function(o){this.buttonClickListeners.push(o)},L.prototype.removeButtonClickListener=function(o){this.buttonClickListeners.indexOf(o)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(o),1)},L.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},L.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var o=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var c=0;c<this.markerButtons.length;c++)c<o||c===o&&this.markerButtons.length-1===o?this.markerButtonBlock.appendChild(this.markerButtons[c]):(c===o&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[c]))}},L.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},L.prototype.resetButtonStyles=function(){var o=this;this.buttons.forEach(function(c){c.className=c.className.replace(o.uiStyleSettings.toolbarButtonStyleColorsClassName?o.uiStyleSettings.toolbarButtonStyleColorsClassName:o.toolbarButtonStyleColorsClass.name,"").trim(),c.className=c.className.replace(o.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?o.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:o.toolbarActiveButtonStyleColorsClass.name,"").trim(),c.className+=" "+(o.uiStyleSettings.toolbarButtonStyleColorsClassName?o.uiStyleSettings.toolbarButtonStyleColorsClassName:o.toolbarButtonStyleColorsClass.name)})},L.prototype.addActionButton=function(o,c,D){var K=this,k=document.createElement("div");switch(k.className=""+this.toolbarButtonStyleClass.name,k.innerHTML=c,k.setAttribute("data-action",D),k.addEventListener("click",function(){K.actionToolbarButtonClicked(k,D)}),D){case"select":k.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":k.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":k.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":k.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":k.style.fill=this.uiStyleSettings.closeButtonColor}o.appendChild(k),this.buttons.push(k)},L.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Oe("toolbar",`
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
height: `+this.uiStyleSettings.toolbarHeight+`px;
box-sizing: content-box;
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
overflow: hidden;
`)),this.toolbarStyleColorsClass=this.styles.addClass(new Oe("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Oe("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new Oe("toolbar-overflow-block",`
position: absolute;
top: `+this.uiStyleSettings.toolbarHeight+`px;
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
z-index: 10;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new Oe("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var o=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Oe("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*o)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*o)+`px;
padding: `+o+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Oe("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Oe("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new De("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new De("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},L.prototype.markerToolbarButtonClicked=function(o,c){this.setActiveButton(o),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(D){return D("marker",c)}),this.markerButtonOverflowBlock.style.display="none"},L.prototype.actionToolbarButtonClicked=function(o,c){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(D){return D("action",c)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},L.prototype.setActiveButton=function(o){this.resetButtonStyles(),o.className=o.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),o.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},L.prototype.setActiveMarkerButton=function(o){var c=this.markerButtons.find(function(D){return D.getAttribute("data-type-name")===o});c&&this.setActiveButton(c)},L.prototype.setCurrentMarker=function(o){var c=this;this.currentMarker=o,this.buttons.filter(function(D){return/delete|notes/.test(D.getAttribute("data-action"))}).forEach(function(D){c.currentMarker===void 0?(D.style.fillOpacity="0.4",D.style.pointerEvents="none"):(D.style.fillOpacity="1",D.style.pointerEvents="all")})},L}(),Ke=function(){function L(o,c,D,K){this.panels=[],this.panelButtons=[],this.markerjsContainer=o,this.displayMode=c,this.uiStyleSettings=D,this.styles=K,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return L.prototype.addStyles=function(){var o;this.toolboxStyleClass=this.styles.addClass(new Oe("toolbox",`
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: column;
font-family: sans-serif;
`+(this.displayMode==="popup"?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+`
box-sizing: content-box;
`+(this.displayMode==="popup"?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+`
`+(this.displayMode==="inline"?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
`+(this.displayMode==="inline"?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
overflow: hidden;
`)),this.toolboxStyleColorsClass=this.styles.addClass(new Oe("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var c=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Oe("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Oe("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Oe("toolbox-panel-row",`
display: flex;
`+(this.displayMode==="inline"?"position: absolute;":"")+`
`+(this.displayMode==="inline"?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+`
cursor: default;
height: `+1.5*this.uiStyleSettings.toolbarHeight+`px;
`+(this.displayMode==="inline"?"width: 100%;":"")+`
box-sizing: content-box;
`)),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new Oe("toolbox-panel-row_colors",`
background-color: `+((o=this.uiStyleSettings.toolboxBackgroundColor)!==null&&o!==void 0?o:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new Oe("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*c)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*c)+`px;
padding: `+c+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Oe("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Oe("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new De("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new De("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},L.prototype.show=function(o){var c;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=o,this.uiContainer.className=this.toolboxStyleClass.name+" "+((c=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&c!==void 0?c:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},L.prototype.setPanelButtons=function(o){var c,D,K=this;this.panels=o,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((c=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&c!==void 0?c:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((D=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&D!==void 0?D:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(k){var ce;k.uiStyleSettings=K.uiStyleSettings;var ze=document.createElement("div");ze.className=K.toolboxButtonStyleClass.name+" "+((ce=K.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ce!==void 0?ce:K.toolboxButtonStyleColorsClass.name),ze.innerHTML=k.icon,ze.title=k.title,ze.addEventListener("click",function(){K.panelButtonClick(k)}),K.panelButtons.push(ze),K.buttonRow.appendChild(ze)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},L.prototype.panelButtonClick=function(o){var c=this,D=-1;if(o!==this.activePanel){D=this.panels.indexOf(o),this.panelRow.innerHTML="";var K=o.getUi();K.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(K),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=o}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){c.displayMode==="inline"?c.panelRow.style.display="none":c.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(k,ce){var ze,gt;k.className=c.toolboxButtonStyleClass.name+" "+(ce===D?""+((ze=c.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&ze!==void 0?ze:c.toolboxActiveButtonStyleColorsClass.name):""+((gt=c.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&gt!==void 0?gt:c.toolboxButtonStyleColorsClass.name))})},L}(),Fe=function(L,o){this.title=L,this.icon=o},He=function(L){function o(c,D,K,k){var ce=L.call(this,c,k||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return ce.colors=[],ce.addTransparent=!1,ce.colorBoxes=[],ce.colors=D,ce.currentColor=K,ce.setCurrentColor=ce.setCurrentColor.bind(ce),ce.getColorBox=ce.getColorBox.bind(ce),ce}return q(o,L),o.prototype.getUi=function(){var c=this,D=document.createElement("div");return D.style.overflow="hidden",D.style.whiteSpace="nowrap",this.colors.forEach(function(K){var k=c.getColorBox(K);D.appendChild(k),c.colorBoxes.push(k)}),D},o.prototype.getColorBox=function(c){var D=this,K=this.uiStyleSettings.toolbarHeight/4,k=this.uiStyleSettings.toolbarHeight-K,ce=document.createElement("div");ce.style.display="inline-block",ce.style.boxSizing="content-box",ce.style.width=k-2+"px",ce.style.height=k-2+"px",ce.style.padding="1px",ce.style.marginRight="2px",ce.style.marginBottom="2px",ce.style.borderWidth="2px",ce.style.borderStyle="solid",ce.style.borderRadius=(k+2)/2+"px",ce.style.borderColor=c===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ce.addEventListener("click",function(){D.setCurrentColor(c,ce)});var ze=document.createElement("div");return ze.style.display="inline-block",ze.style.width=k-2+"px",ze.style.height=k-2+"px",ze.style.backgroundColor=c,ze.style.borderRadius=k/2+"px",c==="transparent"&&(ze.style.fill=this.uiStyleSettings.toolboxAccentColor,ze.innerHTML=`<svg viewBox="0 0 24 24">
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
</svg>`),ce.appendChild(ze),ce},o.prototype.setCurrentColor=function(c,D){var K=this;this.currentColor=c,this.colorBoxes.forEach(function(k){k.style.borderColor=k===D?K.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(c)},o}(Fe),Ne=function(){function L(o,c,D){this._state="new",this._isSelected=!1,this._container=o,this._overlayContainer=c,this.globalSettings=D,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(L.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),L.prototype.ownsTarget=function(o){return!1},Object.defineProperty(L.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),L.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},L.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},L.prototype.pointerDown=function(o,c){},L.prototype.dblClick=function(o,c){},L.prototype.manipulate=function(o){},L.prototype.pointerUp=function(o){this.stateChanged()},L.prototype.dispose=function(){},L.prototype.addMarkerVisualToContainer=function(o){this.container.childNodes.length>0?this.container.insertBefore(o,this.container.childNodes[0]):this.container.appendChild(o)},L.prototype.getState=function(){return{typeName:L.typeName,state:this.state,notes:this.notes}},L.prototype.restoreState=function(o){this._state=o.state,this.notes=o.notes},L.prototype.scale=function(o,c){},L.prototype.colorChanged=function(o){this.onColorChanged&&this.onColorChanged(o),this.stateChanged()},L.prototype.fillColorChanged=function(o){this.onFillColorChanged&&this.onFillColorChanged(o),this.stateChanged()},L.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var o=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),o.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(o)&&this.onStateChanged(this)}},L.typeName="MarkerBase",L}(),xe=function(){function L(){this.findGripByVisual=this.findGripByVisual.bind(this)}return L.prototype.findGripByVisual=function(o){return this.topLeft.ownsTarget(o)?this.topLeft:this.topCenter.ownsTarget(o)?this.topCenter:this.topRight.ownsTarget(o)?this.topRight:this.centerLeft.ownsTarget(o)?this.centerLeft:this.centerRight.ownsTarget(o)?this.centerRight:this.bottomLeft.ownsTarget(o)?this.bottomLeft:this.bottomCenter.ownsTarget(o)?this.bottomCenter:this.bottomRight.ownsTarget(o)?this.bottomRight:void 0},L}(),Ge=function(){function L(){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 L.prototype.ownsTarget=function(o){return o===this.visual||o===this.visual.childNodes[0]||o===this.visual.childNodes[1]},L}(),qe=function(){function L(){}return L.toITransformMatrix=function(o){return{a:o.a,b:o.b,c:o.c,d:o.d,e:o.e,f:o.f}},L.toSVGMatrix=function(o,c){return o.a=c.a,o.b=c.b,o.c=c.c,o.d=c.d,o.e=c.e,o.f=c.f,o},L}(),lt=function(L){function o(c,D,K){var k=L.call(this,c,D,K)||this;return k.left=0,k.top=0,k.width=0,k.height=0,k.defaultSize={x:50,y:20},k.offsetX=0,k.offsetY=0,k.rotationAngle=0,k.CB_DISTANCE=10,k._suppressMarkerCreateEvent=!1,k.container.transform.baseVal.appendItem(V.createTransform()),k.setupControlBox(),k}return q(o,L),Object.defineProperty(o.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"visual",{get:function(){return this._visual},set:function(c){this._visual=c;var D=V.createTransform();this._visual.transform.baseVal.appendItem(D)},enumerable:!1,configurable:!0}),o.prototype.ownsTarget=function(c){return!!L.prototype.ownsTarget.call(this,c)||!!(this.controlGrips.findGripByVisual(c)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(c))},o.prototype.pointerDown=function(c,D){L.prototype.pointerDown.call(this,c,D),this.state==="new"&&(this.left=c.x,this.top=c.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var K=this.unrotatePoint(c);if(this.manipulationStartX=K.x,this.manipulationStartY=K.y,this.offsetX=K.x-this.left,this.offsetY=K.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(D),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(D)){this.activeGrip=this.rotatorGrip;var k=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=k.x-this.width/2,this.top=k.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ce=this.container.transform.baseVal.getItem(0);ce.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ce,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},o.prototype.pointerUp=function(c){var D=this.state;L.prototype.pointerUp.call(this,c),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(c),this._state="select",D==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},o.prototype.moveVisual=function(c){this.visual.style.transform="translate("+c.x+"px, "+c.y+"px)"},o.prototype.manipulate=function(c){var D=this.unrotatePoint(c);this.state==="creating"?this.resize(c):this.state==="move"?(this.left=this.manipulationStartLeft+(D.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(D.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(D):this.state==="rotate"&&this.rotate(c)},o.prototype.resize=function(c){var D=this.manipulationStartLeft,K=this.manipulationStartWidth,k=this.manipulationStartTop,ce=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:D=this.manipulationStartLeft+c.x-this.manipulationStartX,K=this.manipulationStartWidth+this.manipulationStartLeft-D;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:K=this.manipulationStartWidth+c.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:k=this.manipulationStartTop+c.y-this.manipulationStartY,ce=this.manipulationStartHeight+this.manipulationStartTop-k;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ce=this.manipulationStartHeight+c.y-this.manipulationStartY}K>=0?(this.left=D,this.width=K):(this.left=D+K,this.width=-K),ce>=0?(this.top=k,this.height=ce):(this.top=k+ce,this.height=-ce),this.setSize()},o.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},o.prototype.rotate=function(c){if(Math.abs(c.x-this.centerX)>.1){var D=Math.sign(c.x-this.centerX);this.rotationAngle=180*Math.atan((c.y-this.centerY)/(c.x-this.centerX))/Math.PI+90*D,this.applyRotation()}},o.prototype.applyRotation=function(){var c=this.container.transform.baseVal.getItem(0);c.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(c,0)},o.prototype.rotatePoint=function(c){if(this.rotationAngle===0)return c;var D=this.container.getCTM(),K=V.createPoint(c.x,c.y);return{x:(K=K.matrixTransform(D)).x,y:K.y}},o.prototype.unrotatePoint=function(c){if(this.rotationAngle===0)return c;var D=this.container.getCTM();D=D.inverse();var K=V.createPoint(c.x,c.y);return{x:(K=K.matrixTransform(D)).x,y:K.y}},o.prototype.select=function(){L.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},o.prototype.deselect=function(){L.prototype.deselect.call(this),this.controlBox.style.display="none"},o.prototype.setupControlBox=function(){this.controlBox=V.createGroup();var c=V.createTransform();c.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(c),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),this.globalSettings.disableRotation!==!0&&(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 xe,this.addControlGrips(),this.controlBox.style.display="none"},o.prototype.adjustControlBox=function(){var c=this.controlBox.transform.baseVal.getItem(0);c.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(c,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},o.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},o.prototype.createGrip=function(){var c=new Ge;return c.visual.transform.baseVal.appendItem(V.createTransform()),this.controlBox.appendChild(c.visual),c},o.prototype.positionGrips=function(){var c=this.controlGrips.topLeft.GRIP_SIZE,D=-c/2,K=D,k=(this.width+this.CB_DISTANCE)/2-c/2,ce=(this.height+this.CB_DISTANCE)/2-c/2,ze=this.height+this.CB_DISTANCE-c/2,gt=this.width+this.CB_DISTANCE-c/2;this.positionGrip(this.controlGrips.topLeft.visual,D,K),this.positionGrip(this.controlGrips.topCenter.visual,k,K),this.positionGrip(this.controlGrips.topRight.visual,gt,K),this.positionGrip(this.controlGrips.centerLeft.visual,D,ce),this.positionGrip(this.controlGrips.centerRight.visual,gt,ce),this.positionGrip(this.controlGrips.bottomLeft.visual,D,ze),this.positionGrip(this.controlGrips.bottomCenter.visual,k,ze),this.positionGrip(this.controlGrips.bottomRight.visual,gt,ze),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,k,K-3*this.CB_DISTANCE)},o.prototype.positionGrip=function(c,D,K){var k=c.transform.baseVal.getItem(0);k.setTranslate(D,K),c.transform.baseVal.replaceItem(k,0)},o.prototype.hideControlBox=function(){this.controlBox.style.display="none"},o.prototype.showControlBox=function(){this.controlBox.style.display=""},o.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:qe.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:qe.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},L.prototype.getState.call(this))},o.prototype.restoreState=function(c){L.prototype.restoreState.call(this,c);var D=c;this.left=D.left,this.top=D.top,this.width=D.width,this.height=D.height,this.rotationAngle=D.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(qe.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,D.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(qe.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,D.containerTransformMatrix))},o.prototype.scale=function(c,D){L.prototype.scale.call(this,c,D);var K=this.rotatePoint({x:this.left,y:this.top}),k=this.unrotatePoint({x:K.x*c,y:K.y*D});this.left=k.x,this.top=k.y,this.width=this.width*c,this.height=this.height*D,this.adjustControlBox()},o}(Ne),ot=function(L){function o(c,D,K){var k=L.call(this,c,D,K)||this;return k.fillColor="transparent",k.strokeColor="transparent",k.strokeWidth=0,k.strokeDasharray="",k.opacity=1,k.setStrokeColor=k.setStrokeColor.bind(k),k.setFillColor=k.setFillColor.bind(k),k.setStrokeWidth=k.setStrokeWidth.bind(k),k.setStrokeDasharray=k.setStrokeDasharray.bind(k),k.createVisual=k.createVisual.bind(k),k}return q(o,L),o.prototype.ownsTarget=function(c){return!(!L.prototype.ownsTarget.call(this,c)&&c!==this.visual)},o.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)},o.prototype.pointerDown=function(c,D){L.prototype.pointerDown.call(this,c,D),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},o.prototype.manipulate=function(c){L.prototype.manipulate.call(this,c)},o.prototype.resize=function(c){L.prototype.resize.call(this,c),this.setSize()},o.prototype.setSize=function(){L.prototype.setSize.call(this),V.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},o.prototype.pointerUp=function(c){L.prototype.pointerUp.call(this,c),this.setSize()},o.prototype.setStrokeColor=function(c){this.strokeColor=c,this.visual&&V.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(c),this.stateChanged()},o.prototype.setFillColor=function(c){this.fillColor=c,this.visual&&V.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},o.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.visual&&V.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},o.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.visual&&V.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},o.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},L.prototype.getState.call(this))},o.prototype.restoreState=function(c){var D=c;this.fillColor=D.fillColor,this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.opacity=D.opacity,this.createVisual(),L.prototype.restoreState.call(this,c),this.setSize()},o.prototype.scale=function(c,D){L.prototype.scale.call(this,c,D),this.setSize()},o.title="Rectangle marker",o}(lt),bt=function(L){function o(c,D,K,k){var ce=L.call(this,c,k||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ce.widths=[],ce.widthBoxes=[],ce.widths=D,ce.currentWidth=K,ce.setCurrentWidth=ce.setCurrentWidth.bind(ce),ce}return q(o,L),o.prototype.getUi=function(){var c=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",this.widths.forEach(function(K){var k=document.createElement("div");k.style.display="flex",k.style.flexGrow="2",k.style.alignItems="center",k.style.justifyContent="space-between",k.style.padding="5px",k.style.borderWidth="2px",k.style.borderStyle="solid",k.style.borderColor=K===c.currentWidth?c.uiStyleSettings.toolboxAccentColor:"transparent",k.addEventListener("click",function(){c.setCurrentWidth(K,k)}),D.appendChild(k);var ce=document.createElement("div");ce.innerText=K.toString(),ce.style.marginRight="5px",k.appendChild(ce);var ze=document.createElement("div");ze.style.minHeight="20px",ze.style.flexGrow="2",ze.style.display="flex",ze.style.alignItems="center";var gt=document.createElement("hr");gt.style.minWidth="20px",gt.style.border="0px",gt.style.borderTop=K+"px solid "+c.uiStyleSettings.toolboxColor,gt.style.flexGrow="2",ze.appendChild(gt),k.appendChild(ze),c.widthBoxes.push(k)}),D},o.prototype.setCurrentWidth=function(c,D){var K=this;this.currentWidth=c,this.widthBoxes.forEach(function(k){k.style.borderColor=k===D?K.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},o}(Fe),ht=function(L){function o(c,D,K,k){var ce=L.call(this,c,k||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return ce.styles=[],ce.styleBoxes=[],ce.styles=D,ce.currentStyle=K,ce.setCurrentStyle=ce.setCurrentStyle.bind(ce),ce}return q(o,L),o.prototype.getUi=function(){var c=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",this.styles.forEach(function(K){var k=document.createElement("div");k.style.display="flex",k.style.alignItems="center",k.style.justifyContent="space-between",k.style.padding="5px",k.style.borderWidth="2px",k.style.borderStyle="solid",k.style.overflow="hidden",k.style.maxWidth=100/c.styles.length-5+"%",k.style.borderColor=K===c.currentStyle?c.uiStyleSettings.toolboxAccentColor:"transparent",k.addEventListener("click",function(){c.setCurrentStyle(K,k)}),D.appendChild(k);var ce=document.createElement("div");ce.style.minHeight="20px",ce.style.flexGrow="2",ce.style.overflow="hidden";var ze=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+c.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(K!==""?'stroke-dasharray="'+K+'"':"")+` />
</svg>`;ce.innerHTML=ze,k.appendChild(ce),c.styleBoxes.push(k)}),D},o.prototype.setCurrentStyle=function(c,D){var K=this;this.currentStyle=c,this.styleBoxes.forEach(function(k){k.style.borderColor=k===D?K.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},o}(Fe),ut=function(L){function o(c,D,K){var k=L.call(this,c,D,K)||this;return k.strokeColor=K.defaultColor,k.strokeWidth=K.defaultStrokeWidth,k.strokeDasharray=K.defaultStrokeDasharray,k.strokePanel=new He("Line color",K.defaultColorSet,K.defaultColor),k.strokePanel.onColorChanged=k.setStrokeColor,k.strokeWidthPanel=new bt("Line width",K.defaultStrokeWidths,K.defaultStrokeWidth),k.strokeWidthPanel.onWidthChanged=k.setStrokeWidth,k.strokeStylePanel=new ht("Line style",K.defaultStrokeDasharrays,K.defaultStrokeDasharray),k.strokeStylePanel.onStyleChanged=k.setStrokeDasharray,k}return q(o,L),Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var c=L.prototype.getState.call(this);return c.typeName=o.typeName,c},o.typeName="FrameMarker",o.title="Frame marker",o.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',o}(ot),Ze=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},Et=function(L){function o(c,D,K){var k=L.call(this,c,D,K)||this;return k.x1=0,k.y1=0,k.x2=0,k.y2=0,k.defaultLength=50,k.manipulationStartX=0,k.manipulationStartY=0,k.manipulationStartX1=0,k.manipulationStartY1=0,k.manipulationStartX2=0,k.manipulationStartY2=0,k.setupControlBox(),k}return q(o,L),o.prototype.ownsTarget=function(c){return!!L.prototype.ownsTarget.call(this,c)||!(!this.grip1.ownsTarget(c)&&!this.grip2.ownsTarget(c))},o.prototype.pointerDown=function(c,D){L.prototype.pointerDown.call(this,c,D),this.manipulationStartX=c.x,this.manipulationStartY=c.y,this.state==="new"&&(this.x1=c.x,this.y1=c.y,this.x2=c.x,this.y2=c.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(D)?this.activeGrip=this.grip1:this.grip2.ownsTarget(D)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},o.prototype.pointerUp=function(c){var D=this.state;L.prototype.pointerUp.call(this,c),this.state==="creating"&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(c),this._state="select",D==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},o.prototype.adjustVisual=function(){},o.prototype.manipulate=function(c){this.state==="creating"?this.resize(c):this.state==="move"?(this.x1=this.manipulationStartX1+c.x-this.manipulationStartX,this.y1=this.manipulationStartY1+c.y-this.manipulationStartY,this.x2=this.manipulationStartX2+c.x-this.manipulationStartX,this.y2=this.manipulationStartY2+c.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(c)},o.prototype.resize=function(c){switch(this.activeGrip){case this.grip1:this.x1=c.x,this.y1=c.y;break;case this.grip2:case void 0:this.x2=c.x,this.y2=c.y}this.adjustVisual(),this.adjustControlBox()},o.prototype.select=function(){L.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},o.prototype.deselect=function(){L.prototype.deselect.call(this),this.controlBox.style.display="none"},o.prototype.setupControlBox=function(){this.controlBox=V.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},o.prototype.adjustControlBox=function(){this.positionGrips()},o.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},o.prototype.createGrip=function(){var c=new Ge;return c.visual.transform.baseVal.appendItem(V.createTransform()),this.controlBox.appendChild(c.visual),c},o.prototype.positionGrips=function(){var c=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-c/2,this.y1-c/2),this.positionGrip(this.grip2.visual,this.x2-c/2,this.y2-c/2)},o.prototype.positionGrip=function(c,D,K){var k=c.transform.baseVal.getItem(0);k.setTranslate(D,K),c.transform.baseVal.replaceItem(k,0)},o.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},L.prototype.getState.call(this))},o.prototype.restoreState=function(c){L.prototype.restoreState.call(this,c);var D=c;this.x1=D.x1,this.y1=D.y1,this.x2=D.x2,this.y2=D.y2},o.prototype.scale=function(c,D){L.prototype.scale.call(this,c,D),this.x1=this.x1*c,this.y1=this.y1*D,this.x2=this.x2*c,this.y2=this.y2*D,this.adjustVisual(),this.adjustControlBox()},o}(Ne),St=function(L){function o(c,D,K){var k=L.call(this,c,D,K)||this;return k.strokeColor="transparent",k.strokeWidth=0,k.strokeDasharray="",k.setStrokeColor=k.setStrokeColor.bind(k),k.setStrokeWidth=k.setStrokeWidth.bind(k),k.setStrokeDasharray=k.setStrokeDasharray.bind(k),k.strokeColor=K.defaultColor,k.strokeWidth=K.defaultStrokeWidth,k.strokeDasharray=K.defaultStrokeDasharray,k.strokePanel=new He("Line color",K.defaultColorSet,K.defaultColor),k.strokePanel.onColorChanged=k.setStrokeColor,k.strokeWidthPanel=new bt("Line width",K.defaultStrokeWidths,K.defaultStrokeWidth),k.strokeWidthPanel.onWidthChanged=k.setStrokeWidth,k.strokeStylePanel=new ht("Line style",K.defaultStrokeDasharrays,K.defaultStrokeDasharray),k.strokeStylePanel.onStyleChanged=k.setStrokeDasharray,k}return q(o,L),o.prototype.ownsTarget=function(c){return!(!L.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.selectorLine&&c!==this.visibleLine)},o.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)},o.prototype.pointerDown=function(c,D){L.prototype.pointerDown.call(this,c,D),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},o.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()]]))},o.prototype.setStrokeColor=function(c){this.strokeColor=c,this.adjustVisual(),this.colorChanged(c)},o.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.adjustVisual()},o.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.adjustVisual(),this.stateChanged()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var c=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},L.prototype.getState.call(this));return c.typeName=o.typeName,c},o.prototype.restoreState=function(c){L.prototype.restoreState.call(this,c);var D=c;this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.createVisual(),this.adjustVisual()},o.typeName="LineMarker",o.title="Line marker",o.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',o}(Et),We=function(L){function o(c,D,K,k){var ce=L.call(this,c,k||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return ce.fonts=[],ce.fontBoxes=[],ce.fonts=D,ce.currentFont=K,ce.setCurrentFont=ce.setCurrentFont.bind(ce),ce}return q(o,L),o.prototype.getUi=function(){var c=this,D=document.createElement("div");return D.style.overflow="hidden",D.style.flexGrow="2",this.fonts.forEach(function(K){var k=document.createElement("div");k.style.display="inline-block",k.style.alignItems="center",k.style.justifyContent="space-between",k.style.padding="5px",k.style.borderWidth="2px",k.style.borderStyle="solid",k.style.overflow="hidden",k.style.maxWidth=100/c.fonts.length-5+"%",k.style.borderColor=K===c.currentFont?c.uiStyleSettings.toolboxAccentColor:"transparent",k.addEventListener("click",function(){c.setCurrentFont(K,k)}),D.appendChild(k);var ce=document.createElement("div");ce.style.display="flex",ce.style.minHeight="20px",ce.style.flexGrow="2",ce.style.fontFamily=K,ce.style.overflow="hidden";var ze=document.createElement("div");ze.style.whiteSpace="nowrap",ze.style.overflow="hidden",ze.style.textOverflow="ellipsis",ze.innerHTML="The quick brown fox jumps over the lazy dog",ce.appendChild(ze),k.appendChild(ce),c.fontBoxes.push(k)}),D},o.prototype.setCurrentFont=function(c,D){var K=this;this.currentFont=c,this.fontBoxes.forEach(function(k){k.style.borderColor=k===D?K.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},o}(Fe),it=function(L){function o(c,D,K){var k=L.call(this,c,D,K)||this;return k.color="transparent",k.padding=5,k.DEFAULT_TEXT="your text here",k.text=k.DEFAULT_TEXT,k.isMoved=!1,k.color=K.defaultColor,k.fontFamily=K.defaultFontFamily,k.defaultSize={x:100,y:30},k.setColor=k.setColor.bind(k),k.setFont=k.setFont.bind(k),k.renderText=k.renderText.bind(k),k.sizeText=k.sizeText.bind(k),k.textEditDivClicked=k.textEditDivClicked.bind(k),k.showTextEditor=k.showTextEditor.bind(k),k.setSize=k.setSize.bind(k),k.positionTextEditor=k.positionTextEditor.bind(k),k.colorPanel=new He("Color",K.defaultColorSet,K.defaultColor),k.colorPanel.onColorChanged=k.setColor,k.fontFamilyPanel=new We("Font",K.defaultFontFamilies,K.defaultFontFamily),k.fontFamilyPanel.onFontChanged=k.setFont,k}return q(o,L),o.prototype.ownsTarget=function(c){if(L.prototype.ownsTarget.call(this,c)||c===this.visual||c===this.textElement||c===this.bgRectangle)return!0;var D=!1;return this.textElement.childNodes.forEach(function(K){K===c&&(D=!0)}),D},o.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()},o.prototype.pointerDown=function(c,D){L.prototype.pointerDown.call(this,c,D),this.isMoved=!1,this.pointerDownPoint=c,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},o.prototype.renderText=function(){var c=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(D){c.textElement.appendChild(V.createTSpan(D.trim()===""?" ":D.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},o.prototype.getTextScale=function(){var c=this.textElement.getBBox(),D=1;if(c.width>0&&c.height>0){var K=(1*this.width-this.width*this.padding*2/100)/c.width,k=(1*this.height-this.height*this.padding*2/100)/c.height;D=Math.min(K,k)}return D},o.prototype.getTextPosition=function(c){var D=this.textElement.getBBox(),K=0,k=0;return D.width>0&&D.height>0&&(K=(this.width-D.width*c)/2,k=this.height/2-D.height*c/2),{x:K,y:k}},o.prototype.sizeText=function(){var c=this.textElement.getBBox(),D=this.getTextScale(),K=this.getTextPosition(D);K.y-=c.y*D,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+K.x+"px, "+K.y+"px) scale("+D+", "+D+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(K.x,K.y),this.textElement.transform.baseVal.getItem(1).setScale(D,D))},o.prototype.manipulate=function(c){L.prototype.manipulate.call(this,c),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(c.x-this.pointerDownPoint.x)>5||Math.abs(c.y-this.pointerDownPoint.y)>5)},o.prototype.resize=function(c){L.prototype.resize.call(this,c),this.isMoved=!0,this.setSize(),this.sizeText()},o.prototype.setSize=function(){L.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()]]))},o.prototype.pointerUp=function(c){var D=this.state;D==="creating"&&(this._suppressMarkerCreateEvent=!0),L.prototype.pointerUp.call(this,c),this.setSize(),(D==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},o.prototype.showTextEditor=function(){var c=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(D){D.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var D=Number.parseFloat(c.textEditor.style.fontSize);c.textEditor.clientWidth>=Number.parseInt(c.textEditor.style.maxWidth)&&D>.9;)D-=.1,c.textEditor.style.fontSize=Math.max(D,.9)+"em"}),this.textEditor.addEventListener("keyup",function(D){D.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(D){if(D.clipboardData){var K=D.clipboardData.getData("text"),k=window.getSelection();if(!k.rangeCount)return!1;k.deleteFromDocument(),k.getRangeAt(0).insertNode(document.createTextNode(K)),D.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){c.textEditDivClicked(c.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},o.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var c=this.getTextScale(),D=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),K=this.textElement.getBBox(),k={x:K.width*c,y:K.height*c};D.x-=k.x/2,D.y-=k.y/2,this.textEditor.style.top=D.y+"px",this.textEditor.style.left=D.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-D.x+"px",this.textEditor.style.fontSize=Math.max(16*c,12)+"px",this.textElement.style.display="none"}},o.prototype.textEditDivClicked=function(c){this.text=c.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},o.prototype.select=function(){L.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},o.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),L.prototype.deselect.call(this)},o.prototype.dblClick=function(c,D){L.prototype.dblClick.call(this,c,D),this.showTextEditor()},o.prototype.setColor=function(c){this.textElement&&V.setAttributes(this.textElement,[["fill",c]]),this.color=c,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(c)},o.prototype.setFont=function(c){this.textElement&&V.setAttributes(this.textElement,[["font-family",c]]),this.fontFamily=c,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},o.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},o.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var c=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},L.prototype.getState.call(this));return c.typeName=o.typeName,c},o.prototype.restoreState=function(c){var D=c;this.color=D.color,this.fontFamily=D.fontFamily,this.padding=D.padding,this.text=D.text,this.createVisual(),L.prototype.restoreState.call(this,c),this.setSize()},o.prototype.scale=function(c,D){L.prototype.scale.call(this,c,D),this.setSize(),this.sizeText(),this.positionTextEditor()},o.typeName="TextMarker",o.title="Text marker",o.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>',o}(lt),ye=function(L){function o(c,D,K){var k=L.call(this,c,D,K)||this;return k.color="transparent",k.lineWidth=3,k.drawing=!1,k.pixelRatio=1,k.color=K.defaultColor,k.lineWidth=K.defaultStrokeWidth,k.pixelRatio=K.freehandPixelRatio,k.setColor=k.setColor.bind(k),k.addCanvas=k.addCanvas.bind(k),k.finishCreation=k.finishCreation.bind(k),k.setLineWidth=k.setLineWidth.bind(k),k.colorPanel=new He("Color",K.defaultColorSet,K.defaultColor),k.colorPanel.onColorChanged=k.setColor,k.lineWidthPanel=new bt("Line width",K.defaultStrokeWidths,K.defaultStrokeWidth),k.lineWidthPanel.onWidthChanged=k.setLineWidth,k}return q(o,L),o.prototype.ownsTarget=function(c){return!(!L.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.drawingImage)},o.prototype.createVisual=function(){this.visual=V.createGroup(),this.drawingImage=V.createImage(),this.visual.appendChild(this.drawingImage);var c=V.createTransform();this.visual.transform.baseVal.appendItem(c),this.addMarkerVisualToContainer(this.visual)},o.prototype.pointerDown=function(c,D){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(c.x,c.y),this.drawing=!0):L.prototype.pointerDown.call(this,c,D)},o.prototype.manipulate=function(c){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(c.x,c.y),this.canvasContext.stroke()):L.prototype.manipulate.call(this,c)},o.prototype.resize=function(c){L.prototype.resize.call(this,c),V.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),V.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},o.prototype.pointerUp=function(c){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):L.prototype.pointerUp.call(this,c)},o.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)},o.prototype.select=function(){this.state==="creating"&&this.finishCreation(),L.prototype.select.call(this)},o.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),L.prototype.deselect.call(this)},o.prototype.finishCreation=function(){for(var c=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),D=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],K=D[0],k=D[1],ce=D[2],ze=D[3],gt=!1,Nt=0;Nt<this.canvasElement.height;Nt++)for(var Xe=0;Xe<this.canvasElement.width;Xe++)c.data[Nt*this.canvasElement.width*4+4*Xe+3]>0&&(gt=!0,Nt<k&&(k=Nt),Xe<K&&(K=Xe),Nt>ze&&(ze=Nt),Xe>ce&&(ce=Xe));if(gt){this.left=K/this.pixelRatio,this.top=k/this.pixelRatio,this.width=(ce-K)/this.pixelRatio,this.height=(ze-k)/this.pixelRatio;var Jt=document.createElement("canvas");Jt.width=ce-K,Jt.height=ze-k,Jt.getContext("2d").putImageData(this.canvasContext.getImageData(K,k,ce-K,ze-k),0,0),this.drawingImgUrl=Jt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},o.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})},o.prototype.setColor=function(c){this.color=c,this.colorChanged(c)},o.prototype.setLineWidth=function(c){this.lineWidth=c},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var c=Object.assign({drawingImgUrl:this.drawingImgUrl},L.prototype.getState.call(this));return c.typeName=o.typeName,c},o.prototype.restoreState=function(c){this.createVisual(),L.prototype.restoreState.call(this,c),this.drawingImgUrl=c.drawingImgUrl,this.setDrawingImage()},o.prototype.scale=function(c,D){L.prototype.scale.call(this,c,D),this.setDrawingImage()},o.typeName="FreehandMarker",o.title="Freehand marker",o.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>',o}(lt),he=function(L){function o(c,D,K){var k=L.call(this,c,K||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return k.typeBoxes=[],k.currentType=D,k.setCurrentType=k.setCurrentType.bind(k),k}return q(o,L),o.prototype.getUi=function(){var c=this,D=document.createElement("div");D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2";for(var K=function(ze){var gt="both";switch(ze){case 0:gt="both";break;case 1:gt="start";break;case 2:gt="end";break;case 3:gt="none"}var Nt=document.createElement("div");if(Nt.style.display="flex",Nt.style.flexGrow="2",Nt.style.alignItems="center",Nt.style.justifyContent="space-between",Nt.style.padding="5px",Nt.style.borderWidth="2px",Nt.style.borderStyle="solid",Nt.style.borderColor=gt===k.currentType?k.uiStyleSettings.toolboxAccentColor:"transparent",Nt.addEventListener("click",function(){c.setCurrentType(gt,Nt)}),D.appendChild(Nt),gt==="both"||gt==="start"){var Xe=document.createElement("div");Xe.style.display="flex",Xe.style.alignItems="center",Xe.style.minHeight="20px",Xe.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,5 10,0 10,10" fill="`+(k.uiStyleSettings!==void 0?k.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Xe.style.marginLeft="5px",Nt.appendChild(Xe)}var Jt=document.createElement("div");Jt.style.display="flex",Jt.style.alignItems="center",Jt.style.minHeight="20px",Jt.style.flexGrow="2";var Pn=document.createElement("hr");if(Pn.style.minWidth="20px",Pn.style.border="0px",Pn.style.borderTop="3px solid "+(k.uiStyleSettings!==void 0?k.uiStyleSettings.toolboxColor:"#eeeeee"),Pn.style.flexGrow="2",Jt.appendChild(Pn),Nt.appendChild(Jt),gt==="both"||gt==="end"){var Bn=document.createElement("div");Bn.style.display="flex",Bn.style.alignItems="center",Bn.style.minHeight="20px",Bn.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,0 10,5 0,10" fill="`+(k.uiStyleSettings!==void 0?k.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Bn.style.marginRight="5px",Nt.appendChild(Bn)}k.typeBoxes.push(Nt)},k=this,ce=0;ce<4;ce++)K(ce);return D},o.prototype.setCurrentType=function(c,D){var K=this;this.currentType=c,this.typeBoxes.forEach(function(k){k.style.borderColor=k===D?K.uiStyleSettings!==void 0?K.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},o}(Fe),fe=function(L){function o(c,D,K){var k=L.call(this,c,D,K)||this;return k.arrowType="end",k.arrowBaseHeight=10,k.arrowBaseWidth=10,k.getArrowPoints=k.getArrowPoints.bind(k),k.setArrowType=k.setArrowType.bind(k),k.arrowTypePanel=new he("Arrow type","end"),k.arrowTypePanel.onArrowTypeChanged=k.setArrowType,k}return q(o,L),o.prototype.ownsTarget=function(c){return!(!L.prototype.ownsTarget.call(this,c)&&c!==this.arrow1&&c!==this.arrow2)},o.prototype.getArrowPoints=function(c,D){var K=this.arrowBaseWidth+2*this.strokeWidth,k=this.arrowBaseHeight+2*this.strokeWidth;return c-K/2+","+(D+k/2)+" "+c+","+(D-k/2)+" "+(c+K/2)+","+(D+k/2)},o.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)},o.prototype.pointerDown=function(c,D){L.prototype.pointerDown.call(this,c,D),this.state==="creating"&&this.createTips()},o.prototype.adjustVisual=function(){if(L.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",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 c=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),D=this.arrow1.transform.baseVal.getItem(0);D.setRotate(c,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(D,0);var K=this.arrow2.transform.baseVal.getItem(0);K.setRotate(c+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(K,0)}},o.prototype.setArrowType=function(c){this.arrowType=c,this.adjustVisual(),this.stateChanged()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var c=Object.assign({arrowType:this.arrowType},L.prototype.getState.call(this));return c.typeName=o.typeName,c},o.prototype.restoreState=function(c){L.prototype.restoreState.call(this,c);var D=c;this.arrowType=D.arrowType,this.createTips(),this.adjustVisual()},o.typeName="ArrowMarker",o.title="Arrow marker",o.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',o}(St),X=function(L){function o(c,D,K){var k=L.call(this,c,D,K)||this;return k.fillColor=K.defaultFillColor,k.strokeWidth=0,k.fillPanel=new He("Color",K.defaultColorSet,K.defaultFillColor),k.fillPanel.onColorChanged=k.setFillColor,k}return q(o,L),Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var c=L.prototype.getState.call(this);return c.typeName=o.typeName,c},o.typeName="CoverMarker",o.title="Cover marker",o.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',o}(ot),$=function(L){function o(c,D,K,k){var ce=L.call(this,c,k||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return ce.opacities=[],ce.opacityBoxes=[],ce.opacities=D,ce.currentOpacity=K,ce.setCurrentOpacity=ce.setCurrentOpacity.bind(ce),ce}return q(o,L),o.prototype.getUi=function(){var c=this,D=document.createElement("div");return D.style.display="flex",D.style.overflow="hidden",D.style.flexGrow="2",D.style.justifyContent="space-between",this.opacities.forEach(function(K){var k=document.createElement("div");k.style.display="flex",k.style.alignItems="center",k.style.justifyContent="center",k.style.padding="5px",k.style.borderWidth="2px",k.style.borderStyle="solid",k.style.borderColor=K===c.currentOpacity?c.uiStyleSettings.toolboxAccentColor:"transparent",k.addEventListener("click",function(){c.setCurrentOpacity(K,k)}),D.appendChild(k);var ce=document.createElement("div");ce.innerText=100*K+"%",k.appendChild(ce),c.opacityBoxes.push(k)}),D},o.prototype.setCurrentOpacity=function(c,D){var K=this;this.currentOpacity=c,this.opacityBoxes.forEach(function(k){k.style.borderColor=k===D?K.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},o}(Fe),te=function(L){function o(c,D,K){var k=L.call(this,c,D,K)||this;return k.setOpacity=k.setOpacity.bind(k),k.fillColor=K.defaultHighlightColor,k.strokeWidth=0,k.opacity=K.defaultHighlightOpacity,k.fillPanel=new He("Color",K.defaultColorSet,k.fillColor),k.fillPanel.onColorChanged=k.setFillColor,k.opacityPanel=new $("Opacity",K.defaultOpacitySteps,k.opacity),k.opacityPanel.onOpacityChanged=k.setOpacity,k}return q(o,L),o.prototype.setOpacity=function(c){this.opacity=c,this.visual&&V.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var c=L.prototype.getState.call(this);return c.typeName=o.typeName,c},o.typeName="HighlightMarker",o.title="Highlight marker",o.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>',o}(X),oe='<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>',Te=function(L){function o(c,D,K){var k=L.call(this,c,D,K)||this;return k.bgColor="transparent",k.tipPosition={x:0,y:0},k.tipBase1Position={x:0,y:0},k.tipBase2Position={x:0,y:0},k.tipMoving=!1,k.color=K.defaultStrokeColor,k.bgColor=K.defaultFillColor,k.fontFamily=K.defaultFontFamily,k.defaultSize={x:100,y:30},k.setBgColor=k.setBgColor.bind(k),k.getTipPoints=k.getTipPoints.bind(k),k.positionTip=k.positionTip.bind(k),k.setTipPoints=k.setTipPoints.bind(k),k.colorPanel=new He("Text color",K.defaultColorSet,k.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>'),k.colorPanel.onColorChanged=k.setColor,k.bgColorPanel=new He("Fill color",K.defaultColorSet,k.bgColor,oe),k.bgColorPanel.onColorChanged=k.setBgColor,k.fontFamilyPanel=new We("Font",K.defaultFontFamilies,K.defaultFontFamily),k.fontFamilyPanel.onFontChanged=k.setFont,k.tipGrip=new Ge,k.tipGrip.visual.transform.baseVal.appendItem(V.createTransform()),k.controlBox.appendChild(k.tipGrip.visual),k}return q(o,L),o.prototype.ownsTarget=function(c){return L.prototype.ownsTarget.call(this,c)||this.tipGrip.ownsTarget(c)||this.tip===c},o.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)},o.prototype.pointerDown=function(c,D){this.state==="new"&&L.prototype.pointerDown.call(this,c,D),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(D)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):L.prototype.pointerDown.call(this,c,D)},o.prototype.pointerUp=function(c){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,L.prototype.pointerUp.call(this,c);else{var D=this.state==="creating";L.prototype.pointerUp.call(this,c),this.setTipPoints(D),this.positionTip()}},o.prototype.manipulate=function(c){if(this.tipMoving){var D=this.unrotatePoint(c);this.tipPosition={x:D.x-this.manipulationStartLeft,y:D.y-this.manipulationStartTop},this.positionTip()}else L.prototype.manipulate.call(this,c)},o.prototype.setBgColor=function(c){this.bgRectangle&&this.tip&&(V.setAttributes(this.bgRectangle,[["fill",c]]),V.setAttributes(this.tip,[["fill",c]])),this.bgColor=c,this.fillColorChanged(c)},o.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},o.prototype.setTipPoints=function(c){c===void 0&&(c=!1);var D=Math.min(this.height/2,15),K=this.height/5;c&&(this.tipPosition={x:D+K/2,y:this.height+20});var k=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?k<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(K=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:D,y:0},this.tipBase2Position={x:D+K,y:0}):(this.tipBase1Position={x:0,y:D},this.tipBase2Position={x:0,y:D+K}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?k<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(K=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-D-K,y:0},this.tipBase2Position={x:this.width-D,y:0}):(this.tipBase1Position={x:this.width,y:D},this.tipBase2Position={x:this.width,y:D+K}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?k<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(K=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-D-K,y:this.height},this.tipBase2Position={x:this.width-D,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-D-K},this.tipBase2Position={x:this.width,y:this.height-D}):k<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(K=this.width/5,D=Math.min(this.width/2,15),this.tipBase1Position={x:D,y:this.height},this.tipBase2Position={x:D+K,y:this.height}):(this.tipBase1Position={x:0,y:this.height-D},this.tipBase2Position={x:0,y:this.height-D-K})},o.prototype.resize=function(c){L.prototype.resize.call(this,c),this.positionTip()},o.prototype.positionTip=function(){V.setAttributes(this.tip,[["points",this.getTipPoints()]]);var c=this.tipGrip.visual.transform.baseVal.getItem(0);c.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(c,0)},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),o.prototype.select=function(){this.positionTip(),L.prototype.select.call(this)},o.prototype.getState=function(){var c=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},L.prototype.getState.call(this));return c.typeName=o.typeName,c},o.prototype.restoreState=function(c){var D=c;this.bgColor=D.bgColor,this.tipPosition=D.tipPosition,L.prototype.restoreState.call(this,c),this.createTip(),this.setTipPoints()},o.prototype.scale=function(c,D){L.prototype.scale.call(this,c,D),this.tipPosition={x:this.tipPosition.x*c,y:this.tipPosition.y*D},this.positionTip()},o.typeName="CalloutMarker",o.title="Callout marker",o.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>',o}(it),Pe=function(L){function o(c,D,K){var k=L.call(this,c,D,K)||this;return k.fillColor="transparent",k.strokeColor="transparent",k.strokeWidth=0,k.strokeDasharray="",k.opacity=1,k.strokeColor=K.defaultColor,k.strokeWidth=K.defaultStrokeWidth,k.strokeDasharray=K.defaultStrokeDasharray,k.fillColor=K.defaultFillColor,k.setStrokeColor=k.setStrokeColor.bind(k),k.setFillColor=k.setFillColor.bind(k),k.setStrokeWidth=k.setStrokeWidth.bind(k),k.setStrokeDasharray=k.setStrokeDasharray.bind(k),k.setOpacity=k.setOpacity.bind(k),k.createVisual=k.createVisual.bind(k),k.strokePanel=new He("Line color",Q(K.defaultColorSet,["transparent"]),K.defaultColor),k.strokePanel.onColorChanged=k.setStrokeColor,k.fillPanel=new He("Fill color",Q(K.defaultColorSet,["transparent"]),k.fillColor,oe),k.fillPanel.onColorChanged=k.setFillColor,k.strokeWidthPanel=new bt("Line width",K.defaultStrokeWidths,K.defaultStrokeWidth),k.strokeWidthPanel.onWidthChanged=k.setStrokeWidth,k.strokeStylePanel=new ht("Line style",K.defaultStrokeDasharrays,K.defaultStrokeDasharray),k.strokeStylePanel.onStyleChanged=k.setStrokeDasharray,k.opacityPanel=new $("Opacity",K.defaultOpacitySteps,k.opacity),k.opacityPanel.onOpacityChanged=k.setOpacity,k}return q(o,L),o.prototype.ownsTarget=function(c){return!(!L.prototype.ownsTarget.call(this,c)&&c!==this.visual)},o.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)},o.prototype.pointerDown=function(c,D){L.prototype.pointerDown.call(this,c,D),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},o.prototype.manipulate=function(c){L.prototype.manipulate.call(this,c)},o.prototype.resize=function(c){L.prototype.resize.call(this,c),this.setSize()},o.prototype.setSize=function(){L.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()]])},o.prototype.pointerUp=function(c){L.prototype.pointerUp.call(this,c),this.setSize()},o.prototype.setStrokeColor=function(c){this.strokeColor=c,this.visual&&V.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(c),this.stateChanged()},o.prototype.setFillColor=function(c){this.fillColor=c,this.visual&&V.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(c),this.stateChanged()},o.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.visual&&V.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},o.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.visual&&V.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},o.prototype.setOpacity=function(c){this.opacity=c,this.visual&&V.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var c=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},L.prototype.getState.call(this));return c.typeName=o.typeName,c},o.prototype.restoreState=function(c){var D=c;this.fillColor=D.fillColor,this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.opacity=D.opacity,this.createVisual(),L.prototype.restoreState.call(this,c),this.setSize()},o.prototype.scale=function(c,D){L.prototype.scale.call(this,c,D),this.setSize()},o.typeName="EllipseMarker",o.title="Ellipse marker",o.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>',o}(lt),Je=function(L){function o(c,D,K){return L.call(this,c,D,K)||this}return q(o,L),Object.defineProperty(o.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),o.prototype.ownsTarget=function(c){return!(!L.prototype.ownsTarget.call(this,c)&&c!==this.tip1&&c!==this.tip2)},o.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)},o.prototype.pointerDown=function(c,D){L.prototype.pointerDown.call(this,c,D),this.state==="creating"&&this.createTips()},o.prototype.adjustVisual=function(){if(L.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 c=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),D=this.tip1.transform.baseVal.getItem(0);D.setRotate(c,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(D,0);var K=this.tip2.transform.baseVal.getItem(0);K.setRotate(c+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(K,0)}},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var c=L.prototype.getState.call(this);return c.typeName=o.typeName,c},o.prototype.restoreState=function(c){L.prototype.restoreState.call(this,c),this.createTips(),this.adjustVisual()},o.typeName="MeasurementMarker",o.title="Measurement marker",o.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>',o}(St),Wt=function(L){function o(c,D,K){var k=L.call(this,c,D,K)||this;return k.strokePanel.colors=K.defaultColorSet,k.fillColor="transparent",k}return q(o,L),Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var c=L.prototype.getState.call(this);return c.typeName=o.typeName,c},o.typeName="EllipseFrameMarker",o.title="Ellipse frame marker",o.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>',o}(Pe),Zt=function(){function L(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(L.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),L.prototype.addUndoStep=function(o){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(o)||(this.undoStack.push(o),JSON.stringify(this.lastRedoStep)!==JSON.stringify(o)&&this.redoStack.splice(0,this.redoStack.length))},L.prototype.replaceLastUndoStep=function(o){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=o)},L.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},L.prototype.undo=function(){if(this.undoStack.length>1){var o=this.undoStack.pop();return o!==void 0&&this.redoStack.push(o),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},L.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},L}(),Xt=function(L){function o(c,D,K){var k=L.call(this,c,D,K)||this;return k.strokeColor="transparent",k.strokeWidth=0,k.strokeDasharray="",k.curveX=0,k.curveY=0,k.manipulationStartCurveX=0,k.manipulationStartCurveY=0,k.setStrokeColor=k.setStrokeColor.bind(k),k.setStrokeWidth=k.setStrokeWidth.bind(k),k.setStrokeDasharray=k.setStrokeDasharray.bind(k),k.positionGrips=k.positionGrips.bind(k),k.addControlGrips=k.addControlGrips.bind(k),k.adjustVisual=k.adjustVisual.bind(k),k.setupControlBox=k.setupControlBox.bind(k),k.resize=k.resize.bind(k),k.strokeColor=K.defaultColor,k.strokeWidth=K.defaultStrokeWidth,k.strokeDasharray=K.defaultStrokeDasharray,k.strokePanel=new He("Line color",K.defaultColorSet,K.defaultColor),k.strokePanel.onColorChanged=k.setStrokeColor,k.strokeWidthPanel=new bt("Line width",K.defaultStrokeWidths,K.defaultStrokeWidth),k.strokeWidthPanel.onWidthChanged=k.setStrokeWidth,k.strokeStylePanel=new ht("Line style",K.defaultStrokeDasharrays,K.defaultStrokeDasharray),k.strokeStylePanel.onStyleChanged=k.setStrokeDasharray,k}return q(o,L),o.prototype.ownsTarget=function(c){return!(!L.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.selectorCurve&&c!==this.visibleCurve&&!this.curveGrip.ownsTarget(c))},o.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},o.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)},o.prototype.pointerDown=function(c,D){L.prototype.pointerDown.call(this,c,D),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=c.x,this.curveY=c.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(D)&&(this.activeGrip=this.curveGrip,this._state="resize")},o.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()]]))},o.prototype.setupControlBox=function(){L.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)},o.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,L.prototype.addControlGrips.call(this)},o.prototype.positionGrips=function(){L.prototype.positionGrips.call(this);var c=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-c/2,this.curveY-c/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()))},o.prototype.manipulate=function(c){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+c.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+c.y-this.manipulationStartY),L.prototype.manipulate.call(this,c)},o.prototype.resize=function(c){this.activeGrip===this.curveGrip&&(this.curveX=c.x,this.curveY=c.y),L.prototype.resize.call(this,c),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},o.prototype.setStrokeColor=function(c){this.strokeColor=c,this.adjustVisual(),this.colorChanged(c)},o.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.adjustVisual()},o.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.adjustVisual()},o.prototype.scale=function(c,D){this.curveX=this.curveX*c,this.curveY=this.curveY*D,L.prototype.scale.call(this,c,D)},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var c=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},L.prototype.getState.call(this));return c.typeName=o.typeName,c},o.prototype.restoreState=function(c){L.prototype.restoreState.call(this,c);var D=c;this.strokeColor=D.strokeColor,this.strokeWidth=D.strokeWidth,this.strokeDasharray=D.strokeDasharray,this.curveX=D.curveX,this.curveY=D.curveY,this.createVisual(),this.adjustVisual()},o.typeName="CurveMarker",o.title="Curve marker",o.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>',o}(Et),an=function(){function L(o,c){c===void 0&&(c=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=o,this.cancelable=c}return Object.defineProperty(L.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),L.prototype.preventDefault=function(){this._defaultPrevented=!0},L}(),fn=function(L){function o(c,D,K){var k=L.call(this,c,!1)||this;return k.dataUrl=D,k.state=K,k}return q(o,L),o}(an),It=function(L){function o(c,D,K){K===void 0&&(K=!1);var k=L.call(this,c,K)||this;return k.marker=D,k}return q(o,L),o}(an),Kn=function(){function L(){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 L.prototype.addEventListener=function(o,c){this[o].push(c)},L.prototype.removeEventListener=function(o,c){var D=this[o].indexOf(c);D>-1&&this[o].splice(D,1)},L}(),Sn=function(){function L(o){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Ze,this._isOpen=!1,this.undoRedoManager=new Zt,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 Kn,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=L.instanceCounter++,this.styles=new we(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=o,this.targetRoot=document.body,this.width=o.clientWidth,this.height=o.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(L.prototype,"ALL_MARKER_TYPES",{get:function(){return[ut,ye,fe,it,Wt,Pe,te,Te,Je,X,St,Xt]},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[ut,ye,fe,it,Pe,te,Te]},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"BASIC_MARKER_TYPES",{get:function(){return[ut,ye,fe,it,te]},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(o){var c=this;this._availableMarkerTypes.splice(0),o.forEach(function(D){if(typeof D=="string"){var K=c.ALL_MARKER_TYPES.find(function(k){return k.typeName===D});K!==void 0&&c._availableMarkerTypes.push(K)}else c._availableMarkerTypes.push(D)})},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(o){this._zoomLevel=o,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(L.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),L.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),Ce.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},L.prototype.show=function(){var o=this;this.styles.styleSheetRoot===void 0&&Ue.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=Ue.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(c){return c(new an(o))})},L.prototype.render=function(){return ee(this,void 0,void 0,function(){var o;return pe(this,function(c){switch(c.label){case 0:return this.setCurrentMarker(),(o=new ke).naturalSize=this.renderAtNaturalSize,o.imageType=this.renderImageType,o.imageQuality=this.renderImageQuality,o.markersOnly=this.renderMarkersOnly,o.width=this.renderWidth,o.height=this.renderHeight,[4,o.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return c.sent(),[4,o.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,c.sent()]}})})},L.prototype.close=function(o){var c=this;if(o===void 0&&(o=!1),this.isOpen){var D=!1;o||this.eventListeners.beforeclose.forEach(function(K){var k=new an(c,!0);K(k),k.defaultPrevented&&(D=!0)}),D||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(K){return K(new an(c))}),this.detachEvents(),this._isOpen=!1)}},L.prototype.addMarkersToToolbar=function(){for(var o,c=[],D=0;D<arguments.length;D++)c[D]=arguments[D];(o=this._availableMarkerTypes).push.apply(o,c)},L.prototype.addRenderEventListener=function(o){this.addEventListener("render",function(c){o(c.dataUrl,c.state)})},L.prototype.removeRenderEventListener=function(o){},L.prototype.addCloseEventListener=function(o){this.addEventListener("close",function(){o()})},L.prototype.removeCloseEventListener=function(o){},L.prototype.setupResizeObserver=function(){var o=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){o.resize(o.target.clientWidth,o.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return o.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},L.prototype.onPopupTargetResize=function(){var o=1*this.target.clientWidth/this.target.clientHeight,c=this.editorCanvas.clientWidth/o>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*o:this.editorCanvas.clientWidth,D=c<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/o;this.resize(c,D)},L.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},L.prototype.resize=function(o,c){this._isResizing=!0;var D=o/this.imageWidth,K=c/this.imageHeight;this.imageWidth=Math.round(o),this.imageHeight=Math.round(c),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(D,K),this._isResizing=!1},L.prototype.scaleMarkers=function(o,c){var D,K=this;this._currentMarker&&this._currentMarker instanceof it?this._currentMarker.scale(o,c):(D=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(k){k!==K._currentMarker&&k.scale(o,c)}),D!==void 0&&this.setCurrentMarker(D)},L.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"},L.prototype.setTopLeft=function(){var o=this.editingTarget.getBoundingClientRect(),c=this.editorCanvas.getBoundingClientRect();this.left=o.left-c.left,this.top=o.top-c.top},L.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)},L.prototype.addDefs=function(){for(var o,c=[],D=0;D<arguments.length;D++)c[D]=arguments[D];this.defs=V.createDefs(),this.addDefsToImage(),(o=this.defs).append.apply(o,c)},L.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},L.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)},L.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},L.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},L.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)},L.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},L.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)},L.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 o=document.createElement("a");o.href="https://markerjs.com/",o.target="_blank",o.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>',o.title="Powered by marker.js",o.style.display="grid",o.style.alignItems="center",o.style.justifyItems="center",o.style.padding="3px",o.style.width="20px",o.style.height="20px",this.logoUI.appendChild(o),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},L.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},L.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"},L.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},L.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var o=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=o+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new Le(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new Ke(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},L.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},L.prototype.removeMarker=function(o){this.markerImage.removeChild(o.container),this.markers.indexOf(o)>-1&&this.markers.splice(this.markers.indexOf(o),1),o.dispose()},L.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},L.prototype.toolbarButtonClicked=function(o,c){if(o==="marker"&&c!==void 0)this.createNewMarker(c);else if(o==="action")switch(c){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},L.prototype.deleteSelectedMarker=function(){var o=this;if(this._currentMarker!==void 0){var c=!1;if(this.eventListeners.markerbeforedelete.forEach(function(K){var k=new It(o,o._currentMarker,!0);K(k),k.defaultPrevented&&(c=!0)}),!c){var D=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(K){return K(new It(o,D))})}}},L.prototype.clear=function(){var o=this,c=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ce){var ze=new It(o,void 0,!0);ce(ze),ze.defaultPrevented&&(c=!0)}),!c)){this.setCurrentMarker();for(var D=function(ce){var ze=K.markers[ce];K.setCurrentMarker(K.markers[ce]),K._currentMarker.dispose(),K.markerImage.removeChild(K._currentMarker.container),K.markers.splice(K.markers.indexOf(K._currentMarker),1),K.eventListeners.markerdelete.forEach(function(gt){return gt(new It(o,ze))})},K=this,k=this.markers.length-1;k>=0;k--)D(k);this.addUndoStep()}},Object.defineProperty(L.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),L.prototype.showNotesEditor=function(){var o;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(o=this._currentMarker.notes)!==null&&o!==void 0?o:"",this.overlayContainer.appendChild(this.notesArea))},L.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},L.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},L.prototype.addUndoStep=function(){var o=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var c=this.getState(),D=this.undoRedoManager.getLastUndoStep();if(!D||D.width===c.width&&D.height===c.height){var K=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(c),K<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(k){return k(new an(o))})}else this.undoRedoManager.replaceLastUndoStep(c),this.eventListeners.statechange.forEach(function(k){return k(new an(o))})}},L.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},L.prototype.undoStep=function(){var o=this,c=this.undoRedoManager.undo();c!==void 0&&(this.restoreState(c),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(D){return D(new an(o))}))},L.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},L.prototype.redoStep=function(){var o=this,c=this.undoRedoManager.redo();c!==void 0&&(this.restoreState(c),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(D){return D(new an(o))}))},L.prototype.stepZoom=function(){var o=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=o<this.zoomSteps.length-1?this.zoomSteps[o+1]:this.zoomSteps[0]},L.prototype.panTo=function(o){this.contentDiv.scrollBy({left:this.prevPanPoint.x-o.x,top:this.prevPanPoint.y-o.y}),this.prevPanPoint=o},L.prototype.startRenderAndClose=function(){return ee(this,void 0,void 0,function(){var o,c,D=this;return pe(this,function(K){switch(K.label){case 0:return[4,this.render()];case 1:return o=K.sent(),c=this.getState(),this.eventListeners.render.forEach(function(k){return k(new fn(D,o,c))}),this.close(!0),[2]}})})},L.prototype.getState=function(o){o===!0&&this.setCurrentMarker();var c={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(D){return c.markers.push(D.getState())}),c},L.prototype.restoreState=function(o){var c=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);o.markers.forEach(function(D){var K=c._availableMarkerTypes.find(function(ce){return ce.typeName===D.typeName});if(K!==void 0){var k=c.addNewMarker(K);k.restoreState(D),c.markers.push(k)}}),o.width&&o.height&&(o.width!==this.imageWidth||o.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/o.width,this.imageHeight/o.height),this.eventListeners.restorestate.forEach(function(D){return D(new an(c))})},L.prototype.addNewMarker=function(o){var c=V.createGroup();return this.markerImage.appendChild(c),new o(c,this.overlayContainer,this.settings)},L.prototype.createNewMarker=function(o){var c,D=this;(c=typeof o=="string"?this._availableMarkerTypes.find(function(K){return K.typeName===o}):o)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(c),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(c.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(K){return K(new It(D,D._currentMarker))}))},L.prototype.markerCreated=function(o){var c=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(o),this.setCurrentMarker(o),o instanceof ye&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(ye):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(D){return D(new It(c,c._currentMarker))})},L.prototype.colorChanged=function(o){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=o,this.settings.defaultStrokeColor=o)},L.prototype.fillColorChanged=function(o){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=o)},L.prototype.markerStateChanged=function(o){var c=this;this.eventListeners.markerchange.forEach(function(D){return D(new It(c,o))})},L.prototype.setCurrentMarker=function(o){var c=this;this._currentMarker!==o&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(D){return D(new It(c,c._currentMarker))})),this._currentMarker=o,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(D){return D(new It(c,c._currentMarker))}))},L.prototype.onPointerDown=function(o){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||o.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var c=this.markers.find(function(D){return D.ownsTarget(o.target)});c!==void 0?(this.setCurrentMarker(c),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(o.clientX,o.clientY),o.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:o.clientX,y:o.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(o.clientX,o.clientY))},L.prototype.onDblClick=function(o){if(this._isFocused||this.focus(),this.mode==="select"){var c=this.markers.find(function(D){return D.ownsTarget(o.target)});c!==void 0&&c!==this._currentMarker&&this.setCurrentMarker(c),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(o.clientX,o.clientY),o.target):this.setCurrentMarker()}},L.prototype.onPointerMove=function(o){this.touchPoints!==1&&o.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||o.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(o.clientX,o.clientY)):this.zoomLevel>1&&this.panTo({x:o.clientX,y:o.clientY}))},L.prototype.onPointerUp=function(o){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(o.clientX,o.clientY)),this.isDragging=!1,this.addUndoStep()},L.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},L.prototype.onKeyUp=function(o){this._currentMarker===void 0||this.notesArea!==void 0||o.key!=="Delete"&&o.key!=="Backspace"||this.deleteSelectedMarker()},L.prototype.clientToLocalCoordinates=function(o,c){var D=this.markerImage.getBoundingClientRect();return{x:(o-D.left)/this.zoomLevel,y:(c-D.top)/this.zoomLevel}},L.prototype.onWindowResize=function(){this.positionUI()},L.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var o=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=o+"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()},L.prototype.addLicenseKey=function(o){Ce.addKey(o)},L.prototype.addEventListener=function(o,c){this.eventListeners.addEventListener(o,c)},L.prototype.removeEventListener=function(o,c){this.eventListeners.removeEventListener(o,c)},L.prototype.renderState=function(o){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(o),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(L.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),L.prototype.focus=function(){var o=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(c){return c(new an(o))}))},L.prototype.blur=function(){var o=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(c){return c(new an(o))}))},L.instanceCounter=0,L}();/* **********************************
cropro version 1.2.0
@license SEE LICENSE IN LICENSE
copyright Alan Mendelevich
see README and LICENSE for details
********************************** *//*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var Jn=function(L,o){return(Jn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,D){c.__proto__=D}||function(c,D){for(var K in D)Object.prototype.hasOwnProperty.call(D,K)&&(c[K]=D[K])})(L,o)};function Dn(L,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function c(){this.constructor=L}Jn(L,o),L.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}function on(L,o,c,D){return new(c||(c=Promise))(function(K,k){function ce(Nt){try{gt(D.next(Nt))}catch(Xe){k(Xe)}}function ze(Nt){try{gt(D.throw(Nt))}catch(Xe){k(Xe)}}function gt(Nt){var Xe;Nt.done?K(Nt.value):(Xe=Nt.value,Xe instanceof c?Xe:new c(function(Jt){Jt(Xe)})).then(ce,ze)}gt((D=D.apply(L,o||[])).next())})}function qn(L,o){var c,D,K,k,ce={label:0,sent:function(){if(1&K[0])throw K[1];return K[1]},trys:[],ops:[]};return k={next:ze(0),throw:ze(1),return:ze(2)},typeof Symbol=="function"&&(k[Symbol.iterator]=function(){return this}),k;function ze(gt){return function(Nt){return function(Xe){if(c)throw new TypeError("Generator is already executing.");for(;ce;)try{if(c=1,D&&(K=2&Xe[0]?D.return:Xe[0]?D.throw||((K=D.return)&&K.call(D),0):D.next)&&!(K=K.call(D,Xe[1])).done)return K;switch(D=0,K&&(Xe=[2&Xe[0],K.value]),Xe[0]){case 0:case 1:K=Xe;break;case 4:return ce.label++,{value:Xe[1],done:!1};case 5:ce.label++,D=Xe[1],Xe=[0];continue;case 7:Xe=ce.ops.pop(),ce.trys.pop();continue;default:if(!(K=ce.trys,(K=K.length>0&&K[K.length-1])||Xe[0]!==6&&Xe[0]!==2)){ce=0;continue}if(Xe[0]===3&&(!K||Xe[1]>K[0]&&Xe[1]<K[3])){ce.label=Xe[1];break}if(Xe[0]===6&&ce.label<K[1]){ce.label=K[1],K=Xe;break}if(K&&ce.label<K[2]){ce.label=K[2],ce.ops.push(Xe);break}K[2]&&ce.ops.pop(),ce.trys.pop();continue}Xe=o.call(L,ce)}catch(Jt){Xe=[6,Jt],D=0}finally{c=K=0}if(5&Xe[0])throw Xe[1];return{value:Xe[0]?Xe[1]:void 0,done:!0}}([gt,Nt])}}}var Ft=function(){function L(){}return L.addKey=function(o){L.key=o},Object.defineProperty(L,"isLicensed",{get:function(){return!!L.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(L.key)},enumerable:!1,configurable:!0}),L}(),Lt=function(){function L(){}return L.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},L.setAttributes=function(o,c){for(var D=0,K=c;D<K.length;D++){var k=K[D],ce=k[0],ze=k[1];o.setAttribute(ce,ze)}},L.createRect=function(o,c,D){var K=document.createElementNS("http://www.w3.org/2000/svg","rect");return K.setAttribute("width",o.toString()),K.setAttribute("height",c.toString()),D&&L.setAttributes(K,D),K},L.createLine=function(o,c,D,K,k){var ce=document.createElementNS("http://www.w3.org/2000/svg","line");return ce.setAttribute("x1",o.toString()),ce.setAttribute("y1",c.toString()),ce.setAttribute("x2",D.toString()),ce.setAttribute("y2",K.toString()),k&&L.setAttributes(ce,k),ce},L.createPolygon=function(o,c){var D=document.createElementNS("http://www.w3.org/2000/svg","polygon");return D.setAttribute("points",o),c&&L.setAttributes(D,c),D},L.createCircle=function(o,c){var D=document.createElementNS("http://www.w3.org/2000/svg","circle");return D.setAttribute("cx",(o/2).toString()),D.setAttribute("cy",(o/2).toString()),D.setAttribute("r",o.toString()),c&&L.setAttributes(D,c),D},L.createEllipse=function(o,c,D){var K=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return K.setAttribute("cx",(o/2).toString()),K.setAttribute("cy",(c/2).toString()),K.setAttribute("rx",(o/2).toString()),K.setAttribute("ry",(c/2).toString()),D&&L.setAttributes(K,D),K},L.createGroup=function(o){var c=document.createElementNS("http://www.w3.org/2000/svg","g");return o&&L.setAttributes(c,o),c},L.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},L.createMarker=function(o,c,D,K,k,ce,ze){var gt=document.createElementNS("http://www.w3.org/2000/svg","marker");return L.setAttributes(gt,[["id",o],["orient",c],["markerWidth",D.toString()],["markerHeight",K.toString()],["refX",k.toString()],["refY",ce.toString()]]),gt.appendChild(ze),gt},L.createText=function(o){var c=document.createElementNS("http://www.w3.org/2000/svg","text");return c.setAttribute("x","0"),c.setAttribute("y","0"),o&&L.setAttributes(c,o),c},L.createTSpan=function(o,c){var D=document.createElementNS("http://www.w3.org/2000/svg","tspan");return D.textContent=o,c&&L.setAttributes(D,c),D},L.createImage=function(o){var c=document.createElementNS("http://www.w3.org/2000/svg","image");return o&&L.setAttributes(c,o),c},L.createPoint=function(o,c){var D=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return D.x=o,D.y=c,D},L.createPath=function(o,c){var D=document.createElementNS("http://www.w3.org/2000/svg","path");return D.setAttribute("d",o),c&&L.setAttributes(D,c),D},L.createElement=function(o,c){var D=document.createElementNS("http://www.w3.org/2000/svg",o);return c&&L.setAttributes(D,c),D},L.getHollowRectanglePath=function(o,c,D,K,k,ce,ze,gt){return"M"+o+","+c+"V"+(c+K)+"H"+(o+D)+"V"+c+"H"+k+"V"+ce+"H"+(k+ze)+"V"+(ce+gt)+"H"+k+"V"+c+"Z"},L}(),Rr=function(){function L(o){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+o+"_"}return Object.defineProperty(L.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(L.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(L.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),L.prototype.addClass=function(o){return this.styleSheet===void 0&&this.addStyleSheet(),o.name=""+this.classNamePrefix+o.localName,this.classes.push(o),this.styleSheet.sheet.insertRule("."+o.name+" {"+o.style+"}",this.styleSheet.sheet.cssRules.length),o},L.prototype.addRule=function(o){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(o),this.styleSheet.sheet.insertRule(o.selector+" {"+o.style+"}",this.styleSheet.sheet.cssRules.length)},L.prototype.addStyleSheet=function(){var o;this.styleSheet=document.createElement("style"),((o=this.styleSheetRoot)!==null&&o!==void 0?o:document.head).appendChild(this.styleSheet),this.addRule(new kn("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new kn("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new kn("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new Wn("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new Wn("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},L.prototype.removeStyleSheet=function(){var o;this.styleSheet&&(((o=this.styleSheetRoot)!==null&&o!==void 0?o:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},L}(),kn=function(L,o){this.selector=L,this.style=o},Wn=function(L,o){this.localName=L,this.style=o},Vr=function(){function L(){this.blocks=[],this.display=""}return L.prototype.addButtonBlock=function(o){o.className=this.blockClassName,o.buttonClassName=this.buttonClassName,o.buttonColorsClassName=this.buttonColorsClassName,o.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(o)},L.prototype.addElementBlock=function(o){o.className===void 0&&(o.className=this.blockClassName),this.blocks.push(o)},L.prototype.getUI=function(){var o=document.createElement("div");return o.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,o.style.display=this.display,this.blocks.forEach(function(c){return o.appendChild(c.getUI())}),o},L}(),br=function(){function L(){}return L.prototype.getUI=function(){var o=document.createElement("div");if(o.className=this.className,this.minWidth!==void 0&&(o.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":o.style.justifyContent="flex-start";break;case"center":o.style.justifyContent="center";break;case"end":o.style.justifyContent="flex-end"}return o.style.whiteSpace="nowrap",o},L}(),Pr=function(L){function o(){var c=L!==null&&L.apply(this,arguments)||this;return c.buttons=[],c}return Dn(o,L),o.prototype.addButton=function(c){c.className=this.buttonClassName,c.colorsClassName=this.buttonColorsClassName,c.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(c)},o.prototype.getUI=function(){var c=L.prototype.getUI.call(this);return this.buttons.forEach(function(D){return c.appendChild(D.getUI())}),c},o}(br),nr=function(){function L(o,c){this._isActive=!1,this._isHidden=!1,this._icon=o,this.title=c,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(L.prototype,"icon",{get:function(){return this._icon},set:function(o){this._icon=o,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isActive",{get:function(){return this._isActive},set:function(o){this._isActive=o,this.adjustClassName()},enumerable:!1,configurable:!0}),L.prototype.getUI=function(){var o=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 o.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},L.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,"")))},L.prototype.hide=function(){this._isHidden=!0},L}(),dr=function(L){function o(){var c=L!==null&&L.apply(this,arguments)||this;return c.elements=[],c}return Dn(o,L),o.prototype.addElement=function(c){this.elements.push(c)},o.prototype.getUI=function(){var c=L.prototype.getUI.call(this);return this.elements.forEach(function(D){return c.appendChild(D)}),c},o}(br),Ur=function(){function L(o,c){this.horizontal=o,this.vertical=c}return Object.defineProperty(L.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),L.prototype.getVerticalLength=function(o){return o/this.ratio},L.prototype.getHorizontalLength=function(o){return o*this.ratio},L}(),Ar=function(){function L(){}return L.getIcon=function(o,c){if(o>0&&c>0){var D=new Ur(o,c),K=D.ratio>=1?20:D.getHorizontalLength(20),k=D.ratio<1?20:D.getVerticalLength(20),ce=document.createElementNS("http://www.w3.org/2000/svg","svg");ce.setAttribute("xmlns","http://www.w3.org/2000/svg"),ce.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ce);var ze=Lt.createDefs();ce.appendChild(ze);var gt=Lt.createElement("clipPath",[["id","text-bg-clip"]]);ze.appendChild(gt);var Nt=Lt.createPath(Lt.getHollowRectanglePath((24-K)/2,(24-k)/2,K,k,(24-K)/2+2,(24-k)/2+2,K-4,k-4));ce.appendChild(Nt);var Xe=Lt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Xe.appendChild(Lt.createTSpan(o+":"+c)),ce.appendChild(Xe);var Jt=Xe.getBBox();Lt.setAttributes(Xe,[["x",((24-Jt.width)/2).toString()],["y",((24-Jt.height)/2-Jt.y).toString()]]);var Pn=Lt.createPath(Lt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Jt.width))/2,(24-Math.ceil(Jt.height))/2,Math.ceil(Jt.width),Math.ceil(Jt.height)));return gt.appendChild(Pn),Lt.setAttributes(Nt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ce),ce.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},L}(),ua=function(L){function o(c,D,K){var k=L.call(this,c,D)||this;return k.isDropdownOpen=!1,k.onClick=k.dropdownButtonClicked,k.dropdownButtons=K,k}return Dn(o,L),o.prototype.setupDropdown=function(){var c=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(D){D.className=c.className,D.colorsClassName=c.colorsClassName,c.dropdownBlock.appendChild(D.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},o.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},o.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},o.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},o.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},o.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},o}(nr),Er=function(){function L(o,c){this.GRIP_SIZE=10,this.color=o,this.fillColor=c,this.visual=Lt.createGroup(),this.visual.appendChild(Lt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Lt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return L.prototype.ownsTarget=function(o){return o===this.visual||o===this.visual.childNodes[0]||o===this.visual.childNodes[1]},L.prototype.setCenter=function(o,c){this.visual.childNodes.forEach(function(D){return Lt.setAttributes(D,[["cx",o.toString()],["cy",c.toString()]])})},L}(),ya=function(){function L(o,c,D,K){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=o,this.canvasHeight=c,this.margin=D,this.container=K,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(L.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(o){this._aspectRatio=o,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(o){this._isGridVisible=o,this.gridContainer&&Lt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(o){this._zoomFactor=o,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),L.prototype.open=function(){var o=this;this.cropShadeElement=Lt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Lt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var c=0;c<this.numberOfGridLines;c++)this.horizontalGridLines.push(Lt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(Lt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(D){return o.gridContainer.appendChild(D)}),this.verticalGridLines.forEach(function(D){return o.gridContainer.appendChild(D)}),this.cropRectElement=Lt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Er(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Er(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Er(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Er(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},L.prototype.setCropRectangle=function(o){this.cropRect=o;var c=Object.assign({},this.cropRect);this.zoomFactor!==1&&(c.width=this.cropRect.width*this.zoomFactor,c.height=this.cropRect.height*this.zoomFactor,c.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-c.width/2,c.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-c.height/2),Lt.setAttributes(this.cropRectElement,[["x",c.x.toString()],["y",c.y.toString()],["width",c.width.toString()],["height",c.height.toString()]]);var D=c.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(k,ce){var ze=c.y+D*(ce+1);Lt.setAttributes(k,[["x1",""+c.x],["y1",""+ze],["x2",""+(c.x+c.width)],["y2",""+ze]])});var K=c.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(k,ce){var ze=c.x+K*(ce+1);Lt.setAttributes(k,[["x1",""+ze],["y1",""+c.y],["x2",""+ze],["y2",""+(c.y+c.height)]])}),Lt.setAttributes(this.cropShadeElement,[["d",Lt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,c.x,c.y,c.width,c.height)]]),this.topLeftGrip.setCenter(c.x,c.y),this.topRightGrip.setCenter(c.x+c.width,c.y),this.bottomLeftGrip.setCenter(c.x,c.y+c.height),this.bottomRightGrip.setCenter(c.x+c.width,c.y+c.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},L.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)},L.prototype.clientToLocalCoordinates=function(o,c){var D=this.container.getBoundingClientRect();return{x:o-D.left+this.margin,y:c-D.top+this.margin}},L.prototype.onPointerDown=function(o){this.container.setPointerCapture(o.pointerId),this.previousPoint=this.clientToLocalCoordinates(o.clientX,o.clientY),this.cropRectElement===o.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(o.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(o.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(o.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(o.target)&&(this.activeGrip=this.bottomRightGrip)},L.prototype.onPointerMove=function(o){if(this.isMoving)this.move(this.clientToLocalCoordinates(o.clientX,o.clientY));else if(this.activeGrip){var c=this.clientToLocalCoordinates(o.clientX,o.clientY);this.resize(c)}o.preventDefault()},L.prototype.onPointerUp=function(o){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(o.pointerId)},L.prototype.move=function(o){var c=o.x-this.previousPoint.x,D=o.y-this.previousPoint.y;this.zoomFactor!==1&&(c=-c/this.zoomFactor,D=-D/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+c),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+D),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=o},L.prototype.resize=function(o){var c=Object.assign({},this.cropRect),D=o.x-this.previousPoint.x,K=o.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:c.x+D<this.margin&&(D=this.margin-c.x),c.x+=D,c.width=this.cropRect.x+this.cropRect.width-c.x;break;case this.bottomRightGrip:case this.topRightGrip:c.width+D>this.canvasWidth*this.zoomFactor&&(D=this.canvasWidth*this.zoomFactor-c.width),c.width+=D}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(c.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(D),c.height=this.aspectRatio.getVerticalLength(c.width)):(c.y+=K,c.height=this.cropRect.y+this.cropRect.height-c.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?c.height=this.aspectRatio.getVerticalLength(c.width):c.height+=K}c.width<10&&(c.x=this.cropRect.x,c.width=10),c.height<10&&(c.y=this.cropRect.y,c.height=10),this.previousPoint=o,c.x>=this.margin&&c.y>=this.margin&&c.x-this.margin+c.width<=this.canvasWidth&&c.y-this.margin+c.height<=this.canvasHeight&&(this.cropRect=c,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},L.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var o=this.cropRect.x+this.cropRect.width/2,c=this.cropRect.y+this.cropRect.height/2,D=this.aspectRatio.getHorizontalLength(this.cropRect.height),K=this.aspectRatio.getVerticalLength(this.cropRect.width);D/this.canvasWidth<K/this.canvasHeight?this.cropRect.width=D:this.cropRect.height=K,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=o-this.cropRect.width/2,this.cropRect.y=c-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)}},L.prototype.getRescaledRect=function(o,c,D,K,k,ce){var ze=D/o,gt=K/c;return{x:(k.x-ce)*ze+ce,y:(k.y-ce)*gt+ce,width:k.width*ze,height:k.height*gt}},L.prototype.scaleCanvas=function(o,c){var D=this.getRescaledRect(this.canvasWidth,this.canvasHeight,o,c,this.cropRect,this.margin);this.canvasWidth=o,this.canvasHeight=c,this.onCropChange&&this.onCropChange(D),this.setCropRectangle(D)},L}(),da=function(){function L(o){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=o,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(L.prototype,"angle",{get:function(){return this._angle},set:function(o){this._angle=o,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),L.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},L.prototype.onPointerDown=function(o){this.controlContainer.setPointerCapture(o.pointerId),this.isDragging=!0,this.previousPoint={x:o.clientX,y:o.clientY}},L.prototype.onPointerMove=function(o){this.isDragging&&(this.onAngleChange&&this.onAngleChange((o.clientX-this.previousPoint.x)/5),this.previousPoint.x=o.clientX)},L.prototype.onPointerUp=function(o){this.isDragging&&this.onAngleChange&&this.onAngleChange((o.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(o.pointerId)},L.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var o=this.angleLabelText.getBBox();Lt.setAttributes(this.angleLabelElement,[["x",((this.width-o.width)/2).toString()],["y",(this.height/2).toString()]])}},L.prototype.positionScaleShape=function(){if(this.scaleShape){var o=this.scaleShape.transform.baseVal.getItem(0);o.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(o,0)}},L.prototype.getVisual=function(){var o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("xmlns","http://www.w3.org/2000/svg"),o.setAttribute("width",this.width+"px"),o.setAttribute("height",this.height+"px"),o.setAttribute("viewBox","0 0 "+this.width+" "+this.height),o.style.flexShrink="0",document.body.appendChild(o);for(var c="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,D=1;D<=this.width/5+10;D++){var K=D%5==0?this.height/3:this.height/6;c+="h4v"+-K+"h1v"+K}c+="v1H0Z",this.scaleShape=Lt.createPath(c);var k=Lt.createTransform();this.scaleShape.transform.baseVal.appendItem(k),o.appendChild(this.scaleShape),this.angleLabelElement=Lt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Lt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ce=Lt.createTSpan("");return ce.innerHTML="&deg;",this.angleLabelElement.appendChild(ce),o.appendChild(this.angleLabelElement),document.body.removeChild(o),o},L}(),ba=function(){function L(){this.naturalSize=!1,this.imageType="image/png"}return L.prototype.rasterize=function(o,c,D,K,k,ce,ze){var gt=this;return new Promise(function(Nt){var Xe=document.createElement("canvas");Xe.width=o.width.baseVal.value-2*K,Xe.height=o.height.baseVal.value-2*K;var Jt=1,Pn=1;gt.naturalSize===!0?(Jt=c.naturalWidth/(o.width.baseVal.value-2*K)/ce,Pn=c.naturalHeight/(o.height.baseVal.value-2*K)/ze,Xe.width=c.naturalWidth/ce,Xe.height=c.naturalHeight/ze):gt.width!==void 0&&gt.height!==void 0&&(Jt=gt.width/D.width,Pn=gt.height/D.height,Xe.width*=Jt,Xe.height*=Pn);var Bn=Xe.getContext("2d");Bn.translate(Xe.width/2,Xe.height/2),Bn.rotate(k*Math.PI/180),Bn.scale(ce,ze),Bn.translate(-Xe.width/2,-Xe.height/2),Bn.drawImage(c,0,0,Xe.width,Xe.height);var jr=document.createElement("canvas");jr.width=D.width*Jt,jr.height=D.height*Pn,jr.getContext("2d").putImageData(Bn.getImageData((D.x-K)*Jt,(D.y-K)*Pn,D.width*Jt,D.height*Pn),0,0),Nt(jr.toDataURL(gt.imageType,gt.imageQuality))})},L}(),ra=function(){function L(o){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=L.instanceCounter++,this.styles=new Rr(this.instanceNo),this.target=o,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(L.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(o){this._zoomToCropEnabled=o,o?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(o){this._isGridVisible=o,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"gridLines",{get:function(){return this._gridLines},set:function(o){this._gridLines=o,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(o){this._rotationAngle=o,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"aspectRatio",{get:function(){var o;return(o=this._aspectRatio)!==null&&o!==void 0?o:this.aspectRatios[0]},set:function(o){this._aspectRatio=o},enumerable:!1,configurable:!0}),L.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),this.displayMode==="popup"&&this.onPopupResize(),this._isOpen=!0},L.prototype.show=function(){this.showUI(),this.open()},L.prototype.close=function(o){o===void 0&&(o=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),o||this.closeEventListeners.forEach(function(c){return c()}),this._isOpen=!1)},L.prototype.addRenderEventListener=function(o){this.renderEventListeners.push(o)},L.prototype.removeRenderEventListener=function(o){this.renderEventListeners.indexOf(o)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(o),1)},L.prototype.addCloseEventListener=function(o){this.closeEventListeners.push(o)},L.prototype.removeCloseEventListener=function(o){this.closeEventListeners.indexOf(o)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(o),1)},L.prototype.setupResizeObserver=function(){var o=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){o.resize(o.target.clientWidth,o.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},L.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var o=1*this.target.clientWidth/this.target.clientHeight,c=this.contentDiv.clientWidth/o>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*o:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,D=c+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/o;this.resize(c,D)}},L.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},L.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",Lt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},L.prototype.resize=function(o,c){this.imageWidth=Math.round(o),this.imageHeight=Math.round(c),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},L.prototype.setEditingTarget=function(){var o=document.createElement("canvas");o.width=this.target.naturalWidth,o.height=this.target.naturalHeight,o.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var c=o.toDataURL();Lt.setAttributes(this.editingTarget,[["href",c]]),this.setEditingTargetSize()},L.prototype.setTopLeft=function(){var o=this.target.getBoundingClientRect(),c=this.editorCanvas.getBoundingClientRect();this.left=o.left-c.left-this.CANVAS_MARGIN,this.top=o.top-c.top-this.CANVAS_MARGIN},L.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=Lt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=Lt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=Lt.createGroup(),this.editingTargetRotationScaleContainer=Lt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var o=Lt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(o);var c=Lt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(c),this.editingTargetContainer=Lt.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)},L.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},L.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=Lt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new ya(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()},L.prototype.zoomToCrop=function(){if(this.cropRect){var o=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,c=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=o+"px "+c+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-o+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-c+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},L.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)},L.prototype.cropRectChanged=function(o){this.cropRect=o,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},L.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},L.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"},L.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},L.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var o=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,c=this.target.offsetTop>o+this.CANVAS_MARGIN?this.target.offsetTop-(o+this.CANVAS_MARGIN):0;this.coverDiv.style.top=c+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},L.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},L.prototype.addTopToolbar=function(){var o=this;this.topToolbar=new Vr,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 c=new Pr;c.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(c);var D=[];this.aspectRatios.forEach(function(Pn){var Bn=new nr(Ar.getIcon(Pn.horizontal,Pn.vertical),Pn.horizontal===0&&Pn.vertical===0?"FREE":Pn.horizontal+":"+Pn.vertical);Bn.onClick=function(){return o.ratioButtonClicked(Pn)},D.push(Bn)}),this.aspectRatioButton=new ua(Ar.getIcon(0,0),"Aspect ratio",D),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,c.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var K=new nr('<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");K.isActive=this.isGridVisible,K.onClick=function(){o.isGridVisible=!o.isGridVisible,K.isActive=o.isGridVisible},c.addButton(K);var k=new nr('<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(k.isActive=this.zoomToCropEnabled,k.onClick=function(){o.zoomToCropEnabled=!o.zoomToCropEnabled,k.isActive=o.zoomToCropEnabled},c.addButton(k),!Ft.isLicensed){var ce=new dr;this.topToolbar.addElementBlock(ce);var ze=document.createElement("div");ze.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var gt=document.createElement("a");gt.style.color="currentColor",gt.href="https://markerjs.com/products/cropro",gt.target="_blank",gt.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>',ze.appendChild(gt),ce.addElement(ze)}var Nt=new Pr;Nt.minWidth=3*this.toolbarHeight+"px",Nt.contentAlign="end",this.topToolbar.addButtonBlock(Nt);var Xe=new nr('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");Xe.onClick=this.startRenderAndClose,Nt.addButton(Xe),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Xe.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Jt=new nr('<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");Jt.onClick=this.close,Nt.addButton(Jt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Jt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},L.prototype.addBottomToolbar=function(){var o=this;this.bottomToolbar=new Vr,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 c=new Pr;c.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(c);var D=new nr('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");D.onClick=this.rotateLeftButtonClicked,c.addButton(D);var K=new nr('<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");K.onClick=this.rotateRightButtonClicked,c.addButton(K);var k=new dr;k.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(k),this.straightener=new da("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(Nt){o.rotateBy(Nt),o.straightener.angle=o.rotationAngle},k.addElement(this.straightener.getUI());var ce=new Pr;ce.minWidth=2*this.toolbarHeight+"px",ce.contentAlign="end",this.bottomToolbar.addButtonBlock(ce);var ze=new nr('<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");ze.onClick=this.flipHorizontallyButtonClicked,ce.addButton(ze);var gt=new nr('<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");gt.onClick=this.flipVerticallyButtonClicked,ce.addButton(gt)},L.prototype.ratioButtonClicked=function(o){this.aspectRatio=o,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},L.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Ar.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},L.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Ur(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},L.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},L.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},L.prototype.restoreState=function(o){if(o){var c=this.cropLayer.getRescaledRect(o.width,o.height,this.imageWidth,this.imageHeight,o.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(c),this.cropRectChanged(c),this.flippedHorizontally=o.flippedHorizontally,this.flippedVertically=o.flippedVertically,this.applyFlip(),this.rotationAngle=o.rotationAngle,this.applyRotation()}},L.prototype.clientToLocalCoordinates=function(o,c){var D=this.cropImage.getBoundingClientRect();return{x:o-D.left,y:c-D.top}},L.prototype.onWindowResize=function(){this.positionUI()},L.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var o=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=o+"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()},L.prototype.rotateLeftButtonClicked=function(){var o=this.rotationAngle-90;this.rotationAngle%90!=0&&(o+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(o)},L.prototype.rotateRightButtonClicked=function(){var o=this.rotationAngle+90;this.rotationAngle%90!=0&&(o-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(o)},L.prototype.rotateTo=function(o){o=(o=o>180?o-360:o)<=-180?o+360:o,this.rotationAngle=o,this.applyRotation()},L.prototype.rotateBy=function(o){this.rotateTo((this.rotationAngle+o)%360)},L.prototype.applyRotation=function(){var o=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var c=this.editingTargetRotationContainer.transform.baseVal.getItem(0);c.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(c,0);var D=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/D.width,this.imageHeight/D.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=o},L.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},L.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},L.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},L.prototype.startRenderAndClose=function(){return on(this,void 0,void 0,function(){var o,c;return qn(this,function(D){switch(D.label){case 0:return[4,this.render()];case 1:return o=D.sent(),c=this.getState(),this.renderEventListeners.forEach(function(K){return K(o,c)}),this.close(!0),[2]}})})},L.prototype.render=function(){return on(this,void 0,void 0,function(){var o;return qn(this,function(c){switch(c.label){case 0:return(o=new ba).naturalSize=this.renderAtNaturalSize,o.imageType=this.renderImageType,o.imageQuality=this.renderImageQuality,o.width=this.renderWidth,o.height=this.renderHeight,this.unzoomFromCrop(),Lt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,o.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 c.sent(),[4,o.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,c.sent()]}})})},L.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Wn("toolbar",`
width: `+(this.displayMode==="inline"?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+`;
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
height: `+this.toolbarHeight+`px;
box-sizing: content-box;
overflow: hidden;
line-height: 0px;
`)),this.toolbarStyleColorsClass=this.styles.addClass(new Wn("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Wn("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var o=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Wn("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*o)+`px;
height: `+(this.toolbarHeight-2*o)+`px;
padding: `+o+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Wn("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Wn("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new kn("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new kn("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Wn("toolbar_dropdown",`
position: absolute;
max-width: `+4*this.toolbarHeight+`px;
z-index: 20;
white-space: normal;
box-sizing: content-box;
box-shadow: 3px 3px rgba(33, 33, 33, 0.1);
margin: `+(this.displayMode==="inline"?"0":this.popupMargin)+`px;
line-height: 0px;
`)),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new Wn("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Wn("toolbar_straightener_block",`
display: flex;
overflow: hidden;
justify-content: center;
-webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%);
`)),this.toolbarStraightenerStyleClass=this.styles.addClass(new Wn("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*o)+`px;
padding: `+o+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Wn("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},L.instanceCounter=0,L}(),ca=W("8hTe"),Zr=W.n(ca),Ea=/<pre[^>]*>/g;function ha(L){var o=document.createElement("div");return o.innerHTML=L,o.childNodes.length===0?"":o.childNodes[0].nodeValue}var _a=Ye.a=function(L){var o=L.value,c=o===void 0?"":o,D=L.edit,K=D===void 0?!1:D,k=L.className,ce=L.showTextOnly,ze=L.showLines,gt=L.replaces,Nt=L.zoomImg,Xe=L.hasMask,Jt=L.style,Pn=Jt===void 0?{}:Jt,Bn=L.stylesPrev,jr=Bn===void 0?{}:Bn,Dt=String(c),Re=Object(P.useRef)(),rt=Object(P.useRef)(),Ve=Object(P.useState)(""),Qe=Object(I.a)(Ve,2),Ht=Qe[0],Ut=Qe[1],kt=Object(P.useState)("office"),wt=Object(I.a)(kt,2),mt=wt[0],Rt=wt[1],_t=function(){var Be=new ra(rt.current);Be.displayMode="popup",Be.addRenderEventListener(function(){var tn=Object(R.a)(T.a.mark(function tt(dt){var at;return T.a.wrap(function(yt){for(;;)switch(yt.prev=yt.next){case 0:return Re.current.style.display="none",yt.next=3,Object(ve.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:dt}});case 3:at=yt.sent,at!=null&&at.id&&gt(rt.current.getAttribute("src").replace(Z.a.API_SERVER,""),"/api/attachments/".concat(at==null?void 0:at.id,"?type=").concat(at.content_type));case 5:case"end":return yt.stop()}},tt)}));return function(tt){return tn.apply(this,arguments)}}()),Be.show()},Kt=function(){var Be=new Sn(rt.current);Be.settings.displayMode="popup",Be.addEventListener("render",function(){var tn=Object(R.a)(T.a.mark(function tt(dt){var at;return T.a.wrap(function(yt){for(;;)switch(yt.prev=yt.next){case 0:if(Re.current.style.display="none",!rt.current){yt.next=6;break}return yt.next=4,Object(ve.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:dt.dataUrl}});case 4:at=yt.sent,at!=null&&at.id&&gt(rt.current.getAttribute("src").replace(Z.a.API_SERVER,""),"/api/attachments/".concat(at==null?void 0:at.id,"?type=").concat(at.content_type));case 6:case"end":return yt.stop()}},tt)}));return function(tt){return tn.apply(this,arguments)}}()),Be.show(),window.markerArea=Be},Ot=Object(P.useMemo)(function(){try{var ge=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Be=/\"\/api\/attachments\/|\"\/attachments\/download\//g,tn=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Dt=Dt.replace(ge,"("+Z.a.API_SERVER+"/api/attachments/").replace(Be,'"'+Z.a.API_SERVER+"/api/attachments/").replace(tn,'"'+Z.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,`
`),Dt=Dt.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
`)}catch(ft){}var tt=F(Dt),dt=v();if(Dt.match(/\[TOC\]/)&&(tt=tt.replace("<p>[TOC]</p>",m()),g()),tt=tt.replace(/(__special_katext_id_\d+__)/g,function(ft,yt){var vt=dt[yt],Qt=vt.type,un=vt.expression;return Object(re.renderToString)(ha(un)||"",{displayMode:Qt==="block",throwOnError:!1,output:"html"})}),tt=tt.replace(/▁/g,"\u2581\u2581\u2581"),f(),ce){var at=document.createElement("div");return at.innerHTML=tt,at.innerText}return setTimeout(function(){return jt()},500),tt},[Dt]),At=Object(P.useRef)();d.WebkitLineClamp=ze,ze&&(Pn=Object(E.a)(Object(E.a)({},Pn),d));function Bt(ge){var Be=ge.target;if(Be.tagName.toUpperCase()==="IMG"){if(Nt){var tn=Be.getAttribute("src");Ut(tn),Rt("image")}}else if(Be.tagName.toUpperCase()==="A"){var tt=Be.getAttribute("href");if(tt.indexOf("office")>-1)ge.preventDefault(),Ut(tt),Rt("office");else if(tt.indexOf("application/pdf")>-1)ge.preventDefault(),Ut(tt),Rt("pdf");else if(tt.indexOf("type=text")>-1)ge.preventDefault(),Ut(tt),Rt("html");else if(tt.startsWith("#")){ge.preventDefault();var dt=document.getElementById(tt.replace("#",""));dt&&dt.scrollIntoView(!0)}}}var jt=function(){var Be,tn=(Be=At.current)===null||Be===void 0?void 0:Be.querySelectorAll("video");tn==null||tn.forEach(function(tt){if(tt.oncontextmenu=function(){return!1},tt.src.indexOf(".m3u8")>-1&&!tt.canPlayType("application/vnd.apple.mpegurl")){if(B.a.isSupported()){var dt=new B.a;dt.loadSource(tt.src),dt.attachMedia(tt)}}})};Object(P.useEffect)(function(){if(At.current&&Ot&&(Ot.match(Ea)&&window.PR.prettyPrint()),At.current)return At.current.addEventListener("click",Bt),function(){At.current.removeEventListener("click",Bt),f(),g()}},[Ot,At.current,Bt]);var xn=function(Be){if(!K)return;Be.target.nodeName==="IMG"?(Re.current.style.display="flex",Re.current.style.width=Be.target.clientWidth+"px",Re.current.style.height=Be.target.clientHeight+"px",Re.current.style.top=Be.target.offsetTop+"px",Re.current.style.left=Be.target.offsetLeft+"px",rt.current.src=Be.target.getAttribute("src")):Re.current.style.display="none"};return _.a.createElement("div",{style:{position:"relative"}},_.a.createElement("div",{ref:At,style:Object(E.a)({},Pn),className:"".concat(k||""," markdown-body ").concat(Zr.a.mdBody),onMouseOver:xn,dangerouslySetInnerHTML:{__html:Ot}}),_.a.createElement("div",{ref:Re,className:Zr.a.button},_.a.createElement(j.a,null,_.a.createElement(N.a,{onClick:function(){return _t()}},"\u88C1\u526A"),_.a.createElement(N.a,{onClick:function(){return Kt()}},"\u7F16\u8F91"))),_.a.createElement("img",{ref:rt,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),_.a.createElement(ie.a,{close:!0,data:Ht,hasMask:Xe,type:Ht!=null&&Ht.length?mt:"",style:Object(E.a)({},jr),onClose:function(){return Ut("")}}))}},"A60/":function(Pt,Ye,W){Pt.exports={wrap:"wrap___37dvp",right20:"right20___2yZBe",right180:"right180___14fSn",basket:"basket___32ZdA",count:"count___2ydNT",iconWrap:"iconWrap___2cEp5",icon:"icon___3fYs3",name:"name___7IPYm"}},BU3w:function(Pt,Ye,W){"use strict";W.d(Ye,"a",function(){return R});var Ee=W("MNnm"),j="rc-util-key";function w(I){if(I.attachTo)return I.attachTo;var M=document.querySelector("head");return M||document.body}function N(I){var M,T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(Ee.a)())return null;var P=document.createElement("style");if((M=T.csp)===null||M===void 0?void 0:M.nonce){var _;P.nonce=(_=T.csp)===null||_===void 0?void 0:_.nonce}P.innerHTML=I;var S=w(T),O=S.firstChild;return T.prepend&&S.prepend?S.prepend(P):T.prepend&&O?S.insertBefore(P,O):S.appendChild(P),P}var E=new Map;function R(I,M){var T=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},P=w(T);if(!E.has(P)){var _=N("",T),S=_.parentNode;E.set(P,S),S.removeChild(_)}var O=Array.from(E.get(P).children).find(function(n){return n.tagName==="STYLE"&&n[j]===M});if(O){var C,x;if(((C=T.csp)===null||C===void 0?void 0:C.nonce)&&O.nonce!==((x=T.csp)===null||x===void 0?void 0:x.nonce)){var b;O.nonce=(b=T.csp)===null||b===void 0?void 0:b.nonce}return O.innerHTML!==I&&(O.innerHTML=I),O}var p=N(I,T);return p[j]=M,p}},BdwD:function(Pt,Ye,W){"use strict";var Ee=W("+L6B"),j=W("2/Rp"),w=W("0Owb"),N=W("k1fw"),E=W("q1tI"),R=W.n(E),I=W("FOrL"),M=W.n(I),T=function(_){var S=_.buttonProps,O=S===void 0?{}:S,C=_.styles,x=C===void 0?{}:C,b=_.customText,p=_.ButtonText,n=_.ButtonClick,l=_.Buttonclass,s=_.ButtonTwo;return R.a.createElement("section",{className:"tc animated fadeIn",style:Object(N.a)(Object(N.a)({},{color:"#999",margin:"200px auto"}),x)},R.a.createElement("img",{src:M.a}),R.a.createElement("p",{className:"mt20 font14"},b||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),p&&R.a.createElement(j.a,Object(w.a)({className:l,onClick:n},O),p),s&&s)};Ye.a=T},DlQD:function(Pt,Ye,W){(function(Ee,j){Pt.exports=j()})(this,function(){"use strict";function Ee(ye,he){for(var fe=0;fe<he.length;fe++){var X=he[fe];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(ye,X.key,X)}}function j(ye,he,fe){return he&&Ee(ye.prototype,he),fe&&Ee(ye,fe),ye}function w(ye,he){if(!ye)return;if(typeof ye=="string")return N(ye,he);var fe=Object.prototype.toString.call(ye).slice(8,-1);if(fe==="Object"&&ye.constructor&&(fe=ye.constructor.name),fe==="Map"||fe==="Set")return Array.from(ye);if(fe==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(fe))return N(ye,he)}function N(ye,he){(he==null||he>ye.length)&&(he=ye.length);for(var fe=0,X=new Array(he);fe<he;fe++)X[fe]=ye[fe];return X}function E(ye,he){var fe;if(typeof Symbol=="undefined"||ye[Symbol.iterator]==null){if(Array.isArray(ye)||(fe=w(ye))||he&&ye&&typeof ye.length=="number"){fe&&(ye=fe);var X=0;return function(){return X>=ye.length?{done:!0}:{done:!1,value:ye[X++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return fe=ye[Symbol.iterator](),fe.next.bind(fe)}function R(ye,he){return he={exports:{}},ye(he,he.exports),he.exports}var I=R(function(ye){function he(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function fe(X){ye.exports.defaults=X}ye.exports={defaults:he(),getDefaults:he,changeDefaults:fe}}),M=I.defaults,T=I.getDefaults,P=I.changeDefaults,_=/[&<>"']/,S=/[&<>"']/g,O=/[<>"']|&(?!#?\w+;)/,C=/[<>"']|&(?!#?\w+;)/g,x={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},b=function(he){return x[he]};function p(ye,he){if(he){if(_.test(ye))return ye.replace(S,b)}else if(O.test(ye))return ye.replace(C,b);return ye}var n=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(ye){return ye.replace(n,function(he,fe){return fe=fe.toLowerCase(),fe==="colon"?":":fe.charAt(0)==="#"?fe.charAt(1)==="x"?String.fromCharCode(parseInt(fe.substring(2),16)):String.fromCharCode(+fe.substring(1)):""})}var s=/(^|[^\[])\^/g;function g(ye,he){ye=ye.source||ye,he=he||"";var fe={replace:function($,te){return te=te.source||te,te=te.replace(s,"$1"),ye=ye.replace($,te),fe},getRegex:function(){return new RegExp(ye,he)}};return fe}var d=/[^\w:]/g,u=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function m(ye,he,fe){if(ye){var X;try{X=decodeURIComponent(l(fe)).replace(d,"").toLowerCase()}catch($){return null}if(X.indexOf("javascript:")===0||X.indexOf("vbscript:")===0||X.indexOf("data:")===0)return null}he&&!u.test(fe)&&(fe=i(he,fe));try{fe=encodeURI(fe).replace(/%25/g,"%")}catch($){return null}return fe}var h={},a=/^[^:]+:\/*[^/]*$/,r=/^([^:]+:)[\s\S]*$/,e=/^([^:]+:\/*[^/]*)[\s\S]*$/;function i(ye,he){h[" "+ye]||(a.test(ye)?h[" "+ye]=ye+"/":h[" "+ye]=t(ye,"/",!0)),ye=h[" "+ye];var fe=ye.indexOf(":")===-1;return he.substring(0,2)==="//"?fe?he:ye.replace(r,"$1")+he:he.charAt(0)==="/"?fe?he:ye.replace(e,"$1")+he:ye+he}var v={exec:function(){}};function f(ye){for(var he=1,fe,X;he<arguments.length;he++){fe=arguments[he];for(X in fe)Object.prototype.hasOwnProperty.call(fe,X)&&(ye[X]=fe[X])}return ye}function y(ye,he){var fe=ye.replace(/\|/g,function(te,oe,Te){for(var Pe=!1,Je=oe;--Je>=0&&Te[Je]==="\\";)Pe=!Pe;return Pe?"|":" |"}),X=fe.split(/ \|/),$=0;if(X.length>he)X.splice(he);else for(;X.length<he;)X.push("");for(;$<X.length;$++)X[$]=X[$].trim().replace(/\\\|/g,"|");return X}function t(ye,he,fe){var X=ye.length;if(X===0)return"";for(var $=0;$<X;){var te=ye.charAt(X-$-1);if(te===he&&!fe)$++;else if(te!==he&&fe)$++;else break}return ye.substr(0,X-$)}function A(ye,he){if(ye.indexOf(he[1])===-1)return-1;for(var fe=ye.length,X=0,$=0;$<fe;$++)if(ye[$]==="\\")$++;else if(ye[$]===he[0])X++;else if(ye[$]===he[1]&&(X--,X<0))return $;return-1}function U(ye){ye&&ye.sanitize&&!ye.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var F={escape:p,unescape:l,edit:g,cleanUrl:m,resolveUrl:i,noopTest:v,merge:f,splitCells:y,rtrim:t,findClosingBracket:A,checkSanitizeDeprecation:U},H=I.defaults,J=F.rtrim,B=F.splitCells,Z=F.escape,re=F.findClosingBracket;function ie(ye,he,fe){var X=he.href,$=he.title?Z(he.title):null,te=ye[1].replace(/\\([\[\]])/g,"$1");return ye[0].charAt(0)!=="!"?{type:"link",raw:fe,href:X,title:$,text:te}:{type:"image",raw:fe,href:X,title:$,text:Z(te)}}function ve(ye,he){var fe=ye.match(/^(\s+)(?:```)/);if(fe===null)return he;var X=fe[1];return he.split(`
`).map(function($){var te=$.match(/^\s+/);if(te===null)return $;var oe=te[0];return oe.length>=X.length?$.slice(X.length):$}).join(`
`)}var de=function(){function ye(fe){this.options=fe||H}var he=ye.prototype;return he.space=function(X){var $=this.rules.block.newline.exec(X);if($)return $[0].length>1?{type:"space",raw:$[0]}:{raw:`
`}},he.code=function(X,$){var te=this.rules.block.code.exec(X);if(te){var oe=$[$.length-1];if(oe&&oe.type==="paragraph")return{raw:te[0],text:te[0].trimRight()};var Te=te[0].replace(/^ {4}/gm,"");return{type:"code",raw:te[0],codeBlockStyle:"indented",text:this.options.pedantic?Te:J(Te,`
`)}}},he.fences=function(X){var $=this.rules.block.fences.exec(X);if($){var te=$[0],oe=ve(te,$[3]||"");return{type:"code",raw:te,lang:$[2]?$[2].trim():$[2],text:oe}}},he.heading=function(X){var $=this.rules.block.heading.exec(X);if($)return{type:"heading",raw:$[0],depth:$[1].length,text:$[2]}},he.nptable=function(X){var $=this.rules.block.nptable.exec(X);if($){var te={type:"table",header:B($[1].replace(/^ *| *\| *$/g,"")),align:$[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:$[3]?$[3].replace(/\n$/,"").split(`
`):[],raw:$[0]};if(te.header.length===te.align.length){var oe=te.align.length,Te;for(Te=0;Te<oe;Te++)/^ *-+: *$/.test(te.align[Te])?te.align[Te]="right":/^ *:-+: *$/.test(te.align[Te])?te.align[Te]="center":/^ *:-+ *$/.test(te.align[Te])?te.align[Te]="left":te.align[Te]=null;for(oe=te.cells.length,Te=0;Te<oe;Te++)te.cells[Te]=B(te.cells[Te],te.header.length);return te}}},he.hr=function(X){var $=this.rules.block.hr.exec(X);if($)return{type:"hr",raw:$[0]}},he.blockquote=function(X){var $=this.rules.block.blockquote.exec(X);if($){var te=$[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:$[0],text:te}}},he.list=function(X){var $=this.rules.block.list.exec(X);if($){for(var te=$[0],oe=$[2],Te=oe.length>1,Pe=oe[oe.length-1]===")",Je={type:"list",raw:te,ordered:Te,start:Te?+oe.slice(0,-1):"",loose:!1,items:[]},Wt=$[0].match(this.rules.block.item),Zt=!1,Xt,an,fn,It,Kn,Sn,Jn,Dn=Wt.length,on=0;on<Dn;on++)Xt=Wt[on],te=Xt,an=Xt.length,Xt=Xt.replace(/^ *([*+-]|\d+[.)]) */,""),~Xt.indexOf(`
`)&&(an-=Xt.length,Xt=this.options.pedantic?Xt.replace(/^ {1,4}/gm,""):Xt.replace(new RegExp("^ {1,"+an+"}","gm"),"")),on!==Dn-1&&(fn=this.rules.block.bullet.exec(Wt[on+1])[0],(Te?fn.length===1||!Pe&&fn[fn.length-1]===")":fn.length>1||this.options.smartLists&&fn!==oe)&&(It=Wt.slice(on+1).join(`
`),Je.raw=Je.raw.substring(0,Je.raw.length-It.length),on=Dn-1)),Kn=Zt||/\n\n(?!\s*$)/.test(Xt),on!==Dn-1&&(Zt=Xt.charAt(Xt.length-1)===`
`,Kn||(Kn=Zt)),Kn&&(Je.loose=!0),Sn=/^\[[ xX]\] /.test(Xt),Jn=void 0,Sn&&(Jn=Xt[1]!==" ",Xt=Xt.replace(/^\[[ xX]\] +/,"")),Je.items.push({type:"list_item",raw:te,task:Sn,checked:Jn,loose:Kn,text:Xt});return Je}},he.html=function(X){var $=this.rules.block.html.exec(X);if($)return{type:this.options.sanitize?"paragraph":"html",raw:$[0],pre:!this.options.sanitizer&&($[1]==="pre"||$[1]==="script"||$[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer($[0]):Z($[0]):$[0]}},he.def=function(X){var $=this.rules.block.def.exec(X);if($){$[3]&&($[3]=$[3].substring(1,$[3].length-1));var te=$[1].toLowerCase().replace(/\s+/g," ");return{tag:te,raw:$[0],href:$[2],title:$[3]}}},he.table=function(X){var $=this.rules.block.table.exec(X);if($){var te={type:"table",header:B($[1].replace(/^ *| *\| *$/g,"")),align:$[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:$[3]?$[3].replace(/\n$/,"").split(`
`):[]};if(te.header.length===te.align.length){te.raw=$[0];var oe=te.align.length,Te;for(Te=0;Te<oe;Te++)/^ *-+: *$/.test(te.align[Te])?te.align[Te]="right":/^ *:-+: *$/.test(te.align[Te])?te.align[Te]="center":/^ *:-+ *$/.test(te.align[Te])?te.align[Te]="left":te.align[Te]=null;for(oe=te.cells.length,Te=0;Te<oe;Te++)te.cells[Te]=B(te.cells[Te].replace(/^ *\| *| *\| *$/g,""),te.header.length);return te}}},he.lheading=function(X){var $=this.rules.block.lheading.exec(X);if($)return{type:"heading",raw:$[0],depth:$[2].charAt(0)==="="?1:2,text:$[1]}},he.paragraph=function(X){var $=this.rules.block.paragraph.exec(X);if($)return{type:"paragraph",raw:$[0],text:$[1].charAt($[1].length-1)===`
`?$[1].slice(0,-1):$[1]}},he.text=function(X,$){var te=this.rules.block.text.exec(X);if(te){var oe=$[$.length-1];return oe&&oe.type==="text"?{raw:te[0],text:te[0]}:{type:"text",raw:te[0],text:te[0]}}},he.escape=function(X){var $=this.rules.inline.escape.exec(X);if($)return{type:"escape",raw:$[0],text:Z($[1])}},he.tag=function(X,$,te){var oe=this.rules.inline.tag.exec(X);if(oe)return!$&&/^<a /i.test(oe[0])?$=!0:$&&/^<\/a>/i.test(oe[0])&&($=!1),!te&&/^<(pre|code|kbd|script)(\s|>)/i.test(oe[0])?te=!0:te&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(oe[0])&&(te=!1),{type:this.options.sanitize?"text":"html",raw:oe[0],inLink:$,inRawBlock:te,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(oe[0]):Z(oe[0]):oe[0]}},he.link=function(X){var $=this.rules.inline.link.exec(X);if($){var te=re($[2],"()");if(te>-1){var oe=$[0].indexOf("!")===0?5:4,Te=oe+$[1].length+te;$[2]=$[2].substring(0,te),$[0]=$[0].substring(0,Te).trim(),$[3]=""}var Pe=$[2],Je="";if(this.options.pedantic){var Wt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Pe);Wt?(Pe=Wt[1],Je=Wt[3]):Je=""}else Je=$[3]?$[3].slice(1,-1):"";Pe=Pe.trim().replace(/^<([\s\S]*)>$/,"$1");var Zt=ie($,{href:Pe&&Pe.replace(this.rules.inline._escapes,"$1"),title:Je&&Je.replace(this.rules.inline._escapes,"$1")},$[0]);return Zt}},he.reflink=function(X,$){var te;if((te=this.rules.inline.reflink.exec(X))||(te=this.rules.inline.nolink.exec(X))){var oe=(te[2]||te[1]).replace(/\s+/g," ");if(oe=$[oe.toLowerCase()],!oe||!oe.href){var Te=te[0].charAt(0);return{type:"text",raw:Te,text:Te}}var Pe=ie(te,oe,te[0]);return Pe}},he.strong=function(X,$,te){te===void 0&&(te="");var oe=this.rules.inline.strong.start.exec(X);if(oe&&(!oe[1]||oe[1]&&(te===""||this.rules.inline.punctuation.exec(te)))){$=$.slice(-1*X.length);var Te=oe[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Te.lastIndex=0;for(var Pe;(oe=Te.exec($))!=null;)if(Pe=this.rules.inline.strong.middle.exec($.slice(0,oe.index+3)),Pe)return{type:"strong",raw:X.slice(0,Pe[0].length),text:X.slice(2,Pe[0].length-2)}}},he.em=function(X,$,te){te===void 0&&(te="");var oe=this.rules.inline.em.start.exec(X);if(oe&&(!oe[1]||oe[1]&&(te===""||this.rules.inline.punctuation.exec(te)))){$=$.slice(-1*X.length);var Te=oe[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Te.lastIndex=0;for(var Pe;(oe=Te.exec($))!=null;)if(Pe=this.rules.inline.em.middle.exec($.slice(0,oe.index+2)),Pe)return{type:"em",raw:X.slice(0,Pe[0].length),text:X.slice(1,Pe[0].length-1)}}},he.codespan=function(X){var $=this.rules.inline.code.exec(X);if($){var te=$[2].replace(/\n/g," "),oe=/[^ ]/.test(te),Te=te.startsWith(" ")&&te.endsWith(" ");return oe&&Te&&(te=te.substring(1,te.length-1)),te=Z(te,!0),{type:"codespan",raw:$[0],text:te}}},he.br=function(X){var $=this.rules.inline.br.exec(X);if($)return{type:"br",raw:$[0]}},he.del=function(X){var $=this.rules.inline.del.exec(X);if($)return{type:"del",raw:$[0],text:$[1]}},he.autolink=function(X,$){var te=this.rules.inline.autolink.exec(X);if(te){var oe,Te;return te[2]==="@"?(oe=Z(this.options.mangle?$(te[1]):te[1]),Te="mailto:"+oe):(oe=Z(te[1]),Te=oe),{type:"link",raw:te[0],text:oe,href:Te,tokens:[{type:"text",raw:oe,text:oe}]}}},he.url=function(X,$){var te;if(te=this.rules.inline.url.exec(X)){var oe,Te;if(te[2]==="@")oe=Z(this.options.mangle?$(te[0]):te[0]),Te="mailto:"+oe;else{var Pe;do Pe=te[0],te[0]=this.rules.inline._backpedal.exec(te[0])[0];while(Pe!==te[0]);oe=Z(te[0]),te[1]==="www."?Te="http://"+oe:Te=oe}return{type:"link",raw:te[0],text:oe,href:Te,tokens:[{type:"text",raw:oe,text:oe}]}}},he.inlineText=function(X,$,te){var oe=this.rules.inline.text.exec(X);if(oe){var Te;return $?Te=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(oe[0]):Z(oe[0]):oe[0]:Te=Z(this.options.smartypants?te(oe[0]):oe[0]),{type:"text",raw:oe[0],text:Te}}},ye}(),q=F.noopTest,ee=F.edit,pe=F.merge,Q={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:q,table:q,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};Q._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,Q._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,Q.def=ee(Q.def).replace("label",Q._label).replace("title",Q._title).getRegex(),Q.bullet=/(?:[*+-]|\d{1,9}[.)])/,Q.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,Q.item=ee(Q.item,"gm").replace(/bull/g,Q.bullet).getRegex(),Q.list=ee(Q.list).replace(/bull/g,Q.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Q.def.source+")").getRegex(),Q._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",Q._comment=/<!--(?!-?>)[\s\S]*?-->/,Q.html=ee(Q.html,"i").replace("comment",Q._comment).replace("tag",Q._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Q.paragraph=ee(Q._paragraph).replace("hr",Q.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",Q._tag).getRegex(),Q.blockquote=ee(Q.blockquote).replace("paragraph",Q.paragraph).getRegex(),Q.normal=pe({},Q),Q.gfm=pe({},Q.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*|$)"}),Q.gfm.nptable=ee(Q.gfm.nptable).replace("hr",Q.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",Q._tag).getRegex(),Q.gfm.table=ee(Q.gfm.table).replace("hr",Q.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",Q._tag).getRegex(),Q.pedantic=pe({},Q.normal,{html:ee(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Q._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:q,paragraph:ee(Q.normal._paragraph).replace("hr",Q.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",Q.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var V={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:q,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:q,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};V._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",V.punctuation=ee(V.punctuation).replace(/punctuation/g,V._punctuation).getRegex(),V._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",V._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",V.em.start=ee(V.em.start).replace(/punctuation/g,V._punctuation).getRegex(),V.em.middle=ee(V.em.middle).replace(/punctuation/g,V._punctuation).replace(/overlapSkip/g,V._overlapSkip).getRegex(),V.em.endAst=ee(V.em.endAst,"g").replace(/punctuation/g,V._punctuation).getRegex(),V.em.endUnd=ee(V.em.endUnd,"g").replace(/punctuation/g,V._punctuation).getRegex(),V.strong.start=ee(V.strong.start).replace(/punctuation/g,V._punctuation).getRegex(),V.strong.middle=ee(V.strong.middle).replace(/punctuation/g,V._punctuation).replace(/blockSkip/g,V._blockSkip).getRegex(),V.strong.endAst=ee(V.strong.endAst,"g").replace(/punctuation/g,V._punctuation).getRegex(),V.strong.endUnd=ee(V.strong.endUnd,"g").replace(/punctuation/g,V._punctuation).getRegex(),V.blockSkip=ee(V._blockSkip,"g").getRegex(),V.overlapSkip=ee(V._overlapSkip,"g").getRegex(),V._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,V._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,V._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])?)+(?![-_])/,V.autolink=ee(V.autolink).replace("scheme",V._scheme).replace("email",V._email).getRegex(),V._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,V.tag=ee(V.tag).replace("comment",Q._comment).replace("attribute",V._attribute).getRegex(),V._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,V._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,V._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,V.link=ee(V.link).replace("label",V._label).replace("href",V._href).replace("title",V._title).getRegex(),V.reflink=ee(V.reflink).replace("label",V._label).getRegex(),V.reflinkSearch=ee(V.reflinkSearch,"g").replace("reflink",V.reflink).replace("nolink",V.nolink).getRegex(),V.normal=pe({},V),V.pedantic=pe({},V.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:ee(/^!?\[(label)\]\((.*?)\)/).replace("label",V._label).getRegex(),reflink:ee(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",V._label).getRegex()}),V.gfm=pe({},V.normal,{escape:ee(V.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),V.gfm.url=ee(V.gfm.url,"i").replace("email",V.gfm._extended_email).getRegex(),V.breaks=pe({},V.gfm,{br:ee(V.br).replace("{2,}","*").getRegex(),text:ee(V.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Ce={block:Q,inline:V},ke=I.defaults,Ue=Ce.block,we=Ce.inline;function De(ye){return ye.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function Oe(ye){var he="",fe,X,$=ye.length;for(fe=0;fe<$;fe++)X=ye.charCodeAt(fe),Math.random()>.5&&(X="x"+X.toString(16)),he+="&#"+X+";";return he}var Le=function(){function ye(fe){this.tokens=[],this.tokens.links=Object.create(null),this.options=fe||ke,this.options.tokenizer=this.options.tokenizer||new de,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var X={block:Ue.normal,inline:we.normal};this.options.pedantic?(X.block=Ue.pedantic,X.inline=we.pedantic):this.options.gfm&&(X.block=Ue.gfm,this.options.breaks?X.inline=we.breaks:X.inline=we.gfm),this.tokenizer.rules=X}ye.lex=function(X,$){var te=new ye($);return te.lex(X)};var he=ye.prototype;return he.lex=function(X){return X=X.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(X,this.tokens,!0),this.inline(this.tokens),this.tokens},he.blockTokens=function(X,$,te){$===void 0&&($=[]),te===void 0&&(te=!0),X=X.replace(/^ +$/gm,"");for(var oe,Te,Pe,Je;X;){if(oe=this.tokenizer.space(X)){X=X.substring(oe.raw.length),oe.type&&$.push(oe);continue}if(oe=this.tokenizer.code(X,$)){X=X.substring(oe.raw.length),oe.type?$.push(oe):(Je=$[$.length-1],Je.raw+=`
`+oe.raw,Je.text+=`
`+oe.text);continue}if(oe=this.tokenizer.fences(X)){X=X.substring(oe.raw.length),$.push(oe);continue}if(oe=this.tokenizer.heading(X)){X=X.substring(oe.raw.length),$.push(oe);continue}if(oe=this.tokenizer.nptable(X)){X=X.substring(oe.raw.length),$.push(oe);continue}if(oe=this.tokenizer.hr(X)){X=X.substring(oe.raw.length),$.push(oe);continue}if(oe=this.tokenizer.blockquote(X)){X=X.substring(oe.raw.length),oe.tokens=this.blockTokens(oe.text,[],te),$.push(oe);continue}if(oe=this.tokenizer.list(X)){for(X=X.substring(oe.raw.length),Pe=oe.items.length,Te=0;Te<Pe;Te++)oe.items[Te].tokens=this.blockTokens(oe.items[Te].text,[],!1);$.push(oe);continue}if(oe=this.tokenizer.html(X)){X=X.substring(oe.raw.length),$.push(oe);continue}if(te&&(oe=this.tokenizer.def(X))){X=X.substring(oe.raw.length),this.tokens.links[oe.tag]||(this.tokens.links[oe.tag]={href:oe.href,title:oe.title});continue}if(oe=this.tokenizer.table(X)){X=X.substring(oe.raw.length),$.push(oe);continue}if(oe=this.tokenizer.lheading(X)){X=X.substring(oe.raw.length),$.push(oe);continue}if(te&&(oe=this.tokenizer.paragraph(X))){X=X.substring(oe.raw.length),$.push(oe);continue}if(oe=this.tokenizer.text(X,$)){X=X.substring(oe.raw.length),oe.type?$.push(oe):(Je=$[$.length-1],Je.raw+=`
`+oe.raw,Je.text+=`
`+oe.text);continue}if(X){var Wt="Infinite loop on byte: "+X.charCodeAt(0);if(this.options.silent){console.error(Wt);break}else throw new Error(Wt)}}return $},he.inline=function(X){var $,te,oe,Te,Pe,Je,Wt=X.length;for($=0;$<Wt;$++){Je=X[$];switch(Je.type){case"paragraph":case"text":case"heading":{Je.tokens=[],this.inlineTokens(Je.text,Je.tokens);break}case"table":{for(Je.tokens={header:[],cells:[]},Te=Je.header.length,te=0;te<Te;te++)Je.tokens.header[te]=[],this.inlineTokens(Je.header[te],Je.tokens.header[te]);for(Te=Je.cells.length,te=0;te<Te;te++)for(Pe=Je.cells[te],Je.tokens.cells[te]=[],oe=0;oe<Pe.length;oe++)Je.tokens.cells[te][oe]=[],this.inlineTokens(Pe[oe],Je.tokens.cells[te][oe]);break}case"blockquote":{this.inline(Je.tokens);break}case"list":{for(Te=Je.items.length,te=0;te<Te;te++)this.inline(Je.items[te].tokens);break}}}return X},he.inlineTokens=function(X,$,te,oe,Te){$===void 0&&($=[]),te===void 0&&(te=!1),oe===void 0&&(oe=!1),Te===void 0&&(Te="");var Pe,Je=X,Wt;if(this.tokens.links){var Zt=Object.keys(this.tokens.links);if(Zt.length>0)for(;(Wt=this.tokenizer.rules.inline.reflinkSearch.exec(Je))!=null;)Zt.includes(Wt[0].slice(Wt[0].lastIndexOf("[")+1,-1))&&(Je=Je.slice(0,Wt.index)+"["+"a".repeat(Wt[0].length-2)+"]"+Je.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Wt=this.tokenizer.rules.inline.blockSkip.exec(Je))!=null;)Je=Je.slice(0,Wt.index)+"["+"a".repeat(Wt[0].length-2)+"]"+Je.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;X;){if(Pe=this.tokenizer.escape(X)){X=X.substring(Pe.raw.length),$.push(Pe);continue}if(Pe=this.tokenizer.tag(X,te,oe)){X=X.substring(Pe.raw.length),te=Pe.inLink,oe=Pe.inRawBlock,$.push(Pe);continue}if(Pe=this.tokenizer.link(X)){X=X.substring(Pe.raw.length),Pe.type==="link"&&(Pe.tokens=this.inlineTokens(Pe.text,[],!0,oe)),$.push(Pe);continue}if(Pe=this.tokenizer.reflink(X,this.tokens.links)){X=X.substring(Pe.raw.length),Pe.type==="link"&&(Pe.tokens=this.inlineTokens(Pe.text,[],!0,oe)),$.push(Pe);continue}if(Pe=this.tokenizer.strong(X,Je,Te)){X=X.substring(Pe.raw.length),Pe.tokens=this.inlineTokens(Pe.text,[],te,oe),$.push(Pe);continue}if(Pe=this.tokenizer.em(X,Je,Te)){X=X.substring(Pe.raw.length),Pe.tokens=this.inlineTokens(Pe.text,[],te,oe),$.push(Pe);continue}if(Pe=this.tokenizer.codespan(X)){X=X.substring(Pe.raw.length),$.push(Pe);continue}if(Pe=this.tokenizer.br(X)){X=X.substring(Pe.raw.length),$.push(Pe);continue}if(Pe=this.tokenizer.del(X)){X=X.substring(Pe.raw.length),Pe.tokens=this.inlineTokens(Pe.text,[],te,oe),$.push(Pe);continue}if(Pe=this.tokenizer.autolink(X,Oe)){X=X.substring(Pe.raw.length),$.push(Pe);continue}if(!te&&(Pe=this.tokenizer.url(X,Oe))){X=X.substring(Pe.raw.length),$.push(Pe);continue}if(Pe=this.tokenizer.inlineText(X,oe,De)){X=X.substring(Pe.raw.length),Te=Pe.raw.slice(-1),$.push(Pe);continue}if(X){var Xt="Infinite loop on byte: "+X.charCodeAt(0);if(this.options.silent){console.error(Xt);break}else throw new Error(Xt)}}return $},j(ye,null,[{key:"rules",get:function(){return{block:Ue,inline:we}}}]),ye}(),Ke=I.defaults,Fe=F.cleanUrl,He=F.escape,Ne=function(){function ye(fe){this.options=fe||Ke}var he=ye.prototype;return he.code=function(X,$,te){var oe=($||"").match(/\S*/)[0];if(this.options.highlight){var Te=this.options.highlight(X,oe);Te!=null&&Te!==X&&(te=!0,X=Te)}return oe?'<pre><code class="'+this.options.langPrefix+He(oe,!0)+'">'+(te?X:He(X,!0))+`</code></pre>
`:"<pre><code>"+(te?X:He(X,!0))+`</code></pre>
`},he.blockquote=function(X){return`<blockquote>
`+X+`</blockquote>
`},he.html=function(X){return X},he.heading=function(X,$,te,oe){return this.options.headerIds?"<h"+$+' id="'+this.options.headerPrefix+oe.slug(te)+'">'+X+"</h"+$+`>
`:"<h"+$+">"+X+"</h"+$+`>
`},he.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},he.list=function(X,$,te){var oe=$?"ol":"ul",Te=$&&te!==1?' start="'+te+'"':"";return"<"+oe+Te+`>
`+X+"</"+oe+`>
`},he.listitem=function(X){return"<li>"+X+`</li>
`},he.checkbox=function(X){return"<input "+(X?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},he.paragraph=function(X){return"<p>"+X+`</p>
`},he.table=function(X,$){return $&&($="<tbody>"+$+"</tbody>"),`<table>
<thead>
`+X+`</thead>
`+$+`</table>
`},he.tablerow=function(X){return`<tr>
`+X+`</tr>
`},he.tablecell=function(X,$){var te=$.header?"th":"td",oe=$.align?"<"+te+' align="'+$.align+'">':"<"+te+">";return oe+X+"</"+te+`>
`},he.strong=function(X){return"<strong>"+X+"</strong>"},he.em=function(X){return"<em>"+X+"</em>"},he.codespan=function(X){return"<code>"+X+"</code>"},he.br=function(){return this.options.xhtml?"<br/>":"<br>"},he.del=function(X){return"<del>"+X+"</del>"},he.link=function(X,$,te){if(X=Fe(this.options.sanitize,this.options.baseUrl,X),X===null)return te;var oe='<a href="'+He(X)+'"';return $&&(oe+=' title="'+$+'"'),oe+=">"+te+"</a>",oe},he.image=function(X,$,te){if(X=Fe(this.options.sanitize,this.options.baseUrl,X),X===null)return te;var oe='<img src="'+X+'" alt="'+te+'"';return $&&(oe+=' title="'+$+'"'),oe+=this.options.xhtml?"/>":">",oe},he.text=function(X){return X},ye}(),xe=function(){function ye(){}var he=ye.prototype;return he.strong=function(X){return X},he.em=function(X){return X},he.codespan=function(X){return X},he.del=function(X){return X},he.html=function(X){return X},he.text=function(X){return X},he.link=function(X,$,te){return""+te},he.image=function(X,$,te){return""+te},he.br=function(){return""},ye}(),Ge=function(){function ye(){this.seen={}}var he=ye.prototype;return he.slug=function(X){var $=X.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty($)){var te=$;do this.seen[te]++,$=te+"-"+this.seen[te];while(this.seen.hasOwnProperty($))}return this.seen[$]=0,$},ye}(),qe=I.defaults,lt=F.unescape,ot=function(){function ye(fe){this.options=fe||qe,this.options.renderer=this.options.renderer||new Ne,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new xe,this.slugger=new Ge}ye.parse=function(X,$){var te=new ye($);return te.parse(X)};var he=ye.prototype;return he.parse=function(X,$){$===void 0&&($=!0);var te="",oe,Te,Pe,Je,Wt,Zt,Xt,an,fn,It,Kn,Sn,Jn,Dn,on,qn,Ft,Lt,Rr=X.length;for(oe=0;oe<Rr;oe++){It=X[oe];switch(It.type){case"space":continue;case"hr":{te+=this.renderer.hr();continue}case"heading":{te+=this.renderer.heading(this.parseInline(It.tokens),It.depth,lt(this.parseInline(It.tokens,this.textRenderer)),this.slugger);continue}case"code":{te+=this.renderer.code(It.text,It.lang,It.escaped);continue}case"table":{for(an="",Xt="",Je=It.header.length,Te=0;Te<Je;Te++)Xt+=this.renderer.tablecell(this.parseInline(It.tokens.header[Te]),{header:!0,align:It.align[Te]});for(an+=this.renderer.tablerow(Xt),fn="",Je=It.cells.length,Te=0;Te<Je;Te++){for(Zt=It.tokens.cells[Te],Xt="",Wt=Zt.length,Pe=0;Pe<Wt;Pe++)Xt+=this.renderer.tablecell(this.parseInline(Zt[Pe]),{header:!1,align:It.align[Pe]});fn+=this.renderer.tablerow(Xt)}te+=this.renderer.table(an,fn);continue}case"blockquote":{fn=this.parse(It.tokens),te+=this.renderer.blockquote(fn);continue}case"list":{for(Kn=It.ordered,Sn=It.start,Jn=It.loose,Je=It.items.length,fn="",Te=0;Te<Je;Te++)on=It.items[Te],qn=on.checked,Ft=on.task,Dn="",on.task&&(Lt=this.renderer.checkbox(qn),Jn?on.tokens.length>0&&on.tokens[0].type==="text"?(on.tokens[0].text=Lt+" "+on.tokens[0].text,on.tokens[0].tokens&&on.tokens[0].tokens.length>0&&on.tokens[0].tokens[0].type==="text"&&(on.tokens[0].tokens[0].text=Lt+" "+on.tokens[0].tokens[0].text)):on.tokens.unshift({type:"text",text:Lt}):Dn+=Lt),Dn+=this.parse(on.tokens,Jn),fn+=this.renderer.listitem(Dn,Ft,qn);te+=this.renderer.list(fn,Kn,Sn);continue}case"html":{te+=this.renderer.html(It.text);continue}case"paragraph":{te+=this.renderer.paragraph(this.parseInline(It.tokens));continue}case"text":{for(fn=It.tokens?this.parseInline(It.tokens):It.text;oe+1<Rr&&X[oe+1].type==="text";)It=X[++oe],fn+=`
`+(It.tokens?this.parseInline(It.tokens):It.text);te+=$?this.renderer.paragraph(fn):fn;continue}default:{var kn='Token with "'+It.type+'" type was not found.';if(this.options.silent){console.error(kn);return}else throw new Error(kn)}}}return te},he.parseInline=function(X,$){$=$||this.renderer;var te="",oe,Te,Pe=X.length;for(oe=0;oe<Pe;oe++){Te=X[oe];switch(Te.type){case"escape":{te+=$.text(Te.text);break}case"html":{te+=$.html(Te.text);break}case"link":{te+=$.link(Te.href,Te.title,this.parseInline(Te.tokens,$));break}case"image":{te+=$.image(Te.href,Te.title,Te.text);break}case"strong":{te+=$.strong(this.parseInline(Te.tokens,$));break}case"em":{te+=$.em(this.parseInline(Te.tokens,$));break}case"codespan":{te+=$.codespan(Te.text);break}case"br":{te+=$.br();break}case"del":{te+=$.del(this.parseInline(Te.tokens,$));break}case"text":{te+=$.text(Te.text);break}default:{var Je='Token with "'+Te.type+'" type was not found.';if(this.options.silent){console.error(Je);return}else throw new Error(Je)}}}return te},ye}(),bt=F.merge,ht=F.checkSanitizeDeprecation,ut=F.escape,Ze=I.getDefaults,Et=I.changeDefaults,St=I.defaults;function We(ye,he,fe){if(typeof ye=="undefined"||ye===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ye!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ye)+", string expected");if(typeof he=="function"&&(fe=he,he=null),he=bt({},We.defaults,he||{}),ht(he),fe){var X=he.highlight,$;try{$=Le.lex(ye,he)}catch(Pe){return fe(Pe)}var te=function(Je){var Wt;if(!Je)try{Wt=ot.parse($,he)}catch(Zt){Je=Zt}return he.highlight=X,Je?fe(Je):fe(null,Wt)};if(!X||X.length<3)return te();if(delete he.highlight,!$.length)return te();var oe=0;We.walkTokens($,function(Pe){Pe.type==="code"&&(oe++,setTimeout(function(){X(Pe.text,Pe.lang,function(Je,Wt){if(Je)return te(Je);Wt!=null&&Wt!==Pe.text&&(Pe.text=Wt,Pe.escaped=!0),oe--,oe===0&&te()})},0))}),oe===0&&te();return}try{var Te=Le.lex(ye,he);return he.walkTokens&&We.walkTokens(Te,he.walkTokens),ot.parse(Te,he)}catch(Pe){if(Pe.message+=`
Please report this to https://github.com/markedjs/marked.`,he.silent)return"<p>An error occurred:</p><pre>"+ut(Pe.message+"",!0)+"</pre>";throw Pe}}We.options=We.setOptions=function(ye){return bt(We.defaults,ye),Et(We.defaults),We},We.getDefaults=Ze,We.defaults=St,We.use=function(ye){var he=bt({},ye);if(ye.renderer&&function(){var X=We.defaults.renderer||new Ne,$=function(Te){var Pe=X[Te];X[Te]=function(){for(var Je=arguments.length,Wt=new Array(Je),Zt=0;Zt<Je;Zt++)Wt[Zt]=arguments[Zt];var Xt=ye.renderer[Te].apply(X,Wt);return Xt===!1&&(Xt=Pe.apply(X,Wt)),Xt}};for(var te in ye.renderer)$(te);he.renderer=X}(),ye.tokenizer&&function(){var X=We.defaults.tokenizer||new de,$=function(Te){var Pe=X[Te];X[Te]=function(){for(var Je=arguments.length,Wt=new Array(Je),Zt=0;Zt<Je;Zt++)Wt[Zt]=arguments[Zt];var Xt=ye.tokenizer[Te].apply(X,Wt);return Xt===!1&&(Xt=Pe.apply(X,Wt)),Xt}};for(var te in ye.tokenizer)$(te);he.tokenizer=X}(),ye.walkTokens){var fe=We.defaults.walkTokens;he.walkTokens=function(X){ye.walkTokens(X),fe&&fe(X)}}We.setOptions(he)},We.walkTokens=function(ye,he){for(var fe=E(ye),X;!(X=fe()).done;){var $=X.value;he($);switch($.type){case"table":{for(var te=E($.tokens.header),oe;!(oe=te()).done;){var Te=oe.value;We.walkTokens(Te,he)}for(var Pe=E($.tokens.cells),Je;!(Je=Pe()).done;)for(var Wt=Je.value,Zt=E(Wt),Xt;!(Xt=Zt()).done;){var an=Xt.value;We.walkTokens(an,he)}break}case"list":{We.walkTokens($.items,he);break}default:$.tokens&&We.walkTokens($.tokens,he)}}},We.Parser=ot,We.parser=ot.parse,We.Renderer=Ne,We.TextRenderer=xe,We.Lexer=Le,We.lexer=Le.lex,We.Tokenizer=de,We.Slugger=Ge,We.parse=We;var it=We;return it})},FOrL:function(Pt,Ye,W){Pt.exports=W.p+"static/nodata.a6b3f948.png"},IPdS:function(Pt,Ye,W){Pt.exports={drawerWrap:"drawerWrap___nRvfD",title:"title___e_1lX",problemset:"problemset___1u9oP",content:"content___1WwQ5",delete:"delete___3Q7nc",deleteIcon:"deleteIcon___ObOyh",previewWrap:"previewWrap___25lTY",preview:"preview___3uiyE"}},JUtD:function(Pt,Ye,W){"use strict";W.r(Ye);var Ee=W("DjyN"),j=W("NUBc"),w=W("T2oS"),N=W("W9HT"),E=W("qVdP"),R=W("jsC+"),I=W("k1fw"),M=W("+L6B"),T=W("2/Rp"),P=W("5Dmo"),_=W("3S7+"),S=W("lUTK"),O=W("BvKs"),C=W("oBTY"),x=W("sRBo"),b=W("kaz8"),p=W("miYZ"),n=W("tsqr"),l=W("7Kak"),s=W("9yH6"),g=W("2qtc"),d=W("kLXV"),u=W("9og8"),m=W("tJVT"),h=W("PpiC"),a=W("5NDa"),r=W("5rEg"),e=W("Znn+"),i=W("ZTPi"),v=W("WmNS"),f=W.n(v),y=W("q1tI"),t=W.n(y),A=W("9kvl"),U=W("iris"),F=W("d5o6"),H=W.n(F),J=W("P/tu"),B=W("WCUW"),Z=function(Re){var rt=Re.problemset,Ve=Re.dispatch,Qe=Re.onOk,Ht=Object(y.useState)(""),Ut=Object(m.a)(Ht,2),kt=Ut[0],wt=Ut[1],mt=Object(y.useState)([0]),Rt=Object(m.a)(mt,2),_t=Rt[0],Kt=Rt[1],Ot=function(){Ve({type:"problemset/setActionTabs",payload:{}})};Object(y.useEffect)(function(){if(rt.actionTabs.key==="\u65B0\u5EFA\u6587\u4EF6\u5939"){var Bt,jt;Kt([(Bt=rt.actionTabs)===null||Bt===void 0||((jt=Bt.params)===null||jt===void 0)?void 0:jt.group_id]),wt("")}},[rt.actionTabs.key]);var At=function(){var Bt=Object(u.a)(f.a.mark(function jt(){var xn,ge,Be;return f.a.wrap(function(tt){for(;;)switch(tt.prev=tt.next){case 0:if(xn=["\uFF1F","\u3001","/","\u2572","*","<",">","|"],kt.trim()){tt.next=4;break}return n.b.warn("\u8BF7\u8F93\u5165\u6587\u4EF6\u5939\u540D\u79F0"),tt.abrupt("return");case 4:if(!(kt.charAt(0)===" ")){tt.next=7;break}return n.b.warn("\u9996\u5B57\u7B26\u4E0D\u80FD\u4E3A\u7A7A\u683C"),tt.abrupt("return");case 7:ge=0;case 8:if(!(ge<kt.length)){tt.next=15;break}if(!xn.includes(kt.charAt(ge))){tt.next=12;break}return n.b.warn("\u6587\u4EF6\u5939\u540D\u79F0\u5305\u542B\u7279\u6B8A\u5B57\u7B26"),tt.abrupt("return",!1);case 12:ge++,tt.next=8;break;case 15:return tt.next=17,Object(B.n)({parent_id:_t.length>0?_t[0]:0,name:kt});case 17:Be=tt.sent,Be.status===0&&(Ot(),Qe(Be==null?void 0:Be.id));case 19:case"end":return tt.stop()}},jt)}));return function(){return Bt.apply(this,arguments)}}();return t.a.createElement(d.a,{centered:!0,title:"\u65B0\u5EFA\u6587\u4EF6\u5939",visible:rt.actionTabs.key==="\u65B0\u5EFA\u6587\u4EF6\u5939",width:500,onCancel:Ot,onOk:At,destroyOnClose:!0},t.a.createElement("div",{className:H.a.addModal},t.a.createElement("div",{className:H.a.row},t.a.createElement("span",{className:H.a.label},"\u6587\u4EF6\u5939\u540D\u79F0: "),t.a.createElement(r.a,{placeholder:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5939\u540D\u79F0",value:kt,onChange:function(jt){return wt(jt.target.value)}})),t.a.createElement("div",{className:H.a.row,style:{alignItems:"start",maxHeight:500,overflow:"auto"}},t.a.createElement("span",{className:H.a.label},"\u6587\u4EF6\u5939\u4F4D\u7F6E: "),t.a.createElement(J.a,{value:_t,onChange:function(jt){return Kt(jt)}}))))},re=Object(A.a)(function(Dt){var Re=Dt.problemset;return{problemset:Re}})(Z),ie=W("BdwD"),ve=W("iNYN"),de=W.n(ve),q=function(Re){var rt=Re.problemset,Ve=Re.globalSetting,Qe=Re.loading,Ht=Re.dispatch,Ut=Object(h.a)(Re,["problemset","globalSetting","loading","dispatch"]);return t.a.createElement(d.a,{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,visible:rt.actionTabs.key==="Problemset-PublicReview",title:"\u63D0\u793A",okText:"\u77E5\u9053\u5566",cancelText:"",width:"442px",onOk:function(){Ht({type:"problemset/setActionTabs",payload:{}})},onCancel:function(){Ht({type:"problemset/setActionTabs",payload:{}})}},t.a.createElement("div",{className:de.a.modalContent},"\u516C\u5F00\u7533\u8BF7\u5DF2\u63D0\u4EA4\uFF0C\u8BF7\u7B49\u5F85\u7BA1\u7406\u5458\u7684\u5BA1\u6838"),t.a.createElement("div",{className:de.a.modalContent},"\u6211\u4EEC\u5C06\u57281-2\u4E2A\u5DE5\u4F5C\u65E5\u5185\u5B8C\u6210\u5BA1\u6838"))},ee=Object(A.a)(function(Dt){var Re=Dt.problemset,rt=Dt.loading,Ve=Dt.globalSetting;return{problemset:Re,globalSetting:Ve,loading:rt.effects}})(q),pe=W("xlxt"),Q=W.n(pe),V=W("mgmH"),Ce=function(Re){var rt=Re.problemset,Ve=Re.dispatch,Qe=Object(y.useState)([]),Ht=Object(m.a)(Qe,2),Ut=Ht[0],kt=Ht[1],wt=function(){Ve({type:"problemset/setActionTabs",payload:{}})};Object(y.useEffect)(function(){if(rt.actionTabs.key==="\u5BFC\u51FA\u8BD5\u9898"){var Rt,_t;kt([(Rt=rt.actionTabs)===null||Rt===void 0||((_t=Rt.params)===null||_t===void 0)?void 0:_t.group_id])}},[rt.actionTabs.key]);var mt=function(){if(Ut.length===0){n.b.warn("\u8BF7\u9009\u62E9\u6587\u4EF6\u5939");return}Object(V.k)({group_id:Ut[0]}),wt()};return t.a.createElement(d.a,{centered:!0,title:"\u5BFC\u51FA\u8BD5\u9898",visible:rt.actionTabs.key==="\u5BFC\u51FA\u8BD5\u9898",width:718,destroyOnClose:!0,wrapClassName:Q.a.customModal,onCancel:wt,onOk:mt},t.a.createElement("aside",{className:Q.a.exportModal},t.a.createElement(J.a,{value:Ut,onChange:function(_t){return kt(_t)}})))},ke=Object(A.a)(function(Dt){var Re=Dt.problemset;return{problemset:Re}})(Ce),Ue=W("i8i3"),we=W.n(Ue),De=W("Ty5D"),Oe=function(Re){var rt,Ve,Qe=Re.problemset,Ht=Re.dispatch,Ut=Re.onOk,kt=Object(De.i)(),wt=Object(y.useState)([]),mt=Object(m.a)(wt,2),Rt=mt[0],_t=mt[1],Kt=Object(y.useState)(1),Ot=Object(m.a)(Kt,2),At=Ot[0],Bt=Ot[1],jt=Object(y.useState)([]),xn=Object(m.a)(jt,2),ge=xn[0],Be=xn[1],tn=Object(y.useState)([]),tt=Object(m.a)(tn,2),dt=tt[0],at=tt[1],ft=Object(y.useState)(!0),yt=Object(m.a)(ft,2),vt=yt[0],Qt=yt[1],un=Object(y.useState)(!1),Gt=Object(m.a)(un,2),zt=Gt[0],_r=Gt[1],gr=Object(y.useState)(!1),xr=Object(m.a)(gr,2),xt=xr[0],In=xr[1];Object(y.useEffect)(function(){if(Qe.actionTabs.key==="\u5171\u4EAB\u8BD5\u9898"){var wn,Nn;bn(),Be([(wn=Qe.actionTabs)===null||wn===void 0||((Nn=wn.params)===null||Nn===void 0)?void 0:Nn.group_id])}},[Qe.actionTabs.key]);var bn=function(){var wn=Object(u.a)(f.a.mark(function Nn(){var jn,rr,$n;return f.a.wrap(function(pr){for(;;)switch(pr.prev=pr.next){case 0:return Qt(!0),pr.next=3,Object(B.v)({type:0,page:1,per_page:10,order_by:"new"});case 3:jn=pr.sent,jn!=null&&jn.item_banks_group&&(rr={id:-1,item_banks_count:(jn==null?void 0:jn.no_group_count)||0,name:{name:"\u672A\u52A0\u5165\u5206\u7EC4"}},$n=[rr].concat((jn==null?void 0:jn.item_banks_group)||[]),_t($n)),Qt(!1);case 6:case"end":return pr.stop()}},Nn)}));return function(){return wn.apply(this,arguments)}}(),Yn=function(){Ht({type:"problemset/setActionTabs",payload:{}})},zn=function(){var wn=Object(u.a)(f.a.mark(function Nn(){var jn;return f.a.wrap(function($n){for(;;)switch($n.prev=$n.next){case 0:if(!(ge.length===0)){$n.next=3;break}return n.b.warn("\u8BF7\u9009\u62E9\u9700\u8981\u7684\u6587\u4EF6\u5939"),$n.abrupt("return");case 3:if(!(At===1)){$n.next=6;break}return Bt(2),$n.abrupt("return");case 6:return _r(!0),$n.next=9,Object(B.j)({item_banks_group_ids:ge,clazz:"ItemBank",group_ids:dt});case 9:jn=$n.sent,(jn==null?void 0:jn.status)===0&&(Ut(),Yn()),_r(!1);case 12:case"end":return $n.stop()}},Nn)}));return function(){return wn.apply(this,arguments)}}(),Vn=function(Nn){Be(Nn),In(Nn.length===Rt.length)};return t.a.createElement(d.a,{centered:!0,afterClose:function(){at([]),Bt(1),In(!1),_t([])},title:"\u5171\u4EAB\u8BD5\u9898".concat(At,"/2"),visible:Qe.actionTabs.key==="\u5171\u4EAB\u8BD5\u9898",footer:null,width:718,destroyOnClose:!0,wrapClassName:we.a.customModal,onCancel:Yn},t.a.createElement("aside",{className:we.a.shareModal},t.a.createElement(N.a,{spinning:vt},t.a.createElement("div",{className:we.a.content},At===1&&t.a.createElement("div",{className:we.a.group},t.a.createElement(J.a,{value:ge,onChange:function(Nn){return Be(Nn)}})),At===2&&t.a.createElement("div",{className:we.a.teachGroup},t.a.createElement("p",null,"\u5171\u4EAB\u81F3\u6559\u7814\u56E2\u961F"),t.a.createElement(b.a.Group,{value:dt,onChange:function(Nn){return at(Nn)}},Qe==null||((rt=Qe.teachGroupData)===null||rt===void 0||((Ve=rt.groups)===null||Ve===void 0))?void 0:Ve.map(function(wn){return t.a.createElement(b.a,{key:wn.group_id,value:wn.group_id},wn==null?void 0:wn.name)})))),t.a.createElement("div",{className:we.a.footer},t.a.createElement(T.a,{onClick:Yn},"\u53D6\u6D88"),t.a.createElement(T.a,{loading:zt,onClick:zn,type:"primary"},At===1?"\u4E0B\u4E00\u6B65":"\u786E\u8BA4\u5171\u4EAB")))))},Le=Object(A.a)(function(Dt){var Re=Dt.problemset;return{problemset:Re}})(Oe),Ke=function(Re){var rt=Re.problemset,Ve=Re.globalSetting,Qe=Re.loading,Ht=Re.dispatch,Ut=Re.onReloadData,kt=Ut===void 0?function(){}:Ut,wt=Object(h.a)(Re,["problemset","globalSetting","loading","dispatch","onReloadData"]),mt=Object(y.useRef)(!1),Rt=Object(y.useState)(!1),_t=Object(m.a)(Rt,2),Kt=_t[0],Ot=_t[1];Object(y.useEffect)(function(){rt.actionTabs.key==="Problemset-SetPrivate"?window.localStorage.getItem("problemset-set-private-hint-flag")==="1"?At():Ot(!0):Ot(!1)},[rt.actionTabs.key]);var At=function(){var Bt=Object(u.a)(f.a.mark(function jt(){var xn;return f.a.wrap(function(Be){for(;;)switch(Be.prev=Be.next){case 0:return mt.current&&window.localStorage.setItem("problemset-set-private-hint-flag","1"),Be.next=3,Ht({type:"problemset/setPrivate",payload:rt.actionTabs.params});case 3:xn=Be.sent,Ht({type:"problemset/setActionTabs",payload:{}}),mt.current=!1,xn.status===0&&kt();case 7:case"end":return Be.stop()}},jt)}));return function(){return Bt.apply(this,arguments)}}();return t.a.createElement(d.a,{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,visible:Kt,title:"\u64A4\u9500\u516C\u5F00\u544A\u77E5",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",confirmLoading:Qe["problemset/setPrivate"],width:"442px",onOk:At,onCancel:function(){Ht({type:"problemset/setActionTabs",payload:{}}),mt.current=!1}},t.a.createElement("div",{className:de.a.modalContentLeft},"\u672C\u9898\u5DF2\u516C\u5F00\uFF0C\u64A4\u9500\u516C\u5F00\u53EF\u80FD\u5BFC\u81F4\u90E8\u5206\u7528\u6237\u5BF9\u672C\u9898\u7684\u4F7F\u7528\u53D7\u635F\u3002"),t.a.createElement("div",{className:de.a.modalContentLeft},"\u786E\u8BA4\u64A4\u9500\u516C\u5F00\u56DE\u5230\u81EA\u6709\u72B6\u6001\u5417\uFF1F"),t.a.createElement("div",null,t.a.createElement(b.a,{className:"mt10",defaultChecked:!1,onChange:function(jt){return mt.current=jt.target.checked}},"\u4E0D\u518D\u63D0\u793A")))},Fe=Object(A.a)(function(Dt){var Re=Dt.problemset,rt=Dt.loading,Ve=Dt.globalSetting;return{problemset:Re,globalSetting:Ve,loading:rt.effects}})(Ke),He=function(Re){var rt=Re.problemset,Ve=Re.globalSetting,Qe=Re.loading,Ht=Re.dispatch,Ut=Re.onReloadData,kt=Ut===void 0?function(){}:Ut,wt=Object(h.a)(Re,["problemset","globalSetting","loading","dispatch","onReloadData"]),mt=function(){var Rt=Object(u.a)(f.a.mark(function _t(){var Kt;return f.a.wrap(function(At){for(;;)switch(At.prev=At.next){case 0:return At.next=2,Ht({type:"problemset/handleDelete",payload:rt.actionTabs.params});case 2:Kt=At.sent,Ht({type:"problemset/setActionTabs",payload:{}}),Kt.status===0&&kt();case 5:case"end":return At.stop()}},_t)}));return function(){return Rt.apply(this,arguments)}}();return t.a.createElement(d.a,{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,visible:rt.actionTabs.key==="Problemset-Delete",title:"\u63D0\u793A",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",confirmLoading:Qe["problemset/handleDelete"],width:"442px",onOk:mt,onCancel:function(){Ht({type:"problemset/setActionTabs",payload:{}})}},t.a.createElement("div",{className:de.a.modalContent},"\u786E\u8BA4\u5220\u9664\u540E\uFF0C\u65E0\u6CD5\u64A4\u9500"),t.a.createElement("div",{className:de.a.modalContent},"\u662F\u5426\u786E\u8BA4\u5220\u9664\uFF1F"))},Ne=Object(A.a)(function(Dt){var Re=Dt.problemset,rt=Dt.loading,Ve=Dt.globalSetting;return{problemset:Re,globalSetting:Ve,loading:rt.effects}})(He),xe=W("LvDl"),Ge=W("9Bee"),qe=function(Re){var rt,Ve=Re.problemset,Qe=Re.dispatch,Ht=Object(y.useState)({}),Ut=Object(m.a)(Ht,2),kt=Ut[0],wt=Ut[1],mt=Object(y.useState)([]),Rt=Object(m.a)(mt,2),_t=Rt[0],Kt=Rt[1],Ot=Object(y.useState)(!1),At=Object(m.a)(Ot,2),Bt=At[0],jt=At[1],xn=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];Object(y.useEffect)(function(){var tt;if((Ve==null||((tt=Ve.actionTabs)===null||tt===void 0)?void 0:tt.key)==="SINGLE"){var dt,at=Object(xe.cloneDeep)(Ve==null||((dt=Ve.actionTabs)===null||dt===void 0)?void 0:dt.params);wt(at),Kt(at.choices)}},[Ve==null||((rt=Ve.actionTabs)===null||rt===void 0)?void 0:rt.key]);var ge=function(){var tt=Object(u.a)(f.a.mark(function dt(){var at,ft;return f.a.wrap(function(vt){for(;;)switch(vt.prev=vt.next){case 0:if(_t.some(function(Qt){return Qt==null?void 0:Qt.checked})){vt.next=3;break}return n.b.warn("\u8BF7\u60A8\u4F5C\u7B54\u540E\u518D\u63D0\u4EA4"),vt.abrupt("return");case 3:Bt&&(ft=Object(xe.cloneDeep)(Ve==null||((at=Ve.actionTabs)===null||at===void 0)?void 0:at.params),Kt(ft.choices)),jt(!Bt);case 5:case"end":return vt.stop()}},dt)}));return function(){return tt.apply(this,arguments)}}(),Be=function(dt,at){console.log(dt.target.checked);var ft=_t.map(function(yt,vt){return Object(I.a)(Object(I.a)({},yt),{},{checked:vt===at?dt.target.checked:!1})});Kt(ft)},tn=function(){wt({}),Kt([]),jt(!1),Qe({type:"problemset/setActionTabs",payload:{}})};return t.a.createElement(d.a,{centered:!0,destroyOnClose:!0,visible:Ve.actionTabs.key==="SINGLE",title:"\u8BD5\u9898\u4F53\u9A8C",okText:Bt?"\u91CD\u65B0\u7B54\u9898":"\u63D0\u4EA4\u7B54\u6848",cancelText:"\u53D6\u6D88",width:708,onOk:ge,onCancel:tn},t.a.createElement("div",null,t.a.createElement("div",{className:"c-light-primary mb5 font16"},"\u5355\u9009\u9898"),t.a.createElement(Ge.a,{value:kt==null?void 0:kt.name}),_t==null?void 0:_t.map(function(tt,dt){var at=tt.is_answer,ft=tt.checked,yt=tt.choice_text,vt="";return Bt&&at&&(vt=de.a.green),Bt&&!at&&ft&&(vt=de.a.red),t.a.createElement("div",{key:dt,style:{pointerEvents:Bt?"none":"auto"},className:"".concat(de.a.row," ").concat(vt)},t.a.createElement(s.a,{onChange:function(un){return Be(un,dt)},checked:ft}),t.a.createElement("span",null,xn[dt],".\xA0"),t.a.createElement(Ge.a,{className:de.a.html,value:yt}),Bt&&at&&t.a.createElement("span",{style:{paddingTop:4},className:"iconfont icon-duigou1 font16"}),Bt&&!at&&ft&&t.a.createElement("span",{style:{fontWeight:600,paddingTop:5},className:"iconfont icon-guanbi font16"}))}),Bt&&t.a.createElement(y.Fragment,null,t.a.createElement("div",{className:de.a.line}),t.a.createElement("div",{className:"c-grey-333 mb5"},t.a.createElement("b",null,"\u6B63\u786E\u7B54\u6848:\xA0"),xn[_t.findIndex(function(tt){return tt.is_answer})]),t.a.createElement("div",{className:"c-grey-333 mb10"},t.a.createElement("b",null,"\u89E3\u6790:\xA0"),(kt==null?void 0:kt.analysis)||"\u6682\u65E0\u89E3\u6790"))))},lt=Object(A.a)(function(Dt){var Re=Dt.problemset;return{problemset:Re}})(qe),ot=function(Re){var rt,Ve=Re.problemset,Qe=Re.dispatch,Ht=Object(y.useState)({}),Ut=Object(m.a)(Ht,2),kt=Ut[0],wt=Ut[1],mt=Object(y.useState)([]),Rt=Object(m.a)(mt,2),_t=Rt[0],Kt=Rt[1],Ot=Object(y.useState)(!1),At=Object(m.a)(Ot,2),Bt=At[0],jt=At[1],xn=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];Object(y.useEffect)(function(){var dt;if((Ve==null||((dt=Ve.actionTabs)===null||dt===void 0)?void 0:dt.key)==="MULTIPLE"){var at,ft=Object(xe.cloneDeep)(Ve==null||((at=Ve.actionTabs)===null||at===void 0)?void 0:at.params);wt(ft),Kt(ft.choices)}},[Ve==null||((rt=Ve.actionTabs)===null||rt===void 0)?void 0:rt.key]);var ge=function(){var dt=Object(u.a)(f.a.mark(function at(){var ft,yt;return f.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:if(_t.some(function(un){return un==null?void 0:un.checked})){Qt.next=3;break}return n.b.warn("\u8BF7\u60A8\u4F5C\u7B54\u540E\u518D\u63D0\u4EA4"),Qt.abrupt("return");case 3:Bt&&(yt=Object(xe.cloneDeep)(Ve==null||((ft=Ve.actionTabs)===null||ft===void 0)?void 0:ft.params),Kt(yt.choices)),jt(!Bt);case 5:case"end":return Qt.stop()}},at)}));return function(){return dt.apply(this,arguments)}}(),Be=function(at,ft){console.log(at.target.checked);var yt=_t.map(function(vt,Qt){return Object(I.a)(Object(I.a)({},vt),{},{checked:Qt===ft?at.target.checked:vt.checked})});Kt(yt)},tn=function(){wt({}),Kt([]),jt(!1),Qe({type:"problemset/setActionTabs",payload:{}})},tt=function(){var at="";return _t.forEach(function(ft,yt){ft.is_answer&&(at=at+xn[yt])}),at};return t.a.createElement(d.a,{centered:!0,destroyOnClose:!0,visible:Ve.actionTabs.key==="MULTIPLE",title:"\u8BD5\u9898\u4F53\u9A8C",okText:Bt?"\u91CD\u65B0\u7B54\u9898":"\u63D0\u4EA4\u7B54\u6848",cancelText:"\u53D6\u6D88",width:708,onOk:ge,onCancel:tn},t.a.createElement("div",null,t.a.createElement("div",{className:"c-light-primary mb5 font16"},"\u591A\u9009\u9898"),t.a.createElement(Ge.a,{value:kt==null?void 0:kt.name}),_t==null?void 0:_t.map(function(dt,at){var ft=dt.is_answer,yt=dt.checked,vt=dt.choice_text,Qt="";return Bt&&ft&&(Qt=de.a.green),Bt&&!ft&&yt&&(Qt=de.a.red),t.a.createElement("div",{key:at,style:{pointerEvents:Bt?"none":"auto"},className:"".concat(de.a.row," ").concat(Qt)},t.a.createElement(b.a,{style:{padding:3},onChange:function(Gt){return Be(Gt,at)},checked:yt}),t.a.createElement("span",null,xn[at],".\xA0"),t.a.createElement(Ge.a,{className:de.a.html,value:vt}),Bt&&ft&&t.a.createElement("span",{style:{paddingTop:4},className:"iconfont icon-duigou1 font16"}),Bt&&!ft&&yt&&t.a.createElement("span",{style:{fontWeight:600,paddingTop:5},className:"iconfont icon-guanbi font16"}))}),Bt&&t.a.createElement(y.Fragment,null,t.a.createElement("div",{className:de.a.line}),t.a.createElement("div",{className:"c-grey-333 mb5"},t.a.createElement("b",null,"\u6B63\u786E\u7B54\u6848:\xA0"),tt()),t.a.createElement("div",{className:"c-grey-333 mb10"},t.a.createElement("b",null,"\u89E3\u6790:\xA0"),(kt==null?void 0:kt.analysis)||"\u6682\u65E0\u89E3\u6790"))))},bt=Object(A.a)(function(Dt){var Re=Dt.problemset;return{problemset:Re}})(ot),ht=function(Re){var rt,Ve,Qe=Re.problemset,Ht=Re.dispatch,Ut=Object(y.useState)({}),kt=Object(m.a)(Ut,2),wt=kt[0],mt=kt[1],Rt=Object(y.useState)([]),_t=Object(m.a)(Rt,2),Kt=_t[0],Ot=_t[1],At=Object(y.useState)(!1),Bt=Object(m.a)(At,2),jt=Bt[0],xn=Bt[1],ge=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];Object(y.useEffect)(function(){var dt;if((Qe==null||((dt=Qe.actionTabs)===null||dt===void 0)?void 0:dt.key)==="JUDGMENT"){var at,ft=Object(xe.cloneDeep)(Qe==null||((at=Qe.actionTabs)===null||at===void 0)?void 0:at.params);mt(ft),Ot(ft.choices)}},[Qe==null||((rt=Qe.actionTabs)===null||rt===void 0)?void 0:rt.key]);var Be=function(){var dt=Object(u.a)(f.a.mark(function at(){var ft,yt;return f.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:if(Kt.some(function(un){return un==null?void 0:un.checked})){Qt.next=3;break}return n.b.warn("\u8BF7\u60A8\u4F5C\u7B54\u540E\u518D\u63D0\u4EA4"),Qt.abrupt("return");case 3:jt&&(yt=Object(xe.cloneDeep)(Qe==null||((ft=Qe.actionTabs)===null||ft===void 0)?void 0:ft.params),Ot(yt.choices)),xn(!jt);case 5:case"end":return Qt.stop()}},at)}));return function(){return dt.apply(this,arguments)}}(),tn=function(at,ft){console.log(at.target.checked);var yt=Kt.map(function(vt,Qt){return Object(I.a)(Object(I.a)({},vt),{},{checked:Qt===ft?at.target.checked:!1})});Ot(yt)},tt=function(){mt({}),Ot([]),xn(!1),Ht({type:"problemset/setActionTabs",payload:{}})};return t.a.createElement(d.a,{centered:!0,destroyOnClose:!0,visible:Qe.actionTabs.key==="JUDGMENT",title:"\u8BD5\u9898\u4F53\u9A8C",okText:jt?"\u91CD\u65B0\u7B54\u9898":"\u63D0\u4EA4\u7B54\u6848",cancelText:"\u53D6\u6D88",width:708,onOk:Be,onCancel:tt},t.a.createElement("div",null,t.a.createElement("div",{className:"c-light-primary mb5 font16"},"\u5224\u65AD\u9898"),t.a.createElement(Ge.a,{value:wt==null?void 0:wt.name}),Kt==null?void 0:Kt.map(function(dt,at){var ft=dt.is_answer,yt=dt.checked,vt=dt.choice_text,Qt="";return jt&&ft&&(Qt=de.a.green),jt&&!ft&&yt&&(Qt=de.a.red),t.a.createElement("div",{key:at,style:{pointerEvents:jt?"none":"auto"},className:"".concat(de.a.row," ").concat(Qt)},t.a.createElement(s.a,{onChange:function(Gt){return tn(Gt,at)},checked:yt}),t.a.createElement(Ge.a,{className:de.a.html,value:vt}),jt&&ft&&t.a.createElement("span",{style:{paddingTop:4},className:"iconfont icon-duigou1 font16"}),jt&&!ft&&yt&&t.a.createElement("span",{style:{fontWeight:600,paddingTop:5},className:"iconfont icon-guanbi font16"}))}),jt&&t.a.createElement(y.Fragment,null,t.a.createElement("div",{className:de.a.line}),t.a.createElement("div",{className:"c-grey-333 mb5"},t.a.createElement("b",null,"\u6B63\u786E\u7B54\u6848:\xA0"),(Ve=Kt.find(function(dt){return dt.is_answer}))===null||Ve===void 0?void 0:Ve.choice_text),t.a.createElement("div",{className:"c-grey-333 mb10"},t.a.createElement("b",null,"\u89E3\u6790:\xA0"),(wt==null?void 0:wt.analysis)||"\u6682\u65E0\u89E3\u6790"))))},ut=Object(A.a)(function(Dt){var Re=Dt.problemset;return{problemset:Re}})(ht),Ze=function(Re){var rt,Ve,Qe=Re.problemset,Ht=Re.dispatch,Ut=Object(y.useState)({}),kt=Object(m.a)(Ut,2),wt=kt[0],mt=kt[1],Rt=Object(y.useState)([]),_t=Object(m.a)(Rt,2),Kt=_t[0],Ot=_t[1],At=Object(y.useState)(!1),Bt=Object(m.a)(At,2),jt=Bt[0],xn=Bt[1],ge=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];Object(y.useEffect)(function(){var dt;if((Qe==null||((dt=Qe.actionTabs)===null||dt===void 0)?void 0:dt.key)==="COMPLETION"){var at,ft,yt=Object(xe.cloneDeep)(Qe==null||((at=Qe.actionTabs)===null||at===void 0)?void 0:at.params);mt(yt),Ot(yt==null||((ft=yt.standard_answer)===null||ft===void 0)?void 0:ft.map(function(vt){return{value:"",answer:(vt==null?void 0:vt.answer_text)||[]}}))}},[Qe==null||((rt=Qe.actionTabs)===null||rt===void 0)?void 0:rt.key]);var Be=function(){var dt=Object(u.a)(f.a.mark(function at(){var ft,yt,vt;return f.a.wrap(function(un){for(;;)switch(un.prev=un.next){case 0:if(!Kt.some(function(Gt){return(Gt==null?void 0:Gt.value)===""})){un.next=3;break}return n.b.warn("\u8BF7\u60A8\u4F5C\u7B54\u540E\u518D\u63D0\u4EA4"),un.abrupt("return");case 3:jt&&(vt=Object(xe.cloneDeep)(Qe==null||((ft=Qe.actionTabs)===null||ft===void 0)?void 0:ft.params),Ot(vt==null||((yt=vt.standard_answer)===null||yt===void 0)?void 0:yt.map(function(Gt){return{value:"",answer:(Gt==null?void 0:Gt.answer_text)||[]}}))),xn(!jt);case 5:case"end":return un.stop()}},at)}));return function(){return dt.apply(this,arguments)}}(),tn=function(at,ft){var yt=Kt.map(function(vt,Qt){return Object(I.a)(Object(I.a)({},vt),{},{value:Qt===ft?at.target.value:vt.value})});Ot(yt)},tt=function(){mt({}),Ot([]),xn(!1),Ht({type:"problemset/setActionTabs",payload:{}})};return t.a.createElement(d.a,{centered:!0,destroyOnClose:!0,visible:Qe.actionTabs.key==="COMPLETION",title:"\u8BD5\u9898\u4F53\u9A8C",okText:jt?"\u91CD\u65B0\u7B54\u9898":"\u63D0\u4EA4\u7B54\u6848",cancelText:"\u53D6\u6D88",width:708,onOk:Be,onCancel:tt},t.a.createElement("div",null,t.a.createElement("div",{className:"c-light-primary mb5 font16"},"\u586B\u7A7A\u9898"),t.a.createElement(Ge.a,{value:wt==null?void 0:wt.name}),Kt==null?void 0:Kt.map(function(dt,at){var ft=dt.value,yt=dt.answer,vt="";return jt&&yt!==null&&yt!==void 0&&yt.includes(ft)&&(vt=de.a.green),jt&&!(yt!=null&&yt.includes(ft))&&(vt=de.a.red),t.a.createElement("div",{key:at,style:{pointerEvents:jt?"none":"auto",marginTop:10},className:"".concat(de.a.row," ").concat(vt)},t.a.createElement("div",{style:{minWidth:80}},"\u586B\u7A7A",at+1,"\u7B54\u6848:"),t.a.createElement(r.a.TextArea,{className:de.a.textArea,style:{width:610,marginRight:10},onChange:function(un){return tn(un,at)},value:ft}),jt&&(yt==null?void 0:yt.includes(ft))&&t.a.createElement("span",{style:{paddingTop:4},className:"iconfont icon-duigou1 font16"}),jt&&!(yt!=null&&yt.includes(ft))&&t.a.createElement("span",{style:{fontWeight:600,paddingTop:5},className:"iconfont icon-guanbi font16"}))}),jt&&t.a.createElement(y.Fragment,null,t.a.createElement("div",{className:de.a.line}),wt==null||((Ve=wt.standard_answer)===null||Ve===void 0)?void 0:Ve.map(function(dt,at){var ft;return t.a.createElement("div",{className:"c-grey-333 mb5"},t.a.createElement("b",null,"\u586B\u7A7A",at+1,"\u7B54\u6848:\xA0"),(dt==null||((ft=dt.answer_text)===null||ft===void 0)?void 0:ft.join("\u3001"))||"")}),t.a.createElement("div",{className:"c-grey-333 mb10"},t.a.createElement("b",null,"\u89E3\u6790:\xA0"),(wt==null?void 0:wt.analysis)||"\u6682\u65E0\u89E3\u6790"))))},Et=Object(A.a)(function(Dt){var Re=Dt.problemset;return{problemset:Re}})(Ze),St=W("Q9mQ"),We=W("diRs"),it=W("+z73"),ye=W.n(it),he=function(Re){var rt=Re.data,Ve=rt===void 0?[]:rt,Qe=Re.onClick,Ht=function(){return Ve.map(function(wt,mt){return t.a.createElement("div",{key:mt,className:ye.a.few},t.a.createElement("b",{title:wt.name,style:{color:mt===0?"#333333":"#999999"},onClick:function(){return Qe(wt.id)}},wt.name),mt<Ve.length-1&&t.a.createElement("span",null,"/"))})},Ut=function(){var wt=!0,mt=Ve.slice(2,-2),Rt=t.a.createElement("div",{className:ye.a.pWrap},mt.map(function(_t){return t.a.createElement("span",{title:_t.name,onClick:function(){return Qe(_t.id)},key:_t.id},_t.name)}));return Ve.map(function(_t,Kt){var Ot=null;return Kt>1&&Kt<Ve.length-2?wt&&(Ot=t.a.createElement(We.a,{key:Kt,placement:"bottom",content:Rt},t.a.createElement("span",{style:{color:"#999",cursor:"pointer"}},".../")),wt=!1):Ot=t.a.createElement("div",{key:Kt,className:ye.a.few},t.a.createElement("b",{title:_t.name,style:{color:Kt===0?"#333333":"#999999"},onClick:function(){return Qe(_t.id)}},_t.name),Kt<Ve.length-1&&t.a.createElement("span",null,"/")),Ot})};return t.a.createElement("aside",{style:{overflowX:"auto"}},(Ve==null?void 0:Ve.length)>5?Ut():Ht())},fe=he,X=W("tK3L"),$=W.n(X),te=W("bbsP"),oe=W("/wGt"),Te=W("IPdS"),Pe=W.n(Te),Je=[],Wt=function(Re){Je.forEach(function(rt){if(Re.target===rt.element||Zt.isParent(Re.target,rt.element))return;rt.callbacks.forEach(function(Ve){return Ve()})})};window.document.body?window.document.body.addEventListener("click",Wt):window.addEventListener("DOMContentLoaded",function(){window.document.body.addEventListener("click",Wt)});var Zt={isParent:function(Re,rt){for(var Ve=Re;Ve&&Ve.tagName&&Ve.tagName.toLowerCase()!=="body";){if(Ve===rt)return!0;Ve=Ve.parentNode}return!1},init:function(Re,rt){var Ve=Je.filter(function(Qe){return Qe.element===Re});return Ve.length>0?Ve[0].callbacks.push(rt):Je.push({element:Re,callbacks:[rt]}),{clear:function(){Je=Je.filter(function(Ht){return Ht.element!==Re})}}}},Xt=Zt,an=[{stateName:"single_questions_count",type:"SINGLE",typeName:"\u5355\u9009\u9898"},{stateName:"multiple_questions_count",type:"MULTIPLE",typeName:"\u591A\u9009\u9898"},{stateName:"judgement_questions_count",type:"JUDGMENT",typeName:"\u5224\u65AD\u9898"},{stateName:"completion_questions_count",type:"COMPLETION",typeName:"\u586B\u7A7A\u9898"},{stateName:"subjective_questions_count",type:"SUBJECTIVE",typeName:"\u7B80\u7B54\u9898"},{stateName:"program_questions_count",type:"PROGRAM",typeName:"\u7F16\u7A0B\u9898"},{stateName:"practical_questions_count",type:"PRACTICAL",typeName:"\u5B9E\u8BAD\u9898"},{stateName:"combination_questions_count",type:"COMBINATION",typeName:"\u7EC4\u5408\u9898"}],fn=function(Re){var rt=Re.visible,Ve=Re.basketData,Qe=Re.basketTotal,Ht=Re.onClose,Ut=Ht===void 0?function(){}:Ht,kt=Re.onDelete,wt=kt===void 0?function(){}:kt,mt=Object(y.useRef)(),Rt=Object(y.useRef)();return Object(y.useEffect)(function(){return Rt.current?(Qe>=0&&!mt.current&&(mt.current=Xt.init(Rt.current,function(){Ut()})),function(){mt.current&&mt.current.clear()}):void 0},[Rt.current]),t.a.createElement(oe.a,{className:Pe.a.drawerWrap,placement:"right",closable:!1,mask:!1,visible:rt,forceRender:!0,onClose:Ut},Qe>0?t.a.createElement("div",{style:{height:"100%"},ref:Rt},t.a.createElement("div",{className:Pe.a.title},"\u8BD5\u9898\u7BEE"),an.map(function(_t){return Ve[_t.stateName]>0&&t.a.createElement("div",{className:Pe.a.problemset,key:_t.type},t.a.createElement("div",{className:Pe.a.content},_t.typeName,"(",Ve[_t.stateName],")"),t.a.createElement("div",{className:Pe.a.delete,onClick:function(){return wt(_t.type)}},t.a.createElement("i",{className:"iconfont icon-shanchu1 ".concat(Pe.a.deleteIcon)})))}),t.a.createElement("div",{className:Pe.a.previewWrap},t.a.createElement("div",{className:Pe.a.preview,onClick:function(){return A.d.push("/problemset/preview")}},"\u8BD5\u5377\u9884\u89C8"))):t.a.createElement("div",{ref:Rt},t.a.createElement(ie.a,{customText:"\u8BF7\u9009\u62E9\u8BD5\u9898\u8FDB\u884C\u7EC4\u5377"})))},It={SINGLE:"\u5355\u9009\u9898",MULTIPLE:"\u591A\u9009\u9898",JUDGMENT:"\u5224\u65AD\u9898",COMPLETION:"\u586B\u7A7A\u9898",SUBJECTIVE:"\u7B80\u7B54\u9898",PROGRAM:"\u7F16\u7A0B\u9898",PRACTICAL:"\u5B9E\u8BAD\u9898",COMBINATION:"\u7EC4\u5408\u9898"},Kn=function(Re){var rt,Ve,Qe=Re.problemset,Ht=Re.globalSetting,Ut=Re.loading,kt=Re.dispatch,wt=Re.onReloadData,mt=wt===void 0?function(){}:wt,Rt=Re.onReloadBasketData,_t=Rt===void 0?function(){}:Rt,Kt=Object(h.a)(Re,["problemset","globalSetting","loading","dispatch","onReloadData","onReloadBasketData"]),Ot=function(){var At=Object(u.a)(f.a.mark(function Bt(){var jt;return f.a.wrap(function(ge){for(;;)switch(ge.prev=ge.next){case 0:return ge.next=2,kt({type:"problemset/basketDelete",payload:Qe.actionTabs.params});case 2:jt=ge.sent,kt({type:"problemset/setActionTabs",payload:{}}),jt.status===0&&(mt(),_t());case 5:case"end":return ge.stop()}},Bt)}));return function(){return At.apply(this,arguments)}}();return t.a.createElement(d.a,{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,visible:Qe.actionTabs.key==="Problemset-BasketDelete",title:"\u63D0\u793A",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",confirmLoading:Ut["problemset/handleDelete"],width:"442px",onOk:Ot,onCancel:function(){kt({type:"problemset/setActionTabs",payload:{}})}},t.a.createElement("div",{className:de.a.modalContent},"\u662F\u5426\u5220\u9664\u8BD5\u9898\u7BEE\u4E2D",It[(rt=Qe.actionTabs)===null||rt===void 0||((Ve=rt.params)===null||Ve===void 0)?void 0:Ve.type]))},Sn=Object(A.a)(function(Dt){var Re=Dt.problemset,rt=Dt.loading,Ve=Dt.globalSetting;return{problemset:Re,globalSetting:Ve,loading:rt.effects}})(Kn),Jn=W("A60/"),Dn=W.n(Jn),on=function(Re){var rt=Re.count,Ve=Re.visibleBasket,Qe=Re.onToggleVisible,Ht=Qe===void 0?function(){}:Qe;return t.a.createElement("div",{className:"".concat(Ve?Dn.a.right180:Dn.a.right20," ").concat(Dn.a.wrap)},t.a.createElement(_.a,{title:"\u8BD5\u9898\u7BEE",placement:"left"},t.a.createElement("div",{className:Dn.a.basket,onClick:Ht},rt>0&&t.a.createElement("div",{className:Dn.a.count},rt),t.a.createElement("span",{className:Dn.a.iconWrap},t.a.createElement("i",{className:"".concat(Dn.a.icon," iconfont icon-shitilan")})),t.a.createElement("p",{className:Dn.a.name},"\u8BD5\u9898\u7BEE"))))},qn=W("+vTd"),Ft=W.n(qn),Lt=W("xKgJ"),Rr=["A\uFF0E","B\uFF0E","C\uFF0E","D\uFF0E","E\uFF0E","F\uFF0E","G\uFF0E","H\uFF0E","I\uFF0E","J\uFF0E","K\uFF0E","L\uFF0E","M\uFF0E","N\uFF0E","O\uFF0E","P\uFF0E","Q\uFF0E","R\uFF0E","S\uFF0E","T\uFF0E","U\uFF0E","V\uFF0E","W\uFF0E","X\uFF0E","Y\uFF0E","Z\uFF0E"],kn=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Wn=function(Re){var rt,Ve=Re.isProblemset,Qe=Re.data,Ht=Re.user,Ut=Re.selectIds,kt=Re.activeTabsKey,wt=Re.onPublicReview,mt=wt===void 0?function(){}:wt,Rt=Re.onStartExperience,_t=Rt===void 0?function(){}:Rt,Kt=Re.onSelectCheckBox,Ot=Kt===void 0?function(){}:Kt,At=Re.onSetPrivate,Bt=At===void 0?function(){}:At,jt=Re.onCorrection,xn=jt===void 0?function(){}:jt,ge=Re.onCollect,Be=ge===void 0?function(){}:ge,tn=Re.onSetPublic,tt=tn===void 0?function(){}:tn,dt=Re.onDelete,at=dt===void 0?function(){}:dt,ft=Re.onCancel,yt=ft===void 0?function(){}:ft,vt=Re.onSelect,Qt=vt===void 0?function(){}:vt,un=Re.onMoveTo,Gt=un===void 0?function(){}:un,zt=Re.onSetShare,_r=zt===void 0?function(){}:zt,gr=Re.onCancelShare,xr=gr===void 0?function(){}:gr,xt=Re.onPublish,In=xt===void 0?function(){}:xt,bn=Re.onCancelPublish,Yn=bn===void 0?function(){}:bn,zn=Object(y.useState)(!1),Vn=Object(m.a)(zn,2),wn=Vn[0],Nn=Vn[1],jn=function(){if(Qe.item_type==="JUDGMENT")return t.a.createElement("div",{className:Ft.a.judgmentContent},Qe.choices.map(function(Hn,Cr){return t.a.createElement(s.a,{key:Cr,disabled:!0},Hn.choice_text)}));if(Qe.item_type==="PROGRAM"){var ar;return t.a.createElement("div",{className:Ft.a.programContent},t.a.createElement(Ge.a,{value:(ar=Qe.program_attr)===null||ar===void 0?void 0:ar.description}))}if(Qe.item_type==="COMBINATION"){var Zn;return t.a.createElement("div",{className:Ft.a.combinationContent},Qe==null||((Zn=Qe.sub_item_banks)===null||Zn===void 0)?void 0:Zn.map(function(Hn,Cr){var Fr,Jr="(\u9898\u76EE".concat(Cr+1,"-\u5355\u9009\u9898) ");return t.a.createElement(y.Fragment,null,t.a.createElement("div",{style:{marginTop:10,marginBottom:10}},t.a.createElement(Ge.a,{value:Jr+Hn.name})),Hn.choices.map(function(mr,Tr){return t.a.createElement("div",{key:Tr,className:Ft.a.otherContentItem},t.a.createElement("p",null,Rr[Tr]),t.a.createElement(Ge.a,{className:Ft.a.otehrContentHtml,value:mr.choice_text}))}),t.a.createElement("div",{className:Ft.a.con},t.a.createElement("b",{className:"c-grey-333 font14"}," \u7B54\u6848\uFF1A",kn==null?void 0:kn[Hn==null||((Fr=Hn.choices)===null||Fr===void 0)?void 0:Fr.findIndex(function(mr){return mr==null?void 0:mr.is_answer})]," "),t.a.createElement("div",null,t.a.createElement("span",null,"\u89E3\u6790\uFF1A"),t.a.createElement(Ge.a,{className:Ft.a.parseAnswerHtml,value:Hn.analysis||"\u6682\u65E0\u89E3\u6790"}))))}))}return t.a.createElement("div",{className:Ft.a.otherContent},Qe.choices.map(function(Hn,Cr){return t.a.createElement("div",{key:Cr,className:Ft.a.otherContentItem},t.a.createElement("p",null,Rr[Cr]),t.a.createElement(Ge.a,{className:Ft.a.otehrContentHtml,value:Hn.choice_text}))}))},rr=function(){var ar;return t.a.createElement("div",null,(ar=Qe.standard_answer)===null||ar===void 0?void 0:ar.map(function(Zn,Hn){return t.a.createElement(Ge.a,{key:Hn,className:Ft.a.answerHtml,value:"\u7B54\u6848\uFF08\u586B\u7A7A".concat(Zn.position,"\uFF09\uFF1A").concat(Zn.answer_text.join("\u3001"))})}))},$n=function(){var ar,Zn,Hn,Cr={SUBJECTIVE:(ar=Qe.answer_texts)===null||ar===void 0?void 0:ar[0],JUDGMENT:(Zn=Qe.choices)===null||Zn===void 0||((Hn=Zn.find(function(Mr){return Mr.is_answer}))===null||Hn===void 0)?void 0:Hn.choice_text},Fr=Qe.choices.map(function(Mr){return Mr.is_answer}).findIndex(function(Mr){return Mr}),Jr=Fr>-1?kn[Fr]:"",mr="";Qe.choices.map(function(Mr,aa){Mr.is_answer&&(mr+=kn[aa])});var Tr=Cr[Qe.item_type],ir={SINGLE:t.a.createElement(Ge.a,{className:Ft.a.answerHtml,value:"\u7B54\u6848\uFF1A".concat(Jr||"\u65E0")}),MULTIPLE:t.a.createElement(Ge.a,{className:Ft.a.answerHtml,value:"\u7B54\u6848\uFF1A".concat(mr||"\u65E0")}),COMPLETION:rr()},or=t.a.createElement(Ge.a,{className:Ft.a.answerHtml,value:"\u7B54\u6848\uFF1A".concat(Tr||"\u65E0")});return ir[Qe.item_type]||or},Br=function(ar){var Zn=Object(C.a)(Ut);ar.target.checked?Zn.push(Qe.id):Zn=Zn.filter(function(Hn){return Hn!==Qe.id}),Ot(Zn)};return t.a.createElement("div",{className:Ft.a.itemWrap},t.a.createElement("div",{className:Ft.a.list},t.a.createElement(b.a,{className:"mr10",onChange:Br,checked:Ut.includes(Qe.id)}),t.a.createElement("div",{className:Ft.a.title},t.a.createElement(Ge.a,{key:1,showLines:1,showTextOnly:!0,className:Ft.a.topicTitleContent,value:Qe.name})),!wn&&t.a.createElement("div",{onClick:function(){return Nn(!wn)},className:Ft.a.tr},"\u5C55\u5F00",t.a.createElement("i",{style:{transform:"rotate(90deg)"},className:"iconfont icon-lujing"}))),t.a.createElement("aside",{style:wn?{height:"auto"}:{overflow:"hidden",height:0}},t.a.createElement(Ge.a,{key:2,className:"".concat(Ft.a.topicTitleContent," mt20"),value:Qe.name}),t.a.createElement("div",{className:"".concat(Ft.a.row," mt15")},jn()),t.a.createElement("div",{className:Ft.a.row},t.a.createElement("div",{className:Ft.a.updateTimeRow},t.a.createElement("div",{className:Ft.a.updateTimeWrap},Qe.item_type==="PROGRAM"&&t.a.createElement("p",{className:Ft.a.programLanguage},"\u7F16\u7A0B\u8BED\u8A00\uFF1A",(rt=Qe.program_attr)===null||rt===void 0?void 0:rt.language)))),Qe.item_type!=="PROGRAM"&&Qe.item_type!=="COMBINATION"&&t.a.createElement("div",null,t.a.createElement("div",{className:Ft.a.parseAnswerBorder}),t.a.createElement("div",{className:Ft.a.answer},$n()),t.a.createElement("div",{className:Ft.a.parse},t.a.createElement("div",{className:Ft.a.parseText},"\u89E3\u6790\uFF1A"),t.a.createElement("div",{className:Ft.a.parseAnswer},Qe.analysis?t.a.createElement(Ge.a,{className:Ft.a.parseAnswerHtml,value:Qe.analysis}):"\u6682\u65E0\u89E3\u6790"))),t.a.createElement("div",{className:Ft.a.bottom},Qe.item_type!=="SUBJECTIVE"&&Qe.item_type!=="COMBINATION"&&t.a.createElement("span",{onClick:function(){return _t(Qe)}},"\u4F53\u9A8C"),t.a.createElement("span",{onClick:function(){return Nn(!1)}},"\u6536\u8D77",t.a.createElement("i",{className:"iconfont icon-zhankaijiantou"})," "))))},Vr=function(Re){var rt,Ve,Qe,Ht,Ut,kt,wt,mt,Rt,_t,Kt,Ot,At,Bt,jt,xn,ge=Re.isProblemset,Be=Re.data,tn=Re.user,tt=Re.activeTabsKey,dt=Re.onPublicReview,at=dt===void 0?function(){}:dt,ft=Re.onStartExperience,yt=ft===void 0?function(){}:ft,vt=Re.onSetPrivate,Qt=vt===void 0?function(){}:vt,un=Re.onCorrection,Gt=un===void 0?function(){}:un,zt=Re.onCollect,_r=zt===void 0?function(){}:zt,gr=Re.onSetPublic,xr=gr===void 0?function(){}:gr,xt=Re.onDelete,In=xt===void 0?function(){}:xt,bn=Re.onCancel,Yn=bn===void 0?function(){}:bn,zn=Re.onSelect,Vn=zn===void 0?function(){}:zn,wn=Re.onMoveTo,Nn=wn===void 0?function(){}:wn,jn=Re.onSetShare,rr=jn===void 0?function(){}:jn,$n=Re.onCancelShare,Br=$n===void 0?function(){}:$n,pr=Re.onPublish,ar=pr===void 0?function(){}:pr,Zn=Re.onCancelPublish,Hn=Zn===void 0?function(){}:Zn,Cr=Be.item_type==="PROGRAM"?"/problems/".concat((rt=Be.program_attr)===null||rt===void 0?void 0:rt.identifier,"/edit"):"/problemset/edit/".concat(Be.id),Fr=tt==="0"&&!Be.public&&!Be.apply&&(Be.item_type==="PROGRAM"&&((Ve=Be.program_attr)===null||Ve===void 0?void 0:Ve.status)!==0||Be.item_type!=="PROGRAM"),Jr=t.a.createElement(O.a,{forceSubMenuRender:!0,className:Ft.a.menu},tt==="0"&&!Be.public&&t.a.createElement(O.a.Item,{key:"-1"},t.a.createElement("a",{className:Ft.a.actionLink,target:"_blank",href:Cr},"\u7F16\u8F91")),(tt==="0"||tt==="3")&&Be.item_type==="PROGRAM"&&((Qe=Be.program_attr)===null||Qe===void 0?void 0:Qe.status)!==0&&!Be.public&&((Ht=Be.author)===null||Ht===void 0?void 0:Ht.login)===((Ut=tn.userInfo)===null||Ut===void 0?void 0:Ut.login)&&t.a.createElement(O.a.Item,{key:"0"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){var or;return Hn(Be==null||((or=Be.program_attr)===null||or===void 0)?void 0:or.identifier)}},"\u64A4\u9500\u53D1\u5E03")),tt==="0"&&t.a.createElement(O.a.Item,{key:"1"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){return Nn(Be.id)}},"\u79FB\u52A8\u5230")),tt==="0"&&!(Be!=null&&Be.is_share)&&t.a.createElement(O.a.Item,{key:"3"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){return rr(Be.id)}},"\u5171\u4EAB")),(tt==="0"&&(Be==null?void 0:Be.is_share)||tt==="3"&&((kt=Be.author)===null||kt===void 0?void 0:kt.login)===((wt=tn.userInfo)===null||wt===void 0?void 0:wt.login))&&t.a.createElement(O.a.Item,{key:"3"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){return Br(Be.id)}},"\u64A4\u9500\u5171\u4EAB")),Fr&&t.a.createElement(O.a.Item,{key:"4"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){return xr(Be.id)}},"\u516C\u5F00")),tt==="0"&&!Be.public&&Be.apply&&(Be.item_type==="PROGRAM"&&Be.program_attr.status!==0||Be.item_type!=="PROGRAM")&&t.a.createElement(O.a.Item,{key:"5"},t.a.createElement("a",{className:Ft.a.reviewFlag,onClick:at},"\u5BA1\u6838\u4E2D")),(tt==="0"||tt==="1")&&Be.public&&((mt=Be.author)===null||mt===void 0?void 0:mt.login)===((Rt=tn.userInfo)===null||Rt===void 0?void 0:Rt.login)&&t.a.createElement(O.a.Item,{key:"6"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){return Qt(Be.id)}},"\u64A4\u9500\u516C\u5F00")),tt==="2"&&t.a.createElement(O.a.Item,{key:"7"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){return _r(Be.id,Be.is_collected)}},"\u53D6\u6D88\u6536\u85CF")),(tt==="0"||tt==="3")&&Be.item_type==="PROGRAM"&&((_t=Be.program_attr)===null||_t===void 0?void 0:_t.status)===0&&!Be.public&&((Kt=Be.author)===null||Kt===void 0?void 0:Kt.login)===((Ot=tn.userInfo)===null||Ot===void 0?void 0:Ot.login)&&t.a.createElement(O.a.Item,{key:"8"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){var or;return ar(Be==null||((or=Be.program_attr)===null||or===void 0)?void 0:or.identifier)}},"\u53D1\u5E03")),(tt==="1"||tt==="3")&&!Object(Lt.o)()&&!Object(Lt.m)()&&((At=Be.author)===null||At===void 0?void 0:At.login)!==((Bt=tn.userInfo)===null||Bt===void 0?void 0:Bt.login)&&t.a.createElement(O.a.Item,{key:"9"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){return _r(Be.id,Be.is_collected)}},Be.is_collected?"\u53D6\u6D88\u6536\u85CF":"\u6536\u85CF")),tt!=="0"&&!Object(Lt.o)()&&!Object(Lt.m)()&&t.a.createElement(O.a.Item,{key:"10"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){return Gt(Be.id)}},"\u7EA0\u9519")),(tt==="0"&&!Be.public||tt==="1"&&Object(Lt.o)()&&((jt=Be.author)===null||jt===void 0?void 0:jt.login)!==((xn=tn.userInfo)===null||xn===void 0?void 0:xn.login))&&t.a.createElement(O.a.Item,{key:"11"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){return In(Be.id)}},"\u5220\u9664"))),mr=t.a.createElement(O.a,{forceSubMenuRender:!0,className:Ft.a.menu},t.a.createElement(O.a.Item,{key:"10"},t.a.createElement("a",{className:Ft.a.actionLink,onClick:function(){return Gt(Be.id)}},"\u7EA0\u9519"))),Tr=tt!=="0"&&!Object(Lt.o)()&&!Object(Lt.m)();return t.a.createElement(t.a.Fragment,null,ge?t.a.createElement(R.a,{className:"ml40",overlay:Jr},t.a.createElement("span",{style:{cursor:"default"},onClick:function(or){return or.preventDefault()}},t.a.createElement("span",{className:"c-light-primary"},"\u66F4\u591A"))):Tr?t.a.createElement(R.a,{className:"ml40",overlay:mr},t.a.createElement("span",{style:{cursor:"default"},onClick:function(or){return or.preventDefault()}},t.a.createElement("span",{className:"c-light-primary"},"\u66F4\u591A"))):t.a.createElement("span",null))},br=Wn,Pr=W("YaiT"),nr=W.n(Pr),dr=W("ErOA"),Ur=function(Re){var rt=Re.isProblemset,Ve=Re.data,Qe=Re.user,Ht=Re.onOpen,Ut=Ht===void 0?function(){}:Ht,kt=Re.onMove,wt=kt===void 0?function(){}:kt,mt=Re.onRenameOk,Rt=mt===void 0?function(){}:mt,_t=Re.onDeleteOk,Kt=_t===void 0?function(){}:_t,Ot=Object(y.useState)(!1),At=Object(m.a)(Ot,2),Bt=At[0],jt=At[1],xn=Object(y.useState)(""),ge=Object(m.a)(xn,2),Be=ge[0],tn=ge[1];Object(y.useEffect)(function(){Ve.name&&tn(Ve==null?void 0:Ve.name)},[Ve==null?void 0:Ve.name]);var tt=function(){var at=Object(u.a)(f.a.mark(function ft(yt){var vt,Qt,un;return f.a.wrap(function(zt){for(;;)switch(zt.prev=zt.next){case 0:if(vt=["\uFF1F","\u3001","/","\u2572","*","<",">","|"],Be.trim()){zt.next=4;break}return n.b.warn("\u8BF7\u8F93\u5165\u6587\u4EF6\u5939\u540D\u79F0"),zt.abrupt("return");case 4:if(!(Be.charAt(0)===" ")){zt.next=7;break}return n.b.warn("\u9996\u5B57\u7B26\u4E0D\u80FD\u4E3A\u7A7A\u683C"),zt.abrupt("return");case 7:Qt=0;case 8:if(!(Qt<Be.length)){zt.next=15;break}if(!vt.includes(Be.charAt(Qt))){zt.next=12;break}return n.b.warn("\u6587\u4EF6\u5939\u540D\u79F0\u5305\u542B\u7279\u6B8A\u5B57\u7B26"),zt.abrupt("return",!1);case 12:Qt++,zt.next=8;break;case 15:return zt.next=17,Object(dr.a)("/api/item_banks_groups/".concat(Math.abs(yt),".json"),{method:"put",body:{name:Be}});case 17:un=zt.sent,un.status===0&&(jt(!1),Rt());case 19:case"end":return zt.stop()}},ft)}));return function(yt){return at.apply(this,arguments)}}(),dt=function(ft){d.a.confirm({title:"\u63D0\u793A",okText:"\u786E\u8BA4\u5220\u9664",className:"custom-modal-divider ",icon:null,content:t.a.createElement("div",null,t.a.createElement("p",null,"\u672C\u6B21\u5220\u9664\u64CD\u4F5C\u786E\u5B9A\u540E\u5185\u5BB9\u5C06\u65E0\u6CD5\u6062\u590D\uFF0C\u662F\u5426\u7EE7\u7EED\uFF1F"),t.a.createElement("p",null,"\u5220\u9664\u6587\u4EF6\u5939\uFF0C\u5C06\u540C\u6B65\u5220\u9664\u5176\u6240\u5305\u542B\u7684\u5168\u90E8\u5B50\u6587\u4EF6\u5939\u548C\u8BD5\u9898\uFF0C\u8BF7\u614E\u91CD\u64CD\u4F5C\uFF01")),cancelText:"\u53D6\u6D88",onOk:function(){var yt=Object(u.a)(f.a.mark(function Qt(){var un;return f.a.wrap(function(zt){for(;;)switch(zt.prev=zt.next){case 0:return zt.next=2,Object(dr.a)("/api/item_banks_groups/".concat(Math.abs(ft),".json"),{method:"delete",body:{}});case 2:un=zt.sent,un.status===0&&Kt([ft]);case 4:case"end":return zt.stop()}},Qt)}));function vt(){return yt.apply(this,arguments)}return vt}()})};return t.a.createElement("div",{className:nr.a.list},t.a.createElement("div",{className:"iconfont icon-wenjianjia2 c-light-primary mr10"}),Bt?t.a.createElement(r.a,{style:{maxWidth:800},value:Be,onChange:function(ft){return tn(ft.target.value)}}):t.a.createElement("div",{title:Ve==null?void 0:Ve.name,onClick:function(){return Ut(Ve.id)},className:nr.a.name},Ve==null?void 0:Ve.name),rt&&t.a.createElement("div",{className:nr.a.btns},Bt?t.a.createElement(t.a.Fragment,null,t.a.createElement("div",{onClick:function(){return tt(Ve.id)},className:"ml0"},t.a.createElement("i",{className:"iconfont icon-chenggong1",style:{color:"#33BD8C"}})),t.a.createElement("div",{onClick:function(){return jt(!1)},className:"ml10"},t.a.createElement("i",{className:"iconfont icon-qingchu"}))):t.a.createElement(t.a.Fragment,null,t.a.createElement("div",{onClick:function(){return wt(Ve.id,!0)},className:"ml0"},t.a.createElement("i",{className:"iconfont icon-shangyi3",style:{transform:"translateY(2px)"}})),t.a.createElement("div",{onClick:function(){return wt(Ve.id,!1)},className:"ml10",style:{transform:"rotate(180deg) translateY(1px)"}},t.a.createElement("i",{className:"iconfont icon-shangyi3"}))),t.a.createElement(T.a,{style:{marginLeft:16},onClick:function(){return jt(!0)},type:"link"},"\u91CD\u547D\u540D"),t.a.createElement(T.a,{onClick:function(){return dt(Ve.id)},type:"link",danger:!0},"\u5220\u9664")))},Ar=Ur,ua=W("rCGY"),Er=W.n(ua),ya=function(Re){var rt,Ve,Qe=Re.dispatch,Ht=Re.problemset,Ut=Re.groupIds,kt=Ut===void 0?[]:Ut,wt=Re.onChangeTeachGroup,mt=wt===void 0?function(){}:wt,Rt=Ht.teachGroupData;return!!(Rt!=null&&(rt=Rt.groups)!==null&&rt!==void 0&&rt.length)&&t.a.createElement("div",{className:Er.a.groupWrap},t.a.createElement("span",{className:"".concat(Er.a.minWidth73," ml20 mt3")},"\u6559\u7814\u56E2\u961F\uFF1A"),t.a.createElement("span",null,t.a.createElement("li",{className:"mr10 mb10 ".concat(Er.a.minWidth60," ").concat(Er.a.directionItem," ").concat(kt!=null&&kt.length?"":Er.a.active),onClick:function(){return mt([])}},"\u5168\u90E8")),t.a.createElement("div",{className:Er.a.directionContentWrap},Rt==null||((Ve=Rt.groups)===null||Ve===void 0)?void 0:Ve.map(function(_t){return t.a.createElement("span",null,t.a.createElement("li",{key:_t.group_id,onClick:function(){return mt([_t.group_id])},className:"".concat(Er.a.directionItem," ").concat(kt!=null&&kt.includes(_t.group_id)?Er.a.active:"")},_t.name))})))},da=W("1vsH"),ba=W("/zsF"),ra=W("PArb"),ca=W("14J3"),Zr=W("BMrR"),Ea=W("jCWc"),ha=W("kPKH"),_a=W("y8nQ"),L=W("Vl3Y"),o=W("nSDg"),c=W.n(o),D=W("HBuW"),K=W("NLgs"),k=r.a.Search,ce={id:"type",name:"\u6765\u6E90",children:[{name:"\u5168\u90E8",id:"all",type:"type"},{name:"\u6211\u7684",id:"mine",type:"type"}]},ze={id:"diff",name:"\u96BE\u5EA6",children:[{name:"\u5168\u90E8",id:"",type:"diff"},{name:"\u521D\u7EA7",id:1,type:"diff"},{name:"\u4E2D\u7EA7",id:2,type:"diff"},{name:"\u4E2D\u9AD8\u7EA7",id:3,type:"diff"},{name:"\u9AD8\u7EA7",id:4,type:"diff"}]},gt=function(Re){var rt,Ve,Qe,Ht,Ut=Re.classroomList,kt=Re.loading,wt=Re.dispatch,mt=Re.cb,Rt=Re.shixunIds,_t=Rt===void 0?[]:Rt,Kt=Object(De.i)(),Ot=Object(De.h)(),At=Ut.actionTabs,Bt=L.a.useForm(),jt=Object(m.a)(Bt,1),xn=jt[0],ge=Ut.shixunLists,Be=Object(y.useState)([]),tn=Object(m.a)(Be,2),tt=tn[0],dt=tn[1],at=Object(y.useState)([]),ft=Object(m.a)(at,2),yt=ft[0],vt=ft[1],Qt=Object(y.useState)({page:1,type:"all",diff:0,status:"published",order:"desc",limit:10,sort:"myshixuns_count",tag_level:null,sub_discipline_id:null,discipline_id:null}),un=Object(m.a)(Qt,2),Gt=un[0],zt=un[1];Object(y.useEffect)(function(){Ut.actionTabs.key==="\u9009\u7528\u5B9E\u8DF5\u9879\u76EE"&&wt({type:"classroomList/getShixunLists",payload:Object(I.a)({},Gt)})},[Ut.actionTabs.key,Gt]),Object(y.useEffect)(function(){try{Ut.actionTabs.key==="\u9009\u7528\u5B9E\u8DF5\u9879\u76EE"?(document.body.removeAttribute("data-custom"),document.body.setAttribute("data-self","height")):document.body.removeAttribute("data-self")}catch(xt){}return function(){document.body.removeAttribute("data-self"),document.body.setAttribute("data-custom","initial")}},[Ut.actionTabs.key]),Object(y.useEffect)(function(){_r()},[Kt]);var _r=function(){var xt=Object(u.a)(f.a.mark(function In(){var bn;return f.a.wrap(function(zn){for(;;)switch(zn.prev=zn.next){case 0:return zn.next=2,Object(D.ob)({});case 2:bn=zn.sent,vt((bn==null?void 0:bn.disciplines)||[]);case 4:case"end":return zn.stop()}},In)}));return function(){return xt.apply(this,arguments)}}(),gr=function(In,bn,Yn){Gt.tag_level=In,Gt.sub_discipline_id=bn,Gt.discipline_id=Yn,zt(Object(I.a)({},Gt)),wt({type:"classroomList/getShixunLists",payload:Object(I.a)({},Gt)})},xr=function(){wt({type:"classroomList/setActionTabs",payload:{}}),zt({page:1,type:"all",diff:0,status:"all",order:"desc",limit:10,sort:"myshixuns_count",tag_level:null,sub_discipline_id:null,discipline_id:null})};return Ut.actionTabs.key!=="\u9009\u7528\u5B9E\u8DF5\u9879\u76EE"?null:t.a.createElement(oe.a,{placement:"bottom",height:"100%",closable:!0,onClose:xr,visible:Ut.actionTabs.key==="\u9009\u7528\u5B9E\u8DF5\u9879\u76EE",key:"bottom",className:c.a.drawer,footer:t.a.createElement("div",{className:"tc"},t.a.createElement(T.a,{size:"large",onClick:function(){xr(),dt([])},style:{marginRight:8}},"\u53D6\u6D88"),t.a.createElement(T.a,{size:"large",onClick:Object(u.a)(f.a.mark(function xt(){var In,bn,Yn;return f.a.wrap(function(Vn){for(;;)switch(Vn.prev=Vn.next){case 0:In=function(Nn){var jn=tt[Nn];if(_t.includes(jn)){var rr,$n;return n.b.info("\u8BF7\u52FF\u91CD\u590D\u9009\u62E9\uFF1A".concat(ge==null||((rr=ge.shixun_list)===null||rr===void 0||(($n=rr.find(function(Br){return Br.id===jn}))===null||$n===void 0))?void 0:$n.title)),{v:void 0}}},bn=0;case 2:if(!(bn<(tt==null?void 0:tt.length))){Vn.next=9;break}if(Yn=In(bn),!(typeof Yn=="object")){Vn.next=6;break}return Vn.abrupt("return",Yn.v);case 6:bn++,Vn.next=2;break;case 9:xr(),mt(tt),dt([]);case 12:case"end":return Vn.stop()}},xt)})),type:"primary"},"\u786E\u5B9A"))},t.a.createElement("section",{className:"tc"},t.a.createElement(k,{placeholder:"\u5B9E\u8BAD\u4FE1\u606F/\u9662\u6821\u540D\u79F0/\u521B\u5EFA\u8005",enterButton:"\u641C\u7D22",size:"large",className:c.a.search,onSearch:function(In){Gt.keyword=In,Gt.page=1,wt({type:"classroomList/getShixunLists",payload:Object(I.a)({},Gt)})}})),t.a.createElement("section",{className:"edu-container"},t.a.createElement("ul",{className:c.a.menu},t.a.createElement("li",null,ce.name),ce==null||((rt=ce.children)===null||rt===void 0)?void 0:rt.map(function(xt,In){return t.a.createElement("li",{className:Gt[ce.id]==xt.id?c.a.actived:"",onClick:function(){Gt[ce.id]=xt.id,zt(Object(I.a)({},Gt)),wt({type:"classroomList/getShixunLists",payload:Object(I.a)({},Gt)})}},t.a.createElement("strong",null,xt.name))})),t.a.createElement("ul",{className:c.a.menuDirection},t.a.createElement("li",{className:c.a.directionName},"\u65B9\u5411"),t.a.createElement("li",{className:Gt.discipline_id?"":c.a.actived,onClick:function(){gr(null,null,null)}},t.a.createElement("strong",null,"\u5168\u90E8")),yt==null?void 0:yt.map(function(xt,In){return t.a.createElement("li",{key:In,className:Gt.discipline_id==xt.id?c.a.actived:""},t.a.createElement("strong",{onClick:function(){gr(1,null,xt.id)}},xt.name),t.a.createElement("div",null,xt.sub_disciplines.map(function(bn,Yn){return t.a.createElement("div",{key:Yn,className:"mt5"},t.a.createElement("div",{className:Gt.sub_discipline_id==bn.id?"".concat(c.a.actived2," ").concat(c.a.subTag):c.a.subTag,onClick:function(){gr(2,bn.id,xt.id)}},bn.name),t.a.createElement("ul",{className:"mt5"},bn.tags&&bn.tags.map(function(zn,Vn){return t.a.createElement("li",{key:Vn,className:Gt.sub_discipline_id==zn.id&&Gt.tag_level===3?c.a.actived2:"",onClick:function(){gr(3,zn.id,xt.id)}},zn.name)})))})))})),t.a.createElement("ul",{className:c.a.menu},t.a.createElement("li",null,ze.name),ze==null||((Ve=ze.children)===null||Ve===void 0)?void 0:Ve.map(function(xt,In){return t.a.createElement("li",{className:Gt[ze.id]==xt.id?c.a.actived:"",onClick:function(){Gt[ze.id]=xt.id,zt(Object(I.a)({},Gt)),wt({type:"classroomList/getShixunLists",payload:Object(I.a)({},Gt)})}},t.a.createElement("strong",null,xt.name))})),t.a.createElement(Zr.a,null,t.a.createElement(ha.a,{flex:"1"},t.a.createElement("div",{className:c.a.menuCourse,style:{margin:"0px 15px"}},t.a.createElement("ul",null,t.a.createElement("li",null,"\u5DF2\u9009",t.a.createElement("span",{className:"c-blue"},tt.length),"\u4E2A\u5B9E\u8BAD"),t.a.createElement("li",null,"\u5171",t.a.createElement("span",{className:"c-blue"},ge.shixuns_count),"\u4E2A\u8BFE\u7A0B"),t.a.createElement("li",{className:"current",onClick:function(){Gt.order=Gt.order==="asc"?"desc":"asc",zt(Object(I.a)({},Gt))}},"\u5B66\u4E60\u4EBA\u6570",t.a.createElement("p",{className:"edu-sorter current ".concat(Gt.order)},Gt.order==="asc"?t.a.createElement("span",{className:"iconfont icon-sanjiaoxing-up"}):t.a.createElement("span",{className:"iconfont icon-sanjiaoxing-down"})))))),t.a.createElement(ha.a,{className:"c-grey-999"},"\u4EC5\u5DF2\u53D1\u5E03\u7684\u5B9E\u8BAD\u8FDB\u5165\u672C\u5217\u8868\u5907\u9009")),ge==null||((Qe=ge.shixun_list)===null||Qe===void 0)?void 0:Qe.map(function(xt,In){return t.a.createElement("div",{className:c.a.listItem,key:In},t.a.createElement(b.a,{checked:tt.includes(xt.id),value:xt.id,disabled:xt==null?void 0:xt.need_authorize,onChange:function(Yn){var zn=tt.indexOf(xt.id);tt.indexOf(xt.id)>-1?dt(tt.filter(function(Vn){return Vn!==xt.id})):dt(tt.concat(xt.id))}}),t.a.createElement("div",{className:c.a.info},t.a.createElement("div",{className:c.a.title},t.a.createElement("div",{className:c.a.titleLeft},t.a.createElement("a",{className:"c-black",href:"/shixuns/".concat(xt==null?void 0:xt.identifier,"/challenges"),target:"_blank"},t.a.createElement("strong",{className:"font16",dangerouslySetInnerHTML:{__html:xt.title}})),(xt==null?void 0:xt.need_authorize)&&t.a.createElement("span",{onClick:function(){Object(K.a)(!1)},style:{marginRight:"auto"},className:"tag-style bg-pink current ml10"},"\u9700\u6388\u6743"),Object(Lt.v)()&&(xt==null?void 0:xt.mark_status)===1&&t.a.createElement(_.a,{title:xt==null?void 0:xt.mark_content},t.a.createElement("span",{style:{marginRight:"auto",background:"#2FA34F"},className:"tag-style current ml10"},"\u6B63\u5E38")),Object(Lt.v)()&&(xt==null?void 0:xt.mark_status)===2&&t.a.createElement(_.a,{title:xt==null?void 0:xt.mark_content},t.a.createElement("span",{style:{marginRight:"auto",background:"#FF8C29"},className:"tag-style current ml10"},"\u9700\u5B8C\u5584")),Object(Lt.v)()&&(xt==null?void 0:xt.mark_status)===3&&t.a.createElement(_.a,{title:xt==null?void 0:xt.mark_content},t.a.createElement("span",{style:{marginRight:"auto",background:"#E53333"},className:"tag-style current ml10"},"\u65E0\u6CD5\u4F7F\u7528")))),t.a.createElement("div",{className:"flex-wrp mt10 font14 c-light-black"},t.a.createElement("span",{className:c.a.description,dangerouslySetInnerHTML:{__html:xt.description}})),t.a.createElement("div",{className:" mt15"},xt.challenge_names.map(function(bn,Yn){return t.a.createElement("span",{key:Yn,className:"mr30 font12"},"\u7B2C",Yn+1,"\u5173 ",bn," ")})),t.a.createElement(ra.a,{dashed:!0}),t.a.createElement("div",{className:"c-light-black mt20 font12"},t.a.createElement("span",null,xt.author_name),t.a.createElement("span",{className:"ml15 mr15"},"|"),t.a.createElement("span",null,xt.author_school_name),t.a.createElement("span",{className:"ml15 mr15"},"|"),t.a.createElement("span",null,"\u96BE\u5EA6\u7CFB\u6570 ",xt.level),t.a.createElement("span",{className:"ml15 mr15"},"|"),t.a.createElement("span",null,"\u5B66\u4E60\u4EBA\u6570 "),t.a.createElement("span",null,xt.study_count))))}),(ge==null||((Ht=ge.shixun_list)===null||Ht===void 0)?void 0:Ht.length)===0&&t.a.createElement(ie.a,null),t.a.createElement("p",null)),t.a.createElement("div",{className:"tc mt20"},t.a.createElement(j.a,{defaultCurrent:1,hideOnSinglePage:!0,defaultPageSize:20,showSizeChanger:!1,current:Gt.page||1,showQuickJumper:!0,total:ge==null?void 0:ge.shixuns_count,onChange:function(In){Gt.page=In,zt(Object(I.a)({},Gt))}})))},Nt=Object(A.a)(function(Dt){var Re=Dt.classroomList,rt=Dt.loading;return{classroomList:Re,loading:rt}})(gt),Xe=i.a.TabPane,Jt=r.a.Search,Pn=r.a.TextArea,Bn=function(Re){var rt,Ve,Qe,Ht,Ut,kt,wt,mt=Re.problemset,Rt=Re.user,_t=Re.globalSetting,Kt=Re.loading,Ot=Re.dispatch,At=Re.match,Bt=Object(h.a)(Re,["problemset","user","globalSetting","loading","dispatch","match"]),jt=Object(y.useState)({discipline_id:null,sub_discipline_id:null,tag_discipline_id:null,group_id:null,type:"0",item_type:null,difficulty:null,keyword:null,page:1,per_page:20,sort_by:"updated_at",sort_direction:"desc",id:((rt=Bt.location)===null||rt===void 0||((Ve=rt.query)===null||Ve===void 0)?void 0:Ve.id)||null,exam_id:(At==null||((Qe=At.params)===null||Qe===void 0)?void 0:Qe.id)||null,exercise_id:(At==null||((Ht=At.params)===null||Ht===void 0)?void 0:Ht.categoryId)||null}),xn=Object(m.a)(jt,2),ge=xn[0],Be=xn[1],tn=Object(y.useState)(0),tt=Object(m.a)(tn,2),dt=tt[0],at=tt[1],ft=Object(y.useState)([]),yt=Object(m.a)(ft,2),vt=yt[0],Qt=yt[1],un=Object(y.useState)("0"),Gt=Object(m.a)(un,2),zt=Gt[0],_r=Gt[1],gr=Object(y.useState)(0),xr=Object(m.a)(gr,2),xt=xr[0],In=xr[1],bn=Object(y.useState)(-1),Yn=Object(m.a)(bn,2),zn=Yn[0],Vn=Yn[1],wn=Object(y.useState)([]),Nn=Object(m.a)(wn,2),jn=Nn[0],rr=Nn[1],$n=Object(y.useState)(!1),Br=Object(m.a)($n,2),pr=Br[0],ar=Br[1],Zn=Object(y.useState)([]),Hn=Object(m.a)(Zn,2),Cr=Hn[0],Fr=Hn[1],Jr=Object(y.useState)(0),mr=Object(m.a)(Jr,2),Tr=mr[0],ir=mr[1],or=Object(y.useState)(!1),Mr=Object(m.a)(or,2),aa=Mr[0],Na=Mr[1],Va=Object(y.useState)(!1),xa=Object(m.a)(Va,2),Ua=xa[0],Ca=xa[1],ja=Object(y.useRef)(!1),ni=Object(y.useRef)(""),ia=Object(y.useRef)(),qr=Object(y.useRef)(),cr=Object(y.useRef)(),$a=Object(y.useState)(),Ta=Object(m.a)($a,2),Xa=Ta[0],ri=Ta[1],ne=Object(y.useState)([]),me=Object(m.a)(ne,2),ue=me[0],ae=me[1],G=Object(y.useRef)(!1),Y=(At==null?void 0:At.url)==="/problemset",z=Rt.userInfo||{},se=z.admin,le=z.business,_e=z.is_shixun_marker,be=z.is_teacher,Se=z.user_identity,Ie=se||le||_e||be||Se!=="\u5B66\u751F",nt=Object(y.useState)("\u6309\u66F4\u65B0\u65F6\u95F4\u964D\u5E8F"),et=Object(m.a)(nt,2),ct=et[0],Yt=et[1],dn=Object(y.useState)([]),en=Object(m.a)(dn,2),sn=en[0],cn=en[1],ln=Object(y.useState)(0),nn=Object(m.a)(ln,2),mn=nn[0],hn=nn[1],Xn=Object(y.useRef)(null),En=Object(y.useRef)(!1),$t=Object(y.useState)(!1),Vt=Object(m.a)($t,2),vn=Vt[0],pn=Vt[1],Mt=[{name:"\u6309\u66F4\u65B0\u65F6\u95F4\u5347\u5E8F",type:"updated_at",direction:"asc"},{name:"\u6309\u66F4\u65B0\u65F6\u95F4\u964D\u5E8F",type:"updated_at",direction:"desc"},{name:"\u6309\u4F7F\u7528\u6B21\u6570\u5347\u5E8F",type:"quotes",direction:"asc"},{name:"\u6309\u4F7F\u7528\u6B21\u6570\u964D\u5E8F",type:"quotes",direction:"desc"}];Object(y.useEffect)(function(){return document.body.setAttribute("data-custom","initial"),function(){document.body.removeAttribute("data-custom")}},[]),Object(y.useEffect)(function(){var je;Ot({type:"problemset/getDisciplines",payload:{source:"question"}});var Ae=((je=Bt.location.query)===null||je===void 0?void 0:je.group_id)||0;ge.group_id=Number(Ae),Be(ge),qt(ge),gn(),Fn()},[]),Object(y.useEffect)(function(){return Ot({type:"globalSetting/onlyShowBackTopToggle",payload:!1}),Ot({type:"globalSetting/onlyShowBackTopIconToggle",payload:!1}),function(){Ot({type:"globalSetting/onlyShowBackTopToggle",payload:!0}),Ot({type:"globalSetting/onlyShowBackTopIconToggle",payload:!0})}},[]),Object(y.useEffect)(function(){return Ot({type:"globalSetting/headerFixedToggle",payload:!0}),function(){Ot({type:"globalSetting/headerFixedToggle",payload:!1})}},[]),Object(y.useEffect)(function(){return Ot({type:"globalSetting/headerFooterToggle",payload:Y}),function(){Ot({type:"globalSetting/headerFooterToggle",payload:!0})}},[]),Object(y.useEffect)(function(){if(mt.disciplinesData){var je;rr((mt==null||((je=mt.disciplinesData)===null||je===void 0)?void 0:je.tag_disciplines)||[])}Object(da.V)("\u8BD5\u9898\u5E93")},[mt==null?void 0:mt.disciplinesData]);var Cn=function(Ae,Me){var $e=[];if(!Ae){var st,Ct;mt==null||((st=mt.disciplinesData)===null||st===void 0||((Ct=st.disciplines)===null||Ct===void 0))||Ct.forEach(function(Un){var yr;Un==null||((yr=Un.sub_disciplines)===null||yr===void 0)||yr.forEach(function(Or){var la;Or==null||((la=Or.tag_disciplines)===null||la===void 0)||la.forEach(function(Lr){Lr.name!=="\u672A\u5339\u914D\u77E5\u8BC6\u70B9"&&$e.push(Lr)})})})}if(Ae&&!Me){var pt,Tt,On,An=mt==null||((pt=mt.disciplinesData)===null||pt===void 0||((Tt=pt.disciplines)===null||Tt===void 0))?void 0:Tt.find(function(Un){return Un.id===Ae});An==null||((On=An.sub_disciplines)===null||On===void 0)||On.forEach(function(Un){var yr;Un==null||((yr=Un.tag_disciplines)===null||yr===void 0)||yr.forEach(function(Or){Or.name!=="\u672A\u5339\u914D\u77E5\u8BC6\u70B9"&&$e.push(Or)})})}if(Ae&&Me){var Gr,yn,tr,Nr,ur=mt==null||((Gr=mt.disciplinesData)===null||Gr===void 0||((yn=Gr.disciplines)===null||yn===void 0))?void 0:yn.find(function(Un){return Un.id===Ae}),Yr=ur==null||((tr=ur.sub_disciplines)===null||tr===void 0)?void 0:tr.find(function(Un){return Un.id===Me});Yr==null||((Nr=Yr.tag_disciplines)===null||Nr===void 0)||Nr.forEach(function(Un){Un.name!=="\u672A\u5339\u914D\u77E5\u8BC6\u70B9"&&$e.push(Un)})}return $e},Fn=function(){var je=Object(u.a)(f.a.mark(function Ae(){return f.a.wrap(function($e){for(;;)switch($e.prev=$e.next){case 0:Ot({type:"problemset/getTeachGroupData"});case 1:case"end":return $e.stop()}},Ae)}));return function(){return je.apply(this,arguments)}}();Object(y.useEffect)(function(){var je=mt.basketData||{},Ae=je.completion_questions_count,Me=Ae===void 0?0:Ae,$e=je.judgement_questions_count,st=$e===void 0?0:$e,Ct=je.multiple_questions_count,pt=Ct===void 0?0:Ct,Tt=je.practical_questions_count,On=Tt===void 0?0:Tt,An=je.program_questions_count,Gr=An===void 0?0:An,yn=je.single_questions_count,tr=yn===void 0?0:yn,Nr=je.subjective_questions_count,ur=Nr===void 0?0:Nr,Yr=je.combination_questions_count,Un=Yr===void 0?0:Yr,yr=Me+st+pt+On+Gr+tr+ur+Un;ir(yr)},[mt.basketData]);var qt=function(){var je=Object(u.a)(f.a.mark(function Ae(Me){var $e,st;return f.a.wrap(function(pt){for(;;)switch(pt.prev=pt.next){case 0:return pt.next=2,Ot({type:"problemset/getItemBanks",payload:Me});case 2:$e=pt.sent,$e&&$e.status!==403&&$e.status!==401&&$e.status!==500&&(at($e.items_count||0),Qt($e.items||[]),ri($e.used_shixun_ids||[]),Gn($e.items||[]),ae([]),Fr(($e==null?void 0:$e.navigation)||[]),cn(($e==null?void 0:$e.item_banks_group)||[]),En.current||(hn(($e==null||((st=$e.item_banks_group)===null||st===void 0)?void 0:st.length)>5?1:0),En.current=!1),In(($e==null?void 0:$e.added_num)||0),pn(!1));case 4:case"end":return pt.stop()}},Ae)}));return function(Me){return je.apply(this,arguments)}}(),gn=function(){Ot({type:"problemset/getBasketList",payload:{}})},Gn=function(Ae){var Me=Ae.every(function($e){var st;return((st=$e.program_attr)===null||st===void 0?void 0:st.status)===0});ja.current=Me},hr=function(Ae,Me){if(ge.discipline_id=Ae||"",ge.sub_discipline_id=Me||"",ge.tag_discipline_id="",ge.page=1,ge.per_page=20,delete ge.id,Vn(Ae===null?-1:null),Be(ge),qt(ge),Ae===null){var $e;rr((mt==null||(($e=mt.disciplinesData)===null||$e===void 0)?void 0:$e.tag_disciplines)||[]);return}rr(Cn(Ae,Me))},Sr=function(Ae){ge.item_type=Ae||"",ge.page=1,ge.per_page=20,Be(ge),qt(ge)},Qn=function(Ae){ge.difficulty=Ae||"",ge.page=1,ge.per_page=20,delete ge.id,Be(ge),qt(ge)},wr=function(Ae){if(ge.tag_discipline_id=Ae,ge.page=1,ge.per_page=20,delete ge.id,Ae===-1){var Me;ge.discipline_id="",ge.sub_discipline_id="",ge.tag_discipline_id="",rr((mt==null||((Me=mt.disciplinesData)===null||Me===void 0)?void 0:Me.tag_disciplines)||[])}Vn(Ae),Be(ge),qt(ge)},Kr=function(Ae){ge.discipline_id="",ge.sub_discipline_id="",ge.tag_discipline_id="",ge.item_type=null,ge.difficulty=null,ge.type=Ae,Ae==="0"?ge.group_id=0:ge.group_id=null,ge.page=1,ge.per_page=20,delete ge.id,Vn(-1),_r(Ae),Be(ge),qt(ge)},Dr=function(Ae,Me){ge.page=Ae,ge.per_page=Me,Be(ge),qt(ge)},kr=function(Ae){ge.discipline_id="",ge.sub_discipline_id="",ge.tag_discipline_id="",ge.item_type=null,ge.difficulty=null,ge.page=1,ge.keyword=Ae,delete ge.id,Ca(!!Ae),Vn(-1),Be(ge),qt(ge)},rn=function(){ge.per_page=20,Be(ge),qt(ge)},fr=function(Ae){var Me=Ae.length===vt.length&&ge.page>1?ge.page-1:ge.page;ge.page=Me,ge.per_page=20,gn(),Be(ge),qt(ge)},sr=function(){Ot({type:"problemset/setActionTabs",payload:{key:"Problemset-PublicReview"}})},er=function(){var je=Object(u.a)(f.a.mark(function Ae(Me,$e){var st;return f.a.wrap(function(pt){for(;;)switch(pt.prev=pt.next){case 0:if(!$e){pt.next=6;break}return pt.next=3,Object(B.l)({id:Me});case 3:pt.t0=pt.sent,pt.next=9;break;case 6:return pt.next=8,Object(B.C)({id:Me});case 8:pt.t0=pt.sent;case 9:st=pt.t0,(st==null?void 0:st.status)===0&&rn();case 11:case"end":return pt.stop()}},Ae)}));return function(Me,$e){return je.apply(this,arguments)}}(),Wr=function(){var je=Object(u.a)(f.a.mark(function Ae(Me){return f.a.wrap(function(st){for(;;)switch(st.prev=st.next){case 0:Oa(Me);case 1:case"end":return st.stop()}},Ae)}));return function(Me){return je.apply(this,arguments)}}(),Hr=function(){var je=Object(u.a)(f.a.mark(function Ae(Me){return f.a.wrap(function(st){for(;;)switch(st.prev=st.next){case 0:Sa(Me);case 1:case"end":return st.stop()}},Ae)}));return function(Me){return je.apply(this,arguments)}}(),$r=function(Ae){qr.current="",ia.current="",d.a.confirm({centered:!0,width:530,icon:null,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u8BD5\u9898\u7EA0\u9519",content:t.a.createElement("div",{className:"font14"},t.a.createElement("div",null,"\u9519\u8BEF\u7C7B\u578B\uFF1A"),t.a.createElement(s.a.Group,{className:"mt10",onChange:function($e){return ia.current=$e.target.value}},t.a.createElement(s.a,{value:"\u9898\u5E72"},"\u9898\u5E72"),t.a.createElement(s.a,{value:"\u7B54\u6848"},"\u7B54\u6848"),t.a.createElement(s.a,{value:"\u89E3\u6790"},"\u89E3\u6790"),t.a.createElement(s.a,{value:"\u5C5E\u6027"},"\u5C5E\u6027"),t.a.createElement(s.a,{value:"\u5176\u5B83"},"\u5176\u5B83")),t.a.createElement("div",{className:"mt10"},"\u9519\u8BEF\u63CF\u8FF0\uFF1A"),t.a.createElement(Pn,{className:"mt10",rows:4,defaultValue:qr.current,onChange:function($e){return qr.current=$e.target.value}})),onOk:function(){return new Promise(function(){var $e=Object(u.a)(f.a.mark(function st(Ct,pt){var Tt;return f.a.wrap(function(An){for(;;)switch(An.prev=An.next){case 0:if(ia.current&&qr.current){An.next=3;break}return n.b.info("\u8BF7\u586B\u5199\u9519\u8BEF\u7C7B\u578B\u548C\u9519\u8BEF\u63CF\u8FF0\uFF01"),An.abrupt("return",pt());case 3:return An.next=5,Object(B.m)({id:Ae,clazz:ia.current,description:qr.current});case 5:Tt=An.sent,Tt.status===0&&n.b.info("\u6DFB\u52A0\u6210\u529F\uFF01"),Ct();case 8:case"end":return An.stop()}},st)}));return function(st,Ct){return $e.apply(this,arguments)}}())}})},Ln=function(Ae){Ot({type:"problemset/setActionTabs",payload:{key:"Problemset-SetPrivate",params:{id:Ae}}})},Ir=function(Ae){Ot({type:"problemset/setActionTabs",payload:{key:"Problemset-Delete",params:{id:Ae}}})},Xr=function(){var je=Object(u.a)(f.a.mark(function Ae(Me){var $e,st,Ct,pt;return f.a.wrap(function(On){for(;;)switch(On.prev=On.next){case 0:if($e=Me.item_type,!($e==="PROGRAM")){On.next=12;break}return st=Me.program_attr.identifier,On.next=5,Ot({type:"problemset/startExperience",payload:{id:st}});case 5:if(Ct=On.sent,!(Ct.status===0)){On.next=10;break}return pt=Ct.identifier,Object(da.Q)("/myproblems/".concat(pt)),On.abrupt("return");case 10:return n.b.warn(Ct.message),On.abrupt("return");case 12:Ot({type:"problemset/setActionTabs",payload:{key:$e,params:Me}});case 13:case"end":return On.stop()}},Ae)}));return function(Me){return je.apply(this,arguments)}}(),Mn=function(){var je=Object(u.a)(f.a.mark(function Ae(Me){var $e,st,Ct;return f.a.wrap(function(Tt){for(;;)switch(Tt.prev=Tt.next){case 0:if(!ge.exam_id){Tt.next=6;break}return Tt.next=3,Object(B.I)({item_id:Me,id:ge.exam_id});case 3:return $e=Tt.sent,$e.status===0&&rn(),Tt.abrupt("return");case 6:if(!(ge!=null&&ge.exercise_id)){Tt.next=12;break}return Tt.next=9,Object(dr.a)("/api/exercise_questions/delete_by_item_bank.json ",{method:"post",body:{exercise_id:ge==null?void 0:ge.exercise_id,item_bank_ids:[Me]}});case 9:return st=Tt.sent,st.status===0&&rn(),Tt.abrupt("return");case 12:return Tt.next=14,Ot({type:"problemset/cancel",payload:{id:Me,item_bank:1}});case 14:Ct=Tt.sent,Ct.status===0&&(rn(),gn());case 16:case"end":return Tt.stop()}},Ae)}));return function(Me){return je.apply(this,arguments)}}(),Tn=function(){var je=Object(u.a)(f.a.mark(function Ae(Me){return f.a.wrap(function(st){for(;;)switch(st.prev=st.next){case 0:ge.page=1,ge.per_page=20,ge.group_id=Math.abs(Me),Be(ge),qt(ge);case 5:case"end":return st.stop()}},Ae)}));return function(Me){return je.apply(this,arguments)}}(),lr=function(){var je=Object(u.a)(f.a.mark(function Ae(Me,$e){var st;return f.a.wrap(function(pt){for(;;)switch(pt.prev=pt.next){case 0:if(En.current=!0,pn(!0),!$e){pt.next=8;break}return pt.next=5,Object(B.E)({id:Math.abs(Me)});case 5:pt.t0=pt.sent,pt.next=11;break;case 8:return pt.next=10,Object(B.D)({id:Math.abs(Me)});case 10:pt.t0=pt.sent;case 11:st=pt.t0,st.status===0?rn():(En.current=!1,pn(!1));case 13:case"end":return pt.stop()}},Ae)}));return function(Me,$e){return je.apply(this,arguments)}}(),fa=function(){var je=Object(u.a)(f.a.mark(function Ae(Me){var $e,st,Ct;return f.a.wrap(function(Tt){for(;;)switch(Tt.prev=Tt.next){case 0:if(!ge.exam_id){Tt.next=6;break}return Tt.next=3,Object(B.q)({exam_id:ge.exam_id,item_bank_ids:[Me]});case 3:return $e=Tt.sent,$e.status===0&&rn(),Tt.abrupt("return");case 6:if(!(ge!=null&&ge.exercise_id)){Tt.next=12;break}return Tt.next=9,Object(dr.a)("/api/exercises/".concat(ge==null?void 0:ge.exercise_id,"/select_questions.json"),{method:"post",body:{item_bank_ids:[Me]}});case 9:return st=Tt.sent,st.status===0&&rn(),Tt.abrupt("return");case 12:if(!(Tr===200)){Tt.next=15;break}return n.b.info("\u5DF2\u9009200\u4E2A\u8BD5\u9898\uFF08\u4E0D\u80FD\u5728\u9009\u7528\u66F4\u591A\u8BD5\u9898\uFF09"),Tt.abrupt("return");case 15:return Tt.next=17,Ot({type:"problemset/select",payload:{item_bank_ids:[Me]}});case 17:Ct=Tt.sent,Ct.status===0&&(rn(),gn());case 19:case"end":return Tt.stop()}},Ae)}));return function(Me){return je.apply(this,arguments)}}(),ea=function(){var je=Object(u.a)(f.a.mark(function Ae(Me){return f.a.wrap(function(st){for(;;)switch(st.prev=st.next){case 0:if(Me){st.next=3;break}if(ue!=null&&ue.length){st.next=3;break}return st.abrupt("return",n.b.info("\u8BF7\u5148\u9009\u62E9\u8BD5\u9898"));case 3:cr.current=[0],d.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u79FB\u52A8\u5230",maskClosable:!0,className:"custom-modal-divider",icon:null,content:t.a.createElement("div",{className:"font14 ".concat($.a.overflow),style:{maxHeight:500,overflow:"auto"}},t.a.createElement("p",{className:"c-grey-333"},"\u8BF7\u9009\u62E9\u9700\u8981\u79FB\u52A8\u5230\u7684\u6587\u4EF6\u5939"),t.a.createElement(J.a,{defaultValue:!0,value:cr.current,onChange:function(pt){return cr.current=pt}})),onOk:function(){var Ct=Object(u.a)(f.a.mark(function Tt(){var On,An;return f.a.wrap(function(yn){for(;;)switch(yn.prev=yn.next){case 0:return yn.next=2,Object(B.f)({ids:Me?[Me]:ue,groups_ids:(On=cr.current)===null||On===void 0?void 0:On[0]});case 2:An=yn.sent,cr.current=[],(An==null?void 0:An.status)===0&&rn();case 5:case"end":return yn.stop()}},Tt)}));function pt(){return Ct.apply(this,arguments)}return pt}()});case 5:case"end":return st.stop()}},Ae)}));return function(Me){return je.apply(this,arguments)}}(),Qr=function(){var je=Object(u.a)(f.a.mark(function Ae(Me){var $e,st;return f.a.wrap(function(pt){for(;;)switch(pt.prev=pt.next){case 0:return pt.next=2,Object(B.z)({clazz:"ItemBank",id:Me});case 2:$e=pt.sent,st=($e==null?void 0:$e.groups)||[],cr.current=[],d.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A\u64A4\u9500",cancelText:"\u53D6\u6D88",title:"\u672C\u9898\u5DF2\u5171\u4EAB\u7684\u6559\u7814\u56E2\u961F",maskClosable:!0,icon:null,content:t.a.createElement("div",{className:"font14 ".concat($.a.overflow)},t.a.createElement("p",{className:"c-grey-999"},"\u9009\u4E2D\u5E76\u786E\u5B9A\uFF0C\u5373\u64A4\u9500\u672C\u9898\u5BF9\u9009\u4E2D\u6559\u7814\u56E2\u961F\u7684\u5206\u4EAB"),t.a.createElement(b.a.Group,{className:$.a.checkbox,defaultValue:cr.current,onChange:function(On){return cr.current=On}},st==null?void 0:st.map(function(Tt){return t.a.createElement(b.a,{key:Tt.group_id,value:Tt.group_id},Tt.name)}))),onOk:function(){var Tt=Object(u.a)(f.a.mark(function An(){return f.a.wrap(function(yn){for(;;)switch(yn.prev=yn.next){case 0:return yn.abrupt("return",new Promise(function(){var tr=Object(u.a)(f.a.mark(function Nr(ur,Yr){var Un,yr,Or;return f.a.wrap(function(Lr){for(;;)switch(Lr.prev=Lr.next){case 0:if(cr.current.length){Lr.next=3;break}return n.b.warn("\u8BF7\u9009\u62E9\u9700\u8981\u64A4\u9500\u5171\u4EAB\u7684\u6559\u7814\u56E2\u961F"),Lr.abrupt("return",Yr());case 3:return yr=st==null||((Un=st.map(function(Rn){return Rn.group_id}))===null||Un===void 0)?void 0:Un.filter(function(Rn){return!cr.current.includes(Rn)}),Lr.next=6,Object(B.j)({ids:[Me],clazz:"ItemBank",group_ids:yr});case 6:return Or=Lr.sent,cr.current=[],(Or==null?void 0:Or.status)===0&&(n.b.info("\u64A4\u9500\u5171\u4EAB\u6210\u529F"),rn()),Lr.abrupt("return",ur());case 10:case"end":return Lr.stop()}},Nr)}));return function(Nr,ur){return tr.apply(this,arguments)}}()));case 1:case"end":return yn.stop()}},An)}));function On(){return Tt.apply(this,arguments)}return On}()});case 6:case"end":return pt.stop()}},Ae)}));return function(Me){return je.apply(this,arguments)}}(),Ya=function(Ae){Ot({type:"problemset/setActionTabs",payload:{key:"Problemset-BasketDelete",params:{type:Ae}}})},Qa=function(){Ot({type:"problemset/setActionTabs",payload:{key:"\u65B0\u5EFA\u6587\u4EF6\u5939",params:ge}});return},Ba=function(){var Ae={discipline_id:"&discipline_id=".concat(ge.discipline_id),sub_discipline_id:"&sub_discipline_id=".concat(ge.sub_discipline_id),tag_discipline_id:"&sub_discipline_id=".concat(ge.tag_discipline_id),difficulty:"&difficulty=".concat(ge.difficulty),item_type:"&item_type=".concat(ge.item_type),group_id:"&group_id=".concat(ge.group_id||0)},Me="/problemset/newitem?pages=".concat(ge.page);Object.keys(Ae).forEach(function($e){ge[$e]&&(Me=Me+Ae[$e])}),A.d===null||A.d===void 0||A.d.push(Me)},ta=function(Ae){var Me=ue;if(!(Me!=null&&Me.length))return n.b.info("\u8BF7\u5148\u9009\u62E9\u8BD5\u9898");if(Tr+Me.length>200&&Ae&&Y){n.b.info("\u8BD5\u9898\u7BEE\u4E2D\u6700\u591A\u53EF\u518D\u52A0\u5165".concat(200-Tr,"\u9898\uFF0C\u5F53\u524D\u9009\u4E2D").concat(Me.length,"\u9898\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9"));return}Ae?Ja(Me):Za(Me)},Ja=function(){var je=Object(u.a)(f.a.mark(function Ae(Me){var $e;return f.a.wrap(function(Ct){for(;;)switch(Ct.prev=Ct.next){case 0:$e=Object(C.a)(Me),vt.forEach(function(pt){if($e.includes(pt.id)){var Tt;pt.item_type==="PROGRAM"&&((Tt=pt.program_attr)===null||Tt===void 0?void 0:Tt.status)===0&&Object(xe.remove)($e,function(On){return On===pt.id})}}),d.a.confirm({width:530,title:"\u63D0\u793A",className:"custom-modal-divider ",icon:null,centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:t.a.createElement("div",null,"\u5F53\u524D\u5DF2\u9009\u62E9",Me.length,"\u9053\u8BD5\u9898\uFF0C\u5DF2\u52A0\u5165\u8FC7\u7684\u8BD5\u9898\u6216\u672A\u53D1\u5E03\u7684\u7F16\u7A0B\u9898\u5C06\u4E0D\u4F1A\u91CD\u590D\u52A0\u5165 "),onOk:function(){var pt=Object(u.a)(f.a.mark(function On(){var An;return f.a.wrap(function(yn){for(;;)switch(yn.prev=yn.next){case 0:if(!ge.exam_id){yn.next=6;break}return yn.next=3,Object(B.q)({exam_id:ge.exam_id,item_bank_ids:$e});case 3:An=yn.sent,yn.next=15;break;case 6:if(!(ge!=null&&ge.exercise_id)){yn.next=12;break}return yn.next=9,Object(dr.a)("/api/exercises/".concat(ge==null?void 0:ge.exercise_id,"/select_questions.json"),{method:"post",body:{item_bank_ids:$e}});case 9:An=yn.sent,yn.next=15;break;case 12:return yn.next=14,Ot({type:"problemset/select",payload:{item_bank_ids:$e}});case 14:An=yn.sent;case 15:An.status===0&&(rn(),gn());case 16:case"end":return yn.stop()}},On)}));function Tt(){return pt.apply(this,arguments)}return Tt}()});case 3:case"end":return Ct.stop()}},Ae)}));return function(Me){return je.apply(this,arguments)}}(),Za=function(){var je=Object(u.a)(f.a.mark(function Ae(Me){var $e;return f.a.wrap(function(Ct){for(;;)switch(Ct.prev=Ct.next){case 0:if(!ge.exam_id){Ct.next=6;break}return Ct.next=3,Object(dr.a)("/api/examination_banks/".concat(ge.exam_id,"/batch_revoke_item.json"),{method:"post",body:{item_ids:Me}});case 3:$e=Ct.sent,Ct.next=15;break;case 6:if(!(ge!=null&&ge.exercise_id)){Ct.next=12;break}return Ct.next=9,Object(dr.a)("/api/exercise_questions/delete_by_item_bank.json ",{method:"post",body:{exercise_id:ge==null?void 0:ge.exercise_id,item_bank_ids:Me}});case 9:$e=Ct.sent,Ct.next=15;break;case 12:return Ct.next=14,Ot({type:"problemset/unselectAll",payload:{item_ids:Me}});case 14:$e=Ct.sent;case 15:$e.status===0&&(rn(),gn());case 16:case"end":return Ct.stop()}},Ae)}));return function(Me){return je.apply(this,arguments)}}(),Fa=function(){var je=Object(u.a)(f.a.mark(function Ae(Me){var $e;return f.a.wrap(function(Ct){for(;;)switch(Ct.prev=Ct.next){case 0:if(!(Y&&Tr===200)){Ct.next=3;break}return n.b.info("\u5DF2\u9009200\u4E2A\u8BD5\u9898\uFF08\u4E0D\u80FD\u5728\u9009\u7528\u66F4\u591A\u8BD5\u9898\uFF09"),Ct.abrupt("return");case 3:if(!ge.exam_id){Ct.next=10;break}return Ct.next=6,Object(B.q)({exam_id:ge.exam_id,shixun_ids:Me});case 6:$e=Ct.sent,$e.status===0&&rn(),Ct.next=14;break;case 10:return Ct.next=12,Ot({type:"problemset/select",payload:{shixun_ids:Me}});case 12:$e=Ct.sent,$e.status===0&&(gn(),rn());case 14:case"end":return Ct.stop()}},Ae)}));return function(Me){return je.apply(this,arguments)}}(),qa=function(){Ot({type:"classroomList/setActionTabs",payload:{key:"\u9009\u7528\u5B9E\u8DF5\u9879\u76EE"}})},Sa=function(Ae){var Me,$e,st,Ct;if(!(ue!=null&&ue.length)&&!Ae){Ot({type:"problemset/setActionTabs",payload:{key:"\u5171\u4EAB\u8BD5\u9898",params:ge}});return}if(!((Me=mt.teachGroupData)!==null&&Me!==void 0&&($e=Me.groups)!==null&&$e!==void 0&&$e.length))return n.b.info("\u60A8\u6682\u672A\u521B\u5EFA\u6216\u52A0\u5165\u4EFB\u4F55\u6559\u7814\u56E2\u961F\uFF0C\u8BF7\u524D\u5F80\u201C\u6211\u7684\u4E2A\u4EBA\u4E2D\u5FC3-\u6559\u7814\u56E2\u961F\u201D\u67E5\u770B");d.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u5171\u4EAB\u81F3\u6559\u7814\u56E2\u961F",maskClosable:!0,icon:null,content:t.a.createElement("div",{className:"font14 ".concat($.a.overflow)},t.a.createElement(b.a.Group,{className:$.a.checkbox,defaultValue:cr.current,onChange:function(Tt){return cr.current=Tt}},(st=mt.teachGroupData)===null||st===void 0||((Ct=st.groups)===null||Ct===void 0)?void 0:Ct.map(function(pt){return t.a.createElement(b.a,{key:pt.group_id,value:pt.group_id},pt.name)}))),onOk:function(){return new Promise(function(){var Tt=Object(u.a)(f.a.mark(function On(An,Gr){var yn,tr;return f.a.wrap(function(ur){for(;;)switch(ur.prev=ur.next){case 0:if((yn=cr.current)!==null&&yn!==void 0&&yn.length){ur.next=3;break}return n.b.info("\u8BF7\u5148\u9009\u62E9\u6559\u7814\u56E2\u961F"),ur.abrupt("return",Gr());case 3:return ur.next=5,Object(B.j)({ids:Ae?[Ae]:ue,clazz:"ItemBank",group_ids:cr.current});case 5:tr=ur.sent,(tr==null?void 0:tr.status)===0&&(n.b.info("\u6240\u9009\u8BD5\u9898\u6210\u529F\u5206\u4EAB\u81F3\u6559\u7814\u56E2\u961F"),cr.current=[],ae([]),rn(),An());case 7:case"end":return ur.stop()}},On)}));return function(On,An){return Tt.apply(this,arguments)}}())}})},Ka=function(){var Ae=function(){var Me=Object(u.a)(f.a.mark(function $e(){var st;return f.a.wrap(function(pt){for(;;)switch(pt.prev=pt.next){case 0:return ar(!0),pt.next=3,Object(B.h)({ids:ue});case 3:st=pt.sent,ar(!1),(st==null?void 0:st.status)===0&&d.a.info({centered:!0,width:530,className:"custom-modal-divider ",okText:"\u786E\u5B9A",title:"\u5220\u9664\u7ED3\u679C",maskClosable:!1,keyboard:!1,icon:null,content:"\u672C\u6B21\u6210\u529F\u5220\u9664".concat(st.success,"\u6761\u8BD5\u9898\uFF0C\u6709").concat(st.fail,"\u6761\u8BD5\u9898\u56E0\u4E3A\u516C\u5F00\u65E0\u6CD5\u5220\u9664\uFF0C\u8BF7\u64A4\u9500\u540E\u518D\u8FDB\u884C\u5220\u9664\u3002"),onOk:function(){fr(new Array(st.success))}});case 6:case"end":return pt.stop()}},$e)}));return function(){return Me.apply(this,arguments)}}();if(ue!=null&&ue.length){d.a.confirm({centered:!0,width:530,className:"custom-modal-divider ",okText:"\u786E\u5B9A",title:"\u63D0\u793A",cancelText:"\u53D6\u6D88",icon:null,content:"\u672C\u6B21\u9009\u4E2D\u4E86".concat(ue==null?void 0:ue.length,"\u6761\u8BD5\u9898\u8FDB\u884C\u5220\u9664\u64CD\u4F5C\uFF0C\u5220\u9664\u540E\u5C06\u65E0\u6CD5\u6062\u590D\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u5220\u9664\uFF1F"),onOk:Ae});return}n.b.warn("\u8BF7\u9009\u62E9\u9700\u8981\u5220\u9664\u7684\u8BD5\u9898")},wa=function(){var Ae,Me;if(!(ue!=null&&ue.length))return n.b.info("\u8BF7\u5148\u9009\u62E9\u8BD5\u9898");if(vt!=null&&(Ae=vt.filter(function($e){return ue.includes($e.id)}))!==null&&Ae!==void 0&&Ae.every(function($e){return $e.public}))return n.b.info("\u6240\u9009\u8BD5\u9898\u5DF2\u516C\u5F00\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9");if(vt!=null&&(Me=vt.filter(function($e){return ue.includes($e.id)}))!==null&&Me!==void 0&&Me.find(function($e){var st;return $e.item_type==="PROGRAM"&&((st=$e.program_attr)===null||st===void 0?void 0:st.status)===0}))return n.b.info("\u5DF2\u9009\u9898\u4E2D\u5B58\u5728\u672A\u53D1\u5E03\u7684\u7F16\u7A0B\u9898");window.localStorage.getItem("problemset-set-public-hint-flag")==="1"||Rt.userInfo.professional_certification?Oa():d.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u516C\u5F00\u89C4\u5219\u544A\u77E5",maskClosable:!0,icon:null,content:t.a.createElement("div",{className:"font16 c-grey-333"},"\u516C\u5F00\u5E76\u7ECF\u5E73\u53F0\u5BA1\u6838\u540E\uFF0C\u8BE5\u9898\u5C06\u5728\u516C\u5171\u8BD5\u9898\u5E93\u53EF\u89C1\uFF0CEducoder\u6240\u6709\u7528\u6237\u5747\u53EF\u4F7F\u7528\u8BE5\u9898\u3002",t.a.createElement("br",null),"\u516C\u5F00\u540E\u4E0D\u53EF\u4FEE\u6539\uFF0C\u4F46\u53EF\u4EE5\u64A4\u9500\uFF1B\u64A4\u9500\u516C\u5F00\u540E\u53EF\u4EE5\u4FEE\u6539\u3002",t.a.createElement("br",null),"\u662F\u5426\u786E\u8BA4\u7533\u8BF7\u516C\u5F00\uFF1F",t.a.createElement("br",null),t.a.createElement(b.a,{className:"mt10",defaultChecked:!1,onChange:function(st){return G.current=st.target.checked}},"\u4E0D\u518D\u63D0\u793A")),onOk:function(){Oa()}})},Oa=function(){var je=Object(u.a)(f.a.mark(function Ae(Me){var $e,st;return f.a.wrap(function(pt){for(;;)switch(pt.prev=pt.next){case 0:return $e=zt==="3"?1:2,pt.next=3,Object(B.g)({ids:Me?[Me]:ue,source:$e});case 3:st=pt.sent,st.status===0&&(G.current&&window.localStorage.setItem("problemset-set-public-hint-flag","1"),G.current=!1,ae([]),rn());case 5:case"end":return pt.stop()}},Ae)}));return function(Me){return je.apply(this,arguments)}}(),Ra=function(Ae){d.a.confirm({centered:!0,icon:null,title:"\u63D0\u793A",className:"custom-modal-divider",content:t.a.createElement(t.a.Fragment,null,t.a.createElement("div",{className:$.a.modalContent},"\u53D1\u5E03\u540E\u5373\u53EF\u5E94\u7528\u5230\u81EA\u5DF1\u7BA1\u7406\u7684\u8BFE\u5802"),t.a.createElement("div",{className:$.a.modalContent}," \u662F\u5426\u786E\u8BA4\u53D1\u5E03?")),okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",onOk:function(){var Me=Object(u.a)(f.a.mark(function st(){var Ct;return f.a.wrap(function(Tt){for(;;)switch(Tt.prev=Tt.next){case 0:return Tt.next=2,Object(B.H)({identifier:Ae});case 2:Ct=Tt.sent,(Ct==null?void 0:Ct.status)===0&&(n.b.success("\u53D1\u5E03\u6210\u529F"),rn());case 4:case"end":return Tt.stop()}},st)}));function $e(){return Me.apply(this,arguments)}return $e}()})},na=function(Ae){d.a.confirm({centered:!0,icon:null,title:"\u63D0\u793A",className:"custom-modal-divider",content:t.a.createElement("p",{className:$.a.modalContent},"\u662F\u5426\u786E\u8BA4\u64A4\u9500\u53D1\u5E03\uFF1F"),okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",onOk:function(){var Me=Object(u.a)(f.a.mark(function st(){var Ct;return f.a.wrap(function(Tt){for(;;)switch(Tt.prev=Tt.next){case 0:return Tt.next=2,Object(B.G)({identifier:Ae});case 2:Ct=Tt.sent,(Ct==null?void 0:Ct.status)===0&&(n.b.success("\u64A4\u9500\u53D1\u5E03\u6210\u529F"),rn());case 4:case"end":return Tt.stop()}},st)}));function $e(){return Me.apply(this,arguments)}return $e}()})},Wa=function(Ae){ge.page=1,ge.group_id=Ae[0]||null,delete ge.id,Be(ge),qt(ge)},oa=function(Ae){ge.sort_by=Ae.type,ge.sort_direction=Ae.direction,ge.page=1,ge.per_page=20,Yt(Ae.name),Be(ge),qt(ge)},sa=function(){ge.page=1,Be(ge),qt(ge)},Pa=function(Ae){ge.discipline_id="",ge.sub_discipline_id="",ge.tag_discipline_id="",ge.item_type=null,ge.difficulty=null,ge.page=1,ge.per_page=20,ge.group_id=Ae,Vn(-1),Be(ge),qt(ge)},Ha=function(){if(!(ue!=null&&ue.length)){Ot({type:"problemset/setActionTabs",payload:{key:"\u5BFC\u51FA\u8BD5\u9898",params:ge}});return}d.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u5BFC\u51FA\u63D0\u793A",maskClosable:!0,icon:null,content:t.a.createElement("div",{className:"font14 ".concat($.a.overflow)},"\u5DF2\u9009\u4E2D",ue==null?void 0:ue.length,"\u9053\u9898\uFF0C\u5176\u4E2D\u7F16\u7A0B\u9898\u4E0E\u5B9E\u8BAD\u9898\u6682\u4E0D\u652F\u6301\u5BFC\u51FA\u3002"),onOk:function(){Object(V.k)({ids:ue})}})},ai=t.a.createElement(O.a,null,Ie&&t.a.createElement(O.a.Item,{onClick:function(){return ta(!0)}},"\u6279\u91CF\u52A0\u5165"),Ie&&t.a.createElement(O.a.Item,{onClick:function(){return ta(!1)}},"\u6279\u91CF\u79FB\u51FA"),zt==="0"&&Y&&t.a.createElement(O.a.Item,{onClick:function(){return ea()}},"\u79FB\u52A8\u5230"),zt==="0"&&Y&&t.a.createElement(O.a.Item,{onClick:wa},"\u6279\u91CF\u516C\u5F00"),zt==="0"&&Y&&t.a.createElement(O.a.Item,{onClick:function(){return Sa()}},"\u6279\u91CF\u5171\u4EAB"),zt==="0"&&Y&&t.a.createElement(O.a.Item,{onClick:Ka},"\u6279\u91CF\u5220\u9664")),Ga=function(Ae){ae(Ae)},pa=function(Ae){ae(Ae?vt==null?void 0:vt.map(function(Me){return Me.id}):[])},za=function(){var Ae="/problemset/preview";if(ge.exam_id&&(Ae="/paperlibrary/edit/".concat(ge.exam_id)),ge!=null&&ge.exercise_id){var Me;Ae="/classrooms/".concat(At==null||((Me=At.params)===null||Me===void 0)?void 0:Me.coursesId,"/exercise/").concat(ge==null?void 0:ge.exercise_id,"/edit")}A.d.push(Ae)},ma=[{type:"SINGLE",name:"\u5355\u9009\u9898"},{type:"MULTIPLE",name:"\u591A\u9009\u9898"},{type:"JUDGMENT",name:"\u5224\u65AD\u9898"},{type:"PROGRAM",name:"\u7F16\u7A0B\u9898"},{type:"SUBJECTIVE",name:"\u7B80\u7B54\u9898"},{type:"COMPLETION",name:"\u586B\u7A7A\u9898"},{type:"COMBINATION",name:"\u7EC4\u5408\u9898"}],va={1:"\u7B80\u5355",2:"\u9002\u4E2D",3:"\u56F0\u96BE"},Aa=function(Ae,Me){var $e,st=Me.id<0?"--":Ie?Me[ge.exercise_id?"added":"choosed"]?t.a.createElement("span",{key:1,className:$.a.btnCancel,onClick:function(Tt){Tt.target.style.pointerEvents="none",Mn(Me.id)}},Y?"\u79FB\u51FA\u8BD5\u9898\u7BEE":t.a.createElement("span",null,t.a.createElement("b",{className:"iconfont icon-yichu ".concat($.a.cancelC)}),"\u79FB\u51FA")):Me.item_type==="PROGRAM"&&(($e=Me.program_attr)===null||$e===void 0?void 0:$e.status)===0?t.a.createElement(_.a,{placement:"top",title:"\u7F16\u7A0B\u9898\u672A\u53D1\u5E03\uFF0C\u4E0D\u80FD\u52A0\u5165\uFF01"},t.a.createElement("span",{className:$.a.btnAdd,style:{cursor:"not-allowed",background:"#E3E6EC",color:"#B1BACD"}}," ",Y?"\u52A0\u5165\u8BD5\u9898\u7BEE":t.a.createElement("span",{style:{padding:"0 3px"}},t.a.createElement("b",{className:"iconfont icon-jiaru ".concat($.a.addC)}),"\u52A0\u5165")," ")):t.a.createElement("span",{className:$.a.btnAdd,onClick:function(){return fa(Me.id)}},Y?"\u52A0\u5165\u8BD5\u9898\u7BEE":t.a.createElement("span",{style:{padding:"0 3px"}},t.a.createElement("b",{className:"iconfont icon-jiaru ".concat($.a.addC)}),"\u52A0\u5165")):t.a.createElement(t.a.Fragment,null),Ct=t.a.createElement("span",{className:$.a.actonBtn},st,Me.id>0&&t.a.createElement(Vr,{isProblemset:Y,user:Rt,key:Me.id,data:Me,activeTabsKey:zt,selectIds:ue,onCollect:er,onSetPublic:Wr,onStartExperience:Xr,onCorrection:$r,onPublicReview:sr,onSetPrivate:Ln,onDelete:Ir,onCancel:Mn,onSelect:fa,onMoveTo:ea,onSetShare:Hr,onCancelShare:Qr,onPublish:Ra,onCancelPublish:na}));return Ct},ii=[{title:zt==="0"?"\u6587\u4EF6\u5939/\u9898\u76EE":"\u9898\u76EE",dataIndex:"name",key:"name",align:"left",render:function(Ae,Me){return Me.id>0?t.a.createElement(br,{isProblemset:Y,user:Rt,key:Me.id,data:Me,activeTabsKey:zt,selectIds:ue,onCollect:er,onSetPublic:Wr,onStartExperience:Xr,onCorrection:$r,onPublicReview:sr,onSetPrivate:Ln,onDelete:Ir,onCancel:Mn,onSelect:fa,onMoveTo:ea,onSetShare:Hr,onCancelShare:Qr,onPublish:Ra,onCancelPublish:na}):t.a.createElement(Ar,{isProblemset:Y,onRenameOk:rn,onDeleteOk:fr,user:Rt,key:Me.id,data:Me,onOpen:Tn,onMove:lr})}},{title:"\u9898\u578B",dataIndex:"item_type",key:"item_type",align:"center",width:60,render:function(Ae){var Me;return t.a.createElement("div",null,((Me=ma.find(function($e){return $e.type===Ae}))===null||Me===void 0?void 0:Me.name)||"--")}},{title:"\u96BE\u6613\u5EA6",dataIndex:"difficulty",key:"difficulty",align:"center",width:60,render:function(Ae,Me){return t.a.createElement("span",null,(Me==null?void 0:Me.id)<0?"--":va[Ae])}},{title:"\u4F7F\u7528\u6B21\u6570",dataIndex:"quotes",key:"quotes",align:"center",ellipsis:!0,width:80,render:function(Ae,Me){return t.a.createElement("span",null,(Me==null?void 0:Me.id)<0?"--":Ae)}},{title:"\u521B\u5EFA\u8005",dataIndex:"author",key:"author",ellipsis:!0,align:"center",width:94,render:function(Ae){return t.a.createElement("span",null,Ae==null?void 0:Ae.name)}},{title:"\u77E5\u8BC6\u70B9",dataIndex:"tag_discipline",key:"tag_discipline",align:"center",width:146,render:function(Ae){return t.a.createElement("span",null,Ae||"--")}},{title:"\u66F4\u65B0\u65F6\u95F4",dataIndex:"updated_at",key:"updated_at",align:"center",width:146,render:function(Ae,Me){return t.a.createElement("span",null,(Me==null?void 0:Me.id)<0?"--":Ae)}},{title:"\u64CD\u4F5C",dataIndex:"choosed",key:"choosed",align:"center",width:146,render:Aa}];return t.a.createElement(y.Fragment,null,t.a.createElement("section",null,t.a.createElement("div",{className:$.a.wrap},t.a.createElement("div",{className:$.a.title},"\u8BD5\u9898\u5E93"),t.a.createElement(U.a,{showSelectAll:!1,className:$.a.select,disciplinesData:(Ut=mt.disciplinesData)===null||Ut===void 0?void 0:Ut.disciplines,knowledgeData:jn,directionValue:ge.discipline_id,subDisciplineValue:ge.sub_discipline_id,typeValue:ge.item_type,showKnowledge:!0,knowledgeValue:zn,difficultyValue:ge.difficulty,showShixun:!Object(Lt.m)()&&!ge.exercise_id,onShixunChange:qa,onDirectionChange:hr,onTypeChange:Sr,onDifficultyChange:Qn,onKnowledgeChange:wr}),t.a.createElement("div",{className:$.a.contentWrap},t.a.createElement("div",{className:$.a.tabsWrap},t.a.createElement(i.a,{activeKey:zt,onChange:Kr,tabBarExtraContent:t.a.createElement("div",{className:$.a.searchWrap},zt==="0"&&Y&&t.a.createElement("div",{className:$.a.searchContent},t.a.createElement(T.a,{type:"primary",ghost:!0,onClick:Qa,className:"mr20"},t.a.createElement("i",{className:"iconfont icon-xinjianwenjianjia mr5 font14"}),"\u65B0\u5EFA\u6587\u4EF6\u5939"),t.a.createElement(T.a,{type:"primary",className:"mr30",ghost:!0,onClick:Ba},t.a.createElement("i",{className:"iconfont icon-xinzengshiti2 mr5 font14"}),"\u65B0\u589E\u8BD5\u9898")),t.a.createElement(Jt,{allowClear:!0,className:$.a.search,style:{width:300},placeholder:"\u8BF7\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22",value:ge.keyword,onChange:function(Ae){ge.keyword=Ae.target.value,Be(Object(I.a)({},ge))},onSearch:kr}))},t.a.createElement(Xe,{tab:"\u516C\u5171",key:"1"}),((kt=mt.teachGroupData)===null||kt===void 0||((wt=kt.groups)===null||wt===void 0)?void 0:wt.length)&&t.a.createElement(Xe,{tab:"\u6559\u7814\u5171\u4EAB",key:"3"}),!Object(Lt.o)()&&!Object(Lt.m)()&&t.a.createElement(Xe,{tab:"\u6536\u85CF\u5939",key:"2"}),t.a.createElement(Xe,{tab:"\u6211\u521B\u5EFA\u7684",key:"0"}))),t.a.createElement("div",{className:$.a.batchWrap},t.a.createElement("div",{style:{flex:1,display:"flex",alignItems:"center"}},t.a.createElement("div",{className:"font14"},t.a.createElement(R.a,{overlay:t.a.createElement(O.a,{selectedKeys:[ct]},Mt==null?void 0:Mt.map(function(je,Ae){return t.a.createElement(O.a.Item,{key:je.name,onClick:function(){return oa(je)}},je.name)}))},t.a.createElement("span",{style:{color:"#464F66"}},t.a.createElement("i",{className:"iconfont icon-paixu font14 mr5 c-light-primary"}),ct))),zt==="3"&&t.a.createElement("div",{style:{paddingTop:20,marginLeft:20}},t.a.createElement(ya,{dispatch:Ot,problemset:mt,groupIds:ge.group_id?[ge.group_id]:[],onChangeTeachGroup:Wa}))),t.a.createElement("div",null,zt==="0"&&Y&&t.a.createElement(T.a,{onClick:Ha,type:"link"},t.a.createElement("i",{className:"iconfont icon-daochushiti mr5 c-light-primary"}),t.a.createElement("span",{className:"c-light-primary"},"\u5BFC\u51FA\u8BD5\u9898")))),Ua?t.a.createElement("div",null,t.a.createElement(T.a,{style:{paddingLeft:0,marginLeft:25},onClick:function(){ge.page=1,ge.keyword=null,delete ge.id,Be(ge),Ca(!1),qt(ge)},type:"link"}," ",t.a.createElement("i",{className:"iconfont icon-fanhui2 font14"}),"\u8FD4\u56DE"),t.a.createElement("span",{className:"font14 mr20 c-grey-333"},"\u641C\u7D22\u201C",ge.keyword,"\u201D")):zt==="0"?t.a.createElement("div",{style:{overflow:"hidden",height:mn===1?208:"auto"},ref:Xn,className:$.a.treeWarp},t.a.createElement(fe,{data:Cr,onClick:Tn}),t.a.createElement(N.a,{spinning:vn},sn==null?void 0:sn.map(function(je){return t.a.createElement(Ar,{isProblemset:Y,onRenameOk:function(){En.current=!0,rn()},onDeleteOk:function(){En.current=!0,rn()},user:Rt,key:je.id,data:je,onOpen:Tn,onMove:lr})})),!!mn&&t.a.createElement("div",{className:$.a.action},mn===1&&t.a.createElement("span",{onClick:function(){return hn(2)}},"\u5C55\u5F00",t.a.createElement("i",{className:"iconfont icon-xiala"})),mn===2&&t.a.createElement("span",{onClick:function(){return hn(1)}},"\u6536\u8D77",t.a.createElement("i",{style:{transform:"scale(0.5) rotate(180deg) translateY(2px)"},className:"iconfont icon-xiala"})))):null,t.a.createElement("div",{className:$.a.contentListWrap},dt!==0?t.a.createElement(N.a,{size:"large",spinning:Kt["problemset/getItemBanks"]},vt.map(function(je,Ae){var Me,$e;return t.a.createElement("div",{className:$.a.li},t.a.createElement("div",{className:$.a.top},t.a.createElement(br,{isProblemset:Y,user:Rt,key:je.id,data:je,activeTabsKey:zt,selectIds:ue,onCollect:er,onSetPublic:Wr,onStartExperience:Xr,onCorrection:$r,onPublicReview:sr,onSetPrivate:Ln,onDelete:Ir,onCancel:Mn,onSelect:fa,onSelectCheckBox:Ga,onMoveTo:ea,onSetShare:Hr,onCancelShare:Qr,onPublish:Ra,onCancelPublish:na})),t.a.createElement("div",{className:$.a.bottom},t.a.createElement("p",{className:$.a.actionLeftItem},(Me=ma.find(function(st){return st.type===je.item_type}))===null||Me===void 0?void 0:Me.name),t.a.createElement("i",{className:$.a.line}),t.a.createElement("p",{className:$.a.actionLeftItem},va[je.difficulty]),t.a.createElement("i",{className:$.a.line}),t.a.createElement("p",{className:$.a.actionLeftItem},"\u521B\u5EFA\u8005:",t.a.createElement("span",{className:"c-grey-333"},je==null||(($e=je.author)===null||$e===void 0)?void 0:$e.name)),t.a.createElement("i",{className:$.a.line}),t.a.createElement("p",{className:$.a.actionLeftItem},"\u66F4\u65B0:",t.a.createElement("span",{className:"c-grey-333"},je==null?void 0:je.updated_at)),t.a.createElement("i",{className:$.a.line}),t.a.createElement("p",{className:$.a.actionLeftItem},"\u4F7F\u7528\u6B21\u6570:",t.a.createElement("span",{className:"c-grey-333"},je==null?void 0:je.quotes)),t.a.createElement("div",{className:$.a.more},Aa({},je))))})):t.a.createElement(N.a,{size:"large",spinning:Kt["problemset/getItemBanks"]},t.a.createElement(ie.a,null))),dt!==0&&t.a.createElement(j.a,{showSizeChanger:dt>20,showQuickJumper:!0,onChange:Dr,defaultCurrent:1,pageSize:ge==null?void 0:ge.per_page,current:ge.page||1,total:dt,showTotal:function(Ae){return t.a.createElement("span",{className:"mr10"},"\u5171",t.a.createElement("span",{className:"c-orange"},Ae),"\u6761\u6570\u636E")}})),Y&&t.a.createElement(fn,{basketData:mt.basketData,visible:aa,basketTotal:Tr,onClose:function(){return Na(!1)},onDelete:Ya}),!Object(Lt.m)()&&Y&&t.a.createElement(on,{visibleBasket:aa,onToggleVisible:function(){return Na(!aa)},count:Tr})),t.a.createElement(ee,null),t.a.createElement(Fe,{onReloadData:rn}),t.a.createElement(Ne,{onReloadData:function(){return fr([null])}}),t.a.createElement(Sn,{onReloadData:rn,onReloadBasketData:gn}),t.a.createElement(Nt,{shixunIds:Xa,cb:Fa}),t.a.createElement(lt,null),t.a.createElement(bt,null),t.a.createElement(ut,null),t.a.createElement(Et,null),t.a.createElement(ke,null),t.a.createElement(Le,{onOk:sa}),t.a.createElement(re,{onOk:Pa})),Y?t.a.createElement(y.Fragment,null,!!(ue!=null&&ue.length)&&t.a.createElement("div",{className:$.a.batch},t.a.createElement("aside",null,t.a.createElement("div",{style:{flexShrink:0,marginRight:20}},t.a.createElement(b.a,{className:"font14",checked:vt!=null&&vt.length?ue.length===(vt==null?void 0:vt.length):!1,onChange:function(Ae){return pa(Ae.target.checked)}},"\u672C\u9875\u5168\u9009",t.a.createElement("span",{style:{color:"#999",fontSize:12}},"/\u5DF2\u9009(",ue==null?void 0:ue.length,")"))),t.a.createElement("div",{className:$.a.btns},Ie&&t.a.createElement("div",{className:$.a.btn,onClick:function(){return ta(!0)}},t.a.createElement("i",{className:"iconfont icon-piliangjiaru"}),"\u6279\u91CF\u52A0\u5165"),Ie&&t.a.createElement("div",{className:$.a.btn,onClick:function(){return ta(!1)}},t.a.createElement("i",{className:"iconfont icon-piliangyichu"}),"\u6279\u91CF\u79FB\u51FA"),zt==="0"&&t.a.createElement("div",{className:$.a.btn,onClick:function(){return ea()}},t.a.createElement("i",{className:"iconfont icon-yidongmulu font16"}),"\u6279\u91CF\u79FB\u52A8"),zt==="0"&&t.a.createElement("div",{className:$.a.btn,onClick:wa}," ",t.a.createElement("i",{className:"iconfont icon-pilianggongkai"}),"\u6279\u91CF\u516C\u5F00"),zt==="0"&&t.a.createElement("div",{className:$.a.btn,onClick:function(){return Sa()}}," ",t.a.createElement("i",{className:"iconfont icon-pilianggongxiang"}),"\u6279\u91CF\u5171\u4EAB"),zt==="0"&&t.a.createElement("div",{className:$.a.btn,onClick:Ka}," ",t.a.createElement("i",{className:"iconfont icon-piliangshanchu3 c-red"}),"\u6279\u91CF\u5220\u9664"),t.a.createElement("div",{onClick:function(){return ae([])},style:{marginLeft:"auto"},className:$.a.btn}," ",t.a.createElement("i",{className:"iconfont icon-piliangcaozuoicon2"}),"\u53D6\u6D88\u64CD\u4F5C"))))):t.a.createElement("div",{className:$.a.batch},t.a.createElement("aside",null,t.a.createElement("div",{style:{flexShrink:0,marginRight:20}},t.a.createElement(b.a,{className:"font14",checked:vt!=null&&vt.length?ue.length===(vt==null?void 0:vt.length):!1,onChange:function(Ae){return pa(Ae.target.checked)}},"\u672C\u9875\u5168\u9009",t.a.createElement("span",{style:{color:"#999",fontSize:12}},"/\u5DF2\u9009(",ue==null?void 0:ue.length,")"))),t.a.createElement("div",{className:$.a.btns},Ie&&!!(ue!=null&&ue.length)&&t.a.createElement("div",{className:$.a.btn,onClick:function(){return ta(!0)}},t.a.createElement("i",{className:"iconfont icon-piliangjiaru"}),"\u6279\u91CF\u52A0\u5165"),Ie&&!!(ue!=null&&ue.length)&&t.a.createElement("div",{className:$.a.btn,onClick:function(){return ta(!1)}},t.a.createElement("i",{className:"iconfont icon-piliangyichu"}),"\u6279\u91CF\u79FB\u51FA"),t.a.createElement("div",{className:"c-grey-333 font12 mr40",style:{marginLeft:"auto"}},"\u5DF2\u52A0\u5165:\xA0\xA0",xt,"\u9898"),t.a.createElement("div",{onClick:za,className:$.a.btn},"\u8FD4\u56DE\u8BD5\u5377")))))},jr=Ye.default=Object(A.a)(function(Dt){var Re=Dt.problemset,rt=Dt.user,Ve=Dt.loading,Qe=Dt.globalSetting;return{problemset:Re,user:rt,globalSetting:Qe,loading:Ve.effects}})(Bn)},LdHM:function(Pt,Ye,W){"use strict";W.d(Ye,"b",function(){return s}),W.d(Ye,"a",function(){return d});var Ee=W("1OyB"),j=W("vuIU"),w=W("Ji7U"),N=W("LK+K"),E=W("q1tI"),R=W("rePB"),I=W("Ff2n"),M=W("ODXe"),T=W("4IlW"),P=W("bX4T"),_=W("YrtM"),S=W("TSYQ"),O=W.n(S),C=W("+nKL"),x=W("8OUc"),b=function(B,Z){var re=B.prefixCls,ie=B.id,ve=B.flattenOptions,de=B.childrenAsData,q=B.values,ee=B.searchValue,pe=B.multiple,Q=B.defaultActiveFirstOption,V=B.height,Ce=B.itemHeight,ke=B.notFoundContent,Ue=B.open,we=B.menuItemSelectedIcon,De=B.virtual,Oe=B.onSelect,Le=B.onToggleOpen,Ke=B.onActiveValue,Fe=B.onScroll,He=B.onMouseEnter,Ne="".concat(re,"-item"),xe=Object(_.a)(function(){return ve},[Ue,ve],function(it,ye){return ye[0]&&it[1]!==ye[1]}),Ge=E.useRef(null),qe=function(ye){ye.preventDefault()},lt=function(ye){Ge.current&&Ge.current.scrollTo({index:ye})},ot=function(ye){for(var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,fe=xe.length,X=0;X<fe;X+=1){var $=(ye+X*he+fe)%fe,te=xe[$],oe=te.group,Te=te.data;if(!oe&&!Te.disabled)return $}return-1},bt=E.useState(function(){return ot(0)}),ht=Object(M.a)(bt,2),ut=ht[0],Ze=ht[1],Et=function(ye){Ze(ye);var he=xe[ye];if(!he){Ke(null,-1);return}Ke(he.data.value,ye)};E.useEffect(function(){Et(Q!==!1?ot(0):-1)},[xe.length,ee]),E.useEffect(function(){var it=setTimeout(function(){if(!pe&&Ue&&q.size===1){var ye=Array.from(q)[0],he=xe.findIndex(function(fe){var X=fe.data;return X.value===ye});Et(he),lt(he)}});return function(){return clearTimeout(it)}},[Ue]);var St=function(ye){ye!==void 0&&Oe(ye,{selected:!q.has(ye)}),pe||Le(!1)};if(E.useImperativeHandle(Z,function(){return{onKeyDown:function(ye){var he=ye.which;switch(he){case T.a.UP:case T.a.DOWN:{var fe=0;if(he===T.a.UP?fe=-1:he===T.a.DOWN&&(fe=1),fe!==0){var X=ot(ut+fe,fe);lt(X),Et(X)}break}case T.a.ENTER:{var $=xe[ut];$&&!$.data.disabled?St($.data.value):St(void 0),Ue&&ye.preventDefault();break}case T.a.ESC:Le(!1)}},onKeyUp:function(){},scrollTo:function(ye){lt(ye)}}}),xe.length===0)return E.createElement("div",{role:"listbox",id:"".concat(ie,"_list"),className:"".concat(Ne,"-empty"),onMouseDown:qe},ke);function We(it){var ye=xe[it];if(!ye)return null;var he=ye.data||{},fe=he.value,X=he.label,$=he.children,te=Object(P.a)(he,!0),oe=de?$:X;return ye?E.createElement("div",Object.assign({"aria-label":typeof oe=="string"?oe:null},te,{key:it,role:"option",id:"".concat(ie,"_list_").concat(it),"aria-selected":q.has(fe)}),fe):null}return E.createElement(E.Fragment,null,E.createElement("div",{role:"listbox",id:"".concat(ie,"_list"),style:{height:0,width:0,overflow:"hidden"}},We(ut-1),We(ut),We(ut+1)),E.createElement(C.a,{itemKey:"key",ref:Ge,data:xe,height:V,itemHeight:Ce,fullHeight:!1,onMouseDown:qe,onScroll:Fe,virtual:De,onMouseEnter:He},function(it,ye){var he,fe=it.group,X=it.groupOption,$=it.data,te=$.label,oe=$.key;if(fe)return E.createElement("div",{className:O()(Ne,"".concat(Ne,"-group"))},te!==void 0?te:oe);var Te=$.disabled,Pe=$.value,Je=$.title,Wt=$.children,Zt=$.style,Xt=$.className,an=Object(I.a)($,["disabled","value","title","children","style","className"]),fn=q.has(Pe),It="".concat(Ne,"-option"),Kn=O()(Ne,It,Xt,(he={},Object(R.a)(he,"".concat(It,"-grouped"),X),Object(R.a)(he,"".concat(It,"-active"),ut===ye&&!Te),Object(R.a)(he,"".concat(It,"-disabled"),Te),Object(R.a)(he,"".concat(It,"-selected"),fn),he)),Sn=de?Wt:te,Jn=!we||typeof we=="function"||fn;return E.createElement("div",Object.assign({},an,{"aria-selected":fn,className:Kn,title:Je,onMouseMove:function(){if(ut===ye||Te)return;Et(ye)},onClick:function(){Te||St(Pe)},style:Zt}),E.createElement("div",{className:"".concat(It,"-content")},Sn||Pe),E.isValidElement(we)||fn,Jn&&E.createElement(x.a,{className:"".concat(Ne,"-option-state"),customizeIcon:we,customizeIconProps:{isSelected:fn}},fn?"\u2713":null))}))},p=E.forwardRef(b);p.displayName="OptionList";var n=p,l=function(){return null};l.isSelectOption=!0;var s=l,g=function(){return null};g.isSelectOptGroup=!0;var d=g,u=W("VTBJ"),m=W("Zm9Q");function h(J){var B=J.key,Z=J.props,re=Z.children,ie=Z.value,ve=Object(I.a)(Z,["children","value"]);return Object(u.a)({key:B,value:ie!==void 0?ie:B,children:re},ve)}function a(J){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(m.a)(J).map(function(Z,re){if(!E.isValidElement(Z)||!Z.type)return null;var ie=Z.type.isSelectOptGroup,ve=Z.key,de=Z.props,q=de.children,ee=Object(I.a)(de,["children"]);return B||!ie?h(Z):Object(u.a)(Object(u.a)({key:"__RC_SELECT_GRP__".concat(ve===null?re:ve,"__"),label:ve},ee),{},{options:a(q)})}).filter(function(Z){return Z})}var r=W("2Qr1"),e=W("qNPg"),i=W("U8pU"),v=W("Kwbf"),f=W("WKfj");function y(J){var B=J.mode,Z=J.options,re=J.children,ie=J.backfill,ve=J.allowClear,de=J.placeholder,q=J.getInputElement,ee=J.showSearch,pe=J.onSearch,Q=J.defaultOpen,V=J.autoFocus,Ce=J.labelInValue,ke=J.value,Ue=J.inputValue,we=J.optionLabelProp,De=B==="multiple"||B==="tags",Oe=ee!==void 0?ee:De||B==="combobox",Le=Z||a(re);if(Object(v.a)(B!=="tags"||Le.every(function(Ne){return!Ne.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),B==="tags"||B==="combobox"){var Ke=Le.some(function(Ne){return Ne.options?Ne.options.some(function(xe){return typeof("value"in xe?xe.value:xe.key)=="number"}):typeof("value"in Ne?Ne.value:Ne.key)=="number"});Object(v.a)(!Ke,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(v.a)(B!=="combobox"||!we,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(v.a)(B==="combobox"||!ie,"`backfill` only works with `combobox` mode."),Object(v.a)(B==="combobox"||!q,"`getInputElement` only work with `combobox` mode."),Object(v.b)(B!=="combobox"||!q||!ve||!de,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),pe&&!Oe&&B!=="combobox"&&B!=="tags"&&Object(v.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(v.b)(!Q||V,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ke!=null){var Fe=Object(f.d)(ke);Object(v.a)(!Ce||Fe.every(function(Ne){return Object(i.a)(Ne)==="object"&&("key"in Ne||"value"in Ne)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(v.a)(!De||Array.isArray(ke),"`value` should be array when `mode` is `multiple` or `tags`")}if(re){var He=null;Object(m.a)(re).some(function(Ne){if(!E.isValidElement(Ne)||!Ne.type)return!1;var xe=Ne.type;if(xe.isSelectOption)return!1;if(xe.isSelectOptGroup){var Ge=Object(m.a)(Ne.props.children).every(function(qe){return!E.isValidElement(qe)||!Ne.type||qe.type.isSelectOption?!0:(He=qe.type,!1)});return!Ge}return He=xe,!0}),He&&Object(v.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(He.displayName||He.name||He,"`.")),Object(v.a)(Ue===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var t=y,A=Object(e.a)({prefixCls:"rc-select",components:{optionList:n},convertChildrenToData:a,flattenOptions:r.d,getLabeledValue:r.e,filterOptions:r.b,isValueDisabled:r.g,findValueOption:r.c,warningProps:t,fillOptionsWithMissingValue:r.a}),U=function(J){Object(w.a)(Z,J);var B=Object(N.a)(Z);function Z(){var re;return Object(Ee.a)(this,Z),re=B.apply(this,arguments),re.selectRef=E.createRef(),re.focus=function(){re.selectRef.current.focus()},re.blur=function(){re.selectRef.current.blur()},re}return Object(j.a)(Z,[{key:"render",value:function(){return E.createElement(A,Object.assign({ref:this.selectRef},this.props))}}]),Z}(E.Component);U.Option=s,U.OptGroup=d;var F=U,H=Ye.c=F},NLgs:function(Pt,Ye,W){"use strict";W.d(Ye,"e",function(){return g}),W.d(Ye,"f",function(){return d}),W.d(Ye,"d",function(){return m}),W.d(Ye,"c",function(){return h}),W.d(Ye,"a",function(){return a}),W.d(Ye,"b",function(){return r});var Ee=W("miYZ"),j=W("tsqr"),w=W("9og8"),N=W("2qtc"),E=W("kLXV"),R=W("WmNS"),I=W.n(R),M=W("q1tI"),T=W.n(M),P=W("9kvl"),_=W("xKgJ"),S=W("1vsH"),O=W("RCxd"),C=W("mOS8"),x=W.n(C),b=W("1ZF9"),p=W.n(b),n=W("WdTA"),l=W.n(n),s=W("m3rI"),g=function(i){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!!(d(i)&&u(v))},d=function(i){return Object(_.p)()?!0:(i({type:"user/showPopLogin",payload:{showPopLogin:!0,showClosable:!0}}),!1)},u=function(){var i,v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,f=Object(P.c)()._store.getState(),y=f.user;return(i=y.userInfo)!==null&&i!==void 0&&i.profile_completed?!0:(E.a.confirm({title:"\u63D0\u793A",width:530,centered:!0,content:v?"\u6309\u7167\u6709\u5173\u653F\u7B56\u89C4\u5B9A\uFF0C\u7279\u6B8A\u5B9E\u9A8C\u9700\u8981\u5148\u7ED1\u5B9A\u624B\u673A\u53F7\u624D\u80FD\u4F7F\u7528\uFF0C\u8BF7\u5148\u7ED1\u5B9A\u624B\u673A\u53F7\u7801":"\u60A8\u9700\u8981\u53BB\u5B8C\u5584\u60A8\u7684\u4E2A\u4EBA\u8D44\u6599\uFF0C\u624D\u80FD\u4F7F\u7528\u6B64\u529F\u80FD",okText:"\u7ACB\u5373\u5B8C\u5584",cancelText:"\u7A0D\u540E\u5B8C\u5584",onOk:function(){P.d.push("/account/profile/edit")}}),!1)},m=function(){var i,v=Object(P.c)()._store.getState(),f=v.user;return(i=f.userInfo)!==null&&i!==void 0&&i.professional_certification?!0:(E.a.confirm({title:"\u63D0\u793A",centered:!0,content:T.a.createElement("div",{className:"tc"},"\u60A8\u9700\u8981\u53BB\u5B8C\u6210\u60A8\u7684\u804C\u4E1A\u8BA4\u8BC1\uFF0C\u624D\u80FD\u4F7F\u7528\u6B64\u529F\u80FD"),okText:"\u7ACB\u5373\u5B8C\u5584",cancelText:"\u7A0D\u540E\u5B8C\u5584",onOk:function(){Object(S.Q)("/account/certification")}}),!1)},h=function(){return Object(_.a)()?!0:(E.a.warning({centered:!0,width:530,title:"\u63D0\u793A",content:T.a.createElement("div",{className:"tc",style:{marginLeft:-38}},T.a.createElement("p",null,"\u60A8\u53EF\u4EE5\u626B\u7801\u52A0\u7FA4@\u7FA4\u7BA1\u7406\u5458\uFF0C\u7533\u8BF7\u64CD\u4F5C\u6743\u9650\u54E6\uFF01"),T.a.createElement("img",{src:Object(_.t)()?l.a:"".concat(s.a.IMG_SERVER,"/images/educoder/qqqun20191230.png"),width:200})),okText:"\u6211\u77E5\u9053\u4E86",maskClosable:!0}),!1)},a=function(i,v){return i?!0:(E.a.confirm({centered:!0,zIndex:1e4,width:530,title:"\u63D0\u793A",content:T.a.createElement("div",null,T.a.createElement("p",null,v||"\u8BE5\u5B9E\u8DF5\u8D44\u6E90\u9700\u6388\u6743\u540E\u624D\u53EF\u4F7F\u7528\u3002 \u60A8\u53EF\u4EE5\u5728QQ\u670D\u52A1\u7FA4\u5411\u7BA1\u7406\u5458\u7533\u8BF7\uFF0C\u83B7\u5F97\u7EE7\u7EED\u64CD\u4F5C\u7684\u6743\u9650\u3002"),T.a.createElement("div",{style:{marginLeft:"110px"}},T.a.createElement("img",{src:p.a,width:200}),T.a.createElement("div",{style:{marginLeft:"35px"}},"\u7FA4\u53F7\uFF1A","714336072"))),okText:"\u7ACB\u5373\u8054\u7CFB",cancelText:"\u53D6\u6D88",onOk:function(){Object(S.Q)("https://qm.qq.com/cgi-bin/qm/qr?k=tIyDPXUtE0yEk-MOJxhH55lTUJS-nYAM&jump_from=webapi")}}),!1)},r=function(i){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",f=Object(P.c)()._store.getState(),y=f.shixunsDetail.detail;return(y==null?void 0:y.public)===2||(y==null?void 0:y.public)===1||(y==null?void 0:y.shixun_status)===3?(E.a.info({centered:!0,icon:T.a.createElement(O.a,{style:{color:"#faad14"}}),width:460,title:"\u63D0\u793A",content:T.a.createElement("div",{className:"tc",style:{marginLeft:-38}},T.a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",paddingLeft:38,margin:"12px 0"}},T.a.createElement("span",null,"\u8BE5\u5B9E\u8DF5\u9879\u76EE\u7684\u72B6\u6001\u4E3A",(y==null?void 0:y.public)===2?"\u5DF2\u516C\u5F00":(y==null?void 0:y.public)===1?"\u5F85\u5BA1\u6838":"\u5DF2\u5173\u95ED","\uFF0C",v,"\u3002"),T.a.createElement("p",null,"\u5982\u6709\u9700\u8981\uFF0C\u8BF7\u8054\u7CFB\u5E73\u53F0\u7BA1\u7406\u5458\u8FDB\u884C\u6280\u672F\u652F\u6301\u3002")),T.a.createElement("img",{style:{border:"4px solid #0152d9",borderRadius:"4px"},src:x.a,alt:"\u4E8C\u7EF4\u7801",width:160})),okText:"\u6211\u77E5\u9053\u4E86"}),!0):(y==null?void 0:y.shixun_status)===2?(E.a.confirm({centered:!0,icon:T.a.createElement(O.a,null),title:"\u63D0\u793A",content:T.a.createElement("div",null,T.a.createElement("span",null,"\u8BE5\u5B9E\u8DF5\u9879\u76EE\u5DF2\u53D1\u5E03\uFF0C",v,"\u3002"),T.a.createElement("br",null),T.a.createElement("span",null,"\u5982\u6709\u9700\u8981\uFF0C\u60A8\u53EF\u4EE5\u64A4\u9500\u53D1\u5E03\u540E\uFF0C\u518D\u8FDB\u884C\u64CD\u4F5C\u3002")),okText:"\u64A4\u9500\u53D1\u5E03",cancelText:"\u53D6\u6D88",onOk:function(){E.a.confirm({width:440,centered:!0,icon:T.a.createElement(O.a,{style:{color:"#faad14"}}),title:"\u63D0\u793A",content:"\u64A4\u9500\u53D1\u5E03\u540E\uFF0C\u5B66\u5458\u5C06\u65E0\u6CD5\u8FDB\u884C\u7EC3\u4E60\u3002\u662F\u5426\u786E\u8BA4\u64A4\u9500\u53D1\u5E03\uFF1F",okText:"\u786E\u5B9A\u64A4\u9500\u53D1\u5E03",cancelText:"\u53D6\u6D88",onOk:function(){var A=Object(w.a)(I.a.mark(function F(){var H;return I.a.wrap(function(B){for(;;)switch(B.prev=B.next){case 0:return B.next=2,i({type:"shixunsDetail/cancelRelease",payload:{id:y==null?void 0:y.identifier}});case 2:H=B.sent,H.status!==401&&(j.b.success("\u64A4\u9500\u53D1\u5E03\u6210\u529F\u3002\u5B9E\u8BAD\u56DE\u5230\u672A\u53D1\u5E03\u7684\u72B6\u6001\u3002"),i({type:"shixunsDetail/getShixunsDetail",payload:{id:y==null?void 0:y.identifier}}),i({type:"practiceSetting/getCommonData",payload:{id:y==null?void 0:y.identifier}}));case 4:case"end":return B.stop()}},F)}));function U(){return A.apply(this,arguments)}return U}()})}}),!0):!1}},NvD2:function(Pt,Ye,W){"use strict";W.d(Ye,"a",function(){return R});var Ee=W("Kwbf");function j(I,M){var T=new Set;return I.forEach(function(P){M.has(P)||T.add(P)}),T}function w(I){var M=I||{},T=M.disabled,P=M.disableCheckbox,_=M.checkable;return!!(T||P)||_===!1}function N(I,M,T,P){for(var _=new Set(I),S=new Set,O=0;O<=T;O+=1){var C=M.get(O)||new Set;C.forEach(function(n){var l=n.key,s=n.node,g=n.children,d=g===void 0?[]:g;_.has(l)&&!P(s)&&d.filter(function(u){return!P(u.node)}).forEach(function(u){_.add(u.key)})})}for(var x=new Set,b=T;b>=0;b-=1){var p=M.get(b)||new Set;p.forEach(function(n){var l=n.parent,s=n.node;if(P(s)||!n.parent||x.has(n.parent.key))return;if(P(n.parent.node)){x.add(l.key);return}var g=!0,d=!1;(l.children||[]).filter(function(u){return!P(u.node)}).forEach(function(u){var m=u.key,h=_.has(m);g&&!h&&(g=!1),!d&&(h||S.has(m))&&(d=!0)}),g&&_.add(l.key),d&&S.add(l.key),x.add(l.key)})}return{checkedKeys:Array.from(_),halfCheckedKeys:Array.from(j(S,_))}}function E(I,M,T,P,_){for(var S=new Set(I),O=new Set(M),C=0;C<=P;C+=1){var x=T.get(C)||new Set;x.forEach(function(l){var s=l.key,g=l.node,d=l.children,u=d===void 0?[]:d;!S.has(s)&&!O.has(s)&&!_(g)&&u.filter(function(m){return!_(m.node)}).forEach(function(m){S.delete(m.key)})})}O=new Set;for(var b=new Set,p=P;p>=0;p-=1){var n=T.get(p)||new Set;n.forEach(function(l){var s=l.parent,g=l.node;if(_(g)||!l.parent||b.has(l.parent.key))return;if(_(l.parent.node)){b.add(s.key);return}var d=!0,u=!1;(s.children||[]).filter(function(m){return!_(m.node)}).forEach(function(m){var h=m.key,a=S.has(h);d&&!a&&(d=!1),!u&&(a||O.has(h))&&(u=!0)}),d||S.delete(s.key),u&&O.add(s.key),b.add(s.key)})}return{checkedKeys:Array.from(S),halfCheckedKeys:Array.from(j(O,S))}}function R(I,M,T,P){var _=[],S;P?S=P:S=w;var O=new Set(I.filter(function(p){var n=!!T[p];return n||_.push(p),n})),C=new Map,x=0;Object.keys(T).forEach(function(p){var n=T[p],l=n.level,s=C.get(l);s||(s=new Set,C.set(l,s)),s.add(n),x=Math.max(x,l)}),Object(Ee.a)(!_.length,"Tree missing follow keys: ".concat(_.slice(0,100).map(function(p){return"'".concat(p,"'")}).join(", ")));var b;return M===!0?b=N(O,C,x,S):b=E(O,M.halfCheckedKeys,C,x,S),b}},OZM5:function(Pt,Ye,W){"use strict";W.d(Ye,"b",function(){return P}),W.d(Ye,"a",function(){return _}),W.d(Ye,"k",function(){return S}),W.d(Ye,"h",function(){return O}),W.d(Ye,"i",function(){return C}),W.d(Ye,"g",function(){return x}),W.d(Ye,"c",function(){return b}),W.d(Ye,"d",function(){return p}),W.d(Ye,"j",function(){return s}),W.d(Ye,"e",function(){return g}),W.d(Ye,"f",function(){return d});var Ee=W("KQm4"),j=W("U8pU"),w=W("Ff2n"),N=W("q1tI"),E=W.n(N),R=W("Kwbf"),I=W("WaYH"),M=.25,T=2;function P(u,m){var h=u.slice(),a=h.indexOf(m);return a>=0&&h.splice(a,1),h}function _(u,m){var h=u.slice();return h.indexOf(m)===-1&&h.push(m),h}function S(u){return u.split("-")}function O(u,m){return"".concat(u,"-").concat(m)}function C(u){return u&&u.type&&u.type.isTreeNode}function x(u,m){var h=[u],a=m[u];function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];e.forEach(function(i){var v=i.key,f=i.children;h.push(v),r(f)})}return r(a.children),h}function b(u,m){var h=u.clientY,a=m.selectHandle.getBoundingClientRect(),r=a.top,e=a.bottom,i=a.height,v=Math.max(i*M,T);return h<=r+v?-1:h>=e-v?1:0}function p(u,m){if(!u)return;var h=m.multiple;return h?u.slice():u.length?[u[0]]:u}var n=function(m){return m};function l(u,m){if(!u)return[];var h=m||{},a=h.processProps,r=a===void 0?n:a,e=Array.isArray(u)?u:[u];return e.map(function(i){var v=i.children,f=Object(w.a)(i,["children"]),y=l(v,m);return E.a.createElement(I.a,Object.assign({},r(f)),y)})}function s(u){if(!u)return null;var m;if(Array.isArray(u))m={checkedKeys:u,halfCheckedKeys:void 0};else if(Object(j.a)(u)==="object")m={checkedKeys:u.checked||void 0,halfCheckedKeys:u.halfChecked||void 0};else return Object(R.a)(!1,"`checkedKeys` is not an array or an object"),null;return m}function g(u,m){var h=new Set;function a(r){if(h.has(r))return;var e=m[r];if(!e)return;h.add(r);var i=e.parent,v=e.node;if(v.disabled)return;i&&a(i.key)}return(u||[]).forEach(function(r){a(r)}),Object(Ee.a)(h)}function d(u){var m={};return Object.keys(u).forEach(function(h){(h.startsWith("data-")||h.startsWith("aria-"))&&(m[h]=u[h])}),m}},"P/tu":function(Pt,Ye,W){"use strict";var Ee=W("ozfa"),j=W("MJZm"),w=W("0Owb"),N=W("9og8"),E=W("tJVT"),R=W("PpiC"),I=W("WmNS"),M=W.n(I),T=W("q1tI"),P=W.n(T),_=W("WCUW"),S=W("spXi"),O=W.n(S),C=function(b){var p=b.value,n=b.onChange,l=b.defaultValue,s=b.disabled,g=Object(R.a)(b,["value","onChange","defaultValue","disabled"]),d=Object(T.useState)([]),u=Object(E.a)(d,2),m=u[0],h=u[1],a=Object(T.useState)("1"),r=Object(E.a)(a,2),e=r[0],i=r[1];Object(T.useEffect)(function(){v()},[]);var v=function(){var t=Object(N.a)(M.a.mark(function A(){var U,F;return M.a.wrap(function(J){for(;;)switch(J.prev=J.next){case 0:return J.next=2,Object(_.x)({});case 2:U=J.sent,U!=null&&U.data&&(F=[{title:P.a.createElement("div",{title:"\u6839\u76EE\u5F55",className:O.a.name},"\u6839\u76EE\u5F55"),value:0,key:0,icon:P.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:f(U.data||[])}],h(F),i("2"));case 4:case"end":return J.stop()}},A)}));return function(){return t.apply(this,arguments)}}(),f=function(A){function U(F){var H=F.children,J=Array.isArray(H)&&H.length>0,B=F==null?void 0:F.group_id;return{title:P.a.createElement("div",{title:F==null?void 0:F.name,className:O.a.name},F==null?void 0:F.name),value:B,key:B,icon:P.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:J?H==null?void 0:H.map(function(Z){return U(Z)}):[]}}return A==null?void 0:A.map(function(F){return U(F)})},y=l?{defaultExpandedKeys:[0]}:{selectedKeys:p,defaultExpandedKeys:p};return P.a.createElement("div",{className:O.a.customTree},P.a.createElement(j.a,Object(w.a)({key:e},y,{showIcon:!0,treeData:m,onSelect:n,disabled:s},g)))};Ye.a=C},Q0Vu:function(Pt,Ye,W){Pt.exports={flex_box_center:"flex_box_center___3fHaw",flex_space_between:"flex_space_between___1tu3K",flex_box_vertical_center:"flex_box_vertical_center___3kmTT",flex_box_center_end:"flex_box_center_end___19OcD",flex_box_column:"flex_box_column___1aMoy",main:"main___JkLSb",wrap:"wrap___1k_Ib",content:"content___1by-P",name:"name___2mlTd",directionContentWrap:"directionContentWrap___3qsxQ",directionItem:"directionItem___2aAvu",active:"active___ACZqb",subActive:"subActive___2RkoB",subItem:"subItem___3tJgX",subMenu:"subMenu___Y_7S_",action:"action___xqgFs"}},SJMd:function(Pt,Ye){/**
* @license
* Copyright (C) 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var W,Ee,j,w=!1,N,E;window.PR_SHOULD_USE_CONTINUATION=!0;var R,I;(function(){var M=window,T=["break,continue,do,else,for,if,return,while"],P=[T,"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"],_=[P,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],S=[_,"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"],O=[_,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],C=[_,"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"],x="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",b=[_,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],p="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",n=[T,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],l=[T,"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"],s=[T,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],g=[S,C,O,b,p,n,l,s],d=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,u="str",m="kwd",h="com",a="typ",r="lit",e="pun",i="pln",v="tag",f="dec",y="src",t="atn",A="atv",U="nocode",F="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function H(Oe){for(var Le=0,Ke=!1,Fe=!1,He=0,Ne=Oe.length;He<Ne;++He){var xe=Oe[He];if(xe.ignoreCase)Fe=!0;else if(/[a-z]/i.test(xe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ke=!0,Fe=!1;break}}var Ge={b:8,t:9,n:10,v:11,f:12,r:13};function qe(ut){var Ze=ut.charCodeAt(0);if(Ze!==92)return Ze;var Et=ut.charAt(1);return Ze=Ge[Et],Ze||("0"<=Et&&Et<="7"?parseInt(ut.substring(1),8):Et==="u"||Et==="x"?parseInt(ut.substring(2),16):ut.charCodeAt(1))}function lt(ut){if(ut<32)return(ut<16?"\\x0":"\\x")+ut.toString(16);var Ze=String.fromCharCode(ut);return Ze==="\\"||Ze==="-"||Ze==="]"||Ze==="^"?"\\"+Ze:Ze}function ot(ut){var Ze=ut.substring(1,ut.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")),Et=[],St=Ze[0]==="^",We=["["];St&&We.push("^");for(var it=St?1:0,ye=Ze.length;it<ye;++it){var he=Ze[it];if(/\\[bdsw]/i.test(he))We.push(he);else{var fe=qe(he),X;it+2<ye&&Ze[it+1]==="-"?(X=qe(Ze[it+2]),it+=2):X=fe,Et.push([fe,X]),X<65||fe>122||(X<65||fe>90||Et.push([Math.max(65,fe)|32,Math.min(X,90)|32]),X<97||fe>122||Et.push([Math.max(97,fe)&~32,Math.min(X,122)&~32]))}}Et.sort(function(Te,Pe){return Te[0]-Pe[0]||Pe[1]-Te[1]});for(var $=[],te=[],it=0;it<Et.length;++it){var oe=Et[it];oe[0]<=te[1]+1?te[1]=Math.max(te[1],oe[1]):$.push(te=oe)}for(var it=0;it<$.length;++it){var oe=$[it];We.push(lt(oe[0])),oe[1]>oe[0]&&(oe[1]+1>oe[0]&&We.push("-"),We.push(lt(oe[1])))}return We.push("]"),We.join("")}function bt(ut){for(var Ze=ut.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")),Et=Ze.length,St=[],We=0,it=0;We<Et;++We){var ye=Ze[We];if(ye==="(")++it;else if(ye.charAt(0)==="\\"){var he=+ye.substring(1);he&&(he<=it?St[he]=-1:Ze[We]=lt(he))}}for(var We=1;We<St.length;++We)St[We]===-1&&(St[We]=++Le);for(var We=0,it=0;We<Et;++We){var ye=Ze[We];if(ye==="(")++it,St[it]||(Ze[We]="(?:");else if(ye.charAt(0)==="\\"){var he=+ye.substring(1);he&&he<=it&&(Ze[We]="\\"+St[he])}}for(var We=0;We<Et;++We)Ze[We]==="^"&&Ze[We+1]!=="^"&&(Ze[We]="");if(ut.ignoreCase&&Ke)for(var We=0;We<Et;++We){var ye=Ze[We],fe=ye.charAt(0);ye.length>=2&&fe==="["?Ze[We]=ot(ye):fe!=="\\"&&(Ze[We]=ye.replace(/[a-zA-Z]/g,function(te){var oe=te.charCodeAt(0);return"["+String.fromCharCode(oe&~32,oe|32)+"]"}))}return Ze.join("")}for(var ht=[],He=0,Ne=Oe.length;He<Ne;++He){var xe=Oe[He];if(xe.global||xe.multiline)throw new Error(""+xe);ht.push("(?:"+bt(xe)+")")}return new RegExp(ht.join("|"),Fe?"gi":"g")}function J(Oe,Le){var Ke=/(?:^|\s)nocode(?:\s|$)/,Fe=[],He=0,Ne=[],xe=0;function Ge(qe){var lt=qe.nodeType;if(lt==1){if(Ke.test(qe.className))return;for(var ot=qe.firstChild;ot;ot=ot.nextSibling)Ge(ot);var bt=qe.nodeName.toLowerCase();(bt==="br"||bt==="li")&&(Fe[xe]=`
`,Ne[xe<<1]=He++,Ne[xe++<<1|1]=qe)}else if(lt==3||lt==4){var ht=qe.nodeValue;ht.length&&(Le?ht=ht.replace(/\r\n?/g,`
`):ht=ht.replace(/[ \t\r\n]+/g," "),Fe[xe]=ht,Ne[xe<<1]=He,He+=ht.length,Ne[xe++<<1|1]=qe)}}return Ge(Oe),{sourceCode:Fe.join("").replace(/\n$/,""),spans:Ne}}function B(Oe,Le,Ke,Fe,He){if(!Ke)return;var Ne={sourceNode:Oe,pre:1,langExtension:null,numberLines:null,sourceCode:Ke,spans:null,basePos:Le,decorations:null};Fe(Ne),He.push.apply(He,Ne.decorations)}var Z=/\S/;function re(Oe){for(var Le=void 0,Ke=Oe.firstChild;Ke;Ke=Ke.nextSibling){var Fe=Ke.nodeType;Le=Fe===1?Le?Oe:Ke:Fe===3&&Z.test(Ke.nodeValue)?Oe:Le}return Le===Oe?void 0:Le}function ie(Oe,Le){var Ke={},Fe;(function(){for(var xe=Oe.concat(Le),Ge=[],qe={},lt=0,ot=xe.length;lt<ot;++lt){var bt=xe[lt],ht=bt[3];if(ht)for(var ut=ht.length;--ut>=0;)Ke[ht.charAt(ut)]=bt;var Ze=bt[1],Et=""+Ze;qe.hasOwnProperty(Et)||(Ge.push(Ze),qe[Et]=null)}Ge.push(/[\0-\uffff]/),Fe=H(Ge)})();var He=Le.length,Ne=function(xe){for(var Ge=xe.sourceCode,qe=xe.basePos,lt=xe.sourceNode,ot=[qe,i],bt=0,ht=Ge.match(Fe)||[],ut={},Ze=0,Et=ht.length;Ze<Et;++Ze){var St=ht[Ze],We=ut[St],it=void 0,ye;if(typeof We=="string")ye=!1;else{var he=Ke[St.charAt(0)];if(he)it=St.match(he[1]),We=he[0];else{for(var fe=0;fe<He;++fe)if(he=Le[fe],it=St.match(he[1]),it){We=he[0];break}it||(We=i)}ye=We.length>=5&&We.substring(0,5)==="lang-",ye&&!(it&&typeof it[1]=="string")&&(ye=!1,We=y),ye||(ut[St]=We)}var X=bt;if(bt+=St.length,!ye)ot.push(qe+X,We);else{var $=it[1],te=St.indexOf($),oe=te+$.length;it[2]&&(oe=St.length-it[2].length,te=oe-$.length);var Te=We.substring(5);B(lt,qe+X,St.substring(0,te),Ne,ot),B(lt,qe+X+te,$,V(Te,$),ot),B(lt,qe+X+oe,St.substring(oe),Ne,ot)}}xe.decorations=ot};return Ne}function ve(Oe){var Le=[],Ke=[];Oe.tripleQuotedStrings?Le.push([u,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Oe.multiLineStrings?Le.push([u,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Le.push([u,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Oe.verbatimStrings&&Ke.push([u,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Fe=Oe.hashComments;Fe&&(Oe.cStyleComments?(Fe>1?Le.push([h,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Le.push([h,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ke.push([u,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Le.push([h,/^#[^\r\n]*/,null,"#"])),Oe.cStyleComments&&(Ke.push([h,/^\/\/[^\r\n]*/,null]),Ke.push([h,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var He=Oe.regexLiterals;if(He){var Ne=He>1?"":`
\r`,xe=Ne?".":"[\\S\\s]",Ge="/(?=[^/*"+Ne+"])(?:[^/\\x5B\\x5C"+Ne+"]|\\x5C"+xe+"|\\x5B(?:[^\\x5C\\x5D"+Ne+"]|\\x5C"+xe+")*(?:\\x5D|$))+/";Ke.push(["lang-regex",RegExp("^"+F+"("+Ge+")")])}var qe=Oe.types;qe&&Ke.push([a,qe]);var lt=(""+Oe.keywords).replace(/^ | $/g,"");lt.length&&Ke.push([m,new RegExp("^(?:"+lt.replace(/[\s,]+/g,"|")+")\\b"),null]),Le.push([i,/^\s+/,null,` \r
\xA0`]);var ot="^.[^\\s\\w.$@'\"`/\\\\]*";return Oe.regexLiterals&&(ot+="(?!s*/)"),Ke.push([r,/^@[a-z_$][a-z_$@0-9]*/i,null],[a,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[i,/^[a-z_$][a-z_$@0-9]*/i,null],[r,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[i,/^\\[\s\S]?/,null],[e,new RegExp(ot),null]),ie(Le,Ke)}var de=ve({keywords:g,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function q(Oe,Le,Ke){for(var Fe=/(?:^|\s)nocode(?:\s|$)/,He=/\r\n?|\n/,Ne=Oe.ownerDocument,xe=Ne.createElement("li");Oe.firstChild;)xe.appendChild(Oe.firstChild);var Ge=[xe];function qe(Ze){var Et=Ze.nodeType;if(Et==1&&!Fe.test(Ze.className))if(Ze.nodeName==="br")lt(Ze),Ze.parentNode&&Ze.parentNode.removeChild(Ze);else for(var St=Ze.firstChild;St;St=St.nextSibling)qe(St);else if((Et==3||Et==4)&&Ke){var We=Ze.nodeValue,it=We.match(He);if(it){var ye=We.substring(0,it.index);Ze.nodeValue=ye;var he=We.substring(it.index+it[0].length);if(he){var fe=Ze.parentNode;fe.insertBefore(Ne.createTextNode(he),Ze.nextSibling)}lt(Ze),ye||Ze.parentNode.removeChild(Ze)}}}function lt(Ze){for(;!Ze.nextSibling;)if(Ze=Ze.parentNode,!Ze)return;function Et(it,ye){var he=ye?it.cloneNode(!1):it,fe=it.parentNode;if(fe){var X=Et(fe,1),$=it.nextSibling;X.appendChild(he);for(var te=$;te;te=$)$=te.nextSibling,X.appendChild(te)}return he}for(var St=Et(Ze.nextSibling,0),We;(We=St.parentNode)&&We.nodeType===1;)St=We;Ge.push(St)}for(var ot=0;ot<Ge.length;++ot)qe(Ge[ot]);Le===(Le|0)&&Ge[0].setAttribute("value",Le);var bt=Ne.createElement("ol");bt.className="linenums";for(var ht=Math.max(0,Le-1|0)||0,ot=0,ut=Ge.length;ot<ut;++ot)xe=Ge[ot],xe.className="L"+(ot+ht)%10,xe.firstChild||xe.appendChild(Ne.createTextNode("\xA0")),bt.appendChild(xe);Oe.appendChild(bt)}function ee(Oe){var Le=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Le=Le&&+Le[1]<=8;var Ke=/\n/g,Fe=Oe.sourceCode,He=Fe.length,Ne=0,xe=Oe.spans,Ge=xe.length,qe=0,lt=Oe.decorations,ot=lt.length,bt=0;lt[ot]=He;var ht,ut;for(ut=ht=0;ut<ot;)lt[ut]!==lt[ut+2]?(lt[ht++]=lt[ut++],lt[ht++]=lt[ut++]):ut+=2;for(ot=ht,ut=ht=0;ut<ot;){for(var Ze=lt[ut],Et=lt[ut+1],St=ut+2;St+2<=ot&&lt[St+1]===Et;)St+=2;lt[ht++]=Ze,lt[ht++]=Et,ut=St}ot=lt.length=ht;var We=Oe.sourceNode,it="";We&&(it=We.style.display,We.style.display="none");try{for(var ye=null;qe<Ge;){var he=xe[qe],fe=xe[qe+2]||He,X=lt[bt+2]||He,St=Math.min(fe,X),$=xe[qe+1],te;if($.nodeType!==1&&(te=Fe.substring(Ne,St))){Le&&(te=te.replace(Ke,"\r")),$.nodeValue=te;var oe=$.ownerDocument,Te=oe.createElement("span");Te.className=lt[bt+1];var Pe=$.parentNode;Pe.replaceChild(Te,$),Te.appendChild($),Ne<fe&&(xe[qe+1]=$=oe.createTextNode(Fe.substring(St,fe)),Pe.insertBefore($,Te.nextSibling))}Ne=St,Ne>=fe&&(qe+=2),Ne>=X&&(bt+=2)}}finally{We&&(We.style.display=it)}}var pe={};function Q(Oe,Le){for(var Ke=Le.length;--Ke>=0;){var Fe=Le[Ke];pe.hasOwnProperty(Fe)?M.console&&console.warn("cannot override language handler %s",Fe):pe[Fe]=Oe}}function V(Oe,Le){return Oe&&pe.hasOwnProperty(Oe)||(Oe=/^\s*</.test(Le)?"default-markup":"default-code"),pe[Oe]}Q(de,["default-code"]),Q(ie([],[[i,/^[^<?]+/],[f,/^<!\w[^>]*(?:>|$)/],[h,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[e,/^(?:<[%?]|[%?]>)/],["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"]),Q(ie([[i,/^[\s]+/,null,` \r
`],[A,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[v,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[t,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[e,/^[=<>\/]+/],["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"]),Q(ie([],[[A,/^[\s\S]+/]]),["uq.val"]),Q(ve({keywords:S,hashComments:!0,cStyleComments:!0,types:d}),["c","cc","cpp","cxx","cyc","m"]),Q(ve({keywords:"null,true,false"}),["json"]),Q(ve({keywords:C,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:d}),["cs"]),Q(ve({keywords:O,cStyleComments:!0}),["java"]),Q(ve({keywords:s,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),Q(ve({keywords:n,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),Q(ve({keywords:p,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),Q(ve({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),Q(ve({keywords:b,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),Q(ve({keywords:x,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),Q(ie([],[[u,/^[\s\S]+/]]),["regex"]);function Ce(Oe){var Le=Oe.langExtension;try{var Ke=J(Oe.sourceNode,Oe.pre),Fe=Ke.sourceCode;Oe.sourceCode=Fe,Oe.spans=Ke.spans,Oe.basePos=0,V(Le,Fe)(Oe),ee(Oe)}catch(He){M.console&&console.log(He&&He.stack||He)}}function ke(Oe,Le,Ke){var Fe=Ke||!1,He=Le||null,Ne=document.createElement("div");Ne.innerHTML="<pre>"+Oe+"</pre>",Ne=Ne.firstChild,Fe&&q(Ne,Fe,!0);var xe={langExtension:He,numberLines:Fe,sourceNode:Ne,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Ce(xe),Ne.innerHTML}function Ue(Oe,Le){var Ke=Le||document.body,Fe=Ke.ownerDocument||document;function He(he){return Ke.getElementsByTagName(he)}for(var Ne=[He("pre"),He("code"),He("xmp")],xe=[],Ge=0;Ge<Ne.length;++Ge)for(var qe=0,lt=Ne[Ge].length;qe<lt;++qe)xe.push(Ne[Ge][qe]);Ne=null;var ot=Date;ot.now||(ot={now:function(){return+new Date}});var bt=0,ht=/\blang(?:uage)?-([\w.]+)(?!\S)/,ut=/\bprettyprint\b/,Ze=/\bprettyprinted\b/,Et=/pre|xmp/i,St=/^code$/i,We=/^(?:pre|code|xmp)$/i,it={};function ye(){for(var he=M.PR_SHOULD_USE_CONTINUATION?ot.now()+250:Infinity;bt<xe.length&&ot.now()<he;bt++){for(var fe=xe[bt],X=it,$=fe;$=$.previousSibling;){var te=$.nodeType,oe=(te===7||te===8)&&$.nodeValue;if(oe?!/^\??prettify\b/.test(oe):te!==3||/\S/.test($.nodeValue))break;if(oe){X={},oe.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Dn,on,qn){X[on]=qn});break}}var Te=fe.className;if((X!==it||ut.test(Te))&&!Ze.test(Te)){for(var Pe=!1,Je=fe.parentNode;Je;Je=Je.parentNode){var Wt=Je.tagName;if(We.test(Wt)&&Je.className&&ut.test(Je.className)){Pe=!0;break}}if(!Pe){fe.className+=" prettyprinted";var Zt=X.lang;if(!Zt){Zt=Te.match(ht);var Xt;!Zt&&(Xt=re(fe))&&St.test(Xt.tagName)&&(Zt=Xt.className.match(ht)),Zt&&(Zt=Zt[1])}var an;if(Et.test(fe.tagName))an=1;else{var fn=fe.currentStyle,It=Fe.defaultView,Kn=fn?fn.whiteSpace:It&&It.getComputedStyle?It.getComputedStyle(fe,null).getPropertyValue("white-space"):0;an=Kn&&Kn.substring(0,3)==="pre"}var Sn=X.linenums;(Sn=Sn==="true"||+Sn)||(Sn=Te.match(/\blinenums\b(?::(\d+))?/),Sn=Sn?Sn[1]&&Sn[1].length?+Sn[1]:!0:!1),Sn&&q(fe,Sn,an);var Jn={langExtension:Zt,sourceNode:fe,numberLines:Sn,pre:an,sourceCode:null,basePos:null,spans:null,decorations:null};Ce(Jn)}}}bt<xe.length?M.setTimeout(ye,250):typeof Oe=="function"&&Oe()}ye()}var we=M.PR={createSimpleLexer:ie,registerLangHandler:Q,sourceDecorator:ve,PR_ATTRIB_NAME:t,PR_ATTRIB_VALUE:A,PR_COMMENT:h,PR_DECLARATION:f,PR_KEYWORD:m,PR_LITERAL:r,PR_NOCODE:U,PR_PLAIN:i,PR_PUNCTUATION:e,PR_SOURCE:y,PR_STRING:u,PR_TAG:v,PR_TYPE:a,prettyPrintOne:w?M.prettyPrintOne=ke:R=ke,prettyPrint:I=w?M.prettyPrint=Ue:I=Ue},De=M.define;typeof De=="function"&&De.amd&&De("google-code-prettify",[],function(){return we})})()},WaYH:function(Pt,Ye,W){"use strict";var Ee=W("rePB"),j=W("Ff2n"),w=W("VTBJ"),N=W("1OyB"),E=W("vuIU"),R=W("JX7q"),I=W("Ji7U"),M=W("LK+K"),T=W("q1tI"),P=W("TSYQ"),_=W.n(P),S=W("sboe"),O=W("OZM5"),C=function(m){var h=m.prefixCls,a=m.level,r=m.isStart,e=m.isEnd;if(!a)return null;for(var i="".concat(h,"-indent-unit"),v=[],f=0;f<a;f+=1){var y;v.push(T.createElement("span",{key:f,className:_()(i,(y={},Object(Ee.a)(y,"".concat(i,"-start"),r[f+1]),Object(Ee.a)(y,"".concat(i,"-end"),e[f+1]),Object(Ee.a)(y,"".concat(i,"-end-first-level"),!f&&e[0]),y))}))}return T.createElement("span",{"aria-hidden":"true",className:"".concat(h,"-indent")},v)},x=C,b=W("815F"),p="open",n="close",l="---",s=function(u){Object(I.a)(h,u);var m=Object(M.a)(h);function h(){var a;return Object(N.a)(this,h),a=m.apply(this,arguments),a.state={dragNodeHighlight:!1},a.onSelectorClick=function(r){var e=a.props.context.onNodeClick;e(r,Object(b.b)(a.props)),a.isSelectable()?a.onSelect(r):a.onCheck(r)},a.onSelectorDoubleClick=function(r){var e=a.props.context.onNodeDoubleClick;e(r,Object(b.b)(a.props))},a.onSelect=function(r){if(a.isDisabled())return;var e=a.props.context.onNodeSelect;r.preventDefault(),e(r,Object(b.b)(a.props))},a.onCheck=function(r){if(a.isDisabled())return;var e=a.props,i=e.disableCheckbox,v=e.checked,f=a.props.context.onNodeCheck;if(!a.isCheckable()||i)return;r.preventDefault();var y=!v;f(r,Object(b.b)(a.props),y)},a.onMouseEnter=function(r){var e=a.props.context.onNodeMouseEnter;e(r,Object(b.b)(a.props))},a.onMouseLeave=function(r){var e=a.props.context.onNodeMouseLeave;e(r,Object(b.b)(a.props))},a.onContextMenu=function(r){var e=a.props.context.onNodeContextMenu;e(r,Object(b.b)(a.props))},a.onDragStart=function(r){var e=a.props.context.onNodeDragStart;r.stopPropagation(),a.setState({dragNodeHighlight:!0}),e(r,Object(R.a)(a));try{r.dataTransfer.setData("text/plain","")}catch(i){}},a.onDragEnter=function(r){var e=a.props.context.onNodeDragEnter;r.preventDefault(),r.stopPropagation(),e(r,Object(R.a)(a))},a.onDragOver=function(r){var e=a.props.context.onNodeDragOver;r.preventDefault(),r.stopPropagation(),e(r,Object(R.a)(a))},a.onDragLeave=function(r){var e=a.props.context.onNodeDragLeave;r.stopPropagation(),e(r,Object(R.a)(a))},a.onDragEnd=function(r){var e=a.props.context.onNodeDragEnd;r.stopPropagation(),a.setState({dragNodeHighlight:!1}),e(r,Object(R.a)(a))},a.onDrop=function(r){var e=a.props.context.onNodeDrop;r.preventDefault(),r.stopPropagation(),a.setState({dragNodeHighlight:!1}),e(r,Object(R.a)(a))},a.onExpand=function(r){var e=a.props.context.onNodeExpand;e(r,Object(b.b)(a.props))},a.setSelectHandle=function(r){a.selectHandle=r},a.getNodeState=function(){var r=a.props.expanded;return a.isLeaf()?null:r?p:n},a.hasChildren=function(){var r=a.props.eventKey,e=a.props.context.keyEntities,i=e[r]||{},v=i.children;return!!(v||[]).length},a.isLeaf=function(){var r=a.props,e=r.isLeaf,i=r.loaded,v=a.props.context.loadData,f=a.hasChildren();return e===!1?!1:e||!v&&!f||v&&i&&!f},a.isDisabled=function(){var r=a.props.disabled,e=a.props.context.disabled;return!!(e||r)},a.isCheckable=function(){var r=a.props.checkable,e=a.props.context.checkable;return!e||r===!1?!1:e},a.syncLoadData=function(r){var e=r.expanded,i=r.loading,v=r.loaded,f=a.props.context,y=f.loadData,t=f.onNodeLoad;if(i)return;y&&e&&!a.isLeaf()&&(!a.hasChildren()&&!v&&t(Object(b.b)(a.props)))},a.renderSwitcher=function(){var r=a.props,e=r.expanded,i=r.switcherIcon,v=a.props.context,f=v.prefixCls,y=v.switcherIcon,t=i||y;if(a.isLeaf())return T.createElement("span",{className:_()("".concat(f,"-switcher"),"".concat(f,"-switcher-noop"))},typeof t=="function"?t(Object(w.a)(Object(w.a)({},a.props),{},{isLeaf:!0})):t);var A=_()("".concat(f,"-switcher"),"".concat(f,"-switcher_").concat(e?p:n));return T.createElement("span",{onClick:a.onExpand,className:A},typeof t=="function"?t(Object(w.a)(Object(w.a)({},a.props),{},{isLeaf:!1})):t)},a.renderCheckbox=function(){var r=a.props,e=r.checked,i=r.halfChecked,v=r.disableCheckbox,f=a.props.context.prefixCls,y=a.isDisabled(),t=a.isCheckable();if(!t)return null;var A=typeof t!="boolean"?t:null;return T.createElement("span",{className:_()("".concat(f,"-checkbox"),e&&"".concat(f,"-checkbox-checked"),!e&&i&&"".concat(f,"-checkbox-indeterminate"),(y||v)&&"".concat(f,"-checkbox-disabled")),onClick:a.onCheck},A)},a.renderIcon=function(){var r=a.props.loading,e=a.props.context.prefixCls;return T.createElement("span",{className:_()("".concat(e,"-iconEle"),"".concat(e,"-icon__").concat(a.getNodeState()||"docu"),r&&"".concat(e,"-icon_loading"))})},a.renderSelector=function(){var r=a.state.dragNodeHighlight,e=a.props,i=e.title,v=e.selected,f=e.icon,y=e.loading,t=e.data,A=a.props.context,U=A.prefixCls,F=A.showIcon,H=A.icon,J=A.draggable,B=A.loadData,Z=A.titleRender,re=a.isDisabled(),ie="".concat(U,"-node-content-wrapper"),ve;if(F){var de=f||H;ve=de?T.createElement("span",{className:_()("".concat(U,"-iconEle"),"".concat(U,"-icon__customize"))},typeof de=="function"?de(a.props):de):a.renderIcon()}else B&&y&&(ve=a.renderIcon());var q;typeof i=="function"?q=i(t):Z?q=Z(t):q=i;var ee=T.createElement("span",{className:"".concat(U,"-title")},q);return T.createElement("span",{ref:a.setSelectHandle,title:typeof i=="string"?i:"",className:_()("".concat(ie),"".concat(ie,"-").concat(a.getNodeState()||"normal"),!re&&(v||r)&&"".concat(U,"-node-selected"),!re&&J&&"draggable"),draggable:!re&&J||void 0,"aria-grabbed":!re&&J||void 0,onMouseEnter:a.onMouseEnter,onMouseLeave:a.onMouseLeave,onContextMenu:a.onContextMenu,onClick:a.onSelectorClick,onDoubleClick:a.onSelectorDoubleClick,onDragStart:J?a.onDragStart:void 0},ve,ee)},a}return Object(E.a)(h,[{key:"componentDidMount",value:function(){this.syncLoadData(this.props)}},{key:"componentDidUpdate",value:function(){this.syncLoadData(this.props)}},{key:"isSelectable",value:function(){var r=this.props.selectable,e=this.props.context.selectable;return typeof r=="boolean"?r:e}},{key:"render",value:function(){var r,e=this.props,i=e.eventKey,v=e.className,f=e.style,y=e.dragOver,t=e.dragOverGapTop,A=e.dragOverGapBottom,U=e.isLeaf,F=e.isStart,H=e.isEnd,J=e.expanded,B=e.selected,Z=e.checked,re=e.halfChecked,ie=e.loading,ve=e.domRef,de=e.active,q=e.onMouseMove,ee=Object(j.a)(e,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),pe=this.props.context,Q=pe.prefixCls,V=pe.filterTreeNode,Ce=pe.draggable,ke=pe.keyEntities,Ue=this.isDisabled(),we=Object(O.f)(ee),De=ke[i]||{},Oe=De.level,Le=H[H.length-1];return T.createElement("div",Object.assign({ref:ve,className:_()(v,"".concat(Q,"-treenode"),(r={},Object(Ee.a)(r,"".concat(Q,"-treenode-disabled"),Ue),Object(Ee.a)(r,"".concat(Q,"-treenode-switcher-").concat(J?"open":"close"),!U),Object(Ee.a)(r,"".concat(Q,"-treenode-checkbox-checked"),Z),Object(Ee.a)(r,"".concat(Q,"-treenode-checkbox-indeterminate"),re),Object(Ee.a)(r,"".concat(Q,"-treenode-selected"),B),Object(Ee.a)(r,"".concat(Q,"-treenode-loading"),ie),Object(Ee.a)(r,"".concat(Q,"-treenode-active"),de),Object(Ee.a)(r,"".concat(Q,"-treenode-leaf-last"),Le),Object(Ee.a)(r,"drag-over",!Ue&&y),Object(Ee.a)(r,"drag-over-gap-top",!Ue&&t),Object(Ee.a)(r,"drag-over-gap-bottom",!Ue&&A),Object(Ee.a)(r,"filter-node",V&&V(Object(b.b)(this.props))),r)),style:f,onDragEnter:Ce?this.onDragEnter:void 0,onDragOver:Ce?this.onDragOver:void 0,onDragLeave:Ce?this.onDragLeave:void 0,onDrop:Ce?this.onDrop:void 0,onDragEnd:Ce?this.onDragEnd:void 0,onMouseMove:q},we),T.createElement(x,{prefixCls:Q,level:Oe,isStart:F,isEnd:H}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),h}(T.Component),g=function(m){return T.createElement(S.a.Consumer,null,function(h){return T.createElement(s,Object.assign({},m,{context:h}))})};g.displayName="TreeNode",g.defaultProps={title:l},g.isTreeNode=1;var d=Ye.a=g},WdTA:function(Pt,Ye,W){Pt.exports=W.p+"static/studnetqun.598eeb43.png"},Y1PL:function(Pt,Ye,W){"use strict";W.r(Ye),W.d(Ye,"ResizableTextArea",function(){return re});var Ee=W("wx14"),j=W("1OyB"),w=W("vuIU"),N=W("Ji7U"),E=W("LK+K"),R=W("q1tI"),I=W("VTBJ"),M=W("rePB"),T=W("Zm9Q"),P=W("Kwbf"),_=W("c+Xe"),S=W("m+aA"),O=W("bdgK"),C=new Map;function x(de){de.forEach(function(q){var ee,pe=q.target;(ee=C.get(pe))===null||ee===void 0||ee.forEach(function(Q){return Q(pe)})})}var b=new O.default(x),p=null,n=null;function l(de,q){C.has(de)||(C.set(de,new Set),b.observe(de)),C.get(de).add(q)}function s(de,q){C.has(de)&&(C.get(de).delete(q),C.get(de).size||(b.unobserve(de),C.delete(de)))}var g=function(de){Object(N.a)(ee,de);var q=Object(E.a)(ee);function ee(){return Object(j.a)(this,ee),q.apply(this,arguments)}return Object(w.a)(ee,[{key:"render",value:function(){return this.props.children}}]),ee}(R.Component),d=R.createContext(null);function u(de){var q=de.children,ee=de.onBatchResize,pe=R.useRef(0),Q=R.useRef([]),V=R.useContext(d),Ce=R.useCallback(function(ke,Ue,we){pe.current+=1;var De=pe.current;Q.current.push({size:ke,element:Ue,data:we}),Promise.resolve().then(function(){De===pe.current&&(ee==null||ee(Q.current),Q.current=[])}),V==null||V(ke,Ue,we)},[ee,V]);return R.createElement(d.Provider,{value:Ce},q)}function m(de){var q=de.children,ee=de.disabled,pe=R.useRef(null),Q=R.useRef(null),V=R.useContext(d),Ce=R.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ke=R.isValidElement(q)&&Object(_.c)(q),Ue=ke?q.ref:null,we=R.useMemo(function(){return Object(_.a)(Ue,pe)},[Ue,pe]),De=R.useRef(de);De.current=de;var Oe=R.useCallback(function(Le){var Ke=De.current,Fe=Ke.onResize,He=Ke.data,Ne=Le.getBoundingClientRect(),xe=Ne.width,Ge=Ne.height,qe=Le.offsetWidth,lt=Le.offsetHeight,ot=Math.floor(xe),bt=Math.floor(Ge);if(Ce.current.width!==ot||Ce.current.height!==bt||Ce.current.offsetWidth!==qe||Ce.current.offsetHeight!==lt){var ht={width:ot,height:bt,offsetWidth:qe,offsetHeight:lt};Ce.current=ht;var ut=qe===Math.round(xe)?xe:qe,Ze=lt===Math.round(Ge)?Ge:lt,Et=Object(I.a)(Object(I.a)({},ht),{},{offsetWidth:ut,offsetHeight:Ze});V==null||V(Et,Le,He),Fe&&Promise.resolve().then(function(){Fe(Et,Le)})}},[]);return R.useEffect(function(){var Le=Object(S.a)(pe.current)||Object(S.a)(Q.current);return Le&&!ee&&l(Le,Oe),function(){return s(Le,Oe)}},[pe.current,ee]),R.createElement(g,{ref:Q},ke?R.cloneElement(q,{ref:we}):q)}var h="rc-observer-key";function a(de){var q=de.children,ee=Object(T.a)(q);return ee.map(function(pe,Q){var V=(pe==null?void 0:pe.key)||"".concat(h,"-").concat(Q);return R.createElement(m,Object(Ee.a)({},de,{key:V}),pe)})}a.Collection=u;var r=a,e=W("bT9E"),i=W("TSYQ"),v=W.n(i),f=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important
`,y=["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"],t={},A;function U(de){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ee=de.getAttribute("id")||de.getAttribute("data-reactid")||de.getAttribute("name");if(q&&t[ee])return t[ee];var pe=window.getComputedStyle(de),Q=pe.getPropertyValue("box-sizing")||pe.getPropertyValue("-moz-box-sizing")||pe.getPropertyValue("-webkit-box-sizing"),V=parseFloat(pe.getPropertyValue("padding-bottom"))+parseFloat(pe.getPropertyValue("padding-top")),Ce=parseFloat(pe.getPropertyValue("border-bottom-width"))+parseFloat(pe.getPropertyValue("border-top-width")),ke=y.map(function(we){return"".concat(we,":").concat(pe.getPropertyValue(we))}).join(";"),Ue={sizingStyle:ke,paddingSize:V,borderSize:Ce,boxSizing:Q};return q&&ee&&(t[ee]=Ue),Ue}function F(de){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ee=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,pe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;A||(A=document.createElement("textarea"),A.setAttribute("tab-index","-1"),A.setAttribute("aria-hidden","true"),document.body.appendChild(A)),de.getAttribute("wrap")?A.setAttribute("wrap",de.getAttribute("wrap")):A.removeAttribute("wrap");var Q=U(de,q),V=Q.paddingSize,Ce=Q.borderSize,ke=Q.boxSizing,Ue=Q.sizingStyle;A.setAttribute("style","".concat(Ue,";").concat(f)),A.value=de.value||de.placeholder||"";var we=Number.MIN_SAFE_INTEGER,De=Number.MAX_SAFE_INTEGER,Oe=A.scrollHeight,Le;if(ke==="border-box"?Oe+=Ce:ke==="content-box"&&(Oe-=V),ee!==null||pe!==null){A.value=" ";var Ke=A.scrollHeight-V;ee!==null&&(we=Ke*ee,ke==="border-box"&&(we=we+V+Ce),Oe=Math.max(we,Oe)),pe!==null&&(De=Ke*pe,ke==="border-box"&&(De=De+V+Ce),Le=Oe>De?"":"hidden",Oe=Math.min(De,Oe))}return{height:Oe,minHeight:we,maxHeight:De,overflowY:Le,resize:"none"}}var H=W("Gytx"),J=W.n(H),B;(function(de){de[de.NONE=0]="NONE",de[de.RESIZING=1]="RESIZING",de[de.RESIZED=2]="RESIZED"})(B||(B={}));var Z=function(de){Object(N.a)(ee,de);var q=Object(E.a)(ee);function ee(pe){var Q;return Object(j.a)(this,ee),Q=q.call(this,pe),Q.nextFrameActionId=void 0,Q.resizeFrameId=void 0,Q.textArea=void 0,Q.saveTextArea=function(V){Q.textArea=V},Q.handleResize=function(V){var Ce=Q.state.resizeStatus,ke=Q.props,Ue=ke.autoSize,we=ke.onResize;if(Ce!==B.NONE)return;typeof we=="function"&&we(V),Ue&&Q.resizeOnNextFrame()},Q.resizeOnNextFrame=function(){cancelAnimationFrame(Q.nextFrameActionId),Q.nextFrameActionId=requestAnimationFrame(Q.resizeTextarea)},Q.resizeTextarea=function(){var V=Q.props.autoSize;if(!V||!Q.textArea)return;var Ce=V.minRows,ke=V.maxRows,Ue=F(Q.textArea,!1,Ce,ke);Q.setState({textareaStyles:Ue,resizeStatus:B.RESIZING},function(){cancelAnimationFrame(Q.resizeFrameId),Q.resizeFrameId=requestAnimationFrame(function(){Q.setState({resizeStatus:B.RESIZED},function(){Q.resizeFrameId=requestAnimationFrame(function(){Q.setState({resizeStatus:B.NONE}),Q.fixFirefoxAutoScroll()})})})})},Q.renderTextArea=function(){var V=Q.props,Ce=V.prefixCls,ke=Ce===void 0?"rc-textarea":Ce,Ue=V.autoSize,we=V.onResize,De=V.className,Oe=V.disabled,Le=Q.state,Ke=Le.textareaStyles,Fe=Le.resizeStatus,He=Object(e.a)(Q.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ne=v()(ke,De,Object(M.a)({},"".concat(ke,"-disabled"),Oe));"value"in He&&(He.value=He.value||"");var xe=Object(I.a)(Object(I.a)(Object(I.a)({},Q.props.style),Ke),Fe===B.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return R.createElement(r,{onResize:Q.handleResize,disabled:!(Ue||we)},R.createElement("textarea",Object(Ee.a)({},He,{className:Ne,style:xe,ref:Q.saveTextArea})))},Q.state={textareaStyles:{},resizeStatus:B.NONE},Q}return Object(w.a)(ee,[{key:"componentDidUpdate",value:function(Q){(Q.value!==this.props.value||!J()(Q.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 Q=this.textArea.selectionStart,V=this.textArea.selectionEnd;this.textArea.setSelectionRange(Q,V)}}catch(Ce){}}},{key:"render",value:function(){return this.renderTextArea()}}]),ee}(R.Component),re=Z,ie=function(de){Object(N.a)(ee,de);var q=Object(E.a)(ee);function ee(pe){var Q;Object(j.a)(this,ee),Q=q.call(this,pe),Q.resizableTextArea=void 0,Q.focus=function(){Q.resizableTextArea.textArea.focus()},Q.saveTextArea=function(Ce){Q.resizableTextArea=Ce},Q.handleChange=function(Ce){var ke=Q.props.onChange;Q.setValue(Ce.target.value,function(){Q.resizableTextArea.resizeTextarea()}),ke&&ke(Ce)},Q.handleKeyDown=function(Ce){var ke=Q.props,Ue=ke.onPressEnter,we=ke.onKeyDown;Ce.keyCode===13&&Ue&&Ue(Ce),we&&we(Ce)};var V=typeof pe.value=="undefined"||pe.value===null?pe.defaultValue:pe.value;return Q.state={value:V},Q}return Object(w.a)(ee,[{key:"setValue",value:function(Q,V){"value"in this.props||this.setState({value:Q},V)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return R.createElement(re,Object(Ee.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(Q){return"value"in Q?{value:Q.value}:null}}]),ee}(R.Component),ve=Ye.default=ie},YaiT:function(Pt,Ye,W){Pt.exports={list:"list___mDipN",btns:"btns___2c8h_",name:"name___eV55A"}},ZW9T:function(Pt,Ye,W){"use strict";W.d(Ye,"a",function(){return g});var Ee=W("k1fw"),j=W("miYZ"),w=W("tsqr"),N=W("rAM+"),E=W("tJVT"),R=W("PpiC"),I=W("q1tI"),M=W.n(I),T=W("bdgK");function P(d,u,m,h,a){var r=u.getWordUntilPosition(m),e={startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:r.startColumn,endColumn:r.endColumn},i=h.map(function(v){return{label:v,kind:d.languages.CompletionItemKind.Keyword,insertText:v,insertTextRules:d.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:e}});return a.map(function(v){i.push(Object(Ee.a)(Object(Ee.a)({},v),{},{range:e}))}),i}var _=function(d){var u={label:"ifelse",kind:d.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:d.languages.CompletionItemInsertTextRule.InsertAsSnippet},m=["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"];d.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(e,i){var v=P(d,e,i,m,[u]);return{suggestions:v}}});var h=["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"];d.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(e,i){var v=[{label:"print",kind:d.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:d.languages.CompletionItemInsertTextRule.InsertAsSnippet}],f=P(d,e,i,h,v);return{suggestions:f}}});var a=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];d.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(e,i){var v=[u,{label:"main",kind:d.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
`),insertTextRules:d.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:d.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
`),insertTextRules:d.languages.CompletionItemInsertTextRule.InsertAsSnippet}],f=P(d,e,i,a,v);return{suggestions:f}}})},S="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",O=W("LvDl");function C(d){return/^\d+$/.test(d)?"".concat(d,"px"):d}function x(){}var b=!1,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 n(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],u=d;if(Array.isArray(d)){for(var m=0;m<d.length;m++){var h=p[d[m]];if(h)return h}return u[0]}return p[u]||u}var l=null,s=Ye.b=function(d){var u=d.width,m=u===void 0?"100%":u,h=d.height,a=h===void 0?"100%":h,r=d.value,e=d.language,i=e===void 0?"javascript":e,v=d.style,f=v===void 0?{}:v,y=d.options,t=y===void 0?{}:y,A=d.overrideServices,U=A===void 0?{}:A,F=d.theme,H=F===void 0?"vs-dark":F,J=d.onEditBlur,B=d.onSave,Z=d.autoHeight,re=Z===void 0?!1:Z,ie=d.forbidCopy,ve=ie===void 0?!1:ie,de=d.onChange,q=de===void 0?x:de,ee=d.editorDidMount,pe=ee===void 0?x:ee,Q=d.onFocus,V=Q===void 0?x:Q,Ce=d.filename,ke=Ce===void 0?"educoder.txt":Ce,Ue=Object(R.a)(d,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),we=Object(I.useRef)(),De=Object(I.useRef)({}),Oe=Object(I.useRef)(),Le=Object(I.useRef)(!1),Ke=Object(I.useRef)(),Fe=Object(I.useState)(!1),He=Object(E.a)(Fe,2),Ne=He[0],xe=He[1];function Ge(){var te;return we.current&&(te=new T.default(function(oe){var Te=Object(N.a)(oe),Pe;try{for(Te.s();!(Pe=Te.n()).done;){var Je=Pe.value;(Je.target.offsetHeight>0||Je.target.offsetWidth>0)&&De.current.instance.layout()}}catch(Wt){Te.e(Wt)}finally{Te.f()}}),te.observe(we.current)),te}function qe(){w.b.warn(decodeURIComponent(S))}var lt=function(){var oe=De.current.instance;if(r!=null&&oe&&Ne){var Te=oe.getModel();Te&&r!==Te.getValue()&&(b=!0,Te.setValue(r),oe.layout(),b=!1)}};Object(I.useEffect)(function(){Oe.current&&clearTimeout(Oe.current),Oe.current=setTimeout(function(){lt()},500)},[r,Ne,De.current]);function ot(){var te=De.current.instance;if(te){var oe=te.getSelection(),Te=De.current.pastePos||{},Pe=new l.Range(Te.startLineNumber||oe.endLineNumber,Te.startColumn||oe.endColumn,Te.endLineNumber||oe.endLineNumber,Te.endColumn||oe.endColumn);setTimeout(function(){te.executeEdits("",[{range:Pe,text:""}])},300)}}function bt(te){(window.navigator.platform.match("Mac")?te.metaKey:te.ctrlKey)&&te.keyCode==83&&(te.preventDefault(),B())}var ht=function(){if(re&&De.current.instance){var oe=De.current.instance.getContentHeight();X(oe<a?a:oe)}else X(a)};function ut(te){var oe=document.createEvent("MouseEvents");oe.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),te.dispatchEvent(oe)}function Ze(te,oe){var Te=window.URL||window.webkitURL||window,Pe=new Blob([oe]),Je=document.createElementNS("http://www.w3.org/1999/xhtml","a");Je.href=Te.createObjectURL(Pe),Je.download=te,ut(Je)}Object(I.useEffect)(function(){ht()},[ht]),Object(I.useEffect)(function(){we.current&&!Ne&&W.e(27).then(W.t.bind(null,"M/lh",7)).then(function(te){try{l=te,De.current.instance=l.editor.create(we.current,{value:r,language:n(i),theme:H,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},U);var oe=De.current.instance;if(pe(oe,l),setTimeout(function(){ht(),De.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Ze(ke||"educoder.txt",oe.getValue())}})},500),De.current.subscription=oe.onDidChangeModelContent(function(Pe){Le.current?clearTimeout(Ke.current):(ht(),q(oe.getValue(),Pe)),Ke.current=setTimeout(function(){Le.current=!1},500)}),window.Monaco||_(l),ve&&(oe.addCommand(l.KeyMod.CtrlCmd|l.KeyMod.Shift|l.KeyCode.KEY_V,function(){return qe(),null}),oe.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_C,function(){return qe(),null})),window.Monaco=l,J&&oe.onDidBlurEditorWidget(function(){J(oe.getValue())}),V&&oe.onDidFocusEditorText(function(){V(oe.getValue())}),ve){oe.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_V,function(){return qe(),null}),oe.onDidPaste(function(Pe){De.current.pastePos=Pe});try{window.addEventListener("paste",ot)}catch(Pe){}}var Te=Ge();return xe(!0),function(){var Pe=De.current.instance;Pe.dispose();var Je=Pe.getModel();Je&&Je.dispose(),De.current.subscription&&De.current.subscription.dispose(),ve&&window.removeEventListener("paste",ot),Te.unobserve(we.current)}}catch(Pe){}})},[]),Object(I.useEffect)(function(){var te=De.current.instance;if(te&&Ne)return document.addEventListener("keydown",bt,!1),function(){document.removeEventListener("keydown",bt)}},[B,Ne]),Object(I.useEffect)(function(){var te=De.current.instance;if(te&&Ne){var oe=n(i);l.editor.setModelLanguage(te.getModel(),oe),console.log("language:",i,te.getModel(),oe)}},[i,Ne]),Object(I.useEffect)(function(){var te=De.current.instance;te&&Ne&&l.editor.setTheme(H)},[H,Ne]),Object(I.useEffect)(function(){var te=De.current.instance;te&&Ne&&(te.updateOptions(Object(Ee.a)({},t)),setTimeout(function(){te.getModel().updateOptions(Object(Ee.a)({},t))},200))},[JSON.stringify(t),Ne]),Object(I.useEffect)(function(){var te=De.current.instance;te&&Ne&&te.layout()},[m,a,Ne]);var Et=Object(I.useState)(C(m)),St=Object(E.a)(Et,2),We=St[0],it=St[1],ye=Object(I.useState)(C(a)),he=Object(E.a)(ye,2),fe=he[0],X=he[1],$=Object(Ee.a)(Object(Ee.a)({},f),{},{width:We,height:fe});return M.a.createElement("div",{className:"my-monaco-editor",ref:we,style:$})};function g(d){var u=d.width,m=u===void 0?"100%":u,h=d.height,a=h===void 0?"100%":h,r=d.original,e=d.modified,i=d.language,v=d.options,f=v===void 0?{}:v,y=Object(I.useRef)(),t=Object(I.useState)(null),A=Object(E.a)(t,2),U=A[0],F=A[1];function H(re){var ie;return y.current&&(ie=new T.default(function(ve){var de=Object(N.a)(ve),q;try{for(de.s();!(q=de.n()).done;){var ee=q.value;(ee.target.offsetHeight>0||ee.target.offsetWidth>0)&&re.layout()}}catch(pe){de.e(pe)}finally{de.f()}}),ie.observe(y.current)),ie}Object(I.useEffect)(function(){y.current&&W.e(27).then(W.t.bind(null,"M/lh",7)).then(function(re){l=re;var ie=l.editor.createDiffEditor(y.current,Object(Ee.a)(Object(Ee.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},f),{},{wordWrap:!0}));F(ie);var ve=H(ie);return function(){ie.dispose();var de=ie.getModel();de&&de.dispose(),ve.unobserve(y.current)}})},[]),Object(I.useEffect)(function(){U&&U.setModel({original:l.editor.createModel(r,i),modified:l.editor.createModel(e,i)})},[r,e,i,U]);var J=C(m),B=C(a),Z={width:J,height:B};return M.a.createElement("div",{className:"my-diff-editor",ref:y,style:Z})}},ZpRC:function(Pt,Ye,W){"use strict";function Ee(_){return typeof _=="object"&&_!=null&&_.nodeType===1}function j(_,S){return(!S||_!=="hidden")&&_!=="visible"&&_!=="clip"}function w(_,S){if(_.clientHeight<_.scrollHeight||_.clientWidth<_.scrollWidth){var O=getComputedStyle(_,null);return j(O.overflowY,S)||j(O.overflowX,S)||function(C){var x=function(b){if(!b.ownerDocument||!b.ownerDocument.defaultView)return null;try{return b.ownerDocument.defaultView.frameElement}catch(p){return null}}(C);return!!x&&(x.clientHeight<C.scrollHeight||x.clientWidth<C.scrollWidth)}(_)}return!1}function N(_,S,O,C,x,b,p,n){return b<_&&p>S||b>_&&p<S?0:b<=_&&n<=O||p>=S&&n>=O?b-_-C:p>S&&n<O||b<_&&n>O?p-S+x:0}var E=function(_,S){var O=window,C=S.scrollMode,x=S.block,b=S.inline,p=S.boundary,n=S.skipOverflowHiddenElements,l=typeof p=="function"?p:function(Ke){return Ke!==p};if(!Ee(_))throw new TypeError("Invalid target");for(var s=document.scrollingElement||document.documentElement,g=[],d=_;Ee(d)&&l(d);){if((d=d.parentElement)===s){g.push(d);break}d!=null&&d===document.body&&w(d)&&!w(document.documentElement)||d!=null&&w(d,n)&&g.push(d)}for(var u=O.visualViewport?O.visualViewport.width:innerWidth,m=O.visualViewport?O.visualViewport.height:innerHeight,h=window.scrollX||pageXOffset,a=window.scrollY||pageYOffset,r=_.getBoundingClientRect(),e=r.height,i=r.width,v=r.top,f=r.right,y=r.bottom,t=r.left,A=x==="start"||x==="nearest"?v:x==="end"?y:v+e/2,U=b==="center"?t+i/2:b==="end"?f:t,F=[],H=0;H<g.length;H++){var J=g[H],B=J.getBoundingClientRect(),Z=B.height,re=B.width,ie=B.top,ve=B.right,de=B.bottom,q=B.left;if(C==="if-needed"&&v>=0&&t>=0&&y<=m&&f<=u&&v>=ie&&y<=de&&t>=q&&f<=ve)return F;var ee=getComputedStyle(J),pe=parseInt(ee.borderLeftWidth,10),Q=parseInt(ee.borderTopWidth,10),V=parseInt(ee.borderRightWidth,10),Ce=parseInt(ee.borderBottomWidth,10),ke=0,Ue=0,we="offsetWidth"in J?J.offsetWidth-J.clientWidth-pe-V:0,De="offsetHeight"in J?J.offsetHeight-J.clientHeight-Q-Ce:0;if(s===J)ke=x==="start"?A:x==="end"?A-m:x==="nearest"?N(a,a+m,m,Q,Ce,a+A,a+A+e,e):A-m/2,Ue=b==="start"?U:b==="center"?U-u/2:b==="end"?U-u:N(h,h+u,u,pe,V,h+U,h+U+i,i),ke=Math.max(0,ke+a),Ue=Math.max(0,Ue+h);else{ke=x==="start"?A-ie-Q:x==="end"?A-de+Ce+De:x==="nearest"?N(ie,de,Z,Q,Ce+De,A,A+e,e):A-(ie+Z/2)+De/2,Ue=b==="start"?U-q-pe:b==="center"?U-(q+re/2)+we/2:b==="end"?U-ve+V+we:N(q,ve,re,pe,V+we,U,U+i,i);var Oe=J.scrollLeft,Le=J.scrollTop;A+=Le-(ke=Math.max(0,Math.min(Le+ke,J.scrollHeight-Z+De))),U+=Oe-(Ue=Math.max(0,Math.min(Oe+Ue,J.scrollWidth-re+we)))}F.push({el:J,top:ke,left:Ue})}return F};function R(_){return _===Object(_)&&Object.keys(_).length!==0}function I(_,S){S===void 0&&(S="auto");var O="scrollBehavior"in document.body.style;_.forEach(function(C){var x=C.el,b=C.top,p=C.left;x.scroll&&O?x.scroll({top:b,left:p,behavior:S}):(x.scrollTop=b,x.scrollLeft=p)})}function M(_){return _===!1?{block:"end",inline:"nearest"}:R(_)?_:{block:"start",inline:"nearest"}}function T(_,S){var O=!_.ownerDocument.documentElement.contains(_);if(R(S)&&typeof S.behavior=="function")return S.behavior(O?[]:E(_,S));if(O)return;var C=M(S);return I(E(_,C),C.behavior)}var P=Ye.a=T},bT9E:function(Pt,Ye,W){"use strict";W.d(Ye,"a",function(){return j});var Ee=W("VTBJ");function j(w,N){var E=Object(Ee.a)({},w);return Array.isArray(N)&&N.forEach(function(R){delete E[R]}),E}},d5o6:function(Pt,Ye,W){Pt.exports={flex_box_center:"flex_box_center___2-Tej",flex_space_between:"flex_space_between___1Q3vH",flex_box_vertical_center:"flex_box_vertical_center___2x9ha",flex_box_center_end:"flex_box_center_end___1fvRI",flex_box_column:"flex_box_column___2RmOE",addModal:"addModal___2Pv06",row:"row___2XmSi",label:"label___1L8pt"}},fAei:function(Pt,Ye,W){"use strict";W.d(Ye,"a",function(){return s.a});var Ee=W("rePB"),j=W("VTBJ"),w=W("KQm4"),N=W("1OyB"),E=W("vuIU"),R=W("Ji7U"),I=W("LK+K"),M=W("q1tI"),T=W("4IlW"),P=W("Kwbf"),_=W("TSYQ"),S=W.n(_),O=W("sboe"),C=W("OZM5"),x=W("815F"),b=W("ODXe"),p=W("Ff2n"),n=W("+nKL"),l=W("8XRh"),s=W("WaYH"),g=function(ve,de){var q=ve.className,ee=ve.style,pe=ve.motion,Q=ve.motionNodes,V=ve.motionType,Ce=ve.onMotionStart,ke=ve.onMotionEnd,Ue=ve.active,we=ve.treeNodeRequiredProps,De=Object(p.a)(ve,["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"]),Oe=M.useState(!0),Le=Object(b.a)(Oe,2),Ke=Le[0],Fe=Le[1],He=M.useContext(O.a),Ne=He.prefixCls,xe=M.useRef(!1),Ge=function(){xe.current||ke(),xe.current=!0};return Object(M.useEffect)(function(){Q&&V==="hide"&&Ke&&Fe(!1)},[Q]),Object(M.useEffect)(function(){return Q&&Ce(),function(){Q&&Ge()}},[]),Q?M.createElement(l.default,Object.assign({ref:de,visible:Ke},pe,{motionAppear:V==="show",onAppearEnd:Ge,onLeaveEnd:Ge}),function(qe,lt){var ot=qe.className,bt=qe.style;return M.createElement("div",{ref:lt,className:S()("".concat(Ne,"-treenode-motion"),ot),style:bt},Q.map(function(ht){var ut=ht.data,Ze=ut.key,Et=Object(p.a)(ut,["key"]),St=ht.isStart,We=ht.isEnd;delete Et.children;var it=Object(x.f)(Ze,we);return M.createElement(s.a,Object.assign({},Et,it,{active:Ue,data:ht.data,key:Ze,isStart:St,isEnd:We}))}))}):M.createElement(s.a,Object.assign({domRef:de,className:q,style:ee},De,{active:Ue}))};g.displayName="MotionTreeNode";var d=M.forwardRef(g),u=d;function m(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],de=ie.length,q=ve.length;if(Math.abs(de-q)!==1)return{add:!1,key:null};function ee(pe,Q){var V=new Map;pe.forEach(function(ke){V.set(ke,!0)});var Ce=Q.filter(function(ke){return!V.has(ke)});return Ce.length===1?Ce[0]:null}return de<q?{add:!0,key:ee(ie,ve)}:{add:!1,key:ee(ve,ie)}}function h(ie,ve,de){var q=ie.findIndex(function(V){var Ce=V.data;return Ce.key===de}),ee=ie[q+1],pe=ve.findIndex(function(V){var Ce=V.data;return Ce.key===de});if(ee){var Q=ve.findIndex(function(V){var Ce=V.data;return Ce.key===ee.data.key});return ve.slice(pe+1,Q)}return ve.slice(pe+1)}var a={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},r=function(){},e="RC_TREE_MOTION_".concat(Math.random()),i={key:e},v={key:e,level:0,index:0,pos:"0",node:i},f={parent:null,children:[],pos:v.pos,data:i,isStart:[],isEnd:[]};function y(ie,ve,de,q){return ve===!1||!de?ie:ie.slice(0,Math.ceil(de/q)+1)}function t(ie){var ve=ie.data.key,de=ie.pos;return Object(x.e)(ve,de)}function A(ie){for(var ve=String(ie.data.key),de=ie;de.parent;)de=de.parent,ve="".concat(de.data.key," > ").concat(ve);return ve}var U=function(ve,de){var q=ve.prefixCls,ee=ve.data,pe=ve.selectable,Q=ve.checkable,V=ve.expandedKeys,Ce=ve.selectedKeys,ke=ve.checkedKeys,Ue=ve.loadedKeys,we=ve.loadingKeys,De=ve.halfCheckedKeys,Oe=ve.keyEntities,Le=ve.disabled,Ke=ve.dragging,Fe=ve.dragOverNodeKey,He=ve.dropPosition,Ne=ve.motion,xe=ve.height,Ge=ve.itemHeight,qe=ve.virtual,lt=ve.focusable,ot=ve.activeItem,bt=ve.focused,ht=ve.tabIndex,ut=ve.onKeyDown,Ze=ve.onFocus,Et=ve.onBlur,St=ve.onActiveChange,We=ve.onListChangeStart,it=ve.onListChangeEnd,ye=Object(p.a)(ve,["prefixCls","data","selectable","checkable","expandedKeys","selectedKeys","checkedKeys","loadedKeys","loadingKeys","halfCheckedKeys","keyEntities","disabled","dragging","dragOverNodeKey","dropPosition","motion","height","itemHeight","virtual","focusable","activeItem","focused","tabIndex","onKeyDown","onFocus","onBlur","onActiveChange","onListChangeStart","onListChangeEnd"]),he=M.useRef(null);M.useImperativeHandle(de,function(){return{scrollTo:function(Wn){he.current.scrollTo(Wn)}}});var fe=M.useState(V),X=Object(b.a)(fe,2),$=X[0],te=X[1],oe=M.useState(ee),Te=Object(b.a)(oe,2),Pe=Te[0],Je=Te[1],Wt=M.useState(ee),Zt=Object(b.a)(Wt,2),Xt=Zt[0],an=Zt[1],fn=M.useState([]),It=Object(b.a)(fn,2),Kn=It[0],Sn=It[1],Jn=M.useState(null),Dn=Object(b.a)(Jn,2),on=Dn[0],qn=Dn[1];function Ft(){Je(ee),an(ee),Sn([]),qn(null),it()}M.useEffect(function(){te(V);var kn=m($,V);if(kn.key!==null)if(kn.add){var Wn=Pe.findIndex(function(Ur){var Ar=Ur.data.key;return Ar===kn.key}),Vr=y(h(Pe,ee,kn.key),qe,xe,Ge),br=Pe.slice();br.splice(Wn+1,0,f),an(br),Sn(Vr),qn("show")}else{var Pr=ee.findIndex(function(Ur){var Ar=Ur.data.key;return Ar===kn.key}),nr=y(h(ee,Pe,kn.key),qe,xe,Ge),dr=ee.slice();dr.splice(Pr+1,0,f),an(dr),Sn(nr),qn("hide")}else Pe!==ee&&(Je(ee),an(ee))},[V,ee]),M.useEffect(function(){Ke||Ft()},[Ke]);var Lt=Ne?Xt:ee,Rr={expandedKeys:V,selectedKeys:Ce,loadedKeys:Ue,loadingKeys:we,checkedKeys:ke,halfCheckedKeys:De,dragOverNodeKey:Fe,dropPosition:He,keyEntities:Oe};return M.createElement(M.Fragment,null,bt&&ot&&M.createElement("span",{style:a,"aria-live":"assertive"},A(ot)),M.createElement("div",{role:"tree"},M.createElement("input",{style:a,disabled:lt===!1||Le,tabIndex:lt!==!1?ht:null,onKeyDown:ut,onFocus:Ze,onBlur:Et,value:"",onChange:r})),M.createElement(n.a,Object.assign({},ye,{data:Lt,itemKey:t,height:xe,fullHeight:!1,virtual:qe,itemHeight:Ge,prefixCls:"".concat(q,"-list"),ref:he}),function(kn){var Wn=kn.pos,Vr=kn.data,br=Vr.key,Pr=Object(p.a)(Vr,["key"]),nr=kn.isStart,dr=kn.isEnd,Ur=Object(x.e)(br,Wn);delete Pr.children;var Ar=Object(x.f)(Ur,Rr);return M.createElement(u,Object.assign({},Pr,Ar,{active:ot&&br===ot.data.key,pos:Wn,data:kn.data,isStart:nr,isEnd:dr,motion:Ne,motionNodes:br===e?Kn:null,motionType:on,onMotionStart:We,onMotionEnd:Ft,treeNodeRequiredProps:Rr,onMouseMove:function(){St(null)}}))}))},F=M.forwardRef(U);F.displayName="NodeList";var H=F,J=W("NvD2"),B=function(ie){Object(R.a)(de,ie);var ve=Object(I.a)(de);function de(){var q;return Object(N.a)(this,de),q=ve.apply(this,arguments),q.destroyed=!1,q.state={keyEntities:{},selectedKeys:[],checkedKeys:[],halfCheckedKeys:[],loadedKeys:[],loadingKeys:[],expandedKeys:[],dragging:!1,dragNodesKeys:[],dragOverNodeKey:null,dropPosition:null,treeData:[],flattenNodes:[],focused:!1,activeKey:null,listChanging:!1,prevProps:null},q.listRef=M.createRef(),q.onNodeDragStart=function(ee,pe){var Q=q.state,V=Q.expandedKeys,Ce=Q.keyEntities,ke=q.props.onDragStart,Ue=pe.props.eventKey;q.dragNode=pe;var we=Object(C.b)(V,Ue);q.setState({dragging:!0,dragNodesKeys:Object(C.g)(Ue,Ce)}),q.setExpandedKeys(we),ke&&ke({event:ee,node:Object(x.b)(pe.props)})},q.onNodeDragEnter=function(ee,pe){var Q=q.state,V=Q.expandedKeys,Ce=Q.keyEntities,ke=Q.dragNodesKeys,Ue=q.props.onDragEnter,we=pe.props,De=we.pos,Oe=we.eventKey;if(!q.dragNode||ke.indexOf(Oe)!==-1)return;var Le=Object(C.c)(ee,pe);if(q.dragNode.props.eventKey===Oe&&Le===0){q.setState({dragOverNodeKey:"",dropPosition:null});return}setTimeout(function(){q.setState({dragOverNodeKey:Oe,dropPosition:Le}),q.delayedDragEnterLogic||(q.delayedDragEnterLogic={}),Object.keys(q.delayedDragEnterLogic).forEach(function(Ke){clearTimeout(q.delayedDragEnterLogic[Ke])}),q.delayedDragEnterLogic[De]=window.setTimeout(function(){if(!q.state.dragging)return;var Ke=Object(w.a)(V),Fe=Ce[Oe];Fe&&(Fe.children||[]).length&&(Ke=Object(C.a)(V,Oe)),"expandedKeys"in q.props||q.setExpandedKeys(Ke),Ue&&Ue({event:ee,node:Object(x.b)(pe.props),expandedKeys:Ke})},400)},0)},q.onNodeDragOver=function(ee,pe){var Q=q.state.dragNodesKeys,V=q.props.onDragOver,Ce=pe.props.eventKey;if(Q.indexOf(Ce)!==-1)return;if(q.dragNode&&Ce===q.state.dragOverNodeKey){var ke=Object(C.c)(ee,pe);if(ke===q.state.dropPosition)return;q.setState({dropPosition:ke})}V&&V({event:ee,node:Object(x.b)(pe.props)})},q.onNodeDragLeave=function(ee,pe){var Q=q.props.onDragLeave;q.setState({dragOverNodeKey:""}),Q&&Q({event:ee,node:Object(x.b)(pe.props)})},q.onNodeDragEnd=function(ee,pe){var Q=q.props.onDragEnd;q.setState({dragOverNodeKey:""}),q.cleanDragState(),Q&&Q({event:ee,node:Object(x.b)(pe.props)}),q.dragNode=null},q.onNodeDrop=function(ee,pe){var Q=q.state,V=Q.dragNodesKeys,Ce=V===void 0?[]:V,ke=Q.dropPosition,Ue=q.props.onDrop,we=pe.props,De=we.eventKey,Oe=we.pos;if(q.setState({dragOverNodeKey:""}),q.cleanDragState(),Ce.indexOf(De)!==-1){Object(P.a)(!1,"Can not drop to dragNode(include it's children node)");return}var Le=Object(C.k)(Oe),Ke={event:ee,node:Object(x.b)(pe.props),dragNode:q.dragNode?Object(x.b)(q.dragNode.props):null,dragNodesKeys:Ce.slice(),dropPosition:ke+Number(Le[Le.length-1]),dropToGap:!1};ke!==0&&(Ke.dropToGap=!0),Ue&&Ue(Ke),q.dragNode=null},q.cleanDragState=function(){var ee=q.state.dragging;ee&&q.setState({dragging:!1})},q.onNodeClick=function(ee,pe){var Q=q.props.onClick;Q&&Q(ee,pe)},q.onNodeDoubleClick=function(ee,pe){var Q=q.props.onDoubleClick;Q&&Q(ee,pe)},q.onNodeSelect=function(ee,pe){var Q=q.state.selectedKeys,V=q.state.keyEntities,Ce=q.props,ke=Ce.onSelect,Ue=Ce.multiple,we=pe.selected,De=pe.key,Oe=!we;Oe?Ue?Q=Object(C.a)(Q,De):Q=[De]:Q=Object(C.b)(Q,De);var Le=Q.map(function(Ke){var Fe=V[Ke];return Fe?Fe.node:null}).filter(function(Ke){return Ke});q.setUncontrolledState({selectedKeys:Q}),ke&&ke(Q,{event:"select",selected:Oe,node:pe,selectedNodes:Le,nativeEvent:ee.nativeEvent})},q.onNodeCheck=function(ee,pe,Q){var V=q.state,Ce=V.keyEntities,ke=V.checkedKeys,Ue=V.halfCheckedKeys,we=q.props,De=we.checkStrictly,Oe=we.onCheck,Le=pe.key,Ke,Fe={event:"check",node:pe,checked:Q,nativeEvent:ee.nativeEvent};if(De){var He=Q?Object(C.a)(ke,Le):Object(C.b)(ke,Le),Ne=Object(C.b)(Ue,Le);Ke={checked:He,halfChecked:Ne},Fe.checkedNodes=He.map(function(bt){return Ce[bt]}).filter(function(bt){return bt}).map(function(bt){return bt.node}),q.setUncontrolledState({checkedKeys:He})}else{var xe=Object(J.a)([].concat(Object(w.a)(ke),[Le]),!0,Ce),Ge=xe.checkedKeys,qe=xe.halfCheckedKeys;if(!Q){var lt=new Set(Ge);lt.delete(Le);var ot=Object(J.a)(Array.from(lt),{checked:!1,halfCheckedKeys:qe},Ce);Ge=ot.checkedKeys,qe=ot.halfCheckedKeys}Ke=Ge,Fe.checkedNodes=[],Fe.checkedNodesPositions=[],Fe.halfCheckedKeys=qe,Ge.forEach(function(bt){var ht=Ce[bt];if(!ht)return;var ut=ht.node,Ze=ht.pos;Fe.checkedNodes.push(ut),Fe.checkedNodesPositions.push({node:ut,pos:Ze})}),q.setUncontrolledState({checkedKeys:Ge},!1,{halfCheckedKeys:qe})}Oe&&Oe(Ke,Fe)},q.onNodeLoad=function(ee){return new Promise(function(pe){q.setState(function(Q){var V=Q.loadedKeys,Ce=V===void 0?[]:V,ke=Q.loadingKeys,Ue=ke===void 0?[]:ke,we=q.props,De=we.loadData,Oe=we.onLoad,Le=ee.key;if(!De||Ce.indexOf(Le)!==-1||Ue.indexOf(Le)!==-1)return{};var Ke=De(ee);return Ke.then(function(){var Fe=q.state,He=Fe.loadedKeys,Ne=Fe.loadingKeys,xe=Object(C.a)(He,Le),Ge=Object(C.b)(Ne,Le);Oe&&Oe(xe,{event:"load",node:ee}),q.setUncontrolledState({loadedKeys:xe}),q.setState({loadingKeys:Ge}),pe()}),{loadingKeys:Object(C.a)(Ue,Le)}})})},q.onNodeMouseEnter=function(ee,pe){var Q=q.props.onMouseEnter;Q&&Q({event:ee,node:pe})},q.onNodeMouseLeave=function(ee,pe){var Q=q.props.onMouseLeave;Q&&Q({event:ee,node:pe})},q.onNodeContextMenu=function(ee,pe){var Q=q.props.onRightClick;Q&&(ee.preventDefault(),Q({event:ee,node:pe}))},q.onFocus=function(){var ee=q.props.onFocus;q.setState({focused:!0}),ee&&ee.apply(void 0,arguments)},q.onBlur=function(){var ee=q.props.onBlur;q.setState({focused:!1}),q.onActiveChange(null),ee&&ee.apply(void 0,arguments)},q.getTreeNodeRequiredProps=function(){var ee=q.state,pe=ee.expandedKeys,Q=ee.selectedKeys,V=ee.loadedKeys,Ce=ee.loadingKeys,ke=ee.checkedKeys,Ue=ee.halfCheckedKeys,we=ee.dragOverNodeKey,De=ee.dropPosition,Oe=ee.keyEntities;return{expandedKeys:pe||[],selectedKeys:Q||[],loadedKeys:V||[],loadingKeys:Ce||[],checkedKeys:ke||[],halfCheckedKeys:Ue||[],dragOverNodeKey:we,dropPosition:De,keyEntities:Oe}},q.setExpandedKeys=function(ee){var pe=q.state.treeData,Q=Object(x.d)(pe,ee);q.setUncontrolledState({expandedKeys:ee,flattenNodes:Q},!0)},q.onNodeExpand=function(ee,pe){var Q=q.state.expandedKeys,V=q.state.listChanging,Ce=q.props,ke=Ce.onExpand,Ue=Ce.loadData,we=pe.key,De=pe.expanded;if(V)return;var Oe=Q.indexOf(we),Le=!De;if(Object(P.a)(De&&Oe!==-1||!De&&Oe===-1,"Expand state not sync with index check"),Le?Q=Object(C.a)(Q,we):Q=Object(C.b)(Q,we),q.setExpandedKeys(Q),ke&&ke(Q,{node:pe,expanded:Le,nativeEvent:ee.nativeEvent}),Le&&Ue){var Ke=q.onNodeLoad(pe);Ke&&Ke.then(function(){var Fe=Object(x.d)(q.state.treeData,Q);q.setUncontrolledState({flattenNodes:Fe})})}},q.onListChangeStart=function(){q.setUncontrolledState({listChanging:!0})},q.onListChangeEnd=function(){setTimeout(function(){q.setUncontrolledState({listChanging:!1})})},q.onActiveChange=function(ee){var pe=q.state.activeKey,Q=q.props.onActiveChange;if(pe===ee)return;q.setState({activeKey:ee}),ee!==null&&q.scrollTo({key:ee}),Q&&Q(ee)},q.getActiveItem=function(){var ee=q.state,pe=ee.activeKey,Q=ee.flattenNodes;return pe===null?null:Q.find(function(V){var Ce=V.data.key;return Ce===pe})||null},q.offsetActiveKey=function(ee){var pe=q.state,Q=pe.flattenNodes,V=pe.activeKey,Ce=Q.findIndex(function(we){var De=we.data.key;return De===V});Ce===-1&&ee<0&&(Ce=Q.length),Ce=(Ce+ee+Q.length)%Q.length;var ke=Q[Ce];if(ke){var Ue=ke.data.key;q.onActiveChange(Ue)}else q.onActiveChange(null)},q.onKeyDown=function(ee){var pe=q.state,Q=pe.activeKey,V=pe.expandedKeys,Ce=pe.checkedKeys,ke=q.props,Ue=ke.onKeyDown,we=ke.checkable,De=ke.selectable;switch(ee.which){case T.a.UP:{q.offsetActiveKey(-1),ee.preventDefault();break}case T.a.DOWN:{q.offsetActiveKey(1),ee.preventDefault();break}}var Oe=q.getActiveItem();if(Oe&&Oe.data){var Le=q.getTreeNodeRequiredProps(),Ke=Oe.data.isLeaf===!1||!!(Oe.data.children||[]).length,Fe=Object(x.b)(Object(j.a)(Object(j.a)({},Object(x.f)(Q,Le)),{},{data:Oe.data,active:!0}));switch(ee.which){case T.a.LEFT:{Ke&&V.includes(Q)?q.onNodeExpand({},Fe):Oe.parent&&q.onActiveChange(Oe.parent.data.key),ee.preventDefault();break}case T.a.RIGHT:{Ke&&!V.includes(Q)?q.onNodeExpand({},Fe):Oe.children&&Oe.children.length&&q.onActiveChange(Oe.children[0].data.key),ee.preventDefault();break}case T.a.ENTER:case T.a.SPACE:{we&&!Fe.disabled&&Fe.checkable!==!1&&!Fe.disableCheckbox?q.onNodeCheck({},Fe,!Ce.includes(Q)):!we&&De&&!Fe.disabled&&Fe.selectable!==!1&&q.onNodeSelect({},Fe);break}}}Ue&&Ue(ee)},q.setUncontrolledState=function(ee){var pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(q.destroyed)return;var V=!1,Ce=!0,ke={};Object.keys(ee).forEach(function(Ue){if(Ue in q.props){Ce=!1;return}V=!0,ke[Ue]=ee[Ue]}),V&&(!pe||Ce)&&q.setState(Object(j.a)(Object(j.a)({},ke),Q))},q.scrollTo=function(ee){q.listRef.current.scrollTo(ee)},q}return Object(E.a)(de,[{key:"componentWillUnmount",value:function(){this.destroyed=!0}},{key:"render",value:function(){var ee,pe=this.state,Q=pe.focused,V=pe.flattenNodes,Ce=pe.keyEntities,ke=pe.dragging,Ue=pe.activeKey,we=this.props,De=we.prefixCls,Oe=we.className,Le=we.style,Ke=we.showLine,Fe=we.focusable,He=we.tabIndex,Ne=He===void 0?0:He,xe=we.selectable,Ge=we.showIcon,qe=we.icon,lt=we.switcherIcon,ot=we.draggable,bt=we.checkable,ht=we.checkStrictly,ut=we.disabled,Ze=we.motion,Et=we.loadData,St=we.filterTreeNode,We=we.height,it=we.itemHeight,ye=we.virtual,he=we.titleRender,fe=we.onContextMenu,X=Object(C.f)(this.props);return M.createElement(O.a.Provider,{value:{prefixCls:De,selectable:xe,showIcon:Ge,icon:qe,switcherIcon:lt,draggable:ot,checkable:bt,checkStrictly:ht,disabled:ut,keyEntities:Ce,loadData:Et,filterTreeNode:St,titleRender:he,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop}},M.createElement("div",{className:S()(De,Oe,(ee={},Object(Ee.a)(ee,"".concat(De,"-show-line"),Ke),Object(Ee.a)(ee,"".concat(De,"-focused"),Q),Object(Ee.a)(ee,"".concat(De,"-active-focused"),Ue!==null),ee))},M.createElement(H,Object.assign({ref:this.listRef,prefixCls:De,style:Le,data:V,disabled:ut,selectable:xe,checkable:!!bt,motion:Ze,dragging:ke,height:We,itemHeight:it,virtual:ye,focusable:Fe,focused:Q,tabIndex:Ne,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:fe},this.getTreeNodeRequiredProps(),X))))}}],[{key:"getDerivedStateFromProps",value:function(ee,pe){var Q=pe.prevProps,V={prevProps:ee};function Ce(qe){return!Q&&qe in ee||Q&&Q[qe]!==ee[qe]}var ke;if(Ce("treeData")?ke=ee.treeData:Ce("children")&&(Object(P.a)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),ke=Object(x.c)(ee.children)),ke){V.treeData=ke;var Ue=Object(x.a)(ke);V.keyEntities=Object(j.a)(Object(Ee.a)({},e,v),Ue.keyEntities)}var we=V.keyEntities||pe.keyEntities;if(Ce("expandedKeys")||Q&&Ce("autoExpandParent"))V.expandedKeys=ee.autoExpandParent||!Q&&ee.defaultExpandParent?Object(C.e)(ee.expandedKeys,we):ee.expandedKeys;else if(!Q&&ee.defaultExpandAll){var De=Object(j.a)({},we);delete De[e],V.expandedKeys=Object.keys(De).map(function(qe){return De[qe].key})}else!Q&&ee.defaultExpandedKeys&&(V.expandedKeys=ee.autoExpandParent||ee.defaultExpandParent?Object(C.e)(ee.defaultExpandedKeys,we):ee.defaultExpandedKeys);if(V.expandedKeys||delete V.expandedKeys,ke||V.expandedKeys){var Oe=Object(x.d)(ke||pe.treeData,V.expandedKeys||pe.expandedKeys);V.flattenNodes=Oe}if(ee.selectable&&(Ce("selectedKeys")?V.selectedKeys=Object(C.d)(ee.selectedKeys,ee):!Q&&ee.defaultSelectedKeys&&(V.selectedKeys=Object(C.d)(ee.defaultSelectedKeys,ee))),ee.checkable){var Le;if(Ce("checkedKeys")?Le=Object(C.j)(ee.checkedKeys)||{}:!Q&&ee.defaultCheckedKeys?Le=Object(C.j)(ee.defaultCheckedKeys)||{}:ke&&(Le=Object(C.j)(ee.checkedKeys)||{checkedKeys:pe.checkedKeys,halfCheckedKeys:pe.halfCheckedKeys}),Le){var Ke=Le,Fe=Ke.checkedKeys,He=Fe===void 0?[]:Fe,Ne=Ke.halfCheckedKeys,xe=Ne===void 0?[]:Ne;if(!ee.checkStrictly){var Ge=Object(J.a)(He,!0,we);He=Ge.checkedKeys,xe=Ge.halfCheckedKeys}V.checkedKeys=He,V.halfCheckedKeys=xe}}return Ce("loadedKeys")&&(V.loadedKeys=ee.loadedKeys),V}}]),de}(M.Component);B.defaultProps={prefixCls:"rc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[]},B.TreeNode=s.a;var Z=B,re=Ye.b=Z},fcSX:function(Pt,Ye,W){"use strict";var Ee=W("Ff2n"),j=W("1OyB"),w=W("vuIU"),N=W("Ji7U"),E=W("md7G"),R=W("foSv"),I=W("1W/9"),M=W("q1tI"),T=W("rePB"),P=W("JX7q"),_=W("TSYQ"),S=W.n(_),O=W("qx4F"),C=W("4IlW");function x(U){return Array.isArray(U)?U:[U]}var b={transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend"},p=Object.keys(b).filter(function(U){if(typeof document=="undefined")return!1;var F=document.getElementsByTagName("html")[0];return U in(F?F.style:{})})[0],n=b[p];function l(U,F,H,J){U.addEventListener?U.addEventListener(F,H,J):U.attachEvent&&U.attachEvent("on".concat(F),H)}function s(U,F,H,J){U.removeEventListener?U.removeEventListener(F,H,J):U.attachEvent&&U.detachEvent("on".concat(F),H)}function g(U,F){var H=typeof U=="function"?U(F):U;return Array.isArray(H)?H.length===2?H:[H[0],H[1]]:[H]}var d=function(F){return!isNaN(parseFloat(F))&&isFinite(F)},u=!(typeof window!="undefined"&&window.document&&window.document.createElement),m=function U(F,H,J,B){if(!H||H===document||H instanceof Document)return!1;if(H===F.parentNode)return!0;var Z=Math.max(Math.abs(J),Math.abs(B))===Math.abs(B),re=Math.max(Math.abs(J),Math.abs(B))===Math.abs(J),ie=H.scrollHeight-H.clientHeight,ve=H.scrollWidth-H.clientWidth,de=document.defaultView.getComputedStyle(H),q=de.overflowY==="auto"||de.overflowY==="scroll",ee=de.overflowX==="auto"||de.overflowX==="scroll",pe=ie&&q,Q=ve&&ee;return Z&&(!pe||pe&&(H.scrollTop>=ie&&B<0||H.scrollTop<=0&&B>0))||re&&(!Q||Q&&(H.scrollLeft>=ve&&J<0||H.scrollLeft<=0&&J>0))?U(F,H.parentNode,J,B):!1};function h(U){var F=a();return function(){var J=Object(R.a)(U),B;if(F){var Z=Object(R.a)(this).constructor;B=Reflect.construct(J,arguments,Z)}else B=J.apply(this,arguments);return Object(E.a)(this,B)}}function a(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(U){return!1}}var r={},e=function(U){Object(N.a)(H,U);var F=h(H);function H(J){var B;return Object(j.a)(this,H),B=F.call(this,J),B.domFocus=function(){B.dom&&B.dom.focus()},B.removeStartHandler=function(Z){if(Z.touches.length>1)return;B.startPos={x:Z.touches[0].clientX,y:Z.touches[0].clientY}},B.removeMoveHandler=function(Z){if(Z.changedTouches.length>1)return;var re=Z.currentTarget,ie=Z.changedTouches[0].clientX-B.startPos.x,ve=Z.changedTouches[0].clientY-B.startPos.y;(re===B.maskDom||re===B.handlerDom||re===B.contentDom&&m(re,Z.target,ie,ve))&&Z.cancelable&&Z.preventDefault()},B.transitionEnd=function(Z){var re=Z.target;s(re,n,B.transitionEnd),re.style.transition=""},B.onKeyDown=function(Z){if(Z.keyCode===C.a.ESC){var re=B.props.onClose;Z.stopPropagation(),re&&re(Z)}},B.onWrapperTransitionEnd=function(Z){var re=B.props,ie=re.open,ve=re.afterVisibleChange;Z.target===B.contentWrapper&&Z.propertyName.match(/transform$/)&&(B.dom.style.transition="",!ie&&B.getCurrentDrawerSome()&&(document.body.style.overflowX="",B.maskDom&&(B.maskDom.style.left="",B.maskDom.style.width="")),ve&&ve(!!ie))},B.openLevelTransition=function(){var Z=B.props,re=Z.open,ie=Z.width,ve=Z.height,de=B.getHorizontalBoolAndPlacementName(),q=de.isHorizontal,ee=de.placementName,pe=B.contentDom?B.contentDom.getBoundingClientRect()[q?"width":"height"]:0,Q=(q?ie:ve)||pe;B.setLevelAndScrolling(re,ee,Q)},B.setLevelTransform=function(Z,re,ie,ve){var de=B.props,q=de.placement,ee=de.levelMove,pe=de.duration,Q=de.ease,V=de.showMask;B.levelDom.forEach(function(Ce){Ce.style.transition="transform ".concat(pe," ").concat(Q),l(Ce,n,B.transitionEnd);var ke=Z?ie:0;if(ee){var Ue=g(ee,{target:Ce,open:Z});ke=Z?Ue[0]:Ue[1]||0}var we=typeof ke=="number"?"".concat(ke,"px"):ke,De=q==="left"||q==="top"?we:"-".concat(we);De=V&&q==="right"&&ve?"calc(".concat(De," + ").concat(ve,"px)"):De,Ce.style.transform=ke?"".concat(re,"(").concat(De,")"):""})},B.setLevelAndScrolling=function(Z,re,ie){var ve=B.props.onChange;if(!u){var de=document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth?Object(O.a)(!0):0;B.setLevelTransform(Z,re,ie,de),B.toggleScrollingToDrawerAndBody(de)}ve&&ve(Z)},B.toggleScrollingToDrawerAndBody=function(Z){var re=B.props,ie=re.getOpenCount,ve=re.getContainer,de=re.showMask,q=re.open,ee=ve&&ve(),pe=ie&&ie();if(ee&&ee.parentNode===document.body&&de){var Q=["touchstart"],V=[document.body,B.maskDom,B.handlerDom,B.contentDom];q&&document.body.style.overflow!=="hidden"?(Z&&B.addScrollingEffect(Z),pe===1&&(document.body.style.overflow="hidden"),document.body.style.touchAction="none",V.forEach(function(Ce,ke){if(!Ce)return;l(Ce,Q[ke]||"touchmove",ke?B.removeMoveHandler:B.removeStartHandler,B.passive)})):B.getCurrentDrawerSome()&&(pe||(document.body.style.overflow=""),document.body.style.touchAction="",Z&&B.remScrollingEffect(Z),V.forEach(function(Ce,ke){if(!Ce)return;s(Ce,Q[ke]||"touchmove",ke?B.removeMoveHandler:B.removeStartHandler,B.passive)}))}},B.addScrollingEffect=function(Z){var re=B.props,ie=re.placement,ve=re.duration,de=re.ease,q=re.getOpenCount,ee=re.switchScrollingEffect,pe=q&&q();pe===1&&ee();var Q="width ".concat(ve," ").concat(de),V="transform ".concat(ve," ").concat(de);B.dom.style.transition="none";switch(ie){case"right":B.dom.style.transform="translateX(-".concat(Z,"px)");break;case"top":case"bottom":B.dom.style.width="calc(100% - ".concat(Z,"px)"),B.dom.style.transform="translateZ(0)";break;default:break}clearTimeout(B.timeout),B.timeout=setTimeout(function(){B.dom&&(B.dom.style.transition="".concat(V,",").concat(Q),B.dom.style.width="",B.dom.style.transform="")})},B.remScrollingEffect=function(Z){var re=B.props,ie=re.placement,ve=re.duration,de=re.ease,q=re.getOpenCount,ee=re.switchScrollingEffect,pe=q&&q();pe||ee(!0),p&&(document.body.style.overflowX="hidden"),B.dom.style.transition="none";var Q,V="width ".concat(ve," ").concat(de),Ce="transform ".concat(ve," ").concat(de);switch(ie){case"left":{B.dom.style.width="100%",V="width 0s ".concat(de," ").concat(ve);break}case"right":{B.dom.style.transform="translateX(".concat(Z,"px)"),B.dom.style.width="100%",V="width 0s ".concat(de," ").concat(ve),B.maskDom&&(B.maskDom.style.left="-".concat(Z,"px"),B.maskDom.style.width="calc(100% + ".concat(Z,"px)"));break}case"top":case"bottom":{B.dom.style.width="calc(100% + ".concat(Z,"px)"),B.dom.style.height="100%",B.dom.style.transform="translateZ(0)",Q="height 0s ".concat(de," ").concat(ve);break}default:break}clearTimeout(B.timeout),B.timeout=setTimeout(function(){B.dom&&(B.dom.style.transition="".concat(Ce,",").concat(Q?"".concat(Q,","):"").concat(V),B.dom.style.transform="",B.dom.style.width="",B.dom.style.height="")})},B.getCurrentDrawerSome=function(){return!Object.keys(r).some(function(Z){return r[Z]})},B.getLevelDom=function(Z){var re=Z.level,ie=Z.getContainer;if(u)return;var ve=ie&&ie(),de=ve?ve.parentNode:null;if(B.levelDom=[],re==="all"){var q=de?Array.prototype.slice.call(de.children):[];q.forEach(function(ee){ee.nodeName!=="SCRIPT"&&ee.nodeName!=="STYLE"&&ee.nodeName!=="LINK"&&ee!==ve&&B.levelDom.push(ee)})}else re&&x(re).forEach(function(ee){document.querySelectorAll(ee).forEach(function(pe){B.levelDom.push(pe)})})},B.getHorizontalBoolAndPlacementName=function(){var Z=B.props.placement,re=Z==="left"||Z==="right",ie="translate".concat(re?"X":"Y");return{isHorizontal:re,placementName:ie}},B.state={_self:Object(P.a)(B)},B}return Object(w.a)(H,[{key:"componentDidMount",value:function(){var B=this;if(!u){var Z=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){return Z=!0,null}}))}catch(q){}this.passive=Z?{passive:!1}:!1}var re=this.props,ie=re.open,ve=re.getContainer,de=ve&&ve();this.drawerId="drawer_id_".concat(Number((Date.now()+Math.random()).toString().replace(".",Math.round(Math.random()*9).toString())).toString(16)),this.getLevelDom(this.props),ie&&(de&&de.parentNode===document.body&&(r[this.drawerId]=ie),this.openLevelTransition(),this.forceUpdate(function(){B.domFocus()}))}},{key:"componentDidUpdate",value:function(B){var Z=this.props,re=Z.open,ie=Z.getContainer,ve=ie&&ie();re!==B.open&&(re&&this.domFocus(),ve&&ve.parentNode===document.body&&(r[this.drawerId]=!!re),this.openLevelTransition())}},{key:"componentWillUnmount",value:function(){var B=this.props,Z=B.getOpenCount,re=B.open,ie=B.switchScrollingEffect,ve=typeof Z=="function"&&Z();delete r[this.drawerId],re&&(this.setLevelTransform(!1),document.body.style.touchAction=""),ve||(document.body.style.overflow="",ie(!0))}},{key:"render",value:function(){var B,Z=this,re=this.props,ie=re.className,ve=re.children,de=re.style,q=re.width,ee=re.height,pe=re.defaultOpen,Q=re.open,V=re.prefixCls,Ce=re.placement,ke=re.level,Ue=re.levelMove,we=re.ease,De=re.duration,Oe=re.getContainer,Le=re.handler,Ke=re.onChange,Fe=re.afterVisibleChange,He=re.showMask,Ne=re.maskClosable,xe=re.maskStyle,Ge=re.onClose,qe=re.onHandleClick,lt=re.keyboard,ot=re.getOpenCount,bt=re.switchScrollingEffect,ht=Object(Ee.a)(re,["className","children","style","width","height","defaultOpen","open","prefixCls","placement","level","levelMove","ease","duration","getContainer","handler","onChange","afterVisibleChange","showMask","maskClosable","maskStyle","onClose","onHandleClick","keyboard","getOpenCount","switchScrollingEffect"]),ut=this.dom?Q:!1,Ze=S()(V,(B={},Object(T.a)(B,"".concat(V,"-").concat(Ce),!0),Object(T.a)(B,"".concat(V,"-open"),ut),Object(T.a)(B,ie||"",!!ie),Object(T.a)(B,"no-mask",!He),B)),Et=this.getHorizontalBoolAndPlacementName(),St=Et.placementName,We=Ce==="left"||Ce==="top"?"-100%":"100%",it=ut?"":"".concat(St,"(").concat(We,")"),ye=Le&&M.cloneElement(Le,{onClick:function(fe){Le.props.onClick&&Le.props.onClick(),qe&&qe(fe)},ref:function(fe){Z.handlerDom=fe}});return M.createElement("div",Object.assign({},ht,{tabIndex:-1,className:Ze,style:de,ref:function(fe){Z.dom=fe},onKeyDown:ut&&lt?this.onKeyDown:void 0,onTransitionEnd:this.onWrapperTransitionEnd}),He&&M.createElement("div",{className:"".concat(V,"-mask"),onClick:Ne?Ge:void 0,style:xe,ref:function(fe){Z.maskDom=fe}}),M.createElement("div",{className:"".concat(V,"-content-wrapper"),style:{transform:it,msTransform:it,width:d(q)?"".concat(q,"px"):q,height:d(ee)?"".concat(ee,"px"):ee},ref:function(fe){Z.contentWrapper=fe}},M.createElement("div",{className:"".concat(V,"-content"),ref:function(fe){Z.contentDom=fe},onTouchStart:ut&&He?this.removeStartHandler:void 0,onTouchMove:ut&&He?this.removeMoveHandler:void 0},ve),ye))}}],[{key:"getDerivedStateFromProps",value:function(B,Z){var re=Z.prevProps,ie=Z._self,ve={prevProps:B};if(re!==void 0){var de=B.placement,q=B.level;de!==re.placement&&(ie.contentDom=null),q!==re.level&&ie.getLevelDom(B)}return ve}}]),H}(M.Component);e.defaultProps={switchScrollingEffect:function(){}};var i=e;function v(U){var F=f();return function(){var J=Object(R.a)(U),B;if(F){var Z=Object(R.a)(this).constructor;B=Reflect.construct(J,arguments,Z)}else B=J.apply(this,arguments);return Object(E.a)(this,B)}}function f(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(U){return!1}}var y=function(U){Object(N.a)(H,U);var F=v(H);function H(J){var B;Object(j.a)(this,H),B=F.call(this,J),B.onHandleClick=function(re){var ie=B.props,ve=ie.onHandleClick,de=ie.open;if(ve&&ve(re),typeof de=="undefined"){var q=B.state.open;B.setState({open:!q})}},B.onClose=function(re){var ie=B.props,ve=ie.onClose,de=ie.open;ve&&ve(re),typeof de=="undefined"&&B.setState({open:!1})};var Z=typeof J.open!="undefined"?J.open:!!J.defaultOpen;return B.state={open:Z},"onMaskClick"in J&&console.warn("`onMaskClick` are removed, please use `onClose` instead."),B}return Object(w.a)(H,[{key:"render",value:function(){var B=this,Z=this.props,re=Z.defaultOpen,ie=Z.getContainer,ve=Z.wrapperClassName,de=Z.forceRender,q=Z.handler,ee=Object(Ee.a)(Z,["defaultOpen","getContainer","wrapperClassName","forceRender","handler"]),pe=this.state.open;if(!ie)return M.createElement("div",{className:ve,ref:function(Ce){B.dom=Ce}},M.createElement(i,Object.assign({},ee,{open:pe,handler:q,getContainer:function(){return B.dom},onClose:this.onClose,onHandleClick:this.onHandleClick})));var Q=!!q||de;return M.createElement(I.a,{visible:pe,forceRender:Q,getContainer:ie,wrapperClassName:ve},function(V){var Ce=V.visible,ke=V.afterClose,Ue=Object(Ee.a)(V,["visible","afterClose"]);return M.createElement(i,Object.assign({},ee,Ue,{open:Ce!==void 0?Ce:pe,afterVisibleChange:ke!==void 0?ke:ee.afterVisibleChange,handler:q,onClose:B.onClose,onHandleClick:B.onHandleClick}))})}}],[{key:"getDerivedStateFromProps",value:function(B,Z){var re=Z.prevProps,ie={prevProps:B};return typeof re!="undefined"&&B.open!==re.open&&(ie.open=B.open),ie}}]),H}(M.Component);y.defaultProps={prefixCls:"drawer",placement:"left",getContainer:"body",defaultOpen:!1,level:"all",duration:".3s",ease:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",onChange:function(){},afterVisibleChange:function(){},handler:M.createElement("div",{className:"drawer-handle"},M.createElement("i",{className:"drawer-handle-icon"})),showMask:!0,maskClosable:!0,maskStyle:{},wrapperClassName:"",className:"",keyboard:!0,forceRender:!1};var t=y,A=Ye.a=t},i8i3:function(Pt,Ye,W){Pt.exports={flex_box_center:"flex_box_center___3Vf6o",flex_space_between:"flex_space_between___3kR1x",flex_box_vertical_center:"flex_box_vertical_center___25a0b",flex_box_center_end:"flex_box_center_end___3k_KQ",flex_box_column:"flex_box_column___38BD-",customModal:"customModal___2JXW3",shareModal:"shareModal___1xuLw",content:"content___1yjOV",group:"group___2tJcj",teachGroup:"teachGroup___VMxNc",footer:"footer___1OQG5"}},iNYN:function(Pt,Ye,W){Pt.exports={modalContent:"modalContent___3NP2x",modalContentLeft:"modalContentLeft___ycFEY",green:"green___2njFR",textArea:"textArea___28pXQ",red:"red___2bPlD",row:"row___tW7CE",html:"html___30ord",line:"line___1f3U7"}},iris:function(Pt,Ye,W){"use strict";W.d(Ye,"a",function(){return O});var Ee=W("qVdP"),j=W("jsC+"),w=W("lUTK"),N=W("BvKs"),E=W("tJVT"),R=W("q1tI"),I=W.n(R),M=W("Q0Vu"),T=W.n(M),P=[{name:"\u7F16\u7A0B\u9898",value:"PROGRAM"},{name:"\u5355\u9009\u9898",value:"SINGLE"},{name:"\u591A\u9009\u9898",value:"MULTIPLE"},{name:"\u5224\u65AD\u9898",value:"JUDGMENT"},{name:"\u586B\u7A7A\u9898",value:"COMPLETION"},{name:"\u7B80\u7B54\u9898",value:"SUBJECTIVE"},{name:"\u7EC4\u5408\u9898",value:"COMBINATION"}],_=[{name:"\u7B80\u5355",value:1},{name:"\u9002\u4E2D",value:2},{name:"\u56F0\u96BE",value:3}],S=[{name:"\u968F\u673A\u7EC4\u5377",value:1},{name:"\u4EBA\u5DE5\u7EC4\u5377",value:2}],O=function(x){var b=x.showSelectAll,p=b===void 0?!1:b,n=x.disciplinesData,l=n===void 0?[]:n,s=x.knowledgeData,g=s===void 0?[]:s,d=x.directionValue,u=x.subDisciplineValue,m=x.typeValue,h=x.knowledgeValue,a=x.showKnowledge,r=a===void 0?!1:a,e=x.showRandomType,i=e===void 0?!1:e,v=x.difficultyValue,f=x.randomValue,y=x.selectAll,t=x.className,A=x.showShixun,U=A===void 0?!1:A,F=x.showItemType,H=F===void 0?!0:F,J=x.onShixunChange,B=J===void 0?function(){}:J,Z=x.onDirectionChange,re=Z===void 0?function(){}:Z,ie=x.onTypeChange,ve=ie===void 0?function(){}:ie,de=x.onDifficultyChange,q=de===void 0?function(){}:de,ee=x.onKnowledgeChange,pe=ee===void 0?function(){}:ee,Q=x.onRandomChange,V=Q===void 0?function(){}:Q,Ce=Object(R.useState)(0),ke=Object(E.a)(Ce,2),Ue=ke[0],we=ke[1],De=Object(R.useRef)(null),Oe=Object(R.useState)(0),Le=Object(E.a)(Oe,2),Ke=Le[0],Fe=Le[1],He=Object(R.useRef)(null);Object(R.useEffect)(function(){if(l.length!==0){var xe;(De==null||((xe=De.current)===null||xe===void 0)?void 0:xe.clientHeight)>90?we(1):we(0)}l.length===0&&we(0)},[l]),Object(R.useEffect)(function(){if(console.log(g.length===0,"\u6570\u91CF"),g.length!==0){var xe,Ge;console.log(He==null||((xe=He.current)===null||xe===void 0)?void 0:xe.clientHeight,"\u9AD8\u5EA6"),(He==null||((Ge=He.current)===null||Ge===void 0)?void 0:Ge.clientHeight)>90?Fe(1):Fe(0)}g.length===0&&Fe(0)},[g]);var Ne=function(){var Ge=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],qe=arguments.length>1?arguments[1]:void 0;return I.a.createElement(N.a,{className:T.a.subMenu},Ge.map(function(lt){return I.a.createElement(N.a.Item,{key:lt.id},I.a.createElement("a",{className:"".concat(T.a.subItem," ").concat(u===lt.id?T.a.subActive:""),onClick:function(){return re(qe,lt.id)}},lt.name))}))};return I.a.createElement("aside",{className:t?"".concat(T.a.main," ").concat(t):T.a.main},I.a.createElement("div",{className:T.a.wrap},I.a.createElement("div",{className:T.a.content},I.a.createElement("span",{className:T.a.name},"\u65B9\u5411:"),I.a.createElement("span",null,I.a.createElement("li",{className:"".concat(T.a.directionItem," ").concat(d?"":T.a.active," "),onClick:function(){return re(null)}},"\u5168\u90E8")),I.a.createElement("div",{className:T.a.directionContentWrap,style:{overflow:"hidden",height:Ue===1?88:"auto"}},l.map(function(xe){var Ge;return I.a.createElement(I.a.Fragment,{key:xe.id},((Ge=xe.sub_disciplines)===null||Ge===void 0?void 0:Ge.length)>0?I.a.createElement(j.a,{placement:"bottomLeft",overlayStyle:{width:600},getPopupContainer:function(lt){return lt.parentNode},overlay:function(){return Ne(xe.sub_disciplines,xe.id)}},I.a.createElement("li",{className:"".concat(T.a.directionItem," ").concat(d===xe.id?T.a.active:""," "),onClick:function(){return re(xe.id)}},xe.name)):I.a.createElement("li",{className:"".concat(T.a.directionItem," ").concat(d===xe.id?T.a.active:""," "),onClick:function(){return re(xe.id)}},xe.name))})),I.a.createElement("div",{className:T.a.directionContentWrap,ref:De,style:{height:"auto",position:"fixed",left:0,top:0,width:1024,visibility:"hidden"}},l.map(function(xe){var Ge;return I.a.createElement(I.a.Fragment,{key:xe.id},((Ge=xe.sub_disciplines)===null||Ge===void 0?void 0:Ge.length)>0?I.a.createElement(j.a,{placement:"bottomLeft",overlayStyle:{width:600},getPopupContainer:function(lt){return lt.parentNode},overlay:function(){return Ne(xe.sub_disciplines,xe.id)}},I.a.createElement("li",{className:"".concat(T.a.directionItem," ").concat(d===xe.id?T.a.active:""," "),onClick:function(){return re(xe.id)}},xe.name)):I.a.createElement("li",{className:"".concat(T.a.directionItem," ").concat(d===xe.id?T.a.active:""," "),onClick:function(){return re(xe.id)}},xe.name))})),!!Ue&&I.a.createElement("div",{className:T.a.action},Ue===1&&I.a.createElement("span",{onClick:function(){return we(2)}},"\u5C55\u5F00",I.a.createElement("i",{className:"iconfont icon-xiala"})),Ue===2&&I.a.createElement("span",{onClick:function(){return we(1)}},"\u6536\u8D77",I.a.createElement("i",{style:{transform:"scale(0.5) rotate(180deg) translateY(2px)"},className:"iconfont icon-xiala"})))),r&&I.a.createElement("div",{className:T.a.content},I.a.createElement("span",{className:T.a.name},"\u77E5\u8BC6\u70B9:"),I.a.createElement("li",{className:"".concat(T.a.directionItem," ").concat(h===-1?T.a.active:""," "),onClick:function(){return pe(-1)}},"\u6211\u7684"),I.a.createElement("div",{className:T.a.directionContentWrap,style:{overflow:"hidden",height:Ke===1?88:"auto"}},g.map(function(xe){return I.a.createElement("li",{key:xe.id,className:"".concat(T.a.directionItem," ").concat(h===xe.id?T.a.active:""," "),onClick:function(){return pe(xe.id)}},xe.name)})),I.a.createElement("div",{ref:He,className:T.a.directionContentWrap,style:{height:"auto",position:"fixed",left:0,top:0,width:1010,visibility:"hidden"}},g.map(function(xe){return I.a.createElement("li",{key:xe.id,className:"".concat(T.a.directionItem," ").concat(h===xe.id?T.a.active:""," "),onClick:function(){return pe(xe.id)}},xe.name)})),!!Ke&&I.a.createElement("div",{className:T.a.action},Ke===1&&I.a.createElement("span",{onClick:function(){return Fe(2)}},"\u5C55\u5F00",I.a.createElement("i",{className:"iconfont icon-xiala"})),Ke===2&&I.a.createElement("span",{onClick:function(){return Fe(1)}},"\u6536\u8D77",I.a.createElement("i",{style:{transform:"scale(0.5) rotate(180deg) translateY(2px)"},className:"iconfont icon-xiala"})))),H&&I.a.createElement("div",{className:T.a.content},I.a.createElement("span",{className:T.a.name},"\u9898\u578B:"),I.a.createElement("li",{className:"".concat(T.a.directionItem," ").concat(m?"":T.a.active," "),onClick:function(){return ve(null)}},"\u5168\u90E8"),I.a.createElement("div",{className:T.a.directionContentWrap},P.map(function(xe){return I.a.createElement("li",{key:xe.name,className:"".concat(T.a.directionItem," ").concat(m===xe.value?T.a.active:""," "),onClick:function(){return ve(xe.value)}},xe.name)}),U&&I.a.createElement("li",{key:"\u5B9E\u8BAD\u9898",className:T.a.directionItem,onClick:function(){return B()}},"\u5B9E\u8BAD\u9898"))),I.a.createElement("div",{className:T.a.content},I.a.createElement("span",{className:T.a.name},"\u96BE\u5EA6:"),I.a.createElement("li",{className:"".concat(T.a.directionItem," ").concat(v?"":T.a.active," "),onClick:function(){return q(null)}},"\u5168\u90E8"),I.a.createElement("div",{className:T.a.directionContentWrap},_.map(function(xe){return I.a.createElement("li",{key:xe.name,className:"".concat(T.a.directionItem," ").concat(v===xe.value?T.a.active:""," "),onClick:function(){return q(xe.value)}},xe.name)}))),i&&I.a.createElement("div",{className:T.a.content},I.a.createElement("span",{className:T.a.name},"\u7C7B\u578B:"),I.a.createElement("li",{className:"".concat(T.a.directionItem," ").concat(f?"":T.a.active," "),onClick:function(){return V(null)}},"\u5168\u90E8"),I.a.createElement("div",{className:T.a.directionContentWrap},S.map(function(xe){return I.a.createElement("li",{key:xe.name,className:"".concat(T.a.directionItem," ").concat(f===xe.value?T.a.active:""," "),onClick:function(){return V(xe.value)}},xe.name)})))))}},k3GJ:function(Pt,Ye,W){"use strict";W.d(Ye,"a",function(){return ia});var Ee=W("rePB"),j=W("ODXe"),w=W("Ff2n"),N=W("VTBJ"),E=W("q1tI"),R=W("TSYQ"),I=W.n(R),M=W("Zm9Q"),T=W("6cGi"),P=W("KQm4"),_=W("xEkU"),S=W.n(_),O=W("t23M");function C(ne){var me=Object(E.useRef)(),ue=Object(E.useRef)(!1);function ae(){for(var G=arguments.length,Y=new Array(G),z=0;z<G;z++)Y[z]=arguments[z];ue.current||(S.a.cancel(me.current),me.current=S()(function(){ne.apply(void 0,Y)}))}return Object(E.useEffect)(function(){return function(){ue.current=!0,S.a.cancel(me.current)}},[]),ae}function x(ne){var me=Object(E.useRef)([]),ue=Object(E.useState)({}),ae=Object(j.a)(ue,2),G=ae[1],Y=Object(E.useRef)(typeof ne=="function"?ne():ne),z=C(function(){var le=Y.current;me.current.forEach(function(_e){le=_e(le)}),me.current=[],Y.current=le,G({})});function se(le){me.current.push(le),z()}return[Y.current,se]}var b=W("4IlW");function p(ne,me){var ue,ae=ne.prefixCls,G=ne.id,Y=ne.active,z=ne.rtl,se=ne.tab,le=se.key,_e=se.tab,be=se.disabled,Se=se.closeIcon,Ie=ne.tabBarGutter,nt=ne.tabPosition,et=ne.closable,ct=ne.renderWrapper,Yt=ne.removeAriaLabel,dn=ne.editable,en=ne.onClick,sn=ne.onRemove,cn=ne.onFocus,ln="".concat(ae,"-tab");E.useEffect(function(){return sn},[]);var nn={};nt==="top"||nt==="bottom"?nn[z?"marginLeft":"marginRight"]=Ie:nn.marginBottom=Ie;var mn=dn&&et!==!1&&!be;function hn($t){if(be)return;en($t)}function Xn($t){$t.preventDefault(),$t.stopPropagation(),dn.onEdit("remove",{key:le,event:$t})}var En=E.createElement("div",{key:le,ref:me,className:I()(ln,(ue={},Object(Ee.a)(ue,"".concat(ln,"-with-remove"),mn),Object(Ee.a)(ue,"".concat(ln,"-active"),Y),Object(Ee.a)(ue,"".concat(ln,"-disabled"),be),ue)),style:nn,onClick:hn},E.createElement("div",{role:"tab","aria-selected":Y,id:G&&"".concat(G,"-tab-").concat(le),className:"".concat(ln,"-btn"),"aria-controls":G&&"".concat(G,"-panel-").concat(le),"aria-disabled":be,tabIndex:be?null:0,onClick:function(Vt){Vt.stopPropagation(),hn(Vt)},onKeyDown:function(Vt){[b.a.SPACE,b.a.ENTER].includes(Vt.which)&&(Vt.preventDefault(),hn(Vt))},onFocus:cn},_e),mn&&E.createElement("button",{type:"button","aria-label":Yt||"remove",tabIndex:0,className:"".concat(ln,"-remove"),onClick:function(Vt){Vt.stopPropagation(),Xn(Vt)}},Se||dn.removeIcon||"\xD7"));return ct&&(En=ct(En)),En}var n=E.forwardRef(p),l={width:0,height:0,left:0,top:0};function s(ne,me,ue){return Object(E.useMemo)(function(){for(var ae,G=new Map,Y=me.get((ae=ne[0])===null||ae===void 0?void 0:ae.key)||l,z=Y.left+Y.width,se=0;se<ne.length;se+=1){var le=ne[se].key,_e=me.get(le);if(!_e){var be;_e=me.get((be=ne[se-1])===null||be===void 0?void 0:be.key)||l}var Se=G.get(le)||Object(N.a)({},_e);Se.right=z-Se.left-Se.width,G.set(le,Se)}return G},[ne.map(function(ae){return ae.key}).join("_"),me,ue])}var g={width:0,height:0,left:0,top:0,right:0};function d(ne,me,ue,ae,G){var Y=G.tabs,z=G.tabPosition,se=G.rtl,le,_e,be;["top","bottom"].includes(z)?(le="width",_e=se?"right":"left",be=Math.abs(me.left)):(le="height",_e="top",be=-me.top);var Se=me[le],Ie=ue[le],nt=ae[le],et=Se;return Ie+nt>Se&&(et=Se-nt),Object(E.useMemo)(function(){if(!Y.length)return[0,0];for(var ct=Y.length,Yt=ct,dn=0;dn<ct;dn+=1){var en=ne.get(Y[dn].key)||g;if(en[_e]+en[le]>be+et){Yt=dn-1;break}}for(var sn=0,cn=ct-1;cn>=0;cn-=1){var ln=ne.get(Y[cn].key)||g;if(ln[_e]<be){sn=cn+1;break}}return[sn,Yt]},[ne,be,et,z,Y.map(function(ct){return ct.key}).join("_"),se])}var u=W("wx14"),m=W("1OyB"),h=W("vuIU"),a=W("JX7q"),r=W("Ji7U"),e=W("LK+K"),i=W("I8Z2"),v=W("bT9E"),f=W("2GS6"),y=W("Gytx"),t=W.n(y),A=W("U8pU"),U=/iPhone/i,F=/iPod/i,H=/iPad/i,J=/\bAndroid(?:.+)Mobile\b/i,B=/Android/i,Z=/\bAndroid(?:.+)SD4930UR\b/i,re=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,ie=/Windows Phone/i,ve=/\bWindows(?:.+)ARM\b/i,de=/BlackBerry/i,q=/BB10/i,ee=/Opera Mini/i,pe=/\b(CriOS|Chrome)(?:.+)Mobile/i,Q=/Mobile(?:.+)Firefox\b/i;function V(ne,me){return ne.test(me)}function Ce(ne){var me=ne||(typeof navigator!="undefined"?navigator.userAgent:""),ue=(me||"").split("[FBAN");if(typeof ue[1]!="undefined"){var ae=ue,G=Object(j.a)(ae,1);me=G[0]}if(ue=me.split("Twitter"),typeof ue[1]!="undefined"){var Y=ue,z=Object(j.a)(Y,1);me=z[0]}var se={apple:{phone:V(U,me)&&!V(ie,me),ipod:V(F,me),tablet:!V(U,me)&&V(H,me)&&!V(ie,me),device:(V(U,me)||V(F,me)||V(H,me))&&!V(ie,me)},amazon:{phone:V(Z,me),tablet:!V(Z,me)&&V(re,me),device:V(Z,me)||V(re,me)},android:{phone:!V(ie,me)&&V(Z,me)||!V(ie,me)&&V(J,me),tablet:!V(ie,me)&&!V(Z,me)&&!V(J,me)&&(V(re,me)||V(B,me)),device:!V(ie,me)&&(V(Z,me)||V(re,me)||V(J,me)||V(B,me))||V(/\bokhttp\b/i,me)},windows:{phone:V(ie,me),tablet:V(ve,me),device:V(ie,me)||V(ve,me)},other:{blackberry:V(de,me),blackberry10:V(q,me),opera:V(ee,me),firefox:V(Q,me),chrome:V(pe,me),device:V(de,me)||V(q,me)||V(ee,me)||V(Q,me)||V(pe,me)},any:null,phone:null,tablet:null};return se.any=se.apple.device||se.android.device||se.windows.device||se.other.device,se.phone=se.apple.phone||se.android.phone||se.windows.phone,se.tablet=se.apple.tablet||se.android.tablet||se.windows.tablet,se}var ke=Object(N.a)(Object(N.a)({},Ce()),{},{isMobile:Ce}),Ue=ke;function we(){}function De(ne,me,ue){var ae=me||"";return ne.key||"".concat(ae,"item_").concat(ue)}function Oe(ne){return"".concat(ne,"-menu-")}function Le(ne,me){var ue=-1;E.Children.forEach(ne,function(ae){ue+=1,ae&&ae.type&&ae.type.isMenuItemGroup?E.Children.forEach(ae.props.children,function(G){ue+=1,me(G,ue)}):me(ae,ue)})}function Ke(ne,me,ue){if(!ne||ue.find)return;E.Children.forEach(ne,function(ae){if(ae){var G=ae.type;if(!G||!(G.isSubMenu||G.isMenuItem||G.isMenuItemGroup))return;me.indexOf(ae.key)!==-1?ue.find=!0:ae.props.children&&Ke(ae.props.children,me,ue)}})}var Fe=["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"],He=function(me){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ae=me&&typeof me.getBoundingClientRect=="function"&&me.getBoundingClientRect().width;if(ae){if(ue){var G=getComputedStyle(me),Y=G.marginLeft,z=G.marginRight;ae+=+Y.replace("px","")+ +z.replace("px","")}ae=+ae.toFixed(6)}return ae||0},Ne=function(me,ue,ae){me&&Object(A.a)(me.style)==="object"&&(me.style[ue]=ae)},xe=function(){return Ue.any},Ge=W("bdgK"),qe=W("i8i4"),lt=W.n(qe),ot=W("wgJM"),bt=W("l4aY"),ht=W("m+aA"),ut=W("c+Xe"),Ze=W("zT1h"),Et=W("QC+M");function St(ne,me,ue){return ue?ne[0]===me[0]:ne[0]===me[0]&&ne[1]===me[1]}function We(ne,me,ue){var ae=ne[me]||{};return Object(N.a)(Object(N.a)({},ae),ue)}function it(ne,me,ue,ae){for(var G=ue.points,Y=Object.keys(ne),z=0;z<Y.length;z+=1){var se=Y[z];if(St(ne[se].points,G,ae))return"".concat(me,"-placement-").concat(se)}return""}var ye=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var ne=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(ne)||/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(ne==null?void 0:ne.substr(0,4)))},he=W("MNnm");function fe(ne,me){var ue={};return ue[ne.toLowerCase()]=me.toLowerCase(),ue["Webkit".concat(ne)]="webkit".concat(me),ue["Moz".concat(ne)]="moz".concat(me),ue["ms".concat(ne)]="MS".concat(me),ue["O".concat(ne)]="o".concat(me.toLowerCase()),ue}function X(ne,me){var ue={animationend:fe("Animation","AnimationEnd"),transitionend:fe("Transition","TransitionEnd")};return ne&&("AnimationEvent"in me||delete ue.animationend.animation,"TransitionEvent"in me||delete ue.transitionend.transition),ue}var $=X(Object(he.a)(),typeof window!="undefined"?window:{}),te={};if(Object(he.a)()){var oe=document.createElement("div");te=oe.style}var Te={};function Pe(ne){if(Te[ne])return Te[ne];var me=$[ne];if(me)for(var ue=Object.keys(me),ae=ue.length,G=0;G<ae;G+=1){var Y=ue[G];if(Object.prototype.hasOwnProperty.call(me,Y)&&Y in te)return Te[ne]=me[Y],Te[ne]}return""}var Je=Pe("animationend"),Wt=Pe("transitionend"),Zt=!!(Je&&Wt),Xt=Je||"animationend",an=Wt||"transitionend";function fn(ne,me){if(!ne)return null;if(Object(A.a)(ne)==="object"){var ue=me.replace(/-\w/g,function(ae){return ae[1].toUpperCase()});return ne[ue]}return"".concat(ne,"-").concat(me)}var It="none",Kn="appear",Sn="enter",Jn="leave",Dn="none",on="prepare",qn="start",Ft="active",Lt="end";function Rr(ne){var me=Object(E.useRef)(!1),ue=Object(E.useState)(ne),ae=Object(j.a)(ue,2),G=ae[0],Y=ae[1];function z(se){me.current||Y(se)}return Object(E.useEffect)(function(){return function(){me.current=!0}},[]),[G,z]}var kn=Object(he.a)()?E.useLayoutEffect:E.useEffect,Wn=kn,Vr=function(){var ne=E.useRef(null);function me(){ot.a.cancel(ne.current)}function ue(ae){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;me();var Y=Object(ot.a)(function(){G<=1?ae({isCanceled:function(){return Y!==ne.current}}):ue(ae,G-1)});ne.current=Y}return E.useEffect(function(){return function(){me()}},[]),[ue,me]},br=[on,qn,Ft,Lt],Pr=!1,nr=!0;function dr(ne){return ne===Ft||ne===Lt}var Ur=function(ne,me){var ue=E.useState(Dn),ae=Object(j.a)(ue,2),G=ae[0],Y=ae[1],z=Vr(),se=Object(j.a)(z,2),le=se[0],_e=se[1];function be(){Y(on)}return Wn(function(){if(G!==Dn&&G!==Lt){var Se=br.indexOf(G),Ie=br[Se+1],nt=me(G);nt===Pr?Y(Ie):le(function(et){function ct(){if(et.isCanceled())return;Y(Ie)}nt===!0?ct():Promise.resolve(nt).then(ct)})}},[ne,G]),E.useEffect(function(){return function(){_e()}},[]),[be,G]},Ar=function(ne){var me=Object(E.useRef)(),ue=Object(E.useRef)(ne);ue.current=ne;var ae=E.useCallback(function(z){ue.current(z)},[]);function G(z){z&&(z.removeEventListener(an,ae),z.removeEventListener(Xt,ae))}function Y(z){me.current&&me.current!==z&&G(me.current),z&&z!==me.current&&(z.addEventListener(an,ae),z.addEventListener(Xt,ae),me.current=z)}return E.useEffect(function(){return function(){G(me.current)}},[]),[Y,G]};function ua(ne,me,ue,ae){var G=ae.motionEnter,Y=G===void 0?!0:G,z=ae.motionAppear,se=z===void 0?!0:z,le=ae.motionLeave,_e=le===void 0?!0:le,be=ae.motionDeadline,Se=ae.motionLeaveImmediately,Ie=ae.onAppearPrepare,nt=ae.onEnterPrepare,et=ae.onLeavePrepare,ct=ae.onAppearStart,Yt=ae.onEnterStart,dn=ae.onLeaveStart,en=ae.onAppearActive,sn=ae.onEnterActive,cn=ae.onLeaveActive,ln=ae.onAppearEnd,nn=ae.onEnterEnd,mn=ae.onLeaveEnd,hn=ae.onVisibleChanged,Xn=Rr(),En=Object(j.a)(Xn,2),$t=En[0],Vt=En[1],vn=Rr(It),pn=Object(j.a)(vn,2),Mt=pn[0],Cn=pn[1],Fn=Rr(null),qt=Object(j.a)(Fn,2),gn=qt[0],Gn=qt[1],hr=Object(E.useRef)(!1),Sr=Object(E.useRef)(null),Qn=Object(E.useRef)(!1),wr=Object(E.useRef)(null);function Kr(){var Mn=ue();return Mn||wr.current}var Dr=Object(E.useRef)(!1);function kr(Mn){var Tn=Kr();if(Mn&&!Mn.deadline&&Mn.target!==Tn)return;var lr;Mt===Kn&&Dr.current?lr=ln==null?void 0:ln(Tn,Mn):Mt===Sn&&Dr.current?lr=nn==null?void 0:nn(Tn,Mn):Mt===Jn&&Dr.current&&(lr=mn==null?void 0:mn(Tn,Mn)),lr!==!1&&!Qn.current&&(Cn(It),Gn(null))}var rn=Ar(kr),fr=Object(j.a)(rn,1),sr=fr[0],er=E.useMemo(function(){var Mn,Tn,lr;switch(Mt){case"appear":return Mn={},Object(Ee.a)(Mn,on,Ie),Object(Ee.a)(Mn,qn,ct),Object(Ee.a)(Mn,Ft,en),Mn;case"enter":return Tn={},Object(Ee.a)(Tn,on,nt),Object(Ee.a)(Tn,qn,Yt),Object(Ee.a)(Tn,Ft,sn),Tn;case"leave":return lr={},Object(Ee.a)(lr,on,et),Object(Ee.a)(lr,qn,dn),Object(Ee.a)(lr,Ft,cn),lr;default:return{}}},[Mt]),Wr=Ur(Mt,function(Mn){if(Mn===on){var Tn=er[on];return Tn?Tn(Kr()):Pr}if(Ln in er){var lr;Gn(((lr=er[Ln])===null||lr===void 0?void 0:lr.call(er,Kr(),null))||null)}return Ln===Ft&&(sr(Kr()),be>0&&(clearTimeout(Sr.current),Sr.current=setTimeout(function(){kr({deadline:!0})},be))),nr}),Hr=Object(j.a)(Wr,2),$r=Hr[0],Ln=Hr[1],Ir=dr(Ln);Dr.current=Ir,Wn(function(){Vt(me);var Mn=hr.current;if(hr.current=!0,!ne)return;var Tn;!Mn&&me&&se&&(Tn=Kn),Mn&&me&&Y&&(Tn=Sn),(Mn&&!me&&_e||!Mn&&Se&&!me&&_e)&&(Tn=Jn),Tn&&(Cn(Tn),$r())},[me]),Object(E.useEffect)(function(){(Mt===Kn&&!se||Mt===Sn&&!Y||Mt===Jn&&!_e)&&Cn(It)},[se,Y,_e]),Object(E.useEffect)(function(){return function(){clearTimeout(Sr.current),Qn.current=!0}},[]),Object(E.useEffect)(function(){$t!==void 0&&Mt===It&&(hn==null||hn($t))},[$t,Mt]);var Xr=gn;return er[on]&&Ln===qn&&(Xr=Object(N.a)({transition:"none"},Xr)),[Mt,Ln,Xr,$t!=null?$t:me]}var Er=function(ne){Object(r.a)(ue,ne);var me=Object(e.a)(ue);function ue(){return Object(m.a)(this,ue),me.apply(this,arguments)}return Object(h.a)(ue,[{key:"render",value:function(){return this.props.children}}]),ue}(E.Component),ya=Er;function da(ne){var me=ne;Object(A.a)(ne)==="object"&&(me=ne.transitionSupport);function ue(G){return!!(G.motionName&&me)}var ae=E.forwardRef(function(G,Y){var z=G.visible,se=z===void 0?!0:z,le=G.removeOnLeave,_e=le===void 0?!0:le,be=G.forceRender,Se=G.children,Ie=G.motionName,nt=G.leavedClassName,et=G.eventProps,ct=ue(G),Yt=Object(E.useRef)(),dn=Object(E.useRef)();function en(){try{return Object(ht.a)(Yt.current||dn.current)}catch(Cn){return null}}var sn=ua(ct,se,en,G),cn=Object(j.a)(sn,4),ln=cn[0],nn=cn[1],mn=cn[2],hn=cn[3],Xn=E.useRef(hn);hn&&(Xn.current=!0);var En=Object(E.useRef)(Y);En.current=Y;var $t=E.useCallback(function(Cn){Yt.current=Cn,Object(ut.b)(En.current,Cn)},[]),Vt,vn=Object(N.a)(Object(N.a)({},et),{},{visible:se});if(!Se)Vt=null;else if(ln===It||!ue(G))hn?Vt=Se(Object(N.a)({},vn),$t):!_e&&Xn.current?Vt=Se(Object(N.a)(Object(N.a)({},vn),{},{className:nt}),$t):be?Vt=Se(Object(N.a)(Object(N.a)({},vn),{},{style:{display:"none"}}),$t):Vt=null;else{var pn,Mt;nn===on?Mt="prepare":dr(nn)?Mt="active":nn===qn&&(Mt="start"),Vt=Se(Object(N.a)(Object(N.a)({},vn),{},{className:I()(fn(Ie,ln),(pn={},Object(Ee.a)(pn,fn(Ie,"".concat(ln,"-").concat(Mt)),Mt),Object(Ee.a)(pn,Ie,typeof Ie=="string"),pn)),style:mn}),$t)}return E.createElement(ya,{ref:dn},Vt)});return ae.displayName="CSSMotion",ae}var ba=da(Zt),ra="add",ca="keep",Zr="remove",Ea="removed";function ha(ne){var me;return ne&&Object(A.a)(ne)==="object"&&"key"in ne?me=ne:me={key:ne},Object(N.a)(Object(N.a)({},me),{},{key:String(me.key)})}function _a(){var ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return ne.map(ha)}function L(){var ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],ue=[],ae=0,G=me.length,Y=_a(ne),z=_a(me);Y.forEach(function(_e){for(var be=!1,Se=ae;Se<G;Se+=1){var Ie=z[Se];if(Ie.key===_e.key){ae<Se&&(ue=ue.concat(z.slice(ae,Se).map(function(nt){return Object(N.a)(Object(N.a)({},nt),{},{status:ra})})),ae=Se),ue.push(Object(N.a)(Object(N.a)({},Ie),{},{status:ca})),ae+=1,be=!0;break}}be||ue.push(Object(N.a)(Object(N.a)({},_e),{},{status:Zr}))}),ae<G&&(ue=ue.concat(z.slice(ae).map(function(_e){return Object(N.a)(Object(N.a)({},_e),{},{status:ra})})));var se={};ue.forEach(function(_e){var be=_e.key;se[be]=(se[be]||0)+1});var le=Object.keys(se).filter(function(_e){return se[_e]>1});return le.forEach(function(_e){ue=ue.filter(function(be){var Se=be.key,Ie=be.status;return Se!==_e||Ie!==Zr}),ue.forEach(function(be){be.key===_e&&(be.status=ca)})}),ue}var o=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function c(ne){var me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ba,ue=function(ae){Object(r.a)(Y,ae);var G=Object(e.a)(Y);function Y(){var z;return Object(m.a)(this,Y),z=G.apply(this,arguments),z.state={keyEntities:[]},z.removeKey=function(se){z.setState(function(le){var _e=le.keyEntities;return{keyEntities:_e.map(function(be){return be.key!==se?be:Object(N.a)(Object(N.a)({},be),{},{status:Ea})})}})},z}return Object(h.a)(Y,[{key:"render",value:function(){var se=this,le=this.state.keyEntities,_e=this.props,be=_e.component,Se=_e.children,Ie=_e.onVisibleChanged,nt=Object(w.a)(_e,["component","children","onVisibleChanged"]),et=be||E.Fragment,ct={};return o.forEach(function(Yt){ct[Yt]=nt[Yt],delete nt[Yt]}),delete nt.keys,E.createElement(et,nt,le.map(function(Yt){var dn=Yt.status,en=Object(w.a)(Yt,["status"]),sn=dn===ra||dn===ca;return E.createElement(me,Object(u.a)({},ct,{key:en.key,visible:sn,eventProps:en,onVisibleChanged:function(ln){Ie==null||Ie(ln,{key:en.key}),ln||se.removeKey(en.key)}}),Se)}))}}],[{key:"getDerivedStateFromProps",value:function(se,le){var _e=se.keys,be=le.keyEntities,Se=_a(_e),Ie=L(be,Se);return{keyEntities:Ie.filter(function(nt){var et=be.find(function(ct){var Yt=ct.key;return nt.key===Yt});return!(et&&et.status===Ea&&nt.status===Zr)})}}}]),Y}(E.Component);return ue.defaultProps={component:"div"},ue}var D=c(Zt),K=ba;function k(ne){var me=ne.prefixCls,ue=ne.motion,ae=ne.animation,G=ne.transitionName;return ue||(ae?{motionName:"".concat(me,"-").concat(ae)}:G?{motionName:G}:null)}function ce(ne){var me=ne.prefixCls,ue=ne.visible,ae=ne.zIndex,G=ne.mask,Y=ne.maskMotion,z=ne.maskAnimation,se=ne.maskTransitionName;if(!G)return null;var le={};return(Y||se||z)&&(le=Object(N.a)({motionAppear:!0},k({motion:Y,prefixCls:me,transitionName:se,animation:z}))),E.createElement(K,Object(u.a)({},le,{visible:ue,removeOnLeave:!0}),function(_e){var be=_e.className;return E.createElement("div",{style:{zIndex:ae},className:I()("".concat(me,"-mask"),be)})})}var ze=W("9mu1"),gt=W("o0o1"),Nt=W.n(gt),Xe=W("HaE+"),Jt=["measure","align",null,"motion"],Pn=function(ne,me){var ue=Object(E.useState)(null),ae=Object(j.a)(ue,2),G=ae[0],Y=ae[1],z=Object(E.useRef)(),se=Object(E.useRef)(!1);function le(Se){se.current||Y(Se)}function _e(){ot.a.cancel(z.current)}function be(Se){_e(),z.current=Object(ot.a)(function(){le(function(Ie){switch(G){case"align":return"motion";case"motion":return"stable";default:}return Ie}),Se==null||Se()})}return Object(E.useEffect)(function(){le("measure")},[ne]),Object(E.useEffect)(function(){switch(G){case"measure":me();break;default:}G&&(z.current=Object(ot.a)(Object(Xe.a)(Nt.a.mark(function Se(){var Ie,nt;return Nt.a.wrap(function(ct){for(;;)switch(ct.prev=ct.next){case 0:Ie=Jt.indexOf(G),nt=Jt[Ie+1],nt&&Ie!==-1&&le(nt);case 3:case"end":return ct.stop()}},Se)}))))},[G]),Object(E.useEffect)(function(){return function(){se.current=!0,_e()}},[]),[G,be]},Bn=function(ne){var me=E.useState({width:0,height:0}),ue=Object(j.a)(me,2),ae=ue[0],G=ue[1];function Y(se){G({width:se.offsetWidth,height:se.offsetHeight})}var z=E.useMemo(function(){var se={};if(ne){var le=ae.width,_e=ae.height;ne.indexOf("height")!==-1&&_e?se.height=_e:ne.indexOf("minHeight")!==-1&&_e&&(se.minHeight=_e),ne.indexOf("width")!==-1&&le?se.width=le:ne.indexOf("minWidth")!==-1&&le&&(se.minWidth=le)}return se},[ne,ae]);return[z,Y]},jr=E.forwardRef(function(ne,me){var ue=ne.visible,ae=ne.prefixCls,G=ne.className,Y=ne.style,z=ne.children,se=ne.zIndex,le=ne.stretch,_e=ne.destroyPopupOnHide,be=ne.forceRender,Se=ne.align,Ie=ne.point,nt=ne.getRootDomNode,et=ne.getClassNameFromAlign,ct=ne.onAlign,Yt=ne.onMouseEnter,dn=ne.onMouseLeave,en=ne.onMouseDown,sn=ne.onTouchStart,cn=Object(E.useRef)(),ln=Object(E.useRef)(),nn=Object(E.useState)(),mn=Object(j.a)(nn,2),hn=mn[0],Xn=mn[1],En=Bn(le),$t=Object(j.a)(En,2),Vt=$t[0],vn=$t[1];function pn(){le&&vn(nt())}var Mt=Pn(ue,pn),Cn=Object(j.a)(Mt,2),Fn=Cn[0],qt=Cn[1],gn=Object(E.useRef)();function Gn(){return Ie||nt}function hr(){var rn;(rn=cn.current)===null||rn===void 0||rn.forceAlign()}function Sr(rn,fr){var sr=et(fr);hn!==sr&&Xn(sr),Fn==="align"&&(hn!==sr?Promise.resolve().then(function(){hr()}):qt(function(){var er;(er=gn.current)===null||er===void 0||er.call(gn)}),ct==null||ct(rn,fr))}var Qn=Object(N.a)({},k(ne));["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach(function(rn){var fr=Qn[rn];Qn[rn]=function(sr,er){return qt(),fr==null?void 0:fr(sr,er)}});function wr(){return new Promise(function(rn){gn.current=rn})}E.useEffect(function(){!Qn.motionName&&Fn==="motion"&&qt()},[Qn.motionName,Fn]),E.useImperativeHandle(me,function(){return{forceAlign:hr,getElement:function(){return ln.current}}});var Kr=Object(N.a)(Object(N.a)({},Vt),{},{zIndex:se,opacity:Fn==="motion"||Fn==="stable"||!ue?void 0:0,pointerEvents:Fn==="stable"?void 0:"none"},Y),Dr=!0;(Se==null?void 0:Se.points)&&(Fn==="align"||Fn==="stable")&&(Dr=!1);var kr=z;return E.Children.count(z)>1&&(kr=E.createElement("div",{className:"".concat(ae,"-content")},z)),E.createElement(K,Object(u.a)({visible:ue,ref:ln,leavedClassName:"".concat(ae,"-hidden")},Qn,{onAppearPrepare:wr,onEnterPrepare:wr,removeOnLeave:_e,forceRender:be}),function(rn,fr){var sr=rn.className,er=rn.style,Wr=I()(ae,G,hn,sr);return E.createElement(ze.a,{target:Gn(),key:"popup",ref:cn,monitorWindowResize:!0,disabled:Dr,align:Se,onAlign:Sr},E.createElement("div",{ref:fr,className:Wr,onMouseEnter:Yt,onMouseLeave:dn,onMouseDownCapture:en,onTouchStartCapture:sn,style:Object(N.a)(Object(N.a)({},er),Kr)},kr))})});jr.displayName="PopupInner";var Dt=jr,Re=E.forwardRef(function(ne,me){var ue=ne.prefixCls,ae=ne.visible,G=ne.zIndex,Y=ne.children,z=ne.mobile;z=z===void 0?{}:z;var se=z.popupClassName,le=z.popupStyle,_e=z.popupMotion,be=_e===void 0?{}:_e,Se=z.popupRender,Ie=E.useRef();E.useImperativeHandle(me,function(){return{forceAlign:function(){},getElement:function(){return Ie.current}}});var nt=Object(N.a)({zIndex:G},le),et=Y;return E.Children.count(Y)>1&&(et=E.createElement("div",{className:"".concat(ue,"-content")},Y)),Se&&(et=Se(et)),E.createElement(K,Object(u.a)({visible:ae,ref:Ie,removeOnLeave:!0},be),function(ct,Yt){var dn=ct.className,en=ct.style,sn=I()(ue,se,dn);return E.createElement("div",{ref:Yt,className:sn,style:Object(N.a)(Object(N.a)({},en),nt)},et)})});Re.displayName="MobilePopupInner";var rt=Re,Ve=["visible","mobile"],Qe=E.forwardRef(function(ne,me){var ue=ne.visible,ae=ne.mobile,G=Object(w.a)(ne,Ve),Y=Object(E.useState)(ue),z=Object(j.a)(Y,2),se=z[0],le=z[1],_e=Object(E.useState)(!1),be=Object(j.a)(_e,2),Se=be[0],Ie=be[1],nt=Object(N.a)(Object(N.a)({},G),{},{visible:se});Object(E.useEffect)(function(){le(ue),ue&&ae&&Ie(ye())},[ue,ae]);var et=Se?E.createElement(rt,Object(u.a)({},nt,{mobile:ae,ref:me})):E.createElement(Dt,Object(u.a)({},nt,{ref:me}));return E.createElement("div",null,E.createElement(ce,nt),et)});Qe.displayName="Popup";var Ht=Qe,Ut=E.createContext(null),kt=Ut;function wt(){}function mt(){return""}function Rt(ne){return ne?ne.ownerDocument:window.document}var _t=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];function Kt(ne){var me=function(ue){Object(r.a)(G,ue);var ae=Object(e.a)(G);function G(Y){var z;Object(m.a)(this,G),z=ae.call(this,Y),z.popupRef=E.createRef(),z.triggerRef=E.createRef(),z.attachId=void 0,z.clickOutsideHandler=void 0,z.touchOutsideHandler=void 0,z.contextMenuOutsideHandler1=void 0,z.contextMenuOutsideHandler2=void 0,z.mouseDownTimeout=void 0,z.focusTime=void 0,z.preClickTime=void 0,z.preTouchTime=void 0,z.delayTimer=void 0,z.hasPopupMouseDown=void 0,z.onMouseEnter=function(le){var _e=z.props.mouseEnterDelay;z.fireEvents("onMouseEnter",le),z.delaySetPopupVisible(!0,_e,_e?null:le)},z.onMouseMove=function(le){z.fireEvents("onMouseMove",le),z.setPoint(le)},z.onMouseLeave=function(le){z.fireEvents("onMouseLeave",le),z.delaySetPopupVisible(!1,z.props.mouseLeaveDelay)},z.onPopupMouseEnter=function(){z.clearDelayTimer()},z.onPopupMouseLeave=function(le){var _e;if(le.relatedTarget&&!le.relatedTarget.setTimeout&&Object(bt.a)((_e=z.popupRef.current)===null||_e===void 0?void 0:_e.getElement(),le.relatedTarget))return;z.delaySetPopupVisible(!1,z.props.mouseLeaveDelay)},z.onFocus=function(le){z.fireEvents("onFocus",le),z.clearDelayTimer(),z.isFocusToShow()&&(z.focusTime=Date.now(),z.delaySetPopupVisible(!0,z.props.focusDelay))},z.onMouseDown=function(le){z.fireEvents("onMouseDown",le),z.preClickTime=Date.now()},z.onTouchStart=function(le){z.fireEvents("onTouchStart",le),z.preTouchTime=Date.now()},z.onBlur=function(le){z.fireEvents("onBlur",le),z.clearDelayTimer(),z.isBlurToHide()&&z.delaySetPopupVisible(!1,z.props.blurDelay)},z.onContextMenu=function(le){le.preventDefault(),z.fireEvents("onContextMenu",le),z.setPopupVisible(!0,le)},z.onContextMenuClose=function(){z.isContextMenuToShow()&&z.close()},z.onClick=function(le){if(z.fireEvents("onClick",le),z.focusTime){var _e;if(z.preClickTime&&z.preTouchTime?_e=Math.min(z.preClickTime,z.preTouchTime):z.preClickTime?_e=z.preClickTime:z.preTouchTime&&(_e=z.preTouchTime),Math.abs(_e-z.focusTime)<20)return;z.focusTime=0}z.preClickTime=0,z.preTouchTime=0,z.isClickToShow()&&(z.isClickToHide()||z.isBlurToHide())&&le&&le.preventDefault&&le.preventDefault();var be=!z.state.popupVisible;(z.isClickToHide()&&!be||be&&z.isClickToShow())&&z.setPopupVisible(!z.state.popupVisible,le)},z.onPopupMouseDown=function(){if(z.hasPopupMouseDown=!0,clearTimeout(z.mouseDownTimeout),z.mouseDownTimeout=window.setTimeout(function(){z.hasPopupMouseDown=!1},0),z.context){var le;(le=z.context).onPopupMouseDown.apply(le,arguments)}},z.onDocumentClick=function(le){if(z.props.mask&&!z.props.maskClosable)return;var _e=le.target,be=z.getRootDomNode(),Se=z.getPopupDomNode();(!Object(bt.a)(be,_e)||z.isContextMenuOnly())&&!Object(bt.a)(Se,_e)&&!z.hasPopupMouseDown&&z.close()},z.getRootDomNode=function(){var le=z.props.getTriggerDOMNode;if(le)return le(z.triggerRef.current);try{var _e=Object(ht.a)(z.triggerRef.current);if(_e)return _e}catch(be){}return lt.a.findDOMNode(Object(a.a)(z))},z.getPopupClassNameFromAlign=function(le){var _e=[],be=z.props,Se=be.popupPlacement,Ie=be.builtinPlacements,nt=be.prefixCls,et=be.alignPoint,ct=be.getPopupClassNameFromAlign;return Se&&Ie&&_e.push(it(Ie,nt,le,et)),ct&&_e.push(ct(le)),_e.join(" ")},z.getComponent=function(){var le=z.props,_e=le.prefixCls,be=le.destroyPopupOnHide,Se=le.popupClassName,Ie=le.onPopupAlign,nt=le.popupMotion,et=le.popupAnimation,ct=le.popupTransitionName,Yt=le.popupStyle,dn=le.mask,en=le.maskAnimation,sn=le.maskTransitionName,cn=le.maskMotion,ln=le.zIndex,nn=le.popup,mn=le.stretch,hn=le.alignPoint,Xn=le.mobile,En=le.forceRender,$t=z.state,Vt=$t.popupVisible,vn=$t.point,pn=z.getPopupAlign(),Mt={};return z.isMouseEnterToShow()&&(Mt.onMouseEnter=z.onPopupMouseEnter),z.isMouseLeaveToHide()&&(Mt.onMouseLeave=z.onPopupMouseLeave),Mt.onMouseDown=z.onPopupMouseDown,Mt.onTouchStart=z.onPopupMouseDown,E.createElement(Ht,Object(u.a)({prefixCls:_e,destroyPopupOnHide:be,visible:Vt,point:hn&&vn,className:Se,align:pn,onAlign:Ie,animation:et,getClassNameFromAlign:z.getPopupClassNameFromAlign},Mt,{stretch:mn,getRootDomNode:z.getRootDomNode,style:Yt,mask:dn,zIndex:ln,transitionName:ct,maskAnimation:en,maskTransitionName:sn,maskMotion:cn,ref:z.popupRef,motion:nt,mobile:Xn,forceRender:En}),typeof nn=="function"?nn():nn)},z.attachParent=function(le){ot.a.cancel(z.attachId);var _e=z.props,be=_e.getPopupContainer,Se=_e.getDocument,Ie=z.getRootDomNode(),nt;be?(Ie||be.length===0)&&(nt=be(Ie)):nt=Se(z.getRootDomNode()).body,nt?nt.appendChild(le):z.attachId=Object(ot.a)(function(){z.attachParent(le)})},z.getContainer=function(){var le=z.props.getDocument,_e=le(z.getRootDomNode()).createElement("div");return _e.style.position="absolute",_e.style.top="0",_e.style.left="0",_e.style.width="100%",z.attachParent(_e),_e},z.setPoint=function(le){var _e=z.props.alignPoint;if(!_e||!le)return;z.setState({point:{pageX:le.pageX,pageY:le.pageY}})},z.handlePortalUpdate=function(){z.state.prevPopupVisible!==z.state.popupVisible&&z.props.afterPopupVisibleChange(z.state.popupVisible)},z.triggerContextValue={onPopupMouseDown:z.onPopupMouseDown};var se;return"popupVisible"in Y?se=!!Y.popupVisible:se=!!Y.defaultPopupVisible,z.state={prevPopupVisible:se,popupVisible:se},_t.forEach(function(le){z["fire".concat(le)]=function(_e){z.fireEvents(le,_e)}}),z}return Object(h.a)(G,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var z=this.props,se=this.state;if(se.popupVisible){var le;!this.clickOutsideHandler&&(this.isClickToHide()||this.isContextMenuToShow())&&(le=z.getDocument(this.getRootDomNode()),this.clickOutsideHandler=Object(Ze.a)(le,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(le=le||z.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Object(Ze.a)(le,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(le=le||z.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=Object(Ze.a)(le,"scroll",this.onContextMenuClose)),!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=Object(Ze.a)(window,"blur",this.onContextMenuClose));return}this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),ot.a.cancel(this.attachId)}},{key:"getPopupDomNode",value:function(){var z;return((z=this.popupRef.current)===null||z===void 0?void 0:z.getElement())||null}},{key:"getPopupAlign",value:function(){var z=this.props,se=z.popupPlacement,le=z.popupAlign,_e=z.builtinPlacements;return se&&_e?We(_e,se,le):le}},{key:"setPopupVisible",value:function(z,se){var le=this.props.alignPoint,_e=this.state.popupVisible;this.clearDelayTimer(),_e!==z&&("popupVisible"in this.props||this.setState({popupVisible:z,prevPopupVisible:_e}),this.props.onPopupVisibleChange(z)),le&&se&&z&&this.setPoint(se)}},{key:"delaySetPopupVisible",value:function(z,se,le){var _e=this,be=se*1e3;if(this.clearDelayTimer(),be){var Se=le?{pageX:le.pageX,pageY:le.pageY}:null;this.delayTimer=window.setTimeout(function(){_e.setPopupVisible(z,Se),_e.clearDelayTimer()},be)}else this.setPopupVisible(z,le)}},{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(z){var se=this.props.children.props,le=this.props;return se[z]&&le[z]?this["fire".concat(z)]:se[z]||le[z]}},{key:"isClickToShow",value:function(){var z=this.props,se=z.action,le=z.showAction;return se.indexOf("click")!==-1||le.indexOf("click")!==-1}},{key:"isContextMenuOnly",value:function(){var z=this.props.action;return z==="contextMenu"||z.length===1&&z[0]==="contextMenu"}},{key:"isContextMenuToShow",value:function(){var z=this.props,se=z.action,le=z.showAction;return se.indexOf("contextMenu")!==-1||le.indexOf("contextMenu")!==-1}},{key:"isClickToHide",value:function(){var z=this.props,se=z.action,le=z.hideAction;return se.indexOf("click")!==-1||le.indexOf("click")!==-1}},{key:"isMouseEnterToShow",value:function(){var z=this.props,se=z.action,le=z.showAction;return se.indexOf("hover")!==-1||le.indexOf("mouseEnter")!==-1}},{key:"isMouseLeaveToHide",value:function(){var z=this.props,se=z.action,le=z.hideAction;return se.indexOf("hover")!==-1||le.indexOf("mouseLeave")!==-1}},{key:"isFocusToShow",value:function(){var z=this.props,se=z.action,le=z.showAction;return se.indexOf("focus")!==-1||le.indexOf("focus")!==-1}},{key:"isBlurToHide",value:function(){var z=this.props,se=z.action,le=z.hideAction;return se.indexOf("focus")!==-1||le.indexOf("blur")!==-1}},{key:"forcePopupAlign",value:function(){if(this.state.popupVisible){var z;(z=this.popupRef.current)===null||z===void 0||z.forceAlign()}}},{key:"fireEvents",value:function(z,se){var le=this.props.children.props[z];le&&le(se);var _e=this.props[z];_e&&_e(se)}},{key:"close",value:function(){this.setPopupVisible(!1)}},{key:"render",value:function(){var z=this.state.popupVisible,se=this.props,le=se.children,_e=se.forceRender,be=se.alignPoint,Se=se.className,Ie=se.autoDestroy,nt=E.Children.only(le),et={key:"trigger"};this.isContextMenuToShow()?et.onContextMenu=this.onContextMenu:et.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(et.onClick=this.onClick,et.onMouseDown=this.onMouseDown,et.onTouchStart=this.onTouchStart):(et.onClick=this.createTwoChains("onClick"),et.onMouseDown=this.createTwoChains("onMouseDown"),et.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(et.onMouseEnter=this.onMouseEnter,be&&(et.onMouseMove=this.onMouseMove)):et.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?et.onMouseLeave=this.onMouseLeave:et.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(et.onFocus=this.onFocus,et.onBlur=this.onBlur):(et.onFocus=this.createTwoChains("onFocus"),et.onBlur=this.createTwoChains("onBlur"));var ct=I()(nt&&nt.props&&nt.props.className,Se);ct&&(et.className=ct);var Yt=Object(N.a)({},et);Object(ut.c)(nt)&&(Yt.ref=Object(ut.a)(this.triggerRef,nt.ref));var dn=E.cloneElement(nt,Yt),en;return(z||this.popupRef.current||_e)&&(en=E.createElement(ne,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!z&&Ie&&(en=null),E.createElement(kt.Provider,{value:this.triggerContextValue},dn,en)}}],[{key:"getDerivedStateFromProps",value:function(z,se){var le=z.popupVisible,_e={};return le!==void 0&&se.popupVisible!==le&&(_e.popupVisible=le,_e.prevPopupVisible=se.popupVisible),_e}}]),G}(E.Component);return me.contextType=kt,me.defaultProps={prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:mt,getDocument:Rt,onPopupVisibleChange:wt,afterPopupVisibleChange:wt,onPopupAlign:wt,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[],autoDestroy:!1},me}var Ot=Kt(Et.a),At={adjustX:1,adjustY:1},Bt={topLeft:{points:["bl","tl"],overflow:At,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:At,offset:[0,7]},leftTop:{points:["tr","tl"],overflow:At,offset:[-4,0]},rightTop:{points:["tl","tr"],overflow:At,offset:[4,0]}},jt={topLeft:{points:["bl","tl"],overflow:At,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:At,offset:[0,7]},rightTop:{points:["tr","tl"],overflow:At,offset:[-4,0]},leftTop:{points:["tl","tr"],overflow:At,offset:[4,0]}},xn=Bt,ge=0,Be={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"},tn=function(me,ue,ae){var G=Oe(ue),Y=me.getState();me.setState({defaultActiveFirst:Object(N.a)(Object(N.a)({},Y.defaultActiveFirst),{},Object(Ee.a)({},G,ae))})},tt=function(ne){Object(r.a)(ue,ne);var me=Object(e.a)(ue);function ue(ae){var G;Object(m.a)(this,ue),G=me.call(this,ae),G.onDestroy=function(be){G.props.onDestroy(be)},G.onKeyDown=function(be){var Se=be.keyCode,Ie=G.menuInstance,nt=G.props.store,et=G.getVisible();if(Se===b.a.ENTER)return G.onTitleClick(be),tn(nt,G.props.eventKey,!0),!0;if(Se===b.a.RIGHT)return et?Ie.onKeyDown(be):(G.triggerOpenChange(!0),tn(nt,G.props.eventKey,!0)),!0;if(Se===b.a.LEFT){var ct;if(et)ct=Ie.onKeyDown(be);else return;return ct||(G.triggerOpenChange(!1),ct=!0),ct}return et&&(Se===b.a.UP||Se===b.a.DOWN)?Ie.onKeyDown(be):void 0},G.onOpenChange=function(be){G.props.onOpenChange(be)},G.onPopupVisibleChange=function(be){G.triggerOpenChange(be,be?"mouseenter":"mouseleave")},G.onMouseEnter=function(be){var Se=G.props,Ie=Se.eventKey,nt=Se.onMouseEnter,et=Se.store;tn(et,G.props.eventKey,!1),nt({key:Ie,domEvent:be})},G.onMouseLeave=function(be){var Se=G.props,Ie=Se.parentMenu,nt=Se.eventKey,et=Se.onMouseLeave;Ie.subMenuInstance=Object(a.a)(G),et({key:nt,domEvent:be})},G.onTitleMouseEnter=function(be){var Se=G.props,Ie=Se.eventKey,nt=Se.onItemHover,et=Se.onTitleMouseEnter;nt({key:Ie,hover:!0}),et({key:Ie,domEvent:be})},G.onTitleMouseLeave=function(be){var Se=G.props,Ie=Se.parentMenu,nt=Se.eventKey,et=Se.onItemHover,ct=Se.onTitleMouseLeave;Ie.subMenuInstance=Object(a.a)(G),et({key:nt,hover:!1}),ct({key:nt,domEvent:be})},G.onTitleClick=function(be){var Se=Object(a.a)(G),Ie=Se.props;if(Ie.onTitleClick({key:Ie.eventKey,domEvent:be}),Ie.triggerSubMenuAction==="hover")return;G.triggerOpenChange(!G.getVisible(),"click"),tn(Ie.store,G.props.eventKey,!1)},G.onSubMenuClick=function(be){typeof G.props.onClick=="function"&&G.props.onClick(G.addKeyPath(be))},G.onSelect=function(be){G.props.onSelect(be)},G.onDeselect=function(be){G.props.onDeselect(be)},G.getPrefixCls=function(){return"".concat(G.props.rootPrefixCls,"-submenu")},G.getActiveClassName=function(){return"".concat(G.getPrefixCls(),"-active")},G.getDisabledClassName=function(){return"".concat(G.getPrefixCls(),"-disabled")},G.getSelectedClassName=function(){return"".concat(G.getPrefixCls(),"-selected")},G.getOpenClassName=function(){return"".concat(G.props.rootPrefixCls,"-submenu-open")},G.getVisible=function(){return G.state.isOpen},G.getMode=function(){return G.state.mode},G.saveMenuInstance=function(be){G.menuInstance=be},G.addKeyPath=function(be){return Object(N.a)(Object(N.a)({},be),{},{keyPath:(be.keyPath||[]).concat(G.props.eventKey)})},G.triggerOpenChange=function(be,Se){var Ie=G.props.eventKey,nt=function(){G.onOpenChange({key:Ie,item:Object(a.a)(G),trigger:Se,open:be})};Se==="mouseenter"?G.mouseenterTimeout=setTimeout(function(){nt()},0):nt()},G.isChildrenSelected=function(){var be={find:!1};return Ke(G.props.children,G.props.selectedKeys,be),be.find},G.isInlineMode=function(){return G.getMode()==="inline"},G.adjustWidth=function(){if(!G.subMenuTitle||!G.menuInstance)return;var be=qe.findDOMNode(G.menuInstance);if(be.offsetWidth>=G.subMenuTitle.offsetWidth)return;be.style.minWidth="".concat(G.subMenuTitle.offsetWidth,"px")},G.saveSubMenuTitle=function(be){G.subMenuTitle=be},G.getBaseProps=function(){var be=Object(a.a)(G),Se=be.props,Ie=G.getMode();return{mode:Ie==="horizontal"?"vertical":Ie,visible:G.getVisible(),level:Se.level+1,inlineIndent:Se.inlineIndent,focusable:!1,onClick:G.onSubMenuClick,onSelect:G.onSelect,onDeselect:G.onDeselect,onDestroy:G.onDestroy,selectedKeys:Se.selectedKeys,eventKey:"".concat(Se.eventKey,"-menu-"),openKeys:Se.openKeys,motion:Se.motion,onOpenChange:G.onOpenChange,subMenuOpenDelay:Se.subMenuOpenDelay,parentMenu:Object(a.a)(G),subMenuCloseDelay:Se.subMenuCloseDelay,forceSubMenuRender:Se.forceSubMenuRender,triggerSubMenuAction:Se.triggerSubMenuAction,builtinPlacements:Se.builtinPlacements,defaultActiveFirst:Se.store.getState().defaultActiveFirst[Oe(Se.eventKey)],multiple:Se.multiple,prefixCls:Se.rootPrefixCls,id:G.internalMenuId,manualRef:G.saveMenuInstance,itemIcon:Se.itemIcon,expandIcon:Se.expandIcon,direction:Se.direction}},G.getMotion=function(be,Se){var Ie=Object(a.a)(G),nt=Ie.haveRendered,et=G.props,ct=et.motion,Yt=et.rootPrefixCls,dn=Object(N.a)(Object(N.a)({},ct),{},{leavedClassName:"".concat(Yt,"-hidden"),removeOnLeave:!1,motionAppear:nt||!Se||be!=="inline"});return dn};var Y=ae.store,z=ae.eventKey,se=Y.getState(),le=se.defaultActiveFirst;G.isRootMenu=!1;var _e=!1;return le&&(_e=le[z]),tn(Y,z,_e),G.state={mode:ae.mode,isOpen:ae.isOpen},G}return Object(h.a)(ue,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var G=this,Y=this.props,z=Y.mode,se=Y.parentMenu,le=Y.manualRef,_e=Y.isOpen,be=function(){G.setState({mode:z,isOpen:_e})},Se=_e!==this.state.isOpen,Ie=z!==this.state.mode;if((Ie||Se)&&(ot.a.cancel(this.updateStateRaf),Ie?this.updateStateRaf=Object(ot.a)(be):be()),le&&le(this),z!=="horizontal"||!(se==null?void 0:se.isRootMenu)||!_e)return;this.minWidthTimeout=setTimeout(function(){return G.adjustWidth()},0)}},{key:"componentWillUnmount",value:function(){var G=this.props,Y=G.onDestroy,z=G.eventKey;Y&&Y(z),this.minWidthTimeout&&clearTimeout(this.minWidthTimeout),this.mouseenterTimeout&&clearTimeout(this.mouseenterTimeout),ot.a.cancel(this.updateStateRaf)}},{key:"renderPopupMenu",value:function(G,Y){var z=this.getBaseProps();return E.createElement(In,Object(u.a)({},z,{id:this.internalMenuId,className:G,style:Y}),this.props.children)}},{key:"renderChildren",value:function(){var G=this,Y=this.getBaseProps(),z=Y.mode,se=Y.visible,le=Y.forceSubMenuRender,_e=Y.direction,be=this.getMotion(z,se);if(this.haveRendered=!0,this.haveOpened=this.haveOpened||se||le,!this.haveOpened)return E.createElement("div",null);var Se=I()("".concat(Y.prefixCls,"-sub"),Object(Ee.a)({},"".concat(Y.prefixCls,"-rtl"),_e==="rtl"));return this.isInlineMode()?E.createElement(K,Object(u.a)({visible:Y.visible,forceRender:le},be),function(Ie){var nt=Ie.className,et=Ie.style,ct=I()(Se,nt);return G.renderPopupMenu(ct,et)}):this.renderPopupMenu(Se)}},{key:"render",value:function(){var G,Y,z,se=Object(N.a)({},this.props),le=this.getVisible(),_e=this.getPrefixCls(),be=this.isInlineMode(),Se=this.getMode(),Ie=I()(_e,"".concat(_e,"-").concat(Se),(G={},Object(Ee.a)(G,se.className,!!se.className),Object(Ee.a)(G,this.getOpenClassName(),le),Object(Ee.a)(G,this.getActiveClassName(),se.active||le&&!be),Object(Ee.a)(G,this.getDisabledClassName(),se.disabled),Object(Ee.a)(G,this.getSelectedClassName(),this.isChildrenSelected()),G));this.internalMenuId||(se.eventKey?this.internalMenuId="".concat(se.eventKey,"$Menu"):(ge+=1,this.internalMenuId="$__$".concat(ge,"$Menu")));var nt={},et={},ct={};se.disabled||(nt={onMouseLeave:this.onMouseLeave,onMouseEnter:this.onMouseEnter},et={onClick:this.onTitleClick},ct={onMouseEnter:this.onTitleMouseEnter,onMouseLeave:this.onTitleMouseLeave});var Yt={},dn=se.direction,en=dn==="rtl";be&&(en?Yt.paddingRight=se.inlineIndent*se.level:Yt.paddingLeft=se.inlineIndent*se.level);var sn={};this.getVisible()&&(sn={"aria-owns":this.internalMenuId});var cn=null;Se!=="horizontal"&&(cn=this.props.expandIcon,typeof this.props.expandIcon=="function"&&(cn=E.createElement(this.props.expandIcon,Object(N.a)({},this.props))));var ln=E.createElement("div",Object(u.a)({ref:this.saveSubMenuTitle,style:Yt,className:"".concat(_e,"-title"),role:"button"},ct,et,{"aria-expanded":le},sn,{"aria-haspopup":"true",title:typeof se.title=="string"?se.title:void 0}),se.title,cn||E.createElement("i",{className:"".concat(_e,"-arrow")})),nn=this.renderChildren(),mn=((Y=se.parentMenu)===null||Y===void 0?void 0:Y.isRootMenu)?se.parentMenu.props.getPopupContainer:function(Gn){return Gn.parentNode},hn=Be[Se],Xn=se.popupOffset?{offset:se.popupOffset}:{},En=I()((z={},Object(Ee.a)(z,se.popupClassName,se.popupClassName&&!be),Object(Ee.a)(z,"".concat(_e,"-rtl"),en),z)),$t=se.disabled,Vt=se.triggerSubMenuAction,vn=se.subMenuOpenDelay,pn=se.forceSubMenuRender,Mt=se.subMenuCloseDelay,Cn=se.builtinPlacements;Fe.forEach(function(Gn){return delete se[Gn]}),delete se.onClick;var Fn=en?Object(N.a)(Object(N.a)({},jt),Cn):Object(N.a)(Object(N.a)({},Bt),Cn);delete se.direction;var qt=this.getBaseProps(),gn=be?null:this.getMotion(qt.mode,qt.visible);return E.createElement("li",Object(u.a)({},se,nt,{className:Ie,role:"menuitem"}),E.createElement(Ot,{prefixCls:_e,popupClassName:I()("".concat(_e,"-popup"),En),getPopupContainer:mn,builtinPlacements:Fn,popupPlacement:hn,popupVisible:be?!1:le,popupAlign:Xn,popup:be?null:nn,action:$t||be?[]:[Vt],mouseEnterDelay:vn,mouseLeaveDelay:Mt,onPopupVisibleChange:this.onPopupVisibleChange,forceRender:pn,popupMotion:gn},ln),be?nn:null)}}]),ue}(E.Component);tt.defaultProps={onMouseEnter:we,onMouseLeave:we,onTitleMouseEnter:we,onTitleMouseLeave:we,onTitleClick:we,manualRef:we,mode:"vertical",title:""};var dt=Object(i.b)(function(ne,me){var ue=ne.openKeys,ae=ne.activeKey,G=ne.selectedKeys,Y=me.eventKey,z=me.subMenuKey;return{isOpen:ue.indexOf(Y)>-1,active:ae[z]===Y,selectedKeys:G}})(tt);dt.isSubMenu=!0;var at=dt,ft="menuitem-overflowed",yt=.5,vt=function(ne){Object(r.a)(ue,ne);var me=Object(e.a)(ue);function ue(){var ae;return Object(m.a)(this,ue),ae=me.apply(this,arguments),ae.resizeObserver=null,ae.mutationObserver=null,ae.originalTotalWidth=0,ae.overflowedItems=[],ae.menuItemSizes=[],ae.cancelFrameId=null,ae.state={lastVisibleIndex:void 0},ae.childRef=E.createRef(),ae.getMenuItemNodes=function(){var G=ae.props.prefixCls,Y=ae.childRef.current;return Y?[].slice.call(Y.children).filter(function(z){return z.className.split(" ").indexOf("".concat(G,"-overflowed-submenu"))<0}):[]},ae.getOverflowedSubMenuItem=function(G,Y,z){var se=ae.props,le=se.overflowedIndicator,_e=se.level,be=se.mode,Se=se.prefixCls,Ie=se.theme;if(_e!==1||be!=="horizontal")return null;var nt=ae.props.children[0],et=nt.props,ct=et.children,Yt=et.title,dn=et.style,en=Object(w.a)(et,["children","title","style"]),sn=Object(N.a)({},dn),cn="".concat(G,"-overflowed-indicator"),ln="".concat(G,"-overflowed-indicator");Y.length===0&&z!==!0?sn=Object(N.a)(Object(N.a)({},sn),{},{display:"none"}):z&&(sn=Object(N.a)(Object(N.a)({},sn),{},{visibility:"hidden",position:"absolute"}),cn="".concat(cn,"-placeholder"),ln="".concat(ln,"-placeholder"));var nn=Ie?"".concat(Se,"-").concat(Ie):"",mn={};return Fe.forEach(function(hn){en[hn]!==void 0&&(mn[hn]=en[hn])}),E.createElement(at,Object(u.a)({title:le,className:"".concat(Se,"-overflowed-submenu"),popupClassName:nn},mn,{key:cn,eventKey:ln,disabled:!1,style:sn}),Y)},ae.setChildrenWidthAndResize=function(){if(ae.props.mode!=="horizontal")return;var G=ae.childRef.current;if(!G)return;var Y=G.children;if(!Y||Y.length===0)return;var z=G.children[Y.length-1];Ne(z,"display","inline-block");var se=ae.getMenuItemNodes(),le=se.filter(function(_e){return _e.className.split(" ").indexOf(ft)>=0});le.forEach(function(_e){Ne(_e,"display","inline-block")}),ae.menuItemSizes=se.map(function(_e){return He(_e,!0)}),le.forEach(function(_e){Ne(_e,"display","none")}),ae.overflowedIndicatorWidth=He(G.children[G.children.length-1],!0),ae.originalTotalWidth=ae.menuItemSizes.reduce(function(_e,be){return _e+be},0),ae.handleResize(),Ne(z,"display","none")},ae.handleResize=function(){if(ae.props.mode!=="horizontal")return;var G=ae.childRef.current;if(!G)return;var Y=He(G);ae.overflowedItems=[];var z=0,se;ae.originalTotalWidth>Y+yt&&(se=-1,ae.menuItemSizes.forEach(function(le){z+=le,z+ae.overflowedIndicatorWidth<=Y&&(se+=1)})),ae.setState({lastVisibleIndex:se})},ae}return Object(h.a)(ue,[{key:"componentDidMount",value:function(){var G=this;if(this.setChildrenWidthAndResize(),this.props.level===1&&this.props.mode==="horizontal"){var Y=this.childRef.current;if(!Y)return;this.resizeObserver=new Ge.default(function(z){z.forEach(function(){var se=G.cancelFrameId;cancelAnimationFrame(se),G.cancelFrameId=requestAnimationFrame(G.setChildrenWidthAndResize)})}),[].slice.call(Y.children).concat(Y).forEach(function(z){G.resizeObserver.observe(z)}),typeof MutationObserver!="undefined"&&(this.mutationObserver=new MutationObserver(function(){G.resizeObserver.disconnect(),[].slice.call(Y.children).concat(Y).forEach(function(z){G.resizeObserver.observe(z)}),G.setChildrenWidthAndResize()}),this.mutationObserver.observe(Y,{attributes:!1,childList:!0,subTree:!1}))}}},{key:"componentWillUnmount",value:function(){this.resizeObserver&&this.resizeObserver.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),cancelAnimationFrame(this.cancelFrameId)}},{key:"renderChildren",value:function(G){var Y=this,z=this.state.lastVisibleIndex;return(G||[]).reduce(function(se,le,_e){var be=le;if(Y.props.mode==="horizontal"){var Se=Y.getOverflowedSubMenuItem(le.props.eventKey,[]);z!==void 0&&Y.props.className.indexOf("".concat(Y.props.prefixCls,"-root"))!==-1&&(_e>z&&(be=E.cloneElement(le,{style:{display:"none"},eventKey:"".concat(le.props.eventKey,"-hidden"),className:"".concat(ft)})),_e===z+1&&(Y.overflowedItems=G.slice(z+1).map(function(nt){return E.cloneElement(nt,{key:nt.props.eventKey,mode:"vertical-left"})}),Se=Y.getOverflowedSubMenuItem(le.props.eventKey,Y.overflowedItems)));var Ie=[].concat(Object(P.a)(se),[Se,be]);return _e===G.length-1&&Ie.push(Y.getOverflowedSubMenuItem(le.props.eventKey,[],!0)),Ie}return[].concat(Object(P.a)(se),[be])},[])}},{key:"render",value:function(){var G=this.props,Y=G.visible,z=G.prefixCls,se=G.overflowedIndicator,le=G.mode,_e=G.level,be=G.tag,Se=G.children,Ie=G.theme,nt=Object(w.a)(G,["visible","prefixCls","overflowedIndicator","mode","level","tag","children","theme"]),et=be;return E.createElement(et,Object(u.a)({ref:this.childRef},nt),this.renderChildren(Se))}}]),ue}(E.Component);vt.defaultProps={tag:"div",className:""};var Qt=vt;function un(ne){return ne.length?ne.every(function(me){return!!me.props.disabled}):!0}function Gt(ne,me,ue){var ae=ne.getState();ne.setState({activeKey:Object(N.a)(Object(N.a)({},ae.activeKey),{},Object(Ee.a)({},me,ue))})}function zt(ne){return ne.eventKey||"0-menu-"}function _r(ne,me){var ue=me,ae=ne.children,G=ne.eventKey;if(ue){var Y;if(Le(ae,function(z,se){z&&z.props&&!z.props.disabled&&ue===De(z,G,se)&&(Y=!0)}),Y)return ue}return ue=null,ne.defaultActiveFirst&&Le(ae,function(z,se){!ue&&z&&!z.props.disabled&&(ue=De(z,G,se))}),ue}function gr(ne){if(!ne)return;var me=this.instanceArray.indexOf(ne);me!==-1?this.instanceArray[me]=ne:this.instanceArray.push(ne)}var xr=function(ne){Object(r.a)(ue,ne);var me=Object(e.a)(ue);function ue(ae){var G;return Object(m.a)(this,ue),G=me.call(this,ae),G.onKeyDown=function(Y,z){var se=Y.keyCode,le;if(G.getFlatInstanceArray().forEach(function(be){be&&be.props.active&&be.onKeyDown&&(le=be.onKeyDown(Y))}),le)return 1;var _e=null;return(se===b.a.UP||se===b.a.DOWN)&&(_e=G.step(se===b.a.UP?-1:1)),_e?(Y.preventDefault(),Gt(G.props.store,zt(G.props),_e.props.eventKey),typeof z=="function"&&z(_e),1):void 0},G.onItemHover=function(Y){var z=Y.key,se=Y.hover;Gt(G.props.store,zt(G.props),se?z:null)},G.onDeselect=function(Y){G.props.onDeselect(Y)},G.onSelect=function(Y){G.props.onSelect(Y)},G.onClick=function(Y){G.props.onClick(Y)},G.onOpenChange=function(Y){G.props.onOpenChange(Y)},G.onDestroy=function(Y){G.props.onDestroy(Y)},G.getFlatInstanceArray=function(){return G.instanceArray},G.step=function(Y){var z=G.getFlatInstanceArray(),se=G.props.store.getState().activeKey[zt(G.props)],le=z.length;if(!le)return null;Y<0&&(z=z.concat().reverse());var _e=-1;if(z.every(function(nt,et){return nt&&nt.props.eventKey===se?(_e=et,!1):!0}),!G.props.defaultActiveFirst&&_e!==-1&&un(z.slice(_e,le-1)))return;var be=(_e+1)%le,Se=be;do{var Ie=z[Se];if(!Ie||Ie.props.disabled)Se=(Se+1)%le;else return Ie}while(Se!==be);return null},G.renderCommonMenuItem=function(Y,z,se){var le=G.props.store.getState(),_e=Object(a.a)(G),be=_e.props,Se=De(Y,be.eventKey,z),Ie=Y.props;if(!Ie||typeof Y.type=="string")return Y;var nt=Se===le.activeKey,et=Object(N.a)(Object(N.a)({mode:Ie.mode||be.mode,level:be.level,inlineIndent:be.inlineIndent,renderMenuItem:G.renderMenuItem,rootPrefixCls:be.prefixCls,index:z,parentMenu:be.parentMenu,manualRef:Ie.disabled?void 0:Object(f.a)(Y.ref,gr.bind(Object(a.a)(G))),eventKey:Se,active:!Ie.disabled&&nt,multiple:be.multiple,onClick:function(Yt){(Ie.onClick||we)(Yt),G.onClick(Yt)},onItemHover:G.onItemHover,motion:be.motion,subMenuOpenDelay:be.subMenuOpenDelay,subMenuCloseDelay:be.subMenuCloseDelay,forceSubMenuRender:be.forceSubMenuRender,onOpenChange:G.onOpenChange,onDeselect:G.onDeselect,onSelect:G.onSelect,builtinPlacements:be.builtinPlacements,itemIcon:Ie.itemIcon||G.props.itemIcon,expandIcon:Ie.expandIcon||G.props.expandIcon},se),{},{direction:be.direction});return(be.mode==="inline"||xe())&&(et.triggerSubMenuAction="click"),E.cloneElement(Y,Object(N.a)(Object(N.a)({},et),{},{key:Se||z}))},G.renderMenuItem=function(Y,z,se){if(!Y)return null;var le=G.props.store.getState(),_e={openKeys:le.openKeys,selectedKeys:le.selectedKeys,triggerSubMenuAction:G.props.triggerSubMenuAction,subMenuKey:se};return G.renderCommonMenuItem(Y,z,_e)},ae.store.setState({activeKey:Object(N.a)(Object(N.a)({},ae.store.getState().activeKey),{},Object(Ee.a)({},ae.eventKey,_r(ae,ae.activeKey)))}),G.instanceArray=[],G}return Object(h.a)(ue,[{key:"componentDidMount",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"shouldComponentUpdate",value:function(G){return this.props.visible||G.visible||this.props.className!==G.className||!t()(this.props.style,G.style)}},{key:"componentDidUpdate",value:function(G){var Y=this.props,z="activeKey"in Y?Y.activeKey:Y.store.getState().activeKey[zt(Y)],se=_r(Y,z);if(se!==z)Gt(Y.store,zt(Y),se);else if("activeKey"in G){var le=_r(G,G.activeKey);se!==le&&Gt(Y.store,zt(Y),se)}}},{key:"render",value:function(){var G=this,Y=Object(u.a)({},this.props);this.instanceArray=[];var z=I()(Y.prefixCls,Y.className,"".concat(Y.prefixCls,"-").concat(Y.mode)),se={className:z,role:Y.role||"menu"};Y.id&&(se.id=Y.id),Y.focusable&&(se.tabIndex=0,se.onKeyDown=this.onKeyDown);var le=Y.prefixCls,_e=Y.eventKey,be=Y.visible,Se=Y.level,Ie=Y.mode,nt=Y.overflowedIndicator,et=Y.theme;return Fe.forEach(function(ct){return delete Y[ct]}),delete Y.onClick,E.createElement(Qt,Object(u.a)({},Y,{prefixCls:le,mode:Ie,tag:"ul",level:Se,theme:et,visible:be,overflowedIndicator:nt},se),Object(M.a)(Y.children).map(function(ct,Yt){return G.renderMenuItem(ct,Yt,_e||"0-menu-")}))}}]),ue}(E.Component);xr.defaultProps={prefixCls:"rc-menu",className:"",mode:"vertical",level:1,inlineIndent:24,visible:!0,focusable:!0,style:{},manualRef:we};var xt=Object(i.b)()(xr),In=xt,bn=W("Kwbf");function Yn(ne,me,ue){var ae=ne.prefixCls,G=ne.motion,Y=ne.defaultMotions,z=Y===void 0?{}:Y,se=ne.openAnimation,le=ne.openTransitionName,_e=me.switchingModeFromInline;if(G)return G;if(Object(A.a)(se)==="object"&&se)Object(bn.a)(!1,"Object type of `openAnimation` is removed. Please use `motion` instead.");else if(typeof se=="string")return{motionName:"".concat(ae,"-open-").concat(se)};if(le)return{motionName:le};var be=z[ue];return be||(_e?null:z.other)}var zn=function(ne){Object(r.a)(ue,ne);var me=Object(e.a)(ue);function ue(ae){var G;Object(m.a)(this,ue),G=me.call(this,ae),G.onSelect=function(se){var le=Object(a.a)(G),_e=le.props;if(_e.selectable){var be=G.store.getState(),Se=be.selectedKeys,Ie=se.key;_e.multiple?Se=Se.concat([Ie]):Se=[Ie],"selectedKeys"in _e||G.store.setState({selectedKeys:Se}),_e.onSelect(Object(N.a)(Object(N.a)({},se),{},{selectedKeys:Se}))}},G.onClick=function(se){var le=G.getRealMenuMode(),_e=Object(a.a)(G),be=_e.store,Se=_e.props.onOpenChange;le!=="inline"&&!("openKeys"in G.props)&&(be.setState({openKeys:[]}),Se([])),G.props.onClick(se)},G.onKeyDown=function(se,le){G.innerMenu.getWrappedInstance().onKeyDown(se,le)},G.onOpenChange=function(se){var le=Object(a.a)(G),_e=le.props,be=G.store.getState().openKeys.concat(),Se=!1,Ie=function(et){var ct=!1;if(et.open)ct=be.indexOf(et.key)===-1,ct&&be.push(et.key);else{var Yt=be.indexOf(et.key);ct=Yt!==-1,ct&&be.splice(Yt,1)}Se=Se||ct};Array.isArray(se)?se.forEach(Ie):Ie(se),Se&&("openKeys"in G.props||G.store.setState({openKeys:be}),_e.onOpenChange(be))},G.onDeselect=function(se){var le=Object(a.a)(G),_e=le.props;if(_e.selectable){var be=G.store.getState().selectedKeys.concat(),Se=se.key,Ie=be.indexOf(Se);Ie!==-1&&be.splice(Ie,1),"selectedKeys"in _e||G.store.setState({selectedKeys:be}),_e.onDeselect(Object(N.a)(Object(N.a)({},se),{},{selectedKeys:be}))}},G.onMouseEnter=function(se){G.restoreModeVerticalFromInline();var le=G.props.onMouseEnter;le&&le(se)},G.onTransitionEnd=function(se){var le=se.propertyName==="width"&&se.target===se.currentTarget,_e=se.target.className,be=Object.prototype.toString.call(_e)==="[object SVGAnimatedString]"?_e.animVal:_e,Se=se.propertyName==="font-size"&&be.indexOf("anticon")>=0;(le||Se)&&G.restoreModeVerticalFromInline()},G.setInnerMenu=function(se){G.innerMenu=se},G.isRootMenu=!0;var Y=ae.defaultSelectedKeys,z=ae.defaultOpenKeys;return"selectedKeys"in ae&&(Y=ae.selectedKeys||[]),"openKeys"in ae&&(z=ae.openKeys||[]),G.store=Object(i.c)({selectedKeys:Y,openKeys:z,activeKey:{"0-menu-":_r(ae,ae.activeKey)}}),G.state={switchingModeFromInline:!1,prevProps:ae,inlineOpenKeys:[],store:G.store},G}return Object(h.a)(ue,[{key:"componentDidMount",value:function(){this.updateMiniStore(),this.updateMenuDisplay()}},{key:"componentDidUpdate",value:function(G){var Y=this.props,z=Y.siderCollapsed,se=Y.inlineCollapsed,le=Y.onOpenChange;(!G.inlineCollapsed&&se||!G.siderCollapsed&&z)&&le([]),this.updateMiniStore(),this.updateMenuDisplay()}},{key:"updateMenuDisplay",value:function(){var G=this.props.collapsedWidth,Y=this.store,z=this.prevOpenKeys,se=this.getInlineCollapsed()&&(G===0||G==="0"||G==="0px");se?(this.prevOpenKeys=Y.getState().openKeys.concat(),this.store.setState({openKeys:[]})):z&&(this.store.setState({openKeys:z}),this.prevOpenKeys=null)}},{key:"getRealMenuMode",value:function(){var G=this.props.mode,Y=this.state.switchingModeFromInline,z=this.getInlineCollapsed();return Y&&z?"inline":z?"vertical":G}},{key:"getInlineCollapsed",value:function(){var G=this.props,Y=G.inlineCollapsed,z=G.siderCollapsed;return z!==void 0?z:Y}},{key:"restoreModeVerticalFromInline",value:function(){var G=this.state.switchingModeFromInline;G&&this.setState({switchingModeFromInline:!1})}},{key:"updateMiniStore",value:function(){"selectedKeys"in this.props&&this.store.setState({selectedKeys:this.props.selectedKeys||[]}),"openKeys"in this.props&&this.store.setState({openKeys:this.props.openKeys||[]})}},{key:"render",value:function(){var G=Object(N.a)({},Object(v.a)(this.props,["collapsedWidth","siderCollapsed","defaultMotions"])),Y=this.getRealMenuMode();return G.className+=" ".concat(G.prefixCls,"-root"),G.direction==="rtl"&&(G.className+=" ".concat(G.prefixCls,"-rtl")),G=Object(N.a)(Object(N.a)({},G),{},{mode:Y,onClick:this.onClick,onOpenChange:this.onOpenChange,onDeselect:this.onDeselect,onSelect:this.onSelect,onMouseEnter:this.onMouseEnter,onTransitionEnd:this.onTransitionEnd,parentMenu:this,motion:Yn(this.props,this.state,Y)}),delete G.openAnimation,delete G.openTransitionName,E.createElement(i.a,{store:this.store},E.createElement(In,Object(u.a)({},G,{ref:this.setInnerMenu}),this.props.children))}}],[{key:"getDerivedStateFromProps",value:function(G,Y){var z=Y.prevProps,se=Y.store,le=se.getState(),_e={},be={prevProps:G};return z.mode==="inline"&&G.mode!=="inline"&&(be.switchingModeFromInline=!0),"openKeys"in G?_e.openKeys=G.openKeys||[]:((G.inlineCollapsed&&!z.inlineCollapsed||G.siderCollapsed&&!z.siderCollapsed)&&(be.switchingModeFromInline=!0,be.inlineOpenKeys=le.openKeys,_e.openKeys=[]),(!G.inlineCollapsed&&z.inlineCollapsed||!G.siderCollapsed&&z.siderCollapsed)&&(_e.openKeys=Y.inlineOpenKeys,be.inlineOpenKeys=[])),Object.keys(_e).length&&se.setState(_e),be}}]),ue}(E.Component);zn.defaultProps={selectable:!0,onClick:we,onSelect:we,onOpenChange:we,onDeselect:we,defaultSelectedKeys:[],defaultOpenKeys:[],subMenuOpenDelay:.1,subMenuCloseDelay:.1,triggerSubMenuAction:"hover",prefixCls:"rc-menu",className:"",mode:"vertical",style:{},builtinPlacements:{},overflowedIndicator:E.createElement("span",null,"\xB7\xB7\xB7")};var Vn=zn,wn=function(ne){Object(r.a)(ue,ne);var me=Object(e.a)(ue);function ue(){var ae;return Object(m.a)(this,ue),ae=me.apply(this,arguments),ae.onKeyDown=function(G){var Y=G.keyCode;return Y===b.a.ENTER?(ae.onClick(G),!0):void 0},ae.onMouseLeave=function(G){var Y=ae.props,z=Y.eventKey,se=Y.onItemHover,le=Y.onMouseLeave;se({key:z,hover:!1}),le({key:z,domEvent:G})},ae.onMouseEnter=function(G){var Y=ae.props,z=Y.eventKey,se=Y.onItemHover,le=Y.onMouseEnter;se({key:z,hover:!0}),le({key:z,domEvent:G})},ae.onClick=function(G){var Y=ae.props,z=Y.eventKey,se=Y.multiple,le=Y.onClick,_e=Y.onSelect,be=Y.onDeselect,Se=Y.isSelected,Ie={key:z,keyPath:[z],item:Object(a.a)(ae),domEvent:G};le(Ie),se?Se?be(Ie):_e(Ie):Se||_e(Ie)},ae.saveNode=function(G){ae.node=G},ae}return Object(h.a)(ue,[{key:"componentDidMount",value:function(){this.callRef()}},{key:"componentDidUpdate",value:function(){this.callRef()}},{key:"componentWillUnmount",value:function(){var G=this.props;G.onDestroy&&G.onDestroy(G.eventKey)}},{key:"getPrefixCls",value:function(){return"".concat(this.props.rootPrefixCls,"-item")}},{key:"getActiveClassName",value:function(){return"".concat(this.getPrefixCls(),"-active")}},{key:"getSelectedClassName",value:function(){return"".concat(this.getPrefixCls(),"-selected")}},{key:"getDisabledClassName",value:function(){return"".concat(this.getPrefixCls(),"-disabled")}},{key:"callRef",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"render",value:function(){var G,Y=Object(N.a)({},this.props),z=I()(this.getPrefixCls(),Y.className,(G={},Object(Ee.a)(G,this.getActiveClassName(),!Y.disabled&&Y.active),Object(Ee.a)(G,this.getSelectedClassName(),Y.isSelected),Object(Ee.a)(G,this.getDisabledClassName(),Y.disabled),G)),se=Object(N.a)(Object(N.a)({},Y.attribute),{},{title:typeof Y.title=="string"?Y.title:void 0,className:z,role:Y.role||"menuitem","aria-disabled":Y.disabled});Y.role==="option"?se=Object(N.a)(Object(N.a)({},se),{},{role:"option","aria-selected":Y.isSelected}):(Y.role===null||Y.role==="none")&&(se.role="none");var le={onClick:Y.disabled?null:this.onClick,onMouseLeave:Y.disabled?null:this.onMouseLeave,onMouseEnter:Y.disabled?null:this.onMouseEnter},_e=Object(N.a)({},Y.style);Y.mode==="inline"&&(Y.direction==="rtl"?_e.paddingRight=Y.inlineIndent*Y.level:_e.paddingLeft=Y.inlineIndent*Y.level),Fe.forEach(function(Se){return delete Y[Se]}),delete Y.direction;var be=this.props.itemIcon;return typeof this.props.itemIcon=="function"&&(be=E.createElement(this.props.itemIcon,this.props)),E.createElement("li",Object(u.a)({},Object(v.a)(Y,["onClick","onMouseEnter","onMouseLeave","onSelect"]),se,le,{style:_e,ref:this.saveNode}),Y.children,be)}}]),ue}(E.Component);wn.isMenuItem=!0,wn.defaultProps={onSelect:we,onMouseEnter:we,onMouseLeave:we,manualRef:we};var Nn=Object(i.b)(function(ne,me){var ue=ne.activeKey,ae=ne.selectedKeys,G=me.eventKey,Y=me.subMenuKey;return{active:ue[Y]===G,isSelected:Array.isArray(ae)?ae.indexOf(G)!==-1:ae===G}})(wn),jn=Nn,rr=function(ne){Object(r.a)(ue,ne);var me=Object(e.a)(ue);function ue(){var ae;return Object(m.a)(this,ue),ae=me.apply(this,arguments),ae.renderInnerMenuItem=function(G){var Y=ae.props,z=Y.renderMenuItem,se=Y.index;return z(G,se,ae.props.subMenuKey)},ae}return Object(h.a)(ue,[{key:"render",value:function(){var G=Object(u.a)({},this.props),Y=G.className,z=Y===void 0?"":Y,se=G.rootPrefixCls,le="".concat(se,"-item-group-title"),_e="".concat(se,"-item-group-list"),be=G.title,Se=G.children;return Fe.forEach(function(Ie){return delete G[Ie]}),delete G.direction,E.createElement("li",Object(u.a)({},G,{onClick:function(nt){return nt.stopPropagation()},className:"".concat(z," ").concat(se,"-item-group")}),E.createElement("div",{className:le,title:typeof be=="string"?be:void 0},be),E.createElement("ul",{className:_e},E.Children.map(Se,this.renderInnerMenuItem)))}}]),ue}(E.Component);rr.isMenuItemGroup=!0,rr.defaultProps={disabled:!0};var $n=rr,Br=function(me){var ue=me.className,ae=me.rootPrefixCls,G=me.style;return E.createElement("li",{className:"".concat(ue," ").concat(ae,"-item-divider"),style:G})};Br.defaultProps={disabled:!0,className:"",style:{}};var pr=Br,ar=Vn,Zn=W("eDIo");function Hn(ne,me){var ue=ne.prefixCls,ae=ne.editable,G=ne.locale,Y=ne.style;return!ae||ae.showAdd===!1?null:E.createElement("button",{ref:me,type:"button",className:"".concat(ue,"-nav-add"),style:Y,"aria-label":(G==null?void 0:G.addAriaLabel)||"Add tab",onClick:function(se){ae.onEdit("add",{event:se})}},ae.addIcon||"+")}var Cr=E.forwardRef(Hn);function Fr(ne,me){var ue=ne.prefixCls,ae=ne.id,G=ne.tabs,Y=ne.locale,z=ne.mobile,se=ne.moreIcon,le=se===void 0?"More":se,_e=ne.moreTransitionName,be=ne.style,Se=ne.className,Ie=ne.editable,nt=ne.tabBarGutter,et=ne.rtl,ct=ne.onTabClick,Yt=Object(E.useState)(!1),dn=Object(j.a)(Yt,2),en=dn[0],sn=dn[1],cn=Object(E.useState)(null),ln=Object(j.a)(cn,2),nn=ln[0],mn=ln[1],hn="".concat(ae,"-more-popup"),Xn="".concat(ue,"-dropdown"),En=nn!==null?"".concat(hn,"-").concat(nn):null,$t=Y==null?void 0:Y.dropdownAriaLabel,Vt=E.createElement(ar,{onClick:function(gn){var Gn=gn.key,hr=gn.domEvent;ct(Gn,hr),sn(!1)},id:hn,tabIndex:-1,role:"listbox","aria-activedescendant":En,selectedKeys:[nn],"aria-label":$t!==void 0?$t:"expanded dropdown"},G.map(function(qt){return E.createElement(jn,{key:qt.key,id:"".concat(hn,"-").concat(qt.key),role:"option","aria-controls":ae&&"".concat(ae,"-panel-").concat(qt.key),disabled:qt.disabled},qt.tab)}));function vn(qt){for(var gn=G.filter(function(wr){return!wr.disabled}),Gn=gn.findIndex(function(wr){return wr.key===nn})||0,hr=gn.length,Sr=0;Sr<hr;Sr+=1){Gn=(Gn+qt+hr)%hr;var Qn=gn[Gn];if(!Qn.disabled){mn(Qn.key);return}}}function pn(qt){var gn=qt.which;if(!en){[b.a.DOWN,b.a.SPACE,b.a.ENTER].includes(gn)&&(sn(!0),qt.preventDefault());return}switch(gn){case b.a.UP:vn(-1),qt.preventDefault();break;case b.a.DOWN:vn(1),qt.preventDefault();break;case b.a.ESC:sn(!1);break;case b.a.SPACE:case b.a.ENTER:nn!==null&&ct(nn,qt);break}}Object(E.useEffect)(function(){var qt=document.getElementById(En);qt&&qt.scrollIntoView&&qt.scrollIntoView(!1)},[nn]),Object(E.useEffect)(function(){en||mn(null)},[en]);var Mt=Object(Ee.a)({},et?"marginLeft":"marginRight",nt);G.length||(Mt.visibility="hidden",Mt.order=1);var Cn=I()(Object(Ee.a)({},"".concat(Xn,"-rtl"),et)),Fn=z?null:E.createElement(Zn.a,{prefixCls:Xn,overlay:Vt,trigger:["hover"],visible:en,transitionName:_e,onVisibleChange:sn,overlayClassName:Cn,mouseEnterDelay:.1,mouseLeaveDelay:.1},E.createElement("button",{type:"button",className:"".concat(ue,"-nav-more"),style:Mt,tabIndex:-1,"aria-hidden":"true","aria-haspopup":"listbox","aria-controls":hn,id:"".concat(ae,"-more"),"aria-expanded":en,onKeyDown:pn},le));return E.createElement("div",{className:I()("".concat(ue,"-nav-operations"),Se),style:be,ref:me},Fn,E.createElement(Cr,{prefixCls:ue,locale:Y,editable:Ie}))}var Jr=E.forwardRef(Fr),mr=Object(E.createContext)(null),Tr=.1,ir=.01,or=20,Mr=Math.pow(.995,or);function aa(){var ne=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(ne)||/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(ne.substr(0,4)))}function Na(ne,me){var ue=Object(E.useState)(),ae=Object(j.a)(ue,2),G=ae[0],Y=ae[1],z=Object(E.useState)(0),se=Object(j.a)(z,2),le=se[0],_e=se[1],be=Object(E.useState)(0),Se=Object(j.a)(be,2),Ie=Se[0],nt=Se[1],et=Object(E.useState)(),ct=Object(j.a)(et,2),Yt=ct[0],dn=ct[1],en=Object(E.useRef)();function sn($t){var Vt=$t.touches[0],vn=Vt.screenX,pn=Vt.screenY;Y({x:vn,y:pn}),window.clearInterval(en.current)}function cn($t){if(!G)return;$t.preventDefault();var Vt=$t.touches[0],vn=Vt.screenX,pn=Vt.screenY;Y({x:vn,y:pn});var Mt=vn-G.x,Cn=pn-G.y;me(Mt,Cn);var Fn=Date.now();_e(Fn),nt(Fn-le),dn({x:Mt,y:Cn})}function ln(){if(!G)return;if(Y(null),dn(null),Yt){var $t=Yt.x/Ie,Vt=Yt.y/Ie,vn=Math.abs($t),pn=Math.abs(Vt);if(Math.max(vn,pn)<Tr)return;var Mt=$t,Cn=Vt;en.current=window.setInterval(function(){if(Math.abs(Mt)<ir&&Math.abs(Cn)<ir){window.clearInterval(en.current);return}Mt*=Mr,Cn*=Mr,me(Mt*or,Cn*or)},or)}}var nn=Object(E.useRef)(0),mn=Object(E.useRef)(!1),hn=Object(E.useRef)();function Xn($t){var Vt=$t.deltaX,vn=$t.deltaY,pn=0,Mt=Math.abs(Vt),Cn=Math.abs(vn);Mt===Cn?pn=hn.current==="x"?Vt:vn:Mt>Cn?(pn=Vt,hn.current="x"):(pn=vn,hn.current="y");var Fn=Date.now();Fn-nn.current>100&&(mn.current=!1),(me(-pn,-pn)||mn.current)&&($t.preventDefault(),mn.current=!0),nn.current=Fn}var En=Object(E.useRef)(null);En.current={onTouchStart:sn,onTouchMove:cn,onTouchEnd:ln,onWheel:Xn},E.useEffect(function(){function $t(Mt){En.current.onTouchStart(Mt)}function Vt(Mt){En.current.onTouchMove(Mt)}function vn(Mt){En.current.onTouchEnd(Mt)}function pn(Mt){En.current.onWheel(Mt)}return document.addEventListener("touchmove",Vt,{passive:!1}),document.addEventListener("touchend",vn,{passive:!1}),ne.current.addEventListener("touchstart",$t,{passive:!1}),ne.current.addEventListener("wheel",pn),function(){document.removeEventListener("touchmove",Vt),document.removeEventListener("touchend",vn)}},[])}function Va(){var ne=Object(E.useRef)(new Map);function me(ae){return ne.current.has(ae)||ne.current.set(ae,E.createRef()),ne.current.get(ae)}function ue(ae){ne.current.delete(ae)}return[me,ue]}function xa(ne,me){var ue=E.useRef(ne),ae=E.useState({}),G=Object(j.a)(ae,2),Y=G[1];function z(se){var le=typeof se=="function"?se(ue.current):se;le!==ue.current&&me(le,ue.current),ue.current=le,Y({})}return[ue.current,z]}var Ua=function(me){var ue=me.position,ae=me.prefixCls,G=me.extra;if(!G)return null;var Y,z=G;return ue==="right"&&(Y=z.right||!z.left&&z||null),ue==="left"&&(Y=z.left||null),Y?E.createElement("div",{className:"".concat(ae,"-extra-content")},Y):null};function Ca(ne,me){var ue,ae=E.useContext(mr),G=ae.prefixCls,Y=ae.tabs,z=ne.className,se=ne.style,le=ne.id,_e=ne.animated,be=ne.activeKey,Se=ne.rtl,Ie=ne.extra,nt=ne.editable,et=ne.locale,ct=ne.tabPosition,Yt=ne.tabBarGutter,dn=ne.children,en=ne.onTabClick,sn=ne.onTabScroll,cn=Object(E.useRef)(),ln=Object(E.useRef)(),nn=Object(E.useRef)(),mn=Object(E.useRef)(),hn=Va(),Xn=Object(j.a)(hn,2),En=Xn[0],$t=Xn[1],Vt=ct==="top"||ct==="bottom",vn=xa(0,function(Rn,_n){Vt&&sn&&sn({direction:Rn>_n?"left":"right"})}),pn=Object(j.a)(vn,2),Mt=pn[0],Cn=pn[1],Fn=xa(0,function(Rn,_n){!Vt&&sn&&sn({direction:Rn>_n?"top":"bottom"})}),qt=Object(j.a)(Fn,2),gn=qt[0],Gn=qt[1],hr=Object(E.useState)(0),Sr=Object(j.a)(hr,2),Qn=Sr[0],wr=Sr[1],Kr=Object(E.useState)(0),Dr=Object(j.a)(Kr,2),kr=Dr[0],rn=Dr[1],fr=Object(E.useState)(0),sr=Object(j.a)(fr,2),er=sr[0],Wr=sr[1],Hr=Object(E.useState)(0),$r=Object(j.a)(Hr,2),Ln=$r[0],Ir=$r[1],Xr=Object(E.useState)(null),Mn=Object(j.a)(Xr,2),Tn=Mn[0],lr=Mn[1],fa=Object(E.useState)(null),ea=Object(j.a)(fa,2),Qr=ea[0],Ya=ea[1],Qa=Object(E.useState)(0),Ba=Object(j.a)(Qa,2),ta=Ba[0],Ja=Ba[1],Za=Object(E.useState)(0),Fa=Object(j.a)(Za,2),qa=Fa[0],Sa=Fa[1],Ka=x(new Map),wa=Object(j.a)(Ka,2),Oa=wa[0],Ra=wa[1],na=s(Y,Oa,Qn),Wa="".concat(G,"-nav-operations-hidden"),oa=0,sa=0;Vt?Se?(oa=0,sa=Math.max(0,Qn-Tn)):(oa=Math.min(0,Tn-Qn),sa=0):(oa=Math.min(0,Qr-kr),sa=0);function Pa(Rn){return Rn<oa?[oa,!1]:Rn>sa?[sa,!1]:[Rn,!0]}var Ha=Object(E.useRef)(),ai=Object(E.useState)(),Ga=Object(j.a)(ai,2),pa=Ga[0],za=Ga[1];function ma(){za(Date.now())}function va(){window.clearTimeout(Ha.current)}Na(cn,function(Rn,_n){var vr=!1;function zr(Da,ka){Da(function(La){var Ma=Pa(La+ka),ga=Object(j.a)(Ma,2),ei=ga[0],ti=ga[1];return vr=ti,ei})}if(Vt){if(Tn>=Qn)return vr;zr(Cn,Rn)}else{if(Qr>=kr)return vr;zr(Gn,_n)}return va(),ma(),vr}),Object(E.useEffect)(function(){return va(),pa&&(Ha.current=window.setTimeout(function(){za(0)},100)),va},[pa]);function Aa(){var Rn=arguments.length>0&&arguments[0]!==void 0?arguments[0]:be,_n=na.get(Rn);if(!_n)return;if(Vt){var vr=Mt;Se?_n.right<Mt?vr=_n.right:_n.right+_n.width>Mt+Tn&&(vr=_n.right+_n.width-Tn):_n.left<-Mt?vr=-_n.left:_n.left+_n.width>-Mt+Tn&&(vr=-(_n.left+_n.width-Tn)),Gn(0),Cn(Pa(vr)[0])}else{var zr=gn;_n.top<-gn?zr=-_n.top:_n.top+_n.height>-gn+Qr&&(zr=-(_n.top+_n.height-Qr)),Cn(0),Gn(Pa(zr)[0])}}var ii=d(na,{width:Tn,height:Qr,left:Mt,top:gn},{width:er,height:Ln},{width:ta,height:qa},Object(N.a)(Object(N.a)({},ne),{},{tabs:Y})),je=Object(j.a)(ii,2),Ae=je[0],Me=je[1],$e=Y.map(function(Rn){var _n=Rn.key;return E.createElement(n,{id:le,prefixCls:G,key:_n,rtl:Se,tab:Rn,closable:Rn.closable,editable:nt,active:_n===be,tabPosition:ct,tabBarGutter:Yt,renderWrapper:dn,removeAriaLabel:et==null?void 0:et.removeAriaLabel,ref:En(_n),onClick:function(zr){en(_n,zr)},onRemove:function(){$t(_n)},onFocus:function(){Aa(_n),ma(),Se||(cn.current.scrollLeft=0),cn.current.scrollTop=0}})}),st=C(function(){var Rn,_n,vr,zr,Da,ka,La,Ma,ga,ei=((Rn=cn.current)===null||Rn===void 0?void 0:Rn.offsetWidth)||0,ti=((_n=cn.current)===null||_n===void 0?void 0:_n.offsetHeight)||0,oi=((vr=mn.current)===null||vr===void 0?void 0:vr.offsetWidth)||0,si=((zr=mn.current)===null||zr===void 0?void 0:zr.offsetHeight)||0,fi=((Da=nn.current)===null||Da===void 0?void 0:Da.offsetWidth)||0,pi=((ka=nn.current)===null||ka===void 0?void 0:ka.offsetHeight)||0;lr(ei),Ya(ti),Ja(oi),Sa(si);var li=(((La=ln.current)===null||La===void 0?void 0:La.offsetWidth)||0)-oi,ui=(((Ma=ln.current)===null||Ma===void 0?void 0:Ma.offsetHeight)||0)-si;wr(li),rn(ui);var di=(ga=nn.current)===null||ga===void 0?void 0:ga.className.includes(Wa);Wr(li-(di?0:fi)),Ir(ui-(di?0:pi)),Ra(function(){var ci=new Map;return Y.forEach(function(mi){var hi=mi.key,Ia=En(hi).current;Ia&&ci.set(hi,{width:Ia.offsetWidth,height:Ia.offsetHeight,left:Ia.offsetLeft,top:Ia.offsetTop})}),ci})}),Ct=Y.slice(0,Ae),pt=Y.slice(Me+1),Tt=[].concat(Object(P.a)(Ct),Object(P.a)(pt)),On=Object(E.useState)(),An=Object(j.a)(On,2),Gr=An[0],yn=An[1],tr=na.get(be),Nr=Object(E.useRef)();function ur(){S.a.cancel(Nr.current)}Object(E.useEffect)(function(){var Rn={};return tr&&(Vt?(Se?Rn.right=tr.right:Rn.left=tr.left,Rn.width=tr.width):(Rn.top=tr.top,Rn.height=tr.height)),ur(),Nr.current=S()(function(){yn(Rn)}),ur},[tr,Vt,Se]),Object(E.useEffect)(function(){Aa()},[be,tr,na,Vt]),Object(E.useEffect)(function(){st()},[Se,Yt,be,Y.map(function(Rn){return Rn.key}).join("_")]);var Yr=!!Tt.length,Un="".concat(G,"-nav-wrap"),yr,Or,la,Lr;return Vt?Se?(Or=Mt>0,yr=Mt+Tn<Qn):(yr=Mt<0,Or=-Mt+Tn<Qn):(la=gn<0,Lr=-gn+Qr<kr),E.createElement("div",{ref:me,role:"tablist",className:I()("".concat(G,"-nav"),z),style:se,onKeyDown:function(){ma()}},E.createElement(Ua,{position:"left",extra:Ie,prefixCls:G}),E.createElement(O.a,{onResize:st},E.createElement("div",{className:I()(Un,(ue={},Object(Ee.a)(ue,"".concat(Un,"-ping-left"),yr),Object(Ee.a)(ue,"".concat(Un,"-ping-right"),Or),Object(Ee.a)(ue,"".concat(Un,"-ping-top"),la),Object(Ee.a)(ue,"".concat(Un,"-ping-bottom"),Lr),ue)),ref:cn},E.createElement(O.a,{onResize:st},E.createElement("div",{ref:ln,className:"".concat(G,"-nav-list"),style:{transform:"translate(".concat(Mt,"px, ").concat(gn,"px)"),transition:pa?"none":void 0}},$e,E.createElement(Cr,{ref:mn,prefixCls:G,locale:et,editable:nt,style:{visibility:Yr?"hidden":null}}),E.createElement("div",{className:I()("".concat(G,"-ink-bar"),Object(Ee.a)({},"".concat(G,"-ink-bar-animated"),_e.inkBar)),style:Gr}))))),E.createElement(Jr,Object.assign({},ne,{ref:nn,prefixCls:G,tabs:Tt,className:!Yr&&Wa})),E.createElement(Ua,{position:"right",extra:Ie,prefixCls:G}))}var ja=E.forwardRef(Ca);function ni(ne){var me=ne.id,ue=ne.activeKey,ae=ne.animated,G=ne.tabPosition,Y=ne.rtl,z=ne.destroyInactiveTabPane,se=E.useContext(mr),le=se.prefixCls,_e=se.tabs,be=ae.tabPane,Se=_e.findIndex(function(Ie){return Ie.key===ue});return E.createElement("div",{className:I()("".concat(le,"-content-holder"))},E.createElement("div",{className:I()("".concat(le,"-content"),"".concat(le,"-content-").concat(G),Object(Ee.a)({},"".concat(le,"-content-animated"),be)),style:Se&&be?Object(Ee.a)({},Y?"marginRight":"marginLeft","-".concat(Se,"00%")):null},_e.map(function(Ie){return E.cloneElement(Ie.node,{key:Ie.key,prefixCls:le,tabKey:Ie.key,id:me,animated:be,active:Ie.key===ue,destroyInactiveTabPane:z})})))}function ia(ne){var me=ne.prefixCls,ue=ne.forceRender,ae=ne.className,G=ne.style,Y=ne.id,z=ne.active,se=ne.animated,le=ne.destroyInactiveTabPane,_e=ne.tabKey,be=ne.children,Se=E.useState(ue),Ie=Object(j.a)(Se,2),nt=Ie[0],et=Ie[1];E.useEffect(function(){z?et(!0):le&&et(!1)},[z,le]);var ct={};return z||(se?(ct.visibility="hidden",ct.height=0,ct.overflowY="hidden"):ct.display="none"),E.createElement("div",{id:Y&&"".concat(Y,"-panel-").concat(_e),role:"tabpanel",tabIndex:z?0:-1,"aria-labelledby":Y&&"".concat(Y,"-tab-").concat(_e),"aria-hidden":!z,style:Object(N.a)(Object(N.a)({},ct),G),className:I()("".concat(me,"-tabpane"),z&&"".concat(me,"-tabpane-active"),ae)},(z||nt||ue)&&be)}var qr=0;function cr(ne){return Object(M.a)(ne).map(function(me){if(E.isValidElement(me)){var ue=me.key!==void 0?String(me.key):void 0;return Object(N.a)(Object(N.a)({key:ue},me.props),{},{node:me})}return null}).filter(function(me){return me})}function $a(ne,me){var ue,ae=ne.id,G=ne.prefixCls,Y=G===void 0?"rc-tabs":G,z=ne.className,se=ne.children,le=ne.direction,_e=ne.activeKey,be=ne.defaultActiveKey,Se=ne.editable,Ie=ne.animated,nt=ne.tabPosition,et=nt===void 0?"top":nt,ct=ne.tabBarGutter,Yt=ne.tabBarStyle,dn=ne.tabBarExtraContent,en=ne.locale,sn=ne.moreIcon,cn=ne.moreTransitionName,ln=ne.destroyInactiveTabPane,nn=ne.renderTabBar,mn=ne.onChange,hn=ne.onTabClick,Xn=ne.onTabScroll,En=Object(w.a)(ne,["id","prefixCls","className","children","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","moreIcon","moreTransitionName","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll"]),$t=cr(se),Vt=le==="rtl",vn;Ie===!1?vn={inkBar:!1,tabPane:!1}:vn=Object(N.a)({inkBar:!0,tabPane:!1},Ie!==!0?Ie:null);var pn=Object(E.useState)(!1),Mt=Object(j.a)(pn,2),Cn=Mt[0],Fn=Mt[1];Object(E.useEffect)(function(){Fn(aa())},[]);var qt=Object(T.a)(function(){var Ln;return(Ln=$t[0])===null||Ln===void 0?void 0:Ln.key},{value:_e,defaultValue:be}),gn=Object(j.a)(qt,2),Gn=gn[0],hr=gn[1],Sr=Object(E.useState)(function(){return $t.findIndex(function(Ln){return Ln.key===Gn})}),Qn=Object(j.a)(Sr,2),wr=Qn[0],Kr=Qn[1];Object(E.useEffect)(function(){var Ln=$t.findIndex(function(Xr){return Xr.key===Gn});if(Ln===-1){var Ir;Ln=Math.max(0,Math.min(wr,$t.length-1)),hr((Ir=$t[Ln])===null||Ir===void 0?void 0:Ir.key)}Kr(Ln)},[$t.map(function(Ln){return Ln.key}).join("_"),Gn,wr]);var Dr=Object(T.a)(null,{value:ae}),kr=Object(j.a)(Dr,2),rn=kr[0],fr=kr[1],sr=et;Cn&&!["left","right"].includes(et)&&(sr="top"),Object(E.useEffect)(function(){ae||(fr("rc-tabs-".concat(qr)),qr+=1)},[]);function er(Ln,Ir){hn==null||hn(Ln,Ir),hr(Ln),mn==null||mn(Ln)}var Wr={id:rn,activeKey:Gn,animated:vn,tabPosition:sr,rtl:Vt,mobile:Cn},Hr,$r=Object(N.a)(Object(N.a)({},Wr),{},{editable:Se,locale:en,moreIcon:sn,moreTransitionName:cn,tabBarGutter:ct,onTabClick:er,onTabScroll:Xn,extra:dn,style:Yt,panes:se});return nn?Hr=nn($r,ja):Hr=E.createElement(ja,Object.assign({},$r)),E.createElement(mr.Provider,{value:{tabs:$t,prefixCls:Y}},E.createElement("div",Object.assign({ref:me,id:ae,className:I()(Y,"".concat(Y,"-").concat(sr),(ue={},Object(Ee.a)(ue,"".concat(Y,"-mobile"),Cn),Object(Ee.a)(ue,"".concat(Y,"-editable"),Se),Object(Ee.a)(ue,"".concat(Y,"-rtl"),Vt),ue),z)},En),Hr,E.createElement(ni,Object.assign({destroyInactiveTabPane:ln},Wr,{animated:vn}))))}var Ta=E.forwardRef($a);Ta.TabPane=ia;var Xa=Ta,ri=Ye.b=Xa},mOS8:function(Pt,Ye,W){Pt.exports=W.p+"static/403Qrcode.6c17b6f4.png"},mgmH:function(Pt,Ye,W){"use strict";W.d(Ye,"d",function(){return O}),W.d(Ye,"b",function(){return C}),W.d(Ye,"e",function(){return x}),W.d(Ye,"c",function(){return b}),W.d(Ye,"n",function(){return p}),W.d(Ye,"g",function(){return n}),W.d(Ye,"h",function(){return l}),W.d(Ye,"j",function(){return g}),W.d(Ye,"a",function(){return d}),W.d(Ye,"l",function(){return u}),W.d(Ye,"f",function(){return m}),W.d(Ye,"k",function(){return h}),W.d(Ye,"m",function(){return a}),W.d(Ye,"i",function(){return r}),W.d(Ye,"o",function(){return e}),W.d(Ye,"r",function(){return i}),W.d(Ye,"q",function(){return v}),W.d(Ye,"p",function(){return f});var Ee=W("miYZ"),j=W("tsqr"),w=W("k1fw"),N=W("9og8"),E=W("WmNS"),R=W.n(E),I=W("oUNq"),M=W("9kvl"),T=W("1vsH"),P=W("m3rI"),_=function(){Object(M.c)()._store.dispatch({type:"globalSetting/setGlobalLoading",payload:{show:!0,text:"\u6B63\u5728\u751F\u6210\u6587\u4EF6\uFF0C\u8BF7\u7A0D\u540E..."}})},S=function(){Object(M.c)()._store.dispatch({type:"globalSetting/setGlobalLoading",payload:{show:!1,text:""}})},O=function(){var y=Object(N.a)(R.a.mark(function t(A){var U;return R.a.wrap(function(H){for(;;)switch(H.prev=H.next){case 0:return _(),H.next=3,Object(I.s)(Object(w.a)({},A));case 3:if(U=H.sent,!(U.status===0)){H.next=7;break}return H.next=7,Object(T.u)("",Object(T.W)({url:P.a.API_SERVER+"/api/courses/".concat(A.coursesId,"/export_couser_info.json"),query:A}));case 7:S();case 8:case"end":return H.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),C=function(){var y=Object(N.a)(R.a.mark(function t(A){var U;return R.a.wrap(function(H){for(;;)switch(H.prev=H.next){case 0:return H.next=2,Object(I.q)(Object(w.a)({},A));case 2:if(U=H.sent,!(U.status===0)){H.next=8;break}j.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),M.d.push("/classrooms/".concat(A.coursesId,"/exportlist/course_member_act_score")),H.next=13;break;case 8:if(!(U.status===-2)){H.next=12;break}return H.abrupt("return",U);case 12:U.status===-3&&(Object(M.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),M.d.push("/classrooms/".concat(A.coursesId,"/exportlist/course_member_act_score")));case 13:case"end":return H.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),x=function(){var y=Object(N.a)(R.a.mark(function t(A){var U;return R.a.wrap(function(H){for(;;)switch(H.prev=H.next){case 0:return H.next=2,Object(I.t)(Object(w.a)({},A));case 2:if(U=H.sent,!(U.status===0)){H.next=8;break}j.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),M.d.push("/classrooms/".concat(A.coursesId,"/exportlist/course_total_score")),H.next=13;break;case 8:if(!(U.status===-2)){H.next=12;break}return H.abrupt("return",U);case 12:U.status===-3&&(Object(M.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),M.d.push("/classrooms/".concat(A.coursesId,"/exportlist/course_total_score")));case 13:case"end":return H.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),b=function(){var y=Object(N.a)(R.a.mark(function t(A){var U;return R.a.wrap(function(H){for(;;)switch(H.prev=H.next){case 0:return H.next=2,Object(I.r)(Object(w.a)({},A));case 2:if(U=H.sent,!(U.status===0)){H.next=8;break}j.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),M.d.push("/classrooms/".concat(A.coursesId,"/exportlist/course_total_exercise_and_other")),H.next=13;break;case 8:if(!(U.status===-2)){H.next=12;break}return H.abrupt("return",U);case 12:U.status===-3&&(Object(M.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),M.d.push("/classrooms/".concat(A.coursesId,"/exportlist/course_total_exercise_and_other")));case 13:case"end":return H.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),p=function(){var y=Object(N.a)(R.a.mark(function t(A){var U;return R.a.wrap(function(H){for(;;)switch(H.prev=H.next){case 0:return H.next=2,Object(I.y)(Object(w.a)({},A));case 2:if(U=H.sent,!(U.status===0)){H.next=8;break}j.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),M.d.push("/classrooms/".concat(A.coursesId,"/exportlist/course_total_exercise_and_other")),H.next=13;break;case 8:if(!(U.status===-2)){H.next=12;break}return H.abrupt("return",U);case 12:U.status===-3&&(Object(M.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),M.d.push("/classrooms/".concat(A.coursesId,"/exportlist/course_total_exercise_and_other")));case 13:case"end":return H.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),n=function(){var y=Object(N.a)(R.a.mark(function t(A){var U;return R.a.wrap(function(H){for(;;)switch(H.prev=H.next){case 0:return H.next=2,Object(I.u)(Object(w.a)({},A));case 2:if(U=H.sent,!(U.status===0)){H.next=8;break}j.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),M.d.push("/classrooms/".concat(A.coursesId,"/exportlist/course_total_homework")),H.next=13;break;case 8:if(!(U.status===-2)){H.next=12;break}return H.abrupt("return",U);case 12:U.status===-3&&(Object(M.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),M.d.push("/classrooms/".concat(A.coursesId,"/exportlist/course_total_homework")));case 13:case"end":return H.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),l=function(){var y=Object(N.a)(R.a.mark(function t(A,U){var F;return R.a.wrap(function(J){for(;;)switch(J.prev=J.next){case 0:return J.next=2,Object(I.w)(Object(w.a)({},A));case 2:F=J.sent,F.status===0?(j.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),M.d.push("/classrooms/".concat(A.coursesId,"/exportlist/").concat(U))):F.status===-3&&(Object(M.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),M.d.push("/classrooms/".concat(A.coursesId,"/exportlist/").concat(U)));case 4:case"end":return J.stop()}},t)}));return function(A,U){return y.apply(this,arguments)}}(),s=function(){var y=Object(N.a)(R.a.mark(function t(A){var U;return R.a.wrap(function(H){for(;;)switch(H.prev=H.next){case 0:return _(),H.next=3,Object(I.v)(Object(w.a)({},A));case 3:if(U=H.sent,!(U.status===0)){H.next=7;break}return H.next=7,Object(T.u)("",Object(T.W)({url:P.a.API_SERVER+"/api/homework_commons/".concat(A.categoryId,"/works_list.zip"),query:A}));case 7:S();case 8:case"end":return H.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),g=function(){var y=Object(N.a)(R.a.mark(function t(A){var U;return R.a.wrap(function(H){for(;;)switch(H.prev=H.next){case 0:return _(),H.next=3,Object(I.z)(Object(w.a)({},A));case 3:if(U=H.sent,!(U.status===0)){H.next=7;break}return H.next=7,Object(T.u)("",Object(T.W)({url:P.a.API_SERVER+"/api/polls/".concat(A.categoryId,"/commit_result.xlsx"),query:A}));case 7:S();case 8:case"end":return H.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),d=function(){var y=Object(N.a)(R.a.mark(function t(A){return R.a.wrap(function(F){for(;;)switch(F.prev=F.next){case 0:return F.next=2,Object(T.t)("",Object(T.W)({url:P.a.API_SERVER+"/api/courses/".concat(A.coursesId,"/attendances/export_xlsx_data.xlsx"),query:A}));case 2:case"end":return F.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),u=function(){var y=Object(N.a)(R.a.mark(function t(A){return R.a.wrap(function(F){for(;;)switch(F.prev=F.next){case 0:return F.next=2,Object(T.t)("",Object(T.W)({url:P.a.API_SERVER+"/api/courses/".concat(A.coursesId,"/video_study_statics.xlsx"),query:A}));case 2:case"end":return F.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),m=function(){var y=Object(N.a)(R.a.mark(function t(A){return R.a.wrap(function(F){for(;;)switch(F.prev=F.next){case 0:return F.next=2,Object(T.t)("",Object(T.W)({url:P.a.API_SERVER+"/api/courses/".concat(A.coursesId,"/export_course_students_info.xlsx"),query:A}));case 2:case"end":return F.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),h=function(){var y=Object(N.a)(R.a.mark(function t(A){return R.a.wrap(function(F){for(;;)switch(F.prev=F.next){case 0:return F.next=2,Object(T.t)("",Object(T.W)({url:P.a.API_SERVER+"/api/item_banks/export.xlsx",query:A}));case 2:case"end":return F.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),a=function(){var y=Object(N.a)(R.a.mark(function t(A){return R.a.wrap(function(F){for(;;)switch(F.prev=F.next){case 0:return F.next=2,Object(T.t)("",Object(T.W)({url:P.a.API_SERVER+"/api/competitions/region_reports.xlsx",query:A}));case 2:case"end":return F.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),r=function(){var y=Object(N.a)(R.a.mark(function t(A){var U;return R.a.wrap(function(H){for(;;)switch(H.prev=H.next){case 0:return H.next=2,Object(I.x)(Object(w.a)({},A));case 2:U=H.sent,U.status===0?(j.b.info("\u5BFC\u51FA\u4EFB\u52A1\u751F\u6210\u6210\u529F"),M.d.push("/classrooms/".concat(A.coursesId,"/exportlist/exercise_score"))):U.status===-3&&(Object(M.c)()._store.dispatch({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u63D0\u9192"}}),M.d.push("/classrooms/".concat(A.coursesId,"/exportlist/exercise_score")));case 4:case"end":return H.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),e=function(){var y=Object(N.a)(R.a.mark(function t(A){return R.a.wrap(function(F){for(;;)switch(F.prev=F.next){case 0:return console.log("----------","\u8C03\u7528\u4E0B\u8F7D"),F.next=3,Object(T.t)("",Object(T.W)({url:P.a.API_SERVER+"/api/export_records/".concat(A.id,".xlsx"),query:A}));case 3:case"end":return F.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),i=function(){var y=Object(N.a)(R.a.mark(function t(A){return R.a.wrap(function(F){for(;;)switch(F.prev=F.next){case 0:return F.next=2,Object(T.t)("",Object(T.W)({url:P.a.API_SERVER+"/api/ec_major_schools/0/ec_years.xlsx",query:A}));case 2:case"end":return F.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),v=function(){var y=Object(N.a)(R.a.mark(function t(A){return R.a.wrap(function(F){for(;;)switch(F.prev=F.next){case 0:return F.next=2,Object(T.t)("",Object(T.W)({url:P.a.API_SERVER+"/api/ec_years/".concat(A==null?void 0:A.ec_year_id,"/ec_training_objectives.xlsx"),query:A}));case 2:case"end":return F.stop()}},t)}));return function(A){return y.apply(this,arguments)}}(),f=function(){var y=Object(N.a)(R.a.mark(function t(A){return R.a.wrap(function(F){for(;;)switch(F.prev=F.next){case 0:return F.next=2,Object(T.t)("",Object(T.W)({url:P.a.API_SERVER+"/api/ec_years/".concat(A==null?void 0:A.ec_year_id,"/ec_graduation_requirements.xlsx"),query:A}));case 2:case"end":return F.stop()}},t)}));return function(A){return y.apply(this,arguments)}}()},nSDg:function(Pt,Ye,W){Pt.exports={flex_box_center:"flex_box_center___2lqeg",flex_space_between:"flex_space_between___RuZ2s",flex_box_vertical_center:"flex_box_vertical_center___2AGHP",flex_box_center_end:"flex_box_center_end___FDazu",flex_box_column:"flex_box_column___1Yqjx",wrp:"wrp____lZAZ",drawer:"drawer___2XpEN",menu:"menu___fZQrG",actived:"actived___1Yg9q",actived2:"actived2___2KHN5",subTag:"subTag___3AbgU",directionName:"directionName___2Xp-L",menuDirection:"menuDirection___1ZMmo",listItem:"listItem___g9W0X",info:"info___1FHWU",title:"title___1VzwI",titleLeft:"titleLeft___yvqaz",titleRight:"titleRight___2Dqm5",search:"search___3pcQt",description:"description___3yQGh",menuCourse:"menuCourse___3iBFc",paginationWrap:"paginationWrap___KxpDN"}},p5ED:function(Pt,Ye,W){"use strict";var Ee=W("+L6B"),j=W("2/Rp"),w=W("5Dmo"),N=W("3S7+"),E=W("k1fw"),R=W("tJVT"),I=W("q1tI"),M=W.n(I),T=W("vHTk"),P=W.n(T),_=W("yEEn"),S=W("ZW9T"),O=W("1vsH");Ye.a=function(C){var x=C.name,b=C.data,p=C.theme,n=C.type,l=C.filename,s=C.monacoEditor,g=C.className,d=C.style,u=C.close,m=C.onClose,h=C.hasMask,a=Object(I.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),r=Object(R.a)(a,2),e=r[0],i=r[1],v=Object(I.useState)(""),f=Object(R.a)(v,2),y=f[0],t=f[1],A=Object(I.useRef)();l&&(s.filename=l),Object(I.useEffect)(function(){var H,J,B=(H=document.cookie)===null||H===void 0||((J=H.replace(/\s/g,""))===null||J===void 0)?void 0:J.split(";");B==null||B.map(function(Z){var re=Z.split("=");re[0]==="_educoder_session"&&t(re[1])})},[]);var U=function(){if(b.startsWith("http")||b.startsWith("/")){F();return}Object(O.x)(l||"educoder",b,l)},F=function(){Object(O.v)(l||x,b)};return console.log("data:",b,"fileanme:",l," name:",x),M.a.createElement("div",{style:Object(E.a)({},d||{}),className:"".concat(h&&P.a.bgBlack," ").concat(n?P.a.wrp:"hide")},u&&M.a.createElement("div",{className:P.a.close,ref:A},M.a.createElement(N.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return A.current}},M.a.createElement("span",{onClick:F},M.a.createElement("i",{className:"icon-quxiaozhiding"}))),M.a.createElement(N.a,{title:"\u5173\u95ED",getPopupContainer:function(){return A.current}},M.a.createElement("span",{className:"",onClick:m},M.a.createElement("i",{className:"icon-guanbi1"})))),M.a.createElement("div",{className:"".concat(P.a[g]," ").concat(g," ").concat(P.a.monaco," ").concat(n==="txt"?"show":"hide")},n==="txt"&&M.a.createElement(S.b,s)),n==="audio"&&M.a.createElement("audio",{src:"".concat(b!=null&&b.startsWith("/")||(b==null?void 0:b.indexOf("https://"))>-1?b:"data:audio/mp3;base64,").concat(b),autoPlay:!0}),n==="video"&&M.a.createElement(M.a.Fragment,null,b!=null&&b.startsWith("/")?M.a.createElement("video",{controls:!0,src:"".concat(b),autoPlay:!0}):M.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(b),autoPlay:!0})),n==="html"&&M.a.createElement("iframe",{src:b+"&disposition=inline"}),n==="pdf"&&M.a.createElement("embed",{className:P.a.embed,src:b}),n==="image"&&M.a.createElement(M.a.Fragment,null,M.a.createElement("img",{src:"".concat(b!=null&&b.startsWith("/")||(b==null?void 0:b.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(b)})),n==="other"&&M.a.createElement("div",null,M.a.createElement(j.a,{type:"primary",size:"large",onClick:U},M.a.createElement(_.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(n==="download"||n==="office")&&M.a.createElement(j.a,{type:"primary",size:"large",onClick:U},M.a.createElement(_.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"rAM+":function(Pt,Ye,W){"use strict";W.d(Ye,"a",function(){return j});var Ee=W("Qw5x");function j(w,N){var E;if(typeof Symbol=="undefined"||w[Symbol.iterator]==null){if(Array.isArray(w)||(E=Object(Ee.a)(w))||N&&w&&typeof w.length=="number"){E&&(w=E);var R=0,I=function(){};return{s:I,n:function(){return R>=w.length?{done:!0}:{done:!1,value:w[R++]}},e:function(S){throw S},f:I}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var M=!0,T=!1,P;return{s:function(){E=w[Symbol.iterator]()},n:function(){var S=E.next();return M=S.done,S},e:function(S){T=!0,P=S},f:function(){try{!M&&E.return!=null&&E.return()}finally{if(T)throw P}}}}},rCGY:function(Pt,Ye,W){Pt.exports={groupWrap:"groupWrap___3dz2S",directionItem:"directionItem___2Jxzl",active:"active___2GpP3",directionContentWrap:"directionContentWrap___1_SmE",minWidth43:"minWidth43___32DTk",minWidth73:"minWidth73___e9DAK",minWidth60:"minWidth60___cP-g2",delete:"delete___1fhs4"}},rUJ1:function(Pt,Ye){const W=/[&<>"']/,Ee=/[&<>"']/g,j=/[<>"']|&(?!#?\w+;)/,w=/[<>"']|&(?!#?\w+;)/g,N={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},E=h=>N[h];function R(h,a){if(a){if(W.test(h))return h.replace(Ee,E)}else if(j.test(h))return h.replace(w,E);return h}const I=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function M(h){return h.replace(I,(a,r)=>(r=r.toLowerCase(),r==="colon"?":":r.charAt(0)==="#"?r.charAt(1)==="x"?String.fromCharCode(parseInt(r.substring(2),16)):String.fromCharCode(+r.substring(1)):""))}const T=/(^|[^\[])\^/g;function P(h,a){h=h.source||h,a=a||"";const r={replace:(e,i)=>(i=i.source||i,i=i.replace(T,"$1"),h=h.replace(e,i),r),getRegex:()=>new RegExp(h,a)};return r}const _=/[^\w:]/g,S=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(h,a,r){if(h){let e;try{e=decodeURIComponent(M(r)).replace(_,"").toLowerCase()}catch(i){return null}if(e.indexOf("javascript:")===0||e.indexOf("vbscript:")===0||e.indexOf("data:")===0)return null}a&&!S.test(r)&&(r=n(a,r));try{r=encodeURI(r).replace(/%25/g,"%")}catch(e){return null}return r}const C={},x=/^[^:]+:\/*[^/]*$/,b=/^([^:]+:)[\s\S]*$/,p=/^([^:]+:\/*[^/]*)[\s\S]*$/;function n(h,a){C[" "+h]||(x.test(h)?C[" "+h]=h+"/":C[" "+h]=d(h,"/",!0)),h=C[" "+h];const r=h.indexOf(":")===-1;return a.substring(0,2)==="//"?r?a:h.replace(b,"$1")+a:a.charAt(0)==="/"?r?a:h.replace(p,"$1")+a:h+a}const l={exec:function(){}};function s(h){let a=1,r,e;for(;a<arguments.length;a++){r=arguments[a];for(e in r)Object.prototype.hasOwnProperty.call(r,e)&&(h[e]=r[e])}return h}function g(h,a){const r=h.replace(/\|/g,(v,f,y)=>{let t=!1,A=f;for(;--A>=0&&y[A]==="\\";)t=!t;return t?"|":" |"}),e=r.split(/ \|/);let i=0;if(e.length>a)e.splice(a);else for(;e.length<a;)e.push("");for(;i<e.length;i++)e[i]=e[i].trim().replace(/\\\|/g,"|");return e}function d(h,a,r){const e=h.length;if(e===0)return"";let i=0;for(;i<e;){const v=h.charAt(e-i-1);if(v===a&&!r)i++;else if(v!==a&&r)i++;else break}return h.substr(0,e-i)}function u(h,a){if(h.indexOf(a[1])===-1)return-1;const r=h.length;let e=0,i=0;for(;i<r;i++)if(h[i]==="\\")i++;else if(h[i]===a[0])e++;else if(h[i]===a[1]&&(e--,e<0))return i;return-1}function m(h){h&&h.sanitize&&!h.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")}Pt.exports={escape:R,unescape:M,edit:P,cleanUrl:O,resolveUrl:n,noopTest:l,merge:s,splitCells:g,rtrim:d,findClosingBracket:u,checkSanitizeDeprecation:m}},sboe:function(Pt,Ye,W){"use strict";W.d(Ye,"a",function(){return w});var Ee=W("q1tI"),j=W.n(Ee),w=Ee.createContext(null)},spXi:function(Pt,Ye,W){Pt.exports={flex_box_center:"flex_box_center___2B_Y7",flex_space_between:"flex_space_between___2olzC",flex_box_vertical_center:"flex_box_vertical_center___2Z4dV",flex_box_center_end:"flex_box_center_end___3FiwX",flex_box_column:"flex_box_column___8kyK-",customTree:"customTree___1KOYx",name:"name___3pqs4"}},t23M:function(Pt,Ye,W){"use strict";var Ee=W("VTBJ"),j=W("1OyB"),w=W("vuIU"),N=W("Ji7U"),E=W("LK+K"),R=W("q1tI"),I=W.n(R),M=W("m+aA"),T=W("Zm9Q"),P=W("Kwbf"),_=W("c+Xe"),S=W("bdgK"),O="rc-observer-key",C=function(x){Object(N.a)(p,x);var b=Object(E.a)(p);function p(){var n;return Object(j.a)(this,p),n=b.apply(this,arguments),n.resizeObserver=null,n.childNode=null,n.currentElement=null,n.state={width:0,height:0,offsetHeight:0,offsetWidth:0},n.onResize=function(l){var s=n.props.onResize,g=l[0].target,d=g.getBoundingClientRect(),u=d.width,m=d.height,h=g.offsetWidth,a=g.offsetHeight,r=Math.floor(u),e=Math.floor(m);if(n.state.width!==r||n.state.height!==e||n.state.offsetWidth!==h||n.state.offsetHeight!==a){var i={width:r,height:e,offsetWidth:h,offsetHeight:a};n.setState(i),s&&Promise.resolve().then(function(){s(Object(Ee.a)(Object(Ee.a)({},i),{},{offsetWidth:h,offsetHeight:a}))})}},n.setChildNode=function(l){n.childNode=l},n}return Object(w.a)(p,[{key:"componentDidMount",value:function(){this.onComponentUpdated()}},{key:"componentDidUpdate",value:function(){this.onComponentUpdated()}},{key:"componentWillUnmount",value:function(){this.destroyObserver()}},{key:"onComponentUpdated",value:function(){var l=this.props.disabled;if(l){this.destroyObserver();return}var s=Object(M.a)(this.childNode||this),g=s!==this.currentElement;g&&(this.destroyObserver(),this.currentElement=s),!this.resizeObserver&&s&&(this.resizeObserver=new S.default(this.onResize),this.resizeObserver.observe(s))}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var l=this.props.children,s=Object(T.a)(l);if(s.length>1)Object(P.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(s.length===0)return Object(P.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var g=s[0];if(R.isValidElement(g)&&Object(_.c)(g)){var d=g.ref;s[0]=R.cloneElement(g,{ref:Object(_.a)(d,this.setChildNode)})}return s.length===1?s[0]:s.map(function(u,m){return!R.isValidElement(u)||"key"in u&&u.key!==null?u:R.cloneElement(u,{key:"".concat(O,"-").concat(m)})})}}]),p}(R.Component);C.displayName="ResizeObserver",Ye.a=C},tK3L:function(Pt,Ye,W){Pt.exports={flex_box_center:"flex_box_center___3uV00",flex_space_between:"flex_space_between___253zc",flex_box_vertical_center:"flex_box_vertical_center___3Nn4F",flex_box_center_end:"flex_box_center_end___3N00E",flex_box_column:"flex_box_column___wngbD",wrap:"wrap___1vIxE",title:"title___3EB7K",select:"select___3yoep",contentWrap:"contentWrap___2vBaG",tabsWrap:"tabsWrap___35WZr",searchWrap:"searchWrap___3zxJK",searchContent:"searchContent___1fqwB",search:"search___Qt6zp",batchWrap:"batchWrap___1QFBy",customTable:"customTable___4pmq7",row:"row___mgwpl",contentListWrap:"contentListWrap___sfO91",li:"li___2kFZ7",top:"top___2xOLA",bottom:"bottom___1-hPm",line:"line___2PBOX",actionLeftItem:"actionLeftItem___3mz5t",more:"more___Oo-pR",btnAdd:"btnAdd___3ROdW",btnCancel:"btnCancel___2N_Gt",cancelC:"cancelC___3SmK1",addC:"addC___3VFkF",actonBtn:"actonBtn___3j8EO",batch:"batch___1YJ8c",btns:"btns___33g-Q",btn:"btn___3yAUt",treeWarp:"treeWarp___27_L-",action:"action___2Ys8R"}},ulZh:function(Pt,Ye,W){typeof window!="undefined"&&function(j,w){Pt.exports=w()}(this,function(){return function(Ee){var j={};function w(N){if(j[N])return j[N].exports;var E=j[N]={i:N,l:!1,exports:{}};return Ee[N].call(E.exports,E,E.exports,w),E.l=!0,E.exports}return w.m=Ee,w.c=j,w.d=function(N,E,R){w.o(N,E)||Object.defineProperty(N,E,{enumerable:!0,get:R})},w.r=function(N){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(N,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(N,"__esModule",{value:!0})},w.t=function(N,E){if(E&1&&(N=w(N)),E&8)return N;if(E&4&&typeof N=="object"&&N&&N.__esModule)return N;var R=Object.create(null);if(w.r(R),Object.defineProperty(R,"default",{enumerable:!0,value:N}),E&2&&typeof N!="string")for(var I in N)w.d(R,I,function(M){return N[M]}.bind(null,I));return R},w.n=function(N){var E=N&&N.__esModule?function(){return N.default}:function(){return N};return w.d(E,"a",E),E},w.o=function(N,E){return Object.prototype.hasOwnProperty.call(N,E)},w.p="/dist/",w(w.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(Ee,j,w){"use strict";var N=Object.prototype.hasOwnProperty,E="~";function R(){}Object.create&&(R.prototype=Object.create(null),new R().__proto__||(E=!1));function I(_,S,O){this.fn=_,this.context=S,this.once=O||!1}function M(_,S,O,C,x){if(typeof O!="function")throw new TypeError("The listener must be a function");var b=new I(O,C||_,x),p=E?E+S:S;return _._events[p]?_._events[p].fn?_._events[p]=[_._events[p],b]:_._events[p].push(b):(_._events[p]=b,_._eventsCount++),_}function T(_,S){--_._eventsCount===0?_._events=new R:delete _._events[S]}function P(){this._events=new R,this._eventsCount=0}P.prototype.eventNames=function(){var S=[],O,C;if(this._eventsCount===0)return S;for(C in O=this._events)N.call(O,C)&&S.push(E?C.slice(1):C);return Object.getOwnPropertySymbols?S.concat(Object.getOwnPropertySymbols(O)):S},P.prototype.listeners=function(S){var O=E?E+S:S,C=this._events[O];if(!C)return[];if(C.fn)return[C.fn];for(var x=0,b=C.length,p=new Array(b);x<b;x++)p[x]=C[x].fn;return p},P.prototype.listenerCount=function(S){var O=E?E+S:S,C=this._events[O];return C?C.fn?1:C.length:0},P.prototype.emit=function(S,O,C,x,b,p){var n=E?E+S:S;if(!this._events[n])return!1;var l=this._events[n],s=arguments.length,g,d;if(l.fn){l.once&&this.removeListener(S,l.fn,void 0,!0);switch(s){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,O),!0;case 3:return l.fn.call(l.context,O,C),!0;case 4:return l.fn.call(l.context,O,C,x),!0;case 5:return l.fn.call(l.context,O,C,x,b),!0;case 6:return l.fn.call(l.context,O,C,x,b,p),!0}for(d=1,g=new Array(s-1);d<s;d++)g[d-1]=arguments[d];l.fn.apply(l.context,g)}else{var u=l.length,m;for(d=0;d<u;d++){l[d].once&&this.removeListener(S,l[d].fn,void 0,!0);switch(s){case 1:l[d].fn.call(l[d].context);break;case 2:l[d].fn.call(l[d].context,O);break;case 3:l[d].fn.call(l[d].context,O,C);break;case 4:l[d].fn.call(l[d].context,O,C,x);break;default:if(!g)for(m=1,g=new Array(s-1);m<s;m++)g[m-1]=arguments[m];l[d].fn.apply(l[d].context,g)}}}return!0},P.prototype.on=function(S,O,C){return M(this,S,O,C,!1)},P.prototype.once=function(S,O,C){return M(this,S,O,C,!0)},P.prototype.removeListener=function(S,O,C,x){var b=E?E+S:S;if(!this._events[b])return this;if(!O)return T(this,b),this;var p=this._events[b];if(p.fn)p.fn===O&&(!x||p.once)&&(!C||p.context===C)&&T(this,b);else{for(var n=0,l=[],s=p.length;n<s;n++)(p[n].fn!==O||x&&!p[n].once||C&&p[n].context!==C)&&l.push(p[n]);l.length?this._events[b]=l.length===1?l[0]:l:T(this,b)}return this},P.prototype.removeAllListeners=function(S){var O;return S?(O=E?E+S:S,this._events[O]&&T(this,O)):(this._events=new R,this._eventsCount=0),this},P.prototype.off=P.prototype.removeListener,P.prototype.addListener=P.prototype.on,P.prefixed=E,P.EventEmitter=P,Ee.exports=P},"./node_modules/url-toolkit/src/url-toolkit.js":function(Ee,j,w){(function(N){var E=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,R=/^([^\/?#]*)([^]*)$/,I=/(?:\/|^)\.(?=\/)/g,M=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,T={buildAbsoluteURL:function(P,_,S){if(S=S||{},P=P.trim(),_=_.trim(),!_){if(!S.alwaysNormalize)return P;var O=T.parseURL(P);if(!O)throw new Error("Error trying to parse base URL.");return O.path=T.normalizePath(O.path),T.buildURLFromParts(O)}var C=T.parseURL(_);if(!C)throw new Error("Error trying to parse relative URL.");if(C.scheme)return S.alwaysNormalize?(C.path=T.normalizePath(C.path),T.buildURLFromParts(C)):_;var x=T.parseURL(P);if(!x)throw new Error("Error trying to parse base URL.");if(!x.netLoc&&x.path&&x.path[0]!=="/"){var b=R.exec(x.path);x.netLoc=b[1],x.path=b[2]}x.netLoc&&!x.path&&(x.path="/");var p={scheme:x.scheme,netLoc:C.netLoc,path:null,params:C.params,query:C.query,fragment:C.fragment};if(!C.netLoc&&(p.netLoc=x.netLoc,C.path[0]!=="/"))if(!C.path)p.path=x.path,C.params||(p.params=x.params,C.query||(p.query=x.query));else{var n=x.path,l=n.substring(0,n.lastIndexOf("/")+1)+C.path;p.path=T.normalizePath(l)}return p.path===null&&(p.path=S.alwaysNormalize?T.normalizePath(C.path):C.path),T.buildURLFromParts(p)},parseURL:function(P){var _=E.exec(P);return _?{scheme:_[1]||"",netLoc:_[2]||"",path:_[3]||"",params:_[4]||"",query:_[5]||"",fragment:_[6]||""}:null},normalizePath:function(P){for(P=P.split("").reverse().join("").replace(I,"");P.length!==(P=P.replace(M,"")).length;);return P.split("").reverse().join("")},buildURLFromParts:function(P){return P.scheme+P.netLoc+P.path+P.params+P.query+P.fragment}};Ee.exports=T})(this)},"./node_modules/webworkify-webpack/index.js":function(Ee,j,w){function N(S){var O={};function C(b){if(O[b])return O[b].exports;var p=O[b]={i:b,l:!1,exports:{}};return S[b].call(p.exports,p,p.exports,C),p.l=!0,p.exports}C.m=S,C.c=O,C.i=function(b){return b},C.d=function(b,p,n){C.o(b,p)||Object.defineProperty(b,p,{configurable:!1,enumerable:!0,get:n})},C.r=function(b){Object.defineProperty(b,"__esModule",{value:!0})},C.n=function(b){var p=b&&b.__esModule?function(){return b.default}:function(){return b};return C.d(p,"a",p),p},C.o=function(b,p){return Object.prototype.hasOwnProperty.call(b,p)},C.p="/",C.oe=function(b){throw console.error(b),b};var x=C(C.s=ENTRY_MODULE);return x.default||x}var E="[\\.|\\-|\\+|\\w|/|@]+",R="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+E+").*?\\)";function I(S){return(S+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function M(S){return!isNaN(1*S)}function T(S,O,C){var x={};x[C]=[];var b=O.toString(),p=b.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!p)return x;for(var n=p[1],l=new RegExp("(\\\\n|\\W)"+I(n)+R,"g"),s;s=l.exec(b);){if(s[3]==="dll-reference")continue;x[C].push(s[3])}for(l=new RegExp("\\("+I(n)+'\\("(dll-reference\\s('+E+'))"\\)\\)'+R,"g");s=l.exec(b);)S[s[2]]||(x[C].push(s[1]),S[s[2]]=w(s[1]).m),x[s[2]]=x[s[2]]||[],x[s[2]].push(s[4]);for(var g=Object.keys(x),d=0;d<g.length;d++)for(var u=0;u<x[g[d]].length;u++)M(x[g[d]][u])&&(x[g[d]][u]=1*x[g[d]][u]);return x}function P(S){var O=Object.keys(S);return O.reduce(function(C,x){return C||S[x].length>0},!1)}function _(S,O){for(var C={main:[O]},x={main:[]},b={main:{}};P(C);)for(var p=Object.keys(C),n=0;n<p.length;n++){var l=p[n],s=C[l],g=s.pop();if(b[l]=b[l]||{},b[l][g]||!S[l][g])continue;b[l][g]=!0,x[l]=x[l]||[],x[l].push(g);for(var d=T(S,S[l][g],l),u=Object.keys(d),m=0;m<u.length;m++)C[u[m]]=C[u[m]]||[],C[u[m]]=C[u[m]].concat(d[u[m]])}return x}Ee.exports=function(S,O){O=O||{};var C={main:w.m},x=O.all?{main:Object.keys(C.main)}:_(C,S),b="";Object.keys(x).filter(function(g){return g!=="main"}).forEach(function(g){for(var d=0;x[g][d];)d++;x[g].push(d),C[g][d]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",b=b+"var "+g+" = ("+N.toString().replace("ENTRY_MODULE",JSON.stringify(d))+")({"+x[g].map(function(u){return""+JSON.stringify(u)+": "+C[g][u].toString()}).join(",")+`});
`}),b=b+"new (("+N.toString().replace("ENTRY_MODULE",JSON.stringify(S))+")({"+x.main.map(function(g){return""+JSON.stringify(g)+": "+C.main[g].toString()}).join(",")+"}))(self);";var p=new window.Blob([b],{type:"text/javascript"});if(O.bare)return p;var n=window.URL||window.webkitURL||window.mozURL||window.msURL,l=n.createObjectURL(p),s=new window.Worker(l);return s.objectURL=l,s}},"./src/config.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"hlsDefaultConfig",function(){return m}),w.d(j,"mergeConfig",function(){return a}),w.d(j,"enableStreamingMode",function(){return r});var N=w("./src/controller/abr-controller.ts"),E=w("./src/controller/audio-stream-controller.ts"),R=w("./src/controller/audio-track-controller.ts"),I=w("./src/controller/subtitle-stream-controller.ts"),M=w("./src/controller/subtitle-track-controller.ts"),T=w("./src/controller/buffer-controller.ts"),P=w("./src/controller/timeline-controller.ts"),_=w("./src/controller/cap-level-controller.ts"),S=w("./src/controller/fps-controller.ts"),O=w("./src/controller/eme-controller.ts"),C=w("./src/controller/cmcd-controller.ts"),x=w("./src/utils/xhr-loader.ts"),b=w("./src/utils/fetch-loader.ts"),p=w("./src/utils/cues.ts"),n=w("./src/utils/mediakeys-helper.ts"),l=w("./src/utils/logger.ts");function s(){return s=Object.assign||function(e){for(var i=1;i<arguments.length;i++){var v=arguments[i];for(var f in v)Object.prototype.hasOwnProperty.call(v,f)&&(e[f]=v[f])}return e},s.apply(this,arguments)}function g(e,i){var v=Object.keys(e);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(e);i&&(f=f.filter(function(y){return Object.getOwnPropertyDescriptor(e,y).enumerable})),v.push.apply(v,f)}return v}function d(e){for(var i=1;i<arguments.length;i++){var v=arguments[i]!=null?arguments[i]:{};i%2?g(Object(v),!0).forEach(function(f){u(e,f,v[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(v)):g(Object(v)).forEach(function(f){Object.defineProperty(e,f,Object.getOwnPropertyDescriptor(v,f))})}return e}function u(e,i,v){return i in e?Object.defineProperty(e,i,{value:v,enumerable:!0,configurable:!0,writable:!0}):e[i]=v,e}var m=d(d({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:x.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:N.default,bufferController:T.default,capLevelController:_.default,fpsController:S.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:n.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},h()),{},{subtitleStreamController:I.SubtitleStreamController,subtitleTrackController:M.default,timelineController:P.TimelineController,audioStreamController:E.default,audioTrackController:R.default,emeController:O.default,cmcdController:C.default});function h(){return{cueHandler:p.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function a(e,i){if((i.liveSyncDurationCount||i.liveMaxLatencyDurationCount)&&(i.liveSyncDuration||i.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(i.liveMaxLatencyDurationCount!==void 0&&(i.liveSyncDurationCount===void 0||i.liveMaxLatencyDurationCount<=i.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(i.liveMaxLatencyDuration!==void 0&&(i.liveSyncDuration===void 0||i.liveMaxLatencyDuration<=i.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return s({},e,i)}function r(e){var i=e.loader;if(i!==b.default&&i!==x.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1;else{var v=Object(b.fetchSupported)();v&&(e.loader=b.default,e.progressive=!0,e.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(Ee,j,w){"use strict";w.r(j);var N=w("./src/polyfills/number.ts"),E=w("./src/utils/ewma-bandwidth-estimator.ts"),R=w("./src/events.ts"),I=w("./src/utils/buffer-helper.ts"),M=w("./src/errors.ts"),T=w("./src/types/loader.ts"),P=w("./src/utils/logger.ts");function _(C,x){for(var b=0;b<x.length;b++){var p=x[b];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(C,p.key,p)}}function S(C,x,b){return x&&_(C.prototype,x),b&&_(C,b),C}var O=function(){function C(b){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=b;var p=b.config;this.bwEstimator=new E.default(p.abrEwmaSlowVoD,p.abrEwmaFastVoD,p.abrEwmaDefaultEstimate),this.registerListeners()}var x=C.prototype;return x.registerListeners=function(){var p=this.hls;p.on(R.Events.FRAG_LOADING,this.onFragLoading,this),p.on(R.Events.FRAG_LOADED,this.onFragLoaded,this),p.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),p.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(R.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var p=this.hls;p.off(R.Events.FRAG_LOADING,this.onFragLoading,this),p.off(R.Events.FRAG_LOADED,this.onFragLoaded,this),p.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),p.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(R.Events.ERROR,this.onError,this)},x.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},x.onFragLoading=function(p,n){var l=n.frag;if(l.type===T.PlaylistLevelType.MAIN&&!this.timer){var s;this.fragCurrent=l,this.partCurrent=(s=n.part)!=null?s:null,this.timer=self.setInterval(this.onCheck,100)}},x.onLevelLoaded=function(p,n){var l=this.hls.config;n.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},x._abandonRulesCheck=function(){var p=this.fragCurrent,n=this.partCurrent,l=this.hls,s=l.autoLevelEnabled,g=l.config,d=l.media;if(!p||!d)return;var u=n?n.stats:p.stats,m=n?n.duration:p.duration;if(u.aborted){P.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!s||d.paused||!d.playbackRate||!d.readyState)return;var h=performance.now()-u.loading.start,a=Math.abs(d.playbackRate);if(h<=500*m/a)return;var r=l.levels,e=l.minAutoLevel,i=r[p.level],v=u.total||Math.max(u.loaded,Math.round(m*i.maxBitrate/8)),f=Math.max(1,u.bwEstimate?u.bwEstimate/8:u.loaded*1e3/h),y=(v-u.loaded)/f,t=d.currentTime,A=(I.BufferHelper.bufferInfo(d,t,g.maxBufferHole).end-t)/a;if(A>=2*m/a||y<=A)return;var U=Number.POSITIVE_INFINITY,F;for(F=p.level-1;F>e;F--){var H=r[F].maxBitrate;if(U=m*H/(8*.8*f),U<A)break}if(U>=y)return;var J=this.bwEstimator.getEstimate();P.logger.warn("Fragment "+p.sn+(n?" part "+n.index:"")+" of level "+p.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+F+`
Current BW estimate: `+(Object(N.isFiniteNumber)(J)?(J/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+y.toFixed(3)+` s
Estimated load time for the next fragment: `+U.toFixed(3)+` s
Time to underbuffer: `+A.toFixed(3)+" s"),l.nextLoadLevel=F,this.bwEstimator.sample(h,u.loaded),this.clearTimer(),p.loader&&(this.fragCurrent=this.partCurrent=null,p.loader.abort()),l.trigger(R.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:p,part:n,stats:u})},x.onFragLoaded=function(p,n){var l=n.frag,s=n.part;if(l.type===T.PlaylistLevelType.MAIN&&Object(N.isFiniteNumber)(l.sn)){var g=s?s.stats:l.stats,d=s?s.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var u=this.hls.levels[l.level],m=(u.loaded?u.loaded.bytes:0)+g.loaded,h=(u.loaded?u.loaded.duration:0)+d;u.loaded={bytes:m,duration:h},u.realBitrate=Math.round(8*m/h)}if(l.bitrateTest){var a={stats:g,frag:l,part:s,id:l.type};this.onFragBuffered(R.Events.FRAG_BUFFERED,a),l.bitrateTest=!1}}},x.onFragBuffered=function(p,n){var l=n.frag,s=n.part,g=s?s.stats:l.stats;if(g.aborted)return;if(l.type!==T.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var d=g.parsing.end-g.loading.start;this.bwEstimator.sample(d,g.loaded),g.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=d/1e3:this.bitrateTestDelay=0},x.onError=function(p,n){switch(n.details){case M.ErrorDetails.FRAG_LOAD_ERROR:case M.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},x.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},x.getNextABRAutoLevel=function(){var p=this.fragCurrent,n=this.partCurrent,l=this.hls,s=l.maxAutoLevel,g=l.config,d=l.minAutoLevel,u=l.media,m=n?n.duration:p?p.duration:0,h=u?u.currentTime:0,a=u&&u.playbackRate!==0?Math.abs(u.playbackRate):1,r=this.bwEstimator?this.bwEstimator.getEstimate():g.abrEwmaDefaultEstimate,e=(I.BufferHelper.bufferInfo(u,h,g.maxBufferHole).end-h)/a,i=this.findBestLevel(r,d,s,e,g.abrBandWidthFactor,g.abrBandWidthUpFactor);if(i>=0)return i;P.logger.trace((e?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var v=m?Math.min(m,g.maxStarvationDelay):g.maxStarvationDelay,f=g.abrBandWidthFactor,y=g.abrBandWidthUpFactor;if(!e){var t=this.bitrateTestDelay;if(t){var A=m?Math.min(m,g.maxLoadingDelay):g.maxLoadingDelay;v=A-t,P.logger.trace("bitrate test took "+Math.round(1e3*t)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*v)+" ms"),f=y=1}}return i=this.findBestLevel(r,d,s,e+v,f,y),Math.max(i,0)},x.findBestLevel=function(p,n,l,s,g,d){for(var u,m=this.fragCurrent,h=this.partCurrent,a=this.lastLoadedFragLevel,r=this.hls.levels,e=r[a],i=!!(e!=null&&(u=e.details)!==null&&u!==void 0&&u.live),v=e==null?void 0:e.codecSet,f=h?h.duration:m?m.duration:0,y=l;y>=n;y--){var t=r[y];if(!t||v&&t.codecSet!==v)continue;var A=t.details,U=(h?A==null?void 0:A.partTarget:A==null?void 0:A.averagetargetduration)||f,F=void 0;y<=a?F=g*p:F=d*p;var H=r[y].maxBitrate,J=H*U/F;if(P.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+y+"/"+Math.round(F)+"/"+H+"/"+U+"/"+s+"/"+J),F>H&&(!J||i&&!this.bitrateTestDelay||J<s))return y}return-1},S(C,[{key:"nextAutoLevel",get:function(){var p=this._nextAutoLevel,n=this.bwEstimator;if(p!==-1&&(!n||!n.canEstimate()))return p;var l=this.getNextABRAutoLevel();return p!==-1&&(l=Math.min(p,l)),l},set:function(p){this._nextAutoLevel=p}}]),C}();j.default=O},"./src/controller/audio-stream-controller.ts":function(Ee,j,w){"use strict";w.r(j);var N=w("./src/polyfills/number.ts"),E=w("./src/controller/base-stream-controller.ts"),R=w("./src/events.ts"),I=w("./src/utils/buffer-helper.ts"),M=w("./src/controller/fragment-tracker.ts"),T=w("./src/types/level.ts"),P=w("./src/types/loader.ts"),_=w("./src/loader/fragment.ts"),S=w("./src/demux/chunk-cache.ts"),O=w("./src/demux/transmuxer-interface.ts"),C=w("./src/types/transmuxer.ts"),x=w("./src/controller/fragment-finders.ts"),b=w("./src/utils/discontinuities.ts"),p=w("./src/errors.ts"),n=w("./src/utils/logger.ts");function l(){return l=Object.assign||function(m){for(var h=1;h<arguments.length;h++){var a=arguments[h];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(m[r]=a[r])}return m},l.apply(this,arguments)}function s(m,h){m.prototype=Object.create(h.prototype),m.prototype.constructor=m,g(m,h)}function g(m,h){return g=Object.setPrototypeOf||function(r,e){return r.__proto__=e,r},g(m,h)}var d=100,u=function(m){s(h,m);function h(r,e){var i;return i=m.call(this,r,e,"[audio-stream-controller]")||this,i.videoBuffer=null,i.videoTrackCC=-1,i.waitingVideoCC=-1,i.audioSwitch=!1,i.trackId=-1,i.waitingData=null,i.mainDetails=null,i.bufferFlushed=!1,i._registerListeners(),i}var a=h.prototype;return a.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},a._registerListeners=function(){var e=this.hls;e.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(R.Events.ERROR,this.onError,this),e.on(R.Events.BUFFER_RESET,this.onBufferReset,this),e.on(R.Events.BUFFER_CREATED,this.onBufferCreated,this),e.on(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},a._unregisterListeners=function(){var e=this.hls;e.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(R.Events.ERROR,this.onError,this),e.off(R.Events.BUFFER_RESET,this.onBufferReset,this),e.off(R.Events.BUFFER_CREATED,this.onBufferCreated,this),e.off(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},a.onInitPtsFound=function(e,i){var v=i.frag,f=i.id,y=i.initPTS;if(f==="main"){var t=v.cc;this.initPTS[v.cc]=y,this.log("InitPTS for cc: "+t+" found from main: "+y),this.videoTrackCC=t,this.state===E.State.WAITING_INIT_PTS&&this.tick()}},a.startLoad=function(e){if(!this.levels){this.startPosition=e,this.state=E.State.STOPPED;return}var i=this.lastCurrentTime;this.stopLoad(),this.setInterval(d),this.fragLoadError=0,i>0&&e===-1?(this.log("Override startPosition with lastCurrentTime @"+i.toFixed(3)),this.state=E.State.IDLE):(this.loadedmetadata=!1,this.state=E.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()},a.doTick=function(){switch(this.state){case E.State.IDLE:this.doTickIdle();break;case E.State.WAITING_TRACK:{var e,i=this.levels,v=this.trackId,f=i==null||((e=i[v])===null||e===void 0)?void 0:e.details;if(f){if(this.waitForCdnTuneIn(f))break;this.state=E.State.WAITING_INIT_PTS}break}case E.State.FRAG_LOADING_WAITING_RETRY:{var y,t=performance.now(),A=this.retryDate;(!A||t>=A||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=E.State.IDLE);break}case E.State.WAITING_INIT_PTS:{var U=this.waitingData;if(U){var F=U.frag,H=U.part,J=U.cache,B=U.complete;if(this.initPTS[F.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=E.State.FRAG_LOADING;var Z=J.flush(),re={frag:F,part:H,payload:Z,networkDetails:null};this._handleFragmentLoadProgress(re),B&&m.prototype._handleFragmentLoadComplete.call(this,re)}else if(this.videoTrackCC!==this.waitingVideoCC)n.logger.log("Waiting fragment cc ("+F.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ie=this.getLoadPosition(),ve=I.BufferHelper.bufferInfo(this.mediaBuffer,ie,this.config.maxBufferHole),de=Object(x.fragmentWithinToleranceTest)(ve.end,this.config.maxFragLookUpTolerance,F);de<0&&(n.logger.log("Waiting fragment cc ("+F.cc+") @ "+F.start+" cancelled because another fragment at "+ve.end+" is needed"),this.clearWaitingFragment())}}else this.state=E.State.IDLE}}this.onTickEnd()},a.clearWaitingFragment=function(){var e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=E.State.IDLE)},a.onTickEnd=function(){var e=this.media;if(!e||!e.readyState)return;var i=this.mediaBuffer?this.mediaBuffer:e,v=i.buffered;!this.loadedmetadata&&v.length&&(this.loadedmetadata=!0),this.lastCurrentTime=e.currentTime},a.doTickIdle=function(){var e,i,v=this.hls,f=this.levels,y=this.media,t=this.trackId,A=v.config;if(!f||!f[t])return;if(!y&&(this.startFragRequested||!A.startFragPrefetch))return;var U=f[t],F=U.details;if(!F||F.live&&this.levelLastLoaded!==t||this.waitForCdnTuneIn(F)){this.state=E.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,_.ElementaryStreamTypes.AUDIO,P.PlaylistLevelType.AUDIO));var H=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,P.PlaylistLevelType.AUDIO);if(H===null)return;var J=H.len,B=this.getMaxBufferLength(),Z=this.audioSwitch;if(J>=B&&!Z)return;if(!Z&&this._streamEnded(H,F)){v.trigger(R.Events.BUFFER_EOS,{type:"audio"}),this.state=E.State.ENDED;return}var re=F.fragments,ie=re[0].start,ve=H.end;if(Z){var de=this.getLoadPosition();ve=de,F.PTSKnown&&de<ie&&((H.end>ie||H.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),y.currentTime=ie+.05))}var q=this.getNextFragment(ve,F);if(!q){this.bufferFlushed=!0;return}((e=q.decryptdata)===null||e===void 0?void 0:e.keyFormat)==="identity"&&!((i=q.decryptdata)!==null&&i!==void 0&&i.key)?this.loadKey(q,F):this.loadFragment(q,F,ve)},a.getMaxBufferLength=function(){var e=m.prototype.getMaxBufferLength.call(this),i=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,P.PlaylistLevelType.MAIN);return i===null?e:Math.max(e,i.len)},a.onMediaDetaching=function(){this.videoBuffer=null,m.prototype.onMediaDetaching.call(this)},a.onAudioTracksUpdated=function(e,i){var v=i.audioTracks;this.resetTransmuxer(),this.levels=v.map(function(f){return new T.Level(f)})},a.onAudioTrackSwitching=function(e,i){var v=!!i.url;this.trackId=i.id;var f=this.fragCurrent;f!=null&&f.loader&&f.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),v?this.setInterval(d):this.resetTransmuxer(),v?(this.audioSwitch=!0,this.state=E.State.IDLE):this.state=E.State.STOPPED,this.tick()},a.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},a.onLevelLoaded=function(e,i){this.mainDetails=i.details},a.onAudioTrackLoaded=function(e,i){var v,f=this.levels,y=i.details,t=i.id;if(!f){this.warn("Audio tracks were reset while loading level "+t);return}this.log("Track "+t+" loaded ["+y.startSN+","+y.endSN+"],duration:"+y.totalduration);var A=f[t],U=0;if(y.live||(v=A.details)!==null&&v!==void 0&&v.live){var F=this.mainDetails;if(y.fragments[0]||(y.deltaUpdateFailed=!0),y.deltaUpdateFailed||!F)return;!A.details&&y.hasProgramDateTime&&F.hasProgramDateTime?(Object(b.alignMediaPlaylistByPDT)(y,F),U=y.fragments[0].start):U=this.alignPlaylists(y,A.details)}A.details=y,this.levelLastLoaded=t,!this.startFragRequested&&(this.mainDetails||!y.live)&&this.setStartPosition(A.details,U),this.state===E.State.WAITING_TRACK&&!this.waitForCdnTuneIn(y)&&(this.state=E.State.IDLE),this.tick()},a._handleFragmentLoadProgress=function(e){var i,v=e.frag,f=e.part,y=e.payload,t=this.config,A=this.trackId,U=this.levels;if(!U){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+v.sn+" of level "+v.level+" will not be buffered");return}var F=U[A];console.assert(F,"Audio track is defined on fragment load progress");var H=F.details;console.assert(H,"Audio track details are defined on fragment load progress");var J=t.defaultAudioCodec||F.audioCodec||"mp4a.40.2",B=this.transmuxer;B||(B=this.transmuxer=new O.default(this.hls,P.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Z=this.initPTS[v.cc],re=(i=v.initSegment)===null||i===void 0?void 0:i.data;if(Z!==void 0){var ie=!1,ve=f?f.index:-1,de=ve!==-1,q=new C.ChunkMetadata(v.level,v.sn,v.stats.chunkCount,y.byteLength,ve,de);B.push(y,re,J,"",v,f,H.totalduration,ie,q,Z)}else{n.logger.log("Unknown video PTS for cc "+v.cc+", waiting for video PTS before demuxing audio frag "+v.sn+" of ["+H.startSN+" ,"+H.endSN+"],track "+A);var ee=this.waitingData=this.waitingData||{frag:v,part:f,cache:new S.default,complete:!1},pe=ee.cache;pe.push(new Uint8Array(y)),this.waitingVideoCC=this.videoTrackCC,this.state=E.State.WAITING_INIT_PTS}},a._handleFragmentLoadComplete=function(e){if(this.waitingData){this.waitingData.complete=!0;return}m.prototype._handleFragmentLoadComplete.call(this,e)},a.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},a.onBufferCreated=function(e,i){var v=i.tracks.audio;v&&(this.mediaBuffer=v.buffer),i.tracks.video&&(this.videoBuffer=i.tracks.video.buffer)},a.onFragBuffered=function(e,i){var v=i.frag,f=i.part;if(v.type!==P.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(v)){this.warn("Fragment "+v.sn+(f?" p: "+f.index:"")+" of level "+v.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}v.sn!=="initSegment"&&(this.fragPrevious=v,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(v,f)},a.onError=function(e,i){switch(i.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(P.PlaylistLevelType.AUDIO,i);break;case p.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case p.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==E.State.ERROR&&this.state!==E.State.STOPPED&&(this.state=i.fatal?E.State.ERROR:E.State.IDLE,this.warn(i.details+" while loading frag, switching to "+this.state+" state"));break;case p.ErrorDetails.BUFFER_FULL_ERROR:if(i.parent==="audio"&&(this.state===E.State.PARSING||this.state===E.State.PARSED)){var v=!0,f=this.getFwdBufferInfo(this.mediaBuffer,P.PlaylistLevelType.AUDIO);f&&f.len>.5&&(v=!this.reduceMaxBufferLength(f.len)),v&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,m.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},a.onBufferFlushed=function(e,i){var v=i.type;v===_.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},a._handleTransmuxComplete=function(e){var i,v="audio",f=this.hls,y=e.remuxResult,t=e.chunkMeta,A=this.getCurrentContext(t);if(!A){this.warn("The loading context changed while buffering fragment "+t.sn+" of level "+t.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(t.level);return}var U=A.frag,F=A.part,H=y.audio,J=y.text,B=y.id3,Z=y.initSegment;if(this.fragContextChanged(U))return;if(this.state=E.State.PARSING,this.audioSwitch&&H&&this.completeAudioSwitch(),Z!=null&&Z.tracks&&(this._bufferInitSegment(Z.tracks,U,t),f.trigger(R.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:v,tracks:Z.tracks})),H){var re=H.startPTS,ie=H.endPTS,ve=H.startDTS,de=H.endDTS;F&&(F.elementaryStreams[_.ElementaryStreamTypes.AUDIO]={startPTS:re,endPTS:ie,startDTS:ve,endDTS:de}),U.setElementaryStreamInfo(_.ElementaryStreamTypes.AUDIO,re,ie,ve,de),this.bufferFragmentData(H,U,F,t)}if(B!=null&&(i=B.samples)!==null&&i!==void 0&&i.length){var q=l({frag:U,id:v},B);f.trigger(R.Events.FRAG_PARSING_METADATA,q)}if(J){var ee=l({frag:U,id:v},J);f.trigger(R.Events.FRAG_PARSING_USERDATA,ee)}},a._bufferInitSegment=function(e,i,v){if(this.state!==E.State.PARSING)return;e.video&&delete e.video;var f=e.audio;if(!f)return;f.levelCodec=f.codec,f.id="audio",this.log("Init audio buffer, container:"+f.container+", codecs[parsed]=["+f.codec+"]"),this.hls.trigger(R.Events.BUFFER_CODECS,e);var y=f.initSegment;if(y!=null&&y.byteLength){var t={type:"audio",frag:i,part:null,chunkMeta:v,parent:i.type,data:y};this.hls.trigger(R.Events.BUFFER_APPENDING,t)}this.tick()},a.loadFragment=function(e,i,v){var f=this.fragmentTracker.getState(e);this.fragCurrent=e,(this.audioSwitch||f===M.FragmentState.NOT_LOADED||f===M.FragmentState.PARTIAL)&&(e.sn==="initSegment"?this._loadInitSegment(e):i.live&&!Object(N.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=E.State.WAITING_INIT_PTS):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,e,i,v)))},a.completeAudioSwitch=function(){var e=this.hls,i=this.media,v=this.trackId;i&&(this.log("Switching audio track : flushing all audio"),m.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,e.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:v})},h}(E.default);j.default=u},"./src/controller/audio-track-controller.ts":function(Ee,j,w){"use strict";w.r(j);var N=w("./src/events.ts"),E=w("./src/errors.ts"),R=w("./src/controller/base-playlist-controller.ts"),I=w("./src/types/loader.ts");function M(O,C){for(var x=0;x<C.length;x++){var b=C[x];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(O,b.key,b)}}function T(O,C,x){return C&&M(O.prototype,C),x&&M(O,x),O}function P(O,C){O.prototype=Object.create(C.prototype),O.prototype.constructor=O,_(O,C)}function _(O,C){return _=Object.setPrototypeOf||function(b,p){return b.__proto__=p,b},_(O,C)}var S=function(O){P(C,O);function C(b){var p;return p=O.call(this,b,"[audio-track-controller]")||this,p.tracks=[],p.groupId=null,p.tracksInGroup=[],p.trackId=-1,p.trackName="",p.selectDefaultTrack=!0,p.registerListeners(),p}var x=C.prototype;return x.registerListeners=function(){var p=this.hls;p.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.on(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.on(N.Events.LEVEL_LOADING,this.onLevelLoading,this),p.on(N.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),p.on(N.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),p.on(N.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var p=this.hls;p.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.off(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.off(N.Events.LEVEL_LOADING,this.onLevelLoading,this),p.off(N.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),p.off(N.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),p.off(N.Events.ERROR,this.onError,this)},x.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,O.prototype.destroy.call(this)},x.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},x.onManifestParsed=function(p,n){this.tracks=n.audioTracks||[]},x.onAudioTrackLoaded=function(p,n){var l=n.id,s=n.details,g=this.tracksInGroup[l];if(!g){this.warn("Invalid audio track id "+l);return}var d=g.details;g.details=n.details,this.log("audioTrack "+l+" loaded ["+s.startSN+"-"+s.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,n,d))},x.onLevelLoading=function(p,n){this.switchLevel(n.level)},x.onLevelSwitching=function(p,n){this.switchLevel(n.level)},x.switchLevel=function(p){var n=this.hls.levels[p];if(!(n!=null&&n.audioGroupIds))return;var l=n.audioGroupIds[n.urlId];if(this.groupId!==l){this.groupId=l;var s=this.tracks.filter(function(d){return!l||d.groupId===l});this.selectDefaultTrack&&!s.some(function(d){return d.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=s;var g={audioTracks:s};this.log("Updating audio tracks, "+s.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(N.Events.AUDIO_TRACKS_UPDATED,g),this.selectInitialTrack()}},x.onError=function(p,n){if(O.prototype.onError.call(this,p,n),n.fatal||!n.context)return;n.context.type===I.PlaylistContextType.AUDIO_TRACK&&n.context.id===this.trackId&&n.context.groupId===this.groupId&&this.retryLoadingOrFail(n)},x.setAudioTrack=function(p){var n=this.tracksInGroup;if(p<0||p>=n.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=n[this.trackId];this.log("Now switching to audio-track index "+p);var s=n[p],g=s.id,d=s.groupId,u=d===void 0?"":d,m=s.name,h=s.type,a=s.url;if(this.trackId=p,this.trackName=m,this.selectDefaultTrack=!1,this.hls.trigger(N.Events.AUDIO_TRACK_SWITCHING,{id:g,groupId:u,name:m,type:h,url:a}),s.details&&!s.details.live)return;var r=this.switchParams(s.url,l==null?void 0:l.details);this.loadPlaylist(r)},x.selectInitialTrack=function(){var p=this.tracksInGroup;console.assert(p.length,"Initial audio track should be selected when tracks are known");var n=this.trackName,l=this.findTrackId(n)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.MEDIA_ERROR,details:E.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},x.findTrackId=function(p){for(var n=this.tracksInGroup,l=0;l<n.length;l++){var s=n[l];if((!this.selectDefaultTrack||s.default)&&(!p||p===s.name))return s.id}return-1},x.loadPlaylist=function(p){var n=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(n)){var l=n.id,s=n.groupId,g=n.url;if(p)try{g=p.addDirectives(g)}catch(d){this.warn("Could not construct new URL with HLS Delivery Directives: "+d)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(N.Events.AUDIO_TRACK_LOADING,{url:g,id:l,groupId:s,deliveryDirectives:p||null})}},T(C,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(p){this.selectDefaultTrack=!1,this.setAudioTrack(p)}}]),C}(R.default);j.default=S},"./src/controller/base-playlist-controller.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"default",function(){return T});var N=w("./src/polyfills/number.ts"),E=w("./src/types/level.ts"),R=w("./src/controller/level-helper.ts"),I=w("./src/utils/logger.ts"),M=w("./src/errors.ts"),T=function(){function P(S,O){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=I.logger.log.bind(I.logger,O+":"),this.warn=I.logger.warn.bind(I.logger,O+":"),this.hls=S}var _=P.prototype;return _.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},_.onError=function(O,C){C.fatal&&C.type===M.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},_.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},_.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},_.stopLoad=function(){this.canLoad=!1,this.clearTimer()},_.switchParams=function(O,C){var x=C==null?void 0:C.renditionReports;if(x)for(var b=0;b<x.length;b++){var p=x[b],n=""+p.URI;if(n===O.substr(-n.length)){var l=parseInt(p["LAST-MSN"]),s=parseInt(p["LAST-PART"]);if(C&&this.hls.config.lowLatencyMode){var g=Math.min(C.age-C.partTarget,C.targetduration);s!==void 0&&g>C.partTarget&&(s+=1)}if(Object(N.isFiniteNumber)(l))return new E.HlsUrlParameters(l,Object(N.isFiniteNumber)(s)?s:void 0,E.HlsSkip.No)}}},_.loadPlaylist=function(O){},_.shouldLoadTrack=function(O){return this.canLoad&&O&&!!O.url&&(!O.details||O.details.live)},_.playlistLoaded=function(O,C,x){var b=this,p=C.details,n=C.stats,l=n.loading.end?Math.max(0,self.performance.now()-n.loading.end):0;if(p.advancedDateTime=Date.now()-l,p.live||x!=null&&x.live){if(p.reloaded(x),x&&this.log("live playlist "+O+" "+(p.advanced?"REFRESHED "+p.lastPartSn+"-"+p.lastPartIndex:"MISSED")),x&&p.fragments.length>0&&Object(R.mergeDetails)(x,p),!this.canLoad||!p.live)return;var s,g=void 0,d=void 0;if(p.canBlockReload&&p.endSN&&p.advanced){var u=this.hls.config.lowLatencyMode,m=p.lastPartSn,h=p.endSN,a=p.lastPartIndex,r=a!==-1,e=m===h,i=u?0:a;r?(g=e?h+1:m,d=e?i:a+1):g=h+1;var v=p.age,f=v+p.ageHeader,y=Math.min(f-p.partTarget,p.targetduration*1.5);if(y>0){if(x&&y>x.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+x.tuneInGoal+" to: "+y+" with playlist age: "+p.age),y=0;else{var t=Math.floor(y/p.targetduration);if(g+=t,d!==void 0){var A=Math.round(y%p.targetduration/p.partTarget);d+=A}this.log("CDN Tune-in age: "+p.ageHeader+"s last advanced "+v.toFixed(2)+"s goal: "+y+" skip sn "+t+" to part "+d)}p.tuneInGoal=y}if(s=this.getDeliveryDirectives(p,C.deliveryDirectives,g,d),u||!e){this.loadPlaylist(s);return}}else s=this.getDeliveryDirectives(p,C.deliveryDirectives,g,d);var U=Object(R.computeReloadInterval)(p,n);g!==void 0&&p.canBlockReload&&(U-=p.partTarget||1),this.log("reload live playlist "+O+" in "+Math.round(U)+" ms"),this.timer=self.setTimeout(function(){return b.loadPlaylist(s)},U)}else this.clearTimer()},_.getDeliveryDirectives=function(O,C,x,b){var p=Object(E.getSkipValue)(O,x);return C!=null&&C.skip&&O.deltaUpdateFailed&&(x=C.msn,b=C.part,p=E.HlsSkip.No),new E.HlsUrlParameters(x,b,p)},_.retryLoadingOrFail=function(O){var C=this,x=this.hls.config,b=this.retryCount<x.levelLoadingMaxRetry;if(b){var p;if(this.retryCount++,O.details.indexOf("LoadTimeOut")>-1&&(p=O.context)!==null&&p!==void 0&&p.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+O.details+'"'),this.loadPlaylist();else{var n=Math.min(Math.pow(2,this.retryCount)*x.levelLoadingRetryDelay,x.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return C.loadPlaylist()},n),this.warn("retry playlist loading #"+this.retryCount+" in "+n+' ms after "'+O.details+'"')}}else this.warn('cannot recover from error "'+O.details+'"'),this.clearTimer(),O.fatal=!0;return b},P}()},"./src/controller/base-stream-controller.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"State",function(){return h}),w.d(j,"default",function(){return a});var N=w("./src/polyfills/number.ts"),E=w("./src/task-loop.ts"),R=w("./src/controller/fragment-tracker.ts"),I=w("./src/utils/buffer-helper.ts"),M=w("./src/utils/logger.ts"),T=w("./src/events.ts"),P=w("./src/errors.ts"),_=w("./src/types/transmuxer.ts"),S=w("./src/utils/mp4-tools.ts"),O=w("./src/utils/discontinuities.ts"),C=w("./src/controller/fragment-finders.ts"),x=w("./src/controller/level-helper.ts"),b=w("./src/loader/fragment-loader.ts"),p=w("./src/crypt/decrypter.ts"),n=w("./src/utils/time-ranges.ts"),l=w("./src/types/loader.ts");function s(r,e){for(var i=0;i<e.length;i++){var v=e[i];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(r,v.key,v)}}function g(r,e,i){return e&&s(r.prototype,e),i&&s(r,i),r}function d(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function u(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,m(r,e)}function m(r,e){return m=Object.setPrototypeOf||function(v,f){return v.__proto__=f,v},m(r,e)}var h={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},a=function(r){u(e,r);function e(v,f,y){var t;return t=r.call(this)||this,t.hls=void 0,t.fragPrevious=null,t.fragCurrent=null,t.fragmentTracker=void 0,t.transmuxer=null,t._state=h.STOPPED,t.media=void 0,t.mediaBuffer=void 0,t.config=void 0,t.bitrateTest=!1,t.lastCurrentTime=0,t.nextLoadPosition=0,t.startPosition=0,t.loadedmetadata=!1,t.fragLoadError=0,t.retryDate=0,t.levels=null,t.fragmentLoader=void 0,t.levelLastLoaded=null,t.startFragRequested=!1,t.decrypter=void 0,t.initPTS=[],t.onvseeking=null,t.onvended=null,t.logPrefix="",t.log=void 0,t.warn=void 0,t.logPrefix=y,t.log=M.logger.log.bind(M.logger,y+":"),t.warn=M.logger.warn.bind(M.logger,y+":"),t.hls=v,t.fragmentLoader=new b.default(v.config),t.fragmentTracker=f,t.config=v.config,t.decrypter=new p.default(v,v.config),v.on(T.Events.KEY_LOADED,t.onKeyLoaded,d(t)),t}var i=e.prototype;return i.doTick=function(){this.onTickEnd()},i.onTickEnd=function(){},i.startLoad=function(f){},i.stopLoad=function(){this.fragmentLoader.abort();var f=this.fragCurrent;f&&this.fragmentTracker.removeFragment(f),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=h.STOPPED},i._streamEnded=function(f,y){var t=this.fragCurrent,A=this.fragmentTracker;if(!y.live&&t&&t.sn===y.endSN&&!f.nextStart){var U=A.getState(t);return U===R.FragmentState.PARTIAL||U===R.FragmentState.OK}return!1},i.onMediaAttached=function(f,y){var t=this.media=this.mediaBuffer=y.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("ended",this.onvended);var A=this.config;this.levels&&A.autoStartLoad&&this.state===h.STOPPED&&this.startLoad(A.startPosition)},i.onMediaDetaching=function(){var f=this.media;f!=null&&f.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),f&&(f.removeEventListener("seeking",this.onvseeking),f.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},i.onMediaSeeking=function(){var f=this.config,y=this.fragCurrent,t=this.media,A=this.mediaBuffer,U=this.state,F=t?t.currentTime:0,H=I.BufferHelper.bufferInfo(A||t,F,f.maxBufferHole);if(this.log("media seeking to "+(Object(N.isFiniteNumber)(F)?F.toFixed(3):F)+", state: "+U),U===h.ENDED)this.resetLoadingState();else if(y&&!H.len){var J=f.maxFragLookUpTolerance,B=y.start-J,Z=y.start+y.duration+J,re=F>Z;(F<B||re)&&(re&&y.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),y.loader.abort()),this.resetLoadingState())}t&&(this.lastCurrentTime=F),!this.loadedmetadata&&!H.len&&(this.nextLoadPosition=this.startPosition=F),this.tickImmediate()},i.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},i.onKeyLoaded=function(f,y){if(this.state!==h.KEY_LOADING||y.frag!==this.fragCurrent||!this.levels)return;this.state=h.IDLE;var t=this.levels[y.frag.level].details;t&&this.loadFragment(y.frag,t,y.frag.start)},i.onHandlerDestroying=function(){this.stopLoad(),r.prototype.onHandlerDestroying.call(this)},i.onHandlerDestroyed=function(){this.state=h.STOPPED,this.hls.off(T.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,r.prototype.onHandlerDestroyed.call(this)},i.loadKey=function(f,y){this.log("Loading key for "+f.sn+" of ["+y.startSN+"-"+y.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+f.level),this.state=h.KEY_LOADING,this.fragCurrent=f,this.hls.trigger(T.Events.KEY_LOADING,{frag:f})},i.loadFragment=function(f,y,t){this._loadFragForPlayback(f,y,t)},i._loadFragForPlayback=function(f,y,t){var A=this,U=function(H){if(A.fragContextChanged(f)){A.warn("Fragment "+f.sn+(H.part?" p: "+H.part.index:"")+" of level "+f.level+" was dropped during download."),A.fragmentTracker.removeFragment(f);return}f.stats.chunkCount++,A._handleFragmentLoadProgress(H)};this._doFragLoad(f,y,t,U).then(function(F){if(!F)return;A.fragLoadError=0;var H=A.state;if(A.fragContextChanged(f)){(H===h.FRAG_LOADING||H===h.BACKTRACKING||!A.fragCurrent&&H===h.PARSING)&&(A.fragmentTracker.removeFragment(f),A.state=h.IDLE);return}if("payload"in F&&(A.log("Loaded fragment "+f.sn+" of level "+f.level),A.hls.trigger(T.Events.FRAG_LOADED,F),A.state===h.BACKTRACKING)){A.fragmentTracker.backtrack(f,F),A.resetFragmentLoading(f);return}A._handleFragmentLoadComplete(F)}).catch(function(F){A.warn(F),A.resetFragmentLoading(f)})},i.flushMainBuffer=function(f,y,t){if(t===void 0&&(t=null),!(f-y))return;var A={startOffset:f,endOffset:y,type:t};this.fragLoadError=0,this.hls.trigger(T.Events.BUFFER_FLUSHING,A)},i._loadInitSegment=function(f){var y=this;this._doFragLoad(f).then(function(t){if(!t||y.fragContextChanged(f)||!y.levels)throw new Error("init load aborted");return t}).then(function(t){var A=y.hls,U=t.payload,F=f.decryptdata;if(U&&U.byteLength>0&&F&&F.key&&F.iv&&F.method==="AES-128"){var H=self.performance.now();return y.decrypter.webCryptoDecrypt(new Uint8Array(U),F.key.buffer,F.iv.buffer).then(function(J){var B=self.performance.now();return A.trigger(T.Events.FRAG_DECRYPTED,{frag:f,payload:J,stats:{tstart:H,tdecrypt:B}}),t.payload=J,t})}return t}).then(function(t){var A=y.fragCurrent,U=y.hls,F=y.levels;if(!F)throw new Error("init load aborted, missing levels");var H=F[f.level].details;console.assert(H,"Level details are defined when init segment is loaded");var J=f.stats;y.state=h.IDLE,y.fragLoadError=0,f.data=new Uint8Array(t.payload),J.parsing.start=J.buffering.start=self.performance.now(),J.parsing.end=J.buffering.end=self.performance.now(),t.frag===A&&U.trigger(T.Events.FRAG_BUFFERED,{stats:J,frag:A,part:null,id:f.type}),y.tick()}).catch(function(t){y.warn(t),y.resetFragmentLoading(f)})},i.fragContextChanged=function(f){var y=this.fragCurrent;return!f||!y||f.level!==y.level||f.sn!==y.sn||f.urlId!==y.urlId},i.fragBufferedComplete=function(f,y){var t=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+f.type+" sn: "+f.sn+(y?" part: "+y.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+f.level+" "+n.default.toString(I.BufferHelper.getBuffered(t))),this.state=h.IDLE,this.tick()},i._handleFragmentLoadComplete=function(f){var y=this.transmuxer;if(!y)return;var t=f.frag,A=f.part,U=f.partsLoaded,F=!U||U.length===0||U.some(function(J){return!J}),H=new _.ChunkMetadata(t.level,t.sn,t.stats.chunkCount+1,0,A?A.index:-1,!F);y.flush(H)},i._handleFragmentLoadProgress=function(f){},i._doFragLoad=function(f,y,t,A){var U=this;if(t===void 0&&(t=null),!this.levels)throw new Error("frag load aborted, missing levels");if(t=Math.max(f.start,t||0),this.config.lowLatencyMode&&y){var F=y.partList;if(F&&A){t>f.end&&y.fragmentHint&&(f=y.fragmentHint);var H=this.getNextPart(F,f,t);if(H>-1){var J=F[H];return this.log("Loading part sn: "+f.sn+" p: "+J.index+" cc: "+f.cc+" of playlist ["+y.startSN+"-"+y.endSN+"] parts [0-"+H+"-"+(F.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+f.level+", target: "+parseFloat(t.toFixed(3))),this.nextLoadPosition=J.start+J.duration,this.state=h.FRAG_LOADING,this.hls.trigger(T.Events.FRAG_LOADING,{frag:f,part:F[H],targetBufferTime:t}),this.doFragPartsLoad(f,F,H,A).catch(function(B){return U.handleFragLoadError(B)})}else if(!f.url||this.loadedEndOfParts(F,t))return Promise.resolve(null)}}return this.log("Loading fragment "+f.sn+" cc: "+f.cc+" "+(y?"of ["+y.startSN+"-"+y.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+f.level+", target: "+parseFloat(t.toFixed(3))),Object(N.isFiniteNumber)(f.sn)&&!this.bitrateTest&&(this.nextLoadPosition=f.start+f.duration),this.state=h.FRAG_LOADING,this.hls.trigger(T.Events.FRAG_LOADING,{frag:f,targetBufferTime:t}),this.fragmentLoader.load(f,A).catch(function(B){return U.handleFragLoadError(B)})},i.doFragPartsLoad=function(f,y,t,A){var U=this;return new Promise(function(F,H){var J=[],B=function Z(re){var ie=y[re];U.fragmentLoader.loadPart(f,ie,A).then(function(ve){J[ie.index]=ve;var de=ve.part;U.hls.trigger(T.Events.FRAG_LOADED,ve);var q=y[re+1];if(q&&q.fragment===f)Z(re+1);else return F({frag:f,part:de,partsLoaded:J})}).catch(H)};B(t)})},i.handleFragLoadError=function(f){var y=f.data;return y&&y.details===P.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(y.frag,y.part):this.hls.trigger(T.Events.ERROR,y),null},i._handleTransmuxerFlush=function(f){var y=this.getCurrentContext(f);if(!y||this.state!==h.PARSING){this.fragCurrent||(this.state=h.IDLE);return}var t=y.frag,A=y.part,U=y.level,F=self.performance.now();t.stats.parsing.end=F,A&&(A.stats.parsing.end=F),this.updateLevelTiming(t,A,U,f.partial)},i.getCurrentContext=function(f){var y=this.levels,t=f.level,A=f.sn,U=f.part;if(!y||!y[t])return this.warn("Levels object was unset while buffering fragment "+A+" of level "+t+". The current chunk will not be buffered."),null;var F=y[t],H=U>-1?Object(x.getPartWith)(F,A,U):null,J=H?H.fragment:Object(x.getFragmentWithSN)(F,A,this.fragCurrent);return J?{frag:J,part:H,level:F}:null},i.bufferFragmentData=function(f,y,t,A){if(!f||this.state!==h.PARSING)return;var U=f.data1,F=f.data2,H=U;if(U&&F&&(H=Object(S.appendUint8Array)(U,F)),!H||!H.length)return;var J={type:f.type,frag:y,part:t,chunkMeta:A,parent:y.type,data:H};this.hls.trigger(T.Events.BUFFER_APPENDING,J),f.dropped&&f.independent&&!t&&this.flushBufferGap(y)},i.flushBufferGap=function(f){var y=this.media;if(!y)return;if(!I.BufferHelper.isBuffered(y,y.currentTime)){this.flushMainBuffer(0,f.start);return}var t=y.currentTime,A=I.BufferHelper.bufferInfo(y,t,0),U=f.duration,F=Math.min(this.config.maxFragLookUpTolerance*2,U*.25),H=Math.max(Math.min(f.start-F,A.end-F),t+F);f.start-H>F&&this.flushMainBuffer(H,f.start)},i.getFwdBufferInfo=function(f,y){var t=this.config,A=this.getLoadPosition();if(!Object(N.isFiniteNumber)(A))return null;var U=I.BufferHelper.bufferInfo(f,A,t.maxBufferHole);if(U.len===0&&U.nextStart!==void 0){var F=this.fragmentTracker.getBufferedFrag(A,y);if(F&&U.nextStart<F.end)return I.BufferHelper.bufferInfo(f,A,Math.max(U.nextStart,t.maxBufferHole))}return U},i.getMaxBufferLength=function(f){var y=this.config,t;return f?t=Math.max(8*y.maxBufferSize/f,y.maxBufferLength):t=y.maxBufferLength,Math.min(t,y.maxMaxBufferLength)},i.reduceMaxBufferLength=function(f){var y=this.config,t=f||y.maxBufferLength;return y.maxMaxBufferLength>=t?(y.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+y.maxMaxBufferLength+"s"),!0):!1},i.getNextFragment=function(f,y){var t,A,U=y.fragments,F=U.length;if(!F)return null;var H=this.config,J=U[0].start,B;if(y.live){var Z=H.initialLiveManifestSize;if(F<Z)return this.warn("Not enough fragments to start playback (have: "+F+", need: "+Z+")"),null;!y.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(B=this.getInitialLiveFragment(y,U),this.startPosition=B?this.hls.liveSyncPosition||B.start:f)}else f<=J&&(B=U[0]);if(!B){var re=H.lowLatencyMode?y.partEnd:y.fragmentEnd;B=this.getFragmentAtPosition(f,re,y)}return(t=B)!==null&&t!==void 0&&t.initSegment&&!((A=B)!==null&&A!==void 0&&A.initSegment.data)&&!this.bitrateTest&&(B=B.initSegment),B},i.getNextPart=function(f,y,t){for(var A=-1,U=!1,F=!0,H=0,J=f.length;H<J;H++){var B=f[H];if(F=F&&!B.independent,A>-1&&t<B.start)break;var Z=B.loaded;!Z&&(U||B.independent||F)&&B.fragment===y&&(A=H),U=Z}return A},i.loadedEndOfParts=function(f,y){var t=f[f.length-1];return t&&y>t.start&&t.loaded},i.getInitialLiveFragment=function(f,y){var t=this.fragPrevious,A=null;if(t){if(f.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+t.programDateTime),A=Object(C.findFragmentByPDT)(y,t.endProgramDateTime,this.config.maxFragLookUpTolerance)),!A){var U=t.sn+1;if(U>=f.startSN&&U<=f.endSN){var F=y[U-f.startSN];t.cc===F.cc&&(A=F,this.log("Live playlist, switching playlist, load frag with next SN: "+A.sn))}A||(A=Object(C.findFragWithCC)(y,t.cc),A&&this.log("Live playlist, switching playlist, load frag with same CC: "+A.sn))}}else{var H=this.hls.liveSyncPosition;H!==null&&(A=this.getFragmentAtPosition(H,this.bitrateTest?f.fragmentEnd:f.edge,f))}return A},i.getFragmentAtPosition=function(f,y,t){var A=this.config,U=this.fragPrevious,F=t.fragments,H=t.endSN,J=t.fragmentHint,B=A.maxFragLookUpTolerance,Z=!!(A.lowLatencyMode&&t.partList&&J);Z&&J&&!this.bitrateTest&&(F=F.concat(J),H=J.sn);var re;if(f<y){var ie=f>y-B?0:B;re=Object(C.findFragmentByPTS)(U,F,f,ie)}else re=F[F.length-1];if(re){var ve=re.sn-t.startSN,de=U&&re.level===U.level,q=F[ve+1],ee=this.fragmentTracker.getState(re);if(ee===R.FragmentState.BACKTRACKED){re=null;for(var pe=ve;F[pe]&&this.fragmentTracker.getState(F[pe])===R.FragmentState.BACKTRACKED;)U?re=F[pe--]:re=F[--pe];re||(re=q)}else U&&re.sn===U.sn&&!Z&&(de&&(re.sn<H&&this.fragmentTracker.getState(q)!==R.FragmentState.OK?(this.log("SN "+re.sn+" just loaded, load next one: "+q.sn),re=q):re=null))}return re},i.synchronizeToLiveEdge=function(f){var y=this.config,t=this.media;if(!t)return;var A=this.hls.liveSyncPosition,U=t.currentTime,F=f.fragments[0].start,H=f.edge,J=U>=F-y.maxFragLookUpTolerance&&U<=H;if(A!==null&&t.duration>A&&(U<A||!J)){var B=y.liveMaxLatencyDuration!==void 0?y.liveMaxLatencyDuration:y.liveMaxLatencyDurationCount*f.targetduration;(!J&&t.readyState<4||U<H-B)&&(this.loadedmetadata||(this.nextLoadPosition=A),t.readyState&&(this.warn("Playback: "+U.toFixed(3)+" is located too far from the end of live sliding playlist: "+H+", reset currentTime to : "+A.toFixed(3)),t.currentTime=A))}},i.alignPlaylists=function(f,y){var t=this.levels,A=this.levelLastLoaded,U=this.fragPrevious,F=A!==null?t[A]:null,H=f.fragments.length;if(!H)return this.warn("No fragments in live playlist"),0;var J=f.fragments[0].start,B=!y,Z=f.alignedSliding&&Object(N.isFiniteNumber)(J);if(B||!Z&&!J){Object(O.alignStream)(U,F,f);var re=f.fragments[0].start;return this.log("Live playlist sliding: "+re.toFixed(2)+" start-sn: "+(y?y.startSN:"na")+"->"+f.startSN+" prev-sn: "+(U?U.sn:"na")+" fragments: "+H),re}return J},i.waitForCdnTuneIn=function(f){var y=3;return f.live&&f.canBlockReload&&f.tuneInGoal>Math.max(f.partHoldBack,f.partTarget*y)},i.setStartPosition=function(f,y){var t=this.startPosition;if(t<y&&(t=-1),t===-1||this.lastCurrentTime===-1){var A=f.startTimeOffset;Object(N.isFiniteNumber)(A)?(t=y+A,A<0&&(t+=f.totalduration),t=Math.min(Math.max(y,t),y+f.totalduration),this.log("Start time offset "+A+" found in playlist, adjust startPosition to "+t),this.startPosition=t):f.live?t=this.hls.liveSyncPosition||y:this.startPosition=t=0,this.lastCurrentTime=t}this.nextLoadPosition=t},i.getLoadPosition=function(){var f=this.media,y=0;return this.loadedmetadata&&f?y=f.currentTime:this.nextLoadPosition&&(y=this.nextLoadPosition),y},i.handleFragLoadAborted=function(f,y){this.transmuxer&&f.sn!=="initSegment"&&f.stats.aborted&&(this.warn("Fragment "+f.sn+(y?" part"+y.index:"")+" of level "+f.level+" was aborted"),this.resetFragmentLoading(f))},i.resetFragmentLoading=function(f){(!this.fragCurrent||!this.fragContextChanged(f))&&(this.state=h.IDLE)},i.onFragmentOrKeyLoadError=function(f,y){if(y.fatal)return;var t=y.frag;if(!t||t.type!==f)return;var A=this.fragCurrent;console.assert(A&&t.sn===A.sn&&t.level===A.level&&t.urlId===A.urlId,"Frag load error must match current frag to retry");var U=this.config;if(this.fragLoadError+1<=U.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(t.level))return;var F=Math.min(Math.pow(2,this.fragLoadError)*U.fragLoadingRetryDelay,U.fragLoadingMaxRetryTimeout);this.warn("Fragment "+t.sn+" of "+f+" "+t.level+" failed to load, retrying in "+F+"ms"),this.retryDate=self.performance.now()+F,this.fragLoadError++,this.state=h.FRAG_LOADING_WAITING_RETRY}else y.levelRetry?(f===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=h.IDLE):(M.logger.error(y.details+" reaches max retry, redispatch as fatal ..."),y.fatal=!0,this.hls.stopLoad(),this.state=h.ERROR)},i.afterBufferFlushed=function(f,y,t){if(!f)return;var A=I.BufferHelper.getBuffered(f);this.fragmentTracker.detectEvictedFragments(y,A,t),this.state===h.ENDED&&this.resetLoadingState()},i.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=h.IDLE},i.resetLiveStartWhenNotLoaded=function(f){if(!this.loadedmetadata){this.startFragRequested=!1;var y=this.levels?this.levels[f].details:null;if(y!=null&&y.live)return this.startPosition=-1,this.setStartPosition(y,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},i.updateLevelTiming=function(f,y,t,A){var U=this,F=t.details;console.assert(!!F,"level.details must be defined");var H=Object.keys(f.elementaryStreams).reduce(function(J,B){var Z=f.elementaryStreams[B];if(Z){var re=Z.endPTS-Z.startPTS;if(re<=0)return U.warn("Could not parse fragment "+f.sn+" "+B+" duration reliably ("+re+") resetting transmuxer to fallback to playlist timing"),U.resetTransmuxer(),J||!1;var ie=A?0:Object(x.updateFragPTSDTS)(F,f,Z.startPTS,Z.endPTS,Z.startDTS,Z.endDTS);return U.hls.trigger(T.Events.LEVEL_PTS_UPDATED,{details:F,level:t,drift:ie,type:B,frag:f,start:Z.startPTS,end:Z.endPTS}),!0}return J},!1);H?(this.state=h.PARSED,this.hls.trigger(T.Events.FRAG_PARSED,{frag:f,part:y})):this.resetLoadingState()},i.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},g(e,[{key:"state",get:function(){return this._state},set:function(f){var y=this._state;y!==f&&(this._state=f,this.log(y+"->"+f))}}]),e}(E.default)},"./src/controller/buffer-controller.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"default",function(){return C});var N=w("./src/polyfills/number.ts"),E=w("./src/events.ts"),R=w("./src/utils/logger.ts"),I=w("./src/errors.ts"),M=w("./src/utils/buffer-helper.ts"),T=w("./src/utils/mediasource-helper.ts"),P=w("./src/loader/fragment.ts"),_=w("./src/controller/buffer-operation-queue.ts"),S=Object(T.getMediaSource)(),O=/([ha]vc.)(?:\.[^.,]+)+/,C=function(){function x(p){var n=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var l=n.hls,s=n.media,g=n.mediaSource;R.logger.log("[buffer-controller]: Media source opened"),s&&(n.updateMediaElementDuration(),l.trigger(E.Events.MEDIA_ATTACHED,{media:s})),g&&g.removeEventListener("sourceopen",n._onMediaSourceOpen),n.checkPendingTracks()},this._onMediaSourceClose=function(){R.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){R.logger.log("[buffer-controller]: Media source ended")},this.hls=p,this._initSourceBuffer(),this.registerListeners()}var b=x.prototype;return b.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},b.destroy=function(){this.unregisterListeners(),this.details=null},b.registerListeners=function(){var n=this.hls;n.on(E.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),n.on(E.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(E.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.on(E.Events.BUFFER_RESET,this.onBufferReset,this),n.on(E.Events.BUFFER_APPENDING,this.onBufferAppending,this),n.on(E.Events.BUFFER_CODECS,this.onBufferCodecs,this),n.on(E.Events.BUFFER_EOS,this.onBufferEos,this),n.on(E.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),n.on(E.Events.LEVEL_UPDATED,this.onLevelUpdated,this),n.on(E.Events.FRAG_PARSED,this.onFragParsed,this),n.on(E.Events.FRAG_CHANGED,this.onFragChanged,this)},b.unregisterListeners=function(){var n=this.hls;n.off(E.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),n.off(E.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(E.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.off(E.Events.BUFFER_RESET,this.onBufferReset,this),n.off(E.Events.BUFFER_APPENDING,this.onBufferAppending,this),n.off(E.Events.BUFFER_CODECS,this.onBufferCodecs,this),n.off(E.Events.BUFFER_EOS,this.onBufferEos,this),n.off(E.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),n.off(E.Events.LEVEL_UPDATED,this.onLevelUpdated,this),n.off(E.Events.FRAG_PARSED,this.onFragParsed,this),n.off(E.Events.FRAG_CHANGED,this.onFragChanged,this)},b._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new _.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},b.onManifestParsed=function(n,l){var s=2;(l.audio&&!l.video||!l.altAudio)&&(s=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=s,this.details=null,R.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},b.onMediaAttaching=function(n,l){var s=this.media=l.media;if(s&&S){var g=this.mediaSource=new S;g.addEventListener("sourceopen",this._onMediaSourceOpen),g.addEventListener("sourceended",this._onMediaSourceEnded),g.addEventListener("sourceclose",this._onMediaSourceClose),s.src=self.URL.createObjectURL(g),this._objectUrl=s.src}},b.onMediaDetaching=function(){var n=this.media,l=this.mediaSource,s=this._objectUrl;if(l){if(R.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(g){R.logger.warn("[buffer-controller]: onMediaDetaching: "+g.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),n&&(s&&self.URL.revokeObjectURL(s),n.src===s?(n.removeAttribute("src"),n.load()):R.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(E.Events.MEDIA_DETACHED,void 0)},b.onBufferReset=function(){var n=this;this.getSourceBufferTypes().forEach(function(l){var s=n.sourceBuffer[l];try{s&&(n.removeBufferListeners(l),n.mediaSource&&n.mediaSource.removeSourceBuffer(s),n.sourceBuffer[l]=void 0)}catch(g){R.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",g)}}),this._initSourceBuffer()},b.onBufferCodecs=function(n,l){var s=this,g=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(d){if(g){var u=s.tracks[d];if(u&&typeof u.buffer.changeType=="function"){var m=l[d],h=m.codec,a=m.levelCodec,r=m.container,e=(u.levelCodec||u.codec).replace(O,"$1"),i=(a||h).replace(O,"$1");if(e!==i){var v=r+";codecs="+(a||h);s.appendChangeType(d,v)}}}else s.pendingTracks[d]=l[d]}),g)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},b.appendChangeType=function(n,l){var s=this,g=this.operationQueue,d={execute:function(){var m=s.sourceBuffer[n];m&&(R.logger.log("[buffer-controller]: changing "+n+" sourceBuffer type to "+l),m.changeType(l)),g.shiftAndExecuteNext(n)},onStart:function(){},onComplete:function(){},onError:function(m){R.logger.warn("[buffer-controller]: Failed to change "+n+" SourceBuffer type",m)}};g.append(d,n)},b.onBufferAppending=function(n,l){var s=this,g=this.hls,d=this.operationQueue,u=this.tracks,m=l.data,h=l.type,a=l.frag,r=l.part,e=l.chunkMeta,i=e.buffering[h],v=self.performance.now();i.start=v;var f=a.stats.buffering,y=r?r.stats.buffering:null;f.start===0&&(f.start=v),y&&y.start===0&&(y.start=v);var t=u.audio,A=h==="audio"&&e.id===1&&(t==null?void 0:t.container)==="audio/mpeg",U={execute:function(){if(i.executeStart=self.performance.now(),A){var H=s.sourceBuffer[h];if(H){var J=a.start-H.timestampOffset;Math.abs(J)>=.1&&(R.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+a.start+" (delta: "+J+") sn: "+a.sn+")"),H.timestampOffset=a.start)}}s.appendExecutor(m,h)},onStart:function(){},onComplete:function(){var H=self.performance.now();i.executeEnd=i.end=H,f.first===0&&(f.first=H),y&&y.first===0&&(y.first=H);var J=s.sourceBuffer,B={};for(var Z in J)B[Z]=M.BufferHelper.getBuffered(J[Z]);s.appendError=0,s.hls.trigger(E.Events.BUFFER_APPENDED,{type:h,frag:a,part:r,chunkMeta:e,parent:a.type,timeRanges:B})},onError:function(H){R.logger.error("[buffer-controller]: Error encountered while trying to append to the "+h+" SourceBuffer",H);var J={type:I.ErrorTypes.MEDIA_ERROR,parent:a.type,details:I.ErrorDetails.BUFFER_APPEND_ERROR,err:H,fatal:!1};H.code===DOMException.QUOTA_EXCEEDED_ERR?J.details=I.ErrorDetails.BUFFER_FULL_ERROR:(s.appendError++,J.details=I.ErrorDetails.BUFFER_APPEND_ERROR,s.appendError>g.config.appendErrorMaxRetry&&(R.logger.error("[buffer-controller]: Failed "+g.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),J.fatal=!0)),g.trigger(E.Events.ERROR,J)}};d.append(U,h)},b.onBufferFlushing=function(n,l){var s=this,g=this.operationQueue,d=function(m){return{execute:s.removeExecutor.bind(s,m,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){s.hls.trigger(E.Events.BUFFER_FLUSHED,{type:m})},onError:function(a){R.logger.warn("[buffer-controller]: Failed to remove from "+m+" SourceBuffer",a)}}};l.type?g.append(d(l.type),l.type):this.getSourceBufferTypes().forEach(function(u){g.append(d(u),u)})},b.onFragParsed=function(n,l){var s=this,g=l.frag,d=l.part,u=[],m=d?d.elementaryStreams:g.elementaryStreams;m[P.ElementaryStreamTypes.AUDIOVIDEO]?u.push("audiovideo"):(m[P.ElementaryStreamTypes.AUDIO]&&u.push("audio"),m[P.ElementaryStreamTypes.VIDEO]&&u.push("video"));var h=function(){var r=self.performance.now();g.stats.buffering.end=r,d&&(d.stats.buffering.end=r);var e=d?d.stats:g.stats;s.hls.trigger(E.Events.FRAG_BUFFERED,{frag:g,part:d,stats:e,id:g.type})};u.length===0&&R.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+g.type+" level: "+g.level+" sn: "+g.sn),this.blockBuffers(h,u)},b.onFragChanged=function(n,l){this.flushBackBuffer()},b.onBufferEos=function(n,l){var s=this,g=this.getSourceBufferTypes().reduce(function(d,u){var m=s.sourceBuffer[u];return(!l.type||l.type===u)&&(m&&!m.ended&&(m.ended=!0,R.logger.log("[buffer-controller]: "+u+" sourceBuffer now EOS"))),d&&!!(!m||m.ended)},!0);g&&this.blockBuffers(function(){var d=s.mediaSource;if(!d||d.readyState!=="open")return;d.endOfStream()})},b.onLevelUpdated=function(n,l){var s=l.details;if(!s.fragments.length)return;this.details=s,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},b.flushBackBuffer=function(){var n=this.hls,l=this.details,s=this.media,g=this.sourceBuffer;if(!s||l===null)return;var d=this.getSourceBufferTypes();if(!d.length)return;var u=l.live&&n.config.liveBackBufferLength!==null?n.config.liveBackBufferLength:n.config.backBufferLength;if(!Object(N.isFiniteNumber)(u)||u<0)return;var m=s.currentTime,h=l.levelTargetDuration,a=Math.max(u,h),r=Math.floor(m/h)*h-a;d.forEach(function(e){var i=g[e];if(i){var v=M.BufferHelper.getBuffered(i);v.length>0&&r>v.start(0)&&(n.trigger(E.Events.BACK_BUFFER_REACHED,{bufferEnd:r}),l.live&&n.trigger(E.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r}),n.trigger(E.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:r,type:e}))}})},b.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var n=this.details,l=this.hls,s=this.media,g=this.mediaSource,d=n.fragments[0].start+n.totalduration,u=s.duration,m=Object(N.isFiniteNumber)(g.duration)?g.duration:0;n.live&&l.config.liveDurationInfinity?(R.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),g.duration=Infinity,this.updateSeekableRange(n)):(d>m&&d>u||!Object(N.isFiniteNumber)(u))&&(R.logger.log("[buffer-controller]: Updating Media Source duration to "+d.toFixed(3)),g.duration=d)},b.updateSeekableRange=function(n){var l=this.mediaSource,s=n.fragments,g=s.length;if(g&&n.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var d=Math.max(0,s[0].start),u=Math.max(d,d+n.totalduration);l.setLiveSeekableRange(d,u)}},b.checkPendingTracks=function(){var n=this.bufferCodecEventsExpected,l=this.operationQueue,s=this.pendingTracks,g=Object.keys(s).length;if(g&&!n||g===2){this.createSourceBuffers(s),this.pendingTracks={};var d=this.getSourceBufferTypes();if(d.length===0){this.hls.trigger(E.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}d.forEach(function(u){l.executeNext(u)})}},b.createSourceBuffers=function(n){var l=this.sourceBuffer,s=this.mediaSource;if(!s)throw Error("createSourceBuffers called when mediaSource was null");var g=0;for(var d in n)if(!l[d]){var u=n[d];if(!u)throw Error("source buffer exists for track "+d+", however track does not");var m=u.levelCodec||u.codec,h=u.container+";codecs="+m;R.logger.log("[buffer-controller]: creating sourceBuffer("+h+")");try{var a=l[d]=s.addSourceBuffer(h),r=d;this.addBufferListener(r,"updatestart",this._onSBUpdateStart),this.addBufferListener(r,"updateend",this._onSBUpdateEnd),this.addBufferListener(r,"error",this._onSBUpdateError),this.tracks[d]={buffer:a,codec:m,container:u.container,levelCodec:u.levelCodec,id:u.id},g++}catch(e){R.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+e.message),this.hls.trigger(E.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,mimeType:h})}}g&&this.hls.trigger(E.Events.BUFFER_CREATED,{tracks:this.tracks})},b._onSBUpdateStart=function(n){var l=this.operationQueue,s=l.current(n);s.onStart()},b._onSBUpdateEnd=function(n){var l=this.operationQueue,s=l.current(n);s.onComplete(),l.shiftAndExecuteNext(n)},b._onSBUpdateError=function(n,l){R.logger.error("[buffer-controller]: "+n+" SourceBuffer error",l),this.hls.trigger(E.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var s=this.operationQueue.current(n);s&&s.onError(l)},b.removeExecutor=function(n,l,s){var g=this.media,d=this.mediaSource,u=this.operationQueue,m=this.sourceBuffer,h=m[n];if(!g||!d||!h){R.logger.warn("[buffer-controller]: Attempting to remove from the "+n+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(n);return}var a=Object(N.isFiniteNumber)(g.duration)?g.duration:Infinity,r=Object(N.isFiniteNumber)(d.duration)?d.duration:Infinity,e=Math.max(0,l),i=Math.min(s,a,r);i>e?(R.logger.log("[buffer-controller]: Removing ["+e+","+i+"] from the "+n+" SourceBuffer"),console.assert(!h.updating,n+" sourceBuffer must not be updating"),h.remove(e,i)):u.shiftAndExecuteNext(n)},b.appendExecutor=function(n,l){var s=this.operationQueue,g=this.sourceBuffer,d=g[l];if(!d){R.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),s.shiftAndExecuteNext(l);return}d.ended=!1,console.assert(!d.updating,l+" sourceBuffer must not be updating"),d.appendBuffer(n)},b.blockBuffers=function(n,l){var s=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){R.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(n);return}var g=this.operationQueue,d=l.map(function(u){return g.appendBlocker(u)});Promise.all(d).then(function(){n(),l.forEach(function(u){var m=s.sourceBuffer[u];(!m||!m.updating)&&g.shiftAndExecuteNext(u)})})},b.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},b.addBufferListener=function(n,l,s){var g=this.sourceBuffer[n];if(!g)return;var d=s.bind(this,n);this.listeners[n].push({event:l,listener:d}),g.addEventListener(l,d)},b.removeBufferListeners=function(n){var l=this.sourceBuffer[n];if(!l)return;this.listeners[n].forEach(function(s){l.removeEventListener(s.event,s.listener)})},x}()},"./src/controller/buffer-operation-queue.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"default",function(){return E});var N=w("./src/utils/logger.ts"),E=function(){function R(M){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=M}var I=R.prototype;return I.append=function(T,P){var _=this.queues[P];_.push(T),_.length===1&&this.buffers[P]&&this.executeNext(P)},I.insertAbort=function(T,P){var _=this.queues[P];_.unshift(T),this.executeNext(P)},I.appendBlocker=function(T){var P,_=new Promise(function(O){P=O}),S={execute:P,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(S,T),_},I.executeNext=function(T){var P=this.buffers,_=this.queues,S=P[T],O=_[T];if(O.length){var C=O[0];try{C.execute()}catch(x){N.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),C.onError(x),(!S||!S.updating)&&(O.shift(),this.executeNext(T))}}},I.shiftAndExecuteNext=function(T){this.queues[T].shift(),this.executeNext(T)},I.current=function(T){return this.queues[T][0]},R}()},"./src/controller/cap-level-controller.ts":function(Ee,j,w){"use strict";w.r(j);var N=w("./src/events.ts");function E(M,T){for(var P=0;P<T.length;P++){var _=T[P];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(M,_.key,_)}}function R(M,T,P){return T&&E(M.prototype,T),P&&E(M,P),M}var I=function(){function M(P){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=P,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var T=M.prototype;return T.setStreamController=function(_){this.streamController=_},T.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},T.registerListeners=function(){var _=this.hls;_.on(N.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),_.on(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),_.on(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),_.on(N.Events.BUFFER_CODECS,this.onBufferCodecs,this),_.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},T.unregisterListener=function(){var _=this.hls;_.off(N.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),_.off(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),_.off(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),_.off(N.Events.BUFFER_CODECS,this.onBufferCodecs,this),_.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},T.onFpsDropLevelCapping=function(_,S){M.isLevelAllowed(S.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(S.droppedLevel)},T.onMediaAttaching=function(_,S){this.media=S.media instanceof HTMLVideoElement?S.media:null},T.onManifestParsed=function(_,S){var O=this.hls;this.restrictedLevels=[],this.firstLevel=S.firstLevel,O.config.capLevelToPlayerSize&&S.video&&this.startCapping()},T.onBufferCodecs=function(_,S){var O=this.hls;O.config.capLevelToPlayerSize&&S.video&&this.startCapping()},T.onMediaDetaching=function(){this.stopCapping()},T.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var _=this.hls.levels;if(_.length){var S=this.hls;S.autoLevelCapping=this.getMaxLevel(_.length-1),S.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=S.autoLevelCapping}}},T.getMaxLevel=function(_){var S=this,O=this.hls.levels;if(!O.length)return-1;var C=O.filter(function(x,b){return M.isLevelAllowed(b,S.restrictedLevels)&&b<=_});return this.clientRect=null,M.getMaxLevelByMediaSize(C,this.mediaWidth,this.mediaHeight)},T.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},T.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},T.getDimensions=function(){if(this.clientRect)return this.clientRect;var _=this.media,S={width:0,height:0};if(_){var O=_.getBoundingClientRect();S.width=O.width,S.height=O.height,!S.width&&!S.height&&(S.width=O.right-O.left||_.width||0,S.height=O.bottom-O.top||_.height||0)}return this.clientRect=S,S},M.isLevelAllowed=function(_,S){return S===void 0&&(S=[]),S.indexOf(_)===-1},M.getMaxLevelByMediaSize=function(_,S,O){if(!_||!_.length)return-1;for(var C=function(l,s){return s?l.width!==s.width||l.height!==s.height:!0},x=_.length-1,b=0;b<_.length;b+=1){var p=_[b];if((p.width>=S||p.height>=O)&&C(p,_[b+1])){x=b;break}}return x},R(M,[{key:"mediaWidth",get:function(){return this.getDimensions().width*M.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*M.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var _=1;try{_=self.devicePixelRatio}catch(S){}return _}}]),M}();j.default=I},"./src/controller/cmcd-controller.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"default",function(){return C});var N=w("./src/events.ts"),E=w("./src/types/cmcd.ts"),R=w("./src/utils/buffer-helper.ts"),I=w("./src/utils/logger.ts");function M(x,b){for(var p=0;p<b.length;p++){var n=b[p];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(x,n.key,n)}}function T(x,b,p){return b&&M(x.prototype,b),p&&M(x,p),x}function P(x,b){var p=typeof Symbol!="undefined"&&x[Symbol.iterator]||x["@@iterator"];if(p)return(p=p.call(x)).next.bind(p);if(Array.isArray(x)||(p=_(x))||b&&x&&typeof x.length=="number"){p&&(x=p);var n=0;return function(){return n>=x.length?{done:!0}:{done:!1,value:x[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _(x,b){if(!x)return;if(typeof x=="string")return S(x,b);var p=Object.prototype.toString.call(x).slice(8,-1);if(p==="Object"&&x.constructor&&(p=x.constructor.name),p==="Map"||p==="Set")return Array.from(x);if(p==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(p))return S(x,b)}function S(x,b){(b==null||b>x.length)&&(b=x.length);for(var p=0,n=new Array(b);p<b;p++)n[p]=x[p];return n}function O(){return O=Object.assign||function(x){for(var b=1;b<arguments.length;b++){var p=arguments[b];for(var n in p)Object.prototype.hasOwnProperty.call(p,n)&&(x[n]=p[n])}return x},O.apply(this,arguments)}var C=function(){function x(p){var n=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(){n.initialized&&(n.starved=!0),n.buffering=!0},this.onPlaying=function(){n.initialized||(n.initialized=!0),n.buffering=!1},this.applyPlaylistData=function(g){try{n.apply(g,{ot:E.CMCDObjectType.MANIFEST,su:!n.initialized})}catch(d){I.logger.warn("Could not generate manifest CMCD data.",d)}},this.applyFragmentData=function(g){try{var d=g.frag,u=n.hls.levels[d.level],m=n.getObjectType(d),h={d:d.duration*1e3,ot:m};(m===E.CMCDObjectType.VIDEO||m===E.CMCDObjectType.AUDIO||m==E.CMCDObjectType.MUXED)&&(h.br=u.bitrate/1e3,h.tb=n.getTopBandwidth(m),h.bl=n.getBufferLength(m)),n.apply(g,h)}catch(a){I.logger.warn("Could not generate segment CMCD data.",a)}},this.hls=p;var l=this.config=p.config,s=l.cmcd;s!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||x.uuid(),this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.registerListeners())}var b=x.prototype;return b.registerListeners=function(){var n=this.hls;n.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(N.Events.MEDIA_DETACHED,this.onMediaDetached,this),n.on(N.Events.BUFFER_CREATED,this.onBufferCreated,this)},b.unregisterListeners=function(){var n=this.hls;n.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(N.Events.MEDIA_DETACHED,this.onMediaDetached,this),n.off(N.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},b.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},b.onMediaAttached=function(n,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},b.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},b.onBufferCreated=function(n,l){var s,g;this.audioBuffer=(s=l.tracks.audio)===null||s===void 0?void 0:s.buffer,this.videoBuffer=(g=l.tracks.video)===null||g===void 0?void 0:g.buffer},b.createData=function(){var n;return{v:E.CMCDVersion,sf:E.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(n=this.media)===null||n===void 0?void 0:n.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},b.apply=function(n,l){l===void 0&&(l={}),O(l,this.createData());var s=l.ot===E.CMCDObjectType.INIT||l.ot===E.CMCDObjectType.VIDEO||l.ot===E.CMCDObjectType.MUXED;if(this.starved&&s&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var g=x.toHeaders(l);if(!Object.keys(g).length)return;n.headers||(n.headers={}),O(n.headers,g)}else{var d=x.toQuery(l);if(!d)return;n.url=x.appendQueryToUri(n.url,d)}},b.getObjectType=function(n){var l=n.type;return l==="subtitle"?E.CMCDObjectType.TIMED_TEXT:n.sn==="initSegment"?E.CMCDObjectType.INIT:l==="audio"?E.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?E.CMCDObjectType.VIDEO:E.CMCDObjectType.MUXED:void 0},b.getTopBandwidth=function(n){for(var l=0,s=n===E.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,g=P(s),d;!(d=g()).done;){var u=d.value;u.bitrate>l&&(l=u.bitrate)}return l>0?l:NaN},b.getBufferLength=function(n){var l=this.hls.media,s=n===E.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!s||!l)return NaN;var g=R.BufferHelper.bufferInfo(s,l.currentTime,this.config.maxBufferHole);return g.len*1e3},b.createPlaylistLoader=function(){var n=this.config.pLoader,l=this.applyPlaylistData,s=n||this.config.loader;return function(){function g(u){this.loader=void 0,this.loader=new s(u)}var d=g.prototype;return d.destroy=function(){this.loader.destroy()},d.abort=function(){this.loader.abort()},d.load=function(m,h,a){l(m),this.loader.load(m,h,a)},T(g,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),g}()},b.createFragmentLoader=function(){var n=this.config.fLoader,l=this.applyFragmentData,s=n||this.config.loader;return function(){function g(u){this.loader=void 0,this.loader=new s(u)}var d=g.prototype;return d.destroy=function(){this.loader.destroy()},d.abort=function(){this.loader.abort()},d.load=function(m,h,a){l(m),this.loader.load(m,h,a)},T(g,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),g}()},x.uuid=function(){var n=URL.createObjectURL(new Blob),l=n.toString();return URL.revokeObjectURL(n),l.substr(l.lastIndexOf("/")+1)},x.serialize=function(n){for(var l=[],s=function(A){return!Number.isNaN(A)&&A!=null&&A!==""&&A!==!1},g=function(A){return Math.round(A)},d=function(A){return g(A/100)*100},u=function(A){return encodeURIComponent(A)},m={br:g,d:g,bl:d,dl:d,mtp:d,nor:u,rtp:d,tb:g},h=Object.keys(n||{}).sort(),a=P(h),r;!(r=a()).done;){var e=r.value,i=n[e];if(!s(i))continue;if(e==="v"&&i===1)continue;if(e=="pr"&&i===1)continue;var v=m[e];v&&(i=v(i));var f=typeof i,y=void 0;e==="ot"||e==="sf"||e==="st"?y=e+"="+i:f==="boolean"?y=e:f==="number"?y=e+"="+i:y=e+"="+JSON.stringify(i),l.push(y)}return l.join(",")},x.toHeaders=function(n){for(var l=Object.keys(n),s={},g=["Object","Request","Session","Status"],d=[{},{},{},{}],u={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},m=0,h=l;m<h.length;m++){var a=h[m],r=u[a]!=null?u[a]:1;d[r][a]=n[a]}for(var e=0;e<d.length;e++){var i=x.serialize(d[e]);i&&(s["CMCD-"+g[e]]=i)}return s},x.toQuery=function(n){return"CMCD="+encodeURIComponent(x.serialize(n))},x.appendQueryToUri=function(n,l){if(!l)return n;var s=n.includes("?")?"&":"?";return""+n+s+l},x}()},"./src/controller/eme-controller.ts":function(Ee,j,w){"use strict";w.r(j);var N=w("./src/events.ts"),E=w("./src/errors.ts"),R=w("./src/utils/logger.ts"),I=w("./src/utils/mediakeys-helper.ts");function M(C,x){for(var b=0;b<x.length;b++){var p=x[b];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(C,p.key,p)}}function T(C,x,b){return x&&M(C.prototype,x),b&&M(C,b),C}var P=3,_=function(x,b,p){var n={audioCapabilities:[],videoCapabilities:[]};return x.forEach(function(l){n.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:p.audioRobustness||""})}),b.forEach(function(l){n.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:p.videoRobustness||""})}),[n]},S=function(x,b,p,n){switch(x){case I.KeySystems.WIDEVINE:return _(b,p,n);default:throw new Error("Unknown key-system: "+x)}},O=function(){function C(b){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=b,this._config=b.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 x=C.prototype;return x.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},x._registerListeners=function(){this.hls.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(N.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(N.Events.MANIFEST_PARSED,this.onManifestParsed,this)},x._unregisterListeners=function(){this.hls.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(N.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(N.Events.MANIFEST_PARSED,this.onManifestParsed,this)},x.getLicenseServerUrl=function(p){switch(p){case I.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+p+'"')},x._attemptKeySystemAccess=function(p,n,l){var s=this,g=S(p,n,l,this._drmSystemOptions);R.logger.log("Requesting encrypted media key-system access");var d=this.requestMediaKeySystemAccess(p,g);this.mediaKeysPromise=d.then(function(u){return s._onMediaKeySystemAccessObtained(p,u)}),d.catch(function(u){R.logger.error('Failed to obtain key-system "'+p+'" access:',u)})},x._onMediaKeySystemAccessObtained=function(p,n){var l=this;R.logger.log('Access for key-system "'+p+'" obtained');var s={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:n,mediaKeySystemDomain:p};this._mediaKeysList.push(s);var g=Promise.resolve().then(function(){return n.createMediaKeys()}).then(function(d){return s.mediaKeys=d,R.logger.log('Media-keys created for key-system "'+p+'"'),l._onMediaKeysCreated(),d});return g.catch(function(d){R.logger.error("Failed to create media-keys:",d)}),g},x._onMediaKeysCreated=function(){var p=this;this._mediaKeysList.forEach(function(n){n.mediaKeysSession||(n.mediaKeysSession=n.mediaKeys.createSession(),p._onNewMediaKeySession(n.mediaKeysSession))})},x._onNewMediaKeySession=function(p){var n=this;R.logger.log("New key-system session "+p.sessionId),p.addEventListener("message",function(l){n._onKeySessionMessage(p,l.message)},!1)},x._onKeySessionMessage=function(p,n){R.logger.log("Got EME message event, creating license request"),this._requestLicense(n,function(l){R.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),p.update(l)})},x.onMediaEncrypted=function(p){var n=this;if(R.logger.log('Media is encrypted using "'+p.initDataType+'" init data type'),!this.mediaKeysPromise){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.KEY_SYSTEM_ERROR,details:E.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(g){if(!n._media)return;n._attemptSetMediaKeys(g),n._generateRequestWithPreferredKeySession(p.initDataType,p.initData)};this.mediaKeysPromise.then(l).catch(l)},x._attemptSetMediaKeys=function(p){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var n=this._mediaKeysList[0];if(!n||!n.mediaKeys){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.KEY_SYSTEM_ERROR,details:E.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}R.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(n.mediaKeys),this._hasSetMediaKeys=!0}},x._generateRequestWithPreferredKeySession=function(p,n){var l=this,s=this._mediaKeysList[0];if(!s){R.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.KEY_SYSTEM_ERROR,details:E.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(s.mediaKeysSessionInitialized){R.logger.warn("Key-Session already initialized but requested again");return}var g=s.mediaKeysSession;if(!g){R.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.KEY_SYSTEM_ERROR,details:E.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!n){R.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.KEY_SYSTEM_ERROR,details:E.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}R.logger.log('Generating key-session request for "'+p+'" init data type'),s.mediaKeysSessionInitialized=!0,g.generateRequest(p,n).then(function(){R.logger.debug("Key-session generation succeeded")}).catch(function(d){R.logger.error("Error generating key-session request:",d),l.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.KEY_SYSTEM_ERROR,details:E.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},x._createLicenseXhr=function(p,n,l){var s=new XMLHttpRequest;s.responseType="arraybuffer",s.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,s,p,n,l);var g=this._licenseXhrSetup;if(g)try{g.call(this.hls,s,p),g=void 0}catch(d){R.logger.error(d)}try{s.readyState||s.open("POST",p,!0),g&&g.call(this.hls,s,p)}catch(d){throw new Error("issue setting up KeySystem license XHR "+d)}return s},x._onLicenseRequestReadyStageChange=function(p,n,l,s){switch(p.readyState){case 4:if(p.status===200){this._requestLicenseFailureCount=0,R.logger.log("License request succeeded");var g=p.response,d=this._licenseResponseCallback;if(d)try{g=d.call(this.hls,p,n)}catch(m){R.logger.error(m)}s(g)}else{if(R.logger.error("License Request XHR failed ("+n+"). Status: "+p.status+" ("+p.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>P){this.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.KEY_SYSTEM_ERROR,details:E.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var u=P-this._requestLicenseFailureCount+1;R.logger.warn("Retrying license request, "+u+" attempts left"),this._requestLicense(l,s)}break}},x._generateLicenseRequestChallenge=function(p,n){switch(p.mediaKeySystemDomain){case I.KeySystems.WIDEVINE:return n}throw new Error("unsupported key-system: "+p.mediaKeySystemDomain)},x._requestLicense=function(p,n){R.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){R.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.KEY_SYSTEM_ERROR,details:E.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var s=this.getLicenseServerUrl(l.mediaKeySystemDomain),g=this._createLicenseXhr(s,p,n);R.logger.log("Sending license request to URL: "+s);var d=this._generateLicenseRequestChallenge(l,p);g.send(d)}catch(u){R.logger.error("Failure requesting DRM license: "+u),this.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.KEY_SYSTEM_ERROR,details:E.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},x.onMediaAttached=function(p,n){if(!this._emeEnabled)return;var l=n.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},x.onMediaDetached=function(){var p=this._media,n=this._mediaKeysList;if(!p)return;p.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(n.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return p.setMediaKeys(null)}).catch(function(){})},x.onManifestParsed=function(p,n){if(!this._emeEnabled)return;var l=n.levels.map(function(g){return g.audioCodec}).filter(function(g){return!!g}),s=n.levels.map(function(g){return g.videoCodec}).filter(function(g){return!!g});this._attemptKeySystemAccess(I.KeySystems.WIDEVINE,l,s)},T(C,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),C}();j.default=O},"./src/controller/fps-controller.ts":function(Ee,j,w){"use strict";w.r(j);var N=w("./src/events.ts"),E=w("./src/utils/logger.ts"),R=function(){function I(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 M=I.prototype;return M.setStreamController=function(P){this.streamController=P},M.registerListeners=function(){this.hls.on(N.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},M.unregisterListeners=function(){this.hls.off(N.Events.MEDIA_ATTACHING,this.onMediaAttaching)},M.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},M.onMediaAttaching=function(P,_){var S=this.hls.config;if(S.capLevelOnFPSDrop){var O=_.media instanceof self.HTMLVideoElement?_.media:null;this.media=O,O&&typeof O.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),S.fpsDroppedMonitoringPeriod)}},M.checkFPS=function(P,_,S){var O=performance.now();if(_){if(this.lastTime){var C=O-this.lastTime,x=S-this.lastDroppedFrames,b=_-this.lastDecodedFrames,p=1e3*x/C,n=this.hls;if(n.trigger(N.Events.FPS_DROP,{currentDropped:x,currentDecoded:b,totalDroppedFrames:S}),p>0&&x>n.config.fpsDroppedMonitoringThreshold*b){var l=n.currentLevel;E.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(n.autoLevelCapping===-1||n.autoLevelCapping>=l)&&(l=l-1,n.trigger(N.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:n.currentLevel}),n.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=O,this.lastDroppedFrames=S,this.lastDecodedFrames=_}},M.checkFPSInterval=function(){var P=this.media;if(P)if(this.isVideoPlaybackQualityAvailable){var _=P.getVideoPlaybackQuality();this.checkFPS(P,_.totalVideoFrames,_.droppedVideoFrames)}else this.checkFPS(P,P.webkitDecodedFrameCount,P.webkitDroppedFrameCount)},I}();j.default=R},"./src/controller/fragment-finders.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"findFragmentByPDT",function(){return R}),w.d(j,"findFragmentByPTS",function(){return I}),w.d(j,"fragmentWithinToleranceTest",function(){return M}),w.d(j,"pdtWithinToleranceTest",function(){return T}),w.d(j,"findFragWithCC",function(){return P});var N=w("./src/polyfills/number.ts"),E=w("./src/utils/binary-search.ts");function R(_,S,O){if(S===null||!Array.isArray(_)||!_.length||!Object(N.isFiniteNumber)(S))return null;var C=_[0].programDateTime;if(S<(C||0))return null;var x=_[_.length-1].endProgramDateTime;if(S>=(x||0))return null;O=O||0;for(var b=0;b<_.length;++b){var p=_[b];if(T(S,O,p))return p}return null}function I(_,S,O,C){O===void 0&&(O=0),C===void 0&&(C=0);var x=null;if(_?x=S[_.sn-S[0].sn+1]||null:O===0&&S[0].start===0&&(x=S[0]),x&&M(O,C,x)===0)return x;var b=E.default.search(S,M.bind(null,O,C));return b||x}function M(_,S,O){_===void 0&&(_=0),S===void 0&&(S=0);var C=Math.min(S,O.duration+(O.deltaPTS?O.deltaPTS:0));return O.start+O.duration-C<=_?1:O.start-C>_&&O.start?-1:0}function T(_,S,O){var C=Math.min(S,O.duration+(O.deltaPTS?O.deltaPTS:0))*1e3,x=O.endProgramDateTime||0;return x-C>_}function P(_,S){return E.default.search(_,function(O){return O.cc<S?1:O.cc>S?-1:0})}},"./src/controller/fragment-tracker.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"FragmentState",function(){return R}),w.d(j,"FragmentTracker",function(){return I});var N=w("./src/events.ts"),E=w("./src/types/loader.ts"),R;(function(P){P.NOT_LOADED="NOT_LOADED",P.BACKTRACKED="BACKTRACKED",P.APPENDING="APPENDING",P.PARTIAL="PARTIAL",P.OK="OK"})(R||(R={}));var I=function(){function P(S){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=S,this._registerListeners()}var _=P.prototype;return _._registerListeners=function(){var O=this.hls;O.on(N.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.on(N.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.on(N.Events.FRAG_LOADED,this.onFragLoaded,this)},_._unregisterListeners=function(){var O=this.hls;O.off(N.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.off(N.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.off(N.Events.FRAG_LOADED,this.onFragLoaded,this)},_.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},_.getAppendedFrag=function(O,C){if(C===E.PlaylistLevelType.MAIN){var x=this.activeFragment,b=this.activeParts;if(!x)return null;if(b)for(var p=b.length;p--;){var n=b[p],l=n?n.end:x.appendedPTS;if(n.start<=O&&l!==void 0&&O<=l)return p>9&&(this.activeParts=b.slice(p-9)),n}else if(x.start<=O&&x.appendedPTS!==void 0&&O<=x.appendedPTS)return x}return this.getBufferedFrag(O,C)},_.getBufferedFrag=function(O,C){for(var x=this.fragments,b=Object.keys(x),p=b.length;p--;){var n=x[b[p]];if((n==null?void 0:n.body.type)===C&&n.buffered){var l=n.body;if(l.start<=O&&O<=l.end)return l}}return null},_.detectEvictedFragments=function(O,C,x){var b=this;Object.keys(this.fragments).forEach(function(p){var n=b.fragments[p];if(!n)return;if(!n.buffered){n.body.type===x&&b.removeFragment(n.body);return}var l=n.range[O];if(!l)return;l.time.some(function(s){var g=!b.isTimeBuffered(s.startPTS,s.endPTS,C);return g&&b.removeFragment(n.body),g})})},_.detectPartialFragments=function(O){var C=this,x=this.timeRanges,b=O.frag,p=O.part;if(!x||b.sn==="initSegment")return;var n=T(b),l=this.fragments[n];if(!l)return;Object.keys(x).forEach(function(s){var g=b.elementaryStreams[s];if(!g)return;var d=x[s],u=p!==null||g.partial===!0;l.range[s]=C.getBufferedTimes(b,p,u,d)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},_.fragBuffered=function(O){var C=T(O),x=this.fragments[C];x&&(x.backtrack=x.loaded=null,x.buffered=!0)},_.getBufferedTimes=function(O,C,x,b){for(var p={time:[],partial:x},n=C?C.start:O.start,l=C?C.end:O.end,s=O.minEndPTS||l,g=O.maxStartPTS||n,d=0;d<b.length;d++){var u=b.start(d)-this.bufferPadding,m=b.end(d)+this.bufferPadding;if(g>=u&&s<=m){p.time.push({startPTS:Math.max(n,b.start(d)),endPTS:Math.min(l,b.end(d))});break}else if(n<m&&l>u)p.partial=!0,p.time.push({startPTS:Math.max(n,b.start(d)),endPTS:Math.min(l,b.end(d))});else if(l<=u)break}return p},_.getPartialFragment=function(O){var C=null,x,b,p,n=0,l=this.bufferPadding,s=this.fragments;return Object.keys(s).forEach(function(g){var d=s[g];if(!d)return;M(d)&&(b=d.body.start-l,p=d.body.end+l,O>=b&&O<=p&&(x=Math.min(O-b,p-O),n<=x&&(C=d.body,n=x)))}),C},_.getState=function(O){var C=T(O),x=this.fragments[C];return x?x.buffered?M(x)?R.PARTIAL:R.OK:x.backtrack?R.BACKTRACKED:R.APPENDING:R.NOT_LOADED},_.backtrack=function(O,C){var x=T(O),b=this.fragments[x];if(!b||b.backtrack)return null;var p=b.backtrack=C||b.loaded;return b.loaded=null,p},_.getBacktrackData=function(O){var C=T(O),x=this.fragments[C];if(x){var b,p=x.backtrack;if(p!=null&&(b=p.payload)!==null&&b!==void 0&&b.byteLength)return p;this.removeFragment(O)}return null},_.isTimeBuffered=function(O,C,x){for(var b,p,n=0;n<x.length;n++){if(b=x.start(n)-this.bufferPadding,p=x.end(n)+this.bufferPadding,O>=b&&C<=p)return!0;if(C<=b)return!1}return!1},_.onFragLoaded=function(O,C){var x=C.frag,b=C.part;if(x.sn==="initSegment"||x.bitrateTest||b)return;var p=T(x);this.fragments[p]={body:x,loaded:C,backtrack:null,buffered:!1,range:Object.create(null)}},_.onBufferAppended=function(O,C){var x=this,b=C.frag,p=C.part,n=C.timeRanges;if(b.type===E.PlaylistLevelType.MAIN)if(this.activeFragment=b,p){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(p)}else this.activeParts=null;this.timeRanges=n,Object.keys(n).forEach(function(s){var g=n[s];if(x.detectEvictedFragments(s,g),!p)for(var d=0;d<g.length;d++)b.appendedPTS=Math.max(g.end(d),b.appendedPTS||0)})},_.onFragBuffered=function(O,C){this.detectPartialFragments(C)},_.hasFragment=function(O){var C=T(O);return!!this.fragments[C]},_.removeFragmentsInRange=function(O,C,x){var b=this;Object.keys(this.fragments).forEach(function(p){var n=b.fragments[p];if(!n)return;if(n.buffered){var l=n.body;l.type===x&&l.start<C&&l.end>O&&b.removeFragment(l)}})},_.removeFragment=function(O){var C=T(O);O.stats.loaded=0,O.clearElementaryStreamInfo(),delete this.fragments[C]},_.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},P}();function M(P){var _,S;return P.buffered&&(((_=P.range.video)===null||_===void 0?void 0:_.partial)||((S=P.range.audio)===null||S===void 0?void 0:S.partial))}function T(P){return P.type+"_"+P.level+"_"+P.urlId+"_"+P.sn}},"./src/controller/gap-controller.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"STALL_MINIMUM_DURATION_MS",function(){return M}),w.d(j,"MAX_START_GAP_JUMP",function(){return T}),w.d(j,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return P}),w.d(j,"SKIP_BUFFER_RANGE_START",function(){return _}),w.d(j,"default",function(){return S});var N=w("./src/utils/buffer-helper.ts"),E=w("./src/errors.ts"),R=w("./src/events.ts"),I=w("./src/utils/logger.ts"),M=250,T=2,P=.1,_=.05,S=function(){function O(x,b,p,n){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=x,this.media=b,this.fragmentTracker=p,this.hls=n}var C=O.prototype;return C.destroy=function(){this.hls=this.fragmentTracker=this.media=null},C.poll=function(b){var p=this.config,n=this.media,l=this.stalled,s=n.currentTime,g=n.seeking,d=this.seeking&&!g,u=!this.seeking&&g;if(this.seeking=g,s!==b){if(this.moved=!0,l!==null){if(this.stallReported){var m=self.performance.now()-l;I.logger.warn("playback not stuck anymore @"+s+", after "+Math.round(m)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((u||d)&&(this.stalled=null),n.paused||n.ended||n.playbackRate===0||!N.BufferHelper.getBuffered(n).length)return;var h=N.BufferHelper.bufferInfo(n,s,0),a=h.len>0,r=h.nextStart||0;if(!a&&!r)return;if(g){var e=h.len>T,i=!r||r-s>T&&!this.fragmentTracker.getPartialFragment(s);if(e||i)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var v,f=Math.max(r,h.start||0)-s,y=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,t=y==null||((v=y.details)===null||v===void 0)?void 0:v.live,A=t?y.details.targetduration*2:T;if(f>0&&f<=A){this._trySkipBufferHole(null);return}}var U=self.performance.now();if(l===null){this.stalled=U;return}var F=U-l;!g&&F>=M&&this._reportStall(h.len);var H=N.BufferHelper.bufferInfo(n,s,p.maxBufferHole);this._tryFixBufferStall(H,F)},C._tryFixBufferStall=function(b,p){var n=this.config,l=this.fragmentTracker,s=this.media,g=s.currentTime,d=l.getPartialFragment(g);if(d){var u=this._trySkipBufferHole(d);if(u)return}b.len>n.maxBufferHole&&p>n.highBufferWatchdogPeriod*1e3&&(I.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},C._reportStall=function(b){var p=this.hls,n=this.media,l=this.stallReported;l||(this.stallReported=!0,I.logger.warn("Playback stalling at @"+n.currentTime+" due to low buffer (buffer="+b+")"),p.trigger(R.Events.ERROR,{type:E.ErrorTypes.MEDIA_ERROR,details:E.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:b}))},C._trySkipBufferHole=function(b){for(var p=this.config,n=this.hls,l=this.media,s=l.currentTime,g=0,d=N.BufferHelper.getBuffered(l),u=0;u<d.length;u++){var m=d.start(u);if(s+p.maxBufferHole>=g&&s<m){var h=Math.max(m+_,l.currentTime+P);return I.logger.warn("skipping hole, adjusting currentTime from "+s+" to "+h),this.moved=!0,this.stalled=null,l.currentTime=h,b&&n.trigger(R.Events.ERROR,{type:E.ErrorTypes.MEDIA_ERROR,details:E.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+s+" to "+h,frag:b}),h}g=d.end(u)}return 0},C._tryNudgeBuffer=function(){var b=this.config,p=this.hls,n=this.media,l=n.currentTime,s=(this.nudgeRetry||0)+1;if(this.nudgeRetry=s,s<b.nudgeMaxRetry){var g=l+s*b.nudgeOffset;I.logger.warn("Nudging 'currentTime' from "+l+" to "+g),n.currentTime=g,p.trigger(R.Events.ERROR,{type:E.ErrorTypes.MEDIA_ERROR,details:E.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else I.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+b.nudgeMaxRetry+" nudges"),p.trigger(R.Events.ERROR,{type:E.ErrorTypes.MEDIA_ERROR,details:E.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},O}()},"./src/controller/id3-track-controller.ts":function(Ee,j,w){"use strict";w.r(j);var N=w("./src/events.ts"),E=w("./src/utils/texttrack-utils.ts"),R=w("./src/demux/id3.ts"),I=.25,M=function(){function T(_){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=_,this._registerListeners()}var P=T.prototype;return P.destroy=function(){this._unregisterListeners()},P._registerListeners=function(){var S=this.hls;S.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.on(N.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),S.on(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},P._unregisterListeners=function(){var S=this.hls;S.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.off(N.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),S.off(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},P.onMediaAttached=function(S,O){this.media=O.media},P.onMediaDetaching=function(){if(!this.id3Track)return;Object(E.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},P.getID3Track=function(S){if(!this.media)return;for(var O=0;O<S.length;O++){var C=S[O];if(C.kind==="metadata"&&C.label==="id3")return Object(E.sendAddTrackEvent)(C,this.media),C}return this.media.addTextTrack("metadata","id3")},P.onFragParsingMetadata=function(S,O){if(!this.media)return;var C=O.frag,x=O.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var b=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,p=0;p<x.length;p++){var n=R.getID3Frames(x[p].data);if(n){var l=x[p].pts,s=p<x.length-1?x[p+1].pts:C.end,g=s-l;g<=0&&(s=l+I);for(var d=0;d<n.length;d++){var u=n[d];if(!R.isTimeStampFrame(u)){var m=new b(l,s,"");m.value=u,this.id3Track.addCue(m)}}}}},P.onBufferFlushing=function(S,O){var C=O.startOffset,x=O.endOffset,b=O.type;if(!b||b==="audio"){var p=this.id3Track;p&&Object(E.removeCuesInRange)(p,C,x)}},T}();j.default=M},"./src/controller/latency-controller.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"default",function(){return T});var N=w("./src/errors.ts"),E=w("./src/events.ts"),R=w("./src/utils/logger.ts");function I(P,_){for(var S=0;S<_.length;S++){var O=_[S];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(P,O.key,O)}}function M(P,_,S){return _&&I(P.prototype,_),S&&I(P,S),P}var T=function(){function P(S){var O=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 O.timeupdate()},this.hls=S,this.config=S.config,this.registerListeners()}var _=P.prototype;return _.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},_.registerListeners=function(){this.hls.on(E.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(E.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(E.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(E.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(E.Events.ERROR,this.onError,this)},_.unregisterListeners=function(){this.hls.off(E.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(E.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(E.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(E.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(E.Events.ERROR,this.onError)},_.onMediaAttached=function(O,C){this.media=C.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},_.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},_.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},_.onLevelUpdated=function(O,C){var x=C.details;this.levelDetails=x,x.advanced&&this.timeupdate(),!x.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},_.onError=function(O,C){if(C.details!==N.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,R.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},_.timeupdate=function(){var O=this.media,C=this.levelDetails;if(!O||!C)return;this.currentTime=O.currentTime;var x=this.computeLatency();if(x===null)return;this._latency=x;var b=this.config,p=b.lowLatencyMode,n=b.maxLiveSyncPlaybackRate;if(!p||n===1)return;var l=this.targetLatency;if(l===null)return;var s=x-l,g=Math.min(this.maxLatency,l+C.targetduration),d=s<g;if(C.live&&d&&s>.05&&this.forwardBufferLength>1){var u=Math.min(2,Math.max(1,n)),m=Math.round(2/(1+Math.exp(-.75*s-this.edgeStalled))*20)/20;O.playbackRate=Math.min(u,Math.max(1,m))}else O.playbackRate!==1&&O.playbackRate!==0&&(O.playbackRate=1)},_.estimateLiveEdge=function(){var O=this.levelDetails;return O===null?null:O.edge+O.age},_.computeLatency=function(){var O=this.estimateLiveEdge();return O===null?null:O-this.currentTime},M(P,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var O=this.config,C=this.levelDetails;return O.liveMaxLatencyDuration!==void 0?O.liveMaxLatencyDuration:C?O.liveMaxLatencyDurationCount*C.targetduration:0}},{key:"targetLatency",get:function(){var O=this.levelDetails;if(O===null)return null;var C=O.holdBack,x=O.partHoldBack,b=O.targetduration,p=this.config,n=p.liveSyncDuration,l=p.liveSyncDurationCount,s=p.lowLatencyMode,g=this.hls.userConfig,d=s&&x||C;(g.liveSyncDuration||g.liveSyncDurationCount||d===0)&&(d=n!==void 0?n:l*b);var u=b,m=1;return d+Math.min(this.stallCount*m,u)}},{key:"liveSyncPosition",get:function(){var O=this.estimateLiveEdge(),C=this.targetLatency,x=this.levelDetails;if(O===null||C===null||x===null)return null;var b=x.edge,p=O-C-this.edgeStalled,n=b-x.totalduration,l=b-(this.config.lowLatencyMode&&x.partTarget||x.targetduration);return Math.min(Math.max(n,p),l)}},{key:"drift",get:function(){var O=this.levelDetails;return O===null?1:O.drift}},{key:"edgeStalled",get:function(){var O=this.levelDetails;if(O===null)return 0;var C=(this.config.lowLatencyMode&&O.partTarget||O.targetduration)*3;return Math.max(O.age-C,0)}},{key:"forwardBufferLength",get:function(){var O=this.media,C=this.levelDetails;if(!O||!C)return 0;var x=O.buffered.length;return x?O.buffered.end(x-1):C.edge-this.currentTime}}]),P}()},"./src/controller/level-controller.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"default",function(){return p});var N=w("./src/types/level.ts"),E=w("./src/events.ts"),R=w("./src/errors.ts"),I=w("./src/utils/codecs.ts"),M=w("./src/controller/level-helper.ts"),T=w("./src/controller/base-playlist-controller.ts"),P=w("./src/types/loader.ts");function _(){return _=Object.assign||function(n){for(var l=1;l<arguments.length;l++){var s=arguments[l];for(var g in s)Object.prototype.hasOwnProperty.call(s,g)&&(n[g]=s[g])}return n},_.apply(this,arguments)}function S(n,l){for(var s=0;s<l.length;s++){var g=l[s];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(n,g.key,g)}}function O(n,l,s){return l&&S(n.prototype,l),s&&S(n,s),n}function C(n,l){n.prototype=Object.create(l.prototype),n.prototype.constructor=n,x(n,l)}function x(n,l){return x=Object.setPrototypeOf||function(g,d){return g.__proto__=d,g},x(n,l)}var b=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),p=function(n){C(l,n);function l(g){var d;return d=n.call(this,g,"[level-controller]")||this,d._levels=[],d._firstLevel=-1,d._startLevel=void 0,d.currentLevelIndex=-1,d.manualLevelIndex=-1,d.onParsedComplete=void 0,d._registerListeners(),d}var s=l.prototype;return s._registerListeners=function(){var d=this.hls;d.on(E.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.on(E.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(E.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),d.on(E.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(E.Events.ERROR,this.onError,this)},s._unregisterListeners=function(){var d=this.hls;d.off(E.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(E.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(E.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),d.off(E.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(E.Events.ERROR,this.onError,this)},s.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,n.prototype.destroy.call(this)},s.startLoad=function(){var d=this._levels;d.forEach(function(u){u.loadError=0}),n.prototype.startLoad.call(this)},s.onManifestLoaded=function(d,u){var m=[],h=[],a=[],r,e={},i,v=!1,f=!1,y=!1;if(u.levels.forEach(function(F){var H=F.attrs;v=v||!!(F.width&&F.height),f=f||!!F.videoCodec,y=y||!!F.audioCodec,b&&F.audioCodec&&F.audioCodec.indexOf("mp4a.40.34")!==-1&&(F.audioCodec=void 0);var J=F.bitrate+"-"+F.attrs.RESOLUTION+"-"+F.attrs.CODECS;i=e[J],i?i.url.push(F.url):(i=new N.Level(F),e[J]=i,m.push(i)),H&&(H.AUDIO&&Object(M.addGroupId)(i,"audio",H.AUDIO),H.SUBTITLES&&Object(M.addGroupId)(i,"text",H.SUBTITLES))}),(v||f)&&y&&(m=m.filter(function(F){var H=F.videoCodec,J=F.width,B=F.height;return!!H||!!(J&&B)})),m=m.filter(function(F){var H=F.audioCodec,J=F.videoCodec;return(!H||Object(I.isCodecSupportedInMp4)(H,"audio"))&&(!J||Object(I.isCodecSupportedInMp4)(J,"video"))}),u.audioTracks&&(h=u.audioTracks.filter(function(F){return!F.audioCodec||Object(I.isCodecSupportedInMp4)(F.audioCodec,"audio")}),Object(M.assignTrackIdsByGroup)(h)),u.subtitles&&(a=u.subtitles,Object(M.assignTrackIdsByGroup)(a)),m.length>0){r=m[0].bitrate,m.sort(function(F,H){return F.bitrate-H.bitrate}),this._levels=m;for(var t=0;t<m.length;t++)if(m[t].bitrate===r){this._firstLevel=t,this.log("manifest loaded, "+m.length+" level(s) found, first bitrate: "+r);break}var A=y&&!f,U={levels:m,audioTracks:h,subtitleTracks:a,firstLevel:this._firstLevel,stats:u.stats,audio:y,video:f,altAudio:!A&&h.some(function(F){return!!F.url})};this.hls.trigger(E.Events.MANIFEST_PARSED,U),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(E.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:u.url,reason:"no level with compatible codecs found in manifest"})},s.onError=function(d,u){if(n.prototype.onError.call(this,d,u),u.fatal)return;var m=u.context,h=this._levels[this.currentLevelIndex];if(m&&(m.type===P.PlaylistContextType.AUDIO_TRACK&&h.audioGroupIds&&m.groupId===h.audioGroupIds[h.urlId]||m.type===P.PlaylistContextType.SUBTITLE_TRACK&&h.textGroupIds&&m.groupId===h.textGroupIds[h.urlId])){this.redundantFailover(this.currentLevelIndex);return}var a=!1,r=!0,e;switch(u.details){case R.ErrorDetails.FRAG_LOAD_ERROR:case R.ErrorDetails.FRAG_LOAD_TIMEOUT:case R.ErrorDetails.KEY_LOAD_ERROR:case R.ErrorDetails.KEY_LOAD_TIMEOUT:if(u.frag){var i=this._levels[u.frag.level];i?(i.fragmentError++,i.fragmentError>this.hls.config.fragLoadingMaxRetry&&(e=u.frag.level)):e=u.frag.level}break;case R.ErrorDetails.LEVEL_LOAD_ERROR:case R.ErrorDetails.LEVEL_LOAD_TIMEOUT:m&&(m.deliveryDirectives&&(r=!1),e=m.level),a=!0;break;case R.ErrorDetails.REMUX_ALLOC_ERROR:e=u.level,a=!0;break}e!==void 0&&this.recoverLevel(u,e,a,r)},s.recoverLevel=function(d,u,m,h){var a=d.details,r=this._levels[u];if(r.loadError++,m){var e=this.retryLoadingOrFail(d);if(e)d.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(h){var i=r.url.length;if(i>1&&r.loadError<i)d.levelRetry=!0,this.redundantFailover(u);else if(this.manualLevelIndex===-1){var v=u===0?this._levels.length-1:u-1;this.currentLevelIndex!==v&&this._levels[v].loadError===0&&(this.warn(a+": switch to "+v),d.levelRetry=!0,this.hls.nextAutoLevel=v)}}},s.redundantFailover=function(d){var u=this._levels[d],m=u.url.length;if(m>1){var h=(u.urlId+1)%m;this.warn("Switching to redundant URL-id "+h),this._levels.forEach(function(a){a.urlId=h}),this.level=d}},s.onFragLoaded=function(d,u){var m=u.frag;if(m!==void 0&&m.type===P.PlaylistLevelType.MAIN){var h=this._levels[m.level];h!==void 0&&(h.fragmentError=0,h.loadError=0)}},s.onLevelLoaded=function(d,u){var m,h=u.level,a=u.details,r=this._levels[h];if(!r){var e;this.warn("Invalid level index "+h),(e=u.deliveryDirectives)!==null&&e!==void 0&&e.skip&&(a.deltaUpdateFailed=!0);return}h===this.currentLevelIndex?(r.fragmentError===0&&(r.loadError=0,this.retryCount=0),this.playlistLoaded(h,u,r.details)):(m=u.deliveryDirectives)!==null&&m!==void 0&&m.skip&&(a.deltaUpdateFailed=!0)},s.onAudioTrackSwitched=function(d,u){var m=this.hls.levels[this.currentLevelIndex];if(!m)return;if(m.audioGroupIds){for(var h=-1,a=this.hls.audioTracks[u.id].groupId,r=0;r<m.audioGroupIds.length;r++)if(m.audioGroupIds[r]===a){h=r;break}h!==m.urlId&&(m.urlId=h,this.startLoad())}},s.loadPlaylist=function(d){var u=this.currentLevelIndex,m=this._levels[u];if(this.canLoad&&m&&m.url.length>0){var h=m.urlId,a=m.url[h];if(d)try{a=d.addDirectives(a)}catch(r){this.warn("Could not construct new URL with HLS Delivery Directives: "+r)}this.log("Attempt loading level index "+u+(d?" at sn "+d.msn+" part "+d.part:"")+" with URL-id "+h+" "+a),this.clearTimer(),this.hls.trigger(E.Events.LEVEL_LOADING,{url:a,level:u,id:h,deliveryDirectives:d||null})}},s.removeLevel=function(d,u){var m=function(r,e){return e!==u},h=this._levels.filter(function(a,r){return r!==d?!0:a.url.length>1&&u!==void 0?(a.url=a.url.filter(m),a.audioGroupIds&&(a.audioGroupIds=a.audioGroupIds.filter(m)),a.textGroupIds&&(a.textGroupIds=a.textGroupIds.filter(m)),a.urlId=0,!0):!1}).map(function(a,r){var e=a.details;return e!=null&&e.fragments&&e.fragments.forEach(function(i){i.level=r}),a});this._levels=h,this.hls.trigger(E.Events.LEVELS_UPDATED,{levels:h})},O(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(d){var u,m=this._levels;if(m.length===0)return;if(this.currentLevelIndex===d&&(u=m[d])!==null&&u!==void 0&&u.details)return;if(d<0||d>=m.length){var h=d<0;if(this.hls.trigger(E.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.LEVEL_SWITCH_ERROR,level:d,fatal:h,reason:"invalid level idx"}),h)return;d=Math.min(d,m.length-1)}this.clearTimer();var a=this.currentLevelIndex,r=m[a],e=m[d];this.log("switching to level "+d+" from "+a),this.currentLevelIndex=d;var i=_({},e,{level:d,maxBitrate:e.maxBitrate,uri:e.uri,urlId:e.urlId});delete i._urlId,this.hls.trigger(E.Events.LEVEL_SWITCHING,i);var v=e.details;if(!v||v.live){var f=this.switchParams(e.uri,r==null?void 0:r.details);this.loadPlaylist(f)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(d){this.manualLevelIndex=d,this._startLevel===void 0&&(this._startLevel=d),d!==-1&&(this.level=d)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(d){this._firstLevel=d}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var d=this.hls.config.startLevel;return d!==void 0?d:this._firstLevel}else return this._startLevel},set:function(d){this._startLevel=d}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(d){this.level=d,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=d)}}]),l}(T.default)},"./src/controller/level-helper.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"addGroupId",function(){return R}),w.d(j,"assignTrackIdsByGroup",function(){return I}),w.d(j,"updatePTS",function(){return M}),w.d(j,"updateFragPTSDTS",function(){return P}),w.d(j,"mergeDetails",function(){return _}),w.d(j,"mapPartIntersection",function(){return S}),w.d(j,"mapFragmentIntersection",function(){return O}),w.d(j,"adjustSliding",function(){return C}),w.d(j,"addSliding",function(){return x}),w.d(j,"computeReloadInterval",function(){return b}),w.d(j,"getFragmentWithSN",function(){return p}),w.d(j,"getPartWith",function(){return n});var N=w("./src/polyfills/number.ts"),E=w("./src/utils/logger.ts");function R(l,s,g){switch(s){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(g);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(g);break}}function I(l){var s={};l.forEach(function(g){var d=g.groupId||"";g.id=s[d]=s[d]||0,s[d]++})}function M(l,s,g){var d=l[s],u=l[g];T(d,u)}function T(l,s){var g=s.startPTS;if(Object(N.isFiniteNumber)(g)){var d=0,u;s.sn>l.sn?(d=g-l.start,u=l):(d=l.start-g,u=s),u.duration!==d&&(u.duration=d)}else if(s.sn>l.sn){var m=l.cc===s.cc;m&&l.minEndPTS?s.start=l.start+(l.minEndPTS-l.start):s.start=l.start+l.duration}else s.start=Math.max(l.start-s.duration,0)}function P(l,s,g,d,u,m){var h=d-g;h<=0&&(E.logger.warn("Fragment should have a positive duration",s),d=g+s.duration,m=u+s.duration);var a=g,r=d,e=s.startPTS,i=s.endPTS;if(Object(N.isFiniteNumber)(e)){var v=Math.abs(e-g);Object(N.isFiniteNumber)(s.deltaPTS)?s.deltaPTS=Math.max(v,s.deltaPTS):s.deltaPTS=v,a=Math.max(g,e),g=Math.min(g,e),u=Math.min(u,s.startDTS),r=Math.min(d,i),d=Math.max(d,i),m=Math.max(m,s.endDTS)}s.duration=d-g;var f=g-s.start;s.appendedPTS=d,s.start=s.startPTS=g,s.maxStartPTS=a,s.startDTS=u,s.endPTS=d,s.minEndPTS=r,s.endDTS=m;var y=s.sn;if(!l||y<l.startSN||y>l.endSN)return 0;var t,A=y-l.startSN,U=l.fragments;for(U[A]=s,t=A;t>0;t--)T(U[t],U[t-1]);for(t=A;t<U.length-1;t++)T(U[t],U[t+1]);return l.fragmentHint&&T(U[U.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,f}function _(l,s){for(var g=null,d=l.fragments,u=d.length-1;u>=0;u--){var m=d[u].initSegment;if(m){g=m;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var h=0,a;if(O(l,s,function(t,A){t.relurl&&(h=t.cc-A.cc),Object(N.isFiniteNumber)(t.startPTS)&&Object(N.isFiniteNumber)(t.endPTS)&&(A.start=A.startPTS=t.startPTS,A.startDTS=t.startDTS,A.appendedPTS=t.appendedPTS,A.maxStartPTS=t.maxStartPTS,A.endPTS=t.endPTS,A.endDTS=t.endDTS,A.minEndPTS=t.minEndPTS,A.duration=t.endPTS-t.startPTS,A.duration&&(a=A),s.PTSKnown=s.alignedSliding=!0),A.elementaryStreams=t.elementaryStreams,A.loader=t.loader,A.stats=t.stats,A.urlId=t.urlId,t.initSegment&&(A.initSegment=t.initSegment,g=t.initSegment)}),g){var r=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;r.forEach(function(t){var A;(!t.initSegment||t.initSegment.relurl===((A=g)===null||A===void 0?void 0:A.relurl))&&(t.initSegment=g)})}if(s.skippedSegments&&(s.deltaUpdateFailed=s.fragments.some(function(t){return!t}),s.deltaUpdateFailed)){E.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var e=s.skippedSegments;e--;)s.fragments.shift();s.startSN=s.fragments[0].sn,s.startCC=s.fragments[0].cc}var i=s.fragments;if(h){E.logger.warn("discontinuity sliding from playlist, take drift into account");for(var v=0;v<i.length;v++)i[v].cc+=h}s.skippedSegments&&(s.startCC=s.fragments[0].cc),S(l.partList,s.partList,function(t,A){A.elementaryStreams=t.elementaryStreams,A.stats=t.stats}),a?P(s,a,a.startPTS,a.endPTS,a.startDTS,a.endDTS):C(l,s),i.length&&(s.totalduration=s.edge-i[0].start),s.driftStartTime=l.driftStartTime,s.driftStart=l.driftStart;var f=s.advancedDateTime;if(s.advanced&&f){var y=s.edge;s.driftStart||(s.driftStartTime=f,s.driftStart=y),s.driftEndTime=f,s.driftEnd=y}else s.driftEndTime=l.driftEndTime,s.driftEnd=l.driftEnd,s.advancedDateTime=l.advancedDateTime}function S(l,s,g){if(l&&s)for(var d=0,u=0,m=l.length;u<=m;u++){var h=l[u],a=s[u+d];h&&a&&h.index===a.index&&h.fragment.sn===a.fragment.sn?g(h,a):d--}}function O(l,s,g){for(var d=s.skippedSegments,u=Math.max(l.startSN,s.startSN)-s.startSN,m=(l.fragmentHint?1:0)+(d?s.endSN:Math.min(l.endSN,s.endSN))-s.startSN,h=s.startSN-l.startSN,a=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,r=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,e=u;e<=m;e++){var i=r[h+e],v=a[e];d&&!v&&e<d&&(v=s.fragments[e]=i),i&&v&&g(i,v)}}function C(l,s){var g=s.startSN+s.skippedSegments-l.startSN,d=l.fragments;if(g<0||g>=d.length)return;x(s,d[g].start)}function x(l,s){if(s){for(var g=l.fragments,d=l.skippedSegments;d<g.length;d++)g[d].start+=s;l.fragmentHint&&(l.fragmentHint.start+=s)}}function b(l,s){var g=1e3*l.levelTargetDuration,d=g/2,u=l.age,m=u>0&&u<g*3,h=s.loading.end-s.loading.start,a,r=l.availabilityDelay;if(l.updated===!1)if(m){var e=333*l.misses;a=Math.max(Math.min(d,h*2),e),l.availabilityDelay=(l.availabilityDelay||0)+a}else a=d;else m?(r=Math.min(r||g/2,u),l.availabilityDelay=r,a=r+g-u):a=g-h;return Math.round(a)}function p(l,s,g){if(!l||!l.details)return null;var d=l.details,u=d.fragments[s-d.startSN];return u||(u=d.fragmentHint,u&&u.sn===s?u:s<d.startSN&&g&&g.sn===s?g:null)}function n(l,s,g){if(!l||!l.details)return null;var d=l.details.partList;if(d)for(var u=d.length;u--;){var m=d[u];if(m.index===g&&m.fragment.sn===s)return m}return null}},"./src/controller/stream-controller.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"default",function(){return d});var N=w("./src/polyfills/number.ts"),E=w("./src/controller/base-stream-controller.ts"),R=w("./src/is-supported.ts"),I=w("./src/events.ts"),M=w("./src/utils/buffer-helper.ts"),T=w("./src/controller/fragment-tracker.ts"),P=w("./src/types/loader.ts"),_=w("./src/loader/fragment.ts"),S=w("./src/demux/transmuxer-interface.ts"),O=w("./src/types/transmuxer.ts"),C=w("./src/controller/gap-controller.ts"),x=w("./src/errors.ts"),b=w("./src/utils/logger.ts");function p(u,m){for(var h=0;h<m.length;h++){var a=m[h];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(u,a.key,a)}}function n(u,m,h){return m&&p(u.prototype,m),h&&p(u,h),u}function l(u,m){u.prototype=Object.create(m.prototype),u.prototype.constructor=u,s(u,m)}function s(u,m){return s=Object.setPrototypeOf||function(a,r){return a.__proto__=r,a},s(u,m)}var g=100,d=function(u){l(m,u);function m(a,r){var e;return e=u.call(this,a,r,"[stream-controller]")||this,e.audioCodecSwap=!1,e.gapController=null,e.level=-1,e._forceStartLoad=!1,e.altAudio=!1,e.audioOnly=!1,e.fragPlaying=null,e.onvplaying=null,e.onvseeked=null,e.fragLastKbps=0,e.stalled=!1,e.couldBacktrack=!1,e.audioCodecSwitch=!1,e.videoBuffer=null,e._registerListeners(),e}var h=m.prototype;return h._registerListeners=function(){var r=this.hls;r.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),r.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.on(I.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),r.on(I.Events.ERROR,this.onError,this),r.on(I.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),r.on(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),r.on(I.Events.BUFFER_CREATED,this.onBufferCreated,this),r.on(I.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),r.on(I.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),r.on(I.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h._unregisterListeners=function(){var r=this.hls;r.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.off(I.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),r.off(I.Events.ERROR,this.onError,this),r.off(I.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),r.off(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),r.off(I.Events.BUFFER_CREATED,this.onBufferCreated,this),r.off(I.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),r.off(I.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),r.off(I.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},h.startLoad=function(r){if(this.levels){var e=this.lastCurrentTime,i=this.hls;if(this.stopLoad(),this.setInterval(g),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var v=i.startLevel;v===-1&&(i.config.testBandwidth?(v=0,this.bitrateTest=!0):v=i.nextAutoLevel),this.level=i.nextLoadLevel=v,this.loadedmetadata=!1}e>0&&r===-1&&(this.log("Override startPosition with lastCurrentTime @"+e.toFixed(3)),r=e),this.state=E.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=r,this.tick()}else this._forceStartLoad=!0,this.state=E.State.STOPPED},h.stopLoad=function(){this._forceStartLoad=!1,u.prototype.stopLoad.call(this)},h.doTick=function(){switch(this.state){case E.State.IDLE:this.doTickIdle();break;case E.State.WAITING_LEVEL:{var r,e=this.levels,i=this.level,v=e==null||((r=e[i])===null||r===void 0)?void 0:r.details;if(v&&(!v.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(v))break;this.state=E.State.IDLE;break}break}case E.State.FRAG_LOADING_WAITING_RETRY:{var f,y=self.performance.now(),t=this.retryDate;(!t||y>=t||(f=this.media)!==null&&f!==void 0&&f.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=E.State.IDLE)}break;default:break}this.onTickEnd()},h.onTickEnd=function(){u.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},h.doTickIdle=function(){var r,e,i=this.hls,v=this.levelLastLoaded,f=this.levels,y=this.media,t=i.config,A=i.nextLoadLevel;if(v===null||!y&&(this.startFragRequested||!t.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!f||!f[A])return;var U=f[A];this.level=i.nextLoadLevel=A;var F=U.details;if(!F||this.state===E.State.WAITING_LEVEL||F.live&&this.levelLastLoaded!==A){this.state=E.State.WAITING_LEVEL;return}var H=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:y,P.PlaylistLevelType.MAIN);if(H===null)return;var J=H.len,B=this.getMaxBufferLength(U.maxBitrate);if(J>=B)return;if(this._streamEnded(H,F)){var Z={};this.altAudio&&(Z.type="video"),this.hls.trigger(I.Events.BUFFER_EOS,Z),this.state=E.State.ENDED;return}var re=H.end,ie=this.getNextFragment(re,F);if(this.couldBacktrack&&!this.fragPrevious&&ie&&ie.sn!=="initSegment"){var ve=ie.sn-F.startSN;ve>1&&(ie=F.fragments[ve-1],this.fragmentTracker.removeFragment(ie))}if(ie&&this.fragmentTracker.getState(ie)===T.FragmentState.OK&&this.nextLoadPosition>re){var de=this.audioOnly&&!this.altAudio?_.ElementaryStreamTypes.AUDIO:_.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(y,de,P.PlaylistLevelType.MAIN),ie=this.getNextFragment(this.nextLoadPosition,F)}if(!ie)return;ie.initSegment&&!ie.initSegment.data&&!this.bitrateTest&&(ie=ie.initSegment),((r=ie.decryptdata)===null||r===void 0?void 0:r.keyFormat)==="identity"&&!((e=ie.decryptdata)!==null&&e!==void 0&&e.key)?this.loadKey(ie,F):this.loadFragment(ie,F,re)},h.loadFragment=function(r,e,i){var v,f=this.fragmentTracker.getState(r);if(this.fragCurrent=r,f===T.FragmentState.BACKTRACKED){var y=this.fragmentTracker.getBacktrackData(r);if(y){this._handleFragmentLoadProgress(y),this._handleFragmentLoadComplete(y);return}else f=T.FragmentState.NOT_LOADED}f===T.FragmentState.NOT_LOADED||f===T.FragmentState.PARTIAL?r.sn==="initSegment"?this._loadInitSegment(r):this.bitrateTest?(r.bitrateTest=!0,this.log("Fragment "+r.sn+" of level "+r.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(r)):(this.startFragRequested=!0,u.prototype.loadFragment.call(this,r,e,i)):f===T.FragmentState.APPENDING?this.reduceMaxBufferLength(r.duration)&&this.fragmentTracker.removeFragment(r):((v=this.media)===null||v===void 0?void 0:v.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},h.getAppendedFrag=function(r){var e=this.fragmentTracker.getAppendedFrag(r,P.PlaylistLevelType.MAIN);return e&&"fragment"in e?e.fragment:e},h.getBufferedFrag=function(r){return this.fragmentTracker.getBufferedFrag(r,P.PlaylistLevelType.MAIN)},h.followingBufferedFrag=function(r){return r?this.getBufferedFrag(r.end+.5):null},h.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},h.nextLevelSwitch=function(){var r=this.levels,e=this.media;if(e!=null&&e.readyState){var i,v=this.getAppendedFrag(e.currentTime);if(v&&v.start>1&&this.flushMainBuffer(0,v.start-1),!e.paused&&r){var f=this.hls.nextLoadLevel,y=r[f],t=this.fragLastKbps;t&&this.fragCurrent?i=this.fragCurrent.duration*y.maxBitrate/(1e3*t)+1:i=0}else i=0;var A=this.getBufferedFrag(e.currentTime+i);if(A){var U=this.followingBufferedFrag(A);if(U){this.abortCurrentFrag();var F=U.maxStartPTS?U.maxStartPTS:U.start,H=U.duration,J=Math.max(A.end,F+Math.min(Math.max(H-this.config.maxFragLookUpTolerance,H*.5),H*.75));this.flushMainBuffer(J,Number.POSITIVE_INFINITY)}}}},h.abortCurrentFrag=function(){var r=this.fragCurrent;this.fragCurrent=null,r!=null&&r.loader&&r.loader.abort(),this.state===E.State.KEY_LOADING&&(this.state=E.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},h.flushMainBuffer=function(r,e){u.prototype.flushMainBuffer.call(this,r,e,this.altAudio?"video":null)},h.onMediaAttached=function(r,e){u.prototype.onMediaAttached.call(this,r,e);var i=e.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new C.default(this.config,i,this.fragmentTracker,this.hls)},h.onMediaDetaching=function(){var r=this.media;r&&(r.removeEventListener("playing",this.onvplaying),r.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),u.prototype.onMediaDetaching.call(this)},h.onMediaPlaying=function(){this.tick()},h.onMediaSeeked=function(){var r=this.media,e=r?r.currentTime:null;Object(N.isFiniteNumber)(e)&&this.log("Media seeked to "+e.toFixed(3)),this.tick()},h.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(I.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},h.onManifestParsed=function(r,e){var i=!1,v=!1,f;e.levels.forEach(function(y){f=y.audioCodec,f&&(f.indexOf("mp4a.40.2")!==-1&&(i=!0),f.indexOf("mp4a.40.5")!==-1&&(v=!0))}),this.audioCodecSwitch=i&&v&&!Object(R.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},h.onLevelLoading=function(r,e){var i=this.levels;if(!i||this.state!==E.State.IDLE)return;var v=i[e.level];(!v.details||v.details.live&&this.levelLastLoaded!==e.level||this.waitForCdnTuneIn(v.details))&&(this.state=E.State.WAITING_LEVEL)},h.onLevelLoaded=function(r,e){var i,v=this.levels,f=e.level,y=e.details,t=y.totalduration;if(!v){this.warn("Levels were reset while loading level "+f);return}this.log("Level "+f+" loaded ["+y.startSN+","+y.endSN+"], cc ["+y.startCC+", "+y.endCC+"] duration:"+t);var A=this.fragCurrent;A&&(this.state===E.State.FRAG_LOADING||this.state===E.State.FRAG_LOADING_WAITING_RETRY)&&(A.level!==e.level&&A.loader&&(this.state=E.State.IDLE,A.loader.abort()));var U=v[f],F=0;if(y.live||(i=U.details)!==null&&i!==void 0&&i.live){if(y.fragments[0]||(y.deltaUpdateFailed=!0),y.deltaUpdateFailed)return;F=this.alignPlaylists(y,U.details)}if(U.details=y,this.levelLastLoaded=f,this.hls.trigger(I.Events.LEVEL_UPDATED,{details:y,level:f}),this.state===E.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(y))return;this.state=E.State.IDLE}this.startFragRequested?y.live&&this.synchronizeToLiveEdge(y):this.setStartPosition(y,F),this.tick()},h._handleFragmentLoadProgress=function(r){var e,i=r.frag,v=r.part,f=r.payload,y=this.levels;if(!y){this.warn("Levels were reset while fragment load was in progress. Fragment "+i.sn+" of level "+i.level+" will not be buffered");return}var t=y[i.level],A=t.details;if(!A){this.warn("Dropping fragment "+i.sn+" of level "+i.level+" after level details were reset");return}var U=t.videoCodec,F=A.PTSKnown||!A.live,H=(e=i.initSegment)===null||e===void 0?void 0:e.data,J=this._getAudioCodec(t),B=this.transmuxer=this.transmuxer||new S.default(this.hls,P.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Z=v?v.index:-1,re=Z!==-1,ie=new O.ChunkMetadata(i.level,i.sn,i.stats.chunkCount,f.byteLength,Z,re),ve=this.initPTS[i.cc];B.push(f,H,J,U,i,v,A.totalduration,F,ie,ve)},h.onAudioTrackSwitching=function(r,e){var i=this.altAudio,v=!!e.url,f=e.id;if(!v){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var y=this.fragCurrent;y!=null&&y.loader&&(this.log("Switching to main audio track, cancel main fragment load"),y.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var t=this.hls;i&&t.trigger(I.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),t.trigger(I.Events.AUDIO_TRACK_SWITCHED,{id:f})}},h.onAudioTrackSwitched=function(r,e){var i=e.id,v=!!this.hls.audioTracks[i].url;if(v){var f=this.videoBuffer;f&&this.mediaBuffer!==f&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=f)}this.altAudio=v,this.tick()},h.onBufferCreated=function(r,e){var i=e.tracks,v,f,y=!1;for(var t in i){var A=i[t];if(A.id==="main"){if(f=t,v=A,t==="video"){var U=i[t];U&&(this.videoBuffer=U.buffer)}}else y=!0}y&&v?(this.log("Alternate track found, use "+f+".buffered to schedule main fragment loading"),this.mediaBuffer=v.buffer):this.mediaBuffer=this.media},h.onFragBuffered=function(r,e){var i=e.frag,v=e.part;if(i&&i.type!==P.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(i)){this.warn("Fragment "+i.sn+(v?" p: "+v.index:"")+" of level "+i.level+" finished buffering, but was aborted. state: "+this.state),this.state===E.State.PARSED&&(this.state=E.State.IDLE);return}var f=v?v.stats:i.stats;this.fragLastKbps=Math.round(8*f.total/(f.buffering.end-f.loading.first)),i.sn!=="initSegment"&&(this.fragPrevious=i),this.fragBufferedComplete(i,v)},h.onError=function(r,e){switch(e.details){case x.ErrorDetails.FRAG_LOAD_ERROR:case x.ErrorDetails.FRAG_LOAD_TIMEOUT:case x.ErrorDetails.KEY_LOAD_ERROR:case x.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(P.PlaylistLevelType.MAIN,e);break;case x.ErrorDetails.LEVEL_LOAD_ERROR:case x.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==E.State.ERROR&&(e.fatal?(this.warn(""+e.details),this.state=E.State.ERROR):!e.levelRetry&&this.state===E.State.WAITING_LEVEL&&(this.state=E.State.IDLE));break;case x.ErrorDetails.BUFFER_FULL_ERROR:if(e.parent==="main"&&(this.state===E.State.PARSING||this.state===E.State.PARSED)){var i=!0,v=this.getFwdBufferInfo(this.media,P.PlaylistLevelType.MAIN);v&&v.len>.5&&(i=!this.reduceMaxBufferLength(v.len)),i&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},h.checkBuffer=function(){var r=this.media,e=this.gapController;if(!r||!e||!r.readyState)return;var i=M.BufferHelper.getBuffered(r);!this.loadedmetadata&&i.length?(this.loadedmetadata=!0,this.seekToStartPos()):e.poll(this.lastCurrentTime),this.lastCurrentTime=r.currentTime},h.onFragLoadEmergencyAborted=function(){this.state=E.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},h.onBufferFlushed=function(r,e){var i=e.type;if(i!==_.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var v=(i===_.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(v,i,P.PlaylistLevelType.MAIN)}},h.onLevelsUpdated=function(r,e){this.levels=e.levels},h.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},h.seekToStartPos=function(){var r=this.media,e=r.currentTime,i=this.startPosition;if(i>=0&&e<i){if(r.seeking){b.logger.log("could not seek to "+i+", already seeking at "+e);return}var v=M.BufferHelper.getBuffered(r),f=v.length?v.start(0):0,y=f-i;y>0&&(y<this.config.maxBufferHole||y<this.config.maxFragLookUpTolerance)&&(b.logger.log("adjusting start position by "+y+" to match buffer start"),i+=y,this.startPosition=i),this.log("seek to target start position "+i+" from current time "+e),r.currentTime=i}},h._getAudioCodec=function(r){var e=this.config.defaultAudioCodec||r.audioCodec;return this.audioCodecSwap&&e&&(this.log("Swapping audio codec"),e.indexOf("mp4a.40.5")!==-1?e="mp4a.40.2":e="mp4a.40.5"),e},h._loadBitrateTestFrag=function(r){var e=this;this._doFragLoad(r).then(function(i){var v=e.hls;if(!i||v.nextLoadLevel||e.fragContextChanged(r))return;e.fragLoadError=0,e.state=E.State.IDLE,e.startFragRequested=!1,e.bitrateTest=!1;var f=r.stats;f.parsing.start=f.parsing.end=f.buffering.start=f.buffering.end=self.performance.now(),v.trigger(I.Events.FRAG_LOADED,i)})},h._handleTransmuxComplete=function(r){var e,i="main",v=this.hls,f=r.remuxResult,y=r.chunkMeta,t=this.getCurrentContext(y);if(!t){this.warn("The loading context changed while buffering fragment "+y.sn+" of level "+y.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(y.level);return}var A=t.frag,U=t.part,F=t.level,H=f.video,J=f.text,B=f.id3,Z=f.initSegment,re=this.altAudio?void 0:f.audio;if(this.fragContextChanged(A))return;if(this.state=E.State.PARSING,Z){Z.tracks&&(this._bufferInitSegment(F,Z.tracks,A,y),v.trigger(I.Events.FRAG_PARSING_INIT_SEGMENT,{frag:A,id:i,tracks:Z.tracks}));var ie=Z.initPTS,ve=Z.timescale;Object(N.isFiniteNumber)(ie)&&(this.initPTS[A.cc]=ie,v.trigger(I.Events.INIT_PTS_FOUND,{frag:A,id:i,initPTS:ie,timescale:ve}))}if(H&&f.independent!==!1){if(F.details){var de=H.startPTS,q=H.endPTS,ee=H.startDTS,pe=H.endDTS;if(U)U.elementaryStreams[H.type]={startPTS:de,endPTS:q,startDTS:ee,endDTS:pe};else if(H.firstKeyFrame&&H.independent&&(this.couldBacktrack=!0),H.dropped&&H.independent){var Q=this.getLoadPosition()+this.config.maxBufferHole;if(Q<de){this.backtrack(A);return}A.setElementaryStreamInfo(H.type,A.start,q,A.start,pe,!0)}A.setElementaryStreamInfo(H.type,de,q,ee,pe),this.bufferFragmentData(H,A,U,y)}}else if(f.independent===!1){this.backtrack(A);return}if(re){var V=re.startPTS,Ce=re.endPTS,ke=re.startDTS,Ue=re.endDTS;U&&(U.elementaryStreams[_.ElementaryStreamTypes.AUDIO]={startPTS:V,endPTS:Ce,startDTS:ke,endDTS:Ue}),A.setElementaryStreamInfo(_.ElementaryStreamTypes.AUDIO,V,Ce,ke,Ue),this.bufferFragmentData(re,A,U,y)}if(B!=null&&(e=B.samples)!==null&&e!==void 0&&e.length){var we={frag:A,id:i,samples:B.samples};v.trigger(I.Events.FRAG_PARSING_METADATA,we)}if(J){var De={frag:A,id:i,samples:J.samples};v.trigger(I.Events.FRAG_PARSING_USERDATA,De)}},h._bufferInitSegment=function(r,e,i,v){var f=this;if(this.state!==E.State.PARSING)return;this.audioOnly=!!e.audio&&!e.video,this.altAudio&&!this.audioOnly&&delete e.audio;var y=e.audio,t=e.video,A=e.audiovideo;if(y){var U=r.audioCodec,F=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(U&&(U.indexOf("mp4a.40.5")!==-1?U="mp4a.40.2":U="mp4a.40.5"),y.metadata.channelCount!==1&&F.indexOf("firefox")===-1&&(U="mp4a.40.5")),F.indexOf("android")!==-1&&y.container!=="audio/mpeg"&&(U="mp4a.40.2",this.log("Android: force audio codec to "+U)),r.audioCodec&&r.audioCodec!==U&&this.log('Swapping manifest audio codec "'+r.audioCodec+'" for "'+U+'"'),y.levelCodec=U,y.id="main",this.log("Init audio buffer, container:"+y.container+", codecs[selected/level/parsed]=["+(U||"")+"/"+(r.audioCodec||"")+"/"+y.codec+"]")}t&&(t.levelCodec=r.videoCodec,t.id="main",this.log("Init video buffer, container:"+t.container+", codecs[level/parsed]=["+(r.videoCodec||"")+"/"+t.codec+"]")),A&&this.log("Init audiovideo buffer, container:"+A.container+", codecs[level/parsed]=["+(r.attrs.CODECS||"")+"/"+A.codec+"]"),this.hls.trigger(I.Events.BUFFER_CODECS,e),Object.keys(e).forEach(function(H){var J=e[H],B=J.initSegment;B!=null&&B.byteLength&&f.hls.trigger(I.Events.BUFFER_APPENDING,{type:H,data:B,frag:i,part:null,chunkMeta:v,parent:i.type})}),this.tick()},h.backtrack=function(r){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(r);var e=this.fragmentTracker.backtrack(r);this.fragPrevious=null,this.nextLoadPosition=r.start,e?this.resetFragmentLoading(r):this.state=E.State.BACKTRACKING},h.checkFragmentChanged=function(){var r=this.media,e=null;if(r&&r.readyState>1&&r.seeking===!1){var i=r.currentTime;if(M.BufferHelper.isBuffered(r,i)?e=this.getAppendedFrag(i):M.BufferHelper.isBuffered(r,i+.1)&&(e=this.getAppendedFrag(i+.1)),e){var v=this.fragPlaying,f=e.level;(!v||e.sn!==v.sn||v.level!==f||e.urlId!==v.urlId)&&(this.hls.trigger(I.Events.FRAG_CHANGED,{frag:e}),(!v||v.level!==f)&&this.hls.trigger(I.Events.LEVEL_SWITCHED,{level:f}),this.fragPlaying=e)}}},n(m,[{key:"nextLevel",get:function(){var r=this.nextBufferedFrag;return r?r.level:-1}},{key:"currentLevel",get:function(){var r=this.media;if(r){var e=this.getAppendedFrag(r.currentTime);if(e)return e.level}return-1}},{key:"nextBufferedFrag",get:function(){var r=this.media;if(r){var e=this.getAppendedFrag(r.currentTime);return this.followingBufferedFrag(e)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),m}(E.default)},"./src/controller/subtitle-stream-controller.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"SubtitleStreamController",function(){return l});var N=w("./src/events.ts"),E=w("./src/utils/logger.ts"),R=w("./src/utils/buffer-helper.ts"),I=w("./src/controller/fragment-finders.ts"),M=w("./src/utils/discontinuities.ts"),T=w("./src/controller/level-helper.ts"),P=w("./src/controller/fragment-tracker.ts"),_=w("./src/controller/base-stream-controller.ts"),S=w("./src/types/loader.ts"),O=w("./src/types/level.ts");function C(s,g){for(var d=0;d<g.length;d++){var u=g[d];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(s,u.key,u)}}function x(s,g,d){return g&&C(s.prototype,g),d&&C(s,d),s}function b(s,g){s.prototype=Object.create(g.prototype),s.prototype.constructor=s,p(s,g)}function p(s,g){return p=Object.setPrototypeOf||function(u,m){return u.__proto__=m,u},p(s,g)}var n=500,l=function(s){b(g,s);function g(u,m){var h;return h=s.call(this,u,m,"[subtitle-stream-controller]")||this,h.levels=[],h.currentTrackId=-1,h.tracksBuffered=[],h.mainDetails=null,h._registerListeners(),h}var d=g.prototype;return d.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},d._registerListeners=function(){var m=this.hls;m.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),m.on(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.on(N.Events.ERROR,this.onError,this),m.on(N.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),m.on(N.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),m.on(N.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),m.on(N.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),m.on(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},d._unregisterListeners=function(){var m=this.hls;m.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),m.off(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.off(N.Events.ERROR,this.onError,this),m.off(N.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),m.off(N.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),m.off(N.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),m.off(N.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),m.off(N.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},d.startLoad=function(){this.stopLoad(),this.state=_.State.IDLE,this.setInterval(n),this.tick()},d.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},d.onLevelLoaded=function(m,h){this.mainDetails=h.details},d.onSubtitleFragProcessed=function(m,h){var a=h.frag,r=h.success;if(this.fragPrevious=a,this.state=_.State.IDLE,!r)return;var e=this.tracksBuffered[this.currentTrackId];if(!e)return;for(var i,v=a.start,f=0;f<e.length;f++)if(v>=e[f].start&&v<=e[f].end){i=e[f];break}var y=a.start+a.duration;i?i.end=y:(i={start:v,end:y},e.push(i)),this.fragmentTracker.fragBuffered(a)},d.onBufferFlushing=function(m,h){var a=h.startOffset,r=h.endOffset;if(a===0&&r!==Number.POSITIVE_INFINITY){var e=this.currentTrackId,i=this.levels;if(!i.length||!i[e]||!i[e].details)return;var v=i[e].details,f=v.targetduration,y=r-f;if(y<=0)return;h.endOffsetSubtitles=Math.max(0,y),this.tracksBuffered.forEach(function(t){for(var A=0;A<t.length;){if(t[A].end<=y){t.shift();continue}else if(t[A].start<y)t[A].start=y;else break;A++}}),this.fragmentTracker.removeFragmentsInRange(a,y,S.PlaylistLevelType.SUBTITLE)}},d.onError=function(m,h){var a,r=h.frag;if(!r||r.type!==S.PlaylistLevelType.SUBTITLE)return;(a=this.fragCurrent)!==null&&a!==void 0&&a.loader&&this.fragCurrent.loader.abort(),this.state=_.State.IDLE},d.onSubtitleTracksUpdated=function(m,h){var a=this,r=h.subtitleTracks;this.tracksBuffered=[],this.levels=r.map(function(e){return new O.Level(e)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(e){a.tracksBuffered[e.id]=[]}),this.mediaBuffer=null},d.onSubtitleTrackSwitch=function(m,h){if(this.currentTrackId=h.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var a=this.levels[this.currentTrackId];a!=null&&a.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,a&&this.setInterval(n)},d.onSubtitleTrackLoaded=function(m,h){var a,r=h.details,e=h.id,i=this.currentTrackId,v=this.levels;if(!v.length)return;var f=v[i];if(e>=v.length||e!==i||!f)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,r.live||(a=f.details)!==null&&a!==void 0&&a.live){var y=this.mainDetails;if(r.deltaUpdateFailed||!y)return;var t=y.fragments[0];if(!f.details)r.hasProgramDateTime&&y.hasProgramDateTime?Object(M.alignMediaPlaylistByPDT)(r,y):t&&Object(T.addSliding)(r,t.start);else{var A=this.alignPlaylists(r,f.details);A===0&&t&&Object(T.addSliding)(r,t.start)}}if(f.details=r,this.levelLastLoaded=e,this.tick(),r.live&&!this.fragCurrent&&this.media&&this.state===_.State.IDLE){var U=Object(I.findFragmentByPTS)(null,r.fragments,this.media.currentTime,0);U||(this.warn("Subtitle playlist not aligned with playback"),f.details=void 0)}},d._handleFragmentLoadComplete=function(m){var h=m.frag,a=m.payload,r=h.decryptdata,e=this.hls;if(this.fragContextChanged(h))return;if(a&&a.byteLength>0&&r&&r.key&&r.iv&&r.method==="AES-128"){var i=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(a),r.key.buffer,r.iv.buffer).then(function(v){var f=performance.now();e.trigger(N.Events.FRAG_DECRYPTED,{frag:h,payload:v,stats:{tstart:i,tdecrypt:f}})})}},d.doTick=function(){if(!this.media){this.state=_.State.IDLE;return}if(this.state===_.State.IDLE){var m,h=this.currentTrackId,a=this.levels;if(!a.length||!a[h]||!a[h].details)return;var r=a[h].details,e=r.targetduration,i=this.config,v=this.media,f=R.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,v.currentTime-e,i.maxBufferHole),y=f.end,t=f.len,A=this.getMaxBufferLength()+e;if(t>A)return;console.assert(r,"Subtitle track details are defined on idle subtitle stream controller tick");var U=r.fragments,F=U.length,H=r.edge,J,B=this.fragPrevious;if(y<H){var Z=i.maxFragLookUpTolerance;B&&r.hasProgramDateTime&&(J=Object(I.findFragmentByPDT)(U,B.endProgramDateTime,Z)),J||(J=Object(I.findFragmentByPTS)(B,U,y,Z),!J&&B&&B.start<U[0].start&&(J=U[0]))}else J=U[F-1];(m=J)!==null&&m!==void 0&&m.encrypted?(E.logger.log("Loading key for "+J.sn),this.state=_.State.KEY_LOADING,this.hls.trigger(N.Events.KEY_LOADING,{frag:J})):J&&this.fragmentTracker.getState(J)===P.FragmentState.NOT_LOADED&&this.loadFragment(J,r,y)}},d.loadFragment=function(m,h,a){this.fragCurrent=m,s.prototype.loadFragment.call(this,m,h,a)},x(g,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),g}(_.default)},"./src/controller/subtitle-track-controller.ts":function(Ee,j,w){"use strict";w.r(j);var N=w("./src/events.ts"),E=w("./src/utils/texttrack-utils.ts"),R=w("./src/controller/base-playlist-controller.ts"),I=w("./src/types/loader.ts");function M(C,x){for(var b=0;b<x.length;b++){var p=x[b];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(C,p.key,p)}}function T(C,x,b){return x&&M(C.prototype,x),b&&M(C,b),C}function P(C,x){C.prototype=Object.create(x.prototype),C.prototype.constructor=C,_(C,x)}function _(C,x){return _=Object.setPrototypeOf||function(p,n){return p.__proto__=n,p},_(C,x)}var S=function(C){P(x,C);function x(p){var n;return n=C.call(this,p,"[subtitle-track-controller]")||this,n.media=null,n.tracks=[],n.groupId=null,n.tracksInGroup=[],n.trackId=-1,n.selectDefaultTrack=!0,n.queuedDefaultTrack=-1,n.trackChangeListener=function(){return n.onTextTracksChanged()},n.asyncPollTrackChange=function(){return n.pollTrackChange(0)},n.useTextTrackPolling=!1,n.subtitlePollingInterval=-1,n.subtitleDisplay=!0,n.registerListeners(),n}var b=x.prototype;return b.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,C.prototype.destroy.call(this)},b.registerListeners=function(){var n=this.hls;n.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.on(N.Events.LEVEL_LOADING,this.onLevelLoading,this),n.on(N.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),n.on(N.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),n.on(N.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var n=this.hls;n.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),n.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.off(N.Events.LEVEL_LOADING,this.onLevelLoading,this),n.off(N.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),n.off(N.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),n.off(N.Events.ERROR,this.onError,this)},b.onMediaAttached=function(n,l){if(this.media=l.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},b.pollTrackChange=function(n){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,n)},b.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var n=O(this.media.textTracks);n.forEach(function(l){Object(E.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},b.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},b.onManifestParsed=function(n,l){this.tracks=l.subtitleTracks},b.onSubtitleTrackLoaded=function(n,l){var s=l.id,g=l.details,d=this.trackId,u=this.tracksInGroup[d];if(!u){this.warn("Invalid subtitle track id "+s);return}var m=u.details;u.details=l.details,this.log("subtitle track "+s+" loaded ["+g.startSN+"-"+g.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,l,m))},b.onLevelLoading=function(n,l){this.switchLevel(l.level)},b.onLevelSwitching=function(n,l){this.switchLevel(l.level)},b.switchLevel=function(n){var l=this.hls.levels[n];if(!(l!=null&&l.textGroupIds))return;var s=l.textGroupIds[l.urlId];if(this.groupId!==s){var g=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,d=this.tracks.filter(function(h){return!s||h.groupId===s});this.tracksInGroup=d;var u=this.findTrackId(g==null?void 0:g.name)||this.findTrackId();this.groupId=s;var m={subtitleTracks:d};this.log("Updating subtitle tracks, "+d.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(N.Events.SUBTITLE_TRACKS_UPDATED,m),u!==-1&&this.setSubtitleTrack(u,g)}},b.findTrackId=function(n){for(var l=this.tracksInGroup,s=0;s<l.length;s++){var g=l[s];if((!this.selectDefaultTrack||g.default)&&(!n||n===g.name))return g.id}return-1},b.onError=function(n,l){if(C.prototype.onError.call(this,n,l),l.fatal||!l.context)return;l.context.type===I.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},b.loadPlaylist=function(n){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var s=l.id,g=l.groupId,d=l.url;if(n)try{d=n.addDirectives(d)}catch(u){this.warn("Could not construct new URL with HLS Delivery Directives: "+u)}this.log("Loading subtitle playlist for id "+s),this.hls.trigger(N.Events.SUBTITLE_TRACK_LOADING,{url:d,id:s,groupId:g,deliveryDirectives:n||null})}},b.toggleTrackModes=function(n){var l=this,s=this.media,g=this.subtitleDisplay,d=this.trackId;if(!s)return;var u=O(s.textTracks),m=u.filter(function(r){return r.groupId===l.groupId});if(n===-1)[].slice.call(u).forEach(function(r){r.mode="disabled"});else{var h=m[d];h&&(h.mode="disabled")}var a=m[n];a&&(a.mode=g?"showing":"hidden")},b.setSubtitleTrack=function(n,l){var s,g=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=n;return}if(this.trackId!==n&&this.toggleTrackModes(n),this.trackId===n&&(n===-1||(s=g[n])!==null&&s!==void 0&&s.details)||n<-1||n>=g.length)return;this.clearTimer();var d=g[n];if(this.log("Switching to subtitle track "+n),this.trackId=n,d){var u=d.id,m=d.groupId,h=m===void 0?"":m,a=d.name,r=d.type,e=d.url;this.hls.trigger(N.Events.SUBTITLE_TRACK_SWITCH,{id:u,groupId:h,name:a,type:r,url:e});var i=this.switchParams(d.url,l==null?void 0:l.details);this.loadPlaylist(i)}else this.hls.trigger(N.Events.SUBTITLE_TRACK_SWITCH,{id:n})},b.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var n=-1,l=O(this.media.textTracks),s=0;s<l.length;s++)if(l[s].mode==="hidden")n=s;else if(l[s].mode==="showing"){n=s;break}this.subtitleTrack!==n&&(this.subtitleTrack=n)},T(x,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(n){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(n,l)}}]),x}(R.default);function O(C){for(var x=[],b=0;b<C.length;b++){var p=C[b];p.kind==="subtitles"&&p.label&&x.push(C[b])}return x}j.default=S},"./src/controller/timeline-controller.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"TimelineController",function(){return O});var N=w("./src/polyfills/number.ts"),E=w("./src/events.ts"),R=w("./src/utils/cea-608-parser.ts"),I=w("./src/utils/output-filter.ts"),M=w("./src/utils/webvtt-parser.ts"),T=w("./src/utils/texttrack-utils.ts"),P=w("./src/utils/imsc1-ttml-parser.ts"),_=w("./src/types/loader.ts"),S=w("./src/utils/logger.ts"),O=function(){function p(l){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=b(),this.captionsProperties=void 0,this.hls=l,this.config=l.config,this.Cues=l.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var s=new I.default(this,"textTrack1"),g=new I.default(this,"textTrack2"),d=new I.default(this,"textTrack3"),u=new I.default(this,"textTrack4");this.cea608Parser1=new R.default(1,s,g),this.cea608Parser2=new R.default(3,d,u)}l.on(E.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(E.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(E.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(E.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(E.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(E.Events.FRAG_LOADING,this.onFragLoading,this),l.on(E.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(E.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(E.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(E.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(E.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(E.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var n=p.prototype;return n.destroy=function(){var s=this.hls;s.off(E.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(E.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(E.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(E.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.off(E.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.off(E.Events.FRAG_LOADING,this.onFragLoading,this),s.off(E.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(E.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.off(E.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.off(E.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(E.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.off(E.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},n.addCues=function(s,g,d,u,m){for(var h=!1,a=m.length;a--;){var r=m[a],e=x(r[0],r[1],g,d);if(e>=0&&(r[0]=Math.min(r[0],g),r[1]=Math.max(r[1],d),h=!0,e/(d-g)>.5))return}if(h||m.push([g,d]),this.config.renderTextTracksNatively){var i=this.captionsTracks[s];this.Cues.newCue(i,g,d,u)}else{var v=this.Cues.newCue(null,g,d,u);this.hls.trigger(E.Events.CUES_PARSED,{type:"captions",cues:v,track:s})}},n.onInitPtsFound=function(s,g){var d=this,u=g.frag,m=g.id,h=g.initPTS,a=g.timescale,r=this.unparsedVttFrags;m==="main"&&(this.initPTS[u.cc]=h,this.timescale[u.cc]=a),r.length&&(this.unparsedVttFrags=[],r.forEach(function(e){d.onFragLoaded(E.Events.FRAG_LOADED,e)}))},n.getExistingTrack=function(s){var g=this.media;if(g)for(var d=0;d<g.textTracks.length;d++){var u=g.textTracks[d];if(u[s])return u}return null},n.createCaptionsTrack=function(s){this.config.renderTextTracksNatively?this.createNativeTrack(s):this.createNonNativeTrack(s)},n.createNativeTrack=function(s){if(this.captionsTracks[s])return;var g=this.captionsProperties,d=this.captionsTracks,u=this.media,m=g[s],h=m.label,a=m.languageCode,r=this.getExistingTrack(s);if(r)d[s]=r,Object(T.clearCurrentCues)(d[s]),Object(T.sendAddTrackEvent)(d[s],u);else{var e=this.createTextTrack("captions",h,a);e&&(e[s]=!0,d[s]=e)}},n.createNonNativeTrack=function(s){if(this.nonNativeCaptionsTracks[s])return;var g=this.captionsProperties[s];if(!g)return;var d=g.label,u={_id:s,label:d,kind:"captions",default:g.media?!!g.media.default:!1,closedCaptions:g.media};this.nonNativeCaptionsTracks[s]=u,this.hls.trigger(E.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[u]})},n.createTextTrack=function(s,g,d){var u=this.media;return u?u.addTextTrack(s,g,d):void 0},n.onMediaAttaching=function(s,g){this.media=g.media,this._cleanTracks()},n.onMediaDetaching=function(){var s=this.captionsTracks;Object.keys(s).forEach(function(g){Object(T.clearCurrentCues)(s[g]),delete s[g]}),this.nonNativeCaptionsTracks={}},n.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=b(),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())},n._cleanTracks=function(){var s=this.media;if(!s)return;var g=s.textTracks;if(g)for(var d=0;d<g.length;d++)Object(T.clearCurrentCues)(g[d])},n.onSubtitleTracksUpdated=function(s,g){var d=this;this.textTracks=[];var u=g.subtitleTracks||[],m=u.some(function(e){return e.textCodec===P.IMSC1_CODEC});if(this.config.enableWebVTT||m&&this.config.enableIMSC1){var h=this.tracks&&u&&this.tracks.length===u.length;if(this.tracks=u||[],this.config.renderTextTracksNatively){var a=this.media?this.media.textTracks:[];this.tracks.forEach(function(e,i){var v;if(i<a.length){for(var f=null,y=0;y<a.length;y++)if(C(a[y],e)){f=a[y];break}f&&(v=f)}v?Object(T.clearCurrentCues)(v):(v=d.createTextTrack("subtitles",e.name,e.lang),v&&(v.mode="disabled")),v&&(v.groupId=e.groupId,d.textTracks.push(v))})}else if(!h&&this.tracks&&this.tracks.length){var r=this.tracks.map(function(e){return{label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}});this.hls.trigger(E.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:r})}}},n.onManifestLoaded=function(s,g){var d=this;this.config.enableCEA708Captions&&g.captions&&g.captions.forEach(function(u){var m=/(?:CC|SERVICE)([1-4])/.exec(u.instreamId);if(!m)return;var h="textTrack"+m[1],a=d.captionsProperties[h];if(!a)return;a.label=u.name,u.lang&&(a.languageCode=u.lang),a.media=u})},n.onFragLoading=function(s,g){var d=this.cea608Parser1,u=this.cea608Parser2,m=this.lastSn,h=this.lastPartIndex;if(!this.enabled||!(d&&u))return;if(g.frag.type===_.PlaylistLevelType.MAIN){var a,r,e=g.frag.sn,i=(a=g==null||((r=g.part)===null||r===void 0)?void 0:r.index)!=null?a:-1;e===m+1||e===m&&i===h+1||(d.reset(),u.reset()),this.lastSn=e,this.lastPartIndex=i}},n.onFragLoaded=function(s,g){var d=g.frag,u=g.payload,m=this.initPTS,h=this.unparsedVttFrags;if(d.type===_.PlaylistLevelType.SUBTITLE)if(u.byteLength){if(!Object(N.isFiniteNumber)(m[d.cc])){h.push(g),m.length&&this.hls.trigger(E.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:new Error("Missing initial subtitle PTS")});return}var a=d.decryptdata;if(a==null||a.key==null||a.method!=="AES-128"){var r=this.tracks[d.level],e=this.vttCCs;e[d.cc]||(e[d.cc]={start:d.start,prevCC:this.prevCC,new:!0},this.prevCC=d.cc),r&&r.textCodec===P.IMSC1_CODEC?this._parseIMSC1(d,u):this._parseVTTs(d,u,e)}}else this.hls.trigger(E.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:new Error("Empty subtitle payload")})},n._parseIMSC1=function(s,g){var d=this,u=this.hls;Object(P.parseIMSC1)(g,this.initPTS[s.cc],this.timescale[s.cc],function(m){d._appendCues(m,s.level),u.trigger(E.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(m){S.logger.log("Failed to parse IMSC1: "+m),u.trigger(E.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:m})})},n._parseVTTs=function(s,g,d){var u=this,m=this.hls;Object(M.parseWebVTT)(g,this.initPTS[s.cc],this.timescale[s.cc],d,s.cc,s.start,function(h){u._appendCues(h,s.level),m.trigger(E.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(h){u._fallbackToIMSC1(s,g),S.logger.log("Failed to parse VTT cue: "+h),m.trigger(E.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:h})})},n._fallbackToIMSC1=function(s,g){var d=this,u=this.tracks[s.level];u.textCodec||Object(P.parseIMSC1)(g,this.initPTS[s.cc],this.timescale[s.cc],function(){u.textCodec=P.IMSC1_CODEC,d._parseIMSC1(s,g)},function(){u.textCodec="wvtt"})},n._appendCues=function(s,g){var d=this.hls;if(this.config.renderTextTracksNatively){var u=this.textTracks[g];if(u.mode==="disabled")return;s.forEach(function(a){return Object(T.addCueToTrack)(u,a)})}else{var m=this.tracks[g],h=m.default?"default":"subtitles"+g;d.trigger(E.Events.CUES_PARSED,{type:"subtitles",cues:s,track:h})}},n.onFragDecrypted=function(s,g){var d=g.frag;if(d.type===_.PlaylistLevelType.SUBTITLE){if(!Object(N.isFiniteNumber)(this.initPTS[d.cc])){this.unparsedVttFrags.push(g);return}this.onFragLoaded(E.Events.FRAG_LOADED,g)}},n.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},n.onFragParsingUserdata=function(s,g){var d=this.cea608Parser1,u=this.cea608Parser2;if(!this.enabled||!(d&&u))return;for(var m=0;m<g.samples.length;m++){var h=g.samples[m].bytes;if(h){var a=this.extractCea608Data(h);d.addData(g.samples[m].pts,a[0]),u.addData(g.samples[m].pts,a[1])}}},n.onBufferFlushing=function(s,g){var d=g.startOffset,u=g.endOffset,m=g.endOffsetSubtitles,h=g.type,a=this.media;if(!a||a.currentTime<u)return;if(!h||h==="video"){var r=this.captionsTracks;Object.keys(r).forEach(function(i){return Object(T.removeCuesInRange)(r[i],d,u)})}if(this.config.renderTextTracksNatively&&(d===0&&m!==void 0)){var e=this.textTracks;Object.keys(e).forEach(function(i){return Object(T.removeCuesInRange)(e[i],d,m)})}},n.extractCea608Data=function(s){for(var g=s[0]&31,d=2,u=[[],[]],m=0;m<g;m++){var h=s[d++],a=127&s[d++],r=127&s[d++],e=(4&h)!==0,i=3&h;if(a===0&&r===0)continue;e&&((i===0||i===1)&&(u[i].push(a),u[i].push(r)))}return u},p}();function C(p,n){return p&&p.label===n.name&&!(p.textTrack1||p.textTrack2)}function x(p,n,l,s){return Math.min(n,s)-Math.max(p,l)}function b(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"default",function(){return N});var N=function(){function E(I,M){this.subtle=void 0,this.aesIV=void 0,this.subtle=I,this.aesIV=M}var R=E.prototype;return R.decrypt=function(M,T){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},T,M)},E}()},"./src/crypt/aes-decryptor.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"removePadding",function(){return E}),w.d(j,"default",function(){return R});var N=w("./src/utils/typed-array.ts");function E(I){var M=I.byteLength,T=M&&new DataView(I.buffer).getUint8(M-1);return T?Object(N.sliceUint8)(I,0,M-T):I}var R=function(){function I(){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 M=I.prototype;return M.uint8ArrayToUint32Array_=function(P){for(var _=new DataView(P),S=new Uint32Array(4),O=0;O<4;O++)S[O]=_.getUint32(O*4);return S},M.initTable=function(){var P=this.sBox,_=this.invSBox,S=this.subMix,O=S[0],C=S[1],x=S[2],b=S[3],p=this.invSubMix,n=p[0],l=p[1],s=p[2],g=p[3],d=new Uint32Array(256),u=0,m=0,h=0;for(h=0;h<256;h++)h<128?d[h]=h<<1:d[h]=h<<1^283;for(h=0;h<256;h++){var a=m^m<<1^m<<2^m<<3^m<<4;a=a>>>8^a&255^99,P[u]=a,_[a]=u;var r=d[u],e=d[r],i=d[e],v=d[a]*257^a*16843008;O[u]=v<<24|v>>>8,C[u]=v<<16|v>>>16,x[u]=v<<8|v>>>24,b[u]=v,v=i*16843009^e*65537^r*257^u*16843008,n[a]=v<<24|v>>>8,l[a]=v<<16|v>>>16,s[a]=v<<8|v>>>24,g[a]=v,u?(u=r^d[d[d[i^r]]],m^=d[d[m]]):u=m=1}},M.expandKey=function(P){for(var _=this.uint8ArrayToUint32Array_(P),S=!0,O=0;O<_.length&&S;)S=_[O]===this.key[O],O++;if(S)return;this.key=_;var C=this.keySize=_.length;if(C!==4&&C!==6&&C!==8)throw new Error("Invalid aes key size="+C);var x=this.ksRows=(C+6+1)*4,b,p,n=this.keySchedule=new Uint32Array(x),l=this.invKeySchedule=new Uint32Array(x),s=this.sBox,g=this.rcon,d=this.invSubMix,u=d[0],m=d[1],h=d[2],a=d[3],r,e;for(b=0;b<x;b++){if(b<C){r=n[b]=_[b];continue}e=r,b%C===0?(e=e<<8|e>>>24,e=s[e>>>24]<<24|s[e>>>16&255]<<16|s[e>>>8&255]<<8|s[e&255],e^=g[b/C|0]<<24):C>6&&b%C===4&&(e=s[e>>>24]<<24|s[e>>>16&255]<<16|s[e>>>8&255]<<8|s[e&255]),n[b]=r=(n[b-C]^e)>>>0}for(p=0;p<x;p++)b=x-p,p&3?e=n[b]:e=n[b-4],p<4||b<=4?l[p]=e:l[p]=u[s[e>>>24]]^m[s[e>>>16&255]]^h[s[e>>>8&255]]^a[s[e&255]],l[p]=l[p]>>>0},M.networkToHostOrderSwap=function(P){return P<<24|(P&65280)<<8|(P&16711680)>>8|P>>>24},M.decrypt=function(P,_,S){for(var O=this.keySize+6,C=this.invKeySchedule,x=this.invSBox,b=this.invSubMix,p=b[0],n=b[1],l=b[2],s=b[3],g=this.uint8ArrayToUint32Array_(S),d=g[0],u=g[1],m=g[2],h=g[3],a=new Int32Array(P),r=new Int32Array(a.length),e,i,v,f,y,t,A,U,F,H,J,B,Z,re,ie=this.networkToHostOrderSwap;_<a.length;){for(F=ie(a[_]),H=ie(a[_+1]),J=ie(a[_+2]),B=ie(a[_+3]),y=F^C[0],t=B^C[1],A=J^C[2],U=H^C[3],Z=4,re=1;re<O;re++)e=p[y>>>24]^n[t>>16&255]^l[A>>8&255]^s[U&255]^C[Z],i=p[t>>>24]^n[A>>16&255]^l[U>>8&255]^s[y&255]^C[Z+1],v=p[A>>>24]^n[U>>16&255]^l[y>>8&255]^s[t&255]^C[Z+2],f=p[U>>>24]^n[y>>16&255]^l[t>>8&255]^s[A&255]^C[Z+3],y=e,t=i,A=v,U=f,Z=Z+4;e=x[y>>>24]<<24^x[t>>16&255]<<16^x[A>>8&255]<<8^x[U&255]^C[Z],i=x[t>>>24]<<24^x[A>>16&255]<<16^x[U>>8&255]<<8^x[y&255]^C[Z+1],v=x[A>>>24]<<24^x[U>>16&255]<<16^x[y>>8&255]<<8^x[t&255]^C[Z+2],f=x[U>>>24]<<24^x[y>>16&255]<<16^x[t>>8&255]<<8^x[A&255]^C[Z+3],r[_]=ie(e^d),r[_+1]=ie(f^u),r[_+2]=ie(v^m),r[_+3]=ie(i^h),d=F,u=H,m=J,h=B,_=_+4}return r.buffer},I}()},"./src/crypt/decrypter.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"default",function(){return _});var N=w("./src/crypt/aes-crypto.ts"),E=w("./src/crypt/fast-aes-key.ts"),R=w("./src/crypt/aes-decryptor.ts"),I=w("./src/utils/logger.ts"),M=w("./src/utils/mp4-tools.ts"),T=w("./src/utils/typed-array.ts"),P=16,_=function(){function S(C,x,b){var p=b===void 0?{}:b,n=p.removePKCS7Padding,l=n===void 0?!0:n;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=C,this.config=x,this.removePKCS7Padding=l,l)try{var s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch(g){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var O=S.prototype;return O.destroy=function(){this.observer=null},O.isSync=function(){return this.config.enableSoftwareAES},O.flush=function(){var x=this.currentResult;if(!x){this.reset();return}var b=new Uint8Array(x);return this.reset(),this.removePKCS7Padding?Object(R.removePadding)(b):b},O.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},O.decrypt=function(x,b,p,n){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(x),b,p);var l=this.flush();l&&n(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(x),b,p).then(n)},O.softwareDecrypt=function(x,b,p){var n=this.currentIV,l=this.currentResult,s=this.remainderData;this.logOnce("JS AES decrypt"),s&&(x=Object(M.appendUint8Array)(s,x),this.remainderData=null);var g=this.getValidChunk(x);if(!g.length)return null;n&&(p=n);var d=this.softwareDecrypter;d||(d=this.softwareDecrypter=new R.default),d.expandKey(b);var u=l;return this.currentResult=d.decrypt(g.buffer,0,p),this.currentIV=Object(T.sliceUint8)(g,-16).buffer,u||null},O.webCryptoDecrypt=function(x,b,p){var n=this,l=this.subtle;return(this.key!==b||!this.fastAesKey)&&(this.key=b,this.fastAesKey=new E.default(l,b)),this.fastAesKey.expandKey().then(function(s){if(!l)return Promise.reject(new Error("web crypto not initialized"));var g=new N.default(l,p);return g.decrypt(x.buffer,s)}).catch(function(s){return n.onWebCryptoError(s,x,b,p)})},O.onWebCryptoError=function(x,b,p,n){return I.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",x),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(b,p,n)},O.getValidChunk=function(x){var b=x,p=x.length-x.length%P;return p!==x.length&&(b=Object(T.sliceUint8)(x,0,p),this.remainderData=Object(T.sliceUint8)(x,p)),b},O.logOnce=function(x){if(!this.logEnabled)return;I.logger.log("[decrypter.ts]: "+x),this.logEnabled=!1},S}()},"./src/crypt/fast-aes-key.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"default",function(){return N});var N=function(){function E(I,M){this.subtle=void 0,this.key=void 0,this.subtle=I,this.key=M}var R=E.prototype;return R.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},E}()},"./src/demux/aacdemuxer.ts":function(Ee,j,w){"use strict";w.r(j);var N=w("./src/demux/base-audio-demuxer.ts"),E=w("./src/demux/adts.ts"),R=w("./src/utils/logger.ts"),I=w("./src/demux/id3.ts");function M(_,S){_.prototype=Object.create(S.prototype),_.prototype.constructor=_,T(_,S)}function T(_,S){return T=Object.setPrototypeOf||function(C,x){return C.__proto__=x,C},T(_,S)}var P=function(_){M(S,_);function S(C,x){var b;return b=_.call(this)||this,b.observer=void 0,b.config=void 0,b.observer=C,b.config=x,b}var O=S.prototype;return O.resetInitSegment=function(x,b,p){_.prototype.resetInitSegment.call(this,x,b,p),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:x,duration:p,inputTimeScale:9e4,dropped:0}},S.probe=function(x){if(!x)return!1;for(var b=I.getID3Data(x,0)||[],p=b.length,n=x.length;p<n;p++)if(E.probe(x,p))return R.logger.log("ADTS sync word found !"),!0;return!1},O.canParse=function(x,b){return E.canParse(x,b)},O.appendFrame=function(x,b,p){E.initTrackConfig(x,this.observer,b,p,x.manifestCodec);var n=E.appendFrame(x,b,p,this.initPTS,this.frameIndex);if(n&&n.missing===0)return n},S}(N.default);P.minProbeByteLength=9,j.default=P},"./src/demux/adts.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"getAudioConfig",function(){return I}),w.d(j,"isHeaderPattern",function(){return M}),w.d(j,"getHeaderLength",function(){return T}),w.d(j,"getFullFrameLength",function(){return P}),w.d(j,"canGetFrameLength",function(){return _}),w.d(j,"isHeader",function(){return S}),w.d(j,"canParse",function(){return O}),w.d(j,"probe",function(){return C}),w.d(j,"initTrackConfig",function(){return x}),w.d(j,"getFrameDuration",function(){return b}),w.d(j,"parseFrameHeader",function(){return p}),w.d(j,"appendFrame",function(){return n});var N=w("./src/utils/logger.ts"),E=w("./src/errors.ts"),R=w("./src/events.ts");function I(l,s,g,d){var u,m,h,a,r=navigator.userAgent.toLowerCase(),e=d,i=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];u=((s[g+2]&192)>>>6)+1;var v=(s[g+2]&60)>>>2;if(v>i.length-1){l.trigger(R.Events.ERROR,{type:E.ErrorTypes.MEDIA_ERROR,details:E.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+v});return}return h=(s[g+2]&1)<<2,h|=(s[g+3]&192)>>>6,N.logger.log("manifest codec:"+d+", ADTS type:"+u+", samplingIndex:"+v),/firefox/i.test(r)?v>=6?(u=5,a=new Array(4),m=v-3):(u=2,a=new Array(2),m=v):r.indexOf("android")!==-1?(u=2,a=new Array(2),m=v):(u=5,a=new Array(4),d&&(d.indexOf("mp4a.40.29")!==-1||d.indexOf("mp4a.40.5")!==-1)||!d&&v>=6?m=v-3:((d&&d.indexOf("mp4a.40.2")!==-1&&(v>=6&&h===1||/vivaldi/i.test(r))||!d&&h===1)&&(u=2,a=new Array(2)),m=v)),a[0]=u<<3,a[0]|=(v&14)>>1,a[1]|=(v&1)<<7,a[1]|=h<<3,u===5&&(a[1]|=(m&14)>>1,a[2]=(m&1)<<7,a[2]|=2<<2,a[3]=0),{config:a,samplerate:i[v],channelCount:h,codec:"mp4a.40."+u,manifestCodec:e}}function M(l,s){return l[s]===255&&(l[s+1]&246)===240}function T(l,s){return l[s+1]&1?7:9}function P(l,s){return(l[s+3]&3)<<11|l[s+4]<<3|(l[s+5]&224)>>>5}function _(l,s){return s+5<l.length}function S(l,s){return s+1<l.length&&M(l,s)}function O(l,s){return _(l,s)&&M(l,s)&&P(l,s)<=l.length-s}function C(l,s){if(S(l,s)){var g=T(l,s);if(s+g>=l.length)return!1;var d=P(l,s);if(d<=g)return!1;var u=s+d;return u===l.length||S(l,u)}return!1}function x(l,s,g,d,u){if(!l.samplerate){var m=I(s,g,d,u);if(!m)return;l.config=m.config,l.samplerate=m.samplerate,l.channelCount=m.channelCount,l.codec=m.codec,l.manifestCodec=m.manifestCodec,N.logger.log("parsed codec:"+l.codec+", rate:"+m.samplerate+", channels:"+m.channelCount)}}function b(l){return 1024*9e4/l}function p(l,s,g,d,u){var m=T(l,s),h=P(l,s);if(h-=m,h>0){var a=g+d*u;return{headerLength:m,frameLength:h,stamp:a}}}function n(l,s,g,d,u){var m=b(l.samplerate),h=p(s,g,d,u,m);if(h){var a=h.frameLength,r=h.headerLength,e=h.stamp,i=r+a,v=Math.max(0,g+i-s.length),f;v?(f=new Uint8Array(i-r),f.set(s.subarray(g+r,s.length),0)):f=s.subarray(g+r,g+i);var y={unit:f,pts:e};return v||l.samples.push(y),{sample:y,length:i,missing:v}}}},"./src/demux/base-audio-demuxer.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"initPTSFn",function(){return P});var N=w("./src/polyfills/number.ts"),E=w("./src/demux/id3.ts"),R=w("./src/demux/dummy-demuxed-track.ts"),I=w("./src/utils/mp4-tools.ts"),M=w("./src/utils/typed-array.ts"),T=function(){function _(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var S=_.prototype;return S.resetInitSegment=function(C,x,b){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},S.resetTimeStamp=function(){},S.resetContiguity=function(){},S.canParse=function(C,x){return!1},S.appendFrame=function(C,x,b){},S.demux=function(C,x){this.cachedData&&(C=Object(I.appendUint8Array)(this.cachedData,C),this.cachedData=null);var b=E.getID3Data(C,0),p=b?b.length:0,n,l,s=this._audioTrack,g=this._id3Track,d=b?E.getTimeStamp(b):void 0,u=C.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=P(d,x)),b&&b.length>0&&g.samples.push({pts:this.initPTS,dts:this.initPTS,data:b}),l=this.initPTS;p<u;){if(this.canParse(C,p)){var m=this.appendFrame(s,C,p);m?(this.frameIndex++,l=m.sample.pts,p+=m.length,n=p):p=u}else E.canParse(C,p)?(b=E.getID3Data(C,p),g.samples.push({pts:l,dts:l,data:b}),p+=b.length,n=p):p++;if(p===u&&n!==u){var h=Object(M.sliceUint8)(C,n);this.cachedData?this.cachedData=Object(I.appendUint8Array)(this.cachedData,h):this.cachedData=h}}return{audioTrack:s,avcTrack:Object(R.dummyTrack)(),id3Track:g,textTrack:Object(R.dummyTrack)()}},S.demuxSampleAes=function(C,x,b){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},S.flush=function(C){var x=this.cachedData;return x&&(this.cachedData=null,this.demux(x,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(R.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(R.dummyTrack)()}},S.destroy=function(){},_}(),P=function(S,O){return Object(N.isFiniteNumber)(S)?S*90:O*9e4};j.default=T},"./src/demux/chunk-cache.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"default",function(){return N});var N=function(){function R(){this.chunks=[],this.dataLength=0}var I=R.prototype;return I.push=function(T){this.chunks.push(T),this.dataLength+=T.length},I.flush=function(){var T=this.chunks,P=this.dataLength,_;if(T.length)T.length===1?_=T[0]:_=E(T,P);else return new Uint8Array(0);return this.reset(),_},I.reset=function(){this.chunks.length=0,this.dataLength=0},R}();function E(R,I){for(var M=new Uint8Array(I),T=0,P=0;P<R.length;P++){var _=R[P];M.set(_,T),T+=_.length}return M}},"./src/demux/dummy-demuxed-track.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"dummyTrack",function(){return N});function N(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(Ee,j,w){"use strict";w.r(j);var N=w("./src/utils/logger.ts"),E=function(){function R(M){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=M,this.bytesAvailable=M.byteLength,this.word=0,this.bitsAvailable=0}var I=R.prototype;return I.loadWord=function(){var T=this.data,P=this.bytesAvailable,_=T.byteLength-P,S=new Uint8Array(4),O=Math.min(4,P);if(O===0)throw new Error("no bytes available");S.set(T.subarray(_,_+O)),this.word=new DataView(S.buffer).getUint32(0),this.bitsAvailable=O*8,this.bytesAvailable-=O},I.skipBits=function(T){var P;this.bitsAvailable>T?(this.word<<=T,this.bitsAvailable-=T):(T-=this.bitsAvailable,P=T>>3,T-=P>>3,this.bytesAvailable-=P,this.loadWord(),this.word<<=T,this.bitsAvailable-=T)},I.readBits=function(T){var P=Math.min(this.bitsAvailable,T),_=this.word>>>32-P;return T>32&&N.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=P,this.bitsAvailable>0?this.word<<=P:this.bytesAvailable>0&&this.loadWord(),P=T-P,P>0&&this.bitsAvailable?_<<P|this.readBits(P):_},I.skipLZ=function(){var T;for(T=0;T<this.bitsAvailable;++T)if((this.word&2147483648>>>T)!==0)return this.word<<=T,this.bitsAvailable-=T,T;return this.loadWord(),T+this.skipLZ()},I.skipUEG=function(){this.skipBits(1+this.skipLZ())},I.skipEG=function(){this.skipBits(1+this.skipLZ())},I.readUEG=function(){var T=this.skipLZ();return this.readBits(T+1)-1},I.readEG=function(){var T=this.readUEG();return 1&T?1+T>>>1:-1*(T>>>1)},I.readBoolean=function(){return this.readBits(1)===1},I.readUByte=function(){return this.readBits(8)},I.readUShort=function(){return this.readBits(16)},I.readUInt=function(){return this.readBits(32)},I.skipScalingList=function(T){for(var P=8,_=8,S,O=0;O<T;O++)_!==0&&(S=this.readEG(),_=(P+S+256)%256),P=_===0?P:_},I.readSPS=function(){var T=0,P=0,_=0,S=0,O,C,x,b=this.readUByte.bind(this),p=this.readBits.bind(this),n=this.readUEG.bind(this),l=this.readBoolean.bind(this),s=this.skipBits.bind(this),g=this.skipEG.bind(this),d=this.skipUEG.bind(this),u=this.skipScalingList.bind(this);b();var m=b();if(p(5),s(3),b(),d(),m===100||m===110||m===122||m===244||m===44||m===83||m===86||m===118||m===128){var h=n();if(h===3&&s(1),d(),d(),s(1),l())for(C=h!==3?8:12,x=0;x<C;x++)l()&&(x<6?u(16):u(64))}d();var a=n();if(a===0)n();else if(a===1)for(s(1),g(),g(),O=n(),x=0;x<O;x++)g();d(),s(1);var r=n(),e=n(),i=p(1);i===0&&s(1),s(1),l()&&(T=n(),P=n(),_=n(),S=n());var v=[1,1];if(l()&&l()){var f=b();switch(f){case 1:v=[1,1];break;case 2:v=[12,11];break;case 3:v=[10,11];break;case 4:v=[16,11];break;case 5:v=[40,33];break;case 6:v=[24,11];break;case 7:v=[20,11];break;case 8:v=[32,11];break;case 9:v=[80,33];break;case 10:v=[18,11];break;case 11:v=[15,11];break;case 12:v=[64,33];break;case 13:v=[160,99];break;case 14:v=[4,3];break;case 15:v=[3,2];break;case 16:v=[2,1];break;case 255:{v=[b()<<8|b(),b()<<8|b()];break}}}return{width:Math.ceil((r+1)*16-T*2-P*2),height:(2-i)*(e+1)*16-(i?2:4)*(_+S),pixelRatio:v}},I.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},R}();j.default=E},"./src/demux/id3.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"isHeader",function(){return N}),w.d(j,"isFooter",function(){return E}),w.d(j,"getID3Data",function(){return R}),w.d(j,"canParse",function(){return M}),w.d(j,"getTimeStamp",function(){return T}),w.d(j,"isTimeStampFrame",function(){return P}),w.d(j,"getID3Frames",function(){return S}),w.d(j,"decodeFrame",function(){return O}),w.d(j,"utf8ArrayToStr",function(){return n}),w.d(j,"testables",function(){return l});var N=function(u,m){return m+10<=u.length&&(u[m]===73&&u[m+1]===68&&u[m+2]===51&&(u[m+3]<255&&u[m+4]<255&&(u[m+6]<128&&u[m+7]<128&&u[m+8]<128&&u[m+9]<128)))},E=function(u,m){return m+10<=u.length&&(u[m]===51&&u[m+1]===68&&u[m+2]===73&&(u[m+3]<255&&u[m+4]<255&&(u[m+6]<128&&u[m+7]<128&&u[m+8]<128&&u[m+9]<128)))},R=function(u,m){for(var h=m,a=0;N(u,m);){a+=10;var r=I(u,m+6);a+=r,E(u,m+10)&&(a+=10),m+=a}return a>0?u.subarray(h,h+a):void 0},I=function(u,m){var h=0;return h=(u[m]&127)<<21,h|=(u[m+1]&127)<<14,h|=(u[m+2]&127)<<7,h|=u[m+3]&127,h},M=function(u,m){return N(u,m)&&I(u,m+6)+10<=u.length-m},T=function(u){for(var m=S(u),h=0;h<m.length;h++){var a=m[h];if(P(a))return p(a)}return},P=function(u){return u&&u.key==="PRIV"&&u.info==="com.apple.streaming.transportStreamTimestamp"},_=function(u){var m=String.fromCharCode(u[0],u[1],u[2],u[3]),h=I(u,4),a=10;return{type:m,size:h,data:u.subarray(a,a+h)}},S=function(u){for(var m=0,h=[];N(u,m);){var a=I(u,m+6);m+=10;for(var r=m+a;m+8<r;){var e=_(u.subarray(m)),i=O(e);i&&h.push(i),m+=e.size+10}E(u,m)&&(m+=10)}return h},O=function(u){return u.type==="PRIV"?C(u):u.type[0]==="W"?b(u):x(u)},C=function(u){if(u.size<2)return;var m=n(u.data,!0),h=new Uint8Array(u.data.subarray(m.length+1));return{key:u.type,info:m,data:h.buffer}},x=function(u){if(u.size<2)return;if(u.type==="TXXX"){var m=1,h=n(u.data.subarray(m),!0);m+=h.length+1;var a=n(u.data.subarray(m));return{key:u.type,info:h,data:a}}var r=n(u.data.subarray(1));return{key:u.type,data:r}},b=function(u){if(u.type==="WXXX"){if(u.size<2)return;var m=1,h=n(u.data.subarray(m),!0);m+=h.length+1;var a=n(u.data.subarray(m));return{key:u.type,info:h,data:a}}var r=n(u.data);return{key:u.type,data:r}},p=function(u){if(u.data.byteLength===8){var m=new Uint8Array(u.data),h=m[3]&1,a=(m[4]<<23)+(m[5]<<15)+(m[6]<<7)+m[7];return a/=45,h&&(a+=4772185884e-2),Math.round(a)}return},n=function(u,m){m===void 0&&(m=!1);var h=g();if(h){var a=h.decode(u);if(m){var r=a.indexOf("\0");return r!==-1?a.substring(0,r):a}return a.replace(/\0/g,"")}for(var e=u.length,i,v,f,y="",t=0;t<e;){if(i=u[t++],i===0&&m)return y;if(i===0||i===3)continue;switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:y+=String.fromCharCode(i);break;case 12:case 13:v=u[t++],y+=String.fromCharCode((i&31)<<6|v&63);break;case 14:v=u[t++],f=u[t++],y+=String.fromCharCode((i&15)<<12|(v&63)<<6|(f&63)<<0);break;default:}}return y},l={decodeTextFrame:x},s;function g(){return!s&&typeof self.TextDecoder!="undefined"&&(s=new self.TextDecoder("utf-8")),s}},"./src/demux/mp3demuxer.ts":function(Ee,j,w){"use strict";w.r(j);var N=w("./src/demux/base-audio-demuxer.ts"),E=w("./src/demux/id3.ts"),R=w("./src/utils/logger.ts"),I=w("./src/demux/mpegaudio.ts");function M(_,S){_.prototype=Object.create(S.prototype),_.prototype.constructor=_,T(_,S)}function T(_,S){return T=Object.setPrototypeOf||function(C,x){return C.__proto__=x,C},T(_,S)}var P=function(_){M(S,_);function S(){return _.apply(this,arguments)||this}var O=S.prototype;return O.resetInitSegment=function(x,b,p){_.prototype.resetInitSegment.call(this,x,b,p),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:x,duration:p,inputTimeScale:9e4,dropped:0}},S.probe=function(x){if(!x)return!1;for(var b=E.getID3Data(x,0)||[],p=b.length,n=x.length;p<n;p++)if(I.probe(x,p))return R.logger.log("MPEG Audio sync word found !"),!0;return!1},O.canParse=function(x,b){return I.canParse(x,b)},O.appendFrame=function(x,b,p){return this.initPTS===null?void 0:I.appendFrame(x,b,p,this.initPTS,this.frameIndex)},S}(N.default);P.minProbeByteLength=4,j.default=P},"./src/demux/mp4demuxer.ts":function(Ee,j,w){"use strict";w.r(j);var N=w("./src/utils/mp4-tools.ts"),E=w("./src/demux/dummy-demuxed-track.ts"),R=function(){function I(T,P){this.remainderData=null,this.config=void 0,this.config=P}var M=I.prototype;return M.resetTimeStamp=function(){},M.resetInitSegment=function(){},M.resetContiguity=function(){},I.probe=function(P){return Object(N.findBox)({data:P,start:0,end:Math.min(P.length,16384)},["moof"]).length>0},M.demux=function(P){var _=P,S=Object(E.dummyTrack)();if(this.config.progressive){this.remainderData&&(_=Object(N.appendUint8Array)(this.remainderData,P));var O=Object(N.segmentValidRange)(_);this.remainderData=O.remainder,S.samples=O.valid||new Uint8Array}else S.samples=_;return{audioTrack:Object(E.dummyTrack)(),avcTrack:S,id3Track:Object(E.dummyTrack)(),textTrack:Object(E.dummyTrack)()}},M.flush=function(){var P=Object(E.dummyTrack)();return P.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(E.dummyTrack)(),avcTrack:P,id3Track:Object(E.dummyTrack)(),textTrack:Object(E.dummyTrack)()}},M.demuxSampleAes=function(P,_,S){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},M.destroy=function(){},I}();R.minProbeByteLength=1024,j.default=R},"./src/demux/mpegaudio.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"appendFrame",function(){return T}),w.d(j,"parseHeader",function(){return P}),w.d(j,"isHeaderPattern",function(){return _}),w.d(j,"isHeader",function(){return S}),w.d(j,"canParse",function(){return O}),w.d(j,"probe",function(){return C});var N=null,E=[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],R=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],I=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],M=[0,1,1,4];function T(x,b,p,n,l){if(p+24>b.length)return;var s=P(b,p);if(s&&p+s.frameLength<=b.length){var g=s.samplesPerFrame*9e4/s.sampleRate,d=n+l*g,u={unit:b.subarray(p,p+s.frameLength),pts:d,dts:d};return x.config=[],x.channelCount=s.channelCount,x.samplerate=s.sampleRate,x.samples.push(u),{sample:u,length:s.frameLength,missing:0}}}function P(x,b){var p=x[b+1]>>3&3,n=x[b+1]>>1&3,l=x[b+2]>>4&15,s=x[b+2]>>2&3;if(p!==1&&l!==0&&l!==15&&s!==3){var g=x[b+2]>>1&1,d=x[b+3]>>6,u=p===3?3-n:n===3?3:4,m=E[u*14+l-1]*1e3,h=p===3?0:p===2?1:2,a=R[h*3+s],r=d===3?1:2,e=I[p][n],i=M[n],v=e*8*i,f=Math.floor(e*m/a+g)*i;if(N===null){var y=navigator.userAgent||"",t=y.match(/Chrome\/(\d+)/i);N=t?parseInt(t[1]):0}var A=!!N&&N<=87;return A&&n===2&&m>=224e3&&d===0&&(x[b+3]=x[b+3]|128),{sampleRate:a,channelCount:r,frameLength:f,samplesPerFrame:v}}}function _(x,b){return x[b]===255&&(x[b+1]&224)===224&&(x[b+1]&6)!==0}function S(x,b){return b+1<x.length&&_(x,b)}function O(x,b){var p=4;return _(x,b)&&p<=x.length-b}function C(x,b){if(b+1<x.length&&_(x,b)){var p=4,n=P(x,b),l=p;n!=null&&n.frameLength&&(l=n.frameLength);var s=b+l;return s===x.length||S(x,s)}return!1}},"./src/demux/sample-aes.ts":function(Ee,j,w){"use strict";w.r(j);var N=w("./src/crypt/decrypter.ts"),E=w("./src/demux/tsdemuxer.ts"),R=function(){function I(T,P,_){this.keyData=void 0,this.decrypter=void 0,this.keyData=_,this.decrypter=new N.default(T,P,{removePKCS7Padding:!1})}var M=I.prototype;return M.decryptBuffer=function(P,_){this.decrypter.decrypt(P,this.keyData.key.buffer,this.keyData.iv.buffer,_)},M.decryptAacSample=function(P,_,S,O){var C=P[_].unit,x=C.subarray(16,C.length-C.length%16),b=x.buffer.slice(x.byteOffset,x.byteOffset+x.length),p=this;this.decryptBuffer(b,function(n){var l=new Uint8Array(n);C.set(l,16),O||p.decryptAacSamples(P,_+1,S)})},M.decryptAacSamples=function(P,_,S){for(;;_++){if(_>=P.length){S();return}if(P[_].unit.length<32)continue;var O=this.decrypter.isSync();if(this.decryptAacSample(P,_,S,O),!O)return}},M.getAvcEncryptedData=function(P){for(var _=Math.floor((P.length-48)/160)*16+16,S=new Int8Array(_),O=0,C=32;C<=P.length-16;C+=160,O+=16)S.set(P.subarray(C,C+16),O);return S},M.getAvcDecryptedUnit=function(P,_){for(var S=new Uint8Array(_),O=0,C=32;C<=P.length-16;C+=160,O+=16)P.set(S.subarray(O,O+16),C);return P},M.decryptAvcSample=function(P,_,S,O,C,x){var b=Object(E.discardEPB)(C.data),p=this.getAvcEncryptedData(b),n=this;this.decryptBuffer(p.buffer,function(l){C.data=n.getAvcDecryptedUnit(b,l),x||n.decryptAvcSamples(P,_,S+1,O)})},M.decryptAvcSamples=function(P,_,S,O){if(P instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;_++,S=0){if(_>=P.length){O();return}for(var C=P[_].units;!(S>=C.length);S++){var x=C[S];if(x.data.length<=48||x.type!==1&&x.type!==5)continue;var b=this.decrypter.isSync();if(this.decryptAvcSample(P,_,S,O,x,b),!b)return}}},I}();j.default=R},"./src/demux/transmuxer-interface.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"default",function(){return C});var N=w("./node_modules/webworkify-webpack/index.js"),E=w.n(N),R=w("./src/events.ts"),I=w("./src/demux/transmuxer.ts"),M=w("./src/utils/logger.ts"),T=w("./src/errors.ts"),P=w("./src/utils/mediasource-helper.ts"),_=w("./node_modules/eventemitter3/index.js"),S=w.n(_),O=Object(P.getMediaSource)()||{isTypeSupported:function(){return!1}},C=function(){function x(p,n,l,s){var g=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=p,this.id=n,this.onTransmuxComplete=l,this.onFlush=s;var d=p.config,u=function(e,i){i=i||{},i.frag=g.frag,i.id=g.id,p.trigger(e,i)};this.observer=new _.EventEmitter,this.observer.on(R.Events.FRAG_DECRYPTED,u),this.observer.on(R.Events.ERROR,u);var m={mp4:O.isTypeSupported("video/mp4"),mpeg:O.isTypeSupported("audio/mpeg"),mp3:O.isTypeSupported('audio/mp4; codecs="mp3"')},h=navigator.vendor;if(d.enableWorker&&typeof Worker!="undefined"){M.logger.log("demuxing in webworker");var a;try{a=this.worker=N("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),a.addEventListener("message",this.onwmsg),a.onerror=function(r){p.trigger(R.Events.ERROR,{type:T.ErrorTypes.OTHER_ERROR,details:T.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(r.message+" ("+r.filename+":"+r.lineno+")")})},a.postMessage({cmd:"init",typeSupported:m,vendor:h,id:n,config:JSON.stringify(d)})}catch(r){M.logger.warn("Error in worker:",r),M.logger.error("Error while initializing DemuxerWorker, fallback to inline"),a&&self.URL.revokeObjectURL(a.objectURL),this.transmuxer=new I.default(this.observer,m,d,h,n),this.worker=null}}else this.transmuxer=new I.default(this.observer,m,d,h,n)}var b=x.prototype;return b.destroy=function(){var n=this.worker;if(n)n.removeEventListener("message",this.onwmsg),n.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var s=this.observer;s&&s.removeAllListeners(),this.observer=null},b.push=function(n,l,s,g,d,u,m,h,a,r){var e=this;a.transmuxing.start=self.performance.now();var i=this.transmuxer,v=this.worker,f=u?u.start:d.start,y=d.decryptdata,t=this.frag,A=!(t&&d.cc===t.cc),U=!(t&&a.level===t.level),F=t?a.sn-t.sn:-1,H=this.part?a.part-this.part.index:1,J=!U&&(F===1||F===0&&H===1),B=self.performance.now();(U||F||d.stats.parsing.start===0)&&(d.stats.parsing.start=B),u&&(H||!J)&&(u.stats.parsing.start=B);var Z=new I.TransmuxState(A,J,h,U,f);if(!J||A){M.logger.log("[transmuxer-interface, "+d.type+"]: Starting new transmux session for sn: "+a.sn+" p: "+a.part+" level: "+a.level+" id: "+a.id+`
discontinuity: `+A+`
trackSwitch: `+U+`
contiguous: `+J+`
accurateTimeOffset: `+h+`
timeOffset: `+f);var re=new I.TransmuxConfig(s,g,l,m,r);this.configureTransmuxer(re)}if(this.frag=d,this.part=u,v)v.postMessage({cmd:"demux",data:n,decryptdata:y,chunkMeta:a,state:Z},n instanceof ArrayBuffer?[n]:[]);else if(i){var ie=i.push(n,y,a,Z);Object(I.isPromise)(ie)?ie.then(function(ve){e.handleTransmuxComplete(ve)}):this.handleTransmuxComplete(ie)}},b.flush=function(n){var l=this;n.transmuxing.start=self.performance.now();var s=this.transmuxer,g=this.worker;if(g)g.postMessage({cmd:"flush",chunkMeta:n});else if(s){var d=s.flush(n);Object(I.isPromise)(d)?d.then(function(u){l.handleFlushResult(u,n)}):this.handleFlushResult(d,n)}},b.handleFlushResult=function(n,l){var s=this;n.forEach(function(g){s.handleTransmuxComplete(g)}),this.onFlush(l)},b.onWorkerMessage=function(n){var l=n.data,s=this.hls;switch(l.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.id=this.id,s.trigger(l.event,l.data);break}}},b.configureTransmuxer=function(n){var l=this.worker,s=this.transmuxer;l?l.postMessage({cmd:"configure",config:n}):s&&s.configure(n)},b.handleTransmuxComplete=function(n){n.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(n)},x}()},"./src/demux/transmuxer-worker.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"default",function(){return T});var N=w("./src/demux/transmuxer.ts"),E=w("./src/events.ts"),R=w("./src/utils/logger.ts"),I=w("./node_modules/eventemitter3/index.js"),M=w.n(I);function T(C){var x=new I.EventEmitter,b=function(n,l){C.postMessage({event:n,data:l})};x.on(E.Events.FRAG_DECRYPTED,b),x.on(E.Events.ERROR,b),C.addEventListener("message",function(p){var n=p.data;switch(n.cmd){case"init":{var l=JSON.parse(n.config);C.transmuxer=new N.default(x,n.typeSupported,l,n.vendor,n.id),Object(R.enableLogs)(l.debug),b("init",null);break}case"configure":{C.transmuxer.configure(n.config);break}case"demux":{var s=C.transmuxer.push(n.data,n.decryptdata,n.chunkMeta,n.state);Object(N.isPromise)(s)?s.then(function(u){P(C,u)}):P(C,s);break}case"flush":{var g=n.chunkMeta,d=C.transmuxer.flush(g);Object(N.isPromise)(d)?d.then(function(u){S(C,u,g)}):S(C,d,g);break}default:break}})}function P(C,x){if(O(x.remuxResult))return;var b=[],p=x.remuxResult,n=p.audio,l=p.video;n&&_(b,n),l&&_(b,l),C.postMessage({event:"transmuxComplete",data:x},b)}function _(C,x){x.data1&&C.push(x.data1.buffer),x.data2&&C.push(x.data2.buffer)}function S(C,x,b){x.forEach(function(p){P(C,p)}),C.postMessage({event:"flush",data:b})}function O(C){return!C.audio&&!C.video&&!C.text&&!C.id3&&!C.initSegment}},"./src/demux/transmuxer.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"default",function(){return l}),w.d(j,"isPromise",function(){return d}),w.d(j,"TransmuxConfig",function(){return u}),w.d(j,"TransmuxState",function(){return m});var N=w("./src/events.ts"),E=w("./src/errors.ts"),R=w("./src/crypt/decrypter.ts"),I=w("./src/demux/aacdemuxer.ts"),M=w("./src/demux/mp4demuxer.ts"),T=w("./src/demux/tsdemuxer.ts"),P=w("./src/demux/mp3demuxer.ts"),_=w("./src/remux/mp4-remuxer.ts"),S=w("./src/remux/passthrough-remuxer.ts"),O=w("./src/demux/chunk-cache.ts"),C=w("./src/utils/mp4-tools.ts"),x=w("./src/utils/logger.ts"),b;try{b=self.performance.now.bind(self.performance)}catch(h){x.logger.debug("Unable to use Performance API on this environment"),b=self.Date.now}var p=[{demux:T.default,remux:_.default},{demux:M.default,remux:S.default},{demux:I.default,remux:_.default},{demux:P.default,remux:_.default}],n=1024;p.forEach(function(h){var a=h.demux;n=Math.max(n,a.minProbeByteLength)});var l=function(){function h(r,e,i,v,f){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new O.default,this.observer=r,this.typeSupported=e,this.config=i,this.vendor=v,this.id=f}var a=h.prototype;return a.configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},a.push=function(e,i,v,f){var y=this,t=v.transmuxing;t.executeStart=b();var A=new Uint8Array(e),U=this.cache,F=this.config,H=this.currentTransmuxState,J=this.transmuxConfig;f&&(this.currentTransmuxState=f);var B=s(A,i);if(B&&B.method==="AES-128"){var Z=this.getDecrypter();if(F.enableSoftwareAES){var re=Z.softwareDecrypt(A,B.key.buffer,B.iv.buffer);if(!re)return t.executeEnd=b(),g(v);A=new Uint8Array(re)}else return this.decryptionPromise=Z.webCryptoDecrypt(A,B.key.buffer,B.iv.buffer).then(function(Le){var Ke=y.push(Le,null,v);return y.decryptionPromise=null,Ke}),this.decryptionPromise}var ie=f||H,ve=ie.contiguous,de=ie.discontinuity,q=ie.trackSwitch,ee=ie.accurateTimeOffset,pe=ie.timeOffset,Q=J.audioCodec,V=J.videoCodec,Ce=J.defaultInitPts,ke=J.duration,Ue=J.initSegmentData;if((de||q)&&this.resetInitSegment(Ue,Q,V,ke),de&&this.resetInitialTimestamp(Ce),ve||this.resetContiguity(),this.needsProbing(A,de,q)){if(U.dataLength){var we=U.flush();A=Object(C.appendUint8Array)(we,A)}this.configureTransmuxer(A,J)}var De=this.transmux(A,B,pe,ee,v),Oe=this.currentTransmuxState;return Oe.contiguous=!0,Oe.discontinuity=!1,Oe.trackSwitch=!1,t.executeEnd=b(),De},a.flush=function(e){var i=this,v=e.transmuxing;v.executeStart=b();var f=this.decrypter,y=this.cache,t=this.currentTransmuxState,A=this.decryptionPromise;if(A)return A.then(function(){return i.flush(e)});var U=[],F=t.timeOffset;if(f){var H=f.flush();H&&U.push(this.push(H,null,e))}var J=y.dataLength;y.reset();var B=this.demuxer,Z=this.remuxer;if(!B||!Z)return J>=n&&this.observer.emit(N.Events.ERROR,N.Events.ERROR,{type:E.ErrorTypes.MEDIA_ERROR,details:E.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),v.executeEnd=b(),[g(e)];var re=B.flush(F);return d(re)?re.then(function(ie){return i.flushRemux(U,ie,e),U}):(this.flushRemux(U,re,e),U)},a.flushRemux=function(e,i,v){var f=i.audioTrack,y=i.avcTrack,t=i.id3Track,A=i.textTrack,U=this.currentTransmuxState,F=U.accurateTimeOffset,H=U.timeOffset;x.logger.log("[transmuxer.ts]: Flushed fragment "+v.sn+(v.part>-1?" p: "+v.part:"")+" of level "+v.level);var J=this.remuxer.remux(f,y,t,A,H,F,!0,this.id);e.push({remuxResult:J,chunkMeta:v}),v.transmuxing.executeEnd=b()},a.resetInitialTimestamp=function(e){var i=this.demuxer,v=this.remuxer;if(!i||!v)return;i.resetTimeStamp(e),v.resetTimeStamp(e)},a.resetContiguity=function(){var e=this.demuxer,i=this.remuxer;if(!e||!i)return;e.resetContiguity(),i.resetNextTimestamp()},a.resetInitSegment=function(e,i,v,f){var y=this.demuxer,t=this.remuxer;if(!y||!t)return;y.resetInitSegment(i,v,f),t.resetInitSegment(e,i,v)},a.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},a.transmux=function(e,i,v,f,y){var t;return i&&i.method==="SAMPLE-AES"?t=this.transmuxSampleAes(e,i,v,f,y):t=this.transmuxUnencrypted(e,v,f,y),t},a.transmuxUnencrypted=function(e,i,v,f){var y=this.demuxer.demux(e,i,!1,!this.config.progressive),t=y.audioTrack,A=y.avcTrack,U=y.id3Track,F=y.textTrack,H=this.remuxer.remux(t,A,U,F,i,v,!1,this.id);return{remuxResult:H,chunkMeta:f}},a.transmuxSampleAes=function(e,i,v,f,y){var t=this;return this.demuxer.demuxSampleAes(e,i,v).then(function(A){var U=t.remuxer.remux(A.audioTrack,A.avcTrack,A.id3Track,A.textTrack,v,f,!1,t.id);return{remuxResult:U,chunkMeta:y}})},a.configureTransmuxer=function(e,i){for(var v=this.config,f=this.observer,y=this.typeSupported,t=this.vendor,A=i.audioCodec,U=i.defaultInitPts,F=i.duration,H=i.initSegmentData,J=i.videoCodec,B,Z=0,re=p.length;Z<re;Z++)if(p[Z].demux.probe(e)){B=p[Z];break}B||(x.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),B={demux:M.default,remux:S.default});var ie=this.demuxer,ve=this.remuxer,de=B.remux,q=B.demux;(!ve||!(ve instanceof de))&&(this.remuxer=new de(f,v,y,t)),(!ie||!(ie instanceof q))&&(this.demuxer=new q(f,v,y),this.probe=q.probe),this.resetInitSegment(H,A,J,F),this.resetInitialTimestamp(U)},a.needsProbing=function(e,i,v){return!this.demuxer||!this.remuxer||i||v},a.getDecrypter=function(){var e=this.decrypter;return e||(e=this.decrypter=new R.default(this.observer,this.config)),e},h}();function s(h,a){var r=null;return h.byteLength>0&&a!=null&&a.key!=null&&a.iv!==null&&a.method!=null&&(r=a),r}var g=function(a){return{remuxResult:{},chunkMeta:a}};function d(h){return"then"in h&&h.then instanceof Function}var u=function(a,r,e,i,v){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=a,this.videoCodec=r,this.initSegmentData=e,this.duration=i,this.defaultInitPts=v},m=function(a,r,e,i,v){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=a,this.contiguous=r,this.accurateTimeOffset=e,this.trackSwitch=i,this.timeOffset=v}},"./src/demux/tsdemuxer.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"discardEPB",function(){return g});var N=w("./src/demux/adts.ts"),E=w("./src/demux/mpegaudio.ts"),R=w("./src/demux/exp-golomb.ts"),I=w("./src/demux/id3.ts"),M=w("./src/demux/sample-aes.ts"),T=w("./src/events.ts"),P=w("./src/utils/mp4-tools.ts"),_=w("./src/utils/logger.ts"),S=w("./src/errors.ts"),O={video:1,audio:2,id3:3,text:4},C=function(){function d(m,h,a){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=m,this.config=h,this.typeSupported=a}d.probe=function(h){var a=d.syncOffset(h);return a<0?!1:(a&&_.logger.warn("MPEG2-TS detected but first sync word found @ offset "+a+", junk ahead ?"),!0)},d.syncOffset=function(h){for(var a=Math.min(1e3,h.length-3*188),r=0;r<a;){if(h[r]===71&&h[r+188]===71&&h[r+2*188]===71)return r;r++}return-1},d.createTrack=function(h,a){return{container:h==="video"||h==="audio"?"video/mp2t":void 0,type:h,id:O[h],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:h==="audio"?a:void 0}};var u=d.prototype;return u.resetInitSegment=function(h,a,r){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=d.createTrack("video",r),this._audioTrack=d.createTrack("audio",r),this._id3Track=d.createTrack("id3",r),this._txtTrack=d.createTrack("text",r),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=h,this.videoCodec=a,this._duration=r},u.resetTimeStamp=function(){},u.resetContiguity=function(){var h=this._audioTrack,a=this._avcTrack,r=this._id3Track;h&&(h.pesData=null),a&&(a.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},u.demux=function(h,a,r,e){r===void 0&&(r=!1),e===void 0&&(e=!1),r||(this.sampleAes=null);var i,v=this._avcTrack,f=this._audioTrack,y=this._id3Track,t=v.pid,A=v.pesData,U=f.pid,F=y.pid,H=f.pesData,J=y.pesData,B=!1,Z=this.pmtParsed,re=this._pmtId,ie=h.length;if(this.remainderData&&(h=Object(P.appendUint8Array)(this.remainderData,h),ie=h.length,this.remainderData=null),ie<188&&!e)return this.remainderData=h,{audioTrack:f,avcTrack:v,id3Track:y,textTrack:this._txtTrack};var ve=Math.max(0,d.syncOffset(h));ie-=(ie+ve)%188,ie<h.byteLength&&!e&&(this.remainderData=new Uint8Array(h.buffer,ie,h.buffer.byteLength-ie));for(var de=ve;de<ie;de+=188)if(h[de]===71){var q=!!(h[de+1]&64),ee=((h[de+1]&31)<<8)+h[de+2],pe=(h[de+3]&48)>>4,Q=void 0;if(pe>1){if(Q=de+5+h[de+4],Q===de+188)continue}else Q=de+4;switch(ee){case t:q&&(A&&(i=n(A))&&this.parseAVCPES(i,!1),A={data:[],size:0}),A&&(A.data.push(h.subarray(Q,de+188)),A.size+=de+188-Q);break;case U:q&&(H&&(i=n(H))&&(f.isAAC?this.parseAACPES(i):this.parseMPEGPES(i)),H={data:[],size:0}),H&&(H.data.push(h.subarray(Q,de+188)),H.size+=de+188-Q);break;case F:q&&(J&&(i=n(J))&&this.parseID3PES(i),J={data:[],size:0}),J&&(J.data.push(h.subarray(Q,de+188)),J.size+=de+188-Q);break;case 0:q&&(Q+=h[Q]+1),re=this._pmtId=b(h,Q);break;case re:{q&&(Q+=h[Q]+1);var V=p(h,Q,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,r);t=V.avc,t>0&&(v.pid=t),U=V.audio,U>0&&(f.pid=U,f.isAAC=V.isAAC),F=V.id3,F>0&&(y.pid=F),B&&!Z&&(_.logger.log("reparse from beginning"),B=!1,de=ve-188),Z=this.pmtParsed=!0;break}case 17:case 8191:break;default:B=!0;break}}else this.observer.emit(T.Events.ERROR,T.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});v.pesData=A,f.pesData=H,y.pesData=J;var Ce={audioTrack:f,avcTrack:v,id3Track:y,textTrack:this._txtTrack};return e&&this.extractRemainingSamples(Ce),Ce},u.flush=function(){var h=this.remainderData;this.remainderData=null;var a;return h?a=this.demux(h,-1,!1,!0):a={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(a),this.sampleAes?this.decrypt(a,this.sampleAes):a},u.extractRemainingSamples=function(h){var a=h.audioTrack,r=h.avcTrack,e=h.id3Track,i=r.pesData,v=a.pesData,f=e.pesData,y;i&&(y=n(i))?(this.parseAVCPES(y,!0),r.pesData=null):r.pesData=i,v&&(y=n(v))?(a.isAAC?this.parseAACPES(y):this.parseMPEGPES(y),a.pesData=null):(v!=null&&v.size&&_.logger.log("last AAC PES packet truncated,might overlap between fragments"),a.pesData=v),f&&(y=n(f))?(this.parseID3PES(y),e.pesData=null):e.pesData=f},u.demuxSampleAes=function(h,a,r){var e=this.demux(h,r,!0,!this.config.progressive),i=this.sampleAes=new M.default(this.observer,this.config,a);return this.decrypt(e,i)},u.decrypt=function(h,a){return new Promise(function(r){var e=h.audioTrack,i=h.avcTrack;e.samples&&e.isAAC?a.decryptAacSamples(e.samples,0,function(){i.samples?a.decryptAvcSamples(i.samples,0,0,function(){r(h)}):r(h)}):i.samples&&a.decryptAvcSamples(i.samples,0,0,function(){r(h)})})},u.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},u.parseAVCPES=function(h,a){var r=this,e=this._avcTrack,i=this.parseAVCNALu(h.data),v=!1,f=this.avcSample,y,t=!1;h.data=null,f&&i.length&&!e.audFound&&(l(f,e),f=this.avcSample=x(!1,h.pts,h.dts,"")),i.forEach(function(A){switch(A.type){case 1:{y=!0,f||(f=r.avcSample=x(!0,h.pts,h.dts,"")),v&&(f.debug+="NDR "),f.frame=!0;var U=A.data;if(t&&U.length>4){var F=new R.default(U).readSliceType();(F===2||F===4||F===7||F===9)&&(f.key=!0)}break}case 5:y=!0,f||(f=r.avcSample=x(!0,h.pts,h.dts,"")),v&&(f.debug+="IDR "),f.key=!0,f.frame=!0;break;case 6:{y=!0,v&&f&&(f.debug+="SEI ");var H=new R.default(g(A.data));H.readUByte();for(var J=0,B=0,Z=!1,re=0;!Z&&H.bytesAvailable>1;){J=0;do re=H.readUByte(),J+=re;while(re===255);B=0;do re=H.readUByte(),B+=re;while(re===255);if(J===4&&H.bytesAvailable!==0){Z=!0;var ie=H.readUByte();if(ie===181){var ve=H.readUShort();if(ve===49){var de=H.readUInt();if(de===1195456820){var q=H.readUByte();if(q===3){for(var ee=H.readUByte(),pe=H.readUByte(),Q=31&ee,V=[ee,pe],Ce=0;Ce<Q;Ce++)V.push(H.readUByte()),V.push(H.readUByte()),V.push(H.readUByte());s(r._txtTrack.samples,{type:3,pts:h.pts,bytes:V})}}}}}else if(J===5&&H.bytesAvailable!==0){if(Z=!0,B>16){for(var ke=[],Ue=0;Ue<16;Ue++)ke.push(H.readUByte().toString(16)),(Ue===3||Ue===5||Ue===7||Ue===9)&&ke.push("-");for(var we=B-16,De=new Uint8Array(we),Oe=0;Oe<we;Oe++)De[Oe]=H.readUByte();s(r._txtTrack.samples,{pts:h.pts,payloadType:J,uuid:ke.join(""),userData:Object(I.utf8ArrayToStr)(De),userDataBytes:De})}}else if(B<H.bytesAvailable)for(var Le=0;Le<B;Le++)H.readUByte()}break}case 7:if(y=!0,t=!0,v&&f&&(f.debug+="SPS "),!e.sps){var Ke=new R.default(A.data),Fe=Ke.readSPS();e.width=Fe.width,e.height=Fe.height,e.pixelRatio=Fe.pixelRatio,e.sps=[A.data],e.duration=r._duration;for(var He=A.data.subarray(1,4),Ne="avc1.",xe=0;xe<3;xe++){var Ge=He[xe].toString(16);Ge.length<2&&(Ge="0"+Ge),Ne+=Ge}e.codec=Ne}break;case 8:y=!0,v&&f&&(f.debug+="PPS "),e.pps||(e.pps=[A.data]);break;case 9:y=!1,e.audFound=!0,f&&l(f,e),f=r.avcSample=x(!1,h.pts,h.dts,v?"AUD ":"");break;case 12:y=!1;break;default:y=!1,f&&(f.debug+="unknown NAL "+A.type+" ");break}if(f&&y){var qe=f.units;qe.push(A)}}),a&&f&&(l(f,e),this.avcSample=null)},u.getLastNalUnit=function(){var h,a=this.avcSample,r;if(!a||a.units.length===0){var e=this._avcTrack.samples;a=e[e.length-1]}if((h=a)!==null&&h!==void 0&&h.units){var i=a.units;r=i[i.length-1]}return r},u.parseAVCNALu=function(h){var a=h.byteLength,r=this._avcTrack,e=r.naluState||0,i=e,v=[],f=0,y,t,A,U=-1,F=0;for(e===-1&&(U=0,F=h[0]&31,e=0,f=1);f<a;){if(y=h[f++],!e){e=y?0:1;continue}if(e===1){e=y?0:2;continue}if(!y)e=3;else if(y===1){if(U>=0){var H={data:h.subarray(U,f-e-1),type:F};v.push(H)}else{var J=this.getLastNalUnit();if(J&&(i&&f<=4-i&&(J.state&&(J.data=J.data.subarray(0,J.data.byteLength-i))),t=f-e-1,t>0)){var B=new Uint8Array(J.data.byteLength+t);B.set(J.data,0),B.set(h.subarray(0,t),J.data.byteLength),J.data=B,J.state=0}}f<a?(A=h[f]&31,U=f,F=A,e=0):e=-1}else e=0}if(U>=0&&e>=0){var Z={data:h.subarray(U,a),type:F,state:e};v.push(Z)}if(v.length===0){var re=this.getLastNalUnit();if(re){var ie=new Uint8Array(re.data.byteLength+h.byteLength);ie.set(re.data,0),ie.set(h,re.data.byteLength),re.data=ie}}return r.naluState=e,v},u.parseAACPES=function(h){var a=0,r=this._audioTrack,e=this.aacOverFlow,i=h.data;if(e){this.aacOverFlow=null;var v=e.sample.unit.byteLength,f=Math.min(e.missing,v),y=v-f;e.sample.unit.set(i.subarray(0,f),y),r.samples.push(e.sample),a=e.missing}var t,A;for(t=a,A=i.length;t<A-1&&!N.isHeader(i,t);t++);if(t!==a){var U,F;if(t<A-1?(U="AAC PES did not start with ADTS header,offset:"+t,F=!1):(U="no ADTS header found in AAC PES",F=!0),_.logger.warn("parsing error:"+U),this.observer.emit(T.Events.ERROR,T.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.FRAG_PARSING_ERROR,fatal:F,reason:U}),F)return}N.initTrackConfig(r,this.observer,i,t,this.audioCodec);var H;if(h.pts!==void 0)H=h.pts;else if(e){var J=N.getFrameDuration(r.samplerate);H=e.sample.pts+J}else{_.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var B=0;t<A;)if(N.isHeader(i,t)){if(t+5<A){var Z=N.appendFrame(r,i,t,H,B);if(Z)if(Z.missing)this.aacOverFlow=Z;else{t+=Z.length,B++;continue}}break}else t++},u.parseMPEGPES=function(h){var a=h.data,r=a.length,e=0,i=0,v=h.pts;if(v===void 0){_.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;i<r;)if(E.isHeader(a,i)){var f=E.appendFrame(this._audioTrack,a,i,v,e);if(f)i+=f.length,e++;else break}else i++},u.parseID3PES=function(h){if(h.pts===void 0){_.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(h)},d}();C.minProbeByteLength=188;function x(d,u,m,h){return{key:d,frame:!1,pts:u,dts:m,units:[],debug:h,length:0}}function b(d,u){return(d[u+10]&31)<<8|d[u+11]}function p(d,u,m,h){var a={audio:-1,avc:-1,id3:-1,isAAC:!0},r=(d[u+1]&15)<<8|d[u+2],e=u+3+r-4,i=(d[u+10]&15)<<8|d[u+11];for(u+=12+i;u<e;){var v=(d[u+1]&31)<<8|d[u+2];switch(d[u]){case 207:if(!h){_.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:a.audio===-1&&(a.audio=v);break;case 21:a.id3===-1&&(a.id3=v);break;case 219:if(!h){_.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:a.avc===-1&&(a.avc=v);break;case 3:case 4:m?a.audio===-1&&(a.audio=v,a.isAAC=!1):_.logger.log("MPEG audio found, not supported in this browser");break;case 36:_.logger.warn("Unsupported HEVC stream type found");break;default:break}u+=((d[u+3]&15)<<8|d[u+4])+5}return a}function n(d){var u=0,m,h,a,r,e,i=d.data;if(!d||d.size===0)return null;for(;i[0].length<19&&i.length>1;){var v=new Uint8Array(i[0].length+i[1].length);v.set(i[0]),v.set(i[1],i[0].length),i[0]=v,i.splice(1,1)}m=i[0];var f=(m[0]<<16)+(m[1]<<8)+m[2];if(f===1){if(h=(m[4]<<8)+m[5],h&&h>d.size-6)return null;var y=m[7];y&192&&(r=(m[9]&14)*536870912+(m[10]&255)*4194304+(m[11]&254)*16384+(m[12]&255)*128+(m[13]&254)/2,y&64?(e=(m[14]&14)*536870912+(m[15]&255)*4194304+(m[16]&254)*16384+(m[17]&255)*128+(m[18]&254)/2,r-e>60*9e4&&(_.logger.warn(Math.round((r-e)/9e4)+"s delta between PTS and DTS, align them"),r=e)):e=r),a=m[8];var t=a+9;if(d.size<=t)return null;d.size-=t;for(var A=new Uint8Array(d.size),U=0,F=i.length;U<F;U++){m=i[U];var H=m.byteLength;if(t)if(t>H){t-=H;continue}else m=m.subarray(t),H-=t,t=0;A.set(m,u),u+=H}return h&&(h-=a+3),{data:A,pts:r,dts:e,len:h}}return null}function l(d,u){if(d.units.length&&d.frame){if(d.pts===void 0){var m=u.samples,h=m.length;if(h){var a=m[h-1];d.pts=a.pts,d.dts=a.dts}else{u.dropped++;return}}u.samples.push(d)}d.debug.length&&_.logger.log(d.pts+"/"+d.dts+":"+d.debug)}function s(d,u){var m=d.length;if(m>0){if(u.pts>=d[m-1].pts)d.push(u);else for(var h=m-1;h>=0;h--)if(u.pts<d[h].pts){d.splice(h,0,u);break}}else d.push(u)}function g(d){for(var u=d.byteLength,m=[],h=1;h<u-2;)d[h]===0&&d[h+1]===0&&d[h+2]===3?(m.push(h+2),h+=2):h++;if(m.length===0)return d;var a=u-m.length,r=new Uint8Array(a),e=0;for(h=0;h<a;e++,h++)e===m[0]&&(e++,m.shift()),r[h]=d[e];return r}j.default=C},"./src/errors.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"ErrorTypes",function(){return N}),w.d(j,"ErrorDetails",function(){return E});var N;(function(R){R.NETWORK_ERROR="networkError",R.MEDIA_ERROR="mediaError",R.KEY_SYSTEM_ERROR="keySystemError",R.MUX_ERROR="muxError",R.OTHER_ERROR="otherError"})(N||(N={}));var E;(function(R){R.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",R.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",R.KEY_SYSTEM_NO_SESSION="keySystemNoSession",R.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",R.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",R.MANIFEST_LOAD_ERROR="manifestLoadError",R.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",R.MANIFEST_PARSING_ERROR="manifestParsingError",R.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",R.LEVEL_EMPTY_ERROR="levelEmptyError",R.LEVEL_LOAD_ERROR="levelLoadError",R.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",R.LEVEL_SWITCH_ERROR="levelSwitchError",R.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",R.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",R.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",R.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",R.FRAG_LOAD_ERROR="fragLoadError",R.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",R.FRAG_DECRYPT_ERROR="fragDecryptError",R.FRAG_PARSING_ERROR="fragParsingError",R.REMUX_ALLOC_ERROR="remuxAllocError",R.KEY_LOAD_ERROR="keyLoadError",R.KEY_LOAD_TIMEOUT="keyLoadTimeOut",R.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",R.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",R.BUFFER_APPEND_ERROR="bufferAppendError",R.BUFFER_APPENDING_ERROR="bufferAppendingError",R.BUFFER_STALLED_ERROR="bufferStalledError",R.BUFFER_FULL_ERROR="bufferFullError",R.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",R.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",R.INTERNAL_EXCEPTION="internalException",R.INTERNAL_ABORTED="aborted",R.UNKNOWN="unknown"})(E||(E={}))},"./src/events.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"Events",function(){return N});var N;(function(E){E.MEDIA_ATTACHING="hlsMediaAttaching",E.MEDIA_ATTACHED="hlsMediaAttached",E.MEDIA_DETACHING="hlsMediaDetaching",E.MEDIA_DETACHED="hlsMediaDetached",E.BUFFER_RESET="hlsBufferReset",E.BUFFER_CODECS="hlsBufferCodecs",E.BUFFER_CREATED="hlsBufferCreated",E.BUFFER_APPENDING="hlsBufferAppending",E.BUFFER_APPENDED="hlsBufferAppended",E.BUFFER_EOS="hlsBufferEos",E.BUFFER_FLUSHING="hlsBufferFlushing",E.BUFFER_FLUSHED="hlsBufferFlushed",E.MANIFEST_LOADING="hlsManifestLoading",E.MANIFEST_LOADED="hlsManifestLoaded",E.MANIFEST_PARSED="hlsManifestParsed",E.LEVEL_SWITCHING="hlsLevelSwitching",E.LEVEL_SWITCHED="hlsLevelSwitched",E.LEVEL_LOADING="hlsLevelLoading",E.LEVEL_LOADED="hlsLevelLoaded",E.LEVEL_UPDATED="hlsLevelUpdated",E.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",E.LEVELS_UPDATED="hlsLevelsUpdated",E.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",E.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",E.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",E.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",E.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",E.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",E.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",E.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",E.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",E.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",E.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",E.CUES_PARSED="hlsCuesParsed",E.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",E.INIT_PTS_FOUND="hlsInitPtsFound",E.FRAG_LOADING="hlsFragLoading",E.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",E.FRAG_LOADED="hlsFragLoaded",E.FRAG_DECRYPTED="hlsFragDecrypted",E.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",E.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",E.FRAG_PARSING_METADATA="hlsFragParsingMetadata",E.FRAG_PARSED="hlsFragParsed",E.FRAG_BUFFERED="hlsFragBuffered",E.FRAG_CHANGED="hlsFragChanged",E.FPS_DROP="hlsFpsDrop",E.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",E.ERROR="hlsError",E.DESTROYING="hlsDestroying",E.KEY_LOADING="hlsKeyLoading",E.KEY_LOADED="hlsKeyLoaded",E.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",E.BACK_BUFFER_REACHED="hlsBackBufferReached"})(N||(N={}))},"./src/hls.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"default",function(){return d});var N=w("./node_modules/url-toolkit/src/url-toolkit.js"),E=w.n(N),R=w("./src/loader/playlist-loader.ts"),I=w("./src/loader/key-loader.ts"),M=w("./src/controller/id3-track-controller.ts"),T=w("./src/controller/latency-controller.ts"),P=w("./src/controller/level-controller.ts"),_=w("./src/controller/fragment-tracker.ts"),S=w("./src/controller/stream-controller.ts"),O=w("./src/is-supported.ts"),C=w("./src/utils/logger.ts"),x=w("./src/config.ts"),b=w("./node_modules/eventemitter3/index.js"),p=w.n(b),n=w("./src/events.ts"),l=w("./src/errors.ts");function s(u,m){for(var h=0;h<m.length;h++){var a=m[h];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(u,a.key,a)}}function g(u,m,h){return m&&s(u.prototype,m),h&&s(u,h),u}var d=function(){u.isSupported=function(){return Object(O.isSupported)()};function u(h){h===void 0&&(h={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new b.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var a=this.config=Object(x.mergeConfig)(u.DefaultConfig,h);this.userConfig=h,Object(C.enableLogs)(a.debug),this._autoLevelCapping=-1,a.progressive&&Object(x.enableStreamingMode)(a);var r=a.abrController,e=a.bufferController,i=a.capLevelController,v=a.fpsController,f=this.abrController=new r(this),y=this.bufferController=new e(this),t=this.capLevelController=new i(this),A=new v(this),U=new R.default(this),F=new I.default(this),H=new M.default(this),J=this.levelController=new P.default(this),B=new _.FragmentTracker(this),Z=this.streamController=new S.default(this,B);t.setStreamController(Z),A.setStreamController(Z);var re=[J,Z];this.networkControllers=re;var ie=[U,F,f,y,t,A,H,B];this.audioTrackController=this.createController(a.audioTrackController,null,re),this.createController(a.audioStreamController,B,re),this.subtitleTrackController=this.createController(a.subtitleTrackController,null,re),this.createController(a.subtitleStreamController,B,re),this.createController(a.timelineController,null,ie),this.emeController=this.createController(a.emeController,null,ie),this.cmcdController=this.createController(a.cmcdController,null,ie),this.latencyController=this.createController(T.default,null,ie),this.coreComponents=ie}var m=u.prototype;return m.createController=function(a,r,e){if(a){var i=r?new a(this,r):new a(this);return e&&e.push(i),i}return null},m.on=function(a,r,e){e===void 0&&(e=this),this._emitter.on(a,r,e)},m.once=function(a,r,e){e===void 0&&(e=this),this._emitter.once(a,r,e)},m.removeAllListeners=function(a){this._emitter.removeAllListeners(a)},m.off=function(a,r,e,i){e===void 0&&(e=this),this._emitter.off(a,r,e,i)},m.listeners=function(a){return this._emitter.listeners(a)},m.emit=function(a,r,e){return this._emitter.emit(a,r,e)},m.trigger=function(a,r){if(this.config.debug)return this.emit(a,a,r);try{return this.emit(a,a,r)}catch(e){C.logger.error("An internal error happened while handling event "+a+'. Error message: "'+e.message+'". Here is a stacktrace:',e),this.trigger(n.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:a,error:e})}return!1},m.listenerCount=function(a){return this._emitter.listenerCount(a)},m.destroy=function(){C.logger.log("destroy"),this.trigger(n.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(a){return a.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(a){return a.destroy()}),this.coreComponents.length=0},m.attachMedia=function(a){C.logger.log("attachMedia"),this._media=a,this.trigger(n.Events.MEDIA_ATTACHING,{media:a})},m.detachMedia=function(){C.logger.log("detachMedia"),this.trigger(n.Events.MEDIA_DETACHING,void 0),this._media=null},m.loadSource=function(a){this.stopLoad();var r=this.media,e=this.url,i=this.url=N.buildAbsoluteURL(self.location.href,a,{alwaysNormalize:!0});C.logger.log("loadSource:"+i),r&&e&&e!==i&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(r)),this.trigger(n.Events.MANIFEST_LOADING,{url:a})},m.startLoad=function(a){a===void 0&&(a=-1),C.logger.log("startLoad("+a+")"),this.networkControllers.forEach(function(r){r.startLoad(a)})},m.stopLoad=function(){C.logger.log("stopLoad"),this.networkControllers.forEach(function(a){a.stopLoad()})},m.swapAudioCodec=function(){C.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},m.recoverMediaError=function(){C.logger.log("recoverMediaError");var a=this._media;this.detachMedia(),a&&this.attachMedia(a)},m.removeLevel=function(a,r){r===void 0&&(r=0),this.levelController.removeLevel(a,r)},g(u,[{key:"levels",get:function(){var a=this.levelController.levels;return a||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(a){C.logger.log("set currentLevel:"+a),this.loadLevel=a,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(a){C.logger.log("set nextLevel:"+a),this.levelController.manualLevel=a,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(a){C.logger.log("set loadLevel:"+a),this.levelController.manualLevel=a}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(a){this.levelController.nextLoadLevel=a}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(a){C.logger.log("set firstLevel:"+a),this.levelController.firstLevel=a}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(a){C.logger.log("set startLevel:"+a),a!==-1&&(a=Math.max(a,this.minAutoLevel)),this.levelController.startLevel=a}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(a){var r=!!a;r!==this.config.capLevelToPlayerSize&&(r?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=r)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(a){this._autoLevelCapping!==a&&(C.logger.log("set autoLevelCapping:"+a),this._autoLevelCapping=a)}},{key:"bandwidthEstimate",get:function(){var a=this.abrController.bwEstimator;return a?a.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var a=this.levels,r=this.config.minAutoBitrate;if(!a)return 0;for(var e=a.length,i=0;i<e;i++)if(a[i].maxBitrate>r)return i;return 0}},{key:"maxAutoLevel",get:function(){var a=this.levels,r=this.autoLevelCapping,e;return r===-1&&a&&a.length?e=a.length-1:e=r,e}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(a){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,a)}},{key:"audioTracks",get:function(){var a=this.audioTrackController;return a?a.audioTracks:[]}},{key:"audioTrack",get:function(){var a=this.audioTrackController;return a?a.audioTrack:-1},set:function(a){var r=this.audioTrackController;r&&(r.audioTrack=a)}},{key:"subtitleTracks",get:function(){var a=this.subtitleTrackController;return a?a.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var a=this.subtitleTrackController;return a?a.subtitleTrack:-1},set:function(a){var r=this.subtitleTrackController;r&&(r.subtitleTrack=a)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var a=this.subtitleTrackController;return a?a.subtitleDisplay:!1},set:function(a){var r=this.subtitleTrackController;r&&(r.subtitleDisplay=a)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(a){this.config.lowLatencyMode=a}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return n.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return u.defaultConfig?u.defaultConfig:x.hlsDefaultConfig},set:function(a){u.defaultConfig=a}}]),u}();d.defaultConfig=void 0},"./src/is-supported.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"isSupported",function(){return R}),w.d(j,"changeTypeSupported",function(){return I});var N=w("./src/utils/mediasource-helper.ts");function E(){return self.SourceBuffer||self.WebKitSourceBuffer}function R(){var M=Object(N.getMediaSource)();if(!M)return!1;var T=E(),P=M&&typeof M.isTypeSupported=="function"&&M.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),_=!T||T.prototype&&typeof T.prototype.appendBuffer=="function"&&typeof T.prototype.remove=="function";return!!P&&!!_}function I(){var M,T=E();return typeof(T==null||((M=T.prototype)===null||M===void 0)?void 0:M.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"default",function(){return C}),w.d(j,"LoadError",function(){return b});var N=w("./src/polyfills/number.ts"),E=w("./src/errors.ts");function R(p,n){p.prototype=Object.create(n.prototype),p.prototype.constructor=p,_(p,n)}function I(p){var n=typeof Map=="function"?new Map:void 0;return I=function(s){if(s===null||!P(s))return s;if(typeof s!="function")throw new TypeError("Super expression must either be null or a function");if(typeof n!="undefined"){if(n.has(s))return n.get(s);n.set(s,g)}function g(){return M(s,arguments,S(this).constructor)}return g.prototype=Object.create(s.prototype,{constructor:{value:g,enumerable:!1,writable:!0,configurable:!0}}),_(g,s)},I(p)}function M(p,n,l){return T()?M=Reflect.construct:M=function(g,d,u){var m=[null];m.push.apply(m,d);var h=Function.bind.apply(g,m),a=new h;return u&&_(a,u.prototype),a},M.apply(null,arguments)}function T(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(p){return!1}}function P(p){return Function.toString.call(p).indexOf("[native code]")!==-1}function _(p,n){return _=Object.setPrototypeOf||function(s,g){return s.__proto__=g,s},_(p,n)}function S(p){return S=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},S(p)}var O=Math.pow(2,17),C=function(){function p(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var n=p.prototype;return n.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},n.abort=function(){this.loader&&this.loader.abort()},n.load=function(s,g){var d=this,u=s.url;if(!u)return Promise.reject(new b({type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,networkDetails:null},"Fragment does not have a "+(u?"part list":"url")));this.abort();var m=this.config,h=m.fLoader,a=m.loader;return new Promise(function(r,e){d.loader&&d.loader.destroy();var i=d.loader=s.loader=h?new h(m):new a(m),v=x(s),f={timeout:m.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:m.fragLoadingMaxRetryTimeout,highWaterMark:O};s.stats=i.stats,i.load(v,f,{onSuccess:function(t,A,U,F){d.resetLoader(s,i),r({frag:s,part:null,payload:t.data,networkDetails:F})},onError:function(t,A,U){d.resetLoader(s,i),e(new b({type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,response:t,networkDetails:U}))},onAbort:function(t,A,U){d.resetLoader(s,i),e(new b({type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,networkDetails:U}))},onTimeout:function(t,A,U){d.resetLoader(s,i),e(new b({type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,networkDetails:U}))},onProgress:function(t,A,U,F){g&&g({frag:s,part:null,payload:U,networkDetails:F})}})})},n.loadPart=function(s,g,d){var u=this;this.abort();var m=this.config,h=m.fLoader,a=m.loader;return new Promise(function(r,e){u.loader&&u.loader.destroy();var i=u.loader=s.loader=h?new h(m):new a(m),v=x(s,g),f={timeout:m.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:m.fragLoadingMaxRetryTimeout,highWaterMark:O};g.stats=i.stats,i.load(v,f,{onSuccess:function(t,A,U,F){u.resetLoader(s,i),u.updateStatsFromPart(s,g);var H={frag:s,part:g,payload:t.data,networkDetails:F};d(H),r(H)},onError:function(t,A,U){u.resetLoader(s,i),e(new b({type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,part:g,response:t,networkDetails:U}))},onAbort:function(t,A,U){s.stats.aborted=g.stats.aborted,u.resetLoader(s,i),e(new b({type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,part:g,networkDetails:U}))},onTimeout:function(t,A,U){u.resetLoader(s,i),e(new b({type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,part:g,networkDetails:U}))}})})},n.updateStatsFromPart=function(s,g){var d=s.stats,u=g.stats,m=u.total;if(d.loaded+=u.loaded,m){var h=Math.round(s.duration/g.duration),a=Math.min(Math.round(d.loaded/m),h),r=h-a,e=r*Math.round(d.loaded/a);d.total=d.loaded+e}else d.total=Math.max(d.loaded,d.total);var i=d.loading,v=u.loading;i.start?i.first+=v.first-v.start:(i.start=v.start,i.first=v.first),i.end=v.end},n.resetLoader=function(s,g){s.loader=null,this.loader===g&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),g.destroy()},p}();function x(p,n){n===void 0&&(n=null);var l=n||p,s={frag:p,part:n,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},g=l.byteRangeStartOffset,d=l.byteRangeEndOffset;return Object(N.isFiniteNumber)(g)&&Object(N.isFiniteNumber)(d)&&(s.rangeStart=g,s.rangeEnd=d),s}var b=function(p){R(n,p);function n(l){for(var s,g=arguments.length,d=new Array(g>1?g-1:0),u=1;u<g;u++)d[u-1]=arguments[u];return s=p.call.apply(p,[this].concat(d))||this,s.data=void 0,s.data=l,s}return n}(I(Error))},"./src/loader/fragment.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"ElementaryStreamTypes",function(){return C}),w.d(j,"BaseSegment",function(){return x}),w.d(j,"Fragment",function(){return b}),w.d(j,"Part",function(){return p});var N=w("./src/polyfills/number.ts"),E=w("./node_modules/url-toolkit/src/url-toolkit.js"),R=w.n(E),I=w("./src/utils/logger.ts"),M=w("./src/loader/level-key.ts"),T=w("./src/loader/load-stats.ts");function P(n,l){n.prototype=Object.create(l.prototype),n.prototype.constructor=n,_(n,l)}function _(n,l){return _=Object.setPrototypeOf||function(g,d){return g.__proto__=d,g},_(n,l)}function S(n,l){for(var s=0;s<l.length;s++){var g=l[s];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(n,g.key,g)}}function O(n,l,s){return l&&S(n.prototype,l),s&&S(n,s),n}var C;(function(n){n.AUDIO="audio",n.VIDEO="video",n.AUDIOVIDEO="audiovideo"})(C||(C={}));var x=function(){function n(s){var g;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(g={},g[C.AUDIO]=null,g[C.VIDEO]=null,g[C.AUDIOVIDEO]=null,g),this.baseurl=s}var l=n.prototype;return l.setByteRange=function(g,d){var u=g.split("@",2),m=[];u.length===1?m[0]=d?d.byteRangeEndOffset:0:m[0]=parseInt(u[1]),m[1]=parseInt(u[0])+m[0],this._byteRange=m},O(n,[{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(E.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(g){this._url=g}}]),n}(),b=function(n){P(l,n);function l(g,d){var u;return u=n.call(this,d)||this,u._decryptdata=null,u.rawProgramDateTime=null,u.programDateTime=null,u.tagList=[],u.duration=0,u.sn=0,u.levelkey=void 0,u.type=void 0,u.loader=null,u.level=-1,u.cc=0,u.startPTS=void 0,u.endPTS=void 0,u.appendedPTS=void 0,u.startDTS=void 0,u.endDTS=void 0,u.start=0,u.deltaPTS=void 0,u.maxStartPTS=void 0,u.minEndPTS=void 0,u.stats=new T.LoadStats,u.urlId=0,u.data=void 0,u.bitrateTest=!1,u.title=null,u.initSegment=null,u.type=g,u}var s=l.prototype;return s.createInitializationVector=function(d){for(var u=new Uint8Array(16),m=12;m<16;m++)u[m]=d>>8*(15-m)&255;return u},s.setDecryptDataFromLevelKey=function(d,u){var m=d;return(d==null?void 0:d.method)==="AES-128"&&d.uri&&!d.iv&&(m=M.LevelKey.fromURI(d.uri),m.method=d.method,m.iv=this.createInitializationVector(u),m.keyFormat="identity"),m},s.setElementaryStreamInfo=function(d,u,m,h,a,r){r===void 0&&(r=!1);var e=this.elementaryStreams,i=e[d];if(!i){e[d]={startPTS:u,endPTS:m,startDTS:h,endDTS:a,partial:r};return}i.startPTS=Math.min(i.startPTS,u),i.endPTS=Math.max(i.endPTS,m),i.startDTS=Math.min(i.startDTS,h),i.endDTS=Math.max(i.endDTS,a)},s.clearElementaryStreamInfo=function(){var d=this.elementaryStreams;d[C.AUDIO]=null,d[C.VIDEO]=null,d[C.AUDIOVIDEO]=null},O(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var d=this.sn;typeof d!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&I.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),d=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,d)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(N.isFiniteNumber)(this.programDateTime))return null;var d=Object(N.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+d*1e3}},{key:"encrypted",get:function(){var d;return!!((d=this.decryptdata)!==null&&d!==void 0&&d.keyFormat&&this.decryptdata.uri)}}]),l}(x),p=function(n){P(l,n);function l(s,g,d,u,m){var h;h=n.call(this,d)||this,h.fragOffset=0,h.duration=0,h.gap=!1,h.independent=!1,h.relurl=void 0,h.fragment=void 0,h.index=void 0,h.stats=new T.LoadStats,h.duration=s.decimalFloatingPoint("DURATION"),h.gap=s.bool("GAP"),h.independent=s.bool("INDEPENDENT"),h.relurl=s.enumeratedString("URI"),h.fragment=g,h.index=u;var a=s.enumeratedString("BYTERANGE");return a&&h.setByteRange(a,m),m&&(h.fragOffset=m.fragOffset+m.duration),h}return O(l,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var g=this.elementaryStreams;return!!(g.audio||g.video||g.audiovideo)}}]),l}(x)},"./src/loader/key-loader.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"default",function(){return I});var N=w("./src/events.ts"),E=w("./src/errors.ts"),R=w("./src/utils/logger.ts"),I=function(){function M(P){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=P,this._registerListeners()}var T=M.prototype;return T._registerListeners=function(){this.hls.on(N.Events.KEY_LOADING,this.onKeyLoading,this)},T._unregisterListeners=function(){this.hls.off(N.Events.KEY_LOADING,this.onKeyLoading)},T.destroy=function(){this._unregisterListeners();for(var _ in this.loaders){var S=this.loaders[_];S&&S.destroy()}this.loaders={}},T.onKeyLoading=function(_,S){var O=S.frag,C=O.type,x=this.loaders[C];if(!O.decryptdata){R.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var b=O.decryptdata.uri;if(b!==this.decrypturl||this.decryptkey===null){var p=this.hls.config;if(x&&(R.logger.warn("abort previous key loader for type:"+C),x.abort()),!b){R.logger.warn("key uri is falsy");return}var n=p.loader,l=O.loader=this.loaders[C]=new n(p);this.decrypturl=b,this.decryptkey=null;var s={url:b,frag:O,responseType:"arraybuffer"},g={timeout:p.fragLoadingTimeOut,maxRetry:0,retryDelay:p.fragLoadingRetryDelay,maxRetryDelay:p.fragLoadingMaxRetryTimeout,highWaterMark:0},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(s,g,d)}else this.decryptkey&&(O.decryptdata.key=this.decryptkey,this.hls.trigger(N.Events.KEY_LOADED,{frag:O}))},T.loadsuccess=function(_,S,O){var C=O.frag;if(!C.decryptdata){R.logger.error("after key load, decryptdata unset");return}this.decryptkey=C.decryptdata.key=new Uint8Array(_.data),C.loader=null,delete this.loaders[C.type],this.hls.trigger(N.Events.KEY_LOADED,{frag:C})},T.loaderror=function(_,S){var O=S.frag,C=O.loader;C&&C.abort(),delete this.loaders[O.type],this.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:O,response:_})},T.loadtimeout=function(_,S){var O=S.frag,C=O.loader;C&&C.abort(),delete this.loaders[O.type],this.hls.trigger(N.Events.ERROR,{type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:O})},M}()},"./src/loader/level-details.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"LevelDetails",function(){return M});var N=w("./src/polyfills/number.ts");function E(T,P){for(var _=0;_<P.length;_++){var S=P[_];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(T,S.key,S)}}function R(T,P,_){return P&&E(T.prototype,P),_&&E(T,_),T}var I=10,M=function(){function 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=_}var P=T.prototype;return P.reloaded=function(S){if(!S){this.advanced=!0,this.updated=!0;return}var O=this.lastPartSn-S.lastPartSn,C=this.lastPartIndex-S.lastPartIndex;this.updated=this.endSN!==S.endSN||!!C||!!O,this.advanced=this.endSN>S.endSN||O>0||O===0&&C>0,this.updated||this.advanced?this.misses=Math.floor(S.misses*.6):this.misses=S.misses+1,this.availabilityDelay=S.availabilityDelay},R(T,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(N.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||I}},{key:"drift",get:function(){var S=this.driftEndTime-this.driftStartTime;if(S>0){var O=this.driftEnd-this.driftStart;return O*1e3/S}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var S;return(S=this.fragments)!==null&&S!==void 0&&S.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 S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),T}()},"./src/loader/level-key.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"LevelKey",function(){return M});var N=w("./node_modules/url-toolkit/src/url-toolkit.js"),E=w.n(N);function R(T,P){for(var _=0;_<P.length;_++){var S=P[_];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(T,S.key,S)}}function I(T,P,_){return P&&R(T.prototype,P),_&&R(T,_),T}var M=function(){T.fromURL=function(_,S){return new T(_,S)},T.fromURI=function(_){return new T(_)};function T(P,_){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,_?this._uri=Object(N.buildAbsoluteURL)(P,_,{alwaysNormalize:!0}):this._uri=P}return I(T,[{key:"uri",get:function(){return this._uri}}]),T}()},"./src/loader/load-stats.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"LoadStats",function(){return N});var N=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"default",function(){return l});var N=w("./src/polyfills/number.ts"),E=w("./node_modules/url-toolkit/src/url-toolkit.js"),R=w.n(E),I=w("./src/loader/fragment.ts"),M=w("./src/loader/level-details.ts"),T=w("./src/loader/level-key.ts"),P=w("./src/utils/attr-list.ts"),_=w("./src/utils/logger.ts"),S=w("./src/utils/codecs.ts"),O=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,C=/#EXT-X-MEDIA:(.*)/g,x=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),b=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("|")),p=/\.(mp4|m4s|m4v|m4a)$/i;function n(m){var h,a;return p.test((h=(a=E.parseURL(m))===null||a===void 0?void 0:a.path)!=null?h:"")}var l=function(){function m(){}return m.findGroup=function(a,r){for(var e=0;e<a.length;e++){var i=a[e];if(i.id===r)return i}},m.convertAVC1ToAVCOTI=function(a){var r=a.split(".");if(r.length>2){var e=r.shift()+".";return e+=parseInt(r.shift()).toString(16),e+=("000"+parseInt(r.shift()).toString(16)).substr(-4),e}return a},m.resolve=function(a,r){return E.buildAbsoluteURL(r,a,{alwaysNormalize:!0})},m.parseMasterPlaylist=function(a,r){var e=[],i={},v=!1;O.lastIndex=0;for(var f;(f=O.exec(a))!=null;)if(f[1]){var y=new P.AttrList(f[1]),t={attrs:y,bitrate:y.decimalInteger("AVERAGE-BANDWIDTH")||y.decimalInteger("BANDWIDTH"),name:y.NAME,url:m.resolve(f[2],r)},A=y.decimalResolution("RESOLUTION");A&&(t.width=A.width,t.height=A.height),s((y.CODECS||"").split(/[ ,]+/).filter(function(F){return F}),t),t.videoCodec&&t.videoCodec.indexOf("avc1")!==-1&&(t.videoCodec=m.convertAVC1ToAVCOTI(t.videoCodec)),e.push(t)}else if(f[3]){var U=new P.AttrList(f[3]);U["DATA-ID"]&&(v=!0,i[U["DATA-ID"]]=U)}return{levels:e,sessionData:v?i:null}},m.parseMasterPlaylistMedia=function(a,r,e,i){i===void 0&&(i=[]);var v,f=[],y=0;for(C.lastIndex=0;(v=C.exec(a))!==null;){var t=new P.AttrList(v[1]);if(t.TYPE===e){var A={attrs:t,bitrate:0,id:y++,groupId:t["GROUP-ID"],instreamId:t["INSTREAM-ID"],name:t.NAME||t.LANGUAGE||"",type:e,default:t.bool("DEFAULT"),autoselect:t.bool("AUTOSELECT"),forced:t.bool("FORCED"),lang:t.LANGUAGE,url:t.URI?m.resolve(t.URI,r):""};if(i.length){var U=m.findGroup(i,A.groupId)||i[0];g(A,U,"audioCodec"),g(A,U,"textCodec")}f.push(A)}}return f},m.parseLevelPlaylist=function(a,r,e,i,v){var f=new M.LevelDetails(r),y=f.fragments,t=null,A=0,U=0,F=0,H=0,J=null,B=new I.Fragment(i,r),Z,re,ie,ve=-1,de=!1;for(x.lastIndex=0,f.m3u8=a;(Z=x.exec(a))!==null;){de&&(de=!1,B=new I.Fragment(i,r),B.start=F,B.sn=A,B.cc=H,B.level=e,t&&(B.initSegment=t,B.rawProgramDateTime=t.rawProgramDateTime));var q=Z[1];if(q){B.duration=parseFloat(q);var ee=(" "+Z[2]).slice(1);B.title=ee||null,B.tagList.push(ee?["INF",q,ee]:["INF",q])}else if(Z[3])Object(N.isFiniteNumber)(B.duration)&&(B.start=F,ie&&(B.levelkey=ie),B.sn=A,B.level=e,B.cc=H,B.urlId=v,y.push(B),B.relurl=(" "+Z[3]).slice(1),u(B,J),J=B,F+=B.duration,A++,U=0,de=!0);else if(Z[4]){var pe=(" "+Z[4]).slice(1);J?B.setByteRange(pe,J):B.setByteRange(pe)}else if(Z[5])B.rawProgramDateTime=(" "+Z[5]).slice(1),B.tagList.push(["PROGRAM-DATE-TIME",B.rawProgramDateTime]),ve===-1&&(ve=y.length);else{if(Z=Z[0].match(b),!Z){_.logger.warn("No matches on slow regex match for level playlist!");continue}for(re=1;re<Z.length&&!(typeof Z[re]!="undefined");re++);var Q=(" "+Z[re]).slice(1),V=(" "+Z[re+1]).slice(1),Ce=Z[re+2]?(" "+Z[re+2]).slice(1):"";switch(Q){case"PLAYLIST-TYPE":f.type=V.toUpperCase();break;case"MEDIA-SEQUENCE":A=f.startSN=parseInt(V);break;case"SKIP":{var ke=new P.AttrList(V),Ue=ke.decimalInteger("SKIPPED-SEGMENTS");if(Object(N.isFiniteNumber)(Ue)){f.skippedSegments=Ue;for(var we=Ue;we--;)y.unshift(null);A+=Ue}var De=ke.enumeratedString("RECENTLY-REMOVED-DATERANGES");De&&(f.recentlyRemovedDateranges=De.split(" "));break}case"TARGETDURATION":f.targetduration=parseFloat(V);break;case"VERSION":f.version=parseInt(V);break;case"EXTM3U":break;case"ENDLIST":f.live=!1;break;case"#":(V||Ce)&&B.tagList.push(Ce?[V,Ce]:[V]);break;case"DIS":H++;case"GAP":B.tagList.push([Q]);break;case"BITRATE":B.tagList.push([Q,V]);break;case"DISCONTINUITY-SEQ":H=parseInt(V);break;case"KEY":{var Oe,Le=new P.AttrList(V),Ke=Le.enumeratedString("METHOD"),Fe=Le.URI,He=Le.hexadecimalInteger("IV"),Ne=Le.enumeratedString("KEYFORMATVERSIONS"),xe=Le.enumeratedString("KEYID"),Ge=(Oe=Le.enumeratedString("KEYFORMAT"))!=null?Oe:"identity",qe=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(qe.indexOf(Ge)>-1){_.logger.warn("Keyformat "+Ge+" is not supported from the manifest");continue}else if(Ge!=="identity")continue;Ke&&(ie=T.LevelKey.fromURL(r,Fe),Fe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ke)>=0&&(ie.method=Ke,ie.keyFormat=Ge,xe&&(ie.keyID=xe),Ne&&(ie.keyFormatVersions=Ne),ie.iv=He));break}case"START":{var lt=new P.AttrList(V),ot=lt.decimalFloatingPoint("TIME-OFFSET");Object(N.isFiniteNumber)(ot)&&(f.startTimeOffset=ot);break}case"MAP":{var bt=new P.AttrList(V);B.relurl=bt.URI,bt.BYTERANGE&&B.setByteRange(bt.BYTERANGE),B.level=e,B.sn="initSegment",ie&&(B.levelkey=ie),B.initSegment=null,t=B,de=!0;break}case"SERVER-CONTROL":{var ht=new P.AttrList(V);f.canBlockReload=ht.bool("CAN-BLOCK-RELOAD"),f.canSkipUntil=ht.optionalFloat("CAN-SKIP-UNTIL",0),f.canSkipDateRanges=f.canSkipUntil>0&&ht.bool("CAN-SKIP-DATERANGES"),f.partHoldBack=ht.optionalFloat("PART-HOLD-BACK",0),f.holdBack=ht.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var ut=new P.AttrList(V);f.partTarget=ut.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ze=f.partList;Ze||(Ze=f.partList=[]);var Et=U>0?Ze[Ze.length-1]:void 0,St=U++,We=new I.Part(new P.AttrList(V),B,r,St,Et);Ze.push(We),B.duration+=We.duration;break}case"PRELOAD-HINT":{var it=new P.AttrList(V);f.preloadHint=it;break}case"RENDITION-REPORT":{var ye=new P.AttrList(V);f.renditionReports=f.renditionReports||[],f.renditionReports.push(ye);break}default:_.logger.warn("line parsed but not handled: "+Z);break}}}J&&!J.relurl?(y.pop(),F-=J.duration,f.partList&&(f.fragmentHint=J)):f.partList&&(u(B,J),B.cc=H,f.fragmentHint=B);var he=y.length,fe=y[0],X=y[he-1];if(F+=f.skippedSegments*f.targetduration,F>0&&he&&X){f.averagetargetduration=F/he;var $=X.sn;f.endSN=$!=="initSegment"?$:0,fe&&(f.startCC=fe.cc,fe.initSegment||f.fragments.every(function(te){return te.relurl&&n(te.relurl)})&&(_.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),B=new I.Fragment(i,r),B.relurl=X.relurl,B.level=e,B.sn="initSegment",fe.initSegment=B,f.needSidxRanges=!0))}else f.endSN=0,f.startCC=0;return f.fragmentHint&&(F+=f.fragmentHint.duration),f.totalduration=F,f.endCC=H,ve>0&&d(y,ve),f},m}();function s(m,h){["video","audio","text"].forEach(function(a){var r=m.filter(function(i){return Object(S.isCodecType)(i,a)});if(r.length){var e=r.filter(function(i){return i.lastIndexOf("avc1",0)===0||i.lastIndexOf("mp4a",0)===0});h[a+"Codec"]=e.length>0?e[0]:r[0],m=m.filter(function(i){return r.indexOf(i)===-1})}}),h.unknownCodecs=m}function g(m,h,a){var r=h[a];r&&(m[a]=r)}function d(m,h){for(var a=m[h],r=h;r--;){var e=m[r];if(!e)return;e.programDateTime=a.programDateTime-e.duration*1e3,a=e}}function u(m,h){m.rawProgramDateTime?m.programDateTime=Date.parse(m.rawProgramDateTime):h!=null&&h.programDateTime&&(m.programDateTime=h.endProgramDateTime),Object(N.isFiniteNumber)(m.programDateTime)||(m.programDateTime=null,m.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(Ee,j,w){"use strict";w.r(j);var N=w("./src/polyfills/number.ts"),E=w("./src/events.ts"),R=w("./src/errors.ts"),I=w("./src/utils/logger.ts"),M=w("./src/utils/mp4-tools.ts"),T=w("./src/loader/m3u8-parser.ts"),P=w("./src/types/loader.ts"),_=w("./src/utils/attr-list.ts");function S(x){var b=x.type;switch(b){case P.PlaylistContextType.AUDIO_TRACK:return P.PlaylistLevelType.AUDIO;case P.PlaylistContextType.SUBTITLE_TRACK:return P.PlaylistLevelType.SUBTITLE;default:return P.PlaylistLevelType.MAIN}}function O(x,b){var p=x.url;return(p===void 0||p.indexOf("data:")===0)&&(p=b.url),p}var C=function(){function x(p){this.hls=void 0,this.loaders=Object.create(null),this.hls=p,this.registerListeners()}var b=x.prototype;return b.registerListeners=function(){var n=this.hls;n.on(E.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(E.Events.LEVEL_LOADING,this.onLevelLoading,this),n.on(E.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),n.on(E.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.unregisterListeners=function(){var n=this.hls;n.off(E.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(E.Events.LEVEL_LOADING,this.onLevelLoading,this),n.off(E.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),n.off(E.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.createInternalLoader=function(n){var l=this.hls.config,s=l.pLoader,g=l.loader,d=s||g,u=new d(l);return n.loader=u,this.loaders[n.type]=u,u},b.getInternalLoader=function(n){return this.loaders[n.type]},b.resetInternalLoader=function(n){this.loaders[n]&&delete this.loaders[n]},b.destroyInternalLoaders=function(){for(var n in this.loaders){var l=this.loaders[n];l&&l.destroy(),this.resetInternalLoader(n)}},b.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},b.onManifestLoading=function(n,l){var s=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:P.PlaylistContextType.MANIFEST,url:s,deliveryDirectives:null})},b.onLevelLoading=function(n,l){var s=l.id,g=l.level,d=l.url,u=l.deliveryDirectives;this.load({id:s,groupId:null,level:g,responseType:"text",type:P.PlaylistContextType.LEVEL,url:d,deliveryDirectives:u})},b.onAudioTrackLoading=function(n,l){var s=l.id,g=l.groupId,d=l.url,u=l.deliveryDirectives;this.load({id:s,groupId:g,level:null,responseType:"text",type:P.PlaylistContextType.AUDIO_TRACK,url:d,deliveryDirectives:u})},b.onSubtitleTrackLoading=function(n,l){var s=l.id,g=l.groupId,d=l.url,u=l.deliveryDirectives;this.load({id:s,groupId:g,level:null,responseType:"text",type:P.PlaylistContextType.SUBTITLE_TRACK,url:d,deliveryDirectives:u})},b.load=function(n){var l,s=this.hls.config,g=this.getInternalLoader(n);if(g){var d=g.context;if(d&&d.url===n.url){I.logger.trace("[playlist-loader]: playlist request ongoing");return}I.logger.log("[playlist-loader]: aborting previous loader for type: "+n.type),g.abort()}var u,m,h,a;switch(n.type){case P.PlaylistContextType.MANIFEST:u=s.manifestLoadingMaxRetry,m=s.manifestLoadingTimeOut,h=s.manifestLoadingRetryDelay,a=s.manifestLoadingMaxRetryTimeout;break;case P.PlaylistContextType.LEVEL:case P.PlaylistContextType.AUDIO_TRACK:case P.PlaylistContextType.SUBTITLE_TRACK:u=0,m=s.levelLoadingTimeOut;break;default:u=s.levelLoadingMaxRetry,m=s.levelLoadingTimeOut,h=s.levelLoadingRetryDelay,a=s.levelLoadingMaxRetryTimeout;break}if(g=this.createInternalLoader(n),(l=n.deliveryDirectives)!==null&&l!==void 0&&l.part){var r;if(n.type===P.PlaylistContextType.LEVEL&&n.level!==null?r=this.hls.levels[n.level].details:n.type===P.PlaylistContextType.AUDIO_TRACK&&n.id!==null?r=this.hls.audioTracks[n.id].details:n.type===P.PlaylistContextType.SUBTITLE_TRACK&&n.id!==null&&(r=this.hls.subtitleTracks[n.id].details),r){var e=r.partTarget,i=r.targetduration;e&&i&&(m=Math.min(Math.max(e*3,i*.8)*1e3,m))}}var v={timeout:m,maxRetry:u,retryDelay:h,maxRetryDelay:a,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};g.load(n,v,f)},b.loadsuccess=function(n,l,s,g){if(g===void 0&&(g=null),s.isSidxRequest){this.handleSidxRequest(n,s),this.handlePlaylistLoaded(n,l,s,g);return}this.resetInternalLoader(s.type);var d=n.data;if(d.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(n,s,"no EXTM3U delimiter",g);return}l.parsing.start=performance.now(),d.indexOf("#EXTINF:")>0||d.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(n,l,s,g):this.handleMasterPlaylist(n,l,s,g)},b.loaderror=function(n,l,s){s===void 0&&(s=null),this.handleNetworkError(l,s,!1,n)},b.loadtimeout=function(n,l,s){s===void 0&&(s=null),this.handleNetworkError(l,s,!0)},b.handleMasterPlaylist=function(n,l,s,g){var d=this.hls,u=n.data,m=O(n,s),h=T.default.parseMasterPlaylist(u,m),a=h.levels,r=h.sessionData;if(!a.length){this.handleManifestParsingError(n,s,"no level found in manifest",g);return}var e=a.map(function(A){return{id:A.attrs.AUDIO,audioCodec:A.audioCodec}}),i=a.map(function(A){return{id:A.attrs.SUBTITLES,textCodec:A.textCodec}}),v=T.default.parseMasterPlaylistMedia(u,m,"AUDIO",e),f=T.default.parseMasterPlaylistMedia(u,m,"SUBTITLES",i),y=T.default.parseMasterPlaylistMedia(u,m,"CLOSED-CAPTIONS");if(v.length){var t=v.some(function(A){return!A.url});!t&&a[0].audioCodec&&!a[0].attrs.AUDIO&&(I.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),v.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new _.AttrList({}),bitrate:0,url:""}))}d.trigger(E.Events.MANIFEST_LOADED,{levels:a,audioTracks:v,subtitles:f,captions:y,url:m,stats:l,networkDetails:g,sessionData:r})},b.handleTrackOrLevelPlaylist=function(n,l,s,g){var d=this.hls,u=s.id,m=s.level,h=s.type,a=O(n,s),r=Object(N.isFiniteNumber)(u)?u:0,e=Object(N.isFiniteNumber)(m)?m:r,i=S(s),v=T.default.parseLevelPlaylist(n.data,a,e,i,r);if(!v.fragments.length){d.trigger(E.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:a,reason:"no fragments found in level",level:typeof s.level=="number"?s.level:void 0});return}if(h===P.PlaylistContextType.MANIFEST){var f={attrs:new _.AttrList({}),bitrate:0,details:v,name:"",url:a};d.trigger(E.Events.MANIFEST_LOADED,{levels:[f],audioTracks:[],url:a,stats:l,networkDetails:g,sessionData:null})}if(l.parsing.end=performance.now(),v.needSidxRanges){var y,t=(y=v.fragments[0].initSegment)===null||y===void 0?void 0:y.url;this.load({url:t,isSidxRequest:!0,type:h,level:m,levelDetails:v,id:u,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}s.levelDetails=v,this.handlePlaylistLoaded(n,l,s,g)},b.handleSidxRequest=function(n,l){var s=Object(M.parseSegmentIndex)(new Uint8Array(n.data));if(!s)return;var g=s.references,d=l.levelDetails;g.forEach(function(u,m){var h=u.info,a=d.fragments[m];a.byteRange.length===0&&a.setByteRange(String(1+h.end-h.start)+"@"+String(h.start)),a.initSegment&&a.initSegment.setByteRange(String(s.moovEndOffset)+"@0")})},b.handleManifestParsingError=function(n,l,s,g){this.hls.trigger(E.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===P.PlaylistContextType.MANIFEST,url:n.url,reason:s,response:n,context:l,networkDetails:g})},b.handleNetworkError=function(n,l,s,g){s===void 0&&(s=!1),I.logger.warn("[playlist-loader]: A network "+(s?"timeout":"error")+" occurred while loading "+n.type+" level: "+n.level+" id: "+n.id+' group-id: "'+n.groupId+'"');var d=R.ErrorDetails.UNKNOWN,u=!1,m=this.getInternalLoader(n);switch(n.type){case P.PlaylistContextType.MANIFEST:d=s?R.ErrorDetails.MANIFEST_LOAD_TIMEOUT:R.ErrorDetails.MANIFEST_LOAD_ERROR,u=!0;break;case P.PlaylistContextType.LEVEL:d=s?R.ErrorDetails.LEVEL_LOAD_TIMEOUT:R.ErrorDetails.LEVEL_LOAD_ERROR,u=!1;break;case P.PlaylistContextType.AUDIO_TRACK:d=s?R.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:R.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case P.PlaylistContextType.SUBTITLE_TRACK:d=s?R.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:R.ErrorDetails.SUBTITLE_LOAD_ERROR,u=!1;break}m&&this.resetInternalLoader(n.type);var h={type:R.ErrorTypes.NETWORK_ERROR,details:d,fatal:u,url:n.url,loader:m,context:n,networkDetails:l};g&&(h.response=g),this.hls.trigger(E.Events.ERROR,h)},b.handlePlaylistLoaded=function(n,l,s,g){var d=s.type,u=s.level,m=s.id,h=s.groupId,a=s.loader,r=s.levelDetails,e=s.deliveryDirectives;if(!(r!=null&&r.targetduration)){this.handleManifestParsingError(n,s,"invalid target duration",g);return}if(!a)return;r.live&&(a.getCacheAge&&(r.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(r.ageHeader))&&(r.ageHeader=0));switch(d){case P.PlaylistContextType.MANIFEST:case P.PlaylistContextType.LEVEL:this.hls.trigger(E.Events.LEVEL_LOADED,{details:r,level:u||0,id:m||0,stats:l,networkDetails:g,deliveryDirectives:e});break;case P.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(E.Events.AUDIO_TRACK_LOADED,{details:r,id:m||0,groupId:h||"",stats:l,networkDetails:g,deliveryDirectives:e});break;case P.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(E.Events.SUBTITLE_TRACK_LOADED,{details:r,id:m||0,groupId:h||"",stats:l,networkDetails:g,deliveryDirectives:e});break}},x}();j.default=C},"./src/polyfills/number.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"isFiniteNumber",function(){return N}),w.d(j,"MAX_SAFE_INTEGER",function(){return E});var N=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},E=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(Ee,j,w){"use strict";w.r(j);var N=function(){function E(){}return E.getSilentFrame=function(I,M){switch(I){case"mp4a.40.2":if(M===1)return new Uint8Array([0,200,0,128,35,128]);if(M===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(M===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(M===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(M===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(M===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(M===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(M===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(M===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},E}();j.default=N},"./src/remux/mp4-generator.ts":function(Ee,j,w){"use strict";w.r(j);var N=Math.pow(2,32)-1,E=function(){function R(){}return R.init=function(){R.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var M;for(M in R.types)R.types.hasOwnProperty(M)&&(R.types[M]=[M.charCodeAt(0),M.charCodeAt(1),M.charCodeAt(2),M.charCodeAt(3)]);var T=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]),P=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]);R.HDLR_TYPES={video:T,audio:P};var _=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]);R.STTS=R.STSC=R.STCO=S,R.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),R.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),R.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),R.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var O=new Uint8Array([105,115,111,109]),C=new Uint8Array([97,118,99,49]),x=new Uint8Array([0,0,0,1]);R.FTYP=R.box(R.types.ftyp,O,x,O,C),R.DINF=R.box(R.types.dinf,R.box(R.types.dref,_))},R.box=function(M){for(var T=8,P=arguments.length,_=new Array(P>1?P-1:0),S=1;S<P;S++)_[S-1]=arguments[S];for(var O=_.length,C=O;O--;)T+=_[O].byteLength;var x=new Uint8Array(T);for(x[0]=T>>24&255,x[1]=T>>16&255,x[2]=T>>8&255,x[3]=T&255,x.set(M,4),O=0,T=8;O<C;O++)x.set(_[O],T),T+=_[O].byteLength;return x},R.hdlr=function(M){return R.box(R.types.hdlr,R.HDLR_TYPES[M])},R.mdat=function(M){return R.box(R.types.mdat,M)},R.mdhd=function(M,T){T*=M;var P=Math.floor(T/(N+1)),_=Math.floor(T%(N+1));return R.box(R.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,M&255,P>>24,P>>16&255,P>>8&255,P&255,_>>24,_>>16&255,_>>8&255,_&255,85,196,0,0]))},R.mdia=function(M){return R.box(R.types.mdia,R.mdhd(M.timescale,M.duration),R.hdlr(M.type),R.minf(M))},R.mfhd=function(M){return R.box(R.types.mfhd,new Uint8Array([0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255]))},R.minf=function(M){return M.type==="audio"?R.box(R.types.minf,R.box(R.types.smhd,R.SMHD),R.DINF,R.stbl(M)):R.box(R.types.minf,R.box(R.types.vmhd,R.VMHD),R.DINF,R.stbl(M))},R.moof=function(M,T,P){return R.box(R.types.moof,R.mfhd(M),R.traf(P,T))},R.moov=function(M){for(var T=M.length,P=[];T--;)P[T]=R.trak(M[T]);return R.box.apply(null,[R.types.moov,R.mvhd(M[0].timescale,M[0].duration)].concat(P).concat(R.mvex(M)))},R.mvex=function(M){for(var T=M.length,P=[];T--;)P[T]=R.trex(M[T]);return R.box.apply(null,[R.types.mvex].concat(P))},R.mvhd=function(M,T){T*=M;var P=Math.floor(T/(N+1)),_=Math.floor(T%(N+1)),S=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,M&255,P>>24,P>>16&255,P>>8&255,P&255,_>>24,_>>16&255,_>>8&255,_&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return R.box(R.types.mvhd,S)},R.sdtp=function(M){var T=M.samples||[],P=new Uint8Array(4+T.length),_,S;for(_=0;_<T.length;_++)S=T[_].flags,P[_+4]=S.dependsOn<<4|S.isDependedOn<<2|S.hasRedundancy;return R.box(R.types.sdtp,P)},R.stbl=function(M){return R.box(R.types.stbl,R.stsd(M),R.box(R.types.stts,R.STTS),R.box(R.types.stsc,R.STSC),R.box(R.types.stsz,R.STSZ),R.box(R.types.stco,R.STCO))},R.avc1=function(M){var T=[],P=[],_,S,O;for(_=0;_<M.sps.length;_++)S=M.sps[_],O=S.byteLength,T.push(O>>>8&255),T.push(O&255),T=T.concat(Array.prototype.slice.call(S));for(_=0;_<M.pps.length;_++)S=M.pps[_],O=S.byteLength,P.push(O>>>8&255),P.push(O&255),P=P.concat(Array.prototype.slice.call(S));var C=R.box(R.types.avcC,new Uint8Array([1,T[3],T[4],T[5],252|3,224|M.sps.length].concat(T).concat([M.pps.length]).concat(P))),x=M.width,b=M.height,p=M.pixelRatio[0],n=M.pixelRatio[1];return R.box(R.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,x>>8&255,x&255,b>>8&255,b&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),C,R.box(R.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),R.box(R.types.pasp,new Uint8Array([p>>24,p>>16&255,p>>8&255,p&255,n>>24,n>>16&255,n>>8&255,n&255])))},R.esds=function(M){var T=M.config.length;return new Uint8Array([0,0,0,0,3,23+T,0,1,0,4,15+T,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([T]).concat(M.config).concat([6,1,2]))},R.mp4a=function(M){var T=M.samplerate;return R.box(R.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,M.channelCount,0,16,0,0,0,0,T>>8&255,T&255,0,0]),R.box(R.types.esds,R.esds(M)))},R.mp3=function(M){var T=M.samplerate;return R.box(R.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,M.channelCount,0,16,0,0,0,0,T>>8&255,T&255,0,0]))},R.stsd=function(M){return M.type==="audio"?!M.isAAC&&M.codec==="mp3"?R.box(R.types.stsd,R.STSD,R.mp3(M)):R.box(R.types.stsd,R.STSD,R.mp4a(M)):R.box(R.types.stsd,R.STSD,R.avc1(M))},R.tkhd=function(M){var T=M.id,P=M.duration*M.timescale,_=M.width,S=M.height,O=Math.floor(P/(N+1)),C=Math.floor(P%(N+1));return R.box(R.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,T>>24&255,T>>16&255,T>>8&255,T&255,0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,C>>24,C>>16&255,C>>8&255,C&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,_>>8&255,_&255,0,0,S>>8&255,S&255,0,0]))},R.traf=function(M,T){var P=R.sdtp(M),_=M.id,S=Math.floor(T/(N+1)),O=Math.floor(T%(N+1));return R.box(R.types.traf,R.box(R.types.tfhd,new Uint8Array([0,0,0,0,_>>24,_>>16&255,_>>8&255,_&255])),R.box(R.types.tfdt,new Uint8Array([1,0,0,0,S>>24,S>>16&255,S>>8&255,S&255,O>>24,O>>16&255,O>>8&255,O&255])),R.trun(M,P.length+16+20+8+16+8+8),P)},R.trak=function(M){return M.duration=M.duration||4294967295,R.box(R.types.trak,R.tkhd(M),R.mdia(M))},R.trex=function(M){var T=M.id;return R.box(R.types.trex,new Uint8Array([0,0,0,0,T>>24,T>>16&255,T>>8&255,T&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},R.trun=function(M,T){var P=M.samples||[],_=P.length,S=12+16*_,O=new Uint8Array(S),C,x,b,p,n,l;for(T+=8+S,O.set([0,0,15,1,_>>>24&255,_>>>16&255,_>>>8&255,_&255,T>>>24&255,T>>>16&255,T>>>8&255,T&255],0),C=0;C<_;C++)x=P[C],b=x.duration,p=x.size,n=x.flags,l=x.cts,O.set([b>>>24&255,b>>>16&255,b>>>8&255,b&255,p>>>24&255,p>>>16&255,p>>>8&255,p&255,n.isLeading<<2|n.dependsOn,n.isDependedOn<<6|n.hasRedundancy<<4|n.paddingValue<<1|n.isNonSync,n.degradPrio&240<<8,n.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*C);return R.box(R.types.trun,O)},R.initSegment=function(M){R.types||R.init();var T=R.moov(M),P=new Uint8Array(R.FTYP.byteLength+T.byteLength);return P.set(R.FTYP),P.set(T,R.FTYP.byteLength),P},R}();E.types=void 0,E.HDLR_TYPES=void 0,E.STTS=void 0,E.STSC=void 0,E.STCO=void 0,E.STSZ=void 0,E.VMHD=void 0,E.SMHD=void 0,E.STSD=void 0,E.FTYP=void 0,E.DINF=void 0,j.default=E},"./src/remux/mp4-remuxer.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"default",function(){return l}),w.d(j,"normalizePts",function(){return s});var N=w("./src/polyfills/number.ts"),E=w("./src/remux/aac-helper.ts"),R=w("./src/remux/mp4-generator.ts"),I=w("./src/events.ts"),M=w("./src/errors.ts"),T=w("./src/utils/logger.ts"),P=w("./src/types/loader.ts"),_=w("./src/utils/timescale-conversion.ts");function S(){return S=Object.assign||function(m){for(var h=1;h<arguments.length;h++){var a=arguments[h];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(m[r]=a[r])}return m},S.apply(this,arguments)}var O=10*1e3,C=1024,x=1152,b=null,p=null,n=!1,l=function(){function m(a,r,e,i){if(i===void 0&&(i=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=a,this.config=r,this.typeSupported=e,this.ISGenerated=!1,b===null){var v=navigator.userAgent||"",f=v.match(/Chrome\/(\d+)/i);b=f?parseInt(f[1]):0}if(p===null){var y=navigator.userAgent.match(/Safari\/(\d+)/i);p=y?parseInt(y[1]):0}n=!!b&&b<75||!!p&&p<600}var h=m.prototype;return h.destroy=function(){},h.resetTimeStamp=function(r){T.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=r},h.resetNextTimestamp=function(){T.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},h.resetInitSegment=function(){T.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},h.getVideoStartPts=function(r){var e=!1,i=r.reduce(function(v,f){var y=f.pts-v;return y<-4294967296?(e=!0,s(v,f.pts)):y>0?v:f.pts},r[0].pts);return e&&T.logger.debug("PTS rollover detected"),i},h.remux=function(r,e,i,v,f,y,t,A){var U,F,H,J,B,Z,re=f,ie=f,ve=r.pid>-1,de=e.pid>-1,q=e.samples.length,ee=r.samples.length>0,pe=q>1,Q=(!ve||ee)&&(!de||pe)||this.ISGenerated||t;if(Q){this.ISGenerated||(H=this.generateIS(r,e,f));var V=this.isVideoContiguous,Ce=-1;if(pe&&(Ce=g(e.samples),!V&&this.config.forceKeyFrameOnDiscontinuity))if(Z=!0,Ce>0){T.logger.warn("[mp4-remuxer]: Dropped "+Ce+" out of "+q+" video samples due to a missing keyframe");var ke=this.getVideoStartPts(e.samples);e.samples=e.samples.slice(Ce),e.dropped+=Ce,ie+=(e.samples[0].pts-ke)/(e.timescale||9e4)}else Ce===-1&&(T.logger.warn("[mp4-remuxer]: No keyframe found out of "+q+" video samples"),Z=!1);if(this.ISGenerated){if(ee&&pe){var Ue=this.getVideoStartPts(e.samples),we=s(r.samples[0].pts,Ue)-Ue,De=we/e.inputTimeScale;re+=Math.max(0,De),ie+=Math.max(0,-De)}if(ee){if(r.samplerate||(T.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),H=this.generateIS(r,e,f)),F=this.remuxAudio(r,re,this.isAudioContiguous,y,de||pe||A===P.PlaylistLevelType.AUDIO?ie:void 0),pe){var Oe=F?F.endPTS-F.startPTS:0;e.inputTimeScale||(T.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),H=this.generateIS(r,e,f)),U=this.remuxVideo(e,ie,V,Oe)}}else pe&&(U=this.remuxVideo(e,ie,V,0));U&&(U.firstKeyFrame=Ce,U.independent=Ce!==-1)}}return this.ISGenerated&&(i.samples.length&&(B=this.remuxID3(i,f)),v.samples.length&&(J=this.remuxText(v,f))),{audio:F,video:U,initSegment:H,independent:Z,text:J,id3:B}},h.generateIS=function(r,e,i){var v=r.samples,f=e.samples,y=this.typeSupported,t={},A=!Object(N.isFiniteNumber)(this._initPTS),U="audio/mp4",F,H,J;if(A&&(F=H=Infinity),r.config&&v.length&&(r.timescale=r.samplerate,r.isAAC||(y.mpeg?(U="audio/mpeg",r.codec=""):y.mp3&&(r.codec="mp3")),t.audio={id:"audio",container:U,codec:r.codec,initSegment:!r.isAAC&&y.mpeg?new Uint8Array(0):R.default.initSegment([r]),metadata:{channelCount:r.channelCount}},A&&(J=r.inputTimeScale,F=H=v[0].pts-Math.round(J*i))),e.sps&&e.pps&&f.length&&(e.timescale=e.inputTimeScale,t.video={id:"main",container:"video/mp4",codec:e.codec,initSegment:R.default.initSegment([e]),metadata:{width:e.width,height:e.height}},A)){J=e.inputTimeScale;var B=this.getVideoStartPts(f),Z=Math.round(J*i);H=Math.min(H,s(f[0].dts,B)-Z),F=Math.min(F,B-Z)}if(Object.keys(t).length)return this.ISGenerated=!0,A&&(this._initPTS=F,this._initDTS=H),{tracks:t,initPTS:F,timescale:J}},h.remuxVideo=function(r,e,i,v){var f=r.inputTimeScale,y=r.samples,t=[],A=y.length,U=this._initPTS,F=this.nextAvcDts,H=8,J,B,Z,re=Number.POSITIVE_INFINITY,ie=Number.NEGATIVE_INFINITY,ve=0,de=!1;if(!i||F===null){var q=e*f,ee=y[0].pts-s(y[0].dts,y[0].pts);F=q-ee}for(var pe=0;pe<A;pe++){var Q=y[pe];if(Q.pts=s(Q.pts-U,F),Q.dts=s(Q.dts-U,F),Q.dts>Q.pts){var V=9e4*.2;ve=Math.max(Math.min(ve,Q.pts-Q.dts),-1*V)}Q.dts<y[pe>0?pe-1:pe].dts&&(de=!0)}de&&y.sort(function(an,fn){var It=an.dts-fn.dts,Kn=an.pts-fn.pts;return It||Kn}),B=y[0].dts,Z=y[y.length-1].dts;var Ce=Math.round((Z-B)/(A-1));if(ve<0){if(ve<Ce*-2){T.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(_.toMsFromMpegTsClock)(-Ce,!0)+" ms");for(var ke=ve,Ue=0;Ue<A;Ue++)y[Ue].dts=ke=Math.max(ke,y[Ue].pts-Ce),y[Ue].pts=Math.max(ke,y[Ue].pts)}else{T.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(_.toMsFromMpegTsClock)(ve,!0)+" ms to overcome this issue");for(var we=0;we<A;we++)y[we].dts=y[we].dts+ve}B=y[0].dts}if(i){var De=B-F,Oe=De>Ce,Le=De<-1;if(Oe||Le){Oe?T.logger.warn("AVC: "+Object(_.toMsFromMpegTsClock)(De,!0)+" ms ("+De+"dts) hole between fragments detected, filling it"):T.logger.warn("AVC: "+Object(_.toMsFromMpegTsClock)(-De,!0)+" ms ("+De+"dts) overlapping between fragments detected"),B=F;var Ke=y[0].pts-De;y[0].dts=B,y[0].pts=Ke,T.logger.log("Video: First PTS/DTS adjusted: "+Object(_.toMsFromMpegTsClock)(Ke,!0)+"/"+Object(_.toMsFromMpegTsClock)(B,!0)+", delta: "+Object(_.toMsFromMpegTsClock)(De,!0)+" ms")}}n&&(B=Math.max(0,B));for(var Fe=0,He=0,Ne=0;Ne<A;Ne++){for(var xe=y[Ne],Ge=xe.units,qe=Ge.length,lt=0,ot=0;ot<qe;ot++)lt+=Ge[ot].data.length;He+=lt,Fe+=qe,xe.length=lt,xe.dts=Math.max(xe.dts,B),xe.pts=Math.max(xe.pts,xe.dts,0),re=Math.min(xe.pts,re),ie=Math.max(xe.pts,ie)}Z=y[A-1].dts;var bt=He+4*Fe+8,ht;try{ht=new Uint8Array(bt)}catch(an){this.observer.emit(I.Events.ERROR,I.Events.ERROR,{type:M.ErrorTypes.MUX_ERROR,details:M.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:bt,reason:"fail allocating video mdat "+bt});return}var ut=new DataView(ht.buffer);ut.setUint32(0,bt),ht.set(R.default.types.mdat,4);for(var Ze=0;Ze<A;Ze++){for(var Et=y[Ze],St=Et.units,We=0,it=0,ye=St.length;it<ye;it++){var he=St[it],fe=he.data,X=he.data.byteLength;ut.setUint32(H,X),H+=4,ht.set(fe,H),H+=X,We+=4+X}if(Ze<A-1)J=y[Ze+1].dts-Et.dts;else{var $=this.config,te=Et.dts-y[Ze>0?Ze-1:Ze].dts;if($.stretchShortVideoTrack&&this.nextAudioPts!==null){var oe=Math.floor($.maxBufferHole*f),Te=(v?re+v*f:this.nextAudioPts)-Et.pts;Te>oe?(J=Te-te,J<0&&(J=te),T.logger.log("[mp4-remuxer]: It is approximately "+Te/90+" ms to the next segment; using duration "+J/90+" ms for the last video frame.")):J=te}else J=te}var Pe=Math.round(Et.pts-Et.dts);t.push(new d(Et.key,J,We,Pe))}if(t.length&&b&&b<70){var Je=t[0].flags;Je.dependsOn=2,Je.isNonSync=0}console.assert(J!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=F=Z+J,this.isVideoContiguous=!0;var Wt=R.default.moof(r.sequenceNumber++,B,S({},r,{samples:t})),Zt="video",Xt={data1:Wt,data2:ht,startPTS:re/f,endPTS:(ie+J)/f,startDTS:B/f,endDTS:F/f,type:Zt,hasAudio:!1,hasVideo:!0,nb:t.length,dropped:r.dropped};return r.samples=[],r.dropped=0,console.assert(ht.length,"MDAT length must not be zero"),Xt},h.remuxAudio=function(r,e,i,v,f){var y=r.inputTimeScale,t=r.samplerate?r.samplerate:y,A=y/t,U=r.isAAC?C:x,F=U*A,H=this._initPTS,J=!r.isAAC&&this.typeSupported.mpeg,B=[],Z=r.samples,re=J?0:8,ie=this.nextAudioPts||-1,ve=e*y;if(this.isAudioContiguous=i=i||Z.length&&ie>0&&(v&&Math.abs(ve-ie)<9e3||Math.abs(s(Z[0].pts-H,ve)-ie)<20*F),Z.forEach(function(fe){fe.pts=s(fe.pts-H,ve)}),!i||ie<0){if(Z=Z.filter(function(fe){return fe.pts>=0}),!Z.length)return;f===0?ie=0:v?ie=Math.max(0,ve):ie=Z[0].pts}if(r.isAAC)for(var de=f!==void 0,q=this.config.maxAudioFramesDrift,ee=0,pe=ie;ee<Z.length;ee++){var Q=Z[ee],V=Q.pts,Ce=V-pe,ke=Math.abs(1e3*Ce/y);if(Ce<=-q*F&&de)ee===0&&(T.logger.warn("Audio frame @ "+(V/y).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Ce/y)+" ms."),this.nextAudioPts=ie=pe=V);else if(Ce>=q*F&&ke<O&&de){var Ue=Math.round(Ce/F);pe=V-Ue*F,pe<0&&(Ue--,pe+=F),ee===0&&(this.nextAudioPts=ie=pe),T.logger.warn("[mp4-remuxer]: Injecting "+Ue+" audio frame @ "+(pe/y).toFixed(3)+"s due to "+Math.round(1e3*Ce/y)+" ms gap.");for(var we=0;we<Ue;we++){var De=Math.max(pe,0),Oe=E.default.getSilentFrame(r.manifestCodec||r.codec,r.channelCount);Oe||(T.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Oe=Q.unit.subarray()),Z.splice(ee,0,{unit:Oe,pts:De}),pe+=F,ee++}}Q.pts=pe,pe+=F}for(var Le=null,Ke=null,Fe,He=0,Ne=Z.length;Ne--;)He+=Z[Ne].unit.byteLength;for(var xe=0,Ge=Z.length;xe<Ge;xe++){var qe=Z[xe],lt=qe.unit,ot=qe.pts;if(Ke!==null){var bt=B[xe-1];bt.duration=Math.round((ot-Ke)/A)}else if(i&&r.isAAC&&(ot=ie),Le=ot,He>0){He+=re;try{Fe=new Uint8Array(He)}catch(fe){this.observer.emit(I.Events.ERROR,I.Events.ERROR,{type:M.ErrorTypes.MUX_ERROR,details:M.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:He,reason:"fail allocating audio mdat "+He});return}if(!J){var ht=new DataView(Fe.buffer);ht.setUint32(0,He),Fe.set(R.default.types.mdat,4)}}else return;Fe.set(lt,re);var ut=lt.byteLength;re+=ut,B.push(new d(!0,U,ut,0)),Ke=ot}var Ze=B.length;if(!Ze)return;var Et=B[B.length-1];this.nextAudioPts=ie=Ke+A*Et.duration;var St=J?new Uint8Array(0):R.default.moof(r.sequenceNumber++,Le/A,S({},r,{samples:B}));r.samples=[];var We=Le/y,it=ie/y,ye="audio",he={data1:St,data2:Fe,startPTS:We,endPTS:it,startDTS:We,endDTS:it,type:ye,hasAudio:!0,hasVideo:!1,nb:Ze};return this.isAudioContiguous=!0,console.assert(Fe.length,"MDAT length must not be zero"),he},h.remuxEmptyAudio=function(r,e,i,v){var f=r.inputTimeScale,y=r.samplerate?r.samplerate:f,t=f/y,A=this.nextAudioPts,U=(A!==null?A:v.startDTS*f)+this._initDTS,F=v.endDTS*f+this._initDTS,H=t*C,J=Math.ceil((F-U)/H),B=E.default.getSilentFrame(r.manifestCodec||r.codec,r.channelCount);if(T.logger.warn("[mp4-remuxer]: remux empty Audio"),!B){T.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Z=[],re=0;re<J;re++){var ie=U+re*H;Z.push({unit:B,pts:ie,dts:ie})}return r.samples=Z,this.remuxAudio(r,e,i,!1)},h.remuxID3=function(r,e){var i=r.samples.length;if(!i)return;for(var v=r.inputTimeScale,f=this._initPTS,y=this._initDTS,t=0;t<i;t++){var A=r.samples[t];A.pts=s(A.pts-f,e*v)/v,A.dts=s(A.dts-y,e*v)/v}var U=r.samples;return r.samples=[],{samples:U}},h.remuxText=function(r,e){var i=r.samples.length;if(!i)return;for(var v=r.inputTimeScale,f=this._initPTS,y=0;y<i;y++){var t=r.samples[y];t.pts=s(t.pts-f,e*v)/v}r.samples.sort(function(U,F){return U.pts-F.pts});var A=r.samples;return r.samples=[],{samples:A}},m}();function s(m,h){var a;if(h===null)return m;for(h<m?a=-8589934592:a=8589934592;Math.abs(m-h)>4294967296;)m+=a;return m}function g(m){for(var h=0;h<m.length;h++)if(m[h].key)return h;return-1}var d=function(h,a,r,e){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=a,this.size=r,this.cts=e,this.flags=new u(h)},u=function(h){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=h?2:1,this.isNonSync=h?0:1}},"./src/remux/passthrough-remuxer.ts":function(Ee,j,w){"use strict";w.r(j);var N=w("./src/polyfills/number.ts"),E=w("./src/utils/mp4-tools.ts"),R=w("./src/loader/fragment.ts"),I=w("./src/utils/logger.ts"),M=function(){function _(){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 S=_.prototype;return S.destroy=function(){},S.resetTimeStamp=function(C){this.initPTS=C,this.lastEndDTS=null},S.resetNextTimestamp=function(){this.lastEndDTS=null},S.resetInitSegment=function(C,x,b){this.audioCodec=x,this.videoCodec=b,this.generateInitSegment(C),this.emitInitSegment=!0},S.generateInitSegment=function(C){var x=this.audioCodec,b=this.videoCodec;if(!C||!C.byteLength){this.initTracks=void 0,this.initData=void 0;return}var p=this.initData=Object(E.parseInitSegment)(C);x||(x=P(p.audio,R.ElementaryStreamTypes.AUDIO)),b||(b=P(p.video,R.ElementaryStreamTypes.VIDEO));var n={};p.audio&&p.video?n.audiovideo={container:"video/mp4",codec:x+","+b,initSegment:C,id:"main"}:p.audio?n.audio={container:"audio/mp4",codec:x,initSegment:C,id:"audio"}:p.video?n.video={container:"video/mp4",codec:b,initSegment:C,id:"main"}:I.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=n},S.remux=function(C,x,b,p,n){var l=this.initPTS,s=this.lastEndDTS,g={audio:void 0,video:void 0,text:p,id3:b,initSegment:void 0};Object(N.isFiniteNumber)(s)||(s=this.lastEndDTS=n||0);var d=x.samples;if(!d||!d.length)return g;var u={initPTS:void 0,timescale:1},m=this.initData;if((!m||!m.length)&&(this.generateInitSegment(d),m=this.initData),!m||!m.length)return I.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),g;this.emitInitSegment&&(u.tracks=this.initTracks,this.emitInitSegment=!1),Object(N.isFiniteNumber)(l)||(this.initPTS=u.initPTS=l=T(m,d,s));var h=Object(E.getDuration)(d,m),a=s,r=h+a;Object(E.offsetStartDTS)(m,d,l),h>0?this.lastEndDTS=r:(I.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var e=!!m.audio,i=!!m.video,v="";e&&(v+="audio"),i&&(v+="video");var f={data1:d,startPTS:a,startDTS:a,endPTS:r,endDTS:r,type:v,hasAudio:e,hasVideo:i,nb:1,dropped:0};return g.audio=f.type==="audio"?f:void 0,g.video=f.type!=="audio"?f:void 0,g.text=p,g.id3=b,g.initSegment=u,g},_}(),T=function(S,O,C){return Object(E.getStartDTS)(S,O)-C};function P(_,S){var O=_==null?void 0:_.codec;return O&&O.length>4?O:O==="hvc1"?"hvc1.1.c.L120.90":O==="av01"?"av01.0.04M.08":O==="avc1"||S===R.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}j.default=M},"./src/task-loop.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"default",function(){return N});var N=function(){function E(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var R=E.prototype;return R.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},R.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},R.onHandlerDestroyed=function(){},R.hasInterval=function(){return!!this._tickInterval},R.hasNextTick=function(){return!!this._tickTimer},R.setInterval=function(M){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,M),!0)},R.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},R.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},R.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},R.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},R.doTick=function(){},E}()},"./src/types/cmcd.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"CMCDVersion",function(){return N}),w.d(j,"CMCDObjectType",function(){return E}),w.d(j,"CMCDStreamingFormat",function(){return R}),w.d(j,"CMCDStreamType",function(){return I});var N=1,E;(function(M){M.MANIFEST="m",M.AUDIO="a",M.VIDEO="v",M.MUXED="av",M.INIT="i",M.CAPTION="c",M.TIMED_TEXT="tt",M.KEY="k",M.OTHER="o"})(E||(E={}));var R;(function(M){M.DASH="d",M.HLS="h",M.SMOOTH="s",M.OTHER="o"})(R||(R={}));var I;(function(M){M.VOD="v",M.LIVE="l"})(I||(I={}))},"./src/types/level.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"HlsSkip",function(){return R}),w.d(j,"getSkipValue",function(){return I}),w.d(j,"HlsUrlParameters",function(){return M}),w.d(j,"Level",function(){return T});function N(P,_){for(var S=0;S<_.length;S++){var O=_[S];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(P,O.key,O)}}function E(P,_,S){return _&&N(P.prototype,_),S&&N(P,S),P}var R;(function(P){P.No="",P.Yes="YES",P.v2="v2"})(R||(R={}));function I(P,_){var S=P.canSkipUntil,O=P.canSkipDateRanges,C=P.endSN,x=_!==void 0?_-C:0;return S&&x<S?O?R.v2:R.Yes:R.No}var M=function(){function P(S,O,C){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=S,this.part=O,this.skip=C}var _=P.prototype;return _.addDirectives=function(O){var C=new self.URL(O);return this.msn!==void 0&&C.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&C.searchParams.set("_HLS_part",this.part.toString()),this.skip&&C.searchParams.set("_HLS_skip",this.skip),C.toString()},P}(),T=function(){function P(_){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=[_.url],this.attrs=_.attrs,this.bitrate=_.bitrate,_.details&&(this.details=_.details),this.id=_.id||0,this.name=_.name,this.width=_.width||0,this.height=_.height||0,this.audioCodec=_.audioCodec,this.videoCodec=_.videoCodec,this.unknownCodecs=_.unknownCodecs,this.codecSet=[_.videoCodec,_.audioCodec].filter(function(S){return S}).join(",").replace(/\.[^.,]+/g,"")}return E(P,[{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(S){var O=S%this.url.length;this._urlId!==O&&(this.details=void 0,this._urlId=O)}}]),P}()},"./src/types/loader.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"PlaylistContextType",function(){return N}),w.d(j,"PlaylistLevelType",function(){return E});var N;(function(R){R.MANIFEST="manifest",R.LEVEL="level",R.AUDIO_TRACK="audioTrack",R.SUBTITLE_TRACK="subtitleTrack"})(N||(N={}));var E;(function(R){R.MAIN="main",R.AUDIO="audio",R.SUBTITLE="subtitle"})(E||(E={}))},"./src/types/transmuxer.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"ChunkMetadata",function(){return N});var N=function(I,M,T,P,_,S){P===void 0&&(P=0),_===void 0&&(_=-1),S===void 0&&(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=E(),this.buffering={audio:E(),video:E(),audiovideo:E()},this.level=I,this.sn=M,this.id=T,this.size=P,this.part=_,this.partial=S};function E(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"AttrList",function(){return R});var N=/^(\d+)x(\d+)$/,E=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,R=function(){function I(T){typeof T=="string"&&(T=I.parseAttrList(T));for(var P in T)T.hasOwnProperty(P)&&(this[P]=T[P])}var M=I.prototype;return M.decimalInteger=function(P){var _=parseInt(this[P],10);return _>Number.MAX_SAFE_INTEGER?Infinity:_},M.hexadecimalInteger=function(P){if(this[P]){var _=(this[P]||"0x").slice(2);_=(_.length&1?"0":"")+_;for(var S=new Uint8Array(_.length/2),O=0;O<_.length/2;O++)S[O]=parseInt(_.slice(O*2,O*2+2),16);return S}else return null},M.hexadecimalIntegerAsNumber=function(P){var _=parseInt(this[P],16);return _>Number.MAX_SAFE_INTEGER?Infinity:_},M.decimalFloatingPoint=function(P){return parseFloat(this[P])},M.optionalFloat=function(P,_){var S=this[P];return S?parseFloat(S):_},M.enumeratedString=function(P){return this[P]},M.bool=function(P){return this[P]==="YES"},M.decimalResolution=function(P){var _=N.exec(this[P]);return _===null?void 0:{width:parseInt(_[1],10),height:parseInt(_[2],10)}},I.parseAttrList=function(P){var _,S={},O='"';for(E.lastIndex=0;(_=E.exec(P))!==null;){var C=_[2];C.indexOf(O)===0&&C.lastIndexOf(O)===C.length-1&&(C=C.slice(1,-1)),S[_[1]]=C}return S},I}()},"./src/utils/binary-search.ts":function(Ee,j,w){"use strict";w.r(j);var N={search:function(R,I){for(var M=0,T=R.length-1,P=null,_=null;M<=T;){P=(M+T)/2|0,_=R[P];var S=I(_);if(S>0)M=P+1;else if(S<0)T=P-1;else return _}return null}};j.default=N},"./src/utils/buffer-helper.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"BufferHelper",function(){return R});var N=w("./src/utils/logger.ts"),E={length:0,start:function(){return 0},end:function(){return 0}},R=function(){function I(){}return I.isBuffered=function(T,P){try{if(T){for(var _=I.getBuffered(T),S=0;S<_.length;S++)if(P>=_.start(S)&&P<=_.end(S))return!0}}catch(O){}return!1},I.bufferInfo=function(T,P,_){try{if(T){var S=I.getBuffered(T),O=[],C;for(C=0;C<S.length;C++)O.push({start:S.start(C),end:S.end(C)});return this.bufferedInfo(O,P,_)}}catch(x){}return{len:0,start:P,end:P,nextStart:void 0}},I.bufferedInfo=function(T,P,_){P=Math.max(0,P),T.sort(function(u,m){var h=u.start-m.start;return h||m.end-u.end});var S=[];if(_)for(var O=0;O<T.length;O++){var C=S.length;if(C){var x=S[C-1].end;T[O].start-x<_?T[O].end>x&&(S[C-1].end=T[O].end):S.push(T[O])}else S.push(T[O])}else S=T;for(var b=0,p,n=P,l=P,s=0;s<S.length;s++){var g=S[s].start,d=S[s].end;if(P+_>=g&&P<d)n=g,l=d,b=l-P;else if(P+_<g){p=g;break}}return{len:b,start:n||0,end:l||0,nextStart:p}},I.getBuffered=function(T){try{return T.buffered}catch(P){return N.logger.log("failed to get media.buffered",P),E}},I}()},"./src/utils/cea-608-parser.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"Row",function(){return l}),w.d(j,"CaptionScreen",function(){return s});var N=w("./src/utils/logger.ts"),E={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},R=function(r){var e=r;return E.hasOwnProperty(r)&&(e=E[r]),String.fromCharCode(e)},I=15,M=100,T={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},P={17:2,18:4,21:6,22:8,23:10,19:13,20:15},_={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},S={25:2,26:4,29:6,30:8,31:10,27:13,28:15},O=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],C;(function(a){a[a.ERROR=0]="ERROR",a[a.TEXT=1]="TEXT",a[a.WARNING=2]="WARNING",a[a.INFO=2]="INFO",a[a.DEBUG=3]="DEBUG",a[a.DATA=3]="DATA"})(C||(C={}));var x=function(){function a(){this.time=null,this.verboseLevel=C.ERROR}var r=a.prototype;return r.log=function(i,v){this.verboseLevel>=i&&N.logger.log(this.time+" ["+i+"] "+v)},a}(),b=function(r){for(var e=[],i=0;i<r.length;i++)e.push(r[i].toString(16));return e},p=function(){function a(e,i,v,f,y){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=e||"white",this.underline=i||!1,this.italics=v||!1,this.background=f||"black",this.flash=y||!1}var r=a.prototype;return r.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},r.setStyles=function(i){for(var v=["foreground","underline","italics","background","flash"],f=0;f<v.length;f++){var y=v[f];i.hasOwnProperty(y)&&(this[y]=i[y])}},r.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},r.equals=function(i){return this.foreground===i.foreground&&this.underline===i.underline&&this.italics===i.italics&&this.background===i.background&&this.flash===i.flash},r.copy=function(i){this.foreground=i.foreground,this.underline=i.underline,this.italics=i.italics,this.background=i.background,this.flash=i.flash},r.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},a}(),n=function(){function a(e,i,v,f,y,t){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new p(i,v,f,y,t)}var r=a.prototype;return r.reset=function(){this.uchar=" ",this.penState.reset()},r.setChar=function(i,v){this.uchar=i,this.penState.copy(v)},r.setPenState=function(i){this.penState.copy(i)},r.equals=function(i){return this.uchar===i.uchar&&this.penState.equals(i.penState)},r.copy=function(i){this.uchar=i.uchar,this.penState.copy(i.penState)},r.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},a}(),l=function(){function a(e){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var i=0;i<M;i++)this.chars.push(new n);this.logger=e,this.pos=0,this.currPenState=new p}var r=a.prototype;return r.equals=function(i){for(var v=!0,f=0;f<M;f++)if(!this.chars[f].equals(i.chars[f])){v=!1;break}return v},r.copy=function(i){for(var v=0;v<M;v++)this.chars[v].copy(i.chars[v])},r.isEmpty=function(){for(var i=!0,v=0;v<M;v++)if(!this.chars[v].isEmpty()){i=!1;break}return i},r.setCursor=function(i){this.pos!==i&&(this.pos=i),this.pos<0?(this.logger.log(C.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>M&&(this.logger.log(C.DEBUG,"Too large cursor position "+this.pos),this.pos=M)},r.moveCursor=function(i){var v=this.pos+i;if(i>1)for(var f=this.pos+1;f<v+1;f++)this.chars[f].setPenState(this.currPenState);this.setCursor(v)},r.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},r.insertChar=function(i){i>=144&&this.backSpace();var v=R(i);if(this.pos>=M){this.logger.log(C.ERROR,"Cannot insert "+i.toString(16)+" ("+v+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(v,this.currPenState),this.moveCursor(1)},r.clearFromPos=function(i){var v;for(v=i;v<M;v++)this.chars[v].reset()},r.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},r.clearToEndOfRow=function(){this.clearFromPos(this.pos)},r.getTextString=function(){for(var i=[],v=!0,f=0;f<M;f++){var y=this.chars[f].uchar;y!==" "&&(v=!1),i.push(y)}return v?"":i.join("")},r.setPenStyles=function(i){this.currPenState.setStyles(i);var v=this.chars[this.pos];v.setPenState(this.currPenState)},a}(),s=function(){function a(e){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var i=0;i<I;i++)this.rows.push(new l(e));this.logger=e,this.currRow=I-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var r=a.prototype;return r.reset=function(){for(var i=0;i<I;i++)this.rows[i].clear();this.currRow=I-1},r.equals=function(i){for(var v=!0,f=0;f<I;f++)if(!this.rows[f].equals(i.rows[f])){v=!1;break}return v},r.copy=function(i){for(var v=0;v<I;v++)this.rows[v].copy(i.rows[v])},r.isEmpty=function(){for(var i=!0,v=0;v<I;v++)if(!this.rows[v].isEmpty()){i=!1;break}return i},r.backSpace=function(){var i=this.rows[this.currRow];i.backSpace()},r.clearToEndOfRow=function(){var i=this.rows[this.currRow];i.clearToEndOfRow()},r.insertChar=function(i){var v=this.rows[this.currRow];v.insertChar(i)},r.setPen=function(i){var v=this.rows[this.currRow];v.setPenStyles(i)},r.moveCursor=function(i){var v=this.rows[this.currRow];v.moveCursor(i)},r.setCursor=function(i){this.logger.log(C.INFO,"setCursor: "+i);var v=this.rows[this.currRow];v.setCursor(i)},r.setPAC=function(i){this.logger.log(C.INFO,"pacData = "+JSON.stringify(i));var v=i.row-1;if(this.nrRollUpRows&&v<this.nrRollUpRows-1&&(v=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==v){for(var f=0;f<I;f++)this.rows[f].clear();var y=this.currRow+1-this.nrRollUpRows,t=this.lastOutputScreen;if(t){var A=t.rows[y].cueStartTime,U=this.logger.time;if(A&&U!==null&&A<U)for(var F=0;F<this.nrRollUpRows;F++)this.rows[v-this.nrRollUpRows+F+1].copy(t.rows[y+F])}}this.currRow=v;var H=this.rows[this.currRow];if(i.indent!==null){var J=i.indent,B=Math.max(J-1,0);H.setCursor(i.indent),i.color=H.chars[B].penState.foreground}var Z={foreground:i.color,underline:i.underline,italics:i.italics,background:"black",flash:!1};this.setPen(Z)},r.setBkgData=function(i){this.logger.log(C.INFO,"bkgData = "+JSON.stringify(i)),this.backSpace(),this.setPen(i),this.insertChar(32)},r.setRollUpRows=function(i){this.nrRollUpRows=i},r.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(C.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(C.TEXT,this.getDisplayText());var i=this.currRow+1-this.nrRollUpRows,v=this.rows.splice(i,1)[0];v.clear(),this.rows.splice(this.currRow,0,v),this.logger.log(C.INFO,"Rolling up")},r.getDisplayText=function(i){i=i||!1;for(var v=[],f="",y=-1,t=0;t<I;t++){var A=this.rows[t].getTextString();A&&(y=t+1,i?v.push("Row "+y+": '"+A+"'"):v.push(A.trim()))}return v.length>0&&(i?f="["+v.join(" | ")+"]":f=v.join(`
`)),f},r.getTextAndFormat=function(){return this.rows},a}(),g=function(){function a(e,i,v){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=i,this.mode=null,this.verbose=0,this.displayedMemory=new s(v),this.nonDisplayedMemory=new s(v),this.lastOutputScreen=new s(v),this.currRollUpRow=this.displayedMemory.rows[I-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=v}var r=a.prototype;return r.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[I-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},r.getHandler=function(){return this.outputFilter},r.setHandler=function(i){this.outputFilter=i},r.setPAC=function(i){this.writeScreen.setPAC(i)},r.setBkgData=function(i){this.writeScreen.setBkgData(i)},r.setMode=function(i){if(i===this.mode)return;this.mode=i,this.logger.log(C.INFO,"MODE="+i),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=i},r.insertChars=function(i){for(var v=0;v<i.length;v++)this.writeScreen.insertChar(i[v]);var f=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(C.INFO,f+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(C.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},r.ccRCL=function(){this.logger.log(C.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},r.ccBS=function(){if(this.logger.log(C.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},r.ccAOF=function(){},r.ccAON=function(){},r.ccDER=function(){this.logger.log(C.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},r.ccRU=function(i){this.logger.log(C.INFO,"RU("+i+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(i)},r.ccFON=function(){this.logger.log(C.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},r.ccRDC=function(){this.logger.log(C.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},r.ccTR=function(){this.logger.log(C.INFO,"TR"),this.setMode("MODE_TEXT")},r.ccRTD=function(){this.logger.log(C.INFO,"RTD"),this.setMode("MODE_TEXT")},r.ccEDM=function(){this.logger.log(C.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},r.ccCR=function(){this.logger.log(C.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},r.ccENM=function(){this.logger.log(C.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},r.ccEOC=function(){if(this.logger.log(C.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var i=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=i,this.writeScreen=this.nonDisplayedMemory,this.logger.log(C.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},r.ccTO=function(i){this.logger.log(C.INFO,"TO("+i+") - Tab Offset"),this.writeScreen.moveCursor(i)},r.ccMIDROW=function(i){var v={flash:!1};if(v.underline=i%2===1,v.italics=i>=46,v.italics)v.foreground="white";else{var f=Math.floor(i/2)-16,y=["white","green","blue","cyan","red","yellow","magenta"];v.foreground=y[f]}this.logger.log(C.INFO,"MIDROW: "+JSON.stringify(v)),this.writeScreen.setPen(v)},r.outputDataUpdate=function(i){i===void 0&&(i=!1);var v=this.logger.time;if(v===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=v:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,v,this.lastOutputScreen),i&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:v),this.lastOutputScreen.copy(this.displayedMemory))},r.cueSplitAtTime=function(i){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,i,this.displayedMemory),this.cueStartTime=i))},a}(),d=function(){function a(e,i,v){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var f=new x;this.channels=[null,new g(e,i,f),new g(e+1,v,f)],this.cmdHistory=h(),this.logger=f}var r=a.prototype;return r.getHandler=function(i){return this.channels[i].getHandler()},r.setHandler=function(i,v){this.channels[i].setHandler(v)},r.addData=function(i,v){var f,y,t,A=!1;this.logger.time=i;for(var U=0;U<v.length;U+=2){if(y=v[U]&127,t=v[U+1]&127,y===0&&t===0)continue;if(this.logger.log(C.DATA,"["+b([v[U],v[U+1]])+"] -> ("+b([y,t])+")"),f=this.parseCmd(y,t),f||(f=this.parseMidrow(y,t)),f||(f=this.parsePAC(y,t)),f||(f=this.parseBackgroundAttributes(y,t)),!f&&(A=this.parseChars(y,t),A)){var F=this.currentChannel;if(F&&F>0){var H=this.channels[F];H.insertChars(A)}else this.logger.log(C.WARNING,"No channel found yet. TEXT-MODE?")}!f&&!A&&this.logger.log(C.WARNING,"Couldn't parse cleaned data "+b([y,t])+" orig: "+b([v[U],v[U+1]]))}},r.parseCmd=function(i,v){var f=this.cmdHistory,y=(i===20||i===28||i===21||i===29)&&v>=32&&v<=47,t=(i===23||i===31)&&v>=33&&v<=35;if(!(y||t))return!1;if(m(i,v,f))return u(null,null,f),this.logger.log(C.DEBUG,"Repeated command ("+b([i,v])+") is dropped"),!0;var A=i===20||i===21||i===23?1:2,U=this.channels[A];return i===20||i===21||i===28||i===29?v===32?U.ccRCL():v===33?U.ccBS():v===34?U.ccAOF():v===35?U.ccAON():v===36?U.ccDER():v===37?U.ccRU(2):v===38?U.ccRU(3):v===39?U.ccRU(4):v===40?U.ccFON():v===41?U.ccRDC():v===42?U.ccTR():v===43?U.ccRTD():v===44?U.ccEDM():v===45?U.ccCR():v===46?U.ccENM():v===47&&U.ccEOC():U.ccTO(v-32),u(i,v,f),this.currentChannel=A,!0},r.parseMidrow=function(i,v){var f=0;if((i===17||i===25)&&v>=32&&v<=47){if(i===17?f=1:f=2,f!==this.currentChannel)return this.logger.log(C.ERROR,"Mismatch channel in midrow parsing"),!1;var y=this.channels[f];return y?(y.ccMIDROW(v),this.logger.log(C.DEBUG,"MIDROW ("+b([i,v])+")"),!0):!1}return!1},r.parsePAC=function(i,v){var f,y=this.cmdHistory,t=(i>=17&&i<=23||i>=25&&i<=31)&&v>=64&&v<=127,A=(i===16||i===24)&&v>=64&&v<=95;if(!(t||A))return!1;if(m(i,v,y))return u(null,null,y),!0;var U=i<=23?1:2;v>=64&&v<=95?f=U===1?T[i]:_[i]:f=U===1?P[i]:S[i];var F=this.channels[U];return F?(F.setPAC(this.interpretPAC(f,v)),u(i,v,y),this.currentChannel=U,!0):!1},r.interpretPAC=function(i,v){var f,y={color:null,italics:!1,indent:null,underline:!1,row:i};return v>95?f=v-96:f=v-64,y.underline=(f&1)===1,f<=13?y.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(f/2)]:f<=15?(y.italics=!0,y.color="white"):y.indent=Math.floor((f-16)/2)*4,y},r.parseChars=function(i,v){var f,y=null,t=null;if(i>=25?(f=2,t=i-8):(f=1,t=i),t>=17&&t<=19){var A;t===17?A=v+80:t===18?A=v+112:A=v+144,this.logger.log(C.INFO,"Special char '"+R(A)+"' in channel "+f),y=[A]}else i>=32&&i<=127&&(y=v===0?[i]:[i,v]);if(y){var U=b(y);this.logger.log(C.DEBUG,"Char codes = "+U.join(",")),u(i,v,this.cmdHistory)}return y},r.parseBackgroundAttributes=function(i,v){var f=(i===16||i===24)&&v>=32&&v<=47,y=(i===23||i===31)&&v>=45&&v<=47;if(!(f||y))return!1;var t,A={};i===16||i===24?(t=Math.floor((v-32)/2),A.background=O[t],v%2===1&&(A.background=A.background+"_semi")):v===45?A.background="transparent":(A.foreground="black",v===47&&(A.underline=!0));var U=i<=23?1:2,F=this.channels[U];return F.setBkgData(A),u(i,v,this.cmdHistory),!0},r.reset=function(){for(var i=0;i<Object.keys(this.channels).length;i++){var v=this.channels[i];v&&v.reset()}this.cmdHistory=h()},r.cueSplitAtTime=function(i){for(var v=0;v<this.channels.length;v++){var f=this.channels[v];f&&f.cueSplitAtTime(i)}},a}();function u(a,r,e){e.a=a,e.b=r}function m(a,r,e){return e.a===a&&e.b===r}function h(){return{a:null,b:null}}j.default=d},"./src/utils/codecs.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"isCodecType",function(){return E}),w.d(j,"isCodecSupportedInMp4",function(){return R});var N={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 E(I,M){var T=N[M];return!!T&&T[I.slice(0,4)]===!0}function R(I,M){return MediaSource.isTypeSupported((M||"video")+'/mp4;codecs="'+I+'"')}},"./src/utils/cues.ts":function(Ee,j,w){"use strict";w.r(j);var N=w("./src/utils/vttparser.ts"),E=w("./src/utils/webvtt-parser.ts"),R=w("./src/utils/texttrack-utils.ts"),I=/\s/,M={newCue:function(P,_,S,O){for(var C=[],x,b,p,n,l,s=self.VTTCue||self.TextTrackCue,g=0;g<O.rows.length;g++)if(x=O.rows[g],p=!0,n=0,l="",!x.isEmpty()){for(var d=0;d<x.chars.length;d++)I.test(x.chars[d].uchar)&&p?n++:(l+=x.chars[d].uchar,p=!1);x.cueStartTime=_,_===S&&(S+=1e-4),n>=16?n--:n++;var u=Object(N.fixLineBreaks)(l.trim()),m=Object(E.generateCueId)(_,S,u);(!P||!P.cues||!P.cues.getCueById(m))&&(b=new s(_,S,u),b.id=m,b.line=g+1,b.align="left",b.position=10+Math.min(80,Math.floor(n*8/32)*10),C.push(b))}return P&&C.length&&(C.sort(function(h,a){return h.line==="auto"||a.line==="auto"?0:h.line>8&&a.line>8?a.line-h.line:h.line-a.line}),C.forEach(function(h){return Object(R.addCueToTrack)(P,h)})),C}};j.default=M},"./src/utils/discontinuities.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"findFirstFragWithCC",function(){return I}),w.d(j,"shouldAlignOnDiscontinuities",function(){return M}),w.d(j,"findDiscontinuousReferenceFrag",function(){return T}),w.d(j,"adjustSlidingStart",function(){return _}),w.d(j,"alignStream",function(){return S}),w.d(j,"alignPDT",function(){return C}),w.d(j,"alignFragmentByPDTDelta",function(){return x}),w.d(j,"alignMediaPlaylistByPDT",function(){return b});var N=w("./src/polyfills/number.ts"),E=w("./src/utils/logger.ts"),R=w("./src/controller/level-helper.ts");function I(p,n){for(var l=null,s=0,g=p.length;s<g;s++){var d=p[s];if(d&&d.cc===n){l=d;break}}return l}function M(p,n,l){return!!(n.details&&(l.endCC>l.startCC||p&&p.cc<l.startCC))}function T(p,n){var l=p.fragments,s=n.fragments;if(!s.length||!l.length){E.logger.log("No fragments to align");return}var g=I(l,s[0].cc);if(!g||g&&!g.startPTS){E.logger.log("No frag in previous level to align on");return}return g}function P(p,n){if(p){var l=p.start+n;p.start=p.startPTS=l,p.endPTS=l+p.duration}}function _(p,n){for(var l=n.fragments,s=0,g=l.length;s<g;s++)P(l[s],p);n.fragmentHint&&P(n.fragmentHint,p),n.alignedSliding=!0}function S(p,n,l){if(!n)return;O(p,l,n),!l.alignedSliding&&n.details&&C(l,n.details),!l.alignedSliding&&n.details&&!l.skippedSegments&&Object(R.adjustSliding)(n.details,l)}function O(p,n,l){if(M(p,l,n)){var s=T(l.details,n);s&&Object(N.isFiniteNumber)(s.start)&&(E.logger.log("Adjusting PTS using last level due to CC increase within current level "+n.url),_(s.start,n))}}function C(p,n){if(!n.fragments.length||!p.hasProgramDateTime||!n.hasProgramDateTime)return;var l=n.fragments[0].programDateTime,s=p.fragments[0].programDateTime,g=(s-l)/1e3+n.fragments[0].start;g&&Object(N.isFiniteNumber)(g)&&(E.logger.log("Adjusting PTS using programDateTime delta "+(s-l)+"ms, sliding:"+g.toFixed(3)+" "+p.url+" "),_(g,p))}function x(p,n){var l=p.programDateTime;if(!l)return;var s=(l-n)/1e3;p.start=p.startPTS=s,p.endPTS=s+p.duration}function b(p,n){if(!n.fragments.length||!p.hasProgramDateTime||!n.hasProgramDateTime)return;var l=n.fragments[0].programDateTime,s=n.fragments[0].start,g=l-s*1e3;p.fragments.forEach(function(d){x(d,g)}),p.fragmentHint&&x(p.fragmentHint,g),p.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(Ee,j,w){"use strict";w.r(j);var N=w("./src/utils/ewma.ts"),E=function(){function R(M,T,P){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=P,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new N.default(M),this.fast_=new N.default(T)}var I=R.prototype;return I.update=function(T,P){var _=this.slow_,S=this.fast_;this.slow_.halfLife!==T&&(this.slow_=new N.default(T,_.getEstimate(),_.getTotalWeight())),this.fast_.halfLife!==P&&(this.fast_=new N.default(P,S.getEstimate(),S.getTotalWeight()))},I.sample=function(T,P){T=Math.max(T,this.minDelayMs_);var _=8*P,S=T/1e3,O=_/S;this.fast_.sample(S,O),this.slow_.sample(S,O)},I.canEstimate=function(){var T=this.fast_;return T&&T.getTotalWeight()>=this.minWeight_},I.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},I.destroy=function(){},R}();j.default=E},"./src/utils/ewma.ts":function(Ee,j,w){"use strict";w.r(j);var N=function(){function E(I,M,T){M===void 0&&(M=0),T===void 0&&(T=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=I,this.alpha_=I?Math.exp(Math.log(.5)/I):0,this.estimate_=M,this.totalWeight_=T}var R=E.prototype;return R.sample=function(M,T){var P=Math.pow(this.alpha_,M);this.estimate_=T*(1-P)+P*this.estimate_,this.totalWeight_+=M},R.getTotalWeight=function(){return this.totalWeight_},R.getEstimate=function(){if(this.alpha_){var M=1-Math.pow(this.alpha_,this.totalWeight_);if(M)return this.estimate_/M}return this.estimate_},E}();j.default=N},"./src/utils/fetch-loader.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"fetchSupported",function(){return x});var N=w("./src/polyfills/number.ts"),E=w("./src/loader/load-stats.ts"),R=w("./src/demux/chunk-cache.ts");function I(s,g){s.prototype=Object.create(g.prototype),s.prototype.constructor=s,S(s,g)}function M(s){var g=typeof Map=="function"?new Map:void 0;return M=function(u){if(u===null||!_(u))return u;if(typeof u!="function")throw new TypeError("Super expression must either be null or a function");if(typeof g!="undefined"){if(g.has(u))return g.get(u);g.set(u,m)}function m(){return T(u,arguments,O(this).constructor)}return m.prototype=Object.create(u.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),S(m,u)},M(s)}function T(s,g,d){return P()?T=Reflect.construct:T=function(m,h,a){var r=[null];r.push.apply(r,h);var e=Function.bind.apply(m,r),i=new e;return a&&S(i,a.prototype),i},T.apply(null,arguments)}function P(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(s){return!1}}function _(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function S(s,g){return S=Object.setPrototypeOf||function(u,m){return u.__proto__=m,u},S(s,g)}function O(s){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(d){return d.__proto__||Object.getPrototypeOf(d)},O(s)}function C(){return C=Object.assign||function(s){for(var g=1;g<arguments.length;g++){var d=arguments[g];for(var u in d)Object.prototype.hasOwnProperty.call(d,u)&&(s[u]=d[u])}return s},C.apply(this,arguments)}function x(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(s){}return!1}var b=function(){function s(d){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=d.fetchSetup||n,this.controller=new self.AbortController,this.stats=new E.LoadStats}var g=s.prototype;return g.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},g.abortInternal=function(){var u=this.response;(!u||!u.ok)&&(this.stats.aborted=!0,this.controller.abort())},g.abort=function(){var u;this.abortInternal(),(u=this.callbacks)!==null&&u!==void 0&&u.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},g.load=function(u,m,h){var a=this,r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();var e=p(u,this.controller.signal),i=h.onProgress,v=u.responseType==="arraybuffer",f=v?"byteLength":"length";this.context=u,this.config=m,this.callbacks=h,this.request=this.fetchSetup(u,e),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){a.abortInternal(),h.onTimeout(r,u,a.response)},m.timeout),self.fetch(this.request).then(function(y){if(a.response=a.loader=y,!y.ok){var t=y.status,A=y.statusText;throw new l(A||"fetch, bad network response",t,y)}return r.loading.first=Math.max(self.performance.now(),r.loading.start),r.total=parseInt(y.headers.get("Content-Length")||"0"),i&&Object(N.isFiniteNumber)(m.highWaterMark)?a.loadProgressively(y,r,u,m.highWaterMark,i):v?y.arrayBuffer():y.text()}).then(function(y){var t=a.response;self.clearTimeout(a.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first),r.loaded=r.total=y[f];var A={url:t.url,data:y};i&&!Object(N.isFiniteNumber)(m.highWaterMark)&&i(r,u,y,t),h.onSuccess(A,r,u,t)}).catch(function(y){if(self.clearTimeout(a.requestTimeout),r.aborted)return;var t=y.code||0;h.onError({code:t,text:y.message},u,y.details)})},g.getCacheAge=function(){var u=null;if(this.response){var m=this.response.headers.get("age");u=m?parseFloat(m):null}return u},g.loadProgressively=function(u,m,h,a,r){a===void 0&&(a=0);var e=new R.default,i=u.body.getReader(),v=function f(){return i.read().then(function(y){if(y.done)return e.dataLength&&r(m,h,e.flush(),u),Promise.resolve(new ArrayBuffer(0));var t=y.value,A=t.length;return m.loaded+=A,A<a||e.dataLength?(e.push(t),e.dataLength>=a&&r(m,h,e.flush(),u)):r(m,h,t,u),f()}).catch(function(){return Promise.reject()})};return v()},s}();function p(s,g){var d={method:"GET",mode:"cors",credentials:"same-origin",signal:g,headers:new self.Headers(C({},s.headers))};return s.rangeEnd&&d.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),d}function n(s,g){return new self.Request(s.url,g)}var l=function(s){I(g,s);function g(d,u,m){var h;return h=s.call(this,d)||this,h.code=void 0,h.details=void 0,h.code=u,h.details=m,h}return g}(M(Error));j.default=b},"./src/utils/imsc1-ttml-parser.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"IMSC1_CODEC",function(){return _}),w.d(j,"parseIMSC1",function(){return x});var N=w("./src/utils/mp4-tools.ts"),E=w("./src/utils/vttparser.ts"),R=w("./src/utils/vttcue.ts"),I=w("./src/demux/id3.ts"),M=w("./src/utils/timescale-conversion.ts"),T=w("./src/utils/webvtt-parser.ts");function P(){return P=Object.assign||function(a){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(a[i]=e[i])}return a},P.apply(this,arguments)}var _="stpp.ttml.im1t",S=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,O=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,C={left:"start",center:"center",right:"end",start:"start",end:"end"};function x(a,r,e,i,v){var f=Object(N.findBox)(new Uint8Array(a),["mdat"]);if(f.length===0){v(new Error("Could not parse IMSC1 mdat"));return}var y=f[0],t=Object(I.utf8ArrayToStr)(new Uint8Array(a,y.start,y.end-y.start)),A=Object(M.toTimescaleFromScale)(r,1,e);try{i(b(t,A))}catch(U){v(U)}}function b(a,r){var e=new DOMParser,i=e.parseFromString(a,"text/xml"),v=i.getElementsByTagName("tt")[0];if(!v)throw new Error("Invalid ttml");var f={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},y=Object.keys(f).reduce(function(H,J){return H[J]=v.getAttribute("ttp:"+J)||f[J],H},{}),t=v.getAttribute("xml:space")!=="preserve",A=n(p(v,"styling","style")),U=n(p(v,"layout","region")),F=p(v,"body","[begin]");return[].map.call(F,function(H){var J=l(H,t);if(!J||!H.hasAttribute("begin"))return null;var B=u(H.getAttribute("begin"),y),Z=u(H.getAttribute("dur"),y),re=u(H.getAttribute("end"),y);if(B===null)throw d(H);if(re===null){if(Z===null)throw d(H);re=B+Z}var ie=new R.default(B-r,re-r,J);ie.id=Object(T.generateCueId)(ie.startTime,ie.endTime,ie.text);var ve=U[H.getAttribute("region")],de=A[H.getAttribute("style")];ie.position=10,ie.size=80;var q=s(ve,de),ee=q.textAlign;if(ee){var pe=C[ee];pe&&(ie.lineAlign=pe),ie.align=ee}return P(ie,q),ie}).filter(function(H){return H!==null})}function p(a,r,e){var i=a.getElementsByTagName(r)[0];return i?[].slice.call(i.querySelectorAll(e)):[]}function n(a){return a.reduce(function(r,e){var i=e.getAttribute("xml:id");return i&&(r[i]=e),r},{})}function l(a,r){return[].slice.call(a.childNodes).reduce(function(e,i,v){var f;return i.nodeName==="br"&&v?e+`
`:(f=i.childNodes)!==null&&f!==void 0&&f.length?l(i,r):r?e+i.textContent.trim().replace(/\s+/g," "):e+i.textContent},"")}function s(a,r){var e="http://www.w3.org/ns/ttml#styling",i=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return i.reduce(function(v,f){var y=g(r,e,f)||g(a,e,f);return y&&(v[f]=y),v},{})}function g(a,r,e){return a.hasAttributeNS(r,e)?a.getAttributeNS(r,e):null}function d(a){return new Error("Could not parse ttml timestamp "+a)}function u(a,r){if(!a)return null;var e=Object(E.parseTimeStamp)(a);return e===null&&(S.test(a)?e=m(a,r):O.test(a)&&(e=h(a,r))),e}function m(a,r){var e=S.exec(a),i=(e[4]|0)+(e[5]|0)/r.subFrameRate;return(e[1]|0)*3600+(e[2]|0)*60+(e[3]|0)+i/r.frameRate}function h(a,r){var e=O.exec(a),i=Number(e[1]),v=e[2];switch(v){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/r.frameRate;case"t":return i/r.tickRate}return i}},"./src/utils/logger.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"enableLogs",function(){return T}),w.d(j,"logger",function(){return P});var N=function(){},E={trace:N,debug:N,log:N,warn:N,info:N,error:N},R=E;function I(_){var S=self.console[_];return S?S.bind(self.console,"["+_+"] >"):N}function M(_){for(var S=arguments.length,O=new Array(S>1?S-1:0),C=1;C<S;C++)O[C-1]=arguments[C];O.forEach(function(x){R[x]=_[x]?_[x].bind(_):I(x)})}function T(_){if(self.console&&_===!0||typeof _=="object"){M(_,"debug","log","info","warn","error");try{R.log()}catch(S){R=E}}else R=E}var P=R},"./src/utils/mediakeys-helper.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"KeySystems",function(){return N}),w.d(j,"requestMediaKeySystemAccess",function(){return E});var N;(function(R){R.WIDEVINE="com.widevine.alpha",R.PLAYREADY="com.microsoft.playready"})(N||(N={}));var E=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"getMediaSource",function(){return N});function N(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"bin2str",function(){return M}),w.d(j,"readUint16",function(){return T}),w.d(j,"readUint32",function(){return P}),w.d(j,"writeUint32",function(){return _}),w.d(j,"findBox",function(){return S}),w.d(j,"parseSegmentIndex",function(){return O}),w.d(j,"parseInitSegment",function(){return C}),w.d(j,"getStartDTS",function(){return x}),w.d(j,"getDuration",function(){return b}),w.d(j,"computeRawDurationFromSamples",function(){return p}),w.d(j,"offsetStartDTS",function(){return n}),w.d(j,"segmentValidRange",function(){return l}),w.d(j,"appendUint8Array",function(){return s});var N=w("./src/utils/typed-array.ts"),E=w("./src/loader/fragment.ts"),R=Math.pow(2,32)-1,I=[].push;function M(g){return String.fromCharCode.apply(null,g)}function T(g,d){"data"in g&&(d+=g.start,g=g.data);var u=g[d]<<8|g[d+1];return u<0?65536+u:u}function P(g,d){"data"in g&&(d+=g.start,g=g.data);var u=g[d]<<24|g[d+1]<<16|g[d+2]<<8|g[d+3];return u<0?4294967296+u:u}function _(g,d,u){"data"in g&&(d+=g.start,g=g.data),g[d]=u>>24,g[d+1]=u>>16&255,g[d+2]=u>>8&255,g[d+3]=u&255}function S(g,d){var u=[];if(!d.length)return u;var m,h,a;"data"in g?(m=g.data,h=g.start,a=g.end):(m=g,h=0,a=m.byteLength);for(var r=h;r<a;){var e=P(m,r),i=M(m.subarray(r+4,r+8)),v=e>1?r+e:a;if(i===d[0])if(d.length===1)u.push({data:m,start:r+8,end:v});else{var f=S({data:m,start:r+8,end:v},d.slice(1));f.length&&I.apply(u,f)}r=v}return u}function O(g){var d=S(g,["moov"]),u=d[0],m=u?u.end:null,h=S(g,["sidx"]);if(!h||!h[0])return null;var a=[],r=h[0],e=r.data[0],i=e===0?8:16,v=P(r,i);i+=4;var f=0,y=0;e===0?i+=8:i+=16,i+=2;var t=r.end+y,A=T(r,i);i+=2;for(var U=0;U<A;U++){var F=i,H=P(r,F);F+=4;var J=H&2147483647,B=(H&2147483648)>>>31;if(B===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Z=P(r,F);F+=4,a.push({referenceSize:J,subsegmentDuration:Z,info:{duration:Z/v,start:t,end:t+J-1}}),t+=J,F+=4,i=F}return{earliestPresentationTime:f,timescale:v,version:e,referencesCount:A,references:a,moovEndOffset:m}}function C(g){for(var d=[],u=S(g,["moov","trak"]),m=0;m<u.length;m++){var h=u[m],a=S(h,["tkhd"])[0];if(a){var r=a.data[a.start],e=r===0?12:20,i=P(a,e),v=S(h,["mdia","mdhd"])[0];if(v){r=v.data[v.start],e=r===0?12:20;var f=P(v,e),y=S(h,["mdia","hdlr"])[0];if(y){var t=M(y.data.subarray(y.start+8,y.start+12)),A={soun:E.ElementaryStreamTypes.AUDIO,vide:E.ElementaryStreamTypes.VIDEO}[t];if(A){var U=S(h,["mdia","minf","stbl","stsd"])[0],F=void 0;U&&(F=M(U.data.subarray(U.start+12,U.start+16))),d[i]={timescale:f,type:A},d[A]={timescale:f,id:i,codec:F}}}}}}var H=S(g,["moov","mvex","trex"]);return H.forEach(function(J){var B=P(J,4),Z=d[B];Z&&(Z.default={duration:P(J,12),flags:P(J,20)})}),d}function x(g,d){return S(d,["moof","traf"]).reduce(function(u,m){var h=S(m,["tfdt"])[0],a=h.data[h.start],r=S(m,["tfhd"]).reduce(function(e,i){var v=P(i,4),f=g[v];if(f){var y=P(h,4);a===1&&(y*=Math.pow(2,32),y+=P(h,8));var t=f.timescale||9e4,A=y/t;if(isFinite(A)&&(e===null||A<e))return A}return e},null);return r!==null&&isFinite(r)&&(u===null||r<u)?r:u},null)||0}function b(g,d){for(var u=0,m=0,h=0,a=S(g,["moof","traf"]),r=0;r<a.length;r++){var e=a[r],i=S(e,["tfhd"])[0],v=P(i,4),f=d[v];if(!f)continue;var y=f.default,t=P(i,0)|(y==null?void 0:y.flags),A=y==null?void 0:y.duration;t&8&&(t&2?A=P(i,12):A=P(i,8));for(var U=f.timescale||9e4,F=S(e,["trun"]),H=0;H<F.length;H++){if(A){var J=P(F[H],4);u=A*J}else u=p(F[H]);f.type===E.ElementaryStreamTypes.VIDEO?m+=u/U:f.type===E.ElementaryStreamTypes.AUDIO&&(h+=u/U)}}if(m===0&&h===0){var B=O(g);if(B!=null&&B.references)return B.references.reduce(function(Z,re){return Z+re.info.duration||0},0)}return m||h}function p(g){var d=P(g,0),u=8;d&1&&(u+=4),d&4&&(u+=4);for(var m=0,h=P(g,4),a=0;a<h;a++){if(d&256){var r=P(g,u);m+=r,u+=4}d&512&&(u+=4),d&1024&&(u+=4),d&2048&&(u+=4)}return m}function n(g,d,u){S(d,["moof","traf"]).forEach(function(m){S(m,["tfhd"]).forEach(function(h){var a=P(h,4),r=g[a];if(!r)return;var e=r.timescale||9e4;S(m,["tfdt"]).forEach(function(i){var v=i.data[i.start],f=P(i,4);if(v===0)_(i,4,f-u*e);else{f*=Math.pow(2,32),f+=P(i,8),f-=u*e,f=Math.max(f,0);var y=Math.floor(f/(R+1)),t=Math.floor(f%(R+1));_(i,4,y),_(i,8,t)}})})})}function l(g){var d={valid:null,remainder:null},u=S(g,["moof"]);if(u){if(u.length<2)return d.remainder=g,d}else return d;var m=u[u.length-1];return d.valid=Object(N.sliceUint8)(g,0,m.start-8),d.remainder=Object(N.sliceUint8)(g,m.start-8),d}function s(g,d){var u=new Uint8Array(g.length+d.length);return u.set(g),u.set(d,g.length),u}},"./src/utils/output-filter.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"default",function(){return N});var N=function(){function E(I,M){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=I,this.trackName=M}var R=E.prototype;return R.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},R.newCue=function(M,T,P){(this.startTime===null||this.startTime>M)&&(this.startTime=M),this.endTime=T,this.screen=P,this.timelineController.createCaptionsTrack(this.trackName)},R.reset=function(){this.cueRanges=[]},E}()},"./src/utils/texttrack-utils.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"sendAddTrackEvent",function(){return E}),w.d(j,"addCueToTrack",function(){return R}),w.d(j,"clearCurrentCues",function(){return I}),w.d(j,"removeCuesInRange",function(){return M}),w.d(j,"getCuesInRange",function(){return P});var N=w("./src/utils/logger.ts");function E(_,S){var O;try{O=new Event("addtrack")}catch(C){O=document.createEvent("Event"),O.initEvent("addtrack",!1,!1)}O.track=_,S.dispatchEvent(O)}function R(_,S){var O=_.mode;if(O==="disabled"&&(_.mode="hidden"),_.cues&&!_.cues.getCueById(S.id))try{if(_.addCue(S),!_.cues.getCueById(S.id))throw new Error("addCue is failed for: "+S)}catch(x){N.logger.debug("[texttrack-utils]: "+x);var C=new self.TextTrackCue(S.startTime,S.endTime,S.text);C.id=S.id,_.addCue(C)}O==="disabled"&&(_.mode=O)}function I(_){var S=_.mode;if(S==="disabled"&&(_.mode="hidden"),_.cues)for(var O=_.cues.length;O--;)_.removeCue(_.cues[O]);S==="disabled"&&(_.mode=S)}function M(_,S,O){var C=_.mode;if(C==="disabled"&&(_.mode="hidden"),_.cues&&_.cues.length>0)for(var x=P(_.cues,S,O),b=0;b<x.length;b++)_.removeCue(x[b]);C==="disabled"&&(_.mode=C)}function T(_,S){if(S<_[0].startTime)return 0;var O=_.length-1;if(S>_[O].endTime)return-1;for(var C=0,x=O;C<=x;){var b=Math.floor((x+C)/2);if(S<_[b].startTime)x=b-1;else if(S>_[b].startTime&&C<O)C=b+1;else return b}return _[C].startTime-S<S-_[x].startTime?C:x}function P(_,S,O){var C=[],x=T(_,S);if(x>-1)for(var b=x,p=_.length;b<p;b++){var n=_[b];if(n.startTime>=S&&n.endTime<=O)C.push(n);else if(n.startTime>O)return C}return C}},"./src/utils/time-ranges.ts":function(Ee,j,w){"use strict";w.r(j);var N={toString:function(R){for(var I="",M=R.length,T=0;T<M;T++)I+="["+R.start(T).toFixed(3)+","+R.end(T).toFixed(3)+"]";return I}};j.default=N},"./src/utils/timescale-conversion.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"toTimescaleFromBase",function(){return E}),w.d(j,"toTimescaleFromScale",function(){return R}),w.d(j,"toMsFromMpegTsClock",function(){return I}),w.d(j,"toMpegTsClockFromTimescale",function(){return M});var N=9e4;function E(T,P,_,S){_===void 0&&(_=1),S===void 0&&(S=!1);var O=T*P*_;return S?Math.round(O):O}function R(T,P,_,S){return _===void 0&&(_=1),S===void 0&&(S=!1),E(T,P,1/_,S)}function I(T,P){return P===void 0&&(P=!1),E(T,1e3,1/N,P)}function M(T,P){return P===void 0&&(P=1),E(T,N,1/P)}},"./src/utils/typed-array.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"sliceUint8",function(){return N});function N(E,R,I){return Uint8Array.prototype.slice?E.slice(R,I):new Uint8Array(Array.prototype.slice.call(E,R,I))}},"./src/utils/vttcue.ts":function(Ee,j,w){"use strict";w.r(j),j.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var N=["","lr","rl"],E=["start","middle","end","left","right"];function R(_,S){if(typeof S!="string")return!1;if(!Array.isArray(_))return!1;var O=S.toLowerCase();return~_.indexOf(O)?O:!1}function I(_){return R(N,_)}function M(_){return R(E,_)}function T(_){for(var S=arguments.length,O=new Array(S>1?S-1:0),C=1;C<S;C++)O[C-1]=arguments[C];for(var x=1;x<arguments.length;x++){var b=arguments[x];for(var p in b)_[p]=b[p]}return _}function P(_,S,O){var C=this,x={enumerable:!0};C.hasBeenReset=!1;var b="",p=!1,n=_,l=S,s=O,g=null,d="",u=!0,m="auto",h="start",a=50,r="middle",e=50,i="middle";Object.defineProperty(C,"id",T({},x,{get:function(){return b},set:function(f){b=""+f}})),Object.defineProperty(C,"pauseOnExit",T({},x,{get:function(){return p},set:function(f){p=!!f}})),Object.defineProperty(C,"startTime",T({},x,{get:function(){return n},set:function(f){if(typeof f!="number")throw new TypeError("Start time must be set to a number.");n=f,this.hasBeenReset=!0}})),Object.defineProperty(C,"endTime",T({},x,{get:function(){return l},set:function(f){if(typeof f!="number")throw new TypeError("End time must be set to a number.");l=f,this.hasBeenReset=!0}})),Object.defineProperty(C,"text",T({},x,{get:function(){return s},set:function(f){s=""+f,this.hasBeenReset=!0}})),Object.defineProperty(C,"region",T({},x,{get:function(){return g},set:function(f){g=f,this.hasBeenReset=!0}})),Object.defineProperty(C,"vertical",T({},x,{get:function(){return d},set:function(f){var y=I(f);if(y===!1)throw new SyntaxError("An invalid or illegal string was specified.");d=y,this.hasBeenReset=!0}})),Object.defineProperty(C,"snapToLines",T({},x,{get:function(){return u},set:function(f){u=!!f,this.hasBeenReset=!0}})),Object.defineProperty(C,"line",T({},x,{get:function(){return m},set:function(f){if(typeof f!="number"&&f!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");m=f,this.hasBeenReset=!0}})),Object.defineProperty(C,"lineAlign",T({},x,{get:function(){return h},set:function(f){var y=M(f);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");h=y,this.hasBeenReset=!0}})),Object.defineProperty(C,"position",T({},x,{get:function(){return a},set:function(f){if(f<0||f>100)throw new Error("Position must be between 0 and 100.");a=f,this.hasBeenReset=!0}})),Object.defineProperty(C,"positionAlign",T({},x,{get:function(){return r},set:function(f){var y=M(f);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");r=y,this.hasBeenReset=!0}})),Object.defineProperty(C,"size",T({},x,{get:function(){return e},set:function(f){if(f<0||f>100)throw new Error("Size must be between 0 and 100.");e=f,this.hasBeenReset=!0}})),Object.defineProperty(C,"align",T({},x,{get:function(){return i},set:function(f){var y=M(f);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");i=y,this.hasBeenReset=!0}})),C.displayState=void 0}return P.prototype.getCueAsHTML=function(){var _=self.WebVTT;return _.convertCueToDOMTree(self,this.text)},P}()},"./src/utils/vttparser.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"parseTimeStamp",function(){return R}),w.d(j,"fixLineBreaks",function(){return S}),w.d(j,"VTTParser",function(){return O});var N=w("./src/utils/vttcue.ts"),E=function(){function C(){}var x=C.prototype;return x.decode=function(p,n){if(!p)return"";if(typeof p!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(p))},C}();function R(C){function x(p,n,l,s){return(p|0)*3600+(n|0)*60+(l|0)+parseFloat(s||0)}var b=C.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return b?parseFloat(b[2])>59?x(b[2],b[3],0,b[4]):x(b[1],b[2],b[3],b[4]):null}var I=function(){function C(){this.values=Object.create(null)}var x=C.prototype;return x.set=function(p,n){!this.get(p)&&n!==""&&(this.values[p]=n)},x.get=function(p,n,l){return l?this.has(p)?this.values[p]:n[l]:this.has(p)?this.values[p]:n},x.has=function(p){return p in this.values},x.alt=function(p,n,l){for(var s=0;s<l.length;++s)if(n===l[s]){this.set(p,n);break}},x.integer=function(p,n){/^-?\d+$/.test(n)&&this.set(p,parseInt(n,10))},x.percent=function(p,n){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(n)){var l=parseFloat(n);if(l>=0&&l<=100)return this.set(p,l),!0}return!1},C}();function M(C,x,b,p){var n=p?C.split(p):[C];for(var l in n){if(typeof n[l]!="string")continue;var s=n[l].split(b);if(s.length!==2)continue;var g=s[0],d=s[1];x(g,d)}}var T=new N.default(0,0,""),P=T.align==="middle"?"middle":"center";function _(C,x,b){var p=C;function n(){var g=R(C);if(g===null)throw new Error("Malformed timestamp: "+p);return C=C.replace(/^[^\sa-zA-Z-]+/,""),g}function l(g,d){var u=new I;M(g,function(a,r){var e;switch(a){case"region":for(var i=b.length-1;i>=0;i--)if(b[i].id===r){u.set(a,b[i].region);break}break;case"vertical":u.alt(a,r,["rl","lr"]);break;case"line":e=r.split(","),u.integer(a,e[0]),u.percent(a,e[0])&&u.set("snapToLines",!1),u.alt(a,e[0],["auto"]),e.length===2&&u.alt("lineAlign",e[1],["start",P,"end"]);break;case"position":e=r.split(","),u.percent(a,e[0]),e.length===2&&u.alt("positionAlign",e[1],["start",P,"end","line-left","line-right","auto"]);break;case"size":u.percent(a,r);break;case"align":u.alt(a,r,["start",P,"end","left","right"]);break}},/:/,/\s/),d.region=u.get("region",null),d.vertical=u.get("vertical","");var m=u.get("line","auto");m==="auto"&&T.line===-1&&(m=-1),d.line=m,d.lineAlign=u.get("lineAlign","start"),d.snapToLines=u.get("snapToLines",!0),d.size=u.get("size",100),d.align=u.get("align",P);var h=u.get("position","auto");h==="auto"&&T.position===50&&(h=d.align==="start"||d.align==="left"?0:d.align==="end"||d.align==="right"?100:50),d.position=h}function s(){C=C.replace(/^\s+/,"")}if(s(),x.startTime=n(),s(),C.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+p);C=C.substr(3),s(),x.endTime=n(),s(),l(C,x)}function S(C){return C.replace(/<br(?: \/)?>/gi,`
`)}var O=function(){function C(){this.state="INITIAL",this.buffer="",this.decoder=new E,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var x=C.prototype;return x.parse=function(p){var n=this;p&&(n.buffer+=n.decoder.decode(p,{stream:!0}));function l(){var h=n.buffer,a=0;for(h=S(h);a<h.length&&h[a]!=="\r"&&h[a]!==`
`;)++a;var r=h.substr(0,a);return h[a]==="\r"&&++a,h[a]===`
`&&++a,n.buffer=h.substr(a),r}function s(h){M(h,function(a,r){},/:/)}try{var g="";if(n.state==="INITIAL"){if(!/\r\n|\n/.test(n.buffer))return this;g=l();var d=g.match(/^()?WEBVTT([ \t].*)?$/);if(!d||!d[0])throw new Error("Malformed WebVTT signature.");n.state="HEADER"}for(var u=!1;n.buffer;){if(!/\r\n|\n/.test(n.buffer))return this;u?u=!1:g=l();switch(n.state){case"HEADER":/:/.test(g)?s(g):g||(n.state="ID");continue;case"NOTE":g||(n.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(g)){n.state="NOTE";break}if(!g)continue;if(n.cue=new N.default(0,0,""),n.state="CUE",g.indexOf("-->")===-1){n.cue.id=g;continue}case"CUE":if(!n.cue){n.state="BADCUE";continue}try{_(g,n.cue,n.regionList)}catch(h){n.cue=null,n.state="BADCUE";continue}n.state="CUETEXT";continue;case"CUETEXT":{var m=g.indexOf("-->")!==-1;if(!g||m&&(u=!0)){n.oncue&&n.cue&&n.oncue(n.cue),n.cue=null,n.state="ID";continue}if(n.cue===null)continue;n.cue.text&&(n.cue.text+=`
`),n.cue.text+=g}continue;case"BADCUE":g||(n.state="ID")}}}catch(h){n.state==="CUETEXT"&&n.cue&&n.oncue&&n.oncue(n.cue),n.cue=null,n.state=n.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},x.flush=function(){var p=this;try{if((p.cue||p.state==="HEADER")&&(p.buffer+=`
`,p.parse()),p.state==="INITIAL"||p.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(n){p.onparsingerror&&p.onparsingerror(n)}return p.onflush&&p.onflush(),this},C}()},"./src/utils/webvtt-parser.ts":function(Ee,j,w){"use strict";w.r(j),w.d(j,"generateCueId",function(){return O}),w.d(j,"parseWebVTT",function(){return x});var N=w("./src/polyfills/number.ts"),E=w("./src/utils/vttparser.ts"),R=w("./src/demux/id3.ts"),I=w("./src/utils/timescale-conversion.ts"),M=w("./src/remux/mp4-remuxer.ts"),T=/\r\n|\n\r|\n|\r/g,P=function(p,n,l){return l===void 0&&(l=0),p.substr(l,n.length)===n},_=function(p){var n=parseInt(p.substr(-3)),l=parseInt(p.substr(-6,2)),s=parseInt(p.substr(-9,2)),g=p.length>9?parseInt(p.substr(0,p.indexOf(":"))):0;if(!Object(N.isFiniteNumber)(n)||!Object(N.isFiniteNumber)(l)||!Object(N.isFiniteNumber)(s)||!Object(N.isFiniteNumber)(g))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+p);return n+=1e3*l,n+=60*1e3*s,n+=60*60*1e3*g,n},S=function(p){for(var n=5381,l=p.length;l;)n=n*33^p.charCodeAt(--l);return(n>>>0).toString()};function O(b,p,n){return S(b.toString())+S(p.toString())+S(n)}var C=function(p,n,l){var s=p[n],g=p[s.prevCC];if(!g||!g.new&&s.new){p.ccOffset=p.presentationOffset=s.start,s.new=!1;return}for(;(d=g)!==null&&d!==void 0&&d.new;){var d;p.ccOffset+=s.start-g.start,s.new=!1,s=g,g=p[s.prevCC]}p.presentationOffset=l};function x(b,p,n,l,s,g,d,u){var m=new E.VTTParser,h=Object(R.utf8ArrayToStr)(new Uint8Array(b)).trim().replace(T,`
`).split(`
`),a=[],r=Object(I.toMpegTsClockFromTimescale)(p,n),e="00:00.000",i=0,v=0,f,y=!0,t=!1;m.oncue=function(A){var U=l[s],F=l.ccOffset,H=(i-r)/9e4;if(U!=null&&U.new&&(v!==void 0?F=l.ccOffset=U.start:C(l,s,H)),H&&(F=H-l.presentationOffset),t){var J=A.endTime-A.startTime,B=Object(M.normalizePts)((A.startTime+F-v)*9e4,g*9e4)/9e4;A.startTime=B,A.endTime=B+J}var Z=A.text.trim();A.text=decodeURIComponent(encodeURIComponent(Z)),A.id||(A.id=O(A.startTime,A.endTime,Z)),A.endTime>0&&a.push(A)},m.onparsingerror=function(A){f=A},m.onflush=function(){if(f){u(f);return}d(a)},h.forEach(function(A){if(y)if(P(A,"X-TIMESTAMP-MAP=")){y=!1,t=!0,A.substr(16).split(",").forEach(function(U){P(U,"LOCAL:")?e=U.substr(6):P(U,"MPEGTS:")&&(i=parseInt(U.substr(7)))});try{v=_(e)/1e3}catch(U){t=!1,f=U}return}else A===""&&(y=!1);m.parse(A+`
`)}),m.flush()}},"./src/utils/xhr-loader.ts":function(Ee,j,w){"use strict";w.r(j);var N=w("./src/utils/logger.ts"),E=w("./src/loader/load-stats.ts"),R=/^age:\s*[\d.]+\s*$/m,I=function(){function M(P){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=P?P.xhrSetup:null,this.stats=new E.LoadStats,this.retryDelay=0}var T=M.prototype;return T.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},T.abortInternal=function(){var _=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),_&&(_.onreadystatechange=null,_.onprogress=null,_.readyState!==4&&(this.stats.aborted=!0,_.abort()))},T.abort=function(){var _;this.abortInternal(),(_=this.callbacks)!==null&&_!==void 0&&_.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},T.load=function(_,S,O){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=_,this.config=S,this.callbacks=O,this.retryDelay=S.retryDelay,this.loadInternal()},T.loadInternal=function(){var _=this.config,S=this.context;if(!_)return;var O=this.loader=new self.XMLHttpRequest,C=this.stats;C.loading.first=0,C.loaded=0;var x=this.xhrSetup;try{if(x)try{x(O,S.url)}catch(n){O.open("GET",S.url,!0),x(O,S.url)}O.readyState||O.open("GET",S.url,!0);var b=this.context.headers;if(b)for(var p in b)O.setRequestHeader(p,b[p])}catch(n){this.callbacks.onError({code:O.status,text:n.message},S,O);return}S.rangeEnd&&O.setRequestHeader("Range","bytes="+S.rangeStart+"-"+(S.rangeEnd-1)),O.onreadystatechange=this.readystatechange.bind(this),O.onprogress=this.loadprogress.bind(this),O.responseType=S.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),_.timeout),O.send()},T.readystatechange=function(){var _=this.context,S=this.loader,O=this.stats;if(!_||!S)return;var C=S.readyState,x=this.config;if(O.aborted)return;if(C>=2)if(self.clearTimeout(this.requestTimeout),O.loading.first===0&&(O.loading.first=Math.max(self.performance.now(),O.loading.start)),C===4){S.onreadystatechange=null,S.onprogress=null;var b=S.status;if(b>=200&&b<300){O.loading.end=Math.max(self.performance.now(),O.loading.first);var p,n;if(_.responseType==="arraybuffer"?(p=S.response,n=p.byteLength):(p=S.responseText,n=p.length),O.loaded=O.total=n,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(O,_,p,S),!this.callbacks)return;var s={url:S.responseURL,data:p};this.callbacks.onSuccess(s,O,_,S)}else O.retry>=x.maxRetry||b>=400&&b<499?(N.logger.error(b+" while loading "+_.url),this.callbacks.onError({code:b,text:S.statusText},_,S)):(N.logger.warn(b+" while loading "+_.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,x.maxRetryDelay),O.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),x.timeout)},T.loadtimeout=function(){N.logger.warn("timeout while loading "+this.context.url);var _=this.callbacks;_&&(this.abortInternal(),_.onTimeout(this.stats,this.context,this.loader))},T.loadprogress=function(_){var S=this.stats;S.loaded=_.loaded,_.lengthComputable&&(S.total=_.total)},T.getCacheAge=function(){var _=null;if(this.loader&&R.test(this.loader.getAllResponseHeaders())){var S=this.loader.getResponseHeader("age");_=S?parseFloat(S):null}return _},M}();j.default=I}}).default})},vHTk:function(Pt,Ye,W){Pt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},xlxt:function(Pt,Ye,W){Pt.exports={flex_box_center:"flex_box_center___1qaRn",flex_space_between:"flex_space_between___3tOTR",flex_box_vertical_center:"flex_box_vertical_center___2XsRs",flex_box_center_end:"flex_box_center_end___3O9De",flex_box_column:"flex_box_column___3bx6a",exportModal:"exportModal___29rdj"}}}]);