You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/p__RestFul.293bf4d0.async.js

324 lines
681 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[245,7,8],{"55Ip":function(Ve,Ie,ie){"use strict";ie.d(Ie,"a",function(){return s});var ve=ie("Ty5D"),U=ie("dI71"),C=ie("q1tI"),j=ie.n(C),O=ie("YS25"),x=ie("17x9"),K=ie.n(x),M=ie("wx14"),R=ie("zLVn"),L=ie("9R94"),y=function(r){Object(U.a)(t,r);function t(){for(var g,p=arguments.length,S=new Array(p),k=0;k<p;k++)S[k]=arguments[k];return g=r.call.apply(r,[this].concat(S))||this,g.history=Object(O.a)(g.props),g}var n=t.prototype;return n.render=function(){return j.a.createElement(ve.c,{history:this.history,children:this.props.children})},t}(j.a.Component),T=function(r){Object(U.a)(t,r);function t(){for(var g,p=arguments.length,S=new Array(p),k=0;k<p;k++)S[k]=arguments[k];return g=r.call.apply(r,[this].concat(S))||this,g.history=Object(O.b)(g.props),g}var n=t.prototype;return n.render=function(){return j.a.createElement(ve.c,{history:this.history,children:this.props.children})},t}(j.a.Component),w=function(t,n){return typeof t=="function"?t(n):t},E=function(t,n){return typeof t=="string"?Object(O.c)(t,null,null,n):t},b=function(t){return t},v=j.a.forwardRef;typeof v=="undefined"&&(v=b);function l(r){return!!(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)}var e=v(function(r,t){var n=r.innerRef,g=r.navigate,p=r.onClick,S=Object(R.a)(r,["innerRef","navigate","onClick"]),k=S.target,I=Object(M.a)({},S,{onClick:function(V){try{p&&p(V)}catch(J){throw V.preventDefault(),J}!V.defaultPrevented&&V.button===0&&(!k||k==="_self")&&!l(V)&&(V.preventDefault(),g())}});return b!==v?I.ref=t||n:I.ref=n,j.a.createElement("a",I)}),s=v(function(r,t){var n=r.component,g=n===void 0?e:n,p=r.replace,S=r.to,k=r.innerRef,I=Object(R.a)(r,["component","replace","to","innerRef"]);return j.a.createElement(ve.e.Consumer,null,function(G){G||Object(L.a)(!1);var V=G.history,J=E(w(S,G.location),G.location),re=J?V.createHref(J):"",ee=Object(M.a)({},I,{href:re,navigate:function(){var be=w(S,G.location),he=p?V.replace:V.push;he(be)}});return b!==v?ee.ref=t||k:ee.innerRef=k,j.a.createElement(g,ee)})});if(!1)var a,c;var d=function(t){return t},o=j.a.forwardRef;typeof o=="undefined"&&(o=d);function f(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];return t.filter(function(g){return g}).join(" ")}var u=o(function(r,t){var n=r["aria-current"],g=n===void 0?"page":n,p=r.activeClassName,S=p===void 0?"active":p,k=r.activeStyle,I=r.className,G=r.exact,V=r.isActive,J=r.location,re=r.sensitive,ee=r.strict,ae=r.style,be=r.to,he=r.innerRef,me=Object(R.a)(r,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return j.a.createElement(ve.e.Consumer,null,function(ce){ce||Object(L.a)(!1);var te=J||ce.location,q=E(w(be,te),te),oe=q.pathname,Z=oe&&oe.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),D=Z?Object(ve.f)(te.pathname,{path:Z,exact:G,sensitive:re,strict:ee}):null,h=!!(V?V(D,te):D),m=h?f(I,S):I,P=h?Object(M.a)({},ae,{},k):ae,_=Object(M.a)({"aria-current":h&&g||null,className:m,style:P,to:q},me);return d!==o?_.ref=t||he:_.innerRef=he,j.a.createElement(s,_)})});if(!1)var i},"815F":function(Ve,Ie,ie){"use strict";ie.d(Ie,"e",function(){return K}),ie.d(Ie,"c",function(){return R}),ie.d(Ie,"d",function(){return L}),ie.d(Ie,"a",function(){return T}),ie.d(Ie,"f",function(){return w}),ie.d(Ie,"b",function(){return E});var ve=ie("KQm4"),U=ie("VTBJ"),C=ie("Ff2n"),j=ie("Zm9Q"),O=ie("Kwbf"),x=ie("OZM5");function K(b,v){return b!=null?b:v}function M(){var b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],v=new Map;function l(e){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(e||[]).forEach(function(a){var c=a.key,d=a.children;Object(O.a)(c!=null,"Tree node must have a certain key: [".concat(s).concat(c,"]"));var o=String(c);Object(O.a)(!v.has(o)||c===null||c===void 0,"Same 'key' exist in the Tree: ".concat(o)),v.set(o,!0),l(d,"".concat(s).concat(o," > "))})}l(b)}function R(b){function v(l){var e=Object(j.a)(l);return e.map(function(s){if(!Object(x.i)(s))return Object(O.a)(!s,"Tree/TreeNode can only accept TreeNode as children."),null;var a=s.key,c=s.props,d=c.children,o=Object(C.a)(c,["children"]),f=Object(U.a)({key:a},o),u=v(d);return u.length&&(f.children=u),f}).filter(function(s){return s})}return v(b)}function L(){var b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],l=new Set(v===!0?[]:v),e=[];function s(a){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return a.map(function(d,o){var f=Object(x.h)(c?c.pos:"0",o),u=K(d.key,f),i=Object(U.a)(Object(U.a)({},d),{},{parent:c,pos:f,children:null,data:d,isStart:[].concat(Object(ve.a)(c?c.isStart:[]),[o===0]),isEnd:[].concat(Object(ve.a)(c?c.isEnd:[]),[o===a.length-1])});return e.push(i),v===!0||l.has(u)?i.children=s(d.children||[],i):i.children=[],i})}return s(b),e}function y(b,v,l){var e;l?typeof l=="string"?e=function(c){return c[l]}:typeof l=="function"&&(e=function(c){return l(c)}):e=function(c,d){return K(c.key,d)};function s(a,c,d){var o=a?a.children:b,f=a?Object(x.h)(d.pos,c):"0";if(a){var u=e(a,f),i={node:a,index:c,pos:f,key:u,parentPos:d.node?d.pos:null,level:d.level+1};v(i)}o&&o.forEach(function(r,t){s(r,t,{node:a,pos:f,level:d?d.level+1:-1})})}s(null)}function T(b){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=v.initWrapper,e=v.processEntity,s=v.onProcessFinished,a=arguments.length>2?arguments[2]:void 0,c={},d={},o={posEntities:c,keyEntities:d};return l&&(o=l(o)||o),y(b,function(f){var u=f.node,i=f.index,r=f.pos,t=f.key,n=f.parentPos,g=f.level,p={node:u,index:i,key:t,pos:r,level:g},S=K(t,r);c[r]=p,d[S]=p,p.parent=c[n],p.parent&&(p.parent.children=p.parent.children||[],p.parent.children.push(p)),e&&e(p,o)},a),s&&s(o),o}function w(b,v){var l=v.expandedKeys,e=v.selectedKeys,s=v.loadedKeys,a=v.loadingKeys,c=v.checkedKeys,d=v.halfCheckedKeys,o=v.dragOverNodeKey,f=v.dropPosition,u=v.keyEntities,i=u[b],r={eventKey:b,expanded:l.indexOf(b)!==-1,selected:e.indexOf(b)!==-1,loaded:s.indexOf(b)!==-1,loading:a.indexOf(b)!==-1,checked:c.indexOf(b)!==-1,halfChecked:d.indexOf(b)!==-1,pos:String(i?i.pos:""),dragOver:o===b&&f===0,dragOverGapTop:o===b&&f===-1,dragOverGapBottom:o===b&&f===1};return r}function E(b){var v=b.data,l=b.expanded,e=b.selected,s=b.checked,a=b.loaded,c=b.loading,d=b.halfChecked,o=b.dragOver,f=b.dragOverGapTop,u=b.dragOverGapBottom,i=b.pos,r=b.active,t=Object(U.a)(Object(U.a)({},v),{},{expanded:l,selected:e,checked:s,loaded:a,loading:c,halfChecked:d,dragOver:o,dragOverGapTop:f,dragOverGapBottom:u,pos:i,active:r});return"props"in t||Object.defineProperty(t,"props",{get:function(){return Object(O.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),b}}),t}},"8Jsi":function(Ve,Ie,ie){"use strict";ie.d(Ie,"d",function(){return n}),ie.d(Ie,"a",function(){return P}),ie.d(Ie,"b",function(){return A}),ie.d(Ie,"c",function(){return _});var ve=ie("1OyB"),U=ie("vuIU"),C=ie("Ji7U"),j=ie("LK+K"),O=ie("KQm4"),x=ie("U8pU"),K=ie("ODXe"),M=ie("VTBJ"),R=ie("q1tI"),L=ie("qNPg"),y=ie("2Qr1"),T=ie("815F"),w=ie("NvD2"),E=ie("wPlo"),b=ie("6cGi"),v=ie("Kwbf"),l=ie("4IlW"),e=ie("YrtM"),s=ie("fAei"),a=R.createContext(null);function c(se,pe){if(!se)return!0;var ge=se.data,xe=ge.disabled,Te=ge.disableCheckbox;switch(pe){case"select":return xe;case"checkbox":return xe||Te}return!1}function d(se,pe){var ge=R.useCallback(function(Te){var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"select",ye=arguments.length>2?arguments[2]:void 0,Le=se.get(Te);return!ye&&c(Le,Se)?null:Le},[se]),xe=R.useCallback(function(Te){var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"select",ye=arguments.length>2?arguments[2]:void 0,Le=pe.get(Te);return!ye&&c(Le,Se)?null:Le},[pe]);return[ge,xe]}function o(se){return R.useMemo(function(){var pe=new Map,ge=new Map;return se.forEach(function(xe){pe.set(xe.key,xe),ge.set(xe.data.value,xe)}),[pe,ge]},[se])}var f={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},u=function(pe,ge){var xe=pe.prefixCls,Te=pe.height,Se=pe.itemHeight,ye=pe.virtual,Le=pe.options,Re=pe.flattenOptions,z=pe.multiple,N=pe.searchValue,B=pe.onSelect,H=pe.onToggleOpen,X=pe.open,F=pe.notFoundContent,W=pe.onMouseEnter,$=R.useContext(a),Q=$.checkable,de=$.checkedKeys,le=$.halfCheckedKeys,Ce=$.treeExpandedKeys,Oe=$.treeDefaultExpandAll,Me=$.treeDefaultExpandedKeys,Pe=$.onTreeExpand,je=$.treeIcon,Fe=$.showTreeIcon,_e=$.switcherIcon,qe=$.treeLine,ze=$.treeNodeFilterProp,Qe=$.loadData,$e=$.treeLoadedKeys,He=$.treeMotion,rt=$.onTreeLoad,it=R.useRef(),Je=Object(e.a)(function(){return Le},[X,Le],function(dt,at){return at[0]&&dt[1]!==at[1]}),lt=o(Re),Ye=Object(K.a)(lt,2),ot=Ye[0],tt=Ye[1],nt=d(ot,tt),ft=Object(K.a)(nt,2),et=ft[0],Be=ft[1],ke=R.useMemo(function(){return de.map(function(dt){var at=Be(dt);return at?at.key:null})},[de]),Ge=R.useMemo(function(){return Q?{checked:ke,halfChecked:le}:null},[ke,le,Q]);R.useEffect(function(){if(X&&!z&&ke.length){var dt;(dt=it.current)===null||dt===void 0||dt.scrollTo({key:ke[0]})}},[X]);var Ne=String(N).toLowerCase(),Ke=function(at){return Ne?String(at[ze]).toLowerCase().includes(Ne):!1},Ue=R.useState(Me),Ze=Object(K.a)(Ue,2),Xe=Ze[0],gt=Ze[1],vt=R.useState(null),Lt=Object(K.a)(vt,2),St=Lt[0],Nt=Lt[1],Rt=R.useMemo(function(){return Ce?Object(O.a)(Ce):N?St:Xe},[Xe,St,Ne,Ce]);R.useEffect(function(){N&&Nt(Re.map(function(dt){return dt.key}))},[N]);var Bt=function(at){gt(at),Nt(at),Pe&&Pe(at)},kt=function(at){at.preventDefault()},Ct=function(at,ut){var We=ut.node.key,ht=et(We,Q?"checkbox":"select");ht!==null&&B(ht.data.value,{selected:!de.includes(ht.data.value)}),z||H(!1)},Pt=R.useState(null),Mt=Object(K.a)(Pt,2),Dt=Mt[0],Ut=Mt[1],Ot=et(Dt);if(R.useImperativeHandle(ge,function(){return{onKeyDown:function(at){var ut,We=at.which;switch(We){case l.a.UP:case l.a.DOWN:case l.a.LEFT:case l.a.RIGHT:(ut=it.current)===null||ut===void 0||ut.onKeyDown(at);break;case l.a.ENTER:{Ot!==null&&Ct(null,{node:{key:Dt},selected:!de.includes(Ot.data.value)});break}case l.a.ESC:H(!1)}},onKeyUp:function(){}}}),Je.length===0)return R.createElement("div",{role:"listbox",className:"".concat(xe,"-empty"),onMouseDown:kt},F);var It={};return $e&&(It.loadedKeys=$e),Rt&&(It.expandedKeys=Rt),R.createElement("div",{onMouseDown:kt,onMouseEnter:W},Ot&&X&&R.createElement("span",{style:f,"aria-live":"assertive"},Ot.data.value),R.createElement(s.b,Object.assign({ref:it,focusable:!1,prefixCls:"".concat(xe,"-tree"),treeData:Je,height:Te,itemHeight:Se,virtual:ye,multiple:z,icon:je,showIcon:Fe,switcherIcon:_e,showLine:qe,loadData:N?null:Qe,motion:He,checkable:Q,checkStrictly:!0,checkedKeys:Ge,selectedKeys:Q?[]:ke,defaultExpandAll:Oe},It,{onActiveChange:Ut,onSelect:Ct,onCheck:Ct,onExpand:Bt,onLoad:rt,filterTreeNode:Ke})))},i=R.forwardRef(u);i.displayName="OptionList";var r=i,t=function(){return null},n=t,g=ie("Ff2n"),p=ie("Zm9Q");function S(se){return Object(p.a)(se).map(function(pe){if(!R.isValidElement(pe)||!pe.type)return null;var ge=pe.key,xe=pe.props,Te=xe.children,Se=xe.value,ye=Object(g.a)(xe,["children","value"]),Le=Object(M.a)({key:ge,value:Se},ye),Re=S(Te);return Re.length&&(Le.children=Re),Le}).filter(function(pe){return pe})}function k(se){if(!se)return se;var pe=Object(M.a)({},se);return"props"in pe||Object.defineProperty(pe,"props",{get:function(){return Object(v.a)(!1,"New `rc-tree-select` not support return node instance as argument anymore. Please consider to remove `props` access."),pe}}),pe}function I(se,pe,ge,xe,Te){var Se=null,ye=null;function Le(){function Re(z){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"0",B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return z.map(function(H,X){var F="".concat(N,"-").concat(X),W=ge.includes(H.value),$=Re(H.children||[],F,W),Q=R.createElement(n,Object.assign({},H),$.map(function(le){return le.node}));if(pe===H.value&&(Se=Q),W){var de={pos:F,node:Q,children:$};return B||ye.push(de),de}return null}).filter(function(H){return H})}ye||(ye=[],Re(xe),ye.sort(function(z,N){var B=z.node.props.value,H=N.node.props.value,X=ge.indexOf(B),F=ge.indexOf(H);return X-F}))}Object.defineProperty(se,"triggerNode",{get:function(){return Object(v.a)(!1,"`triggerNode` is deprecated. Please consider decoupling data with node."),Le(),Se}}),Object.defineProperty(se,"allCheckedNodes",{get:function(){return Object(v.a)(!1,"`allCheckedNodes` is deprecated. Please consider decoupling data with node."),Le(),Te?ye:ye.map(function(z){var N=z.node;return N})}})}function G(se){return Array.isArray(se)?se:se!==void 0?[se]:[]}function V(se,pe){var ge=new Map;return pe.forEach(function(xe){var Te=xe.data;ge.set(Te.value,Te)}),se.map(function(xe){return k(ge.get(xe))})}function J(se,pe){var ge=V([se],pe)[0];return ge?ge.disabled:!1}function re(se){return se.disabled||se.disableCheckbox||se.checkable===!1}function ee(se){for(var pe=se.parent,ge=0,xe=pe;xe;)xe=xe.parent,ge+=1;return ge}function ae(se){function pe(xe){return(xe||[]).map(function(Te){var Se=Te.value,ye=Te.key,Le=Te.children,Re=Object(M.a)(Object(M.a)({},Te),{},{key:"key"in Te?ye:Se});return Le&&(Re.children=pe(Le)),Re})}var ge=Object(T.d)(pe(se),!0);return ge.map(function(xe){return{key:xe.data.key,data:xe.data,level:ee(xe)}})}function be(se){return function(pe,ge){var xe=ge[se];return String(xe).toLowerCase().includes(String(pe).toLowerCase())}}function he(se,pe,ge){var xe=ge.optionFilterProp,Te=ge.filterOption;if(Te===!1)return pe;var Se;typeof Te=="function"?Se=Te:Se=be(xe);function ye(Le){var Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Le.map(function(z){var N=z.children,B=Re||Se(se,k(z)),H=ye(N||[],B);return B||H.length?Object(M.a)(Object(M.a)({},z),{},{children:H}):null}).filter(function(z){return z})}return ye(pe)}function me(se,pe,ge,xe){var Te=new Map;return G(pe).forEach(function(Se){Se&&Object(x.a)(Se)==="object"&&"value"in Se&&Te.set(Se.value,Se)}),se.map(function(Se){var ye={value:Se},Le=ge(Se,"select",!0),Re=Le?xe(Le.data):Se;if(Te.has(Se)){var z=Te.get(Se);ye.label="label"in z?z.label:Re,"halfChecked"in z&&(ye.halfChecked=z.halfChecked)}else ye.label=Re;return ye})}function ce(se,pe){var ge=new Set(se);return ge.add(pe),Array.from(ge)}function te(se,pe){var ge=new Set(se);return ge.delete(pe),Array.from(ge)}function q(se){var pe=se.searchPlaceholder,ge=se.treeCheckStrictly,xe=se.treeCheckable,Te=se.labelInValue,Se=se.value,ye=se.multiple;Object(v.a)(!pe,"`searchPlaceholder` has been removed."),ge&&Te===!1&&Object(v.a)(!1,"`treeCheckStrictly` will force set `labelInValue` to `true`."),(Te||ge)&&Object(v.a)(G(Se).every(function(Le){return Le&&Object(x.a)(Le)==="object"&&"value"in Le}),"Invalid prop `value` supplied to `TreeSelect`. You should use { label: string, value: string | number } or [{ label: string, value: string | number }] instead."),ge||ye||xe?Object(v.a)(!Se||Array.isArray(Se),"`value` should be an array when `TreeSelect` is checkable or multiple."):Object(v.a)(!Array.isArray(Se),"`value` should not be array when `TreeSelect` is single mode.")}var oe=q,Z=10;function D(se,pe){var ge=pe.id,xe=pe.pId,Te=pe.rootPId,Se={},ye=[],Le=se.map(function(Re){var z=Object(M.a)({},Re),N=z[ge];return Se[N]=z,z.key=z.key||N,z});return Le.forEach(function(Re){var z=Re[xe],N=Se[z];N&&(N.children=N.children||[],N.children.push(Re)),(z===Te||!N&&Te===null)&&ye.push(Re)}),ye}function h(se,pe){var ge=0,xe=new Set;function Te(Se){return(Se||[]).map(function(ye){var Le=ye.key,Re=ye.value,z=ye.children,N=Object(g.a)(ye,["key","value","children"]),B="value"in ye?Re:Le,H=Object(M.a)(Object(M.a)({},N),{},{key:Le!=null?Le:B,value:B,title:pe(ye)});return"children"in ye&&(H.children=Te(z)),H})}return Te(se)}function m(se,pe,ge){var xe=ge.getLabelProp,Te=ge.simpleMode,Se=R.useRef({});return se?(Se.current.formatTreeData=Se.current.treeData===se?Se.current.formatTreeData:h(Te?D(se,Object(M.a)({id:"id",pId:"pId",rootPId:null},Te!==!0?Te:{})):se,xe),Se.current.treeData=se):Se.current.formatTreeData=Se.current.children===pe?Se.current.formatTreeData:h(S(pe),xe),Se.current.formatTreeData}var P="SHOW_ALL",_="SHOW_PARENT",A="SHOW_CHILD";function Y(se,pe,ge){var xe=new Set(se);return pe===A?se.filter(function(Te){var Se=ge[Te];return!(Se&&Se.children&&Se.children.every(function(ye){var Le=ye.node;return re(Le)||xe.has(Le.key)}))}):pe===_?se.filter(function(Te){var Se=ge[Te],ye=Se?Se.parent:null;return!(ye&&!re(ye.node)&&xe.has(ye.node.key))}):se}function ne(se,pe){var ge=pe.value,xe=pe.getEntityByValue,Te=pe.getEntityByKey,Se=pe.treeConduction,ye=pe.showCheckedStrategy,Le=pe.conductKeyEntities,Re=pe.getLabelProp;return R.useMemo(function(){var z=se;if(Se){var N=Y(se.map(function(B){var H=xe(B);return H?H.key:B}),ye,Le);z=N.map(function(B){var H=Te(B);return H?H.data.value:B})}return me(z,ge,xe,Re)},[se,ge,Se,ye,xe])}var ue=["expandedKeys","treeData","treeCheckable","showCheckedStrategy","searchPlaceholder","treeLine","treeIcon","showTreeIcon","switcherIcon","treeNodeFilterProp","filterTreeNode","dropdownPopupAlign","treeDefaultExpandAll","treeCheckStrictly","treeExpandedKeys","treeLoadedKeys","treeMotion","onTreeExpand","onTreeLoad","loadData","treeDataSimpleMode","treeNodeLabelProp","treeDefaultExpandedKeys"],fe=Object(L.a)({prefixCls:"rc-tree-select",components:{optionList:r},convertChildrenToData:function(){return null},flattenOptions:ae,getLabeledValue:y.e,filterOptions:he,isValueDisabled:J,findValueOption:V,omitDOMProps:function(pe){var ge=Object(M.a)({},pe);return ue.forEach(function(xe){delete ge[xe]}),ge}});fe.displayName="Select";var Ee=R.forwardRef(function(se,pe){var ge=se.multiple,xe=se.treeCheckable,Te=se.treeCheckStrictly,Se=se.showCheckedStrategy,ye=Se===void 0?"SHOW_CHILD":Se,Le=se.labelInValue,Re=se.loadData,z=se.treeLoadedKeys,N=se.treeNodeFilterProp,B=N===void 0?"value":N,H=se.treeNodeLabelProp,X=se.treeDataSimpleMode,F=se.treeData,W=se.treeExpandedKeys,$=se.treeDefaultExpandedKeys,Q=se.treeDefaultExpandAll,de=se.children,le=se.treeIcon,Ce=se.showTreeIcon,Oe=se.switcherIcon,Me=se.treeLine,Pe=se.treeMotion,je=se.filterTreeNode,Fe=se.dropdownPopupAlign,_e=se.onChange,qe=se.onTreeExpand,ze=se.onTreeLoad,Qe=se.onDropdownVisibleChange,$e=se.onSelect,He=se.onDeselect,rt=xe||Te,it=ge||rt,Je=xe&&!Te,lt=Te||Le,Ye=R.useRef(null);R.useImperativeHandle(pe,function(){return{focus:Ye.current.focus,blur:Ye.current.blur}});var ot=function(We){return F&&We.label||We.title},tt=function(We){return H?We[H]:ot(We)},nt=m(F,de,{getLabelProp:ot,simpleMode:X}),ft=Object(R.useMemo)(function(){return ae(nt)},[nt]),et=o(ft),Be=Object(K.a)(et,2),ke=Be[0],Ge=Be[1],Ne=d(ke,Ge),Ke=Object(K.a)(Ne,2),Ue=Ke[0],Ze=Ke[1],Xe=Object(R.useMemo)(function(){return Je?Object(T.a)(nt):{keyEntities:null}},[nt,xe,Te]),gt=Xe.keyEntities,vt=Object(b.a)(se.defaultValue,{value:se.value}),Lt=Object(K.a)(vt,2),St=Lt[0],Nt=Lt[1],Rt=function(We){var ht=[],yt=[];return We.forEach(function(ct){Ze(ct)?yt.push(ct):ht.push(ct)}),{missingRawValues:ht,existRawValues:yt}},Bt=Object(R.useMemo)(function(){var ut=[],We=[];if(G(St).forEach(function(st){if(st&&Object(x.a)(st)==="object"&&"value"in st)if(st.halfChecked&&Te){var Et=Ze(st.value);ut.push(Et?Et.key:st.value)}else We.push(st.value);else We.push(st)}),Je){var ht=Rt(We),yt=ht.missingRawValues,ct=ht.existRawValues,bt=ct.map(function(st){return Ze(st).key}),Tt=Object(w.a)(bt,!0,gt),wt=Tt.checkedKeys,At=Tt.halfCheckedKeys;return[[].concat(Object(O.a)(yt),Object(O.a)(wt.map(function(st){return Ue(st).data.value}))),At]}return[We,ut]},[St,it,lt,xe,Te]),kt=Object(K.a)(Bt,2),Ct=kt[0],Pt=kt[1],Mt=ne(Ct,{treeConduction:Je,value:St,showCheckedStrategy:ye,conductKeyEntities:gt,getEntityByValue:Ze,getEntityByKey:Ue,getLabelProp:tt}),Dt=function(We,ht,yt){if(Nt(it?We:We[0]),_e){var ct=We;if(Je&&ye!=="SHOW_ALL"){var bt=We.map(function(mt){var xt=Ze(mt);return xt?xt.key:mt}),Tt=Y(bt,ye,gt);ct=Tt.map(function(mt){var xt=Ue(mt);return xt?xt.data.value:mt})}var wt=ht||{triggerValue:void 0,selected:void 0},At=wt.triggerValue,st=wt.selected,Et=lt?me(ct,St,Ze,tt):ct;if(Te){var _t=Pt.map(function(mt){var xt=Ue(mt);return xt?xt.data.value:mt}).filter(function(mt){return!ct.includes(mt)});Et=[].concat(Object(O.a)(Et),Object(O.a)(me(_t,St,Ze,tt)))}var pt={preValue:Mt,triggerValue:At},Ft=!0;(Te||yt==="selection"&&!st)&&(Ft=!1),I(pt,At,We,nt,Ft),rt?pt.checked=st:pt.selected=st,_e(it?Et:Et[0],lt?null:ct.map(function(mt){var xt=Ze(mt);return xt?tt(xt.data):null}),pt)}},Ut=function(We,ht,yt){var ct=We;if(!it)Dt([We],{selected:!0,triggerValue:We},yt);else{var bt=ce(Ct,We);if(Je){var Tt=Rt(bt),wt=Tt.missingRawValues,At=Tt.existRawValues,st=At.map(function(pt){return Ze(pt).key}),Et=Object(w.a)(st,!0,gt),_t=Et.checkedKeys;bt=[].concat(Object(O.a)(wt),Object(O.a)(_t.map(function(pt){return Ue(pt).data.value})))}Dt(bt,{selected:!0,triggerValue:We},yt)}$e&&$e(ct,ht)},Ot=function(We,ht,yt){var ct=We,bt=te(Ct,We);if(Je){var Tt=Rt(bt),wt=Tt.missingRawValues,At=Tt.existRawValues,st=At.map(function(pt){return Ze(pt).key}),Et=Object(w.a)(st,{checked:!1,halfCheckedKeys:Pt},gt),_t=Et.checkedKeys;bt=[].concat(Object(O.a)(wt),Object(O.a)(_t.map(function(pt){return Ue(pt).data.value})))}Dt(bt,{selected:!1,triggerValue:We},yt),He&&He(ct,ht)},It=function(){Dt([],null,"clear")},dt=R.useCallback(function(ut){if(Qe){var We={};Object.defineProperty(We,"documentClickClose",{get:function(){return Object(v.a)(!1,"Second param of `onDropdownVisibleChange` has been removed."),!1}}),Qe(ut,We)}},[Qe]),at={optionLabelProp:null,optionFilterProp:B,dropdownAlign:Fe,internalProps:{mark:E.a,onClear:It,skipTriggerChange:!0,skipTriggerSelect:!0,onRawSelect:Ut,onRawDeselect:Ot}};return"filterTreeNode"in se&&(at.filterOption=je),R.createElement(a.Provider,{value:{checkable:rt,loadData:Re,treeLoadedKeys:z,onTreeLoad:ze,checkedKeys:Ct,halfCheckedKeys:Pt,treeDefaultExpandAll:Q,treeExpandedKeys:W,treeDefaultExpandedKeys:$,onTreeExpand:qe,treeIcon:le,treeMotion:Pe,showTreeIcon:Ce,switcherIcon:Oe,treeLine:Me,treeNodeFilterProp:B}},R.createElement(fe,Object.assign({ref:Ye,mode:it?"multiple":null},se,at,{value:Mt,labelInValue:!0,options:nt,onChange:null,onSelect:null,onDeselect:null,onDropdownVisibleChange:dt})))}),we=function(se){Object(C.a)(ge,se);var pe=Object(j.a)(ge);function ge(){var xe;return Object(ve.a)(this,ge),xe=pe.apply(this,arguments),xe.selectRef=R.createRef(),xe.focus=function(){xe.selectRef.current.focus()},xe.blur=function(){xe.selectRef.current.blur()},xe}return Object(U.a)(ge,[{key:"render",value:function(){return R.createElement(Ee,Object.assign({ref:this.selectRef},this.props))}}]),ge}(R.Component);we.TreeNode=n,we.SHOW_ALL=P,we.SHOW_PARENT=_,we.SHOW_CHILD=A;var Ae=we,De=Ie.e=Ae},"8hTe":function(Ve,Ie,ie){Ve.exports={button:"button___1wy9m"}},"9Bee":function(Ve,Ie,ie){"use strict";var ve=ie("DYRE"),U=ie("zeV3"),C=ie("+L6B"),j=ie("2/Rp"),O=ie("k1fw"),x=ie("9og8"),K=ie("tJVT"),M=ie("WmNS"),R=ie.n(M),L=ie("q1tI"),y=ie.n(L),T=ie("vg9a"),w=ie("DlQD"),E=ie.n(w),b=ie("rUJ1");function v(z,N){var B=z.match(/^(\s+)(?:```)/);if(B===null)return N;var H=B[1];return N.split(`
`).map(function(X){var F=X.match(/^\s+/);if(F===null)return X;var W=Object(K.a)(F,1),$=W[0];return $.length>=H.length?X.slice(H.length):X}).join(`
`)}var l=[],e=["<ul>"],s=new E.a.Renderer,a=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function c(){l.length=0,e=["<ul>"]}var d={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function o(z,N,B,H){if(N>=z.length||z[N].level<=B)return N;var X=z[N];H.push("<li><a href='#"+X.anchor+"'>"+X.text+"</a>"),N++;var F=[];return N=o(z,N,X.level,F),F.length>0&&(H.push("<ul>"),F.forEach(function(W){H.push(W)}),H.push("</ul>")),H.push("</li>"),N=o(z,N,B,H),N}function f(){return o(l,0,0,e),e.push("</ul>"),e.join("")}var u={heading:function(N){var B=a.exec(N);if(B)return{type:"heading",raw:B[0],depth:B[1].length,text:B[2]}},fences:function(N){var B=this.rules.block.fences.exec(N);if(B){var H=B[0],X=v(H,B[3]||""),F=B[2]?B[2].trim():B[2];if(["latex","katex","math"].indexOf(F)>=0){var W=t(),$=X;X=W,n[W]={type:"block",expression:$}}return{type:"code",raw:H,lang:F,text:X}}}},i=/(?:\${2})([^\n`]+?)(?:\${2})/gi,r=0,t=function(){return"__special_katext_id_".concat(r++,"__")},n={};function g(){return n}function p(){r=0,n={}}function S(z){return z=z.replace(i,function(N,B){var H=t();return n[H]={type:"inline",expression:B},H}),z}var k=s.listitem;s.listitem=function(z){return k(S(z))};var I=s.paragraph;s.paragraph=function(z){return I(S(z))};var G=s.tablecell;s.tablecell=function(z,N){return G(S(z),N)},s.code=function(z,N,B){var H=(N||"").match(/\S*/)[0];return H?["latex","katex","math"].indexOf(H)>=0?"<p class='editormd-tex'>".concat(z,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(N,'">').concat(B?z:Object(b.escape)(z,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(B?z:Object(b.escape)(z,!0))+"</code></pre>"},s.heading=function(z,N,B){var H=this.options.headerPrefix+B.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return l.push({anchor:H,level:N,text:z}),"<h"+N+' id="'+H+'">'+z+"</h"+N+">"},E.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),E.a.use({tokenizer:u,renderer:s});var V=E.a,J=ie("SJMd"),re=ie("ulZh"),ee=ie.n(re),ae=ie("m3rI"),be=ie("Oy/b"),he=ie("p5ED"),me=ie("ErOA"),ce=ie("STEk");/* **********************************
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 te=function(z,N){return(te=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(B,H){B.__proto__=H}||function(B,H){for(var X in H)Object.prototype.hasOwnProperty.call(H,X)&&(B[X]=H[X])})(z,N)};function q(z,N){if(typeof N!="function"&&N!==null)throw new TypeError("Class extends value "+String(N)+" is not a constructor or null");function B(){this.constructor=z}te(z,N),z.prototype=N===null?Object.create(N):(B.prototype=N.prototype,new B)}function oe(z,N,B,H){return new(B||(B=Promise))(function(X,F){function W(de){try{Q(H.next(de))}catch(le){F(le)}}function $(de){try{Q(H.throw(de))}catch(le){F(le)}}function Q(de){var le;de.done?X(de.value):(le=de.value,le instanceof B?le:new B(function(Ce){Ce(le)})).then(W,$)}Q((H=H.apply(z,N||[])).next())})}function Z(z,N){var B,H,X,F,W={label:0,sent:function(){if(1&X[0])throw X[1];return X[1]},trys:[],ops:[]};return F={next:$(0),throw:$(1),return:$(2)},typeof Symbol=="function"&&(F[Symbol.iterator]=function(){return this}),F;function $(Q){return function(de){return function(le){if(B)throw new TypeError("Generator is already executing.");for(;W;)try{if(B=1,H&&(X=2&le[0]?H.return:le[0]?H.throw||((X=H.return)&&X.call(H),0):H.next)&&!(X=X.call(H,le[1])).done)return X;switch(H=0,X&&(le=[2&le[0],X.value]),le[0]){case 0:case 1:X=le;break;case 4:return W.label++,{value:le[1],done:!1};case 5:W.label++,H=le[1],le=[0];continue;case 7:le=W.ops.pop(),W.trys.pop();continue;default:if(!(X=W.trys,(X=X.length>0&&X[X.length-1])||le[0]!==6&&le[0]!==2)){W=0;continue}if(le[0]===3&&(!X||le[1]>X[0]&&le[1]<X[3])){W.label=le[1];break}if(le[0]===6&&W.label<X[1]){W.label=X[1],X=le;break}if(X&&W.label<X[2]){W.label=X[2],W.ops.push(le);break}X[2]&&W.ops.pop(),W.trys.pop();continue}le=N.call(z,W)}catch(Ce){le=[6,Ce],H=0}finally{B=X=0}if(5&le[0])throw le[1];return{value:le[0]?le[1]:void 0,done:!0}}([Q,de])}}}var D=function(){function z(){}return z.addKey=function(N){z.key=N},Object.defineProperty(z,"isLicensed",{get:function(){return!!z.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(z.key)},enumerable:!1,configurable:!0}),z}(),h=function(){function z(){}return z.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},z.setAttributes=function(N,B){for(var H=0,X=B;H<X.length;H++){var F=X[H],W=F[0],$=F[1];N.setAttribute(W,$)}},z.createRect=function(N,B,H){var X=document.createElementNS("http://www.w3.org/2000/svg","rect");return X.setAttribute("width",N.toString()),X.setAttribute("height",B.toString()),H&&z.setAttributes(X,H),X},z.createLine=function(N,B,H,X,F){var W=document.createElementNS("http://www.w3.org/2000/svg","line");return W.setAttribute("x1",N.toString()),W.setAttribute("y1",B.toString()),W.setAttribute("x2",H.toString()),W.setAttribute("y2",X.toString()),F&&z.setAttributes(W,F),W},z.createPolygon=function(N,B){var H=document.createElementNS("http://www.w3.org/2000/svg","polygon");return H.setAttribute("points",N),B&&z.setAttributes(H,B),H},z.createCircle=function(N,B){var H=document.createElementNS("http://www.w3.org/2000/svg","circle");return H.setAttribute("cx",(N/2).toString()),H.setAttribute("cy",(N/2).toString()),H.setAttribute("r",N.toString()),B&&z.setAttributes(H,B),H},z.createEllipse=function(N,B,H){var X=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return X.setAttribute("cx",(N/2).toString()),X.setAttribute("cy",(B/2).toString()),X.setAttribute("rx",(N/2).toString()),X.setAttribute("ry",(B/2).toString()),H&&z.setAttributes(X,H),X},z.createGroup=function(N){var B=document.createElementNS("http://www.w3.org/2000/svg","g");return N&&z.setAttributes(B,N),B},z.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},z.createMarker=function(N,B,H,X,F,W,$){var Q=document.createElementNS("http://www.w3.org/2000/svg","marker");return z.setAttributes(Q,[["id",N],["orient",B],["markerWidth",H.toString()],["markerHeight",X.toString()],["refX",F.toString()],["refY",W.toString()]]),Q.appendChild($),Q},z.createText=function(N){var B=document.createElementNS("http://www.w3.org/2000/svg","text");return B.setAttribute("x","0"),B.setAttribute("y","0"),N&&z.setAttributes(B,N),B},z.createTSpan=function(N,B){var H=document.createElementNS("http://www.w3.org/2000/svg","tspan");return H.textContent=N,B&&z.setAttributes(H,B),H},z.createImage=function(N){var B=document.createElementNS("http://www.w3.org/2000/svg","image");return N&&z.setAttributes(B,N),B},z.createPoint=function(N,B){var H=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return H.x=N,H.y=B,H},z.createPath=function(N,B){var H=document.createElementNS("http://www.w3.org/2000/svg","path");return H.setAttribute("d",N),B&&z.setAttributes(H,B),H},z.createElement=function(N,B){var H=document.createElementNS("http://www.w3.org/2000/svg",N);return B&&z.setAttributes(H,B),H},z.getHollowRectanglePath=function(N,B,H,X,F,W,$,Q){return"M"+N+","+B+"V"+(B+X)+"H"+(N+H)+"V"+B+"H"+F+"V"+W+"H"+(F+$)+"V"+(W+Q)+"H"+F+"V"+B+"Z"},z}(),m=function(){function z(N){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+N+"_"}return Object.defineProperty(z.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),z.prototype.addClass=function(N){return this.styleSheet===void 0&&this.addStyleSheet(),N.name=""+this.classNamePrefix+N.localName,this.classes.push(N),this.styleSheet.sheet.insertRule("."+N.name+" {"+N.style+"}",this.styleSheet.sheet.cssRules.length),N},z.prototype.addRule=function(N){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(N),this.styleSheet.sheet.insertRule(N.selector+" {"+N.style+"}",this.styleSheet.sheet.cssRules.length)},z.prototype.addStyleSheet=function(){var N;this.styleSheet=document.createElement("style"),((N=this.styleSheetRoot)!==null&&N!==void 0?N:document.head).appendChild(this.styleSheet),this.addRule(new P("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new P("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new P("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new _("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new _("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},z.prototype.removeStyleSheet=function(){var N;this.styleSheet&&(((N=this.styleSheetRoot)!==null&&N!==void 0?N:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},z}(),P=function(z,N){this.selector=z,this.style=N},_=function(z,N){this.localName=z,this.style=N},A=function(){function z(){this.blocks=[],this.display=""}return z.prototype.addButtonBlock=function(N){N.className=this.blockClassName,N.buttonClassName=this.buttonClassName,N.buttonColorsClassName=this.buttonColorsClassName,N.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(N)},z.prototype.addElementBlock=function(N){N.className===void 0&&(N.className=this.blockClassName),this.blocks.push(N)},z.prototype.getUI=function(){var N=document.createElement("div");return N.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,N.style.display=this.display,this.blocks.forEach(function(B){return N.appendChild(B.getUI())}),N},z}(),Y=function(){function z(){}return z.prototype.getUI=function(){var N=document.createElement("div");if(N.className=this.className,this.minWidth!==void 0&&(N.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":N.style.justifyContent="flex-start";break;case"center":N.style.justifyContent="center";break;case"end":N.style.justifyContent="flex-end"}return N.style.whiteSpace="nowrap",N},z}(),ne=function(z){function N(){var B=z!==null&&z.apply(this,arguments)||this;return B.buttons=[],B}return q(N,z),N.prototype.addButton=function(B){B.className=this.buttonClassName,B.colorsClassName=this.buttonColorsClassName,B.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(B)},N.prototype.getUI=function(){var B=z.prototype.getUI.call(this);return this.buttons.forEach(function(H){return B.appendChild(H.getUI())}),B},N}(Y),ue=function(){function z(N,B){this._isActive=!1,this._isHidden=!1,this._icon=N,this.title=B,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(z.prototype,"icon",{get:function(){return this._icon},set:function(N){this._icon=N,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isActive",{get:function(){return this._isActive},set:function(N){this._isActive=N,this.adjustClassName()},enumerable:!1,configurable:!0}),z.prototype.getUI=function(){var N=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return N.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},z.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},z.prototype.hide=function(){this._isHidden=!0},z}(),fe=function(z){function N(){var B=z!==null&&z.apply(this,arguments)||this;return B.elements=[],B}return q(N,z),N.prototype.addElement=function(B){this.elements.push(B)},N.prototype.getUI=function(){var B=z.prototype.getUI.call(this);return this.elements.forEach(function(H){return B.appendChild(H)}),B},N}(Y),Ee=function(){function z(N,B){this.horizontal=N,this.vertical=B}return Object.defineProperty(z.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),z.prototype.getVerticalLength=function(N){return N/this.ratio},z.prototype.getHorizontalLength=function(N){return N*this.ratio},z}(),we=function(){function z(){}return z.getIcon=function(N,B){if(N>0&&B>0){var H=new Ee(N,B),X=H.ratio>=1?20:H.getHorizontalLength(20),F=H.ratio<1?20:H.getVerticalLength(20),W=document.createElementNS("http://www.w3.org/2000/svg","svg");W.setAttribute("xmlns","http://www.w3.org/2000/svg"),W.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(W);var $=h.createDefs();W.appendChild($);var Q=h.createElement("clipPath",[["id","text-bg-clip"]]);$.appendChild(Q);var de=h.createPath(h.getHollowRectanglePath((24-X)/2,(24-F)/2,X,F,(24-X)/2+2,(24-F)/2+2,X-4,F-4));W.appendChild(de);var le=h.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);le.appendChild(h.createTSpan(N+":"+B)),W.appendChild(le);var Ce=le.getBBox();h.setAttributes(le,[["x",((24-Ce.width)/2).toString()],["y",((24-Ce.height)/2-Ce.y).toString()]]);var Oe=h.createPath(h.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Ce.width))/2,(24-Math.ceil(Ce.height))/2,Math.ceil(Ce.width),Math.ceil(Ce.height)));return Q.appendChild(Oe),h.setAttributes(de,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(W),W.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},z}(),Ae=function(z){function N(B,H,X){var F=z.call(this,B,H)||this;return F.isDropdownOpen=!1,F.onClick=F.dropdownButtonClicked,F.dropdownButtons=X,F}return q(N,z),N.prototype.setupDropdown=function(){var B=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(H){H.className=B.className,H.colorsClassName=B.colorsClassName,B.dropdownBlock.appendChild(H.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},N.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},N.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},N.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},N.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},N.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},N}(ue),De=function(){function z(N,B){this.GRIP_SIZE=10,this.color=N,this.fillColor=B,this.visual=h.createGroup(),this.visual.appendChild(h.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(h.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return z.prototype.ownsTarget=function(N){return N===this.visual||N===this.visual.childNodes[0]||N===this.visual.childNodes[1]},z.prototype.setCenter=function(N,B){this.visual.childNodes.forEach(function(H){return h.setAttributes(H,[["cx",N.toString()],["cy",B.toString()]])})},z}(),se=function(){function z(N,B,H,X){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=N,this.canvasHeight=B,this.margin=H,this.container=X,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(z.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(N){this._aspectRatio=N,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(N){this._isGridVisible=N,this.gridContainer&&h.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(N){this._zoomFactor=N,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),z.prototype.open=function(){var N=this;this.cropShadeElement=h.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=h.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var B=0;B<this.numberOfGridLines;B++)this.horizontalGridLines.push(h.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(h.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(H){return N.gridContainer.appendChild(H)}),this.verticalGridLines.forEach(function(H){return N.gridContainer.appendChild(H)}),this.cropRectElement=h.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new De(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new De(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new De(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new De(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},z.prototype.setCropRectangle=function(N){this.cropRect=N;var B=Object.assign({},this.cropRect);this.zoomFactor!==1&&(B.width=this.cropRect.width*this.zoomFactor,B.height=this.cropRect.height*this.zoomFactor,B.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-B.width/2,B.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-B.height/2),h.setAttributes(this.cropRectElement,[["x",B.x.toString()],["y",B.y.toString()],["width",B.width.toString()],["height",B.height.toString()]]);var H=B.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(F,W){var $=B.y+H*(W+1);h.setAttributes(F,[["x1",""+B.x],["y1",""+$],["x2",""+(B.x+B.width)],["y2",""+$]])});var X=B.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(F,W){var $=B.x+X*(W+1);h.setAttributes(F,[["x1",""+$],["y1",""+B.y],["x2",""+$],["y2",""+(B.y+B.height)]])}),h.setAttributes(this.cropShadeElement,[["d",h.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,B.x,B.y,B.width,B.height)]]),this.topLeftGrip.setCenter(B.x,B.y),this.topRightGrip.setCenter(B.x+B.width,B.y),this.bottomLeftGrip.setCenter(B.x,B.y+B.height),this.bottomRightGrip.setCenter(B.x+B.width,B.y+B.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},z.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)},z.prototype.clientToLocalCoordinates=function(N,B){var H=this.container.getBoundingClientRect();return{x:N-H.left+this.margin,y:B-H.top+this.margin}},z.prototype.onPointerDown=function(N){this.container.setPointerCapture(N.pointerId),this.previousPoint=this.clientToLocalCoordinates(N.clientX,N.clientY),this.cropRectElement===N.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(N.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(N.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(N.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(N.target)&&(this.activeGrip=this.bottomRightGrip)},z.prototype.onPointerMove=function(N){if(this.isMoving)this.move(this.clientToLocalCoordinates(N.clientX,N.clientY));else if(this.activeGrip){var B=this.clientToLocalCoordinates(N.clientX,N.clientY);this.resize(B)}N.preventDefault()},z.prototype.onPointerUp=function(N){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(N.pointerId)},z.prototype.move=function(N){var B=N.x-this.previousPoint.x,H=N.y-this.previousPoint.y;this.zoomFactor!==1&&(B=-B/this.zoomFactor,H=-H/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+B),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+H),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=N},z.prototype.resize=function(N){var B=Object.assign({},this.cropRect),H=N.x-this.previousPoint.x,X=N.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:B.x+H<this.margin&&(H=this.margin-B.x),B.x+=H,B.width=this.cropRect.x+this.cropRect.width-B.x;break;case this.bottomRightGrip:case this.topRightGrip:B.width+H>this.canvasWidth*this.zoomFactor&&(H=this.canvasWidth*this.zoomFactor-B.width),B.width+=H}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(B.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(H),B.height=this.aspectRatio.getVerticalLength(B.width)):(B.y+=X,B.height=this.cropRect.y+this.cropRect.height-B.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?B.height=this.aspectRatio.getVerticalLength(B.width):B.height+=X}B.width<10&&(B.x=this.cropRect.x,B.width=10),B.height<10&&(B.y=this.cropRect.y,B.height=10),this.previousPoint=N,B.x>=this.margin&&B.y>=this.margin&&B.x-this.margin+B.width<=this.canvasWidth&&B.y-this.margin+B.height<=this.canvasHeight&&(this.cropRect=B,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},z.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var N=this.cropRect.x+this.cropRect.width/2,B=this.cropRect.y+this.cropRect.height/2,H=this.aspectRatio.getHorizontalLength(this.cropRect.height),X=this.aspectRatio.getVerticalLength(this.cropRect.width);H/this.canvasWidth<X/this.canvasHeight?this.cropRect.width=H:this.cropRect.height=X,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=N-this.cropRect.width/2,this.cropRect.y=B-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)}},z.prototype.getRescaledRect=function(N,B,H,X,F,W){var $=H/N,Q=X/B;return{x:(F.x-W)*$+W,y:(F.y-W)*Q+W,width:F.width*$,height:F.height*Q}},z.prototype.scaleCanvas=function(N,B){var H=this.getRescaledRect(this.canvasWidth,this.canvasHeight,N,B,this.cropRect,this.margin);this.canvasWidth=N,this.canvasHeight=B,this.onCropChange&&this.onCropChange(H),this.setCropRectangle(H)},z}(),pe=function(){function z(N){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=N,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(z.prototype,"angle",{get:function(){return this._angle},set:function(N){this._angle=N,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),z.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},z.prototype.onPointerDown=function(N){this.controlContainer.setPointerCapture(N.pointerId),this.isDragging=!0,this.previousPoint={x:N.clientX,y:N.clientY}},z.prototype.onPointerMove=function(N){this.isDragging&&(this.onAngleChange&&this.onAngleChange((N.clientX-this.previousPoint.x)/5),this.previousPoint.x=N.clientX)},z.prototype.onPointerUp=function(N){this.isDragging&&this.onAngleChange&&this.onAngleChange((N.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(N.pointerId)},z.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var N=this.angleLabelText.getBBox();h.setAttributes(this.angleLabelElement,[["x",((this.width-N.width)/2).toString()],["y",(this.height/2).toString()]])}},z.prototype.positionScaleShape=function(){if(this.scaleShape){var N=this.scaleShape.transform.baseVal.getItem(0);N.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(N,0)}},z.prototype.getVisual=function(){var N=document.createElementNS("http://www.w3.org/2000/svg","svg");N.setAttribute("xmlns","http://www.w3.org/2000/svg"),N.setAttribute("width",this.width+"px"),N.setAttribute("height",this.height+"px"),N.setAttribute("viewBox","0 0 "+this.width+" "+this.height),N.style.flexShrink="0",document.body.appendChild(N);for(var B="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,H=1;H<=this.width/5+10;H++){var X=H%5==0?this.height/3:this.height/6;B+="h4v"+-X+"h1v"+X}B+="v1H0Z",this.scaleShape=h.createPath(B);var F=h.createTransform();this.scaleShape.transform.baseVal.appendItem(F),N.appendChild(this.scaleShape),this.angleLabelElement=h.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=h.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var W=h.createTSpan("");return W.innerHTML="&deg;",this.angleLabelElement.appendChild(W),N.appendChild(this.angleLabelElement),document.body.removeChild(N),N},z}(),ge=function(){function z(){this.naturalSize=!1,this.imageType="image/png"}return z.prototype.rasterize=function(N,B,H,X,F,W,$){var Q=this;return new Promise(function(de){var le=document.createElement("canvas");le.width=N.width.baseVal.value-2*X,le.height=N.height.baseVal.value-2*X;var Ce=1,Oe=1;Q.naturalSize===!0?(Ce=B.naturalWidth/(N.width.baseVal.value-2*X)/W,Oe=B.naturalHeight/(N.height.baseVal.value-2*X)/$,le.width=B.naturalWidth/W,le.height=B.naturalHeight/$):Q.width!==void 0&&Q.height!==void 0&&(Ce=Q.width/H.width,Oe=Q.height/H.height,le.width*=Ce,le.height*=Oe);var Me=le.getContext("2d");Me.translate(le.width/2,le.height/2),Me.rotate(F*Math.PI/180),Me.scale(W,$),Me.translate(-le.width/2,-le.height/2),Me.drawImage(B,0,0,le.width,le.height);var Pe=document.createElement("canvas");Pe.width=H.width*Ce,Pe.height=H.height*Oe,Pe.getContext("2d").putImageData(Me.getImageData((H.x-X)*Ce,(H.y-X)*Oe,H.width*Ce,H.height*Oe),0,0),de(Pe.toDataURL(Q.imageType,Q.imageQuality))})},z}(),xe=function(){function z(N){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=z.instanceCounter++,this.styles=new m(this.instanceNo),this.target=N,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(z.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(N){this._zoomToCropEnabled=N,N?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(N){this._isGridVisible=N,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"gridLines",{get:function(){return this._gridLines},set:function(N){this._gridLines=N,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(N){this._rotationAngle=N,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"aspectRatio",{get:function(){var N;return(N=this._aspectRatio)!==null&&N!==void 0?N:this.aspectRatios[0]},set:function(N){this._aspectRatio=N},enumerable:!1,configurable:!0}),z.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},z.prototype.show=function(){this.showUI(),this.open()},z.prototype.close=function(N){N===void 0&&(N=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),N||this.closeEventListeners.forEach(function(B){return B()}),this._isOpen=!1)},z.prototype.addRenderEventListener=function(N){this.renderEventListeners.push(N)},z.prototype.removeRenderEventListener=function(N){this.renderEventListeners.indexOf(N)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(N),1)},z.prototype.addCloseEventListener=function(N){this.closeEventListeners.push(N)},z.prototype.removeCloseEventListener=function(N){this.closeEventListeners.indexOf(N)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(N),1)},z.prototype.setupResizeObserver=function(){var N=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){N.resize(N.target.clientWidth,N.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))},z.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var N=1*this.target.clientWidth/this.target.clientHeight,B=this.contentDiv.clientWidth/N>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*N:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,H=B+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/N;this.resize(B,H)}},z.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},z.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",h.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},z.prototype.resize=function(N,B){this.imageWidth=Math.round(N),this.imageHeight=Math.round(B),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},z.prototype.setEditingTarget=function(){var N=document.createElement("canvas");N.width=this.target.naturalWidth,N.height=this.target.naturalHeight,N.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var B=N.toDataURL();h.setAttributes(this.editingTarget,[["href",B]]),this.setEditingTargetSize()},z.prototype.setTopLeft=function(){var N=this.target.getBoundingClientRect(),B=this.editorCanvas.getBoundingClientRect();this.left=N.left-B.left-this.CANVAS_MARGIN,this.top=N.top-B.top-this.CANVAS_MARGIN},z.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=h.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=h.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=h.createGroup(),this.editingTargetRotationScaleContainer=h.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var N=h.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(N);var B=h.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(B),this.editingTargetContainer=h.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},z.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},z.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=h.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new se(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},z.prototype.zoomToCrop=function(){if(this.cropRect){var N=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,B=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=N+"px "+B+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-N+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-B+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},z.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},z.prototype.cropRectChanged=function(N){this.cropRect=N,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},z.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},z.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"},z.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},z.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var N=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,B=this.target.offsetTop>N+this.CANVAS_MARGIN?this.target.offsetTop-(N+this.CANVAS_MARGIN):0;this.coverDiv.style.top=B+"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},z.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},z.prototype.addTopToolbar=function(){var N=this;this.topToolbar=new A,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 B=new ne;B.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(B);var H=[];this.aspectRatios.forEach(function(Oe){var Me=new ue(we.getIcon(Oe.horizontal,Oe.vertical),Oe.horizontal===0&&Oe.vertical===0?"FREE":Oe.horizontal+":"+Oe.vertical);Me.onClick=function(){return N.ratioButtonClicked(Oe)},H.push(Me)}),this.aspectRatioButton=new Ae(we.getIcon(0,0),"Aspect ratio",H),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,B.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var X=new ue('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");X.isActive=this.isGridVisible,X.onClick=function(){N.isGridVisible=!N.isGridVisible,X.isActive=N.isGridVisible},B.addButton(X);var F=new ue('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(F.isActive=this.zoomToCropEnabled,F.onClick=function(){N.zoomToCropEnabled=!N.zoomToCropEnabled,F.isActive=N.zoomToCropEnabled},B.addButton(F),!D.isLicensed){var W=new fe;this.topToolbar.addElementBlock(W);var $=document.createElement("div");$.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Q=document.createElement("a");Q.style.color="currentColor",Q.href="https://markerjs.com/products/cropro",Q.target="_blank",Q.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',$.appendChild(Q),W.addElement($)}var de=new ne;de.minWidth=3*this.toolbarHeight+"px",de.contentAlign="end",this.topToolbar.addButtonBlock(de);var le=new ue('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");le.onClick=this.startRenderAndClose,de.addButton(le),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(le.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Ce=new ue('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");Ce.onClick=this.close,de.addButton(Ce),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Ce.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},z.prototype.addBottomToolbar=function(){var N=this;this.bottomToolbar=new A,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 B=new ne;B.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(B);var H=new ue('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");H.onClick=this.rotateLeftButtonClicked,B.addButton(H);var X=new ue('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");X.onClick=this.rotateRightButtonClicked,B.addButton(X);var F=new fe;F.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(F),this.straightener=new pe("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(de){N.rotateBy(de),N.straightener.angle=N.rotationAngle},F.addElement(this.straightener.getUI());var W=new ne;W.minWidth=2*this.toolbarHeight+"px",W.contentAlign="end",this.bottomToolbar.addButtonBlock(W);var $=new ue('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");$.onClick=this.flipHorizontallyButtonClicked,W.addButton($);var Q=new ue('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");Q.onClick=this.flipVerticallyButtonClicked,W.addButton(Q)},z.prototype.ratioButtonClicked=function(N){this.aspectRatio=N,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},z.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=we.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},z.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Ee(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},z.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},z.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},z.prototype.restoreState=function(N){if(N){var B=this.cropLayer.getRescaledRect(N.width,N.height,this.imageWidth,this.imageHeight,N.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(B),this.cropRectChanged(B),this.flippedHorizontally=N.flippedHorizontally,this.flippedVertically=N.flippedVertically,this.applyFlip(),this.rotationAngle=N.rotationAngle,this.applyRotation()}},z.prototype.clientToLocalCoordinates=function(N,B){var H=this.cropImage.getBoundingClientRect();return{x:N-H.left,y:B-H.top}},z.prototype.onWindowResize=function(){this.positionUI()},z.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var N=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=N+"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()},z.prototype.rotateLeftButtonClicked=function(){var N=this.rotationAngle-90;this.rotationAngle%90!=0&&(N+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(N)},z.prototype.rotateRightButtonClicked=function(){var N=this.rotationAngle+90;this.rotationAngle%90!=0&&(N-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(N)},z.prototype.rotateTo=function(N){N=(N=N>180?N-360:N)<=-180?N+360:N,this.rotationAngle=N,this.applyRotation()},z.prototype.rotateBy=function(N){this.rotateTo((this.rotationAngle+N)%360)},z.prototype.applyRotation=function(){var N=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var B=this.editingTargetRotationContainer.transform.baseVal.getItem(0);B.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(B,0);var H=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/H.width,this.imageHeight/H.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=N},z.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},z.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},z.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},z.prototype.startRenderAndClose=function(){return oe(this,void 0,void 0,function(){var N,B;return Z(this,function(H){switch(H.label){case 0:return[4,this.render()];case 1:return N=H.sent(),B=this.getState(),this.renderEventListeners.forEach(function(X){return X(N,B)}),this.close(!0),[2]}})})},z.prototype.render=function(){return oe(this,void 0,void 0,function(){var N;return Z(this,function(B){switch(B.label){case 0:return(N=new ge).naturalSize=this.renderAtNaturalSize,N.imageType=this.renderImageType,N.imageQuality=this.renderImageQuality,N.width=this.renderWidth,N.height=this.renderHeight,this.unzoomFromCrop(),h.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,N.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 B.sent(),[4,N.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,B.sent()]}})})},z.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new _("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 _("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new _("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var N=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new _("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*N)+`px;
height: `+(this.toolbarHeight-2*N)+`px;
padding: `+N+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new _("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new _("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new P("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new P("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new _("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 _("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new _("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 _("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*N)+`px;
padding: `+N+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new _("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},z.instanceCounter=0,z}(),Te=ie("8hTe"),Se=ie.n(Te),ye=/<pre[^>]*>/g;function Le(z){var N=document.createElement("div");return N.innerHTML=z,N.childNodes.length===0?"":N.childNodes[0].nodeValue}var Re=Ie.a=function(z){var N=z.value,B=N===void 0?"":N,H=z.edit,X=H===void 0?!1:H,F=z.className,W=z.showTextOnly,$=z.showLines,Q=z.replaces,de=z.zoomImg,le=z.hasMask,Ce=z.style,Oe=Ce===void 0?{}:Ce,Me=z.stylesPrev,Pe=Me===void 0?{}:Me,je=String(B),Fe=Object(L.useRef)(),_e=Object(L.useRef)(),qe=Object(L.useState)(""),ze=Object(K.a)(qe,2),Qe=ze[0],$e=ze[1],He=Object(L.useState)("office"),rt=Object(K.a)(He,2),it=rt[0],Je=rt[1],lt=function(){var ke=new xe(_e.current);ke.displayMode="popup",ke.addRenderEventListener(function(){var Ge=Object(x.a)(R.a.mark(function Ne(Ke){var Ue;return R.a.wrap(function(Xe){for(;;)switch(Xe.prev=Xe.next){case 0:return Fe.current.style.display="none",Xe.next=3,Object(me.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Ke}});case 3:Ue=Xe.sent,Ue!=null&&Ue.id&&Q(_e.current.getAttribute("src").replace(ae.a.API_SERVER,""),"/api/attachments/".concat(Ue==null?void 0:Ue.id,"?type=").concat(Ue.content_type));case 5:case"end":return Xe.stop()}},Ne)}));return function(Ne){return Ge.apply(this,arguments)}}()),ke.show()},Ye=function(){var ke=new ce.a(_e.current);ke.settings.displayMode="popup",ke.addEventListener("render",function(){var Ge=Object(x.a)(R.a.mark(function Ne(Ke){var Ue;return R.a.wrap(function(Xe){for(;;)switch(Xe.prev=Xe.next){case 0:if(Fe.current.style.display="none",!_e.current){Xe.next=6;break}return Xe.next=4,Object(me.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Ke.dataUrl}});case 4:Ue=Xe.sent,Ue!=null&&Ue.id&&Q(_e.current.getAttribute("src").replace(ae.a.API_SERVER,""),"/api/attachments/".concat(Ue==null?void 0:Ue.id,"?type=").concat(Ue.content_type));case 6:case"end":return Xe.stop()}},Ne)}));return function(Ne){return Ge.apply(this,arguments)}}()),ke.show(),window.markerArea=ke},ot=Object(L.useMemo)(function(){Fe.current&&(Fe.current.style.zIndex=-1);try{var Be=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,ke=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Ge=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;je=je.replace(Be,"("+ae.a.API_SERVER+"/api/attachments/").replace(ke,'"'+ae.a.API_SERVER+"/api/attachments/").replace(Ge,'"'+ae.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(Ze){}var Ne=V(je),Ke=g();if(je.match(/\[TOC\]/)&&(Ne=Ne.replace("<p>[TOC]</p>",f()),c()),Ne=Ne.replace(/(__special_katext_id_\d+__)/g,function(Ze,Xe){var gt=Ke[Xe],vt=gt.type,Lt=gt.expression;return Object(be.renderToString)(Le(Lt)||"",{displayMode:vt==="block",throwOnError:!1,output:"html"})}),Ne=Ne.replace(/▁/g,"\u2581\u2581\u2581"),p(),W){var Ue=document.createElement("div");return Ue.innerHTML=Ne,Ue.innerText}return setTimeout(function(){return ft()},500),Ne},[je]),tt=Object(L.useRef)();d.WebkitLineClamp=$,$&&(Oe=Object(O.a)(Object(O.a)({},Oe),d));function nt(Be){var ke=Be.target;if(ke.tagName.toUpperCase()==="IMG"){if(de){var Ge=ke.getAttribute("src");$e(Ge),Je("image")}}else if(ke.tagName.toUpperCase()==="A"){var Ne=ke.getAttribute("href");if(Ne.indexOf("office")>-1)Be.preventDefault(),$e(Ne),Je("office");else if(Ne.indexOf("application/pdf")>-1)Be.preventDefault(),$e(Ne),Je("pdf");else if(Ne.indexOf("text/html")>-1)Be.preventDefault(),$e(Ne),Je("html");else if(Ne.startsWith("#")){Be.preventDefault();var Ke=document.getElementById(Ne.replace("#",""));Ke&&Ke.scrollIntoView(!0)}}}var ft=function(){var ke,Ge=(ke=tt.current)===null||ke===void 0?void 0:ke.querySelectorAll("video");Ge==null||Ge.forEach(function(Ne){if(Ne.oncontextmenu=function(){return!1},Ne.src.indexOf(".m3u8")>-1&&!Ne.canPlayType("application/vnd.apple.mpegurl")){if(ee.a.isSupported()){var Ke=new ee.a;Ke.loadSource(Ne.src),Ke.attachMedia(Ne)}}})};Object(L.useEffect)(function(){if(tt.current&&ot&&(ot.match(ye)&&window.PR.prettyPrint()),tt.current)return tt.current.addEventListener("click",nt),function(){tt.current.removeEventListener("click",nt),p(),c()}},[ot,tt.current,nt]);var et=function(ke){if(!X)return;ke.target.nodeName==="IMG"?(Fe.current.style.zIndex=1,Fe.current.style.display="flex",Fe.current.style.width=ke.target.clientWidth+"px",Fe.current.style.height=ke.target.clientHeight+"px",Fe.current.style.top=ke.target.offsetTop+"px",Fe.current.style.left=ke.target.offsetLeft+"px",_e.current.src=ke.target.getAttribute("src")):Fe.current.style.display="none"};return y.a.createElement("div",{style:{position:"relative"}},y.a.createElement("div",{ref:tt,style:Object(O.a)({},Oe),className:"".concat(F||""," markdown-body ").concat(Se.a.mdBody),onMouseOver:et,dangerouslySetInnerHTML:{__html:ot}}),y.a.createElement("div",{ref:Fe,className:Se.a.button},y.a.createElement(U.a,null,y.a.createElement(j.a,{onClick:function(){return lt()}},"\u88C1\u526A"),y.a.createElement(j.a,{onClick:function(){return Ye()}},"\u7F16\u8F91"))),y.a.createElement("img",{ref:_e,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),y.a.createElement(he.a,{close:!0,data:Qe,type:Qe!=null&&Qe.length?it:"",style:Object(O.a)({},Pe),onClose:function(){return $e("")}}))}},DlQD:function(Ve,Ie,ie){(function(ve,U){Ve.exports=U()})(this,function(){"use strict";function ve(B,H){for(var X=0;X<H.length;X++){var F=H[X];F.enumerable=F.enumerable||!1,F.configurable=!0,"value"in F&&(F.writable=!0),Object.defineProperty(B,F.key,F)}}function U(B,H,X){return H&&ve(B.prototype,H),X&&ve(B,X),B}function C(B,H){if(!B)return;if(typeof B=="string")return j(B,H);var X=Object.prototype.toString.call(B).slice(8,-1);if(X==="Object"&&B.constructor&&(X=B.constructor.name),X==="Map"||X==="Set")return Array.from(B);if(X==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(X))return j(B,H)}function j(B,H){(H==null||H>B.length)&&(H=B.length);for(var X=0,F=new Array(H);X<H;X++)F[X]=B[X];return F}function O(B,H){var X;if(typeof Symbol=="undefined"||B[Symbol.iterator]==null){if(Array.isArray(B)||(X=C(B))||H&&B&&typeof B.length=="number"){X&&(B=X);var F=0;return function(){return F>=B.length?{done:!0}:{done:!1,value:B[F++]}}}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 X=B[Symbol.iterator](),X.next.bind(X)}function x(B,H){return H={exports:{}},B(H,H.exports),H.exports}var K=x(function(B){function H(){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 X(F){B.exports.defaults=F}B.exports={defaults:H(),getDefaults:H,changeDefaults:X}}),M=K.defaults,R=K.getDefaults,L=K.changeDefaults,y=/[&<>"']/,T=/[&<>"']/g,w=/[<>"']|&(?!#?\w+;)/,E=/[<>"']|&(?!#?\w+;)/g,b={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},v=function(H){return b[H]};function l(B,H){if(H){if(y.test(B))return B.replace(T,v)}else if(w.test(B))return B.replace(E,v);return B}var e=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(B){return B.replace(e,function(H,X){return X=X.toLowerCase(),X==="colon"?":":X.charAt(0)==="#"?X.charAt(1)==="x"?String.fromCharCode(parseInt(X.substring(2),16)):String.fromCharCode(+X.substring(1)):""})}var a=/(^|[^\[])\^/g;function c(B,H){B=B.source||B,H=H||"";var X={replace:function(W,$){return $=$.source||$,$=$.replace(a,"$1"),B=B.replace(W,$),X},getRegex:function(){return new RegExp(B,H)}};return X}var d=/[^\w:]/g,o=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function f(B,H,X){if(B){var F;try{F=decodeURIComponent(s(X)).replace(d,"").toLowerCase()}catch(W){return null}if(F.indexOf("javascript:")===0||F.indexOf("vbscript:")===0||F.indexOf("data:")===0)return null}H&&!o.test(X)&&(X=n(H,X));try{X=encodeURI(X).replace(/%25/g,"%")}catch(W){return null}return X}var u={},i=/^[^:]+:\/*[^/]*$/,r=/^([^:]+:)[\s\S]*$/,t=/^([^:]+:\/*[^/]*)[\s\S]*$/;function n(B,H){u[" "+B]||(i.test(B)?u[" "+B]=B+"/":u[" "+B]=k(B,"/",!0)),B=u[" "+B];var X=B.indexOf(":")===-1;return H.substring(0,2)==="//"?X?H:B.replace(r,"$1")+H:H.charAt(0)==="/"?X?H:B.replace(t,"$1")+H:B+H}var g={exec:function(){}};function p(B){for(var H=1,X,F;H<arguments.length;H++){X=arguments[H];for(F in X)Object.prototype.hasOwnProperty.call(X,F)&&(B[F]=X[F])}return B}function S(B,H){var X=B.replace(/\|/g,function($,Q,de){for(var le=!1,Ce=Q;--Ce>=0&&de[Ce]==="\\";)le=!le;return le?"|":" |"}),F=X.split(/ \|/),W=0;if(F.length>H)F.splice(H);else for(;F.length<H;)F.push("");for(;W<F.length;W++)F[W]=F[W].trim().replace(/\\\|/g,"|");return F}function k(B,H,X){var F=B.length;if(F===0)return"";for(var W=0;W<F;){var $=B.charAt(F-W-1);if($===H&&!X)W++;else if($!==H&&X)W++;else break}return B.substr(0,F-W)}function I(B,H){if(B.indexOf(H[1])===-1)return-1;for(var X=B.length,F=0,W=0;W<X;W++)if(B[W]==="\\")W++;else if(B[W]===H[0])F++;else if(B[W]===H[1]&&(F--,F<0))return W;return-1}function G(B){B&&B.sanitize&&!B.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var V={escape:l,unescape:s,edit:c,cleanUrl:f,resolveUrl:n,noopTest:g,merge:p,splitCells:S,rtrim:k,findClosingBracket:I,checkSanitizeDeprecation:G},J=K.defaults,re=V.rtrim,ee=V.splitCells,ae=V.escape,be=V.findClosingBracket;function he(B,H,X){var F=H.href,W=H.title?ae(H.title):null,$=B[1].replace(/\\([\[\]])/g,"$1");return B[0].charAt(0)!=="!"?{type:"link",raw:X,href:F,title:W,text:$}:{type:"image",raw:X,href:F,title:W,text:ae($)}}function me(B,H){var X=B.match(/^(\s+)(?:```)/);if(X===null)return H;var F=X[1];return H.split(`
`).map(function(W){var $=W.match(/^\s+/);if($===null)return W;var Q=$[0];return Q.length>=F.length?W.slice(F.length):W}).join(`
`)}var ce=function(){function B(X){this.options=X||J}var H=B.prototype;return H.space=function(F){var W=this.rules.block.newline.exec(F);if(W)return W[0].length>1?{type:"space",raw:W[0]}:{raw:`
`}},H.code=function(F,W){var $=this.rules.block.code.exec(F);if($){var Q=W[W.length-1];if(Q&&Q.type==="paragraph")return{raw:$[0],text:$[0].trimRight()};var de=$[0].replace(/^ {4}/gm,"");return{type:"code",raw:$[0],codeBlockStyle:"indented",text:this.options.pedantic?de:re(de,`
`)}}},H.fences=function(F){var W=this.rules.block.fences.exec(F);if(W){var $=W[0],Q=me($,W[3]||"");return{type:"code",raw:$,lang:W[2]?W[2].trim():W[2],text:Q}}},H.heading=function(F){var W=this.rules.block.heading.exec(F);if(W)return{type:"heading",raw:W[0],depth:W[1].length,text:W[2]}},H.nptable=function(F){var W=this.rules.block.nptable.exec(F);if(W){var $={type:"table",header:ee(W[1].replace(/^ *| *\| *$/g,"")),align:W[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:W[3]?W[3].replace(/\n$/,"").split(`
`):[],raw:W[0]};if($.header.length===$.align.length){var Q=$.align.length,de;for(de=0;de<Q;de++)/^ *-+: *$/.test($.align[de])?$.align[de]="right":/^ *:-+: *$/.test($.align[de])?$.align[de]="center":/^ *:-+ *$/.test($.align[de])?$.align[de]="left":$.align[de]=null;for(Q=$.cells.length,de=0;de<Q;de++)$.cells[de]=ee($.cells[de],$.header.length);return $}}},H.hr=function(F){var W=this.rules.block.hr.exec(F);if(W)return{type:"hr",raw:W[0]}},H.blockquote=function(F){var W=this.rules.block.blockquote.exec(F);if(W){var $=W[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:W[0],text:$}}},H.list=function(F){var W=this.rules.block.list.exec(F);if(W){for(var $=W[0],Q=W[2],de=Q.length>1,le=Q[Q.length-1]===")",Ce={type:"list",raw:$,ordered:de,start:de?+Q.slice(0,-1):"",loose:!1,items:[]},Oe=W[0].match(this.rules.block.item),Me=!1,Pe,je,Fe,_e,qe,ze,Qe,$e=Oe.length,He=0;He<$e;He++)Pe=Oe[He],$=Pe,je=Pe.length,Pe=Pe.replace(/^ *([*+-]|\d+[.)]) */,""),~Pe.indexOf(`
`)&&(je-=Pe.length,Pe=this.options.pedantic?Pe.replace(/^ {1,4}/gm,""):Pe.replace(new RegExp("^ {1,"+je+"}","gm"),"")),He!==$e-1&&(Fe=this.rules.block.bullet.exec(Oe[He+1])[0],(de?Fe.length===1||!le&&Fe[Fe.length-1]===")":Fe.length>1||this.options.smartLists&&Fe!==Q)&&(_e=Oe.slice(He+1).join(`
`),Ce.raw=Ce.raw.substring(0,Ce.raw.length-_e.length),He=$e-1)),qe=Me||/\n\n(?!\s*$)/.test(Pe),He!==$e-1&&(Me=Pe.charAt(Pe.length-1)===`
`,qe||(qe=Me)),qe&&(Ce.loose=!0),ze=/^\[[ xX]\] /.test(Pe),Qe=void 0,ze&&(Qe=Pe[1]!==" ",Pe=Pe.replace(/^\[[ xX]\] +/,"")),Ce.items.push({type:"list_item",raw:$,task:ze,checked:Qe,loose:qe,text:Pe});return Ce}},H.html=function(F){var W=this.rules.block.html.exec(F);if(W)return{type:this.options.sanitize?"paragraph":"html",raw:W[0],pre:!this.options.sanitizer&&(W[1]==="pre"||W[1]==="script"||W[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(W[0]):ae(W[0]):W[0]}},H.def=function(F){var W=this.rules.block.def.exec(F);if(W){W[3]&&(W[3]=W[3].substring(1,W[3].length-1));var $=W[1].toLowerCase().replace(/\s+/g," ");return{tag:$,raw:W[0],href:W[2],title:W[3]}}},H.table=function(F){var W=this.rules.block.table.exec(F);if(W){var $={type:"table",header:ee(W[1].replace(/^ *| *\| *$/g,"")),align:W[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:W[3]?W[3].replace(/\n$/,"").split(`
`):[]};if($.header.length===$.align.length){$.raw=W[0];var Q=$.align.length,de;for(de=0;de<Q;de++)/^ *-+: *$/.test($.align[de])?$.align[de]="right":/^ *:-+: *$/.test($.align[de])?$.align[de]="center":/^ *:-+ *$/.test($.align[de])?$.align[de]="left":$.align[de]=null;for(Q=$.cells.length,de=0;de<Q;de++)$.cells[de]=ee($.cells[de].replace(/^ *\| *| *\| *$/g,""),$.header.length);return $}}},H.lheading=function(F){var W=this.rules.block.lheading.exec(F);if(W)return{type:"heading",raw:W[0],depth:W[2].charAt(0)==="="?1:2,text:W[1]}},H.paragraph=function(F){var W=this.rules.block.paragraph.exec(F);if(W)return{type:"paragraph",raw:W[0],text:W[1].charAt(W[1].length-1)===`
`?W[1].slice(0,-1):W[1]}},H.text=function(F,W){var $=this.rules.block.text.exec(F);if($){var Q=W[W.length-1];return Q&&Q.type==="text"?{raw:$[0],text:$[0]}:{type:"text",raw:$[0],text:$[0]}}},H.escape=function(F){var W=this.rules.inline.escape.exec(F);if(W)return{type:"escape",raw:W[0],text:ae(W[1])}},H.tag=function(F,W,$){var Q=this.rules.inline.tag.exec(F);if(Q)return!W&&/^<a /i.test(Q[0])?W=!0:W&&/^<\/a>/i.test(Q[0])&&(W=!1),!$&&/^<(pre|code|kbd|script)(\s|>)/i.test(Q[0])?$=!0:$&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(Q[0])&&($=!1),{type:this.options.sanitize?"text":"html",raw:Q[0],inLink:W,inRawBlock:$,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Q[0]):ae(Q[0]):Q[0]}},H.link=function(F){var W=this.rules.inline.link.exec(F);if(W){var $=be(W[2],"()");if($>-1){var Q=W[0].indexOf("!")===0?5:4,de=Q+W[1].length+$;W[2]=W[2].substring(0,$),W[0]=W[0].substring(0,de).trim(),W[3]=""}var le=W[2],Ce="";if(this.options.pedantic){var Oe=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(le);Oe?(le=Oe[1],Ce=Oe[3]):Ce=""}else Ce=W[3]?W[3].slice(1,-1):"";le=le.trim().replace(/^<([\s\S]*)>$/,"$1");var Me=he(W,{href:le&&le.replace(this.rules.inline._escapes,"$1"),title:Ce&&Ce.replace(this.rules.inline._escapes,"$1")},W[0]);return Me}},H.reflink=function(F,W){var $;if(($=this.rules.inline.reflink.exec(F))||($=this.rules.inline.nolink.exec(F))){var Q=($[2]||$[1]).replace(/\s+/g," ");if(Q=W[Q.toLowerCase()],!Q||!Q.href){var de=$[0].charAt(0);return{type:"text",raw:de,text:de}}var le=he($,Q,$[0]);return le}},H.strong=function(F,W,$){$===void 0&&($="");var Q=this.rules.inline.strong.start.exec(F);if(Q&&(!Q[1]||Q[1]&&($===""||this.rules.inline.punctuation.exec($)))){W=W.slice(-1*F.length);var de=Q[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;de.lastIndex=0;for(var le;(Q=de.exec(W))!=null;)if(le=this.rules.inline.strong.middle.exec(W.slice(0,Q.index+3)),le)return{type:"strong",raw:F.slice(0,le[0].length),text:F.slice(2,le[0].length-2)}}},H.em=function(F,W,$){$===void 0&&($="");var Q=this.rules.inline.em.start.exec(F);if(Q&&(!Q[1]||Q[1]&&($===""||this.rules.inline.punctuation.exec($)))){W=W.slice(-1*F.length);var de=Q[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;de.lastIndex=0;for(var le;(Q=de.exec(W))!=null;)if(le=this.rules.inline.em.middle.exec(W.slice(0,Q.index+2)),le)return{type:"em",raw:F.slice(0,le[0].length),text:F.slice(1,le[0].length-1)}}},H.codespan=function(F){var W=this.rules.inline.code.exec(F);if(W){var $=W[2].replace(/\n/g," "),Q=/[^ ]/.test($),de=$.startsWith(" ")&&$.endsWith(" ");return Q&&de&&($=$.substring(1,$.length-1)),$=ae($,!0),{type:"codespan",raw:W[0],text:$}}},H.br=function(F){var W=this.rules.inline.br.exec(F);if(W)return{type:"br",raw:W[0]}},H.del=function(F){var W=this.rules.inline.del.exec(F);if(W)return{type:"del",raw:W[0],text:W[1]}},H.autolink=function(F,W){var $=this.rules.inline.autolink.exec(F);if($){var Q,de;return $[2]==="@"?(Q=ae(this.options.mangle?W($[1]):$[1]),de="mailto:"+Q):(Q=ae($[1]),de=Q),{type:"link",raw:$[0],text:Q,href:de,tokens:[{type:"text",raw:Q,text:Q}]}}},H.url=function(F,W){var $;if($=this.rules.inline.url.exec(F)){var Q,de;if($[2]==="@")Q=ae(this.options.mangle?W($[0]):$[0]),de="mailto:"+Q;else{var le;do le=$[0],$[0]=this.rules.inline._backpedal.exec($[0])[0];while(le!==$[0]);Q=ae($[0]),$[1]==="www."?de="http://"+Q:de=Q}return{type:"link",raw:$[0],text:Q,href:de,tokens:[{type:"text",raw:Q,text:Q}]}}},H.inlineText=function(F,W,$){var Q=this.rules.inline.text.exec(F);if(Q){var de;return W?de=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Q[0]):ae(Q[0]):Q[0]:de=ae(this.options.smartypants?$(Q[0]):Q[0]),{type:"text",raw:Q[0],text:de}}},B}(),te=V.noopTest,q=V.edit,oe=V.merge,Z={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:te,table:te,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};Z._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,Z._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,Z.def=q(Z.def).replace("label",Z._label).replace("title",Z._title).getRegex(),Z.bullet=/(?:[*+-]|\d{1,9}[.)])/,Z.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,Z.item=q(Z.item,"gm").replace(/bull/g,Z.bullet).getRegex(),Z.list=q(Z.list).replace(/bull/g,Z.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Z.def.source+")").getRegex(),Z._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",Z._comment=/<!--(?!-?>)[\s\S]*?-->/,Z.html=q(Z.html,"i").replace("comment",Z._comment).replace("tag",Z._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Z.paragraph=q(Z._paragraph).replace("hr",Z.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",Z._tag).getRegex(),Z.blockquote=q(Z.blockquote).replace("paragraph",Z.paragraph).getRegex(),Z.normal=oe({},Z),Z.gfm=oe({},Z.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*|$)"}),Z.gfm.nptable=q(Z.gfm.nptable).replace("hr",Z.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",Z._tag).getRegex(),Z.gfm.table=q(Z.gfm.table).replace("hr",Z.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",Z._tag).getRegex(),Z.pedantic=oe({},Z.normal,{html:q(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Z._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:te,paragraph:q(Z.normal._paragraph).replace("hr",Z.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",Z.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var D={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:te,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:te,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};D._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",D.punctuation=q(D.punctuation).replace(/punctuation/g,D._punctuation).getRegex(),D._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",D._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",D.em.start=q(D.em.start).replace(/punctuation/g,D._punctuation).getRegex(),D.em.middle=q(D.em.middle).replace(/punctuation/g,D._punctuation).replace(/overlapSkip/g,D._overlapSkip).getRegex(),D.em.endAst=q(D.em.endAst,"g").replace(/punctuation/g,D._punctuation).getRegex(),D.em.endUnd=q(D.em.endUnd,"g").replace(/punctuation/g,D._punctuation).getRegex(),D.strong.start=q(D.strong.start).replace(/punctuation/g,D._punctuation).getRegex(),D.strong.middle=q(D.strong.middle).replace(/punctuation/g,D._punctuation).replace(/blockSkip/g,D._blockSkip).getRegex(),D.strong.endAst=q(D.strong.endAst,"g").replace(/punctuation/g,D._punctuation).getRegex(),D.strong.endUnd=q(D.strong.endUnd,"g").replace(/punctuation/g,D._punctuation).getRegex(),D.blockSkip=q(D._blockSkip,"g").getRegex(),D.overlapSkip=q(D._overlapSkip,"g").getRegex(),D._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,D._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,D._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])?)+(?![-_])/,D.autolink=q(D.autolink).replace("scheme",D._scheme).replace("email",D._email).getRegex(),D._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,D.tag=q(D.tag).replace("comment",Z._comment).replace("attribute",D._attribute).getRegex(),D._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,D._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,D._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,D.link=q(D.link).replace("label",D._label).replace("href",D._href).replace("title",D._title).getRegex(),D.reflink=q(D.reflink).replace("label",D._label).getRegex(),D.reflinkSearch=q(D.reflinkSearch,"g").replace("reflink",D.reflink).replace("nolink",D.nolink).getRegex(),D.normal=oe({},D),D.pedantic=oe({},D.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:q(/^!?\[(label)\]\((.*?)\)/).replace("label",D._label).getRegex(),reflink:q(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",D._label).getRegex()}),D.gfm=oe({},D.normal,{escape:q(D.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),D.gfm.url=q(D.gfm.url,"i").replace("email",D.gfm._extended_email).getRegex(),D.breaks=oe({},D.gfm,{br:q(D.br).replace("{2,}","*").getRegex(),text:q(D.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var h={block:Z,inline:D},m=K.defaults,P=h.block,_=h.inline;function A(B){return B.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function Y(B){var H="",X,F,W=B.length;for(X=0;X<W;X++)F=B.charCodeAt(X),Math.random()>.5&&(F="x"+F.toString(16)),H+="&#"+F+";";return H}var ne=function(){function B(X){this.tokens=[],this.tokens.links=Object.create(null),this.options=X||m,this.options.tokenizer=this.options.tokenizer||new ce,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var F={block:P.normal,inline:_.normal};this.options.pedantic?(F.block=P.pedantic,F.inline=_.pedantic):this.options.gfm&&(F.block=P.gfm,this.options.breaks?F.inline=_.breaks:F.inline=_.gfm),this.tokenizer.rules=F}B.lex=function(F,W){var $=new B(W);return $.lex(F)};var H=B.prototype;return H.lex=function(F){return F=F.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(F,this.tokens,!0),this.inline(this.tokens),this.tokens},H.blockTokens=function(F,W,$){W===void 0&&(W=[]),$===void 0&&($=!0),F=F.replace(/^ +$/gm,"");for(var Q,de,le,Ce;F;){if(Q=this.tokenizer.space(F)){F=F.substring(Q.raw.length),Q.type&&W.push(Q);continue}if(Q=this.tokenizer.code(F,W)){F=F.substring(Q.raw.length),Q.type?W.push(Q):(Ce=W[W.length-1],Ce.raw+=`
`+Q.raw,Ce.text+=`
`+Q.text);continue}if(Q=this.tokenizer.fences(F)){F=F.substring(Q.raw.length),W.push(Q);continue}if(Q=this.tokenizer.heading(F)){F=F.substring(Q.raw.length),W.push(Q);continue}if(Q=this.tokenizer.nptable(F)){F=F.substring(Q.raw.length),W.push(Q);continue}if(Q=this.tokenizer.hr(F)){F=F.substring(Q.raw.length),W.push(Q);continue}if(Q=this.tokenizer.blockquote(F)){F=F.substring(Q.raw.length),Q.tokens=this.blockTokens(Q.text,[],$),W.push(Q);continue}if(Q=this.tokenizer.list(F)){for(F=F.substring(Q.raw.length),le=Q.items.length,de=0;de<le;de++)Q.items[de].tokens=this.blockTokens(Q.items[de].text,[],!1);W.push(Q);continue}if(Q=this.tokenizer.html(F)){F=F.substring(Q.raw.length),W.push(Q);continue}if($&&(Q=this.tokenizer.def(F))){F=F.substring(Q.raw.length),this.tokens.links[Q.tag]||(this.tokens.links[Q.tag]={href:Q.href,title:Q.title});continue}if(Q=this.tokenizer.table(F)){F=F.substring(Q.raw.length),W.push(Q);continue}if(Q=this.tokenizer.lheading(F)){F=F.substring(Q.raw.length),W.push(Q);continue}if($&&(Q=this.tokenizer.paragraph(F))){F=F.substring(Q.raw.length),W.push(Q);continue}if(Q=this.tokenizer.text(F,W)){F=F.substring(Q.raw.length),Q.type?W.push(Q):(Ce=W[W.length-1],Ce.raw+=`
`+Q.raw,Ce.text+=`
`+Q.text);continue}if(F){var Oe="Infinite loop on byte: "+F.charCodeAt(0);if(this.options.silent){console.error(Oe);break}else throw new Error(Oe)}}return W},H.inline=function(F){var W,$,Q,de,le,Ce,Oe=F.length;for(W=0;W<Oe;W++){Ce=F[W];switch(Ce.type){case"paragraph":case"text":case"heading":{Ce.tokens=[],this.inlineTokens(Ce.text,Ce.tokens);break}case"table":{for(Ce.tokens={header:[],cells:[]},de=Ce.header.length,$=0;$<de;$++)Ce.tokens.header[$]=[],this.inlineTokens(Ce.header[$],Ce.tokens.header[$]);for(de=Ce.cells.length,$=0;$<de;$++)for(le=Ce.cells[$],Ce.tokens.cells[$]=[],Q=0;Q<le.length;Q++)Ce.tokens.cells[$][Q]=[],this.inlineTokens(le[Q],Ce.tokens.cells[$][Q]);break}case"blockquote":{this.inline(Ce.tokens);break}case"list":{for(de=Ce.items.length,$=0;$<de;$++)this.inline(Ce.items[$].tokens);break}}}return F},H.inlineTokens=function(F,W,$,Q,de){W===void 0&&(W=[]),$===void 0&&($=!1),Q===void 0&&(Q=!1),de===void 0&&(de="");var le,Ce=F,Oe;if(this.tokens.links){var Me=Object.keys(this.tokens.links);if(Me.length>0)for(;(Oe=this.tokenizer.rules.inline.reflinkSearch.exec(Ce))!=null;)Me.includes(Oe[0].slice(Oe[0].lastIndexOf("[")+1,-1))&&(Ce=Ce.slice(0,Oe.index)+"["+"a".repeat(Oe[0].length-2)+"]"+Ce.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Oe=this.tokenizer.rules.inline.blockSkip.exec(Ce))!=null;)Ce=Ce.slice(0,Oe.index)+"["+"a".repeat(Oe[0].length-2)+"]"+Ce.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;F;){if(le=this.tokenizer.escape(F)){F=F.substring(le.raw.length),W.push(le);continue}if(le=this.tokenizer.tag(F,$,Q)){F=F.substring(le.raw.length),$=le.inLink,Q=le.inRawBlock,W.push(le);continue}if(le=this.tokenizer.link(F)){F=F.substring(le.raw.length),le.type==="link"&&(le.tokens=this.inlineTokens(le.text,[],!0,Q)),W.push(le);continue}if(le=this.tokenizer.reflink(F,this.tokens.links)){F=F.substring(le.raw.length),le.type==="link"&&(le.tokens=this.inlineTokens(le.text,[],!0,Q)),W.push(le);continue}if(le=this.tokenizer.strong(F,Ce,de)){F=F.substring(le.raw.length),le.tokens=this.inlineTokens(le.text,[],$,Q),W.push(le);continue}if(le=this.tokenizer.em(F,Ce,de)){F=F.substring(le.raw.length),le.tokens=this.inlineTokens(le.text,[],$,Q),W.push(le);continue}if(le=this.tokenizer.codespan(F)){F=F.substring(le.raw.length),W.push(le);continue}if(le=this.tokenizer.br(F)){F=F.substring(le.raw.length),W.push(le);continue}if(le=this.tokenizer.del(F)){F=F.substring(le.raw.length),le.tokens=this.inlineTokens(le.text,[],$,Q),W.push(le);continue}if(le=this.tokenizer.autolink(F,Y)){F=F.substring(le.raw.length),W.push(le);continue}if(!$&&(le=this.tokenizer.url(F,Y))){F=F.substring(le.raw.length),W.push(le);continue}if(le=this.tokenizer.inlineText(F,Q,A)){F=F.substring(le.raw.length),de=le.raw.slice(-1),W.push(le);continue}if(F){var Pe="Infinite loop on byte: "+F.charCodeAt(0);if(this.options.silent){console.error(Pe);break}else throw new Error(Pe)}}return W},U(B,null,[{key:"rules",get:function(){return{block:P,inline:_}}}]),B}(),ue=K.defaults,fe=V.cleanUrl,Ee=V.escape,we=function(){function B(X){this.options=X||ue}var H=B.prototype;return H.code=function(F,W,$){var Q=(W||"").match(/\S*/)[0];if(this.options.highlight){var de=this.options.highlight(F,Q);de!=null&&de!==F&&($=!0,F=de)}return Q?'<pre><code class="'+this.options.langPrefix+Ee(Q,!0)+'">'+($?F:Ee(F,!0))+`</code></pre>
`:"<pre><code>"+($?F:Ee(F,!0))+`</code></pre>
`},H.blockquote=function(F){return`<blockquote>
`+F+`</blockquote>
`},H.html=function(F){return F},H.heading=function(F,W,$,Q){return this.options.headerIds?"<h"+W+' id="'+this.options.headerPrefix+Q.slug($)+'">'+F+"</h"+W+`>
`:"<h"+W+">"+F+"</h"+W+`>
`},H.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},H.list=function(F,W,$){var Q=W?"ol":"ul",de=W&&$!==1?' start="'+$+'"':"";return"<"+Q+de+`>
`+F+"</"+Q+`>
`},H.listitem=function(F){return"<li>"+F+`</li>
`},H.checkbox=function(F){return"<input "+(F?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},H.paragraph=function(F){return"<p>"+F+`</p>
`},H.table=function(F,W){return W&&(W="<tbody>"+W+"</tbody>"),`<table>
<thead>
`+F+`</thead>
`+W+`</table>
`},H.tablerow=function(F){return`<tr>
`+F+`</tr>
`},H.tablecell=function(F,W){var $=W.header?"th":"td",Q=W.align?"<"+$+' align="'+W.align+'">':"<"+$+">";return Q+F+"</"+$+`>
`},H.strong=function(F){return"<strong>"+F+"</strong>"},H.em=function(F){return"<em>"+F+"</em>"},H.codespan=function(F){return"<code>"+F+"</code>"},H.br=function(){return this.options.xhtml?"<br/>":"<br>"},H.del=function(F){return"<del>"+F+"</del>"},H.link=function(F,W,$){if(F=fe(this.options.sanitize,this.options.baseUrl,F),F===null)return $;var Q='<a href="'+Ee(F)+'"';return W&&(Q+=' title="'+W+'"'),Q+=">"+$+"</a>",Q},H.image=function(F,W,$){if(F=fe(this.options.sanitize,this.options.baseUrl,F),F===null)return $;var Q='<img src="'+F+'" alt="'+$+'"';return W&&(Q+=' title="'+W+'"'),Q+=this.options.xhtml?"/>":">",Q},H.text=function(F){return F},B}(),Ae=function(){function B(){}var H=B.prototype;return H.strong=function(F){return F},H.em=function(F){return F},H.codespan=function(F){return F},H.del=function(F){return F},H.html=function(F){return F},H.text=function(F){return F},H.link=function(F,W,$){return""+$},H.image=function(F,W,$){return""+$},H.br=function(){return""},B}(),De=function(){function B(){this.seen={}}var H=B.prototype;return H.slug=function(F){var W=F.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(W)){var $=W;do this.seen[$]++,W=$+"-"+this.seen[$];while(this.seen.hasOwnProperty(W))}return this.seen[W]=0,W},B}(),se=K.defaults,pe=V.unescape,ge=function(){function B(X){this.options=X||se,this.options.renderer=this.options.renderer||new we,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ae,this.slugger=new De}B.parse=function(F,W){var $=new B(W);return $.parse(F)};var H=B.prototype;return H.parse=function(F,W){W===void 0&&(W=!0);var $="",Q,de,le,Ce,Oe,Me,Pe,je,Fe,_e,qe,ze,Qe,$e,He,rt,it,Je,lt=F.length;for(Q=0;Q<lt;Q++){_e=F[Q];switch(_e.type){case"space":continue;case"hr":{$+=this.renderer.hr();continue}case"heading":{$+=this.renderer.heading(this.parseInline(_e.tokens),_e.depth,pe(this.parseInline(_e.tokens,this.textRenderer)),this.slugger);continue}case"code":{$+=this.renderer.code(_e.text,_e.lang,_e.escaped);continue}case"table":{for(je="",Pe="",Ce=_e.header.length,de=0;de<Ce;de++)Pe+=this.renderer.tablecell(this.parseInline(_e.tokens.header[de]),{header:!0,align:_e.align[de]});for(je+=this.renderer.tablerow(Pe),Fe="",Ce=_e.cells.length,de=0;de<Ce;de++){for(Me=_e.tokens.cells[de],Pe="",Oe=Me.length,le=0;le<Oe;le++)Pe+=this.renderer.tablecell(this.parseInline(Me[le]),{header:!1,align:_e.align[le]});Fe+=this.renderer.tablerow(Pe)}$+=this.renderer.table(je,Fe);continue}case"blockquote":{Fe=this.parse(_e.tokens),$+=this.renderer.blockquote(Fe);continue}case"list":{for(qe=_e.ordered,ze=_e.start,Qe=_e.loose,Ce=_e.items.length,Fe="",de=0;de<Ce;de++)He=_e.items[de],rt=He.checked,it=He.task,$e="",He.task&&(Je=this.renderer.checkbox(rt),Qe?He.tokens.length>0&&He.tokens[0].type==="text"?(He.tokens[0].text=Je+" "+He.tokens[0].text,He.tokens[0].tokens&&He.tokens[0].tokens.length>0&&He.tokens[0].tokens[0].type==="text"&&(He.tokens[0].tokens[0].text=Je+" "+He.tokens[0].tokens[0].text)):He.tokens.unshift({type:"text",text:Je}):$e+=Je),$e+=this.parse(He.tokens,Qe),Fe+=this.renderer.listitem($e,it,rt);$+=this.renderer.list(Fe,qe,ze);continue}case"html":{$+=this.renderer.html(_e.text);continue}case"paragraph":{$+=this.renderer.paragraph(this.parseInline(_e.tokens));continue}case"text":{for(Fe=_e.tokens?this.parseInline(_e.tokens):_e.text;Q+1<lt&&F[Q+1].type==="text";)_e=F[++Q],Fe+=`
`+(_e.tokens?this.parseInline(_e.tokens):_e.text);$+=W?this.renderer.paragraph(Fe):Fe;continue}default:{var Ye='Token with "'+_e.type+'" type was not found.';if(this.options.silent){console.error(Ye);return}else throw new Error(Ye)}}}return $},H.parseInline=function(F,W){W=W||this.renderer;var $="",Q,de,le=F.length;for(Q=0;Q<le;Q++){de=F[Q];switch(de.type){case"escape":{$+=W.text(de.text);break}case"html":{$+=W.html(de.text);break}case"link":{$+=W.link(de.href,de.title,this.parseInline(de.tokens,W));break}case"image":{$+=W.image(de.href,de.title,de.text);break}case"strong":{$+=W.strong(this.parseInline(de.tokens,W));break}case"em":{$+=W.em(this.parseInline(de.tokens,W));break}case"codespan":{$+=W.codespan(de.text);break}case"br":{$+=W.br();break}case"del":{$+=W.del(this.parseInline(de.tokens,W));break}case"text":{$+=W.text(de.text);break}default:{var Ce='Token with "'+de.type+'" type was not found.';if(this.options.silent){console.error(Ce);return}else throw new Error(Ce)}}}return $},B}(),xe=V.merge,Te=V.checkSanitizeDeprecation,Se=V.escape,ye=K.getDefaults,Le=K.changeDefaults,Re=K.defaults;function z(B,H,X){if(typeof B=="undefined"||B===null)throw new Error("marked(): input parameter is undefined or null");if(typeof B!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(B)+", string expected");if(typeof H=="function"&&(X=H,H=null),H=xe({},z.defaults,H||{}),Te(H),X){var F=H.highlight,W;try{W=ne.lex(B,H)}catch(le){return X(le)}var $=function(Ce){var Oe;if(!Ce)try{Oe=ge.parse(W,H)}catch(Me){Ce=Me}return H.highlight=F,Ce?X(Ce):X(null,Oe)};if(!F||F.length<3)return $();if(delete H.highlight,!W.length)return $();var Q=0;z.walkTokens(W,function(le){le.type==="code"&&(Q++,setTimeout(function(){F(le.text,le.lang,function(Ce,Oe){if(Ce)return $(Ce);Oe!=null&&Oe!==le.text&&(le.text=Oe,le.escaped=!0),Q--,Q===0&&$()})},0))}),Q===0&&$();return}try{var de=ne.lex(B,H);return H.walkTokens&&z.walkTokens(de,H.walkTokens),ge.parse(de,H)}catch(le){if(le.message+=`
Please report this to https://github.com/markedjs/marked.`,H.silent)return"<p>An error occurred:</p><pre>"+Se(le.message+"",!0)+"</pre>";throw le}}z.options=z.setOptions=function(B){return xe(z.defaults,B),Le(z.defaults),z},z.getDefaults=ye,z.defaults=Re,z.use=function(B){var H=xe({},B);if(B.renderer&&function(){var F=z.defaults.renderer||new we,W=function(de){var le=F[de];F[de]=function(){for(var Ce=arguments.length,Oe=new Array(Ce),Me=0;Me<Ce;Me++)Oe[Me]=arguments[Me];var Pe=B.renderer[de].apply(F,Oe);return Pe===!1&&(Pe=le.apply(F,Oe)),Pe}};for(var $ in B.renderer)W($);H.renderer=F}(),B.tokenizer&&function(){var F=z.defaults.tokenizer||new ce,W=function(de){var le=F[de];F[de]=function(){for(var Ce=arguments.length,Oe=new Array(Ce),Me=0;Me<Ce;Me++)Oe[Me]=arguments[Me];var Pe=B.tokenizer[de].apply(F,Oe);return Pe===!1&&(Pe=le.apply(F,Oe)),Pe}};for(var $ in B.tokenizer)W($);H.tokenizer=F}(),B.walkTokens){var X=z.defaults.walkTokens;H.walkTokens=function(F){B.walkTokens(F),X&&X(F)}}z.setOptions(H)},z.walkTokens=function(B,H){for(var X=O(B),F;!(F=X()).done;){var W=F.value;H(W);switch(W.type){case"table":{for(var $=O(W.tokens.header),Q;!(Q=$()).done;){var de=Q.value;z.walkTokens(de,H)}for(var le=O(W.tokens.cells),Ce;!(Ce=le()).done;)for(var Oe=Ce.value,Me=O(Oe),Pe;!(Pe=Me()).done;){var je=Pe.value;z.walkTokens(je,H)}break}case"list":{z.walkTokens(W.items,H);break}default:W.tokens&&z.walkTokens(W.tokens,H)}}},z.Parser=ge,z.parser=ge.parse,z.Renderer=we,z.TextRenderer=Ae,z.Lexer=ne,z.lexer=ne.lex,z.Tokenizer=ce,z.Slugger=De,z.parse=z;var N=z;return N})},Etsf:function(Ve,Ie,ie){"use strict";ie.r(Ie);var ve=ie("5Dmo"),U=ie("3S7+"),C=ie("14J3"),j=ie("BMrR"),O=ie("jCWc"),x=ie("kPKH"),K=ie("sPJy"),M=ie("bE4q"),R=ie("k1fw"),L=ie("9og8"),y=ie("y8nQ"),T=ie("Vl3Y"),w=ie("tJVT"),E=ie("PpiC"),b=ie("WmNS"),v=ie.n(b),l=ie("q1tI"),e=ie.n(l),s=ie("55Ip"),a=ie("9kvl"),c=ie("9Bee"),d=ie("xKgJ"),o=ie("U/Y8"),f=ie.n(o),u=ie("Q9mQ"),i=ie("diRs"),r=ie("miYZ"),t=ie("tsqr"),n=ie("2qtc"),g=ie("kLXV"),p=ie("oBTY"),S=ie("ozfa"),k=ie("MJZm"),I=ie("5NDa"),G=ie("5rEg"),V=ie("jrin"),J=ie("nRaC"),re=ie("5RzL"),ee=ie("ErOA"),ae=ie("Ty5D"),be=re.a.TreeNode,he=function(ue){var fe=ue.restful,Ee=ue.loading,we=ue.dispatch,Ae=Object(ae.i)(),De=Object(ae.h)(),se=Object(l.useState)(!1),pe=Object(w.a)(se,2),ge=pe[0],xe=pe[1],Te=Object(l.useState)(),Se=Object(w.a)(Te,2),ye=Se[0],Le=Se[1],Re=fe.actionTabs,z=T.a.useForm(),N=Object(w.a)(z,1),B=N[0];return Object(l.useEffect)(function(){fe.actionTabs.key=="\u65B0\u5EFA\u540C\u7EA7\u76EE\u5F55"&&B.resetFields()},[fe.actionTabs.key]),fe.actionTabs.key!=="\u65B0\u5EFA\u540C\u7EA7\u76EE\u5F55"?null:e.a.createElement(g.a,{centered:!0,title:"\u65B0\u5EFA\u76EE\u5F55",visible:fe.actionTabs.key==="\u65B0\u5EFA\u540C\u7EA7\u76EE\u5F55",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",bodyStyle:{minHeight:150},confirmLoading:ge,onOk:Object(L.a)(v.a.mark(function H(){var X,F,W;return v.a.wrap(function(Q){for(;;)switch(Q.prev=Q.next){case 0:return Q.next=2,B.validateFields();case 2:return X=B.getFieldValue(),xe(!0),F="/api/restfuls.json",Q.next=7,Object(ee.a)(F,{method:"post",body:Object(R.a)({file_type:1},X)});case 7:W=Q.sent,W.status===0&&(t.b.success("\u6DFB\u52A0\u6210\u529F"),we({type:"restful/setActionTabs",payload:{}}),we({type:"restful/getRestful"})),xe(!1);case 10:case"end":return Q.stop()}},H)})),onCancel:function(){we({type:"restful/setActionTabs",payload:{}})}},e.a.createElement("div",{className:"pl30 pr30"},e.a.createElement(T.a,{form:B,initialValues:Object(V.a)({},"name","")},e.a.createElement(T.a.Item,{name:"name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u76EE\u5F55\u540D\u79F0"}]},e.a.createElement(j.a,{className:"mt30"},e.a.createElement(x.a,{flex:"80px",className:"font14"},"\u76EE\u5F55\u540D\u79F0\uFF1A"),e.a.createElement(x.a,{flex:"1"},e.a.createElement(G.a,{placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26 ",maxLength:60})))))))},me=Object(a.a)(function(ne){var ue=ne.restful,fe=ne.loading;return{restful:ue,loading:fe}})(he),ce=re.a.TreeNode,te=function(ue){var fe=ue.restful,Ee=ue.loading,we=ue.dispatch,Ae=Object(ae.i)(),De=Object(ae.h)(),se=Object(l.useState)(!1),pe=Object(w.a)(se,2),ge=pe[0],xe=pe[1],Te=Object(l.useState)(),Se=Object(w.a)(Te,2),ye=Se[0],Le=Se[1],Re=fe.actionTabs,z=T.a.useForm(),N=Object(w.a)(z,1),B=N[0];return Object(l.useEffect)(function(){fe.actionTabs.key=="\u91CD\u547D\u540D"&&(B.resetFields(),B.setFieldsValue({name:fe.actionTabs.data.title}))},[fe.actionTabs.key]),fe.actionTabs.key!=="\u91CD\u547D\u540D"?null:e.a.createElement(g.a,{centered:!0,title:"\u91CD\u547D\u540D",visible:fe.actionTabs.key==="\u91CD\u547D\u540D",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",bodyStyle:{minHeight:150},confirmLoading:ge,onOk:Object(L.a)(v.a.mark(function H(){var X,F,W;return v.a.wrap(function(Q){for(;;)switch(Q.prev=Q.next){case 0:return Q.next=2,B.validateFields();case 2:return X=B.getFieldValue(),xe(!0),F="/api/restfuls/".concat(fe.actionTabs.data.id,".json"),Q.next=7,Object(ee.a)(F,{method:"put",body:Object(R.a)({file_type:1},X)});case 7:W=Q.sent,W.status===0&&(t.b.success("\u4FEE\u6539\u6210\u529F"),we({type:"restful/setActionTabs",payload:{}}),we({type:"restful/getRestful"})),xe(!1);case 10:case"end":return Q.stop()}},H)})),onCancel:function(){we({type:"restful/setActionTabs",payload:{}})}},e.a.createElement("div",{className:"pl30 pr30"},e.a.createElement(T.a,{form:B,initialValues:Object(V.a)({},"name","")},e.a.createElement(j.a,{className:"mt30"},e.a.createElement(x.a,{flex:"80px",className:"font14"},"\u76EE\u5F55\u540D\u79F0\uFF1A"),e.a.createElement(x.a,{flex:"1"},e.a.createElement(T.a.Item,{name:"name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u65B0\u540D\u79F0"}]},e.a.createElement(G.a,{placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26 ",maxLength:60})))))))},q=Object(a.a)(function(ne){var ue=ne.restful,fe=ne.loading;return{restful:ue,loading:fe}})(te),oe=ie("s7vb"),Z=ie("P48q"),D=ie.n(Z),h=G.a.Search,m=k.a.DirectoryTree,P=function(ue){var fe=ue.user,Ee=ue.globalSetting,we=ue.loading,Ae=ue.dispatch,De=ue.restful,se=Object(E.a)(ue,["user","globalSetting","loading","dispatch","restful"]),pe=Object(l.useState)({content:"",message:"",status:0,contacts:[],address:"",data:[]}),ge=Object(w.a)(pe,2),xe=ge[0],Te=ge[1],Se=Object(l.useState)(!0),ye=Object(w.a)(Se,2),Le=ye[0],Re=ye[1],z=T.a.useForm(),N=Object(w.a)(z,1),B=N[0],H=Object(l.useState)(""),X=Object(w.a)(H,2),F=X[0],W=X[1],$=Object(l.useState)([{id:1,name:"\u65B0\u5EFA\u6587\u4EF6"},{id:2,name:"\u65B0\u5EFA\u540C\u7EA7\u76EE\u5F55"},{id:3,name:"\u91CD\u547D\u540D"},{id:4,name:"\u7F16\u8F91"},{id:5,name:"\u5220\u9664"}]),Q=Object(w.a)($,1),de=Q[0],le=Object(l.useState)([]),Ce=Object(w.a)(le,2),Oe=Ce[0],Me=Ce[1],Pe=Object(l.useState)([]),je=Object(w.a)(Pe,2),Fe=je[0],_e=je[1],qe=Object(l.useState)(!1),ze=Object(w.a)(qe,2),Qe=ze[0],$e=ze[1],He=Object(l.useState)([]),rt=Object(w.a)(He,2),it=rt[0],Je=rt[1];Object(l.useEffect)(function(){var et;if((et=De.restful)!==null&&et!==void 0&&et.data){var Be,ke,Ge;Je(Object(p.a)((Be=De.restful)===null||Be===void 0?void 0:Be.data));var Ne=0,Ke;if((ke=De.restful)===null||ke===void 0||((Ge=ke.data)===null||Ge===void 0)||Ge.map(function(Ue){var Ze;Ue.id==se.match.params.id&&(Ne=Ue.id),Ue.file_type==0&&!Ke&&(Ke=Ue.id),Ue==null||((Ze=Ue.children)===null||Ze===void 0)||Ze.map(function(Xe){Ke||(Ke=Xe.id),Xe.id==se.match.params.id&&(Ne=Ue.id)}),!Ue.children&&!Ke&&(Ke=Ue.id)}),!se.match.params.id&&Ke){se.history.push("/ch/rest/".concat(Ke));return}Ne&&setTimeout(function(){Me([Ne]),_e([Number(se.match.params.id||Ke)])},200)}},[De.restful]);var lt=function(Be,ke){ke.node.file_type===0?se.history.push("/ch/rest/".concat(Be[0])):_e(Object(p.a)(Be)),console.log("Trigger Select",Be,ke)},Ye=function(Be){Me(Be),console.log("Trigger Expand",Be)},ot=function(Be){return e.a.createElement("div",null,de.map(function(ke,Ge){return e.a.createElement("p",{key:ke.id,className:"current",onClick:function(){switch(ke.id){case 1:se.history.push("/ch/rest/edit/".concat(Be.id,"/0"));break;case 2:case 3:Ae({type:"restful/setActionTabs",payload:{key:ke.name,data:Be}});break;case 4:document.location.href="/ch/rest/edit/".concat(Be.pid||0,"/").concat(Be.id);break;case 5:g.a.confirm({title:"\u63D0\u793A",content:"\u662F\u5426\u786E\u5B9A\u5220\u9664\uFF1F",onOk:function(){var Ke=Object(L.a)(v.a.mark(function Ze(){var Xe;return v.a.wrap(function(vt){for(;;)switch(vt.prev=vt.next){case 0:return vt.next=2,Object(oe.a)({id:Be.id});case 2:Xe=vt.sent,(Xe==null?void 0:Xe.status)==0&&(t.b.success("\u5220\u9664\u6210\u529F"),Ae({type:"restful/getRestful"}));case 4:case"end":return vt.stop()}},Ze)}));function Ue(){return Ke.apply(this,arguments)}return Ue}()});break}}},ke.name)}).filter(function(ke){return!!ke}).filter(function(ke){return Be.pid||Be.file_type==0?ke.key>3:ke.key!=4}))},tt=function et(Be){return Be.map(function(ke){var Ge=ke.title.indexOf(F),Ne=ke.title.substr(0,Ge),Ke=ke.title.substr(Ge+F.length),Ue=e.a.createElement("span",null,Ne,e.a.createElement("span",{className:"c-blue"},F),Ke,Object(d.o)()&&e.a.createElement(i.a,{placement:"right",title:F,content:function(){return ot(ke)},trigger:"hover"},e.a.createElement("span",{className:"iconfont icon-sandian ".concat(D.a.actions)})));if(F!==""){var Ze;if(Ge===-1&&!((Ze=ke.children)!==null&&Ze!==void 0&&Ze.length))return null}return ke.children&&ke.file_type===1?Object(R.a)(Object(R.a)({},ke),{},{title:Ue,key:ke.key,children:et(ke.children)}):Object(R.a)(Object(R.a)({},ke),{},{title:Ue,key:ke.key,isLeaf:!0})}).filter(function(ke){return!!ke})},nt=function et(Be,ke){for(var Ge,Ne=0;Ne<ke.length;Ne++){var Ke=ke[Ne];Ke.children&&(Ke.children.some(function(Ue){return Ue.key===Be})?Ge=Ke.key:et(Be,Ke.children)&&(Ge=et(Be,Ke.children)))}return Ge},ft=function(Be){var ke=Be.target.value,Ge=it.map(function(Ne){if(Ne!=null&&Ne.children){var Ke;return Ne!=null&&(Ke=Ne.children.filter(function(Ue){return Ue.title.indexOf(ke)>-1}))!==null&&Ke!==void 0&&Ke.length?Ne.id:null}return null});W(ke),$e(!0),console.log("expandedKeys:",Ge),Me(Ge)};return console.log("loop(treeData):",tt(it)),e.a.createElement("div",{className:D.a.tree},e.a.createElement(h,{style:{marginBottom:8},placeholder:"\u8F93\u5165\u5173\u952E\u5B57\u68C0\u7D22",onChange:ft}),e.a.createElement(m,{multiple:!0,defaultExpandAll:!0,onSelect:lt,onExpand:Ye,expandedKeys:Oe,selectedKeys:Fe,autoExpandParent:Qe,treeData:tt(it)}),e.a.createElement(me,null),e.a.createElement(q,null))},_=Object(a.a)(function(ne){var ue=ne.user,fe=ne.loading,Ee=ne.globalSetting,we=ne.restful;return{user:ue,globalSetting:Ee,restful:we,loading:fe.models.index}})(P),A=function(ue){var fe,Ee,we=ue.user,Ae=ue.globalSetting,De=ue.loading,se=ue.dispatch,pe=ue.restful,ge=Object(E.a)(ue,["user","globalSetting","loading","dispatch","restful"]),xe=Object(l.useState)({content:"",message:"",status:0,contacts:[],address:"",data:[]}),Te=Object(w.a)(xe,2),Se=Te[0],ye=Te[1],Le=Object(l.useState)(!0),Re=Object(w.a)(Le,2),z=Re[0],N=Re[1],B=T.a.useForm(),H=Object(w.a)(B,1),X=H[0],F=ge.match.params,W=function(){var de=Object(L.a)(v.a.mark(function le(){return v.a.wrap(function(Oe){for(;;)switch(Oe.prev=Oe.next){case 0:se({type:"restful/getRestful"}),F.id&&se({type:"restful/getRestfulDetail",payload:Object(R.a)({},F)});case 2:case"end":return Oe.stop()}},le)}));return function(){return de.apply(this,arguments)}}();Object(l.useEffect)(function(){N(!0),W()},[F.id]);var $=function(){se({type:"restful/setActionTabs",payload:{key:"\u65B0\u5EFA\u540C\u7EA7\u76EE\u5F55"}})},Q=function(){var le;if((le=pe.restful)!==null&&le!==void 0&&le.data){var Ce,Oe,Me=0;return(Ce=pe.restful)===null||Ce===void 0||((Oe=Ce.data)===null||Oe===void 0)||Oe.map(function(Pe){var je;Pe==null||((je=Pe.children)===null||je===void 0)||je.map(function(Fe){Fe.id==ge.match.params.id&&(Me=Pe.id)}),!Pe.children&&!Me&&(Me=Pe.id)}),Me}return 0};return e.a.createElement("section",null,e.a.createElement("aside",{className:"edu-container mt20"},e.a.createElement(M.a,null,e.a.createElement(M.a.Item,null,e.a.createElement(s.a,{to:"/"},"\u9996\u9875")),e.a.createElement(M.a.Item,null,e.a.createElement(s.a,{to:"/ch/rest"},"API\u6587\u6863"))),e.a.createElement("div",{className:"mt20"},e.a.createElement(j.a,{gutter:[20,20]},e.a.createElement(x.a,{flex:"300px"},e.a.createElement(_,ge)),e.a.createElement(x.a,{flex:"1"},e.a.createElement("div",{className:f.a.info},e.a.createElement("h1",{style:{fontSize:28,paddingBottom:15,borderBottom:"1px solid #eaeaea",textAlign:"center"}},(fe=pe.restfulDetail)===null||fe===void 0?void 0:fe.name),e.a.createElement(c.a,{value:(Ee=pe.restfulDetail)===null||Ee===void 0?void 0:Ee.description}))))),Object(d.o)()&&e.a.createElement("div",{className:f.a.bar},e.a.createElement(j.a,null,!!Q()&&e.a.createElement(x.a,null,e.a.createElement(U.a,{title:"\u7F16\u8F91\u6587\u4EF6"},e.a.createElement(s.a,{to:"/ch/rest/edit/".concat(Q(),"/").concat(ge.match.params.id),className:"icon-zhongmingming current"}))),e.a.createElement(x.a,null,e.a.createElement(U.a,{title:"\u6DFB\u52A0\u6587\u4EF6"},e.a.createElement(s.a,{to:"/ch/rest/edit/".concat(Q(),"/0"),className:"icon-tianjiatimu current"}))),e.a.createElement(x.a,null,e.a.createElement(U.a,{title:"\u65B0\u5EFA\u6587\u4EF6\u5939"},e.a.createElement("span",{className:"icon-wenjianjia1 current",onClick:$})))))))},Y=Ie.default=Object(a.a)(function(ne){var ue=ne.user,fe=ne.loading,Ee=ne.globalSetting,we=ne.restful;return{user:ue,globalSetting:Ee,restful:we,loading:fe.models.index}})(A)},NvD2:function(Ve,Ie,ie){"use strict";ie.d(Ie,"a",function(){return x});var ve=ie("Kwbf");function U(K,M){var R=new Set;return K.forEach(function(L){M.has(L)||R.add(L)}),R}function C(K){var M=K||{},R=M.disabled,L=M.disableCheckbox,y=M.checkable;return!!(R||L)||y===!1}function j(K,M,R,L){for(var y=new Set(K),T=new Set,w=0;w<=R;w+=1){var E=M.get(w)||new Set;E.forEach(function(e){var s=e.key,a=e.node,c=e.children,d=c===void 0?[]:c;y.has(s)&&!L(a)&&d.filter(function(o){return!L(o.node)}).forEach(function(o){y.add(o.key)})})}for(var b=new Set,v=R;v>=0;v-=1){var l=M.get(v)||new Set;l.forEach(function(e){var s=e.parent,a=e.node;if(L(a)||!e.parent||b.has(e.parent.key))return;if(L(e.parent.node)){b.add(s.key);return}var c=!0,d=!1;(s.children||[]).filter(function(o){return!L(o.node)}).forEach(function(o){var f=o.key,u=y.has(f);c&&!u&&(c=!1),!d&&(u||T.has(f))&&(d=!0)}),c&&y.add(s.key),d&&T.add(s.key),b.add(s.key)})}return{checkedKeys:Array.from(y),halfCheckedKeys:Array.from(U(T,y))}}function O(K,M,R,L,y){for(var T=new Set(K),w=new Set(M),E=0;E<=L;E+=1){var b=R.get(E)||new Set;b.forEach(function(s){var a=s.key,c=s.node,d=s.children,o=d===void 0?[]:d;!T.has(a)&&!w.has(a)&&!y(c)&&o.filter(function(f){return!y(f.node)}).forEach(function(f){T.delete(f.key)})})}w=new Set;for(var v=new Set,l=L;l>=0;l-=1){var e=R.get(l)||new Set;e.forEach(function(s){var a=s.parent,c=s.node;if(y(c)||!s.parent||v.has(s.parent.key))return;if(y(s.parent.node)){v.add(a.key);return}var d=!0,o=!1;(a.children||[]).filter(function(f){return!y(f.node)}).forEach(function(f){var u=f.key,i=T.has(u);d&&!i&&(d=!1),!o&&(i||w.has(u))&&(o=!0)}),d||T.delete(a.key),o&&w.add(a.key),v.add(a.key)})}return{checkedKeys:Array.from(T),halfCheckedKeys:Array.from(U(w,T))}}function x(K,M,R,L){var y=[],T;L?T=L:T=C;var w=new Set(K.filter(function(l){var e=!!R[l];return e||y.push(l),e})),E=new Map,b=0;Object.keys(R).forEach(function(l){var e=R[l],s=e.level,a=E.get(s);a||(a=new Set,E.set(s,a)),a.add(e),b=Math.max(b,s)}),Object(ve.a)(!y.length,"Tree missing follow keys: ".concat(y.slice(0,100).map(function(l){return"'".concat(l,"'")}).join(", ")));var v;return M===!0?v=j(w,E,b,T):v=O(w,M.halfCheckedKeys,E,b,T),v}},OZM5:function(Ve,Ie,ie){"use strict";ie.d(Ie,"b",function(){return L}),ie.d(Ie,"a",function(){return y}),ie.d(Ie,"k",function(){return T}),ie.d(Ie,"h",function(){return w}),ie.d(Ie,"i",function(){return E}),ie.d(Ie,"g",function(){return b}),ie.d(Ie,"c",function(){return v}),ie.d(Ie,"d",function(){return l}),ie.d(Ie,"j",function(){return a}),ie.d(Ie,"e",function(){return c}),ie.d(Ie,"f",function(){return d});var ve=ie("KQm4"),U=ie("U8pU"),C=ie("Ff2n"),j=ie("q1tI"),O=ie.n(j),x=ie("Kwbf"),K=ie("WaYH"),M=.25,R=2;function L(o,f){var u=o.slice(),i=u.indexOf(f);return i>=0&&u.splice(i,1),u}function y(o,f){var u=o.slice();return u.indexOf(f)===-1&&u.push(f),u}function T(o){return o.split("-")}function w(o,f){return"".concat(o,"-").concat(f)}function E(o){return o&&o.type&&o.type.isTreeNode}function b(o,f){var u=[o],i=f[o];function r(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];t.forEach(function(n){var g=n.key,p=n.children;u.push(g),r(p)})}return r(i.children),u}function v(o,f){var u=o.clientY,i=f.selectHandle.getBoundingClientRect(),r=i.top,t=i.bottom,n=i.height,g=Math.max(n*M,R);return u<=r+g?-1:u>=t-g?1:0}function l(o,f){if(!o)return;var u=f.multiple;return u?o.slice():o.length?[o[0]]:o}var e=function(f){return f};function s(o,f){if(!o)return[];var u=f||{},i=u.processProps,r=i===void 0?e:i,t=Array.isArray(o)?o:[o];return t.map(function(n){var g=n.children,p=Object(C.a)(n,["children"]),S=s(g,f);return O.a.createElement(K.a,Object.assign({},r(p)),S)})}function a(o){if(!o)return null;var f;if(Array.isArray(o))f={checkedKeys:o,halfCheckedKeys:void 0};else if(Object(U.a)(o)==="object")f={checkedKeys:o.checked||void 0,halfCheckedKeys:o.halfChecked||void 0};else return Object(x.a)(!1,"`checkedKeys` is not an array or an object"),null;return f}function c(o,f){var u=new Set;function i(r){if(u.has(r))return;var t=f[r];if(!t)return;u.add(r);var n=t.parent,g=t.node;if(g.disabled)return;n&&i(n.key)}return(o||[]).forEach(function(r){i(r)}),Object(ve.a)(u)}function d(o){var f={};return Object.keys(o).forEach(function(u){(u.startsWith("data-")||u.startsWith("aria-"))&&(f[u]=o[u])}),f}},P48q:function(Ve,Ie,ie){Ve.exports={flex_box_center:"flex_box_center___BHtvi",flex_space_between:"flex_space_between___1noDr",flex_box_vertical_center:"flex_box_vertical_center___2UDAc",flex_box_center_end:"flex_box_center_end___2j8--",flex_box_column:"flex_box_column___3X60k",tree:"tree___2kCYs",actions:"actions___10Q_6"}},SJMd:function(Ve,Ie){/**
* @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 ie,ve,U,C=!1,j,O;window.PR_SHOULD_USE_CONTINUATION=!0;var x,K;(function(){var M=window,R=["break,continue,do,else,for,if,return,while"],L=[R,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],y=[L,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],T=[y,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],w=[y,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],E=[y,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],b="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",v=[y,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],l="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",e=[R,"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"],s=[R,"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"],a=[R,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],c=[T,E,w,v,l,e,s,a],d=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,o="str",f="kwd",u="com",i="typ",r="lit",t="pun",n="pln",g="tag",p="dec",S="src",k="atn",I="atv",G="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function J(Y){for(var ne=0,ue=!1,fe=!1,Ee=0,we=Y.length;Ee<we;++Ee){var Ae=Y[Ee];if(Ae.ignoreCase)fe=!0;else if(/[a-z]/i.test(Ae.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){ue=!0,fe=!1;break}}var De={b:8,t:9,n:10,v:11,f:12,r:13};function se(Se){var ye=Se.charCodeAt(0);if(ye!==92)return ye;var Le=Se.charAt(1);return ye=De[Le],ye||("0"<=Le&&Le<="7"?parseInt(Se.substring(1),8):Le==="u"||Le==="x"?parseInt(Se.substring(2),16):Se.charCodeAt(1))}function pe(Se){if(Se<32)return(Se<16?"\\x0":"\\x")+Se.toString(16);var ye=String.fromCharCode(Se);return ye==="\\"||ye==="-"||ye==="]"||ye==="^"?"\\"+ye:ye}function ge(Se){var ye=Se.substring(1,Se.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),Le=[],Re=ye[0]==="^",z=["["];Re&&z.push("^");for(var N=Re?1:0,B=ye.length;N<B;++N){var H=ye[N];if(/\\[bdsw]/i.test(H))z.push(H);else{var X=se(H),F;N+2<B&&ye[N+1]==="-"?(F=se(ye[N+2]),N+=2):F=X,Le.push([X,F]),F<65||X>122||(F<65||X>90||Le.push([Math.max(65,X)|32,Math.min(F,90)|32]),F<97||X>122||Le.push([Math.max(97,X)&~32,Math.min(F,122)&~32]))}}Le.sort(function(de,le){return de[0]-le[0]||le[1]-de[1]});for(var W=[],$=[],N=0;N<Le.length;++N){var Q=Le[N];Q[0]<=$[1]+1?$[1]=Math.max($[1],Q[1]):W.push($=Q)}for(var N=0;N<W.length;++N){var Q=W[N];z.push(pe(Q[0])),Q[1]>Q[0]&&(Q[1]+1>Q[0]&&z.push("-"),z.push(pe(Q[1])))}return z.push("]"),z.join("")}function xe(Se){for(var ye=Se.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")),Le=ye.length,Re=[],z=0,N=0;z<Le;++z){var B=ye[z];if(B==="(")++N;else if(B.charAt(0)==="\\"){var H=+B.substring(1);H&&(H<=N?Re[H]=-1:ye[z]=pe(H))}}for(var z=1;z<Re.length;++z)Re[z]===-1&&(Re[z]=++ne);for(var z=0,N=0;z<Le;++z){var B=ye[z];if(B==="(")++N,Re[N]||(ye[z]="(?:");else if(B.charAt(0)==="\\"){var H=+B.substring(1);H&&H<=N&&(ye[z]="\\"+Re[H])}}for(var z=0;z<Le;++z)ye[z]==="^"&&ye[z+1]!=="^"&&(ye[z]="");if(Se.ignoreCase&&ue)for(var z=0;z<Le;++z){var B=ye[z],X=B.charAt(0);B.length>=2&&X==="["?ye[z]=ge(B):X!=="\\"&&(ye[z]=B.replace(/[a-zA-Z]/g,function($){var Q=$.charCodeAt(0);return"["+String.fromCharCode(Q&~32,Q|32)+"]"}))}return ye.join("")}for(var Te=[],Ee=0,we=Y.length;Ee<we;++Ee){var Ae=Y[Ee];if(Ae.global||Ae.multiline)throw new Error(""+Ae);Te.push("(?:"+xe(Ae)+")")}return new RegExp(Te.join("|"),fe?"gi":"g")}function re(Y,ne){var ue=/(?:^|\s)nocode(?:\s|$)/,fe=[],Ee=0,we=[],Ae=0;function De(se){var pe=se.nodeType;if(pe==1){if(ue.test(se.className))return;for(var ge=se.firstChild;ge;ge=ge.nextSibling)De(ge);var xe=se.nodeName.toLowerCase();(xe==="br"||xe==="li")&&(fe[Ae]=`
`,we[Ae<<1]=Ee++,we[Ae++<<1|1]=se)}else if(pe==3||pe==4){var Te=se.nodeValue;Te.length&&(ne?Te=Te.replace(/\r\n?/g,`
`):Te=Te.replace(/[ \t\r\n]+/g," "),fe[Ae]=Te,we[Ae<<1]=Ee,Ee+=Te.length,we[Ae++<<1|1]=se)}}return De(Y),{sourceCode:fe.join("").replace(/\n$/,""),spans:we}}function ee(Y,ne,ue,fe,Ee){if(!ue)return;var we={sourceNode:Y,pre:1,langExtension:null,numberLines:null,sourceCode:ue,spans:null,basePos:ne,decorations:null};fe(we),Ee.push.apply(Ee,we.decorations)}var ae=/\S/;function be(Y){for(var ne=void 0,ue=Y.firstChild;ue;ue=ue.nextSibling){var fe=ue.nodeType;ne=fe===1?ne?Y:ue:fe===3&&ae.test(ue.nodeValue)?Y:ne}return ne===Y?void 0:ne}function he(Y,ne){var ue={},fe;(function(){for(var Ae=Y.concat(ne),De=[],se={},pe=0,ge=Ae.length;pe<ge;++pe){var xe=Ae[pe],Te=xe[3];if(Te)for(var Se=Te.length;--Se>=0;)ue[Te.charAt(Se)]=xe;var ye=xe[1],Le=""+ye;se.hasOwnProperty(Le)||(De.push(ye),se[Le]=null)}De.push(/[\0-\uffff]/),fe=J(De)})();var Ee=ne.length,we=function(Ae){for(var De=Ae.sourceCode,se=Ae.basePos,pe=Ae.sourceNode,ge=[se,n],xe=0,Te=De.match(fe)||[],Se={},ye=0,Le=Te.length;ye<Le;++ye){var Re=Te[ye],z=Se[Re],N=void 0,B;if(typeof z=="string")B=!1;else{var H=ue[Re.charAt(0)];if(H)N=Re.match(H[1]),z=H[0];else{for(var X=0;X<Ee;++X)if(H=ne[X],N=Re.match(H[1]),N){z=H[0];break}N||(z=n)}B=z.length>=5&&z.substring(0,5)==="lang-",B&&!(N&&typeof N[1]=="string")&&(B=!1,z=S),B||(Se[Re]=z)}var F=xe;if(xe+=Re.length,!B)ge.push(se+F,z);else{var W=N[1],$=Re.indexOf(W),Q=$+W.length;N[2]&&(Q=Re.length-N[2].length,$=Q-W.length);var de=z.substring(5);ee(pe,se+F,Re.substring(0,$),we,ge),ee(pe,se+F+$,W,D(de,W),ge),ee(pe,se+F+Q,Re.substring(Q),we,ge)}}Ae.decorations=ge};return we}function me(Y){var ne=[],ue=[];Y.tripleQuotedStrings?ne.push([o,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Y.multiLineStrings?ne.push([o,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):ne.push([o,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Y.verbatimStrings&&ue.push([o,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var fe=Y.hashComments;fe&&(Y.cStyleComments?(fe>1?ne.push([u,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):ne.push([u,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),ue.push([o,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):ne.push([u,/^#[^\r\n]*/,null,"#"])),Y.cStyleComments&&(ue.push([u,/^\/\/[^\r\n]*/,null]),ue.push([u,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ee=Y.regexLiterals;if(Ee){var we=Ee>1?"":`
\r`,Ae=we?".":"[\\S\\s]",De="/(?=[^/*"+we+"])(?:[^/\\x5B\\x5C"+we+"]|\\x5C"+Ae+"|\\x5B(?:[^\\x5C\\x5D"+we+"]|\\x5C"+Ae+")*(?:\\x5D|$))+/";ue.push(["lang-regex",RegExp("^"+V+"("+De+")")])}var se=Y.types;se&&ue.push([i,se]);var pe=(""+Y.keywords).replace(/^ | $/g,"");pe.length&&ue.push([f,new RegExp("^(?:"+pe.replace(/[\s,]+/g,"|")+")\\b"),null]),ne.push([n,/^\s+/,null,` \r
\xA0`]);var ge="^.[^\\s\\w.$@'\"`/\\\\]*";return Y.regexLiterals&&(ge+="(?!s*/)"),ue.push([r,/^@[a-z_$][a-z_$@0-9]*/i,null],[i,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[n,/^[a-z_$][a-z_$@0-9]*/i,null],[r,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[n,/^\\[\s\S]?/,null],[t,new RegExp(ge),null]),he(ne,ue)}var ce=me({keywords:c,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function te(Y,ne,ue){for(var fe=/(?:^|\s)nocode(?:\s|$)/,Ee=/\r\n?|\n/,we=Y.ownerDocument,Ae=we.createElement("li");Y.firstChild;)Ae.appendChild(Y.firstChild);var De=[Ae];function se(ye){var Le=ye.nodeType;if(Le==1&&!fe.test(ye.className))if(ye.nodeName==="br")pe(ye),ye.parentNode&&ye.parentNode.removeChild(ye);else for(var Re=ye.firstChild;Re;Re=Re.nextSibling)se(Re);else if((Le==3||Le==4)&&ue){var z=ye.nodeValue,N=z.match(Ee);if(N){var B=z.substring(0,N.index);ye.nodeValue=B;var H=z.substring(N.index+N[0].length);if(H){var X=ye.parentNode;X.insertBefore(we.createTextNode(H),ye.nextSibling)}pe(ye),B||ye.parentNode.removeChild(ye)}}}function pe(ye){for(;!ye.nextSibling;)if(ye=ye.parentNode,!ye)return;function Le(N,B){var H=B?N.cloneNode(!1):N,X=N.parentNode;if(X){var F=Le(X,1),W=N.nextSibling;F.appendChild(H);for(var $=W;$;$=W)W=$.nextSibling,F.appendChild($)}return H}for(var Re=Le(ye.nextSibling,0),z;(z=Re.parentNode)&&z.nodeType===1;)Re=z;De.push(Re)}for(var ge=0;ge<De.length;++ge)se(De[ge]);ne===(ne|0)&&De[0].setAttribute("value",ne);var xe=we.createElement("ol");xe.className="linenums";for(var Te=Math.max(0,ne-1|0)||0,ge=0,Se=De.length;ge<Se;++ge)Ae=De[ge],Ae.className="L"+(ge+Te)%10,Ae.firstChild||Ae.appendChild(we.createTextNode("\xA0")),xe.appendChild(Ae);Y.appendChild(xe)}function q(Y){var ne=/\bMSIE\s(\d+)/.exec(navigator.userAgent);ne=ne&&+ne[1]<=8;var ue=/\n/g,fe=Y.sourceCode,Ee=fe.length,we=0,Ae=Y.spans,De=Ae.length,se=0,pe=Y.decorations,ge=pe.length,xe=0;pe[ge]=Ee;var Te,Se;for(Se=Te=0;Se<ge;)pe[Se]!==pe[Se+2]?(pe[Te++]=pe[Se++],pe[Te++]=pe[Se++]):Se+=2;for(ge=Te,Se=Te=0;Se<ge;){for(var ye=pe[Se],Le=pe[Se+1],Re=Se+2;Re+2<=ge&&pe[Re+1]===Le;)Re+=2;pe[Te++]=ye,pe[Te++]=Le,Se=Re}ge=pe.length=Te;var z=Y.sourceNode,N="";z&&(N=z.style.display,z.style.display="none");try{for(var B=null;se<De;){var H=Ae[se],X=Ae[se+2]||Ee,F=pe[xe+2]||Ee,Re=Math.min(X,F),W=Ae[se+1],$;if(W.nodeType!==1&&($=fe.substring(we,Re))){ne&&($=$.replace(ue,"\r")),W.nodeValue=$;var Q=W.ownerDocument,de=Q.createElement("span");de.className=pe[xe+1];var le=W.parentNode;le.replaceChild(de,W),de.appendChild(W),we<X&&(Ae[se+1]=W=Q.createTextNode(fe.substring(Re,X)),le.insertBefore(W,de.nextSibling))}we=Re,we>=X&&(se+=2),we>=F&&(xe+=2)}}finally{z&&(z.style.display=N)}}var oe={};function Z(Y,ne){for(var ue=ne.length;--ue>=0;){var fe=ne[ue];oe.hasOwnProperty(fe)?M.console&&console.warn("cannot override language handler %s",fe):oe[fe]=Y}}function D(Y,ne){return Y&&oe.hasOwnProperty(Y)||(Y=/^\s*</.test(ne)?"default-markup":"default-code"),oe[Y]}Z(ce,["default-code"]),Z(he([],[[n,/^[^<?]+/],[p,/^<!\w[^>]*(?:>|$)/],[u,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[t,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),Z(he([[n,/^[\s]+/,null,` \r
`],[I,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[g,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[k,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[t,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),Z(he([],[[I,/^[\s\S]+/]]),["uq.val"]),Z(me({keywords:T,hashComments:!0,cStyleComments:!0,types:d}),["c","cc","cpp","cxx","cyc","m"]),Z(me({keywords:"null,true,false"}),["json"]),Z(me({keywords:E,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:d}),["cs"]),Z(me({keywords:w,cStyleComments:!0}),["java"]),Z(me({keywords:a,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),Z(me({keywords:e,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),Z(me({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),Z(me({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),Z(me({keywords:v,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),Z(me({keywords:b,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),Z(he([],[[o,/^[\s\S]+/]]),["regex"]);function h(Y){var ne=Y.langExtension;try{var ue=re(Y.sourceNode,Y.pre),fe=ue.sourceCode;Y.sourceCode=fe,Y.spans=ue.spans,Y.basePos=0,D(ne,fe)(Y),q(Y)}catch(Ee){M.console&&console.log(Ee&&Ee.stack||Ee)}}function m(Y,ne,ue){var fe=ue||!1,Ee=ne||null,we=document.createElement("div");we.innerHTML="<pre>"+Y+"</pre>",we=we.firstChild,fe&&te(we,fe,!0);var Ae={langExtension:Ee,numberLines:fe,sourceNode:we,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return h(Ae),we.innerHTML}function P(Y,ne){var ue=ne||document.body,fe=ue.ownerDocument||document;function Ee(H){return ue.getElementsByTagName(H)}for(var we=[Ee("pre"),Ee("code"),Ee("xmp")],Ae=[],De=0;De<we.length;++De)for(var se=0,pe=we[De].length;se<pe;++se)Ae.push(we[De][se]);we=null;var ge=Date;ge.now||(ge={now:function(){return+new Date}});var xe=0,Te=/\blang(?:uage)?-([\w.]+)(?!\S)/,Se=/\bprettyprint\b/,ye=/\bprettyprinted\b/,Le=/pre|xmp/i,Re=/^code$/i,z=/^(?:pre|code|xmp)$/i,N={};function B(){for(var H=M.PR_SHOULD_USE_CONTINUATION?ge.now()+250:Infinity;xe<Ae.length&&ge.now()<H;xe++){for(var X=Ae[xe],F=N,W=X;W=W.previousSibling;){var $=W.nodeType,Q=($===7||$===8)&&W.nodeValue;if(Q?!/^\??prettify\b/.test(Q):$!==3||/\S/.test(W.nodeValue))break;if(Q){F={},Q.replace(/\b(\w+)=([\w:.%+-]+)/g,function($e,He,rt){F[He]=rt});break}}var de=X.className;if((F!==N||Se.test(de))&&!ye.test(de)){for(var le=!1,Ce=X.parentNode;Ce;Ce=Ce.parentNode){var Oe=Ce.tagName;if(z.test(Oe)&&Ce.className&&Se.test(Ce.className)){le=!0;break}}if(!le){X.className+=" prettyprinted";var Me=F.lang;if(!Me){Me=de.match(Te);var Pe;!Me&&(Pe=be(X))&&Re.test(Pe.tagName)&&(Me=Pe.className.match(Te)),Me&&(Me=Me[1])}var je;if(Le.test(X.tagName))je=1;else{var Fe=X.currentStyle,_e=fe.defaultView,qe=Fe?Fe.whiteSpace:_e&&_e.getComputedStyle?_e.getComputedStyle(X,null).getPropertyValue("white-space"):0;je=qe&&qe.substring(0,3)==="pre"}var ze=F.linenums;(ze=ze==="true"||+ze)||(ze=de.match(/\blinenums\b(?::(\d+))?/),ze=ze?ze[1]&&ze[1].length?+ze[1]:!0:!1),ze&&te(X,ze,je);var Qe={langExtension:Me,sourceNode:X,numberLines:ze,pre:je,sourceCode:null,basePos:null,spans:null,decorations:null};h(Qe)}}}xe<Ae.length?M.setTimeout(B,250):typeof Y=="function"&&Y()}B()}var _=M.PR={createSimpleLexer:he,registerLangHandler:Z,sourceDecorator:me,PR_ATTRIB_NAME:k,PR_ATTRIB_VALUE:I,PR_COMMENT:u,PR_DECLARATION:p,PR_KEYWORD:f,PR_LITERAL:r,PR_NOCODE:G,PR_PLAIN:n,PR_PUNCTUATION:t,PR_SOURCE:S,PR_STRING:o,PR_TAG:g,PR_TYPE:i,prettyPrintOne:C?M.prettyPrintOne=m:x=m,prettyPrint:K=C?M.prettyPrint=P:K=P},A=M.define;typeof A=="function"&&A.amd&&A("google-code-prettify",[],function(){return _})})()},STEk:function(Ve,Ie,ie){"use strict";ie.d(Ie,"a",function(){return Z});/*! *****************************************************************************
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 ve=function(D,h){return(ve=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,P){m.__proto__=P}||function(m,P){for(var _ in P)Object.prototype.hasOwnProperty.call(P,_)&&(m[_]=P[_])})(D,h)};function U(D,h){function m(){this.constructor=D}ve(D,h),D.prototype=h===null?Object.create(h):(m.prototype=h.prototype,new m)}function C(D,h,m,P){return new(m||(m=Promise))(function(_,A){function Y(fe){try{ue(P.next(fe))}catch(Ee){A(Ee)}}function ne(fe){try{ue(P.throw(fe))}catch(Ee){A(Ee)}}function ue(fe){var Ee;fe.done?_(fe.value):(Ee=fe.value,Ee instanceof m?Ee:new m(function(we){we(Ee)})).then(Y,ne)}ue((P=P.apply(D,h||[])).next())})}function j(D,h){var m,P,_,A,Y={label:0,sent:function(){if(1&_[0])throw _[1];return _[1]},trys:[],ops:[]};return A={next:ne(0),throw:ne(1),return:ne(2)},typeof Symbol=="function"&&(A[Symbol.iterator]=function(){return this}),A;function ne(ue){return function(fe){return function(Ee){if(m)throw new TypeError("Generator is already executing.");for(;Y;)try{if(m=1,P&&(_=2&Ee[0]?P.return:Ee[0]?P.throw||((_=P.return)&&_.call(P),0):P.next)&&!(_=_.call(P,Ee[1])).done)return _;switch(P=0,_&&(Ee=[2&Ee[0],_.value]),Ee[0]){case 0:case 1:_=Ee;break;case 4:return Y.label++,{value:Ee[1],done:!1};case 5:Y.label++,P=Ee[1],Ee=[0];continue;case 7:Ee=Y.ops.pop(),Y.trys.pop();continue;default:if(!(_=Y.trys,(_=_.length>0&&_[_.length-1])||Ee[0]!==6&&Ee[0]!==2)){Y=0;continue}if(Ee[0]===3&&(!_||Ee[1]>_[0]&&Ee[1]<_[3])){Y.label=Ee[1];break}if(Ee[0]===6&&Y.label<_[1]){Y.label=_[1],_=Ee;break}if(_&&Y.label<_[2]){Y.label=_[2],Y.ops.push(Ee);break}_[2]&&Y.ops.pop(),Y.trys.pop();continue}Ee=h.call(D,Y)}catch(we){Ee=[6,we],P=0}finally{m=_=0}if(5&Ee[0])throw Ee[1];return{value:Ee[0]?Ee[1]:void 0,done:!0}}([ue,fe])}}}function O(){for(var D=0,h=0,m=arguments.length;h<m;h++)D+=arguments[h].length;var P=Array(D),_=0;for(h=0;h<m;h++)for(var A=arguments[h],Y=0,ne=A.length;Y<ne;Y++,_++)P[_]=A[Y];return P}var x=function(){function D(){}return D.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},D.setAttributes=function(h,m){for(var P=0,_=m;P<_.length;P++){var A=_[P],Y=A[0],ne=A[1];h.setAttribute(Y,ne)}},D.createRect=function(h,m,P){var _=document.createElementNS("http://www.w3.org/2000/svg","rect");return _.setAttribute("width",h.toString()),_.setAttribute("height",m.toString()),P&&D.setAttributes(_,P),_},D.createLine=function(h,m,P,_,A){var Y=document.createElementNS("http://www.w3.org/2000/svg","line");return Y.setAttribute("x1",h.toString()),Y.setAttribute("y1",m.toString()),Y.setAttribute("x2",P.toString()),Y.setAttribute("y2",_.toString()),A&&D.setAttributes(Y,A),Y},D.createPolygon=function(h,m){var P=document.createElementNS("http://www.w3.org/2000/svg","polygon");return P.setAttribute("points",h),m&&D.setAttributes(P,m),P},D.createCircle=function(h,m){var P=document.createElementNS("http://www.w3.org/2000/svg","circle");return P.setAttribute("cx",(h/2).toString()),P.setAttribute("cy",(h/2).toString()),P.setAttribute("r",h.toString()),m&&D.setAttributes(P,m),P},D.createEllipse=function(h,m,P){var _=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return _.setAttribute("cx",(h/2).toString()),_.setAttribute("cy",(m/2).toString()),_.setAttribute("rx",(h/2).toString()),_.setAttribute("ry",(m/2).toString()),P&&D.setAttributes(_,P),_},D.createGroup=function(h){var m=document.createElementNS("http://www.w3.org/2000/svg","g");return h&&D.setAttributes(m,h),m},D.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},D.createMarker=function(h,m,P,_,A,Y,ne){var ue=document.createElementNS("http://www.w3.org/2000/svg","marker");return D.setAttributes(ue,[["id",h],["orient",m],["markerWidth",P.toString()],["markerHeight",_.toString()],["refX",A.toString()],["refY",Y.toString()]]),ue.appendChild(ne),ue},D.createText=function(h){var m=document.createElementNS("http://www.w3.org/2000/svg","text");return m.setAttribute("x","0"),m.setAttribute("y","0"),h&&D.setAttributes(m,h),m},D.createTSpan=function(h,m){var P=document.createElementNS("http://www.w3.org/2000/svg","tspan");return P.textContent=h,m&&D.setAttributes(P,m),P},D.createImage=function(h){var m=document.createElementNS("http://www.w3.org/2000/svg","image");return h&&D.setAttributes(m,h),m},D.createPoint=function(h,m){var P=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return P.x=h,P.y=m,P},D.createPath=function(h,m){var P=document.createElementNS("http://www.w3.org/2000/svg","path");return P.setAttribute("d",h),m&&D.setAttributes(P,m),P},D}(),K=function(){function D(){}return D.addKey=function(h){D.key=h},Object.defineProperty(D,"isLicensed",{get:function(){return!!D.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(D.key)},enumerable:!1,configurable:!0}),D}(),M=function(){function D(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return D.prototype.rasterize=function(h,m,P){var _=this;return new Promise(function(A){var Y=P!==void 0?P:document.createElement("canvas");h===null&&(_.markersOnly=!0,_.naturalSize=!1);var ne=document.createElementNS("http://www.w3.org/2000/svg","svg");ne.setAttribute("xmlns","http://www.w3.org/2000/svg"),ne.setAttribute("width",m.width.baseVal.valueAsString),ne.setAttribute("height",m.height.baseVal.valueAsString),ne.setAttribute("viewBox","0 0 "+m.viewBox.baseVal.width.toString()+" "+m.viewBox.baseVal.height.toString()),ne.innerHTML=m.innerHTML,_.naturalSize===!0?(ne.width.baseVal.value=h.naturalWidth,ne.height.baseVal.value=h.naturalHeight):_.width!==void 0&&_.height!==void 0&&(ne.width.baseVal.value=_.width,ne.height.baseVal.value=_.height),Y.width=ne.width.baseVal.value,Y.height=ne.height.baseVal.value;var ue=ne.outerHTML,fe=Y.getContext("2d");_.markersOnly!==!0&&fe.drawImage(h,0,0,Y.width,Y.height);var Ee=window.URL,we=new Image(Y.width,Y.height);we.setAttribute("crossOrigin","anonymous");var Ae=new Blob([ue],{type:"image/svg+xml"}),De=Ee.createObjectURL(Ae);we.onload=function(){fe.drawImage(we,0,0),Ee.revokeObjectURL(De);var se=Y.toDataURL(_.imageType,_.imageQuality);A(se)},we.src=De})},D}(),R=function(){},L=function(){function D(h){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+h+"_"}return Object.defineProperty(D.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),D.prototype.addClass=function(h){return this.styleSheet===void 0&&this.addStyleSheet(),h.name=""+this.classNamePrefix+h.localName,this.classes.push(h),this.styleSheet.sheet.insertRule("."+h.name+" {"+h.style+"}",this.styleSheet.sheet.cssRules.length),h},D.prototype.addRule=function(h){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(h),this.styleSheet.sheet.insertRule(h.selector+" {"+h.style+"}",this.styleSheet.sheet.cssRules.length)},D.prototype.addStyleSheet=function(){var h;this.styleSheet=document.createElement("style"),((h=this.styleSheetRoot)!==null&&h!==void 0?h:document.head).appendChild(this.styleSheet),this.addRule(new y("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new y("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new y("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new T("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new T("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},D.prototype.removeStyleSheet=function(){var h;this.styleSheet&&(((h=this.styleSheetRoot)!==null&&h!==void 0?h:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},D}(),y=function(D,h){this.selector=D,this.style=h},T=function(D,h){this.localName=D,this.style=h},w=function(){function D(h,m,P,_,A){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=h,this.displayMode=m,this.markerItems=P,this.uiStyleSettings=_,this.styles=A,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return D.prototype.show=function(h){var m=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=h,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var P=document.createElement("div");P.className=this.toolbarBlockStyleClass.name,P.style.whiteSpace="nowrap",this.uiContainer.appendChild(P),this.addActionButton(P,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(P,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(P,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(P,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(P,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(P,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(P,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(P,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(A){var Y=document.createElement("div");Y.className=""+m.toolbarButtonStyleClass.name,Y.setAttribute("data-type-name",A.typeName),Y.innerHTML=A.icon,Y.addEventListener("click",function(){m.markerToolbarButtonClicked(Y,A)}),m.buttons.push(Y),m.markerButtons.push(Y)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var _=document.createElement("div");_.className=this.toolbarBlockStyleClass.name,_.style.whiteSpace="nowrap",_.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(_),this.addActionButton(_,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(_,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},D.prototype.addButtonClickListener=function(h){this.buttonClickListeners.push(h)},D.prototype.removeButtonClickListener=function(h){this.buttonClickListeners.indexOf(h)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(h),1)},D.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},D.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var h=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var m=0;m<this.markerButtons.length;m++)m<h||m===h&&this.markerButtons.length-1===h?this.markerButtonBlock.appendChild(this.markerButtons[m]):(m===h&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[m]))}},D.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},D.prototype.resetButtonStyles=function(){var h=this;this.buttons.forEach(function(m){m.className=m.className.replace(h.uiStyleSettings.toolbarButtonStyleColorsClassName?h.uiStyleSettings.toolbarButtonStyleColorsClassName:h.toolbarButtonStyleColorsClass.name,"").trim(),m.className=m.className.replace(h.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?h.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:h.toolbarActiveButtonStyleColorsClass.name,"").trim(),m.className+=" "+(h.uiStyleSettings.toolbarButtonStyleColorsClassName?h.uiStyleSettings.toolbarButtonStyleColorsClassName:h.toolbarButtonStyleColorsClass.name)})},D.prototype.addActionButton=function(h,m,P){var _=this,A=document.createElement("div");switch(A.className=""+this.toolbarButtonStyleClass.name,A.innerHTML=m,A.setAttribute("data-action",P),A.addEventListener("click",function(){_.actionToolbarButtonClicked(A,P)}),P){case"select":A.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":A.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":A.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":A.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":A.style.fill=this.uiStyleSettings.closeButtonColor}h.appendChild(A),this.buttons.push(A)},D.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new T("toolbar",`
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
height: `+this.uiStyleSettings.toolbarHeight+`px;
box-sizing: content-box;
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
overflow: hidden;
`)),this.toolbarStyleColorsClass=this.styles.addClass(new T("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new T("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new T("toolbar-overflow-block",`
position: absolute;
top: `+this.uiStyleSettings.toolbarHeight+`px;
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
z-index: 10;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new T("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var h=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new T("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*h)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*h)+`px;
padding: `+h+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new T("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new T("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new y("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new y("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},D.prototype.markerToolbarButtonClicked=function(h,m){this.setActiveButton(h),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(P){return P("marker",m)}),this.markerButtonOverflowBlock.style.display="none"},D.prototype.actionToolbarButtonClicked=function(h,m){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(P){return P("action",m)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},D.prototype.setActiveButton=function(h){this.resetButtonStyles(),h.className=h.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),h.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},D.prototype.setActiveMarkerButton=function(h){var m=this.markerButtons.find(function(P){return P.getAttribute("data-type-name")===h});m&&this.setActiveButton(m)},D.prototype.setCurrentMarker=function(h){var m=this;this.currentMarker=h,this.buttons.filter(function(P){return/delete|notes/.test(P.getAttribute("data-action"))}).forEach(function(P){m.currentMarker===void 0?(P.style.fillOpacity="0.4",P.style.pointerEvents="none"):(P.style.fillOpacity="1",P.style.pointerEvents="all")})},D}(),E=function(){function D(h,m,P,_){this.panels=[],this.panelButtons=[],this.markerjsContainer=h,this.displayMode=m,this.uiStyleSettings=P,this.styles=_,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return D.prototype.addStyles=function(){var h;this.toolboxStyleClass=this.styles.addClass(new T("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 T("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var m=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new T("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new T("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new T("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 T("toolbox-panel-row_colors",`
background-color: `+((h=this.uiStyleSettings.toolboxBackgroundColor)!==null&&h!==void 0?h:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new T("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*m)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*m)+`px;
padding: `+m+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new T("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new T("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new y("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new y("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},D.prototype.show=function(h){var m;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=h,this.uiContainer.className=this.toolboxStyleClass.name+" "+((m=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&m!==void 0?m:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},D.prototype.setPanelButtons=function(h){var m,P,_=this;this.panels=h,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((m=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&m!==void 0?m: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(A){var Y;A.uiStyleSettings=_.uiStyleSettings;var ne=document.createElement("div");ne.className=_.toolboxButtonStyleClass.name+" "+((Y=_.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Y!==void 0?Y:_.toolboxButtonStyleColorsClass.name),ne.innerHTML=A.icon,ne.title=A.title,ne.addEventListener("click",function(){_.panelButtonClick(A)}),_.panelButtons.push(ne),_.buttonRow.appendChild(ne)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},D.prototype.panelButtonClick=function(h){var m=this,P=-1;if(h!==this.activePanel){P=this.panels.indexOf(h),this.panelRow.innerHTML="";var _=h.getUi();_.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(_),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=h}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){m.displayMode==="inline"?m.panelRow.style.display="none":m.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(A,Y){var ne,ue;A.className=m.toolboxButtonStyleClass.name+" "+(Y===P?""+((ne=m.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&ne!==void 0?ne:m.toolboxActiveButtonStyleColorsClass.name):""+((ue=m.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ue!==void 0?ue:m.toolboxButtonStyleColorsClass.name))})},D}(),b=function(D,h){this.title=D,this.icon=h},v=function(D){function h(m,P,_,A){var Y=D.call(this,m,A||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return Y.colors=[],Y.addTransparent=!1,Y.colorBoxes=[],Y.colors=P,Y.currentColor=_,Y.setCurrentColor=Y.setCurrentColor.bind(Y),Y.getColorBox=Y.getColorBox.bind(Y),Y}return U(h,D),h.prototype.getUi=function(){var m=this,P=document.createElement("div");return P.style.overflow="hidden",P.style.whiteSpace="nowrap",this.colors.forEach(function(_){var A=m.getColorBox(_);P.appendChild(A),m.colorBoxes.push(A)}),P},h.prototype.getColorBox=function(m){var P=this,_=this.uiStyleSettings.toolbarHeight/4,A=this.uiStyleSettings.toolbarHeight-_,Y=document.createElement("div");Y.style.display="inline-block",Y.style.boxSizing="content-box",Y.style.width=A-2+"px",Y.style.height=A-2+"px",Y.style.padding="1px",Y.style.marginRight="2px",Y.style.marginBottom="2px",Y.style.borderWidth="2px",Y.style.borderStyle="solid",Y.style.borderRadius=(A+2)/2+"px",Y.style.borderColor=m===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",Y.addEventListener("click",function(){P.setCurrentColor(m,Y)});var ne=document.createElement("div");return ne.style.display="inline-block",ne.style.width=A-2+"px",ne.style.height=A-2+"px",ne.style.backgroundColor=m,ne.style.borderRadius=A/2+"px",m==="transparent"&&(ne.style.fill=this.uiStyleSettings.toolboxAccentColor,ne.innerHTML=`<svg viewBox="0 0 24 24">
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
</svg>`),Y.appendChild(ne),Y},h.prototype.setCurrentColor=function(m,P){var _=this;this.currentColor=m,this.colorBoxes.forEach(function(A){A.style.borderColor=A===P?_.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(m)},h}(b),l=function(){function D(h,m,P){this._state="new",this._isSelected=!1,this._container=h,this._overlayContainer=m,this.globalSettings=P,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(D.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),D.prototype.ownsTarget=function(h){return!1},Object.defineProperty(D.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),D.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},D.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},D.prototype.pointerDown=function(h,m){},D.prototype.dblClick=function(h,m){},D.prototype.manipulate=function(h){},D.prototype.pointerUp=function(h){this.stateChanged()},D.prototype.dispose=function(){},D.prototype.addMarkerVisualToContainer=function(h){this.container.childNodes.length>0?this.container.insertBefore(h,this.container.childNodes[0]):this.container.appendChild(h)},D.prototype.getState=function(){return{typeName:D.typeName,state:this.state,notes:this.notes}},D.prototype.restoreState=function(h){this._state=h.state,this.notes=h.notes},D.prototype.scale=function(h,m){},D.prototype.colorChanged=function(h){this.onColorChanged&&this.onColorChanged(h),this.stateChanged()},D.prototype.fillColorChanged=function(h){this.onFillColorChanged&&this.onFillColorChanged(h),this.stateChanged()},D.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var h=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),h.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(h)&&this.onStateChanged(this)}},D.typeName="MarkerBase",D}(),e=function(){function D(){this.findGripByVisual=this.findGripByVisual.bind(this)}return D.prototype.findGripByVisual=function(h){return this.topLeft.ownsTarget(h)?this.topLeft:this.topCenter.ownsTarget(h)?this.topCenter:this.topRight.ownsTarget(h)?this.topRight:this.centerLeft.ownsTarget(h)?this.centerLeft:this.centerRight.ownsTarget(h)?this.centerRight:this.bottomLeft.ownsTarget(h)?this.bottomLeft:this.bottomCenter.ownsTarget(h)?this.bottomCenter:this.bottomRight.ownsTarget(h)?this.bottomRight:void 0},D}(),s=function(){function D(){this.GRIP_SIZE=10,this.visual=x.createGroup(),this.visual.appendChild(x.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(x.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return D.prototype.ownsTarget=function(h){return h===this.visual||h===this.visual.childNodes[0]||h===this.visual.childNodes[1]},D}(),a=function(){function D(){}return D.toITransformMatrix=function(h){return{a:h.a,b:h.b,c:h.c,d:h.d,e:h.e,f:h.f}},D.toSVGMatrix=function(h,m){return h.a=m.a,h.b=m.b,h.c=m.c,h.d=m.d,h.e=m.e,h.f=m.f,h},D}(),c=function(D){function h(m,P,_){var A=D.call(this,m,P,_)||this;return A.left=0,A.top=0,A.width=0,A.height=0,A.defaultSize={x:50,y:20},A.offsetX=0,A.offsetY=0,A.rotationAngle=0,A.CB_DISTANCE=10,A._suppressMarkerCreateEvent=!1,A.container.transform.baseVal.appendItem(x.createTransform()),A.setupControlBox(),A}return U(h,D),Object.defineProperty(h.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"visual",{get:function(){return this._visual},set:function(m){this._visual=m;var P=x.createTransform();this._visual.transform.baseVal.appendItem(P)},enumerable:!1,configurable:!0}),h.prototype.ownsTarget=function(m){return!!D.prototype.ownsTarget.call(this,m)||!!(this.controlGrips.findGripByVisual(m)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(m))},h.prototype.pointerDown=function(m,P){D.prototype.pointerDown.call(this,m,P),this.state==="new"&&(this.left=m.x,this.top=m.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var _=this.unrotatePoint(m);if(this.manipulationStartX=_.x,this.manipulationStartY=_.y,this.offsetX=_.x-this.left,this.offsetY=_.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 A=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=A.x-this.width/2,this.top=A.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var Y=this.container.transform.baseVal.getItem(0);Y.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(Y,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},h.prototype.pointerUp=function(m){var P=this.state;D.prototype.pointerUp.call(this,m),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(m),this._state="select",P==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},h.prototype.moveVisual=function(m){this.visual.style.transform="translate("+m.x+"px, "+m.y+"px)"},h.prototype.manipulate=function(m){var P=this.unrotatePoint(m);this.state==="creating"?this.resize(m):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(m)},h.prototype.resize=function(m){var P=this.manipulationStartLeft,_=this.manipulationStartWidth,A=this.manipulationStartTop,Y=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:P=this.manipulationStartLeft+m.x-this.manipulationStartX,_=this.manipulationStartWidth+this.manipulationStartLeft-P;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:_=this.manipulationStartWidth+m.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:A=this.manipulationStartTop+m.y-this.manipulationStartY,Y=this.manipulationStartHeight+this.manipulationStartTop-A;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:Y=this.manipulationStartHeight+m.y-this.manipulationStartY}_>=0?(this.left=P,this.width=_):(this.left=P+_,this.width=-_),Y>=0?(this.top=A,this.height=Y):(this.top=A+Y,this.height=-Y),this.setSize()},h.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},h.prototype.rotate=function(m){if(Math.abs(m.x-this.centerX)>.1){var P=Math.sign(m.x-this.centerX);this.rotationAngle=180*Math.atan((m.y-this.centerY)/(m.x-this.centerX))/Math.PI+90*P,this.applyRotation()}},h.prototype.applyRotation=function(){var m=this.container.transform.baseVal.getItem(0);m.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(m,0)},h.prototype.rotatePoint=function(m){if(this.rotationAngle===0)return m;var P=this.container.getCTM(),_=x.createPoint(m.x,m.y);return{x:(_=_.matrixTransform(P)).x,y:_.y}},h.prototype.unrotatePoint=function(m){if(this.rotationAngle===0)return m;var P=this.container.getCTM();P=P.inverse();var _=x.createPoint(m.x,m.y);return{x:(_=_.matrixTransform(P)).x,y:_.y}},h.prototype.select=function(){D.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},h.prototype.deselect=function(){D.prototype.deselect.call(this),this.controlBox.style.display="none"},h.prototype.setupControlBox=function(){this.controlBox=x.createGroup();var m=x.createTransform();m.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(m),this.container.appendChild(this.controlBox),this.controlRect=x.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=x.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new e,this.addControlGrips(),this.controlBox.style.display="none"},h.prototype.adjustControlBox=function(){var m=this.controlBox.transform.baseVal.getItem(0);m.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(m,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()},h.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()},h.prototype.createGrip=function(){var m=new s;return m.visual.transform.baseVal.appendItem(x.createTransform()),this.controlBox.appendChild(m.visual),m},h.prototype.positionGrips=function(){var m=this.controlGrips.topLeft.GRIP_SIZE,P=-m/2,_=P,A=(this.width+this.CB_DISTANCE)/2-m/2,Y=(this.height+this.CB_DISTANCE)/2-m/2,ne=this.height+this.CB_DISTANCE-m/2,ue=this.width+this.CB_DISTANCE-m/2;this.positionGrip(this.controlGrips.topLeft.visual,P,_),this.positionGrip(this.controlGrips.topCenter.visual,A,_),this.positionGrip(this.controlGrips.topRight.visual,ue,_),this.positionGrip(this.controlGrips.centerLeft.visual,P,Y),this.positionGrip(this.controlGrips.centerRight.visual,ue,Y),this.positionGrip(this.controlGrips.bottomLeft.visual,P,ne),this.positionGrip(this.controlGrips.bottomCenter.visual,A,ne),this.positionGrip(this.controlGrips.bottomRight.visual,ue,ne),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,A,_-3*this.CB_DISTANCE)},h.prototype.positionGrip=function(m,P,_){var A=m.transform.baseVal.getItem(0);A.setTranslate(P,_),m.transform.baseVal.replaceItem(A,0)},h.prototype.hideControlBox=function(){this.controlBox.style.display="none"},h.prototype.showControlBox=function(){this.controlBox.style.display=""},h.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:a.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:a.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},D.prototype.getState.call(this))},h.prototype.restoreState=function(m){D.prototype.restoreState.call(this,m);var P=m;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(a.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,P.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(a.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,P.containerTransformMatrix))},h.prototype.scale=function(m,P){D.prototype.scale.call(this,m,P);var _=this.rotatePoint({x:this.left,y:this.top}),A=this.unrotatePoint({x:_.x*m,y:_.y*P});this.left=A.x,this.top=A.y,this.width=this.width*m,this.height=this.height*P,this.adjustControlBox()},h}(l),d=function(D){function h(m,P,_){var A=D.call(this,m,P,_)||this;return A.fillColor="transparent",A.strokeColor="transparent",A.strokeWidth=0,A.strokeDasharray="",A.opacity=1,A.setStrokeColor=A.setStrokeColor.bind(A),A.setFillColor=A.setFillColor.bind(A),A.setStrokeWidth=A.setStrokeWidth.bind(A),A.setStrokeDasharray=A.setStrokeDasharray.bind(A),A.createVisual=A.createVisual.bind(A),A}return U(h,D),h.prototype.ownsTarget=function(m){return!(!D.prototype.ownsTarget.call(this,m)&&m!==this.visual)},h.prototype.createVisual=function(){this.visual=x.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},h.prototype.pointerDown=function(m,P){D.prototype.pointerDown.call(this,m,P),this.state==="new"&&(this.createVisual(),this.moveVisual(m),this._state="creating")},h.prototype.manipulate=function(m){D.prototype.manipulate.call(this,m)},h.prototype.resize=function(m){D.prototype.resize.call(this,m),this.setSize()},h.prototype.setSize=function(){D.prototype.setSize.call(this),x.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},h.prototype.pointerUp=function(m){D.prototype.pointerUp.call(this,m),this.setSize()},h.prototype.setStrokeColor=function(m){this.strokeColor=m,this.visual&&x.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(m),this.stateChanged()},h.prototype.setFillColor=function(m){this.fillColor=m,this.visual&&x.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},h.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.visual&&x.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},h.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.visual&&x.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},h.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},D.prototype.getState.call(this))},h.prototype.restoreState=function(m){var P=m;this.fillColor=P.fillColor,this.strokeColor=P.strokeColor,this.strokeWidth=P.strokeWidth,this.strokeDasharray=P.strokeDasharray,this.opacity=P.opacity,this.createVisual(),D.prototype.restoreState.call(this,m),this.setSize()},h.prototype.scale=function(m,P){D.prototype.scale.call(this,m,P),this.setSize()},h.title="Rectangle marker",h}(c),o=function(D){function h(m,P,_,A){var Y=D.call(this,m,A||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return Y.widths=[],Y.widthBoxes=[],Y.widths=P,Y.currentWidth=_,Y.setCurrentWidth=Y.setCurrentWidth.bind(Y),Y}return U(h,D),h.prototype.getUi=function(){var m=this,P=document.createElement("div");return P.style.display="flex",P.style.overflow="hidden",P.style.flexGrow="2",this.widths.forEach(function(_){var A=document.createElement("div");A.style.display="flex",A.style.flexGrow="2",A.style.alignItems="center",A.style.justifyContent="space-between",A.style.padding="5px",A.style.borderWidth="2px",A.style.borderStyle="solid",A.style.borderColor=_===m.currentWidth?m.uiStyleSettings.toolboxAccentColor:"transparent",A.addEventListener("click",function(){m.setCurrentWidth(_,A)}),P.appendChild(A);var Y=document.createElement("div");Y.innerText=_.toString(),Y.style.marginRight="5px",A.appendChild(Y);var ne=document.createElement("div");ne.style.minHeight="20px",ne.style.flexGrow="2",ne.style.display="flex",ne.style.alignItems="center";var ue=document.createElement("hr");ue.style.minWidth="20px",ue.style.border="0px",ue.style.borderTop=_+"px solid "+m.uiStyleSettings.toolboxColor,ue.style.flexGrow="2",ne.appendChild(ue),A.appendChild(ne),m.widthBoxes.push(A)}),P},h.prototype.setCurrentWidth=function(m,P){var _=this;this.currentWidth=m,this.widthBoxes.forEach(function(A){A.style.borderColor=A===P?_.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},h}(b),f=function(D){function h(m,P,_,A){var Y=D.call(this,m,A||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return Y.styles=[],Y.styleBoxes=[],Y.styles=P,Y.currentStyle=_,Y.setCurrentStyle=Y.setCurrentStyle.bind(Y),Y}return U(h,D),h.prototype.getUi=function(){var m=this,P=document.createElement("div");return P.style.display="flex",P.style.overflow="hidden",P.style.flexGrow="2",this.styles.forEach(function(_){var A=document.createElement("div");A.style.display="flex",A.style.alignItems="center",A.style.justifyContent="space-between",A.style.padding="5px",A.style.borderWidth="2px",A.style.borderStyle="solid",A.style.overflow="hidden",A.style.maxWidth=100/m.styles.length-5+"%",A.style.borderColor=_===m.currentStyle?m.uiStyleSettings.toolboxAccentColor:"transparent",A.addEventListener("click",function(){m.setCurrentStyle(_,A)}),P.appendChild(A);var Y=document.createElement("div");Y.style.minHeight="20px",Y.style.flexGrow="2",Y.style.overflow="hidden";var ne=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+m.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(_!==""?'stroke-dasharray="'+_+'"':"")+` />
</svg>`;Y.innerHTML=ne,A.appendChild(Y),m.styleBoxes.push(A)}),P},h.prototype.setCurrentStyle=function(m,P){var _=this;this.currentStyle=m,this.styleBoxes.forEach(function(A){A.style.borderColor=A===P?_.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},h}(b),u=function(D){function h(m,P,_){var A=D.call(this,m,P,_)||this;return A.strokeColor=_.defaultColor,A.strokeWidth=_.defaultStrokeWidth,A.strokeDasharray=_.defaultStrokeDasharray,A.strokePanel=new v("Line color",_.defaultColorSet,_.defaultColor),A.strokePanel.onColorChanged=A.setStrokeColor,A.strokeWidthPanel=new o("Line width",_.defaultStrokeWidths,_.defaultStrokeWidth),A.strokeWidthPanel.onWidthChanged=A.setStrokeWidth,A.strokeStylePanel=new f("Line style",_.defaultStrokeDasharrays,_.defaultStrokeDasharray),A.strokeStylePanel.onStyleChanged=A.setStrokeDasharray,A}return U(h,D),Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var m=D.prototype.getState.call(this);return m.typeName=h.typeName,m},h.typeName="FrameMarker",h.title="Frame marker",h.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',h}(d),i=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},r=function(D){function h(m,P,_){var A=D.call(this,m,P,_)||this;return A.x1=0,A.y1=0,A.x2=0,A.y2=0,A.defaultLength=50,A.manipulationStartX=0,A.manipulationStartY=0,A.manipulationStartX1=0,A.manipulationStartY1=0,A.manipulationStartX2=0,A.manipulationStartY2=0,A.setupControlBox(),A}return U(h,D),h.prototype.ownsTarget=function(m){return!!D.prototype.ownsTarget.call(this,m)||!(!this.grip1.ownsTarget(m)&&!this.grip2.ownsTarget(m))},h.prototype.pointerDown=function(m,P){D.prototype.pointerDown.call(this,m,P),this.manipulationStartX=m.x,this.manipulationStartY=m.y,this.state==="new"&&(this.x1=m.x,this.y1=m.y,this.x2=m.x,this.y2=m.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")},h.prototype.pointerUp=function(m){var P=this.state;D.prototype.pointerUp.call(this,m),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(m),this._state="select",P==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},h.prototype.adjustVisual=function(){},h.prototype.manipulate=function(m){this.state==="creating"?this.resize(m):this.state==="move"?(this.x1=this.manipulationStartX1+m.x-this.manipulationStartX,this.y1=this.manipulationStartY1+m.y-this.manipulationStartY,this.x2=this.manipulationStartX2+m.x-this.manipulationStartX,this.y2=this.manipulationStartY2+m.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(m)},h.prototype.resize=function(m){switch(this.activeGrip){case this.grip1:this.x1=m.x,this.y1=m.y;break;case this.grip2:case void 0:this.x2=m.x,this.y2=m.y}this.adjustVisual(),this.adjustControlBox()},h.prototype.select=function(){D.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},h.prototype.deselect=function(){D.prototype.deselect.call(this),this.controlBox.style.display="none"},h.prototype.setupControlBox=function(){this.controlBox=x.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},h.prototype.adjustControlBox=function(){this.positionGrips()},h.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},h.prototype.createGrip=function(){var m=new s;return m.visual.transform.baseVal.appendItem(x.createTransform()),this.controlBox.appendChild(m.visual),m},h.prototype.positionGrips=function(){var m=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-m/2,this.y1-m/2),this.positionGrip(this.grip2.visual,this.x2-m/2,this.y2-m/2)},h.prototype.positionGrip=function(m,P,_){var A=m.transform.baseVal.getItem(0);A.setTranslate(P,_),m.transform.baseVal.replaceItem(A,0)},h.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},D.prototype.getState.call(this))},h.prototype.restoreState=function(m){D.prototype.restoreState.call(this,m);var P=m;this.x1=P.x1,this.y1=P.y1,this.x2=P.x2,this.y2=P.y2},h.prototype.scale=function(m,P){D.prototype.scale.call(this,m,P),this.x1=this.x1*m,this.y1=this.y1*P,this.x2=this.x2*m,this.y2=this.y2*P,this.adjustVisual(),this.adjustControlBox()},h}(l),t=function(D){function h(m,P,_){var A=D.call(this,m,P,_)||this;return A.strokeColor="transparent",A.strokeWidth=0,A.strokeDasharray="",A.setStrokeColor=A.setStrokeColor.bind(A),A.setStrokeWidth=A.setStrokeWidth.bind(A),A.setStrokeDasharray=A.setStrokeDasharray.bind(A),A.strokeColor=_.defaultColor,A.strokeWidth=_.defaultStrokeWidth,A.strokeDasharray=_.defaultStrokeDasharray,A.strokePanel=new v("Line color",_.defaultColorSet,_.defaultColor),A.strokePanel.onColorChanged=A.setStrokeColor,A.strokeWidthPanel=new o("Line width",_.defaultStrokeWidths,_.defaultStrokeWidth),A.strokeWidthPanel.onWidthChanged=A.setStrokeWidth,A.strokeStylePanel=new f("Line style",_.defaultStrokeDasharrays,_.defaultStrokeDasharray),A.strokeStylePanel.onStyleChanged=A.setStrokeDasharray,A}return U(h,D),h.prototype.ownsTarget=function(m){return!(!D.prototype.ownsTarget.call(this,m)&&m!==this.visual&&m!==this.selectorLine&&m!==this.visibleLine)},h.prototype.createVisual=function(){this.visual=x.createGroup(),this.selectorLine=x.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=x.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},h.prototype.pointerDown=function(m,P){D.prototype.pointerDown.call(this,m,P),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},h.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),x.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),x.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),x.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},h.prototype.setStrokeColor=function(m){this.strokeColor=m,this.adjustVisual(),this.colorChanged(m)},h.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.adjustVisual()},h.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.adjustVisual(),this.stateChanged()},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var m=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},D.prototype.getState.call(this));return m.typeName=h.typeName,m},h.prototype.restoreState=function(m){D.prototype.restoreState.call(this,m);var P=m;this.strokeColor=P.strokeColor,this.strokeWidth=P.strokeWidth,this.strokeDasharray=P.strokeDasharray,this.createVisual(),this.adjustVisual()},h.typeName="LineMarker",h.title="Line marker",h.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',h}(r),n=function(D){function h(m,P,_,A){var Y=D.call(this,m,A||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return Y.fonts=[],Y.fontBoxes=[],Y.fonts=P,Y.currentFont=_,Y.setCurrentFont=Y.setCurrentFont.bind(Y),Y}return U(h,D),h.prototype.getUi=function(){var m=this,P=document.createElement("div");return P.style.overflow="hidden",P.style.flexGrow="2",this.fonts.forEach(function(_){var A=document.createElement("div");A.style.display="inline-block",A.style.alignItems="center",A.style.justifyContent="space-between",A.style.padding="5px",A.style.borderWidth="2px",A.style.borderStyle="solid",A.style.overflow="hidden",A.style.maxWidth=100/m.fonts.length-5+"%",A.style.borderColor=_===m.currentFont?m.uiStyleSettings.toolboxAccentColor:"transparent",A.addEventListener("click",function(){m.setCurrentFont(_,A)}),P.appendChild(A);var Y=document.createElement("div");Y.style.display="flex",Y.style.minHeight="20px",Y.style.flexGrow="2",Y.style.fontFamily=_,Y.style.overflow="hidden";var ne=document.createElement("div");ne.style.whiteSpace="nowrap",ne.style.overflow="hidden",ne.style.textOverflow="ellipsis",ne.innerHTML="The quick brown fox jumps over the lazy dog",Y.appendChild(ne),A.appendChild(Y),m.fontBoxes.push(A)}),P},h.prototype.setCurrentFont=function(m,P){var _=this;this.currentFont=m,this.fontBoxes.forEach(function(A){A.style.borderColor=A===P?_.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},h}(b),g=function(D){function h(m,P,_){var A=D.call(this,m,P,_)||this;return A.color="transparent",A.padding=5,A.DEFAULT_TEXT="your text here",A.text=A.DEFAULT_TEXT,A.isMoved=!1,A.color=_.defaultColor,A.fontFamily=_.defaultFontFamily,A.defaultSize={x:100,y:30},A.setColor=A.setColor.bind(A),A.setFont=A.setFont.bind(A),A.renderText=A.renderText.bind(A),A.sizeText=A.sizeText.bind(A),A.textEditDivClicked=A.textEditDivClicked.bind(A),A.showTextEditor=A.showTextEditor.bind(A),A.setSize=A.setSize.bind(A),A.positionTextEditor=A.positionTextEditor.bind(A),A.colorPanel=new v("Color",_.defaultColorSet,_.defaultColor),A.colorPanel.onColorChanged=A.setColor,A.fontFamilyPanel=new n("Font",_.defaultFontFamilies,_.defaultFontFamily),A.fontFamilyPanel.onFontChanged=A.setFont,A}return U(h,D),h.prototype.ownsTarget=function(m){if(D.prototype.ownsTarget.call(this,m)||m===this.visual||m===this.textElement||m===this.bgRectangle)return!0;var P=!1;return this.textElement.childNodes.forEach(function(_){_===m&&(P=!0)}),P},h.prototype.createVisual=function(){this.visual=x.createGroup(),this.bgRectangle=x.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=x.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(x.createTransform()),this.textElement.transform.baseVal.appendItem(x.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},h.prototype.pointerDown=function(m,P){D.prototype.pointerDown.call(this,m,P),this.isMoved=!1,this.pointerDownPoint=m,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(m),this._state="creating")},h.prototype.renderText=function(){var m=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){m.textElement.appendChild(x.createTSpan(P.trim()===""?" ":P.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},h.prototype.getTextScale=function(){var m=this.textElement.getBBox(),P=1;if(m.width>0&&m.height>0){var _=(1*this.width-this.width*this.padding*2/100)/m.width,A=(1*this.height-this.height*this.padding*2/100)/m.height;P=Math.min(_,A)}return P},h.prototype.getTextPosition=function(m){var P=this.textElement.getBBox(),_=0,A=0;return P.width>0&&P.height>0&&(_=(this.width-P.width*m)/2,A=this.height/2-P.height*m/2),{x:_,y:A}},h.prototype.sizeText=function(){var m=this.textElement.getBBox(),P=this.getTextScale(),_=this.getTextPosition(P);_.y-=m.y*P,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+_.x+"px, "+_.y+"px) scale("+P+", "+P+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(_.x,_.y),this.textElement.transform.baseVal.getItem(1).setScale(P,P))},h.prototype.manipulate=function(m){D.prototype.manipulate.call(this,m),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(m.x-this.pointerDownPoint.x)>5||Math.abs(m.y-this.pointerDownPoint.y)>5)},h.prototype.resize=function(m){D.prototype.resize.call(this,m),this.isMoved=!0,this.setSize(),this.sizeText()},h.prototype.setSize=function(){D.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(x.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),x.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},h.prototype.pointerUp=function(m){var P=this.state;P==="creating"&&(this._suppressMarkerCreateEvent=!0),D.prototype.pointerUp.call(this,m),this.setSize(),(P==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},h.prototype.showTextEditor=function(){var m=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(m.textEditor.style.fontSize);m.textEditor.clientWidth>=Number.parseInt(m.textEditor.style.maxWidth)&&P>.9;)P-=.1,m.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 _=P.clipboardData.getData("text"),A=window.getSelection();if(!A.rangeCount)return!1;A.deleteFromDocument(),A.getRangeAt(0).insertNode(document.createTextNode(_)),P.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){m.textEditDivClicked(m.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},h.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var m=this.getTextScale(),P=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),_=this.textElement.getBBox(),A={x:_.width*m,y:_.height*m};P.x-=A.x/2,P.y-=A.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*m,12)+"px",this.textElement.style.display="none"}},h.prototype.textEditDivClicked=function(m){this.text=m.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},h.prototype.select=function(){D.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},h.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),D.prototype.deselect.call(this)},h.prototype.dblClick=function(m,P){D.prototype.dblClick.call(this,m,P),this.showTextEditor()},h.prototype.setColor=function(m){this.textElement&&x.setAttributes(this.textElement,[["fill",m]]),this.color=m,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(m)},h.prototype.setFont=function(m){this.textElement&&x.setAttributes(this.textElement,[["font-family",m]]),this.fontFamily=m,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},h.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},h.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var m=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},D.prototype.getState.call(this));return m.typeName=h.typeName,m},h.prototype.restoreState=function(m){var P=m;this.color=P.color,this.fontFamily=P.fontFamily,this.padding=P.padding,this.text=P.text,this.createVisual(),D.prototype.restoreState.call(this,m),this.setSize()},h.prototype.scale=function(m,P){D.prototype.scale.call(this,m,P),this.setSize(),this.sizeText(),this.positionTextEditor()},h.typeName="TextMarker",h.title="Text marker",h.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',h}(c),p=function(D){function h(m,P,_){var A=D.call(this,m,P,_)||this;return A.color="transparent",A.lineWidth=3,A.drawing=!1,A.pixelRatio=1,A.color=_.defaultColor,A.lineWidth=_.defaultStrokeWidth,A.pixelRatio=_.freehandPixelRatio,A.setColor=A.setColor.bind(A),A.addCanvas=A.addCanvas.bind(A),A.finishCreation=A.finishCreation.bind(A),A.setLineWidth=A.setLineWidth.bind(A),A.colorPanel=new v("Color",_.defaultColorSet,_.defaultColor),A.colorPanel.onColorChanged=A.setColor,A.lineWidthPanel=new o("Line width",_.defaultStrokeWidths,_.defaultStrokeWidth),A.lineWidthPanel.onWidthChanged=A.setLineWidth,A}return U(h,D),h.prototype.ownsTarget=function(m){return!(!D.prototype.ownsTarget.call(this,m)&&m!==this.visual&&m!==this.drawingImage)},h.prototype.createVisual=function(){this.visual=x.createGroup(),this.drawingImage=x.createImage(),this.visual.appendChild(this.drawingImage);var m=x.createTransform();this.visual.transform.baseVal.appendItem(m),this.addMarkerVisualToContainer(this.visual)},h.prototype.pointerDown=function(m,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(m.x,m.y),this.drawing=!0):D.prototype.pointerDown.call(this,m,P)},h.prototype.manipulate=function(m){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(m.x,m.y),this.canvasContext.stroke()):D.prototype.manipulate.call(this,m)},h.prototype.resize=function(m){D.prototype.resize.call(this,m),x.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),x.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},h.prototype.pointerUp=function(m){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):D.prototype.pointerUp.call(this,m)},h.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)},h.prototype.select=function(){this.state==="creating"&&this.finishCreation(),D.prototype.select.call(this)},h.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),D.prototype.deselect.call(this)},h.prototype.finishCreation=function(){for(var m=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),P=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],_=P[0],A=P[1],Y=P[2],ne=P[3],ue=!1,fe=0;fe<this.canvasElement.height;fe++)for(var Ee=0;Ee<this.canvasElement.width;Ee++)m.data[fe*this.canvasElement.width*4+4*Ee+3]>0&&(ue=!0,fe<A&&(A=fe),Ee<_&&(_=Ee),fe>ne&&(ne=fe),Ee>Y&&(Y=Ee));if(ue){this.left=_/this.pixelRatio,this.top=A/this.pixelRatio,this.width=(Y-_)/this.pixelRatio,this.height=(ne-A)/this.pixelRatio;var we=document.createElement("canvas");we.width=Y-_,we.height=ne-A,we.getContext("2d").putImageData(this.canvasContext.getImageData(_,A,Y-_,ne-A),0,0),this.drawingImgUrl=we.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},h.prototype.setDrawingImage=function(){x.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),x.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},h.prototype.setColor=function(m){this.color=m,this.colorChanged(m)},h.prototype.setLineWidth=function(m){this.lineWidth=m},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var m=Object.assign({drawingImgUrl:this.drawingImgUrl},D.prototype.getState.call(this));return m.typeName=h.typeName,m},h.prototype.restoreState=function(m){this.createVisual(),D.prototype.restoreState.call(this,m),this.drawingImgUrl=m.drawingImgUrl,this.setDrawingImage()},h.prototype.scale=function(m,P){D.prototype.scale.call(this,m,P),this.setDrawingImage()},h.typeName="FreehandMarker",h.title="Freehand marker",h.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',h}(c),S=function(D){function h(m,P,_){var A=D.call(this,m,_||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return A.typeBoxes=[],A.currentType=P,A.setCurrentType=A.setCurrentType.bind(A),A}return U(h,D),h.prototype.getUi=function(){var m=this,P=document.createElement("div");P.style.display="flex",P.style.overflow="hidden",P.style.flexGrow="2";for(var _=function(ne){var ue="both";switch(ne){case 0:ue="both";break;case 1:ue="start";break;case 2:ue="end";break;case 3:ue="none"}var fe=document.createElement("div");if(fe.style.display="flex",fe.style.flexGrow="2",fe.style.alignItems="center",fe.style.justifyContent="space-between",fe.style.padding="5px",fe.style.borderWidth="2px",fe.style.borderStyle="solid",fe.style.borderColor=ue===A.currentType?A.uiStyleSettings.toolboxAccentColor:"transparent",fe.addEventListener("click",function(){m.setCurrentType(ue,fe)}),P.appendChild(fe),ue==="both"||ue==="start"){var Ee=document.createElement("div");Ee.style.display="flex",Ee.style.alignItems="center",Ee.style.minHeight="20px",Ee.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,5 10,0 10,10" fill="`+(A.uiStyleSettings!==void 0?A.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Ee.style.marginLeft="5px",fe.appendChild(Ee)}var we=document.createElement("div");we.style.display="flex",we.style.alignItems="center",we.style.minHeight="20px",we.style.flexGrow="2";var Ae=document.createElement("hr");if(Ae.style.minWidth="20px",Ae.style.border="0px",Ae.style.borderTop="3px solid "+(A.uiStyleSettings!==void 0?A.uiStyleSettings.toolboxColor:"#eeeeee"),Ae.style.flexGrow="2",we.appendChild(Ae),fe.appendChild(we),ue==="both"||ue==="end"){var De=document.createElement("div");De.style.display="flex",De.style.alignItems="center",De.style.minHeight="20px",De.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,0 10,5 0,10" fill="`+(A.uiStyleSettings!==void 0?A.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,De.style.marginRight="5px",fe.appendChild(De)}A.typeBoxes.push(fe)},A=this,Y=0;Y<4;Y++)_(Y);return P},h.prototype.setCurrentType=function(m,P){var _=this;this.currentType=m,this.typeBoxes.forEach(function(A){A.style.borderColor=A===P?_.uiStyleSettings!==void 0?_.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},h}(b),k=function(D){function h(m,P,_){var A=D.call(this,m,P,_)||this;return A.arrowType="end",A.arrowBaseHeight=10,A.arrowBaseWidth=10,A.getArrowPoints=A.getArrowPoints.bind(A),A.setArrowType=A.setArrowType.bind(A),A.arrowTypePanel=new S("Arrow type","end"),A.arrowTypePanel.onArrowTypeChanged=A.setArrowType,A}return U(h,D),h.prototype.ownsTarget=function(m){return!(!D.prototype.ownsTarget.call(this,m)&&m!==this.arrow1&&m!==this.arrow2)},h.prototype.getArrowPoints=function(m,P){var _=this.arrowBaseWidth+2*this.strokeWidth,A=this.arrowBaseHeight+2*this.strokeWidth;return m-_/2+","+(P+A/2)+" "+m+","+(P-A/2)+" "+(m+_/2)+","+(P+A/2)},h.prototype.createTips=function(){this.arrow1=x.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(x.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=x.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(x.createTransform()),this.visual.appendChild(this.arrow2)},h.prototype.pointerDown=function(m,P){D.prototype.pointerDown.call(this,m,P),this.state==="creating"&&this.createTips()},h.prototype.adjustVisual=function(){if(D.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",x.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),x.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var m=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(m,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(P,0);var _=this.arrow2.transform.baseVal.getItem(0);_.setRotate(m+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(_,0)}},h.prototype.setArrowType=function(m){this.arrowType=m,this.adjustVisual(),this.stateChanged()},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var m=Object.assign({arrowType:this.arrowType},D.prototype.getState.call(this));return m.typeName=h.typeName,m},h.prototype.restoreState=function(m){D.prototype.restoreState.call(this,m);var P=m;this.arrowType=P.arrowType,this.createTips(),this.adjustVisual()},h.typeName="ArrowMarker",h.title="Arrow marker",h.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',h}(t),I=function(D){function h(m,P,_){var A=D.call(this,m,P,_)||this;return A.fillColor=_.defaultFillColor,A.strokeWidth=0,A.fillPanel=new v("Color",_.defaultColorSet,_.defaultFillColor),A.fillPanel.onColorChanged=A.setFillColor,A}return U(h,D),Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var m=D.prototype.getState.call(this);return m.typeName=h.typeName,m},h.typeName="CoverMarker",h.title="Cover marker",h.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',h}(d),G=function(D){function h(m,P,_,A){var Y=D.call(this,m,A||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return Y.opacities=[],Y.opacityBoxes=[],Y.opacities=P,Y.currentOpacity=_,Y.setCurrentOpacity=Y.setCurrentOpacity.bind(Y),Y}return U(h,D),h.prototype.getUi=function(){var m=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(_){var A=document.createElement("div");A.style.display="flex",A.style.alignItems="center",A.style.justifyContent="center",A.style.padding="5px",A.style.borderWidth="2px",A.style.borderStyle="solid",A.style.borderColor=_===m.currentOpacity?m.uiStyleSettings.toolboxAccentColor:"transparent",A.addEventListener("click",function(){m.setCurrentOpacity(_,A)}),P.appendChild(A);var Y=document.createElement("div");Y.innerText=100*_+"%",A.appendChild(Y),m.opacityBoxes.push(A)}),P},h.prototype.setCurrentOpacity=function(m,P){var _=this;this.currentOpacity=m,this.opacityBoxes.forEach(function(A){A.style.borderColor=A===P?_.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},h}(b),V=function(D){function h(m,P,_){var A=D.call(this,m,P,_)||this;return A.setOpacity=A.setOpacity.bind(A),A.fillColor=_.defaultHighlightColor,A.strokeWidth=0,A.opacity=_.defaultHighlightOpacity,A.fillPanel=new v("Color",_.defaultColorSet,A.fillColor),A.fillPanel.onColorChanged=A.setFillColor,A.opacityPanel=new G("Opacity",_.defaultOpacitySteps,A.opacity),A.opacityPanel.onOpacityChanged=A.setOpacity,A}return U(h,D),h.prototype.setOpacity=function(m){this.opacity=m,this.visual&&x.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var m=D.prototype.getState.call(this);return m.typeName=h.typeName,m},h.typeName="HighlightMarker",h.title="Highlight marker",h.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',h}(I),J='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',re=function(D){function h(m,P,_){var A=D.call(this,m,P,_)||this;return A.bgColor="transparent",A.tipPosition={x:0,y:0},A.tipBase1Position={x:0,y:0},A.tipBase2Position={x:0,y:0},A.tipMoving=!1,A.color=_.defaultStrokeColor,A.bgColor=_.defaultFillColor,A.fontFamily=_.defaultFontFamily,A.defaultSize={x:100,y:30},A.setBgColor=A.setBgColor.bind(A),A.getTipPoints=A.getTipPoints.bind(A),A.positionTip=A.positionTip.bind(A),A.setTipPoints=A.setTipPoints.bind(A),A.colorPanel=new v("Text color",_.defaultColorSet,A.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),A.colorPanel.onColorChanged=A.setColor,A.bgColorPanel=new v("Fill color",_.defaultColorSet,A.bgColor,J),A.bgColorPanel.onColorChanged=A.setBgColor,A.fontFamilyPanel=new n("Font",_.defaultFontFamilies,_.defaultFontFamily),A.fontFamilyPanel.onFontChanged=A.setFont,A.tipGrip=new s,A.tipGrip.visual.transform.baseVal.appendItem(x.createTransform()),A.controlBox.appendChild(A.tipGrip.visual),A}return U(h,D),h.prototype.ownsTarget=function(m){return D.prototype.ownsTarget.call(this,m)||this.tipGrip.ownsTarget(m)||this.tip===m},h.prototype.createTip=function(){x.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=x.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},h.prototype.pointerDown=function(m,P){this.state==="new"&&D.prototype.pointerDown.call(this,m,P),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(P)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):D.prototype.pointerDown.call(this,m,P)},h.prototype.pointerUp=function(m){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,D.prototype.pointerUp.call(this,m);else{var P=this.state==="creating";D.prototype.pointerUp.call(this,m),this.setTipPoints(P),this.positionTip()}},h.prototype.manipulate=function(m){if(this.tipMoving){var P=this.unrotatePoint(m);this.tipPosition={x:P.x-this.manipulationStartLeft,y:P.y-this.manipulationStartTop},this.positionTip()}else D.prototype.manipulate.call(this,m)},h.prototype.setBgColor=function(m){this.bgRectangle&&this.tip&&(x.setAttributes(this.bgRectangle,[["fill",m]]),x.setAttributes(this.tip,[["fill",m]])),this.bgColor=m,this.fillColorChanged(m)},h.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},h.prototype.setTipPoints=function(m){m===void 0&&(m=!1);var P=Math.min(this.height/2,15),_=this.height/5;m&&(this.tipPosition={x:P+_/2,y:this.height+20});var A=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?A<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(_=this.width/5,P=Math.min(this.width/2,15),this.tipBase1Position={x:P,y:0},this.tipBase2Position={x:P+_,y:0}):(this.tipBase1Position={x:0,y:P},this.tipBase2Position={x:0,y:P+_}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?A<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(_=this.width/5,P=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-P-_,y:0},this.tipBase2Position={x:this.width-P,y:0}):(this.tipBase1Position={x:this.width,y:P},this.tipBase2Position={x:this.width,y:P+_}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?A<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(_=this.width/5,P=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-P-_,y:this.height},this.tipBase2Position={x:this.width-P,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-P-_},this.tipBase2Position={x:this.width,y:this.height-P}):A<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(_=this.width/5,P=Math.min(this.width/2,15),this.tipBase1Position={x:P,y:this.height},this.tipBase2Position={x:P+_,y:this.height}):(this.tipBase1Position={x:0,y:this.height-P},this.tipBase2Position={x:0,y:this.height-P-_})},h.prototype.resize=function(m){D.prototype.resize.call(this,m),this.positionTip()},h.prototype.positionTip=function(){x.setAttributes(this.tip,[["points",this.getTipPoints()]]);var m=this.tipGrip.visual.transform.baseVal.getItem(0);m.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(m,0)},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),h.prototype.select=function(){this.positionTip(),D.prototype.select.call(this)},h.prototype.getState=function(){var m=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},D.prototype.getState.call(this));return m.typeName=h.typeName,m},h.prototype.restoreState=function(m){var P=m;this.bgColor=P.bgColor,this.tipPosition=P.tipPosition,D.prototype.restoreState.call(this,m),this.createTip(),this.setTipPoints()},h.prototype.scale=function(m,P){D.prototype.scale.call(this,m,P),this.tipPosition={x:this.tipPosition.x*m,y:this.tipPosition.y*P},this.positionTip()},h.typeName="CalloutMarker",h.title="Callout marker",h.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',h}(g),ee=function(D){function h(m,P,_){var A=D.call(this,m,P,_)||this;return A.fillColor="transparent",A.strokeColor="transparent",A.strokeWidth=0,A.strokeDasharray="",A.opacity=1,A.strokeColor=_.defaultColor,A.strokeWidth=_.defaultStrokeWidth,A.strokeDasharray=_.defaultStrokeDasharray,A.fillColor=_.defaultFillColor,A.setStrokeColor=A.setStrokeColor.bind(A),A.setFillColor=A.setFillColor.bind(A),A.setStrokeWidth=A.setStrokeWidth.bind(A),A.setStrokeDasharray=A.setStrokeDasharray.bind(A),A.setOpacity=A.setOpacity.bind(A),A.createVisual=A.createVisual.bind(A),A.strokePanel=new v("Line color",O(_.defaultColorSet,["transparent"]),_.defaultColor),A.strokePanel.onColorChanged=A.setStrokeColor,A.fillPanel=new v("Fill color",O(_.defaultColorSet,["transparent"]),A.fillColor,J),A.fillPanel.onColorChanged=A.setFillColor,A.strokeWidthPanel=new o("Line width",_.defaultStrokeWidths,_.defaultStrokeWidth),A.strokeWidthPanel.onWidthChanged=A.setStrokeWidth,A.strokeStylePanel=new f("Line style",_.defaultStrokeDasharrays,_.defaultStrokeDasharray),A.strokeStylePanel.onStyleChanged=A.setStrokeDasharray,A.opacityPanel=new G("Opacity",_.defaultOpacitySteps,A.opacity),A.opacityPanel.onOpacityChanged=A.setOpacity,A}return U(h,D),h.prototype.ownsTarget=function(m){return!(!D.prototype.ownsTarget.call(this,m)&&m!==this.visual)},h.prototype.createVisual=function(){this.visual=x.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},h.prototype.pointerDown=function(m,P){D.prototype.pointerDown.call(this,m,P),this.state==="new"&&(this.createVisual(),this.moveVisual(m),this._state="creating")},h.prototype.manipulate=function(m){D.prototype.manipulate.call(this,m)},h.prototype.resize=function(m){D.prototype.resize.call(this,m),this.setSize()},h.prototype.setSize=function(){D.prototype.setSize.call(this),x.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},h.prototype.pointerUp=function(m){D.prototype.pointerUp.call(this,m),this.setSize()},h.prototype.setStrokeColor=function(m){this.strokeColor=m,this.visual&&x.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(m),this.stateChanged()},h.prototype.setFillColor=function(m){this.fillColor=m,this.visual&&x.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(m),this.stateChanged()},h.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.visual&&x.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},h.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.visual&&x.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},h.prototype.setOpacity=function(m){this.opacity=m,this.visual&&x.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var m=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},D.prototype.getState.call(this));return m.typeName=h.typeName,m},h.prototype.restoreState=function(m){var P=m;this.fillColor=P.fillColor,this.strokeColor=P.strokeColor,this.strokeWidth=P.strokeWidth,this.strokeDasharray=P.strokeDasharray,this.opacity=P.opacity,this.createVisual(),D.prototype.restoreState.call(this,m),this.setSize()},h.prototype.scale=function(m,P){D.prototype.scale.call(this,m,P),this.setSize()},h.typeName="EllipseMarker",h.title="Ellipse marker",h.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',h}(c),ae=function(D){function h(m,P,_){return D.call(this,m,P,_)||this}return U(h,D),Object.defineProperty(h.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),h.prototype.ownsTarget=function(m){return!(!D.prototype.ownsTarget.call(this,m)&&m!==this.tip1&&m!==this.tip2)},h.prototype.createTips=function(){this.tip1=x.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(x.createTransform()),this.visual.appendChild(this.tip1),this.tip2=x.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(x.createTransform()),this.visual.appendChild(this.tip2)},h.prototype.pointerDown=function(m,P){D.prototype.pointerDown.call(this,m,P),this.state==="creating"&&this.createTips()},h.prototype.adjustVisual=function(){if(D.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(x.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),x.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var m=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(m,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(P,0);var _=this.tip2.transform.baseVal.getItem(0);_.setRotate(m+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(_,0)}},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var m=D.prototype.getState.call(this);return m.typeName=h.typeName,m},h.prototype.restoreState=function(m){D.prototype.restoreState.call(this,m),this.createTips(),this.adjustVisual()},h.typeName="MeasurementMarker",h.title="Measurement marker",h.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',h}(t),be=function(D){function h(m,P,_){var A=D.call(this,m,P,_)||this;return A.strokePanel.colors=_.defaultColorSet,A.fillColor="transparent",A}return U(h,D),Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var m=D.prototype.getState.call(this);return m.typeName=h.typeName,m},h.typeName="EllipseFrameMarker",h.title="Ellipse frame marker",h.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',h}(ee),he=function(){function D(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(D.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),D.prototype.addUndoStep=function(h){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(h)||(this.undoStack.push(h),JSON.stringify(this.lastRedoStep)!==JSON.stringify(h)&&this.redoStack.splice(0,this.redoStack.length))},D.prototype.replaceLastUndoStep=function(h){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=h)},D.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},D.prototype.undo=function(){if(this.undoStack.length>1){var h=this.undoStack.pop();return h!==void 0&&this.redoStack.push(h),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},D.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},D}(),me=function(D){function h(m,P,_){var A=D.call(this,m,P,_)||this;return A.strokeColor="transparent",A.strokeWidth=0,A.strokeDasharray="",A.curveX=0,A.curveY=0,A.manipulationStartCurveX=0,A.manipulationStartCurveY=0,A.setStrokeColor=A.setStrokeColor.bind(A),A.setStrokeWidth=A.setStrokeWidth.bind(A),A.setStrokeDasharray=A.setStrokeDasharray.bind(A),A.positionGrips=A.positionGrips.bind(A),A.addControlGrips=A.addControlGrips.bind(A),A.adjustVisual=A.adjustVisual.bind(A),A.setupControlBox=A.setupControlBox.bind(A),A.resize=A.resize.bind(A),A.strokeColor=_.defaultColor,A.strokeWidth=_.defaultStrokeWidth,A.strokeDasharray=_.defaultStrokeDasharray,A.strokePanel=new v("Line color",_.defaultColorSet,_.defaultColor),A.strokePanel.onColorChanged=A.setStrokeColor,A.strokeWidthPanel=new o("Line width",_.defaultStrokeWidths,_.defaultStrokeWidth),A.strokeWidthPanel.onWidthChanged=A.setStrokeWidth,A.strokeStylePanel=new f("Line style",_.defaultStrokeDasharrays,_.defaultStrokeDasharray),A.strokeStylePanel.onStyleChanged=A.setStrokeDasharray,A}return U(h,D),h.prototype.ownsTarget=function(m){return!(!D.prototype.ownsTarget.call(this,m)&&m!==this.visual&&m!==this.selectorCurve&&m!==this.visibleCurve&&!this.curveGrip.ownsTarget(m))},h.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},h.prototype.createVisual=function(){this.visual=x.createGroup(),this.selectorCurve=x.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=x.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},h.prototype.pointerDown=function(m,P){D.prototype.pointerDown.call(this,m,P),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=m.x,this.curveY=m.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(P)&&(this.activeGrip=this.curveGrip,this._state="resize")},h.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),x.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),x.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),x.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},h.prototype.setupControlBox=function(){D.prototype.setupControlBox.call(this),this.curveControlLine1=x.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=x.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},h.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,D.prototype.addControlGrips.call(this)},h.prototype.positionGrips=function(){D.prototype.positionGrips.call(this);var m=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-m/2,this.curveY-m/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()))},h.prototype.manipulate=function(m){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+m.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+m.y-this.manipulationStartY),D.prototype.manipulate.call(this,m)},h.prototype.resize=function(m){this.activeGrip===this.curveGrip&&(this.curveX=m.x,this.curveY=m.y),D.prototype.resize.call(this,m),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},h.prototype.setStrokeColor=function(m){this.strokeColor=m,this.adjustVisual(),this.colorChanged(m)},h.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.adjustVisual()},h.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.adjustVisual()},h.prototype.scale=function(m,P){this.curveX=this.curveX*m,this.curveY=this.curveY*P,D.prototype.scale.call(this,m,P)},Object.defineProperty(h.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),h.prototype.getState=function(){var m=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},D.prototype.getState.call(this));return m.typeName=h.typeName,m},h.prototype.restoreState=function(m){D.prototype.restoreState.call(this,m);var P=m;this.strokeColor=P.strokeColor,this.strokeWidth=P.strokeWidth,this.strokeDasharray=P.strokeDasharray,this.curveX=P.curveX,this.curveY=P.curveY,this.createVisual(),this.adjustVisual()},h.typeName="CurveMarker",h.title="Curve marker",h.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',h}(r),ce=function(){function D(h,m){m===void 0&&(m=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=h,this.cancelable=m}return Object.defineProperty(D.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),D.prototype.preventDefault=function(){this._defaultPrevented=!0},D}(),te=function(D){function h(m,P,_){var A=D.call(this,m,!1)||this;return A.dataUrl=P,A.state=_,A}return U(h,D),h}(ce),q=function(D){function h(m,P,_){_===void 0&&(_=!1);var A=D.call(this,m,_)||this;return A.marker=P,A}return U(h,D),h}(ce),oe=function(){function D(){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 D.prototype.addEventListener=function(h,m){this[h].push(m)},D.prototype.removeEventListener=function(h,m){var P=this[h].indexOf(m);P>-1&&this[h].splice(P,1)},D}(),Z=function(){function D(h){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new i,this._isOpen=!1,this.undoRedoManager=new he,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 oe,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=D.instanceCounter++,this.styles=new L(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=h,this.targetRoot=document.body,this.width=h.clientWidth,this.height=h.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(D.prototype,"ALL_MARKER_TYPES",{get:function(){return[u,p,k,g,be,ee,V,re,ae,I,t,me]},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[u,p,k,g,ee,V,re]},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"BASIC_MARKER_TYPES",{get:function(){return[u,p,k,g,V]},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(h){var m=this;this._availableMarkerTypes.splice(0),h.forEach(function(P){if(typeof P=="string"){var _=m.ALL_MARKER_TYPES.find(function(A){return A.typeName===P});_!==void 0&&m._availableMarkerTypes.push(_)}else m._availableMarkerTypes.push(P)})},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(h){this._zoomLevel=h,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(D.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),D.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),K.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},D.prototype.show=function(){var h=this;this.styles.styleSheetRoot===void 0&&R.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=R.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(m){return m(new ce(h))})},D.prototype.render=function(){return C(this,void 0,void 0,function(){var h;return j(this,function(m){switch(m.label){case 0:return this.setCurrentMarker(),(h=new M).naturalSize=this.renderAtNaturalSize,h.imageType=this.renderImageType,h.imageQuality=this.renderImageQuality,h.markersOnly=this.renderMarkersOnly,h.width=this.renderWidth,h.height=this.renderHeight,[4,h.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return m.sent(),[4,h.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,m.sent()]}})})},D.prototype.close=function(h){var m=this;if(h===void 0&&(h=!1),this.isOpen){var P=!1;h||this.eventListeners.beforeclose.forEach(function(_){var A=new ce(m,!0);_(A),A.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(_){return _(new ce(m))}),this.detachEvents(),this._isOpen=!1)}},D.prototype.addMarkersToToolbar=function(){for(var h,m=[],P=0;P<arguments.length;P++)m[P]=arguments[P];(h=this._availableMarkerTypes).push.apply(h,m)},D.prototype.addRenderEventListener=function(h){this.addEventListener("render",function(m){h(m.dataUrl,m.state)})},D.prototype.removeRenderEventListener=function(h){},D.prototype.addCloseEventListener=function(h){this.addEventListener("close",function(){h()})},D.prototype.removeCloseEventListener=function(h){},D.prototype.setupResizeObserver=function(){var h=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){h.resize(h.target.clientWidth,h.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return h.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},D.prototype.onPopupTargetResize=function(){var h=1*this.target.clientWidth/this.target.clientHeight,m=this.editorCanvas.clientWidth/h>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*h:this.editorCanvas.clientWidth,P=m<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/h;this.resize(m,P)},D.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},D.prototype.resize=function(h,m){this._isResizing=!0;var P=h/this.imageWidth,_=m/this.imageHeight;this.imageWidth=Math.round(h),this.imageHeight=Math.round(m),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(P,_),this._isResizing=!1},D.prototype.scaleMarkers=function(h,m){var P,_=this;this._currentMarker&&this._currentMarker instanceof g?this._currentMarker.scale(h,m):(P=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(A){A!==_._currentMarker&&A.scale(h,m)}),P!==void 0&&this.setCurrentMarker(P)},D.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},D.prototype.setTopLeft=function(){var h=this.editingTarget.getBoundingClientRect(),m=this.editorCanvas.getBoundingClientRect();this.left=h.left-m.left,this.top=h.top-m.top},D.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},D.prototype.addDefs=function(){for(var h,m=[],P=0;P<arguments.length;P++)m[P]=arguments[P];this.defs=x.createDefs(),this.addDefsToImage(),(h=this.defs).append.apply(h,m)},D.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},D.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},D.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},D.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},D.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},D.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},D.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},D.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var h=document.createElement("a");h.href="https://markerjs.com/",h.target="_blank",h.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',h.title="Powered by marker.js",h.style.display="grid",h.style.alignItems="center",h.style.justifyItems="center",h.style.padding="3px",h.style.width="20px",h.style.height="20px",this.logoUI.appendChild(h),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},D.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")},D.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"},D.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},D.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 h=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=h+"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 w(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new E(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},D.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},D.prototype.removeMarker=function(h){this.markerImage.removeChild(h.container),this.markers.indexOf(h)>-1&&this.markers.splice(this.markers.indexOf(h),1),h.dispose()},D.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())},D.prototype.toolbarButtonClicked=function(h,m){if(h==="marker"&&m!==void 0)this.createNewMarker(m);else if(h==="action")switch(m){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()}},D.prototype.deleteSelectedMarker=function(){var h=this;if(this._currentMarker!==void 0){var m=!1;if(this.eventListeners.markerbeforedelete.forEach(function(_){var A=new q(h,h._currentMarker,!0);_(A),A.defaultPrevented&&(m=!0)}),!m){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(_){return _(new q(h,P))})}}},D.prototype.clear=function(){var h=this,m=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(Y){var ne=new q(h,void 0,!0);Y(ne),ne.defaultPrevented&&(m=!0)}),!m)){this.setCurrentMarker();for(var P=function(Y){var ne=_.markers[Y];_.setCurrentMarker(_.markers[Y]),_._currentMarker.dispose(),_.markerImage.removeChild(_._currentMarker.container),_.markers.splice(_.markers.indexOf(_._currentMarker),1),_.eventListeners.markerdelete.forEach(function(ue){return ue(new q(h,ne))})},_=this,A=this.markers.length-1;A>=0;A--)P(A);this.addUndoStep()}},Object.defineProperty(D.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),D.prototype.showNotesEditor=function(){var h;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=(h=this._currentMarker.notes)!==null&&h!==void 0?h:"",this.overlayContainer.appendChild(this.notesArea))},D.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)},D.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},D.prototype.addUndoStep=function(){var h=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var m=this.getState(),P=this.undoRedoManager.getLastUndoStep();if(!P||P.width===m.width&&P.height===m.height){var _=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(m),_<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(A){return A(new ce(h))})}else this.undoRedoManager.replaceLastUndoStep(m),this.eventListeners.statechange.forEach(function(A){return A(new ce(h))})}},D.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},D.prototype.undoStep=function(){var h=this,m=this.undoRedoManager.undo();m!==void 0&&(this.restoreState(m),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(P){return P(new ce(h))}))},D.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},D.prototype.redoStep=function(){var h=this,m=this.undoRedoManager.redo();m!==void 0&&(this.restoreState(m),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(P){return P(new ce(h))}))},D.prototype.stepZoom=function(){var h=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=h<this.zoomSteps.length-1?this.zoomSteps[h+1]:this.zoomSteps[0]},D.prototype.panTo=function(h){this.contentDiv.scrollBy({left:this.prevPanPoint.x-h.x,top:this.prevPanPoint.y-h.y}),this.prevPanPoint=h},D.prototype.startRenderAndClose=function(){return C(this,void 0,void 0,function(){var h,m,P=this;return j(this,function(_){switch(_.label){case 0:return[4,this.render()];case 1:return h=_.sent(),m=this.getState(),this.eventListeners.render.forEach(function(A){return A(new te(P,h,m))}),this.close(!0),[2]}})})},D.prototype.getState=function(h){h===!0&&this.setCurrentMarker();var m={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(P){return m.markers.push(P.getState())}),m},D.prototype.restoreState=function(h){var m=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);h.markers.forEach(function(P){var _=m._availableMarkerTypes.find(function(Y){return Y.typeName===P.typeName});if(_!==void 0){var A=m.addNewMarker(_);A.restoreState(P),m.markers.push(A)}}),h.width&&h.height&&(h.width!==this.imageWidth||h.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/h.width,this.imageHeight/h.height),this.eventListeners.restorestate.forEach(function(P){return P(new ce(m))})},D.prototype.addNewMarker=function(h){var m=x.createGroup();return this.markerImage.appendChild(m),new h(m,this.overlayContainer,this.settings)},D.prototype.createNewMarker=function(h){var m,P=this;(m=typeof h=="string"?this._availableMarkerTypes.find(function(_){return _.typeName===h}):h)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(m),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(m.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(_){return _(new q(P,P._currentMarker))}))},D.prototype.markerCreated=function(h){var m=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(h),this.setCurrentMarker(h),h instanceof p&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(p):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(P){return P(new q(m,m._currentMarker))})},D.prototype.colorChanged=function(h){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=h,this.settings.defaultStrokeColor=h)},D.prototype.fillColorChanged=function(h){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=h)},D.prototype.markerStateChanged=function(h){var m=this;this.eventListeners.markerchange.forEach(function(P){return P(new q(m,h))})},D.prototype.setCurrentMarker=function(h){var m=this;this._currentMarker!==h&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(P){return P(new q(m,m._currentMarker))})),this._currentMarker=h,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(P){return P(new q(m,m._currentMarker))}))},D.prototype.onPointerDown=function(h){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||h.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var m=this.markers.find(function(P){return P.ownsTarget(h.target)});m!==void 0?(this.setCurrentMarker(m),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(h.clientX,h.clientY),h.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:h.clientX,y:h.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(h.clientX,h.clientY))},D.prototype.onDblClick=function(h){if(this._isFocused||this.focus(),this.mode==="select"){var m=this.markers.find(function(P){return P.ownsTarget(h.target)});m!==void 0&&m!==this._currentMarker&&this.setCurrentMarker(m),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(h.clientX,h.clientY),h.target):this.setCurrentMarker()}},D.prototype.onPointerMove=function(h){this.touchPoints!==1&&h.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||h.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(h.clientX,h.clientY)):this.zoomLevel>1&&this.panTo({x:h.clientX,y:h.clientY}))},D.prototype.onPointerUp=function(h){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(h.clientX,h.clientY)),this.isDragging=!1,this.addUndoStep()},D.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},D.prototype.onKeyUp=function(h){this._currentMarker===void 0||this.notesArea!==void 0||h.key!=="Delete"&&h.key!=="Backspace"||this.deleteSelectedMarker()},D.prototype.clientToLocalCoordinates=function(h,m){var P=this.markerImage.getBoundingClientRect();return{x:(h-P.left)/this.zoomLevel,y:(m-P.top)/this.zoomLevel}},D.prototype.onWindowResize=function(){this.positionUI()},D.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var h=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=h+"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()},D.prototype.addLicenseKey=function(h){K.addKey(h)},D.prototype.addEventListener=function(h,m){this.eventListeners.addEventListener(h,m)},D.prototype.removeEventListener=function(h,m){this.eventListeners.removeEventListener(h,m)},D.prototype.renderState=function(h){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(h),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(D.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),D.prototype.focus=function(){var h=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(m){return m(new ce(h))}))},D.prototype.blur=function(){var h=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(m){return m(new ce(h))}))},D.instanceCounter=0,D}()},"U/Y8":function(Ve,Ie,ie){Ve.exports={flex_box_center:"flex_box_center___2aRVA",flex_space_between:"flex_space_between___12c3F",flex_box_vertical_center:"flex_box_vertical_center___30OYS",flex_box_center_end:"flex_box_center_end___12QBt",flex_box_column:"flex_box_column___t6urT",info:"info___2BaCz",bar:"bar___3Aega"}},WaYH:function(Ve,Ie,ie){"use strict";var ve=ie("rePB"),U=ie("Ff2n"),C=ie("VTBJ"),j=ie("1OyB"),O=ie("vuIU"),x=ie("JX7q"),K=ie("Ji7U"),M=ie("LK+K"),R=ie("q1tI"),L=ie("TSYQ"),y=ie.n(L),T=ie("sboe"),w=ie("OZM5"),E=function(f){var u=f.prefixCls,i=f.level,r=f.isStart,t=f.isEnd;if(!i)return null;for(var n="".concat(u,"-indent-unit"),g=[],p=0;p<i;p+=1){var S;g.push(R.createElement("span",{key:p,className:y()(n,(S={},Object(ve.a)(S,"".concat(n,"-start"),r[p+1]),Object(ve.a)(S,"".concat(n,"-end"),t[p+1]),Object(ve.a)(S,"".concat(n,"-end-first-level"),!p&&t[0]),S))}))}return R.createElement("span",{"aria-hidden":"true",className:"".concat(u,"-indent")},g)},b=E,v=ie("815F"),l="open",e="close",s="---",a=function(o){Object(K.a)(u,o);var f=Object(M.a)(u);function u(){var i;return Object(j.a)(this,u),i=f.apply(this,arguments),i.state={dragNodeHighlight:!1},i.onSelectorClick=function(r){var t=i.props.context.onNodeClick;t(r,Object(v.b)(i.props)),i.isSelectable()?i.onSelect(r):i.onCheck(r)},i.onSelectorDoubleClick=function(r){var t=i.props.context.onNodeDoubleClick;t(r,Object(v.b)(i.props))},i.onSelect=function(r){if(i.isDisabled())return;var t=i.props.context.onNodeSelect;r.preventDefault(),t(r,Object(v.b)(i.props))},i.onCheck=function(r){if(i.isDisabled())return;var t=i.props,n=t.disableCheckbox,g=t.checked,p=i.props.context.onNodeCheck;if(!i.isCheckable()||n)return;r.preventDefault();var S=!g;p(r,Object(v.b)(i.props),S)},i.onMouseEnter=function(r){var t=i.props.context.onNodeMouseEnter;t(r,Object(v.b)(i.props))},i.onMouseLeave=function(r){var t=i.props.context.onNodeMouseLeave;t(r,Object(v.b)(i.props))},i.onContextMenu=function(r){var t=i.props.context.onNodeContextMenu;t(r,Object(v.b)(i.props))},i.onDragStart=function(r){var t=i.props.context.onNodeDragStart;r.stopPropagation(),i.setState({dragNodeHighlight:!0}),t(r,Object(x.a)(i));try{r.dataTransfer.setData("text/plain","")}catch(n){}},i.onDragEnter=function(r){var t=i.props.context.onNodeDragEnter;r.preventDefault(),r.stopPropagation(),t(r,Object(x.a)(i))},i.onDragOver=function(r){var t=i.props.context.onNodeDragOver;r.preventDefault(),r.stopPropagation(),t(r,Object(x.a)(i))},i.onDragLeave=function(r){var t=i.props.context.onNodeDragLeave;r.stopPropagation(),t(r,Object(x.a)(i))},i.onDragEnd=function(r){var t=i.props.context.onNodeDragEnd;r.stopPropagation(),i.setState({dragNodeHighlight:!1}),t(r,Object(x.a)(i))},i.onDrop=function(r){var t=i.props.context.onNodeDrop;r.preventDefault(),r.stopPropagation(),i.setState({dragNodeHighlight:!1}),t(r,Object(x.a)(i))},i.onExpand=function(r){var t=i.props.context.onNodeExpand;t(r,Object(v.b)(i.props))},i.setSelectHandle=function(r){i.selectHandle=r},i.getNodeState=function(){var r=i.props.expanded;return i.isLeaf()?null:r?l:e},i.hasChildren=function(){var r=i.props.eventKey,t=i.props.context.keyEntities,n=t[r]||{},g=n.children;return!!(g||[]).length},i.isLeaf=function(){var r=i.props,t=r.isLeaf,n=r.loaded,g=i.props.context.loadData,p=i.hasChildren();return t===!1?!1:t||!g&&!p||g&&n&&!p},i.isDisabled=function(){var r=i.props.disabled,t=i.props.context.disabled;return!!(t||r)},i.isCheckable=function(){var r=i.props.checkable,t=i.props.context.checkable;return!t||r===!1?!1:t},i.syncLoadData=function(r){var t=r.expanded,n=r.loading,g=r.loaded,p=i.props.context,S=p.loadData,k=p.onNodeLoad;if(n)return;S&&t&&!i.isLeaf()&&(!i.hasChildren()&&!g&&k(Object(v.b)(i.props)))},i.renderSwitcher=function(){var r=i.props,t=r.expanded,n=r.switcherIcon,g=i.props.context,p=g.prefixCls,S=g.switcherIcon,k=n||S;if(i.isLeaf())return R.createElement("span",{className:y()("".concat(p,"-switcher"),"".concat(p,"-switcher-noop"))},typeof k=="function"?k(Object(C.a)(Object(C.a)({},i.props),{},{isLeaf:!0})):k);var I=y()("".concat(p,"-switcher"),"".concat(p,"-switcher_").concat(t?l:e));return R.createElement("span",{onClick:i.onExpand,className:I},typeof k=="function"?k(Object(C.a)(Object(C.a)({},i.props),{},{isLeaf:!1})):k)},i.renderCheckbox=function(){var r=i.props,t=r.checked,n=r.halfChecked,g=r.disableCheckbox,p=i.props.context.prefixCls,S=i.isDisabled(),k=i.isCheckable();if(!k)return null;var I=typeof k!="boolean"?k:null;return R.createElement("span",{className:y()("".concat(p,"-checkbox"),t&&"".concat(p,"-checkbox-checked"),!t&&n&&"".concat(p,"-checkbox-indeterminate"),(S||g)&&"".concat(p,"-checkbox-disabled")),onClick:i.onCheck},I)},i.renderIcon=function(){var r=i.props.loading,t=i.props.context.prefixCls;return R.createElement("span",{className:y()("".concat(t,"-iconEle"),"".concat(t,"-icon__").concat(i.getNodeState()||"docu"),r&&"".concat(t,"-icon_loading"))})},i.renderSelector=function(){var r=i.state.dragNodeHighlight,t=i.props,n=t.title,g=t.selected,p=t.icon,S=t.loading,k=t.data,I=i.props.context,G=I.prefixCls,V=I.showIcon,J=I.icon,re=I.draggable,ee=I.loadData,ae=I.titleRender,be=i.isDisabled(),he="".concat(G,"-node-content-wrapper"),me;if(V){var ce=p||J;me=ce?R.createElement("span",{className:y()("".concat(G,"-iconEle"),"".concat(G,"-icon__customize"))},typeof ce=="function"?ce(i.props):ce):i.renderIcon()}else ee&&S&&(me=i.renderIcon());var te;typeof n=="function"?te=n(k):ae?te=ae(k):te=n;var q=R.createElement("span",{className:"".concat(G,"-title")},te);return R.createElement("span",{ref:i.setSelectHandle,title:typeof n=="string"?n:"",className:y()("".concat(he),"".concat(he,"-").concat(i.getNodeState()||"normal"),!be&&(g||r)&&"".concat(G,"-node-selected"),!be&&re&&"draggable"),draggable:!be&&re||void 0,"aria-grabbed":!be&&re||void 0,onMouseEnter:i.onMouseEnter,onMouseLeave:i.onMouseLeave,onContextMenu:i.onContextMenu,onClick:i.onSelectorClick,onDoubleClick:i.onSelectorDoubleClick,onDragStart:re?i.onDragStart:void 0},me,q)},i}return Object(O.a)(u,[{key:"componentDidMount",value:function(){this.syncLoadData(this.props)}},{key:"componentDidUpdate",value:function(){this.syncLoadData(this.props)}},{key:"isSelectable",value:function(){var r=this.props.selectable,t=this.props.context.selectable;return typeof r=="boolean"?r:t}},{key:"render",value:function(){var r,t=this.props,n=t.eventKey,g=t.className,p=t.style,S=t.dragOver,k=t.dragOverGapTop,I=t.dragOverGapBottom,G=t.isLeaf,V=t.isStart,J=t.isEnd,re=t.expanded,ee=t.selected,ae=t.checked,be=t.halfChecked,he=t.loading,me=t.domRef,ce=t.active,te=t.onMouseMove,q=Object(U.a)(t,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),oe=this.props.context,Z=oe.prefixCls,D=oe.filterTreeNode,h=oe.draggable,m=oe.keyEntities,P=this.isDisabled(),_=Object(w.f)(q),A=m[n]||{},Y=A.level,ne=J[J.length-1];return R.createElement("div",Object.assign({ref:me,className:y()(g,"".concat(Z,"-treenode"),(r={},Object(ve.a)(r,"".concat(Z,"-treenode-disabled"),P),Object(ve.a)(r,"".concat(Z,"-treenode-switcher-").concat(re?"open":"close"),!G),Object(ve.a)(r,"".concat(Z,"-treenode-checkbox-checked"),ae),Object(ve.a)(r,"".concat(Z,"-treenode-checkbox-indeterminate"),be),Object(ve.a)(r,"".concat(Z,"-treenode-selected"),ee),Object(ve.a)(r,"".concat(Z,"-treenode-loading"),he),Object(ve.a)(r,"".concat(Z,"-treenode-active"),ce),Object(ve.a)(r,"".concat(Z,"-treenode-leaf-last"),ne),Object(ve.a)(r,"drag-over",!P&&S),Object(ve.a)(r,"drag-over-gap-top",!P&&k),Object(ve.a)(r,"drag-over-gap-bottom",!P&&I),Object(ve.a)(r,"filter-node",D&&D(Object(v.b)(this.props))),r)),style:p,onDragEnter:h?this.onDragEnter:void 0,onDragOver:h?this.onDragOver:void 0,onDragLeave:h?this.onDragLeave:void 0,onDrop:h?this.onDrop:void 0,onDragEnd:h?this.onDragEnd:void 0,onMouseMove:te},_),R.createElement(b,{prefixCls:Z,level:Y,isStart:V,isEnd:J}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),u}(R.Component),c=function(f){return R.createElement(T.a.Consumer,null,function(u){return R.createElement(a,Object.assign({},f,{context:u}))})};c.displayName="TreeNode",c.defaultProps={title:s},c.isTreeNode=1;var d=Ie.a=c},Y1PL:function(Ve,Ie,ie){"use strict";ie.r(Ie),ie.d(Ie,"ResizableTextArea",function(){return be});var ve=ie("wx14"),U=ie("1OyB"),C=ie("vuIU"),j=ie("Ji7U"),O=ie("LK+K"),x=ie("q1tI"),K=ie("VTBJ"),M=ie("rePB"),R=ie("Zm9Q"),L=ie("Kwbf"),y=ie("c+Xe"),T=ie("m+aA"),w=ie("bdgK"),E=new Map;function b(ce){ce.forEach(function(te){var q,oe=te.target;(q=E.get(oe))===null||q===void 0||q.forEach(function(Z){return Z(oe)})})}var v=new w.default(b),l=null,e=null;function s(ce,te){E.has(ce)||(E.set(ce,new Set),v.observe(ce)),E.get(ce).add(te)}function a(ce,te){E.has(ce)&&(E.get(ce).delete(te),E.get(ce).size||(v.unobserve(ce),E.delete(ce)))}var c=function(ce){Object(j.a)(q,ce);var te=Object(O.a)(q);function q(){return Object(U.a)(this,q),te.apply(this,arguments)}return Object(C.a)(q,[{key:"render",value:function(){return this.props.children}}]),q}(x.Component),d=x.createContext(null);function o(ce){var te=ce.children,q=ce.onBatchResize,oe=x.useRef(0),Z=x.useRef([]),D=x.useContext(d),h=x.useCallback(function(m,P,_){oe.current+=1;var A=oe.current;Z.current.push({size:m,element:P,data:_}),Promise.resolve().then(function(){A===oe.current&&(q==null||q(Z.current),Z.current=[])}),D==null||D(m,P,_)},[q,D]);return x.createElement(d.Provider,{value:h},te)}function f(ce){var te=ce.children,q=ce.disabled,oe=x.useRef(null),Z=x.useRef(null),D=x.useContext(d),h=x.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),m=x.isValidElement(te)&&Object(y.c)(te),P=m?te.ref:null,_=x.useMemo(function(){return Object(y.a)(P,oe)},[P,oe]),A=x.useRef(ce);A.current=ce;var Y=x.useCallback(function(ne){var ue=A.current,fe=ue.onResize,Ee=ue.data,we=ne.getBoundingClientRect(),Ae=we.width,De=we.height,se=ne.offsetWidth,pe=ne.offsetHeight,ge=Math.floor(Ae),xe=Math.floor(De);if(h.current.width!==ge||h.current.height!==xe||h.current.offsetWidth!==se||h.current.offsetHeight!==pe){var Te={width:ge,height:xe,offsetWidth:se,offsetHeight:pe};h.current=Te;var Se=se===Math.round(Ae)?Ae:se,ye=pe===Math.round(De)?De:pe,Le=Object(K.a)(Object(K.a)({},Te),{},{offsetWidth:Se,offsetHeight:ye});D==null||D(Le,ne,Ee),fe&&Promise.resolve().then(function(){fe(Le,ne)})}},[]);return x.useEffect(function(){var ne=Object(T.a)(oe.current)||Object(T.a)(Z.current);return ne&&!q&&s(ne,Y),function(){return a(ne,Y)}},[oe.current,q]),x.createElement(c,{ref:Z},m?x.cloneElement(te,{ref:_}):te)}var u="rc-observer-key";function i(ce){var te=ce.children,q=Object(R.a)(te);return q.map(function(oe,Z){var D=(oe==null?void 0:oe.key)||"".concat(u,"-").concat(Z);return x.createElement(f,Object(ve.a)({},ce,{key:D}),oe)})}i.Collection=o;var r=i,t=ie("bT9E"),n=ie("TSYQ"),g=ie.n(n),p=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important
`,S=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],k={},I;function G(ce){var te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,q=ce.getAttribute("id")||ce.getAttribute("data-reactid")||ce.getAttribute("name");if(te&&k[q])return k[q];var oe=window.getComputedStyle(ce),Z=oe.getPropertyValue("box-sizing")||oe.getPropertyValue("-moz-box-sizing")||oe.getPropertyValue("-webkit-box-sizing"),D=parseFloat(oe.getPropertyValue("padding-bottom"))+parseFloat(oe.getPropertyValue("padding-top")),h=parseFloat(oe.getPropertyValue("border-bottom-width"))+parseFloat(oe.getPropertyValue("border-top-width")),m=S.map(function(_){return"".concat(_,":").concat(oe.getPropertyValue(_))}).join(";"),P={sizingStyle:m,paddingSize:D,borderSize:h,boxSizing:Z};return te&&q&&(k[q]=P),P}function V(ce){var te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,oe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;I||(I=document.createElement("textarea"),I.setAttribute("tab-index","-1"),I.setAttribute("aria-hidden","true"),document.body.appendChild(I)),ce.getAttribute("wrap")?I.setAttribute("wrap",ce.getAttribute("wrap")):I.removeAttribute("wrap");var Z=G(ce,te),D=Z.paddingSize,h=Z.borderSize,m=Z.boxSizing,P=Z.sizingStyle;I.setAttribute("style","".concat(P,";").concat(p)),I.value=ce.value||ce.placeholder||"";var _=Number.MIN_SAFE_INTEGER,A=Number.MAX_SAFE_INTEGER,Y=I.scrollHeight,ne;if(m==="border-box"?Y+=h:m==="content-box"&&(Y-=D),q!==null||oe!==null){I.value=" ";var ue=I.scrollHeight-D;q!==null&&(_=ue*q,m==="border-box"&&(_=_+D+h),Y=Math.max(_,Y)),oe!==null&&(A=ue*oe,m==="border-box"&&(A=A+D+h),ne=Y>A?"":"hidden",Y=Math.min(A,Y))}return{height:Y,minHeight:_,maxHeight:A,overflowY:ne,resize:"none"}}var J=ie("Gytx"),re=ie.n(J),ee;(function(ce){ce[ce.NONE=0]="NONE",ce[ce.RESIZING=1]="RESIZING",ce[ce.RESIZED=2]="RESIZED"})(ee||(ee={}));var ae=function(ce){Object(j.a)(q,ce);var te=Object(O.a)(q);function q(oe){var Z;return Object(U.a)(this,q),Z=te.call(this,oe),Z.nextFrameActionId=void 0,Z.resizeFrameId=void 0,Z.textArea=void 0,Z.saveTextArea=function(D){Z.textArea=D},Z.handleResize=function(D){var h=Z.state.resizeStatus,m=Z.props,P=m.autoSize,_=m.onResize;if(h!==ee.NONE)return;typeof _=="function"&&_(D),P&&Z.resizeOnNextFrame()},Z.resizeOnNextFrame=function(){cancelAnimationFrame(Z.nextFrameActionId),Z.nextFrameActionId=requestAnimationFrame(Z.resizeTextarea)},Z.resizeTextarea=function(){var D=Z.props.autoSize;if(!D||!Z.textArea)return;var h=D.minRows,m=D.maxRows,P=V(Z.textArea,!1,h,m);Z.setState({textareaStyles:P,resizeStatus:ee.RESIZING},function(){cancelAnimationFrame(Z.resizeFrameId),Z.resizeFrameId=requestAnimationFrame(function(){Z.setState({resizeStatus:ee.RESIZED},function(){Z.resizeFrameId=requestAnimationFrame(function(){Z.setState({resizeStatus:ee.NONE}),Z.fixFirefoxAutoScroll()})})})})},Z.renderTextArea=function(){var D=Z.props,h=D.prefixCls,m=h===void 0?"rc-textarea":h,P=D.autoSize,_=D.onResize,A=D.className,Y=D.disabled,ne=Z.state,ue=ne.textareaStyles,fe=ne.resizeStatus,Ee=Object(t.a)(Z.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),we=g()(m,A,Object(M.a)({},"".concat(m,"-disabled"),Y));"value"in Ee&&(Ee.value=Ee.value||"");var Ae=Object(K.a)(Object(K.a)(Object(K.a)({},Z.props.style),ue),fe===ee.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return x.createElement(r,{onResize:Z.handleResize,disabled:!(P||_)},x.createElement("textarea",Object(ve.a)({},Ee,{className:we,style:Ae,ref:Z.saveTextArea})))},Z.state={textareaStyles:{},resizeStatus:ee.NONE},Z}return Object(C.a)(q,[{key:"componentDidUpdate",value:function(Z){(Z.value!==this.props.value||!re()(Z.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var Z=this.textArea.selectionStart,D=this.textArea.selectionEnd;this.textArea.setSelectionRange(Z,D)}}catch(h){}}},{key:"render",value:function(){return this.renderTextArea()}}]),q}(x.Component),be=ae,he=function(ce){Object(j.a)(q,ce);var te=Object(O.a)(q);function q(oe){var Z;Object(U.a)(this,q),Z=te.call(this,oe),Z.resizableTextArea=void 0,Z.focus=function(){Z.resizableTextArea.textArea.focus()},Z.saveTextArea=function(h){Z.resizableTextArea=h},Z.handleChange=function(h){var m=Z.props.onChange;Z.setValue(h.target.value,function(){Z.resizableTextArea.resizeTextarea()}),m&&m(h)},Z.handleKeyDown=function(h){var m=Z.props,P=m.onPressEnter,_=m.onKeyDown;h.keyCode===13&&P&&P(h),_&&_(h)};var D=typeof oe.value=="undefined"||oe.value===null?oe.defaultValue:oe.value;return Z.state={value:D},Z}return Object(C.a)(q,[{key:"setValue",value:function(Z,D){"value"in this.props||this.setState({value:Z},D)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return x.createElement(be,Object(ve.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(Z){return"value"in Z?{value:Z.value}:null}}]),q}(x.Component),me=Ie.default=he},bT9E:function(Ve,Ie,ie){"use strict";ie.d(Ie,"a",function(){return U});var ve=ie("VTBJ");function U(C,j){var O=Object(ve.a)({},C);return Array.isArray(j)&&j.forEach(function(x){delete O[x]}),O}},fAei:function(Ve,Ie,ie){"use strict";ie.d(Ie,"a",function(){return a.a});var ve=ie("rePB"),U=ie("VTBJ"),C=ie("KQm4"),j=ie("1OyB"),O=ie("vuIU"),x=ie("Ji7U"),K=ie("LK+K"),M=ie("q1tI"),R=ie("4IlW"),L=ie("Kwbf"),y=ie("TSYQ"),T=ie.n(y),w=ie("sboe"),E=ie("OZM5"),b=ie("815F"),v=ie("ODXe"),l=ie("Ff2n"),e=ie("+nKL"),s=ie("8XRh"),a=ie("WaYH"),c=function(me,ce){var te=me.className,q=me.style,oe=me.motion,Z=me.motionNodes,D=me.motionType,h=me.onMotionStart,m=me.onMotionEnd,P=me.active,_=me.treeNodeRequiredProps,A=Object(l.a)(me,["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"]),Y=M.useState(!0),ne=Object(v.a)(Y,2),ue=ne[0],fe=ne[1],Ee=M.useContext(w.a),we=Ee.prefixCls,Ae=M.useRef(!1),De=function(){Ae.current||m(),Ae.current=!0};return Object(M.useEffect)(function(){Z&&D==="hide"&&ue&&fe(!1)},[Z]),Object(M.useEffect)(function(){return Z&&h(),function(){Z&&De()}},[]),Z?M.createElement(s.default,Object.assign({ref:ce,visible:ue},oe,{motionAppear:D==="show",onAppearEnd:De,onLeaveEnd:De}),function(se,pe){var ge=se.className,xe=se.style;return M.createElement("div",{ref:pe,className:T()("".concat(we,"-treenode-motion"),ge),style:xe},Z.map(function(Te){var Se=Te.data,ye=Se.key,Le=Object(l.a)(Se,["key"]),Re=Te.isStart,z=Te.isEnd;delete Le.children;var N=Object(b.f)(ye,_);return M.createElement(a.a,Object.assign({},Le,N,{active:P,data:Te.data,key:ye,isStart:Re,isEnd:z}))}))}):M.createElement(a.a,Object.assign({domRef:ce,className:te,style:q},A,{active:P}))};c.displayName="MotionTreeNode";var d=M.forwardRef(c),o=d;function f(){var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],ce=he.length,te=me.length;if(Math.abs(ce-te)!==1)return{add:!1,key:null};function q(oe,Z){var D=new Map;oe.forEach(function(m){D.set(m,!0)});var h=Z.filter(function(m){return!D.has(m)});return h.length===1?h[0]:null}return ce<te?{add:!0,key:q(he,me)}:{add:!1,key:q(me,he)}}function u(he,me,ce){var te=he.findIndex(function(D){var h=D.data;return h.key===ce}),q=he[te+1],oe=me.findIndex(function(D){var h=D.data;return h.key===ce});if(q){var Z=me.findIndex(function(D){var h=D.data;return h.key===q.data.key});return me.slice(oe+1,Z)}return me.slice(oe+1)}var i={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},r=function(){},t="RC_TREE_MOTION_".concat(Math.random()),n={key:t},g={key:t,level:0,index:0,pos:"0",node:n},p={parent:null,children:[],pos:g.pos,data:n,isStart:[],isEnd:[]};function S(he,me,ce,te){return me===!1||!ce?he:he.slice(0,Math.ceil(ce/te)+1)}function k(he){var me=he.data.key,ce=he.pos;return Object(b.e)(me,ce)}function I(he){for(var me=String(he.data.key),ce=he;ce.parent;)ce=ce.parent,me="".concat(ce.data.key," > ").concat(me);return me}var G=function(me,ce){var te=me.prefixCls,q=me.data,oe=me.selectable,Z=me.checkable,D=me.expandedKeys,h=me.selectedKeys,m=me.checkedKeys,P=me.loadedKeys,_=me.loadingKeys,A=me.halfCheckedKeys,Y=me.keyEntities,ne=me.disabled,ue=me.dragging,fe=me.dragOverNodeKey,Ee=me.dropPosition,we=me.motion,Ae=me.height,De=me.itemHeight,se=me.virtual,pe=me.focusable,ge=me.activeItem,xe=me.focused,Te=me.tabIndex,Se=me.onKeyDown,ye=me.onFocus,Le=me.onBlur,Re=me.onActiveChange,z=me.onListChangeStart,N=me.onListChangeEnd,B=Object(l.a)(me,["prefixCls","data","selectable","checkable","expandedKeys","selectedKeys","checkedKeys","loadedKeys","loadingKeys","halfCheckedKeys","keyEntities","disabled","dragging","dragOverNodeKey","dropPosition","motion","height","itemHeight","virtual","focusable","activeItem","focused","tabIndex","onKeyDown","onFocus","onBlur","onActiveChange","onListChangeStart","onListChangeEnd"]),H=M.useRef(null);M.useImperativeHandle(ce,function(){return{scrollTo:function(ot){H.current.scrollTo(ot)}}});var X=M.useState(D),F=Object(v.a)(X,2),W=F[0],$=F[1],Q=M.useState(q),de=Object(v.a)(Q,2),le=de[0],Ce=de[1],Oe=M.useState(q),Me=Object(v.a)(Oe,2),Pe=Me[0],je=Me[1],Fe=M.useState([]),_e=Object(v.a)(Fe,2),qe=_e[0],ze=_e[1],Qe=M.useState(null),$e=Object(v.a)(Qe,2),He=$e[0],rt=$e[1];function it(){Ce(q),je(q),ze([]),rt(null),N()}M.useEffect(function(){$(D);var Ye=f(W,D);if(Ye.key!==null)if(Ye.add){var ot=le.findIndex(function(ke){var Ge=ke.data.key;return Ge===Ye.key}),tt=S(u(le,q,Ye.key),se,Ae,De),nt=le.slice();nt.splice(ot+1,0,p),je(nt),ze(tt),rt("show")}else{var ft=q.findIndex(function(ke){var Ge=ke.data.key;return Ge===Ye.key}),et=S(u(q,le,Ye.key),se,Ae,De),Be=q.slice();Be.splice(ft+1,0,p),je(Be),ze(et),rt("hide")}else le!==q&&(Ce(q),je(q))},[D,q]),M.useEffect(function(){ue||it()},[ue]);var Je=we?Pe:q,lt={expandedKeys:D,selectedKeys:h,loadedKeys:P,loadingKeys:_,checkedKeys:m,halfCheckedKeys:A,dragOverNodeKey:fe,dropPosition:Ee,keyEntities:Y};return M.createElement(M.Fragment,null,xe&&ge&&M.createElement("span",{style:i,"aria-live":"assertive"},I(ge)),M.createElement("div",{role:"tree"},M.createElement("input",{style:i,disabled:pe===!1||ne,tabIndex:pe!==!1?Te:null,onKeyDown:Se,onFocus:ye,onBlur:Le,value:"",onChange:r})),M.createElement(e.a,Object.assign({},B,{data:Je,itemKey:k,height:Ae,fullHeight:!1,virtual:se,itemHeight:De,prefixCls:"".concat(te,"-list"),ref:H}),function(Ye){var ot=Ye.pos,tt=Ye.data,nt=tt.key,ft=Object(l.a)(tt,["key"]),et=Ye.isStart,Be=Ye.isEnd,ke=Object(b.e)(nt,ot);delete ft.children;var Ge=Object(b.f)(ke,lt);return M.createElement(o,Object.assign({},ft,Ge,{active:ge&&nt===ge.data.key,pos:ot,data:Ye.data,isStart:et,isEnd:Be,motion:we,motionNodes:nt===t?qe:null,motionType:He,onMotionStart:z,onMotionEnd:it,treeNodeRequiredProps:lt,onMouseMove:function(){Re(null)}}))}))},V=M.forwardRef(G);V.displayName="NodeList";var J=V,re=ie("NvD2"),ee=function(he){Object(x.a)(ce,he);var me=Object(K.a)(ce);function ce(){var te;return Object(j.a)(this,ce),te=me.apply(this,arguments),te.destroyed=!1,te.state={keyEntities:{},selectedKeys:[],checkedKeys:[],halfCheckedKeys:[],loadedKeys:[],loadingKeys:[],expandedKeys:[],dragging:!1,dragNodesKeys:[],dragOverNodeKey:null,dropPosition:null,treeData:[],flattenNodes:[],focused:!1,activeKey:null,listChanging:!1,prevProps:null},te.listRef=M.createRef(),te.onNodeDragStart=function(q,oe){var Z=te.state,D=Z.expandedKeys,h=Z.keyEntities,m=te.props.onDragStart,P=oe.props.eventKey;te.dragNode=oe;var _=Object(E.b)(D,P);te.setState({dragging:!0,dragNodesKeys:Object(E.g)(P,h)}),te.setExpandedKeys(_),m&&m({event:q,node:Object(b.b)(oe.props)})},te.onNodeDragEnter=function(q,oe){var Z=te.state,D=Z.expandedKeys,h=Z.keyEntities,m=Z.dragNodesKeys,P=te.props.onDragEnter,_=oe.props,A=_.pos,Y=_.eventKey;if(!te.dragNode||m.indexOf(Y)!==-1)return;var ne=Object(E.c)(q,oe);if(te.dragNode.props.eventKey===Y&&ne===0){te.setState({dragOverNodeKey:"",dropPosition:null});return}setTimeout(function(){te.setState({dragOverNodeKey:Y,dropPosition:ne}),te.delayedDragEnterLogic||(te.delayedDragEnterLogic={}),Object.keys(te.delayedDragEnterLogic).forEach(function(ue){clearTimeout(te.delayedDragEnterLogic[ue])}),te.delayedDragEnterLogic[A]=window.setTimeout(function(){if(!te.state.dragging)return;var ue=Object(C.a)(D),fe=h[Y];fe&&(fe.children||[]).length&&(ue=Object(E.a)(D,Y)),"expandedKeys"in te.props||te.setExpandedKeys(ue),P&&P({event:q,node:Object(b.b)(oe.props),expandedKeys:ue})},400)},0)},te.onNodeDragOver=function(q,oe){var Z=te.state.dragNodesKeys,D=te.props.onDragOver,h=oe.props.eventKey;if(Z.indexOf(h)!==-1)return;if(te.dragNode&&h===te.state.dragOverNodeKey){var m=Object(E.c)(q,oe);if(m===te.state.dropPosition)return;te.setState({dropPosition:m})}D&&D({event:q,node:Object(b.b)(oe.props)})},te.onNodeDragLeave=function(q,oe){var Z=te.props.onDragLeave;te.setState({dragOverNodeKey:""}),Z&&Z({event:q,node:Object(b.b)(oe.props)})},te.onNodeDragEnd=function(q,oe){var Z=te.props.onDragEnd;te.setState({dragOverNodeKey:""}),te.cleanDragState(),Z&&Z({event:q,node:Object(b.b)(oe.props)}),te.dragNode=null},te.onNodeDrop=function(q,oe){var Z=te.state,D=Z.dragNodesKeys,h=D===void 0?[]:D,m=Z.dropPosition,P=te.props.onDrop,_=oe.props,A=_.eventKey,Y=_.pos;if(te.setState({dragOverNodeKey:""}),te.cleanDragState(),h.indexOf(A)!==-1){Object(L.a)(!1,"Can not drop to dragNode(include it's children node)");return}var ne=Object(E.k)(Y),ue={event:q,node:Object(b.b)(oe.props),dragNode:te.dragNode?Object(b.b)(te.dragNode.props):null,dragNodesKeys:h.slice(),dropPosition:m+Number(ne[ne.length-1]),dropToGap:!1};m!==0&&(ue.dropToGap=!0),P&&P(ue),te.dragNode=null},te.cleanDragState=function(){var q=te.state.dragging;q&&te.setState({dragging:!1})},te.onNodeClick=function(q,oe){var Z=te.props.onClick;Z&&Z(q,oe)},te.onNodeDoubleClick=function(q,oe){var Z=te.props.onDoubleClick;Z&&Z(q,oe)},te.onNodeSelect=function(q,oe){var Z=te.state.selectedKeys,D=te.state.keyEntities,h=te.props,m=h.onSelect,P=h.multiple,_=oe.selected,A=oe.key,Y=!_;Y?P?Z=Object(E.a)(Z,A):Z=[A]:Z=Object(E.b)(Z,A);var ne=Z.map(function(ue){var fe=D[ue];return fe?fe.node:null}).filter(function(ue){return ue});te.setUncontrolledState({selectedKeys:Z}),m&&m(Z,{event:"select",selected:Y,node:oe,selectedNodes:ne,nativeEvent:q.nativeEvent})},te.onNodeCheck=function(q,oe,Z){var D=te.state,h=D.keyEntities,m=D.checkedKeys,P=D.halfCheckedKeys,_=te.props,A=_.checkStrictly,Y=_.onCheck,ne=oe.key,ue,fe={event:"check",node:oe,checked:Z,nativeEvent:q.nativeEvent};if(A){var Ee=Z?Object(E.a)(m,ne):Object(E.b)(m,ne),we=Object(E.b)(P,ne);ue={checked:Ee,halfChecked:we},fe.checkedNodes=Ee.map(function(xe){return h[xe]}).filter(function(xe){return xe}).map(function(xe){return xe.node}),te.setUncontrolledState({checkedKeys:Ee})}else{var Ae=Object(re.a)([].concat(Object(C.a)(m),[ne]),!0,h),De=Ae.checkedKeys,se=Ae.halfCheckedKeys;if(!Z){var pe=new Set(De);pe.delete(ne);var ge=Object(re.a)(Array.from(pe),{checked:!1,halfCheckedKeys:se},h);De=ge.checkedKeys,se=ge.halfCheckedKeys}ue=De,fe.checkedNodes=[],fe.checkedNodesPositions=[],fe.halfCheckedKeys=se,De.forEach(function(xe){var Te=h[xe];if(!Te)return;var Se=Te.node,ye=Te.pos;fe.checkedNodes.push(Se),fe.checkedNodesPositions.push({node:Se,pos:ye})}),te.setUncontrolledState({checkedKeys:De},!1,{halfCheckedKeys:se})}Y&&Y(ue,fe)},te.onNodeLoad=function(q){return new Promise(function(oe){te.setState(function(Z){var D=Z.loadedKeys,h=D===void 0?[]:D,m=Z.loadingKeys,P=m===void 0?[]:m,_=te.props,A=_.loadData,Y=_.onLoad,ne=q.key;if(!A||h.indexOf(ne)!==-1||P.indexOf(ne)!==-1)return{};var ue=A(q);return ue.then(function(){var fe=te.state,Ee=fe.loadedKeys,we=fe.loadingKeys,Ae=Object(E.a)(Ee,ne),De=Object(E.b)(we,ne);Y&&Y(Ae,{event:"load",node:q}),te.setUncontrolledState({loadedKeys:Ae}),te.setState({loadingKeys:De}),oe()}),{loadingKeys:Object(E.a)(P,ne)}})})},te.onNodeMouseEnter=function(q,oe){var Z=te.props.onMouseEnter;Z&&Z({event:q,node:oe})},te.onNodeMouseLeave=function(q,oe){var Z=te.props.onMouseLeave;Z&&Z({event:q,node:oe})},te.onNodeContextMenu=function(q,oe){var Z=te.props.onRightClick;Z&&(q.preventDefault(),Z({event:q,node:oe}))},te.onFocus=function(){var q=te.props.onFocus;te.setState({focused:!0}),q&&q.apply(void 0,arguments)},te.onBlur=function(){var q=te.props.onBlur;te.setState({focused:!1}),te.onActiveChange(null),q&&q.apply(void 0,arguments)},te.getTreeNodeRequiredProps=function(){var q=te.state,oe=q.expandedKeys,Z=q.selectedKeys,D=q.loadedKeys,h=q.loadingKeys,m=q.checkedKeys,P=q.halfCheckedKeys,_=q.dragOverNodeKey,A=q.dropPosition,Y=q.keyEntities;return{expandedKeys:oe||[],selectedKeys:Z||[],loadedKeys:D||[],loadingKeys:h||[],checkedKeys:m||[],halfCheckedKeys:P||[],dragOverNodeKey:_,dropPosition:A,keyEntities:Y}},te.setExpandedKeys=function(q){var oe=te.state.treeData,Z=Object(b.d)(oe,q);te.setUncontrolledState({expandedKeys:q,flattenNodes:Z},!0)},te.onNodeExpand=function(q,oe){var Z=te.state.expandedKeys,D=te.state.listChanging,h=te.props,m=h.onExpand,P=h.loadData,_=oe.key,A=oe.expanded;if(D)return;var Y=Z.indexOf(_),ne=!A;if(Object(L.a)(A&&Y!==-1||!A&&Y===-1,"Expand state not sync with index check"),ne?Z=Object(E.a)(Z,_):Z=Object(E.b)(Z,_),te.setExpandedKeys(Z),m&&m(Z,{node:oe,expanded:ne,nativeEvent:q.nativeEvent}),ne&&P){var ue=te.onNodeLoad(oe);ue&&ue.then(function(){var fe=Object(b.d)(te.state.treeData,Z);te.setUncontrolledState({flattenNodes:fe})})}},te.onListChangeStart=function(){te.setUncontrolledState({listChanging:!0})},te.onListChangeEnd=function(){setTimeout(function(){te.setUncontrolledState({listChanging:!1})})},te.onActiveChange=function(q){var oe=te.state.activeKey,Z=te.props.onActiveChange;if(oe===q)return;te.setState({activeKey:q}),q!==null&&te.scrollTo({key:q}),Z&&Z(q)},te.getActiveItem=function(){var q=te.state,oe=q.activeKey,Z=q.flattenNodes;return oe===null?null:Z.find(function(D){var h=D.data.key;return h===oe})||null},te.offsetActiveKey=function(q){var oe=te.state,Z=oe.flattenNodes,D=oe.activeKey,h=Z.findIndex(function(_){var A=_.data.key;return A===D});h===-1&&q<0&&(h=Z.length),h=(h+q+Z.length)%Z.length;var m=Z[h];if(m){var P=m.data.key;te.onActiveChange(P)}else te.onActiveChange(null)},te.onKeyDown=function(q){var oe=te.state,Z=oe.activeKey,D=oe.expandedKeys,h=oe.checkedKeys,m=te.props,P=m.onKeyDown,_=m.checkable,A=m.selectable;switch(q.which){case R.a.UP:{te.offsetActiveKey(-1),q.preventDefault();break}case R.a.DOWN:{te.offsetActiveKey(1),q.preventDefault();break}}var Y=te.getActiveItem();if(Y&&Y.data){var ne=te.getTreeNodeRequiredProps(),ue=Y.data.isLeaf===!1||!!(Y.data.children||[]).length,fe=Object(b.b)(Object(U.a)(Object(U.a)({},Object(b.f)(Z,ne)),{},{data:Y.data,active:!0}));switch(q.which){case R.a.LEFT:{ue&&D.includes(Z)?te.onNodeExpand({},fe):Y.parent&&te.onActiveChange(Y.parent.data.key),q.preventDefault();break}case R.a.RIGHT:{ue&&!D.includes(Z)?te.onNodeExpand({},fe):Y.children&&Y.children.length&&te.onActiveChange(Y.children[0].data.key),q.preventDefault();break}case R.a.ENTER:case R.a.SPACE:{_&&!fe.disabled&&fe.checkable!==!1&&!fe.disableCheckbox?te.onNodeCheck({},fe,!h.includes(Z)):!_&&A&&!fe.disabled&&fe.selectable!==!1&&te.onNodeSelect({},fe);break}}}P&&P(q)},te.setUncontrolledState=function(q){var oe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(te.destroyed)return;var D=!1,h=!0,m={};Object.keys(q).forEach(function(P){if(P in te.props){h=!1;return}D=!0,m[P]=q[P]}),D&&(!oe||h)&&te.setState(Object(U.a)(Object(U.a)({},m),Z))},te.scrollTo=function(q){te.listRef.current.scrollTo(q)},te}return Object(O.a)(ce,[{key:"componentWillUnmount",value:function(){this.destroyed=!0}},{key:"render",value:function(){var q,oe=this.state,Z=oe.focused,D=oe.flattenNodes,h=oe.keyEntities,m=oe.dragging,P=oe.activeKey,_=this.props,A=_.prefixCls,Y=_.className,ne=_.style,ue=_.showLine,fe=_.focusable,Ee=_.tabIndex,we=Ee===void 0?0:Ee,Ae=_.selectable,De=_.showIcon,se=_.icon,pe=_.switcherIcon,ge=_.draggable,xe=_.checkable,Te=_.checkStrictly,Se=_.disabled,ye=_.motion,Le=_.loadData,Re=_.filterTreeNode,z=_.height,N=_.itemHeight,B=_.virtual,H=_.titleRender,X=_.onContextMenu,F=Object(E.f)(this.props);return M.createElement(w.a.Provider,{value:{prefixCls:A,selectable:Ae,showIcon:De,icon:se,switcherIcon:pe,draggable:ge,checkable:xe,checkStrictly:Te,disabled:Se,keyEntities:h,loadData:Le,filterTreeNode:Re,titleRender:H,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop}},M.createElement("div",{className:T()(A,Y,(q={},Object(ve.a)(q,"".concat(A,"-show-line"),ue),Object(ve.a)(q,"".concat(A,"-focused"),Z),Object(ve.a)(q,"".concat(A,"-active-focused"),P!==null),q))},M.createElement(J,Object.assign({ref:this.listRef,prefixCls:A,style:ne,data:D,disabled:Se,selectable:Ae,checkable:!!xe,motion:ye,dragging:m,height:z,itemHeight:N,virtual:B,focusable:fe,focused:Z,tabIndex:we,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:X},this.getTreeNodeRequiredProps(),F))))}}],[{key:"getDerivedStateFromProps",value:function(q,oe){var Z=oe.prevProps,D={prevProps:q};function h(se){return!Z&&se in q||Z&&Z[se]!==q[se]}var m;if(h("treeData")?m=q.treeData:h("children")&&(Object(L.a)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),m=Object(b.c)(q.children)),m){D.treeData=m;var P=Object(b.a)(m);D.keyEntities=Object(U.a)(Object(ve.a)({},t,g),P.keyEntities)}var _=D.keyEntities||oe.keyEntities;if(h("expandedKeys")||Z&&h("autoExpandParent"))D.expandedKeys=q.autoExpandParent||!Z&&q.defaultExpandParent?Object(E.e)(q.expandedKeys,_):q.expandedKeys;else if(!Z&&q.defaultExpandAll){var A=Object(U.a)({},_);delete A[t],D.expandedKeys=Object.keys(A).map(function(se){return A[se].key})}else!Z&&q.defaultExpandedKeys&&(D.expandedKeys=q.autoExpandParent||q.defaultExpandParent?Object(E.e)(q.defaultExpandedKeys,_):q.defaultExpandedKeys);if(D.expandedKeys||delete D.expandedKeys,m||D.expandedKeys){var Y=Object(b.d)(m||oe.treeData,D.expandedKeys||oe.expandedKeys);D.flattenNodes=Y}if(q.selectable&&(h("selectedKeys")?D.selectedKeys=Object(E.d)(q.selectedKeys,q):!Z&&q.defaultSelectedKeys&&(D.selectedKeys=Object(E.d)(q.defaultSelectedKeys,q))),q.checkable){var ne;if(h("checkedKeys")?ne=Object(E.j)(q.checkedKeys)||{}:!Z&&q.defaultCheckedKeys?ne=Object(E.j)(q.defaultCheckedKeys)||{}:m&&(ne=Object(E.j)(q.checkedKeys)||{checkedKeys:oe.checkedKeys,halfCheckedKeys:oe.halfCheckedKeys}),ne){var ue=ne,fe=ue.checkedKeys,Ee=fe===void 0?[]:fe,we=ue.halfCheckedKeys,Ae=we===void 0?[]:we;if(!q.checkStrictly){var De=Object(re.a)(Ee,!0,_);Ee=De.checkedKeys,Ae=De.halfCheckedKeys}D.checkedKeys=Ee,D.halfCheckedKeys=Ae}}return h("loadedKeys")&&(D.loadedKeys=q.loadedKeys),D}}]),ce}(M.Component);ee.defaultProps={prefixCls:"rc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[]},ee.TreeNode=a.a;var ae=ee,be=Ie.b=ae},p5ED:function(Ve,Ie,ie){"use strict";var ve=ie("+L6B"),U=ie("2/Rp"),C=ie("5Dmo"),j=ie("3S7+"),O=ie("k1fw"),x=ie("9og8"),K=ie("tJVT"),M=ie("WmNS"),R=ie.n(M),L=ie("q1tI"),y=ie.n(L),T=ie("vHTk"),w=ie.n(T),E=ie("yEEn"),b=ie("ZW9T"),v=ie("1vsH"),l=ie("V0Rq"),e=ie("m3rI");Ie.a=function(s){var a,c,d,o,f,u,i,r=s.editOffice,t=r===void 0?"view":r,n=s.data,g=s.theme,p=s.type,S=s.filename,k=s.monacoEditor,I=s.className,G=s.style,V=s.close,J=s.onClose,re=s.hasMask,ee=s.disabledDownload,ae=Object(L.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),be=Object(K.a)(ae,2),he=be[0],me=be[1],ce=Object(L.useState)(""),te=Object(K.a)(ce,2),q=te[0],oe=te[1],Z=Object(L.useState)(),D=Object(K.a)(Z,2),h=D[0],m=D[1],P=window.ENV==="build"?"/react/build":"",_=e.a.PROXY_SERVER||location.origin,A,Y=1024*1024,ne=10*Y,ue=Object(L.useRef)();(a=n)!==null&&a!==void 0&&a.startsWith("/api")&&p!=="txt"&&(n=(e.a.API_SERVER||location.origin)+n),p==="office"&&(A=Object(v.T)(n).filesize,A>ne&&(p="other")),S&&k&&(k.filename=S),Object(L.useEffect)(function(){var Ae,De,se=(Ae=document.cookie)===null||Ae===void 0||((De=Ae.replace(/\s/g,""))===null||De===void 0)?void 0:De.split(";");se==null||se.map(function(pe){var ge=pe.split("=");ge[0]==="_educoder_session"&&oe(ge[1])})},[]),Object(L.useEffect)(function(){p==="office"&&fe()},[p,n]);var fe=function(){var Ae=Object(x.a)(R.a.mark(function De(){var se,pe,ge;return R.a.wrap(function(Te){for(;;)switch(Te.prev=Te.next){case 0:return console.log("data:",n),se=n,n.startsWith("http")||(se=location.origin+se),pe=new URL(se).pathname.split("/").pop(),Te.next=6,Object(l.V)({attachment_id:pe});case 6:ge=Te.sent,m(ge);case 8:case"end":return Te.stop()}},De)}));return function(){return Ae.apply(this,arguments)}}(),Ee=function(){if(n.startsWith("http")||n.startsWith("blob:")){we();return}Object(v.z)(S||"educoder",n,S)},we=function(){Object(v.x)(S||"educoder",decodeURIComponent(n))};return y.a.createElement("div",{style:Object(O.a)({},G||{}),className:"".concat(re&&w.a.bgBlack," ").concat(p?w.a.wrp:"hide")},V&&y.a.createElement("div",{className:w.a.close,ref:ue},!ee&&y.a.createElement(j.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return ue.current}},y.a.createElement("span",{onClick:we},y.a.createElement("i",{className:"icon-quxiaozhiding"}))),y.a.createElement(j.a,{title:"\u5173\u95ED",getPopupContainer:function(){return ue.current}},y.a.createElement("span",{className:"",onClick:J},y.a.createElement("i",{className:"icon-guanbi1"})))),y.a.createElement("div",{className:"".concat(w.a[I]," ").concat(I," ").concat(w.a.monaco," ").concat(p==="txt"?"show":"hide")},p==="txt"&&y.a.createElement(b.b,k)),p==="audio"&&y.a.createElement("audio",{src:"".concat(((c=n)===null||c===void 0?void 0:c.indexOf("http://"))>-1||((d=n)===null||d===void 0?void 0:d.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(n),autoPlay:!0}),p==="video"&&y.a.createElement(y.a.Fragment,null,((o=n)===null||o===void 0?void 0:o.indexOf("http"))>-1?y.a.createElement("video",{controls:!0,src:"".concat(n),autoPlay:!0}):y.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(n),autoPlay:!0})),p==="office"&&h&&y.a.createElement("iframe",{src:"".concat(P,"/office.html?key=").concat(h.key,"&url=").concat(_+h.url,"&callbackUrl=").concat(_+h.callbackUrl,"&fileType=").concat(h.fileType,"&title=").concat(h.title,"&model=").concat(t,"&officeServer=").concat(e.a.OFFICE_SERVER,"&disabledDownload=").concat(!!ee)}),p==="html"&&y.a.createElement("iframe",{src:n+"&disposition=inline"}),p==="pdf"&&y.a.createElement("iframe",{src:"".concat(P,"/js/pdfview/index.html?url=").concat(n,"&disabledDownload=").concat(!!ee)}),p==="image"&&y.a.createElement("img",{src:"".concat(((f=n)===null||f===void 0?void 0:f.indexOf("http://"))>-1||((u=n)===null||u===void 0?void 0:u.indexOf("https://"))>-1||(i=n)!==null&&i!==void 0&&i.startsWith("/api")?"":"data:image/png;base64,").concat(n)}),p==="other"&&y.a.createElement("div",null,y.a.createElement(U.a,{type:"primary",size:"large",onClick:Ee},y.a.createElement(E.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),p==="download"&&y.a.createElement(U.a,{type:"primary",size:"large",onClick:Ee},y.a.createElement(E.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},rUJ1:function(Ve,Ie){const ie=/[&<>"']/,ve=/[&<>"']/g,U=/[<>"']|&(?!#?\w+;)/,C=/[<>"']|&(?!#?\w+;)/g,j={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},O=u=>j[u];function x(u,i){if(i){if(ie.test(u))return u.replace(ve,O)}else if(U.test(u))return u.replace(C,O);return u}const K=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function M(u){return u.replace(K,(i,r)=>(r=r.toLowerCase(),r==="colon"?":":r.charAt(0)==="#"?r.charAt(1)==="x"?String.fromCharCode(parseInt(r.substring(2),16)):String.fromCharCode(+r.substring(1)):""))}const R=/(^|[^\[])\^/g;function L(u,i){u=u.source||u,i=i||"";const r={replace:(t,n)=>(n=n.source||n,n=n.replace(R,"$1"),u=u.replace(t,n),r),getRegex:()=>new RegExp(u,i)};return r}const y=/[^\w:]/g,T=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function w(u,i,r){if(u){let t;try{t=decodeURIComponent(M(r)).replace(y,"").toLowerCase()}catch(n){return null}if(t.indexOf("javascript:")===0||t.indexOf("vbscript:")===0||t.indexOf("data:")===0)return null}i&&!T.test(r)&&(r=e(i,r));try{r=encodeURI(r).replace(/%25/g,"%")}catch(t){return null}return r}const E={},b=/^[^:]+:\/*[^/]*$/,v=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function e(u,i){E[" "+u]||(b.test(u)?E[" "+u]=u+"/":E[" "+u]=d(u,"/",!0)),u=E[" "+u];const r=u.indexOf(":")===-1;return i.substring(0,2)==="//"?r?i:u.replace(v,"$1")+i:i.charAt(0)==="/"?r?i:u.replace(l,"$1")+i:u+i}const s={exec:function(){}};function a(u){let i=1,r,t;for(;i<arguments.length;i++){r=arguments[i];for(t in r)Object.prototype.hasOwnProperty.call(r,t)&&(u[t]=r[t])}return u}function c(u,i){const r=u.replace(/\|/g,(g,p,S)=>{let k=!1,I=p;for(;--I>=0&&S[I]==="\\";)k=!k;return k?"|":" |"}),t=r.split(/ \|/);let n=0;if(t.length>i)t.splice(i);else for(;t.length<i;)t.push("");for(;n<t.length;n++)t[n]=t[n].trim().replace(/\\\|/g,"|");return t}function d(u,i,r){const t=u.length;if(t===0)return"";let n=0;for(;n<t;){const g=u.charAt(t-n-1);if(g===i&&!r)n++;else if(g!==i&&r)n++;else break}return u.substr(0,t-n)}function o(u,i){if(u.indexOf(i[1])===-1)return-1;const r=u.length;let t=0,n=0;for(;n<r;n++)if(u[n]==="\\")n++;else if(u[n]===i[0])t++;else if(u[n]===i[1]&&(t--,t<0))return n;return-1}function f(u){u&&u.sanitize&&!u.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}Ve.exports={escape:x,unescape:M,edit:L,cleanUrl:w,resolveUrl:e,noopTest:s,merge:a,splitCells:c,rtrim:d,findClosingBracket:o,checkSanitizeDeprecation:f}},sboe:function(Ve,Ie,ie){"use strict";ie.d(Ie,"a",function(){return C});var ve=ie("q1tI"),U=ie.n(ve),C=ve.createContext(null)},ulZh:function(Ve,Ie,ie){typeof window!="undefined"&&function(U,C){Ve.exports=C()}(this,function(){return function(ve){var U={};function C(j){if(U[j])return U[j].exports;var O=U[j]={i:j,l:!1,exports:{}};return ve[j].call(O.exports,O,O.exports,C),O.l=!0,O.exports}return C.m=ve,C.c=U,C.d=function(j,O,x){C.o(j,O)||Object.defineProperty(j,O,{enumerable:!0,get:x})},C.r=function(j){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(j,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(j,"__esModule",{value:!0})},C.t=function(j,O){if(O&1&&(j=C(j)),O&8)return j;if(O&4&&typeof j=="object"&&j&&j.__esModule)return j;var x=Object.create(null);if(C.r(x),Object.defineProperty(x,"default",{enumerable:!0,value:j}),O&2&&typeof j!="string")for(var K in j)C.d(x,K,function(M){return j[M]}.bind(null,K));return x},C.n=function(j){var O=j&&j.__esModule?function(){return j.default}:function(){return j};return C.d(O,"a",O),O},C.o=function(j,O){return Object.prototype.hasOwnProperty.call(j,O)},C.p="/dist/",C(C.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ve,U,C){"use strict";var j=Object.prototype.hasOwnProperty,O="~";function x(){}Object.create&&(x.prototype=Object.create(null),new x().__proto__||(O=!1));function K(y,T,w){this.fn=y,this.context=T,this.once=w||!1}function M(y,T,w,E,b){if(typeof w!="function")throw new TypeError("The listener must be a function");var v=new K(w,E||y,b),l=O?O+T:T;return y._events[l]?y._events[l].fn?y._events[l]=[y._events[l],v]:y._events[l].push(v):(y._events[l]=v,y._eventsCount++),y}function R(y,T){--y._eventsCount===0?y._events=new x:delete y._events[T]}function L(){this._events=new x,this._eventsCount=0}L.prototype.eventNames=function(){var T=[],w,E;if(this._eventsCount===0)return T;for(E in w=this._events)j.call(w,E)&&T.push(O?E.slice(1):E);return Object.getOwnPropertySymbols?T.concat(Object.getOwnPropertySymbols(w)):T},L.prototype.listeners=function(T){var w=O?O+T:T,E=this._events[w];if(!E)return[];if(E.fn)return[E.fn];for(var b=0,v=E.length,l=new Array(v);b<v;b++)l[b]=E[b].fn;return l},L.prototype.listenerCount=function(T){var w=O?O+T:T,E=this._events[w];return E?E.fn?1:E.length:0},L.prototype.emit=function(T,w,E,b,v,l){var e=O?O+T:T;if(!this._events[e])return!1;var s=this._events[e],a=arguments.length,c,d;if(s.fn){s.once&&this.removeListener(T,s.fn,void 0,!0);switch(a){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,w),!0;case 3:return s.fn.call(s.context,w,E),!0;case 4:return s.fn.call(s.context,w,E,b),!0;case 5:return s.fn.call(s.context,w,E,b,v),!0;case 6:return s.fn.call(s.context,w,E,b,v,l),!0}for(d=1,c=new Array(a-1);d<a;d++)c[d-1]=arguments[d];s.fn.apply(s.context,c)}else{var o=s.length,f;for(d=0;d<o;d++){s[d].once&&this.removeListener(T,s[d].fn,void 0,!0);switch(a){case 1:s[d].fn.call(s[d].context);break;case 2:s[d].fn.call(s[d].context,w);break;case 3:s[d].fn.call(s[d].context,w,E);break;case 4:s[d].fn.call(s[d].context,w,E,b);break;default:if(!c)for(f=1,c=new Array(a-1);f<a;f++)c[f-1]=arguments[f];s[d].fn.apply(s[d].context,c)}}}return!0},L.prototype.on=function(T,w,E){return M(this,T,w,E,!1)},L.prototype.once=function(T,w,E){return M(this,T,w,E,!0)},L.prototype.removeListener=function(T,w,E,b){var v=O?O+T:T;if(!this._events[v])return this;if(!w)return R(this,v),this;var l=this._events[v];if(l.fn)l.fn===w&&(!b||l.once)&&(!E||l.context===E)&&R(this,v);else{for(var e=0,s=[],a=l.length;e<a;e++)(l[e].fn!==w||b&&!l[e].once||E&&l[e].context!==E)&&s.push(l[e]);s.length?this._events[v]=s.length===1?s[0]:s:R(this,v)}return this},L.prototype.removeAllListeners=function(T){var w;return T?(w=O?O+T:T,this._events[w]&&R(this,w)):(this._events=new x,this._eventsCount=0),this},L.prototype.off=L.prototype.removeListener,L.prototype.addListener=L.prototype.on,L.prefixed=O,L.EventEmitter=L,ve.exports=L},"./node_modules/url-toolkit/src/url-toolkit.js":function(ve,U,C){(function(j){var O=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,x=/^([^\/?#]*)([^]*)$/,K=/(?:\/|^)\.(?=\/)/g,M=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,R={buildAbsoluteURL:function(L,y,T){if(T=T||{},L=L.trim(),y=y.trim(),!y){if(!T.alwaysNormalize)return L;var w=R.parseURL(L);if(!w)throw new Error("Error trying to parse base URL.");return w.path=R.normalizePath(w.path),R.buildURLFromParts(w)}var E=R.parseURL(y);if(!E)throw new Error("Error trying to parse relative URL.");if(E.scheme)return T.alwaysNormalize?(E.path=R.normalizePath(E.path),R.buildURLFromParts(E)):y;var b=R.parseURL(L);if(!b)throw new Error("Error trying to parse base URL.");if(!b.netLoc&&b.path&&b.path[0]!=="/"){var v=x.exec(b.path);b.netLoc=v[1],b.path=v[2]}b.netLoc&&!b.path&&(b.path="/");var l={scheme:b.scheme,netLoc:E.netLoc,path:null,params:E.params,query:E.query,fragment:E.fragment};if(!E.netLoc&&(l.netLoc=b.netLoc,E.path[0]!=="/"))if(!E.path)l.path=b.path,E.params||(l.params=b.params,E.query||(l.query=b.query));else{var e=b.path,s=e.substring(0,e.lastIndexOf("/")+1)+E.path;l.path=R.normalizePath(s)}return l.path===null&&(l.path=T.alwaysNormalize?R.normalizePath(E.path):E.path),R.buildURLFromParts(l)},parseURL:function(L){var y=O.exec(L);return y?{scheme:y[1]||"",netLoc:y[2]||"",path:y[3]||"",params:y[4]||"",query:y[5]||"",fragment:y[6]||""}:null},normalizePath:function(L){for(L=L.split("").reverse().join("").replace(K,"");L.length!==(L=L.replace(M,"")).length;);return L.split("").reverse().join("")},buildURLFromParts:function(L){return L.scheme+L.netLoc+L.path+L.params+L.query+L.fragment}};ve.exports=R})(this)},"./node_modules/webworkify-webpack/index.js":function(ve,U,C){function j(T){var w={};function E(v){if(w[v])return w[v].exports;var l=w[v]={i:v,l:!1,exports:{}};return T[v].call(l.exports,l,l.exports,E),l.l=!0,l.exports}E.m=T,E.c=w,E.i=function(v){return v},E.d=function(v,l,e){E.o(v,l)||Object.defineProperty(v,l,{configurable:!1,enumerable:!0,get:e})},E.r=function(v){Object.defineProperty(v,"__esModule",{value:!0})},E.n=function(v){var l=v&&v.__esModule?function(){return v.default}:function(){return v};return E.d(l,"a",l),l},E.o=function(v,l){return Object.prototype.hasOwnProperty.call(v,l)},E.p="/",E.oe=function(v){throw console.error(v),v};var b=E(E.s=ENTRY_MODULE);return b.default||b}var O="[\\.|\\-|\\+|\\w|/|@]+",x="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+O+").*?\\)";function K(T){return(T+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function M(T){return!isNaN(1*T)}function R(T,w,E){var b={};b[E]=[];var v=w.toString(),l=v.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!l)return b;for(var e=l[1],s=new RegExp("(\\\\n|\\W)"+K(e)+x,"g"),a;a=s.exec(v);){if(a[3]==="dll-reference")continue;b[E].push(a[3])}for(s=new RegExp("\\("+K(e)+'\\("(dll-reference\\s('+O+'))"\\)\\)'+x,"g");a=s.exec(v);)T[a[2]]||(b[E].push(a[1]),T[a[2]]=C(a[1]).m),b[a[2]]=b[a[2]]||[],b[a[2]].push(a[4]);for(var c=Object.keys(b),d=0;d<c.length;d++)for(var o=0;o<b[c[d]].length;o++)M(b[c[d]][o])&&(b[c[d]][o]=1*b[c[d]][o]);return b}function L(T){var w=Object.keys(T);return w.reduce(function(E,b){return E||T[b].length>0},!1)}function y(T,w){for(var E={main:[w]},b={main:[]},v={main:{}};L(E);)for(var l=Object.keys(E),e=0;e<l.length;e++){var s=l[e],a=E[s],c=a.pop();if(v[s]=v[s]||{},v[s][c]||!T[s][c])continue;v[s][c]=!0,b[s]=b[s]||[],b[s].push(c);for(var d=R(T,T[s][c],s),o=Object.keys(d),f=0;f<o.length;f++)E[o[f]]=E[o[f]]||[],E[o[f]]=E[o[f]].concat(d[o[f]])}return b}ve.exports=function(T,w){w=w||{};var E={main:C.m},b=w.all?{main:Object.keys(E.main)}:y(E,T),v="";Object.keys(b).filter(function(c){return c!=="main"}).forEach(function(c){for(var d=0;b[c][d];)d++;b[c].push(d),E[c][d]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",v=v+"var "+c+" = ("+j.toString().replace("ENTRY_MODULE",JSON.stringify(d))+")({"+b[c].map(function(o){return""+JSON.stringify(o)+": "+E[c][o].toString()}).join(",")+`});
`}),v=v+"new (("+j.toString().replace("ENTRY_MODULE",JSON.stringify(T))+")({"+b.main.map(function(c){return""+JSON.stringify(c)+": "+E.main[c].toString()}).join(",")+"}))(self);";var l=new window.Blob([v],{type:"text/javascript"});if(w.bare)return l;var e=window.URL||window.webkitURL||window.mozURL||window.msURL,s=e.createObjectURL(l),a=new window.Worker(s);return a.objectURL=s,a}},"./src/config.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"hlsDefaultConfig",function(){return f}),C.d(U,"mergeConfig",function(){return i}),C.d(U,"enableStreamingMode",function(){return r});var j=C("./src/controller/abr-controller.ts"),O=C("./src/controller/audio-stream-controller.ts"),x=C("./src/controller/audio-track-controller.ts"),K=C("./src/controller/subtitle-stream-controller.ts"),M=C("./src/controller/subtitle-track-controller.ts"),R=C("./src/controller/buffer-controller.ts"),L=C("./src/controller/timeline-controller.ts"),y=C("./src/controller/cap-level-controller.ts"),T=C("./src/controller/fps-controller.ts"),w=C("./src/controller/eme-controller.ts"),E=C("./src/controller/cmcd-controller.ts"),b=C("./src/utils/xhr-loader.ts"),v=C("./src/utils/fetch-loader.ts"),l=C("./src/utils/cues.ts"),e=C("./src/utils/mediakeys-helper.ts"),s=C("./src/utils/logger.ts");function a(){return a=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var g=arguments[n];for(var p in g)Object.prototype.hasOwnProperty.call(g,p)&&(t[p]=g[p])}return t},a.apply(this,arguments)}function c(t,n){var g=Object.keys(t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(t);n&&(p=p.filter(function(S){return Object.getOwnPropertyDescriptor(t,S).enumerable})),g.push.apply(g,p)}return g}function d(t){for(var n=1;n<arguments.length;n++){var g=arguments[n]!=null?arguments[n]:{};n%2?c(Object(g),!0).forEach(function(p){o(t,p,g[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(g)):c(Object(g)).forEach(function(p){Object.defineProperty(t,p,Object.getOwnPropertyDescriptor(g,p))})}return t}function o(t,n,g){return n in t?Object.defineProperty(t,n,{value:g,enumerable:!0,configurable:!0,writable:!0}):t[n]=g,t}var f=d(d({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:b.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:j.default,bufferController:R.default,capLevelController:y.default,fpsController:T.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:e.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},u()),{},{subtitleStreamController:K.SubtitleStreamController,subtitleTrackController:M.default,timelineController:L.TimelineController,audioStreamController:O.default,audioTrackController:x.default,emeController:w.default,cmcdController:E.default});function u(){return{cueHandler:l.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function i(t,n){if((n.liveSyncDurationCount||n.liveMaxLatencyDurationCount)&&(n.liveSyncDuration||n.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(n.liveMaxLatencyDurationCount!==void 0&&(n.liveSyncDurationCount===void 0||n.liveMaxLatencyDurationCount<=n.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(n.liveMaxLatencyDuration!==void 0&&(n.liveSyncDuration===void 0||n.liveMaxLatencyDuration<=n.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return a({},t,n)}function r(t){var n=t.loader;if(n!==v.default&&n!==b.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),t.progressive=!1;else{var g=Object(v.fetchSupported)();g&&(t.loader=v.default,t.progressive=!0,t.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ve,U,C){"use strict";C.r(U);var j=C("./src/polyfills/number.ts"),O=C("./src/utils/ewma-bandwidth-estimator.ts"),x=C("./src/events.ts"),K=C("./src/utils/buffer-helper.ts"),M=C("./src/errors.ts"),R=C("./src/types/loader.ts"),L=C("./src/utils/logger.ts");function y(E,b){for(var v=0;v<b.length;v++){var l=b[v];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(E,l.key,l)}}function T(E,b,v){return b&&y(E.prototype,b),v&&y(E,v),E}var w=function(){function E(v){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=v;var l=v.config;this.bwEstimator=new O.default(l.abrEwmaSlowVoD,l.abrEwmaFastVoD,l.abrEwmaDefaultEstimate),this.registerListeners()}var b=E.prototype;return b.registerListeners=function(){var l=this.hls;l.on(x.Events.FRAG_LOADING,this.onFragLoading,this),l.on(x.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(x.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.on(x.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(x.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var l=this.hls;l.off(x.Events.FRAG_LOADING,this.onFragLoading,this),l.off(x.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(x.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.off(x.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(x.Events.ERROR,this.onError,this)},b.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},b.onFragLoading=function(l,e){var s=e.frag;if(s.type===R.PlaylistLevelType.MAIN&&!this.timer){var a;this.fragCurrent=s,this.partCurrent=(a=e.part)!=null?a:null,this.timer=self.setInterval(this.onCheck,100)}},b.onLevelLoaded=function(l,e){var s=this.hls.config;e.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},b._abandonRulesCheck=function(){var l=this.fragCurrent,e=this.partCurrent,s=this.hls,a=s.autoLevelEnabled,c=s.config,d=s.media;if(!l||!d)return;var o=e?e.stats:l.stats,f=e?e.duration:l.duration;if(o.aborted){L.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!a||d.paused||!d.playbackRate||!d.readyState)return;var u=performance.now()-o.loading.start,i=Math.abs(d.playbackRate);if(u<=500*f/i)return;var r=s.levels,t=s.minAutoLevel,n=r[l.level],g=o.total||Math.max(o.loaded,Math.round(f*n.maxBitrate/8)),p=Math.max(1,o.bwEstimate?o.bwEstimate/8:o.loaded*1e3/u),S=(g-o.loaded)/p,k=d.currentTime,I=(K.BufferHelper.bufferInfo(d,k,c.maxBufferHole).end-k)/i;if(I>=2*f/i||S<=I)return;var G=Number.POSITIVE_INFINITY,V;for(V=l.level-1;V>t;V--){var J=r[V].maxBitrate;if(G=f*J/(8*.8*p),G<I)break}if(G>=S)return;var re=this.bwEstimator.getEstimate();L.logger.warn("Fragment "+l.sn+(e?" part "+e.index:"")+" of level "+l.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+`
Current BW estimate: `+(Object(j.isFiniteNumber)(re)?(re/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+S.toFixed(3)+` s
Estimated load time for the next fragment: `+G.toFixed(3)+` s
Time to underbuffer: `+I.toFixed(3)+" s"),s.nextLoadLevel=V,this.bwEstimator.sample(u,o.loaded),this.clearTimer(),l.loader&&(this.fragCurrent=this.partCurrent=null,l.loader.abort()),s.trigger(x.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:l,part:e,stats:o})},b.onFragLoaded=function(l,e){var s=e.frag,a=e.part;if(s.type===R.PlaylistLevelType.MAIN&&Object(j.isFiniteNumber)(s.sn)){var c=a?a.stats:s.stats,d=a?a.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var o=this.hls.levels[s.level],f=(o.loaded?o.loaded.bytes:0)+c.loaded,u=(o.loaded?o.loaded.duration:0)+d;o.loaded={bytes:f,duration:u},o.realBitrate=Math.round(8*f/u)}if(s.bitrateTest){var i={stats:c,frag:s,part:a,id:s.type};this.onFragBuffered(x.Events.FRAG_BUFFERED,i),s.bitrateTest=!1}}},b.onFragBuffered=function(l,e){var s=e.frag,a=e.part,c=a?a.stats:s.stats;if(c.aborted)return;if(s.type!==R.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var d=c.parsing.end-c.loading.start;this.bwEstimator.sample(d,c.loaded),c.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=d/1e3:this.bitrateTestDelay=0},b.onError=function(l,e){switch(e.details){case M.ErrorDetails.FRAG_LOAD_ERROR:case M.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},b.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},b.getNextABRAutoLevel=function(){var l=this.fragCurrent,e=this.partCurrent,s=this.hls,a=s.maxAutoLevel,c=s.config,d=s.minAutoLevel,o=s.media,f=e?e.duration:l?l.duration:0,u=o?o.currentTime:0,i=o&&o.playbackRate!==0?Math.abs(o.playbackRate):1,r=this.bwEstimator?this.bwEstimator.getEstimate():c.abrEwmaDefaultEstimate,t=(K.BufferHelper.bufferInfo(o,u,c.maxBufferHole).end-u)/i,n=this.findBestLevel(r,d,a,t,c.abrBandWidthFactor,c.abrBandWidthUpFactor);if(n>=0)return n;L.logger.trace((t?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var g=f?Math.min(f,c.maxStarvationDelay):c.maxStarvationDelay,p=c.abrBandWidthFactor,S=c.abrBandWidthUpFactor;if(!t){var k=this.bitrateTestDelay;if(k){var I=f?Math.min(f,c.maxLoadingDelay):c.maxLoadingDelay;g=I-k,L.logger.trace("bitrate test took "+Math.round(1e3*k)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*g)+" ms"),p=S=1}}return n=this.findBestLevel(r,d,a,t+g,p,S),Math.max(n,0)},b.findBestLevel=function(l,e,s,a,c,d){for(var o,f=this.fragCurrent,u=this.partCurrent,i=this.lastLoadedFragLevel,r=this.hls.levels,t=r[i],n=!!(t!=null&&(o=t.details)!==null&&o!==void 0&&o.live),g=t==null?void 0:t.codecSet,p=u?u.duration:f?f.duration:0,S=s;S>=e;S--){var k=r[S];if(!k||g&&k.codecSet!==g)continue;var I=k.details,G=(u?I==null?void 0:I.partTarget:I==null?void 0:I.averagetargetduration)||p,V=void 0;S<=i?V=c*l:V=d*l;var J=r[S].maxBitrate,re=J*G/V;if(L.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+S+"/"+Math.round(V)+"/"+J+"/"+G+"/"+a+"/"+re),V>J&&(!re||n&&!this.bitrateTestDelay||re<a))return S}return-1},T(E,[{key:"nextAutoLevel",get:function(){var l=this._nextAutoLevel,e=this.bwEstimator;if(l!==-1&&(!e||!e.canEstimate()))return l;var s=this.getNextABRAutoLevel();return l!==-1&&(s=Math.min(l,s)),s},set:function(l){this._nextAutoLevel=l}}]),E}();U.default=w},"./src/controller/audio-stream-controller.ts":function(ve,U,C){"use strict";C.r(U);var j=C("./src/polyfills/number.ts"),O=C("./src/controller/base-stream-controller.ts"),x=C("./src/events.ts"),K=C("./src/utils/buffer-helper.ts"),M=C("./src/controller/fragment-tracker.ts"),R=C("./src/types/level.ts"),L=C("./src/types/loader.ts"),y=C("./src/loader/fragment.ts"),T=C("./src/demux/chunk-cache.ts"),w=C("./src/demux/transmuxer-interface.ts"),E=C("./src/types/transmuxer.ts"),b=C("./src/controller/fragment-finders.ts"),v=C("./src/utils/discontinuities.ts"),l=C("./src/errors.ts"),e=C("./src/utils/logger.ts");function s(){return s=Object.assign||function(f){for(var u=1;u<arguments.length;u++){var i=arguments[u];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(f[r]=i[r])}return f},s.apply(this,arguments)}function a(f,u){f.prototype=Object.create(u.prototype),f.prototype.constructor=f,c(f,u)}function c(f,u){return c=Object.setPrototypeOf||function(r,t){return r.__proto__=t,r},c(f,u)}var d=100,o=function(f){a(u,f);function u(r,t){var n;return n=f.call(this,r,t,"[audio-stream-controller]")||this,n.videoBuffer=null,n.videoTrackCC=-1,n.waitingVideoCC=-1,n.audioSwitch=!1,n.trackId=-1,n.waitingData=null,n.mainDetails=null,n.bufferFlushed=!1,n._registerListeners(),n}var i=u.prototype;return i.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},i._registerListeners=function(){var t=this.hls;t.on(x.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(x.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(x.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(x.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.on(x.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(x.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(x.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(x.Events.ERROR,this.onError,this),t.on(x.Events.BUFFER_RESET,this.onBufferReset,this),t.on(x.Events.BUFFER_CREATED,this.onBufferCreated,this),t.on(x.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(x.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(x.Events.FRAG_BUFFERED,this.onFragBuffered,this)},i._unregisterListeners=function(){var t=this.hls;t.off(x.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(x.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(x.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(x.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.off(x.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(x.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(x.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(x.Events.ERROR,this.onError,this),t.off(x.Events.BUFFER_RESET,this.onBufferReset,this),t.off(x.Events.BUFFER_CREATED,this.onBufferCreated,this),t.off(x.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(x.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(x.Events.FRAG_BUFFERED,this.onFragBuffered,this)},i.onInitPtsFound=function(t,n){var g=n.frag,p=n.id,S=n.initPTS;if(p==="main"){var k=g.cc;this.initPTS[g.cc]=S,this.log("InitPTS for cc: "+k+" found from main: "+S),this.videoTrackCC=k,this.state===O.State.WAITING_INIT_PTS&&this.tick()}},i.startLoad=function(t){if(!this.levels){this.startPosition=t,this.state=O.State.STOPPED;return}var n=this.lastCurrentTime;this.stopLoad(),this.setInterval(d),this.fragLoadError=0,n>0&&t===-1?(this.log("Override startPosition with lastCurrentTime @"+n.toFixed(3)),this.state=O.State.IDLE):(this.loadedmetadata=!1,this.state=O.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()},i.doTick=function(){switch(this.state){case O.State.IDLE:this.doTickIdle();break;case O.State.WAITING_TRACK:{var t,n=this.levels,g=this.trackId,p=n==null||((t=n[g])===null||t===void 0)?void 0:t.details;if(p){if(this.waitForCdnTuneIn(p))break;this.state=O.State.WAITING_INIT_PTS}break}case O.State.FRAG_LOADING_WAITING_RETRY:{var S,k=performance.now(),I=this.retryDate;(!I||k>=I||(S=this.media)!==null&&S!==void 0&&S.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=O.State.IDLE);break}case O.State.WAITING_INIT_PTS:{var G=this.waitingData;if(G){var V=G.frag,J=G.part,re=G.cache,ee=G.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=O.State.FRAG_LOADING;var ae=re.flush(),be={frag:V,part:J,payload:ae,networkDetails:null};this._handleFragmentLoadProgress(be),ee&&f.prototype._handleFragmentLoadComplete.call(this,be)}else if(this.videoTrackCC!==this.waitingVideoCC)e.logger.log("Waiting fragment cc ("+V.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var he=this.getLoadPosition(),me=K.BufferHelper.bufferInfo(this.mediaBuffer,he,this.config.maxBufferHole),ce=Object(b.fragmentWithinToleranceTest)(me.end,this.config.maxFragLookUpTolerance,V);ce<0&&(e.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+me.end+" is needed"),this.clearWaitingFragment())}}else this.state=O.State.IDLE}}this.onTickEnd()},i.clearWaitingFragment=function(){var t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=O.State.IDLE)},i.onTickEnd=function(){var t=this.media;if(!t||!t.readyState)return;var n=this.mediaBuffer?this.mediaBuffer:t,g=n.buffered;!this.loadedmetadata&&g.length&&(this.loadedmetadata=!0),this.lastCurrentTime=t.currentTime},i.doTickIdle=function(){var t,n,g=this.hls,p=this.levels,S=this.media,k=this.trackId,I=g.config;if(!p||!p[k])return;if(!S&&(this.startFragRequested||!I.startFragPrefetch))return;var G=p[k],V=G.details;if(!V||V.live&&this.levelLastLoaded!==k||this.waitForCdnTuneIn(V)){this.state=O.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,y.ElementaryStreamTypes.AUDIO,L.PlaylistLevelType.AUDIO));var J=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,L.PlaylistLevelType.AUDIO);if(J===null)return;var re=J.len,ee=this.getMaxBufferLength(),ae=this.audioSwitch;if(re>=ee&&!ae)return;if(!ae&&this._streamEnded(J,V)){g.trigger(x.Events.BUFFER_EOS,{type:"audio"}),this.state=O.State.ENDED;return}var be=V.fragments,he=be[0].start,me=J.end;if(ae){var ce=this.getLoadPosition();me=ce,V.PTSKnown&&ce<he&&((J.end>he||J.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),S.currentTime=he+.05))}var te=this.getNextFragment(me,V);if(!te){this.bufferFlushed=!0;return}((t=te.decryptdata)===null||t===void 0?void 0:t.keyFormat)==="identity"&&!((n=te.decryptdata)!==null&&n!==void 0&&n.key)?this.loadKey(te,V):this.loadFragment(te,V,me)},i.getMaxBufferLength=function(){var t=f.prototype.getMaxBufferLength.call(this),n=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,L.PlaylistLevelType.MAIN);return n===null?t:Math.max(t,n.len)},i.onMediaDetaching=function(){this.videoBuffer=null,f.prototype.onMediaDetaching.call(this)},i.onAudioTracksUpdated=function(t,n){var g=n.audioTracks;this.resetTransmuxer(),this.levels=g.map(function(p){return new R.Level(p)})},i.onAudioTrackSwitching=function(t,n){var g=!!n.url;this.trackId=n.id;var p=this.fragCurrent;p!=null&&p.loader&&p.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),g?this.setInterval(d):this.resetTransmuxer(),g?(this.audioSwitch=!0,this.state=O.State.IDLE):this.state=O.State.STOPPED,this.tick()},i.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},i.onLevelLoaded=function(t,n){this.mainDetails=n.details},i.onAudioTrackLoaded=function(t,n){var g,p=this.levels,S=n.details,k=n.id;if(!p){this.warn("Audio tracks were reset while loading level "+k);return}this.log("Track "+k+" loaded ["+S.startSN+","+S.endSN+"],duration:"+S.totalduration);var I=p[k],G=0;if(S.live||(g=I.details)!==null&&g!==void 0&&g.live){var V=this.mainDetails;if(S.fragments[0]||(S.deltaUpdateFailed=!0),S.deltaUpdateFailed||!V)return;!I.details&&S.hasProgramDateTime&&V.hasProgramDateTime?(Object(v.alignMediaPlaylistByPDT)(S,V),G=S.fragments[0].start):G=this.alignPlaylists(S,I.details)}I.details=S,this.levelLastLoaded=k,!this.startFragRequested&&(this.mainDetails||!S.live)&&this.setStartPosition(I.details,G),this.state===O.State.WAITING_TRACK&&!this.waitForCdnTuneIn(S)&&(this.state=O.State.IDLE),this.tick()},i._handleFragmentLoadProgress=function(t){var n,g=t.frag,p=t.part,S=t.payload,k=this.config,I=this.trackId,G=this.levels;if(!G){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+g.sn+" of level "+g.level+" will not be buffered");return}var V=G[I];console.assert(V,"Audio track is defined on fragment load progress");var J=V.details;console.assert(J,"Audio track details are defined on fragment load progress");var re=k.defaultAudioCodec||V.audioCodec||"mp4a.40.2",ee=this.transmuxer;ee||(ee=this.transmuxer=new w.default(this.hls,L.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ae=this.initPTS[g.cc],be=(n=g.initSegment)===null||n===void 0?void 0:n.data;if(ae!==void 0){var he=!1,me=p?p.index:-1,ce=me!==-1,te=new E.ChunkMetadata(g.level,g.sn,g.stats.chunkCount,S.byteLength,me,ce);ee.push(S,be,re,"",g,p,J.totalduration,he,te,ae)}else{e.logger.log("Unknown video PTS for cc "+g.cc+", waiting for video PTS before demuxing audio frag "+g.sn+" of ["+J.startSN+" ,"+J.endSN+"],track "+I);var q=this.waitingData=this.waitingData||{frag:g,part:p,cache:new T.default,complete:!1},oe=q.cache;oe.push(new Uint8Array(S)),this.waitingVideoCC=this.videoTrackCC,this.state=O.State.WAITING_INIT_PTS}},i._handleFragmentLoadComplete=function(t){if(this.waitingData){this.waitingData.complete=!0;return}f.prototype._handleFragmentLoadComplete.call(this,t)},i.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},i.onBufferCreated=function(t,n){var g=n.tracks.audio;g&&(this.mediaBuffer=g.buffer),n.tracks.video&&(this.videoBuffer=n.tracks.video.buffer)},i.onFragBuffered=function(t,n){var g=n.frag,p=n.part;if(g.type!==L.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(g)){this.warn("Fragment "+g.sn+(p?" p: "+p.index:"")+" of level "+g.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}g.sn!=="initSegment"&&(this.fragPrevious=g,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(x.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(g,p)},i.onError=function(t,n){switch(n.details){case l.ErrorDetails.FRAG_LOAD_ERROR:case l.ErrorDetails.FRAG_LOAD_TIMEOUT:case l.ErrorDetails.KEY_LOAD_ERROR:case l.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.AUDIO,n);break;case l.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case l.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==O.State.ERROR&&this.state!==O.State.STOPPED&&(this.state=n.fatal?O.State.ERROR:O.State.IDLE,this.warn(n.details+" while loading frag, switching to "+this.state+" state"));break;case l.ErrorDetails.BUFFER_FULL_ERROR:if(n.parent==="audio"&&(this.state===O.State.PARSING||this.state===O.State.PARSED)){var g=!0,p=this.getFwdBufferInfo(this.mediaBuffer,L.PlaylistLevelType.AUDIO);p&&p.len>.5&&(g=!this.reduceMaxBufferLength(p.len)),g&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,f.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},i.onBufferFlushed=function(t,n){var g=n.type;g===y.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},i._handleTransmuxComplete=function(t){var n,g="audio",p=this.hls,S=t.remuxResult,k=t.chunkMeta,I=this.getCurrentContext(k);if(!I){this.warn("The loading context changed while buffering fragment "+k.sn+" of level "+k.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(k.level);return}var G=I.frag,V=I.part,J=S.audio,re=S.text,ee=S.id3,ae=S.initSegment;if(this.fragContextChanged(G))return;if(this.state=O.State.PARSING,this.audioSwitch&&J&&this.completeAudioSwitch(),ae!=null&&ae.tracks&&(this._bufferInitSegment(ae.tracks,G,k),p.trigger(x.Events.FRAG_PARSING_INIT_SEGMENT,{frag:G,id:g,tracks:ae.tracks})),J){var be=J.startPTS,he=J.endPTS,me=J.startDTS,ce=J.endDTS;V&&(V.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:be,endPTS:he,startDTS:me,endDTS:ce}),G.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,be,he,me,ce),this.bufferFragmentData(J,G,V,k)}if(ee!=null&&(n=ee.samples)!==null&&n!==void 0&&n.length){var te=s({frag:G,id:g},ee);p.trigger(x.Events.FRAG_PARSING_METADATA,te)}if(re){var q=s({frag:G,id:g},re);p.trigger(x.Events.FRAG_PARSING_USERDATA,q)}},i._bufferInitSegment=function(t,n,g){if(this.state!==O.State.PARSING)return;t.video&&delete t.video;var p=t.audio;if(!p)return;p.levelCodec=p.codec,p.id="audio",this.log("Init audio buffer, container:"+p.container+", codecs[parsed]=["+p.codec+"]"),this.hls.trigger(x.Events.BUFFER_CODECS,t);var S=p.initSegment;if(S!=null&&S.byteLength){var k={type:"audio",frag:n,part:null,chunkMeta:g,parent:n.type,data:S};this.hls.trigger(x.Events.BUFFER_APPENDING,k)}this.tick()},i.loadFragment=function(t,n,g){var p=this.fragmentTracker.getState(t);this.fragCurrent=t,(this.audioSwitch||p===M.FragmentState.NOT_LOADED||p===M.FragmentState.PARTIAL)&&(t.sn==="initSegment"?this._loadInitSegment(t):n.live&&!Object(j.isFiniteNumber)(this.initPTS[t.cc])?(this.log("Waiting for video PTS in continuity counter "+t.cc+" of live stream before loading audio fragment "+t.sn+" of level "+this.trackId),this.state=O.State.WAITING_INIT_PTS):(this.startFragRequested=!0,f.prototype.loadFragment.call(this,t,n,g)))},i.completeAudioSwitch=function(){var t=this.hls,n=this.media,g=this.trackId;n&&(this.log("Switching audio track : flushing all audio"),f.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,t.trigger(x.Events.AUDIO_TRACK_SWITCHED,{id:g})},u}(O.default);U.default=o},"./src/controller/audio-track-controller.ts":function(ve,U,C){"use strict";C.r(U);var j=C("./src/events.ts"),O=C("./src/errors.ts"),x=C("./src/controller/base-playlist-controller.ts"),K=C("./src/types/loader.ts");function M(w,E){for(var b=0;b<E.length;b++){var v=E[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(w,v.key,v)}}function R(w,E,b){return E&&M(w.prototype,E),b&&M(w,b),w}function L(w,E){w.prototype=Object.create(E.prototype),w.prototype.constructor=w,y(w,E)}function y(w,E){return y=Object.setPrototypeOf||function(v,l){return v.__proto__=l,v},y(w,E)}var T=function(w){L(E,w);function E(v){var l;return l=w.call(this,v,"[audio-track-controller]")||this,l.tracks=[],l.groupId=null,l.tracksInGroup=[],l.trackId=-1,l.trackName="",l.selectDefaultTrack=!0,l.registerListeners(),l}var b=E.prototype;return b.registerListeners=function(){var l=this.hls;l.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on(j.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on(j.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.on(j.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(j.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var l=this.hls;l.off(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off(j.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off(j.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.off(j.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(j.Events.ERROR,this.onError,this)},b.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,w.prototype.destroy.call(this)},b.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},b.onManifestParsed=function(l,e){this.tracks=e.audioTracks||[]},b.onAudioTrackLoaded=function(l,e){var s=e.id,a=e.details,c=this.tracksInGroup[s];if(!c){this.warn("Invalid audio track id "+s);return}var d=c.details;c.details=e.details,this.log("audioTrack "+s+" loaded ["+a.startSN+"-"+a.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,e,d))},b.onLevelLoading=function(l,e){this.switchLevel(e.level)},b.onLevelSwitching=function(l,e){this.switchLevel(e.level)},b.switchLevel=function(l){var e=this.hls.levels[l];if(!(e!=null&&e.audioGroupIds))return;var s=e.audioGroupIds[e.urlId];if(this.groupId!==s){this.groupId=s;var a=this.tracks.filter(function(d){return!s||d.groupId===s});this.selectDefaultTrack&&!a.some(function(d){return d.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=a;var c={audioTracks:a};this.log("Updating audio tracks, "+a.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(j.Events.AUDIO_TRACKS_UPDATED,c),this.selectInitialTrack()}},b.onError=function(l,e){if(w.prototype.onError.call(this,l,e),e.fatal||!e.context)return;e.context.type===K.PlaylistContextType.AUDIO_TRACK&&e.context.id===this.trackId&&e.context.groupId===this.groupId&&this.retryLoadingOrFail(e)},b.setAudioTrack=function(l){var e=this.tracksInGroup;if(l<0||l>=e.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=e[this.trackId];this.log("Now switching to audio-track index "+l);var a=e[l],c=a.id,d=a.groupId,o=d===void 0?"":d,f=a.name,u=a.type,i=a.url;if(this.trackId=l,this.trackName=f,this.selectDefaultTrack=!1,this.hls.trigger(j.Events.AUDIO_TRACK_SWITCHING,{id:c,groupId:o,name:f,type:u,url:i}),a.details&&!a.details.live)return;var r=this.switchParams(a.url,s==null?void 0:s.details);this.loadPlaylist(r)},b.selectInitialTrack=function(){var l=this.tracksInGroup;console.assert(l.length,"Initial audio track should be selected when tracks are known");var e=this.trackName,s=this.findTrackId(e)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(j.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},b.findTrackId=function(l){for(var e=this.tracksInGroup,s=0;s<e.length;s++){var a=e[s];if((!this.selectDefaultTrack||a.default)&&(!l||l===a.name))return a.id}return-1},b.loadPlaylist=function(l){var e=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(e)){var s=e.id,a=e.groupId,c=e.url;if(l)try{c=l.addDirectives(c)}catch(d){this.warn("Could not construct new URL with HLS Delivery Directives: "+d)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(j.Events.AUDIO_TRACK_LOADING,{url:c,id:s,groupId:a,deliveryDirectives:l||null})}},R(E,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(l){this.selectDefaultTrack=!1,this.setAudioTrack(l)}}]),E}(x.default);U.default=T},"./src/controller/base-playlist-controller.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"default",function(){return R});var j=C("./src/polyfills/number.ts"),O=C("./src/types/level.ts"),x=C("./src/controller/level-helper.ts"),K=C("./src/utils/logger.ts"),M=C("./src/errors.ts"),R=function(){function L(T,w){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=K.logger.log.bind(K.logger,w+":"),this.warn=K.logger.warn.bind(K.logger,w+":"),this.hls=T}var y=L.prototype;return y.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},y.onError=function(w,E){E.fatal&&E.type===M.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},y.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},y.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},y.stopLoad=function(){this.canLoad=!1,this.clearTimer()},y.switchParams=function(w,E){var b=E==null?void 0:E.renditionReports;if(b)for(var v=0;v<b.length;v++){var l=b[v],e=""+l.URI;if(e===w.substr(-e.length)){var s=parseInt(l["LAST-MSN"]),a=parseInt(l["LAST-PART"]);if(E&&this.hls.config.lowLatencyMode){var c=Math.min(E.age-E.partTarget,E.targetduration);a!==void 0&&c>E.partTarget&&(a+=1)}if(Object(j.isFiniteNumber)(s))return new O.HlsUrlParameters(s,Object(j.isFiniteNumber)(a)?a:void 0,O.HlsSkip.No)}}},y.loadPlaylist=function(w){},y.shouldLoadTrack=function(w){return this.canLoad&&w&&!!w.url&&(!w.details||w.details.live)},y.playlistLoaded=function(w,E,b){var v=this,l=E.details,e=E.stats,s=e.loading.end?Math.max(0,self.performance.now()-e.loading.end):0;if(l.advancedDateTime=Date.now()-s,l.live||b!=null&&b.live){if(l.reloaded(b),b&&this.log("live playlist "+w+" "+(l.advanced?"REFRESHED "+l.lastPartSn+"-"+l.lastPartIndex:"MISSED")),b&&l.fragments.length>0&&Object(x.mergeDetails)(b,l),!this.canLoad||!l.live)return;var a,c=void 0,d=void 0;if(l.canBlockReload&&l.endSN&&l.advanced){var o=this.hls.config.lowLatencyMode,f=l.lastPartSn,u=l.endSN,i=l.lastPartIndex,r=i!==-1,t=f===u,n=o?0:i;r?(c=t?u+1:f,d=t?n:i+1):c=u+1;var g=l.age,p=g+l.ageHeader,S=Math.min(p-l.partTarget,l.targetduration*1.5);if(S>0){if(b&&S>b.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+b.tuneInGoal+" to: "+S+" with playlist age: "+l.age),S=0;else{var k=Math.floor(S/l.targetduration);if(c+=k,d!==void 0){var I=Math.round(S%l.targetduration/l.partTarget);d+=I}this.log("CDN Tune-in age: "+l.ageHeader+"s last advanced "+g.toFixed(2)+"s goal: "+S+" skip sn "+k+" to part "+d)}l.tuneInGoal=S}if(a=this.getDeliveryDirectives(l,E.deliveryDirectives,c,d),o||!t){this.loadPlaylist(a);return}}else a=this.getDeliveryDirectives(l,E.deliveryDirectives,c,d);var G=Object(x.computeReloadInterval)(l,e);c!==void 0&&l.canBlockReload&&(G-=l.partTarget||1),this.log("reload live playlist "+w+" in "+Math.round(G)+" ms"),this.timer=self.setTimeout(function(){return v.loadPlaylist(a)},G)}else this.clearTimer()},y.getDeliveryDirectives=function(w,E,b,v){var l=Object(O.getSkipValue)(w,b);return E!=null&&E.skip&&w.deltaUpdateFailed&&(b=E.msn,v=E.part,l=O.HlsSkip.No),new O.HlsUrlParameters(b,v,l)},y.retryLoadingOrFail=function(w){var E=this,b=this.hls.config,v=this.retryCount<b.levelLoadingMaxRetry;if(v){var l;if(this.retryCount++,w.details.indexOf("LoadTimeOut")>-1&&(l=w.context)!==null&&l!==void 0&&l.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+w.details+'"'),this.loadPlaylist();else{var e=Math.min(Math.pow(2,this.retryCount)*b.levelLoadingRetryDelay,b.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return E.loadPlaylist()},e),this.warn("retry playlist loading #"+this.retryCount+" in "+e+' ms after "'+w.details+'"')}}else this.warn('cannot recover from error "'+w.details+'"'),this.clearTimer(),w.fatal=!0;return v},L}()},"./src/controller/base-stream-controller.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"State",function(){return u}),C.d(U,"default",function(){return i});var j=C("./src/polyfills/number.ts"),O=C("./src/task-loop.ts"),x=C("./src/controller/fragment-tracker.ts"),K=C("./src/utils/buffer-helper.ts"),M=C("./src/utils/logger.ts"),R=C("./src/events.ts"),L=C("./src/errors.ts"),y=C("./src/types/transmuxer.ts"),T=C("./src/utils/mp4-tools.ts"),w=C("./src/utils/discontinuities.ts"),E=C("./src/controller/fragment-finders.ts"),b=C("./src/controller/level-helper.ts"),v=C("./src/loader/fragment-loader.ts"),l=C("./src/crypt/decrypter.ts"),e=C("./src/utils/time-ranges.ts"),s=C("./src/types/loader.ts");function a(r,t){for(var n=0;n<t.length;n++){var g=t[n];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(r,g.key,g)}}function c(r,t,n){return t&&a(r.prototype,t),n&&a(r,n),r}function d(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function o(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,f(r,t)}function f(r,t){return f=Object.setPrototypeOf||function(g,p){return g.__proto__=p,g},f(r,t)}var u={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},i=function(r){o(t,r);function t(g,p,S){var k;return k=r.call(this)||this,k.hls=void 0,k.fragPrevious=null,k.fragCurrent=null,k.fragmentTracker=void 0,k.transmuxer=null,k._state=u.STOPPED,k.media=void 0,k.mediaBuffer=void 0,k.config=void 0,k.bitrateTest=!1,k.lastCurrentTime=0,k.nextLoadPosition=0,k.startPosition=0,k.loadedmetadata=!1,k.fragLoadError=0,k.retryDate=0,k.levels=null,k.fragmentLoader=void 0,k.levelLastLoaded=null,k.startFragRequested=!1,k.decrypter=void 0,k.initPTS=[],k.onvseeking=null,k.onvended=null,k.logPrefix="",k.log=void 0,k.warn=void 0,k.logPrefix=S,k.log=M.logger.log.bind(M.logger,S+":"),k.warn=M.logger.warn.bind(M.logger,S+":"),k.hls=g,k.fragmentLoader=new v.default(g.config),k.fragmentTracker=p,k.config=g.config,k.decrypter=new l.default(g,g.config),g.on(R.Events.KEY_LOADED,k.onKeyLoaded,d(k)),k}var n=t.prototype;return n.doTick=function(){this.onTickEnd()},n.onTickEnd=function(){},n.startLoad=function(p){},n.stopLoad=function(){this.fragmentLoader.abort();var p=this.fragCurrent;p&&this.fragmentTracker.removeFragment(p),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=u.STOPPED},n._streamEnded=function(p,S){var k=this.fragCurrent,I=this.fragmentTracker;if(!S.live&&k&&k.sn===S.endSN&&!p.nextStart){var G=I.getState(k);return G===x.FragmentState.PARTIAL||G===x.FragmentState.OK}return!1},n.onMediaAttached=function(p,S){var k=this.media=this.mediaBuffer=S.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),k.addEventListener("seeking",this.onvseeking),k.addEventListener("ended",this.onvended);var I=this.config;this.levels&&I.autoStartLoad&&this.state===u.STOPPED&&this.startLoad(I.startPosition)},n.onMediaDetaching=function(){var p=this.media;p!=null&&p.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),p&&(p.removeEventListener("seeking",this.onvseeking),p.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},n.onMediaSeeking=function(){var p=this.config,S=this.fragCurrent,k=this.media,I=this.mediaBuffer,G=this.state,V=k?k.currentTime:0,J=K.BufferHelper.bufferInfo(I||k,V,p.maxBufferHole);if(this.log("media seeking to "+(Object(j.isFiniteNumber)(V)?V.toFixed(3):V)+", state: "+G),G===u.ENDED)this.resetLoadingState();else if(S&&!J.len){var re=p.maxFragLookUpTolerance,ee=S.start-re,ae=S.start+S.duration+re,be=V>ae;(V<ee||be)&&(be&&S.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),S.loader.abort()),this.resetLoadingState())}k&&(this.lastCurrentTime=V),!this.loadedmetadata&&!J.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},n.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},n.onKeyLoaded=function(p,S){if(this.state!==u.KEY_LOADING||S.frag!==this.fragCurrent||!this.levels)return;this.state=u.IDLE;var k=this.levels[S.frag.level].details;k&&this.loadFragment(S.frag,k,S.frag.start)},n.onHandlerDestroying=function(){this.stopLoad(),r.prototype.onHandlerDestroying.call(this)},n.onHandlerDestroyed=function(){this.state=u.STOPPED,this.hls.off(R.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,r.prototype.onHandlerDestroyed.call(this)},n.loadKey=function(p,S){this.log("Loading key for "+p.sn+" of ["+S.startSN+"-"+S.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level),this.state=u.KEY_LOADING,this.fragCurrent=p,this.hls.trigger(R.Events.KEY_LOADING,{frag:p})},n.loadFragment=function(p,S,k){this._loadFragForPlayback(p,S,k)},n._loadFragForPlayback=function(p,S,k){var I=this,G=function(J){if(I.fragContextChanged(p)){I.warn("Fragment "+p.sn+(J.part?" p: "+J.part.index:"")+" of level "+p.level+" was dropped during download."),I.fragmentTracker.removeFragment(p);return}p.stats.chunkCount++,I._handleFragmentLoadProgress(J)};this._doFragLoad(p,S,k,G).then(function(V){if(!V)return;I.fragLoadError=0;var J=I.state;if(I.fragContextChanged(p)){(J===u.FRAG_LOADING||J===u.BACKTRACKING||!I.fragCurrent&&J===u.PARSING)&&(I.fragmentTracker.removeFragment(p),I.state=u.IDLE);return}if("payload"in V&&(I.log("Loaded fragment "+p.sn+" of level "+p.level),I.hls.trigger(R.Events.FRAG_LOADED,V),I.state===u.BACKTRACKING)){I.fragmentTracker.backtrack(p,V),I.resetFragmentLoading(p);return}I._handleFragmentLoadComplete(V)}).catch(function(V){I.warn(V),I.resetFragmentLoading(p)})},n.flushMainBuffer=function(p,S,k){if(k===void 0&&(k=null),!(p-S))return;var I={startOffset:p,endOffset:S,type:k};this.fragLoadError=0,this.hls.trigger(R.Events.BUFFER_FLUSHING,I)},n._loadInitSegment=function(p){var S=this;this._doFragLoad(p).then(function(k){if(!k||S.fragContextChanged(p)||!S.levels)throw new Error("init load aborted");return k}).then(function(k){var I=S.hls,G=k.payload,V=p.decryptdata;if(G&&G.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var J=self.performance.now();return S.decrypter.webCryptoDecrypt(new Uint8Array(G),V.key.buffer,V.iv.buffer).then(function(re){var ee=self.performance.now();return I.trigger(R.Events.FRAG_DECRYPTED,{frag:p,payload:re,stats:{tstart:J,tdecrypt:ee}}),k.payload=re,k})}return k}).then(function(k){var I=S.fragCurrent,G=S.hls,V=S.levels;if(!V)throw new Error("init load aborted, missing levels");var J=V[p.level].details;console.assert(J,"Level details are defined when init segment is loaded");var re=p.stats;S.state=u.IDLE,S.fragLoadError=0,p.data=new Uint8Array(k.payload),re.parsing.start=re.buffering.start=self.performance.now(),re.parsing.end=re.buffering.end=self.performance.now(),k.frag===I&&G.trigger(R.Events.FRAG_BUFFERED,{stats:re,frag:I,part:null,id:p.type}),S.tick()}).catch(function(k){S.warn(k),S.resetFragmentLoading(p)})},n.fragContextChanged=function(p){var S=this.fragCurrent;return!p||!S||p.level!==S.level||p.sn!==S.sn||p.urlId!==S.urlId},n.fragBufferedComplete=function(p,S){var k=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+p.type+" sn: "+p.sn+(S?" part: "+S.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level+" "+e.default.toString(K.BufferHelper.getBuffered(k))),this.state=u.IDLE,this.tick()},n._handleFragmentLoadComplete=function(p){var S=this.transmuxer;if(!S)return;var k=p.frag,I=p.part,G=p.partsLoaded,V=!G||G.length===0||G.some(function(re){return!re}),J=new y.ChunkMetadata(k.level,k.sn,k.stats.chunkCount+1,0,I?I.index:-1,!V);S.flush(J)},n._handleFragmentLoadProgress=function(p){},n._doFragLoad=function(p,S,k,I){var G=this;if(k===void 0&&(k=null),!this.levels)throw new Error("frag load aborted, missing levels");if(k=Math.max(p.start,k||0),this.config.lowLatencyMode&&S){var V=S.partList;if(V&&I){k>p.end&&S.fragmentHint&&(p=S.fragmentHint);var J=this.getNextPart(V,p,k);if(J>-1){var re=V[J];return this.log("Loading part sn: "+p.sn+" p: "+re.index+" cc: "+p.cc+" of playlist ["+S.startSN+"-"+S.endSN+"] parts [0-"+J+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(k.toFixed(3))),this.nextLoadPosition=re.start+re.duration,this.state=u.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:p,part:V[J],targetBufferTime:k}),this.doFragPartsLoad(p,V,J,I).catch(function(ee){return G.handleFragLoadError(ee)})}else if(!p.url||this.loadedEndOfParts(V,k))return Promise.resolve(null)}}return this.log("Loading fragment "+p.sn+" cc: "+p.cc+" "+(S?"of ["+S.startSN+"-"+S.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(k.toFixed(3))),Object(j.isFiniteNumber)(p.sn)&&!this.bitrateTest&&(this.nextLoadPosition=p.start+p.duration),this.state=u.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:p,targetBufferTime:k}),this.fragmentLoader.load(p,I).catch(function(ee){return G.handleFragLoadError(ee)})},n.doFragPartsLoad=function(p,S,k,I){var G=this;return new Promise(function(V,J){var re=[],ee=function ae(be){var he=S[be];G.fragmentLoader.loadPart(p,he,I).then(function(me){re[he.index]=me;var ce=me.part;G.hls.trigger(R.Events.FRAG_LOADED,me);var te=S[be+1];if(te&&te.fragment===p)ae(be+1);else return V({frag:p,part:ce,partsLoaded:re})}).catch(J)};ee(k)})},n.handleFragLoadError=function(p){var S=p.data;return S&&S.details===L.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(S.frag,S.part):this.hls.trigger(R.Events.ERROR,S),null},n._handleTransmuxerFlush=function(p){var S=this.getCurrentContext(p);if(!S||this.state!==u.PARSING){this.fragCurrent||(this.state=u.IDLE);return}var k=S.frag,I=S.part,G=S.level,V=self.performance.now();k.stats.parsing.end=V,I&&(I.stats.parsing.end=V),this.updateLevelTiming(k,I,G,p.partial)},n.getCurrentContext=function(p){var S=this.levels,k=p.level,I=p.sn,G=p.part;if(!S||!S[k])return this.warn("Levels object was unset while buffering fragment "+I+" of level "+k+". The current chunk will not be buffered."),null;var V=S[k],J=G>-1?Object(b.getPartWith)(V,I,G):null,re=J?J.fragment:Object(b.getFragmentWithSN)(V,I,this.fragCurrent);return re?{frag:re,part:J,level:V}:null},n.bufferFragmentData=function(p,S,k,I){if(!p||this.state!==u.PARSING)return;var G=p.data1,V=p.data2,J=G;if(G&&V&&(J=Object(T.appendUint8Array)(G,V)),!J||!J.length)return;var re={type:p.type,frag:S,part:k,chunkMeta:I,parent:S.type,data:J};this.hls.trigger(R.Events.BUFFER_APPENDING,re),p.dropped&&p.independent&&!k&&this.flushBufferGap(S)},n.flushBufferGap=function(p){var S=this.media;if(!S)return;if(!K.BufferHelper.isBuffered(S,S.currentTime)){this.flushMainBuffer(0,p.start);return}var k=S.currentTime,I=K.BufferHelper.bufferInfo(S,k,0),G=p.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,G*.25),J=Math.max(Math.min(p.start-V,I.end-V),k+V);p.start-J>V&&this.flushMainBuffer(J,p.start)},n.getFwdBufferInfo=function(p,S){var k=this.config,I=this.getLoadPosition();if(!Object(j.isFiniteNumber)(I))return null;var G=K.BufferHelper.bufferInfo(p,I,k.maxBufferHole);if(G.len===0&&G.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(I,S);if(V&&G.nextStart<V.end)return K.BufferHelper.bufferInfo(p,I,Math.max(G.nextStart,k.maxBufferHole))}return G},n.getMaxBufferLength=function(p){var S=this.config,k;return p?k=Math.max(8*S.maxBufferSize/p,S.maxBufferLength):k=S.maxBufferLength,Math.min(k,S.maxMaxBufferLength)},n.reduceMaxBufferLength=function(p){var S=this.config,k=p||S.maxBufferLength;return S.maxMaxBufferLength>=k?(S.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+S.maxMaxBufferLength+"s"),!0):!1},n.getNextFragment=function(p,S){var k,I,G=S.fragments,V=G.length;if(!V)return null;var J=this.config,re=G[0].start,ee;if(S.live){var ae=J.initialLiveManifestSize;if(V<ae)return this.warn("Not enough fragments to start playback (have: "+V+", need: "+ae+")"),null;!S.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(ee=this.getInitialLiveFragment(S,G),this.startPosition=ee?this.hls.liveSyncPosition||ee.start:p)}else p<=re&&(ee=G[0]);if(!ee){var be=J.lowLatencyMode?S.partEnd:S.fragmentEnd;ee=this.getFragmentAtPosition(p,be,S)}return(k=ee)!==null&&k!==void 0&&k.initSegment&&!((I=ee)!==null&&I!==void 0&&I.initSegment.data)&&!this.bitrateTest&&(ee=ee.initSegment),ee},n.getNextPart=function(p,S,k){for(var I=-1,G=!1,V=!0,J=0,re=p.length;J<re;J++){var ee=p[J];if(V=V&&!ee.independent,I>-1&&k<ee.start)break;var ae=ee.loaded;!ae&&(G||ee.independent||V)&&ee.fragment===S&&(I=J),G=ae}return I},n.loadedEndOfParts=function(p,S){var k=p[p.length-1];return k&&S>k.start&&k.loaded},n.getInitialLiveFragment=function(p,S){var k=this.fragPrevious,I=null;if(k){if(p.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+k.programDateTime),I=Object(E.findFragmentByPDT)(S,k.endProgramDateTime,this.config.maxFragLookUpTolerance)),!I){var G=k.sn+1;if(G>=p.startSN&&G<=p.endSN){var V=S[G-p.startSN];k.cc===V.cc&&(I=V,this.log("Live playlist, switching playlist, load frag with next SN: "+I.sn))}I||(I=Object(E.findFragWithCC)(S,k.cc),I&&this.log("Live playlist, switching playlist, load frag with same CC: "+I.sn))}}else{var J=this.hls.liveSyncPosition;J!==null&&(I=this.getFragmentAtPosition(J,this.bitrateTest?p.fragmentEnd:p.edge,p))}return I},n.getFragmentAtPosition=function(p,S,k){var I=this.config,G=this.fragPrevious,V=k.fragments,J=k.endSN,re=k.fragmentHint,ee=I.maxFragLookUpTolerance,ae=!!(I.lowLatencyMode&&k.partList&&re);ae&&re&&!this.bitrateTest&&(V=V.concat(re),J=re.sn);var be;if(p<S){var he=p>S-ee?0:ee;be=Object(E.findFragmentByPTS)(G,V,p,he)}else be=V[V.length-1];if(be){var me=be.sn-k.startSN,ce=G&&be.level===G.level,te=V[me+1],q=this.fragmentTracker.getState(be);if(q===x.FragmentState.BACKTRACKED){be=null;for(var oe=me;V[oe]&&this.fragmentTracker.getState(V[oe])===x.FragmentState.BACKTRACKED;)G?be=V[oe--]:be=V[--oe];be||(be=te)}else G&&be.sn===G.sn&&!ae&&(ce&&(be.sn<J&&this.fragmentTracker.getState(te)!==x.FragmentState.OK?(this.log("SN "+be.sn+" just loaded, load next one: "+te.sn),be=te):be=null))}return be},n.synchronizeToLiveEdge=function(p){var S=this.config,k=this.media;if(!k)return;var I=this.hls.liveSyncPosition,G=k.currentTime,V=p.fragments[0].start,J=p.edge,re=G>=V-S.maxFragLookUpTolerance&&G<=J;if(I!==null&&k.duration>I&&(G<I||!re)){var ee=S.liveMaxLatencyDuration!==void 0?S.liveMaxLatencyDuration:S.liveMaxLatencyDurationCount*p.targetduration;(!re&&k.readyState<4||G<J-ee)&&(this.loadedmetadata||(this.nextLoadPosition=I),k.readyState&&(this.warn("Playback: "+G.toFixed(3)+" is located too far from the end of live sliding playlist: "+J+", reset currentTime to : "+I.toFixed(3)),k.currentTime=I))}},n.alignPlaylists=function(p,S){var k=this.levels,I=this.levelLastLoaded,G=this.fragPrevious,V=I!==null?k[I]:null,J=p.fragments.length;if(!J)return this.warn("No fragments in live playlist"),0;var re=p.fragments[0].start,ee=!S,ae=p.alignedSliding&&Object(j.isFiniteNumber)(re);if(ee||!ae&&!re){Object(w.alignStream)(G,V,p);var be=p.fragments[0].start;return this.log("Live playlist sliding: "+be.toFixed(2)+" start-sn: "+(S?S.startSN:"na")+"->"+p.startSN+" prev-sn: "+(G?G.sn:"na")+" fragments: "+J),be}return re},n.waitForCdnTuneIn=function(p){var S=3;return p.live&&p.canBlockReload&&p.tuneInGoal>Math.max(p.partHoldBack,p.partTarget*S)},n.setStartPosition=function(p,S){var k=this.startPosition;if(k<S&&(k=-1),k===-1||this.lastCurrentTime===-1){var I=p.startTimeOffset;Object(j.isFiniteNumber)(I)?(k=S+I,I<0&&(k+=p.totalduration),k=Math.min(Math.max(S,k),S+p.totalduration),this.log("Start time offset "+I+" found in playlist, adjust startPosition to "+k),this.startPosition=k):p.live?k=this.hls.liveSyncPosition||S:this.startPosition=k=0,this.lastCurrentTime=k}this.nextLoadPosition=k},n.getLoadPosition=function(){var p=this.media,S=0;return this.loadedmetadata&&p?S=p.currentTime:this.nextLoadPosition&&(S=this.nextLoadPosition),S},n.handleFragLoadAborted=function(p,S){this.transmuxer&&p.sn!=="initSegment"&&p.stats.aborted&&(this.warn("Fragment "+p.sn+(S?" part"+S.index:"")+" of level "+p.level+" was aborted"),this.resetFragmentLoading(p))},n.resetFragmentLoading=function(p){(!this.fragCurrent||!this.fragContextChanged(p))&&(this.state=u.IDLE)},n.onFragmentOrKeyLoadError=function(p,S){if(S.fatal)return;var k=S.frag;if(!k||k.type!==p)return;var I=this.fragCurrent;console.assert(I&&k.sn===I.sn&&k.level===I.level&&k.urlId===I.urlId,"Frag load error must match current frag to retry");var G=this.config;if(this.fragLoadError+1<=G.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(k.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*G.fragLoadingRetryDelay,G.fragLoadingMaxRetryTimeout);this.warn("Fragment "+k.sn+" of "+p+" "+k.level+" failed to load, retrying in "+V+"ms"),this.retryDate=self.performance.now()+V,this.fragLoadError++,this.state=u.FRAG_LOADING_WAITING_RETRY}else S.levelRetry?(p===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=u.IDLE):(M.logger.error(S.details+" reaches max retry, redispatch as fatal ..."),S.fatal=!0,this.hls.stopLoad(),this.state=u.ERROR)},n.afterBufferFlushed=function(p,S,k){if(!p)return;var I=K.BufferHelper.getBuffered(p);this.fragmentTracker.detectEvictedFragments(S,I,k),this.state===u.ENDED&&this.resetLoadingState()},n.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=u.IDLE},n.resetLiveStartWhenNotLoaded=function(p){if(!this.loadedmetadata){this.startFragRequested=!1;var S=this.levels?this.levels[p].details:null;if(S!=null&&S.live)return this.startPosition=-1,this.setStartPosition(S,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},n.updateLevelTiming=function(p,S,k,I){var G=this,V=k.details;console.assert(!!V,"level.details must be defined");var J=Object.keys(p.elementaryStreams).reduce(function(re,ee){var ae=p.elementaryStreams[ee];if(ae){var be=ae.endPTS-ae.startPTS;if(be<=0)return G.warn("Could not parse fragment "+p.sn+" "+ee+" duration reliably ("+be+") resetting transmuxer to fallback to playlist timing"),G.resetTransmuxer(),re||!1;var he=I?0:Object(b.updateFragPTSDTS)(V,p,ae.startPTS,ae.endPTS,ae.startDTS,ae.endDTS);return G.hls.trigger(R.Events.LEVEL_PTS_UPDATED,{details:V,level:k,drift:he,type:ee,frag:p,start:ae.startPTS,end:ae.endPTS}),!0}return re},!1);J?(this.state=u.PARSED,this.hls.trigger(R.Events.FRAG_PARSED,{frag:p,part:S})):this.resetLoadingState()},n.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},c(t,[{key:"state",get:function(){return this._state},set:function(p){var S=this._state;S!==p&&(this._state=p,this.log(S+"->"+p))}}]),t}(O.default)},"./src/controller/buffer-controller.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"default",function(){return E});var j=C("./src/polyfills/number.ts"),O=C("./src/events.ts"),x=C("./src/utils/logger.ts"),K=C("./src/errors.ts"),M=C("./src/utils/buffer-helper.ts"),R=C("./src/utils/mediasource-helper.ts"),L=C("./src/loader/fragment.ts"),y=C("./src/controller/buffer-operation-queue.ts"),T=Object(R.getMediaSource)(),w=/([ha]vc.)(?:\.[^.,]+)+/,E=function(){function b(l){var e=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=e.hls,a=e.media,c=e.mediaSource;x.logger.log("[buffer-controller]: Media source opened"),a&&(e.updateMediaElementDuration(),s.trigger(O.Events.MEDIA_ATTACHED,{media:a})),c&&c.removeEventListener("sourceopen",e._onMediaSourceOpen),e.checkPendingTracks()},this._onMediaSourceClose=function(){x.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){x.logger.log("[buffer-controller]: Media source ended")},this.hls=l,this._initSourceBuffer(),this.registerListeners()}var v=b.prototype;return v.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},v.destroy=function(){this.unregisterListeners(),this.details=null},v.registerListeners=function(){var e=this.hls;e.on(O.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(O.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(O.Events.BUFFER_RESET,this.onBufferReset,this),e.on(O.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.on(O.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(O.Events.BUFFER_EOS,this.onBufferEos,this),e.on(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(O.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(O.Events.FRAG_PARSED,this.onFragParsed,this),e.on(O.Events.FRAG_CHANGED,this.onFragChanged,this)},v.unregisterListeners=function(){var e=this.hls;e.off(O.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(O.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(O.Events.BUFFER_RESET,this.onBufferReset,this),e.off(O.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.off(O.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(O.Events.BUFFER_EOS,this.onBufferEos,this),e.off(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(O.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(O.Events.FRAG_PARSED,this.onFragParsed,this),e.off(O.Events.FRAG_CHANGED,this.onFragChanged,this)},v._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new y.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},v.onManifestParsed=function(e,s){var a=2;(s.audio&&!s.video||!s.altAudio)&&(a=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=a,this.details=null,x.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},v.onMediaAttaching=function(e,s){var a=this.media=s.media;if(a&&T){var c=this.mediaSource=new T;c.addEventListener("sourceopen",this._onMediaSourceOpen),c.addEventListener("sourceended",this._onMediaSourceEnded),c.addEventListener("sourceclose",this._onMediaSourceClose),a.src=self.URL.createObjectURL(c),this._objectUrl=a.src}},v.onMediaDetaching=function(){var e=this.media,s=this.mediaSource,a=this._objectUrl;if(s){if(x.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(c){x.logger.warn("[buffer-controller]: onMediaDetaching: "+c.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(a&&self.URL.revokeObjectURL(a),e.src===a?(e.removeAttribute("src"),e.load()):x.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(O.Events.MEDIA_DETACHED,void 0)},v.onBufferReset=function(){var e=this;this.getSourceBufferTypes().forEach(function(s){var a=e.sourceBuffer[s];try{a&&(e.removeBufferListeners(s),e.mediaSource&&e.mediaSource.removeSourceBuffer(a),e.sourceBuffer[s]=void 0)}catch(c){x.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",c)}}),this._initSourceBuffer()},v.onBufferCodecs=function(e,s){var a=this,c=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(d){if(c){var o=a.tracks[d];if(o&&typeof o.buffer.changeType=="function"){var f=s[d],u=f.codec,i=f.levelCodec,r=f.container,t=(o.levelCodec||o.codec).replace(w,"$1"),n=(i||u).replace(w,"$1");if(t!==n){var g=r+";codecs="+(i||u);a.appendChangeType(d,g)}}}else a.pendingTracks[d]=s[d]}),c)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},v.appendChangeType=function(e,s){var a=this,c=this.operationQueue,d={execute:function(){var f=a.sourceBuffer[e];f&&(x.logger.log("[buffer-controller]: changing "+e+" sourceBuffer type to "+s),f.changeType(s)),c.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(f){x.logger.warn("[buffer-controller]: Failed to change "+e+" SourceBuffer type",f)}};c.append(d,e)},v.onBufferAppending=function(e,s){var a=this,c=this.hls,d=this.operationQueue,o=this.tracks,f=s.data,u=s.type,i=s.frag,r=s.part,t=s.chunkMeta,n=t.buffering[u],g=self.performance.now();n.start=g;var p=i.stats.buffering,S=r?r.stats.buffering:null;p.start===0&&(p.start=g),S&&S.start===0&&(S.start=g);var k=o.audio,I=u==="audio"&&t.id===1&&(k==null?void 0:k.container)==="audio/mpeg",G={execute:function(){if(n.executeStart=self.performance.now(),I){var J=a.sourceBuffer[u];if(J){var re=i.start-J.timestampOffset;Math.abs(re)>=.1&&(x.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+i.start+" (delta: "+re+") sn: "+i.sn+")"),J.timestampOffset=i.start)}}a.appendExecutor(f,u)},onStart:function(){},onComplete:function(){var J=self.performance.now();n.executeEnd=n.end=J,p.first===0&&(p.first=J),S&&S.first===0&&(S.first=J);var re=a.sourceBuffer,ee={};for(var ae in re)ee[ae]=M.BufferHelper.getBuffered(re[ae]);a.appendError=0,a.hls.trigger(O.Events.BUFFER_APPENDED,{type:u,frag:i,part:r,chunkMeta:t,parent:i.type,timeRanges:ee})},onError:function(J){x.logger.error("[buffer-controller]: Error encountered while trying to append to the "+u+" SourceBuffer",J);var re={type:K.ErrorTypes.MEDIA_ERROR,parent:i.type,details:K.ErrorDetails.BUFFER_APPEND_ERROR,err:J,fatal:!1};J.code===DOMException.QUOTA_EXCEEDED_ERR?re.details=K.ErrorDetails.BUFFER_FULL_ERROR:(a.appendError++,re.details=K.ErrorDetails.BUFFER_APPEND_ERROR,a.appendError>c.config.appendErrorMaxRetry&&(x.logger.error("[buffer-controller]: Failed "+c.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),re.fatal=!0)),c.trigger(O.Events.ERROR,re)}};d.append(G,u)},v.onBufferFlushing=function(e,s){var a=this,c=this.operationQueue,d=function(f){return{execute:a.removeExecutor.bind(a,f,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){a.hls.trigger(O.Events.BUFFER_FLUSHED,{type:f})},onError:function(i){x.logger.warn("[buffer-controller]: Failed to remove from "+f+" SourceBuffer",i)}}};s.type?c.append(d(s.type),s.type):this.getSourceBufferTypes().forEach(function(o){c.append(d(o),o)})},v.onFragParsed=function(e,s){var a=this,c=s.frag,d=s.part,o=[],f=d?d.elementaryStreams:c.elementaryStreams;f[L.ElementaryStreamTypes.AUDIOVIDEO]?o.push("audiovideo"):(f[L.ElementaryStreamTypes.AUDIO]&&o.push("audio"),f[L.ElementaryStreamTypes.VIDEO]&&o.push("video"));var u=function(){var r=self.performance.now();c.stats.buffering.end=r,d&&(d.stats.buffering.end=r);var t=d?d.stats:c.stats;a.hls.trigger(O.Events.FRAG_BUFFERED,{frag:c,part:d,stats:t,id:c.type})};o.length===0&&x.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+c.type+" level: "+c.level+" sn: "+c.sn),this.blockBuffers(u,o)},v.onFragChanged=function(e,s){this.flushBackBuffer()},v.onBufferEos=function(e,s){var a=this,c=this.getSourceBufferTypes().reduce(function(d,o){var f=a.sourceBuffer[o];return(!s.type||s.type===o)&&(f&&!f.ended&&(f.ended=!0,x.logger.log("[buffer-controller]: "+o+" sourceBuffer now EOS"))),d&&!!(!f||f.ended)},!0);c&&this.blockBuffers(function(){var d=a.mediaSource;if(!d||d.readyState!=="open")return;d.endOfStream()})},v.onLevelUpdated=function(e,s){var a=s.details;if(!a.fragments.length)return;this.details=a,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},v.flushBackBuffer=function(){var e=this.hls,s=this.details,a=this.media,c=this.sourceBuffer;if(!a||s===null)return;var d=this.getSourceBufferTypes();if(!d.length)return;var o=s.live&&e.config.liveBackBufferLength!==null?e.config.liveBackBufferLength:e.config.backBufferLength;if(!Object(j.isFiniteNumber)(o)||o<0)return;var f=a.currentTime,u=s.levelTargetDuration,i=Math.max(o,u),r=Math.floor(f/u)*u-i;d.forEach(function(t){var n=c[t];if(n){var g=M.BufferHelper.getBuffered(n);g.length>0&&r>g.start(0)&&(e.trigger(O.Events.BACK_BUFFER_REACHED,{bufferEnd:r}),s.live&&e.trigger(O.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r}),e.trigger(O.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:r,type:t}))}})},v.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var e=this.details,s=this.hls,a=this.media,c=this.mediaSource,d=e.fragments[0].start+e.totalduration,o=a.duration,f=Object(j.isFiniteNumber)(c.duration)?c.duration:0;e.live&&s.config.liveDurationInfinity?(x.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),c.duration=Infinity,this.updateSeekableRange(e)):(d>f&&d>o||!Object(j.isFiniteNumber)(o))&&(x.logger.log("[buffer-controller]: Updating Media Source duration to "+d.toFixed(3)),c.duration=d)},v.updateSeekableRange=function(e){var s=this.mediaSource,a=e.fragments,c=a.length;if(c&&e.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var d=Math.max(0,a[0].start),o=Math.max(d,d+e.totalduration);s.setLiveSeekableRange(d,o)}},v.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,s=this.operationQueue,a=this.pendingTracks,c=Object.keys(a).length;if(c&&!e||c===2){this.createSourceBuffers(a),this.pendingTracks={};var d=this.getSourceBufferTypes();if(d.length===0){this.hls.trigger(O.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}d.forEach(function(o){s.executeNext(o)})}},v.createSourceBuffers=function(e){var s=this.sourceBuffer,a=this.mediaSource;if(!a)throw Error("createSourceBuffers called when mediaSource was null");var c=0;for(var d in e)if(!s[d]){var o=e[d];if(!o)throw Error("source buffer exists for track "+d+", however track does not");var f=o.levelCodec||o.codec,u=o.container+";codecs="+f;x.logger.log("[buffer-controller]: creating sourceBuffer("+u+")");try{var i=s[d]=a.addSourceBuffer(u),r=d;this.addBufferListener(r,"updatestart",this._onSBUpdateStart),this.addBufferListener(r,"updateend",this._onSBUpdateEnd),this.addBufferListener(r,"error",this._onSBUpdateError),this.tracks[d]={buffer:i,codec:f,container:o.container,levelCodec:o.levelCodec,id:o.id},c++}catch(t){x.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+t.message),this.hls.trigger(O.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:t,mimeType:u})}}c&&this.hls.trigger(O.Events.BUFFER_CREATED,{tracks:this.tracks})},v._onSBUpdateStart=function(e){var s=this.operationQueue,a=s.current(e);a.onStart()},v._onSBUpdateEnd=function(e){var s=this.operationQueue,a=s.current(e);a.onComplete(),s.shiftAndExecuteNext(e)},v._onSBUpdateError=function(e,s){x.logger.error("[buffer-controller]: "+e+" SourceBuffer error",s),this.hls.trigger(O.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var a=this.operationQueue.current(e);a&&a.onError(s)},v.removeExecutor=function(e,s,a){var c=this.media,d=this.mediaSource,o=this.operationQueue,f=this.sourceBuffer,u=f[e];if(!c||!d||!u){x.logger.warn("[buffer-controller]: Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),o.shiftAndExecuteNext(e);return}var i=Object(j.isFiniteNumber)(c.duration)?c.duration:Infinity,r=Object(j.isFiniteNumber)(d.duration)?d.duration:Infinity,t=Math.max(0,s),n=Math.min(a,i,r);n>t?(x.logger.log("[buffer-controller]: Removing ["+t+","+n+"] from the "+e+" SourceBuffer"),console.assert(!u.updating,e+" sourceBuffer must not be updating"),u.remove(t,n)):o.shiftAndExecuteNext(e)},v.appendExecutor=function(e,s){var a=this.operationQueue,c=this.sourceBuffer,d=c[s];if(!d){x.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),a.shiftAndExecuteNext(s);return}d.ended=!1,console.assert(!d.updating,s+" sourceBuffer must not be updating"),d.appendBuffer(e)},v.blockBuffers=function(e,s){var a=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){x.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(e);return}var c=this.operationQueue,d=s.map(function(o){return c.appendBlocker(o)});Promise.all(d).then(function(){e(),s.forEach(function(o){var f=a.sourceBuffer[o];(!f||!f.updating)&&c.shiftAndExecuteNext(o)})})},v.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},v.addBufferListener=function(e,s,a){var c=this.sourceBuffer[e];if(!c)return;var d=a.bind(this,e);this.listeners[e].push({event:s,listener:d}),c.addEventListener(s,d)},v.removeBufferListeners=function(e){var s=this.sourceBuffer[e];if(!s)return;this.listeners[e].forEach(function(a){s.removeEventListener(a.event,a.listener)})},b}()},"./src/controller/buffer-operation-queue.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"default",function(){return O});var j=C("./src/utils/logger.ts"),O=function(){function x(M){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=M}var K=x.prototype;return K.append=function(R,L){var y=this.queues[L];y.push(R),y.length===1&&this.buffers[L]&&this.executeNext(L)},K.insertAbort=function(R,L){var y=this.queues[L];y.unshift(R),this.executeNext(L)},K.appendBlocker=function(R){var L,y=new Promise(function(w){L=w}),T={execute:L,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(T,R),y},K.executeNext=function(R){var L=this.buffers,y=this.queues,T=L[R],w=y[R];if(w.length){var E=w[0];try{E.execute()}catch(b){j.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),E.onError(b),(!T||!T.updating)&&(w.shift(),this.executeNext(R))}}},K.shiftAndExecuteNext=function(R){this.queues[R].shift(),this.executeNext(R)},K.current=function(R){return this.queues[R][0]},x}()},"./src/controller/cap-level-controller.ts":function(ve,U,C){"use strict";C.r(U);var j=C("./src/events.ts");function O(M,R){for(var L=0;L<R.length;L++){var y=R[L];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(M,y.key,y)}}function x(M,R,L){return R&&O(M.prototype,R),L&&O(M,L),M}var K=function(){function M(L){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=L,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var R=M.prototype;return R.setStreamController=function(y){this.streamController=y},R.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},R.registerListeners=function(){var y=this.hls;y.on(j.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.on(j.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.on(j.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.unregisterListener=function(){var y=this.hls;y.off(j.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.off(j.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.off(j.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.onFpsDropLevelCapping=function(y,T){M.isLevelAllowed(T.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(T.droppedLevel)},R.onMediaAttaching=function(y,T){this.media=T.media instanceof HTMLVideoElement?T.media:null},R.onManifestParsed=function(y,T){var w=this.hls;this.restrictedLevels=[],this.firstLevel=T.firstLevel,w.config.capLevelToPlayerSize&&T.video&&this.startCapping()},R.onBufferCodecs=function(y,T){var w=this.hls;w.config.capLevelToPlayerSize&&T.video&&this.startCapping()},R.onMediaDetaching=function(){this.stopCapping()},R.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var y=this.hls.levels;if(y.length){var T=this.hls;T.autoLevelCapping=this.getMaxLevel(y.length-1),T.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=T.autoLevelCapping}}},R.getMaxLevel=function(y){var T=this,w=this.hls.levels;if(!w.length)return-1;var E=w.filter(function(b,v){return M.isLevelAllowed(v,T.restrictedLevels)&&v<=y});return this.clientRect=null,M.getMaxLevelByMediaSize(E,this.mediaWidth,this.mediaHeight)},R.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},R.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},R.getDimensions=function(){if(this.clientRect)return this.clientRect;var y=this.media,T={width:0,height:0};if(y){var w=y.getBoundingClientRect();T.width=w.width,T.height=w.height,!T.width&&!T.height&&(T.width=w.right-w.left||y.width||0,T.height=w.bottom-w.top||y.height||0)}return this.clientRect=T,T},M.isLevelAllowed=function(y,T){return T===void 0&&(T=[]),T.indexOf(y)===-1},M.getMaxLevelByMediaSize=function(y,T,w){if(!y||!y.length)return-1;for(var E=function(s,a){return a?s.width!==a.width||s.height!==a.height:!0},b=y.length-1,v=0;v<y.length;v+=1){var l=y[v];if((l.width>=T||l.height>=w)&&E(l,y[v+1])){b=v;break}}return b},x(M,[{key:"mediaWidth",get:function(){return this.getDimensions().width*M.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*M.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var y=1;try{y=self.devicePixelRatio}catch(T){}return y}}]),M}();U.default=K},"./src/controller/cmcd-controller.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"default",function(){return E});var j=C("./src/events.ts"),O=C("./src/types/cmcd.ts"),x=C("./src/utils/buffer-helper.ts"),K=C("./src/utils/logger.ts");function M(b,v){for(var l=0;l<v.length;l++){var e=v[l];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(b,e.key,e)}}function R(b,v,l){return v&&M(b.prototype,v),l&&M(b,l),b}function L(b,v){var l=typeof Symbol!="undefined"&&b[Symbol.iterator]||b["@@iterator"];if(l)return(l=l.call(b)).next.bind(l);if(Array.isArray(b)||(l=y(b))||v&&b&&typeof b.length=="number"){l&&(b=l);var e=0;return function(){return e>=b.length?{done:!0}:{done:!1,value:b[e++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y(b,v){if(!b)return;if(typeof b=="string")return T(b,v);var l=Object.prototype.toString.call(b).slice(8,-1);if(l==="Object"&&b.constructor&&(l=b.constructor.name),l==="Map"||l==="Set")return Array.from(b);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return T(b,v)}function T(b,v){(v==null||v>b.length)&&(v=b.length);for(var l=0,e=new Array(v);l<v;l++)e[l]=b[l];return e}function w(){return w=Object.assign||function(b){for(var v=1;v<arguments.length;v++){var l=arguments[v];for(var e in l)Object.prototype.hasOwnProperty.call(l,e)&&(b[e]=l[e])}return b},w.apply(this,arguments)}var E=function(){function b(l){var e=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){e.initialized&&(e.starved=!0),e.buffering=!0},this.onPlaying=function(){e.initialized||(e.initialized=!0),e.buffering=!1},this.applyPlaylistData=function(c){try{e.apply(c,{ot:O.CMCDObjectType.MANIFEST,su:!e.initialized})}catch(d){K.logger.warn("Could not generate manifest CMCD data.",d)}},this.applyFragmentData=function(c){try{var d=c.frag,o=e.hls.levels[d.level],f=e.getObjectType(d),u={d:d.duration*1e3,ot:f};(f===O.CMCDObjectType.VIDEO||f===O.CMCDObjectType.AUDIO||f==O.CMCDObjectType.MUXED)&&(u.br=o.bitrate/1e3,u.tb=e.getTopBandwidth(f),u.bl=e.getBufferLength(f)),e.apply(c,u)}catch(i){K.logger.warn("Could not generate segment CMCD data.",i)}},this.hls=l;var s=this.config=l.config,a=s.cmcd;a!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=a.sessionId||b.uuid(),this.cid=a.contentId,this.useHeaders=a.useHeaders===!0,this.registerListeners())}var v=b.prototype;return v.registerListeners=function(){var e=this.hls;e.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(j.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.on(j.Events.BUFFER_CREATED,this.onBufferCreated,this)},v.unregisterListeners=function(){var e=this.hls;e.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(j.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.off(j.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},v.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},v.onMediaAttached=function(e,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},v.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},v.onBufferCreated=function(e,s){var a,c;this.audioBuffer=(a=s.tracks.audio)===null||a===void 0?void 0:a.buffer,this.videoBuffer=(c=s.tracks.video)===null||c===void 0?void 0:c.buffer},v.createData=function(){var e;return{v:O.CMCDVersion,sf:O.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)===null||e===void 0?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},v.apply=function(e,s){s===void 0&&(s={}),w(s,this.createData());var a=s.ot===O.CMCDObjectType.INIT||s.ot===O.CMCDObjectType.VIDEO||s.ot===O.CMCDObjectType.MUXED;if(this.starved&&a&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var c=b.toHeaders(s);if(!Object.keys(c).length)return;e.headers||(e.headers={}),w(e.headers,c)}else{var d=b.toQuery(s);if(!d)return;e.url=b.appendQueryToUri(e.url,d)}},v.getObjectType=function(e){var s=e.type;return s==="subtitle"?O.CMCDObjectType.TIMED_TEXT:e.sn==="initSegment"?O.CMCDObjectType.INIT:s==="audio"?O.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?O.CMCDObjectType.VIDEO:O.CMCDObjectType.MUXED:void 0},v.getTopBandwidth=function(e){for(var s=0,a=e===O.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,c=L(a),d;!(d=c()).done;){var o=d.value;o.bitrate>s&&(s=o.bitrate)}return s>0?s:NaN},v.getBufferLength=function(e){var s=this.hls.media,a=e===O.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!a||!s)return NaN;var c=x.BufferHelper.bufferInfo(a,s.currentTime,this.config.maxBufferHole);return c.len*1e3},v.createPlaylistLoader=function(){var e=this.config.pLoader,s=this.applyPlaylistData,a=e||this.config.loader;return function(){function c(o){this.loader=void 0,this.loader=new a(o)}var d=c.prototype;return d.destroy=function(){this.loader.destroy()},d.abort=function(){this.loader.abort()},d.load=function(f,u,i){s(f),this.loader.load(f,u,i)},R(c,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),c}()},v.createFragmentLoader=function(){var e=this.config.fLoader,s=this.applyFragmentData,a=e||this.config.loader;return function(){function c(o){this.loader=void 0,this.loader=new a(o)}var d=c.prototype;return d.destroy=function(){this.loader.destroy()},d.abort=function(){this.loader.abort()},d.load=function(f,u,i){s(f),this.loader.load(f,u,i)},R(c,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),c}()},b.uuid=function(){var e=URL.createObjectURL(new Blob),s=e.toString();return URL.revokeObjectURL(e),s.substr(s.lastIndexOf("/")+1)},b.serialize=function(e){for(var s=[],a=function(I){return!Number.isNaN(I)&&I!=null&&I!==""&&I!==!1},c=function(I){return Math.round(I)},d=function(I){return c(I/100)*100},o=function(I){return encodeURIComponent(I)},f={br:c,d:c,bl:d,dl:d,mtp:d,nor:o,rtp:d,tb:c},u=Object.keys(e||{}).sort(),i=L(u),r;!(r=i()).done;){var t=r.value,n=e[t];if(!a(n))continue;if(t==="v"&&n===1)continue;if(t=="pr"&&n===1)continue;var g=f[t];g&&(n=g(n));var p=typeof n,S=void 0;t==="ot"||t==="sf"||t==="st"?S=t+"="+n:p==="boolean"?S=t:p==="number"?S=t+"="+n:S=t+"="+JSON.stringify(n),s.push(S)}return s.join(",")},b.toHeaders=function(e){for(var s=Object.keys(e),a={},c=["Object","Request","Session","Status"],d=[{},{},{},{}],o={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},f=0,u=s;f<u.length;f++){var i=u[f],r=o[i]!=null?o[i]:1;d[r][i]=e[i]}for(var t=0;t<d.length;t++){var n=b.serialize(d[t]);n&&(a["CMCD-"+c[t]]=n)}return a},b.toQuery=function(e){return"CMCD="+encodeURIComponent(b.serialize(e))},b.appendQueryToUri=function(e,s){if(!s)return e;var a=e.includes("?")?"&":"?";return""+e+a+s},b}()},"./src/controller/eme-controller.ts":function(ve,U,C){"use strict";C.r(U);var j=C("./src/events.ts"),O=C("./src/errors.ts"),x=C("./src/utils/logger.ts"),K=C("./src/utils/mediakeys-helper.ts");function M(E,b){for(var v=0;v<b.length;v++){var l=b[v];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(E,l.key,l)}}function R(E,b,v){return b&&M(E.prototype,b),v&&M(E,v),E}var L=3,y=function(b,v,l){var e={audioCapabilities:[],videoCapabilities:[]};return b.forEach(function(s){e.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:l.audioRobustness||""})}),v.forEach(function(s){e.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:l.videoRobustness||""})}),[e]},T=function(b,v,l,e){switch(b){case K.KeySystems.WIDEVINE:return y(v,l,e);default:throw new Error("Unknown key-system: "+b)}},w=function(){function E(v){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=v,this._config=v.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var b=E.prototype;return b.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},b._registerListeners=function(){this.hls.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(j.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this)},b._unregisterListeners=function(){this.hls.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(j.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this)},b.getLicenseServerUrl=function(l){switch(l){case K.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+l+'"')},b._attemptKeySystemAccess=function(l,e,s){var a=this,c=T(l,e,s,this._drmSystemOptions);x.logger.log("Requesting encrypted media key-system access");var d=this.requestMediaKeySystemAccess(l,c);this.mediaKeysPromise=d.then(function(o){return a._onMediaKeySystemAccessObtained(l,o)}),d.catch(function(o){x.logger.error('Failed to obtain key-system "'+l+'" access:',o)})},b._onMediaKeySystemAccessObtained=function(l,e){var s=this;x.logger.log('Access for key-system "'+l+'" obtained');var a={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:e,mediaKeySystemDomain:l};this._mediaKeysList.push(a);var c=Promise.resolve().then(function(){return e.createMediaKeys()}).then(function(d){return a.mediaKeys=d,x.logger.log('Media-keys created for key-system "'+l+'"'),s._onMediaKeysCreated(),d});return c.catch(function(d){x.logger.error("Failed to create media-keys:",d)}),c},b._onMediaKeysCreated=function(){var l=this;this._mediaKeysList.forEach(function(e){e.mediaKeysSession||(e.mediaKeysSession=e.mediaKeys.createSession(),l._onNewMediaKeySession(e.mediaKeysSession))})},b._onNewMediaKeySession=function(l){var e=this;x.logger.log("New key-system session "+l.sessionId),l.addEventListener("message",function(s){e._onKeySessionMessage(l,s.message)},!1)},b._onKeySessionMessage=function(l,e){x.logger.log("Got EME message event, creating license request"),this._requestLicense(e,function(s){x.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),l.update(s)})},b.onMediaEncrypted=function(l){var e=this;if(x.logger.log('Media is encrypted using "'+l.initDataType+'" init data type'),!this.mediaKeysPromise){x.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(j.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(c){if(!e._media)return;e._attemptSetMediaKeys(c),e._generateRequestWithPreferredKeySession(l.initDataType,l.initData)};this.mediaKeysPromise.then(s).catch(s)},b._attemptSetMediaKeys=function(l){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var e=this._mediaKeysList[0];if(!e||!e.mediaKeys){x.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(j.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}x.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(e.mediaKeys),this._hasSetMediaKeys=!0}},b._generateRequestWithPreferredKeySession=function(l,e){var s=this,a=this._mediaKeysList[0];if(!a){x.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(j.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(a.mediaKeysSessionInitialized){x.logger.warn("Key-Session already initialized but requested again");return}var c=a.mediaKeysSession;if(!c){x.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(j.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!e){x.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(j.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}x.logger.log('Generating key-session request for "'+l+'" init data type'),a.mediaKeysSessionInitialized=!0,c.generateRequest(l,e).then(function(){x.logger.debug("Key-session generation succeeded")}).catch(function(d){x.logger.error("Error generating key-session request:",d),s.hls.trigger(j.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},b._createLicenseXhr=function(l,e,s){var a=new XMLHttpRequest;a.responseType="arraybuffer",a.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,a,l,e,s);var c=this._licenseXhrSetup;if(c)try{c.call(this.hls,a,l),c=void 0}catch(d){x.logger.error(d)}try{a.readyState||a.open("POST",l,!0),c&&c.call(this.hls,a,l)}catch(d){throw new Error("issue setting up KeySystem license XHR "+d)}return a},b._onLicenseRequestReadyStageChange=function(l,e,s,a){switch(l.readyState){case 4:if(l.status===200){this._requestLicenseFailureCount=0,x.logger.log("License request succeeded");var c=l.response,d=this._licenseResponseCallback;if(d)try{c=d.call(this.hls,l,e)}catch(f){x.logger.error(f)}a(c)}else{if(x.logger.error("License Request XHR failed ("+e+"). Status: "+l.status+" ("+l.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>L){this.hls.trigger(j.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var o=L-this._requestLicenseFailureCount+1;x.logger.warn("Retrying license request, "+o+" attempts left"),this._requestLicense(s,a)}break}},b._generateLicenseRequestChallenge=function(l,e){switch(l.mediaKeySystemDomain){case K.KeySystems.WIDEVINE:return e}throw new Error("unsupported key-system: "+l.mediaKeySystemDomain)},b._requestLicense=function(l,e){x.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){x.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(j.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var a=this.getLicenseServerUrl(s.mediaKeySystemDomain),c=this._createLicenseXhr(a,l,e);x.logger.log("Sending license request to URL: "+a);var d=this._generateLicenseRequestChallenge(s,l);c.send(d)}catch(o){x.logger.error("Failure requesting DRM license: "+o),this.hls.trigger(j.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},b.onMediaAttached=function(l,e){if(!this._emeEnabled)return;var s=e.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},b.onMediaDetached=function(){var l=this._media,e=this._mediaKeysList;if(!l)return;l.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(e.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return l.setMediaKeys(null)}).catch(function(){})},b.onManifestParsed=function(l,e){if(!this._emeEnabled)return;var s=e.levels.map(function(c){return c.audioCodec}).filter(function(c){return!!c}),a=e.levels.map(function(c){return c.videoCodec}).filter(function(c){return!!c});this._attemptKeySystemAccess(K.KeySystems.WIDEVINE,s,a)},R(E,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),E}();U.default=w},"./src/controller/fps-controller.ts":function(ve,U,C){"use strict";C.r(U);var j=C("./src/events.ts"),O=C("./src/utils/logger.ts"),x=function(){function K(R){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=R,this.registerListeners()}var M=K.prototype;return M.setStreamController=function(L){this.streamController=L},M.registerListeners=function(){this.hls.on(j.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},M.unregisterListeners=function(){this.hls.off(j.Events.MEDIA_ATTACHING,this.onMediaAttaching)},M.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},M.onMediaAttaching=function(L,y){var T=this.hls.config;if(T.capLevelOnFPSDrop){var w=y.media instanceof self.HTMLVideoElement?y.media:null;this.media=w,w&&typeof w.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),T.fpsDroppedMonitoringPeriod)}},M.checkFPS=function(L,y,T){var w=performance.now();if(y){if(this.lastTime){var E=w-this.lastTime,b=T-this.lastDroppedFrames,v=y-this.lastDecodedFrames,l=1e3*b/E,e=this.hls;if(e.trigger(j.Events.FPS_DROP,{currentDropped:b,currentDecoded:v,totalDroppedFrames:T}),l>0&&b>e.config.fpsDroppedMonitoringThreshold*v){var s=e.currentLevel;O.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(e.autoLevelCapping===-1||e.autoLevelCapping>=s)&&(s=s-1,e.trigger(j.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:e.currentLevel}),e.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=w,this.lastDroppedFrames=T,this.lastDecodedFrames=y}},M.checkFPSInterval=function(){var L=this.media;if(L)if(this.isVideoPlaybackQualityAvailable){var y=L.getVideoPlaybackQuality();this.checkFPS(L,y.totalVideoFrames,y.droppedVideoFrames)}else this.checkFPS(L,L.webkitDecodedFrameCount,L.webkitDroppedFrameCount)},K}();U.default=x},"./src/controller/fragment-finders.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"findFragmentByPDT",function(){return x}),C.d(U,"findFragmentByPTS",function(){return K}),C.d(U,"fragmentWithinToleranceTest",function(){return M}),C.d(U,"pdtWithinToleranceTest",function(){return R}),C.d(U,"findFragWithCC",function(){return L});var j=C("./src/polyfills/number.ts"),O=C("./src/utils/binary-search.ts");function x(y,T,w){if(T===null||!Array.isArray(y)||!y.length||!Object(j.isFiniteNumber)(T))return null;var E=y[0].programDateTime;if(T<(E||0))return null;var b=y[y.length-1].endProgramDateTime;if(T>=(b||0))return null;w=w||0;for(var v=0;v<y.length;++v){var l=y[v];if(R(T,w,l))return l}return null}function K(y,T,w,E){w===void 0&&(w=0),E===void 0&&(E=0);var b=null;if(y?b=T[y.sn-T[0].sn+1]||null:w===0&&T[0].start===0&&(b=T[0]),b&&M(w,E,b)===0)return b;var v=O.default.search(T,M.bind(null,w,E));return v||b}function M(y,T,w){y===void 0&&(y=0),T===void 0&&(T=0);var E=Math.min(T,w.duration+(w.deltaPTS?w.deltaPTS:0));return w.start+w.duration-E<=y?1:w.start-E>y&&w.start?-1:0}function R(y,T,w){var E=Math.min(T,w.duration+(w.deltaPTS?w.deltaPTS:0))*1e3,b=w.endProgramDateTime||0;return b-E>y}function L(y,T){return O.default.search(y,function(w){return w.cc<T?1:w.cc>T?-1:0})}},"./src/controller/fragment-tracker.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"FragmentState",function(){return x}),C.d(U,"FragmentTracker",function(){return K});var j=C("./src/events.ts"),O=C("./src/types/loader.ts"),x;(function(L){L.NOT_LOADED="NOT_LOADED",L.BACKTRACKED="BACKTRACKED",L.APPENDING="APPENDING",L.PARTIAL="PARTIAL",L.OK="OK"})(x||(x={}));var K=function(){function L(T){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=T,this._registerListeners()}var y=L.prototype;return y._registerListeners=function(){var w=this.hls;w.on(j.Events.BUFFER_APPENDED,this.onBufferAppended,this),w.on(j.Events.FRAG_BUFFERED,this.onFragBuffered,this),w.on(j.Events.FRAG_LOADED,this.onFragLoaded,this)},y._unregisterListeners=function(){var w=this.hls;w.off(j.Events.BUFFER_APPENDED,this.onBufferAppended,this),w.off(j.Events.FRAG_BUFFERED,this.onFragBuffered,this),w.off(j.Events.FRAG_LOADED,this.onFragLoaded,this)},y.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},y.getAppendedFrag=function(w,E){if(E===O.PlaylistLevelType.MAIN){var b=this.activeFragment,v=this.activeParts;if(!b)return null;if(v)for(var l=v.length;l--;){var e=v[l],s=e?e.end:b.appendedPTS;if(e.start<=w&&s!==void 0&&w<=s)return l>9&&(this.activeParts=v.slice(l-9)),e}else if(b.start<=w&&b.appendedPTS!==void 0&&w<=b.appendedPTS)return b}return this.getBufferedFrag(w,E)},y.getBufferedFrag=function(w,E){for(var b=this.fragments,v=Object.keys(b),l=v.length;l--;){var e=b[v[l]];if((e==null?void 0:e.body.type)===E&&e.buffered){var s=e.body;if(s.start<=w&&w<=s.end)return s}}return null},y.detectEvictedFragments=function(w,E,b){var v=this;Object.keys(this.fragments).forEach(function(l){var e=v.fragments[l];if(!e)return;if(!e.buffered){e.body.type===b&&v.removeFragment(e.body);return}var s=e.range[w];if(!s)return;s.time.some(function(a){var c=!v.isTimeBuffered(a.startPTS,a.endPTS,E);return c&&v.removeFragment(e.body),c})})},y.detectPartialFragments=function(w){var E=this,b=this.timeRanges,v=w.frag,l=w.part;if(!b||v.sn==="initSegment")return;var e=R(v),s=this.fragments[e];if(!s)return;Object.keys(b).forEach(function(a){var c=v.elementaryStreams[a];if(!c)return;var d=b[a],o=l!==null||c.partial===!0;s.range[a]=E.getBufferedTimes(v,l,o,d)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},y.fragBuffered=function(w){var E=R(w),b=this.fragments[E];b&&(b.backtrack=b.loaded=null,b.buffered=!0)},y.getBufferedTimes=function(w,E,b,v){for(var l={time:[],partial:b},e=E?E.start:w.start,s=E?E.end:w.end,a=w.minEndPTS||s,c=w.maxStartPTS||e,d=0;d<v.length;d++){var o=v.start(d)-this.bufferPadding,f=v.end(d)+this.bufferPadding;if(c>=o&&a<=f){l.time.push({startPTS:Math.max(e,v.start(d)),endPTS:Math.min(s,v.end(d))});break}else if(e<f&&s>o)l.partial=!0,l.time.push({startPTS:Math.max(e,v.start(d)),endPTS:Math.min(s,v.end(d))});else if(s<=o)break}return l},y.getPartialFragment=function(w){var E=null,b,v,l,e=0,s=this.bufferPadding,a=this.fragments;return Object.keys(a).forEach(function(c){var d=a[c];if(!d)return;M(d)&&(v=d.body.start-s,l=d.body.end+s,w>=v&&w<=l&&(b=Math.min(w-v,l-w),e<=b&&(E=d.body,e=b)))}),E},y.getState=function(w){var E=R(w),b=this.fragments[E];return b?b.buffered?M(b)?x.PARTIAL:x.OK:b.backtrack?x.BACKTRACKED:x.APPENDING:x.NOT_LOADED},y.backtrack=function(w,E){var b=R(w),v=this.fragments[b];if(!v||v.backtrack)return null;var l=v.backtrack=E||v.loaded;return v.loaded=null,l},y.getBacktrackData=function(w){var E=R(w),b=this.fragments[E];if(b){var v,l=b.backtrack;if(l!=null&&(v=l.payload)!==null&&v!==void 0&&v.byteLength)return l;this.removeFragment(w)}return null},y.isTimeBuffered=function(w,E,b){for(var v,l,e=0;e<b.length;e++){if(v=b.start(e)-this.bufferPadding,l=b.end(e)+this.bufferPadding,w>=v&&E<=l)return!0;if(E<=v)return!1}return!1},y.onFragLoaded=function(w,E){var b=E.frag,v=E.part;if(b.sn==="initSegment"||b.bitrateTest||v)return;var l=R(b);this.fragments[l]={body:b,loaded:E,backtrack:null,buffered:!1,range:Object.create(null)}},y.onBufferAppended=function(w,E){var b=this,v=E.frag,l=E.part,e=E.timeRanges;if(v.type===O.PlaylistLevelType.MAIN)if(this.activeFragment=v,l){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(l)}else this.activeParts=null;this.timeRanges=e,Object.keys(e).forEach(function(a){var c=e[a];if(b.detectEvictedFragments(a,c),!l)for(var d=0;d<c.length;d++)v.appendedPTS=Math.max(c.end(d),v.appendedPTS||0)})},y.onFragBuffered=function(w,E){this.detectPartialFragments(E)},y.hasFragment=function(w){var E=R(w);return!!this.fragments[E]},y.removeFragmentsInRange=function(w,E,b){var v=this;Object.keys(this.fragments).forEach(function(l){var e=v.fragments[l];if(!e)return;if(e.buffered){var s=e.body;s.type===b&&s.start<E&&s.end>w&&v.removeFragment(s)}})},y.removeFragment=function(w){var E=R(w);w.stats.loaded=0,w.clearElementaryStreamInfo(),delete this.fragments[E]},y.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},L}();function M(L){var y,T;return L.buffered&&(((y=L.range.video)===null||y===void 0?void 0:y.partial)||((T=L.range.audio)===null||T===void 0?void 0:T.partial))}function R(L){return L.type+"_"+L.level+"_"+L.urlId+"_"+L.sn}},"./src/controller/gap-controller.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"STALL_MINIMUM_DURATION_MS",function(){return M}),C.d(U,"MAX_START_GAP_JUMP",function(){return R}),C.d(U,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return L}),C.d(U,"SKIP_BUFFER_RANGE_START",function(){return y}),C.d(U,"default",function(){return T});var j=C("./src/utils/buffer-helper.ts"),O=C("./src/errors.ts"),x=C("./src/events.ts"),K=C("./src/utils/logger.ts"),M=250,R=2,L=.1,y=.05,T=function(){function w(b,v,l,e){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=b,this.media=v,this.fragmentTracker=l,this.hls=e}var E=w.prototype;return E.destroy=function(){this.hls=this.fragmentTracker=this.media=null},E.poll=function(v){var l=this.config,e=this.media,s=this.stalled,a=e.currentTime,c=e.seeking,d=this.seeking&&!c,o=!this.seeking&&c;if(this.seeking=c,a!==v){if(this.moved=!0,s!==null){if(this.stallReported){var f=self.performance.now()-s;K.logger.warn("playback not stuck anymore @"+a+", after "+Math.round(f)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((o||d)&&(this.stalled=null),e.paused||e.ended||e.playbackRate===0||!j.BufferHelper.getBuffered(e).length)return;var u=j.BufferHelper.bufferInfo(e,a,0),i=u.len>0,r=u.nextStart||0;if(!i&&!r)return;if(c){var t=u.len>R,n=!r||r-a>R&&!this.fragmentTracker.getPartialFragment(a);if(t||n)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var g,p=Math.max(r,u.start||0)-a,S=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,k=S==null||((g=S.details)===null||g===void 0)?void 0:g.live,I=k?S.details.targetduration*2:R;if(p>0&&p<=I){this._trySkipBufferHole(null);return}}var G=self.performance.now();if(s===null){this.stalled=G;return}var V=G-s;!c&&V>=M&&this._reportStall(u.len);var J=j.BufferHelper.bufferInfo(e,a,l.maxBufferHole);this._tryFixBufferStall(J,V)},E._tryFixBufferStall=function(v,l){var e=this.config,s=this.fragmentTracker,a=this.media,c=a.currentTime,d=s.getPartialFragment(c);if(d){var o=this._trySkipBufferHole(d);if(o)return}v.len>e.maxBufferHole&&l>e.highBufferWatchdogPeriod*1e3&&(K.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},E._reportStall=function(v){var l=this.hls,e=this.media,s=this.stallReported;s||(this.stallReported=!0,K.logger.warn("Playback stalling at @"+e.currentTime+" due to low buffer (buffer="+v+")"),l.trigger(x.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:v}))},E._trySkipBufferHole=function(v){for(var l=this.config,e=this.hls,s=this.media,a=s.currentTime,c=0,d=j.BufferHelper.getBuffered(s),o=0;o<d.length;o++){var f=d.start(o);if(a+l.maxBufferHole>=c&&a<f){var u=Math.max(f+y,s.currentTime+L);return K.logger.warn("skipping hole, adjusting currentTime from "+a+" to "+u),this.moved=!0,this.stalled=null,s.currentTime=u,v&&e.trigger(x.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+a+" to "+u,frag:v}),u}c=d.end(o)}return 0},E._tryNudgeBuffer=function(){var v=this.config,l=this.hls,e=this.media,s=e.currentTime,a=(this.nudgeRetry||0)+1;if(this.nudgeRetry=a,a<v.nudgeMaxRetry){var c=s+a*v.nudgeOffset;K.logger.warn("Nudging 'currentTime' from "+s+" to "+c),e.currentTime=c,l.trigger(x.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else K.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+v.nudgeMaxRetry+" nudges"),l.trigger(x.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},w}()},"./src/controller/id3-track-controller.ts":function(ve,U,C){"use strict";C.r(U);var j=C("./src/events.ts"),O=C("./src/utils/texttrack-utils.ts"),x=C("./src/demux/id3.ts"),K=.25,M=function(){function R(y){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=y,this._registerListeners()}var L=R.prototype;return L.destroy=function(){this._unregisterListeners()},L._registerListeners=function(){var T=this.hls;T.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.on(j.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),T.on(j.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L._unregisterListeners=function(){var T=this.hls;T.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.off(j.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),T.off(j.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L.onMediaAttached=function(T,w){this.media=w.media},L.onMediaDetaching=function(){if(!this.id3Track)return;Object(O.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},L.getID3Track=function(T){if(!this.media)return;for(var w=0;w<T.length;w++){var E=T[w];if(E.kind==="metadata"&&E.label==="id3")return Object(O.sendAddTrackEvent)(E,this.media),E}return this.media.addTextTrack("metadata","id3")},L.onFragParsingMetadata=function(T,w){if(!this.media)return;var E=w.frag,b=w.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var v=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,l=0;l<b.length;l++){var e=x.getID3Frames(b[l].data);if(e){var s=b[l].pts,a=l<b.length-1?b[l+1].pts:E.end,c=a-s;c<=0&&(a=s+K);for(var d=0;d<e.length;d++){var o=e[d];if(!x.isTimeStampFrame(o)){var f=new v(s,a,"");f.value=o,this.id3Track.addCue(f)}}}}},L.onBufferFlushing=function(T,w){var E=w.startOffset,b=w.endOffset,v=w.type;if(!v||v==="audio"){var l=this.id3Track;l&&Object(O.removeCuesInRange)(l,E,b)}},R}();U.default=M},"./src/controller/latency-controller.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"default",function(){return R});var j=C("./src/errors.ts"),O=C("./src/events.ts"),x=C("./src/utils/logger.ts");function K(L,y){for(var T=0;T<y.length;T++){var w=y[T];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(L,w.key,w)}}function M(L,y,T){return y&&K(L.prototype,y),T&&K(L,T),L}var R=function(){function L(T){var w=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return w.timeupdate()},this.hls=T,this.config=T.config,this.registerListeners()}var y=L.prototype;return y.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},y.registerListeners=function(){this.hls.on(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(O.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(O.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){this.hls.off(O.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(O.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(O.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(O.Events.ERROR,this.onError)},y.onMediaAttached=function(w,E){this.media=E.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},y.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},y.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},y.onLevelUpdated=function(w,E){var b=E.details;this.levelDetails=b,b.advanced&&this.timeupdate(),!b.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},y.onError=function(w,E){if(E.details!==j.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,x.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},y.timeupdate=function(){var w=this.media,E=this.levelDetails;if(!w||!E)return;this.currentTime=w.currentTime;var b=this.computeLatency();if(b===null)return;this._latency=b;var v=this.config,l=v.lowLatencyMode,e=v.maxLiveSyncPlaybackRate;if(!l||e===1)return;var s=this.targetLatency;if(s===null)return;var a=b-s,c=Math.min(this.maxLatency,s+E.targetduration),d=a<c;if(E.live&&d&&a>.05&&this.forwardBufferLength>1){var o=Math.min(2,Math.max(1,e)),f=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20;w.playbackRate=Math.min(o,Math.max(1,f))}else w.playbackRate!==1&&w.playbackRate!==0&&(w.playbackRate=1)},y.estimateLiveEdge=function(){var w=this.levelDetails;return w===null?null:w.edge+w.age},y.computeLatency=function(){var w=this.estimateLiveEdge();return w===null?null:w-this.currentTime},M(L,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var w=this.config,E=this.levelDetails;return w.liveMaxLatencyDuration!==void 0?w.liveMaxLatencyDuration:E?w.liveMaxLatencyDurationCount*E.targetduration:0}},{key:"targetLatency",get:function(){var w=this.levelDetails;if(w===null)return null;var E=w.holdBack,b=w.partHoldBack,v=w.targetduration,l=this.config,e=l.liveSyncDuration,s=l.liveSyncDurationCount,a=l.lowLatencyMode,c=this.hls.userConfig,d=a&&b||E;(c.liveSyncDuration||c.liveSyncDurationCount||d===0)&&(d=e!==void 0?e:s*v);var o=v,f=1;return d+Math.min(this.stallCount*f,o)}},{key:"liveSyncPosition",get:function(){var w=this.estimateLiveEdge(),E=this.targetLatency,b=this.levelDetails;if(w===null||E===null||b===null)return null;var v=b.edge,l=w-E-this.edgeStalled,e=v-b.totalduration,s=v-(this.config.lowLatencyMode&&b.partTarget||b.targetduration);return Math.min(Math.max(e,l),s)}},{key:"drift",get:function(){var w=this.levelDetails;return w===null?1:w.drift}},{key:"edgeStalled",get:function(){var w=this.levelDetails;if(w===null)return 0;var E=(this.config.lowLatencyMode&&w.partTarget||w.targetduration)*3;return Math.max(w.age-E,0)}},{key:"forwardBufferLength",get:function(){var w=this.media,E=this.levelDetails;if(!w||!E)return 0;var b=w.buffered.length;return b?w.buffered.end(b-1):E.edge-this.currentTime}}]),L}()},"./src/controller/level-controller.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"default",function(){return l});var j=C("./src/types/level.ts"),O=C("./src/events.ts"),x=C("./src/errors.ts"),K=C("./src/utils/codecs.ts"),M=C("./src/controller/level-helper.ts"),R=C("./src/controller/base-playlist-controller.ts"),L=C("./src/types/loader.ts");function y(){return y=Object.assign||function(e){for(var s=1;s<arguments.length;s++){var a=arguments[s];for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(e[c]=a[c])}return e},y.apply(this,arguments)}function T(e,s){for(var a=0;a<s.length;a++){var c=s[a];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(e,c.key,c)}}function w(e,s,a){return s&&T(e.prototype,s),a&&T(e,a),e}function E(e,s){e.prototype=Object.create(s.prototype),e.prototype.constructor=e,b(e,s)}function b(e,s){return b=Object.setPrototypeOf||function(c,d){return c.__proto__=d,c},b(e,s)}var v=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),l=function(e){E(s,e);function s(c){var d;return d=e.call(this,c,"[level-controller]")||this,d._levels=[],d._firstLevel=-1,d._startLevel=void 0,d.currentLevelIndex=-1,d.manualLevelIndex=-1,d.onParsedComplete=void 0,d._registerListeners(),d}var a=s.prototype;return a._registerListeners=function(){var d=this.hls;d.on(O.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(O.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),d.on(O.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(O.Events.ERROR,this.onError,this)},a._unregisterListeners=function(){var d=this.hls;d.off(O.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(O.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),d.off(O.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(O.Events.ERROR,this.onError,this)},a.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,e.prototype.destroy.call(this)},a.startLoad=function(){var d=this._levels;d.forEach(function(o){o.loadError=0}),e.prototype.startLoad.call(this)},a.onManifestLoaded=function(d,o){var f=[],u=[],i=[],r,t={},n,g=!1,p=!1,S=!1;if(o.levels.forEach(function(V){var J=V.attrs;g=g||!!(V.width&&V.height),p=p||!!V.videoCodec,S=S||!!V.audioCodec,v&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var re=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;n=t[re],n?n.url.push(V.url):(n=new j.Level(V),t[re]=n,f.push(n)),J&&(J.AUDIO&&Object(M.addGroupId)(n,"audio",J.AUDIO),J.SUBTITLES&&Object(M.addGroupId)(n,"text",J.SUBTITLES))}),(g||p)&&S&&(f=f.filter(function(V){var J=V.videoCodec,re=V.width,ee=V.height;return!!J||!!(re&&ee)})),f=f.filter(function(V){var J=V.audioCodec,re=V.videoCodec;return(!J||Object(K.isCodecSupportedInMp4)(J,"audio"))&&(!re||Object(K.isCodecSupportedInMp4)(re,"video"))}),o.audioTracks&&(u=o.audioTracks.filter(function(V){return!V.audioCodec||Object(K.isCodecSupportedInMp4)(V.audioCodec,"audio")}),Object(M.assignTrackIdsByGroup)(u)),o.subtitles&&(i=o.subtitles,Object(M.assignTrackIdsByGroup)(i)),f.length>0){r=f[0].bitrate,f.sort(function(V,J){return V.bitrate-J.bitrate}),this._levels=f;for(var k=0;k<f.length;k++)if(f[k].bitrate===r){this._firstLevel=k,this.log("manifest loaded, "+f.length+" level(s) found, first bitrate: "+r);break}var I=S&&!p,G={levels:f,audioTracks:u,subtitleTracks:i,firstLevel:this._firstLevel,stats:o.stats,audio:S,video:p,altAudio:!I&&u.some(function(V){return!!V.url})};this.hls.trigger(O.Events.MANIFEST_PARSED,G),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(O.Events.ERROR,{type:x.ErrorTypes.MEDIA_ERROR,details:x.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:o.url,reason:"no level with compatible codecs found in manifest"})},a.onError=function(d,o){if(e.prototype.onError.call(this,d,o),o.fatal)return;var f=o.context,u=this._levels[this.currentLevelIndex];if(f&&(f.type===L.PlaylistContextType.AUDIO_TRACK&&u.audioGroupIds&&f.groupId===u.audioGroupIds[u.urlId]||f.type===L.PlaylistContextType.SUBTITLE_TRACK&&u.textGroupIds&&f.groupId===u.textGroupIds[u.urlId])){this.redundantFailover(this.currentLevelIndex);return}var i=!1,r=!0,t;switch(o.details){case x.ErrorDetails.FRAG_LOAD_ERROR:case x.ErrorDetails.FRAG_LOAD_TIMEOUT:case x.ErrorDetails.KEY_LOAD_ERROR:case x.ErrorDetails.KEY_LOAD_TIMEOUT:if(o.frag){var n=this._levels[o.frag.level];n?(n.fragmentError++,n.fragmentError>this.hls.config.fragLoadingMaxRetry&&(t=o.frag.level)):t=o.frag.level}break;case x.ErrorDetails.LEVEL_LOAD_ERROR:case x.ErrorDetails.LEVEL_LOAD_TIMEOUT:f&&(f.deliveryDirectives&&(r=!1),t=f.level),i=!0;break;case x.ErrorDetails.REMUX_ALLOC_ERROR:t=o.level,i=!0;break}t!==void 0&&this.recoverLevel(o,t,i,r)},a.recoverLevel=function(d,o,f,u){var i=d.details,r=this._levels[o];if(r.loadError++,f){var t=this.retryLoadingOrFail(d);if(t)d.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(u){var n=r.url.length;if(n>1&&r.loadError<n)d.levelRetry=!0,this.redundantFailover(o);else if(this.manualLevelIndex===-1){var g=o===0?this._levels.length-1:o-1;this.currentLevelIndex!==g&&this._levels[g].loadError===0&&(this.warn(i+": switch to "+g),d.levelRetry=!0,this.hls.nextAutoLevel=g)}}},a.redundantFailover=function(d){var o=this._levels[d],f=o.url.length;if(f>1){var u=(o.urlId+1)%f;this.warn("Switching to redundant URL-id "+u),this._levels.forEach(function(i){i.urlId=u}),this.level=d}},a.onFragLoaded=function(d,o){var f=o.frag;if(f!==void 0&&f.type===L.PlaylistLevelType.MAIN){var u=this._levels[f.level];u!==void 0&&(u.fragmentError=0,u.loadError=0)}},a.onLevelLoaded=function(d,o){var f,u=o.level,i=o.details,r=this._levels[u];if(!r){var t;this.warn("Invalid level index "+u),(t=o.deliveryDirectives)!==null&&t!==void 0&&t.skip&&(i.deltaUpdateFailed=!0);return}u===this.currentLevelIndex?(r.fragmentError===0&&(r.loadError=0,this.retryCount=0),this.playlistLoaded(u,o,r.details)):(f=o.deliveryDirectives)!==null&&f!==void 0&&f.skip&&(i.deltaUpdateFailed=!0)},a.onAudioTrackSwitched=function(d,o){var f=this.hls.levels[this.currentLevelIndex];if(!f)return;if(f.audioGroupIds){for(var u=-1,i=this.hls.audioTracks[o.id].groupId,r=0;r<f.audioGroupIds.length;r++)if(f.audioGroupIds[r]===i){u=r;break}u!==f.urlId&&(f.urlId=u,this.startLoad())}},a.loadPlaylist=function(d){var o=this.currentLevelIndex,f=this._levels[o];if(this.canLoad&&f&&f.url.length>0){var u=f.urlId,i=f.url[u];if(d)try{i=d.addDirectives(i)}catch(r){this.warn("Could not construct new URL with HLS Delivery Directives: "+r)}this.log("Attempt loading level index "+o+(d?" at sn "+d.msn+" part "+d.part:"")+" with URL-id "+u+" "+i),this.clearTimer(),this.hls.trigger(O.Events.LEVEL_LOADING,{url:i,level:o,id:u,deliveryDirectives:d||null})}},a.removeLevel=function(d,o){var f=function(r,t){return t!==o},u=this._levels.filter(function(i,r){return r!==d?!0:i.url.length>1&&o!==void 0?(i.url=i.url.filter(f),i.audioGroupIds&&(i.audioGroupIds=i.audioGroupIds.filter(f)),i.textGroupIds&&(i.textGroupIds=i.textGroupIds.filter(f)),i.urlId=0,!0):!1}).map(function(i,r){var t=i.details;return t!=null&&t.fragments&&t.fragments.forEach(function(n){n.level=r}),i});this._levels=u,this.hls.trigger(O.Events.LEVELS_UPDATED,{levels:u})},w(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(d){var o,f=this._levels;if(f.length===0)return;if(this.currentLevelIndex===d&&(o=f[d])!==null&&o!==void 0&&o.details)return;if(d<0||d>=f.length){var u=d<0;if(this.hls.trigger(O.Events.ERROR,{type:x.ErrorTypes.OTHER_ERROR,details:x.ErrorDetails.LEVEL_SWITCH_ERROR,level:d,fatal:u,reason:"invalid level idx"}),u)return;d=Math.min(d,f.length-1)}this.clearTimer();var i=this.currentLevelIndex,r=f[i],t=f[d];this.log("switching to level "+d+" from "+i),this.currentLevelIndex=d;var n=y({},t,{level:d,maxBitrate:t.maxBitrate,uri:t.uri,urlId:t.urlId});delete n._urlId,this.hls.trigger(O.Events.LEVEL_SWITCHING,n);var g=t.details;if(!g||g.live){var p=this.switchParams(t.uri,r==null?void 0:r.details);this.loadPlaylist(p)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(d){this.manualLevelIndex=d,this._startLevel===void 0&&(this._startLevel=d),d!==-1&&(this.level=d)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(d){this._firstLevel=d}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var d=this.hls.config.startLevel;return d!==void 0?d:this._firstLevel}else return this._startLevel},set:function(d){this._startLevel=d}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(d){this.level=d,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=d)}}]),s}(R.default)},"./src/controller/level-helper.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"addGroupId",function(){return x}),C.d(U,"assignTrackIdsByGroup",function(){return K}),C.d(U,"updatePTS",function(){return M}),C.d(U,"updateFragPTSDTS",function(){return L}),C.d(U,"mergeDetails",function(){return y}),C.d(U,"mapPartIntersection",function(){return T}),C.d(U,"mapFragmentIntersection",function(){return w}),C.d(U,"adjustSliding",function(){return E}),C.d(U,"addSliding",function(){return b}),C.d(U,"computeReloadInterval",function(){return v}),C.d(U,"getFragmentWithSN",function(){return l}),C.d(U,"getPartWith",function(){return e});var j=C("./src/polyfills/number.ts"),O=C("./src/utils/logger.ts");function x(s,a,c){switch(a){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(c);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(c);break}}function K(s){var a={};s.forEach(function(c){var d=c.groupId||"";c.id=a[d]=a[d]||0,a[d]++})}function M(s,a,c){var d=s[a],o=s[c];R(d,o)}function R(s,a){var c=a.startPTS;if(Object(j.isFiniteNumber)(c)){var d=0,o;a.sn>s.sn?(d=c-s.start,o=s):(d=s.start-c,o=a),o.duration!==d&&(o.duration=d)}else if(a.sn>s.sn){var f=s.cc===a.cc;f&&s.minEndPTS?a.start=s.start+(s.minEndPTS-s.start):a.start=s.start+s.duration}else a.start=Math.max(s.start-a.duration,0)}function L(s,a,c,d,o,f){var u=d-c;u<=0&&(O.logger.warn("Fragment should have a positive duration",a),d=c+a.duration,f=o+a.duration);var i=c,r=d,t=a.startPTS,n=a.endPTS;if(Object(j.isFiniteNumber)(t)){var g=Math.abs(t-c);Object(j.isFiniteNumber)(a.deltaPTS)?a.deltaPTS=Math.max(g,a.deltaPTS):a.deltaPTS=g,i=Math.max(c,t),c=Math.min(c,t),o=Math.min(o,a.startDTS),r=Math.min(d,n),d=Math.max(d,n),f=Math.max(f,a.endDTS)}a.duration=d-c;var p=c-a.start;a.appendedPTS=d,a.start=a.startPTS=c,a.maxStartPTS=i,a.startDTS=o,a.endPTS=d,a.minEndPTS=r,a.endDTS=f;var S=a.sn;if(!s||S<s.startSN||S>s.endSN)return 0;var k,I=S-s.startSN,G=s.fragments;for(G[I]=a,k=I;k>0;k--)R(G[k],G[k-1]);for(k=I;k<G.length-1;k++)R(G[k],G[k+1]);return s.fragmentHint&&R(G[G.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,p}function y(s,a){for(var c=null,d=s.fragments,o=d.length-1;o>=0;o--){var f=d[o].initSegment;if(f){c=f;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var u=0,i;if(w(s,a,function(k,I){k.relurl&&(u=k.cc-I.cc),Object(j.isFiniteNumber)(k.startPTS)&&Object(j.isFiniteNumber)(k.endPTS)&&(I.start=I.startPTS=k.startPTS,I.startDTS=k.startDTS,I.appendedPTS=k.appendedPTS,I.maxStartPTS=k.maxStartPTS,I.endPTS=k.endPTS,I.endDTS=k.endDTS,I.minEndPTS=k.minEndPTS,I.duration=k.endPTS-k.startPTS,I.duration&&(i=I),a.PTSKnown=a.alignedSliding=!0),I.elementaryStreams=k.elementaryStreams,I.loader=k.loader,I.stats=k.stats,I.urlId=k.urlId,k.initSegment&&(I.initSegment=k.initSegment,c=k.initSegment)}),c){var r=a.fragmentHint?a.fragments.concat(a.fragmentHint):a.fragments;r.forEach(function(k){var I;(!k.initSegment||k.initSegment.relurl===((I=c)===null||I===void 0?void 0:I.relurl))&&(k.initSegment=c)})}if(a.skippedSegments&&(a.deltaUpdateFailed=a.fragments.some(function(k){return!k}),a.deltaUpdateFailed)){O.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var t=a.skippedSegments;t--;)a.fragments.shift();a.startSN=a.fragments[0].sn,a.startCC=a.fragments[0].cc}var n=a.fragments;if(u){O.logger.warn("discontinuity sliding from playlist, take drift into account");for(var g=0;g<n.length;g++)n[g].cc+=u}a.skippedSegments&&(a.startCC=a.fragments[0].cc),T(s.partList,a.partList,function(k,I){I.elementaryStreams=k.elementaryStreams,I.stats=k.stats}),i?L(a,i,i.startPTS,i.endPTS,i.startDTS,i.endDTS):E(s,a),n.length&&(a.totalduration=a.edge-n[0].start),a.driftStartTime=s.driftStartTime,a.driftStart=s.driftStart;var p=a.advancedDateTime;if(a.advanced&&p){var S=a.edge;a.driftStart||(a.driftStartTime=p,a.driftStart=S),a.driftEndTime=p,a.driftEnd=S}else a.driftEndTime=s.driftEndTime,a.driftEnd=s.driftEnd,a.advancedDateTime=s.advancedDateTime}function T(s,a,c){if(s&&a)for(var d=0,o=0,f=s.length;o<=f;o++){var u=s[o],i=a[o+d];u&&i&&u.index===i.index&&u.fragment.sn===i.fragment.sn?c(u,i):d--}}function w(s,a,c){for(var d=a.skippedSegments,o=Math.max(s.startSN,a.startSN)-a.startSN,f=(s.fragmentHint?1:0)+(d?a.endSN:Math.min(s.endSN,a.endSN))-a.startSN,u=a.startSN-s.startSN,i=a.fragmentHint?a.fragments.concat(a.fragmentHint):a.fragments,r=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,t=o;t<=f;t++){var n=r[u+t],g=i[t];d&&!g&&t<d&&(g=a.fragments[t]=n),n&&g&&c(n,g)}}function E(s,a){var c=a.startSN+a.skippedSegments-s.startSN,d=s.fragments;if(c<0||c>=d.length)return;b(a,d[c].start)}function b(s,a){if(a){for(var c=s.fragments,d=s.skippedSegments;d<c.length;d++)c[d].start+=a;s.fragmentHint&&(s.fragmentHint.start+=a)}}function v(s,a){var c=1e3*s.levelTargetDuration,d=c/2,o=s.age,f=o>0&&o<c*3,u=a.loading.end-a.loading.start,i,r=s.availabilityDelay;if(s.updated===!1)if(f){var t=333*s.misses;i=Math.max(Math.min(d,u*2),t),s.availabilityDelay=(s.availabilityDelay||0)+i}else i=d;else f?(r=Math.min(r||c/2,o),s.availabilityDelay=r,i=r+c-o):i=c-u;return Math.round(i)}function l(s,a,c){if(!s||!s.details)return null;var d=s.details,o=d.fragments[a-d.startSN];return o||(o=d.fragmentHint,o&&o.sn===a?o:a<d.startSN&&c&&c.sn===a?c:null)}function e(s,a,c){if(!s||!s.details)return null;var d=s.details.partList;if(d)for(var o=d.length;o--;){var f=d[o];if(f.index===c&&f.fragment.sn===a)return f}return null}},"./src/controller/stream-controller.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"default",function(){return d});var j=C("./src/polyfills/number.ts"),O=C("./src/controller/base-stream-controller.ts"),x=C("./src/is-supported.ts"),K=C("./src/events.ts"),M=C("./src/utils/buffer-helper.ts"),R=C("./src/controller/fragment-tracker.ts"),L=C("./src/types/loader.ts"),y=C("./src/loader/fragment.ts"),T=C("./src/demux/transmuxer-interface.ts"),w=C("./src/types/transmuxer.ts"),E=C("./src/controller/gap-controller.ts"),b=C("./src/errors.ts"),v=C("./src/utils/logger.ts");function l(o,f){for(var u=0;u<f.length;u++){var i=f[u];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(o,i.key,i)}}function e(o,f,u){return f&&l(o.prototype,f),u&&l(o,u),o}function s(o,f){o.prototype=Object.create(f.prototype),o.prototype.constructor=o,a(o,f)}function a(o,f){return a=Object.setPrototypeOf||function(i,r){return i.__proto__=r,i},a(o,f)}var c=100,d=function(o){s(f,o);function f(i,r){var t;return t=o.call(this,i,r,"[stream-controller]")||this,t.audioCodecSwap=!1,t.gapController=null,t.level=-1,t._forceStartLoad=!1,t.altAudio=!1,t.audioOnly=!1,t.fragPlaying=null,t.onvplaying=null,t.onvseeked=null,t.fragLastKbps=0,t.stalled=!1,t.couldBacktrack=!1,t.audioCodecSwitch=!1,t.videoBuffer=null,t._registerListeners(),t}var u=f.prototype;return u._registerListeners=function(){var r=this.hls;r.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),r.on(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.on(K.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),r.on(K.Events.ERROR,this.onError,this),r.on(K.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),r.on(K.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),r.on(K.Events.BUFFER_CREATED,this.onBufferCreated,this),r.on(K.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),r.on(K.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),r.on(K.Events.FRAG_BUFFERED,this.onFragBuffered,this)},u._unregisterListeners=function(){var r=this.hls;r.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.off(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),r.off(K.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),r.off(K.Events.ERROR,this.onError,this),r.off(K.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),r.off(K.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),r.off(K.Events.BUFFER_CREATED,this.onBufferCreated,this),r.off(K.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),r.off(K.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),r.off(K.Events.FRAG_BUFFERED,this.onFragBuffered,this)},u.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},u.startLoad=function(r){if(this.levels){var t=this.lastCurrentTime,n=this.hls;if(this.stopLoad(),this.setInterval(c),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var g=n.startLevel;g===-1&&(n.config.testBandwidth?(g=0,this.bitrateTest=!0):g=n.nextAutoLevel),this.level=n.nextLoadLevel=g,this.loadedmetadata=!1}t>0&&r===-1&&(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),r=t),this.state=O.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=r,this.tick()}else this._forceStartLoad=!0,this.state=O.State.STOPPED},u.stopLoad=function(){this._forceStartLoad=!1,o.prototype.stopLoad.call(this)},u.doTick=function(){switch(this.state){case O.State.IDLE:this.doTickIdle();break;case O.State.WAITING_LEVEL:{var r,t=this.levels,n=this.level,g=t==null||((r=t[n])===null||r===void 0)?void 0:r.details;if(g&&(!g.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(g))break;this.state=O.State.IDLE;break}break}case O.State.FRAG_LOADING_WAITING_RETRY:{var p,S=self.performance.now(),k=this.retryDate;(!k||S>=k||(p=this.media)!==null&&p!==void 0&&p.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=O.State.IDLE)}break;default:break}this.onTickEnd()},u.onTickEnd=function(){o.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},u.doTickIdle=function(){var r,t,n=this.hls,g=this.levelLastLoaded,p=this.levels,S=this.media,k=n.config,I=n.nextLoadLevel;if(g===null||!S&&(this.startFragRequested||!k.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!p||!p[I])return;var G=p[I];this.level=n.nextLoadLevel=I;var V=G.details;if(!V||this.state===O.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==I){this.state=O.State.WAITING_LEVEL;return}var J=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:S,L.PlaylistLevelType.MAIN);if(J===null)return;var re=J.len,ee=this.getMaxBufferLength(G.maxBitrate);if(re>=ee)return;if(this._streamEnded(J,V)){var ae={};this.altAudio&&(ae.type="video"),this.hls.trigger(K.Events.BUFFER_EOS,ae),this.state=O.State.ENDED;return}var be=J.end,he=this.getNextFragment(be,V);if(this.couldBacktrack&&!this.fragPrevious&&he&&he.sn!=="initSegment"){var me=he.sn-V.startSN;me>1&&(he=V.fragments[me-1],this.fragmentTracker.removeFragment(he))}if(he&&this.fragmentTracker.getState(he)===R.FragmentState.OK&&this.nextLoadPosition>be){var ce=this.audioOnly&&!this.altAudio?y.ElementaryStreamTypes.AUDIO:y.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(S,ce,L.PlaylistLevelType.MAIN),he=this.getNextFragment(this.nextLoadPosition,V)}if(!he)return;he.initSegment&&!he.initSegment.data&&!this.bitrateTest&&(he=he.initSegment),((r=he.decryptdata)===null||r===void 0?void 0:r.keyFormat)==="identity"&&!((t=he.decryptdata)!==null&&t!==void 0&&t.key)?this.loadKey(he,V):this.loadFragment(he,V,be)},u.loadFragment=function(r,t,n){var g,p=this.fragmentTracker.getState(r);if(this.fragCurrent=r,p===R.FragmentState.BACKTRACKED){var S=this.fragmentTracker.getBacktrackData(r);if(S){this._handleFragmentLoadProgress(S),this._handleFragmentLoadComplete(S);return}else p=R.FragmentState.NOT_LOADED}p===R.FragmentState.NOT_LOADED||p===R.FragmentState.PARTIAL?r.sn==="initSegment"?this._loadInitSegment(r):this.bitrateTest?(r.bitrateTest=!0,this.log("Fragment "+r.sn+" of level "+r.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(r)):(this.startFragRequested=!0,o.prototype.loadFragment.call(this,r,t,n)):p===R.FragmentState.APPENDING?this.reduceMaxBufferLength(r.duration)&&this.fragmentTracker.removeFragment(r):((g=this.media)===null||g===void 0?void 0:g.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},u.getAppendedFrag=function(r){var t=this.fragmentTracker.getAppendedFrag(r,L.PlaylistLevelType.MAIN);return t&&"fragment"in t?t.fragment:t},u.getBufferedFrag=function(r){return this.fragmentTracker.getBufferedFrag(r,L.PlaylistLevelType.MAIN)},u.followingBufferedFrag=function(r){return r?this.getBufferedFrag(r.end+.5):null},u.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},u.nextLevelSwitch=function(){var r=this.levels,t=this.media;if(t!=null&&t.readyState){var n,g=this.getAppendedFrag(t.currentTime);if(g&&g.start>1&&this.flushMainBuffer(0,g.start-1),!t.paused&&r){var p=this.hls.nextLoadLevel,S=r[p],k=this.fragLastKbps;k&&this.fragCurrent?n=this.fragCurrent.duration*S.maxBitrate/(1e3*k)+1:n=0}else n=0;var I=this.getBufferedFrag(t.currentTime+n);if(I){var G=this.followingBufferedFrag(I);if(G){this.abortCurrentFrag();var V=G.maxStartPTS?G.maxStartPTS:G.start,J=G.duration,re=Math.max(I.end,V+Math.min(Math.max(J-this.config.maxFragLookUpTolerance,J*.5),J*.75));this.flushMainBuffer(re,Number.POSITIVE_INFINITY)}}}},u.abortCurrentFrag=function(){var r=this.fragCurrent;this.fragCurrent=null,r!=null&&r.loader&&r.loader.abort(),this.state===O.State.KEY_LOADING&&(this.state=O.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},u.flushMainBuffer=function(r,t){o.prototype.flushMainBuffer.call(this,r,t,this.altAudio?"video":null)},u.onMediaAttached=function(r,t){o.prototype.onMediaAttached.call(this,r,t);var n=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),n.addEventListener("playing",this.onvplaying),n.addEventListener("seeked",this.onvseeked),this.gapController=new E.default(this.config,n,this.fragmentTracker,this.hls)},u.onMediaDetaching=function(){var r=this.media;r&&(r.removeEventListener("playing",this.onvplaying),r.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),o.prototype.onMediaDetaching.call(this)},u.onMediaPlaying=function(){this.tick()},u.onMediaSeeked=function(){var r=this.media,t=r?r.currentTime:null;Object(j.isFiniteNumber)(t)&&this.log("Media seeked to "+t.toFixed(3)),this.tick()},u.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(K.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},u.onManifestParsed=function(r,t){var n=!1,g=!1,p;t.levels.forEach(function(S){p=S.audioCodec,p&&(p.indexOf("mp4a.40.2")!==-1&&(n=!0),p.indexOf("mp4a.40.5")!==-1&&(g=!0))}),this.audioCodecSwitch=n&&g&&!Object(x.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1},u.onLevelLoading=function(r,t){var n=this.levels;if(!n||this.state!==O.State.IDLE)return;var g=n[t.level];(!g.details||g.details.live&&this.levelLastLoaded!==t.level||this.waitForCdnTuneIn(g.details))&&(this.state=O.State.WAITING_LEVEL)},u.onLevelLoaded=function(r,t){var n,g=this.levels,p=t.level,S=t.details,k=S.totalduration;if(!g){this.warn("Levels were reset while loading level "+p);return}this.log("Level "+p+" loaded ["+S.startSN+","+S.endSN+"], cc ["+S.startCC+", "+S.endCC+"] duration:"+k);var I=this.fragCurrent;I&&(this.state===O.State.FRAG_LOADING||this.state===O.State.FRAG_LOADING_WAITING_RETRY)&&(I.level!==t.level&&I.loader&&(this.state=O.State.IDLE,I.loader.abort()));var G=g[p],V=0;if(S.live||(n=G.details)!==null&&n!==void 0&&n.live){if(S.fragments[0]||(S.deltaUpdateFailed=!0),S.deltaUpdateFailed)return;V=this.alignPlaylists(S,G.details)}if(G.details=S,this.levelLastLoaded=p,this.hls.trigger(K.Events.LEVEL_UPDATED,{details:S,level:p}),this.state===O.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(S))return;this.state=O.State.IDLE}this.startFragRequested?S.live&&this.synchronizeToLiveEdge(S):this.setStartPosition(S,V),this.tick()},u._handleFragmentLoadProgress=function(r){var t,n=r.frag,g=r.part,p=r.payload,S=this.levels;if(!S){this.warn("Levels were reset while fragment load was in progress. Fragment "+n.sn+" of level "+n.level+" will not be buffered");return}var k=S[n.level],I=k.details;if(!I){this.warn("Dropping fragment "+n.sn+" of level "+n.level+" after level details were reset");return}var G=k.videoCodec,V=I.PTSKnown||!I.live,J=(t=n.initSegment)===null||t===void 0?void 0:t.data,re=this._getAudioCodec(k),ee=this.transmuxer=this.transmuxer||new T.default(this.hls,L.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ae=g?g.index:-1,be=ae!==-1,he=new w.ChunkMetadata(n.level,n.sn,n.stats.chunkCount,p.byteLength,ae,be),me=this.initPTS[n.cc];ee.push(p,J,re,G,n,g,I.totalduration,V,he,me)},u.onAudioTrackSwitching=function(r,t){var n=this.altAudio,g=!!t.url,p=t.id;if(!g){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var S=this.fragCurrent;S!=null&&S.loader&&(this.log("Switching to main audio track, cancel main fragment load"),S.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var k=this.hls;n&&k.trigger(K.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),k.trigger(K.Events.AUDIO_TRACK_SWITCHED,{id:p})}},u.onAudioTrackSwitched=function(r,t){var n=t.id,g=!!this.hls.audioTracks[n].url;if(g){var p=this.videoBuffer;p&&this.mediaBuffer!==p&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=p)}this.altAudio=g,this.tick()},u.onBufferCreated=function(r,t){var n=t.tracks,g,p,S=!1;for(var k in n){var I=n[k];if(I.id==="main"){if(p=k,g=I,k==="video"){var G=n[k];G&&(this.videoBuffer=G.buffer)}}else S=!0}S&&g?(this.log("Alternate track found, use "+p+".buffered to schedule main fragment loading"),this.mediaBuffer=g.buffer):this.mediaBuffer=this.media},u.onFragBuffered=function(r,t){var n=t.frag,g=t.part;if(n&&n.type!==L.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(n)){this.warn("Fragment "+n.sn+(g?" p: "+g.index:"")+" of level "+n.level+" finished buffering, but was aborted. state: "+this.state),this.state===O.State.PARSED&&(this.state=O.State.IDLE);return}var p=g?g.stats:n.stats;this.fragLastKbps=Math.round(8*p.total/(p.buffering.end-p.loading.first)),n.sn!=="initSegment"&&(this.fragPrevious=n),this.fragBufferedComplete(n,g)},u.onError=function(r,t){switch(t.details){case b.ErrorDetails.FRAG_LOAD_ERROR:case b.ErrorDetails.FRAG_LOAD_TIMEOUT:case b.ErrorDetails.KEY_LOAD_ERROR:case b.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.MAIN,t);break;case b.ErrorDetails.LEVEL_LOAD_ERROR:case b.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==O.State.ERROR&&(t.fatal?(this.warn(""+t.details),this.state=O.State.ERROR):!t.levelRetry&&this.state===O.State.WAITING_LEVEL&&(this.state=O.State.IDLE));break;case b.ErrorDetails.BUFFER_FULL_ERROR:if(t.parent==="main"&&(this.state===O.State.PARSING||this.state===O.State.PARSED)){var n=!0,g=this.getFwdBufferInfo(this.media,L.PlaylistLevelType.MAIN);g&&g.len>.5&&(n=!this.reduceMaxBufferLength(g.len)),n&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},u.checkBuffer=function(){var r=this.media,t=this.gapController;if(!r||!t||!r.readyState)return;var n=M.BufferHelper.getBuffered(r);!this.loadedmetadata&&n.length?(this.loadedmetadata=!0,this.seekToStartPos()):t.poll(this.lastCurrentTime),this.lastCurrentTime=r.currentTime},u.onFragLoadEmergencyAborted=function(){this.state=O.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},u.onBufferFlushed=function(r,t){var n=t.type;if(n!==y.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var g=(n===y.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(g,n,L.PlaylistLevelType.MAIN)}},u.onLevelsUpdated=function(r,t){this.levels=t.levels},u.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},u.seekToStartPos=function(){var r=this.media,t=r.currentTime,n=this.startPosition;if(n>=0&&t<n){if(r.seeking){v.logger.log("could not seek to "+n+", already seeking at "+t);return}var g=M.BufferHelper.getBuffered(r),p=g.length?g.start(0):0,S=p-n;S>0&&(S<this.config.maxBufferHole||S<this.config.maxFragLookUpTolerance)&&(v.logger.log("adjusting start position by "+S+" to match buffer start"),n+=S,this.startPosition=n),this.log("seek to target start position "+n+" from current time "+t),r.currentTime=n}},u._getAudioCodec=function(r){var t=this.config.defaultAudioCodec||r.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t},u._loadBitrateTestFrag=function(r){var t=this;this._doFragLoad(r).then(function(n){var g=t.hls;if(!n||g.nextLoadLevel||t.fragContextChanged(r))return;t.fragLoadError=0,t.state=O.State.IDLE,t.startFragRequested=!1,t.bitrateTest=!1;var p=r.stats;p.parsing.start=p.parsing.end=p.buffering.start=p.buffering.end=self.performance.now(),g.trigger(K.Events.FRAG_LOADED,n)})},u._handleTransmuxComplete=function(r){var t,n="main",g=this.hls,p=r.remuxResult,S=r.chunkMeta,k=this.getCurrentContext(S);if(!k){this.warn("The loading context changed while buffering fragment "+S.sn+" of level "+S.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(S.level);return}var I=k.frag,G=k.part,V=k.level,J=p.video,re=p.text,ee=p.id3,ae=p.initSegment,be=this.altAudio?void 0:p.audio;if(this.fragContextChanged(I))return;if(this.state=O.State.PARSING,ae){ae.tracks&&(this._bufferInitSegment(V,ae.tracks,I,S),g.trigger(K.Events.FRAG_PARSING_INIT_SEGMENT,{frag:I,id:n,tracks:ae.tracks}));var he=ae.initPTS,me=ae.timescale;Object(j.isFiniteNumber)(he)&&(this.initPTS[I.cc]=he,g.trigger(K.Events.INIT_PTS_FOUND,{frag:I,id:n,initPTS:he,timescale:me}))}if(J&&p.independent!==!1){if(V.details){var ce=J.startPTS,te=J.endPTS,q=J.startDTS,oe=J.endDTS;if(G)G.elementaryStreams[J.type]={startPTS:ce,endPTS:te,startDTS:q,endDTS:oe};else if(J.firstKeyFrame&&J.independent&&(this.couldBacktrack=!0),J.dropped&&J.independent){var Z=this.getLoadPosition()+this.config.maxBufferHole;if(Z<ce){this.backtrack(I);return}I.setElementaryStreamInfo(J.type,I.start,te,I.start,oe,!0)}I.setElementaryStreamInfo(J.type,ce,te,q,oe),this.bufferFragmentData(J,I,G,S)}}else if(p.independent===!1){this.backtrack(I);return}if(be){var D=be.startPTS,h=be.endPTS,m=be.startDTS,P=be.endDTS;G&&(G.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:D,endPTS:h,startDTS:m,endDTS:P}),I.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,D,h,m,P),this.bufferFragmentData(be,I,G,S)}if(ee!=null&&(t=ee.samples)!==null&&t!==void 0&&t.length){var _={frag:I,id:n,samples:ee.samples};g.trigger(K.Events.FRAG_PARSING_METADATA,_)}if(re){var A={frag:I,id:n,samples:re.samples};g.trigger(K.Events.FRAG_PARSING_USERDATA,A)}},u._bufferInitSegment=function(r,t,n,g){var p=this;if(this.state!==O.State.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;var S=t.audio,k=t.video,I=t.audiovideo;if(S){var G=r.audioCodec,V=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(G&&(G.indexOf("mp4a.40.5")!==-1?G="mp4a.40.2":G="mp4a.40.5"),S.metadata.channelCount!==1&&V.indexOf("firefox")===-1&&(G="mp4a.40.5")),V.indexOf("android")!==-1&&S.container!=="audio/mpeg"&&(G="mp4a.40.2",this.log("Android: force audio codec to "+G)),r.audioCodec&&r.audioCodec!==G&&this.log('Swapping manifest audio codec "'+r.audioCodec+'" for "'+G+'"'),S.levelCodec=G,S.id="main",this.log("Init audio buffer, container:"+S.container+", codecs[selected/level/parsed]=["+(G||"")+"/"+(r.audioCodec||"")+"/"+S.codec+"]")}k&&(k.levelCodec=r.videoCodec,k.id="main",this.log("Init video buffer, container:"+k.container+", codecs[level/parsed]=["+(r.videoCodec||"")+"/"+k.codec+"]")),I&&this.log("Init audiovideo buffer, container:"+I.container+", codecs[level/parsed]=["+(r.attrs.CODECS||"")+"/"+I.codec+"]"),this.hls.trigger(K.Events.BUFFER_CODECS,t),Object.keys(t).forEach(function(J){var re=t[J],ee=re.initSegment;ee!=null&&ee.byteLength&&p.hls.trigger(K.Events.BUFFER_APPENDING,{type:J,data:ee,frag:n,part:null,chunkMeta:g,parent:n.type})}),this.tick()},u.backtrack=function(r){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(r);var t=this.fragmentTracker.backtrack(r);this.fragPrevious=null,this.nextLoadPosition=r.start,t?this.resetFragmentLoading(r):this.state=O.State.BACKTRACKING},u.checkFragmentChanged=function(){var r=this.media,t=null;if(r&&r.readyState>1&&r.seeking===!1){var n=r.currentTime;if(M.BufferHelper.isBuffered(r,n)?t=this.getAppendedFrag(n):M.BufferHelper.isBuffered(r,n+.1)&&(t=this.getAppendedFrag(n+.1)),t){var g=this.fragPlaying,p=t.level;(!g||t.sn!==g.sn||g.level!==p||t.urlId!==g.urlId)&&(this.hls.trigger(K.Events.FRAG_CHANGED,{frag:t}),(!g||g.level!==p)&&this.hls.trigger(K.Events.LEVEL_SWITCHED,{level:p}),this.fragPlaying=t)}}},e(f,[{key:"nextLevel",get:function(){var r=this.nextBufferedFrag;return r?r.level:-1}},{key:"currentLevel",get:function(){var r=this.media;if(r){var t=this.getAppendedFrag(r.currentTime);if(t)return t.level}return-1}},{key:"nextBufferedFrag",get:function(){var r=this.media;if(r){var t=this.getAppendedFrag(r.currentTime);return this.followingBufferedFrag(t)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),f}(O.default)},"./src/controller/subtitle-stream-controller.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"SubtitleStreamController",function(){return s});var j=C("./src/events.ts"),O=C("./src/utils/logger.ts"),x=C("./src/utils/buffer-helper.ts"),K=C("./src/controller/fragment-finders.ts"),M=C("./src/utils/discontinuities.ts"),R=C("./src/controller/level-helper.ts"),L=C("./src/controller/fragment-tracker.ts"),y=C("./src/controller/base-stream-controller.ts"),T=C("./src/types/loader.ts"),w=C("./src/types/level.ts");function E(a,c){for(var d=0;d<c.length;d++){var o=c[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(a,o.key,o)}}function b(a,c,d){return c&&E(a.prototype,c),d&&E(a,d),a}function v(a,c){a.prototype=Object.create(c.prototype),a.prototype.constructor=a,l(a,c)}function l(a,c){return l=Object.setPrototypeOf||function(o,f){return o.__proto__=f,o},l(a,c)}var e=500,s=function(a){v(c,a);function c(o,f){var u;return u=a.call(this,o,f,"[subtitle-stream-controller]")||this,u.levels=[],u.currentTrackId=-1,u.tracksBuffered=[],u.mainDetails=null,u._registerListeners(),u}var d=c.prototype;return d.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},d._registerListeners=function(){var f=this.hls;f.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.on(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(j.Events.ERROR,this.onError,this),f.on(j.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),f.on(j.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),f.on(j.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),f.on(j.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),f.on(j.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},d._unregisterListeners=function(){var f=this.hls;f.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.off(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(j.Events.ERROR,this.onError,this),f.off(j.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),f.off(j.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),f.off(j.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),f.off(j.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),f.off(j.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},d.startLoad=function(){this.stopLoad(),this.state=y.State.IDLE,this.setInterval(e),this.tick()},d.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},d.onLevelLoaded=function(f,u){this.mainDetails=u.details},d.onSubtitleFragProcessed=function(f,u){var i=u.frag,r=u.success;if(this.fragPrevious=i,this.state=y.State.IDLE,!r)return;var t=this.tracksBuffered[this.currentTrackId];if(!t)return;for(var n,g=i.start,p=0;p<t.length;p++)if(g>=t[p].start&&g<=t[p].end){n=t[p];break}var S=i.start+i.duration;n?n.end=S:(n={start:g,end:S},t.push(n)),this.fragmentTracker.fragBuffered(i)},d.onBufferFlushing=function(f,u){var i=u.startOffset,r=u.endOffset;if(i===0&&r!==Number.POSITIVE_INFINITY){var t=this.currentTrackId,n=this.levels;if(!n.length||!n[t]||!n[t].details)return;var g=n[t].details,p=g.targetduration,S=r-p;if(S<=0)return;u.endOffsetSubtitles=Math.max(0,S),this.tracksBuffered.forEach(function(k){for(var I=0;I<k.length;){if(k[I].end<=S){k.shift();continue}else if(k[I].start<S)k[I].start=S;else break;I++}}),this.fragmentTracker.removeFragmentsInRange(i,S,T.PlaylistLevelType.SUBTITLE)}},d.onError=function(f,u){var i,r=u.frag;if(!r||r.type!==T.PlaylistLevelType.SUBTITLE)return;(i=this.fragCurrent)!==null&&i!==void 0&&i.loader&&this.fragCurrent.loader.abort(),this.state=y.State.IDLE},d.onSubtitleTracksUpdated=function(f,u){var i=this,r=u.subtitleTracks;this.tracksBuffered=[],this.levels=r.map(function(t){return new w.Level(t)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(t){i.tracksBuffered[t.id]=[]}),this.mediaBuffer=null},d.onSubtitleTrackSwitch=function(f,u){if(this.currentTrackId=u.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var i=this.levels[this.currentTrackId];i!=null&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.setInterval(e)},d.onSubtitleTrackLoaded=function(f,u){var i,r=u.details,t=u.id,n=this.currentTrackId,g=this.levels;if(!g.length)return;var p=g[n];if(t>=g.length||t!==n||!p)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,r.live||(i=p.details)!==null&&i!==void 0&&i.live){var S=this.mainDetails;if(r.deltaUpdateFailed||!S)return;var k=S.fragments[0];if(!p.details)r.hasProgramDateTime&&S.hasProgramDateTime?Object(M.alignMediaPlaylistByPDT)(r,S):k&&Object(R.addSliding)(r,k.start);else{var I=this.alignPlaylists(r,p.details);I===0&&k&&Object(R.addSliding)(r,k.start)}}if(p.details=r,this.levelLastLoaded=t,this.tick(),r.live&&!this.fragCurrent&&this.media&&this.state===y.State.IDLE){var G=Object(K.findFragmentByPTS)(null,r.fragments,this.media.currentTime,0);G||(this.warn("Subtitle playlist not aligned with playback"),p.details=void 0)}},d._handleFragmentLoadComplete=function(f){var u=f.frag,i=f.payload,r=u.decryptdata,t=this.hls;if(this.fragContextChanged(u))return;if(i&&i.byteLength>0&&r&&r.key&&r.iv&&r.method==="AES-128"){var n=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(i),r.key.buffer,r.iv.buffer).then(function(g){var p=performance.now();t.trigger(j.Events.FRAG_DECRYPTED,{frag:u,payload:g,stats:{tstart:n,tdecrypt:p}})})}},d.doTick=function(){if(!this.media){this.state=y.State.IDLE;return}if(this.state===y.State.IDLE){var f,u=this.currentTrackId,i=this.levels;if(!i.length||!i[u]||!i[u].details)return;var r=i[u].details,t=r.targetduration,n=this.config,g=this.media,p=x.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,g.currentTime-t,n.maxBufferHole),S=p.end,k=p.len,I=this.getMaxBufferLength()+t;if(k>I)return;console.assert(r,"Subtitle track details are defined on idle subtitle stream controller tick");var G=r.fragments,V=G.length,J=r.edge,re,ee=this.fragPrevious;if(S<J){var ae=n.maxFragLookUpTolerance;ee&&r.hasProgramDateTime&&(re=Object(K.findFragmentByPDT)(G,ee.endProgramDateTime,ae)),re||(re=Object(K.findFragmentByPTS)(ee,G,S,ae),!re&&ee&&ee.start<G[0].start&&(re=G[0]))}else re=G[V-1];(f=re)!==null&&f!==void 0&&f.encrypted?(O.logger.log("Loading key for "+re.sn),this.state=y.State.KEY_LOADING,this.hls.trigger(j.Events.KEY_LOADING,{frag:re})):re&&this.fragmentTracker.getState(re)===L.FragmentState.NOT_LOADED&&this.loadFragment(re,r,S)}},d.loadFragment=function(f,u,i){this.fragCurrent=f,a.prototype.loadFragment.call(this,f,u,i)},b(c,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),c}(y.default)},"./src/controller/subtitle-track-controller.ts":function(ve,U,C){"use strict";C.r(U);var j=C("./src/events.ts"),O=C("./src/utils/texttrack-utils.ts"),x=C("./src/controller/base-playlist-controller.ts"),K=C("./src/types/loader.ts");function M(E,b){for(var v=0;v<b.length;v++){var l=b[v];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(E,l.key,l)}}function R(E,b,v){return b&&M(E.prototype,b),v&&M(E,v),E}function L(E,b){E.prototype=Object.create(b.prototype),E.prototype.constructor=E,y(E,b)}function y(E,b){return y=Object.setPrototypeOf||function(l,e){return l.__proto__=e,l},y(E,b)}var T=function(E){L(b,E);function b(l){var e;return e=E.call(this,l,"[subtitle-track-controller]")||this,e.media=null,e.tracks=[],e.groupId=null,e.tracksInGroup=[],e.trackId=-1,e.selectDefaultTrack=!0,e.queuedDefaultTrack=-1,e.trackChangeListener=function(){return e.onTextTracksChanged()},e.asyncPollTrackChange=function(){return e.pollTrackChange(0)},e.useTextTrackPolling=!1,e.subtitlePollingInterval=-1,e.subtitleDisplay=!0,e.registerListeners(),e}var v=b.prototype;return v.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,E.prototype.destroy.call(this)},v.registerListeners=function(){var e=this.hls;e.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(j.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(j.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(j.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(j.Events.ERROR,this.onError,this)},v.unregisterListeners=function(){var e=this.hls;e.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(j.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(j.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(j.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(j.Events.ERROR,this.onError,this)},v.onMediaAttached=function(e,s){if(this.media=s.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},v.pollTrackChange=function(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,e)},v.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var e=w(this.media.textTracks);e.forEach(function(s){Object(O.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},v.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},v.onManifestParsed=function(e,s){this.tracks=s.subtitleTracks},v.onSubtitleTrackLoaded=function(e,s){var a=s.id,c=s.details,d=this.trackId,o=this.tracksInGroup[d];if(!o){this.warn("Invalid subtitle track id "+a);return}var f=o.details;o.details=s.details,this.log("subtitle track "+a+" loaded ["+c.startSN+"-"+c.endSN+"]"),a===this.trackId&&(this.retryCount=0,this.playlistLoaded(a,s,f))},v.onLevelLoading=function(e,s){this.switchLevel(s.level)},v.onLevelSwitching=function(e,s){this.switchLevel(s.level)},v.switchLevel=function(e){var s=this.hls.levels[e];if(!(s!=null&&s.textGroupIds))return;var a=s.textGroupIds[s.urlId];if(this.groupId!==a){var c=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,d=this.tracks.filter(function(u){return!a||u.groupId===a});this.tracksInGroup=d;var o=this.findTrackId(c==null?void 0:c.name)||this.findTrackId();this.groupId=a;var f={subtitleTracks:d};this.log("Updating subtitle tracks, "+d.length+' track(s) found in "'+a+'" group-id'),this.hls.trigger(j.Events.SUBTITLE_TRACKS_UPDATED,f),o!==-1&&this.setSubtitleTrack(o,c)}},v.findTrackId=function(e){for(var s=this.tracksInGroup,a=0;a<s.length;a++){var c=s[a];if((!this.selectDefaultTrack||c.default)&&(!e||e===c.name))return c.id}return-1},v.onError=function(e,s){if(E.prototype.onError.call(this,e,s),s.fatal||!s.context)return;s.context.type===K.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},v.loadPlaylist=function(e){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var a=s.id,c=s.groupId,d=s.url;if(e)try{d=e.addDirectives(d)}catch(o){this.warn("Could not construct new URL with HLS Delivery Directives: "+o)}this.log("Loading subtitle playlist for id "+a),this.hls.trigger(j.Events.SUBTITLE_TRACK_LOADING,{url:d,id:a,groupId:c,deliveryDirectives:e||null})}},v.toggleTrackModes=function(e){var s=this,a=this.media,c=this.subtitleDisplay,d=this.trackId;if(!a)return;var o=w(a.textTracks),f=o.filter(function(r){return r.groupId===s.groupId});if(e===-1)[].slice.call(o).forEach(function(r){r.mode="disabled"});else{var u=f[d];u&&(u.mode="disabled")}var i=f[e];i&&(i.mode=c?"showing":"hidden")},v.setSubtitleTrack=function(e,s){var a,c=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(this.trackId!==e&&this.toggleTrackModes(e),this.trackId===e&&(e===-1||(a=c[e])!==null&&a!==void 0&&a.details)||e<-1||e>=c.length)return;this.clearTimer();var d=c[e];if(this.log("Switching to subtitle track "+e),this.trackId=e,d){var o=d.id,f=d.groupId,u=f===void 0?"":f,i=d.name,r=d.type,t=d.url;this.hls.trigger(j.Events.SUBTITLE_TRACK_SWITCH,{id:o,groupId:u,name:i,type:r,url:t});var n=this.switchParams(d.url,s==null?void 0:s.details);this.loadPlaylist(n)}else this.hls.trigger(j.Events.SUBTITLE_TRACK_SWITCH,{id:e})},v.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var e=-1,s=w(this.media.textTracks),a=0;a<s.length;a++)if(s[a].mode==="hidden")e=a;else if(s[a].mode==="showing"){e=a;break}this.subtitleTrack!==e&&(this.subtitleTrack=e)},R(b,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(e,s)}}]),b}(x.default);function w(E){for(var b=[],v=0;v<E.length;v++){var l=E[v];l.kind==="subtitles"&&l.label&&b.push(E[v])}return b}U.default=T},"./src/controller/timeline-controller.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"TimelineController",function(){return w});var j=C("./src/polyfills/number.ts"),O=C("./src/events.ts"),x=C("./src/utils/cea-608-parser.ts"),K=C("./src/utils/output-filter.ts"),M=C("./src/utils/webvtt-parser.ts"),R=C("./src/utils/texttrack-utils.ts"),L=C("./src/utils/imsc1-ttml-parser.ts"),y=C("./src/types/loader.ts"),T=C("./src/utils/logger.ts"),w=function(){function l(s){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=v(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var a=new K.default(this,"textTrack1"),c=new K.default(this,"textTrack2"),d=new K.default(this,"textTrack3"),o=new K.default(this,"textTrack4");this.cea608Parser1=new x.default(1,a,c),this.cea608Parser2=new x.default(3,d,o)}s.on(O.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(O.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(O.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(O.Events.FRAG_LOADING,this.onFragLoading,this),s.on(O.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(O.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(O.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(O.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var e=l.prototype;return e.destroy=function(){var a=this.hls;a.off(O.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(O.Events.MANIFEST_LOADED,this.onManifestLoaded,this),a.off(O.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),a.off(O.Events.FRAG_LOADING,this.onFragLoading,this),a.off(O.Events.FRAG_LOADED,this.onFragLoaded,this),a.off(O.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),a.off(O.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),a.off(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),a.off(O.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),a.off(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},e.addCues=function(a,c,d,o,f){for(var u=!1,i=f.length;i--;){var r=f[i],t=b(r[0],r[1],c,d);if(t>=0&&(r[0]=Math.min(r[0],c),r[1]=Math.max(r[1],d),u=!0,t/(d-c)>.5))return}if(u||f.push([c,d]),this.config.renderTextTracksNatively){var n=this.captionsTracks[a];this.Cues.newCue(n,c,d,o)}else{var g=this.Cues.newCue(null,c,d,o);this.hls.trigger(O.Events.CUES_PARSED,{type:"captions",cues:g,track:a})}},e.onInitPtsFound=function(a,c){var d=this,o=c.frag,f=c.id,u=c.initPTS,i=c.timescale,r=this.unparsedVttFrags;f==="main"&&(this.initPTS[o.cc]=u,this.timescale[o.cc]=i),r.length&&(this.unparsedVttFrags=[],r.forEach(function(t){d.onFragLoaded(O.Events.FRAG_LOADED,t)}))},e.getExistingTrack=function(a){var c=this.media;if(c)for(var d=0;d<c.textTracks.length;d++){var o=c.textTracks[d];if(o[a])return o}return null},e.createCaptionsTrack=function(a){this.config.renderTextTracksNatively?this.createNativeTrack(a):this.createNonNativeTrack(a)},e.createNativeTrack=function(a){if(this.captionsTracks[a])return;var c=this.captionsProperties,d=this.captionsTracks,o=this.media,f=c[a],u=f.label,i=f.languageCode,r=this.getExistingTrack(a);if(r)d[a]=r,Object(R.clearCurrentCues)(d[a]),Object(R.sendAddTrackEvent)(d[a],o);else{var t=this.createTextTrack("captions",u,i);t&&(t[a]=!0,d[a]=t)}},e.createNonNativeTrack=function(a){if(this.nonNativeCaptionsTracks[a])return;var c=this.captionsProperties[a];if(!c)return;var d=c.label,o={_id:a,label:d,kind:"captions",default:c.media?!!c.media.default:!1,closedCaptions:c.media};this.nonNativeCaptionsTracks[a]=o,this.hls.trigger(O.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[o]})},e.createTextTrack=function(a,c,d){var o=this.media;return o?o.addTextTrack(a,c,d):void 0},e.onMediaAttaching=function(a,c){this.media=c.media,this._cleanTracks()},e.onMediaDetaching=function(){var a=this.captionsTracks;Object.keys(a).forEach(function(c){Object(R.clearCurrentCues)(a[c]),delete a[c]}),this.nonNativeCaptionsTracks={}},e.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=v(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},e._cleanTracks=function(){var a=this.media;if(!a)return;var c=a.textTracks;if(c)for(var d=0;d<c.length;d++)Object(R.clearCurrentCues)(c[d])},e.onSubtitleTracksUpdated=function(a,c){var d=this;this.textTracks=[];var o=c.subtitleTracks||[],f=o.some(function(t){return t.textCodec===L.IMSC1_CODEC});if(this.config.enableWebVTT||f&&this.config.enableIMSC1){var u=this.tracks&&o&&this.tracks.length===o.length;if(this.tracks=o||[],this.config.renderTextTracksNatively){var i=this.media?this.media.textTracks:[];this.tracks.forEach(function(t,n){var g;if(n<i.length){for(var p=null,S=0;S<i.length;S++)if(E(i[S],t)){p=i[S];break}p&&(g=p)}g?Object(R.clearCurrentCues)(g):(g=d.createTextTrack("subtitles",t.name,t.lang),g&&(g.mode="disabled")),g&&(g.groupId=t.groupId,d.textTracks.push(g))})}else if(!u&&this.tracks&&this.tracks.length){var r=this.tracks.map(function(t){return{label:t.name,kind:t.type.toLowerCase(),default:t.default,subtitleTrack:t}});this.hls.trigger(O.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:r})}}},e.onManifestLoaded=function(a,c){var d=this;this.config.enableCEA708Captions&&c.captions&&c.captions.forEach(function(o){var f=/(?:CC|SERVICE)([1-4])/.exec(o.instreamId);if(!f)return;var u="textTrack"+f[1],i=d.captionsProperties[u];if(!i)return;i.label=o.name,o.lang&&(i.languageCode=o.lang),i.media=o})},e.onFragLoading=function(a,c){var d=this.cea608Parser1,o=this.cea608Parser2,f=this.lastSn,u=this.lastPartIndex;if(!this.enabled||!(d&&o))return;if(c.frag.type===y.PlaylistLevelType.MAIN){var i,r,t=c.frag.sn,n=(i=c==null||((r=c.part)===null||r===void 0)?void 0:r.index)!=null?i:-1;t===f+1||t===f&&n===u+1||(d.reset(),o.reset()),this.lastSn=t,this.lastPartIndex=n}},e.onFragLoaded=function(a,c){var d=c.frag,o=c.payload,f=this.initPTS,u=this.unparsedVttFrags;if(d.type===y.PlaylistLevelType.SUBTITLE)if(o.byteLength){if(!Object(j.isFiniteNumber)(f[d.cc])){u.push(c),f.length&&this.hls.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:new Error("Missing initial subtitle PTS")});return}var i=d.decryptdata;if(i==null||i.key==null||i.method!=="AES-128"){var r=this.tracks[d.level],t=this.vttCCs;t[d.cc]||(t[d.cc]={start:d.start,prevCC:this.prevCC,new:!0},this.prevCC=d.cc),r&&r.textCodec===L.IMSC1_CODEC?this._parseIMSC1(d,o):this._parseVTTs(d,o,t)}}else this.hls.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:new Error("Empty subtitle payload")})},e._parseIMSC1=function(a,c){var d=this,o=this.hls;Object(L.parseIMSC1)(c,this.initPTS[a.cc],this.timescale[a.cc],function(f){d._appendCues(f,a.level),o.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:a})},function(f){T.logger.log("Failed to parse IMSC1: "+f),o.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:a,error:f})})},e._parseVTTs=function(a,c,d){var o=this,f=this.hls;Object(M.parseWebVTT)(c,this.initPTS[a.cc],this.timescale[a.cc],d,a.cc,a.start,function(u){o._appendCues(u,a.level),f.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:a})},function(u){o._fallbackToIMSC1(a,c),T.logger.log("Failed to parse VTT cue: "+u),f.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:a,error:u})})},e._fallbackToIMSC1=function(a,c){var d=this,o=this.tracks[a.level];o.textCodec||Object(L.parseIMSC1)(c,this.initPTS[a.cc],this.timescale[a.cc],function(){o.textCodec=L.IMSC1_CODEC,d._parseIMSC1(a,c)},function(){o.textCodec="wvtt"})},e._appendCues=function(a,c){var d=this.hls;if(this.config.renderTextTracksNatively){var o=this.textTracks[c];if(o.mode==="disabled")return;a.forEach(function(i){return Object(R.addCueToTrack)(o,i)})}else{var f=this.tracks[c],u=f.default?"default":"subtitles"+c;d.trigger(O.Events.CUES_PARSED,{type:"subtitles",cues:a,track:u})}},e.onFragDecrypted=function(a,c){var d=c.frag;if(d.type===y.PlaylistLevelType.SUBTITLE){if(!Object(j.isFiniteNumber)(this.initPTS[d.cc])){this.unparsedVttFrags.push(c);return}this.onFragLoaded(O.Events.FRAG_LOADED,c)}},e.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},e.onFragParsingUserdata=function(a,c){var d=this.cea608Parser1,o=this.cea608Parser2;if(!this.enabled||!(d&&o))return;for(var f=0;f<c.samples.length;f++){var u=c.samples[f].bytes;if(u){var i=this.extractCea608Data(u);d.addData(c.samples[f].pts,i[0]),o.addData(c.samples[f].pts,i[1])}}},e.onBufferFlushing=function(a,c){var d=c.startOffset,o=c.endOffset,f=c.endOffsetSubtitles,u=c.type,i=this.media;if(!i||i.currentTime<o)return;if(!u||u==="video"){var r=this.captionsTracks;Object.keys(r).forEach(function(n){return Object(R.removeCuesInRange)(r[n],d,o)})}if(this.config.renderTextTracksNatively&&(d===0&&f!==void 0)){var t=this.textTracks;Object.keys(t).forEach(function(n){return Object(R.removeCuesInRange)(t[n],d,f)})}},e.extractCea608Data=function(a){for(var c=a[0]&31,d=2,o=[[],[]],f=0;f<c;f++){var u=a[d++],i=127&a[d++],r=127&a[d++],t=(4&u)!==0,n=3&u;if(i===0&&r===0)continue;t&&((n===0||n===1)&&(o[n].push(i),o[n].push(r)))}return o},l}();function E(l,e){return l&&l.label===e.name&&!(l.textTrack1||l.textTrack2)}function b(l,e,s,a){return Math.min(e,a)-Math.max(l,s)}function v(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"default",function(){return j});var j=function(){function O(K,M){this.subtle=void 0,this.aesIV=void 0,this.subtle=K,this.aesIV=M}var x=O.prototype;return x.decrypt=function(M,R){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},R,M)},O}()},"./src/crypt/aes-decryptor.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"removePadding",function(){return O}),C.d(U,"default",function(){return x});var j=C("./src/utils/typed-array.ts");function O(K){var M=K.byteLength,R=M&&new DataView(K.buffer).getUint8(M-1);return R?Object(j.sliceUint8)(K,0,M-R):K}var x=function(){function K(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var M=K.prototype;return M.uint8ArrayToUint32Array_=function(L){for(var y=new DataView(L),T=new Uint32Array(4),w=0;w<4;w++)T[w]=y.getUint32(w*4);return T},M.initTable=function(){var L=this.sBox,y=this.invSBox,T=this.subMix,w=T[0],E=T[1],b=T[2],v=T[3],l=this.invSubMix,e=l[0],s=l[1],a=l[2],c=l[3],d=new Uint32Array(256),o=0,f=0,u=0;for(u=0;u<256;u++)u<128?d[u]=u<<1:d[u]=u<<1^283;for(u=0;u<256;u++){var i=f^f<<1^f<<2^f<<3^f<<4;i=i>>>8^i&255^99,L[o]=i,y[i]=o;var r=d[o],t=d[r],n=d[t],g=d[i]*257^i*16843008;w[o]=g<<24|g>>>8,E[o]=g<<16|g>>>16,b[o]=g<<8|g>>>24,v[o]=g,g=n*16843009^t*65537^r*257^o*16843008,e[i]=g<<24|g>>>8,s[i]=g<<16|g>>>16,a[i]=g<<8|g>>>24,c[i]=g,o?(o=r^d[d[d[n^r]]],f^=d[d[f]]):o=f=1}},M.expandKey=function(L){for(var y=this.uint8ArrayToUint32Array_(L),T=!0,w=0;w<y.length&&T;)T=y[w]===this.key[w],w++;if(T)return;this.key=y;var E=this.keySize=y.length;if(E!==4&&E!==6&&E!==8)throw new Error("Invalid aes key size="+E);var b=this.ksRows=(E+6+1)*4,v,l,e=this.keySchedule=new Uint32Array(b),s=this.invKeySchedule=new Uint32Array(b),a=this.sBox,c=this.rcon,d=this.invSubMix,o=d[0],f=d[1],u=d[2],i=d[3],r,t;for(v=0;v<b;v++){if(v<E){r=e[v]=y[v];continue}t=r,v%E===0?(t=t<<8|t>>>24,t=a[t>>>24]<<24|a[t>>>16&255]<<16|a[t>>>8&255]<<8|a[t&255],t^=c[v/E|0]<<24):E>6&&v%E===4&&(t=a[t>>>24]<<24|a[t>>>16&255]<<16|a[t>>>8&255]<<8|a[t&255]),e[v]=r=(e[v-E]^t)>>>0}for(l=0;l<b;l++)v=b-l,l&3?t=e[v]:t=e[v-4],l<4||v<=4?s[l]=t:s[l]=o[a[t>>>24]]^f[a[t>>>16&255]]^u[a[t>>>8&255]]^i[a[t&255]],s[l]=s[l]>>>0},M.networkToHostOrderSwap=function(L){return L<<24|(L&65280)<<8|(L&16711680)>>8|L>>>24},M.decrypt=function(L,y,T){for(var w=this.keySize+6,E=this.invKeySchedule,b=this.invSBox,v=this.invSubMix,l=v[0],e=v[1],s=v[2],a=v[3],c=this.uint8ArrayToUint32Array_(T),d=c[0],o=c[1],f=c[2],u=c[3],i=new Int32Array(L),r=new Int32Array(i.length),t,n,g,p,S,k,I,G,V,J,re,ee,ae,be,he=this.networkToHostOrderSwap;y<i.length;){for(V=he(i[y]),J=he(i[y+1]),re=he(i[y+2]),ee=he(i[y+3]),S=V^E[0],k=ee^E[1],I=re^E[2],G=J^E[3],ae=4,be=1;be<w;be++)t=l[S>>>24]^e[k>>16&255]^s[I>>8&255]^a[G&255]^E[ae],n=l[k>>>24]^e[I>>16&255]^s[G>>8&255]^a[S&255]^E[ae+1],g=l[I>>>24]^e[G>>16&255]^s[S>>8&255]^a[k&255]^E[ae+2],p=l[G>>>24]^e[S>>16&255]^s[k>>8&255]^a[I&255]^E[ae+3],S=t,k=n,I=g,G=p,ae=ae+4;t=b[S>>>24]<<24^b[k>>16&255]<<16^b[I>>8&255]<<8^b[G&255]^E[ae],n=b[k>>>24]<<24^b[I>>16&255]<<16^b[G>>8&255]<<8^b[S&255]^E[ae+1],g=b[I>>>24]<<24^b[G>>16&255]<<16^b[S>>8&255]<<8^b[k&255]^E[ae+2],p=b[G>>>24]<<24^b[S>>16&255]<<16^b[k>>8&255]<<8^b[I&255]^E[ae+3],r[y]=he(t^d),r[y+1]=he(p^o),r[y+2]=he(g^f),r[y+3]=he(n^u),d=V,o=J,f=re,u=ee,y=y+4}return r.buffer},K}()},"./src/crypt/decrypter.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"default",function(){return y});var j=C("./src/crypt/aes-crypto.ts"),O=C("./src/crypt/fast-aes-key.ts"),x=C("./src/crypt/aes-decryptor.ts"),K=C("./src/utils/logger.ts"),M=C("./src/utils/mp4-tools.ts"),R=C("./src/utils/typed-array.ts"),L=16,y=function(){function T(E,b,v){var l=v===void 0?{}:v,e=l.removePKCS7Padding,s=e===void 0?!0:e;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=E,this.config=b,this.removePKCS7Padding=s,s)try{var a=self.crypto;a&&(this.subtle=a.subtle||a.webkitSubtle)}catch(c){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var w=T.prototype;return w.destroy=function(){this.observer=null},w.isSync=function(){return this.config.enableSoftwareAES},w.flush=function(){var b=this.currentResult;if(!b){this.reset();return}var v=new Uint8Array(b);return this.reset(),this.removePKCS7Padding?Object(x.removePadding)(v):v},w.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},w.decrypt=function(b,v,l,e){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(b),v,l);var s=this.flush();s&&e(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(b),v,l).then(e)},w.softwareDecrypt=function(b,v,l){var e=this.currentIV,s=this.currentResult,a=this.remainderData;this.logOnce("JS AES decrypt"),a&&(b=Object(M.appendUint8Array)(a,b),this.remainderData=null);var c=this.getValidChunk(b);if(!c.length)return null;e&&(l=e);var d=this.softwareDecrypter;d||(d=this.softwareDecrypter=new x.default),d.expandKey(v);var o=s;return this.currentResult=d.decrypt(c.buffer,0,l),this.currentIV=Object(R.sliceUint8)(c,-16).buffer,o||null},w.webCryptoDecrypt=function(b,v,l){var e=this,s=this.subtle;return(this.key!==v||!this.fastAesKey)&&(this.key=v,this.fastAesKey=new O.default(s,v)),this.fastAesKey.expandKey().then(function(a){if(!s)return Promise.reject(new Error("web crypto not initialized"));var c=new j.default(s,l);return c.decrypt(b.buffer,a)}).catch(function(a){return e.onWebCryptoError(a,b,v,l)})},w.onWebCryptoError=function(b,v,l,e){return K.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",b),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(v,l,e)},w.getValidChunk=function(b){var v=b,l=b.length-b.length%L;return l!==b.length&&(v=Object(R.sliceUint8)(b,0,l),this.remainderData=Object(R.sliceUint8)(b,l)),v},w.logOnce=function(b){if(!this.logEnabled)return;K.logger.log("[decrypter.ts]: "+b),this.logEnabled=!1},T}()},"./src/crypt/fast-aes-key.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"default",function(){return j});var j=function(){function O(K,M){this.subtle=void 0,this.key=void 0,this.subtle=K,this.key=M}var x=O.prototype;return x.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},O}()},"./src/demux/aacdemuxer.ts":function(ve,U,C){"use strict";C.r(U);var j=C("./src/demux/base-audio-demuxer.ts"),O=C("./src/demux/adts.ts"),x=C("./src/utils/logger.ts"),K=C("./src/demux/id3.ts");function M(y,T){y.prototype=Object.create(T.prototype),y.prototype.constructor=y,R(y,T)}function R(y,T){return R=Object.setPrototypeOf||function(E,b){return E.__proto__=b,E},R(y,T)}var L=function(y){M(T,y);function T(E,b){var v;return v=y.call(this)||this,v.observer=void 0,v.config=void 0,v.observer=E,v.config=b,v}var w=T.prototype;return w.resetInitSegment=function(b,v,l){y.prototype.resetInitSegment.call(this,b,v,l),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:b,duration:l,inputTimeScale:9e4,dropped:0}},T.probe=function(b){if(!b)return!1;for(var v=K.getID3Data(b,0)||[],l=v.length,e=b.length;l<e;l++)if(O.probe(b,l))return x.logger.log("ADTS sync word found !"),!0;return!1},w.canParse=function(b,v){return O.canParse(b,v)},w.appendFrame=function(b,v,l){O.initTrackConfig(b,this.observer,v,l,b.manifestCodec);var e=O.appendFrame(b,v,l,this.initPTS,this.frameIndex);if(e&&e.missing===0)return e},T}(j.default);L.minProbeByteLength=9,U.default=L},"./src/demux/adts.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"getAudioConfig",function(){return K}),C.d(U,"isHeaderPattern",function(){return M}),C.d(U,"getHeaderLength",function(){return R}),C.d(U,"getFullFrameLength",function(){return L}),C.d(U,"canGetFrameLength",function(){return y}),C.d(U,"isHeader",function(){return T}),C.d(U,"canParse",function(){return w}),C.d(U,"probe",function(){return E}),C.d(U,"initTrackConfig",function(){return b}),C.d(U,"getFrameDuration",function(){return v}),C.d(U,"parseFrameHeader",function(){return l}),C.d(U,"appendFrame",function(){return e});var j=C("./src/utils/logger.ts"),O=C("./src/errors.ts"),x=C("./src/events.ts");function K(s,a,c,d){var o,f,u,i,r=navigator.userAgent.toLowerCase(),t=d,n=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];o=((a[c+2]&192)>>>6)+1;var g=(a[c+2]&60)>>>2;if(g>n.length-1){s.trigger(x.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+g});return}return u=(a[c+2]&1)<<2,u|=(a[c+3]&192)>>>6,j.logger.log("manifest codec:"+d+", ADTS type:"+o+", samplingIndex:"+g),/firefox/i.test(r)?g>=6?(o=5,i=new Array(4),f=g-3):(o=2,i=new Array(2),f=g):r.indexOf("android")!==-1?(o=2,i=new Array(2),f=g):(o=5,i=new Array(4),d&&(d.indexOf("mp4a.40.29")!==-1||d.indexOf("mp4a.40.5")!==-1)||!d&&g>=6?f=g-3:((d&&d.indexOf("mp4a.40.2")!==-1&&(g>=6&&u===1||/vivaldi/i.test(r))||!d&&u===1)&&(o=2,i=new Array(2)),f=g)),i[0]=o<<3,i[0]|=(g&14)>>1,i[1]|=(g&1)<<7,i[1]|=u<<3,o===5&&(i[1]|=(f&14)>>1,i[2]=(f&1)<<7,i[2]|=2<<2,i[3]=0),{config:i,samplerate:n[g],channelCount:u,codec:"mp4a.40."+o,manifestCodec:t}}function M(s,a){return s[a]===255&&(s[a+1]&246)===240}function R(s,a){return s[a+1]&1?7:9}function L(s,a){return(s[a+3]&3)<<11|s[a+4]<<3|(s[a+5]&224)>>>5}function y(s,a){return a+5<s.length}function T(s,a){return a+1<s.length&&M(s,a)}function w(s,a){return y(s,a)&&M(s,a)&&L(s,a)<=s.length-a}function E(s,a){if(T(s,a)){var c=R(s,a);if(a+c>=s.length)return!1;var d=L(s,a);if(d<=c)return!1;var o=a+d;return o===s.length||T(s,o)}return!1}function b(s,a,c,d,o){if(!s.samplerate){var f=K(a,c,d,o);if(!f)return;s.config=f.config,s.samplerate=f.samplerate,s.channelCount=f.channelCount,s.codec=f.codec,s.manifestCodec=f.manifestCodec,j.logger.log("parsed codec:"+s.codec+", rate:"+f.samplerate+", channels:"+f.channelCount)}}function v(s){return 1024*9e4/s}function l(s,a,c,d,o){var f=R(s,a),u=L(s,a);if(u-=f,u>0){var i=c+d*o;return{headerLength:f,frameLength:u,stamp:i}}}function e(s,a,c,d,o){var f=v(s.samplerate),u=l(a,c,d,o,f);if(u){var i=u.frameLength,r=u.headerLength,t=u.stamp,n=r+i,g=Math.max(0,c+n-a.length),p;g?(p=new Uint8Array(n-r),p.set(a.subarray(c+r,a.length),0)):p=a.subarray(c+r,c+n);var S={unit:p,pts:t};return g||s.samples.push(S),{sample:S,length:n,missing:g}}}},"./src/demux/base-audio-demuxer.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"initPTSFn",function(){return L});var j=C("./src/polyfills/number.ts"),O=C("./src/demux/id3.ts"),x=C("./src/demux/dummy-demuxed-track.ts"),K=C("./src/utils/mp4-tools.ts"),M=C("./src/utils/typed-array.ts"),R=function(){function y(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var T=y.prototype;return T.resetInitSegment=function(E,b,v){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},T.resetTimeStamp=function(){},T.resetContiguity=function(){},T.canParse=function(E,b){return!1},T.appendFrame=function(E,b,v){},T.demux=function(E,b){this.cachedData&&(E=Object(K.appendUint8Array)(this.cachedData,E),this.cachedData=null);var v=O.getID3Data(E,0),l=v?v.length:0,e,s,a=this._audioTrack,c=this._id3Track,d=v?O.getTimeStamp(v):void 0,o=E.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=L(d,b)),v&&v.length>0&&c.samples.push({pts:this.initPTS,dts:this.initPTS,data:v}),s=this.initPTS;l<o;){if(this.canParse(E,l)){var f=this.appendFrame(a,E,l);f?(this.frameIndex++,s=f.sample.pts,l+=f.length,e=l):l=o}else O.canParse(E,l)?(v=O.getID3Data(E,l),c.samples.push({pts:s,dts:s,data:v}),l+=v.length,e=l):l++;if(l===o&&e!==o){var u=Object(M.sliceUint8)(E,e);this.cachedData?this.cachedData=Object(K.appendUint8Array)(this.cachedData,u):this.cachedData=u}}return{audioTrack:a,avcTrack:Object(x.dummyTrack)(),id3Track:c,textTrack:Object(x.dummyTrack)()}},T.demuxSampleAes=function(E,b,v){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},T.flush=function(E){var b=this.cachedData;return b&&(this.cachedData=null,this.demux(b,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(x.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(x.dummyTrack)()}},T.destroy=function(){},y}(),L=function(T,w){return Object(j.isFiniteNumber)(T)?T*90:w*9e4};U.default=R},"./src/demux/chunk-cache.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"default",function(){return j});var j=function(){function x(){this.chunks=[],this.dataLength=0}var K=x.prototype;return K.push=function(R){this.chunks.push(R),this.dataLength+=R.length},K.flush=function(){var R=this.chunks,L=this.dataLength,y;if(R.length)R.length===1?y=R[0]:y=O(R,L);else return new Uint8Array(0);return this.reset(),y},K.reset=function(){this.chunks.length=0,this.dataLength=0},x}();function O(x,K){for(var M=new Uint8Array(K),R=0,L=0;L<x.length;L++){var y=x[L];M.set(y,R),R+=y.length}return M}},"./src/demux/dummy-demuxed-track.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"dummyTrack",function(){return j});function j(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ve,U,C){"use strict";C.r(U);var j=C("./src/utils/logger.ts"),O=function(){function x(M){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=M,this.bytesAvailable=M.byteLength,this.word=0,this.bitsAvailable=0}var K=x.prototype;return K.loadWord=function(){var R=this.data,L=this.bytesAvailable,y=R.byteLength-L,T=new Uint8Array(4),w=Math.min(4,L);if(w===0)throw new Error("no bytes available");T.set(R.subarray(y,y+w)),this.word=new DataView(T.buffer).getUint32(0),this.bitsAvailable=w*8,this.bytesAvailable-=w},K.skipBits=function(R){var L;this.bitsAvailable>R?(this.word<<=R,this.bitsAvailable-=R):(R-=this.bitsAvailable,L=R>>3,R-=L>>3,this.bytesAvailable-=L,this.loadWord(),this.word<<=R,this.bitsAvailable-=R)},K.readBits=function(R){var L=Math.min(this.bitsAvailable,R),y=this.word>>>32-L;return R>32&&j.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=L,this.bitsAvailable>0?this.word<<=L:this.bytesAvailable>0&&this.loadWord(),L=R-L,L>0&&this.bitsAvailable?y<<L|this.readBits(L):y},K.skipLZ=function(){var R;for(R=0;R<this.bitsAvailable;++R)if((this.word&2147483648>>>R)!==0)return this.word<<=R,this.bitsAvailable-=R,R;return this.loadWord(),R+this.skipLZ()},K.skipUEG=function(){this.skipBits(1+this.skipLZ())},K.skipEG=function(){this.skipBits(1+this.skipLZ())},K.readUEG=function(){var R=this.skipLZ();return this.readBits(R+1)-1},K.readEG=function(){var R=this.readUEG();return 1&R?1+R>>>1:-1*(R>>>1)},K.readBoolean=function(){return this.readBits(1)===1},K.readUByte=function(){return this.readBits(8)},K.readUShort=function(){return this.readBits(16)},K.readUInt=function(){return this.readBits(32)},K.skipScalingList=function(R){for(var L=8,y=8,T,w=0;w<R;w++)y!==0&&(T=this.readEG(),y=(L+T+256)%256),L=y===0?L:y},K.readSPS=function(){var R=0,L=0,y=0,T=0,w,E,b,v=this.readUByte.bind(this),l=this.readBits.bind(this),e=this.readUEG.bind(this),s=this.readBoolean.bind(this),a=this.skipBits.bind(this),c=this.skipEG.bind(this),d=this.skipUEG.bind(this),o=this.skipScalingList.bind(this);v();var f=v();if(l(5),a(3),v(),d(),f===100||f===110||f===122||f===244||f===44||f===83||f===86||f===118||f===128){var u=e();if(u===3&&a(1),d(),d(),a(1),s())for(E=u!==3?8:12,b=0;b<E;b++)s()&&(b<6?o(16):o(64))}d();var i=e();if(i===0)e();else if(i===1)for(a(1),c(),c(),w=e(),b=0;b<w;b++)c();d(),a(1);var r=e(),t=e(),n=l(1);n===0&&a(1),a(1),s()&&(R=e(),L=e(),y=e(),T=e());var g=[1,1];if(s()&&s()){var p=v();switch(p){case 1:g=[1,1];break;case 2:g=[12,11];break;case 3:g=[10,11];break;case 4:g=[16,11];break;case 5:g=[40,33];break;case 6:g=[24,11];break;case 7:g=[20,11];break;case 8:g=[32,11];break;case 9:g=[80,33];break;case 10:g=[18,11];break;case 11:g=[15,11];break;case 12:g=[64,33];break;case 13:g=[160,99];break;case 14:g=[4,3];break;case 15:g=[3,2];break;case 16:g=[2,1];break;case 255:{g=[v()<<8|v(),v()<<8|v()];break}}}return{width:Math.ceil((r+1)*16-R*2-L*2),height:(2-n)*(t+1)*16-(n?2:4)*(y+T),pixelRatio:g}},K.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},x}();U.default=O},"./src/demux/id3.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"isHeader",function(){return j}),C.d(U,"isFooter",function(){return O}),C.d(U,"getID3Data",function(){return x}),C.d(U,"canParse",function(){return M}),C.d(U,"getTimeStamp",function(){return R}),C.d(U,"isTimeStampFrame",function(){return L}),C.d(U,"getID3Frames",function(){return T}),C.d(U,"decodeFrame",function(){return w}),C.d(U,"utf8ArrayToStr",function(){return e}),C.d(U,"testables",function(){return s});var j=function(o,f){return f+10<=o.length&&(o[f]===73&&o[f+1]===68&&o[f+2]===51&&(o[f+3]<255&&o[f+4]<255&&(o[f+6]<128&&o[f+7]<128&&o[f+8]<128&&o[f+9]<128)))},O=function(o,f){return f+10<=o.length&&(o[f]===51&&o[f+1]===68&&o[f+2]===73&&(o[f+3]<255&&o[f+4]<255&&(o[f+6]<128&&o[f+7]<128&&o[f+8]<128&&o[f+9]<128)))},x=function(o,f){for(var u=f,i=0;j(o,f);){i+=10;var r=K(o,f+6);i+=r,O(o,f+10)&&(i+=10),f+=i}return i>0?o.subarray(u,u+i):void 0},K=function(o,f){var u=0;return u=(o[f]&127)<<21,u|=(o[f+1]&127)<<14,u|=(o[f+2]&127)<<7,u|=o[f+3]&127,u},M=function(o,f){return j(o,f)&&K(o,f+6)+10<=o.length-f},R=function(o){for(var f=T(o),u=0;u<f.length;u++){var i=f[u];if(L(i))return l(i)}return},L=function(o){return o&&o.key==="PRIV"&&o.info==="com.apple.streaming.transportStreamTimestamp"},y=function(o){var f=String.fromCharCode(o[0],o[1],o[2],o[3]),u=K(o,4),i=10;return{type:f,size:u,data:o.subarray(i,i+u)}},T=function(o){for(var f=0,u=[];j(o,f);){var i=K(o,f+6);f+=10;for(var r=f+i;f+8<r;){var t=y(o.subarray(f)),n=w(t);n&&u.push(n),f+=t.size+10}O(o,f)&&(f+=10)}return u},w=function(o){return o.type==="PRIV"?E(o):o.type[0]==="W"?v(o):b(o)},E=function(o){if(o.size<2)return;var f=e(o.data,!0),u=new Uint8Array(o.data.subarray(f.length+1));return{key:o.type,info:f,data:u.buffer}},b=function(o){if(o.size<2)return;if(o.type==="TXXX"){var f=1,u=e(o.data.subarray(f),!0);f+=u.length+1;var i=e(o.data.subarray(f));return{key:o.type,info:u,data:i}}var r=e(o.data.subarray(1));return{key:o.type,data:r}},v=function(o){if(o.type==="WXXX"){if(o.size<2)return;var f=1,u=e(o.data.subarray(f),!0);f+=u.length+1;var i=e(o.data.subarray(f));return{key:o.type,info:u,data:i}}var r=e(o.data);return{key:o.type,data:r}},l=function(o){if(o.data.byteLength===8){var f=new Uint8Array(o.data),u=f[3]&1,i=(f[4]<<23)+(f[5]<<15)+(f[6]<<7)+f[7];return i/=45,u&&(i+=4772185884e-2),Math.round(i)}return},e=function(o,f){f===void 0&&(f=!1);var u=c();if(u){var i=u.decode(o);if(f){var r=i.indexOf("\0");return r!==-1?i.substring(0,r):i}return i.replace(/\0/g,"")}for(var t=o.length,n,g,p,S="",k=0;k<t;){if(n=o[k++],n===0&&f)return S;if(n===0||n===3)continue;switch(n>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:S+=String.fromCharCode(n);break;case 12:case 13:g=o[k++],S+=String.fromCharCode((n&31)<<6|g&63);break;case 14:g=o[k++],p=o[k++],S+=String.fromCharCode((n&15)<<12|(g&63)<<6|(p&63)<<0);break;default:}}return S},s={decodeTextFrame:b},a;function c(){return!a&&typeof self.TextDecoder!="undefined"&&(a=new self.TextDecoder("utf-8")),a}},"./src/demux/mp3demuxer.ts":function(ve,U,C){"use strict";C.r(U);var j=C("./src/demux/base-audio-demuxer.ts"),O=C("./src/demux/id3.ts"),x=C("./src/utils/logger.ts"),K=C("./src/demux/mpegaudio.ts");function M(y,T){y.prototype=Object.create(T.prototype),y.prototype.constructor=y,R(y,T)}function R(y,T){return R=Object.setPrototypeOf||function(E,b){return E.__proto__=b,E},R(y,T)}var L=function(y){M(T,y);function T(){return y.apply(this,arguments)||this}var w=T.prototype;return w.resetInitSegment=function(b,v,l){y.prototype.resetInitSegment.call(this,b,v,l),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:b,duration:l,inputTimeScale:9e4,dropped:0}},T.probe=function(b){if(!b)return!1;for(var v=O.getID3Data(b,0)||[],l=v.length,e=b.length;l<e;l++)if(K.probe(b,l))return x.logger.log("MPEG Audio sync word found !"),!0;return!1},w.canParse=function(b,v){return K.canParse(b,v)},w.appendFrame=function(b,v,l){return this.initPTS===null?void 0:K.appendFrame(b,v,l,this.initPTS,this.frameIndex)},T}(j.default);L.minProbeByteLength=4,U.default=L},"./src/demux/mp4demuxer.ts":function(ve,U,C){"use strict";C.r(U);var j=C("./src/utils/mp4-tools.ts"),O=C("./src/demux/dummy-demuxed-track.ts"),x=function(){function K(R,L){this.remainderData=null,this.config=void 0,this.config=L}var M=K.prototype;return M.resetTimeStamp=function(){},M.resetInitSegment=function(){},M.resetContiguity=function(){},K.probe=function(L){return Object(j.findBox)({data:L,start:0,end:Math.min(L.length,16384)},["moof"]).length>0},M.demux=function(L){var y=L,T=Object(O.dummyTrack)();if(this.config.progressive){this.remainderData&&(y=Object(j.appendUint8Array)(this.remainderData,L));var w=Object(j.segmentValidRange)(y);this.remainderData=w.remainder,T.samples=w.valid||new Uint8Array}else T.samples=y;return{audioTrack:Object(O.dummyTrack)(),avcTrack:T,id3Track:Object(O.dummyTrack)(),textTrack:Object(O.dummyTrack)()}},M.flush=function(){var L=Object(O.dummyTrack)();return L.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(O.dummyTrack)(),avcTrack:L,id3Track:Object(O.dummyTrack)(),textTrack:Object(O.dummyTrack)()}},M.demuxSampleAes=function(L,y,T){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},M.destroy=function(){},K}();x.minProbeByteLength=1024,U.default=x},"./src/demux/mpegaudio.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"appendFrame",function(){return R}),C.d(U,"parseHeader",function(){return L}),C.d(U,"isHeaderPattern",function(){return y}),C.d(U,"isHeader",function(){return T}),C.d(U,"canParse",function(){return w}),C.d(U,"probe",function(){return E});var j=null,O=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],x=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],K=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],M=[0,1,1,4];function R(b,v,l,e,s){if(l+24>v.length)return;var a=L(v,l);if(a&&l+a.frameLength<=v.length){var c=a.samplesPerFrame*9e4/a.sampleRate,d=e+s*c,o={unit:v.subarray(l,l+a.frameLength),pts:d,dts:d};return b.config=[],b.channelCount=a.channelCount,b.samplerate=a.sampleRate,b.samples.push(o),{sample:o,length:a.frameLength,missing:0}}}function L(b,v){var l=b[v+1]>>3&3,e=b[v+1]>>1&3,s=b[v+2]>>4&15,a=b[v+2]>>2&3;if(l!==1&&s!==0&&s!==15&&a!==3){var c=b[v+2]>>1&1,d=b[v+3]>>6,o=l===3?3-e:e===3?3:4,f=O[o*14+s-1]*1e3,u=l===3?0:l===2?1:2,i=x[u*3+a],r=d===3?1:2,t=K[l][e],n=M[e],g=t*8*n,p=Math.floor(t*f/i+c)*n;if(j===null){var S=navigator.userAgent||"",k=S.match(/Chrome\/(\d+)/i);j=k?parseInt(k[1]):0}var I=!!j&&j<=87;return I&&e===2&&f>=224e3&&d===0&&(b[v+3]=b[v+3]|128),{sampleRate:i,channelCount:r,frameLength:p,samplesPerFrame:g}}}function y(b,v){return b[v]===255&&(b[v+1]&224)===224&&(b[v+1]&6)!==0}function T(b,v){return v+1<b.length&&y(b,v)}function w(b,v){var l=4;return y(b,v)&&l<=b.length-v}function E(b,v){if(v+1<b.length&&y(b,v)){var l=4,e=L(b,v),s=l;e!=null&&e.frameLength&&(s=e.frameLength);var a=v+s;return a===b.length||T(b,a)}return!1}},"./src/demux/sample-aes.ts":function(ve,U,C){"use strict";C.r(U);var j=C("./src/crypt/decrypter.ts"),O=C("./src/demux/tsdemuxer.ts"),x=function(){function K(R,L,y){this.keyData=void 0,this.decrypter=void 0,this.keyData=y,this.decrypter=new j.default(R,L,{removePKCS7Padding:!1})}var M=K.prototype;return M.decryptBuffer=function(L,y){this.decrypter.decrypt(L,this.keyData.key.buffer,this.keyData.iv.buffer,y)},M.decryptAacSample=function(L,y,T,w){var E=L[y].unit,b=E.subarray(16,E.length-E.length%16),v=b.buffer.slice(b.byteOffset,b.byteOffset+b.length),l=this;this.decryptBuffer(v,function(e){var s=new Uint8Array(e);E.set(s,16),w||l.decryptAacSamples(L,y+1,T)})},M.decryptAacSamples=function(L,y,T){for(;;y++){if(y>=L.length){T();return}if(L[y].unit.length<32)continue;var w=this.decrypter.isSync();if(this.decryptAacSample(L,y,T,w),!w)return}},M.getAvcEncryptedData=function(L){for(var y=Math.floor((L.length-48)/160)*16+16,T=new Int8Array(y),w=0,E=32;E<=L.length-16;E+=160,w+=16)T.set(L.subarray(E,E+16),w);return T},M.getAvcDecryptedUnit=function(L,y){for(var T=new Uint8Array(y),w=0,E=32;E<=L.length-16;E+=160,w+=16)L.set(T.subarray(w,w+16),E);return L},M.decryptAvcSample=function(L,y,T,w,E,b){var v=Object(O.discardEPB)(E.data),l=this.getAvcEncryptedData(v),e=this;this.decryptBuffer(l.buffer,function(s){E.data=e.getAvcDecryptedUnit(v,s),b||e.decryptAvcSamples(L,y,T+1,w)})},M.decryptAvcSamples=function(L,y,T,w){if(L instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;y++,T=0){if(y>=L.length){w();return}for(var E=L[y].units;!(T>=E.length);T++){var b=E[T];if(b.data.length<=48||b.type!==1&&b.type!==5)continue;var v=this.decrypter.isSync();if(this.decryptAvcSample(L,y,T,w,b,v),!v)return}}},K}();U.default=x},"./src/demux/transmuxer-interface.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"default",function(){return E});var j=C("./node_modules/webworkify-webpack/index.js"),O=C.n(j),x=C("./src/events.ts"),K=C("./src/demux/transmuxer.ts"),M=C("./src/utils/logger.ts"),R=C("./src/errors.ts"),L=C("./src/utils/mediasource-helper.ts"),y=C("./node_modules/eventemitter3/index.js"),T=C.n(y),w=Object(L.getMediaSource)()||{isTypeSupported:function(){return!1}},E=function(){function b(l,e,s,a){var c=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=l,this.id=e,this.onTransmuxComplete=s,this.onFlush=a;var d=l.config,o=function(t,n){n=n||{},n.frag=c.frag,n.id=c.id,l.trigger(t,n)};this.observer=new y.EventEmitter,this.observer.on(x.Events.FRAG_DECRYPTED,o),this.observer.on(x.Events.ERROR,o);var f={mp4:w.isTypeSupported("video/mp4"),mpeg:w.isTypeSupported("audio/mpeg"),mp3:w.isTypeSupported('audio/mp4; codecs="mp3"')},u=navigator.vendor;if(d.enableWorker&&typeof Worker!="undefined"){M.logger.log("demuxing in webworker");var i;try{i=this.worker=j("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),i.addEventListener("message",this.onwmsg),i.onerror=function(r){l.trigger(x.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(r.message+" ("+r.filename+":"+r.lineno+")")})},i.postMessage({cmd:"init",typeSupported:f,vendor:u,id:e,config:JSON.stringify(d)})}catch(r){M.logger.warn("Error in worker:",r),M.logger.error("Error while initializing DemuxerWorker, fallback to inline"),i&&self.URL.revokeObjectURL(i.objectURL),this.transmuxer=new K.default(this.observer,f,d,u,e),this.worker=null}}else this.transmuxer=new K.default(this.observer,f,d,u,e)}var v=b.prototype;return v.destroy=function(){var e=this.worker;if(e)e.removeEventListener("message",this.onwmsg),e.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var a=this.observer;a&&a.removeAllListeners(),this.observer=null},v.push=function(e,s,a,c,d,o,f,u,i,r){var t=this;i.transmuxing.start=self.performance.now();var n=this.transmuxer,g=this.worker,p=o?o.start:d.start,S=d.decryptdata,k=this.frag,I=!(k&&d.cc===k.cc),G=!(k&&i.level===k.level),V=k?i.sn-k.sn:-1,J=this.part?i.part-this.part.index:1,re=!G&&(V===1||V===0&&J===1),ee=self.performance.now();(G||V||d.stats.parsing.start===0)&&(d.stats.parsing.start=ee),o&&(J||!re)&&(o.stats.parsing.start=ee);var ae=new K.TransmuxState(I,re,u,G,p);if(!re||I){M.logger.log("[transmuxer-interface, "+d.type+"]: Starting new transmux session for sn: "+i.sn+" p: "+i.part+" level: "+i.level+" id: "+i.id+`
discontinuity: `+I+`
trackSwitch: `+G+`
contiguous: `+re+`
accurateTimeOffset: `+u+`
timeOffset: `+p);var be=new K.TransmuxConfig(a,c,s,f,r);this.configureTransmuxer(be)}if(this.frag=d,this.part=o,g)g.postMessage({cmd:"demux",data:e,decryptdata:S,chunkMeta:i,state:ae},e instanceof ArrayBuffer?[e]:[]);else if(n){var he=n.push(e,S,i,ae);Object(K.isPromise)(he)?he.then(function(me){t.handleTransmuxComplete(me)}):this.handleTransmuxComplete(he)}},v.flush=function(e){var s=this;e.transmuxing.start=self.performance.now();var a=this.transmuxer,c=this.worker;if(c)c.postMessage({cmd:"flush",chunkMeta:e});else if(a){var d=a.flush(e);Object(K.isPromise)(d)?d.then(function(o){s.handleFlushResult(o,e)}):this.handleFlushResult(d,e)}},v.handleFlushResult=function(e,s){var a=this;e.forEach(function(c){a.handleTransmuxComplete(c)}),this.onFlush(s)},v.onWorkerMessage=function(e){var s=e.data,a=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,a.trigger(s.event,s.data);break}}},v.configureTransmuxer=function(e){var s=this.worker,a=this.transmuxer;s?s.postMessage({cmd:"configure",config:e}):a&&a.configure(e)},v.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},b}()},"./src/demux/transmuxer-worker.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"default",function(){return R});var j=C("./src/demux/transmuxer.ts"),O=C("./src/events.ts"),x=C("./src/utils/logger.ts"),K=C("./node_modules/eventemitter3/index.js"),M=C.n(K);function R(E){var b=new K.EventEmitter,v=function(e,s){E.postMessage({event:e,data:s})};b.on(O.Events.FRAG_DECRYPTED,v),b.on(O.Events.ERROR,v),E.addEventListener("message",function(l){var e=l.data;switch(e.cmd){case"init":{var s=JSON.parse(e.config);E.transmuxer=new j.default(b,e.typeSupported,s,e.vendor,e.id),Object(x.enableLogs)(s.debug),v("init",null);break}case"configure":{E.transmuxer.configure(e.config);break}case"demux":{var a=E.transmuxer.push(e.data,e.decryptdata,e.chunkMeta,e.state);Object(j.isPromise)(a)?a.then(function(o){L(E,o)}):L(E,a);break}case"flush":{var c=e.chunkMeta,d=E.transmuxer.flush(c);Object(j.isPromise)(d)?d.then(function(o){T(E,o,c)}):T(E,d,c);break}default:break}})}function L(E,b){if(w(b.remuxResult))return;var v=[],l=b.remuxResult,e=l.audio,s=l.video;e&&y(v,e),s&&y(v,s),E.postMessage({event:"transmuxComplete",data:b},v)}function y(E,b){b.data1&&E.push(b.data1.buffer),b.data2&&E.push(b.data2.buffer)}function T(E,b,v){b.forEach(function(l){L(E,l)}),E.postMessage({event:"flush",data:v})}function w(E){return!E.audio&&!E.video&&!E.text&&!E.id3&&!E.initSegment}},"./src/demux/transmuxer.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"default",function(){return s}),C.d(U,"isPromise",function(){return d}),C.d(U,"TransmuxConfig",function(){return o}),C.d(U,"TransmuxState",function(){return f});var j=C("./src/events.ts"),O=C("./src/errors.ts"),x=C("./src/crypt/decrypter.ts"),K=C("./src/demux/aacdemuxer.ts"),M=C("./src/demux/mp4demuxer.ts"),R=C("./src/demux/tsdemuxer.ts"),L=C("./src/demux/mp3demuxer.ts"),y=C("./src/remux/mp4-remuxer.ts"),T=C("./src/remux/passthrough-remuxer.ts"),w=C("./src/demux/chunk-cache.ts"),E=C("./src/utils/mp4-tools.ts"),b=C("./src/utils/logger.ts"),v;try{v=self.performance.now.bind(self.performance)}catch(u){b.logger.debug("Unable to use Performance API on this environment"),v=self.Date.now}var l=[{demux:R.default,remux:y.default},{demux:M.default,remux:T.default},{demux:K.default,remux:y.default},{demux:L.default,remux:y.default}],e=1024;l.forEach(function(u){var i=u.demux;e=Math.max(e,i.minProbeByteLength)});var s=function(){function u(r,t,n,g,p){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new w.default,this.observer=r,this.typeSupported=t,this.config=n,this.vendor=g,this.id=p}var i=u.prototype;return i.configure=function(t){this.transmuxConfig=t,this.decrypter&&this.decrypter.reset()},i.push=function(t,n,g,p){var S=this,k=g.transmuxing;k.executeStart=v();var I=new Uint8Array(t),G=this.cache,V=this.config,J=this.currentTransmuxState,re=this.transmuxConfig;p&&(this.currentTransmuxState=p);var ee=a(I,n);if(ee&&ee.method==="AES-128"){var ae=this.getDecrypter();if(V.enableSoftwareAES){var be=ae.softwareDecrypt(I,ee.key.buffer,ee.iv.buffer);if(!be)return k.executeEnd=v(),c(g);I=new Uint8Array(be)}else return this.decryptionPromise=ae.webCryptoDecrypt(I,ee.key.buffer,ee.iv.buffer).then(function(ne){var ue=S.push(ne,null,g);return S.decryptionPromise=null,ue}),this.decryptionPromise}var he=p||J,me=he.contiguous,ce=he.discontinuity,te=he.trackSwitch,q=he.accurateTimeOffset,oe=he.timeOffset,Z=re.audioCodec,D=re.videoCodec,h=re.defaultInitPts,m=re.duration,P=re.initSegmentData;if((ce||te)&&this.resetInitSegment(P,Z,D,m),ce&&this.resetInitialTimestamp(h),me||this.resetContiguity(),this.needsProbing(I,ce,te)){if(G.dataLength){var _=G.flush();I=Object(E.appendUint8Array)(_,I)}this.configureTransmuxer(I,re)}var A=this.transmux(I,ee,oe,q,g),Y=this.currentTransmuxState;return Y.contiguous=!0,Y.discontinuity=!1,Y.trackSwitch=!1,k.executeEnd=v(),A},i.flush=function(t){var n=this,g=t.transmuxing;g.executeStart=v();var p=this.decrypter,S=this.cache,k=this.currentTransmuxState,I=this.decryptionPromise;if(I)return I.then(function(){return n.flush(t)});var G=[],V=k.timeOffset;if(p){var J=p.flush();J&&G.push(this.push(J,null,t))}var re=S.dataLength;S.reset();var ee=this.demuxer,ae=this.remuxer;if(!ee||!ae)return re>=e&&this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),g.executeEnd=v(),[c(t)];var be=ee.flush(V);return d(be)?be.then(function(he){return n.flushRemux(G,he,t),G}):(this.flushRemux(G,be,t),G)},i.flushRemux=function(t,n,g){var p=n.audioTrack,S=n.avcTrack,k=n.id3Track,I=n.textTrack,G=this.currentTransmuxState,V=G.accurateTimeOffset,J=G.timeOffset;b.logger.log("[transmuxer.ts]: Flushed fragment "+g.sn+(g.part>-1?" p: "+g.part:"")+" of level "+g.level);var re=this.remuxer.remux(p,S,k,I,J,V,!0,this.id);t.push({remuxResult:re,chunkMeta:g}),g.transmuxing.executeEnd=v()},i.resetInitialTimestamp=function(t){var n=this.demuxer,g=this.remuxer;if(!n||!g)return;n.resetTimeStamp(t),g.resetTimeStamp(t)},i.resetContiguity=function(){var t=this.demuxer,n=this.remuxer;if(!t||!n)return;t.resetContiguity(),n.resetNextTimestamp()},i.resetInitSegment=function(t,n,g,p){var S=this.demuxer,k=this.remuxer;if(!S||!k)return;S.resetInitSegment(n,g,p),k.resetInitSegment(t,n,g)},i.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},i.transmux=function(t,n,g,p,S){var k;return n&&n.method==="SAMPLE-AES"?k=this.transmuxSampleAes(t,n,g,p,S):k=this.transmuxUnencrypted(t,g,p,S),k},i.transmuxUnencrypted=function(t,n,g,p){var S=this.demuxer.demux(t,n,!1,!this.config.progressive),k=S.audioTrack,I=S.avcTrack,G=S.id3Track,V=S.textTrack,J=this.remuxer.remux(k,I,G,V,n,g,!1,this.id);return{remuxResult:J,chunkMeta:p}},i.transmuxSampleAes=function(t,n,g,p,S){var k=this;return this.demuxer.demuxSampleAes(t,n,g).then(function(I){var G=k.remuxer.remux(I.audioTrack,I.avcTrack,I.id3Track,I.textTrack,g,p,!1,k.id);return{remuxResult:G,chunkMeta:S}})},i.configureTransmuxer=function(t,n){for(var g=this.config,p=this.observer,S=this.typeSupported,k=this.vendor,I=n.audioCodec,G=n.defaultInitPts,V=n.duration,J=n.initSegmentData,re=n.videoCodec,ee,ae=0,be=l.length;ae<be;ae++)if(l[ae].demux.probe(t)){ee=l[ae];break}ee||(b.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),ee={demux:M.default,remux:T.default});var he=this.demuxer,me=this.remuxer,ce=ee.remux,te=ee.demux;(!me||!(me instanceof ce))&&(this.remuxer=new ce(p,g,S,k)),(!he||!(he instanceof te))&&(this.demuxer=new te(p,g,S),this.probe=te.probe),this.resetInitSegment(J,I,re,V),this.resetInitialTimestamp(G)},i.needsProbing=function(t,n,g){return!this.demuxer||!this.remuxer||n||g},i.getDecrypter=function(){var t=this.decrypter;return t||(t=this.decrypter=new x.default(this.observer,this.config)),t},u}();function a(u,i){var r=null;return u.byteLength>0&&i!=null&&i.key!=null&&i.iv!==null&&i.method!=null&&(r=i),r}var c=function(i){return{remuxResult:{},chunkMeta:i}};function d(u){return"then"in u&&u.then instanceof Function}var o=function(i,r,t,n,g){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=i,this.videoCodec=r,this.initSegmentData=t,this.duration=n,this.defaultInitPts=g},f=function(i,r,t,n,g){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=i,this.contiguous=r,this.accurateTimeOffset=t,this.trackSwitch=n,this.timeOffset=g}},"./src/demux/tsdemuxer.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"discardEPB",function(){return c});var j=C("./src/demux/adts.ts"),O=C("./src/demux/mpegaudio.ts"),x=C("./src/demux/exp-golomb.ts"),K=C("./src/demux/id3.ts"),M=C("./src/demux/sample-aes.ts"),R=C("./src/events.ts"),L=C("./src/utils/mp4-tools.ts"),y=C("./src/utils/logger.ts"),T=C("./src/errors.ts"),w={video:1,audio:2,id3:3,text:4},E=function(){function d(f,u,i){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=f,this.config=u,this.typeSupported=i}d.probe=function(u){var i=d.syncOffset(u);return i<0?!1:(i&&y.logger.warn("MPEG2-TS detected but first sync word found @ offset "+i+", junk ahead ?"),!0)},d.syncOffset=function(u){for(var i=Math.min(1e3,u.length-3*188),r=0;r<i;){if(u[r]===71&&u[r+188]===71&&u[r+2*188]===71)return r;r++}return-1},d.createTrack=function(u,i){return{container:u==="video"||u==="audio"?"video/mp2t":void 0,type:u,id:w[u],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:u==="audio"?i:void 0}};var o=d.prototype;return o.resetInitSegment=function(u,i,r){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=d.createTrack("video",r),this._audioTrack=d.createTrack("audio",r),this._id3Track=d.createTrack("id3",r),this._txtTrack=d.createTrack("text",r),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=u,this.videoCodec=i,this._duration=r},o.resetTimeStamp=function(){},o.resetContiguity=function(){var u=this._audioTrack,i=this._avcTrack,r=this._id3Track;u&&(u.pesData=null),i&&(i.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},o.demux=function(u,i,r,t){r===void 0&&(r=!1),t===void 0&&(t=!1),r||(this.sampleAes=null);var n,g=this._avcTrack,p=this._audioTrack,S=this._id3Track,k=g.pid,I=g.pesData,G=p.pid,V=S.pid,J=p.pesData,re=S.pesData,ee=!1,ae=this.pmtParsed,be=this._pmtId,he=u.length;if(this.remainderData&&(u=Object(L.appendUint8Array)(this.remainderData,u),he=u.length,this.remainderData=null),he<188&&!t)return this.remainderData=u,{audioTrack:p,avcTrack:g,id3Track:S,textTrack:this._txtTrack};var me=Math.max(0,d.syncOffset(u));he-=(he+me)%188,he<u.byteLength&&!t&&(this.remainderData=new Uint8Array(u.buffer,he,u.buffer.byteLength-he));for(var ce=me;ce<he;ce+=188)if(u[ce]===71){var te=!!(u[ce+1]&64),q=((u[ce+1]&31)<<8)+u[ce+2],oe=(u[ce+3]&48)>>4,Z=void 0;if(oe>1){if(Z=ce+5+u[ce+4],Z===ce+188)continue}else Z=ce+4;switch(q){case k:te&&(I&&(n=e(I))&&this.parseAVCPES(n,!1),I={data:[],size:0}),I&&(I.data.push(u.subarray(Z,ce+188)),I.size+=ce+188-Z);break;case G:te&&(J&&(n=e(J))&&(p.isAAC?this.parseAACPES(n):this.parseMPEGPES(n)),J={data:[],size:0}),J&&(J.data.push(u.subarray(Z,ce+188)),J.size+=ce+188-Z);break;case V:te&&(re&&(n=e(re))&&this.parseID3PES(n),re={data:[],size:0}),re&&(re.data.push(u.subarray(Z,ce+188)),re.size+=ce+188-Z);break;case 0:te&&(Z+=u[Z]+1),be=this._pmtId=v(u,Z);break;case be:{te&&(Z+=u[Z]+1);var D=l(u,Z,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,r);k=D.avc,k>0&&(g.pid=k),G=D.audio,G>0&&(p.pid=G,p.isAAC=D.isAAC),V=D.id3,V>0&&(S.pid=V),ee&&!ae&&(y.logger.log("reparse from beginning"),ee=!1,ce=me-188),ae=this.pmtParsed=!0;break}case 17:case 8191:break;default:ee=!0;break}}else this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});g.pesData=I,p.pesData=J,S.pesData=re;var h={audioTrack:p,avcTrack:g,id3Track:S,textTrack:this._txtTrack};return t&&this.extractRemainingSamples(h),h},o.flush=function(){var u=this.remainderData;this.remainderData=null;var i;return u?i=this.demux(u,-1,!1,!0):i={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(i),this.sampleAes?this.decrypt(i,this.sampleAes):i},o.extractRemainingSamples=function(u){var i=u.audioTrack,r=u.avcTrack,t=u.id3Track,n=r.pesData,g=i.pesData,p=t.pesData,S;n&&(S=e(n))?(this.parseAVCPES(S,!0),r.pesData=null):r.pesData=n,g&&(S=e(g))?(i.isAAC?this.parseAACPES(S):this.parseMPEGPES(S),i.pesData=null):(g!=null&&g.size&&y.logger.log("last AAC PES packet truncated,might overlap between fragments"),i.pesData=g),p&&(S=e(p))?(this.parseID3PES(S),t.pesData=null):t.pesData=p},o.demuxSampleAes=function(u,i,r){var t=this.demux(u,r,!0,!this.config.progressive),n=this.sampleAes=new M.default(this.observer,this.config,i);return this.decrypt(t,n)},o.decrypt=function(u,i){return new Promise(function(r){var t=u.audioTrack,n=u.avcTrack;t.samples&&t.isAAC?i.decryptAacSamples(t.samples,0,function(){n.samples?i.decryptAvcSamples(n.samples,0,0,function(){r(u)}):r(u)}):n.samples&&i.decryptAvcSamples(n.samples,0,0,function(){r(u)})})},o.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},o.parseAVCPES=function(u,i){var r=this,t=this._avcTrack,n=this.parseAVCNALu(u.data),g=!1,p=this.avcSample,S,k=!1;u.data=null,p&&n.length&&!t.audFound&&(s(p,t),p=this.avcSample=b(!1,u.pts,u.dts,"")),n.forEach(function(I){switch(I.type){case 1:{S=!0,p||(p=r.avcSample=b(!0,u.pts,u.dts,"")),g&&(p.debug+="NDR "),p.frame=!0;var G=I.data;if(k&&G.length>4){var V=new x.default(G).readSliceType();(V===2||V===4||V===7||V===9)&&(p.key=!0)}break}case 5:S=!0,p||(p=r.avcSample=b(!0,u.pts,u.dts,"")),g&&(p.debug+="IDR "),p.key=!0,p.frame=!0;break;case 6:{S=!0,g&&p&&(p.debug+="SEI ");var J=new x.default(c(I.data));J.readUByte();for(var re=0,ee=0,ae=!1,be=0;!ae&&J.bytesAvailable>1;){re=0;do be=J.readUByte(),re+=be;while(be===255);ee=0;do be=J.readUByte(),ee+=be;while(be===255);if(re===4&&J.bytesAvailable!==0){ae=!0;var he=J.readUByte();if(he===181){var me=J.readUShort();if(me===49){var ce=J.readUInt();if(ce===1195456820){var te=J.readUByte();if(te===3){for(var q=J.readUByte(),oe=J.readUByte(),Z=31&q,D=[q,oe],h=0;h<Z;h++)D.push(J.readUByte()),D.push(J.readUByte()),D.push(J.readUByte());a(r._txtTrack.samples,{type:3,pts:u.pts,bytes:D})}}}}}else if(re===5&&J.bytesAvailable!==0){if(ae=!0,ee>16){for(var m=[],P=0;P<16;P++)m.push(J.readUByte().toString(16)),(P===3||P===5||P===7||P===9)&&m.push("-");for(var _=ee-16,A=new Uint8Array(_),Y=0;Y<_;Y++)A[Y]=J.readUByte();a(r._txtTrack.samples,{pts:u.pts,payloadType:re,uuid:m.join(""),userData:Object(K.utf8ArrayToStr)(A),userDataBytes:A})}}else if(ee<J.bytesAvailable)for(var ne=0;ne<ee;ne++)J.readUByte()}break}case 7:if(S=!0,k=!0,g&&p&&(p.debug+="SPS "),!t.sps){var ue=new x.default(I.data),fe=ue.readSPS();t.width=fe.width,t.height=fe.height,t.pixelRatio=fe.pixelRatio,t.sps=[I.data],t.duration=r._duration;for(var Ee=I.data.subarray(1,4),we="avc1.",Ae=0;Ae<3;Ae++){var De=Ee[Ae].toString(16);De.length<2&&(De="0"+De),we+=De}t.codec=we}break;case 8:S=!0,g&&p&&(p.debug+="PPS "),t.pps||(t.pps=[I.data]);break;case 9:S=!1,t.audFound=!0,p&&s(p,t),p=r.avcSample=b(!1,u.pts,u.dts,g?"AUD ":"");break;case 12:S=!1;break;default:S=!1,p&&(p.debug+="unknown NAL "+I.type+" ");break}if(p&&S){var se=p.units;se.push(I)}}),i&&p&&(s(p,t),this.avcSample=null)},o.getLastNalUnit=function(){var u,i=this.avcSample,r;if(!i||i.units.length===0){var t=this._avcTrack.samples;i=t[t.length-1]}if((u=i)!==null&&u!==void 0&&u.units){var n=i.units;r=n[n.length-1]}return r},o.parseAVCNALu=function(u){var i=u.byteLength,r=this._avcTrack,t=r.naluState||0,n=t,g=[],p=0,S,k,I,G=-1,V=0;for(t===-1&&(G=0,V=u[0]&31,t=0,p=1);p<i;){if(S=u[p++],!t){t=S?0:1;continue}if(t===1){t=S?0:2;continue}if(!S)t=3;else if(S===1){if(G>=0){var J={data:u.subarray(G,p-t-1),type:V};g.push(J)}else{var re=this.getLastNalUnit();if(re&&(n&&p<=4-n&&(re.state&&(re.data=re.data.subarray(0,re.data.byteLength-n))),k=p-t-1,k>0)){var ee=new Uint8Array(re.data.byteLength+k);ee.set(re.data,0),ee.set(u.subarray(0,k),re.data.byteLength),re.data=ee,re.state=0}}p<i?(I=u[p]&31,G=p,V=I,t=0):t=-1}else t=0}if(G>=0&&t>=0){var ae={data:u.subarray(G,i),type:V,state:t};g.push(ae)}if(g.length===0){var be=this.getLastNalUnit();if(be){var he=new Uint8Array(be.data.byteLength+u.byteLength);he.set(be.data,0),he.set(u,be.data.byteLength),be.data=he}}return r.naluState=t,g},o.parseAACPES=function(u){var i=0,r=this._audioTrack,t=this.aacOverFlow,n=u.data;if(t){this.aacOverFlow=null;var g=t.sample.unit.byteLength,p=Math.min(t.missing,g),S=g-p;t.sample.unit.set(n.subarray(0,p),S),r.samples.push(t.sample),i=t.missing}var k,I;for(k=i,I=n.length;k<I-1&&!j.isHeader(n,k);k++);if(k!==i){var G,V;if(k<I-1?(G="AAC PES did not start with ADTS header,offset:"+k,V=!1):(G="no ADTS header found in AAC PES",V=!0),y.logger.warn("parsing error:"+G),this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:V,reason:G}),V)return}j.initTrackConfig(r,this.observer,n,k,this.audioCodec);var J;if(u.pts!==void 0)J=u.pts;else if(t){var re=j.getFrameDuration(r.samplerate);J=t.sample.pts+re}else{y.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var ee=0;k<I;)if(j.isHeader(n,k)){if(k+5<I){var ae=j.appendFrame(r,n,k,J,ee);if(ae)if(ae.missing)this.aacOverFlow=ae;else{k+=ae.length,ee++;continue}}break}else k++},o.parseMPEGPES=function(u){var i=u.data,r=i.length,t=0,n=0,g=u.pts;if(g===void 0){y.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;n<r;)if(O.isHeader(i,n)){var p=O.appendFrame(this._audioTrack,i,n,g,t);if(p)n+=p.length,t++;else break}else n++},o.parseID3PES=function(u){if(u.pts===void 0){y.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(u)},d}();E.minProbeByteLength=188;function b(d,o,f,u){return{key:d,frame:!1,pts:o,dts:f,units:[],debug:u,length:0}}function v(d,o){return(d[o+10]&31)<<8|d[o+11]}function l(d,o,f,u){var i={audio:-1,avc:-1,id3:-1,isAAC:!0},r=(d[o+1]&15)<<8|d[o+2],t=o+3+r-4,n=(d[o+10]&15)<<8|d[o+11];for(o+=12+n;o<t;){var g=(d[o+1]&31)<<8|d[o+2];switch(d[o]){case 207:if(!u){y.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:i.audio===-1&&(i.audio=g);break;case 21:i.id3===-1&&(i.id3=g);break;case 219:if(!u){y.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:i.avc===-1&&(i.avc=g);break;case 3:case 4:f?i.audio===-1&&(i.audio=g,i.isAAC=!1):y.logger.log("MPEG audio found, not supported in this browser");break;case 36:y.logger.warn("Unsupported HEVC stream type found");break;default:break}o+=((d[o+3]&15)<<8|d[o+4])+5}return i}function e(d){var o=0,f,u,i,r,t,n=d.data;if(!d||d.size===0)return null;for(;n[0].length<19&&n.length>1;){var g=new Uint8Array(n[0].length+n[1].length);g.set(n[0]),g.set(n[1],n[0].length),n[0]=g,n.splice(1,1)}f=n[0];var p=(f[0]<<16)+(f[1]<<8)+f[2];if(p===1){if(u=(f[4]<<8)+f[5],u&&u>d.size-6)return null;var S=f[7];S&192&&(r=(f[9]&14)*536870912+(f[10]&255)*4194304+(f[11]&254)*16384+(f[12]&255)*128+(f[13]&254)/2,S&64?(t=(f[14]&14)*536870912+(f[15]&255)*4194304+(f[16]&254)*16384+(f[17]&255)*128+(f[18]&254)/2,r-t>60*9e4&&(y.logger.warn(Math.round((r-t)/9e4)+"s delta between PTS and DTS, align them"),r=t)):t=r),i=f[8];var k=i+9;if(d.size<=k)return null;d.size-=k;for(var I=new Uint8Array(d.size),G=0,V=n.length;G<V;G++){f=n[G];var J=f.byteLength;if(k)if(k>J){k-=J;continue}else f=f.subarray(k),J-=k,k=0;I.set(f,o),o+=J}return u&&(u-=i+3),{data:I,pts:r,dts:t,len:u}}return null}function s(d,o){if(d.units.length&&d.frame){if(d.pts===void 0){var f=o.samples,u=f.length;if(u){var i=f[u-1];d.pts=i.pts,d.dts=i.dts}else{o.dropped++;return}}o.samples.push(d)}d.debug.length&&y.logger.log(d.pts+"/"+d.dts+":"+d.debug)}function a(d,o){var f=d.length;if(f>0){if(o.pts>=d[f-1].pts)d.push(o);else for(var u=f-1;u>=0;u--)if(o.pts<d[u].pts){d.splice(u,0,o);break}}else d.push(o)}function c(d){for(var o=d.byteLength,f=[],u=1;u<o-2;)d[u]===0&&d[u+1]===0&&d[u+2]===3?(f.push(u+2),u+=2):u++;if(f.length===0)return d;var i=o-f.length,r=new Uint8Array(i),t=0;for(u=0;u<i;t++,u++)t===f[0]&&(t++,f.shift()),r[u]=d[t];return r}U.default=E},"./src/errors.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"ErrorTypes",function(){return j}),C.d(U,"ErrorDetails",function(){return O});var j;(function(x){x.NETWORK_ERROR="networkError",x.MEDIA_ERROR="mediaError",x.KEY_SYSTEM_ERROR="keySystemError",x.MUX_ERROR="muxError",x.OTHER_ERROR="otherError"})(j||(j={}));var O;(function(x){x.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",x.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",x.KEY_SYSTEM_NO_SESSION="keySystemNoSession",x.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",x.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",x.MANIFEST_LOAD_ERROR="manifestLoadError",x.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",x.MANIFEST_PARSING_ERROR="manifestParsingError",x.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",x.LEVEL_EMPTY_ERROR="levelEmptyError",x.LEVEL_LOAD_ERROR="levelLoadError",x.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",x.LEVEL_SWITCH_ERROR="levelSwitchError",x.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",x.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",x.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",x.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",x.FRAG_LOAD_ERROR="fragLoadError",x.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",x.FRAG_DECRYPT_ERROR="fragDecryptError",x.FRAG_PARSING_ERROR="fragParsingError",x.REMUX_ALLOC_ERROR="remuxAllocError",x.KEY_LOAD_ERROR="keyLoadError",x.KEY_LOAD_TIMEOUT="keyLoadTimeOut",x.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",x.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",x.BUFFER_APPEND_ERROR="bufferAppendError",x.BUFFER_APPENDING_ERROR="bufferAppendingError",x.BUFFER_STALLED_ERROR="bufferStalledError",x.BUFFER_FULL_ERROR="bufferFullError",x.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",x.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",x.INTERNAL_EXCEPTION="internalException",x.INTERNAL_ABORTED="aborted",x.UNKNOWN="unknown"})(O||(O={}))},"./src/events.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"Events",function(){return j});var j;(function(O){O.MEDIA_ATTACHING="hlsMediaAttaching",O.MEDIA_ATTACHED="hlsMediaAttached",O.MEDIA_DETACHING="hlsMediaDetaching",O.MEDIA_DETACHED="hlsMediaDetached",O.BUFFER_RESET="hlsBufferReset",O.BUFFER_CODECS="hlsBufferCodecs",O.BUFFER_CREATED="hlsBufferCreated",O.BUFFER_APPENDING="hlsBufferAppending",O.BUFFER_APPENDED="hlsBufferAppended",O.BUFFER_EOS="hlsBufferEos",O.BUFFER_FLUSHING="hlsBufferFlushing",O.BUFFER_FLUSHED="hlsBufferFlushed",O.MANIFEST_LOADING="hlsManifestLoading",O.MANIFEST_LOADED="hlsManifestLoaded",O.MANIFEST_PARSED="hlsManifestParsed",O.LEVEL_SWITCHING="hlsLevelSwitching",O.LEVEL_SWITCHED="hlsLevelSwitched",O.LEVEL_LOADING="hlsLevelLoading",O.LEVEL_LOADED="hlsLevelLoaded",O.LEVEL_UPDATED="hlsLevelUpdated",O.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",O.LEVELS_UPDATED="hlsLevelsUpdated",O.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",O.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",O.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",O.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",O.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",O.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",O.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",O.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",O.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",O.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",O.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",O.CUES_PARSED="hlsCuesParsed",O.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",O.INIT_PTS_FOUND="hlsInitPtsFound",O.FRAG_LOADING="hlsFragLoading",O.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",O.FRAG_LOADED="hlsFragLoaded",O.FRAG_DECRYPTED="hlsFragDecrypted",O.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",O.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",O.FRAG_PARSING_METADATA="hlsFragParsingMetadata",O.FRAG_PARSED="hlsFragParsed",O.FRAG_BUFFERED="hlsFragBuffered",O.FRAG_CHANGED="hlsFragChanged",O.FPS_DROP="hlsFpsDrop",O.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",O.ERROR="hlsError",O.DESTROYING="hlsDestroying",O.KEY_LOADING="hlsKeyLoading",O.KEY_LOADED="hlsKeyLoaded",O.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",O.BACK_BUFFER_REACHED="hlsBackBufferReached"})(j||(j={}))},"./src/hls.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"default",function(){return d});var j=C("./node_modules/url-toolkit/src/url-toolkit.js"),O=C.n(j),x=C("./src/loader/playlist-loader.ts"),K=C("./src/loader/key-loader.ts"),M=C("./src/controller/id3-track-controller.ts"),R=C("./src/controller/latency-controller.ts"),L=C("./src/controller/level-controller.ts"),y=C("./src/controller/fragment-tracker.ts"),T=C("./src/controller/stream-controller.ts"),w=C("./src/is-supported.ts"),E=C("./src/utils/logger.ts"),b=C("./src/config.ts"),v=C("./node_modules/eventemitter3/index.js"),l=C.n(v),e=C("./src/events.ts"),s=C("./src/errors.ts");function a(o,f){for(var u=0;u<f.length;u++){var i=f[u];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(o,i.key,i)}}function c(o,f,u){return f&&a(o.prototype,f),u&&a(o,u),o}var d=function(){o.isSupported=function(){return Object(w.isSupported)()};function o(u){u===void 0&&(u={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new v.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var i=this.config=Object(b.mergeConfig)(o.DefaultConfig,u);this.userConfig=u,Object(E.enableLogs)(i.debug),this._autoLevelCapping=-1,i.progressive&&Object(b.enableStreamingMode)(i);var r=i.abrController,t=i.bufferController,n=i.capLevelController,g=i.fpsController,p=this.abrController=new r(this),S=this.bufferController=new t(this),k=this.capLevelController=new n(this),I=new g(this),G=new x.default(this),V=new K.default(this),J=new M.default(this),re=this.levelController=new L.default(this),ee=new y.FragmentTracker(this),ae=this.streamController=new T.default(this,ee);k.setStreamController(ae),I.setStreamController(ae);var be=[re,ae];this.networkControllers=be;var he=[G,V,p,S,k,I,J,ee];this.audioTrackController=this.createController(i.audioTrackController,null,be),this.createController(i.audioStreamController,ee,be),this.subtitleTrackController=this.createController(i.subtitleTrackController,null,be),this.createController(i.subtitleStreamController,ee,be),this.createController(i.timelineController,null,he),this.emeController=this.createController(i.emeController,null,he),this.cmcdController=this.createController(i.cmcdController,null,he),this.latencyController=this.createController(R.default,null,he),this.coreComponents=he}var f=o.prototype;return f.createController=function(i,r,t){if(i){var n=r?new i(this,r):new i(this);return t&&t.push(n),n}return null},f.on=function(i,r,t){t===void 0&&(t=this),this._emitter.on(i,r,t)},f.once=function(i,r,t){t===void 0&&(t=this),this._emitter.once(i,r,t)},f.removeAllListeners=function(i){this._emitter.removeAllListeners(i)},f.off=function(i,r,t,n){t===void 0&&(t=this),this._emitter.off(i,r,t,n)},f.listeners=function(i){return this._emitter.listeners(i)},f.emit=function(i,r,t){return this._emitter.emit(i,r,t)},f.trigger=function(i,r){if(this.config.debug)return this.emit(i,i,r);try{return this.emit(i,i,r)}catch(t){E.logger.error("An internal error happened while handling event "+i+'. Error message: "'+t.message+'". Here is a stacktrace:',t),this.trigger(e.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:i,error:t})}return!1},f.listenerCount=function(i){return this._emitter.listenerCount(i)},f.destroy=function(){E.logger.log("destroy"),this.trigger(e.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(i){return i.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(i){return i.destroy()}),this.coreComponents.length=0},f.attachMedia=function(i){E.logger.log("attachMedia"),this._media=i,this.trigger(e.Events.MEDIA_ATTACHING,{media:i})},f.detachMedia=function(){E.logger.log("detachMedia"),this.trigger(e.Events.MEDIA_DETACHING,void 0),this._media=null},f.loadSource=function(i){this.stopLoad();var r=this.media,t=this.url,n=this.url=j.buildAbsoluteURL(self.location.href,i,{alwaysNormalize:!0});E.logger.log("loadSource:"+n),r&&t&&t!==n&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(r)),this.trigger(e.Events.MANIFEST_LOADING,{url:i})},f.startLoad=function(i){i===void 0&&(i=-1),E.logger.log("startLoad("+i+")"),this.networkControllers.forEach(function(r){r.startLoad(i)})},f.stopLoad=function(){E.logger.log("stopLoad"),this.networkControllers.forEach(function(i){i.stopLoad()})},f.swapAudioCodec=function(){E.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},f.recoverMediaError=function(){E.logger.log("recoverMediaError");var i=this._media;this.detachMedia(),i&&this.attachMedia(i)},f.removeLevel=function(i,r){r===void 0&&(r=0),this.levelController.removeLevel(i,r)},c(o,[{key:"levels",get:function(){var i=this.levelController.levels;return i||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(i){E.logger.log("set currentLevel:"+i),this.loadLevel=i,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(i){E.logger.log("set nextLevel:"+i),this.levelController.manualLevel=i,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(i){E.logger.log("set loadLevel:"+i),this.levelController.manualLevel=i}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(i){this.levelController.nextLoadLevel=i}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(i){E.logger.log("set firstLevel:"+i),this.levelController.firstLevel=i}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(i){E.logger.log("set startLevel:"+i),i!==-1&&(i=Math.max(i,this.minAutoLevel)),this.levelController.startLevel=i}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(i){var r=!!i;r!==this.config.capLevelToPlayerSize&&(r?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=r)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(i){this._autoLevelCapping!==i&&(E.logger.log("set autoLevelCapping:"+i),this._autoLevelCapping=i)}},{key:"bandwidthEstimate",get:function(){var i=this.abrController.bwEstimator;return i?i.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var i=this.levels,r=this.config.minAutoBitrate;if(!i)return 0;for(var t=i.length,n=0;n<t;n++)if(i[n].maxBitrate>r)return n;return 0}},{key:"maxAutoLevel",get:function(){var i=this.levels,r=this.autoLevelCapping,t;return r===-1&&i&&i.length?t=i.length-1:t=r,t}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(i){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,i)}},{key:"audioTracks",get:function(){var i=this.audioTrackController;return i?i.audioTracks:[]}},{key:"audioTrack",get:function(){var i=this.audioTrackController;return i?i.audioTrack:-1},set:function(i){var r=this.audioTrackController;r&&(r.audioTrack=i)}},{key:"subtitleTracks",get:function(){var i=this.subtitleTrackController;return i?i.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var i=this.subtitleTrackController;return i?i.subtitleTrack:-1},set:function(i){var r=this.subtitleTrackController;r&&(r.subtitleTrack=i)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var i=this.subtitleTrackController;return i?i.subtitleDisplay:!1},set:function(i){var r=this.subtitleTrackController;r&&(r.subtitleDisplay=i)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(i){this.config.lowLatencyMode=i}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return e.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return o.defaultConfig?o.defaultConfig:b.hlsDefaultConfig},set:function(i){o.defaultConfig=i}}]),o}();d.defaultConfig=void 0},"./src/is-supported.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"isSupported",function(){return x}),C.d(U,"changeTypeSupported",function(){return K});var j=C("./src/utils/mediasource-helper.ts");function O(){return self.SourceBuffer||self.WebKitSourceBuffer}function x(){var M=Object(j.getMediaSource)();if(!M)return!1;var R=O(),L=M&&typeof M.isTypeSupported=="function"&&M.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),y=!R||R.prototype&&typeof R.prototype.appendBuffer=="function"&&typeof R.prototype.remove=="function";return!!L&&!!y}function K(){var M,R=O();return typeof(R==null||((M=R.prototype)===null||M===void 0)?void 0:M.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"default",function(){return E}),C.d(U,"LoadError",function(){return v});var j=C("./src/polyfills/number.ts"),O=C("./src/errors.ts");function x(l,e){l.prototype=Object.create(e.prototype),l.prototype.constructor=l,y(l,e)}function K(l){var e=typeof Map=="function"?new Map:void 0;return K=function(a){if(a===null||!L(a))return a;if(typeof a!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e!="undefined"){if(e.has(a))return e.get(a);e.set(a,c)}function c(){return M(a,arguments,T(this).constructor)}return c.prototype=Object.create(a.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),y(c,a)},K(l)}function M(l,e,s){return R()?M=Reflect.construct:M=function(c,d,o){var f=[null];f.push.apply(f,d);var u=Function.bind.apply(c,f),i=new u;return o&&y(i,o.prototype),i},M.apply(null,arguments)}function R(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(l){return!1}}function L(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function y(l,e){return y=Object.setPrototypeOf||function(a,c){return a.__proto__=c,a},y(l,e)}function T(l){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},T(l)}var w=Math.pow(2,17),E=function(){function l(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var e=l.prototype;return e.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},e.abort=function(){this.loader&&this.loader.abort()},e.load=function(a,c){var d=this,o=a.url;if(!o)return Promise.reject(new v({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:a,networkDetails:null},"Fragment does not have a "+(o?"part list":"url")));this.abort();var f=this.config,u=f.fLoader,i=f.loader;return new Promise(function(r,t){d.loader&&d.loader.destroy();var n=d.loader=a.loader=u?new u(f):new i(f),g=b(a),p={timeout:f.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:f.fragLoadingMaxRetryTimeout,highWaterMark:w};a.stats=n.stats,n.load(g,p,{onSuccess:function(k,I,G,V){d.resetLoader(a,n),r({frag:a,part:null,payload:k.data,networkDetails:V})},onError:function(k,I,G){d.resetLoader(a,n),t(new v({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:a,response:k,networkDetails:G}))},onAbort:function(k,I,G){d.resetLoader(a,n),t(new v({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:a,networkDetails:G}))},onTimeout:function(k,I,G){d.resetLoader(a,n),t(new v({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:a,networkDetails:G}))},onProgress:function(k,I,G,V){c&&c({frag:a,part:null,payload:G,networkDetails:V})}})})},e.loadPart=function(a,c,d){var o=this;this.abort();var f=this.config,u=f.fLoader,i=f.loader;return new Promise(function(r,t){o.loader&&o.loader.destroy();var n=o.loader=a.loader=u?new u(f):new i(f),g=b(a,c),p={timeout:f.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:f.fragLoadingMaxRetryTimeout,highWaterMark:w};c.stats=n.stats,n.load(g,p,{onSuccess:function(k,I,G,V){o.resetLoader(a,n),o.updateStatsFromPart(a,c);var J={frag:a,part:c,payload:k.data,networkDetails:V};d(J),r(J)},onError:function(k,I,G){o.resetLoader(a,n),t(new v({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:a,part:c,response:k,networkDetails:G}))},onAbort:function(k,I,G){a.stats.aborted=c.stats.aborted,o.resetLoader(a,n),t(new v({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:a,part:c,networkDetails:G}))},onTimeout:function(k,I,G){o.resetLoader(a,n),t(new v({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:a,part:c,networkDetails:G}))}})})},e.updateStatsFromPart=function(a,c){var d=a.stats,o=c.stats,f=o.total;if(d.loaded+=o.loaded,f){var u=Math.round(a.duration/c.duration),i=Math.min(Math.round(d.loaded/f),u),r=u-i,t=r*Math.round(d.loaded/i);d.total=d.loaded+t}else d.total=Math.max(d.loaded,d.total);var n=d.loading,g=o.loading;n.start?n.first+=g.first-g.start:(n.start=g.start,n.first=g.first),n.end=g.end},e.resetLoader=function(a,c){a.loader=null,this.loader===c&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),c.destroy()},l}();function b(l,e){e===void 0&&(e=null);var s=e||l,a={frag:l,part:e,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},c=s.byteRangeStartOffset,d=s.byteRangeEndOffset;return Object(j.isFiniteNumber)(c)&&Object(j.isFiniteNumber)(d)&&(a.rangeStart=c,a.rangeEnd=d),a}var v=function(l){x(e,l);function e(s){for(var a,c=arguments.length,d=new Array(c>1?c-1:0),o=1;o<c;o++)d[o-1]=arguments[o];return a=l.call.apply(l,[this].concat(d))||this,a.data=void 0,a.data=s,a}return e}(K(Error))},"./src/loader/fragment.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"ElementaryStreamTypes",function(){return E}),C.d(U,"BaseSegment",function(){return b}),C.d(U,"Fragment",function(){return v}),C.d(U,"Part",function(){return l});var j=C("./src/polyfills/number.ts"),O=C("./node_modules/url-toolkit/src/url-toolkit.js"),x=C.n(O),K=C("./src/utils/logger.ts"),M=C("./src/loader/level-key.ts"),R=C("./src/loader/load-stats.ts");function L(e,s){e.prototype=Object.create(s.prototype),e.prototype.constructor=e,y(e,s)}function y(e,s){return y=Object.setPrototypeOf||function(c,d){return c.__proto__=d,c},y(e,s)}function T(e,s){for(var a=0;a<s.length;a++){var c=s[a];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(e,c.key,c)}}function w(e,s,a){return s&&T(e.prototype,s),a&&T(e,a),e}var E;(function(e){e.AUDIO="audio",e.VIDEO="video",e.AUDIOVIDEO="audiovideo"})(E||(E={}));var b=function(){function e(a){var c;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(c={},c[E.AUDIO]=null,c[E.VIDEO]=null,c[E.AUDIOVIDEO]=null,c),this.baseurl=a}var s=e.prototype;return s.setByteRange=function(c,d){var o=c.split("@",2),f=[];o.length===1?f[0]=d?d.byteRangeEndOffset:0:f[0]=parseInt(o[1]),f[1]=parseInt(o[0])+f[0],this._byteRange=f},w(e,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(O.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(c){this._url=c}}]),e}(),v=function(e){L(s,e);function s(c,d){var o;return o=e.call(this,d)||this,o._decryptdata=null,o.rawProgramDateTime=null,o.programDateTime=null,o.tagList=[],o.duration=0,o.sn=0,o.levelkey=void 0,o.type=void 0,o.loader=null,o.level=-1,o.cc=0,o.startPTS=void 0,o.endPTS=void 0,o.appendedPTS=void 0,o.startDTS=void 0,o.endDTS=void 0,o.start=0,o.deltaPTS=void 0,o.maxStartPTS=void 0,o.minEndPTS=void 0,o.stats=new R.LoadStats,o.urlId=0,o.data=void 0,o.bitrateTest=!1,o.title=null,o.initSegment=null,o.type=c,o}var a=s.prototype;return a.createInitializationVector=function(d){for(var o=new Uint8Array(16),f=12;f<16;f++)o[f]=d>>8*(15-f)&255;return o},a.setDecryptDataFromLevelKey=function(d,o){var f=d;return(d==null?void 0:d.method)==="AES-128"&&d.uri&&!d.iv&&(f=M.LevelKey.fromURI(d.uri),f.method=d.method,f.iv=this.createInitializationVector(o),f.keyFormat="identity"),f},a.setElementaryStreamInfo=function(d,o,f,u,i,r){r===void 0&&(r=!1);var t=this.elementaryStreams,n=t[d];if(!n){t[d]={startPTS:o,endPTS:f,startDTS:u,endDTS:i,partial:r};return}n.startPTS=Math.min(n.startPTS,o),n.endPTS=Math.max(n.endPTS,f),n.startDTS=Math.min(n.startDTS,u),n.endDTS=Math.max(n.endDTS,i)},a.clearElementaryStreamInfo=function(){var d=this.elementaryStreams;d[E.AUDIO]=null,d[E.VIDEO]=null,d[E.AUDIOVIDEO]=null},w(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var d=this.sn;typeof d!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&K.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),d=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,d)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(j.isFiniteNumber)(this.programDateTime))return null;var d=Object(j.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+d*1e3}},{key:"encrypted",get:function(){var d;return!!((d=this.decryptdata)!==null&&d!==void 0&&d.keyFormat&&this.decryptdata.uri)}}]),s}(b),l=function(e){L(s,e);function s(a,c,d,o,f){var u;u=e.call(this,d)||this,u.fragOffset=0,u.duration=0,u.gap=!1,u.independent=!1,u.relurl=void 0,u.fragment=void 0,u.index=void 0,u.stats=new R.LoadStats,u.duration=a.decimalFloatingPoint("DURATION"),u.gap=a.bool("GAP"),u.independent=a.bool("INDEPENDENT"),u.relurl=a.enumeratedString("URI"),u.fragment=c,u.index=o;var i=a.enumeratedString("BYTERANGE");return i&&u.setByteRange(i,f),f&&(u.fragOffset=f.fragOffset+f.duration),u}return w(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var c=this.elementaryStreams;return!!(c.audio||c.video||c.audiovideo)}}]),s}(b)},"./src/loader/key-loader.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"default",function(){return K});var j=C("./src/events.ts"),O=C("./src/errors.ts"),x=C("./src/utils/logger.ts"),K=function(){function M(L){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=L,this._registerListeners()}var R=M.prototype;return R._registerListeners=function(){this.hls.on(j.Events.KEY_LOADING,this.onKeyLoading,this)},R._unregisterListeners=function(){this.hls.off(j.Events.KEY_LOADING,this.onKeyLoading)},R.destroy=function(){this._unregisterListeners();for(var y in this.loaders){var T=this.loaders[y];T&&T.destroy()}this.loaders={}},R.onKeyLoading=function(y,T){var w=T.frag,E=w.type,b=this.loaders[E];if(!w.decryptdata){x.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var v=w.decryptdata.uri;if(v!==this.decrypturl||this.decryptkey===null){var l=this.hls.config;if(b&&(x.logger.warn("abort previous key loader for type:"+E),b.abort()),!v){x.logger.warn("key uri is falsy");return}var e=l.loader,s=w.loader=this.loaders[E]=new e(l);this.decrypturl=v,this.decryptkey=null;var a={url:v,frag:w,responseType:"arraybuffer"},c={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(a,c,d)}else this.decryptkey&&(w.decryptdata.key=this.decryptkey,this.hls.trigger(j.Events.KEY_LOADED,{frag:w}))},R.loadsuccess=function(y,T,w){var E=w.frag;if(!E.decryptdata){x.logger.error("after key load, decryptdata unset");return}this.decryptkey=E.decryptdata.key=new Uint8Array(y.data),E.loader=null,delete this.loaders[E.type],this.hls.trigger(j.Events.KEY_LOADED,{frag:E})},R.loaderror=function(y,T){var w=T.frag,E=w.loader;E&&E.abort(),delete this.loaders[w.type],this.hls.trigger(j.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:w,response:y})},R.loadtimeout=function(y,T){var w=T.frag,E=w.loader;E&&E.abort(),delete this.loaders[w.type],this.hls.trigger(j.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:w})},M}()},"./src/loader/level-details.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"LevelDetails",function(){return M});var j=C("./src/polyfills/number.ts");function O(R,L){for(var y=0;y<L.length;y++){var T=L[y];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(R,T.key,T)}}function x(R,L,y){return L&&O(R.prototype,L),y&&O(R,y),R}var K=10,M=function(){function R(y){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=y}var L=R.prototype;return L.reloaded=function(T){if(!T){this.advanced=!0,this.updated=!0;return}var w=this.lastPartSn-T.lastPartSn,E=this.lastPartIndex-T.lastPartIndex;this.updated=this.endSN!==T.endSN||!!E||!!w,this.advanced=this.endSN>T.endSN||w>0||w===0&&E>0,this.updated||this.advanced?this.misses=Math.floor(T.misses*.6):this.misses=T.misses+1,this.availabilityDelay=T.availabilityDelay},x(R,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(j.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||K}},{key:"drift",get:function(){var T=this.driftEndTime-this.driftStartTime;if(T>0){var w=this.driftEnd-this.driftStart;return w*1e3/T}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var T;return(T=this.fragments)!==null&&T!==void 0&&T.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),R}()},"./src/loader/level-key.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"LevelKey",function(){return M});var j=C("./node_modules/url-toolkit/src/url-toolkit.js"),O=C.n(j);function x(R,L){for(var y=0;y<L.length;y++){var T=L[y];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(R,T.key,T)}}function K(R,L,y){return L&&x(R.prototype,L),y&&x(R,y),R}var M=function(){R.fromURL=function(y,T){return new R(y,T)},R.fromURI=function(y){return new R(y)};function R(L,y){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,y?this._uri=Object(j.buildAbsoluteURL)(L,y,{alwaysNormalize:!0}):this._uri=L}return K(R,[{key:"uri",get:function(){return this._uri}}]),R}()},"./src/loader/load-stats.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"LoadStats",function(){return j});var j=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"default",function(){return s});var j=C("./src/polyfills/number.ts"),O=C("./node_modules/url-toolkit/src/url-toolkit.js"),x=C.n(O),K=C("./src/loader/fragment.ts"),M=C("./src/loader/level-details.ts"),R=C("./src/loader/level-key.ts"),L=C("./src/utils/attr-list.ts"),y=C("./src/utils/logger.ts"),T=C("./src/utils/codecs.ts"),w=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,E=/#EXT-X-MEDIA:(.*)/g,b=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),v=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),l=/\.(mp4|m4s|m4v|m4a)$/i;function e(f){var u,i;return l.test((u=(i=O.parseURL(f))===null||i===void 0?void 0:i.path)!=null?u:"")}var s=function(){function f(){}return f.findGroup=function(i,r){for(var t=0;t<i.length;t++){var n=i[t];if(n.id===r)return n}},f.convertAVC1ToAVCOTI=function(i){var r=i.split(".");if(r.length>2){var t=r.shift()+".";return t+=parseInt(r.shift()).toString(16),t+=("000"+parseInt(r.shift()).toString(16)).substr(-4),t}return i},f.resolve=function(i,r){return O.buildAbsoluteURL(r,i,{alwaysNormalize:!0})},f.parseMasterPlaylist=function(i,r){var t=[],n={},g=!1;w.lastIndex=0;for(var p;(p=w.exec(i))!=null;)if(p[1]){var S=new L.AttrList(p[1]),k={attrs:S,bitrate:S.decimalInteger("AVERAGE-BANDWIDTH")||S.decimalInteger("BANDWIDTH"),name:S.NAME,url:f.resolve(p[2],r)},I=S.decimalResolution("RESOLUTION");I&&(k.width=I.width,k.height=I.height),a((S.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),k),k.videoCodec&&k.videoCodec.indexOf("avc1")!==-1&&(k.videoCodec=f.convertAVC1ToAVCOTI(k.videoCodec)),t.push(k)}else if(p[3]){var G=new L.AttrList(p[3]);G["DATA-ID"]&&(g=!0,n[G["DATA-ID"]]=G)}return{levels:t,sessionData:g?n:null}},f.parseMasterPlaylistMedia=function(i,r,t,n){n===void 0&&(n=[]);var g,p=[],S=0;for(E.lastIndex=0;(g=E.exec(i))!==null;){var k=new L.AttrList(g[1]);if(k.TYPE===t){var I={attrs:k,bitrate:0,id:S++,groupId:k["GROUP-ID"],instreamId:k["INSTREAM-ID"],name:k.NAME||k.LANGUAGE||"",type:t,default:k.bool("DEFAULT"),autoselect:k.bool("AUTOSELECT"),forced:k.bool("FORCED"),lang:k.LANGUAGE,url:k.URI?f.resolve(k.URI,r):""};if(n.length){var G=f.findGroup(n,I.groupId)||n[0];c(I,G,"audioCodec"),c(I,G,"textCodec")}p.push(I)}}return p},f.parseLevelPlaylist=function(i,r,t,n,g){var p=new M.LevelDetails(r),S=p.fragments,k=null,I=0,G=0,V=0,J=0,re=null,ee=new K.Fragment(n,r),ae,be,he,me=-1,ce=!1;for(b.lastIndex=0,p.m3u8=i;(ae=b.exec(i))!==null;){ce&&(ce=!1,ee=new K.Fragment(n,r),ee.start=V,ee.sn=I,ee.cc=J,ee.level=t,k&&(ee.initSegment=k,ee.rawProgramDateTime=k.rawProgramDateTime));var te=ae[1];if(te){ee.duration=parseFloat(te);var q=(" "+ae[2]).slice(1);ee.title=q||null,ee.tagList.push(q?["INF",te,q]:["INF",te])}else if(ae[3])Object(j.isFiniteNumber)(ee.duration)&&(ee.start=V,he&&(ee.levelkey=he),ee.sn=I,ee.level=t,ee.cc=J,ee.urlId=g,S.push(ee),ee.relurl=(" "+ae[3]).slice(1),o(ee,re),re=ee,V+=ee.duration,I++,G=0,ce=!0);else if(ae[4]){var oe=(" "+ae[4]).slice(1);re?ee.setByteRange(oe,re):ee.setByteRange(oe)}else if(ae[5])ee.rawProgramDateTime=(" "+ae[5]).slice(1),ee.tagList.push(["PROGRAM-DATE-TIME",ee.rawProgramDateTime]),me===-1&&(me=S.length);else{if(ae=ae[0].match(v),!ae){y.logger.warn("No matches on slow regex match for level playlist!");continue}for(be=1;be<ae.length&&!(typeof ae[be]!="undefined");be++);var Z=(" "+ae[be]).slice(1),D=(" "+ae[be+1]).slice(1),h=ae[be+2]?(" "+ae[be+2]).slice(1):"";switch(Z){case"PLAYLIST-TYPE":p.type=D.toUpperCase();break;case"MEDIA-SEQUENCE":I=p.startSN=parseInt(D);break;case"SKIP":{var m=new L.AttrList(D),P=m.decimalInteger("SKIPPED-SEGMENTS");if(Object(j.isFiniteNumber)(P)){p.skippedSegments=P;for(var _=P;_--;)S.unshift(null);I+=P}var A=m.enumeratedString("RECENTLY-REMOVED-DATERANGES");A&&(p.recentlyRemovedDateranges=A.split(" "));break}case"TARGETDURATION":p.targetduration=parseFloat(D);break;case"VERSION":p.version=parseInt(D);break;case"EXTM3U":break;case"ENDLIST":p.live=!1;break;case"#":(D||h)&&ee.tagList.push(h?[D,h]:[D]);break;case"DIS":J++;case"GAP":ee.tagList.push([Z]);break;case"BITRATE":ee.tagList.push([Z,D]);break;case"DISCONTINUITY-SEQ":J=parseInt(D);break;case"KEY":{var Y,ne=new L.AttrList(D),ue=ne.enumeratedString("METHOD"),fe=ne.URI,Ee=ne.hexadecimalInteger("IV"),we=ne.enumeratedString("KEYFORMATVERSIONS"),Ae=ne.enumeratedString("KEYID"),De=(Y=ne.enumeratedString("KEYFORMAT"))!=null?Y:"identity",se=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(se.indexOf(De)>-1){y.logger.warn("Keyformat "+De+" is not supported from the manifest");continue}else if(De!=="identity")continue;ue&&(he=R.LevelKey.fromURL(r,fe),fe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(ue)>=0&&(he.method=ue,he.keyFormat=De,Ae&&(he.keyID=Ae),we&&(he.keyFormatVersions=we),he.iv=Ee));break}case"START":{var pe=new L.AttrList(D),ge=pe.decimalFloatingPoint("TIME-OFFSET");Object(j.isFiniteNumber)(ge)&&(p.startTimeOffset=ge);break}case"MAP":{var xe=new L.AttrList(D);ee.relurl=xe.URI,xe.BYTERANGE&&ee.setByteRange(xe.BYTERANGE),ee.level=t,ee.sn="initSegment",he&&(ee.levelkey=he),ee.initSegment=null,k=ee,ce=!0;break}case"SERVER-CONTROL":{var Te=new L.AttrList(D);p.canBlockReload=Te.bool("CAN-BLOCK-RELOAD"),p.canSkipUntil=Te.optionalFloat("CAN-SKIP-UNTIL",0),p.canSkipDateRanges=p.canSkipUntil>0&&Te.bool("CAN-SKIP-DATERANGES"),p.partHoldBack=Te.optionalFloat("PART-HOLD-BACK",0),p.holdBack=Te.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Se=new L.AttrList(D);p.partTarget=Se.decimalFloatingPoint("PART-TARGET");break}case"PART":{var ye=p.partList;ye||(ye=p.partList=[]);var Le=G>0?ye[ye.length-1]:void 0,Re=G++,z=new K.Part(new L.AttrList(D),ee,r,Re,Le);ye.push(z),ee.duration+=z.duration;break}case"PRELOAD-HINT":{var N=new L.AttrList(D);p.preloadHint=N;break}case"RENDITION-REPORT":{var B=new L.AttrList(D);p.renditionReports=p.renditionReports||[],p.renditionReports.push(B);break}default:y.logger.warn("line parsed but not handled: "+ae);break}}}re&&!re.relurl?(S.pop(),V-=re.duration,p.partList&&(p.fragmentHint=re)):p.partList&&(o(ee,re),ee.cc=J,p.fragmentHint=ee);var H=S.length,X=S[0],F=S[H-1];if(V+=p.skippedSegments*p.targetduration,V>0&&H&&F){p.averagetargetduration=V/H;var W=F.sn;p.endSN=W!=="initSegment"?W:0,X&&(p.startCC=X.cc,X.initSegment||p.fragments.every(function($){return $.relurl&&e($.relurl)})&&(y.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),ee=new K.Fragment(n,r),ee.relurl=F.relurl,ee.level=t,ee.sn="initSegment",X.initSegment=ee,p.needSidxRanges=!0))}else p.endSN=0,p.startCC=0;return p.fragmentHint&&(V+=p.fragmentHint.duration),p.totalduration=V,p.endCC=J,me>0&&d(S,me),p},f}();function a(f,u){["video","audio","text"].forEach(function(i){var r=f.filter(function(n){return Object(T.isCodecType)(n,i)});if(r.length){var t=r.filter(function(n){return n.lastIndexOf("avc1",0)===0||n.lastIndexOf("mp4a",0)===0});u[i+"Codec"]=t.length>0?t[0]:r[0],f=f.filter(function(n){return r.indexOf(n)===-1})}}),u.unknownCodecs=f}function c(f,u,i){var r=u[i];r&&(f[i]=r)}function d(f,u){for(var i=f[u],r=u;r--;){var t=f[r];if(!t)return;t.programDateTime=i.programDateTime-t.duration*1e3,i=t}}function o(f,u){f.rawProgramDateTime?f.programDateTime=Date.parse(f.rawProgramDateTime):u!=null&&u.programDateTime&&(f.programDateTime=u.endProgramDateTime),Object(j.isFiniteNumber)(f.programDateTime)||(f.programDateTime=null,f.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ve,U,C){"use strict";C.r(U);var j=C("./src/polyfills/number.ts"),O=C("./src/events.ts"),x=C("./src/errors.ts"),K=C("./src/utils/logger.ts"),M=C("./src/utils/mp4-tools.ts"),R=C("./src/loader/m3u8-parser.ts"),L=C("./src/types/loader.ts"),y=C("./src/utils/attr-list.ts");function T(b){var v=b.type;switch(v){case L.PlaylistContextType.AUDIO_TRACK:return L.PlaylistLevelType.AUDIO;case L.PlaylistContextType.SUBTITLE_TRACK:return L.PlaylistLevelType.SUBTITLE;default:return L.PlaylistLevelType.MAIN}}function w(b,v){var l=b.url;return(l===void 0||l.indexOf("data:")===0)&&(l=v.url),l}var E=function(){function b(l){this.hls=void 0,this.loaders=Object.create(null),this.hls=l,this.registerListeners()}var v=b.prototype;return v.registerListeners=function(){var e=this.hls;e.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(O.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(O.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(O.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},v.unregisterListeners=function(){var e=this.hls;e.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(O.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(O.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(O.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},v.createInternalLoader=function(e){var s=this.hls.config,a=s.pLoader,c=s.loader,d=a||c,o=new d(s);return e.loader=o,this.loaders[e.type]=o,o},v.getInternalLoader=function(e){return this.loaders[e.type]},v.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},v.destroyInternalLoaders=function(){for(var e in this.loaders){var s=this.loaders[e];s&&s.destroy(),this.resetInternalLoader(e)}},v.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},v.onManifestLoading=function(e,s){var a=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:L.PlaylistContextType.MANIFEST,url:a,deliveryDirectives:null})},v.onLevelLoading=function(e,s){var a=s.id,c=s.level,d=s.url,o=s.deliveryDirectives;this.load({id:a,groupId:null,level:c,responseType:"text",type:L.PlaylistContextType.LEVEL,url:d,deliveryDirectives:o})},v.onAudioTrackLoading=function(e,s){var a=s.id,c=s.groupId,d=s.url,o=s.deliveryDirectives;this.load({id:a,groupId:c,level:null,responseType:"text",type:L.PlaylistContextType.AUDIO_TRACK,url:d,deliveryDirectives:o})},v.onSubtitleTrackLoading=function(e,s){var a=s.id,c=s.groupId,d=s.url,o=s.deliveryDirectives;this.load({id:a,groupId:c,level:null,responseType:"text",type:L.PlaylistContextType.SUBTITLE_TRACK,url:d,deliveryDirectives:o})},v.load=function(e){var s,a=this.hls.config,c=this.getInternalLoader(e);if(c){var d=c.context;if(d&&d.url===e.url){K.logger.trace("[playlist-loader]: playlist request ongoing");return}K.logger.log("[playlist-loader]: aborting previous loader for type: "+e.type),c.abort()}var o,f,u,i;switch(e.type){case L.PlaylistContextType.MANIFEST:o=a.manifestLoadingMaxRetry,f=a.manifestLoadingTimeOut,u=a.manifestLoadingRetryDelay,i=a.manifestLoadingMaxRetryTimeout;break;case L.PlaylistContextType.LEVEL:case L.PlaylistContextType.AUDIO_TRACK:case L.PlaylistContextType.SUBTITLE_TRACK:o=0,f=a.levelLoadingTimeOut;break;default:o=a.levelLoadingMaxRetry,f=a.levelLoadingTimeOut,u=a.levelLoadingRetryDelay,i=a.levelLoadingMaxRetryTimeout;break}if(c=this.createInternalLoader(e),(s=e.deliveryDirectives)!==null&&s!==void 0&&s.part){var r;if(e.type===L.PlaylistContextType.LEVEL&&e.level!==null?r=this.hls.levels[e.level].details:e.type===L.PlaylistContextType.AUDIO_TRACK&&e.id!==null?r=this.hls.audioTracks[e.id].details:e.type===L.PlaylistContextType.SUBTITLE_TRACK&&e.id!==null&&(r=this.hls.subtitleTracks[e.id].details),r){var t=r.partTarget,n=r.targetduration;t&&n&&(f=Math.min(Math.max(t*3,n*.8)*1e3,f))}}var g={timeout:f,maxRetry:o,retryDelay:u,maxRetryDelay:i,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};c.load(e,g,p)},v.loadsuccess=function(e,s,a,c){if(c===void 0&&(c=null),a.isSidxRequest){this.handleSidxRequest(e,a),this.handlePlaylistLoaded(e,s,a,c);return}this.resetInternalLoader(a.type);var d=e.data;if(d.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(e,a,"no EXTM3U delimiter",c);return}s.parsing.start=performance.now(),d.indexOf("#EXTINF:")>0||d.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(e,s,a,c):this.handleMasterPlaylist(e,s,a,c)},v.loaderror=function(e,s,a){a===void 0&&(a=null),this.handleNetworkError(s,a,!1,e)},v.loadtimeout=function(e,s,a){a===void 0&&(a=null),this.handleNetworkError(s,a,!0)},v.handleMasterPlaylist=function(e,s,a,c){var d=this.hls,o=e.data,f=w(e,a),u=R.default.parseMasterPlaylist(o,f),i=u.levels,r=u.sessionData;if(!i.length){this.handleManifestParsingError(e,a,"no level found in manifest",c);return}var t=i.map(function(I){return{id:I.attrs.AUDIO,audioCodec:I.audioCodec}}),n=i.map(function(I){return{id:I.attrs.SUBTITLES,textCodec:I.textCodec}}),g=R.default.parseMasterPlaylistMedia(o,f,"AUDIO",t),p=R.default.parseMasterPlaylistMedia(o,f,"SUBTITLES",n),S=R.default.parseMasterPlaylistMedia(o,f,"CLOSED-CAPTIONS");if(g.length){var k=g.some(function(I){return!I.url});!k&&i[0].audioCodec&&!i[0].attrs.AUDIO&&(K.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new y.AttrList({}),bitrate:0,url:""}))}d.trigger(O.Events.MANIFEST_LOADED,{levels:i,audioTracks:g,subtitles:p,captions:S,url:f,stats:s,networkDetails:c,sessionData:r})},v.handleTrackOrLevelPlaylist=function(e,s,a,c){var d=this.hls,o=a.id,f=a.level,u=a.type,i=w(e,a),r=Object(j.isFiniteNumber)(o)?o:0,t=Object(j.isFiniteNumber)(f)?f:r,n=T(a),g=R.default.parseLevelPlaylist(e.data,i,t,n,r);if(!g.fragments.length){d.trigger(O.Events.ERROR,{type:x.ErrorTypes.NETWORK_ERROR,details:x.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:i,reason:"no fragments found in level",level:typeof a.level=="number"?a.level:void 0});return}if(u===L.PlaylistContextType.MANIFEST){var p={attrs:new y.AttrList({}),bitrate:0,details:g,name:"",url:i};d.trigger(O.Events.MANIFEST_LOADED,{levels:[p],audioTracks:[],url:i,stats:s,networkDetails:c,sessionData:null})}if(s.parsing.end=performance.now(),g.needSidxRanges){var S,k=(S=g.fragments[0].initSegment)===null||S===void 0?void 0:S.url;this.load({url:k,isSidxRequest:!0,type:u,level:f,levelDetails:g,id:o,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}a.levelDetails=g,this.handlePlaylistLoaded(e,s,a,c)},v.handleSidxRequest=function(e,s){var a=Object(M.parseSegmentIndex)(new Uint8Array(e.data));if(!a)return;var c=a.references,d=s.levelDetails;c.forEach(function(o,f){var u=o.info,i=d.fragments[f];i.byteRange.length===0&&i.setByteRange(String(1+u.end-u.start)+"@"+String(u.start)),i.initSegment&&i.initSegment.setByteRange(String(a.moovEndOffset)+"@0")})},v.handleManifestParsingError=function(e,s,a,c){this.hls.trigger(O.Events.ERROR,{type:x.ErrorTypes.NETWORK_ERROR,details:x.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===L.PlaylistContextType.MANIFEST,url:e.url,reason:a,response:e,context:s,networkDetails:c})},v.handleNetworkError=function(e,s,a,c){a===void 0&&(a=!1),K.logger.warn("[playlist-loader]: A network "+(a?"timeout":"error")+" occurred while loading "+e.type+" level: "+e.level+" id: "+e.id+' group-id: "'+e.groupId+'"');var d=x.ErrorDetails.UNKNOWN,o=!1,f=this.getInternalLoader(e);switch(e.type){case L.PlaylistContextType.MANIFEST:d=a?x.ErrorDetails.MANIFEST_LOAD_TIMEOUT:x.ErrorDetails.MANIFEST_LOAD_ERROR,o=!0;break;case L.PlaylistContextType.LEVEL:d=a?x.ErrorDetails.LEVEL_LOAD_TIMEOUT:x.ErrorDetails.LEVEL_LOAD_ERROR,o=!1;break;case L.PlaylistContextType.AUDIO_TRACK:d=a?x.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:x.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,o=!1;break;case L.PlaylistContextType.SUBTITLE_TRACK:d=a?x.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:x.ErrorDetails.SUBTITLE_LOAD_ERROR,o=!1;break}f&&this.resetInternalLoader(e.type);var u={type:x.ErrorTypes.NETWORK_ERROR,details:d,fatal:o,url:e.url,loader:f,context:e,networkDetails:s};c&&(u.response=c),this.hls.trigger(O.Events.ERROR,u)},v.handlePlaylistLoaded=function(e,s,a,c){var d=a.type,o=a.level,f=a.id,u=a.groupId,i=a.loader,r=a.levelDetails,t=a.deliveryDirectives;if(!(r!=null&&r.targetduration)){this.handleManifestParsingError(e,a,"invalid target duration",c);return}if(!i)return;r.live&&(i.getCacheAge&&(r.ageHeader=i.getCacheAge()||0),(!i.getCacheAge||isNaN(r.ageHeader))&&(r.ageHeader=0));switch(d){case L.PlaylistContextType.MANIFEST:case L.PlaylistContextType.LEVEL:this.hls.trigger(O.Events.LEVEL_LOADED,{details:r,level:o||0,id:f||0,stats:s,networkDetails:c,deliveryDirectives:t});break;case L.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(O.Events.AUDIO_TRACK_LOADED,{details:r,id:f||0,groupId:u||"",stats:s,networkDetails:c,deliveryDirectives:t});break;case L.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(O.Events.SUBTITLE_TRACK_LOADED,{details:r,id:f||0,groupId:u||"",stats:s,networkDetails:c,deliveryDirectives:t});break}},b}();U.default=E},"./src/polyfills/number.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"isFiniteNumber",function(){return j}),C.d(U,"MAX_SAFE_INTEGER",function(){return O});var j=Number.isFinite||function(x){return typeof x=="number"&&isFinite(x)},O=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ve,U,C){"use strict";C.r(U);var j=function(){function O(){}return O.getSilentFrame=function(K,M){switch(K){case"mp4a.40.2":if(M===1)return new Uint8Array([0,200,0,128,35,128]);if(M===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(M===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(M===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(M===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(M===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(M===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(M===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(M===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},O}();U.default=j},"./src/remux/mp4-generator.ts":function(ve,U,C){"use strict";C.r(U);var j=Math.pow(2,32)-1,O=function(){function x(){}return x.init=function(){x.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var M;for(M in x.types)x.types.hasOwnProperty(M)&&(x.types[M]=[M.charCodeAt(0),M.charCodeAt(1),M.charCodeAt(2),M.charCodeAt(3)]);var R=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]),L=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]);x.HDLR_TYPES={video:R,audio:L};var y=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),T=new Uint8Array([0,0,0,0,0,0,0,0]);x.STTS=x.STSC=x.STCO=T,x.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),x.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),x.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),x.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var w=new Uint8Array([105,115,111,109]),E=new Uint8Array([97,118,99,49]),b=new Uint8Array([0,0,0,1]);x.FTYP=x.box(x.types.ftyp,w,b,w,E),x.DINF=x.box(x.types.dinf,x.box(x.types.dref,y))},x.box=function(M){for(var R=8,L=arguments.length,y=new Array(L>1?L-1:0),T=1;T<L;T++)y[T-1]=arguments[T];for(var w=y.length,E=w;w--;)R+=y[w].byteLength;var b=new Uint8Array(R);for(b[0]=R>>24&255,b[1]=R>>16&255,b[2]=R>>8&255,b[3]=R&255,b.set(M,4),w=0,R=8;w<E;w++)b.set(y[w],R),R+=y[w].byteLength;return b},x.hdlr=function(M){return x.box(x.types.hdlr,x.HDLR_TYPES[M])},x.mdat=function(M){return x.box(x.types.mdat,M)},x.mdhd=function(M,R){R*=M;var L=Math.floor(R/(j+1)),y=Math.floor(R%(j+1));return x.box(x.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,M&255,L>>24,L>>16&255,L>>8&255,L&255,y>>24,y>>16&255,y>>8&255,y&255,85,196,0,0]))},x.mdia=function(M){return x.box(x.types.mdia,x.mdhd(M.timescale,M.duration),x.hdlr(M.type),x.minf(M))},x.mfhd=function(M){return x.box(x.types.mfhd,new Uint8Array([0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255]))},x.minf=function(M){return M.type==="audio"?x.box(x.types.minf,x.box(x.types.smhd,x.SMHD),x.DINF,x.stbl(M)):x.box(x.types.minf,x.box(x.types.vmhd,x.VMHD),x.DINF,x.stbl(M))},x.moof=function(M,R,L){return x.box(x.types.moof,x.mfhd(M),x.traf(L,R))},x.moov=function(M){for(var R=M.length,L=[];R--;)L[R]=x.trak(M[R]);return x.box.apply(null,[x.types.moov,x.mvhd(M[0].timescale,M[0].duration)].concat(L).concat(x.mvex(M)))},x.mvex=function(M){for(var R=M.length,L=[];R--;)L[R]=x.trex(M[R]);return x.box.apply(null,[x.types.mvex].concat(L))},x.mvhd=function(M,R){R*=M;var L=Math.floor(R/(j+1)),y=Math.floor(R%(j+1)),T=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,M&255,L>>24,L>>16&255,L>>8&255,L&255,y>>24,y>>16&255,y>>8&255,y&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return x.box(x.types.mvhd,T)},x.sdtp=function(M){var R=M.samples||[],L=new Uint8Array(4+R.length),y,T;for(y=0;y<R.length;y++)T=R[y].flags,L[y+4]=T.dependsOn<<4|T.isDependedOn<<2|T.hasRedundancy;return x.box(x.types.sdtp,L)},x.stbl=function(M){return x.box(x.types.stbl,x.stsd(M),x.box(x.types.stts,x.STTS),x.box(x.types.stsc,x.STSC),x.box(x.types.stsz,x.STSZ),x.box(x.types.stco,x.STCO))},x.avc1=function(M){var R=[],L=[],y,T,w;for(y=0;y<M.sps.length;y++)T=M.sps[y],w=T.byteLength,R.push(w>>>8&255),R.push(w&255),R=R.concat(Array.prototype.slice.call(T));for(y=0;y<M.pps.length;y++)T=M.pps[y],w=T.byteLength,L.push(w>>>8&255),L.push(w&255),L=L.concat(Array.prototype.slice.call(T));var E=x.box(x.types.avcC,new Uint8Array([1,R[3],R[4],R[5],252|3,224|M.sps.length].concat(R).concat([M.pps.length]).concat(L))),b=M.width,v=M.height,l=M.pixelRatio[0],e=M.pixelRatio[1];return x.box(x.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b>>8&255,b&255,v>>8&255,v&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),E,x.box(x.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),x.box(x.types.pasp,new Uint8Array([l>>24,l>>16&255,l>>8&255,l&255,e>>24,e>>16&255,e>>8&255,e&255])))},x.esds=function(M){var R=M.config.length;return new Uint8Array([0,0,0,0,3,23+R,0,1,0,4,15+R,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([R]).concat(M.config).concat([6,1,2]))},x.mp4a=function(M){var R=M.samplerate;return x.box(x.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,M.channelCount,0,16,0,0,0,0,R>>8&255,R&255,0,0]),x.box(x.types.esds,x.esds(M)))},x.mp3=function(M){var R=M.samplerate;return x.box(x.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,M.channelCount,0,16,0,0,0,0,R>>8&255,R&255,0,0]))},x.stsd=function(M){return M.type==="audio"?!M.isAAC&&M.codec==="mp3"?x.box(x.types.stsd,x.STSD,x.mp3(M)):x.box(x.types.stsd,x.STSD,x.mp4a(M)):x.box(x.types.stsd,x.STSD,x.avc1(M))},x.tkhd=function(M){var R=M.id,L=M.duration*M.timescale,y=M.width,T=M.height,w=Math.floor(L/(j+1)),E=Math.floor(L%(j+1));return x.box(x.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,R>>24&255,R>>16&255,R>>8&255,R&255,0,0,0,0,w>>24,w>>16&255,w>>8&255,w&255,E>>24,E>>16&255,E>>8&255,E&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,y>>8&255,y&255,0,0,T>>8&255,T&255,0,0]))},x.traf=function(M,R){var L=x.sdtp(M),y=M.id,T=Math.floor(R/(j+1)),w=Math.floor(R%(j+1));return x.box(x.types.traf,x.box(x.types.tfhd,new Uint8Array([0,0,0,0,y>>24,y>>16&255,y>>8&255,y&255])),x.box(x.types.tfdt,new Uint8Array([1,0,0,0,T>>24,T>>16&255,T>>8&255,T&255,w>>24,w>>16&255,w>>8&255,w&255])),x.trun(M,L.length+16+20+8+16+8+8),L)},x.trak=function(M){return M.duration=M.duration||4294967295,x.box(x.types.trak,x.tkhd(M),x.mdia(M))},x.trex=function(M){var R=M.id;return x.box(x.types.trex,new Uint8Array([0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},x.trun=function(M,R){var L=M.samples||[],y=L.length,T=12+16*y,w=new Uint8Array(T),E,b,v,l,e,s;for(R+=8+T,w.set([0,0,15,1,y>>>24&255,y>>>16&255,y>>>8&255,y&255,R>>>24&255,R>>>16&255,R>>>8&255,R&255],0),E=0;E<y;E++)b=L[E],v=b.duration,l=b.size,e=b.flags,s=b.cts,w.set([v>>>24&255,v>>>16&255,v>>>8&255,v&255,l>>>24&255,l>>>16&255,l>>>8&255,l&255,e.isLeading<<2|e.dependsOn,e.isDependedOn<<6|e.hasRedundancy<<4|e.paddingValue<<1|e.isNonSync,e.degradPrio&240<<8,e.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*E);return x.box(x.types.trun,w)},x.initSegment=function(M){x.types||x.init();var R=x.moov(M),L=new Uint8Array(x.FTYP.byteLength+R.byteLength);return L.set(x.FTYP),L.set(R,x.FTYP.byteLength),L},x}();O.types=void 0,O.HDLR_TYPES=void 0,O.STTS=void 0,O.STSC=void 0,O.STCO=void 0,O.STSZ=void 0,O.VMHD=void 0,O.SMHD=void 0,O.STSD=void 0,O.FTYP=void 0,O.DINF=void 0,U.default=O},"./src/remux/mp4-remuxer.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"default",function(){return s}),C.d(U,"normalizePts",function(){return a});var j=C("./src/polyfills/number.ts"),O=C("./src/remux/aac-helper.ts"),x=C("./src/remux/mp4-generator.ts"),K=C("./src/events.ts"),M=C("./src/errors.ts"),R=C("./src/utils/logger.ts"),L=C("./src/types/loader.ts"),y=C("./src/utils/timescale-conversion.ts");function T(){return T=Object.assign||function(f){for(var u=1;u<arguments.length;u++){var i=arguments[u];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(f[r]=i[r])}return f},T.apply(this,arguments)}var w=10*1e3,E=1024,b=1152,v=null,l=null,e=!1,s=function(){function f(i,r,t,n){if(n===void 0&&(n=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=i,this.config=r,this.typeSupported=t,this.ISGenerated=!1,v===null){var g=navigator.userAgent||"",p=g.match(/Chrome\/(\d+)/i);v=p?parseInt(p[1]):0}if(l===null){var S=navigator.userAgent.match(/Safari\/(\d+)/i);l=S?parseInt(S[1]):0}e=!!v&&v<75||!!l&&l<600}var u=f.prototype;return u.destroy=function(){},u.resetTimeStamp=function(r){R.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=r},u.resetNextTimestamp=function(){R.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},u.resetInitSegment=function(){R.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},u.getVideoStartPts=function(r){var t=!1,n=r.reduce(function(g,p){var S=p.pts-g;return S<-4294967296?(t=!0,a(g,p.pts)):S>0?g:p.pts},r[0].pts);return t&&R.logger.debug("PTS rollover detected"),n},u.remux=function(r,t,n,g,p,S,k,I){var G,V,J,re,ee,ae,be=p,he=p,me=r.pid>-1,ce=t.pid>-1,te=t.samples.length,q=r.samples.length>0,oe=te>1,Z=(!me||q)&&(!ce||oe)||this.ISGenerated||k;if(Z){this.ISGenerated||(J=this.generateIS(r,t,p));var D=this.isVideoContiguous,h=-1;if(oe&&(h=c(t.samples),!D&&this.config.forceKeyFrameOnDiscontinuity))if(ae=!0,h>0){R.logger.warn("[mp4-remuxer]: Dropped "+h+" out of "+te+" video samples due to a missing keyframe");var m=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(h),t.dropped+=h,he+=(t.samples[0].pts-m)/(t.timescale||9e4)}else h===-1&&(R.logger.warn("[mp4-remuxer]: No keyframe found out of "+te+" video samples"),ae=!1);if(this.ISGenerated){if(q&&oe){var P=this.getVideoStartPts(t.samples),_=a(r.samples[0].pts,P)-P,A=_/t.inputTimeScale;be+=Math.max(0,A),he+=Math.max(0,-A)}if(q){if(r.samplerate||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),J=this.generateIS(r,t,p)),V=this.remuxAudio(r,be,this.isAudioContiguous,S,ce||oe||I===L.PlaylistLevelType.AUDIO?he:void 0),oe){var Y=V?V.endPTS-V.startPTS:0;t.inputTimeScale||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),J=this.generateIS(r,t,p)),G=this.remuxVideo(t,he,D,Y)}}else oe&&(G=this.remuxVideo(t,he,D,0));G&&(G.firstKeyFrame=h,G.independent=h!==-1)}}return this.ISGenerated&&(n.samples.length&&(ee=this.remuxID3(n,p)),g.samples.length&&(re=this.remuxText(g,p))),{audio:V,video:G,initSegment:J,independent:ae,text:re,id3:ee}},u.generateIS=function(r,t,n){var g=r.samples,p=t.samples,S=this.typeSupported,k={},I=!Object(j.isFiniteNumber)(this._initPTS),G="audio/mp4",V,J,re;if(I&&(V=J=Infinity),r.config&&g.length&&(r.timescale=r.samplerate,r.isAAC||(S.mpeg?(G="audio/mpeg",r.codec=""):S.mp3&&(r.codec="mp3")),k.audio={id:"audio",container:G,codec:r.codec,initSegment:!r.isAAC&&S.mpeg?new Uint8Array(0):x.default.initSegment([r]),metadata:{channelCount:r.channelCount}},I&&(re=r.inputTimeScale,V=J=g[0].pts-Math.round(re*n))),t.sps&&t.pps&&p.length&&(t.timescale=t.inputTimeScale,k.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:x.default.initSegment([t]),metadata:{width:t.width,height:t.height}},I)){re=t.inputTimeScale;var ee=this.getVideoStartPts(p),ae=Math.round(re*n);J=Math.min(J,a(p[0].dts,ee)-ae),V=Math.min(V,ee-ae)}if(Object.keys(k).length)return this.ISGenerated=!0,I&&(this._initPTS=V,this._initDTS=J),{tracks:k,initPTS:V,timescale:re}},u.remuxVideo=function(r,t,n,g){var p=r.inputTimeScale,S=r.samples,k=[],I=S.length,G=this._initPTS,V=this.nextAvcDts,J=8,re,ee,ae,be=Number.POSITIVE_INFINITY,he=Number.NEGATIVE_INFINITY,me=0,ce=!1;if(!n||V===null){var te=t*p,q=S[0].pts-a(S[0].dts,S[0].pts);V=te-q}for(var oe=0;oe<I;oe++){var Z=S[oe];if(Z.pts=a(Z.pts-G,V),Z.dts=a(Z.dts-G,V),Z.dts>Z.pts){var D=9e4*.2;me=Math.max(Math.min(me,Z.pts-Z.dts),-1*D)}Z.dts<S[oe>0?oe-1:oe].dts&&(ce=!0)}ce&&S.sort(function(je,Fe){var _e=je.dts-Fe.dts,qe=je.pts-Fe.pts;return _e||qe}),ee=S[0].dts,ae=S[S.length-1].dts;var h=Math.round((ae-ee)/(I-1));if(me<0){if(me<h*-2){R.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(y.toMsFromMpegTsClock)(-h,!0)+" ms");for(var m=me,P=0;P<I;P++)S[P].dts=m=Math.max(m,S[P].pts-h),S[P].pts=Math.max(m,S[P].pts)}else{R.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(y.toMsFromMpegTsClock)(me,!0)+" ms to overcome this issue");for(var _=0;_<I;_++)S[_].dts=S[_].dts+me}ee=S[0].dts}if(n){var A=ee-V,Y=A>h,ne=A<-1;if(Y||ne){Y?R.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(A,!0)+" ms ("+A+"dts) hole between fragments detected, filling it"):R.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(-A,!0)+" ms ("+A+"dts) overlapping between fragments detected"),ee=V;var ue=S[0].pts-A;S[0].dts=ee,S[0].pts=ue,R.logger.log("Video: First PTS/DTS adjusted: "+Object(y.toMsFromMpegTsClock)(ue,!0)+"/"+Object(y.toMsFromMpegTsClock)(ee,!0)+", delta: "+Object(y.toMsFromMpegTsClock)(A,!0)+" ms")}}e&&(ee=Math.max(0,ee));for(var fe=0,Ee=0,we=0;we<I;we++){for(var Ae=S[we],De=Ae.units,se=De.length,pe=0,ge=0;ge<se;ge++)pe+=De[ge].data.length;Ee+=pe,fe+=se,Ae.length=pe,Ae.dts=Math.max(Ae.dts,ee),Ae.pts=Math.max(Ae.pts,Ae.dts,0),be=Math.min(Ae.pts,be),he=Math.max(Ae.pts,he)}ae=S[I-1].dts;var xe=Ee+4*fe+8,Te;try{Te=new Uint8Array(xe)}catch(je){this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:M.ErrorTypes.MUX_ERROR,details:M.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:xe,reason:"fail allocating video mdat "+xe});return}var Se=new DataView(Te.buffer);Se.setUint32(0,xe),Te.set(x.default.types.mdat,4);for(var ye=0;ye<I;ye++){for(var Le=S[ye],Re=Le.units,z=0,N=0,B=Re.length;N<B;N++){var H=Re[N],X=H.data,F=H.data.byteLength;Se.setUint32(J,F),J+=4,Te.set(X,J),J+=F,z+=4+F}if(ye<I-1)re=S[ye+1].dts-Le.dts;else{var W=this.config,$=Le.dts-S[ye>0?ye-1:ye].dts;if(W.stretchShortVideoTrack&&this.nextAudioPts!==null){var Q=Math.floor(W.maxBufferHole*p),de=(g?be+g*p:this.nextAudioPts)-Le.pts;de>Q?(re=de-$,re<0&&(re=$),R.logger.log("[mp4-remuxer]: It is approximately "+de/90+" ms to the next segment; using duration "+re/90+" ms for the last video frame.")):re=$}else re=$}var le=Math.round(Le.pts-Le.dts);k.push(new d(Le.key,re,z,le))}if(k.length&&v&&v<70){var Ce=k[0].flags;Ce.dependsOn=2,Ce.isNonSync=0}console.assert(re!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=ae+re,this.isVideoContiguous=!0;var Oe=x.default.moof(r.sequenceNumber++,ee,T({},r,{samples:k})),Me="video",Pe={data1:Oe,data2:Te,startPTS:be/p,endPTS:(he+re)/p,startDTS:ee/p,endDTS:V/p,type:Me,hasAudio:!1,hasVideo:!0,nb:k.length,dropped:r.dropped};return r.samples=[],r.dropped=0,console.assert(Te.length,"MDAT length must not be zero"),Pe},u.remuxAudio=function(r,t,n,g,p){var S=r.inputTimeScale,k=r.samplerate?r.samplerate:S,I=S/k,G=r.isAAC?E:b,V=G*I,J=this._initPTS,re=!r.isAAC&&this.typeSupported.mpeg,ee=[],ae=r.samples,be=re?0:8,he=this.nextAudioPts||-1,me=t*S;if(this.isAudioContiguous=n=n||ae.length&&he>0&&(g&&Math.abs(me-he)<9e3||Math.abs(a(ae[0].pts-J,me)-he)<20*V),ae.forEach(function(X){X.pts=a(X.pts-J,me)}),!n||he<0){if(ae=ae.filter(function(X){return X.pts>=0}),!ae.length)return;p===0?he=0:g?he=Math.max(0,me):he=ae[0].pts}if(r.isAAC)for(var ce=p!==void 0,te=this.config.maxAudioFramesDrift,q=0,oe=he;q<ae.length;q++){var Z=ae[q],D=Z.pts,h=D-oe,m=Math.abs(1e3*h/S);if(h<=-te*V&&ce)q===0&&(R.logger.warn("Audio frame @ "+(D/S).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*h/S)+" ms."),this.nextAudioPts=he=oe=D);else if(h>=te*V&&m<w&&ce){var P=Math.round(h/V);oe=D-P*V,oe<0&&(P--,oe+=V),q===0&&(this.nextAudioPts=he=oe),R.logger.warn("[mp4-remuxer]: Injecting "+P+" audio frame @ "+(oe/S).toFixed(3)+"s due to "+Math.round(1e3*h/S)+" ms gap.");for(var _=0;_<P;_++){var A=Math.max(oe,0),Y=O.default.getSilentFrame(r.manifestCodec||r.codec,r.channelCount);Y||(R.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Y=Z.unit.subarray()),ae.splice(q,0,{unit:Y,pts:A}),oe+=V,q++}}Z.pts=oe,oe+=V}for(var ne=null,ue=null,fe,Ee=0,we=ae.length;we--;)Ee+=ae[we].unit.byteLength;for(var Ae=0,De=ae.length;Ae<De;Ae++){var se=ae[Ae],pe=se.unit,ge=se.pts;if(ue!==null){var xe=ee[Ae-1];xe.duration=Math.round((ge-ue)/I)}else if(n&&r.isAAC&&(ge=he),ne=ge,Ee>0){Ee+=be;try{fe=new Uint8Array(Ee)}catch(X){this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:M.ErrorTypes.MUX_ERROR,details:M.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ee,reason:"fail allocating audio mdat "+Ee});return}if(!re){var Te=new DataView(fe.buffer);Te.setUint32(0,Ee),fe.set(x.default.types.mdat,4)}}else return;fe.set(pe,be);var Se=pe.byteLength;be+=Se,ee.push(new d(!0,G,Se,0)),ue=ge}var ye=ee.length;if(!ye)return;var Le=ee[ee.length-1];this.nextAudioPts=he=ue+I*Le.duration;var Re=re?new Uint8Array(0):x.default.moof(r.sequenceNumber++,ne/I,T({},r,{samples:ee}));r.samples=[];var z=ne/S,N=he/S,B="audio",H={data1:Re,data2:fe,startPTS:z,endPTS:N,startDTS:z,endDTS:N,type:B,hasAudio:!0,hasVideo:!1,nb:ye};return this.isAudioContiguous=!0,console.assert(fe.length,"MDAT length must not be zero"),H},u.remuxEmptyAudio=function(r,t,n,g){var p=r.inputTimeScale,S=r.samplerate?r.samplerate:p,k=p/S,I=this.nextAudioPts,G=(I!==null?I:g.startDTS*p)+this._initDTS,V=g.endDTS*p+this._initDTS,J=k*E,re=Math.ceil((V-G)/J),ee=O.default.getSilentFrame(r.manifestCodec||r.codec,r.channelCount);if(R.logger.warn("[mp4-remuxer]: remux empty Audio"),!ee){R.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ae=[],be=0;be<re;be++){var he=G+be*J;ae.push({unit:ee,pts:he,dts:he})}return r.samples=ae,this.remuxAudio(r,t,n,!1)},u.remuxID3=function(r,t){var n=r.samples.length;if(!n)return;for(var g=r.inputTimeScale,p=this._initPTS,S=this._initDTS,k=0;k<n;k++){var I=r.samples[k];I.pts=a(I.pts-p,t*g)/g,I.dts=a(I.dts-S,t*g)/g}var G=r.samples;return r.samples=[],{samples:G}},u.remuxText=function(r,t){var n=r.samples.length;if(!n)return;for(var g=r.inputTimeScale,p=this._initPTS,S=0;S<n;S++){var k=r.samples[S];k.pts=a(k.pts-p,t*g)/g}r.samples.sort(function(G,V){return G.pts-V.pts});var I=r.samples;return r.samples=[],{samples:I}},f}();function a(f,u){var i;if(u===null)return f;for(u<f?i=-8589934592:i=8589934592;Math.abs(f-u)>4294967296;)f+=i;return f}function c(f){for(var u=0;u<f.length;u++)if(f[u].key)return u;return-1}var d=function(u,i,r,t){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=i,this.size=r,this.cts=t,this.flags=new o(u)},o=function(u){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=u?2:1,this.isNonSync=u?0:1}},"./src/remux/passthrough-remuxer.ts":function(ve,U,C){"use strict";C.r(U);var j=C("./src/polyfills/number.ts"),O=C("./src/utils/mp4-tools.ts"),x=C("./src/loader/fragment.ts"),K=C("./src/utils/logger.ts"),M=function(){function y(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var T=y.prototype;return T.destroy=function(){},T.resetTimeStamp=function(E){this.initPTS=E,this.lastEndDTS=null},T.resetNextTimestamp=function(){this.lastEndDTS=null},T.resetInitSegment=function(E,b,v){this.audioCodec=b,this.videoCodec=v,this.generateInitSegment(E),this.emitInitSegment=!0},T.generateInitSegment=function(E){var b=this.audioCodec,v=this.videoCodec;if(!E||!E.byteLength){this.initTracks=void 0,this.initData=void 0;return}var l=this.initData=Object(O.parseInitSegment)(E);b||(b=L(l.audio,x.ElementaryStreamTypes.AUDIO)),v||(v=L(l.video,x.ElementaryStreamTypes.VIDEO));var e={};l.audio&&l.video?e.audiovideo={container:"video/mp4",codec:b+","+v,initSegment:E,id:"main"}:l.audio?e.audio={container:"audio/mp4",codec:b,initSegment:E,id:"audio"}:l.video?e.video={container:"video/mp4",codec:v,initSegment:E,id:"main"}:K.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=e},T.remux=function(E,b,v,l,e){var s=this.initPTS,a=this.lastEndDTS,c={audio:void 0,video:void 0,text:l,id3:v,initSegment:void 0};Object(j.isFiniteNumber)(a)||(a=this.lastEndDTS=e||0);var d=b.samples;if(!d||!d.length)return c;var o={initPTS:void 0,timescale:1},f=this.initData;if((!f||!f.length)&&(this.generateInitSegment(d),f=this.initData),!f||!f.length)return K.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),c;this.emitInitSegment&&(o.tracks=this.initTracks,this.emitInitSegment=!1),Object(j.isFiniteNumber)(s)||(this.initPTS=o.initPTS=s=R(f,d,a));var u=Object(O.getDuration)(d,f),i=a,r=u+i;Object(O.offsetStartDTS)(f,d,s),u>0?this.lastEndDTS=r:(K.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var t=!!f.audio,n=!!f.video,g="";t&&(g+="audio"),n&&(g+="video");var p={data1:d,startPTS:i,startDTS:i,endPTS:r,endDTS:r,type:g,hasAudio:t,hasVideo:n,nb:1,dropped:0};return c.audio=p.type==="audio"?p:void 0,c.video=p.type!=="audio"?p:void 0,c.text=l,c.id3=v,c.initSegment=o,c},y}(),R=function(T,w,E){return Object(O.getStartDTS)(T,w)-E};function L(y,T){var w=y==null?void 0:y.codec;return w&&w.length>4?w:w==="hvc1"?"hvc1.1.c.L120.90":w==="av01"?"av01.0.04M.08":w==="avc1"||T===x.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}U.default=M},"./src/task-loop.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"default",function(){return j});var j=function(){function O(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var x=O.prototype;return x.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},x.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},x.onHandlerDestroyed=function(){},x.hasInterval=function(){return!!this._tickInterval},x.hasNextTick=function(){return!!this._tickTimer},x.setInterval=function(M){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,M),!0)},x.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},x.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},x.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},x.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},x.doTick=function(){},O}()},"./src/types/cmcd.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"CMCDVersion",function(){return j}),C.d(U,"CMCDObjectType",function(){return O}),C.d(U,"CMCDStreamingFormat",function(){return x}),C.d(U,"CMCDStreamType",function(){return K});var j=1,O;(function(M){M.MANIFEST="m",M.AUDIO="a",M.VIDEO="v",M.MUXED="av",M.INIT="i",M.CAPTION="c",M.TIMED_TEXT="tt",M.KEY="k",M.OTHER="o"})(O||(O={}));var x;(function(M){M.DASH="d",M.HLS="h",M.SMOOTH="s",M.OTHER="o"})(x||(x={}));var K;(function(M){M.VOD="v",M.LIVE="l"})(K||(K={}))},"./src/types/level.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"HlsSkip",function(){return x}),C.d(U,"getSkipValue",function(){return K}),C.d(U,"HlsUrlParameters",function(){return M}),C.d(U,"Level",function(){return R});function j(L,y){for(var T=0;T<y.length;T++){var w=y[T];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(L,w.key,w)}}function O(L,y,T){return y&&j(L.prototype,y),T&&j(L,T),L}var x;(function(L){L.No="",L.Yes="YES",L.v2="v2"})(x||(x={}));function K(L,y){var T=L.canSkipUntil,w=L.canSkipDateRanges,E=L.endSN,b=y!==void 0?y-E:0;return T&&b<T?w?x.v2:x.Yes:x.No}var M=function(){function L(T,w,E){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=T,this.part=w,this.skip=E}var y=L.prototype;return y.addDirectives=function(w){var E=new self.URL(w);return this.msn!==void 0&&E.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&E.searchParams.set("_HLS_part",this.part.toString()),this.skip&&E.searchParams.set("_HLS_skip",this.skip),E.toString()},L}(),R=function(){function L(y){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[y.url],this.attrs=y.attrs,this.bitrate=y.bitrate,y.details&&(this.details=y.details),this.id=y.id||0,this.name=y.name,this.width=y.width||0,this.height=y.height||0,this.audioCodec=y.audioCodec,this.videoCodec=y.videoCodec,this.unknownCodecs=y.unknownCodecs,this.codecSet=[y.videoCodec,y.audioCodec].filter(function(T){return T}).join(",").replace(/\.[^.,]+/g,"")}return O(L,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(T){var w=T%this.url.length;this._urlId!==w&&(this.details=void 0,this._urlId=w)}}]),L}()},"./src/types/loader.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"PlaylistContextType",function(){return j}),C.d(U,"PlaylistLevelType",function(){return O});var j;(function(x){x.MANIFEST="manifest",x.LEVEL="level",x.AUDIO_TRACK="audioTrack",x.SUBTITLE_TRACK="subtitleTrack"})(j||(j={}));var O;(function(x){x.MAIN="main",x.AUDIO="audio",x.SUBTITLE="subtitle"})(O||(O={}))},"./src/types/transmuxer.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"ChunkMetadata",function(){return j});var j=function(K,M,R,L,y,T){L===void 0&&(L=0),y===void 0&&(y=-1),T===void 0&&(T=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=O(),this.buffering={audio:O(),video:O(),audiovideo:O()},this.level=K,this.sn=M,this.id=R,this.size=L,this.part=y,this.partial=T};function O(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"AttrList",function(){return x});var j=/^(\d+)x(\d+)$/,O=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,x=function(){function K(R){typeof R=="string"&&(R=K.parseAttrList(R));for(var L in R)R.hasOwnProperty(L)&&(this[L]=R[L])}var M=K.prototype;return M.decimalInteger=function(L){var y=parseInt(this[L],10);return y>Number.MAX_SAFE_INTEGER?Infinity:y},M.hexadecimalInteger=function(L){if(this[L]){var y=(this[L]||"0x").slice(2);y=(y.length&1?"0":"")+y;for(var T=new Uint8Array(y.length/2),w=0;w<y.length/2;w++)T[w]=parseInt(y.slice(w*2,w*2+2),16);return T}else return null},M.hexadecimalIntegerAsNumber=function(L){var y=parseInt(this[L],16);return y>Number.MAX_SAFE_INTEGER?Infinity:y},M.decimalFloatingPoint=function(L){return parseFloat(this[L])},M.optionalFloat=function(L,y){var T=this[L];return T?parseFloat(T):y},M.enumeratedString=function(L){return this[L]},M.bool=function(L){return this[L]==="YES"},M.decimalResolution=function(L){var y=j.exec(this[L]);return y===null?void 0:{width:parseInt(y[1],10),height:parseInt(y[2],10)}},K.parseAttrList=function(L){var y,T={},w='"';for(O.lastIndex=0;(y=O.exec(L))!==null;){var E=y[2];E.indexOf(w)===0&&E.lastIndexOf(w)===E.length-1&&(E=E.slice(1,-1)),T[y[1]]=E}return T},K}()},"./src/utils/binary-search.ts":function(ve,U,C){"use strict";C.r(U);var j={search:function(x,K){for(var M=0,R=x.length-1,L=null,y=null;M<=R;){L=(M+R)/2|0,y=x[L];var T=K(y);if(T>0)M=L+1;else if(T<0)R=L-1;else return y}return null}};U.default=j},"./src/utils/buffer-helper.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"BufferHelper",function(){return x});var j=C("./src/utils/logger.ts"),O={length:0,start:function(){return 0},end:function(){return 0}},x=function(){function K(){}return K.isBuffered=function(R,L){try{if(R){for(var y=K.getBuffered(R),T=0;T<y.length;T++)if(L>=y.start(T)&&L<=y.end(T))return!0}}catch(w){}return!1},K.bufferInfo=function(R,L,y){try{if(R){var T=K.getBuffered(R),w=[],E;for(E=0;E<T.length;E++)w.push({start:T.start(E),end:T.end(E)});return this.bufferedInfo(w,L,y)}}catch(b){}return{len:0,start:L,end:L,nextStart:void 0}},K.bufferedInfo=function(R,L,y){L=Math.max(0,L),R.sort(function(o,f){var u=o.start-f.start;return u||f.end-o.end});var T=[];if(y)for(var w=0;w<R.length;w++){var E=T.length;if(E){var b=T[E-1].end;R[w].start-b<y?R[w].end>b&&(T[E-1].end=R[w].end):T.push(R[w])}else T.push(R[w])}else T=R;for(var v=0,l,e=L,s=L,a=0;a<T.length;a++){var c=T[a].start,d=T[a].end;if(L+y>=c&&L<d)e=c,s=d,v=s-L;else if(L+y<c){l=c;break}}return{len:v,start:e||0,end:s||0,nextStart:l}},K.getBuffered=function(R){try{return R.buffered}catch(L){return j.logger.log("failed to get media.buffered",L),O}},K}()},"./src/utils/cea-608-parser.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"Row",function(){return s}),C.d(U,"CaptionScreen",function(){return a});var j=C("./src/utils/logger.ts"),O={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},x=function(r){var t=r;return O.hasOwnProperty(r)&&(t=O[r]),String.fromCharCode(t)},K=15,M=100,R={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},L={17:2,18:4,21:6,22:8,23:10,19:13,20:15},y={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},T={25:2,26:4,29:6,30:8,31:10,27:13,28:15},w=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],E;(function(i){i[i.ERROR=0]="ERROR",i[i.TEXT=1]="TEXT",i[i.WARNING=2]="WARNING",i[i.INFO=2]="INFO",i[i.DEBUG=3]="DEBUG",i[i.DATA=3]="DATA"})(E||(E={}));var b=function(){function i(){this.time=null,this.verboseLevel=E.ERROR}var r=i.prototype;return r.log=function(n,g){this.verboseLevel>=n&&j.logger.log(this.time+" ["+n+"] "+g)},i}(),v=function(r){for(var t=[],n=0;n<r.length;n++)t.push(r[n].toString(16));return t},l=function(){function i(t,n,g,p,S){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=t||"white",this.underline=n||!1,this.italics=g||!1,this.background=p||"black",this.flash=S||!1}var r=i.prototype;return r.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},r.setStyles=function(n){for(var g=["foreground","underline","italics","background","flash"],p=0;p<g.length;p++){var S=g[p];n.hasOwnProperty(S)&&(this[S]=n[S])}},r.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},r.equals=function(n){return this.foreground===n.foreground&&this.underline===n.underline&&this.italics===n.italics&&this.background===n.background&&this.flash===n.flash},r.copy=function(n){this.foreground=n.foreground,this.underline=n.underline,this.italics=n.italics,this.background=n.background,this.flash=n.flash},r.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},i}(),e=function(){function i(t,n,g,p,S,k){this.uchar=void 0,this.penState=void 0,this.uchar=t||" ",this.penState=new l(n,g,p,S,k)}var r=i.prototype;return r.reset=function(){this.uchar=" ",this.penState.reset()},r.setChar=function(n,g){this.uchar=n,this.penState.copy(g)},r.setPenState=function(n){this.penState.copy(n)},r.equals=function(n){return this.uchar===n.uchar&&this.penState.equals(n.penState)},r.copy=function(n){this.uchar=n.uchar,this.penState.copy(n.penState)},r.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},i}(),s=function(){function i(t){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var n=0;n<M;n++)this.chars.push(new e);this.logger=t,this.pos=0,this.currPenState=new l}var r=i.prototype;return r.equals=function(n){for(var g=!0,p=0;p<M;p++)if(!this.chars[p].equals(n.chars[p])){g=!1;break}return g},r.copy=function(n){for(var g=0;g<M;g++)this.chars[g].copy(n.chars[g])},r.isEmpty=function(){for(var n=!0,g=0;g<M;g++)if(!this.chars[g].isEmpty()){n=!1;break}return n},r.setCursor=function(n){this.pos!==n&&(this.pos=n),this.pos<0?(this.logger.log(E.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>M&&(this.logger.log(E.DEBUG,"Too large cursor position "+this.pos),this.pos=M)},r.moveCursor=function(n){var g=this.pos+n;if(n>1)for(var p=this.pos+1;p<g+1;p++)this.chars[p].setPenState(this.currPenState);this.setCursor(g)},r.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},r.insertChar=function(n){n>=144&&this.backSpace();var g=x(n);if(this.pos>=M){this.logger.log(E.ERROR,"Cannot insert "+n.toString(16)+" ("+g+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(g,this.currPenState),this.moveCursor(1)},r.clearFromPos=function(n){var g;for(g=n;g<M;g++)this.chars[g].reset()},r.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},r.clearToEndOfRow=function(){this.clearFromPos(this.pos)},r.getTextString=function(){for(var n=[],g=!0,p=0;p<M;p++){var S=this.chars[p].uchar;S!==" "&&(g=!1),n.push(S)}return g?"":n.join("")},r.setPenStyles=function(n){this.currPenState.setStyles(n);var g=this.chars[this.pos];g.setPenState(this.currPenState)},i}(),a=function(){function i(t){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var n=0;n<K;n++)this.rows.push(new s(t));this.logger=t,this.currRow=K-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var r=i.prototype;return r.reset=function(){for(var n=0;n<K;n++)this.rows[n].clear();this.currRow=K-1},r.equals=function(n){for(var g=!0,p=0;p<K;p++)if(!this.rows[p].equals(n.rows[p])){g=!1;break}return g},r.copy=function(n){for(var g=0;g<K;g++)this.rows[g].copy(n.rows[g])},r.isEmpty=function(){for(var n=!0,g=0;g<K;g++)if(!this.rows[g].isEmpty()){n=!1;break}return n},r.backSpace=function(){var n=this.rows[this.currRow];n.backSpace()},r.clearToEndOfRow=function(){var n=this.rows[this.currRow];n.clearToEndOfRow()},r.insertChar=function(n){var g=this.rows[this.currRow];g.insertChar(n)},r.setPen=function(n){var g=this.rows[this.currRow];g.setPenStyles(n)},r.moveCursor=function(n){var g=this.rows[this.currRow];g.moveCursor(n)},r.setCursor=function(n){this.logger.log(E.INFO,"setCursor: "+n);var g=this.rows[this.currRow];g.setCursor(n)},r.setPAC=function(n){this.logger.log(E.INFO,"pacData = "+JSON.stringify(n));var g=n.row-1;if(this.nrRollUpRows&&g<this.nrRollUpRows-1&&(g=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==g){for(var p=0;p<K;p++)this.rows[p].clear();var S=this.currRow+1-this.nrRollUpRows,k=this.lastOutputScreen;if(k){var I=k.rows[S].cueStartTime,G=this.logger.time;if(I&&G!==null&&I<G)for(var V=0;V<this.nrRollUpRows;V++)this.rows[g-this.nrRollUpRows+V+1].copy(k.rows[S+V])}}this.currRow=g;var J=this.rows[this.currRow];if(n.indent!==null){var re=n.indent,ee=Math.max(re-1,0);J.setCursor(n.indent),n.color=J.chars[ee].penState.foreground}var ae={foreground:n.color,underline:n.underline,italics:n.italics,background:"black",flash:!1};this.setPen(ae)},r.setBkgData=function(n){this.logger.log(E.INFO,"bkgData = "+JSON.stringify(n)),this.backSpace(),this.setPen(n),this.insertChar(32)},r.setRollUpRows=function(n){this.nrRollUpRows=n},r.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(E.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(E.TEXT,this.getDisplayText());var n=this.currRow+1-this.nrRollUpRows,g=this.rows.splice(n,1)[0];g.clear(),this.rows.splice(this.currRow,0,g),this.logger.log(E.INFO,"Rolling up")},r.getDisplayText=function(n){n=n||!1;for(var g=[],p="",S=-1,k=0;k<K;k++){var I=this.rows[k].getTextString();I&&(S=k+1,n?g.push("Row "+S+": '"+I+"'"):g.push(I.trim()))}return g.length>0&&(n?p="["+g.join(" | ")+"]":p=g.join(`
`)),p},r.getTextAndFormat=function(){return this.rows},i}(),c=function(){function i(t,n,g){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=t,this.outputFilter=n,this.mode=null,this.verbose=0,this.displayedMemory=new a(g),this.nonDisplayedMemory=new a(g),this.lastOutputScreen=new a(g),this.currRollUpRow=this.displayedMemory.rows[K-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=g}var r=i.prototype;return r.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[K-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},r.getHandler=function(){return this.outputFilter},r.setHandler=function(n){this.outputFilter=n},r.setPAC=function(n){this.writeScreen.setPAC(n)},r.setBkgData=function(n){this.writeScreen.setBkgData(n)},r.setMode=function(n){if(n===this.mode)return;this.mode=n,this.logger.log(E.INFO,"MODE="+n),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=n},r.insertChars=function(n){for(var g=0;g<n.length;g++)this.writeScreen.insertChar(n[g]);var p=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(E.INFO,p+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(E.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},r.ccRCL=function(){this.logger.log(E.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},r.ccBS=function(){if(this.logger.log(E.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},r.ccAOF=function(){},r.ccAON=function(){},r.ccDER=function(){this.logger.log(E.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},r.ccRU=function(n){this.logger.log(E.INFO,"RU("+n+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(n)},r.ccFON=function(){this.logger.log(E.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},r.ccRDC=function(){this.logger.log(E.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},r.ccTR=function(){this.logger.log(E.INFO,"TR"),this.setMode("MODE_TEXT")},r.ccRTD=function(){this.logger.log(E.INFO,"RTD"),this.setMode("MODE_TEXT")},r.ccEDM=function(){this.logger.log(E.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},r.ccCR=function(){this.logger.log(E.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},r.ccENM=function(){this.logger.log(E.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},r.ccEOC=function(){if(this.logger.log(E.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var n=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=n,this.writeScreen=this.nonDisplayedMemory,this.logger.log(E.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},r.ccTO=function(n){this.logger.log(E.INFO,"TO("+n+") - Tab Offset"),this.writeScreen.moveCursor(n)},r.ccMIDROW=function(n){var g={flash:!1};if(g.underline=n%2===1,g.italics=n>=46,g.italics)g.foreground="white";else{var p=Math.floor(n/2)-16,S=["white","green","blue","cyan","red","yellow","magenta"];g.foreground=S[p]}this.logger.log(E.INFO,"MIDROW: "+JSON.stringify(g)),this.writeScreen.setPen(g)},r.outputDataUpdate=function(n){n===void 0&&(n=!1);var g=this.logger.time;if(g===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=g:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,g,this.lastOutputScreen),n&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:g),this.lastOutputScreen.copy(this.displayedMemory))},r.cueSplitAtTime=function(n){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,n,this.displayedMemory),this.cueStartTime=n))},i}(),d=function(){function i(t,n,g){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var p=new b;this.channels=[null,new c(t,n,p),new c(t+1,g,p)],this.cmdHistory=u(),this.logger=p}var r=i.prototype;return r.getHandler=function(n){return this.channels[n].getHandler()},r.setHandler=function(n,g){this.channels[n].setHandler(g)},r.addData=function(n,g){var p,S,k,I=!1;this.logger.time=n;for(var G=0;G<g.length;G+=2){if(S=g[G]&127,k=g[G+1]&127,S===0&&k===0)continue;if(this.logger.log(E.DATA,"["+v([g[G],g[G+1]])+"] -> ("+v([S,k])+")"),p=this.parseCmd(S,k),p||(p=this.parseMidrow(S,k)),p||(p=this.parsePAC(S,k)),p||(p=this.parseBackgroundAttributes(S,k)),!p&&(I=this.parseChars(S,k),I)){var V=this.currentChannel;if(V&&V>0){var J=this.channels[V];J.insertChars(I)}else this.logger.log(E.WARNING,"No channel found yet. TEXT-MODE?")}!p&&!I&&this.logger.log(E.WARNING,"Couldn't parse cleaned data "+v([S,k])+" orig: "+v([g[G],g[G+1]]))}},r.parseCmd=function(n,g){var p=this.cmdHistory,S=(n===20||n===28||n===21||n===29)&&g>=32&&g<=47,k=(n===23||n===31)&&g>=33&&g<=35;if(!(S||k))return!1;if(f(n,g,p))return o(null,null,p),this.logger.log(E.DEBUG,"Repeated command ("+v([n,g])+") is dropped"),!0;var I=n===20||n===21||n===23?1:2,G=this.channels[I];return n===20||n===21||n===28||n===29?g===32?G.ccRCL():g===33?G.ccBS():g===34?G.ccAOF():g===35?G.ccAON():g===36?G.ccDER():g===37?G.ccRU(2):g===38?G.ccRU(3):g===39?G.ccRU(4):g===40?G.ccFON():g===41?G.ccRDC():g===42?G.ccTR():g===43?G.ccRTD():g===44?G.ccEDM():g===45?G.ccCR():g===46?G.ccENM():g===47&&G.ccEOC():G.ccTO(g-32),o(n,g,p),this.currentChannel=I,!0},r.parseMidrow=function(n,g){var p=0;if((n===17||n===25)&&g>=32&&g<=47){if(n===17?p=1:p=2,p!==this.currentChannel)return this.logger.log(E.ERROR,"Mismatch channel in midrow parsing"),!1;var S=this.channels[p];return S?(S.ccMIDROW(g),this.logger.log(E.DEBUG,"MIDROW ("+v([n,g])+")"),!0):!1}return!1},r.parsePAC=function(n,g){var p,S=this.cmdHistory,k=(n>=17&&n<=23||n>=25&&n<=31)&&g>=64&&g<=127,I=(n===16||n===24)&&g>=64&&g<=95;if(!(k||I))return!1;if(f(n,g,S))return o(null,null,S),!0;var G=n<=23?1:2;g>=64&&g<=95?p=G===1?R[n]:y[n]:p=G===1?L[n]:T[n];var V=this.channels[G];return V?(V.setPAC(this.interpretPAC(p,g)),o(n,g,S),this.currentChannel=G,!0):!1},r.interpretPAC=function(n,g){var p,S={color:null,italics:!1,indent:null,underline:!1,row:n};return g>95?p=g-96:p=g-64,S.underline=(p&1)===1,p<=13?S.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(p/2)]:p<=15?(S.italics=!0,S.color="white"):S.indent=Math.floor((p-16)/2)*4,S},r.parseChars=function(n,g){var p,S=null,k=null;if(n>=25?(p=2,k=n-8):(p=1,k=n),k>=17&&k<=19){var I;k===17?I=g+80:k===18?I=g+112:I=g+144,this.logger.log(E.INFO,"Special char '"+x(I)+"' in channel "+p),S=[I]}else n>=32&&n<=127&&(S=g===0?[n]:[n,g]);if(S){var G=v(S);this.logger.log(E.DEBUG,"Char codes = "+G.join(",")),o(n,g,this.cmdHistory)}return S},r.parseBackgroundAttributes=function(n,g){var p=(n===16||n===24)&&g>=32&&g<=47,S=(n===23||n===31)&&g>=45&&g<=47;if(!(p||S))return!1;var k,I={};n===16||n===24?(k=Math.floor((g-32)/2),I.background=w[k],g%2===1&&(I.background=I.background+"_semi")):g===45?I.background="transparent":(I.foreground="black",g===47&&(I.underline=!0));var G=n<=23?1:2,V=this.channels[G];return V.setBkgData(I),o(n,g,this.cmdHistory),!0},r.reset=function(){for(var n=0;n<Object.keys(this.channels).length;n++){var g=this.channels[n];g&&g.reset()}this.cmdHistory=u()},r.cueSplitAtTime=function(n){for(var g=0;g<this.channels.length;g++){var p=this.channels[g];p&&p.cueSplitAtTime(n)}},i}();function o(i,r,t){t.a=i,t.b=r}function f(i,r,t){return t.a===i&&t.b===r}function u(){return{a:null,b:null}}U.default=d},"./src/utils/codecs.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"isCodecType",function(){return O}),C.d(U,"isCodecSupportedInMp4",function(){return x});var j={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function O(K,M){var R=j[M];return!!R&&R[K.slice(0,4)]===!0}function x(K,M){return MediaSource.isTypeSupported((M||"video")+'/mp4;codecs="'+K+'"')}},"./src/utils/cues.ts":function(ve,U,C){"use strict";C.r(U);var j=C("./src/utils/vttparser.ts"),O=C("./src/utils/webvtt-parser.ts"),x=C("./src/utils/texttrack-utils.ts"),K=/\s/,M={newCue:function(L,y,T,w){for(var E=[],b,v,l,e,s,a=self.VTTCue||self.TextTrackCue,c=0;c<w.rows.length;c++)if(b=w.rows[c],l=!0,e=0,s="",!b.isEmpty()){for(var d=0;d<b.chars.length;d++)K.test(b.chars[d].uchar)&&l?e++:(s+=b.chars[d].uchar,l=!1);b.cueStartTime=y,y===T&&(T+=1e-4),e>=16?e--:e++;var o=Object(j.fixLineBreaks)(s.trim()),f=Object(O.generateCueId)(y,T,o);(!L||!L.cues||!L.cues.getCueById(f))&&(v=new a(y,T,o),v.id=f,v.line=c+1,v.align="left",v.position=10+Math.min(80,Math.floor(e*8/32)*10),E.push(v))}return L&&E.length&&(E.sort(function(u,i){return u.line==="auto"||i.line==="auto"?0:u.line>8&&i.line>8?i.line-u.line:u.line-i.line}),E.forEach(function(u){return Object(x.addCueToTrack)(L,u)})),E}};U.default=M},"./src/utils/discontinuities.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"findFirstFragWithCC",function(){return K}),C.d(U,"shouldAlignOnDiscontinuities",function(){return M}),C.d(U,"findDiscontinuousReferenceFrag",function(){return R}),C.d(U,"adjustSlidingStart",function(){return y}),C.d(U,"alignStream",function(){return T}),C.d(U,"alignPDT",function(){return E}),C.d(U,"alignFragmentByPDTDelta",function(){return b}),C.d(U,"alignMediaPlaylistByPDT",function(){return v});var j=C("./src/polyfills/number.ts"),O=C("./src/utils/logger.ts"),x=C("./src/controller/level-helper.ts");function K(l,e){for(var s=null,a=0,c=l.length;a<c;a++){var d=l[a];if(d&&d.cc===e){s=d;break}}return s}function M(l,e,s){return!!(e.details&&(s.endCC>s.startCC||l&&l.cc<s.startCC))}function R(l,e){var s=l.fragments,a=e.fragments;if(!a.length||!s.length){O.logger.log("No fragments to align");return}var c=K(s,a[0].cc);if(!c||c&&!c.startPTS){O.logger.log("No frag in previous level to align on");return}return c}function L(l,e){if(l){var s=l.start+e;l.start=l.startPTS=s,l.endPTS=s+l.duration}}function y(l,e){for(var s=e.fragments,a=0,c=s.length;a<c;a++)L(s[a],l);e.fragmentHint&&L(e.fragmentHint,l),e.alignedSliding=!0}function T(l,e,s){if(!e)return;w(l,s,e),!s.alignedSliding&&e.details&&E(s,e.details),!s.alignedSliding&&e.details&&!s.skippedSegments&&Object(x.adjustSliding)(e.details,s)}function w(l,e,s){if(M(l,s,e)){var a=R(s.details,e);a&&Object(j.isFiniteNumber)(a.start)&&(O.logger.log("Adjusting PTS using last level due to CC increase within current level "+e.url),y(a.start,e))}}function E(l,e){if(!e.fragments.length||!l.hasProgramDateTime||!e.hasProgramDateTime)return;var s=e.fragments[0].programDateTime,a=l.fragments[0].programDateTime,c=(a-s)/1e3+e.fragments[0].start;c&&Object(j.isFiniteNumber)(c)&&(O.logger.log("Adjusting PTS using programDateTime delta "+(a-s)+"ms, sliding:"+c.toFixed(3)+" "+l.url+" "),y(c,l))}function b(l,e){var s=l.programDateTime;if(!s)return;var a=(s-e)/1e3;l.start=l.startPTS=a,l.endPTS=a+l.duration}function v(l,e){if(!e.fragments.length||!l.hasProgramDateTime||!e.hasProgramDateTime)return;var s=e.fragments[0].programDateTime,a=e.fragments[0].start,c=s-a*1e3;l.fragments.forEach(function(d){b(d,c)}),l.fragmentHint&&b(l.fragmentHint,c),l.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ve,U,C){"use strict";C.r(U);var j=C("./src/utils/ewma.ts"),O=function(){function x(M,R,L){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=L,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new j.default(M),this.fast_=new j.default(R)}var K=x.prototype;return K.update=function(R,L){var y=this.slow_,T=this.fast_;this.slow_.halfLife!==R&&(this.slow_=new j.default(R,y.getEstimate(),y.getTotalWeight())),this.fast_.halfLife!==L&&(this.fast_=new j.default(L,T.getEstimate(),T.getTotalWeight()))},K.sample=function(R,L){R=Math.max(R,this.minDelayMs_);var y=8*L,T=R/1e3,w=y/T;this.fast_.sample(T,w),this.slow_.sample(T,w)},K.canEstimate=function(){var R=this.fast_;return R&&R.getTotalWeight()>=this.minWeight_},K.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},K.destroy=function(){},x}();U.default=O},"./src/utils/ewma.ts":function(ve,U,C){"use strict";C.r(U);var j=function(){function O(K,M,R){M===void 0&&(M=0),R===void 0&&(R=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=K,this.alpha_=K?Math.exp(Math.log(.5)/K):0,this.estimate_=M,this.totalWeight_=R}var x=O.prototype;return x.sample=function(M,R){var L=Math.pow(this.alpha_,M);this.estimate_=R*(1-L)+L*this.estimate_,this.totalWeight_+=M},x.getTotalWeight=function(){return this.totalWeight_},x.getEstimate=function(){if(this.alpha_){var M=1-Math.pow(this.alpha_,this.totalWeight_);if(M)return this.estimate_/M}return this.estimate_},O}();U.default=j},"./src/utils/fetch-loader.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"fetchSupported",function(){return b});var j=C("./src/polyfills/number.ts"),O=C("./src/loader/load-stats.ts"),x=C("./src/demux/chunk-cache.ts");function K(a,c){a.prototype=Object.create(c.prototype),a.prototype.constructor=a,T(a,c)}function M(a){var c=typeof Map=="function"?new Map:void 0;return M=function(o){if(o===null||!y(o))return o;if(typeof o!="function")throw new TypeError("Super expression must either be null or a function");if(typeof c!="undefined"){if(c.has(o))return c.get(o);c.set(o,f)}function f(){return R(o,arguments,w(this).constructor)}return f.prototype=Object.create(o.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),T(f,o)},M(a)}function R(a,c,d){return L()?R=Reflect.construct:R=function(f,u,i){var r=[null];r.push.apply(r,u);var t=Function.bind.apply(f,r),n=new t;return i&&T(n,i.prototype),n},R.apply(null,arguments)}function L(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}function y(a){return Function.toString.call(a).indexOf("[native code]")!==-1}function T(a,c){return T=Object.setPrototypeOf||function(o,f){return o.__proto__=f,o},T(a,c)}function w(a){return w=Object.setPrototypeOf?Object.getPrototypeOf:function(d){return d.__proto__||Object.getPrototypeOf(d)},w(a)}function E(){return E=Object.assign||function(a){for(var c=1;c<arguments.length;c++){var d=arguments[c];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(a[o]=d[o])}return a},E.apply(this,arguments)}function b(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(a){}return!1}var v=function(){function a(d){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=d.fetchSetup||e,this.controller=new self.AbortController,this.stats=new O.LoadStats}var c=a.prototype;return c.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},c.abortInternal=function(){var o=this.response;(!o||!o.ok)&&(this.stats.aborted=!0,this.controller.abort())},c.abort=function(){var o;this.abortInternal(),(o=this.callbacks)!==null&&o!==void 0&&o.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},c.load=function(o,f,u){var i=this,r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();var t=l(o,this.controller.signal),n=u.onProgress,g=o.responseType==="arraybuffer",p=g?"byteLength":"length";this.context=o,this.config=f,this.callbacks=u,this.request=this.fetchSetup(o,t),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){i.abortInternal(),u.onTimeout(r,o,i.response)},f.timeout),self.fetch(this.request).then(function(S){if(i.response=i.loader=S,!S.ok){var k=S.status,I=S.statusText;throw new s(I||"fetch, bad network response",k,S)}return r.loading.first=Math.max(self.performance.now(),r.loading.start),r.total=parseInt(S.headers.get("Content-Length")||"0"),n&&Object(j.isFiniteNumber)(f.highWaterMark)?i.loadProgressively(S,r,o,f.highWaterMark,n):g?S.arrayBuffer():S.text()}).then(function(S){var k=i.response;self.clearTimeout(i.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first),r.loaded=r.total=S[p];var I={url:k.url,data:S};n&&!Object(j.isFiniteNumber)(f.highWaterMark)&&n(r,o,S,k),u.onSuccess(I,r,o,k)}).catch(function(S){if(self.clearTimeout(i.requestTimeout),r.aborted)return;var k=S.code||0;u.onError({code:k,text:S.message},o,S.details)})},c.getCacheAge=function(){var o=null;if(this.response){var f=this.response.headers.get("age");o=f?parseFloat(f):null}return o},c.loadProgressively=function(o,f,u,i,r){i===void 0&&(i=0);var t=new x.default,n=o.body.getReader(),g=function p(){return n.read().then(function(S){if(S.done)return t.dataLength&&r(f,u,t.flush(),o),Promise.resolve(new ArrayBuffer(0));var k=S.value,I=k.length;return f.loaded+=I,I<i||t.dataLength?(t.push(k),t.dataLength>=i&&r(f,u,t.flush(),o)):r(f,u,k,o),p()}).catch(function(){return Promise.reject()})};return g()},a}();function l(a,c){var d={method:"GET",mode:"cors",credentials:"same-origin",signal:c,headers:new self.Headers(E({},a.headers))};return a.rangeEnd&&d.headers.set("Range","bytes="+a.rangeStart+"-"+String(a.rangeEnd-1)),d}function e(a,c){return new self.Request(a.url,c)}var s=function(a){K(c,a);function c(d,o,f){var u;return u=a.call(this,d)||this,u.code=void 0,u.details=void 0,u.code=o,u.details=f,u}return c}(M(Error));U.default=v},"./src/utils/imsc1-ttml-parser.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"IMSC1_CODEC",function(){return y}),C.d(U,"parseIMSC1",function(){return b});var j=C("./src/utils/mp4-tools.ts"),O=C("./src/utils/vttparser.ts"),x=C("./src/utils/vttcue.ts"),K=C("./src/demux/id3.ts"),M=C("./src/utils/timescale-conversion.ts"),R=C("./src/utils/webvtt-parser.ts");function L(){return L=Object.assign||function(i){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},L.apply(this,arguments)}var y="stpp.ttml.im1t",T=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,w=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,E={left:"start",center:"center",right:"end",start:"start",end:"end"};function b(i,r,t,n,g){var p=Object(j.findBox)(new Uint8Array(i),["mdat"]);if(p.length===0){g(new Error("Could not parse IMSC1 mdat"));return}var S=p[0],k=Object(K.utf8ArrayToStr)(new Uint8Array(i,S.start,S.end-S.start)),I=Object(M.toTimescaleFromScale)(r,1,t);try{n(v(k,I))}catch(G){g(G)}}function v(i,r){var t=new DOMParser,n=t.parseFromString(i,"text/xml"),g=n.getElementsByTagName("tt")[0];if(!g)throw new Error("Invalid ttml");var p={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},S=Object.keys(p).reduce(function(J,re){return J[re]=g.getAttribute("ttp:"+re)||p[re],J},{}),k=g.getAttribute("xml:space")!=="preserve",I=e(l(g,"styling","style")),G=e(l(g,"layout","region")),V=l(g,"body","[begin]");return[].map.call(V,function(J){var re=s(J,k);if(!re||!J.hasAttribute("begin"))return null;var ee=o(J.getAttribute("begin"),S),ae=o(J.getAttribute("dur"),S),be=o(J.getAttribute("end"),S);if(ee===null)throw d(J);if(be===null){if(ae===null)throw d(J);be=ee+ae}var he=new x.default(ee-r,be-r,re);he.id=Object(R.generateCueId)(he.startTime,he.endTime,he.text);var me=G[J.getAttribute("region")],ce=I[J.getAttribute("style")];he.position=10,he.size=80;var te=a(me,ce),q=te.textAlign;if(q){var oe=E[q];oe&&(he.lineAlign=oe),he.align=q}return L(he,te),he}).filter(function(J){return J!==null})}function l(i,r,t){var n=i.getElementsByTagName(r)[0];return n?[].slice.call(n.querySelectorAll(t)):[]}function e(i){return i.reduce(function(r,t){var n=t.getAttribute("xml:id");return n&&(r[n]=t),r},{})}function s(i,r){return[].slice.call(i.childNodes).reduce(function(t,n,g){var p;return n.nodeName==="br"&&g?t+`
`:(p=n.childNodes)!==null&&p!==void 0&&p.length?s(n,r):r?t+n.textContent.trim().replace(/\s+/g," "):t+n.textContent},"")}function a(i,r){var t="http://www.w3.org/ns/ttml#styling",n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return n.reduce(function(g,p){var S=c(r,t,p)||c(i,t,p);return S&&(g[p]=S),g},{})}function c(i,r,t){return i.hasAttributeNS(r,t)?i.getAttributeNS(r,t):null}function d(i){return new Error("Could not parse ttml timestamp "+i)}function o(i,r){if(!i)return null;var t=Object(O.parseTimeStamp)(i);return t===null&&(T.test(i)?t=f(i,r):w.test(i)&&(t=u(i,r))),t}function f(i,r){var t=T.exec(i),n=(t[4]|0)+(t[5]|0)/r.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+n/r.frameRate}function u(i,r){var t=w.exec(i),n=Number(t[1]),g=t[2];switch(g){case"h":return n*3600;case"m":return n*60;case"ms":return n*1e3;case"f":return n/r.frameRate;case"t":return n/r.tickRate}return n}},"./src/utils/logger.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"enableLogs",function(){return R}),C.d(U,"logger",function(){return L});var j=function(){},O={trace:j,debug:j,log:j,warn:j,info:j,error:j},x=O;function K(y){var T=self.console[y];return T?T.bind(self.console,"["+y+"] >"):j}function M(y){for(var T=arguments.length,w=new Array(T>1?T-1:0),E=1;E<T;E++)w[E-1]=arguments[E];w.forEach(function(b){x[b]=y[b]?y[b].bind(y):K(b)})}function R(y){if(self.console&&y===!0||typeof y=="object"){M(y,"debug","log","info","warn","error");try{x.log()}catch(T){x=O}}else x=O}var L=x},"./src/utils/mediakeys-helper.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"KeySystems",function(){return j}),C.d(U,"requestMediaKeySystemAccess",function(){return O});var j;(function(x){x.WIDEVINE="com.widevine.alpha",x.PLAYREADY="com.microsoft.playready"})(j||(j={}));var O=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"getMediaSource",function(){return j});function j(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"bin2str",function(){return M}),C.d(U,"readUint16",function(){return R}),C.d(U,"readUint32",function(){return L}),C.d(U,"writeUint32",function(){return y}),C.d(U,"findBox",function(){return T}),C.d(U,"parseSegmentIndex",function(){return w}),C.d(U,"parseInitSegment",function(){return E}),C.d(U,"getStartDTS",function(){return b}),C.d(U,"getDuration",function(){return v}),C.d(U,"computeRawDurationFromSamples",function(){return l}),C.d(U,"offsetStartDTS",function(){return e}),C.d(U,"segmentValidRange",function(){return s}),C.d(U,"appendUint8Array",function(){return a});var j=C("./src/utils/typed-array.ts"),O=C("./src/loader/fragment.ts"),x=Math.pow(2,32)-1,K=[].push;function M(c){return String.fromCharCode.apply(null,c)}function R(c,d){"data"in c&&(d+=c.start,c=c.data);var o=c[d]<<8|c[d+1];return o<0?65536+o:o}function L(c,d){"data"in c&&(d+=c.start,c=c.data);var o=c[d]<<24|c[d+1]<<16|c[d+2]<<8|c[d+3];return o<0?4294967296+o:o}function y(c,d,o){"data"in c&&(d+=c.start,c=c.data),c[d]=o>>24,c[d+1]=o>>16&255,c[d+2]=o>>8&255,c[d+3]=o&255}function T(c,d){var o=[];if(!d.length)return o;var f,u,i;"data"in c?(f=c.data,u=c.start,i=c.end):(f=c,u=0,i=f.byteLength);for(var r=u;r<i;){var t=L(f,r),n=M(f.subarray(r+4,r+8)),g=t>1?r+t:i;if(n===d[0])if(d.length===1)o.push({data:f,start:r+8,end:g});else{var p=T({data:f,start:r+8,end:g},d.slice(1));p.length&&K.apply(o,p)}r=g}return o}function w(c){var d=T(c,["moov"]),o=d[0],f=o?o.end:null,u=T(c,["sidx"]);if(!u||!u[0])return null;var i=[],r=u[0],t=r.data[0],n=t===0?8:16,g=L(r,n);n+=4;var p=0,S=0;t===0?n+=8:n+=16,n+=2;var k=r.end+S,I=R(r,n);n+=2;for(var G=0;G<I;G++){var V=n,J=L(r,V);V+=4;var re=J&2147483647,ee=(J&2147483648)>>>31;if(ee===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ae=L(r,V);V+=4,i.push({referenceSize:re,subsegmentDuration:ae,info:{duration:ae/g,start:k,end:k+re-1}}),k+=re,V+=4,n=V}return{earliestPresentationTime:p,timescale:g,version:t,referencesCount:I,references:i,moovEndOffset:f}}function E(c){for(var d=[],o=T(c,["moov","trak"]),f=0;f<o.length;f++){var u=o[f],i=T(u,["tkhd"])[0];if(i){var r=i.data[i.start],t=r===0?12:20,n=L(i,t),g=T(u,["mdia","mdhd"])[0];if(g){r=g.data[g.start],t=r===0?12:20;var p=L(g,t),S=T(u,["mdia","hdlr"])[0];if(S){var k=M(S.data.subarray(S.start+8,S.start+12)),I={soun:O.ElementaryStreamTypes.AUDIO,vide:O.ElementaryStreamTypes.VIDEO}[k];if(I){var G=T(u,["mdia","minf","stbl","stsd"])[0],V=void 0;G&&(V=M(G.data.subarray(G.start+12,G.start+16))),d[n]={timescale:p,type:I},d[I]={timescale:p,id:n,codec:V}}}}}}var J=T(c,["moov","mvex","trex"]);return J.forEach(function(re){var ee=L(re,4),ae=d[ee];ae&&(ae.default={duration:L(re,12),flags:L(re,20)})}),d}function b(c,d){return T(d,["moof","traf"]).reduce(function(o,f){var u=T(f,["tfdt"])[0],i=u.data[u.start],r=T(f,["tfhd"]).reduce(function(t,n){var g=L(n,4),p=c[g];if(p){var S=L(u,4);i===1&&(S*=Math.pow(2,32),S+=L(u,8));var k=p.timescale||9e4,I=S/k;if(isFinite(I)&&(t===null||I<t))return I}return t},null);return r!==null&&isFinite(r)&&(o===null||r<o)?r:o},null)||0}function v(c,d){for(var o=0,f=0,u=0,i=T(c,["moof","traf"]),r=0;r<i.length;r++){var t=i[r],n=T(t,["tfhd"])[0],g=L(n,4),p=d[g];if(!p)continue;var S=p.default,k=L(n,0)|(S==null?void 0:S.flags),I=S==null?void 0:S.duration;k&8&&(k&2?I=L(n,12):I=L(n,8));for(var G=p.timescale||9e4,V=T(t,["trun"]),J=0;J<V.length;J++){if(I){var re=L(V[J],4);o=I*re}else o=l(V[J]);p.type===O.ElementaryStreamTypes.VIDEO?f+=o/G:p.type===O.ElementaryStreamTypes.AUDIO&&(u+=o/G)}}if(f===0&&u===0){var ee=w(c);if(ee!=null&&ee.references)return ee.references.reduce(function(ae,be){return ae+be.info.duration||0},0)}return f||u}function l(c){var d=L(c,0),o=8;d&1&&(o+=4),d&4&&(o+=4);for(var f=0,u=L(c,4),i=0;i<u;i++){if(d&256){var r=L(c,o);f+=r,o+=4}d&512&&(o+=4),d&1024&&(o+=4),d&2048&&(o+=4)}return f}function e(c,d,o){T(d,["moof","traf"]).forEach(function(f){T(f,["tfhd"]).forEach(function(u){var i=L(u,4),r=c[i];if(!r)return;var t=r.timescale||9e4;T(f,["tfdt"]).forEach(function(n){var g=n.data[n.start],p=L(n,4);if(g===0)y(n,4,p-o*t);else{p*=Math.pow(2,32),p+=L(n,8),p-=o*t,p=Math.max(p,0);var S=Math.floor(p/(x+1)),k=Math.floor(p%(x+1));y(n,4,S),y(n,8,k)}})})})}function s(c){var d={valid:null,remainder:null},o=T(c,["moof"]);if(o){if(o.length<2)return d.remainder=c,d}else return d;var f=o[o.length-1];return d.valid=Object(j.sliceUint8)(c,0,f.start-8),d.remainder=Object(j.sliceUint8)(c,f.start-8),d}function a(c,d){var o=new Uint8Array(c.length+d.length);return o.set(c),o.set(d,c.length),o}},"./src/utils/output-filter.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"default",function(){return j});var j=function(){function O(K,M){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=K,this.trackName=M}var x=O.prototype;return x.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},x.newCue=function(M,R,L){(this.startTime===null||this.startTime>M)&&(this.startTime=M),this.endTime=R,this.screen=L,this.timelineController.createCaptionsTrack(this.trackName)},x.reset=function(){this.cueRanges=[]},O}()},"./src/utils/texttrack-utils.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"sendAddTrackEvent",function(){return O}),C.d(U,"addCueToTrack",function(){return x}),C.d(U,"clearCurrentCues",function(){return K}),C.d(U,"removeCuesInRange",function(){return M}),C.d(U,"getCuesInRange",function(){return L});var j=C("./src/utils/logger.ts");function O(y,T){var w;try{w=new Event("addtrack")}catch(E){w=document.createEvent("Event"),w.initEvent("addtrack",!1,!1)}w.track=y,T.dispatchEvent(w)}function x(y,T){var w=y.mode;if(w==="disabled"&&(y.mode="hidden"),y.cues&&!y.cues.getCueById(T.id))try{if(y.addCue(T),!y.cues.getCueById(T.id))throw new Error("addCue is failed for: "+T)}catch(b){j.logger.debug("[texttrack-utils]: "+b);var E=new self.TextTrackCue(T.startTime,T.endTime,T.text);E.id=T.id,y.addCue(E)}w==="disabled"&&(y.mode=w)}function K(y){var T=y.mode;if(T==="disabled"&&(y.mode="hidden"),y.cues)for(var w=y.cues.length;w--;)y.removeCue(y.cues[w]);T==="disabled"&&(y.mode=T)}function M(y,T,w){var E=y.mode;if(E==="disabled"&&(y.mode="hidden"),y.cues&&y.cues.length>0)for(var b=L(y.cues,T,w),v=0;v<b.length;v++)y.removeCue(b[v]);E==="disabled"&&(y.mode=E)}function R(y,T){if(T<y[0].startTime)return 0;var w=y.length-1;if(T>y[w].endTime)return-1;for(var E=0,b=w;E<=b;){var v=Math.floor((b+E)/2);if(T<y[v].startTime)b=v-1;else if(T>y[v].startTime&&E<w)E=v+1;else return v}return y[E].startTime-T<T-y[b].startTime?E:b}function L(y,T,w){var E=[],b=R(y,T);if(b>-1)for(var v=b,l=y.length;v<l;v++){var e=y[v];if(e.startTime>=T&&e.endTime<=w)E.push(e);else if(e.startTime>w)return E}return E}},"./src/utils/time-ranges.ts":function(ve,U,C){"use strict";C.r(U);var j={toString:function(x){for(var K="",M=x.length,R=0;R<M;R++)K+="["+x.start(R).toFixed(3)+","+x.end(R).toFixed(3)+"]";return K}};U.default=j},"./src/utils/timescale-conversion.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"toTimescaleFromBase",function(){return O}),C.d(U,"toTimescaleFromScale",function(){return x}),C.d(U,"toMsFromMpegTsClock",function(){return K}),C.d(U,"toMpegTsClockFromTimescale",function(){return M});var j=9e4;function O(R,L,y,T){y===void 0&&(y=1),T===void 0&&(T=!1);var w=R*L*y;return T?Math.round(w):w}function x(R,L,y,T){return y===void 0&&(y=1),T===void 0&&(T=!1),O(R,L,1/y,T)}function K(R,L){return L===void 0&&(L=!1),O(R,1e3,1/j,L)}function M(R,L){return L===void 0&&(L=1),O(R,j,1/L)}},"./src/utils/typed-array.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"sliceUint8",function(){return j});function j(O,x,K){return Uint8Array.prototype.slice?O.slice(x,K):new Uint8Array(Array.prototype.slice.call(O,x,K))}},"./src/utils/vttcue.ts":function(ve,U,C){"use strict";C.r(U),U.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var j=["","lr","rl"],O=["start","middle","end","left","right"];function x(y,T){if(typeof T!="string")return!1;if(!Array.isArray(y))return!1;var w=T.toLowerCase();return~y.indexOf(w)?w:!1}function K(y){return x(j,y)}function M(y){return x(O,y)}function R(y){for(var T=arguments.length,w=new Array(T>1?T-1:0),E=1;E<T;E++)w[E-1]=arguments[E];for(var b=1;b<arguments.length;b++){var v=arguments[b];for(var l in v)y[l]=v[l]}return y}function L(y,T,w){var E=this,b={enumerable:!0};E.hasBeenReset=!1;var v="",l=!1,e=y,s=T,a=w,c=null,d="",o=!0,f="auto",u="start",i=50,r="middle",t=50,n="middle";Object.defineProperty(E,"id",R({},b,{get:function(){return v},set:function(p){v=""+p}})),Object.defineProperty(E,"pauseOnExit",R({},b,{get:function(){return l},set:function(p){l=!!p}})),Object.defineProperty(E,"startTime",R({},b,{get:function(){return e},set:function(p){if(typeof p!="number")throw new TypeError("Start time must be set to a number.");e=p,this.hasBeenReset=!0}})),Object.defineProperty(E,"endTime",R({},b,{get:function(){return s},set:function(p){if(typeof p!="number")throw new TypeError("End time must be set to a number.");s=p,this.hasBeenReset=!0}})),Object.defineProperty(E,"text",R({},b,{get:function(){return a},set:function(p){a=""+p,this.hasBeenReset=!0}})),Object.defineProperty(E,"region",R({},b,{get:function(){return c},set:function(p){c=p,this.hasBeenReset=!0}})),Object.defineProperty(E,"vertical",R({},b,{get:function(){return d},set:function(p){var S=K(p);if(S===!1)throw new SyntaxError("An invalid or illegal string was specified.");d=S,this.hasBeenReset=!0}})),Object.defineProperty(E,"snapToLines",R({},b,{get:function(){return o},set:function(p){o=!!p,this.hasBeenReset=!0}})),Object.defineProperty(E,"line",R({},b,{get:function(){return f},set:function(p){if(typeof p!="number"&&p!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");f=p,this.hasBeenReset=!0}})),Object.defineProperty(E,"lineAlign",R({},b,{get:function(){return u},set:function(p){var S=M(p);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");u=S,this.hasBeenReset=!0}})),Object.defineProperty(E,"position",R({},b,{get:function(){return i},set:function(p){if(p<0||p>100)throw new Error("Position must be between 0 and 100.");i=p,this.hasBeenReset=!0}})),Object.defineProperty(E,"positionAlign",R({},b,{get:function(){return r},set:function(p){var S=M(p);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");r=S,this.hasBeenReset=!0}})),Object.defineProperty(E,"size",R({},b,{get:function(){return t},set:function(p){if(p<0||p>100)throw new Error("Size must be between 0 and 100.");t=p,this.hasBeenReset=!0}})),Object.defineProperty(E,"align",R({},b,{get:function(){return n},set:function(p){var S=M(p);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");n=S,this.hasBeenReset=!0}})),E.displayState=void 0}return L.prototype.getCueAsHTML=function(){var y=self.WebVTT;return y.convertCueToDOMTree(self,this.text)},L}()},"./src/utils/vttparser.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"parseTimeStamp",function(){return x}),C.d(U,"fixLineBreaks",function(){return T}),C.d(U,"VTTParser",function(){return w});var j=C("./src/utils/vttcue.ts"),O=function(){function E(){}var b=E.prototype;return b.decode=function(l,e){if(!l)return"";if(typeof l!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(l))},E}();function x(E){function b(l,e,s,a){return(l|0)*3600+(e|0)*60+(s|0)+parseFloat(a||0)}var v=E.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return v?parseFloat(v[2])>59?b(v[2],v[3],0,v[4]):b(v[1],v[2],v[3],v[4]):null}var K=function(){function E(){this.values=Object.create(null)}var b=E.prototype;return b.set=function(l,e){!this.get(l)&&e!==""&&(this.values[l]=e)},b.get=function(l,e,s){return s?this.has(l)?this.values[l]:e[s]:this.has(l)?this.values[l]:e},b.has=function(l){return l in this.values},b.alt=function(l,e,s){for(var a=0;a<s.length;++a)if(e===s[a]){this.set(l,e);break}},b.integer=function(l,e){/^-?\d+$/.test(e)&&this.set(l,parseInt(e,10))},b.percent=function(l,e){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(e)){var s=parseFloat(e);if(s>=0&&s<=100)return this.set(l,s),!0}return!1},E}();function M(E,b,v,l){var e=l?E.split(l):[E];for(var s in e){if(typeof e[s]!="string")continue;var a=e[s].split(v);if(a.length!==2)continue;var c=a[0],d=a[1];b(c,d)}}var R=new j.default(0,0,""),L=R.align==="middle"?"middle":"center";function y(E,b,v){var l=E;function e(){var c=x(E);if(c===null)throw new Error("Malformed timestamp: "+l);return E=E.replace(/^[^\sa-zA-Z-]+/,""),c}function s(c,d){var o=new K;M(c,function(i,r){var t;switch(i){case"region":for(var n=v.length-1;n>=0;n--)if(v[n].id===r){o.set(i,v[n].region);break}break;case"vertical":o.alt(i,r,["rl","lr"]);break;case"line":t=r.split(","),o.integer(i,t[0]),o.percent(i,t[0])&&o.set("snapToLines",!1),o.alt(i,t[0],["auto"]),t.length===2&&o.alt("lineAlign",t[1],["start",L,"end"]);break;case"position":t=r.split(","),o.percent(i,t[0]),t.length===2&&o.alt("positionAlign",t[1],["start",L,"end","line-left","line-right","auto"]);break;case"size":o.percent(i,r);break;case"align":o.alt(i,r,["start",L,"end","left","right"]);break}},/:/,/\s/),d.region=o.get("region",null),d.vertical=o.get("vertical","");var f=o.get("line","auto");f==="auto"&&R.line===-1&&(f=-1),d.line=f,d.lineAlign=o.get("lineAlign","start"),d.snapToLines=o.get("snapToLines",!0),d.size=o.get("size",100),d.align=o.get("align",L);var u=o.get("position","auto");u==="auto"&&R.position===50&&(u=d.align==="start"||d.align==="left"?0:d.align==="end"||d.align==="right"?100:50),d.position=u}function a(){E=E.replace(/^\s+/,"")}if(a(),b.startTime=e(),a(),E.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+l);E=E.substr(3),a(),b.endTime=e(),a(),s(E,b)}function T(E){return E.replace(/<br(?: \/)?>/gi,`
`)}var w=function(){function E(){this.state="INITIAL",this.buffer="",this.decoder=new O,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var b=E.prototype;return b.parse=function(l){var e=this;l&&(e.buffer+=e.decoder.decode(l,{stream:!0}));function s(){var u=e.buffer,i=0;for(u=T(u);i<u.length&&u[i]!=="\r"&&u[i]!==`
`;)++i;var r=u.substr(0,i);return u[i]==="\r"&&++i,u[i]===`
`&&++i,e.buffer=u.substr(i),r}function a(u){M(u,function(i,r){},/:/)}try{var c="";if(e.state==="INITIAL"){if(!/\r\n|\n/.test(e.buffer))return this;c=s();var d=c.match(/^()?WEBVTT([ \t].*)?$/);if(!d||!d[0])throw new Error("Malformed WebVTT signature.");e.state="HEADER"}for(var o=!1;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;o?o=!1:c=s();switch(e.state){case"HEADER":/:/.test(c)?a(c):c||(e.state="ID");continue;case"NOTE":c||(e.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(c)){e.state="NOTE";break}if(!c)continue;if(e.cue=new j.default(0,0,""),e.state="CUE",c.indexOf("-->")===-1){e.cue.id=c;continue}case"CUE":if(!e.cue){e.state="BADCUE";continue}try{y(c,e.cue,e.regionList)}catch(u){e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":{var f=c.indexOf("-->")!==-1;if(!c||f&&(o=!0)){e.oncue&&e.cue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}if(e.cue===null)continue;e.cue.text&&(e.cue.text+=`
`),e.cue.text+=c}continue;case"BADCUE":c||(e.state="ID")}}}catch(u){e.state==="CUETEXT"&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state=e.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},b.flush=function(){var l=this;try{if((l.cue||l.state==="HEADER")&&(l.buffer+=`
`,l.parse()),l.state==="INITIAL"||l.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(e){l.onparsingerror&&l.onparsingerror(e)}return l.onflush&&l.onflush(),this},E}()},"./src/utils/webvtt-parser.ts":function(ve,U,C){"use strict";C.r(U),C.d(U,"generateCueId",function(){return w}),C.d(U,"parseWebVTT",function(){return b});var j=C("./src/polyfills/number.ts"),O=C("./src/utils/vttparser.ts"),x=C("./src/demux/id3.ts"),K=C("./src/utils/timescale-conversion.ts"),M=C("./src/remux/mp4-remuxer.ts"),R=/\r\n|\n\r|\n|\r/g,L=function(l,e,s){return s===void 0&&(s=0),l.substr(s,e.length)===e},y=function(l){var e=parseInt(l.substr(-3)),s=parseInt(l.substr(-6,2)),a=parseInt(l.substr(-9,2)),c=l.length>9?parseInt(l.substr(0,l.indexOf(":"))):0;if(!Object(j.isFiniteNumber)(e)||!Object(j.isFiniteNumber)(s)||!Object(j.isFiniteNumber)(a)||!Object(j.isFiniteNumber)(c))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+l);return e+=1e3*s,e+=60*1e3*a,e+=60*60*1e3*c,e},T=function(l){for(var e=5381,s=l.length;s;)e=e*33^l.charCodeAt(--s);return(e>>>0).toString()};function w(v,l,e){return T(v.toString())+T(l.toString())+T(e)}var E=function(l,e,s){var a=l[e],c=l[a.prevCC];if(!c||!c.new&&a.new){l.ccOffset=l.presentationOffset=a.start,a.new=!1;return}for(;(d=c)!==null&&d!==void 0&&d.new;){var d;l.ccOffset+=a.start-c.start,a.new=!1,a=c,c=l[a.prevCC]}l.presentationOffset=s};function b(v,l,e,s,a,c,d,o){var f=new O.VTTParser,u=Object(x.utf8ArrayToStr)(new Uint8Array(v)).trim().replace(R,`
`).split(`
`),i=[],r=Object(K.toMpegTsClockFromTimescale)(l,e),t="00:00.000",n=0,g=0,p,S=!0,k=!1;f.oncue=function(I){var G=s[a],V=s.ccOffset,J=(n-r)/9e4;if(G!=null&&G.new&&(g!==void 0?V=s.ccOffset=G.start:E(s,a,J)),J&&(V=J-s.presentationOffset),k){var re=I.endTime-I.startTime,ee=Object(M.normalizePts)((I.startTime+V-g)*9e4,c*9e4)/9e4;I.startTime=ee,I.endTime=ee+re}var ae=I.text.trim();I.text=decodeURIComponent(encodeURIComponent(ae)),I.id||(I.id=w(I.startTime,I.endTime,ae)),I.endTime>0&&i.push(I)},f.onparsingerror=function(I){p=I},f.onflush=function(){if(p){o(p);return}d(i)},u.forEach(function(I){if(S)if(L(I,"X-TIMESTAMP-MAP=")){S=!1,k=!0,I.substr(16).split(",").forEach(function(G){L(G,"LOCAL:")?t=G.substr(6):L(G,"MPEGTS:")&&(n=parseInt(G.substr(7)))});try{g=y(t)/1e3}catch(G){k=!1,p=G}return}else I===""&&(S=!1);f.parse(I+`
`)}),f.flush()}},"./src/utils/xhr-loader.ts":function(ve,U,C){"use strict";C.r(U);var j=C("./src/utils/logger.ts"),O=C("./src/loader/load-stats.ts"),x=/^age:\s*[\d.]+\s*$/m,K=function(){function M(L){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=L?L.xhrSetup:null,this.stats=new O.LoadStats,this.retryDelay=0}var R=M.prototype;return R.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},R.abortInternal=function(){var y=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),y&&(y.onreadystatechange=null,y.onprogress=null,y.readyState!==4&&(this.stats.aborted=!0,y.abort()))},R.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},R.load=function(y,T,w){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=y,this.config=T,this.callbacks=w,this.retryDelay=T.retryDelay,this.loadInternal()},R.loadInternal=function(){var y=this.config,T=this.context;if(!y)return;var w=this.loader=new self.XMLHttpRequest,E=this.stats;E.loading.first=0,E.loaded=0;var b=this.xhrSetup;try{if(b)try{b(w,T.url)}catch(e){w.open("GET",T.url,!0),b(w,T.url)}w.readyState||w.open("GET",T.url,!0);var v=this.context.headers;if(v)for(var l in v)w.setRequestHeader(l,v[l])}catch(e){this.callbacks.onError({code:w.status,text:e.message},T,w);return}T.rangeEnd&&w.setRequestHeader("Range","bytes="+T.rangeStart+"-"+(T.rangeEnd-1)),w.onreadystatechange=this.readystatechange.bind(this),w.onprogress=this.loadprogress.bind(this),w.responseType=T.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout),w.send()},R.readystatechange=function(){var y=this.context,T=this.loader,w=this.stats;if(!y||!T)return;var E=T.readyState,b=this.config;if(w.aborted)return;if(E>=2)if(self.clearTimeout(this.requestTimeout),w.loading.first===0&&(w.loading.first=Math.max(self.performance.now(),w.loading.start)),E===4){T.onreadystatechange=null,T.onprogress=null;var v=T.status;if(v>=200&&v<300){w.loading.end=Math.max(self.performance.now(),w.loading.first);var l,e;if(y.responseType==="arraybuffer"?(l=T.response,e=l.byteLength):(l=T.responseText,e=l.length),w.loaded=w.total=e,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(w,y,l,T),!this.callbacks)return;var a={url:T.responseURL,data:l};this.callbacks.onSuccess(a,w,y,T)}else w.retry>=b.maxRetry||v>=400&&v<499?(j.logger.error(v+" while loading "+y.url),this.callbacks.onError({code:v,text:T.statusText},y,T)):(j.logger.warn(v+" while loading "+y.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,b.maxRetryDelay),w.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),b.timeout)},R.loadtimeout=function(){j.logger.warn("timeout while loading "+this.context.url);var y=this.callbacks;y&&(this.abortInternal(),y.onTimeout(this.stats,this.context,this.loader))},R.loadprogress=function(y){var T=this.stats;T.loaded=y.loaded,y.lengthComputable&&(T.total=y.total)},R.getCacheAge=function(){var y=null;if(this.loader&&x.test(this.loader.getAllResponseHeaders())){var T=this.loader.getResponseHeader("age");y=T?parseFloat(T):null}return y},M}();U.default=K}}).default})},vHTk:function(Ve,Ie,ie){Ve.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);