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.4c7004eb.async.js

334 lines
781 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[196,5,7],{"+ua5":function(et,he,K){},"/cxE":function(et,he,K){"use strict";K.d(he,"e",function(){return w}),K.d(he,"f",function(){return _}),K.d(he,"g",function(){return D}),K.d(he,"d",function(){return N}),K.d(he,"a",function(){return k}),K.d(he,"b",function(){return S}),K.d(he,"c",function(){return C});var ue=function(){function d(){this.listeners=[],this.unexpectedErrorHandler=function(v){setTimeout(function(){throw v.stack?new Error(v.message+`
`+v.stack):v},0)}}return d.prototype.emit=function(v){this.listeners.forEach(function(b){b(v)})},d.prototype.onUnexpectedError=function(v){this.unexpectedErrorHandler(v),this.emit(v)},d.prototype.onUnexpectedExternalError=function(v){this.unexpectedErrorHandler(v)},d}(),B=new ue;function w(d){N(d)||B.onUnexpectedError(d);return}function _(d){N(d)||B.onUnexpectedExternalError(d);return}function D(d){if(d instanceof Error){var v=d.name,b=d.message,p=d.stacktrace||d.stack;return{$isError:!0,name:v,message:b,stack:p}}return d}var A="Canceled";function N(d){return d instanceof Error&&d.name===A&&d.message===A}function k(){var d=new Error(A);return d.name=d.message,d}function S(d){return d?new Error("Illegal argument: "+d):new Error("Illegal argument")}function C(d){return d?new Error("Illegal state: "+d):new Error("Illegal state")}},"24hK":function(et,he,K){"use strict";K.d(he,"a",function(){return w});var ue=K("JYp7"),B=function(){function _(D){this.element=D,this.next=_.Undefined,this.prev=_.Undefined}return _.Undefined=new _(void 0),_}(),w=function(){function _(){this._first=B.Undefined,this._last=B.Undefined,this._size=0}return Object.defineProperty(_.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),_.prototype.isEmpty=function(){return this._first===B.Undefined},_.prototype.clear=function(){this._first=B.Undefined,this._last=B.Undefined,this._size=0},_.prototype.unshift=function(D){return this._insert(D,!1)},_.prototype.push=function(D){return this._insert(D,!0)},_.prototype._insert=function(D,A){var N=this,k=new B(D);if(this._first===B.Undefined)this._first=k,this._last=k;else if(A){var S=this._last;this._last=k,k.prev=S,S.next=k}else{var C=this._first;this._first=k,k.next=C,C.prev=k}this._size+=1;var d=!1;return function(){d||(d=!0,N._remove(k))}},_.prototype.shift=function(){if(this._first===B.Undefined)return;var D=this._first.element;return this._remove(this._first),D},_.prototype.pop=function(){if(this._last===B.Undefined)return;var D=this._last.element;return this._remove(this._last),D},_.prototype._remove=function(D){if(D.prev!==B.Undefined&&D.next!==B.Undefined){var A=D.prev;A.next=D.next,D.next.prev=A}else D.prev===B.Undefined&&D.next===B.Undefined?(this._first=B.Undefined,this._last=B.Undefined):D.next===B.Undefined?(this._last=this._last.prev,this._last.next=B.Undefined):D.prev===B.Undefined&&(this._first=this._first.next,this._first.prev=B.Undefined);this._size-=1},_.prototype.iterator=function(){var D,A=this._first;return{next:function(){return A===B.Undefined?ue.c:(D?D.value=A.element:D={done:!1,value:A.element},A=A.next,D)}}},_.prototype.toArray=function(){for(var D=[],A=this._first;A!==B.Undefined;A=A.next)D.push(A.element);return D},_}()},"55Ip":function(et,he,K){"use strict";K.d(he,"a",function(){return t}),K.d(he,"b",function(){return g});var ue=K("Ty5D"),B=K("dI71"),w=K("q1tI"),_=K.n(w),D=K("YS25"),A=K("17x9"),N=K.n(A),k=K("wx14"),S=K("zLVn"),C=K("9R94"),d=function(a){Object(B.a)(i,a);function i(){for(var T,x=arguments.length,L=new Array(x),R=0;R<x;R++)L[R]=arguments[R];return T=a.call.apply(a,[this].concat(L))||this,T.history=Object(D.a)(T.props),T}var l=i.prototype;return l.render=function(){return _.a.createElement(ue.c,{history:this.history,children:this.props.children})},i}(_.a.Component),v=function(a){Object(B.a)(i,a);function i(){for(var T,x=arguments.length,L=new Array(x),R=0;R<x;R++)L[R]=arguments[R];return T=a.call.apply(a,[this].concat(L))||this,T.history=Object(D.b)(T.props),T}var l=i.prototype;return l.render=function(){return _.a.createElement(ue.c,{history:this.history,children:this.props.children})},i}(_.a.Component),b=function(i,l){return typeof i=="function"?i(l):i},p=function(i,l){return typeof i=="string"?Object(D.c)(i,null,null,l):i},m=function(i){return i},y=_.a.forwardRef;typeof y=="undefined"&&(y=m);function n(a){return!!(a.metaKey||a.altKey||a.ctrlKey||a.shiftKey)}var e=y(function(a,i){var l=a.innerRef,T=a.navigate,x=a.onClick,L=Object(S.a)(a,["innerRef","navigate","onClick"]),R=L.target,I=Object(k.a)({},L,{onClick:function(j){try{x&&x(j)}catch(z){throw j.preventDefault(),z}!j.defaultPrevented&&j.button===0&&(!R||R==="_self")&&!n(j)&&(j.preventDefault(),T())}});return m!==y?I.ref=i||l:I.ref=l,_.a.createElement("a",I)}),t=y(function(a,i){var l=a.component,T=l===void 0?e:l,x=a.replace,L=a.to,R=a.innerRef,I=Object(S.a)(a,["component","replace","to","innerRef"]);return _.a.createElement(ue.e.Consumer,null,function(F){F||Object(C.a)(!1);var j=F.history,z=p(b(L,F.location),F.location),Q=z?j.createHref(z):"",J=Object(k.a)({},I,{href:Q,navigate:function(){var pe=b(L,F.location),ce=x?j.replace:j.push;ce(pe)}});return m!==y?J.ref=i||R:J.innerRef=R,_.a.createElement(T,J)})});if(!1)var r,f;var c=function(i){return i},u=_.a.forwardRef;typeof u=="undefined"&&(u=c);function E(){for(var a=arguments.length,i=new Array(a),l=0;l<a;l++)i[l]=arguments[l];return i.filter(function(T){return T}).join(" ")}var g=u(function(a,i){var l=a["aria-current"],T=l===void 0?"page":l,x=a.activeClassName,L=x===void 0?"active":x,R=a.activeStyle,I=a.className,F=a.exact,j=a.isActive,z=a.location,Q=a.sensitive,J=a.strict,ie=a.style,pe=a.to,ce=a.innerRef,ye=Object(S.a)(a,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return _.a.createElement(ue.e.Consumer,null,function(ve){ve||Object(C.a)(!1);var Z=z||ve.location,q=p(b(pe,Z),Z),se=q.pathname,V=se&&se.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),G=V?Object(ue.f)(Z.pathname,{path:V,exact:F,sensitive:Q,strict:J}):null,be=!!(j?j(G,Z):G),Re=be?E(I,L):I,De=be?Object(k.a)({},ie,{},R):ie,Me=Object(k.a)({"aria-current":be&&T||null,className:Re,style:De,to:q},ye);return c!==u?Me.ref=i||ce:Me.innerRef=ce,_.a.createElement(t,Me)})});if(!1)var s},"746U":function(et,he,K){"use strict";K.d(he,"d",function(){return B}),K.d(he,"j",function(){return w}),K.d(he,"i",function(){return _}),K.d(he,"h",function(){return D}),K.d(he,"e",function(){return A}),K.d(he,"k",function(){return N}),K.d(he,"l",function(){return k}),K.d(he,"a",function(){return S}),K.d(he,"f",function(){return d}),K.d(he,"g",function(){return v}),K.d(he,"m",function(){return b}),K.d(he,"c",function(){return y}),K.d(he,"b",function(){return n}),K.d(he,"n",function(){return e}),K.d(he,"o",function(){return t});var ue={number:"number",string:"string",undefined:"undefined",object:"object",function:"function"};function B(r){return Array.isArray?Array.isArray(r):!!(r&&typeof r.length===ue.number&&r.constructor===Array)}function w(r){return typeof r===ue.string||r instanceof String}function _(r){return typeof r===ue.object&&r!==null&&!Array.isArray(r)&&!(r instanceof RegExp)&&!(r instanceof Date)}function D(r){return(typeof r===ue.number||r instanceof Number)&&!isNaN(r)}function A(r){return r===!0||r===!1}function N(r){return typeof r===ue.undefined}function k(r){return N(r)||r===null}function S(r,f){if(!r)throw new Error(f?"Unexpected type, expected '"+f+"'":"Unexpected type")}var C=Object.prototype.hasOwnProperty;function d(r){if(!_(r))return!1;for(var f in r)if(C.call(r,f))return!1;return!0}function v(r){return typeof r===ue.function}function b(r,f){for(var c=Math.min(r.length,f.length),u=0;u<c;u++)p(r[u],f[u])}function p(r,f){if(w(f)){if(typeof r!==f)throw new Error("argument does not match constraint: typeof "+f)}else if(v(f)){try{if(r instanceof f)return}catch(c){}if(!k(r)&&r.constructor===f)return;if(f.length===1&&f.call(void 0,r)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function m(r){for(var f=[],c=Object.getPrototypeOf(r);Object.prototype!==c;)f=f.concat(Object.getOwnPropertyNames(c)),c=Object.getPrototypeOf(c);return f}function y(r){for(var f=[],c=0,u=m(r);c<u.length;c++){var E=u[c];typeof r[E]=="function"&&f.push(E)}return f}function n(r,f){for(var c=function(a){return function(){var i=Array.prototype.slice.call(arguments,0);return f(a,i)}},u={},E=0,g=r;E<g.length;E++){var s=g[E];u[s]=c(s)}return u}function e(r){return r===null?void 0:r}function t(r){return typeof r=="undefined"?null:r}},"815F":function(et,he,K){"use strict";K.d(he,"e",function(){return N}),K.d(he,"c",function(){return S}),K.d(he,"d",function(){return C}),K.d(he,"a",function(){return v}),K.d(he,"f",function(){return b}),K.d(he,"b",function(){return p});var ue=K("KQm4"),B=K("VTBJ"),w=K("Ff2n"),_=K("Zm9Q"),D=K("Kwbf"),A=K("OZM5");function N(m,y){return m!=null?m:y}function k(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],y=new Map;function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(e||[]).forEach(function(r){var f=r.key,c=r.children;Object(D.a)(f!=null,"Tree node must have a certain key: [".concat(t).concat(f,"]"));var u=String(f);Object(D.a)(!y.has(u)||f===null||f===void 0,"Same 'key' exist in the Tree: ".concat(u)),y.set(u,!0),n(c,"".concat(t).concat(u," > "))})}n(m)}function S(m){function y(n){var e=Object(_.a)(n);return e.map(function(t){if(!Object(A.i)(t))return Object(D.a)(!t,"Tree/TreeNode can only accept TreeNode as children."),null;var r=t.key,f=t.props,c=f.children,u=Object(w.a)(f,["children"]),E=Object(B.a)({key:r},u),g=y(c);return g.length&&(E.children=g),E}).filter(function(t){return t})}return y(m)}function C(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=new Set(y===!0?[]:y),e=[];function t(r){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return r.map(function(c,u){var E=Object(A.h)(f?f.pos:"0",u),g=N(c.key,E),s=Object(B.a)(Object(B.a)({},c),{},{parent:f,pos:E,children:null,data:c,isStart:[].concat(Object(ue.a)(f?f.isStart:[]),[u===0]),isEnd:[].concat(Object(ue.a)(f?f.isEnd:[]),[u===r.length-1])});return e.push(s),y===!0||n.has(g)?s.children=t(c.children||[],s):s.children=[],s})}return t(m),e}function d(m,y,n){var e;n?typeof n=="string"?e=function(f){return f[n]}:typeof n=="function"&&(e=function(f){return n(f)}):e=function(f,c){return N(f.key,c)};function t(r,f,c){var u=r?r.children:m,E=r?Object(A.h)(c.pos,f):"0";if(r){var g=e(r,E),s={node:r,index:f,pos:E,key:g,parentPos:c.node?c.pos:null,level:c.level+1};y(s)}u&&u.forEach(function(a,i){t(a,i,{node:r,pos:E,level:c?c.level+1:-1})})}t(null)}function v(m){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=y.initWrapper,e=y.processEntity,t=y.onProcessFinished,r=arguments.length>2?arguments[2]:void 0,f={},c={},u={posEntities:f,keyEntities:c};return n&&(u=n(u)||u),d(m,function(E){var g=E.node,s=E.index,a=E.pos,i=E.key,l=E.parentPos,T=E.level,x={node:g,index:s,key:i,pos:a,level:T},L=N(i,a);f[a]=x,c[L]=x,x.parent=f[l],x.parent&&(x.parent.children=x.parent.children||[],x.parent.children.push(x)),e&&e(x,u)},r),t&&t(u),u}function b(m,y){var n=y.expandedKeys,e=y.selectedKeys,t=y.loadedKeys,r=y.loadingKeys,f=y.checkedKeys,c=y.halfCheckedKeys,u=y.dragOverNodeKey,E=y.dropPosition,g=y.keyEntities,s=g[m],a={eventKey:m,expanded:n.indexOf(m)!==-1,selected:e.indexOf(m)!==-1,loaded:t.indexOf(m)!==-1,loading:r.indexOf(m)!==-1,checked:f.indexOf(m)!==-1,halfChecked:c.indexOf(m)!==-1,pos:String(s?s.pos:""),dragOver:u===m&&E===0,dragOverGapTop:u===m&&E===-1,dragOverGapBottom:u===m&&E===1};return a}function p(m){var y=m.data,n=m.expanded,e=m.selected,t=m.checked,r=m.loaded,f=m.loading,c=m.halfChecked,u=m.dragOver,E=m.dragOverGapTop,g=m.dragOverGapBottom,s=m.pos,a=m.active,i=Object(B.a)(Object(B.a)({},y),{},{expanded:n,selected:e,checked:t,loaded:r,loading:f,halfChecked:c,dragOver:u,dragOverGapTop:E,dragOverGapBottom:g,pos:s,active:a});return"props"in i||Object.defineProperty(i,"props",{get:function(){return Object(D.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),m}}),i}},"8HAY":function(et,he,K){"use strict";K.d(he,"a",function(){return A}),K.d(he,"b",function(){return N});var ue=K("pmY6"),B=K("MI8n"),w=function(){var k=function(S,C){return k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,v){d.__proto__=v}||function(d,v){for(var b in v)v.hasOwnProperty(b)&&(d[b]=v[b])},k(S,C)};return function(S,C){k(S,C);function d(){this.constructor=S}S.prototype=C===null?Object.create(C):(d.prototype=C.prototype,new d)}}(),_=function(k,S,C,d){function v(b){return b instanceof C?b:new C(function(p){p(b)})}return new(C||(C=Promise))(function(b,p){function m(e){try{n(d.next(e))}catch(t){p(t)}}function y(e){try{n(d.throw(e))}catch(t){p(t)}}function n(e){e.done?b(e.value):v(e.value).then(m,y)}n((d=d.apply(k,S||[])).next())})},D=function(k,S){var C={label:0,sent:function(){if(b[0]&1)throw b[1];return b[1]},trys:[],ops:[]},d,v,b,p;return p={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function m(n){return function(e){return y([n,e])}}function y(n){if(d)throw new TypeError("Generator is already executing.");for(;C;)try{if(d=1,v&&(b=n[0]&2?v.return:n[0]?v.throw||((b=v.return)&&b.call(v),0):v.next)&&!(b=b.call(v,n[1])).done)return b;(v=0,b)&&(n=[n[0]&2,b.value]);switch(n[0]){case 0:case 1:b=n;break;case 4:return C.label++,{value:n[1],done:!1};case 5:C.label++,v=n[1],n=[0];continue;case 7:n=C.ops.pop(),C.trys.pop();continue;default:if(!(b=C.trys,b=b.length>0&&b[b.length-1])&&(n[0]===6||n[0]===2)){C=0;continue}if(n[0]===3&&(!b||n[1]>b[0]&&n[1]<b[3])){C.label=n[1];break}if(n[0]===6&&C.label<b[1]){C.label=b[1],b=n;break}if(b&&C.label<b[2]){C.label=b[2],C.ops.push(n);break}b[2]&&C.ops.pop(),C.trys.pop();continue}n=S.call(k,C)}catch(e){n=[6,e],v=0}finally{d=b=0}if(n[0]&5)throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}},A=function(k){w(S,k);function S(C,d,v,b,p){d===void 0&&(d=""),v===void 0&&(v=""),b===void 0&&(b=!0);var m=k.call(this)||this;return m._onDidChange=m._register(new B.a),m.onDidChange=m._onDidChange.event,m._enabled=!0,m._checked=!1,m._id=C,m._label=d,m._cssClass=v,m._enabled=b,m._actionCallback=p,m}return Object.defineProperty(S.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(S.prototype,"label",{get:function(){return this._label},set:function(C){this._setLabel(C)},enumerable:!0,configurable:!0}),S.prototype._setLabel=function(C){this._label!==C&&(this._label=C,this._onDidChange.fire({label:C}))},Object.defineProperty(S.prototype,"tooltip",{get:function(){return this._tooltip||""},set:function(C){this._setTooltip(C)},enumerable:!0,configurable:!0}),S.prototype._setTooltip=function(C){this._tooltip!==C&&(this._tooltip=C,this._onDidChange.fire({tooltip:C}))},Object.defineProperty(S.prototype,"class",{get:function(){return this._cssClass},set:function(C){this._setClass(C)},enumerable:!0,configurable:!0}),S.prototype._setClass=function(C){this._cssClass!==C&&(this._cssClass=C,this._onDidChange.fire({class:C}))},Object.defineProperty(S.prototype,"enabled",{get:function(){return this._enabled},set:function(C){this._setEnabled(C)},enumerable:!0,configurable:!0}),S.prototype._setEnabled=function(C){this._enabled!==C&&(this._enabled=C,this._onDidChange.fire({enabled:C}))},Object.defineProperty(S.prototype,"checked",{get:function(){return this._checked},set:function(C){this._setChecked(C)},enumerable:!0,configurable:!0}),S.prototype._setChecked=function(C){this._checked!==C&&(this._checked=C,this._onDidChange.fire({checked:C}))},S.prototype.run=function(C,d){return this._actionCallback?this._actionCallback(C):Promise.resolve(!0)},S}(ue.a),N=function(k){w(S,k);function S(){var C=k!==null&&k.apply(this,arguments)||this;return C._onDidBeforeRun=C._register(new B.a),C.onDidBeforeRun=C._onDidBeforeRun.event,C._onDidRun=C._register(new B.a),C.onDidRun=C._onDidRun.event,C}return S.prototype.run=function(C,d){return _(this,void 0,void 0,function(){var v,b;return D(this,function(p){switch(p.label){case 0:if(!C.enabled)return[2,Promise.resolve(null)];this._onDidBeforeRun.fire({action:C}),p.label=1;case 1:return p.trys.push([1,3,,4]),[4,this.runAction(C,d)];case 2:return v=p.sent(),this._onDidRun.fire({action:C,result:v}),[3,4];case 3:return b=p.sent(),this._onDidRun.fire({action:C,error:b}),[3,4];case 4:return[2]}})})},S.prototype.runAction=function(C,d){var v=d?C.run(d):C.run();return Promise.resolve(v)},S}(ue.a)},"8Jsi":function(et,he,K){"use strict";K.d(he,"d",function(){return l}),K.d(he,"a",function(){return De}),K.d(he,"b",function(){return X}),K.d(he,"c",function(){return Me});var ue=K("1OyB"),B=K("vuIU"),w=K("Ji7U"),_=K("LK+K"),D=K("KQm4"),A=K("U8pU"),N=K("ODXe"),k=K("VTBJ"),S=K("q1tI"),C=K("qNPg"),d=K("2Qr1"),v=K("815F"),b=K("NvD2"),p=K("wPlo"),m=K("6cGi"),y=K("Kwbf"),n=K("4IlW"),e=K("YrtM"),t=K("fAei"),r=S.createContext(null);function f(le,ge){if(!le)return!0;var Ee=le.data,Se=Ee.disabled,Ae=Ee.disableCheckbox;switch(ge){case"select":return Se;case"checkbox":return Se||Ae}return!1}function c(le,ge){var Ee=S.useCallback(function(Ae){var Le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"select",xe=arguments.length>2?arguments[2]:void 0,Oe=le.get(Ae);return!xe&&f(Oe,Le)?null:Oe},[le]),Se=S.useCallback(function(Ae){var Le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"select",xe=arguments.length>2?arguments[2]:void 0,Oe=ge.get(Ae);return!xe&&f(Oe,Le)?null:Oe},[ge]);return[Ee,Se]}function u(le){return S.useMemo(function(){var ge=new Map,Ee=new Map;return le.forEach(function(Se){ge.set(Se.key,Se),Ee.set(Se.data.value,Se)}),[ge,Ee]},[le])}var E={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},g=function(ge,Ee){var Se=ge.prefixCls,Ae=ge.height,Le=ge.itemHeight,xe=ge.virtual,Oe=ge.options,Ue=ge.flattenOptions,Te=ge.multiple,Ne=ge.searchValue,oe=ge.onSelect,re=ge.onToggleOpen,ae=ge.open,W=ge.notFoundContent,H=ge.onMouseEnter,Y=S.useContext(r),ee=Y.checkable,me=Y.checkedKeys,Ce=Y.halfCheckedKeys,Be=Y.treeExpandedKeys,Ge=Y.treeDefaultExpandAll,Qe=Y.treeDefaultExpandedKeys,Ve=Y.onTreeExpand,qe=Y.treeIcon,at=Y.showTreeIcon,Je=Y.switcherIcon,Ct=Y.treeLine,ht=Y.treeNodeFilterProp,Lt=Y.loadData,xt=Y.treeLoadedKeys,rt=Y.treeMotion,Dt=Y.onTreeLoad,At=S.useRef(),$e=Object(e.a)(function(){return Oe},[ae,Oe],function(We,Pe){return Pe[0]&&We[1]!==Pe[1]}),Xe=u(Ue),je=Object(N.a)(Xe,2),He=je[0],lt=je[1],ut=c(He,lt),ft=Object(N.a)(ut,2),nt=ft[0],tt=ft[1],Ze=S.useMemo(function(){return me.map(function(We){var Pe=tt(We);return Pe?Pe.key:null})},[me]),mt=S.useMemo(function(){return ee?{checked:Ze,halfChecked:Ce}:null},[Ze,Ce,ee]);S.useEffect(function(){if(ae&&!Te&&Ze.length){var We;(We=At.current)===null||We===void 0||We.scrollTo({key:Ze[0]})}},[ae]);var vt=String(Ne).toLowerCase(),dt=function(Pe){return vt?String(Pe[ht]).toLowerCase().includes(vt):!1},pt=S.useState(Qe),Tt=Object(N.a)(pt,2),It=Tt[0],gt=Tt[1],st=S.useState(null),it=Object(N.a)(st,2),ct=it[0],bt=it[1],Et=S.useMemo(function(){return Be?Object(D.a)(Be):Ne?ct:It},[It,ct,vt,Be]);S.useEffect(function(){Ne&&bt(Ue.map(function(We){return We.key}))},[Ne]);var P=function(Pe){gt(Pe),bt(Pe),Ve&&Ve(Pe)},o=function(Pe){Pe.preventDefault()},h=function(Pe,Ye){var ze=Ye.node.key,ot=nt(ze,ee?"checkbox":"select");ot!==null&&oe(ot.data.value,{selected:!me.includes(ot.data.value)}),Te||re(!1)},O=S.useState(null),U=Object(N.a)(O,2),M=U[0],ne=U[1],ke=nt(M);if(S.useImperativeHandle(Ee,function(){return{onKeyDown:function(Pe){var Ye,ze=Pe.which;switch(ze){case n.a.UP:case n.a.DOWN:case n.a.LEFT:case n.a.RIGHT:(Ye=At.current)===null||Ye===void 0||Ye.onKeyDown(Pe);break;case n.a.ENTER:{ke!==null&&h(null,{node:{key:M},selected:!me.includes(ke.data.value)});break}case n.a.ESC:re(!1)}},onKeyUp:function(){}}}),$e.length===0)return S.createElement("div",{role:"listbox",className:"".concat(Se,"-empty"),onMouseDown:o},W);var Ke={};return xt&&(Ke.loadedKeys=xt),Et&&(Ke.expandedKeys=Et),S.createElement("div",{onMouseDown:o,onMouseEnter:H},ke&&ae&&S.createElement("span",{style:E,"aria-live":"assertive"},ke.data.value),S.createElement(t.b,Object.assign({ref:At,focusable:!1,prefixCls:"".concat(Se,"-tree"),treeData:$e,height:Ae,itemHeight:Le,virtual:xe,multiple:Te,icon:qe,showIcon:at,switcherIcon:Je,showLine:Ct,loadData:Ne?null:Lt,motion:rt,checkable:ee,checkStrictly:!0,checkedKeys:mt,selectedKeys:ee?[]:Ze,defaultExpandAll:Ge},Ke,{onActiveChange:ne,onSelect:h,onCheck:h,onExpand:P,onLoad:Dt,filterTreeNode:dt})))},s=S.forwardRef(g);s.displayName="OptionList";var a=s,i=function(){return null},l=i,T=K("Ff2n"),x=K("Zm9Q");function L(le){return Object(x.a)(le).map(function(ge){if(!S.isValidElement(ge)||!ge.type)return null;var Ee=ge.key,Se=ge.props,Ae=Se.children,Le=Se.value,xe=Object(T.a)(Se,["children","value"]),Oe=Object(k.a)({key:Ee,value:Le},xe),Ue=L(Ae);return Ue.length&&(Oe.children=Ue),Oe}).filter(function(ge){return ge})}function R(le){if(!le)return le;var ge=Object(k.a)({},le);return"props"in ge||Object.defineProperty(ge,"props",{get:function(){return Object(y.a)(!1,"New `rc-tree-select` not support return node instance as argument anymore. Please consider to remove `props` access."),ge}}),ge}function I(le,ge,Ee,Se,Ae){var Le=null,xe=null;function Oe(){function Ue(Te){var Ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"0",oe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return Te.map(function(re,ae){var W="".concat(Ne,"-").concat(ae),H=Ee.includes(re.value),Y=Ue(re.children||[],W,H),ee=S.createElement(l,Object.assign({},re),Y.map(function(Ce){return Ce.node}));if(ge===re.value&&(Le=ee),H){var me={pos:W,node:ee,children:Y};return oe||xe.push(me),me}return null}).filter(function(re){return re})}xe||(xe=[],Ue(Se),xe.sort(function(Te,Ne){var oe=Te.node.props.value,re=Ne.node.props.value,ae=Ee.indexOf(oe),W=Ee.indexOf(re);return ae-W}))}Object.defineProperty(le,"triggerNode",{get:function(){return Object(y.a)(!1,"`triggerNode` is deprecated. Please consider decoupling data with node."),Oe(),Le}}),Object.defineProperty(le,"allCheckedNodes",{get:function(){return Object(y.a)(!1,"`allCheckedNodes` is deprecated. Please consider decoupling data with node."),Oe(),Ae?xe:xe.map(function(Te){var Ne=Te.node;return Ne})}})}function F(le){return Array.isArray(le)?le:le!==void 0?[le]:[]}function j(le,ge){var Ee=new Map;return ge.forEach(function(Se){var Ae=Se.data;Ee.set(Ae.value,Ae)}),le.map(function(Se){return R(Ee.get(Se))})}function z(le,ge){var Ee=j([le],ge)[0];return Ee?Ee.disabled:!1}function Q(le){return le.disabled||le.disableCheckbox||le.checkable===!1}function J(le){for(var ge=le.parent,Ee=0,Se=ge;Se;)Se=Se.parent,Ee+=1;return Ee}function ie(le){function ge(Se){return(Se||[]).map(function(Ae){var Le=Ae.value,xe=Ae.key,Oe=Ae.children,Ue=Object(k.a)(Object(k.a)({},Ae),{},{key:"key"in Ae?xe:Le});return Oe&&(Ue.children=ge(Oe)),Ue})}var Ee=Object(v.d)(ge(le),!0);return Ee.map(function(Se){return{key:Se.data.key,data:Se.data,level:J(Se)}})}function pe(le){return function(ge,Ee){var Se=Ee[le];return String(Se).toLowerCase().includes(String(ge).toLowerCase())}}function ce(le,ge,Ee){var Se=Ee.optionFilterProp,Ae=Ee.filterOption;if(Ae===!1)return ge;var Le;typeof Ae=="function"?Le=Ae:Le=pe(Se);function xe(Oe){var Ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Oe.map(function(Te){var Ne=Te.children,oe=Ue||Le(le,R(Te)),re=xe(Ne||[],oe);return oe||re.length?Object(k.a)(Object(k.a)({},Te),{},{children:re}):null}).filter(function(Te){return Te})}return xe(ge)}function ye(le,ge,Ee,Se){var Ae=new Map;return F(ge).forEach(function(Le){Le&&Object(A.a)(Le)==="object"&&"value"in Le&&Ae.set(Le.value,Le)}),le.map(function(Le){var xe={value:Le},Oe=Ee(Le,"select",!0),Ue=Oe?Se(Oe.data):Le;if(Ae.has(Le)){var Te=Ae.get(Le);xe.label="label"in Te?Te.label:Ue,"halfChecked"in Te&&(xe.halfChecked=Te.halfChecked)}else xe.label=Ue;return xe})}function ve(le,ge){var Ee=new Set(le);return Ee.add(ge),Array.from(Ee)}function Z(le,ge){var Ee=new Set(le);return Ee.delete(ge),Array.from(Ee)}function q(le){var ge=le.searchPlaceholder,Ee=le.treeCheckStrictly,Se=le.treeCheckable,Ae=le.labelInValue,Le=le.value,xe=le.multiple;Object(y.a)(!ge,"`searchPlaceholder` has been removed."),Ee&&Ae===!1&&Object(y.a)(!1,"`treeCheckStrictly` will force set `labelInValue` to `true`."),(Ae||Ee)&&Object(y.a)(F(Le).every(function(Oe){return Oe&&Object(A.a)(Oe)==="object"&&"value"in Oe}),"Invalid prop `value` supplied to `TreeSelect`. You should use { label: string, value: string | number } or [{ label: string, value: string | number }] instead."),Ee||xe||Se?Object(y.a)(!Le||Array.isArray(Le),"`value` should be an array when `TreeSelect` is checkable or multiple."):Object(y.a)(!Array.isArray(Le),"`value` should not be array when `TreeSelect` is single mode.")}var se=q,V=10;function G(le,ge){var Ee=ge.id,Se=ge.pId,Ae=ge.rootPId,Le={},xe=[],Oe=le.map(function(Ue){var Te=Object(k.a)({},Ue),Ne=Te[Ee];return Le[Ne]=Te,Te.key=Te.key||Ne,Te});return Oe.forEach(function(Ue){var Te=Ue[Se],Ne=Le[Te];Ne&&(Ne.children=Ne.children||[],Ne.children.push(Ue)),(Te===Ae||!Ne&&Ae===null)&&xe.push(Ue)}),xe}function be(le,ge){var Ee=0,Se=new Set;function Ae(Le){return(Le||[]).map(function(xe){var Oe=xe.key,Ue=xe.value,Te=xe.children,Ne=Object(T.a)(xe,["key","value","children"]),oe="value"in xe?Ue:Oe,re=Object(k.a)(Object(k.a)({},Ne),{},{key:Oe!=null?Oe:oe,value:oe,title:ge(xe)});return"children"in xe&&(re.children=Ae(Te)),re})}return Ae(le)}function Re(le,ge,Ee){var Se=Ee.getLabelProp,Ae=Ee.simpleMode,Le=S.useRef({});return le?(Le.current.formatTreeData=Le.current.treeData===le?Le.current.formatTreeData:be(Ae?G(le,Object(k.a)({id:"id",pId:"pId",rootPId:null},Ae!==!0?Ae:{})):le,Se),Le.current.treeData=le):Le.current.formatTreeData=Le.current.children===ge?Le.current.formatTreeData:be(L(ge),Se),Le.current.formatTreeData}var De="SHOW_ALL",Me="SHOW_PARENT",X="SHOW_CHILD";function $(le,ge,Ee){var Se=new Set(le);return ge===X?le.filter(function(Ae){var Le=Ee[Ae];return!(Le&&Le.children&&Le.children.every(function(xe){var Oe=xe.node;return Q(Oe)||Se.has(Oe.key)}))}):ge===Me?le.filter(function(Ae){var Le=Ee[Ae],xe=Le?Le.parent:null;return!(xe&&!Q(xe.node)&&Se.has(xe.node.key))}):le}function te(le,ge){var Ee=ge.value,Se=ge.getEntityByValue,Ae=ge.getEntityByKey,Le=ge.treeConduction,xe=ge.showCheckedStrategy,Oe=ge.conductKeyEntities,Ue=ge.getLabelProp;return S.useMemo(function(){var Te=le;if(Le){var Ne=$(le.map(function(oe){var re=Se(oe);return re?re.key:oe}),xe,Oe);Te=Ne.map(function(oe){var re=Ae(oe);return re?re.data.value:oe})}return ye(Te,Ee,Se,Ue)},[le,Ee,Le,xe,Se])}var de=["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(C.a)({prefixCls:"rc-tree-select",components:{optionList:a},convertChildrenToData:function(){return null},flattenOptions:ie,getLabeledValue:d.e,filterOptions:ce,isValueDisabled:z,findValueOption:j,omitDOMProps:function(ge){var Ee=Object(k.a)({},ge);return de.forEach(function(Se){delete Ee[Se]}),Ee}});fe.displayName="Select";var we=S.forwardRef(function(le,ge){var Ee=le.multiple,Se=le.treeCheckable,Ae=le.treeCheckStrictly,Le=le.showCheckedStrategy,xe=Le===void 0?"SHOW_CHILD":Le,Oe=le.labelInValue,Ue=le.loadData,Te=le.treeLoadedKeys,Ne=le.treeNodeFilterProp,oe=Ne===void 0?"value":Ne,re=le.treeNodeLabelProp,ae=le.treeDataSimpleMode,W=le.treeData,H=le.treeExpandedKeys,Y=le.treeDefaultExpandedKeys,ee=le.treeDefaultExpandAll,me=le.children,Ce=le.treeIcon,Be=le.showTreeIcon,Ge=le.switcherIcon,Qe=le.treeLine,Ve=le.treeMotion,qe=le.filterTreeNode,at=le.dropdownPopupAlign,Je=le.onChange,Ct=le.onTreeExpand,ht=le.onTreeLoad,Lt=le.onDropdownVisibleChange,xt=le.onSelect,rt=le.onDeselect,Dt=Se||Ae,At=Ee||Dt,$e=Se&&!Ae,Xe=Ae||Oe,je=S.useRef(null);S.useImperativeHandle(ge,function(){return{focus:je.current.focus,blur:je.current.blur}});var He=function(ze){return W&&ze.label||ze.title},lt=function(ze){return re?ze[re]:He(ze)},ut=Re(W,me,{getLabelProp:He,simpleMode:ae}),ft=Object(S.useMemo)(function(){return ie(ut)},[ut]),nt=u(ft),tt=Object(N.a)(nt,2),Ze=tt[0],mt=tt[1],vt=c(Ze,mt),dt=Object(N.a)(vt,2),pt=dt[0],Tt=dt[1],It=Object(S.useMemo)(function(){return $e?Object(v.a)(ut):{keyEntities:null}},[ut,Se,Ae]),gt=It.keyEntities,st=Object(m.a)(le.defaultValue,{value:le.value}),it=Object(N.a)(st,2),ct=it[0],bt=it[1],Et=function(ze){var ot=[],Pt=[];return ze.forEach(function(Rt){Tt(Rt)?Pt.push(Rt):ot.push(Rt)}),{missingRawValues:ot,existRawValues:Pt}},P=Object(S.useMemo)(function(){var Ye=[],ze=[];if(F(ct).forEach(function(wt){if(wt&&Object(A.a)(wt)==="object"&&"value"in wt)if(wt.halfChecked&&Ae){var _t=Tt(wt.value);Ye.push(_t?_t.key:wt.value)}else ze.push(wt.value);else ze.push(wt)}),$e){var ot=Et(ze),Pt=ot.missingRawValues,Rt=ot.existRawValues,Ot=Rt.map(function(wt){return Tt(wt).key}),kt=Object(b.a)(Ot,!0,gt),Gt=kt.checkedKeys,Kt=kt.halfCheckedKeys;return[[].concat(Object(D.a)(Pt),Object(D.a)(Gt.map(function(wt){return pt(wt).data.value}))),Kt]}return[ze,Ye]},[ct,At,Xe,Se,Ae]),o=Object(N.a)(P,2),h=o[0],O=o[1],U=te(h,{treeConduction:$e,value:ct,showCheckedStrategy:xe,conductKeyEntities:gt,getEntityByValue:Tt,getEntityByKey:pt,getLabelProp:lt}),M=function(ze,ot,Pt){if(bt(At?ze:ze[0]),Je){var Rt=ze;if($e&&xe!=="SHOW_ALL"){var Ot=ze.map(function(Nt){var jt=Tt(Nt);return jt?jt.key:Nt}),kt=$(Ot,xe,gt);Rt=kt.map(function(Nt){var jt=pt(Nt);return jt?jt.data.value:Nt})}var Gt=ot||{triggerValue:void 0,selected:void 0},Kt=Gt.triggerValue,wt=Gt.selected,_t=Xe?ye(Rt,ct,Tt,lt):Rt;if(Ae){var zt=O.map(function(Nt){var jt=pt(Nt);return jt?jt.data.value:Nt}).filter(function(Nt){return!Rt.includes(Nt)});_t=[].concat(Object(D.a)(_t),Object(D.a)(ye(zt,ct,Tt,lt)))}var Bt={preValue:U,triggerValue:Kt},Xt=!0;(Ae||Pt==="selection"&&!wt)&&(Xt=!1),I(Bt,Kt,ze,ut,Xt),Dt?Bt.checked=wt:Bt.selected=wt,Je(At?_t:_t[0],Xe?null:Rt.map(function(Nt){var jt=Tt(Nt);return jt?lt(jt.data):null}),Bt)}},ne=function(ze,ot,Pt){var Rt=ze;if(!At)M([ze],{selected:!0,triggerValue:ze},Pt);else{var Ot=ve(h,ze);if($e){var kt=Et(Ot),Gt=kt.missingRawValues,Kt=kt.existRawValues,wt=Kt.map(function(Bt){return Tt(Bt).key}),_t=Object(b.a)(wt,!0,gt),zt=_t.checkedKeys;Ot=[].concat(Object(D.a)(Gt),Object(D.a)(zt.map(function(Bt){return pt(Bt).data.value})))}M(Ot,{selected:!0,triggerValue:ze},Pt)}xt&&xt(Rt,ot)},ke=function(ze,ot,Pt){var Rt=ze,Ot=Z(h,ze);if($e){var kt=Et(Ot),Gt=kt.missingRawValues,Kt=kt.existRawValues,wt=Kt.map(function(Bt){return Tt(Bt).key}),_t=Object(b.a)(wt,{checked:!1,halfCheckedKeys:O},gt),zt=_t.checkedKeys;Ot=[].concat(Object(D.a)(Gt),Object(D.a)(zt.map(function(Bt){return pt(Bt).data.value})))}M(Ot,{selected:!1,triggerValue:ze},Pt),rt&&rt(Rt,ot)},Ke=function(){M([],null,"clear")},We=S.useCallback(function(Ye){if(Lt){var ze={};Object.defineProperty(ze,"documentClickClose",{get:function(){return Object(y.a)(!1,"Second param of `onDropdownVisibleChange` has been removed."),!1}}),Lt(Ye,ze)}},[Lt]),Pe={optionLabelProp:null,optionFilterProp:oe,dropdownAlign:at,internalProps:{mark:p.a,onClear:Ke,skipTriggerChange:!0,skipTriggerSelect:!0,onRawSelect:ne,onRawDeselect:ke}};return"filterTreeNode"in le&&(Pe.filterOption=qe),S.createElement(r.Provider,{value:{checkable:Dt,loadData:Ue,treeLoadedKeys:Te,onTreeLoad:ht,checkedKeys:h,halfCheckedKeys:O,treeDefaultExpandAll:ee,treeExpandedKeys:H,treeDefaultExpandedKeys:Y,onTreeExpand:Ct,treeIcon:Ce,treeMotion:Ve,showTreeIcon:Be,switcherIcon:Ge,treeLine:Qe,treeNodeFilterProp:oe}},S.createElement(fe,Object.assign({ref:je,mode:At?"multiple":null},le,Pe,{value:U,labelInValue:!0,options:ut,onChange:null,onSelect:null,onDeselect:null,onDropdownVisibleChange:We})))}),Ie=function(le){Object(w.a)(Ee,le);var ge=Object(_.a)(Ee);function Ee(){var Se;return Object(ue.a)(this,Ee),Se=ge.apply(this,arguments),Se.selectRef=S.createRef(),Se.focus=function(){Se.selectRef.current.focus()},Se.blur=function(){Se.selectRef.current.blur()},Se}return Object(B.a)(Ee,[{key:"render",value:function(){return S.createElement(we,Object.assign({ref:this.selectRef},this.props))}}]),Ee}(S.Component);Ie.TreeNode=l,Ie.SHOW_ALL=De,Ie.SHOW_PARENT=Me,Ie.SHOW_CHILD=X;var _e=Ie,Fe=he.e=_e},"8hTe":function(et,he,K){et.exports={button:"button___1wy9m"}},"9Bee":function(et,he,K){"use strict";var ue=K("DYRE"),B=K("zeV3"),w=K("+L6B"),_=K("2/Rp"),D=K("k1fw"),A=K("9og8"),N=K("tJVT"),k=K("WmNS"),S=K.n(k),C=K("q1tI"),d=K.n(C),v=K("vg9a"),b=K("DlQD"),p=K.n(b),m=K("rUJ1");function y(P,o){var h=P.match(/^(\s+)(?:```)/);if(h===null)return o;var O=h[1];return o.split(`
`).map(function(U){var M=U.match(/^\s+/);if(M===null)return U;var ne=Object(N.a)(M,1),ke=ne[0];return ke.length>=O.length?U.slice(O.length):U}).join(`
`)}var n=[],e=["<ul>"],t=new p.a.Renderer,r=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function f(){n.length=0,e=["<ul>"]}var c={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function u(P,o,h,O){if(o>=P.length||P[o].level<=h)return o;var U=P[o];O.push("<li><a href='#"+U.anchor+"'>"+U.text+"</a>"),o++;var M=[];return o=u(P,o,U.level,M),M.length>0&&(O.push("<ul>"),M.forEach(function(ne){O.push(ne)}),O.push("</ul>")),O.push("</li>"),o=u(P,o,h,O),o}function E(){return u(n,0,0,e),e.push("</ul>"),e.join("")}var g={heading:function(o){var h=r.exec(o);if(h)return{type:"heading",raw:h[0],depth:h[1].length,text:h[2]}},fences:function(o){var h=this.rules.block.fences.exec(o);if(h){var O=h[0],U=y(O,h[3]||""),M=h[2]?h[2].trim():h[2];if(["latex","katex","math"].indexOf(M)>=0){var ne=i(),ke=U;U=ne,l[ne]={type:"block",expression:ke}}return{type:"code",raw:O,lang:M,text:U}}}},s=/(?:\${2})([^\n`]+?)(?:\${2})/gi,a=0,i=function(){return"__special_katext_id_".concat(a++,"__")},l={};function T(){return l}function x(){a=0,l={}}function L(P){return P=P.replace(s,function(o,h){var O=i();return l[O]={type:"inline",expression:h},O}),P}var R=t.listitem;t.listitem=function(P){return R(L(P))};var I=t.paragraph;t.paragraph=function(P){return I(L(P))};var F=t.tablecell;t.tablecell=function(P,o){return F(L(P),o)},t.code=function(P,o,h){var O=(o||"").match(/\S*/)[0];return O?["latex","katex","math"].indexOf(O)>=0?"<p class='editormd-tex'>".concat(P,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(o,'">').concat(h?P:Object(m.escape)(P,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(h?P:Object(m.escape)(P,!0))+"</code></pre>"},t.heading=function(P,o,h){var O=this.options.headerPrefix+h.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return n.push({anchor:O,level:o,text:P}),"<h"+o+' id="'+O+'">'+P+"</h"+o+">"},p.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),p.a.use({tokenizer:g,renderer:t});var j=p.a,z=K("SJMd"),Q=K("ulZh"),J=K.n(Q),ie=K("m3rI"),pe=K("Oy/b"),ce=K("p5ED"),ye=K("ErOA");/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var ve=function(P,o){return(ve=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,O){h.__proto__=O}||function(h,O){for(var U in O)Object.prototype.hasOwnProperty.call(O,U)&&(h[U]=O[U])})(P,o)};function Z(P,o){function h(){this.constructor=P}ve(P,o),P.prototype=o===null?Object.create(o):(h.prototype=o.prototype,new h)}function q(P,o,h,O){return new(h||(h=Promise))(function(U,M){function ne(We){try{Ke(O.next(We))}catch(Pe){M(Pe)}}function ke(We){try{Ke(O.throw(We))}catch(Pe){M(Pe)}}function Ke(We){var Pe;We.done?U(We.value):(Pe=We.value,Pe instanceof h?Pe:new h(function(Ye){Ye(Pe)})).then(ne,ke)}Ke((O=O.apply(P,o||[])).next())})}function se(P,o){var h,O,U,M,ne={label:0,sent:function(){if(1&U[0])throw U[1];return U[1]},trys:[],ops:[]};return M={next:ke(0),throw:ke(1),return:ke(2)},typeof Symbol=="function"&&(M[Symbol.iterator]=function(){return this}),M;function ke(Ke){return function(We){return function(Pe){if(h)throw new TypeError("Generator is already executing.");for(;ne;)try{if(h=1,O&&(U=2&Pe[0]?O.return:Pe[0]?O.throw||((U=O.return)&&U.call(O),0):O.next)&&!(U=U.call(O,Pe[1])).done)return U;switch(O=0,U&&(Pe=[2&Pe[0],U.value]),Pe[0]){case 0:case 1:U=Pe;break;case 4:return ne.label++,{value:Pe[1],done:!1};case 5:ne.label++,O=Pe[1],Pe=[0];continue;case 7:Pe=ne.ops.pop(),ne.trys.pop();continue;default:if(!(U=ne.trys,(U=U.length>0&&U[U.length-1])||Pe[0]!==6&&Pe[0]!==2)){ne=0;continue}if(Pe[0]===3&&(!U||Pe[1]>U[0]&&Pe[1]<U[3])){ne.label=Pe[1];break}if(Pe[0]===6&&ne.label<U[1]){ne.label=U[1],U=Pe;break}if(U&&ne.label<U[2]){ne.label=U[2],ne.ops.push(Pe);break}U[2]&&ne.ops.pop(),ne.trys.pop();continue}Pe=o.call(P,ne)}catch(Ye){Pe=[6,Ye],O=0}finally{h=U=0}if(5&Pe[0])throw Pe[1];return{value:Pe[0]?Pe[1]:void 0,done:!0}}([Ke,We])}}}function V(){for(var P=0,o=0,h=arguments.length;o<h;o++)P+=arguments[o].length;var O=Array(P),U=0;for(o=0;o<h;o++)for(var M=arguments[o],ne=0,ke=M.length;ne<ke;ne++,U++)O[U]=M[ne];return O}var G=function(){function P(){}return P.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},P.setAttributes=function(o,h){for(var O=0,U=h;O<U.length;O++){var M=U[O],ne=M[0],ke=M[1];o.setAttribute(ne,ke)}},P.createRect=function(o,h,O){var U=document.createElementNS("http://www.w3.org/2000/svg","rect");return U.setAttribute("width",o.toString()),U.setAttribute("height",h.toString()),O&&P.setAttributes(U,O),U},P.createLine=function(o,h,O,U,M){var ne=document.createElementNS("http://www.w3.org/2000/svg","line");return ne.setAttribute("x1",o.toString()),ne.setAttribute("y1",h.toString()),ne.setAttribute("x2",O.toString()),ne.setAttribute("y2",U.toString()),M&&P.setAttributes(ne,M),ne},P.createPolygon=function(o,h){var O=document.createElementNS("http://www.w3.org/2000/svg","polygon");return O.setAttribute("points",o),h&&P.setAttributes(O,h),O},P.createCircle=function(o,h){var O=document.createElementNS("http://www.w3.org/2000/svg","circle");return O.setAttribute("cx",(o/2).toString()),O.setAttribute("cy",(o/2).toString()),O.setAttribute("r",o.toString()),h&&P.setAttributes(O,h),O},P.createEllipse=function(o,h,O){var U=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return U.setAttribute("cx",(o/2).toString()),U.setAttribute("cy",(h/2).toString()),U.setAttribute("rx",(o/2).toString()),U.setAttribute("ry",(h/2).toString()),O&&P.setAttributes(U,O),U},P.createGroup=function(o){var h=document.createElementNS("http://www.w3.org/2000/svg","g");return o&&P.setAttributes(h,o),h},P.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},P.createMarker=function(o,h,O,U,M,ne,ke){var Ke=document.createElementNS("http://www.w3.org/2000/svg","marker");return P.setAttributes(Ke,[["id",o],["orient",h],["markerWidth",O.toString()],["markerHeight",U.toString()],["refX",M.toString()],["refY",ne.toString()]]),Ke.appendChild(ke),Ke},P.createText=function(o){var h=document.createElementNS("http://www.w3.org/2000/svg","text");return h.setAttribute("x","0"),h.setAttribute("y","0"),o&&P.setAttributes(h,o),h},P.createTSpan=function(o,h){var O=document.createElementNS("http://www.w3.org/2000/svg","tspan");return O.textContent=o,h&&P.setAttributes(O,h),O},P.createImage=function(o){var h=document.createElementNS("http://www.w3.org/2000/svg","image");return o&&P.setAttributes(h,o),h},P.createPoint=function(o,h){var O=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return O.x=o,O.y=h,O},P.createPath=function(o,h){var O=document.createElementNS("http://www.w3.org/2000/svg","path");return O.setAttribute("d",o),h&&P.setAttributes(O,h),O},P}(),be=function(){function P(){}return P.addKey=function(o){P.key=o},Object.defineProperty(P,"isLicensed",{get:function(){return!!P.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(P.key)},enumerable:!1,configurable:!0}),P}(),Re=function(){function P(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return P.prototype.rasterize=function(o,h,O){var U=this;return new Promise(function(M){var ne=O!==void 0?O:document.createElement("canvas");o===null&&(U.markersOnly=!0,U.naturalSize=!1);var ke=document.createElementNS("http://www.w3.org/2000/svg","svg");ke.setAttribute("xmlns","http://www.w3.org/2000/svg"),ke.setAttribute("width",h.width.baseVal.valueAsString),ke.setAttribute("height",h.height.baseVal.valueAsString),ke.setAttribute("viewBox","0 0 "+h.viewBox.baseVal.width.toString()+" "+h.viewBox.baseVal.height.toString()),ke.innerHTML=h.innerHTML,U.naturalSize===!0?(ke.width.baseVal.value=o.naturalWidth,ke.height.baseVal.value=o.naturalHeight):U.width!==void 0&&U.height!==void 0&&(ke.width.baseVal.value=U.width,ke.height.baseVal.value=U.height),ne.width=ke.width.baseVal.value,ne.height=ke.height.baseVal.value;var Ke=ke.outerHTML,We=ne.getContext("2d");U.markersOnly!==!0&&We.drawImage(o,0,0,ne.width,ne.height);var Pe=window.URL,Ye=new Image(ne.width,ne.height);Ye.setAttribute("crossOrigin","anonymous");var ze=new Blob([Ke],{type:"image/svg+xml"}),ot=Pe.createObjectURL(ze);Ye.onload=function(){We.drawImage(Ye,0,0),Pe.revokeObjectURL(ot);var Pt=ne.toDataURL(U.imageType,U.imageQuality);M(Pt)},Ye.src=ot})},P}(),De=function(){},Me=function(){function P(o){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+o+"_"}return Object.defineProperty(P.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(P.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(P.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),P.prototype.addClass=function(o){return this.styleSheet===void 0&&this.addStyleSheet(),o.name=""+this.classNamePrefix+o.localName,this.classes.push(o),this.styleSheet.sheet.insertRule("."+o.name+" {"+o.style+"}",this.styleSheet.sheet.cssRules.length),o},P.prototype.addRule=function(o){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(o),this.styleSheet.sheet.insertRule(o.selector+" {"+o.style+"}",this.styleSheet.sheet.cssRules.length)},P.prototype.addStyleSheet=function(){var o;this.styleSheet=document.createElement("style"),((o=this.styleSheetRoot)!==null&&o!==void 0?o:document.head).appendChild(this.styleSheet),this.addRule(new X("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new X("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new X("@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;
`))},P.prototype.removeStyleSheet=function(){var o;this.styleSheet&&(((o=this.styleSheetRoot)!==null&&o!==void 0?o:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},P}(),X=function(P,o){this.selector=P,this.style=o},$=function(P,o){this.localName=P,this.style=o},te=function(){function P(o,h,O,U,M){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=o,this.displayMode=h,this.markerItems=O,this.uiStyleSettings=U,this.styles=M,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return P.prototype.show=function(o){var h=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=o,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var O=document.createElement("div");O.className=this.toolbarBlockStyleClass.name,O.style.whiteSpace="nowrap",this.uiContainer.appendChild(O),this.addActionButton(O,'<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(O,'<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(O,'<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(O,'<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(O,'<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(O,'<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(O,'<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(O,'<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(M){var ne=document.createElement("div");ne.className=""+h.toolbarButtonStyleClass.name,ne.setAttribute("data-type-name",M.typeName),ne.innerHTML=M.icon,ne.addEventListener("click",function(){h.markerToolbarButtonClicked(ne,M)}),h.buttons.push(ne),h.markerButtons.push(ne)}),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 U=document.createElement("div");U.className=this.toolbarBlockStyleClass.name,U.style.whiteSpace="nowrap",U.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(U),this.addActionButton(U,'<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(U,'<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()},P.prototype.addButtonClickListener=function(o){this.buttonClickListeners.push(o)},P.prototype.removeButtonClickListener=function(o){this.buttonClickListeners.indexOf(o)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(o),1)},P.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},P.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var o=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var h=0;h<this.markerButtons.length;h++)h<o||h===o&&this.markerButtons.length-1===o?this.markerButtonBlock.appendChild(this.markerButtons[h]):(h===o&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[h]))}},P.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")},P.prototype.resetButtonStyles=function(){var o=this;this.buttons.forEach(function(h){h.className=h.className.replace(o.uiStyleSettings.toolbarButtonStyleColorsClassName?o.uiStyleSettings.toolbarButtonStyleColorsClassName:o.toolbarButtonStyleColorsClass.name,"").trim(),h.className=h.className.replace(o.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?o.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:o.toolbarActiveButtonStyleColorsClass.name,"").trim(),h.className+=" "+(o.uiStyleSettings.toolbarButtonStyleColorsClassName?o.uiStyleSettings.toolbarButtonStyleColorsClassName:o.toolbarButtonStyleColorsClass.name)})},P.prototype.addActionButton=function(o,h,O){var U=this,M=document.createElement("div");switch(M.className=""+this.toolbarButtonStyleClass.name,M.innerHTML=h,M.setAttribute("data-action",O),M.addEventListener("click",function(){U.actionToolbarButtonClicked(M,O)}),O){case"select":M.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":M.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":M.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":M.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":M.style.fill=this.uiStyleSettings.closeButtonColor}o.appendChild(M),this.buttons.push(M)},P.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new $("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 $("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new $("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new $("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 $("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var o=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new $("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*o)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*o)+`px;
padding: `+o+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new $("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new $("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new X("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new X("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},P.prototype.markerToolbarButtonClicked=function(o,h){this.setActiveButton(o),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(O){return O("marker",h)}),this.markerButtonOverflowBlock.style.display="none"},P.prototype.actionToolbarButtonClicked=function(o,h){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(O){return O("action",h)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},P.prototype.setActiveButton=function(o){this.resetButtonStyles(),o.className=o.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),o.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},P.prototype.setActiveMarkerButton=function(o){var h=this.markerButtons.find(function(O){return O.getAttribute("data-type-name")===o});h&&this.setActiveButton(h)},P.prototype.setCurrentMarker=function(o){var h=this;this.currentMarker=o,this.buttons.filter(function(O){return/delete|notes/.test(O.getAttribute("data-action"))}).forEach(function(O){h.currentMarker===void 0?(O.style.fillOpacity="0.4",O.style.pointerEvents="none"):(O.style.fillOpacity="1",O.style.pointerEvents="all")})},P}(),de=function(){function P(o,h,O,U){this.panels=[],this.panelButtons=[],this.markerjsContainer=o,this.displayMode=h,this.uiStyleSettings=O,this.styles=U,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return P.prototype.addStyles=function(){var o;this.toolboxStyleClass=this.styles.addClass(new $("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 $("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var h=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new $("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new $("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new $("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 $("toolbox-panel-row_colors",`
background-color: `+((o=this.uiStyleSettings.toolboxBackgroundColor)!==null&&o!==void 0?o:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new $("toolbox_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.toolboxButtonStyleColorsClass=this.styles.addClass(new $("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new $("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new X("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new X("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},P.prototype.show=function(o){var h;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=o,this.uiContainer.className=this.toolboxStyleClass.name+" "+((h=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&h!==void 0?h:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},P.prototype.setPanelButtons=function(o){var h,O,U=this;this.panels=o,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((h=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&h!==void 0?h:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((O=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&O!==void 0?O:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(M){var ne;M.uiStyleSettings=U.uiStyleSettings;var ke=document.createElement("div");ke.className=U.toolboxButtonStyleClass.name+" "+((ne=U.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ne!==void 0?ne:U.toolboxButtonStyleColorsClass.name),ke.innerHTML=M.icon,ke.title=M.title,ke.addEventListener("click",function(){U.panelButtonClick(M)}),U.panelButtons.push(ke),U.buttonRow.appendChild(ke)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},P.prototype.panelButtonClick=function(o){var h=this,O=-1;if(o!==this.activePanel){O=this.panels.indexOf(o),this.panelRow.innerHTML="";var U=o.getUi();U.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(U),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=o}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){h.displayMode==="inline"?h.panelRow.style.display="none":h.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(M,ne){var ke,Ke;M.className=h.toolboxButtonStyleClass.name+" "+(ne===O?""+((ke=h.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&ke!==void 0?ke:h.toolboxActiveButtonStyleColorsClass.name):""+((Ke=h.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Ke!==void 0?Ke:h.toolboxButtonStyleColorsClass.name))})},P}(),fe=function(P,o){this.title=P,this.icon=o},we=function(P){function o(h,O,U,M){var ne=P.call(this,h,M||'<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 ne.colors=[],ne.addTransparent=!1,ne.colorBoxes=[],ne.colors=O,ne.currentColor=U,ne.setCurrentColor=ne.setCurrentColor.bind(ne),ne.getColorBox=ne.getColorBox.bind(ne),ne}return Z(o,P),o.prototype.getUi=function(){var h=this,O=document.createElement("div");return O.style.overflow="hidden",O.style.whiteSpace="nowrap",this.colors.forEach(function(U){var M=h.getColorBox(U);O.appendChild(M),h.colorBoxes.push(M)}),O},o.prototype.getColorBox=function(h){var O=this,U=this.uiStyleSettings.toolbarHeight/4,M=this.uiStyleSettings.toolbarHeight-U,ne=document.createElement("div");ne.style.display="inline-block",ne.style.boxSizing="content-box",ne.style.width=M-2+"px",ne.style.height=M-2+"px",ne.style.padding="1px",ne.style.marginRight="2px",ne.style.marginBottom="2px",ne.style.borderWidth="2px",ne.style.borderStyle="solid",ne.style.borderRadius=(M+2)/2+"px",ne.style.borderColor=h===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ne.addEventListener("click",function(){O.setCurrentColor(h,ne)});var ke=document.createElement("div");return ke.style.display="inline-block",ke.style.width=M-2+"px",ke.style.height=M-2+"px",ke.style.backgroundColor=h,ke.style.borderRadius=M/2+"px",h==="transparent"&&(ke.style.fill=this.uiStyleSettings.toolboxAccentColor,ke.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>`),ne.appendChild(ke),ne},o.prototype.setCurrentColor=function(h,O){var U=this;this.currentColor=h,this.colorBoxes.forEach(function(M){M.style.borderColor=M===O?U.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(h)},o}(fe),Ie=function(){function P(o,h,O){this._state="new",this._isSelected=!1,this._container=o,this._overlayContainer=h,this.globalSettings=O,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(P.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),P.prototype.ownsTarget=function(o){return!1},Object.defineProperty(P.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),P.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},P.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},P.prototype.pointerDown=function(o,h){},P.prototype.dblClick=function(o,h){},P.prototype.manipulate=function(o){},P.prototype.pointerUp=function(o){this.stateChanged()},P.prototype.dispose=function(){},P.prototype.addMarkerVisualToContainer=function(o){this.container.childNodes.length>0?this.container.insertBefore(o,this.container.childNodes[0]):this.container.appendChild(o)},P.prototype.getState=function(){return{typeName:P.typeName,state:this.state,notes:this.notes}},P.prototype.restoreState=function(o){this._state=o.state,this.notes=o.notes},P.prototype.scale=function(o,h){},P.prototype.colorChanged=function(o){this.onColorChanged&&this.onColorChanged(o),this.stateChanged()},P.prototype.fillColorChanged=function(o){this.onFillColorChanged&&this.onFillColorChanged(o),this.stateChanged()},P.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var o=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),o.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(o)&&this.onStateChanged(this)}},P.typeName="MarkerBase",P}(),_e=function(){function P(){this.findGripByVisual=this.findGripByVisual.bind(this)}return P.prototype.findGripByVisual=function(o){return this.topLeft.ownsTarget(o)?this.topLeft:this.topCenter.ownsTarget(o)?this.topCenter:this.topRight.ownsTarget(o)?this.topRight:this.centerLeft.ownsTarget(o)?this.centerLeft:this.centerRight.ownsTarget(o)?this.centerRight:this.bottomLeft.ownsTarget(o)?this.bottomLeft:this.bottomCenter.ownsTarget(o)?this.bottomCenter:this.bottomRight.ownsTarget(o)?this.bottomRight:void 0},P}(),Fe=function(){function P(){this.GRIP_SIZE=10,this.visual=G.createGroup(),this.visual.appendChild(G.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(G.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return P.prototype.ownsTarget=function(o){return o===this.visual||o===this.visual.childNodes[0]||o===this.visual.childNodes[1]},P}(),le=function(){function P(){}return P.toITransformMatrix=function(o){return{a:o.a,b:o.b,c:o.c,d:o.d,e:o.e,f:o.f}},P.toSVGMatrix=function(o,h){return o.a=h.a,o.b=h.b,o.c=h.c,o.d=h.d,o.e=h.e,o.f=h.f,o},P}(),ge=function(P){function o(h,O,U){var M=P.call(this,h,O,U)||this;return M.left=0,M.top=0,M.width=0,M.height=0,M.defaultSize={x:50,y:20},M.offsetX=0,M.offsetY=0,M.rotationAngle=0,M.CB_DISTANCE=10,M._suppressMarkerCreateEvent=!1,M.container.transform.baseVal.appendItem(G.createTransform()),M.setupControlBox(),M}return Z(o,P),Object.defineProperty(o.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"visual",{get:function(){return this._visual},set:function(h){this._visual=h;var O=G.createTransform();this._visual.transform.baseVal.appendItem(O)},enumerable:!1,configurable:!0}),o.prototype.ownsTarget=function(h){return!!P.prototype.ownsTarget.call(this,h)||!!(this.controlGrips.findGripByVisual(h)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(h))},o.prototype.pointerDown=function(h,O){P.prototype.pointerDown.call(this,h,O),this.state==="new"&&(this.left=h.x,this.top=h.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var U=this.unrotatePoint(h);if(this.manipulationStartX=U.x,this.manipulationStartY=U.y,this.offsetX=U.x-this.left,this.offsetY=U.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(O),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(O)){this.activeGrip=this.rotatorGrip;var M=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=M.x-this.width/2,this.top=M.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ne=this.container.transform.baseVal.getItem(0);ne.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ne,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},o.prototype.pointerUp=function(h){var O=this.state;P.prototype.pointerUp.call(this,h),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(h),this._state="select",O==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},o.prototype.moveVisual=function(h){this.visual.style.transform="translate("+h.x+"px, "+h.y+"px)"},o.prototype.manipulate=function(h){var O=this.unrotatePoint(h);this.state==="creating"?this.resize(h):this.state==="move"?(this.left=this.manipulationStartLeft+(O.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(O.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(O):this.state==="rotate"&&this.rotate(h)},o.prototype.resize=function(h){var O=this.manipulationStartLeft,U=this.manipulationStartWidth,M=this.manipulationStartTop,ne=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:O=this.manipulationStartLeft+h.x-this.manipulationStartX,U=this.manipulationStartWidth+this.manipulationStartLeft-O;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:U=this.manipulationStartWidth+h.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:M=this.manipulationStartTop+h.y-this.manipulationStartY,ne=this.manipulationStartHeight+this.manipulationStartTop-M;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ne=this.manipulationStartHeight+h.y-this.manipulationStartY}U>=0?(this.left=O,this.width=U):(this.left=O+U,this.width=-U),ne>=0?(this.top=M,this.height=ne):(this.top=M+ne,this.height=-ne),this.setSize()},o.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},o.prototype.rotate=function(h){if(Math.abs(h.x-this.centerX)>.1){var O=Math.sign(h.x-this.centerX);this.rotationAngle=180*Math.atan((h.y-this.centerY)/(h.x-this.centerX))/Math.PI+90*O,this.applyRotation()}},o.prototype.applyRotation=function(){var h=this.container.transform.baseVal.getItem(0);h.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(h,0)},o.prototype.rotatePoint=function(h){if(this.rotationAngle===0)return h;var O=this.container.getCTM(),U=G.createPoint(h.x,h.y);return{x:(U=U.matrixTransform(O)).x,y:U.y}},o.prototype.unrotatePoint=function(h){if(this.rotationAngle===0)return h;var O=this.container.getCTM();O=O.inverse();var U=G.createPoint(h.x,h.y);return{x:(U=U.matrixTransform(O)).x,y:U.y}},o.prototype.select=function(){P.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},o.prototype.deselect=function(){P.prototype.deselect.call(this),this.controlBox.style.display="none"},o.prototype.setupControlBox=function(){this.controlBox=G.createGroup();var h=G.createTransform();h.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(h),this.container.appendChild(this.controlBox),this.controlRect=G.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=G.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"},o.prototype.adjustControlBox=function(){var h=this.controlBox.transform.baseVal.getItem(0);h.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(h,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},o.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},o.prototype.createGrip=function(){var h=new Fe;return h.visual.transform.baseVal.appendItem(G.createTransform()),this.controlBox.appendChild(h.visual),h},o.prototype.positionGrips=function(){var h=this.controlGrips.topLeft.GRIP_SIZE,O=-h/2,U=O,M=(this.width+this.CB_DISTANCE)/2-h/2,ne=(this.height+this.CB_DISTANCE)/2-h/2,ke=this.height+this.CB_DISTANCE-h/2,Ke=this.width+this.CB_DISTANCE-h/2;this.positionGrip(this.controlGrips.topLeft.visual,O,U),this.positionGrip(this.controlGrips.topCenter.visual,M,U),this.positionGrip(this.controlGrips.topRight.visual,Ke,U),this.positionGrip(this.controlGrips.centerLeft.visual,O,ne),this.positionGrip(this.controlGrips.centerRight.visual,Ke,ne),this.positionGrip(this.controlGrips.bottomLeft.visual,O,ke),this.positionGrip(this.controlGrips.bottomCenter.visual,M,ke),this.positionGrip(this.controlGrips.bottomRight.visual,Ke,ke),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,M,U-3*this.CB_DISTANCE)},o.prototype.positionGrip=function(h,O,U){var M=h.transform.baseVal.getItem(0);M.setTranslate(O,U),h.transform.baseVal.replaceItem(M,0)},o.prototype.hideControlBox=function(){this.controlBox.style.display="none"},o.prototype.showControlBox=function(){this.controlBox.style.display=""},o.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:le.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:le.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},P.prototype.getState.call(this))},o.prototype.restoreState=function(h){P.prototype.restoreState.call(this,h);var O=h;this.left=O.left,this.top=O.top,this.width=O.width,this.height=O.height,this.rotationAngle=O.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(le.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,O.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(le.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,O.containerTransformMatrix))},o.prototype.scale=function(h,O){P.prototype.scale.call(this,h,O);var U=this.rotatePoint({x:this.left,y:this.top}),M=this.unrotatePoint({x:U.x*h,y:U.y*O});this.left=M.x,this.top=M.y,this.width=this.width*h,this.height=this.height*O,this.adjustControlBox()},o}(Ie),Ee=function(P){function o(h,O,U){var M=P.call(this,h,O,U)||this;return M.fillColor="transparent",M.strokeColor="transparent",M.strokeWidth=0,M.strokeDasharray="",M.opacity=1,M.setStrokeColor=M.setStrokeColor.bind(M),M.setFillColor=M.setFillColor.bind(M),M.setStrokeWidth=M.setStrokeWidth.bind(M),M.setStrokeDasharray=M.setStrokeDasharray.bind(M),M.createVisual=M.createVisual.bind(M),M}return Z(o,P),o.prototype.ownsTarget=function(h){return!(!P.prototype.ownsTarget.call(this,h)&&h!==this.visual)},o.prototype.createVisual=function(){this.visual=G.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},o.prototype.pointerDown=function(h,O){P.prototype.pointerDown.call(this,h,O),this.state==="new"&&(this.createVisual(),this.moveVisual(h),this._state="creating")},o.prototype.manipulate=function(h){P.prototype.manipulate.call(this,h)},o.prototype.resize=function(h){P.prototype.resize.call(this,h),this.setSize()},o.prototype.setSize=function(){P.prototype.setSize.call(this),G.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},o.prototype.pointerUp=function(h){P.prototype.pointerUp.call(this,h),this.setSize()},o.prototype.setStrokeColor=function(h){this.strokeColor=h,this.visual&&G.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(h),this.stateChanged()},o.prototype.setFillColor=function(h){this.fillColor=h,this.visual&&G.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},o.prototype.setStrokeWidth=function(h){this.strokeWidth=h,this.visual&&G.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},o.prototype.setStrokeDasharray=function(h){this.strokeDasharray=h,this.visual&&G.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},o.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},P.prototype.getState.call(this))},o.prototype.restoreState=function(h){var O=h;this.fillColor=O.fillColor,this.strokeColor=O.strokeColor,this.strokeWidth=O.strokeWidth,this.strokeDasharray=O.strokeDasharray,this.opacity=O.opacity,this.createVisual(),P.prototype.restoreState.call(this,h),this.setSize()},o.prototype.scale=function(h,O){P.prototype.scale.call(this,h,O),this.setSize()},o.title="Rectangle marker",o}(ge),Se=function(P){function o(h,O,U,M){var ne=P.call(this,h,M||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ne.widths=[],ne.widthBoxes=[],ne.widths=O,ne.currentWidth=U,ne.setCurrentWidth=ne.setCurrentWidth.bind(ne),ne}return Z(o,P),o.prototype.getUi=function(){var h=this,O=document.createElement("div");return O.style.display="flex",O.style.overflow="hidden",O.style.flexGrow="2",this.widths.forEach(function(U){var M=document.createElement("div");M.style.display="flex",M.style.flexGrow="2",M.style.alignItems="center",M.style.justifyContent="space-between",M.style.padding="5px",M.style.borderWidth="2px",M.style.borderStyle="solid",M.style.borderColor=U===h.currentWidth?h.uiStyleSettings.toolboxAccentColor:"transparent",M.addEventListener("click",function(){h.setCurrentWidth(U,M)}),O.appendChild(M);var ne=document.createElement("div");ne.innerText=U.toString(),ne.style.marginRight="5px",M.appendChild(ne);var ke=document.createElement("div");ke.style.minHeight="20px",ke.style.flexGrow="2",ke.style.display="flex",ke.style.alignItems="center";var Ke=document.createElement("hr");Ke.style.minWidth="20px",Ke.style.border="0px",Ke.style.borderTop=U+"px solid "+h.uiStyleSettings.toolboxColor,Ke.style.flexGrow="2",ke.appendChild(Ke),M.appendChild(ke),h.widthBoxes.push(M)}),O},o.prototype.setCurrentWidth=function(h,O){var U=this;this.currentWidth=h,this.widthBoxes.forEach(function(M){M.style.borderColor=M===O?U.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},o}(fe),Ae=function(P){function o(h,O,U,M){var ne=P.call(this,h,M||'<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 ne.styles=[],ne.styleBoxes=[],ne.styles=O,ne.currentStyle=U,ne.setCurrentStyle=ne.setCurrentStyle.bind(ne),ne}return Z(o,P),o.prototype.getUi=function(){var h=this,O=document.createElement("div");return O.style.display="flex",O.style.overflow="hidden",O.style.flexGrow="2",this.styles.forEach(function(U){var M=document.createElement("div");M.style.display="flex",M.style.alignItems="center",M.style.justifyContent="space-between",M.style.padding="5px",M.style.borderWidth="2px",M.style.borderStyle="solid",M.style.overflow="hidden",M.style.maxWidth=100/h.styles.length-5+"%",M.style.borderColor=U===h.currentStyle?h.uiStyleSettings.toolboxAccentColor:"transparent",M.addEventListener("click",function(){h.setCurrentStyle(U,M)}),O.appendChild(M);var ne=document.createElement("div");ne.style.minHeight="20px",ne.style.flexGrow="2",ne.style.overflow="hidden";var ke=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+h.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(U!==""?'stroke-dasharray="'+U+'"':"")+` />
</svg>`;ne.innerHTML=ke,M.appendChild(ne),h.styleBoxes.push(M)}),O},o.prototype.setCurrentStyle=function(h,O){var U=this;this.currentStyle=h,this.styleBoxes.forEach(function(M){M.style.borderColor=M===O?U.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},o}(fe),Le=function(P){function o(h,O,U){var M=P.call(this,h,O,U)||this;return M.strokeColor=U.defaultColor,M.strokeWidth=U.defaultStrokeWidth,M.strokeDasharray=U.defaultStrokeDasharray,M.strokePanel=new we("Line color",U.defaultColorSet,U.defaultColor),M.strokePanel.onColorChanged=M.setStrokeColor,M.strokeWidthPanel=new Se("Line width",U.defaultStrokeWidths,U.defaultStrokeWidth),M.strokeWidthPanel.onWidthChanged=M.setStrokeWidth,M.strokeStylePanel=new Ae("Line style",U.defaultStrokeDasharrays,U.defaultStrokeDasharray),M.strokeStylePanel.onStyleChanged=M.setStrokeDasharray,M}return Z(o,P),Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var h=P.prototype.getState.call(this);return h.typeName=o.typeName,h},o.typeName="FrameMarker",o.title="Frame marker",o.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',o}(Ee),xe=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},Oe=function(P){function o(h,O,U){var M=P.call(this,h,O,U)||this;return M.x1=0,M.y1=0,M.x2=0,M.y2=0,M.defaultLength=50,M.manipulationStartX=0,M.manipulationStartY=0,M.manipulationStartX1=0,M.manipulationStartY1=0,M.manipulationStartX2=0,M.manipulationStartY2=0,M.setupControlBox(),M}return Z(o,P),o.prototype.ownsTarget=function(h){return!!P.prototype.ownsTarget.call(this,h)||!(!this.grip1.ownsTarget(h)&&!this.grip2.ownsTarget(h))},o.prototype.pointerDown=function(h,O){P.prototype.pointerDown.call(this,h,O),this.manipulationStartX=h.x,this.manipulationStartY=h.y,this.state==="new"&&(this.x1=h.x,this.y1=h.y,this.x2=h.x,this.y2=h.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(O)?this.activeGrip=this.grip1:this.grip2.ownsTarget(O)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},o.prototype.pointerUp=function(h){var O=this.state;P.prototype.pointerUp.call(this,h),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(h),this._state="select",O==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},o.prototype.adjustVisual=function(){},o.prototype.manipulate=function(h){this.state==="creating"?this.resize(h):this.state==="move"?(this.x1=this.manipulationStartX1+h.x-this.manipulationStartX,this.y1=this.manipulationStartY1+h.y-this.manipulationStartY,this.x2=this.manipulationStartX2+h.x-this.manipulationStartX,this.y2=this.manipulationStartY2+h.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(h)},o.prototype.resize=function(h){switch(this.activeGrip){case this.grip1:this.x1=h.x,this.y1=h.y;break;case this.grip2:case void 0:this.x2=h.x,this.y2=h.y}this.adjustVisual(),this.adjustControlBox()},o.prototype.select=function(){P.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},o.prototype.deselect=function(){P.prototype.deselect.call(this),this.controlBox.style.display="none"},o.prototype.setupControlBox=function(){this.controlBox=G.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},o.prototype.adjustControlBox=function(){this.positionGrips()},o.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},o.prototype.createGrip=function(){var h=new Fe;return h.visual.transform.baseVal.appendItem(G.createTransform()),this.controlBox.appendChild(h.visual),h},o.prototype.positionGrips=function(){var h=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-h/2,this.y1-h/2),this.positionGrip(this.grip2.visual,this.x2-h/2,this.y2-h/2)},o.prototype.positionGrip=function(h,O,U){var M=h.transform.baseVal.getItem(0);M.setTranslate(O,U),h.transform.baseVal.replaceItem(M,0)},o.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},P.prototype.getState.call(this))},o.prototype.restoreState=function(h){P.prototype.restoreState.call(this,h);var O=h;this.x1=O.x1,this.y1=O.y1,this.x2=O.x2,this.y2=O.y2},o.prototype.scale=function(h,O){P.prototype.scale.call(this,h,O),this.x1=this.x1*h,this.y1=this.y1*O,this.x2=this.x2*h,this.y2=this.y2*O,this.adjustVisual(),this.adjustControlBox()},o}(Ie),Ue=function(P){function o(h,O,U){var M=P.call(this,h,O,U)||this;return M.strokeColor="transparent",M.strokeWidth=0,M.strokeDasharray="",M.setStrokeColor=M.setStrokeColor.bind(M),M.setStrokeWidth=M.setStrokeWidth.bind(M),M.setStrokeDasharray=M.setStrokeDasharray.bind(M),M.strokeColor=U.defaultColor,M.strokeWidth=U.defaultStrokeWidth,M.strokeDasharray=U.defaultStrokeDasharray,M.strokePanel=new we("Line color",U.defaultColorSet,U.defaultColor),M.strokePanel.onColorChanged=M.setStrokeColor,M.strokeWidthPanel=new Se("Line width",U.defaultStrokeWidths,U.defaultStrokeWidth),M.strokeWidthPanel.onWidthChanged=M.setStrokeWidth,M.strokeStylePanel=new Ae("Line style",U.defaultStrokeDasharrays,U.defaultStrokeDasharray),M.strokeStylePanel.onStyleChanged=M.setStrokeDasharray,M}return Z(o,P),o.prototype.ownsTarget=function(h){return!(!P.prototype.ownsTarget.call(this,h)&&h!==this.visual&&h!==this.selectorLine&&h!==this.visibleLine)},o.prototype.createVisual=function(){this.visual=G.createGroup(),this.selectorLine=G.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=G.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},o.prototype.pointerDown=function(h,O){P.prototype.pointerDown.call(this,h,O),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},o.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),G.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),G.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),G.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},o.prototype.setStrokeColor=function(h){this.strokeColor=h,this.adjustVisual(),this.colorChanged(h)},o.prototype.setStrokeWidth=function(h){this.strokeWidth=h,this.adjustVisual()},o.prototype.setStrokeDasharray=function(h){this.strokeDasharray=h,this.adjustVisual(),this.stateChanged()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var h=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},P.prototype.getState.call(this));return h.typeName=o.typeName,h},o.prototype.restoreState=function(h){P.prototype.restoreState.call(this,h);var O=h;this.strokeColor=O.strokeColor,this.strokeWidth=O.strokeWidth,this.strokeDasharray=O.strokeDasharray,this.createVisual(),this.adjustVisual()},o.typeName="LineMarker",o.title="Line marker",o.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',o}(Oe),Te=function(P){function o(h,O,U,M){var ne=P.call(this,h,M||'<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 ne.fonts=[],ne.fontBoxes=[],ne.fonts=O,ne.currentFont=U,ne.setCurrentFont=ne.setCurrentFont.bind(ne),ne}return Z(o,P),o.prototype.getUi=function(){var h=this,O=document.createElement("div");return O.style.overflow="hidden",O.style.flexGrow="2",this.fonts.forEach(function(U){var M=document.createElement("div");M.style.display="inline-block",M.style.alignItems="center",M.style.justifyContent="space-between",M.style.padding="5px",M.style.borderWidth="2px",M.style.borderStyle="solid",M.style.overflow="hidden",M.style.maxWidth=100/h.fonts.length-5+"%",M.style.borderColor=U===h.currentFont?h.uiStyleSettings.toolboxAccentColor:"transparent",M.addEventListener("click",function(){h.setCurrentFont(U,M)}),O.appendChild(M);var ne=document.createElement("div");ne.style.display="flex",ne.style.minHeight="20px",ne.style.flexGrow="2",ne.style.fontFamily=U,ne.style.overflow="hidden";var ke=document.createElement("div");ke.style.whiteSpace="nowrap",ke.style.overflow="hidden",ke.style.textOverflow="ellipsis",ke.innerHTML="The quick brown fox jumps over the lazy dog",ne.appendChild(ke),M.appendChild(ne),h.fontBoxes.push(M)}),O},o.prototype.setCurrentFont=function(h,O){var U=this;this.currentFont=h,this.fontBoxes.forEach(function(M){M.style.borderColor=M===O?U.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},o}(fe),Ne=function(P){function o(h,O,U){var M=P.call(this,h,O,U)||this;return M.color="transparent",M.padding=5,M.DEFAULT_TEXT="your text here",M.text=M.DEFAULT_TEXT,M.isMoved=!1,M.color=U.defaultColor,M.fontFamily=U.defaultFontFamily,M.defaultSize={x:100,y:30},M.setColor=M.setColor.bind(M),M.setFont=M.setFont.bind(M),M.renderText=M.renderText.bind(M),M.sizeText=M.sizeText.bind(M),M.textEditDivClicked=M.textEditDivClicked.bind(M),M.showTextEditor=M.showTextEditor.bind(M),M.setSize=M.setSize.bind(M),M.positionTextEditor=M.positionTextEditor.bind(M),M.colorPanel=new we("Color",U.defaultColorSet,U.defaultColor),M.colorPanel.onColorChanged=M.setColor,M.fontFamilyPanel=new Te("Font",U.defaultFontFamilies,U.defaultFontFamily),M.fontFamilyPanel.onFontChanged=M.setFont,M}return Z(o,P),o.prototype.ownsTarget=function(h){if(P.prototype.ownsTarget.call(this,h)||h===this.visual||h===this.textElement||h===this.bgRectangle)return!0;var O=!1;return this.textElement.childNodes.forEach(function(U){U===h&&(O=!0)}),O},o.prototype.createVisual=function(){this.visual=G.createGroup(),this.bgRectangle=G.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=G.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(G.createTransform()),this.textElement.transform.baseVal.appendItem(G.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},o.prototype.pointerDown=function(h,O){P.prototype.pointerDown.call(this,h,O),this.isMoved=!1,this.pointerDownPoint=h,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(h),this._state="creating")},o.prototype.renderText=function(){var h=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(O){h.textElement.appendChild(G.createTSpan(O.trim()===""?" ":O.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},o.prototype.getTextScale=function(){var h=this.textElement.getBBox(),O=1;if(h.width>0&&h.height>0){var U=(1*this.width-this.width*this.padding*2/100)/h.width,M=(1*this.height-this.height*this.padding*2/100)/h.height;O=Math.min(U,M)}return O},o.prototype.getTextPosition=function(h){var O=this.textElement.getBBox(),U=0,M=0;return O.width>0&&O.height>0&&(U=(this.width-O.width*h)/2,M=this.height/2-O.height*h/2),{x:U,y:M}},o.prototype.sizeText=function(){var h=this.textElement.getBBox(),O=this.getTextScale(),U=this.getTextPosition(O);U.y-=h.y*O,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+U.x+"px, "+U.y+"px) scale("+O+", "+O+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(U.x,U.y),this.textElement.transform.baseVal.getItem(1).setScale(O,O))},o.prototype.manipulate=function(h){P.prototype.manipulate.call(this,h),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(h.x-this.pointerDownPoint.x)>5||Math.abs(h.y-this.pointerDownPoint.y)>5)},o.prototype.resize=function(h){P.prototype.resize.call(this,h),this.isMoved=!0,this.setSize(),this.sizeText()},o.prototype.setSize=function(){P.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(G.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),G.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},o.prototype.pointerUp=function(h){var O=this.state;O==="creating"&&(this._suppressMarkerCreateEvent=!0),P.prototype.pointerUp.call(this,h),this.setSize(),(O==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},o.prototype.showTextEditor=function(){var h=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(O){O.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var O=Number.parseFloat(h.textEditor.style.fontSize);h.textEditor.clientWidth>=Number.parseInt(h.textEditor.style.maxWidth)&&O>.9;)O-=.1,h.textEditor.style.fontSize=Math.max(O,.9)+"em"}),this.textEditor.addEventListener("keyup",function(O){O.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(O){if(O.clipboardData){var U=O.clipboardData.getData("text"),M=window.getSelection();if(!M.rangeCount)return!1;M.deleteFromDocument(),M.getRangeAt(0).insertNode(document.createTextNode(U)),O.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){h.textEditDivClicked(h.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},o.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var h=this.getTextScale(),O=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),U=this.textElement.getBBox(),M={x:U.width*h,y:U.height*h};O.x-=M.x/2,O.y-=M.y/2,this.textEditor.style.top=O.y+"px",this.textEditor.style.left=O.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-O.x+"px",this.textEditor.style.fontSize=Math.max(16*h,12)+"px",this.textElement.style.display="none"}},o.prototype.textEditDivClicked=function(h){this.text=h.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},o.prototype.select=function(){P.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},o.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),P.prototype.deselect.call(this)},o.prototype.dblClick=function(h,O){P.prototype.dblClick.call(this,h,O),this.showTextEditor()},o.prototype.setColor=function(h){this.textElement&&G.setAttributes(this.textElement,[["fill",h]]),this.color=h,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(h)},o.prototype.setFont=function(h){this.textElement&&G.setAttributes(this.textElement,[["font-family",h]]),this.fontFamily=h,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},o.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},o.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var h=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},P.prototype.getState.call(this));return h.typeName=o.typeName,h},o.prototype.restoreState=function(h){var O=h;this.color=O.color,this.fontFamily=O.fontFamily,this.padding=O.padding,this.text=O.text,this.createVisual(),P.prototype.restoreState.call(this,h),this.setSize()},o.prototype.scale=function(h,O){P.prototype.scale.call(this,h,O),this.setSize(),this.sizeText(),this.positionTextEditor()},o.typeName="TextMarker",o.title="Text marker",o.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',o}(ge),oe=function(P){function o(h,O,U){var M=P.call(this,h,O,U)||this;return M.color="transparent",M.lineWidth=3,M.drawing=!1,M.pixelRatio=1,M.color=U.defaultColor,M.lineWidth=U.defaultStrokeWidth,M.pixelRatio=U.freehandPixelRatio,M.setColor=M.setColor.bind(M),M.addCanvas=M.addCanvas.bind(M),M.finishCreation=M.finishCreation.bind(M),M.setLineWidth=M.setLineWidth.bind(M),M.colorPanel=new we("Color",U.defaultColorSet,U.defaultColor),M.colorPanel.onColorChanged=M.setColor,M.lineWidthPanel=new Se("Line width",U.defaultStrokeWidths,U.defaultStrokeWidth),M.lineWidthPanel.onWidthChanged=M.setLineWidth,M}return Z(o,P),o.prototype.ownsTarget=function(h){return!(!P.prototype.ownsTarget.call(this,h)&&h!==this.visual&&h!==this.drawingImage)},o.prototype.createVisual=function(){this.visual=G.createGroup(),this.drawingImage=G.createImage(),this.visual.appendChild(this.drawingImage);var h=G.createTransform();this.visual.transform.baseVal.appendItem(h),this.addMarkerVisualToContainer(this.visual)},o.prototype.pointerDown=function(h,O){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(h.x,h.y),this.drawing=!0):P.prototype.pointerDown.call(this,h,O)},o.prototype.manipulate=function(h){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(h.x,h.y),this.canvasContext.stroke()):P.prototype.manipulate.call(this,h)},o.prototype.resize=function(h){P.prototype.resize.call(this,h),G.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),G.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},o.prototype.pointerUp=function(h){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):P.prototype.pointerUp.call(this,h)},o.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},o.prototype.select=function(){this.state==="creating"&&this.finishCreation(),P.prototype.select.call(this)},o.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),P.prototype.deselect.call(this)},o.prototype.finishCreation=function(){for(var h=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),O=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],U=O[0],M=O[1],ne=O[2],ke=O[3],Ke=!1,We=0;We<this.canvasElement.height;We++)for(var Pe=0;Pe<this.canvasElement.width;Pe++)h.data[We*this.canvasElement.width*4+4*Pe+3]>0&&(Ke=!0,We<M&&(M=We),Pe<U&&(U=Pe),We>ke&&(ke=We),Pe>ne&&(ne=Pe));if(Ke){this.left=U/this.pixelRatio,this.top=M/this.pixelRatio,this.width=(ne-U)/this.pixelRatio,this.height=(ke-M)/this.pixelRatio;var Ye=document.createElement("canvas");Ye.width=ne-U,Ye.height=ke-M,Ye.getContext("2d").putImageData(this.canvasContext.getImageData(U,M,ne-U,ke-M),0,0),this.drawingImgUrl=Ye.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},o.prototype.setDrawingImage=function(){G.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),G.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},o.prototype.setColor=function(h){this.color=h,this.colorChanged(h)},o.prototype.setLineWidth=function(h){this.lineWidth=h},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var h=Object.assign({drawingImgUrl:this.drawingImgUrl},P.prototype.getState.call(this));return h.typeName=o.typeName,h},o.prototype.restoreState=function(h){this.createVisual(),P.prototype.restoreState.call(this,h),this.drawingImgUrl=h.drawingImgUrl,this.setDrawingImage()},o.prototype.scale=function(h,O){P.prototype.scale.call(this,h,O),this.setDrawingImage()},o.typeName="FreehandMarker",o.title="Freehand marker",o.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',o}(ge),re=function(P){function o(h,O,U){var M=P.call(this,h,U||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return M.typeBoxes=[],M.currentType=O,M.setCurrentType=M.setCurrentType.bind(M),M}return Z(o,P),o.prototype.getUi=function(){var h=this,O=document.createElement("div");O.style.display="flex",O.style.overflow="hidden",O.style.flexGrow="2";for(var U=function(ke){var Ke="both";switch(ke){case 0:Ke="both";break;case 1:Ke="start";break;case 2:Ke="end";break;case 3:Ke="none"}var We=document.createElement("div");if(We.style.display="flex",We.style.flexGrow="2",We.style.alignItems="center",We.style.justifyContent="space-between",We.style.padding="5px",We.style.borderWidth="2px",We.style.borderStyle="solid",We.style.borderColor=Ke===M.currentType?M.uiStyleSettings.toolboxAccentColor:"transparent",We.addEventListener("click",function(){h.setCurrentType(Ke,We)}),O.appendChild(We),Ke==="both"||Ke==="start"){var Pe=document.createElement("div");Pe.style.display="flex",Pe.style.alignItems="center",Pe.style.minHeight="20px",Pe.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="`+(M.uiStyleSettings!==void 0?M.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Pe.style.marginLeft="5px",We.appendChild(Pe)}var Ye=document.createElement("div");Ye.style.display="flex",Ye.style.alignItems="center",Ye.style.minHeight="20px",Ye.style.flexGrow="2";var ze=document.createElement("hr");if(ze.style.minWidth="20px",ze.style.border="0px",ze.style.borderTop="3px solid "+(M.uiStyleSettings!==void 0?M.uiStyleSettings.toolboxColor:"#eeeeee"),ze.style.flexGrow="2",Ye.appendChild(ze),We.appendChild(Ye),Ke==="both"||Ke==="end"){var ot=document.createElement("div");ot.style.display="flex",ot.style.alignItems="center",ot.style.minHeight="20px",ot.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="`+(M.uiStyleSettings!==void 0?M.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,ot.style.marginRight="5px",We.appendChild(ot)}M.typeBoxes.push(We)},M=this,ne=0;ne<4;ne++)U(ne);return O},o.prototype.setCurrentType=function(h,O){var U=this;this.currentType=h,this.typeBoxes.forEach(function(M){M.style.borderColor=M===O?U.uiStyleSettings!==void 0?U.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},o}(fe),ae=function(P){function o(h,O,U){var M=P.call(this,h,O,U)||this;return M.arrowType="end",M.arrowBaseHeight=10,M.arrowBaseWidth=10,M.getArrowPoints=M.getArrowPoints.bind(M),M.setArrowType=M.setArrowType.bind(M),M.arrowTypePanel=new re("Arrow type","end"),M.arrowTypePanel.onArrowTypeChanged=M.setArrowType,M}return Z(o,P),o.prototype.ownsTarget=function(h){return!(!P.prototype.ownsTarget.call(this,h)&&h!==this.arrow1&&h!==this.arrow2)},o.prototype.getArrowPoints=function(h,O){var U=this.arrowBaseWidth+2*this.strokeWidth,M=this.arrowBaseHeight+2*this.strokeWidth;return h-U/2+","+(O+M/2)+" "+h+","+(O-M/2)+" "+(h+U/2)+","+(O+M/2)},o.prototype.createTips=function(){this.arrow1=G.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(G.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=G.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(G.createTransform()),this.visual.appendChild(this.arrow2)},o.prototype.pointerDown=function(h,O){P.prototype.pointerDown.call(this,h,O),this.state==="creating"&&this.createTips()},o.prototype.adjustVisual=function(){if(P.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",G.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),G.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var h=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),O=this.arrow1.transform.baseVal.getItem(0);O.setRotate(h,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(O,0);var U=this.arrow2.transform.baseVal.getItem(0);U.setRotate(h+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(U,0)}},o.prototype.setArrowType=function(h){this.arrowType=h,this.adjustVisual(),this.stateChanged()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var h=Object.assign({arrowType:this.arrowType},P.prototype.getState.call(this));return h.typeName=o.typeName,h},o.prototype.restoreState=function(h){P.prototype.restoreState.call(this,h);var O=h;this.arrowType=O.arrowType,this.createTips(),this.adjustVisual()},o.typeName="ArrowMarker",o.title="Arrow marker",o.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',o}(Ue),W=function(P){function o(h,O,U){var M=P.call(this,h,O,U)||this;return M.fillColor=U.defaultFillColor,M.strokeWidth=0,M.fillPanel=new we("Color",U.defaultColorSet,U.defaultFillColor),M.fillPanel.onColorChanged=M.setFillColor,M}return Z(o,P),Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var h=P.prototype.getState.call(this);return h.typeName=o.typeName,h},o.typeName="CoverMarker",o.title="Cover marker",o.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',o}(Ee),H=function(P){function o(h,O,U,M){var ne=P.call(this,h,M||'<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 ne.opacities=[],ne.opacityBoxes=[],ne.opacities=O,ne.currentOpacity=U,ne.setCurrentOpacity=ne.setCurrentOpacity.bind(ne),ne}return Z(o,P),o.prototype.getUi=function(){var h=this,O=document.createElement("div");return O.style.display="flex",O.style.overflow="hidden",O.style.flexGrow="2",O.style.justifyContent="space-between",this.opacities.forEach(function(U){var M=document.createElement("div");M.style.display="flex",M.style.alignItems="center",M.style.justifyContent="center",M.style.padding="5px",M.style.borderWidth="2px",M.style.borderStyle="solid",M.style.borderColor=U===h.currentOpacity?h.uiStyleSettings.toolboxAccentColor:"transparent",M.addEventListener("click",function(){h.setCurrentOpacity(U,M)}),O.appendChild(M);var ne=document.createElement("div");ne.innerText=100*U+"%",M.appendChild(ne),h.opacityBoxes.push(M)}),O},o.prototype.setCurrentOpacity=function(h,O){var U=this;this.currentOpacity=h,this.opacityBoxes.forEach(function(M){M.style.borderColor=M===O?U.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},o}(fe),Y=function(P){function o(h,O,U){var M=P.call(this,h,O,U)||this;return M.setOpacity=M.setOpacity.bind(M),M.fillColor=U.defaultHighlightColor,M.strokeWidth=0,M.opacity=U.defaultHighlightOpacity,M.fillPanel=new we("Color",U.defaultColorSet,M.fillColor),M.fillPanel.onColorChanged=M.setFillColor,M.opacityPanel=new H("Opacity",U.defaultOpacitySteps,M.opacity),M.opacityPanel.onOpacityChanged=M.setOpacity,M}return Z(o,P),o.prototype.setOpacity=function(h){this.opacity=h,this.visual&&G.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var h=P.prototype.getState.call(this);return h.typeName=o.typeName,h},o.typeName="HighlightMarker",o.title="Highlight marker",o.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',o}(W),ee='<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>',me=function(P){function o(h,O,U){var M=P.call(this,h,O,U)||this;return M.bgColor="transparent",M.tipPosition={x:0,y:0},M.tipBase1Position={x:0,y:0},M.tipBase2Position={x:0,y:0},M.tipMoving=!1,M.color=U.defaultStrokeColor,M.bgColor=U.defaultFillColor,M.fontFamily=U.defaultFontFamily,M.defaultSize={x:100,y:30},M.setBgColor=M.setBgColor.bind(M),M.getTipPoints=M.getTipPoints.bind(M),M.positionTip=M.positionTip.bind(M),M.setTipPoints=M.setTipPoints.bind(M),M.colorPanel=new we("Text color",U.defaultColorSet,M.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>'),M.colorPanel.onColorChanged=M.setColor,M.bgColorPanel=new we("Fill color",U.defaultColorSet,M.bgColor,ee),M.bgColorPanel.onColorChanged=M.setBgColor,M.fontFamilyPanel=new Te("Font",U.defaultFontFamilies,U.defaultFontFamily),M.fontFamilyPanel.onFontChanged=M.setFont,M.tipGrip=new Fe,M.tipGrip.visual.transform.baseVal.appendItem(G.createTransform()),M.controlBox.appendChild(M.tipGrip.visual),M}return Z(o,P),o.prototype.ownsTarget=function(h){return P.prototype.ownsTarget.call(this,h)||this.tipGrip.ownsTarget(h)||this.tip===h},o.prototype.createTip=function(){G.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=G.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},o.prototype.pointerDown=function(h,O){this.state==="new"&&P.prototype.pointerDown.call(this,h,O),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(O)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):P.prototype.pointerDown.call(this,h,O)},o.prototype.pointerUp=function(h){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,P.prototype.pointerUp.call(this,h);else{var O=this.state==="creating";P.prototype.pointerUp.call(this,h),this.setTipPoints(O),this.positionTip()}},o.prototype.manipulate=function(h){if(this.tipMoving){var O=this.unrotatePoint(h);this.tipPosition={x:O.x-this.manipulationStartLeft,y:O.y-this.manipulationStartTop},this.positionTip()}else P.prototype.manipulate.call(this,h)},o.prototype.setBgColor=function(h){this.bgRectangle&&this.tip&&(G.setAttributes(this.bgRectangle,[["fill",h]]),G.setAttributes(this.tip,[["fill",h]])),this.bgColor=h,this.fillColorChanged(h)},o.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},o.prototype.setTipPoints=function(h){h===void 0&&(h=!1);var O=Math.min(this.height/2,15),U=this.height/5;h&&(this.tipPosition={x:O+U/2,y:this.height+20});var M=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?M<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(U=this.width/5,O=Math.min(this.width/2,15),this.tipBase1Position={x:O,y:0},this.tipBase2Position={x:O+U,y:0}):(this.tipBase1Position={x:0,y:O},this.tipBase2Position={x:0,y:O+U}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?M<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(U=this.width/5,O=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-O-U,y:0},this.tipBase2Position={x:this.width-O,y:0}):(this.tipBase1Position={x:this.width,y:O},this.tipBase2Position={x:this.width,y:O+U}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?M<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(U=this.width/5,O=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-O-U,y:this.height},this.tipBase2Position={x:this.width-O,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-O-U},this.tipBase2Position={x:this.width,y:this.height-O}):M<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(U=this.width/5,O=Math.min(this.width/2,15),this.tipBase1Position={x:O,y:this.height},this.tipBase2Position={x:O+U,y:this.height}):(this.tipBase1Position={x:0,y:this.height-O},this.tipBase2Position={x:0,y:this.height-O-U})},o.prototype.resize=function(h){P.prototype.resize.call(this,h),this.positionTip()},o.prototype.positionTip=function(){G.setAttributes(this.tip,[["points",this.getTipPoints()]]);var h=this.tipGrip.visual.transform.baseVal.getItem(0);h.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(h,0)},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),o.prototype.select=function(){this.positionTip(),P.prototype.select.call(this)},o.prototype.getState=function(){var h=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},P.prototype.getState.call(this));return h.typeName=o.typeName,h},o.prototype.restoreState=function(h){var O=h;this.bgColor=O.bgColor,this.tipPosition=O.tipPosition,P.prototype.restoreState.call(this,h),this.createTip(),this.setTipPoints()},o.prototype.scale=function(h,O){P.prototype.scale.call(this,h,O),this.tipPosition={x:this.tipPosition.x*h,y:this.tipPosition.y*O},this.positionTip()},o.typeName="CalloutMarker",o.title="Callout marker",o.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',o}(Ne),Ce=function(P){function o(h,O,U){var M=P.call(this,h,O,U)||this;return M.fillColor="transparent",M.strokeColor="transparent",M.strokeWidth=0,M.strokeDasharray="",M.opacity=1,M.strokeColor=U.defaultColor,M.strokeWidth=U.defaultStrokeWidth,M.strokeDasharray=U.defaultStrokeDasharray,M.fillColor=U.defaultFillColor,M.setStrokeColor=M.setStrokeColor.bind(M),M.setFillColor=M.setFillColor.bind(M),M.setStrokeWidth=M.setStrokeWidth.bind(M),M.setStrokeDasharray=M.setStrokeDasharray.bind(M),M.setOpacity=M.setOpacity.bind(M),M.createVisual=M.createVisual.bind(M),M.strokePanel=new we("Line color",V(U.defaultColorSet,["transparent"]),U.defaultColor),M.strokePanel.onColorChanged=M.setStrokeColor,M.fillPanel=new we("Fill color",V(U.defaultColorSet,["transparent"]),M.fillColor,ee),M.fillPanel.onColorChanged=M.setFillColor,M.strokeWidthPanel=new Se("Line width",U.defaultStrokeWidths,U.defaultStrokeWidth),M.strokeWidthPanel.onWidthChanged=M.setStrokeWidth,M.strokeStylePanel=new Ae("Line style",U.defaultStrokeDasharrays,U.defaultStrokeDasharray),M.strokeStylePanel.onStyleChanged=M.setStrokeDasharray,M.opacityPanel=new H("Opacity",U.defaultOpacitySteps,M.opacity),M.opacityPanel.onOpacityChanged=M.setOpacity,M}return Z(o,P),o.prototype.ownsTarget=function(h){return!(!P.prototype.ownsTarget.call(this,h)&&h!==this.visual)},o.prototype.createVisual=function(){this.visual=G.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},o.prototype.pointerDown=function(h,O){P.prototype.pointerDown.call(this,h,O),this.state==="new"&&(this.createVisual(),this.moveVisual(h),this._state="creating")},o.prototype.manipulate=function(h){P.prototype.manipulate.call(this,h)},o.prototype.resize=function(h){P.prototype.resize.call(this,h),this.setSize()},o.prototype.setSize=function(){P.prototype.setSize.call(this),G.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},o.prototype.pointerUp=function(h){P.prototype.pointerUp.call(this,h),this.setSize()},o.prototype.setStrokeColor=function(h){this.strokeColor=h,this.visual&&G.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(h),this.stateChanged()},o.prototype.setFillColor=function(h){this.fillColor=h,this.visual&&G.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(h),this.stateChanged()},o.prototype.setStrokeWidth=function(h){this.strokeWidth=h,this.visual&&G.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},o.prototype.setStrokeDasharray=function(h){this.strokeDasharray=h,this.visual&&G.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},o.prototype.setOpacity=function(h){this.opacity=h,this.visual&&G.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var h=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},P.prototype.getState.call(this));return h.typeName=o.typeName,h},o.prototype.restoreState=function(h){var O=h;this.fillColor=O.fillColor,this.strokeColor=O.strokeColor,this.strokeWidth=O.strokeWidth,this.strokeDasharray=O.strokeDasharray,this.opacity=O.opacity,this.createVisual(),P.prototype.restoreState.call(this,h),this.setSize()},o.prototype.scale=function(h,O){P.prototype.scale.call(this,h,O),this.setSize()},o.typeName="EllipseMarker",o.title="Ellipse marker",o.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',o}(ge),Be=function(P){function o(h,O,U){return P.call(this,h,O,U)||this}return Z(o,P),Object.defineProperty(o.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),o.prototype.ownsTarget=function(h){return!(!P.prototype.ownsTarget.call(this,h)&&h!==this.tip1&&h!==this.tip2)},o.prototype.createTips=function(){this.tip1=G.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(G.createTransform()),this.visual.appendChild(this.tip1),this.tip2=G.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(G.createTransform()),this.visual.appendChild(this.tip2)},o.prototype.pointerDown=function(h,O){P.prototype.pointerDown.call(this,h,O),this.state==="creating"&&this.createTips()},o.prototype.adjustVisual=function(){if(P.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(G.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()]]),G.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 h=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),O=this.tip1.transform.baseVal.getItem(0);O.setRotate(h,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(O,0);var U=this.tip2.transform.baseVal.getItem(0);U.setRotate(h+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(U,0)}},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var h=P.prototype.getState.call(this);return h.typeName=o.typeName,h},o.prototype.restoreState=function(h){P.prototype.restoreState.call(this,h),this.createTips(),this.adjustVisual()},o.typeName="MeasurementMarker",o.title="Measurement marker",o.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',o}(Ue),Ge=function(P){function o(h,O,U){var M=P.call(this,h,O,U)||this;return M.strokePanel.colors=U.defaultColorSet,M.fillColor="transparent",M}return Z(o,P),Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var h=P.prototype.getState.call(this);return h.typeName=o.typeName,h},o.typeName="EllipseFrameMarker",o.title="Ellipse frame marker",o.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',o}(Ce),Qe=function(){function P(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(P.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),P.prototype.addUndoStep=function(o){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(o)||(this.undoStack.push(o),JSON.stringify(this.lastRedoStep)!==JSON.stringify(o)&&this.redoStack.splice(0,this.redoStack.length))},P.prototype.replaceLastUndoStep=function(o){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=o)},P.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},P.prototype.undo=function(){if(this.undoStack.length>1){var o=this.undoStack.pop();return o!==void 0&&this.redoStack.push(o),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},P.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},P}(),Ve=function(P){function o(h,O,U){var M=P.call(this,h,O,U)||this;return M.strokeColor="transparent",M.strokeWidth=0,M.strokeDasharray="",M.curveX=0,M.curveY=0,M.manipulationStartCurveX=0,M.manipulationStartCurveY=0,M.setStrokeColor=M.setStrokeColor.bind(M),M.setStrokeWidth=M.setStrokeWidth.bind(M),M.setStrokeDasharray=M.setStrokeDasharray.bind(M),M.positionGrips=M.positionGrips.bind(M),M.addControlGrips=M.addControlGrips.bind(M),M.adjustVisual=M.adjustVisual.bind(M),M.setupControlBox=M.setupControlBox.bind(M),M.resize=M.resize.bind(M),M.strokeColor=U.defaultColor,M.strokeWidth=U.defaultStrokeWidth,M.strokeDasharray=U.defaultStrokeDasharray,M.strokePanel=new we("Line color",U.defaultColorSet,U.defaultColor),M.strokePanel.onColorChanged=M.setStrokeColor,M.strokeWidthPanel=new Se("Line width",U.defaultStrokeWidths,U.defaultStrokeWidth),M.strokeWidthPanel.onWidthChanged=M.setStrokeWidth,M.strokeStylePanel=new Ae("Line style",U.defaultStrokeDasharrays,U.defaultStrokeDasharray),M.strokeStylePanel.onStyleChanged=M.setStrokeDasharray,M}return Z(o,P),o.prototype.ownsTarget=function(h){return!(!P.prototype.ownsTarget.call(this,h)&&h!==this.visual&&h!==this.selectorCurve&&h!==this.visibleCurve&&!this.curveGrip.ownsTarget(h))},o.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},o.prototype.createVisual=function(){this.visual=G.createGroup(),this.selectorCurve=G.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=G.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},o.prototype.pointerDown=function(h,O){P.prototype.pointerDown.call(this,h,O),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=h.x,this.curveY=h.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(O)&&(this.activeGrip=this.curveGrip,this._state="resize")},o.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),G.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),G.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),G.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},o.prototype.setupControlBox=function(){P.prototype.setupControlBox.call(this),this.curveControlLine1=G.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=G.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},o.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,P.prototype.addControlGrips.call(this)},o.prototype.positionGrips=function(){P.prototype.positionGrips.call(this);var h=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-h/2,this.curveY-h/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},o.prototype.manipulate=function(h){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+h.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+h.y-this.manipulationStartY),P.prototype.manipulate.call(this,h)},o.prototype.resize=function(h){this.activeGrip===this.curveGrip&&(this.curveX=h.x,this.curveY=h.y),P.prototype.resize.call(this,h),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},o.prototype.setStrokeColor=function(h){this.strokeColor=h,this.adjustVisual(),this.colorChanged(h)},o.prototype.setStrokeWidth=function(h){this.strokeWidth=h,this.adjustVisual()},o.prototype.setStrokeDasharray=function(h){this.strokeDasharray=h,this.adjustVisual()},o.prototype.scale=function(h,O){this.curveX=this.curveX*h,this.curveY=this.curveY*O,P.prototype.scale.call(this,h,O)},Object.defineProperty(o.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),o.prototype.getState=function(){var h=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},P.prototype.getState.call(this));return h.typeName=o.typeName,h},o.prototype.restoreState=function(h){P.prototype.restoreState.call(this,h);var O=h;this.strokeColor=O.strokeColor,this.strokeWidth=O.strokeWidth,this.strokeDasharray=O.strokeDasharray,this.curveX=O.curveX,this.curveY=O.curveY,this.createVisual(),this.adjustVisual()},o.typeName="CurveMarker",o.title="Curve marker",o.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',o}(Oe),qe=function(){function P(o,h){h===void 0&&(h=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=o,this.cancelable=h}return Object.defineProperty(P.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),P.prototype.preventDefault=function(){this._defaultPrevented=!0},P}(),at=function(P){function o(h,O,U){var M=P.call(this,h,!1)||this;return M.dataUrl=O,M.state=U,M}return Z(o,P),o}(qe),Je=function(P){function o(h,O,U){U===void 0&&(U=!1);var M=P.call(this,h,U)||this;return M.marker=O,M}return Z(o,P),o}(qe),Ct=function(){function P(){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 P.prototype.addEventListener=function(o,h){this[o].push(h)},P.prototype.removeEventListener=function(o,h){var O=this[o].indexOf(h);O>-1&&this[o].splice(O,1)},P}(),ht=function(){function P(o){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new xe,this._isOpen=!1,this.undoRedoManager=new Qe,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 Ct,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=P.instanceCounter++,this.styles=new Me(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=o,this.targetRoot=document.body,this.width=o.clientWidth,this.height=o.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(P.prototype,"ALL_MARKER_TYPES",{get:function(){return[Le,oe,ae,Ne,Ge,Ce,Y,me,Be,W,Ue,Ve]},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Le,oe,ae,Ne,Ce,Y,me]},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Le,oe,ae,Ne,Y]},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(o){var h=this;this._availableMarkerTypes.splice(0),o.forEach(function(O){if(typeof O=="string"){var U=h.ALL_MARKER_TYPES.find(function(M){return M.typeName===O});U!==void 0&&h._availableMarkerTypes.push(U)}else h._availableMarkerTypes.push(O)})},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(o){this._zoomLevel=o,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),P.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),be.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},P.prototype.show=function(){var o=this;this.styles.styleSheetRoot===void 0&&De.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=De.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(h){return h(new qe(o))})},P.prototype.render=function(){return q(this,void 0,void 0,function(){var o;return se(this,function(h){switch(h.label){case 0:return this.setCurrentMarker(),(o=new Re).naturalSize=this.renderAtNaturalSize,o.imageType=this.renderImageType,o.imageQuality=this.renderImageQuality,o.markersOnly=this.renderMarkersOnly,o.width=this.renderWidth,o.height=this.renderHeight,[4,o.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return h.sent(),[4,o.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,h.sent()]}})})},P.prototype.close=function(o){var h=this;if(o===void 0&&(o=!1),this.isOpen){var O=!1;o||this.eventListeners.beforeclose.forEach(function(U){var M=new qe(h,!0);U(M),M.defaultPrevented&&(O=!0)}),O||(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(U){return U(new qe(h))}),this.detachEvents(),this._isOpen=!1)}},P.prototype.addMarkersToToolbar=function(){for(var o,h=[],O=0;O<arguments.length;O++)h[O]=arguments[O];(o=this._availableMarkerTypes).push.apply(o,h)},P.prototype.addRenderEventListener=function(o){this.addEventListener("render",function(h){o(h.dataUrl,h.state)})},P.prototype.removeRenderEventListener=function(o){},P.prototype.addCloseEventListener=function(o){this.addEventListener("close",function(){o()})},P.prototype.removeCloseEventListener=function(o){},P.prototype.setupResizeObserver=function(){var o=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){o.resize(o.target.clientWidth,o.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return o.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},P.prototype.onPopupTargetResize=function(){var o=1*this.target.clientWidth/this.target.clientHeight,h=this.editorCanvas.clientWidth/o>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*o:this.editorCanvas.clientWidth,O=h<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/o;this.resize(h,O)},P.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},P.prototype.resize=function(o,h){this._isResizing=!0;var O=o/this.imageWidth,U=h/this.imageHeight;this.imageWidth=Math.round(o),this.imageHeight=Math.round(h),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(O,U),this._isResizing=!1},P.prototype.scaleMarkers=function(o,h){var O,U=this;this._currentMarker&&this._currentMarker instanceof Ne?this._currentMarker.scale(o,h):(O=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(M){M!==U._currentMarker&&M.scale(o,h)}),O!==void 0&&this.setCurrentMarker(O)},P.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"},P.prototype.setTopLeft=function(){var o=this.editingTarget.getBoundingClientRect(),h=this.editorCanvas.getBoundingClientRect();this.left=o.left-h.left,this.top=o.top-h.top},P.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)},P.prototype.addDefs=function(){for(var o,h=[],O=0;O<arguments.length;O++)h[O]=arguments[O];this.defs=G.createDefs(),this.addDefsToImage(),(o=this.defs).append.apply(o,h)},P.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},P.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)},P.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},P.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},P.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)},P.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},P.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)},P.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var o=document.createElement("a");o.href="https://markerjs.com/",o.target="_blank",o.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',o.title="Powered by marker.js",o.style.display="grid",o.style.alignItems="center",o.style.justifyItems="center",o.style.padding="3px",o.style.width="20px",o.style.height="20px",this.logoUI.appendChild(o),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},P.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")},P.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"},P.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},P.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var o=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=o+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new te(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 de(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},P.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},P.prototype.removeMarker=function(o){this.markerImage.removeChild(o.container),this.markers.indexOf(o)>-1&&this.markers.splice(this.markers.indexOf(o),1),o.dispose()},P.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())},P.prototype.toolbarButtonClicked=function(o,h){if(o==="marker"&&h!==void 0)this.createNewMarker(h);else if(o==="action")switch(h){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()}},P.prototype.deleteSelectedMarker=function(){var o=this;if(this._currentMarker!==void 0){var h=!1;if(this.eventListeners.markerbeforedelete.forEach(function(U){var M=new Je(o,o._currentMarker,!0);U(M),M.defaultPrevented&&(h=!0)}),!h){var O=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(U){return U(new Je(o,O))})}}},P.prototype.clear=function(){var o=this,h=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ne){var ke=new Je(o,void 0,!0);ne(ke),ke.defaultPrevented&&(h=!0)}),!h)){this.setCurrentMarker();for(var O=function(ne){var ke=U.markers[ne];U.setCurrentMarker(U.markers[ne]),U._currentMarker.dispose(),U.markerImage.removeChild(U._currentMarker.container),U.markers.splice(U.markers.indexOf(U._currentMarker),1),U.eventListeners.markerdelete.forEach(function(Ke){return Ke(new Je(o,ke))})},U=this,M=this.markers.length-1;M>=0;M--)O(M);this.addUndoStep()}},Object.defineProperty(P.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),P.prototype.showNotesEditor=function(){var o;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(o=this._currentMarker.notes)!==null&&o!==void 0?o:"",this.overlayContainer.appendChild(this.notesArea))},P.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)},P.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},P.prototype.addUndoStep=function(){var o=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var h=this.getState(),O=this.undoRedoManager.getLastUndoStep();if(!O||O.width===h.width&&O.height===h.height){var U=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(h),U<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(M){return M(new qe(o))})}else this.undoRedoManager.replaceLastUndoStep(h),this.eventListeners.statechange.forEach(function(M){return M(new qe(o))})}},P.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},P.prototype.undoStep=function(){var o=this,h=this.undoRedoManager.undo();h!==void 0&&(this.restoreState(h),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(O){return O(new qe(o))}))},P.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},P.prototype.redoStep=function(){var o=this,h=this.undoRedoManager.redo();h!==void 0&&(this.restoreState(h),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(O){return O(new qe(o))}))},P.prototype.stepZoom=function(){var o=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=o<this.zoomSteps.length-1?this.zoomSteps[o+1]:this.zoomSteps[0]},P.prototype.panTo=function(o){this.contentDiv.scrollBy({left:this.prevPanPoint.x-o.x,top:this.prevPanPoint.y-o.y}),this.prevPanPoint=o},P.prototype.startRenderAndClose=function(){return q(this,void 0,void 0,function(){var o,h,O=this;return se(this,function(U){switch(U.label){case 0:return[4,this.render()];case 1:return o=U.sent(),h=this.getState(),this.eventListeners.render.forEach(function(M){return M(new at(O,o,h))}),this.close(!0),[2]}})})},P.prototype.getState=function(o){o===!0&&this.setCurrentMarker();var h={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(O){return h.markers.push(O.getState())}),h},P.prototype.restoreState=function(o){var h=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);o.markers.forEach(function(O){var U=h._availableMarkerTypes.find(function(ne){return ne.typeName===O.typeName});if(U!==void 0){var M=h.addNewMarker(U);M.restoreState(O),h.markers.push(M)}}),o.width&&o.height&&(o.width!==this.imageWidth||o.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/o.width,this.imageHeight/o.height),this.eventListeners.restorestate.forEach(function(O){return O(new qe(h))})},P.prototype.addNewMarker=function(o){var h=G.createGroup();return this.markerImage.appendChild(h),new o(h,this.overlayContainer,this.settings)},P.prototype.createNewMarker=function(o){var h,O=this;(h=typeof o=="string"?this._availableMarkerTypes.find(function(U){return U.typeName===o}):o)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(h),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(h.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(U){return U(new Je(O,O._currentMarker))}))},P.prototype.markerCreated=function(o){var h=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(o),this.setCurrentMarker(o),o instanceof oe&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(oe):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(O){return O(new Je(h,h._currentMarker))})},P.prototype.colorChanged=function(o){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=o,this.settings.defaultStrokeColor=o)},P.prototype.fillColorChanged=function(o){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=o)},P.prototype.markerStateChanged=function(o){var h=this;this.eventListeners.markerchange.forEach(function(O){return O(new Je(h,o))})},P.prototype.setCurrentMarker=function(o){var h=this;this._currentMarker!==o&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(O){return O(new Je(h,h._currentMarker))})),this._currentMarker=o,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(O){return O(new Je(h,h._currentMarker))}))},P.prototype.onPointerDown=function(o){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||o.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var h=this.markers.find(function(O){return O.ownsTarget(o.target)});h!==void 0?(this.setCurrentMarker(h),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(o.clientX,o.clientY),o.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:o.clientX,y:o.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(o.clientX,o.clientY))},P.prototype.onDblClick=function(o){if(this._isFocused||this.focus(),this.mode==="select"){var h=this.markers.find(function(O){return O.ownsTarget(o.target)});h!==void 0&&h!==this._currentMarker&&this.setCurrentMarker(h),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(o.clientX,o.clientY),o.target):this.setCurrentMarker()}},P.prototype.onPointerMove=function(o){this.touchPoints!==1&&o.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||o.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(o.clientX,o.clientY)):this.zoomLevel>1&&this.panTo({x:o.clientX,y:o.clientY}))},P.prototype.onPointerUp=function(o){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(o.clientX,o.clientY)),this.isDragging=!1,this.addUndoStep()},P.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},P.prototype.onKeyUp=function(o){this._currentMarker===void 0||this.notesArea!==void 0||o.key!=="Delete"&&o.key!=="Backspace"||this.deleteSelectedMarker()},P.prototype.clientToLocalCoordinates=function(o,h){var O=this.markerImage.getBoundingClientRect();return{x:(o-O.left)/this.zoomLevel,y:(h-O.top)/this.zoomLevel}},P.prototype.onWindowResize=function(){this.positionUI()},P.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var o=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=o+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},P.prototype.addLicenseKey=function(o){be.addKey(o)},P.prototype.addEventListener=function(o,h){this.eventListeners.addEventListener(o,h)},P.prototype.removeEventListener=function(o,h){this.eventListeners.removeEventListener(o,h)},P.prototype.renderState=function(o){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(o),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(P.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),P.prototype.focus=function(){var o=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(h){return h(new qe(o))}))},P.prototype.blur=function(){var o=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(h){return h(new qe(o))}))},P.instanceCounter=0,P}();/* **********************************
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 Lt=function(P,o){return(Lt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,O){h.__proto__=O}||function(h,O){for(var U in O)Object.prototype.hasOwnProperty.call(O,U)&&(h[U]=O[U])})(P,o)};function xt(P,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function h(){this.constructor=P}Lt(P,o),P.prototype=o===null?Object.create(o):(h.prototype=o.prototype,new h)}function rt(P,o,h,O){return new(h||(h=Promise))(function(U,M){function ne(We){try{Ke(O.next(We))}catch(Pe){M(Pe)}}function ke(We){try{Ke(O.throw(We))}catch(Pe){M(Pe)}}function Ke(We){var Pe;We.done?U(We.value):(Pe=We.value,Pe instanceof h?Pe:new h(function(Ye){Ye(Pe)})).then(ne,ke)}Ke((O=O.apply(P,o||[])).next())})}function Dt(P,o){var h,O,U,M,ne={label:0,sent:function(){if(1&U[0])throw U[1];return U[1]},trys:[],ops:[]};return M={next:ke(0),throw:ke(1),return:ke(2)},typeof Symbol=="function"&&(M[Symbol.iterator]=function(){return this}),M;function ke(Ke){return function(We){return function(Pe){if(h)throw new TypeError("Generator is already executing.");for(;ne;)try{if(h=1,O&&(U=2&Pe[0]?O.return:Pe[0]?O.throw||((U=O.return)&&U.call(O),0):O.next)&&!(U=U.call(O,Pe[1])).done)return U;switch(O=0,U&&(Pe=[2&Pe[0],U.value]),Pe[0]){case 0:case 1:U=Pe;break;case 4:return ne.label++,{value:Pe[1],done:!1};case 5:ne.label++,O=Pe[1],Pe=[0];continue;case 7:Pe=ne.ops.pop(),ne.trys.pop();continue;default:if(!(U=ne.trys,(U=U.length>0&&U[U.length-1])||Pe[0]!==6&&Pe[0]!==2)){ne=0;continue}if(Pe[0]===3&&(!U||Pe[1]>U[0]&&Pe[1]<U[3])){ne.label=Pe[1];break}if(Pe[0]===6&&ne.label<U[1]){ne.label=U[1],U=Pe;break}if(U&&ne.label<U[2]){ne.label=U[2],ne.ops.push(Pe);break}U[2]&&ne.ops.pop(),ne.trys.pop();continue}Pe=o.call(P,ne)}catch(Ye){Pe=[6,Ye],O=0}finally{h=U=0}if(5&Pe[0])throw Pe[1];return{value:Pe[0]?Pe[1]:void 0,done:!0}}([Ke,We])}}}var At=function(){function P(){}return P.addKey=function(o){P.key=o},Object.defineProperty(P,"isLicensed",{get:function(){return!!P.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(P.key)},enumerable:!1,configurable:!0}),P}(),$e=function(){function P(){}return P.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},P.setAttributes=function(o,h){for(var O=0,U=h;O<U.length;O++){var M=U[O],ne=M[0],ke=M[1];o.setAttribute(ne,ke)}},P.createRect=function(o,h,O){var U=document.createElementNS("http://www.w3.org/2000/svg","rect");return U.setAttribute("width",o.toString()),U.setAttribute("height",h.toString()),O&&P.setAttributes(U,O),U},P.createLine=function(o,h,O,U,M){var ne=document.createElementNS("http://www.w3.org/2000/svg","line");return ne.setAttribute("x1",o.toString()),ne.setAttribute("y1",h.toString()),ne.setAttribute("x2",O.toString()),ne.setAttribute("y2",U.toString()),M&&P.setAttributes(ne,M),ne},P.createPolygon=function(o,h){var O=document.createElementNS("http://www.w3.org/2000/svg","polygon");return O.setAttribute("points",o),h&&P.setAttributes(O,h),O},P.createCircle=function(o,h){var O=document.createElementNS("http://www.w3.org/2000/svg","circle");return O.setAttribute("cx",(o/2).toString()),O.setAttribute("cy",(o/2).toString()),O.setAttribute("r",o.toString()),h&&P.setAttributes(O,h),O},P.createEllipse=function(o,h,O){var U=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return U.setAttribute("cx",(o/2).toString()),U.setAttribute("cy",(h/2).toString()),U.setAttribute("rx",(o/2).toString()),U.setAttribute("ry",(h/2).toString()),O&&P.setAttributes(U,O),U},P.createGroup=function(o){var h=document.createElementNS("http://www.w3.org/2000/svg","g");return o&&P.setAttributes(h,o),h},P.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},P.createMarker=function(o,h,O,U,M,ne,ke){var Ke=document.createElementNS("http://www.w3.org/2000/svg","marker");return P.setAttributes(Ke,[["id",o],["orient",h],["markerWidth",O.toString()],["markerHeight",U.toString()],["refX",M.toString()],["refY",ne.toString()]]),Ke.appendChild(ke),Ke},P.createText=function(o){var h=document.createElementNS("http://www.w3.org/2000/svg","text");return h.setAttribute("x","0"),h.setAttribute("y","0"),o&&P.setAttributes(h,o),h},P.createTSpan=function(o,h){var O=document.createElementNS("http://www.w3.org/2000/svg","tspan");return O.textContent=o,h&&P.setAttributes(O,h),O},P.createImage=function(o){var h=document.createElementNS("http://www.w3.org/2000/svg","image");return o&&P.setAttributes(h,o),h},P.createPoint=function(o,h){var O=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return O.x=o,O.y=h,O},P.createPath=function(o,h){var O=document.createElementNS("http://www.w3.org/2000/svg","path");return O.setAttribute("d",o),h&&P.setAttributes(O,h),O},P.createElement=function(o,h){var O=document.createElementNS("http://www.w3.org/2000/svg",o);return h&&P.setAttributes(O,h),O},P.getHollowRectanglePath=function(o,h,O,U,M,ne,ke,Ke){return"M"+o+","+h+"V"+(h+U)+"H"+(o+O)+"V"+h+"H"+M+"V"+ne+"H"+(M+ke)+"V"+(ne+Ke)+"H"+M+"V"+h+"Z"},P}(),Xe=function(){function P(o){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+o+"_"}return Object.defineProperty(P.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(P.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(P.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),P.prototype.addClass=function(o){return this.styleSheet===void 0&&this.addStyleSheet(),o.name=""+this.classNamePrefix+o.localName,this.classes.push(o),this.styleSheet.sheet.insertRule("."+o.name+" {"+o.style+"}",this.styleSheet.sheet.cssRules.length),o},P.prototype.addRule=function(o){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(o),this.styleSheet.sheet.insertRule(o.selector+" {"+o.style+"}",this.styleSheet.sheet.cssRules.length)},P.prototype.addStyleSheet=function(){var o;this.styleSheet=document.createElement("style"),((o=this.styleSheetRoot)!==null&&o!==void 0?o:document.head).appendChild(this.styleSheet),this.addRule(new je("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new je("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new je("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new He("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new He("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},P.prototype.removeStyleSheet=function(){var o;this.styleSheet&&(((o=this.styleSheetRoot)!==null&&o!==void 0?o:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},P}(),je=function(P,o){this.selector=P,this.style=o},He=function(P,o){this.localName=P,this.style=o},lt=function(){function P(){this.blocks=[],this.display=""}return P.prototype.addButtonBlock=function(o){o.className=this.blockClassName,o.buttonClassName=this.buttonClassName,o.buttonColorsClassName=this.buttonColorsClassName,o.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(o)},P.prototype.addElementBlock=function(o){o.className===void 0&&(o.className=this.blockClassName),this.blocks.push(o)},P.prototype.getUI=function(){var o=document.createElement("div");return o.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,o.style.display=this.display,this.blocks.forEach(function(h){return o.appendChild(h.getUI())}),o},P}(),ut=function(){function P(){}return P.prototype.getUI=function(){var o=document.createElement("div");if(o.className=this.className,this.minWidth!==void 0&&(o.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":o.style.justifyContent="flex-start";break;case"center":o.style.justifyContent="center";break;case"end":o.style.justifyContent="flex-end"}return o.style.whiteSpace="nowrap",o},P}(),ft=function(P){function o(){var h=P!==null&&P.apply(this,arguments)||this;return h.buttons=[],h}return xt(o,P),o.prototype.addButton=function(h){h.className=this.buttonClassName,h.colorsClassName=this.buttonColorsClassName,h.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(h)},o.prototype.getUI=function(){var h=P.prototype.getUI.call(this);return this.buttons.forEach(function(O){return h.appendChild(O.getUI())}),h},o}(ut),nt=function(){function P(o,h){this._isActive=!1,this._isHidden=!1,this._icon=o,this.title=h,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(P.prototype,"icon",{get:function(){return this._icon},set:function(o){this._icon=o,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isActive",{get:function(){return this._isActive},set:function(o){this._isActive=o,this.adjustClassName()},enumerable:!1,configurable:!0}),P.prototype.getUI=function(){var o=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return o.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},P.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,"")))},P.prototype.hide=function(){this._isHidden=!0},P}(),tt=function(P){function o(){var h=P!==null&&P.apply(this,arguments)||this;return h.elements=[],h}return xt(o,P),o.prototype.addElement=function(h){this.elements.push(h)},o.prototype.getUI=function(){var h=P.prototype.getUI.call(this);return this.elements.forEach(function(O){return h.appendChild(O)}),h},o}(ut),Ze=function(){function P(o,h){this.horizontal=o,this.vertical=h}return Object.defineProperty(P.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),P.prototype.getVerticalLength=function(o){return o/this.ratio},P.prototype.getHorizontalLength=function(o){return o*this.ratio},P}(),mt=function(){function P(){}return P.getIcon=function(o,h){if(o>0&&h>0){var O=new Ze(o,h),U=O.ratio>=1?20:O.getHorizontalLength(20),M=O.ratio<1?20:O.getVerticalLength(20),ne=document.createElementNS("http://www.w3.org/2000/svg","svg");ne.setAttribute("xmlns","http://www.w3.org/2000/svg"),ne.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ne);var ke=$e.createDefs();ne.appendChild(ke);var Ke=$e.createElement("clipPath",[["id","text-bg-clip"]]);ke.appendChild(Ke);var We=$e.createPath($e.getHollowRectanglePath((24-U)/2,(24-M)/2,U,M,(24-U)/2+2,(24-M)/2+2,U-4,M-4));ne.appendChild(We);var Pe=$e.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Pe.appendChild($e.createTSpan(o+":"+h)),ne.appendChild(Pe);var Ye=Pe.getBBox();$e.setAttributes(Pe,[["x",((24-Ye.width)/2).toString()],["y",((24-Ye.height)/2-Ye.y).toString()]]);var ze=$e.createPath($e.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Ye.width))/2,(24-Math.ceil(Ye.height))/2,Math.ceil(Ye.width),Math.ceil(Ye.height)));return Ke.appendChild(ze),$e.setAttributes(We,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ne),ne.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>'},P}(),vt=function(P){function o(h,O,U){var M=P.call(this,h,O)||this;return M.isDropdownOpen=!1,M.onClick=M.dropdownButtonClicked,M.dropdownButtons=U,M}return xt(o,P),o.prototype.setupDropdown=function(){var h=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(O){O.className=h.className,O.colorsClassName=h.colorsClassName,h.dropdownBlock.appendChild(O.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},o.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},o.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},o.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},o.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},o.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},o}(nt),dt=function(){function P(o,h){this.GRIP_SIZE=10,this.color=o,this.fillColor=h,this.visual=$e.createGroup(),this.visual.appendChild($e.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild($e.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return P.prototype.ownsTarget=function(o){return o===this.visual||o===this.visual.childNodes[0]||o===this.visual.childNodes[1]},P.prototype.setCenter=function(o,h){this.visual.childNodes.forEach(function(O){return $e.setAttributes(O,[["cx",o.toString()],["cy",h.toString()]])})},P}(),pt=function(){function P(o,h,O,U){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=o,this.canvasHeight=h,this.margin=O,this.container=U,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(P.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(o){this._aspectRatio=o,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(o){this._isGridVisible=o,this.gridContainer&&$e.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(o){this._zoomFactor=o,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),P.prototype.open=function(){var o=this;this.cropShadeElement=$e.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=$e.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var h=0;h<this.numberOfGridLines;h++)this.horizontalGridLines.push($e.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push($e.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(O){return o.gridContainer.appendChild(O)}),this.verticalGridLines.forEach(function(O){return o.gridContainer.appendChild(O)}),this.cropRectElement=$e.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new dt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new dt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new dt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new dt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},P.prototype.setCropRectangle=function(o){this.cropRect=o;var h=Object.assign({},this.cropRect);this.zoomFactor!==1&&(h.width=this.cropRect.width*this.zoomFactor,h.height=this.cropRect.height*this.zoomFactor,h.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-h.width/2,h.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-h.height/2),$e.setAttributes(this.cropRectElement,[["x",h.x.toString()],["y",h.y.toString()],["width",h.width.toString()],["height",h.height.toString()]]);var O=h.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(M,ne){var ke=h.y+O*(ne+1);$e.setAttributes(M,[["x1",""+h.x],["y1",""+ke],["x2",""+(h.x+h.width)],["y2",""+ke]])});var U=h.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(M,ne){var ke=h.x+U*(ne+1);$e.setAttributes(M,[["x1",""+ke],["y1",""+h.y],["x2",""+ke],["y2",""+(h.y+h.height)]])}),$e.setAttributes(this.cropShadeElement,[["d",$e.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,h.x,h.y,h.width,h.height)]]),this.topLeftGrip.setCenter(h.x,h.y),this.topRightGrip.setCenter(h.x+h.width,h.y),this.bottomLeftGrip.setCenter(h.x,h.y+h.height),this.bottomRightGrip.setCenter(h.x+h.width,h.y+h.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},P.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)},P.prototype.clientToLocalCoordinates=function(o,h){var O=this.container.getBoundingClientRect();return{x:o-O.left+this.margin,y:h-O.top+this.margin}},P.prototype.onPointerDown=function(o){this.container.setPointerCapture(o.pointerId),this.previousPoint=this.clientToLocalCoordinates(o.clientX,o.clientY),this.cropRectElement===o.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(o.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(o.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(o.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(o.target)&&(this.activeGrip=this.bottomRightGrip)},P.prototype.onPointerMove=function(o){if(this.isMoving)this.move(this.clientToLocalCoordinates(o.clientX,o.clientY));else if(this.activeGrip){var h=this.clientToLocalCoordinates(o.clientX,o.clientY);this.resize(h)}o.preventDefault()},P.prototype.onPointerUp=function(o){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(o.pointerId)},P.prototype.move=function(o){var h=o.x-this.previousPoint.x,O=o.y-this.previousPoint.y;this.zoomFactor!==1&&(h=-h/this.zoomFactor,O=-O/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+h),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+O),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=o},P.prototype.resize=function(o){var h=Object.assign({},this.cropRect),O=o.x-this.previousPoint.x,U=o.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:h.x+O<this.margin&&(O=this.margin-h.x),h.x+=O,h.width=this.cropRect.x+this.cropRect.width-h.x;break;case this.bottomRightGrip:case this.topRightGrip:h.width+O>this.canvasWidth*this.zoomFactor&&(O=this.canvasWidth*this.zoomFactor-h.width),h.width+=O}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(h.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(O),h.height=this.aspectRatio.getVerticalLength(h.width)):(h.y+=U,h.height=this.cropRect.y+this.cropRect.height-h.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?h.height=this.aspectRatio.getVerticalLength(h.width):h.height+=U}h.width<10&&(h.x=this.cropRect.x,h.width=10),h.height<10&&(h.y=this.cropRect.y,h.height=10),this.previousPoint=o,h.x>=this.margin&&h.y>=this.margin&&h.x-this.margin+h.width<=this.canvasWidth&&h.y-this.margin+h.height<=this.canvasHeight&&(this.cropRect=h,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},P.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var o=this.cropRect.x+this.cropRect.width/2,h=this.cropRect.y+this.cropRect.height/2,O=this.aspectRatio.getHorizontalLength(this.cropRect.height),U=this.aspectRatio.getVerticalLength(this.cropRect.width);O/this.canvasWidth<U/this.canvasHeight?this.cropRect.width=O:this.cropRect.height=U,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=o-this.cropRect.width/2,this.cropRect.y=h-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)}},P.prototype.getRescaledRect=function(o,h,O,U,M,ne){var ke=O/o,Ke=U/h;return{x:(M.x-ne)*ke+ne,y:(M.y-ne)*Ke+ne,width:M.width*ke,height:M.height*Ke}},P.prototype.scaleCanvas=function(o,h){var O=this.getRescaledRect(this.canvasWidth,this.canvasHeight,o,h,this.cropRect,this.margin);this.canvasWidth=o,this.canvasHeight=h,this.onCropChange&&this.onCropChange(O),this.setCropRectangle(O)},P}(),Tt=function(){function P(o){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=o,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(P.prototype,"angle",{get:function(){return this._angle},set:function(o){this._angle=o,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),P.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},P.prototype.onPointerDown=function(o){this.controlContainer.setPointerCapture(o.pointerId),this.isDragging=!0,this.previousPoint={x:o.clientX,y:o.clientY}},P.prototype.onPointerMove=function(o){this.isDragging&&(this.onAngleChange&&this.onAngleChange((o.clientX-this.previousPoint.x)/5),this.previousPoint.x=o.clientX)},P.prototype.onPointerUp=function(o){this.isDragging&&this.onAngleChange&&this.onAngleChange((o.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(o.pointerId)},P.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var o=this.angleLabelText.getBBox();$e.setAttributes(this.angleLabelElement,[["x",((this.width-o.width)/2).toString()],["y",(this.height/2).toString()]])}},P.prototype.positionScaleShape=function(){if(this.scaleShape){var o=this.scaleShape.transform.baseVal.getItem(0);o.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(o,0)}},P.prototype.getVisual=function(){var o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("xmlns","http://www.w3.org/2000/svg"),o.setAttribute("width",this.width+"px"),o.setAttribute("height",this.height+"px"),o.setAttribute("viewBox","0 0 "+this.width+" "+this.height),o.style.flexShrink="0",document.body.appendChild(o);for(var h="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,O=1;O<=this.width/5+10;O++){var U=O%5==0?this.height/3:this.height/6;h+="h4v"+-U+"h1v"+U}h+="v1H0Z",this.scaleShape=$e.createPath(h);var M=$e.createTransform();this.scaleShape.transform.baseVal.appendItem(M),o.appendChild(this.scaleShape),this.angleLabelElement=$e.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=$e.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ne=$e.createTSpan("");return ne.innerHTML="&deg;",this.angleLabelElement.appendChild(ne),o.appendChild(this.angleLabelElement),document.body.removeChild(o),o},P}(),It=function(){function P(){this.naturalSize=!1,this.imageType="image/png"}return P.prototype.rasterize=function(o,h,O,U,M,ne,ke){var Ke=this;return new Promise(function(We){var Pe=document.createElement("canvas");Pe.width=o.width.baseVal.value-2*U,Pe.height=o.height.baseVal.value-2*U;var Ye=1,ze=1;Ke.naturalSize===!0?(Ye=h.naturalWidth/(o.width.baseVal.value-2*U)/ne,ze=h.naturalHeight/(o.height.baseVal.value-2*U)/ke,Pe.width=h.naturalWidth/ne,Pe.height=h.naturalHeight/ke):Ke.width!==void 0&&Ke.height!==void 0&&(Ye=Ke.width/O.width,ze=Ke.height/O.height,Pe.width*=Ye,Pe.height*=ze);var ot=Pe.getContext("2d");ot.translate(Pe.width/2,Pe.height/2),ot.rotate(M*Math.PI/180),ot.scale(ne,ke),ot.translate(-Pe.width/2,-Pe.height/2),ot.drawImage(h,0,0,Pe.width,Pe.height);var Pt=document.createElement("canvas");Pt.width=O.width*Ye,Pt.height=O.height*ze,Pt.getContext("2d").putImageData(ot.getImageData((O.x-U)*Ye,(O.y-U)*ze,O.width*Ye,O.height*ze),0,0),We(Pt.toDataURL(Ke.imageType,Ke.imageQuality))})},P}(),gt=function(){function P(o){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=P.instanceCounter++,this.styles=new Xe(this.instanceNo),this.target=o,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(P.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(o){this._zoomToCropEnabled=o,o?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(o){this._isGridVisible=o,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"gridLines",{get:function(){return this._gridLines},set:function(o){this._gridLines=o,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(o){this._rotationAngle=o,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"aspectRatio",{get:function(){var o;return(o=this._aspectRatio)!==null&&o!==void 0?o:this.aspectRatios[0]},set:function(o){this._aspectRatio=o},enumerable:!1,configurable:!0}),P.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},P.prototype.show=function(){this.showUI(),this.open()},P.prototype.close=function(o){o===void 0&&(o=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),o||this.closeEventListeners.forEach(function(h){return h()}),this._isOpen=!1)},P.prototype.addRenderEventListener=function(o){this.renderEventListeners.push(o)},P.prototype.removeRenderEventListener=function(o){this.renderEventListeners.indexOf(o)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(o),1)},P.prototype.addCloseEventListener=function(o){this.closeEventListeners.push(o)},P.prototype.removeCloseEventListener=function(o){this.closeEventListeners.indexOf(o)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(o),1)},P.prototype.setupResizeObserver=function(){var o=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){o.resize(o.target.clientWidth,o.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},P.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var o=1*this.target.clientWidth/this.target.clientHeight,h=this.contentDiv.clientWidth/o>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*o:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,O=h+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/o;this.resize(h,O)}},P.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},P.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",$e.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},P.prototype.resize=function(o,h){this.imageWidth=Math.round(o),this.imageHeight=Math.round(h),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()},P.prototype.setEditingTarget=function(){var o=document.createElement("canvas");o.width=this.target.naturalWidth,o.height=this.target.naturalHeight,o.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var h=o.toDataURL();$e.setAttributes(this.editingTarget,[["href",h]]),this.setEditingTargetSize()},P.prototype.setTopLeft=function(){var o=this.target.getBoundingClientRect(),h=this.editorCanvas.getBoundingClientRect();this.left=o.left-h.left-this.CANVAS_MARGIN,this.top=o.top-h.top-this.CANVAS_MARGIN},P.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=$e.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=$e.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=$e.createGroup(),this.editingTargetRotationScaleContainer=$e.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var o=$e.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(o);var h=$e.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(h),this.editingTargetContainer=$e.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)},P.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},P.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=$e.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new pt(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()},P.prototype.zoomToCrop=function(){if(this.cropRect){var o=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,h=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=o+"px "+h+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-o+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-h+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},P.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)},P.prototype.cropRectChanged=function(o){this.cropRect=o,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},P.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},P.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"},P.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},P.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var o=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,h=this.target.offsetTop>o+this.CANVAS_MARGIN?this.target.offsetTop-(o+this.CANVAS_MARGIN):0;this.coverDiv.style.top=h+"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},P.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},P.prototype.addTopToolbar=function(){var o=this;this.topToolbar=new lt,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 h=new ft;h.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(h);var O=[];this.aspectRatios.forEach(function(ze){var ot=new nt(mt.getIcon(ze.horizontal,ze.vertical),ze.horizontal===0&&ze.vertical===0?"FREE":ze.horizontal+":"+ze.vertical);ot.onClick=function(){return o.ratioButtonClicked(ze)},O.push(ot)}),this.aspectRatioButton=new vt(mt.getIcon(0,0),"Aspect ratio",O),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,h.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var U=new nt('<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");U.isActive=this.isGridVisible,U.onClick=function(){o.isGridVisible=!o.isGridVisible,U.isActive=o.isGridVisible},h.addButton(U);var M=new nt('<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(M.isActive=this.zoomToCropEnabled,M.onClick=function(){o.zoomToCropEnabled=!o.zoomToCropEnabled,M.isActive=o.zoomToCropEnabled},h.addButton(M),!At.isLicensed){var ne=new tt;this.topToolbar.addElementBlock(ne);var ke=document.createElement("div");ke.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Ke=document.createElement("a");Ke.style.color="currentColor",Ke.href="https://markerjs.com/products/cropro",Ke.target="_blank",Ke.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>',ke.appendChild(Ke),ne.addElement(ke)}var We=new ft;We.minWidth=3*this.toolbarHeight+"px",We.contentAlign="end",this.topToolbar.addButtonBlock(We);var Pe=new nt('<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");Pe.onClick=this.startRenderAndClose,We.addButton(Pe),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Pe.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Ye=new nt('<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");Ye.onClick=this.close,We.addButton(Ye),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Ye.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},P.prototype.addBottomToolbar=function(){var o=this;this.bottomToolbar=new lt,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 h=new ft;h.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(h);var O=new nt('<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");O.onClick=this.rotateLeftButtonClicked,h.addButton(O);var U=new nt('<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");U.onClick=this.rotateRightButtonClicked,h.addButton(U);var M=new tt;M.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(M),this.straightener=new Tt("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(We){o.rotateBy(We),o.straightener.angle=o.rotationAngle},M.addElement(this.straightener.getUI());var ne=new ft;ne.minWidth=2*this.toolbarHeight+"px",ne.contentAlign="end",this.bottomToolbar.addButtonBlock(ne);var ke=new nt('<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");ke.onClick=this.flipHorizontallyButtonClicked,ne.addButton(ke);var Ke=new nt('<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");Ke.onClick=this.flipVerticallyButtonClicked,ne.addButton(Ke)},P.prototype.ratioButtonClicked=function(o){this.aspectRatio=o,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},P.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=mt.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},P.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Ze(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},P.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},P.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},P.prototype.restoreState=function(o){if(o){var h=this.cropLayer.getRescaledRect(o.width,o.height,this.imageWidth,this.imageHeight,o.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(h),this.cropRectChanged(h),this.flippedHorizontally=o.flippedHorizontally,this.flippedVertically=o.flippedVertically,this.applyFlip(),this.rotationAngle=o.rotationAngle,this.applyRotation()}},P.prototype.clientToLocalCoordinates=function(o,h){var O=this.cropImage.getBoundingClientRect();return{x:o-O.left,y:h-O.top}},P.prototype.onWindowResize=function(){this.positionUI()},P.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var o=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=o+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},P.prototype.rotateLeftButtonClicked=function(){var o=this.rotationAngle-90;this.rotationAngle%90!=0&&(o+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(o)},P.prototype.rotateRightButtonClicked=function(){var o=this.rotationAngle+90;this.rotationAngle%90!=0&&(o-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(o)},P.prototype.rotateTo=function(o){o=(o=o>180?o-360:o)<=-180?o+360:o,this.rotationAngle=o,this.applyRotation()},P.prototype.rotateBy=function(o){this.rotateTo((this.rotationAngle+o)%360)},P.prototype.applyRotation=function(){var o=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var h=this.editingTargetRotationContainer.transform.baseVal.getItem(0);h.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(h,0);var O=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/O.width,this.imageHeight/O.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=o},P.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},P.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},P.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},P.prototype.startRenderAndClose=function(){return rt(this,void 0,void 0,function(){var o,h;return Dt(this,function(O){switch(O.label){case 0:return[4,this.render()];case 1:return o=O.sent(),h=this.getState(),this.renderEventListeners.forEach(function(U){return U(o,h)}),this.close(!0),[2]}})})},P.prototype.render=function(){return rt(this,void 0,void 0,function(){var o;return Dt(this,function(h){switch(h.label){case 0:return(o=new It).naturalSize=this.renderAtNaturalSize,o.imageType=this.renderImageType,o.imageQuality=this.renderImageQuality,o.width=this.renderWidth,o.height=this.renderHeight,this.unzoomFromCrop(),$e.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,o.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return h.sent(),[4,o.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,h.sent()]}})})},P.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new He("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 He("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new He("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var o=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new He("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*o)+`px;
height: `+(this.toolbarHeight-2*o)+`px;
padding: `+o+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new He("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new He("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new je("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new je("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new He("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 He("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new He("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 He("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*o)+`px;
padding: `+o+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new He("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},P.instanceCounter=0,P}(),st=K("8hTe"),it=K.n(st),ct=/<pre[^>]*>/g;function bt(P){var o=document.createElement("div");return o.innerHTML=P,o.childNodes.length===0?"":o.childNodes[0].nodeValue}var Et=he.a=function(P){var o=P.value,h=o===void 0?"":o,O=P.edit,U=O===void 0?!1:O,M=P.className,ne=P.showTextOnly,ke=P.showLines,Ke=P.replaces,We=P.zoomImg,Pe=P.hasMask,Ye=P.style,ze=Ye===void 0?{}:Ye,ot=P.stylesPrev,Pt=ot===void 0?{}:ot,Rt=String(h),Ot=Object(C.useRef)(),kt=Object(C.useRef)(),Gt=Object(C.useState)(""),Kt=Object(N.a)(Gt,2),wt=Kt[0],_t=Kt[1],zt=Object(C.useState)("office"),Bt=Object(N.a)(zt,2),Xt=Bt[0],Nt=Bt[1],jt=function(){var St=new gt(kt.current);St.displayMode="popup",St.addRenderEventListener(function(){var Wt=Object(A.a)(S.a.mark(function yt(Ht){var Mt;return S.a.wrap(function(Ft){for(;;)switch(Ft.prev=Ft.next){case 0:return Ot.current.style.display="none",Ft.next=3,Object(ye.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Ht}});case 3:Mt=Ft.sent,Mt!=null&&Mt.id&&Ke(kt.current.getAttribute("src").replace(ie.a.API_SERVER,""),"/api/attachments/".concat(Mt==null?void 0:Mt.id,"?type=").concat(Mt.content_type));case 5:case"end":return Ft.stop()}},yt)}));return function(yt){return Wt.apply(this,arguments)}}()),St.show()},Zt=function(){var St=new ht(kt.current);St.settings.displayMode="popup",St.addEventListener("render",function(){var Wt=Object(A.a)(S.a.mark(function yt(Ht){var Mt;return S.a.wrap(function(Ft){for(;;)switch(Ft.prev=Ft.next){case 0:if(Ot.current.style.display="none",!kt.current){Ft.next=6;break}return Ft.next=4,Object(ye.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Ht.dataUrl}});case 4:Mt=Ft.sent,Mt!=null&&Mt.id&&Ke(kt.current.getAttribute("src").replace(ie.a.API_SERVER,""),"/api/attachments/".concat(Mt==null?void 0:Mt.id,"?type=").concat(Mt.content_type));case 6:case"end":return Ft.stop()}},yt)}));return function(yt){return Wt.apply(this,arguments)}}()),St.show(),window.markerArea=St},$t=Object(C.useMemo)(function(){try{var Ut=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,St=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Wt=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Rt=Rt.replace(Ut,"("+ie.a.API_SERVER+"/api/attachments/").replace(St,'"'+ie.a.API_SERVER+"/api/attachments/").replace(Wt,'"'+ie.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,`
`),Rt=Rt.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
`)}catch(Jt){}var yt=j(Rt),Ht=T();if(Rt.match(/\[TOC\]/)&&(yt=yt.replace("<p>[TOC]</p>",E()),f()),yt=yt.replace(/(__special_katext_id_\d+__)/g,function(Jt,Ft){var Qt=Ht[Ft],tr=Qt.type,rr=Qt.expression;return Object(pe.renderToString)(bt(rr)||"",{displayMode:tr==="block",throwOnError:!1,output:"html"})}),yt=yt.replace(/▁/g,"\u2581\u2581\u2581"),x(),ne){var Mt=document.createElement("div");return Mt.innerHTML=yt,Mt.innerText}return setTimeout(function(){return qt()},500),yt},[Rt]),Vt=Object(C.useRef)();c.WebkitLineClamp=ke,ke&&(ze=Object(D.a)(Object(D.a)({},ze),c));function Yt(Ut){var St=Ut.target;if(St.tagName.toUpperCase()==="IMG"){if(We){var Wt=St.getAttribute("src");_t(Wt),Nt("image")}}else if(St.tagName.toUpperCase()==="A"){var yt=St.getAttribute("href");if(yt.indexOf("office")>-1)Ut.preventDefault(),_t(yt),Nt("office");else if(yt.indexOf("application/pdf")>-1)Ut.preventDefault(),_t(yt),Nt("pdf");else if(yt.indexOf("type=text")>-1)Ut.preventDefault(),_t(yt),Nt("html");else if(yt.startsWith("#")){Ut.preventDefault();var Ht=document.getElementById(yt.replace("#",""));Ht&&Ht.scrollIntoView(!0)}}}var qt=function(){var St,Wt=(St=Vt.current)===null||St===void 0?void 0:St.querySelectorAll("video");Wt==null||Wt.forEach(function(yt){if(yt.oncontextmenu=function(){return!1},yt.src.indexOf(".m3u8")>-1&&!yt.canPlayType("application/vnd.apple.mpegurl")){if(J.a.isSupported()){var Ht=new J.a;Ht.loadSource(yt.src),Ht.attachMedia(yt)}}})};Object(C.useEffect)(function(){if(Vt.current&&$t&&($t.match(ct)&&window.PR.prettyPrint()),Vt.current)return Vt.current.addEventListener("click",Yt),function(){Vt.current.removeEventListener("click",Yt),x(),f()}},[$t,Vt.current,Yt]);var er=function(St){if(!U)return;St.target.nodeName==="IMG"?(Ot.current.style.display="flex",Ot.current.style.width=St.target.clientWidth+"px",Ot.current.style.height=St.target.clientHeight+"px",Ot.current.style.top=St.target.offsetTop+"px",Ot.current.style.left=St.target.offsetLeft+"px",kt.current.src=St.target.getAttribute("src")):Ot.current.style.display="none"};return d.a.createElement("div",{style:{position:"relative"}},d.a.createElement("div",{ref:Vt,style:Object(D.a)({},ze),className:"".concat(M||""," markdown-body ").concat(it.a.mdBody),onMouseOver:er,dangerouslySetInnerHTML:{__html:$t}}),d.a.createElement("div",{ref:Ot,className:it.a.button},d.a.createElement(B.a,null,d.a.createElement(_.a,{onClick:function(){return jt()}},"\u88C1\u526A"),d.a.createElement(_.a,{onClick:function(){return Zt()}},"\u7F16\u8F91"))),d.a.createElement("img",{ref:kt,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),d.a.createElement(ce.a,{close:!0,data:wt,hasMask:Pe,type:wt!=null&&wt.length?Xt:"",style:Object(D.a)({},Pt),onClose:function(){return _t("")}}))}},BU3w:function(et,he,K){"use strict";K.d(he,"a",function(){return A});var ue=K("MNnm"),B="rc-util-key";function w(N){if(N.attachTo)return N.attachTo;var k=document.querySelector("head");return k||document.body}function _(N){var k,S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ue.a)())return null;var C=document.createElement("style");if((k=S.csp)===null||k===void 0?void 0:k.nonce){var d;C.nonce=(d=S.csp)===null||d===void 0?void 0:d.nonce}C.innerHTML=N;var v=w(S),b=v.firstChild;return S.prepend&&v.prepend?v.prepend(C):S.prepend&&b?v.insertBefore(C,b):v.appendChild(C),C}var D=new Map;function A(N,k){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},C=w(S);if(!D.has(C)){var d=_("",S),v=d.parentNode;D.set(C,v),v.removeChild(d)}var b=Array.from(D.get(C).children).find(function(e){return e.tagName==="STYLE"&&e[B]===k});if(b){var p,m;if(((p=S.csp)===null||p===void 0?void 0:p.nonce)&&b.nonce!==((m=S.csp)===null||m===void 0?void 0:m.nonce)){var y;b.nonce=(y=S.csp)===null||y===void 0?void 0:y.nonce}return b.innerHTML!==N&&(b.innerHTML=N),b}var n=_(N,S);return n[B]=k,n}},"C/vA":function(et,he,K){"use strict";K.d(he,"a",function(){return ue});function ue(B){var w=this,_=!1,D;return function(){return _||(_=!0,D=B.apply(w,arguments)),D}}},"Cg/j":function(et,he,K){"use strict";K.d(he,"b",function(){return ue}),K.d(he,"a",function(){return B}),K.d(he,"c",function(){return _}),K.d(he,"d",function(){return D});var ue;(function(A){A.serviceIds=new Map,A.DI_TARGET="$di$target",A.DI_DEPENDENCIES="$di$dependencies";function N(k){return k[A.DI_DEPENDENCIES]||[]}A.getServiceDependencies=N})(ue||(ue={}));var B=_("instantiationService");function w(A,N,k,S){N[ue.DI_TARGET]===N?N[ue.DI_DEPENDENCIES].push({id:A,index:k,optional:S}):(N[ue.DI_DEPENDENCIES]=[{id:A,index:k,optional:S}],N[ue.DI_TARGET]=N)}function _(A){if(ue.serviceIds.has(A))return ue.serviceIds.get(A);var N=function(k,S,C){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");w(N,k,C,!1)};return N.toString=function(){return A},ue.serviceIds.set(A,N),N}function D(A){return function(N,k,S){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");w(A,N,S,!0)}}},DlQD:function(et,he,K){(function(ue,B){et.exports=B()})(this,function(){"use strict";function ue(oe,re){for(var ae=0;ae<re.length;ae++){var W=re[ae];W.enumerable=W.enumerable||!1,W.configurable=!0,"value"in W&&(W.writable=!0),Object.defineProperty(oe,W.key,W)}}function B(oe,re,ae){return re&&ue(oe.prototype,re),ae&&ue(oe,ae),oe}function w(oe,re){if(!oe)return;if(typeof oe=="string")return _(oe,re);var ae=Object.prototype.toString.call(oe).slice(8,-1);if(ae==="Object"&&oe.constructor&&(ae=oe.constructor.name),ae==="Map"||ae==="Set")return Array.from(oe);if(ae==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ae))return _(oe,re)}function _(oe,re){(re==null||re>oe.length)&&(re=oe.length);for(var ae=0,W=new Array(re);ae<re;ae++)W[ae]=oe[ae];return W}function D(oe,re){var ae;if(typeof Symbol=="undefined"||oe[Symbol.iterator]==null){if(Array.isArray(oe)||(ae=w(oe))||re&&oe&&typeof oe.length=="number"){ae&&(oe=ae);var W=0;return function(){return W>=oe.length?{done:!0}:{done:!1,value:oe[W++]}}}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 ae=oe[Symbol.iterator](),ae.next.bind(ae)}function A(oe,re){return re={exports:{}},oe(re,re.exports),re.exports}var N=A(function(oe){function re(){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 ae(W){oe.exports.defaults=W}oe.exports={defaults:re(),getDefaults:re,changeDefaults:ae}}),k=N.defaults,S=N.getDefaults,C=N.changeDefaults,d=/[&<>"']/,v=/[&<>"']/g,b=/[<>"']|&(?!#?\w+;)/,p=/[<>"']|&(?!#?\w+;)/g,m={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},y=function(re){return m[re]};function n(oe,re){if(re){if(d.test(oe))return oe.replace(v,y)}else if(b.test(oe))return oe.replace(p,y);return oe}var e=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function t(oe){return oe.replace(e,function(re,ae){return ae=ae.toLowerCase(),ae==="colon"?":":ae.charAt(0)==="#"?ae.charAt(1)==="x"?String.fromCharCode(parseInt(ae.substring(2),16)):String.fromCharCode(+ae.substring(1)):""})}var r=/(^|[^\[])\^/g;function f(oe,re){oe=oe.source||oe,re=re||"";var ae={replace:function(H,Y){return Y=Y.source||Y,Y=Y.replace(r,"$1"),oe=oe.replace(H,Y),ae},getRegex:function(){return new RegExp(oe,re)}};return ae}var c=/[^\w:]/g,u=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function E(oe,re,ae){if(oe){var W;try{W=decodeURIComponent(t(ae)).replace(c,"").toLowerCase()}catch(H){return null}if(W.indexOf("javascript:")===0||W.indexOf("vbscript:")===0||W.indexOf("data:")===0)return null}re&&!u.test(ae)&&(ae=l(re,ae));try{ae=encodeURI(ae).replace(/%25/g,"%")}catch(H){return null}return ae}var g={},s=/^[^:]+:\/*[^/]*$/,a=/^([^:]+:)[\s\S]*$/,i=/^([^:]+:\/*[^/]*)[\s\S]*$/;function l(oe,re){g[" "+oe]||(s.test(oe)?g[" "+oe]=oe+"/":g[" "+oe]=R(oe,"/",!0)),oe=g[" "+oe];var ae=oe.indexOf(":")===-1;return re.substring(0,2)==="//"?ae?re:oe.replace(a,"$1")+re:re.charAt(0)==="/"?ae?re:oe.replace(i,"$1")+re:oe+re}var T={exec:function(){}};function x(oe){for(var re=1,ae,W;re<arguments.length;re++){ae=arguments[re];for(W in ae)Object.prototype.hasOwnProperty.call(ae,W)&&(oe[W]=ae[W])}return oe}function L(oe,re){var ae=oe.replace(/\|/g,function(Y,ee,me){for(var Ce=!1,Be=ee;--Be>=0&&me[Be]==="\\";)Ce=!Ce;return Ce?"|":" |"}),W=ae.split(/ \|/),H=0;if(W.length>re)W.splice(re);else for(;W.length<re;)W.push("");for(;H<W.length;H++)W[H]=W[H].trim().replace(/\\\|/g,"|");return W}function R(oe,re,ae){var W=oe.length;if(W===0)return"";for(var H=0;H<W;){var Y=oe.charAt(W-H-1);if(Y===re&&!ae)H++;else if(Y!==re&&ae)H++;else break}return oe.substr(0,W-H)}function I(oe,re){if(oe.indexOf(re[1])===-1)return-1;for(var ae=oe.length,W=0,H=0;H<ae;H++)if(oe[H]==="\\")H++;else if(oe[H]===re[0])W++;else if(oe[H]===re[1]&&(W--,W<0))return H;return-1}function F(oe){oe&&oe.sanitize&&!oe.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var j={escape:n,unescape:t,edit:f,cleanUrl:E,resolveUrl:l,noopTest:T,merge:x,splitCells:L,rtrim:R,findClosingBracket:I,checkSanitizeDeprecation:F},z=N.defaults,Q=j.rtrim,J=j.splitCells,ie=j.escape,pe=j.findClosingBracket;function ce(oe,re,ae){var W=re.href,H=re.title?ie(re.title):null,Y=oe[1].replace(/\\([\[\]])/g,"$1");return oe[0].charAt(0)!=="!"?{type:"link",raw:ae,href:W,title:H,text:Y}:{type:"image",raw:ae,href:W,title:H,text:ie(Y)}}function ye(oe,re){var ae=oe.match(/^(\s+)(?:```)/);if(ae===null)return re;var W=ae[1];return re.split(`
`).map(function(H){var Y=H.match(/^\s+/);if(Y===null)return H;var ee=Y[0];return ee.length>=W.length?H.slice(W.length):H}).join(`
`)}var ve=function(){function oe(ae){this.options=ae||z}var re=oe.prototype;return re.space=function(W){var H=this.rules.block.newline.exec(W);if(H)return H[0].length>1?{type:"space",raw:H[0]}:{raw:`
`}},re.code=function(W,H){var Y=this.rules.block.code.exec(W);if(Y){var ee=H[H.length-1];if(ee&&ee.type==="paragraph")return{raw:Y[0],text:Y[0].trimRight()};var me=Y[0].replace(/^ {4}/gm,"");return{type:"code",raw:Y[0],codeBlockStyle:"indented",text:this.options.pedantic?me:Q(me,`
`)}}},re.fences=function(W){var H=this.rules.block.fences.exec(W);if(H){var Y=H[0],ee=ye(Y,H[3]||"");return{type:"code",raw:Y,lang:H[2]?H[2].trim():H[2],text:ee}}},re.heading=function(W){var H=this.rules.block.heading.exec(W);if(H)return{type:"heading",raw:H[0],depth:H[1].length,text:H[2]}},re.nptable=function(W){var H=this.rules.block.nptable.exec(W);if(H){var Y={type:"table",header:J(H[1].replace(/^ *| *\| *$/g,"")),align:H[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:H[3]?H[3].replace(/\n$/,"").split(`
`):[],raw:H[0]};if(Y.header.length===Y.align.length){var ee=Y.align.length,me;for(me=0;me<ee;me++)/^ *-+: *$/.test(Y.align[me])?Y.align[me]="right":/^ *:-+: *$/.test(Y.align[me])?Y.align[me]="center":/^ *:-+ *$/.test(Y.align[me])?Y.align[me]="left":Y.align[me]=null;for(ee=Y.cells.length,me=0;me<ee;me++)Y.cells[me]=J(Y.cells[me],Y.header.length);return Y}}},re.hr=function(W){var H=this.rules.block.hr.exec(W);if(H)return{type:"hr",raw:H[0]}},re.blockquote=function(W){var H=this.rules.block.blockquote.exec(W);if(H){var Y=H[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:H[0],text:Y}}},re.list=function(W){var H=this.rules.block.list.exec(W);if(H){for(var Y=H[0],ee=H[2],me=ee.length>1,Ce=ee[ee.length-1]===")",Be={type:"list",raw:Y,ordered:me,start:me?+ee.slice(0,-1):"",loose:!1,items:[]},Ge=H[0].match(this.rules.block.item),Qe=!1,Ve,qe,at,Je,Ct,ht,Lt,xt=Ge.length,rt=0;rt<xt;rt++)Ve=Ge[rt],Y=Ve,qe=Ve.length,Ve=Ve.replace(/^ *([*+-]|\d+[.)]) */,""),~Ve.indexOf(`
`)&&(qe-=Ve.length,Ve=this.options.pedantic?Ve.replace(/^ {1,4}/gm,""):Ve.replace(new RegExp("^ {1,"+qe+"}","gm"),"")),rt!==xt-1&&(at=this.rules.block.bullet.exec(Ge[rt+1])[0],(me?at.length===1||!Ce&&at[at.length-1]===")":at.length>1||this.options.smartLists&&at!==ee)&&(Je=Ge.slice(rt+1).join(`
`),Be.raw=Be.raw.substring(0,Be.raw.length-Je.length),rt=xt-1)),Ct=Qe||/\n\n(?!\s*$)/.test(Ve),rt!==xt-1&&(Qe=Ve.charAt(Ve.length-1)===`
`,Ct||(Ct=Qe)),Ct&&(Be.loose=!0),ht=/^\[[ xX]\] /.test(Ve),Lt=void 0,ht&&(Lt=Ve[1]!==" ",Ve=Ve.replace(/^\[[ xX]\] +/,"")),Be.items.push({type:"list_item",raw:Y,task:ht,checked:Lt,loose:Ct,text:Ve});return Be}},re.html=function(W){var H=this.rules.block.html.exec(W);if(H)return{type:this.options.sanitize?"paragraph":"html",raw:H[0],pre:!this.options.sanitizer&&(H[1]==="pre"||H[1]==="script"||H[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(H[0]):ie(H[0]):H[0]}},re.def=function(W){var H=this.rules.block.def.exec(W);if(H){H[3]&&(H[3]=H[3].substring(1,H[3].length-1));var Y=H[1].toLowerCase().replace(/\s+/g," ");return{tag:Y,raw:H[0],href:H[2],title:H[3]}}},re.table=function(W){var H=this.rules.block.table.exec(W);if(H){var Y={type:"table",header:J(H[1].replace(/^ *| *\| *$/g,"")),align:H[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:H[3]?H[3].replace(/\n$/,"").split(`
`):[]};if(Y.header.length===Y.align.length){Y.raw=H[0];var ee=Y.align.length,me;for(me=0;me<ee;me++)/^ *-+: *$/.test(Y.align[me])?Y.align[me]="right":/^ *:-+: *$/.test(Y.align[me])?Y.align[me]="center":/^ *:-+ *$/.test(Y.align[me])?Y.align[me]="left":Y.align[me]=null;for(ee=Y.cells.length,me=0;me<ee;me++)Y.cells[me]=J(Y.cells[me].replace(/^ *\| *| *\| *$/g,""),Y.header.length);return Y}}},re.lheading=function(W){var H=this.rules.block.lheading.exec(W);if(H)return{type:"heading",raw:H[0],depth:H[2].charAt(0)==="="?1:2,text:H[1]}},re.paragraph=function(W){var H=this.rules.block.paragraph.exec(W);if(H)return{type:"paragraph",raw:H[0],text:H[1].charAt(H[1].length-1)===`
`?H[1].slice(0,-1):H[1]}},re.text=function(W,H){var Y=this.rules.block.text.exec(W);if(Y){var ee=H[H.length-1];return ee&&ee.type==="text"?{raw:Y[0],text:Y[0]}:{type:"text",raw:Y[0],text:Y[0]}}},re.escape=function(W){var H=this.rules.inline.escape.exec(W);if(H)return{type:"escape",raw:H[0],text:ie(H[1])}},re.tag=function(W,H,Y){var ee=this.rules.inline.tag.exec(W);if(ee)return!H&&/^<a /i.test(ee[0])?H=!0:H&&/^<\/a>/i.test(ee[0])&&(H=!1),!Y&&/^<(pre|code|kbd|script)(\s|>)/i.test(ee[0])?Y=!0:Y&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ee[0])&&(Y=!1),{type:this.options.sanitize?"text":"html",raw:ee[0],inLink:H,inRawBlock:Y,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ee[0]):ie(ee[0]):ee[0]}},re.link=function(W){var H=this.rules.inline.link.exec(W);if(H){var Y=pe(H[2],"()");if(Y>-1){var ee=H[0].indexOf("!")===0?5:4,me=ee+H[1].length+Y;H[2]=H[2].substring(0,Y),H[0]=H[0].substring(0,me).trim(),H[3]=""}var Ce=H[2],Be="";if(this.options.pedantic){var Ge=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ce);Ge?(Ce=Ge[1],Be=Ge[3]):Be=""}else Be=H[3]?H[3].slice(1,-1):"";Ce=Ce.trim().replace(/^<([\s\S]*)>$/,"$1");var Qe=ce(H,{href:Ce&&Ce.replace(this.rules.inline._escapes,"$1"),title:Be&&Be.replace(this.rules.inline._escapes,"$1")},H[0]);return Qe}},re.reflink=function(W,H){var Y;if((Y=this.rules.inline.reflink.exec(W))||(Y=this.rules.inline.nolink.exec(W))){var ee=(Y[2]||Y[1]).replace(/\s+/g," ");if(ee=H[ee.toLowerCase()],!ee||!ee.href){var me=Y[0].charAt(0);return{type:"text",raw:me,text:me}}var Ce=ce(Y,ee,Y[0]);return Ce}},re.strong=function(W,H,Y){Y===void 0&&(Y="");var ee=this.rules.inline.strong.start.exec(W);if(ee&&(!ee[1]||ee[1]&&(Y===""||this.rules.inline.punctuation.exec(Y)))){H=H.slice(-1*W.length);var me=ee[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;me.lastIndex=0;for(var Ce;(ee=me.exec(H))!=null;)if(Ce=this.rules.inline.strong.middle.exec(H.slice(0,ee.index+3)),Ce)return{type:"strong",raw:W.slice(0,Ce[0].length),text:W.slice(2,Ce[0].length-2)}}},re.em=function(W,H,Y){Y===void 0&&(Y="");var ee=this.rules.inline.em.start.exec(W);if(ee&&(!ee[1]||ee[1]&&(Y===""||this.rules.inline.punctuation.exec(Y)))){H=H.slice(-1*W.length);var me=ee[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;me.lastIndex=0;for(var Ce;(ee=me.exec(H))!=null;)if(Ce=this.rules.inline.em.middle.exec(H.slice(0,ee.index+2)),Ce)return{type:"em",raw:W.slice(0,Ce[0].length),text:W.slice(1,Ce[0].length-1)}}},re.codespan=function(W){var H=this.rules.inline.code.exec(W);if(H){var Y=H[2].replace(/\n/g," "),ee=/[^ ]/.test(Y),me=Y.startsWith(" ")&&Y.endsWith(" ");return ee&&me&&(Y=Y.substring(1,Y.length-1)),Y=ie(Y,!0),{type:"codespan",raw:H[0],text:Y}}},re.br=function(W){var H=this.rules.inline.br.exec(W);if(H)return{type:"br",raw:H[0]}},re.del=function(W){var H=this.rules.inline.del.exec(W);if(H)return{type:"del",raw:H[0],text:H[1]}},re.autolink=function(W,H){var Y=this.rules.inline.autolink.exec(W);if(Y){var ee,me;return Y[2]==="@"?(ee=ie(this.options.mangle?H(Y[1]):Y[1]),me="mailto:"+ee):(ee=ie(Y[1]),me=ee),{type:"link",raw:Y[0],text:ee,href:me,tokens:[{type:"text",raw:ee,text:ee}]}}},re.url=function(W,H){var Y;if(Y=this.rules.inline.url.exec(W)){var ee,me;if(Y[2]==="@")ee=ie(this.options.mangle?H(Y[0]):Y[0]),me="mailto:"+ee;else{var Ce;do Ce=Y[0],Y[0]=this.rules.inline._backpedal.exec(Y[0])[0];while(Ce!==Y[0]);ee=ie(Y[0]),Y[1]==="www."?me="http://"+ee:me=ee}return{type:"link",raw:Y[0],text:ee,href:me,tokens:[{type:"text",raw:ee,text:ee}]}}},re.inlineText=function(W,H,Y){var ee=this.rules.inline.text.exec(W);if(ee){var me;return H?me=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ee[0]):ie(ee[0]):ee[0]:me=ie(this.options.smartypants?Y(ee[0]):ee[0]),{type:"text",raw:ee[0],text:me}}},oe}(),Z=j.noopTest,q=j.edit,se=j.merge,V={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:Z,table:Z,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};V._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,V._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,V.def=q(V.def).replace("label",V._label).replace("title",V._title).getRegex(),V.bullet=/(?:[*+-]|\d{1,9}[.)])/,V.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,V.item=q(V.item,"gm").replace(/bull/g,V.bullet).getRegex(),V.list=q(V.list).replace(/bull/g,V.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+V.def.source+")").getRegex(),V._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",V._comment=/<!--(?!-?>)[\s\S]*?-->/,V.html=q(V.html,"i").replace("comment",V._comment).replace("tag",V._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),V.paragraph=q(V._paragraph).replace("hr",V.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",V._tag).getRegex(),V.blockquote=q(V.blockquote).replace("paragraph",V.paragraph).getRegex(),V.normal=se({},V),V.gfm=se({},V.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*|$)"}),V.gfm.nptable=q(V.gfm.nptable).replace("hr",V.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",V._tag).getRegex(),V.gfm.table=q(V.gfm.table).replace("hr",V.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",V._tag).getRegex(),V.pedantic=se({},V.normal,{html:q(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",V._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:Z,paragraph:q(V.normal._paragraph).replace("hr",V.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",V.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var G={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Z,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:Z,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};G._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",G.punctuation=q(G.punctuation).replace(/punctuation/g,G._punctuation).getRegex(),G._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",G._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",G.em.start=q(G.em.start).replace(/punctuation/g,G._punctuation).getRegex(),G.em.middle=q(G.em.middle).replace(/punctuation/g,G._punctuation).replace(/overlapSkip/g,G._overlapSkip).getRegex(),G.em.endAst=q(G.em.endAst,"g").replace(/punctuation/g,G._punctuation).getRegex(),G.em.endUnd=q(G.em.endUnd,"g").replace(/punctuation/g,G._punctuation).getRegex(),G.strong.start=q(G.strong.start).replace(/punctuation/g,G._punctuation).getRegex(),G.strong.middle=q(G.strong.middle).replace(/punctuation/g,G._punctuation).replace(/blockSkip/g,G._blockSkip).getRegex(),G.strong.endAst=q(G.strong.endAst,"g").replace(/punctuation/g,G._punctuation).getRegex(),G.strong.endUnd=q(G.strong.endUnd,"g").replace(/punctuation/g,G._punctuation).getRegex(),G.blockSkip=q(G._blockSkip,"g").getRegex(),G.overlapSkip=q(G._overlapSkip,"g").getRegex(),G._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,G._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,G._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])?)+(?![-_])/,G.autolink=q(G.autolink).replace("scheme",G._scheme).replace("email",G._email).getRegex(),G._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,G.tag=q(G.tag).replace("comment",V._comment).replace("attribute",G._attribute).getRegex(),G._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,G._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,G._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,G.link=q(G.link).replace("label",G._label).replace("href",G._href).replace("title",G._title).getRegex(),G.reflink=q(G.reflink).replace("label",G._label).getRegex(),G.reflinkSearch=q(G.reflinkSearch,"g").replace("reflink",G.reflink).replace("nolink",G.nolink).getRegex(),G.normal=se({},G),G.pedantic=se({},G.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",G._label).getRegex(),reflink:q(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",G._label).getRegex()}),G.gfm=se({},G.normal,{escape:q(G.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),G.gfm.url=q(G.gfm.url,"i").replace("email",G.gfm._extended_email).getRegex(),G.breaks=se({},G.gfm,{br:q(G.br).replace("{2,}","*").getRegex(),text:q(G.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var be={block:V,inline:G},Re=N.defaults,De=be.block,Me=be.inline;function X(oe){return oe.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function $(oe){var re="",ae,W,H=oe.length;for(ae=0;ae<H;ae++)W=oe.charCodeAt(ae),Math.random()>.5&&(W="x"+W.toString(16)),re+="&#"+W+";";return re}var te=function(){function oe(ae){this.tokens=[],this.tokens.links=Object.create(null),this.options=ae||Re,this.options.tokenizer=this.options.tokenizer||new ve,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var W={block:De.normal,inline:Me.normal};this.options.pedantic?(W.block=De.pedantic,W.inline=Me.pedantic):this.options.gfm&&(W.block=De.gfm,this.options.breaks?W.inline=Me.breaks:W.inline=Me.gfm),this.tokenizer.rules=W}oe.lex=function(W,H){var Y=new oe(H);return Y.lex(W)};var re=oe.prototype;return re.lex=function(W){return W=W.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(W,this.tokens,!0),this.inline(this.tokens),this.tokens},re.blockTokens=function(W,H,Y){H===void 0&&(H=[]),Y===void 0&&(Y=!0),W=W.replace(/^ +$/gm,"");for(var ee,me,Ce,Be;W;){if(ee=this.tokenizer.space(W)){W=W.substring(ee.raw.length),ee.type&&H.push(ee);continue}if(ee=this.tokenizer.code(W,H)){W=W.substring(ee.raw.length),ee.type?H.push(ee):(Be=H[H.length-1],Be.raw+=`
`+ee.raw,Be.text+=`
`+ee.text);continue}if(ee=this.tokenizer.fences(W)){W=W.substring(ee.raw.length),H.push(ee);continue}if(ee=this.tokenizer.heading(W)){W=W.substring(ee.raw.length),H.push(ee);continue}if(ee=this.tokenizer.nptable(W)){W=W.substring(ee.raw.length),H.push(ee);continue}if(ee=this.tokenizer.hr(W)){W=W.substring(ee.raw.length),H.push(ee);continue}if(ee=this.tokenizer.blockquote(W)){W=W.substring(ee.raw.length),ee.tokens=this.blockTokens(ee.text,[],Y),H.push(ee);continue}if(ee=this.tokenizer.list(W)){for(W=W.substring(ee.raw.length),Ce=ee.items.length,me=0;me<Ce;me++)ee.items[me].tokens=this.blockTokens(ee.items[me].text,[],!1);H.push(ee);continue}if(ee=this.tokenizer.html(W)){W=W.substring(ee.raw.length),H.push(ee);continue}if(Y&&(ee=this.tokenizer.def(W))){W=W.substring(ee.raw.length),this.tokens.links[ee.tag]||(this.tokens.links[ee.tag]={href:ee.href,title:ee.title});continue}if(ee=this.tokenizer.table(W)){W=W.substring(ee.raw.length),H.push(ee);continue}if(ee=this.tokenizer.lheading(W)){W=W.substring(ee.raw.length),H.push(ee);continue}if(Y&&(ee=this.tokenizer.paragraph(W))){W=W.substring(ee.raw.length),H.push(ee);continue}if(ee=this.tokenizer.text(W,H)){W=W.substring(ee.raw.length),ee.type?H.push(ee):(Be=H[H.length-1],Be.raw+=`
`+ee.raw,Be.text+=`
`+ee.text);continue}if(W){var Ge="Infinite loop on byte: "+W.charCodeAt(0);if(this.options.silent){console.error(Ge);break}else throw new Error(Ge)}}return H},re.inline=function(W){var H,Y,ee,me,Ce,Be,Ge=W.length;for(H=0;H<Ge;H++){Be=W[H];switch(Be.type){case"paragraph":case"text":case"heading":{Be.tokens=[],this.inlineTokens(Be.text,Be.tokens);break}case"table":{for(Be.tokens={header:[],cells:[]},me=Be.header.length,Y=0;Y<me;Y++)Be.tokens.header[Y]=[],this.inlineTokens(Be.header[Y],Be.tokens.header[Y]);for(me=Be.cells.length,Y=0;Y<me;Y++)for(Ce=Be.cells[Y],Be.tokens.cells[Y]=[],ee=0;ee<Ce.length;ee++)Be.tokens.cells[Y][ee]=[],this.inlineTokens(Ce[ee],Be.tokens.cells[Y][ee]);break}case"blockquote":{this.inline(Be.tokens);break}case"list":{for(me=Be.items.length,Y=0;Y<me;Y++)this.inline(Be.items[Y].tokens);break}}}return W},re.inlineTokens=function(W,H,Y,ee,me){H===void 0&&(H=[]),Y===void 0&&(Y=!1),ee===void 0&&(ee=!1),me===void 0&&(me="");var Ce,Be=W,Ge;if(this.tokens.links){var Qe=Object.keys(this.tokens.links);if(Qe.length>0)for(;(Ge=this.tokenizer.rules.inline.reflinkSearch.exec(Be))!=null;)Qe.includes(Ge[0].slice(Ge[0].lastIndexOf("[")+1,-1))&&(Be=Be.slice(0,Ge.index)+"["+"a".repeat(Ge[0].length-2)+"]"+Be.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ge=this.tokenizer.rules.inline.blockSkip.exec(Be))!=null;)Be=Be.slice(0,Ge.index)+"["+"a".repeat(Ge[0].length-2)+"]"+Be.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;W;){if(Ce=this.tokenizer.escape(W)){W=W.substring(Ce.raw.length),H.push(Ce);continue}if(Ce=this.tokenizer.tag(W,Y,ee)){W=W.substring(Ce.raw.length),Y=Ce.inLink,ee=Ce.inRawBlock,H.push(Ce);continue}if(Ce=this.tokenizer.link(W)){W=W.substring(Ce.raw.length),Ce.type==="link"&&(Ce.tokens=this.inlineTokens(Ce.text,[],!0,ee)),H.push(Ce);continue}if(Ce=this.tokenizer.reflink(W,this.tokens.links)){W=W.substring(Ce.raw.length),Ce.type==="link"&&(Ce.tokens=this.inlineTokens(Ce.text,[],!0,ee)),H.push(Ce);continue}if(Ce=this.tokenizer.strong(W,Be,me)){W=W.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],Y,ee),H.push(Ce);continue}if(Ce=this.tokenizer.em(W,Be,me)){W=W.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],Y,ee),H.push(Ce);continue}if(Ce=this.tokenizer.codespan(W)){W=W.substring(Ce.raw.length),H.push(Ce);continue}if(Ce=this.tokenizer.br(W)){W=W.substring(Ce.raw.length),H.push(Ce);continue}if(Ce=this.tokenizer.del(W)){W=W.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],Y,ee),H.push(Ce);continue}if(Ce=this.tokenizer.autolink(W,$)){W=W.substring(Ce.raw.length),H.push(Ce);continue}if(!Y&&(Ce=this.tokenizer.url(W,$))){W=W.substring(Ce.raw.length),H.push(Ce);continue}if(Ce=this.tokenizer.inlineText(W,ee,X)){W=W.substring(Ce.raw.length),me=Ce.raw.slice(-1),H.push(Ce);continue}if(W){var Ve="Infinite loop on byte: "+W.charCodeAt(0);if(this.options.silent){console.error(Ve);break}else throw new Error(Ve)}}return H},B(oe,null,[{key:"rules",get:function(){return{block:De,inline:Me}}}]),oe}(),de=N.defaults,fe=j.cleanUrl,we=j.escape,Ie=function(){function oe(ae){this.options=ae||de}var re=oe.prototype;return re.code=function(W,H,Y){var ee=(H||"").match(/\S*/)[0];if(this.options.highlight){var me=this.options.highlight(W,ee);me!=null&&me!==W&&(Y=!0,W=me)}return ee?'<pre><code class="'+this.options.langPrefix+we(ee,!0)+'">'+(Y?W:we(W,!0))+`</code></pre>
`:"<pre><code>"+(Y?W:we(W,!0))+`</code></pre>
`},re.blockquote=function(W){return`<blockquote>
`+W+`</blockquote>
`},re.html=function(W){return W},re.heading=function(W,H,Y,ee){return this.options.headerIds?"<h"+H+' id="'+this.options.headerPrefix+ee.slug(Y)+'">'+W+"</h"+H+`>
`:"<h"+H+">"+W+"</h"+H+`>
`},re.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},re.list=function(W,H,Y){var ee=H?"ol":"ul",me=H&&Y!==1?' start="'+Y+'"':"";return"<"+ee+me+`>
`+W+"</"+ee+`>
`},re.listitem=function(W){return"<li>"+W+`</li>
`},re.checkbox=function(W){return"<input "+(W?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},re.paragraph=function(W){return"<p>"+W+`</p>
`},re.table=function(W,H){return H&&(H="<tbody>"+H+"</tbody>"),`<table>
<thead>
`+W+`</thead>
`+H+`</table>
`},re.tablerow=function(W){return`<tr>
`+W+`</tr>
`},re.tablecell=function(W,H){var Y=H.header?"th":"td",ee=H.align?"<"+Y+' align="'+H.align+'">':"<"+Y+">";return ee+W+"</"+Y+`>
`},re.strong=function(W){return"<strong>"+W+"</strong>"},re.em=function(W){return"<em>"+W+"</em>"},re.codespan=function(W){return"<code>"+W+"</code>"},re.br=function(){return this.options.xhtml?"<br/>":"<br>"},re.del=function(W){return"<del>"+W+"</del>"},re.link=function(W,H,Y){if(W=fe(this.options.sanitize,this.options.baseUrl,W),W===null)return Y;var ee='<a href="'+we(W)+'"';return H&&(ee+=' title="'+H+'"'),ee+=">"+Y+"</a>",ee},re.image=function(W,H,Y){if(W=fe(this.options.sanitize,this.options.baseUrl,W),W===null)return Y;var ee='<img src="'+W+'" alt="'+Y+'"';return H&&(ee+=' title="'+H+'"'),ee+=this.options.xhtml?"/>":">",ee},re.text=function(W){return W},oe}(),_e=function(){function oe(){}var re=oe.prototype;return re.strong=function(W){return W},re.em=function(W){return W},re.codespan=function(W){return W},re.del=function(W){return W},re.html=function(W){return W},re.text=function(W){return W},re.link=function(W,H,Y){return""+Y},re.image=function(W,H,Y){return""+Y},re.br=function(){return""},oe}(),Fe=function(){function oe(){this.seen={}}var re=oe.prototype;return re.slug=function(W){var H=W.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(H)){var Y=H;do this.seen[Y]++,H=Y+"-"+this.seen[Y];while(this.seen.hasOwnProperty(H))}return this.seen[H]=0,H},oe}(),le=N.defaults,ge=j.unescape,Ee=function(){function oe(ae){this.options=ae||le,this.options.renderer=this.options.renderer||new Ie,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new _e,this.slugger=new Fe}oe.parse=function(W,H){var Y=new oe(H);return Y.parse(W)};var re=oe.prototype;return re.parse=function(W,H){H===void 0&&(H=!0);var Y="",ee,me,Ce,Be,Ge,Qe,Ve,qe,at,Je,Ct,ht,Lt,xt,rt,Dt,At,$e,Xe=W.length;for(ee=0;ee<Xe;ee++){Je=W[ee];switch(Je.type){case"space":continue;case"hr":{Y+=this.renderer.hr();continue}case"heading":{Y+=this.renderer.heading(this.parseInline(Je.tokens),Je.depth,ge(this.parseInline(Je.tokens,this.textRenderer)),this.slugger);continue}case"code":{Y+=this.renderer.code(Je.text,Je.lang,Je.escaped);continue}case"table":{for(qe="",Ve="",Be=Je.header.length,me=0;me<Be;me++)Ve+=this.renderer.tablecell(this.parseInline(Je.tokens.header[me]),{header:!0,align:Je.align[me]});for(qe+=this.renderer.tablerow(Ve),at="",Be=Je.cells.length,me=0;me<Be;me++){for(Qe=Je.tokens.cells[me],Ve="",Ge=Qe.length,Ce=0;Ce<Ge;Ce++)Ve+=this.renderer.tablecell(this.parseInline(Qe[Ce]),{header:!1,align:Je.align[Ce]});at+=this.renderer.tablerow(Ve)}Y+=this.renderer.table(qe,at);continue}case"blockquote":{at=this.parse(Je.tokens),Y+=this.renderer.blockquote(at);continue}case"list":{for(Ct=Je.ordered,ht=Je.start,Lt=Je.loose,Be=Je.items.length,at="",me=0;me<Be;me++)rt=Je.items[me],Dt=rt.checked,At=rt.task,xt="",rt.task&&($e=this.renderer.checkbox(Dt),Lt?rt.tokens.length>0&&rt.tokens[0].type==="text"?(rt.tokens[0].text=$e+" "+rt.tokens[0].text,rt.tokens[0].tokens&&rt.tokens[0].tokens.length>0&&rt.tokens[0].tokens[0].type==="text"&&(rt.tokens[0].tokens[0].text=$e+" "+rt.tokens[0].tokens[0].text)):rt.tokens.unshift({type:"text",text:$e}):xt+=$e),xt+=this.parse(rt.tokens,Lt),at+=this.renderer.listitem(xt,At,Dt);Y+=this.renderer.list(at,Ct,ht);continue}case"html":{Y+=this.renderer.html(Je.text);continue}case"paragraph":{Y+=this.renderer.paragraph(this.parseInline(Je.tokens));continue}case"text":{for(at=Je.tokens?this.parseInline(Je.tokens):Je.text;ee+1<Xe&&W[ee+1].type==="text";)Je=W[++ee],at+=`
`+(Je.tokens?this.parseInline(Je.tokens):Je.text);Y+=H?this.renderer.paragraph(at):at;continue}default:{var je='Token with "'+Je.type+'" type was not found.';if(this.options.silent){console.error(je);return}else throw new Error(je)}}}return Y},re.parseInline=function(W,H){H=H||this.renderer;var Y="",ee,me,Ce=W.length;for(ee=0;ee<Ce;ee++){me=W[ee];switch(me.type){case"escape":{Y+=H.text(me.text);break}case"html":{Y+=H.html(me.text);break}case"link":{Y+=H.link(me.href,me.title,this.parseInline(me.tokens,H));break}case"image":{Y+=H.image(me.href,me.title,me.text);break}case"strong":{Y+=H.strong(this.parseInline(me.tokens,H));break}case"em":{Y+=H.em(this.parseInline(me.tokens,H));break}case"codespan":{Y+=H.codespan(me.text);break}case"br":{Y+=H.br();break}case"del":{Y+=H.del(this.parseInline(me.tokens,H));break}case"text":{Y+=H.text(me.text);break}default:{var Be='Token with "'+me.type+'" type was not found.';if(this.options.silent){console.error(Be);return}else throw new Error(Be)}}}return Y},oe}(),Se=j.merge,Ae=j.checkSanitizeDeprecation,Le=j.escape,xe=N.getDefaults,Oe=N.changeDefaults,Ue=N.defaults;function Te(oe,re,ae){if(typeof oe=="undefined"||oe===null)throw new Error("marked(): input parameter is undefined or null");if(typeof oe!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(oe)+", string expected");if(typeof re=="function"&&(ae=re,re=null),re=Se({},Te.defaults,re||{}),Ae(re),ae){var W=re.highlight,H;try{H=te.lex(oe,re)}catch(Ce){return ae(Ce)}var Y=function(Be){var Ge;if(!Be)try{Ge=Ee.parse(H,re)}catch(Qe){Be=Qe}return re.highlight=W,Be?ae(Be):ae(null,Ge)};if(!W||W.length<3)return Y();if(delete re.highlight,!H.length)return Y();var ee=0;Te.walkTokens(H,function(Ce){Ce.type==="code"&&(ee++,setTimeout(function(){W(Ce.text,Ce.lang,function(Be,Ge){if(Be)return Y(Be);Ge!=null&&Ge!==Ce.text&&(Ce.text=Ge,Ce.escaped=!0),ee--,ee===0&&Y()})},0))}),ee===0&&Y();return}try{var me=te.lex(oe,re);return re.walkTokens&&Te.walkTokens(me,re.walkTokens),Ee.parse(me,re)}catch(Ce){if(Ce.message+=`
Please report this to https://github.com/markedjs/marked.`,re.silent)return"<p>An error occurred:</p><pre>"+Le(Ce.message+"",!0)+"</pre>";throw Ce}}Te.options=Te.setOptions=function(oe){return Se(Te.defaults,oe),Oe(Te.defaults),Te},Te.getDefaults=xe,Te.defaults=Ue,Te.use=function(oe){var re=Se({},oe);if(oe.renderer&&function(){var W=Te.defaults.renderer||new Ie,H=function(me){var Ce=W[me];W[me]=function(){for(var Be=arguments.length,Ge=new Array(Be),Qe=0;Qe<Be;Qe++)Ge[Qe]=arguments[Qe];var Ve=oe.renderer[me].apply(W,Ge);return Ve===!1&&(Ve=Ce.apply(W,Ge)),Ve}};for(var Y in oe.renderer)H(Y);re.renderer=W}(),oe.tokenizer&&function(){var W=Te.defaults.tokenizer||new ve,H=function(me){var Ce=W[me];W[me]=function(){for(var Be=arguments.length,Ge=new Array(Be),Qe=0;Qe<Be;Qe++)Ge[Qe]=arguments[Qe];var Ve=oe.tokenizer[me].apply(W,Ge);return Ve===!1&&(Ve=Ce.apply(W,Ge)),Ve}};for(var Y in oe.tokenizer)H(Y);re.tokenizer=W}(),oe.walkTokens){var ae=Te.defaults.walkTokens;re.walkTokens=function(W){oe.walkTokens(W),ae&&ae(W)}}Te.setOptions(re)},Te.walkTokens=function(oe,re){for(var ae=D(oe),W;!(W=ae()).done;){var H=W.value;re(H);switch(H.type){case"table":{for(var Y=D(H.tokens.header),ee;!(ee=Y()).done;){var me=ee.value;Te.walkTokens(me,re)}for(var Ce=D(H.tokens.cells),Be;!(Be=Ce()).done;)for(var Ge=Be.value,Qe=D(Ge),Ve;!(Ve=Qe()).done;){var qe=Ve.value;Te.walkTokens(qe,re)}break}case"list":{Te.walkTokens(H.items,re);break}default:H.tokens&&Te.walkTokens(H.tokens,re)}}},Te.Parser=Ee,Te.parser=Ee.parse,Te.Renderer=Ie,Te.TextRenderer=_e,Te.Lexer=te,Te.lexer=te.lex,Te.Tokenizer=ve,Te.Slugger=Fe,Te.parse=Te;var Ne=Te;return Ne})},Etsf:function(et,he,K){"use strict";K.r(he);var ue=K("5Dmo"),B=K("3S7+"),w=K("14J3"),_=K("BMrR"),D=K("jCWc"),A=K("kPKH"),N=K("sPJy"),k=K("bE4q"),S=K("k1fw"),C=K("9og8"),d=K("y8nQ"),v=K("Vl3Y"),b=K("tJVT"),p=K("PpiC"),m=K("WmNS"),y=K.n(m),n=K("q1tI"),e=K.n(n),t=K("55Ip"),r=K("9kvl"),f=K("9Bee"),c=K("xKgJ"),u=K("U/Y8"),E=K.n(u),g=K("Q9mQ"),s=K("diRs"),a=K("miYZ"),i=K("tsqr"),l=K("2qtc"),T=K("kLXV"),x=K("oBTY"),L=K("ozfa"),R=K("MJZm"),I=K("5NDa"),F=K("5rEg"),j=K("jrin"),z=K("nRaC"),Q=K("5RzL"),J=K("ErOA"),ie=K("Ty5D"),pe=Q.a.TreeNode,ce=function(de){var fe=de.restful,we=de.loading,Ie=de.dispatch,_e=Object(ie.i)(),Fe=Object(ie.h)(),le=Object(n.useState)(!1),ge=Object(b.a)(le,2),Ee=ge[0],Se=ge[1],Ae=Object(n.useState)(),Le=Object(b.a)(Ae,2),xe=Le[0],Oe=Le[1],Ue=fe.actionTabs,Te=v.a.useForm(),Ne=Object(b.a)(Te,1),oe=Ne[0];return Object(n.useEffect)(function(){fe.actionTabs.key=="\u65B0\u5EFA\u540C\u7EA7\u76EE\u5F55"&&oe.resetFields()},[fe.actionTabs.key]),fe.actionTabs.key!=="\u65B0\u5EFA\u540C\u7EA7\u76EE\u5F55"?null:e.a.createElement(T.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:Ee,onOk:Object(C.a)(y.a.mark(function re(){var ae,W,H;return y.a.wrap(function(ee){for(;;)switch(ee.prev=ee.next){case 0:return ee.next=2,oe.validateFields();case 2:return ae=oe.getFieldValue(),Se(!0),W="/api/restfuls.json",ee.next=7,Object(J.a)(W,{method:"post",body:Object(S.a)({file_type:1},ae)});case 7:H=ee.sent,H.status===0&&(i.b.success("\u6DFB\u52A0\u6210\u529F"),Ie({type:"restful/setActionTabs",payload:{}}),Ie({type:"restful/getRestful"})),Se(!1);case 10:case"end":return ee.stop()}},re)})),onCancel:function(){Ie({type:"restful/setActionTabs",payload:{}})}},e.a.createElement("div",{className:"pl30 pr30"},e.a.createElement(v.a,{form:oe,initialValues:Object(j.a)({},"name","")},e.a.createElement(v.a.Item,{name:"name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u76EE\u5F55\u540D\u79F0"}]},e.a.createElement(_.a,{className:"mt30"},e.a.createElement(A.a,{flex:"80px",className:"font14"},"\u76EE\u5F55\u540D\u79F0\uFF1A"),e.a.createElement(A.a,{flex:"1"},e.a.createElement(F.a,{placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26 ",maxLength:60})))))))},ye=Object(r.a)(function(te){var de=te.restful,fe=te.loading;return{restful:de,loading:fe}})(ce),ve=Q.a.TreeNode,Z=function(de){var fe=de.restful,we=de.loading,Ie=de.dispatch,_e=Object(ie.i)(),Fe=Object(ie.h)(),le=Object(n.useState)(!1),ge=Object(b.a)(le,2),Ee=ge[0],Se=ge[1],Ae=Object(n.useState)(),Le=Object(b.a)(Ae,2),xe=Le[0],Oe=Le[1],Ue=fe.actionTabs,Te=v.a.useForm(),Ne=Object(b.a)(Te,1),oe=Ne[0];return Object(n.useEffect)(function(){fe.actionTabs.key=="\u91CD\u547D\u540D"&&(oe.resetFields(),oe.setFieldsValue({name:fe.actionTabs.data.title}))},[fe.actionTabs.key]),fe.actionTabs.key!=="\u91CD\u547D\u540D"?null:e.a.createElement(T.a,{centered:!0,title:"\u91CD\u547D\u540D",visible:fe.actionTabs.key==="\u91CD\u547D\u540D",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",bodyStyle:{minHeight:150},confirmLoading:Ee,onOk:Object(C.a)(y.a.mark(function re(){var ae,W,H;return y.a.wrap(function(ee){for(;;)switch(ee.prev=ee.next){case 0:return ee.next=2,oe.validateFields();case 2:return ae=oe.getFieldValue(),Se(!0),W="/api/restfuls/".concat(fe.actionTabs.data.id,".json"),ee.next=7,Object(J.a)(W,{method:"put",body:Object(S.a)({file_type:1},ae)});case 7:H=ee.sent,H.status===0&&(i.b.success("\u4FEE\u6539\u6210\u529F"),Ie({type:"restful/setActionTabs",payload:{}}),Ie({type:"restful/getRestful"})),Se(!1);case 10:case"end":return ee.stop()}},re)})),onCancel:function(){Ie({type:"restful/setActionTabs",payload:{}})}},e.a.createElement("div",{className:"pl30 pr30"},e.a.createElement(v.a,{form:oe,initialValues:Object(j.a)({},"name","")},e.a.createElement(_.a,{className:"mt30"},e.a.createElement(A.a,{flex:"80px",className:"font14"},"\u76EE\u5F55\u540D\u79F0\uFF1A"),e.a.createElement(A.a,{flex:"1"},e.a.createElement(v.a.Item,{name:"name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u65B0\u540D\u79F0"}]},e.a.createElement(F.a,{placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26 ",maxLength:60})))))))},q=Object(r.a)(function(te){var de=te.restful,fe=te.loading;return{restful:de,loading:fe}})(Z),se=K("s7vb"),V=K("P48q"),G=K.n(V),be=F.a.Search,Re=R.a.DirectoryTree,De=function(de){var fe=de.user,we=de.globalSetting,Ie=de.loading,_e=de.dispatch,Fe=de.restful,le=Object(p.a)(de,["user","globalSetting","loading","dispatch","restful"]),ge=Object(n.useState)({content:"",message:"",status:0,contacts:[],address:"",data:[]}),Ee=Object(b.a)(ge,2),Se=Ee[0],Ae=Ee[1],Le=Object(n.useState)(!0),xe=Object(b.a)(Le,2),Oe=xe[0],Ue=xe[1],Te=v.a.useForm(),Ne=Object(b.a)(Te,1),oe=Ne[0],re=Object(n.useState)(""),ae=Object(b.a)(re,2),W=ae[0],H=ae[1],Y=Object(n.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"}]),ee=Object(b.a)(Y,1),me=ee[0],Ce=Object(n.useState)([]),Be=Object(b.a)(Ce,2),Ge=Be[0],Qe=Be[1],Ve=Object(n.useState)([]),qe=Object(b.a)(Ve,2),at=qe[0],Je=qe[1],Ct=Object(n.useState)(!1),ht=Object(b.a)(Ct,2),Lt=ht[0],xt=ht[1],rt=Object(n.useState)([]),Dt=Object(b.a)(rt,2),At=Dt[0],$e=Dt[1];Object(n.useEffect)(function(){var nt;if((nt=Fe.restful)!==null&&nt!==void 0&&nt.data){var tt,Ze,mt;$e(Object(x.a)((tt=Fe.restful)===null||tt===void 0?void 0:tt.data));var vt=0,dt;if((Ze=Fe.restful)===null||Ze===void 0||((mt=Ze.data)===null||mt===void 0)||mt.map(function(pt){var Tt;pt.id==le.match.params.id&&(vt=pt.id),pt.file_type==0&&!dt&&(dt=pt.id),pt==null||((Tt=pt.children)===null||Tt===void 0)||Tt.map(function(It){dt||(dt=It.id),It.id==le.match.params.id&&(vt=pt.id)}),!pt.children&&!dt&&(dt=pt.id)}),!le.match.params.id&&dt){le.history.push("/ch/rest/".concat(dt));return}vt&&setTimeout(function(){Qe([vt]),Je([Number(le.match.params.id||dt)])},200)}},[Fe.restful]);var Xe=function(tt,Ze){Ze.node.file_type===0?le.history.push("/ch/rest/".concat(tt[0])):Je(Object(x.a)(tt)),console.log("Trigger Select",tt,Ze)},je=function(tt){Qe(tt),console.log("Trigger Expand",tt)},He=function(tt){return e.a.createElement("div",null,me.map(function(Ze,mt){return e.a.createElement("p",{key:Ze.id,className:"current",onClick:function(){switch(Ze.id){case 1:le.history.push("/ch/rest/edit/".concat(tt.id,"/0"));break;case 2:case 3:_e({type:"restful/setActionTabs",payload:{key:Ze.name,data:tt}});break;case 4:document.location.href="/ch/rest/edit/".concat(tt.pid||0,"/").concat(tt.id);break;case 5:T.a.confirm({title:"\u63D0\u793A",content:"\u662F\u5426\u786E\u5B9A\u5220\u9664\uFF1F",onOk:function(){var dt=Object(C.a)(y.a.mark(function Tt(){var It;return y.a.wrap(function(st){for(;;)switch(st.prev=st.next){case 0:return st.next=2,Object(se.a)({id:tt.id});case 2:It=st.sent,(It==null?void 0:It.status)==0&&(i.b.success("\u5220\u9664\u6210\u529F"),_e({type:"restful/getRestful"}));case 4:case"end":return st.stop()}},Tt)}));function pt(){return dt.apply(this,arguments)}return pt}()});break}}},Ze.name)}).filter(function(Ze){return!!Ze}).filter(function(Ze){return tt.pid||tt.file_type==0?Ze.key>3:Ze.key!=4}))},lt=function nt(tt){return tt.map(function(Ze){var mt=Ze.title.indexOf(W),vt=Ze.title.substr(0,mt),dt=Ze.title.substr(mt+W.length),pt=e.a.createElement("span",null,vt,e.a.createElement("span",{className:"c-blue"},W),dt,Object(c.o)()&&e.a.createElement(s.a,{placement:"right",title:W,content:function(){return He(Ze)},trigger:"hover"},e.a.createElement("span",{className:"iconfont icon-sandian ".concat(G.a.actions)})));if(W!==""){var Tt;if(mt===-1&&!((Tt=Ze.children)!==null&&Tt!==void 0&&Tt.length))return null}return Ze.children&&Ze.file_type===1?Object(S.a)(Object(S.a)({},Ze),{},{title:pt,key:Ze.key,children:nt(Ze.children)}):Object(S.a)(Object(S.a)({},Ze),{},{title:pt,key:Ze.key,isLeaf:!0})}).filter(function(Ze){return!!Ze})},ut=function nt(tt,Ze){for(var mt,vt=0;vt<Ze.length;vt++){var dt=Ze[vt];dt.children&&(dt.children.some(function(pt){return pt.key===tt})?mt=dt.key:nt(tt,dt.children)&&(mt=nt(tt,dt.children)))}return mt},ft=function(tt){var Ze=tt.target.value,mt=At.map(function(vt){if(vt!=null&&vt.children){var dt;return vt!=null&&(dt=vt.children.filter(function(pt){return pt.title.indexOf(Ze)>-1}))!==null&&dt!==void 0&&dt.length?vt.id:null}return null});H(Ze),xt(!0),console.log("expandedKeys:",mt),Qe(mt)};return console.log("loop(treeData):",lt(At)),e.a.createElement("div",{className:G.a.tree},e.a.createElement(be,{style:{marginBottom:8},placeholder:"\u8F93\u5165\u5173\u952E\u5B57\u68C0\u7D22",onChange:ft}),e.a.createElement(Re,{multiple:!0,defaultExpandAll:!0,onSelect:Xe,onExpand:je,expandedKeys:Ge,selectedKeys:at,autoExpandParent:Lt,treeData:lt(At)}),e.a.createElement(ye,null),e.a.createElement(q,null))},Me=Object(r.a)(function(te){var de=te.user,fe=te.loading,we=te.globalSetting,Ie=te.restful;return{user:de,globalSetting:we,restful:Ie,loading:fe.models.index}})(De),X=function(de){var fe,we,Ie=de.user,_e=de.globalSetting,Fe=de.loading,le=de.dispatch,ge=de.restful,Ee=Object(p.a)(de,["user","globalSetting","loading","dispatch","restful"]),Se=Object(n.useState)({content:"",message:"",status:0,contacts:[],address:"",data:[]}),Ae=Object(b.a)(Se,2),Le=Ae[0],xe=Ae[1],Oe=Object(n.useState)(!0),Ue=Object(b.a)(Oe,2),Te=Ue[0],Ne=Ue[1],oe=v.a.useForm(),re=Object(b.a)(oe,1),ae=re[0],W=Ee.match.params,H=function(){var me=Object(C.a)(y.a.mark(function Ce(){return y.a.wrap(function(Ge){for(;;)switch(Ge.prev=Ge.next){case 0:le({type:"restful/getRestful"}),W.id&&le({type:"restful/getRestfulDetail",payload:Object(S.a)({},W)});case 2:case"end":return Ge.stop()}},Ce)}));return function(){return me.apply(this,arguments)}}();Object(n.useEffect)(function(){Ne(!0),H()},[W.id]);var Y=function(){le({type:"restful/setActionTabs",payload:{key:"\u65B0\u5EFA\u540C\u7EA7\u76EE\u5F55"}})},ee=function(){var Ce;if((Ce=ge.restful)!==null&&Ce!==void 0&&Ce.data){var Be,Ge,Qe=0;return(Be=ge.restful)===null||Be===void 0||((Ge=Be.data)===null||Ge===void 0)||Ge.map(function(Ve){var qe;Ve==null||((qe=Ve.children)===null||qe===void 0)||qe.map(function(at){at.id==Ee.match.params.id&&(Qe=Ve.id)}),!Ve.children&&!Qe&&(Qe=Ve.id)}),Qe}return 0};return e.a.createElement("section",null,e.a.createElement("aside",{className:"edu-container mt20"},e.a.createElement(k.a,null,e.a.createElement(k.a.Item,null,e.a.createElement(t.a,{to:"/"},"\u9996\u9875")),e.a.createElement(k.a.Item,null,e.a.createElement(t.a,{to:"/ch/rest"},"API\u6587\u6863"))),e.a.createElement("div",{className:"mt20"},e.a.createElement(_.a,{gutter:[20,20]},e.a.createElement(A.a,{flex:"300px"},e.a.createElement(Me,Ee)),e.a.createElement(A.a,{flex:"1"},e.a.createElement("div",{className:E.a.info},e.a.createElement("h1",{style:{fontSize:28,paddingBottom:15,borderBottom:"1px solid #eaeaea",textAlign:"center"}},(fe=ge.restfulDetail)===null||fe===void 0?void 0:fe.name),e.a.createElement(f.a,{value:(we=ge.restfulDetail)===null||we===void 0?void 0:we.description}))))),Object(c.o)()&&e.a.createElement("div",{className:E.a.bar},e.a.createElement(_.a,null,!!ee()&&e.a.createElement(A.a,null,e.a.createElement(B.a,{title:"\u7F16\u8F91\u6587\u4EF6"},e.a.createElement(t.a,{to:"/ch/rest/edit/".concat(ee(),"/").concat(Ee.match.params.id),className:"icon-zhongmingming current"}))),e.a.createElement(A.a,null,e.a.createElement(B.a,{title:"\u6DFB\u52A0\u6587\u4EF6"},e.a.createElement(t.a,{to:"/ch/rest/edit/".concat(ee(),"/0"),className:"icon-tianjiatimu current"}))),e.a.createElement(A.a,null,e.a.createElement(B.a,{title:"\u65B0\u5EFA\u6587\u4EF6\u5939"},e.a.createElement("span",{className:"icon-wenjianjia1 current",onClick:Y})))))))},$=he.default=Object(r.a)(function(te){var de=te.user,fe=te.loading,we=te.globalSetting,Ie=te.restful;return{user:de,globalSetting:we,restful:Ie,loading:fe.models.index}})(X)},JYp7:function(et,he,K){"use strict";K.d(he,"c",function(){return B}),K.d(he,"d",function(){return w}),K.d(he,"f",function(){return D}),K.d(he,"a",function(){return A}),K.d(he,"b",function(){return N}),K.d(he,"e",function(){return k});var ue=function(){var S=function(C,d){return S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,b){v.__proto__=b}||function(v,b){for(var p in b)b.hasOwnProperty(p)&&(v[p]=b[p])},S(C,d)};return function(C,d){S(C,d);function v(){this.constructor=C}C.prototype=d===null?Object.create(d):(v.prototype=d.prototype,new v)}}(),B={done:!0,value:void 0},w;(function(S){var C={next:function(){return B}};function d(){return C}S.empty=d;function v(c){var u=!1;return{next:function(){return u?B:(u=!0,{done:!1,value:c})}}}S.single=v;function b(c,u,E){return u===void 0&&(u=0),E===void 0&&(E=c.length),{next:function(){return u>=E?B:{done:!1,value:c[u++]}}}}S.fromArray=b;function p(c){return{next:function(){var u=c.next();return u.done?B:{done:!1,value:u.value}}}}S.fromNativeIterator=p;function m(c){return c?Array.isArray(c)?S.fromArray(c):c:S.empty()}S.from=m;function y(c,u){return{next:function(){var E=c.next();return E.done?B:{done:!1,value:u(E.value)}}}}S.map=y;function n(c,u){return{next:function(){for(;;){var E=c.next();if(E.done)return B;if(u(E.value))return{done:!1,value:E.value}}}}}S.filter=n;function e(c,u){for(var E=c.next();!E.done;E=c.next())u(E.value)}S.forEach=e;function t(c,u){u===void 0&&(u=Number.POSITIVE_INFINITY);var E=[];if(u===0)return E;for(var g=0,s=c.next();!s.done&&!(E.push(s.value),++g>=u);s=c.next());return E}S.collect=t;function r(){for(var c=[],u=0;u<arguments.length;u++)c[u]=arguments[u];var E=0;return{next:function(){if(E>=c.length)return B;var g=c[E],s=g.next();return s.done?(E++,this.next()):s}}}S.concat=r;function f(c){return new _(c)}S.chain=f})(w||(w={}));var _=function(){function S(C){this.it=C}return S.prototype.next=function(){return this.it.next()},S}();function D(S){return Array.isArray(S)?w.fromArray(S):S||w.empty()}var A=function(){function S(C,d,v,b){d===void 0&&(d=0),v===void 0&&(v=C.length),b===void 0&&(b=d-1),this.items=C,this.start=d,this.end=v,this.index=b}return S.prototype.first=function(){return this.index=this.start,this.current()},S.prototype.next=function(){return this.index=Math.min(this.index+1,this.end),this.current()},S.prototype.current=function(){return this.index===this.start-1||this.index===this.end?null:this.items[this.index]},S}(),N=function(S){ue(C,S);function C(d,v,b,p){return v===void 0&&(v=0),b===void 0&&(b=d.length),p===void 0&&(p=v-1),S.call(this,d,v,b,p)||this}return C.prototype.current=function(){return S.prototype.current.call(this)},C.prototype.previous=function(){return this.index=Math.max(this.index-1,this.start-1),this.current()},C.prototype.first=function(){return this.index=this.start,this.current()},C.prototype.last=function(){return this.index=this.end-1,this.current()},C.prototype.parent=function(){return null},C}(A),k=function(){function S(C,d){this.iterator=C,this.fn=d}return S.prototype.next=function(){return this.fn(this.iterator.next())},S}()},MI8n:function(et,he,K){"use strict";K.d(he,"b",function(){return A}),K.d(he,"a",function(){return S}),K.d(he,"e",function(){return C}),K.d(he,"d",function(){return d}),K.d(he,"c",function(){return v}),K.d(he,"f",function(){return b});var ue=K("/cxE"),B=K("C/vA"),w=K("pmY6"),_=K("24hK"),D=function(){var p=function(m,y){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(n,e){for(var t in e)e.hasOwnProperty(t)&&(n[t]=e[t])},p(m,y)};return function(m,y){p(m,y);function n(){this.constructor=m}m.prototype=y===null?Object.create(y):(n.prototype=y.prototype,new n)}}(),A;(function(p){p.None=function(){return w.a.None};function m(R){return function(I,F,j){F===void 0&&(F=null);var z=!1,Q;return Q=R(function(J){return z?void 0:(Q?Q.dispose():z=!0,I.call(F,J))},null,j),z&&Q.dispose(),Q}}p.once=m;function y(R,I){return c(function(F,j,z){return j===void 0&&(j=null),R(function(Q){return F.call(j,I(Q))},null,z)})}p.map=y;function n(R,I){return c(function(F,j,z){return j===void 0&&(j=null),R(function(Q){I(Q),F.call(j,Q)},null,z)})}p.forEach=n;function e(R,I){return c(function(F,j,z){return j===void 0&&(j=null),R(function(Q){return I(Q)&&F.call(j,Q)},null,z)})}p.filter=e;function t(R){return R}p.signal=t;function r(){for(var R=[],I=0;I<arguments.length;I++)R[I]=arguments[I];return function(F,j,z){return j===void 0&&(j=null),w.e.apply(void 0,R.map(function(Q){return Q(function(J){return F.call(j,J)},null,z)}))}}p.any=r;function f(R,I,F){var j=F;return y(R,function(z){return j=I(j,z),j})}p.reduce=f;function c(R){var I,F=new S({onFirstListenerAdd:function(){I=R(F.fire,F)},onLastListenerRemove:function(){I.dispose()}});return F.event}p.snapshot=c;function u(R,I,F,j,z){F===void 0&&(F=100),j===void 0&&(j=!1);var Q,J=void 0,ie=void 0,pe=0,ce=new S({leakWarningThreshold:z,onFirstListenerAdd:function(){Q=R(function(ye){pe++,J=I(J,ye),j&&!ie&&(ce.fire(J),J=void 0),clearTimeout(ie),ie=setTimeout(function(){var ve=J;J=void 0,ie=void 0,(!j||pe>1)&&ce.fire(ve),pe=0},F)})},onLastListenerRemove:function(){Q.dispose()}});return ce.event}p.debounce=u;function E(R){var I=new Date().getTime();return y(m(R),function(F){return new Date().getTime()-I})}p.stopwatch=E;function g(R){var I=!0,F;return e(R,function(j){var z=I||j!==F;return I=!1,F=j,z})}p.latch=g;function s(R,I,F){I===void 0&&(I=!1),F===void 0&&(F=[]);var j=F.slice(),z=R(function(ie){j?j.push(ie):J.fire(ie)}),Q=function(){j&&j.forEach(function(ie){return J.fire(ie)}),j=null},J=new S({onFirstListenerAdd:function(){z||(z=R(function(ie){return J.fire(ie)}))},onFirstListenerDidAdd:function(){j&&(I?setTimeout(Q):Q())},onLastListenerRemove:function(){z&&z.dispose(),z=null}});return J.event}p.buffer=s;var a=function(){function R(I){this.event=I}return R.prototype.map=function(I){return new R(y(this.event,I))},R.prototype.forEach=function(I){return new R(n(this.event,I))},R.prototype.filter=function(I){return new R(e(this.event,I))},R.prototype.reduce=function(I,F){return new R(f(this.event,I,F))},R.prototype.latch=function(){return new R(g(this.event))},R.prototype.debounce=function(I,F,j,z){return F===void 0&&(F=100),j===void 0&&(j=!1),new R(u(this.event,I,F,j,z))},R.prototype.on=function(I,F,j){return this.event(I,F,j)},R.prototype.once=function(I,F,j){return m(this.event)(I,F,j)},R}();function i(R){return new a(R)}p.chain=i;function l(R,I,F){F===void 0&&(F=function(ie){return ie});var j=function(){for(var ie=[],pe=0;pe<arguments.length;pe++)ie[pe]=arguments[pe];return J.fire(F.apply(void 0,ie))},z=function(){return R.on(I,j)},Q=function(){return R.removeListener(I,j)},J=new S({onFirstListenerAdd:z,onLastListenerRemove:Q});return J.event}p.fromNodeEventEmitter=l;function T(R,I,F){F===void 0&&(F=function(ie){return ie});var j=function(){for(var ie=[],pe=0;pe<arguments.length;pe++)ie[pe]=arguments[pe];return J.fire(F.apply(void 0,ie))},z=function(){return R.addEventListener(I,j)},Q=function(){return R.removeEventListener(I,j)},J=new S({onFirstListenerAdd:z,onLastListenerRemove:Q});return J.event}p.fromDOMEventEmitter=T;function x(R){var I=new S,F=!1;return R.then(void 0,function(){return null}).then(function(){F?I.fire(void 0):setTimeout(function(){return I.fire(void 0)},0)}),F=!0,I.event}p.fromPromise=x;function L(R){return new Promise(function(I){return m(R)(I)})}p.toPromise=L})(A||(A={}));var N=-1,k=function(){function p(m,y){y===void 0&&(y=Math.random().toString(18).slice(2,5)),this.customThreshold=m,this.name=y,this._warnCountdown=0}return p.prototype.dispose=function(){this._stacks&&this._stacks.clear()},p.prototype.check=function(m){var y=this,n=N;if(typeof this.customThreshold=="number"&&(n=this.customThreshold),n<=0||m<n)return;this._stacks||(this._stacks=new Map);var e=new Error().stack.split(`
`).slice(3).join(`
`),t=this._stacks.get(e)||0;if(this._stacks.set(e,t+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;var r,f=0;this._stacks.forEach(function(c,u){(!r||f<c)&&(r=u,f=c)}),console.warn("["+this.name+"] potential listener LEAK detected, having "+m+" listeners already. MOST frequent listener ("+f+"):"),console.warn(r)}return function(){var c=y._stacks.get(e)||0;y._stacks.set(e,c-1)}},p}(),S=function(){function p(m){this._disposed=!1,this._options=m,this._leakageMon=N>0?new k(this._options&&this._options.leakWarningThreshold):void 0}return Object.defineProperty(p.prototype,"event",{get:function(){var m=this;return this._event||(this._event=function(y,n,e){m._listeners||(m._listeners=new _.a);var t=m._listeners.isEmpty();t&&m._options&&m._options.onFirstListenerAdd&&m._options.onFirstListenerAdd(m);var r=m._listeners.push(n?[y,n]:y);t&&m._options&&m._options.onFirstListenerDidAdd&&m._options.onFirstListenerDidAdd(m),m._options&&m._options.onListenerDidAdd&&m._options.onListenerDidAdd(m,y,n);var f;m._leakageMon&&(f=m._leakageMon.check(m._listeners.size));var c;return c={dispose:function(){if(f&&f(),c.dispose=p._noop,!m._disposed&&(r(),m._options&&m._options.onLastListenerRemove)){var u=m._listeners&&!m._listeners.isEmpty();u||m._options.onLastListenerRemove(m)}}},e instanceof w.b?e.add(c):Array.isArray(e)&&e.push(c),c}),this._event},enumerable:!0,configurable:!0}),p.prototype.fire=function(m){if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new _.a);for(var y=this._listeners.iterator(),n=y.next();!n.done;n=y.next())this._deliveryQueue.push([n.value,m]);for(;this._deliveryQueue.size>0;){var e=this._deliveryQueue.shift(),t=e[0],r=e[1];try{typeof t=="function"?t.call(void 0,r):t[0].call(t[1],r)}catch(f){Object(ue.e)(f)}}}},p.prototype.dispose=function(){this._listeners&&this._listeners.clear(),this._deliveryQueue&&this._deliveryQueue.clear(),this._leakageMon&&this._leakageMon.dispose(),this._disposed=!0},p._noop=function(){},p}(),C=function(p){D(m,p);function m(y){var n=p.call(this,y)||this;return n._isPaused=0,n._eventQueue=new _.a,n._mergeFn=y&&y.merge,n}return m.prototype.pause=function(){this._isPaused++},m.prototype.resume=function(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){var y=this._eventQueue.toArray();this._eventQueue.clear(),p.prototype.fire.call(this,this._mergeFn(y))}else for(;!this._isPaused&&this._eventQueue.size!==0;)p.prototype.fire.call(this,this._eventQueue.shift())},m.prototype.fire=function(y){this._listeners&&(this._isPaused!==0?this._eventQueue.push(y):p.prototype.fire.call(this,y))},m}(S),d=function(){function p(){var m=this;this.hasListeners=!1,this.events=[],this.emitter=new S({onFirstListenerAdd:function(){return m.onFirstListenerAdd()},onLastListenerRemove:function(){return m.onLastListenerRemove()}})}return Object.defineProperty(p.prototype,"event",{get:function(){return this.emitter.event},enumerable:!0,configurable:!0}),p.prototype.add=function(m){var y=this,n={event:m,listener:null};this.events.push(n),this.hasListeners&&this.hook(n);var e=function(){y.hasListeners&&y.unhook(n);var t=y.events.indexOf(n);y.events.splice(t,1)};return Object(w.h)(Object(B.a)(e))},p.prototype.onFirstListenerAdd=function(){var m=this;this.hasListeners=!0,this.events.forEach(function(y){return m.hook(y)})},p.prototype.onLastListenerRemove=function(){var m=this;this.hasListeners=!1,this.events.forEach(function(y){return m.unhook(y)})},p.prototype.hook=function(m){var y=this;m.listener=m.event(function(n){return y.emitter.fire(n)})},p.prototype.unhook=function(m){m.listener&&m.listener.dispose(),m.listener=null},p.prototype.dispose=function(){this.emitter.dispose()},p}(),v=function(){function p(){this.buffers=[]}return p.prototype.wrapEvent=function(m){var y=this;return function(n,e,t){return m(function(r){var f=y.buffers[y.buffers.length-1];f?f.push(function(){return n.call(e,r)}):n.call(e,r)},void 0,t)}},p.prototype.bufferEvents=function(m){var y=[];this.buffers.push(y);var n=m();return this.buffers.pop(),y.forEach(function(e){return e()}),n},p}(),b=function(){function p(){var m=this;this.listening=!1,this.inputEvent=A.None,this.inputEventListener=w.a.None,this.emitter=new S({onFirstListenerDidAdd:function(){m.listening=!0,m.inputEventListener=m.inputEvent(m.emitter.fire,m.emitter)},onLastListenerRemove:function(){m.listening=!1,m.inputEventListener.dispose()}}),this.event=this.emitter.event}return Object.defineProperty(p.prototype,"input",{set:function(m){this.inputEvent=m,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=m(this.emitter.fire,this.emitter))},enumerable:!0,configurable:!0}),p.prototype.dispose=function(){this.inputEventListener.dispose(),this.emitter.dispose()},p}()},N0LK:function(et,he,K){"use strict";K.d(he,"x",function(){return ue}),K.d(he,"F",function(){return B}),K.d(he,"r",function(){return _}),K.d(he,"o",function(){return D}),K.d(he,"p",function(){return A}),K.d(he,"Q",function(){return N}),K.d(he,"K",function(){return S}),K.d(he,"k",function(){return C}),K.d(he,"N",function(){return d}),K.d(he,"m",function(){return v}),K.d(he,"l",function(){return b}),K.d(he,"I",function(){return p}),K.d(he,"H",function(){return m}),K.d(he,"q",function(){return y}),K.d(he,"t",function(){return n}),K.d(he,"D",function(){return e}),K.d(he,"e",function(){return t}),K.d(he,"f",function(){return r}),K.d(he,"B",function(){return f}),K.d(he,"C",function(){return c}),K.d(he,"n",function(){return E}),K.d(he,"O",function(){return s}),K.d(he,"c",function(){return a}),K.d(he,"d",function(){return i}),K.d(he,"z",function(){return l}),K.d(he,"A",function(){return T}),K.d(he,"u",function(){return x}),K.d(he,"E",function(){return R}),K.d(he,"G",function(){return I}),K.d(he,"i",function(){return j}),K.d(he,"g",function(){return Q}),K.d(he,"v",function(){return ie}),K.d(he,"h",function(){return pe}),K.d(he,"y",function(){return ce}),K.d(he,"w",function(){return ye}),K.d(he,"a",function(){return ve}),K.d(he,"P",function(){return Z}),K.d(he,"L",function(){return q}),K.d(he,"J",function(){return se}),K.d(he,"j",function(){return V}),K.d(he,"M",function(){return G}),K.d(he,"s",function(){return be}),K.d(he,"b",function(){return Re});function ue(X){return!X||typeof X!="string"?!0:X.trim().length===0}function B(X,$,te){te===void 0&&(te="0");for(var de=""+X,fe=[de],we=de.length;we<$;we++)fe.push(te);return fe.reverse().join("")}var w=/{(\d+)}/g;function _(X){for(var $=[],te=1;te<arguments.length;te++)$[te-1]=arguments[te];return $.length===0?X:X.replace(w,function(de,fe){var we=parseInt(fe,10);return isNaN(we)||we<0||we>=$.length?de:$[we]})}function D(X){return X.replace(/[<>&]/g,function($){switch($){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return $}})}function A(X){return X.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function N(X,$){$===void 0&&($=" ");var te=k(X,$);return S(te,$)}function k(X,$){if(!X||!$)return X;var te=$.length;if(te===0||X.length===0)return X;for(var de=0;X.indexOf($,de)===de;)de=de+te;return X.substring(de)}function S(X,$){if(!X||!$)return X;var te=$.length,de=X.length;if(te===0||de===0)return X;for(var fe=de,we=-1;!(we=X.lastIndexOf($,fe-1),we===-1||we+te!==fe);){if(we===0)return"";fe=we}return X.substring(0,fe)}function C(X){return X.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function d(X,$){if(X.length<$.length)return!1;if(X===$)return!0;for(var te=0;te<$.length;te++)if(X[te]!==$[te])return!1;return!0}function v(X,$){var te=X.length-$.length;return te>0?X.indexOf($,te)===te:te===0?X===$:!1}function b(X,$,te){if(te===void 0&&(te={}),!X)throw new Error("Cannot create regex from empty string");$||(X=A(X)),te.wholeWord&&(/\B/.test(X.charAt(0))||(X="\\b"+X),/\B/.test(X.charAt(X.length-1))||(X=X+"\\b"));var de="";return te.global&&(de+="g"),te.matchCase||(de+="i"),te.multiline&&(de+="m"),te.unicode&&(de+="u"),new RegExp(X,de)}function p(X){if(X.source==="^"||X.source==="^$"||X.source==="$"||X.source==="^\\s*$")return!1;var $=X.exec("");return!!($&&X.lastIndex===0)}function m(X){return(X.global?"g":"")+(X.ignoreCase?"i":"")+(X.multiline?"m":"")+(X.unicode?"u":"")}function y(X){for(var $=0,te=X.length;$<te;$++){var de=X.charCodeAt($);if(de!==32&&de!==9)return $}return-1}function n(X,$,te){$===void 0&&($=0),te===void 0&&(te=X.length);for(var de=$;de<te;de++){var fe=X.charCodeAt(de);if(fe!==32&&fe!==9)return X.substring($,de)}return X.substring($,te)}function e(X,$){$===void 0&&($=X.length-1);for(var te=$;te>=0;te--){var de=X.charCodeAt(te);if(de!==32&&de!==9)return te}return-1}function t(X,$){return X<$?-1:X>$?1:0}function r(X,$){for(var te=Math.min(X.length,$.length),de=0;de<te;de++){var fe=X.charCodeAt(de),we=$.charCodeAt(de);if(fe===we)continue;c(fe)&&(fe+=32),c(we)&&(we+=32);var Ie=fe-we;if(Ie===0)continue;return f(fe)&&f(we)?Ie:t(X.toLowerCase(),$.toLowerCase())}return X.length<$.length?-1:X.length>$.length?1:0}function f(X){return X>=97&&X<=122}function c(X){return X>=65&&X<=90}function u(X){return f(X)||c(X)}function E(X,$){return X.length===$.length&&g(X,$)}function g(X,$,te){te===void 0&&(te=X.length);for(var de=0;de<te;de++){var fe=X.charCodeAt(de),we=$.charCodeAt(de);if(fe===we)continue;if(u(fe)&&u(we)){var Ie=Math.abs(fe-we);if(Ie!==0&&Ie!==32)return!1}else if(String.fromCharCode(fe).toLowerCase()!==String.fromCharCode(we).toLowerCase())return!1}return!0}function s(X,$){var te=$.length;return $.length>X.length?!1:g(X,$,te)}function a(X,$){var te,de=Math.min(X.length,$.length);for(te=0;te<de;te++)if(X.charCodeAt(te)!==$.charCodeAt(te))return te;return de}function i(X,$){var te,de=Math.min(X.length,$.length),fe=X.length-1,we=$.length-1;for(te=0;te<de;te++)if(X.charCodeAt(fe-te)!==$.charCodeAt(we-te))return te;return de}function l(X){return 55296<=X&&X<=56319}function T(X){return 56320<=X&&X<=57343}function x(X,$,te){var de=X.charCodeAt(te);if(l(de)&&te+1<$){var fe=X.charCodeAt(te+1);if(T(fe))return(de-55296<<10)+(fe-56320)+65536}return de}function L(X,$){var te=X.charCodeAt($-1);if(T(te)&&$>1){var de=X.charCodeAt($-2);if(l(de))return(de-55296<<10)+(te-56320)+65536}return te}function R(X,$){var te=De.getInstance(),de=$,fe=X.length,we=x(X,fe,$);$+=we>=65536?2:1;for(var Ie=te.getGraphemeBreakType(we);$<fe;){var _e=x(X,fe,$),Fe=te.getGraphemeBreakType(_e);if(Re(Ie,Fe))break;$+=_e>=65536?2:1,Ie=Fe}return $-de}function I(X,$){var te=De.getInstance(),de=$,fe=L(X,$);$-=fe>=65536?2:1;for(var we=te.getGraphemeBreakType(fe);$>0;){var Ie=L(X,$),_e=te.getGraphemeBreakType(Ie);if(Re(_e,we))break;$-=Ie>=65536?2:1,we=_e}return de-$}var F=/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u08BD\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE33\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDCFF]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD50-\uDFFF]|\uD83B[\uDC00-\uDEBB])/;function j(X){return F.test(X)}var z=/(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD00-\uDDFF\uDE70-\uDE73\uDE78-\uDE82\uDE90-\uDE95])/;function Q(X){return z.test(X)}var J=/^[\t\n\r\x20-\x7E]*$/;function ie(X){return J.test(X)}function pe(X){for(var $=0,te=X.length;$<te;$++)if(ce(X.charCodeAt($)))return!0;return!1}function ce(X){return X=+X,X>=11904&&X<=55215||X>=63744&&X<=64255||X>=65281&&X<=65374}function ye(X){return X>=127462&&X<=127487||X>=9728&&X<=10175||X>=127744&&X<=128591||X>=128640&&X<=128764||X>=128992&&X<=129003||X>=129280&&X<=129535||X>=129648&&X<=129651||X>=129656&&X<=129666||X>=129680&&X<=129685}var ve=String.fromCharCode(65279);function Z(X){return!!(X&&X.length>0&&X.charCodeAt(0)===65279)}function q(X){return btoa(encodeURIComponent(X))}function se(X,$){for(var te="",de=0;de<$;de++)te+=X;return te}function V(X,$){return $===void 0&&($=!1),X?($&&(X=X.replace(/\\./g,"")),X.toLowerCase()!==X):!1}function G(X){var $=90-65+1;return X=X%(2*$),X<$?String.fromCharCode(97+X):String.fromCharCode(65+X-$)}function be(X){var $=De.getInstance();return $.getGraphemeBreakType(X)}function Re(X,$){return X===0?$!==5&&$!==7:X===2&&$===3?!1:X===4||X===2||X===3||($===4||$===2||$===3)?!0:X===8&&($===8||$===9||$===11||$===12)||((X===11||X===9)&&($===9||$===10)||((X===12||X===10)&&$===10||($===5||$===13||($===7||(X===1||X===13&&$===14)))))?!1:!(X===6&&$===6)}var De=function(){function X(){this._data=Me()}return X.getInstance=function(){return X._INSTANCE||(X._INSTANCE=new X),X._INSTANCE},X.prototype.getGraphemeBreakType=function($){if($<32)return $===10?3:$===13?2:4;if($<127)return 0;for(var te=this._data,de=te.length/3,fe=1;fe<=de;)if($<te[3*fe])fe=2*fe;else if($>te[3*fe+1])fe=2*fe+1;else return te[3*fe+2];return 0},X._INSTANCE=null,X}();function Me(){return JSON.parse("[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2259,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6848,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9776,9783,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]")}},NvD2:function(et,he,K){"use strict";K.d(he,"a",function(){return A});var ue=K("Kwbf");function B(N,k){var S=new Set;return N.forEach(function(C){k.has(C)||S.add(C)}),S}function w(N){var k=N||{},S=k.disabled,C=k.disableCheckbox,d=k.checkable;return!!(S||C)||d===!1}function _(N,k,S,C){for(var d=new Set(N),v=new Set,b=0;b<=S;b+=1){var p=k.get(b)||new Set;p.forEach(function(e){var t=e.key,r=e.node,f=e.children,c=f===void 0?[]:f;d.has(t)&&!C(r)&&c.filter(function(u){return!C(u.node)}).forEach(function(u){d.add(u.key)})})}for(var m=new Set,y=S;y>=0;y-=1){var n=k.get(y)||new Set;n.forEach(function(e){var t=e.parent,r=e.node;if(C(r)||!e.parent||m.has(e.parent.key))return;if(C(e.parent.node)){m.add(t.key);return}var f=!0,c=!1;(t.children||[]).filter(function(u){return!C(u.node)}).forEach(function(u){var E=u.key,g=d.has(E);f&&!g&&(f=!1),!c&&(g||v.has(E))&&(c=!0)}),f&&d.add(t.key),c&&v.add(t.key),m.add(t.key)})}return{checkedKeys:Array.from(d),halfCheckedKeys:Array.from(B(v,d))}}function D(N,k,S,C,d){for(var v=new Set(N),b=new Set(k),p=0;p<=C;p+=1){var m=S.get(p)||new Set;m.forEach(function(t){var r=t.key,f=t.node,c=t.children,u=c===void 0?[]:c;!v.has(r)&&!b.has(r)&&!d(f)&&u.filter(function(E){return!d(E.node)}).forEach(function(E){v.delete(E.key)})})}b=new Set;for(var y=new Set,n=C;n>=0;n-=1){var e=S.get(n)||new Set;e.forEach(function(t){var r=t.parent,f=t.node;if(d(f)||!t.parent||y.has(t.parent.key))return;if(d(t.parent.node)){y.add(r.key);return}var c=!0,u=!1;(r.children||[]).filter(function(E){return!d(E.node)}).forEach(function(E){var g=E.key,s=v.has(g);c&&!s&&(c=!1),!u&&(s||b.has(g))&&(u=!0)}),c||v.delete(r.key),u&&b.add(r.key),y.add(r.key)})}return{checkedKeys:Array.from(v),halfCheckedKeys:Array.from(B(b,v))}}function A(N,k,S,C){var d=[],v;C?v=C:v=w;var b=new Set(N.filter(function(n){var e=!!S[n];return e||d.push(n),e})),p=new Map,m=0;Object.keys(S).forEach(function(n){var e=S[n],t=e.level,r=p.get(t);r||(r=new Set,p.set(t,r)),r.add(e),m=Math.max(m,t)}),Object(ue.a)(!d.length,"Tree missing follow keys: ".concat(d.slice(0,100).map(function(n){return"'".concat(n,"'")}).join(", ")));var y;return k===!0?y=_(b,p,m,v):y=D(b,k.halfCheckedKeys,p,m,v),y}},OZM5:function(et,he,K){"use strict";K.d(he,"b",function(){return C}),K.d(he,"a",function(){return d}),K.d(he,"k",function(){return v}),K.d(he,"h",function(){return b}),K.d(he,"i",function(){return p}),K.d(he,"g",function(){return m}),K.d(he,"c",function(){return y}),K.d(he,"d",function(){return n}),K.d(he,"j",function(){return r}),K.d(he,"e",function(){return f}),K.d(he,"f",function(){return c});var ue=K("KQm4"),B=K("U8pU"),w=K("Ff2n"),_=K("q1tI"),D=K.n(_),A=K("Kwbf"),N=K("WaYH"),k=.25,S=2;function C(u,E){var g=u.slice(),s=g.indexOf(E);return s>=0&&g.splice(s,1),g}function d(u,E){var g=u.slice();return g.indexOf(E)===-1&&g.push(E),g}function v(u){return u.split("-")}function b(u,E){return"".concat(u,"-").concat(E)}function p(u){return u&&u.type&&u.type.isTreeNode}function m(u,E){var g=[u],s=E[u];function a(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];i.forEach(function(l){var T=l.key,x=l.children;g.push(T),a(x)})}return a(s.children),g}function y(u,E){var g=u.clientY,s=E.selectHandle.getBoundingClientRect(),a=s.top,i=s.bottom,l=s.height,T=Math.max(l*k,S);return g<=a+T?-1:g>=i-T?1:0}function n(u,E){if(!u)return;var g=E.multiple;return g?u.slice():u.length?[u[0]]:u}var e=function(E){return E};function t(u,E){if(!u)return[];var g=E||{},s=g.processProps,a=s===void 0?e:s,i=Array.isArray(u)?u:[u];return i.map(function(l){var T=l.children,x=Object(w.a)(l,["children"]),L=t(T,E);return D.a.createElement(N.a,Object.assign({},a(x)),L)})}function r(u){if(!u)return null;var E;if(Array.isArray(u))E={checkedKeys:u,halfCheckedKeys:void 0};else if(Object(B.a)(u)==="object")E={checkedKeys:u.checked||void 0,halfCheckedKeys:u.halfChecked||void 0};else return Object(A.a)(!1,"`checkedKeys` is not an array or an object"),null;return E}function f(u,E){var g=new Set;function s(a){if(g.has(a))return;var i=E[a];if(!i)return;g.add(a);var l=i.parent,T=i.node;if(T.disabled)return;l&&s(l.key)}return(u||[]).forEach(function(a){s(a)}),Object(ue.a)(g)}function c(u){var E={};return Object.keys(u).forEach(function(g){(g.startsWith("data-")||g.startsWith("aria-"))&&(E[g]=u[g])}),E}},P48q:function(et,he,K){et.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"}},QDVR:function(et,he,K){"use strict";K.d(he,"e",function(){return B}),K.d(he,"d",function(){return w}),K.d(he,"c",function(){return N}),K.d(he,"b",function(){return k}),K.d(he,"a",function(){return C});var ue=function(){var d=function(v,b){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,m){p.__proto__=m}||function(p,m){for(var y in m)m.hasOwnProperty(y)&&(p[y]=m[y])},d(v,b)};return function(v,b){d(v,b);function p(){this.constructor=v}v.prototype=b===null?Object.create(b):(p.prototype=b.prototype,new p)}}();function B(d){var v=[];return d.forEach(function(b){return v.push(b)}),v}function w(d){var v=[];return d.forEach(function(b,p){return v.push(p)}),v}var _=function(){function d(){this._value="",this._pos=0}return d.prototype.reset=function(v){return this._value=v,this._pos=0,this},d.prototype.next=function(){return this._pos+=1,this},d.prototype.hasNext=function(){return this._pos<this._value.length-1},d.prototype.cmp=function(v){var b=v.charCodeAt(0),p=this._value.charCodeAt(this._pos);return b-p},d.prototype.value=function(){return this._value[this._pos]},d}(),D=function(){function d(v){v===void 0&&(v=!0),this._splitOnBackslash=v}return d.prototype.reset=function(v){return this._value=v.replace(/\\$|\/$/,""),this._from=0,this._to=0,this.next()},d.prototype.hasNext=function(){return this._to<this._value.length},d.prototype.next=function(){this._from=this._to;for(var v=!0;this._to<this._value.length;this._to++){var b=this._value.charCodeAt(this._to);if(b===47||this._splitOnBackslash&&b===92)if(v)this._from++;else break;else v=!1}return this},d.prototype.cmp=function(v){for(var b=0,p=v.length,m=this._from;b<p&&m<this._to;){var y=v.charCodeAt(b)-this._value.charCodeAt(m);if(y!==0)return y;b+=1,m+=1}return p===this._to-this._from?0:b<p?-1:1},d.prototype.value=function(){return this._value.substring(this._from,this._to)},d}(),A=function(){function d(){}return d}(),N=function(){function d(v){this._iter=v}return d.forPaths=function(){return new d(new D)},d.forStrings=function(){return new d(new _)},d.prototype.clear=function(){this._root=void 0},d.prototype.set=function(v,b){var p=this._iter.reset(v),m;for(this._root||(this._root=new A,this._root.segment=p.value()),m=this._root;;){var y=p.cmp(m.segment);if(y>0)m.left||(m.left=new A,m.left.segment=p.value()),m=m.left;else if(y<0)m.right||(m.right=new A,m.right.segment=p.value()),m=m.right;else if(p.hasNext())p.next(),m.mid||(m.mid=new A,m.mid.segment=p.value()),m=m.mid;else break}var n=m.value;return m.value=b,m.key=v,n},d.prototype.get=function(v){for(var b=this._iter.reset(v),p=this._root;p;){var m=b.cmp(p.segment);if(m>0)p=p.left;else if(m<0)p=p.right;else if(b.hasNext())b.next(),p=p.mid;else break}return p?p.value:void 0},d.prototype.findSubstr=function(v){for(var b=this._iter.reset(v),p=this._root,m=void 0;p;){var y=b.cmp(p.segment);if(y>0)p=p.left;else if(y<0)p=p.right;else if(b.hasNext())b.next(),m=p.value||m,p=p.mid;else break}return p&&p.value||m},d.prototype.forEach=function(v){this._forEach(this._root,v)},d.prototype._forEach=function(v,b){v&&(this._forEach(v.left,b),v.value&&b(v.value,v.key),this._forEach(v.mid,b),this._forEach(v.right,b))},d}(),k=function(){function d(){this.map=new Map,this.ignoreCase=!1}return d.prototype.set=function(v,b){this.map.set(this.toKey(v),b)},d.prototype.get=function(v){return this.map.get(this.toKey(v))},d.prototype.toKey=function(v){var b=v.toString();return this.ignoreCase&&(b=b.toLowerCase()),b},d}(),S=function(){function d(){this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0}return d.prototype.clear=function(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0},Object.defineProperty(d.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),d.prototype.get=function(v,b){b===void 0&&(b=0);var p=this._map.get(v);return p?(b!==0&&this.touch(p,b),p.value):void 0},d.prototype.set=function(v,b,p){p===void 0&&(p=0);var m=this._map.get(v);if(m)m.value=b,p!==0&&this.touch(m,p);else{m={key:v,value:b,next:void 0,previous:void 0};switch(p){case 0:this.addItemLast(m);break;case 1:this.addItemFirst(m);break;case 2:this.addItemLast(m);break;default:this.addItemLast(m);break}this._map.set(v,m),this._size++}},d.prototype.delete=function(v){return!!this.remove(v)},d.prototype.remove=function(v){var b=this._map.get(v);return b?(this._map.delete(v),this.removeItem(b),this._size--,b.value):void 0},d.prototype.forEach=function(v,b){for(var p=this._head;p;)b?v.bind(b)(p.value,p.key,this):v(p.value,p.key,this),p=p.next},d.prototype.trimOld=function(v){if(v>=this.size)return;if(v===0){this.clear();return}for(var b=this._head,p=this.size;b&&p>v;)this._map.delete(b.key),b=b.next,p--;this._head=b,this._size=p,b&&(b.previous=void 0)},d.prototype.addItemFirst=function(v){if(!this._head&&!this._tail)this._tail=v;else if(this._head)v.next=this._head,this._head.previous=v;else throw new Error("Invalid list");this._head=v},d.prototype.addItemLast=function(v){if(!this._head&&!this._tail)this._head=v;else if(this._tail)v.previous=this._tail,this._tail.next=v;else throw new Error("Invalid list");this._tail=v},d.prototype.removeItem=function(v){if(v===this._head&&v===this._tail)this._head=void 0,this._tail=void 0;else if(v===this._head){if(!v.next)throw new Error("Invalid list");v.next.previous=void 0,this._head=v.next}else if(v===this._tail){if(!v.previous)throw new Error("Invalid list");v.previous.next=void 0,this._tail=v.previous}else{var b=v.next,p=v.previous;if(!b||!p)throw new Error("Invalid list");b.previous=p,p.next=b}v.next=void 0,v.previous=void 0},d.prototype.touch=function(v,b){if(!this._head||!this._tail)throw new Error("Invalid list");if(b!==1&&b!==2)return;if(b===1){if(v===this._head)return;var p=v.next,m=v.previous;v===this._tail?(m.next=void 0,this._tail=m):(p.previous=m,m.next=p),v.previous=void 0,v.next=this._head,this._head.previous=v,this._head=v}else if(b===2){if(v===this._tail)return;var p=v.next,m=v.previous;v===this._head?(p.previous=void 0,this._head=p):(p.previous=m,m.next=p),v.next=void 0,v.previous=this._tail,this._tail.next=v,this._tail=v}},d.prototype.toJSON=function(){var v=[];return this.forEach(function(b,p){v.push([p,b])}),v},d}(),C=function(d){ue(v,d);function v(b,p){p===void 0&&(p=1);var m=d.call(this)||this;return m._limit=b,m._ratio=Math.min(Math.max(0,p),1),m}return v.prototype.get=function(b){return d.prototype.get.call(this,b,2)},v.prototype.peek=function(b){return d.prototype.get.call(this,b,0)},v.prototype.set=function(b,p){d.prototype.set.call(this,b,p,2),this.checkTrim()},v.prototype.checkTrim=function(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))},v}(S)},SJMd:function(et,he){/**
* @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 K,ue,B,w=!1,_,D;window.PR_SHOULD_USE_CONTINUATION=!0;var A,N;(function(){var k=window,S=["break,continue,do,else,for,if,return,while"],C=[S,"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"],d=[C,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],v=[d,"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"],b=[d,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],p=[d,"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"],m="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",y=[d,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],n="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=[S,"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"],t=[S,"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"],r=[S,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],f=[v,p,b,y,n,e,t,r],c=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,u="str",E="kwd",g="com",s="typ",a="lit",i="pun",l="pln",T="tag",x="dec",L="src",R="atn",I="atv",F="nocode",j="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function z($){for(var te=0,de=!1,fe=!1,we=0,Ie=$.length;we<Ie;++we){var _e=$[we];if(_e.ignoreCase)fe=!0;else if(/[a-z]/i.test(_e.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){de=!0,fe=!1;break}}var Fe={b:8,t:9,n:10,v:11,f:12,r:13};function le(Le){var xe=Le.charCodeAt(0);if(xe!==92)return xe;var Oe=Le.charAt(1);return xe=Fe[Oe],xe||("0"<=Oe&&Oe<="7"?parseInt(Le.substring(1),8):Oe==="u"||Oe==="x"?parseInt(Le.substring(2),16):Le.charCodeAt(1))}function ge(Le){if(Le<32)return(Le<16?"\\x0":"\\x")+Le.toString(16);var xe=String.fromCharCode(Le);return xe==="\\"||xe==="-"||xe==="]"||xe==="^"?"\\"+xe:xe}function Ee(Le){var xe=Le.substring(1,Le.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")),Oe=[],Ue=xe[0]==="^",Te=["["];Ue&&Te.push("^");for(var Ne=Ue?1:0,oe=xe.length;Ne<oe;++Ne){var re=xe[Ne];if(/\\[bdsw]/i.test(re))Te.push(re);else{var ae=le(re),W;Ne+2<oe&&xe[Ne+1]==="-"?(W=le(xe[Ne+2]),Ne+=2):W=ae,Oe.push([ae,W]),W<65||ae>122||(W<65||ae>90||Oe.push([Math.max(65,ae)|32,Math.min(W,90)|32]),W<97||ae>122||Oe.push([Math.max(97,ae)&~32,Math.min(W,122)&~32]))}}Oe.sort(function(me,Ce){return me[0]-Ce[0]||Ce[1]-me[1]});for(var H=[],Y=[],Ne=0;Ne<Oe.length;++Ne){var ee=Oe[Ne];ee[0]<=Y[1]+1?Y[1]=Math.max(Y[1],ee[1]):H.push(Y=ee)}for(var Ne=0;Ne<H.length;++Ne){var ee=H[Ne];Te.push(ge(ee[0])),ee[1]>ee[0]&&(ee[1]+1>ee[0]&&Te.push("-"),Te.push(ge(ee[1])))}return Te.push("]"),Te.join("")}function Se(Le){for(var xe=Le.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")),Oe=xe.length,Ue=[],Te=0,Ne=0;Te<Oe;++Te){var oe=xe[Te];if(oe==="(")++Ne;else if(oe.charAt(0)==="\\"){var re=+oe.substring(1);re&&(re<=Ne?Ue[re]=-1:xe[Te]=ge(re))}}for(var Te=1;Te<Ue.length;++Te)Ue[Te]===-1&&(Ue[Te]=++te);for(var Te=0,Ne=0;Te<Oe;++Te){var oe=xe[Te];if(oe==="(")++Ne,Ue[Ne]||(xe[Te]="(?:");else if(oe.charAt(0)==="\\"){var re=+oe.substring(1);re&&re<=Ne&&(xe[Te]="\\"+Ue[re])}}for(var Te=0;Te<Oe;++Te)xe[Te]==="^"&&xe[Te+1]!=="^"&&(xe[Te]="");if(Le.ignoreCase&&de)for(var Te=0;Te<Oe;++Te){var oe=xe[Te],ae=oe.charAt(0);oe.length>=2&&ae==="["?xe[Te]=Ee(oe):ae!=="\\"&&(xe[Te]=oe.replace(/[a-zA-Z]/g,function(Y){var ee=Y.charCodeAt(0);return"["+String.fromCharCode(ee&~32,ee|32)+"]"}))}return xe.join("")}for(var Ae=[],we=0,Ie=$.length;we<Ie;++we){var _e=$[we];if(_e.global||_e.multiline)throw new Error(""+_e);Ae.push("(?:"+Se(_e)+")")}return new RegExp(Ae.join("|"),fe?"gi":"g")}function Q($,te){var de=/(?:^|\s)nocode(?:\s|$)/,fe=[],we=0,Ie=[],_e=0;function Fe(le){var ge=le.nodeType;if(ge==1){if(de.test(le.className))return;for(var Ee=le.firstChild;Ee;Ee=Ee.nextSibling)Fe(Ee);var Se=le.nodeName.toLowerCase();(Se==="br"||Se==="li")&&(fe[_e]=`
`,Ie[_e<<1]=we++,Ie[_e++<<1|1]=le)}else if(ge==3||ge==4){var Ae=le.nodeValue;Ae.length&&(te?Ae=Ae.replace(/\r\n?/g,`
`):Ae=Ae.replace(/[ \t\r\n]+/g," "),fe[_e]=Ae,Ie[_e<<1]=we,we+=Ae.length,Ie[_e++<<1|1]=le)}}return Fe($),{sourceCode:fe.join("").replace(/\n$/,""),spans:Ie}}function J($,te,de,fe,we){if(!de)return;var Ie={sourceNode:$,pre:1,langExtension:null,numberLines:null,sourceCode:de,spans:null,basePos:te,decorations:null};fe(Ie),we.push.apply(we,Ie.decorations)}var ie=/\S/;function pe($){for(var te=void 0,de=$.firstChild;de;de=de.nextSibling){var fe=de.nodeType;te=fe===1?te?$:de:fe===3&&ie.test(de.nodeValue)?$:te}return te===$?void 0:te}function ce($,te){var de={},fe;(function(){for(var _e=$.concat(te),Fe=[],le={},ge=0,Ee=_e.length;ge<Ee;++ge){var Se=_e[ge],Ae=Se[3];if(Ae)for(var Le=Ae.length;--Le>=0;)de[Ae.charAt(Le)]=Se;var xe=Se[1],Oe=""+xe;le.hasOwnProperty(Oe)||(Fe.push(xe),le[Oe]=null)}Fe.push(/[\0-\uffff]/),fe=z(Fe)})();var we=te.length,Ie=function(_e){for(var Fe=_e.sourceCode,le=_e.basePos,ge=_e.sourceNode,Ee=[le,l],Se=0,Ae=Fe.match(fe)||[],Le={},xe=0,Oe=Ae.length;xe<Oe;++xe){var Ue=Ae[xe],Te=Le[Ue],Ne=void 0,oe;if(typeof Te=="string")oe=!1;else{var re=de[Ue.charAt(0)];if(re)Ne=Ue.match(re[1]),Te=re[0];else{for(var ae=0;ae<we;++ae)if(re=te[ae],Ne=Ue.match(re[1]),Ne){Te=re[0];break}Ne||(Te=l)}oe=Te.length>=5&&Te.substring(0,5)==="lang-",oe&&!(Ne&&typeof Ne[1]=="string")&&(oe=!1,Te=L),oe||(Le[Ue]=Te)}var W=Se;if(Se+=Ue.length,!oe)Ee.push(le+W,Te);else{var H=Ne[1],Y=Ue.indexOf(H),ee=Y+H.length;Ne[2]&&(ee=Ue.length-Ne[2].length,Y=ee-H.length);var me=Te.substring(5);J(ge,le+W,Ue.substring(0,Y),Ie,Ee),J(ge,le+W+Y,H,G(me,H),Ee),J(ge,le+W+ee,Ue.substring(ee),Ie,Ee)}}_e.decorations=Ee};return Ie}function ye($){var te=[],de=[];$.tripleQuotedStrings?te.push([u,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):$.multiLineStrings?te.push([u,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):te.push([u,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),$.verbatimStrings&&de.push([u,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var fe=$.hashComments;fe&&($.cStyleComments?(fe>1?te.push([g,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):te.push([g,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),de.push([u,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):te.push([g,/^#[^\r\n]*/,null,"#"])),$.cStyleComments&&(de.push([g,/^\/\/[^\r\n]*/,null]),de.push([g,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var we=$.regexLiterals;if(we){var Ie=we>1?"":`
\r`,_e=Ie?".":"[\\S\\s]",Fe="/(?=[^/*"+Ie+"])(?:[^/\\x5B\\x5C"+Ie+"]|\\x5C"+_e+"|\\x5B(?:[^\\x5C\\x5D"+Ie+"]|\\x5C"+_e+")*(?:\\x5D|$))+/";de.push(["lang-regex",RegExp("^"+j+"("+Fe+")")])}var le=$.types;le&&de.push([s,le]);var ge=(""+$.keywords).replace(/^ | $/g,"");ge.length&&de.push([E,new RegExp("^(?:"+ge.replace(/[\s,]+/g,"|")+")\\b"),null]),te.push([l,/^\s+/,null,` \r
\xA0`]);var Ee="^.[^\\s\\w.$@'\"`/\\\\]*";return $.regexLiterals&&(Ee+="(?!s*/)"),de.push([a,/^@[a-z_$][a-z_$@0-9]*/i,null],[s,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[l,/^[a-z_$][a-z_$@0-9]*/i,null],[a,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[l,/^\\[\s\S]?/,null],[i,new RegExp(Ee),null]),ce(te,de)}var ve=ye({keywords:f,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Z($,te,de){for(var fe=/(?:^|\s)nocode(?:\s|$)/,we=/\r\n?|\n/,Ie=$.ownerDocument,_e=Ie.createElement("li");$.firstChild;)_e.appendChild($.firstChild);var Fe=[_e];function le(xe){var Oe=xe.nodeType;if(Oe==1&&!fe.test(xe.className))if(xe.nodeName==="br")ge(xe),xe.parentNode&&xe.parentNode.removeChild(xe);else for(var Ue=xe.firstChild;Ue;Ue=Ue.nextSibling)le(Ue);else if((Oe==3||Oe==4)&&de){var Te=xe.nodeValue,Ne=Te.match(we);if(Ne){var oe=Te.substring(0,Ne.index);xe.nodeValue=oe;var re=Te.substring(Ne.index+Ne[0].length);if(re){var ae=xe.parentNode;ae.insertBefore(Ie.createTextNode(re),xe.nextSibling)}ge(xe),oe||xe.parentNode.removeChild(xe)}}}function ge(xe){for(;!xe.nextSibling;)if(xe=xe.parentNode,!xe)return;function Oe(Ne,oe){var re=oe?Ne.cloneNode(!1):Ne,ae=Ne.parentNode;if(ae){var W=Oe(ae,1),H=Ne.nextSibling;W.appendChild(re);for(var Y=H;Y;Y=H)H=Y.nextSibling,W.appendChild(Y)}return re}for(var Ue=Oe(xe.nextSibling,0),Te;(Te=Ue.parentNode)&&Te.nodeType===1;)Ue=Te;Fe.push(Ue)}for(var Ee=0;Ee<Fe.length;++Ee)le(Fe[Ee]);te===(te|0)&&Fe[0].setAttribute("value",te);var Se=Ie.createElement("ol");Se.className="linenums";for(var Ae=Math.max(0,te-1|0)||0,Ee=0,Le=Fe.length;Ee<Le;++Ee)_e=Fe[Ee],_e.className="L"+(Ee+Ae)%10,_e.firstChild||_e.appendChild(Ie.createTextNode("\xA0")),Se.appendChild(_e);$.appendChild(Se)}function q($){var te=/\bMSIE\s(\d+)/.exec(navigator.userAgent);te=te&&+te[1]<=8;var de=/\n/g,fe=$.sourceCode,we=fe.length,Ie=0,_e=$.spans,Fe=_e.length,le=0,ge=$.decorations,Ee=ge.length,Se=0;ge[Ee]=we;var Ae,Le;for(Le=Ae=0;Le<Ee;)ge[Le]!==ge[Le+2]?(ge[Ae++]=ge[Le++],ge[Ae++]=ge[Le++]):Le+=2;for(Ee=Ae,Le=Ae=0;Le<Ee;){for(var xe=ge[Le],Oe=ge[Le+1],Ue=Le+2;Ue+2<=Ee&&ge[Ue+1]===Oe;)Ue+=2;ge[Ae++]=xe,ge[Ae++]=Oe,Le=Ue}Ee=ge.length=Ae;var Te=$.sourceNode,Ne="";Te&&(Ne=Te.style.display,Te.style.display="none");try{for(var oe=null;le<Fe;){var re=_e[le],ae=_e[le+2]||we,W=ge[Se+2]||we,Ue=Math.min(ae,W),H=_e[le+1],Y;if(H.nodeType!==1&&(Y=fe.substring(Ie,Ue))){te&&(Y=Y.replace(de,"\r")),H.nodeValue=Y;var ee=H.ownerDocument,me=ee.createElement("span");me.className=ge[Se+1];var Ce=H.parentNode;Ce.replaceChild(me,H),me.appendChild(H),Ie<ae&&(_e[le+1]=H=ee.createTextNode(fe.substring(Ue,ae)),Ce.insertBefore(H,me.nextSibling))}Ie=Ue,Ie>=ae&&(le+=2),Ie>=W&&(Se+=2)}}finally{Te&&(Te.style.display=Ne)}}var se={};function V($,te){for(var de=te.length;--de>=0;){var fe=te[de];se.hasOwnProperty(fe)?k.console&&console.warn("cannot override language handler %s",fe):se[fe]=$}}function G($,te){return $&&se.hasOwnProperty($)||($=/^\s*</.test(te)?"default-markup":"default-code"),se[$]}V(ve,["default-code"]),V(ce([],[[l,/^[^<?]+/],[x,/^<!\w[^>]*(?:>|$)/],[g,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[i,/^(?:<[%?]|[%?]>)/],["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"]),V(ce([[l,/^[\s]+/,null,` \r
`],[I,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[T,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[R,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[i,/^[=<>\/]+/],["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"]),V(ce([],[[I,/^[\s\S]+/]]),["uq.val"]),V(ye({keywords:v,hashComments:!0,cStyleComments:!0,types:c}),["c","cc","cpp","cxx","cyc","m"]),V(ye({keywords:"null,true,false"}),["json"]),V(ye({keywords:p,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:c}),["cs"]),V(ye({keywords:b,cStyleComments:!0}),["java"]),V(ye({keywords:r,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),V(ye({keywords:e,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),V(ye({keywords:n,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),V(ye({keywords:t,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),V(ye({keywords:y,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),V(ye({keywords:m,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),V(ce([],[[u,/^[\s\S]+/]]),["regex"]);function be($){var te=$.langExtension;try{var de=Q($.sourceNode,$.pre),fe=de.sourceCode;$.sourceCode=fe,$.spans=de.spans,$.basePos=0,G(te,fe)($),q($)}catch(we){k.console&&console.log(we&&we.stack||we)}}function Re($,te,de){var fe=de||!1,we=te||null,Ie=document.createElement("div");Ie.innerHTML="<pre>"+$+"</pre>",Ie=Ie.firstChild,fe&&Z(Ie,fe,!0);var _e={langExtension:we,numberLines:fe,sourceNode:Ie,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return be(_e),Ie.innerHTML}function De($,te){var de=te||document.body,fe=de.ownerDocument||document;function we(re){return de.getElementsByTagName(re)}for(var Ie=[we("pre"),we("code"),we("xmp")],_e=[],Fe=0;Fe<Ie.length;++Fe)for(var le=0,ge=Ie[Fe].length;le<ge;++le)_e.push(Ie[Fe][le]);Ie=null;var Ee=Date;Ee.now||(Ee={now:function(){return+new Date}});var Se=0,Ae=/\blang(?:uage)?-([\w.]+)(?!\S)/,Le=/\bprettyprint\b/,xe=/\bprettyprinted\b/,Oe=/pre|xmp/i,Ue=/^code$/i,Te=/^(?:pre|code|xmp)$/i,Ne={};function oe(){for(var re=k.PR_SHOULD_USE_CONTINUATION?Ee.now()+250:Infinity;Se<_e.length&&Ee.now()<re;Se++){for(var ae=_e[Se],W=Ne,H=ae;H=H.previousSibling;){var Y=H.nodeType,ee=(Y===7||Y===8)&&H.nodeValue;if(ee?!/^\??prettify\b/.test(ee):Y!==3||/\S/.test(H.nodeValue))break;if(ee){W={},ee.replace(/\b(\w+)=([\w:.%+-]+)/g,function(xt,rt,Dt){W[rt]=Dt});break}}var me=ae.className;if((W!==Ne||Le.test(me))&&!xe.test(me)){for(var Ce=!1,Be=ae.parentNode;Be;Be=Be.parentNode){var Ge=Be.tagName;if(Te.test(Ge)&&Be.className&&Le.test(Be.className)){Ce=!0;break}}if(!Ce){ae.className+=" prettyprinted";var Qe=W.lang;if(!Qe){Qe=me.match(Ae);var Ve;!Qe&&(Ve=pe(ae))&&Ue.test(Ve.tagName)&&(Qe=Ve.className.match(Ae)),Qe&&(Qe=Qe[1])}var qe;if(Oe.test(ae.tagName))qe=1;else{var at=ae.currentStyle,Je=fe.defaultView,Ct=at?at.whiteSpace:Je&&Je.getComputedStyle?Je.getComputedStyle(ae,null).getPropertyValue("white-space"):0;qe=Ct&&Ct.substring(0,3)==="pre"}var ht=W.linenums;(ht=ht==="true"||+ht)||(ht=me.match(/\blinenums\b(?::(\d+))?/),ht=ht?ht[1]&&ht[1].length?+ht[1]:!0:!1),ht&&Z(ae,ht,qe);var Lt={langExtension:Qe,sourceNode:ae,numberLines:ht,pre:qe,sourceCode:null,basePos:null,spans:null,decorations:null};be(Lt)}}}Se<_e.length?k.setTimeout(oe,250):typeof $=="function"&&$()}oe()}var Me=k.PR={createSimpleLexer:ce,registerLangHandler:V,sourceDecorator:ye,PR_ATTRIB_NAME:R,PR_ATTRIB_VALUE:I,PR_COMMENT:g,PR_DECLARATION:x,PR_KEYWORD:E,PR_LITERAL:a,PR_NOCODE:F,PR_PLAIN:l,PR_PUNCTUATION:i,PR_SOURCE:L,PR_STRING:u,PR_TAG:T,PR_TYPE:s,prettyPrintOne:w?k.prettyPrintOne=Re:A=Re,prettyPrint:N=w?k.prettyPrint=De:N=De},X=k.define;typeof X=="function"&&X.amd&&X("google-code-prettify",[],function(){return Me})})()},T8No:function(et,he,K){"use strict";K.d(he,"a",function(){return _}),K.d(he,"b",function(){return b}),K.d(he,"d",function(){return p}),K.d(he,"c",function(){return m}),K.d(he,"e",function(){return y});var ue=K("N0LK"),B=K("Cg/j"),w=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,f){r.__proto__=f}||function(r,f){for(var c in f)f.hasOwnProperty(c)&&(r[c]=f[c])},n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),_=function(){function n(){}return n.has=function(e){return A.create(e)},n.equals=function(e,t){return N.create(e,t)},n.regex=function(e,t){return C.create(e,t)},n.not=function(e){return S.create(e)},n.and=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v.create(e)},n.or=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return b.create(e)},n.deserialize=function(e,t){return t===void 0&&(t=!1),e?this._deserializeOrExpression(e,t):void 0},n._deserializeOrExpression=function(e,t){var r=this,f=e.split("||");return b.create(f.map(function(c){return r._deserializeAndExpression(c,t)}))},n._deserializeAndExpression=function(e,t){var r=this,f=e.split("&&");return v.create(f.map(function(c){return r._deserializeOne(c,t)}))},n._deserializeOne=function(e,t){if(e=e.trim(),e.indexOf("!=")>=0){var r=e.split("!=");return k.create(r[0].trim(),this._deserializeValue(r[1],t))}if(e.indexOf("==")>=0){var r=e.split("==");return N.create(r[0].trim(),this._deserializeValue(r[1],t))}if(e.indexOf("=~")>=0){var r=e.split("=~");return C.create(r[0].trim(),this._deserializeRegexValue(r[1],t))}return/^\!\s*/.test(e)?S.create(e.substr(1).trim()):A.create(e)},n._deserializeValue=function(e,t){if(e=e.trim(),e==="true")return!0;if(e==="false")return!1;var r=/^'([^']*)'$/.exec(e);return r?r[1].trim():e},n._deserializeRegexValue=function(e,t){if(Object(ue.x)(e)){if(t)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}var r=e.indexOf("/"),f=e.lastIndexOf("/");if(r===f||r<0){if(t)throw new Error("bad regexp-value '"+e+"', missing /-enclosure");return console.warn("bad regexp-value '"+e+"', missing /-enclosure"),null}var c=e.slice(r+1,f),u=e[f+1]==="i"?"i":"";try{return new RegExp(c,u)}catch(E){if(t)throw new Error("bad regexp-value '"+e+"', parse error: "+E);return console.warn("bad regexp-value '"+e+"', parse error: "+E),null}},n}();function D(n,e){var t=n.getType(),r=e.getType();if(t!==r)return t-r;switch(t){case 1:return n.cmp(e);case 2:return n.cmp(e);case 3:return n.cmp(e);case 4:return n.cmp(e);case 6:return n.cmp(e);case 7:return n.cmp(e);case 5:return n.cmp(e);default:throw new Error("Unknown ContextKeyExpr!")}}var A=function(){function n(e){this.key=e}return n.create=function(e){return new n(e)},n.prototype.getType=function(){return 1},n.prototype.cmp=function(e){return this.key<e.key?-1:this.key>e.key?1:0},n.prototype.equals=function(e){return e instanceof n?this.key===e.key:!1},n.prototype.evaluate=function(e){return!!e.getValue(this.key)},n.prototype.keys=function(){return[this.key]},n.prototype.negate=function(){return S.create(this.key)},n}(),N=function(){function n(e,t){this.key=e,this.value=t}return n.create=function(e,t){return typeof t=="boolean"?t?A.create(e):S.create(e):new n(e,t)},n.prototype.getType=function(){return 3},n.prototype.cmp=function(e){return this.key<e.key?-1:this.key>e.key?1:this.value<e.value?-1:this.value>e.value?1:0},n.prototype.equals=function(e){return e instanceof n?this.key===e.key&&this.value===e.value:!1},n.prototype.evaluate=function(e){return e.getValue(this.key)==this.value},n.prototype.keys=function(){return[this.key]},n.prototype.negate=function(){return k.create(this.key,this.value)},n}(),k=function(){function n(e,t){this.key=e,this.value=t}return n.create=function(e,t){return typeof t=="boolean"?t?S.create(e):A.create(e):new n(e,t)},n.prototype.getType=function(){return 4},n.prototype.cmp=function(e){return this.key<e.key?-1:this.key>e.key?1:this.value<e.value?-1:this.value>e.value?1:0},n.prototype.equals=function(e){return e instanceof n?this.key===e.key&&this.value===e.value:!1},n.prototype.evaluate=function(e){return e.getValue(this.key)!=this.value},n.prototype.keys=function(){return[this.key]},n.prototype.negate=function(){return N.create(this.key,this.value)},n}(),S=function(){function n(e){this.key=e}return n.create=function(e){return new n(e)},n.prototype.getType=function(){return 2},n.prototype.cmp=function(e){return this.key<e.key?-1:this.key>e.key?1:0},n.prototype.equals=function(e){return e instanceof n?this.key===e.key:!1},n.prototype.evaluate=function(e){return!e.getValue(this.key)},n.prototype.keys=function(){return[this.key]},n.prototype.negate=function(){return A.create(this.key)},n}(),C=function(){function n(e,t){this.key=e,this.regexp=t}return n.create=function(e,t){return new n(e,t)},n.prototype.getType=function(){return 6},n.prototype.cmp=function(e){if(this.key<e.key)return-1;if(this.key>e.key)return 1;var t=this.regexp?this.regexp.source:"",r=e.regexp?e.regexp.source:"";return t<r?-1:t>r?1:0},n.prototype.equals=function(e){if(e instanceof n){var t=this.regexp?this.regexp.source:"",r=e.regexp?e.regexp.source:"";return this.key===e.key&&t===r}return!1},n.prototype.evaluate=function(e){var t=e.getValue(this.key);return this.regexp?this.regexp.test(t):!1},n.prototype.keys=function(){return[this.key]},n.prototype.negate=function(){return d.create(this)},n}(),d=function(){function n(e){this._actual=e}return n.create=function(e){return new n(e)},n.prototype.getType=function(){return 7},n.prototype.cmp=function(e){return this._actual.cmp(e._actual)},n.prototype.equals=function(e){return e instanceof n?this._actual.equals(e._actual):!1},n.prototype.evaluate=function(e){return!this._actual.evaluate(e)},n.prototype.keys=function(){return this._actual.keys()},n.prototype.negate=function(){return this._actual},n}(),v=function(){function n(e){this.expr=e}return n.create=function(e){var t=n._normalizeArr(e);return t.length===0?void 0:t.length===1?t[0]:new n(t)},n.prototype.getType=function(){return 5},n.prototype.cmp=function(e){if(this.expr.length<e.expr.length)return-1;if(this.expr.length>e.expr.length)return 1;for(var t=0,r=this.expr.length;t<r;t++){var f=D(this.expr[t],e.expr[t]);if(f!==0)return f}return 0},n.prototype.equals=function(e){if(e instanceof n){if(this.expr.length!==e.expr.length)return!1;for(var t=0,r=this.expr.length;t<r;t++)if(!this.expr[t].equals(e.expr[t]))return!1;return!0}return!1},n.prototype.evaluate=function(e){for(var t=0,r=this.expr.length;t<r;t++)if(!this.expr[t].evaluate(e))return!1;return!0},n._normalizeArr=function(e){var t=[];if(e){for(var r=0,f=e.length;r<f;r++){var c=e[r];if(!c)continue;if(c instanceof n){t=t.concat(c.expr);continue}if(c instanceof b)throw new Error('It is not allowed to have an or expression here due to lack of parens! For example "a && (b||c)" is not supported, use "(a&&b) || (a&&c)" instead.');t.push(c)}t.sort(D)}return t},n.prototype.keys=function(){for(var e=[],t=0,r=this.expr;t<r.length;t++){var f=r[t];e.push.apply(e,f.keys())}return e},n.prototype.negate=function(){for(var e=[],t=0,r=this.expr;t<r.length;t++){var f=r[t];e.push(f.negate())}return b.create(e)},n}(),b=function(){function n(e){this.expr=e}return n.create=function(e){var t=n._normalizeArr(e);return t.length===0?void 0:t.length===1?t[0]:new n(t)},n.prototype.getType=function(){return 8},n.prototype.equals=function(e){if(e instanceof n){if(this.expr.length!==e.expr.length)return!1;for(var t=0,r=this.expr.length;t<r;t++)if(!this.expr[t].equals(e.expr[t]))return!1;return!0}return!1},n.prototype.evaluate=function(e){for(var t=0,r=this.expr.length;t<r;t++)if(this.expr[t].evaluate(e))return!0;return!1},n._normalizeArr=function(e){var t=[];if(e){for(var r=0,f=e.length;r<f;r++){var c=e[r];if(!c)continue;if(c instanceof n){t=t.concat(c.expr);continue}t.push(c)}t.sort(D)}return t},n.prototype.keys=function(){for(var e=[],t=0,r=this.expr;t<r.length;t++){var f=r[t];e.push.apply(e,f.keys())}return e},n.prototype.negate=function(){for(var e=[],t=0,r=this.expr;t<r.length;t++){var f=r[t];e.push(f.negate())}for(var c=function(L){return L instanceof n?L.expr:[L]};e.length>1;){for(var u=e.shift(),E=e.shift(),g=[],s=0,a=c(u);s<a.length;s++)for(var i=a[s],l=0,T=c(E);l<T.length;l++){var x=T[l];g.push(_.and(i,x))}e.unshift(_.or.apply(_,g))}return e[0]},n}(),p=function(n){w(e,n);function e(t,r){var f=n.call(this,t)||this;return f._defaultValue=r,f}return e.prototype.bindTo=function(t){return t.createKey(this.key,this._defaultValue)},e.prototype.getValue=function(t){return t.getContextKeyValue(this.key)},e.prototype.toNegated=function(){return _.not(this.key)},e}(A),m=Object(B.c)("contextKeyService"),y="setContext"},"U/Y8":function(et,he,K){et.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(et,he,K){"use strict";var ue=K("rePB"),B=K("Ff2n"),w=K("VTBJ"),_=K("1OyB"),D=K("vuIU"),A=K("JX7q"),N=K("Ji7U"),k=K("LK+K"),S=K("q1tI"),C=K("TSYQ"),d=K.n(C),v=K("sboe"),b=K("OZM5"),p=function(E){var g=E.prefixCls,s=E.level,a=E.isStart,i=E.isEnd;if(!s)return null;for(var l="".concat(g,"-indent-unit"),T=[],x=0;x<s;x+=1){var L;T.push(S.createElement("span",{key:x,className:d()(l,(L={},Object(ue.a)(L,"".concat(l,"-start"),a[x+1]),Object(ue.a)(L,"".concat(l,"-end"),i[x+1]),Object(ue.a)(L,"".concat(l,"-end-first-level"),!x&&i[0]),L))}))}return S.createElement("span",{"aria-hidden":"true",className:"".concat(g,"-indent")},T)},m=p,y=K("815F"),n="open",e="close",t="---",r=function(u){Object(N.a)(g,u);var E=Object(k.a)(g);function g(){var s;return Object(_.a)(this,g),s=E.apply(this,arguments),s.state={dragNodeHighlight:!1},s.onSelectorClick=function(a){var i=s.props.context.onNodeClick;i(a,Object(y.b)(s.props)),s.isSelectable()?s.onSelect(a):s.onCheck(a)},s.onSelectorDoubleClick=function(a){var i=s.props.context.onNodeDoubleClick;i(a,Object(y.b)(s.props))},s.onSelect=function(a){if(s.isDisabled())return;var i=s.props.context.onNodeSelect;a.preventDefault(),i(a,Object(y.b)(s.props))},s.onCheck=function(a){if(s.isDisabled())return;var i=s.props,l=i.disableCheckbox,T=i.checked,x=s.props.context.onNodeCheck;if(!s.isCheckable()||l)return;a.preventDefault();var L=!T;x(a,Object(y.b)(s.props),L)},s.onMouseEnter=function(a){var i=s.props.context.onNodeMouseEnter;i(a,Object(y.b)(s.props))},s.onMouseLeave=function(a){var i=s.props.context.onNodeMouseLeave;i(a,Object(y.b)(s.props))},s.onContextMenu=function(a){var i=s.props.context.onNodeContextMenu;i(a,Object(y.b)(s.props))},s.onDragStart=function(a){var i=s.props.context.onNodeDragStart;a.stopPropagation(),s.setState({dragNodeHighlight:!0}),i(a,Object(A.a)(s));try{a.dataTransfer.setData("text/plain","")}catch(l){}},s.onDragEnter=function(a){var i=s.props.context.onNodeDragEnter;a.preventDefault(),a.stopPropagation(),i(a,Object(A.a)(s))},s.onDragOver=function(a){var i=s.props.context.onNodeDragOver;a.preventDefault(),a.stopPropagation(),i(a,Object(A.a)(s))},s.onDragLeave=function(a){var i=s.props.context.onNodeDragLeave;a.stopPropagation(),i(a,Object(A.a)(s))},s.onDragEnd=function(a){var i=s.props.context.onNodeDragEnd;a.stopPropagation(),s.setState({dragNodeHighlight:!1}),i(a,Object(A.a)(s))},s.onDrop=function(a){var i=s.props.context.onNodeDrop;a.preventDefault(),a.stopPropagation(),s.setState({dragNodeHighlight:!1}),i(a,Object(A.a)(s))},s.onExpand=function(a){var i=s.props.context.onNodeExpand;i(a,Object(y.b)(s.props))},s.setSelectHandle=function(a){s.selectHandle=a},s.getNodeState=function(){var a=s.props.expanded;return s.isLeaf()?null:a?n:e},s.hasChildren=function(){var a=s.props.eventKey,i=s.props.context.keyEntities,l=i[a]||{},T=l.children;return!!(T||[]).length},s.isLeaf=function(){var a=s.props,i=a.isLeaf,l=a.loaded,T=s.props.context.loadData,x=s.hasChildren();return i===!1?!1:i||!T&&!x||T&&l&&!x},s.isDisabled=function(){var a=s.props.disabled,i=s.props.context.disabled;return!!(i||a)},s.isCheckable=function(){var a=s.props.checkable,i=s.props.context.checkable;return!i||a===!1?!1:i},s.syncLoadData=function(a){var i=a.expanded,l=a.loading,T=a.loaded,x=s.props.context,L=x.loadData,R=x.onNodeLoad;if(l)return;L&&i&&!s.isLeaf()&&(!s.hasChildren()&&!T&&R(Object(y.b)(s.props)))},s.renderSwitcher=function(){var a=s.props,i=a.expanded,l=a.switcherIcon,T=s.props.context,x=T.prefixCls,L=T.switcherIcon,R=l||L;if(s.isLeaf())return S.createElement("span",{className:d()("".concat(x,"-switcher"),"".concat(x,"-switcher-noop"))},typeof R=="function"?R(Object(w.a)(Object(w.a)({},s.props),{},{isLeaf:!0})):R);var I=d()("".concat(x,"-switcher"),"".concat(x,"-switcher_").concat(i?n:e));return S.createElement("span",{onClick:s.onExpand,className:I},typeof R=="function"?R(Object(w.a)(Object(w.a)({},s.props),{},{isLeaf:!1})):R)},s.renderCheckbox=function(){var a=s.props,i=a.checked,l=a.halfChecked,T=a.disableCheckbox,x=s.props.context.prefixCls,L=s.isDisabled(),R=s.isCheckable();if(!R)return null;var I=typeof R!="boolean"?R:null;return S.createElement("span",{className:d()("".concat(x,"-checkbox"),i&&"".concat(x,"-checkbox-checked"),!i&&l&&"".concat(x,"-checkbox-indeterminate"),(L||T)&&"".concat(x,"-checkbox-disabled")),onClick:s.onCheck},I)},s.renderIcon=function(){var a=s.props.loading,i=s.props.context.prefixCls;return S.createElement("span",{className:d()("".concat(i,"-iconEle"),"".concat(i,"-icon__").concat(s.getNodeState()||"docu"),a&&"".concat(i,"-icon_loading"))})},s.renderSelector=function(){var a=s.state.dragNodeHighlight,i=s.props,l=i.title,T=i.selected,x=i.icon,L=i.loading,R=i.data,I=s.props.context,F=I.prefixCls,j=I.showIcon,z=I.icon,Q=I.draggable,J=I.loadData,ie=I.titleRender,pe=s.isDisabled(),ce="".concat(F,"-node-content-wrapper"),ye;if(j){var ve=x||z;ye=ve?S.createElement("span",{className:d()("".concat(F,"-iconEle"),"".concat(F,"-icon__customize"))},typeof ve=="function"?ve(s.props):ve):s.renderIcon()}else J&&L&&(ye=s.renderIcon());var Z;typeof l=="function"?Z=l(R):ie?Z=ie(R):Z=l;var q=S.createElement("span",{className:"".concat(F,"-title")},Z);return S.createElement("span",{ref:s.setSelectHandle,title:typeof l=="string"?l:"",className:d()("".concat(ce),"".concat(ce,"-").concat(s.getNodeState()||"normal"),!pe&&(T||a)&&"".concat(F,"-node-selected"),!pe&&Q&&"draggable"),draggable:!pe&&Q||void 0,"aria-grabbed":!pe&&Q||void 0,onMouseEnter:s.onMouseEnter,onMouseLeave:s.onMouseLeave,onContextMenu:s.onContextMenu,onClick:s.onSelectorClick,onDoubleClick:s.onSelectorDoubleClick,onDragStart:Q?s.onDragStart:void 0},ye,q)},s}return Object(D.a)(g,[{key:"componentDidMount",value:function(){this.syncLoadData(this.props)}},{key:"componentDidUpdate",value:function(){this.syncLoadData(this.props)}},{key:"isSelectable",value:function(){var a=this.props.selectable,i=this.props.context.selectable;return typeof a=="boolean"?a:i}},{key:"render",value:function(){var a,i=this.props,l=i.eventKey,T=i.className,x=i.style,L=i.dragOver,R=i.dragOverGapTop,I=i.dragOverGapBottom,F=i.isLeaf,j=i.isStart,z=i.isEnd,Q=i.expanded,J=i.selected,ie=i.checked,pe=i.halfChecked,ce=i.loading,ye=i.domRef,ve=i.active,Z=i.onMouseMove,q=Object(B.a)(i,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),se=this.props.context,V=se.prefixCls,G=se.filterTreeNode,be=se.draggable,Re=se.keyEntities,De=this.isDisabled(),Me=Object(b.f)(q),X=Re[l]||{},$=X.level,te=z[z.length-1];return S.createElement("div",Object.assign({ref:ye,className:d()(T,"".concat(V,"-treenode"),(a={},Object(ue.a)(a,"".concat(V,"-treenode-disabled"),De),Object(ue.a)(a,"".concat(V,"-treenode-switcher-").concat(Q?"open":"close"),!F),Object(ue.a)(a,"".concat(V,"-treenode-checkbox-checked"),ie),Object(ue.a)(a,"".concat(V,"-treenode-checkbox-indeterminate"),pe),Object(ue.a)(a,"".concat(V,"-treenode-selected"),J),Object(ue.a)(a,"".concat(V,"-treenode-loading"),ce),Object(ue.a)(a,"".concat(V,"-treenode-active"),ve),Object(ue.a)(a,"".concat(V,"-treenode-leaf-last"),te),Object(ue.a)(a,"drag-over",!De&&L),Object(ue.a)(a,"drag-over-gap-top",!De&&R),Object(ue.a)(a,"drag-over-gap-bottom",!De&&I),Object(ue.a)(a,"filter-node",G&&G(Object(y.b)(this.props))),a)),style:x,onDragEnter:be?this.onDragEnter:void 0,onDragOver:be?this.onDragOver:void 0,onDragLeave:be?this.onDragLeave:void 0,onDrop:be?this.onDrop:void 0,onDragEnd:be?this.onDragEnd:void 0,onMouseMove:Z},Me),S.createElement(m,{prefixCls:V,level:$,isStart:j,isEnd:z}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),g}(S.Component),f=function(E){return S.createElement(v.a.Consumer,null,function(g){return S.createElement(r,Object.assign({},E,{context:g}))})};f.displayName="TreeNode",f.defaultProps={title:t},f.isTreeNode=1;var c=he.a=f},Y1PL:function(et,he,K){"use strict";K.r(he),K.d(he,"ResizableTextArea",function(){return pe});var ue=K("wx14"),B=K("1OyB"),w=K("vuIU"),_=K("Ji7U"),D=K("LK+K"),A=K("q1tI"),N=K("VTBJ"),k=K("rePB"),S=K("Zm9Q"),C=K("Kwbf"),d=K("c+Xe"),v=K("m+aA"),b=K("bdgK"),p=new Map;function m(ve){ve.forEach(function(Z){var q,se=Z.target;(q=p.get(se))===null||q===void 0||q.forEach(function(V){return V(se)})})}var y=new b.default(m),n=null,e=null;function t(ve,Z){p.has(ve)||(p.set(ve,new Set),y.observe(ve)),p.get(ve).add(Z)}function r(ve,Z){p.has(ve)&&(p.get(ve).delete(Z),p.get(ve).size||(y.unobserve(ve),p.delete(ve)))}var f=function(ve){Object(_.a)(q,ve);var Z=Object(D.a)(q);function q(){return Object(B.a)(this,q),Z.apply(this,arguments)}return Object(w.a)(q,[{key:"render",value:function(){return this.props.children}}]),q}(A.Component),c=A.createContext(null);function u(ve){var Z=ve.children,q=ve.onBatchResize,se=A.useRef(0),V=A.useRef([]),G=A.useContext(c),be=A.useCallback(function(Re,De,Me){se.current+=1;var X=se.current;V.current.push({size:Re,element:De,data:Me}),Promise.resolve().then(function(){X===se.current&&(q==null||q(V.current),V.current=[])}),G==null||G(Re,De,Me)},[q,G]);return A.createElement(c.Provider,{value:be},Z)}function E(ve){var Z=ve.children,q=ve.disabled,se=A.useRef(null),V=A.useRef(null),G=A.useContext(c),be=A.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Re=A.isValidElement(Z)&&Object(d.c)(Z),De=Re?Z.ref:null,Me=A.useMemo(function(){return Object(d.a)(De,se)},[De,se]),X=A.useRef(ve);X.current=ve;var $=A.useCallback(function(te){var de=X.current,fe=de.onResize,we=de.data,Ie=te.getBoundingClientRect(),_e=Ie.width,Fe=Ie.height,le=te.offsetWidth,ge=te.offsetHeight,Ee=Math.floor(_e),Se=Math.floor(Fe);if(be.current.width!==Ee||be.current.height!==Se||be.current.offsetWidth!==le||be.current.offsetHeight!==ge){var Ae={width:Ee,height:Se,offsetWidth:le,offsetHeight:ge};be.current=Ae;var Le=le===Math.round(_e)?_e:le,xe=ge===Math.round(Fe)?Fe:ge,Oe=Object(N.a)(Object(N.a)({},Ae),{},{offsetWidth:Le,offsetHeight:xe});G==null||G(Oe,te,we),fe&&Promise.resolve().then(function(){fe(Oe,te)})}},[]);return A.useEffect(function(){var te=Object(v.a)(se.current)||Object(v.a)(V.current);return te&&!q&&t(te,$),function(){return r(te,$)}},[se.current,q]),A.createElement(f,{ref:V},Re?A.cloneElement(Z,{ref:Me}):Z)}var g="rc-observer-key";function s(ve){var Z=ve.children,q=Object(S.a)(Z);return q.map(function(se,V){var G=(se==null?void 0:se.key)||"".concat(g,"-").concat(V);return A.createElement(E,Object(ue.a)({},ve,{key:G}),se)})}s.Collection=u;var a=s,i=K("bT9E"),l=K("TSYQ"),T=K.n(l),x=`
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
`,L=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],R={},I;function F(ve){var Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,q=ve.getAttribute("id")||ve.getAttribute("data-reactid")||ve.getAttribute("name");if(Z&&R[q])return R[q];var se=window.getComputedStyle(ve),V=se.getPropertyValue("box-sizing")||se.getPropertyValue("-moz-box-sizing")||se.getPropertyValue("-webkit-box-sizing"),G=parseFloat(se.getPropertyValue("padding-bottom"))+parseFloat(se.getPropertyValue("padding-top")),be=parseFloat(se.getPropertyValue("border-bottom-width"))+parseFloat(se.getPropertyValue("border-top-width")),Re=L.map(function(Me){return"".concat(Me,":").concat(se.getPropertyValue(Me))}).join(";"),De={sizingStyle:Re,paddingSize:G,borderSize:be,boxSizing:V};return Z&&q&&(R[q]=De),De}function j(ve){var Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,se=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)),ve.getAttribute("wrap")?I.setAttribute("wrap",ve.getAttribute("wrap")):I.removeAttribute("wrap");var V=F(ve,Z),G=V.paddingSize,be=V.borderSize,Re=V.boxSizing,De=V.sizingStyle;I.setAttribute("style","".concat(De,";").concat(x)),I.value=ve.value||ve.placeholder||"";var Me=Number.MIN_SAFE_INTEGER,X=Number.MAX_SAFE_INTEGER,$=I.scrollHeight,te;if(Re==="border-box"?$+=be:Re==="content-box"&&($-=G),q!==null||se!==null){I.value=" ";var de=I.scrollHeight-G;q!==null&&(Me=de*q,Re==="border-box"&&(Me=Me+G+be),$=Math.max(Me,$)),se!==null&&(X=de*se,Re==="border-box"&&(X=X+G+be),te=$>X?"":"hidden",$=Math.min(X,$))}return{height:$,minHeight:Me,maxHeight:X,overflowY:te,resize:"none"}}var z=K("Gytx"),Q=K.n(z),J;(function(ve){ve[ve.NONE=0]="NONE",ve[ve.RESIZING=1]="RESIZING",ve[ve.RESIZED=2]="RESIZED"})(J||(J={}));var ie=function(ve){Object(_.a)(q,ve);var Z=Object(D.a)(q);function q(se){var V;return Object(B.a)(this,q),V=Z.call(this,se),V.nextFrameActionId=void 0,V.resizeFrameId=void 0,V.textArea=void 0,V.saveTextArea=function(G){V.textArea=G},V.handleResize=function(G){var be=V.state.resizeStatus,Re=V.props,De=Re.autoSize,Me=Re.onResize;if(be!==J.NONE)return;typeof Me=="function"&&Me(G),De&&V.resizeOnNextFrame()},V.resizeOnNextFrame=function(){cancelAnimationFrame(V.nextFrameActionId),V.nextFrameActionId=requestAnimationFrame(V.resizeTextarea)},V.resizeTextarea=function(){var G=V.props.autoSize;if(!G||!V.textArea)return;var be=G.minRows,Re=G.maxRows,De=j(V.textArea,!1,be,Re);V.setState({textareaStyles:De,resizeStatus:J.RESIZING},function(){cancelAnimationFrame(V.resizeFrameId),V.resizeFrameId=requestAnimationFrame(function(){V.setState({resizeStatus:J.RESIZED},function(){V.resizeFrameId=requestAnimationFrame(function(){V.setState({resizeStatus:J.NONE}),V.fixFirefoxAutoScroll()})})})})},V.renderTextArea=function(){var G=V.props,be=G.prefixCls,Re=be===void 0?"rc-textarea":be,De=G.autoSize,Me=G.onResize,X=G.className,$=G.disabled,te=V.state,de=te.textareaStyles,fe=te.resizeStatus,we=Object(i.a)(V.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ie=T()(Re,X,Object(k.a)({},"".concat(Re,"-disabled"),$));"value"in we&&(we.value=we.value||"");var _e=Object(N.a)(Object(N.a)(Object(N.a)({},V.props.style),de),fe===J.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return A.createElement(a,{onResize:V.handleResize,disabled:!(De||Me)},A.createElement("textarea",Object(ue.a)({},we,{className:Ie,style:_e,ref:V.saveTextArea})))},V.state={textareaStyles:{},resizeStatus:J.NONE},V}return Object(w.a)(q,[{key:"componentDidUpdate",value:function(V){(V.value!==this.props.value||!Q()(V.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 V=this.textArea.selectionStart,G=this.textArea.selectionEnd;this.textArea.setSelectionRange(V,G)}}catch(be){}}},{key:"render",value:function(){return this.renderTextArea()}}]),q}(A.Component),pe=ie,ce=function(ve){Object(_.a)(q,ve);var Z=Object(D.a)(q);function q(se){var V;Object(B.a)(this,q),V=Z.call(this,se),V.resizableTextArea=void 0,V.focus=function(){V.resizableTextArea.textArea.focus()},V.saveTextArea=function(be){V.resizableTextArea=be},V.handleChange=function(be){var Re=V.props.onChange;V.setValue(be.target.value,function(){V.resizableTextArea.resizeTextarea()}),Re&&Re(be)},V.handleKeyDown=function(be){var Re=V.props,De=Re.onPressEnter,Me=Re.onKeyDown;be.keyCode===13&&De&&De(be),Me&&Me(be)};var G=typeof se.value=="undefined"||se.value===null?se.defaultValue:se.value;return V.state={value:G},V}return Object(w.a)(q,[{key:"setValue",value:function(V,G){"value"in this.props||this.setState({value:V},G)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return A.createElement(pe,Object(ue.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(V){return"value"in V?{value:V.value}:null}}]),q}(A.Component),ye=he.default=ce},ZW9T:function(et,he,K){"use strict";K.d(he,"a",function(){return a});var ue=K("k1fw"),B=K("oBTY"),w=K("9og8"),_=K("miYZ"),D=K("tsqr"),A=K("rAM+"),N=K("tJVT"),k=K("PpiC"),S=K("WmNS"),C=K.n(S),d=K("q1tI"),v=K.n(d),b=K("bdgK");function p(i,l,T,x,L){var R=l.getWordUntilPosition(T),I={startLineNumber:T.lineNumber,endLineNumber:T.lineNumber,startColumn:R.startColumn,endColumn:R.endColumn},F=x.map(function(j){return{label:j,kind:i.languages.CompletionItemKind.Keyword,insertText:j,insertTextRules:i.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:I}});return L.map(function(j){F.push(Object(ue.a)(Object(ue.a)({},j),{},{range:I}))}),F}var m=function(i){var l={label:"ifelse",kind:i.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:i.languages.CompletionItemInsertTextRule.InsertAsSnippet},T=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];i.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(I,F){var j=p(i,I,F,T,[l]);return{suggestions:j}}});var x=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];i.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(I,F){var j=[{label:"print",kind:i.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:i.languages.CompletionItemInsertTextRule.InsertAsSnippet}],z=p(i,I,F,x,j);return{suggestions:z}}});var L=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];i.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(I,F){var j=[l,{label:"main",kind:i.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
`),insertTextRules:i.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:i.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
`),insertTextRules:i.languages.CompletionItemInsertTextRule.InsertAsSnippet}],z=p(i,I,F,L,j);return{suggestions:z}}})},y="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",n=K("fjLI"),e=K("LvDl"),t=K("+ua5");function r(i){return/^\d+$/.test(i)?"".concat(i,"px"):i}function f(){}var c=!1,u={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python",Scala:"scale"};function E(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],l=i;if(Array.isArray(i)){for(var T=0;T<i.length;T++){var x=u[i[T]];if(x)return x}return l[0]}return u[l]||l}var g=null,s=he.b=function(i){var l=i.width,T=l===void 0?"100%":l,x=i.height,L=x===void 0?"100%":x,R=i.value,I=i.language,F=I===void 0?"javascript":I,j=i.style,z=j===void 0?{}:j,Q=i.options,J=Q===void 0?{}:Q,ie=i.overrideServices,pe=ie===void 0?{}:ie,ce=i.theme,ye=ce===void 0?"vs-dark":ce,ve=i.onEditBlur,Z=i.onSave,q=i.autoHeight,se=q===void 0?!1:q,V=i.forbidCopy,G=V===void 0?!1:V,be=i.onChange,Re=be===void 0?f:be,De=i.editorDidMount,Me=De===void 0?f:De,X=i.onFocus,$=X===void 0?f:X,te=i.onBreakPoint,de=te===void 0?f:te,fe=i.breakPointValue,we=fe===void 0?[]:fe,Ie=i.filename,_e=Ie===void 0?"educoder.txt":Ie,Fe=i.errorLine,le=i.errorContent,ge=le===void 0?"":le,Ee=i.highlightLine,Se=i.openBreakPoint,Ae=Se===void 0?!1:Se,Le=Object(k.a)(i,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","onBreakPoint","breakPointValue","filename","errorLine","errorContent","highlightLine","openBreakPoint"]),xe=Object(d.useRef)(),Oe=Object(d.useRef)({}),Ue=Object(d.useRef)(),Te=Object(d.useRef)(),Ne=Object(d.useRef)([]),oe=Object(d.useRef)(!1),re=Object(d.useRef)(),ae=Object(d.useState)(!1),W=Object(N.a)(ae,2),H=W[0],Y=W[1];function ee(){var Xe;return xe.current&&(Xe=new b.default(function(je){var He=Object(A.a)(je),lt;try{for(He.s();!(lt=He.n()).done;){var ut=lt.value;(ut.target.offsetHeight>0||ut.target.offsetWidth>0)&&Oe.current.instance.layout()}}catch(ft){He.e(ft)}finally{He.f()}}),Xe.observe(xe.current)),Xe}function me(){D.b.warn({content:decodeURIComponent(y),key:"monaco-editor-tip"})}var Ce=function(){var je=Oe.current.instance;if(R!=null&&je&&H){var He=je.getModel();He&&R!==He.getValue()&&(c=!0,He.setValue(R),je.layout(),c=!1)}};Object(d.useEffect)(function(){try{var Xe,je=Oe.current.instance;Te.current&&clearTimeout(Te.current),Te.current=setTimeout(function(){Ce()},500),je==null||((Xe=je.updateOptions)===null||Xe===void 0)||Xe.call(je,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(R.split(/\r\n|\r|\n/g).length))+3,5)})}catch(He){debugger}},[R,H,Oe.current]),Object(d.useEffect)(function(){try{if(Fe&&Oe.current&&Oe.current.instance){var Xe=Oe.current.instance;Xe.changeViewZones(function(He){var lt=document.createElement("div");lt.style.padding="10px 20px",lt.style.width="calc(100% - 20px)",lt.className="my-error-line-wrp",lt.innerHTML=ge,He.addZone({afterLineNumber:Fe||11,heightInLines:3,domNode:lt})});var je={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};Xe.addOverlayWidget(je),Xe.revealPositionInCenter({lineNumber:20,column:1})}}catch(He){debugger}},[Fe,Oe.current,H]),Object(d.useEffect)(function(){var Xe;if((Xe=Oe.current)!==null&&Xe!==void 0&&Xe.instance&&H&&Ae){var je=Oe.current.instance,He=je.getModel();if(!He)return;var lt=function(){var st=[],it=[],ct=He.getAllDecorations(),bt=Object(A.a)(ct),Et;try{for(bt.s();!(Et=bt.n()).done;){var P=Et.value;if(P.options.className==="highlighted-line"){var o;st.push(P==null||((o=P.range)===null||o===void 0)?void 0:o.startLineNumber),it.push(P==null?void 0:P.id)}}}catch(O){bt.e(O)}finally{bt.f()}He.deltaDecorations(it,[]);var h=He.getLineCount();!!Ee&&Ee<=h&&(je.deltaDecorations([],[{range:new g.Range(Ee,1,Ee,He.getLineMaxColumn(Ee)),options:{isWholeLine:!0,className:"highlighted-line"}}]),je.revealLineInCenter(Ee))};lt();var ut=function(){var st=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,it=[],ct=[],bt=He.getAllDecorations(),Et=Object(A.a)(bt),P;try{for(Et.s();!(P=Et.n()).done;){var o=P.value;if(o.options.linesDecorationsClassName==="breakpoints"){var h;it.push(o==null||((h=o.range)===null||h===void 0)?void 0:h.startLineNumber),ct.push(o==null?void 0:o.id)}}}catch(O){Et.e(O)}finally{Et.f()}if(st)return{lines:it,ids:ct};de(it)},ft=function(){var gt=Object(w.a)(C.a.mark(function st(it){var ct;return C.a.wrap(function(Et){for(;;)switch(Et.prev=Et.next){case 0:return ct={range:new g.Range(it,1,it,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints"}},Et.next=3,He.deltaDecorations([],[ct]);case 3:ut();case 4:case"end":return Et.stop()}},st)}));return function(it){return gt.apply(this,arguments)}}(),nt=function(){var gt=Object(w.a)(C.a.mark(function st(it){var ct,bt,Et,P,o;return C.a.wrap(function(O){for(;;)switch(O.prev=O.next){case 0:ct=[],bt=je.getLineDecorations(it),Et=Object(A.a)(bt);try{for(Et.s();!(P=Et.n()).done;)o=P.value,o.options.linesDecorationsClassName==="breakpoints"&&ct.push(o.id)}catch(U){Et.e(U)}finally{Et.f()}return O.next=6,He.deltaDecorations(ct,[]);case 6:ut();case 7:case"end":return O.stop()}},st)}));return function(it){return gt.apply(this,arguments)}}(),tt=function(st){var it=je.getLineDecorations(st),ct=Object(A.a)(it),bt;try{for(ct.s();!(bt=ct.n()).done;){var Et=bt.value;if(Et.options.linesDecorationsClassName==="breakpoints")return!0}}catch(P){ct.e(P)}finally{ct.f()}return!1};if(!Object(e.isEqual)(we,ut(!0).lines)){He.deltaDecorations(ut(!0).ids,[]);var Ze=we.map(function(gt){return{range:new g.Range(gt,1,gt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints"}}});He.deltaDecorations([],Ze)}var mt=je.onDidChangeModelContent(function(gt){var st=je.getPosition();if(st){var it=st.lineNumber;He.getLineContent(it).trim()===""?nt(it):tt(it)&&(nt(it),ft(it))}}),vt=je.onMouseDown(function(gt){var st,it,ct;if(gt.target.detail&&(st=gt.target)!==null&&st!==void 0&&(it=st.element)!==null&&it!==void 0&&(ct=it.className)!==null&&ct!==void 0&&ct.includes("line-numbers")){var bt=gt.target.position.lineNumber;if(He.getLineContent(bt).trim()==="")return;tt(bt)?nt(bt):ft(bt)}}),dt=function(st){var it={range:new g.Range(st,1,st,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};Ne.current=je.deltaDecorations(Ne.current,[it])},pt=function(){Ne.current=je.deltaDecorations(Ne.current,[])},Tt=je.onMouseMove(function(gt){var st,it,ct;if(pt(),gt.target.detail&&(st=gt.target)!==null&&st!==void 0&&(it=st.element)!==null&&it!==void 0&&(ct=it.className)!==null&&ct!==void 0&&ct.includes("line-numbers")){var bt=gt.target.position.lineNumber;if(He.getLineContent(bt).trim()==="")return;dt(bt)}}),It=je.onMouseLeave(function(){pt()});return function(){mt.dispose(),vt.dispose(),Tt.dispose(),It.dispose()}}},[Oe.current,H,we,Ee,Ae]);function Be(){var Xe=Oe.current.instance;if(Xe){var je=Xe.getSelection(),He=Oe.current.pastePos||{},lt=new g.Range(He.startLineNumber||je.endLineNumber,He.startColumn||je.endColumn,He.endLineNumber||je.endLineNumber,He.endColumn||je.endColumn);setTimeout(function(){Xe.executeEdits("",[{range:lt,text:""}])},300)}}function Ge(Xe){(window.navigator.platform.match("Mac")?Xe.metaKey:Xe.ctrlKey)&&Xe.keyCode==83&&(Xe.preventDefault(),Z())}var Qe=function(){if(se&&Oe.current.instance){var je=Oe.current.instance.getContentHeight();At(je<L?L:je)}else At(L)};function Ve(Xe){var je=document.createEvent("MouseEvents");je.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Xe.dispatchEvent(je)}var qe=function(je){var He=je.keyCode,lt=je.ctrlKey,ut=je.metaKey,ft=je.target,nt=je.type;return(nt==="paste"||(He===67||He===86)&&(ut||lt))&&ft.nodeName==="TEXTAREA"&&(me(),je.preventDefault()),!1};function at(Xe,je){var He=window.URL||window.webkitURL||window,lt=new Blob([je]),ut=document.createElementNS("http://www.w3.org/1999/xhtml","a");ut.href=He.createObjectURL(lt),ut.download=Xe,Ve(ut)}Object(d.useEffect)(function(){Qe()},[Qe]),Object(d.useEffect)(function(){xe.current&&!H&&K.e(27).then(K.t.bind(null,"M/lh",7)).then(function(Xe){try{g=Xe,Oe.current.instance=g.editor.create(xe.current,{value:R,language:E(F),theme:ye,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0},pe);var je=Oe.current.instance,He=n.c._menuItems,lt=Object(B.a)(He).find(function(ft){return ft[0]._debugName=="EditorContext"});if(Me(je,g),setTimeout(function(){Qe(),Oe.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){at(_e||"educoder.txt",je.getValue())}}),je.getDomNode().addEventListener("input",function(){Ue.current.autoFormat&&je.getAction("editor.action.formatDocument").run()})},500),Oe.current.subscription=je.onDidChangeModelContent(function(ft){debugger;oe.current?clearTimeout(re.current):(Qe(),Re(je.getValue(),ft)),re.current=setTimeout(function(){oe.current=!1},500)}),window.Monaco||m(g,E(F)),G&&(xe.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",qe),window.removeEventListener("paste",qe),window.addEventListener("keydown",qe),window.addEventListener("paste",qe)),window.Monaco=g,ve&&je.onDidBlurEditorWidget(function(){ve(je.getValue())}),$&&je.onDidFocusEditorText(function(){$(je.getValue())}),G)try{window.addEventListener("paste",Be)}catch(ft){}var ut=ee();return Y(!0),function(){var ft=Oe.current.instance;ft.dispose();var nt=ft.getModel();nt&&nt.dispose(),Oe.current.subscription&&Oe.current.subscription.dispose(),G&&window.removeEventListener("paste",Be),ut.unobserve(xe.current)}}catch(ft){debugger}})},[]),Object(d.useEffect)(function(){var Xe=Oe.current.instance;if(Xe&&H)return document.addEventListener("keydown",Ge,!1),function(){document.removeEventListener("keydown",Ge)}},[Z,H]),Object(d.useEffect)(function(){var Xe=Oe.current.instance;if(Xe&&H){var je=E(F);g.editor.setModelLanguage(Xe.getModel(),je)}},[F,H]),Object(d.useEffect)(function(){var Xe=Oe.current.instance;Xe&&H&&g.editor.setTheme(ye)},[ye,H]),Object(d.useEffect)(function(){var Xe=Oe.current.instance;Ue.current=J,Xe&&H&&(Xe.updateOptions(Object(ue.a)({},J)),setTimeout(function(){Xe.getModel().updateOptions(Object(ue.a)({},J))},200))},[JSON.stringify(J),H]),Object(d.useEffect)(function(){var Xe=Oe.current.instance;Xe&&H&&Xe.layout()},[T,L,H]);var Je=Object(d.useState)(r(T)),Ct=Object(N.a)(Je,2),ht=Ct[0],Lt=Ct[1],xt=Object(d.useState)(r(L)),rt=Object(N.a)(xt,2),Dt=rt[0],At=rt[1],$e=Object(ue.a)(Object(ue.a)({},z),{},{width:ht,height:Dt});return v.a.createElement("div",{className:"my-monaco-editor",ref:xe,style:$e})};function a(i){var l=i.width,T=l===void 0?"100%":l,x=i.height,L=x===void 0?"100%":x,R=i.original,I=i.modified,F=i.language,j=i.options,z=j===void 0?{}:j,Q=Object(d.useRef)(),J=Object(d.useState)(null),ie=Object(N.a)(J,2),pe=ie[0],ce=ie[1];function ye(se){var V;return Q.current&&(V=new b.default(function(G){var be=Object(A.a)(G),Re;try{for(be.s();!(Re=be.n()).done;){var De=Re.value;(De.target.offsetHeight>0||De.target.offsetWidth>0)&&se.layout()}}catch(Me){be.e(Me)}finally{be.f()}}),V.observe(Q.current)),V}Object(d.useEffect)(function(){return Q.current&&K.e(27).then(K.t.bind(null,"M/lh",7)).then(function(se){g=se;var V=g.editor.createDiffEditor(Q.current,Object(ue.a)(Object(ue.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",wordWrap:"off",ignoreTrimWhitespace:!1,"semanticHighlighting.enabled":!0,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},z),{},{wordWrap:!0}));ce(V);var G=ye(V);return function(){V.dispose();var be=V.getModel();be&&be.dispose(),G.unobserve(Q.current)}}),function(){window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}},[]),Object(d.useEffect)(function(){pe&&pe.setModel({original:g.editor.createModel(R,F),modified:g.editor.createModel(I,F)})},[R,I,F,pe]);var ve=r(T),Z=r(L),q={width:ve,height:Z};return v.a.createElement("div",{className:"my-diff-editor",ref:Q,style:q})}},ZpRC:function(et,he,K){"use strict";function ue(d){return typeof d=="object"&&d!=null&&d.nodeType===1}function B(d,v){return(!v||d!=="hidden")&&d!=="visible"&&d!=="clip"}function w(d,v){if(d.clientHeight<d.scrollHeight||d.clientWidth<d.scrollWidth){var b=getComputedStyle(d,null);return B(b.overflowY,v)||B(b.overflowX,v)||function(p){var m=function(y){if(!y.ownerDocument||!y.ownerDocument.defaultView)return null;try{return y.ownerDocument.defaultView.frameElement}catch(n){return null}}(p);return!!m&&(m.clientHeight<p.scrollHeight||m.clientWidth<p.scrollWidth)}(d)}return!1}function _(d,v,b,p,m,y,n,e){return y<d&&n>v||y>d&&n<v?0:y<=d&&e<=b||n>=v&&e>=b?y-d-p:n>v&&e<b||y<d&&e>b?n-v+m:0}var D=function(d,v){var b=window,p=v.scrollMode,m=v.block,y=v.inline,n=v.boundary,e=v.skipOverflowHiddenElements,t=typeof n=="function"?n:function(de){return de!==n};if(!ue(d))throw new TypeError("Invalid target");for(var r=document.scrollingElement||document.documentElement,f=[],c=d;ue(c)&&t(c);){if((c=c.parentElement)===r){f.push(c);break}c!=null&&c===document.body&&w(c)&&!w(document.documentElement)||c!=null&&w(c,e)&&f.push(c)}for(var u=b.visualViewport?b.visualViewport.width:innerWidth,E=b.visualViewport?b.visualViewport.height:innerHeight,g=window.scrollX||pageXOffset,s=window.scrollY||pageYOffset,a=d.getBoundingClientRect(),i=a.height,l=a.width,T=a.top,x=a.right,L=a.bottom,R=a.left,I=m==="start"||m==="nearest"?T:m==="end"?L:T+i/2,F=y==="center"?R+l/2:y==="end"?x:R,j=[],z=0;z<f.length;z++){var Q=f[z],J=Q.getBoundingClientRect(),ie=J.height,pe=J.width,ce=J.top,ye=J.right,ve=J.bottom,Z=J.left;if(p==="if-needed"&&T>=0&&R>=0&&L<=E&&x<=u&&T>=ce&&L<=ve&&R>=Z&&x<=ye)return j;var q=getComputedStyle(Q),se=parseInt(q.borderLeftWidth,10),V=parseInt(q.borderTopWidth,10),G=parseInt(q.borderRightWidth,10),be=parseInt(q.borderBottomWidth,10),Re=0,De=0,Me="offsetWidth"in Q?Q.offsetWidth-Q.clientWidth-se-G:0,X="offsetHeight"in Q?Q.offsetHeight-Q.clientHeight-V-be:0;if(r===Q)Re=m==="start"?I:m==="end"?I-E:m==="nearest"?_(s,s+E,E,V,be,s+I,s+I+i,i):I-E/2,De=y==="start"?F:y==="center"?F-u/2:y==="end"?F-u:_(g,g+u,u,se,G,g+F,g+F+l,l),Re=Math.max(0,Re+s),De=Math.max(0,De+g);else{Re=m==="start"?I-ce-V:m==="end"?I-ve+be+X:m==="nearest"?_(ce,ve,ie,V,be+X,I,I+i,i):I-(ce+ie/2)+X/2,De=y==="start"?F-Z-se:y==="center"?F-(Z+pe/2)+Me/2:y==="end"?F-ye+G+Me:_(Z,ye,pe,se,G+Me,F,F+l,l);var $=Q.scrollLeft,te=Q.scrollTop;I+=te-(Re=Math.max(0,Math.min(te+Re,Q.scrollHeight-ie+X))),F+=$-(De=Math.max(0,Math.min($+De,Q.scrollWidth-pe+Me)))}j.push({el:Q,top:Re,left:De})}return j};function A(d){return d===Object(d)&&Object.keys(d).length!==0}function N(d,v){v===void 0&&(v="auto");var b="scrollBehavior"in document.body.style;d.forEach(function(p){var m=p.el,y=p.top,n=p.left;m.scroll&&b?m.scroll({top:y,left:n,behavior:v}):(m.scrollTop=y,m.scrollLeft=n)})}function k(d){return d===!1?{block:"end",inline:"nearest"}:A(d)?d:{block:"start",inline:"nearest"}}function S(d,v){var b=!d.ownerDocument.documentElement.contains(d);if(A(v)&&typeof v.behavior=="function")return v.behavior(b?[]:D(d,v));if(b)return;var p=k(v);return N(D(d,p),p.behavior)}var C=he.a=S},bT9E:function(et,he,K){"use strict";K.d(he,"a",function(){return B});var ue=K("VTBJ");function B(w,_){var D=Object(ue.a)({},w);return Array.isArray(_)&&_.forEach(function(A){delete D[A]}),D}},fAei:function(et,he,K){"use strict";K.d(he,"a",function(){return r.a});var ue=K("rePB"),B=K("VTBJ"),w=K("KQm4"),_=K("1OyB"),D=K("vuIU"),A=K("Ji7U"),N=K("LK+K"),k=K("q1tI"),S=K("4IlW"),C=K("Kwbf"),d=K("TSYQ"),v=K.n(d),b=K("sboe"),p=K("OZM5"),m=K("815F"),y=K("ODXe"),n=K("Ff2n"),e=K("+nKL"),t=K("8XRh"),r=K("WaYH"),f=function(ye,ve){var Z=ye.className,q=ye.style,se=ye.motion,V=ye.motionNodes,G=ye.motionType,be=ye.onMotionStart,Re=ye.onMotionEnd,De=ye.active,Me=ye.treeNodeRequiredProps,X=Object(n.a)(ye,["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"]),$=k.useState(!0),te=Object(y.a)($,2),de=te[0],fe=te[1],we=k.useContext(b.a),Ie=we.prefixCls,_e=k.useRef(!1),Fe=function(){_e.current||Re(),_e.current=!0};return Object(k.useEffect)(function(){V&&G==="hide"&&de&&fe(!1)},[V]),Object(k.useEffect)(function(){return V&&be(),function(){V&&Fe()}},[]),V?k.createElement(t.default,Object.assign({ref:ve,visible:de},se,{motionAppear:G==="show",onAppearEnd:Fe,onLeaveEnd:Fe}),function(le,ge){var Ee=le.className,Se=le.style;return k.createElement("div",{ref:ge,className:v()("".concat(Ie,"-treenode-motion"),Ee),style:Se},V.map(function(Ae){var Le=Ae.data,xe=Le.key,Oe=Object(n.a)(Le,["key"]),Ue=Ae.isStart,Te=Ae.isEnd;delete Oe.children;var Ne=Object(m.f)(xe,Me);return k.createElement(r.a,Object.assign({},Oe,Ne,{active:De,data:Ae.data,key:xe,isStart:Ue,isEnd:Te}))}))}):k.createElement(r.a,Object.assign({domRef:ve,className:Z,style:q},X,{active:De}))};f.displayName="MotionTreeNode";var c=k.forwardRef(f),u=c;function E(){var ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],ve=ce.length,Z=ye.length;if(Math.abs(ve-Z)!==1)return{add:!1,key:null};function q(se,V){var G=new Map;se.forEach(function(Re){G.set(Re,!0)});var be=V.filter(function(Re){return!G.has(Re)});return be.length===1?be[0]:null}return ve<Z?{add:!0,key:q(ce,ye)}:{add:!1,key:q(ye,ce)}}function g(ce,ye,ve){var Z=ce.findIndex(function(G){var be=G.data;return be.key===ve}),q=ce[Z+1],se=ye.findIndex(function(G){var be=G.data;return be.key===ve});if(q){var V=ye.findIndex(function(G){var be=G.data;return be.key===q.data.key});return ye.slice(se+1,V)}return ye.slice(se+1)}var s={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},a=function(){},i="RC_TREE_MOTION_".concat(Math.random()),l={key:i},T={key:i,level:0,index:0,pos:"0",node:l},x={parent:null,children:[],pos:T.pos,data:l,isStart:[],isEnd:[]};function L(ce,ye,ve,Z){return ye===!1||!ve?ce:ce.slice(0,Math.ceil(ve/Z)+1)}function R(ce){var ye=ce.data.key,ve=ce.pos;return Object(m.e)(ye,ve)}function I(ce){for(var ye=String(ce.data.key),ve=ce;ve.parent;)ve=ve.parent,ye="".concat(ve.data.key," > ").concat(ye);return ye}var F=function(ye,ve){var Z=ye.prefixCls,q=ye.data,se=ye.selectable,V=ye.checkable,G=ye.expandedKeys,be=ye.selectedKeys,Re=ye.checkedKeys,De=ye.loadedKeys,Me=ye.loadingKeys,X=ye.halfCheckedKeys,$=ye.keyEntities,te=ye.disabled,de=ye.dragging,fe=ye.dragOverNodeKey,we=ye.dropPosition,Ie=ye.motion,_e=ye.height,Fe=ye.itemHeight,le=ye.virtual,ge=ye.focusable,Ee=ye.activeItem,Se=ye.focused,Ae=ye.tabIndex,Le=ye.onKeyDown,xe=ye.onFocus,Oe=ye.onBlur,Ue=ye.onActiveChange,Te=ye.onListChangeStart,Ne=ye.onListChangeEnd,oe=Object(n.a)(ye,["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"]),re=k.useRef(null);k.useImperativeHandle(ve,function(){return{scrollTo:function(He){re.current.scrollTo(He)}}});var ae=k.useState(G),W=Object(y.a)(ae,2),H=W[0],Y=W[1],ee=k.useState(q),me=Object(y.a)(ee,2),Ce=me[0],Be=me[1],Ge=k.useState(q),Qe=Object(y.a)(Ge,2),Ve=Qe[0],qe=Qe[1],at=k.useState([]),Je=Object(y.a)(at,2),Ct=Je[0],ht=Je[1],Lt=k.useState(null),xt=Object(y.a)(Lt,2),rt=xt[0],Dt=xt[1];function At(){Be(q),qe(q),ht([]),Dt(null),Ne()}k.useEffect(function(){Y(G);var je=E(H,G);if(je.key!==null)if(je.add){var He=Ce.findIndex(function(Ze){var mt=Ze.data.key;return mt===je.key}),lt=L(g(Ce,q,je.key),le,_e,Fe),ut=Ce.slice();ut.splice(He+1,0,x),qe(ut),ht(lt),Dt("show")}else{var ft=q.findIndex(function(Ze){var mt=Ze.data.key;return mt===je.key}),nt=L(g(q,Ce,je.key),le,_e,Fe),tt=q.slice();tt.splice(ft+1,0,x),qe(tt),ht(nt),Dt("hide")}else Ce!==q&&(Be(q),qe(q))},[G,q]),k.useEffect(function(){de||At()},[de]);var $e=Ie?Ve:q,Xe={expandedKeys:G,selectedKeys:be,loadedKeys:De,loadingKeys:Me,checkedKeys:Re,halfCheckedKeys:X,dragOverNodeKey:fe,dropPosition:we,keyEntities:$};return k.createElement(k.Fragment,null,Se&&Ee&&k.createElement("span",{style:s,"aria-live":"assertive"},I(Ee)),k.createElement("div",{role:"tree"},k.createElement("input",{style:s,disabled:ge===!1||te,tabIndex:ge!==!1?Ae:null,onKeyDown:Le,onFocus:xe,onBlur:Oe,value:"",onChange:a})),k.createElement(e.a,Object.assign({},oe,{data:$e,itemKey:R,height:_e,fullHeight:!1,virtual:le,itemHeight:Fe,prefixCls:"".concat(Z,"-list"),ref:re}),function(je){var He=je.pos,lt=je.data,ut=lt.key,ft=Object(n.a)(lt,["key"]),nt=je.isStart,tt=je.isEnd,Ze=Object(m.e)(ut,He);delete ft.children;var mt=Object(m.f)(Ze,Xe);return k.createElement(u,Object.assign({},ft,mt,{active:Ee&&ut===Ee.data.key,pos:He,data:je.data,isStart:nt,isEnd:tt,motion:Ie,motionNodes:ut===i?Ct:null,motionType:rt,onMotionStart:Te,onMotionEnd:At,treeNodeRequiredProps:Xe,onMouseMove:function(){Ue(null)}}))}))},j=k.forwardRef(F);j.displayName="NodeList";var z=j,Q=K("NvD2"),J=function(ce){Object(A.a)(ve,ce);var ye=Object(N.a)(ve);function ve(){var Z;return Object(_.a)(this,ve),Z=ye.apply(this,arguments),Z.destroyed=!1,Z.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},Z.listRef=k.createRef(),Z.onNodeDragStart=function(q,se){var V=Z.state,G=V.expandedKeys,be=V.keyEntities,Re=Z.props.onDragStart,De=se.props.eventKey;Z.dragNode=se;var Me=Object(p.b)(G,De);Z.setState({dragging:!0,dragNodesKeys:Object(p.g)(De,be)}),Z.setExpandedKeys(Me),Re&&Re({event:q,node:Object(m.b)(se.props)})},Z.onNodeDragEnter=function(q,se){var V=Z.state,G=V.expandedKeys,be=V.keyEntities,Re=V.dragNodesKeys,De=Z.props.onDragEnter,Me=se.props,X=Me.pos,$=Me.eventKey;if(!Z.dragNode||Re.indexOf($)!==-1)return;var te=Object(p.c)(q,se);if(Z.dragNode.props.eventKey===$&&te===0){Z.setState({dragOverNodeKey:"",dropPosition:null});return}setTimeout(function(){Z.setState({dragOverNodeKey:$,dropPosition:te}),Z.delayedDragEnterLogic||(Z.delayedDragEnterLogic={}),Object.keys(Z.delayedDragEnterLogic).forEach(function(de){clearTimeout(Z.delayedDragEnterLogic[de])}),Z.delayedDragEnterLogic[X]=window.setTimeout(function(){if(!Z.state.dragging)return;var de=Object(w.a)(G),fe=be[$];fe&&(fe.children||[]).length&&(de=Object(p.a)(G,$)),"expandedKeys"in Z.props||Z.setExpandedKeys(de),De&&De({event:q,node:Object(m.b)(se.props),expandedKeys:de})},400)},0)},Z.onNodeDragOver=function(q,se){var V=Z.state.dragNodesKeys,G=Z.props.onDragOver,be=se.props.eventKey;if(V.indexOf(be)!==-1)return;if(Z.dragNode&&be===Z.state.dragOverNodeKey){var Re=Object(p.c)(q,se);if(Re===Z.state.dropPosition)return;Z.setState({dropPosition:Re})}G&&G({event:q,node:Object(m.b)(se.props)})},Z.onNodeDragLeave=function(q,se){var V=Z.props.onDragLeave;Z.setState({dragOverNodeKey:""}),V&&V({event:q,node:Object(m.b)(se.props)})},Z.onNodeDragEnd=function(q,se){var V=Z.props.onDragEnd;Z.setState({dragOverNodeKey:""}),Z.cleanDragState(),V&&V({event:q,node:Object(m.b)(se.props)}),Z.dragNode=null},Z.onNodeDrop=function(q,se){var V=Z.state,G=V.dragNodesKeys,be=G===void 0?[]:G,Re=V.dropPosition,De=Z.props.onDrop,Me=se.props,X=Me.eventKey,$=Me.pos;if(Z.setState({dragOverNodeKey:""}),Z.cleanDragState(),be.indexOf(X)!==-1){Object(C.a)(!1,"Can not drop to dragNode(include it's children node)");return}var te=Object(p.k)($),de={event:q,node:Object(m.b)(se.props),dragNode:Z.dragNode?Object(m.b)(Z.dragNode.props):null,dragNodesKeys:be.slice(),dropPosition:Re+Number(te[te.length-1]),dropToGap:!1};Re!==0&&(de.dropToGap=!0),De&&De(de),Z.dragNode=null},Z.cleanDragState=function(){var q=Z.state.dragging;q&&Z.setState({dragging:!1})},Z.onNodeClick=function(q,se){var V=Z.props.onClick;V&&V(q,se)},Z.onNodeDoubleClick=function(q,se){var V=Z.props.onDoubleClick;V&&V(q,se)},Z.onNodeSelect=function(q,se){var V=Z.state.selectedKeys,G=Z.state.keyEntities,be=Z.props,Re=be.onSelect,De=be.multiple,Me=se.selected,X=se.key,$=!Me;$?De?V=Object(p.a)(V,X):V=[X]:V=Object(p.b)(V,X);var te=V.map(function(de){var fe=G[de];return fe?fe.node:null}).filter(function(de){return de});Z.setUncontrolledState({selectedKeys:V}),Re&&Re(V,{event:"select",selected:$,node:se,selectedNodes:te,nativeEvent:q.nativeEvent})},Z.onNodeCheck=function(q,se,V){var G=Z.state,be=G.keyEntities,Re=G.checkedKeys,De=G.halfCheckedKeys,Me=Z.props,X=Me.checkStrictly,$=Me.onCheck,te=se.key,de,fe={event:"check",node:se,checked:V,nativeEvent:q.nativeEvent};if(X){var we=V?Object(p.a)(Re,te):Object(p.b)(Re,te),Ie=Object(p.b)(De,te);de={checked:we,halfChecked:Ie},fe.checkedNodes=we.map(function(Se){return be[Se]}).filter(function(Se){return Se}).map(function(Se){return Se.node}),Z.setUncontrolledState({checkedKeys:we})}else{var _e=Object(Q.a)([].concat(Object(w.a)(Re),[te]),!0,be),Fe=_e.checkedKeys,le=_e.halfCheckedKeys;if(!V){var ge=new Set(Fe);ge.delete(te);var Ee=Object(Q.a)(Array.from(ge),{checked:!1,halfCheckedKeys:le},be);Fe=Ee.checkedKeys,le=Ee.halfCheckedKeys}de=Fe,fe.checkedNodes=[],fe.checkedNodesPositions=[],fe.halfCheckedKeys=le,Fe.forEach(function(Se){var Ae=be[Se];if(!Ae)return;var Le=Ae.node,xe=Ae.pos;fe.checkedNodes.push(Le),fe.checkedNodesPositions.push({node:Le,pos:xe})}),Z.setUncontrolledState({checkedKeys:Fe},!1,{halfCheckedKeys:le})}$&&$(de,fe)},Z.onNodeLoad=function(q){return new Promise(function(se){Z.setState(function(V){var G=V.loadedKeys,be=G===void 0?[]:G,Re=V.loadingKeys,De=Re===void 0?[]:Re,Me=Z.props,X=Me.loadData,$=Me.onLoad,te=q.key;if(!X||be.indexOf(te)!==-1||De.indexOf(te)!==-1)return{};var de=X(q);return de.then(function(){var fe=Z.state,we=fe.loadedKeys,Ie=fe.loadingKeys,_e=Object(p.a)(we,te),Fe=Object(p.b)(Ie,te);$&&$(_e,{event:"load",node:q}),Z.setUncontrolledState({loadedKeys:_e}),Z.setState({loadingKeys:Fe}),se()}),{loadingKeys:Object(p.a)(De,te)}})})},Z.onNodeMouseEnter=function(q,se){var V=Z.props.onMouseEnter;V&&V({event:q,node:se})},Z.onNodeMouseLeave=function(q,se){var V=Z.props.onMouseLeave;V&&V({event:q,node:se})},Z.onNodeContextMenu=function(q,se){var V=Z.props.onRightClick;V&&(q.preventDefault(),V({event:q,node:se}))},Z.onFocus=function(){var q=Z.props.onFocus;Z.setState({focused:!0}),q&&q.apply(void 0,arguments)},Z.onBlur=function(){var q=Z.props.onBlur;Z.setState({focused:!1}),Z.onActiveChange(null),q&&q.apply(void 0,arguments)},Z.getTreeNodeRequiredProps=function(){var q=Z.state,se=q.expandedKeys,V=q.selectedKeys,G=q.loadedKeys,be=q.loadingKeys,Re=q.checkedKeys,De=q.halfCheckedKeys,Me=q.dragOverNodeKey,X=q.dropPosition,$=q.keyEntities;return{expandedKeys:se||[],selectedKeys:V||[],loadedKeys:G||[],loadingKeys:be||[],checkedKeys:Re||[],halfCheckedKeys:De||[],dragOverNodeKey:Me,dropPosition:X,keyEntities:$}},Z.setExpandedKeys=function(q){var se=Z.state.treeData,V=Object(m.d)(se,q);Z.setUncontrolledState({expandedKeys:q,flattenNodes:V},!0)},Z.onNodeExpand=function(q,se){var V=Z.state.expandedKeys,G=Z.state.listChanging,be=Z.props,Re=be.onExpand,De=be.loadData,Me=se.key,X=se.expanded;if(G)return;var $=V.indexOf(Me),te=!X;if(Object(C.a)(X&&$!==-1||!X&&$===-1,"Expand state not sync with index check"),te?V=Object(p.a)(V,Me):V=Object(p.b)(V,Me),Z.setExpandedKeys(V),Re&&Re(V,{node:se,expanded:te,nativeEvent:q.nativeEvent}),te&&De){var de=Z.onNodeLoad(se);de&&de.then(function(){var fe=Object(m.d)(Z.state.treeData,V);Z.setUncontrolledState({flattenNodes:fe})})}},Z.onListChangeStart=function(){Z.setUncontrolledState({listChanging:!0})},Z.onListChangeEnd=function(){setTimeout(function(){Z.setUncontrolledState({listChanging:!1})})},Z.onActiveChange=function(q){var se=Z.state.activeKey,V=Z.props.onActiveChange;if(se===q)return;Z.setState({activeKey:q}),q!==null&&Z.scrollTo({key:q}),V&&V(q)},Z.getActiveItem=function(){var q=Z.state,se=q.activeKey,V=q.flattenNodes;return se===null?null:V.find(function(G){var be=G.data.key;return be===se})||null},Z.offsetActiveKey=function(q){var se=Z.state,V=se.flattenNodes,G=se.activeKey,be=V.findIndex(function(Me){var X=Me.data.key;return X===G});be===-1&&q<0&&(be=V.length),be=(be+q+V.length)%V.length;var Re=V[be];if(Re){var De=Re.data.key;Z.onActiveChange(De)}else Z.onActiveChange(null)},Z.onKeyDown=function(q){var se=Z.state,V=se.activeKey,G=se.expandedKeys,be=se.checkedKeys,Re=Z.props,De=Re.onKeyDown,Me=Re.checkable,X=Re.selectable;switch(q.which){case S.a.UP:{Z.offsetActiveKey(-1),q.preventDefault();break}case S.a.DOWN:{Z.offsetActiveKey(1),q.preventDefault();break}}var $=Z.getActiveItem();if($&&$.data){var te=Z.getTreeNodeRequiredProps(),de=$.data.isLeaf===!1||!!($.data.children||[]).length,fe=Object(m.b)(Object(B.a)(Object(B.a)({},Object(m.f)(V,te)),{},{data:$.data,active:!0}));switch(q.which){case S.a.LEFT:{de&&G.includes(V)?Z.onNodeExpand({},fe):$.parent&&Z.onActiveChange($.parent.data.key),q.preventDefault();break}case S.a.RIGHT:{de&&!G.includes(V)?Z.onNodeExpand({},fe):$.children&&$.children.length&&Z.onActiveChange($.children[0].data.key),q.preventDefault();break}case S.a.ENTER:case S.a.SPACE:{Me&&!fe.disabled&&fe.checkable!==!1&&!fe.disableCheckbox?Z.onNodeCheck({},fe,!be.includes(V)):!Me&&X&&!fe.disabled&&fe.selectable!==!1&&Z.onNodeSelect({},fe);break}}}De&&De(q)},Z.setUncontrolledState=function(q){var se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,V=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(Z.destroyed)return;var G=!1,be=!0,Re={};Object.keys(q).forEach(function(De){if(De in Z.props){be=!1;return}G=!0,Re[De]=q[De]}),G&&(!se||be)&&Z.setState(Object(B.a)(Object(B.a)({},Re),V))},Z.scrollTo=function(q){Z.listRef.current.scrollTo(q)},Z}return Object(D.a)(ve,[{key:"componentWillUnmount",value:function(){this.destroyed=!0}},{key:"render",value:function(){var q,se=this.state,V=se.focused,G=se.flattenNodes,be=se.keyEntities,Re=se.dragging,De=se.activeKey,Me=this.props,X=Me.prefixCls,$=Me.className,te=Me.style,de=Me.showLine,fe=Me.focusable,we=Me.tabIndex,Ie=we===void 0?0:we,_e=Me.selectable,Fe=Me.showIcon,le=Me.icon,ge=Me.switcherIcon,Ee=Me.draggable,Se=Me.checkable,Ae=Me.checkStrictly,Le=Me.disabled,xe=Me.motion,Oe=Me.loadData,Ue=Me.filterTreeNode,Te=Me.height,Ne=Me.itemHeight,oe=Me.virtual,re=Me.titleRender,ae=Me.onContextMenu,W=Object(p.f)(this.props);return k.createElement(b.a.Provider,{value:{prefixCls:X,selectable:_e,showIcon:Fe,icon:le,switcherIcon:ge,draggable:Ee,checkable:Se,checkStrictly:Ae,disabled:Le,keyEntities:be,loadData:Oe,filterTreeNode:Ue,titleRender:re,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop}},k.createElement("div",{className:v()(X,$,(q={},Object(ue.a)(q,"".concat(X,"-show-line"),de),Object(ue.a)(q,"".concat(X,"-focused"),V),Object(ue.a)(q,"".concat(X,"-active-focused"),De!==null),q))},k.createElement(z,Object.assign({ref:this.listRef,prefixCls:X,style:te,data:G,disabled:Le,selectable:_e,checkable:!!Se,motion:xe,dragging:Re,height:Te,itemHeight:Ne,virtual:oe,focusable:fe,focused:V,tabIndex:Ie,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:ae},this.getTreeNodeRequiredProps(),W))))}}],[{key:"getDerivedStateFromProps",value:function(q,se){var V=se.prevProps,G={prevProps:q};function be(le){return!V&&le in q||V&&V[le]!==q[le]}var Re;if(be("treeData")?Re=q.treeData:be("children")&&(Object(C.a)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),Re=Object(m.c)(q.children)),Re){G.treeData=Re;var De=Object(m.a)(Re);G.keyEntities=Object(B.a)(Object(ue.a)({},i,T),De.keyEntities)}var Me=G.keyEntities||se.keyEntities;if(be("expandedKeys")||V&&be("autoExpandParent"))G.expandedKeys=q.autoExpandParent||!V&&q.defaultExpandParent?Object(p.e)(q.expandedKeys,Me):q.expandedKeys;else if(!V&&q.defaultExpandAll){var X=Object(B.a)({},Me);delete X[i],G.expandedKeys=Object.keys(X).map(function(le){return X[le].key})}else!V&&q.defaultExpandedKeys&&(G.expandedKeys=q.autoExpandParent||q.defaultExpandParent?Object(p.e)(q.defaultExpandedKeys,Me):q.defaultExpandedKeys);if(G.expandedKeys||delete G.expandedKeys,Re||G.expandedKeys){var $=Object(m.d)(Re||se.treeData,G.expandedKeys||se.expandedKeys);G.flattenNodes=$}if(q.selectable&&(be("selectedKeys")?G.selectedKeys=Object(p.d)(q.selectedKeys,q):!V&&q.defaultSelectedKeys&&(G.selectedKeys=Object(p.d)(q.defaultSelectedKeys,q))),q.checkable){var te;if(be("checkedKeys")?te=Object(p.j)(q.checkedKeys)||{}:!V&&q.defaultCheckedKeys?te=Object(p.j)(q.defaultCheckedKeys)||{}:Re&&(te=Object(p.j)(q.checkedKeys)||{checkedKeys:se.checkedKeys,halfCheckedKeys:se.halfCheckedKeys}),te){var de=te,fe=de.checkedKeys,we=fe===void 0?[]:fe,Ie=de.halfCheckedKeys,_e=Ie===void 0?[]:Ie;if(!q.checkStrictly){var Fe=Object(Q.a)(we,!0,Me);we=Fe.checkedKeys,_e=Fe.halfCheckedKeys}G.checkedKeys=we,G.halfCheckedKeys=_e}}return be("loadedKeys")&&(G.loadedKeys=q.loadedKeys),G}}]),ve}(k.Component);J.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:[]},J.TreeNode=r.a;var ie=J,pe=he.b=ie},fjLI:function(et,he,K){"use strict";K.d(he,"e",function(){return C}),K.d(he,"a",function(){return d}),K.d(he,"c",function(){return v}),K.d(he,"d",function(){return p}),K.d(he,"b",function(){return m});var ue=K("8HAY"),B=K("Cg/j"),w=K("T8No"),_=K("nnTU"),D=K("MI8n"),A=function(){var y=function(n,e){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var f in r)r.hasOwnProperty(f)&&(t[f]=r[f])},y(n,e)};return function(n,e){y(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}}(),N=function(y,n,e,t){var r=arguments.length,f=r<3?n:t===null?t=Object.getOwnPropertyDescriptor(n,e):t,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(y,n,e,t);else for(var u=y.length-1;u>=0;u--)(c=y[u])&&(f=(r<3?c(f):r>3?c(n,e,f):c(n,e))||f);return r>3&&f&&Object.defineProperty(n,e,f),f},k=function(y,n){return function(e,t){n(e,t,y)}},S=function(){for(var y=0,n=0,e=arguments.length;n<e;n++)y+=arguments[n].length;for(var t=Array(y),r=0,n=0;n<e;n++)for(var f=arguments[n],c=0,u=f.length;c<u;c++,r++)t[r]=f[c];return t};function C(y){return y.command!==void 0}var d=Object(B.c)("menuService"),v=new(function(){function y(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new D.a,this.onDidChangeMenu=this._onDidChangeMenu.event}return y.prototype.addCommand=function(n){var e=this;return this._commands.set(n.id,n),this._onDidChangeMenu.fire(0),{dispose:function(){e._commands.delete(n.id)&&e._onDidChangeMenu.fire(0)}}},y.prototype.getCommand=function(n){return this._commands.get(n)},y.prototype.getCommands=function(){var n=new Map;return this._commands.forEach(function(e,t){return n.set(t,e)}),n},y.prototype.appendMenuItem=function(n,e){var t=this,r=this._menuItems.get(n);return r?r.push(e):(r=[e],this._menuItems.set(n,r)),this._onDidChangeMenu.fire(n),{dispose:function(){var f=r.indexOf(e);f>=0&&(r.splice(f,1),t._onDidChangeMenu.fire(n))}}},y.prototype.getMenuItems=function(n){var e=(this._menuItems.get(n)||[]).slice(0);return n===0&&this._appendImplicitItems(e),e},y.prototype._appendImplicitItems=function(n){for(var e=new Set,t=n.filter(function(g){return C(g)}),r=0,f=t;r<f.length;r++){var c=f[r],u=c.command,E=c.alt;e.add(u.id),E&&e.add(E.id)}this._commands.forEach(function(g,s){e.has(s)||n.push({command:g})})},y}()),b=function(y){A(n,y);function n(e,t,r){var f=y.call(this,e,t)||this;return f._commandService=r,f}return n.prototype.run=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(e=this._commandService).executeCommand.apply(e,S([this.id],t))},n=N([k(2,_.b)],n),n}(ue.a),p=function(y){A(n,y);function n(e){var t=this;return typeof e.title=="string"?t=y.call(this,"",e.title,"submenu")||this:t=y.call(this,"",e.title.value,"submenu")||this,t.item=e,t}return n}(ue.a),m=function(y){A(n,y);function n(e,t,r,f,c){var u=this;return typeof e.title=="string"?u=y.call(this,e.id,e.title,c)||this:u=y.call(this,e.id,e.title.value,c)||this,u._cssClass=void 0,u._enabled=!e.precondition||f.contextMatchesRules(e.precondition),u._checked=Boolean(e.toggled&&f.contextMatchesRules(e.toggled)),u._options=r||{},u.item=e,u.alt=t?new n(t,void 0,u._options,f,c):void 0,u}return n.prototype.dispose=function(){this.alt&&this.alt.dispose(),y.prototype.dispose.call(this)},n.prototype.run=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=[];return this._options.arg&&(r=S(r,[this._options.arg])),this._options.shouldForwardArgs&&(r=S(r,e)),y.prototype.run.apply(this,r)},n=N([k(3,w.c),k(4,_.b)],n),n}(b)},nnTU:function(et,he,K){"use strict";K.d(he,"b",function(){return k}),K.d(he,"a",function(){return S});var ue=K("pmY6"),B=K("746U"),w=K("Cg/j"),_=K("MI8n"),D=K("24hK"),A=K("QDVR"),N=function(){for(var C=0,d=0,v=arguments.length;d<v;d++)C+=arguments[d].length;for(var b=Array(C),p=0,d=0;d<v;d++)for(var m=arguments[d],y=0,n=m.length;y<n;y++,p++)b[p]=m[y];return b},k=Object(w.c)("commandService"),S=new(function(){function C(){this._commands=new Map,this._onDidRegisterCommand=new _.a,this.onDidRegisterCommand=this._onDidRegisterCommand.event}return C.prototype.registerCommand=function(d,v){var b=this;if(!d)throw new Error("invalid command");if(typeof d=="string"){if(!v)throw new Error("invalid command");return this.registerCommand({id:d,handler:v})}if(d.description){for(var p=[],m=0,y=d.description.args;m<y.length;m++){var n=y[m];p.push(n.constraint)}var e=d.handler;d.handler=function(u){for(var E=[],g=1;g<arguments.length;g++)E[g-1]=arguments[g];return Object(B.m)(E,p),e.apply(void 0,N([u],E))}}var t=d.id,r=this._commands.get(t);r||(r=new D.a,this._commands.set(t,r));var f=r.unshift(d),c=Object(ue.h)(function(){f();var u=b._commands.get(t);(u==null?void 0:u.isEmpty())&&b._commands.delete(t)});return this._onDidRegisterCommand.fire(t),c},C.prototype.registerCommandAlias=function(d,v){return S.registerCommand(d,function(b){for(var p,m=[],y=1;y<arguments.length;y++)m[y-1]=arguments[y];return(p=b.get(k)).executeCommand.apply(p,N([v],m))})},C.prototype.getCommand=function(d){var v=this._commands.get(d);return!v||v.isEmpty()?void 0:v.iterator().next().value},C.prototype.getCommands=function(){for(var d=new Map,v=0,b=Object(A.d)(this._commands);v<b.length;v++){var p=b[v],m=this.getCommand(p);m&&d.set(p,m)}return d},C}())},p5ED:function(et,he,K){"use strict";var ue=K("+L6B"),B=K("2/Rp"),w=K("5Dmo"),_=K("3S7+"),D=K("k1fw"),A=K("9og8"),N=K("tJVT"),k=K("WmNS"),S=K.n(k),C=K("q1tI"),d=K.n(C),v=K("vHTk"),b=K.n(v),p=K("yEEn"),m=K("ZW9T"),y=K("1vsH"),n=K("V0Rq"),e=K("m3rI");he.a=function(t){var r,f,c,u,E,g,s=t.editOffice,a=s===void 0?"view":s,i=t.name,l=t.data,T=t.theme,x=t.type,L=t.filename,R=t.monacoEditor,I=t.className,F=t.style,j=t.close,z=t.onClose,Q=t.hasMask,J=t.disabledDownload,ie=t.onImgDimensions,pe=t.otherData,ce=Object(C.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),ye=Object(N.a)(ce,2),ve=ye[0],Z=ye[1],q=Object(C.useState)(""),se=Object(N.a)(q,2),V=se[0],G=se[1],be=Object(C.useState)(),Re=Object(N.a)(be,2),De=Re[0],Me=Re[1],X=window.ENV==="build"?"/react/build":"",$=location.host.startsWith("localhost")?e.a.PROXY_SERVER:e.a.API_SERVER,te,de=1024*1024,fe=10*de,we=Object(C.useRef)();(r=l)!==null&&r!==void 0&&r.startsWith("/api")&&x!=="txt"&&(l=e.a.API_SERVER+l),x==="office"&&(te=Object(y.P)(l).filesize,te>fe&&(x="other")),L&&(R.filename=L),Object(C.useEffect)(function(){var le,ge,Ee=(le=document.cookie)===null||le===void 0||((ge=le.replace(/\s/g,""))===null||ge===void 0)?void 0:ge.split(";");Ee==null||Ee.map(function(Se){var Ae=Se.split("=");Ae[0]==="_educoder_session"&&G(Ae[1])})},[]),Object(C.useEffect)(function(){x==="office"&&Ie()},[x,l]);var Ie=function(){var le=Object(A.a)(S.a.mark(function ge(){var Ee,Se,Ae;return S.a.wrap(function(xe){for(;;)switch(xe.prev=xe.next){case 0:return console.log("data:",l),Ee=l,l.startsWith("http")||(Ee=location.origin+Ee),Se=new URL(Ee).pathname.split("/").pop(),xe.next=6,Object(n.U)({attachment_id:Se});case 6:Ae=xe.sent,Me(Ae);case 8:case"end":return xe.stop()}},ge)}));return function(){return le.apply(this,arguments)}}(),_e=function(){if(l.startsWith("http")||l.startsWith("blob:")){Fe();return}Object(y.x)(L||"educoder",l,L)},Fe=function(){Object(y.v)(L||"educoder",decodeURIComponent(l))};return d.a.createElement("div",{style:Object(D.a)({},F||{}),className:"".concat(Q&&b.a.bgBlack," ").concat(x?b.a.wrp:"hide")},j&&d.a.createElement("div",{className:b.a.close,ref:we},!!ie&&d.a.createElement(_.a,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:function(){return we.current}},d.a.createElement("span",{onClick:function(){z(),ie()}},d.a.createElement("i",{className:"icon-yulanpizhu"}))),!J&&d.a.createElement(_.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return we.current}},d.a.createElement("span",{onClick:Fe},d.a.createElement("i",{className:"icon-quxiaozhiding"}))),d.a.createElement(_.a,{title:"\u5173\u95ED",getPopupContainer:function(){return we.current}},d.a.createElement("span",{className:"",onClick:z},d.a.createElement("i",{className:"icon-guanbi1"})))),d.a.createElement("div",{className:"".concat(b.a[I]," ").concat(I," ").concat(b.a.monaco," ").concat(x==="txt"?"show":"hide")},x==="txt"&&d.a.createElement(m.b,R)),x==="audio"&&d.a.createElement("audio",{src:"".concat(((f=l)===null||f===void 0?void 0:f.indexOf("http://"))>-1||((c=l)===null||c===void 0?void 0:c.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(l),autoPlay:!0}),x==="video"&&d.a.createElement(d.a.Fragment,null,((u=l)===null||u===void 0?void 0:u.indexOf("http"))>-1?d.a.createElement("video",{controls:!0,src:"".concat(l),autoPlay:!0}):d.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(l),autoPlay:!0})),x==="office"&&De&&d.a.createElement("iframe",{src:"".concat(X,"/office.html?key=").concat(De.key,"&url=").concat($+De.url,"&callbackUrl=").concat($+De.callbackUrl,"&fileType=").concat(De.fileType,"&title=").concat(De.title,"&model=").concat(a,"&officeServer=").concat(e.a.OFFICE_SERVER,"&disabledDownload=").concat(!!J)}),(x==="xlsx"||x==="doc"||x==="pptx"||x==="docx")&&d.a.createElement("iframe",{src:"/react/build/office.html?key=".concat(pe.key,"&url=").concat(e.a.API_SERVER+pe.url,"&callbackUrl=").concat(e.a.API_SERVER+pe.callbackUrl,"&fileType=").concat(pe.fileType,"&title=").concat(pe.title,"&model=").concat(pe.model)}),x==="html"&&d.a.createElement("iframe",{src:l+"&disposition=inline"}),x==="pdf"&&d.a.createElement("embed",{className:b.a.embed,src:l}),x==="image"&&d.a.createElement("img",{src:"".concat(((E=l)===null||E===void 0?void 0:E.indexOf("http://"))>-1||((g=l)===null||g===void 0?void 0:g.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(l)}),x==="other"&&d.a.createElement("div",null,d.a.createElement(B.a,{type:"primary",size:"large",onClick:_e},d.a.createElement(p.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),x==="download"&&d.a.createElement(B.a,{type:"primary",size:"large",onClick:_e},d.a.createElement(p.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},pmY6:function(et,he,K){"use strict";K.d(he,"g",function(){return D}),K.d(he,"f",function(){return A}),K.d(he,"e",function(){return N}),K.d(he,"h",function(){return k}),K.d(he,"b",function(){return S}),K.d(he,"a",function(){return C}),K.d(he,"d",function(){return d}),K.d(he,"c",function(){return v});var ue=!1,B="__is_disposable_tracked__";function w(b){if(!ue)return;if(b&&b!==C.None)try{b[B]=!0}catch(p){}}function _(b){if(!ue)return b;var p=new Error("Potentially leaked disposable").stack;return setTimeout(function(){b[B]||console.log(p)},3e3),b}function D(b){return typeof b.dispose=="function"&&b.dispose.length===0}function A(b){return Array.isArray(b)?(b.forEach(function(p){p&&(w(p),p.dispose())}),[]):b?(w(b),b.dispose(),b):void 0}function N(){for(var b=[],p=0;p<arguments.length;p++)b[p]=arguments[p];return b.forEach(w),_({dispose:function(){return A(b)}})}function k(b){var p=_({dispose:function(){w(p),b()}});return p}var S=function(){function b(){this._toDispose=new Set,this._isDisposed=!1}return b.prototype.dispose=function(){if(this._isDisposed)return;w(this),this._isDisposed=!0,this.clear()},b.prototype.clear=function(){this._toDispose.forEach(function(p){return p.dispose()}),this._toDispose.clear()},b.prototype.add=function(p){if(!p)return p;if(p===this)throw new Error("Cannot register a disposable on itself!");return w(p),this._isDisposed?console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(p),p},b}(),C=function(){function b(){this._store=new S,_(this)}return b.prototype.dispose=function(){w(this),this._store.dispose()},b.prototype._register=function(p){if(p===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(p)},b.None=Object.freeze({dispose:function(){}}),b}(),d=function(){function b(){this._isDisposed=!1,_(this)}return Object.defineProperty(b.prototype,"value",{get:function(){return this._isDisposed?void 0:this._value},set:function(p){if(this._isDisposed||p===this._value)return;this._value&&this._value.dispose(),p&&w(p),this._value=p},enumerable:!0,configurable:!0}),b.prototype.clear=function(){this.value=void 0},b.prototype.dispose=function(){this._isDisposed=!0,w(this),this._value&&this._value.dispose(),this._value=void 0},b}(),v=function(){function b(p){this.object=p}return b.prototype.dispose=function(){},b}()},"rAM+":function(et,he,K){"use strict";K.d(he,"a",function(){return B});var ue=K("Qw5x");function B(w,_){var D;if(typeof Symbol=="undefined"||w[Symbol.iterator]==null){if(Array.isArray(w)||(D=Object(ue.a)(w))||_&&w&&typeof w.length=="number"){D&&(w=D);var A=0,N=function(){};return{s:N,n:function(){return A>=w.length?{done:!0}:{done:!1,value:w[A++]}},e:function(v){throw v},f:N}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var k=!0,S=!1,C;return{s:function(){D=w[Symbol.iterator]()},n:function(){var v=D.next();return k=v.done,v},e:function(v){S=!0,C=v},f:function(){try{!k&&D.return!=null&&D.return()}finally{if(S)throw C}}}}},rUJ1:function(et,he){const K=/[&<>"']/,ue=/[&<>"']/g,B=/[<>"']|&(?!#?\w+;)/,w=/[<>"']|&(?!#?\w+;)/g,_={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},D=g=>_[g];function A(g,s){if(s){if(K.test(g))return g.replace(ue,D)}else if(B.test(g))return g.replace(w,D);return g}const N=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function k(g){return g.replace(N,(s,a)=>(a=a.toLowerCase(),a==="colon"?":":a.charAt(0)==="#"?a.charAt(1)==="x"?String.fromCharCode(parseInt(a.substring(2),16)):String.fromCharCode(+a.substring(1)):""))}const S=/(^|[^\[])\^/g;function C(g,s){g=g.source||g,s=s||"";const a={replace:(i,l)=>(l=l.source||l,l=l.replace(S,"$1"),g=g.replace(i,l),a),getRegex:()=>new RegExp(g,s)};return a}const d=/[^\w:]/g,v=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function b(g,s,a){if(g){let i;try{i=decodeURIComponent(k(a)).replace(d,"").toLowerCase()}catch(l){return null}if(i.indexOf("javascript:")===0||i.indexOf("vbscript:")===0||i.indexOf("data:")===0)return null}s&&!v.test(a)&&(a=e(s,a));try{a=encodeURI(a).replace(/%25/g,"%")}catch(i){return null}return a}const p={},m=/^[^:]+:\/*[^/]*$/,y=/^([^:]+:)[\s\S]*$/,n=/^([^:]+:\/*[^/]*)[\s\S]*$/;function e(g,s){p[" "+g]||(m.test(g)?p[" "+g]=g+"/":p[" "+g]=c(g,"/",!0)),g=p[" "+g];const a=g.indexOf(":")===-1;return s.substring(0,2)==="//"?a?s:g.replace(y,"$1")+s:s.charAt(0)==="/"?a?s:g.replace(n,"$1")+s:g+s}const t={exec:function(){}};function r(g){let s=1,a,i;for(;s<arguments.length;s++){a=arguments[s];for(i in a)Object.prototype.hasOwnProperty.call(a,i)&&(g[i]=a[i])}return g}function f(g,s){const a=g.replace(/\|/g,(T,x,L)=>{let R=!1,I=x;for(;--I>=0&&L[I]==="\\";)R=!R;return R?"|":" |"}),i=a.split(/ \|/);let l=0;if(i.length>s)i.splice(s);else for(;i.length<s;)i.push("");for(;l<i.length;l++)i[l]=i[l].trim().replace(/\\\|/g,"|");return i}function c(g,s,a){const i=g.length;if(i===0)return"";let l=0;for(;l<i;){const T=g.charAt(i-l-1);if(T===s&&!a)l++;else if(T!==s&&a)l++;else break}return g.substr(0,i-l)}function u(g,s){if(g.indexOf(s[1])===-1)return-1;const a=g.length;let i=0,l=0;for(;l<a;l++)if(g[l]==="\\")l++;else if(g[l]===s[0])i++;else if(g[l]===s[1]&&(i--,i<0))return l;return-1}function E(g){g&&g.sanitize&&!g.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")}et.exports={escape:A,unescape:k,edit:C,cleanUrl:b,resolveUrl:e,noopTest:t,merge:r,splitCells:f,rtrim:c,findClosingBracket:u,checkSanitizeDeprecation:E}},sboe:function(et,he,K){"use strict";K.d(he,"a",function(){return w});var ue=K("q1tI"),B=K.n(ue),w=ue.createContext(null)},ulZh:function(et,he,K){typeof window!="undefined"&&function(B,w){et.exports=w()}(this,function(){return function(ue){var B={};function w(_){if(B[_])return B[_].exports;var D=B[_]={i:_,l:!1,exports:{}};return ue[_].call(D.exports,D,D.exports,w),D.l=!0,D.exports}return w.m=ue,w.c=B,w.d=function(_,D,A){w.o(_,D)||Object.defineProperty(_,D,{enumerable:!0,get:A})},w.r=function(_){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(_,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(_,"__esModule",{value:!0})},w.t=function(_,D){if(D&1&&(_=w(_)),D&8)return _;if(D&4&&typeof _=="object"&&_&&_.__esModule)return _;var A=Object.create(null);if(w.r(A),Object.defineProperty(A,"default",{enumerable:!0,value:_}),D&2&&typeof _!="string")for(var N in _)w.d(A,N,function(k){return _[k]}.bind(null,N));return A},w.n=function(_){var D=_&&_.__esModule?function(){return _.default}:function(){return _};return w.d(D,"a",D),D},w.o=function(_,D){return Object.prototype.hasOwnProperty.call(_,D)},w.p="/dist/",w(w.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ue,B,w){"use strict";var _=Object.prototype.hasOwnProperty,D="~";function A(){}Object.create&&(A.prototype=Object.create(null),new A().__proto__||(D=!1));function N(d,v,b){this.fn=d,this.context=v,this.once=b||!1}function k(d,v,b,p,m){if(typeof b!="function")throw new TypeError("The listener must be a function");var y=new N(b,p||d,m),n=D?D+v:v;return d._events[n]?d._events[n].fn?d._events[n]=[d._events[n],y]:d._events[n].push(y):(d._events[n]=y,d._eventsCount++),d}function S(d,v){--d._eventsCount===0?d._events=new A:delete d._events[v]}function C(){this._events=new A,this._eventsCount=0}C.prototype.eventNames=function(){var v=[],b,p;if(this._eventsCount===0)return v;for(p in b=this._events)_.call(b,p)&&v.push(D?p.slice(1):p);return Object.getOwnPropertySymbols?v.concat(Object.getOwnPropertySymbols(b)):v},C.prototype.listeners=function(v){var b=D?D+v:v,p=this._events[b];if(!p)return[];if(p.fn)return[p.fn];for(var m=0,y=p.length,n=new Array(y);m<y;m++)n[m]=p[m].fn;return n},C.prototype.listenerCount=function(v){var b=D?D+v:v,p=this._events[b];return p?p.fn?1:p.length:0},C.prototype.emit=function(v,b,p,m,y,n){var e=D?D+v:v;if(!this._events[e])return!1;var t=this._events[e],r=arguments.length,f,c;if(t.fn){t.once&&this.removeListener(v,t.fn,void 0,!0);switch(r){case 1:return t.fn.call(t.context),!0;case 2:return t.fn.call(t.context,b),!0;case 3:return t.fn.call(t.context,b,p),!0;case 4:return t.fn.call(t.context,b,p,m),!0;case 5:return t.fn.call(t.context,b,p,m,y),!0;case 6:return t.fn.call(t.context,b,p,m,y,n),!0}for(c=1,f=new Array(r-1);c<r;c++)f[c-1]=arguments[c];t.fn.apply(t.context,f)}else{var u=t.length,E;for(c=0;c<u;c++){t[c].once&&this.removeListener(v,t[c].fn,void 0,!0);switch(r){case 1:t[c].fn.call(t[c].context);break;case 2:t[c].fn.call(t[c].context,b);break;case 3:t[c].fn.call(t[c].context,b,p);break;case 4:t[c].fn.call(t[c].context,b,p,m);break;default:if(!f)for(E=1,f=new Array(r-1);E<r;E++)f[E-1]=arguments[E];t[c].fn.apply(t[c].context,f)}}}return!0},C.prototype.on=function(v,b,p){return k(this,v,b,p,!1)},C.prototype.once=function(v,b,p){return k(this,v,b,p,!0)},C.prototype.removeListener=function(v,b,p,m){var y=D?D+v:v;if(!this._events[y])return this;if(!b)return S(this,y),this;var n=this._events[y];if(n.fn)n.fn===b&&(!m||n.once)&&(!p||n.context===p)&&S(this,y);else{for(var e=0,t=[],r=n.length;e<r;e++)(n[e].fn!==b||m&&!n[e].once||p&&n[e].context!==p)&&t.push(n[e]);t.length?this._events[y]=t.length===1?t[0]:t:S(this,y)}return this},C.prototype.removeAllListeners=function(v){var b;return v?(b=D?D+v:v,this._events[b]&&S(this,b)):(this._events=new A,this._eventsCount=0),this},C.prototype.off=C.prototype.removeListener,C.prototype.addListener=C.prototype.on,C.prefixed=D,C.EventEmitter=C,ue.exports=C},"./node_modules/url-toolkit/src/url-toolkit.js":function(ue,B,w){(function(_){var D=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,A=/^([^\/?#]*)([^]*)$/,N=/(?:\/|^)\.(?=\/)/g,k=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,S={buildAbsoluteURL:function(C,d,v){if(v=v||{},C=C.trim(),d=d.trim(),!d){if(!v.alwaysNormalize)return C;var b=S.parseURL(C);if(!b)throw new Error("Error trying to parse base URL.");return b.path=S.normalizePath(b.path),S.buildURLFromParts(b)}var p=S.parseURL(d);if(!p)throw new Error("Error trying to parse relative URL.");if(p.scheme)return v.alwaysNormalize?(p.path=S.normalizePath(p.path),S.buildURLFromParts(p)):d;var m=S.parseURL(C);if(!m)throw new Error("Error trying to parse base URL.");if(!m.netLoc&&m.path&&m.path[0]!=="/"){var y=A.exec(m.path);m.netLoc=y[1],m.path=y[2]}m.netLoc&&!m.path&&(m.path="/");var n={scheme:m.scheme,netLoc:p.netLoc,path:null,params:p.params,query:p.query,fragment:p.fragment};if(!p.netLoc&&(n.netLoc=m.netLoc,p.path[0]!=="/"))if(!p.path)n.path=m.path,p.params||(n.params=m.params,p.query||(n.query=m.query));else{var e=m.path,t=e.substring(0,e.lastIndexOf("/")+1)+p.path;n.path=S.normalizePath(t)}return n.path===null&&(n.path=v.alwaysNormalize?S.normalizePath(p.path):p.path),S.buildURLFromParts(n)},parseURL:function(C){var d=D.exec(C);return d?{scheme:d[1]||"",netLoc:d[2]||"",path:d[3]||"",params:d[4]||"",query:d[5]||"",fragment:d[6]||""}:null},normalizePath:function(C){for(C=C.split("").reverse().join("").replace(N,"");C.length!==(C=C.replace(k,"")).length;);return C.split("").reverse().join("")},buildURLFromParts:function(C){return C.scheme+C.netLoc+C.path+C.params+C.query+C.fragment}};ue.exports=S})(this)},"./node_modules/webworkify-webpack/index.js":function(ue,B,w){function _(v){var b={};function p(y){if(b[y])return b[y].exports;var n=b[y]={i:y,l:!1,exports:{}};return v[y].call(n.exports,n,n.exports,p),n.l=!0,n.exports}p.m=v,p.c=b,p.i=function(y){return y},p.d=function(y,n,e){p.o(y,n)||Object.defineProperty(y,n,{configurable:!1,enumerable:!0,get:e})},p.r=function(y){Object.defineProperty(y,"__esModule",{value:!0})},p.n=function(y){var n=y&&y.__esModule?function(){return y.default}:function(){return y};return p.d(n,"a",n),n},p.o=function(y,n){return Object.prototype.hasOwnProperty.call(y,n)},p.p="/",p.oe=function(y){throw console.error(y),y};var m=p(p.s=ENTRY_MODULE);return m.default||m}var D="[\\.|\\-|\\+|\\w|/|@]+",A="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+D+").*?\\)";function N(v){return(v+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function k(v){return!isNaN(1*v)}function S(v,b,p){var m={};m[p]=[];var y=b.toString(),n=y.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!n)return m;for(var e=n[1],t=new RegExp("(\\\\n|\\W)"+N(e)+A,"g"),r;r=t.exec(y);){if(r[3]==="dll-reference")continue;m[p].push(r[3])}for(t=new RegExp("\\("+N(e)+'\\("(dll-reference\\s('+D+'))"\\)\\)'+A,"g");r=t.exec(y);)v[r[2]]||(m[p].push(r[1]),v[r[2]]=w(r[1]).m),m[r[2]]=m[r[2]]||[],m[r[2]].push(r[4]);for(var f=Object.keys(m),c=0;c<f.length;c++)for(var u=0;u<m[f[c]].length;u++)k(m[f[c]][u])&&(m[f[c]][u]=1*m[f[c]][u]);return m}function C(v){var b=Object.keys(v);return b.reduce(function(p,m){return p||v[m].length>0},!1)}function d(v,b){for(var p={main:[b]},m={main:[]},y={main:{}};C(p);)for(var n=Object.keys(p),e=0;e<n.length;e++){var t=n[e],r=p[t],f=r.pop();if(y[t]=y[t]||{},y[t][f]||!v[t][f])continue;y[t][f]=!0,m[t]=m[t]||[],m[t].push(f);for(var c=S(v,v[t][f],t),u=Object.keys(c),E=0;E<u.length;E++)p[u[E]]=p[u[E]]||[],p[u[E]]=p[u[E]].concat(c[u[E]])}return m}ue.exports=function(v,b){b=b||{};var p={main:w.m},m=b.all?{main:Object.keys(p.main)}:d(p,v),y="";Object.keys(m).filter(function(f){return f!=="main"}).forEach(function(f){for(var c=0;m[f][c];)c++;m[f].push(c),p[f][c]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",y=y+"var "+f+" = ("+_.toString().replace("ENTRY_MODULE",JSON.stringify(c))+")({"+m[f].map(function(u){return""+JSON.stringify(u)+": "+p[f][u].toString()}).join(",")+`});
`}),y=y+"new (("+_.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+m.main.map(function(f){return""+JSON.stringify(f)+": "+p.main[f].toString()}).join(",")+"}))(self);";var n=new window.Blob([y],{type:"text/javascript"});if(b.bare)return n;var e=window.URL||window.webkitURL||window.mozURL||window.msURL,t=e.createObjectURL(n),r=new window.Worker(t);return r.objectURL=t,r}},"./src/config.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"hlsDefaultConfig",function(){return E}),w.d(B,"mergeConfig",function(){return s}),w.d(B,"enableStreamingMode",function(){return a});var _=w("./src/controller/abr-controller.ts"),D=w("./src/controller/audio-stream-controller.ts"),A=w("./src/controller/audio-track-controller.ts"),N=w("./src/controller/subtitle-stream-controller.ts"),k=w("./src/controller/subtitle-track-controller.ts"),S=w("./src/controller/buffer-controller.ts"),C=w("./src/controller/timeline-controller.ts"),d=w("./src/controller/cap-level-controller.ts"),v=w("./src/controller/fps-controller.ts"),b=w("./src/controller/eme-controller.ts"),p=w("./src/controller/cmcd-controller.ts"),m=w("./src/utils/xhr-loader.ts"),y=w("./src/utils/fetch-loader.ts"),n=w("./src/utils/cues.ts"),e=w("./src/utils/mediakeys-helper.ts"),t=w("./src/utils/logger.ts");function r(){return r=Object.assign||function(i){for(var l=1;l<arguments.length;l++){var T=arguments[l];for(var x in T)Object.prototype.hasOwnProperty.call(T,x)&&(i[x]=T[x])}return i},r.apply(this,arguments)}function f(i,l){var T=Object.keys(i);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(i);l&&(x=x.filter(function(L){return Object.getOwnPropertyDescriptor(i,L).enumerable})),T.push.apply(T,x)}return T}function c(i){for(var l=1;l<arguments.length;l++){var T=arguments[l]!=null?arguments[l]:{};l%2?f(Object(T),!0).forEach(function(x){u(i,x,T[x])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(T)):f(Object(T)).forEach(function(x){Object.defineProperty(i,x,Object.getOwnPropertyDescriptor(T,x))})}return i}function u(i,l,T){return l in i?Object.defineProperty(i,l,{value:T,enumerable:!0,configurable:!0,writable:!0}):i[l]=T,i}var E=c(c({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:m.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:_.default,bufferController:S.default,capLevelController:d.default,fpsController:v.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},g()),{},{subtitleStreamController:N.SubtitleStreamController,subtitleTrackController:k.default,timelineController:C.TimelineController,audioStreamController:D.default,audioTrackController:A.default,emeController:b.default,cmcdController:p.default});function g(){return{cueHandler:n.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 s(i,l){if((l.liveSyncDurationCount||l.liveMaxLatencyDurationCount)&&(l.liveSyncDuration||l.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(l.liveMaxLatencyDurationCount!==void 0&&(l.liveSyncDurationCount===void 0||l.liveMaxLatencyDurationCount<=l.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(l.liveMaxLatencyDuration!==void 0&&(l.liveSyncDuration===void 0||l.liveMaxLatencyDuration<=l.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return r({},i,l)}function a(i){var l=i.loader;if(l!==y.default&&l!==m.default)t.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),i.progressive=!1;else{var T=Object(y.fetchSupported)();T&&(i.loader=y.default,i.progressive=!0,i.enableSoftwareAES=!0,t.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ue,B,w){"use strict";w.r(B);var _=w("./src/polyfills/number.ts"),D=w("./src/utils/ewma-bandwidth-estimator.ts"),A=w("./src/events.ts"),N=w("./src/utils/buffer-helper.ts"),k=w("./src/errors.ts"),S=w("./src/types/loader.ts"),C=w("./src/utils/logger.ts");function d(p,m){for(var y=0;y<m.length;y++){var n=m[y];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(p,n.key,n)}}function v(p,m,y){return m&&d(p.prototype,m),y&&d(p,y),p}var b=function(){function p(y){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=y;var n=y.config;this.bwEstimator=new D.default(n.abrEwmaSlowVoD,n.abrEwmaFastVoD,n.abrEwmaDefaultEstimate),this.registerListeners()}var m=p.prototype;return m.registerListeners=function(){var n=this.hls;n.on(A.Events.FRAG_LOADING,this.onFragLoading,this),n.on(A.Events.FRAG_LOADED,this.onFragLoaded,this),n.on(A.Events.FRAG_BUFFERED,this.onFragBuffered,this),n.on(A.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.on(A.Events.ERROR,this.onError,this)},m.unregisterListeners=function(){var n=this.hls;n.off(A.Events.FRAG_LOADING,this.onFragLoading,this),n.off(A.Events.FRAG_LOADED,this.onFragLoaded,this),n.off(A.Events.FRAG_BUFFERED,this.onFragBuffered,this),n.off(A.Events.LEVEL_LOADED,this.onLevelLoaded,this),n.off(A.Events.ERROR,this.onError,this)},m.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},m.onFragLoading=function(n,e){var t=e.frag;if(t.type===S.PlaylistLevelType.MAIN&&!this.timer){var r;this.fragCurrent=t,this.partCurrent=(r=e.part)!=null?r:null,this.timer=self.setInterval(this.onCheck,100)}},m.onLevelLoaded=function(n,e){var t=this.hls.config;e.details.live?this.bwEstimator.update(t.abrEwmaSlowLive,t.abrEwmaFastLive):this.bwEstimator.update(t.abrEwmaSlowVoD,t.abrEwmaFastVoD)},m._abandonRulesCheck=function(){var n=this.fragCurrent,e=this.partCurrent,t=this.hls,r=t.autoLevelEnabled,f=t.config,c=t.media;if(!n||!c)return;var u=e?e.stats:n.stats,E=e?e.duration:n.duration;if(u.aborted){C.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!r||c.paused||!c.playbackRate||!c.readyState)return;var g=performance.now()-u.loading.start,s=Math.abs(c.playbackRate);if(g<=500*E/s)return;var a=t.levels,i=t.minAutoLevel,l=a[n.level],T=u.total||Math.max(u.loaded,Math.round(E*l.maxBitrate/8)),x=Math.max(1,u.bwEstimate?u.bwEstimate/8:u.loaded*1e3/g),L=(T-u.loaded)/x,R=c.currentTime,I=(N.BufferHelper.bufferInfo(c,R,f.maxBufferHole).end-R)/s;if(I>=2*E/s||L<=I)return;var F=Number.POSITIVE_INFINITY,j;for(j=n.level-1;j>i;j--){var z=a[j].maxBitrate;if(F=E*z/(8*.8*x),F<I)break}if(F>=L)return;var Q=this.bwEstimator.getEstimate();C.logger.warn("Fragment "+n.sn+(e?" part "+e.index:"")+" of level "+n.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+j+`
Current BW estimate: `+(Object(_.isFiniteNumber)(Q)?(Q/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+L.toFixed(3)+` s
Estimated load time for the next fragment: `+F.toFixed(3)+` s
Time to underbuffer: `+I.toFixed(3)+" s"),t.nextLoadLevel=j,this.bwEstimator.sample(g,u.loaded),this.clearTimer(),n.loader&&(this.fragCurrent=this.partCurrent=null,n.loader.abort()),t.trigger(A.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:n,part:e,stats:u})},m.onFragLoaded=function(n,e){var t=e.frag,r=e.part;if(t.type===S.PlaylistLevelType.MAIN&&Object(_.isFiniteNumber)(t.sn)){var f=r?r.stats:t.stats,c=r?r.duration:t.duration;if(this.clearTimer(),this.lastLoadedFragLevel=t.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var u=this.hls.levels[t.level],E=(u.loaded?u.loaded.bytes:0)+f.loaded,g=(u.loaded?u.loaded.duration:0)+c;u.loaded={bytes:E,duration:g},u.realBitrate=Math.round(8*E/g)}if(t.bitrateTest){var s={stats:f,frag:t,part:r,id:t.type};this.onFragBuffered(A.Events.FRAG_BUFFERED,s),t.bitrateTest=!1}}},m.onFragBuffered=function(n,e){var t=e.frag,r=e.part,f=r?r.stats:t.stats;if(f.aborted)return;if(t.type!==S.PlaylistLevelType.MAIN||t.sn==="initSegment")return;var c=f.parsing.end-f.loading.start;this.bwEstimator.sample(c,f.loaded),f.bwEstimate=this.bwEstimator.getEstimate(),t.bitrateTest?this.bitrateTestDelay=c/1e3:this.bitrateTestDelay=0},m.onError=function(n,e){switch(e.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},m.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},m.getNextABRAutoLevel=function(){var n=this.fragCurrent,e=this.partCurrent,t=this.hls,r=t.maxAutoLevel,f=t.config,c=t.minAutoLevel,u=t.media,E=e?e.duration:n?n.duration:0,g=u?u.currentTime:0,s=u&&u.playbackRate!==0?Math.abs(u.playbackRate):1,a=this.bwEstimator?this.bwEstimator.getEstimate():f.abrEwmaDefaultEstimate,i=(N.BufferHelper.bufferInfo(u,g,f.maxBufferHole).end-g)/s,l=this.findBestLevel(a,c,r,i,f.abrBandWidthFactor,f.abrBandWidthUpFactor);if(l>=0)return l;C.logger.trace((i?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var T=E?Math.min(E,f.maxStarvationDelay):f.maxStarvationDelay,x=f.abrBandWidthFactor,L=f.abrBandWidthUpFactor;if(!i){var R=this.bitrateTestDelay;if(R){var I=E?Math.min(E,f.maxLoadingDelay):f.maxLoadingDelay;T=I-R,C.logger.trace("bitrate test took "+Math.round(1e3*R)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*T)+" ms"),x=L=1}}return l=this.findBestLevel(a,c,r,i+T,x,L),Math.max(l,0)},m.findBestLevel=function(n,e,t,r,f,c){for(var u,E=this.fragCurrent,g=this.partCurrent,s=this.lastLoadedFragLevel,a=this.hls.levels,i=a[s],l=!!(i!=null&&(u=i.details)!==null&&u!==void 0&&u.live),T=i==null?void 0:i.codecSet,x=g?g.duration:E?E.duration:0,L=t;L>=e;L--){var R=a[L];if(!R||T&&R.codecSet!==T)continue;var I=R.details,F=(g?I==null?void 0:I.partTarget:I==null?void 0:I.averagetargetduration)||x,j=void 0;L<=s?j=f*n:j=c*n;var z=a[L].maxBitrate,Q=z*F/j;if(C.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+L+"/"+Math.round(j)+"/"+z+"/"+F+"/"+r+"/"+Q),j>z&&(!Q||l&&!this.bitrateTestDelay||Q<r))return L}return-1},v(p,[{key:"nextAutoLevel",get:function(){var n=this._nextAutoLevel,e=this.bwEstimator;if(n!==-1&&(!e||!e.canEstimate()))return n;var t=this.getNextABRAutoLevel();return n!==-1&&(t=Math.min(n,t)),t},set:function(n){this._nextAutoLevel=n}}]),p}();B.default=b},"./src/controller/audio-stream-controller.ts":function(ue,B,w){"use strict";w.r(B);var _=w("./src/polyfills/number.ts"),D=w("./src/controller/base-stream-controller.ts"),A=w("./src/events.ts"),N=w("./src/utils/buffer-helper.ts"),k=w("./src/controller/fragment-tracker.ts"),S=w("./src/types/level.ts"),C=w("./src/types/loader.ts"),d=w("./src/loader/fragment.ts"),v=w("./src/demux/chunk-cache.ts"),b=w("./src/demux/transmuxer-interface.ts"),p=w("./src/types/transmuxer.ts"),m=w("./src/controller/fragment-finders.ts"),y=w("./src/utils/discontinuities.ts"),n=w("./src/errors.ts"),e=w("./src/utils/logger.ts");function t(){return t=Object.assign||function(E){for(var g=1;g<arguments.length;g++){var s=arguments[g];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(E[a]=s[a])}return E},t.apply(this,arguments)}function r(E,g){E.prototype=Object.create(g.prototype),E.prototype.constructor=E,f(E,g)}function f(E,g){return f=Object.setPrototypeOf||function(a,i){return a.__proto__=i,a},f(E,g)}var c=100,u=function(E){r(g,E);function g(a,i){var l;return l=E.call(this,a,i,"[audio-stream-controller]")||this,l.videoBuffer=null,l.videoTrackCC=-1,l.waitingVideoCC=-1,l.audioSwitch=!1,l.trackId=-1,l.waitingData=null,l.mainDetails=null,l.bufferFlushed=!1,l._registerListeners(),l}var s=g.prototype;return s.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},s._registerListeners=function(){var i=this.hls;i.on(A.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.on(A.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(A.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(A.Events.LEVEL_LOADED,this.onLevelLoaded,this),i.on(A.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),i.on(A.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),i.on(A.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),i.on(A.Events.ERROR,this.onError,this),i.on(A.Events.BUFFER_RESET,this.onBufferReset,this),i.on(A.Events.BUFFER_CREATED,this.onBufferCreated,this),i.on(A.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),i.on(A.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),i.on(A.Events.FRAG_BUFFERED,this.onFragBuffered,this)},s._unregisterListeners=function(){var i=this.hls;i.off(A.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.off(A.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off(A.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(A.Events.LEVEL_LOADED,this.onLevelLoaded,this),i.off(A.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),i.off(A.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),i.off(A.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),i.off(A.Events.ERROR,this.onError,this),i.off(A.Events.BUFFER_RESET,this.onBufferReset,this),i.off(A.Events.BUFFER_CREATED,this.onBufferCreated,this),i.off(A.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),i.off(A.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),i.off(A.Events.FRAG_BUFFERED,this.onFragBuffered,this)},s.onInitPtsFound=function(i,l){var T=l.frag,x=l.id,L=l.initPTS;if(x==="main"){var R=T.cc;this.initPTS[T.cc]=L,this.log("InitPTS for cc: "+R+" found from main: "+L),this.videoTrackCC=R,this.state===D.State.WAITING_INIT_PTS&&this.tick()}},s.startLoad=function(i){if(!this.levels){this.startPosition=i,this.state=D.State.STOPPED;return}var l=this.lastCurrentTime;this.stopLoad(),this.setInterval(c),this.fragLoadError=0,l>0&&i===-1?(this.log("Override startPosition with lastCurrentTime @"+l.toFixed(3)),this.state=D.State.IDLE):(this.loadedmetadata=!1,this.state=D.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=i,this.tick()},s.doTick=function(){switch(this.state){case D.State.IDLE:this.doTickIdle();break;case D.State.WAITING_TRACK:{var i,l=this.levels,T=this.trackId,x=l==null||((i=l[T])===null||i===void 0)?void 0:i.details;if(x){if(this.waitForCdnTuneIn(x))break;this.state=D.State.WAITING_INIT_PTS}break}case D.State.FRAG_LOADING_WAITING_RETRY:{var L,R=performance.now(),I=this.retryDate;(!I||R>=I||(L=this.media)!==null&&L!==void 0&&L.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=D.State.IDLE);break}case D.State.WAITING_INIT_PTS:{var F=this.waitingData;if(F){var j=F.frag,z=F.part,Q=F.cache,J=F.complete;if(this.initPTS[j.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=D.State.FRAG_LOADING;var ie=Q.flush(),pe={frag:j,part:z,payload:ie,networkDetails:null};this._handleFragmentLoadProgress(pe),J&&E.prototype._handleFragmentLoadComplete.call(this,pe)}else if(this.videoTrackCC!==this.waitingVideoCC)e.logger.log("Waiting fragment cc ("+j.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ce=this.getLoadPosition(),ye=N.BufferHelper.bufferInfo(this.mediaBuffer,ce,this.config.maxBufferHole),ve=Object(m.fragmentWithinToleranceTest)(ye.end,this.config.maxFragLookUpTolerance,j);ve<0&&(e.logger.log("Waiting fragment cc ("+j.cc+") @ "+j.start+" cancelled because another fragment at "+ye.end+" is needed"),this.clearWaitingFragment())}}else this.state=D.State.IDLE}}this.onTickEnd()},s.clearWaitingFragment=function(){var i=this.waitingData;i&&(this.fragmentTracker.removeFragment(i.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=D.State.IDLE)},s.onTickEnd=function(){var i=this.media;if(!i||!i.readyState)return;var l=this.mediaBuffer?this.mediaBuffer:i,T=l.buffered;!this.loadedmetadata&&T.length&&(this.loadedmetadata=!0),this.lastCurrentTime=i.currentTime},s.doTickIdle=function(){var i,l,T=this.hls,x=this.levels,L=this.media,R=this.trackId,I=T.config;if(!x||!x[R])return;if(!L&&(this.startFragRequested||!I.startFragPrefetch))return;var F=x[R],j=F.details;if(!j||j.live&&this.levelLastLoaded!==R||this.waitForCdnTuneIn(j)){this.state=D.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,d.ElementaryStreamTypes.AUDIO,C.PlaylistLevelType.AUDIO));var z=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,C.PlaylistLevelType.AUDIO);if(z===null)return;var Q=z.len,J=this.getMaxBufferLength(),ie=this.audioSwitch;if(Q>=J&&!ie)return;if(!ie&&this._streamEnded(z,j)){T.trigger(A.Events.BUFFER_EOS,{type:"audio"}),this.state=D.State.ENDED;return}var pe=j.fragments,ce=pe[0].start,ye=z.end;if(ie){var ve=this.getLoadPosition();ye=ve,j.PTSKnown&&ve<ce&&((z.end>ce||z.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),L.currentTime=ce+.05))}var Z=this.getNextFragment(ye,j);if(!Z){this.bufferFlushed=!0;return}((i=Z.decryptdata)===null||i===void 0?void 0:i.keyFormat)==="identity"&&!((l=Z.decryptdata)!==null&&l!==void 0&&l.key)?this.loadKey(Z,j):this.loadFragment(Z,j,ye)},s.getMaxBufferLength=function(){var i=E.prototype.getMaxBufferLength.call(this),l=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,C.PlaylistLevelType.MAIN);return l===null?i:Math.max(i,l.len)},s.onMediaDetaching=function(){this.videoBuffer=null,E.prototype.onMediaDetaching.call(this)},s.onAudioTracksUpdated=function(i,l){var T=l.audioTracks;this.resetTransmuxer(),this.levels=T.map(function(x){return new S.Level(x)})},s.onAudioTrackSwitching=function(i,l){var T=!!l.url;this.trackId=l.id;var x=this.fragCurrent;x!=null&&x.loader&&x.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),T?this.setInterval(c):this.resetTransmuxer(),T?(this.audioSwitch=!0,this.state=D.State.IDLE):this.state=D.State.STOPPED,this.tick()},s.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},s.onLevelLoaded=function(i,l){this.mainDetails=l.details},s.onAudioTrackLoaded=function(i,l){var T,x=this.levels,L=l.details,R=l.id;if(!x){this.warn("Audio tracks were reset while loading level "+R);return}this.log("Track "+R+" loaded ["+L.startSN+","+L.endSN+"],duration:"+L.totalduration);var I=x[R],F=0;if(L.live||(T=I.details)!==null&&T!==void 0&&T.live){var j=this.mainDetails;if(L.fragments[0]||(L.deltaUpdateFailed=!0),L.deltaUpdateFailed||!j)return;!I.details&&L.hasProgramDateTime&&j.hasProgramDateTime?(Object(y.alignMediaPlaylistByPDT)(L,j),F=L.fragments[0].start):F=this.alignPlaylists(L,I.details)}I.details=L,this.levelLastLoaded=R,!this.startFragRequested&&(this.mainDetails||!L.live)&&this.setStartPosition(I.details,F),this.state===D.State.WAITING_TRACK&&!this.waitForCdnTuneIn(L)&&(this.state=D.State.IDLE),this.tick()},s._handleFragmentLoadProgress=function(i){var l,T=i.frag,x=i.part,L=i.payload,R=this.config,I=this.trackId,F=this.levels;if(!F){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+T.sn+" of level "+T.level+" will not be buffered");return}var j=F[I];console.assert(j,"Audio track is defined on fragment load progress");var z=j.details;console.assert(z,"Audio track details are defined on fragment load progress");var Q=R.defaultAudioCodec||j.audioCodec||"mp4a.40.2",J=this.transmuxer;J||(J=this.transmuxer=new b.default(this.hls,C.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ie=this.initPTS[T.cc],pe=(l=T.initSegment)===null||l===void 0?void 0:l.data;if(ie!==void 0){var ce=!1,ye=x?x.index:-1,ve=ye!==-1,Z=new p.ChunkMetadata(T.level,T.sn,T.stats.chunkCount,L.byteLength,ye,ve);J.push(L,pe,Q,"",T,x,z.totalduration,ce,Z,ie)}else{e.logger.log("Unknown video PTS for cc "+T.cc+", waiting for video PTS before demuxing audio frag "+T.sn+" of ["+z.startSN+" ,"+z.endSN+"],track "+I);var q=this.waitingData=this.waitingData||{frag:T,part:x,cache:new v.default,complete:!1},se=q.cache;se.push(new Uint8Array(L)),this.waitingVideoCC=this.videoTrackCC,this.state=D.State.WAITING_INIT_PTS}},s._handleFragmentLoadComplete=function(i){if(this.waitingData){this.waitingData.complete=!0;return}E.prototype._handleFragmentLoadComplete.call(this,i)},s.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},s.onBufferCreated=function(i,l){var T=l.tracks.audio;T&&(this.mediaBuffer=T.buffer),l.tracks.video&&(this.videoBuffer=l.tracks.video.buffer)},s.onFragBuffered=function(i,l){var T=l.frag,x=l.part;if(T.type!==C.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(T)){this.warn("Fragment "+T.sn+(x?" p: "+x.index:"")+" of level "+T.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}T.sn!=="initSegment"&&(this.fragPrevious=T,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(A.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(T,x)},s.onError=function(i,l){switch(l.details){case n.ErrorDetails.FRAG_LOAD_ERROR:case n.ErrorDetails.FRAG_LOAD_TIMEOUT:case n.ErrorDetails.KEY_LOAD_ERROR:case n.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(C.PlaylistLevelType.AUDIO,l);break;case n.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case n.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==D.State.ERROR&&this.state!==D.State.STOPPED&&(this.state=l.fatal?D.State.ERROR:D.State.IDLE,this.warn(l.details+" while loading frag, switching to "+this.state+" state"));break;case n.ErrorDetails.BUFFER_FULL_ERROR:if(l.parent==="audio"&&(this.state===D.State.PARSING||this.state===D.State.PARSED)){var T=!0,x=this.getFwdBufferInfo(this.mediaBuffer,C.PlaylistLevelType.AUDIO);x&&x.len>.5&&(T=!this.reduceMaxBufferLength(x.len)),T&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,E.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},s.onBufferFlushed=function(i,l){var T=l.type;T===d.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},s._handleTransmuxComplete=function(i){var l,T="audio",x=this.hls,L=i.remuxResult,R=i.chunkMeta,I=this.getCurrentContext(R);if(!I){this.warn("The loading context changed while buffering fragment "+R.sn+" of level "+R.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(R.level);return}var F=I.frag,j=I.part,z=L.audio,Q=L.text,J=L.id3,ie=L.initSegment;if(this.fragContextChanged(F))return;if(this.state=D.State.PARSING,this.audioSwitch&&z&&this.completeAudioSwitch(),ie!=null&&ie.tracks&&(this._bufferInitSegment(ie.tracks,F,R),x.trigger(A.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:T,tracks:ie.tracks})),z){var pe=z.startPTS,ce=z.endPTS,ye=z.startDTS,ve=z.endDTS;j&&(j.elementaryStreams[d.ElementaryStreamTypes.AUDIO]={startPTS:pe,endPTS:ce,startDTS:ye,endDTS:ve}),F.setElementaryStreamInfo(d.ElementaryStreamTypes.AUDIO,pe,ce,ye,ve),this.bufferFragmentData(z,F,j,R)}if(J!=null&&(l=J.samples)!==null&&l!==void 0&&l.length){var Z=t({frag:F,id:T},J);x.trigger(A.Events.FRAG_PARSING_METADATA,Z)}if(Q){var q=t({frag:F,id:T},Q);x.trigger(A.Events.FRAG_PARSING_USERDATA,q)}},s._bufferInitSegment=function(i,l,T){if(this.state!==D.State.PARSING)return;i.video&&delete i.video;var x=i.audio;if(!x)return;x.levelCodec=x.codec,x.id="audio",this.log("Init audio buffer, container:"+x.container+", codecs[parsed]=["+x.codec+"]"),this.hls.trigger(A.Events.BUFFER_CODECS,i);var L=x.initSegment;if(L!=null&&L.byteLength){var R={type:"audio",frag:l,part:null,chunkMeta:T,parent:l.type,data:L};this.hls.trigger(A.Events.BUFFER_APPENDING,R)}this.tick()},s.loadFragment=function(i,l,T){var x=this.fragmentTracker.getState(i);this.fragCurrent=i,(this.audioSwitch||x===k.FragmentState.NOT_LOADED||x===k.FragmentState.PARTIAL)&&(i.sn==="initSegment"?this._loadInitSegment(i):l.live&&!Object(_.isFiniteNumber)(this.initPTS[i.cc])?(this.log("Waiting for video PTS in continuity counter "+i.cc+" of live stream before loading audio fragment "+i.sn+" of level "+this.trackId),this.state=D.State.WAITING_INIT_PTS):(this.startFragRequested=!0,E.prototype.loadFragment.call(this,i,l,T)))},s.completeAudioSwitch=function(){var i=this.hls,l=this.media,T=this.trackId;l&&(this.log("Switching audio track : flushing all audio"),E.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,i.trigger(A.Events.AUDIO_TRACK_SWITCHED,{id:T})},g}(D.default);B.default=u},"./src/controller/audio-track-controller.ts":function(ue,B,w){"use strict";w.r(B);var _=w("./src/events.ts"),D=w("./src/errors.ts"),A=w("./src/controller/base-playlist-controller.ts"),N=w("./src/types/loader.ts");function k(b,p){for(var m=0;m<p.length;m++){var y=p[m];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(b,y.key,y)}}function S(b,p,m){return p&&k(b.prototype,p),m&&k(b,m),b}function C(b,p){b.prototype=Object.create(p.prototype),b.prototype.constructor=b,d(b,p)}function d(b,p){return d=Object.setPrototypeOf||function(y,n){return y.__proto__=n,y},d(b,p)}var v=function(b){C(p,b);function p(y){var n;return n=b.call(this,y,"[audio-track-controller]")||this,n.tracks=[],n.groupId=null,n.tracksInGroup=[],n.trackId=-1,n.trackName="",n.selectDefaultTrack=!0,n.registerListeners(),n}var m=p.prototype;return m.registerListeners=function(){var n=this.hls;n.on(_.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(_.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.on(_.Events.LEVEL_LOADING,this.onLevelLoading,this),n.on(_.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),n.on(_.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),n.on(_.Events.ERROR,this.onError,this)},m.unregisterListeners=function(){var n=this.hls;n.off(_.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(_.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.off(_.Events.LEVEL_LOADING,this.onLevelLoading,this),n.off(_.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),n.off(_.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),n.off(_.Events.ERROR,this.onError,this)},m.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,b.prototype.destroy.call(this)},m.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},m.onManifestParsed=function(n,e){this.tracks=e.audioTracks||[]},m.onAudioTrackLoaded=function(n,e){var t=e.id,r=e.details,f=this.tracksInGroup[t];if(!f){this.warn("Invalid audio track id "+t);return}var c=f.details;f.details=e.details,this.log("audioTrack "+t+" loaded ["+r.startSN+"-"+r.endSN+"]"),t===this.trackId&&(this.retryCount=0,this.playlistLoaded(t,e,c))},m.onLevelLoading=function(n,e){this.switchLevel(e.level)},m.onLevelSwitching=function(n,e){this.switchLevel(e.level)},m.switchLevel=function(n){var e=this.hls.levels[n];if(!(e!=null&&e.audioGroupIds))return;var t=e.audioGroupIds[e.urlId];if(this.groupId!==t){this.groupId=t;var r=this.tracks.filter(function(c){return!t||c.groupId===t});this.selectDefaultTrack&&!r.some(function(c){return c.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=r;var f={audioTracks:r};this.log("Updating audio tracks, "+r.length+' track(s) found in "'+t+'" group-id'),this.hls.trigger(_.Events.AUDIO_TRACKS_UPDATED,f),this.selectInitialTrack()}},m.onError=function(n,e){if(b.prototype.onError.call(this,n,e),e.fatal||!e.context)return;e.context.type===N.PlaylistContextType.AUDIO_TRACK&&e.context.id===this.trackId&&e.context.groupId===this.groupId&&this.retryLoadingOrFail(e)},m.setAudioTrack=function(n){var e=this.tracksInGroup;if(n<0||n>=e.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var t=e[this.trackId];this.log("Now switching to audio-track index "+n);var r=e[n],f=r.id,c=r.groupId,u=c===void 0?"":c,E=r.name,g=r.type,s=r.url;if(this.trackId=n,this.trackName=E,this.selectDefaultTrack=!1,this.hls.trigger(_.Events.AUDIO_TRACK_SWITCHING,{id:f,groupId:u,name:E,type:g,url:s}),r.details&&!r.details.live)return;var a=this.switchParams(r.url,t==null?void 0:t.details);this.loadPlaylist(a)},m.selectInitialTrack=function(){var n=this.tracksInGroup;console.assert(n.length,"Initial audio track should be selected when tracks are known");var e=this.trackName,t=this.findTrackId(e)||this.findTrackId();t!==-1?this.setAudioTrack(t):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(_.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},m.findTrackId=function(n){for(var e=this.tracksInGroup,t=0;t<e.length;t++){var r=e[t];if((!this.selectDefaultTrack||r.default)&&(!n||n===r.name))return r.id}return-1},m.loadPlaylist=function(n){var e=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(e)){var t=e.id,r=e.groupId,f=e.url;if(n)try{f=n.addDirectives(f)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("loading audio-track playlist for id: "+t),this.clearTimer(),this.hls.trigger(_.Events.AUDIO_TRACK_LOADING,{url:f,id:t,groupId:r,deliveryDirectives:n||null})}},S(p,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(n){this.selectDefaultTrack=!1,this.setAudioTrack(n)}}]),p}(A.default);B.default=v},"./src/controller/base-playlist-controller.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"default",function(){return S});var _=w("./src/polyfills/number.ts"),D=w("./src/types/level.ts"),A=w("./src/controller/level-helper.ts"),N=w("./src/utils/logger.ts"),k=w("./src/errors.ts"),S=function(){function C(v,b){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=N.logger.log.bind(N.logger,b+":"),this.warn=N.logger.warn.bind(N.logger,b+":"),this.hls=v}var d=C.prototype;return d.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},d.onError=function(b,p){p.fatal&&p.type===k.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},d.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},d.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},d.stopLoad=function(){this.canLoad=!1,this.clearTimer()},d.switchParams=function(b,p){var m=p==null?void 0:p.renditionReports;if(m)for(var y=0;y<m.length;y++){var n=m[y],e=""+n.URI;if(e===b.substr(-e.length)){var t=parseInt(n["LAST-MSN"]),r=parseInt(n["LAST-PART"]);if(p&&this.hls.config.lowLatencyMode){var f=Math.min(p.age-p.partTarget,p.targetduration);r!==void 0&&f>p.partTarget&&(r+=1)}if(Object(_.isFiniteNumber)(t))return new D.HlsUrlParameters(t,Object(_.isFiniteNumber)(r)?r:void 0,D.HlsSkip.No)}}},d.loadPlaylist=function(b){},d.shouldLoadTrack=function(b){return this.canLoad&&b&&!!b.url&&(!b.details||b.details.live)},d.playlistLoaded=function(b,p,m){var y=this,n=p.details,e=p.stats,t=e.loading.end?Math.max(0,self.performance.now()-e.loading.end):0;if(n.advancedDateTime=Date.now()-t,n.live||m!=null&&m.live){if(n.reloaded(m),m&&this.log("live playlist "+b+" "+(n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:"MISSED")),m&&n.fragments.length>0&&Object(A.mergeDetails)(m,n),!this.canLoad||!n.live)return;var r,f=void 0,c=void 0;if(n.canBlockReload&&n.endSN&&n.advanced){var u=this.hls.config.lowLatencyMode,E=n.lastPartSn,g=n.endSN,s=n.lastPartIndex,a=s!==-1,i=E===g,l=u?0:s;a?(f=i?g+1:E,c=i?l:s+1):f=g+1;var T=n.age,x=T+n.ageHeader,L=Math.min(x-n.partTarget,n.targetduration*1.5);if(L>0){if(m&&L>m.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+m.tuneInGoal+" to: "+L+" with playlist age: "+n.age),L=0;else{var R=Math.floor(L/n.targetduration);if(f+=R,c!==void 0){var I=Math.round(L%n.targetduration/n.partTarget);c+=I}this.log("CDN Tune-in age: "+n.ageHeader+"s last advanced "+T.toFixed(2)+"s goal: "+L+" skip sn "+R+" to part "+c)}n.tuneInGoal=L}if(r=this.getDeliveryDirectives(n,p.deliveryDirectives,f,c),u||!i){this.loadPlaylist(r);return}}else r=this.getDeliveryDirectives(n,p.deliveryDirectives,f,c);var F=Object(A.computeReloadInterval)(n,e);f!==void 0&&n.canBlockReload&&(F-=n.partTarget||1),this.log("reload live playlist "+b+" in "+Math.round(F)+" ms"),this.timer=self.setTimeout(function(){return y.loadPlaylist(r)},F)}else this.clearTimer()},d.getDeliveryDirectives=function(b,p,m,y){var n=Object(D.getSkipValue)(b,m);return p!=null&&p.skip&&b.deltaUpdateFailed&&(m=p.msn,y=p.part,n=D.HlsSkip.No),new D.HlsUrlParameters(m,y,n)},d.retryLoadingOrFail=function(b){var p=this,m=this.hls.config,y=this.retryCount<m.levelLoadingMaxRetry;if(y){var n;if(this.retryCount++,b.details.indexOf("LoadTimeOut")>-1&&(n=b.context)!==null&&n!==void 0&&n.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+b.details+'"'),this.loadPlaylist();else{var e=Math.min(Math.pow(2,this.retryCount)*m.levelLoadingRetryDelay,m.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return p.loadPlaylist()},e),this.warn("retry playlist loading #"+this.retryCount+" in "+e+' ms after "'+b.details+'"')}}else this.warn('cannot recover from error "'+b.details+'"'),this.clearTimer(),b.fatal=!0;return y},C}()},"./src/controller/base-stream-controller.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"State",function(){return g}),w.d(B,"default",function(){return s});var _=w("./src/polyfills/number.ts"),D=w("./src/task-loop.ts"),A=w("./src/controller/fragment-tracker.ts"),N=w("./src/utils/buffer-helper.ts"),k=w("./src/utils/logger.ts"),S=w("./src/events.ts"),C=w("./src/errors.ts"),d=w("./src/types/transmuxer.ts"),v=w("./src/utils/mp4-tools.ts"),b=w("./src/utils/discontinuities.ts"),p=w("./src/controller/fragment-finders.ts"),m=w("./src/controller/level-helper.ts"),y=w("./src/loader/fragment-loader.ts"),n=w("./src/crypt/decrypter.ts"),e=w("./src/utils/time-ranges.ts"),t=w("./src/types/loader.ts");function r(a,i){for(var l=0;l<i.length;l++){var T=i[l];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(a,T.key,T)}}function f(a,i,l){return i&&r(a.prototype,i),l&&r(a,l),a}function c(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function u(a,i){a.prototype=Object.create(i.prototype),a.prototype.constructor=a,E(a,i)}function E(a,i){return E=Object.setPrototypeOf||function(T,x){return T.__proto__=x,T},E(a,i)}var g={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"},s=function(a){u(i,a);function i(T,x,L){var R;return R=a.call(this)||this,R.hls=void 0,R.fragPrevious=null,R.fragCurrent=null,R.fragmentTracker=void 0,R.transmuxer=null,R._state=g.STOPPED,R.media=void 0,R.mediaBuffer=void 0,R.config=void 0,R.bitrateTest=!1,R.lastCurrentTime=0,R.nextLoadPosition=0,R.startPosition=0,R.loadedmetadata=!1,R.fragLoadError=0,R.retryDate=0,R.levels=null,R.fragmentLoader=void 0,R.levelLastLoaded=null,R.startFragRequested=!1,R.decrypter=void 0,R.initPTS=[],R.onvseeking=null,R.onvended=null,R.logPrefix="",R.log=void 0,R.warn=void 0,R.logPrefix=L,R.log=k.logger.log.bind(k.logger,L+":"),R.warn=k.logger.warn.bind(k.logger,L+":"),R.hls=T,R.fragmentLoader=new y.default(T.config),R.fragmentTracker=x,R.config=T.config,R.decrypter=new n.default(T,T.config),T.on(S.Events.KEY_LOADED,R.onKeyLoaded,c(R)),R}var l=i.prototype;return l.doTick=function(){this.onTickEnd()},l.onTickEnd=function(){},l.startLoad=function(x){},l.stopLoad=function(){this.fragmentLoader.abort();var x=this.fragCurrent;x&&this.fragmentTracker.removeFragment(x),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=g.STOPPED},l._streamEnded=function(x,L){var R=this.fragCurrent,I=this.fragmentTracker;if(!L.live&&R&&R.sn===L.endSN&&!x.nextStart){var F=I.getState(R);return F===A.FragmentState.PARTIAL||F===A.FragmentState.OK}return!1},l.onMediaAttached=function(x,L){var R=this.media=this.mediaBuffer=L.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),R.addEventListener("seeking",this.onvseeking),R.addEventListener("ended",this.onvended);var I=this.config;this.levels&&I.autoStartLoad&&this.state===g.STOPPED&&this.startLoad(I.startPosition)},l.onMediaDetaching=function(){var x=this.media;x!=null&&x.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),x&&(x.removeEventListener("seeking",this.onvseeking),x.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},l.onMediaSeeking=function(){var x=this.config,L=this.fragCurrent,R=this.media,I=this.mediaBuffer,F=this.state,j=R?R.currentTime:0,z=N.BufferHelper.bufferInfo(I||R,j,x.maxBufferHole);if(this.log("media seeking to "+(Object(_.isFiniteNumber)(j)?j.toFixed(3):j)+", state: "+F),F===g.ENDED)this.resetLoadingState();else if(L&&!z.len){var Q=x.maxFragLookUpTolerance,J=L.start-Q,ie=L.start+L.duration+Q,pe=j>ie;(j<J||pe)&&(pe&&L.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),L.loader.abort()),this.resetLoadingState())}R&&(this.lastCurrentTime=j),!this.loadedmetadata&&!z.len&&(this.nextLoadPosition=this.startPosition=j),this.tickImmediate()},l.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},l.onKeyLoaded=function(x,L){if(this.state!==g.KEY_LOADING||L.frag!==this.fragCurrent||!this.levels)return;this.state=g.IDLE;var R=this.levels[L.frag.level].details;R&&this.loadFragment(L.frag,R,L.frag.start)},l.onHandlerDestroying=function(){this.stopLoad(),a.prototype.onHandlerDestroying.call(this)},l.onHandlerDestroyed=function(){this.state=g.STOPPED,this.hls.off(S.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,a.prototype.onHandlerDestroyed.call(this)},l.loadKey=function(x,L){this.log("Loading key for "+x.sn+" of ["+L.startSN+"-"+L.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+x.level),this.state=g.KEY_LOADING,this.fragCurrent=x,this.hls.trigger(S.Events.KEY_LOADING,{frag:x})},l.loadFragment=function(x,L,R){this._loadFragForPlayback(x,L,R)},l._loadFragForPlayback=function(x,L,R){var I=this,F=function(z){if(I.fragContextChanged(x)){I.warn("Fragment "+x.sn+(z.part?" p: "+z.part.index:"")+" of level "+x.level+" was dropped during download."),I.fragmentTracker.removeFragment(x);return}x.stats.chunkCount++,I._handleFragmentLoadProgress(z)};this._doFragLoad(x,L,R,F).then(function(j){if(!j)return;I.fragLoadError=0;var z=I.state;if(I.fragContextChanged(x)){(z===g.FRAG_LOADING||z===g.BACKTRACKING||!I.fragCurrent&&z===g.PARSING)&&(I.fragmentTracker.removeFragment(x),I.state=g.IDLE);return}if("payload"in j&&(I.log("Loaded fragment "+x.sn+" of level "+x.level),I.hls.trigger(S.Events.FRAG_LOADED,j),I.state===g.BACKTRACKING)){I.fragmentTracker.backtrack(x,j),I.resetFragmentLoading(x);return}I._handleFragmentLoadComplete(j)}).catch(function(j){I.warn(j),I.resetFragmentLoading(x)})},l.flushMainBuffer=function(x,L,R){if(R===void 0&&(R=null),!(x-L))return;var I={startOffset:x,endOffset:L,type:R};this.fragLoadError=0,this.hls.trigger(S.Events.BUFFER_FLUSHING,I)},l._loadInitSegment=function(x){var L=this;this._doFragLoad(x).then(function(R){if(!R||L.fragContextChanged(x)||!L.levels)throw new Error("init load aborted");return R}).then(function(R){var I=L.hls,F=R.payload,j=x.decryptdata;if(F&&F.byteLength>0&&j&&j.key&&j.iv&&j.method==="AES-128"){var z=self.performance.now();return L.decrypter.webCryptoDecrypt(new Uint8Array(F),j.key.buffer,j.iv.buffer).then(function(Q){var J=self.performance.now();return I.trigger(S.Events.FRAG_DECRYPTED,{frag:x,payload:Q,stats:{tstart:z,tdecrypt:J}}),R.payload=Q,R})}return R}).then(function(R){var I=L.fragCurrent,F=L.hls,j=L.levels;if(!j)throw new Error("init load aborted, missing levels");var z=j[x.level].details;console.assert(z,"Level details are defined when init segment is loaded");var Q=x.stats;L.state=g.IDLE,L.fragLoadError=0,x.data=new Uint8Array(R.payload),Q.parsing.start=Q.buffering.start=self.performance.now(),Q.parsing.end=Q.buffering.end=self.performance.now(),R.frag===I&&F.trigger(S.Events.FRAG_BUFFERED,{stats:Q,frag:I,part:null,id:x.type}),L.tick()}).catch(function(R){L.warn(R),L.resetFragmentLoading(x)})},l.fragContextChanged=function(x){var L=this.fragCurrent;return!x||!L||x.level!==L.level||x.sn!==L.sn||x.urlId!==L.urlId},l.fragBufferedComplete=function(x,L){var R=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+x.type+" sn: "+x.sn+(L?" part: "+L.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+x.level+" "+e.default.toString(N.BufferHelper.getBuffered(R))),this.state=g.IDLE,this.tick()},l._handleFragmentLoadComplete=function(x){var L=this.transmuxer;if(!L)return;var R=x.frag,I=x.part,F=x.partsLoaded,j=!F||F.length===0||F.some(function(Q){return!Q}),z=new d.ChunkMetadata(R.level,R.sn,R.stats.chunkCount+1,0,I?I.index:-1,!j);L.flush(z)},l._handleFragmentLoadProgress=function(x){},l._doFragLoad=function(x,L,R,I){var F=this;if(R===void 0&&(R=null),!this.levels)throw new Error("frag load aborted, missing levels");if(R=Math.max(x.start,R||0),this.config.lowLatencyMode&&L){var j=L.partList;if(j&&I){R>x.end&&L.fragmentHint&&(x=L.fragmentHint);var z=this.getNextPart(j,x,R);if(z>-1){var Q=j[z];return this.log("Loading part sn: "+x.sn+" p: "+Q.index+" cc: "+x.cc+" of playlist ["+L.startSN+"-"+L.endSN+"] parts [0-"+z+"-"+(j.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+x.level+", target: "+parseFloat(R.toFixed(3))),this.nextLoadPosition=Q.start+Q.duration,this.state=g.FRAG_LOADING,this.hls.trigger(S.Events.FRAG_LOADING,{frag:x,part:j[z],targetBufferTime:R}),this.doFragPartsLoad(x,j,z,I).catch(function(J){return F.handleFragLoadError(J)})}else if(!x.url||this.loadedEndOfParts(j,R))return Promise.resolve(null)}}return this.log("Loading fragment "+x.sn+" cc: "+x.cc+" "+(L?"of ["+L.startSN+"-"+L.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+x.level+", target: "+parseFloat(R.toFixed(3))),Object(_.isFiniteNumber)(x.sn)&&!this.bitrateTest&&(this.nextLoadPosition=x.start+x.duration),this.state=g.FRAG_LOADING,this.hls.trigger(S.Events.FRAG_LOADING,{frag:x,targetBufferTime:R}),this.fragmentLoader.load(x,I).catch(function(J){return F.handleFragLoadError(J)})},l.doFragPartsLoad=function(x,L,R,I){var F=this;return new Promise(function(j,z){var Q=[],J=function ie(pe){var ce=L[pe];F.fragmentLoader.loadPart(x,ce,I).then(function(ye){Q[ce.index]=ye;var ve=ye.part;F.hls.trigger(S.Events.FRAG_LOADED,ye);var Z=L[pe+1];if(Z&&Z.fragment===x)ie(pe+1);else return j({frag:x,part:ve,partsLoaded:Q})}).catch(z)};J(R)})},l.handleFragLoadError=function(x){var L=x.data;return L&&L.details===C.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(L.frag,L.part):this.hls.trigger(S.Events.ERROR,L),null},l._handleTransmuxerFlush=function(x){var L=this.getCurrentContext(x);if(!L||this.state!==g.PARSING){this.fragCurrent||(this.state=g.IDLE);return}var R=L.frag,I=L.part,F=L.level,j=self.performance.now();R.stats.parsing.end=j,I&&(I.stats.parsing.end=j),this.updateLevelTiming(R,I,F,x.partial)},l.getCurrentContext=function(x){var L=this.levels,R=x.level,I=x.sn,F=x.part;if(!L||!L[R])return this.warn("Levels object was unset while buffering fragment "+I+" of level "+R+". The current chunk will not be buffered."),null;var j=L[R],z=F>-1?Object(m.getPartWith)(j,I,F):null,Q=z?z.fragment:Object(m.getFragmentWithSN)(j,I,this.fragCurrent);return Q?{frag:Q,part:z,level:j}:null},l.bufferFragmentData=function(x,L,R,I){if(!x||this.state!==g.PARSING)return;var F=x.data1,j=x.data2,z=F;if(F&&j&&(z=Object(v.appendUint8Array)(F,j)),!z||!z.length)return;var Q={type:x.type,frag:L,part:R,chunkMeta:I,parent:L.type,data:z};this.hls.trigger(S.Events.BUFFER_APPENDING,Q),x.dropped&&x.independent&&!R&&this.flushBufferGap(L)},l.flushBufferGap=function(x){var L=this.media;if(!L)return;if(!N.BufferHelper.isBuffered(L,L.currentTime)){this.flushMainBuffer(0,x.start);return}var R=L.currentTime,I=N.BufferHelper.bufferInfo(L,R,0),F=x.duration,j=Math.min(this.config.maxFragLookUpTolerance*2,F*.25),z=Math.max(Math.min(x.start-j,I.end-j),R+j);x.start-z>j&&this.flushMainBuffer(z,x.start)},l.getFwdBufferInfo=function(x,L){var R=this.config,I=this.getLoadPosition();if(!Object(_.isFiniteNumber)(I))return null;var F=N.BufferHelper.bufferInfo(x,I,R.maxBufferHole);if(F.len===0&&F.nextStart!==void 0){var j=this.fragmentTracker.getBufferedFrag(I,L);if(j&&F.nextStart<j.end)return N.BufferHelper.bufferInfo(x,I,Math.max(F.nextStart,R.maxBufferHole))}return F},l.getMaxBufferLength=function(x){var L=this.config,R;return x?R=Math.max(8*L.maxBufferSize/x,L.maxBufferLength):R=L.maxBufferLength,Math.min(R,L.maxMaxBufferLength)},l.reduceMaxBufferLength=function(x){var L=this.config,R=x||L.maxBufferLength;return L.maxMaxBufferLength>=R?(L.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+L.maxMaxBufferLength+"s"),!0):!1},l.getNextFragment=function(x,L){var R,I,F=L.fragments,j=F.length;if(!j)return null;var z=this.config,Q=F[0].start,J;if(L.live){var ie=z.initialLiveManifestSize;if(j<ie)return this.warn("Not enough fragments to start playback (have: "+j+", need: "+ie+")"),null;!L.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(J=this.getInitialLiveFragment(L,F),this.startPosition=J?this.hls.liveSyncPosition||J.start:x)}else x<=Q&&(J=F[0]);if(!J){var pe=z.lowLatencyMode?L.partEnd:L.fragmentEnd;J=this.getFragmentAtPosition(x,pe,L)}return(R=J)!==null&&R!==void 0&&R.initSegment&&!((I=J)!==null&&I!==void 0&&I.initSegment.data)&&!this.bitrateTest&&(J=J.initSegment),J},l.getNextPart=function(x,L,R){for(var I=-1,F=!1,j=!0,z=0,Q=x.length;z<Q;z++){var J=x[z];if(j=j&&!J.independent,I>-1&&R<J.start)break;var ie=J.loaded;!ie&&(F||J.independent||j)&&J.fragment===L&&(I=z),F=ie}return I},l.loadedEndOfParts=function(x,L){var R=x[x.length-1];return R&&L>R.start&&R.loaded},l.getInitialLiveFragment=function(x,L){var R=this.fragPrevious,I=null;if(R){if(x.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+R.programDateTime),I=Object(p.findFragmentByPDT)(L,R.endProgramDateTime,this.config.maxFragLookUpTolerance)),!I){var F=R.sn+1;if(F>=x.startSN&&F<=x.endSN){var j=L[F-x.startSN];R.cc===j.cc&&(I=j,this.log("Live playlist, switching playlist, load frag with next SN: "+I.sn))}I||(I=Object(p.findFragWithCC)(L,R.cc),I&&this.log("Live playlist, switching playlist, load frag with same CC: "+I.sn))}}else{var z=this.hls.liveSyncPosition;z!==null&&(I=this.getFragmentAtPosition(z,this.bitrateTest?x.fragmentEnd:x.edge,x))}return I},l.getFragmentAtPosition=function(x,L,R){var I=this.config,F=this.fragPrevious,j=R.fragments,z=R.endSN,Q=R.fragmentHint,J=I.maxFragLookUpTolerance,ie=!!(I.lowLatencyMode&&R.partList&&Q);ie&&Q&&!this.bitrateTest&&(j=j.concat(Q),z=Q.sn);var pe;if(x<L){var ce=x>L-J?0:J;pe=Object(p.findFragmentByPTS)(F,j,x,ce)}else pe=j[j.length-1];if(pe){var ye=pe.sn-R.startSN,ve=F&&pe.level===F.level,Z=j[ye+1],q=this.fragmentTracker.getState(pe);if(q===A.FragmentState.BACKTRACKED){pe=null;for(var se=ye;j[se]&&this.fragmentTracker.getState(j[se])===A.FragmentState.BACKTRACKED;)F?pe=j[se--]:pe=j[--se];pe||(pe=Z)}else F&&pe.sn===F.sn&&!ie&&(ve&&(pe.sn<z&&this.fragmentTracker.getState(Z)!==A.FragmentState.OK?(this.log("SN "+pe.sn+" just loaded, load next one: "+Z.sn),pe=Z):pe=null))}return pe},l.synchronizeToLiveEdge=function(x){var L=this.config,R=this.media;if(!R)return;var I=this.hls.liveSyncPosition,F=R.currentTime,j=x.fragments[0].start,z=x.edge,Q=F>=j-L.maxFragLookUpTolerance&&F<=z;if(I!==null&&R.duration>I&&(F<I||!Q)){var J=L.liveMaxLatencyDuration!==void 0?L.liveMaxLatencyDuration:L.liveMaxLatencyDurationCount*x.targetduration;(!Q&&R.readyState<4||F<z-J)&&(this.loadedmetadata||(this.nextLoadPosition=I),R.readyState&&(this.warn("Playback: "+F.toFixed(3)+" is located too far from the end of live sliding playlist: "+z+", reset currentTime to : "+I.toFixed(3)),R.currentTime=I))}},l.alignPlaylists=function(x,L){var R=this.levels,I=this.levelLastLoaded,F=this.fragPrevious,j=I!==null?R[I]:null,z=x.fragments.length;if(!z)return this.warn("No fragments in live playlist"),0;var Q=x.fragments[0].start,J=!L,ie=x.alignedSliding&&Object(_.isFiniteNumber)(Q);if(J||!ie&&!Q){Object(b.alignStream)(F,j,x);var pe=x.fragments[0].start;return this.log("Live playlist sliding: "+pe.toFixed(2)+" start-sn: "+(L?L.startSN:"na")+"->"+x.startSN+" prev-sn: "+(F?F.sn:"na")+" fragments: "+z),pe}return Q},l.waitForCdnTuneIn=function(x){var L=3;return x.live&&x.canBlockReload&&x.tuneInGoal>Math.max(x.partHoldBack,x.partTarget*L)},l.setStartPosition=function(x,L){var R=this.startPosition;if(R<L&&(R=-1),R===-1||this.lastCurrentTime===-1){var I=x.startTimeOffset;Object(_.isFiniteNumber)(I)?(R=L+I,I<0&&(R+=x.totalduration),R=Math.min(Math.max(L,R),L+x.totalduration),this.log("Start time offset "+I+" found in playlist, adjust startPosition to "+R),this.startPosition=R):x.live?R=this.hls.liveSyncPosition||L:this.startPosition=R=0,this.lastCurrentTime=R}this.nextLoadPosition=R},l.getLoadPosition=function(){var x=this.media,L=0;return this.loadedmetadata&&x?L=x.currentTime:this.nextLoadPosition&&(L=this.nextLoadPosition),L},l.handleFragLoadAborted=function(x,L){this.transmuxer&&x.sn!=="initSegment"&&x.stats.aborted&&(this.warn("Fragment "+x.sn+(L?" part"+L.index:"")+" of level "+x.level+" was aborted"),this.resetFragmentLoading(x))},l.resetFragmentLoading=function(x){(!this.fragCurrent||!this.fragContextChanged(x))&&(this.state=g.IDLE)},l.onFragmentOrKeyLoadError=function(x,L){if(L.fatal)return;var R=L.frag;if(!R||R.type!==x)return;var I=this.fragCurrent;console.assert(I&&R.sn===I.sn&&R.level===I.level&&R.urlId===I.urlId,"Frag load error must match current frag to retry");var F=this.config;if(this.fragLoadError+1<=F.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(R.level))return;var j=Math.min(Math.pow(2,this.fragLoadError)*F.fragLoadingRetryDelay,F.fragLoadingMaxRetryTimeout);this.warn("Fragment "+R.sn+" of "+x+" "+R.level+" failed to load, retrying in "+j+"ms"),this.retryDate=self.performance.now()+j,this.fragLoadError++,this.state=g.FRAG_LOADING_WAITING_RETRY}else L.levelRetry?(x===t.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=g.IDLE):(k.logger.error(L.details+" reaches max retry, redispatch as fatal ..."),L.fatal=!0,this.hls.stopLoad(),this.state=g.ERROR)},l.afterBufferFlushed=function(x,L,R){if(!x)return;var I=N.BufferHelper.getBuffered(x);this.fragmentTracker.detectEvictedFragments(L,I,R),this.state===g.ENDED&&this.resetLoadingState()},l.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=g.IDLE},l.resetLiveStartWhenNotLoaded=function(x){if(!this.loadedmetadata){this.startFragRequested=!1;var L=this.levels?this.levels[x].details:null;if(L!=null&&L.live)return this.startPosition=-1,this.setStartPosition(L,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},l.updateLevelTiming=function(x,L,R,I){var F=this,j=R.details;console.assert(!!j,"level.details must be defined");var z=Object.keys(x.elementaryStreams).reduce(function(Q,J){var ie=x.elementaryStreams[J];if(ie){var pe=ie.endPTS-ie.startPTS;if(pe<=0)return F.warn("Could not parse fragment "+x.sn+" "+J+" duration reliably ("+pe+") resetting transmuxer to fallback to playlist timing"),F.resetTransmuxer(),Q||!1;var ce=I?0:Object(m.updateFragPTSDTS)(j,x,ie.startPTS,ie.endPTS,ie.startDTS,ie.endDTS);return F.hls.trigger(S.Events.LEVEL_PTS_UPDATED,{details:j,level:R,drift:ce,type:J,frag:x,start:ie.startPTS,end:ie.endPTS}),!0}return Q},!1);z?(this.state=g.PARSED,this.hls.trigger(S.Events.FRAG_PARSED,{frag:x,part:L})):this.resetLoadingState()},l.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},f(i,[{key:"state",get:function(){return this._state},set:function(x){var L=this._state;L!==x&&(this._state=x,this.log(L+"->"+x))}}]),i}(D.default)},"./src/controller/buffer-controller.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"default",function(){return p});var _=w("./src/polyfills/number.ts"),D=w("./src/events.ts"),A=w("./src/utils/logger.ts"),N=w("./src/errors.ts"),k=w("./src/utils/buffer-helper.ts"),S=w("./src/utils/mediasource-helper.ts"),C=w("./src/loader/fragment.ts"),d=w("./src/controller/buffer-operation-queue.ts"),v=Object(S.getMediaSource)(),b=/([ha]vc.)(?:\.[^.,]+)+/,p=function(){function m(n){var e=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var t=e.hls,r=e.media,f=e.mediaSource;A.logger.log("[buffer-controller]: Media source opened"),r&&(e.updateMediaElementDuration(),t.trigger(D.Events.MEDIA_ATTACHED,{media:r})),f&&f.removeEventListener("sourceopen",e._onMediaSourceOpen),e.checkPendingTracks()},this._onMediaSourceClose=function(){A.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){A.logger.log("[buffer-controller]: Media source ended")},this.hls=n,this._initSourceBuffer(),this.registerListeners()}var y=m.prototype;return y.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},y.destroy=function(){this.unregisterListeners(),this.details=null},y.registerListeners=function(){var e=this.hls;e.on(D.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(D.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(D.Events.BUFFER_RESET,this.onBufferReset,this),e.on(D.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.on(D.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(D.Events.BUFFER_EOS,this.onBufferEos,this),e.on(D.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(D.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(D.Events.FRAG_PARSED,this.onFragParsed,this),e.on(D.Events.FRAG_CHANGED,this.onFragChanged,this)},y.unregisterListeners=function(){var e=this.hls;e.off(D.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(D.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(D.Events.BUFFER_RESET,this.onBufferReset,this),e.off(D.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.off(D.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(D.Events.BUFFER_EOS,this.onBufferEos,this),e.off(D.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(D.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(D.Events.FRAG_PARSED,this.onFragParsed,this),e.off(D.Events.FRAG_CHANGED,this.onFragChanged,this)},y._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new d.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},y.onManifestParsed=function(e,t){var r=2;(t.audio&&!t.video||!t.altAudio)&&(r=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=r,this.details=null,A.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},y.onMediaAttaching=function(e,t){var r=this.media=t.media;if(r&&v){var f=this.mediaSource=new v;f.addEventListener("sourceopen",this._onMediaSourceOpen),f.addEventListener("sourceended",this._onMediaSourceEnded),f.addEventListener("sourceclose",this._onMediaSourceClose),r.src=self.URL.createObjectURL(f),this._objectUrl=r.src}},y.onMediaDetaching=function(){var e=this.media,t=this.mediaSource,r=this._objectUrl;if(t){if(A.logger.log("[buffer-controller]: media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(f){A.logger.warn("[buffer-controller]: onMediaDetaching: "+f.message+" while calling endOfStream")}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(r&&self.URL.revokeObjectURL(r),e.src===r?(e.removeAttribute("src"),e.load()):A.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(D.Events.MEDIA_DETACHED,void 0)},y.onBufferReset=function(){var e=this;this.getSourceBufferTypes().forEach(function(t){var r=e.sourceBuffer[t];try{r&&(e.removeBufferListeners(t),e.mediaSource&&e.mediaSource.removeSourceBuffer(r),e.sourceBuffer[t]=void 0)}catch(f){A.logger.warn("[buffer-controller]: Failed to reset the "+t+" buffer",f)}}),this._initSourceBuffer()},y.onBufferCodecs=function(e,t){var r=this,f=this.getSourceBufferTypes().length;if(Object.keys(t).forEach(function(c){if(f){var u=r.tracks[c];if(u&&typeof u.buffer.changeType=="function"){var E=t[c],g=E.codec,s=E.levelCodec,a=E.container,i=(u.levelCodec||u.codec).replace(b,"$1"),l=(s||g).replace(b,"$1");if(i!==l){var T=a+";codecs="+(s||g);r.appendChangeType(c,T)}}}else r.pendingTracks[c]=t[c]}),f)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},y.appendChangeType=function(e,t){var r=this,f=this.operationQueue,c={execute:function(){var E=r.sourceBuffer[e];E&&(A.logger.log("[buffer-controller]: changing "+e+" sourceBuffer type to "+t),E.changeType(t)),f.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(E){A.logger.warn("[buffer-controller]: Failed to change "+e+" SourceBuffer type",E)}};f.append(c,e)},y.onBufferAppending=function(e,t){var r=this,f=this.hls,c=this.operationQueue,u=this.tracks,E=t.data,g=t.type,s=t.frag,a=t.part,i=t.chunkMeta,l=i.buffering[g],T=self.performance.now();l.start=T;var x=s.stats.buffering,L=a?a.stats.buffering:null;x.start===0&&(x.start=T),L&&L.start===0&&(L.start=T);var R=u.audio,I=g==="audio"&&i.id===1&&(R==null?void 0:R.container)==="audio/mpeg",F={execute:function(){if(l.executeStart=self.performance.now(),I){var z=r.sourceBuffer[g];if(z){var Q=s.start-z.timestampOffset;Math.abs(Q)>=.1&&(A.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+s.start+" (delta: "+Q+") sn: "+s.sn+")"),z.timestampOffset=s.start)}}r.appendExecutor(E,g)},onStart:function(){},onComplete:function(){var z=self.performance.now();l.executeEnd=l.end=z,x.first===0&&(x.first=z),L&&L.first===0&&(L.first=z);var Q=r.sourceBuffer,J={};for(var ie in Q)J[ie]=k.BufferHelper.getBuffered(Q[ie]);r.appendError=0,r.hls.trigger(D.Events.BUFFER_APPENDED,{type:g,frag:s,part:a,chunkMeta:i,parent:s.type,timeRanges:J})},onError:function(z){A.logger.error("[buffer-controller]: Error encountered while trying to append to the "+g+" SourceBuffer",z);var Q={type:N.ErrorTypes.MEDIA_ERROR,parent:s.type,details:N.ErrorDetails.BUFFER_APPEND_ERROR,err:z,fatal:!1};z.code===DOMException.QUOTA_EXCEEDED_ERR?Q.details=N.ErrorDetails.BUFFER_FULL_ERROR:(r.appendError++,Q.details=N.ErrorDetails.BUFFER_APPEND_ERROR,r.appendError>f.config.appendErrorMaxRetry&&(A.logger.error("[buffer-controller]: Failed "+f.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),Q.fatal=!0)),f.trigger(D.Events.ERROR,Q)}};c.append(F,g)},y.onBufferFlushing=function(e,t){var r=this,f=this.operationQueue,c=function(E){return{execute:r.removeExecutor.bind(r,E,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){r.hls.trigger(D.Events.BUFFER_FLUSHED,{type:E})},onError:function(s){A.logger.warn("[buffer-controller]: Failed to remove from "+E+" SourceBuffer",s)}}};t.type?f.append(c(t.type),t.type):this.getSourceBufferTypes().forEach(function(u){f.append(c(u),u)})},y.onFragParsed=function(e,t){var r=this,f=t.frag,c=t.part,u=[],E=c?c.elementaryStreams:f.elementaryStreams;E[C.ElementaryStreamTypes.AUDIOVIDEO]?u.push("audiovideo"):(E[C.ElementaryStreamTypes.AUDIO]&&u.push("audio"),E[C.ElementaryStreamTypes.VIDEO]&&u.push("video"));var g=function(){var a=self.performance.now();f.stats.buffering.end=a,c&&(c.stats.buffering.end=a);var i=c?c.stats:f.stats;r.hls.trigger(D.Events.FRAG_BUFFERED,{frag:f,part:c,stats:i,id:f.type})};u.length===0&&A.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+f.type+" level: "+f.level+" sn: "+f.sn),this.blockBuffers(g,u)},y.onFragChanged=function(e,t){this.flushBackBuffer()},y.onBufferEos=function(e,t){var r=this,f=this.getSourceBufferTypes().reduce(function(c,u){var E=r.sourceBuffer[u];return(!t.type||t.type===u)&&(E&&!E.ended&&(E.ended=!0,A.logger.log("[buffer-controller]: "+u+" sourceBuffer now EOS"))),c&&!!(!E||E.ended)},!0);f&&this.blockBuffers(function(){var c=r.mediaSource;if(!c||c.readyState!=="open")return;c.endOfStream()})},y.onLevelUpdated=function(e,t){var r=t.details;if(!r.fragments.length)return;this.details=r,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},y.flushBackBuffer=function(){var e=this.hls,t=this.details,r=this.media,f=this.sourceBuffer;if(!r||t===null)return;var c=this.getSourceBufferTypes();if(!c.length)return;var u=t.live&&e.config.liveBackBufferLength!==null?e.config.liveBackBufferLength:e.config.backBufferLength;if(!Object(_.isFiniteNumber)(u)||u<0)return;var E=r.currentTime,g=t.levelTargetDuration,s=Math.max(u,g),a=Math.floor(E/g)*g-s;c.forEach(function(i){var l=f[i];if(l){var T=k.BufferHelper.getBuffered(l);T.length>0&&a>T.start(0)&&(e.trigger(D.Events.BACK_BUFFER_REACHED,{bufferEnd:a}),t.live&&e.trigger(D.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:a}),e.trigger(D.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:a,type:i}))}})},y.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var e=this.details,t=this.hls,r=this.media,f=this.mediaSource,c=e.fragments[0].start+e.totalduration,u=r.duration,E=Object(_.isFiniteNumber)(f.duration)?f.duration:0;e.live&&t.config.liveDurationInfinity?(A.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),f.duration=Infinity,this.updateSeekableRange(e)):(c>E&&c>u||!Object(_.isFiniteNumber)(u))&&(A.logger.log("[buffer-controller]: Updating Media Source duration to "+c.toFixed(3)),f.duration=c)},y.updateSeekableRange=function(e){var t=this.mediaSource,r=e.fragments,f=r.length;if(f&&e.live&&t!==null&&t!==void 0&&t.setLiveSeekableRange){var c=Math.max(0,r[0].start),u=Math.max(c,c+e.totalduration);t.setLiveSeekableRange(c,u)}},y.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,r=this.pendingTracks,f=Object.keys(r).length;if(f&&!e||f===2){this.createSourceBuffers(r),this.pendingTracks={};var c=this.getSourceBufferTypes();if(c.length===0){this.hls.trigger(D.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}c.forEach(function(u){t.executeNext(u)})}},y.createSourceBuffers=function(e){var t=this.sourceBuffer,r=this.mediaSource;if(!r)throw Error("createSourceBuffers called when mediaSource was null");var f=0;for(var c in e)if(!t[c]){var u=e[c];if(!u)throw Error("source buffer exists for track "+c+", however track does not");var E=u.levelCodec||u.codec,g=u.container+";codecs="+E;A.logger.log("[buffer-controller]: creating sourceBuffer("+g+")");try{var s=t[c]=r.addSourceBuffer(g),a=c;this.addBufferListener(a,"updatestart",this._onSBUpdateStart),this.addBufferListener(a,"updateend",this._onSBUpdateEnd),this.addBufferListener(a,"error",this._onSBUpdateError),this.tracks[c]={buffer:s,codec:E,container:u.container,levelCodec:u.levelCodec,id:u.id},f++}catch(i){A.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+i.message),this.hls.trigger(D.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:i,mimeType:g})}}f&&this.hls.trigger(D.Events.BUFFER_CREATED,{tracks:this.tracks})},y._onSBUpdateStart=function(e){var t=this.operationQueue,r=t.current(e);r.onStart()},y._onSBUpdateEnd=function(e){var t=this.operationQueue,r=t.current(e);r.onComplete(),t.shiftAndExecuteNext(e)},y._onSBUpdateError=function(e,t){A.logger.error("[buffer-controller]: "+e+" SourceBuffer error",t),this.hls.trigger(D.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var r=this.operationQueue.current(e);r&&r.onError(t)},y.removeExecutor=function(e,t,r){var f=this.media,c=this.mediaSource,u=this.operationQueue,E=this.sourceBuffer,g=E[e];if(!f||!c||!g){A.logger.warn("[buffer-controller]: Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(e);return}var s=Object(_.isFiniteNumber)(f.duration)?f.duration:Infinity,a=Object(_.isFiniteNumber)(c.duration)?c.duration:Infinity,i=Math.max(0,t),l=Math.min(r,s,a);l>i?(A.logger.log("[buffer-controller]: Removing ["+i+","+l+"] from the "+e+" SourceBuffer"),console.assert(!g.updating,e+" sourceBuffer must not be updating"),g.remove(i,l)):u.shiftAndExecuteNext(e)},y.appendExecutor=function(e,t){var r=this.operationQueue,f=this.sourceBuffer,c=f[t];if(!c){A.logger.warn("[buffer-controller]: Attempting to append to the "+t+" SourceBuffer, but it does not exist"),r.shiftAndExecuteNext(t);return}c.ended=!1,console.assert(!c.updating,t+" sourceBuffer must not be updating"),c.appendBuffer(e)},y.blockBuffers=function(e,t){var r=this;if(t===void 0&&(t=this.getSourceBufferTypes()),!t.length){A.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(e);return}var f=this.operationQueue,c=t.map(function(u){return f.appendBlocker(u)});Promise.all(c).then(function(){e(),t.forEach(function(u){var E=r.sourceBuffer[u];(!E||!E.updating)&&f.shiftAndExecuteNext(u)})})},y.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},y.addBufferListener=function(e,t,r){var f=this.sourceBuffer[e];if(!f)return;var c=r.bind(this,e);this.listeners[e].push({event:t,listener:c}),f.addEventListener(t,c)},y.removeBufferListeners=function(e){var t=this.sourceBuffer[e];if(!t)return;this.listeners[e].forEach(function(r){t.removeEventListener(r.event,r.listener)})},m}()},"./src/controller/buffer-operation-queue.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"default",function(){return D});var _=w("./src/utils/logger.ts"),D=function(){function A(k){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=k}var N=A.prototype;return N.append=function(S,C){var d=this.queues[C];d.push(S),d.length===1&&this.buffers[C]&&this.executeNext(C)},N.insertAbort=function(S,C){var d=this.queues[C];d.unshift(S),this.executeNext(C)},N.appendBlocker=function(S){var C,d=new Promise(function(b){C=b}),v={execute:C,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(v,S),d},N.executeNext=function(S){var C=this.buffers,d=this.queues,v=C[S],b=d[S];if(b.length){var p=b[0];try{p.execute()}catch(m){_.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),p.onError(m),(!v||!v.updating)&&(b.shift(),this.executeNext(S))}}},N.shiftAndExecuteNext=function(S){this.queues[S].shift(),this.executeNext(S)},N.current=function(S){return this.queues[S][0]},A}()},"./src/controller/cap-level-controller.ts":function(ue,B,w){"use strict";w.r(B);var _=w("./src/events.ts");function D(k,S){for(var C=0;C<S.length;C++){var d=S[C];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(k,d.key,d)}}function A(k,S,C){return S&&D(k.prototype,S),C&&D(k,C),k}var N=function(){function k(C){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=C,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var S=k.prototype;return S.setStreamController=function(d){this.streamController=d},S.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},S.registerListeners=function(){var d=this.hls;d.on(_.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),d.on(_.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.on(_.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(_.Events.BUFFER_CODECS,this.onBufferCodecs,this),d.on(_.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},S.unregisterListener=function(){var d=this.hls;d.off(_.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),d.off(_.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off(_.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(_.Events.BUFFER_CODECS,this.onBufferCodecs,this),d.off(_.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},S.onFpsDropLevelCapping=function(d,v){k.isLevelAllowed(v.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(v.droppedLevel)},S.onMediaAttaching=function(d,v){this.media=v.media instanceof HTMLVideoElement?v.media:null},S.onManifestParsed=function(d,v){var b=this.hls;this.restrictedLevels=[],this.firstLevel=v.firstLevel,b.config.capLevelToPlayerSize&&v.video&&this.startCapping()},S.onBufferCodecs=function(d,v){var b=this.hls;b.config.capLevelToPlayerSize&&v.video&&this.startCapping()},S.onMediaDetaching=function(){this.stopCapping()},S.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var d=this.hls.levels;if(d.length){var v=this.hls;v.autoLevelCapping=this.getMaxLevel(d.length-1),v.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=v.autoLevelCapping}}},S.getMaxLevel=function(d){var v=this,b=this.hls.levels;if(!b.length)return-1;var p=b.filter(function(m,y){return k.isLevelAllowed(y,v.restrictedLevels)&&y<=d});return this.clientRect=null,k.getMaxLevelByMediaSize(p,this.mediaWidth,this.mediaHeight)},S.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()},S.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},S.getDimensions=function(){if(this.clientRect)return this.clientRect;var d=this.media,v={width:0,height:0};if(d){var b=d.getBoundingClientRect();v.width=b.width,v.height=b.height,!v.width&&!v.height&&(v.width=b.right-b.left||d.width||0,v.height=b.bottom-b.top||d.height||0)}return this.clientRect=v,v},k.isLevelAllowed=function(d,v){return v===void 0&&(v=[]),v.indexOf(d)===-1},k.getMaxLevelByMediaSize=function(d,v,b){if(!d||!d.length)return-1;for(var p=function(t,r){return r?t.width!==r.width||t.height!==r.height:!0},m=d.length-1,y=0;y<d.length;y+=1){var n=d[y];if((n.width>=v||n.height>=b)&&p(n,d[y+1])){m=y;break}}return m},A(k,[{key:"mediaWidth",get:function(){return this.getDimensions().width*k.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*k.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var d=1;try{d=self.devicePixelRatio}catch(v){}return d}}]),k}();B.default=N},"./src/controller/cmcd-controller.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"default",function(){return p});var _=w("./src/events.ts"),D=w("./src/types/cmcd.ts"),A=w("./src/utils/buffer-helper.ts"),N=w("./src/utils/logger.ts");function k(m,y){for(var n=0;n<y.length;n++){var e=y[n];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(m,e.key,e)}}function S(m,y,n){return y&&k(m.prototype,y),n&&k(m,n),m}function C(m,y){var n=typeof Symbol!="undefined"&&m[Symbol.iterator]||m["@@iterator"];if(n)return(n=n.call(m)).next.bind(n);if(Array.isArray(m)||(n=d(m))||y&&m&&typeof m.length=="number"){n&&(m=n);var e=0;return function(){return e>=m.length?{done:!0}:{done:!1,value:m[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 d(m,y){if(!m)return;if(typeof m=="string")return v(m,y);var n=Object.prototype.toString.call(m).slice(8,-1);if(n==="Object"&&m.constructor&&(n=m.constructor.name),n==="Map"||n==="Set")return Array.from(m);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return v(m,y)}function v(m,y){(y==null||y>m.length)&&(y=m.length);for(var n=0,e=new Array(y);n<y;n++)e[n]=m[n];return e}function b(){return b=Object.assign||function(m){for(var y=1;y<arguments.length;y++){var n=arguments[y];for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(m[e]=n[e])}return m},b.apply(this,arguments)}var p=function(){function m(n){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(f){try{e.apply(f,{ot:D.CMCDObjectType.MANIFEST,su:!e.initialized})}catch(c){N.logger.warn("Could not generate manifest CMCD data.",c)}},this.applyFragmentData=function(f){try{var c=f.frag,u=e.hls.levels[c.level],E=e.getObjectType(c),g={d:c.duration*1e3,ot:E};(E===D.CMCDObjectType.VIDEO||E===D.CMCDObjectType.AUDIO||E==D.CMCDObjectType.MUXED)&&(g.br=u.bitrate/1e3,g.tb=e.getTopBandwidth(E),g.bl=e.getBufferLength(E)),e.apply(f,g)}catch(s){N.logger.warn("Could not generate segment CMCD data.",s)}},this.hls=n;var t=this.config=n.config,r=t.cmcd;r!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=r.sessionId||m.uuid(),this.cid=r.contentId,this.useHeaders=r.useHeaders===!0,this.registerListeners())}var y=m.prototype;return y.registerListeners=function(){var e=this.hls;e.on(_.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.on(_.Events.BUFFER_CREATED,this.onBufferCreated,this)},y.unregisterListeners=function(){var e=this.hls;e.off(_.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.off(_.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},y.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},y.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},y.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},y.onBufferCreated=function(e,t){var r,f;this.audioBuffer=(r=t.tracks.audio)===null||r===void 0?void 0:r.buffer,this.videoBuffer=(f=t.tracks.video)===null||f===void 0?void 0:f.buffer},y.createData=function(){var e;return{v:D.CMCDVersion,sf:D.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}},y.apply=function(e,t){t===void 0&&(t={}),b(t,this.createData());var r=t.ot===D.CMCDObjectType.INIT||t.ot===D.CMCDObjectType.VIDEO||t.ot===D.CMCDObjectType.MUXED;if(this.starved&&r&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering),this.useHeaders){var f=m.toHeaders(t);if(!Object.keys(f).length)return;e.headers||(e.headers={}),b(e.headers,f)}else{var c=m.toQuery(t);if(!c)return;e.url=m.appendQueryToUri(e.url,c)}},y.getObjectType=function(e){var t=e.type;return t==="subtitle"?D.CMCDObjectType.TIMED_TEXT:e.sn==="initSegment"?D.CMCDObjectType.INIT:t==="audio"?D.CMCDObjectType.AUDIO:t==="main"?this.hls.audioTracks.length?D.CMCDObjectType.VIDEO:D.CMCDObjectType.MUXED:void 0},y.getTopBandwidth=function(e){for(var t=0,r=e===D.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,f=C(r),c;!(c=f()).done;){var u=c.value;u.bitrate>t&&(t=u.bitrate)}return t>0?t:NaN},y.getBufferLength=function(e){var t=this.hls.media,r=e===D.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!r||!t)return NaN;var f=A.BufferHelper.bufferInfo(r,t.currentTime,this.config.maxBufferHole);return f.len*1e3},y.createPlaylistLoader=function(){var e=this.config.pLoader,t=this.applyPlaylistData,r=e||this.config.loader;return function(){function f(u){this.loader=void 0,this.loader=new r(u)}var c=f.prototype;return c.destroy=function(){this.loader.destroy()},c.abort=function(){this.loader.abort()},c.load=function(E,g,s){t(E),this.loader.load(E,g,s)},S(f,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),f}()},y.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,r=e||this.config.loader;return function(){function f(u){this.loader=void 0,this.loader=new r(u)}var c=f.prototype;return c.destroy=function(){this.loader.destroy()},c.abort=function(){this.loader.abort()},c.load=function(E,g,s){t(E),this.loader.load(E,g,s)},S(f,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),f}()},m.uuid=function(){var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.substr(t.lastIndexOf("/")+1)},m.serialize=function(e){for(var t=[],r=function(I){return!Number.isNaN(I)&&I!=null&&I!==""&&I!==!1},f=function(I){return Math.round(I)},c=function(I){return f(I/100)*100},u=function(I){return encodeURIComponent(I)},E={br:f,d:f,bl:c,dl:c,mtp:c,nor:u,rtp:c,tb:f},g=Object.keys(e||{}).sort(),s=C(g),a;!(a=s()).done;){var i=a.value,l=e[i];if(!r(l))continue;if(i==="v"&&l===1)continue;if(i=="pr"&&l===1)continue;var T=E[i];T&&(l=T(l));var x=typeof l,L=void 0;i==="ot"||i==="sf"||i==="st"?L=i+"="+l:x==="boolean"?L=i:x==="number"?L=i+"="+l:L=i+"="+JSON.stringify(l),t.push(L)}return t.join(",")},m.toHeaders=function(e){for(var t=Object.keys(e),r={},f=["Object","Request","Session","Status"],c=[{},{},{},{}],u={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},E=0,g=t;E<g.length;E++){var s=g[E],a=u[s]!=null?u[s]:1;c[a][s]=e[s]}for(var i=0;i<c.length;i++){var l=m.serialize(c[i]);l&&(r["CMCD-"+f[i]]=l)}return r},m.toQuery=function(e){return"CMCD="+encodeURIComponent(m.serialize(e))},m.appendQueryToUri=function(e,t){if(!t)return e;var r=e.includes("?")?"&":"?";return""+e+r+t},m}()},"./src/controller/eme-controller.ts":function(ue,B,w){"use strict";w.r(B);var _=w("./src/events.ts"),D=w("./src/errors.ts"),A=w("./src/utils/logger.ts"),N=w("./src/utils/mediakeys-helper.ts");function k(p,m){for(var y=0;y<m.length;y++){var n=m[y];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(p,n.key,n)}}function S(p,m,y){return m&&k(p.prototype,m),y&&k(p,y),p}var C=3,d=function(m,y,n){var e={audioCapabilities:[],videoCapabilities:[]};return m.forEach(function(t){e.audioCapabilities.push({contentType:'audio/mp4; codecs="'+t+'"',robustness:n.audioRobustness||""})}),y.forEach(function(t){e.videoCapabilities.push({contentType:'video/mp4; codecs="'+t+'"',robustness:n.videoRobustness||""})}),[e]},v=function(m,y,n,e){switch(m){case N.KeySystems.WIDEVINE:return d(y,n,e);default:throw new Error("Unknown key-system: "+m)}},b=function(){function p(y){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=y,this._config=y.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 m=p.prototype;return m.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},m._registerListeners=function(){this.hls.on(_.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(_.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(_.Events.MANIFEST_PARSED,this.onManifestParsed,this)},m._unregisterListeners=function(){this.hls.off(_.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(_.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(_.Events.MANIFEST_PARSED,this.onManifestParsed,this)},m.getLicenseServerUrl=function(n){switch(n){case N.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+n+'"')},m._attemptKeySystemAccess=function(n,e,t){var r=this,f=v(n,e,t,this._drmSystemOptions);A.logger.log("Requesting encrypted media key-system access");var c=this.requestMediaKeySystemAccess(n,f);this.mediaKeysPromise=c.then(function(u){return r._onMediaKeySystemAccessObtained(n,u)}),c.catch(function(u){A.logger.error('Failed to obtain key-system "'+n+'" access:',u)})},m._onMediaKeySystemAccessObtained=function(n,e){var t=this;A.logger.log('Access for key-system "'+n+'" obtained');var r={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:e,mediaKeySystemDomain:n};this._mediaKeysList.push(r);var f=Promise.resolve().then(function(){return e.createMediaKeys()}).then(function(c){return r.mediaKeys=c,A.logger.log('Media-keys created for key-system "'+n+'"'),t._onMediaKeysCreated(),c});return f.catch(function(c){A.logger.error("Failed to create media-keys:",c)}),f},m._onMediaKeysCreated=function(){var n=this;this._mediaKeysList.forEach(function(e){e.mediaKeysSession||(e.mediaKeysSession=e.mediaKeys.createSession(),n._onNewMediaKeySession(e.mediaKeysSession))})},m._onNewMediaKeySession=function(n){var e=this;A.logger.log("New key-system session "+n.sessionId),n.addEventListener("message",function(t){e._onKeySessionMessage(n,t.message)},!1)},m._onKeySessionMessage=function(n,e){A.logger.log("Got EME message event, creating license request"),this._requestLicense(e,function(t){A.logger.log("Received license data (length: "+(t&&t.byteLength)+"), updating key-session"),n.update(t)})},m.onMediaEncrypted=function(n){var e=this;if(A.logger.log('Media is encrypted using "'+n.initDataType+'" init data type'),!this.mediaKeysPromise){A.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(_.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var t=function(f){if(!e._media)return;e._attemptSetMediaKeys(f),e._generateRequestWithPreferredKeySession(n.initDataType,n.initData)};this.mediaKeysPromise.then(t).catch(t)},m._attemptSetMediaKeys=function(n){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){A.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(_.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}A.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(e.mediaKeys),this._hasSetMediaKeys=!0}},m._generateRequestWithPreferredKeySession=function(n,e){var t=this,r=this._mediaKeysList[0];if(!r){A.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(_.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(r.mediaKeysSessionInitialized){A.logger.warn("Key-Session already initialized but requested again");return}var f=r.mediaKeysSession;if(!f){A.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(_.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!e){A.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(_.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}A.logger.log('Generating key-session request for "'+n+'" init data type'),r.mediaKeysSessionInitialized=!0,f.generateRequest(n,e).then(function(){A.logger.debug("Key-session generation succeeded")}).catch(function(c){A.logger.error("Error generating key-session request:",c),t.hls.trigger(_.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},m._createLicenseXhr=function(n,e,t){var r=new XMLHttpRequest;r.responseType="arraybuffer",r.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,r,n,e,t);var f=this._licenseXhrSetup;if(f)try{f.call(this.hls,r,n),f=void 0}catch(c){A.logger.error(c)}try{r.readyState||r.open("POST",n,!0),f&&f.call(this.hls,r,n)}catch(c){throw new Error("issue setting up KeySystem license XHR "+c)}return r},m._onLicenseRequestReadyStageChange=function(n,e,t,r){switch(n.readyState){case 4:if(n.status===200){this._requestLicenseFailureCount=0,A.logger.log("License request succeeded");var f=n.response,c=this._licenseResponseCallback;if(c)try{f=c.call(this.hls,n,e)}catch(E){A.logger.error(E)}r(f)}else{if(A.logger.error("License Request XHR failed ("+e+"). Status: "+n.status+" ("+n.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>C){this.hls.trigger(_.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var u=C-this._requestLicenseFailureCount+1;A.logger.warn("Retrying license request, "+u+" attempts left"),this._requestLicense(t,r)}break}},m._generateLicenseRequestChallenge=function(n,e){switch(n.mediaKeySystemDomain){case N.KeySystems.WIDEVINE:return e}throw new Error("unsupported key-system: "+n.mediaKeySystemDomain)},m._requestLicense=function(n,e){A.logger.log("Requesting content license for key-system");var t=this._mediaKeysList[0];if(!t){A.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(_.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var r=this.getLicenseServerUrl(t.mediaKeySystemDomain),f=this._createLicenseXhr(r,n,e);A.logger.log("Sending license request to URL: "+r);var c=this._generateLicenseRequestChallenge(t,n);f.send(c)}catch(u){A.logger.error("Failure requesting DRM license: "+u),this.hls.trigger(_.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},m.onMediaAttached=function(n,e){if(!this._emeEnabled)return;var t=e.media;this._media=t,t.addEventListener("encrypted",this._onMediaEncrypted)},m.onMediaDetached=function(){var n=this._media,e=this._mediaKeysList;if(!n)return;n.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(e.map(function(t){if(t.mediaKeysSession)return t.mediaKeysSession.close().catch(function(){})})).then(function(){return n.setMediaKeys(null)}).catch(function(){})},m.onManifestParsed=function(n,e){if(!this._emeEnabled)return;var t=e.levels.map(function(f){return f.audioCodec}).filter(function(f){return!!f}),r=e.levels.map(function(f){return f.videoCodec}).filter(function(f){return!!f});this._attemptKeySystemAccess(N.KeySystems.WIDEVINE,t,r)},S(p,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),p}();B.default=b},"./src/controller/fps-controller.ts":function(ue,B,w){"use strict";w.r(B);var _=w("./src/events.ts"),D=w("./src/utils/logger.ts"),A=function(){function N(S){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=S,this.registerListeners()}var k=N.prototype;return k.setStreamController=function(C){this.streamController=C},k.registerListeners=function(){this.hls.on(_.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},k.unregisterListeners=function(){this.hls.off(_.Events.MEDIA_ATTACHING,this.onMediaAttaching)},k.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},k.onMediaAttaching=function(C,d){var v=this.hls.config;if(v.capLevelOnFPSDrop){var b=d.media instanceof self.HTMLVideoElement?d.media:null;this.media=b,b&&typeof b.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),v.fpsDroppedMonitoringPeriod)}},k.checkFPS=function(C,d,v){var b=performance.now();if(d){if(this.lastTime){var p=b-this.lastTime,m=v-this.lastDroppedFrames,y=d-this.lastDecodedFrames,n=1e3*m/p,e=this.hls;if(e.trigger(_.Events.FPS_DROP,{currentDropped:m,currentDecoded:y,totalDroppedFrames:v}),n>0&&m>e.config.fpsDroppedMonitoringThreshold*y){var t=e.currentLevel;D.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+t),t>0&&(e.autoLevelCapping===-1||e.autoLevelCapping>=t)&&(t=t-1,e.trigger(_.Events.FPS_DROP_LEVEL_CAPPING,{level:t,droppedLevel:e.currentLevel}),e.autoLevelCapping=t,this.streamController.nextLevelSwitch())}}this.lastTime=b,this.lastDroppedFrames=v,this.lastDecodedFrames=d}},k.checkFPSInterval=function(){var C=this.media;if(C)if(this.isVideoPlaybackQualityAvailable){var d=C.getVideoPlaybackQuality();this.checkFPS(C,d.totalVideoFrames,d.droppedVideoFrames)}else this.checkFPS(C,C.webkitDecodedFrameCount,C.webkitDroppedFrameCount)},N}();B.default=A},"./src/controller/fragment-finders.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"findFragmentByPDT",function(){return A}),w.d(B,"findFragmentByPTS",function(){return N}),w.d(B,"fragmentWithinToleranceTest",function(){return k}),w.d(B,"pdtWithinToleranceTest",function(){return S}),w.d(B,"findFragWithCC",function(){return C});var _=w("./src/polyfills/number.ts"),D=w("./src/utils/binary-search.ts");function A(d,v,b){if(v===null||!Array.isArray(d)||!d.length||!Object(_.isFiniteNumber)(v))return null;var p=d[0].programDateTime;if(v<(p||0))return null;var m=d[d.length-1].endProgramDateTime;if(v>=(m||0))return null;b=b||0;for(var y=0;y<d.length;++y){var n=d[y];if(S(v,b,n))return n}return null}function N(d,v,b,p){b===void 0&&(b=0),p===void 0&&(p=0);var m=null;if(d?m=v[d.sn-v[0].sn+1]||null:b===0&&v[0].start===0&&(m=v[0]),m&&k(b,p,m)===0)return m;var y=D.default.search(v,k.bind(null,b,p));return y||m}function k(d,v,b){d===void 0&&(d=0),v===void 0&&(v=0);var p=Math.min(v,b.duration+(b.deltaPTS?b.deltaPTS:0));return b.start+b.duration-p<=d?1:b.start-p>d&&b.start?-1:0}function S(d,v,b){var p=Math.min(v,b.duration+(b.deltaPTS?b.deltaPTS:0))*1e3,m=b.endProgramDateTime||0;return m-p>d}function C(d,v){return D.default.search(d,function(b){return b.cc<v?1:b.cc>v?-1:0})}},"./src/controller/fragment-tracker.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"FragmentState",function(){return A}),w.d(B,"FragmentTracker",function(){return N});var _=w("./src/events.ts"),D=w("./src/types/loader.ts"),A;(function(C){C.NOT_LOADED="NOT_LOADED",C.BACKTRACKED="BACKTRACKED",C.APPENDING="APPENDING",C.PARTIAL="PARTIAL",C.OK="OK"})(A||(A={}));var N=function(){function C(v){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=v,this._registerListeners()}var d=C.prototype;return d._registerListeners=function(){var b=this.hls;b.on(_.Events.BUFFER_APPENDED,this.onBufferAppended,this),b.on(_.Events.FRAG_BUFFERED,this.onFragBuffered,this),b.on(_.Events.FRAG_LOADED,this.onFragLoaded,this)},d._unregisterListeners=function(){var b=this.hls;b.off(_.Events.BUFFER_APPENDED,this.onBufferAppended,this),b.off(_.Events.FRAG_BUFFERED,this.onFragBuffered,this),b.off(_.Events.FRAG_LOADED,this.onFragLoaded,this)},d.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},d.getAppendedFrag=function(b,p){if(p===D.PlaylistLevelType.MAIN){var m=this.activeFragment,y=this.activeParts;if(!m)return null;if(y)for(var n=y.length;n--;){var e=y[n],t=e?e.end:m.appendedPTS;if(e.start<=b&&t!==void 0&&b<=t)return n>9&&(this.activeParts=y.slice(n-9)),e}else if(m.start<=b&&m.appendedPTS!==void 0&&b<=m.appendedPTS)return m}return this.getBufferedFrag(b,p)},d.getBufferedFrag=function(b,p){for(var m=this.fragments,y=Object.keys(m),n=y.length;n--;){var e=m[y[n]];if((e==null?void 0:e.body.type)===p&&e.buffered){var t=e.body;if(t.start<=b&&b<=t.end)return t}}return null},d.detectEvictedFragments=function(b,p,m){var y=this;Object.keys(this.fragments).forEach(function(n){var e=y.fragments[n];if(!e)return;if(!e.buffered){e.body.type===m&&y.removeFragment(e.body);return}var t=e.range[b];if(!t)return;t.time.some(function(r){var f=!y.isTimeBuffered(r.startPTS,r.endPTS,p);return f&&y.removeFragment(e.body),f})})},d.detectPartialFragments=function(b){var p=this,m=this.timeRanges,y=b.frag,n=b.part;if(!m||y.sn==="initSegment")return;var e=S(y),t=this.fragments[e];if(!t)return;Object.keys(m).forEach(function(r){var f=y.elementaryStreams[r];if(!f)return;var c=m[r],u=n!==null||f.partial===!0;t.range[r]=p.getBufferedTimes(y,n,u,c)}),t.backtrack=t.loaded=null,Object.keys(t.range).length?t.buffered=!0:this.removeFragment(t.body)},d.fragBuffered=function(b){var p=S(b),m=this.fragments[p];m&&(m.backtrack=m.loaded=null,m.buffered=!0)},d.getBufferedTimes=function(b,p,m,y){for(var n={time:[],partial:m},e=p?p.start:b.start,t=p?p.end:b.end,r=b.minEndPTS||t,f=b.maxStartPTS||e,c=0;c<y.length;c++){var u=y.start(c)-this.bufferPadding,E=y.end(c)+this.bufferPadding;if(f>=u&&r<=E){n.time.push({startPTS:Math.max(e,y.start(c)),endPTS:Math.min(t,y.end(c))});break}else if(e<E&&t>u)n.partial=!0,n.time.push({startPTS:Math.max(e,y.start(c)),endPTS:Math.min(t,y.end(c))});else if(t<=u)break}return n},d.getPartialFragment=function(b){var p=null,m,y,n,e=0,t=this.bufferPadding,r=this.fragments;return Object.keys(r).forEach(function(f){var c=r[f];if(!c)return;k(c)&&(y=c.body.start-t,n=c.body.end+t,b>=y&&b<=n&&(m=Math.min(b-y,n-b),e<=m&&(p=c.body,e=m)))}),p},d.getState=function(b){var p=S(b),m=this.fragments[p];return m?m.buffered?k(m)?A.PARTIAL:A.OK:m.backtrack?A.BACKTRACKED:A.APPENDING:A.NOT_LOADED},d.backtrack=function(b,p){var m=S(b),y=this.fragments[m];if(!y||y.backtrack)return null;var n=y.backtrack=p||y.loaded;return y.loaded=null,n},d.getBacktrackData=function(b){var p=S(b),m=this.fragments[p];if(m){var y,n=m.backtrack;if(n!=null&&(y=n.payload)!==null&&y!==void 0&&y.byteLength)return n;this.removeFragment(b)}return null},d.isTimeBuffered=function(b,p,m){for(var y,n,e=0;e<m.length;e++){if(y=m.start(e)-this.bufferPadding,n=m.end(e)+this.bufferPadding,b>=y&&p<=n)return!0;if(p<=y)return!1}return!1},d.onFragLoaded=function(b,p){var m=p.frag,y=p.part;if(m.sn==="initSegment"||m.bitrateTest||y)return;var n=S(m);this.fragments[n]={body:m,loaded:p,backtrack:null,buffered:!1,range:Object.create(null)}},d.onBufferAppended=function(b,p){var m=this,y=p.frag,n=p.part,e=p.timeRanges;if(y.type===D.PlaylistLevelType.MAIN)if(this.activeFragment=y,n){var t=this.activeParts;t||(this.activeParts=t=[]),t.push(n)}else this.activeParts=null;this.timeRanges=e,Object.keys(e).forEach(function(r){var f=e[r];if(m.detectEvictedFragments(r,f),!n)for(var c=0;c<f.length;c++)y.appendedPTS=Math.max(f.end(c),y.appendedPTS||0)})},d.onFragBuffered=function(b,p){this.detectPartialFragments(p)},d.hasFragment=function(b){var p=S(b);return!!this.fragments[p]},d.removeFragmentsInRange=function(b,p,m){var y=this;Object.keys(this.fragments).forEach(function(n){var e=y.fragments[n];if(!e)return;if(e.buffered){var t=e.body;t.type===m&&t.start<p&&t.end>b&&y.removeFragment(t)}})},d.removeFragment=function(b){var p=S(b);b.stats.loaded=0,b.clearElementaryStreamInfo(),delete this.fragments[p]},d.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},C}();function k(C){var d,v;return C.buffered&&(((d=C.range.video)===null||d===void 0?void 0:d.partial)||((v=C.range.audio)===null||v===void 0?void 0:v.partial))}function S(C){return C.type+"_"+C.level+"_"+C.urlId+"_"+C.sn}},"./src/controller/gap-controller.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"STALL_MINIMUM_DURATION_MS",function(){return k}),w.d(B,"MAX_START_GAP_JUMP",function(){return S}),w.d(B,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return C}),w.d(B,"SKIP_BUFFER_RANGE_START",function(){return d}),w.d(B,"default",function(){return v});var _=w("./src/utils/buffer-helper.ts"),D=w("./src/errors.ts"),A=w("./src/events.ts"),N=w("./src/utils/logger.ts"),k=250,S=2,C=.1,d=.05,v=function(){function b(m,y,n,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=m,this.media=y,this.fragmentTracker=n,this.hls=e}var p=b.prototype;return p.destroy=function(){this.hls=this.fragmentTracker=this.media=null},p.poll=function(y){var n=this.config,e=this.media,t=this.stalled,r=e.currentTime,f=e.seeking,c=this.seeking&&!f,u=!this.seeking&&f;if(this.seeking=f,r!==y){if(this.moved=!0,t!==null){if(this.stallReported){var E=self.performance.now()-t;N.logger.warn("playback not stuck anymore @"+r+", after "+Math.round(E)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((u||c)&&(this.stalled=null),e.paused||e.ended||e.playbackRate===0||!_.BufferHelper.getBuffered(e).length)return;var g=_.BufferHelper.bufferInfo(e,r,0),s=g.len>0,a=g.nextStart||0;if(!s&&!a)return;if(f){var i=g.len>S,l=!a||a-r>S&&!this.fragmentTracker.getPartialFragment(r);if(i||l)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var T,x=Math.max(a,g.start||0)-r,L=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,R=L==null||((T=L.details)===null||T===void 0)?void 0:T.live,I=R?L.details.targetduration*2:S;if(x>0&&x<=I){this._trySkipBufferHole(null);return}}var F=self.performance.now();if(t===null){this.stalled=F;return}var j=F-t;!f&&j>=k&&this._reportStall(g.len);var z=_.BufferHelper.bufferInfo(e,r,n.maxBufferHole);this._tryFixBufferStall(z,j)},p._tryFixBufferStall=function(y,n){var e=this.config,t=this.fragmentTracker,r=this.media,f=r.currentTime,c=t.getPartialFragment(f);if(c){var u=this._trySkipBufferHole(c);if(u)return}y.len>e.maxBufferHole&&n>e.highBufferWatchdogPeriod*1e3&&(N.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},p._reportStall=function(y){var n=this.hls,e=this.media,t=this.stallReported;t||(this.stallReported=!0,N.logger.warn("Playback stalling at @"+e.currentTime+" due to low buffer (buffer="+y+")"),n.trigger(A.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:y}))},p._trySkipBufferHole=function(y){for(var n=this.config,e=this.hls,t=this.media,r=t.currentTime,f=0,c=_.BufferHelper.getBuffered(t),u=0;u<c.length;u++){var E=c.start(u);if(r+n.maxBufferHole>=f&&r<E){var g=Math.max(E+d,t.currentTime+C);return N.logger.warn("skipping hole, adjusting currentTime from "+r+" to "+g),this.moved=!0,this.stalled=null,t.currentTime=g,y&&e.trigger(A.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+r+" to "+g,frag:y}),g}f=c.end(u)}return 0},p._tryNudgeBuffer=function(){var y=this.config,n=this.hls,e=this.media,t=e.currentTime,r=(this.nudgeRetry||0)+1;if(this.nudgeRetry=r,r<y.nudgeMaxRetry){var f=t+r*y.nudgeOffset;N.logger.warn("Nudging 'currentTime' from "+t+" to "+f),e.currentTime=f,n.trigger(A.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else N.logger.error("Playhead still not moving while enough data buffered @"+t+" after "+y.nudgeMaxRetry+" nudges"),n.trigger(A.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},b}()},"./src/controller/id3-track-controller.ts":function(ue,B,w){"use strict";w.r(B);var _=w("./src/events.ts"),D=w("./src/utils/texttrack-utils.ts"),A=w("./src/demux/id3.ts"),N=.25,k=function(){function S(d){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=d,this._registerListeners()}var C=S.prototype;return C.destroy=function(){this._unregisterListeners()},C._registerListeners=function(){var v=this.hls;v.on(_.Events.MEDIA_ATTACHED,this.onMediaAttached,this),v.on(_.Events.MEDIA_DETACHING,this.onMediaDetaching,this),v.on(_.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),v.on(_.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},C._unregisterListeners=function(){var v=this.hls;v.off(_.Events.MEDIA_ATTACHED,this.onMediaAttached,this),v.off(_.Events.MEDIA_DETACHING,this.onMediaDetaching,this),v.off(_.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),v.off(_.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},C.onMediaAttached=function(v,b){this.media=b.media},C.onMediaDetaching=function(){if(!this.id3Track)return;Object(D.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},C.getID3Track=function(v){if(!this.media)return;for(var b=0;b<v.length;b++){var p=v[b];if(p.kind==="metadata"&&p.label==="id3")return Object(D.sendAddTrackEvent)(p,this.media),p}return this.media.addTextTrack("metadata","id3")},C.onFragParsingMetadata=function(v,b){if(!this.media)return;var p=b.frag,m=b.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var y=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,n=0;n<m.length;n++){var e=A.getID3Frames(m[n].data);if(e){var t=m[n].pts,r=n<m.length-1?m[n+1].pts:p.end,f=r-t;f<=0&&(r=t+N);for(var c=0;c<e.length;c++){var u=e[c];if(!A.isTimeStampFrame(u)){var E=new y(t,r,"");E.value=u,this.id3Track.addCue(E)}}}}},C.onBufferFlushing=function(v,b){var p=b.startOffset,m=b.endOffset,y=b.type;if(!y||y==="audio"){var n=this.id3Track;n&&Object(D.removeCuesInRange)(n,p,m)}},S}();B.default=k},"./src/controller/latency-controller.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"default",function(){return S});var _=w("./src/errors.ts"),D=w("./src/events.ts"),A=w("./src/utils/logger.ts");function N(C,d){for(var v=0;v<d.length;v++){var b=d[v];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(C,b.key,b)}}function k(C,d,v){return d&&N(C.prototype,d),v&&N(C,v),C}var S=function(){function C(v){var b=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 b.timeupdate()},this.hls=v,this.config=v.config,this.registerListeners()}var d=C.prototype;return d.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},d.registerListeners=function(){this.hls.on(D.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(D.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(D.Events.ERROR,this.onError,this)},d.unregisterListeners=function(){this.hls.off(D.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(D.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(D.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(D.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(D.Events.ERROR,this.onError)},d.onMediaAttached=function(b,p){this.media=p.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},d.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},d.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},d.onLevelUpdated=function(b,p){var m=p.details;this.levelDetails=m,m.advanced&&this.timeupdate(),!m.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},d.onError=function(b,p){if(p.details!==_.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,A.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},d.timeupdate=function(){var b=this.media,p=this.levelDetails;if(!b||!p)return;this.currentTime=b.currentTime;var m=this.computeLatency();if(m===null)return;this._latency=m;var y=this.config,n=y.lowLatencyMode,e=y.maxLiveSyncPlaybackRate;if(!n||e===1)return;var t=this.targetLatency;if(t===null)return;var r=m-t,f=Math.min(this.maxLatency,t+p.targetduration),c=r<f;if(p.live&&c&&r>.05&&this.forwardBufferLength>1){var u=Math.min(2,Math.max(1,e)),E=Math.round(2/(1+Math.exp(-.75*r-this.edgeStalled))*20)/20;b.playbackRate=Math.min(u,Math.max(1,E))}else b.playbackRate!==1&&b.playbackRate!==0&&(b.playbackRate=1)},d.estimateLiveEdge=function(){var b=this.levelDetails;return b===null?null:b.edge+b.age},d.computeLatency=function(){var b=this.estimateLiveEdge();return b===null?null:b-this.currentTime},k(C,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var b=this.config,p=this.levelDetails;return b.liveMaxLatencyDuration!==void 0?b.liveMaxLatencyDuration:p?b.liveMaxLatencyDurationCount*p.targetduration:0}},{key:"targetLatency",get:function(){var b=this.levelDetails;if(b===null)return null;var p=b.holdBack,m=b.partHoldBack,y=b.targetduration,n=this.config,e=n.liveSyncDuration,t=n.liveSyncDurationCount,r=n.lowLatencyMode,f=this.hls.userConfig,c=r&&m||p;(f.liveSyncDuration||f.liveSyncDurationCount||c===0)&&(c=e!==void 0?e:t*y);var u=y,E=1;return c+Math.min(this.stallCount*E,u)}},{key:"liveSyncPosition",get:function(){var b=this.estimateLiveEdge(),p=this.targetLatency,m=this.levelDetails;if(b===null||p===null||m===null)return null;var y=m.edge,n=b-p-this.edgeStalled,e=y-m.totalduration,t=y-(this.config.lowLatencyMode&&m.partTarget||m.targetduration);return Math.min(Math.max(e,n),t)}},{key:"drift",get:function(){var b=this.levelDetails;return b===null?1:b.drift}},{key:"edgeStalled",get:function(){var b=this.levelDetails;if(b===null)return 0;var p=(this.config.lowLatencyMode&&b.partTarget||b.targetduration)*3;return Math.max(b.age-p,0)}},{key:"forwardBufferLength",get:function(){var b=this.media,p=this.levelDetails;if(!b||!p)return 0;var m=b.buffered.length;return m?b.buffered.end(m-1):p.edge-this.currentTime}}]),C}()},"./src/controller/level-controller.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"default",function(){return n});var _=w("./src/types/level.ts"),D=w("./src/events.ts"),A=w("./src/errors.ts"),N=w("./src/utils/codecs.ts"),k=w("./src/controller/level-helper.ts"),S=w("./src/controller/base-playlist-controller.ts"),C=w("./src/types/loader.ts");function d(){return d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var f in r)Object.prototype.hasOwnProperty.call(r,f)&&(e[f]=r[f])}return e},d.apply(this,arguments)}function v(e,t){for(var r=0;r<t.length;r++){var f=t[r];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(e,f.key,f)}}function b(e,t,r){return t&&v(e.prototype,t),r&&v(e,r),e}function p(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,m(e,t)}function m(e,t){return m=Object.setPrototypeOf||function(f,c){return f.__proto__=c,f},m(e,t)}var y=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),n=function(e){p(t,e);function t(f){var c;return c=e.call(this,f,"[level-controller]")||this,c._levels=[],c._firstLevel=-1,c._startLevel=void 0,c.currentLevelIndex=-1,c.manualLevelIndex=-1,c.onParsedComplete=void 0,c._registerListeners(),c}var r=t.prototype;return r._registerListeners=function(){var c=this.hls;c.on(D.Events.MANIFEST_LOADED,this.onManifestLoaded,this),c.on(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(D.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(D.Events.FRAG_LOADED,this.onFragLoaded,this),c.on(D.Events.ERROR,this.onError,this)},r._unregisterListeners=function(){var c=this.hls;c.off(D.Events.MANIFEST_LOADED,this.onManifestLoaded,this),c.off(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(D.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(D.Events.FRAG_LOADED,this.onFragLoaded,this),c.off(D.Events.ERROR,this.onError,this)},r.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,e.prototype.destroy.call(this)},r.startLoad=function(){var c=this._levels;c.forEach(function(u){u.loadError=0}),e.prototype.startLoad.call(this)},r.onManifestLoaded=function(c,u){var E=[],g=[],s=[],a,i={},l,T=!1,x=!1,L=!1;if(u.levels.forEach(function(j){var z=j.attrs;T=T||!!(j.width&&j.height),x=x||!!j.videoCodec,L=L||!!j.audioCodec,y&&j.audioCodec&&j.audioCodec.indexOf("mp4a.40.34")!==-1&&(j.audioCodec=void 0);var Q=j.bitrate+"-"+j.attrs.RESOLUTION+"-"+j.attrs.CODECS;l=i[Q],l?l.url.push(j.url):(l=new _.Level(j),i[Q]=l,E.push(l)),z&&(z.AUDIO&&Object(k.addGroupId)(l,"audio",z.AUDIO),z.SUBTITLES&&Object(k.addGroupId)(l,"text",z.SUBTITLES))}),(T||x)&&L&&(E=E.filter(function(j){var z=j.videoCodec,Q=j.width,J=j.height;return!!z||!!(Q&&J)})),E=E.filter(function(j){var z=j.audioCodec,Q=j.videoCodec;return(!z||Object(N.isCodecSupportedInMp4)(z,"audio"))&&(!Q||Object(N.isCodecSupportedInMp4)(Q,"video"))}),u.audioTracks&&(g=u.audioTracks.filter(function(j){return!j.audioCodec||Object(N.isCodecSupportedInMp4)(j.audioCodec,"audio")}),Object(k.assignTrackIdsByGroup)(g)),u.subtitles&&(s=u.subtitles,Object(k.assignTrackIdsByGroup)(s)),E.length>0){a=E[0].bitrate,E.sort(function(j,z){return j.bitrate-z.bitrate}),this._levels=E;for(var R=0;R<E.length;R++)if(E[R].bitrate===a){this._firstLevel=R,this.log("manifest loaded, "+E.length+" level(s) found, first bitrate: "+a);break}var I=L&&!x,F={levels:E,audioTracks:g,subtitleTracks:s,firstLevel:this._firstLevel,stats:u.stats,audio:L,video:x,altAudio:!I&&g.some(function(j){return!!j.url})};this.hls.trigger(D.Events.MANIFEST_PARSED,F),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(D.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:u.url,reason:"no level with compatible codecs found in manifest"})},r.onError=function(c,u){if(e.prototype.onError.call(this,c,u),u.fatal)return;var E=u.context,g=this._levels[this.currentLevelIndex];if(E&&(E.type===C.PlaylistContextType.AUDIO_TRACK&&g.audioGroupIds&&E.groupId===g.audioGroupIds[g.urlId]||E.type===C.PlaylistContextType.SUBTITLE_TRACK&&g.textGroupIds&&E.groupId===g.textGroupIds[g.urlId])){this.redundantFailover(this.currentLevelIndex);return}var s=!1,a=!0,i;switch(u.details){case A.ErrorDetails.FRAG_LOAD_ERROR:case A.ErrorDetails.FRAG_LOAD_TIMEOUT:case A.ErrorDetails.KEY_LOAD_ERROR:case A.ErrorDetails.KEY_LOAD_TIMEOUT:if(u.frag){var l=this._levels[u.frag.level];l?(l.fragmentError++,l.fragmentError>this.hls.config.fragLoadingMaxRetry&&(i=u.frag.level)):i=u.frag.level}break;case A.ErrorDetails.LEVEL_LOAD_ERROR:case A.ErrorDetails.LEVEL_LOAD_TIMEOUT:E&&(E.deliveryDirectives&&(a=!1),i=E.level),s=!0;break;case A.ErrorDetails.REMUX_ALLOC_ERROR:i=u.level,s=!0;break}i!==void 0&&this.recoverLevel(u,i,s,a)},r.recoverLevel=function(c,u,E,g){var s=c.details,a=this._levels[u];if(a.loadError++,E){var i=this.retryLoadingOrFail(c);if(i)c.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(g){var l=a.url.length;if(l>1&&a.loadError<l)c.levelRetry=!0,this.redundantFailover(u);else if(this.manualLevelIndex===-1){var T=u===0?this._levels.length-1:u-1;this.currentLevelIndex!==T&&this._levels[T].loadError===0&&(this.warn(s+": switch to "+T),c.levelRetry=!0,this.hls.nextAutoLevel=T)}}},r.redundantFailover=function(c){var u=this._levels[c],E=u.url.length;if(E>1){var g=(u.urlId+1)%E;this.warn("Switching to redundant URL-id "+g),this._levels.forEach(function(s){s.urlId=g}),this.level=c}},r.onFragLoaded=function(c,u){var E=u.frag;if(E!==void 0&&E.type===C.PlaylistLevelType.MAIN){var g=this._levels[E.level];g!==void 0&&(g.fragmentError=0,g.loadError=0)}},r.onLevelLoaded=function(c,u){var E,g=u.level,s=u.details,a=this._levels[g];if(!a){var i;this.warn("Invalid level index "+g),(i=u.deliveryDirectives)!==null&&i!==void 0&&i.skip&&(s.deltaUpdateFailed=!0);return}g===this.currentLevelIndex?(a.fragmentError===0&&(a.loadError=0,this.retryCount=0),this.playlistLoaded(g,u,a.details)):(E=u.deliveryDirectives)!==null&&E!==void 0&&E.skip&&(s.deltaUpdateFailed=!0)},r.onAudioTrackSwitched=function(c,u){var E=this.hls.levels[this.currentLevelIndex];if(!E)return;if(E.audioGroupIds){for(var g=-1,s=this.hls.audioTracks[u.id].groupId,a=0;a<E.audioGroupIds.length;a++)if(E.audioGroupIds[a]===s){g=a;break}g!==E.urlId&&(E.urlId=g,this.startLoad())}},r.loadPlaylist=function(c){var u=this.currentLevelIndex,E=this._levels[u];if(this.canLoad&&E&&E.url.length>0){var g=E.urlId,s=E.url[g];if(c)try{s=c.addDirectives(s)}catch(a){this.warn("Could not construct new URL with HLS Delivery Directives: "+a)}this.log("Attempt loading level index "+u+(c?" at sn "+c.msn+" part "+c.part:"")+" with URL-id "+g+" "+s),this.clearTimer(),this.hls.trigger(D.Events.LEVEL_LOADING,{url:s,level:u,id:g,deliveryDirectives:c||null})}},r.removeLevel=function(c,u){var E=function(a,i){return i!==u},g=this._levels.filter(function(s,a){return a!==c?!0:s.url.length>1&&u!==void 0?(s.url=s.url.filter(E),s.audioGroupIds&&(s.audioGroupIds=s.audioGroupIds.filter(E)),s.textGroupIds&&(s.textGroupIds=s.textGroupIds.filter(E)),s.urlId=0,!0):!1}).map(function(s,a){var i=s.details;return i!=null&&i.fragments&&i.fragments.forEach(function(l){l.level=a}),s});this._levels=g,this.hls.trigger(D.Events.LEVELS_UPDATED,{levels:g})},b(t,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(c){var u,E=this._levels;if(E.length===0)return;if(this.currentLevelIndex===c&&(u=E[c])!==null&&u!==void 0&&u.details)return;if(c<0||c>=E.length){var g=c<0;if(this.hls.trigger(D.Events.ERROR,{type:A.ErrorTypes.OTHER_ERROR,details:A.ErrorDetails.LEVEL_SWITCH_ERROR,level:c,fatal:g,reason:"invalid level idx"}),g)return;c=Math.min(c,E.length-1)}this.clearTimer();var s=this.currentLevelIndex,a=E[s],i=E[c];this.log("switching to level "+c+" from "+s),this.currentLevelIndex=c;var l=d({},i,{level:c,maxBitrate:i.maxBitrate,uri:i.uri,urlId:i.urlId});delete l._urlId,this.hls.trigger(D.Events.LEVEL_SWITCHING,l);var T=i.details;if(!T||T.live){var x=this.switchParams(i.uri,a==null?void 0:a.details);this.loadPlaylist(x)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(c){this.manualLevelIndex=c,this._startLevel===void 0&&(this._startLevel=c),c!==-1&&(this.level=c)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(c){this._firstLevel=c}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var c=this.hls.config.startLevel;return c!==void 0?c:this._firstLevel}else return this._startLevel},set:function(c){this._startLevel=c}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(c){this.level=c,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=c)}}]),t}(S.default)},"./src/controller/level-helper.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"addGroupId",function(){return A}),w.d(B,"assignTrackIdsByGroup",function(){return N}),w.d(B,"updatePTS",function(){return k}),w.d(B,"updateFragPTSDTS",function(){return C}),w.d(B,"mergeDetails",function(){return d}),w.d(B,"mapPartIntersection",function(){return v}),w.d(B,"mapFragmentIntersection",function(){return b}),w.d(B,"adjustSliding",function(){return p}),w.d(B,"addSliding",function(){return m}),w.d(B,"computeReloadInterval",function(){return y}),w.d(B,"getFragmentWithSN",function(){return n}),w.d(B,"getPartWith",function(){return e});var _=w("./src/polyfills/number.ts"),D=w("./src/utils/logger.ts");function A(t,r,f){switch(r){case"audio":t.audioGroupIds||(t.audioGroupIds=[]),t.audioGroupIds.push(f);break;case"text":t.textGroupIds||(t.textGroupIds=[]),t.textGroupIds.push(f);break}}function N(t){var r={};t.forEach(function(f){var c=f.groupId||"";f.id=r[c]=r[c]||0,r[c]++})}function k(t,r,f){var c=t[r],u=t[f];S(c,u)}function S(t,r){var f=r.startPTS;if(Object(_.isFiniteNumber)(f)){var c=0,u;r.sn>t.sn?(c=f-t.start,u=t):(c=t.start-f,u=r),u.duration!==c&&(u.duration=c)}else if(r.sn>t.sn){var E=t.cc===r.cc;E&&t.minEndPTS?r.start=t.start+(t.minEndPTS-t.start):r.start=t.start+t.duration}else r.start=Math.max(t.start-r.duration,0)}function C(t,r,f,c,u,E){var g=c-f;g<=0&&(D.logger.warn("Fragment should have a positive duration",r),c=f+r.duration,E=u+r.duration);var s=f,a=c,i=r.startPTS,l=r.endPTS;if(Object(_.isFiniteNumber)(i)){var T=Math.abs(i-f);Object(_.isFiniteNumber)(r.deltaPTS)?r.deltaPTS=Math.max(T,r.deltaPTS):r.deltaPTS=T,s=Math.max(f,i),f=Math.min(f,i),u=Math.min(u,r.startDTS),a=Math.min(c,l),c=Math.max(c,l),E=Math.max(E,r.endDTS)}r.duration=c-f;var x=f-r.start;r.appendedPTS=c,r.start=r.startPTS=f,r.maxStartPTS=s,r.startDTS=u,r.endPTS=c,r.minEndPTS=a,r.endDTS=E;var L=r.sn;if(!t||L<t.startSN||L>t.endSN)return 0;var R,I=L-t.startSN,F=t.fragments;for(F[I]=r,R=I;R>0;R--)S(F[R],F[R-1]);for(R=I;R<F.length-1;R++)S(F[R],F[R+1]);return t.fragmentHint&&S(F[F.length-1],t.fragmentHint),t.PTSKnown=t.alignedSliding=!0,x}function d(t,r){for(var f=null,c=t.fragments,u=c.length-1;u>=0;u--){var E=c[u].initSegment;if(E){f=E;break}}t.fragmentHint&&delete t.fragmentHint.endPTS;var g=0,s;if(b(t,r,function(R,I){R.relurl&&(g=R.cc-I.cc),Object(_.isFiniteNumber)(R.startPTS)&&Object(_.isFiniteNumber)(R.endPTS)&&(I.start=I.startPTS=R.startPTS,I.startDTS=R.startDTS,I.appendedPTS=R.appendedPTS,I.maxStartPTS=R.maxStartPTS,I.endPTS=R.endPTS,I.endDTS=R.endDTS,I.minEndPTS=R.minEndPTS,I.duration=R.endPTS-R.startPTS,I.duration&&(s=I),r.PTSKnown=r.alignedSliding=!0),I.elementaryStreams=R.elementaryStreams,I.loader=R.loader,I.stats=R.stats,I.urlId=R.urlId,R.initSegment&&(I.initSegment=R.initSegment,f=R.initSegment)}),f){var a=r.fragmentHint?r.fragments.concat(r.fragmentHint):r.fragments;a.forEach(function(R){var I;(!R.initSegment||R.initSegment.relurl===((I=f)===null||I===void 0?void 0:I.relurl))&&(R.initSegment=f)})}if(r.skippedSegments&&(r.deltaUpdateFailed=r.fragments.some(function(R){return!R}),r.deltaUpdateFailed)){D.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var i=r.skippedSegments;i--;)r.fragments.shift();r.startSN=r.fragments[0].sn,r.startCC=r.fragments[0].cc}var l=r.fragments;if(g){D.logger.warn("discontinuity sliding from playlist, take drift into account");for(var T=0;T<l.length;T++)l[T].cc+=g}r.skippedSegments&&(r.startCC=r.fragments[0].cc),v(t.partList,r.partList,function(R,I){I.elementaryStreams=R.elementaryStreams,I.stats=R.stats}),s?C(r,s,s.startPTS,s.endPTS,s.startDTS,s.endDTS):p(t,r),l.length&&(r.totalduration=r.edge-l[0].start),r.driftStartTime=t.driftStartTime,r.driftStart=t.driftStart;var x=r.advancedDateTime;if(r.advanced&&x){var L=r.edge;r.driftStart||(r.driftStartTime=x,r.driftStart=L),r.driftEndTime=x,r.driftEnd=L}else r.driftEndTime=t.driftEndTime,r.driftEnd=t.driftEnd,r.advancedDateTime=t.advancedDateTime}function v(t,r,f){if(t&&r)for(var c=0,u=0,E=t.length;u<=E;u++){var g=t[u],s=r[u+c];g&&s&&g.index===s.index&&g.fragment.sn===s.fragment.sn?f(g,s):c--}}function b(t,r,f){for(var c=r.skippedSegments,u=Math.max(t.startSN,r.startSN)-r.startSN,E=(t.fragmentHint?1:0)+(c?r.endSN:Math.min(t.endSN,r.endSN))-r.startSN,g=r.startSN-t.startSN,s=r.fragmentHint?r.fragments.concat(r.fragmentHint):r.fragments,a=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,i=u;i<=E;i++){var l=a[g+i],T=s[i];c&&!T&&i<c&&(T=r.fragments[i]=l),l&&T&&f(l,T)}}function p(t,r){var f=r.startSN+r.skippedSegments-t.startSN,c=t.fragments;if(f<0||f>=c.length)return;m(r,c[f].start)}function m(t,r){if(r){for(var f=t.fragments,c=t.skippedSegments;c<f.length;c++)f[c].start+=r;t.fragmentHint&&(t.fragmentHint.start+=r)}}function y(t,r){var f=1e3*t.levelTargetDuration,c=f/2,u=t.age,E=u>0&&u<f*3,g=r.loading.end-r.loading.start,s,a=t.availabilityDelay;if(t.updated===!1)if(E){var i=333*t.misses;s=Math.max(Math.min(c,g*2),i),t.availabilityDelay=(t.availabilityDelay||0)+s}else s=c;else E?(a=Math.min(a||f/2,u),t.availabilityDelay=a,s=a+f-u):s=f-g;return Math.round(s)}function n(t,r,f){if(!t||!t.details)return null;var c=t.details,u=c.fragments[r-c.startSN];return u||(u=c.fragmentHint,u&&u.sn===r?u:r<c.startSN&&f&&f.sn===r?f:null)}function e(t,r,f){if(!t||!t.details)return null;var c=t.details.partList;if(c)for(var u=c.length;u--;){var E=c[u];if(E.index===f&&E.fragment.sn===r)return E}return null}},"./src/controller/stream-controller.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"default",function(){return c});var _=w("./src/polyfills/number.ts"),D=w("./src/controller/base-stream-controller.ts"),A=w("./src/is-supported.ts"),N=w("./src/events.ts"),k=w("./src/utils/buffer-helper.ts"),S=w("./src/controller/fragment-tracker.ts"),C=w("./src/types/loader.ts"),d=w("./src/loader/fragment.ts"),v=w("./src/demux/transmuxer-interface.ts"),b=w("./src/types/transmuxer.ts"),p=w("./src/controller/gap-controller.ts"),m=w("./src/errors.ts"),y=w("./src/utils/logger.ts");function n(u,E){for(var g=0;g<E.length;g++){var s=E[g];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(u,s.key,s)}}function e(u,E,g){return E&&n(u.prototype,E),g&&n(u,g),u}function t(u,E){u.prototype=Object.create(E.prototype),u.prototype.constructor=u,r(u,E)}function r(u,E){return r=Object.setPrototypeOf||function(s,a){return s.__proto__=a,s},r(u,E)}var f=100,c=function(u){t(E,u);function E(s,a){var i;return i=u.call(this,s,a,"[stream-controller]")||this,i.audioCodecSwap=!1,i.gapController=null,i.level=-1,i._forceStartLoad=!1,i.altAudio=!1,i.audioOnly=!1,i.fragPlaying=null,i.onvplaying=null,i.onvseeked=null,i.fragLastKbps=0,i.stalled=!1,i.couldBacktrack=!1,i.audioCodecSwitch=!1,i.videoBuffer=null,i._registerListeners(),i}var g=E.prototype;return g._registerListeners=function(){var a=this.hls;a.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(N.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),a.on(N.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),a.on(N.Events.ERROR,this.onError,this),a.on(N.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),a.on(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),a.on(N.Events.BUFFER_CREATED,this.onBufferCreated,this),a.on(N.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),a.on(N.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),a.on(N.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g._unregisterListeners=function(){var a=this.hls;a.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),a.off(N.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),a.off(N.Events.ERROR,this.onError,this),a.off(N.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),a.off(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),a.off(N.Events.BUFFER_CREATED,this.onBufferCreated,this),a.off(N.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),a.off(N.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),a.off(N.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},g.startLoad=function(a){if(this.levels){var i=this.lastCurrentTime,l=this.hls;if(this.stopLoad(),this.setInterval(f),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var T=l.startLevel;T===-1&&(l.config.testBandwidth?(T=0,this.bitrateTest=!0):T=l.nextAutoLevel),this.level=l.nextLoadLevel=T,this.loadedmetadata=!1}i>0&&a===-1&&(this.log("Override startPosition with lastCurrentTime @"+i.toFixed(3)),a=i),this.state=D.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=a,this.tick()}else this._forceStartLoad=!0,this.state=D.State.STOPPED},g.stopLoad=function(){this._forceStartLoad=!1,u.prototype.stopLoad.call(this)},g.doTick=function(){switch(this.state){case D.State.IDLE:this.doTickIdle();break;case D.State.WAITING_LEVEL:{var a,i=this.levels,l=this.level,T=i==null||((a=i[l])===null||a===void 0)?void 0:a.details;if(T&&(!T.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(T))break;this.state=D.State.IDLE;break}break}case D.State.FRAG_LOADING_WAITING_RETRY:{var x,L=self.performance.now(),R=this.retryDate;(!R||L>=R||(x=this.media)!==null&&x!==void 0&&x.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=D.State.IDLE)}break;default:break}this.onTickEnd()},g.onTickEnd=function(){u.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},g.doTickIdle=function(){var a,i,l=this.hls,T=this.levelLastLoaded,x=this.levels,L=this.media,R=l.config,I=l.nextLoadLevel;if(T===null||!L&&(this.startFragRequested||!R.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!x||!x[I])return;var F=x[I];this.level=l.nextLoadLevel=I;var j=F.details;if(!j||this.state===D.State.WAITING_LEVEL||j.live&&this.levelLastLoaded!==I){this.state=D.State.WAITING_LEVEL;return}var z=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:L,C.PlaylistLevelType.MAIN);if(z===null)return;var Q=z.len,J=this.getMaxBufferLength(F.maxBitrate);if(Q>=J)return;if(this._streamEnded(z,j)){var ie={};this.altAudio&&(ie.type="video"),this.hls.trigger(N.Events.BUFFER_EOS,ie),this.state=D.State.ENDED;return}var pe=z.end,ce=this.getNextFragment(pe,j);if(this.couldBacktrack&&!this.fragPrevious&&ce&&ce.sn!=="initSegment"){var ye=ce.sn-j.startSN;ye>1&&(ce=j.fragments[ye-1],this.fragmentTracker.removeFragment(ce))}if(ce&&this.fragmentTracker.getState(ce)===S.FragmentState.OK&&this.nextLoadPosition>pe){var ve=this.audioOnly&&!this.altAudio?d.ElementaryStreamTypes.AUDIO:d.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(L,ve,C.PlaylistLevelType.MAIN),ce=this.getNextFragment(this.nextLoadPosition,j)}if(!ce)return;ce.initSegment&&!ce.initSegment.data&&!this.bitrateTest&&(ce=ce.initSegment),((a=ce.decryptdata)===null||a===void 0?void 0:a.keyFormat)==="identity"&&!((i=ce.decryptdata)!==null&&i!==void 0&&i.key)?this.loadKey(ce,j):this.loadFragment(ce,j,pe)},g.loadFragment=function(a,i,l){var T,x=this.fragmentTracker.getState(a);if(this.fragCurrent=a,x===S.FragmentState.BACKTRACKED){var L=this.fragmentTracker.getBacktrackData(a);if(L){this._handleFragmentLoadProgress(L),this._handleFragmentLoadComplete(L);return}else x=S.FragmentState.NOT_LOADED}x===S.FragmentState.NOT_LOADED||x===S.FragmentState.PARTIAL?a.sn==="initSegment"?this._loadInitSegment(a):this.bitrateTest?(a.bitrateTest=!0,this.log("Fragment "+a.sn+" of level "+a.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(a)):(this.startFragRequested=!0,u.prototype.loadFragment.call(this,a,i,l)):x===S.FragmentState.APPENDING?this.reduceMaxBufferLength(a.duration)&&this.fragmentTracker.removeFragment(a):((T=this.media)===null||T===void 0?void 0:T.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},g.getAppendedFrag=function(a){var i=this.fragmentTracker.getAppendedFrag(a,C.PlaylistLevelType.MAIN);return i&&"fragment"in i?i.fragment:i},g.getBufferedFrag=function(a){return this.fragmentTracker.getBufferedFrag(a,C.PlaylistLevelType.MAIN)},g.followingBufferedFrag=function(a){return a?this.getBufferedFrag(a.end+.5):null},g.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},g.nextLevelSwitch=function(){var a=this.levels,i=this.media;if(i!=null&&i.readyState){var l,T=this.getAppendedFrag(i.currentTime);if(T&&T.start>1&&this.flushMainBuffer(0,T.start-1),!i.paused&&a){var x=this.hls.nextLoadLevel,L=a[x],R=this.fragLastKbps;R&&this.fragCurrent?l=this.fragCurrent.duration*L.maxBitrate/(1e3*R)+1:l=0}else l=0;var I=this.getBufferedFrag(i.currentTime+l);if(I){var F=this.followingBufferedFrag(I);if(F){this.abortCurrentFrag();var j=F.maxStartPTS?F.maxStartPTS:F.start,z=F.duration,Q=Math.max(I.end,j+Math.min(Math.max(z-this.config.maxFragLookUpTolerance,z*.5),z*.75));this.flushMainBuffer(Q,Number.POSITIVE_INFINITY)}}}},g.abortCurrentFrag=function(){var a=this.fragCurrent;this.fragCurrent=null,a!=null&&a.loader&&a.loader.abort(),this.state===D.State.KEY_LOADING&&(this.state=D.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},g.flushMainBuffer=function(a,i){u.prototype.flushMainBuffer.call(this,a,i,this.altAudio?"video":null)},g.onMediaAttached=function(a,i){u.prototype.onMediaAttached.call(this,a,i);var l=i.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),l.addEventListener("playing",this.onvplaying),l.addEventListener("seeked",this.onvseeked),this.gapController=new p.default(this.config,l,this.fragmentTracker,this.hls)},g.onMediaDetaching=function(){var a=this.media;a&&(a.removeEventListener("playing",this.onvplaying),a.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),u.prototype.onMediaDetaching.call(this)},g.onMediaPlaying=function(){this.tick()},g.onMediaSeeked=function(){var a=this.media,i=a?a.currentTime:null;Object(_.isFiniteNumber)(i)&&this.log("Media seeked to "+i.toFixed(3)),this.tick()},g.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(N.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},g.onManifestParsed=function(a,i){var l=!1,T=!1,x;i.levels.forEach(function(L){x=L.audioCodec,x&&(x.indexOf("mp4a.40.2")!==-1&&(l=!0),x.indexOf("mp4a.40.5")!==-1&&(T=!0))}),this.audioCodecSwitch=l&&T&&!Object(A.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=i.levels,this.startFragRequested=!1},g.onLevelLoading=function(a,i){var l=this.levels;if(!l||this.state!==D.State.IDLE)return;var T=l[i.level];(!T.details||T.details.live&&this.levelLastLoaded!==i.level||this.waitForCdnTuneIn(T.details))&&(this.state=D.State.WAITING_LEVEL)},g.onLevelLoaded=function(a,i){var l,T=this.levels,x=i.level,L=i.details,R=L.totalduration;if(!T){this.warn("Levels were reset while loading level "+x);return}this.log("Level "+x+" loaded ["+L.startSN+","+L.endSN+"], cc ["+L.startCC+", "+L.endCC+"] duration:"+R);var I=this.fragCurrent;I&&(this.state===D.State.FRAG_LOADING||this.state===D.State.FRAG_LOADING_WAITING_RETRY)&&(I.level!==i.level&&I.loader&&(this.state=D.State.IDLE,I.loader.abort()));var F=T[x],j=0;if(L.live||(l=F.details)!==null&&l!==void 0&&l.live){if(L.fragments[0]||(L.deltaUpdateFailed=!0),L.deltaUpdateFailed)return;j=this.alignPlaylists(L,F.details)}if(F.details=L,this.levelLastLoaded=x,this.hls.trigger(N.Events.LEVEL_UPDATED,{details:L,level:x}),this.state===D.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(L))return;this.state=D.State.IDLE}this.startFragRequested?L.live&&this.synchronizeToLiveEdge(L):this.setStartPosition(L,j),this.tick()},g._handleFragmentLoadProgress=function(a){var i,l=a.frag,T=a.part,x=a.payload,L=this.levels;if(!L){this.warn("Levels were reset while fragment load was in progress. Fragment "+l.sn+" of level "+l.level+" will not be buffered");return}var R=L[l.level],I=R.details;if(!I){this.warn("Dropping fragment "+l.sn+" of level "+l.level+" after level details were reset");return}var F=R.videoCodec,j=I.PTSKnown||!I.live,z=(i=l.initSegment)===null||i===void 0?void 0:i.data,Q=this._getAudioCodec(R),J=this.transmuxer=this.transmuxer||new v.default(this.hls,C.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ie=T?T.index:-1,pe=ie!==-1,ce=new b.ChunkMetadata(l.level,l.sn,l.stats.chunkCount,x.byteLength,ie,pe),ye=this.initPTS[l.cc];J.push(x,z,Q,F,l,T,I.totalduration,j,ce,ye)},g.onAudioTrackSwitching=function(a,i){var l=this.altAudio,T=!!i.url,x=i.id;if(!T){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var L=this.fragCurrent;L!=null&&L.loader&&(this.log("Switching to main audio track, cancel main fragment load"),L.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var R=this.hls;l&&R.trigger(N.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),R.trigger(N.Events.AUDIO_TRACK_SWITCHED,{id:x})}},g.onAudioTrackSwitched=function(a,i){var l=i.id,T=!!this.hls.audioTracks[l].url;if(T){var x=this.videoBuffer;x&&this.mediaBuffer!==x&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=x)}this.altAudio=T,this.tick()},g.onBufferCreated=function(a,i){var l=i.tracks,T,x,L=!1;for(var R in l){var I=l[R];if(I.id==="main"){if(x=R,T=I,R==="video"){var F=l[R];F&&(this.videoBuffer=F.buffer)}}else L=!0}L&&T?(this.log("Alternate track found, use "+x+".buffered to schedule main fragment loading"),this.mediaBuffer=T.buffer):this.mediaBuffer=this.media},g.onFragBuffered=function(a,i){var l=i.frag,T=i.part;if(l&&l.type!==C.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(l)){this.warn("Fragment "+l.sn+(T?" p: "+T.index:"")+" of level "+l.level+" finished buffering, but was aborted. state: "+this.state),this.state===D.State.PARSED&&(this.state=D.State.IDLE);return}var x=T?T.stats:l.stats;this.fragLastKbps=Math.round(8*x.total/(x.buffering.end-x.loading.first)),l.sn!=="initSegment"&&(this.fragPrevious=l),this.fragBufferedComplete(l,T)},g.onError=function(a,i){switch(i.details){case m.ErrorDetails.FRAG_LOAD_ERROR:case m.ErrorDetails.FRAG_LOAD_TIMEOUT:case m.ErrorDetails.KEY_LOAD_ERROR:case m.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(C.PlaylistLevelType.MAIN,i);break;case m.ErrorDetails.LEVEL_LOAD_ERROR:case m.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==D.State.ERROR&&(i.fatal?(this.warn(""+i.details),this.state=D.State.ERROR):!i.levelRetry&&this.state===D.State.WAITING_LEVEL&&(this.state=D.State.IDLE));break;case m.ErrorDetails.BUFFER_FULL_ERROR:if(i.parent==="main"&&(this.state===D.State.PARSING||this.state===D.State.PARSED)){var l=!0,T=this.getFwdBufferInfo(this.media,C.PlaylistLevelType.MAIN);T&&T.len>.5&&(l=!this.reduceMaxBufferLength(T.len)),l&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},g.checkBuffer=function(){var a=this.media,i=this.gapController;if(!a||!i||!a.readyState)return;var l=k.BufferHelper.getBuffered(a);!this.loadedmetadata&&l.length?(this.loadedmetadata=!0,this.seekToStartPos()):i.poll(this.lastCurrentTime),this.lastCurrentTime=a.currentTime},g.onFragLoadEmergencyAborted=function(){this.state=D.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},g.onBufferFlushed=function(a,i){var l=i.type;if(l!==d.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var T=(l===d.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(T,l,C.PlaylistLevelType.MAIN)}},g.onLevelsUpdated=function(a,i){this.levels=i.levels},g.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},g.seekToStartPos=function(){var a=this.media,i=a.currentTime,l=this.startPosition;if(l>=0&&i<l){if(a.seeking){y.logger.log("could not seek to "+l+", already seeking at "+i);return}var T=k.BufferHelper.getBuffered(a),x=T.length?T.start(0):0,L=x-l;L>0&&(L<this.config.maxBufferHole||L<this.config.maxFragLookUpTolerance)&&(y.logger.log("adjusting start position by "+L+" to match buffer start"),l+=L,this.startPosition=l),this.log("seek to target start position "+l+" from current time "+i),a.currentTime=l}},g._getAudioCodec=function(a){var i=this.config.defaultAudioCodec||a.audioCodec;return this.audioCodecSwap&&i&&(this.log("Swapping audio codec"),i.indexOf("mp4a.40.5")!==-1?i="mp4a.40.2":i="mp4a.40.5"),i},g._loadBitrateTestFrag=function(a){var i=this;this._doFragLoad(a).then(function(l){var T=i.hls;if(!l||T.nextLoadLevel||i.fragContextChanged(a))return;i.fragLoadError=0,i.state=D.State.IDLE,i.startFragRequested=!1,i.bitrateTest=!1;var x=a.stats;x.parsing.start=x.parsing.end=x.buffering.start=x.buffering.end=self.performance.now(),T.trigger(N.Events.FRAG_LOADED,l)})},g._handleTransmuxComplete=function(a){var i,l="main",T=this.hls,x=a.remuxResult,L=a.chunkMeta,R=this.getCurrentContext(L);if(!R){this.warn("The loading context changed while buffering fragment "+L.sn+" of level "+L.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(L.level);return}var I=R.frag,F=R.part,j=R.level,z=x.video,Q=x.text,J=x.id3,ie=x.initSegment,pe=this.altAudio?void 0:x.audio;if(this.fragContextChanged(I))return;if(this.state=D.State.PARSING,ie){ie.tracks&&(this._bufferInitSegment(j,ie.tracks,I,L),T.trigger(N.Events.FRAG_PARSING_INIT_SEGMENT,{frag:I,id:l,tracks:ie.tracks}));var ce=ie.initPTS,ye=ie.timescale;Object(_.isFiniteNumber)(ce)&&(this.initPTS[I.cc]=ce,T.trigger(N.Events.INIT_PTS_FOUND,{frag:I,id:l,initPTS:ce,timescale:ye}))}if(z&&x.independent!==!1){if(j.details){var ve=z.startPTS,Z=z.endPTS,q=z.startDTS,se=z.endDTS;if(F)F.elementaryStreams[z.type]={startPTS:ve,endPTS:Z,startDTS:q,endDTS:se};else if(z.firstKeyFrame&&z.independent&&(this.couldBacktrack=!0),z.dropped&&z.independent){var V=this.getLoadPosition()+this.config.maxBufferHole;if(V<ve){this.backtrack(I);return}I.setElementaryStreamInfo(z.type,I.start,Z,I.start,se,!0)}I.setElementaryStreamInfo(z.type,ve,Z,q,se),this.bufferFragmentData(z,I,F,L)}}else if(x.independent===!1){this.backtrack(I);return}if(pe){var G=pe.startPTS,be=pe.endPTS,Re=pe.startDTS,De=pe.endDTS;F&&(F.elementaryStreams[d.ElementaryStreamTypes.AUDIO]={startPTS:G,endPTS:be,startDTS:Re,endDTS:De}),I.setElementaryStreamInfo(d.ElementaryStreamTypes.AUDIO,G,be,Re,De),this.bufferFragmentData(pe,I,F,L)}if(J!=null&&(i=J.samples)!==null&&i!==void 0&&i.length){var Me={frag:I,id:l,samples:J.samples};T.trigger(N.Events.FRAG_PARSING_METADATA,Me)}if(Q){var X={frag:I,id:l,samples:Q.samples};T.trigger(N.Events.FRAG_PARSING_USERDATA,X)}},g._bufferInitSegment=function(a,i,l,T){var x=this;if(this.state!==D.State.PARSING)return;this.audioOnly=!!i.audio&&!i.video,this.altAudio&&!this.audioOnly&&delete i.audio;var L=i.audio,R=i.video,I=i.audiovideo;if(L){var F=a.audioCodec,j=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(F&&(F.indexOf("mp4a.40.5")!==-1?F="mp4a.40.2":F="mp4a.40.5"),L.metadata.channelCount!==1&&j.indexOf("firefox")===-1&&(F="mp4a.40.5")),j.indexOf("android")!==-1&&L.container!=="audio/mpeg"&&(F="mp4a.40.2",this.log("Android: force audio codec to "+F)),a.audioCodec&&a.audioCodec!==F&&this.log('Swapping manifest audio codec "'+a.audioCodec+'" for "'+F+'"'),L.levelCodec=F,L.id="main",this.log("Init audio buffer, container:"+L.container+", codecs[selected/level/parsed]=["+(F||"")+"/"+(a.audioCodec||"")+"/"+L.codec+"]")}R&&(R.levelCodec=a.videoCodec,R.id="main",this.log("Init video buffer, container:"+R.container+", codecs[level/parsed]=["+(a.videoCodec||"")+"/"+R.codec+"]")),I&&this.log("Init audiovideo buffer, container:"+I.container+", codecs[level/parsed]=["+(a.attrs.CODECS||"")+"/"+I.codec+"]"),this.hls.trigger(N.Events.BUFFER_CODECS,i),Object.keys(i).forEach(function(z){var Q=i[z],J=Q.initSegment;J!=null&&J.byteLength&&x.hls.trigger(N.Events.BUFFER_APPENDING,{type:z,data:J,frag:l,part:null,chunkMeta:T,parent:l.type})}),this.tick()},g.backtrack=function(a){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(a);var i=this.fragmentTracker.backtrack(a);this.fragPrevious=null,this.nextLoadPosition=a.start,i?this.resetFragmentLoading(a):this.state=D.State.BACKTRACKING},g.checkFragmentChanged=function(){var a=this.media,i=null;if(a&&a.readyState>1&&a.seeking===!1){var l=a.currentTime;if(k.BufferHelper.isBuffered(a,l)?i=this.getAppendedFrag(l):k.BufferHelper.isBuffered(a,l+.1)&&(i=this.getAppendedFrag(l+.1)),i){var T=this.fragPlaying,x=i.level;(!T||i.sn!==T.sn||T.level!==x||i.urlId!==T.urlId)&&(this.hls.trigger(N.Events.FRAG_CHANGED,{frag:i}),(!T||T.level!==x)&&this.hls.trigger(N.Events.LEVEL_SWITCHED,{level:x}),this.fragPlaying=i)}}},e(E,[{key:"nextLevel",get:function(){var a=this.nextBufferedFrag;return a?a.level:-1}},{key:"currentLevel",get:function(){var a=this.media;if(a){var i=this.getAppendedFrag(a.currentTime);if(i)return i.level}return-1}},{key:"nextBufferedFrag",get:function(){var a=this.media;if(a){var i=this.getAppendedFrag(a.currentTime);return this.followingBufferedFrag(i)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),E}(D.default)},"./src/controller/subtitle-stream-controller.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"SubtitleStreamController",function(){return t});var _=w("./src/events.ts"),D=w("./src/utils/logger.ts"),A=w("./src/utils/buffer-helper.ts"),N=w("./src/controller/fragment-finders.ts"),k=w("./src/utils/discontinuities.ts"),S=w("./src/controller/level-helper.ts"),C=w("./src/controller/fragment-tracker.ts"),d=w("./src/controller/base-stream-controller.ts"),v=w("./src/types/loader.ts"),b=w("./src/types/level.ts");function p(r,f){for(var c=0;c<f.length;c++){var u=f[c];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(r,u.key,u)}}function m(r,f,c){return f&&p(r.prototype,f),c&&p(r,c),r}function y(r,f){r.prototype=Object.create(f.prototype),r.prototype.constructor=r,n(r,f)}function n(r,f){return n=Object.setPrototypeOf||function(u,E){return u.__proto__=E,u},n(r,f)}var e=500,t=function(r){y(f,r);function f(u,E){var g;return g=r.call(this,u,E,"[subtitle-stream-controller]")||this,g.levels=[],g.currentTrackId=-1,g.tracksBuffered=[],g.mainDetails=null,g._registerListeners(),g}var c=f.prototype;return c.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},c._registerListeners=function(){var E=this.hls;E.on(_.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.on(_.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.on(_.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.on(_.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.on(_.Events.ERROR,this.onError,this),E.on(_.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),E.on(_.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),E.on(_.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),E.on(_.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),E.on(_.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},c._unregisterListeners=function(){var E=this.hls;E.off(_.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.off(_.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.off(_.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.off(_.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.off(_.Events.ERROR,this.onError,this),E.off(_.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),E.off(_.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),E.off(_.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),E.off(_.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),E.off(_.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},c.startLoad=function(){this.stopLoad(),this.state=d.State.IDLE,this.setInterval(e),this.tick()},c.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},c.onLevelLoaded=function(E,g){this.mainDetails=g.details},c.onSubtitleFragProcessed=function(E,g){var s=g.frag,a=g.success;if(this.fragPrevious=s,this.state=d.State.IDLE,!a)return;var i=this.tracksBuffered[this.currentTrackId];if(!i)return;for(var l,T=s.start,x=0;x<i.length;x++)if(T>=i[x].start&&T<=i[x].end){l=i[x];break}var L=s.start+s.duration;l?l.end=L:(l={start:T,end:L},i.push(l)),this.fragmentTracker.fragBuffered(s)},c.onBufferFlushing=function(E,g){var s=g.startOffset,a=g.endOffset;if(s===0&&a!==Number.POSITIVE_INFINITY){var i=this.currentTrackId,l=this.levels;if(!l.length||!l[i]||!l[i].details)return;var T=l[i].details,x=T.targetduration,L=a-x;if(L<=0)return;g.endOffsetSubtitles=Math.max(0,L),this.tracksBuffered.forEach(function(R){for(var I=0;I<R.length;){if(R[I].end<=L){R.shift();continue}else if(R[I].start<L)R[I].start=L;else break;I++}}),this.fragmentTracker.removeFragmentsInRange(s,L,v.PlaylistLevelType.SUBTITLE)}},c.onError=function(E,g){var s,a=g.frag;if(!a||a.type!==v.PlaylistLevelType.SUBTITLE)return;(s=this.fragCurrent)!==null&&s!==void 0&&s.loader&&this.fragCurrent.loader.abort(),this.state=d.State.IDLE},c.onSubtitleTracksUpdated=function(E,g){var s=this,a=g.subtitleTracks;this.tracksBuffered=[],this.levels=a.map(function(i){return new b.Level(i)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(i){s.tracksBuffered[i.id]=[]}),this.mediaBuffer=null},c.onSubtitleTrackSwitch=function(E,g){if(this.currentTrackId=g.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var s=this.levels[this.currentTrackId];s!=null&&s.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,s&&this.setInterval(e)},c.onSubtitleTrackLoaded=function(E,g){var s,a=g.details,i=g.id,l=this.currentTrackId,T=this.levels;if(!T.length)return;var x=T[l];if(i>=T.length||i!==l||!x)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,a.live||(s=x.details)!==null&&s!==void 0&&s.live){var L=this.mainDetails;if(a.deltaUpdateFailed||!L)return;var R=L.fragments[0];if(!x.details)a.hasProgramDateTime&&L.hasProgramDateTime?Object(k.alignMediaPlaylistByPDT)(a,L):R&&Object(S.addSliding)(a,R.start);else{var I=this.alignPlaylists(a,x.details);I===0&&R&&Object(S.addSliding)(a,R.start)}}if(x.details=a,this.levelLastLoaded=i,this.tick(),a.live&&!this.fragCurrent&&this.media&&this.state===d.State.IDLE){var F=Object(N.findFragmentByPTS)(null,a.fragments,this.media.currentTime,0);F||(this.warn("Subtitle playlist not aligned with playback"),x.details=void 0)}},c._handleFragmentLoadComplete=function(E){var g=E.frag,s=E.payload,a=g.decryptdata,i=this.hls;if(this.fragContextChanged(g))return;if(s&&s.byteLength>0&&a&&a.key&&a.iv&&a.method==="AES-128"){var l=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(s),a.key.buffer,a.iv.buffer).then(function(T){var x=performance.now();i.trigger(_.Events.FRAG_DECRYPTED,{frag:g,payload:T,stats:{tstart:l,tdecrypt:x}})})}},c.doTick=function(){if(!this.media){this.state=d.State.IDLE;return}if(this.state===d.State.IDLE){var E,g=this.currentTrackId,s=this.levels;if(!s.length||!s[g]||!s[g].details)return;var a=s[g].details,i=a.targetduration,l=this.config,T=this.media,x=A.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,T.currentTime-i,l.maxBufferHole),L=x.end,R=x.len,I=this.getMaxBufferLength()+i;if(R>I)return;console.assert(a,"Subtitle track details are defined on idle subtitle stream controller tick");var F=a.fragments,j=F.length,z=a.edge,Q,J=this.fragPrevious;if(L<z){var ie=l.maxFragLookUpTolerance;J&&a.hasProgramDateTime&&(Q=Object(N.findFragmentByPDT)(F,J.endProgramDateTime,ie)),Q||(Q=Object(N.findFragmentByPTS)(J,F,L,ie),!Q&&J&&J.start<F[0].start&&(Q=F[0]))}else Q=F[j-1];(E=Q)!==null&&E!==void 0&&E.encrypted?(D.logger.log("Loading key for "+Q.sn),this.state=d.State.KEY_LOADING,this.hls.trigger(_.Events.KEY_LOADING,{frag:Q})):Q&&this.fragmentTracker.getState(Q)===C.FragmentState.NOT_LOADED&&this.loadFragment(Q,a,L)}},c.loadFragment=function(E,g,s){this.fragCurrent=E,r.prototype.loadFragment.call(this,E,g,s)},m(f,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),f}(d.default)},"./src/controller/subtitle-track-controller.ts":function(ue,B,w){"use strict";w.r(B);var _=w("./src/events.ts"),D=w("./src/utils/texttrack-utils.ts"),A=w("./src/controller/base-playlist-controller.ts"),N=w("./src/types/loader.ts");function k(p,m){for(var y=0;y<m.length;y++){var n=m[y];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(p,n.key,n)}}function S(p,m,y){return m&&k(p.prototype,m),y&&k(p,y),p}function C(p,m){p.prototype=Object.create(m.prototype),p.prototype.constructor=p,d(p,m)}function d(p,m){return d=Object.setPrototypeOf||function(n,e){return n.__proto__=e,n},d(p,m)}var v=function(p){C(m,p);function m(n){var e;return e=p.call(this,n,"[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 y=m.prototype;return y.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,p.prototype.destroy.call(this)},y.registerListeners=function(){var e=this.hls;e.on(_.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(_.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(_.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(_.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){var e=this.hls;e.off(_.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(_.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(_.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(_.Events.ERROR,this.onError,this)},y.onMediaAttached=function(e,t){if(this.media=t.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)},y.pollTrackChange=function(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,e)},y.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=b(this.media.textTracks);e.forEach(function(t){Object(D.clearCurrentCues)(t)}),this.subtitleTrack=-1,this.media=null},y.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},y.onManifestParsed=function(e,t){this.tracks=t.subtitleTracks},y.onSubtitleTrackLoaded=function(e,t){var r=t.id,f=t.details,c=this.trackId,u=this.tracksInGroup[c];if(!u){this.warn("Invalid subtitle track id "+r);return}var E=u.details;u.details=t.details,this.log("subtitle track "+r+" loaded ["+f.startSN+"-"+f.endSN+"]"),r===this.trackId&&(this.retryCount=0,this.playlistLoaded(r,t,E))},y.onLevelLoading=function(e,t){this.switchLevel(t.level)},y.onLevelSwitching=function(e,t){this.switchLevel(t.level)},y.switchLevel=function(e){var t=this.hls.levels[e];if(!(t!=null&&t.textGroupIds))return;var r=t.textGroupIds[t.urlId];if(this.groupId!==r){var f=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,c=this.tracks.filter(function(g){return!r||g.groupId===r});this.tracksInGroup=c;var u=this.findTrackId(f==null?void 0:f.name)||this.findTrackId();this.groupId=r;var E={subtitleTracks:c};this.log("Updating subtitle tracks, "+c.length+' track(s) found in "'+r+'" group-id'),this.hls.trigger(_.Events.SUBTITLE_TRACKS_UPDATED,E),u!==-1&&this.setSubtitleTrack(u,f)}},y.findTrackId=function(e){for(var t=this.tracksInGroup,r=0;r<t.length;r++){var f=t[r];if((!this.selectDefaultTrack||f.default)&&(!e||e===f.name))return f.id}return-1},y.onError=function(e,t){if(p.prototype.onError.call(this,e,t),t.fatal||!t.context)return;t.context.type===N.PlaylistContextType.SUBTITLE_TRACK&&t.context.id===this.trackId&&t.context.groupId===this.groupId&&this.retryLoadingOrFail(t)},y.loadPlaylist=function(e){var t=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(t)){var r=t.id,f=t.groupId,c=t.url;if(e)try{c=e.addDirectives(c)}catch(u){this.warn("Could not construct new URL with HLS Delivery Directives: "+u)}this.log("Loading subtitle playlist for id "+r),this.hls.trigger(_.Events.SUBTITLE_TRACK_LOADING,{url:c,id:r,groupId:f,deliveryDirectives:e||null})}},y.toggleTrackModes=function(e){var t=this,r=this.media,f=this.subtitleDisplay,c=this.trackId;if(!r)return;var u=b(r.textTracks),E=u.filter(function(a){return a.groupId===t.groupId});if(e===-1)[].slice.call(u).forEach(function(a){a.mode="disabled"});else{var g=E[c];g&&(g.mode="disabled")}var s=E[e];s&&(s.mode=f?"showing":"hidden")},y.setSubtitleTrack=function(e,t){var r,f=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(this.trackId!==e&&this.toggleTrackModes(e),this.trackId===e&&(e===-1||(r=f[e])!==null&&r!==void 0&&r.details)||e<-1||e>=f.length)return;this.clearTimer();var c=f[e];if(this.log("Switching to subtitle track "+e),this.trackId=e,c){var u=c.id,E=c.groupId,g=E===void 0?"":E,s=c.name,a=c.type,i=c.url;this.hls.trigger(_.Events.SUBTITLE_TRACK_SWITCH,{id:u,groupId:g,name:s,type:a,url:i});var l=this.switchParams(c.url,t==null?void 0:t.details);this.loadPlaylist(l)}else this.hls.trigger(_.Events.SUBTITLE_TRACK_SWITCH,{id:e})},y.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var e=-1,t=b(this.media.textTracks),r=0;r<t.length;r++)if(t[r].mode==="hidden")e=r;else if(t[r].mode==="showing"){e=r;break}this.subtitleTrack!==e&&(this.subtitleTrack=e)},S(m,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1;var t=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(e,t)}}]),m}(A.default);function b(p){for(var m=[],y=0;y<p.length;y++){var n=p[y];n.kind==="subtitles"&&n.label&&m.push(p[y])}return m}B.default=v},"./src/controller/timeline-controller.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"TimelineController",function(){return b});var _=w("./src/polyfills/number.ts"),D=w("./src/events.ts"),A=w("./src/utils/cea-608-parser.ts"),N=w("./src/utils/output-filter.ts"),k=w("./src/utils/webvtt-parser.ts"),S=w("./src/utils/texttrack-utils.ts"),C=w("./src/utils/imsc1-ttml-parser.ts"),d=w("./src/types/loader.ts"),v=w("./src/utils/logger.ts"),b=function(){function n(t){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=y(),this.captionsProperties=void 0,this.hls=t,this.config=t.config,this.Cues=t.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var r=new N.default(this,"textTrack1"),f=new N.default(this,"textTrack2"),c=new N.default(this,"textTrack3"),u=new N.default(this,"textTrack4");this.cea608Parser1=new A.default(1,r,f),this.cea608Parser2=new A.default(3,c,u)}t.on(D.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(D.Events.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(D.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(D.Events.FRAG_LOADING,this.onFragLoading,this),t.on(D.Events.FRAG_LOADED,this.onFragLoaded,this),t.on(D.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on(D.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on(D.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(D.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on(D.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var e=n.prototype;return e.destroy=function(){var r=this.hls;r.off(D.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),r.off(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(D.Events.MANIFEST_LOADED,this.onManifestLoaded,this),r.off(D.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),r.off(D.Events.FRAG_LOADING,this.onFragLoading,this),r.off(D.Events.FRAG_LOADED,this.onFragLoaded,this),r.off(D.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),r.off(D.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),r.off(D.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),r.off(D.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),r.off(D.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},e.addCues=function(r,f,c,u,E){for(var g=!1,s=E.length;s--;){var a=E[s],i=m(a[0],a[1],f,c);if(i>=0&&(a[0]=Math.min(a[0],f),a[1]=Math.max(a[1],c),g=!0,i/(c-f)>.5))return}if(g||E.push([f,c]),this.config.renderTextTracksNatively){var l=this.captionsTracks[r];this.Cues.newCue(l,f,c,u)}else{var T=this.Cues.newCue(null,f,c,u);this.hls.trigger(D.Events.CUES_PARSED,{type:"captions",cues:T,track:r})}},e.onInitPtsFound=function(r,f){var c=this,u=f.frag,E=f.id,g=f.initPTS,s=f.timescale,a=this.unparsedVttFrags;E==="main"&&(this.initPTS[u.cc]=g,this.timescale[u.cc]=s),a.length&&(this.unparsedVttFrags=[],a.forEach(function(i){c.onFragLoaded(D.Events.FRAG_LOADED,i)}))},e.getExistingTrack=function(r){var f=this.media;if(f)for(var c=0;c<f.textTracks.length;c++){var u=f.textTracks[c];if(u[r])return u}return null},e.createCaptionsTrack=function(r){this.config.renderTextTracksNatively?this.createNativeTrack(r):this.createNonNativeTrack(r)},e.createNativeTrack=function(r){if(this.captionsTracks[r])return;var f=this.captionsProperties,c=this.captionsTracks,u=this.media,E=f[r],g=E.label,s=E.languageCode,a=this.getExistingTrack(r);if(a)c[r]=a,Object(S.clearCurrentCues)(c[r]),Object(S.sendAddTrackEvent)(c[r],u);else{var i=this.createTextTrack("captions",g,s);i&&(i[r]=!0,c[r]=i)}},e.createNonNativeTrack=function(r){if(this.nonNativeCaptionsTracks[r])return;var f=this.captionsProperties[r];if(!f)return;var c=f.label,u={_id:r,label:c,kind:"captions",default:f.media?!!f.media.default:!1,closedCaptions:f.media};this.nonNativeCaptionsTracks[r]=u,this.hls.trigger(D.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[u]})},e.createTextTrack=function(r,f,c){var u=this.media;return u?u.addTextTrack(r,f,c):void 0},e.onMediaAttaching=function(r,f){this.media=f.media,this._cleanTracks()},e.onMediaDetaching=function(){var r=this.captionsTracks;Object.keys(r).forEach(function(f){Object(S.clearCurrentCues)(r[f]),delete r[f]}),this.nonNativeCaptionsTracks={}},e.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=y(),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 r=this.media;if(!r)return;var f=r.textTracks;if(f)for(var c=0;c<f.length;c++)Object(S.clearCurrentCues)(f[c])},e.onSubtitleTracksUpdated=function(r,f){var c=this;this.textTracks=[];var u=f.subtitleTracks||[],E=u.some(function(i){return i.textCodec===C.IMSC1_CODEC});if(this.config.enableWebVTT||E&&this.config.enableIMSC1){var g=this.tracks&&u&&this.tracks.length===u.length;if(this.tracks=u||[],this.config.renderTextTracksNatively){var s=this.media?this.media.textTracks:[];this.tracks.forEach(function(i,l){var T;if(l<s.length){for(var x=null,L=0;L<s.length;L++)if(p(s[L],i)){x=s[L];break}x&&(T=x)}T?Object(S.clearCurrentCues)(T):(T=c.createTextTrack("subtitles",i.name,i.lang),T&&(T.mode="disabled")),T&&(T.groupId=i.groupId,c.textTracks.push(T))})}else if(!g&&this.tracks&&this.tracks.length){var a=this.tracks.map(function(i){return{label:i.name,kind:i.type.toLowerCase(),default:i.default,subtitleTrack:i}});this.hls.trigger(D.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:a})}}},e.onManifestLoaded=function(r,f){var c=this;this.config.enableCEA708Captions&&f.captions&&f.captions.forEach(function(u){var E=/(?:CC|SERVICE)([1-4])/.exec(u.instreamId);if(!E)return;var g="textTrack"+E[1],s=c.captionsProperties[g];if(!s)return;s.label=u.name,u.lang&&(s.languageCode=u.lang),s.media=u})},e.onFragLoading=function(r,f){var c=this.cea608Parser1,u=this.cea608Parser2,E=this.lastSn,g=this.lastPartIndex;if(!this.enabled||!(c&&u))return;if(f.frag.type===d.PlaylistLevelType.MAIN){var s,a,i=f.frag.sn,l=(s=f==null||((a=f.part)===null||a===void 0)?void 0:a.index)!=null?s:-1;i===E+1||i===E&&l===g+1||(c.reset(),u.reset()),this.lastSn=i,this.lastPartIndex=l}},e.onFragLoaded=function(r,f){var c=f.frag,u=f.payload,E=this.initPTS,g=this.unparsedVttFrags;if(c.type===d.PlaylistLevelType.SUBTITLE)if(u.byteLength){if(!Object(_.isFiniteNumber)(E[c.cc])){g.push(f),E.length&&this.hls.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:new Error("Missing initial subtitle PTS")});return}var s=c.decryptdata;if(s==null||s.key==null||s.method!=="AES-128"){var a=this.tracks[c.level],i=this.vttCCs;i[c.cc]||(i[c.cc]={start:c.start,prevCC:this.prevCC,new:!0},this.prevCC=c.cc),a&&a.textCodec===C.IMSC1_CODEC?this._parseIMSC1(c,u):this._parseVTTs(c,u,i)}}else this.hls.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:new Error("Empty subtitle payload")})},e._parseIMSC1=function(r,f){var c=this,u=this.hls;Object(C.parseIMSC1)(f,this.initPTS[r.cc],this.timescale[r.cc],function(E){c._appendCues(E,r.level),u.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:r})},function(E){v.logger.log("Failed to parse IMSC1: "+E),u.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:E})})},e._parseVTTs=function(r,f,c){var u=this,E=this.hls;Object(k.parseWebVTT)(f,this.initPTS[r.cc],this.timescale[r.cc],c,r.cc,r.start,function(g){u._appendCues(g,r.level),E.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:r})},function(g){u._fallbackToIMSC1(r,f),v.logger.log("Failed to parse VTT cue: "+g),E.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:g})})},e._fallbackToIMSC1=function(r,f){var c=this,u=this.tracks[r.level];u.textCodec||Object(C.parseIMSC1)(f,this.initPTS[r.cc],this.timescale[r.cc],function(){u.textCodec=C.IMSC1_CODEC,c._parseIMSC1(r,f)},function(){u.textCodec="wvtt"})},e._appendCues=function(r,f){var c=this.hls;if(this.config.renderTextTracksNatively){var u=this.textTracks[f];if(u.mode==="disabled")return;r.forEach(function(s){return Object(S.addCueToTrack)(u,s)})}else{var E=this.tracks[f],g=E.default?"default":"subtitles"+f;c.trigger(D.Events.CUES_PARSED,{type:"subtitles",cues:r,track:g})}},e.onFragDecrypted=function(r,f){var c=f.frag;if(c.type===d.PlaylistLevelType.SUBTITLE){if(!Object(_.isFiniteNumber)(this.initPTS[c.cc])){this.unparsedVttFrags.push(f);return}this.onFragLoaded(D.Events.FRAG_LOADED,f)}},e.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},e.onFragParsingUserdata=function(r,f){var c=this.cea608Parser1,u=this.cea608Parser2;if(!this.enabled||!(c&&u))return;for(var E=0;E<f.samples.length;E++){var g=f.samples[E].bytes;if(g){var s=this.extractCea608Data(g);c.addData(f.samples[E].pts,s[0]),u.addData(f.samples[E].pts,s[1])}}},e.onBufferFlushing=function(r,f){var c=f.startOffset,u=f.endOffset,E=f.endOffsetSubtitles,g=f.type,s=this.media;if(!s||s.currentTime<u)return;if(!g||g==="video"){var a=this.captionsTracks;Object.keys(a).forEach(function(l){return Object(S.removeCuesInRange)(a[l],c,u)})}if(this.config.renderTextTracksNatively&&(c===0&&E!==void 0)){var i=this.textTracks;Object.keys(i).forEach(function(l){return Object(S.removeCuesInRange)(i[l],c,E)})}},e.extractCea608Data=function(r){for(var f=r[0]&31,c=2,u=[[],[]],E=0;E<f;E++){var g=r[c++],s=127&r[c++],a=127&r[c++],i=(4&g)!==0,l=3&g;if(s===0&&a===0)continue;i&&((l===0||l===1)&&(u[l].push(s),u[l].push(a)))}return u},n}();function p(n,e){return n&&n.label===e.name&&!(n.textTrack1||n.textTrack2)}function m(n,e,t,r){return Math.min(e,r)-Math.max(n,t)}function y(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"default",function(){return _});var _=function(){function D(N,k){this.subtle=void 0,this.aesIV=void 0,this.subtle=N,this.aesIV=k}var A=D.prototype;return A.decrypt=function(k,S){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},S,k)},D}()},"./src/crypt/aes-decryptor.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"removePadding",function(){return D}),w.d(B,"default",function(){return A});var _=w("./src/utils/typed-array.ts");function D(N){var k=N.byteLength,S=k&&new DataView(N.buffer).getUint8(k-1);return S?Object(_.sliceUint8)(N,0,k-S):N}var A=function(){function N(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var k=N.prototype;return k.uint8ArrayToUint32Array_=function(C){for(var d=new DataView(C),v=new Uint32Array(4),b=0;b<4;b++)v[b]=d.getUint32(b*4);return v},k.initTable=function(){var C=this.sBox,d=this.invSBox,v=this.subMix,b=v[0],p=v[1],m=v[2],y=v[3],n=this.invSubMix,e=n[0],t=n[1],r=n[2],f=n[3],c=new Uint32Array(256),u=0,E=0,g=0;for(g=0;g<256;g++)g<128?c[g]=g<<1:c[g]=g<<1^283;for(g=0;g<256;g++){var s=E^E<<1^E<<2^E<<3^E<<4;s=s>>>8^s&255^99,C[u]=s,d[s]=u;var a=c[u],i=c[a],l=c[i],T=c[s]*257^s*16843008;b[u]=T<<24|T>>>8,p[u]=T<<16|T>>>16,m[u]=T<<8|T>>>24,y[u]=T,T=l*16843009^i*65537^a*257^u*16843008,e[s]=T<<24|T>>>8,t[s]=T<<16|T>>>16,r[s]=T<<8|T>>>24,f[s]=T,u?(u=a^c[c[c[l^a]]],E^=c[c[E]]):u=E=1}},k.expandKey=function(C){for(var d=this.uint8ArrayToUint32Array_(C),v=!0,b=0;b<d.length&&v;)v=d[b]===this.key[b],b++;if(v)return;this.key=d;var p=this.keySize=d.length;if(p!==4&&p!==6&&p!==8)throw new Error("Invalid aes key size="+p);var m=this.ksRows=(p+6+1)*4,y,n,e=this.keySchedule=new Uint32Array(m),t=this.invKeySchedule=new Uint32Array(m),r=this.sBox,f=this.rcon,c=this.invSubMix,u=c[0],E=c[1],g=c[2],s=c[3],a,i;for(y=0;y<m;y++){if(y<p){a=e[y]=d[y];continue}i=a,y%p===0?(i=i<<8|i>>>24,i=r[i>>>24]<<24|r[i>>>16&255]<<16|r[i>>>8&255]<<8|r[i&255],i^=f[y/p|0]<<24):p>6&&y%p===4&&(i=r[i>>>24]<<24|r[i>>>16&255]<<16|r[i>>>8&255]<<8|r[i&255]),e[y]=a=(e[y-p]^i)>>>0}for(n=0;n<m;n++)y=m-n,n&3?i=e[y]:i=e[y-4],n<4||y<=4?t[n]=i:t[n]=u[r[i>>>24]]^E[r[i>>>16&255]]^g[r[i>>>8&255]]^s[r[i&255]],t[n]=t[n]>>>0},k.networkToHostOrderSwap=function(C){return C<<24|(C&65280)<<8|(C&16711680)>>8|C>>>24},k.decrypt=function(C,d,v){for(var b=this.keySize+6,p=this.invKeySchedule,m=this.invSBox,y=this.invSubMix,n=y[0],e=y[1],t=y[2],r=y[3],f=this.uint8ArrayToUint32Array_(v),c=f[0],u=f[1],E=f[2],g=f[3],s=new Int32Array(C),a=new Int32Array(s.length),i,l,T,x,L,R,I,F,j,z,Q,J,ie,pe,ce=this.networkToHostOrderSwap;d<s.length;){for(j=ce(s[d]),z=ce(s[d+1]),Q=ce(s[d+2]),J=ce(s[d+3]),L=j^p[0],R=J^p[1],I=Q^p[2],F=z^p[3],ie=4,pe=1;pe<b;pe++)i=n[L>>>24]^e[R>>16&255]^t[I>>8&255]^r[F&255]^p[ie],l=n[R>>>24]^e[I>>16&255]^t[F>>8&255]^r[L&255]^p[ie+1],T=n[I>>>24]^e[F>>16&255]^t[L>>8&255]^r[R&255]^p[ie+2],x=n[F>>>24]^e[L>>16&255]^t[R>>8&255]^r[I&255]^p[ie+3],L=i,R=l,I=T,F=x,ie=ie+4;i=m[L>>>24]<<24^m[R>>16&255]<<16^m[I>>8&255]<<8^m[F&255]^p[ie],l=m[R>>>24]<<24^m[I>>16&255]<<16^m[F>>8&255]<<8^m[L&255]^p[ie+1],T=m[I>>>24]<<24^m[F>>16&255]<<16^m[L>>8&255]<<8^m[R&255]^p[ie+2],x=m[F>>>24]<<24^m[L>>16&255]<<16^m[R>>8&255]<<8^m[I&255]^p[ie+3],a[d]=ce(i^c),a[d+1]=ce(x^u),a[d+2]=ce(T^E),a[d+3]=ce(l^g),c=j,u=z,E=Q,g=J,d=d+4}return a.buffer},N}()},"./src/crypt/decrypter.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"default",function(){return d});var _=w("./src/crypt/aes-crypto.ts"),D=w("./src/crypt/fast-aes-key.ts"),A=w("./src/crypt/aes-decryptor.ts"),N=w("./src/utils/logger.ts"),k=w("./src/utils/mp4-tools.ts"),S=w("./src/utils/typed-array.ts"),C=16,d=function(){function v(p,m,y){var n=y===void 0?{}:y,e=n.removePKCS7Padding,t=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=p,this.config=m,this.removePKCS7Padding=t,t)try{var r=self.crypto;r&&(this.subtle=r.subtle||r.webkitSubtle)}catch(f){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var b=v.prototype;return b.destroy=function(){this.observer=null},b.isSync=function(){return this.config.enableSoftwareAES},b.flush=function(){var m=this.currentResult;if(!m){this.reset();return}var y=new Uint8Array(m);return this.reset(),this.removePKCS7Padding?Object(A.removePadding)(y):y},b.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},b.decrypt=function(m,y,n,e){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(m),y,n);var t=this.flush();t&&e(t.buffer)}else this.webCryptoDecrypt(new Uint8Array(m),y,n).then(e)},b.softwareDecrypt=function(m,y,n){var e=this.currentIV,t=this.currentResult,r=this.remainderData;this.logOnce("JS AES decrypt"),r&&(m=Object(k.appendUint8Array)(r,m),this.remainderData=null);var f=this.getValidChunk(m);if(!f.length)return null;e&&(n=e);var c=this.softwareDecrypter;c||(c=this.softwareDecrypter=new A.default),c.expandKey(y);var u=t;return this.currentResult=c.decrypt(f.buffer,0,n),this.currentIV=Object(S.sliceUint8)(f,-16).buffer,u||null},b.webCryptoDecrypt=function(m,y,n){var e=this,t=this.subtle;return(this.key!==y||!this.fastAesKey)&&(this.key=y,this.fastAesKey=new D.default(t,y)),this.fastAesKey.expandKey().then(function(r){if(!t)return Promise.reject(new Error("web crypto not initialized"));var f=new _.default(t,n);return f.decrypt(m.buffer,r)}).catch(function(r){return e.onWebCryptoError(r,m,y,n)})},b.onWebCryptoError=function(m,y,n,e){return N.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",m),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(y,n,e)},b.getValidChunk=function(m){var y=m,n=m.length-m.length%C;return n!==m.length&&(y=Object(S.sliceUint8)(m,0,n),this.remainderData=Object(S.sliceUint8)(m,n)),y},b.logOnce=function(m){if(!this.logEnabled)return;N.logger.log("[decrypter.ts]: "+m),this.logEnabled=!1},v}()},"./src/crypt/fast-aes-key.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"default",function(){return _});var _=function(){function D(N,k){this.subtle=void 0,this.key=void 0,this.subtle=N,this.key=k}var A=D.prototype;return A.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},D}()},"./src/demux/aacdemuxer.ts":function(ue,B,w){"use strict";w.r(B);var _=w("./src/demux/base-audio-demuxer.ts"),D=w("./src/demux/adts.ts"),A=w("./src/utils/logger.ts"),N=w("./src/demux/id3.ts");function k(d,v){d.prototype=Object.create(v.prototype),d.prototype.constructor=d,S(d,v)}function S(d,v){return S=Object.setPrototypeOf||function(p,m){return p.__proto__=m,p},S(d,v)}var C=function(d){k(v,d);function v(p,m){var y;return y=d.call(this)||this,y.observer=void 0,y.config=void 0,y.observer=p,y.config=m,y}var b=v.prototype;return b.resetInitSegment=function(m,y,n){d.prototype.resetInitSegment.call(this,m,y,n),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:m,duration:n,inputTimeScale:9e4,dropped:0}},v.probe=function(m){if(!m)return!1;for(var y=N.getID3Data(m,0)||[],n=y.length,e=m.length;n<e;n++)if(D.probe(m,n))return A.logger.log("ADTS sync word found !"),!0;return!1},b.canParse=function(m,y){return D.canParse(m,y)},b.appendFrame=function(m,y,n){D.initTrackConfig(m,this.observer,y,n,m.manifestCodec);var e=D.appendFrame(m,y,n,this.initPTS,this.frameIndex);if(e&&e.missing===0)return e},v}(_.default);C.minProbeByteLength=9,B.default=C},"./src/demux/adts.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"getAudioConfig",function(){return N}),w.d(B,"isHeaderPattern",function(){return k}),w.d(B,"getHeaderLength",function(){return S}),w.d(B,"getFullFrameLength",function(){return C}),w.d(B,"canGetFrameLength",function(){return d}),w.d(B,"isHeader",function(){return v}),w.d(B,"canParse",function(){return b}),w.d(B,"probe",function(){return p}),w.d(B,"initTrackConfig",function(){return m}),w.d(B,"getFrameDuration",function(){return y}),w.d(B,"parseFrameHeader",function(){return n}),w.d(B,"appendFrame",function(){return e});var _=w("./src/utils/logger.ts"),D=w("./src/errors.ts"),A=w("./src/events.ts");function N(t,r,f,c){var u,E,g,s,a=navigator.userAgent.toLowerCase(),i=c,l=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];u=((r[f+2]&192)>>>6)+1;var T=(r[f+2]&60)>>>2;if(T>l.length-1){t.trigger(A.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+T});return}return g=(r[f+2]&1)<<2,g|=(r[f+3]&192)>>>6,_.logger.log("manifest codec:"+c+", ADTS type:"+u+", samplingIndex:"+T),/firefox/i.test(a)?T>=6?(u=5,s=new Array(4),E=T-3):(u=2,s=new Array(2),E=T):a.indexOf("android")!==-1?(u=2,s=new Array(2),E=T):(u=5,s=new Array(4),c&&(c.indexOf("mp4a.40.29")!==-1||c.indexOf("mp4a.40.5")!==-1)||!c&&T>=6?E=T-3:((c&&c.indexOf("mp4a.40.2")!==-1&&(T>=6&&g===1||/vivaldi/i.test(a))||!c&&g===1)&&(u=2,s=new Array(2)),E=T)),s[0]=u<<3,s[0]|=(T&14)>>1,s[1]|=(T&1)<<7,s[1]|=g<<3,u===5&&(s[1]|=(E&14)>>1,s[2]=(E&1)<<7,s[2]|=2<<2,s[3]=0),{config:s,samplerate:l[T],channelCount:g,codec:"mp4a.40."+u,manifestCodec:i}}function k(t,r){return t[r]===255&&(t[r+1]&246)===240}function S(t,r){return t[r+1]&1?7:9}function C(t,r){return(t[r+3]&3)<<11|t[r+4]<<3|(t[r+5]&224)>>>5}function d(t,r){return r+5<t.length}function v(t,r){return r+1<t.length&&k(t,r)}function b(t,r){return d(t,r)&&k(t,r)&&C(t,r)<=t.length-r}function p(t,r){if(v(t,r)){var f=S(t,r);if(r+f>=t.length)return!1;var c=C(t,r);if(c<=f)return!1;var u=r+c;return u===t.length||v(t,u)}return!1}function m(t,r,f,c,u){if(!t.samplerate){var E=N(r,f,c,u);if(!E)return;t.config=E.config,t.samplerate=E.samplerate,t.channelCount=E.channelCount,t.codec=E.codec,t.manifestCodec=E.manifestCodec,_.logger.log("parsed codec:"+t.codec+", rate:"+E.samplerate+", channels:"+E.channelCount)}}function y(t){return 1024*9e4/t}function n(t,r,f,c,u){var E=S(t,r),g=C(t,r);if(g-=E,g>0){var s=f+c*u;return{headerLength:E,frameLength:g,stamp:s}}}function e(t,r,f,c,u){var E=y(t.samplerate),g=n(r,f,c,u,E);if(g){var s=g.frameLength,a=g.headerLength,i=g.stamp,l=a+s,T=Math.max(0,f+l-r.length),x;T?(x=new Uint8Array(l-a),x.set(r.subarray(f+a,r.length),0)):x=r.subarray(f+a,f+l);var L={unit:x,pts:i};return T||t.samples.push(L),{sample:L,length:l,missing:T}}}},"./src/demux/base-audio-demuxer.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"initPTSFn",function(){return C});var _=w("./src/polyfills/number.ts"),D=w("./src/demux/id3.ts"),A=w("./src/demux/dummy-demuxed-track.ts"),N=w("./src/utils/mp4-tools.ts"),k=w("./src/utils/typed-array.ts"),S=function(){function d(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var v=d.prototype;return v.resetInitSegment=function(p,m,y){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},v.resetTimeStamp=function(){},v.resetContiguity=function(){},v.canParse=function(p,m){return!1},v.appendFrame=function(p,m,y){},v.demux=function(p,m){this.cachedData&&(p=Object(N.appendUint8Array)(this.cachedData,p),this.cachedData=null);var y=D.getID3Data(p,0),n=y?y.length:0,e,t,r=this._audioTrack,f=this._id3Track,c=y?D.getTimeStamp(y):void 0,u=p.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=C(c,m)),y&&y.length>0&&f.samples.push({pts:this.initPTS,dts:this.initPTS,data:y}),t=this.initPTS;n<u;){if(this.canParse(p,n)){var E=this.appendFrame(r,p,n);E?(this.frameIndex++,t=E.sample.pts,n+=E.length,e=n):n=u}else D.canParse(p,n)?(y=D.getID3Data(p,n),f.samples.push({pts:t,dts:t,data:y}),n+=y.length,e=n):n++;if(n===u&&e!==u){var g=Object(k.sliceUint8)(p,e);this.cachedData?this.cachedData=Object(N.appendUint8Array)(this.cachedData,g):this.cachedData=g}}return{audioTrack:r,avcTrack:Object(A.dummyTrack)(),id3Track:f,textTrack:Object(A.dummyTrack)()}},v.demuxSampleAes=function(p,m,y){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},v.flush=function(p){var m=this.cachedData;return m&&(this.cachedData=null,this.demux(m,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(A.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(A.dummyTrack)()}},v.destroy=function(){},d}(),C=function(v,b){return Object(_.isFiniteNumber)(v)?v*90:b*9e4};B.default=S},"./src/demux/chunk-cache.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"default",function(){return _});var _=function(){function A(){this.chunks=[],this.dataLength=0}var N=A.prototype;return N.push=function(S){this.chunks.push(S),this.dataLength+=S.length},N.flush=function(){var S=this.chunks,C=this.dataLength,d;if(S.length)S.length===1?d=S[0]:d=D(S,C);else return new Uint8Array(0);return this.reset(),d},N.reset=function(){this.chunks.length=0,this.dataLength=0},A}();function D(A,N){for(var k=new Uint8Array(N),S=0,C=0;C<A.length;C++){var d=A[C];k.set(d,S),S+=d.length}return k}},"./src/demux/dummy-demuxed-track.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"dummyTrack",function(){return _});function _(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ue,B,w){"use strict";w.r(B);var _=w("./src/utils/logger.ts"),D=function(){function A(k){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=k,this.bytesAvailable=k.byteLength,this.word=0,this.bitsAvailable=0}var N=A.prototype;return N.loadWord=function(){var S=this.data,C=this.bytesAvailable,d=S.byteLength-C,v=new Uint8Array(4),b=Math.min(4,C);if(b===0)throw new Error("no bytes available");v.set(S.subarray(d,d+b)),this.word=new DataView(v.buffer).getUint32(0),this.bitsAvailable=b*8,this.bytesAvailable-=b},N.skipBits=function(S){var C;this.bitsAvailable>S?(this.word<<=S,this.bitsAvailable-=S):(S-=this.bitsAvailable,C=S>>3,S-=C>>3,this.bytesAvailable-=C,this.loadWord(),this.word<<=S,this.bitsAvailable-=S)},N.readBits=function(S){var C=Math.min(this.bitsAvailable,S),d=this.word>>>32-C;return S>32&&_.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=C,this.bitsAvailable>0?this.word<<=C:this.bytesAvailable>0&&this.loadWord(),C=S-C,C>0&&this.bitsAvailable?d<<C|this.readBits(C):d},N.skipLZ=function(){var S;for(S=0;S<this.bitsAvailable;++S)if((this.word&2147483648>>>S)!==0)return this.word<<=S,this.bitsAvailable-=S,S;return this.loadWord(),S+this.skipLZ()},N.skipUEG=function(){this.skipBits(1+this.skipLZ())},N.skipEG=function(){this.skipBits(1+this.skipLZ())},N.readUEG=function(){var S=this.skipLZ();return this.readBits(S+1)-1},N.readEG=function(){var S=this.readUEG();return 1&S?1+S>>>1:-1*(S>>>1)},N.readBoolean=function(){return this.readBits(1)===1},N.readUByte=function(){return this.readBits(8)},N.readUShort=function(){return this.readBits(16)},N.readUInt=function(){return this.readBits(32)},N.skipScalingList=function(S){for(var C=8,d=8,v,b=0;b<S;b++)d!==0&&(v=this.readEG(),d=(C+v+256)%256),C=d===0?C:d},N.readSPS=function(){var S=0,C=0,d=0,v=0,b,p,m,y=this.readUByte.bind(this),n=this.readBits.bind(this),e=this.readUEG.bind(this),t=this.readBoolean.bind(this),r=this.skipBits.bind(this),f=this.skipEG.bind(this),c=this.skipUEG.bind(this),u=this.skipScalingList.bind(this);y();var E=y();if(n(5),r(3),y(),c(),E===100||E===110||E===122||E===244||E===44||E===83||E===86||E===118||E===128){var g=e();if(g===3&&r(1),c(),c(),r(1),t())for(p=g!==3?8:12,m=0;m<p;m++)t()&&(m<6?u(16):u(64))}c();var s=e();if(s===0)e();else if(s===1)for(r(1),f(),f(),b=e(),m=0;m<b;m++)f();c(),r(1);var a=e(),i=e(),l=n(1);l===0&&r(1),r(1),t()&&(S=e(),C=e(),d=e(),v=e());var T=[1,1];if(t()&&t()){var x=y();switch(x){case 1:T=[1,1];break;case 2:T=[12,11];break;case 3:T=[10,11];break;case 4:T=[16,11];break;case 5:T=[40,33];break;case 6:T=[24,11];break;case 7:T=[20,11];break;case 8:T=[32,11];break;case 9:T=[80,33];break;case 10:T=[18,11];break;case 11:T=[15,11];break;case 12:T=[64,33];break;case 13:T=[160,99];break;case 14:T=[4,3];break;case 15:T=[3,2];break;case 16:T=[2,1];break;case 255:{T=[y()<<8|y(),y()<<8|y()];break}}}return{width:Math.ceil((a+1)*16-S*2-C*2),height:(2-l)*(i+1)*16-(l?2:4)*(d+v),pixelRatio:T}},N.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},A}();B.default=D},"./src/demux/id3.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"isHeader",function(){return _}),w.d(B,"isFooter",function(){return D}),w.d(B,"getID3Data",function(){return A}),w.d(B,"canParse",function(){return k}),w.d(B,"getTimeStamp",function(){return S}),w.d(B,"isTimeStampFrame",function(){return C}),w.d(B,"getID3Frames",function(){return v}),w.d(B,"decodeFrame",function(){return b}),w.d(B,"utf8ArrayToStr",function(){return e}),w.d(B,"testables",function(){return t});var _=function(u,E){return E+10<=u.length&&(u[E]===73&&u[E+1]===68&&u[E+2]===51&&(u[E+3]<255&&u[E+4]<255&&(u[E+6]<128&&u[E+7]<128&&u[E+8]<128&&u[E+9]<128)))},D=function(u,E){return E+10<=u.length&&(u[E]===51&&u[E+1]===68&&u[E+2]===73&&(u[E+3]<255&&u[E+4]<255&&(u[E+6]<128&&u[E+7]<128&&u[E+8]<128&&u[E+9]<128)))},A=function(u,E){for(var g=E,s=0;_(u,E);){s+=10;var a=N(u,E+6);s+=a,D(u,E+10)&&(s+=10),E+=s}return s>0?u.subarray(g,g+s):void 0},N=function(u,E){var g=0;return g=(u[E]&127)<<21,g|=(u[E+1]&127)<<14,g|=(u[E+2]&127)<<7,g|=u[E+3]&127,g},k=function(u,E){return _(u,E)&&N(u,E+6)+10<=u.length-E},S=function(u){for(var E=v(u),g=0;g<E.length;g++){var s=E[g];if(C(s))return n(s)}return},C=function(u){return u&&u.key==="PRIV"&&u.info==="com.apple.streaming.transportStreamTimestamp"},d=function(u){var E=String.fromCharCode(u[0],u[1],u[2],u[3]),g=N(u,4),s=10;return{type:E,size:g,data:u.subarray(s,s+g)}},v=function(u){for(var E=0,g=[];_(u,E);){var s=N(u,E+6);E+=10;for(var a=E+s;E+8<a;){var i=d(u.subarray(E)),l=b(i);l&&g.push(l),E+=i.size+10}D(u,E)&&(E+=10)}return g},b=function(u){return u.type==="PRIV"?p(u):u.type[0]==="W"?y(u):m(u)},p=function(u){if(u.size<2)return;var E=e(u.data,!0),g=new Uint8Array(u.data.subarray(E.length+1));return{key:u.type,info:E,data:g.buffer}},m=function(u){if(u.size<2)return;if(u.type==="TXXX"){var E=1,g=e(u.data.subarray(E),!0);E+=g.length+1;var s=e(u.data.subarray(E));return{key:u.type,info:g,data:s}}var a=e(u.data.subarray(1));return{key:u.type,data:a}},y=function(u){if(u.type==="WXXX"){if(u.size<2)return;var E=1,g=e(u.data.subarray(E),!0);E+=g.length+1;var s=e(u.data.subarray(E));return{key:u.type,info:g,data:s}}var a=e(u.data);return{key:u.type,data:a}},n=function(u){if(u.data.byteLength===8){var E=new Uint8Array(u.data),g=E[3]&1,s=(E[4]<<23)+(E[5]<<15)+(E[6]<<7)+E[7];return s/=45,g&&(s+=4772185884e-2),Math.round(s)}return},e=function(u,E){E===void 0&&(E=!1);var g=f();if(g){var s=g.decode(u);if(E){var a=s.indexOf("\0");return a!==-1?s.substring(0,a):s}return s.replace(/\0/g,"")}for(var i=u.length,l,T,x,L="",R=0;R<i;){if(l=u[R++],l===0&&E)return L;if(l===0||l===3)continue;switch(l>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:L+=String.fromCharCode(l);break;case 12:case 13:T=u[R++],L+=String.fromCharCode((l&31)<<6|T&63);break;case 14:T=u[R++],x=u[R++],L+=String.fromCharCode((l&15)<<12|(T&63)<<6|(x&63)<<0);break;default:}}return L},t={decodeTextFrame:m},r;function f(){return!r&&typeof self.TextDecoder!="undefined"&&(r=new self.TextDecoder("utf-8")),r}},"./src/demux/mp3demuxer.ts":function(ue,B,w){"use strict";w.r(B);var _=w("./src/demux/base-audio-demuxer.ts"),D=w("./src/demux/id3.ts"),A=w("./src/utils/logger.ts"),N=w("./src/demux/mpegaudio.ts");function k(d,v){d.prototype=Object.create(v.prototype),d.prototype.constructor=d,S(d,v)}function S(d,v){return S=Object.setPrototypeOf||function(p,m){return p.__proto__=m,p},S(d,v)}var C=function(d){k(v,d);function v(){return d.apply(this,arguments)||this}var b=v.prototype;return b.resetInitSegment=function(m,y,n){d.prototype.resetInitSegment.call(this,m,y,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:m,duration:n,inputTimeScale:9e4,dropped:0}},v.probe=function(m){if(!m)return!1;for(var y=D.getID3Data(m,0)||[],n=y.length,e=m.length;n<e;n++)if(N.probe(m,n))return A.logger.log("MPEG Audio sync word found !"),!0;return!1},b.canParse=function(m,y){return N.canParse(m,y)},b.appendFrame=function(m,y,n){return this.initPTS===null?void 0:N.appendFrame(m,y,n,this.initPTS,this.frameIndex)},v}(_.default);C.minProbeByteLength=4,B.default=C},"./src/demux/mp4demuxer.ts":function(ue,B,w){"use strict";w.r(B);var _=w("./src/utils/mp4-tools.ts"),D=w("./src/demux/dummy-demuxed-track.ts"),A=function(){function N(S,C){this.remainderData=null,this.config=void 0,this.config=C}var k=N.prototype;return k.resetTimeStamp=function(){},k.resetInitSegment=function(){},k.resetContiguity=function(){},N.probe=function(C){return Object(_.findBox)({data:C,start:0,end:Math.min(C.length,16384)},["moof"]).length>0},k.demux=function(C){var d=C,v=Object(D.dummyTrack)();if(this.config.progressive){this.remainderData&&(d=Object(_.appendUint8Array)(this.remainderData,C));var b=Object(_.segmentValidRange)(d);this.remainderData=b.remainder,v.samples=b.valid||new Uint8Array}else v.samples=d;return{audioTrack:Object(D.dummyTrack)(),avcTrack:v,id3Track:Object(D.dummyTrack)(),textTrack:Object(D.dummyTrack)()}},k.flush=function(){var C=Object(D.dummyTrack)();return C.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(D.dummyTrack)(),avcTrack:C,id3Track:Object(D.dummyTrack)(),textTrack:Object(D.dummyTrack)()}},k.demuxSampleAes=function(C,d,v){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},k.destroy=function(){},N}();A.minProbeByteLength=1024,B.default=A},"./src/demux/mpegaudio.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"appendFrame",function(){return S}),w.d(B,"parseHeader",function(){return C}),w.d(B,"isHeaderPattern",function(){return d}),w.d(B,"isHeader",function(){return v}),w.d(B,"canParse",function(){return b}),w.d(B,"probe",function(){return p});var _=null,D=[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],A=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],N=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],k=[0,1,1,4];function S(m,y,n,e,t){if(n+24>y.length)return;var r=C(y,n);if(r&&n+r.frameLength<=y.length){var f=r.samplesPerFrame*9e4/r.sampleRate,c=e+t*f,u={unit:y.subarray(n,n+r.frameLength),pts:c,dts:c};return m.config=[],m.channelCount=r.channelCount,m.samplerate=r.sampleRate,m.samples.push(u),{sample:u,length:r.frameLength,missing:0}}}function C(m,y){var n=m[y+1]>>3&3,e=m[y+1]>>1&3,t=m[y+2]>>4&15,r=m[y+2]>>2&3;if(n!==1&&t!==0&&t!==15&&r!==3){var f=m[y+2]>>1&1,c=m[y+3]>>6,u=n===3?3-e:e===3?3:4,E=D[u*14+t-1]*1e3,g=n===3?0:n===2?1:2,s=A[g*3+r],a=c===3?1:2,i=N[n][e],l=k[e],T=i*8*l,x=Math.floor(i*E/s+f)*l;if(_===null){var L=navigator.userAgent||"",R=L.match(/Chrome\/(\d+)/i);_=R?parseInt(R[1]):0}var I=!!_&&_<=87;return I&&e===2&&E>=224e3&&c===0&&(m[y+3]=m[y+3]|128),{sampleRate:s,channelCount:a,frameLength:x,samplesPerFrame:T}}}function d(m,y){return m[y]===255&&(m[y+1]&224)===224&&(m[y+1]&6)!==0}function v(m,y){return y+1<m.length&&d(m,y)}function b(m,y){var n=4;return d(m,y)&&n<=m.length-y}function p(m,y){if(y+1<m.length&&d(m,y)){var n=4,e=C(m,y),t=n;e!=null&&e.frameLength&&(t=e.frameLength);var r=y+t;return r===m.length||v(m,r)}return!1}},"./src/demux/sample-aes.ts":function(ue,B,w){"use strict";w.r(B);var _=w("./src/crypt/decrypter.ts"),D=w("./src/demux/tsdemuxer.ts"),A=function(){function N(S,C,d){this.keyData=void 0,this.decrypter=void 0,this.keyData=d,this.decrypter=new _.default(S,C,{removePKCS7Padding:!1})}var k=N.prototype;return k.decryptBuffer=function(C,d){this.decrypter.decrypt(C,this.keyData.key.buffer,this.keyData.iv.buffer,d)},k.decryptAacSample=function(C,d,v,b){var p=C[d].unit,m=p.subarray(16,p.length-p.length%16),y=m.buffer.slice(m.byteOffset,m.byteOffset+m.length),n=this;this.decryptBuffer(y,function(e){var t=new Uint8Array(e);p.set(t,16),b||n.decryptAacSamples(C,d+1,v)})},k.decryptAacSamples=function(C,d,v){for(;;d++){if(d>=C.length){v();return}if(C[d].unit.length<32)continue;var b=this.decrypter.isSync();if(this.decryptAacSample(C,d,v,b),!b)return}},k.getAvcEncryptedData=function(C){for(var d=Math.floor((C.length-48)/160)*16+16,v=new Int8Array(d),b=0,p=32;p<=C.length-16;p+=160,b+=16)v.set(C.subarray(p,p+16),b);return v},k.getAvcDecryptedUnit=function(C,d){for(var v=new Uint8Array(d),b=0,p=32;p<=C.length-16;p+=160,b+=16)C.set(v.subarray(b,b+16),p);return C},k.decryptAvcSample=function(C,d,v,b,p,m){var y=Object(D.discardEPB)(p.data),n=this.getAvcEncryptedData(y),e=this;this.decryptBuffer(n.buffer,function(t){p.data=e.getAvcDecryptedUnit(y,t),m||e.decryptAvcSamples(C,d,v+1,b)})},k.decryptAvcSamples=function(C,d,v,b){if(C instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;d++,v=0){if(d>=C.length){b();return}for(var p=C[d].units;!(v>=p.length);v++){var m=p[v];if(m.data.length<=48||m.type!==1&&m.type!==5)continue;var y=this.decrypter.isSync();if(this.decryptAvcSample(C,d,v,b,m,y),!y)return}}},N}();B.default=A},"./src/demux/transmuxer-interface.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"default",function(){return p});var _=w("./node_modules/webworkify-webpack/index.js"),D=w.n(_),A=w("./src/events.ts"),N=w("./src/demux/transmuxer.ts"),k=w("./src/utils/logger.ts"),S=w("./src/errors.ts"),C=w("./src/utils/mediasource-helper.ts"),d=w("./node_modules/eventemitter3/index.js"),v=w.n(d),b=Object(C.getMediaSource)()||{isTypeSupported:function(){return!1}},p=function(){function m(n,e,t,r){var f=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=n,this.id=e,this.onTransmuxComplete=t,this.onFlush=r;var c=n.config,u=function(i,l){l=l||{},l.frag=f.frag,l.id=f.id,n.trigger(i,l)};this.observer=new d.EventEmitter,this.observer.on(A.Events.FRAG_DECRYPTED,u),this.observer.on(A.Events.ERROR,u);var E={mp4:b.isTypeSupported("video/mp4"),mpeg:b.isTypeSupported("audio/mpeg"),mp3:b.isTypeSupported('audio/mp4; codecs="mp3"')},g=navigator.vendor;if(c.enableWorker&&typeof Worker!="undefined"){k.logger.log("demuxing in webworker");var s;try{s=this.worker=_("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),s.addEventListener("message",this.onwmsg),s.onerror=function(a){n.trigger(A.Events.ERROR,{type:S.ErrorTypes.OTHER_ERROR,details:S.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(a.message+" ("+a.filename+":"+a.lineno+")")})},s.postMessage({cmd:"init",typeSupported:E,vendor:g,id:e,config:JSON.stringify(c)})}catch(a){k.logger.warn("Error in worker:",a),k.logger.error("Error while initializing DemuxerWorker, fallback to inline"),s&&self.URL.revokeObjectURL(s.objectURL),this.transmuxer=new N.default(this.observer,E,c,g,e),this.worker=null}}else this.transmuxer=new N.default(this.observer,E,c,g,e)}var y=m.prototype;return y.destroy=function(){var e=this.worker;if(e)e.removeEventListener("message",this.onwmsg),e.terminate(),this.worker=null;else{var t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}var r=this.observer;r&&r.removeAllListeners(),this.observer=null},y.push=function(e,t,r,f,c,u,E,g,s,a){var i=this;s.transmuxing.start=self.performance.now();var l=this.transmuxer,T=this.worker,x=u?u.start:c.start,L=c.decryptdata,R=this.frag,I=!(R&&c.cc===R.cc),F=!(R&&s.level===R.level),j=R?s.sn-R.sn:-1,z=this.part?s.part-this.part.index:1,Q=!F&&(j===1||j===0&&z===1),J=self.performance.now();(F||j||c.stats.parsing.start===0)&&(c.stats.parsing.start=J),u&&(z||!Q)&&(u.stats.parsing.start=J);var ie=new N.TransmuxState(I,Q,g,F,x);if(!Q||I){k.logger.log("[transmuxer-interface, "+c.type+"]: Starting new transmux session for sn: "+s.sn+" p: "+s.part+" level: "+s.level+" id: "+s.id+`
discontinuity: `+I+`
trackSwitch: `+F+`
contiguous: `+Q+`
accurateTimeOffset: `+g+`
timeOffset: `+x);var pe=new N.TransmuxConfig(r,f,t,E,a);this.configureTransmuxer(pe)}if(this.frag=c,this.part=u,T)T.postMessage({cmd:"demux",data:e,decryptdata:L,chunkMeta:s,state:ie},e instanceof ArrayBuffer?[e]:[]);else if(l){var ce=l.push(e,L,s,ie);Object(N.isPromise)(ce)?ce.then(function(ye){i.handleTransmuxComplete(ye)}):this.handleTransmuxComplete(ce)}},y.flush=function(e){var t=this;e.transmuxing.start=self.performance.now();var r=this.transmuxer,f=this.worker;if(f)f.postMessage({cmd:"flush",chunkMeta:e});else if(r){var c=r.flush(e);Object(N.isPromise)(c)?c.then(function(u){t.handleFlushResult(u,e)}):this.handleFlushResult(c,e)}},y.handleFlushResult=function(e,t){var r=this;e.forEach(function(f){r.handleTransmuxComplete(f)}),this.onFlush(t)},y.onWorkerMessage=function(e){var t=e.data,r=this.hls;switch(t.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,r.trigger(t.event,t.data);break}}},y.configureTransmuxer=function(e){var t=this.worker,r=this.transmuxer;t?t.postMessage({cmd:"configure",config:e}):r&&r.configure(e)},y.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},m}()},"./src/demux/transmuxer-worker.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"default",function(){return S});var _=w("./src/demux/transmuxer.ts"),D=w("./src/events.ts"),A=w("./src/utils/logger.ts"),N=w("./node_modules/eventemitter3/index.js"),k=w.n(N);function S(p){var m=new N.EventEmitter,y=function(e,t){p.postMessage({event:e,data:t})};m.on(D.Events.FRAG_DECRYPTED,y),m.on(D.Events.ERROR,y),p.addEventListener("message",function(n){var e=n.data;switch(e.cmd){case"init":{var t=JSON.parse(e.config);p.transmuxer=new _.default(m,e.typeSupported,t,e.vendor,e.id),Object(A.enableLogs)(t.debug),y("init",null);break}case"configure":{p.transmuxer.configure(e.config);break}case"demux":{var r=p.transmuxer.push(e.data,e.decryptdata,e.chunkMeta,e.state);Object(_.isPromise)(r)?r.then(function(u){C(p,u)}):C(p,r);break}case"flush":{var f=e.chunkMeta,c=p.transmuxer.flush(f);Object(_.isPromise)(c)?c.then(function(u){v(p,u,f)}):v(p,c,f);break}default:break}})}function C(p,m){if(b(m.remuxResult))return;var y=[],n=m.remuxResult,e=n.audio,t=n.video;e&&d(y,e),t&&d(y,t),p.postMessage({event:"transmuxComplete",data:m},y)}function d(p,m){m.data1&&p.push(m.data1.buffer),m.data2&&p.push(m.data2.buffer)}function v(p,m,y){m.forEach(function(n){C(p,n)}),p.postMessage({event:"flush",data:y})}function b(p){return!p.audio&&!p.video&&!p.text&&!p.id3&&!p.initSegment}},"./src/demux/transmuxer.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"default",function(){return t}),w.d(B,"isPromise",function(){return c}),w.d(B,"TransmuxConfig",function(){return u}),w.d(B,"TransmuxState",function(){return E});var _=w("./src/events.ts"),D=w("./src/errors.ts"),A=w("./src/crypt/decrypter.ts"),N=w("./src/demux/aacdemuxer.ts"),k=w("./src/demux/mp4demuxer.ts"),S=w("./src/demux/tsdemuxer.ts"),C=w("./src/demux/mp3demuxer.ts"),d=w("./src/remux/mp4-remuxer.ts"),v=w("./src/remux/passthrough-remuxer.ts"),b=w("./src/demux/chunk-cache.ts"),p=w("./src/utils/mp4-tools.ts"),m=w("./src/utils/logger.ts"),y;try{y=self.performance.now.bind(self.performance)}catch(g){m.logger.debug("Unable to use Performance API on this environment"),y=self.Date.now}var n=[{demux:S.default,remux:d.default},{demux:k.default,remux:v.default},{demux:N.default,remux:d.default},{demux:C.default,remux:d.default}],e=1024;n.forEach(function(g){var s=g.demux;e=Math.max(e,s.minProbeByteLength)});var t=function(){function g(a,i,l,T,x){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 b.default,this.observer=a,this.typeSupported=i,this.config=l,this.vendor=T,this.id=x}var s=g.prototype;return s.configure=function(i){this.transmuxConfig=i,this.decrypter&&this.decrypter.reset()},s.push=function(i,l,T,x){var L=this,R=T.transmuxing;R.executeStart=y();var I=new Uint8Array(i),F=this.cache,j=this.config,z=this.currentTransmuxState,Q=this.transmuxConfig;x&&(this.currentTransmuxState=x);var J=r(I,l);if(J&&J.method==="AES-128"){var ie=this.getDecrypter();if(j.enableSoftwareAES){var pe=ie.softwareDecrypt(I,J.key.buffer,J.iv.buffer);if(!pe)return R.executeEnd=y(),f(T);I=new Uint8Array(pe)}else return this.decryptionPromise=ie.webCryptoDecrypt(I,J.key.buffer,J.iv.buffer).then(function(te){var de=L.push(te,null,T);return L.decryptionPromise=null,de}),this.decryptionPromise}var ce=x||z,ye=ce.contiguous,ve=ce.discontinuity,Z=ce.trackSwitch,q=ce.accurateTimeOffset,se=ce.timeOffset,V=Q.audioCodec,G=Q.videoCodec,be=Q.defaultInitPts,Re=Q.duration,De=Q.initSegmentData;if((ve||Z)&&this.resetInitSegment(De,V,G,Re),ve&&this.resetInitialTimestamp(be),ye||this.resetContiguity(),this.needsProbing(I,ve,Z)){if(F.dataLength){var Me=F.flush();I=Object(p.appendUint8Array)(Me,I)}this.configureTransmuxer(I,Q)}var X=this.transmux(I,J,se,q,T),$=this.currentTransmuxState;return $.contiguous=!0,$.discontinuity=!1,$.trackSwitch=!1,R.executeEnd=y(),X},s.flush=function(i){var l=this,T=i.transmuxing;T.executeStart=y();var x=this.decrypter,L=this.cache,R=this.currentTransmuxState,I=this.decryptionPromise;if(I)return I.then(function(){return l.flush(i)});var F=[],j=R.timeOffset;if(x){var z=x.flush();z&&F.push(this.push(z,null,i))}var Q=L.dataLength;L.reset();var J=this.demuxer,ie=this.remuxer;if(!J||!ie)return Q>=e&&this.observer.emit(_.Events.ERROR,_.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),T.executeEnd=y(),[f(i)];var pe=J.flush(j);return c(pe)?pe.then(function(ce){return l.flushRemux(F,ce,i),F}):(this.flushRemux(F,pe,i),F)},s.flushRemux=function(i,l,T){var x=l.audioTrack,L=l.avcTrack,R=l.id3Track,I=l.textTrack,F=this.currentTransmuxState,j=F.accurateTimeOffset,z=F.timeOffset;m.logger.log("[transmuxer.ts]: Flushed fragment "+T.sn+(T.part>-1?" p: "+T.part:"")+" of level "+T.level);var Q=this.remuxer.remux(x,L,R,I,z,j,!0,this.id);i.push({remuxResult:Q,chunkMeta:T}),T.transmuxing.executeEnd=y()},s.resetInitialTimestamp=function(i){var l=this.demuxer,T=this.remuxer;if(!l||!T)return;l.resetTimeStamp(i),T.resetTimeStamp(i)},s.resetContiguity=function(){var i=this.demuxer,l=this.remuxer;if(!i||!l)return;i.resetContiguity(),l.resetNextTimestamp()},s.resetInitSegment=function(i,l,T,x){var L=this.demuxer,R=this.remuxer;if(!L||!R)return;L.resetInitSegment(l,T,x),R.resetInitSegment(i,l,T)},s.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},s.transmux=function(i,l,T,x,L){var R;return l&&l.method==="SAMPLE-AES"?R=this.transmuxSampleAes(i,l,T,x,L):R=this.transmuxUnencrypted(i,T,x,L),R},s.transmuxUnencrypted=function(i,l,T,x){var L=this.demuxer.demux(i,l,!1,!this.config.progressive),R=L.audioTrack,I=L.avcTrack,F=L.id3Track,j=L.textTrack,z=this.remuxer.remux(R,I,F,j,l,T,!1,this.id);return{remuxResult:z,chunkMeta:x}},s.transmuxSampleAes=function(i,l,T,x,L){var R=this;return this.demuxer.demuxSampleAes(i,l,T).then(function(I){var F=R.remuxer.remux(I.audioTrack,I.avcTrack,I.id3Track,I.textTrack,T,x,!1,R.id);return{remuxResult:F,chunkMeta:L}})},s.configureTransmuxer=function(i,l){for(var T=this.config,x=this.observer,L=this.typeSupported,R=this.vendor,I=l.audioCodec,F=l.defaultInitPts,j=l.duration,z=l.initSegmentData,Q=l.videoCodec,J,ie=0,pe=n.length;ie<pe;ie++)if(n[ie].demux.probe(i)){J=n[ie];break}J||(m.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),J={demux:k.default,remux:v.default});var ce=this.demuxer,ye=this.remuxer,ve=J.remux,Z=J.demux;(!ye||!(ye instanceof ve))&&(this.remuxer=new ve(x,T,L,R)),(!ce||!(ce instanceof Z))&&(this.demuxer=new Z(x,T,L),this.probe=Z.probe),this.resetInitSegment(z,I,Q,j),this.resetInitialTimestamp(F)},s.needsProbing=function(i,l,T){return!this.demuxer||!this.remuxer||l||T},s.getDecrypter=function(){var i=this.decrypter;return i||(i=this.decrypter=new A.default(this.observer,this.config)),i},g}();function r(g,s){var a=null;return g.byteLength>0&&s!=null&&s.key!=null&&s.iv!==null&&s.method!=null&&(a=s),a}var f=function(s){return{remuxResult:{},chunkMeta:s}};function c(g){return"then"in g&&g.then instanceof Function}var u=function(s,a,i,l,T){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=s,this.videoCodec=a,this.initSegmentData=i,this.duration=l,this.defaultInitPts=T},E=function(s,a,i,l,T){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=s,this.contiguous=a,this.accurateTimeOffset=i,this.trackSwitch=l,this.timeOffset=T}},"./src/demux/tsdemuxer.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"discardEPB",function(){return f});var _=w("./src/demux/adts.ts"),D=w("./src/demux/mpegaudio.ts"),A=w("./src/demux/exp-golomb.ts"),N=w("./src/demux/id3.ts"),k=w("./src/demux/sample-aes.ts"),S=w("./src/events.ts"),C=w("./src/utils/mp4-tools.ts"),d=w("./src/utils/logger.ts"),v=w("./src/errors.ts"),b={video:1,audio:2,id3:3,text:4},p=function(){function c(E,g,s){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=E,this.config=g,this.typeSupported=s}c.probe=function(g){var s=c.syncOffset(g);return s<0?!1:(s&&d.logger.warn("MPEG2-TS detected but first sync word found @ offset "+s+", junk ahead ?"),!0)},c.syncOffset=function(g){for(var s=Math.min(1e3,g.length-3*188),a=0;a<s;){if(g[a]===71&&g[a+188]===71&&g[a+2*188]===71)return a;a++}return-1},c.createTrack=function(g,s){return{container:g==="video"||g==="audio"?"video/mp2t":void 0,type:g,id:b[g],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:g==="audio"?s:void 0}};var u=c.prototype;return u.resetInitSegment=function(g,s,a){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=c.createTrack("video",a),this._audioTrack=c.createTrack("audio",a),this._id3Track=c.createTrack("id3",a),this._txtTrack=c.createTrack("text",a),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=g,this.videoCodec=s,this._duration=a},u.resetTimeStamp=function(){},u.resetContiguity=function(){var g=this._audioTrack,s=this._avcTrack,a=this._id3Track;g&&(g.pesData=null),s&&(s.pesData=null),a&&(a.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},u.demux=function(g,s,a,i){a===void 0&&(a=!1),i===void 0&&(i=!1),a||(this.sampleAes=null);var l,T=this._avcTrack,x=this._audioTrack,L=this._id3Track,R=T.pid,I=T.pesData,F=x.pid,j=L.pid,z=x.pesData,Q=L.pesData,J=!1,ie=this.pmtParsed,pe=this._pmtId,ce=g.length;if(this.remainderData&&(g=Object(C.appendUint8Array)(this.remainderData,g),ce=g.length,this.remainderData=null),ce<188&&!i)return this.remainderData=g,{audioTrack:x,avcTrack:T,id3Track:L,textTrack:this._txtTrack};var ye=Math.max(0,c.syncOffset(g));ce-=(ce+ye)%188,ce<g.byteLength&&!i&&(this.remainderData=new Uint8Array(g.buffer,ce,g.buffer.byteLength-ce));for(var ve=ye;ve<ce;ve+=188)if(g[ve]===71){var Z=!!(g[ve+1]&64),q=((g[ve+1]&31)<<8)+g[ve+2],se=(g[ve+3]&48)>>4,V=void 0;if(se>1){if(V=ve+5+g[ve+4],V===ve+188)continue}else V=ve+4;switch(q){case R:Z&&(I&&(l=e(I))&&this.parseAVCPES(l,!1),I={data:[],size:0}),I&&(I.data.push(g.subarray(V,ve+188)),I.size+=ve+188-V);break;case F:Z&&(z&&(l=e(z))&&(x.isAAC?this.parseAACPES(l):this.parseMPEGPES(l)),z={data:[],size:0}),z&&(z.data.push(g.subarray(V,ve+188)),z.size+=ve+188-V);break;case j:Z&&(Q&&(l=e(Q))&&this.parseID3PES(l),Q={data:[],size:0}),Q&&(Q.data.push(g.subarray(V,ve+188)),Q.size+=ve+188-V);break;case 0:Z&&(V+=g[V]+1),pe=this._pmtId=y(g,V);break;case pe:{Z&&(V+=g[V]+1);var G=n(g,V,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,a);R=G.avc,R>0&&(T.pid=R),F=G.audio,F>0&&(x.pid=F,x.isAAC=G.isAAC),j=G.id3,j>0&&(L.pid=j),J&&!ie&&(d.logger.log("reparse from beginning"),J=!1,ve=ye-188),ie=this.pmtParsed=!0;break}case 17:case 8191:break;default:J=!0;break}}else this.observer.emit(S.Events.ERROR,S.Events.ERROR,{type:v.ErrorTypes.MEDIA_ERROR,details:v.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});T.pesData=I,x.pesData=z,L.pesData=Q;var be={audioTrack:x,avcTrack:T,id3Track:L,textTrack:this._txtTrack};return i&&this.extractRemainingSamples(be),be},u.flush=function(){var g=this.remainderData;this.remainderData=null;var s;return g?s=this.demux(g,-1,!1,!0):s={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(s),this.sampleAes?this.decrypt(s,this.sampleAes):s},u.extractRemainingSamples=function(g){var s=g.audioTrack,a=g.avcTrack,i=g.id3Track,l=a.pesData,T=s.pesData,x=i.pesData,L;l&&(L=e(l))?(this.parseAVCPES(L,!0),a.pesData=null):a.pesData=l,T&&(L=e(T))?(s.isAAC?this.parseAACPES(L):this.parseMPEGPES(L),s.pesData=null):(T!=null&&T.size&&d.logger.log("last AAC PES packet truncated,might overlap between fragments"),s.pesData=T),x&&(L=e(x))?(this.parseID3PES(L),i.pesData=null):i.pesData=x},u.demuxSampleAes=function(g,s,a){var i=this.demux(g,a,!0,!this.config.progressive),l=this.sampleAes=new k.default(this.observer,this.config,s);return this.decrypt(i,l)},u.decrypt=function(g,s){return new Promise(function(a){var i=g.audioTrack,l=g.avcTrack;i.samples&&i.isAAC?s.decryptAacSamples(i.samples,0,function(){l.samples?s.decryptAvcSamples(l.samples,0,0,function(){a(g)}):a(g)}):l.samples&&s.decryptAvcSamples(l.samples,0,0,function(){a(g)})})},u.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},u.parseAVCPES=function(g,s){var a=this,i=this._avcTrack,l=this.parseAVCNALu(g.data),T=!1,x=this.avcSample,L,R=!1;g.data=null,x&&l.length&&!i.audFound&&(t(x,i),x=this.avcSample=m(!1,g.pts,g.dts,"")),l.forEach(function(I){switch(I.type){case 1:{L=!0,x||(x=a.avcSample=m(!0,g.pts,g.dts,"")),T&&(x.debug+="NDR "),x.frame=!0;var F=I.data;if(R&&F.length>4){var j=new A.default(F).readSliceType();(j===2||j===4||j===7||j===9)&&(x.key=!0)}break}case 5:L=!0,x||(x=a.avcSample=m(!0,g.pts,g.dts,"")),T&&(x.debug+="IDR "),x.key=!0,x.frame=!0;break;case 6:{L=!0,T&&x&&(x.debug+="SEI ");var z=new A.default(f(I.data));z.readUByte();for(var Q=0,J=0,ie=!1,pe=0;!ie&&z.bytesAvailable>1;){Q=0;do pe=z.readUByte(),Q+=pe;while(pe===255);J=0;do pe=z.readUByte(),J+=pe;while(pe===255);if(Q===4&&z.bytesAvailable!==0){ie=!0;var ce=z.readUByte();if(ce===181){var ye=z.readUShort();if(ye===49){var ve=z.readUInt();if(ve===1195456820){var Z=z.readUByte();if(Z===3){for(var q=z.readUByte(),se=z.readUByte(),V=31&q,G=[q,se],be=0;be<V;be++)G.push(z.readUByte()),G.push(z.readUByte()),G.push(z.readUByte());r(a._txtTrack.samples,{type:3,pts:g.pts,bytes:G})}}}}}else if(Q===5&&z.bytesAvailable!==0){if(ie=!0,J>16){for(var Re=[],De=0;De<16;De++)Re.push(z.readUByte().toString(16)),(De===3||De===5||De===7||De===9)&&Re.push("-");for(var Me=J-16,X=new Uint8Array(Me),$=0;$<Me;$++)X[$]=z.readUByte();r(a._txtTrack.samples,{pts:g.pts,payloadType:Q,uuid:Re.join(""),userData:Object(N.utf8ArrayToStr)(X),userDataBytes:X})}}else if(J<z.bytesAvailable)for(var te=0;te<J;te++)z.readUByte()}break}case 7:if(L=!0,R=!0,T&&x&&(x.debug+="SPS "),!i.sps){var de=new A.default(I.data),fe=de.readSPS();i.width=fe.width,i.height=fe.height,i.pixelRatio=fe.pixelRatio,i.sps=[I.data],i.duration=a._duration;for(var we=I.data.subarray(1,4),Ie="avc1.",_e=0;_e<3;_e++){var Fe=we[_e].toString(16);Fe.length<2&&(Fe="0"+Fe),Ie+=Fe}i.codec=Ie}break;case 8:L=!0,T&&x&&(x.debug+="PPS "),i.pps||(i.pps=[I.data]);break;case 9:L=!1,i.audFound=!0,x&&t(x,i),x=a.avcSample=m(!1,g.pts,g.dts,T?"AUD ":"");break;case 12:L=!1;break;default:L=!1,x&&(x.debug+="unknown NAL "+I.type+" ");break}if(x&&L){var le=x.units;le.push(I)}}),s&&x&&(t(x,i),this.avcSample=null)},u.getLastNalUnit=function(){var g,s=this.avcSample,a;if(!s||s.units.length===0){var i=this._avcTrack.samples;s=i[i.length-1]}if((g=s)!==null&&g!==void 0&&g.units){var l=s.units;a=l[l.length-1]}return a},u.parseAVCNALu=function(g){var s=g.byteLength,a=this._avcTrack,i=a.naluState||0,l=i,T=[],x=0,L,R,I,F=-1,j=0;for(i===-1&&(F=0,j=g[0]&31,i=0,x=1);x<s;){if(L=g[x++],!i){i=L?0:1;continue}if(i===1){i=L?0:2;continue}if(!L)i=3;else if(L===1){if(F>=0){var z={data:g.subarray(F,x-i-1),type:j};T.push(z)}else{var Q=this.getLastNalUnit();if(Q&&(l&&x<=4-l&&(Q.state&&(Q.data=Q.data.subarray(0,Q.data.byteLength-l))),R=x-i-1,R>0)){var J=new Uint8Array(Q.data.byteLength+R);J.set(Q.data,0),J.set(g.subarray(0,R),Q.data.byteLength),Q.data=J,Q.state=0}}x<s?(I=g[x]&31,F=x,j=I,i=0):i=-1}else i=0}if(F>=0&&i>=0){var ie={data:g.subarray(F,s),type:j,state:i};T.push(ie)}if(T.length===0){var pe=this.getLastNalUnit();if(pe){var ce=new Uint8Array(pe.data.byteLength+g.byteLength);ce.set(pe.data,0),ce.set(g,pe.data.byteLength),pe.data=ce}}return a.naluState=i,T},u.parseAACPES=function(g){var s=0,a=this._audioTrack,i=this.aacOverFlow,l=g.data;if(i){this.aacOverFlow=null;var T=i.sample.unit.byteLength,x=Math.min(i.missing,T),L=T-x;i.sample.unit.set(l.subarray(0,x),L),a.samples.push(i.sample),s=i.missing}var R,I;for(R=s,I=l.length;R<I-1&&!_.isHeader(l,R);R++);if(R!==s){var F,j;if(R<I-1?(F="AAC PES did not start with ADTS header,offset:"+R,j=!1):(F="no ADTS header found in AAC PES",j=!0),d.logger.warn("parsing error:"+F),this.observer.emit(S.Events.ERROR,S.Events.ERROR,{type:v.ErrorTypes.MEDIA_ERROR,details:v.ErrorDetails.FRAG_PARSING_ERROR,fatal:j,reason:F}),j)return}_.initTrackConfig(a,this.observer,l,R,this.audioCodec);var z;if(g.pts!==void 0)z=g.pts;else if(i){var Q=_.getFrameDuration(a.samplerate);z=i.sample.pts+Q}else{d.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var J=0;R<I;)if(_.isHeader(l,R)){if(R+5<I){var ie=_.appendFrame(a,l,R,z,J);if(ie)if(ie.missing)this.aacOverFlow=ie;else{R+=ie.length,J++;continue}}break}else R++},u.parseMPEGPES=function(g){var s=g.data,a=s.length,i=0,l=0,T=g.pts;if(T===void 0){d.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;l<a;)if(D.isHeader(s,l)){var x=D.appendFrame(this._audioTrack,s,l,T,i);if(x)l+=x.length,i++;else break}else l++},u.parseID3PES=function(g){if(g.pts===void 0){d.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(g)},c}();p.minProbeByteLength=188;function m(c,u,E,g){return{key:c,frame:!1,pts:u,dts:E,units:[],debug:g,length:0}}function y(c,u){return(c[u+10]&31)<<8|c[u+11]}function n(c,u,E,g){var s={audio:-1,avc:-1,id3:-1,isAAC:!0},a=(c[u+1]&15)<<8|c[u+2],i=u+3+a-4,l=(c[u+10]&15)<<8|c[u+11];for(u+=12+l;u<i;){var T=(c[u+1]&31)<<8|c[u+2];switch(c[u]){case 207:if(!g){d.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:s.audio===-1&&(s.audio=T);break;case 21:s.id3===-1&&(s.id3=T);break;case 219:if(!g){d.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:s.avc===-1&&(s.avc=T);break;case 3:case 4:E?s.audio===-1&&(s.audio=T,s.isAAC=!1):d.logger.log("MPEG audio found, not supported in this browser");break;case 36:d.logger.warn("Unsupported HEVC stream type found");break;default:break}u+=((c[u+3]&15)<<8|c[u+4])+5}return s}function e(c){var u=0,E,g,s,a,i,l=c.data;if(!c||c.size===0)return null;for(;l[0].length<19&&l.length>1;){var T=new Uint8Array(l[0].length+l[1].length);T.set(l[0]),T.set(l[1],l[0].length),l[0]=T,l.splice(1,1)}E=l[0];var x=(E[0]<<16)+(E[1]<<8)+E[2];if(x===1){if(g=(E[4]<<8)+E[5],g&&g>c.size-6)return null;var L=E[7];L&192&&(a=(E[9]&14)*536870912+(E[10]&255)*4194304+(E[11]&254)*16384+(E[12]&255)*128+(E[13]&254)/2,L&64?(i=(E[14]&14)*536870912+(E[15]&255)*4194304+(E[16]&254)*16384+(E[17]&255)*128+(E[18]&254)/2,a-i>60*9e4&&(d.logger.warn(Math.round((a-i)/9e4)+"s delta between PTS and DTS, align them"),a=i)):i=a),s=E[8];var R=s+9;if(c.size<=R)return null;c.size-=R;for(var I=new Uint8Array(c.size),F=0,j=l.length;F<j;F++){E=l[F];var z=E.byteLength;if(R)if(R>z){R-=z;continue}else E=E.subarray(R),z-=R,R=0;I.set(E,u),u+=z}return g&&(g-=s+3),{data:I,pts:a,dts:i,len:g}}return null}function t(c,u){if(c.units.length&&c.frame){if(c.pts===void 0){var E=u.samples,g=E.length;if(g){var s=E[g-1];c.pts=s.pts,c.dts=s.dts}else{u.dropped++;return}}u.samples.push(c)}c.debug.length&&d.logger.log(c.pts+"/"+c.dts+":"+c.debug)}function r(c,u){var E=c.length;if(E>0){if(u.pts>=c[E-1].pts)c.push(u);else for(var g=E-1;g>=0;g--)if(u.pts<c[g].pts){c.splice(g,0,u);break}}else c.push(u)}function f(c){for(var u=c.byteLength,E=[],g=1;g<u-2;)c[g]===0&&c[g+1]===0&&c[g+2]===3?(E.push(g+2),g+=2):g++;if(E.length===0)return c;var s=u-E.length,a=new Uint8Array(s),i=0;for(g=0;g<s;i++,g++)i===E[0]&&(i++,E.shift()),a[g]=c[i];return a}B.default=p},"./src/errors.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"ErrorTypes",function(){return _}),w.d(B,"ErrorDetails",function(){return D});var _;(function(A){A.NETWORK_ERROR="networkError",A.MEDIA_ERROR="mediaError",A.KEY_SYSTEM_ERROR="keySystemError",A.MUX_ERROR="muxError",A.OTHER_ERROR="otherError"})(_||(_={}));var D;(function(A){A.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",A.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",A.KEY_SYSTEM_NO_SESSION="keySystemNoSession",A.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",A.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",A.MANIFEST_LOAD_ERROR="manifestLoadError",A.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",A.MANIFEST_PARSING_ERROR="manifestParsingError",A.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",A.LEVEL_EMPTY_ERROR="levelEmptyError",A.LEVEL_LOAD_ERROR="levelLoadError",A.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",A.LEVEL_SWITCH_ERROR="levelSwitchError",A.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",A.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",A.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",A.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",A.FRAG_LOAD_ERROR="fragLoadError",A.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",A.FRAG_DECRYPT_ERROR="fragDecryptError",A.FRAG_PARSING_ERROR="fragParsingError",A.REMUX_ALLOC_ERROR="remuxAllocError",A.KEY_LOAD_ERROR="keyLoadError",A.KEY_LOAD_TIMEOUT="keyLoadTimeOut",A.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",A.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",A.BUFFER_APPEND_ERROR="bufferAppendError",A.BUFFER_APPENDING_ERROR="bufferAppendingError",A.BUFFER_STALLED_ERROR="bufferStalledError",A.BUFFER_FULL_ERROR="bufferFullError",A.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",A.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",A.INTERNAL_EXCEPTION="internalException",A.INTERNAL_ABORTED="aborted",A.UNKNOWN="unknown"})(D||(D={}))},"./src/events.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"Events",function(){return _});var _;(function(D){D.MEDIA_ATTACHING="hlsMediaAttaching",D.MEDIA_ATTACHED="hlsMediaAttached",D.MEDIA_DETACHING="hlsMediaDetaching",D.MEDIA_DETACHED="hlsMediaDetached",D.BUFFER_RESET="hlsBufferReset",D.BUFFER_CODECS="hlsBufferCodecs",D.BUFFER_CREATED="hlsBufferCreated",D.BUFFER_APPENDING="hlsBufferAppending",D.BUFFER_APPENDED="hlsBufferAppended",D.BUFFER_EOS="hlsBufferEos",D.BUFFER_FLUSHING="hlsBufferFlushing",D.BUFFER_FLUSHED="hlsBufferFlushed",D.MANIFEST_LOADING="hlsManifestLoading",D.MANIFEST_LOADED="hlsManifestLoaded",D.MANIFEST_PARSED="hlsManifestParsed",D.LEVEL_SWITCHING="hlsLevelSwitching",D.LEVEL_SWITCHED="hlsLevelSwitched",D.LEVEL_LOADING="hlsLevelLoading",D.LEVEL_LOADED="hlsLevelLoaded",D.LEVEL_UPDATED="hlsLevelUpdated",D.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",D.LEVELS_UPDATED="hlsLevelsUpdated",D.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",D.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",D.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",D.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",D.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",D.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",D.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",D.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",D.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",D.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",D.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",D.CUES_PARSED="hlsCuesParsed",D.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",D.INIT_PTS_FOUND="hlsInitPtsFound",D.FRAG_LOADING="hlsFragLoading",D.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",D.FRAG_LOADED="hlsFragLoaded",D.FRAG_DECRYPTED="hlsFragDecrypted",D.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",D.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",D.FRAG_PARSING_METADATA="hlsFragParsingMetadata",D.FRAG_PARSED="hlsFragParsed",D.FRAG_BUFFERED="hlsFragBuffered",D.FRAG_CHANGED="hlsFragChanged",D.FPS_DROP="hlsFpsDrop",D.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",D.ERROR="hlsError",D.DESTROYING="hlsDestroying",D.KEY_LOADING="hlsKeyLoading",D.KEY_LOADED="hlsKeyLoaded",D.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",D.BACK_BUFFER_REACHED="hlsBackBufferReached"})(_||(_={}))},"./src/hls.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"default",function(){return c});var _=w("./node_modules/url-toolkit/src/url-toolkit.js"),D=w.n(_),A=w("./src/loader/playlist-loader.ts"),N=w("./src/loader/key-loader.ts"),k=w("./src/controller/id3-track-controller.ts"),S=w("./src/controller/latency-controller.ts"),C=w("./src/controller/level-controller.ts"),d=w("./src/controller/fragment-tracker.ts"),v=w("./src/controller/stream-controller.ts"),b=w("./src/is-supported.ts"),p=w("./src/utils/logger.ts"),m=w("./src/config.ts"),y=w("./node_modules/eventemitter3/index.js"),n=w.n(y),e=w("./src/events.ts"),t=w("./src/errors.ts");function r(u,E){for(var g=0;g<E.length;g++){var s=E[g];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(u,s.key,s)}}function f(u,E,g){return E&&r(u.prototype,E),g&&r(u,g),u}var c=function(){u.isSupported=function(){return Object(b.isSupported)()};function u(g){g===void 0&&(g={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new y.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 s=this.config=Object(m.mergeConfig)(u.DefaultConfig,g);this.userConfig=g,Object(p.enableLogs)(s.debug),this._autoLevelCapping=-1,s.progressive&&Object(m.enableStreamingMode)(s);var a=s.abrController,i=s.bufferController,l=s.capLevelController,T=s.fpsController,x=this.abrController=new a(this),L=this.bufferController=new i(this),R=this.capLevelController=new l(this),I=new T(this),F=new A.default(this),j=new N.default(this),z=new k.default(this),Q=this.levelController=new C.default(this),J=new d.FragmentTracker(this),ie=this.streamController=new v.default(this,J);R.setStreamController(ie),I.setStreamController(ie);var pe=[Q,ie];this.networkControllers=pe;var ce=[F,j,x,L,R,I,z,J];this.audioTrackController=this.createController(s.audioTrackController,null,pe),this.createController(s.audioStreamController,J,pe),this.subtitleTrackController=this.createController(s.subtitleTrackController,null,pe),this.createController(s.subtitleStreamController,J,pe),this.createController(s.timelineController,null,ce),this.emeController=this.createController(s.emeController,null,ce),this.cmcdController=this.createController(s.cmcdController,null,ce),this.latencyController=this.createController(S.default,null,ce),this.coreComponents=ce}var E=u.prototype;return E.createController=function(s,a,i){if(s){var l=a?new s(this,a):new s(this);return i&&i.push(l),l}return null},E.on=function(s,a,i){i===void 0&&(i=this),this._emitter.on(s,a,i)},E.once=function(s,a,i){i===void 0&&(i=this),this._emitter.once(s,a,i)},E.removeAllListeners=function(s){this._emitter.removeAllListeners(s)},E.off=function(s,a,i,l){i===void 0&&(i=this),this._emitter.off(s,a,i,l)},E.listeners=function(s){return this._emitter.listeners(s)},E.emit=function(s,a,i){return this._emitter.emit(s,a,i)},E.trigger=function(s,a){if(this.config.debug)return this.emit(s,s,a);try{return this.emit(s,s,a)}catch(i){p.logger.error("An internal error happened while handling event "+s+'. Error message: "'+i.message+'". Here is a stacktrace:',i),this.trigger(e.Events.ERROR,{type:t.ErrorTypes.OTHER_ERROR,details:t.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:s,error:i})}return!1},E.listenerCount=function(s){return this._emitter.listenerCount(s)},E.destroy=function(){p.logger.log("destroy"),this.trigger(e.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(s){return s.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(s){return s.destroy()}),this.coreComponents.length=0},E.attachMedia=function(s){p.logger.log("attachMedia"),this._media=s,this.trigger(e.Events.MEDIA_ATTACHING,{media:s})},E.detachMedia=function(){p.logger.log("detachMedia"),this.trigger(e.Events.MEDIA_DETACHING,void 0),this._media=null},E.loadSource=function(s){this.stopLoad();var a=this.media,i=this.url,l=this.url=_.buildAbsoluteURL(self.location.href,s,{alwaysNormalize:!0});p.logger.log("loadSource:"+l),a&&i&&i!==l&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(a)),this.trigger(e.Events.MANIFEST_LOADING,{url:s})},E.startLoad=function(s){s===void 0&&(s=-1),p.logger.log("startLoad("+s+")"),this.networkControllers.forEach(function(a){a.startLoad(s)})},E.stopLoad=function(){p.logger.log("stopLoad"),this.networkControllers.forEach(function(s){s.stopLoad()})},E.swapAudioCodec=function(){p.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},E.recoverMediaError=function(){p.logger.log("recoverMediaError");var s=this._media;this.detachMedia(),s&&this.attachMedia(s)},E.removeLevel=function(s,a){a===void 0&&(a=0),this.levelController.removeLevel(s,a)},f(u,[{key:"levels",get:function(){var s=this.levelController.levels;return s||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(s){p.logger.log("set currentLevel:"+s),this.loadLevel=s,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(s){p.logger.log("set nextLevel:"+s),this.levelController.manualLevel=s,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(s){p.logger.log("set loadLevel:"+s),this.levelController.manualLevel=s}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(s){this.levelController.nextLoadLevel=s}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(s){p.logger.log("set firstLevel:"+s),this.levelController.firstLevel=s}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(s){p.logger.log("set startLevel:"+s),s!==-1&&(s=Math.max(s,this.minAutoLevel)),this.levelController.startLevel=s}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(s){var a=!!s;a!==this.config.capLevelToPlayerSize&&(a?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=a)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(s){this._autoLevelCapping!==s&&(p.logger.log("set autoLevelCapping:"+s),this._autoLevelCapping=s)}},{key:"bandwidthEstimate",get:function(){var s=this.abrController.bwEstimator;return s?s.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var s=this.levels,a=this.config.minAutoBitrate;if(!s)return 0;for(var i=s.length,l=0;l<i;l++)if(s[l].maxBitrate>a)return l;return 0}},{key:"maxAutoLevel",get:function(){var s=this.levels,a=this.autoLevelCapping,i;return a===-1&&s&&s.length?i=s.length-1:i=a,i}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(s){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,s)}},{key:"audioTracks",get:function(){var s=this.audioTrackController;return s?s.audioTracks:[]}},{key:"audioTrack",get:function(){var s=this.audioTrackController;return s?s.audioTrack:-1},set:function(s){var a=this.audioTrackController;a&&(a.audioTrack=s)}},{key:"subtitleTracks",get:function(){var s=this.subtitleTrackController;return s?s.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var s=this.subtitleTrackController;return s?s.subtitleTrack:-1},set:function(s){var a=this.subtitleTrackController;a&&(a.subtitleTrack=s)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var s=this.subtitleTrackController;return s?s.subtitleDisplay:!1},set:function(s){var a=this.subtitleTrackController;a&&(a.subtitleDisplay=s)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(s){this.config.lowLatencyMode=s}},{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 t.ErrorTypes}},{key:"ErrorDetails",get:function(){return t.ErrorDetails}},{key:"DefaultConfig",get:function(){return u.defaultConfig?u.defaultConfig:m.hlsDefaultConfig},set:function(s){u.defaultConfig=s}}]),u}();c.defaultConfig=void 0},"./src/is-supported.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"isSupported",function(){return A}),w.d(B,"changeTypeSupported",function(){return N});var _=w("./src/utils/mediasource-helper.ts");function D(){return self.SourceBuffer||self.WebKitSourceBuffer}function A(){var k=Object(_.getMediaSource)();if(!k)return!1;var S=D(),C=k&&typeof k.isTypeSupported=="function"&&k.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),d=!S||S.prototype&&typeof S.prototype.appendBuffer=="function"&&typeof S.prototype.remove=="function";return!!C&&!!d}function N(){var k,S=D();return typeof(S==null||((k=S.prototype)===null||k===void 0)?void 0:k.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"default",function(){return p}),w.d(B,"LoadError",function(){return y});var _=w("./src/polyfills/number.ts"),D=w("./src/errors.ts");function A(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,d(n,e)}function N(n){var e=typeof Map=="function"?new Map:void 0;return N=function(r){if(r===null||!C(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e!="undefined"){if(e.has(r))return e.get(r);e.set(r,f)}function f(){return k(r,arguments,v(this).constructor)}return f.prototype=Object.create(r.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),d(f,r)},N(n)}function k(n,e,t){return S()?k=Reflect.construct:k=function(f,c,u){var E=[null];E.push.apply(E,c);var g=Function.bind.apply(f,E),s=new g;return u&&d(s,u.prototype),s},k.apply(null,arguments)}function S(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(n){return!1}}function C(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function d(n,e){return d=Object.setPrototypeOf||function(r,f){return r.__proto__=f,r},d(n,e)}function v(n){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},v(n)}var b=Math.pow(2,17),p=function(){function n(t){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=t}var e=n.prototype;return e.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},e.abort=function(){this.loader&&this.loader.abort()},e.load=function(r,f){var c=this,u=r.url;if(!u)return Promise.reject(new y({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:r,networkDetails:null},"Fragment does not have a "+(u?"part list":"url")));this.abort();var E=this.config,g=E.fLoader,s=E.loader;return new Promise(function(a,i){c.loader&&c.loader.destroy();var l=c.loader=r.loader=g?new g(E):new s(E),T=m(r),x={timeout:E.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:E.fragLoadingMaxRetryTimeout,highWaterMark:b};r.stats=l.stats,l.load(T,x,{onSuccess:function(R,I,F,j){c.resetLoader(r,l),a({frag:r,part:null,payload:R.data,networkDetails:j})},onError:function(R,I,F){c.resetLoader(r,l),i(new y({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:r,response:R,networkDetails:F}))},onAbort:function(R,I,F){c.resetLoader(r,l),i(new y({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:r,networkDetails:F}))},onTimeout:function(R,I,F){c.resetLoader(r,l),i(new y({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:r,networkDetails:F}))},onProgress:function(R,I,F,j){f&&f({frag:r,part:null,payload:F,networkDetails:j})}})})},e.loadPart=function(r,f,c){var u=this;this.abort();var E=this.config,g=E.fLoader,s=E.loader;return new Promise(function(a,i){u.loader&&u.loader.destroy();var l=u.loader=r.loader=g?new g(E):new s(E),T=m(r,f),x={timeout:E.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:E.fragLoadingMaxRetryTimeout,highWaterMark:b};f.stats=l.stats,l.load(T,x,{onSuccess:function(R,I,F,j){u.resetLoader(r,l),u.updateStatsFromPart(r,f);var z={frag:r,part:f,payload:R.data,networkDetails:j};c(z),a(z)},onError:function(R,I,F){u.resetLoader(r,l),i(new y({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:r,part:f,response:R,networkDetails:F}))},onAbort:function(R,I,F){r.stats.aborted=f.stats.aborted,u.resetLoader(r,l),i(new y({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:r,part:f,networkDetails:F}))},onTimeout:function(R,I,F){u.resetLoader(r,l),i(new y({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:r,part:f,networkDetails:F}))}})})},e.updateStatsFromPart=function(r,f){var c=r.stats,u=f.stats,E=u.total;if(c.loaded+=u.loaded,E){var g=Math.round(r.duration/f.duration),s=Math.min(Math.round(c.loaded/E),g),a=g-s,i=a*Math.round(c.loaded/s);c.total=c.loaded+i}else c.total=Math.max(c.loaded,c.total);var l=c.loading,T=u.loading;l.start?l.first+=T.first-T.start:(l.start=T.start,l.first=T.first),l.end=T.end},e.resetLoader=function(r,f){r.loader=null,this.loader===f&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),f.destroy()},n}();function m(n,e){e===void 0&&(e=null);var t=e||n,r={frag:n,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},f=t.byteRangeStartOffset,c=t.byteRangeEndOffset;return Object(_.isFiniteNumber)(f)&&Object(_.isFiniteNumber)(c)&&(r.rangeStart=f,r.rangeEnd=c),r}var y=function(n){A(e,n);function e(t){for(var r,f=arguments.length,c=new Array(f>1?f-1:0),u=1;u<f;u++)c[u-1]=arguments[u];return r=n.call.apply(n,[this].concat(c))||this,r.data=void 0,r.data=t,r}return e}(N(Error))},"./src/loader/fragment.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"ElementaryStreamTypes",function(){return p}),w.d(B,"BaseSegment",function(){return m}),w.d(B,"Fragment",function(){return y}),w.d(B,"Part",function(){return n});var _=w("./src/polyfills/number.ts"),D=w("./node_modules/url-toolkit/src/url-toolkit.js"),A=w.n(D),N=w("./src/utils/logger.ts"),k=w("./src/loader/level-key.ts"),S=w("./src/loader/load-stats.ts");function C(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,d(e,t)}function d(e,t){return d=Object.setPrototypeOf||function(f,c){return f.__proto__=c,f},d(e,t)}function v(e,t){for(var r=0;r<t.length;r++){var f=t[r];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(e,f.key,f)}}function b(e,t,r){return t&&v(e.prototype,t),r&&v(e,r),e}var p;(function(e){e.AUDIO="audio",e.VIDEO="video",e.AUDIOVIDEO="audiovideo"})(p||(p={}));var m=function(){function e(r){var f;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(f={},f[p.AUDIO]=null,f[p.VIDEO]=null,f[p.AUDIOVIDEO]=null,f),this.baseurl=r}var t=e.prototype;return t.setByteRange=function(f,c){var u=f.split("@",2),E=[];u.length===1?E[0]=c?c.byteRangeEndOffset:0:E[0]=parseInt(u[1]),E[1]=parseInt(u[0])+E[0],this._byteRange=E},b(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(D.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(f){this._url=f}}]),e}(),y=function(e){C(t,e);function t(f,c){var u;return u=e.call(this,c)||this,u._decryptdata=null,u.rawProgramDateTime=null,u.programDateTime=null,u.tagList=[],u.duration=0,u.sn=0,u.levelkey=void 0,u.type=void 0,u.loader=null,u.level=-1,u.cc=0,u.startPTS=void 0,u.endPTS=void 0,u.appendedPTS=void 0,u.startDTS=void 0,u.endDTS=void 0,u.start=0,u.deltaPTS=void 0,u.maxStartPTS=void 0,u.minEndPTS=void 0,u.stats=new S.LoadStats,u.urlId=0,u.data=void 0,u.bitrateTest=!1,u.title=null,u.initSegment=null,u.type=f,u}var r=t.prototype;return r.createInitializationVector=function(c){for(var u=new Uint8Array(16),E=12;E<16;E++)u[E]=c>>8*(15-E)&255;return u},r.setDecryptDataFromLevelKey=function(c,u){var E=c;return(c==null?void 0:c.method)==="AES-128"&&c.uri&&!c.iv&&(E=k.LevelKey.fromURI(c.uri),E.method=c.method,E.iv=this.createInitializationVector(u),E.keyFormat="identity"),E},r.setElementaryStreamInfo=function(c,u,E,g,s,a){a===void 0&&(a=!1);var i=this.elementaryStreams,l=i[c];if(!l){i[c]={startPTS:u,endPTS:E,startDTS:g,endDTS:s,partial:a};return}l.startPTS=Math.min(l.startPTS,u),l.endPTS=Math.max(l.endPTS,E),l.startDTS=Math.min(l.startDTS,g),l.endDTS=Math.max(l.endDTS,s)},r.clearElementaryStreamInfo=function(){var c=this.elementaryStreams;c[p.AUDIO]=null,c[p.VIDEO]=null,c[p.AUDIOVIDEO]=null},b(t,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var c=this.sn;typeof c!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&N.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),c=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,c)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(_.isFiniteNumber)(this.programDateTime))return null;var c=Object(_.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+c*1e3}},{key:"encrypted",get:function(){var c;return!!((c=this.decryptdata)!==null&&c!==void 0&&c.keyFormat&&this.decryptdata.uri)}}]),t}(m),n=function(e){C(t,e);function t(r,f,c,u,E){var g;g=e.call(this,c)||this,g.fragOffset=0,g.duration=0,g.gap=!1,g.independent=!1,g.relurl=void 0,g.fragment=void 0,g.index=void 0,g.stats=new S.LoadStats,g.duration=r.decimalFloatingPoint("DURATION"),g.gap=r.bool("GAP"),g.independent=r.bool("INDEPENDENT"),g.relurl=r.enumeratedString("URI"),g.fragment=f,g.index=u;var s=r.enumeratedString("BYTERANGE");return s&&g.setByteRange(s,E),E&&(g.fragOffset=E.fragOffset+E.duration),g}return b(t,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var f=this.elementaryStreams;return!!(f.audio||f.video||f.audiovideo)}}]),t}(m)},"./src/loader/key-loader.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"default",function(){return N});var _=w("./src/events.ts"),D=w("./src/errors.ts"),A=w("./src/utils/logger.ts"),N=function(){function k(C){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=C,this._registerListeners()}var S=k.prototype;return S._registerListeners=function(){this.hls.on(_.Events.KEY_LOADING,this.onKeyLoading,this)},S._unregisterListeners=function(){this.hls.off(_.Events.KEY_LOADING,this.onKeyLoading)},S.destroy=function(){this._unregisterListeners();for(var d in this.loaders){var v=this.loaders[d];v&&v.destroy()}this.loaders={}},S.onKeyLoading=function(d,v){var b=v.frag,p=b.type,m=this.loaders[p];if(!b.decryptdata){A.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var y=b.decryptdata.uri;if(y!==this.decrypturl||this.decryptkey===null){var n=this.hls.config;if(m&&(A.logger.warn("abort previous key loader for type:"+p),m.abort()),!y){A.logger.warn("key uri is falsy");return}var e=n.loader,t=b.loader=this.loaders[p]=new e(n);this.decrypturl=y,this.decryptkey=null;var r={url:y,frag:b,responseType:"arraybuffer"},f={timeout:n.fragLoadingTimeOut,maxRetry:0,retryDelay:n.fragLoadingRetryDelay,maxRetryDelay:n.fragLoadingMaxRetryTimeout,highWaterMark:0},c={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};t.load(r,f,c)}else this.decryptkey&&(b.decryptdata.key=this.decryptkey,this.hls.trigger(_.Events.KEY_LOADED,{frag:b}))},S.loadsuccess=function(d,v,b){var p=b.frag;if(!p.decryptdata){A.logger.error("after key load, decryptdata unset");return}this.decryptkey=p.decryptdata.key=new Uint8Array(d.data),p.loader=null,delete this.loaders[p.type],this.hls.trigger(_.Events.KEY_LOADED,{frag:p})},S.loaderror=function(d,v){var b=v.frag,p=b.loader;p&&p.abort(),delete this.loaders[b.type],this.hls.trigger(_.Events.ERROR,{type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:b,response:d})},S.loadtimeout=function(d,v){var b=v.frag,p=b.loader;p&&p.abort(),delete this.loaders[b.type],this.hls.trigger(_.Events.ERROR,{type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:b})},k}()},"./src/loader/level-details.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"LevelDetails",function(){return k});var _=w("./src/polyfills/number.ts");function D(S,C){for(var d=0;d<C.length;d++){var v=C[d];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(S,v.key,v)}}function A(S,C,d){return C&&D(S.prototype,C),d&&D(S,d),S}var N=10,k=function(){function S(d){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=d}var C=S.prototype;return C.reloaded=function(v){if(!v){this.advanced=!0,this.updated=!0;return}var b=this.lastPartSn-v.lastPartSn,p=this.lastPartIndex-v.lastPartIndex;this.updated=this.endSN!==v.endSN||!!p||!!b,this.advanced=this.endSN>v.endSN||b>0||b===0&&p>0,this.updated||this.advanced?this.misses=Math.floor(v.misses*.6):this.misses=v.misses+1,this.availabilityDelay=v.availabilityDelay},A(S,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(_.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||N}},{key:"drift",get:function(){var v=this.driftEndTime-this.driftStartTime;if(v>0){var b=this.driftEnd-this.driftStart;return b*1e3/v}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var v;return(v=this.partList)!==null&&v!==void 0&&v.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var v;return(v=this.fragments)!==null&&v!==void 0&&v.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 v;return(v=this.partList)!==null&&v!==void 0&&v.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var v;return(v=this.partList)!==null&&v!==void 0&&v.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),S}()},"./src/loader/level-key.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"LevelKey",function(){return k});var _=w("./node_modules/url-toolkit/src/url-toolkit.js"),D=w.n(_);function A(S,C){for(var d=0;d<C.length;d++){var v=C[d];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(S,v.key,v)}}function N(S,C,d){return C&&A(S.prototype,C),d&&A(S,d),S}var k=function(){S.fromURL=function(d,v){return new S(d,v)},S.fromURI=function(d){return new S(d)};function S(C,d){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,d?this._uri=Object(_.buildAbsoluteURL)(C,d,{alwaysNormalize:!0}):this._uri=C}return N(S,[{key:"uri",get:function(){return this._uri}}]),S}()},"./src/loader/load-stats.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"LoadStats",function(){return _});var _=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(ue,B,w){"use strict";w.r(B),w.d(B,"default",function(){return t});var _=w("./src/polyfills/number.ts"),D=w("./node_modules/url-toolkit/src/url-toolkit.js"),A=w.n(D),N=w("./src/loader/fragment.ts"),k=w("./src/loader/level-details.ts"),S=w("./src/loader/level-key.ts"),C=w("./src/utils/attr-list.ts"),d=w("./src/utils/logger.ts"),v=w("./src/utils/codecs.ts"),b=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,p=/#EXT-X-MEDIA:(.*)/g,m=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),y=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("|")),n=/\.(mp4|m4s|m4v|m4a)$/i;function e(E){var g,s;return n.test((g=(s=D.parseURL(E))===null||s===void 0?void 0:s.path)!=null?g:"")}var t=function(){function E(){}return E.findGroup=function(s,a){for(var i=0;i<s.length;i++){var l=s[i];if(l.id===a)return l}},E.convertAVC1ToAVCOTI=function(s){var a=s.split(".");if(a.length>2){var i=a.shift()+".";return i+=parseInt(a.shift()).toString(16),i+=("000"+parseInt(a.shift()).toString(16)).substr(-4),i}return s},E.resolve=function(s,a){return D.buildAbsoluteURL(a,s,{alwaysNormalize:!0})},E.parseMasterPlaylist=function(s,a){var i=[],l={},T=!1;b.lastIndex=0;for(var x;(x=b.exec(s))!=null;)if(x[1]){var L=new C.AttrList(x[1]),R={attrs:L,bitrate:L.decimalInteger("AVERAGE-BANDWIDTH")||L.decimalInteger("BANDWIDTH"),name:L.NAME,url:E.resolve(x[2],a)},I=L.decimalResolution("RESOLUTION");I&&(R.width=I.width,R.height=I.height),r((L.CODECS||"").split(/[ ,]+/).filter(function(j){return j}),R),R.videoCodec&&R.videoCodec.indexOf("avc1")!==-1&&(R.videoCodec=E.convertAVC1ToAVCOTI(R.videoCodec)),i.push(R)}else if(x[3]){var F=new C.AttrList(x[3]);F["DATA-ID"]&&(T=!0,l[F["DATA-ID"]]=F)}return{levels:i,sessionData:T?l:null}},E.parseMasterPlaylistMedia=function(s,a,i,l){l===void 0&&(l=[]);var T,x=[],L=0;for(p.lastIndex=0;(T=p.exec(s))!==null;){var R=new C.AttrList(T[1]);if(R.TYPE===i){var I={attrs:R,bitrate:0,id:L++,groupId:R["GROUP-ID"],instreamId:R["INSTREAM-ID"],name:R.NAME||R.LANGUAGE||"",type:i,default:R.bool("DEFAULT"),autoselect:R.bool("AUTOSELECT"),forced:R.bool("FORCED"),lang:R.LANGUAGE,url:R.URI?E.resolve(R.URI,a):""};if(l.length){var F=E.findGroup(l,I.groupId)||l[0];f(I,F,"audioCodec"),f(I,F,"textCodec")}x.push(I)}}return x},E.parseLevelPlaylist=function(s,a,i,l,T){var x=new k.LevelDetails(a),L=x.fragments,R=null,I=0,F=0,j=0,z=0,Q=null,J=new N.Fragment(l,a),ie,pe,ce,ye=-1,ve=!1;for(m.lastIndex=0,x.m3u8=s;(ie=m.exec(s))!==null;){ve&&(ve=!1,J=new N.Fragment(l,a),J.start=j,J.sn=I,J.cc=z,J.level=i,R&&(J.initSegment=R,J.rawProgramDateTime=R.rawProgramDateTime));var Z=ie[1];if(Z){J.duration=parseFloat(Z);var q=(" "+ie[2]).slice(1);J.title=q||null,J.tagList.push(q?["INF",Z,q]:["INF",Z])}else if(ie[3])Object(_.isFiniteNumber)(J.duration)&&(J.start=j,ce&&(J.levelkey=ce),J.sn=I,J.level=i,J.cc=z,J.urlId=T,L.push(J),J.relurl=(" "+ie[3]).slice(1),u(J,Q),Q=J,j+=J.duration,I++,F=0,ve=!0);else if(ie[4]){var se=(" "+ie[4]).slice(1);Q?J.setByteRange(se,Q):J.setByteRange(se)}else if(ie[5])J.rawProgramDateTime=(" "+ie[5]).slice(1),J.tagList.push(["PROGRAM-DATE-TIME",J.rawProgramDateTime]),ye===-1&&(ye=L.length);else{if(ie=ie[0].match(y),!ie){d.logger.warn("No matches on slow regex match for level playlist!");continue}for(pe=1;pe<ie.length&&!(typeof ie[pe]!="undefined");pe++);var V=(" "+ie[pe]).slice(1),G=(" "+ie[pe+1]).slice(1),be=ie[pe+2]?(" "+ie[pe+2]).slice(1):"";switch(V){case"PLAYLIST-TYPE":x.type=G.toUpperCase();break;case"MEDIA-SEQUENCE":I=x.startSN=parseInt(G);break;case"SKIP":{var Re=new C.AttrList(G),De=Re.decimalInteger("SKIPPED-SEGMENTS");if(Object(_.isFiniteNumber)(De)){x.skippedSegments=De;for(var Me=De;Me--;)L.unshift(null);I+=De}var X=Re.enumeratedString("RECENTLY-REMOVED-DATERANGES");X&&(x.recentlyRemovedDateranges=X.split(" "));break}case"TARGETDURATION":x.targetduration=parseFloat(G);break;case"VERSION":x.version=parseInt(G);break;case"EXTM3U":break;case"ENDLIST":x.live=!1;break;case"#":(G||be)&&J.tagList.push(be?[G,be]:[G]);break;case"DIS":z++;case"GAP":J.tagList.push([V]);break;case"BITRATE":J.tagList.push([V,G]);break;case"DISCONTINUITY-SEQ":z=parseInt(G);break;case"KEY":{var $,te=new C.AttrList(G),de=te.enumeratedString("METHOD"),fe=te.URI,we=te.hexadecimalInteger("IV"),Ie=te.enumeratedString("KEYFORMATVERSIONS"),_e=te.enumeratedString("KEYID"),Fe=($=te.enumeratedString("KEYFORMAT"))!=null?$:"identity",le=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(le.indexOf(Fe)>-1){d.logger.warn("Keyformat "+Fe+" is not supported from the manifest");continue}else if(Fe!=="identity")continue;de&&(ce=S.LevelKey.fromURL(a,fe),fe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(de)>=0&&(ce.method=de,ce.keyFormat=Fe,_e&&(ce.keyID=_e),Ie&&(ce.keyFormatVersions=Ie),ce.iv=we));break}case"START":{var ge=new C.AttrList(G),Ee=ge.decimalFloatingPoint("TIME-OFFSET");Object(_.isFiniteNumber)(Ee)&&(x.startTimeOffset=Ee);break}case"MAP":{var Se=new C.AttrList(G);J.relurl=Se.URI,Se.BYTERANGE&&J.setByteRange(Se.BYTERANGE),J.level=i,J.sn="initSegment",ce&&(J.levelkey=ce),J.initSegment=null,R=J,ve=!0;break}case"SERVER-CONTROL":{var Ae=new C.AttrList(G);x.canBlockReload=Ae.bool("CAN-BLOCK-RELOAD"),x.canSkipUntil=Ae.optionalFloat("CAN-SKIP-UNTIL",0),x.canSkipDateRanges=x.canSkipUntil>0&&Ae.bool("CAN-SKIP-DATERANGES"),x.partHoldBack=Ae.optionalFloat("PART-HOLD-BACK",0),x.holdBack=Ae.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Le=new C.AttrList(G);x.partTarget=Le.decimalFloatingPoint("PART-TARGET");break}case"PART":{var xe=x.partList;xe||(xe=x.partList=[]);var Oe=F>0?xe[xe.length-1]:void 0,Ue=F++,Te=new N.Part(new C.AttrList(G),J,a,Ue,Oe);xe.push(Te),J.duration+=Te.duration;break}case"PRELOAD-HINT":{var Ne=new C.AttrList(G);x.preloadHint=Ne;break}case"RENDITION-REPORT":{var oe=new C.AttrList(G);x.renditionReports=x.renditionReports||[],x.renditionReports.push(oe);break}default:d.logger.warn("line parsed but not handled: "+ie);break}}}Q&&!Q.relurl?(L.pop(),j-=Q.duration,x.partList&&(x.fragmentHint=Q)):x.partList&&(u(J,Q),J.cc=z,x.fragmentHint=J);var re=L.length,ae=L[0],W=L[re-1];if(j+=x.skippedSegments*x.targetduration,j>0&&re&&W){x.averagetargetduration=j/re;var H=W.sn;x.endSN=H!=="initSegment"?H:0,ae&&(x.startCC=ae.cc,ae.initSegment||x.fragments.every(function(Y){return Y.relurl&&e(Y.relurl)})&&(d.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),J=new N.Fragment(l,a),J.relurl=W.relurl,J.level=i,J.sn="initSegment",ae.initSegment=J,x.needSidxRanges=!0))}else x.endSN=0,x.startCC=0;return x.fragmentHint&&(j+=x.fragmentHint.duration),x.totalduration=j,x.endCC=z,ye>0&&c(L,ye),x},E}();function r(E,g){["video","audio","text"].forEach(function(s){var a=E.filter(function(l){return Object(v.isCodecType)(l,s)});if(a.length){var i=a.filter(function(l){return l.lastIndexOf("avc1",0)===0||l.lastIndexOf("mp4a",0)===0});g[s+"Codec"]=i.length>0?i[0]:a[0],E=E.filter(function(l){return a.indexOf(l)===-1})}}),g.unknownCodecs=E}function f(E,g,s){var a=g[s];a&&(E[s]=a)}function c(E,g){for(var s=E[g],a=g;a--;){var i=E[a];if(!i)return;i.programDateTime=s.programDateTime-i.duration*1e3,s=i}}function u(E,g){E.rawProgramDateTime?E.programDateTime=Date.parse(E.rawProgramDateTime):g!=null&&g.programDateTime&&(E.programDateTime=g.endProgramDateTime),Object(_.isFiniteNumber)(E.programDateTime)||(E.programDateTime=null,E.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ue,B,w){"use strict";w.r(B);var _=w("./src/polyfills/number.ts"),D=w("./src/events.ts"),A=w("./src/errors.ts"),N=w("./src/utils/logger.ts"),k=w("./src/utils/mp4-tools.ts"),S=w("./src/loader/m3u8-parser.ts"),C=w("./src/types/loader.ts"),d=w("./src/utils/attr-list.ts");function v(m){var y=m.type;switch(y){case C.PlaylistContextType.AUDIO_TRACK:return C.PlaylistLevelType.AUDIO;case C.PlaylistContextType.SUBTITLE_TRACK:return C.PlaylistLevelType.SUBTITLE;default:return C.PlaylistLevelType.MAIN}}function b(m,y){var n=m.url;return(n===void 0||n.indexOf("data:")===0)&&(n=y.url),n}var p=function(){function m(n){this.hls=void 0,this.loaders=Object.create(null),this.hls=n,this.registerListeners()}var y=m.prototype;return y.registerListeners=function(){var e=this.hls;e.on(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(D.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(D.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(D.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},y.unregisterListeners=function(){var e=this.hls;e.off(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(D.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(D.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(D.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},y.createInternalLoader=function(e){var t=this.hls.config,r=t.pLoader,f=t.loader,c=r||f,u=new c(t);return e.loader=u,this.loaders[e.type]=u,u},y.getInternalLoader=function(e){return this.loaders[e.type]},y.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},y.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},y.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},y.onManifestLoading=function(e,t){var r=t.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:C.PlaylistContextType.MANIFEST,url:r,deliveryDirectives:null})},y.onLevelLoading=function(e,t){var r=t.id,f=t.level,c=t.url,u=t.deliveryDirectives;this.load({id:r,groupId:null,level:f,responseType:"text",type:C.PlaylistContextType.LEVEL,url:c,deliveryDirectives:u})},y.onAudioTrackLoading=function(e,t){var r=t.id,f=t.groupId,c=t.url,u=t.deliveryDirectives;this.load({id:r,groupId:f,level:null,responseType:"text",type:C.PlaylistContextType.AUDIO_TRACK,url:c,deliveryDirectives:u})},y.onSubtitleTrackLoading=function(e,t){var r=t.id,f=t.groupId,c=t.url,u=t.deliveryDirectives;this.load({id:r,groupId:f,level:null,responseType:"text",type:C.PlaylistContextType.SUBTITLE_TRACK,url:c,deliveryDirectives:u})},y.load=function(e){var t,r=this.hls.config,f=this.getInternalLoader(e);if(f){var c=f.context;if(c&&c.url===e.url){N.logger.trace("[playlist-loader]: playlist request ongoing");return}N.logger.log("[playlist-loader]: aborting previous loader for type: "+e.type),f.abort()}var u,E,g,s;switch(e.type){case C.PlaylistContextType.MANIFEST:u=r.manifestLoadingMaxRetry,E=r.manifestLoadingTimeOut,g=r.manifestLoadingRetryDelay,s=r.manifestLoadingMaxRetryTimeout;break;case C.PlaylistContextType.LEVEL:case C.PlaylistContextType.AUDIO_TRACK:case C.PlaylistContextType.SUBTITLE_TRACK:u=0,E=r.levelLoadingTimeOut;break;default:u=r.levelLoadingMaxRetry,E=r.levelLoadingTimeOut,g=r.levelLoadingRetryDelay,s=r.levelLoadingMaxRetryTimeout;break}if(f=this.createInternalLoader(e),(t=e.deliveryDirectives)!==null&&t!==void 0&&t.part){var a;if(e.type===C.PlaylistContextType.LEVEL&&e.level!==null?a=this.hls.levels[e.level].details:e.type===C.PlaylistContextType.AUDIO_TRACK&&e.id!==null?a=this.hls.audioTracks[e.id].details:e.type===C.PlaylistContextType.SUBTITLE_TRACK&&e.id!==null&&(a=this.hls.subtitleTracks[e.id].details),a){var i=a.partTarget,l=a.targetduration;i&&l&&(E=Math.min(Math.max(i*3,l*.8)*1e3,E))}}var T={timeout:E,maxRetry:u,retryDelay:g,maxRetryDelay:s,highWaterMark:0},x={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};f.load(e,T,x)},y.loadsuccess=function(e,t,r,f){if(f===void 0&&(f=null),r.isSidxRequest){this.handleSidxRequest(e,r),this.handlePlaylistLoaded(e,t,r,f);return}this.resetInternalLoader(r.type);var c=e.data;if(c.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(e,r,"no EXTM3U delimiter",f);return}t.parsing.start=performance.now(),c.indexOf("#EXTINF:")>0||c.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(e,t,r,f):this.handleMasterPlaylist(e,t,r,f)},y.loaderror=function(e,t,r){r===void 0&&(r=null),this.handleNetworkError(t,r,!1,e)},y.loadtimeout=function(e,t,r){r===void 0&&(r=null),this.handleNetworkError(t,r,!0)},y.handleMasterPlaylist=function(e,t,r,f){var c=this.hls,u=e.data,E=b(e,r),g=S.default.parseMasterPlaylist(u,E),s=g.levels,a=g.sessionData;if(!s.length){this.handleManifestParsingError(e,r,"no level found in manifest",f);return}var i=s.map(function(I){return{id:I.attrs.AUDIO,audioCodec:I.audioCodec}}),l=s.map(function(I){return{id:I.attrs.SUBTITLES,textCodec:I.textCodec}}),T=S.default.parseMasterPlaylistMedia(u,E,"AUDIO",i),x=S.default.parseMasterPlaylistMedia(u,E,"SUBTITLES",l),L=S.default.parseMasterPlaylistMedia(u,E,"CLOSED-CAPTIONS");if(T.length){var R=T.some(function(I){return!I.url});!R&&s[0].audioCodec&&!s[0].attrs.AUDIO&&(N.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),T.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new d.AttrList({}),bitrate:0,url:""}))}c.trigger(D.Events.MANIFEST_LOADED,{levels:s,audioTracks:T,subtitles:x,captions:L,url:E,stats:t,networkDetails:f,sessionData:a})},y.handleTrackOrLevelPlaylist=function(e,t,r,f){var c=this.hls,u=r.id,E=r.level,g=r.type,s=b(e,r),a=Object(_.isFiniteNumber)(u)?u:0,i=Object(_.isFiniteNumber)(E)?E:a,l=v(r),T=S.default.parseLevelPlaylist(e.data,s,i,l,a);if(!T.fragments.length){c.trigger(D.Events.ERROR,{type:A.ErrorTypes.NETWORK_ERROR,details:A.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:s,reason:"no fragments found in level",level:typeof r.level=="number"?r.level:void 0});return}if(g===C.PlaylistContextType.MANIFEST){var x={attrs:new d.AttrList({}),bitrate:0,details:T,name:"",url:s};c.trigger(D.Events.MANIFEST_LOADED,{levels:[x],audioTracks:[],url:s,stats:t,networkDetails:f,sessionData:null})}if(t.parsing.end=performance.now(),T.needSidxRanges){var L,R=(L=T.fragments[0].initSegment)===null||L===void 0?void 0:L.url;this.load({url:R,isSidxRequest:!0,type:g,level:E,levelDetails:T,id:u,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}r.levelDetails=T,this.handlePlaylistLoaded(e,t,r,f)},y.handleSidxRequest=function(e,t){var r=Object(k.parseSegmentIndex)(new Uint8Array(e.data));if(!r)return;var f=r.references,c=t.levelDetails;f.forEach(function(u,E){var g=u.info,s=c.fragments[E];s.byteRange.length===0&&s.setByteRange(String(1+g.end-g.start)+"@"+String(g.start)),s.initSegment&&s.initSegment.setByteRange(String(r.moovEndOffset)+"@0")})},y.handleManifestParsingError=function(e,t,r,f){this.hls.trigger(D.Events.ERROR,{type:A.ErrorTypes.NETWORK_ERROR,details:A.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:t.type===C.PlaylistContextType.MANIFEST,url:e.url,reason:r,response:e,context:t,networkDetails:f})},y.handleNetworkError=function(e,t,r,f){r===void 0&&(r=!1),N.logger.warn("[playlist-loader]: A network "+(r?"timeout":"error")+" occurred while loading "+e.type+" level: "+e.level+" id: "+e.id+' group-id: "'+e.groupId+'"');var c=A.ErrorDetails.UNKNOWN,u=!1,E=this.getInternalLoader(e);switch(e.type){case C.PlaylistContextType.MANIFEST:c=r?A.ErrorDetails.MANIFEST_LOAD_TIMEOUT:A.ErrorDetails.MANIFEST_LOAD_ERROR,u=!0;break;case C.PlaylistContextType.LEVEL:c=r?A.ErrorDetails.LEVEL_LOAD_TIMEOUT:A.ErrorDetails.LEVEL_LOAD_ERROR,u=!1;break;case C.PlaylistContextType.AUDIO_TRACK:c=r?A.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:A.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case C.PlaylistContextType.SUBTITLE_TRACK:c=r?A.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:A.ErrorDetails.SUBTITLE_LOAD_ERROR,u=!1;break}E&&this.resetInternalLoader(e.type);var g={type:A.ErrorTypes.NETWORK_ERROR,details:c,fatal:u,url:e.url,loader:E,context:e,networkDetails:t};f&&(g.response=f),this.hls.trigger(D.Events.ERROR,g)},y.handlePlaylistLoaded=function(e,t,r,f){var c=r.type,u=r.level,E=r.id,g=r.groupId,s=r.loader,a=r.levelDetails,i=r.deliveryDirectives;if(!(a!=null&&a.targetduration)){this.handleManifestParsingError(e,r,"invalid target duration",f);return}if(!s)return;a.live&&(s.getCacheAge&&(a.ageHeader=s.getCacheAge()||0),(!s.getCacheAge||isNaN(a.ageHeader))&&(a.ageHeader=0));switch(c){case C.PlaylistContextType.MANIFEST:case C.PlaylistContextType.LEVEL:this.hls.trigger(D.Events.LEVEL_LOADED,{details:a,level:u||0,id:E||0,stats:t,networkDetails:f,deliveryDirectives:i});break;case C.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(D.Events.AUDIO_TRACK_LOADED,{details:a,id:E||0,groupId:g||"",stats:t,networkDetails:f,deliveryDirectives:i});break;case C.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(D.Events.SUBTITLE_TRACK_LOADED,{details:a,id:E||0,groupId:g||"",stats:t,networkDetails:f,deliveryDirectives:i});break}},m}();B.default=p},"./src/polyfills/number.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"isFiniteNumber",function(){return _}),w.d(B,"MAX_SAFE_INTEGER",function(){return D});var _=Number.isFinite||function(A){return typeof A=="number"&&isFinite(A)},D=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ue,B,w){"use strict";w.r(B);var _=function(){function D(){}return D.getSilentFrame=function(N,k){switch(N){case"mp4a.40.2":if(k===1)return new Uint8Array([0,200,0,128,35,128]);if(k===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(k===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(k===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(k===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(k===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(k===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(k===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(k===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},D}();B.default=_},"./src/remux/mp4-generator.ts":function(ue,B,w){"use strict";w.r(B);var _=Math.pow(2,32)-1,D=function(){function A(){}return A.init=function(){A.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var k;for(k in A.types)A.types.hasOwnProperty(k)&&(A.types[k]=[k.charCodeAt(0),k.charCodeAt(1),k.charCodeAt(2),k.charCodeAt(3)]);var S=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),C=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);A.HDLR_TYPES={video:S,audio:C};var d=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),v=new Uint8Array([0,0,0,0,0,0,0,0]);A.STTS=A.STSC=A.STCO=v,A.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),A.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),A.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),A.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var b=new Uint8Array([105,115,111,109]),p=new Uint8Array([97,118,99,49]),m=new Uint8Array([0,0,0,1]);A.FTYP=A.box(A.types.ftyp,b,m,b,p),A.DINF=A.box(A.types.dinf,A.box(A.types.dref,d))},A.box=function(k){for(var S=8,C=arguments.length,d=new Array(C>1?C-1:0),v=1;v<C;v++)d[v-1]=arguments[v];for(var b=d.length,p=b;b--;)S+=d[b].byteLength;var m=new Uint8Array(S);for(m[0]=S>>24&255,m[1]=S>>16&255,m[2]=S>>8&255,m[3]=S&255,m.set(k,4),b=0,S=8;b<p;b++)m.set(d[b],S),S+=d[b].byteLength;return m},A.hdlr=function(k){return A.box(A.types.hdlr,A.HDLR_TYPES[k])},A.mdat=function(k){return A.box(A.types.mdat,k)},A.mdhd=function(k,S){S*=k;var C=Math.floor(S/(_+1)),d=Math.floor(S%(_+1));return A.box(A.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,C>>24,C>>16&255,C>>8&255,C&255,d>>24,d>>16&255,d>>8&255,d&255,85,196,0,0]))},A.mdia=function(k){return A.box(A.types.mdia,A.mdhd(k.timescale,k.duration),A.hdlr(k.type),A.minf(k))},A.mfhd=function(k){return A.box(A.types.mfhd,new Uint8Array([0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255]))},A.minf=function(k){return k.type==="audio"?A.box(A.types.minf,A.box(A.types.smhd,A.SMHD),A.DINF,A.stbl(k)):A.box(A.types.minf,A.box(A.types.vmhd,A.VMHD),A.DINF,A.stbl(k))},A.moof=function(k,S,C){return A.box(A.types.moof,A.mfhd(k),A.traf(C,S))},A.moov=function(k){for(var S=k.length,C=[];S--;)C[S]=A.trak(k[S]);return A.box.apply(null,[A.types.moov,A.mvhd(k[0].timescale,k[0].duration)].concat(C).concat(A.mvex(k)))},A.mvex=function(k){for(var S=k.length,C=[];S--;)C[S]=A.trex(k[S]);return A.box.apply(null,[A.types.mvex].concat(C))},A.mvhd=function(k,S){S*=k;var C=Math.floor(S/(_+1)),d=Math.floor(S%(_+1)),v=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,C>>24,C>>16&255,C>>8&255,C&255,d>>24,d>>16&255,d>>8&255,d&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 A.box(A.types.mvhd,v)},A.sdtp=function(k){var S=k.samples||[],C=new Uint8Array(4+S.length),d,v;for(d=0;d<S.length;d++)v=S[d].flags,C[d+4]=v.dependsOn<<4|v.isDependedOn<<2|v.hasRedundancy;return A.box(A.types.sdtp,C)},A.stbl=function(k){return A.box(A.types.stbl,A.stsd(k),A.box(A.types.stts,A.STTS),A.box(A.types.stsc,A.STSC),A.box(A.types.stsz,A.STSZ),A.box(A.types.stco,A.STCO))},A.avc1=function(k){var S=[],C=[],d,v,b;for(d=0;d<k.sps.length;d++)v=k.sps[d],b=v.byteLength,S.push(b>>>8&255),S.push(b&255),S=S.concat(Array.prototype.slice.call(v));for(d=0;d<k.pps.length;d++)v=k.pps[d],b=v.byteLength,C.push(b>>>8&255),C.push(b&255),C=C.concat(Array.prototype.slice.call(v));var p=A.box(A.types.avcC,new Uint8Array([1,S[3],S[4],S[5],252|3,224|k.sps.length].concat(S).concat([k.pps.length]).concat(C))),m=k.width,y=k.height,n=k.pixelRatio[0],e=k.pixelRatio[1];return A.box(A.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,m>>8&255,m&255,y>>8&255,y&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]),p,A.box(A.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),A.box(A.types.pasp,new Uint8Array([n>>24,n>>16&255,n>>8&255,n&255,e>>24,e>>16&255,e>>8&255,e&255])))},A.esds=function(k){var S=k.config.length;return new Uint8Array([0,0,0,0,3,23+S,0,1,0,4,15+S,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([S]).concat(k.config).concat([6,1,2]))},A.mp4a=function(k){var S=k.samplerate;return A.box(A.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,k.channelCount,0,16,0,0,0,0,S>>8&255,S&255,0,0]),A.box(A.types.esds,A.esds(k)))},A.mp3=function(k){var S=k.samplerate;return A.box(A.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,k.channelCount,0,16,0,0,0,0,S>>8&255,S&255,0,0]))},A.stsd=function(k){return k.type==="audio"?!k.isAAC&&k.codec==="mp3"?A.box(A.types.stsd,A.STSD,A.mp3(k)):A.box(A.types.stsd,A.STSD,A.mp4a(k)):A.box(A.types.stsd,A.STSD,A.avc1(k))},A.tkhd=function(k){var S=k.id,C=k.duration*k.timescale,d=k.width,v=k.height,b=Math.floor(C/(_+1)),p=Math.floor(C%(_+1));return A.box(A.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,S>>24&255,S>>16&255,S>>8&255,S&255,0,0,0,0,b>>24,b>>16&255,b>>8&255,b&255,p>>24,p>>16&255,p>>8&255,p&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,d>>8&255,d&255,0,0,v>>8&255,v&255,0,0]))},A.traf=function(k,S){var C=A.sdtp(k),d=k.id,v=Math.floor(S/(_+1)),b=Math.floor(S%(_+1));return A.box(A.types.traf,A.box(A.types.tfhd,new Uint8Array([0,0,0,0,d>>24,d>>16&255,d>>8&255,d&255])),A.box(A.types.tfdt,new Uint8Array([1,0,0,0,v>>24,v>>16&255,v>>8&255,v&255,b>>24,b>>16&255,b>>8&255,b&255])),A.trun(k,C.length+16+20+8+16+8+8),C)},A.trak=function(k){return k.duration=k.duration||4294967295,A.box(A.types.trak,A.tkhd(k),A.mdia(k))},A.trex=function(k){var S=k.id;return A.box(A.types.trex,new Uint8Array([0,0,0,0,S>>24,S>>16&255,S>>8&255,S&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},A.trun=function(k,S){var C=k.samples||[],d=C.length,v=12+16*d,b=new Uint8Array(v),p,m,y,n,e,t;for(S+=8+v,b.set([0,0,15,1,d>>>24&255,d>>>16&255,d>>>8&255,d&255,S>>>24&255,S>>>16&255,S>>>8&255,S&255],0),p=0;p<d;p++)m=C[p],y=m.duration,n=m.size,e=m.flags,t=m.cts,b.set([y>>>24&255,y>>>16&255,y>>>8&255,y&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255,e.isLeading<<2|e.dependsOn,e.isDependedOn<<6|e.hasRedundancy<<4|e.paddingValue<<1|e.isNonSync,e.degradPrio&240<<8,e.degradPrio&15,t>>>24&255,t>>>16&255,t>>>8&255,t&255],12+16*p);return A.box(A.types.trun,b)},A.initSegment=function(k){A.types||A.init();var S=A.moov(k),C=new Uint8Array(A.FTYP.byteLength+S.byteLength);return C.set(A.FTYP),C.set(S,A.FTYP.byteLength),C},A}();D.types=void 0,D.HDLR_TYPES=void 0,D.STTS=void 0,D.STSC=void 0,D.STCO=void 0,D.STSZ=void 0,D.VMHD=void 0,D.SMHD=void 0,D.STSD=void 0,D.FTYP=void 0,D.DINF=void 0,B.default=D},"./src/remux/mp4-remuxer.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"default",function(){return t}),w.d(B,"normalizePts",function(){return r});var _=w("./src/polyfills/number.ts"),D=w("./src/remux/aac-helper.ts"),A=w("./src/remux/mp4-generator.ts"),N=w("./src/events.ts"),k=w("./src/errors.ts"),S=w("./src/utils/logger.ts"),C=w("./src/types/loader.ts"),d=w("./src/utils/timescale-conversion.ts");function v(){return v=Object.assign||function(E){for(var g=1;g<arguments.length;g++){var s=arguments[g];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(E[a]=s[a])}return E},v.apply(this,arguments)}var b=10*1e3,p=1024,m=1152,y=null,n=null,e=!1,t=function(){function E(s,a,i,l){if(l===void 0&&(l=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=s,this.config=a,this.typeSupported=i,this.ISGenerated=!1,y===null){var T=navigator.userAgent||"",x=T.match(/Chrome\/(\d+)/i);y=x?parseInt(x[1]):0}if(n===null){var L=navigator.userAgent.match(/Safari\/(\d+)/i);n=L?parseInt(L[1]):0}e=!!y&&y<75||!!n&&n<600}var g=E.prototype;return g.destroy=function(){},g.resetTimeStamp=function(a){S.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=a},g.resetNextTimestamp=function(){S.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},g.resetInitSegment=function(){S.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},g.getVideoStartPts=function(a){var i=!1,l=a.reduce(function(T,x){var L=x.pts-T;return L<-4294967296?(i=!0,r(T,x.pts)):L>0?T:x.pts},a[0].pts);return i&&S.logger.debug("PTS rollover detected"),l},g.remux=function(a,i,l,T,x,L,R,I){var F,j,z,Q,J,ie,pe=x,ce=x,ye=a.pid>-1,ve=i.pid>-1,Z=i.samples.length,q=a.samples.length>0,se=Z>1,V=(!ye||q)&&(!ve||se)||this.ISGenerated||R;if(V){this.ISGenerated||(z=this.generateIS(a,i,x));var G=this.isVideoContiguous,be=-1;if(se&&(be=f(i.samples),!G&&this.config.forceKeyFrameOnDiscontinuity))if(ie=!0,be>0){S.logger.warn("[mp4-remuxer]: Dropped "+be+" out of "+Z+" video samples due to a missing keyframe");var Re=this.getVideoStartPts(i.samples);i.samples=i.samples.slice(be),i.dropped+=be,ce+=(i.samples[0].pts-Re)/(i.timescale||9e4)}else be===-1&&(S.logger.warn("[mp4-remuxer]: No keyframe found out of "+Z+" video samples"),ie=!1);if(this.ISGenerated){if(q&&se){var De=this.getVideoStartPts(i.samples),Me=r(a.samples[0].pts,De)-De,X=Me/i.inputTimeScale;pe+=Math.max(0,X),ce+=Math.max(0,-X)}if(q){if(a.samplerate||(S.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),z=this.generateIS(a,i,x)),j=this.remuxAudio(a,pe,this.isAudioContiguous,L,ve||se||I===C.PlaylistLevelType.AUDIO?ce:void 0),se){var $=j?j.endPTS-j.startPTS:0;i.inputTimeScale||(S.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),z=this.generateIS(a,i,x)),F=this.remuxVideo(i,ce,G,$)}}else se&&(F=this.remuxVideo(i,ce,G,0));F&&(F.firstKeyFrame=be,F.independent=be!==-1)}}return this.ISGenerated&&(l.samples.length&&(J=this.remuxID3(l,x)),T.samples.length&&(Q=this.remuxText(T,x))),{audio:j,video:F,initSegment:z,independent:ie,text:Q,id3:J}},g.generateIS=function(a,i,l){var T=a.samples,x=i.samples,L=this.typeSupported,R={},I=!Object(_.isFiniteNumber)(this._initPTS),F="audio/mp4",j,z,Q;if(I&&(j=z=Infinity),a.config&&T.length&&(a.timescale=a.samplerate,a.isAAC||(L.mpeg?(F="audio/mpeg",a.codec=""):L.mp3&&(a.codec="mp3")),R.audio={id:"audio",container:F,codec:a.codec,initSegment:!a.isAAC&&L.mpeg?new Uint8Array(0):A.default.initSegment([a]),metadata:{channelCount:a.channelCount}},I&&(Q=a.inputTimeScale,j=z=T[0].pts-Math.round(Q*l))),i.sps&&i.pps&&x.length&&(i.timescale=i.inputTimeScale,R.video={id:"main",container:"video/mp4",codec:i.codec,initSegment:A.default.initSegment([i]),metadata:{width:i.width,height:i.height}},I)){Q=i.inputTimeScale;var J=this.getVideoStartPts(x),ie=Math.round(Q*l);z=Math.min(z,r(x[0].dts,J)-ie),j=Math.min(j,J-ie)}if(Object.keys(R).length)return this.ISGenerated=!0,I&&(this._initPTS=j,this._initDTS=z),{tracks:R,initPTS:j,timescale:Q}},g.remuxVideo=function(a,i,l,T){var x=a.inputTimeScale,L=a.samples,R=[],I=L.length,F=this._initPTS,j=this.nextAvcDts,z=8,Q,J,ie,pe=Number.POSITIVE_INFINITY,ce=Number.NEGATIVE_INFINITY,ye=0,ve=!1;if(!l||j===null){var Z=i*x,q=L[0].pts-r(L[0].dts,L[0].pts);j=Z-q}for(var se=0;se<I;se++){var V=L[se];if(V.pts=r(V.pts-F,j),V.dts=r(V.dts-F,j),V.dts>V.pts){var G=9e4*.2;ye=Math.max(Math.min(ye,V.pts-V.dts),-1*G)}V.dts<L[se>0?se-1:se].dts&&(ve=!0)}ve&&L.sort(function(qe,at){var Je=qe.dts-at.dts,Ct=qe.pts-at.pts;return Je||Ct}),J=L[0].dts,ie=L[L.length-1].dts;var be=Math.round((ie-J)/(I-1));if(ye<0){if(ye<be*-2){S.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(d.toMsFromMpegTsClock)(-be,!0)+" ms");for(var Re=ye,De=0;De<I;De++)L[De].dts=Re=Math.max(Re,L[De].pts-be),L[De].pts=Math.max(Re,L[De].pts)}else{S.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(d.toMsFromMpegTsClock)(ye,!0)+" ms to overcome this issue");for(var Me=0;Me<I;Me++)L[Me].dts=L[Me].dts+ye}J=L[0].dts}if(l){var X=J-j,$=X>be,te=X<-1;if($||te){$?S.logger.warn("AVC: "+Object(d.toMsFromMpegTsClock)(X,!0)+" ms ("+X+"dts) hole between fragments detected, filling it"):S.logger.warn("AVC: "+Object(d.toMsFromMpegTsClock)(-X,!0)+" ms ("+X+"dts) overlapping between fragments detected"),J=j;var de=L[0].pts-X;L[0].dts=J,L[0].pts=de,S.logger.log("Video: First PTS/DTS adjusted: "+Object(d.toMsFromMpegTsClock)(de,!0)+"/"+Object(d.toMsFromMpegTsClock)(J,!0)+", delta: "+Object(d.toMsFromMpegTsClock)(X,!0)+" ms")}}e&&(J=Math.max(0,J));for(var fe=0,we=0,Ie=0;Ie<I;Ie++){for(var _e=L[Ie],Fe=_e.units,le=Fe.length,ge=0,Ee=0;Ee<le;Ee++)ge+=Fe[Ee].data.length;we+=ge,fe+=le,_e.length=ge,_e.dts=Math.max(_e.dts,J),_e.pts=Math.max(_e.pts,_e.dts,0),pe=Math.min(_e.pts,pe),ce=Math.max(_e.pts,ce)}ie=L[I-1].dts;var Se=we+4*fe+8,Ae;try{Ae=new Uint8Array(Se)}catch(qe){this.observer.emit(N.Events.ERROR,N.Events.ERROR,{type:k.ErrorTypes.MUX_ERROR,details:k.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Se,reason:"fail allocating video mdat "+Se});return}var Le=new DataView(Ae.buffer);Le.setUint32(0,Se),Ae.set(A.default.types.mdat,4);for(var xe=0;xe<I;xe++){for(var Oe=L[xe],Ue=Oe.units,Te=0,Ne=0,oe=Ue.length;Ne<oe;Ne++){var re=Ue[Ne],ae=re.data,W=re.data.byteLength;Le.setUint32(z,W),z+=4,Ae.set(ae,z),z+=W,Te+=4+W}if(xe<I-1)Q=L[xe+1].dts-Oe.dts;else{var H=this.config,Y=Oe.dts-L[xe>0?xe-1:xe].dts;if(H.stretchShortVideoTrack&&this.nextAudioPts!==null){var ee=Math.floor(H.maxBufferHole*x),me=(T?pe+T*x:this.nextAudioPts)-Oe.pts;me>ee?(Q=me-Y,Q<0&&(Q=Y),S.logger.log("[mp4-remuxer]: It is approximately "+me/90+" ms to the next segment; using duration "+Q/90+" ms for the last video frame.")):Q=Y}else Q=Y}var Ce=Math.round(Oe.pts-Oe.dts);R.push(new c(Oe.key,Q,Te,Ce))}if(R.length&&y&&y<70){var Be=R[0].flags;Be.dependsOn=2,Be.isNonSync=0}console.assert(Q!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=j=ie+Q,this.isVideoContiguous=!0;var Ge=A.default.moof(a.sequenceNumber++,J,v({},a,{samples:R})),Qe="video",Ve={data1:Ge,data2:Ae,startPTS:pe/x,endPTS:(ce+Q)/x,startDTS:J/x,endDTS:j/x,type:Qe,hasAudio:!1,hasVideo:!0,nb:R.length,dropped:a.dropped};return a.samples=[],a.dropped=0,console.assert(Ae.length,"MDAT length must not be zero"),Ve},g.remuxAudio=function(a,i,l,T,x){var L=a.inputTimeScale,R=a.samplerate?a.samplerate:L,I=L/R,F=a.isAAC?p:m,j=F*I,z=this._initPTS,Q=!a.isAAC&&this.typeSupported.mpeg,J=[],ie=a.samples,pe=Q?0:8,ce=this.nextAudioPts||-1,ye=i*L;if(this.isAudioContiguous=l=l||ie.length&&ce>0&&(T&&Math.abs(ye-ce)<9e3||Math.abs(r(ie[0].pts-z,ye)-ce)<20*j),ie.forEach(function(ae){ae.pts=r(ae.pts-z,ye)}),!l||ce<0){if(ie=ie.filter(function(ae){return ae.pts>=0}),!ie.length)return;x===0?ce=0:T?ce=Math.max(0,ye):ce=ie[0].pts}if(a.isAAC)for(var ve=x!==void 0,Z=this.config.maxAudioFramesDrift,q=0,se=ce;q<ie.length;q++){var V=ie[q],G=V.pts,be=G-se,Re=Math.abs(1e3*be/L);if(be<=-Z*j&&ve)q===0&&(S.logger.warn("Audio frame @ "+(G/L).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*be/L)+" ms."),this.nextAudioPts=ce=se=G);else if(be>=Z*j&&Re<b&&ve){var De=Math.round(be/j);se=G-De*j,se<0&&(De--,se+=j),q===0&&(this.nextAudioPts=ce=se),S.logger.warn("[mp4-remuxer]: Injecting "+De+" audio frame @ "+(se/L).toFixed(3)+"s due to "+Math.round(1e3*be/L)+" ms gap.");for(var Me=0;Me<De;Me++){var X=Math.max(se,0),$=D.default.getSilentFrame(a.manifestCodec||a.codec,a.channelCount);$||(S.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),$=V.unit.subarray()),ie.splice(q,0,{unit:$,pts:X}),se+=j,q++}}V.pts=se,se+=j}for(var te=null,de=null,fe,we=0,Ie=ie.length;Ie--;)we+=ie[Ie].unit.byteLength;for(var _e=0,Fe=ie.length;_e<Fe;_e++){var le=ie[_e],ge=le.unit,Ee=le.pts;if(de!==null){var Se=J[_e-1];Se.duration=Math.round((Ee-de)/I)}else if(l&&a.isAAC&&(Ee=ce),te=Ee,we>0){we+=pe;try{fe=new Uint8Array(we)}catch(ae){this.observer.emit(N.Events.ERROR,N.Events.ERROR,{type:k.ErrorTypes.MUX_ERROR,details:k.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:we,reason:"fail allocating audio mdat "+we});return}if(!Q){var Ae=new DataView(fe.buffer);Ae.setUint32(0,we),fe.set(A.default.types.mdat,4)}}else return;fe.set(ge,pe);var Le=ge.byteLength;pe+=Le,J.push(new c(!0,F,Le,0)),de=Ee}var xe=J.length;if(!xe)return;var Oe=J[J.length-1];this.nextAudioPts=ce=de+I*Oe.duration;var Ue=Q?new Uint8Array(0):A.default.moof(a.sequenceNumber++,te/I,v({},a,{samples:J}));a.samples=[];var Te=te/L,Ne=ce/L,oe="audio",re={data1:Ue,data2:fe,startPTS:Te,endPTS:Ne,startDTS:Te,endDTS:Ne,type:oe,hasAudio:!0,hasVideo:!1,nb:xe};return this.isAudioContiguous=!0,console.assert(fe.length,"MDAT length must not be zero"),re},g.remuxEmptyAudio=function(a,i,l,T){var x=a.inputTimeScale,L=a.samplerate?a.samplerate:x,R=x/L,I=this.nextAudioPts,F=(I!==null?I:T.startDTS*x)+this._initDTS,j=T.endDTS*x+this._initDTS,z=R*p,Q=Math.ceil((j-F)/z),J=D.default.getSilentFrame(a.manifestCodec||a.codec,a.channelCount);if(S.logger.warn("[mp4-remuxer]: remux empty Audio"),!J){S.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ie=[],pe=0;pe<Q;pe++){var ce=F+pe*z;ie.push({unit:J,pts:ce,dts:ce})}return a.samples=ie,this.remuxAudio(a,i,l,!1)},g.remuxID3=function(a,i){var l=a.samples.length;if(!l)return;for(var T=a.inputTimeScale,x=this._initPTS,L=this._initDTS,R=0;R<l;R++){var I=a.samples[R];I.pts=r(I.pts-x,i*T)/T,I.dts=r(I.dts-L,i*T)/T}var F=a.samples;return a.samples=[],{samples:F}},g.remuxText=function(a,i){var l=a.samples.length;if(!l)return;for(var T=a.inputTimeScale,x=this._initPTS,L=0;L<l;L++){var R=a.samples[L];R.pts=r(R.pts-x,i*T)/T}a.samples.sort(function(F,j){return F.pts-j.pts});var I=a.samples;return a.samples=[],{samples:I}},E}();function r(E,g){var s;if(g===null)return E;for(g<E?s=-8589934592:s=8589934592;Math.abs(E-g)>4294967296;)E+=s;return E}function f(E){for(var g=0;g<E.length;g++)if(E[g].key)return g;return-1}var c=function(g,s,a,i){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=s,this.size=a,this.cts=i,this.flags=new u(g)},u=function(g){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=g?2:1,this.isNonSync=g?0:1}},"./src/remux/passthrough-remuxer.ts":function(ue,B,w){"use strict";w.r(B);var _=w("./src/polyfills/number.ts"),D=w("./src/utils/mp4-tools.ts"),A=w("./src/loader/fragment.ts"),N=w("./src/utils/logger.ts"),k=function(){function d(){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 v=d.prototype;return v.destroy=function(){},v.resetTimeStamp=function(p){this.initPTS=p,this.lastEndDTS=null},v.resetNextTimestamp=function(){this.lastEndDTS=null},v.resetInitSegment=function(p,m,y){this.audioCodec=m,this.videoCodec=y,this.generateInitSegment(p),this.emitInitSegment=!0},v.generateInitSegment=function(p){var m=this.audioCodec,y=this.videoCodec;if(!p||!p.byteLength){this.initTracks=void 0,this.initData=void 0;return}var n=this.initData=Object(D.parseInitSegment)(p);m||(m=C(n.audio,A.ElementaryStreamTypes.AUDIO)),y||(y=C(n.video,A.ElementaryStreamTypes.VIDEO));var e={};n.audio&&n.video?e.audiovideo={container:"video/mp4",codec:m+","+y,initSegment:p,id:"main"}:n.audio?e.audio={container:"audio/mp4",codec:m,initSegment:p,id:"audio"}:n.video?e.video={container:"video/mp4",codec:y,initSegment:p,id:"main"}:N.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=e},v.remux=function(p,m,y,n,e){var t=this.initPTS,r=this.lastEndDTS,f={audio:void 0,video:void 0,text:n,id3:y,initSegment:void 0};Object(_.isFiniteNumber)(r)||(r=this.lastEndDTS=e||0);var c=m.samples;if(!c||!c.length)return f;var u={initPTS:void 0,timescale:1},E=this.initData;if((!E||!E.length)&&(this.generateInitSegment(c),E=this.initData),!E||!E.length)return N.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),f;this.emitInitSegment&&(u.tracks=this.initTracks,this.emitInitSegment=!1),Object(_.isFiniteNumber)(t)||(this.initPTS=u.initPTS=t=S(E,c,r));var g=Object(D.getDuration)(c,E),s=r,a=g+s;Object(D.offsetStartDTS)(E,c,t),g>0?this.lastEndDTS=a:(N.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var i=!!E.audio,l=!!E.video,T="";i&&(T+="audio"),l&&(T+="video");var x={data1:c,startPTS:s,startDTS:s,endPTS:a,endDTS:a,type:T,hasAudio:i,hasVideo:l,nb:1,dropped:0};return f.audio=x.type==="audio"?x:void 0,f.video=x.type!=="audio"?x:void 0,f.text=n,f.id3=y,f.initSegment=u,f},d}(),S=function(v,b,p){return Object(D.getStartDTS)(v,b)-p};function C(d,v){var b=d==null?void 0:d.codec;return b&&b.length>4?b:b==="hvc1"?"hvc1.1.c.L120.90":b==="av01"?"av01.0.04M.08":b==="avc1"||v===A.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}B.default=k},"./src/task-loop.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"default",function(){return _});var _=function(){function D(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var A=D.prototype;return A.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},A.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},A.onHandlerDestroyed=function(){},A.hasInterval=function(){return!!this._tickInterval},A.hasNextTick=function(){return!!this._tickTimer},A.setInterval=function(k){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,k),!0)},A.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},A.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},A.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},A.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},A.doTick=function(){},D}()},"./src/types/cmcd.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"CMCDVersion",function(){return _}),w.d(B,"CMCDObjectType",function(){return D}),w.d(B,"CMCDStreamingFormat",function(){return A}),w.d(B,"CMCDStreamType",function(){return N});var _=1,D;(function(k){k.MANIFEST="m",k.AUDIO="a",k.VIDEO="v",k.MUXED="av",k.INIT="i",k.CAPTION="c",k.TIMED_TEXT="tt",k.KEY="k",k.OTHER="o"})(D||(D={}));var A;(function(k){k.DASH="d",k.HLS="h",k.SMOOTH="s",k.OTHER="o"})(A||(A={}));var N;(function(k){k.VOD="v",k.LIVE="l"})(N||(N={}))},"./src/types/level.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"HlsSkip",function(){return A}),w.d(B,"getSkipValue",function(){return N}),w.d(B,"HlsUrlParameters",function(){return k}),w.d(B,"Level",function(){return S});function _(C,d){for(var v=0;v<d.length;v++){var b=d[v];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(C,b.key,b)}}function D(C,d,v){return d&&_(C.prototype,d),v&&_(C,v),C}var A;(function(C){C.No="",C.Yes="YES",C.v2="v2"})(A||(A={}));function N(C,d){var v=C.canSkipUntil,b=C.canSkipDateRanges,p=C.endSN,m=d!==void 0?d-p:0;return v&&m<v?b?A.v2:A.Yes:A.No}var k=function(){function C(v,b,p){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=v,this.part=b,this.skip=p}var d=C.prototype;return d.addDirectives=function(b){var p=new self.URL(b);return this.msn!==void 0&&p.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&p.searchParams.set("_HLS_part",this.part.toString()),this.skip&&p.searchParams.set("_HLS_skip",this.skip),p.toString()},C}(),S=function(){function C(d){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=[d.url],this.attrs=d.attrs,this.bitrate=d.bitrate,d.details&&(this.details=d.details),this.id=d.id||0,this.name=d.name,this.width=d.width||0,this.height=d.height||0,this.audioCodec=d.audioCodec,this.videoCodec=d.videoCodec,this.unknownCodecs=d.unknownCodecs,this.codecSet=[d.videoCodec,d.audioCodec].filter(function(v){return v}).join(",").replace(/\.[^.,]+/g,"")}return D(C,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(v){var b=v%this.url.length;this._urlId!==b&&(this.details=void 0,this._urlId=b)}}]),C}()},"./src/types/loader.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"PlaylistContextType",function(){return _}),w.d(B,"PlaylistLevelType",function(){return D});var _;(function(A){A.MANIFEST="manifest",A.LEVEL="level",A.AUDIO_TRACK="audioTrack",A.SUBTITLE_TRACK="subtitleTrack"})(_||(_={}));var D;(function(A){A.MAIN="main",A.AUDIO="audio",A.SUBTITLE="subtitle"})(D||(D={}))},"./src/types/transmuxer.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"ChunkMetadata",function(){return _});var _=function(N,k,S,C,d,v){C===void 0&&(C=0),d===void 0&&(d=-1),v===void 0&&(v=!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=D(),this.buffering={audio:D(),video:D(),audiovideo:D()},this.level=N,this.sn=k,this.id=S,this.size=C,this.part=d,this.partial=v};function D(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"AttrList",function(){return A});var _=/^(\d+)x(\d+)$/,D=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,A=function(){function N(S){typeof S=="string"&&(S=N.parseAttrList(S));for(var C in S)S.hasOwnProperty(C)&&(this[C]=S[C])}var k=N.prototype;return k.decimalInteger=function(C){var d=parseInt(this[C],10);return d>Number.MAX_SAFE_INTEGER?Infinity:d},k.hexadecimalInteger=function(C){if(this[C]){var d=(this[C]||"0x").slice(2);d=(d.length&1?"0":"")+d;for(var v=new Uint8Array(d.length/2),b=0;b<d.length/2;b++)v[b]=parseInt(d.slice(b*2,b*2+2),16);return v}else return null},k.hexadecimalIntegerAsNumber=function(C){var d=parseInt(this[C],16);return d>Number.MAX_SAFE_INTEGER?Infinity:d},k.decimalFloatingPoint=function(C){return parseFloat(this[C])},k.optionalFloat=function(C,d){var v=this[C];return v?parseFloat(v):d},k.enumeratedString=function(C){return this[C]},k.bool=function(C){return this[C]==="YES"},k.decimalResolution=function(C){var d=_.exec(this[C]);return d===null?void 0:{width:parseInt(d[1],10),height:parseInt(d[2],10)}},N.parseAttrList=function(C){var d,v={},b='"';for(D.lastIndex=0;(d=D.exec(C))!==null;){var p=d[2];p.indexOf(b)===0&&p.lastIndexOf(b)===p.length-1&&(p=p.slice(1,-1)),v[d[1]]=p}return v},N}()},"./src/utils/binary-search.ts":function(ue,B,w){"use strict";w.r(B);var _={search:function(A,N){for(var k=0,S=A.length-1,C=null,d=null;k<=S;){C=(k+S)/2|0,d=A[C];var v=N(d);if(v>0)k=C+1;else if(v<0)S=C-1;else return d}return null}};B.default=_},"./src/utils/buffer-helper.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"BufferHelper",function(){return A});var _=w("./src/utils/logger.ts"),D={length:0,start:function(){return 0},end:function(){return 0}},A=function(){function N(){}return N.isBuffered=function(S,C){try{if(S){for(var d=N.getBuffered(S),v=0;v<d.length;v++)if(C>=d.start(v)&&C<=d.end(v))return!0}}catch(b){}return!1},N.bufferInfo=function(S,C,d){try{if(S){var v=N.getBuffered(S),b=[],p;for(p=0;p<v.length;p++)b.push({start:v.start(p),end:v.end(p)});return this.bufferedInfo(b,C,d)}}catch(m){}return{len:0,start:C,end:C,nextStart:void 0}},N.bufferedInfo=function(S,C,d){C=Math.max(0,C),S.sort(function(u,E){var g=u.start-E.start;return g||E.end-u.end});var v=[];if(d)for(var b=0;b<S.length;b++){var p=v.length;if(p){var m=v[p-1].end;S[b].start-m<d?S[b].end>m&&(v[p-1].end=S[b].end):v.push(S[b])}else v.push(S[b])}else v=S;for(var y=0,n,e=C,t=C,r=0;r<v.length;r++){var f=v[r].start,c=v[r].end;if(C+d>=f&&C<c)e=f,t=c,y=t-C;else if(C+d<f){n=f;break}}return{len:y,start:e||0,end:t||0,nextStart:n}},N.getBuffered=function(S){try{return S.buffered}catch(C){return _.logger.log("failed to get media.buffered",C),D}},N}()},"./src/utils/cea-608-parser.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"Row",function(){return t}),w.d(B,"CaptionScreen",function(){return r});var _=w("./src/utils/logger.ts"),D={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},A=function(a){var i=a;return D.hasOwnProperty(a)&&(i=D[a]),String.fromCharCode(i)},N=15,k=100,S={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},C={17:2,18:4,21:6,22:8,23:10,19:13,20:15},d={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},v={25:2,26:4,29:6,30:8,31:10,27:13,28:15},b=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],p;(function(s){s[s.ERROR=0]="ERROR",s[s.TEXT=1]="TEXT",s[s.WARNING=2]="WARNING",s[s.INFO=2]="INFO",s[s.DEBUG=3]="DEBUG",s[s.DATA=3]="DATA"})(p||(p={}));var m=function(){function s(){this.time=null,this.verboseLevel=p.ERROR}var a=s.prototype;return a.log=function(l,T){this.verboseLevel>=l&&_.logger.log(this.time+" ["+l+"] "+T)},s}(),y=function(a){for(var i=[],l=0;l<a.length;l++)i.push(a[l].toString(16));return i},n=function(){function s(i,l,T,x,L){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=i||"white",this.underline=l||!1,this.italics=T||!1,this.background=x||"black",this.flash=L||!1}var a=s.prototype;return a.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},a.setStyles=function(l){for(var T=["foreground","underline","italics","background","flash"],x=0;x<T.length;x++){var L=T[x];l.hasOwnProperty(L)&&(this[L]=l[L])}},a.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},a.equals=function(l){return this.foreground===l.foreground&&this.underline===l.underline&&this.italics===l.italics&&this.background===l.background&&this.flash===l.flash},a.copy=function(l){this.foreground=l.foreground,this.underline=l.underline,this.italics=l.italics,this.background=l.background,this.flash=l.flash},a.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},s}(),e=function(){function s(i,l,T,x,L,R){this.uchar=void 0,this.penState=void 0,this.uchar=i||" ",this.penState=new n(l,T,x,L,R)}var a=s.prototype;return a.reset=function(){this.uchar=" ",this.penState.reset()},a.setChar=function(l,T){this.uchar=l,this.penState.copy(T)},a.setPenState=function(l){this.penState.copy(l)},a.equals=function(l){return this.uchar===l.uchar&&this.penState.equals(l.penState)},a.copy=function(l){this.uchar=l.uchar,this.penState.copy(l.penState)},a.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},s}(),t=function(){function s(i){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var l=0;l<k;l++)this.chars.push(new e);this.logger=i,this.pos=0,this.currPenState=new n}var a=s.prototype;return a.equals=function(l){for(var T=!0,x=0;x<k;x++)if(!this.chars[x].equals(l.chars[x])){T=!1;break}return T},a.copy=function(l){for(var T=0;T<k;T++)this.chars[T].copy(l.chars[T])},a.isEmpty=function(){for(var l=!0,T=0;T<k;T++)if(!this.chars[T].isEmpty()){l=!1;break}return l},a.setCursor=function(l){this.pos!==l&&(this.pos=l),this.pos<0?(this.logger.log(p.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>k&&(this.logger.log(p.DEBUG,"Too large cursor position "+this.pos),this.pos=k)},a.moveCursor=function(l){var T=this.pos+l;if(l>1)for(var x=this.pos+1;x<T+1;x++)this.chars[x].setPenState(this.currPenState);this.setCursor(T)},a.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},a.insertChar=function(l){l>=144&&this.backSpace();var T=A(l);if(this.pos>=k){this.logger.log(p.ERROR,"Cannot insert "+l.toString(16)+" ("+T+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(T,this.currPenState),this.moveCursor(1)},a.clearFromPos=function(l){var T;for(T=l;T<k;T++)this.chars[T].reset()},a.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},a.clearToEndOfRow=function(){this.clearFromPos(this.pos)},a.getTextString=function(){for(var l=[],T=!0,x=0;x<k;x++){var L=this.chars[x].uchar;L!==" "&&(T=!1),l.push(L)}return T?"":l.join("")},a.setPenStyles=function(l){this.currPenState.setStyles(l);var T=this.chars[this.pos];T.setPenState(this.currPenState)},s}(),r=function(){function s(i){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var l=0;l<N;l++)this.rows.push(new t(i));this.logger=i,this.currRow=N-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var a=s.prototype;return a.reset=function(){for(var l=0;l<N;l++)this.rows[l].clear();this.currRow=N-1},a.equals=function(l){for(var T=!0,x=0;x<N;x++)if(!this.rows[x].equals(l.rows[x])){T=!1;break}return T},a.copy=function(l){for(var T=0;T<N;T++)this.rows[T].copy(l.rows[T])},a.isEmpty=function(){for(var l=!0,T=0;T<N;T++)if(!this.rows[T].isEmpty()){l=!1;break}return l},a.backSpace=function(){var l=this.rows[this.currRow];l.backSpace()},a.clearToEndOfRow=function(){var l=this.rows[this.currRow];l.clearToEndOfRow()},a.insertChar=function(l){var T=this.rows[this.currRow];T.insertChar(l)},a.setPen=function(l){var T=this.rows[this.currRow];T.setPenStyles(l)},a.moveCursor=function(l){var T=this.rows[this.currRow];T.moveCursor(l)},a.setCursor=function(l){this.logger.log(p.INFO,"setCursor: "+l);var T=this.rows[this.currRow];T.setCursor(l)},a.setPAC=function(l){this.logger.log(p.INFO,"pacData = "+JSON.stringify(l));var T=l.row-1;if(this.nrRollUpRows&&T<this.nrRollUpRows-1&&(T=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==T){for(var x=0;x<N;x++)this.rows[x].clear();var L=this.currRow+1-this.nrRollUpRows,R=this.lastOutputScreen;if(R){var I=R.rows[L].cueStartTime,F=this.logger.time;if(I&&F!==null&&I<F)for(var j=0;j<this.nrRollUpRows;j++)this.rows[T-this.nrRollUpRows+j+1].copy(R.rows[L+j])}}this.currRow=T;var z=this.rows[this.currRow];if(l.indent!==null){var Q=l.indent,J=Math.max(Q-1,0);z.setCursor(l.indent),l.color=z.chars[J].penState.foreground}var ie={foreground:l.color,underline:l.underline,italics:l.italics,background:"black",flash:!1};this.setPen(ie)},a.setBkgData=function(l){this.logger.log(p.INFO,"bkgData = "+JSON.stringify(l)),this.backSpace(),this.setPen(l),this.insertChar(32)},a.setRollUpRows=function(l){this.nrRollUpRows=l},a.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(p.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(p.TEXT,this.getDisplayText());var l=this.currRow+1-this.nrRollUpRows,T=this.rows.splice(l,1)[0];T.clear(),this.rows.splice(this.currRow,0,T),this.logger.log(p.INFO,"Rolling up")},a.getDisplayText=function(l){l=l||!1;for(var T=[],x="",L=-1,R=0;R<N;R++){var I=this.rows[R].getTextString();I&&(L=R+1,l?T.push("Row "+L+": '"+I+"'"):T.push(I.trim()))}return T.length>0&&(l?x="["+T.join(" | ")+"]":x=T.join(`
`)),x},a.getTextAndFormat=function(){return this.rows},s}(),f=function(){function s(i,l,T){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=i,this.outputFilter=l,this.mode=null,this.verbose=0,this.displayedMemory=new r(T),this.nonDisplayedMemory=new r(T),this.lastOutputScreen=new r(T),this.currRollUpRow=this.displayedMemory.rows[N-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=T}var a=s.prototype;return a.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[N-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},a.getHandler=function(){return this.outputFilter},a.setHandler=function(l){this.outputFilter=l},a.setPAC=function(l){this.writeScreen.setPAC(l)},a.setBkgData=function(l){this.writeScreen.setBkgData(l)},a.setMode=function(l){if(l===this.mode)return;this.mode=l,this.logger.log(p.INFO,"MODE="+l),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=l},a.insertChars=function(l){for(var T=0;T<l.length;T++)this.writeScreen.insertChar(l[T]);var x=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(p.INFO,x+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(p.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},a.ccRCL=function(){this.logger.log(p.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},a.ccBS=function(){if(this.logger.log(p.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},a.ccAOF=function(){},a.ccAON=function(){},a.ccDER=function(){this.logger.log(p.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},a.ccRU=function(l){this.logger.log(p.INFO,"RU("+l+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(l)},a.ccFON=function(){this.logger.log(p.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},a.ccRDC=function(){this.logger.log(p.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},a.ccTR=function(){this.logger.log(p.INFO,"TR"),this.setMode("MODE_TEXT")},a.ccRTD=function(){this.logger.log(p.INFO,"RTD"),this.setMode("MODE_TEXT")},a.ccEDM=function(){this.logger.log(p.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},a.ccCR=function(){this.logger.log(p.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},a.ccENM=function(){this.logger.log(p.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},a.ccEOC=function(){if(this.logger.log(p.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var l=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=l,this.writeScreen=this.nonDisplayedMemory,this.logger.log(p.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},a.ccTO=function(l){this.logger.log(p.INFO,"TO("+l+") - Tab Offset"),this.writeScreen.moveCursor(l)},a.ccMIDROW=function(l){var T={flash:!1};if(T.underline=l%2===1,T.italics=l>=46,T.italics)T.foreground="white";else{var x=Math.floor(l/2)-16,L=["white","green","blue","cyan","red","yellow","magenta"];T.foreground=L[x]}this.logger.log(p.INFO,"MIDROW: "+JSON.stringify(T)),this.writeScreen.setPen(T)},a.outputDataUpdate=function(l){l===void 0&&(l=!1);var T=this.logger.time;if(T===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=T:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,T,this.lastOutputScreen),l&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:T),this.lastOutputScreen.copy(this.displayedMemory))},a.cueSplitAtTime=function(l){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,l,this.displayedMemory),this.cueStartTime=l))},s}(),c=function(){function s(i,l,T){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var x=new m;this.channels=[null,new f(i,l,x),new f(i+1,T,x)],this.cmdHistory=g(),this.logger=x}var a=s.prototype;return a.getHandler=function(l){return this.channels[l].getHandler()},a.setHandler=function(l,T){this.channels[l].setHandler(T)},a.addData=function(l,T){var x,L,R,I=!1;this.logger.time=l;for(var F=0;F<T.length;F+=2){if(L=T[F]&127,R=T[F+1]&127,L===0&&R===0)continue;if(this.logger.log(p.DATA,"["+y([T[F],T[F+1]])+"] -> ("+y([L,R])+")"),x=this.parseCmd(L,R),x||(x=this.parseMidrow(L,R)),x||(x=this.parsePAC(L,R)),x||(x=this.parseBackgroundAttributes(L,R)),!x&&(I=this.parseChars(L,R),I)){var j=this.currentChannel;if(j&&j>0){var z=this.channels[j];z.insertChars(I)}else this.logger.log(p.WARNING,"No channel found yet. TEXT-MODE?")}!x&&!I&&this.logger.log(p.WARNING,"Couldn't parse cleaned data "+y([L,R])+" orig: "+y([T[F],T[F+1]]))}},a.parseCmd=function(l,T){var x=this.cmdHistory,L=(l===20||l===28||l===21||l===29)&&T>=32&&T<=47,R=(l===23||l===31)&&T>=33&&T<=35;if(!(L||R))return!1;if(E(l,T,x))return u(null,null,x),this.logger.log(p.DEBUG,"Repeated command ("+y([l,T])+") is dropped"),!0;var I=l===20||l===21||l===23?1:2,F=this.channels[I];return l===20||l===21||l===28||l===29?T===32?F.ccRCL():T===33?F.ccBS():T===34?F.ccAOF():T===35?F.ccAON():T===36?F.ccDER():T===37?F.ccRU(2):T===38?F.ccRU(3):T===39?F.ccRU(4):T===40?F.ccFON():T===41?F.ccRDC():T===42?F.ccTR():T===43?F.ccRTD():T===44?F.ccEDM():T===45?F.ccCR():T===46?F.ccENM():T===47&&F.ccEOC():F.ccTO(T-32),u(l,T,x),this.currentChannel=I,!0},a.parseMidrow=function(l,T){var x=0;if((l===17||l===25)&&T>=32&&T<=47){if(l===17?x=1:x=2,x!==this.currentChannel)return this.logger.log(p.ERROR,"Mismatch channel in midrow parsing"),!1;var L=this.channels[x];return L?(L.ccMIDROW(T),this.logger.log(p.DEBUG,"MIDROW ("+y([l,T])+")"),!0):!1}return!1},a.parsePAC=function(l,T){var x,L=this.cmdHistory,R=(l>=17&&l<=23||l>=25&&l<=31)&&T>=64&&T<=127,I=(l===16||l===24)&&T>=64&&T<=95;if(!(R||I))return!1;if(E(l,T,L))return u(null,null,L),!0;var F=l<=23?1:2;T>=64&&T<=95?x=F===1?S[l]:d[l]:x=F===1?C[l]:v[l];var j=this.channels[F];return j?(j.setPAC(this.interpretPAC(x,T)),u(l,T,L),this.currentChannel=F,!0):!1},a.interpretPAC=function(l,T){var x,L={color:null,italics:!1,indent:null,underline:!1,row:l};return T>95?x=T-96:x=T-64,L.underline=(x&1)===1,x<=13?L.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(x/2)]:x<=15?(L.italics=!0,L.color="white"):L.indent=Math.floor((x-16)/2)*4,L},a.parseChars=function(l,T){var x,L=null,R=null;if(l>=25?(x=2,R=l-8):(x=1,R=l),R>=17&&R<=19){var I;R===17?I=T+80:R===18?I=T+112:I=T+144,this.logger.log(p.INFO,"Special char '"+A(I)+"' in channel "+x),L=[I]}else l>=32&&l<=127&&(L=T===0?[l]:[l,T]);if(L){var F=y(L);this.logger.log(p.DEBUG,"Char codes = "+F.join(",")),u(l,T,this.cmdHistory)}return L},a.parseBackgroundAttributes=function(l,T){var x=(l===16||l===24)&&T>=32&&T<=47,L=(l===23||l===31)&&T>=45&&T<=47;if(!(x||L))return!1;var R,I={};l===16||l===24?(R=Math.floor((T-32)/2),I.background=b[R],T%2===1&&(I.background=I.background+"_semi")):T===45?I.background="transparent":(I.foreground="black",T===47&&(I.underline=!0));var F=l<=23?1:2,j=this.channels[F];return j.setBkgData(I),u(l,T,this.cmdHistory),!0},a.reset=function(){for(var l=0;l<Object.keys(this.channels).length;l++){var T=this.channels[l];T&&T.reset()}this.cmdHistory=g()},a.cueSplitAtTime=function(l){for(var T=0;T<this.channels.length;T++){var x=this.channels[T];x&&x.cueSplitAtTime(l)}},s}();function u(s,a,i){i.a=s,i.b=a}function E(s,a,i){return i.a===s&&i.b===a}function g(){return{a:null,b:null}}B.default=c},"./src/utils/codecs.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"isCodecType",function(){return D}),w.d(B,"isCodecSupportedInMp4",function(){return A});var _={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 D(N,k){var S=_[k];return!!S&&S[N.slice(0,4)]===!0}function A(N,k){return MediaSource.isTypeSupported((k||"video")+'/mp4;codecs="'+N+'"')}},"./src/utils/cues.ts":function(ue,B,w){"use strict";w.r(B);var _=w("./src/utils/vttparser.ts"),D=w("./src/utils/webvtt-parser.ts"),A=w("./src/utils/texttrack-utils.ts"),N=/\s/,k={newCue:function(C,d,v,b){for(var p=[],m,y,n,e,t,r=self.VTTCue||self.TextTrackCue,f=0;f<b.rows.length;f++)if(m=b.rows[f],n=!0,e=0,t="",!m.isEmpty()){for(var c=0;c<m.chars.length;c++)N.test(m.chars[c].uchar)&&n?e++:(t+=m.chars[c].uchar,n=!1);m.cueStartTime=d,d===v&&(v+=1e-4),e>=16?e--:e++;var u=Object(_.fixLineBreaks)(t.trim()),E=Object(D.generateCueId)(d,v,u);(!C||!C.cues||!C.cues.getCueById(E))&&(y=new r(d,v,u),y.id=E,y.line=f+1,y.align="left",y.position=10+Math.min(80,Math.floor(e*8/32)*10),p.push(y))}return C&&p.length&&(p.sort(function(g,s){return g.line==="auto"||s.line==="auto"?0:g.line>8&&s.line>8?s.line-g.line:g.line-s.line}),p.forEach(function(g){return Object(A.addCueToTrack)(C,g)})),p}};B.default=k},"./src/utils/discontinuities.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"findFirstFragWithCC",function(){return N}),w.d(B,"shouldAlignOnDiscontinuities",function(){return k}),w.d(B,"findDiscontinuousReferenceFrag",function(){return S}),w.d(B,"adjustSlidingStart",function(){return d}),w.d(B,"alignStream",function(){return v}),w.d(B,"alignPDT",function(){return p}),w.d(B,"alignFragmentByPDTDelta",function(){return m}),w.d(B,"alignMediaPlaylistByPDT",function(){return y});var _=w("./src/polyfills/number.ts"),D=w("./src/utils/logger.ts"),A=w("./src/controller/level-helper.ts");function N(n,e){for(var t=null,r=0,f=n.length;r<f;r++){var c=n[r];if(c&&c.cc===e){t=c;break}}return t}function k(n,e,t){return!!(e.details&&(t.endCC>t.startCC||n&&n.cc<t.startCC))}function S(n,e){var t=n.fragments,r=e.fragments;if(!r.length||!t.length){D.logger.log("No fragments to align");return}var f=N(t,r[0].cc);if(!f||f&&!f.startPTS){D.logger.log("No frag in previous level to align on");return}return f}function C(n,e){if(n){var t=n.start+e;n.start=n.startPTS=t,n.endPTS=t+n.duration}}function d(n,e){for(var t=e.fragments,r=0,f=t.length;r<f;r++)C(t[r],n);e.fragmentHint&&C(e.fragmentHint,n),e.alignedSliding=!0}function v(n,e,t){if(!e)return;b(n,t,e),!t.alignedSliding&&e.details&&p(t,e.details),!t.alignedSliding&&e.details&&!t.skippedSegments&&Object(A.adjustSliding)(e.details,t)}function b(n,e,t){if(k(n,t,e)){var r=S(t.details,e);r&&Object(_.isFiniteNumber)(r.start)&&(D.logger.log("Adjusting PTS using last level due to CC increase within current level "+e.url),d(r.start,e))}}function p(n,e){if(!e.fragments.length||!n.hasProgramDateTime||!e.hasProgramDateTime)return;var t=e.fragments[0].programDateTime,r=n.fragments[0].programDateTime,f=(r-t)/1e3+e.fragments[0].start;f&&Object(_.isFiniteNumber)(f)&&(D.logger.log("Adjusting PTS using programDateTime delta "+(r-t)+"ms, sliding:"+f.toFixed(3)+" "+n.url+" "),d(f,n))}function m(n,e){var t=n.programDateTime;if(!t)return;var r=(t-e)/1e3;n.start=n.startPTS=r,n.endPTS=r+n.duration}function y(n,e){if(!e.fragments.length||!n.hasProgramDateTime||!e.hasProgramDateTime)return;var t=e.fragments[0].programDateTime,r=e.fragments[0].start,f=t-r*1e3;n.fragments.forEach(function(c){m(c,f)}),n.fragmentHint&&m(n.fragmentHint,f),n.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ue,B,w){"use strict";w.r(B);var _=w("./src/utils/ewma.ts"),D=function(){function A(k,S,C){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=C,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new _.default(k),this.fast_=new _.default(S)}var N=A.prototype;return N.update=function(S,C){var d=this.slow_,v=this.fast_;this.slow_.halfLife!==S&&(this.slow_=new _.default(S,d.getEstimate(),d.getTotalWeight())),this.fast_.halfLife!==C&&(this.fast_=new _.default(C,v.getEstimate(),v.getTotalWeight()))},N.sample=function(S,C){S=Math.max(S,this.minDelayMs_);var d=8*C,v=S/1e3,b=d/v;this.fast_.sample(v,b),this.slow_.sample(v,b)},N.canEstimate=function(){var S=this.fast_;return S&&S.getTotalWeight()>=this.minWeight_},N.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},N.destroy=function(){},A}();B.default=D},"./src/utils/ewma.ts":function(ue,B,w){"use strict";w.r(B);var _=function(){function D(N,k,S){k===void 0&&(k=0),S===void 0&&(S=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=N,this.alpha_=N?Math.exp(Math.log(.5)/N):0,this.estimate_=k,this.totalWeight_=S}var A=D.prototype;return A.sample=function(k,S){var C=Math.pow(this.alpha_,k);this.estimate_=S*(1-C)+C*this.estimate_,this.totalWeight_+=k},A.getTotalWeight=function(){return this.totalWeight_},A.getEstimate=function(){if(this.alpha_){var k=1-Math.pow(this.alpha_,this.totalWeight_);if(k)return this.estimate_/k}return this.estimate_},D}();B.default=_},"./src/utils/fetch-loader.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"fetchSupported",function(){return m});var _=w("./src/polyfills/number.ts"),D=w("./src/loader/load-stats.ts"),A=w("./src/demux/chunk-cache.ts");function N(r,f){r.prototype=Object.create(f.prototype),r.prototype.constructor=r,v(r,f)}function k(r){var f=typeof Map=="function"?new Map:void 0;return k=function(u){if(u===null||!d(u))return u;if(typeof u!="function")throw new TypeError("Super expression must either be null or a function");if(typeof f!="undefined"){if(f.has(u))return f.get(u);f.set(u,E)}function E(){return S(u,arguments,b(this).constructor)}return E.prototype=Object.create(u.prototype,{constructor:{value:E,enumerable:!1,writable:!0,configurable:!0}}),v(E,u)},k(r)}function S(r,f,c){return C()?S=Reflect.construct:S=function(E,g,s){var a=[null];a.push.apply(a,g);var i=Function.bind.apply(E,a),l=new i;return s&&v(l,s.prototype),l},S.apply(null,arguments)}function C(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(r){return!1}}function d(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function v(r,f){return v=Object.setPrototypeOf||function(u,E){return u.__proto__=E,u},v(r,f)}function b(r){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(c){return c.__proto__||Object.getPrototypeOf(c)},b(r)}function p(){return p=Object.assign||function(r){for(var f=1;f<arguments.length;f++){var c=arguments[f];for(var u in c)Object.prototype.hasOwnProperty.call(c,u)&&(r[u]=c[u])}return r},p.apply(this,arguments)}function m(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(r){}return!1}var y=function(){function r(c){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=c.fetchSetup||e,this.controller=new self.AbortController,this.stats=new D.LoadStats}var f=r.prototype;return f.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},f.abortInternal=function(){var u=this.response;(!u||!u.ok)&&(this.stats.aborted=!0,this.controller.abort())},f.abort=function(){var u;this.abortInternal(),(u=this.callbacks)!==null&&u!==void 0&&u.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},f.load=function(u,E,g){var s=this,a=this.stats;if(a.loading.start)throw new Error("Loader can only be used once.");a.loading.start=self.performance.now();var i=n(u,this.controller.signal),l=g.onProgress,T=u.responseType==="arraybuffer",x=T?"byteLength":"length";this.context=u,this.config=E,this.callbacks=g,this.request=this.fetchSetup(u,i),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){s.abortInternal(),g.onTimeout(a,u,s.response)},E.timeout),self.fetch(this.request).then(function(L){if(s.response=s.loader=L,!L.ok){var R=L.status,I=L.statusText;throw new t(I||"fetch, bad network response",R,L)}return a.loading.first=Math.max(self.performance.now(),a.loading.start),a.total=parseInt(L.headers.get("Content-Length")||"0"),l&&Object(_.isFiniteNumber)(E.highWaterMark)?s.loadProgressively(L,a,u,E.highWaterMark,l):T?L.arrayBuffer():L.text()}).then(function(L){var R=s.response;self.clearTimeout(s.requestTimeout),a.loading.end=Math.max(self.performance.now(),a.loading.first),a.loaded=a.total=L[x];var I={url:R.url,data:L};l&&!Object(_.isFiniteNumber)(E.highWaterMark)&&l(a,u,L,R),g.onSuccess(I,a,u,R)}).catch(function(L){if(self.clearTimeout(s.requestTimeout),a.aborted)return;var R=L.code||0;g.onError({code:R,text:L.message},u,L.details)})},f.getCacheAge=function(){var u=null;if(this.response){var E=this.response.headers.get("age");u=E?parseFloat(E):null}return u},f.loadProgressively=function(u,E,g,s,a){s===void 0&&(s=0);var i=new A.default,l=u.body.getReader(),T=function x(){return l.read().then(function(L){if(L.done)return i.dataLength&&a(E,g,i.flush(),u),Promise.resolve(new ArrayBuffer(0));var R=L.value,I=R.length;return E.loaded+=I,I<s||i.dataLength?(i.push(R),i.dataLength>=s&&a(E,g,i.flush(),u)):a(E,g,R,u),x()}).catch(function(){return Promise.reject()})};return T()},r}();function n(r,f){var c={method:"GET",mode:"cors",credentials:"same-origin",signal:f,headers:new self.Headers(p({},r.headers))};return r.rangeEnd&&c.headers.set("Range","bytes="+r.rangeStart+"-"+String(r.rangeEnd-1)),c}function e(r,f){return new self.Request(r.url,f)}var t=function(r){N(f,r);function f(c,u,E){var g;return g=r.call(this,c)||this,g.code=void 0,g.details=void 0,g.code=u,g.details=E,g}return f}(k(Error));B.default=y},"./src/utils/imsc1-ttml-parser.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"IMSC1_CODEC",function(){return d}),w.d(B,"parseIMSC1",function(){return m});var _=w("./src/utils/mp4-tools.ts"),D=w("./src/utils/vttparser.ts"),A=w("./src/utils/vttcue.ts"),N=w("./src/demux/id3.ts"),k=w("./src/utils/timescale-conversion.ts"),S=w("./src/utils/webvtt-parser.ts");function C(){return C=Object.assign||function(s){for(var a=1;a<arguments.length;a++){var i=arguments[a];for(var l in i)Object.prototype.hasOwnProperty.call(i,l)&&(s[l]=i[l])}return s},C.apply(this,arguments)}var d="stpp.ttml.im1t",v=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,b=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,p={left:"start",center:"center",right:"end",start:"start",end:"end"};function m(s,a,i,l,T){var x=Object(_.findBox)(new Uint8Array(s),["mdat"]);if(x.length===0){T(new Error("Could not parse IMSC1 mdat"));return}var L=x[0],R=Object(N.utf8ArrayToStr)(new Uint8Array(s,L.start,L.end-L.start)),I=Object(k.toTimescaleFromScale)(a,1,i);try{l(y(R,I))}catch(F){T(F)}}function y(s,a){var i=new DOMParser,l=i.parseFromString(s,"text/xml"),T=l.getElementsByTagName("tt")[0];if(!T)throw new Error("Invalid ttml");var x={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},L=Object.keys(x).reduce(function(z,Q){return z[Q]=T.getAttribute("ttp:"+Q)||x[Q],z},{}),R=T.getAttribute("xml:space")!=="preserve",I=e(n(T,"styling","style")),F=e(n(T,"layout","region")),j=n(T,"body","[begin]");return[].map.call(j,function(z){var Q=t(z,R);if(!Q||!z.hasAttribute("begin"))return null;var J=u(z.getAttribute("begin"),L),ie=u(z.getAttribute("dur"),L),pe=u(z.getAttribute("end"),L);if(J===null)throw c(z);if(pe===null){if(ie===null)throw c(z);pe=J+ie}var ce=new A.default(J-a,pe-a,Q);ce.id=Object(S.generateCueId)(ce.startTime,ce.endTime,ce.text);var ye=F[z.getAttribute("region")],ve=I[z.getAttribute("style")];ce.position=10,ce.size=80;var Z=r(ye,ve),q=Z.textAlign;if(q){var se=p[q];se&&(ce.lineAlign=se),ce.align=q}return C(ce,Z),ce}).filter(function(z){return z!==null})}function n(s,a,i){var l=s.getElementsByTagName(a)[0];return l?[].slice.call(l.querySelectorAll(i)):[]}function e(s){return s.reduce(function(a,i){var l=i.getAttribute("xml:id");return l&&(a[l]=i),a},{})}function t(s,a){return[].slice.call(s.childNodes).reduce(function(i,l,T){var x;return l.nodeName==="br"&&T?i+`
`:(x=l.childNodes)!==null&&x!==void 0&&x.length?t(l,a):a?i+l.textContent.trim().replace(/\s+/g," "):i+l.textContent},"")}function r(s,a){var i="http://www.w3.org/ns/ttml#styling",l=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return l.reduce(function(T,x){var L=f(a,i,x)||f(s,i,x);return L&&(T[x]=L),T},{})}function f(s,a,i){return s.hasAttributeNS(a,i)?s.getAttributeNS(a,i):null}function c(s){return new Error("Could not parse ttml timestamp "+s)}function u(s,a){if(!s)return null;var i=Object(D.parseTimeStamp)(s);return i===null&&(v.test(s)?i=E(s,a):b.test(s)&&(i=g(s,a))),i}function E(s,a){var i=v.exec(s),l=(i[4]|0)+(i[5]|0)/a.subFrameRate;return(i[1]|0)*3600+(i[2]|0)*60+(i[3]|0)+l/a.frameRate}function g(s,a){var i=b.exec(s),l=Number(i[1]),T=i[2];switch(T){case"h":return l*3600;case"m":return l*60;case"ms":return l*1e3;case"f":return l/a.frameRate;case"t":return l/a.tickRate}return l}},"./src/utils/logger.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"enableLogs",function(){return S}),w.d(B,"logger",function(){return C});var _=function(){},D={trace:_,debug:_,log:_,warn:_,info:_,error:_},A=D;function N(d){var v=self.console[d];return v?v.bind(self.console,"["+d+"] >"):_}function k(d){for(var v=arguments.length,b=new Array(v>1?v-1:0),p=1;p<v;p++)b[p-1]=arguments[p];b.forEach(function(m){A[m]=d[m]?d[m].bind(d):N(m)})}function S(d){if(self.console&&d===!0||typeof d=="object"){k(d,"debug","log","info","warn","error");try{A.log()}catch(v){A=D}}else A=D}var C=A},"./src/utils/mediakeys-helper.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"KeySystems",function(){return _}),w.d(B,"requestMediaKeySystemAccess",function(){return D});var _;(function(A){A.WIDEVINE="com.widevine.alpha",A.PLAYREADY="com.microsoft.playready"})(_||(_={}));var D=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"getMediaSource",function(){return _});function _(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"bin2str",function(){return k}),w.d(B,"readUint16",function(){return S}),w.d(B,"readUint32",function(){return C}),w.d(B,"writeUint32",function(){return d}),w.d(B,"findBox",function(){return v}),w.d(B,"parseSegmentIndex",function(){return b}),w.d(B,"parseInitSegment",function(){return p}),w.d(B,"getStartDTS",function(){return m}),w.d(B,"getDuration",function(){return y}),w.d(B,"computeRawDurationFromSamples",function(){return n}),w.d(B,"offsetStartDTS",function(){return e}),w.d(B,"segmentValidRange",function(){return t}),w.d(B,"appendUint8Array",function(){return r});var _=w("./src/utils/typed-array.ts"),D=w("./src/loader/fragment.ts"),A=Math.pow(2,32)-1,N=[].push;function k(f){return String.fromCharCode.apply(null,f)}function S(f,c){"data"in f&&(c+=f.start,f=f.data);var u=f[c]<<8|f[c+1];return u<0?65536+u:u}function C(f,c){"data"in f&&(c+=f.start,f=f.data);var u=f[c]<<24|f[c+1]<<16|f[c+2]<<8|f[c+3];return u<0?4294967296+u:u}function d(f,c,u){"data"in f&&(c+=f.start,f=f.data),f[c]=u>>24,f[c+1]=u>>16&255,f[c+2]=u>>8&255,f[c+3]=u&255}function v(f,c){var u=[];if(!c.length)return u;var E,g,s;"data"in f?(E=f.data,g=f.start,s=f.end):(E=f,g=0,s=E.byteLength);for(var a=g;a<s;){var i=C(E,a),l=k(E.subarray(a+4,a+8)),T=i>1?a+i:s;if(l===c[0])if(c.length===1)u.push({data:E,start:a+8,end:T});else{var x=v({data:E,start:a+8,end:T},c.slice(1));x.length&&N.apply(u,x)}a=T}return u}function b(f){var c=v(f,["moov"]),u=c[0],E=u?u.end:null,g=v(f,["sidx"]);if(!g||!g[0])return null;var s=[],a=g[0],i=a.data[0],l=i===0?8:16,T=C(a,l);l+=4;var x=0,L=0;i===0?l+=8:l+=16,l+=2;var R=a.end+L,I=S(a,l);l+=2;for(var F=0;F<I;F++){var j=l,z=C(a,j);j+=4;var Q=z&2147483647,J=(z&2147483648)>>>31;if(J===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ie=C(a,j);j+=4,s.push({referenceSize:Q,subsegmentDuration:ie,info:{duration:ie/T,start:R,end:R+Q-1}}),R+=Q,j+=4,l=j}return{earliestPresentationTime:x,timescale:T,version:i,referencesCount:I,references:s,moovEndOffset:E}}function p(f){for(var c=[],u=v(f,["moov","trak"]),E=0;E<u.length;E++){var g=u[E],s=v(g,["tkhd"])[0];if(s){var a=s.data[s.start],i=a===0?12:20,l=C(s,i),T=v(g,["mdia","mdhd"])[0];if(T){a=T.data[T.start],i=a===0?12:20;var x=C(T,i),L=v(g,["mdia","hdlr"])[0];if(L){var R=k(L.data.subarray(L.start+8,L.start+12)),I={soun:D.ElementaryStreamTypes.AUDIO,vide:D.ElementaryStreamTypes.VIDEO}[R];if(I){var F=v(g,["mdia","minf","stbl","stsd"])[0],j=void 0;F&&(j=k(F.data.subarray(F.start+12,F.start+16))),c[l]={timescale:x,type:I},c[I]={timescale:x,id:l,codec:j}}}}}}var z=v(f,["moov","mvex","trex"]);return z.forEach(function(Q){var J=C(Q,4),ie=c[J];ie&&(ie.default={duration:C(Q,12),flags:C(Q,20)})}),c}function m(f,c){return v(c,["moof","traf"]).reduce(function(u,E){var g=v(E,["tfdt"])[0],s=g.data[g.start],a=v(E,["tfhd"]).reduce(function(i,l){var T=C(l,4),x=f[T];if(x){var L=C(g,4);s===1&&(L*=Math.pow(2,32),L+=C(g,8));var R=x.timescale||9e4,I=L/R;if(isFinite(I)&&(i===null||I<i))return I}return i},null);return a!==null&&isFinite(a)&&(u===null||a<u)?a:u},null)||0}function y(f,c){for(var u=0,E=0,g=0,s=v(f,["moof","traf"]),a=0;a<s.length;a++){var i=s[a],l=v(i,["tfhd"])[0],T=C(l,4),x=c[T];if(!x)continue;var L=x.default,R=C(l,0)|(L==null?void 0:L.flags),I=L==null?void 0:L.duration;R&8&&(R&2?I=C(l,12):I=C(l,8));for(var F=x.timescale||9e4,j=v(i,["trun"]),z=0;z<j.length;z++){if(I){var Q=C(j[z],4);u=I*Q}else u=n(j[z]);x.type===D.ElementaryStreamTypes.VIDEO?E+=u/F:x.type===D.ElementaryStreamTypes.AUDIO&&(g+=u/F)}}if(E===0&&g===0){var J=b(f);if(J!=null&&J.references)return J.references.reduce(function(ie,pe){return ie+pe.info.duration||0},0)}return E||g}function n(f){var c=C(f,0),u=8;c&1&&(u+=4),c&4&&(u+=4);for(var E=0,g=C(f,4),s=0;s<g;s++){if(c&256){var a=C(f,u);E+=a,u+=4}c&512&&(u+=4),c&1024&&(u+=4),c&2048&&(u+=4)}return E}function e(f,c,u){v(c,["moof","traf"]).forEach(function(E){v(E,["tfhd"]).forEach(function(g){var s=C(g,4),a=f[s];if(!a)return;var i=a.timescale||9e4;v(E,["tfdt"]).forEach(function(l){var T=l.data[l.start],x=C(l,4);if(T===0)d(l,4,x-u*i);else{x*=Math.pow(2,32),x+=C(l,8),x-=u*i,x=Math.max(x,0);var L=Math.floor(x/(A+1)),R=Math.floor(x%(A+1));d(l,4,L),d(l,8,R)}})})})}function t(f){var c={valid:null,remainder:null},u=v(f,["moof"]);if(u){if(u.length<2)return c.remainder=f,c}else return c;var E=u[u.length-1];return c.valid=Object(_.sliceUint8)(f,0,E.start-8),c.remainder=Object(_.sliceUint8)(f,E.start-8),c}function r(f,c){var u=new Uint8Array(f.length+c.length);return u.set(f),u.set(c,f.length),u}},"./src/utils/output-filter.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"default",function(){return _});var _=function(){function D(N,k){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=N,this.trackName=k}var A=D.prototype;return A.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},A.newCue=function(k,S,C){(this.startTime===null||this.startTime>k)&&(this.startTime=k),this.endTime=S,this.screen=C,this.timelineController.createCaptionsTrack(this.trackName)},A.reset=function(){this.cueRanges=[]},D}()},"./src/utils/texttrack-utils.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"sendAddTrackEvent",function(){return D}),w.d(B,"addCueToTrack",function(){return A}),w.d(B,"clearCurrentCues",function(){return N}),w.d(B,"removeCuesInRange",function(){return k}),w.d(B,"getCuesInRange",function(){return C});var _=w("./src/utils/logger.ts");function D(d,v){var b;try{b=new Event("addtrack")}catch(p){b=document.createEvent("Event"),b.initEvent("addtrack",!1,!1)}b.track=d,v.dispatchEvent(b)}function A(d,v){var b=d.mode;if(b==="disabled"&&(d.mode="hidden"),d.cues&&!d.cues.getCueById(v.id))try{if(d.addCue(v),!d.cues.getCueById(v.id))throw new Error("addCue is failed for: "+v)}catch(m){_.logger.debug("[texttrack-utils]: "+m);var p=new self.TextTrackCue(v.startTime,v.endTime,v.text);p.id=v.id,d.addCue(p)}b==="disabled"&&(d.mode=b)}function N(d){var v=d.mode;if(v==="disabled"&&(d.mode="hidden"),d.cues)for(var b=d.cues.length;b--;)d.removeCue(d.cues[b]);v==="disabled"&&(d.mode=v)}function k(d,v,b){var p=d.mode;if(p==="disabled"&&(d.mode="hidden"),d.cues&&d.cues.length>0)for(var m=C(d.cues,v,b),y=0;y<m.length;y++)d.removeCue(m[y]);p==="disabled"&&(d.mode=p)}function S(d,v){if(v<d[0].startTime)return 0;var b=d.length-1;if(v>d[b].endTime)return-1;for(var p=0,m=b;p<=m;){var y=Math.floor((m+p)/2);if(v<d[y].startTime)m=y-1;else if(v>d[y].startTime&&p<b)p=y+1;else return y}return d[p].startTime-v<v-d[m].startTime?p:m}function C(d,v,b){var p=[],m=S(d,v);if(m>-1)for(var y=m,n=d.length;y<n;y++){var e=d[y];if(e.startTime>=v&&e.endTime<=b)p.push(e);else if(e.startTime>b)return p}return p}},"./src/utils/time-ranges.ts":function(ue,B,w){"use strict";w.r(B);var _={toString:function(A){for(var N="",k=A.length,S=0;S<k;S++)N+="["+A.start(S).toFixed(3)+","+A.end(S).toFixed(3)+"]";return N}};B.default=_},"./src/utils/timescale-conversion.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"toTimescaleFromBase",function(){return D}),w.d(B,"toTimescaleFromScale",function(){return A}),w.d(B,"toMsFromMpegTsClock",function(){return N}),w.d(B,"toMpegTsClockFromTimescale",function(){return k});var _=9e4;function D(S,C,d,v){d===void 0&&(d=1),v===void 0&&(v=!1);var b=S*C*d;return v?Math.round(b):b}function A(S,C,d,v){return d===void 0&&(d=1),v===void 0&&(v=!1),D(S,C,1/d,v)}function N(S,C){return C===void 0&&(C=!1),D(S,1e3,1/_,C)}function k(S,C){return C===void 0&&(C=1),D(S,_,1/C)}},"./src/utils/typed-array.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"sliceUint8",function(){return _});function _(D,A,N){return Uint8Array.prototype.slice?D.slice(A,N):new Uint8Array(Array.prototype.slice.call(D,A,N))}},"./src/utils/vttcue.ts":function(ue,B,w){"use strict";w.r(B),B.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var _=["","lr","rl"],D=["start","middle","end","left","right"];function A(d,v){if(typeof v!="string")return!1;if(!Array.isArray(d))return!1;var b=v.toLowerCase();return~d.indexOf(b)?b:!1}function N(d){return A(_,d)}function k(d){return A(D,d)}function S(d){for(var v=arguments.length,b=new Array(v>1?v-1:0),p=1;p<v;p++)b[p-1]=arguments[p];for(var m=1;m<arguments.length;m++){var y=arguments[m];for(var n in y)d[n]=y[n]}return d}function C(d,v,b){var p=this,m={enumerable:!0};p.hasBeenReset=!1;var y="",n=!1,e=d,t=v,r=b,f=null,c="",u=!0,E="auto",g="start",s=50,a="middle",i=50,l="middle";Object.defineProperty(p,"id",S({},m,{get:function(){return y},set:function(x){y=""+x}})),Object.defineProperty(p,"pauseOnExit",S({},m,{get:function(){return n},set:function(x){n=!!x}})),Object.defineProperty(p,"startTime",S({},m,{get:function(){return e},set:function(x){if(typeof x!="number")throw new TypeError("Start time must be set to a number.");e=x,this.hasBeenReset=!0}})),Object.defineProperty(p,"endTime",S({},m,{get:function(){return t},set:function(x){if(typeof x!="number")throw new TypeError("End time must be set to a number.");t=x,this.hasBeenReset=!0}})),Object.defineProperty(p,"text",S({},m,{get:function(){return r},set:function(x){r=""+x,this.hasBeenReset=!0}})),Object.defineProperty(p,"region",S({},m,{get:function(){return f},set:function(x){f=x,this.hasBeenReset=!0}})),Object.defineProperty(p,"vertical",S({},m,{get:function(){return c},set:function(x){var L=N(x);if(L===!1)throw new SyntaxError("An invalid or illegal string was specified.");c=L,this.hasBeenReset=!0}})),Object.defineProperty(p,"snapToLines",S({},m,{get:function(){return u},set:function(x){u=!!x,this.hasBeenReset=!0}})),Object.defineProperty(p,"line",S({},m,{get:function(){return E},set:function(x){if(typeof x!="number"&&x!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");E=x,this.hasBeenReset=!0}})),Object.defineProperty(p,"lineAlign",S({},m,{get:function(){return g},set:function(x){var L=k(x);if(!L)throw new SyntaxError("An invalid or illegal string was specified.");g=L,this.hasBeenReset=!0}})),Object.defineProperty(p,"position",S({},m,{get:function(){return s},set:function(x){if(x<0||x>100)throw new Error("Position must be between 0 and 100.");s=x,this.hasBeenReset=!0}})),Object.defineProperty(p,"positionAlign",S({},m,{get:function(){return a},set:function(x){var L=k(x);if(!L)throw new SyntaxError("An invalid or illegal string was specified.");a=L,this.hasBeenReset=!0}})),Object.defineProperty(p,"size",S({},m,{get:function(){return i},set:function(x){if(x<0||x>100)throw new Error("Size must be between 0 and 100.");i=x,this.hasBeenReset=!0}})),Object.defineProperty(p,"align",S({},m,{get:function(){return l},set:function(x){var L=k(x);if(!L)throw new SyntaxError("An invalid or illegal string was specified.");l=L,this.hasBeenReset=!0}})),p.displayState=void 0}return C.prototype.getCueAsHTML=function(){var d=self.WebVTT;return d.convertCueToDOMTree(self,this.text)},C}()},"./src/utils/vttparser.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"parseTimeStamp",function(){return A}),w.d(B,"fixLineBreaks",function(){return v}),w.d(B,"VTTParser",function(){return b});var _=w("./src/utils/vttcue.ts"),D=function(){function p(){}var m=p.prototype;return m.decode=function(n,e){if(!n)return"";if(typeof n!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(n))},p}();function A(p){function m(n,e,t,r){return(n|0)*3600+(e|0)*60+(t|0)+parseFloat(r||0)}var y=p.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return y?parseFloat(y[2])>59?m(y[2],y[3],0,y[4]):m(y[1],y[2],y[3],y[4]):null}var N=function(){function p(){this.values=Object.create(null)}var m=p.prototype;return m.set=function(n,e){!this.get(n)&&e!==""&&(this.values[n]=e)},m.get=function(n,e,t){return t?this.has(n)?this.values[n]:e[t]:this.has(n)?this.values[n]:e},m.has=function(n){return n in this.values},m.alt=function(n,e,t){for(var r=0;r<t.length;++r)if(e===t[r]){this.set(n,e);break}},m.integer=function(n,e){/^-?\d+$/.test(e)&&this.set(n,parseInt(e,10))},m.percent=function(n,e){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(e)){var t=parseFloat(e);if(t>=0&&t<=100)return this.set(n,t),!0}return!1},p}();function k(p,m,y,n){var e=n?p.split(n):[p];for(var t in e){if(typeof e[t]!="string")continue;var r=e[t].split(y);if(r.length!==2)continue;var f=r[0],c=r[1];m(f,c)}}var S=new _.default(0,0,""),C=S.align==="middle"?"middle":"center";function d(p,m,y){var n=p;function e(){var f=A(p);if(f===null)throw new Error("Malformed timestamp: "+n);return p=p.replace(/^[^\sa-zA-Z-]+/,""),f}function t(f,c){var u=new N;k(f,function(s,a){var i;switch(s){case"region":for(var l=y.length-1;l>=0;l--)if(y[l].id===a){u.set(s,y[l].region);break}break;case"vertical":u.alt(s,a,["rl","lr"]);break;case"line":i=a.split(","),u.integer(s,i[0]),u.percent(s,i[0])&&u.set("snapToLines",!1),u.alt(s,i[0],["auto"]),i.length===2&&u.alt("lineAlign",i[1],["start",C,"end"]);break;case"position":i=a.split(","),u.percent(s,i[0]),i.length===2&&u.alt("positionAlign",i[1],["start",C,"end","line-left","line-right","auto"]);break;case"size":u.percent(s,a);break;case"align":u.alt(s,a,["start",C,"end","left","right"]);break}},/:/,/\s/),c.region=u.get("region",null),c.vertical=u.get("vertical","");var E=u.get("line","auto");E==="auto"&&S.line===-1&&(E=-1),c.line=E,c.lineAlign=u.get("lineAlign","start"),c.snapToLines=u.get("snapToLines",!0),c.size=u.get("size",100),c.align=u.get("align",C);var g=u.get("position","auto");g==="auto"&&S.position===50&&(g=c.align==="start"||c.align==="left"?0:c.align==="end"||c.align==="right"?100:50),c.position=g}function r(){p=p.replace(/^\s+/,"")}if(r(),m.startTime=e(),r(),p.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+n);p=p.substr(3),r(),m.endTime=e(),r(),t(p,m)}function v(p){return p.replace(/<br(?: \/)?>/gi,`
`)}var b=function(){function p(){this.state="INITIAL",this.buffer="",this.decoder=new D,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var m=p.prototype;return m.parse=function(n){var e=this;n&&(e.buffer+=e.decoder.decode(n,{stream:!0}));function t(){var g=e.buffer,s=0;for(g=v(g);s<g.length&&g[s]!=="\r"&&g[s]!==`
`;)++s;var a=g.substr(0,s);return g[s]==="\r"&&++s,g[s]===`
`&&++s,e.buffer=g.substr(s),a}function r(g){k(g,function(s,a){},/:/)}try{var f="";if(e.state==="INITIAL"){if(!/\r\n|\n/.test(e.buffer))return this;f=t();var c=f.match(/^()?WEBVTT([ \t].*)?$/);if(!c||!c[0])throw new Error("Malformed WebVTT signature.");e.state="HEADER"}for(var u=!1;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;u?u=!1:f=t();switch(e.state){case"HEADER":/:/.test(f)?r(f):f||(e.state="ID");continue;case"NOTE":f||(e.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(f)){e.state="NOTE";break}if(!f)continue;if(e.cue=new _.default(0,0,""),e.state="CUE",f.indexOf("-->")===-1){e.cue.id=f;continue}case"CUE":if(!e.cue){e.state="BADCUE";continue}try{d(f,e.cue,e.regionList)}catch(g){e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":{var E=f.indexOf("-->")!==-1;if(!f||E&&(u=!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+=f}continue;case"BADCUE":f||(e.state="ID")}}}catch(g){e.state==="CUETEXT"&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state=e.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},m.flush=function(){var n=this;try{if((n.cue||n.state==="HEADER")&&(n.buffer+=`
`,n.parse()),n.state==="INITIAL"||n.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(e){n.onparsingerror&&n.onparsingerror(e)}return n.onflush&&n.onflush(),this},p}()},"./src/utils/webvtt-parser.ts":function(ue,B,w){"use strict";w.r(B),w.d(B,"generateCueId",function(){return b}),w.d(B,"parseWebVTT",function(){return m});var _=w("./src/polyfills/number.ts"),D=w("./src/utils/vttparser.ts"),A=w("./src/demux/id3.ts"),N=w("./src/utils/timescale-conversion.ts"),k=w("./src/remux/mp4-remuxer.ts"),S=/\r\n|\n\r|\n|\r/g,C=function(n,e,t){return t===void 0&&(t=0),n.substr(t,e.length)===e},d=function(n){var e=parseInt(n.substr(-3)),t=parseInt(n.substr(-6,2)),r=parseInt(n.substr(-9,2)),f=n.length>9?parseInt(n.substr(0,n.indexOf(":"))):0;if(!Object(_.isFiniteNumber)(e)||!Object(_.isFiniteNumber)(t)||!Object(_.isFiniteNumber)(r)||!Object(_.isFiniteNumber)(f))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+n);return e+=1e3*t,e+=60*1e3*r,e+=60*60*1e3*f,e},v=function(n){for(var e=5381,t=n.length;t;)e=e*33^n.charCodeAt(--t);return(e>>>0).toString()};function b(y,n,e){return v(y.toString())+v(n.toString())+v(e)}var p=function(n,e,t){var r=n[e],f=n[r.prevCC];if(!f||!f.new&&r.new){n.ccOffset=n.presentationOffset=r.start,r.new=!1;return}for(;(c=f)!==null&&c!==void 0&&c.new;){var c;n.ccOffset+=r.start-f.start,r.new=!1,r=f,f=n[r.prevCC]}n.presentationOffset=t};function m(y,n,e,t,r,f,c,u){var E=new D.VTTParser,g=Object(A.utf8ArrayToStr)(new Uint8Array(y)).trim().replace(S,`
`).split(`
`),s=[],a=Object(N.toMpegTsClockFromTimescale)(n,e),i="00:00.000",l=0,T=0,x,L=!0,R=!1;E.oncue=function(I){var F=t[r],j=t.ccOffset,z=(l-a)/9e4;if(F!=null&&F.new&&(T!==void 0?j=t.ccOffset=F.start:p(t,r,z)),z&&(j=z-t.presentationOffset),R){var Q=I.endTime-I.startTime,J=Object(k.normalizePts)((I.startTime+j-T)*9e4,f*9e4)/9e4;I.startTime=J,I.endTime=J+Q}var ie=I.text.trim();I.text=decodeURIComponent(encodeURIComponent(ie)),I.id||(I.id=b(I.startTime,I.endTime,ie)),I.endTime>0&&s.push(I)},E.onparsingerror=function(I){x=I},E.onflush=function(){if(x){u(x);return}c(s)},g.forEach(function(I){if(L)if(C(I,"X-TIMESTAMP-MAP=")){L=!1,R=!0,I.substr(16).split(",").forEach(function(F){C(F,"LOCAL:")?i=F.substr(6):C(F,"MPEGTS:")&&(l=parseInt(F.substr(7)))});try{T=d(i)/1e3}catch(F){R=!1,x=F}return}else I===""&&(L=!1);E.parse(I+`
`)}),E.flush()}},"./src/utils/xhr-loader.ts":function(ue,B,w){"use strict";w.r(B);var _=w("./src/utils/logger.ts"),D=w("./src/loader/load-stats.ts"),A=/^age:\s*[\d.]+\s*$/m,N=function(){function k(C){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=C?C.xhrSetup:null,this.stats=new D.LoadStats,this.retryDelay=0}var S=k.prototype;return S.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},S.abortInternal=function(){var d=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),d&&(d.onreadystatechange=null,d.onprogress=null,d.readyState!==4&&(this.stats.aborted=!0,d.abort()))},S.abort=function(){var d;this.abortInternal(),(d=this.callbacks)!==null&&d!==void 0&&d.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},S.load=function(d,v,b){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=d,this.config=v,this.callbacks=b,this.retryDelay=v.retryDelay,this.loadInternal()},S.loadInternal=function(){var d=this.config,v=this.context;if(!d)return;var b=this.loader=new self.XMLHttpRequest,p=this.stats;p.loading.first=0,p.loaded=0;var m=this.xhrSetup;try{if(m)try{m(b,v.url)}catch(e){b.open("GET",v.url,!0),m(b,v.url)}b.readyState||b.open("GET",v.url,!0);var y=this.context.headers;if(y)for(var n in y)b.setRequestHeader(n,y[n])}catch(e){this.callbacks.onError({code:b.status,text:e.message},v,b);return}v.rangeEnd&&b.setRequestHeader("Range","bytes="+v.rangeStart+"-"+(v.rangeEnd-1)),b.onreadystatechange=this.readystatechange.bind(this),b.onprogress=this.loadprogress.bind(this),b.responseType=v.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),d.timeout),b.send()},S.readystatechange=function(){var d=this.context,v=this.loader,b=this.stats;if(!d||!v)return;var p=v.readyState,m=this.config;if(b.aborted)return;if(p>=2)if(self.clearTimeout(this.requestTimeout),b.loading.first===0&&(b.loading.first=Math.max(self.performance.now(),b.loading.start)),p===4){v.onreadystatechange=null,v.onprogress=null;var y=v.status;if(y>=200&&y<300){b.loading.end=Math.max(self.performance.now(),b.loading.first);var n,e;if(d.responseType==="arraybuffer"?(n=v.response,e=n.byteLength):(n=v.responseText,e=n.length),b.loaded=b.total=e,!this.callbacks)return;var t=this.callbacks.onProgress;if(t&&t(b,d,n,v),!this.callbacks)return;var r={url:v.responseURL,data:n};this.callbacks.onSuccess(r,b,d,v)}else b.retry>=m.maxRetry||y>=400&&y<499?(_.logger.error(y+" while loading "+d.url),this.callbacks.onError({code:y,text:v.statusText},d,v)):(_.logger.warn(y+" while loading "+d.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,m.maxRetryDelay),b.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),m.timeout)},S.loadtimeout=function(){_.logger.warn("timeout while loading "+this.context.url);var d=this.callbacks;d&&(this.abortInternal(),d.onTimeout(this.stats,this.context,this.loader))},S.loadprogress=function(d){var v=this.stats;v.loaded=d.loaded,d.lengthComputable&&(v.total=d.total)},S.getCacheAge=function(){var d=null;if(this.loader&&A.test(this.loader.getAllResponseHeaders())){var v=this.loader.getResponseHeader("age");d=v?parseFloat(v):null}return d},k}();B.default=N}}).default})},vHTk:function(et,he,K){et.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);