(window.webpackJsonp=window.webpackJsonp||[]).push([[294,6,7,11],{"+QRC":function(ut,ot,ee){"use strict";var ge=ee("E9nw"),G={"text/plain":"Text","text/html":"Url",default:"Text"},w="Copy to clipboard: #{key}, Enter";function z(v){var F=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return v.replace(/#{\s*key\s*}/g,F)}function k(v,F){var U,N,R,b,T,C,x=!1;F||(F={}),U=F.debug||!1;try{R=ge(),b=document.createRange(),T=document.getSelection(),C=document.createElement("span"),C.textContent=v,C.style.all="unset",C.style.position="fixed",C.style.top=0,C.style.clip="rect(0, 0, 0, 0)",C.style.whiteSpace="pre",C.style.webkitUserSelect="text",C.style.MozUserSelect="text",C.style.msUserSelect="text",C.style.userSelect="text",C.addEventListener("copy",function(E){if(E.stopPropagation(),F.format)if(E.preventDefault(),typeof E.clipboardData=="undefined"){U&&console.warn("unable to use e.clipboardData"),U&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var u=G[F.format]||G.default;window.clipboardData.setData(u,v)}else E.clipboardData.clearData(),E.clipboardData.setData(F.format,v);F.onCopy&&(E.preventDefault(),F.onCopy(E.clipboardData))}),document.body.appendChild(C),b.selectNodeContents(C),T.addRange(b);var S=document.execCommand("copy");if(!S)throw new Error("copy command was unsuccessful");x=!0}catch(E){U&&console.error("unable to copy using execCommand: ",E),U&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(F.format||"text",v),F.onCopy&&F.onCopy(window.clipboardData),x=!0}catch(u){U&&console.error("unable to copy using clipboardData: ",u),U&&console.error("falling back to prompt"),N=z("message"in F?F.message:w),window.prompt(N,v)}}finally{T&&(typeof T.removeRange=="function"?T.removeRange(b):T.removeAllRanges()),C&&document.body.removeChild(C),R()}return x}ut.exports=k},"0r65":function(ut,ot){var ee=arguments[3],ge=arguments[4],G=arguments[5],w=JSON.stringify;ut.exports=function(z,k){for(var v,F=Object.keys(G),U=0,N=F.length;U1&&arguments[1]!==void 0?arguments[1]:0,S=(F[C[x+0]]+F[C[x+1]]+F[C[x+2]]+F[C[x+3]]+"-"+F[C[x+4]]+F[C[x+5]]+"-"+F[C[x+6]]+F[C[x+7]]+"-"+F[C[x+8]]+F[C[x+9]]+"-"+F[C[x+10]]+F[C[x+11]]+F[C[x+12]]+F[C[x+13]]+F[C[x+14]]+F[C[x+15]]).toLowerCase();if(!v(S))throw TypeError("Stringified UUID is invalid");return S}var R=N;function b(C,x,S){C=C||{};var E=C.random||(C.rng||w)();if(E[6]=E[6]&15|64,E[8]=E[8]&63|128,x){S=S||0;for(var u=0;u<16;++u)x[S+u]=E[u];return x}return R(E)}var T=ot.a=b},"7ixt":function(ut,ot,ee){"use strict";ee.d(ot,"a",function(){return w});var ge={adjustX:1,adjustY:1},G=[0,0],w={left:{points:["cr","cl"],overflow:ge,offset:[-4,0],targetOffset:G},right:{points:["cl","cr"],overflow:ge,offset:[4,0],targetOffset:G},top:{points:["bc","tc"],overflow:ge,offset:[0,-4],targetOffset:G},bottom:{points:["tc","bc"],overflow:ge,offset:[0,4],targetOffset:G},topLeft:{points:["bl","tl"],overflow:ge,offset:[0,-4],targetOffset:G},leftTop:{points:["tr","tl"],overflow:ge,offset:[-4,0],targetOffset:G},topRight:{points:["br","tr"],overflow:ge,offset:[0,-4],targetOffset:G},rightTop:{points:["tl","tr"],overflow:ge,offset:[4,0],targetOffset:G},bottomRight:{points:["tr","br"],overflow:ge,offset:[0,4],targetOffset:G},rightBottom:{points:["bl","br"],overflow:ge,offset:[4,0],targetOffset:G},bottomLeft:{points:["tl","bl"],overflow:ge,offset:[0,4],targetOffset:G},leftBottom:{points:["br","bl"],overflow:ge,offset:[-4,0],targetOffset:G}},z=w},"8hTe":function(ut,ot,ee){ut.exports={button:"button___1wy9m"}},"8mKB":function(ut,ot,ee){"use strict";var ge=ee("rePB"),G=ee("1OyB"),w=ee("vuIU"),z=ee("Ji7U"),k=ee("md7G"),v=ee("foSv"),F=ee("q1tI"),U=ee.n(F),N=ee("m+aA"),R=ee("TSYQ"),b=ee.n(R),T=ee("4IlW");function C(o){var r=o.pageXOffset,i="scrollLeft";if(typeof r!="number"){var g=o.document;r=g.documentElement[i],typeof r!="number"&&(r=g.body[i])}return r}function x(o){var r,i,g=o.ownerDocument,p=g.body,_=g&&g.documentElement,D=o.getBoundingClientRect();return r=D.left,i=D.top,r-=_.clientLeft||p.clientLeft||0,i-=_.clientTop||p.clientTop||0,{left:r,top:i}}function S(o){var r=x(o),i=o.ownerDocument,g=i.defaultView||i.parentWindow;return r.left+=C(g),r.left}function E(o){var r=u();return function(){var g=Object(v.a)(o),p;if(r){var _=Object(v.a)(this).constructor;p=Reflect.construct(g,arguments,_)}else p=g.apply(this,arguments);return Object(k.a)(this,p)}}function u(){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(o){return!1}}var t=function(o){Object(z.a)(i,o);var r=E(i);function i(){var g;return Object(G.a)(this,i),g=r.apply(this,arguments),g.onHover=function(p){var _=g.props,D=_.onHover,M=_.index;D(p,M)},g.onClick=function(p){var _=g.props,D=_.onClick,M=_.index;D(p,M)},g.onKeyDown=function(p){var _=g.props,D=_.onClick,M=_.index;p.keyCode===13&&D(p,M)},g}return Object(w.a)(i,[{key:"getClassName",value:function(){var p=this.props,_=p.prefixCls,D=p.index,M=p.value,H=p.allowHalf,j=p.focused,V=D+1,$=_;return M===0&&D===0&&j?$+=" ".concat(_,"-focused"):H&&M+.5>=V&&MX?"true":"false","aria-posinset":X+1,"aria-setsize":q,tabIndex:H?-1:0},U.a.createElement("div",{className:"".concat(j,"-first")},oe),U.a.createElement("div",{className:"".concat(j,"-second")},oe)));return $&&(Ce=$(Ce,this.props)),Ce}}]),i}(U.a.Component);function n(o,r){var i=Object.keys(o);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(o);r&&(g=g.filter(function(p){return Object.getOwnPropertyDescriptor(o,p).enumerable})),i.push.apply(i,g)}return i}function s(o){for(var r=1;r0&&!q||M===T.a.RIGHT&&ie>0&&q?(V?ie-=.5:ie-=1,p.changeValue(ie),D.preventDefault()):M===T.a.LEFT&&ieq/2||!j&&_-X0)){ae.next=20;break}return ae.next=18,Promise.all(ve);case 18:pe=ae.sent,We+=Ze;case 20:ae.next=13;break;case 22:return ae.next=24,Object(U.a)("/api/attachments/multipart_upload_end",{method:"POST",body:Object(ge.a)({fileName:de.name,chunkCount:we,uploadId:at},h)});case 24:Z=ae.sent,Z.object?($("success"),Re(),c&&c(Object(ge.a)(Object(ge.a)({},Z),{},{file:de,percent:100}))):($("error"),xe("\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),Re(),y&&y(de.name));case 26:case"end":return ae.stop()}},je)})(),"t0",11);case 11:ke.next=19;break;case 13:ke.prev=13,ke.t1=ke.catch(9),$("error"),xe("\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),Re(),y&&y(de.name);case 19:case"end":return ke.stop()}},Ie,null,[[9,13]])}));return function(de){return Ne.apply(this,arguments)}}(),Le=Object(v.useCallback)(function(){Te.current=!0,ue.current&&(ue.current.abort(),l&&l())},[l]),Be=function(Ie){var de,ye,we=Ie==null||((de=Ie.target)===null||de===void 0||((ye=de.files)===null||ye===void 0))?void 0:ye[0];if(J(we),V="ready",!we)return;if(d){var Oe=d(we);Oe||he(we),Re();return}he(we)};return F.a.createElement(v.Fragment,null,F.a.createElement("input",{type:"file",id:re.current,style:{display:"none"},onChange:Be,accept:i}),F.a.createElement("label",{className:b()(C.a.upload,g),htmlFor:re.current,style:_},r))};ot.a=Object(v.forwardRef)(x)},"96GE":function(ut,ot,ee){"use strict";ee.r(ot),ee.d(ot,"formatQuery",function(){return De});var ge=ee("T2oS"),G=ee("W9HT"),w=ee("k1fw"),z=ee("PpiC"),k=ee("q1tI"),v=ee.n(k),F=ee("9kvl"),U=ee("JqQi"),N=ee.n(U),R=ee("pC0b"),b=ee("GzdX"),T=ee("9og8"),C=ee("tJVT"),x=ee("WmNS"),S=ee.n(x),E=ee("nUhQ"),u=ee.n(E),t=ee("2qtc"),n=ee("kLXV"),s=ee("7Kak"),h=ee("9yH6"),l=ee("miYZ"),c=ee("tsqr"),y=ee("5NDa"),f=ee("5rEg"),d=ee("Ty5D"),o=ee("sWEp"),r=ee.n(o),i=ee("qdXH"),g=f.a.Search,p=function($e){var Je,ze=$e.videoDetail,He=$e.globalSetting,qe=$e.loading,st=$e.dispatch,gt=Object(z.a)($e,["videoDetail","globalSetting","loading","dispatch"]),yt=Object(d.i)(),bt=Object(d.h)(),vt=Object(k.useState)([]),Ct=Object(C.a)(vt,2),pt=Ct[0],Ot=Ct[1],Rt=Object(k.useState)(""),_t=Object(C.a)(Rt,2),St=_t[0],Q=_t[1],K=Object(k.useState)(),m=Object(C.a)(K,2),A=m[0],L=m[1],B=Object(k.useState)(!1),Y=Object(C.a)(B,2),ce=Y[0],be=Y[1],Me=Object(k.useState)(!1),Ve=Object(C.a)(Me,2),Ge=Ve[0],rt=Ve[1];Object(k.useEffect)(function(){ze.actionTabs.key==="Banner-SendToClass"&&Qe()},[ze.actionTabs.key]);var Qe=function(){var O=Object(T.a)(S.a.mark(function e(){var a,P;return S.a.wrap(function(I){for(;;)switch(I.prev=I.next){case 0:return I.next=2,Object(i.h)({});case 2:if(P=I.sent,!(P!=null&&(a=P.courses)!==null&&a!==void 0&&a.length)){I.next=8;break}Ot((P==null?void 0:P.courses)||[]),rt(!0),I.next=11;break;case 8:return nt(),c.b.info("\u60A8\u5F53\u524D\u6CA1\u6709\u7BA1\u7406\u4EFB\u4F55\u8BFE\u5802\uFF0C\u4E0D\u53EF\u53D1\u9001"),I.abrupt("return");case 11:case"end":return I.stop()}},e)}));return function(){return O.apply(this,arguments)}}(),Pe=function(e){Ot(pt==null?void 0:pt.map(function(a){return Object(w.a)(Object(w.a)({},a),{},{hide:!a.course_name.includes(e)})}))},tt=function(){var O=Object(T.a)(S.a.mark(function e(){var a;return S.a.wrap(function(W){for(;;)switch(W.prev=W.next){case 0:if(A){W.next=3;break}return be(!0),W.abrupt("return");case 3:return W.next=5,Object(i.m)({id:yt.videoId,course_id:A});case 5:a=W.sent,(a==null?void 0:a.status)===0&&(c.b.success("\u53D1\u9001\u6210\u529F"),nt(),F.d===null||F.d===void 0||F.d.replace("/classrooms/".concat(A,"/shixun_homework")));case 7:case"end":return W.stop()}},e)}));return function(){return O.apply(this,arguments)}}(),nt=function(){Q(""),L(null),be(!1),st({type:"videoDetail/setActionTabs",payload:{}}),rt(!1)};return v.a.createElement(n.a,{centered:!0,keyboard:!1,closable:!1,title:"\u53D1\u9001\u81F3\u8BFE\u5802",visible:Ge,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",onOk:tt,onCancel:nt},v.a.createElement("div",{className:r.a.wrap},v.a.createElement("div",{className:"mb10"},v.a.createElement(g,{placeholder:"\u8F93\u5165\u8BFE\u5802\u540D\u79F0\u7684\u5173\u952E\u5B57\u8FDB\u884C\u641C\u7D22",value:St,onChange:function(e){return Q(e.target.value)},onSearch:function(e){Q(e),Pe(e)}})),v.a.createElement("div",{className:r.a.radioWrap},v.a.createElement(h.a.Group,{value:A,onChange:function(e){L(e.target.value),be(!1)}},pt==null||((Je=pt.filter(function(O){return!(O!=null&&O.hide)}))===null||Je===void 0)?void 0:Je.map(function(O,e){return v.a.createElement(h.a,{className:r.a.radio,value:O.course_id,key:e},O.course_name)}))),ce&&v.a.createElement("div",{className:r.a.colorFF0000},"\u8BF7\u9009\u62E9\u4F60\u8981\u53D1\u9001\u7684\u8BFE\u5802"),v.a.createElement("div",{className:r.a.title},"\u6E29\u99A8\u63D0\u793A\uFF1A\u5F53\u524D\u89C6\u9891\u9879\u76EE\u5C06\u4F1A\u53D1\u9001\u5230\u6307\u5B9A\u8BFE\u5802")))},_=Object(F.a)(function(lt){var $e=lt.videoDetail,Je=lt.loading,ze=lt.globalSetting;return{videoDetail:$e,globalSetting:ze,loading:Je.models.index}})(p),D=ee("sBCT"),M=ee("Mgx3"),H=ee("1vsH"),j=ee("NLgs"),V=ee("Awhp"),$=ee("KrTs"),X=ee("+L6B"),q=ee("2/Rp"),ie=ee("O3gP"),oe=ee("lrIw"),Ce=ee("oBTY"),Ee=ee("eoI0"),Se=ee.n(Ee),xe=ee("HBuW"),_e=function($e){var Je,ze,He=$e.videoDetail,qe=$e.dispatch,st=qe===void 0?function(){}:qe,gt=$e.visible,yt=$e.onClose,bt=yt===void 0?function(){}:yt,vt=He.queryParams,Ct=He.queryParams,pt=Ct.subject_id,Ot=Ct.videoId,Rt={videoId:Ot},_t=Object(k.useState)(0),St=Object(C.a)(_t,2),Q=St[0],K=St[1],m=Object(k.useState)(""),A=Object(C.a)(m,2),L=A[0],B=A[1],Y=Object(k.useState)([]),ce=Object(C.a)(Y,2),be=ce[0],Me=ce[1],Ve=Object(k.useState)([]),Ge=Object(C.a)(Ve,2),rt=Ge[0],Qe=Ge[1];Object(k.useEffect)(function(){var e,a,P=((e=He.detail)===null||e===void 0||((a=e.video_item)===null||a===void 0)?void 0:a.schools)||[];K(P!=null&&P.length?1:0),Qe(P)},[(Je=He.detail)===null||Je===void 0||((ze=Je.video_item)===null||ze===void 0)?void 0:ze.schools]);var Pe=function(){var e=Object(T.a)(S.a.mark(function a(P){var W;return S.a.wrap(function(le){for(;;)switch(le.prev=le.next){case 0:return le.next=2,Object(xe.P)({q:P});case 2:W=le.sent,W&&Me(W.shools_name||[]);case 4:case"end":return le.stop()}},a)}));return function(P){return e.apply(this,arguments)}}(),tt=function(a){if(rt.includes(a)){c.b.info("\u8BF7\u52FF\u6307\u5B9A\u76F8\u540C\u7684\u5355\u4F4D");return}B(""),Qe([].concat(Object(Ce.a)(rt),[a]))},nt=function(){var e=Object(T.a)(S.a.mark(function a(){var P;return S.a.wrap(function(I){for(;;)switch(I.prev=I.next){case 0:if(!(Q===1&&!(rt!=null&&rt.length))){I.next=2;break}return I.abrupt("return",c.b.info("\u8BF7\u9009\u62E9\u6307\u5B9A\u5355\u4F4D\u516C\u5F00"));case 2:return I.next=4,Object(i.a)(Object(w.a)(Object(w.a)({},vt),{},{id:Rt.videoId,schools:Q===0?[]:rt,is_public:!(Q===2)}));case 4:P=I.sent,(P==null?void 0:P.status)===0&&(c.b.success("\u8BBE\u7F6E\u6210\u529F"),O());case 6:case"end":return I.stop()}},a)}));return function(){return e.apply(this,arguments)}}(),O=function(){bt(),st({type:"videoDetail/getVideoDetail",payload:Object(w.a)(Object(w.a)({},vt),{},{id:Rt.videoId})})};return v.a.createElement(n.a,{centered:!0,maskClosable:!1,title:"\u6743\u9650\u8BBE\u7F6E",width:530,className:Se.a.modal,visible:gt,onOk:nt,onCancel:O},v.a.createElement(v.a.Fragment,null,v.a.createElement(h.a.Group,{value:Q,onChange:function(a){return K(a.target.value)}},v.a.createElement(h.a,{value:0},"\u5BF9\u6240\u6709\u5355\u4F4D\u516C\u5F00",v.a.createElement("span",null,"\uFF08\u9009\u4E2D\u540E\uFF0C\u5BF9\u6240\u6709\u7528\u6237\u53EF\u89C1\uFF09")),v.a.createElement(h.a,{value:1},"\u5BF9\u6307\u5B9A\u5355\u4F4D\u516C\u5F00",v.a.createElement("span",null,"\uFF08\u9009\u4E2D\u540E\uFF0C\u4EC5\u5BF9\u4E0B\u65B9\u6307\u5B9A\u5355\u4F4D\u7528\u6237\u53EF\u89C1\uFF09")),v.a.createElement(h.a,{value:2},"\u4E0D\u516C\u5F00",v.a.createElement("span",null,"\uFF08\u9009\u4E2D\u540E\uFF0C\u5BF9\u6240\u6709\u7528\u6237\u4E0D\u53EF\u89C1\uFF09"))),Q===1&&v.a.createElement(v.a.Fragment,null,v.a.createElement("div",{className:"mt10"},v.a.createElement(oe.a,{showSearch:!0,className:Se.a.selectSchool,placeholder:"\u8BF7\u8F93\u5165\u5E76\u9009\u62E9\u5355\u4F4D\u540D\u79F0",value:L,onChange:function(a){B(a),Pe(a)},onSelect:tt,options:be==null?void 0:be.map(function(e){return{value:e}})})),v.a.createElement("div",{className:"mt10"},rt==null?void 0:rt.map(function(e,a){return v.a.createElement($.a,{count:v.a.createElement("span",{className:Se.a.delete,onClick:function(){return Qe(rt.filter(function(W){return W!==e}))}},"x"),className:"mt10 mr20 current",key:a},v.a.createElement(q.a,{type:"primary",ghost:!0},e))})))))},fe=_e,se=function($e){var Je=$e.user,ze=$e.videoDetail,He=$e.dispatch,qe=ze.queryParams,st=ze.queryParams,gt=st.subject_id,yt=st.videoId,bt={videoId:yt},vt=Object(k.useState)(),Ct=Object(C.a)(vt,2),pt=Ct[0],Ot=Ct[1],Rt=Object(k.useState)(),_t=Object(C.a)(Rt,2),St=_t[0],Q=_t[1],K=Object(k.useState)(!1),m=Object(C.a)(K,2),A=m[0],L=m[1],B=ze.detail||{},Y=B.video_item,ce=ze||{},be=ce.stages,Me=function(){He({type:"videoDetail/setActionTabs",payload:{key:"Banner-SendToClass"}})},Ve=function(){var rt=Object(T.a)(S.a.mark(function Qe(){var Pe,tt,nt,O,e,a;return S.a.wrap(function(W){for(;;)switch(W.prev=W.next){case 0:if(!((Pe=Je.userInfo)!==null&&Pe!==void 0&&Pe.admin||(tt=Je.userInfo)!==null&&tt!==void 0&&tt.is_teacher&&Object(j.d)())){W.next=9;break}return O=[],be.map(function(I){I.items.map(function(le){O.push(le)})}),e=O.filter(function(I){return I.id===Y.id}),W.next=6,Object(i.g)(Object(w.a)({id:e==null||((nt=e[0])===null||nt===void 0)?void 0:nt.stage_item_id},qe));case 6:a=W.sent,Q(a),Ot(!0);case 9:case"end":return W.stop()}},Qe)}));return function(){return rt.apply(this,arguments)}}(),Ge=function(){var rt=Object(T.a)(S.a.mark(function Qe(Pe){var tt,nt,O;return S.a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,Object(M.R)(Object(w.a)(Object(w.a)({id:St==null?void 0:St.id},Pe),{},{video_id:(Pe==null?void 0:Pe.video_id)||(St==null||((tt=St.video_item)===null||tt===void 0)?void 0:tt.video_id),link:(Pe==null?void 0:Pe.link)||(St==null||((nt=St.video_item)===null||nt===void 0)?void 0:nt.link)}));case 2:return O=a.sent,O&&(Ot(!1),He({type:"videoDetail/getVideoDetail",payload:Object(w.a)({id:bt.videoId},qe)})),a.abrupt("return",O);case 5:case"end":return a.stop()}},Qe)}));return function(Pe){return rt.apply(this,arguments)}}();return v.a.createElement("aside",{className:u.a.banner},v.a.createElement("aside",{className:u.a.wrap},v.a.createElement("p",{className:u.a.title},Y==null?void 0:Y.name),v.a.createElement("div",{className:u.a.contentWrap},v.a.createElement("span",{className:"font14 c-white"},v.a.createElement("span",{className:"mr10"},"\u5B66\u4E60\u4EBA\u6570\uFF1A"),v.a.createElement("span",null,(Y==null?void 0:Y.study_video_items_count)||0),v.a.createElement("span",{className:"ml100 mr10"},"\u5B66\u5458\u8BC4\u5206\uFF1A"),v.a.createElement(b.a,{allowHalf:!0,value:Object(H.C)(Y==null?void 0:Y.star),disabled:!0,className:u.a.rating})))),v.a.createElement(_,null),v.a.createElement(D.a,{editData:St,visible:pt,onCancel:function(){return Ot(!1)},onOk:Ge,queryParams:qe}),v.a.createElement(fe,{dispatch:He,videoDetail:ze,visible:A,onClose:function(){return L(!1)}}))},J=Object(F.a)(function(lt){var $e=lt.user,Je=lt.videoDetail;return{user:$e,videoDetail:Je}})(se),ue=ee("R9oj"),re=ee("ECub"),Te=ee("sRBo"),Re=ee("kaz8"),he=ee("J66h"),Le=ee("hgre"),Be=ee("9Bee"),Ne=ee("vZDz"),Ie=ee.n(Ne),de=ee("9VGf"),ye=function($e){var Je=$e.videoDetail,ze=$e.globalSetting,He=$e.loading,qe=$e.dispatch,st=Object(z.a)($e,["videoDetail","globalSetting","loading","dispatch"]),gt=Je.queryParams,yt=Je.selectParams,bt=Je.videoList,vt=gt.subject_id,Ct=gt.videoId,pt=yt.checkBoxValue,Ot=yt.radioValue,Rt={videoId:Ct},_t={query:gt},St=Object(k.useRef)(),Q=Object(k.useRef)(),K=Object(k.useRef)(),m=Object(k.useRef)(5),A=Je.detail||{},L=A.video_item;Object(de.a)(Object(T.a)(S.a.mark(function Qe(){return S.a.wrap(function(tt){for(;;)switch(tt.prev=tt.next){case 0:if(!Q.current){tt.next=5;break}return console.log("videoRef lastUpdatedTime: ",St.current.getLastUpdatedTime()),console.log(St.current),tt.next=5,B();case 5:case"end":return tt.stop()}},Qe)})),m.current*1e3);var B=function(){var Pe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,tt=Pe?{is_f:1}:{};return Object(i.n)(Object(w.a)(Object(w.a)({},tt),{id:Rt.videoId,point:St.current.getLastUpdatedTime(),total:St.current.getDuration()}))},Y=function(Pe){return Pe.ed==="1"&&(Q.current=!1,B(!0)),!Q.current&&!Pe.ed&&(Q.current=!0,m.current=St.current.getDuration()<=5?1:5,B()),qe({type:"userDetail/logWatchHistory",payload:Pe})},ce=function(){Q.current=!1},be=function(){Q.current=!0},Me=function(){K.current=5,n.a.confirm({width:600,centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u8BF7\u7ED9\u672C\u89C6\u9891\u8BC4\u5206",content:v.a.createElement("div",{className:"tc font14"},v.a.createElement(b.a,{defaultValue:K.current,onChange:function(tt){return K.current=tt},className:Ie.a.modalRating})),onOk:function(){var Pe=Object(T.a)(S.a.mark(function nt(){var O,e,a;return S.a.wrap(function(W){for(;;)switch(W.prev=W.next){case 0:return W.next=2,Object(i.l)({id:Rt.videoId,star:K.current});case 2:O=W.sent,O.status===0&&(e=Object(H.I)(),a=e.course_id,qe({type:"videoDetail/getVideoDetail",payload:{id:Rt.videoId,videoId:Rt.videoId,course_id:a}}));case 4:case"end":return W.stop()}},nt)}));function tt(){return Pe.apply(this,arguments)}return tt}()})},Ve=function(Pe){var tt=window.filterVideoSign,nt=tt.findIndex(function(I){return I.id===Ct}),O=nt===tt.length-1;if(O)return;var e=tt[nt+1].id,a=tt[nt+1].can_view,P=tt[nt+1].link,W=tt[nt+1].is_public;if(window.checkBoxValue){if(P){window.open(P);return}if(!a){n.a.info({centered:!0,width:400,okText:"\u77E5\u9053\u5566",icon:null,content:v.a.createElement("div",{className:"tc font14"},"\u4E0B\u4E00\u6761\u89C6\u9891\u4E3A\u521B\u5EFA\u8005\u6240\u5C5E\u5355\u4F4D\u5185\u90E8\u6559\u5B66\u8D44\u6599\uFF0C\u5916\u5355\u4F4D\u7528\u6237\u65E0\u89C2\u770B\u6743\u9650")});return}if(!W){n.a.info({centered:!0,width:400,okText:"\u77E5\u9053\u5566",icon:null,content:v.a.createElement("div",{className:"tc font14"},"\u4E0B\u4E00\u6761\u89C6\u9891\u6682\u672A\u516C\u5F00\uFF0C\u656C\u8BF7\u671F\u5F85")});return}qe({type:"videoDetail/handleListItemClick",payload:{videoId:e}}),window.videoTimer=setTimeout(function(){Pe.current.play()},2e3)}},Ge=function(Pe,tt){if(Pe==="checkBox"){var nt=tt.target.checked;window.checkBoxValue=nt,qe({type:"videoDetail/setSelectValue",payload:{radioValue:Ot,checkBoxValue:nt}});return}qe({type:"videoDetail/setSelectValue",payload:{checkBoxValue:pt,radioValue:tt.target.value}})},rt=function(){var Pe=bt.findIndex(function(nt){return nt.id===Ct}),tt=Pe===bt.length-1;return tt?v.a.createElement("div",null,"\u5F53\u524D\u5DF2\u662F\u6700\u540E\u4E00\u4E2A\u89C6\u9891"):v.a.createElement(Re.a,{onChange:function(O){Ge("checkBox",O)},checked:pt},"\u81EA\u52A8\u64AD\u653E\u4E0B\u4E00\u4E2A\u89C6\u9891")};return v.a.createElement("aside",{className:Ie.a.contentWrap},v.a.createElement("aside",{className:Ie.a.wrap},v.a.createElement("header",null,(L==null?void 0:L.description)&&v.a.createElement("span",{className:Ie.a.introName},"\u7B80\u4ECB"),Object(H.P)(L==null?void 0:L.my_star)?v.a.createElement(q.a,{type:"primary",ghost:!0,onClick:Me},"\u8BC4\u5206"):v.a.createElement("span",null,v.a.createElement("span",{className:"ml100 mr10 font14"},"\u6211\u7684\u8BC4\u5206\uFF1A"),v.a.createElement(b.a,{value:L==null?void 0:L.my_star,disabled:!0,className:Ie.a.rating}))),v.a.createElement("div",{className:"mt20"},v.a.createElement(Be.a,{value:(L==null?void 0:L.description)||""})),!(L!=null&&L.can_edit)&&!(L!=null&&L.is_public)?v.a.createElement(re.a,{description:"\u5F53\u524D\u89C6\u9891\u6682\u672A\u516C\u5F00\uFF0C\u656C\u8BF7\u671F\u5F85"}):v.a.createElement(Le.a,{ref:St,startTime:L==null?void 0:L.last_point,src:L!=null&&L.is_link?L==null?void 0:L.link:(L==null?void 0:L.play_url)&&he.Base64.decode(L==null?void 0:L.play_url),videoId:L==null?void 0:L.video_id,logWatchHistory:Y,handlePause:ce,handlePlay:be,videoSpeed:Ot,handlePlayEnded:Ve,toLog:function(){}}),!(L!=null&&L.can_edit)&&!(L!=null&&L.is_public)?null:v.a.createElement("div",{className:Ie.a.footer},v.a.createElement("div",{className:Ie.a.checkBox},rt()),v.a.createElement("div",{className:Ie.a.radioGroup},v.a.createElement(h.a.Group,{onChange:function(Pe){Ge("radio",Pe)},value:Ot},v.a.createElement(h.a,{value:1},"1.0X"),v.a.createElement(h.a,{value:1.5},"1.5X"),v.a.createElement(h.a,{value:2},"2.0X"))))))},we=Object(F.a)(function(lt){var $e=lt.videoDetail,Je=lt.loading,ze=lt.globalSetting;return{videoDetail:$e,globalSetting:ze,loading:Je}})(ye),Oe=ee("MRWH"),ke=ee.n(Oe),je=ee("V0Rq"),it=ee("m3rI"),at=[{name:"\u5B9E\u8DF5\u9879\u76EE",type:"Shixun",icon:v.a.createElement("i",{className:"iconfont icon-shixun2 font20"})},{name:"\u89C6\u9891\u9879\u76EE",type:"VideoItem",icon:v.a.createElement("i",{className:"iconfont icon-shipin font20"})},{name:"\u6559\u5B66\u8BFE\u4EF6",type:"Attachment",icon:v.a.createElement("i",{className:"iconfont icon-jiaoxueanli font20"})},{name:"\u7A7A\u76EE\u5F55",type:"StageCatalog",icon:v.a.createElement("i",{className:"iconfont icon-kongbai font20"})}],et=function($e){var Je=$e.dispatch,ze=$e.videoDetail,He=$e.user,qe=Object(z.a)($e,["dispatch","videoDetail","user"]),st=ze.queryParams,gt=ze.stages,yt=ze.cust_seq,bt=ze.active,vt=st.subject_id,Ct=st.course_id;Object(k.useEffect)(function(){Je(vt?{type:"videoDetail/getStageData",payload:{subject_id:vt}}:{type:"videoDetail/getCourseStageData",payload:{coursesId:Ct}})},[]);var pt=function(){var m=Object(T.a)(S.a.mark(function A(L,B){var Y;return S.a.wrap(function(be){for(;;)switch(be.prev=be.next){case 0:if(Je({type:"globalSetting/setGlobalLoading",payload:{show:!0,text:"\u6B63\u5728\u8FDB\u5165\u5B9E\u8BAD\uFF0C\u8BF7\u7A0D\u540E..."}}),!B){be.next=7;break}return be.next=4,Object(xe.D)({id:L});case 4:be.t0=be.sent,be.next=10;break;case 7:return be.next=9,Object(xe.E)({id:L});case 9:be.t0=be.sent;case 10:if(Y=be.t0,Je({type:"globalSetting/setGlobalLoading",payload:{show:!1,text:""}}),!(Y!=null&&Y.game_identifier||Y!=null&&Y.identifier)){be.next=15;break}return Object(H.S)(B?"/tasks/".concat(Y==null?void 0:Y.identifier,"/jupyter"):"/tasks/".concat(Y.game_identifier)),be.abrupt("return");case 15:(Y==null?void 0:Y.status)===2?Rt(Y==null?void 0:Y.message):(Y==null?void 0:Y.status)===3&&Ot(Y==null?void 0:Y.message);case 16:case"end":return be.stop()}},A)}));return function(L,B){return m.apply(this,arguments)}}(),Ot=function(A){n.a.confirm({centered:!0,title:"\u63D0\u793A",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:v.a.createElement("div",{className:"tc font16"},"\u76EE\u524D\u8BE5\u5B9E\u8DF5\u9879\u76EE\u5C1A\u5728\u5185\u6D4B\u4E2D\uFF0C\u5C06\u4E8E",A,"\u4E4B\u540E\u5F00\u653E\uFF0C\u8C22\u8C22\uFF01")})},Rt=function m(A){var L;A=(L=A)!==null&&L!==void 0&&L.includes(".json")?A:"".concat(A,".json"),n.a.confirm({centered:!0,title:"\u63D0\u793A",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:v.a.createElement("div",{className:"tc font16"},"\u5B9E\u8BAD\u5DF2\u7ECF\u66F4\u65B0\u4E86\uFF0C\u6B63\u5728\u4E3A\u60A8\u91CD\u7F6E!"),onOk:function(){var B=Object(T.a)(S.a.mark(function ce(){var be,Me;return S.a.wrap(function(Ge){for(;;)switch(Ge.prev=Ge.next){case 0:return Ge.next=2,Object(je.U)({url:A});case 2:if(be=Ge.sent,be){Ge.next=5;break}return Ge.abrupt("return");case 5:return c.b.success("\u91CD\u7F6E\u6210\u529F\uFF0C\u6B63\u5728\u8FDB\u5165\u5B9E\u8BAD\uFF01"),Ge.next=8,Object(xe.E)({id:be.shixun_identifier});case 8:if(Me=Ge.sent,!(Me!=null&&Me.game_identifier)){Ge.next=12;break}return Object(H.S)("/tasks/".concat(Me.game_identifier)),Ge.abrupt("return");case 12:(Me==null?void 0:Me.status)===2?m(Me==null?void 0:Me.message):(Me==null?void 0:Me.status)===3&&Ot(Me==null?void 0:Me.message);case 13:case"end":return Ge.stop()}},ce)}));function Y(){return B.apply(this,arguments)}return Y}()})},_t=function(A){if((A==null?void 0:A.item_type)==="StageCatalog")return;clearTimeout(window.videoTimer);var L=A.id,B=A.item_type,Y=A.identifier,ce=A.is_jupyter,be=A.url,Me=A.link;if(B==="VideoItem"&&!Me){var Ve,Ge;if(!((Ve=He.userInfo)!==null&&Ve!==void 0&&Ve.admin)&&!((Ge=He.userInfo)!==null&&Ge!==void 0&&Ge.business)&&!A.can_view){n.a.info({centered:!0,width:400,okText:"\u77E5\u9053\u5566",icon:null,content:v.a.createElement("div",{className:"tc font14"},"\u5F53\u524D\u89C6\u9891\u4E3A\u521B\u5EFA\u8005\u6240\u5C5E\u5355\u4F4D\u5185\u90E8\u6559\u5B66\u8D44\u6599\uFF0C\u5916\u5355\u4F4D\u7528\u6237\u65E0\u89C2\u770B\u6743\u9650")});return}Je({type:"videoDetail/handleListItemClick",payload:{videoId:L}}),Je({type:"videoDetail/getVideoDetail",payload:Object(w.a)(Object(w.a)({id:L},st),{},{videoId:L}),callback:function(Qe){if(Qe&&Qe.video_item&&!Qe.video_item.can_edit&&!A.is_public){n.a.info({centered:!0,width:400,okText:"\u77E5\u9053\u5566",icon:null,content:v.a.createElement("div",{className:"tc font14"},"\u5F53\u524D\u89C6\u9891\u6682\u672A\u516C\u5F00\uFF0C\u656C\u8BF7\u671F\u5F85")});return}}});return}if(B==="VideoItem"&&!!Me){A.link&&Object(i.n)({is_f:1,id:A.id,point:0,total:0}),window.open(Me);return}if(B==="Shixun"){pt(Y,ce);return}if(B==="Attachment"){Object(H.v)(A.name,it.a.API_SERVER+A.url);return}window.open(it.a.IMG_SERVER+be)},St=function(A){var L=["\u96F6","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D","\u4E03","\u516B","\u4E5D"],B=["","\u5341","\u767E","\u5343","\u4E07"];A=parseInt(A);var Y=function(Ve){for(var Ge=Ve.toString().split("").reverse(),rt="",Qe=0;Qe0&&Ge[Qe]==0&&Ge[Qe-1]==0?"":L[Ge[Qe]]+(Ge[Qe]==0?B[0]:B[Qe]))+rt;return rt},ce=Math.floor(A/1e4),be=A%1e4;return be.toString().length<4&&(be="0"+be),ce?Y(ce)+"\u4E07"+Y(be):Y(A)},Q=function(A,L,B,Y){var ce,be=A.name,Me=A.item_type,Ve=A.id,Ge="".concat(L+1,"-").concat(B+1,"-").concat(Y+1),rt=(ce=at.find(function(tt){return tt.type===Me}))===null||ce===void 0?void 0:ce.icon,Qe=ke.a.brght,Pe=bt.id===Ve?"".concat(Qe," ").concat(ke.a.active):Qe;return v.a.createElement("div",{key:Ge,onClick:function(){return _t(A)},className:Pe,style:{paddingLeft:52}},v.a.createElement("span",{className:ke.a.s1},rt),!!yt&&v.a.createElement("span",{className:ke.a.s2},Ge),v.a.createElement("span",{className:ke.a.s3},"\u203B ",be))},K=function(A,L,B){var Y,ce=A.name,be=A.item_type,Me=A.id,Ve=A.children,Ge="".concat(L+1,"-").concat(B+1),rt=(Y=at.find(function(tt){return tt.type===be}))===null||Y===void 0?void 0:Y.icon,Qe=ke.a.brght,Pe=bt.id===Me?"".concat(Qe," ").concat(ke.a.active):Qe;return v.a.createElement(k.Fragment,{key:Ge},v.a.createElement("div",{onClick:function(){return _t(A)},className:Pe},v.a.createElement("span",{className:ke.a.s1},rt),!!yt&&v.a.createElement("span",{className:ke.a.s2},Ge),v.a.createElement("span",{className:ke.a.s3},"\u203B ",ce)),!!Ve.length&&Ve.map(function(tt,nt){return Q(tt,L,B,nt)}))};return v.a.createElement("aside",{className:ke.a.list},gt.map(function(m,A){var L=m.stage_name,B=m.items,Y=B===void 0?[]:B;return v.a.createElement("aside",{key:A,className:ke.a.box},v.a.createElement("div",{className:ke.a.title},St(A+1),"\u3001",L),Y.map(function(ce,be){return K(ce,A,be)}),A!==gt.length-1&&v.a.createElement("div",{className:ke.a.line}))}))},Ke=Object(F.a)(function(lt){var $e=lt.user,Je=lt.videoDetail,ze=lt.loading,He=lt.globalSetting;return{user:$e,videoDetail:Je,globalSetting:He,loading:ze}})(et),dt=ee("lppi"),ft=ee.n(dt),We=ee("fWQN"),Ze=function lt(){var $e=this;Object(We.a)(this,lt),this.conversion_getDPI=function(){var Je=new Array;if(window.screen.deviceXDPI)Je[0]=window.screen.deviceXDPI,Je[1]=window.screen.deviceXDPI;else{var ze=document.createElement("DIV");ze.style.cssText="width:1in;height:1in;position:absolute;left:0px;top:0px;z-index:99;visibility:hidden",document.body.appendChild(ze),Je[0]=parseInt(String(ze.offsetWidth)),Je[1]=parseInt(String(ze.offsetHeight)),ze.parentNode.removeChild(ze)}return Je},this.pxConversionMm=function(Je){var ze=Je/$e.conversion_getDPI()[0],He=ze*25.4;return He},this.mmConversionPx=function(Je){var ze=Je/25.4,He=ze*$e.conversion_getDPI()[0];return He}},me=new Ze,ve=me.mmConversionPx(297),pe=function($e){var Je=$e.url,ze=Object(k.useState)(""),He=Object(C.a)(ze,2),qe=He[0],st=He[1],gt=Object(k.useState)(!0),yt=Object(C.a)(gt,2),bt=yt[0],vt=yt[1];return Object(k.useEffect)(function(){var Ct="".concat(it.a.API_SERVER).concat(Je);qe!==Ct&&(vt(!1),setTimeout(function(){vt(!0)},500)),st(Ct)},[Je]),qe?v.a.createElement("div",{className:ft.a.pdfContainer},v.a.createElement("div",{className:ft.a.loading},v.a.createElement(G.a,{tip:"\u6B63\u5728\u52A0\u8F7D"})),bt&&v.a.createElement("embed",{src:qe,height:ve,width:"100%"})):v.a.createElement(v.a.Fragment,null)},Z=pe,te=ee("b57q"),ae=ee.n(te),ne=function($e){var Je=$e.url,ze=Object(H.T)(Je).filesize,He=1024*1024,qe=10*He;return v.a.createElement("div",{className:ae.a.officeContainer},ze>qe&&v.a.createElement("div",{className:"tc mt100 font16"},"\u5F53\u524D\u6587\u4EF6(",parseInt(ze/He),"MB)\uFF0C\u5DF2\u8D85\u51FA\u6700\u5927\u9650\u5236\uFF0C\u8BF7\u4E0B\u8F7D\u540E\u9884\u89C8\uFF01",v.a.createElement("br",null),v.a.createElement(q.a,{type:"primary",className:"mt20"},v.a.createElement("a",{href:"".concat(it.a.IMG_SERVER).concat(Je)},"\u70B9\u51FB\u4E0B\u8F7D"))),ze<=qe&&v.a.createElement("iframe",{frameBorder:0,width:"100%",height,src:"https://view.officeapps.live.com/op/view.aspx?src=".concat(encodeURIComponent("".concat(it.a.IMG_SERVER).concat(Je,"?disposition=inline")))}))},Ae=ne,De=function($e){var Je=$e.subject_id;return{subject_id:Je,course_id:Je}},Ye=function($e){var Je=$e.videoDetail,ze=$e.globalSetting,He=$e.loading,qe=$e.dispatch,st=Object(z.a)($e,["videoDetail","globalSetting","loading","dispatch"]),gt=Je.queryParams,yt=Je.videoList,bt=Je.attachmentList,vt=Je.active,Ct=gt.subject_id,pt=gt.videoId,Ot={videoId:pt};Object(k.useEffect)(function(){if(vt){var _t=vt.item_type,St=vt.id;_t==="VideoItem"&&qe({type:"videoDetail/getVideoDetail",payload:Object(w.a)(Object(w.a)({},gt),{},{id:St})})}},[vt.id]),Object(k.useEffect)(function(){var _t,St;Object(H.X)((_t=Je.detail)===null||_t===void 0||((St=_t.video_item)===null||St===void 0)?void 0:St.name)},[Je]);var Rt={width:1200};return vt&&vt.item_type==="Attachment"&&vt.content_type==="application/pdf"&&(Rt={width:1250,marginLeft:(document.body.clientWidth-1200)/2}),console.log("active:",vt),v.a.createElement(G.a,{spinning:!1},v.a.createElement("section",{className:N.a.bg},v.a.createElement(J,null),v.a.createElement("div",{className:N.a.container,style:Rt},v.a.createElement(Ke,null),vt&&vt.item_type==="VideoItem"&&v.a.createElement(we,null),vt&&vt.item_type==="Attachment"&&vt.content_type==="application/pdf"&&vt.url&&v.a.createElement(Z,{url:vt.url}),vt&&vt.item_type==="Attachment"&&["application/msword","application/vnd.ms-excel","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document"].includes(vt.content_type)&&vt.url&&v.a.createElement(Ae,{url:vt.url,name:vt.name}))))},mt=ot.default=Object(F.a)(function(lt){var $e=lt.videoDetail,Je=lt.loading,ze=lt.globalSetting;return{videoDetail:$e,globalSetting:ze,loading:Je}})(Ye)},"9Bee":function(ut,ot,ee){"use strict";var ge=ee("DYRE"),G=ee("zeV3"),w=ee("+L6B"),z=ee("2/Rp"),k=ee("k1fw"),v=ee("9og8"),F=ee("tJVT"),U=ee("WmNS"),N=ee.n(U),R=ee("q1tI"),b=ee.n(R),T=ee("vg9a"),C=ee("DlQD"),x=ee.n(C),S=ee("rUJ1");function E(O,e){var a=O.match(/^(\s+)(?:```)/);if(a===null)return e;var P=a[1];return e.split(`
`).map(function(W){var I=W.match(/^\s+/);if(I===null)return W;var le=Object(F.a)(I,1),Ue=le[0];return Ue.length>=P.length?W.slice(P.length):W}).join(`
`)}var u=[],t=[""],n=new x.a.Renderer,s=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function h(){u.length=0,t=[""]}var l={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function c(O,e,a,P){if(e>=O.length||O[e].level<=a)return e;var W=O[e];P.push("- "+W.text+""),e++;var I=[];return e=c(O,e,W.level,I),I.length>0&&(P.push("
"),I.forEach(function(le){P.push(le)}),P.push("
")),P.push(" "),e=c(O,e,a,P),e}function y(){return c(u,0,0,t),t.push("
"),t.join("")}var f={heading:function(e){var a=s.exec(e);if(a)return{type:"heading",raw:a[0],depth:a[1].length,text:a[2]}},fences:function(e){var a=this.rules.block.fences.exec(e);if(a){var P=a[0],W=E(P,a[3]||""),I=a[2]?a[2].trim():a[2];if(["latex","katex","math"].indexOf(I)>=0){var le=r(),Ue=W;W=le,i[le]={type:"block",expression:Ue}}return{type:"code",raw:P,lang:I,text:W}}}},d=/(?:\${2})([^\n`]+?)(?:\${2})/gi,o=0,r=function(){return"__special_katext_id_".concat(o++,"__")},i={};function g(){return i}function p(){o=0,i={}}function _(O){return O=O.replace(d,function(e,a){var P=r();return i[P]={type:"inline",expression:a},P}),O}var D=n.listitem;n.listitem=function(O){return D(_(O))};var M=n.paragraph;n.paragraph=function(O){return M(_(O))};var H=n.tablecell;n.tablecell=function(O,e){return H(_(O),e)},n.code=function(O,e,a){var P=(e||"").match(/\S*/)[0];return P?["latex","katex","math"].indexOf(P)>=0?"".concat(O,"
"):'
').concat(a?O:Object(S.escape)(O,!0),`
`):''+(a?O:Object(S.escape)(O,!0))+"
"},n.heading=function(O,e,a){var P=this.options.headerPrefix+a.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return u.push({anchor:P,level:e,text:O}),"'+O+""},x.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),x.a.use({tokenizer:f,renderer:n});var j=x.a,V=ee("SJMd"),$=ee("ulZh"),X=ee.n($),q=ee("m3rI"),ie=ee("Oy/b"),oe=ee("p5ED"),Ce=ee("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 Ee=function(O,e){return(Ee=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,P){a.__proto__=P}||function(a,P){for(var W in P)Object.prototype.hasOwnProperty.call(P,W)&&(a[W]=P[W])})(O,e)};function Se(O,e){function a(){this.constructor=O}Ee(O,e),O.prototype=e===null?Object.create(e):(a.prototype=e.prototype,new a)}function xe(O,e,a,P){return new(a||(a=Promise))(function(W,I){function le(ht){try{Xe(P.next(ht))}catch(Fe){I(Fe)}}function Ue(ht){try{Xe(P.throw(ht))}catch(Fe){I(Fe)}}function Xe(ht){var Fe;ht.done?W(ht.value):(Fe=ht.value,Fe instanceof a?Fe:new a(function(ct){ct(Fe)})).then(le,Ue)}Xe((P=P.apply(O,e||[])).next())})}function _e(O,e){var a,P,W,I,le={label:0,sent:function(){if(1&W[0])throw W[1];return W[1]},trys:[],ops:[]};return I={next:Ue(0),throw:Ue(1),return:Ue(2)},typeof Symbol=="function"&&(I[Symbol.iterator]=function(){return this}),I;function Ue(Xe){return function(ht){return function(Fe){if(a)throw new TypeError("Generator is already executing.");for(;le;)try{if(a=1,P&&(W=2&Fe[0]?P.return:Fe[0]?P.throw||((W=P.return)&&W.call(P),0):P.next)&&!(W=W.call(P,Fe[1])).done)return W;switch(P=0,W&&(Fe=[2&Fe[0],W.value]),Fe[0]){case 0:case 1:W=Fe;break;case 4:return le.label++,{value:Fe[1],done:!1};case 5:le.label++,P=Fe[1],Fe=[0];continue;case 7:Fe=le.ops.pop(),le.trys.pop();continue;default:if(!(W=le.trys,(W=W.length>0&&W[W.length-1])||Fe[0]!==6&&Fe[0]!==2)){le=0;continue}if(Fe[0]===3&&(!W||Fe[1]>W[0]&&Fe[1]',"select"),this.addActionButton(P,'',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(P,'',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(P,'',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(P,'',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(P,'',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(P,'',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(P,'',"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(I){var le=document.createElement("div");le.className=""+a.toolbarButtonStyleClass.name,le.setAttribute("data-type-name",I.typeName),le.innerHTML=I.icon,le.addEventListener("click",function(){a.markerToolbarButtonClicked(le,I)}),a.buttons.push(le),a.markerButtons.push(le)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var W=document.createElement("div");W.className=this.toolbarBlockStyleClass.name,W.style.whiteSpace="nowrap",W.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(W),this.addActionButton(W,'',"render"),this.addActionButton(W,'',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},O.prototype.addButtonClickListener=function(e){this.buttonClickListeners.push(e)},O.prototype.removeButtonClickListener=function(e){this.buttonClickListeners.indexOf(e)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(e),1)},O.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},O.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var e=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var a=0;a0&&this.buttonClickListeners.forEach(function(P){return P("marker",a)}),this.markerButtonOverflowBlock.style.display="none"},O.prototype.actionToolbarButtonClicked=function(e,a){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(P){return P("action",a)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},O.prototype.setActiveButton=function(e){this.resetButtonStyles(),e.className=e.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),e.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},O.prototype.setActiveMarkerButton=function(e){var a=this.markerButtons.find(function(P){return P.getAttribute("data-type-name")===e});a&&this.setActiveButton(a)},O.prototype.setCurrentMarker=function(e){var a=this;this.currentMarker=e,this.buttons.filter(function(P){return/delete|notes/.test(P.getAttribute("data-action"))}).forEach(function(P){a.currentMarker===void 0?(P.style.fillOpacity="0.4",P.style.pointerEvents="none"):(P.style.fillOpacity="1",P.style.pointerEvents="all")})},O}(),Be=function(){function O(e,a,P,W){this.panels=[],this.panelButtons=[],this.markerjsContainer=e,this.displayMode=a,this.uiStyleSettings=P,this.styles=W,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return O.prototype.addStyles=function(){var e;this.toolboxStyleClass=this.styles.addClass(new he("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 he("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var a=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new he("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new he("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new he("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 he("toolbox-panel-row_colors",`
background-color: `+((e=this.uiStyleSettings.toolboxBackgroundColor)!==null&&e!==void 0?e:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new he("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*a)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*a)+`px;
padding: `+a+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new he("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new he("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new Re("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Re("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},O.prototype.show=function(e){var a;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=e,this.uiContainer.className=this.toolboxStyleClass.name+" "+((a=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&a!==void 0?a:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},O.prototype.setPanelButtons=function(e){var a,P,W=this;this.panels=e,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((a=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&a!==void 0?a:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((P=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&P!==void 0?P:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(I){var le;I.uiStyleSettings=W.uiStyleSettings;var Ue=document.createElement("div");Ue.className=W.toolboxButtonStyleClass.name+" "+((le=W.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&le!==void 0?le:W.toolboxButtonStyleColorsClass.name),Ue.innerHTML=I.icon,Ue.title=I.title,Ue.addEventListener("click",function(){W.panelButtonClick(I)}),W.panelButtons.push(Ue),W.buttonRow.appendChild(Ue)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},O.prototype.panelButtonClick=function(e){var a=this,P=-1;if(e!==this.activePanel){P=this.panels.indexOf(e),this.panelRow.innerHTML="";var W=e.getUi();W.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(W),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=e}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){a.displayMode==="inline"?a.panelRow.style.display="none":a.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(I,le){var Ue,Xe;I.className=a.toolboxButtonStyleClass.name+" "+(le===P?""+((Ue=a.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Ue!==void 0?Ue:a.toolboxActiveButtonStyleColorsClass.name):""+((Xe=a.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Xe!==void 0?Xe:a.toolboxButtonStyleColorsClass.name))})},O}(),Ne=function(O,e){this.title=O,this.icon=e},Ie=function(O){function e(a,P,W,I){var le=O.call(this,a,I||'')||this;return le.colors=[],le.addTransparent=!1,le.colorBoxes=[],le.colors=P,le.currentColor=W,le.setCurrentColor=le.setCurrentColor.bind(le),le.getColorBox=le.getColorBox.bind(le),le}return Se(e,O),e.prototype.getUi=function(){var a=this,P=document.createElement("div");return P.style.overflow="hidden",P.style.whiteSpace="nowrap",this.colors.forEach(function(W){var I=a.getColorBox(W);P.appendChild(I),a.colorBoxes.push(I)}),P},e.prototype.getColorBox=function(a){var P=this,W=this.uiStyleSettings.toolbarHeight/4,I=this.uiStyleSettings.toolbarHeight-W,le=document.createElement("div");le.style.display="inline-block",le.style.boxSizing="content-box",le.style.width=I-2+"px",le.style.height=I-2+"px",le.style.padding="1px",le.style.marginRight="2px",le.style.marginBottom="2px",le.style.borderWidth="2px",le.style.borderStyle="solid",le.style.borderRadius=(I+2)/2+"px",le.style.borderColor=a===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",le.addEventListener("click",function(){P.setCurrentColor(a,le)});var Ue=document.createElement("div");return Ue.style.display="inline-block",Ue.style.width=I-2+"px",Ue.style.height=I-2+"px",Ue.style.backgroundColor=a,Ue.style.borderRadius=I/2+"px",a==="transparent"&&(Ue.style.fill=this.uiStyleSettings.toolboxAccentColor,Ue.innerHTML=``),le.appendChild(Ue),le},e.prototype.setCurrentColor=function(a,P){var W=this;this.currentColor=a,this.colorBoxes.forEach(function(I){I.style.borderColor=I===P?W.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(a)},e}(Ne),de=function(){function O(e,a,P){this._state="new",this._isSelected=!1,this._container=e,this._overlayContainer=a,this.globalSettings=P,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(O.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),O.prototype.ownsTarget=function(e){return!1},Object.defineProperty(O.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),O.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},O.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},O.prototype.pointerDown=function(e,a){},O.prototype.dblClick=function(e,a){},O.prototype.manipulate=function(e){},O.prototype.pointerUp=function(e){this.stateChanged()},O.prototype.dispose=function(){},O.prototype.addMarkerVisualToContainer=function(e){this.container.childNodes.length>0?this.container.insertBefore(e,this.container.childNodes[0]):this.container.appendChild(e)},O.prototype.getState=function(){return{typeName:O.typeName,state:this.state,notes:this.notes}},O.prototype.restoreState=function(e){this._state=e.state,this.notes=e.notes},O.prototype.scale=function(e,a){},O.prototype.colorChanged=function(e){this.onColorChanged&&this.onColorChanged(e),this.stateChanged()},O.prototype.fillColorChanged=function(e){this.onFillColorChanged&&this.onFillColorChanged(e),this.stateChanged()},O.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var e=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),e.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(e)&&this.onStateChanged(this)}},O.typeName="MarkerBase",O}(),ye=function(){function O(){this.findGripByVisual=this.findGripByVisual.bind(this)}return O.prototype.findGripByVisual=function(e){return this.topLeft.ownsTarget(e)?this.topLeft:this.topCenter.ownsTarget(e)?this.topCenter:this.topRight.ownsTarget(e)?this.topRight:this.centerLeft.ownsTarget(e)?this.centerLeft:this.centerRight.ownsTarget(e)?this.centerRight:this.bottomLeft.ownsTarget(e)?this.bottomLeft:this.bottomCenter.ownsTarget(e)?this.bottomCenter:this.bottomRight.ownsTarget(e)?this.bottomRight:void 0},O}(),we=function(){function O(){this.GRIP_SIZE=10,this.visual=se.createGroup(),this.visual.appendChild(se.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(se.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return O.prototype.ownsTarget=function(e){return e===this.visual||e===this.visual.childNodes[0]||e===this.visual.childNodes[1]},O}(),Oe=function(){function O(){}return O.toITransformMatrix=function(e){return{a:e.a,b:e.b,c:e.c,d:e.d,e:e.e,f:e.f}},O.toSVGMatrix=function(e,a){return e.a=a.a,e.b=a.b,e.c=a.c,e.d=a.d,e.e=a.e,e.f=a.f,e},O}(),ke=function(O){function e(a,P,W){var I=O.call(this,a,P,W)||this;return I.left=0,I.top=0,I.width=0,I.height=0,I.defaultSize={x:50,y:20},I.offsetX=0,I.offsetY=0,I.rotationAngle=0,I.CB_DISTANCE=10,I._suppressMarkerCreateEvent=!1,I.container.transform.baseVal.appendItem(se.createTransform()),I.setupControlBox(),I}return Se(e,O),Object.defineProperty(e.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"visual",{get:function(){return this._visual},set:function(a){this._visual=a;var P=se.createTransform();this._visual.transform.baseVal.appendItem(P)},enumerable:!1,configurable:!0}),e.prototype.ownsTarget=function(a){return!!O.prototype.ownsTarget.call(this,a)||!!(this.controlGrips.findGripByVisual(a)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(a))},e.prototype.pointerDown=function(a,P){O.prototype.pointerDown.call(this,a,P),this.state==="new"&&(this.left=a.x,this.top=a.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var W=this.unrotatePoint(a);if(this.manipulationStartX=W.x,this.manipulationStartY=W.y,this.offsetX=W.x-this.left,this.offsetY=W.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(P),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(P)){this.activeGrip=this.rotatorGrip;var I=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=I.x-this.width/2,this.top=I.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var le=this.container.transform.baseVal.getItem(0);le.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(le,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},e.prototype.pointerUp=function(a){var P=this.state;O.prototype.pointerUp.call(this,a),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(a),this._state="select",P==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},e.prototype.moveVisual=function(a){this.visual.style.transform="translate("+a.x+"px, "+a.y+"px)"},e.prototype.manipulate=function(a){var P=this.unrotatePoint(a);this.state==="creating"?this.resize(a):this.state==="move"?(this.left=this.manipulationStartLeft+(P.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(P.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(P):this.state==="rotate"&&this.rotate(a)},e.prototype.resize=function(a){var P=this.manipulationStartLeft,W=this.manipulationStartWidth,I=this.manipulationStartTop,le=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:P=this.manipulationStartLeft+a.x-this.manipulationStartX,W=this.manipulationStartWidth+this.manipulationStartLeft-P;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:W=this.manipulationStartWidth+a.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:I=this.manipulationStartTop+a.y-this.manipulationStartY,le=this.manipulationStartHeight+this.manipulationStartTop-I;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:le=this.manipulationStartHeight+a.y-this.manipulationStartY}W>=0?(this.left=P,this.width=W):(this.left=P+W,this.width=-W),le>=0?(this.top=I,this.height=le):(this.top=I+le,this.height=-le),this.setSize()},e.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},e.prototype.rotate=function(a){if(Math.abs(a.x-this.centerX)>.1){var P=Math.sign(a.x-this.centerX);this.rotationAngle=180*Math.atan((a.y-this.centerY)/(a.x-this.centerX))/Math.PI+90*P,this.applyRotation()}},e.prototype.applyRotation=function(){var a=this.container.transform.baseVal.getItem(0);a.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(a,0)},e.prototype.rotatePoint=function(a){if(this.rotationAngle===0)return a;var P=this.container.getCTM(),W=se.createPoint(a.x,a.y);return{x:(W=W.matrixTransform(P)).x,y:W.y}},e.prototype.unrotatePoint=function(a){if(this.rotationAngle===0)return a;var P=this.container.getCTM();P=P.inverse();var W=se.createPoint(a.x,a.y);return{x:(W=W.matrixTransform(P)).x,y:W.y}},e.prototype.select=function(){O.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},e.prototype.deselect=function(){O.prototype.deselect.call(this),this.controlBox.style.display="none"},e.prototype.setupControlBox=function(){this.controlBox=se.createGroup();var a=se.createTransform();a.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(a),this.container.appendChild(this.controlBox),this.controlRect=se.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=se.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new ye,this.addControlGrips(),this.controlBox.style.display="none"},e.prototype.adjustControlBox=function(){var a=this.controlBox.transform.baseVal.getItem(0);a.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(a,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()},e.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},e.prototype.createGrip=function(){var a=new we;return a.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(a.visual),a},e.prototype.positionGrips=function(){var a=this.controlGrips.topLeft.GRIP_SIZE,P=-a/2,W=P,I=(this.width+this.CB_DISTANCE)/2-a/2,le=(this.height+this.CB_DISTANCE)/2-a/2,Ue=this.height+this.CB_DISTANCE-a/2,Xe=this.width+this.CB_DISTANCE-a/2;this.positionGrip(this.controlGrips.topLeft.visual,P,W),this.positionGrip(this.controlGrips.topCenter.visual,I,W),this.positionGrip(this.controlGrips.topRight.visual,Xe,W),this.positionGrip(this.controlGrips.centerLeft.visual,P,le),this.positionGrip(this.controlGrips.centerRight.visual,Xe,le),this.positionGrip(this.controlGrips.bottomLeft.visual,P,Ue),this.positionGrip(this.controlGrips.bottomCenter.visual,I,Ue),this.positionGrip(this.controlGrips.bottomRight.visual,Xe,Ue),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,I,W-3*this.CB_DISTANCE)},e.prototype.positionGrip=function(a,P,W){var I=a.transform.baseVal.getItem(0);I.setTranslate(P,W),a.transform.baseVal.replaceItem(I,0)},e.prototype.hideControlBox=function(){this.controlBox.style.display="none"},e.prototype.showControlBox=function(){this.controlBox.style.display=""},e.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:Oe.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:Oe.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},O.prototype.getState.call(this))},e.prototype.restoreState=function(a){O.prototype.restoreState.call(this,a);var P=a;this.left=P.left,this.top=P.top,this.width=P.width,this.height=P.height,this.rotationAngle=P.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Oe.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,P.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Oe.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,P.containerTransformMatrix))},e.prototype.scale=function(a,P){O.prototype.scale.call(this,a,P);var W=this.rotatePoint({x:this.left,y:this.top}),I=this.unrotatePoint({x:W.x*a,y:W.y*P});this.left=I.x,this.top=I.y,this.width=this.width*a,this.height=this.height*P,this.adjustControlBox()},e}(de),je=function(O){function e(a,P,W){var I=O.call(this,a,P,W)||this;return I.fillColor="transparent",I.strokeColor="transparent",I.strokeWidth=0,I.strokeDasharray="",I.opacity=1,I.setStrokeColor=I.setStrokeColor.bind(I),I.setFillColor=I.setFillColor.bind(I),I.setStrokeWidth=I.setStrokeWidth.bind(I),I.setStrokeDasharray=I.setStrokeDasharray.bind(I),I.createVisual=I.createVisual.bind(I),I}return Se(e,O),e.prototype.ownsTarget=function(a){return!(!O.prototype.ownsTarget.call(this,a)&&a!==this.visual)},e.prototype.createVisual=function(){this.visual=se.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},e.prototype.pointerDown=function(a,P){O.prototype.pointerDown.call(this,a,P),this.state==="new"&&(this.createVisual(),this.moveVisual(a),this._state="creating")},e.prototype.manipulate=function(a){O.prototype.manipulate.call(this,a)},e.prototype.resize=function(a){O.prototype.resize.call(this,a),this.setSize()},e.prototype.setSize=function(){O.prototype.setSize.call(this),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},e.prototype.pointerUp=function(a){O.prototype.pointerUp.call(this,a),this.setSize()},e.prototype.setStrokeColor=function(a){this.strokeColor=a,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(a),this.stateChanged()},e.prototype.setFillColor=function(a){this.fillColor=a,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},e.prototype.setStrokeWidth=function(a){this.strokeWidth=a,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},e.prototype.setStrokeDasharray=function(a){this.strokeDasharray=a,this.visual&&se.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},e.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},O.prototype.getState.call(this))},e.prototype.restoreState=function(a){var P=a;this.fillColor=P.fillColor,this.strokeColor=P.strokeColor,this.strokeWidth=P.strokeWidth,this.strokeDasharray=P.strokeDasharray,this.opacity=P.opacity,this.createVisual(),O.prototype.restoreState.call(this,a),this.setSize()},e.prototype.scale=function(a,P){O.prototype.scale.call(this,a,P),this.setSize()},e.title="Rectangle marker",e}(ke),it=function(O){function e(a,P,W,I){var le=O.call(this,a,I||'')||this;return le.widths=[],le.widthBoxes=[],le.widths=P,le.currentWidth=W,le.setCurrentWidth=le.setCurrentWidth.bind(le),le}return Se(e,O),e.prototype.getUi=function(){var a=this,P=document.createElement("div");return P.style.display="flex",P.style.overflow="hidden",P.style.flexGrow="2",this.widths.forEach(function(W){var I=document.createElement("div");I.style.display="flex",I.style.flexGrow="2",I.style.alignItems="center",I.style.justifyContent="space-between",I.style.padding="5px",I.style.borderWidth="2px",I.style.borderStyle="solid",I.style.borderColor=W===a.currentWidth?a.uiStyleSettings.toolboxAccentColor:"transparent",I.addEventListener("click",function(){a.setCurrentWidth(W,I)}),P.appendChild(I);var le=document.createElement("div");le.innerText=W.toString(),le.style.marginRight="5px",I.appendChild(le);var Ue=document.createElement("div");Ue.style.minHeight="20px",Ue.style.flexGrow="2",Ue.style.display="flex",Ue.style.alignItems="center";var Xe=document.createElement("hr");Xe.style.minWidth="20px",Xe.style.border="0px",Xe.style.borderTop=W+"px solid "+a.uiStyleSettings.toolboxColor,Xe.style.flexGrow="2",Ue.appendChild(Xe),I.appendChild(Ue),a.widthBoxes.push(I)}),P},e.prototype.setCurrentWidth=function(a,P){var W=this;this.currentWidth=a,this.widthBoxes.forEach(function(I){I.style.borderColor=I===P?W.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},e}(Ne),at=function(O){function e(a,P,W,I){var le=O.call(this,a,I||'')||this;return le.styles=[],le.styleBoxes=[],le.styles=P,le.currentStyle=W,le.setCurrentStyle=le.setCurrentStyle.bind(le),le}return Se(e,O),e.prototype.getUi=function(){var a=this,P=document.createElement("div");return P.style.display="flex",P.style.overflow="hidden",P.style.flexGrow="2",this.styles.forEach(function(W){var I=document.createElement("div");I.style.display="flex",I.style.alignItems="center",I.style.justifyContent="space-between",I.style.padding="5px",I.style.borderWidth="2px",I.style.borderStyle="solid",I.style.overflow="hidden",I.style.maxWidth=100/a.styles.length-5+"%",I.style.borderColor=W===a.currentStyle?a.uiStyleSettings.toolboxAccentColor:"transparent",I.addEventListener("click",function(){a.setCurrentStyle(W,I)}),P.appendChild(I);var le=document.createElement("div");le.style.minHeight="20px",le.style.flexGrow="2",le.style.overflow="hidden";var Ue=``;le.innerHTML=Ue,I.appendChild(le),a.styleBoxes.push(I)}),P},e.prototype.setCurrentStyle=function(a,P){var W=this;this.currentStyle=a,this.styleBoxes.forEach(function(I){I.style.borderColor=I===P?W.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},e}(Ne),et=function(O){function e(a,P,W){var I=O.call(this,a,P,W)||this;return I.strokeColor=W.defaultColor,I.strokeWidth=W.defaultStrokeWidth,I.strokeDasharray=W.defaultStrokeDasharray,I.strokePanel=new Ie("Line color",W.defaultColorSet,W.defaultColor),I.strokePanel.onColorChanged=I.setStrokeColor,I.strokeWidthPanel=new it("Line width",W.defaultStrokeWidths,W.defaultStrokeWidth),I.strokeWidthPanel.onWidthChanged=I.setStrokeWidth,I.strokeStylePanel=new at("Line style",W.defaultStrokeDasharrays,W.defaultStrokeDasharray),I.strokeStylePanel.onStyleChanged=I.setStrokeDasharray,I}return Se(e,O),Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var a=O.prototype.getState.call(this);return a.typeName=e.typeName,a},e.typeName="FrameMarker",e.title="Frame marker",e.icon='',e}(je),Ke=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},dt=function(O){function e(a,P,W){var I=O.call(this,a,P,W)||this;return I.x1=0,I.y1=0,I.x2=0,I.y2=0,I.defaultLength=50,I.manipulationStartX=0,I.manipulationStartY=0,I.manipulationStartX1=0,I.manipulationStartY1=0,I.manipulationStartX2=0,I.manipulationStartY2=0,I.setupControlBox(),I}return Se(e,O),e.prototype.ownsTarget=function(a){return!!O.prototype.ownsTarget.call(this,a)||!(!this.grip1.ownsTarget(a)&&!this.grip2.ownsTarget(a))},e.prototype.pointerDown=function(a,P){O.prototype.pointerDown.call(this,a,P),this.manipulationStartX=a.x,this.manipulationStartY=a.y,this.state==="new"&&(this.x1=a.x,this.y1=a.y,this.x2=a.x,this.y2=a.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(P)?this.activeGrip=this.grip1:this.grip2.ownsTarget(P)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},e.prototype.pointerUp=function(a){var P=this.state;O.prototype.pointerUp.call(this,a),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(a),this._state="select",P==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},e.prototype.adjustVisual=function(){},e.prototype.manipulate=function(a){this.state==="creating"?this.resize(a):this.state==="move"?(this.x1=this.manipulationStartX1+a.x-this.manipulationStartX,this.y1=this.manipulationStartY1+a.y-this.manipulationStartY,this.x2=this.manipulationStartX2+a.x-this.manipulationStartX,this.y2=this.manipulationStartY2+a.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(a)},e.prototype.resize=function(a){switch(this.activeGrip){case this.grip1:this.x1=a.x,this.y1=a.y;break;case this.grip2:case void 0:this.x2=a.x,this.y2=a.y}this.adjustVisual(),this.adjustControlBox()},e.prototype.select=function(){O.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},e.prototype.deselect=function(){O.prototype.deselect.call(this),this.controlBox.style.display="none"},e.prototype.setupControlBox=function(){this.controlBox=se.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},e.prototype.adjustControlBox=function(){this.positionGrips()},e.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},e.prototype.createGrip=function(){var a=new we;return a.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(a.visual),a},e.prototype.positionGrips=function(){var a=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-a/2,this.y1-a/2),this.positionGrip(this.grip2.visual,this.x2-a/2,this.y2-a/2)},e.prototype.positionGrip=function(a,P,W){var I=a.transform.baseVal.getItem(0);I.setTranslate(P,W),a.transform.baseVal.replaceItem(I,0)},e.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},O.prototype.getState.call(this))},e.prototype.restoreState=function(a){O.prototype.restoreState.call(this,a);var P=a;this.x1=P.x1,this.y1=P.y1,this.x2=P.x2,this.y2=P.y2},e.prototype.scale=function(a,P){O.prototype.scale.call(this,a,P),this.x1=this.x1*a,this.y1=this.y1*P,this.x2=this.x2*a,this.y2=this.y2*P,this.adjustVisual(),this.adjustControlBox()},e}(de),ft=function(O){function e(a,P,W){var I=O.call(this,a,P,W)||this;return I.strokeColor="transparent",I.strokeWidth=0,I.strokeDasharray="",I.setStrokeColor=I.setStrokeColor.bind(I),I.setStrokeWidth=I.setStrokeWidth.bind(I),I.setStrokeDasharray=I.setStrokeDasharray.bind(I),I.strokeColor=W.defaultColor,I.strokeWidth=W.defaultStrokeWidth,I.strokeDasharray=W.defaultStrokeDasharray,I.strokePanel=new Ie("Line color",W.defaultColorSet,W.defaultColor),I.strokePanel.onColorChanged=I.setStrokeColor,I.strokeWidthPanel=new it("Line width",W.defaultStrokeWidths,W.defaultStrokeWidth),I.strokeWidthPanel.onWidthChanged=I.setStrokeWidth,I.strokeStylePanel=new at("Line style",W.defaultStrokeDasharrays,W.defaultStrokeDasharray),I.strokeStylePanel.onStyleChanged=I.setStrokeDasharray,I}return Se(e,O),e.prototype.ownsTarget=function(a){return!(!O.prototype.ownsTarget.call(this,a)&&a!==this.visual&&a!==this.selectorLine&&a!==this.visibleLine)},e.prototype.createVisual=function(){this.visual=se.createGroup(),this.selectorLine=se.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=se.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},e.prototype.pointerDown=function(a,P){O.prototype.pointerDown.call(this,a,P),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},e.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),se.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},e.prototype.setStrokeColor=function(a){this.strokeColor=a,this.adjustVisual(),this.colorChanged(a)},e.prototype.setStrokeWidth=function(a){this.strokeWidth=a,this.adjustVisual()},e.prototype.setStrokeDasharray=function(a){this.strokeDasharray=a,this.adjustVisual(),this.stateChanged()},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var a=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},O.prototype.getState.call(this));return a.typeName=e.typeName,a},e.prototype.restoreState=function(a){O.prototype.restoreState.call(this,a);var P=a;this.strokeColor=P.strokeColor,this.strokeWidth=P.strokeWidth,this.strokeDasharray=P.strokeDasharray,this.createVisual(),this.adjustVisual()},e.typeName="LineMarker",e.title="Line marker",e.icon='',e}(dt),We=function(O){function e(a,P,W,I){var le=O.call(this,a,I||'')||this;return le.fonts=[],le.fontBoxes=[],le.fonts=P,le.currentFont=W,le.setCurrentFont=le.setCurrentFont.bind(le),le}return Se(e,O),e.prototype.getUi=function(){var a=this,P=document.createElement("div");return P.style.overflow="hidden",P.style.flexGrow="2",this.fonts.forEach(function(W){var I=document.createElement("div");I.style.display="inline-block",I.style.alignItems="center",I.style.justifyContent="space-between",I.style.padding="5px",I.style.borderWidth="2px",I.style.borderStyle="solid",I.style.overflow="hidden",I.style.maxWidth=100/a.fonts.length-5+"%",I.style.borderColor=W===a.currentFont?a.uiStyleSettings.toolboxAccentColor:"transparent",I.addEventListener("click",function(){a.setCurrentFont(W,I)}),P.appendChild(I);var le=document.createElement("div");le.style.display="flex",le.style.minHeight="20px",le.style.flexGrow="2",le.style.fontFamily=W,le.style.overflow="hidden";var Ue=document.createElement("div");Ue.style.whiteSpace="nowrap",Ue.style.overflow="hidden",Ue.style.textOverflow="ellipsis",Ue.innerHTML="The quick brown fox jumps over the lazy dog",le.appendChild(Ue),I.appendChild(le),a.fontBoxes.push(I)}),P},e.prototype.setCurrentFont=function(a,P){var W=this;this.currentFont=a,this.fontBoxes.forEach(function(I){I.style.borderColor=I===P?W.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},e}(Ne),Ze=function(O){function e(a,P,W){var I=O.call(this,a,P,W)||this;return I.color="transparent",I.padding=5,I.DEFAULT_TEXT="your text here",I.text=I.DEFAULT_TEXT,I.isMoved=!1,I.color=W.defaultColor,I.fontFamily=W.defaultFontFamily,I.defaultSize={x:100,y:30},I.setColor=I.setColor.bind(I),I.setFont=I.setFont.bind(I),I.renderText=I.renderText.bind(I),I.sizeText=I.sizeText.bind(I),I.textEditDivClicked=I.textEditDivClicked.bind(I),I.showTextEditor=I.showTextEditor.bind(I),I.setSize=I.setSize.bind(I),I.positionTextEditor=I.positionTextEditor.bind(I),I.colorPanel=new Ie("Color",W.defaultColorSet,W.defaultColor),I.colorPanel.onColorChanged=I.setColor,I.fontFamilyPanel=new We("Font",W.defaultFontFamilies,W.defaultFontFamily),I.fontFamilyPanel.onFontChanged=I.setFont,I}return Se(e,O),e.prototype.ownsTarget=function(a){if(O.prototype.ownsTarget.call(this,a)||a===this.visual||a===this.textElement||a===this.bgRectangle)return!0;var P=!1;return this.textElement.childNodes.forEach(function(W){W===a&&(P=!0)}),P},e.prototype.createVisual=function(){this.visual=se.createGroup(),this.bgRectangle=se.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=se.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},e.prototype.pointerDown=function(a,P){O.prototype.pointerDown.call(this,a,P),this.isMoved=!1,this.pointerDownPoint=a,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(a),this._state="creating")},e.prototype.renderText=function(){var a=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(P){a.textElement.appendChild(se.createTSpan(P.trim()===""?" ":P.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},e.prototype.getTextScale=function(){var a=this.textElement.getBBox(),P=1;if(a.width>0&&a.height>0){var W=(1*this.width-this.width*this.padding*2/100)/a.width,I=(1*this.height-this.height*this.padding*2/100)/a.height;P=Math.min(W,I)}return P},e.prototype.getTextPosition=function(a){var P=this.textElement.getBBox(),W=0,I=0;return P.width>0&&P.height>0&&(W=(this.width-P.width*a)/2,I=this.height/2-P.height*a/2),{x:W,y:I}},e.prototype.sizeText=function(){var a=this.textElement.getBBox(),P=this.getTextScale(),W=this.getTextPosition(P);W.y-=a.y*P,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+W.x+"px, "+W.y+"px) scale("+P+", "+P+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(W.x,W.y),this.textElement.transform.baseVal.getItem(1).setScale(P,P))},e.prototype.manipulate=function(a){O.prototype.manipulate.call(this,a),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(a.x-this.pointerDownPoint.x)>5||Math.abs(a.y-this.pointerDownPoint.y)>5)},e.prototype.resize=function(a){O.prototype.resize.call(this,a),this.isMoved=!0,this.setSize(),this.sizeText()},e.prototype.setSize=function(){O.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},e.prototype.pointerUp=function(a){var P=this.state;P==="creating"&&(this._suppressMarkerCreateEvent=!0),O.prototype.pointerUp.call(this,a),this.setSize(),(P==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},e.prototype.showTextEditor=function(){var a=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(P){P.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var P=Number.parseFloat(a.textEditor.style.fontSize);a.textEditor.clientWidth>=Number.parseInt(a.textEditor.style.maxWidth)&&P>.9;)P-=.1,a.textEditor.style.fontSize=Math.max(P,.9)+"em"}),this.textEditor.addEventListener("keyup",function(P){P.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(P){if(P.clipboardData){var W=P.clipboardData.getData("text"),I=window.getSelection();if(!I.rangeCount)return!1;I.deleteFromDocument(),I.getRangeAt(0).insertNode(document.createTextNode(W)),P.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){a.textEditDivClicked(a.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},e.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var a=this.getTextScale(),P=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),W=this.textElement.getBBox(),I={x:W.width*a,y:W.height*a};P.x-=I.x/2,P.y-=I.y/2,this.textEditor.style.top=P.y+"px",this.textEditor.style.left=P.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-P.x+"px",this.textEditor.style.fontSize=Math.max(16*a,12)+"px",this.textElement.style.display="none"}},e.prototype.textEditDivClicked=function(a){this.text=a.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},e.prototype.select=function(){O.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},e.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),O.prototype.deselect.call(this)},e.prototype.dblClick=function(a,P){O.prototype.dblClick.call(this,a,P),this.showTextEditor()},e.prototype.setColor=function(a){this.textElement&&se.setAttributes(this.textElement,[["fill",a]]),this.color=a,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(a)},e.prototype.setFont=function(a){this.textElement&&se.setAttributes(this.textElement,[["font-family",a]]),this.fontFamily=a,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},e.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},e.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var a=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},O.prototype.getState.call(this));return a.typeName=e.typeName,a},e.prototype.restoreState=function(a){var P=a;this.color=P.color,this.fontFamily=P.fontFamily,this.padding=P.padding,this.text=P.text,this.createVisual(),O.prototype.restoreState.call(this,a),this.setSize()},e.prototype.scale=function(a,P){O.prototype.scale.call(this,a,P),this.setSize(),this.sizeText(),this.positionTextEditor()},e.typeName="TextMarker",e.title="Text marker",e.icon='',e}(ke),me=function(O){function e(a,P,W){var I=O.call(this,a,P,W)||this;return I.color="transparent",I.lineWidth=3,I.drawing=!1,I.pixelRatio=1,I.color=W.defaultColor,I.lineWidth=W.defaultStrokeWidth,I.pixelRatio=W.freehandPixelRatio,I.setColor=I.setColor.bind(I),I.addCanvas=I.addCanvas.bind(I),I.finishCreation=I.finishCreation.bind(I),I.setLineWidth=I.setLineWidth.bind(I),I.colorPanel=new Ie("Color",W.defaultColorSet,W.defaultColor),I.colorPanel.onColorChanged=I.setColor,I.lineWidthPanel=new it("Line width",W.defaultStrokeWidths,W.defaultStrokeWidth),I.lineWidthPanel.onWidthChanged=I.setLineWidth,I}return Se(e,O),e.prototype.ownsTarget=function(a){return!(!O.prototype.ownsTarget.call(this,a)&&a!==this.visual&&a!==this.drawingImage)},e.prototype.createVisual=function(){this.visual=se.createGroup(),this.drawingImage=se.createImage(),this.visual.appendChild(this.drawingImage);var a=se.createTransform();this.visual.transform.baseVal.appendItem(a),this.addMarkerVisualToContainer(this.visual)},e.prototype.pointerDown=function(a,P){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(a.x,a.y),this.drawing=!0):O.prototype.pointerDown.call(this,a,P)},e.prototype.manipulate=function(a){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(a.x,a.y),this.canvasContext.stroke()):O.prototype.manipulate.call(this,a)},e.prototype.resize=function(a){O.prototype.resize.call(this,a),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},e.prototype.pointerUp=function(a){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):O.prototype.pointerUp.call(this,a)},e.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},e.prototype.select=function(){this.state==="creating"&&this.finishCreation(),O.prototype.select.call(this)},e.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),O.prototype.deselect.call(this)},e.prototype.finishCreation=function(){for(var a=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),P=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],W=P[0],I=P[1],le=P[2],Ue=P[3],Xe=!1,ht=0;ht0&&(Xe=!0,htUe&&(Ue=ht),Fe>le&&(le=Fe));if(Xe){this.left=W/this.pixelRatio,this.top=I/this.pixelRatio,this.width=(le-W)/this.pixelRatio,this.height=(Ue-I)/this.pixelRatio;var ct=document.createElement("canvas");ct.width=le-W,ct.height=Ue-I,ct.getContext("2d").putImageData(this.canvasContext.getImageData(W,I,le-W,Ue-I),0,0),this.drawingImgUrl=ct.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},e.prototype.setDrawingImage=function(){se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},e.prototype.setColor=function(a){this.color=a,this.colorChanged(a)},e.prototype.setLineWidth=function(a){this.lineWidth=a},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var a=Object.assign({drawingImgUrl:this.drawingImgUrl},O.prototype.getState.call(this));return a.typeName=e.typeName,a},e.prototype.restoreState=function(a){this.createVisual(),O.prototype.restoreState.call(this,a),this.drawingImgUrl=a.drawingImgUrl,this.setDrawingImage()},e.prototype.scale=function(a,P){O.prototype.scale.call(this,a,P),this.setDrawingImage()},e.typeName="FreehandMarker",e.title="Freehand marker",e.icon='',e}(ke),ve=function(O){function e(a,P,W){var I=O.call(this,a,W||'')||this;return I.typeBoxes=[],I.currentType=P,I.setCurrentType=I.setCurrentType.bind(I),I}return Se(e,O),e.prototype.getUi=function(){var a=this,P=document.createElement("div");P.style.display="flex",P.style.overflow="hidden",P.style.flexGrow="2";for(var W=function(Ue){var Xe="both";switch(Ue){case 0:Xe="both";break;case 1:Xe="start";break;case 2:Xe="end";break;case 3:Xe="none"}var ht=document.createElement("div");if(ht.style.display="flex",ht.style.flexGrow="2",ht.style.alignItems="center",ht.style.justifyContent="space-between",ht.style.padding="5px",ht.style.borderWidth="2px",ht.style.borderStyle="solid",ht.style.borderColor=Xe===I.currentType?I.uiStyleSettings.toolboxAccentColor:"transparent",ht.addEventListener("click",function(){a.setCurrentType(Xe,ht)}),P.appendChild(ht),Xe==="both"||Xe==="start"){var Fe=document.createElement("div");Fe.style.display="flex",Fe.style.alignItems="center",Fe.style.minHeight="20px",Fe.innerHTML=``,Fe.style.marginLeft="5px",ht.appendChild(Fe)}var ct=document.createElement("div");ct.style.display="flex",ct.style.alignItems="center",ct.style.minHeight="20px",ct.style.flexGrow="2";var Et=document.createElement("hr");if(Et.style.minWidth="20px",Et.style.border="0px",Et.style.borderTop="3px solid "+(I.uiStyleSettings!==void 0?I.uiStyleSettings.toolboxColor:"#eeeeee"),Et.style.flexGrow="2",ct.appendChild(Et),ht.appendChild(ct),Xe==="both"||Xe==="end"){var Tt=document.createElement("div");Tt.style.display="flex",Tt.style.alignItems="center",Tt.style.minHeight="20px",Tt.innerHTML=``,Tt.style.marginRight="5px",ht.appendChild(Tt)}I.typeBoxes.push(ht)},I=this,le=0;le<4;le++)W(le);return P},e.prototype.setCurrentType=function(a,P){var W=this;this.currentType=a,this.typeBoxes.forEach(function(I){I.style.borderColor=I===P?W.uiStyleSettings!==void 0?W.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},e}(Ne),pe=function(O){function e(a,P,W){var I=O.call(this,a,P,W)||this;return I.arrowType="end",I.arrowBaseHeight=10,I.arrowBaseWidth=10,I.getArrowPoints=I.getArrowPoints.bind(I),I.setArrowType=I.setArrowType.bind(I),I.arrowTypePanel=new ve("Arrow type","end"),I.arrowTypePanel.onArrowTypeChanged=I.setArrowType,I}return Se(e,O),e.prototype.ownsTarget=function(a){return!(!O.prototype.ownsTarget.call(this,a)&&a!==this.arrow1&&a!==this.arrow2)},e.prototype.getArrowPoints=function(a,P){var W=this.arrowBaseWidth+2*this.strokeWidth,I=this.arrowBaseHeight+2*this.strokeWidth;return a-W/2+","+(P+I/2)+" "+a+","+(P-I/2)+" "+(a+W/2)+","+(P+I/2)},e.prototype.createTips=function(){this.arrow1=se.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=se.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow2)},e.prototype.pointerDown=function(a,P){O.prototype.pointerDown.call(this,a,P),this.state==="creating"&&this.createTips()},e.prototype.adjustVisual=function(){if(O.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",se.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),se.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var a=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),P=this.arrow1.transform.baseVal.getItem(0);P.setRotate(a,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(P,0);var W=this.arrow2.transform.baseVal.getItem(0);W.setRotate(a+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(W,0)}},e.prototype.setArrowType=function(a){this.arrowType=a,this.adjustVisual(),this.stateChanged()},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var a=Object.assign({arrowType:this.arrowType},O.prototype.getState.call(this));return a.typeName=e.typeName,a},e.prototype.restoreState=function(a){O.prototype.restoreState.call(this,a);var P=a;this.arrowType=P.arrowType,this.createTips(),this.adjustVisual()},e.typeName="ArrowMarker",e.title="Arrow marker",e.icon='',e}(ft),Z=function(O){function e(a,P,W){var I=O.call(this,a,P,W)||this;return I.fillColor=W.defaultFillColor,I.strokeWidth=0,I.fillPanel=new Ie("Color",W.defaultColorSet,W.defaultFillColor),I.fillPanel.onColorChanged=I.setFillColor,I}return Se(e,O),Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var a=O.prototype.getState.call(this);return a.typeName=e.typeName,a},e.typeName="CoverMarker",e.title="Cover marker",e.icon='',e}(je),te=function(O){function e(a,P,W,I){var le=O.call(this,a,I||'')||this;return le.opacities=[],le.opacityBoxes=[],le.opacities=P,le.currentOpacity=W,le.setCurrentOpacity=le.setCurrentOpacity.bind(le),le}return Se(e,O),e.prototype.getUi=function(){var a=this,P=document.createElement("div");return P.style.display="flex",P.style.overflow="hidden",P.style.flexGrow="2",P.style.justifyContent="space-between",this.opacities.forEach(function(W){var I=document.createElement("div");I.style.display="flex",I.style.alignItems="center",I.style.justifyContent="center",I.style.padding="5px",I.style.borderWidth="2px",I.style.borderStyle="solid",I.style.borderColor=W===a.currentOpacity?a.uiStyleSettings.toolboxAccentColor:"transparent",I.addEventListener("click",function(){a.setCurrentOpacity(W,I)}),P.appendChild(I);var le=document.createElement("div");le.innerText=100*W+"%",I.appendChild(le),a.opacityBoxes.push(I)}),P},e.prototype.setCurrentOpacity=function(a,P){var W=this;this.currentOpacity=a,this.opacityBoxes.forEach(function(I){I.style.borderColor=I===P?W.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},e}(Ne),ae=function(O){function e(a,P,W){var I=O.call(this,a,P,W)||this;return I.setOpacity=I.setOpacity.bind(I),I.fillColor=W.defaultHighlightColor,I.strokeWidth=0,I.opacity=W.defaultHighlightOpacity,I.fillPanel=new Ie("Color",W.defaultColorSet,I.fillColor),I.fillPanel.onColorChanged=I.setFillColor,I.opacityPanel=new te("Opacity",W.defaultOpacitySteps,I.opacity),I.opacityPanel.onOpacityChanged=I.setOpacity,I}return Se(e,O),e.prototype.setOpacity=function(a){this.opacity=a,this.visual&&se.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var a=O.prototype.getState.call(this);return a.typeName=e.typeName,a},e.typeName="HighlightMarker",e.title="Highlight marker",e.icon='',e}(Z),ne='',Ae=function(O){function e(a,P,W){var I=O.call(this,a,P,W)||this;return I.bgColor="transparent",I.tipPosition={x:0,y:0},I.tipBase1Position={x:0,y:0},I.tipBase2Position={x:0,y:0},I.tipMoving=!1,I.color=W.defaultStrokeColor,I.bgColor=W.defaultFillColor,I.fontFamily=W.defaultFontFamily,I.defaultSize={x:100,y:30},I.setBgColor=I.setBgColor.bind(I),I.getTipPoints=I.getTipPoints.bind(I),I.positionTip=I.positionTip.bind(I),I.setTipPoints=I.setTipPoints.bind(I),I.colorPanel=new Ie("Text color",W.defaultColorSet,I.color,''),I.colorPanel.onColorChanged=I.setColor,I.bgColorPanel=new Ie("Fill color",W.defaultColorSet,I.bgColor,ne),I.bgColorPanel.onColorChanged=I.setBgColor,I.fontFamilyPanel=new We("Font",W.defaultFontFamilies,W.defaultFontFamily),I.fontFamilyPanel.onFontChanged=I.setFont,I.tipGrip=new we,I.tipGrip.visual.transform.baseVal.appendItem(se.createTransform()),I.controlBox.appendChild(I.tipGrip.visual),I}return Se(e,O),e.prototype.ownsTarget=function(a){return O.prototype.ownsTarget.call(this,a)||this.tipGrip.ownsTarget(a)||this.tip===a},e.prototype.createTip=function(){se.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=se.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},e.prototype.pointerDown=function(a,P){this.state==="new"&&O.prototype.pointerDown.call(this,a,P),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(P)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):O.prototype.pointerDown.call(this,a,P)},e.prototype.pointerUp=function(a){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,O.prototype.pointerUp.call(this,a);else{var P=this.state==="creating";O.prototype.pointerUp.call(this,a),this.setTipPoints(P),this.positionTip()}},e.prototype.manipulate=function(a){if(this.tipMoving){var P=this.unrotatePoint(a);this.tipPosition={x:P.x-this.manipulationStartLeft,y:P.y-this.manipulationStartTop},this.positionTip()}else O.prototype.manipulate.call(this,a)},e.prototype.setBgColor=function(a){this.bgRectangle&&this.tip&&(se.setAttributes(this.bgRectangle,[["fill",a]]),se.setAttributes(this.tip,[["fill",a]])),this.bgColor=a,this.fillColorChanged(a)},e.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},e.prototype.setTipPoints=function(a){a===void 0&&(a=!1);var P=Math.min(this.height/2,15),W=this.height/5;a&&(this.tipPosition={x:P+W/2,y:this.height+20});var I=Math.atan(this.height/2/(this.width/2));this.tipPosition.x=this.width/2&&this.tipPosition.y=this.width/2&&this.tipPosition.y>=this.height/2?I',e}(Ze),De=function(O){function e(a,P,W){var I=O.call(this,a,P,W)||this;return I.fillColor="transparent",I.strokeColor="transparent",I.strokeWidth=0,I.strokeDasharray="",I.opacity=1,I.strokeColor=W.defaultColor,I.strokeWidth=W.defaultStrokeWidth,I.strokeDasharray=W.defaultStrokeDasharray,I.fillColor=W.defaultFillColor,I.setStrokeColor=I.setStrokeColor.bind(I),I.setFillColor=I.setFillColor.bind(I),I.setStrokeWidth=I.setStrokeWidth.bind(I),I.setStrokeDasharray=I.setStrokeDasharray.bind(I),I.setOpacity=I.setOpacity.bind(I),I.createVisual=I.createVisual.bind(I),I.strokePanel=new Ie("Line color",fe(W.defaultColorSet,["transparent"]),W.defaultColor),I.strokePanel.onColorChanged=I.setStrokeColor,I.fillPanel=new Ie("Fill color",fe(W.defaultColorSet,["transparent"]),I.fillColor,ne),I.fillPanel.onColorChanged=I.setFillColor,I.strokeWidthPanel=new it("Line width",W.defaultStrokeWidths,W.defaultStrokeWidth),I.strokeWidthPanel.onWidthChanged=I.setStrokeWidth,I.strokeStylePanel=new at("Line style",W.defaultStrokeDasharrays,W.defaultStrokeDasharray),I.strokeStylePanel.onStyleChanged=I.setStrokeDasharray,I.opacityPanel=new te("Opacity",W.defaultOpacitySteps,I.opacity),I.opacityPanel.onOpacityChanged=I.setOpacity,I}return Se(e,O),e.prototype.ownsTarget=function(a){return!(!O.prototype.ownsTarget.call(this,a)&&a!==this.visual)},e.prototype.createVisual=function(){this.visual=se.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},e.prototype.pointerDown=function(a,P){O.prototype.pointerDown.call(this,a,P),this.state==="new"&&(this.createVisual(),this.moveVisual(a),this._state="creating")},e.prototype.manipulate=function(a){O.prototype.manipulate.call(this,a)},e.prototype.resize=function(a){O.prototype.resize.call(this,a),this.setSize()},e.prototype.setSize=function(){O.prototype.setSize.call(this),se.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},e.prototype.pointerUp=function(a){O.prototype.pointerUp.call(this,a),this.setSize()},e.prototype.setStrokeColor=function(a){this.strokeColor=a,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(a),this.stateChanged()},e.prototype.setFillColor=function(a){this.fillColor=a,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(a),this.stateChanged()},e.prototype.setStrokeWidth=function(a){this.strokeWidth=a,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},e.prototype.setStrokeDasharray=function(a){this.strokeDasharray=a,this.visual&&se.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},e.prototype.setOpacity=function(a){this.opacity=a,this.visual&&se.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var a=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},O.prototype.getState.call(this));return a.typeName=e.typeName,a},e.prototype.restoreState=function(a){var P=a;this.fillColor=P.fillColor,this.strokeColor=P.strokeColor,this.strokeWidth=P.strokeWidth,this.strokeDasharray=P.strokeDasharray,this.opacity=P.opacity,this.createVisual(),O.prototype.restoreState.call(this,a),this.setSize()},e.prototype.scale=function(a,P){O.prototype.scale.call(this,a,P),this.setSize()},e.typeName="EllipseMarker",e.title="Ellipse marker",e.icon='',e}(ke),Ye=function(O){function e(a,P,W){return O.call(this,a,P,W)||this}return Se(e,O),Object.defineProperty(e.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),e.prototype.ownsTarget=function(a){return!(!O.prototype.ownsTarget.call(this,a)&&a!==this.tip1&&a!==this.tip2)},e.prototype.createTips=function(){this.tip1=se.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.tip1),this.tip2=se.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.tip2)},e.prototype.pointerDown=function(a,P){O.prototype.pointerDown.call(this,a,P),this.state==="creating"&&this.createTips()},e.prototype.adjustVisual=function(){if(O.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(se.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var a=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),P=this.tip1.transform.baseVal.getItem(0);P.setRotate(a,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(P,0);var W=this.tip2.transform.baseVal.getItem(0);W.setRotate(a+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(W,0)}},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var a=O.prototype.getState.call(this);return a.typeName=e.typeName,a},e.prototype.restoreState=function(a){O.prototype.restoreState.call(this,a),this.createTips(),this.adjustVisual()},e.typeName="MeasurementMarker",e.title="Measurement marker",e.icon='',e}(ft),mt=function(O){function e(a,P,W){var I=O.call(this,a,P,W)||this;return I.strokePanel.colors=W.defaultColorSet,I.fillColor="transparent",I}return Se(e,O),Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var a=O.prototype.getState.call(this);return a.typeName=e.typeName,a},e.typeName="EllipseFrameMarker",e.title="Ellipse frame marker",e.icon='',e}(De),lt=function(){function O(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(O.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),O.prototype.addUndoStep=function(e){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(e)||(this.undoStack.push(e),JSON.stringify(this.lastRedoStep)!==JSON.stringify(e)&&this.redoStack.splice(0,this.redoStack.length))},O.prototype.replaceLastUndoStep=function(e){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=e)},O.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},O.prototype.undo=function(){if(this.undoStack.length>1){var e=this.undoStack.pop();return e!==void 0&&this.redoStack.push(e),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},O.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},O}(),$e=function(O){function e(a,P,W){var I=O.call(this,a,P,W)||this;return I.strokeColor="transparent",I.strokeWidth=0,I.strokeDasharray="",I.curveX=0,I.curveY=0,I.manipulationStartCurveX=0,I.manipulationStartCurveY=0,I.setStrokeColor=I.setStrokeColor.bind(I),I.setStrokeWidth=I.setStrokeWidth.bind(I),I.setStrokeDasharray=I.setStrokeDasharray.bind(I),I.positionGrips=I.positionGrips.bind(I),I.addControlGrips=I.addControlGrips.bind(I),I.adjustVisual=I.adjustVisual.bind(I),I.setupControlBox=I.setupControlBox.bind(I),I.resize=I.resize.bind(I),I.strokeColor=W.defaultColor,I.strokeWidth=W.defaultStrokeWidth,I.strokeDasharray=W.defaultStrokeDasharray,I.strokePanel=new Ie("Line color",W.defaultColorSet,W.defaultColor),I.strokePanel.onColorChanged=I.setStrokeColor,I.strokeWidthPanel=new it("Line width",W.defaultStrokeWidths,W.defaultStrokeWidth),I.strokeWidthPanel.onWidthChanged=I.setStrokeWidth,I.strokeStylePanel=new at("Line style",W.defaultStrokeDasharrays,W.defaultStrokeDasharray),I.strokeStylePanel.onStyleChanged=I.setStrokeDasharray,I}return Se(e,O),e.prototype.ownsTarget=function(a){return!(!O.prototype.ownsTarget.call(this,a)&&a!==this.visual&&a!==this.selectorCurve&&a!==this.visibleCurve&&!this.curveGrip.ownsTarget(a))},e.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},e.prototype.createVisual=function(){this.visual=se.createGroup(),this.selectorCurve=se.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=se.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},e.prototype.pointerDown=function(a,P){O.prototype.pointerDown.call(this,a,P),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=a.x,this.curveY=a.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(P)&&(this.activeGrip=this.curveGrip,this._state="resize")},e.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),se.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},e.prototype.setupControlBox=function(){O.prototype.setupControlBox.call(this),this.curveControlLine1=se.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=se.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},e.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,O.prototype.addControlGrips.call(this)},e.prototype.positionGrips=function(){O.prototype.positionGrips.call(this);var a=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-a/2,this.curveY-a/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},e.prototype.manipulate=function(a){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+a.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+a.y-this.manipulationStartY),O.prototype.manipulate.call(this,a)},e.prototype.resize=function(a){this.activeGrip===this.curveGrip&&(this.curveX=a.x,this.curveY=a.y),O.prototype.resize.call(this,a),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},e.prototype.setStrokeColor=function(a){this.strokeColor=a,this.adjustVisual(),this.colorChanged(a)},e.prototype.setStrokeWidth=function(a){this.strokeWidth=a,this.adjustVisual()},e.prototype.setStrokeDasharray=function(a){this.strokeDasharray=a,this.adjustVisual()},e.prototype.scale=function(a,P){this.curveX=this.curveX*a,this.curveY=this.curveY*P,O.prototype.scale.call(this,a,P)},Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),e.prototype.getState=function(){var a=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},O.prototype.getState.call(this));return a.typeName=e.typeName,a},e.prototype.restoreState=function(a){O.prototype.restoreState.call(this,a);var P=a;this.strokeColor=P.strokeColor,this.strokeWidth=P.strokeWidth,this.strokeDasharray=P.strokeDasharray,this.curveX=P.curveX,this.curveY=P.curveY,this.createVisual(),this.adjustVisual()},e.typeName="CurveMarker",e.title="Curve marker",e.icon='',e}(dt),Je=function(){function O(e,a){a===void 0&&(a=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=e,this.cancelable=a}return Object.defineProperty(O.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),O.prototype.preventDefault=function(){this._defaultPrevented=!0},O}(),ze=function(O){function e(a,P,W){var I=O.call(this,a,!1)||this;return I.dataUrl=P,I.state=W,I}return Se(e,O),e}(Je),He=function(O){function e(a,P,W){W===void 0&&(W=!1);var I=O.call(this,a,W)||this;return I.marker=P,I}return Se(e,O),e}(Je),qe=function(){function O(){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 O.prototype.addEventListener=function(e,a){this[e].push(a)},O.prototype.removeEventListener=function(e,a){var P=this[e].indexOf(a);P>-1&&this[e].splice(P,1)},O}(),st=function(){function O(e){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Ke,this._isOpen=!1,this.undoRedoManager=new lt,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 qe,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=O.instanceCounter++,this.styles=new Te(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=e,this.targetRoot=document.body,this.width=e.clientWidth,this.height=e.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(O.prototype,"ALL_MARKER_TYPES",{get:function(){return[et,me,pe,Ze,mt,De,ae,Ae,Ye,Z,ft,$e]},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[et,me,pe,Ze,De,ae,Ae]},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"BASIC_MARKER_TYPES",{get:function(){return[et,me,pe,Ze,ae]},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(e){var a=this;this._availableMarkerTypes.splice(0),e.forEach(function(P){if(typeof P=="string"){var W=a.ALL_MARKER_TYPES.find(function(I){return I.typeName===P});W!==void 0&&a._availableMarkerTypes.push(W)}else a._availableMarkerTypes.push(P)})},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(e){this._zoomLevel=e,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(O.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),O.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),J.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},O.prototype.show=function(){var e=this;this.styles.styleSheetRoot===void 0&&re.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=re.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(a){return a(new Je(e))})},O.prototype.render=function(){return xe(this,void 0,void 0,function(){var e;return _e(this,function(a){switch(a.label){case 0:return this.setCurrentMarker(),(e=new ue).naturalSize=this.renderAtNaturalSize,e.imageType=this.renderImageType,e.imageQuality=this.renderImageQuality,e.markersOnly=this.renderMarkersOnly,e.width=this.renderWidth,e.height=this.renderHeight,[4,e.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return a.sent(),[4,e.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,a.sent()]}})})},O.prototype.close=function(e){var a=this;if(e===void 0&&(e=!1),this.isOpen){var P=!1;e||this.eventListeners.beforeclose.forEach(function(W){var I=new Je(a,!0);W(I),I.defaultPrevented&&(P=!0)}),P||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(W){return W(new Je(a))}),this.detachEvents(),this._isOpen=!1)}},O.prototype.addMarkersToToolbar=function(){for(var e,a=[],P=0;Pthis.editorCanvas.clientHeight?this.editorCanvas.clientHeight*e:this.editorCanvas.clientWidth,P=a',e.title="Powered by marker.js",e.style.display="grid",e.style.alignItems="center",e.style.justifyItems="center",e.style.padding="3px",e.style.width="20px",e.style.height="20px",this.logoUI.appendChild(e),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},O.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")},O.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"},O.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},O.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 e=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=e+"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-1&&this.markers.splice(this.markers.indexOf(e),1),e.dispose()},O.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())},O.prototype.toolbarButtonClicked=function(e,a){if(e==="marker"&&a!==void 0)this.createNewMarker(a);else if(e==="action")switch(a){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()}},O.prototype.deleteSelectedMarker=function(){var e=this;if(this._currentMarker!==void 0){var a=!1;if(this.eventListeners.markerbeforedelete.forEach(function(W){var I=new He(e,e._currentMarker,!0);W(I),I.defaultPrevented&&(a=!0)}),!a){var P=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(W){return W(new He(e,P))})}}},O.prototype.clear=function(){var e=this,a=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(le){var Ue=new He(e,void 0,!0);le(Ue),Ue.defaultPrevented&&(a=!0)}),!a)){this.setCurrentMarker();for(var P=function(le){var Ue=W.markers[le];W.setCurrentMarker(W.markers[le]),W._currentMarker.dispose(),W.markerImage.removeChild(W._currentMarker.container),W.markers.splice(W.markers.indexOf(W._currentMarker),1),W.eventListeners.markerdelete.forEach(function(Xe){return Xe(new He(e,Ue))})},W=this,I=this.markers.length-1;I>=0;I--)P(I);this.addUndoStep()}},Object.defineProperty(O.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),O.prototype.showNotesEditor=function(){var e;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=(e=this._currentMarker.notes)!==null&&e!==void 0?e:"",this.overlayContainer.appendChild(this.notesArea))},O.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)},O.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},O.prototype.addUndoStep=function(){var e=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var a=this.getState(),P=this.undoRedoManager.getLastUndoStep();if(!P||P.width===a.width&&P.height===a.height){var W=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(a),W1&&this.panTo({x:e.clientX,y:e.clientY}))},O.prototype.onPointerUp=function(e){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(e.clientX,e.clientY)),this.isDragging=!1,this.addUndoStep()},O.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},O.prototype.onKeyUp=function(e){this._currentMarker===void 0||this.notesArea!==void 0||e.key!=="Delete"&&e.key!=="Backspace"||this.deleteSelectedMarker()},O.prototype.clientToLocalCoordinates=function(e,a){var P=this.markerImage.getBoundingClientRect();return{x:(e-P.left)/this.zoomLevel,y:(a-P.top)/this.zoomLevel}},O.prototype.onWindowResize=function(){this.positionUI()},O.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var e=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=e+"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()},O.prototype.addLicenseKey=function(e){J.addKey(e)},O.prototype.addEventListener=function(e,a){this.eventListeners.addEventListener(e,a)},O.prototype.removeEventListener=function(e,a){this.eventListeners.removeEventListener(e,a)},O.prototype.renderState=function(e){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(e),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(O.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),O.prototype.focus=function(){var e=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(a){return a(new Je(e))}))},O.prototype.blur=function(){var e=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(a){return a(new Je(e))}))},O.instanceCounter=0,O}();/* **********************************
cropro version 1.2.0
@license SEE LICENSE IN LICENSE
copyright Alan Mendelevich
see README and LICENSE for details
********************************** *//*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var gt=function(O,e){return(gt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,P){a.__proto__=P}||function(a,P){for(var W in P)Object.prototype.hasOwnProperty.call(P,W)&&(a[W]=P[W])})(O,e)};function yt(O,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function a(){this.constructor=O}gt(O,e),O.prototype=e===null?Object.create(e):(a.prototype=e.prototype,new a)}function bt(O,e,a,P){return new(a||(a=Promise))(function(W,I){function le(ht){try{Xe(P.next(ht))}catch(Fe){I(Fe)}}function Ue(ht){try{Xe(P.throw(ht))}catch(Fe){I(Fe)}}function Xe(ht){var Fe;ht.done?W(ht.value):(Fe=ht.value,Fe instanceof a?Fe:new a(function(ct){ct(Fe)})).then(le,Ue)}Xe((P=P.apply(O,e||[])).next())})}function vt(O,e){var a,P,W,I,le={label:0,sent:function(){if(1&W[0])throw W[1];return W[1]},trys:[],ops:[]};return I={next:Ue(0),throw:Ue(1),return:Ue(2)},typeof Symbol=="function"&&(I[Symbol.iterator]=function(){return this}),I;function Ue(Xe){return function(ht){return function(Fe){if(a)throw new TypeError("Generator is already executing.");for(;le;)try{if(a=1,P&&(W=2&Fe[0]?P.return:Fe[0]?P.throw||((W=P.return)&&W.call(P),0):P.next)&&!(W=W.call(P,Fe[1])).done)return W;switch(P=0,W&&(Fe=[2&Fe[0],W.value]),Fe[0]){case 0:case 1:W=Fe;break;case 4:return le.label++,{value:Fe[1],done:!1};case 5:le.label++,P=Fe[1],Fe=[0];continue;case 7:Fe=le.ops.pop(),le.trys.pop();continue;default:if(!(W=le.trys,(W=W.length>0&&W[W.length-1])||Fe[0]!==6&&Fe[0]!==2)){le=0;continue}if(Fe[0]===3&&(!W||Fe[1]>W[0]&&Fe[1]0&&a>0){var P=new L(e,a),W=P.ratio>=1?20:P.getHorizontalLength(20),I=P.ratio<1?20:P.getVerticalLength(20),le=document.createElementNS("http://www.w3.org/2000/svg","svg");le.setAttribute("xmlns","http://www.w3.org/2000/svg"),le.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(le);var Ue=pt.createDefs();le.appendChild(Ue);var Xe=pt.createElement("clipPath",[["id","text-bg-clip"]]);Ue.appendChild(Xe);var ht=pt.createPath(pt.getHollowRectanglePath((24-W)/2,(24-I)/2,W,I,(24-W)/2+2,(24-I)/2+2,W-4,I-4));le.appendChild(ht);var Fe=pt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Fe.appendChild(pt.createTSpan(e+":"+a)),le.appendChild(Fe);var ct=Fe.getBBox();pt.setAttributes(Fe,[["x",((24-ct.width)/2).toString()],["y",((24-ct.height)/2-ct.y).toString()]]);var Et=pt.createPath(pt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(ct.width))/2,(24-Math.ceil(ct.height))/2,Math.ceil(ct.width),Math.ceil(ct.height)));return Xe.appendChild(Et),pt.setAttributes(ht,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(le),le.outerHTML}return''},O}(),Y=function(O){function e(a,P,W){var I=O.call(this,a,P)||this;return I.isDropdownOpen=!1,I.onClick=I.dropdownButtonClicked,I.dropdownButtons=W,I}return yt(e,O),e.prototype.setupDropdown=function(){var a=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(P){P.className=a.className,P.colorsClassName=a.colorsClassName,a.dropdownBlock.appendChild(P.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},e.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},e.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},e.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},e.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},e.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},e}(m),ce=function(){function O(e,a){this.GRIP_SIZE=10,this.color=e,this.fillColor=a,this.visual=pt.createGroup(),this.visual.appendChild(pt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(pt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return O.prototype.ownsTarget=function(e){return e===this.visual||e===this.visual.childNodes[0]||e===this.visual.childNodes[1]},O.prototype.setCenter=function(e,a){this.visual.childNodes.forEach(function(P){return pt.setAttributes(P,[["cx",e.toString()],["cy",a.toString()]])})},O}(),be=function(){function O(e,a,P,W){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=e,this.canvasHeight=a,this.margin=P,this.container=W,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(O.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(e){this._aspectRatio=e,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(e){this._isGridVisible=e,this.gridContainer&&pt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(e){this._zoomFactor=e,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),O.prototype.open=function(){var e=this;this.cropShadeElement=pt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=pt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var a=0;athis.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-a.height/2),pt.setAttributes(this.cropRectElement,[["x",a.x.toString()],["y",a.y.toString()],["width",a.width.toString()],["height",a.height.toString()]]);var P=a.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(I,le){var Ue=a.y+P*(le+1);pt.setAttributes(I,[["x1",""+a.x],["y1",""+Ue],["x2",""+(a.x+a.width)],["y2",""+Ue]])});var W=a.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(I,le){var Ue=a.x+W*(le+1);pt.setAttributes(I,[["x1",""+Ue],["y1",""+a.y],["x2",""+Ue],["y2",""+(a.y+a.height)]])}),pt.setAttributes(this.cropShadeElement,[["d",pt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,a.x,a.y,a.width,a.height)]]),this.topLeftGrip.setCenter(a.x,a.y),this.topRightGrip.setCenter(a.x+a.width,a.y),this.bottomLeftGrip.setCenter(a.x,a.y+a.height),this.bottomRightGrip.setCenter(a.x+a.width,a.y+a.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},O.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)},O.prototype.clientToLocalCoordinates=function(e,a){var P=this.container.getBoundingClientRect();return{x:e-P.left+this.margin,y:a-P.top+this.margin}},O.prototype.onPointerDown=function(e){this.container.setPointerCapture(e.pointerId),this.previousPoint=this.clientToLocalCoordinates(e.clientX,e.clientY),this.cropRectElement===e.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(e.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(e.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(e.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(e.target)&&(this.activeGrip=this.bottomRightGrip)},O.prototype.onPointerMove=function(e){if(this.isMoving)this.move(this.clientToLocalCoordinates(e.clientX,e.clientY));else if(this.activeGrip){var a=this.clientToLocalCoordinates(e.clientX,e.clientY);this.resize(a)}e.preventDefault()},O.prototype.onPointerUp=function(e){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(e.pointerId)},O.prototype.move=function(e){var a=e.x-this.previousPoint.x,P=e.y-this.previousPoint.y;this.zoomFactor!==1&&(a=-a/this.zoomFactor,P=-P/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+a),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+P),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=e},O.prototype.resize=function(e){var a=Object.assign({},this.cropRect),P=e.x-this.previousPoint.x,W=e.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:a.x+Pthis.canvasWidth*this.zoomFactor&&(P=this.canvasWidth*this.zoomFactor-a.width),a.width+=P}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(a.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(P),a.height=this.aspectRatio.getVerticalLength(a.width)):(a.y+=W,a.height=this.cropRect.y+this.cropRect.height-a.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?a.height=this.aspectRatio.getVerticalLength(a.width):a.height+=W}a.width<10&&(a.x=this.cropRect.x,a.width=10),a.height<10&&(a.y=this.cropRect.y,a.height=10),this.previousPoint=e,a.x>=this.margin&&a.y>=this.margin&&a.x-this.margin+a.width<=this.canvasWidth&&a.y-this.margin+a.height<=this.canvasHeight&&(this.cropRect=a,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},O.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var e=this.cropRect.x+this.cropRect.width/2,a=this.cropRect.y+this.cropRect.height/2,P=this.aspectRatio.getHorizontalLength(this.cropRect.height),W=this.aspectRatio.getVerticalLength(this.cropRect.width);P/this.canvasWidththis.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=e-this.cropRect.width/2,this.cropRect.y=a-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)}},O.prototype.getRescaledRect=function(e,a,P,W,I,le){var Ue=P/e,Xe=W/a;return{x:(I.x-le)*Ue+le,y:(I.y-le)*Xe+le,width:I.width*Ue,height:I.height*Xe}},O.prototype.scaleCanvas=function(e,a){var P=this.getRescaledRect(this.canvasWidth,this.canvasHeight,e,a,this.cropRect,this.margin);this.canvasWidth=e,this.canvasHeight=a,this.onCropChange&&this.onCropChange(P),this.setCropRectangle(P)},O}(),Me=function(){function O(e){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=e,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(O.prototype,"angle",{get:function(){return this._angle},set:function(e){this._angle=e,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),O.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},O.prototype.onPointerDown=function(e){this.controlContainer.setPointerCapture(e.pointerId),this.isDragging=!0,this.previousPoint={x:e.clientX,y:e.clientY}},O.prototype.onPointerMove=function(e){this.isDragging&&(this.onAngleChange&&this.onAngleChange((e.clientX-this.previousPoint.x)/5),this.previousPoint.x=e.clientX)},O.prototype.onPointerUp=function(e){this.isDragging&&this.onAngleChange&&this.onAngleChange((e.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(e.pointerId)},O.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var e=this.angleLabelText.getBBox();pt.setAttributes(this.angleLabelElement,[["x",((this.width-e.width)/2).toString()],["y",(this.height/2).toString()]])}},O.prototype.positionScaleShape=function(){if(this.scaleShape){var e=this.scaleShape.transform.baseVal.getItem(0);e.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(e,0)}},O.prototype.getVisual=function(){var e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("width",this.width+"px"),e.setAttribute("height",this.height+"px"),e.setAttribute("viewBox","0 0 "+this.width+" "+this.height),e.style.flexShrink="0",document.body.appendChild(e);for(var a="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,P=1;P<=this.width/5+10;P++){var W=P%5==0?this.height/3:this.height/6;a+="h4v"+-W+"h1v"+W}a+="v1H0Z",this.scaleShape=pt.createPath(a);var I=pt.createTransform();this.scaleShape.transform.baseVal.appendItem(I),e.appendChild(this.scaleShape),this.angleLabelElement=pt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=pt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var le=pt.createTSpan("");return le.innerHTML="°",this.angleLabelElement.appendChild(le),e.appendChild(this.angleLabelElement),document.body.removeChild(e),e},O}(),Ve=function(){function O(){this.naturalSize=!1,this.imageType="image/png"}return O.prototype.rasterize=function(e,a,P,W,I,le,Ue){var Xe=this;return new Promise(function(ht){var Fe=document.createElement("canvas");Fe.width=e.width.baseVal.value-2*W,Fe.height=e.height.baseVal.value-2*W;var ct=1,Et=1;Xe.naturalSize===!0?(ct=a.naturalWidth/(e.width.baseVal.value-2*W)/le,Et=a.naturalHeight/(e.height.baseVal.value-2*W)/Ue,Fe.width=a.naturalWidth/le,Fe.height=a.naturalHeight/Ue):Xe.width!==void 0&&Xe.height!==void 0&&(ct=Xe.width/P.width,Et=Xe.height/P.height,Fe.width*=ct,Fe.height*=Et);var Tt=Fe.getContext("2d");Tt.translate(Fe.width/2,Fe.height/2),Tt.rotate(I*Math.PI/180),Tt.scale(le,Ue),Tt.translate(-Fe.width/2,-Fe.height/2),Tt.drawImage(a,0,0,Fe.width,Fe.height);var Mt=document.createElement("canvas");Mt.width=P.width*ct,Mt.height=P.height*Et,Mt.getContext("2d").putImageData(Tt.getImageData((P.x-W)*ct,(P.y-W)*Et,P.width*ct,P.height*Et),0,0),ht(Mt.toDataURL(Xe.imageType,Xe.imageQuality))})},O}(),Ge=function(){function O(e){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=O.instanceCounter++,this.styles=new Ot(this.instanceNo),this.target=e,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(O.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(e){this._zoomToCropEnabled=e,e?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(e){this._isGridVisible=e,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"gridLines",{get:function(){return this._gridLines},set:function(e){this._gridLines=e,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(e){this._rotationAngle=e,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"aspectRatio",{get:function(){var e;return(e=this._aspectRatio)!==null&&e!==void 0?e:this.aspectRatios[0]},set:function(e){this._aspectRatio=e},enumerable:!1,configurable:!0}),O.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},O.prototype.show=function(){this.showUI(),this.open()},O.prototype.close=function(e){e===void 0&&(e=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),e||this.closeEventListeners.forEach(function(a){return a()}),this._isOpen=!1)},O.prototype.addRenderEventListener=function(e){this.renderEventListeners.push(e)},O.prototype.removeRenderEventListener=function(e){this.renderEventListeners.indexOf(e)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(e),1)},O.prototype.addCloseEventListener=function(e){this.closeEventListeners.push(e)},O.prototype.removeCloseEventListener=function(e){this.closeEventListeners.indexOf(e)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(e),1)},O.prototype.setupResizeObserver=function(){var e=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){e.resize(e.target.clientWidth,e.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))},O.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var e=1*this.target.clientWidth/this.target.clientHeight,a=this.contentDiv.clientWidth/e>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*e:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,P=a+2*this.CANVAS_MARGINe+this.CANVAS_MARGIN?this.target.offsetTop-(e+this.CANVAS_MARGIN):0;this.coverDiv.style.top=a+"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},O.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},O.prototype.addTopToolbar=function(){var e=this;this.topToolbar=new St,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 a=new K;a.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(a);var P=[];this.aspectRatios.forEach(function(Et){var Tt=new m(B.getIcon(Et.horizontal,Et.vertical),Et.horizontal===0&&Et.vertical===0?"FREE":Et.horizontal+":"+Et.vertical);Tt.onClick=function(){return e.ratioButtonClicked(Et)},P.push(Tt)}),this.aspectRatioButton=new Y(B.getIcon(0,0),"Aspect ratio",P),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,a.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var W=new m('',"Toggle grid");W.isActive=this.isGridVisible,W.onClick=function(){e.isGridVisible=!e.isGridVisible,W.isActive=e.isGridVisible},a.addButton(W);var I=new m('',"Zoom to selection");if(I.isActive=this.zoomToCropEnabled,I.onClick=function(){e.zoomToCropEnabled=!e.zoomToCropEnabled,I.isActive=e.zoomToCropEnabled},a.addButton(I),!Ct.isLicensed){var le=new A;this.topToolbar.addElementBlock(le);var Ue=document.createElement("div");Ue.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Xe=document.createElement("a");Xe.style.color="currentColor",Xe.href="https://markerjs.com/products/cropro",Xe.target="_blank",Xe.innerHTML='',Ue.appendChild(Xe),le.addElement(Ue)}var ht=new K;ht.minWidth=3*this.toolbarHeight+"px",ht.contentAlign="end",this.topToolbar.addButtonBlock(ht);var Fe=new m('',"OK");Fe.onClick=this.startRenderAndClose,ht.addButton(Fe),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Fe.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var ct=new m('',"Close");ct.onClick=this.close,ht.addButton(ct),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(ct.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},O.prototype.addBottomToolbar=function(){var e=this;this.bottomToolbar=new St,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 a=new K;a.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(a);var P=new m('',"Rotate left");P.onClick=this.rotateLeftButtonClicked,a.addButton(P);var W=new m('',"Rotate right");W.onClick=this.rotateRightButtonClicked,a.addButton(W);var I=new A;I.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(I),this.straightener=new Me("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(ht){e.rotateBy(ht),e.straightener.angle=e.rotationAngle},I.addElement(this.straightener.getUI());var le=new K;le.minWidth=2*this.toolbarHeight+"px",le.contentAlign="end",this.bottomToolbar.addButtonBlock(le);var Ue=new m('',"Flip horizontal");Ue.onClick=this.flipHorizontallyButtonClicked,le.addButton(Ue);var Xe=new m('',"Flip vertical");Xe.onClick=this.flipVerticallyButtonClicked,le.addButton(Xe)},O.prototype.ratioButtonClicked=function(e){this.aspectRatio=e,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},O.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=B.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},O.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new L(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},O.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},O.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},O.prototype.restoreState=function(e){if(e){var a=this.cropLayer.getRescaledRect(e.width,e.height,this.imageWidth,this.imageHeight,e.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(a),this.cropRectChanged(a),this.flippedHorizontally=e.flippedHorizontally,this.flippedVertically=e.flippedVertically,this.applyFlip(),this.rotationAngle=e.rotationAngle,this.applyRotation()}},O.prototype.clientToLocalCoordinates=function(e,a){var P=this.cropImage.getBoundingClientRect();return{x:e-P.left,y:a-P.top}},O.prototype.onWindowResize=function(){this.positionUI()},O.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var e=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=e+"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()},O.prototype.rotateLeftButtonClicked=function(){var e=this.rotationAngle-90;this.rotationAngle%90!=0&&(e+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(e)},O.prototype.rotateRightButtonClicked=function(){var e=this.rotationAngle+90;this.rotationAngle%90!=0&&(e-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(e)},O.prototype.rotateTo=function(e){e=(e=e>180?e-360:e)<=-180?e+360:e,this.rotationAngle=e,this.applyRotation()},O.prototype.rotateBy=function(e){this.rotateTo((this.rotationAngle+e)%360)},O.prototype.applyRotation=function(){var e=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var a=this.editingTargetRotationContainer.transform.baseVal.getItem(0);a.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(a,0);var P=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/P.width,this.imageHeight/P.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=e},O.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},O.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},O.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},O.prototype.startRenderAndClose=function(){return bt(this,void 0,void 0,function(){var e,a;return vt(this,function(P){switch(P.label){case 0:return[4,this.render()];case 1:return e=P.sent(),a=this.getState(),this.renderEventListeners.forEach(function(W){return W(e,a)}),this.close(!0),[2]}})})},O.prototype.render=function(){return bt(this,void 0,void 0,function(){var e;return vt(this,function(a){switch(a.label){case 0:return(e=new Ve).naturalSize=this.renderAtNaturalSize,e.imageType=this.renderImageType,e.imageQuality=this.renderImageQuality,e.width=this.renderWidth,e.height=this.renderHeight,this.unzoomFromCrop(),pt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,e.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 a.sent(),[4,e.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,a.sent()]}})})},O.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new _t("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 _t("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new _t("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var e=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new _t("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*e)+`px;
height: `+(this.toolbarHeight-2*e)+`px;
padding: `+e+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new _t("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new _t("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new Rt("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new Rt("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new _t("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 _t("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new _t("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 _t("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*e)+`px;
padding: `+e+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new _t("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},O.instanceCounter=0,O}(),rt=ee("8hTe"),Qe=ee.n(rt),Pe=/]*>/g;function tt(O){var e=document.createElement("div");return e.innerHTML=O,e.childNodes.length===0?"":e.childNodes[0].nodeValue}var nt=ot.a=function(O){var e=O.value,a=e===void 0?"":e,P=O.edit,W=P===void 0?!1:P,I=O.className,le=O.showTextOnly,Ue=O.showLines,Xe=O.replaces,ht=O.zoomImg,Fe=O.hasMask,ct=O.style,Et=ct===void 0?{}:ct,Tt=O.stylesPrev,Mt=Tt===void 0?{}:Tt,Ut=String(a),wt=Object(R.useRef)(),Lt=Object(R.useRef)(),Yt=Object(R.useState)(""),Gt=Object(F.a)(Yt,2),kt=Gt[0],It=Gt[1],Vt=Object(R.useState)("office"),zt=Object(F.a)(Vt,2),Xt=zt[0],jt=zt[1],$t=function(){var xt=new Ge(Lt.current);xt.displayMode="popup",xt.addRenderEventListener(function(){var Nt=Object(v.a)(N.a.mark(function At(Ht){var Pt;return N.a.wrap(function(Bt){for(;;)switch(Bt.prev=Bt.next){case 0:return wt.current.style.display="none",Bt.next=3,Object(Ce.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Ht}});case 3:Pt=Bt.sent,Pt!=null&&Pt.id&&Xe(Lt.current.getAttribute("src").replace(q.a.API_SERVER,""),"/api/attachments/".concat(Pt==null?void 0:Pt.id,"?type=").concat(Pt.content_type));case 5:case"end":return Bt.stop()}},At)}));return function(At){return Nt.apply(this,arguments)}}()),xt.show()},Kt=function(){var xt=new st(Lt.current);xt.settings.displayMode="popup",xt.addEventListener("render",function(){var Nt=Object(v.a)(N.a.mark(function At(Ht){var Pt;return N.a.wrap(function(Bt){for(;;)switch(Bt.prev=Bt.next){case 0:if(wt.current.style.display="none",!Lt.current){Bt.next=6;break}return Bt.next=4,Object(Ce.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Ht.dataUrl}});case 4:Pt=Bt.sent,Pt!=null&&Pt.id&&Xe(Lt.current.getAttribute("src").replace(q.a.API_SERVER,""),"/api/attachments/".concat(Pt==null?void 0:Pt.id,"?type=").concat(Pt.content_type));case 6:case"end":return Bt.stop()}},At)}));return function(At){return Nt.apply(this,arguments)}}()),xt.show(),window.markerArea=xt},Wt=Object(R.useMemo)(function(){wt.current&&(wt.current.style.zIndex=-1);try{var Dt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,xt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Nt=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Ut=Ut.replace(Dt,"("+q.a.API_SERVER+"/api/attachments/").replace(xt,'"'+q.a.API_SERVER+"/api/attachments/").replace(Nt,'"'+q.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`)}catch(Qt){}var At=j(Ut),Ht=g();if(Ut.match(/\[TOC\]/)&&(At=At.replace("[TOC]
",y()),h()),At=At.replace(/(__special_katext_id_\d+__)/g,function(Qt,Bt){var er=Ht[Bt],tr=er.type,rr=er.expression;return Object(ie.renderToString)(tt(rr)||"",{displayMode:tr==="block",throwOnError:!1,output:"html"})}),At=At.replace(/▁/g,"\u2581\u2581\u2581"),p(),le){var Pt=document.createElement("div");return Pt.innerHTML=At,Pt.innerText}return setTimeout(function(){return Zt()},500),At},[Ut]),Ft=Object(R.useRef)();l.WebkitLineClamp=Ue,Ue&&(Et=Object(k.a)(Object(k.a)({},Et),l));function qt(Dt){var xt=Dt.target;if(xt.tagName.toUpperCase()==="IMG"){if(ht){var Nt=xt.getAttribute("src");It(Nt),jt("image")}}else if(xt.tagName.toUpperCase()==="A"){var At=xt.getAttribute("href");if(At.indexOf("office")>-1)Dt.preventDefault(),It(At),jt("office");else if(At.indexOf("application/pdf")>-1)Dt.preventDefault(),It(At),jt("pdf");else if(At.indexOf("text/html")>-1)Dt.preventDefault(),It(At),jt("html");else if(At.startsWith("#")){Dt.preventDefault();var Ht=document.getElementById(At.replace("#",""));Ht&&Ht.scrollIntoView(!0)}}}var Zt=function(){var xt,Nt=(xt=Ft.current)===null||xt===void 0?void 0:xt.querySelectorAll("video");Nt==null||Nt.forEach(function(At){if(At.oncontextmenu=function(){return!1},At.src.indexOf(".m3u8")>-1&&!At.canPlayType("application/vnd.apple.mpegurl")){if(X.a.isSupported()){var Ht=new X.a;Ht.loadSource(At.src),Ht.attachMedia(At)}}})};Object(R.useEffect)(function(){if(Ft.current&&Wt&&(Wt.match(Pe)&&window.PR.prettyPrint()),Ft.current)return Ft.current.addEventListener("click",qt),function(){Ft.current.removeEventListener("click",qt),p(),h()}},[Wt,Ft.current,qt]);var Jt=function(xt){if(!W)return;xt.target.nodeName==="IMG"?(wt.current.style.zIndex=1,wt.current.style.display="flex",wt.current.style.width=xt.target.clientWidth+"px",wt.current.style.height=xt.target.clientHeight+"px",wt.current.style.top=xt.target.offsetTop+"px",wt.current.style.left=xt.target.offsetLeft+"px",Lt.current.src=xt.target.getAttribute("src")):wt.current.style.display="none"};return b.a.createElement("div",{style:{position:"relative"}},b.a.createElement("div",{ref:Ft,style:Object(k.a)({},Et),className:"".concat(I||""," markdown-body ").concat(Qe.a.mdBody),onMouseOver:Jt,dangerouslySetInnerHTML:{__html:Wt}}),b.a.createElement("div",{ref:wt,className:Qe.a.button},b.a.createElement(G.a,null,b.a.createElement(z.a,{onClick:function(){return $t()}},"\u88C1\u526A"),b.a.createElement(z.a,{onClick:function(){return Kt()}},"\u7F16\u8F91"))),b.a.createElement("img",{ref:Lt,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),b.a.createElement(oe.a,{close:!0,data:kt,type:kt!=null&&kt.length?Xt:"",style:Object(k.a)({},Mt),onClose:function(){return It("")}}))}},"9VGf":function(ut,ot,ee){"use strict";ee.d(ot,"a",function(){return w});var ge=ee("q1tI"),G=ee.n(ge);function w(z,k){var v=Object(ge.useRef)();Object(ge.useEffect)(function(){v.current=z}),Object(ge.useEffect)(function(){function F(){v.current()}if(k!==null){var U=setInterval(F,k);return function(){return clearInterval(U)}}},[k])}},DlQD:function(ut,ot,ee){(function(ge,G){ut.exports=G()})(this,function(){"use strict";function ge(me,ve){for(var pe=0;peme.length)&&(ve=me.length);for(var pe=0,Z=new Array(ve);pe=me.length?{done:!0}:{done:!1,value:me[Z++]}}}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 pe=me[Symbol.iterator](),pe.next.bind(pe)}function v(me,ve){return ve={exports:{}},me(ve,ve.exports),ve.exports}var F=v(function(me){function ve(){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 pe(Z){me.exports.defaults=Z}me.exports={defaults:ve(),getDefaults:ve,changeDefaults:pe}}),U=F.defaults,N=F.getDefaults,R=F.changeDefaults,b=/[&<>"']/,T=/[&<>"']/g,C=/[<>"']|&(?!#?\w+;)/,x=/[<>"']|&(?!#?\w+;)/g,S={"&":"&","<":"<",">":">",'"':""","'":"'"},E=function(ve){return S[ve]};function u(me,ve){if(ve){if(b.test(me))return me.replace(T,E)}else if(C.test(me))return me.replace(x,E);return me}var t=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function n(me){return me.replace(t,function(ve,pe){return pe=pe.toLowerCase(),pe==="colon"?":":pe.charAt(0)==="#"?pe.charAt(1)==="x"?String.fromCharCode(parseInt(pe.substring(2),16)):String.fromCharCode(+pe.substring(1)):""})}var s=/(^|[^\[])\^/g;function h(me,ve){me=me.source||me,ve=ve||"";var pe={replace:function(te,ae){return ae=ae.source||ae,ae=ae.replace(s,"$1"),me=me.replace(te,ae),pe},getRegex:function(){return new RegExp(me,ve)}};return pe}var l=/[^\w:]/g,c=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function y(me,ve,pe){if(me){var Z;try{Z=decodeURIComponent(n(pe)).replace(l,"").toLowerCase()}catch(te){return null}if(Z.indexOf("javascript:")===0||Z.indexOf("vbscript:")===0||Z.indexOf("data:")===0)return null}ve&&!c.test(pe)&&(pe=i(ve,pe));try{pe=encodeURI(pe).replace(/%25/g,"%")}catch(te){return null}return pe}var f={},d=/^[^:]+:\/*[^/]*$/,o=/^([^:]+:)[\s\S]*$/,r=/^([^:]+:\/*[^/]*)[\s\S]*$/;function i(me,ve){f[" "+me]||(d.test(me)?f[" "+me]=me+"/":f[" "+me]=D(me,"/",!0)),me=f[" "+me];var pe=me.indexOf(":")===-1;return ve.substring(0,2)==="//"?pe?ve:me.replace(o,"$1")+ve:ve.charAt(0)==="/"?pe?ve:me.replace(r,"$1")+ve:me+ve}var g={exec:function(){}};function p(me){for(var ve=1,pe,Z;ve=0&&Ae[Ye]==="\\";)De=!De;return De?"|":" |"}),Z=pe.split(/ \|/),te=0;if(Z.length>ve)Z.splice(ve);else for(;Z.length=Z.length?te.slice(Z.length):te}).join(`
`)}var Ee=function(){function me(pe){this.options=pe||V}var ve=me.prototype;return ve.space=function(Z){var te=this.rules.block.newline.exec(Z);if(te)return te[0].length>1?{type:"space",raw:te[0]}:{raw:`
`}},ve.code=function(Z,te){var ae=this.rules.block.code.exec(Z);if(ae){var ne=te[te.length-1];if(ne&&ne.type==="paragraph")return{raw:ae[0],text:ae[0].trimRight()};var Ae=ae[0].replace(/^ {4}/gm,"");return{type:"code",raw:ae[0],codeBlockStyle:"indented",text:this.options.pedantic?Ae:$(Ae,`
`)}}},ve.fences=function(Z){var te=this.rules.block.fences.exec(Z);if(te){var ae=te[0],ne=Ce(ae,te[3]||"");return{type:"code",raw:ae,lang:te[2]?te[2].trim():te[2],text:ne}}},ve.heading=function(Z){var te=this.rules.block.heading.exec(Z);if(te)return{type:"heading",raw:te[0],depth:te[1].length,text:te[2]}},ve.nptable=function(Z){var te=this.rules.block.nptable.exec(Z);if(te){var ae={type:"table",header:X(te[1].replace(/^ *| *\| *$/g,"")),align:te[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:te[3]?te[3].replace(/\n$/,"").split(`
`):[],raw:te[0]};if(ae.header.length===ae.align.length){var ne=ae.align.length,Ae;for(Ae=0;Ae ?/gm,"");return{type:"blockquote",raw:te[0],text:ae}}},ve.list=function(Z){var te=this.rules.block.list.exec(Z);if(te){for(var ae=te[0],ne=te[2],Ae=ne.length>1,De=ne[ne.length-1]===")",Ye={type:"list",raw:ae,ordered:Ae,start:Ae?+ne.slice(0,-1):"",loose:!1,items:[]},mt=te[0].match(this.rules.block.item),lt=!1,$e,Je,ze,He,qe,st,gt,yt=mt.length,bt=0;bt1||this.options.smartLists&&ze!==ne)&&(He=mt.slice(bt+1).join(`
`),Ye.raw=Ye.raw.substring(0,Ye.raw.length-He.length),bt=yt-1)),qe=lt||/\n\n(?!\s*$)/.test($e),bt!==yt-1&&(lt=$e.charAt($e.length-1)===`
`,qe||(qe=lt)),qe&&(Ye.loose=!0),st=/^\[[ xX]\] /.test($e),gt=void 0,st&&(gt=$e[1]!==" ",$e=$e.replace(/^\[[ xX]\] +/,"")),Ye.items.push({type:"list_item",raw:ae,task:st,checked:gt,loose:qe,text:$e});return Ye}},ve.html=function(Z){var te=this.rules.block.html.exec(Z);if(te)return{type:this.options.sanitize?"paragraph":"html",raw:te[0],pre:!this.options.sanitizer&&(te[1]==="pre"||te[1]==="script"||te[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(te[0]):q(te[0]):te[0]}},ve.def=function(Z){var te=this.rules.block.def.exec(Z);if(te){te[3]&&(te[3]=te[3].substring(1,te[3].length-1));var ae=te[1].toLowerCase().replace(/\s+/g," ");return{tag:ae,raw:te[0],href:te[2],title:te[3]}}},ve.table=function(Z){var te=this.rules.block.table.exec(Z);if(te){var ae={type:"table",header:X(te[1].replace(/^ *| *\| *$/g,"")),align:te[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:te[3]?te[3].replace(/\n$/,"").split(`
`):[]};if(ae.header.length===ae.align.length){ae.raw=te[0];var ne=ae.align.length,Ae;for(Ae=0;Ae/i.test(ne[0])&&(te=!1),!ae&&/^<(pre|code|kbd|script)(\s|>)/i.test(ne[0])?ae=!0:ae&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ne[0])&&(ae=!1),{type:this.options.sanitize?"text":"html",raw:ne[0],inLink:te,inRawBlock:ae,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ne[0]):q(ne[0]):ne[0]}},ve.link=function(Z){var te=this.rules.inline.link.exec(Z);if(te){var ae=ie(te[2],"()");if(ae>-1){var ne=te[0].indexOf("!")===0?5:4,Ae=ne+te[1].length+ae;te[2]=te[2].substring(0,ae),te[0]=te[0].substring(0,Ae).trim(),te[3]=""}var De=te[2],Ye="";if(this.options.pedantic){var mt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(De);mt?(De=mt[1],Ye=mt[3]):Ye=""}else Ye=te[3]?te[3].slice(1,-1):"";De=De.trim().replace(/^<([\s\S]*)>$/,"$1");var lt=oe(te,{href:De&&De.replace(this.rules.inline._escapes,"$1"),title:Ye&&Ye.replace(this.rules.inline._escapes,"$1")},te[0]);return lt}},ve.reflink=function(Z,te){var ae;if((ae=this.rules.inline.reflink.exec(Z))||(ae=this.rules.inline.nolink.exec(Z))){var ne=(ae[2]||ae[1]).replace(/\s+/g," ");if(ne=te[ne.toLowerCase()],!ne||!ne.href){var Ae=ae[0].charAt(0);return{type:"text",raw:Ae,text:Ae}}var De=oe(ae,ne,ae[0]);return De}},ve.strong=function(Z,te,ae){ae===void 0&&(ae="");var ne=this.rules.inline.strong.start.exec(Z);if(ne&&(!ne[1]||ne[1]&&(ae===""||this.rules.inline.punctuation.exec(ae)))){te=te.slice(-1*Z.length);var Ae=ne[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Ae.lastIndex=0;for(var De;(ne=Ae.exec(te))!=null;)if(De=this.rules.inline.strong.middle.exec(te.slice(0,ne.index+3)),De)return{type:"strong",raw:Z.slice(0,De[0].length),text:Z.slice(2,De[0].length-2)}}},ve.em=function(Z,te,ae){ae===void 0&&(ae="");var ne=this.rules.inline.em.start.exec(Z);if(ne&&(!ne[1]||ne[1]&&(ae===""||this.rules.inline.punctuation.exec(ae)))){te=te.slice(-1*Z.length);var Ae=ne[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Ae.lastIndex=0;for(var De;(ne=Ae.exec(te))!=null;)if(De=this.rules.inline.em.middle.exec(te.slice(0,ne.index+2)),De)return{type:"em",raw:Z.slice(0,De[0].length),text:Z.slice(1,De[0].length-1)}}},ve.codespan=function(Z){var te=this.rules.inline.code.exec(Z);if(te){var ae=te[2].replace(/\n/g," "),ne=/[^ ]/.test(ae),Ae=ae.startsWith(" ")&&ae.endsWith(" ");return ne&&Ae&&(ae=ae.substring(1,ae.length-1)),ae=q(ae,!0),{type:"codespan",raw:te[0],text:ae}}},ve.br=function(Z){var te=this.rules.inline.br.exec(Z);if(te)return{type:"br",raw:te[0]}},ve.del=function(Z){var te=this.rules.inline.del.exec(Z);if(te)return{type:"del",raw:te[0],text:te[1]}},ve.autolink=function(Z,te){var ae=this.rules.inline.autolink.exec(Z);if(ae){var ne,Ae;return ae[2]==="@"?(ne=q(this.options.mangle?te(ae[1]):ae[1]),Ae="mailto:"+ne):(ne=q(ae[1]),Ae=ne),{type:"link",raw:ae[0],text:ne,href:Ae,tokens:[{type:"text",raw:ne,text:ne}]}}},ve.url=function(Z,te){var ae;if(ae=this.rules.inline.url.exec(Z)){var ne,Ae;if(ae[2]==="@")ne=q(this.options.mangle?te(ae[0]):ae[0]),Ae="mailto:"+ne;else{var De;do De=ae[0],ae[0]=this.rules.inline._backpedal.exec(ae[0])[0];while(De!==ae[0]);ne=q(ae[0]),ae[1]==="www."?Ae="http://"+ne:Ae=ne}return{type:"link",raw:ae[0],text:ne,href:Ae,tokens:[{type:"text",raw:ne,text:ne}]}}},ve.inlineText=function(Z,te,ae){var ne=this.rules.inline.text.exec(Z);if(ne){var Ae;return te?Ae=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ne[0]):q(ne[0]):ne[0]:Ae=q(this.options.smartypants?ae(ne[0]):ne[0]),{type:"text",raw:ne[0],text:Ae}}},me}(),Se=j.noopTest,xe=j.edit,_e=j.merge,fe={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*|\\n*|\\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:Se,table:Se,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};fe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,fe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,fe.def=xe(fe.def).replace("label",fe._label).replace("title",fe._title).getRegex(),fe.bullet=/(?:[*+-]|\d{1,9}[.)])/,fe.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,fe.item=xe(fe.item,"gm").replace(/bull/g,fe.bullet).getRegex(),fe.list=xe(fe.list).replace(/bull/g,fe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+fe.def.source+")").getRegex(),fe._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",fe._comment=//,fe.html=xe(fe.html,"i").replace("comment",fe._comment).replace("tag",fe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),fe.paragraph=xe(fe._paragraph).replace("hr",fe.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",fe._tag).getRegex(),fe.blockquote=xe(fe.blockquote).replace("paragraph",fe.paragraph).getRegex(),fe.normal=_e({},fe),fe.gfm=_e({},fe.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*|$)"}),fe.gfm.nptable=xe(fe.gfm.nptable).replace("hr",fe.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",fe._tag).getRegex(),fe.gfm.table=xe(fe.gfm.table).replace("hr",fe.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",fe._tag).getRegex(),fe.pedantic=_e({},fe.normal,{html:xe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",fe._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:Se,paragraph:xe(fe.normal._paragraph).replace("hr",fe.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",fe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var se={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Se,tag:"^comment|^[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Se,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",se.punctuation=xe(se.punctuation).replace(/punctuation/g,se._punctuation).getRegex(),se._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",se._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",se.em.start=xe(se.em.start).replace(/punctuation/g,se._punctuation).getRegex(),se.em.middle=xe(se.em.middle).replace(/punctuation/g,se._punctuation).replace(/overlapSkip/g,se._overlapSkip).getRegex(),se.em.endAst=xe(se.em.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.em.endUnd=xe(se.em.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.start=xe(se.strong.start).replace(/punctuation/g,se._punctuation).getRegex(),se.strong.middle=xe(se.strong.middle).replace(/punctuation/g,se._punctuation).replace(/blockSkip/g,se._blockSkip).getRegex(),se.strong.endAst=xe(se.strong.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.endUnd=xe(se.strong.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.blockSkip=xe(se._blockSkip,"g").getRegex(),se.overlapSkip=xe(se._overlapSkip,"g").getRegex(),se._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,se._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,se._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,se.autolink=xe(se.autolink).replace("scheme",se._scheme).replace("email",se._email).getRegex(),se._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,se.tag=xe(se.tag).replace("comment",fe._comment).replace("attribute",se._attribute).getRegex(),se._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,se._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,se._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,se.link=xe(se.link).replace("label",se._label).replace("href",se._href).replace("title",se._title).getRegex(),se.reflink=xe(se.reflink).replace("label",se._label).getRegex(),se.reflinkSearch=xe(se.reflinkSearch,"g").replace("reflink",se.reflink).replace("nolink",se.nolink).getRegex(),se.normal=_e({},se),se.pedantic=_e({},se.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:xe(/^!?\[(label)\]\((.*?)\)/).replace("label",se._label).getRegex(),reflink:xe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",se._label).getRegex()}),se.gfm=_e({},se.normal,{escape:xe(se.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\.5&&(Z="x"+Z.toString(16)),ve+=""+Z+";";return ve}var Le=function(){function me(pe){this.tokens=[],this.tokens.links=Object.create(null),this.options=pe||ue,this.options.tokenizer=this.options.tokenizer||new Ee,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Z={block:re.normal,inline:Te.normal};this.options.pedantic?(Z.block=re.pedantic,Z.inline=Te.pedantic):this.options.gfm&&(Z.block=re.gfm,this.options.breaks?Z.inline=Te.breaks:Z.inline=Te.gfm),this.tokenizer.rules=Z}me.lex=function(Z,te){var ae=new me(te);return ae.lex(Z)};var ve=me.prototype;return ve.lex=function(Z){return Z=Z.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(Z,this.tokens,!0),this.inline(this.tokens),this.tokens},ve.blockTokens=function(Z,te,ae){te===void 0&&(te=[]),ae===void 0&&(ae=!0),Z=Z.replace(/^ +$/gm,"");for(var ne,Ae,De,Ye;Z;){if(ne=this.tokenizer.space(Z)){Z=Z.substring(ne.raw.length),ne.type&&te.push(ne);continue}if(ne=this.tokenizer.code(Z,te)){Z=Z.substring(ne.raw.length),ne.type?te.push(ne):(Ye=te[te.length-1],Ye.raw+=`
`+ne.raw,Ye.text+=`
`+ne.text);continue}if(ne=this.tokenizer.fences(Z)){Z=Z.substring(ne.raw.length),te.push(ne);continue}if(ne=this.tokenizer.heading(Z)){Z=Z.substring(ne.raw.length),te.push(ne);continue}if(ne=this.tokenizer.nptable(Z)){Z=Z.substring(ne.raw.length),te.push(ne);continue}if(ne=this.tokenizer.hr(Z)){Z=Z.substring(ne.raw.length),te.push(ne);continue}if(ne=this.tokenizer.blockquote(Z)){Z=Z.substring(ne.raw.length),ne.tokens=this.blockTokens(ne.text,[],ae),te.push(ne);continue}if(ne=this.tokenizer.list(Z)){for(Z=Z.substring(ne.raw.length),De=ne.items.length,Ae=0;Ae0)for(;(mt=this.tokenizer.rules.inline.reflinkSearch.exec(Ye))!=null;)lt.includes(mt[0].slice(mt[0].lastIndexOf("[")+1,-1))&&(Ye=Ye.slice(0,mt.index)+"["+"a".repeat(mt[0].length-2)+"]"+Ye.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(mt=this.tokenizer.rules.inline.blockSkip.exec(Ye))!=null;)Ye=Ye.slice(0,mt.index)+"["+"a".repeat(mt[0].length-2)+"]"+Ye.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Z;){if(De=this.tokenizer.escape(Z)){Z=Z.substring(De.raw.length),te.push(De);continue}if(De=this.tokenizer.tag(Z,ae,ne)){Z=Z.substring(De.raw.length),ae=De.inLink,ne=De.inRawBlock,te.push(De);continue}if(De=this.tokenizer.link(Z)){Z=Z.substring(De.raw.length),De.type==="link"&&(De.tokens=this.inlineTokens(De.text,[],!0,ne)),te.push(De);continue}if(De=this.tokenizer.reflink(Z,this.tokens.links)){Z=Z.substring(De.raw.length),De.type==="link"&&(De.tokens=this.inlineTokens(De.text,[],!0,ne)),te.push(De);continue}if(De=this.tokenizer.strong(Z,Ye,Ae)){Z=Z.substring(De.raw.length),De.tokens=this.inlineTokens(De.text,[],ae,ne),te.push(De);continue}if(De=this.tokenizer.em(Z,Ye,Ae)){Z=Z.substring(De.raw.length),De.tokens=this.inlineTokens(De.text,[],ae,ne),te.push(De);continue}if(De=this.tokenizer.codespan(Z)){Z=Z.substring(De.raw.length),te.push(De);continue}if(De=this.tokenizer.br(Z)){Z=Z.substring(De.raw.length),te.push(De);continue}if(De=this.tokenizer.del(Z)){Z=Z.substring(De.raw.length),De.tokens=this.inlineTokens(De.text,[],ae,ne),te.push(De);continue}if(De=this.tokenizer.autolink(Z,he)){Z=Z.substring(De.raw.length),te.push(De);continue}if(!ae&&(De=this.tokenizer.url(Z,he))){Z=Z.substring(De.raw.length),te.push(De);continue}if(De=this.tokenizer.inlineText(Z,ne,Re)){Z=Z.substring(De.raw.length),Ae=De.raw.slice(-1),te.push(De);continue}if(Z){var $e="Infinite loop on byte: "+Z.charCodeAt(0);if(this.options.silent){console.error($e);break}else throw new Error($e)}}return te},G(me,null,[{key:"rules",get:function(){return{block:re,inline:Te}}}]),me}(),Be=F.defaults,Ne=j.cleanUrl,Ie=j.escape,de=function(){function me(pe){this.options=pe||Be}var ve=me.prototype;return ve.code=function(Z,te,ae){var ne=(te||"").match(/\S*/)[0];if(this.options.highlight){var Ae=this.options.highlight(Z,ne);Ae!=null&&Ae!==Z&&(ae=!0,Z=Ae)}return ne?''+(ae?Z:Ie(Z,!0))+`
`:""+(ae?Z:Ie(Z,!0))+`
`},ve.blockquote=function(Z){return`
`+Z+`
`},ve.html=function(Z){return Z},ve.heading=function(Z,te,ae,ne){return this.options.headerIds?"
`:""+Z+"
`},ve.hr=function(){return this.options.xhtml?`
`:`
`},ve.list=function(Z,te,ae){var ne=te?"ol":"ul",Ae=te&&ae!==1?' start="'+ae+'"':"";return"<"+ne+Ae+`>
`+Z+""+ne+`>
`},ve.listitem=function(Z){return""+Z+`
`},ve.checkbox=function(Z){return" "},ve.paragraph=function(Z){return""+Z+`
`},ve.table=function(Z,te){return te&&(te=""+te+""),`
`},ve.tablerow=function(Z){return`
`+Z+`
`},ve.tablecell=function(Z,te){var ae=te.header?"th":"td",ne=te.align?"<"+ae+' align="'+te.align+'">':"<"+ae+">";return ne+Z+""+ae+`>
`},ve.strong=function(Z){return""+Z+""},ve.em=function(Z){return""+Z+""},ve.codespan=function(Z){return""+Z+""},ve.br=function(){return this.options.xhtml?"
":"
"},ve.del=function(Z){return""+Z+""},ve.link=function(Z,te,ae){if(Z=Ne(this.options.sanitize,this.options.baseUrl,Z),Z===null)return ae;var ne='"+ae+"",ne},ve.image=function(Z,te,ae){if(Z=Ne(this.options.sanitize,this.options.baseUrl,Z),Z===null)return ae;var ne='
":">",ne},ve.text=function(Z){return Z},me}(),ye=function(){function me(){}var ve=me.prototype;return ve.strong=function(Z){return Z},ve.em=function(Z){return Z},ve.codespan=function(Z){return Z},ve.del=function(Z){return Z},ve.html=function(Z){return Z},ve.text=function(Z){return Z},ve.link=function(Z,te,ae){return""+ae},ve.image=function(Z,te,ae){return""+ae},ve.br=function(){return""},me}(),we=function(){function me(){this.seen={}}var ve=me.prototype;return ve.slug=function(Z){var te=Z.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(te)){var ae=te;do this.seen[ae]++,te=ae+"-"+this.seen[ae];while(this.seen.hasOwnProperty(te))}return this.seen[te]=0,te},me}(),Oe=F.defaults,ke=j.unescape,je=function(){function me(pe){this.options=pe||Oe,this.options.renderer=this.options.renderer||new de,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ye,this.slugger=new we}me.parse=function(Z,te){var ae=new me(te);return ae.parse(Z)};var ve=me.prototype;return ve.parse=function(Z,te){te===void 0&&(te=!0);var ae="",ne,Ae,De,Ye,mt,lt,$e,Je,ze,He,qe,st,gt,yt,bt,vt,Ct,pt,Ot=Z.length;for(ne=0;ne0&&bt.tokens[0].type==="text"?(bt.tokens[0].text=pt+" "+bt.tokens[0].text,bt.tokens[0].tokens&&bt.tokens[0].tokens.length>0&&bt.tokens[0].tokens[0].type==="text"&&(bt.tokens[0].tokens[0].text=pt+" "+bt.tokens[0].tokens[0].text)):bt.tokens.unshift({type:"text",text:pt}):yt+=pt),yt+=this.parse(bt.tokens,gt),ze+=this.renderer.listitem(yt,Ct,vt);ae+=this.renderer.list(ze,qe,st);continue}case"html":{ae+=this.renderer.html(He.text);continue}case"paragraph":{ae+=this.renderer.paragraph(this.parseInline(He.tokens));continue}case"text":{for(ze=He.tokens?this.parseInline(He.tokens):He.text;ne+1An error occurred:
"+et(De.message+"",!0)+"
";throw De}}We.options=We.setOptions=function(me){return it(We.defaults,me),dt(We.defaults),We},We.getDefaults=Ke,We.defaults=ft,We.use=function(me){var ve=it({},me);if(me.renderer&&function(){var Z=We.defaults.renderer||new de,te=function(Ae){var De=Z[Ae];Z[Ae]=function(){for(var Ye=arguments.length,mt=new Array(Ye),lt=0;lt ").concat(A);if(Q.ENABLE_CALLBACK&&Q.emitter.emit("log","error",L),!Q.ENABLE_ERROR)return;console.error?console.error(L):console.warn?console.warn(L):console.log(L)}},{key:"i",value:function(m,A){(!m||Q.FORCE_GLOBAL_TAG)&&(m=Q.GLOBAL_TAG);var L="[".concat(m,"] > ").concat(A);if(Q.ENABLE_CALLBACK&&Q.emitter.emit("log","info",L),!Q.ENABLE_INFO)return;console.info?console.info(L):console.log(L)}},{key:"w",value:function(m,A){(!m||Q.FORCE_GLOBAL_TAG)&&(m=Q.GLOBAL_TAG);var L="[".concat(m,"] > ").concat(A);if(Q.ENABLE_CALLBACK&&Q.emitter.emit("log","warn",L),!Q.ENABLE_WARN)return;console.warn?console.warn(L):console.log(L)}},{key:"d",value:function(m,A){(!m||Q.FORCE_GLOBAL_TAG)&&(m=Q.GLOBAL_TAG);var L="[".concat(m,"] > ").concat(A);if(Q.ENABLE_CALLBACK&&Q.emitter.emit("log","debug",L),!Q.ENABLE_DEBUG)return;console.debug?console.debug(L):console.log(L)}},{key:"v",value:function(m,A){(!m||Q.FORCE_GLOBAL_TAG)&&(m=Q.GLOBAL_TAG);var L="[".concat(m,"] > ").concat(A);if(Q.ENABLE_CALLBACK&&Q.emitter.emit("log","verbose",L),!Q.ENABLE_VERBOSE)return;console.log(L)}}]),Q}();F.GLOBAL_TAG="flv.js",F.FORCE_GLOBAL_TAG=!1,F.ENABLE_ERROR=!0,F.ENABLE_INFO=!0,F.ENABLE_WARN=!0,F.ENABLE_DEBUG=!0,F.ENABLE_VERBOSE=!0,F.ENABLE_CALLBACK=!1,F.emitter=new v.a;var U=F,N=function(){function Q(){Object(ge.a)(this,Q),this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now}return Object(G.a)(Q,[{key:"reset",value:function(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0}},{key:"addBytes",value:function(m){this._firstCheckpoint===0?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=m,this._totalBytes+=m):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=m,this._totalBytes+=m):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=m,this._totalBytes+=m,this._lastCheckpoint=this._now())}},{key:"currentKBps",get:function(){this.addBytes(0);var m=(this._now()-this._lastCheckpoint)/1e3;return m==0&&(m=1),this._intervalBytes/m/1024}},{key:"lastSecondKBps",get:function(){return this.addBytes(0),this._lastSecondBytes!==0?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0}},{key:"averageKBps",get:function(){var m=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/m/1024}}]),Q}(),R=N,b=ee("yKVA"),T=ee("879j"),C=function(){function Q(K){Object(ge.a)(this,Q),this._message=K}return Object(G.a)(Q,[{key:"name",get:function(){return"RuntimeException"}},{key:"message",get:function(){return this._message}},{key:"toString",value:function(){return this.name+": "+this.message}}]),Q}(),x=function(Q){Object(b.a)(m,Q);var K=Object(T.a)(m);function m(A){return Object(ge.a)(this,m),K.call(this,A)}return Object(G.a)(m,[{key:"name",get:function(){return"IllegalStateException"}}]),m}(C),S=function(Q){Object(b.a)(m,Q);var K=Object(T.a)(m);function m(A){return Object(ge.a)(this,m),K.call(this,A)}return Object(G.a)(m,[{key:"name",get:function(){return"InvalidArgumentException"}}]),m}(C),E=function(Q){Object(b.a)(m,Q);var K=Object(T.a)(m);function m(A){return Object(ge.a)(this,m),K.call(this,A)}return Object(G.a)(m,[{key:"name",get:function(){return"NotImplementedException"}}]),m}(C),u={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},t={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"},n=function(){function Q(K){Object(ge.a)(this,Q),this._type=K||"undefined",this._status=u.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}return Object(G.a)(Q,[{key:"destroy",value:function(){this._status=u.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}},{key:"isWorking",value:function(){return this._status===u.kConnecting||this._status===u.kBuffering}},{key:"type",get:function(){return this._type}},{key:"status",get:function(){return this._status}},{key:"needStashBuffer",get:function(){return this._needStash}},{key:"onContentLengthKnown",get:function(){return this._onContentLengthKnown},set:function(m){this._onContentLengthKnown=m}},{key:"onURLRedirect",get:function(){return this._onURLRedirect},set:function(m){this._onURLRedirect=m}},{key:"onDataArrival",get:function(){return this._onDataArrival},set:function(m){this._onDataArrival=m}},{key:"onError",get:function(){return this._onError},set:function(m){this._onError=m}},{key:"onComplete",get:function(){return this._onComplete},set:function(m){this._onComplete=m}},{key:"open",value:function(m,A){throw new E("Unimplemented abstract function!")}},{key:"abort",value:function(){throw new E("Unimplemented abstract function!")}}]),Q}(),s=ee("oZsa");function h(Q,K){for(;!Object.prototype.hasOwnProperty.call(Q,K)&&!(Q=Object(s.a)(Q),Q===null););return Q}function l(Q,K,m){return typeof Reflect!="undefined"&&Reflect.get?l=Reflect.get:l=function(L,B,Y){var ce=h(L,B);if(!ce)return;var be=Object.getOwnPropertyDescriptor(ce,B);return be.get?be.get.call(Y):be.value},l(Q,K,m||Q)}var c={};function y(){var Q=self.navigator.userAgent.toLowerCase(),K=/(edge)\/([\w.]+)/.exec(Q)||/(opr)[\/]([\w.]+)/.exec(Q)||/(chrome)[ \/]([\w.]+)/.exec(Q)||/(iemobile)[\/]([\w.]+)/.exec(Q)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(Q)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(Q)||/(webkit)[ \/]([\w.]+)/.exec(Q)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(Q)||/(msie) ([\w.]+)/.exec(Q)||Q.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(Q)||Q.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(Q)||[],m=/(ipad)/.exec(Q)||/(ipod)/.exec(Q)||/(windows phone)/.exec(Q)||/(iphone)/.exec(Q)||/(kindle)/.exec(Q)||/(android)/.exec(Q)||/(windows)/.exec(Q)||/(mac)/.exec(Q)||/(linux)/.exec(Q)||/(cros)/.exec(Q)||[],A={browser:K[5]||K[3]||K[1]||"",version:K[2]||K[4]||"0",majorVersion:K[4]||K[2]||"0",platform:m[0]||""},L={};if(A.browser){L[A.browser]=!0;var B=A.majorVersion.split(".");L.version={major:parseInt(A.majorVersion,10),string:A.version},B.length>1&&(L.version.minor=parseInt(B[1],10)),B.length>2&&(L.version.build=parseInt(B[2],10))}if(A.platform&&(L[A.platform]=!0),(L.chrome||L.opr||L.safari)&&(L.webkit=!0),L.rv||L.iemobile){L.rv&&delete L.rv;var Y="msie";A.browser=Y,L[Y]=!0}if(L.edge){delete L.edge;var ce="msedge";A.browser=ce,L[ce]=!0}if(L.opr){var be="opera";A.browser=be,L[be]=!0}if(L.safari&&L.android){var Me="android";A.browser=Me,L[Me]=!0}L.name=A.browser,L.platform=A.platform;for(var Ve in c)c.hasOwnProperty(Ve)&&delete c[Ve];Object.assign(c,L)}y();var f=c,d=function(Q){Object(b.a)(m,Q);var K=Object(T.a)(m);function m(A,L){var B;return Object(ge.a)(this,m),B=K.call(this,"fetch-stream-loader"),B.TAG="FetchStreamLoader",B._seekHandler=A,B._config=L,B._needStash=!0,B._requestAbort=!1,B._contentLength=null,B._receivedLength=0,B}return Object(G.a)(m,[{key:"destroy",value:function(){this.isWorking()&&this.abort(),l(Object(s.a)(m.prototype),"destroy",this).call(this)}},{key:"open",value:function(L,B){var Y=this;this._dataSource=L,this._range=B;var ce=L.url;this._config.reuseRedirectedURL&&L.redirectedURL!=null&&(ce=L.redirectedURL);var be=this._seekHandler.getConfig(ce,B),Me=new self.Headers;if(typeof be.headers=="object"){var Ve=be.headers;for(var Ge in Ve)Ve.hasOwnProperty(Ge)&&Me.append(Ge,Ve[Ge])}var rt={method:"GET",headers:Me,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if(typeof this._config.headers=="object")for(var Qe in this._config.headers)Me.append(Qe,this._config.headers[Qe]);L.cors===!1&&(rt.mode="same-origin"),L.withCredentials&&(rt.credentials="include"),L.referrerPolicy&&(rt.referrerPolicy=L.referrerPolicy),this._status=u.kConnecting,self.fetch(be.url,rt).then(function(Pe){if(Y._requestAbort){Y._requestAbort=!1,Y._status=u.kIdle;return}if(Pe.ok&&Pe.status>=200&&Pe.status<=299){if(Pe.url!==be.url&&Y._onURLRedirect){var tt=Y._seekHandler.removeURLParameters(Pe.url);Y._onURLRedirect(tt)}var nt=Pe.headers.get("Content-Length");return nt!=null&&(Y._contentLength=parseInt(nt),Y._contentLength!==0&&(Y._onContentLengthKnown&&Y._onContentLengthKnown(Y._contentLength))),Y._pump.call(Y,Pe.body.getReader())}else if(Y._status=u.kError,Y._onError)Y._onError(t.HTTP_STATUS_CODE_INVALID,{code:Pe.status,msg:Pe.statusText});else throw new C("FetchStreamLoader: Http code invalid, "+Pe.status+" "+Pe.statusText)}).catch(function(Pe){if(Y._status=u.kError,Y._onError)Y._onError(t.EXCEPTION,{code:-1,msg:Pe.message});else throw Pe})}},{key:"abort",value:function(){this._requestAbort=!0}},{key:"_pump",value:function(L){var B=this;return L.read().then(function(Y){if(Y.done)if(B._contentLength!==null&&B._receivedLength=15048,B=f.msedge?L:!0;return self.fetch&&self.ReadableStream&&B}catch(Y){return!1}}}]),m}(n),o=d,r=function(Q){Object(b.a)(m,Q);var K=Object(T.a)(m);function m(A,L){var B;return Object(ge.a)(this,m),B=K.call(this,"xhr-moz-chunked-loader"),B.TAG="MozChunkedLoader",B._seekHandler=A,B._config=L,B._needStash=!0,B._xhr=null,B._requestAbort=!1,B._contentLength=null,B._receivedLength=0,B}return Object(G.a)(m,[{key:"destroy",value:function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onloadend=null,this._xhr.onerror=null,this._xhr=null),l(Object(s.a)(m.prototype),"destroy",this).call(this)}},{key:"open",value:function(L,B){this._dataSource=L,this._range=B;var Y=L.url;this._config.reuseRedirectedURL&&L.redirectedURL!=null&&(Y=L.redirectedURL);var ce=this._seekHandler.getConfig(Y,B);this._requestURL=ce.url;var be=this._xhr=new XMLHttpRequest;if(be.open("GET",ce.url,!0),be.responseType="moz-chunked-arraybuffer",be.onreadystatechange=this._onReadyStateChange.bind(this),be.onprogress=this._onProgress.bind(this),be.onloadend=this._onLoadEnd.bind(this),be.onerror=this._onXhrError.bind(this),L.withCredentials&&(be.withCredentials=!0),typeof ce.headers=="object"){var Me=ce.headers;for(var Ve in Me)Me.hasOwnProperty(Ve)&&be.setRequestHeader(Ve,Me[Ve])}if(typeof this._config.headers=="object"){var Ge=this._config.headers;for(var rt in Ge)Ge.hasOwnProperty(rt)&&be.setRequestHeader(rt,Ge[rt])}this._status=u.kConnecting,be.send()}},{key:"abort",value:function(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=u.kComplete}},{key:"_onReadyStateChange",value:function(L){var B=L.target;if(B.readyState===2){if(B.responseURL!=null&&B.responseURL!==this._requestURL&&this._onURLRedirect){var Y=this._seekHandler.removeURLParameters(B.responseURL);this._onURLRedirect(Y)}if(B.status!==0&&(B.status<200||B.status>299))if(this._status=u.kError,this._onError)this._onError(t.HTTP_STATUS_CODE_INVALID,{code:B.status,msg:B.statusText});else throw new C("MozChunkedLoader: Http code invalid, "+B.status+" "+B.statusText);else this._status=u.kBuffering}}},{key:"_onProgress",value:function(L){if(this._status===u.kError)return;this._contentLength===null&&(L.total!==null&&L.total!==0&&(this._contentLength=L.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)));var B=L.target.response,Y=this._range.from+this._receivedLength;this._receivedLength+=B.byteLength,this._onDataArrival&&this._onDataArrival(B,Y,this._receivedLength)}},{key:"_onLoadEnd",value:function(L){if(this._requestAbort===!0){this._requestAbort=!1;return}else if(this._status===u.kError)return;this._status=u.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)}},{key:"_onXhrError",value:function(L){this._status=u.kError;var B=0,Y=null;if(this._contentLength&&L.loaded=200&&B.status<=299){if(this._status=u.kBuffering,B.responseURL!=null){var Y=this._seekHandler.removeURLParameters(B.responseURL);B.responseURL!==this._currentRequestURL&&Y!==this._currentRedirectedURL&&(this._currentRedirectedURL=Y,this._onURLRedirect&&this._onURLRedirect(Y))}var ce=B.getResponseHeader("Content-Length");if(ce!=null&&this._contentLength==null){var be=parseInt(ce);be>0&&(this._contentLength=be,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength))}}else if(this._status=u.kError,this._onError)this._onError(t.HTTP_STATUS_CODE_INVALID,{code:B.status,msg:B.statusText});else throw new C("MSStreamLoader: Http code invalid, "+B.status+" "+B.statusText);else if(B.readyState===3&&(B.status>=200&&B.status<=299)){this._status=u.kBuffering;var Me=B.response;this._reader.readAsArrayBuffer(Me)}}},{key:"_xhrOnError",value:function(L){this._status=u.kError;var B=t.EXCEPTION,Y={code:-1,msg:L.constructor.name+" "+L.type};if(this._onError)this._onError(B,Y);else throw new C(Y.msg)}},{key:"_msrOnProgress",value:function(L){var B=L.target,Y=B.result;if(Y==null){this._doReconnectIfNeeded();return}var ce=Y.slice(this._lastTimeBufferSize);this._lastTimeBufferSize=Y.byteLength;var be=this._totalRange.from+this._receivedLength;this._receivedLength+=ce.byteLength,this._onDataArrival&&this._onDataArrival(ce,be,this._receivedLength),Y.byteLength>=this._bufferLimit&&(U.v(this.TAG,"MSStream buffer exceeded max size near ".concat(be+ce.byteLength,", reconnecting...")),this._doReconnectIfNeeded())}},{key:"_doReconnectIfNeeded",value:function(){if(this._contentLength==null||this._receivedLength=this._contentLength&&(Y=this._range.from+this._contentLength-1)),this._currentRequestRange={from:B,to:Y},this._internalOpen(this._dataSource,this._currentRequestRange)}},{key:"_internalOpen",value:function(L,B){this._lastTimeLoaded=0;var Y=L.url;this._config.reuseRedirectedURL&&(this._currentRedirectedURL!=null?Y=this._currentRedirectedURL:L.redirectedURL!=null&&(Y=L.redirectedURL));var ce=this._seekHandler.getConfig(Y,B);this._currentRequestURL=ce.url;var be=this._xhr=new XMLHttpRequest;if(be.open("GET",ce.url,!0),be.responseType="arraybuffer",be.onreadystatechange=this._onReadyStateChange.bind(this),be.onprogress=this._onProgress.bind(this),be.onload=this._onLoad.bind(this),be.onerror=this._onXhrError.bind(this),L.withCredentials&&(be.withCredentials=!0),typeof ce.headers=="object"){var Me=ce.headers;for(var Ve in Me)Me.hasOwnProperty(Ve)&&be.setRequestHeader(Ve,Me[Ve])}if(typeof this._config.headers=="object"){var Ge=this._config.headers;for(var rt in Ge)Ge.hasOwnProperty(rt)&&be.setRequestHeader(rt,Ge[rt])}be.send()}},{key:"abort",value:function(){this._requestAbort=!0,this._internalAbort(),this._status=u.kComplete}},{key:"_internalAbort",value:function(){this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr.abort(),this._xhr=null)}},{key:"_onReadyStateChange",value:function(L){var B=L.target;if(B.readyState===2){if(B.responseURL!=null){var Y=this._seekHandler.removeURLParameters(B.responseURL);B.responseURL!==this._currentRequestURL&&Y!==this._currentRedirectedURL&&(this._currentRedirectedURL=Y,this._onURLRedirect&&this._onURLRedirect(Y))}if(B.status>=200&&B.status<=299){if(this._waitForTotalLength)return;this._status=u.kBuffering}else if(this._status=u.kError,this._onError)this._onError(t.HTTP_STATUS_CODE_INVALID,{code:B.status,msg:B.statusText});else throw new C("RangeLoader: Http code invalid, "+B.status+" "+B.statusText)}}},{key:"_onProgress",value:function(L){if(this._status===u.kError)return;if(this._contentLength===null){var B=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,B=!0;var Y=L.total;this._internalAbort(),Y!=null&Y!==0&&(this._totalLength=Y)}if(this._range.to===-1?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,B){this._openSubRange();return}this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}var ce=L.loaded-this._lastTimeLoaded;this._lastTimeLoaded=L.loaded,this._speedSampler.addBytes(ce)}},{key:"_normalizeSpeed",value:function(L){var B=this._chunkSizeKBList,Y=B.length-1,ce=0,be=0,Me=Y;if(L=B[ce]&&L=3&&(B=this._speedSampler.currentKBps)),B!==0){var Y=this._normalizeSpeed(B);this._currentSpeedNormalized!==Y&&(this._currentSpeedNormalized=Y,this._currentChunkSizeKB=Y)}var ce=L.target.response,be=this._range.from+this._receivedLength;this._receivedLength+=ce.byteLength;var Me=!1;this._contentLength!=null&&this._receivedLength0&&this._receivedLength0)for(var ce=L.split("&"),be=0;be0;Me[0]!==this._startName&&Me[0]!==this._endName&&(Ve&&(Y+="&"),Y+=ce[be])}return Y.length===0?A:A+"?"+Y}}]),Q}(),X=$,q=function(){function Q(K,m,A){Object(ge.a)(this,Q),this.TAG="IOController",this._config=m,this._extraData=A,this._stashInitialSize=1024*384,m.stashInitialSize!=null&&m.stashInitialSize>0&&(this._stashInitialSize=m.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=1024*1024*3,this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,this._enableStash=!0,m.enableStashBuffer===!1&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=K,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(K.url),this._refTotalLength=K.filesize?K.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new R,this._speedNormalizeList=[64,128,256,384,512,768,1024,1536,2048,3072,4096],this._isEarlyEofReconnecting=!1,this._paused=!1,this._resumeFrom=0,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._selectSeekHandler(),this._selectLoader(),this._createLoader()}return Object(G.a)(Q,[{key:"destroy",value:function(){this._loader.isWorking()&&this._loader.abort(),this._loader.destroy(),this._loader=null,this._loaderClass=null,this._dataSource=null,this._stashBuffer=null,this._stashUsed=this._stashSize=this._bufferSize=this._stashByteStart=0,this._currentRange=null,this._speedSampler=null,this._isEarlyEofReconnecting=!1,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._extraData=null}},{key:"isWorking",value:function(){return this._loader&&this._loader.isWorking()&&!this._paused}},{key:"isPaused",value:function(){return this._paused}},{key:"status",get:function(){return this._loader.status}},{key:"extraData",get:function(){return this._extraData},set:function(m){this._extraData=m}},{key:"onDataArrival",get:function(){return this._onDataArrival},set:function(m){this._onDataArrival=m}},{key:"onSeeked",get:function(){return this._onSeeked},set:function(m){this._onSeeked=m}},{key:"onError",get:function(){return this._onError},set:function(m){this._onError=m}},{key:"onComplete",get:function(){return this._onComplete},set:function(m){this._onComplete=m}},{key:"onRedirect",get:function(){return this._onRedirect},set:function(m){this._onRedirect=m}},{key:"onRecoveredEarlyEof",get:function(){return this._onRecoveredEarlyEof},set:function(m){this._onRecoveredEarlyEof=m}},{key:"currentURL",get:function(){return this._dataSource.url}},{key:"hasRedirect",get:function(){return this._redirectedURL!=null||this._dataSource.redirectedURL!=null}},{key:"currentRedirectedURL",get:function(){return this._redirectedURL||this._dataSource.redirectedURL}},{key:"currentSpeed",get:function(){return this._loaderClass===D?this._loader.currentSpeed:this._speedSampler.lastSecondKBps}},{key:"loaderType",get:function(){return this._loader.type}},{key:"_selectSeekHandler",value:function(){var m=this._config;if(m.seekType==="range")this._seekHandler=new V(this._config.rangeLoadZeroStart);else if(m.seekType==="param"){var A=m.seekParamStart||"bstart",L=m.seekParamEnd||"bend";this._seekHandler=new X(A,L)}else if(m.seekType==="custom"){if(typeof m.customSeekHandler!="function")throw new S("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new m.customSeekHandler}else throw new S("Invalid seekType in config: ".concat(m.seekType))}},{key:"_selectLoader",value:function(){if(this._config.customLoader!=null)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=H;else if(o.isSupported())this._loaderClass=o;else if(i.isSupported())this._loaderClass=i;else if(D.isSupported())this._loaderClass=D;else throw new C("Your browser doesn't support xhr with arraybuffer responseType!")}},{key:"_createLoader",value:function(){this._loader=new this._loaderClass(this._seekHandler,this._config),this._loader.needStashBuffer===!1&&(this._enableStash=!1),this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this),this._loader.onURLRedirect=this._onURLRedirect.bind(this),this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this),this._loader.onComplete=this._onLoaderComplete.bind(this),this._loader.onError=this._onLoaderError.bind(this)}},{key:"open",value:function(m){this._currentRange={from:0,to:-1},m&&(this._currentRange.from=m),this._speedSampler.reset(),m||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))}},{key:"abort",value:function(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)}},{key:"pause",value:function(){this.isWorking()&&(this._loader.abort(),this._stashUsed!==0?(this._resumeFrom=this._stashByteStart,this._currentRange.to=this._stashByteStart-1):this._resumeFrom=this._currentRange.to+1,this._stashUsed=0,this._stashByteStart=0,this._paused=!0)}},{key:"resume",value:function(){if(this._paused){this._paused=!1;var m=this._resumeFrom;this._resumeFrom=0,this._internalSeek(m,!0)}}},{key:"seek",value:function(m){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(m,!0)}},{key:"_internalSeek",value:function(m,A){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(A),this._loader.destroy(),this._loader=null;var L={from:m,to:-1};this._currentRange={from:L.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,L),this._onSeeked&&this._onSeeked()}},{key:"updateUrl",value:function(m){if(!m||typeof m!="string"||m.length===0)throw new S("Url must be a non-empty string!");this._dataSource.url=m}},{key:"_expandBuffer",value:function(m){for(var A=this._stashSize;A+1024*1024*10){var B=new Uint8Array(this._stashBuffer,0,this._stashUsed),Y=new Uint8Array(L,0,A);Y.set(B,0)}this._stashBuffer=L,this._bufferSize=A}},{key:"_normalizeSpeed",value:function(m){var A=this._speedNormalizeList,L=A.length-1,B=0,Y=0,ce=L;if(m=A[B]&&m=512&&m<=1024?A=Math.floor(m*1.5):A=m*2,A>8192&&(A=8192);var L=A*1024+1024*1024*1;this._bufferSize0){var tt=this._stashBuffer.slice(0,this._stashUsed),nt=this._dispatchChunks(tt,this._stashByteStart);if(nt0){var O=new Uint8Array(tt,nt);Pe.set(O,0),this._stashUsed=O.byteLength,this._stashByteStart+=nt}}else this._stashUsed=0,this._stashByteStart+=nt;this._stashUsed+m.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+m.byteLength),Pe=new Uint8Array(this._stashBuffer,0,this._bufferSize)),Pe.set(new Uint8Array(m),this._stashUsed),this._stashUsed+=m.byteLength}else{var e=this._dispatchChunks(m,A);if(ethis._bufferSize&&(this._expandBuffer(a),Pe=new Uint8Array(this._stashBuffer,0,this._bufferSize)),Pe.set(new Uint8Array(m,e),0),this._stashUsed+=a,this._stashByteStart=A+e}}}else if(this._stashUsed===0){var ce=this._dispatchChunks(m,A);if(cethis._bufferSize&&this._expandBuffer(be);var Me=new Uint8Array(this._stashBuffer,0,this._bufferSize);Me.set(new Uint8Array(m,ce),0),this._stashUsed+=be,this._stashByteStart=A+ce}}else{this._stashUsed+m.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+m.byteLength);var Ve=new Uint8Array(this._stashBuffer,0,this._bufferSize);Ve.set(new Uint8Array(m),this._stashUsed),this._stashUsed+=m.byteLength;var Ge=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart);if(Ge0){var rt=new Uint8Array(this._stashBuffer,Ge);Ve.set(rt,0)}this._stashUsed-=Ge,this._stashByteStart+=Ge}}},{key:"_flushStashBuffer",value:function(m){if(this._stashUsed>0){var A=this._stashBuffer.slice(0,this._stashUsed),L=this._dispatchChunks(A,this._stashByteStart),B=A.byteLength-L;if(L0){var Y=new Uint8Array(this._stashBuffer,0,this._bufferSize),ce=new Uint8Array(A,L);Y.set(ce,0),this._stashUsed=ce.byteLength,this._stashByteStart+=L}return 0}return this._stashUsed=0,this._stashByteStart=0,B}return 0}},{key:"_onLoaderComplete",value:function(m,A){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)}},{key:"_onLoaderError",value:function(m,A){U.e(this.TAG,"Loader error, code = ".concat(A.code,", msg = ").concat(A.msg)),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,m=t.UNRECOVERABLE_EARLY_EOF);switch(m){case t.EARLY_EOF:{if(!this._config.isLive&&this._totalLength){var L=this._currentRange.to+1;L0){var A=Q.getConfig();m.emit("change",A)}}},{key:"registerListener",value:function(m){Q.emitter.addListener("change",m)}},{key:"removeListener",value:function(m){Q.emitter.removeListener("change",m)}},{key:"addLogListener",value:function(m){U.emitter.addListener("log",m),U.emitter.listenerCount("log")>0&&(U.ENABLE_CALLBACK=!0,Q._notifyChange())}},{key:"removeLogListener",value:function(m){U.emitter.removeListener("log",m),U.emitter.listenerCount("log")===0&&(U.ENABLE_CALLBACK=!1,Q._notifyChange())}}]),Q}();fe.emitter=new v.a;var se=fe,J=function(){function Q(){Object(ge.a)(this,Q),this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}return Object(G.a)(Q,[{key:"isComplete",value:function(){var m=this.hasAudio===!1||this.hasAudio===!0&&this.audioCodec!=null&&this.audioSampleRate!=null&&this.audioChannelCount!=null,A=this.hasVideo===!1||this.hasVideo===!0&&this.videoCodec!=null&&this.width!=null&&this.height!=null&&this.fps!=null&&this.profile!=null&&this.level!=null&&this.refFrames!=null&&this.chromaFormat!=null&&this.sarNum!=null&&this.sarDen!=null;return this.mimeType!=null&&this.duration!=null&&this.metadata!=null&&this.hasKeyframesIndex!=null&&m&&A}},{key:"isSeekable",value:function(){return this.hasKeyframesIndex===!0}},{key:"getNearestKeyframe",value:function(m){if(this.keyframesIndex==null)return null;var A=this.keyframesIndex,L=this._search(A.times,m);return{index:L,milliseconds:A.times[L],fileposition:A.filepositions[L]}}},{key:"_search",value:function(m,A){var L=0,B=m.length-1,Y=0,ce=0,be=B;for(A=m[Y]&&A=128){K.push(String.fromCharCode(B&65535)),A+=2;continue}}}else if(m[A]<240){if(re(m,A,2)){var Y=(m[A]&15)<<12|(m[A+1]&63)<<6|m[A+2]&63;if(Y>=2048&&(Y&63488)!==55296){K.push(String.fromCharCode(Y&65535)),A+=3;continue}}}else if(m[A]<248&&re(m,A,3)){var ce=(m[A]&7)<<18|(m[A+1]&63)<<12|(m[A+2]&63)<<6|m[A+3]&63;if(ce>65536&&ce<1114112){ce-=65536,K.push(String.fromCharCode(ce>>>10|55296)),K.push(String.fromCharCode(ce&1023|56320)),A+=4;continue}}}K.push(String.fromCharCode(65533)),++A}return K.join("")}var Re=Te,he=function(){var Q=new ArrayBuffer(2);return new DataView(Q).setInt16(0,256,!0),new Int16Array(Q)[0]===256}(),Le=function(){function Q(){Object(ge.a)(this,Q)}return Object(G.a)(Q,null,[{key:"parseScriptData",value:function(m,A,L){var B={};try{var Y=Q.parseValue(m,A,L),ce=Q.parseValue(m,A+Y.size,L-Y.size);B[Y.data]=ce.data}catch(be){U.e("AMF",be.toString())}return B}},{key:"parseObject",value:function(m,A,L){if(L<3)throw new x("Data not enough when parse ScriptDataObject");var B=Q.parseString(m,A,L),Y=Q.parseValue(m,A+B.size,L-B.size),ce=Y.objectEnd;return{data:{name:B.data,value:Y.data},size:B.size+Y.size,objectEnd:ce}}},{key:"parseVariable",value:function(m,A,L){return Q.parseObject(m,A,L)}},{key:"parseString",value:function(m,A,L){if(L<2)throw new x("Data not enough when parse String");var B=new DataView(m,A,L),Y=B.getUint16(0,!he),ce;return Y>0?ce=Re(new Uint8Array(m,A+2,Y)):ce="",{data:ce,size:2+Y}}},{key:"parseLongString",value:function(m,A,L){if(L<4)throw new x("Data not enough when parse LongString");var B=new DataView(m,A,L),Y=B.getUint32(0,!he),ce;return Y>0?ce=Re(new Uint8Array(m,A+4,Y)):ce="",{data:ce,size:4+Y}}},{key:"parseDate",value:function(m,A,L){if(L<10)throw new x("Data size invalid when parse Date");var B=new DataView(m,A,L),Y=B.getFloat64(0,!he),ce=B.getInt16(8,!he);return Y+=ce*60*1e3,{data:new Date(Y),size:8+2}}},{key:"parseValue",value:function(m,A,L){if(L<1)throw new x("Data not enough when parse Value");var B=new DataView(m,A,L),Y=1,ce=B.getUint8(0),be,Me=!1;try{switch(ce){case 0:be=B.getFloat64(1,!he),Y+=8;break;case 1:{var Ve=B.getUint8(1);be=!!Ve,Y+=1;break}case 2:{var Ge=Q.parseString(m,A+1,L-1);be=Ge.data,Y+=Ge.size;break}case 3:{be={};var rt=0;for((B.getUint32(L-4,!he)&16777215)===9&&(rt=3);Y32)throw new S("ExpGolomb: readBits() bits exceeded max 32bits!");if(m<=this._current_word_bits_left){var A=this._current_word>>>32-m;return this._current_word<<=m,this._current_word_bits_left-=m,A}var L=this._current_word_bits_left?this._current_word:0;L=L>>>32-this._current_word_bits_left;var B=m-this._current_word_bits_left;this._fillCurrentWord();var Y=Math.min(B,this._current_word_bits_left),ce=this._current_word>>>32-Y;return this._current_word<<=Y,this._current_word_bits_left-=Y,L=L<>>m)!==0)return this._current_word<<=m,this._current_word_bits_left-=m,m;return this._fillCurrentWord(),m+this._skipLeadingZero()}},{key:"readUEG",value:function(){var m=this._skipLeadingZero();return this.readBits(m+1)-1}},{key:"readSEG",value:function(){var m=this.readUEG();return m&1?m+1>>>1:-1*(m>>>1)}}]),Q}(),Ie=Ne,de=function(){function Q(){Object(ge.a)(this,Q)}return Object(G.a)(Q,null,[{key:"_ebsp2rbsp",value:function(m){for(var A=m,L=A.byteLength,B=new Uint8Array(L),Y=0,ce=0;ce=2&&(A[ce]===3&&A[ce-1]===0&&A[ce-2]===0))continue;B[Y]=A[ce],Y++}return new Uint8Array(B.buffer,0,Y)}},{key:"parseSPS",value:function(m){var A=Q._ebsp2rbsp(m),L=new Ie(A);L.readByte();var B=L.readByte();L.readByte();var Y=L.readByte();L.readUEG();var ce=Q.getProfileString(B),be=Q.getLevelString(Y),Me=1,Ve=420,Ge=[0,420,422,444],rt=8;if((B===100||B===110||B===122||B===244||B===44||B===83||B===86||B===118||B===128||B===138||B===144)&&(Me=L.readUEG(),Me===3&&L.readBits(1),Me<=3&&(Ve=Ge[Me]),rt=L.readUEG()+8,L.readUEG(),L.readBits(1),L.readBool()))for(var Qe=Me!==3?8:12,Pe=0;Pe0&&Lt<16?(Fe=Yt[Lt-1],ct=Gt[Lt-1]):Lt===255&&(Fe=L.readByte()<<8|L.readByte(),ct=L.readByte()<<8|L.readByte())}if(L.readBool()&&L.readBool(),L.readBool()&&(L.readBits(4),L.readBool()&&L.readBits(24)),L.readBool()&&(L.readUEG(),L.readUEG()),L.readBool()){var kt=L.readBits(32),It=L.readBits(32);Tt=L.readBool(),Mt=It,Ut=kt*2,Et=Mt/Ut}}var Vt=1;(Fe!==1||ct!==1)&&(Vt=Fe/ct);var zt=0,Xt=0;if(Me===0)zt=1,Xt=2-W;else{var jt=Me===3?1:2,$t=Me===1?2:1;zt=jt,Xt=$t*(2-W)}var Kt=(a+1)*16,Wt=(2-W)*((P+1)*16);Kt-=(I+le)*zt,Wt-=(Ue+Xe)*Xt;var Ft=Math.ceil(Kt*Vt);return L.destroy(),L=null,{profile_string:ce,level_string:be,bit_depth:rt,ref_frames:e,chroma_format:Ve,chroma_format_string:Q.getChromaFormatString(Ve),frame_rate:{fixed:Tt,fps:Et,fps_den:Ut,fps_num:Mt},sar_ratio:{width:Fe,height:ct},codec_size:{width:Kt,height:Wt},present_size:{width:Ft,height:Wt}}}},{key:"_skipScalingList",value:function(m,A){for(var L=8,B=8,Y=0,ce=0;ce>>8&255|(Q&255)<<8}function je(Q){return(Q&4278190080)>>>24|(Q&16711680)>>>8|(Q&65280)<<8|(Q&255)<<24}function it(Q,K){return Q[K]<<24|Q[K+1]<<16|Q[K+2]<<8|Q[K+3]}var at=function(){function Q(K,m){Object(ge.a)(this,Q),this.TAG="FLVDemuxer",this._config=m,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._dataOffset=K.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=K.hasAudioTrack,this._hasVideo=K.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new ue,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=function(){var A=new ArrayBuffer(2);return new DataView(A).setInt16(0,256,!0),new Int16Array(A)[0]===256}()}return Object(G.a)(Q,[{key:"destroy",value:function(){this._mediaInfo=null,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._videoTrack=null,this._audioTrack=null,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null}},{key:"bindDataSource",value:function(m){return m.onDataArrival=this.parseChunks.bind(this),this}},{key:"onTrackMetadata",get:function(){return this._onTrackMetadata},set:function(m){this._onTrackMetadata=m}},{key:"onMediaInfo",get:function(){return this._onMediaInfo},set:function(m){this._onMediaInfo=m}},{key:"onMetaDataArrived",get:function(){return this._onMetaDataArrived},set:function(m){this._onMetaDataArrived=m}},{key:"onScriptDataArrived",get:function(){return this._onScriptDataArrived},set:function(m){this._onScriptDataArrived=m}},{key:"onError",get:function(){return this._onError},set:function(m){this._onError=m}},{key:"onDataAvailable",get:function(){return this._onDataAvailable},set:function(m){this._onDataAvailable=m}},{key:"timestampBase",get:function(){return this._timestampBase},set:function(m){this._timestampBase=m}},{key:"overridedDuration",get:function(){return this._duration},set:function(m){this._durationOverrided=!0,this._duration=m,this._mediaInfo.duration=m}},{key:"overridedHasAudio",set:function(m){this._hasAudioFlagOverrided=!0,this._hasAudio=m,this._mediaInfo.hasAudio=m}},{key:"overridedHasVideo",set:function(m){this._hasVideoFlagOverrided=!0,this._hasVideo=m,this._mediaInfo.hasVideo=m}},{key:"resetMediaInfo",value:function(){this._mediaInfo=new ue}},{key:"_isInitialMetadataDispatched",value:function(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!this._hasAudio&&this._hasVideo?this._videoInitialMetadataDispatched:!1}},{key:"parseChunks",value:function(m,A){if(!this._onError||!this._onMediaInfo||!this._onTrackMetadata||!this._onDataAvailable)throw new x("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var L=0,B=this._littleEndian;if(A===0)if(m.byteLength>13){var Y=Q.probe(m);L=Y.dataOffset}else return 0;if(this._firstParse){this._firstParse=!1,A+L!==this._dataOffset&&U.w(this.TAG,"First time parsing but chunk byteStart invalid!");var ce=new DataView(m,L),be=ce.getUint32(0,!B);be!==0&&U.w(this.TAG,"PrevTagSize0 !== 0 !!!"),L+=4}for(;Lm.byteLength)break;var Ve=Me.getUint8(0),Ge=Me.getUint32(0,!B)&16777215;if(L+11+Ge+4>m.byteLength)break;if(Ve!==8&&Ve!==9&&Ve!==18){U.w(this.TAG,"Unsupported tag type ".concat(Ve,", skipped")),L+=11+Ge+4;continue}var rt=Me.getUint8(4),Qe=Me.getUint8(5),Pe=Me.getUint8(6),tt=Me.getUint8(7),nt=Pe|Qe<<8|rt<<16|tt<<24,O=Me.getUint32(7,!B)&16777215;O!==0&&U.w(this.TAG,"Meet tag which has StreamID != 0!");var e=L+11;switch(Ve){case 8:this._parseAudioData(m,e,Ge,nt);break;case 9:this._parseVideoData(m,e,Ge,nt,A+L);break;case 18:this._parseScriptData(m,e,Ge);break}var a=Me.getUint32(11+Ge,!B);a!==11+Ge&&U.w(this.TAG,"Invalid PrevTagSize ".concat(a)),L+=11+Ge+4}return this._isInitialMetadataDispatched()&&(this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack)),L}},{key:"_parseScriptData",value:function(m,A,L){var B=Be.parseScriptData(m,A,L);if(B.hasOwnProperty("onMetaData")){if(B.onMetaData==null||typeof B.onMetaData!="object"){U.w(this.TAG,"Invalid onMetaData structure!");return}this._metadata&&U.w(this.TAG,"Found another onMetaData tag!"),this._metadata=B;var Y=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},Y)),typeof Y.hasAudio=="boolean"&&(this._hasAudioFlagOverrided===!1&&(this._hasAudio=Y.hasAudio,this._mediaInfo.hasAudio=this._hasAudio)),typeof Y.hasVideo=="boolean"&&(this._hasVideoFlagOverrided===!1&&(this._hasVideo=Y.hasVideo,this._mediaInfo.hasVideo=this._hasVideo)),typeof Y.audiodatarate=="number"&&(this._mediaInfo.audioDataRate=Y.audiodatarate),typeof Y.videodatarate=="number"&&(this._mediaInfo.videoDataRate=Y.videodatarate),typeof Y.width=="number"&&(this._mediaInfo.width=Y.width),typeof Y.height=="number"&&(this._mediaInfo.height=Y.height),typeof Y.duration=="number"){if(!this._durationOverrided){var ce=Math.floor(Y.duration*this._timescale);this._duration=ce,this._mediaInfo.duration=ce}}else this._mediaInfo.duration=0;if(typeof Y.framerate=="number"){var be=Math.floor(Y.framerate*1e3);if(be>0){var Me=be/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=Me,this._referenceFrameRate.fps_num=be,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=Me}}if(typeof Y.keyframes=="object"){this._mediaInfo.hasKeyframesIndex=!0;var Ve=Y.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(Ve),Y.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=Y,U.v(this.TAG,"Parsed onMetaData"),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(B).length>0&&(this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},B)))}},{key:"_parseKeyframesIndex",value:function(m){for(var A=[],L=[],B=1;B>>4;if(Me!==2&&Me!==10){this._onError(Oe.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+Me);return}var Ve=0,Ge=(be&12)>>>2;if(Ge>=0&&Ge<=4)Ve=this._flvSoundRateTable[Ge];else{this._onError(Oe.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+Ge);return}var rt=(be&2)>>>1,Qe=be&1,Pe=this._audioMetadata,tt=this._audioTrack;if(Pe||(this._hasAudio===!1&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),Pe=this._audioMetadata={},Pe.type="audio",Pe.id=tt.id,Pe.timescale=this._timescale,Pe.duration=this._duration,Pe.audioSampleRate=Ve,Pe.channelCount=Qe===0?1:2),Me===10){var nt=this._parseAACAudioData(m,A+1,L-1);if(nt==null)return;if(nt.packetType===0){Pe.config&&U.w(this.TAG,"Found another AudioSpecificConfig!");var O=nt.data;Pe.audioSampleRate=O.samplingRate,Pe.channelCount=O.channelCount,Pe.codec=O.codec,Pe.originalCodec=O.originalCodec,Pe.config=O.config,Pe.refSampleDuration=1024/Pe.audioSampleRate*Pe.timescale,U.v(this.TAG,"Parsed AudioSpecificConfig"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("audio",Pe);var e=this._mediaInfo;e.audioCodec=Pe.originalCodec,e.audioSampleRate=Pe.audioSampleRate,e.audioChannelCount=Pe.channelCount,e.hasVideo?e.videoCodec!=null&&(e.mimeType='video/x-flv; codecs="'+e.videoCodec+","+e.audioCodec+'"'):e.mimeType='video/x-flv; codecs="'+e.audioCodec+'"',e.isComplete()&&this._onMediaInfo(e)}else if(nt.packetType===1){var a=this._timestampBase+B,P={unit:nt.data,length:nt.data.byteLength,dts:a,pts:a};tt.samples.push(P),tt.length+=nt.data.length}else U.e(this.TAG,"Flv: Unsupported AAC data type ".concat(nt.packetType))}else if(Me===2){if(!Pe.codec){var W=this._parseMP3AudioData(m,A+1,L-1,!0);if(W==null)return;Pe.audioSampleRate=W.samplingRate,Pe.channelCount=W.channelCount,Pe.codec=W.codec,Pe.originalCodec=W.originalCodec,Pe.refSampleDuration=1152/Pe.audioSampleRate*Pe.timescale,U.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",Pe);var I=this._mediaInfo;I.audioCodec=Pe.codec,I.audioSampleRate=Pe.audioSampleRate,I.audioChannelCount=Pe.channelCount,I.audioDataRate=W.bitRate,I.hasVideo?I.videoCodec!=null&&(I.mimeType='video/x-flv; codecs="'+I.videoCodec+","+I.audioCodec+'"'):I.mimeType='video/x-flv; codecs="'+I.audioCodec+'"',I.isComplete()&&this._onMediaInfo(I)}var le=this._parseMP3AudioData(m,A+1,L-1,!1);if(le==null)return;var Ue=this._timestampBase+B,Xe={unit:le,length:le.byteLength,dts:Ue,pts:Ue};tt.samples.push(Xe),tt.length+=le.length}}},{key:"_parseAACAudioData",value:function(m,A,L){if(L<=1){U.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!");return}var B={},Y=new Uint8Array(m,A,L);return B.packetType=Y[0],Y[0]===0?B.data=this._parseAACAudioSpecificConfig(m,A+1,L-1):B.data=Y.subarray(1),B}},{key:"_parseAACAudioSpecificConfig",value:function(m,A,L){var B=new Uint8Array(m,A,L),Y=null,ce=0,be=0,Me=null,Ve=0,Ge=null;if(ce=be=B[0]>>>3,Ve=(B[0]&7)<<1|B[1]>>>7,Ve<0||Ve>=this._mpegSamplingRates.length){this._onError(Oe.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");return}var rt=this._mpegSamplingRates[Ve],Qe=(B[1]&120)>>>3;if(Qe<0||Qe>=8){this._onError(Oe.FORMAT_ERROR,"Flv: AAC invalid channel configuration");return}ce===5&&(Ge=(B[1]&7)<<1|B[2]>>>7,Me=(B[2]&124)>>>2);var Pe=self.navigator.userAgent.toLowerCase();return Pe.indexOf("firefox")!==-1?Ve>=6?(ce=5,Y=new Array(4),Ge=Ve-3):(ce=2,Y=new Array(2),Ge=Ve):Pe.indexOf("android")!==-1?(ce=2,Y=new Array(2),Ge=Ve):(ce=5,Ge=Ve,Y=new Array(4),Ve>=6?Ge=Ve-3:Qe===1&&(ce=2,Y=new Array(2),Ge=Ve)),Y[0]=ce<<3,Y[0]|=(Ve&15)>>>1,Y[1]=(Ve&15)<<7,Y[1]|=(Qe&15)<<3,ce===5&&(Y[1]|=(Ge&15)>>>1,Y[2]=(Ge&1)<<7,Y[2]|=2<<2,Y[3]=0),{config:Y,samplingRate:rt,channelCount:Qe,codec:"mp4a.40."+ce,originalCodec:"mp4a.40."+be}}},{key:"_parseMP3AudioData",value:function(m,A,L,B){if(L<4){U.w(this.TAG,"Flv: Invalid MP3 packet, header missing!");return}var Y=this._littleEndian,ce=new Uint8Array(m,A,L),be=null;if(B){if(ce[0]!==255)return;var Me=ce[1]>>>3&3,Ve=(ce[1]&6)>>1,Ge=(ce[2]&240)>>>4,rt=(ce[2]&12)>>>2,Qe=ce[3]>>>6&3,Pe=Qe!==3?2:1,tt=0,nt=0,O=34,e="mp3";switch(Me){case 0:tt=this._mpegAudioV25SampleRateTable[rt];break;case 2:tt=this._mpegAudioV20SampleRateTable[rt];break;case 3:tt=this._mpegAudioV10SampleRateTable[rt];break}switch(Ve){case 1:O=34,Ge>>4,Me=ce&15;if(Me!==7){this._onError(Oe.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: ".concat(Me));return}this._parseAVCVideoPacket(m,A+1,L-1,B,Y,be)}},{key:"_parseAVCVideoPacket",value:function(m,A,L,B,Y,ce){if(L<4){U.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");return}var be=this._littleEndian,Me=new DataView(m,A,L),Ve=Me.getUint8(0),Ge=Me.getUint32(0,!be)&16777215,rt=Ge<<8>>8;if(Ve===0)this._parseAVCDecoderConfigurationRecord(m,A+4,L-4);else if(Ve===1)this._parseAVCVideoData(m,A+4,L-4,B,Y,ce,rt);else if(!(Ve===2)){this._onError(Oe.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(Ve));return}}},{key:"_parseAVCDecoderConfigurationRecord",value:function(m,A,L){if(L<7){U.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");return}var B=this._videoMetadata,Y=this._videoTrack,ce=this._littleEndian,be=new DataView(m,A,L);B?typeof B.avcc!="undefined"&&U.w(this.TAG,"Found another AVCDecoderConfigurationRecord!"):(this._hasVideo===!1&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),B=this._videoMetadata={},B.type="video",B.id=Y.id,B.timescale=this._timescale,B.duration=this._duration);var Me=be.getUint8(0),Ve=be.getUint8(1),Ge=be.getUint8(2),rt=be.getUint8(3);if(Me!==1||Ve===0){this._onError(Oe.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord");return}if(this._naluLengthSize=(be.getUint8(4)&3)+1,this._naluLengthSize!==3&&this._naluLengthSize!==4){this._onError(Oe.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: ".concat(this._naluLengthSize-1));return}var Qe=be.getUint8(5)&31;if(Qe===0){this._onError(Oe.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS");return}else Qe>1&&U.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: SPS Count = ".concat(Qe));for(var Pe=6,tt=0;tt1&&U.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = ".concat(ht));Pe++;for(var Fe=0;Fe=L){U.w(this.TAG,"Malformed Nalu near timestamp ".concat(tt,", offset = ").concat(Qe,", dataSize = ").concat(L));break}var O=Ve.getUint32(Qe,!Me);if(Pe===3&&(O>>>=8),O>L-Pe){U.w(this.TAG,"Malformed Nalus near timestamp ".concat(tt,", NaluSize > DataSize!"));return}var e=Ve.getUint8(Qe+Pe)&31;e===5&&(nt=!0);var a=new Uint8Array(m,A+Qe,Pe+O),P={type:e,data:a};Ge.push(P),rt+=a.byteLength,Qe+=Pe+O}if(Ge.length){var W=this._videoTrack,I={units:Ge,length:rt,isKeyframe:nt,dts:tt,cts:be,pts:tt+be};nt&&(I.fileposition=Y),W.samples.push(I),W.length+=rt}}}],[{key:"probe",value:function(m){var A=new Uint8Array(m),L={match:!1};if(A[0]!==70||A[1]!==76||A[2]!==86||A[3]!==1)return L;var B=(A[4]&4)>>>2!==0,Y=(A[4]&1)!==0,ce=it(A,5);return ce<9?L:{match:!0,consumed:ce,dataOffset:ce,hasAudioTrack:B,hasVideoTrack:Y}}}]),Q}(),et=at,Ke=function(){function Q(){Object(ge.a)(this,Q)}return Object(G.a)(Q,null,[{key:"init",value:function(){Q.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[]};for(var m in Q.types)Q.types.hasOwnProperty(m)&&(Q.types[m]=[m.charCodeAt(0),m.charCodeAt(1),m.charCodeAt(2),m.charCodeAt(3)]);var A=Q.constants={};A.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),A.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),A.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),A.STSC=A.STCO=A.STTS,A.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),A.HDLR_VIDEO=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]),A.HDLR_AUDIO=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]),A.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),A.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),A.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}},{key:"box",value:function(m){for(var A=8,L=null,B=Array.prototype.slice.call(arguments,1),Y=B.length,ce=0;ce>>24&255,L[1]=A>>>16&255,L[2]=A>>>8&255,L[3]=A&255,L.set(m,4);for(var be=8,Me=0;Me>>24&255,m>>>16&255,m>>>8&255,m&255,A>>>24&255,A>>>16&255,A>>>8&255,A&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]))}},{key:"trak",value:function(m){return Q.box(Q.types.trak,Q.tkhd(m),Q.mdia(m))}},{key:"tkhd",value:function(m){var A=m.id,L=m.duration,B=m.presentWidth,Y=m.presentHeight;return Q.box(Q.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,A>>>24&255,A>>>16&255,A>>>8&255,A&255,0,0,0,0,L>>>24&255,L>>>16&255,L>>>8&255,L&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,B>>>8&255,B&255,0,0,Y>>>8&255,Y&255,0,0]))}},{key:"mdia",value:function(m){return Q.box(Q.types.mdia,Q.mdhd(m),Q.hdlr(m),Q.minf(m))}},{key:"mdhd",value:function(m){var A=m.timescale,L=m.duration;return Q.box(Q.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,A>>>24&255,A>>>16&255,A>>>8&255,A&255,L>>>24&255,L>>>16&255,L>>>8&255,L&255,85,196,0,0]))}},{key:"hdlr",value:function(m){var A=null;return m.type==="audio"?A=Q.constants.HDLR_AUDIO:A=Q.constants.HDLR_VIDEO,Q.box(Q.types.hdlr,A)}},{key:"minf",value:function(m){var A=null;return m.type==="audio"?A=Q.box(Q.types.smhd,Q.constants.SMHD):A=Q.box(Q.types.vmhd,Q.constants.VMHD),Q.box(Q.types.minf,A,Q.dinf(),Q.stbl(m))}},{key:"dinf",value:function(){var m=Q.box(Q.types.dinf,Q.box(Q.types.dref,Q.constants.DREF));return m}},{key:"stbl",value:function(m){var A=Q.box(Q.types.stbl,Q.stsd(m),Q.box(Q.types.stts,Q.constants.STTS),Q.box(Q.types.stsc,Q.constants.STSC),Q.box(Q.types.stsz,Q.constants.STSZ),Q.box(Q.types.stco,Q.constants.STCO));return A}},{key:"stsd",value:function(m){return m.type==="audio"?m.codec==="mp3"?Q.box(Q.types.stsd,Q.constants.STSD_PREFIX,Q.mp3(m)):Q.box(Q.types.stsd,Q.constants.STSD_PREFIX,Q.mp4a(m)):Q.box(Q.types.stsd,Q.constants.STSD_PREFIX,Q.avc1(m))}},{key:"mp3",value:function(m){var A=m.channelCount,L=m.audioSampleRate,B=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,A,0,16,0,0,0,0,L>>>8&255,L&255,0,0]);return Q.box(Q.types[".mp3"],B)}},{key:"mp4a",value:function(m){var A=m.channelCount,L=m.audioSampleRate,B=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,A,0,16,0,0,0,0,L>>>8&255,L&255,0,0]);return Q.box(Q.types.mp4a,B,Q.esds(m))}},{key:"esds",value:function(m){var A=m.config||[],L=A.length,B=new Uint8Array([0,0,0,0,3,23+L,0,1,0,4,15+L,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([L]).concat(A).concat([6,1,2]));return Q.box(Q.types.esds,B)}},{key:"avc1",value:function(m){var A=m.avcc,L=m.codecWidth,B=m.codecHeight,Y=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,L>>>8&255,L&255,B>>>8&255,B&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return Q.box(Q.types.avc1,Y,Q.box(Q.types.avcC,A))}},{key:"mvex",value:function(m){return Q.box(Q.types.mvex,Q.trex(m))}},{key:"trex",value:function(m){var A=m.id,L=new Uint8Array([0,0,0,0,A>>>24&255,A>>>16&255,A>>>8&255,A&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return Q.box(Q.types.trex,L)}},{key:"moof",value:function(m,A){return Q.box(Q.types.moof,Q.mfhd(m.sequenceNumber),Q.traf(m,A))}},{key:"mfhd",value:function(m){var A=new Uint8Array([0,0,0,0,m>>>24&255,m>>>16&255,m>>>8&255,m&255]);return Q.box(Q.types.mfhd,A)}},{key:"traf",value:function(m,A){var L=m.id,B=Q.box(Q.types.tfhd,new Uint8Array([0,0,0,0,L>>>24&255,L>>>16&255,L>>>8&255,L&255])),Y=Q.box(Q.types.tfdt,new Uint8Array([0,0,0,0,A>>>24&255,A>>>16&255,A>>>8&255,A&255])),ce=Q.sdtp(m),be=Q.trun(m,ce.byteLength+16+16+8+16+8+8);return Q.box(Q.types.traf,B,Y,be,ce)}},{key:"sdtp",value:function(m){for(var A=m.samples||[],L=A.length,B=new Uint8Array(4+L),Y=0;Y>>24&255,B>>>16&255,B>>>8&255,B&255,A>>>24&255,A>>>16&255,A>>>8&255,A&255],0);for(var be=0;be>>24&255,Me>>>16&255,Me>>>8&255,Me&255,Ve>>>24&255,Ve>>>16&255,Ve>>>8&255,Ve&255,Ge.isLeading<<2|Ge.dependsOn,Ge.isDependedOn<<6|Ge.hasRedundancy<<4|Ge.isNonSync,0,0,rt>>>24&255,rt>>>16&255,rt>>>8&255,rt&255],12+16*be)}return Q.box(Q.types.trun,ce)}},{key:"mdat",value:function(m){return Q.box(Q.types.mdat,m)}}]),Q}();Ke.init();var dt=Ke,ft=function(){function Q(){Object(ge.a)(this,Q)}return Object(G.a)(Q,null,[{key:"getSilentFrame",value:function(m,A){if(m==="mp4a.40.2"){if(A===1)return new Uint8Array([0,200,0,128,35,128]);if(A===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(A===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(A===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(A===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(A===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])}else{if(A===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(A===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(A===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])}return null}}]),Q}(),We=ft,Ze=function Q(K,m,A,L,B){Object(ge.a)(this,Q),this.dts=K,this.pts=m,this.duration=A,this.originalDts=L,this.isSyncPoint=B,this.fileposition=null},me=function(){function Q(){Object(ge.a)(this,Q),this.beginDts=0,this.endDts=0,this.beginPts=0,this.endPts=0,this.originalBeginDts=0,this.originalEndDts=0,this.syncPoints=[],this.firstSample=null,this.lastSample=null}return Object(G.a)(Q,[{key:"appendSyncPoint",value:function(m){m.isSyncPoint=!0,this.syncPoints.push(m)}}]),Q}(),ve=function(){function Q(){Object(ge.a)(this,Q),this._list=[]}return Object(G.a)(Q,[{key:"clear",value:function(){this._list=[]}},{key:"appendArray",value:function(m){var A=this._list;if(m.length===0)return;A.length>0&&m[0].originalDts=A[Y].dts&&mA[B].lastSample.originalDts&&m=A[B].lastSample.originalDts&&(B===A.length-1||B0&&(Y=this._searchNearestSegmentBefore(L.originalBeginDts)+1),this._lastAppendLocation=Y,this._list.splice(Y,0,L)}},{key:"getLastSegmentBefore",value:function(m){var A=this._searchNearestSegmentBefore(m);return A>=0?this._list[A]:null}},{key:"getLastSampleBefore",value:function(m){var A=this.getLastSegmentBefore(m);return A!=null?A.lastSample:null}},{key:"getLastSyncPointBefore",value:function(m){for(var A=this._searchNearestSegmentBefore(m),L=this._list[A].syncPoints;L.length===0&&A>0;)A--,L=this._list[A].syncPoints;return L.length>0?L[L.length-1]:null}}]),Q}(),Z=function(){function Q(K){Object(ge.a)(this,Q),this.TAG="MP4Remuxer",this._config=K,this._isLive=K.isLive===!0,this._dtsBase=-1,this._dtsBaseInited=!1,this._audioDtsBase=Infinity,this._videoDtsBase=Infinity,this._audioNextDts=void 0,this._videoNextDts=void 0,this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList=new pe("audio"),this._videoSegmentInfoList=new pe("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!!(f.chrome&&(f.version.major<50||f.version.major===50&&f.version.build<2661)),this._fillSilentAfterSeek=f.msedge||f.msie,this._mp3UseMpegAudio=!f.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}return Object(G.a)(Q,[{key:"destroy",value:function(){this._dtsBase=-1,this._dtsBaseInited=!1,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList.clear(),this._audioSegmentInfoList=null,this._videoSegmentInfoList.clear(),this._videoSegmentInfoList=null,this._onInitSegment=null,this._onMediaSegment=null}},{key:"bindDataSource",value:function(m){return m.onDataAvailable=this.remux.bind(this),m.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this}},{key:"onInitSegment",get:function(){return this._onInitSegment},set:function(m){this._onInitSegment=m}},{key:"onMediaSegment",get:function(){return this._onMediaSegment},set:function(m){this._onMediaSegment=m}},{key:"insertDiscontinuity",value:function(){this._audioNextDts=this._videoNextDts=void 0}},{key:"seek",value:function(m){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()}},{key:"remux",value:function(m,A){if(!this._onMediaSegment)throw new x("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(m,A),this._remuxVideo(A),this._remuxAudio(m)}},{key:"_onTrackMetadataReceived",value:function(m,A){var L=null,B="mp4",Y=A.codec;if(m==="audio")this._audioMeta=A,A.codec==="mp3"&&this._mp3UseMpegAudio?(B="mpeg",Y="",L=new Uint8Array):L=dt.generateInitSegment(A);else if(m==="video")this._videoMeta=A,L=dt.generateInitSegment(A);else return;if(!this._onInitSegment)throw new x("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(m,{type:m,data:L.buffer,codec:Y,container:"".concat(m,"/").concat(B),mediaDuration:A.duration})}},{key:"_calculateDtsBase",value:function(m,A){if(this._dtsBaseInited)return;m.samples&&m.samples.length&&(this._audioDtsBase=m.samples[0].dts),A.samples&&A.samples.length&&(this._videoDtsBase=A.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0}},{key:"flushStashedSamples",value:function(){var m=this._videoStashedLastSample,A=this._audioStashedLastSample,L={type:"video",id:1,sequenceNumber:0,samples:[],length:0};m!=null&&(L.samples.push(m),L.length=m.length);var B={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};A!=null&&(B.samples.push(A),B.length=A.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(L,!0),this._remuxAudio(B,!0)}},{key:"_remuxAudio",value:function(m,A){if(this._audioMeta==null)return;var L=m,B=L.samples,Y=void 0,ce=-1,be=-1,Me=-1,Ve=this._audioMeta.refSampleDuration,Ge=this._audioMeta.codec==="mp3"&&this._mp3UseMpegAudio,rt=this._dtsBaseInited&&this._audioNextDts===void 0,Qe=!1;if(!B||B.length===0)return;if(B.length===1&&!A)return;var Pe=0,tt=null,nt=0;Ge?(Pe=0,nt=L.length):(Pe=8,nt=8+L.length);var O=null;if(B.length>1&&(O=B.pop(),nt-=O.length),this._audioStashedLastSample!=null){var e=this._audioStashedLastSample;this._audioStashedLastSample=null,B.unshift(e),nt+=e.length}O!=null&&(this._audioStashedLastSample=O);var a=B[0].dts-this._dtsBase;if(this._audioNextDts)Y=a-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())Y=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&(this._audioMeta.originalCodec!=="mp3"&&(Qe=!0));else{var P=this._audioSegmentInfoList.getLastSampleBefore(a);if(P!=null){var W=a-(P.originalDts+P.duration);W<=3&&(W=0);var I=P.dts+P.duration+W;Y=a-I}else Y=0}if(Qe){var le=a-Y,Ue=this._videoSegmentInfoList.getLastSegmentBefore(a);if(Ue!=null&&Ue.beginDts=1?Lt=ct[ct.length-1].duration:Lt=Math.floor(Ve);var kt=!1,It=null;if(Lt>Ve*1.5&&this._audioMeta.codec!=="mp3"&&this._fillAudioTimestampGap&&!f.safari){kt=!0;var Vt=Math.abs(Lt-Ve),zt=Math.ceil(Vt/Ve),Xt=wt+Ve;U.w(this.TAG,`Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.
`+"dts: ".concat(wt+Lt," ms, expected: ").concat(wt+Math.round(Ve)," ms, ")+"delta: ".concat(Math.round(Vt)," ms, generate: ").concat(zt," frames"));var jt=We.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);jt==null&&(U.w(this.TAG,"Unable to generate silent frame for "+"".concat(this._audioMeta.originalCodec," with ").concat(this._audioMeta.channelCount," channels, repeat last frame")),jt=Mt),It=[];for(var $t=0;$t0){var Wt=It[It.length-1];Wt.duration=Kt-Wt.dts}var Ft={dts:Kt,pts:Kt,cts:0,unit:jt,size:jt.byteLength,duration:0,originalDts:Ut,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};It.push(Ft),nt+=Ft.size,Xt+=Ve}var qt=It[It.length-1];qt.duration=wt+Lt-qt.dts,Lt=Math.round(Ve)}ct.push({dts:wt,pts:wt,cts:0,unit:Tt.unit,size:Tt.unit.byteLength,duration:Lt,originalDts:Ut,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),kt&&ct.push.apply(ct,It)}Ge?tt=new Uint8Array(nt):(tt=new Uint8Array(nt),tt[0]=nt>>>24&255,tt[1]=nt>>>16&255,tt[2]=nt>>>8&255,tt[3]=nt&255,tt.set(dt.types.mdat,4));for(var Zt=0;Zt1&&(Pe=B.pop(),Qe-=Pe.length),this._videoStashedLastSample!=null){var tt=this._videoStashedLastSample;this._videoStashedLastSample=null,B.unshift(tt),Qe+=tt.length}Pe!=null&&(this._videoStashedLastSample=Pe);var nt=B[0].dts-this._dtsBase;if(this._videoNextDts)Y=nt-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())Y=0;else{var O=this._videoSegmentInfoList.getLastSampleBefore(nt);if(O!=null){var e=nt-(O.originalDts+O.duration);e<=3&&(e=0);var a=O.dts+O.duration+e;Y=nt-a}else Y=0}for(var P=new me,W=[],I=0;I=1?Et=W[W.length-1].duration:Et=Math.floor(this._videoMeta.refSampleDuration);if(Xe){var Ut=new Ze(ht,ct,Et,le.dts,!0);Ut.fileposition=le.fileposition,P.appendSyncPoint(Ut)}W.push({dts:ht,pts:ct,cts:Fe,units:le.units,size:le.length,isKeyframe:Xe,duration:Et,originalDts:Ue,flags:{isLeading:0,dependsOn:Xe?2:1,isDependedOn:Xe?1:0,hasRedundancy:0,isNonSync:Xe?0:1}})}rt=new Uint8Array(Qe),rt[0]=Qe>>>24&255,rt[1]=Qe>>>16&255,rt[2]=Qe>>>8&255,rt[3]=Qe&255,rt.set(dt.types.mdat,4);for(var wt=0;wt0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,Y=this._demuxer.parseChunks(m,A);else if((B=et.probe(m)).match){this._demuxer=new et(B,this._config),this._remuxer||(this._remuxer=new te(this._config));var ce=this._mediaDataSource;ce.duration!=null&&!isNaN(ce.duration)&&(this._demuxer.overridedDuration=ce.duration),typeof ce.hasAudio=="boolean"&&(this._demuxer.overridedHasAudio=ce.hasAudio),typeof ce.hasVideo=="boolean"&&(this._demuxer.overridedHasVideo=ce.hasVideo),this._demuxer.timestampBase=ce.segments[this._currentSegmentIndex].timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._demuxer.onMetaDataArrived=this._onMetaDataArrived.bind(this),this._demuxer.onScriptDataArrived=this._onScriptDataArrived.bind(this),this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this),Y=this._demuxer.parseChunks(m,A)}else B=null,U.e(this.TAG,"Non-FLV, Unsupported media type!"),Promise.resolve().then(function(){L._internalAbort()}),this._emitter.emit(ne.DEMUX_ERROR,Oe.FORMAT_UNSUPPORTED,"Non-FLV, Unsupported media type"),Y=0;return Y}},{key:"_onMediaInfo",value:function(m){var A=this;this._mediaInfo==null&&(this._mediaInfo=Object.assign({},m),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,ue.prototype));var L=Object.assign({},m);Object.setPrototypeOf(L,ue.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=L,this._reportSegmentMediaInfo(this._currentSegmentIndex),this._pendingSeekTime!=null&&Promise.resolve().then(function(){var B=A._pendingSeekTime;A._pendingSeekTime=null,A.seek(B)})}},{key:"_onMetaDataArrived",value:function(m){this._emitter.emit(ne.METADATA_ARRIVED,m)}},{key:"_onScriptDataArrived",value:function(m){this._emitter.emit(ne.SCRIPTDATA_ARRIVED,m)}},{key:"_onIOSeeked",value:function(){this._remuxer.insertDiscontinuity()}},{key:"_onIOComplete",value:function(m){var A=m,L=A+1;L0&&L[0].originalDts===B&&(B=L[0].pts),this._emitter.emit(ne.RECOMMEND_SEEKPOINT,B)}}},{key:"_enableStatisticsReporter",value:function(){this._statisticsReporter==null&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))}},{key:"_disableStatisticsReporter",value:function(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}},{key:"_reportSegmentMediaInfo",value:function(m){var A=this._mediaInfo.segments[m],L=Object.assign({},A);L.duration=this._mediaInfo.duration,L.segmentCount=this._mediaInfo.segmentCount,delete L.segments,delete L.keyframesIndex,this._emitter.emit(ne.MEDIA_INFO,L)}},{key:"_reportStatisticsInfo",value:function(){var m={};m.url=this._ioctl.currentURL,m.hasRedirect=this._ioctl.hasRedirect,m.hasRedirect&&(m.redirectedURL=this._ioctl.currentRedirectedURL),m.speed=this._ioctl.currentSpeed,m.loaderType=this._ioctl.loaderType,m.currentSegmentIndex=this._currentSegmentIndex,m.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(ne.STATISTICS_INFO,m)}}]),Q}(),De=Ae,Ye=function(K){var m="TransmuxingWorker",A=null,L=nt.bind(this);z.install(),K.addEventListener("message",function(O){switch(O.data.cmd){case"init":A=new De(O.data.param[0],O.data.param[1]),A.on(ne.IO_ERROR,Qe.bind(this)),A.on(ne.DEMUX_ERROR,Pe.bind(this)),A.on(ne.INIT_SEGMENT,B.bind(this)),A.on(ne.MEDIA_SEGMENT,Y.bind(this)),A.on(ne.LOADING_COMPLETE,ce.bind(this)),A.on(ne.RECOVERED_EARLY_EOF,be.bind(this)),A.on(ne.MEDIA_INFO,Me.bind(this)),A.on(ne.METADATA_ARRIVED,Ve.bind(this)),A.on(ne.SCRIPTDATA_ARRIVED,Ge.bind(this)),A.on(ne.STATISTICS_INFO,rt.bind(this)),A.on(ne.RECOMMEND_SEEKPOINT,tt.bind(this));break;case"destroy":A&&(A.destroy(),A=null),K.postMessage({msg:"destroyed"});break;case"start":A.start();break;case"stop":A.stop();break;case"seek":A.seek(O.data.param);break;case"pause":A.pause();break;case"resume":A.resume();break;case"logging_config":{var e=O.data.param;se.applyConfig(e),e.enableCallback===!0?se.addLogListener(L):se.removeLogListener(L);break}}});function B(O,e){var a={msg:ne.INIT_SEGMENT,data:{type:O,data:e}};K.postMessage(a,[e.data])}function Y(O,e){var a={msg:ne.MEDIA_SEGMENT,data:{type:O,data:e}};K.postMessage(a,[e.data])}function ce(){var O={msg:ne.LOADING_COMPLETE};K.postMessage(O)}function be(){var O={msg:ne.RECOVERED_EARLY_EOF};K.postMessage(O)}function Me(O){var e={msg:ne.MEDIA_INFO,data:O};K.postMessage(e)}function Ve(O){var e={msg:ne.METADATA_ARRIVED,data:O};K.postMessage(e)}function Ge(O){var e={msg:ne.SCRIPTDATA_ARRIVED,data:O};K.postMessage(e)}function rt(O){var e={msg:ne.STATISTICS_INFO,data:O};K.postMessage(e)}function Qe(O,e){K.postMessage({msg:ne.IO_ERROR,data:{type:O,info:e}})}function Pe(O,e){K.postMessage({msg:ne.DEMUX_ERROR,data:{type:O,info:e}})}function tt(O){K.postMessage({msg:ne.RECOMMEND_SEEKPOINT,data:O})}function nt(O,e){K.postMessage({msg:"logcat_callback",data:{type:O,logcat:e}})}},mt=Ye,lt=function(){function Q(K,m){if(Object(ge.a)(this,Q),this.TAG="Transmuxer",this._emitter=new v.a,m.enableWorker&&typeof Worker!="undefined")try{var A=ee("0r65");this._worker=A(mt),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[K,m]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},se.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:se.getConfig()})}catch(B){U.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new De(K,m)}else this._controller=new De(K,m);if(this._controller){var L=this._controller;L.on(ne.IO_ERROR,this._onIOError.bind(this)),L.on(ne.DEMUX_ERROR,this._onDemuxError.bind(this)),L.on(ne.INIT_SEGMENT,this._onInitSegment.bind(this)),L.on(ne.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),L.on(ne.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),L.on(ne.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),L.on(ne.MEDIA_INFO,this._onMediaInfo.bind(this)),L.on(ne.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),L.on(ne.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),L.on(ne.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),L.on(ne.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}return Object(G.a)(Q,[{key:"destroy",value:function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),se.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null}},{key:"on",value:function(m,A){this._emitter.addListener(m,A)}},{key:"off",value:function(m,A){this._emitter.removeListener(m,A)}},{key:"hasWorker",value:function(){return this._worker!=null}},{key:"open",value:function(){this._worker?this._worker.postMessage({cmd:"start"}):this._controller.start()}},{key:"close",value:function(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()}},{key:"seek",value:function(m){this._worker?this._worker.postMessage({cmd:"seek",param:m}):this._controller.seek(m)}},{key:"pause",value:function(){this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()}},{key:"resume",value:function(){this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()}},{key:"_onInitSegment",value:function(m,A){var L=this;Promise.resolve().then(function(){L._emitter.emit(ne.INIT_SEGMENT,m,A)})}},{key:"_onMediaSegment",value:function(m,A){var L=this;Promise.resolve().then(function(){L._emitter.emit(ne.MEDIA_SEGMENT,m,A)})}},{key:"_onLoadingComplete",value:function(){var m=this;Promise.resolve().then(function(){m._emitter.emit(ne.LOADING_COMPLETE)})}},{key:"_onRecoveredEarlyEof",value:function(){var m=this;Promise.resolve().then(function(){m._emitter.emit(ne.RECOVERED_EARLY_EOF)})}},{key:"_onMediaInfo",value:function(m){var A=this;Promise.resolve().then(function(){A._emitter.emit(ne.MEDIA_INFO,m)})}},{key:"_onMetaDataArrived",value:function(m){var A=this;Promise.resolve().then(function(){A._emitter.emit(ne.METADATA_ARRIVED,m)})}},{key:"_onScriptDataArrived",value:function(m){var A=this;Promise.resolve().then(function(){A._emitter.emit(ne.SCRIPTDATA_ARRIVED,m)})}},{key:"_onStatisticsInfo",value:function(m){var A=this;Promise.resolve().then(function(){A._emitter.emit(ne.STATISTICS_INFO,m)})}},{key:"_onIOError",value:function(m,A){var L=this;Promise.resolve().then(function(){L._emitter.emit(ne.IO_ERROR,m,A)})}},{key:"_onDemuxError",value:function(m,A){var L=this;Promise.resolve().then(function(){L._emitter.emit(ne.DEMUX_ERROR,m,A)})}},{key:"_onRecommendSeekpoint",value:function(m){var A=this;Promise.resolve().then(function(){A._emitter.emit(ne.RECOMMEND_SEEKPOINT,m)})}},{key:"_onLoggingConfigChanged",value:function(m){this._worker&&this._worker.postMessage({cmd:"logging_config",param:m})}},{key:"_onWorkerMessage",value:function(m){var A=m.data,L=A.data;if(A.msg==="destroyed"||this._workerDestroying){this._workerDestroying=!1,this._worker.terminate(),this._worker=null;return}switch(A.msg){case ne.INIT_SEGMENT:case ne.MEDIA_SEGMENT:this._emitter.emit(A.msg,L.type,L.data);break;case ne.LOADING_COMPLETE:case ne.RECOVERED_EARLY_EOF:this._emitter.emit(A.msg);break;case ne.MEDIA_INFO:Object.setPrototypeOf(L,ue.prototype),this._emitter.emit(A.msg,L);break;case ne.METADATA_ARRIVED:case ne.SCRIPTDATA_ARRIVED:case ne.STATISTICS_INFO:this._emitter.emit(A.msg,L);break;case ne.IO_ERROR:case ne.DEMUX_ERROR:this._emitter.emit(A.msg,L.type,L.info);break;case ne.RECOMMEND_SEEKPOINT:this._emitter.emit(A.msg,L);break;case"logcat_callback":U.emitter.emit("log",L.type,L.logcat);break;default:break}}}]),Q}(),$e=lt,Je={ERROR:"error",SOURCE_OPEN:"source_open",UPDATE_END:"update_end",BUFFER_FULL:"buffer_full"},ze=Je,He=function(){function Q(K){Object(ge.a)(this,Q),this.TAG="MSEController",this._config=K,this._emitter=new v.a,this._config.isLive&&this._config.autoCleanupSourceBuffer==null&&(this._config.autoCleanupSourceBuffer=!0),this.e={onSourceOpen:this._onSourceOpen.bind(this),onSourceEnded:this._onSourceEnded.bind(this),onSourceClose:this._onSourceClose.bind(this),onSourceBufferError:this._onSourceBufferError.bind(this),onSourceBufferUpdateEnd:this._onSourceBufferUpdateEnd.bind(this)},this._mediaSource=null,this._mediaSourceObjectURL=null,this._mediaElement=null,this._isBufferFull=!1,this._hasPendingEos=!1,this._requireSetMediaDuration=!1,this._pendingMediaDuration=0,this._pendingSourceBufferInit=[],this._mimeTypes={video:null,audio:null},this._sourceBuffers={video:null,audio:null},this._lastInitSegments={video:null,audio:null},this._pendingSegments={video:[],audio:[]},this._pendingRemoveRanges={video:[],audio:[]},this._idrList=new ve}return Object(G.a)(Q,[{key:"destroy",value:function(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null}},{key:"on",value:function(m,A){this._emitter.addListener(m,A)}},{key:"off",value:function(m,A){this._emitter.removeListener(m,A)}},{key:"attachMediaElement",value:function(m){if(this._mediaSource)throw new x("MediaSource has been attached to an HTMLMediaElement!");var A=this._mediaSource=new window.MediaSource;A.addEventListener("sourceopen",this.e.onSourceOpen),A.addEventListener("sourceended",this.e.onSourceEnded),A.addEventListener("sourceclose",this.e.onSourceClose),this._mediaElement=m,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),m.src=this._mediaSourceObjectURL}},{key:"detachMediaElement",value:function(){if(this._mediaSource){var m=this._mediaSource;for(var A in this._sourceBuffers){var L=this._pendingSegments[A];L.splice(0,L.length),this._pendingSegments[A]=null,this._pendingRemoveRanges[A]=null,this._lastInitSegments[A]=null;var B=this._sourceBuffers[A];if(B){if(m.readyState!=="closed"){try{m.removeSourceBuffer(B)}catch(Y){U.e(this.TAG,Y.message)}B.removeEventListener("error",this.e.onSourceBufferError),B.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[A]=null,this._sourceBuffers[A]=null}}if(m.readyState==="open")try{m.endOfStream()}catch(Y){U.e(this.TAG,Y.message)}m.removeEventListener("sourceopen",this.e.onSourceOpen),m.removeEventListener("sourceended",this.e.onSourceEnded),m.removeEventListener("sourceclose",this.e.onSourceClose),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._idrList.clear(),this._mediaSource=null}this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement=null),this._mediaSourceObjectURL&&(window.URL.revokeObjectURL(this._mediaSourceObjectURL),this._mediaSourceObjectURL=null)}},{key:"appendInitSegment",value:function(m,A){if(!this._mediaSource||this._mediaSource.readyState!=="open"){this._pendingSourceBufferInit.push(m),this._pendingSegments[m.type].push(m);return}var L=m,B="".concat(L.container);L.codec&&L.codec.length>0&&(B+=";codecs=".concat(L.codec));var Y=!1;if(U.v(this.TAG,"Received Initialization Segment, mimeType: "+B),this._lastInitSegments[L.type]=L,B!==this._mimeTypes[L.type]){if(this._mimeTypes[L.type])U.v(this.TAG,"Notice: ".concat(L.type," mimeType changed, origin: ").concat(this._mimeTypes[L.type],", target: ").concat(B));else{Y=!0;try{var ce=this._sourceBuffers[L.type]=this._mediaSource.addSourceBuffer(B);ce.addEventListener("error",this.e.onSourceBufferError),ce.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(be){U.e(this.TAG,be.message),this._emitter.emit(ze.ERROR,{code:be.code,msg:be.message});return}}this._mimeTypes[L.type]=B}A||this._pendingSegments[L.type].push(L),Y||this._sourceBuffers[L.type]&&!this._sourceBuffers[L.type].updating&&this._doAppendSegments(),f.safari&&L.container==="audio/mpeg"&&L.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=L.mediaDuration/1e3,this._updateMediaSourceDuration())}},{key:"appendMediaSegment",value:function(m){var A=m;this._pendingSegments[A.type].push(A),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();var L=this._sourceBuffers[A.type];L&&!L.updating&&!this._hasPendingRemoveRanges()&&this._doAppendSegments()}},{key:"seek",value:function(m){for(var A in this._sourceBuffers){if(!this._sourceBuffers[A])continue;var L=this._sourceBuffers[A];if(this._mediaSource.readyState==="open")try{L.abort()}catch(Ve){U.e(this.TAG,Ve.message)}this._idrList.clear();var B=this._pendingSegments[A];if(B.splice(0,B.length),this._mediaSource.readyState==="closed")continue;for(var Y=0;Y=1&&m-B.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1}},{key:"_doCleanupSourceBuffer",value:function(){var m=this._mediaElement.currentTime;for(var A in this._sourceBuffers){var L=this._sourceBuffers[A];if(L){for(var B=L.buffered,Y=!1,ce=0;ce=this._config.autoCleanupMaxBackwardDuration){Y=!0;var Ve=m-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[A].push({start:be,end:Ve})}}else Me0&&(isNaN(A)||L>A)&&(U.v(this.TAG,"Update MediaSource duration from ".concat(A," to ").concat(L)),this._mediaSource.duration=L),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}},{key:"_doRemoveRanges",value:function(){for(var m in this._pendingRemoveRanges){if(!this._sourceBuffers[m]||this._sourceBuffers[m].updating)continue;for(var A=this._sourceBuffers[m],L=this._pendingRemoveRanges[m];L.length&&!A.updating;){var B=L.shift();A.remove(B.start,B.end)}}}},{key:"_doAppendSegments",value:function(){var m=this._pendingSegments;for(var A in m){if(!this._sourceBuffers[A]||this._sourceBuffers[A].updating)continue;if(m[A].length>0){var L=m[A].shift();if(L.timestampOffset){var B=this._sourceBuffers[A].timestampOffset,Y=L.timestampOffset/1e3,ce=Math.abs(B-Y);ce>.1&&(U.v(this.TAG,"Update MPEG audio timestampOffset from ".concat(B," to ").concat(Y)),this._sourceBuffers[A].timestampOffset=Y),delete L.timestampOffset}if(!L.data||L.data.byteLength===0)continue;try{this._sourceBuffers[A].appendBuffer(L.data),this._isBufferFull=!1,A==="video"&&L.hasOwnProperty("info")&&this._idrList.appendArray(L.info.syncPoints)}catch(be){this._pendingSegments[A].unshift(L),be.code===22?(this._isBufferFull||this._emitter.emit(ze.BUFFER_FULL),this._isBufferFull=!0):(U.e(this.TAG,be.message),this._emitter.emit(ze.ERROR,{code:be.code,msg:be.message}))}}}}},{key:"_onSourceOpen",value:function(){if(U.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0)for(var m=this._pendingSourceBufferInit;m.length;){var A=m.shift();this.appendInitSegment(A,!0)}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(ze.SOURCE_OPEN)}},{key:"_onSourceEnded",value:function(){U.v(this.TAG,"MediaSource onSourceEnded")}},{key:"_onSourceClose",value:function(){U.v(this.TAG,"MediaSource onSourceClose"),this._mediaSource&&this.e!=null&&(this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._mediaSource.removeEventListener("sourceended",this.e.onSourceEnded),this._mediaSource.removeEventListener("sourceclose",this.e.onSourceClose))}},{key:"_hasPendingSegments",value:function(){var m=this._pendingSegments;return m.video.length>0||m.audio.length>0}},{key:"_hasPendingRemoveRanges",value:function(){var m=this._pendingRemoveRanges;return m.video.length>0||m.audio.length>0}},{key:"_onSourceBufferUpdateEnd",value:function(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(ze.UPDATE_END)}},{key:"_onSourceBufferError",value:function(m){U.e(this.TAG,"SourceBuffer Error: ".concat(m))}}]),Q}(),qe=He,st={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},gt={NETWORK_EXCEPTION:t.EXCEPTION,NETWORK_STATUS_CODE_INVALID:t.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:t.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:t.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:Oe.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:Oe.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:Oe.CODEC_UNSUPPORTED},yt=function(){function Q(K,m){if(Object(ge.a)(this,Q),this.TAG="FlvPlayer",this._type="FlvPlayer",this._emitter=new v.a,this._config=Ce(),typeof m=="object"&&Object.assign(this._config,m),K.type.toLowerCase()!=="flv")throw new S("FlvPlayer requires an flv MediaDataSource input!");K.isLive===!0&&(this._config.isLive=!0),this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this),onvSeeking:this._onvSeeking.bind(this),onvCanPlay:this._onvCanPlay.bind(this),onvStalled:this._onvStalled.bind(this),onvProgress:this._onvProgress.bind(this)},self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now,this._pendingSeekTime=null,this._requestSetTime=!1,this._seekpointRecord=null,this._progressChecker=null,this._mediaDataSource=K,this._mediaElement=null,this._msectl=null,this._transmuxer=null,this._mseSourceOpened=!1,this._hasPendingLoad=!1,this._receivedCanPlay=!1,this._mediaInfo=null,this._statisticsInfo=null;var A=f.chrome&&(f.version.major<50||f.version.major===50&&f.version.build<2661);this._alwaysSeekKeyframe=!!(A||f.msedge||f.msie),this._alwaysSeekKeyframe&&(this._config.accurateSeek=!1)}return Object(G.a)(Q,[{key:"destroy",value:function(){this._progressChecker!=null&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._transmuxer&&this.unload(),this._mediaElement&&this.detachMediaElement(),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null}},{key:"on",value:function(m,A){var L=this;m===_e.MEDIA_INFO?this._mediaInfo!=null&&Promise.resolve().then(function(){L._emitter.emit(_e.MEDIA_INFO,L.mediaInfo)}):m===_e.STATISTICS_INFO&&(this._statisticsInfo!=null&&Promise.resolve().then(function(){L._emitter.emit(_e.STATISTICS_INFO,L.statisticsInfo)})),this._emitter.addListener(m,A)}},{key:"off",value:function(m,A){this._emitter.removeListener(m,A)}},{key:"attachMediaElement",value:function(m){var A=this;if(this._mediaElement=m,m.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),m.addEventListener("seeking",this.e.onvSeeking),m.addEventListener("canplay",this.e.onvCanPlay),m.addEventListener("stalled",this.e.onvStalled),m.addEventListener("progress",this.e.onvProgress),this._msectl=new qe(this._config),this._msectl.on(ze.UPDATE_END,this._onmseUpdateEnd.bind(this)),this._msectl.on(ze.BUFFER_FULL,this._onmseBufferFull.bind(this)),this._msectl.on(ze.SOURCE_OPEN,function(){A._mseSourceOpened=!0,A._hasPendingLoad&&(A._hasPendingLoad=!1,A.load())}),this._msectl.on(ze.ERROR,function(L){A._emitter.emit(_e.ERROR,st.MEDIA_ERROR,gt.MEDIA_MSE_ERROR,L)}),this._msectl.attachMediaElement(m),this._pendingSeekTime!=null)try{m.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(L){}}},{key:"detachMediaElement",value:function(){this._mediaElement&&(this._msectl.detachMediaElement(),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement.removeEventListener("seeking",this.e.onvSeeking),this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay),this._mediaElement.removeEventListener("stalled",this.e.onvStalled),this._mediaElement.removeEventListener("progress",this.e.onvProgress),this._mediaElement=null),this._msectl&&(this._msectl.destroy(),this._msectl=null)}},{key:"load",value:function(){var m=this;if(!this._mediaElement)throw new x("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new x("FlvPlayer.load() has been called, please call unload() first!");if(this._hasPendingLoad)return;if(this._config.deferLoadAfterSourceOpen&&this._mseSourceOpened===!1){this._hasPendingLoad=!0;return}this._mediaElement.readyState>0&&(this._requestSetTime=!0,this._mediaElement.currentTime=0),this._transmuxer=new $e(this._mediaDataSource,this._config),this._transmuxer.on(ne.INIT_SEGMENT,function(A,L){m._msectl.appendInitSegment(L)}),this._transmuxer.on(ne.MEDIA_SEGMENT,function(A,L){if(m._msectl.appendMediaSegment(L),m._config.lazyLoad&&!m._config.isLive){var B=m._mediaElement.currentTime;L.info.endDts>=(B+m._config.lazyLoadMaxDuration)*1e3&&(m._progressChecker==null&&(U.v(m.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),m._suspendTransmuxer()))}}),this._transmuxer.on(ne.LOADING_COMPLETE,function(){m._msectl.endOfStream(),m._emitter.emit(_e.LOADING_COMPLETE)}),this._transmuxer.on(ne.RECOVERED_EARLY_EOF,function(){m._emitter.emit(_e.RECOVERED_EARLY_EOF)}),this._transmuxer.on(ne.IO_ERROR,function(A,L){m._emitter.emit(_e.ERROR,st.NETWORK_ERROR,A,L)}),this._transmuxer.on(ne.DEMUX_ERROR,function(A,L){m._emitter.emit(_e.ERROR,st.MEDIA_ERROR,A,{code:-1,msg:L})}),this._transmuxer.on(ne.MEDIA_INFO,function(A){m._mediaInfo=A,m._emitter.emit(_e.MEDIA_INFO,Object.assign({},A))}),this._transmuxer.on(ne.METADATA_ARRIVED,function(A){m._emitter.emit(_e.METADATA_ARRIVED,A)}),this._transmuxer.on(ne.SCRIPTDATA_ARRIVED,function(A){m._emitter.emit(_e.SCRIPTDATA_ARRIVED,A)}),this._transmuxer.on(ne.STATISTICS_INFO,function(A){m._statisticsInfo=m._fillStatisticsInfo(A),m._emitter.emit(_e.STATISTICS_INFO,Object.assign({},m._statisticsInfo))}),this._transmuxer.on(ne.RECOMMEND_SEEKPOINT,function(A){m._mediaElement&&!m._config.accurateSeek&&(m._requestSetTime=!0,m._mediaElement.currentTime=A/1e3)}),this._transmuxer.open()}},{key:"unload",value:function(){this._mediaElement&&this._mediaElement.pause(),this._msectl&&this._msectl.seek(0),this._transmuxer&&(this._transmuxer.close(),this._transmuxer.destroy(),this._transmuxer=null)}},{key:"play",value:function(){return this._mediaElement.play()}},{key:"pause",value:function(){this._mediaElement.pause()}},{key:"type",get:function(){return this._type}},{key:"buffered",get:function(){return this._mediaElement.buffered}},{key:"duration",get:function(){return this._mediaElement.duration}},{key:"volume",get:function(){return this._mediaElement.volume},set:function(m){this._mediaElement.volume=m}},{key:"muted",get:function(){return this._mediaElement.muted},set:function(m){this._mediaElement.muted=m}},{key:"currentTime",get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(m){this._mediaElement?this._internalSeek(m):this._pendingSeekTime=m}},{key:"mediaInfo",get:function(){return Object.assign({},this._mediaInfo)}},{key:"statisticsInfo",get:function(){return this._statisticsInfo==null&&(this._statisticsInfo={}),this._statisticsInfo=this._fillStatisticsInfo(this._statisticsInfo),Object.assign({},this._statisticsInfo)}},{key:"_fillStatisticsInfo",value:function(m){if(m.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return m;var A=!0,L=0,B=0;if(this._mediaElement.getVideoPlaybackQuality){var Y=this._mediaElement.getVideoPlaybackQuality();L=Y.totalVideoFrames,B=Y.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount!=null?(L=this._mediaElement.webkitDecodedFrameCount,B=this._mediaElement.webkitDroppedFrameCount):A=!1;return A&&(m.decodedFrames=L,m.droppedFrames=B),m}},{key:"_onmseUpdateEnd",value:function(){if(!this._config.lazyLoad||this._config.isLive)return;for(var m=this._mediaElement.buffered,A=this._mediaElement.currentTime,L=0,B=0,Y=0;Y=A+this._config.lazyLoadMaxDuration&&this._progressChecker==null&&(U.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}},{key:"_onmseBufferFull",value:function(){U.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),this._progressChecker==null&&this._suspendTransmuxer()}},{key:"_suspendTransmuxer",value:function(){this._transmuxer&&(this._transmuxer.pause(),this._progressChecker==null&&(this._progressChecker=window.setInterval(this._checkProgressAndResume.bind(this),1e3)))}},{key:"_checkProgressAndResume",value:function(){for(var m=this._mediaElement.currentTime,A=this._mediaElement.buffered,L=!1,B=0;B=Y&&m=ce-this._config.lazyLoadRecoverDuration&&(L=!0);break}}L&&(window.clearInterval(this._progressChecker),this._progressChecker=null,L&&(U.v(this.TAG,"Continue loading from paused position"),this._transmuxer.resume()))}},{key:"_isTimepointBuffered",value:function(m){for(var A=this._mediaElement.buffered,L=0;L=B&&m0){var Y=this._mediaElement.buffered.start(0);(Y<1&&m0&&A.currentTime0){var B=L.start(0);if(B<1&&A0&&(this._mediaElement.currentTime=0),this._mediaElement.preload="auto",this._mediaElement.load(),this._statisticsReporter=window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)}},{key:"unload",value:function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),this._statisticsReporter!=null&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}},{key:"play",value:function(){return this._mediaElement.play()}},{key:"pause",value:function(){this._mediaElement.pause()}},{key:"type",get:function(){return this._type}},{key:"buffered",get:function(){return this._mediaElement.buffered}},{key:"duration",get:function(){return this._mediaElement.duration}},{key:"volume",get:function(){return this._mediaElement.volume},set:function(m){this._mediaElement.volume=m}},{key:"muted",get:function(){return this._mediaElement.muted},set:function(m){this._mediaElement.muted=m}},{key:"currentTime",get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(m){this._mediaElement?this._mediaElement.currentTime=m:this._pendingSeekTime=m}},{key:"mediaInfo",get:function(){var m=this._mediaElement instanceof HTMLAudioElement?"audio/":"video/",A={mimeType:m+this._mediaDataSource.type};return this._mediaElement&&(A.duration=Math.floor(this._mediaElement.duration*1e3),this._mediaElement instanceof HTMLVideoElement&&(A.width=this._mediaElement.videoWidth,A.height=this._mediaElement.videoHeight)),A}},{key:"statisticsInfo",get:function(){var m={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return m;var A=!0,L=0,B=0;if(this._mediaElement.getVideoPlaybackQuality){var Y=this._mediaElement.getVideoPlaybackQuality();L=Y.totalVideoFrames,B=Y.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount!=null?(L=this._mediaElement.webkitDecodedFrameCount,B=this._mediaElement.webkitDroppedFrameCount):A=!1;return A&&(m.decodedFrames=L,m.droppedFrames=B),m}},{key:"_onvLoadedMetadata",value:function(m){this._pendingSeekTime!=null&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(_e.MEDIA_INFO,this.mediaInfo)}},{key:"_reportStatisticsInfo",value:function(){this._emitter.emit(_e.STATISTICS_INFO,this.statisticsInfo)}}]),Q}(),Ct=vt;z.install();function pt(Q,K){var m=Q;if(m==null||typeof m!="object")throw new S("MediaDataSource must be an javascript object!");if(!m.hasOwnProperty("type"))throw new S("MediaDataSource must has type field to indicate video file type!");switch(m.type){case"flv":return new bt(m,K);default:return new Ct(m,K)}}function Ot(){return Se.supportMSEH264Playback()}function Rt(){return Se.getFeatureList()}var _t={};_t.createPlayer=pt,_t.isSupported=Ot,_t.getFeatureList=Rt,_t.BaseLoader=n,_t.LoaderStatus=u,_t.LoaderErrors=t,_t.Events=_e,_t.ErrorTypes=st,_t.ErrorDetails=gt,_t.FlvPlayer=bt,_t.NativePlayer=Ct,_t.LoggingControl=se,Object.defineProperty(_t,"version",{enumerable:!0,get:function(){return"__VERSION__"}});var St=ot.a=_t},GfqC:function(ut,ot,ee){"use strict";var ge=ee("q1tI"),G=ee.n(ge),w=ee("TSYQ"),z=ee.n(w);function k(j,V){var $="cannot "+j.method+" "+j.action+" "+V.status+"'",X=new Error($);return X.status=V.status,X.method=j.method,X.url=j.action,X}function v(j){var V=j.responseText||j.response;if(!V)return V;try{return JSON.parse(V)}catch($){return V}}function F(j){var V=new XMLHttpRequest;j.onProgress&&V.upload&&(V.upload.onprogress=function(ie){ie.total>0&&(ie.percent=ie.loaded/ie.total*100),j.onProgress(ie)});var $=new FormData;j.data&&Object.keys(j.data).forEach(function(q){var ie=j.data[q];if(Array.isArray(ie)){ie.forEach(function(oe){$.append(q+"[]",oe)});return}$.append(q,j.data[q])}),j.file instanceof Blob?$.append(j.filename,j.file,j.file.name):$.append(j.filename,j.file),V.onerror=function(ie){j.onError(ie)},V.onload=function(){return V.status<200||V.status>=300?j.onError(k(j,V),v(V)):j.onSuccess(v(V),V)},V.open(j.method,j.action,!0),j.withCredentials&&"withCredentials"in V&&(V.withCredentials=!0);var X=j.headers||{};return X["X-Requested-With"]!==null&&V.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(X).forEach(function(q){X[q]!==null&&V.setRequestHeader(q,X[q])}),V.send($),{abort:function(){V.abort()}}}var U=+new Date,N=0;function R(){return"rc-upload-"+U+"-"+ ++N}function b(j,V){return j.indexOf(V,j.length-V.length)!==-1}var T=function(j,V){if(j&&V){var $=Array.isArray(V)?V:V.split(","),X=j.name||"",q=j.type||"",ie=q.replace(/\/.*$/,"");return $.some(function(oe){var Ce=oe.trim();return Ce.charAt(0)==="."?b(X.toLowerCase(),Ce.toLowerCase()):/\/\*$/.test(Ce)?ie===Ce.replace(/\/.*$/,""):q===Ce})}return!0};function C(j,V){var $=j.createReader(),X=[];function q(){$.readEntries(function(ie){var oe=Array.prototype.slice.apply(ie);X=X.concat(oe);var Ce=!oe.length;Ce?V(X):q()})}q()}var x=function(V,$,X){var q=function ie(oe,Ce){Ce=Ce||"",oe.isFile?oe.file(function(Ee){X(Ee)&&(oe.fullPath&&!Ee.webkitRelativePath&&(Object.defineProperties(Ee,{webkitRelativePath:{writable:!0}}),Ee.webkitRelativePath=oe.fullPath.replace(/^\//,""),Object.defineProperties(Ee,{webkitRelativePath:{writable:!1}})),$([Ee]))}):oe.isDirectory&&C(oe,function(Ee){Ee.forEach(function(Se){ie(Se,""+Ce+oe.name+"/")})})};V.forEach(function(ie){q(ie.webkitGetAsEntry())})},S=x,E=Object.assign||function(j){for(var V=1;V=0)continue;if(!Object.prototype.hasOwnProperty.call(j,X))continue;$[X]=j[X]}return $}function h(j,V){if(!(j instanceof V))throw new TypeError("Cannot call a class as a function")}function l(j,V){if(!j)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return V&&(typeof V=="object"||typeof V=="function")?V:j}function c(j,V){if(typeof V!="function"&&V!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof V);j.prototype=Object.create(V&&V.prototype,{constructor:{value:j,enumerable:!1,writable:!0,configurable:!0}}),V&&(Object.setPrototypeOf?Object.setPrototypeOf(j,V):j.__proto__=V)}var y=function(V){return Object.keys(V).reduce(function($,X){return(X.substr(0,5)==="data-"||X.substr(0,5)==="aria-"||X==="role")&&($[X]=V[X]),$},{})},f=function(j){c(V,j);function V(){var $,X,q,ie;h(this,V);for(var oe=arguments.length,Ce=Array(oe),Ee=0;Ee>>6)+N(128|D&63):N(224|D>>>12&15)+N(128|D>>>6&63)+N(128|D&63)}else{var D=65536+(_.charCodeAt(0)-55296)*1024+(_.charCodeAt(1)-56320);return N(240|D>>>18&7)+N(128|D>>>12&63)+N(128|D>>>6&63)+N(128|D&63)}},b=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,T=function(_){return _.replace(b,R)},C=function(_){var D=[0,2,1][_.length%3],M=_.charCodeAt(0)<<16|(_.length>1?_.charCodeAt(1):0)<<8|(_.length>2?_.charCodeAt(2):0),H=[F.charAt(M>>>18),F.charAt(M>>>12&63),D>=2?"=":F.charAt(M>>>6&63),D>=1?"=":F.charAt(M&63)];return H.join("")},x=z.btoa&&typeof z.btoa=="function"?function(_){return z.btoa(_)}:function(_){if(_.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return _.replace(/[\s\S]{1,3}/g,C)},S=function(_){return x(T(String(_)))},E=function(_){return _.replace(/[+\/]/g,function(D){return D=="+"?"-":"_"}).replace(/=/g,"")},u=function(_,D){return D?E(S(_)):S(_)},t=function(_){return u(_,!0)},n;z.Uint8Array&&(n=function(_,D){for(var M="",H=0,j=_.length;H>>18)+F.charAt(q>>>12&63)+(typeof $!="undefined"?F.charAt(q>>>6&63):"=")+(typeof X!="undefined"?F.charAt(q&63):"=")}return D?E(M):M});var s=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,h=function(_){switch(_.length){case 4:var D=(7&_.charCodeAt(0))<<18|(63&_.charCodeAt(1))<<12|(63&_.charCodeAt(2))<<6|63&_.charCodeAt(3),M=D-65536;return N((M>>>10)+55296)+N((M&1023)+56320);case 3:return N((15&_.charCodeAt(0))<<12|(63&_.charCodeAt(1))<<6|63&_.charCodeAt(2));default:return N((31&_.charCodeAt(0))<<6|63&_.charCodeAt(1))}},l=function(_){return _.replace(s,h)},c=function(_){var D=_.length,M=D%4,H=(D>0?U[_.charAt(0)]<<18:0)|(D>1?U[_.charAt(1)]<<12:0)|(D>2?U[_.charAt(2)]<<6:0)|(D>3?U[_.charAt(3)]:0),j=[N(H>>>16),N(H>>>8&255),N(H&255)];return j.length-=[0,0,2,1][M],j.join("")},y=z.atob&&typeof z.atob=="function"?function(_){return z.atob(_)}:function(_){return _.replace(/\S{1,4}/g,c)},f=function(_){return y(String(_).replace(/[^A-Za-z0-9\+\/]/g,""))},d=function(_){return l(y(_))},o=function(_){return String(_).replace(/[-_]/g,function(D){return D=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,"")},r=function(_){return d(o(_))},i;z.Uint8Array&&(i=function(_){return Uint8Array.from(f(o(_)),function(D){return D.charCodeAt(0)})});var g=function(){var _=z.Base64;return z.Base64=k,_};if(z.Base64={VERSION:v,atob:f,btoa:x,fromBase64:r,toBase64:u,utob:T,encode:u,encodeURI:t,btou:l,decode:r,noConflict:g,fromUint8Array:n,toUint8Array:i},typeof Object.defineProperty=="function"){var p=function(_){return{value:_,enumerable:!1,writable:!0,configurable:!0}};z.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",p(function(){return r(this)})),Object.defineProperty(String.prototype,"toBase64",p(function(_){return u(this,_)})),Object.defineProperty(String.prototype,"toBase64URI",p(function(){return u(this,!0)}))}}return z.Meteor&&(Base64=z.Base64),ut.exports?ut.exports.Base64=z.Base64:!(G=[],w=function(){return z.Base64}.apply(ot,G),w!==void 0&&(ut.exports=w)),{Base64:z.Base64}})}).call(this,ee("IyRk"))},JqQi:function(ut,ot,ee){ut.exports={bg:"bg___31owl",container:"container___2NGOo"}},LdHM:function(ut,ot,ee){"use strict";ee.d(ot,"b",function(){return s}),ee.d(ot,"a",function(){return l});var ge=ee("1OyB"),G=ee("vuIU"),w=ee("Ji7U"),z=ee("LK+K"),k=ee("q1tI"),v=ee("rePB"),F=ee("Ff2n"),U=ee("ODXe"),N=ee("4IlW"),R=ee("bX4T"),b=ee("YrtM"),T=ee("TSYQ"),C=ee.n(T),x=ee("+nKL"),S=ee("8OUc"),E=function(X,q){var ie=X.prefixCls,oe=X.id,Ce=X.flattenOptions,Ee=X.childrenAsData,Se=X.values,xe=X.searchValue,_e=X.multiple,fe=X.defaultActiveFirstOption,se=X.height,J=X.itemHeight,ue=X.notFoundContent,re=X.open,Te=X.menuItemSelectedIcon,Re=X.virtual,he=X.onSelect,Le=X.onToggleOpen,Be=X.onActiveValue,Ne=X.onScroll,Ie=X.onMouseEnter,de="".concat(ie,"-item"),ye=Object(b.a)(function(){return Ce},[re,Ce],function(Ze,me){return me[0]&&Ze[1]!==me[1]}),we=k.useRef(null),Oe=function(me){me.preventDefault()},ke=function(me){we.current&&we.current.scrollTo({index:me})},je=function(me){for(var ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,pe=ye.length,Z=0;Z1&&arguments[1]!==void 0?arguments[1]:!1;return Object(y.a)($).map(function(q,ie){if(!k.isValidElement(q)||!q.type)return null;var oe=q.type.isSelectOptGroup,Ce=q.key,Ee=q.props,Se=Ee.children,xe=Object(F.a)(Ee,["children"]);return X||!oe?f(q):Object(c.a)(Object(c.a)({key:"__RC_SELECT_GRP__".concat(Ce===null?ie:Ce,"__"),label:Ce},xe),{},{options:d(Se)})}).filter(function(q){return q})}var o=ee("2Qr1"),r=ee("qNPg"),i=ee("U8pU"),g=ee("Kwbf"),p=ee("WKfj");function _($){var X=$.mode,q=$.options,ie=$.children,oe=$.backfill,Ce=$.allowClear,Ee=$.placeholder,Se=$.getInputElement,xe=$.showSearch,_e=$.onSearch,fe=$.defaultOpen,se=$.autoFocus,J=$.labelInValue,ue=$.value,re=$.inputValue,Te=$.optionLabelProp,Re=X==="multiple"||X==="tags",he=xe!==void 0?xe:Re||X==="combobox",Le=q||d(ie);if(Object(g.a)(X!=="tags"||Le.every(function(de){return!de.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),X==="tags"||X==="combobox"){var Be=Le.some(function(de){return de.options?de.options.some(function(ye){return typeof("value"in ye?ye.value:ye.key)=="number"}):typeof("value"in de?de.value:de.key)=="number"});Object(g.a)(!Be,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(g.a)(X!=="combobox"||!Te,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(g.a)(X==="combobox"||!oe,"`backfill` only works with `combobox` mode."),Object(g.a)(X==="combobox"||!Se,"`getInputElement` only work with `combobox` mode."),Object(g.b)(X!=="combobox"||!Se||!Ce||!Ee,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),_e&&!he&&X!=="combobox"&&X!=="tags"&&Object(g.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(g.b)(!fe||se,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ue!=null){var Ne=Object(p.d)(ue);Object(g.a)(!J||Ne.every(function(de){return Object(i.a)(de)==="object"&&("key"in de||"value"in de)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(g.a)(!Re||Array.isArray(ue),"`value` should be array when `mode` is `multiple` or `tags`")}if(ie){var Ie=null;Object(y.a)(ie).some(function(de){if(!k.isValidElement(de)||!de.type)return!1;var ye=de.type;if(ye.isSelectOption)return!1;if(ye.isSelectOptGroup){var we=Object(y.a)(de.props.children).every(function(Oe){return!k.isValidElement(Oe)||!de.type||Oe.type.isSelectOption?!0:(Ie=Oe.type,!1)});return!we}return Ie=ye,!0}),Ie&&Object(g.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ie.displayName||Ie.name||Ie,"`.")),Object(g.a)(re===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var D=_,M=Object(r.a)({prefixCls:"rc-select",components:{optionList:t},convertChildrenToData:d,flattenOptions:o.d,getLabeledValue:o.e,filterOptions:o.b,isValueDisabled:o.g,findValueOption:o.c,warningProps:D,fillOptionsWithMissingValue:o.a}),H=function($){Object(w.a)(q,$);var X=Object(z.a)(q);function q(){var ie;return Object(ge.a)(this,q),ie=X.apply(this,arguments),ie.selectRef=k.createRef(),ie.focus=function(){ie.selectRef.current.focus()},ie.blur=function(){ie.selectRef.current.blur()},ie}return Object(G.a)(q,[{key:"render",value:function(){return k.createElement(M,Object.assign({ref:this.selectRef},this.props))}}]),q}(k.Component);H.Option=s,H.OptGroup=l;var j=H,V=ot.c=j},MRWH:function(ut,ot,ee){ut.exports={flex_box_center:"flex_box_center___30XbU",flex_space_between:"flex_space_between___3jfWA",flex_box_vertical_center:"flex_box_vertical_center___27kWs",flex_box_center_end:"flex_box_center_end___1RoAS",flex_box_column:"flex_box_column____3Jvr",list:"list___2NJ_T",box:"box___36KCF",title:"title___Kd2ce",gray:"gray___14ob6",brght:"brght___GgzyD",s1:"s1___IhDpz",s2:"s2___3hR0s",s3:"s3___23SCF",active:"active___2_5D5",line:"line___3Croa"}},NLgs:function(ut,ot,ee){"use strict";ee.d(ot,"e",function(){return u}),ee.d(ot,"f",function(){return t}),ee.d(ot,"d",function(){return s}),ee.d(ot,"c",function(){return h}),ee.d(ot,"a",function(){return l}),ee.d(ot,"b",function(){return c});var ge=ee("miYZ"),G=ee("tsqr"),w=ee("9og8"),z=ee("2qtc"),k=ee("kLXV"),v=ee("WmNS"),F=ee.n(v),U=ee("q1tI"),N=ee.n(U),R=ee("9kvl"),b=ee("xKgJ"),T=ee("1vsH"),C=ee("RCxd"),x=ee("yTi+"),S=ee.n(x),E=ee("m3rI"),u=function(f){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!!(t(f)&&n(d))},t=function(f){return Object(b.p)()?!0:(f({type:"user/showPopLogin",payload:{showPopLogin:!0,showClosable:!0}}),!1)},n=function(){var f,d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,o=Object(R.c)()._store.getState(),r=o.user;return(f=r.userInfo)!==null&&f!==void 0&&f.profile_completed?!0:(k.a.confirm({title:"\u63D0\u793A",width:530,centered:!0,content:d?"\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(){R.d.push("/account/profile/edit")}}),!1)},s=function(){var f,d=Object(R.c)()._store.getState(),o=d.user;return(f=o.userInfo)!==null&&f!==void 0&&f.professional_certification?!0:(k.a.confirm({title:"\u63D0\u793A",centered:!0,content:N.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(T.S)("/account/certification")}}),!1)},h=function(){var f;if(Object(b.a)())return!0;var d=Object(R.c)()._store.getState(),o=d.user,r=d.globalSetting;return k.a.warning({centered:!0,width:530,title:"\u63D0\u793A",content:N.a.createElement("div",{className:"tc",style:{marginLeft:-38}},N.a.createElement("p",null,"\u626B\u7801\u6DFB\u52A0\uFF0C\u7533\u8BF7\u64CD\u4F5C\u6743\u9650"),N.a.createElement("img",{src:E.a.IMG_SERVER+(r==null||((f=r.setting)===null||f===void 0)?void 0:f.authority_qrcode_url),width:200})),okText:"\u6211\u77E5\u9053\u4E86",maskClosable:!0}),!1},l=function(f,d){var o;if(f)return!0;var r=Object(R.c)()._store.getState(),i=r.user,g=r.globalSetting;return k.a.confirm({centered:!0,zIndex:1e4,width:530,title:"\u63D0\u793A",content:N.a.createElement("div",null,N.a.createElement("p",null,d||"\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"),N.a.createElement("div",{style:{marginLeft:"110px"}},N.a.createElement("img",{src:E.a.IMG_SERVER+(g==null||((o=g.setting)===null||o===void 0)?void 0:o.authority_qrcode_url),width:200}),N.a.createElement("div",{style:{marginLeft:"35px"}},"\u7FA4\u53F7\uFF1A","714336072"))),okText:"\u7ACB\u5373\u8054\u7CFB",cancelText:"\u53D6\u6D88",onOk:function(){Object(T.S)("https://qm.qq.com/cgi-bin/qm/qr?k=tIyDPXUtE0yEk-MOJxhH55lTUJS-nYAM&jump_from=webapi")}}),!1},c=function(f){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",o=Object(R.c)()._store.getState(),r=o.shixunsDetail.detail;return(r==null?void 0:r.public)===2||(r==null?void 0:r.public)===1||(r==null?void 0:r.shixun_status)===3?(k.a.info({centered:!0,icon:N.a.createElement(C.a,{style:{color:"#faad14"}}),width:460,title:"\u63D0\u793A",content:N.a.createElement("div",{className:"tc",style:{marginLeft:-38}},N.a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",paddingLeft:38,margin:"12px 0"}},N.a.createElement("span",null,"\u8BE5\u5B9E\u8DF5\u9879\u76EE\u7684\u72B6\u6001\u4E3A",(r==null?void 0:r.public)===2?"\u5DF2\u516C\u5F00":(r==null?void 0:r.public)===1?"\u5F85\u5BA1\u6838":"\u5DF2\u5173\u95ED","\uFF0C",d,"\u3002"),N.a.createElement("p",null,"\u5982\u6709\u9700\u8981\uFF0C\u8BF7\u8054\u7CFB\u5E73\u53F0\u7BA1\u7406\u5458\u8FDB\u884C\u6280\u672F\u652F\u6301\u3002")),N.a.createElement("img",{style:{border:"4px solid #0152d9",borderRadius:"4px"},src:S.a,alt:"\u4E8C\u7EF4\u7801",width:160})),okText:"\u6211\u77E5\u9053\u4E86"}),!0):(r==null?void 0:r.shixun_status)===2?(k.a.confirm({centered:!0,icon:N.a.createElement(C.a,null),title:"\u63D0\u793A",content:N.a.createElement("div",null,N.a.createElement("span",null,"\u8BE5\u5B9E\u8DF5\u9879\u76EE\u5DF2\u53D1\u5E03\uFF0C",d,"\u3002"),N.a.createElement("br",null),N.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(){k.a.confirm({width:440,centered:!0,icon:N.a.createElement(C.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 g=Object(w.a)(F.a.mark(function _(){var D;return F.a.wrap(function(H){for(;;)switch(H.prev=H.next){case 0:return H.next=2,f({type:"shixunsDetail/cancelRelease",payload:{id:r==null?void 0:r.identifier}});case 2:D=H.sent,D.status!==401&&(G.b.success("\u64A4\u9500\u53D1\u5E03\u6210\u529F\u3002\u5B9E\u8BAD\u56DE\u5230\u672A\u53D1\u5E03\u7684\u72B6\u6001\u3002"),f({type:"shixunsDetail/getShixunsDetail",payload:{id:r==null?void 0:r.identifier}}),f({type:"practiceSetting/getCommonData",payload:{id:r==null?void 0:r.identifier}}));case 4:case"end":return H.stop()}},_)}));function p(){return g.apply(this,arguments)}return p}()})}}),!0):!1}},OLES:function(ut,ot,ee){"use strict";var ge=ee("U8pU"),G=ee("VTBJ"),w=ee("Ff2n"),z=ee("q1tI"),k=ee("uciX"),v=ee("7ixt"),F=function(C){var x=C.overlay,S=C.prefixCls,E=C.id,u=C.overlayInnerStyle;return z.createElement("div",{className:"".concat(S,"-inner"),id:E,role:"tooltip",style:u},typeof x=="function"?x():x)},U=F,N=function(C,x){var S=C.overlayClassName,E=C.trigger,u=E===void 0?["hover"]:E,t=C.mouseEnterDelay,n=t===void 0?0:t,s=C.mouseLeaveDelay,h=s===void 0?.1:s,l=C.overlayStyle,c=C.prefixCls,y=c===void 0?"rc-tooltip":c,f=C.children,d=C.onVisibleChange,o=C.afterVisibleChange,r=C.transitionName,i=C.animation,g=C.placement,p=g===void 0?"right":g,_=C.align,D=_===void 0?{}:_,M=C.destroyTooltipOnHide,H=M===void 0?!1:M,j=C.defaultVisible,V=C.getTooltipContainer,$=C.overlayInnerStyle,X=Object(w.a)(C,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),q=Object(z.useRef)(null);Object(z.useImperativeHandle)(x,function(){return q.current});var ie=Object(G.a)({},X);"visible"in C&&(ie.popupVisible=C.visible);var oe=function(){var _e=C.arrowContent,fe=_e===void 0?null:_e,se=C.overlay,J=C.id;return[z.createElement("div",{className:"".concat(y,"-arrow"),key:"arrow"},fe),z.createElement(U,{key:"content",prefixCls:y,id:J,overlay:se,overlayInnerStyle:$})]},Ce=!1,Ee=!1;if(typeof H=="boolean")Ce=H;else if(H&&Object(ge.a)(H)==="object"){var Se=H.keepParent;Ce=Se===!0,Ee=Se===!1}return z.createElement(k.a,Object.assign({popupClassName:S,prefixCls:y,popup:oe,action:u,builtinPlacements:v.a,popupPlacement:p,ref:q,popupAlign:D,getPopupContainer:V,onPopupVisibleChange:d,afterPopupVisibleChange:o,popupTransitionName:r,popupAnimation:i,defaultPopupVisible:j,destroyPopupOnHide:Ce,autoDestroy:Ee,mouseLeaveDelay:h,popupStyle:l,mouseEnterDelay:n},ie),f)},R=Object(z.forwardRef)(N),b=ot.a=R},P5Jw:function(ut,ot,ee){"use strict";var ge=ee("rHrb"),G=ge.CopyToClipboard;G.CopyToClipboard=G,ut.exports=G},SJMd:function(ut,ot){/**
* @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 ee,ge,G,w=!1,z,k;window.PR_SHOULD_USE_CONTINUATION=!0;var v,F;(function(){var U=window,N=["break,continue,do,else,for,if,return,while"],R=[N,"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"],b=[R,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],T=[b,"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"],C=[b,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],x=[b,"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"],S="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",E=[b,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],u="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",t=[N,"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"],n=[N,"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=[N,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],h=[T,x,C,E,u,t,n,s],l=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,c="str",y="kwd",f="com",d="typ",o="lit",r="pun",i="pln",g="tag",p="dec",_="src",D="atn",M="atv",H="nocode",j="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function V(he){for(var Le=0,Be=!1,Ne=!1,Ie=0,de=he.length;Ie122||(Z<65||pe>90||dt.push([Math.max(65,pe)|32,Math.min(Z,90)|32]),Z<97||pe>122||dt.push([Math.max(97,pe)&~32,Math.min(Z,122)&~32]))}}dt.sort(function(Ae,De){return Ae[0]-De[0]||De[1]-Ae[1]});for(var te=[],ae=[],Ze=0;Zene[0]&&(ne[1]+1>ne[0]&&We.push("-"),We.push(ke(ne[1])))}return We.push("]"),We.join("")}function it(et){for(var Ke=et.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")),dt=Ke.length,ft=[],We=0,Ze=0;We=2&&pe==="["?Ke[We]=je(me):pe!=="\\"&&(Ke[We]=me.replace(/[a-zA-Z]/g,function(ae){var ne=ae.charCodeAt(0);return"["+String.fromCharCode(ne&~32,ne|32)+"]"}))}return Ke.join("")}for(var at=[],Ie=0,de=he.length;Ie=0;)Be[at.charAt(et)]=it;var Ke=it[1],dt=""+Ke;Oe.hasOwnProperty(dt)||(we.push(Ke),Oe[dt]=null)}we.push(/[\0-\uffff]/),Ne=V(we)})();var Ie=Le.length,de=function(ye){for(var we=ye.sourceCode,Oe=ye.basePos,ke=ye.sourceNode,je=[Oe,i],it=0,at=we.match(Ne)||[],et={},Ke=0,dt=at.length;Ke=5&&We.substring(0,5)==="lang-",me&&!(Ze&&typeof Ze[1]=="string")&&(me=!1,We=_),me||(et[ft]=We)}var Z=it;if(it+=ft.length,!me)je.push(Oe+Z,We);else{var te=Ze[1],ae=ft.indexOf(te),ne=ae+te.length;Ze[2]&&(ne=ft.length-Ze[2].length,ae=ne-te.length);var Ae=We.substring(5);X(ke,Oe+Z,ft.substring(0,ae),de,je),X(ke,Oe+Z+ae,te,se(Ae,te),je),X(ke,Oe+Z+ne,ft.substring(ne),de,je)}}ye.decorations=je};return de}function Ce(he){var Le=[],Be=[];he.tripleQuotedStrings?Le.push([c,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):he.multiLineStrings?Le.push([c,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Le.push([c,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),he.verbatimStrings&&Be.push([c,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ne=he.hashComments;Ne&&(he.cStyleComments?(Ne>1?Le.push([f,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Le.push([f,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Be.push([c,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Le.push([f,/^#[^\r\n]*/,null,"#"])),he.cStyleComments&&(Be.push([f,/^\/\/[^\r\n]*/,null]),Be.push([f,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ie=he.regexLiterals;if(Ie){var de=Ie>1?"":`
\r`,ye=de?".":"[\\S\\s]",we="/(?=[^/*"+de+"])(?:[^/\\x5B\\x5C"+de+"]|\\x5C"+ye+"|\\x5B(?:[^\\x5C\\x5D"+de+"]|\\x5C"+ye+")*(?:\\x5D|$))+/";Be.push(["lang-regex",RegExp("^"+j+"("+we+")")])}var Oe=he.types;Oe&&Be.push([d,Oe]);var ke=(""+he.keywords).replace(/^ | $/g,"");ke.length&&Be.push([y,new RegExp("^(?:"+ke.replace(/[\s,]+/g,"|")+")\\b"),null]),Le.push([i,/^\s+/,null,` \r
\xA0`]);var je="^.[^\\s\\w.$@'\"`/\\\\]*";return he.regexLiterals&&(je+="(?!s*/)"),Be.push([o,/^@[a-z_$][a-z_$@0-9]*/i,null],[d,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[i,/^[a-z_$][a-z_$@0-9]*/i,null],[o,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[i,/^\\[\s\S]?/,null],[r,new RegExp(je),null]),oe(Le,Be)}var Ee=Ce({keywords:h,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Se(he,Le,Be){for(var Ne=/(?:^|\s)nocode(?:\s|$)/,Ie=/\r\n?|\n/,de=he.ownerDocument,ye=de.createElement("li");he.firstChild;)ye.appendChild(he.firstChild);var we=[ye];function Oe(Ke){var dt=Ke.nodeType;if(dt==1&&!Ne.test(Ke.className))if(Ke.nodeName==="br")ke(Ke),Ke.parentNode&&Ke.parentNode.removeChild(Ke);else for(var ft=Ke.firstChild;ft;ft=ft.nextSibling)Oe(ft);else if((dt==3||dt==4)&&Be){var We=Ke.nodeValue,Ze=We.match(Ie);if(Ze){var me=We.substring(0,Ze.index);Ke.nodeValue=me;var ve=We.substring(Ze.index+Ze[0].length);if(ve){var pe=Ke.parentNode;pe.insertBefore(de.createTextNode(ve),Ke.nextSibling)}ke(Ke),me||Ke.parentNode.removeChild(Ke)}}}function ke(Ke){for(;!Ke.nextSibling;)if(Ke=Ke.parentNode,!Ke)return;function dt(Ze,me){var ve=me?Ze.cloneNode(!1):Ze,pe=Ze.parentNode;if(pe){var Z=dt(pe,1),te=Ze.nextSibling;Z.appendChild(ve);for(var ae=te;ae;ae=te)te=ae.nextSibling,Z.appendChild(ae)}return ve}for(var ft=dt(Ke.nextSibling,0),We;(We=ft.parentNode)&&We.nodeType===1;)ft=We;we.push(ft)}for(var je=0;je=pe&&(Oe+=2),de>=Z&&(it+=2)}}finally{We&&(We.style.display=Ze)}}var _e={};function fe(he,Le){for(var Be=Le.length;--Be>=0;){var Ne=Le[Be];_e.hasOwnProperty(Ne)?U.console&&console.warn("cannot override language handler %s",Ne):_e[Ne]=he}}function se(he,Le){return he&&_e.hasOwnProperty(he)||(he=/^\s*]*(?:>|$)/],[f,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[r,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^