@dao42/d42paas-front 0.3.8 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/1569.js +2 -2
  2. package/dist/1585.js +2 -2
  3. package/dist/1593.js +2 -2
  4. package/dist/1594.js +2 -2
  5. package/dist/162.js +2 -2
  6. package/dist/1649.js +2 -2
  7. package/dist/17.js +168 -0
  8. package/dist/1941.js +2 -2
  9. package/dist/2014.js +2 -2
  10. package/dist/2088.js +2 -2
  11. package/dist/2235.js +247 -247
  12. package/dist/2271.js +2 -2
  13. package/dist/2287.js +3 -3
  14. package/dist/2388.js +2 -2
  15. package/dist/2583.js +2 -2
  16. package/dist/2862.js +2 -2
  17. package/dist/2906.js +2 -2
  18. package/dist/300.js +2 -2
  19. package/dist/3008.js +2 -2
  20. package/dist/317.js +7 -7
  21. package/dist/3315.js +2 -2
  22. package/dist/3399.js +2 -2
  23. package/dist/3504.js +2 -2
  24. package/dist/3553.js +2 -2
  25. package/dist/3673.js +2 -2
  26. package/dist/3780.js +3 -3
  27. package/dist/3855.js +2 -2
  28. package/dist/4035.js +3 -3
  29. package/dist/4073.js +2 -2
  30. package/dist/4246.js +5 -5
  31. package/dist/4289.js +171 -0
  32. package/dist/4366.js +4 -4
  33. package/dist/4369.js +2 -2
  34. package/dist/4454.js +2 -2
  35. package/dist/4511.js +2 -2
  36. package/dist/4558.js +2 -2
  37. package/dist/4610.js +2 -2
  38. package/dist/471.js +2 -2
  39. package/dist/4858.js +3 -3
  40. package/dist/4896.js +2 -2
  41. package/dist/491.js +2 -2
  42. package/dist/5257.js +2 -2
  43. package/dist/5454.js +2 -2
  44. package/dist/5524.js +2 -2
  45. package/dist/5669.js +2 -2
  46. package/dist/5881.js +2 -2
  47. package/dist/5900.js +2 -2
  48. package/dist/5924.js +2 -2
  49. package/dist/5925.js +2 -2
  50. package/dist/5972.js +2 -2
  51. package/dist/5974.js +2 -2
  52. package/dist/6022.js +2 -2
  53. package/dist/615.js +4 -4
  54. package/dist/6162.js +2 -2
  55. package/dist/6175.js +2 -2
  56. package/dist/622.js +2 -2
  57. package/dist/6223.js +2 -2
  58. package/dist/6330.js +2 -2
  59. package/dist/6331.js +2 -2
  60. package/dist/6354.js +2 -2
  61. package/dist/6751.js +2 -2
  62. package/dist/6792.js +2 -2
  63. package/dist/6844.js +2 -2
  64. package/dist/7125.js +2 -2
  65. package/dist/7127.js +2 -2
  66. package/dist/7135.js +2 -2
  67. package/dist/7148.js +2 -2
  68. package/dist/7447.js +2 -2
  69. package/dist/7453.js +2 -2
  70. package/dist/7483.js +2 -2
  71. package/dist/7604.js +2 -2
  72. package/dist/7971.js +2 -2
  73. package/dist/8147.js +2 -2
  74. package/dist/8308.js +2 -2
  75. package/dist/8309.js +2 -2
  76. package/dist/8327.js +2 -2
  77. package/dist/849.js +2 -2
  78. package/dist/8677.js +2 -2
  79. package/dist/868.js +2 -2
  80. package/dist/8947.js +2 -2
  81. package/dist/930.js +1 -1
  82. package/dist/9342.js +2 -2
  83. package/dist/9482.js +2 -2
  84. package/dist/9538.js +2 -2
  85. package/dist/9741.js +2 -2
  86. package/dist/9909.js +7 -7
  87. package/dist/9953.js +2 -2
  88. package/dist/css.worker.js +23 -23
  89. package/dist/daoPaaS.js +3 -4
  90. package/dist/editor.worker.js +7 -7
  91. package/dist/html.worker.js +19 -19
  92. package/dist/index.d.ts +31 -0
  93. package/dist/index.html +1 -1
  94. package/dist/json.worker.js +19 -19
  95. package/dist/ts.worker.js +21 -21
  96. package/package.json +2 -1
  97. package/dist/1742.js +0 -171
  98. package/dist/7546.js +0 -155
package/dist/1742.js DELETED
@@ -1,171 +0,0 @@
1
- var a0=Object.defineProperty,c0=Object.defineProperties;var l0=Object.getOwnPropertyDescriptors;var hu=Object.getOwnPropertySymbols;var xg=Object.prototype.hasOwnProperty,Mg=Object.prototype.propertyIsEnumerable;var kg=(Oe,he,H)=>he in Oe?a0(Oe,he,{enumerable:!0,configurable:!0,writable:!0,value:H}):Oe[he]=H,ul=(Oe,he)=>{for(var H in he||(he={}))xg.call(he,H)&&kg(Oe,H,he[H]);if(hu)for(var H of hu(he))Mg.call(he,H)&&kg(Oe,H,he[H]);return Oe},Ug=(Oe,he)=>c0(Oe,l0(he));var $d=(Oe,he)=>{var H={};for(var k in Oe)xg.call(Oe,k)&&he.indexOf(k)<0&&(H[k]=Oe[k]);if(Oe!=null&&hu)for(var k of hu(Oe))he.indexOf(k)<0&&Mg.call(Oe,k)&&(H[k]=Oe[k]);return H};var Ee=(Oe,he,H)=>new Promise((k,W)=>{var P=O=>{try{L(H.next(O))}catch(b){W(b)}},E=O=>{try{L(H.throw(O))}catch(b){W(b)}},L=O=>O.done?k(O.value):Promise.resolve(O.value).then(P,E);L((H=H.apply(Oe,he)).next())});(this.webpackChunkDaoPaaS=this.webpackChunkDaoPaaS||[]).push([[1742],{85046:function(Oe,he,H){(function(k,W){W(he,H(79640),H(45904),H(88711))})(this,function(k,W,P,E){"use strict";function L(u){return u&&typeof u=="object"&&"default"in u?u:{default:u}}var O,b=L(W),w=L(P),g=L(E);/*! *****************************************************************************
2
- Copyright (c) Microsoft Corporation.
3
-
4
- Permission to use, copy, modify, and/or distribute this software for any
5
- purpose with or without fee is hereby granted.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
- PERFORMANCE OF THIS SOFTWARE.
14
- ***************************************************************************** */function D(u,l,A,I){return new(A||(A=Promise))(function(R,y){function v(B){try{S(I.next(B))}catch(N){y(N)}}function m(B){try{S(I.throw(B))}catch(N){y(N)}}function S(B){var N;B.done?R(B.value):(N=B.value,N instanceof A?N:new A(function(M){M(N)})).then(v,m)}S((I=I.apply(u,l||[])).next())})}function T(u,l){var A,I,R,y,v={label:0,sent:function(){if(1&R[0])throw R[1];return R[1]},trys:[],ops:[]};return y={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function m(S){return function(B){return function(N){if(A)throw new TypeError("Generator is already executing.");for(;v;)try{if(A=1,I&&(R=2&N[0]?I.return:N[0]?I.throw||((R=I.return)&&R.call(I),0):I.next)&&!(R=R.call(I,N[1])).done)return R;switch(I=0,R&&(N=[2&N[0],R.value]),N[0]){case 0:case 1:R=N;break;case 4:return v.label++,{value:N[1],done:!1};case 5:v.label++,I=N[1],N=[0];continue;case 7:N=v.ops.pop(),v.trys.pop();continue;default:if(R=v.trys,!((R=R.length>0&&R[R.length-1])||N[0]!==6&&N[0]!==2)){v=0;continue}if(N[0]===3&&(!R||N[1]>R[0]&&N[1]<R[3])){v.label=N[1];break}if(N[0]===6&&v.label<R[1]){v.label=R[1],R=N;break}if(R&&v.label<R[2]){v.label=R[2],v.ops.push(N);break}R[2]&&v.ops.pop(),v.trys.pop();continue}N=l.call(u,v)}catch(M){N=[6,M],I=0}finally{A=R=0}if(5&N[0])throw N[1];return{value:N[0]?N[1]:void 0,done:!0}}([S,B])}}}function f(u,l){return u.cid===l.cid&&u.uid===l.uid&&u.sid===l.sid}function p(u,l){return l===void 0&&(l="_"),u.split(l)}k.Events=void 0,(O=k.Events||(k.Events={})).userAudioStart="user_audio_start",O.userAudioClose="user_audio_close",O.userVideoStart="user_video_start",O.userVideoClose="user_video_close";var _=function(){function u(l,A){var I;this.server=l,this.localAudioTrack=null,this.localVideoTrack=null,this.client=w.default.createClient({mode:"rtc",codec:"vp8"}),this.id=A,this.callback=((I={})[k.Events.userAudioStart]=function(R){},I[k.Events.userAudioClose]=function(R){},I[k.Events.userVideoStart]=function(R){},I[k.Events.userVideoClose]=function(R){},I)}return u.prototype.on=function(l,A){this.callback[l]=A},u.prototype.join=function(){return D(this,void 0,void 0,function(){var l;return T(this,function(A){switch(A.label){case 0:return l={appId:"",channel:this.id.cid,token:"",uid:(I=this.id.uid,R=this.id.sid,y===void 0&&(y="_"),I+y+R)},[4,fetch(this.server+"/rtc/api/agora/token",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({user:l.uid.toString(),channel:l.channel})}).then(function(v){return v.json()}).then(function(v){l.appId=v.appid,l.token=v.token,console.log(v)},function(v){console.log(v)})];case 1:return A.sent(),[4,this.client.join(l.appId,l.channel,l.token,l.uid)];case 2:return A.sent(),this.call(),[2]}var I,R,y})})},u.prototype.onVideoStream=function(l,A){b.default.debug(l,A)},u.prototype.onAudioStream=function(l,A){b.default.debug(l,A)},u.prototype.startVideo=function(){var l;return D(this,void 0,void 0,function(){var A,I;return T(this,function(R){switch(R.label){case 0:return A=this,[4,w.default.createCameraVideoTrack()];case 1:return A.localVideoTrack=R.sent(),(I=(l=this.localVideoTrack)===null||l===void 0?void 0:l.getMediaStreamTrack())&&this.onVideoStream(this.id,new MediaStream([I])),[4,this.client.publish([this.localVideoTrack])];case 2:return R.sent(),console.log("publish video success!"),[2]}})})},u.prototype.startAudio=function(){var l;return D(this,void 0,void 0,function(){var A,I;return T(this,function(R){switch(R.label){case 0:return A=this,[4,w.default.createMicrophoneAudioTrack()];case 1:return A.localAudioTrack=R.sent(),(I=(l=this.localAudioTrack)===null||l===void 0?void 0:l.getMediaStreamTrack())&&this.onAudioStream(this.id,new MediaStream([I])),[4,this.client.publish([this.localAudioTrack])];case 2:return R.sent(),console.log("publish audio success!"),[2]}})})},u.prototype.call=function(){return D(this,void 0,void 0,function(){var l=this;return T(this,function(A){return this.client.on("user-published",function(I,R){return D(l,void 0,void 0,function(){var y,v,m,S,B,N,M=this;return T(this,function(U){switch(U.label){case 0:return[4,this.client.subscribe(I,R)];case 1:return U.sent(),console.log("subscribe success"),y=p(I.uid.toString()),v=y[0],m=y[1],console.log("remote user uid: ",v,", sid: ",m),R==="video"&&(S=(B=I.videoTrack)===null||B===void 0?void 0:B.getMediaStreamTrack())&&this.onVideoStream({cid:this.id.cid,uid:v,sid:m},new MediaStream([S])),R==="audio"&&(S=(N=I.audioTrack)===null||N===void 0?void 0:N.getMediaStreamTrack())&&this.onAudioStream({cid:this.id.cid,uid:v,sid:m},new MediaStream([S])),this.client.on("user-unpublished",function(K,j){return D(M,void 0,void 0,function(){var X,ie,se;return T(this,function(le){return console.log(K,j),X=p(K.uid.toString()),ie=X[0],se=X[1],console.log("remote close user uid: ",ie,", sid: ",se),j==="audio"&&this.callback[k.Events.userAudioClose]({cid:this.id.cid,uid:ie,sid:se}),j==="video"&&this.callback[k.Events.userVideoClose]({cid:this.id.cid,uid:ie,sid:se}),[2]})})}),[2]}})})}),[2]})})},u.prototype.closeVideo=function(l){return D(this,void 0,void 0,function(){return T(this,function(A){return f(this.id,l)&&(this.localVideoTrack.close(),this.client.unpublish(this.localVideoTrack)),[2]})})},u.prototype.closeAudio=function(l){return D(this,void 0,void 0,function(){return T(this,function(A){return f(this.id,l)&&(this.localAudioTrack.close(),this.client.unpublish(this.localAudioTrack)),[2]})})},u.prototype.leave=function(){return D(this,void 0,void 0,function(){return T(this,function(l){switch(l.label){case 0:return[4,this.client.leave()];case 1:return l.sent(),b.default.debug("already closed"),[2]}})})},u.prototype.startRecord=function(){return D(this,void 0,void 0,function(){var l=this;return T(this,function(A){return[2,new Promise(function(I){fetch(l.server+"/rtc/api/agora/recording/start/"+l.id.cid,{method:"post",headers:{"Content-Type":"application/json"}}).then(function(R){return R.json()}).then(function(R){console.log(R),I(R.id)},function(R){console.log(R),I("")})})]})})},u.prototype.closeRecord=function(){return D(this,void 0,void 0,function(){return T(this,function(l){return[2]})})},u.prototype.playbackCid=function(l,A){var I="/rtc/api/agora/playback/"+l;if(A.canPlayType("application/vnd.apple.mpegurl"))A.src=I;else if(g.default.isSupported()){var R=new g.default;R.loadSource(I),R.attachMedia(A)}},u.prototype.playbackSegment=function(l,A){var I="/rtc/api/agora/playback/segment/"+l;if(A.canPlayType("application/vnd.apple.mpegurl"))A.src=I;else if(g.default.isSupported()){var R=new g.default;R.loadSource(I),R.attachMedia(A)}},u}(),d=["webrtc-echo","webrtc-1v1","webrtc-mesh","webrtc-sfu","webrtc-mcu","janus","agora","pano","tcloud","qiniu","rongcloud"],o=function(){function u(l,A,I,R){var y,v,m;this.server=l,this.store={line:"agora",joined:!1,record:!1,video:(y={},y[A.uid]=!1,y),audio:(v={},v[A.uid]=!1,v)},this.featSet=I,this.io=R,this.able=[],this.line="auto",this.provide=d,this.rtc=new _(l,A),this.id=A,this.callback=((m={})[k.Events.userAudioStart]=function(S){},m[k.Events.userAudioClose]=function(S){},m[k.Events.userVideoStart]=function(S){},m[k.Events.userVideoClose]=function(S){},m.userpub=function(S){b.default.debug(S)},m),this.onVideoStream=function(S,B){b.default.debug(S,B)},this.onAudioStream=function(S,B){b.default.debug(S,B)}}return Object.defineProperty(u.prototype,"onVideoStream",{set:function(l){this.rtc.onVideoStream=l},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"onAudioStream",{set:function(l){this.rtc.onAudioStream=l},enumerable:!1,configurable:!0}),u.prototype.join=function(){return D(this,void 0,void 0,function(){return T(this,function(l){return this.store.joined=!0,this.rtc.join(),[2]})})},u.prototype.startVideo=function(){return D(this,void 0,void 0,function(){return T(this,function(l){return this.store.video[this.id.uid]=!0,this.rtc.startVideo(),[2]})})},u.prototype.startAudio=function(){return D(this,void 0,void 0,function(){return T(this,function(l){return this.store.audio[this.id.uid]=!0,this.rtc.startAudio(),[2]})})},u.prototype.closeVideo=function(l){return D(this,void 0,void 0,function(){return T(this,function(A){return this.store.video[l.uid]=!1,this.rtc.closeVideo(l),[2]})})},u.prototype.closeAudio=function(l){return D(this,void 0,void 0,function(){return T(this,function(A){return this.store.audio[l.uid]=!1,this.rtc.closeAudio(l),[2]})})},u.prototype.leave=function(){return D(this,void 0,void 0,function(){return T(this,function(l){return this.store.joined=!1,this.rtc.leave(),[2]})})},u.prototype.startRecord=function(){return D(this,void 0,void 0,function(){return T(this,function(l){return this.store.record=!0,[2,this.rtc.startRecord()]})})},u.prototype.closeRecord=function(){return D(this,void 0,void 0,function(){return T(this,function(l){return this.store.record=!1,this.rtc.closeRecord(),[2]})})},u.prototype.playbackCid=function(l,A){this.rtc.playbackCid(l,A)},u.prototype.playbackSegment=function(l,A){this.rtc.playbackSegment(l,A)},u.prototype.on=function(l,A){this.callback[l]=A,this.rtc.on(l,A)},u.prototype.setState=function(l){var A=this;l.joined&&(this.join(),setTimeout(function(){l.video[A.id.uid]&&A.startVideo(),l.audio[A.id.uid]&&A.startAudio()},1e3)),this.store=l},u.prototype.getState=function(){return this.store},u}(),s=function(){function u(l,A){this.key=l,this.io=A}return u.prototype.send=function(l){var A;this.io.send(((A={})[this.key]=l,A))},u.prototype.recv=function(l){},u.prototype.on=function(l){this.recv=l},u}(),a=function(){function u(l){this.io=l,this.map={}}return u.prototype.send=function(l){this.io.send(l)},u.prototype.recv=function(l){var A=this;Object.keys(l).forEach(function(I){A.map[I]&&A.map[I].recv(l[I])})},u.prototype.chan=function(l){var A=new s(l,this);return this.map[l]=A,A},u}();k.Conn=a,k.D42RTC=o,k.checkID=f,Object.defineProperty(k,"__esModule",{value:!0})})},79520:(Oe,he,H)=>{"use strict";H.d(he,{iv:()=>ae});var k=H(10003),W=H(7748),P=H(31938),E=H(33343),L=`You have illegal escape sequence in your template literal, most likely inside content's property value.
15
- Because you write your CSS inside a JavaScript string you actually have to do double escaping, so for example "content: '\\00d7';" should become "content: '\\\\00d7';".
16
- You can read more about this here:
17
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences`,O="You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key).",b=/[A-Z]|^ms/g,w=/_EMO_([^_]+?)_([^]*?)_EMO_/g,g=function(Te){return Te.charCodeAt(1)===45},D=function(Te){return Te!=null&&typeof Te!="boolean"},T=(0,E.Z)(function(Ge){return g(Ge)?Ge:Ge.replace(b,"-$&").toLowerCase()}),f=function(Te,Ue){switch(Te){case"animation":case"animationName":if(typeof Ue=="string")return Ue.replace(w,function(Ze,ut,Fe){return R={name:ut,styles:Fe,next:R},ut})}return P.Z[Te]!==1&&!g(Te)&&typeof Ue=="number"&&Ue!==0?Ue+"px":Ue};if(!1)var p,_,d,o,s,a;function u(Ge,Te,Ue){if(Ue==null)return"";if(Ue.__emotion_styles!==void 0)return Ue;switch(typeof Ue){case"boolean":return"";case"object":{if(Ue.anim===1)return R={name:Ue.name,styles:Ue.styles,next:R},Ue.name;if(Ue.styles!==void 0){var Ze=Ue.next;if(Ze!==void 0)for(;Ze!==void 0;)R={name:Ze.name,styles:Ze.styles,next:R},Ze=Ze.next;var ut=Ue.styles+";";return ut}return l(Ge,Te,Ue)}case"function":{if(Ge!==void 0){var Fe=R,Ye=Ue(Ge);return R=Fe,u(Ge,Te,Ye)}break}case"string":if(!1)var Ht,Bt;break}if(Te==null)return Ue;var Ft=Te[Ue];return Ft!==void 0?Ft:Ue}function l(Ge,Te,Ue){var Ze="";if(Array.isArray(Ue))for(var ut=0;ut<Ue.length;ut++)Ze+=u(Ge,Te,Ue[ut])+";";else for(var Fe in Ue){var Ye=Ue[Fe];if(typeof Ye!="object")Te!=null&&Te[Ye]!==void 0?Ze+=Fe+"{"+Te[Ye]+"}":D(Ye)&&(Ze+=T(Fe)+":"+f(Fe,Ye)+";");else if(Array.isArray(Ye)&&typeof Ye[0]=="string"&&(Te==null||Te[Ye[0]]===void 0))for(var Ht=0;Ht<Ye.length;Ht++)D(Ye[Ht])&&(Ze+=T(Fe)+":"+f(Fe,Ye[Ht])+";");else{var Bt=u(Ge,Te,Ye);switch(Fe){case"animation":case"animationName":{Ze+=T(Fe)+":"+Bt+";";break}default:Ze+=Fe+"{"+Bt+"}"}}}return Ze}var A=/label:\s*([^\s;\n{]+)\s*(;|$)/g,I,R,y=function(Te,Ue,Ze){if(Te.length===1&&typeof Te[0]=="object"&&Te[0]!==null&&Te[0].styles!==void 0)return Te[0];var ut=!0,Fe="";R=void 0;var Ye=Te[0];Ye==null||Ye.raw===void 0?(ut=!1,Fe+=u(Ze,Ue,Ye)):Fe+=Ye[0];for(var Ht=1;Ht<Te.length;Ht++)Fe+=u(Ze,Ue,Te[Ht]),ut&&(Fe+=Ye[Ht]);var Bt;A.lastIndex=0;for(var Ft="",Mt;(Mt=A.exec(Fe))!==null;)Ft+="-"+Mt[1];var cr=(0,W.Z)(Fe)+Ft;return{name:cr,styles:Fe,next:R}},v=!0;function m(Ge,Te,Ue){var Ze="";return Ue.split(" ").forEach(function(ut){Ge[ut]!==void 0?Te.push(Ge[ut]+";"):Ze+=ut+" "}),Ze}var S=function(Te,Ue,Ze){var ut=Te.key+"-"+Ue.name;if((Ze===!1||v===!1)&&Te.registered[ut]===void 0&&(Te.registered[ut]=Ue.styles),Te.inserted[Ue.name]===void 0){var Fe=Ue;do{var Ye=Te.insert(Ue===Fe?"."+ut:"",Fe,Te.sheet,!0);Fe=Fe.next}while(Fe!==void 0)}};function B(Ge,Te){if(Ge.inserted[Te.name]===void 0)return Ge.insert("",Te,Ge.sheet,!0)}function N(Ge,Te,Ue){var Ze=[],ut=m(Ge,Ze,Ue);return Ze.length<2?Ue:ut+Te(Ze)}var M=function(Te){var Ue=(0,k.Z)(Te);Ue.sheet.speedy=function(Ht){this.isSpeedy=Ht},Ue.compat=!0;var Ze=function(){for(var Bt=arguments.length,Ft=new Array(Bt),Mt=0;Mt<Bt;Mt++)Ft[Mt]=arguments[Mt];var cr=y(Ft,Ue.registered,void 0);return S(Ue,cr,!1),Ue.key+"-"+cr.name},ut=function(){for(var Bt=arguments.length,Ft=new Array(Bt),Mt=0;Mt<Bt;Mt++)Ft[Mt]=arguments[Mt];var cr=y(Ft,Ue.registered),sr="animation-"+cr.name;return B(Ue,{name:cr.name,styles:"@keyframes "+sr+"{"+cr.styles+"}"}),sr},Fe=function(){for(var Bt=arguments.length,Ft=new Array(Bt),Mt=0;Mt<Bt;Mt++)Ft[Mt]=arguments[Mt];var cr=y(Ft,Ue.registered);B(Ue,cr)},Ye=function(){for(var Bt=arguments.length,Ft=new Array(Bt),Mt=0;Mt<Bt;Mt++)Ft[Mt]=arguments[Mt];return N(Ue.registered,Ze,U(Ft))};return{css:Ze,cx:Ye,injectGlobal:Fe,keyframes:ut,hydrate:function(Bt){Bt.forEach(function(Ft){Ue.inserted[Ft]=!0})},flush:function(){Ue.registered={},Ue.inserted={},Ue.sheet.flush()},sheet:Ue.sheet,cache:Ue,getRegisteredStyles:m.bind(null,Ue.registered),merge:N.bind(null,Ue.registered,Ze)}},U=function Ge(Te){for(var Ue="",Ze=0;Ze<Te.length;Ze++){var ut=Te[Ze];if(ut!=null){var Fe=void 0;switch(typeof ut){case"boolean":break;case"object":{if(Array.isArray(ut))Fe=Ge(ut);else{Fe="";for(var Ye in ut)ut[Ye]&&Ye&&(Fe&&(Fe+=" "),Fe+=Ye)}break}default:Fe=ut}Fe&&(Ue&&(Ue+=" "),Ue+=Fe)}}return Ue},j=M({key:"css"}),X=j.flush,ie=j.hydrate,se=j.cx,le=j.merge,ve=j.getRegisteredStyles,q=j.injectGlobal,ee=j.keyframes,ae=j.css,_e=j.sheet,fe=j.cache},11918:(Oe,he,H)=>{"use strict";function k(g){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?k=function(T){return typeof T}:k=function(T){return T&&typeof Symbol=="function"&&T.constructor===Symbol&&T!==Symbol.prototype?"symbol":typeof T},k(g)}Object.defineProperty(he,"__esModule",{value:!0}),he.default=void 0;var W=E(H(2784));function P(){if(typeof WeakMap!="function")return null;var g=new WeakMap;return P=function(){return g},g}function E(g){if(g&&g.__esModule)return g;if(g===null||k(g)!=="object"&&typeof g!="function")return{default:g};var D=P();if(D&&D.has(g))return D.get(g);var T={},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in g)if(Object.prototype.hasOwnProperty.call(g,p)){var _=f?Object.getOwnPropertyDescriptor(g,p):null;_&&(_.get||_.set)?Object.defineProperty(T,p,_):T[p]=g[p]}return T.default=g,D&&D.set(g,T),T}function L(){return L=Object.assign||function(g){for(var D=1;D<arguments.length;D++){var T=arguments[D];for(var f in T)Object.prototype.hasOwnProperty.call(T,f)&&(g[f]=T[f])}return g},L.apply(this,arguments)}function O(g,D){return W.createElement("svg",L({width:"1em",height:"1em",viewBox:"0 0 21 32",fill:"currentColor",ref:D},g),W.createElement("path",{d:"M19.196 13.143a.612.612 0 01-.179.411l-8.321 8.321c-.107.107-.268.179-.411.179s-.304-.071-.411-.179l-8.321-8.321c-.107-.107-.179-.268-.179-.411s.071-.304.179-.411l.893-.893a.582.582 0 01.411-.179c.143 0 .304.071.411.179l7.018 7.018 7.018-7.018c.107-.107.268-.179.411-.179s.304.071.411.179l.893.893a.617.617 0 01.179.411z"}))}var b=W.forwardRef(O),w=b;he.default=w},35885:(Oe,he,H)=>{"use strict";function k(g){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?k=function(T){return typeof T}:k=function(T){return T&&typeof Symbol=="function"&&T.constructor===Symbol&&T!==Symbol.prototype?"symbol":typeof T},k(g)}Object.defineProperty(he,"__esModule",{value:!0}),he.default=void 0;var W=E(H(2784));function P(){if(typeof WeakMap!="function")return null;var g=new WeakMap;return P=function(){return g},g}function E(g){if(g&&g.__esModule)return g;if(g===null||k(g)!=="object"&&typeof g!="function")return{default:g};var D=P();if(D&&D.has(g))return D.get(g);var T={},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in g)if(Object.prototype.hasOwnProperty.call(g,p)){var _=f?Object.getOwnPropertyDescriptor(g,p):null;_&&(_.get||_.set)?Object.defineProperty(T,p,_):T[p]=g[p]}return T.default=g,D&&D.set(g,T),T}function L(){return L=Object.assign||function(g){for(var D=1;D<arguments.length;D++){var T=arguments[D];for(var f in T)Object.prototype.hasOwnProperty.call(T,f)&&(g[f]=T[f])}return g},L.apply(this,arguments)}function O(g,D){return W.createElement("svg",L({width:"1em",height:"1em",viewBox:"0 0 12 32",fill:"currentColor",ref:D},g),W.createElement("path",{d:"M11.196 9.714a.612.612 0 01-.179.411l-7.018 7.018 7.018 7.018c.107.107.179.268.179.411s-.071.304-.179.411l-.893.893c-.107.107-.268.179-.411.179s-.304-.071-.411-.179L.981 17.555c-.107-.107-.179-.268-.179-.411s.071-.304.179-.411l8.321-8.321c.107-.107.268-.179.411-.179s.304.071.411.179l.893.893c.107.107.179.25.179.411z"}))}var b=W.forwardRef(O),w=b;he.default=w},89406:(Oe,he,H)=>{"use strict";function k(g){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?k=function(T){return typeof T}:k=function(T){return T&&typeof Symbol=="function"&&T.constructor===Symbol&&T!==Symbol.prototype?"symbol":typeof T},k(g)}Object.defineProperty(he,"__esModule",{value:!0}),he.default=void 0;var W=E(H(2784));function P(){if(typeof WeakMap!="function")return null;var g=new WeakMap;return P=function(){return g},g}function E(g){if(g&&g.__esModule)return g;if(g===null||k(g)!=="object"&&typeof g!="function")return{default:g};var D=P();if(D&&D.has(g))return D.get(g);var T={},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in g)if(Object.prototype.hasOwnProperty.call(g,p)){var _=f?Object.getOwnPropertyDescriptor(g,p):null;_&&(_.get||_.set)?Object.defineProperty(T,p,_):T[p]=g[p]}return T.default=g,D&&D.set(g,T),T}function L(){return L=Object.assign||function(g){for(var D=1;D<arguments.length;D++){var T=arguments[D];for(var f in T)Object.prototype.hasOwnProperty.call(T,f)&&(g[f]=T[f])}return g},L.apply(this,arguments)}function O(g,D){return W.createElement("svg",L({width:"1em",height:"1em",viewBox:"0 0 11 32",fill:"currentColor",ref:D},g),W.createElement("path",{d:"M10.625 17.143a.612.612 0 01-.179.411l-8.321 8.321c-.107.107-.268.179-.411.179s-.304-.071-.411-.179l-.893-.893a.582.582 0 01-.179-.411c0-.143.071-.304.179-.411l7.018-7.018L.41 10.124c-.107-.107-.179-.268-.179-.411s.071-.304.179-.411l.893-.893c.107-.107.268-.179.411-.179s.304.071.411.179l8.321 8.321a.617.617 0 01.179.411z"}))}var b=W.forwardRef(O),w=b;he.default=w},57559:(Oe,he,H)=>{"use strict";function k(g){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?k=function(T){return typeof T}:k=function(T){return T&&typeof Symbol=="function"&&T.constructor===Symbol&&T!==Symbol.prototype?"symbol":typeof T},k(g)}Object.defineProperty(he,"__esModule",{value:!0}),he.default=void 0;var W=E(H(2784));function P(){if(typeof WeakMap!="function")return null;var g=new WeakMap;return P=function(){return g},g}function E(g){if(g&&g.__esModule)return g;if(g===null||k(g)!=="object"&&typeof g!="function")return{default:g};var D=P();if(D&&D.has(g))return D.get(g);var T={},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in g)if(Object.prototype.hasOwnProperty.call(g,p)){var _=f?Object.getOwnPropertyDescriptor(g,p):null;_&&(_.get||_.set)?Object.defineProperty(T,p,_):T[p]=g[p]}return T.default=g,D&&D.set(g,T),T}function L(){return L=Object.assign||function(g){for(var D=1;D<arguments.length;D++){var T=arguments[D];for(var f in T)Object.prototype.hasOwnProperty.call(T,f)&&(g[f]=T[f])}return g},L.apply(this,arguments)}function O(g,D){return W.createElement("svg",L({width:"1em",height:"1em",viewBox:"0 0 21 32",fill:"currentColor",ref:D},g),W.createElement("path",{d:"M19.196 21.143a.612.612 0 01-.179.411l-.893.893a.582.582 0 01-.411.179.612.612 0 01-.411-.179l-7.018-7.018-7.018 7.018c-.107.107-.268.179-.411.179s-.304-.071-.411-.179l-.893-.893c-.107-.107-.179-.268-.179-.411s.071-.304.179-.411l8.321-8.321c.107-.107.268-.179.411-.179s.304.071.411.179l8.321 8.321a.617.617 0 01.179.411z"}))}var b=W.forwardRef(O),w=b;he.default=w},28801:(Oe,he,H)=>{"use strict";var k;k={value:!0},Object.defineProperty(he,"Z",{enumerable:!0,get:function(){return W.default}});var W=P(H(75939));function P(E){return E&&E.__esModule?E:{default:E}}},7582:(Oe,he,H)=>{"use strict";var k;k={value:!0},Object.defineProperty(he,"Z",{enumerable:!0,get:function(){return W.default}});var W=P(H(70816));function P(E){return E&&E.__esModule?E:{default:E}}},41840:(Oe,he,H)=>{"use strict";var k;k={value:!0},Object.defineProperty(he,"Z",{enumerable:!0,get:function(){return W.default}});var W=P(H(85911));function P(E){return E&&E.__esModule?E:{default:E}}},70095:(Oe,he,H)=>{"use strict";var k;k={value:!0},Object.defineProperty(he,"Z",{enumerable:!0,get:function(){return W.default}});var W=P(H(14586));function P(E){return E&&E.__esModule?E:{default:E}}},75939:(Oe,he,H)=>{"use strict";var k=H(14859);he.__esModule=!0,he.default=void 0;var W=k(H(620)),P=k(H(11918)),E=(0,W.default)({as:P.default,ariaLabel:"angle down",category:"legacy",displayName:"AngleDown"}),L=E;he.default=L,Oe.exports=he.default},70816:(Oe,he,H)=>{"use strict";var k=H(14859);he.__esModule=!0,he.default=void 0;var W=k(H(620)),P=k(H(35885)),E=(0,W.default)({as:P.default,ariaLabel:"angle left",category:"legacy",displayName:"AngleLeft"}),L=E;he.default=L,Oe.exports=he.default},85911:(Oe,he,H)=>{"use strict";var k=H(14859);he.__esModule=!0,he.default=void 0;var W=k(H(620)),P=k(H(89406)),E=(0,W.default)({as:P.default,ariaLabel:"angle right",category:"legacy",displayName:"AngleRight"}),L=E;he.default=L,Oe.exports=he.default},14586:(Oe,he,H)=>{"use strict";var k=H(14859);he.__esModule=!0,he.default=void 0;var W=k(H(620)),P=k(H(57559)),E=(0,W.default)({as:P.default,ariaLabel:"angle up",category:"legacy",displayName:"AngleUp"}),L=E;he.default=L,Oe.exports=he.default},45904:function(Oe,he,H){"use strict";/*
18
- @license
19
- UAParser.js v0.7.28
20
- Lightweight JavaScript-based User-Agent string parser
21
- https://github.com/faisalman/ua-parser-js
22
-
23
- Copyright ? 2012-2021 Faisal Salman <f@faisalman.com>
24
- Licensed under MIT License
25
- *****************************************************************************
26
- Copyright (c) Microsoft Corporation. All rights reserved.
27
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
28
- this file except in compliance with the License. You may obtain a copy of the
29
- License at http://www.apache.org/licenses/LICENSE-2.0
30
-
31
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
32
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
33
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
34
- MERCHANTABLITY OR NON-INFRINGEMENT.
35
-
36
- See the Apache Version 2.0 License for specific language governing permissions
37
- and limitations under the License.
38
- *****************************************************************************/(function(k,W){Oe.exports=W()})(this,function(){function k(t,e,r){return t(r={path:e,exports:{},require:function(i,n){throw Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}},r.exports),r.exports}function W(t,e,r){return(t=t.match(e))&&t.length>=r&&Ii(t[r],10)}function P(t,e,r){if(t.RTCPeerConnection){t=t.RTCPeerConnection.prototype;var i=t.addEventListener;t.addEventListener=function(c,h){if(c!==e)return i.apply(this,arguments);let C=x=>{(x=r(x))&&h(x)};return this._eventMap=this._eventMap||{},this._eventMap[h]=C,i.apply(this,[c,C])};var n=t.removeEventListener;t.removeEventListener=function(c,h){if(c!==e||!this._eventMap||!this._eventMap[h])return n.apply(this,arguments);let C=this._eventMap[h];return delete this._eventMap[h],n.apply(this,[c,C])},_r(t,"on"+e,{get(){return this["_on"+e]},set(c){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),c&&this.addEventListener(e,this["_on"+e]=c)},enumerable:!0,configurable:!0})}}function E(t){return typeof t!="boolean"?Error("Argument type: "+typeof t+". Please use a boolean."):(Sh=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function L(t){return typeof t!="boolean"?Error("Argument type: "+typeof t+". Please use a boolean."):(Th=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function O(){typeof window!="object"||Sh||typeof console!="undefined"&&typeof console.log=="function"&&console.log.apply(console,arguments)}function b(t,e){Th&&console.warn(t+" is deprecated, please use "+e+" instead.")}function w(t){let{navigator:e}=t,r={browser:null,version:null};if(t===void 0||!t.navigator)return r.browser="Not a browser.",r;if(e.mozGetUserMedia)r.browser="firefox",r.version=W(e.userAgent,/Firefox\/(\d+)\./,1);else if(e.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection&&!t.RTCIceGatherer)r.browser="chrome",r.version=W(e.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(e.mediaDevices&&e.userAgent.match(/Edge\/(\d+).(\d+)$/))r.browser="edge",r.version=W(e.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!t.RTCPeerConnection||!e.userAgent.match(/AppleWebKit\/(\d+)\./))return r.browser="Not a supported browser.",r;r.browser="safari",r.version=W(e.userAgent,/AppleWebKit\/(\d+)\./,1),r.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype}return r}function g(t){var e;return Object.prototype.toString.call(t)==="[object Object]"?Ml(e=Er(t)).call(e,function(r,i){var n=Object.prototype.toString.call(t[i])==="[object Object]";let c=n?g(t[i]):t[i];return n=n&&!Er(c).length,c===void 0||n?r:Sn(r,{[i]:c})},{}):t}function D(t,e,r){let i=r?"outbound-rtp":"inbound-rtp",n=new Lr;if(e===null)return n;let c=[];return Re(t).call(t,h=>{h.type==="track"&&h.trackIdentifier===e.id&&c.push(h)}),Re(c).call(c,h=>{Re(t).call(t,C=>{C.type===i&&C.trackId===h.id&&function x(Q,F,V){var Y;F&&!V.has(F.id)&&(V.set(F.id,F),Re(Y=Er(F)).call(Y,$=>{if(ph($).call($,"Id"))x(Q,Q.get(F[$]),V);else if(ph($).call($,"Ids")){var te;Re(te=F[$]).call(te,ce=>{x(Q,Q.get(ce),V)})}}))}(t,C,n)})}),n}function T(t){let e=t&&t.navigator;if(e.mediaDevices){var r=w(t),i=function(C){var x;if(typeof C!="object"||C.mandatory||C.optional)return C;const Q={};var F;return Re(x=Er(C)).call(x,V=>{if(V!=="require"&&V!=="advanced"&&V!=="mediaSource"){var Y=typeof C[V]=="object"?C[V]:{ideal:C[V]};Y.exact!==void 0&&typeof Y.exact=="number"&&(Y.min=Y.max=Y.exact);var $=function(ce,Ae){return ce?ce+Ae.charAt(0).toUpperCase()+$i(Ae).call(Ae,1):Ae==="deviceId"?"sourceId":Ae};if(Y.ideal!==void 0){Q.optional=Q.optional||[];let ce={};typeof Y.ideal=="number"?(ce[$("min",V)]=Y.ideal,Q.optional.push(ce),ce={},ce[$("max",V)]=Y.ideal,Q.optional.push(ce)):(ce[$("",V)]=Y.ideal,Q.optional.push(ce))}var te;Y.exact!==void 0&&typeof Y.exact!="number"?(Q.mandatory=Q.mandatory||{},Q.mandatory[$("",V)]=Y.exact):Re(te=["min","max"]).call(te,ce=>{Y[ce]!==void 0&&(Q.mandatory=Q.mandatory||{},Q.mandatory[$(ce,V)]=Y[ce])})}}),C.advanced&&(Q.optional=ne(F=Q.optional||[]).call(F,C.advanced)),Q},n=function(C,x){if(61<=r.version)return x(C);if((C=JSON.parse(ht(C)))&&typeof C.audio=="object"){var Q=function(F,V,Y){V in F&&!(Y in F)&&(F[Y]=F[V],delete F[V])};Q((C=JSON.parse(ht(C))).audio,"autoGainControl","googAutoGainControl"),Q(C.audio,"noiseSuppression","googNoiseSuppression"),C.audio=i(C.audio)}if(C&&typeof C.video=="object"){let F=C.video.facingMode;if(F=F&&(typeof F=="object"?F:{ideal:F}),Q=66>r.version,!(!F||F.exact!=="user"&&F.exact!=="environment"&&F.ideal!=="user"&&F.ideal!=="environment"||e.mediaDevices.getSupportedConstraints&&e.mediaDevices.getSupportedConstraints().facingMode&&!Q)){let V;if(delete C.video.facingMode,F.exact==="environment"||F.ideal==="environment"?V=["back","rear"]:F.exact!=="user"&&F.ideal!=="user"||(V=["front"]),V)return e.mediaDevices.enumerateDevices().then(Y=>{Y=Gt(Y).call(Y,te=>te.kind==="videoinput");let $=tr(Y).call(Y,te=>ff(V).call(V,ce=>{var Ae;return Ir(Ae=te.label.toLowerCase()).call(Ae,ce)}));return!$&&Y.length&&Ir(V).call(V,"back")&&($=Y[Y.length-1]),$&&(C.video.deviceId=F.exact?{exact:$.deviceId}:{ideal:$.deviceId}),C.video=i(C.video),Af("chrome: "+ht(C)),x(C)})}C.video=i(C.video)}return Af("chrome: "+ht(C)),x(C)},c=function(C){return 64<=r.version?C:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[C.name]||C.name,message:C.message,constraint:C.constraint||C.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(t=function(C,x,Q){n(C,F=>{e.webkitGetUserMedia(F,x,V=>{Q&&Q(c(V))})})},e.getUserMedia=Si(t).call(t,e),e.mediaDevices.getUserMedia){var h;let C=Si(h=e.mediaDevices.getUserMedia).call(h,e.mediaDevices);e.mediaDevices.getUserMedia=function(x){return n(x,Q=>C(Q).then(F=>{var V;if(Q.audio&&!F.getAudioTracks().length||Q.video&&!F.getVideoTracks().length)throw Re(V=F.getTracks()).call(V,Y=>{Y.stop()}),new DOMException("","NotFoundError");return F},F=>it.reject(c(F))))}}}}function f(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function p(t){if(typeof t!="object"||!t.RTCPeerConnection||"ontrack"in t.RTCPeerConnection.prototype)P(t,"track",e=>(e.transceiver||_r(e,"transceiver",{value:{receiver:e.receiver}}),e));else{_r(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(r){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=r)},enumerable:!0,configurable:!0});let e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=r=>{var i;r.stream.addEventListener("addtrack",n=>{let c;var h;t.RTCPeerConnection.prototype.getReceivers?c=tr(h=this.getReceivers()).call(h,C=>C.track&&C.track.id===n.track.id):c={track:n.track},h=new Event("track"),h.track=n.track,h.receiver=c,h.transceiver={receiver:c},h.streams=[r.stream],this.dispatchEvent(h)}),Re(i=r.stream.getTracks()).call(i,n=>{let c;var h;t.RTCPeerConnection.prototype.getReceivers?c=tr(h=this.getReceivers()).call(h,C=>C.track&&C.track.id===n.id):c={track:n},h=new Event("track"),h.track=n,h.receiver=c,h.transceiver={receiver:c},h.streams=[r.stream],this.dispatchEvent(h)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}}function _(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){let e=function(n,c){return{track:c,get dtmf(){return this._dtmf===void 0&&(c.kind==="audio"?this._dtmf=n.createDTMFSender(c):this._dtmf=null),this._dtmf},_pc:n}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function(){var h;return this._senders=this._senders||[],$i(h=this._senders).call(h)};let n=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(h,C){let x=n.apply(this,arguments);return x||(x=e(this,h),this._senders.push(x)),x};let c=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(h){var C;c.apply(this,arguments);let x=Wt(C=this._senders).call(C,h);var Q;x!==-1&&un(Q=this._senders).call(Q,x,1)}}let r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(n){var c;this._senders=this._senders||[],r.apply(this,[n]),Re(c=n.getTracks()).call(c,h=>{this._senders.push(e(this,h))})};let i=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(n){var c;this._senders=this._senders||[],i.apply(this,[n]),Re(c=n.getTracks()).call(c,h=>{var C;let x=tr(C=this._senders).call(C,V=>V.track===h);var Q,F;x&&un(Q=this._senders).call(Q,Wt(F=this._senders).call(F,x),1)})}}else if(typeof t=="object"&&t.RTCPeerConnection&&"getSenders"in t.RTCPeerConnection.prototype&&"createDTMFSender"in t.RTCPeerConnection.prototype&&t.RTCRtpSender&&!("dtmf"in t.RTCRtpSender.prototype)){let e=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function(){let r=e.apply(this,[]);return Re(r).call(r,i=>i._pc=this),r},_r(t.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function d(t){if(t.RTCPeerConnection){var e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){let[r,i,n]=arguments;if(0<arguments.length&&typeof r=="function")return e.apply(this,arguments);if(e.length===0&&(arguments.length===0||typeof r!="function"))return e.apply(this,[]);let c=function(C){const x={};return C=C.result(),Re(C).call(C,Q=>{var F;const V={id:Q.id,timestamp:Q.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[Q.type]||Q.type};Re(F=Q.names()).call(F,Y=>{V[Y]=Q.stat(Y)}),x[V.id]=V}),x},h=function(C){var x;return new Lr(yt(x=Er(C)).call(x,Q=>[Q,C[Q]]))};return 2<=arguments.length?e.apply(this,[function(C){i(h(c(C)))},r]):new it((C,x)=>{e.apply(this,[function(Q){C(h(c(Q)))},x])}).then(i,n)}}}function o(t){if(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver){if(!("getStats"in t.RTCRtpSender.prototype)){let r=t.RTCPeerConnection.prototype.getSenders;r&&(t.RTCPeerConnection.prototype.getSenders=function(){let n=r.apply(this,[]);return Re(n).call(n,c=>c._pc=this),n});let i=t.RTCPeerConnection.prototype.addTrack;i&&(t.RTCPeerConnection.prototype.addTrack=function(){let n=i.apply(this,arguments);return n._pc=this,n}),t.RTCRtpSender.prototype.getStats=function(){let n=this;return this._pc.getStats().then(c=>D(c,n.track,!0))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){let r=t.RTCPeerConnection.prototype.getReceivers;r&&(t.RTCPeerConnection.prototype.getReceivers=function(){let i=r.apply(this,[]);return Re(i).call(i,n=>n._pc=this),i}),P(t,"track",i=>(i.receiver._pc=i.srcElement,i)),t.RTCRtpReceiver.prototype.getStats=function(){let i=this;return this._pc.getStats().then(n=>D(n,i.track,!1))}}if("getStats"in t.RTCRtpSender.prototype&&"getStats"in t.RTCRtpReceiver.prototype){var e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){if(0<arguments.length&&arguments[0]instanceof t.MediaStreamTrack){var r,i;let n=arguments[0],c,h,C;return Re(r=this.getSenders()).call(r,x=>{x.track===n&&(c?C=!0:c=x)}),Re(i=this.getReceivers()).call(i,x=>(x.track===n&&(h?C=!0:h=x),x.track===n)),C||c&&h?it.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):c?c.getStats():h?h.getStats():it.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}}}function s(t){t.RTCPeerConnection.prototype.getLocalStreams=function(){var c;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},yt(c=Er(this._shimmedLocalStreams)).call(c,h=>this._shimmedLocalStreams[h][0])};let e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(c,h){var C;if(!h)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};let x=e.apply(this,arguments);return this._shimmedLocalStreams[h.id]?Wt(C=this._shimmedLocalStreams[h.id]).call(C,x)===-1&&this._shimmedLocalStreams[h.id].push(x):this._shimmedLocalStreams[h.id]=[h,x],x};let r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(c){var h,C,x;this._shimmedLocalStreams=this._shimmedLocalStreams||{},Re(h=c.getTracks()).call(h,F=>{var V;if(tr(V=this.getSenders()).call(V,Y=>Y.track===F))throw new DOMException("Track already exists.","InvalidAccessError")});let Q=this.getSenders();r.apply(this,arguments),h=Gt(C=this.getSenders()).call(C,F=>Wt(Q).call(Q,F)===-1),this._shimmedLocalStreams[c.id]=ne(x=[c]).call(x,h)};let i=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(c){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[c.id],i.apply(this,arguments)};let n=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(c){var h;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},c&&Re(h=Er(this._shimmedLocalStreams)).call(h,C=>{var x;let Q=Wt(x=this._shimmedLocalStreams[C]).call(x,c);var F;Q!==-1&&un(F=this._shimmedLocalStreams[C]).call(F,Q,1),this._shimmedLocalStreams[C].length===1&&delete this._shimmedLocalStreams[C]}),n.apply(this,arguments)}}function a(t){function e(F,V){var Y;let $=V.sdp;return Re(Y=Er(F._reverseStreams||[])).call(Y,te=>{te=F._reverseStreams[te],$=$.replace(new RegExp(F._streams[te.id].id,"g"),te.id)}),new RTCSessionDescription({type:V.type,sdp:$})}function r(F,V){var Y;let $=V.sdp;return Re(Y=Er(F._reverseStreams||[])).call(Y,te=>{te=F._reverseStreams[te],$=$.replace(new RegExp(te.id,"g"),F._streams[te.id].id)}),new RTCSessionDescription({type:V.type,sdp:$})}var i;if(t.RTCPeerConnection){var n=w(t);if(t.RTCPeerConnection.prototype.addTrack&&65<=n.version)return s(t);var c=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function(){let F=c.apply(this);return this._reverseStreams=this._reverseStreams||{},yt(F).call(F,V=>this._reverseStreams[V.id])};var h=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(F){var V;this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},Re(V=F.getTracks()).call(V,Y=>{var $;if(tr($=this.getSenders()).call($,te=>te.track===Y))throw new DOMException("Track already exists.","InvalidAccessError")}),this._reverseStreams[F.id]||(V=new t.MediaStream(F.getTracks()),this._streams[F.id]=V,this._reverseStreams[V.id]=F,F=V),h.apply(this,[F])};var C=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(F){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},C.apply(this,[this._streams[F.id]||F]),delete this._reverseStreams[this._streams[F.id]?this._streams[F.id].id:F.id],delete this._streams[F.id]},t.RTCPeerConnection.prototype.addTrack=function(F,V){var Y,$,te;if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");let ce=$i([]).call(arguments,1);if(ce.length!==1||!tr(Y=ce[0].getTracks()).call(Y,Ae=>Ae===F))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(tr($=this.getSenders()).call($,Ae=>Ae.track===F))throw new DOMException("Track already exists.","InvalidAccessError");return this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},(Y=this._streams[V.id])?(Y.addTrack(F),it.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))})):(Y=new t.MediaStream([F]),this._streams[V.id]=Y,this._reverseStreams[Y.id]=V,this.addStream(Y)),tr(te=this.getSenders()).call(te,Ae=>Ae.track===F)},Re(i=["createOffer","createAnswer"]).call(i,function(F){let V=t.RTCPeerConnection.prototype[F];t.RTCPeerConnection.prototype[F]={[F](){const Y=arguments;return arguments.length&&typeof arguments[0]=="function"?V.apply(this,[$=>{$=e(this,$),Y[0].apply(null,[$])},$=>{Y[1]&&Y[1].apply(null,$)},arguments[2]]):V.apply(this,arguments).then($=>e(this,$))}}[F]});var x=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=r(this,arguments[0]),x.apply(this,arguments)):x.apply(this,arguments)};var Q=gr(t.RTCPeerConnection.prototype,"localDescription");_r(t.RTCPeerConnection.prototype,"localDescription",{get(){let F=Q.get.apply(this);return F.type===""?F:e(this,F)}}),t.RTCPeerConnection.prototype.removeTrack=function(F){var V;if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!F._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(F._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let Y;this._streams=this._streams||{},Re(V=Er(this._streams)).call(V,$=>{var te;tr(te=this._streams[$].getTracks()).call(te,ce=>F.track===ce)&&(Y=this._streams[$])}),Y&&(Y.getTracks().length===1?this.removeStream(this._reverseStreams[Y.id]):Y.removeTrack(F.track),this.dispatchEvent(new Event("negotiationneeded")))}}}function u(t){let e=w(t);if(!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection){var r;53>e.version&&Re(r=["setLocalDescription","setRemoteDescription","addIceCandidate"]).call(r,function(n){let c=t.RTCPeerConnection.prototype[n];t.RTCPeerConnection.prototype[n]={[n](){return arguments[0]=new(n==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),c.apply(this,arguments)}}[n]});var i=t.RTCPeerConnection.prototype.addIceCandidate;t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?78>e.version&&arguments[0]&&arguments[0].candidate===""?it.resolve():i.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),it.resolve())}}}function l(t){P(t,"negotiationneeded",e=>{if(e.target.signalingState==="stable")return e})}function A(t,e,r,i,n){return e=Kt.writeRtpDescription(t.kind,e),e+=Kt.writeIceParameters(t.iceGatherer.getLocalParameters()),e+=Kt.writeDtlsParameters(t.dtlsTransport.getLocalParameters(),r==="offer"?"actpass":n||"active"),e+="a=mid:"+t.mid+`\r
39
- `,t.rtpSender&&t.rtpReceiver?e+=`a=sendrecv\r
40
- `:t.rtpSender?e+=`a=sendonly\r
41
- `:t.rtpReceiver?e+=`a=recvonly\r
42
- `:e+=`a=inactive\r
43
- `,t.rtpSender&&(r=t.rtpSender._initialTrackId||t.rtpSender.track.id,t.rtpSender._initialTrackId=r,i="msid:"+(i?i.id:"-")+" "+r+`\r
44
- `,e=e+("a="+i)+("a=ssrc:"+t.sendEncodingParameters[0].ssrc+" "+i),t.sendEncodingParameters[0].rtx&&(e+="a=ssrc:"+t.sendEncodingParameters[0].rtx.ssrc+" "+i,e+="a=ssrc-group:FID "+t.sendEncodingParameters[0].ssrc+" "+t.sendEncodingParameters[0].rtx.ssrc+`\r
45
- `)),e+="a=ssrc:"+t.sendEncodingParameters[0].ssrc+" cname:"+Kt.localCName+`\r
46
- `,t.rtpSender&&t.sendEncodingParameters[0].rtx&&(e+="a=ssrc:"+t.sendEncodingParameters[0].rtx.ssrc+" cname:"+Kt.localCName+`\r
47
- `),e}function I(t,e){var r={codecs:[],headerExtensions:[],fecMechanisms:[]},i=function(c,h){c=parseInt(c,10);for(var C=0;C<h.length;C++)if(h[C].payloadType===c||h[C].preferredPayloadType===c)return h[C]},n=function(c,h,C,x){return c=i(c.parameters.apt,C),h=i(h.parameters.apt,x),c&&h&&c.name.toLowerCase()===h.name.toLowerCase()};return t.codecs.forEach(function(c){for(var h=0;h<e.codecs.length;h++){var C=e.codecs[h];if(c.name.toLowerCase()===C.name.toLowerCase()&&c.clockRate===C.clockRate&&(c.name.toLowerCase()!=="rtx"||!c.parameters||!C.parameters.apt||n(c,C,t.codecs,e.codecs))){(C=JSON.parse(JSON.stringify(C))).numChannels=Math.min(c.numChannels,C.numChannels),r.codecs.push(C),C.rtcpFeedback=C.rtcpFeedback.filter(function(x){for(var Q=0;Q<c.rtcpFeedback.length;Q++)if(c.rtcpFeedback[Q].type===x.type&&c.rtcpFeedback[Q].parameter===x.parameter)return!0;return!1});break}}}),t.headerExtensions.forEach(function(c){for(var h=0;h<e.headerExtensions.length;h++){var C=e.headerExtensions[h];if(c.uri===C.uri){r.headerExtensions.push(C);break}}}),r}function R(t,e,r){return{offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[e][t].indexOf(r)!==-1}function y(t,e){var r=t.getRemoteCandidates().find(function(i){return e.foundation===i.foundation&&e.ip===i.ip&&e.port===i.port&&e.priority===i.priority&&e.protocol===i.protocol&&e.type===i.type});return r||t.addRemoteCandidate(e),!r}function v(t,e){return e=Error(e),e.name=t,e.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[t],e}function m(t){var e;t=t&&t.navigator;let r=Si(e=t.mediaDevices.getUserMedia).call(e,t.mediaDevices);t.mediaDevices.getUserMedia=function(i){return r(i).catch(n=>it.reject(function(c){return{name:{PermissionDeniedError:"NotAllowedError"}[c.name]||c.name,message:c.message,constraint:c.constraint,toString(){return this.name}}}(n)))}}function S(t){var e;"getDisplayMedia"in t.navigator&&t.navigator.mediaDevices&&(t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||(t.navigator.mediaDevices.getDisplayMedia=Si(e=t.navigator.getDisplayMedia).call(e,t.navigator)))}function B(t){let e=w(t);if(t.RTCIceGatherer&&(t.RTCIceCandidate||(t.RTCIceCandidate=function(i){return i}),t.RTCSessionDescription||(t.RTCSessionDescription=function(i){return i}),15025>e.version)){let i=gr(t.MediaStreamTrack.prototype,"enabled");_r(t.MediaStreamTrack.prototype,"enabled",{set(n){i.set.call(this,n);let c=new Event("enabled");c.enabled=n,this.dispatchEvent(c)}})}!t.RTCRtpSender||"dtmf"in t.RTCRtpSender.prototype||_r(t.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=new t.RTCDtmfSender(this):this.track.kind==="video"&&(this._dtmf=null)),this._dtmf}}),t.RTCDtmfSender&&!t.RTCDTMFSender&&(t.RTCDTMFSender=t.RTCDtmfSender);let r=jp(t,e.version);t.RTCPeerConnection=function(i){return i&&i.iceServers&&(i.iceServers=function(n,c){let h=!1;return n=JSON.parse(ht(n)),Gt(n).call(n,C=>{if(C&&(C.urls||C.url)){var x=C.urls||C.url;C.url&&!C.urls&&b("RTCIceServer.url","RTCIceServer.urls");let Q=typeof x=="string";return Q&&(x=[x]),x=Gt(x).call(x,F=>Wt(F).call(F,"stun:")===0?!1:(F=jc(F).call(F,"turn")&&!jc(F).call(F,"turn:[")&&Ir(F).call(F,"transport=udp"))&&!h?(h=!0,!0):F&&!h),delete C.url,C.urls=Q?x[0]:x,!!x.length}})}(i.iceServers,e.version),O("ICE servers after filtering:",i.iceServers)),new r(i)},t.RTCPeerConnection.prototype=r.prototype}function N(t){!t.RTCRtpSender||"replaceTrack"in t.RTCRtpSender.prototype||(t.RTCRtpSender.prototype.replaceTrack=t.RTCRtpSender.prototype.setTrack)}function M(t){let e=w(t),r=t&&t.navigator;if(t=t&&t.MediaStreamTrack,r.getUserMedia=function(n,c,h){b("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(n).then(c,h)},!(55<e.version&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var i;let n=function(h,C,x){C in h&&!(x in h)&&(h[x]=h[C],delete h[C])},c=Si(i=r.mediaDevices.getUserMedia).call(i,r.mediaDevices);if(r.mediaDevices.getUserMedia=function(h){return typeof h=="object"&&typeof h.audio=="object"&&(h=JSON.parse(ht(h)),n(h.audio,"autoGainControl","mozAutoGainControl"),n(h.audio,"noiseSuppression","mozNoiseSuppression")),c(h)},t&&t.prototype.getSettings){let h=t.prototype.getSettings;t.prototype.getSettings=function(){let C=h.apply(this,arguments);return n(C,"mozAutoGainControl","autoGainControl"),n(C,"mozNoiseSuppression","noiseSuppression"),C}}if(t&&t.prototype.applyConstraints){let h=t.prototype.applyConstraints;t.prototype.applyConstraints=function(C){return this.kind==="audio"&&typeof C=="object"&&(C=JSON.parse(ht(C)),n(C,"autoGainControl","mozAutoGainControl"),n(C,"noiseSuppression","mozNoiseSuppression")),h.apply(this,[C])}}}}function U(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&_r(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function K(t){let e=w(t);if(typeof t=="object"&&(t.RTCPeerConnection||t.mozRTCPeerConnection)){var r;!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),53>e.version&&Re(r=["setLocalDescription","setRemoteDescription","addIceCandidate"]).call(r,function(h){let C=t.RTCPeerConnection.prototype[h];t.RTCPeerConnection.prototype[h]={[h](){return arguments[0]=new(h==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),C.apply(this,arguments)}}[h]});var i=t.RTCPeerConnection.prototype.addIceCandidate;t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?68>e.version&&arguments[0]&&arguments[0].candidate===""?it.resolve():i.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),it.resolve())};var n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},c=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){let[h,C,x]=arguments;return c.apply(this,[h||null]).then(Q=>{if(53>e.version&&!C)try{Re(Q).call(Q,F=>{F.type=n[F.type]||F.type})}catch(F){if(F.name!=="TypeError")throw F;Re(Q).call(Q,(V,Y)=>{Q.set(Y,Sn({},V,{type:n[V.type]||V.type}))})}return Q}).then(C,x)}}}function j(t){if(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender&&!(t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)){var e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){let i=e.apply(this,[]);return Re(i).call(i,n=>n._pc=this),i});var r=t.RTCPeerConnection.prototype.addTrack;r&&(t.RTCPeerConnection.prototype.addTrack=function(){let i=r.apply(this,arguments);return i._pc=this,i}),t.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):it.resolve(new Lr)}}}function X(t){if(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender&&!(t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)){var e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){let r=e.apply(this,[]);return Re(r).call(r,i=>i._pc=this),r}),P(t,"track",r=>(r.receiver._pc=r.srcElement,r)),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function ie(t){!t.RTCPeerConnection||"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(e){var r;b("removeStream","removeTrack"),Re(r=this.getSenders()).call(r,i=>{var n;i.track&&Ir(n=e.getTracks()).call(n,i.track)&&this.removeTrack(i)})})}function se(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function le(t){if(typeof t=="object"&&t.RTCPeerConnection){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){let e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(r){var i,n,c;this._localStreams||(this._localStreams=[]),Ir(i=this._localStreams).call(i,r)||this._localStreams.push(r),Re(n=r.getAudioTracks()).call(n,h=>e.call(this,h,r)),Re(c=r.getVideoTracks()).call(c,h=>e.call(this,h,r))},t.RTCPeerConnection.prototype.addTrack=function(r,i){var n;return i&&(this._localStreams?Ir(n=this._localStreams).call(n,i)||this._localStreams.push(i):this._localStreams=[i]),e.call(this,r,i)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(e){var r,i,n;this._localStreams||(this._localStreams=[]);let c=Wt(r=this._localStreams).call(r,e);if(c!==-1){un(i=this._localStreams).call(i,c,1);var h=e.getTracks();Re(n=this.getSenders()).call(n,C=>{Ir(h).call(h,C.track)&&this.removeTrack(C)})}})}}function ve(t){if(typeof t=="object"&&t.RTCPeerConnection&&("getRemoteStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in t.RTCPeerConnection.prototype))){_r(t.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(r){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=r),this.addEventListener("track",this._onaddstreampoly=i=>{var n;Re(n=i.streams).call(n,c=>{var h;this._remoteStreams||(this._remoteStreams=[]),Ir(h=this._remoteStreams).call(h,c)||(this._remoteStreams.push(c),h=new Event("addstream"),h.stream=c,this.dispatchEvent(h))})})}});let e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){let r=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(i){var n;Re(n=i.streams).call(n,c=>{var h;r._remoteStreams||(r._remoteStreams=[]),0<=Wt(h=r._remoteStreams).call(h,c)||(r._remoteStreams.push(c),h=new Event("addstream"),h.stream=c,r.dispatchEvent(h))})}),e.apply(r,arguments)}}}function q(t){if(typeof t=="object"&&t.RTCPeerConnection){t=t.RTCPeerConnection.prototype;var e=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,n=t.setRemoteDescription,c=t.addIceCandidate;t.createOffer=function(C,x){let Q=e.apply(this,[2<=arguments.length?arguments[2]:arguments[0]]);return x?(Q.then(C,x),it.resolve()):Q},t.createAnswer=function(C,x){let Q=r.apply(this,[2<=arguments.length?arguments[2]:arguments[0]]);return x?(Q.then(C,x),it.resolve()):Q};var h=function(C,x,Q){return C=i.apply(this,[C]),Q?(C.then(x,Q),it.resolve()):C};t.setLocalDescription=h,h=function(C,x,Q){return C=n.apply(this,[C]),Q?(C.then(x,Q),it.resolve()):C},t.setRemoteDescription=h,h=function(C,x,Q){return C=c.apply(this,[C]),Q?(C.then(x,Q),it.resolve()):C},t.addIceCandidate=h}}function ee(t){let e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){var r;t=e.mediaDevices;let n=Si(r=t.getUserMedia).call(r,t);e.mediaDevices.getUserMedia=c=>n(ae(c))}var i;!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=Si(i=function(n,c,h){e.mediaDevices.getUserMedia(n).then(c,h)}).call(i,e))}function ae(t){return t&&t.video!==void 0?Sn({},t,{video:g(t.video)}):t}function _e(t){let e=t.RTCPeerConnection;t.RTCPeerConnection=function(r,i){if(r&&r.iceServers){let n=[];for(let c=0;c<r.iceServers.length;c++){let h=r.iceServers[c];!h.hasOwnProperty("urls")&&h.hasOwnProperty("url")?(b("RTCIceServer.url","RTCIceServer.urls"),h=JSON.parse(ht(h)),h.urls=h.url,delete h.url,n.push(h)):n.push(r.iceServers[c])}r.iceServers=n}return new e(r,i)},t.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in t.RTCPeerConnection&&_r(t.RTCPeerConnection,"generateCertificate",{get:()=>e.generateCertificate})}function fe(t){typeof t=="object"&&t.RTCPeerConnection&&"receiver"in t.RTCTrackEvent.prototype&&!t.RTCTransceiver&&_r(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Ge(t){let e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(r){if(r){var i,n;r.offerToReceiveAudio!==void 0&&(r.offerToReceiveAudio=!!r.offerToReceiveAudio);let c=tr(i=this.getTransceivers()).call(i,h=>h.receiver.track.kind==="audio");r.offerToReceiveAudio===!1&&c?c.direction==="sendrecv"?c.setDirection?c.setDirection("sendonly"):c.direction="sendonly":c.direction==="recvonly"&&(c.setDirection?c.setDirection("inactive"):c.direction="inactive"):r.offerToReceiveAudio!==!0||c||this.addTransceiver("audio"),r.offerToReceiveVideo!==void 0&&(r.offerToReceiveVideo=!!r.offerToReceiveVideo),i=tr(n=this.getTransceivers()).call(n,h=>h.receiver.track.kind==="video"),r.offerToReceiveVideo===!1&&i?i.direction==="sendrecv"?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":i.direction==="recvonly"&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):r.offerToReceiveVideo!==!0||i||this.addTransceiver("video")}return e.apply(this,arguments)}}function Te(t){if(t.RTCIceCandidate&&!(t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype)){var e=t.RTCIceCandidate;t.RTCIceCandidate=function(r){var i;if(typeof r=="object"&&r.candidate&&Wt(i=r.candidate).call(i,"a=")===0&&((r=JSON.parse(ht(r))).candidate=r.candidate.substr(2)),r.candidate&&r.candidate.length){i=new e(r),r=Kt.parseCandidate(r.candidate);let n=Sn(i,r);return n.toJSON=function(){return{candidate:n.candidate,sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,usernameFragment:n.usernameFragment}},n}return new e(r)},t.RTCIceCandidate.prototype=e.prototype,P(t,"icecandidate",r=>(r.candidate&&_r(r,"candidate",{value:new t.RTCIceCandidate(r.candidate),writable:"false"}),r))}}function Ue(t){if(t.RTCPeerConnection){var e=w(t);"sctp"in t.RTCPeerConnection.prototype||_r(t.RTCPeerConnection.prototype,"sctp",{get(){return this._sctp===void 0?null:this._sctp}});var r=function(C){return!C||!C.sdp?!1:(C=Kt.splitSections(C.sdp),C.shift(),ff(C).call(C,x=>{var Q;return(x=Kt.parseMLine(x))&&x.kind==="application"&&Wt(Q=x.protocol).call(Q,"SCTP")!==-1}))},i=function(C){return C=C.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/),C===null||2>C.length?-1:(C=Ii(C[1],10),C!=C?-1:C)},n=function(C){let x=65536;return e.browser==="firefox"&&(x=57>e.version?C===-1?16384:2147483637:60>e.version?e.version===57?65535:65536:2147483637),x},c=function(C,x){let Q=65536;return e.browser==="firefox"&&e.version===57&&(Q=65535),C=Kt.matchPrefix(C.sdp,"a=max-message-size:"),0<C.length?Q=Ii(C[0].substr(19),10):e.browser==="firefox"&&x!==-1&&(Q=2147483637),Q},h=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,e.browser==="chrome"&&76<=e.version){var{sdpSemantics:C}=this.getConfiguration();C==="plan-b"&&_r(this,"sctp",{get(){return this._sctp===void 0?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){var x=i(arguments[0]);C=n(x),x=c(arguments[0],x);let Q;Q=C===0&&x===0?Number.POSITIVE_INFINITY:C===0||x===0?Math.max(C,x):Math.min(C,x),C={},_r(C,"maxMessageSize",{get:()=>Q}),this._sctp=C}return h.apply(this,arguments)}}}function Ze(t){function e(i,n){let c=i.send;i.send=function(){var h=arguments[0];if(h=h.length||h.size||h.byteLength,i.readyState==="open"&&n.sctp&&h>n.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+n.sctp.maxMessageSize+" bytes)");return c.apply(i,arguments)}}if(t.RTCPeerConnection&&"createDataChannel"in t.RTCPeerConnection.prototype){var r=t.RTCPeerConnection.prototype.createDataChannel;t.RTCPeerConnection.prototype.createDataChannel=function(){let i=r.apply(this,arguments);return e(i,this),i},P(t,"datachannel",i=>(e(i.channel,i.target),i))}}function ut(t){var e;if(t.RTCPeerConnection&&!("connectionState"in t.RTCPeerConnection.prototype)){var r=t.RTCPeerConnection.prototype;_r(r,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),_r(r,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(i){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),i&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=i)},enumerable:!0,configurable:!0}),Re(e=["setLocalDescription","setRemoteDescription"]).call(e,i=>{let n=r[i];r[i]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=c=>{let h=c.target;if(h._lastConnectionState!==h.connectionState){h._lastConnectionState=h.connectionState;let C=new Event("connectionstatechange",c);h.dispatchEvent(C)}return c},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}})}}function Fe(t){if(t.RTCPeerConnection){var e=w(t);if(!(e.browser==="chrome"&&71<=e.version)){var r=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(i){var n,c;return i&&i.sdp&&Wt(n=i.sdp).call(n,`
48
- a=extmap-allow-mixed`)!==-1&&(i.sdp=Gt(c=i.sdp.split(`
49
- `)).call(c,h=>Na(h).call(h)!=="a=extmap-allow-mixed").join(`
50
- `)),r.apply(this,arguments)}}}}function Ye(t){t&&id.setUA(t),xn=id.getResult(),t=Ht(xn);var e,r=(e=xn.engine.name==="Blink"?xn.engine.version||"":xn.browser.version||"",e.split(".")[0]);e:switch(xn.os.name){case"Windows":e=xn.os.version?xn.os.name+" "+xn.os.version:xn.os.name;break e;default:e=xn.os.name||""}return{name:t,version:r,os:e,osVersion:xn.os.version}}function Ht(t){if(t.engine.name==="Blink")return rr.CHROME;switch(t.browser.name){case"Chrome Headless":case"Chrome":case"Chromium":return rr.CHROME;case"Safari":case"Mobile Safari":return rr.SAFARI;case"Edge":return rr.EDGE;case"Firefox":return rr.FIREFOX;case"QQBrowser":return rr.QQ;case"Opera":return rr.OPERA;case"WeChat":return rr.WECHAT;default:return t.browser.name||""}}function Bt(){let t=Ye();return!!(xn.engine.name==="WebKit"&&t.os===en.MAC_OS&&navigator.maxTouchPoints&&0<navigator.maxTouchPoints&&t.name!==rr.SAFARI||br()&&t.name!==rr.SAFARI)}function Ft(){var t=Ye();return!!(Bt()&&(t.os===en.MAC_OS||t.os===en.IOS&&((t=xn.os.version&&xn.os.version.split("."))&&Number(t[0])===14&&t[1]&&3<=Number(t[1])||t&&14<Number(t[0]))))}function Mt(){return Ye().name===rr.CHROME}function cr(){return Ye().name===rr.SAFARI}function sr(){return Ye().name===rr.FIREFOX}function br(){return Ye().os===en.IOS}function hi(){var t=Ye();return t.os!==en.IOS||!t.osVersion?!1:(t=t.osVersion.split("."),Number(t[0])===15)}function Mr(){var t=Ye();return t.os!==en.IOS||!t.osVersion?!1:(t=t.osVersion.split("."),Number(t[0])===15&&Number(t[1])===0)}function Hr(){var t=Ye();return t.os!==en.IOS||!t.osVersion?!1:(t=t.osVersion.split("."),Number(t[0])===15&&1<=Number(t[1]))}function pi(){return cr()&&0<navigator.maxTouchPoints}function si(){return window.navigator.appVersion&&window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)!==null&&35>=window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)[1]}function bi(){let t=Ye();return t.name===rr.EDGE||t.name===rr.SAFARI?!1:!!navigator.userAgent.toLocaleLowerCase().match(/chrome\/[\d]./i)}function oi(t){return typeof t=="string"?Sn({},Vp[t]):t}function Ci(t){return typeof t=="string"?Sn({},Yp[t]):t}function sn(t){return typeof t=="string"?Sn({},Jp[t]):t}function Zr(t){return typeof t=="string"?Sn({},zp[t]):t}function Rr(t,e){var r;Ir(r=Er(Xe)).call(r,t)&&(Xe[t]=e)}function Vr(t,e,r){return{sampleRate:t,stereo:e,bitrate:r}}function Lt(t,e,r,i,n){return{width:t,height:e,frameRate:r,bitrateMin:i,bitrateMax:n}}function $r(t,e,r,i,n){return{width:{max:t},height:{max:e},frameRate:r,bitrateMin:i,bitrateMax:n}}function wn(t,e){return{numSpatialLayers:t,numTemporalLayers:e}}function on(t){return sc.call(t)==="[object Array]"}function wi(t){return t!==null&&typeof t=="object"}function pn(t){return sc.call(t)==="[object Function]"}function vn(t,e){if(t!=null)if(typeof t!="object"&&(t=[t]),on(t))for(var r=0,i=t.length;r<i;r++)e.call(null,t[r],r,t);else for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.call(null,t[r],r,t)}function Oi(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Ln(){this.handlers=[]}function Ds(t,e){!Yt.isUndefined(t)&&Yt.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Dn(t){this.defaults=t,this.interceptors={request:new Lf,response:new Lf}}function bs(t){this.message=t}function hs(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;t(function(i){r.reason||(r.reason=new Of(i),e(r.reason))})}function Vs(t){t=new jl(t);var e=Rf(jl.prototype.request,t);return Yt.extend(e,jl.prototype,t),Yt.extend(e,t),e}function Os(){let t=new Date;return t.toTimeString().split(" ")[0]+":"+t.getMilliseconds()}function Fn(t,e){if(typeof t!="boolean")throw new ue(oe.INVALID_PARAMS,"Invalid ".concat(e,": The value is of the boolean type."))}function Yr(t,e,r){var i;if(!Ir(r).call(r,t))throw new ue(oe.INVALID_PARAMS,ne(i="".concat(e," can only be set as ")).call(i,ht(r)))}function $t(t,e,r=1,i=1e4,n=!0){if(t<r||t>i||n&&(typeof t!="number"||t%1!=0)){var c,h;throw new ue(oe.INVALID_PARAMS,ne(c=ne(h="invalid ".concat(e,": the value range is [")).call(h,r,", ")).call(c,i,"]. integer only"))}}function Jr(t,e,r=1,i=255,n=!0){if(t==null)throw new ue(oe.INVALID_PARAMS,"".concat(e||"param"," cannot be empty"));var c,h,C;if(!Ro(t,r,i,n))throw new ue(oe.INVALID_PARAMS,ne(c=ne(h=ne(C="Invalid ".concat(e||"string param",": Length of the string: [")).call(C,r,",")).call(h,i,"].")).call(c,n?" ASCII characters only.":""))}function oo(t,e){if(!eo(t))throw new ue(oe.INVALID_PARAMS,"".concat(e," should be an array"))}function ao(t){if(typeof t!="string"||!/^[a-zA-Z0-9 !#\$%&\(\)\+\-:;<=\.>\?@\[\]\^_\{\}\|~,]{1,64}$/.test(t))throw z.error("Invalid Channel Name ".concat(t)),new ue(oe.INVALID_PARAMS,"The length must be within 64 bytes. The supported characters: a-z,A-Z,0-9,space,!, #, $, %, &, (, ), +, -, :, ;, <, =, ., >, ?, @, [, ], ^, _, {, }, |, ~, ,")}function co(t){var e;if(!(typeof t=="number"&&Math.floor(t)===t&&0<=t&&4294967295>=t||Ro(t,1,255)))throw z.error(ne(e="Invalid UID ".concat(t," ")).call(e,typeof t)),new ue(oe.INVALID_PARAMS,"[String uid] Length of the string: [1,255]. ASCII characters only. [Number uid] The value range is [0,10000]");typeof t=="string"&&z.warning("You input a string as the user ID, to ensure better end-user experience, Agora highly suggests not using a string as the user ID.")}function Ro(t,e=1,r=255,i=!0){if(e=typeof t=="string"&&t.length<=r&&t.length>=e){if(!(i=!i))e:if(typeof t!="string")i=!1;else{for(i=0;i<t.length;i+=1)if(e=t.charCodeAt(i),0>e||255<e){i=!1;break e}i=!0}e=i}return e}function _a(t){return Jr(t.reportId,"params.reportId",0,100,!1),Jr(t.category,"params.category",0,100,!1),Jr(t.event,"params.event",0,100,!1),Jr(t.label,"params.label",0,100,!1),$t(t.value,"params.value",-9007199254740991,9007199254740991,!1),!0}function wo(t){return $t(t.timeout,"config.timeout",0,1e5),$t(t.timeoutFactor,"config.timeoutFactor",0,100,!1),$t(t.maxRetryCount,"config.maxRetryConfig",0,1/0),$t(t.maxRetryTimeout,"config.maxRetryTimeout",0,1/0),!0}function Lo(t){if(!eo(t)||1>t.length)return!1;try{Re(t).call(t,e=>{if(!e.urls)throw Error()})}catch(e){return!1}return!0}function Xo(t){return Jr(t.turnServerURL,"turnServerURL"),Jr(t.username,"username"),Jr(t.password,"password"),t.udpport&&$t(t.udpport,"udpport",1,99999,!0),t.forceturn&&Fn(t.forceturn,"forceturn"),t.security&&Fn(t.security,"security"),t.tcpport&&$t(t.tcpport,"tcpport",1,99999,!0),!0}function Do(t){return t.level!==void 0&&Yr(t.level,"level",[1,2,3]),!0}function Bs(t,e){Jr(t.url,"".concat(e,".url"),1,1e3,!1),t.x==null||$t(t.x,"".concat(e,".x"),0,1e4),t.y==null||$t(t.y,"".concat(e,".y"),0,1e4),t.width==null||$t(t.width,"".concat(e,".width"),0,1e4),t.height==null||$t(t.height,"".concat(e,".height"),0,1e4),t.zOrder==null||$t(t.zOrder,"".concat(e,".zOrder"),0,255),t.alpha==null||$t(t.alpha,"".concat(e,".alpha"),0,1,!1)}function lo(t){if(!t.channelName)throw new ue(oe.INVALID_PARAMS,"invalid channelName in info");if(!t.uid||typeof t.uid!="number")throw new ue(oe.INVALID_PARAMS,"invalid uid in info, uid must be a number");return t.token&&Jr(t.token,"info.token",1,2047),co(t.uid),ao(t.channelName),!0}function bo(t){return Yr(t,"mediaSource",["screen","window","application"]),!0}function es(t,e){var r=Er(t);if(Qr){var i=Qr(t);e&&(i=Gt(i).call(i,function(n){return gr(t,n).enumerable})),r.push.apply(r,i)}return r}function _i(t,e,r){return new it((i,n)=>{e.timeout=e.timeout||Xe.HTTP_CONNECT_TIMEOUT,e.responseType=e.responseType||"json",e.data&&!r?(e.data=ht(e.data),Jl+=zs(e.data)):r&&(e.data.size?Jl+=e.data.size:e.data instanceof FormData?Jl+=function(c){let h=0;return/DingTalk/i.test(navigator.userAgent)&&c.realFormData&&(c=c.realFormData),Re(c).call(c,C=>{h+=typeof C=="string"?zs(C):C.size}),h+138}(e.data):Jl+=zs(ht(e.data))),e.headers=e.headers||{},e.headers["Content-Type"]=e.headers["Content-Type"]||"application/json",e.method="POST",e.url=t,yo.request(e).then(c=>{typeof c.data=="string"?_d+=zs(c.data):c.data instanceof ArrayBuffer||c.data instanceof Uint8Array?_d+=c.data.byteLength:_d+=zs(ht(c.data)),i(c.data)}).catch(c=>{yo.isCancel(c)?n(new ue(oe.OPERATION_ABORTED,"cancel token canceled")):c.code==="ECONNABORTED"?n(new ue(oe.NETWORK_TIMEOUT,c.message)):c.response?n(new ue(oe.NETWORK_RESPONSE_ERROR,c.response.status)):n(new ue(oe.NETWORK_ERROR,c.message))})})}function Zo(t,e){return Ee(this,null,function*(){let r=new Blob([e.data],{type:"buffer"});return yield _i(t,function(i){for(var n=1;n<arguments.length;n++){var c,h=arguments[n]!=null?arguments[n]:{};if(n%2)Re(c=es(Object(h),!0)).call(c,function(x){Un(i,x,h[x])});else if(Fr)Mn(i,Fr(h));else{var C;Re(C=es(Object(h))).call(C,function(x){_r(i,x,gr(h,x))})}}return i}({},e,{data:r,headers:{"Content-Type":"application/octet-stream"}}),!0)})}function mn(t,e,r,i){let n=Sn({},Vi,i),c=n.timeout,h=()=>Ee(this,null,function*(){yield Pe(c),c*=n.timeoutFactor,c=Math.min(n.maxRetryTimeout,c)}),C=!1;return i=new it((x,Q)=>Ee(this,null,function*(){e=e||(()=>!1),r=r||(()=>!0);for(let F=0;F<n.maxRetryCount;F+=1){if(C)return Q(new ue(oe.OPERATION_ABORTED));try{const V=yield t();if(!e(V,F)||F+1===n.maxRetryCount)return x(V);yield h()}catch(V){if(!r(V,F)||F+1===n.maxRetryCount)return Q(V);yield h()}}})),i.cancel=()=>C=!0,i}function uo(t,e){var r=Er(t);if(Qr){var i=Qr(t);e&&(i=Gt(i).call(i,function(n){return gr(t,n).enumerable})),r.push.apply(r,i)}return r}function ei(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=uo(Object(i),!0)).call(r,function(c){Un(t,c,i[c])});else if(Fr)Mn(t,Fr(i));else{var n;Re(n=uo(Object(i))).call(n,function(c){_r(t,c,gr(i,c))})}}return t}function bn(t={report:Qe}){return function(e,r,i){let n=e[r];if(typeof n=="function"){let c=e.constructor.name==="AgoraRTCClient"?"Client":e.constructor.name;i.value=function(...h){var C;let x=t.report.reportApiInvoke(this._sessionId||null,{name:ne(C="".concat(c,".")).call(C,r),options:h,tag:Dt.TRACER});try{let Q=n.apply(this,h);return x.onSuccess(),Q}catch(Q){throw x.onError(Q),Q}}}return i}}function On(t={report:Qe}){return function(e,r,i){let n=e[r];if(typeof n=="function"){let c=e.constructor.name==="AgoraRTCClient"?"Client":e.constructor.name;i.value=function(...h){return Ee(this,null,function*(){var C;let x=t.report.reportApiInvoke(this._sessionId||null,{name:ne(C="".concat(c,".")).call(C,r),options:h,tag:Dt.TRACER});try{let Q=yield n.apply(this,h);return x.onSuccess(),Q}catch(Q){throw x.onError(Q),Q}})}}return i}}function $o(){eA?(z.info("create audio context"),no=new eA,fr.curState=no.state,no.onstatechange=()=>{var t;fr.prevState=fr.curState,fr.curState=no?no.state:void 0,z.debug("AudioContext State Change",ne(t="".concat(fr.prevState,"=>")).call(t,fr.curState)),(br()||pi())&&fr.prevState==="running"&&fr.curState==="interrupted"&&(z.info("ios-interruption-start"),fr.emit(Yi.IOS_INTERRUPTION_START)),(br()||pi())&&fr.prevState==="interrupted"&&fr.curState==="running"&&(z.info("ios-interruption-end"),fr.emit(Yi.IOS_INTERRUPTION_END)),fr.emit("state-change")},function(t){return Ee(this,null,function*(){function e(te){t.state==="running"?r(!1):br()||pi()?t.state==="suspended"&&(r(!0),te?t.resume().then(i,i):r(!1)):t.state!=="closed"&&(r(!0),te?t.resume().then(i,i):r(!1))}function r(te){if(V!==te){V=te;for(let ce=0,Ae=Q;ce<Ae.length;ce+=1){let Me=Ae[ce];te?window.addEventListener(Me,n,{capture:!0,passive:!0}):window.removeEventListener(Me,n,{capture:!0,passive:!0})}}}function i(){e(!1)}function n(){e(!0)}function c(te){if(!$)if(F.paused)if(te){h(!1),$=!0,te=void 0;try{(te=F.play())?te.then(C,C):(F.addEventListener("playing",C),F.addEventListener("abort",C),F.addEventListener("error",C))}catch(ce){C()}}else h(!0);else h(!1)}function h(te){if(Y!==te){Y=te;for(let ce=0,Ae=Q;ce<Ae.length;ce++){let Me=Ae[ce];te?window.addEventListener(Me,x,{capture:!0,passive:!0}):window.removeEventListener(Me,x,{capture:!0,passive:!0})}}}function C(){F.removeEventListener("playing",C),F.removeEventListener("abort",C),F.removeEventListener("error",C),$=!1,c(!1)}function x(){c(!0)}let Q="click contextmenu auxclick dblclick mousedown mouseup touchend keydown keyup".split(" "),F,V=!1,Y=!1,$=!1;if(br()){let te=t.createMediaStreamDestination(),ce=document.createElement("div");ce.innerHTML="<audio x-webkit-airplay='deny'></audio>",F=ce.children.item(0),F.controls=!1,F.disableRemotePlayback=!0,F.preload="auto",F.srcObject=te.stream,c(!0)}fr.on("state-change",function(){e(!0)}),e(!1)})}(no)):z.error("your browser is not support web audio")}function fs(){if(!no&&($o(),!no))throw new ue(oe.NOT_SUPPORTED,"can not create audio context");return no}function ts(t){if(!function(){if(Cd!==null)return Cd;var i=fs();let n=i.createBufferSource(),c=i.createGain();i=i.createGain(),n.connect(c),n.connect(i),n.disconnect(c),i=!1;try{n.disconnect(c)}catch(h){i=!0}return n.disconnect(),Cd=i,i}()){z.debug("polyfill audio node");var e=t.connect,r=t.disconnect;t.connect=(i,n,c)=>{var h;return t._inputNodes||(t._inputNodes=[]),Ir(h=t._inputNodes).call(h,i)||(i instanceof AudioNode?(t._inputNodes.push(i),e.call(t,i,n,c)):e.call(t,i,n)),t},t.disconnect=(i,n,c)=>{r.call(t),i?vi(t._inputNodes,i):t._inputNodes=[];for(let h of t._inputNodes)e.call(t,h)}}}function Ys(t,e){let r=1/e,i=fs(),n=i.createGain();n.gain.value=0,n.connect(i.destination);let c=!1,h=()=>{if(c)return void(n=null);const C=i.createOscillator();C.onended=h,C.connect(n),C.start(0),C.stop(i.currentTime+r),t(i.currentTime)};return h(),()=>{c=!0}}function ho(t,e){return Ee(this,null,function*(){let r=(i,n)=>i?typeof i!="number"?i.max||i.exact||i.ideal||i.min||n:i:n;return t={audio:!1,video:{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxHeight:r(e.height,1080),maxWidth:r(e.width,1920)}}},e.frameRate&&typeof e.frameRate!="number"?(t.video.mandatory.maxFrameRate=e.frameRate.max,t.video.mandatory.minFrameRate=e.frameRate.min):typeof e.frameRate=="number"&&(t.video.mandatory.maxFrameRate=e.frameRate),yield navigator.mediaDevices.getUserMedia(t)})}function ea(t){return Ee(this,null,function*(){let e=yield function(r){return new it((i,n)=>{const c=document.createElement("div");c.innerText="share screen",c.setAttribute("style","text-align: center; height: 25px; line-height: 25px; border-radius: 4px 4px 0 0; background: #D4D2D4; border-bottom: solid 1px #B9B8B9;");const h=document.createElement("div");h.setAttribute("style","width: 100%; height: 500px; padding: 15px 25px ; box-sizing: border-box;");const C=document.createElement("div");C.innerText="Agora Web Screensharing wants to share the contents of your screen with webdemo.agorabeckon.com. Choose what you'd like to share.",C.setAttribute("style","height: 12%;");const x=document.createElement("div");x.setAttribute("style","width: 100%; height: 80%; background: #FFF; border: solid 1px #CBCBCB; display: flex; flex-wrap: wrap; justify-content: space-around; overflow-y: scroll; padding: 0 15px; box-sizing: border-box;");const Q=document.createElement("div");Q.setAttribute("style","text-align: right; padding: 16px 0;");const F=document.createElement("button");F.innerHTML="cancel",F.setAttribute("style","width: 85px;"),F.onclick=()=>{document.body.removeChild(V);const Y=Error("NotAllowedError");Y.name="NotAllowedError",n(Y)},Q.appendChild(F),h.appendChild(C),h.appendChild(x),h.appendChild(Q);const V=document.createElement("div");V.setAttribute("style","position: fixed; z-index: 99999999; top: 50%; left: 50%; width: 620px; height: 525px; background: #ECECEC; border-radius: 4px; -webkit-transform: translate(-50%,-50%); transform: translate(-50%,-50%);"),V.appendChild(c),V.appendChild(h),document.body.appendChild(V),yt(r).call(r,Y=>{if(Y.id){const $=document.createElement("div");$.setAttribute("style","width: 30%; height: 160px; padding: 20px 0; text-align: center;box-sizing: content-box;");let te=Y.thumbnail;const{width:ce}=te.getSize();1920<ce&&(te=te.resize({width:1920})),$.innerHTML='<div style="height: 120px; display: table-cell; vertical-align: middle;"><img style="width: 100%; background: #333333; box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.2);" src='+te.toDataURL()+' /></div><span style=" height: 40px; line-height: 40px; display: inline-block; width: 70%; word-break: keep-all; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">'+(Y.name.replace(/[\u00A0-\u9999<>&]/g,function(Ae){return"&#"+Ae.charCodeAt(0)+";"})+"</span>"),$.onclick=()=>{document.body.removeChild(V),i(Y.id)},x.appendChild($)}})})}(yield As(t.mediaSource));return yield ho(e,t)})}function As(t){return Ee(this,null,function*(){let e=["window","screen"];t!=="application"&&t!=="window"||(e=["window"]),t==="screen"&&(e=["screen"]);let r=Ns();if(!r)throw new ue(oe.ELECTRON_IS_NULL);t=null;try{t=r.desktopCapturer.getSources({types:e})}catch(i){t=null}t&&t.then||(t=new it((i,n)=>{r.desktopCapturer.getSources({types:e},(c,h)=>{c?n(c):i(h)})}));try{return yield t}catch(i){throw new ue(oe.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR,i.toString())}})}function Ns(){if(ql)return ql;try{return ql=window.require("electron"),ql}catch(t){return null}}function Fi(t,e){return Ee(this,null,function*(){let r=0,i=null;for(;2>r;)try{i=yield Ca(t,e,0<r);break}catch(h){var n,c;if(h instanceof ue)throw z.error(ne(c="[".concat(e,"] ")).call(c,h.toString())),h;let C=fo(h.name||h.code||h,h.message);if(C.code===oe.MEDIA_OPTION_INVALID)z.debug("[".concat(e,"] detect media option invalid, retry")),r+=1,yield Pe(500);else throw z.error(ne(n="[".concat(e,"] ")).call(n,C.toString())),C}if(!i)throw new ue(oe.UNEXPECTED_ERROR,"can not find stream after getUserMedia");return i})}function Ca(t,e,r){return Ee(this,null,function*(){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new ue(oe.NOT_SUPPORTED,"can not find getUserMedia");r&&(t.video&&(delete t.video.width,delete t.video.height),t.screen&&(delete t.screen.width,delete t.screen.height));var i=Ur;if(r=new MediaStream,t.audioSource&&r.addTrack(t.audioSource),t.videoSource&&r.addTrack(t.videoSource),!t.audio&&!t.video&&!t.screen)return z.debug("Using Video Source/ Audio Source"),r;if(t.screen)if(Ns())t.screen.sourceId?Bi(r,yield ho(t.screen.sourceId,t.screen)):Bi(r,yield ea(t.screen));else if(Mt()&&t.screen.extensionId&&t.screen.mandatory){if(!i.getStreamFromExtension)throw new ue(oe.NOT_SUPPORTED,"This browser does not support screen sharing");z.debug("[".concat(e,'] Screen access on chrome stable, looking for extension"'));var n=yield(c=t.screen.extensionId,h=e,new it((x,Q)=>{try{chrome.runtime.sendMessage(c,{getStream:!0},V=>{if(!V||!V.streamId)return z.error("[".concat(h,"] No response from Chrome Plugin. Plugin not installed properly"),V),void Q(new ue(oe.CHROME_PLUGIN_NO_RESPONSE,"No response from Chrome Plugin. Plugin not installed properly"));x(V.streamId)})}catch(V){var F;z.error(ne(F="[".concat(h,"] AgoraRTC screensharing plugin is not accessible(")).call(F,c,")"),V.toString()),Q(new ue(oe.CHROME_PLUGIN_NOT_INSTALL))}}));t.screen.mandatory.chromeMediaSourceId=n,Bi(r,yield navigator.mediaDevices.getUserMedia({video:{mandatory:t.screen.mandatory}}))}else if(i.getDisplayMedia)t.screen.mediaSource&&bo(t.screen.mediaSource),n={width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate,displaySurface:t.screen.mediaSource==="screen"?"monitor":t.screen.mediaSource},z.debug("[".concat(e,"] getDisplayMedia:"),ht({video:n,audio:!!t.screenAudio})),Bi(r,yield navigator.mediaDevices.getDisplayMedia({video:n,audio:!!t.screenAudio}));else{if(!sr())throw z.error("[".concat(e,"] This browser does not support screenSharing")),new ue(oe.NOT_SUPPORTED,"This browser does not support screen sharing");t.screen.mediaSource&&bo(t.screen.mediaSource),i={video:{mediaSource:t.screen.mediaSource,width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate}},z.debug(ne(n="[".concat(e,"] getUserMedia: ")).call(n,ht(i))),Bi(r,yield navigator.mediaDevices.getUserMedia(i))}var c,h;if(!t.video&&!t.audio)return r;t={video:t.video,audio:t.audio},z.debug("[".concat(e,"] GetUserMedia"),ht(t)),Ye();let C;e=null,(cr()||br()||Bt())&&(e=yield yd.lock());try{C=yield navigator.mediaDevices.getUserMedia(t)}catch(x){throw e&&e(),x}return t.audio&&(iA=!0),t.video&&(nA=!0),Bi(r,C),e&&e(),r})}function fo(t,e){switch(t){case"Starting video failed":case"OverconstrainedError":case"TrackStartError":var r;return new ue(oe.MEDIA_OPTION_INVALID,ne(r="".concat(t,": ")).call(r,e));case"NotFoundError":case"DevicesNotFoundError":var i;return new ue(oe.DEVICE_NOT_FOUND,ne(i="".concat(t,": ")).call(i,e));case"NotSupportedError":var n;return new ue(oe.NOT_SUPPORTED,ne(n="".concat(t,": ")).call(n,e));case"NotReadableError":var c;return new ue(oe.NOT_READABLE,ne(c="".concat(t,": ")).call(c,e));case"InvalidStateError":case"NotAllowedError":case"PERMISSION_DENIED":case"PermissionDeniedError":var h;return new ue(oe.PERMISSION_DENIED,ne(h="".concat(t,": ")).call(h,e));case"ConstraintNotSatisfiedError":var C;return new ue(oe.CONSTRAINT_NOT_SATISFIED,ne(C="".concat(t,": ")).call(C,e));default:var x;return z.error("getUserMedia unexpected error",t),new ue(oe.UNEXPECTED_ERROR,ne(x="".concat(t,": ")).call(x,e))}}function Bi(t,e){let r=t.getVideoTracks()[0],i=t.getAudioTracks()[0],n=e.getVideoTracks()[0];(e=e.getAudioTracks()[0])&&(i&&t.removeTrack(i),t.addTrack(e)),n&&(r&&t.removeTrack(r),t.addTrack(n))}function gs(){if(!Id){let t=e=>{e.preventDefault(),Id=!1,document.body.removeEventListener("touchstart",t,!0),document.body.removeEventListener("mousedown",t,!0)};Id=!0,document.body.addEventListener("touchstart",t,!0),document.body.addEventListener("mousedown",t,!0),aA.emit("autoplay-failed")}}function Or(){return function(t,e,r){let i=t[e];typeof i=="function"&&(r.value=function(...n){this._isClosed&&new ue(oe.INVALID_OPERATION,"[".concat(this.getTrackId(),"] cannot operate a closed track")).print("warning");let c=i.apply(this,n);return c instanceof it?new it((h,C)=>{c.then(h).catch(C)}):c})}}function Oo(t,e){var r=Er(t);if(Qr){var i=Qr(t);e&&(i=Gt(i).call(i,function(n){return gr(t,n).enumerable})),r.push.apply(r,i)}return r}function Js(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=Oo(Object(i),!0)).call(r,function(c){Un(t,c,i[c])});else if(Fr)Mn(t,Fr(i));else{var n;Re(n=Oo(Object(i))).call(n,function(c){_r(t,c,gr(i,c))})}}return t}function ta(t,e){var r=Er(t);if(Qr){var i=Qr(t);e&&(i=Gt(i).call(i,function(n){return gr(t,n).enumerable})),r.push.apply(r,i)}return r}function En(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=ta(Object(i),!0)).call(r,function(c){Un(t,c,i[c])});else if(Fr)Mn(t,Fr(i));else{var n;Re(n=ta(Object(i))).call(n,function(c){_r(t,c,gr(i,c))})}}return t}function ra(t,e){var r=Er(t);if(Qr){var i=Qr(t);e&&(i=Gt(i).call(i,function(n){return gr(t,n).enumerable})),r.push.apply(r,i)}return r}function Bo(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=ra(Object(i),!0)).call(r,function(c){Un(t,c,i[c])});else if(Fr)Mn(t,Fr(i));else{var n;Re(n=ra(Object(i))).call(n,function(c){_r(t,c,gr(i,c))})}}return t}function ya(t){if(!t.address||!t.tcp)throw new ue(oe.UNEXPECTED_RESPONSE,"Invalid address format ".concat(t));return t.address.match(/^[\.:\d]+$/)?"".concat(t.address.replace(/[^\d]/g,"-"),".edge.agora.io"):(z.info("Cannot recognized as IP address ".concat(t.address,". Used As Host instead")),ne(e="".concat(t.address,":")).call(e,t.tcp));var e}function Ao(t,e){var r;let i=Xe.GATEWAY_DOMAINS,n=i[1]&&Wt(e).call(e,i[1])!==-1?1:0;return t.addresses=t.addresses||[],{gatewayAddrs:yt(r=t.addresses).call(r,c=>{var h,C,x;return c.ip.match(/^[\.:\d]+$/)?ne(h=ne(C="".concat(c.ip.replace(/[^\d]/g,"-"),".")).call(C,i[n++%i.length],":")).call(h,c.port):(z.info("Cannot recognized as IP address ".concat(c.ip,". Used As Host instead")),ne(x="".concat(c.ip,":")).call(x,c.port))}),uid:t.uid,cid:t.cid,vid:t.detail&&t.detail[8],uni_lbs_ip:t.detail&&t.detail[1],res:t,csIp:t.detail&&t.detail[502]}}function Qn(t){return typeof t=="number"?t:t.exact||t.ideal||t.max||t.min||0}function ia(t,e){let r=t.videoSend[0];return r?(e=e&&e.videoSend[0]?e.videoSend[0].inputFrame:void 0,t={id:mr(10,""),timestamp:new Date(t.timestamp).toISOString(),mediaType:"video",type:"ssrc",ssrc:r.ssrc.toString()},r.inputFrame&&(e&&r.inputFrame.height===e.height||(t.A_fhi=r.inputFrame.height?r.inputFrame.height.toString():"0"),e&&r.inputFrame.width===e.width||(t.A_fwi=r.inputFrame.width?r.inputFrame.width.toString():"0"),e&&r.inputFrame.frameRate===e.frameRate||(t.A_fri=r.inputFrame.frameRate?r.inputFrame.frameRate.toString():"0")),t):null}function na(t){return 0<=t&&.17>t?1:.17<=t&&.36>t?2:.36<=t&&.59>t?3:.59<=t&&1>=t?4:1<t?5:0}function Ha(t,e){let r={};return t.height&&t.width&&(e=e._videoHeight||e.getMediaStreamTrack(!0).getSettings().height,r.scaleResolutionDownBy=e?e/Qn(t.height):4),r.maxFramerate=t.framerate?Qn(t.framerate):void 0,r.maxBitrate=t.bitrate?1e3*t.bitrate:void 0,r}function go(t,e){var r;let i,n;switch(e){case kn.CHOOSE_SERVER:i=4096,e="choose server";break;case kn.CLOUD_PROXY:i=1048576,e="proxy";break;case kn.CLOUD_PROXY_5:i=4194304,e="proxy5";break;default:throw new ue(oe.UNEXPECTED_ERROR,"multi unlibs response transformer get unknown service id",{csIp:t.detail&&t.detail[502],retry:!1})}if(Re(r=t.response_body).call(r,c=>{var h;c.buffer&&c.buffer.flag===i&&(n={code:c.buffer.code,addresses:yt(h=c.buffer.edges_services).call(h,C=>Bo({},C,{ticket:c.buffer.cert})),server_ts:t.enter_ts,uid:c.buffer.uid,cid:c.buffer.cid,cname:c.buffer.cname,detail:Bo({},c.buffer.detail,{},t.detail),flag:c.buffer.flag,opid:t.opid})}),!n)throw new ue(oe.MULTI_UNILBS_RESPONSE_ERROR,"cannot parse response ".concat(e," from multi unilbs response"),{csIp:t.detail&&t.detail[502]});return n}function Ka(t){var e;return yt(e=t.addresses).call(e,r=>({address:r.ip,tcpport:r.port,udpport:r.port,username:tn.username,password:tn.password}))}function Ia(t,e){var r=Er(t);if(Qr){var i=Qr(t);e&&(i=Gt(i).call(i,function(n){return gr(t,n).enumerable})),r.push.apply(r,i)}return r}function Sa(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=Ia(Object(i),!0)).call(r,function(c){Un(t,c,i[c])});else if(Fr)Mn(t,Fr(i));else{var n;Re(n=Ia(Object(i))).call(n,function(c){_r(t,c,gr(i,c))})}}return t}function zs(t){return window.TextEncoder?new TextEncoder().encode(t).length:t.length}function Pe(t){return new it(e=>{window.setTimeout(e,t)})}function xe(t){let e=new ue(oe.TIMEOUT,"timeout");return new it((r,i)=>{window.setTimeout(()=>i(e),t)})}function mr(t=7,e){var r,i;let n=Math.random().toString(16).substr(2,t).toLowerCase();return n.length===t?ne(r="".concat(e)).call(r,n):ne(i="".concat(e)).call(i,n)+mr(t-n.length,"")}function Ps(t){return new it((e,r)=>{let i=!1,n=document.createElement("video");n.setAttribute("autoplay",""),n.setAttribute("muted",""),n.muted=!0,n.autoplay=!0,n.setAttribute("playsinline",""),n.setAttribute("style","position: fixed; top: 0; left: 0; width: 1px; height: 1px"),document.body.appendChild(n),r=br()?"canplay":"playing",n.addEventListener(r,()=>{let c=n.videoWidth,h=n.videoHeight;!c&&sr()||(i=!0,n.srcObject=null,n.remove(),e([c,h]))}),n.srcObject=new MediaStream([t]),n.play().catch(Xl),Is(()=>{i||(n.srcObject=null,n.remove(),e([n.videoWidth,n.videoHeight]))},4e3)})}function Gn(t){return it.all(yt(t).call(t,e=>e.then(r=>{throw r},r=>r))).then(e=>{throw e},e=>e)}function lr(t,e,...r){return t.getListeners(e).length===0?it.reject(new ue(oe.UNEXPECTED_ERROR,"can not emit promise")):new it((i,n)=>{t.emit(e,...r,i,n)})}function Kr(t,e,...r){return t.getListeners(e).length===0?it.resolve():lr(t,e,...r)}function Qi(t,e,...r){return t.getListeners(e).length===0?null:Bn(t,e,...r)}function Bn(t,e,...r){let i=null,n=null;if(t.emit(e,...r,c=>{i=c},c=>{n=c}),n!==null)throw n;if(i===null)throw new ue(oe.UNEXPECTED_ERROR,"handler is not sync");return i}function vi(t,e){e=Wt(t).call(t,e),e!==-1&&un(t).call(t,e,1)}function an(t){let e=[];return Re(t).call(t,r=>{Wt(e).call(e,r)===-1&&e.push(r)}),e}function Ni(t){it.resolve().then(t)}function ps(t,e){dA[e]||(dA[e]=!0,t())}function xs(t){t=window.atob(t);let e=new Uint8Array(new ArrayBuffer(t.length));for(let r=0;r<t.length;r+=1)e[r]=t.charCodeAt(r);return e}function vs(t){let e="";for(let r=0;r<t.length;r+=1)e+=String.fromCharCode(t[r]);return window.btoa(e)}function Pi(t){var e=Dv[Math.floor(t/1e4)];if(!e)return{desc:"unkonw error",retry:!1};if(e=e[t%1e4],!e){if(Math.floor(t/1e4)===oc.ACCESS_POINT){if(e=t%1e4,e.toString()[0]==="1")return{desc:t.toString(),retry:!1};if(e.toString()[0]==="2")return{desc:t.toString(),retry:!0}}return{desc:"unkonw error",retry:!1}}return e}function cn(t){return bv[t]||{desc:"UNKNOW_ERROR_".concat(t),action:"failed"}}function mi(){return Ee(this,null,function*(){function t(ct){let Ut=C["_"+ct];var St;return St="Cannot call unknown function "+ct+", make sure it is exported",Ut||r("Assertion failed: "+St),Ut}function e(ct,Ut,St,ki,Qa){Qa={string:function(dr){let di=0;if(dr!=null&&dr!==0){var qi=1+(dr.length<<2);di=at(qi);var Ui=et,Ri=di;if(0<qi){qi=Ri+qi-1;for(let so=0;so<dr.length;++so){let nn=dr.charCodeAt(so);if(55296<=nn&&57343>=nn&&(nn=65536+((1023&nn)<<10)|1023&dr.charCodeAt(++so)),127>=nn){if(Ri>=qi)break;Ui[Ri++]=nn}else{if(2047>=nn){if(Ri+1>=qi)break;Ui[Ri++]=192|nn>>6}else{if(65535>=nn){if(Ri+2>=qi)break;Ui[Ri++]=224|nn>>12}else{if(Ri+3>=qi)break;Ui[Ri++]=240|nn>>18,Ui[Ri++]=128|nn>>12&63}Ui[Ri++]=128|nn>>6&63}Ui[Ri++]=128|63&nn}}Ui[Ri]=0}}return di},array:function(dr){const di=at(dr.length);return Me.set(dr,di),di}};let Ga=t(ct),pc=[];if(ct=0,ki)for(let dr=0;dr<ki.length;dr++){let di=Qa[St[dr]];di?(ct===0&&(ct=Ne()),pc[dr]=di(ki[dr])):pc[dr]=ki[dr]}return St=Ga.apply(null,pc),St=function(dr){if(Ut==="string")if(Ui=dr){dr=et;var di=Ui+qi,qi=Ui;let Ri="";for(;dr[qi]&&!(qi>=di);)++qi;if(16<qi-Ui&&dr.subarray&&Ae)dr=Ae.decode(dr.subarray(Ui,qi));else{for(;Ui<qi;){if(di=dr[Ui++],!(128&di)){Ri+=String.fromCharCode(di);continue}let so=63&dr[Ui++];if((224&di)==192){Ri+=String.fromCharCode((31&di)<<6|so);continue}let nn=63&dr[Ui++];di=(240&di)==224?(15&di)<<12|so<<6|nn:(7&di)<<18|so<<12|nn<<6|63&dr[Ui++],65536>di?Ri+=String.fromCharCode(di):(di-=65536,Ri+=String.fromCharCode(55296|di>>10,56320|1023&di))}dr=Ri}}else dr="";else dr=Ut==="boolean"?!!dr:dr;return dr;var Ui}(St),ct!==0&&Je(ct),St}function r(ct){throw C.onAbort&&C.onAbort(ct),$(ct+=""),ce=!0,new WebAssembly.RuntimeError("abort("+ct+"). Build with -s ASSERTIONS=1 for more info.")}function i(ct){for(;0<ct.length;){let Ut=ct.shift();if(typeof Ut=="function"){Ut(C);continue}let St=Ut.func;typeof St=="number"?Ut.arg===void 0?vt.get(St)():vt.get(St)(Ut.arg):St(Ut.arg===void 0?null:Ut.arg)}}function n(ct){function Ut(){if(!Wr&&(Wr=!0,C.calledRun=!0,!ce)){if(i(Pt),i(Dr),C.onRuntimeInitialized&&C.onRuntimeInitialized(),C.postRun)for(typeof C.postRun=="function"&&(C.postRun=[C.postRun]);C.postRun.length;){var St=C.postRun.shift();Et.unshift(St)}i(Et)}}0<nr||(function(){if(C.preRun)for(typeof C.preRun=="function"&&(C.preRun=[C.preRun]);C.preRun.length;){var St=C.preRun.shift();kt.unshift(St)}i(kt)}(),0<nr||(C.setStatus?(C.setStatus("Running..."),Is(function(){Is(function(){C.setStatus("")},1),Ut()},1)):Ut()))}var c,h;if(Rd)return Rd;let C={},x,Q={};for(x in C)Object.prototype.hasOwnProperty.call(C,x)&&(Q[x]=C[x]);let F=!1,V=!1;F=typeof window=="object",V=typeof importScripts=="function";let Y="";(F||V)&&(V?Y=self.location.href:typeof document!="undefined"&&document.currentScript&&(Y=document.currentScript.src),Y=Wt(Y).call(Y,"blob:")!==0?Y.substr(0,Hv(Y).call(Y,"/")+1):""),C.print||Si(c=console.log).call(c,console);let $=C.printErr||Si(h=console.warn).call(h,console);for(x in Q)Object.prototype.hasOwnProperty.call(Q,x)&&(C[x]=Q[x]);let te;Q=null,typeof WebAssembly!="object"&&r("no native wasm support detected");let ce=!1,Ae=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):void 0;typeof TextDecoder!="undefined"&&new TextDecoder("utf-16le");let Me,et,vt,kt=[],Pt=[],Dr=[],Et=[];Pt.push({func:function(){Rn()}});let nr=0,Tr=null;C.preloadedImages={},C.preloadedAudios={},c="deflate.wasm";var ui;jc(ui=c).call(ui,"data:application/octet-stream;base64,")||(c=function(ct){return C.locateFile?C.locateFile(ct,Y):Y+ct}(c));let zi={emscripten_memcpy_big:function(ct,Ut,St){var ki=et.copyWithin;(et===AA||et instanceof Array&&ki===AA.copyWithin?Nv:ki).call(et,ct,Ut,Ut+St)},emscripten_resize_heap:function(ct){r("OOM")}};yield function(){return Ee(this,null,function*(){function ct(St,ki){C.asm=St.exports,te=C.asm.memory,St=te.buffer,C.HEAP8=Me=new Int8Array(St),C.HEAP16=new Int16Array(St),C.HEAP32=new Int32Array(St),C.HEAPU8=et=new Uint8Array(St),C.HEAPU16=new Uint16Array(St),C.HEAPU32=new Uint32Array(St),C.HEAPF32=new Float32Array(St),C.HEAPF64=new Float64Array(St),vt=C.asm.__indirect_function_table,nr--,C.monitorRunDependencies&&C.monitorRunDependencies(nr),nr==0&&Tr&&(St=Tr,Tr=null,St())}let Ut={env:zi,wasi_snapshot_preview1:zi};if(nr++,C.monitorRunDependencies&&C.monitorRunDependencies(nr),C.instantiateWasm)try{return C.instantiateWasm(Ut,ct)}catch(St){return $("Module.instantiateWasm callback failed with error: "+St),!1}return yield function(St){return new it((ki,Qa)=>{ki(Kv().buffer)}).then(function(ki){return WebAssembly.instantiate(ki,Ut)}).then(St,function(ki){$("failed to asynchronously prepare wasm: "+ki),r(ki)})}(function(St){ct(St.instance)}),{}})}();let Wr,Rn=C.___wasm_call_ctors=function(){return(Rn=C.___wasm_call_ctors=C.asm.__wasm_call_ctors).apply(null,arguments)},Ce=C._malloc=function(){return(Ce=C._malloc=C.asm.malloc).apply(null,arguments)};C._free=function(){return(C._free=C.asm.free).apply(null,arguments)},C.___errno_location=function(){return(C.___errno_location=C.asm.__errno_location).apply(null,arguments)},C._zlibCompress=function(){return(C._zlibCompress=C.asm.zlibCompress).apply(null,arguments)};let Ne=C.stackSave=function(){return(Ne=C.stackSave=C.asm.stackSave).apply(null,arguments)},Je=C.stackRestore=function(){return(Je=C.stackRestore=C.asm.stackRestore).apply(null,arguments)},at=C.stackAlloc=function(){return(at=C.stackAlloc=C.asm.stackAlloc).apply(null,arguments)};if(C.ccall=e,C.cwrap=function(ct,Ut,St,ki){let Qa=xv(St=St||[]).call(St,function(Ga){return Ga==="number"});return Ut!=="string"&&Qa&&!ki?t(ct):function(){return e(ct,Ut,St,arguments)}},C.allocate=function(ct,Ut){let St;return St=Ut==1?at(ct.length):Ce(ct.length),ct.subarray||$i(ct)?et.set(ct,St):et.set(new Uint8Array(ct),St),St},Tr=function ct(){Wr||n(),Wr||(Tr=ct)},C.run=n,C.preInit)for(typeof C.preInit=="function"&&(C.preInit=[C.preInit]);0<C.preInit.length;)C.preInit.pop()();return n(),Rd=C,C})}function _n(t,e){var r=Er(t);if(Qr){var i=Qr(t);e&&(i=Gt(i).call(i,function(n){return gr(t,n).enumerable})),r.push.apply(r,i)}return r}function Gi(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=_n(Object(i),!0)).call(r,function(c){Un(t,c,i[c])});else if(Fr)Mn(t,Fr(i));else{var n;Re(n=_n(Object(i))).call(n,function(c){_r(t,c,gr(i,c))})}}return t}function ms(t,e){var r=Er(t);if(Qr){var i=Qr(t);e&&(i=Gt(i).call(i,function(n){return gr(t,n).enumerable})),r.push.apply(r,i)}return r}function qs(t,e,r,i,n){Yd+=1;let c={sid:r.sid,command:"convergeAllocateEdge",uid:"666",appId:r.appId,ts:Math.floor(ot()/1e3),seq:Yd,requestId:Yd,version:as,cname:r.cname},h={service_name:e,json_body:ht(c)},C,x,Q=t[0];return mn(()=>Ee(this,null,function*(){C=ot();var F=yield _i(Q,{data:h,cancelToken:i,headers:{"X-Packet-Service-Type":"0","X-Packet-URI":"61"}});if(x=ot()-C,F.code!==0){var V=new ue(oe.UNEXPECTED_RESPONSE,"live streaming ap error, code"+F.code,{retry:!0,responseTime:x});throw z.error(V.toString()),V}if(F=JSON.parse(F.json_body),F.code!==200)throw F=new ue(oe.UNEXPECTED_RESPONSE,ne(V="live streaming app center error, code: ".concat(F.code,", reason: ")).call(V,F.reason),{code:F.code,responseTime:x}),z.error(F.toString()),F;if(!F.servers||F.servers.length===0)throw V=new ue(oe.UNEXPECTED_RESPONSE,"live streaming app center empty server",{code:F.code,responseTime:x}),z.error(V.toString()),V;return V=function(Y,$){var te;return{addressList:yt(te=Y.servers).call(te,ce=>{var Ae,Me;return ne(Ae=ne(Me="wss://".concat(ce.address.replace(/\./g,"-"),".edge.agora.io:")).call(Me,ce.wss,"?serviceName=")).call(Ae,encodeURIComponent($))}),workerToken:Y.workerToken,vid:Y.vid}}(F,e),Xe.LIVE_STREAMING_ADDRESS&&(V.addressList=Xe.LIVE_STREAMING_ADDRESS instanceof Array?Xe.LIVE_STREAMING_ADDRESS:[Xe.LIVE_STREAMING_ADDRESS]),function(Y){for(var $=1;$<arguments.length;$++){var te,ce=arguments[$]!=null?arguments[$]:{};if($%2)Re(te=ms(Object(ce),!0)).call(te,function(Me){Un(Y,Me,ce[Me])});else if(Fr)Mn(Y,Fr(ce));else{var Ae;Re(Ae=ms(Object(ce))).call(Ae,function(Me){_r(Y,Me,gr(ce,Me))})}}return Y}({},V,{responseTime:x})}),(F,V)=>(Qe.apworkerEvent(r.sid,{success:!0,sc:200,serviceName:e,responseDetail:ht(F.addressList),firstSuccess:V===0,responseTime:x,serverIp:t[V%t.length]}),!1),(F,V)=>(Qe.apworkerEvent(r.sid,{success:!1,sc:F.data&&F.data.code||200,serviceName:e,responseTime:x,serverIp:t[V%t.length]}),!!(F.code!==oe.OPERATION_ABORTED&&F.code!==oe.UNEXPECTED_RESPONSE||F.data&&F.data.retry)&&(Q=t[(V+1)%t.length],!0)),n)}function No({url:t,areaCode:e},r,i,n){let c=ot(),[h,C]=og(r,e,[kn.CHOOSE_SERVER]),x=us.networkState;return mn(()=>Ee(this,null,function*(){x&&us.networkState===js.OFFLINE&&us.onlineWaiter&&(yield it.race([us.onlineWaiter,Pe(n&&n.maxRetryTimeout||Vi.maxRetryTimeout)])),x=us.networkState;var Q=yield _i(t,{data:h,cancelToken:i,headers:{"Content-Type":"multipart/form-data;"}},!0);return ng(Q,t,r,c,[kn.CHOOSE_SERVER]),Q=go(Q,kn.CHOOSE_SERVER),sg(Q),Ao(Q,t)}),Q=>(Q&&Qe.joinChooseServer(r.sid,{lts:c,succ:!0,csAddr:t,opid:C,serverList:Q.gatewayAddrs,ec:null,cid:Q.cid.toString(),uid:Q.uid.toString(),csIp:Q.csIp,unilbsServerIds:[kn.CHOOSE_SERVER].toString()}),!1),Q=>Q.code!==oe.OPERATION_ABORTED&&(Q.code===oe.CAN_NOT_GET_GATEWAY_SERVER?Q.data.retry:(Qe.joinChooseServer(r.sid,{lts:c,succ:!1,csAddr:t,serverList:null,opid:C,ec:Q.code,csIp:Q.data&&Q.data.csIp,unilbsServerIds:[kn.CHOOSE_SERVER].toString(),extend:ht({networkState:x})}),z.warning("[".concat(r.clientId,"] Choose server network error, retry"),Q),!0)),n)}function rs({url:t,areaCode:e,serviceIds:r},i,n,c){let h=ot(),[C,x]=og(i,e,r),Q;return mn(()=>Ee(this,null,function*(){Q&&us.networkState===js.OFFLINE&&us.onlineWaiter&&(yield it.race([us.onlineWaiter,Pe(c&&c.maxRetryTimeout||Vi.maxRetryTimeout)])),Q=us.networkState;var F=yield _i(t,{data:C,cancelToken:n,headers:{"Content-Type":"multipart/form-data;"}},!0);ng(F,t,i,h,r);let V=go(F,kn.CHOOSE_SERVER);return F=go(F,i.cloudProxyServer==="proxy5"?kn.CLOUD_PROXY_5:kn.CLOUD_PROXY),sg(V),{gatewayInfo:Ao(V,t),proxyInfo:F,url:t}}),F=>{var V;return F.gatewayInfo&&Qe.joinChooseServer(i.sid,{lts:h,succ:!0,csAddr:t,serverList:F.gatewayInfo.gatewayAddrs,ec:null,opid:x,cid:F.gatewayInfo.cid.toString(),uid:F.gatewayInfo.uid.toString(),csIp:F.gatewayInfo.csIp,unilbsServerIds:r.toString()}),F.proxyInfo&&Qe.joinWebProxyAP(i.sid,{lts:h,sucess:1,apServerAddr:t,turnServerAddrList:yt(V=F.proxyInfo.addresses).call(V,Y=>Y.ip).join(","),errorCode:null,eventType:i.cloudProxyServer,unilbsServerIds:r.toString()}),!1},F=>F.code!==oe.OPERATION_ABORTED&&(F.code===oe.CAN_NOT_GET_GATEWAY_SERVER?F.data.retry:(Qe.joinWebProxyAP(i.sid,{lts:h,sucess:0,apServerAddr:t,turnServerAddrList:null,errorCode:F.code,eventType:i.cloudProxyServer,unilbsServerIds:r.toString(),extend:ht({networkState:Q})}),z.warning("[".concat(i.clientId,"] multi unilbs network error, retry"),F),!0)),c)}function xi(t,e,r){return Ee(this,null,function*(){return{gatewayInfo:yield function(i,n,c){return Ee(this,null,function*(){var h,C;const x=yt(h=$i(C=Xe.WEBCS_DOMAIN).call(C,0,Xe.AJAX_REQUEST_CONCURRENT)).call(h,V=>{var Y;return{url:i.proxyServer?ne(Y="https://".concat(i.proxyServer,"/ap/?url=")).call(Y,V+"/api/v2/transpond/webrtc?v=2"):"https://".concat(V,"/api/v2/transpond/webrtc?v=2"),areaCode:il()}});let Q=null;const F=[];return Q=yield Gn([(()=>Ee(this,null,function*(){return yield dc({fragementLength:Xe.FRAGEMENT_LENGTH,referenceList:x,asyncMapHandler:V=>(z.debug("[".concat(i.clientId,"] Connect to choose_server:"),V.url),No(V,i,n,c)),allFailedhandler:V=>{throw V[0]},promisesCollector:F})}))(),(()=>Ee(this,null,function*(){var V;if(yield Pe(1e3),Q!==null)return Q;const Y=yt(V=Xe.WEBCS_DOMAIN_BACKUP_LIST).call(V,$=>{var te;return{url:i.proxyServer?ne(te="https://".concat(i.proxyServer,"/ap/?url=")).call(te,$+"/api/v2/transpond/webrtc?v=2"):"https://".concat($,"/api/v2/transpond/webrtc?v=2"),areaCode:il()}});return yield dc({fragementLength:Xe.FRAGEMENT_LENGTH,referenceList:Y,asyncMapHandler:$=>(z.debug("[".concat(i.clientId,"] Connect to backup choose_server:"),$.url),No($,i,n,c)),allFailedhandler:$=>{throw $[0]},promisesCollector:F})}))()]),F.length&&Re(F).call(F,V=>V.cancel&&typeof V.cancel=="function"&&V.cancel()),Q})}(t,e,r)}})}function Ms(t,e,r,i){return Ee(this,null,function*(){var n,c;if(t.cloudProxyServer==="disabled")return i?yield xi(t,e,r):void 0;let h;if(t.cloudProxyServer==="443only"||t.cloudProxyServer==="normal"){var C;let x;i?t.cloudProxyServer!=="normal"?[x,h]=yield it.all([po(t,e,r),xi(t,e,r)]):(x=yield po(t,e,r),t.proxyServer=x.addresses[0],Qe.setProxyServer(t.proxyServer),z.setProxyServer(t.proxyServer),h=yield xi(t,e,r)):(h=void 0,t.cloudProxyServer!=="normal"?x=yield po(t,e,r):(x=yield po(t,e,r),t.proxyServer=x.addresses[0],Qe.setProxyServer(t.proxyServer),z.setProxyServer(t.proxyServer))),t.turnServer={mode:"manual",servers:yt(C=x.addresses).call(C,Q=>({turnServerURL:Q,tcpport:t.cloudProxyServer==="proxy3"?void 0:x.serverResponse.tcpport?x.serverResponse.tcpport:tn.tcpport,udpport:t.cloudProxyServer==="proxy4"?void 0:x.serverResponse.udpport?x.serverResponse.udpport:tn.udpport,username:x.serverResponse.username||tn.username,password:x.serverResponse.password||tn.password,forceturn:t.cloudProxyServer!=="proxy4"&&t.cloudProxyServer!=="proxy5",security:t.cloudProxyServer==="proxy5"}))}}else{let{proxyInfo:x,gatewayInfo:Q}=yield function(F,V,Y){return Ee(this,null,function*(){var $,te;const ce=Xe.PROXY_SERVER_TYPE3,Ae=(Et,nr)=>{var Tr;let ui=ce;return eo(ui)&&(ui=nr%2==0?ce[1]:ce[0]),ne(Tr="https://".concat(ui,"/ap/?url=")).call(Tr,Et)},Me=yt($=$i(te=Xe.WEBCS_DOMAIN).call(te,0,Xe.AJAX_REQUEST_CONCURRENT)).call($,(Et,nr)=>({url:Ae("".concat(Et,"/api/v2/transpond/webrtc?v=2"),nr),areaCode:il(),serviceIds:[kn.CHOOSE_SERVER,F.cloudProxyServer==="proxy5"?kn.CLOUD_PROXY_5:kn.CLOUD_PROXY]}));let et=null;const vt=[],{gatewayInfo:kt,proxyInfo:Pt,url:Dr}=yield Gn([(()=>Ee(this,null,function*(){return yield dc({fragementLength:Xe.FRAGEMENT_LENGTH,referenceList:Me,asyncMapHandler:Et=>(z.debug("[".concat(F.clientId,"] Connect to choose_server:"),Et.url),rs(Et,F,V,Y)),allFailedhandler:Et=>{throw Et[0]},promisesCollector:vt})}))(),(()=>Ee(this,null,function*(){var Et;if(yield Pe(1e3),et!==null)return et;const nr=yt(Et=Xe.WEBCS_DOMAIN_BACKUP_LIST).call(Et,(Tr,ui)=>({url:Ae("".concat(Tr,"/api/v2/transpond/webrtc?v=2"),ui),areaCode:il(),serviceIds:[11,18]}));return yield dc({fragementLength:Xe.FRAGEMENT_LENGTH,referenceList:nr,asyncMapHandler:Tr=>(z.debug("[".concat(F.clientId,"] Connect to backup choose_server:"),Tr.url),rs(Tr,F,V,Y)),allFailedhandler:Tr=>{throw Tr[0]},promisesCollector:vt})}))()]);if(vt.length&&Re(vt).call(vt,Et=>Et.cancel&&typeof Et.cancel=="function"&&Et.cancel()),!kt||!Pt)throw new ue(oe.UNEXPECTED_ERROR,"missing gateway or proxy response").print();return eo(ce)&&Dr&&($=new Im(Dr).host,Ir(ce).call(ce,$)&&(F.proxyServer=$,z.setProxyServer($),Qe.setProxyServer($))),et={gatewayInfo:kt,proxyInfo:Ka(Pt)},et})}(t,e,r);h={gatewayInfo:Q},t.turnServer={mode:"manual",servers:yt(x).call(x,F=>({turnServerURL:F.address,tcpport:t.cloudProxyServer==="proxy3"?void 0:F.tcpport?F.tcpport:tn.tcpport,udpport:t.cloudProxyServer==="proxy4"?void 0:F.udpport?F.udpport:tn.udpport,username:F.username||tn.username,password:F.password||tn.password,forceturn:t.cloudProxyServer!=="proxy4"&&t.cloudProxyServer!=="proxy5",security:t.cloudProxyServer==="proxy5"}))}}return z.debug(ne(n=ne(c="[".concat(t.clientId,"] set proxy server: ")).call(c,t.proxyServer,", mode: ")).call(n,t.cloudProxyServer)),h})}function Po(t,e,r,i){return Ee(this,null,function*(){var n;let c=$i(n=Xe.ACCOUNT_REGISTER).call(n,0,Xe.AJAX_REQUEST_CONCURRENT);return n=[],n=e.proxyServer?yt(c).call(c,h=>{var C;return ne(C="https://".concat(e.proxyServer,"/ap/?url=")).call(C,h+"/api/v1")}):yt(c).call(c,h=>"https://".concat(h,"/api/v1")),(yield function(h,C,x,Q,F){return Ee(this,null,function*(){let V=ot(),Y={sid:x.sid,opid:10,appid:x.appId,string_uid:C},$=h[0];if(x=yield mn(()=>_i($+"".concat(Wt($).call($,"?")===-1?"?":"&","action=stringuid"),{data:Y,cancelToken:Q,headers:{"X-Packet-Service-Type":0,"X-Packet-URI":72}}),(te,ce)=>{if(te.code===0){var Ae;if(0>=te.uid||te.uid>=Math.pow(2,32))throw z.error(ne(Ae="Invalid Uint Uid ".concat(C," => ")).call(Ae,te.uid),te),Qe.reqUserAccount(Y.sid,{lts:V,success:!1,serverAddr:$,stringUid:Y.string_uid,uid:te.uid,errorCode:oe.INVALID_UINT_UID_FROM_STRING_UID,extend:Y}),new ue(oe.INVALID_UINT_UID_FROM_STRING_UID);return Qe.reqUserAccount(Y.sid,{lts:V,success:!0,serverAddr:$,stringUid:Y.string_uid,uid:te.uid,errorCode:null,extend:Y}),!1}return Ae=Pi(te.code),Ae.retry&&($=h[(ce+1)%h.length]),Qe.reqUserAccount(Y.sid,{lts:V,success:!1,serverAddr:$,stringUid:Y.string_uid,uid:te.uid,errorCode:Ae.desc,extend:Y}),Ae.retry},(te,ce)=>te.code!==oe.OPERATION_ABORTED&&(Qe.reqUserAccount(Y.sid,{lts:V,success:!1,serverAddr:$,stringUid:Y.string_uid,uid:null,errorCode:te.code,extend:Y}),$=h[(ce+1)%h.length],!0),F),x.code!==0)throw x=Pi(x.code),new ue(oe.UNEXPECTED_RESPONSE,x.desc);return x})}(n,t,e,r,i)).uid})}function po(t,e,r){return Ee(this,null,function*(){var i,n=ot(),c=yt(i=Xe[t.cloudProxyServer==="normal"?"PROXY_CS":"WEBCS_DOMAIN"]).call(i,C=>{var x;return t.proxyServer?ne(x="https://".concat(t.proxyServer,"/ap/?url=")).call(x,C+"/api/v1"):"https://".concat(C,"/api/v1")});if(t.cloudProxyServer==="proxy3"||t.cloudProxyServer==="proxy4"||t.cloudProxyServer==="proxy5"){n=yt(c).call(c,C=>({url:C,areaCode:il()}));var h=null;if(h=yield dc({fragementLength:Xe.FRAGEMENT_LENGTH,referenceList:n,asyncMapHandler:C=>function({url:x,areaCode:Q},F,V,Y){let $=ot(),te={opid:133,flag:F.cloudProxyServer==="proxy5"?4194304:1048576,ts:+new Date,key:F.token,cname:F.cname,sid:F.sid,detail:{6:F.stringUid,11:Q},uid:F.uid||0};return mn(()=>Ee(this,null,function*(){return yield _i(x,{data:te,cancelToken:V,headers:{"X-Packet-Service-Type":0,"X-Packet-URI":69}})}),ce=>{var Ae;if(ce.code===0)return Qe.joinWebProxyAP(F.sid,{lts:$,sucess:1,apServerAddr:x,turnServerAddrList:yt(Ae=ce.addresses).call(Ae,Me=>Me.ip).join(","),errorCode:null,eventType:F.cloudProxyServer}),!1;throw ce=Pi(ce.code),new ue(oe.CAN_NOT_GET_GATEWAY_SERVER,ce.desc,{retry:ce.retry})},ce=>{return ce.code!==oe.OPERATION_ABORTED&&(ce.code===oe.CAN_NOT_GET_GATEWAY_SERVER?(Qe.joinWebProxyAP(te.sid,{lts:$,sucess:0,apServerAddr:x,turnServerAddrList:null,errorCode:ce.code,eventType:F.cloudProxyServer}),z.warning(ne(Ae=ne(Me=ne(et="[".concat(F.clientId,"] proxy ap server ")).call(et,x," failed, message: ")).call(Me,ce.message,", retry: ")).call(Ae,ce.data.retry)),ce.data.retry):(Qe.joinWebProxyAP(te.sid,{lts:$,sucess:0,apServerAddr:x,turnServerAddrList:null,errorCode:ce.code,eventType:F.cloudProxyServer}),!0));var Ae,Me,et},Y)}(C,t,e,r),allFailedhandler:()=>{throw z.error("[".concat(t.clientId,"] can not get proxy server after trying several times")),new ue(oe.CAN_NOT_GET_PROXY_SERVER)}}),n=h.addresses,!n||n.length===0)throw z.error("[".concat(t.clientId,"] can not get proxy server, empty proxy server list")),new ue(oe.CAN_NOT_GET_PROXY_SERVER,"empty proxy server list");return{addresses:yt(n).call(n,C=>C.ip),serverResponse:{tcpport:n[0].port||443,udpport:n[0].port||tn.udpport,username:tn.username,password:tn.password}}}if(i=null,i=yield dc({fragementLength:Xe.FRAGEMENT_LENGTH,referenceList:c,asyncMapHandler:C=>function(x,Q,F,V){let Y=ot(),$={command:"convergeAllocateEdge",sid:Q.sid,appId:Q.appId,token:Q.token,uid:Q.uid,cname:Q.cname,ts:Math.floor(ot()/1e3),version:as,seq:0,requestId:1};return mn(()=>Ee(this,null,function*(){return{res:yield _i(x,{data:{service_name:"webrtc_proxy",json_body:ht($)},cancelToken:F,headers:{"X-Packet-Service-Type":0,"X-Packet-URI":61}}),url:x}}),te=>{if(!te.res.json_body)throw z.debug("[".concat(Q.clientId,"] Get proxy server failed: no json_body")),new ue(oe.UNEXPECTED_RESPONSE,ht(te.res));let ce=JSON.parse(te.res.json_body);var Ae,Me;if(ce.code!==200)throw z.debug(ne(Ae=ne(Me="[".concat(Q.clientId,"] Get proxy server failed: response code [")).call(Me,ce.code,"], reason [")).call(Ae,ce.reason,"]")),new ue(oe.UNEXPECTED_RESPONSE,ht(te.res));return z.debug("[".concat(Q.clientId,"] App return server length"),ce.servers.length),!1},te=>te.code!==oe.OPERATION_ABORTED&&(Qe.requestProxyAppCenter($.sid,{lts:Y,succ:!1,APAddr:x,workerManagerList:null,ec:te.code,response:te.message}),!0),V)}(C,t,e,r),allFailedhandler:()=>{throw z.error("[".concat(t.clientId,"] can not get proxy server after trying several times")),new ue(oe.CAN_NOT_GET_PROXY_SERVER)}}),c=JSON.parse(i.res.json_body),c=yt(h=c.servers).call(h,ya),t.cloudProxyServer==="443only")return{addresses:c,serverResponse:{tcpport:443,udpport:tn.udpport,username:tn.username,password:tn.password}};Qe.requestProxyAppCenter(t.sid,{lts:n,succ:!0,APAddr:i.url,workerManagerList:ht(c),ec:null,response:ht(i.res)}),n=ot(),h=yt(c).call(c,C=>function(x,Q,F,V){const Y=ot();let $=x;jc(x).call(x,"http")||($="https://".concat(x,":4000/v2/machine"));const te={command:"request",gatewayType:"http",appId:Q.appId,cname:Q.cname,uid:(Q.uid||"").toString(),sdkVersion:"2.3.1",sid:Q.sid,seq:1,ts:ot(),requestId:3,clientRequest:{appId:Q.appId,cname:Q.cname,uid:(Q.uid||"").toString(),sid:Q.sid}};return mn(()=>Ee(this,null,function*(){return{res:yield _i($,{data:te,cancelToken:F}),url:x}}),ce=>{if(!ce.res.serverResponse)throw new ue(oe.UNEXPECTED_RESPONSE,"requeet worker manager server failed: serverResponse is undefined");return!1},ce=>ce.code!==oe.OPERATION_ABORTED&&(Qe.requestProxyWorkerManager(te.sid,{lts:Y,succ:!1,workerManagerAddr:x,ec:ce.code,response:ce.message}),!0),V)}(C,t,e,r)),i=null;try{i=yield Gn(h)}catch(C){throw z.error("[".concat(t.clientId,"] can not get worker manager after trying several times")),new ue(oe.CAN_NOT_GET_PROXY_SERVER)}return Re(h).call(h,C=>C.cancel()),Qe.requestProxyWorkerManager(t.sid,{lts:n,succ:!0,workerManagerAddr:i.url,ec:null,response:ht(i.res)}),{addresses:[i.url],serverResponse:i.res.serverResponse}})}function Nn(t,e,r){return Ee(this,null,function*(){var i,n,c=yt(i=$i(n=Xe.CDS_AP).call(n,0,Xe.AJAX_REQUEST_CONCURRENT)).call(i,C=>{var x;return t.proxyServer?ne(x="https://".concat(t.proxyServer,"/ap/?url=")).call(x,C+"/api/v1"):"https://".concat(C,"/api/v1?action=config")});i=yt(c).call(c,C=>function(x,Q,F,V){const Y=Ye(),$={flag:64,cipher_method:0,features:{device:Y.name,system:Y.os,vendor:Q.appId,version:as,cname:Q.cname,sid:Q.sid,session_id:Q.sid,detail:"",proxyServer:Q.proxyServer}};return mn(()=>_i(x,{data:$,timeout:1e3,cancelToken:F,headers:{"X-Packet-Service-Type":0,"X-Packet-URI":54}}),void 0,te=>te.code!==oe.OPERATION_ABORTED,V)}(C,t,e,r)),c=n=null;let h={};try{n=yield Gn(i)}catch(C){if(C.code===oe.OPERATION_ABORTED)throw C;c=C}if(Re(i).call(i,C=>C.cancel()),Qe.reportApiInvoke(t.sid,{name:bt.REQUEST_CONFIG_DISTRIBUTE,options:{error:c,res:n}}).onSuccess(),n&&n.test_tags)try{h=function(C){if(!C.test_tags)return{};let x=C.test_tags;C=Er(x);let Q={};return Re(C).call(C,F=>{var V;let Y=Na(V=$i(F).call(F,4)).call(V);F=JSON.parse(x[F])[1],Q[Y]=F}),Q}(n)}catch(C){}return h})}function ks(t,e,r,i){return Ee(this,null,function*(){var n,c;let h=yt(n=$i(c=Xe.UAP_AP).call(c,0,Xe.AJAX_REQUEST_CONCURRENT)).call(n,C=>{var x;return e.proxyServer?ne(x="https://".concat(e.proxyServer,"/ap/?url=")).call(x,C+"/api/v1?action=uap"):"https://".concat(C,"/api/v1?action=uap")});return yield qs(h,t,e,r,i)})}function vo(t,e,r){return Ee(this,null,function*(){var i,n;let c=yt(i=$i(n=Xe.UAP_AP).call(n,0,Xe.AJAX_REQUEST_CONCURRENT)).call(i,h=>{var C;return t.proxyServer?ne(C="https://".concat(t.proxyServer,"/ap/?url=")).call(C,h+"/api/v1?action=uap"):"https://".concat(h,"/api/v1?action=uap")});i=yt(c).call(c,h=>function(C,x,Q,F){x={command:"convergeAllocateEdge",sid:x.sid,appId:x.appId,token:x.token,ts:ot(),version:as,cname:x.cname,uid:x.uid.toString(),requestId:Jd,seq:Jd},Jd+=1;const V={service_name:"tele_channel",json_body:ht(x)};return mn(()=>Ee(this,null,function*(){var Y=yield _i(C,{data:V,cancelToken:Q,headers:{"X-Packet-Service-Type":0,"X-Packet-URI":61}});if(Y.code!==0){var $=new ue(oe.UNEXPECTED_RESPONSE,"cross channel ap error, code"+Y.code,{retry:!0});throw z.error($.toString()),$}if(Y=JSON.parse(Y.json_body),Y.code!==200){var te=new ue(oe.UNEXPECTED_RESPONSE,ne($="cross channel app center error, code: ".concat(Y.code,", reason: ")).call($,Y.reason));throw z.error(te.toString()),te}if(!Y.servers||Y.servers.length===0)throw $=new ue(oe.UNEXPECTED_RESPONSE,"cross channel app center empty server"),z.error($.toString()),$;return{vid:Y.vid,workerToken:Y.workerToken,addressList:yt(te=Y.servers).call(te,ce=>{var Ae;return ne(Ae="wss://".concat(ce.address.replace(/\./g,"-"),".edge.agora.io:")).call(Ae,ce.wss)})}}),void 0,Y=>!!(Y.code!==oe.OPERATION_ABORTED&&Y.code!==oe.UNEXPECTED_RESPONSE||Y.data&&Y.data.retry),F)}(h,t,e,r));try{let h=yield Gn(i);return Re(i).call(i,C=>C.cancel()),h}catch(h){throw h[0]}})}function dl(t,e){var r=Er(t);if(Qr){var i=Qr(t);e&&(i=Gt(i).call(i,function(n){return gr(t,n).enumerable})),r.push.apply(r,i)}return r}function is(t){if(Array.isArray(t))return t.map(function(i){return i});if(!hl(t))return t;var e={},r;for(r in t)hl(t[r])||Array.isArray(t[r])?e[r]=is(t[r]):e[r]=t[r];return e}function hl(t){return!(typeof t!="object"||Array.isArray(t)||!t)}function Ta(t,e){function r(){this.constructor=t}ag(t,e),t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Cc(t,e,r,i){return new(r||(r=Promise))(function(n,c){function h(Q){try{x(i.next(Q))}catch(F){c(F)}}function C(Q){try{x(i.throw(Q))}catch(F){c(F)}}function x(Q){Q.done?n(Q.value):new r(function(F){F(Q.value)}).then(h,C)}x((i=i.apply(t,e||[])).next())})}function wr(t,e){function r(x){return function(Q){return function(F){if(i)throw new TypeError("Generator is already executing.");for(;C;)try{if(i=1,n&&(c=2&F[0]?n.return:F[0]?n.throw||((c=n.return)&&c.call(n),0):n.next)&&!(c=c.call(n,F[1])).done)return c;switch(n=0,c&&(F=[2&F[0],c.value]),F[0]){case 0:case 1:c=F;break;case 4:return C.label++,{value:F[1],done:!1};case 5:C.label++,n=F[1],F=[0];continue;case 7:F=C.ops.pop(),C.trys.pop();continue;default:if(c=C.trys,!((c=0<c.length&&c[c.length-1])||F[0]!==6&&F[0]!==2)){C=0;continue}if(F[0]===3&&(!c||F[1]>c[0]&&F[1]<c[3]))C.label=F[1];else if(F[0]===6&&C.label<c[1])C.label=c[1],c=F;else if(c&&C.label<c[2])C.label=c[2],C.ops.push(F);else{c[2]&&C.ops.pop(),C.trys.pop();continue}}F=e.call(t,C)}catch(V){F=[6,V],n=0}finally{i=c=0}if(5&F[0])throw F[1];return{value:F[0]?F[1]:void 0,done:!0}}([x,Q])}}var i,n,c,h,C={label:0,sent:function(){if(1&c[0])throw c[1];return c[1]},trys:[],ops:[]};return h={next:r(0),throw:r(1),return:r(2)},typeof Symbol=="function"&&(h[Symbol.iterator]=function(){return this}),h}function fu(t,e,r){return r=t.createShader(r),r?(t.shaderSource(r,e),t.compileShader(r),t.getShaderParameter(r,t.COMPILE_STATUS)?r:(e=t.getShaderInfoLog(r),t.deleteShader(r),new ue(oe.WEBGL_INTERNAL_ERROR,"error compiling shader:"+e).throw())):new ue(oe.WEBGL_INTERNAL_ERROR,"can not create shader").throw()}function Au(t,e,r,i){let n=[];for(let c=0;c<e.length;++c)n.push(fu(t,e[c],c===0?t.VERTEX_SHADER:t.FRAGMENT_SHADER));return function(c,h,C,x){let Q=c.createProgram();if(!Q)throw new ue(oe.WEBGL_INTERNAL_ERROR,"can not create webgl program");if(Re(h).call(h,F=>{c.attachShader(Q,F)}),C&&Re(C).call(C,(F,V)=>{c.bindAttribLocation(Q,x?x[V]:V,F)}),c.linkProgram(Q),!c.getProgramParameter(Q,c.LINK_STATUS))throw h=c.getProgramInfoLog(Q),c.deleteProgram(Q),new ue(oe.WEBGL_INTERNAL_ERROR,"error in program linking:"+h);return Q}(t,n,r,i)}function fl(t){var e=new Uint8Array([99,114,121,112,116,105,105]),r=e.length;let i=t.length,n=new Uint8Array(i),c=new Uint8Array(256);for(var h=0;256>h;h++)c[h]=h;h=0;for(var C=0;256>C;C++)h=(h+c[C]+e[C%r])%256,[c[C],c[h]]=[c[h],c[C]];for(h=r=0,C=0;C<0+i;C++)r=(r+1)%256,h=(h+c[r])%256,[c[r],c[h]]=[c[h],c[r]],e=c[(c[r]+c[h])%256],0<=C&&(n[C-0]=t[C-0]^e);return t=String.fromCharCode.apply(null,io(n)),Function("var winSize = 5; return `"+t+"`")()}function yc(t){let e={};return t.facingMode&&(e.facingMode=t.facingMode),t.cameraId&&(e.deviceId={exact:t.cameraId}),t.encoderConfig?(t=oi(t.encoderConfig),e.width=t.width,e.height=t.height,!si()&&t.frameRate&&(e.frameRate=t.frameRate),Ye().name===rr.EDGE&&typeof e.frameRate=="object"&&(e.frameRate.max=60),sr()&&(e.frameRate={ideal:30,max:30}),e):e}function Ic(t){let e={};if(si()||(t.AGC!==void 0&&(e.autoGainControl=t.AGC,Mt()&&(e.googAutoGainControl=t.AGC,e.googAutoGainControl2=t.AGC)),t.AEC!==void 0&&(e.echoCancellation=t.AEC),t.ANS!==void 0&&(e.noiseSuppression=t.ANS,Mt()&&(e.googNoiseSuppression=t.ANS))),t.encoderConfig){let r=Zr(t.encoderConfig);e.channelCount=r.stereo?2:1,e.sampleRate=r.sampleRate,e.sampleSize=r.sampleSize}return t.microphoneId&&(e.deviceId={exact:t.microphoneId}),Mt()&&e.channelCount===2&&(e.googAutoGainControl=!1,e.googAutoGainControl2=!1,e.echoCancellation=!1,e.googNoiseSuppression=!1),Ye().os===en.ANDROID&&(e.sampleRate=void 0),e}function Al(t,e){var r=Er(t);if(Qr){var i=Qr(t);e&&(i=Gt(i).call(i,function(n){return gr(t,n).enumerable})),r.push.apply(r,i)}return r}function sa(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=Al(Object(i),!0)).call(r,function(c){Un(t,c,i[c])});else if(Fr)Mn(t,Fr(i));else{var n;Re(n=Al(Object(i))).call(n,function(c){_r(t,c,gr(i,c))})}}return t}function Sc(t){let e={video:[],audio:[]};return t.match(/ VP8/i)&&e.video.push("VP8"),t.match(/ VP9/i)&&e.video.push("VP9"),t.match(/ AV1X/i)&&e.video.push("AV1"),t.match(/ H264/i)&&e.video.push("H264"),t.match(/ opus/i)&&e.audio.push("OPUS"),e}function Tc(t,e){var r=t.match(/a=rtpmap:(\d+) opus/);if(!r||!r[0]||!r[1])return t;var i=r[1];if(r=t.match("a=fmtp:".concat(i,`.*\r
51
- `)),!r||!r[0])return t;i="a=fmtp:".concat(i," minptime=10;useinbandfec=1;");var n;return e.bitrate&&!sr()&&(i+="maxaveragebitrate=".concat(Math.floor(1e3*e.bitrate),";")),e.sampleRate&&(i+=ne(n="maxplaybackrate=".concat(e.sampleRate,";sprop-maxcapturerate=")).call(n,e.sampleRate,";")),e.stereo&&(i+="stereo=1;sprop-stereo-1;"),i+=`\r
52
- `,t.replace(r[0],i)}function ja(t){return t.replace("minptime=10","minptime=10;stereo=1;sprop-stereo=1")}function gl(t,e,r){var i=!1;switch(e){case"h264":return t;case"vp8":if(!Xe.SIMULCAST)return t;r&&(r.numSpatialLayers=2);case"vp9":case"av1":i=!0}if(i){var n;let vt=Si(n=RegExp.prototype.test).call(n,/^([a-z])=(.*)/),kt=t.split("m="),Pt,Dr,Et=null,nr=null,Tr=null,ui=[];n=[];var c;e=[];let zi=i=null;var h;let Wr=[],Rn=[];for(var C=0;C<kt.length;++C)if(Et=kt[C].match(/a=msid-semantic:/),Et){Et=kt[C];break}for(C=0;C<kt.length;++C)if(nr=kt[C].match(/audio /),nr){Pt=C,nr="m="+kt[C];break}for(C=0;C<kt.length;++C)if(Tr=kt[C].match(/video /),Tr){Dr=C,Tr="m="+kt[C];break}if(Et&&(ui=Gt(c=Et.split(/(\r\n|\r|\n)/)).call(c,vt)),0<ui.length&&(e=ne(e).call(e,ui)),nr&&(n=Gt(h=nr.split(/(\r\n|\r|\n)/)).call(h,vt)),!Tr)return t;var x;for(c=Gt(x=Tr.split(/(\r\n|\r|\n)/)).call(x,vt),x=0;x<c.length;++x)if(i===null&&(i=c[x].match(/cname:/),i!==null)){i="cname:"+c[x].split("cname:")[1];break}for(h=0;h<c.length;++h)if(zi===null&&(zi=c[h].match(/a=msid:/),zi!==null&&(zi="msid:"+c[h].split(":")[1])),c[h].match(/a=ssrc-group:FID/)){x=c[h].split(" "),Wr.push(Number(x[1])),x[2]&&Rn.push(Number(x[2])),c.length=h;break}for(x=1;x<r.numSpatialLayers;++x)Wr.push(Wr[0]+x),0<Rn.length&&Rn.push(Rn[0]+x);for(x="a=ssrc-group:SIM ",h=0;h<Wr.length;++h)x=ne(x).call(x,String(Wr[h])),h<Wr.length-1&&(x=ne(x).call(x," "));for(c.push(x),x=0;x<r.numSpatialLayers;++x){var Q,F;h=ne(Q=ne(F=ne("a=ssrc-group:FID ").call("a=ssrc-group:FID ",String(Wr[x]))).call(F," ")).call(Q,String(Rn[x])),c.push(h)}for(Q=0;Q<r.numSpatialLayers;++Q){var V,Y,$,te;if(i===null||zi===null)return t;F=ne(V=ne(Y="a=ssrc:".concat(String(Wr[Q]))).call(Y," ")).call(V,i),x=ne($=ne(te="a=ssrc:".concat(String(Wr[Q]))).call(te," ")).call($,zi),c.push(F),c.push(x)}for(V=0;V<r.numSpatialLayers;++V){var ce,Ae,Me,et;if(i===null||zi===null)return t;Y=ne(ce=ne(Ae="a=ssrc:".concat(String(Rn[V]))).call(Ae," ")).call(ce,i),$=ne(Me=ne(et="a=ssrc:".concat(String(Rn[V]))).call(et," ")).call(Me,zi),c.push(Y),c.push($)}Pt&&Dr&&Pt>Dr?(e=ne(e).call(e,c),e=ne(e).call(e,n)):(e=ne(e).call(e,n),e=ne(e).call(e,c)),t=e.join(`\r
53
- `)+`\r
54
- `}return t}function yi(t,e){let r=(n,c)=>{const h=Tg(n,c);return h?r(i(n,h),c):n},i=(n,c)=>{var h,C;const x=Si(h=RegExp.prototype.test).call(h,/^([a-z])=(.*)/),Q=["a=rtpmap:".concat(c),"a=rtcp-fb:".concat(c),"a=fmtp:".concat(c)],F=Gt(C=n.split(/(\r\n|\r|\n)/)).call(C,x),V=[];if(Re(F).call(F,($,te)=>{Re(Q).call(Q,ce=>{Ir($).call($,ce)&&V.push(te)})}),n=lu(F).call(F,$=>Ir($).call($,"apt=".concat(c))),n){V.push(n,n-1);var Y=(Y=F[n-1].match(/a=rtpmap:(\d+) rtx.*/))&&Y[1]}return Re(V).call(V,$=>{F[$]=""}),n=lu(F).call(F,$=>Ir($).call($,"m=video")),F[n]=F[n].replace(" ".concat(c),""),Y&&(F[n]=F[n].replace(" ".concat(Y),"")),Gt(F).call(F,$=>!!$).join(`\r
55
- `)+`\r
56
- `};return Re(e).call(e,n=>{t=r(t,n)}),t}function gu(t,e){let r=document.createElement("video"),i=document.createElement("canvas");r.setAttribute("style","display:none"),i.setAttribute("style","display:none"),r.setAttribute("muted",""),r.muted=!0,r.setAttribute("autoplay",""),r.autoplay=!0,r.setAttribute("playsinline",""),i.width=Qn(e.width),i.height=Qn(e.height),e=Qn(e.framerate||15),document.body.append(r),document.body.append(i);let n=t._mediaStreamTrack;r.srcObject=new MediaStream([n]),r.play();let c=i.getContext("2d");if(!c)throw new ue(oe.UNEXPECTED_ERROR,"can not get canvas context");let h=i.captureStream(Ur.supportRequestFrame?0:e).getVideoTracks()[0],C=Ys(()=>{if(r.paused&&r.play(),2<r.videoHeight&&2<r.videoWidth){const Y=r.videoHeight/r.videoWidth*i.width;var Q,F,V;2<=Math.abs(Y-i.height)&&(z.debug("adjust low stream resolution",ne(Q=ne(F=ne(V="".concat(i.width,"x")).call(V,i.height," -> ")).call(F,i.width,"x")).call(Q,Y)),i.height=Y)}c.drawImage(r,0,0,i.width,i.height),h.requestFrame&&h.requestFrame(),n!==t._mediaStreamTrack&&(n=t._mediaStreamTrack,r.srcObject=new MediaStream([n]))},e),x=h.stop;return h.stop=()=>{x.call(h),C(),r.remove(),i.width=0,i.remove(),r=i=null,z.debug("clean low stream renderer")},h}function pl(t,e){var r=Er(t);if(Qr){var i=Qr(t);e&&(i=Gt(i).call(i,function(n){return gr(t,n).enumerable})),r.push.apply(r,i)}return r}function vl(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=pl(Object(i),!0)).call(r,function(c){Un(t,c,i[c])});else if(Fr)Mn(t,Fr(i));else{var n;Re(n=pl(Object(i))).call(n,function(c){_r(t,c,gr(i,c))})}}return t}function ml(t,e){var r=Er(t);if(Qr){var i=Qr(t);e&&(i=Gt(i).call(i,function(n){return gr(t,n).enumerable})),r.push.apply(r,i)}return r}function Wa(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=ml(Object(i),!0)).call(r,function(c){Un(t,c,i[c])});else if(Fr)Mn(t,Fr(i));else{var n;Re(n=ml(Object(i))).call(n,function(c){_r(t,c,gr(i,c))})}}return t}function El(t,e){var r=Er(t);if(Qr){var i=Qr(t);e&&(i=Gt(i).call(i,function(n){return gr(t,n).enumerable})),r.push.apply(r,i)}return r}function Va(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=El(Object(i),!0)).call(r,function(c){Un(t,c,i[c])});else if(Fr)Mn(t,Fr(i));else{var n;Re(n=El(Object(i))).call(n,function(c){_r(t,c,gr(i,c))})}}return t}function _l(t,e){var r=Er(t);if(Qr){var i=Qr(t);e&&(i=Gt(i).call(i,function(n){return gr(t,n).enumerable})),r.push.apply(r,i)}return r}function mo(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=_l(Object(i),!0)).call(r,function(c){Un(t,c,i[c])});else if(Fr)Mn(t,Fr(i));else{var n;Re(n=_l(Object(i))).call(n,function(c){_r(t,c,gr(i,c))})}}return t}function Ra(t){if(!(t instanceof Lg))return new ue(oe.INVALID_PARAMS,"Config should be instance of [ChannelMediaRelayConfiguration]").throw();let e=t.getSrcChannelMediaInfo();if(t=t.getDestChannelMediaInfo(),!e)return new ue(oe.INVALID_PARAMS,"srcChannelMediaInfo should not be empty").throw();if(t.size===0)return new ue(oe.INVALID_PARAMS,"destChannelMediaInfo should not be empty").throw()}function Cl(t,e){var r=Er(t);if(Qr){var i=Qr(t);e&&(i=Gt(i).call(i,function(n){return gr(t,n).enumerable})),r.push.apply(r,i)}return r}function Eo(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=Cl(Object(i),!0)).call(r,function(c){Un(t,c,i[c])});else if(Fr)Mn(t,Fr(i));else{var n;Re(n=Cl(Object(i))).call(n,function(c){_r(t,c,gr(i,c))})}}return t}function eh(t,e){return Ee(this,null,function*(){var r=null;if(typeof t=="string"){let i=Dg.get(t);if(i)return z.debug("use cached audio resource: ",t),i;try{r=(yield mn(()=>yo.get(t,{responseType:"arraybuffer"}),void 0,void 0,{maxRetryCount:3})).data}catch(n){throw new ue(oe.FETCH_AUDIO_FILE_FAILED,n.toString())}}else r=yield new it((i,n)=>{const c=new FileReader;c.onload=h=>{h.target?i(h.target.result):n(new ue(oe.READ_LOCAL_AUDIO_FILE_ERROR))},c.onerror=()=>{n(new ue(oe.READ_LOCAL_AUDIO_FILE_ERROR))},c.readAsArrayBuffer(t)});return r=yield function(i){const n=fs();return new it((c,h)=>{n.decodeAudioData(i,C=>{c(C)},C=>{h(new ue(oe.DECODE_AUDIO_FILE_FAILED,C.toString()))})})}(r),typeof t=="string"&&e&&Dg.set(t,r),r})}function yl(t,e){var r=Er(t);if(Qr){var i=Qr(t);e&&(i=Gt(i).call(i,function(n){return gr(t,n).enumerable})),r.push.apply(r,i)}return r}function Rc(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e]!=null?arguments[e]:{};if(e%2)Re(r=yl(Object(i),!0)).call(r,function(c){Un(t,c,i[c])});else if(Fr)Mn(t,Fr(i));else{var n;Re(n=yl(Object(i))).call(n,function(c){_r(t,c,gr(i,c))})}}return t}function wc(t,e,r,i){r.optimizationMode&&(i&&i.width&&i.height?(r.encoderConfig=Rc({},i,{bitrateMin:i.bitrateMin,bitrateMax:i.bitrateMax}),r.optimizationMode!=="motion"&&r.optimizationMode!=="detail"||(e.contentHint=r.optimizationMode,e.contentHint===r.optimizationMode?z.debug("[".concat(t,"] set content hint to"),r.optimizationMode):z.debug("[".concat(t,"] set content hint failed")))):z.warning("[".concat(t,"] can not apply optimization mode bitrate config, no encoderConfig")))}var oa=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof H.g!="undefined"?H.g:typeof self!="undefined"?self:{},aa=function(t){return t&&t.Math==Math&&t},gt=aa(typeof globalThis=="object"&&globalThis)||aa(typeof window=="object"&&window)||aa(typeof self=="object"&&self)||aa(typeof oa=="object"&&oa)||Function("return this")(),Jt=function(t){try{return!!t()}catch(e){return!0}},kr=!Jt(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7}),ca={}.propertyIsEnumerable,Ya=Object.getOwnPropertyDescriptor,xo=Ya&&!ca.call({1:2},1)?function(t){return t=Ya(this,t),!!t&&t.enumerable}:ca,Xs=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},Es={}.toString,ns=function(t){return Es.call(t).slice(8,-1)},pu="".split,la=Jt(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return ns(t)=="String"?pu.call(t,""):Object(t)}:Object,Mo=function(t){if(t==null)throw TypeError("Can't call method on "+t);return t},Cn=function(t){return la(Mo(t))},zr=function(t){return typeof t=="object"?t!==null:typeof t=="function"},ua=function(t,e){if(!zr(t))return t;var r,i;if(e&&typeof(r=t.toString)=="function"&&!zr(i=r.call(t))||typeof(r=t.valueOf)=="function"&&!zr(i=r.call(t))||!e&&typeof(r=t.toString)=="function"&&!zr(i=r.call(t)))return i;throw TypeError("Can't convert object to primitive value")},vu={}.hasOwnProperty,qt=function(t,e){return vu.call(t,e)},da=gt.document,Ja=zr(da)&&zr(da.createElement),Lc=!kr&&!Jt(function(){return Object.defineProperty(Ja?da.createElement("div"):{},"a",{get:function(){return 7}}).a!=7}),Il=Object.getOwnPropertyDescriptor,ko=kr?Il:function(t,e){if(t=Cn(t),e=ua(e,!0),Lc)try{return Il(t,e)}catch(r){}if(qt(t,e))return Xs(!xo.call(t,e),t[e])},mu=/#|\.prototype\./,Uo=function(t,e){return t=_u[Eu(t)],t==Dc||t!=Cu&&(typeof e=="function"?Jt(e):!!e)},Eu=Uo.normalize=function(t){return String(t).replace(mu,".").toLowerCase()},_u=Uo.data={},Cu=Uo.NATIVE="N",Dc=Uo.POLYFILL="P",Br={},ss=function(t){if(typeof t!="function")throw TypeError(String(t)+" is not a function");return t},yn=function(t,e,r){if(ss(t),e===void 0)return t;switch(r){case 0:return function(){return t.call(e)};case 1:return function(i){return t.call(e,i)};case 2:return function(i,n){return t.call(e,i,n)};case 3:return function(i,n,c){return t.call(e,i,n,c)}}return function(){return t.apply(e,arguments)}},Hi=function(t){if(!zr(t))throw TypeError(String(t)+" is not an object");return t},Sl=Object.defineProperty,Hn={f:kr?Sl:function(t,e,r){if(Hi(t),e=ua(e,!0),Hi(r),Lc)try{return Sl(t,e,r)}catch(i){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},Kn=kr?function(t,e,r){return Hn.f(t,e,Xs(1,r))}:function(t,e,r){return t[e]=r,t},yu=ko,Iu=function(t){var e=function(r,i,n){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(r);case 2:return new t(r,i)}return new t(r,i,n)}return t.apply(this,arguments)};return e.prototype=t.prototype,e},Qt=function(t,e){var r,i,n,c,h,C=t.target,x=t.global,Q=t.stat,F=t.proto,V=x?gt:Q?gt[C]:(gt[C]||{}).prototype,Y=x?Br:Br[C]||(Br[C]={}),$=Y.prototype;for(i in e){var te=!Uo(x?i:C+(Q?".":"#")+i,t.forced)&&V&&qt(V,i),ce=Y[i];te&&(n=t.noTargetGet?(h=yu(V,i))&&h.value:V[i]);var Ae=te&&n?n:e[i];te&&typeof ce==typeof Ae||(c=t.bind&&te?yn(Ae,gt):t.wrap&&te?Iu(Ae):F&&typeof Ae=="function"?yn(Function.call,Ae):Ae,(t.sham||Ae&&Ae.sham||ce&&ce.sham)&&Kn(c,"sham",!0),Y[i]=c,F&&(qt(Br,r=C+"Prototype")||Kn(Br,r,{}),Br[r][i]=Ae,t.real&&$&&!$[i]&&Kn($,i,Ae)))}},Tl=function(t){return typeof t=="function"?t:void 0},jn=function(t,e){return 2>arguments.length?Tl(Br[t])||Tl(gt[t]):Br[t]&&Br[t][e]||gt[t]&&gt[t][e]},za=jn("JSON","stringify"),Rl=/[\uD800-\uDFFF]/g,bc=/^[\uD800-\uDBFF]$/,Oc=/^[\uDC00-\uDFFF]$/,wl=function(t,e,r){var i=r.charAt(e-1);return e=r.charAt(e+1),bc.test(t)&&!Oc.test(e)||Oc.test(t)&&!bc.test(i)?"\\u"+t.charCodeAt(0).toString(16):t},Bc=Jt(function(){return za("\uDF06\uD834")!=='"\\udf06\\ud834"'||za("\uDEAD")!=='"\\udead"'});za&&Qt({target:"JSON",stat:!0,forced:Bc},{stringify:function(t,e,r){var i=za.apply(null,arguments);return typeof i=="string"?i.replace(Rl,wl):i}}),Br.JSON||(Br.JSON={stringify:JSON.stringify});var Fo,_s,ht=function(t,e,r){return Br.JSON.stringify.apply(null,arguments)},Zs=Array.isArray||function(t){return ns(t)=="Array"},Wn=function(t){return Object(Mo(t))},Nc=Math.ceil,Su=Math.floor,Qo=function(t){return isNaN(t=+t)?0:(0<t?Su:Nc)(t)},Tu=Math.min,Vn=function(t){return 0<t?Tu(Qo(t),9007199254740991):0},Go=function(t,e,r){e=ua(e),e in t?Hn.f(t,e,Xs(0,r)):t[e]=r},qa=gt["__core-js_shared__"]||function(t,e){try{Kn(gt,t,e)}catch(r){gt[t]=e}return e}("__core-js_shared__",{}),Xi=k(function(t){(t.exports=function(e,r){return qa[e]||(qa[e]=r!==void 0?r:{})})("versions",[]).push({version:"3.4.3",mode:"pure",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})}),Ll=0,Dl=Math.random(),ha=function(t){return"Symbol("+String(t===void 0?"":t)+")_"+(++Ll+Dl).toString(36)},Us=!!Object.getOwnPropertySymbols&&!Jt(function(){return!String(Symbol())}),Pc=Us&&!Symbol.sham&&typeof Symbol()=="symbol",wa=Xi("wks"),La=gt.Symbol,Ru=Pc?La:ha,fi=function(t){return qt(wa,t)||(Us&&qt(La,t)?wa[t]=La[t]:wa[t]=Ru("Symbol."+t)),wa[t]},xc=fi("species"),Mc=function(t,e){var r;return Zs(t)&&(typeof(r=t.constructor)!="function"||r!==Array&&!Zs(r.prototype)?zr(r)&&(r=r[xc])===null&&(r=void 0):r=void 0),new(r===void 0?Array:r)(e===0?0:e)},fa=jn("navigator","userAgent")||"",kc=gt.process,Ho=kc&&kc.versions,bl=Ho&&Ho.v8;bl?_s=(Fo=bl.split("."))[0]+Fo[1]:fa&&(!(Fo=fa.match(/Edge\/(\d+)/))||74<=Fo[1])&&(Fo=fa.match(/Chrome\/(\d+)/))&&(_s=Fo[1]);var Aa=_s&&+_s,wu=fi("species"),Da=function(t){return 51<=Aa||!Jt(function(){var e=[];return(e.constructor={})[wu]=function(){return{foo:1}},e[t](Boolean).foo!==1})},Ol=fi("isConcatSpreadable"),Lu=51<=Aa||!Jt(function(){var t=[];return t[Ol]=!1,t.concat()[0]!==t}),Du=Da("concat");Qt({target:"Array",proto:!0,forced:!Lu||!Du},{concat:function(t){var e,r,i=Wn(this),n=Mc(i,0),c=0,h=-1;for(e=arguments.length;h<e;h++){var C=r=h===-1?i:arguments[h];if(zr(C)){var x=C[Ol];C=x!==void 0?!!x:Zs(C)}else C=!1;if(C){if(9007199254740991<c+(x=Vn(r.length)))throw TypeError("Maximum allowed index exceeded");for(C=0;C<x;C++,c++)C in r&&Go(n,c,r[C])}else{if(9007199254740991<=c)throw TypeError("Maximum allowed index exceeded");Go(n,c++,r)}}return n.length=c,n}});var ai=function(t){return Br[t+"Prototype"]},Xa=ai("Array").concat,Za=Array.prototype,ne=function(t){var e=t.concat;return t===Za||t instanceof Array&&e===Za.concat?Xa:e},Fs={},th=!Jt(function(){return Object.isExtensible(Object.preventExtensions({}))}),$a=k(function(t){var e=Hn.f,r=ha("meta"),i=0,n=Object.isExtensible||function(){return!0},c=function(C){e(C,r,{value:{objectID:"O"+ ++i,weakData:{}}})},h=t.exports={REQUIRED:!1,fastKey:function(C,x){if(!zr(C))return typeof C=="symbol"?C:(typeof C=="string"?"S":"P")+C;if(!qt(C,r)){if(!n(C))return"F";if(!x)return"E";c(C)}return C[r].objectID},getWeakData:function(C,x){if(!qt(C,r)){if(!n(C))return!0;if(!x)return!1;c(C)}return C[r].weakData},onFreeze:function(C){return th&&h.REQUIRED&&n(C)&&!qt(C,r)&&c(C),C}};Fs[r]=!0}),$s={},ba=fi("iterator"),rh=Array.prototype,Bl=function(t){return t!==void 0&&($s.Array===t||rh[ba]===t)},G={};G[fi("toStringTag")]="z";var Z=String(G)==="[object z]",re=fi("toStringTag"),ge=ns(function(){return arguments}())=="Arguments",de=Z?ns:function(t){var e;if(t===void 0)var r="Undefined";else{if(t===null)var i="Null";else{e:{var n=t=Object(t);try{i=n[re];break e}catch(c){}i=void 0}i=typeof(r=i)=="string"?r:ge?ns(t):(e=ns(t))=="Object"&&typeof t.callee=="function"?"Arguments":e}r=i}return r},Ie=fi("iterator"),Se=function(t){if(t!=null)return t[Ie]||t["@@iterator"]||$s[de(t)]},be=function(t,e,r,i){try{return i?e(Hi(r)[0],r[1]):e(r)}catch(n){throw e=t.return,e!==void 0&&Hi(e.call(t)),n}},ke=k(function(t){var e=function(r,i){this.stopped=r,this.result=i};(t.exports=function(r,i,n,c,h){var C,x;if(i=yn(i,n,c?2:1),!h){if(typeof(h=Se(r))!="function")throw TypeError("Target is not iterable");if(Bl(h)){for(h=0,n=Vn(r.length);n>h;h++)if((C=c?i(Hi(x=r[h])[0],x[1]):i(r[h]))&&C instanceof e)return C;return new e(!1)}r=h.call(r)}for(h=r.next;!(x=h.call(r)).done;)if(typeof(C=be(r,i,x.value,c))=="object"&&C&&C instanceof e)return C;return new e(!1)}).stop=function(r){return new e(!0,r)}}),we=function(t,e,r){if(!(t instanceof e))throw TypeError("Incorrect "+(r?r+" ":"")+"invocation");return t},Le=Z?{}.toString:function(){return"[object "+de(this)+"]"},Be=Hn.f,He=fi("toStringTag"),je=function(t,e,r,i){t&&(t=r?t:t.prototype,qt(t,He)||Be(t,He,{configurable:!0,value:e}),i&&!Z&&Kn(t,"toString",Le))},qe=[].push,ze=function(t){var e=t==1,r=t==2,i=t==3,n=t==4,c=t==6,h=t==5||c;return function(C,x,Q,F){var V,Y,$=Wn(C),te=la($);x=yn(x,Q,3),Q=Vn(te.length);var ce=0;for(F=F||Mc,C=e?F(C,Q):r?F(C,0):void 0;Q>ce;ce++)if((h||ce in te)&&(Y=x(V=te[ce],ce,$),t)){if(e)C[ce]=Y;else if(Y)switch(t){case 3:return!0;case 5:return V;case 6:return ce;case 2:qe.call(C,V)}else if(n)return!1}return c?-1:i||n?n:C}},rt=ze(0),We=ze(1),Ke=ze(2),st=ze(3),pt=ze(4),Ct=ze(5),$e=ze(6),lt=Xi("native-function-to-string",Function.toString),mt=gt.WeakMap,dt=typeof mt=="function"&&/native code/.test(lt.call(mt)),At=Xi("keys"),wt=function(t){return At[t]||(At[t]=ha(t))},Rt=gt.WeakMap;if(dt)var jt=new Rt,or=jt.get,Xt=jt.has,hr=jt.set,Nr=function(t,e){return hr.call(jt,t,e),e},ur=function(t){return or.call(jt,t)||{}},Vt=function(t){return Xt.call(jt,t)};else{var yr=wt("state");Fs[yr]=!0,Nr=function(t,e){return Kn(t,yr,e),e},ur=function(t){return qt(t,yr)?t[yr]:{}},Vt=function(t){return qt(t,yr)}}var Zt={set:Nr,get:ur,has:Vt,enforce:function(t){return Vt(t)?ur(t):Nr(t,{})},getterFor:function(t){return function(e){var r;if(!zr(e)||(r=ur(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}},Ai=Hn.f,ti=Zt.set,ci=Zt.getterFor,ri=function(t,e,r){var i=t.indexOf("Map")!==-1,n=t.indexOf("Weak")!==-1,c=i?"set":"add",h=gt[t],C=h&&h.prototype,x={};if(kr&&typeof h=="function"&&(n||C.forEach&&!Jt(function(){new h().entries().next()}))){var Q=e(function(V,Y){ti(we(V,Q,t),{type:t,collection:new h}),Y!=null&&ke(Y,V[c],V,i)}),F=ci(t);rt("add clear delete forEach get has set keys values entries".split(" "),function(V){var Y=V=="add"||V=="set";!(V in C)||n&&V=="clear"||Kn(Q.prototype,V,function($,te){var ce=F(this).collection;return!Y&&n&&!zr($)?V=="get"&&void 0:($=ce[V]($===0?0:$,te),Y?this:$)})}),n||Ai(Q.prototype,"size",{configurable:!0,get:function(){return F(this).collection.size}})}else Q=r.getConstructor(e,t,i,c),$a.REQUIRED=!0;return je(Q,t,!1,!0),x[t]=Q,Qt({global:!0,forced:!0},x),n||r.setStrong(Q,t,i),Q},Cs=Math.max,Pn=Math.min,Li=function(t,e){return t=Qo(t),0>t?Cs(t+e,0):Pn(t,e)},Zi=function(t){return function(e,r,i){var n;e=Cn(e);var c=Vn(e.length);if(i=Li(i,c),t&&r!=r){for(;c>i;)if((n=e[i++])!=n)return!0}else for(;c>i;i++)if((t||i in e)&&e[i]===r)return t||i||0;return!t&&-1}},Yn=Zi(!0),Jn=Zi(!1),_o=function(t,e){var r;t=Cn(t);var i=0,n=[];for(r in t)!qt(Fs,r)&&qt(t,r)&&n.push(r);for(;e.length>i;)qt(t,r=e[i++])&&(~Jn(n,r)||n.push(r));return n},qr="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),Pr=Object.keys||function(t){return _o(t,qr)},ft=kr?Object.defineProperties:function(t,e){Hi(t);for(var r,i=Pr(e),n=i.length,c=0;n>c;)Hn.f(t,r=i[c++],e[r]);return t},ii=jn("document","documentElement"),Ki=wt("IE_PROTO"),jr=function(){},zn=function(){var t=Ja?da.createElement("iframe"):{},e=qr.length;for(t.style.display="none",ii.appendChild(t),t.src="javascript:",(t=t.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),zn=t.F;e--;)delete zn.prototype[qr[e]];return zn()},ys=Object.create||function(t,e){var r;return t!==null?(jr.prototype=Hi(t),r=new jr,jr.prototype=null,r[Ki]=t):r=zn(),e===void 0?r:ft(r,e)};Fs[Ki]=!0;var ga,ln,Mi,In=function(t,e,r,i){i&&i.enumerable?t[e]=r:Kn(t,e,r)},Ko=function(t,e,r){for(var i in e)r&&r.unsafe&&t[i]?t[i]=e[i]:In(t,i,e[i],r);return t},bu=!Jt(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}),ih=wt("IE_PROTO"),Fg=Object.prototype,Ou=bu?Object.getPrototypeOf:function(t){return t=Wn(t),qt(t,ih)?t[ih]:typeof t.constructor=="function"&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?Fg:null},nh=(fi("iterator"),!1);[].keys&&("next"in(Mi=[].keys())?(ln=Ou(Ou(Mi)))!==Object.prototype&&(ga=ln):nh=!0),ga==null&&(ga={});var sh=ga,Nl=nh,Qg=function(){return this},oh=function(t,e,r){return e+=" Iterator",t.prototype=ys(sh,{next:Xs(1,r)}),je(t,e,!1,!0),$s[e]=Qg,t},Gg=(Object.setPrototypeOf||"__proto__"in{}&&function(){var t={};try{Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set.call(t,[])}catch(e){}}(),sh),Bu=fi("iterator"),Hg=function(){return this},Nu=function(t,e,r,i,n,c,h){oh(r,e,i);var C,x,Q;i=function(Ae){if(Ae===n&&te)return te;if(!Nl&&Ae in Y)return Y[Ae];switch(Ae){case"keys":case"values":case"entries":return function(){return new r(this,Ae)}}return function(){return new r(this)}};var F=e+" Iterator",V=!1,Y=t.prototype,$=Y[Bu]||Y["@@iterator"]||n&&Y[n],te=!Nl&&$||i(n),ce=e=="Array"&&Y.entries||$;if(ce&&(C=Ou(ce.call(new t)),Gg!==Object.prototype&&C.next&&(je(C,F,!0,!0),$s[F]=Hg)),n=="values"&&$&&$.name!=="values"&&(V=!0,te=function(){return $.call(this)}),h&&Y[Bu]!==te&&Kn(Y,Bu,te),$s[e]=te,n)if(x={values:i("values"),keys:c?te:i("keys"),entries:i("entries")},h)for(Q in x)!Nl&&!V&&Q in Y||In(Y,Q,x[Q]);else Qt({target:e,proto:!0,forced:Nl||V},x);return x},ah=fi("species"),ch=function(t){t=jn(t);var e=Hn.f;kr&&t&&!t[ah]&&e(t,ah,{configurable:!0,get:function(){return this}})},Kg=Hn.f,lh=$a.fastKey,uh=Zt.set,Pu=Zt.getterFor,dh=(ri("Map",function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},{getConstructor:function(t,e,r,i){var n=t(function(x,Q){we(x,n,e),uh(x,{type:e,index:ys(null),first:void 0,last:void 0,size:0}),kr||(x.size=0),Q!=null&&ke(Q,x[i],x,r)}),c=Pu(e),h=function(x,Q,F){var V,Y,$=c(x),te=C(x,Q);return te?te.value=F:($.last=te={index:Y=lh(Q,!0),key:Q,value:F,previous:V=$.last,next:void 0,removed:!1},$.first||($.first=te),V&&(V.next=te),kr?$.size++:x.size++,Y!=="F"&&($.index[Y]=te)),x},C=function(x,Q){x=c(x);var F=lh(Q);if(F!=="F")return x.index[F];for(x=x.first;x;x=x.next)if(x.key==Q)return x};return Ko(n.prototype,{clear:function(){for(var x=c(this),Q=x.index,F=x.first;F;)F.removed=!0,F.previous&&(F.previous=F.previous.next=void 0),delete Q[F.index],F=F.next;x.first=x.last=void 0,kr?x.size=0:this.size=0},delete:function(x){var Q=c(this);if(x=C(this,x)){var F=x.next,V=x.previous;delete Q.index[x.index],x.removed=!0,V&&(V.next=F),F&&(F.previous=V),Q.first==x&&(Q.first=F),Q.last==x&&(Q.last=V),kr?Q.size--:this.size--}return!!x},forEach:function(x){for(var Q,F=c(this),V=yn(x,1<arguments.length?arguments[1]:void 0,3);Q=Q?Q.next:F.first;)for(V(Q.value,Q.key,this);Q&&Q.removed;)Q=Q.previous},has:function(x){return!!C(this,x)}}),Ko(n.prototype,r?{get:function(x){return(x=C(this,x))&&x.value},set:function(x,Q){return h(this,x===0?0:x,Q)}}:{add:function(x){return h(this,x=x===0?0:x,x)}}),kr&&Kg(n.prototype,"size",{get:function(){return c(this).size}}),n},setStrong:function(t,e,r){var i=e+" Iterator",n=Pu(e),c=Pu(i);Nu(t,e,function(h,C){uh(this,{type:i,target:h,state:n(h),kind:C,last:void 0})},function(){for(var h=c(this),C=h.kind,x=h.last;x&&x.removed;)x=x.previous;return h.target&&(h.last=x=x?x.next:h.state.first)?C=="keys"?{value:x.key,done:!1}:C=="values"?{value:x.value,done:!1}:{value:[x.key,x.value],done:!1}:(h.target=void 0,{value:void 0,done:!0})},r?"entries":"values",!r,!0),ch(e)}}),function(t){return function(e,r){var i,n;e=String(Mo(e)),r=Qo(r);var c=e.length;return 0>r||r>=c?t?"":void 0:55296>(i=e.charCodeAt(r))||56319<i||r+1===c||56320>(n=e.charCodeAt(r+1))||57343<n?t?e.charAt(r):i:t?e.slice(r,r+2):n-56320+(i-55296<<10)+65536}}),jg=dh(!1),Wg=dh(!0),Vg=Zt.set,Yg=Zt.getterFor("String Iterator");Nu(String,"String",function(t){Vg(this,{type:"String Iterator",string:String(t),index:0})},function(){var t,e=Yg(this),r=e.string,i=e.index;return i>=r.length?{value:void 0,done:!0}:(t=Wg(r,i),e.index+=t.length,{value:t,done:!1})});var Jg=Zt.set,zg=Zt.getterFor("Array Iterator");Nu(Array,"Array",function(t,e){Jg(this,{type:"Array Iterator",target:Cn(t),index:0,kind:e})},function(){var t=zg(this),e=t.target,r=t.kind,i=t.index++;return!e||i>=e.length?(t.target=void 0,{value:void 0,done:!0}):r=="keys"?{value:i,done:!1}:r=="values"?{value:e[i],done:!1}:{value:[i,e[i]],done:!1}},"values"),$s.Arguments=$s.Array;var hh=fi("toStringTag"),Pl;for(Pl in{CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}){var fh=gt[Pl],xu=fh&&fh.prototype;xu&&!xu[hh]&&Kn(xu,hh,Pl),$s[Pl]=$s.Array}var Lr=Br.Map,qg=fi("match"),Mu=function(t){var e;if(zr(t)&&((e=t[qg])!==void 0?e:ns(t)=="RegExp"))throw TypeError("The method doesn't accept regular expressions");return t},Xg=fi("match"),ku=function(t){var e=/./;try{"/./"[t](e)}catch(r){try{return e[Xg]=!1,"/./"[t](e)}catch(i){}}return!1},Ah="".endsWith,Zg=Math.min,$g=ku("endsWith");Qt({target:"String",proto:!0,forced:!$g},{endsWith:function(t){var e=String(Mo(this));Mu(t);var r=1<arguments.length?arguments[1]:void 0,i=Vn(e.length);return r=r===void 0?i:Zg(Vn(r),i),i=String(t),Ah?Ah.call(e,i,r):e.slice(r-i.length,r)===i}});var ep=ai("String").endsWith,gh=String.prototype,ph=function(t){var e=t.endsWith;return typeof t=="string"||t===gh||t instanceof String&&e===gh.endsWith?ep:e},Oa=function(t,e){var r=[][t];return!r||!Jt(function(){r.call(null,e||function(){throw 1},1)})},vh=Oa("forEach")?function(t){return rt(this,t,1<arguments.length?arguments[1]:void 0)}:[].forEach;Qt({target:"Array",proto:!0,forced:[].forEach!=vh},{forEach:vh});var tp=ai("Array").forEach,mh=Array.prototype,rp={DOMTokenList:!0,NodeList:!0},Re=function(t){var e=t.forEach;return t===mh||t instanceof Array&&e===mh.forEach||rp.hasOwnProperty(de(t))?tp:e},Uc={f:Object.getOwnPropertySymbols},xl=Object.assign,Fc=!xl||Jt(function(){var t={},e={},r=Symbol();return t[r]=7,"abcdefghijklmnopqrst".split("").forEach(function(i){e[i]=i}),xl({},t)[r]!=7||Pr(xl({},e)).join("")!="abcdefghijklmnopqrst"})?function(t,e){for(var r=Wn(t),i=arguments.length,n=1,c=Uc.f,h=xo;i>n;)for(var C,x=la(arguments[n++]),Q=c?Pr(x).concat(c(x)):Pr(x),F=Q.length,V=0;F>V;)C=Q[V++],kr&&!h.call(x,C)||(r[C]=x[C]);return r}:xl;Qt({target:"Object",stat:!0,forced:Object.assign!==Fc},{assign:Fc});var Sn=Br.Object.assign,ip=Jt(function(){Pr(1)});Qt({target:"Object",stat:!0,forced:ip},{keys:function(t){return Pr(Wn(t))}});var Er=Br.Object.keys,Eh=function(t){return function(e,r,i,n){ss(r),e=Wn(e);var c=la(e),h=Vn(e.length),C=t?h-1:0,x=t?-1:1;if(2>i)for(;;){if(C in c){n=c[C],C+=x;break}if(C+=x,t?0>C:h<=C)throw TypeError("Reduce of empty array with no initial value")}for(;t?0<=C:h>C;C+=x)C in c&&(n=r(n,c[C],C,e));return n}},np={left:Eh(!1),right:Eh(!0)}.left;Qt({target:"Array",proto:!0,forced:Oa("reduce")},{reduce:function(t){return np(this,t,arguments.length,1<arguments.length?arguments[1]:void 0)}});var sp=ai("Array").reduce,_h=Array.prototype,Ml=function(t){var e=t.reduce;return t===_h||t instanceof Array&&e===_h.reduce?sp:e};Qt({target:"Object",stat:!0,forced:!kr,sham:!kr},{defineProperty:Hn.f});var Ch=k(function(t){var e=Br.Object;t=t.exports=function(r,i,n){return e.defineProperty(r,i,n)},e.defineProperty.sham&&(t.sham=!0)}),_r=Ch,op=/^[\t\n\x0B\f\r \u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\ufeff][\t\n\x0B\f\r \u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\ufeff]*/,ap=/[\t\n\x0B\f\r \u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\ufeff][\t\n\x0B\f\r \u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\ufeff]*$/,Uu=function(t){return function(e){return e=String(Mo(e)),1&t&&(e=e.replace(op,"")),2&t&&(e=e.replace(ap,"")),e}};Uu(1),Uu(2);var yh=Uu(3),kl=gt.parseInt,cp=/^[+-]?0[Xx]/,Ih=kl(`
57
- \v\f\r \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF08`)!==8||kl(`
58
- \v\f\r \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF0x16`)!==22?function(t,e){return t=yh(String(t)),kl(t,e>>>0||(cp.test(t)?16:10))}:kl;Qt({global:!0,forced:parseInt!=Ih},{parseInt:Ih});var Ii=Br.parseInt;let Sh=!0,Th=!0;var Rh=ko,lp=Jt(function(){Rh(1)});Qt({target:"Object",stat:!0,forced:!kr||lp,sham:!kr},{getOwnPropertyDescriptor:function(t,e){return Rh(Cn(t),e)}});var gr=k(function(t){var e=Br.Object;t=t.exports=function(r,i){return e.getOwnPropertyDescriptor(r,i)},e.getOwnPropertyDescriptor.sham&&(t.sham=!0)});Qt({target:"Array",proto:!0,forced:!Da("filter")},{filter:function(t){return Ke(this,t,1<arguments.length?arguments[1]:void 0)}});var up=ai("Array").filter,wh=Array.prototype,Gt=function(t){var e=t.filter;return t===wh||t instanceof Array&&e===wh.filter?up:e},dp=gt.Promise,Lh=fi("iterator"),Dh=!1;try{var hp=0,bh={next:function(){return{done:!!hp++}},return:function(){Dh=!0}};bh[Lh]=function(){return this},Array.from(bh,function(){throw 2})}catch(t){}var ec,Oh,Fu,Bh=function(t,e){if(!e&&!Dh)return!1;var r=!1;try{e={},e[Lh]=function(){return{next:function(){return{done:r=!0}}}},t(e)}catch(i){}return r},fp=fi("species"),Nh=function(t,e){var r;return t=Hi(t).constructor,t===void 0||(r=Hi(t)[fp])==null?e:ss(r)},Ph=/(iphone|ipod|ipad).*applewebkit/i.test(fa),xh=gt.location,Qu=gt.setImmediate,Mh=gt.clearImmediate,kh=gt.process,Uh=gt.MessageChannel,Gu=gt.Dispatch,Hu=0,Qc={},Ku=function(t){if(Qc.hasOwnProperty(t)){var e=Qc[t];delete Qc[t],e()}},ju=function(t){return function(){Ku(t)}},Fh=function(t){Ku(t.data)},Qh=function(t){gt.postMessage(t+"",xh.protocol+"//"+xh.host)};Qu&&Mh||(Qu=function(t){for(var e=[],r=1;arguments.length>r;)e.push(arguments[r++]);return Qc[++Hu]=function(){(typeof t=="function"?t:Function(t)).apply(void 0,e)},ec(Hu),Hu},Mh=function(t){delete Qc[t]},ns(kh)=="process"?ec=function(t){kh.nextTick(ju(t))}:Gu&&Gu.now?ec=function(t){Gu.now(ju(t))}:Uh&&!Ph?(Fu=(Oh=new Uh).port2,Oh.port1.onmessage=Fh,ec=yn(Fu.postMessage,Fu,1)):!gt.addEventListener||typeof postMessage!="function"||gt.importScripts||Jt(Qh)?ec="onreadystatechange"in(Ja?da.createElement("script"):{})?function(t){ii.appendChild(Ja?da.createElement("script"):{}).onreadystatechange=function(){ii.removeChild(this),Ku(t)}}:function(t){setTimeout(ju(t),0)}:(ec=Qh,gt.addEventListener("message",Fh,!1)));var Gc,Ba,Hc,tc,Wu,Vu,Yu,Gh,Ju=Qu,Ap=ko,Hh=gt.MutationObserver||gt.WebKitMutationObserver,zu=gt.process,qu=gt.Promise,Kh=ns(zu)=="process",jh=Ap(gt,"queueMicrotask"),Wh=jh&&jh.value;Wh||(Gc=function(){var t;for(Kh&&(t=zu.domain)&&t.exit();Ba;){var e=Ba.fn;Ba=Ba.next;try{e()}catch(r){throw Ba?tc():Hc=void 0,r}}Hc=void 0,t&&t.enter()},Kh?tc=function(){zu.nextTick(Gc)}:Hh&&!Ph?(Wu=!0,Vu=document.createTextNode(""),new Hh(Gc).observe(Vu,{characterData:!0}),tc=function(){Vu.data=Wu=!Wu}):qu&&qu.resolve?(Yu=qu.resolve(void 0),Gh=Yu.then,tc=function(){Gh.call(Yu,Gc)}):tc=function(){Ju.call(gt,Gc)});var Xu,Vh,Yh=Wh||function(t){t={fn:t,next:void 0},Hc&&(Hc.next=t),Ba||(Ba=t,tc()),Hc=t},gp=function(t){var e,r;this.promise=new t(function(i,n){if(e!==void 0||r!==void 0)throw TypeError("Bad Promise constructor");e=i,r=n}),this.resolve=ss(e),this.reject=ss(r)},Ul={f:function(t){return new gp(t)}},Zu=function(t,e){return Hi(t),zr(e)&&e.constructor===t?e:(t=Ul.f(t),(0,t.resolve)(e),t.promise)},Fl=function(t){try{return{error:!1,value:t()}}catch(e){return{error:!0,value:e}}},pp=fi("species"),Jh=Zt.get,vp=Zt.set,mp=Zt.getterFor("Promise"),os=dp,zh=gt.TypeError,$u=gt.document,Ql=gt.process,Ep=Xi("inspectSource"),rc=(jn("fetch"),Ul.f),_p=rc,Kc=ns(Ql)=="process",Cp=!!($u&&$u.createEvent&&gt.dispatchEvent),Gl=Uo("Promise",function(){if(Ep(os)===String(os)&&(Aa===66||!Kc&&typeof PromiseRejectionEvent!="function")||!os.prototype.finally)return!0;if(51<=Aa&&/native code/.test(os))return!1;var t=os.resolve(1),e=function(r){r(function(){},function(){})};return(t.constructor={})[pp]=e,!(t.then(function(){})instanceof e)}),yp=Gl||!Bh(function(t){os.all(t).catch(function(){})}),qh=function(t){var e;return!(!zr(t)||typeof(e=t.then)!="function")&&e},ed=function(t,e,r){if(!e.notified){e.notified=!0;var i=e.reactions;Yh(function(){for(var n=e.value,c=e.state==1,h=0;i.length>h;){var C,x,Q,F=i[h++],V=c?F.ok:F.fail,Y=F.resolve,$=F.reject,te=F.domain;try{V?(c||(e.rejection===2&&Sp(t,e),e.rejection=1),V===!0?C=n:(te&&te.enter(),C=V(n),te&&(te.exit(),Q=!0)),C===F.promise?$(zh("Promise-chain cycle")):(x=qh(C))?x.call(C,Y,$):Y(C)):$(n)}catch(ce){te&&!Q&&te.exit(),$(ce)}}e.reactions=[],e.notified=!1,r&&!e.rejection&&Ip(t,e)})}},Xh=function(t,e,r){var i,n;Cp?((i=$u.createEvent("Event")).promise=e,i.reason=r,i.initEvent(t,!1,!0),gt.dispatchEvent(i)):i={promise:e,reason:r},(n=gt["on"+t])?n(i):t==="unhandledrejection"&&function(c,h){var C=gt.console;C&&C.error&&(arguments.length===1?C.error(c):C.error(c,h))}("Unhandled promise rejection",r)},Ip=function(t,e){Ju.call(gt,function(){var r,i=e.value;if(e.rejection!==1&&!e.parent&&(r=Fl(function(){Kc?Ql.emit("unhandledRejection",i,t):Xh("unhandledrejection",t,i)}),e.rejection=Kc||e.rejection!==1&&!e.parent?2:1,r.error))throw r.value})},Sp=function(t,e){Ju.call(gt,function(){Kc?Ql.emit("rejectionHandled",t):Xh("rejectionhandled",t,e.value)})},ic=function(t,e,r,i){return function(n){t(e,r,n,i)}},nc=function(t,e,r,i){e.done||(e.done=!0,i&&(e=i),e.value=r,e.state=2,ed(t,e,!0))},td=function(t,e,r,i){if(!e.done){e.done=!0,i&&(e=i);try{if(t===r)throw zh("Promise can't be resolved itself");var n=qh(r);n?Yh(function(){var c={done:!1};try{n.call(r,ic(td,t,c,e),ic(nc,t,c,e))}catch(h){nc(t,c,h,e)}}):(e.value=r,e.state=1,ed(t,e,!1))}catch(c){nc(t,{done:!1},c,e)}}};Gl&&(os=function(t){we(this,os,"Promise"),ss(t),Xu.call(this);var e=Jh(this);try{t(ic(td,this,e),ic(nc,this,e))}catch(r){nc(this,e,r)}},(Xu=function(t){vp(this,{type:"Promise",done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=Ko(os.prototype,{then:function(t,e){var r=mp(this),i=rc(Nh(this,os));return i.ok=typeof t!="function"||t,i.fail=typeof e=="function"&&e,i.domain=Kc?Ql.domain:void 0,r.parent=!0,r.reactions.push(i),r.state!=0&&ed(this,r,!1),i.promise},catch:function(t){return this.then(void 0,t)}}),Vh=function(){var t=new Xu,e=Jh(t);this.promise=t,this.resolve=ic(td,t,e),this.reject=ic(nc,t,e)},Ul.f=rc=function(t){return t===os||t===Zh?new Vh(t):_p(t)}),Qt({global:!0,wrap:!0,forced:Gl},{Promise:os}),je(os,"Promise",!1,!0),ch("Promise");var Zh=jn("Promise");Qt({target:"Promise",stat:!0,forced:Gl},{reject:function(t){var e=rc(this);return e.reject.call(void 0,t),e.promise}}),Qt({target:"Promise",stat:!0,forced:!0},{resolve:function(t){return Zu(this===Zh?os:this,t)}}),Qt({target:"Promise",stat:!0,forced:yp},{all:function(t){var e=this,r=rc(e),i=r.resolve,n=r.reject,c=Fl(function(){var h=ss(e.resolve),C=[],x=0,Q=1;ke(t,function(F){var V=x++,Y=!1;C.push(void 0),Q++,h.call(e,F).then(function($){Y||(Y=!0,C[V]=$,--Q||i(C))},n)}),--Q||i(C)});return c.error&&n(c.value),r.promise},race:function(t){var e=this,r=rc(e),i=r.reject,n=Fl(function(){var c=ss(e.resolve);ke(t,function(h){c.call(e,h).then(r.resolve,i)})});return n.error&&i(n.value),r.promise}}),Qt({target:"Promise",stat:!0},{allSettled:function(t){var e=this,r=Ul.f(e),i=r.resolve,n=r.reject,c=Fl(function(){var h=ss(e.resolve),C=[],x=0,Q=1;ke(t,function(F){var V=x++,Y=!1;C.push(void 0),Q++,h.call(e,F).then(function($){Y||(Y=!0,C[V]={status:"fulfilled",value:$},--Q||i(C))},function($){Y||(Y=!0,C[V]={status:"rejected",reason:$},--Q||i(C))})}),--Q||i(C)});return c.error&&n(c.value),r.promise}}),Qt({target:"Promise",proto:!0,real:!0},{finally:function(t){var e=Nh(this,jn("Promise")),r=typeof t=="function";return this.then(r?function(i){return Zu(e,t()).then(function(){return i})}:t,r?function(i){return Zu(e,t()).then(function(){throw i})}:t)}});var it=Br.Promise;Qt({target:"Array",proto:!0,forced:!Da("map")},{map:function(t){return We(this,t,1<arguments.length?arguments[1]:void 0)}});var Tp=ai("Array").map,$h=Array.prototype,yt=function(t){var e=t.map;return t===$h||t instanceof Array&&e===$h.map?Tp:e},Rp=Math.max,wp=Math.min;Qt({target:"Array",proto:!0,forced:!Da("splice")},{splice:function(t,e){var r,i,n,c,h=Wn(this),C=Vn(h.length),x=Li(t,C),Q=arguments.length;if(Q===0?r=i=0:Q===1?(r=0,i=C-x):(r=Q-2,i=wp(Rp(Qo(e),0),C-x)),9007199254740991<C+r-i)throw TypeError("Maximum allowed length exceeded");for(Q=Mc(h,i),n=0;n<i;n++)(c=x+n)in h&&Go(Q,n,h[c]);if(Q.length=i,r<i){for(n=x;n<C-i;n++){var F=n+r;(c=n+i)in h?h[F]=h[c]:delete h[F]}for(n=C;n>C-i+r;n--)delete h[n-1]}else if(r>i)for(n=C-i;n>x;n--)F=n+r-1,(c=n+i-1)in h?h[F]=h[c]:delete h[F];for(n=0;n<r;n++)h[n+x]=arguments[n+2];return h.length=C-i+r,Q}});var Lp=ai("Array").splice,ef=Array.prototype,un=function(t){var e=t.splice;return t===ef||t instanceof Array&&e===ef.splice?Lp:e},tf=[].indexOf,rf=!!tf&&0>1/[1].indexOf(1,-0),Dp=Oa("indexOf");Qt({target:"Array",proto:!0,forced:rf||Dp},{indexOf:function(t){return rf?tf.apply(this,arguments)||0:Jn(this,t,1<arguments.length?arguments[1]:void 0)}});var bp=ai("Array").indexOf,nf=Array.prototype,Wt=function(t){var e=t.indexOf;return t===nf||t instanceof Array&&e===nf.indexOf?bp:e},Op=fi("species"),Bp=[].slice,Np=Math.max;Qt({target:"Array",proto:!0,forced:!Da("slice")},{slice:function(t,e){var r,i=Cn(this),n=Vn(i.length);if(t=Li(t,n),e=Li(e===void 0?n:e,n),Zs(i)&&(typeof(r=i.constructor)!="function"||r!==Array&&!Zs(r.prototype)?zr(r)&&(r=r[Op])===null&&(r=void 0):r=void 0,r===Array||r===void 0))return Bp.call(i,t,e);for(r=new(r===void 0?Array:r)(Np(e-t,0)),n=0;t<e;t++,n++)t in i&&Go(r,n,i[t]);return r.length=n,r}});var Pp=ai("Array").slice,sf=Array.prototype,$i=function(t){var e=t.slice;return t===sf||t instanceof Array&&e===sf.slice?Pp:e},of=!0;"find"in[]&&Array(1).find(function(){of=!1}),Qt({target:"Array",proto:!0,forced:of},{find:function(t){return Ct(this,t,1<arguments.length?arguments[1]:void 0)}});var xp=ai("Array").find,af=Array.prototype,tr=function(t){var e=t.find;return t===af||t instanceof Array&&e===af.find?xp:e},cf=[].slice,rd={};Qt({target:"Function",proto:!0},{bind:Function.bind||function(t){var e=ss(this),r=cf.call(arguments,1),i=function(){var n=r.concat(cf.call(arguments));if(this instanceof i){var c=n.length;if(!(c in rd)){for(var h=[],C=0;C<c;C++)h[C]="a["+C+"]";rd[c]=Function("C,a","return new C("+h.join(",")+")")}n=rd[c](e,n)}else n=e.apply(t,n);return n};return zr(e.prototype)&&(i.prototype=e.prototype),i}});var Mp=ai("Function").bind,lf=Function.prototype,Si=function(t){var e=t.bind;return t===lf||t instanceof Function&&e===lf.bind?Mp:e};Qt({target:"Array",proto:!0},{includes:function(t){return Yn(this,t,1<arguments.length?arguments[1]:void 0)}});var kp=ai("Array").includes;Qt({target:"String",proto:!0,forced:!ku("includes")},{includes:function(t){return!!~String(Mo(this)).indexOf(Mu(t),1<arguments.length?arguments[1]:void 0)}});var Up=ai("String").includes,uf=Array.prototype,df=String.prototype,Ir=function(t){var e=t.includes;return t===uf||t instanceof Array&&e===uf.includes?kp:typeof t=="string"||t===df||t instanceof String&&e===df.includes?Up:e};Qt({target:"Array",proto:!0,forced:Oa("some")},{some:function(t){return st(this,t,1<arguments.length?arguments[1]:void 0)}});var Fp=ai("Array").some,hf=Array.prototype,ff=function(t){var e=t.some;return t===hf||t instanceof Array&&e===hf.some?Fp:e};let Af=O;var gf=Object.freeze({__proto__:null,shimMediaStream:f,shimOnTrack:p,shimGetSendersWithDtmf:_,shimGetStats:d,shimSenderReceiverGetStats:o,shimAddTrackRemoveTrackWithNative:s,shimAddTrackRemoveTrack:a,shimPeerConnection:u,fixNegotiationNeeded:l,shimGetUserMedia:T,shimGetDisplayMedia:function(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(typeof e=="function"?t.navigator.mediaDevices.getDisplayMedia=function(r){return e(r).then(i=>{let n=r.video&&r.video.width,c=r.video&&r.video.height;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:i,maxFrameRate:r.video&&r.video.frameRate||3}},n&&(r.video.mandatory.maxWidth=n),c&&(r.video.mandatory.maxHeight=c),t.navigator.mediaDevices.getUserMedia(r)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}),pf="".startsWith,Qp=Math.min,Gp=ku("startsWith");Qt({target:"String",proto:!0,forced:!Gp},{startsWith:function(t){var e=String(Mo(this));Mu(t);var r=Vn(Qp(1<arguments.length?arguments[1]:void 0,e.length)),i=String(t);return pf?pf.call(e,i,r):e.slice(r,r+i.length)===i}});var Hp=ai("String").startsWith,vf=String.prototype,jc=function(t){var e=t.startsWith;return typeof t=="string"||t===vf||t instanceof String&&e===vf.startsWith?Hp:e};Qt({target:"String",proto:!0,forced:Jt(function(){return`
59
- \v\f\r \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF`.trim.name!=="trim"})},{trim:function(){return yh(this)}});var Kp=ai("String").trim,mf=String.prototype,Na=function(t){var e=t.trim;return typeof t=="string"||t===mf||t instanceof String&&e===mf.trim?Kp:e},Kt=k(function(t){var e={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};e.localCName=e.generateIdentifier(),e.splitLines=function(r){var i;return yt(i=Na(r).call(r).split(`
60
- `)).call(i,function(n){return Na(n).call(n)})},e.splitSections=function(r){return r=r.split(`
61
- m=`),yt(r).call(r,function(i,n){var c;return Na(c=0<n?"m="+i:i).call(c)+`\r
62
- `})},e.getDescription=function(r){return(r=e.splitSections(r))&&r[0]},e.getMediaSections=function(r){return r=e.splitSections(r),r.shift(),r},e.matchPrefix=function(r,i){var n;return Gt(n=e.splitLines(r)).call(n,function(c){return Wt(c).call(c,i)===0})},e.parseCandidate=function(r){var i;r={foundation:(i=Wt(r).call(r,"a=candidate:")===0?r.substring(12).split(" "):r.substring(10).split(" "))[0],component:Ii(i[1],10),protocol:i[2].toLowerCase(),priority:Ii(i[3],10),ip:i[4],address:i[4],port:Ii(i[5],10),type:i[7]};for(var n=8;n<i.length;n+=2)switch(i[n]){case"raddr":r.relatedAddress=i[n+1];break;case"rport":r.relatedPort=Ii(i[n+1],10);break;case"tcptype":r.tcpType=i[n+1];break;case"ufrag":r.ufrag=i[n+1],r.usernameFragment=i[n+1];break;default:r[i[n]]=i[n+1]}return r},e.writeCandidate=function(r){var i=[];i.push(r.foundation),i.push(r.component),i.push(r.protocol.toUpperCase()),i.push(r.priority),i.push(r.address||r.ip),i.push(r.port);var n=r.type;return i.push("typ"),i.push(n),n!=="host"&&r.relatedAddress&&r.relatedPort&&(i.push("raddr"),i.push(r.relatedAddress),i.push("rport"),i.push(r.relatedPort)),r.tcpType&&r.protocol.toLowerCase()==="tcp"&&(i.push("tcptype"),i.push(r.tcpType)),(r.usernameFragment||r.ufrag)&&(i.push("ufrag"),i.push(r.usernameFragment||r.ufrag)),"candidate:"+i.join(" ")},e.parseIceOptions=function(r){return r.substr(14).split(" ")},e.parseRtpMap=function(r){r=r.substr(9).split(" ");var i={payloadType:Ii(r.shift(),10)};return r=r[0].split("/"),i.name=r[0],i.clockRate=Ii(r[1],10),i.channels=r.length===3?Ii(r[2],10):1,i.numChannels=i.channels,i},e.writeRtpMap=function(r){var i=r.payloadType;r.preferredPayloadType!==void 0&&(i=r.preferredPayloadType);var n=r.channels||r.numChannels||1;return"a=rtpmap:"+i+" "+r.name+"/"+r.clockRate+(n!==1?"/"+n:"")+`\r
63
- `},e.parseExtmap=function(r){var i;return r=r.substr(9).split(" "),{id:Ii(r[0],10),direction:0<Wt(i=r[0]).call(i,"/")?r[0].split("/")[1]:"sendrecv",uri:r[1]}},e.writeExtmap=function(r){return"a=extmap:"+(r.id||r.preferredId)+(r.direction&&r.direction!=="sendrecv"?"/"+r.direction:"")+" "+r.uri+`\r
64
- `},e.parseFmtp=function(r){for(var i={},n=r.substr(Wt(r).call(r," ")+1).split(";"),c=0;c<n.length;c++){var h,C;r=Na(h=n[c]).call(h).split("="),i[Na(C=r[0]).call(C)]=r[1]}return i},e.writeFmtp=function(r){var i="",n=r.payloadType;if(r.preferredPayloadType!==void 0&&(n=r.preferredPayloadType),r.parameters&&Er(r.parameters).length){var c,h=[];Re(c=Er(r.parameters)).call(c,function(C){r.parameters[C]?h.push(C+"="+r.parameters[C]):h.push(C)}),i+="a=fmtp:"+n+" "+h.join(";")+`\r
65
- `}return i},e.parseRtcpFb=function(r){return r=r.substr(Wt(r).call(r," ")+1).split(" "),{type:r.shift(),parameter:r.join(" ")}},e.writeRtcpFb=function(r){var i,n="",c=r.payloadType;return r.preferredPayloadType!==void 0&&(c=r.preferredPayloadType),r.rtcpFeedback&&r.rtcpFeedback.length&&Re(i=r.rtcpFeedback).call(i,function(h){n+="a=rtcp-fb:"+c+" "+h.type+(h.parameter&&h.parameter.length?" "+h.parameter:"")+`\r
66
- `}),n},e.parseSsrcMedia=function(r){var i=Wt(r).call(r," "),n={ssrc:Ii(r.substr(7,i-7),10)},c=Wt(r).call(r,":",i);return-1<c?(n.attribute=r.substr(i+1,c-i-1),n.value=r.substr(c+1)):n.attribute=r.substr(i+1),n},e.parseSsrcGroup=function(r){return r=r.substr(13).split(" "),{semantics:r.shift(),ssrcs:yt(r).call(r,function(i){return Ii(i,10)})}},e.getMid=function(r){if(r=e.matchPrefix(r,"a=mid:")[0])return r.substr(6)},e.parseFingerprint=function(r){return r=r.substr(14).split(" "),{algorithm:r[0].toLowerCase(),value:r[1]}},e.getDtlsParameters=function(r,i){return r=e.matchPrefix(r+i,"a=fingerprint:"),{role:"auto",fingerprints:yt(r).call(r,e.parseFingerprint)}},e.writeDtlsParameters=function(r,i){var n,c="a=setup:"+i+`\r
67
- `;return Re(n=r.fingerprints).call(n,function(h){c+="a=fingerprint:"+h.algorithm+" "+h.value+`\r
68
- `}),c},e.getIceParameters=function(r,i){return r=e.splitLines(r),r=ne(r).call(r,e.splitLines(i)),{usernameFragment:Gt(r).call(r,function(n){return Wt(n).call(n,"a=ice-ufrag:")===0})[0].substr(12),password:Gt(r).call(r,function(n){return Wt(n).call(n,"a=ice-pwd:")===0})[0].substr(10)}},e.writeIceParameters=function(r){return"a=ice-ufrag:"+r.usernameFragment+`\r
69
- a=ice-pwd:`+r.password+`\r
70
- `},e.parseRtpParameters=function(r){for(var i,n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},c=e.splitLines(r)[0].split(" "),h=3;h<c.length;h++){var C=c[h],x=e.matchPrefix(r,"a=rtpmap:"+C+" ")[0];if(x){var Q;x=e.parseRtpMap(x);var F=e.matchPrefix(r,"a=fmtp:"+C+" ");switch(x.parameters=F.length?e.parseFmtp(F[0]):{},x.rtcpFeedback=yt(Q=e.matchPrefix(r,"a=rtcp-fb:"+C+" ")).call(Q,e.parseRtcpFb),n.codecs.push(x),x.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(x.name.toUpperCase())}}}return Re(i=e.matchPrefix(r,"a=extmap:")).call(i,function(V){n.headerExtensions.push(e.parseExtmap(V))}),n},e.writeRtpDescription=function(r,i){var n,c,h,C="";C+="m="+r+" ",C+=0<i.codecs.length?"9":"0",C+=" UDP/TLS/RTP/SAVPF ",C+=yt(n=i.codecs).call(n,function(F){return F.preferredPayloadType!==void 0?F.preferredPayloadType:F.payloadType}).join(" ")+`\r
71
- `,C+=`c=IN IP4 0.0.0.0\r
72
- `,C+=`a=rtcp:9 IN IP4 0.0.0.0\r
73
- `,Re(c=i.codecs).call(c,function(F){C+=e.writeRtpMap(F),C+=e.writeFmtp(F),C+=e.writeRtcpFb(F)});var x,Q=0;return Re(h=i.codecs).call(h,function(F){F.maxptime>Q&&(Q=F.maxptime)}),0<Q&&(C+="a=maxptime:"+Q+`\r
74
- `),C+=`a=rtcp-mux\r
75
- `,i.headerExtensions&&Re(x=i.headerExtensions).call(x,function(F){C+=e.writeExtmap(F)}),C},e.parseRtpEncodingParameters=function(r){var i,n,c,h,C,x,Q,F=[],V=e.parseRtpParameters(r),Y=Wt(i=V.fecMechanisms).call(i,"RED")!==-1,$=Wt(n=V.fecMechanisms).call(n,"ULPFEC")!==-1;i=Gt(c=yt(h=e.matchPrefix(r,"a=ssrc:")).call(h,function(et){return e.parseSsrcMedia(et)})).call(c,function(et){return et.attribute==="cname"});var te=0<i.length&&i[0].ssrc;c=yt(C=e.matchPrefix(r,"a=ssrc-group:FID")).call(C,function(et){return et=et.substr(17).split(" "),yt(et).call(et,function(vt){return Ii(vt,10)})}),0<c.length&&1<c[0].length&&c[0][0]===te&&(Q=c[0][1]),Re(x=V.codecs).call(x,function(et){et.name.toUpperCase()==="RTX"&&et.parameters.apt&&(et={ssrc:te,codecPayloadType:Ii(et.parameters.apt,10)},te&&Q&&(et.rtx={ssrc:Q}),F.push(et),Y&&((et=JSON.parse(ht(et))).fec={ssrc:te,mechanism:$?"red+ulpfec":"red"},F.push(et)))}),F.length===0&&te&&F.push({ssrc:te});var ce,Ae,Me=e.matchPrefix(r,"b=");return Me.length&&(Me=Wt(ce=Me[0]).call(ce,"b=TIAS:")===0?Ii(Me[0].substr(7),10):Wt(Ae=Me[0]).call(Ae,"b=AS:")===0?950*Ii(Me[0].substr(5),10)-16e3:void 0,Re(F).call(F,function(et){et.maxBitrate=Me})),F},e.parseRtcpParameters=function(r){var i,n,c={},h=Gt(i=yt(n=e.matchPrefix(r,"a=ssrc:")).call(n,function(C){return e.parseSsrcMedia(C)})).call(i,function(C){return C.attribute==="cname"})[0];return h&&(c.cname=h.value,c.ssrc=h.ssrc),i=e.matchPrefix(r,"a=rtcp-rsize"),c.reducedSize=0<i.length,c.compound=i.length===0,r=e.matchPrefix(r,"a=rtcp-mux"),c.mux=0<r.length,c},e.parseMsid=function(r){var i,n,c,h=e.matchPrefix(r,"a=msid:");return h.length===1?{stream:(c=h[0].substr(7).split(" "))[0],track:c[1]}:(r=Gt(i=yt(n=e.matchPrefix(r,"a=ssrc:")).call(n,function(C){return e.parseSsrcMedia(C)})).call(i,function(C){return C.attribute==="msid"}),0<r.length?{stream:(c=r[0].value.split(" "))[0],track:c[1]}:void 0)},e.generateSessionId=function(){return Math.random().toString().substr(2,21)},e.writeSessionBoilerplate=function(r,i,n){return i=i!==void 0?i:2,`v=0\r
76
- o=`+(n||"thisisadapterortc")+" "+(r||e.generateSessionId())+" "+i+` IN IP4 127.0.0.1\r
77
- s=-\r
78
- t=0 0\r
79
- `},e.writeMediaSection=function(r,i,n,c){return i=e.writeRtpDescription(r.kind,i),i+=e.writeIceParameters(r.iceGatherer.getLocalParameters()),i+=e.writeDtlsParameters(r.dtlsTransport.getLocalParameters(),n==="offer"?"actpass":"active"),i+="a=mid:"+r.mid+`\r
80
- `,r.direction?i+="a="+r.direction+`\r
81
- `:r.rtpSender&&r.rtpReceiver?i+=`a=sendrecv\r
82
- `:r.rtpSender?i+=`a=sendonly\r
83
- `:r.rtpReceiver?i+=`a=recvonly\r
84
- `:i+=`a=inactive\r
85
- `,r.rtpSender&&(n="msid:"+c.id+" "+r.rtpSender.track.id+`\r
86
- `,i=i+("a="+n)+("a=ssrc:"+r.sendEncodingParameters[0].ssrc+" "+n),r.sendEncodingParameters[0].rtx&&(i+="a=ssrc:"+r.sendEncodingParameters[0].rtx.ssrc+" "+n,i+="a=ssrc-group:FID "+r.sendEncodingParameters[0].ssrc+" "+r.sendEncodingParameters[0].rtx.ssrc+`\r
87
- `)),i+="a=ssrc:"+r.sendEncodingParameters[0].ssrc+" cname:"+e.localCName+`\r
88
- `,r.rtpSender&&r.sendEncodingParameters[0].rtx&&(i+="a=ssrc:"+r.sendEncodingParameters[0].rtx.ssrc+" cname:"+e.localCName+`\r
89
- `),i},e.getDirection=function(r,i){r=e.splitLines(r);for(var n=0;n<r.length;n++)switch(r[n]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[n].substr(2)}return i?e.getDirection(i):"sendrecv"},e.getKind=function(r){return e.splitLines(r)[0].split(" ")[0].substr(2)},e.isRejected=function(r){return r.split(" ",2)[1]==="0"},e.parseMLine=function(r){return r=e.splitLines(r)[0].substr(2).split(" "),{kind:r[0],port:Ii(r[1],10),protocol:r[2],fmt:$i(r).call(r,3).join(" ")}},e.parseOLine=function(r){return r=e.matchPrefix(r,"o=")[0].substr(2).split(" "),{username:r[0],sessionId:r[1],sessionVersion:Ii(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},e.isValidSDP=function(r){if(typeof r!="string"||r.length===0)return!1;r=e.splitLines(r);for(var i=0;i<r.length;i++)if(2>r[i].length||r[i].charAt(1)!=="=")return!1;return!0},t.exports=e}),jp=function(t,e){function r(h,C){C.addTrack(h),C.dispatchEvent(new t.MediaStreamTrackEvent("addtrack",{track:h}))}function i(h,C,x,Q){var F=new Event("track");F.track=C,F.receiver=x,F.transceiver={receiver:x},F.streams=Q,t.setTimeout(function(){h._dispatchEvent("track",F)})}var n=function(h){var C=this,x=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach(function(F){C[F]=x[F].bind(x)}),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",h=JSON.parse(JSON.stringify(h||{})),this.usingBundle=h.bundlePolicy==="max-bundle",h.rtcpMuxPolicy==="negotiate")throw v("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(h.rtcpMuxPolicy||(h.rtcpMuxPolicy="require"),h.iceTransportPolicy){case"all":case"relay":break;default:h.iceTransportPolicy="all"}switch(h.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:h.bundlePolicy="balanced"}if(h.iceServers=function(F,V){var Y=!1;return(F=JSON.parse(JSON.stringify(F))).filter(function($){if($&&($.urls||$.url)){var te=$.urls||$.url;$.url&&!$.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var ce=typeof te=="string";return ce&&(te=[te]),te=te.filter(function(Ae){return Ae.indexOf("turn:")!==0||Ae.indexOf("transport=udp")===-1||Ae.indexOf("turn:[")!==-1||Y?Ae.indexOf("stun:")===0&&14393<=V&&Ae.indexOf("?transport=udp")===-1:(Y=!0,!0)}),delete $.url,$.urls=ce?te[0]:te,!!te.length}})}(h.iceServers||[],e),this._iceGatherers=[],h.iceCandidatePoolSize)for(var Q=h.iceCandidatePoolSize;0<Q;Q--)this._iceGatherers.push(new t.RTCIceGatherer({iceServers:h.iceServers,gatherPolicy:h.iceTransportPolicy}));else h.iceCandidatePoolSize=0;this._config=h,this.transceivers=[],this._sdpSessionId=Kt.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(n.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(n.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),n.prototype.onicecandidate=null,n.prototype.onaddstream=null,n.prototype.ontrack=null,n.prototype.onremovestream=null,n.prototype.onsignalingstatechange=null,n.prototype.oniceconnectionstatechange=null,n.prototype.onconnectionstatechange=null,n.prototype.onicegatheringstatechange=null,n.prototype.onnegotiationneeded=null,n.prototype.ondatachannel=null,n.prototype._dispatchEvent=function(h,C){this._isClosed||(this.dispatchEvent(C),typeof this["on"+h]=="function"&&this["on"+h](C))},n.prototype._emitGatheringStateChange=function(){var h=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",h)},n.prototype.getConfiguration=function(){return this._config},n.prototype.getLocalStreams=function(){return this.localStreams},n.prototype.getRemoteStreams=function(){return this.remoteStreams},n.prototype._createTransceiver=function(h,C){var x=0<this.transceivers.length;return h={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:h,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0},this.usingBundle&&x?(h.iceTransport=this.transceivers[0].iceTransport,h.dtlsTransport=this.transceivers[0].dtlsTransport):(x=this._createIceAndDtlsTransports(),h.iceTransport=x.iceTransport,h.dtlsTransport=x.dtlsTransport),C||this.transceivers.push(h),h},n.prototype.addTrack=function(h,C){if(this._isClosed)throw v("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var x;if(this.transceivers.find(function(F){return F.track===h}))throw v("InvalidAccessError","Track already exists.");for(var Q=0;Q<this.transceivers.length;Q++)this.transceivers[Q].track||this.transceivers[Q].kind!==h.kind||(x=this.transceivers[Q]);return x||(x=this._createTransceiver(h.kind)),this._maybeFireNegotiationNeeded(),this.localStreams.indexOf(C)===-1&&this.localStreams.push(C),x.track=h,x.stream=C,x.rtpSender=new t.RTCRtpSender(h,x.dtlsTransport),x.rtpSender},n.prototype.addStream=function(h){var C=this;if(15025<=e)h.getTracks().forEach(function(Q){C.addTrack(Q,h)});else{var x=h.clone();h.getTracks().forEach(function(Q,F){var V=x.getTracks()[F];Q.addEventListener("enabled",function(Y){V.enabled=Y.enabled})}),x.getTracks().forEach(function(Q){C.addTrack(Q,x)})}},n.prototype.removeTrack=function(h){if(this._isClosed)throw v("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(h instanceof t.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var C=this.transceivers.find(function(Q){return Q.rtpSender===h});if(!C)throw v("InvalidAccessError","Sender was not created by this connection.");var x=C.stream;C.rtpSender.stop(),C.rtpSender=null,C.track=null,C.stream=null,this.transceivers.map(function(Q){return Q.stream}).indexOf(x)===-1&&-1<this.localStreams.indexOf(x)&&this.localStreams.splice(this.localStreams.indexOf(x),1),this._maybeFireNegotiationNeeded()},n.prototype.removeStream=function(h){var C=this;h.getTracks().forEach(function(x){var Q=C.getSenders().find(function(F){return F.track===x});Q&&C.removeTrack(Q)})},n.prototype.getSenders=function(){return this.transceivers.filter(function(h){return!!h.rtpSender}).map(function(h){return h.rtpSender})},n.prototype.getReceivers=function(){return this.transceivers.filter(function(h){return!!h.rtpReceiver}).map(function(h){return h.rtpReceiver})},n.prototype._createIceGatherer=function(h,C){var x=this;if(C&&0<h)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var Q=new t.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(Q,"state",{value:"new",writable:!0}),this.transceivers[h].bufferedCandidateEvents=[],this.transceivers[h].bufferCandidates=function(F){var V=!F.candidate||Object.keys(F.candidate).length===0;Q.state=V?"completed":"gathering",x.transceivers[h].bufferedCandidateEvents!==null&&x.transceivers[h].bufferedCandidateEvents.push(F)},Q.addEventListener("localcandidate",this.transceivers[h].bufferCandidates),Q},n.prototype._gather=function(h,C){var x=this,Q=this.transceivers[C].iceGatherer;if(!Q.onlocalcandidate){var F=this.transceivers[C].bufferedCandidateEvents;this.transceivers[C].bufferedCandidateEvents=null,Q.removeEventListener("localcandidate",this.transceivers[C].bufferCandidates),Q.onlocalcandidate=function(V){if(!(x.usingBundle&&0<C)){var Y=new Event("icecandidate");Y.candidate={sdpMid:h,sdpMLineIndex:C};var $=V.candidate;(V=!$||Object.keys($).length===0)?Q.state!=="new"&&Q.state!=="gathering"||(Q.state="completed"):(Q.state==="new"&&(Q.state="gathering"),$.component=1,$.ufrag=Q.getLocalParameters().usernameFragment,$=Kt.writeCandidate($),Y.candidate=Object.assign(Y.candidate,Kt.parseCandidate($)),Y.candidate.candidate=$,Y.candidate.toJSON=function(){return{candidate:Y.candidate.candidate,sdpMid:Y.candidate.sdpMid,sdpMLineIndex:Y.candidate.sdpMLineIndex,usernameFragment:Y.candidate.usernameFragment}}),$=Kt.getMediaSections(x._localDescription.sdp),$[Y.candidate.sdpMLineIndex]+=V?`a=end-of-candidates\r
90
- `:"a="+Y.candidate.candidate+`\r
91
- `,x._localDescription.sdp=Kt.getDescription(x._localDescription.sdp)+$.join(""),$=x.transceivers.every(function(te){return te.iceGatherer&&te.iceGatherer.state==="completed"}),x.iceGatheringState!=="gathering"&&(x.iceGatheringState="gathering",x._emitGatheringStateChange()),V||x._dispatchEvent("icecandidate",Y),$&&(x._dispatchEvent("icecandidate",new Event("icecandidate")),x.iceGatheringState="complete",x._emitGatheringStateChange())}},t.setTimeout(function(){F.forEach(function(V){Q.onlocalcandidate(V)})},0)}},n.prototype._createIceAndDtlsTransports=function(){var h=this,C=new t.RTCIceTransport(null);C.onicestatechange=function(){h._updateIceConnectionState(),h._updateConnectionState()};var x=new t.RTCDtlsTransport(C);return x.ondtlsstatechange=function(){h._updateConnectionState()},x.onerror=function(){Object.defineProperty(x,"state",{value:"failed",writable:!0}),h._updateConnectionState()},{iceTransport:C,dtlsTransport:x}},n.prototype._disposeIceAndDtlsTransports=function(h){var C=this.transceivers[h].iceGatherer;C&&(delete C.onlocalcandidate,delete this.transceivers[h].iceGatherer),(C=this.transceivers[h].iceTransport)&&(delete C.onicestatechange,delete this.transceivers[h].iceTransport),(C=this.transceivers[h].dtlsTransport)&&(delete C.ondtlsstatechange,delete C.onerror,delete this.transceivers[h].dtlsTransport)},n.prototype._transceive=function(h,C,x){var Q=I(h.localCapabilities,h.remoteCapabilities);C&&h.rtpSender&&(Q.encodings=h.sendEncodingParameters,Q.rtcp={cname:Kt.localCName,compound:h.rtcpParameters.compound},h.recvEncodingParameters.length&&(Q.rtcp.ssrc=h.recvEncodingParameters[0].ssrc),h.rtpSender.send(Q)),x&&h.rtpReceiver&&0<Q.codecs.length&&(h.kind==="video"&&h.recvEncodingParameters&&15019>e&&h.recvEncodingParameters.forEach(function(F){delete F.rtx}),h.recvEncodingParameters.length?Q.encodings=h.recvEncodingParameters:Q.encodings=[{}],Q.rtcp={compound:h.rtcpParameters.compound},h.rtcpParameters.cname&&(Q.rtcp.cname=h.rtcpParameters.cname),h.sendEncodingParameters.length&&(Q.rtcp.ssrc=h.sendEncodingParameters[0].ssrc),h.rtpReceiver.receive(Q))},n.prototype.setLocalDescription=function(h){var C=this;if(["offer","answer"].indexOf(h.type)===-1)return Promise.reject(v("TypeError",'Unsupported type "'+h.type+'"'));if(!R("setLocalDescription",h.type,C.signalingState)||C._isClosed)return Promise.reject(v("InvalidStateError","Can not set local "+h.type+" in state "+C.signalingState));if(h.type==="offer"){var x=Kt.splitSections(h.sdp),Q=x.shift();x.forEach(function(V,Y){V=Kt.parseRtpParameters(V),C.transceivers[Y].localCapabilities=V}),C.transceivers.forEach(function(V,Y){C._gather(V.mid,Y)})}else if(h.type==="answer"){x=Kt.splitSections(C._remoteDescription.sdp),Q=x.shift();var F=0<Kt.matchPrefix(Q,"a=ice-lite").length;x.forEach(function(V,Y){var $=C.transceivers[Y],te=$.iceGatherer,ce=$.iceTransport,Ae=$.dtlsTransport,Me=$.localCapabilities,et=$.remoteCapabilities;if(!(Kt.isRejected(V)&&Kt.matchPrefix(V,"a=bundle-only").length===0||$.rejected)){var vt=Kt.getIceParameters(V,Q);V=Kt.getDtlsParameters(V,Q),F&&(V.role="server"),C.usingBundle&&Y!==0||(C._gather($.mid,Y),ce.state==="new"&&ce.start(te,vt,F?"controlling":"controlled"),Ae.state==="new"&&Ae.start(V)),Y=I(Me,et),C._transceive($,0<Y.codecs.length,!1)}})}return C._localDescription={type:h.type,sdp:h.sdp},h.type==="offer"?C._updateSignalingState("have-local-offer"):C._updateSignalingState("stable"),Promise.resolve()},n.prototype.setRemoteDescription=function(h){var C=this;if(["offer","answer"].indexOf(h.type)===-1)return Promise.reject(v("TypeError",'Unsupported type "'+h.type+'"'));if(!R("setRemoteDescription",h.type,C.signalingState)||C._isClosed)return Promise.reject(v("InvalidStateError","Can not set remote "+h.type+" in state "+C.signalingState));var x={};C.remoteStreams.forEach(function(ce){x[ce.id]=ce});var Q=[],F=Kt.splitSections(h.sdp),V=F.shift(),Y=0<Kt.matchPrefix(V,"a=ice-lite").length,$=0<Kt.matchPrefix(V,"a=group:BUNDLE ").length;C.usingBundle=$;var te=Kt.matchPrefix(V,"a=ice-options:")[0];return C.canTrickleIceCandidates=!!te&&0<=te.substr(14).split(" ").indexOf("trickle"),F.forEach(function(ce,Ae){var Me=Kt.splitLines(ce),et=Kt.getKind(ce),vt=Kt.isRejected(ce)&&Kt.matchPrefix(ce,"a=bundle-only").length===0,kt=Me[0].substr(2).split(" ")[2];Me=Kt.getDirection(ce,V);var Pt=Kt.parseMsid(ce),Dr=Kt.getMid(ce)||Kt.generateIdentifier();if(vt||et==="application"&&(kt==="DTLS/SCTP"||kt==="UDP/DTLS/SCTP"))C.transceivers[Ae]={mid:Dr,kind:et,protocol:kt,rejected:!0};else{var Et,nr;!vt&&C.transceivers[Ae]&&C.transceivers[Ae].rejected&&(C.transceivers[Ae]=C._createTransceiver(et,!0));var Tr,ui,zi=Kt.parseRtpParameters(ce);vt||(Tr=Kt.getIceParameters(ce,V),(ui=Kt.getDtlsParameters(ce,V)).role="client"),kt=Kt.parseRtpEncodingParameters(ce);var Wr=Kt.parseRtcpParameters(ce),Rn=0<Kt.matchPrefix(ce,"a=end-of-candidates",V).length;if(ce=Kt.matchPrefix(ce,"a=candidate:").map(function(at){return Kt.parseCandidate(at)}).filter(function(at){return at.component===1}),(h.type==="offer"||h.type==="answer")&&!vt&&$&&0<Ae&&C.transceivers[Ae]&&(C._disposeIceAndDtlsTransports(Ae),C.transceivers[Ae].iceGatherer=C.transceivers[0].iceGatherer,C.transceivers[Ae].iceTransport=C.transceivers[0].iceTransport,C.transceivers[Ae].dtlsTransport=C.transceivers[0].dtlsTransport,C.transceivers[Ae].rtpSender&&C.transceivers[Ae].rtpSender.setTransport(C.transceivers[0].dtlsTransport),C.transceivers[Ae].rtpReceiver&&C.transceivers[Ae].rtpReceiver.setTransport(C.transceivers[0].dtlsTransport)),h.type!=="offer"||vt){if(h.type==="answer"&&!vt){et=(Et=C.transceivers[Ae]).iceGatherer;var Ce=Et.iceTransport,Ne=Et.dtlsTransport,Je=Et.rtpReceiver;vt=Et.sendEncodingParameters,Dr=Et.localCapabilities,C.transceivers[Ae].recvEncodingParameters=kt,C.transceivers[Ae].remoteCapabilities=zi,C.transceivers[Ae].rtcpParameters=Wr,ce.length&&Ce.state==="new"&&(!Y&&!Rn||$&&Ae!==0?ce.forEach(function(at){y(Et.iceTransport,at)}):Ce.setRemoteCandidates(ce)),$&&Ae!==0||(Ce.state==="new"&&Ce.start(et,Tr,"controlling"),Ne.state==="new"&&Ne.start(ui)),!I(Et.localCapabilities,Et.remoteCapabilities).codecs.filter(function(at){return at.name.toLowerCase()==="rtx"}).length&&Et.sendEncodingParameters[0].rtx&&delete Et.sendEncodingParameters[0].rtx,C._transceive(Et,Me==="sendrecv"||Me==="recvonly",Me==="sendrecv"||Me==="sendonly"),!Je||Me!=="sendrecv"&&Me!=="sendonly"?delete Et.rtpReceiver:(nr=Je.track,Pt?(x[Pt.stream]||(x[Pt.stream]=new t.MediaStream),r(nr,x[Pt.stream]),Q.push([nr,Je,x[Pt.stream]])):(x.default||(x.default=new t.MediaStream),r(nr,x.default),Q.push([nr,Je,x.default])))}}else(Et=C.transceivers[Ae]||C._createTransceiver(et)).mid=Dr,Et.iceGatherer||(Et.iceGatherer=C._createIceGatherer(Ae,$)),ce.length&&Et.iceTransport.state==="new"&&(!Rn||$&&Ae!==0?ce.forEach(function(at){y(Et.iceTransport,at)}):Et.iceTransport.setRemoteCandidates(ce)),Dr=t.RTCRtpReceiver.getCapabilities(et),15019>e&&(Dr.codecs=Dr.codecs.filter(function(at){return at.name!=="rtx"})),vt=Et.sendEncodingParameters||[{ssrc:1001*(2*Ae+2)}],Tr=!1,Me==="sendrecv"||Me==="sendonly"?(Tr=!Et.rtpReceiver,Je=Et.rtpReceiver||new t.RTCRtpReceiver(Et.dtlsTransport,et),Tr&&(nr=Je.track,Pt&&Pt.stream==="-"||(Pt?(x[Pt.stream]||(x[Pt.stream]=new t.MediaStream,Object.defineProperty(x[Pt.stream],"id",{get:function(){return Pt.stream}})),Object.defineProperty(nr,"id",{get:function(){return Pt.track}}),Ce=x[Pt.stream]):(x.default||(x.default=new t.MediaStream),Ce=x.default)),Ce&&(r(nr,Ce),Et.associatedRemoteMediaStreams.push(Ce)),Q.push([nr,Je,Ce]))):Et.rtpReceiver&&Et.rtpReceiver.track&&(Et.associatedRemoteMediaStreams.forEach(function(at){var ct=at.getTracks().find(function(Ut){return Ut.id===Et.rtpReceiver.track.id});ct&&function(Ut,St){St.removeTrack(Ut),St.dispatchEvent(new t.MediaStreamTrackEvent("removetrack",{track:Ut}))}(ct,at)}),Et.associatedRemoteMediaStreams=[]),Et.localCapabilities=Dr,Et.remoteCapabilities=zi,Et.rtpReceiver=Je,Et.rtcpParameters=Wr,Et.sendEncodingParameters=vt,Et.recvEncodingParameters=kt,C._transceive(C.transceivers[Ae],!1,Tr)}}),C._dtlsRole===void 0&&(C._dtlsRole=h.type==="offer"?"active":"passive"),C._remoteDescription={type:h.type,sdp:h.sdp},h.type==="offer"?C._updateSignalingState("have-remote-offer"):C._updateSignalingState("stable"),Object.keys(x).forEach(function(ce){var Ae=x[ce];if(Ae.getTracks().length){if(C.remoteStreams.indexOf(Ae)===-1){C.remoteStreams.push(Ae);var Me=new Event("addstream");Me.stream=Ae,t.setTimeout(function(){C._dispatchEvent("addstream",Me)})}Q.forEach(function(et){var vt=et[0],kt=et[1];Ae.id===et[2].id&&i(C,vt,kt,[Ae])})}}),Q.forEach(function(ce){ce[2]||i(C,ce[0],ce[1],[])}),t.setTimeout(function(){C&&C.transceivers&&C.transceivers.forEach(function(ce){ce.iceTransport&&ce.iceTransport.state==="new"&&0<ce.iceTransport.getRemoteCandidates().length&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),ce.iceTransport.addRemoteCandidate({}))})},4e3),Promise.resolve()},n.prototype.close=function(){this.transceivers.forEach(function(h){h.iceTransport&&h.iceTransport.stop(),h.dtlsTransport&&h.dtlsTransport.stop(),h.rtpSender&&h.rtpSender.stop(),h.rtpReceiver&&h.rtpReceiver.stop()}),this._isClosed=!0,this._updateSignalingState("closed")},n.prototype._updateSignalingState=function(h){this.signalingState=h,h=new Event("signalingstatechange"),this._dispatchEvent("signalingstatechange",h)},n.prototype._maybeFireNegotiationNeeded=function(){var h=this;this.signalingState==="stable"&&this.needNegotiation!==!0&&(this.needNegotiation=!0,t.setTimeout(function(){if(h.needNegotiation){h.needNegotiation=!1;var C=new Event("negotiationneeded");h._dispatchEvent("negotiationneeded",C)}},0))},n.prototype._updateIceConnectionState=function(){var h,C={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};this.transceivers.forEach(function(x){x.iceTransport&&!x.rejected&&C[x.iceTransport.state]++}),h="new",0<C.failed?h="failed":0<C.checking?h="checking":0<C.disconnected?h="disconnected":0<C.new?h="new":0<C.connected?h="connected":0<C.completed&&(h="completed"),h!==this.iceConnectionState&&(this.iceConnectionState=h,h=new Event("iceconnectionstatechange"),this._dispatchEvent("iceconnectionstatechange",h))},n.prototype._updateConnectionState=function(){var h,C={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};this.transceivers.forEach(function(x){x.iceTransport&&x.dtlsTransport&&!x.rejected&&(C[x.iceTransport.state]++,C[x.dtlsTransport.state]++)}),C.connected+=C.completed,h="new",0<C.failed?h="failed":0<C.connecting?h="connecting":0<C.disconnected?h="disconnected":0<C.new?h="new":0<C.connected&&(h="connected"),h!==this.connectionState&&(this.connectionState=h,h=new Event("connectionstatechange"),this._dispatchEvent("connectionstatechange",h))},n.prototype.createOffer=function(h){var C=this;if(C._isClosed)return Promise.reject(v("InvalidStateError","Can not call createOffer after close"));var x=C.transceivers.filter(function(V){return V.kind==="audio"}).length,Q=C.transceivers.filter(function(V){return V.kind==="video"}).length;if(h){if(h.mandatory||h.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");h.offerToReceiveAudio!==void 0&&(x=h.offerToReceiveAudio===!0?1:h.offerToReceiveAudio===!1?0:h.offerToReceiveAudio),h.offerToReceiveVideo!==void 0&&(Q=h.offerToReceiveVideo===!0?1:h.offerToReceiveVideo===!1?0:h.offerToReceiveVideo)}for(C.transceivers.forEach(function(V){V.kind==="audio"?0>--x&&(V.wantReceive=!1):V.kind==="video"&&0>--Q&&(V.wantReceive=!1)});0<x||0<Q;)0<x&&(C._createTransceiver("audio"),x--),0<Q&&(C._createTransceiver("video"),Q--);var F=Kt.writeSessionBoilerplate(C._sdpSessionId,C._sdpSessionVersion++);return C.transceivers.forEach(function(V,Y){var $=V.track,te=V.kind,ce=V.mid||Kt.generateIdentifier();V.mid=ce,V.iceGatherer||(V.iceGatherer=C._createIceGatherer(Y,C.usingBundle)),ce=t.RTCRtpSender.getCapabilities(te),15019>e&&(ce.codecs=ce.codecs.filter(function(Ae){return Ae.name!=="rtx"})),ce.codecs.forEach(function(Ae){Ae.name==="H264"&&Ae.parameters["level-asymmetry-allowed"]===void 0&&(Ae.parameters["level-asymmetry-allowed"]="1"),V.remoteCapabilities&&V.remoteCapabilities.codecs&&V.remoteCapabilities.codecs.forEach(function(Me){Ae.name.toLowerCase()===Me.name.toLowerCase()&&Ae.clockRate===Me.clockRate&&(Ae.preferredPayloadType=Me.payloadType)})}),ce.headerExtensions.forEach(function(Ae){(V.remoteCapabilities&&V.remoteCapabilities.headerExtensions||[]).forEach(function(Me){Ae.uri===Me.uri&&(Ae.id=Me.id)})}),Y=V.sendEncodingParameters||[{ssrc:1001*(2*Y+1)}],$&&15019<=e&&te==="video"&&!Y[0].rtx&&(Y[0].rtx={ssrc:Y[0].ssrc+1}),V.wantReceive&&(V.rtpReceiver=new t.RTCRtpReceiver(V.dtlsTransport,te)),V.localCapabilities=ce,V.sendEncodingParameters=Y}),C._config.bundlePolicy!=="max-compat"&&(F+="a=group:BUNDLE "+C.transceivers.map(function(V){return V.mid}).join(" ")+`\r
92
- `),F+=`a=ice-options:trickle\r
93
- `,C.transceivers.forEach(function(V,Y){F+=A(V,V.localCapabilities,"offer",V.stream,C._dtlsRole),F+=`a=rtcp-rsize\r
94
- `,!V.iceGatherer||C.iceGatheringState==="new"||Y!==0&&C.usingBundle||(V.iceGatherer.getLocalCandidates().forEach(function($){$.component=1,F+="a="+Kt.writeCandidate($)+`\r
95
- `}),V.iceGatherer.state==="completed"&&(F+=`a=end-of-candidates\r
96
- `))}),h=new t.RTCSessionDescription({type:"offer",sdp:F}),Promise.resolve(h)},n.prototype.createAnswer=function(){var h=this;if(h._isClosed)return Promise.reject(v("InvalidStateError","Can not call createAnswer after close"));if(h.signalingState!=="have-remote-offer"&&h.signalingState!=="have-local-pranswer")return Promise.reject(v("InvalidStateError","Can not call createAnswer in signalingState "+h.signalingState));var C=Kt.writeSessionBoilerplate(h._sdpSessionId,h._sdpSessionVersion++);h.usingBundle&&(C+="a=group:BUNDLE "+h.transceivers.map(function(F){return F.mid}).join(" ")+`\r
97
- `),C+=`a=ice-options:trickle\r
98
- `;var x=Kt.getMediaSections(h._remoteDescription.sdp).length;h.transceivers.forEach(function(F,V){if(!(V+1>x)){if(F.rejected)return F.kind==="application"?F.protocol==="DTLS/SCTP"?C+=`m=application 0 DTLS/SCTP 5000\r
99
- `:C+="m=application 0 "+F.protocol+` webrtc-datachannel\r
100
- `:F.kind==="audio"?C+=`m=audio 0 UDP/TLS/RTP/SAVPF 0\r
101
- a=rtpmap:0 PCMU/8000\r
102
- `:F.kind==="video"&&(C+=`m=video 0 UDP/TLS/RTP/SAVPF 120\r
103
- a=rtpmap:120 VP8/90000\r
104
- `),void(C+=`c=IN IP4 0.0.0.0\r
105
- a=inactive\r
106
- a=mid:`+F.mid+`\r
107
- `);var Y;F.stream&&(F.kind==="audio"?Y=F.stream.getAudioTracks()[0]:F.kind==="video"&&(Y=F.stream.getVideoTracks()[0]),Y&&15019<=e&&F.kind==="video"&&!F.sendEncodingParameters[0].rtx&&(F.sendEncodingParameters[0].rtx={ssrc:F.sendEncodingParameters[0].ssrc+1})),V=I(F.localCapabilities,F.remoteCapabilities),!V.codecs.filter(function($){return $.name.toLowerCase()==="rtx"}).length&&F.sendEncodingParameters[0].rtx&&delete F.sendEncodingParameters[0].rtx,C+=A(F,V,"answer",F.stream,h._dtlsRole),F.rtcpParameters&&F.rtcpParameters.reducedSize&&(C+=`a=rtcp-rsize\r
108
- `)}});var Q=new t.RTCSessionDescription({type:"answer",sdp:C});return Promise.resolve(Q)},n.prototype.addIceCandidate=function(h){var C,x=this;return h&&h.sdpMLineIndex===void 0&&!h.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise(function(Q,F){if(!x._remoteDescription)return F(v("InvalidStateError","Can not add ICE candidate without a remote description"));if(h&&h.candidate!==""){var V=h.sdpMLineIndex;if(h.sdpMid){for(var Y=0;Y<x.transceivers.length;Y++)if(x.transceivers[Y].mid===h.sdpMid){V=Y;break}}var $=x.transceivers[V];if(!$)return F(v("OperationError","Can not add ICE candidate"));if($.rejected||(Y=0<Object.keys(h.candidate).length?Kt.parseCandidate(h.candidate):{},Y.protocol==="tcp"&&(Y.port===0||Y.port===9)||Y.component&&Y.component!==1))return Q();if((V===0||0<V&&$.iceTransport!==x.transceivers[0].iceTransport)&&!y($.iceTransport,Y))return F(v("OperationError","Can not add ICE candidate"));F=h.candidate.trim(),F.indexOf("a=")===0&&(F=F.substr(2)),(C=Kt.getMediaSections(x._remoteDescription.sdp))[V]+="a="+(Y.type?F:"end-of-candidates")+`\r
109
- `,x._remoteDescription.sdp=Kt.getDescription(x._remoteDescription.sdp)+C.join("")}else for(V=0;V<x.transceivers.length&&(x.transceivers[V].rejected||(x.transceivers[V].iceTransport.addRemoteCandidate({}),(C=Kt.getMediaSections(x._remoteDescription.sdp))[V]+=`a=end-of-candidates\r
110
- `,x._remoteDescription.sdp=Kt.getDescription(x._remoteDescription.sdp)+C.join(""),!x.usingBundle));V++);Q()})},n.prototype.getStats=function(h){if(h&&h instanceof t.MediaStreamTrack){var C=null;if(this.transceivers.forEach(function(Q){Q.rtpSender&&Q.rtpSender.track===h?C=Q.rtpSender:Q.rtpReceiver&&Q.rtpReceiver.track===h&&(C=Q.rtpReceiver)}),!C)throw v("InvalidAccessError","Invalid selector.");return C.getStats()}var x=[];return this.transceivers.forEach(function(Q){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach(function(F){Q[F]&&x.push(Q[F].getStats())})}),Promise.all(x).then(function(Q){var F=new Map;return Q.forEach(function(V){V.forEach(function(Y){F.set(Y.id,Y)})}),F})},["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach(function(h){if((h=t[h])&&h.prototype&&h.prototype.getStats){var C=h.prototype.getStats;h.prototype.getStats=function(){return C.apply(this).then(function(x){var Q=new Map;return Object.keys(x).forEach(function(F){var V;x[F].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(V=x[F]).type]||V.type,Q.set(F,x[F])}),Q})}}});var c=["createOffer","createAnswer"];return c.forEach(function(h){var C=n.prototype[h];n.prototype[h]=function(){var x=arguments;return typeof x[0]=="function"||typeof x[1]=="function"?C.apply(this,[arguments[2]]).then(function(Q){typeof x[0]=="function"&&x[0].apply(null,[Q])},function(Q){typeof x[1]=="function"&&x[1].apply(null,[Q])}):C.apply(this,arguments)}}),(c=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach(function(h){var C=n.prototype[h];n.prototype[h]=function(){var x=arguments;return typeof x[1]=="function"||typeof x[2]=="function"?C.apply(this,arguments).then(function(){typeof x[1]=="function"&&x[1].apply(null)},function(Q){typeof x[2]=="function"&&x[2].apply(null,[Q])}):C.apply(this,arguments)}}),["getStats"].forEach(function(h){var C=n.prototype[h];n.prototype[h]=function(){var x=arguments;return typeof x[1]=="function"?C.apply(this,arguments).then(function(){typeof x[1]=="function"&&x[1].apply(null)}):C.apply(this,arguments)}}),n},Ef=Object.freeze({__proto__:null,shimPeerConnection:B,shimReplaceTrack:N,shimGetUserMedia:m,shimGetDisplayMedia:S}),_f=Object.freeze({__proto__:null,shimOnTrack:U,shimPeerConnection:K,shimSenderGetStats:j,shimReceiverGetStats:X,shimRemoveStream:ie,shimRTCDataChannel:se,shimGetUserMedia:M,shimGetDisplayMedia:function(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function(r){return r&&r.video?(r.video===!0?r.video={mediaSource:e}:r.video.mediaSource=e,t.navigator.mediaDevices.getUserMedia(r)):(r=new DOMException("getDisplayMedia without video constraints is undefined"),r.name="NotFoundError",r.code=8,it.reject(r))})}}),Cf=Object.freeze({__proto__:null,shimLocalStreamsAPI:le,shimRemoteStreamsAPI:ve,shimCallbacksAPI:q,shimGetUserMedia:ee,shimConstraints:ae,shimRTCIceServerUrls:_e,shimTrackEventTransceiver:fe,shimCreateOfferLegacy:Ge}),Wp=Object.freeze({__proto__:null,shimRTCIceCandidate:Te,shimMaxMessageSize:Ue,shimSendThrowTypeError:Ze,shimConnectionState:ut,removeAllowExtmapMixed:Fe});(function({window:t}={},e={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){let r=w(t),i={browserDetails:r,commonShim:Wp,extractVersion:W,disableLog:E,disableWarnings:L};switch(r.browser){case"chrome":if(!gf||!u||!e.shimChrome)return O("Chrome shim is not included in this adapter release."),i;O("adapter.js shimming chrome."),i.browserShim=gf,T(t),f(t),u(t),p(t),a(t),_(t),d(t),o(t),l(t),Te(t),ut(t),Ue(t),Ze(t),Fe(t);break;case"firefox":if(!_f||!K||!e.shimFirefox)return O("Firefox shim is not included in this adapter release."),i;O("adapter.js shimming firefox."),i.browserShim=_f,M(t),K(t),U(t),ie(t),j(t),X(t),se(t),Te(t),ut(t),Ue(t),Ze(t);break;case"edge":if(!Ef||!B||!e.shimEdge)return O("MS edge shim is not included in this adapter release."),i;O("adapter.js shimming edge."),i.browserShim=Ef,m(t),S(t),B(t),N(t),Ue(t),Ze(t);break;case"safari":if(!Cf||!e.shimSafari)return O("Safari shim is not included in this adapter release."),i;O("adapter.js shimming safari."),i.browserShim=Cf,_e(t),Ge(t),q(t),le(t),ve(t),fe(t),ee(t),Te(t),Ue(t),Ze(t),Fe(t);break;default:O("Unsupported browser!")}})({window});var en,rr;(function(t){t.WIN_10="Windows 10",t.WIN_81="Windows 8.1",t.WIN_8="Windows 8",t.WIN_7="Windows 7",t.WIN_VISTA="Windows Vista",t.WIN_SERVER_2003="Windows Server 2003",t.WIN_XP="Windows XP",t.WIN_2000="Windows 2000",t.ANDROID="Android",t.OPEN_BSD="Open BSD",t.SUN_OS="Sun OS",t.LINUX="Linux",t.IOS="iOS",t.MAC_OS="Mac OS",t.QNX="QNX",t.UNIX="UNIX",t.BEOS="BeOS",t.OS_2="OS/2",t.SEARCH_BOT="Search Bot"})(en||(en={})),function(t){t.CHROME="Chrome",t.SAFARI="Safari",t.EDGE="Edge",t.FIREFOX="Firefox",t.OPERA="OPR",t.QQ="QQBrowser",t.WECHAT="MicroMessenger"}(rr||(rr={}));let id=new(k(function(t,e){(function(r,i){var n={extend:function(Y,$){var te={},ce;for(ce in Y)$[ce]&&$[ce].length%2==0?te[ce]=$[ce].concat(Y[ce]):te[ce]=Y[ce];return te},has:function(Y,$){return typeof Y=="string"&&$.toLowerCase().indexOf(Y.toLowerCase())!==-1},lowerize:function(Y){return Y.toLowerCase()},major:function(Y){return typeof Y=="string"?Y.replace(/[^\d\.]/g,"").split(".")[0]:i},trim:function(Y,$){return Y=Y.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),$===void 0?Y:Y.substring(0,255)}},c=function(Y,$){for(var te,ce,Ae,Me,et,vt,kt=0;kt<$.length&&!et;){var Pt=$[kt],Dr=$[kt+1];for(te=ce=0;te<Pt.length&&!et;)if(et=Pt[te++].exec(Y))for(Ae=0;Ae<Dr.length;Ae++)vt=et[++ce],typeof(Me=Dr[Ae])=="object"&&0<Me.length?Me.length==2?typeof Me[1]=="function"?this[Me[0]]=Me[1].call(this,vt):this[Me[0]]=Me[1]:Me.length==3?typeof Me[1]!="function"||Me[1].exec&&Me[1].test?this[Me[0]]=vt?vt.replace(Me[1],Me[2]):i:this[Me[0]]=vt?Me[1].call(this,vt,Me[2]):i:Me.length==4&&(this[Me[0]]=vt?Me[3].call(this,vt.replace(Me[1],Me[2])):i):this[Me]=vt||i;kt+=2}},h=function(Y,$){for(var te in $)if(typeof $[te]=="object"&&0<$[te].length){for(var ce=0;ce<$[te].length;ce++)if(n.has($[te][ce],Y))return te==="?"?i:te}else if(n.has($[te],Y))return te==="?"?i:te;return Y},C={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},x={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],["version",["name","Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],["version",["name","Edge"]],[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]{3,6})\b.+version\/([\w\.-]+)/i,/(opera)(?:.+version\/|[\/\s]+)([\w\.]+)/i],["name","version"],[/opios[\/\s]+([\w\.]+)/i],["version",["name","Opera Mini"]],[/\sopr\/([\w\.]+)/i],["version",["name","Opera"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]*)/i,/(avant\s|iemobile|slim)(?:browser)?[\/\s]?([\w\.]*)/i,/(ba?idubrowser)[\/\s]?([\w\.]+)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon)\/([\w\.-]+)/i,/(rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([\w\.]+)/i,/(weibo)__([\d\.]+)/i],["name","version"],[/(?:[\s\/]uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i],["version",["name","UCBrowser"]],[/(?:windowswechat)?\sqbcore\/([\w\.]+)\b.*(?:windowswechat)?/i],["version",["name","WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],["version",["name","WeChat"]],[/konqueror\/([\w\.]+)/i],["version",["name","Konqueror"]],[/trident.+rv[:\s]([\w\.]{1,9})\b.+like\sgecko/i],["version",["name","IE"]],[/yabrowser\/([\w\.]+)/i],["version",["name","Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[["name",/(.+)/,"$1 Secure Browser"],"version"],[/focus\/([\w\.]+)/i],["version",["name","Firefox Focus"]],[/opt\/([\w\.]+)/i],["version",["name","Opera Touch"]],[/coc_coc_browser\/([\w\.]+)/i],["version",["name","Coc Coc"]],[/dolfin\/([\w\.]+)/i],["version",["name","Dolphin"]],[/coast\/([\w\.]+)/i],["version",["name","Opera Coast"]],[/xiaomi\/miuibrowser\/([\w\.]+)/i],["version",["name","MIUI Browser"]],[/fxios\/([\w\.-]+)/i],["version",["name","Firefox"]],[/(qihu|qhbrowser|qihoobrowser|360browser)/i],[["name","360 Browser"]],[/(oculus|samsung|sailfish)browser\/([\w\.]+)/i],[["name",/(.+)/,"$1 Browser"],"version"],[/(comodo_dragon)\/([\w\.]+)/i],[["name",/_/g," "],"version"],[/\s(electron)\/([\w\.]+)\ssafari/i,/(tesla)(?:\sqtcarbrowser|\/(20[12]\d\.[\w\.-]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/\s]?([\w\.]+)/i],["name","version"],[/(MetaSr)[\/\s]?([\w\.]+)/i,/(LBBROWSER)/i],["name"],[/;fbav\/([\w\.]+);/i],["version",["name","Facebook"]],[/FBAN\/FBIOS|FB_IAB\/FB4A/i],[["name","Facebook"]],[/safari\s(line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/\s]([\w\.-]+)/i],["name","version"],[/\bgsa\/([\w\.]+)\s.*safari\//i],["version",["name","GSA"]],[/headlesschrome(?:\/([\w\.]+)|\s)/i],["version",["name","Chrome Headless"]],[/\swv\).+(chrome)\/([\w\.]+)/i],[["name","Chrome WebView"],"version"],[/droid.+\sversion\/([\w\.]+)\b.+(?:mobile\ssafari|safari)/i],["version",["name","Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i],["name","version"],[/version\/([\w\.]+)\s.*mobile\/\w+\s(safari)/i],["version",["name","Mobile Safari"]],[/version\/([\w\.]+)\s.*(mobile\s?safari|safari)/i],["version","name"],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],["name",["version",h,{"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],["name","version"],[/(navigator|netscape)\/([\w\.-]+)/i],[["name","Netscape"],"version"],[/ile\svr;\srv:([\w\.]+)\).+firefox/i],["version",["name","Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([\w\.-]+)$/i,/(firefox)\/([\w\.]+)\s[\w\s\-]+\/[\w\.]+$/i,/(mozilla)\/([\w\.]+)\s.+rv:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]*)/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],["name","version"]],cpu:[[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],[["architecture","amd64"]],[/(ia32(?=;))/i],[["architecture",n.lowerize]],[/((?:i[346]|x)86)[;\)]/i],[["architecture","ia32"]],[/\b(aarch64|armv?8e?l?)\b/i],[["architecture","arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[["architecture","armhf"]],[/windows\s(ce|mobile);\sppc;/i],[["architecture","arm"]],[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],[["architecture",/ower/,"",n.lowerize]],[/(sun4\w)[;\)]/i],[["architecture","sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?:64|(?=v(?:[1-7]|[5-7]1)l?|;|eabi))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[["architecture",n.lowerize]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[pt]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus\s10)/i],["model",["vendor","Samsung"],["type","tablet"]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy\snexus)/i,/\ssamsung[\s-]([\w-]+)/i,/sec-(sgh\w+)/i],["model",["vendor","Samsung"],["type","mobile"]],[/\((ip(?:hone|od)[\s\w]*);/i],["model",["vendor","Apple"],["type","mobile"]],[/\((ipad);[\w\s\),;-]+apple/i,/applecoremedia\/[\w\.]+\s\((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],["model",["vendor","Apple"],["type","tablet"]],[/\b((?:agr|ags[23]|bah2?|sht?)-a?[lw]\d{2})/i],["model",["vendor","Huawei"],["type","tablet"]],[/d\/huawei([\w\s-]+)[;\)]/i,/\b(nexus\s6p|vog-[at]?l\d\d|ane-[at]?l[x\d]\d|eml-a?l\d\da?|lya-[at]?l\d[\dc]|clt-a?l\d\di?|ele-l\d\d)/i,/\b(\w{2,4}-[atu][ln][01259][019])[;\)\s]/i],["model",["vendor","Huawei"],["type","mobile"]],[/\b(poco[\s\w]+)(?:\sbuild|\))/i,/\b;\s(\w+)\sbuild\/hm\1/i,/\b(hm[\s\-_]?note?[\s_]?(?:\d\w)?)\sbuild/i,/\b(redmi[\s\-_]?(?:note|k)?[\w\s_]+)(?:\sbuild|\))/i,/\b(mi[\s\-_]?(?:a\d|one|one[\s_]plus|note lte)?[\s_]?(?:\d?\w?)[\s_]?(?:plus)?)\sbuild/i],[["model",/_/g," "],["vendor","Xiaomi"],["type","mobile"]],[/\b(mi[\s\-_]?(?:pad)(?:[\w\s_]+))(?:\sbuild|\))/i],[["model",/_/g," "],["vendor","Xiaomi"],["type","tablet"]],[/;\s(\w+)\sbuild.+\soppo/i,/\s(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007)\b/i],["model",["vendor","OPPO"],["type","mobile"]],[/\svivo\s(\w+)(?:\sbuild|\))/i,/\s(v[12]\d{3}\w?[at])(?:\sbuild|;)/i],["model",["vendor","Vivo"],["type","mobile"]],[/\s(rmx[12]\d{3})(?:\sbuild|;)/i],["model",["vendor","Realme"],["type","mobile"]],[/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?:?(\s4g)?)\b[\w\s]+build\//i,/\smot(?:orola)?[\s-](\w*)/i,/((?:moto[\s\w\(\)]+|xt\d{3,4}|nexus\s6)(?=\sbuild|\)))/i],["model",["vendor","Motorola"],["type","mobile"]],[/\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i],["model",["vendor","Motorola"],["type","tablet"]],[/((?=lg)?[vl]k\-?\d{3})\sbuild|\s3\.[\s\w;-]{10}lg?-([06cv9]{3,4})/i],["model",["vendor","LG"],["type","tablet"]],[/(lm-?f100[nv]?|nexus\s[45])/i,/lg[e;\s\/-]+((?!browser|netcast)\w+)/i,/\blg(\-?[\d\w]+)\sbuild/i],["model",["vendor","LG"],["type","mobile"]],[/(ideatab[\w\-\s]+)/i,/lenovo\s?(s(?:5000|6000)(?:[\w-]+)|tab(?:[\s\w]+)|yt[\d\w-]{6}|tb[\d\w-]{6})/i],["model",["vendor","Lenovo"],["type","tablet"]],[/(?:maemo|nokia).*(n900|lumia\s\d+)/i,/nokia[\s_-]?([\w\.-]*)/i],[["model",/_/g," "],["vendor","Nokia"],["type","mobile"]],[/droid.+;\s(pixel\sc)[\s)]/i],["model",["vendor","Google"],["type","tablet"]],[/droid.+;\s(pixel[\s\daxl]{0,6})(?:\sbuild|\))/i],["model",["vendor","Google"],["type","mobile"]],[/droid.+\s([c-g]\d{4}|so[-l]\w+|xq-a\w[4-7][12])(?=\sbuild\/|\).+chrome\/(?![1-6]{0,1}\d\.))/i],["model",["vendor","Sony"],["type","mobile"]],[/sony\stablet\s[ps]\sbuild\//i,/(?:sony)?sgp\w+(?:\sbuild\/|\))/i],[["model","Xperia Tablet"],["vendor","Sony"],["type","tablet"]],[/\s(kb2005|in20[12]5|be20[12][59])\b/i,/\ba000(1)\sbuild/i,/\boneplus\s(a\d{4})[\s)]/i],["model",["vendor","OnePlus"],["type","mobile"]],[/(alexa)webm/i,/(kf[a-z]{2}wi)(\sbuild\/|\))/i,/(kf[a-z]+)(\sbuild\/|\)).+silk\//i],["model",["vendor","Amazon"],["type","tablet"]],[/(sd|kf)[0349hijorstuw]+(\sbuild\/|\)).+silk\//i],[["model","Fire Phone"],["vendor","Amazon"],["type","mobile"]],[/\((playbook);[\w\s\),;-]+(rim)/i],["model","vendor",["type","tablet"]],[/((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10;\s(\w+)/i],["model",["vendor","BlackBerry"],["type","mobile"]],[/(?:\b|asus_)(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus\s7|padfone|p00[cj])/i],["model",["vendor","ASUS"],["type","tablet"]],[/\s(z[es]6[027][01][km][ls]|zenfone\s\d\w?)\b/i],["model",["vendor","ASUS"],["type","mobile"]],[/(nexus\s9)/i],["model",["vendor","HTC"],["type","tablet"]],[/(htc)[;_\s-]{1,2}([\w\s]+(?=\)|\sbuild)|\w+)/i,/(zte)-(\w*)/i,/(alcatel|geeksphone|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]*)/i],["vendor",["model",/_/g," "],["type","mobile"]],[/droid[x\d\.\s;]+\s([ab][1-7]\-?[0178a]\d\d?)/i],["model",["vendor","Acer"],["type","tablet"]],[/droid.+;\s(m[1-5]\snote)\sbuild/i,/\bmz-([\w-]{2,})/i],["model",["vendor","Meizu"],["type","mobile"]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]*)/i,/(hp)\s([\w\s]+\w)/i,/(asus)-?(\w+)/i,/(microsoft);\s(lumia[\s\w]+)/i,/(lenovo)[_\s-]?([\w-]+)/i,/linux;.+(jolla);/i,/droid.+;\s(oppo)\s?([\w\s]+)\sbuild/i],["vendor","model",["type","mobile"]],[/(archos)\s(gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/\s(nook)[\w\s]+build\/(\w+)/i,/(dell)\s(strea[kpr\s\d]*[\dko])/i,/[;\/]\s?(le[\s\-]+pan)[\s\-]+(\w{1,9})\sbuild/i,/[;\/]\s?(trinity)[\-\s]*(t\d{3})\sbuild/i,/\b(gigaset)[\s\-]+(q\w{1,9})\sbuild/i,/\b(vodafone)\s([\w\s]+)(?:\)|\sbuild)/i],["vendor","model",["type","tablet"]],[/\s(surface\sduo)\s/i],["model",["vendor","Microsoft"],["type","tablet"]],[/droid\s[\d\.]+;\s(fp\du?)\sbuild/i],["model",["vendor","Fairphone"],["type","mobile"]],[/\s(u304aa)\sbuild/i],["model",["vendor","AT&T"],["type","mobile"]],[/sie-(\w*)/i],["model",["vendor","Siemens"],["type","mobile"]],[/[;\/]\s?(rct\w+)\sbuild/i],["model",["vendor","RCA"],["type","tablet"]],[/[;\/\s](venue[\d\s]{2,7})\sbuild/i],["model",["vendor","Dell"],["type","tablet"]],[/[;\/]\s?(q(?:mv|ta)\w+)\sbuild/i],["model",["vendor","Verizon"],["type","tablet"]],[/[;\/]\s(?:barnes[&\s]+noble\s|bn[rt])([\w\s\+]*)\sbuild/i],["model",["vendor","Barnes & Noble"],["type","tablet"]],[/[;\/]\s(tm\d{3}\w+)\sbuild/i],["model",["vendor","NuVision"],["type","tablet"]],[/;\s(k88)\sbuild/i],["model",["vendor","ZTE"],["type","tablet"]],[/;\s(nx\d{3}j)\sbuild/i],["model",["vendor","ZTE"],["type","mobile"]],[/[;\/]\s?(gen\d{3})\sbuild.*49h/i],["model",["vendor","Swiss"],["type","mobile"]],[/[;\/]\s?(zur\d{3})\sbuild/i],["model",["vendor","Swiss"],["type","tablet"]],[/[;\/]\s?((zeki)?tb.*\b)\sbuild/i],["model",["vendor","Zeki"],["type","tablet"]],[/[;\/]\s([yr]\d{2})\sbuild/i,/[;\/]\s(dragon[\-\s]+touch\s|dt)(\w{5})\sbuild/i],[["vendor","Dragon Touch"],"model",["type","tablet"]],[/[;\/]\s?(ns-?\w{0,9})\sbuild/i],["model",["vendor","Insignia"],["type","tablet"]],[/[;\/]\s?((nxa|Next)-?\w{0,9})\sbuild/i],["model",["vendor","NextBook"],["type","tablet"]],[/[;\/]\s?(xtreme_)?(v(1[045]|2[015]|[3469]0|7[05]))\sbuild/i],[["vendor","Voice"],"model",["type","mobile"]],[/[;\/]\s?(lvtel\-)?(v1[12])\sbuild/i],[["vendor","LvTel"],"model",["type","mobile"]],[/;\s(ph-1)\s/i],["model",["vendor","Essential"],["type","mobile"]],[/[;\/]\s?(v(100md|700na|7011|917g).*\b)\sbuild/i],["model",["vendor","Envizen"],["type","tablet"]],[/[;\/]\s?(trio[\s\w\-\.]+)\sbuild/i],["model",["vendor","MachSpeed"],["type","tablet"]],[/[;\/]\s?tu_(1491)\sbuild/i],["model",["vendor","Rotor"],["type","tablet"]],[/(shield[\w\s]+)\sbuild/i],["model",["vendor","Nvidia"],["type","tablet"]],[/(sprint)\s(\w+)/i],["vendor","model",["type","mobile"]],[/(kin\.[onetw]{3})/i],[["model",/\./g," "],["vendor","Microsoft"],["type","mobile"]],[/droid\s[\d\.]+;\s(cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],["model",["vendor","Zebra"],["type","tablet"]],[/droid\s[\d\.]+;\s(ec30|ps20|tc[2-8]\d[kx])\)/i],["model",["vendor","Zebra"],["type","mobile"]],[/\s(ouya)\s/i,/(nintendo)\s([wids3utch]+)/i],["vendor","model",["type","console"]],[/droid.+;\s(shield)\sbuild/i],["model",["vendor","Nvidia"],["type","console"]],[/(playstation\s[345portablevi]+)/i],["model",["vendor","Sony"],["type","console"]],[/[\s\(;](xbox(?:\sone)?(?!;\sxbox))[\s\);]/i],["model",["vendor","Microsoft"],["type","console"]],[/smart-tv.+(samsung)/i],["vendor",["type","smarttv"]],[/hbbtv.+maple;(\d+)/i],[["model",/^/,"SmartTV"],["vendor","Samsung"],["type","smarttv"]],[/(?:linux;\snetcast.+smarttv|lg\snetcast\.tv-201\d)/i],[["vendor","LG"],["type","smarttv"]],[/(apple)\s?tv/i],["vendor",["model","Apple TV"],["type","smarttv"]],[/crkey/i],[["model","Chromecast"],["vendor","Google"],["type","smarttv"]],[/droid.+aft([\w])(\sbuild\/|\))/i],["model",["vendor","Amazon"],["type","smarttv"]],[/\(dtv[\);].+(aquos)/i],["model",["vendor","Sharp"],["type","smarttv"]],[/hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i],[["vendor",n.trim],["model",n.trim],["type","smarttv"]],[/[\s\/\(](android\s|smart[-\s]?|opera\s)tv[;\)\s]/i],[["type","smarttv"]],[/((pebble))app\/[\d\.]+\s/i],["vendor","model",["type","wearable"]],[/droid.+;\s(glass)\s\d/i],["model",["vendor","Google"],["type","wearable"]],[/droid\s[\d\.]+;\s(wt63?0{2,3})\)/i],["model",["vendor","Zebra"],["type","wearable"]],[/(tesla)(?:\sqtcarbrowser|\/20[12]\d\.[\w\.-]+)/i],["vendor",["type","embedded"]],[/droid .+?; ([^;]+?)(?: build|\) applewebkit).+? mobile safari/i],["model",["type","mobile"]],[/droid .+?;\s([^;]+?)(?: build|\) applewebkit).+?(?! mobile) safari/i],["model",["type","tablet"]],[/\s(tablet|tab)[;\/]/i,/\s(mobile)(?:[;\/]|\ssafari)/i],[["type",n.lowerize]],[/(android[\w\.\s\-]{0,9});.+build/i],["model",["vendor","Generic"]],[/(phone)/i],[["type","mobile"]]],engine:[[/windows.+\sedge\/([\w\.]+)/i],["version",["name","EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],["version",["name","Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],["name","version"],[/rv:([\w\.]{1,9})\b.+(gecko)/i],["version","name"]],os:[[/microsoft\s(windows)\s(vista|xp)/i],["name","version"],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s\w]*)/i,/(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)(?!.+xbox)/i],["name",["version",h,C]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[["name","Windows"],["version",h,C]],[/ip[honead]{2,4}\b(?:.*os\s([\w]+)\slike\smac|;\sopera)/i,/cfnetwork\/.+darwin/i],[["version",/_/g,"."],["name","iOS"]],[/(mac\sos\sx)\s?([\w\s\.]*)/i,/(macintosh|mac(?=_powerpc)\s)(?!.+haiku)/i],[["name","Mac OS"],["version",/_/g,"."]],[/(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|sailfish|contiki)[\/\s-]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/\s]([\w\.]+)/i,/\((series40);/i],["name","version"],[/\(bb(10);/i],["version",["name","BlackBerry"]],[/(?:symbian\s?os|symbos|s60(?=;)|series60)[\/\s-]?([\w\.]*)/i],["version",["name","Symbian"]],[/mozilla.+\(mobile;.+gecko.+firefox/i],[["name","Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],["version",["name","webOS"]],[/crkey\/([\d\.]+)/i],["version",["name","Chromecast"]],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[["name","Chromium OS"],"version"],[/(nintendo|playstation)\s([wids345portablevuch]+)/i,/(xbox);\s+xbox\s([^\);]+)/i,/(mint)[\/\s\(\)]?(\w*)/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?=\slinux)|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus|raspbian)(?:\sgnu\/linux)?(?:\slinux)?[\/\s-]?(?!chrom|package)([\w\.-]*)/i,/(hurd|linux)\s?([\w\.]*)/i,/(gnu)\s?([\w\.]*)/i,/\s([frentopc-]{0,4}bsd|dragonfly)\s?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku)\s(\w+)/i],["name","version"],[/(sunos)\s?([\w\.\d]*)/i],[["name","Solaris"],"version"],[/((?:open)?solaris)[\/\s-]?([\w\.]*)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.])*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms|fuchsia)/i,/(unix)\s?([\w\.]*)/i],["name","version"]]},Q=function(Y,$){if(typeof Y=="object"&&($=Y,Y=i),!(this instanceof Q))return new Q(Y,$).getResult();var te=Y||(r!==void 0&&r.navigator&&r.navigator.userAgent?r.navigator.userAgent:""),ce=$?n.extend(x,$):x;return this.getBrowser=function(){var Ae={name:i,version:i};return c.call(Ae,te,ce.browser),Ae.major=n.major(Ae.version),Ae},this.getCPU=function(){var Ae={architecture:i};return c.call(Ae,te,ce.cpu),Ae},this.getDevice=function(){var Ae={vendor:i,model:i,type:i};return c.call(Ae,te,ce.device),Ae},this.getEngine=function(){var Ae={name:i,version:i};return c.call(Ae,te,ce.engine),Ae},this.getOS=function(){var Ae={name:i,version:i};return c.call(Ae,te,ce.os),Ae},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return te},this.setUA=function(Ae){return te=typeof Ae=="string"&&255<Ae.length?n.trim(Ae,255):Ae,this},this.setUA(te),this};Q.VERSION="0.7.28",Q.BROWSER={NAME:"name",MAJOR:"major",VERSION:"version"},Q.CPU={ARCHITECTURE:"architecture"},Q.DEVICE={MODEL:"model",VENDOR:"vendor",TYPE:"type",CONSOLE:"console",MOBILE:"mobile",SMARTTV:"smarttv",TABLET:"tablet",WEARABLE:"wearable",EMBEDDED:"embedded"},Q.ENGINE={NAME:"name",VERSION:"version"},Q.OS={NAME:"name",VERSION:"version"},t.exports&&(e=t.exports=Q),e.UAParser=Q;var F=r!==void 0&&(r.jQuery||r.Zepto);if(F&&!F.ua){var V=new Q;F.ua=V.getResult(),F.ua.get=function(){return V.getUA()},F.ua.set=function(Y){V.setUA(Y),Y=V.getResult();for(var $ in Y)F.ua[$]=Y[$]}}})(typeof window=="object"?window:oa)})),xn=id.getResult(),as=function(t){if(t.match(/[0-9]+\.[0-9]+\.[0-9]+$/))return t;var e=t.match(/([0-9]+\.[0-9]+\.[0-9]+)\-alpha\.([0-9]+)/);if(e&&e[1]&&e[2]){var r,i=e[2];return ne(r="".concat(e[1],".")).call(r,i)}return(e=t.match(/([0-9]+\.[0-9]+\.[0-9]+)\-special\.([0-9]+)/))&&e[1]&&e[2]?(r=e[2],ne(i="".concat(e[1],".")).call(i,100*(Number(r)+1))):"4.0.0.999"}("4.7.3");try{var yf=JSON.parse("true")===!0}catch(t){yf=!0}let nd=yf,tn={username:"test",password:"111111",turnServerURL:"",tcpport:3433,udpport:3478,forceturn:!1},Vp={"90p":Lt(160,90),"90p_1":Lt(160,90),"120p":Lt(160,120,15,30,65),"120p_1":Lt(160,120,15,30,65),"120p_3":Lt(120,120,15,30,50),"120p_4":Lt(212,120),"180p":Lt(320,180,15,30,140),"180p_1":Lt(320,180,15,30,140),"180p_3":Lt(180,180,15,30,100),"180p_4":Lt(240,180,15,30,120),"240p":Lt(320,240,15,40,200),"240p_1":Lt(320,240,15,40,200),"240p_3":Lt(240,240,15,40,140),"240p_4":Lt(424,240,15,40,220),"360p":Lt(640,360,15,80,400),"360p_1":Lt(640,360,15,80,400),"360p_3":Lt(360,360,15,80,260),"360p_4":Lt(640,360,30,80,600),"360p_6":Lt(360,360,30,80,400),"360p_7":Lt(480,360,15,80,320),"360p_8":Lt(480,360,30,80,490),"360p_9":Lt(640,360,15,80,800),"360p_10":Lt(640,360,24,80,800),"360p_11":Lt(640,360,24,80,1e3),"480p":Lt(640,480,15,100,500),"480p_1":Lt(640,480,15,100,500),"480p_2":Lt(640,480,30,100,1e3),"480p_3":Lt(480,480,15,100,400),"480p_4":Lt(640,480,30,100,750),"480p_6":Lt(480,480,30,100,600),"480p_8":Lt(848,480,15,100,610),"480p_9":Lt(848,480,30,100,930),"480p_10":Lt(640,480,10,100,400),"720p":Lt(1280,720,15,120,1130),"720p_1":Lt(1280,720,15,120,1130),"720p_2":Lt(1280,720,30,120,2e3),"720p_3":Lt(1280,720,30,120,1710),"720p_5":Lt(960,720,15,120,910),"720p_6":Lt(960,720,30,120,1380),"1080p":Lt(1920,1080,15,120,2080),"1080p_1":Lt(1920,1080,15,120,2080),"1080p_2":Lt(1920,1080,30,120,3e3),"1080p_3":Lt(1920,1080,30,120,3150),"1080p_5":Lt(1920,1080,60,120,4780),"1440p":Lt(2560,1440,30,120,4850),"1440p_1":Lt(2560,1440,30,120,4850),"1440p_2":Lt(2560,1440,60,120,7350),"4k":Lt(3840,2160,30,120,8910),"4k_1":Lt(3840,2160,30,120,8910),"4k_3":Lt(3840,2160,60,120,13500)},Yp={"480p":$r(640,480,5),"480p_1":$r(640,480,5),"480p_2":$r(640,480,30),"480p_3":$r(640,480,15),"720p":$r(1280,720,5),"720p_1":$r(1280,720,5),"720p_2":$r(1280,720,30),"720p_3":$r(1280,720,15),"1080p":$r(1920,1080,5),"1080p_1":$r(1920,1080,5),"1080p_2":$r(1920,1080,30),"1080p_3":$r(1920,1080,15)},Jp={"1SL1TL":wn(1,1),"3SL3TL":wn(3,3),"2SL3TL":wn(2,3)},zp={speech_low_quality:Vr(16e3,!1),speech_standard:Vr(32e3,!1,18),music_standard:Vr(48e3,!1),standard_stereo:Vr(48e3,!0,56),high_quality:Vr(48e3,!1,128),high_quality_stereo:Vr(48e3,!0,192)},Xe={PROCESS_ID:"",ENCRYPT_AES:!0,AREAS:["CHINA","GLOBAL"],WEBCS_DOMAIN:["webrtc2-ap-web-1.agora.io","webrtc2-2.ap.sd-rtn.com"],WEBCS_DOMAIN_BACKUP_LIST:["webrtc2-ap-web-3.agora.io","webrtc2-4.ap.sd-rtn.com"],PROXY_CS:["ap-proxy-1.agora.io","ap-proxy-2.agora.io"],CDS_AP:["cds-ap-web-1.agora.io","cds-web-2.ap.sd-rtn.com","cds-ap-web-3.agora.io","cds-web-4.ap.sd-rtn.com"],ACCOUNT_REGISTER:["sua-ap-web-1.agora.io","sua-web-2.ap.sd-rtn.com","sua-ap-web-3.agora.io","sua-web-4.ap.sd-rtn.com"],UAP_AP:["uap-ap-web-1.agora.io","uap-web-2.ap.sd-rtn.com","uap-ap-web-3.agora.io","uap-web-4.ap.sd-rtn.com"],LOG_UPLOAD_SERVER:"logservice.agora.io",EVENT_REPORT_DOMAIN:"statscollector-1.agora.io",EVENT_REPORT_BACKUP_DOMAIN:"web-2.statscollector.sd-rtn.com",GATEWAY_ADDRESS:[],GATEWAY_WSS_ADDRESS:"",LIVE_STREAMING_ADDRESS:"",ACCOUNT_REGISTER_RETRY_TIMEOUT:1,ACCOUNT_REGISTER_RETRY_RATIO:2,ACCOUNT_REGISTER_RETRY_TIMEOUT_MAX:6e4,ACCOUNT_REGISTER_RETRY_COUNT_MAX:1e5,AUDIO_CONTEXT:null,WEBCS_BACKUP_CONNECT_TIMEOUT:6e3,HTTP_CONNECT_TIMEOUT:5e3,PLAYER_STATE_DEFER:2e3,SIGNAL_REQUEST_TIMEOUT:1e4,SIGNAL_REQUEST_WATCH_INTERVAL:1e3,REPORT_STATS:!0,UPLOAD_LOG:!1,NOT_REPORT_EVENT:[],FILEPATH_LENMAX:255,SUBSCRIBE_TCC:!0,PING_PONG_TIME_OUT:10,DUALSTREAM_OPERATION_CHECK:!0,WEBSOCKET_TIMEOUT_MIN:1e4,EVENT_REPORT_SEND_INTERVAL:3e3,CONFIG_DISTRIBUTE_INTERVAL:3e5,MEDIA_ELEMENT_EXISTS_DEPTH:3,CANDIDATE_TIMEOUT:5e3,SHIM_CANDIDATE:!1,LEAVE_MSG_TIMEOUT:2e3,SHOW_REPORT_INVOKER_LOG:!1,STATS_FILTER:{transportId:!0,googTrackId:!0},JOIN_EXTEND:"",PUB_EXTEND:"",SUB_EXTEND:"",FORCE_TURN:!1,TURN_ENABLE_TCP:!0,TURN_ENABLE_UDP:!0,MAX_UPLOAD_CACHE:50,UPLOAD_CACHE_INTERVAL:2e3,AJAX_REQUEST_CONCURRENT:3,REPORT_APP_SCENARIO:void 0,GATEWAY_DOMAINS:["edge.agora.io","edge.sd-rtn.com"],EVENT_REPORT_RETRY:!0,CHROME_FORCE_PLAN_B:!1,AUDIO_SOURCE_VOLUME_UPDATE_INTERVAL:400,AUDIO_SOURCE_AVG_VOLUME_DURATION:3e3,AUDIO_VOLUME_INDICATION_INTERVAL:2e3,VOLUME_VOICE_WEIGHT:10,NORMAL_EVENT_QUEUE_CAPACITY:100,CUSTOM_REPORT:!0,CUSTOM_REPORT_LIMIT:20,PROXY_SERVER_TYPE2:"webnginx-proxy.agora.io",PROXY_SERVER_TYPE3:["webrtc-cloud-proxy.sd-rtn.com","webrtc-cloud-proxy.agora.io"],CUSTOM_PUB_ANSWER_MODIFIER:null,CUSTOM_SUB_ANSWER_MODIFIER:null,CUSTOM_PUB_OFFER_MODIFIER:null,CUSTOM_SUB_OFFER_MODIFIER:null,DSCP_TYPE:"high",REMOVE_NEW_CODECS:!0,FRAGEMENT_LENGTH:3,WEBSOCKET_COMPRESS:!1,SIMULCAST:!1,ENUMERATE_DEVICES_INTERVAL:!0};nd||(Xe.WEBCS_DOMAIN=["ap-web-1-oversea.agora.io","ap-web-1-north-america.agora.io"],Xe.WEBCS_DOMAIN_BACKUP_LIST=["ap-web-2-oversea.agora.io","ap-web-2-north-america.agora.io"],Xe.PROXY_CS=["proxy-ap-web-oversea.agora.io","proxy-ap-web-america.agora.io"],Xe.CDS_AP=["cds-ap-web-oversea.agora.io","cds-ap-web-america.agora.io","cds-ap-web-america2.agora.io"],Xe.ACCOUNT_REGISTER=["sua-ap-web-oversea.agora.io","sua-ap-web-america.agora.io","sua-ap-web-america2.agora.io"],Xe.UAP_AP=["uap-ap-web-oversea.agora.io","uap-ap-web-america.agora.io","uap-ap-web-america2.agora.io"],Xe.LOG_UPLOAD_SERVER="logservice-oversea.agora.io",Xe.EVENT_REPORT_DOMAIN="statscollector-1-oversea.agora.io",Xe.EVENT_REPORT_BACKUP_DOMAIN="statscollector-2-oversea.agora.io",Xe.PROXY_SERVER_TYPE3="webrtc-cloud-proxy.agora.io",Xe.AREAS=["NORTH_AMERICA","OVERSEA"]);let qp=[[0,1,2,3,4,5,5],[0,2,2,3,4,5,5],[0,3,3,3,4,5,5],[0,4,4,4,4,5,5],[0,5,5,5,5,5,5]],jo=[],pa=[];var sd=[],If=sd.sort,Xp=Jt(function(){sd.sort(void 0)}),Zp=Jt(function(){sd.sort(null)}),$p=Oa("sort");Qt({target:"Array",proto:!0,forced:Xp||!Zp||$p},{sort:function(t){return t===void 0?If.call(Wn(this)):If.call(Wn(this),ss(t))}});var ev=ai("Array").sort,Sf=Array.prototype,Wc=function(t){var e=t.sort;return t===Sf||t instanceof Array&&e===Sf.sort?ev:e};Qt({target:"Array",stat:!0},{isArray:Zs});var oe,eo=Br.Array.isArray;(function(t){t.UNEXPECTED_ERROR="UNEXPECTED_ERROR",t.UNEXPECTED_RESPONSE="UNEXPECTED_RESPONSE",t.TIMEOUT="TIMEOUT",t.INVALID_PARAMS="INVALID_PARAMS",t.NOT_READABLE="NOT_READABLE",t.NOT_SUPPORTED="NOT_SUPPORTED",t.INVALID_OPERATION="INVALID_OPERATION",t.OPERATION_ABORTED="OPERATION_ABORTED",t.WEB_SECURITY_RESTRICT="WEB_SECURITY_RESTRICT",t.NETWORK_ERROR="NETWORK_ERROR",t.NETWORK_TIMEOUT="NETWORK_TIMEOUT",t.NETWORK_RESPONSE_ERROR="NETWORK_RESPONSE_ERROR",t.API_INVOKE_TIMEOUT="API_INVOKE_TIMEOUT",t.ENUMERATE_DEVICES_FAILED="ENUMERATE_DEVICES_FAILED",t.DEVICE_NOT_FOUND="DEVICE_NOT_FOUND",t.ELECTRON_IS_NULL="ELECTRON_IS_NULL",t.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR="ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR",t.CHROME_PLUGIN_NO_RESPONSE="CHROME_PLUGIN_NO_RESPONSE",t.CHROME_PLUGIN_NOT_INSTALL="CHROME_PLUGIN_NOT_INSTALL",t.MEDIA_OPTION_INVALID="MEDIA_OPTION_INVALID",t.PERMISSION_DENIED="PERMISSION_DENIED",t.CONSTRAINT_NOT_SATISFIED="CONSTRAINT_NOT_SATISFIED",t.TRACK_IS_DISABLED="TRACK_IS_DISABLED",t.SHARE_AUDIO_NOT_ALLOWED="SHARE_AUDIO_NOT_ALLOWED",t.LOW_STREAM_ENCODING_ERROR="LOW_STREAM_ENCODING_ERROR",t.SET_ENCODING_PARAMETER_ERROR="SET_ENCODING_PARAMETER_ERROR",t.TRACK_STATE_UNREACHABLE="TRACK_STATE_UNREACHABLE",t.INVALID_UINT_UID_FROM_STRING_UID="INVALID_UINT_UID_FROM_STRING_UID",t.CAN_NOT_GET_PROXY_SERVER="CAN_NOT_GET_PROXY_SERVER",t.CAN_NOT_GET_GATEWAY_SERVER="CAN_NOT_GET_GATEWAY_SERVER",t.VOID_GATEWAY_ADDRESS="VOID_GATEWAY_ADDRESS",t.UID_CONFLICT="UID_CONFLICT",t.MULTI_UNILBS_RESPONSE_ERROR="MULTI_UNILBS_RESPONSE_ERROR",t.INVALID_LOCAL_TRACK="INVALID_LOCAL_TRACK",t.INVALID_TRACK="INVALID_TRACK",t.SENDER_NOT_FOUND="SENDER_NOT_FOUND",t.CREATE_OFFER_FAILED="CREATE_OFFER_FAILED",t.SET_ANSWER_FAILED="SET_ANSWER_FAILED",t.ICE_FAILED="ICE_FAILED",t.PC_CLOSED="PC_CLOSED",t.SENDER_REPLACE_FAILED="SENDER_REPLACE_FAILED",t.GATEWAY_P2P_LOST="GATEWAY_P2P_LOST",t.NO_ICE_CANDIDATE="NO_ICE_CANDIDATE",t.CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS="CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS",t.CAN_NOT_PUBLISH_MULTIPLE_AUDIO_TRACKS="CAN_NOT_PUBLISH_MULTIPLE_AUDIO_TRACKS",t.EXIST_DISABLED_VIDEO_TRACK="EXIST_DISABLED_VIDEO_TRACK",t.INVALID_REMOTE_USER="INVALID_REMOTE_USER",t.REMOTE_USER_IS_NOT_PUBLISHED="REMOTE_USER_IS_NOT_PUBLISHED",t.CUSTOM_REPORT_SEND_FAILED="CUSTOM_REPORT_SEND_FAILED",t.CUSTOM_REPORT_FREQUENCY_TOO_HIGH="CUSTOM_REPORT_FREQUENCY_TOO_HIGH",t.FETCH_AUDIO_FILE_FAILED="FETCH_AUDIO_FILE_FAILED",t.READ_LOCAL_AUDIO_FILE_ERROR="READ_LOCAL_AUDIO_FILE_ERROR",t.DECODE_AUDIO_FILE_FAILED="DECODE_AUDIO_FILE_FAILED",t.WS_ABORT="WS_ABORT",t.WS_DISCONNECT="WS_DISCONNECT",t.WS_ERR="WS_ERR",t.LIVE_STREAMING_TASK_CONFLICT="LIVE_STREAMING_TASK_CONFLICT",t.LIVE_STREAMING_INVALID_ARGUMENT="LIVE_STREAMING_INVALID_ARGUMENT",t.LIVE_STREAMING_INTERNAL_SERVER_ERROR="LIVE_STREAMING_INTERNAL_SERVER_ERROR",t.LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED="LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED",t.LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED="LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED",t.LIVE_STREAMING_CDN_ERROR="LIVE_STREAMING_CDN_ERROR",t.LIVE_STREAMING_INVALID_RAW_STREAM="LIVE_STREAMING_INVALID_RAW_STREAM",t.LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT="LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT",t.LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE="LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE",t.LIVE_STREAMING_WARN_FREQUENT_REQUEST="LIVE_STREAMING_WARN_FREQUENT_REQUEST",t.WEBGL_INTERNAL_ERROR="WEBGL_INTERNAL_ERROR",t.BEAUTY_PROCESSOR_INTERNAL_ERROR="BEAUTY_PROCESSOR_INTERNAL_ERROR",t.CROSS_CHANNEL_WAIT_STATUS_ERROR="CROSS_CHANNEL_WAIT_STATUS_ERROR",t.CROSS_CHANNEL_FAILED_JOIN_SRC="CROSS_CHANNEL_FAILED_JOIN_SEC",t.CROSS_CHANNEL_FAILED_JOIN_DEST="CROSS_CHANNEL_FAILED_JOIN_DEST",t.CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST="CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST",t.CROSS_CHANNEL_SERVER_ERROR_RESPONSE="CROSS_CHANNEL_SERVER_ERROR_RESPONSE",t.METADATA_OUT_OF_RANGE="METADATA_OUT_OF_RANGE",t.LOCAL_AEC_ERROR="LOCAL_AEC_ERROR",t.INVALID_PLUGIN="INVALID_PLUGIN"})(oe||(oe={}));var tv=[].slice,rv=/MSIE .\./.test(fa),Tf=function(t){return function(e,r){var i=2<arguments.length,n=i?tv.call(arguments,2):void 0;return t(i?function(){(typeof e=="function"?e:Function(e)).apply(this,n)}:e,r)}};Qt({global:!0,bind:!0,forced:rv},{setTimeout:Tf(gt.setTimeout),setInterval:Tf(gt.setInterval)});var Is=Br.setTimeout;Qt({target:"Date",stat:!0},{now:function(){return new Date().getTime()}});var ot=Br.Date.now,Rf=function(t,e){return function(){for(var r=Array(arguments.length),i=0;i<r.length;i++)r[i]=arguments[i];return t.apply(e,r)}},sc=Object.prototype.toString,Yt={isArray:on,isArrayBuffer:function(t){return sc.call(t)==="[object ArrayBuffer]"},isBuffer:function(t){return t!=null&&t.constructor!=null&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)},isFormData:function(t){return typeof FormData!="undefined"&&t instanceof FormData},isArrayBufferView:function(t){return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return typeof t=="string"},isNumber:function(t){return typeof t=="number"},isObject:wi,isUndefined:function(t){return t===void 0},isDate:function(t){return sc.call(t)==="[object Date]"},isFile:function(t){return sc.call(t)==="[object File]"},isBlob:function(t){return sc.call(t)==="[object Blob]"},isFunction:pn,isStream:function(t){return wi(t)&&pn(t.pipe)},isURLSearchParams:function(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return(typeof navigator=="undefined"||navigator.product!=="ReactNative"&&navigator.product!=="NativeScript"&&navigator.product!=="NS")&&typeof window!="undefined"&&typeof document!="undefined"},forEach:vn,merge:function t(){function e(c,h){typeof r[h]=="object"&&typeof c=="object"?r[h]=t(r[h],c):r[h]=c}for(var r={},i=0,n=arguments.length;i<n;i++)vn(arguments[i],e);return r},deepMerge:function t(){function e(c,h){typeof r[h]=="object"&&typeof c=="object"?r[h]=t(r[h],c):r[h]=typeof c=="object"?t({},c):c}for(var r={},i=0,n=arguments.length;i<n;i++)vn(arguments[i],e);return r},extend:function(t,e,r){return vn(e,function(i,n){t[n]=r&&typeof i=="function"?Rf(i,r):i}),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}},wf=function(t,e,r){if(!e)return t;if(r)e=r(e);else if(Yt.isURLSearchParams(e))e=e.toString();else{var i=[];Yt.forEach(e,function(n,c){n!=null&&(Yt.isArray(n)?c+="[]":n=[n],Yt.forEach(n,function(h){Yt.isDate(h)?h=h.toISOString():Yt.isObject(h)&&(h=JSON.stringify(h)),i.push(Oi(c)+"="+Oi(h))}))}),e=i.join("&")}return e&&(r=t.indexOf("#"),r!==-1&&(t=t.slice(0,r)),t+=(t.indexOf("?")===-1?"?":"&")+e),t};Ln.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},Ln.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},Ln.prototype.forEach=function(t){Yt.forEach(this.handlers,function(e){e!==null&&t(e)})};var Lf=Ln,od=function(t,e,r){return Yt.forEach(r,function(i){t=i(t,e)}),t},Df=function(t){return!(!t||!t.__CANCEL__)},bf=function(t,e){Yt.forEach(t,function(r,i){i!==e&&i.toUpperCase()===e.toUpperCase()&&(t[e]=r,delete t[i])})},Hl=function(t,e,r,i,n){return function(c,h,C,x,Q){return c.config=h,C&&(c.code=C),c.request=x,c.response=Q,c.isAxiosError=!0,c.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},c}(Error(t),e,r,i,n)},iv="age authorization content-length content-type etag expires from host if-modified-since if-unmodified-since last-modified location max-forwards proxy-authorization referer retry-after user-agent".split(" "),nv=Yt.isStandardBrowserEnv()?function(){function t(n){return r&&(i.setAttribute("href",n),n=i.href),i.setAttribute("href",n),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:i.pathname.charAt(0)==="/"?i.pathname:"/"+i.pathname}}var e,r=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a");return e=t(window.location.href),function(n){return n=Yt.isString(n)?t(n):n,n.protocol===e.protocol&&n.host===e.host}}():function(){return!0},sv=Yt.isStandardBrowserEnv()?{write:function(t,e,r,i,n,c){var h=[];h.push(t+"="+encodeURIComponent(e)),Yt.isNumber(r)&&h.push("expires="+new Date(r).toGMTString()),Yt.isString(i)&&h.push("path="+i),Yt.isString(n)&&h.push("domain="+n),c===!0&&h.push("secure"),document.cookie=h.join("; ")},read:function(t){return(t=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)")))?decodeURIComponent(t[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},ov=function(t){return new Promise(function(e,r){var i=t.data,n=t.headers;Yt.isFormData(i)&&delete n["Content-Type"];var c=new XMLHttpRequest;if(t.auth&&(n.Authorization="Basic "+btoa((t.auth.username||"")+":"+(t.auth.password||""))),c.open(t.method.toUpperCase(),wf(t.url,t.params,t.paramsSerializer),!0),c.timeout=t.timeout,c.onreadystatechange=function(){if(c&&c.readyState===4&&(c.status!==0||c.responseURL&&c.responseURL.indexOf("file:")===0)){var C,x,Q,F,V,Y="getAllResponseHeaders"in c?(C=c.getAllResponseHeaders(),V={},C&&Yt.forEach(C.split(`
111
- `),function($){F=$.indexOf(":"),x=Yt.trim($.substr(0,F)).toLowerCase(),Q=Yt.trim($.substr(F+1)),!x||V[x]&&0<=iv.indexOf(x)||(V[x]=x==="set-cookie"?(V[x]?V[x]:[]).concat([Q]):V[x]?V[x]+", "+Q:Q)}),V):null;(function($,te,ce){var Ae=ce.config.validateStatus;!Ae||Ae(ce.status)?$(ce):te(Hl("Request failed with status code "+ce.status,ce.config,null,ce.request,ce))})(e,r,{data:t.responseType&&t.responseType!=="text"?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:Y,config:t,request:c}),c=null}},c.onabort=function(){c&&(r(Hl("Request aborted",t,"ECONNABORTED",c)),c=null)},c.onerror=function(){r(Hl("Network Error",t,null,c)),c=null},c.ontimeout=function(){r(Hl("timeout of "+t.timeout+"ms exceeded",t,"ECONNABORTED",c)),c=null},Yt.isStandardBrowserEnv()){var h=(t.withCredentials||nv(t.url))&&t.xsrfCookieName?sv.read(t.xsrfCookieName):void 0;h&&(n[t.xsrfHeaderName]=h)}if("setRequestHeader"in c&&Yt.forEach(n,function(C,x){i===void 0&&x.toLowerCase()==="content-type"?delete n[x]:c.setRequestHeader(x,C)}),t.withCredentials&&(c.withCredentials=!0),t.responseType)try{c.responseType=t.responseType}catch(C){if(t.responseType!=="json")throw C}typeof t.onDownloadProgress=="function"&&c.addEventListener("progress",t.onDownloadProgress),typeof t.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then(function(C){c&&(c.abort(),r(C),c=null)}),i===void 0&&(i=null),c.send(i)})},av={"Content-Type":"application/x-www-form-urlencoded"},Kl={adapter:function(){var t;return(typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"||typeof XMLHttpRequest!="undefined")&&(t=ov),t}(),transformRequest:[function(t,e){return bf(e,"Accept"),bf(e,"Content-Type"),Yt.isFormData(t)||Yt.isArrayBuffer(t)||Yt.isBuffer(t)||Yt.isStream(t)||Yt.isFile(t)||Yt.isBlob(t)?t:Yt.isArrayBufferView(t)?t.buffer:Yt.isURLSearchParams(t)?(Ds(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):Yt.isObject(t)?(Ds(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if(typeof t=="string")try{t=JSON.parse(t)}catch(e){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(t){return 200<=t&&300>t},headers:{common:{Accept:"application/json, text/plain, */*"}}};Yt.forEach(["delete","get","head"],function(t){Kl.headers[t]={}}),Yt.forEach(["post","put","patch"],function(t){Kl.headers[t]=Yt.merge(av)});var cv=function(t){var e,r;return t.cancelToken&&t.cancelToken.throwIfRequested(),t.baseURL&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t.url)&&(t.url=(e=t.baseURL,(r=t.url)?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e)),t.headers=t.headers||{},t.data=od(t.data,t.headers,t.transformRequest),t.headers=Yt.merge(t.headers.common||{},t.headers[t.method]||{},t.headers||{}),Yt.forEach("delete get head post put patch common".split(" "),function(i){delete t.headers[i]}),(t.adapter||Kl.adapter)(t).then(function(i){return t.cancelToken&&t.cancelToken.throwIfRequested(),i.data=od(i.data,i.headers,t.transformResponse),i},function(i){return Df(i)||(t.cancelToken&&t.cancelToken.throwIfRequested(),i&&i.response&&(i.response.data=od(i.response.data,i.response.headers,t.transformResponse))),Promise.reject(i)})},ad=function(t,e){e=e||{};var r={};return Yt.forEach(["url","method","params","data"],function(i){e[i]!==void 0&&(r[i]=e[i])}),Yt.forEach(["headers","auth","proxy"],function(i){Yt.isObject(e[i])?r[i]=Yt.deepMerge(t[i],e[i]):e[i]!==void 0?r[i]=e[i]:Yt.isObject(t[i])?r[i]=Yt.deepMerge(t[i]):t[i]!==void 0&&(r[i]=t[i])}),Yt.forEach("baseURL transformRequest transformResponse paramsSerializer timeout withCredentials adapter responseType xsrfCookieName xsrfHeaderName onUploadProgress onDownloadProgress maxContentLength validateStatus maxRedirects httpAgent httpsAgent cancelToken socketPath".split(" "),function(i){e[i]!==void 0?r[i]=e[i]:t[i]!==void 0&&(r[i]=t[i])}),r};Dn.prototype.request=function(t,e){typeof t=="string"?(t=e||{}).url=t:t=t||{},(t=ad(this.defaults,t)).method=t.method?t.method.toLowerCase():"get";var r=[cv,void 0];for(t=Promise.resolve(t),this.interceptors.request.forEach(function(i){r.unshift(i.fulfilled,i.rejected)}),this.interceptors.response.forEach(function(i){r.push(i.fulfilled,i.rejected)});r.length;)t=t.then(r.shift(),r.shift());return t},Dn.prototype.getUri=function(t){return t=ad(this.defaults,t),wf(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},Yt.forEach(["delete","get","head","options"],function(t){Dn.prototype[t]=function(e,r){return this.request(Yt.merge(r||{},{method:t,url:e}))}}),Yt.forEach(["post","put","patch"],function(t){Dn.prototype[t]=function(e,r,i){return this.request(Yt.merge(i||{},{method:t,url:e,data:r}))}});var jl=Dn;bs.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},bs.prototype.__CANCEL__=!0;var Of=bs;hs.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},hs.source=function(){var t;return{token:new hs(function(e){t=e}),cancel:t}};var Co=Vs(Kl);Co.Axios=jl,Co.create=function(t){return Vs(ad(Co.defaults,t))},Co.Cancel=Of,Co.CancelToken=hs,Co.isCancel=Df,Co.all=function(t){return Promise.all(t)},Co.spread=function(t){return function(e){return t.apply(null,e)}};var yo=Co.default=Co;let Qs={DEBUG:0,INFO:1,WARNING:2,ERROR:3,NONE:4},Bf=ot(),Nf=t=>{for(const e in Qs)if(Object.prototype.hasOwnProperty.call(Qs,e)&&Qs[e]===t)return e;return"DEFAULT"},z=new class{constructor(){this.logLevel=Qs.DEBUG,this.uploadState="collecting",this.uploadLogWaitingList=[],this.uploadLogUploadingList=[],this.currentLogID=this.uploadErrorCount=0}debug(...t){var e;t=ne(e=[Qs.DEBUG]).call(e,t),this.log.apply(this,t)}info(...t){var e;t=ne(e=[Qs.INFO]).call(e,t),this.log.apply(this,t)}warning(...t){var e;t=ne(e=[Qs.WARNING]).call(e,t),this.log.apply(this,t)}error(...t){var e;t=ne(e=[Qs.ERROR]).call(e,t),this.log.apply(this,t)}setLogLevel(t){this.logLevel=t=Math.min(Math.max(0,t),4)}enableLogUpload(){Rr("UPLOAD_LOG",!0)}disableLogUpload(){Rr("UPLOAD_LOG",!1),this.uploadLogUploadingList=[],this.uploadLogWaitingList=[]}setProxyServer(t){this.proxyServerURL=t}log(...t){var e,r,i,n;if(100>ot()-Bf)return void Is(()=>{this.log(...t)},ot()-Bf);const c=Math.max(0,Math.min(4,t[0]));if(t[0]=Os()+" Agora-SDK [".concat(Nf(c),"]:"),this.appendLogToWaitingList(c,t),!(c<this.logLevel)){var h=Os()+" %cAgora-SDK [".concat(Nf(c),"]:"),C=[];switch(c){case Qs.DEBUG:C=ne(e=[h,"color: #64B5F6;"]).call(e,$i(t).call(t,1)),console.log.apply(console,C);break;case Qs.INFO:C=ne(r=[h,"color: #1E88E5; font-weight: bold;"]).call(r,$i(t).call(t,1)),console.log.apply(console,C);break;case Qs.WARNING:C=ne(i=[h,"color: #FB8C00; font-weight: bold;"]).call(i,$i(t).call(t,1)),console.warn.apply(console,C);break;case Qs.ERROR:C=ne(n=[h,"color: #B00020; font-weight: bold;"]).call(n,$i(t).call(t,1)),console.error.apply(console,C)}}}appendLogToWaitingList(t,...e){if(Xe.UPLOAD_LOG){var r="";Re(e).call(e,i=>{typeof i=="object"&&(i=ht(i)),r+="".concat(i," ")}),this.uploadLogWaitingList.push({payload_str:r,log_level:t,log_item_id:this.currentLogID++}),this.uploadState==="uploading"&&this.uploadLogUploadingList.length===0&&this.uploadLogInterval()}}startUpload(){this.uploadState="uploading",this.uploadLogUploadingList.length===0&&this.uploadLogInterval()}uploadLogs(){return Ee(this,null,function*(){var t,e={sdk_version:as,process_id:Xe.PROCESS_ID,payload:ht(this.uploadLogUploadingList)};if(e=yield yo.post(this.url||(this.proxyServerURL?ne(t="https://".concat(this.proxyServerURL,"/ls/?h=")).call(t,Xe.LOG_UPLOAD_SERVER,"&p=443&d=upload/v1"):"https://".concat(Xe.LOG_UPLOAD_SERVER,"/upload/v1")),e,{responseType:"text"}),e.data!=="OK")throw Error("unexpected upload log response: "+e.data);this.uploadLogUploadingList=[]})}uploadLogInterval(){if(this.uploadLogUploadingList.length!==0||this.uploadLogWaitingList.length!==0){var t;this.uploadLogUploadingList.length===0&&(this.uploadLogUploadingList=un(t=this.uploadLogWaitingList).call(t,0,10)),this.uploadLogs().then(()=>{this.uploadErrorCount=0,0<this.uploadLogWaitingList.length&&window.setTimeout(()=>this.uploadLogInterval(),3e3)}).catch(e=>{this.uploadErrorCount+=1,2>this.uploadErrorCount?window.setTimeout(()=>this.uploadLogInterval(),200):window.setTimeout(()=>this.uploadLogInterval(),1e3)})}}};class ue{constructor(e,r="",i){var n;this.name="AgoraRTCException",this.code=e,this.message=ne(n="AgoraRTCError ".concat(this.code,": ")).call(n,r),this.data=i}toString(){var e;return this.data?ne(e="".concat(this.message," data: ")).call(e,ht(this.data)):this.message}print(e="error"){return e==="error"&&z.error(this.toString()),e==="warning"&&z.warning(this.toString()),this}throw(){throw this.print(),this}}var Pf,rn;(function(t){t.FREE="free",t.UPLOADING="uploading"})(Pf||(Pf={})),function(t){t.NONE="none",t.INIT="init",t.CANPLAY="canplay",t.PLAYING="playing",t.PAUSED="paused",t.SUSPEND="suspend",t.STALLED="stalled",t.WAITING="waiting",t.ERROR="error",t.DESTROYED="destroyed",t.ABORT="abort",t.ENDED="ended",t.EMPTIED="emptied"}(rn||(rn={})),Qt({target:"Number",stat:!0},{MAX_SAFE_INTEGER:9007199254740991}),Qt({target:"Number",stat:!0},{MIN_SAFE_INTEGER:-9007199254740991});let lv={sid:"",lts:0,success:null,cname:null,uid:null,peer:null,cid:null,elapse:null,extend:null,vid:0};var dn,gi,xf,bt,Dt,Pa,Wo,oc,Vc,cs,hn,Ot,er,qn,Di,ir,xr,Gs,Sr,Nt,Hs;(function(t){t.PUBLISH="publish",t.SUBSCRIBE="subscribe",t.SESSION_INIT="session_init",t.JOIN_CHOOSE_SERVER="join_choose_server",t.REQ_USER_ACCOUNT="req_user_account",t.JOIN_GATEWAY="join_gateway",t.STREAM_SWITCH="stream_switch",t.REQUEST_PROXY_WORKER_MANAGER="request_proxy_worker_manager",t.REQUEST_PROXY_APPCENTER="request_proxy_appcenter",t.FIRST_VIDEO_RECEIVED="first_video_received",t.FIRST_AUDIO_RECEIVED="first_audio_received",t.FIRST_VIDEO_DECODE="first_video_decode",t.FIRST_AUDIO_DECODE="first_audio_decode",t.ON_ADD_AUDIO_STREAM="on_add_audio_stream",t.ON_ADD_VIDEO_STREAM="on_add_video_stream",t.ON_UPDATE_STREAM="on_update_stream",t.ON_REMOVE_STREAM="on_remove_stream",t.USER_ANALYTICS="req_user_analytics"})(dn||(dn={})),function(t){t.SESSION="io.agora.pb.Wrtc.Session",t.JOIN_CHOOSE_SERVER="io.agora.pb.Wrtc.JoinChooseServer",t.REQ_USER_ACCOUNT="io.agora.pb.Wrtc.ReqUserAccount",t.JOIN_GATEWAT="io.agora.pb.Wrtc.JoinGateway",t.PUBLISH="io.agora.pb.Wrtc.Publish",t.SUBSCRIBE="io.agora.pb.Wrtc.Subscribe",t.STREAM_SWITCH="io.agora.pb.Wrtc.StreamSwitch",t.AUDIO_SENDING_STOPPED="io.agora.pb.Wrtc.AudioSendingStopped",t.VIDEO_SENDING_STOPPED="io.agora.pb.Wrtc.VideoSendingStopped",t.REQUEST_PROXY_APPCENTER="io.agora.pb.Wrtc.RequestProxyAppCenter",t.REQUEST_PROXY_WORKER_MANAGER="io.agora.pb.Wrtc.RequestProxyWorkerManager",t.API_INVOKE="io.agora.pb.Wrtc.ApiInvoke",t.FIRST_VIDEO_RECEIVED="io.agora.pb.Wrtc.FirstVideoReceived",t.FIRST_AUDIO_RECEIVED="io.agora.pb.Wrtc.FirstAudioReceived",t.FIRST_VIDEO_DECODE="io.agora.pb.Wrtc.FirstVideoDecode",t.FIRST_AUDIO_DECODE="io.agora.pb.Wrtc.FirstAudioDecode",t.ON_ADD_AUDIO_STREAM="io.agora.pb.Wrtc.OnAddAudioStream",t.ON_ADD_VIDEO_STREAM="io.agora.pb.Wrtc.OnAddVideoStream",t.ON_UPDATE_STREAM="io.agora.pb.Wrtc.OnUpdateStream",t.ON_REMOVE_STREAM="io.agora.pb.Wrtc.OnRemoveStream",t.JOIN_CHANNEL_TIMEOUT="io.agora.pb.Wrtc.JoinChannelTimeout",t.PEER_PUBLISH_STATUS="io.agora.pb.Wrtc.PeerPublishStatus",t.WORKER_EVENT="io.agora.pb.Wrtc.WorkerEvent",t.AP_WORKER_EVENT="io.agora.pb.Wrtc.APWorkerEvent",t.JOIN_WEB_PROXY_AP="io.agora.pb.Wrtc.JoinWebProxyAP",t.WEBSOCKET_QUIT="io.agora.pb.Wrtc.WebSocketQuit",t.USER_ANALYTICS="io.agora.pb.Wrtc.UserAnalytics"}(gi||(gi={})),function(t){t[t.WORKER_EVENT=156]="WORKER_EVENT",t[t.AP_WORKER_EVENT=160]="AP_WORKER_EVENT"}(xf||(xf={})),function(t){t.CREATE_CLIENT="createClient",t.CHECK_SYSTEM_REQUIREMENTS="checkSystemRequirements",t.SET_AREA="setArea",t.CHECK_VIDEO_TRACK_IS_ACTIVE="checkVideoTrackIsActive",t.CHECK_AUDIO_TRACK_IS_ACTIVE="checkAudioTrackIsActive",t.CREATE_MIC_AUDIO_TRACK="createMicrophoneAudioTrack",t.CREATE_CUSTOM_AUDIO_TRACK="createCustomAudioTrack",t.CREATE_BUFFER_AUDIO_TRACK="createBufferSourceAudioTrack",t.CREATE_CAM_VIDEO_TRACK="createCameraVideoTrack",t.CREATE_CUSTOM_VIDEO_TRACK="createCustomVideoTrack",t.CREATE_MIC_AND_CAM_TRACKS="createMicrophoneAndCameraTracks",t.CREATE_SCREEN_VIDEO_TRACK="createScreenVideoTrack",t.SET_ENCRYPTION_CONFIG="Client.setEncryptionConfig",t.START_PROXY_SERVER="Client.startProxyServer",t.STOP_PROXY_SERVER="Client.stopProxyServer",t.SET_PROXY_SERVER="Client.setProxyServer",t.SET_TURN_SERVER="Client.setTurnServer",t.SET_CLIENT_ROLE="Client.setClientRole",t.SET_LOW_STREAM_PARAMETER="Client.setLowStreamParameter",t.ENABLE_DUAL_STREAM="Client.enableDualStream",t.DISABLE_DUAL_STREAM="Client.disableDualStream",t.JOIN="Client.join",t.LEAVE="Client.leave",t.PUBLISH="Client.publish",t.UNPUBLISH="Client.unpublish",t.SUBSCRIBE="Client.subscribe",t.UNSUBSCRIBE="Client.unsubscribe",t.RENEW_TOKEN="Client.renewToken",t.SET_REMOTE_VIDEO_STREAM_TYPE="Client.setRemoteVideoStreamType",t.SET_STREAM_FALLBACK_OPTION="Client.setStreamFallbackOption",t.ENABLE_AUDIO_VOLUME_INDICATOR="Client.enableAudioVolumeIndicator",t.SEND_CUSTOM_REPORT_MESSAGE="Client.sendCustomReportMessage",t.ON_LIVE_STREAM_WARNING="Client.onLiveStreamWarning",t.ON_LIVE_STREAM_ERROR="Client.onLiveStreamingError",t.START_LIVE_STREAMING="Client.startLiveStreaming",t.SET_LIVE_TRANSCODING="Client.setLiveTranscoding",t.STOP_LIVE_STREAMING="Client.stopLiveStreaming",t.ADD_INJECT_STREAM_URL="Client.addInjectStreamUrl",t.REMOVE_INJECT_STREAM_URL="Client.removeInjectStreamUrl",t.START_CHANNEL_MEDIA_RELAY="Client.startChannelMediaRelay",t.UPDATE_CHANNEL_MEDIA_RELAY="Client.updateChannelMediaRelay",t.STOP_CHANNEL_MEDIA_RELAY="Client.stopChannelMediaRelay",t.REQUEST_CONFIG_DISTRIBUTE="_config-distribute-request",t.SET_CONFIG_DISTRIBUTE="_configDistribute",t.LOCAL_TRACK_SET_MUTED="LocalTrack.setMute",t.LOCAL_AUDIO_TRACK_PLAY="LocalAudioTrack.play",t.LOCAL_AUDIO_TRACK_PLAY_IN_ELEMENT="LocalAudioTrack.playInElement",t.LOCAL_AUDIO_TRACK_STOP="LocalAudioTrack.stop",t.LOCAL_AUDIO_TRACK_SET_VOLUME="LocalAudioTrack.setVolume",t.MIC_AUDIO_TRACK_SET_DEVICE="MicrophoneAudioTrack.setDevice",t.BUFFER_AUDIO_TRACK_START="BufferSourceAudioTrack.startProcessAudioBuffer",t.BUFFER_AUDIO_TRACK_STOP="BufferSourceAudioTrack.stopProcessAudioBuffer",t.BUFFER_AUDIO_TRACK_PAUSE="BufferSourceAudioTrack.pauseProcessAudioBuffer",t.BUFFER_AUDIO_TRACK_RESUME="BufferSourceAudioTrack.resumeProcessAudioBuffer",t.BUFFER_AUDIO_TRACK_SEEK="BufferSourceAudioTrack.seekAudioBuffer",t.LOCAL_VIDEO_TRACK_PLAY="LocalVideoTrack.play",t.LOCAL_VIDEO_TRACK_STOP="LocalVideoTrack.stop",t.LOCAL_VIDEO_TRACK_BEAUTY="LocalVideoTrack.setBeautyEffect",t.CAM_VIDEO_TRACK_SET_DEVICE="CameraVideoTrack.setDevice",t.CAM_VIDEO_TRACK_SET_ENCODER_CONFIG="CameraVideoTrack.setEncoderConfiguration",t.REMOTE_VIDEO_TRACK_PLAY="RemoteVideoTrack.play",t.REMOTE_VIDEO_TRACK_STOP="RemoteVideoTrack.stop",t.REMOTE_AUDIO_TRACK_PLAY="RemoteAudioTrack.play",t.REMOTE_AUDIO_TRACK_STOP="RemoteAudioTrack.stop",t.REMOTE_AUDIO_SET_VOLUME="RemoteAudioTrack.setVolume",t.REMOTE_AUDIO_SET_OUTPUT_DEVICE="RemoteAudioTrack.setOutputDevice",t.GET_MEDIA_STREAM_TRACK="Track.getMediaStreamTrack",t.STREAM_TYPE_CHANGE="streamTypeChange"}(bt||(bt={})),(Dt||(Dt={})).TRACER="tracer",function(t){t.IDLE="IDLE",t.INITING="INITING",t.INITEND="INITEND"}(Pa||(Pa={})),function(t){t.STATE_CHANGE="state_change",t.RECORDING_DEVICE_CHANGED="recordingDeviceChanged",t.PLAYOUT_DEVICE_CHANGED="playoutDeviceChanged",t.CAMERA_DEVICE_CHANGED="cameraDeviceChanged"}(Wo||(Wo={})),function(t){t[t.ACCESS_POINT=101]="ACCESS_POINT",t[t.UNILBS=201]="UNILBS",t[t.STRING_UID_ALLOCATOR=901]="STRING_UID_ALLOCATOR"}(oc||(oc={})),function(t){t[t.IIIEGAL_APPID=1]="IIIEGAL_APPID",t[t.IIIEGAL_UID=2]="IIIEGAL_UID",t[t.INTERNAL_ERROR=3]="INTERNAL_ERROR"}(Vc||(Vc={})),function(t){t[t.INVALID_VENDOR_KEY=5]="INVALID_VENDOR_KEY",t[t.INVALID_CHANNEL_NAME=7]="INVALID_CHANNEL_NAME",t[t.INTERNAL_ERROR=8]="INTERNAL_ERROR",t[t.NO_AUTHORIZED=9]="NO_AUTHORIZED",t[t.DYNAMIC_KEY_TIMEOUT=10]="DYNAMIC_KEY_TIMEOUT",t[t.NO_ACTIVE_STATUS=11]="NO_ACTIVE_STATUS",t[t.DYNAMIC_KEY_EXPIRED=13]="DYNAMIC_KEY_EXPIRED",t[t.STATIC_USE_DYNAMIC_KEY=14]="STATIC_USE_DYNAMIC_KEY",t[t.DYNAMIC_USE_STATIC_KEY=15]="DYNAMIC_USE_STATIC_KEY",t[t.USER_OVERLOAD=16]="USER_OVERLOAD",t[t.FORBIDDEN_REGION=18]="FORBIDDEN_REGION",t[t.CANNOT_MEET_AREA_DEMAND=19]="CANNOT_MEET_AREA_DEMAND"}(cs||(cs={})),function(t){t[t.NO_FLAG_SET=100]="NO_FLAG_SET",t[t.FLAG_SET_BUT_EMPTY=101]="FLAG_SET_BUT_EMPTY",t[t.INVALID_FALG_SET=102]="INVALID_FALG_SET",t[t.NO_SERVICE_AVAILABLE=200]="NO_SERVICE_AVAILABLE",t[t.NO_SERVICE_AVAILABLE_P2P=201]="NO_SERVICE_AVAILABLE_P2P",t[t.NO_SERVICE_AVAILABLE_VOICE=202]="NO_SERVICE_AVAILABLE_VOICE",t[t.NO_SERVICE_AVAILABLE_WEBRTC=203]="NO_SERVICE_AVAILABLE_WEBRTC",t[t.NO_SERVICE_AVAILABLE_CDS=204]="NO_SERVICE_AVAILABLE_CDS",t[t.NO_SERVICE_AVAILABLE_CDN=205]="NO_SERVICE_AVAILABLE_CDN",t[t.NO_SERVICE_AVAILABLE_TDS=206]="NO_SERVICE_AVAILABLE_TDS",t[t.NO_SERVICE_AVAILABLE_REPORT=207]="NO_SERVICE_AVAILABLE_REPORT",t[t.NO_SERVICE_AVAILABLE_APP_CENTER=208]="NO_SERVICE_AVAILABLE_APP_CENTER",t[t.NO_SERVICE_AVAILABLE_ENV0=209]="NO_SERVICE_AVAILABLE_ENV0",t[t.NO_SERVICE_AVAILABLE_VOET=210]="NO_SERVICE_AVAILABLE_VOET",t[t.NO_SERVICE_AVAILABLE_STRING_UID=211]="NO_SERVICE_AVAILABLE_STRING_UID",t[t.NO_SERVICE_AVAILABLE_WEBRTC_UNILBS=212]="NO_SERVICE_AVAILABLE_WEBRTC_UNILBS",t[t.NO_SERVICE_AVAILABLE_UNILBS_FLV=213]="NO_SERVICE_AVAILABLE_UNILBS_FLV"}(hn||(hn={})),function(t){t[t.K_TIMESTAMP_EXPIRED=2]="K_TIMESTAMP_EXPIRED",t[t.K_CHANNEL_PERMISSION_INVALID=3]="K_CHANNEL_PERMISSION_INVALID",t[t.K_CERTIFICATE_INVALID=4]="K_CERTIFICATE_INVALID",t[t.K_CHANNEL_NAME_EMPTY=5]="K_CHANNEL_NAME_EMPTY",t[t.K_CHANNEL_NOT_FOUND=6]="K_CHANNEL_NOT_FOUND",t[t.K_TICKET_INVALID=7]="K_TICKET_INVALID",t[t.K_CHANNEL_CONFLICTED=8]="K_CHANNEL_CONFLICTED",t[t.K_SERVICE_NOT_READY=9]="K_SERVICE_NOT_READY",t[t.K_SERVICE_TOO_HEAVY=10]="K_SERVICE_TOO_HEAVY",t[t.K_UID_BANNED=14]="K_UID_BANNED",t[t.K_IP_BANNED=15]="K_IP_BANNED",t[t.K_CHANNEL_BANNED=16]="K_CHANNEL_BANNED",t[t.WARN_NO_AVAILABLE_CHANNEL=103]="WARN_NO_AVAILABLE_CHANNEL",t[t.WARN_LOOKUP_CHANNEL_TIMEOUT=104]="WARN_LOOKUP_CHANNEL_TIMEOUT",t[t.WARN_LOOKUP_CHANNEL_REJECTED=105]="WARN_LOOKUP_CHANNEL_REJECTED",t[t.WARN_OPEN_CHANNEL_TIMEOUT=106]="WARN_OPEN_CHANNEL_TIMEOUT",t[t.WARN_OPEN_CHANNEL_REJECTED=107]="WARN_OPEN_CHANNEL_REJECTED",t[t.WARN_REQUEST_DEFERRED=108]="WARN_REQUEST_DEFERRED",t[t.ERR_DYNAMIC_KEY_TIMEOUT=109]="ERR_DYNAMIC_KEY_TIMEOUT",t[t.ERR_NO_AUTHORIZED=110]="ERR_NO_AUTHORIZED",t[t.ERR_VOM_SERVICE_UNAVAILABLE=111]="ERR_VOM_SERVICE_UNAVAILABLE",t[t.ERR_NO_CHANNEL_AVAILABLE_CODE=112]="ERR_NO_CHANNEL_AVAILABLE_CODE",t[t.ERR_MASTER_VOCS_UNAVAILABLE=114]="ERR_MASTER_VOCS_UNAVAILABLE",t[t.ERR_INTERNAL_ERROR=115]="ERR_INTERNAL_ERROR",t[t.ERR_NO_ACTIVE_STATUS=116]="ERR_NO_ACTIVE_STATUS",t[t.ERR_INVALID_UID=117]="ERR_INVALID_UID",t[t.ERR_DYNAMIC_KEY_EXPIRED=118]="ERR_DYNAMIC_KEY_EXPIRED",t[t.ERR_STATIC_USE_DYANMIC_KE=119]="ERR_STATIC_USE_DYANMIC_KE",t[t.ERR_DYNAMIC_USE_STATIC_KE=120]="ERR_DYNAMIC_USE_STATIC_KE",t[t.ERR_NO_VOCS_AVAILABLE=2e3]="ERR_NO_VOCS_AVAILABLE",t[t.ERR_NO_VOS_AVAILABLE=2001]="ERR_NO_VOS_AVAILABLE",t[t.ERR_JOIN_CHANNEL_TIMEOUT=2002]="ERR_JOIN_CHANNEL_TIMEOUT",t[t.ERR_REPEAT_JOIN_CHANNEL=2003]="ERR_REPEAT_JOIN_CHANNEL",t[t.ERR_JOIN_BY_MULTI_IP=2004]="ERR_JOIN_BY_MULTI_IP",t[t.ERR_NOT_JOINED=2011]="ERR_NOT_JOINED",t[t.ERR_REPEAT_JOIN_REQUEST=2012]="ERR_REPEAT_JOIN_REQUEST",t[t.ERR_INVALID_VENDOR_KEY=2013]="ERR_INVALID_VENDOR_KEY",t[t.ERR_INVALID_CHANNEL_NAME=2014]="ERR_INVALID_CHANNEL_NAME",t[t.ERR_INVALID_STRINGUID=2015]="ERR_INVALID_STRINGUID",t[t.ERR_TOO_MANY_USERS=2016]="ERR_TOO_MANY_USERS",t[t.ERR_SET_CLIENT_ROLE_TIMEOUT=2017]="ERR_SET_CLIENT_ROLE_TIMEOUT",t[t.ERR_SET_CLIENT_ROLE_NO_PERMISSION=2018]="ERR_SET_CLIENT_ROLE_NO_PERMISSION",t[t.ERR_SET_CLIENT_ROLE_ALREADY_IN_USE=2019]="ERR_SET_CLIENT_ROLE_ALREADY_IN_USE",t[t.ERR_PUBLISH_REQUEST_INVALID=2020]="ERR_PUBLISH_REQUEST_INVALID",t[t.ERR_SUBSCRIBE_REQUEST_INVALID=2021]="ERR_SUBSCRIBE_REQUEST_INVALID",t[t.ERR_NOT_SUPPORTED_MESSAGE=2022]="ERR_NOT_SUPPORTED_MESSAGE",t[t.ERR_ILLEAGAL_PLUGIN=2023]="ERR_ILLEAGAL_PLUGIN",t[t.ERR_REJOIN_TOKEN_INVALID=2024]="ERR_REJOIN_TOKEN_INVALID",t[t.ERR_REJOIN_USER_NOT_JOINED=2025]="ERR_REJOIN_USER_NOT_JOINED",t[t.ERR_INVALID_OPTIONAL_INFO=2027]="ERR_INVALID_OPTIONAL_INFO",t[t.ILLEGAL_AES_PASSWORD=2028]="ILLEGAL_AES_PASSWORD",t[t.ILLEGAL_CLIENT_ROLE_LEVEL=2029]="ILLEGAL_CLIENT_ROLE_LEVEL",t[t.ERR_TEST_RECOVER=9e3]="ERR_TEST_RECOVER",t[t.ERR_TEST_TRYNEXT=9001]="ERR_TEST_TRYNEXT",t[t.ERR_TEST_RETRY=9002]="ERR_TEST_RETRY"}(Ot||(Ot={})),function(t){t.CONNECTION_STATE_CHANGE="connection-state-change",t.MEDIA_RECONNECT_START="media-reconnect-start",t.MEDIA_RECONNECT_END="media-reconnect-end",t.IS_USING_CLOUD_PROXY="is-using-cloud-proxy",t.USER_JOINED="user-joined",t.USER_LEAVED="user-left",t.USER_PUBLISHED="user-published",t.USER_UNPUBLISHED="user-unpublished",t.USER_INFO_UPDATED="user-info-updated",t.CLIENT_BANNED="client-banned",t.CHANNEL_MEDIA_RELAY_STATE="channel-media-relay-state",t.CHANNEL_MEDIA_RELAY_EVENT="channel-media-relay-event",t.VOLUME_INDICATOR="volume-indicator",t.CRYPT_ERROR="crypt-error",t.ON_TOKEN_PRIVILEGE_WILL_EXPIRE="token-privilege-will-expire",t.ON_TOKEN_PRIVILEGE_DID_EXPIRE="token-privilege-did-expire",t.NETWORK_QUALITY="network-quality",t.STREAM_TYPE_CHANGED="stream-type-changed",t.STREAM_FALLBACK="stream-fallback",t.RECEIVE_METADATA="receive-metadata",t.STREAM_MESSAGE="stream-message",t.LIVE_STREAMING_ERROR="live-streaming-error",t.LIVE_STREAMING_WARNING="live-streaming-warning",t.INJECT_STREAM_STATUS="stream-inject-status",t.EXCEPTION="exception",t.ERROR="error",t.P2P_LOST="p2p_lost"}(er||(er={})),function(t){t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.MULTI_IP="MULTI_IP",t.TIMEOUT="TIMEOUT",t.OFFLINE="OFFLINE",t.LEAVE="LEAVE"}(qn||(qn={})),function(t){t.CONNECTING="connecting",t.CONNECTED="connected",t.RECONNECTING="reconnecting",t.CLOSED="closed"}(Di||(Di={})),function(t){t.WS_CONNECTED="ws_connected",t.WS_RECONNECTING="ws_reconnecting",t.WS_CLOSED="ws_closed",t.ON_BINARY_DATA="on_binary_data",t.REQUEST_RECOVER="request_recover",t.REQUEST_JOIN_INFO="request_join_info",t.REQUEST_REJOIN_INFO="req_rejoin_info",t.IS_P2P_DISCONNECTED="is_p2p_dis",t.DISCONNECT_P2P="dis_p2p",t.NEED_RENEW_SESSION="need-sid",t.REPORT_JOIN_GATEWAY="report_join_gateway",t.REQUEST_TIMEOUT="request_timeout",t.REQUEST_SUCCESS="request_success"}(ir||(ir={})),function(t){t.PING="ping",t.PING_BACK="ping_back",t.JOIN="join_v2",t.REJOIN="rejoin",t.LEAVE="leave",t.SET_CLIENT_ROLE="set_client_role",t.PUBLISH="publish",t.UNPUBLISH="unpublish",t.SUBSCRIBE="subscribe",t.UNSUBSCRIBE="unsubscribe",t.SUBSCRIBE_CHANGE="subscribe_change",t.TRAFFIC_STATS="traffic_stats",t.RENEW_TOKEN="renew_token",t.SWITCH_VIDEO_STREAM="switch_video_stream",t.SET_FALLBACK_OPTION="set_fallback_option",t.GATEWAY_INFO="gateway_info",t.CONTROL="control",t.SEND_METADATA="send_metadata",t.DATA_STREAM="data_stream",t.PICK_SVC_LAYER="pick_svc_layer"}(xr||(xr={})),function(t){t.PUBLISH_STATS="publish_stats",t.PUBLISH_RELATED_STATS="publish_related_stats",t.SUBSCRIBE_STATS="subscribe_stats",t.SUBSCRIBE_RELATED_STATS="subscribe_related_stats",t.WS_INFLATE_DATA_LENGTH="ws_inflate_data_length"}(Gs||(Gs={})),function(t){t.ON_USER_ONLINE="on_user_online",t.ON_USER_OFFLINE="on_user_offline",t.ON_STREAM_FALLBACK_UPDATE="on_stream_fallback_update",t.ON_PUBLISH_STREAM="on_publish_stream",t.ON_UPLINK_STATS="on_uplink_stats",t.ON_P2P_LOST="on_p2p_lost",t.ON_REMOVE_STREAM="on_remove_stream",t.ON_ADD_AUDIO_STREAM="on_add_audio_stream",t.ON_ADD_VIDEO_STREAM="on_add_video_stream",t.ON_TOKEN_PRIVILEGE_WILL_EXPIRE="on_token_privilege_will_expire",t.ON_TOKEN_PRIVILEGE_DID_EXPIRE="on_token_privilege_did_expire",t.ON_USER_BANNED="on_user_banned",t.ON_NOTIFICATION="on_notification",t.ON_CRYPT_ERROR="on_crypt_error",t.MUTE_AUDIO="mute_audio",t.MUTE_VIDEO="mute_video",t.UNMUTE_AUDIO="unmute_audio",t.UNMUTE_VIDEO="unmute_video",t.RECEIVE_METADATA="receive_metadata",t.ON_DATA_STREAM="on_data_stream",t.ENABLE_LOCAL_VIDEO="enable_local_video",t.DISABLE_LOCAL_VIDEO="disable_local_video",t.ENABLE_LOCAL_AUDIO="enable_local_audio",t.DISABLE_LOCAL_AUDIO="disable_local_audio"}(Sr||(Sr={})),function(t){t.CONNECTION_STATE_CHANGE="CONNECTION_STATE_CHANGE",t.NEED_ANSWER="NEED_ANSWER",t.NEED_RENEGOTIATE="NEED_RENEGOTIATE",t.P2P_LOST="P2P_LOST",t.GATEWAY_P2P_LOST="GATEWAY_P2P_LOST",t.NEED_UNPUB="NEED_UNPUB",t.NEED_UNSUB="NEED_UNSUB",t.NEED_UPLOAD="NEED_UPLOAD",t.NEED_CONTROL="NEED_CONTROL",t.START_RECONNECT="START_RECONNECT",t.END_RECONNECT="END_RECONNECT",t.NEED_SIGNAL_RTT="NEED_SIGNAL_RTT"}(Nt||(Nt={})),function(t){t.AUDIO_SOURCE_STATE_CHANGE="audio_source_state_change",t.RECEIVE_TRACK_BUFFER="receive_track_buffer",t.ON_AUDIO_BUFFER="on_audio_buffer"}(Hs||(Hs={}));let Wl={sendVolumeLevel:0,sendBitrate:0,sendBytes:0,sendPackets:0,sendPacketsLost:0,currentPacketLossRate:0},Vl={sendBytes:0,sendBitrate:0,sendPackets:0,sendPacketsLost:0,sendResolutionHeight:0,sendResolutionWidth:0,captureResolutionHeight:0,captureResolutionWidth:0,targetSendBitrate:0,totalDuration:0,totalFreezeTime:0,currentPacketLossRate:0},cd={transportDelay:0,end2EndDelay:0,receiveBitrate:0,receiveLevel:0,receiveBytes:0,receiveDelay:0,receivePackets:0,receivePacketsLost:0,totalDuration:0,totalFreezeTime:0,freezeRate:0,packetLossRate:0,currentPacketLossRate:0,publishDuration:-1},Mf={uplinkNetworkQuality:0,downlinkNetworkQuality:0},ld={transportDelay:0,end2EndDelay:0,receiveBitrate:0,receiveBytes:0,receiveDelay:0,receivePackets:0,receivePacketsLost:0,receiveResolutionHeight:0,receiveResolutionWidth:0,totalDuration:0,totalFreezeTime:0,freezeRate:0,packetLossRate:0,currentPacketLossRate:0,publishDuration:-1};var pr,Ei;(function(t){t.CONNECTED="websocket:connected",t.RECONNECTING="websocket:reconnecting",t.WILL_RECONNECT="websocket:will_reconnect",t.CLOSED="websocket:closed",t.FAILED="websocket:failed",t.ON_MESSAGE="websocket:on_message",t.REQUEST_NEW_URLS="websocket:request_new_urls"})(pr||(pr={})),function(t){t.TRANSCODE="mix_streaming",t.RAW="raw_streaming",t.INJECT="inject_streaming"}(Ei||(Ei={}));let uv={alpha:1,height:640,width:360,x:0,y:0,zOrder:0,audioChannel:0},ud={x:0,y:0,width:160,height:160,zOrder:255,alpha:1},dv={audioBitrate:48,audioChannels:1,audioSampleRate:48e3,backgroundColor:0,height:360,lowLatency:!1,videoBitrate:400,videoCodecProfile:100,videoCodecType:1,videoFrameRate:15,videoGop:30,width:640,images:[],userConfigs:[],userConfigExtraInfo:""},hv={audioBitrate:48,audioChannels:2,audioVolume:100,audioSampleRate:48e3,height:0,width:0,videoBitrate:400,videoFramerate:15,videoGop:30};var Ks,ac,Xr,kf,fn,ji,xt,to,xa,Yc;(function(t){t.WARNING="@live_uap-warning",t.ERROR="@line_uap-error",t.PUBLISH_STREAM_STATUS="@live_uap-publish-status",t.INJECT_STREAM_STATUS="@live_uap-inject-status",t.WORKER_STATUS="@live_uap-worker-status",t.REQUEST_NEW_ADDRESS="@live_uap-request-address"})(Ks||(Ks={})),(ac||(ac={})).REQUEST_WORKER_MANAGER_LIST="@live_req_worker_manager",function(t){t[t.LIVE_STREAM_RESPONSE_SUCCEED=200]="LIVE_STREAM_RESPONSE_SUCCEED",t[t.LIVE_STREAM_RESPONSE_ALREADY_EXISTS_STREAM=454]="LIVE_STREAM_RESPONSE_ALREADY_EXISTS_STREAM",t[t.LIVE_STREAM_RESPONSE_TRANSCODING_PARAMETER_ERROR=450]="LIVE_STREAM_RESPONSE_TRANSCODING_PARAMETER_ERROR",t[t.LIVE_STREAM_RESPONSE_BAD_STREAM=451]="LIVE_STREAM_RESPONSE_BAD_STREAM",t[t.LIVE_STREAM_RESPONSE_WM_PARAMETER_ERROR=400]="LIVE_STREAM_RESPONSE_WM_PARAMETER_ERROR",t[t.LIVE_STREAM_RESPONSE_WM_WORKER_NOT_EXIST=404]="LIVE_STREAM_RESPONSE_WM_WORKER_NOT_EXIST",t[t.LIVE_STREAM_RESPONSE_NOT_AUTHORIZED=456]="LIVE_STREAM_RESPONSE_NOT_AUTHORIZED",t[t.LIVE_STREAM_RESPONSE_FAILED_LOAD_IMAGE=457]="LIVE_STREAM_RESPONSE_FAILED_LOAD_IMAGE",t[t.LIVE_STREAM_RESPONSE_REQUEST_TOO_OFTEN=429]="LIVE_STREAM_RESPONSE_REQUEST_TOO_OFTEN",t[t.LIVE_STREAM_RESPONSE_NOT_FOUND_PUBLISH=452]="LIVE_STREAM_RESPONSE_NOT_FOUND_PUBLISH",t[t.LIVE_STREAM_RESPONSE_NOT_SUPPORTED=453]="LIVE_STREAM_RESPONSE_NOT_SUPPORTED",t[t.LIVE_STREAM_RESPONSE_MAX_STREAM_NUM=455]="LIVE_STREAM_RESPONSE_MAX_STREAM_NUM",t[t.LIVE_STREAM_RESPONSE_INTERNAL_SERVER_ERROR=500]="LIVE_STREAM_RESPONSE_INTERNAL_SERVER_ERROR",t[t.LIVE_STREAM_RESPONSE_WORKER_LOST=501]="LIVE_STREAM_RESPONSE_WORKER_LOST",t[t.LIVE_STREAM_RESPONSE_RESOURCE_LIMIT=502]="LIVE_STREAM_RESPONSE_RESOURCE_LIMIT",t[t.LIVE_STREAM_RESPONSE_WORKER_QUIT=503]="LIVE_STREAM_RESPONSE_WORKER_QUIT",t[t.ERROR_FAIL_SEND_MESSAGE=504]="ERROR_FAIL_SEND_MESSAGE",t[t.PUBLISH_STREAM_STATUS_ERROR_RTMP_HANDSHAKE=30]="PUBLISH_STREAM_STATUS_ERROR_RTMP_HANDSHAKE",t[t.PUBLISH_STREAM_STATUS_ERROR_RTMP_CONNECT=31]="PUBLISH_STREAM_STATUS_ERROR_RTMP_CONNECT",t[t.PUBLISH_STREAM_STATUS_ERROR_RTMP_PUBLISH=32]="PUBLISH_STREAM_STATUS_ERROR_RTMP_PUBLISH",t[t.PUBLISH_STREAM_STATUS_ERROR_PUBLISH_BROKEN=33]="PUBLISH_STREAM_STATUS_ERROR_PUBLISH_BROKEN"}(Xr||(Xr={})),function(t){t.CONNECT_FAILED="connect failed",t.CONNECT_TIMEOUT="connect timeout",t.WS_DISCONNECTED="websocket disconnected",t.REQUEST_TIMEOUT="request timeout",t.REQUEST_FAILED="request failed",t.WAIT_STATUS_TIMEOUT="wait status timeout",t.WAIT_STATUS_ERROR="wait status error",t.BAD_STATE="bad state",t.WS_ABORT="ws abort",t.AP_REQUEST_TIMEOUT="AP request timeout",t.AP_JSON_PARSE_ERROR="AP json parse error",t.AP_REQUEST_ERROR="AP request error",t.AP_REQUEST_ABORT="AP request abort"}(kf||(kf={})),function(t){t[t.SetSdkProfile=0]="SetSdkProfile",t[t.SetSourceChannel=1]="SetSourceChannel",t[t.SetSourceUserId=2]="SetSourceUserId",t[t.SetDestChannel=3]="SetDestChannel",t[t.StartPacketTransfer=4]="StartPacketTransfer",t[t.StopPacketTransfer=5]="StopPacketTransfer",t[t.UpdateDestChannel=6]="UpdateDestChannel",t[t.Reconnect=7]="Reconnect",t[t.SetVideoProfile=8]="SetVideoProfile"}(fn||(fn={})),function(t){t.DISCONNECT="disconnect",t.CONNECTION_STATE_CHANGE="connection-state-change",t.NETWORK_QUALITY="network-quality",t.STREAM_TYPE_CHANGE="stream-type-change",t.IS_P2P_DISCONNECTED="is-p2p-dis",t.DISCONNECT_P2P="dis-p2p",t.REQUEST_NEW_GATEWAY_LIST="req-gate-url",t.NEED_RENEW_SESSION="need-sid"}(ji||(ji={})),function(t){t.NEED_RENEGOTIATE="@need_renegotiate",t.NEED_REPLACE_TRACK="@need_replace_track",t.NEED_CLOSE="@need_close",t.NEED_ADD_TRACK="@need_add_track",t.NEED_REMOVE_TRACK="@need_remove_track",t.NEED_SESSION_ID="@need_sid",t.SET_OPTIMIZATION_MODE="@set_optimization_mode",t.GET_STATS="@get_stats",t.GET_LOW_VIDEO_TRACK="@get_low_video_track",t.NEED_RESET_REMOTE_SDP="@need_reset_remote_sdp",t.SET_VIDEO_TRACK_MUTED="@set_video_track_muted",t.SET_AUDIO_TRACK_MUTED="@set_audio_track_muted"}(xt||(xt={})),function(t){t.SCREEN_TRACK="screen_track",t.LOW_STREAM="low_stream"}(to||(to={})),function(t){t.SOURCE_STATE_CHANGE="source-state-change",t.TRACK_ENDED="track-ended",t.BEAUTY_EFFECT_OVERLOAD="beauty-effect-overload"}(xa||(xa={})),(Yc||(Yc={})).FIRST_FRAME_DECODED="first-frame-decoded";let Uf="AFRICA ASIA CHINA EUROPE GLOBAL INDIA JAPAN NORTH_AMERICA OCEANIA OVERSEA SOUTH_AMERICA".split(" ");var Wi;(function(t){t.CHINA="CN",t.ASIA="AS",t.NORTH_AMERICA="NA",t.EUROPE="EU",t.JAPAN="JP",t.INDIA="IN",t.OCEANIA="OC",t.SOUTH_AMERICA="SA",t.AFRICA="AF",t.OVERSEA="OVERSEA",t.GLOBAL="GLOBAL"})(Wi||(Wi={}));let dd={CHINA:{},ASIA:{CODE:Wi.ASIA,WEBCS_DOMAIN:["ap-web-1-asia.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-asia.agora.io"],PROXY_CS:["proxy-ap-web-asia.agora.io"],CDS_AP:["cds-ap-web-asia.agora.io","cds-ap-web-asia2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-asia.agora.io","sua-ap-web-asia2.agora.io"],UAP_AP:["uap-ap-web-asia.agora.io","uap-ap-web-asia2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-asia.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-asia.agora.io"],LOG_UPLOAD_SERVER:["logservice-asia.agora.io"],PROXY_SERVER_TYPE3:["southeast-asia.webrtc-cloud-proxy.sd-rtn.com"]},NORTH_AMERICA:{CODE:Wi.NORTH_AMERICA,WEBCS_DOMAIN:["ap-web-1-north-america.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-north-america.agora.io"],PROXY_CS:["proxy-ap-web-america.agora.io"],CDS_AP:["cds-ap-web-america.agora.io","cds-ap-web-america2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-america.agora.io","sua-ap-web-america2.agora.io"],UAP_AP:["uap-ap-web-america.agora.io","uap-ap-web-america2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-north-america.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-north-america.agora.io"],LOG_UPLOAD_SERVER:["logservice-north-america.agora.io"],PROXY_SERVER_TYPE3:["east-usa.webrtc-cloud-proxy.sd-rtn.com"]},EUROPE:{CODE:Wi.EUROPE,WEBCS_DOMAIN:["ap-web-1-europe.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-europe.agora.io"],PROXY_CS:["proxy-ap-web-europe.agora.io"],CDS_AP:["cds-ap-web-europe.agora.io","cds-ap-web-europe2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-europe.agora.io","sua-ap-web-europe.agora.io"],UAP_AP:["uap-ap-web-europe.agora.io","uap-ap-web-europe2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-europe.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-europe.agora.io"],LOG_UPLOAD_SERVER:["logservice-europe.agora.io"],PROXY_SERVER_TYPE3:["europe.webrtc-cloud-proxy.sd-rtn.com"]},JAPAN:{CODE:Wi.JAPAN,WEBCS_DOMAIN:["ap-web-1-japan.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-japan.agora.io"],PROXY_CS:["proxy-ap-web-japan.agora.io"],CDS_AP:["cds-ap-web-japan.agora.io","cds-ap-web-japan2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-japan.agora.io","sua-ap-web-japan2.agora.io"],UAP_AP:["uap-ap-web-japan.agora.io"," uap-ap-web-japan2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-japan.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-japan.agora.io"],LOG_UPLOAD_SERVER:["logservice-japan.agora.io"],PROXY_SERVER_TYPE3:["japan.webrtc-cloud-proxy.sd-rtn.com"]},INDIA:{CODE:Wi.INDIA,WEBCS_DOMAIN:["ap-web-1-india.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-india.agora.io"],PROXY_CS:["proxy-ap-web-india.agora.io"],CDS_AP:["cds-ap-web-india.agora.io","cds-ap-web-india2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-india.agora.io","sua-ap-web-india2.agora.io"],UAP_AP:["uap-ap-web-india.agora.io","uap-ap-web-india2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-india.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-india.agora.io"],LOG_UPLOAD_SERVER:["logservice-india.agora.io"],PROXY_SERVER_TYPE3:["india.webrtc-cloud-proxy.sd-rtn.com"]},OVERSEA:{CODE:Wi.OVERSEA,WEBCS_DOMAIN:["ap-web-1-oversea.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-oversea.agora.io"],PROXY_CS:["proxy-ap-web-oversea.agora.io"],CDS_AP:["cds-ap-web-oversea.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-oversea.agora.io"],UAP_AP:["uap-ap-web-oversea.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-oversea.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-oversea.agora.io"],LOG_UPLOAD_SERVER:["logservice-oversea.agora.io"],PROXY_SERVER_TYPE3:["webrtc-cloud-proxy.agora.io"]},GLOBAL:{CODE:Wi.GLOBAL,WEBCS_DOMAIN:["webrtc2-ap-web-1.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["webrtc2-ap-web-3.agora.io"],PROXY_CS:["ap-proxy-1.agora.io","ap-proxy-2.agora.io"],CDS_AP:["cds-ap-web-1.agora.io","cds-ap-web-3.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-1.agora.io","sua-ap-web-3.agora.io"],UAP_AP:["uap-ap-web-1.agora.io","uap-ap-web-3.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2.agora.io"],LOG_UPLOAD_SERVER:["logservice.agora.io"],PROXY_SERVER_TYPE3:["webrtc-cloud-proxy.sd-rtn.com"]},OCEANIA:{CODE:Wi.OCEANIA,WEBCS_DOMAIN:["ap-web-1-oceania.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-oceania.agora.io"],PROXY_CS:["proxy-ap-web-oceania.agora.io"],CDS_AP:["cds-ap-web-oceania.agora.io","cds-ap-web-oceania2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-oceania.agora.io","sua-ap-web-oceania2.agora.io"],UAP_AP:["uap-ap-web-oceania.agora.io","uap-ap-web-oceania2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-oceania.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-oceania.agora.io"],LOG_UPLOAD_SERVER:["logservice-oceania.agora.io"],PROXY_SERVER_TYPE3:["oceania.webrtc-cloud-proxy.sd-rtn.com"]},SOUTH_AMERICA:{CODE:Wi.SOUTH_AMERICA,WEBCS_DOMAIN:["ap-web-1-south-america.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-south-america.agora.io"],PROXY_CS:["proxy-ap-web-south-america.agora.io"],CDS_AP:["cds-ap-web-south-america.agora.io","cds-ap-web-south-america2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-south-america.agora.io","sua-ap-web-south-america2.agora.io"],UAP_AP:["uap-ap-web-south-america.agora.io","uap-ap-web-south-america2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-south-america.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-south-america.agora.io"],LOG_UPLOAD_SERVER:["logservice-south-america.agora.io"],PROXY_SERVER_TYPE3:["south-america.webrtc-cloud-proxy.sd-rtn.com"]},AFRICA:{CODE:Wi.AFRICA,WEBCS_DOMAIN:["ap-web-1-africa.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-africa.agora.io"],PROXY_CS:["proxy-ap-web-africa.agora.io"],CDS_AP:["cds-ap-web-africa.agora.io","cds-ap-web-africa2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-africa.agora.io","sua-ap-web-africa2.agora.io"],UAP_AP:["uap-ap-web-africa.agora.io","uap-ap-web-africa2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-africa.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-africa.agora.io"],LOG_UPLOAD_SERVER:["logservice-south-africa.agora.io"],PROXY_SERVER_TYPE3:["africa.webrtc-cloud-proxy.sd-rtn.com"]}};var Jc,js,cc;nd&&(dd.CHINA={CODE:Wi.CHINA,WEBCS_DOMAIN:["webrtc2-2.ap.sd-rtn.com"],WEBCS_DOMAIN_BACKUP_LIST:["webrtc2-4.ap.sd-rtn.com"],PROXY_CS:["proxy-web.ap.sd-rtn.com"],CDS_AP:["cds-web-2.ap.sd-rtn.com","cds-web-4.ap.sd-rtn.com"],ACCOUNT_REGISTER:["sua-web-2.ap.sd-rtn.com","sua-web-4.ap.sd-rtn.com"],UAP_AP:["uap-web-2.ap.sd-rtn.com","uap-web-4.ap.sd-rtn.com"],EVENT_REPORT_DOMAIN:["web-3.statscollector.sd-rtn.com"],EVENT_REPORT_BACKUP_DOMAIN:["web-4.statscollector.sd-rtn.com"],LOG_UPLOAD_SERVER:["logservice-china.agora.io"],PROXY_SERVER_TYPE3:["east-cn.webrtc-cloud-proxy.sd-rtn.com"]}),(Jc||(Jc={})).UPDATE_BITRATE_LIMIT="update_bitrate_limit",function(t){t.ONLINE="ONLINE",t.OFFLINE="OFFLINE"}(js||(js={})),function(t){t.NETWORK_STATE_CHANGE="NETWORK_STATE_CHANGE",t.ONLINE="ONLINE",t.OFFLINE="OFFLINE"}(cc||(cc={}));let fv={join:["startJoin","startRequestAp","startJoinGateway","finishJoin"],publish:["startPublish"]},Ur={getDisplayMedia:!1,getStreamFromExtension:!1,supportUnifiedPlan:!1,supportMinBitrate:!1,supportSetRtpSenderParameters:!1,supportDualStream:!0,webAudioMediaStreamDest:!1,supportReplaceTrack:!1,supportWebGL:!1,webAudioWithAEC:!1,supportRequestFrame:!1,supportShareAudio:!1,supportDualStreamEncoding:!1};Qt({target:"Object",stat:!0,forced:!kr,sham:!kr},{defineProperties:ft});var Mn=k(function(t){var e=Br.Object;t=t.exports=function(r,i){return e.defineProperties(r,i)},e.defineProperties.sham&&(t.sham=!0)}),Av=qr.concat("length","prototype"),hd={f:Object.getOwnPropertyNames||function(t){return _o(t,Av)}},gv=jn("Reflect","ownKeys")||function(t){var e=hd.f(Hi(t)),r=Uc.f;return r?e.concat(r(t)):e};Qt({target:"Object",stat:!0,sham:!kr},{getOwnPropertyDescriptors:function(t){var e,r;t=Cn(t);for(var i=ko,n=gv(t),c={},h=0;n.length>h;)(r=i(t,e=n[h++]))!==void 0&&Go(c,e,r);return c}});var Fr=Br.Object.getOwnPropertyDescriptors,Ff=hd.f,pv={}.toString,Qf=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Gf=function(t){if(Qf&&pv.call(t)=="[object Window]")try{var e=Ff(t)}catch(r){e=Qf.slice()}else e=Ff(Cn(t));return e},Hf={f:fi},vv=Hn.f,ls=wt("hidden"),Kf=fi("toPrimitive"),mv=Zt.set,jf=Zt.getterFor("Symbol"),ro=Object.prototype,Ss=gt.Symbol,zc=jn("JSON","stringify"),Wf=ko,va=Hn.f,Vf=Gf,Ev=xo,Vo=Xi("symbols"),qc=Xi("op-symbols"),fd=Xi("string-to-symbol-registry"),Ad=Xi("symbol-to-string-registry"),_v=Xi("wks"),gd=gt.QObject,pd=!gd||!gd.prototype||!gd.prototype.findChild,vd=kr&&Jt(function(){return ys(va({},"a",{get:function(){return va(this,"a",{value:7}).a}})).a!=7})?function(t,e,r){var i=Wf(ro,e);i&&delete ro[e],va(t,e,r),i&&t!==ro&&va(ro,e,i)}:va,Yf=function(t,e){var r=Vo[t]=ys(Ss.prototype);return mv(r,{type:"Symbol",tag:t,description:e}),kr||(r.description=e),r},md=Us&&typeof Ss.iterator=="symbol"?function(t){return typeof t=="symbol"}:function(t){return Object(t)instanceof Ss},Yl=function(t,e,r){return t===ro&&Yl(qc,e,r),Hi(t),e=ua(e,!0),Hi(r),qt(Vo,e)?(r.enumerable?(qt(t,ls)&&t[ls][e]&&(t[ls][e]=!1),r=ys(r,{enumerable:Xs(0,!1)})):(qt(t,ls)||va(t,ls,Xs(1,{})),t[ls][e]=!0),vd(t,e,r)):va(t,e,r)},Jf=function(t,e){Hi(t);var r=Cn(e);return e=Pr(r).concat(Ed(r)),rt(e,function(i){kr&&!zf.call(r,i)||Yl(t,i,r[i])}),t},zf=function(t){t=ua(t,!0);var e=Ev.call(this,t);return!(this===ro&&qt(Vo,t)&&!qt(qc,t))&&(!(e||!qt(this,t)||!qt(Vo,t)||qt(this,ls)&&this[ls][t])||e)},qf=function(t,e){if(t=Cn(t),e=ua(e,!0),t!==ro||!qt(Vo,e)||qt(qc,e)){var r=Wf(t,e);return!r||!qt(Vo,e)||qt(t,ls)&&t[ls][e]||(r.enumerable=!0),r}},Xf=function(t){t=Vf(Cn(t));var e=[];return rt(t,function(r){qt(Vo,r)||qt(Fs,r)||e.push(r)}),e},Ed=function(t){var e=t===ro;t=Vf(e?qc:Cn(t));var r=[];return rt(t,function(i){!qt(Vo,i)||e&&!qt(ro,i)||r.push(Vo[i])}),r};if(Us||(In((Ss=function(){if(this instanceof Ss)throw TypeError("Symbol is not a constructor");var t=arguments.length&&arguments[0]!==void 0?String(arguments[0]):void 0,e=ha(t),r=function(i){this===ro&&r.call(qc,i),qt(this,ls)&&qt(this[ls],e)&&(this[ls][e]=!1),vd(this,e,Xs(1,i))};return kr&&pd&&vd(ro,e,{configurable:!0,set:r}),Yf(e,t)}).prototype,"toString",function(){return jf(this).tag}),xo=zf,Hn.f=Yl,ko=qf,hd.f=Gf=Xf,Uc.f=Ed,kr&&va(Ss.prototype,"description",{configurable:!0,get:function(){return jf(this).description}})),Pc||(Hf.f=function(t){return Yf(fi(t),t)}),Qt({global:!0,wrap:!0,forced:!Us,sham:!Us},{Symbol:Ss}),rt(Pr(_v),function(t){var e=Br.Symbol||(Br.Symbol={});qt(e,t)||vv(e,t,{value:Hf.f(t)})}),Qt({target:"Symbol",stat:!0,forced:!Us},{for:function(t){if(t=String(t),qt(fd,t))return fd[t];var e=Ss(t);return fd[t]=e,Ad[e]=t,e},keyFor:function(t){if(!md(t))throw TypeError(t+" is not a symbol");if(qt(Ad,t))return Ad[t]},useSetter:function(){pd=!0},useSimple:function(){pd=!1}}),Qt({target:"Object",stat:!0,forced:!Us,sham:!kr},{create:function(t,e){return e===void 0?ys(t):Jf(ys(t),e)},defineProperty:Yl,defineProperties:Jf,getOwnPropertyDescriptor:qf}),Qt({target:"Object",stat:!0,forced:!Us},{getOwnPropertyNames:Xf,getOwnPropertySymbols:Ed}),Qt({target:"Object",stat:!0,forced:Jt(function(){Uc.f(1)})},{getOwnPropertySymbols:function(t){return Uc.f(Wn(t))}}),zc){var Cv=!Us||Jt(function(){var t=Ss();return zc([t])!="[null]"||zc({a:t})!="{}"||zc(Object(t))!="{}"});Qt({target:"JSON",stat:!0,forced:Cv},{stringify:function(t,e,r){for(var i,n=[t],c=1;arguments.length>c;)n.push(arguments[c++]);if(i=e,(zr(e)||t!==void 0)&&!md(t))return Zs(e)||(e=function(h,C){if(typeof i=="function"&&(C=i.call(this,h,C)),!md(C))return C}),n[1]=e,zc.apply(null,n)}})}Ss.prototype[Kf]||Kn(Ss.prototype,Kf,Ss.prototype.valueOf),je(Ss,"Symbol"),Fs[ls]=!0;var Qr=Br.Object.getOwnPropertySymbols,kn,Un=function(t,e,r){return e in t?Ch(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t};(function(t){t[t.CHOOSE_SERVER=11]="CHOOSE_SERVER",t[t.CLOUD_PROXY=18]="CLOUD_PROXY",t[t.CLOUD_PROXY_5=20]="CLOUD_PROXY_5"})(kn||(kn={}));var yv=ai("Array").values,Zf=Array.prototype,Iv={DOMTokenList:!0,NodeList:!0},Ma=function(t){var e=t.values;return t===Zf||t instanceof Array&&e===Zf.values||Iv.hasOwnProperty(de(t))?yv:e},ka=function(t){var e=Wn(t),r=typeof this=="function"?this:Array,i=arguments.length,n=1<i?arguments[1]:void 0,c=n!==void 0,h=0,C=Se(e);if(c&&(n=yn(n,2<i?arguments[2]:void 0,2)),C==null||r==Array&&Bl(C))for(r=new r(i=Vn(e.length));i>h;h++)Go(r,h,c?n(e[h],h):e[h]);else for(i=(e=C.call(e)).next,r=new r;!(C=i.call(e)).done;h++)Go(r,h,c?be(e,n,[C.value,h],!0):C.value);return r.length=h,r},Sv=!Bh(function(t){Array.from(t)});Qt({target:"Array",stat:!0,forced:Sv},{from:ka});var io=Br.Array.from;class An{constructor(){this._events={},this.addListener=this.on}getListeners(e){var r;return this._events[e]?yt(r=this._events[e]).call(r,i=>i.listener):[]}on(e,r){this._events[e]||(this._events[e]=[]),e=this._events[e],this._indexOfListener(e,r)===-1&&e.push({listener:r,once:!1})}once(e,r){this._events[e]||(this._events[e]=[]),e=this._events[e],this._indexOfListener(e,r)===-1&&e.push({listener:r,once:!0})}off(e,r){if(this._events[e]){var i=this._events[e];r=this._indexOfListener(i,r),r!==-1&&un(i).call(i,r,1),this._events[e].length===0&&delete this._events[e]}}removeAllListeners(e){e?delete this._events[e]:this._events={}}emit(e,...r){var i;this._events[e]||(this._events[e]=[]);let n=yt(i=this._events[e]).call(i,c=>c);for(i=0;i<n.length;i+=1){let c=n[i];c.once&&this.off(e,c.listener),c.listener.apply(this,r||[])}}_indexOfListener(e,r){let i=e.length;for(;i--;)if(e[i].listener===r)return i;return-1}}let Jl=0,_d=0,us=new class extends An{constructor(){super();this._moduleName="network-indicator",this._networkState=js.ONLINE,window.addEventListener("online",()=>{this.networkState=js.ONLINE}),window.addEventListener("offline",()=>{this.networkState=js.OFFLINE})}set networkState(t){z.info("[".concat(this._moduleName,"]")+"network state changed, "+this._networkState+" -> "+t),this.emit(cc.NETWORK_STATE_CHANGE,t,this._networkState),t===js.ONLINE?this.emit(cc.ONLINE):t===js.OFFLINE&&(this.onlineWaiter=new it(e=>{this.once(cc.ONLINE,()=>{this.onlineWaiter=void 0,e(js.ONLINE)})}),this.emit(cc.OFFLINE)),this._networkState=t}get networkState(){return this._networkState}},Vi={timeout:500,timeoutFactor:1.5,maxRetryCount:1/0,maxRetryTimeout:1e4},Qe=new class{constructor(){var t,e;this.baseInfoMap=new Lr,this.clientList=jo,this.keyEventUploadPendingItems=[],this.normalEventUploadPendingItems=[],this.apiInvokeUploadPendingItems=[],this.apiInvokeCount=0,this.ltsList=[],this.lastSendNormalEventTime=ot(),this.customReportCount=0,this.eventUploadTimer=window.setInterval(Si(t=this.doSend).call(t,this),Xe.EVENT_REPORT_SEND_INTERVAL),this.setSessionIdTimer=window.setInterval(Si(e=this.appendSessionId).call(e,this),Xe.EVENT_REPORT_SEND_INTERVAL)}reportApiInvoke(t,e,r){e.timeout=e.timeout||6e4,e.reportResult=e.reportResult===void 0||e.reportResult;const i=ot(),n=this.apiInvokeCount+=1,c=()=>({tag:e.tag,invokeId:n,sid:t,name:e.name,apiInvokeTime:i,options:e.options,states:e.states||null}),h=!!Xe.SHOW_REPORT_INVOKER_LOG;h&&z.info("".concat(e.name," start"),e.options);let C=!1;Pe(e.timeout).then(()=>{C||(this.sendApiInvoke(ei({},c(),{error:oe.API_INVOKE_TIMEOUT,success:!1})),z.debug("".concat(e.name," timeout")))});const x=new ue(oe.UNEXPECTED_ERROR,"".concat(e.name,": this api invoke is end"));return{onSuccess:Q=>{const F=()=>{if(C)throw x;return C=!0,this.sendApiInvoke(ei({},c(),{success:!0},e.reportResult&&{result:Q})),h&&z.info("".concat(e.name," onSuccess")),Q};return r?fA(F,e.name+"Success",r,()=>C=!0):F()},onError:Q=>{const F=()=>{if(C)throw Q;C=!0,this.sendApiInvoke(ei({},c(),{success:!1,error:Q.toString()})),h&&z.info("".concat(e.name," onFailure"),Q.toString())};return r?fA(F,e.name+"Error",r,()=>C=!0):F()}}}sessionInit(t,e){if(!this.baseInfoMap.has(t)){var r=ot();t=this.createBaseInfo(t,r),t.cname=e.cname;var i=Sn({},{willUploadConsoleLog:Xe.UPLOAD_LOG,maxTouchPoints:navigator.maxTouchPoints,areaVersion:nd?"global":"oversea",areas:Xe.AREAS&&Xe.AREAS.join(",")},e.extend),n=ot();e=ei({},t,{eventType:dn.SESSION_INIT,appid:e.appid,browser:navigator.userAgent,build:"v4.7.3-0-g0eb931c7(11/16/2021, 7:57:58 PM)",lts:n,elapse:n-r,extend:ht(i),mode:e.mode,process:Xe.PROCESS_ID,success:!0,version:as}),this.send({type:gi.SESSION,data:e},!0)}}joinChooseServer(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=ot();e=ei({},r,{eventType:dn.JOIN_CHOOSE_SERVER,lts:i,eventElapse:i-e.lts,chooseServerAddr:e.csAddr,errorCode:e.ec,elapse:i-t.startTime,success:e.succ,chooseServerAddrList:ht(e.serverList),uid:e.uid?Ii(e.uid):null,cid:e.cid?Ii(e.cid):null,chooseServerIp:e.csIp||"",opid:e.opid,unilbsServerIds:e.unilbsServerIds,extend:e.extend||void 0}),this.send({type:gi.JOIN_CHOOSE_SERVER,data:e},!0)}}reqUserAccount(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=ot();e=ei({},r,{eventType:dn.REQ_USER_ACCOUNT,lts:i,success:e.success,serverAddress:e.serverAddr,stringUid:e.stringUid,uid:e.uid,errorCode:e.errorCode,elapse:i-t.startTime,eventElapse:i-e.lts,extend:ht(e.extend)}),this.send({type:gi.REQ_USER_ACCOUNT,data:e},!0)}}joinGateway(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info;e.vid&&(r.vid=e.vid),r.uid=e.uid,r.cid=e.cid;var i=ot();r=ei({},r,{eventType:dn.JOIN_GATEWAY,lts:i,gatewayAddr:e.addr,success:e.succ,errorCode:e.ec,elapse:i-t.startTime,eventElapse:i-e.lts}),e.succ&&(t.lastJoinSuccessTime=i),this.send({type:gi.JOIN_GATEWAT,data:r},!0)}}joinChannelTimeout(t,e){if(t=this.baseInfoMap.get(t)){var r=ot();e=ei({},t.info,{lts:r,timeout:e,elapse:r-t.startTime}),this.send({type:gi.JOIN_CHANNEL_TIMEOUT,data:e},!0)}}publish(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=ot();e=ei({},r,{eventType:dn.PUBLISH,lts:i,eventElapse:i-e.lts,elapse:i-t.startTime,success:e.succ,errorCode:e.ec,videoName:e.videoName,audioName:e.audioName,screenName:e.screenName,screenshare:e.screenshare,audio:e.audio,video:e.video,p2pid:e.p2pid,publishRequestid:e.publishRequestid}),this.send({type:gi.PUBLISH,data:e},!0)}}subscribe(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=ot();t=ei({},r,{eventType:dn.SUBSCRIBE,lts:i,eventElapse:i-e.lts,elapse:i-t.startTime,success:e.succ,errorCode:e.ec,video:e.video,audio:e.audio,subscribeRequestid:e.subscribeRequestid,p2pid:e.p2pid}),typeof e.peerid=="string"?t.peerSuid=e.peerid:t.peer=e.peerid,this.send({type:gi.SUBSCRIBE,data:t},!0)}}firstRemoteFrame(t,e,r,i){if(t=this.baseInfoMap.get(t)){var n=t.info,c=ot();e=ei({},n,{},i,{elapse:c-t.startTime,eventType:e,lts:c}),this.send({type:r,data:e},!0)}}onGatewayStream(t,e,r,i){(t=this.baseInfoMap.get(t))&&(e=ei({},t.info,{},i,{eventType:e,lts:ot()}),this.send({type:r,data:e},!0))}streamSwitch(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=ot();e=ei({},r,{eventType:dn.STREAM_SWITCH,lts:i,isDual:e.isdual,elapse:i-t.startTime,success:e.succ}),this.send({type:gi.STREAM_SWITCH,data:e},!0)}}requestProxyAppCenter(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=ot();e=ei({},r,{eventType:dn.REQUEST_PROXY_APPCENTER,lts:i,eventElapse:i-e.lts,elapse:i-t.startTime,APAddr:e.APAddr,workerManagerList:e.workerManagerList,response:e.response,errorCode:e.ec,success:e.succ}),this.send({type:gi.REQUEST_PROXY_APPCENTER,data:e},!0)}}requestProxyWorkerManager(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=ot();e=ei({},r,{eventType:dn.REQUEST_PROXY_WORKER_MANAGER,lts:i,eventElapse:i-e.lts,elapse:i-t.startTime,workerManagerAddr:e.workerManagerAddr,response:e.response,errorCode:e.ec,success:e.succ}),this.send({type:gi.REQUEST_PROXY_WORKER_MANAGER,data:e},!0)}}setProxyServer(t){(this.proxyServer=t)?z.debug("reportProxyServerurl: ".concat(t)):z.debug("disable reportProxyServerurl: ".concat(t))}peerPublishStatus(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=ot();e=ei({},r,{subscribeElapse:e.subscribeElapse,peer:e.peer,peerPublishDuration:Math.max(e.audioPublishDuration,e.videoPublishDuration),audiotag:0<e.audioPublishDuration?1:-1,videotag:0<e.videoPublishDuration?1:-1,lts:i,elapse:i-t.startTime,joinChannelSuccessElapse:i-(t.lastJoinSuccessTime||i)}),this.send({type:gi.PEER_PUBLISH_STATUS,data:e},!0)}}workerEvent(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=ot();e=function(n,c,h){const C=n[c];if(!C||typeof C!="string")return[n];n[c]="";const x=zs(ht(n));let Q=0;const F=[];let V=0;for(let Y=0;Y<C.length;Y++)V+=127>=C.charCodeAt(Y)?1:3,V<=h-x||(F[F.length]=Sa({},n,{[c]:C.substring(Q,Y)}),Q=Y,V=127>=C.charCodeAt(Y)?1:3);return Q!==C.length-1&&(F[F.length]=Sa({},n,{[c]:C.substring(Q)})),F}(ei({},r,{},e,{elapse:i-t.startTime,lts:i,productType:"WebRTC"}),"payload",1300),Re(e).call(e,n=>this.send({type:gi.WORKER_EVENT,data:n},!0))}}apworkerEvent(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=ot();e=ei({},r,{},e,{elapse:i-t.startTime,lts:i}),this.send({type:gi.AP_WORKER_EVENT,data:e},!0)}}joinWebProxyAP(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=ot();e=ei({},r,{},e,{elapse:i-t.startTime,lts:i,extend:e.extend||void 0}),this.send({type:gi.JOIN_WEB_PROXY_AP,data:e},!0)}}WebSocketQuit(t,e){if(t=this.baseInfoMap.get(t)){var r=t.info,i=ot();e=ei({},r,{},e,{elapse:i-t.startTime,lts:i}),this.send({type:gi.WEBSOCKET_QUIT,data:e},!0)}}sendCustomReportMessage(t,e){return Ee(this,null,function*(){if(this.customReportCount+=e.length,this.customReportCount>Xe.CUSTOM_REPORT_LIMIT)throw new ue(oe.CUSTOM_REPORT_FREQUENCY_TOO_HIGH);this.customReportCounterTimer||(this.customReportCounterTimer=window.setInterval(()=>{this.customReportCount=0},5e3)),e=yt(e).call(e,r=>({type:gi.USER_ANALYTICS,data:ei({sid:t},r)})),e={msgType:"EventMessages",sentTs:Math.round(ot()/1e3),payloads:yt(e).call(e,r=>ht(r))};try{yield this.postDataToStatsCollector(e)}catch(r){throw z.error("send custom report message failed",r.toString()),new ue(oe.CUSTOM_REPORT_SEND_FAILED,r.message)}})}sendApiInvoke(t){var e=Xe.NOT_REPORT_EVENT;if(t.tag&&Ir(e)&&Ir(e).call(e,t.tag))return!1;if(t.sid===null)return this.apiInvokeUploadPendingItems.push(t),!1;if(e=this.baseInfoMap.get(t.sid),!e)return this.apiInvokeUploadPendingItems.push(t),!1;const{cname:r,uid:i,cid:n}=e.info;return t.lts=t.lts||ot(),t={invokeId:t.invokeId,sid:t.sid,cname:r,cid:n,uid:i,lts:t.lts,success:t.success,elapse:t.lts-e.startTime,execElapse:t.lts-t.apiInvokeTime,apiName:t.name,options:t.options?ht(t.options):void 0,execStates:t.states?ht(t.states):void 0,execResult:t.result?ht(t.result):void 0,errorCode:t.error?ht(t.error):void 0},this.send({type:gi.API_INVOKE,data:t},!1),!0}appendSessionId(){var t;Re(t=this.clientList).call(t,e=>{if(e._sessionId){const r=this.apiInvokeUploadPendingItems.length;for(let i=0;i<r;i++){const n=this.apiInvokeUploadPendingItems.shift();n&&(n.sid=e._sessionId,this.sendApiInvoke(Sn({},n)))}}})}send(t,e){if(e)return this.keyEventUploadPendingItems.push(t),void this.sendItems(this.keyEventUploadPendingItems,!0);var r;this.normalEventUploadPendingItems.push(t),this.normalEventUploadPendingItems.length>Xe.NORMAL_EVENT_QUEUE_CAPACITY&&un(r=this.normalEventUploadPendingItems).call(r,0,1),10<=this.normalEventUploadPendingItems.length&&this.sendItems(this.normalEventUploadPendingItems,!1)}doSend(){0<this.keyEventUploadPendingItems.length&&this.sendItems(this.keyEventUploadPendingItems,!0),0<this.normalEventUploadPendingItems.length&&5e3<=ot()-this.lastSendNormalEventTime&&this.sendItems(this.normalEventUploadPendingItems,!1)}sendItems(t,e){const r=[];for(var i=[];t.length;){const h=t.shift();20>r.length?r.push(h):i.push(h)}t.push(...i);for(const h of[...r]){var n,c;Wt(n=this.ltsList).call(n,h.data.lts)!==-1?(h.data.lts=this.ltsList[this.ltsList.length-1]+1,this.ltsList.push(h.data.lts)):(this.ltsList.push(h.data.lts),Wc(c=this.ltsList).call(c,(C,x)=>C-x))}return e||(this.lastSendNormalEventTime=ot()),i={msgType:"EventMessages",sentTs:Math.round(ot()/1e3),payloads:yt(r).call(r,h=>ht(h)),vid:(h=>(h=h&&h.data.sid&&this.baseInfoMap.get(h.data.sid))&&h.info.vid&&+h.info.vid||0)(r[0])},r.length&&this.postDataToStatsCollector(i).catch((h=>C=>{var x,Q,F;Xe.EVENT_REPORT_RETRY&&(e?this.keyEventUploadPendingItems=ne(x=this.keyEventUploadPendingItems).call(x,h):(this.normalEventUploadPendingItems=ne(Q=this.normalEventUploadPendingItems).call(Q,h),this.normalEventUploadPendingItems.length>Xe.NORMAL_EVENT_QUEUE_CAPACITY&&(un(F=this.normalEventUploadPendingItems).call(F,0,this.normalEventUploadPendingItems.length-Xe.NORMAL_EVENT_QUEUE_CAPACITY),z.warning("report: drop normal events"))))})(r)),t}postDataToStatsCollector(t,e=!1){return Ee(this,null,function*(){var r,i,n;us.networkState===js.OFFLINE&&(yield it.race([us.onlineWaiter,Pe(2*Vi.maxRetryTimeout)]));const c=e?"/events/proto-raws":"/events/messages";let h=this.url||(this.proxyServer?ne(r=ne(i="https://".concat(this.proxyServer,"/rs/?h=")).call(i,Xe.EVENT_REPORT_DOMAIN,"&p=6443&d=")).call(r,c):ne(n="https://".concat(Xe.EVENT_REPORT_DOMAIN,":6443")).call(n,c));for(r=0;2>r;r+=1){var C,x,Q;r===1&&(h=this.backupUrl||(this.proxyServer?ne(C=ne(x="https://".concat(this.proxyServer,"/rs/?h=")).call(x,Xe.EVENT_REPORT_BACKUP_DOMAIN,"&p=6443&d=")).call(C,c):ne(Q="https://".concat(Xe.EVENT_REPORT_BACKUP_DOMAIN,":6443")).call(Q,c)));try{e?yield Zo(h,{timeout:1e4,data:t}):yield _i(h,{timeout:1e4,data:t})}catch(F){if(r===1)throw F;continue}break}})}createBaseInfo(t,e){const r=Sn({},lv);return r.sid=t,this.baseInfoMap.set(t,{info:r,startTime:e}),r}};class $f extends An{constructor(e,r){super();this._hints=[],this._isClosed=!1,this._ID=r||mr(8,"track-"),this._mediaStreamTrack=this._originMediaStreamTrack=e,Ir(pa).call(pa,this)||pa.push(this)}toString(){return this._ID}getTrackId(){return this._ID}getMediaStreamTrack(e){return e||(e=Qe.reportApiInvoke(null,{name:bt.GET_MEDIA_STREAM_TRACK,options:[],tag:Dt.TRACER}),this._mediaStreamTrack&&typeof this._mediaStreamTrack.label=="string"?e.onSuccess(this._mediaStreamTrack.label):e.onSuccess("")),this._mediaStreamTrack}close(){this._isClosed=!0;{let e=Wt(pa).call(pa,this);e!==-1&&un(pa).call(pa,e,1)}}}let Tv=1;class Yo{constructor(e){var r;this.lockingPromise=it.resolve(),this.locks=0,this.name="",this.lockId=Tv++,e&&(this.name=e),z.debug(ne(r="[lock-".concat(this.name,"-")).call(r,this.lockId,"] is created."))}get isLocked(){return 0<this.locks}lock(){var e,r;let i;this.locks+=1,z.debug(ne(e=ne(r="[lock-".concat(this.name,"-")).call(r,this.lockId,"] is locked, current queue ")).call(e,this.locks,"."));let n=new it(c=>{i=()=>{var h,C;--this.locks,z.debug(ne(h=ne(C="[lock-".concat(this.name,"-")).call(C,this.lockId,"] is not locked, current queue ")).call(h,this.locks,".")),c()}});return e=this.lockingPromise.then(()=>i),this.lockingPromise=this.lockingPromise.then(()=>n),e}}class zl extends $f{constructor(e,r){super(e,r);this._enabled=!0,this._isClosed=this._muted=!1,this._trackProcessors=[],this._handleTrackEnded=()=>{this.onTrackEnded()},this._enabledMutex=new Yo("".concat(r)),e.addEventListener("ended",this._handleTrackEnded)}get muted(){return this._muted}get enabled(){return this._enabled}getTrackLabel(){return this._originMediaStreamTrack.label}close(){var e;this._isClosed||(this.stop(),Re(e=this._trackProcessors).call(e,r=>r.destroy()),this._trackProcessors=[],this._originMediaStreamTrack.stop(),this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack.stop(),this._mediaStreamTrack=null),this._originMediaStreamTrack=null,this._enabledMutex=null,z.debug("[".concat(this.getTrackId(),"] close")),this.emit(xt.NEED_CLOSE),super.close())}_registerTrackProcessor(e){return Ee(this,null,function*(){var r;if(Wt(r=this._trackProcessors).call(r,e)===-1){var i=this._trackProcessors[this._trackProcessors.length-1];this._trackProcessors.push(e),e.onOutputChange=()=>Ee(this,null,function*(){this._mediaStreamTrack=e.output||this._originMediaStreamTrack,this._updatePlayerSource(),yield Kr(this,xt.NEED_REPLACE_TRACK,this._mediaStreamTrack)}),i?(i.onOutputChange=()=>Ee(this,null,function*(){i.output&&(yield e.setInput(i.output))}),yield e.setInput(i.output||i.input||this._originMediaStreamTrack)):yield e.setInput(this._originMediaStreamTrack)}})}_getOutputFromProcessors(){if(this._trackProcessors.length===0)return this._originMediaStreamTrack;let e=this._trackProcessors[this._trackProcessors.length-1];return e.output||e.input||this._originMediaStreamTrack}_updateOriginMediaStreamTrack(e,r){return Ee(this,null,function*(){e!==this._originMediaStreamTrack&&(this._originMediaStreamTrack.removeEventListener("ended",this._handleTrackEnded),r&&this._originMediaStreamTrack.stop(),e.addEventListener("ended",this._handleTrackEnded),this._originMediaStreamTrack=e,0<this._trackProcessors.length?(yield this._trackProcessors[0].setInput(e),this._mediaStreamTrack=this._getOutputFromProcessors()):this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),yield Kr(this,xt.NEED_REPLACE_TRACK,this._mediaStreamTrack))})}_getDefaultPlayerConfig(){return{}}onTrackEnded(){z.debug("[".concat(this.getTrackId(),"] track ended")),this.emit(xa.TRACK_ENDED)}stateCheck(e,r){var i,n,c;if(z.debug(ne(i=ne(n=ne(c="check track state, [muted: ".concat(this._muted,", enabled: ")).call(c,this._enabled,"] to [")).call(n,e,": ")).call(i,r,"]")),e==="muted"&&!Ur.webAudioMediaStreamDest)throw new ue(oe.NOT_SUPPORTED,"current environment does not support set mute").print();if(Fn(r,e),this._enabled&&this._muted&&e==="enabled"&&r===!1)throw new ue(oe.TRACK_STATE_UNREACHABLE,"cannot set enabled while the track is muted").print();if(!this._enabled&&!this._muted&&e==="muted"&&r===!0)throw new ue(oe.TRACK_STATE_UNREACHABLE,"cannot set muted while the track is disabled").print()}}var Yi;(function(t){t.IOS_15_INTERRUPTION_START="ios15-interruption-start",t.IOS_15_INTERRUPTION_END="ios15-interruption-end",t.IOS_INTERRUPTION_START="ios-interruption-start",t.IOS_INTERRUPTION_END="ios-interruption-end"})(Yi||(Yi={}));let eA=window.AudioContext||window.webkitAudioContext,no=null,fr=new class extends An{constructor(){super(...arguments);this.onLocalAudioTrackMute=()=>{z.info("ios15-interruption-start"),this.emit(Yi.IOS_15_INTERRUPTION_START)},this.onLocalAudioTrackUnmute=()=>Ee(this,null,function*(){z.info("ios15-interruption-end"),this.curState!=="running"||this.duringInterruption?z.info("ios15-interruption-end-canceled"):(no&&(yield no.suspend()),this.emit(Yi.IOS_15_INTERRUPTION_END))})}get duringInterruption(){return this.prevState==="running"&&this.curState==="interrupted"}bindInterruptDetectorTrack(t){z.debug("webaudio bindInterruptDetectorTrack ".concat(t.getTrackId())),this.interruptDetectorTrack||(this.interruptDetectorTrack=t,this.interruptDetectorTrack._mediaStreamTrack.onmute=this.onLocalAudioTrackMute,this.interruptDetectorTrack._mediaStreamTrack.onunmute=this.onLocalAudioTrackUnmute)}unbindInterruptDetectorTrack(t){z.debug("webaudio unbindInterruptDetectorTrack ".concat(t.getTrackId())),this.interruptDetectorTrack&&this.interruptDetectorTrack===t&&(this.interruptDetectorTrack._mediaStreamTrack&&(this.interruptDetectorTrack._mediaStreamTrack.onmute=null,this.interruptDetectorTrack._mediaStreamTrack.onunmute=null),this.interruptDetectorTrack=void 0)}},Cd=null;class tA extends An{constructor(){super();this.isPlayed=!1,this.audioOutputLevel=0,this.isNoAudioInput=this.isDestroyed=!1,this._noAudioInputCount=0,this.context=fs(),this.playNode=this.context.destination,this.outputNode=this.context.createGain(),ts(this.outputNode),this.analyserNode=this.context.createAnalyser(),this.analyserNode.smoothingTimeConstant=.4,this.analyserNode.fftSize=2048}startGetAudioBuffer(e){this.audioBufferNode||(this.audioBufferNode=this.context.createScriptProcessor(e),this.outputNode.connect(this.audioBufferNode),this.audioBufferNode.connect(this.context.destination),this.audioBufferNode.onaudioprocess=r=>{this.emit(Hs.ON_AUDIO_BUFFER,function(i){for(let n=0;n<i.outputBuffer.numberOfChannels;n+=1){let c=i.outputBuffer.getChannelData(n);for(let h=0;h<c.length;h+=1)c[h]=0}return i.inputBuffer}(r))})}stopGetAudioBuffer(){this.audioBufferNode&&(this.audioBufferNode.onaudioprocess=null,this.outputNode.disconnect(this.audioBufferNode),this.audioBufferNode=void 0)}createOutputTrack(){if(!Ur.webAudioMediaStreamDest)throw new ue(oe.NOT_SUPPORTED,"your browser is not support audio processor");return this.destNode&&this.outputTrack||(this.destNode=this.context.createMediaStreamDestination(),this.outputNode.connect(this.destNode),this.outputTrack=this.destNode.stream.getAudioTracks()[0]),this.outputTrack}play(e){this.context.state!=="running"&&Ni(()=>{fr.emit("autoplay-failed")}),this.isPlayed=!0,this.playNode=e||this.context.destination,this.outputNode.connect(this.playNode)}stop(){if(this.isPlayed)try{this.outputNode.disconnect(this.playNode)}catch(e){}this.isPlayed=!1}getAccurateVolumeLevel(){if(!this.context||br()||pi()||this.context.state!=="running"&&this.context.resume(),!this.analyserNode)return 0;let e=new Uint8Array(this.analyserNode.frequencyBinCount);this.analyserNode.getByteFrequencyData(e);let r=0;for(let i=0;i<e.length;i++)r+=64>i?Math.abs(10*e[i]):Math.abs(6*e[i]/15);return r/e.length/255}checkHasAudioInput(e=0){return Ee(this,null,function*(){if(5<e)return this.isNoAudioInput=!0,this.onNoAudioInput&&this.onNoAudioInput(),!1;if(br()||pi()?this.context.state==="suspended"&&this.context.resume():this.context.state!=="running"&&this.context.resume(),!this.analyserNode)return!1;let r=new Uint8Array(this.analyserNode.frequencyBinCount);this.analyserNode.getByteFrequencyData(r);let i=!1;for(let n=0;n<r.length;n++)r[n]!==0&&(i=!0);return i?(this.isNoAudioInput=!1,!0):(yield Pe(200),(yield this.checkHasAudioInput(e?e+1:1))&&i)})}getAudioVolume(){return this.outputNode.gain.value}setVolume(e){this.outputNode.gain.setValueAtTime(e,this.context.currentTime)}setMute(e){e?(this.disconnect(),this.audioOutputLevel=0):this.connect()}destroy(){this.disconnect(),this.stop(),this.isDestroyed=!0,this.onNoAudioInput=void 0}disconnect(){this.sourceNode&&this.sourceNode.disconnect(),this.outputNode&&this.outputNode.disconnect()}connect(){this.sourceNode&&this.sourceNode.connect(this.outputNode),this.outputNode.connect(this.analyserNode)}}class rA extends tA{constructor(e,r){if(super(),this.isCurrentTrackCloned=!1,this.isRemoteTrack=!1,this.rebuildWebAudio=()=>Ee(this,null,function*(){if(z.debug("ready to rebuild web audio, state:",this.context.state),this.isNoAudioInput&&(yield this.checkHasAudioInput()),!this.isNoAudioInput||this.isDestroyed)return document.body.removeEventListener("click",this.rebuildWebAudio,!0),void z.debug("rebuild web audio success, current volume status",this.getAccurateVolumeLevel());this.context.resume().then(()=>z.info("resume success")),z.debug("rebuild web audio because of ios 12 bugs"),this.disconnect();var i=this.track;this.track=this.track.clone(),this.isCurrentTrackCloned?i.stop():this.isCurrentTrackCloned=!0,i=new MediaStream([this.track]),this.sourceNode=this.context.createMediaStreamSource(i),ts(this.sourceNode),this.analyserNode=this.context.createAnalyser();let n=this.outputNode.gain.value;this.outputNode=this.context.createGain(),this.outputNode.gain.setValueAtTime(n,this.context.currentTime),ts(this.outputNode),this.connect(),this.audioElement.srcObject=i,this.isPlayed&&this.play(this.playNode),this.checkHasAudioInput()}),e.kind!=="audio")throw new ue(oe.UNEXPECTED_ERROR);this.track=e,e=new MediaStream([this.track]),this.isRemoteTrack=!!r,this.sourceNode=this.context.createMediaStreamSource(e),ts(this.sourceNode),this.connect(),this.audioElement=document.createElement("audio"),this.audioElement.srcObject=e,e=Ye(),r&&e.os===en.IOS&&15>Number(e.osVersion&&e.osVersion.split(".")[0])&&(fr.on("state-change",()=>{this.context.state==="suspended"?document.body.addEventListener("click",this.rebuildWebAudio,!0):this.context.state==="running"&&this.rebuildWebAudio()}),this.checkHasAudioInput().then(i=>{i||document.body.addEventListener("click",this.rebuildWebAudio,!0)}))}get isFreeze(){return!1}updateTrack(e){this.sourceNode.disconnect(),this.track=e,this.isCurrentTrackCloned=!1,e=new MediaStream([e]),this.sourceNode=this.context.createMediaStreamSource(e),ts(this.sourceNode),this.sourceNode.connect(this.outputNode),this.audioElement.srcObject=e}destroy(){this.audioElement.srcObject=null,this.audioElement.remove(),fr.off("state-change",this.rebuildWebAudio),super.destroy()}}let ql=null,yd=new Yo("safari"),iA=!1,nA=!1,Xn=new class extends An{constructor(){super();this._state=Pa.IDLE,this.lastAccessCameraPermission=this.lastAccessMicrophonePermission=this.isAccessCameraPermission=this.isAccessMicrophonePermission=!1,this.deviceInfoMap=new Lr,this.init().then(()=>{var t;navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",Si(t=this.updateDevicesInfo).call(t,this)),window.setInterval(()=>Ye().name!==rr.WECHAT&&Xe.ENUMERATE_DEVICES_INTERVAL&&this.updateDevicesInfo(),6e4)}).catch(t=>z.error(t.toString()))}get state(){return this._state}set state(t){t!==this._state&&(this.emit(Wo.STATE_CHANGE,t),this._state=t)}enumerateDevices(t,e,r=!1){return Ee(this,null,function*(){if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)return new ue(oe.NOT_SUPPORTED,"enumerateDevices() not supported.").throw();var i=yield navigator.mediaDevices.enumerateDevices();i=this.checkMediaDeviceInfoIsOk(i);let n=!this.isAccessMicrophonePermission&&t,c=!this.isAccessCameraPermission&&e;i.audio&&(n=!1),i.video&&(c=!1);let h=i=null,C=null;if(!r&&(n||c)){if(yd.isLocked&&(z.debug("[device manager] wait GUM lock"),(yield yd.lock())(),z.debug("[device manager] GUM unlock")),iA&&(n=!1,this.isAccessMicrophonePermission=!0),nA&&(c=!1,this.isAccessCameraPermission=!0),z.debug("[device manager] check media device permissions",t,e,n,c),n&&c){try{C=yield navigator.mediaDevices.getUserMedia({audio:!0,video:!0})}catch(te){if(r=fo(te.name||te.code||te,te.message),r.code===oe.PERMISSION_DENIED)throw r;z.warning("getUserMedia failed in getDevices",r)}this.isAccessMicrophonePermission=this.isAccessCameraPermission=!0}else if(n){try{i=yield navigator.mediaDevices.getUserMedia({audio:t})}catch(te){if(r=fo(te.name||te.code||te,te.message),r.code===oe.PERMISSION_DENIED)throw r;z.warning("getUserMedia failed in getDevices",r)}this.isAccessMicrophonePermission=!0}else if(c){try{h=yield navigator.mediaDevices.getUserMedia({video:e})}catch(te){if(r=fo(te.name||te.code||te,te.message),r.code===oe.PERMISSION_DENIED)throw r;z.warning("getUserMedia failed in getDevices",r)}this.isAccessCameraPermission=!0}z.debug("[device manager] mic permission",t,"cam permission",e)}try{var x,Q,F;const te=yield navigator.mediaDevices.enumerateDevices();return i&&Re(x=i.getTracks()).call(x,ce=>ce.stop()),h&&Re(Q=h.getTracks()).call(Q,ce=>ce.stop()),C&&Re(F=C.getTracks()).call(F,ce=>ce.stop()),i=null,h=null,C=null,te}catch(te){var V,Y,$;return i&&Re(V=i.getTracks()).call(V,ce=>ce.stop()),h&&Re(Y=h.getTracks()).call(Y,ce=>ce.stop()),C&&Re($=C.getTracks()).call($,ce=>ce.stop()),C=h=i=null,new ue(oe.ENUMERATE_DEVICES_FAILED,te.toString()).throw()}})}getRecordingDevices(t=!1){return Ee(this,null,function*(){return t=yield this.enumerateDevices(!0,!1,t),Gt(t).call(t,e=>e.kind==="audioinput")})}getCamerasDevices(t=!1){return Ee(this,null,function*(){return t=yield this.enumerateDevices(!1,!0,t),Gt(t).call(t,e=>e.kind==="videoinput")})}getSpeakers(t=!1){return Ee(this,null,function*(){return t=yield this.enumerateDevices(!0,!1,t),Gt(t).call(t,e=>e.kind==="audiooutput")})}searchDeviceNameById(t){return(t=this.deviceInfoMap.get(t))?t.device.label||t.device.deviceId:null}searchDeviceIdByName(t){var e;let r=null;return Re(e=this.deviceInfoMap).call(e,i=>{i.device.label===t&&(r=i.device.deviceId)}),r}getDeviceById(t){return Ee(this,null,function*(){var e=yield this.enumerateDevices(!0,!0,!0);if(e=tr(e).call(e,r=>r.deviceId===t),!e)throw new ue(oe.DEVICE_NOT_FOUND,"deviceId: ".concat(t));return e})}init(){return Ee(this,null,function*(){this.state=Pa.INITING;try{yield this.updateDevicesInfo(),this.state=Pa.INITEND}catch(e){z.warning("Device Detection functionality cannot start properly.",e.toString()),this.state=Pa.IDLE;var t=typeof isSecureContext=="boolean"?isSecureContext:location.protocol==="https:"||location.protocol==="file:"||location.hostname==="localhost"||location.hostname==="127.0.0.1"||location.hostname==="::1";throw t||new ue(oe.WEB_SECURITY_RESTRICT,"Your context is limited by web security, please try using https protocol or localhost.").throw(),e}})}updateDevicesInfo(){return Ee(this,null,function*(){var t;const e=yield this.enumerateDevices(!0,!0,!0),r=ot(),i=[],n=this.checkMediaDeviceInfoIsOk(e);if(Re(e).call(e,c=>{if(c.deviceId){var h=this.deviceInfoMap.get(c.deviceId);if((h?h.state:"INACTIVE")!=="ACTIVE"){const C={initAt:r,updateAt:r,device:c,state:"ACTIVE"};this.deviceInfoMap.set(c.deviceId,C),i.push(C)}h&&(h.updateAt=r)}}),Re(t=this.deviceInfoMap).call(t,(c,h)=>{c.state==="ACTIVE"&&c.updateAt!==r&&(c.state="INACTIVE",i.push(c))}),this.state!==Pa.INITEND)return n.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),void(n.video&&(this.lastAccessCameraPermission=!0,this.isAccessCameraPermission=!0));Re(i).call(i,c=>{switch(c.device.kind){case"audioinput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit(Wo.RECORDING_DEVICE_CHANGED,c);break;case"videoinput":this.lastAccessCameraPermission&&this.isAccessCameraPermission&&this.emit(Wo.CAMERA_DEVICE_CHANGED,c);break;case"audiooutput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit(Wo.PLAYOUT_DEVICE_CHANGED,c)}}),n.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),n.video&&(this.lastAccessCameraPermission=!0,this.isAccessCameraPermission=!0)})}checkMediaDeviceInfoIsOk(t){const e=Gt(t).call(t,i=>i.kind==="audioinput");t=Gt(t).call(t,i=>i.kind==="videoinput");const r={audio:!1,video:!1};for(const i of e)if(i.label&&i.deviceId){r.audio=!0;break}for(const i of t)if(i.label&&i.deviceId){r.video=!0;break}return r}};var Rv=ai("Array").entries,sA=Array.prototype,wv={DOMTokenList:!0,NodeList:!0},oA=function(t){var e=t.entries;return t===sA||t instanceof Array&&e===sA.entries||wv.hasOwnProperty(de(t))?Rv:e};let Id=!1,aA=new An,cA="play playing loadeddata canplay pause stalled suspend waiting abort emptied ended".split(" "),Ts=new class{constructor(){this.elementMap=new Lr,this.elementStateMap=new Lr,this.elementsNeedToResume=[],this.sinkIdMap=new Lr,this.autoResumeAfterInterruption=()=>{var t,e;Re(t=io(oA(e=this.elementMap).call(e))).call(t,([r,i])=>{r=this.elementStateMap.get(r);const n=i.srcObject.getAudioTracks()[0];hi()?n&&n.readyState==="live"&&fr.curState==="running"&&(z.debug("auto resume after interruption for iOS 15"),i.pause(),i.play()):r&&r==="pause"&&n&&n.readyState==="live"&&fr.curState==="running"&&(z.debug("auto resume after interruption for iOS"),i.play())})},this.autoResumeAfterInterruptionOnIOS15=()=>{var t,e;Re(t=io(oA(e=this.elementMap).call(e))).call(t,([,r])=>{const i=r.srcObject.getAudioTracks()[0];i&&i.readyState==="live"&&(z.debug("auto resume after interruption inside autoResumeAfterInterruptionOnIOS15"),r.pause(),r.play())})},this.autoResumeAudioElement(),fr.on(Yi.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),fr.on(Yi.IOS_15_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15)}setSinkID(t,e){return Ee(this,null,function*(){const r=this.elementMap.get(t);if(this.sinkIdMap.set(t,e),r)try{yield r.setSinkId(e)}catch(i){throw new ue(oe.PERMISSION_DENIED,"can not set sink id: "+i.toString())}})}play(t,e,r){if(!this.elementMap.has(e)){var i=document.createElement("audio");i.autoplay=!0,i.srcObject=new MediaStream([t]),this.bindAudioElementEvents(e,i),this.elementMap.set(e,i),this.elementStateMap.set(e,rn.INIT),this.setVolume(e,r),(t=this.sinkIdMap.get(e))&&i.setSinkId(t).catch(n=>{z.warning("[".concat(e,"] set sink id failed"),n.toString())}),(t=i.play())&&t.then&&t.catch(n=>{z.warning("audio element play warning",n.toString()),this.elementMap.has(e)&&n.name==="NotAllowedError"&&(z.warning("detected audio element autoplay failed"),this.elementsNeedToResume.push(i),Ni(()=>{this.onAutoplayFailed&&this.onAutoplayFailed(),gs()}))})}}updateTrack(t,e){(t=this.elementMap.get(t))&&(t.srcObject=new MediaStream([e]))}isPlaying(t){return this.elementMap.has(t)}setVolume(t,e){(t=this.elementMap.get(t))&&(e=Math.max(0,Math.min(100,e)),t.volume=e/100)}stop(t){var e,r;const i=this.elementMap.get(t);if(this.sinkIdMap.delete(t),i){var n=Wt(e=this.elementsNeedToResume).call(e,i);un(r=this.elementsNeedToResume).call(r,n,1),i.srcObject=null,i.remove(),this.elementMap.delete(t),this.elementStateMap.delete(t)}}bindAudioElementEvents(t,e){Re(cA).call(cA,r=>{e.addEventListener(r,i=>{var n,c;const h=this.elementStateMap.get(t);i=i.type,z.debug(ne(n=ne(c="[".concat(t,"] audio-element-status change ")).call(c,h," => ")).call(n,i)),this.elementStateMap.set(t,i)})})}autoResumeAudioElement(){const t=()=>{var e;Re(e=this.elementsNeedToResume).call(e,r=>{r.play().then(i=>{z.debug("Auto resume audio element success")}).catch(i=>{z.warning("Auto resume audio element failed!",i)})}),this.elementsNeedToResume=[]};new it(e=>{document.body?e():window.addEventListener("load",()=>e())}).then(()=>{document.body.addEventListener("touchstart",t,!0),document.body.addEventListener("mousedown",t,!0)})}};var ds=function(t,e,r,i){var n,c=arguments.length,h=3>c?e:i===null?i=gr(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(t,e,r,i);else for(var C=t.length-1;0<=C;C--)(n=t[C])&&(h=(3>c?n(h):3<c?n(e,r,h):n(e,r))||h);return 3<c&&h&&_r(e,r,h),h},ar=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)};class Ji extends zl{constructor(e,r,i){super(e,i);this.trackMediaType="audio",this._enabled=!0,this._volume=100,this._bypassWebAudio=this._useAudioElement=!1,this._encoderConfig=r,this._source=new rA(e)}get isPlaying(){return this._useAudioElement?Ts.isPlaying(this.getTrackId()):this._source.isPlayed}setVolume(e){$t(e,"volume",0,1e3);let r=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.LOCAL_AUDIO_TRACK_SET_VOLUME,options:[this.getTrackId(),e]},300);this._volume=e,this._source.setVolume(e/100),this._useAudioElement&&Ts.setVolume(this.getTrackId(),e);try{if(this._bypassWebAudio)return void z.debug("[".concat(this.getTrackId(),"] setVolume returned because no pass through WebAudio."));let i=this._source.createOutputTrack();this._mediaStreamTrack!==i&&(this._mediaStreamTrack=i,Kr(this,xt.NEED_REPLACE_TRACK,this._mediaStreamTrack).then(()=>{z.debug("[".concat(this.getTrackId(),"] replace web audio track success"))}).catch(n=>{z.warning("[".concat(this.getTrackId(),"] replace web audio track failed"),n)}))}catch(i){}r.onSuccess()}getVolumeLevel(){return this._source.getAccurateVolumeLevel()}setPlaybackDevice(e){return Ee(this,null,function*(){let r=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.REMOTE_AUDIO_SET_OUTPUT_DEVICE,options:[this.getTrackId(),e]});if(!this._useAudioElement)throw new ue(oe.NOT_SUPPORTED,"your browser does not support setting the audio output device");try{yield Ts.setSinkID(this.getTrackId(),e)}catch(i){throw r.onError(i),i}r.onSuccess()})}setEnabled(e,r,i){return Ee(this,null,function*(){var n;if(!i){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(z.info("[".concat(this.getTrackId(),"] start setEnabled"),e),r=yield this._enabledMutex.lock(),!e){this._originMediaStreamTrack.enabled=!1;try{yield Kr(this,xt.NEED_REMOVE_TRACK,this)}catch(c){throw z.error("[".concat(this.getTrackId(),"] setEnabled to false error"),c.toString()),r(),c}return i||(this._enabled=!1),r()}this._originMediaStreamTrack.enabled=!0;try{yield Kr(this,xt.NEED_ADD_TRACK,this)}catch(c){throw z.error("[".concat(this.getTrackId(),"] setEnabled to true error"),c.toString()),r(),c}z.info(ne(n="[".concat(this.getTrackId(),"] setEnabled to ")).call(n,e," success")),i||(this._enabled=!0),r()})}setMuted(e){return Ee(this,null,function*(){var r,i;if(this._bypassWebAudio)return z.debug(ne(i="[".concat(this.getTrackId(),"] setMuted:")).call(i,e," fallback to setEnabled because no pass through.")),void(yield this.setEnabled(!e));if(e!==this._muted){if(this.stateCheck("muted",e),this._muted=e,Ye().name===rr.FIREFOX)return z.debug("[".concat(this.getTrackId(),"] firefox set mute fallback to set enabled")),void(yield this.setEnabled(!e,void 0,!0));this._mediaStreamTrack.enabled=!e,z.debug(ne(r="[".concat(this.getTrackId(),"] start set muted: ")).call(r,e)),yield Kr(this,xt.SET_AUDIO_TRACK_MUTED,{track:this,muted:e})}})}getStats(){return ps(()=>{z.warning("[deprecated] LocalAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalAudioStats instead")},"localAudioTrackGetStatsWarning"),Qi(this,xt.GET_STATS)||Js({},Wl)}setAudioFrameCallback(e,r=4096){if(!e)return this._source.removeAllListeners(Hs.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(r),this._source.removeAllListeners(Hs.ON_AUDIO_BUFFER),this._source.on(Hs.ON_AUDIO_BUFFER,i=>e(i))}play(){let e=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.LOCAL_AUDIO_TRACK_PLAY,options:[this.getTrackId()]});z.debug("[".concat(this.getTrackId(),"] start audio playback")),this._useAudioElement?(z.debug("[".concat(this.getTrackId(),"] start audio playback in element")),Ts.play(this._mediaStreamTrack,this.getTrackId(),this._volume)):this._source.play(),e.onSuccess()}stop(){let e=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.LOCAL_AUDIO_TRACK_STOP,options:[this.getTrackId()]});z.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._useAudioElement?Ts.stop(this.getTrackId()):this._source.stop(),e.onSuccess()}close(){super.close(),this._source.destroy()}_updatePlayerSource(){z.debug("[".concat(this.getTrackId(),"] update player source track")),this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&Ts.updateTrack(this.getTrackId(),this._mediaStreamTrack)}_updateOriginMediaStreamTrack(e,r){return Ee(this,null,function*(){this._originMediaStreamTrack!==e&&(this._originMediaStreamTrack.removeEventListener("ended",this._handleTrackEnded),e.addEventListener("ended",this._handleTrackEnded),r&&this._originMediaStreamTrack.stop(),this._originMediaStreamTrack=e,this._source.updateTrack(this._originMediaStreamTrack),this._mediaStreamTrack!==this._source.outputTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),yield Kr(this,xt.NEED_REPLACE_TRACK,this._mediaStreamTrack)))})}renewMediaStreamTrack(){return it.resolve(void 0)}}ds([Or(),ar("design:type",Function),ar("design:paramtypes",[String]),ar("design:returntype",it)],Ji.prototype,"setPlaybackDevice",null),ds([Or(),ar("design:type",Function),ar("design:paramtypes",[Boolean,Object,Boolean]),ar("design:returntype",it)],Ji.prototype,"setEnabled",null),ds([Or(),On({report:Qe}),ar("design:type",Function),ar("design:paramtypes",[Boolean]),ar("design:returntype",it)],Ji.prototype,"setMuted",null),ds([Or(),ar("design:type",Function),ar("design:paramtypes",[]),ar("design:returntype",Object)],Ji.prototype,"getStats",null),ds([Or(),ar("design:type",Function),ar("design:paramtypes",[Object,Number]),ar("design:returntype",void 0)],Ji.prototype,"setAudioFrameCallback",null),ds([Or(),ar("design:type",Function),ar("design:paramtypes",[]),ar("design:returntype",void 0)],Ji.prototype,"play",null),ds([Or(),ar("design:type",Function),ar("design:paramtypes",[]),ar("design:returntype",void 0)],Ji.prototype,"stop",null);class Xc extends Ji{constructor(e,r,i,n){super(e,r.encoderConfig?Zr(r.encoderConfig):{},n);this._deviceName="default",this._enabled=!0,this._config=r,this._constraints=i,this._deviceName=e.label,typeof r.bypassWebAudio=="boolean"&&(this._bypassWebAudio=r.bypassWebAudio),hi()&&fr.bindInterruptDetectorTrack(this)}setDevice(e){return Ee(this,null,function*(){var r,i;let n=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.MIC_AUDIO_TRACK_SET_DEVICE,options:[this.getTrackId(),e]});if(z.info(ne(r="[".concat(this.getTrackId(),"] start set device to ")).call(r,e)),this._enabled)try{let c=yield Xn.getDeviceById(e);r={},r.audio=Js({},this._constraints),r.audio.deviceId={exact:e},this._originMediaStreamTrack.stop();let h=null;try{h=yield Fi(r,this.getTrackId())}catch(C){throw z.error("[".concat(this.getTrackId(),"] setDevice failed"),C.toString()),h=yield Fi({video:this._constraints},this.getTrackId()),yield this._updateOriginMediaStreamTrack(h.getAudioTracks()[0],!1),C}yield this._updateOriginMediaStreamTrack(h.getAudioTracks()[0],!1),this._deviceName=c.label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(c){throw n.onError(c),z.error("[".concat(this.getTrackId(),"] setDevice error"),c.toString()),c}else try{this._deviceName=(yield Xn.getDeviceById(e)).label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(c){throw n.onError(c),z.error("[".concat(this.getTrackId(),"] setDevice error"),c.toString()),c}n.onSuccess(),z.info(ne(i="[".concat(this.getTrackId(),"] set device to ")).call(i,e," success"))})}setEnabled(e,r,i){var n=c=>super[c];return Ee(this,null,function*(){if(r)return z.debug("[".concat(this.getTrackId,"] setEnabled false (do not close microphone)")),yield n("setEnabled").call(this,e);if(!i){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(z.info("[".concat(this.getTrackId(),"] start setEnabled"),e),r=yield this._enabledMutex.lock(),!e){this._originMediaStreamTrack.onended=null,this._originMediaStreamTrack.stop(),i||(this._enabled=!1);try{yield Kr(this,xt.NEED_REMOVE_TRACK,this)}catch(C){throw z.error("[".concat(this.getTrackId(),"] setEnabled false failed"),C.toString()),r(),C}return void r()}e=Js({},this._constraints);let h=Xn.searchDeviceIdByName(this._deviceName);h&&!e.deviceId&&(e.deviceId=h);try{let C=yield Fi({audio:this._constraints},this.getTrackId());yield this._updateOriginMediaStreamTrack(C.getAudioTracks()[0],!1),yield Kr(this,xt.NEED_ADD_TRACK,this)}catch(C){throw r(),z.error("[".concat(this.getTrackId(),"] setEnabled true failed"),C.toString()),C}i||(this._enabled=!0),z.info("[".concat(this.getTrackId(),"] setEnabled success")),r()})}close(){super.close(),hi()&&fr.unbindInterruptDetectorTrack(this)}onTrackEnded(){if((br()||pi())&&this._enabled&&!this._isClosed&&fr.duringInterruption){let e=()=>Ee(this,null,function*(){fr.off(Yi.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(z.debug("[".concat(this.getTrackId(),"] try capture microphone media device for interrupted iOS device.")),yield this.setEnabled(!1),yield this.setEnabled(!0))});fr.on(Yi.IOS_INTERRUPTION_END,e)}else z.debug("[".concat(this.getTrackId(),"] track ended")),this.emit(xa.TRACK_ENDED)}renewMediaStreamTrack(){return Ee(this,null,function*(){var e=Js({},this._constraints);let r=Xn.searchDeviceIdByName(this._deviceName);r&&!e.deviceId&&(e.deviceId=r),e=yield Fi({audio:this._constraints},this.getTrackId()),yield this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!0)})}}ds([Or(),ar("design:type",Function),ar("design:paramtypes",[String]),ar("design:returntype",it)],Xc.prototype,"setDevice",null),ds([Or(),ar("design:type",Function),ar("design:paramtypes",[Boolean,Boolean,Boolean]),ar("design:returntype",it)],Xc.prototype,"setEnabled",null);class lc extends Ji{constructor(e,r,i,n){super(r.createOutputTrack(),i,n);this.source=e,this._bufferSource=r,this._bufferSource.on(Hs.AUDIO_SOURCE_STATE_CHANGE,c=>{this.emit(xa.SOURCE_STATE_CHANGE,c)});try{this._mediaStreamTrack=this._source.createOutputTrack()}catch(c){}}get currentState(){return this._bufferSource.currentState}get duration(){return this._bufferSource.duration}getCurrentTime(){return this._bufferSource.currentTime}startProcessAudioBuffer(e){let r=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.BUFFER_AUDIO_TRACK_START,options:[this.getTrackId(),e,this.duration]});e&&this._bufferSource.updateOptions(e),this._bufferSource.startProcessAudioBuffer(),r.onSuccess()}pauseProcessAudioBuffer(){let e=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.BUFFER_AUDIO_TRACK_PAUSE,options:[this.getTrackId()]});this._bufferSource.pauseProcessAudioBuffer(),e.onSuccess()}seekAudioBuffer(e){let r=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.BUFFER_AUDIO_TRACK_SEEK,options:[this.getTrackId()]});this._bufferSource.seekAudioBuffer(e),r.onSuccess()}resumeProcessAudioBuffer(){let e=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.BUFFER_AUDIO_TRACK_RESUME,options:[this.getTrackId()]});this._bufferSource.resumeProcessAudioBuffer(),e.onSuccess()}stopProcessAudioBuffer(){let e=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.BUFFER_AUDIO_TRACK_STOP,options:[this.getTrackId()]});this._bufferSource.stopProcessAudioBuffer(),e.onSuccess()}}ds([Or(),ar("design:type",Function),ar("design:paramtypes",[Object]),ar("design:returntype",void 0)],lc.prototype,"startProcessAudioBuffer",null),ds([Or(),ar("design:type",Function),ar("design:paramtypes",[]),ar("design:returntype",void 0)],lc.prototype,"pauseProcessAudioBuffer",null),ds([Or(),ar("design:type",Function),ar("design:paramtypes",[Number]),ar("design:returntype",void 0)],lc.prototype,"seekAudioBuffer",null),ds([Or(),ar("design:type",Function),ar("design:paramtypes",[]),ar("design:returntype",void 0)],lc.prototype,"resumeProcessAudioBuffer",null),ds([Or(),ar("design:type",Function),ar("design:paramtypes",[]),ar("design:returntype",void 0)],lc.prototype,"stopProcessAudioBuffer",null);class Tn extends Ji{constructor(){let e=fs().createMediaStreamDestination();super(e.stream.getAudioTracks()[0],void 0,mr(8,"track-mix-"));try{this._mediaStreamTrack=this._source.createOutputTrack()}catch(r){}this.destNode=e,this.trackList=[]}get isActive(){var e;return!(!this.trackList.length||!tr(e=this.trackList).call(e,r=>!r.muted))}getSubTrackLabels(){var e;return yt(e=this.trackList).call(e,r=>r.getTrackLabel())}hasAudioTrack(e){var r;return Wt(r=this.trackList).call(r,e)!==-1}addAudioTrack(e){var r;Wt(r=this.trackList).call(r,e)===-1?(z.debug("add ".concat(e.getTrackId()," to mixing track")),e._source.outputNode.connect(this.destNode),this.trackList.push(e),this.updateEncoderConfig()):z.debug("track ".concat(e.getTrackId()," is already added"))}removeAudioTrack(e){var r;if(Wt(r=this.trackList).call(r,e)!==-1){z.debug("remove ".concat(e.getTrackId()," from mixing track"));try{e._source.outputNode.disconnect(this.destNode)}catch(i){}vi(this.trackList,e),this.updateEncoderConfig()}}updateEncoderConfig(){var e;let r={};Re(e=this.trackList).call(e,i=>{i._encoderConfig&&((i._encoderConfig.bitrate||0)>(r.bitrate||0)&&(r.bitrate=i._encoderConfig.bitrate),(i._encoderConfig.sampleRate||0)>(r.sampleRate||0)&&(r.sampleRate=i._encoderConfig.sampleRate),(i._encoderConfig.sampleSize||0)>(r.sampleSize||0)&&(r.sampleSize=i._encoderConfig.sampleSize),i._encoderConfig.stereo&&(r.stereo=!0))}),this._encoderConfig=r}}class Lv extends An{constructor(){super(...arguments);this.resultStorage=new Lr}setLocalAudioStats(e,r,i){this.record("AUDIO_INPUT_LEVEL_TOO_LOW",e,this.checkAudioInputLevel(i,r)),this.record("SEND_AUDIO_BITRATE_TOO_LOW",e,this.checkSendAudioBitrate(i,r))}setLocalVideoStats(e,r,i){this.record("SEND_VIDEO_BITRATE_TOO_LOW",e,this.checkSendVideoBitrate(i,r)),this.record("FRAMERATE_INPUT_TOO_LOW",e,this.checkFramerateInput(i,r)),this.record("FRAMERATE_SENT_TOO_LOW",e,this.checkFramerateSent(i))}setRemoteAudioStats(e,r){e=e.getUserId(),this.record("AUDIO_OUTPUT_LEVEL_TOO_LOW",e,this.checkAudioOutputLevel(r))}setRemoteVideoStats(e,r){e=e.getUserId(),this.record("RECV_VIDEO_DECODE_FAILED",e,this.checkVideoDecode(r))}record(e,r,i){this.resultStorage.has(e)||this.resultStorage.set(e,{result:[],isPrevNormal:!0});let n=this.resultStorage.get(e);if(n&&(n.result.push(i),5<=n.result.length)){var c;i=Ir(c=n.result).call(c,!0),n.isPrevNormal&&!i&&this.emit("exception",lA[e],e,r),!n.isPrevNormal&&i&&this.emit("exception",lA[e]+2e3,e+"_RECOVER",r),n.isPrevNormal=i,n.result=[]}}checkAudioOutputLevel(e){return!(0<e.receiveBitrate&&e.receiveLevel===0)}checkAudioInputLevel(e,r){return r instanceof Tn&&!r.isActive||!!r.muted||e.sendVolumeLevel!==0}checkFramerateInput(e,r){let i=null;return r._encoderConfig&&r._encoderConfig.frameRate&&(i=Qn(r._encoderConfig.frameRate)),e=e.captureFrameRate,!i||!e||!(10<i&&5>e||10>i&&5<=i&&1>=e)}checkFramerateSent(e){return!(e.captureFrameRate&&e.sendFrameRate&&5<e.captureFrameRate&&1>=e.sendFrameRate)}checkSendVideoBitrate(e,r){return!!r.muted||e.sendBitrate!==0}checkSendAudioBitrate(e,r){return r instanceof Tn&&!r.isActive||!!r.muted||e.sendBitrate!==0}checkVideoDecode(e){return e.receiveBitrate===0||e.decodeFrameRate!==0}}let lA={FRAMERATE_INPUT_TOO_LOW:1001,FRAMERATE_SENT_TOO_LOW:1002,SEND_VIDEO_BITRATE_TOO_LOW:1003,RECV_VIDEO_DECODE_FAILED:1005,AUDIO_INPUT_LEVEL_TOO_LOW:2001,AUDIO_OUTPUT_LEVEL_TOO_LOW:2002,SEND_AUDIO_BITRATE_TOO_LOW:2003};class uc{constructor(e){this.localConnectionsMap=new Lr,this.remoteConnectionsMap=new Lr,this.trafficStatsPeerList=[],this.updateStats=()=>{var r,i;Re(r=this.remoteConnectionsMap).call(r,n=>{var c;let h=n.audioStats;var C=n.videoStats,x=n.pcStats;let Q=En({},cd),F=En({},ld),V=En({},Mf),Y=n.connection.pc.getStats(),$=Y.audioRecv[0],te=Y.videoRecv[0];x=x?x.videoRecv[0]:void 0;let ce=n.connection.pc._statsFilter.videoIsReady===!0,Ae=this.trafficStats&&tr(c=this.trafficStats.peer_delay).call(c,Me=>Me.peer_uid===n.connection.getUserId());$&&($.codec!=="opus"&&$.codec!=="aac"||(Q.codecType=$.codec),$.outputLevel?Q.receiveLevel=Math.round(32767*$.outputLevel):n.connection.user.audioTrack&&(Q.receiveLevel=Math.round(32767*n.connection.user.audioTrack.getVolumeLevel())),Q.receiveBytes=$.bytes,Q.receivePackets=$.packets,Q.receivePacketsLost=$.packetsLost,Q.packetLossRate=Q.receivePacketsLost/(Q.receivePackets+Q.receivePacketsLost),Q.receiveBitrate=h?8*Math.max(0,Q.receiveBytes-h.receiveBytes):0,Q.totalDuration=h?h.totalDuration+1:1,Q.totalFreezeTime=h?h.totalFreezeTime:0,Q.freezeRate=Q.totalFreezeTime/Q.totalDuration,Q.receiveDelay=$.jitterBufferMs,c=n.connection.user.audioTrack,10<Q.totalDuration&&uc.isRemoteAudioFreeze(c)&&(Q.totalFreezeTime+=1)),te&&(te.codec!=="H264"&&te.codec!=="VP8"&&te.codec!=="VP9"&&te.codec!=="AV1X"||(F.codecType=te.codec),F.receiveBytes=te.bytes,F.receiveBitrate=C?8*Math.max(0,F.receiveBytes-C.receiveBytes):0,F.decodeFrameRate=te.decodeFrameRate,F.renderFrameRate=te.decodeFrameRate,te.outputFrame&&(F.renderFrameRate=te.outputFrame.frameRate),te.receivedFrame?(F.receiveFrameRate=te.receivedFrame.frameRate,F.receiveResolutionHeight=te.receivedFrame.height,F.receiveResolutionWidth=te.receivedFrame.width):n.connection.user.videoTrack&&(F.receiveResolutionHeight=n.connection.user.videoTrack._videoHeight||0,F.receiveResolutionWidth=n.connection.user.videoTrack._videoWidth||0),te.framesRateFirefox!==void 0&&(F.receiveFrameRate=Math.round(te.framesRateFirefox)),F.receivePackets=te.packets,F.receivePacketsLost=te.packetsLost,F.packetLossRate=F.receivePacketsLost/(F.receivePackets+F.receivePacketsLost),F.totalDuration=C?C.totalDuration+1:1,F.totalFreezeTime=C?C.totalFreezeTime:0,F.receiveDelay=te.jitterBufferMs||0,C=n.connection.user.videoTrack,n.connection.subscribeOptions.video&&ce&&uc.isRemoteVideoFreeze(C,te,x)&&(F.totalFreezeTime+=1),F.freezeRate=F.totalFreezeTime/F.totalDuration),Ae&&(Q.end2EndDelay=Ae.B_ad,F.end2EndDelay=Ae.B_vd,Q.transportDelay=Ae.B_ed,F.transportDelay=Ae.B_ed,Q.currentPacketLossRate=Ae.B_ealr4/100,F.currentPacketLossRate=Ae.B_evlr4/100,V.uplinkNetworkQuality=Ae.B_punq?Ae.B_punq:0,V.downlinkNetworkQuality=Ae.B_pdnq?Ae.B_punq:0),n.audioStats=Q,n.videoStats=F,n.pcStats=Y,n.networkStats=V,n.connection.user.audioTrack&&this.exceptionMonitor.setRemoteAudioStats(n.connection.user.audioTrack,Q),n.connection.user.videoTrack&&this.exceptionMonitor.setRemoteVideoStats(n.connection.user.videoTrack,F)}),Re(i=this.localConnectionsMap).call(i,n=>{let c=n.audioStats,h=n.videoStats,C=En({},Wl),x=En({},Vl);var Q=n.connection.pc.getStats();let F=Q.audioSend[0];Q=Q.videoSend[0];let V=n.connection.getUserId();F&&(F.codec!=="opus"&&F.codec!=="aac"||(C.codecType=F.codec),F.inputLevel?C.sendVolumeLevel=Math.round(32767*F.inputLevel):n.connection.audioTrack&&(C.sendVolumeLevel=Math.round(32767*n.connection.audioTrack.getVolumeLevel())),C.sendBytes=F.bytes,C.sendPackets=F.packets,C.sendPacketsLost=F.packetsLost,C.sendBitrate=c?8*Math.max(0,C.sendBytes-c.sendBytes):0),Q&&(Q.codec!=="H264"&&Q.codec!=="VP8"&&Q.codec!=="VP9"&&Q.codec!=="AV1X"||(x.codecType=Q.codec),x.sendBytes=Q.bytes,x.sendBitrate=h?8*Math.max(0,x.sendBytes-h.sendBytes):0,Q.inputFrame?(x.captureFrameRate=Q.inputFrame.frameRate,x.captureResolutionHeight=Q.inputFrame.height,x.captureResolutionWidth=Q.inputFrame.width):n.connection.videoTrack&&(x.captureResolutionWidth=n.connection.videoTrack._videoWidth||0,x.captureResolutionHeight=n.connection.videoTrack._videoHeight||0),Q.sentFrame?(x.sendFrameRate=Q.sentFrame.frameRate,x.sendResolutionHeight=Q.sentFrame.height,x.sendResolutionWidth=Q.sentFrame.width):n.connection.videoTrack&&(x.sendResolutionWidth=n.connection.videoTrack._videoWidth||0,x.sendResolutionHeight=n.connection.videoTrack._videoHeight||0),Q.avgEncodeMs&&(x.encodeDelay=Q.avgEncodeMs),n.connection.videoTrack&&n.connection.videoTrack._encoderConfig&&n.connection.videoTrack._encoderConfig.bitrateMax&&(x.targetSendBitrate=1e3*n.connection.videoTrack._encoderConfig.bitrateMax),x.sendPackets=Q.packets,x.sendPacketsLost=Q.packetsLost,x.totalDuration=h?h.totalDuration+1:1,x.totalFreezeTime=h?h.totalFreezeTime:0,this.isLocalVideoFreeze(Q)&&(x.totalFreezeTime+=1)),this.trafficStats&&(C.sendPacketsLost=this.trafficStats.B_palr4/100,x.sendPacketsLost=this.trafficStats.B_pvlr4/100),n.audioStats=C,n.videoStats=x,n.audioStats&&n.connection.audioTrack&&this.exceptionMonitor.setLocalAudioStats(V,n.connection.audioTrack,n.audioStats),n.videoStats&&n.connection.videoTrack&&this.exceptionMonitor.setLocalVideoStats(V,n.connection.videoTrack,n.videoStats)})},this.clientId=e,this.updateStatsInterval=window.setInterval(this.updateStats,1e3),this.exceptionMonitor=new Lv,this.exceptionMonitor.on("exception",(r,i,n)=>{this.onStatsException&&this.onStatsException(r,i,n)})}reset(){this.localConnectionsMap=new Lr,this.remoteConnectionsMap=new Lr,this.trafficStats=void 0,this.trafficStatsPeerList=[],this.uplinkStats=void 0}getLocalAudioTrackStats(e){return(e=this.localConnectionsMap.get(e))&&e.audioStats?e.audioStats:En({},Wl)}getLocalVideoTrackStats(e){return(e=this.localConnectionsMap.get(e))&&e.videoStats?e.videoStats:En({},Vl)}getRemoteAudioTrackStats(e){var r;let i=this.remoteConnectionsMap.get(e);return!i||!i.audioStats?En({},cd):this.trafficStats?(e=tr(r=this.trafficStats.peer_delay).call(r,n=>n.peer_uid===i.connection.user.uid),e&&(i.audioStats.publishDuration=e.B_ppad+(ot()-this.trafficStats.timestamp)),i.audioStats):i.audioStats}getRemoteNetworkQualityStats(e){return(e=this.remoteConnectionsMap.get(e))&&e.networkStats?e.networkStats:En({},Mf)}getRemoteVideoTrackStats(e){var r;let i=this.remoteConnectionsMap.get(e);return!i||!i.videoStats?En({},ld):this.trafficStats?(e=tr(r=this.trafficStats.peer_delay).call(r,n=>n.peer_uid===i.connection.user.uid),e&&(i.videoStats.publishDuration=e.B_ppvd+(ot()-this.trafficStats.timestamp)),i.videoStats):i.videoStats}getRTCStats(){var e,r;let i=0,n=0,c=0,h=0;return Re(e=this.localConnectionsMap).call(e,C=>{C.audioStats&&(i+=C.audioStats.sendBytes,n+=C.audioStats.sendBitrate),C.videoStats&&(i+=C.videoStats.sendBytes,n+=C.videoStats.sendBitrate)}),Re(r=this.remoteConnectionsMap).call(r,C=>{C.audioStats&&(c+=C.audioStats.receiveBytes,h+=C.audioStats.receiveBitrate),C.videoStats&&(c+=C.videoStats.receiveBytes,h+=C.videoStats.receiveBitrate)}),e=1,this.trafficStats&&(e+=this.trafficStats.peer_delay.length),{Duration:0,UserCount:e,SendBitrate:n,SendBytes:i,RecvBytes:c,RecvBitrate:h,OutgoingAvailableBandwidth:this.uplinkStats?this.uplinkStats.B_uab/1e3:0,RTT:this.trafficStats?2*this.trafficStats.B_acd:0}}removeConnection(e){this.localConnectionsMap.delete(e),this.remoteConnectionsMap.delete(e)}addLocalConnection(e){let r=e.connectionId;this.localConnectionsMap.has(r)||this.localConnectionsMap.set(r,{connection:e})}addRemoteConnection(e){let r=e.connectionId;this.remoteConnectionsMap.has(r)||this.remoteConnectionsMap.set(r,{connection:e})}updateTrafficStats(e){var r;let i=Gt(r=e.peer_delay).call(r,n=>{var c;return Wt(c=this.trafficStatsPeerList).call(c,n.peer_uid)===-1});Re(i).call(i,n=>{var c,h;let C=tr(c=io(Ma(h=this.remoteConnectionsMap).call(h))).call(c,x=>x.connection._userId===n.peer_uid);n.B_ppad!==void 0&&n.B_ppvd!==void 0&&(this.onUploadPublishDuration&&this.onUploadPublishDuration(n.peer_uid,n.B_ppad,n.B_ppvd,C?ot()-C.connection.startTime:0),this.trafficStatsPeerList.push(n.peer_uid))}),this.trafficStats=e}updateUplinkStats(e){var r;this.uplinkStats&&this.uplinkStats.B_fir!==e.B_fir&&z.debug(ne(r="[".concat(this.clientId,"]: Period fir changes to ")).call(r,e.B_fir)),this.uplinkStats=e}static isRemoteVideoFreeze(e,r,i){return e?(e=!i||r.framesDecodeCount>i.framesDecodeCount,!!i&&r.framesDecodeFreezeTime>i.framesDecodeFreezeTime||!e):!1}static isRemoteAudioFreeze(e){return!!e&&e._isFreeze()}isLocalVideoFreeze(e){return!(!e.inputFrame||!e.sentFrame)&&5<e.inputFrame.frameRate&&3>e.sentFrame.frameRate}}var uA;let Xl=()=>{},dA={},hA=new class{constructor(){this.fnMap=new Lr}throttleByKey(t,e,r,i,...n){if(this.fnMap.has(e)){var c=this.fnMap.get(e);c.threshold!==r?(c.fn(...c.args),clearTimeout(c.timer),c=window.setTimeout(()=>{const h=this.fnMap.get(e);h&&h.fn(...h.args),this.fnMap.delete(e)},r),this.fnMap.set(e,{fn:t,threshold:r,timer:c,args:n,skipFn:i})):(c.skipFn&&c.skipFn(...c.args),this.fnMap.set(e,Sa({},c,{fn:t,args:n,skipFn:i})))}else c=window.setTimeout(()=>{const h=this.fnMap.get(e);h&&h.fn(...h.args),this.fnMap.delete(e)},r),this.fnMap.set(e,{fn:t,threshold:r,timer:c,args:n,skipFn:i})}},fA=Si(uA=hA.throttleByKey).call(uA,hA),dc=c=>Ee(this,[c],function*({fragementLength:t,referenceList:e,asyncMapHandler:r,allFailedhandler:i,promisesCollector:n}){let h=0,C,x=0;const Q=()=>Ee(this,null,function*(){const F=(()=>{var V=h*t;const Y=V+t;return V=$i(e).call(e,V,Y),yt(V).call(V,r)})();n&&n.push(...F);try{C=yield Gn(F)}catch(V){if(x+=t,h++,!(x>=e.length))return void(yield Q());i(V)}Re(F).call(F,V=>V.cancel())});return yield Q(),C}),Dv={[oc.ACCESS_POINT]:{[hn.NO_FLAG_SET]:{desc:"flag is zero",retry:!1},[hn.FLAG_SET_BUT_EMPTY]:{desc:"flag is empty",retry:!1},[hn.INVALID_FALG_SET]:{desc:"invalid flag",retry:!1},[hn.NO_SERVICE_AVAILABLE]:{desc:"no service available",retry:!0},[hn.NO_SERVICE_AVAILABLE_P2P]:{desc:"no unilbs p2p service available",retry:!0},[hn.NO_SERVICE_AVAILABLE_VOET]:{desc:"no unilbs voice service available",retry:!0},[hn.NO_SERVICE_AVAILABLE_WEBRTC]:{desc:"no unilbs webrtc service available",retry:!0},[hn.NO_SERVICE_AVAILABLE_CDS]:{desc:"no cds service available",retry:!0},[hn.NO_SERVICE_AVAILABLE_CDN]:{desc:"no cdn dispatcher service available",retry:!0},[hn.NO_SERVICE_AVAILABLE_TDS]:{desc:"no tds service available",retry:!0},[hn.NO_SERVICE_AVAILABLE_REPORT]:{desc:"no unilbs report service available",retry:!0},[hn.NO_SERVICE_AVAILABLE_APP_CENTER]:{desc:"no app center service available",retry:!0},[hn.NO_SERVICE_AVAILABLE_ENV0]:{desc:"no unilbs sig env0 service available",retry:!0},[hn.NO_SERVICE_AVAILABLE_VOET]:{desc:"no unilbs voet service available",retry:!0},[hn.NO_SERVICE_AVAILABLE_STRING_UID]:{desc:"no string uid service available",retry:!0},[hn.NO_SERVICE_AVAILABLE_WEBRTC_UNILBS]:{desc:"no webrtc unilbs service available",retry:!0}},[oc.UNILBS]:{[cs.INVALID_VENDOR_KEY]:{desc:"invalid vendor key, can not find appid",retry:!1},[cs.INVALID_CHANNEL_NAME]:{desc:"invalid channel name",retry:!1},[cs.INTERNAL_ERROR]:{desc:"unilbs internal error",retry:!1},[cs.NO_AUTHORIZED]:{desc:"invalid token, authorized failed",retry:!1},[cs.DYNAMIC_KEY_TIMEOUT]:{desc:"dynamic key or token timeout",retry:!1},[cs.NO_ACTIVE_STATUS]:{desc:"no active status",retry:!1},[cs.DYNAMIC_KEY_EXPIRED]:{desc:"dynamic key expired",retry:!1},[cs.STATIC_USE_DYNAMIC_KEY]:{desc:"static use dynamic key",retry:!1},[cs.DYNAMIC_USE_STATIC_KEY]:{desc:"dynamic use static key",retry:!1},[cs.USER_OVERLOAD]:{desc:"amount of users over load",retry:!1},[cs.FORBIDDEN_REGION]:{desc:"the request is forbidden in this area",retry:!1},[cs.CANNOT_MEET_AREA_DEMAND]:{desc:"unable to allocate services in this area",retry:!1}},[oc.STRING_UID_ALLOCATOR]:{[Vc.IIIEGAL_APPID]:{desc:"invalid appid",retry:!1},[Vc.IIIEGAL_UID]:{desc:"invalid string uid",retry:!1},[Vc.INTERNAL_ERROR]:{desc:"string uid allocator internal error",retry:!0}}},bv={[Ot.K_TIMESTAMP_EXPIRED]:{desc:"K_TIMESTAMP_EXPIRED",action:"failed"},[Ot.K_CHANNEL_PERMISSION_INVALID]:{desc:"K_CHANNEL_PERMISSION_INVALID",action:"failed"},[Ot.K_CERTIFICATE_INVALID]:{desc:"K_CERTIFICATE_INVALID",action:"failed"},[Ot.K_CHANNEL_NAME_EMPTY]:{desc:"K_CHANNEL_NAME_EMPTY",action:"failed"},[Ot.K_CHANNEL_NOT_FOUND]:{desc:"K_CHANNEL_NOT_FOUND",action:"failed"},[Ot.K_TICKET_INVALID]:{desc:"K_TICKET_INVALID",action:"failed"},[Ot.K_CHANNEL_CONFLICTED]:{desc:"K_CHANNEL_CONFLICTED",action:"failed"},[Ot.K_SERVICE_NOT_READY]:{desc:"K_SERVICE_NOT_READY",action:"tryNext"},[Ot.K_SERVICE_TOO_HEAVY]:{desc:"K_SERVICE_TOO_HEAVY",action:"tryNext"},[Ot.K_UID_BANNED]:{desc:"K_UID_BANNED",action:"failed"},[Ot.K_IP_BANNED]:{desc:"K_IP_BANNED",action:"failed"},[Ot.ERR_INVALID_VENDOR_KEY]:{desc:"ERR_INVALID_VENDOR_KEY",action:"failed"},[Ot.ERR_INVALID_CHANNEL_NAME]:{desc:"ERR_INVALID_CHANNEL_NAME",action:"failed"},[Ot.WARN_NO_AVAILABLE_CHANNEL]:{desc:"WARN_NO_AVAILABLE_CHANNEL",action:"failed"},[Ot.WARN_LOOKUP_CHANNEL_TIMEOUT]:{desc:"WARN_LOOKUP_CHANNEL_TIMEOUT",action:"tryNext"},[Ot.WARN_LOOKUP_CHANNEL_REJECTED]:{desc:"WARN_LOOKUP_CHANNEL_REJECTED",action:"failed"},[Ot.WARN_OPEN_CHANNEL_TIMEOUT]:{desc:"WARN_OPEN_CHANNEL_TIMEOUT",action:"tryNext"},[Ot.WARN_OPEN_CHANNEL_REJECTED]:{desc:"WARN_OPEN_CHANNEL_REJECTED",action:"failed"},[Ot.WARN_REQUEST_DEFERRED]:{desc:"WARN_REQUEST_DEFERRED",action:"failed"},[Ot.ERR_DYNAMIC_KEY_TIMEOUT]:{desc:"ERR_DYNAMIC_KEY_TIMEOUT",action:"failed"},[Ot.ERR_NO_AUTHORIZED]:{desc:"ERR_NO_AUTHORIZED",action:"failed"},[Ot.ERR_VOM_SERVICE_UNAVAILABLE]:{desc:"ERR_VOM_SERVICE_UNAVAILABLE",action:"tryNext"},[Ot.ERR_NO_CHANNEL_AVAILABLE_CODE]:{desc:"ERR_NO_CHANNEL_AVAILABLE_CODE",action:"failed"},[Ot.ERR_MASTER_VOCS_UNAVAILABLE]:{desc:"ERR_MASTER_VOCS_UNAVAILABLE",action:"tryNext"},[Ot.ERR_INTERNAL_ERROR]:{desc:"ERR_INTERNAL_ERROR",action:"tryNext"},[Ot.ERR_NO_ACTIVE_STATUS]:{desc:"ERR_NO_ACTIVE_STATUS",action:"failed"},[Ot.ERR_INVALID_UID]:{desc:"ERR_INVALID_UID",action:"failed"},[Ot.ERR_DYNAMIC_KEY_EXPIRED]:{desc:"ERR_DYNAMIC_KEY_EXPIRED",action:"failed"},[Ot.ERR_STATIC_USE_DYANMIC_KE]:{desc:"ERR_STATIC_USE_DYANMIC_KE",action:"failed"},[Ot.ERR_DYNAMIC_USE_STATIC_KE]:{desc:"ERR_DYNAMIC_USE_STATIC_KE",action:"failed"},[Ot.ERR_NO_VOCS_AVAILABLE]:{desc:"ERR_NO_VOCS_AVAILABLE",action:"tryNext"},[Ot.ERR_NO_VOS_AVAILABLE]:{desc:"ERR_NO_VOS_AVAILABLE",action:"tryNext"},[Ot.ERR_JOIN_CHANNEL_TIMEOUT]:{desc:"ERR_JOIN_CHANNEL_TIMEOUT",action:"tryNext"},[Ot.ERR_JOIN_BY_MULTI_IP]:{desc:"ERR_JOIN_BY_MULTI_IP",action:"recover"},[Ot.ERR_NOT_JOINED]:{desc:"ERR_NOT_JOINED",action:"failed"},[Ot.ERR_REPEAT_JOIN_REQUEST]:{desc:"ERR_REPEAT_JOIN_REQUEST",action:"quit"},[Ot.ERR_REPEAT_JOIN_CHANNEL]:{desc:"ERR_REPEAT_JOIN_CHANNEL",action:"quit"},[Ot.ERR_INVALID_VENDOR_KEY]:{desc:"ERR_INVALID_VENDOR_KEY",action:"failed"},[Ot.ERR_INVALID_CHANNEL_NAME]:{desc:"ERR_INVALID_CHANNEL_NAME",action:"failed"},[Ot.ERR_INVALID_STRINGUID]:{desc:"ERR_INVALID_STRINGUID",action:"failed"},[Ot.ERR_TOO_MANY_USERS]:{desc:"ERR_TOO_MANY_USERS",action:"tryNext"},[Ot.ERR_SET_CLIENT_ROLE_TIMEOUT]:{desc:"ERR_SET_CLIENT_ROLE_TIMEOUT",action:"failed"},[Ot.ERR_SET_CLIENT_ROLE_NO_PERMISSION]:{desc:"ERR_SET_CLIENT_ROLE_TIMEOUT",action:"failed"},[Ot.ERR_SET_CLIENT_ROLE_ALREADY_IN_USE]:{desc:"ERR_SET_CLIENT_ROLE_ALREADY_IN_USE",action:"success"},[Ot.ERR_PUBLISH_REQUEST_INVALID]:{desc:"ERR_PUBLISH_REQUEST_INVALID",action:"failed"},[Ot.ERR_SUBSCRIBE_REQUEST_INVALID]:{desc:"ERR_SUBSCRIBE_REQUEST_INVALID",action:"failed"},[Ot.ERR_NOT_SUPPORTED_MESSAGE]:{desc:"ERR_NOT_SUPPORTED_MESSAGE",action:"failed"},[Ot.ERR_ILLEAGAL_PLUGIN]:{desc:"ERR_ILLEAGAL_PLUGIN",action:"failed"},[Ot.ILLEGAL_CLIENT_ROLE_LEVEL]:{desc:"ILLEGAL_CLIENT_ROLE_LEVEL",action:"failed"},[Ot.ERR_REJOIN_TOKEN_INVALID]:{desc:"ERR_REJOIN_TOKEN_INVALID",action:"failed"},[Ot.ERR_REJOIN_USER_NOT_JOINED]:{desc:"ERR_REJOIN_NOT_JOINED",action:"failed"},[Ot.ERR_INVALID_OPTIONAL_INFO]:{desc:"ERR_INVALID_OPTIONAL_INFO",action:"quit"},[Ot.ERR_TEST_RECOVER]:{desc:"ERR_TEST_RECOVER",action:"recover"},[Ot.ERR_TEST_TRYNEXT]:{desc:"ERR_TEST_TRYNEXT",action:"recover"},[Ot.ERR_TEST_RETRY]:{desc:"ERR_TEST_RETRY",action:"recover"},[Ot.ILLEGAL_AES_PASSWORD]:{desc:"ERR_TEST_RETRY",action:"failed"}};var Ov=k(function(t,e){t.exports=function(){function r(pe){for(var J=pe.length,me=0,ye=0;ye<J;){var Ve=pe.charCodeAt(ye++);if((4294967168&Ve)!=0)if((4294965248&Ve)==0)me+=2;else{if(55296<=Ve&&56319>=Ve&&ye<J){var De=pe.charCodeAt(ye);(64512&De)==56320&&(++ye,Ve=((1023&Ve)<<10)+(1023&De)+65536)}me+=(4294901760&Ve)==0?3:4}else me++}return me}function i(pe,J,me){me=J+me;for(var ye=[],Ve="";J<me;){var De=pe[J++];if((128&De)==0)ye.push(De);else if((224&De)==192){var It=63&pe[J++];ye.push((31&De)<<6|It)}else if((240&De)==224){It=63&pe[J++];var tt=63&pe[J++];ye.push((31&De)<<12|It<<6|tt)}else(248&De)==240&&(De=(7&De)<<18|(63&pe[J++])<<12|(63&pe[J++])<<6|63&pe[J++],65535<De&&(De-=65536,ye.push(De>>>10&1023|55296),De=56320|1023&De)),ye.push(De);4096<=ye.length&&(Ve+=String.fromCharCode.apply(String,Et([],Dr(ye))),ye.length=0)}return 0<ye.length&&(Ve+=String.fromCharCode.apply(String,Et([],Dr(ye)))),Ve}function n(pe,J){return 4294967296*pe.getInt32(J)+pe.getUint32(J+4)}function c(pe){var J,me=pe.sec;if(pe=pe.nsec,0<=me&&0<=pe&&17179869183>=me){if(pe===0&&4294967295>=me){var ye=new Uint8Array(4);return new DataView(ye.buffer).setUint32(0,me),ye}var Ve=me/4294967296;return me&=4294967295,ye=new Uint8Array(8),(J=new DataView(ye.buffer)).setUint32(0,pe<<2|3&Ve),J.setUint32(4,me),ye}return ye=new Uint8Array(12),(J=new DataView(ye.buffer)).setUint32(0,pe),J.setUint32(4,Math.floor(me/4294967296)),J.setUint32(8,me),ye}function h(pe){var J=pe.getTime();pe=Math.floor(J/1e3),J=1e6*(J-1e3*pe);var me=Math.floor(J/1e9);return{sec:pe+me,nsec:J-1e9*me}}function C(pe){return pe instanceof Date?c(h(pe)):null}function x(pe){var J=new DataView(pe.buffer,pe.byteOffset,pe.byteLength);switch(pe.byteLength){case 4:return{sec:J.getUint32(0),nsec:0};case 8:return pe=J.getUint32(0),{sec:4294967296*(3&pe)+J.getUint32(4),nsec:pe>>>2};case 12:return{sec:n(J,4),nsec:J.getUint32(0)};default:throw Error("Unrecognized data size for timestamp: "+pe.length)}}function Q(pe){return pe=x(pe),new Date(1e3*pe.sec+pe.nsec/1e6)}function F(pe){return pe instanceof Uint8Array?pe:ArrayBuffer.isView(pe)?new Uint8Array(pe.buffer,pe.byteOffset,pe.byteLength):pe instanceof ArrayBuffer?new Uint8Array(pe):Uint8Array.from(pe)}function V(pe,J){return J===void 0&&(J=St),new Ut(J.extensionCodec,J.context,J.maxDepth,J.initialBufferSize,J.sortKeys,J.forceFloat32,J.ignoreUndefined,J.forceIntegerToFloat).encode(pe)}function Y(pe){return(0>pe?"-":"")+"0x"+Math.abs(pe).toString(16).padStart(2,"0")}function $(pe,J){return J===void 0&&(J=mc),new vc(J.extensionCodec,J.context,J.maxStrLength,J.maxBinLength,J.maxArrayLength,J.maxMapLength,J.maxExtLength).decode(pe)}function te(pe,J){return J===void 0&&(J=mc),new vc(J.extensionCodec,J.context,J.maxStrLength,J.maxBinLength,J.maxArrayLength,J.maxMapLength,J.maxExtLength).decodeMulti(pe)}function ce(pe){return pe[Symbol.asyncIterator]!=null?pe:function(J){return o0(this,arguments,function(){var me,ye,Ve,De;return s0(this,function(It){switch(It.label){case 0:me=J.getReader(),It.label=1;case 1:It.trys.push([1,,9,10]),It.label=2;case 2:return[4,Ec(me.read())];case 3:return ye=It.sent(),Ve=ye.done,De=ye.value,Ve?[4,Ec(void 0)]:[3,5];case 4:return[2,It.sent()];case 5:if(De==null)throw Error("Assertion Failure: value must not be null nor undefined");return[4,Ec(De)];case 6:return[4,It.sent()];case 7:return It.sent(),[3,2];case 8:return[3,10];case 9:return me.releaseLock(),[7];case 10:return[2]}})})}(pe)}function Ae(pe,J){return J===void 0&&(J=mc),me=this,ye=void 0,De=function(){var It;return function(tt,zt){function Gr(Ls){return function(_c){return function(Cr){if(nt)throw new TypeError("Generator is already executing.");for(;vr;)try{if(nt=1,Tt&&(_t=2&Cr[0]?Tt.return:Cr[0]?Tt.throw||((_t=Tt.return)&&_t.call(Tt),0):Tt.next)&&!(_t=_t.call(Tt,Cr[1])).done)return _t;switch(Tt=0,_t&&(Cr=[2&Cr[0],_t.value]),Cr[0]){case 0:case 1:_t=Cr;break;case 4:return vr.label++,{value:Cr[1],done:!1};case 5:vr.label++,Tt=Cr[1],Cr=[0];continue;case 7:Cr=vr.ops.pop(),vr.trys.pop();continue;default:if(!((_t=0<(_t=vr.trys).length&&_t[_t.length-1])||Cr[0]!==6&&Cr[0]!==2)){vr=0;continue}if(Cr[0]===3&&(!_t||Cr[1]>_t[0]&&Cr[1]<_t[3]))vr.label=Cr[1];else if(Cr[0]===6&&vr.label<_t[1])vr.label=_t[1],_t=Cr;else if(_t&&vr.label<_t[2])vr.label=_t[2],vr.ops.push(Cr);else{_t[2]&&vr.ops.pop(),vr.trys.pop();continue}}Cr=zt.call(tt,vr)}catch(du){Cr=[6,du],Tt=0}finally{nt=_t=0}if(5&Cr[0])throw Cr[1];return{value:Cr[0]?Cr[1]:void 0,done:!0}}([Ls,_c])}}var nt,Tt,_t,ni,vr={label:0,sent:function(){if(1&_t[0])throw _t[1];return _t[1]},trys:[],ops:[]};return ni={next:Gr(0),throw:Gr(1),return:Gr(2)},typeof Symbol=="function"&&(ni[Symbol.iterator]=function(){return this}),ni}(this,function(tt){return It=ce(pe),[2,new vc(J.extensionCodec,J.context,J.maxStrLength,J.maxBinLength,J.maxArrayLength,J.maxMapLength,J.maxExtLength).decodeAsync(It)]})},new(Ve=void 0,Ve=Promise)(function(It,tt){function zt(Tt){try{nt(De.next(Tt))}catch(_t){tt(_t)}}function Gr(Tt){try{nt(De.throw(Tt))}catch(_t){tt(_t)}}function nt(Tt){var _t;Tt.done?It(Tt.value):(_t=Tt.value,_t instanceof Ve?_t:new Ve(function(ni){ni(_t)})).then(zt,Gr)}nt((De=De.apply(me,ye||[])).next())});var me,ye,Ve,De}function Me(pe,J){return J===void 0&&(J=mc),pe=ce(pe),new vc(J.extensionCodec,J.context,J.maxStrLength,J.maxBinLength,J.maxArrayLength,J.maxMapLength,J.maxExtLength).decodeArrayStream(pe)}function et(pe,J){return J===void 0&&(J=mc),pe=ce(pe),new vc(J.extensionCodec,J.context,J.maxStrLength,J.maxBinLength,J.maxArrayLength,J.maxMapLength,J.maxExtLength).decodeStream(pe)}function vt(pe,J){return J===void 0&&(J=mc),et(pe,J)}var kt={d:function(pe,J){for(var me in J)kt.o(J,me)&&!kt.o(pe,me)&&Object.defineProperty(pe,me,{enumerable:!0,get:J[me]})},o:function(pe,J){return Object.prototype.hasOwnProperty.call(pe,J)},r:function(pe){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(pe,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(pe,"__esModule",{value:!0})}},Pt={};kt.r(Pt),kt.d(Pt,{DecodeError:function(){return To},Decoder:function(){return vc},EXT_TIMESTAMP:function(){return Ne},Encoder:function(){return Ut},ExtData:function(){return Ce},ExtensionCodec:function(){return at},decode:function(){return $},decodeArrayStream:function(){return Me},decodeAsync:function(){return Ae},decodeMulti:function(){return te},decodeMultiStream:function(){return et},decodeStream:function(){return vt},decodeTimestampExtension:function(){return Q},decodeTimestampToTimeSpec:function(){return x},encode:function(){return V},encodeDateToTimeSpec:function(){return h},encodeTimeSpecToTimestamp:function(){return c},encodeTimestampExtension:function(){return C}});var Dr=function(pe,J){var me=typeof Symbol=="function"&&pe[Symbol.iterator];if(!me)return pe;var ye;pe=me.call(pe);var Ve=[];try{for(;(J===void 0||0<J--)&&!(ye=pe.next()).done;)Ve.push(ye.value)}catch(It){var De={error:It}}finally{try{ye&&!ye.done&&(me=pe.return)&&me.call(pe)}finally{if(De)throw De.error}}return Ve},Et=function(pe,J){for(var me=0,ye=J.length,Ve=pe.length;me<ye;me++,Ve++)pe[Ve]=J[me];return pe},nr=typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined",Tr=nr?new TextEncoder:void 0,ui=nr?typeof process!="undefined"?200:0:4294967295,zi=(Tr==null?0:Tr.encodeInto)?function(pe,J,me){Tr.encodeInto(pe,J.subarray(me))}:function(pe,J,me){J.set(Tr.encode(pe),me)},Wr=nr?new TextDecoder:null,Rn=nr?typeof process!="undefined"?200:0:4294967295,Ce=function(pe,J){this.type=pe,this.data=J},Ne=-1,Je={type:Ne,encode:C,decode:Q},at=function(){function pe(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Je)}return pe.prototype.register=function(J){var me=J.type,ye=J.encode;J=J.decode,0<=me?(this.encoders[me]=ye,this.decoders[me]=J):(me=1+me,this.builtInEncoders[me]=ye,this.builtInDecoders[me]=J)},pe.prototype.tryToEncode=function(J,me){for(var ye=0;ye<this.builtInEncoders.length;ye++)if((Ve=this.builtInEncoders[ye])!=null&&(De=Ve(J,me))!=null)return new Ce(-1-ye,De);for(ye=0;ye<this.encoders.length;ye++){var Ve,De;if((Ve=this.encoders[ye])!=null&&(De=Ve(J,me))!=null)return new Ce(ye,De)}return J instanceof Ce?J:null},pe.prototype.decode=function(J,me,ye){var Ve=0>me?this.builtInDecoders[-1-me]:this.decoders[me];return Ve?Ve(J,me,ye):new Ce(me,J)},pe.defaultCodec=new pe,pe}(),ct=function(pe){var J=typeof Symbol=="function"&&Symbol.iterator,me=J&&pe[J],ye=0;if(me)return me.call(pe);if(pe&&typeof pe.length=="number")return{next:function(){return pe&&ye>=pe.length&&(pe=void 0),{value:pe&&pe[ye++],done:!pe}}};throw new TypeError(J?"Object is not iterable.":"Symbol.iterator is not defined.")},Ut=function(){function pe(J,me,ye,Ve,De,It,tt,zt){J===void 0&&(J=at.defaultCodec),me===void 0&&(me=void 0),ye===void 0&&(ye=100),Ve===void 0&&(Ve=2048),De===void 0&&(De=!1),It===void 0&&(It=!1),tt===void 0&&(tt=!1),zt===void 0&&(zt=!1),this.extensionCodec=J,this.context=me,this.maxDepth=ye,this.initialBufferSize=Ve,this.sortKeys=De,this.forceFloat32=It,this.ignoreUndefined=tt,this.forceIntegerToFloat=zt,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}return pe.prototype.getUint8Array=function(){return this.bytes.subarray(0,this.pos)},pe.prototype.reinitializeState=function(){this.pos=0},pe.prototype.encode=function(J){return this.reinitializeState(),this.doEncode(J,1),this.getUint8Array()},pe.prototype.doEncode=function(J,me){if(me>this.maxDepth)throw Error("Too deep objects in depth "+me);J==null?this.encodeNil():typeof J=="boolean"?this.encodeBoolean(J):typeof J=="number"?this.encodeNumber(J):typeof J=="string"?this.encodeString(J):this.encodeObject(J,me)},pe.prototype.ensureBufferSizeToWrite=function(J){J=this.pos+J,this.view.byteLength<J&&this.resizeBuffer(2*J)},pe.prototype.resizeBuffer=function(J){var me=new ArrayBuffer(J);J=new Uint8Array(me),me=new DataView(me),J.set(this.bytes),this.view=me,this.bytes=J},pe.prototype.encodeNil=function(){this.writeU8(192)},pe.prototype.encodeBoolean=function(J){J===!1?this.writeU8(194):this.writeU8(195)},pe.prototype.encodeNumber=function(J){Number.isSafeInteger(J)&&!this.forceIntegerToFloat?0<=J?128>J?this.writeU8(J):256>J?(this.writeU8(204),this.writeU8(J)):65536>J?(this.writeU8(205),this.writeU16(J)):4294967296>J?(this.writeU8(206),this.writeU32(J)):(this.writeU8(207),this.writeU64(J)):-32<=J?this.writeU8(224|J+32):-128<=J?(this.writeU8(208),this.writeI8(J)):-32768<=J?(this.writeU8(209),this.writeI16(J)):-2147483648<=J?(this.writeU8(210),this.writeI32(J)):(this.writeU8(211),this.writeI64(J)):this.forceFloat32?(this.writeU8(202),this.writeF32(J)):(this.writeU8(203),this.writeF64(J))},pe.prototype.writeStringHeader=function(J){if(32>J)this.writeU8(160+J);else if(256>J)this.writeU8(217),this.writeU8(J);else if(65536>J)this.writeU8(218),this.writeU16(J);else{if(!(4294967296>J))throw Error("Too long string: "+J+" bytes in UTF-8");this.writeU8(219),this.writeU32(J)}},pe.prototype.encodeString=function(J){if(J.length>ui){var me=r(J);this.ensureBufferSizeToWrite(5+me),this.writeStringHeader(me),zi(J,this.bytes,this.pos)}else{me=r(J),this.ensureBufferSizeToWrite(5+me),this.writeStringHeader(me);for(var ye=this.bytes,Ve=J.length,De=this.pos,It=0;It<Ve;){var tt=J.charCodeAt(It++);if((4294967168&tt)!=0){if((4294965248&tt)==0)ye[De++]=tt>>6&31|192;else{if(55296<=tt&&56319>=tt&&It<Ve){var zt=J.charCodeAt(It);(64512&zt)==56320&&(++It,tt=((1023&tt)<<10)+(1023&zt)+65536)}(4294901760&tt)==0?(ye[De++]=tt>>12&15|224,ye[De++]=tt>>6&63|128):(ye[De++]=tt>>18&7|240,ye[De++]=tt>>12&63|128,ye[De++]=tt>>6&63|128)}ye[De++]=63&tt|128}else ye[De++]=tt}}this.pos+=me},pe.prototype.encodeObject=function(J,me){var ye=this.extensionCodec.tryToEncode(J,this.context);if(ye!=null)this.encodeExtension(ye);else if(Array.isArray(J))this.encodeArray(J,me);else if(ArrayBuffer.isView(J))this.encodeBinary(J);else{if(typeof J!="object")throw Error("Unrecognized object: "+Object.prototype.toString.apply(J));this.encodeMap(J,me)}},pe.prototype.encodeBinary=function(J){var me=J.byteLength;if(256>me)this.writeU8(196),this.writeU8(me);else if(65536>me)this.writeU8(197),this.writeU16(me);else{if(!(4294967296>me))throw Error("Too large binary: "+me);this.writeU8(198),this.writeU32(me)}J=F(J),this.writeU8a(J)},pe.prototype.encodeArray=function(J,me){var ye,Ve=J.length;if(16>Ve)this.writeU8(144+Ve);else if(65536>Ve)this.writeU8(220),this.writeU16(Ve);else{if(!(4294967296>Ve))throw Error("Too large array: "+Ve);this.writeU8(221),this.writeU32(Ve)}try{for(var De=ct(J),It=De.next();!It.done;It=De.next())this.doEncode(It.value,me+1)}catch(zt){var tt={error:zt}}finally{try{It&&!It.done&&(ye=De.return)&&ye.call(De)}finally{if(tt)throw tt.error}}},pe.prototype.countWithoutUndefined=function(J,me){var ye,Ve=0;try{for(var De=ct(me),It=De.next();!It.done;It=De.next())J[It.value]!==void 0&&Ve++}catch(zt){var tt={error:zt}}finally{try{It&&!It.done&&(ye=De.return)&&ye.call(De)}finally{if(tt)throw tt.error}}return Ve},pe.prototype.encodeMap=function(J,me){var ye,Ve=Object.keys(J);this.sortKeys&&Ve.sort();var De=this.ignoreUndefined?this.countWithoutUndefined(J,Ve):Ve.length;if(16>De)this.writeU8(128+De);else if(65536>De)this.writeU8(222),this.writeU16(De);else{if(!(4294967296>De))throw Error("Too large map object: "+De);this.writeU8(223),this.writeU32(De)}try{for(var It=ct(Ve),tt=It.next();!tt.done;tt=It.next()){var zt=tt.value,Gr=J[zt];this.ignoreUndefined&&Gr===void 0||(this.encodeString(zt),this.doEncode(Gr,me+1))}}catch(Tt){var nt={error:Tt}}finally{try{tt&&!tt.done&&(ye=It.return)&&ye.call(It)}finally{if(nt)throw nt.error}}},pe.prototype.encodeExtension=function(J){var me=J.data.length;if(me===1)this.writeU8(212);else if(me===2)this.writeU8(213);else if(me===4)this.writeU8(214);else if(me===8)this.writeU8(215);else if(me===16)this.writeU8(216);else if(256>me)this.writeU8(199),this.writeU8(me);else if(65536>me)this.writeU8(200),this.writeU16(me);else{if(!(4294967296>me))throw Error("Too large extension object: "+me);this.writeU8(201),this.writeU32(me)}this.writeI8(J.type),this.writeU8a(J.data)},pe.prototype.writeU8=function(J){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,J),this.pos++},pe.prototype.writeU8a=function(J){var me=J.length;this.ensureBufferSizeToWrite(me),this.bytes.set(J,this.pos),this.pos+=me},pe.prototype.writeI8=function(J){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,J),this.pos++},pe.prototype.writeU16=function(J){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,J),this.pos+=2},pe.prototype.writeI16=function(J){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,J),this.pos+=2},pe.prototype.writeU32=function(J){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,J),this.pos+=4},pe.prototype.writeI32=function(J){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,J),this.pos+=4},pe.prototype.writeF32=function(J){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,J),this.pos+=4},pe.prototype.writeF64=function(J){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,J),this.pos+=8},pe.prototype.writeU64=function(J){this.ensureBufferSizeToWrite(8);var me=this.view,ye=this.pos;me.setUint32(ye,J/4294967296),me.setUint32(ye+4,J),this.pos+=8},pe.prototype.writeI64=function(J){this.ensureBufferSizeToWrite(8);var me=this.view,ye=this.pos;me.setUint32(ye,Math.floor(J/4294967296)),me.setUint32(ye+4,J),this.pos+=8},pe}(),St={},ki;nr=function(){function pe(J,me){for(J===void 0&&(J=16),me===void 0&&(me=16),this.maxKeyLength=J,this.maxLengthPerKey=me,this.miss=this.hit=0,this.caches=[],J=0;J<this.maxKeyLength;J++)this.caches.push([])}return pe.prototype.canBeCached=function(J){return 0<J&&J<=this.maxKeyLength},pe.prototype.find=function(J,me,ye){var Ve,De=this.caches[ye-1];try{var It=function(Tt){var _t=typeof Symbol=="function"&&Symbol.iterator,ni=_t&&Tt[_t],vr=0;if(ni)return ni.call(Tt);if(Tt&&typeof Tt.length=="number")return{next:function(){return Tt&&vr>=Tt.length&&(Tt=void 0),{value:Tt&&Tt[vr++],done:!Tt}}};throw new TypeError(_t?"Object is not iterable.":"Symbol.iterator is not defined.")}(De),tt=It.next();e:for(;!tt.done;tt=It.next()){var zt=tt.value,Gr=zt.bytes;for(De=0;De<ye;De++)if(Gr[De]!==J[me+De])continue e;return zt.str}}catch(Tt){var nt={error:Tt}}finally{try{tt&&!tt.done&&(Ve=It.return)&&Ve.call(It)}finally{if(nt)throw nt.error}}return null},pe.prototype.store=function(J,me){var ye=this.caches[J.length-1];J={bytes:J,str:me},ye.length>=this.maxLengthPerKey?ye[Math.random()*ye.length|0]=J:ye.push(J)},pe.prototype.decode=function(J,me,ye){var Ve=this.find(J,me,ye);return Ve!=null?(this.hit++,Ve):(this.miss++,Ve=i(J,me,ye),J=Uint8Array.prototype.slice.call(J,me,me+ye),this.store(J,Ve),Ve)},pe}();var Qa=(ki=function(pe,J){return(ki=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(me,ye){me.__proto__=ye}||function(me,ye){for(var Ve in ye)Object.prototype.hasOwnProperty.call(ye,Ve)&&(me[Ve]=ye[Ve])})(pe,J)},function(pe,J){function me(){this.constructor=pe}if(typeof J!="function"&&J!==null)throw new TypeError("Class extends value "+String(J)+" is not a constructor or null");ki(pe,J),pe.prototype=J===null?Object.create(J):(me.prototype=J.prototype,new me)}),Ga=function(pe,J){function me(zt){return function(Gr){return function(nt){if(ye)throw new TypeError("Generator is already executing.");for(;tt;)try{if(ye=1,Ve&&(De=2&nt[0]?Ve.return:nt[0]?Ve.throw||((De=Ve.return)&&De.call(Ve),0):Ve.next)&&!(De=De.call(Ve,nt[1])).done)return De;switch(Ve=0,De&&(nt=[2&nt[0],De.value]),nt[0]){case 0:case 1:De=nt;break;case 4:return tt.label++,{value:nt[1],done:!1};case 5:tt.label++,Ve=nt[1],nt=[0];continue;case 7:nt=tt.ops.pop(),tt.trys.pop();continue;default:if(!((De=0<(De=tt.trys).length&&De[De.length-1])||nt[0]!==6&&nt[0]!==2)){tt=0;continue}if(nt[0]===3&&(!De||nt[1]>De[0]&&nt[1]<De[3]))tt.label=nt[1];else if(nt[0]===6&&tt.label<De[1])tt.label=De[1],De=nt;else if(De&&tt.label<De[2])tt.label=De[2],tt.ops.push(nt);else{De[2]&&tt.ops.pop(),tt.trys.pop();continue}}nt=J.call(pe,tt)}catch(Tt){nt=[6,Tt],Ve=0}finally{ye=De=0}if(5&nt[0])throw nt[1];return{value:nt[0]?nt[1]:void 0,done:!0}}([zt,Gr])}}var ye,Ve,De,It,tt={label:0,sent:function(){if(1&De[0])throw De[1];return De[1]},trys:[],ops:[]};return It={next:me(0),throw:me(1),return:me(2)},typeof Symbol=="function"&&(It[Symbol.iterator]=function(){return this}),It},pc=function(pe){function J(Ve){me[Ve]=pe[Ve]&&function(De){return new Promise(function(It,tt){(function(zt,Gr,nt,Tt){Promise.resolve(Tt).then(function(_t){zt({value:_t,done:nt})},Gr)})(It,tt,(De=pe[Ve](De)).done,De.value)})}}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var me,ye=pe[Symbol.asyncIterator];return ye?ye.call(pe):(pe=typeof __values=="function"?__values(pe):pe[Symbol.iterator](),me={},J("next"),J("throw"),J("return"),me[Symbol.asyncIterator]=function(){return this},me)},dr=function(pe){return this instanceof dr?(this.v=pe,this):new dr(pe)},di=function(pe,J,me){function ye(Tt){Gr[Tt]&&(zt[Tt]=function(_t){return new Promise(function(ni,vr){1<nt.push([Tt,_t,ni,vr])||Ve(Tt,_t)})})}function Ve(Tt,_t){try{(ni=Gr[Tt](_t)).value instanceof dr?Promise.resolve(ni.value.v).then(De,It):tt(nt[0][2],ni)}catch(vr){tt(nt[0][3],vr)}var ni}function De(Tt){Ve("next",Tt)}function It(Tt){Ve("throw",Tt)}function tt(Tt,_t){Tt(_t),nt.shift(),nt.length&&Ve(nt[0][0],nt[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var zt,Gr=me.apply(pe,J||[]),nt=[];return zt={},ye("next"),ye("throw"),ye("return"),zt[Symbol.asyncIterator]=function(){return this},zt},qi=new DataView(new ArrayBuffer(0)),Ui=new Uint8Array(qi.buffer);e:{try{qi.getInt8(0)}catch(pe){var Ri=pe.constructor;break e}throw Error("never reached")}var so=new Ri("Insufficient data"),nn=new nr,To=function(pe){function J(me){me=pe.call(this,me)||this;var ye=Object.create(J.prototype);return Object.setPrototypeOf(me,ye),Object.defineProperty(me,"name",{configurable:!0,enumerable:!1,value:J.name}),me}return Qa(J,pe),J}(Error),vc=function(){function pe(J,me,ye,Ve,De,It,tt,zt){J===void 0&&(J=at.defaultCodec),me===void 0&&(me=void 0),ye===void 0&&(ye=4294967295),Ve===void 0&&(Ve=4294967295),De===void 0&&(De=4294967295),It===void 0&&(It=4294967295),tt===void 0&&(tt=4294967295),zt===void 0&&(zt=nn),this.extensionCodec=J,this.context=me,this.maxStrLength=ye,this.maxBinLength=Ve,this.maxArrayLength=De,this.maxMapLength=It,this.maxExtLength=tt,this.keyDecoder=zt,this.pos=this.totalPos=0,this.view=qi,this.bytes=Ui,this.headByte=-1,this.stack=[]}return pe.prototype.reinitializeState=function(){this.totalPos=0,this.headByte=-1,this.stack.length=0},pe.prototype.setBuffer=function(J){this.bytes=F(J),J=this.bytes,J instanceof ArrayBuffer?J=new DataView(J):(J=F(J),J=new DataView(J.buffer,J.byteOffset,J.byteLength)),this.view=J,this.pos=0},pe.prototype.appendBuffer=function(J){if(this.headByte!==-1||this.hasRemaining()){var me=this.bytes.subarray(this.pos);J=F(J);var ye=new Uint8Array(me.length+J.length);ye.set(me),ye.set(J,me.length),this.setBuffer(ye)}else this.setBuffer(J)},pe.prototype.hasRemaining=function(J){return J===void 0&&(J=1),this.view.byteLength-this.pos>=J},pe.prototype.createExtraByteError=function(J){var me=this.view;return new RangeError("Extra "+(me.byteLength-this.pos)+" of "+me.byteLength+" byte(s) found at buffer["+J+"]")},pe.prototype.decode=function(J){if(this.reinitializeState(),this.setBuffer(J),J=this.doDecodeSync(),this.hasRemaining())throw this.createExtraByteError(this.pos);return J},pe.prototype.decodeMulti=function(J){return Ga(this,function(me){switch(me.label){case 0:this.reinitializeState(),this.setBuffer(J),me.label=1;case 1:return this.hasRemaining()?[4,this.doDecodeSync()]:[3,3];case 2:return me.sent(),[3,1];case 3:return[2]}})},pe.prototype.decodeAsync=function(J){var me,ye,Ve,De,It,tt,zt;return It=this,zt=function(){var Gr,nt,Tt,_t,ni,vr,Ls,_c;return Ga(this,function(Cr){switch(Cr.label){case 0:Gr=!1,Cr.label=1;case 1:Cr.trys.push([1,6,7,12]),me=pc(J),Cr.label=2;case 2:return[4,me.next()];case 3:if((ye=Cr.sent()).done)return[3,5];if(Tt=ye.value,Gr)throw this.createExtraByteError(this.totalPos);this.appendBuffer(Tt);try{nt=this.doDecodeSync(),Gr=!0}catch(du){if(!(du instanceof Ri))throw du}this.totalPos+=this.pos,Cr.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return _t=Cr.sent(),Ve={error:_t},[3,12];case 7:return Cr.trys.push([7,,10,11]),ye&&!ye.done&&(De=me.return)?[4,De.call(me)]:[3,9];case 8:Cr.sent(),Cr.label=9;case 9:return[3,11];case 10:if(Ve)throw Ve.error;return[7];case 11:return[7];case 12:if(Gr){if(this.hasRemaining())throw this.createExtraByteError(this.totalPos);return[2,nt]}throw vr=(ni=this).headByte,Ls=ni.pos,_c=ni.totalPos,new RangeError("Insufficient data in parsing "+Y(vr)+" at "+_c+" ("+Ls+" in the current buffer)")}})},new(tt=void 0,tt=Promise)(function(Gr,nt){function Tt(vr){try{ni(zt.next(vr))}catch(Ls){nt(Ls)}}function _t(vr){try{ni(zt.throw(vr))}catch(Ls){nt(Ls)}}function ni(vr){var Ls;vr.done?Gr(vr.value):(Ls=vr.value,Ls instanceof tt?Ls:new tt(function(_c){_c(Ls)})).then(Tt,_t)}ni((zt=zt.apply(It,[])).next())})},pe.prototype.decodeArrayStream=function(J){return this.decodeMultiAsync(J,!0)},pe.prototype.decodeStream=function(J){return this.decodeMultiAsync(J,!1)},pe.prototype.decodeMultiAsync=function(J,me){return di(this,arguments,function(){var ye,Ve,De,It,tt,zt,Gr,nt,Tt;return Ga(this,function(_t){switch(_t.label){case 0:ye=me,Ve=-1,_t.label=1;case 1:_t.trys.push([1,13,14,19]),De=pc(J),_t.label=2;case 2:return[4,dr(De.next())];case 3:if((It=_t.sent()).done)return[3,12];if(tt=It.value,me&&Ve===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(tt),ye&&(Ve=this.readArraySize(),ye=!1,this.complete()),_t.label=4;case 4:_t.trys.push([4,9,,10]),_t.label=5;case 5:return[4,dr(this.doDecodeSync())];case 6:return[4,_t.sent()];case 7:return _t.sent(),--Ve==0?[3,8]:[3,5];case 8:return[3,10];case 9:if(!((zt=_t.sent())instanceof Ri))throw zt;return[3,10];case 10:this.totalPos+=this.pos,_t.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return Gr=_t.sent(),nt={error:Gr},[3,19];case 14:return _t.trys.push([14,,17,18]),It&&!It.done&&(Tt=De.return)?[4,dr(Tt.call(De))]:[3,16];case 15:_t.sent(),_t.label=16;case 16:return[3,18];case 17:if(nt)throw nt.error;return[7];case 18:return[7];case 19:return[2]}})})},pe.prototype.doDecodeSync=function(){e:for(;;){var J=this.readHeadByte();if(224<=J)J-=256;else if(192>J){if(!(128>J))if(144>J){if((J-=128)!=0){this.pushMapState(J),this.complete();continue e}J={}}else if(160>J){if((J-=144)!=0){this.pushArrayState(J),this.complete();continue e}J=[]}else J-=160,J=this.decodeUtf8String(J,0)}else if(J===192)J=null;else if(J===194)J=!1;else if(J===195)J=!0;else if(J===202)J=this.readF32();else if(J===203)J=this.readF64();else if(J===204)J=this.readU8();else if(J===205)J=this.readU16();else if(J===206)J=this.readU32();else if(J===207)J=this.readU64();else if(J===208)J=this.readI8();else if(J===209)J=this.readI16();else if(J===210)J=this.readI32();else if(J===211)J=this.readI64();else if(J===217)J=this.lookU8(),J=this.decodeUtf8String(J,1);else if(J===218)J=this.lookU16(),J=this.decodeUtf8String(J,2);else if(J===219)J=this.lookU32(),J=this.decodeUtf8String(J,4);else if(J===220){if((J=this.readU16())!==0){this.pushArrayState(J),this.complete();continue e}J=[]}else if(J===221){if((J=this.readU32())!==0){this.pushArrayState(J),this.complete();continue e}J=[]}else if(J===222){if((J=this.readU16())!==0){this.pushMapState(J),this.complete();continue e}J={}}else if(J===223){if((J=this.readU32())!==0){this.pushMapState(J),this.complete();continue e}J={}}else if(J===196)J=this.lookU8(),J=this.decodeBinary(J,1);else if(J===197)J=this.lookU16(),J=this.decodeBinary(J,2);else if(J===198)J=this.lookU32(),J=this.decodeBinary(J,4);else if(J===212)J=this.decodeExtension(1,0);else if(J===213)J=this.decodeExtension(2,0);else if(J===214)J=this.decodeExtension(4,0);else if(J===215)J=this.decodeExtension(8,0);else if(J===216)J=this.decodeExtension(16,0);else if(J===199)J=this.lookU8(),J=this.decodeExtension(J,1);else if(J===200)J=this.lookU16(),J=this.decodeExtension(J,2);else{if(J!==201)throw new To("Unrecognized type byte: "+Y(J));J=this.lookU32(),J=this.decodeExtension(J,4)}this.complete();for(var me=this.stack;0<me.length;){var ye=me[me.length-1];if(ye.type===0){if(ye.array[ye.position]=J,ye.position++,ye.position!==ye.size)continue e;me.pop(),J=ye.array}else{if(ye.type===1){if((Ve=typeof J)!="string"&&Ve!=="number")throw new To("The type of key must be string or number but "+typeof J);if(J==="__proto__")throw new To("The key __proto__ is not allowed");ye.key=J,ye.type=2;continue e}if(ye.map[ye.key]=J,ye.readCount++,ye.readCount!==ye.size){ye.key=null,ye.type=1;continue e}me.pop(),J=ye.map}}return J}var Ve},pe.prototype.readHeadByte=function(){return this.headByte===-1&&(this.headByte=this.readU8()),this.headByte},pe.prototype.complete=function(){this.headByte=-1},pe.prototype.readArraySize=function(){var J=this.readHeadByte();switch(J){case 220:return this.readU16();case 221:return this.readU32();default:if(160>J)return J-144;throw new To("Unrecognized array type byte: "+Y(J))}},pe.prototype.pushMapState=function(J){if(J>this.maxMapLength)throw new To("Max length exceeded: map length ("+J+") > maxMapLengthLength ("+this.maxMapLength+")");this.stack.push({type:1,size:J,key:null,readCount:0,map:{}})},pe.prototype.pushArrayState=function(J){if(J>this.maxArrayLength)throw new To("Max length exceeded: array length ("+J+") > maxArrayLength ("+this.maxArrayLength+")");this.stack.push({type:0,size:J,array:Array(J),position:0})},pe.prototype.decodeUtf8String=function(J,me){var ye;if(J>this.maxStrLength)throw new To("Max length exceeded: UTF-8 byte length ("+J+") > maxStrLength ("+this.maxStrLength+")");if(this.bytes.byteLength<this.pos+me+J)throw so;var Ve,De=this.pos+me;return this.stateIsMapKey()&&((ye=this.keyDecoder)===null||ye===void 0?0:ye.canBeCached(J))?ye=this.keyDecoder.decode(this.bytes,De,J):J>Rn?(ye=this.bytes.subarray(De,De+J),ye=Wr.decode(ye)):ye=i(this.bytes,De,J),Ve=ye,this.pos+=me+J,Ve},pe.prototype.stateIsMapKey=function(){return 0<this.stack.length&&this.stack[this.stack.length-1].type===1},pe.prototype.decodeBinary=function(J,me){if(J>this.maxBinLength)throw new To("Max length exceeded: bin length ("+J+") > maxBinLength ("+this.maxBinLength+")");if(!this.hasRemaining(J+me))throw so;var ye=this.pos+me;return ye=this.bytes.subarray(ye,ye+J),this.pos+=me+J,ye},pe.prototype.decodeExtension=function(J,me){if(J>this.maxExtLength)throw new To("Max length exceeded: ext length ("+J+") > maxExtLength ("+this.maxExtLength+")");var ye=this.view.getInt8(this.pos+me);return J=this.decodeBinary(J,me+1),this.extensionCodec.decode(J,ye,this.context)},pe.prototype.lookU8=function(){return this.view.getUint8(this.pos)},pe.prototype.lookU16=function(){return this.view.getUint16(this.pos)},pe.prototype.lookU32=function(){return this.view.getUint32(this.pos)},pe.prototype.readU8=function(){var J=this.view.getUint8(this.pos);return this.pos++,J},pe.prototype.readI8=function(){var J=this.view.getInt8(this.pos);return this.pos++,J},pe.prototype.readU16=function(){var J=this.view.getUint16(this.pos);return this.pos+=2,J},pe.prototype.readI16=function(){var J=this.view.getInt16(this.pos);return this.pos+=2,J},pe.prototype.readU32=function(){var J=this.view.getUint32(this.pos);return this.pos+=4,J},pe.prototype.readI32=function(){var J=this.view.getInt32(this.pos);return this.pos+=4,J},pe.prototype.readU64=function(){var J,me,ye=(J=this.view,me=this.pos,4294967296*J.getUint32(me)+J.getUint32(me+4));return this.pos+=8,ye},pe.prototype.readI64=function(){var J=n(this.view,this.pos);return this.pos+=8,J},pe.prototype.readF32=function(){var J=this.view.getFloat32(this.pos);return this.pos+=4,J},pe.prototype.readF64=function(){var J=this.view.getFloat64(this.pos);return this.pos+=8,J},pe}(),mc={},s0=function(pe,J){function me(zt){return function(Gr){return function(nt){if(ye)throw new TypeError("Generator is already executing.");for(;tt;)try{if(ye=1,Ve&&(De=2&nt[0]?Ve.return:nt[0]?Ve.throw||((De=Ve.return)&&De.call(Ve),0):Ve.next)&&!(De=De.call(Ve,nt[1])).done)return De;switch(Ve=0,De&&(nt=[2&nt[0],De.value]),nt[0]){case 0:case 1:De=nt;break;case 4:return tt.label++,{value:nt[1],done:!1};case 5:tt.label++,Ve=nt[1],nt=[0];continue;case 7:nt=tt.ops.pop(),tt.trys.pop();continue;default:if(!((De=0<(De=tt.trys).length&&De[De.length-1])||nt[0]!==6&&nt[0]!==2)){tt=0;continue}if(nt[0]===3&&(!De||nt[1]>De[0]&&nt[1]<De[3]))tt.label=nt[1];else if(nt[0]===6&&tt.label<De[1])tt.label=De[1],De=nt;else if(De&&tt.label<De[2])tt.label=De[2],tt.ops.push(nt);else{De[2]&&tt.ops.pop(),tt.trys.pop();continue}}nt=J.call(pe,tt)}catch(Tt){nt=[6,Tt],Ve=0}finally{ye=De=0}if(5&nt[0])throw nt[1];return{value:nt[0]?nt[1]:void 0,done:!0}}([zt,Gr])}}var ye,Ve,De,It,tt={label:0,sent:function(){if(1&De[0])throw De[1];return De[1]},trys:[],ops:[]};return It={next:me(0),throw:me(1),return:me(2)},typeof Symbol=="function"&&(It[Symbol.iterator]=function(){return this}),It},Ec=function(pe){return this instanceof Ec?(this.v=pe,this):new Ec(pe)},o0=function(pe,J,me){function ye(Tt){Gr[Tt]&&(zt[Tt]=function(_t){return new Promise(function(ni,vr){1<nt.push([Tt,_t,ni,vr])||Ve(Tt,_t)})})}function Ve(Tt,_t){try{(ni=Gr[Tt](_t)).value instanceof Ec?Promise.resolve(ni.value.v).then(De,It):tt(nt[0][2],ni)}catch(vr){tt(nt[0][3],vr)}var ni}function De(Tt){Ve("next",Tt)}function It(Tt){Ve("throw",Tt)}function tt(Tt,_t){Tt(_t),nt.shift(),nt.length&&Ve(nt[0][0],nt[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var zt,Gr=me.apply(pe,J||[]),nt=[];return zt={},ye("next"),ye("throw"),ye("return"),zt[Symbol.asyncIterator]=function(){return this},zt};return Pt}()}),Bv=Math.min;Qt({target:"Array",proto:!0},{copyWithin:[].copyWithin||function(t,e){var r=Wn(this),i=Vn(r.length),n=Li(t,i),c=Li(e,i),h=2<arguments.length?arguments[2]:void 0;for(i=Bv((h===void 0?i:Li(h,i))-c,i-n),h=1,c<n&&n<c+i&&(h=-1,c+=i-1,n+=i-1);0<i--;)c in r?r[n]=r[c]:delete r[n],n+=h,c+=h;return r}});var Nv=ai("Array").copyWithin,AA=Array.prototype;Qt({target:"Array",proto:!0,forced:Oa("every")},{every:function(t){return pt(this,t,1<arguments.length?arguments[1]:void 0)}});var Pv=ai("Array").every,gA=Array.prototype,xv=function(t){var e=t.every;return t===gA||t instanceof Array&&e===gA.every?Pv:e},Zl=$a.getWeakData,Mv=Zt.set,kv=Zt.getterFor,Uv=0,$l=function(t){return t.frozen||(t.frozen=new pA)},pA=function(){this.entries=[]},Sd=function(t,e){return Ct(t.entries,function(r){return r[0]===e})};pA.prototype={get:function(t){if(t=Sd(this,t))return t[1]},has:function(t){return!!Sd(this,t)},set:function(t,e){var r=Sd(this,t);r?r[1]=e:this.entries.push([t,e])},delete:function(t){var e=$e(this.entries,function(r){return r[0]===t});return~e&&this.entries.splice(e,1),!!~e}};var vA={getConstructor:function(t,e,r,i){var n=t(function(C,x){we(C,n,e),Mv(C,{type:e,id:Uv++,frozen:void 0}),x!=null&&ke(x,C[i],C,r)}),c=kv(e),h=function(C,x,Q){var F=c(C),V=Zl(Hi(x),!0);return V===!0?$l(F).set(x,Q):V[F.id]=Q,C};return Ko(n.prototype,{delete:function(C){var x=c(this);if(!zr(C))return!1;var Q=Zl(C);return Q===!0?$l(x).delete(C):Q&&qt(Q,x.id)&&delete Q[x.id]},has:function(C){var x=c(this);if(!zr(C))return!1;var Q=Zl(C);return Q===!0?$l(x).has(C):Q&&qt(Q,x.id)}}),Ko(n.prototype,r?{get:function(C){var x=c(this);if(zr(C)){var Q=Zl(C);return Q===!0?$l(x).get(C):Q?Q[x.id]:void 0}},set:function(C,x){return h(this,C,x)}}:{add:function(C){return h(this,C,!0)}}),n}},Fv=(k(function(t){var e=Zt.enforce,r=!gt.ActiveXObject&&"ActiveXObject"in gt,i=Object.isExtensible,n=function(F){return function(){return F(this,arguments.length?arguments[0]:void 0)}};if(t=t.exports=ri("WeakMap",n,vA),dt&&r){var c=vA.getConstructor(n,"WeakMap",!0);$a.REQUIRED=!0,r=t.prototype;var h=r.delete,C=r.has,x=r.get,Q=r.set;Ko(r,{delete:function(F){if(zr(F)&&!i(F)){var V=e(this);return V.frozen||(V.frozen=new c),h.call(this,F)||V.frozen.delete(F)}return h.call(this,F)},has:function(F){if(zr(F)&&!i(F)){var V=e(this);return V.frozen||(V.frozen=new c),C.call(this,F)||V.frozen.has(F)}return C.call(this,F)},get:function(F){if(zr(F)&&!i(F)){var V=e(this);return V.frozen||(V.frozen=new c),C.call(this,F)?x.call(this,F):V.frozen.get(F)}return x.call(this,F)},set:function(F,V){if(zr(F)&&!i(F)){var Y=e(this);Y.frozen||(Y.frozen=new c),C.call(this,F)?Q.call(this,F,V):Y.frozen.set(F,V)}else Q.call(this,F,V);return this}})}}),Math.min),Td=[].lastIndexOf,mA=!!Td&&0>1/[1].lastIndexOf(1,-0),Qv=Oa("lastIndexOf"),EA=mA||Qv?function(t){if(mA)return Td.apply(this,arguments)||0;var e=Cn(this),r=Vn(e.length),i=r-1;for(1<arguments.length&&(i=Fv(i,Qo(arguments[1]))),0>i&&(i=r+i);0<=i;i--)if(i in e&&e[i]===t)return i||0;return-1}:Td;Qt({target:"Array",proto:!0,forced:EA!==[].lastIndexOf},{lastIndexOf:EA});var Gv=ai("Array").lastIndexOf,_A=Array.prototype,Hv=function(t){var e=t.lastIndexOf;return t===_A||t instanceof Array&&e===_A.lastIndexOf?Gv:e};let Kv=()=>function(t){var e;return t=yt(e=window.atob(t).split("")).call(e,r=>r.charCodeAt(0)),new Uint8Array(t,0,t.length/Uint8Array.BYTES_PER_ELEMENT)}("AGFzbQEAAAABMAlgA39/fwF/YAF/AGACf38AYAF/AX9gAn9/AX9gA39/fwBgBH9/f38AYAABf2AAAAI6AgNlbnYWZW1zY3JpcHRlbl9yZXNpemVfaGVhcAADA2VudhVlbXNjcmlwdGVuX21lbWNweV9iaWcAAAMjIggAAAAAAQEDAQEEBAQEAQEGAQYCBQUAAgAHAwEDAAIHAQMEBQFwAQYGBQYBAYACgAIGCQF/AUHQ48ACCweUAQoGbWVtb3J5AgARX193YXNtX2NhbGxfY3RvcnMAAhlfX2luZGlyZWN0X2Z1bmN0aW9uX3RhYmxlAQAGbWFsbG9jABwEZnJlZQAdEF9fZXJybm9fbG9jYXRpb24AGwx6bGliQ29tcHJlc3MAGglzdGFja1NhdmUAIQxzdGFja1Jlc3RvcmUAIgpzdGFja0FsbG9jACMJCwEAQQELBRgZDA0PCq6FAiIDAAELpQcBBH8gAEH//wNxIQMgAEEQdiEEQQEhACACQQFGBEAgAyABLQAAaiIAQfH/A2sgACAAQfD/A0sbIgAgBGoiA0EQdCIEQYCAPGogBCADQfD/A0sbIAByDwsgAQR/IAJBEE8EQAJAAkACQCACQa8rSwRAA0AgAkGwK2shAkHbAiEFIAEhAANAIAMgAC0AAGoiAyAEaiADIAAtAAFqIgNqIAMgAC0AAmoiA2ogAyAALQADaiIDaiADIAAtAARqIgNqIAMgAC0ABWoiA2ogAyAALQAGaiIDaiADIAAtAAdqIgNqIAMgAC0ACGoiA2ogAyAALQAJaiIDaiADIAAtAApqIgNqIAMgAC0AC2oiA2ogAyAALQAMaiIDaiADIAAtAA1qIgNqIAMgAC0ADmoiA2ogAyAALQAPaiIDaiEEIABBEGohACAFQQFrIgUNAAsgBEHx/wNwIQQgA0Hx/wNwIQMgAUGwK2ohASACQa8rSw0ACyACRQ0DIAJBEEkNAQsDQCADIAEtAABqIgAgBGogACABLQABaiIAaiAAIAEtAAJqIgBqIAAgAS0AA2oiAGogACABLQAEaiIAaiAAIAEtAAVqIgBqIAAgAS0ABmoiAGogACABLQAHaiIAaiAAIAEtAAhqIgBqIAAgAS0ACWoiAGogACABLQAKaiIAaiAAIAEtAAtqIgBqIAAgAS0ADGoiAGogACABLQANaiIAaiAAIAEtAA5qIgBqIAAgAS0AD2oiA2ohBCABQRBqIQEgAkEQayICQQ9LDQALIAJFDQELIAJBAWshBiACQQNxIgUEQCABIQADQCACQQFrIQIgAyAALQAAaiIDIARqIQQgAEEBaiIBIQAgBUEBayIFDQALCyAGQQNJDQADQCADIAEtAABqIgAgAS0AAWoiBSABLQACaiIGIAEtAANqIgMgBiAFIAAgBGpqamohBCABQQRqIQEgAkEEayICDQALCyAEQfH/A3AhBCADQfH/A3AhAwsgBEEQdCADcg8LAkAgAkUNACACQQFrIQYgAkEDcSIFBEAgASEAA0AgAkEBayECIAMgAC0AAGoiAyAEaiEEIABBAWoiASEAIAVBAWsiBQ0ACwsgBkEDSQ0AA0AgAyABLQAAaiIAIAEtAAFqIgUgAS0AAmoiBiABLQADaiIDIAYgBSAAIARqampqIQQgAUEEaiEBIAJBBGsiAg0ACwsgBEHx/wNwQRB0IANB8f8DayADIANB8P8DSxtyBSAACwsKACAAIAEgAhADC4UJAQJ/IAFFBEBBAA8LIABBf3MhAAJAIAJFDQAgAUEDcUUNACABLQAAIABB/wFxc0ECdEGACGooAgAgAEEIdnMhACACQQFrIgRBACABQQFqIgNBA3EbRQRAIAMhASAEIQIMAQsgAS0AASAAQf8BcXNBAnRBgAhqKAIAIABBCHZzIQAgAUECaiEDAkAgAkECayIERQ0AIANBA3FFDQAgAS0AAiAAQf8BcXNBAnRBgAhqKAIAIABBCHZzIQAgAUEDaiEDAkAgAkEDayIERQ0AIANBA3FFDQAgAS0AAyAAQf8BcXNBAnRBgAhqKAIAIABBCHZzIQAgAkEEayECIAFBBGohAQwCCyADIQEgBCECDAELIAMhASAEIQILIAJBH0sEQANAIAEoAhwgASgCGCABKAIUIAEoAhAgASgCDCABKAIIIAEoAgQgASgCACAAcyIAQQZ2QfwHcUGAGGooAgAgAEH/AXFBAnRBgCBqKAIAcyAAQQ52QfwHcUGAEGooAgBzIABBFnZB/AdxQYAIaigCAHNzIgBBBnZB/AdxQYAYaigCACAAQf8BcUECdEGAIGooAgBzIABBDnZB/AdxQYAQaigCAHMgAEEWdkH8B3FBgAhqKAIAc3MiAEEGdkH8B3FBgBhqKAIAIABB/wFxQQJ0QYAgaigCAHMgAEEOdkH8B3FBgBBqKAIAcyAAQRZ2QfwHcUGACGooAgBzcyIAQQZ2QfwHcUGAGGooAgAgAEH/AXFBAnRBgCBqKAIAcyAAQQ52QfwHcUGAEGooAgBzIABBFnZB/AdxQYAIaigCAHNzIgBBBnZB/AdxQYAYaigCACAAQf8BcUECdEGAIGooAgBzIABBDnZB/AdxQYAQaigCAHMgAEEWdkH8B3FBgAhqKAIAc3MiAEEGdkH8B3FBgBhqKAIAIABB/wFxQQJ0QYAgaigCAHMgAEEOdkH8B3FBgBBqKAIAcyAAQRZ2QfwHcUGACGooAgBzcyIAQQZ2QfwHcUGAGGooAgAgAEH/AXFBAnRBgCBqKAIAcyAAQQ52QfwHcUGAEGooAgBzIABBFnZB/AdxQYAIaigCAHNzIgBBBnZB/AdxQYAYaigCACAAQf8BcUECdEGAIGooAgBzIABBDnZB/AdxQYAQaigCAHMgAEEWdkH8B3FBgAhqKAIAcyEAIAFBIGohASACQSBrIgJBH0sNAAsLIAJBA0sEQANAIAEoAgAgAHMiAEEGdkH8B3FBgBhqKAIAIABB/wFxQQJ0QYAgaigCAHMgAEEOdkH8B3FBgBBqKAIAcyAAQRZ2QfwHcUGACGooAgBzIQAgAUEEaiEBIAJBBGsiAkEDSw0ACwsCQCACRQ0AIAJBAXEEfyABLQAAIABB/wFxc0ECdEGACGooAgAgAEEIdnMhACABQQFqIQEgAkEBawUgAgshAyACQQFGDQADQCABLQABIAEtAAAgAEH/AXFzQQJ0QYAIaigCACAAQQh2cyIAQf8BcXNBAnRBgAhqKAIAIABBCHZzIQAgAUECaiEBIANBAmsiAw0ACwsgAEF/cwsKACAAIAEgAhAFC9wEAQN/AkBByN8ALQAAQTFHDQAgAEUNACAAQQA2AhggACgCICIBRQRAIABBADYCKCAAQQE2AiBBASEBCyAAKAIkRQRAIABBAjYCJAsgACgCKEEBQcQtIAERAAAiAUUNACAAIAE2AhwgAUEPNgIwIAFBADYCHCABQQA2AhggAUEqNgIEIAEgADYCACABQQs2AlAgAUGAgAI2AiwgAUH//wE2AjQgAUGAEDYCTCABQQQ2AlggAUH/DzYCVCABIAAoAihBgIACQQIgACgCIBEAADYCOCABIAAoAiggASgCLEECIAAoAiARAAA2AkAgACgCKCABKAJMQQIgACgCIBEAACECIAFBADYCwC0gASACNgJEIAFBgAg2ApwtIAEgACgCKEGACEEEIAAoAiARAAAiAjYCCCABIAEoApwtIgNBAnQ2AgwCQAJAIAEoAjhFDQAgASgCQEUNACACRQ0AIAEoAkQNAQsgAUGaBTYCBCAAQbjfACgCADYCGCAAEAgPCyABQQA2AogBIAFBCTYChAEgAUEIOgAkIAEgAiADQQNsajYCmC0gASACIANBfnFqNgKkLSAAEAkNACAAKAIcIgAgACgCLEEBdDYCPCAAKAJEIgEgACgCTEEBdEECayIDakEAOwEAIAEgAxAgIABBADYCtC0gAEKAgICAIDcCdCAAQgA3AmggAEKAgICAIDcCXCAAQQA2AkggACAAKAKEAUEMbCIBQYTIAGovAQA2ApABIAAgAUGAyABqLwEANgKMASAAIAFBgsgAai8BADYCgAEgACABQYbIAGovAQA2AnwLC6kCAQN/AkAgAEUNACAAKAIgRQ0AIAAoAiQiA0UNACAAKAIcIgFFDQAgASgCACAARw0AAkACQCABKAIEIgJBOWsOOQECAgICAgICAgICAgECAgIBAgICAgICAgICAgICAgICAgIBAgICAgICAgICAgIBAgICAgICAgICAQALIAJBmgVGDQAgAkEqRw0BCwJ/An8CfyABKAIIIgIEQCAAKAIoIAIgAxECACAAKAIcIQELIAEoAkQiAgsEQCAAKAIoIAIgACgCJBECACAAKAIcIQELIAEoAkAiAgsEQCAAKAIoIAIgACgCJBECACAAKAIcIQELIAEoAjgiAgsEQCAAKAIoIAIgACgCJBECACAAKAIcIQELIAAoAiggASAAKAIkEQIAIABBADYCHAsLlgIBA39BfiECAkAgAEUNACAAKAIgRQ0AIAAoAiRFDQAgACgCHCIBRQ0AIAEoAgAgAEcNAAJAAkAgASgCBCIDQTlrDjkBAgICAgICAgICAgIBAgICAQICAgICAgICAgICAgICAgICAQICAgICAgICAgICAQICAgICAgICAgEACyADQZoFRg0AIANBKkcNAQsgAEECNgIsIABBADYCCCAAQgA3AhQgAUEANgIUIAEgASgCCDYCECABKAIYIgJBf0wEQCABQQAgAmsiAjYCGAsgAUE5QSpB8QAgAhsgAkECRhs2AgQgAAJ/IAJBAkYEQEEAQQBBABAGDAELQQBBAEEAEAQLNgIwQQAhAiABQQA2AiggARAQCyACC9wIAQt/IAAoAiwiB0GGAmshCyAAKAJ0IQUgByEBA0AgACgCPCAFayAAKAJsIghrIQYgASALaiAITQRAIAAoAjgiASABIAdqIAcgBmsQHxogACAAKAJwIAdrNgJwIAAgACgCbCAHayIINgJsIAAgACgCXCAHazYCXCAAKAJMIgRBAWshCiAAKAJEIARBAXRqIQMgACgCLCEBIARBA3EiAgRAA0AgA0ECayIDQQAgAy8BACIFIAFrIgkgBSAJSRs7AQAgBEEBayEEIAJBAWsiAg0ACwsgCkEDTwRAA0AgA0ECayICQQAgAi8BACICIAFrIgUgAiAFSRs7AQAgA0EEayICQQAgAi8BACICIAFrIgUgAiAFSRs7AQAgA0EGayICQQAgAi8BACICIAFrIgUgAiAFSRs7AQAgA0EIayIDQQAgAy8BACICIAFrIgUgAiAFSRs7AQAgBEEEayIEDQALCyABQQFrIQogACgCQCABQQF0aiEDIAEhBCABQQNxIgIEQANAIANBAmsiA0EAIAMvAQAiBSABayIJIAUgCUkbOwEAIARBAWshBCACQQFrIgINAAsLIApBA08EQANAIANBAmsiAkEAIAIvAQAiAiABayIFIAIgBUkbOwEAIANBBGsiAkEAIAIvAQAiAiABayIFIAIgBUkbOwEAIANBBmsiAkEAIAIvAQAiAiABayIFIAIgBUkbOwEAIANBCGsiA0EAIAMvAQAiAiABayIFIAIgBUkbOwEAIARBBGsiBA0ACwsgBiAHaiEGCwJAIAAoAgAiASgCBCIERQ0AIAAoAnQhAiAGIAQgBCAGSxsiAwRAIAAoAjghBSABIAQgA2s2AgQgBSAIaiACaiABKAIAIAMQHyEEAkACQAJAIAEoAhwoAhhBAWsOAgABAgsgASABKAIwIAQgAxAENgIwDAELIAEgASgCMCAEIAMQBjYCMAsgASABKAIAIANqNgIAIAEgASgCCCADajYCCCAAKAJ0IQILIAAgAiADaiIFNgJ0AkAgACgCtC0iAyAFakEDSQ0AIAAgACgCOCIJIAAoAmwgA2siAWoiBC0AACICNgJIIAAgACgCVCIIIAQtAAEgAiAAKAJYIgZ0c3EiBDYCSANAIANFDQEgACABIAlqLQACIAQgBnRzIAhxIgQ2AkggACgCQCAAKAI0IAFxQQF0aiAAKAJEIARBAXRqIgIvAQA7AQAgAiABOwEAIAAgA0EBayIDNgK0LSABQQFqIQEgAyAFakECSw0ACwsgBUGFAksNACAAKAIAKAIERQ0AIAAoAiwhAQwBCwsCQCAAKAI8IgQgACgCwC0iAU0NACAAKAJ0IAAoAmxqIgMgAUsEQCAAKAI4IANqIAQgA2siAUGCAiABQYICSRsiARAgIAAgASADajYCwC0PCyADQYICaiIDIAFNDQAgACgCOCABaiAEIAFrIgQgAyABayIBIAEgBEsbIgEQICAAIAAoAsAtIAFqNgLALQsLsSwBCn8CQCAARQ0AIAAoAiBFDQAgACgCJEUNACAAKAIcIgFFDQAgASgCACAARw0AAkACQCABKAIEIgNBOWsOOQECAgICAgICAgICAgECAgIBAgICAgICAgICAgICAgICAgIBAgICAgICAgICAgIBAgICAgICAgICAQALIANBmgVGDQAgA0EqRw0BCwJAAkAgACgCDEUNACAAKAIEIgIEQCAAKAIARQ0BCyADQZoFRw0BCyAAQbDfACgCADYCGA8LIAAoAhBFBEAgAEG83wAoAgA2AhgPCyABKAIoIQUgAUEDNgIoAkAgASgCFARAIAEQEwJAIAAoAhAiAyABKAIUIgQgAyAESRsiAkUNACAAKAIMIAEoAhAgAhAfGiAAIAAoAgwgAmo2AgwgASABKAIQIAJqNgIQIAAgACgCFCACajYCFCAAIAAoAhAgAmsiAzYCECABIAEoAhQgAmsiBDYCFCAEDQAgASABKAIINgIQQQAhBAsgAwRAIAEoAgQhAwwCCyABQX82AigPCyACDQAgBUEBdEF3QQAgBUEEShtqQQZIDQAgAEG83wAoAgA2AhgPCwJAAkACQAJAAn8CQAJAAkACQAJAAkAgA0EqRwRAIANBmgVHDQEgACgCBEUNAiAAQbzfACgCADYCGA8LIAEoAjBBDHRBgPABayEDQQAhAgJAIAEoAogBQQFKDQAgASgChAEiBUECSA0AQcAAIQIgBUEGSA0AQYABQcABIAVBBkYbIQILIAEgBEEBajYCFCABKAIIIARqIAIgA3IiAkEgciACIAEoAmwbIgJBCHY6AAAgASABKAIUIgNBAWo2AhQgAyABKAIIaiACQR9wIAJyQR9zOgAAIAEoAmwEQCAAKAIwIQIgASABKAIUIgNBAWo2AhQgAyABKAIIaiACQRh2OgAAIAEgASgCFCIDQQFqNgIUIAMgASgCCGogAkEQdjoAACAAKAIwIQIgASABKAIUIgNBAWo2AhQgAyABKAIIaiACQQh2OgAAIAEgASgCFCIDQQFqNgIUIAMgASgCCGogAjoAAAsgAEEAQQBBABAENgIwIAFB8QA2AgQgACgCHCICEBMCQCAAKAIQIgMgAigCFCIEIAMgBEkbIgNFDQAgACgCDCACKAIQIAMQHxogACAAKAIMIANqNgIMIAIgAigCECADajYCECAAIAAoAhQgA2o2AhQgACAAKAIQIANrNgIQIAIgAigCFCADayIDNgIUIAMNACACIAIoAgg2AhALIAEoAhQNBCABKAIEIQMLAkACQAJAAkACQAJAAkAgA0E5RgR/IABBAEEAQQAQBjYCMCABIAEoAhQiAkEBajYCFCACIAEoAghqQR86AAAgASABKAIUIgJBAWo2AhQgAiABKAIIakGLAToAACABIAEoAhQiAkEBajYCFCACIAEoAghqQQg6AAAgASgCHCICDQIgASABKAIUIgJBAWo2AhQgAiABKAIIakEAOgAAIAEgASgCFCICQQFqNgIUIAIgASgCCGpBADoAACABIAEoAhQiAkEBajYCFCACIAEoAghqQQA6AAAgASABKAIUIgJBAWo2AhQgAiABKAIIakEAOgAAIAEgASgCFCICQQFqNgIUIAIgASgCCGpBADoAAEECIQIgASgChAEiA0EJRwRAQQQgASgCiAFBAUpBAnQgA0ECSBshAgsgASABKAIUIgNBAWo2AhQgAyABKAIIaiACOgAAIAEgASgCFCICQQFqNgIUIAIgASgCCGpBAzoAACABQfEANgIEIAAoAhwiAhATAkAgACgCECIDIAIoAhQiBCADIARJGyIDRQ0AIAAoAgwgAigCECADEB8aIAAgACgCDCADajYCDCACIAIoAhAgA2o2AhAgACAAKAIUIANqNgIUIAAgACgCECADazYCECACIAIoAhQgA2siAzYCFCADDQAgAiACKAIINgIQCyABKAIUDQEgASgCBAUgAwtBxQBrDiMCBgYGAwYGBgYGBgYGBgYGBgYGBgYGBAYGBgYGBgYGBgYGBQYLIAFBfzYCKA8LIAIoAiQhAyACKAIcIQQgAigCECEFIAIoAiwhBiACKAIAIQggASABKAIUIgdBAWo2AhRBAiECIAcgASgCCGogBkEAR0EBdCAIQQBHciAFQQBHQQJ0ciAEQQBHQQN0ciADQQBHQQR0cjoAACABKAIcKAIEIQMgASABKAIUIgRBAWo2AhQgBCABKAIIaiADOgAAIAEoAhwoAgQhAyABIAEoAhQiBEEBajYCFCAEIAEoAghqIANBCHY6AAAgASgCHC8BBiEDIAEgASgCFCIEQQFqNgIUIAQgASgCCGogAzoAACABKAIcLQAHIQMgASABKAIUIgRBAWo2AhQgBCABKAIIaiADOgAAIAEoAoQBIgNBCUcEQEEEIAEoAogBQQFKQQJ0IANBAkgbIQILIAEgASgCFCIDQQFqNgIUIAMgASgCCGogAjoAACABKAIcKAIMIQIgASABKAIUIgNBAWo2AhQgAyABKAIIaiACOgAAIAEoAhwiAigCEAR/IAIoAhQhAiABIAEoAhQiA0EBajYCFCADIAEoAghqIAI6AAAgASgCHCgCFCECIAEgASgCFCIDQQFqNgIUIAMgASgCCGogAkEIdjoAACABKAIcBSACCygCLARAIAAgACgCMCABKAIIIAEoAhQQBjYCMAsgAUHFADYCBCABQQA2AiALIAEoAhwiBCgCECIDBEAgASgCFCICIAQvARQgASgCICIGayIFaiABKAIMIgRLBEADQCABKAIIIAJqIAMgBmogBCACayIEEB8aIAEgASgCDCIDNgIUAkAgAiADTw0AIAEoAhwoAixFDQAgACAAKAIwIAEoAgggAmogAyACaxAGNgIwCyABIAEoAiAgBGo2AiAgACgCHCICEBMCQCAAKAIQIgMgAigCFCIGIAMgBkkbIgNFDQAgACgCDCACKAIQIAMQHxogACAAKAIMIANqNgIMIAIgAigCECADajYCECAAIAAoAhQgA2o2AhQgACAAKAIQIANrNgIQIAIgAigCFCADayIDNgIUIAMNACACIAIoAgg2AhALIAEoAhQEQCABQX82AigPCyABKAIgIQYgASgCHCgCECEDQQAhAiAFIARrIgUgASgCDCIESw0ACwsgASgCCCACaiADIAZqIAUQHxogASABKAIUIAVqIgM2AhQCQCACIANPDQAgASgCHCgCLEUNACAAIAAoAjAgASgCCCACaiADIAJrEAY2AjALIAFBADYCIAsgAUHJADYCBAsgASgCHCgCHARAIAEoAhQiAiEFA0ACQCACIAEoAgxHDQACQCACIAVNDQAgASgCHCgCLEUNACAAIAAoAjAgASgCCCAFaiACIAVrEAY2AjALIAAoAhwiAhATAkAgACgCECIDIAIoAhQiBCADIARJGyIDRQ0AIAAoAgwgAigCECADEB8aIAAgACgCDCADajYCDCACIAIoAhAgA2o2AhAgACAAKAIUIANqNgIUIAAgACgCECADazYCECACIAIoAhQgA2siAzYCFCADDQAgAiACKAIINgIQC0EAIQJBACEFIAEoAhRFDQAgAUF/NgIoDwsgASgCHCgCHCEDIAEgASgCICIEQQFqNgIgIAMgBGotAAAhAyABIAJBAWo2AhQgASgCCCACaiADOgAAIAMEQCABKAIUIQIMAQsLAkAgASgCHCgCLEUNACABKAIUIgIgBU0NACAAIAAoAjAgASgCCCAFaiACIAVrEAY2AjALIAFBADYCIAsgAUHbADYCBAsCQCABKAIcKAIkRQ0AIAEoAhQiAiEFA0ACQCACIAEoAgxHDQACQCACIAVNDQAgASgCHCgCLEUNACAAIAAoAjAgASgCCCAFaiACIAVrEAY2AjALIAAoAhwiAhATAkAgACgCECIDIAIoAhQiBCADIARJGyIDRQ0AIAAoAgwgAigCECADEB8aIAAgACgCDCADajYCDCACIAIoAhAgA2o2AhAgACAAKAIUIANqNgIUIAAgACgCECADazYCECACIAIoAhQgA2siAzYCFCADDQAgAiACKAIINgIQC0EAIQJBACEFIAEoAhRFDQAgAUF/NgIoDwsgASgCHCgCJCEDIAEgASgCICIEQQFqNgIgIAMgBGotAAAhAyABIAJBAWo2AhQgASgCCCACaiADOgAAIAMEQCABKAIUIQIMAQsLIAEoAhwoAixFDQAgASgCFCICIAVNDQAgACAAKAIwIAEoAgggBWogAiAFaxAGNgIwCyABQecANgIECyABKAIcKAIsBEAgASgCDCABKAIUIgJBAmpJBEAgACgCHCICEBMCQCAAKAIQIgMgAigCFCIEIAMgBEkbIgNFDQAgACgCDCACKAIQIAMQHxogACAAKAIMIANqNgIMIAIgAigCECADajYCECAAIAAoAhQgA2o2AhQgACAAKAIQIANrNgIQIAIgAigCFCADayIDNgIUIAMNACACIAIoAgg2AhALIAEoAhQNBUEAIQILIAAoAjAhAyABIAJBAWo2AhQgASgCCCACaiADOgAAIAAoAjAhAiABIAEoAhQiA0EBajYCFCADIAEoAghqIAJBCHY6AAAgAEEAQQBBABAGNgIwCyABQfEANgIEIAAoAhwiAhATAkAgACgCECIDIAIoAhQiBCADIARJGyIDRQ0AIAAoAgwgAigCECADEB8aIAAgACgCDCADajYCDCACIAIoAhAgA2o2AhAgACAAKAIUIANqNgIUIAAgACgCECADazYCECACIAIoAhQgA2siAzYCFCADDQAgAiACKAIINgIQCyABKAIURQ0AIAFBfzYCKA8LIAAoAgQNAQsgASgCdA0AIAEoAgRBmgVGDQgLIAEoAoQBIgJFBEAgAUEDEAwMBAsCQAJAIAEoAogBQQJrDgIAAQQLA0ACQAJAIAEoAnQNACABEAogASgCdA0AIAFBADYCtC0MAQsgAUEANgJgIAEoAjggASgCbGotAAAhAiABKAKkLSABKAKgLSIDQQF0akEAOwEAIAEgA0EBajYCoC0gAyABKAKYLWogAjoAACABIAJBAnRqQZQBaiICIAIvAQBBAWo7AQAgASABKAJ0QQFrNgJ0IAEgASgCbEEBaiICNgJsIAEoAqAtIAEoApwtQQFrRw0BIAEgASgCXCIEQQBOBH8gASgCOCAEagVBAAsgAiAEa0EAEBQgASABKAJsNgJcIAEoAgAiAigCHCIDEBMCQCACKAIQIgQgAygCFCIFIAQgBUkbIgRFDQAgAigCDCADKAIQIAQQHxogAiACKAIMIARqNgIMIAMgAygCECAEajYCECACIAIoAhQgBGo2AhQgAiACKAIQIARrNgIQIAMgAygCFCAEayICNgIUIAINACADIAMoAgg2AhALIAEoAgAoAhANAQwHCwsgASgCoC1FDQcgASABKAJcIgNBAE4EfyABKAI4IANqBUEACyABKAJsIANrQQAQFCABIAEoAmw2AlwgASgCACICKAIcIgMQEwJAIAIoAhAiBCADKAIUIgUgBCAFSRsiBEUNACACKAIMIAMoAhAgBBAfGiACIAIoAgwgBGo2AgwgAyADKAIQIARqNgIQIAIgAigCFCAEajYCFCACIAIoAhAgBGs2AhAgAyADKAIUIARrIgI2AhQgAg0AIAMgAygCCDYCEAsgASgCACgCEEUNBQwHCwNAAkACQAJAIAEoAnQiAkGDAk8EQCABQQA2AmAMAQsgARAKIAEoAnQiAgRAIAFBADYCYCACQQJLDQEgASgCbCEDDAILIAFBADYCtC0gASgCoC1FDQogASABKAJcIgNBAE4EfyABKAI4IANqBUEACyABKAJsIANrQQAQFCABIAEoAmw2AlwgASgCACICKAIcIgMQEwJAIAIoAhAiBCADKAIUIgUgBCAFSRsiBEUNACACKAIMIAMoAhAgBBAfGiACIAIoAgwgBGo2AgwgAyADKAIQIARqNgIQIAIgAigCFCAEajYCFCACIAIoAhAgBGs2AhAgAyADKAIUIARrIgI2AhQgAg0AIAMgAygCCDYCEAsgASgCACgCEEUNCAwKCyABKAJsIgNFBEBBACEDDAELIAEoAjggA2oiBkEBayIFLQAAIgQgBi0AAEcNACAEIAUtAAJHDQAgBCAFLQADRw0AIAZBggJqIQlBfyEIAkACQAJAAkACQAJAA0AgBiAIaiIFLQAEIARGBEAgBCAFLQAFRw0CIAQgBS0ABkcNAyAEIAUtAAdHDQQgBCAGIAhBCGoiCmoiBy0AAEcNByAEIAUtAAlHDQUgBCAFLQAKRw0GIAVBC2ohByAIQfYBSg0HIAohCCAEIActAABGDQEMBwsLIAVBBGohBwwFCyAFQQVqIQcMBAsgBUEGaiEHDAMLIAVBB2ohBwwCCyAFQQlqIQcMAQsgBUEKaiEHCyABIAIgByAJa0GCAmoiBCACIARJGyICNgJgIAJBA0kNACABKAKkLSABKAKgLSIDQQF0akEBOwEAIAEgA0EBajYCoC0gAyABKAKYLWogAkEDayICOgAAIAJB/wFxQYDNAGotAABBAnQgAWpBmAlqIgIgAi8BAEEBajsBACABQYDJAC0AAEECdGpBiBNqIgIgAi8BAEEBajsBACABKAJgIQIgAUEANgJgIAEgASgCdCACazYCdCABIAIgASgCbGoiAjYCbCABKAKgLSABKAKcLUEBa0cNAgwBCyABKAI4IANqLQAAIQIgASgCpC0gASgCoC0iA0EBdGpBADsBACABIANBAWo2AqAtIAMgASgCmC1qIAI6AAAgASACQQJ0akGUAWoiAiACLwEAQQFqOwEAIAEgASgCdEEBazYCdCABIAEoAmxBAWoiAjYCbCABKAKgLSABKAKcLUEBa0cNAQsgASABKAJcIgRBAE4EfyABKAI4IARqBUEACyACIARrQQAQFCABIAEoAmw2AlwgASgCACICKAIcIgMQEwJAIAIoAhAiBCADKAIUIgUgBCAFSRsiBEUNACACKAIMIAMoAhAgBBAfGiACIAIoAgwgBGo2AgwgAyADKAIQIARqNgIQIAIgAigCFCAEajYCFCACIAIoAhAgBGs2AhAgAyADKAIUIARrIgI2AhQgAg0AIAMgAygCCDYCEAsgASgCACgCEA0ACwwECyABQX82AigPCyABQX82AigPCyABQQMgAkEMbEGIyABqKAIAEQQACyICQX5xQQJGBEAgAUGaBTYCBAsgAkF9cQ0BCyAAKAIQDQMgAUF/NgIoDwsgAkEBRw0BCyABQQBBAEEAEBIgASgCRCICIAEoAkxBAXRBAmsiA2pBADsBACACIAMQICABKAJ0RQRAIAFBADYCtC0gAUEANgJcIAFBADYCbAsgACgCHCICEBMCQCAAKAIQIgQgAigCFCIDIAMgBEsbIgNFDQAgACgCDCACKAIQIAMQHxogACAAKAIMIANqNgIMIAIgAigCECADajYCECAAIAAoAhQgA2o2AhQgACAAKAIQIANrIgQ2AhAgAiACKAIUIANrIgM2AhQgAw0AIAIgAigCCDYCEAsgBA0AIAFBfzYCKAsLC7YNAQt/IAAoAgAiBCgCBCEJQQEhCAJAIAQoAhAiAyAAKAK8LUEqakEDdSICSQ0AIAAoAiwiBSAAKAIMQQVrIgYgBSAGSRshCiABQQRHIQsDQCAKIAMgAmsiAyAAKAJsIAAoAlxrIgYgBCgCBGoiAkH//wMgAkH//wNJGyIFIAMgBUkbIgNLBEAgAiADRw0CIAFFDQIgCyADRXENAgsgAEEAQQAgAUEERiACIANGcSIHEBIgACgCFCAAKAIIakEEayADOgAAIAAoAhQgACgCCGpBA2sgA0EIdjoAACAAKAIUIAAoAghqQQJrIANBf3MiAjoAACAAKAIUIAAoAghqQQFrIAJBCHY6AAAgACgCACICKAIcIgQQEwJAIAIoAhAiBSAEKAIUIgwgBSAMSRsiBUUNACACKAIMIAQoAhAgBRAfGiACIAIoAgwgBWo2AgwgBCAEKAIQIAVqNgIQIAIgAigCFCAFajYCFCACIAIoAhAgBWs2AhAgBCAEKAIUIAVrIgI2AhQgAg0AIAQgBCgCCDYCEAsCfyAGBEAgACgCACgCDCAAKAI4IAAoAlxqIAMgBiADIAZJGyICEB8aIAAoAgAiBCAEKAIMIAJqNgIMIAQgBCgCECACazYCECAEIAQoAhQgAmo2AhQgACAAKAJcIAJqNgJcIAMgAmshAwsgAwsEQCAAKAIAIgIoAgwhBSADIAIoAgQiBiADIAZJGyIEBEAgAiAGIARrNgIEIAUgAigCACAEEB8hBQJAAkACQCACKAIcKAIYQQFrDgIAAQILIAIgAigCMCAFIAQQBDYCMAwBCyACIAIoAjAgBSAEEAY2AjALIAIgAigCACAEajYCACACIAIoAgggBGo2AgggACgCACICKAIMIQULIAIgAyAFajYCDCACIAIoAhAgA2s2AhAgAiACKAIUIANqNgIUCyAAKAIAIQQgBwRAQQAhCAwCCyAEKAIQIgMgACgCvC1BKmpBA3UiAk8NAAsLAkAgCSAEKAIEayIDRQRAIAAoAmwhAgwBCwJAIAAoAiwiAiADTQRAIABBAjYCsC0gACgCOCAEKAIAIAJrIAIQHxogACAAKAIsIgQ2AmwgBCECDAELAkAgACgCPCAAKAJsIgRrIANLDQAgACAEIAJrIgQ2AmwgACgCOCIFIAIgBWogBBAfGiAAKAKwLSICQQFLDQAgACACQQFqNgKwLQsgACgCOCAAKAJsaiAAKAIAKAIAIANrIAMQHxogACAAKAJsIANqIgI2AmwgACgCLCEECyAAIAI2AlwgACAEIAAoArQtIgVrIgQgAyADIARLGyAFajYCtC0LIAIgACgCwC1LBEAgACACNgLALQtBAyEDAkAgCEUNACAAKAIAIgQoAgQhAwJAAkAgAUF7cUUNACADDQBBASEDIAIgACgCXEYNAiAAKAI8IAJBf3NqIQVBACEDDAELIAMgACgCPCACQX9zaiIFTQ0AIAAoAlwiByAAKAIsIgZIDQAgACACIAZrIgM2AmwgACAHIAZrNgJcIAAoAjgiAiACIAZqIAMQHxogACgCsC0iA0EBTQRAIAAgA0EBajYCsC0LIAAoAiwgBWohBSAAKAIAIgQoAgQhAwsCQCADIAUgAyAFSRsiAkUEQCAAKAJsIQMMAQsgACgCbCEFIAAoAjghBiAEIAMgAms2AgQgBSAGaiAEKAIAIAIQHyEDAkACQAJAIAQoAhwoAhhBAWsOAgABAgsgBCAEKAIwIAMgAhAENgIwDAELIAQgBCgCMCADIAIQBjYCMAsgBCAEKAIAIAJqNgIAIAQgBCgCCCACajYCCCAAIAAoAmwgAmoiAzYCbAsgAyAAKALALUsEQCAAIAM2AsAtCyADIAAoAlwiBmsiBCAAKAIsIgMgACgCDCAAKAK8LUEqakEDdWsiAkH//wMgAkH//wNJGyICIAIgA0sbSQRAQQAhAyABRQ0BIAFBBEYgBEEAR3JFDQEgAiAESQ0BIAAoAgAoAgQNAQtBACEFIAAgACgCOCAGaiACIAQgAiAESRsiAwJ/IAFBBEYEQCAAKAIAKAIERSACIARPcSEFCyAFCxASIAAgACgCXCADajYCXCAAKAIAIgAoAhwiAxATAkAgACgCECICIAMoAhQiBCACIARJGyICRQ0AIAAoAgwgAygCECACEB8aIAAgACgCDCACajYCDCADIAMoAhAgAmo2AhAgACAAKAIUIAJqNgIUIAAgACgCECACazYCECADIAMoAhQgAmsiADYCFCAADQAgAyADKAIINgIQC0ECQQAgBRshAwsgAwu5CwENfwJAA0ACQAJAIAAoAnRBhQJNBEAgABAKIAAoAnQhAgJAIAENACACQYYCTw0AQQAPCyACRQ0EIAJBA0kNAQsgACAAKAJUIAAoAmwiAiAAKAI4ai0AAiAAKAJIIAAoAlh0c3EiAzYCSCAAKAJAIAIgACgCNHFBAXRqIAAoAkQgA0EBdGoiBC8BACIDOwEAIAQgAjsBACADRQ0AIAAoAixBhgJrIAIgA2tJDQAgACAAIAMQDiICNgJgDAELIAAoAmAhAgsCQCACQQNPBEAgACgCpC0gACgCoC0iA0EBdGogACgCbCAAKAJwayIEOwEAIAAgA0EBajYCoC0gAyAAKAKYLWogAkEDayICOgAAIAJB/wFxQYDNAGotAABBAnQgAGpBmAlqIgIgAi8BAEEBajsBACAAIARBAWtB//8DcSICIAJBB3ZBgAJqIAJBgAJJG0GAyQBqLQAAQQJ0akGIE2oiAiACLwEAQQFqOwEAIAAgACgCdCAAKAJgIgJrIgM2AnQgACgCnC1BAWshBiAAKAKgLSEHAkAgA0EDSQ0AIAIgACgCgAFLDQAgACACQQFrIgM2AmAgACgCSCEEIAAoAmwhAiAAKAI0IQggACgCQCEJIAAoAkQhCiAAKAJUIQsgACgCOCEMIAAoAlghDQNAIAAgAiIFQQFqIgI2AmwgACAFIAxqLQADIAQgDXRzIAtxIgQ2AkggCSACIAhxQQF0aiAKIARBAXRqIg4vAQA7AQAgDiACOwEAIAAgA0EBayIDNgJgIAMNAAsgACAFQQJqIgI2AmwgBiAHRw0DDAILIABBADYCYCAAIAAoAmwgAmoiAjYCbCAAIAAoAjggAmoiAy0AACIENgJIIAAgACgCVCADLQABIAQgACgCWHRzcTYCSCAGIAdHDQIMAQsgACgCOCAAKAJsai0AACECIAAoAqQtIAAoAqAtIgNBAXRqQQA7AQAgACADQQFqNgKgLSADIAAoApgtaiACOgAAIAAgAkECdGpBlAFqIgIgAi8BAEEBajsBACAAIAAoAnRBAWs2AnQgACAAKAJsQQFqIgI2AmwgACgCoC0gACgCnC1BAWtHDQELQQAhAyAAIAAoAlwiBEEATgR/IAAoAjggBGoFIAMLIAIgBGtBABAUIAAgACgCbDYCXCAAKAIAIgIoAhwiAxATAkAgAigCECIEIAMoAhQiBSAEIAVJGyIERQ0AIAIoAgwgAygCECAEEB8aIAIgAigCDCAEajYCDCADIAMoAhAgBGo2AhAgAiACKAIUIARqNgIUIAIgAigCECAEazYCECADIAMoAhQgBGsiAjYCFCACDQAgAyADKAIINgIQCyAAKAIAKAIQDQALQQAPCyAAIAAoAmwiAkECIAJBAkkbNgK0LSABQQRGBEBBACEDIAAgACgCXCIEQQBOBH8gACgCOCAEagUgAwsgAiAEa0EBEBQgACAAKAJsNgJcIAAoAgAiAigCHCIDEBMCQCACKAIQIgQgAygCFCIFIAQgBUkbIgRFDQAgAigCDCADKAIQIAQQHxogAiACKAIMIARqNgIMIAMgAygCECAEajYCECACIAIoAhQgBGo2AhQgAiACKAIQIARrNgIQIAMgAygCFCAEayICNgIUIAINACADIAMoAgg2AhALQQNBAiAAKAIAKAIQGw8LAkAgACgCoC1FDQBBACEDIAAgACgCXCIEQQBOBH8gACgCOCAEagUgAwsgAiAEa0EAEBQgACAAKAJsNgJcIAAoAgAiAigCHCIDEBMCQCACKAIQIgQgAygCFCIFIAQgBUkbIgRFDQAgAigCDCADKAIQIAQQHxogAiACKAIMIARqNgIMIAMgAygCECAEajYCECACIAIoAhQgBGo2AhQgAiACKAIQIARrNgIQIAMgAygCFCAEayICNgIUIAINACADIAMoAgg2AhALIAAoAgAoAhANAEEADwtBAQukBAEQfyAAKAJ8IgMgA0ECdiAAKAJ4IgQgACgCjAFJGyEJQQAgACgCbCIDIAAoAixrQYYCaiICIAIgA0sbIQwgACgCdCIHIAAoApABIgIgAiAHSxshDSAAKAI4Ig4gA2oiBUGCAmohDyAEIAVqIgMtAAAhCiADQQFrLQAAIQsgACgCNCEQIAAoAkAhEQNAAkACQCABIA5qIgMgBGoiAi0AACAKRw0AIAJBAWstAAAgC0cNACADLQAAIAUtAABHDQBBAiEGIAMtAAEgBS0AAUcNAAJAAkACQAJAAkACQAJAA0AgBSAGaiICLQABIAMtAANHDQYgAi0AAiADLQAERw0FIAItAAMgAy0ABUcNBCACLQAEIAMtAAZHDQMgAi0ABSADLQAHRw0CIAItAAYgAy0ACEcNASACLQAHIAMtAAlGBEAgBkH5AUshCCAFIAZBCGoiBmohAiAIDQggAy0ACiEIIANBCGohAyACLQAAIAhGDQEMCAsLIAJBB2ohAgwGCyACQQZqIQIMBQsgAkEFaiECDAQLIAJBBGohAgwDCyACQQNqIQIMAgsgAkECaiECDAELIAJBAWohAgsgAiAPayICQYICaiIDIARMDQAgACABNgJwIAMgDU4EQCADIQQMAgsgAyAFai0AACEKIAIgBWotAIECIQsgAyEECyAJQQFrIglFDQAgDCARIAEgEHFBAXRqLwEAIgFJDQELCyAHIAQgBCAHSxsL3Q4BB38DQAJAAkACQCAAKAJ0QYUCSw0AIAAQCiAAKAJ0IQICQCABDQAgAkGGAk8NAEEADwsgAkUNAiACQQJLDQAgACAAKAJgIgI2AnggACAAKAJwNgJkQQIhAyAAQQI2AmAMAQtBAiEDIAAgACgCVCAAKAJsIgIgACgCOGotAAIgACgCSCAAKAJYdHNxIgQ2AkggACgCQCACIAAoAjRxQQF0aiAAKAJEIARBAXRqIgUvAQAiBDsBACAFIAI7AQAgACAAKAJgIgI2AnggACAAKAJwNgJkIABBAjYCYCAERQ0AAkAgAiAAKAKAAU8NACAAKAIsQYYCayAAKAJsIARrSQ0AIAAgACAEEA4iAzYCYCADQQVLDQAgACgCiAFBAUcEQCADQQNHDQFBAyEDIAAoAmwgACgCcGtBgSBJDQELQQIhAyAAQQI2AmALIAAoAnghAgsCQCACQQNJDQAgAiADSQ0AIAAoAnQhBCAAKAKkLSAAKAKgLSIDQQF0aiAAKAJsIgUgACgCZEF/c2oiBjsBACAAIANBAWo2AqAtIAMgACgCmC1qIAJBA2siAjoAACACQf8BcUGAzQBqLQAAQQJ0IABqQZgJaiICIAIvAQBBAWo7AQAgACAGQQFrQf//A3EiAiACQQd2QYACaiACQYACSRtBgMkAai0AAEECdGpBiBNqIgIgAi8BAEEBajsBACAAIAAoAngiAkECayIDNgJ4IAAgACgCdCACa0EBajYCdCAEIAVqQQNrIQUgACgCnC1BAWshByAAKAJsIQIgACgCoC0hCANAIAAgAiIEQQFqIgI2AmwgAiAFTQRAIAAgACgCVCAEIAAoAjhqLQADIAAoAkggACgCWHRzcSIGNgJIIAAoAkAgACgCNCACcUEBdGogACgCRCAGQQF0aiIGLwEAOwEAIAYgAjsBAAsgACADQQFrIgM2AnggAw0ACyAAQQI2AmAgAEEANgJoIAAgBEECaiICNgJsIAcgCEcNAkEAIQMgACAAKAJcIgRBAE4EfyAAKAI4IARqBSADCyACIARrQQAQFCAAIAAoAmw2AlwgACgCACICKAIcIgMQEwJAIAIoAhAiBCADKAIUIgUgBCAFSRsiBEUNACACKAIMIAMoAhAgBBAfGiACIAIoAgwgBGo2AgwgAyADKAIQIARqNgIQIAIgAigCFCAEajYCFCACIAIoAhAgBGs2AhAgAyADKAIUIARrIgI2AhQgAg0AIAMgAygCCDYCEAsgACgCACgCEA0CQQAPCyAAKAJoBEAgACgCbCAAKAI4akEBay0AACECIAAoAqQtIAAoAqAtIgNBAXRqQQA7AQAgACADQQFqNgKgLSADIAAoApgtaiACOgAAIAAgAkECdGpBlAFqIgIgAi8BAEEBajsBAAJAIAAoAqAtIAAoApwtQQFrRw0AQQAhAyAAIAAoAlwiAkEATgR/IAAoAjggAmoFIAMLIAAoAmwgAmtBABAUIAAgACgCbDYCXCAAKAIAIgIoAhwiAxATIAIoAhAiBCADKAIUIgUgBCAFSRsiBEUNACACKAIMIAMoAhAgBBAfGiACIAIoAgwgBGo2AgwgAyADKAIQIARqNgIQIAIgAigCFCAEajYCFCACIAIoAhAgBGs2AhAgAyADKAIUIARrIgI2AhQgAg0AIAMgAygCCDYCEAsgACAAKAJsQQFqNgJsIAAgACgCdEEBazYCdCAAKAIAKAIQDQJBAA8FIABBATYCaCAAIAAoAmxBAWo2AmwgACAAKAJ0QQFrNgJ0DAILAAsLIAAoAmgEQCAAKAJsIAAoAjhqQQFrLQAAIQIgACgCpC0gACgCoC0iA0EBdGpBADsBACAAIANBAWo2AqAtIAMgACgCmC1qIAI6AAAgACACQQJ0akGUAWoiAiACLwEAQQFqOwEAIABBADYCaAsgACAAKAJsIgJBAiACQQJJGzYCtC0gAUEERgRAQQAhAyAAIAAoAlwiBEEATgR/IAAoAjggBGoFIAMLIAIgBGtBARAUIAAgACgCbDYCXCAAKAIAIgIoAhwiAxATAkAgAigCECIEIAMoAhQiBSAEIAVJGyIERQ0AIAIoAgwgAygCECAEEB8aIAIgAigCDCAEajYCDCADIAMoAhAgBGo2AhAgAiACKAIUIARqNgIUIAIgAigCECAEazYCECADIAMoAhQgBGsiAjYCFCACDQAgAyADKAIINgIQC0EDQQIgACgCACgCEBsPCwJAIAAoAqAtRQ0AQQAhAyAAIAAoAlwiBEEATgR/IAAoAjggBGoFIAMLIAIgBGtBABAUIAAgACgCbDYCXCAAKAIAIgIoAhwiAxATAkAgAigCECIEIAMoAhQiBSAEIAVJGyIERQ0AIAIoAgwgAygCECAEEB8aIAIgAigCDCAEajYCDCADIAMoAhAgBGo2AhAgAiACKAIUIARqNgIUIAIgAigCECAEazYCECADIAMoAhQgBGsiAjYCFCACDQAgAyADKAIINgIQCyAAKAIAKAIQDQBBAA8LQQELYQAgAEEANgK8LSAAQQA7AbgtIABBuBZqQajPADYCACAAIABB/BRqNgKwFiAAQawWakGUzwA2AgAgACAAQYgTajYCpBYgAEGgFmpBgM8ANgIAIAAgAEGUAWo2ApgWIAAQEQvwBAEDfyAAQZQBaiECA0AgAiABQQJ0IgNqQQA7AQAgAiADQQRyakEAOwEAIAFBAmoiAUGeAkcNAAsgAEEAOwH8FCAAQQA7AYgTIABBxBVqQQA7AQAgAEHAFWpBADsBACAAQbwVakEAOwEAIABBuBVqQQA7AQAgAEG0FWpBADsBACAAQbAVakEAOwEAIABBrBVqQQA7AQAgAEGoFWpBADsBACAAQaQVakEAOwEAIABBoBVqQQA7AQAgAEGcFWpBADsBACAAQZgVakEAOwEAIABBlBVqQQA7AQAgAEGQFWpBADsBACAAQYwVakEAOwEAIABBiBVqQQA7AQAgAEGEFWpBADsBACAAQYAVakEAOwEAIABB/BNqQQA7AQAgAEH4E2pBADsBACAAQfQTakEAOwEAIABB8BNqQQA7AQAgAEHsE2pBADsBACAAQegTakEAOwEAIABB5BNqQQA7AQAgAEHgE2pBADsBACAAQdwTakEAOwEAIABB2BNqQQA7AQAgAEHUE2pBADsBACAAQdATakEAOwEAIABBzBNqQQA7AQAgAEHIE2pBADsBACAAQcQTakEAOwEAIABBwBNqQQA7AQAgAEG8E2pBADsBACAAQbgTakEAOwEAIABBtBNqQQA7AQAgAEGwE2pBADsBACAAQawTakEAOwEAIABBqBNqQQA7AQAgAEGkE2pBADsBACAAQaATakEAOwEAIABBnBNqQQA7AQAgAEGYE2pBADsBACAAQZQTakEAOwEAIABBkBNqQQA7AQAgAEGME2pBADsBACAAQgA3AqwtIABBlAlqQQE7AQAgAEEANgKoLSAAQQA2AqAtC7IDAQJ/IAAgAC8BuC0gA0H//wNxIgUgACgCvC0iBHRyIgM7AbgtAkACQAJ/IARBDk4EQCAAIAAoAhQiBEEBajYCFCAEIAAoAghqIAM6AAAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAAQbktai0AADoAACAAIAVBECAAKAK8LSIEa3YiAzsBuC0gBEENawwBCyAEQQNqCyIEQQlOBEAgACAAKAIUIgRBAWo2AhQgBCAAKAIIaiADOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGohBCAAQbktai0AACEDDAELIARBAUgNASAAIAAoAhQiBEEBajYCFCAEIAAoAghqIQQLIAQgAzoAAAsgAEEANgK8LSAAQQA7AbgtIAAgACgCFCIDQQFqNgIUIAMgACgCCGogAjoAACAAIAAoAhQiA0EBajYCFCADIAAoAghqIAJBCHY6AAAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiACQX9zIgM6AAAgACAAKAIUIgRBAWo2AhQgBCAAKAIIaiADQQh2OgAAIAAoAgggACgCFGogASACEB8aIAAgACgCFCACajYCFAusAQEBfwJAIAACfyAAKAK8LSIBQRBGBEAgACAAKAIUIgFBAWo2AhQgASAAKAIIaiAALQC4LToAACAAIAAoAhQiAUEBajYCFCABIAAoAghqIABBuS1qLQAAOgAAIABBADsBuC1BAAwBCyABQQhIDQEgACAAKAIUIgFBAWo2AhQgASAAKAIIaiAALQC4LToAACAAIABBuS1qLQAAOwG4LSAAKAK8LUEIaws2ArwtCwuhEwENfwJ/AkACQAJAIAAoAoQBQQFOBEAgACgCACIGKAIsQQJHDQNB/4D/n38hBANAAkAgBEEBcUUNACAAIAVBAnRqLwGUAUUNAEEAIQQMBAsCQCAEQQJxRQ0AIAAgBUECdEEEcmovAZQBRQ0AQQAhBAwECyAEQQJ2IQQgBUECaiIFQSBHDQALDAELIAJBBWoiBQwDCwJAIAAvAbgBDQAgAC8BvAENACAALwHIAQ0AQSAhBQNAIAAgBUECdCIEai8BlAENASAAIARBBHJqLwGUAQ0BIAAgBEEIcmovAZQBDQEgACAEQQxyai8BlAENAUEAIQQgBUEEaiIFQYACRw0ACwwBC0EBIQQLIAYgBDYCLAsgACAAQZgWahAVIAAgAEGkFmoQFSAALwGWASEEIAAgAEGcFmooAgAiCkECdGpB//8DOwGaASAKQQBOBEBBB0GKASAEGyEJQQRBAyAEGyELIABBwBVqIQ4gAEHEFWohDyAAQbwVaiEQQX8hDANAIAQhBSAAIAgiDUEBaiIIQQJ0ai8BlgEhBAJAAkAgB0EBaiIGIAlODQAgBCAFRw0AIAYhBwwBCwJ/IAYgC0gEQCAAIAVBAnRqQfwUaiIHLwEAIAZqDAELIAUEQCAFIAxHBEAgACAFQQJ0akH8FGoiBiAGLwEAQQFqOwEACyAQIgcvAQBBAWoMAQsgB0EJTARAIA4iBy8BAEEBagwBCyAPIgcvAQBBAWoLIQYgByAGOwEAQQAhBwJ/IARFBEBBAyELQYoBDAELQQNBBCAEIAVGIgYbIQtBBkEHIAYbCyEJIAUhDAsgCiANRw0ACwsgAEGKE2ovAQAhBCAAIABBqBZqKAIAIgpBAnRqQY4TakH//wM7AQBBACEHIApBAE4EQEEHQYoBIAQbIQlBBEEDIAQbIQsgAEHAFWohDiAAQcQVaiEPIABBvBVqIRBBfyEMQQAhCANAIAQhBSAAIAgiDUEBaiIIQQJ0akGKE2ovAQAhBAJAAkAgB0EBaiIGIAlODQAgBCAFRw0AIAYhBwwBCwJ/IAYgC0gEQCAAIAVBAnRqQfwUaiIHLwEAIAZqDAELIAUEQCAFIAxHBEAgACAFQQJ0akH8FGoiBiAGLwEAQQFqOwEACyAQIgcvAQBBAWoMAQsgB0EJTARAIA4iBy8BAEEBagwBCyAPIgcvAQBBAWoLIQYgByAGOwEAQQAhBwJ/IARFBEBBAyELQYoBDAELQQNBBCAEIAVGIgYbIQtBBkEHIAYbCyEJIAUhDAsgCiANRw0ACwsgACAAQbAWahAVIAAgACgCqC0Cf0ESIABBuhVqLwEADQAaQREgAEGCFWovAQANABpBECAAQbYVai8BAA0AGkEPIABBhhVqLwEADQAaQQ4gAEGyFWovAQANABpBDSAAQYoVai8BAA0AGkEMIABBrhVqLwEADQAaQQsgAEGOFWovAQANABpBCiAAQaoVai8BAA0AGkEJIABBkhVqLwEADQAaQQggAEGmFWovAQANABpBByAAQZYVai8BAA0AGkEGIABBohVqLwEADQAaQQUgAEGaFWovAQANABpBBCAAQZ4Vai8BAA0AGkEDQQIgAEH+FGovAQAbCyIIQQNsaiIEQRFqNgKoLSAEQRtqQQN2IgQgACgCrC1BCmpBA3YiBSAEIAVJGwshBAJAAkAgAUUNACACQQRqIARLDQAgACABIAIgAxASDAELIAAoArwtIQYCQCAEIAVHBEAgACgCiAFBBEcNAQsgACAALwG4LSADQQJqQf//A3EiBCAGdHIiBTsBuC0gAAJ/IAZBDk4EQCAAIAAoAhQiBkEBajYCFCAGIAAoAghqIAU6AAAgACAAKAIUIgVBAWo2AhQgBSAAKAIIaiAAQbktai0AADoAACAAIARBECAAKAK8LSIFa3Y7AbgtIAVBDWsMAQsgBkEDags2ArwtIABBwM8AQcDYABAWDAELIAAvAbgtIANBBGpB//8DcSIHIAZ0ciEFAkAgBkEOTgRAIAAgBTsBuC0gACAAKAIUIgRBAWo2AhQgBCAAKAIIaiAFOgAAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogAEG5LWotAAA6AAAgACgCvC0iBUENayEEIAdBECAFa3YhBQwBCyAGQQNqIQQLIAAgBDYCvC0gAEGcFmooAgAiCkGA/gNqQf//A3EiByAEdCEGIABBqBZqKAIAIQkCfyAEQQxOBEAgACAFIAZyIgQ7AbgtIAAgACgCFCIFQQFqNgIUIAUgACgCCGogBDoAACAAIAAoAhQiBEEBajYCFCAEIAAoAghqIABBuS1qLQAAOgAAIAAoArwtIgVBC2shBCAHQRAgBWt2DAELIARBBWohBCAFIAZyCyEFIAAgBDYCvC0gCUH//wNxIgcgBHQhBgJ/IARBDE4EQCAAIAUgBnIiBDsBuC0gACAAKAIUIgVBAWo2AhQgBSAAKAIIaiAEOgAAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogAEG5LWotAAA6AAAgACgCvC0iBUELayEEIAdBECAFa3YMAQsgBEEFaiEEIAUgBnILIQUgACAENgK8LSAIQf3/A2pB//8DcSIHIAR0IQYCfyAEQQ1OBEAgACAFIAZyIgQ7AbgtIAAgACgCFCIFQQFqNgIUIAUgACgCCGogBDoAACAAIAAoAhQiBEEBajYCFCAEIAAoAghqIABBuS1qLQAAOgAAIAAoArwtIgVBDGshBCAHQRAgBWt2DAELIARBBGohBCAFIAZyCyEGIAAgBDYCvC1BACEFIABBuS1qIQ0DQCAAIAYgACAFQZDcAGotAABBAnRqQf4Uai8BACIHIAR0ciIGOwG4LSAAAn8gBEEOTgRAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogBjoAACAAIAAoAhQiBEEBajYCFCAEIAAoAghqIA0tAAA6AAAgACAHQRAgACgCvC0iBGt2IgY7AbgtIARBDWsMAQsgBEEDagsiBDYCvC0gBSAIRyEHIAVBAWohBSAHDQALIAAgAEGUAWoiBCAKEBcgACAAQYgTaiIFIAkQFyAAIAQgBRAWCyAAEBEgAwRAAkACfyAAKAK8LSIEQQlOBEAgACAAKAIUIgRBAWo2AhQgBCAAKAIIaiAALQC4LToAACAAIAAoAhQiBEEBajYCFCAEIAAoAghqIQQgAEG5LWotAAAMAQsgBEEBSA0BIAAgACgCFCIEQQFqNgIUIAQgACgCCGohBCAALQC4LQshBSAEIAU6AAALIABBADYCvC0gAEEAOwG4LQsLsRUBFX8jAEEgayEKIAEoAgAhCSABKAIIIgIoAgAhBSACKAIMIQ0gAEKAgICA0McANwLQKEF/IRACQCANQQBKBEBBACECA0ACQCAJIAJBAnRqIgMvAQAEQCAAIAAoAtAoQQFqIgM2AtAoIAAgA0ECdGpB3BZqIAI2AgAgACACakHYKGpBADoAACACIRAMAQsgA0EAOwECCyACQQFqIgIgDUcNAAsgACgC0CgiBEEBSg0BCwNAIAAgBEEBaiICNgLQKCAAIAJBAnRqQdwWaiAQQQFqIgNBACAQQQJIIgQbIgI2AgAgCSACQQJ0IgdqQQE7AQAgACACakHYKGpBADoAACAAIAAoAqgtQQFrNgKoLSAFBEAgACAAKAKsLSAFIAdqLwECazYCrC0LIAMgECAEGyEQIAAoAtAoIgRBAkgNAAsLIAEgEDYCBCAEQQF2IQgDQCAAIAhBAnRqQdwWaigCACELAkAgCCICQQF0IgMgBEoNACAAIAtqQdgoaiEPIAkgC0ECdGohBiAIIQUDQAJAIAMgBE4EQCADIQIMAQsgCSAAQdwWaiICIANBAXIiBEECdGooAgAiDkECdGovAQAiByAJIAIgA0ECdGooAgAiDEECdGovAQAiAk8EQCACIAdHBEAgAyECDAILIAMhAiAAQdgoaiIDIA5qLQAAIAMgDGotAABLDQELIAQhAgsgBi8BACIEIAkgACACQQJ0akHcFmooAgAiA0ECdGovAQAiB0kEQCAFIQIMAgsCQCAEIAdHDQAgDy0AACAAIANqQdgoai0AAEsNACAFIQIMAgsgACAFQQJ0akHcFmogAzYCACACIQUgAkEBdCIDIAAoAtAoIgRMDQALCyAAIAJBAnRqQdwWaiALNgIAIAhBAk4EQCAIQQFrIQggACgC0CghBAwBCwsgACgC0CghAwNAIA0hCCAAIANBAWsiBDYC0CggACgC4BYhCyAAIAAgA0ECdGpB3BZqKAIAIg02AuAWQQEhAgJAIANBA0gNACAAIA1qQdgoaiEPQQIhAyAJIA1BAnRqIQZBASEFA0ACQCADIAROBEAgAyECDAELIAkgAEHcFmoiAiADQQFyIgRBAnRqKAIAIg5BAnRqLwEAIgcgCSACIANBAnRqKAIAIgxBAnRqLwEAIgJPBEAgAiAHRwRAIAMhAgwCCyADIQIgAEHYKGoiAyAOai0AACADIAxqLQAASw0BCyAEIQILIAYvAQAiBCAJIAAgAkECdGpB3BZqKAIAIgNBAnRqLwEAIgdJBEAgBSECDAILAkAgBCAHRw0AIA8tAAAgACADakHYKGotAABLDQAgBSECDAILIAAgBUECdGpB3BZqIAM2AgAgAiEFIAJBAXQiAyAAKALQKCIETA0ACwtBAiEDIABB3BZqIgYgAkECdGogDTYCACAAIAAoAtQoQQFrIgQ2AtQoIAAoAuAWIQIgBiAEQQJ0aiALNgIAIAAgACgC1ChBAWsiBDYC1CggBiAEQQJ0aiACNgIAIAkgCEECdGoiDiAJIAJBAnRqIgQvAQAgCSALQQJ0aiIFLwEAajsBACAAQdgoaiIMIAhqIg8gAiAMai0AACICIAsgDGotAAAiByACIAdLG0EBajoAACAEIAg7AQIgBSAIOwECIAAgCDYC4BZBASEFQQEhAgJAIAAoAtAoIgRBAkgNAANAAn8gAyADIARODQAaIAkgBiADQQFyIgRBAnRqKAIAIgtBAnRqLwEAIgIgCSAGIANBAnRqKAIAIg1BAnRqLwEAIgdPBEAgAyACIAdHDQEaIAMgCyAMai0AACAMIA1qLQAASw0BGgsgBAshAiAOLwEAIgQgCSAAIAJBAnRqQdwWaigCACIDQQJ0ai8BACIHSQRAIAUhAgwCCwJAIAQgB0cNACAPLQAAIAAgA2pB2ChqLQAASw0AIAUhAgwCCyAAIAVBAnRqQdwWaiADNgIAIAIhBSACQQF0IgMgACgC0CgiBEwNAAsLIAhBAWohDSAAIAJBAnRqQdwWaiAINgIAIAAoAtAoIgNBAUoNAAsgACAAKALUKEEBayICNgLUKCAAQdwWaiIDIAJBAnRqIAAoAuAWNgIAIAEoAgQhByABKAIIIgIoAhAhBiACKAIIIREgAigCBCETIAIoAgAhEiABKAIAIQwgAEHUFmoiAUIANwEAIABBzBZqIhRCADcBACAAQcQWaiIVQgA3AQAgAEG8FmoiFkIANwEAQQAhCCAMIAMgACgC1ChBAnRqKAIAQQJ0akEAOwECAkAgACgC1CgiAkG7BEoNACACQQFqIQJBACEOA0AgDCAAIAJBAnRqQdwWaigCACIEQQJ0Ig1qIgUgDCAFLwECQQJ0ai8BAiIDQQFqIAYgAyAGSBsiDzsBAiADIAZOIQMCQCAEIAdKDQAgACAPQQF0akG8FmoiCyALLwEAQQFqOwEAQQAhCyAEIBFOBEAgEyAEIBFrQQJ0aigCACELCyAAIAAoAqgtIAUvAQAiBCALIA9qbGo2AqgtIBJFDQAgACAAKAKsLSALIA0gEmovAQJqIARsajYCrC0LIAMgDmohDiACQQFqIgJBvQRHDQALIA5FDQAgACAGQQF0akG8FmohDwNAIAYhAgNAIAAgAiIDQQFrIgJBAXRqQbwWaiIELwEAIgVFDQALIAQgBUEBazsBACAAIANBAXRqQbwWaiICIAIvAQBBAmo7AQAgDyAPLwEAQQFrIgI7AQAgDkECSiEDIA5BAmshDiADDQALIAZFDQBBvQQhBQNAIAJB//8DcSEDIAUhAgNAIAMEQCAAIAJBAWsiAkECdGpB3BZqKAIAIgQgB0oNASAMIARBAnRqIgQvAQIiBSAGRwRAIAAgACgCqC0gBC8BACAGIAVrbGo2AqgtIAQgBjsBAgsgA0EBayEDIAIhBQwBCwsgBkEBayIGRQ0BIAAgBkEBdGpBvBZqLwEAIQIMAAsACyAKIBYvAQBBAXQiAjsBAiAKIAIgAEG+FmovAQBqQQF0IgI7AQQgCiACIABBwBZqLwEAakEBdCICOwEGIAogAiAAQcIWai8BAGpBAXQiAjsBCCAKIAIgFS8BAGpBAXQiAjsBCiAKIAIgAEHGFmovAQBqQQF0IgI7AQwgCiACIABByBZqLwEAakEBdCICOwEOIAogAiAAQcoWai8BAGpBAXQiAjsBECAKIAIgFC8BAGpBAXQiAjsBEiAKIAIgAEHOFmovAQBqQQF0IgI7ARQgCiACIABB0BZqLwEAakEBdCICOwEWIAogAiAAQdIWai8BAGpBAXQiAjsBGCAKIAEvAQAgAmpBAXQiAjsBGiAKIABB1hZqLwEAIAJqQQF0IgI7ARwgCiACIABB2BZqLwEAakEBdDsBHiAQQQBOBEADQCAJIAhBAnRqIgcvAQIiBARAIAogBEEBdGoiACAALwEAIgBBAWo7AQAgBEEDcSEDQQAhAiAEQQFrQQNPBEAgBEH8/wNxIQUDQCAAQQN2QQFxIABBAnZBAXEgAEECcSACIABBAXFyQQJ0cnJBAXRyIgRBAXQhAiAAQQR2IQAgBUEEayIFDQALCyADBEADQCACIABBAXFyIgRBAXQhAiAAQQF2IQAgA0EBayIDDQALCyAHIAQ7AQALIAggEEchACAIQQFqIQggAA0ACwsL2QgBCn8CQCAAKAKgLUUEQCAAKAK8LSEDDAELIABBuS1qIQgDQCAEQQFqIQogACgCmC0gBGotAAAhBQJAIAACfyAAKAKkLSAEQQF0ai8BACIHRQRAIAEgBUECdGoiAy8BAiEEIAAgAC8BuC0gAy8BACIFIAAoArwtIgN0ciIHOwG4LUEQIARrIANIBEAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAHOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogCC0AADoAACAAIAVBECAAKAK8LSIDa3Y7AbgtIAMgBGpBEGsMAgsgAyAEagwBCyAFQYDNAGotAAAiC0ECdCIJQYAIciABaiIDLwEGIQQgACAALwG4LSADLwEEIgwgACgCvC0iBnRyIgM7AbgtIAACf0EQIARrIAZIBEAgACAAKAIUIgZBAWo2AhQgBiAAKAIIaiADOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogCC0AADoAACAAIAxBECAAKAK8LSIGa3YiAzsBuC0gBCAGakEQawwBCyAEIAZqCyIENgK8LSALQQhrQRNNBEAgACADIAUgCUGw3ABqKAIAa0H//wNxIgYgBHRyIgM7AbgtIAACf0EQIAlBwNkAaigCACIFayAESARAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogAzoAACAAIAAoAhQiBEEBajYCFCAEIAAoAghqIAgtAAA6AAAgACAGQRAgACgCvC0iBGt2IgM7AbgtIAQgBWpBEGsMAQsgBCAFagsiBDYCvC0LIAIgB0EBayIFIAVBB3ZBgAJqIAVBgAJJG0GAyQBqLQAAIgtBAnQiCWoiBi8BAiEHIAAgAyAGLwEAIgwgBHRyIgY7AbgtIAACf0EQIAdrIARIBEAgACAAKAIUIgRBAWo2AhQgBCAAKAIIaiAGOgAAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogCC0AADoAACAAIAxBECAAKAK8LSIEa3YiBjsBuC0gBCAHakEQawwBCyAEIAdqCyIDNgK8LSALQQRJDQEgACAGIAUgCUGw3QBqKAIAa0H//wNxIgUgA3RyIgc7AbgtQRAgCUHA2gBqKAIAIgRrIANIBEAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAHOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogCC0AADoAACAAIAVBECAAKAK8LSIDa3Y7AbgtIAMgBGpBEGsMAQsgAyAEagsiAzYCvC0LIAoiBCAAKAKgLUkNAAsLIAFBgghqLwEAIQQgACAALwG4LSABLwGACCIKIAN0ciIFOwG4LUEQIARrIANIBEAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAFOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogAEG5LWotAAA6AAAgACAKQRAgACgCvC0iA2t2OwG4LSAAIAMgBGpBEGs2ArwtDwsgACADIARqNgK8LQuXCwEMfyACQQBOBEBBBEEDIAEvAQIiChshBkEHQYoBIAobIQMgAEG5LWohCEF/IQcDQCAKIQkgASALIgxBAWoiC0ECdGovAQIhCgJAAkAgBUEBaiIEIANODQAgCSAKRw0AIAQhBQwBCwJAIAQgBkgEQCAAIAlBAnRqIgVB/BRqIQ0gBUH+FGohDiAAKAK8LSEFA0AgDi8BACEDIAAgAC8BuC0gDS8BACIGIAV0ciIHOwG4LSAAAn9BECADayAFSARAIAAgACgCFCIFQQFqNgIUIAUgACgCCGogBzoAACAAIAAoAhQiBUEBajYCFCAFIAAoAghqIAgtAAA6AAAgACAGQRAgACgCvC0iBWt2OwG4LSADIAVqQRBrDAELIAMgBWoLIgU2ArwtIARBAWsiBA0ACwwBCyAAAn8gCQRAAkAgByAJRgRAIAAoArwtIQMgBCEFDAELIAAgCUECdGoiBEH+FGovAQAhAyAAIAAvAbgtIARB/BRqLwEAIgYgACgCvC0iBHRyIgc7AbgtIAACf0EQIANrIARIBEAgACAAKAIUIgRBAWo2AhQgBCAAKAIIaiAHOgAAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogCC0AADoAACAAIAZBECAAKAK8LSIEa3Y7AbgtIAMgBGpBEGsMAQsgAyAEagsiAzYCvC0LIAAvAbgtIAAvAbwVIgcgA3RyIQQCQEEQIAAvAb4VIgZrIANIBEAgACAEOwG4LSAAIAAoAhQiA0EBajYCFCADIAAoAghqIAQ6AAAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAILQAAOgAAIAYgACgCvC0iBGpBEGshAyAHQRAgBGt2IQQMAQsgAyAGaiEDCyAAIAM2ArwtIAAgBCAFQf3/A2pB//8DcSIFIAN0ciIEOwG4LSADQQ9OBEAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAEOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogCC0AADoAACAAIAVBECAAKAK8LSIDa3Y7AbgtIANBDmsMAgsgA0ECagwBCyAFQQlMBEAgAC8BuC0gAC8BwBUiByAAKAK8LSIDdHIhBAJAQRAgAC8BwhUiBmsgA0gEQCAAIAQ7AbgtIAAgACgCFCIDQQFqNgIUIAMgACgCCGogBDoAACAAIAAoAhQiA0EBajYCFCADIAAoAghqIAgtAAA6AAAgBiAAKAK8LSIEakEQayEDIAdBECAEa3YhBAwBCyADIAZqIQMLIAAgAzYCvC0gACAEIAVB/v8DakH//wNxIgUgA3RyIgQ7AbgtIANBDk4EQCAAIAAoAhQiA0EBajYCFCADIAAoAghqIAQ6AAAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAILQAAOgAAIAAgBUEQIAAoArwtIgNrdjsBuC0gA0ENawwCCyADQQNqDAELIAAvAbgtIAAvAcQVIgcgACgCvC0iA3RyIQQCQEEQIAAvAcYVIgZrIANIBEAgACAEOwG4LSAAIAAoAhQiA0EBajYCFCADIAAoAghqIAQ6AAAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAILQAAOgAAIAYgACgCvC0iBGpBEGshAyAHQRAgBGt2IQQMAQsgAyAGaiEDCyAAIAM2ArwtIAAgBCAFQfb/A2pB//8DcSIFIAN0ciIEOwG4LSADQQpOBEAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAEOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogCC0AADoAACAAIAVBECAAKAK8LSIDa3Y7AbgtIANBCWsMAQsgA0EHags2ArwtC0EAIQUCfyAKRQRAQYoBIQNBAwwBC0EGQQcgCSAKRiIEGyEDQQNBBCAEGwshBiAJIQcLIAIgDEcNAAsLCwkAIAEgAmwQHAsGACABEB0LXwEBfyMAQUBqIgMkACADQQA2AjAgA0IANwMoIAMgADYCCCADIAI2AhQgAyABNgIMIAMgAUEDbDYCGCADQQhqEAcgA0EIahALIANBCGoQCCADKAIcIQEgA0FAayQAIAELBgBB1N8AC6QuAQx/IwBBEGsiDCQAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIABB9AFNBEBB2N8AKAIAIgZBECAAQQtqQXhxIABBC0kbIgRBA3YiAXYiAEEDcQRAIABBf3NBAXEgAWoiAkEDdCIDQYjgAGooAgAiAUEIaiEAAkAgASgCCCIEIANBgOAAaiIDRgRAQdjfACAGQX4gAndxNgIADAELIAQgAzYCDCADIAQ2AggLIAEgAkEDdCICQQNyNgIEIAEgAmoiASABKAIEQQFyNgIEDA0LIARB4N8AKAIAIghNDQEgAARAAkAgACABdEECIAF0IgBBACAAa3JxIgBBACAAa3FBAWsiACAAQQx2QRBxIgB2IgFBBXZBCHEiAiAAciABIAJ2IgBBAnZBBHEiAXIgACABdiIAQQF2QQJxIgFyIAAgAXYiAEEBdkEBcSIBciAAIAF2aiICQQN0IgNBiOAAaigCACIBKAIIIgAgA0GA4ABqIgNGBEBB2N8AIAZBfiACd3EiBjYCAAwBCyAAIAM2AgwgAyAANgIICyABQQhqIQAgASAEQQNyNgIEIAEgBGoiAyACQQN0IgUgBGsiAkEBcjYCBCABIAVqIAI2AgAgCARAIAhBA3YiBUEDdEGA4ABqIQRB7N8AKAIAIQECfyAGQQEgBXQiBXFFBEBB2N8AIAUgBnI2AgAgBAwBCyAEKAIICyEFIAQgATYCCCAFIAE2AgwgASAENgIMIAEgBTYCCAtB7N8AIAM2AgBB4N8AIAI2AgAMDQtB3N8AKAIAIglFDQEgCUEAIAlrcUEBayIAIABBDHZBEHEiAHYiAUEFdkEIcSICIAByIAEgAnYiAEECdkEEcSIBciAAIAF2IgBBAXZBAnEiAXIgACABdiIAQQF2QQFxIgFyIAAgAXZqQQJ0QYjiAGooAgAiAygCBEF4cSAEayEBIAMhAgNAAkAgAigCECIARQRAIAIoAhQiAEUNAQsgACgCBEF4cSAEayICIAEgASACSyICGyEBIAAgAyACGyEDIAAhAgwBCwsgAyAEaiILIANNDQIgAygCGCEKIAMgAygCDCIFRwRAIAMoAggiAEHo3wAoAgBJGiAAIAU2AgwgBSAANgIIDAwLIANBFGoiAigCACIARQRAIAMoAhAiAEUNBCADQRBqIQILA0AgAiEHIAAiBUEUaiICKAIAIgANACAFQRBqIQIgBSgCECIADQALIAdBADYCAAwLC0F/IQQgAEG/f0sNACAAQQtqIgBBeHEhBEHc3wAoAgAiCEUNAEEfIQcgBEH///8HTQRAIABBCHYiACAAQYD+P2pBEHZBCHEiAHQiASABQYDgH2pBEHZBBHEiAXQiAiACQYCAD2pBEHZBAnEiAnRBD3YgACABciACcmsiAEEBdCAEIABBFWp2QQFxckEcaiEHC0EAIARrIQECQAJAAkAgB0ECdEGI4gBqKAIAIgJFBEBBACEADAELQQAhACAEQQBBGSAHQQF2ayAHQR9GG3QhAwNAAkAgAigCBEF4cSAEayIGIAFPDQAgAiEFIAYiAQ0AQQAhASACIQAMAwsgACACKAIUIgYgBiACIANBHXZBBHFqKAIQIgJGGyAAIAYbIQAgA0EBdCEDIAINAAsLIAAgBXJFBEBBAiAHdCIAQQAgAGtyIAhxIgBFDQMgAEEAIABrcUEBayIAIABBDHZBEHEiAHYiAkEFdkEIcSIDIAByIAIgA3YiAEECdkEEcSICciAAIAJ2IgBBAXZBAnEiAnIgACACdiIAQQF2QQFxIgJyIAAgAnZqQQJ0QYjiAGooAgAhAAsgAEUNAQsDQCAAKAIEQXhxIARrIgYgAUkhAyAGIAEgAxshASAAIAUgAxshBSAAKAIQIgIEfyACBSAAKAIUCyIADQALCyAFRQ0AIAFB4N8AKAIAIARrTw0AIAQgBWoiByAFTQ0BIAUoAhghCSAFIAUoAgwiA0cEQCAFKAIIIgBB6N8AKAIASRogACADNgIMIAMgADYCCAwKCyAFQRRqIgIoAgAiAEUEQCAFKAIQIgBFDQQgBUEQaiECCwNAIAIhBiAAIgNBFGoiAigCACIADQAgA0EQaiECIAMoAhAiAA0ACyAGQQA2AgAMCQsgBEHg3wAoAgAiAE0EQEHs3wAoAgAhAQJAIAAgBGsiAkEQTwRAQeDfACACNgIAQezfACABIARqIgM2AgAgAyACQQFyNgIEIAAgAWogAjYCACABIARBA3I2AgQMAQtB7N8AQQA2AgBB4N8AQQA2AgAgASAAQQNyNgIEIAAgAWoiACAAKAIEQQFyNgIECyABQQhqIQAMCwsgBEHk3wAoAgAiA0kEQEHk3wAgAyAEayIBNgIAQfDfAEHw3wAoAgAiACAEaiICNgIAIAIgAUEBcjYCBCAAIARBA3I2AgQgAEEIaiEADAsLQQAhACAEQS9qIggCf0Gw4wAoAgAEQEG44wAoAgAMAQtBvOMAQn83AgBBtOMAQoCggICAgAQ3AgBBsOMAIAxBDGpBcHFB2KrVqgVzNgIAQcTjAEEANgIAQZTjAEEANgIAQYAgCyIBaiIGQQAgAWsiB3EiBSAETQ0KQZDjACgCACIBBEBBiOMAKAIAIgIgBWoiCSACTQ0LIAEgCUkNCwtBlOMALQAAQQRxDQUCQAJAQfDfACgCACIBBEBBmOMAIQADQCABIAAoAgAiAk8EQCACIAAoAgRqIAFLDQMLIAAoAggiAA0ACwtBABAeIgNBf0YNBiAFIQZBtOMAKAIAIgBBAWsiASADcQRAIAUgA2sgASADakEAIABrcWohBgsgBCAGTw0GIAZB/v///wdLDQZBkOMAKAIAIgAEQEGI4wAoAgAiASAGaiICIAFNDQcgACACSQ0HCyAGEB4iACADRw0BDAgLIAYgA2sgB3EiBkH+////B0sNBSAGEB4iAyAAKAIAIAAoAgRqRg0EIAMhAAsCQCAEQTBqIAZNDQAgAEF/Rg0AQbjjACgCACIBIAggBmtqQQAgAWtxIgFB/v///wdLBEAgACEDDAgLIAEQHkF/RwRAIAEgBmohBiAAIQMMCAtBACAGaxAeGgwFCyAAIQMgAEF/Rw0GDAQLAAtBACEFDAcLQQAhAwwFCyADQX9HDQILQZTjAEGU4wAoAgBBBHI2AgALIAVB/v///wdLDQEgBRAeIgNBABAeIgBPDQEgA0F/Rg0BIABBf0YNASAAIANrIgYgBEEoak0NAQtBiOMAQYjjACgCACAGaiIANgIAQYzjACgCACAASQRAQYzjACAANgIACwJAAkACQEHw3wAoAgAiAQRAQZjjACEAA0AgAyAAKAIAIgIgACgCBCIFakYNAiAAKAIIIgANAAsMAgtB6N8AKAIAIgBBACAAIANNG0UEQEHo3wAgAzYCAAtBACEAQZzjACAGNgIAQZjjACADNgIAQfjfAEF/NgIAQfzfAEGw4wAoAgA2AgBBpOMAQQA2AgADQCAAQQN0IgFBiOAAaiABQYDgAGoiAjYCACABQYzgAGogAjYCACAAQQFqIgBBIEcNAAtB5N8AIAZBKGsiAEF4IANrQQdxQQAgA0EIakEHcRsiAWsiAjYCAEHw3wAgASADaiIBNgIAIAEgAkEBcjYCBCAAIANqQSg2AgRB9N8AQcDjACgCADYCAAwCCyABIANPDQAgASACSQ0AIAAoAgxBCHENACAAIAUgBmo2AgRB8N8AIAFBeCABa0EHcUEAIAFBCGpBB3EbIgBqIgI2AgBB5N8AQeTfACgCACAGaiIDIABrIgA2AgAgAiAAQQFyNgIEIAEgA2pBKDYCBEH03wBBwOMAKAIANgIADAELQejfACgCACADSwRAQejfACADNgIACyADIAZqIQJBmOMAIQACQAJAAkACQAJAAkADQCACIAAoAgBHBEAgACgCCCIADQEMAgsLIAAtAAxBCHFFDQELQZjjACEAA0AgASAAKAIAIgJPBEAgAiAAKAIEaiICIAFLDQMLIAAoAgghAAwACwALIAAgAzYCACAAIAAoAgQgBmo2AgQgA0F4IANrQQdxQQAgA0EIakEHcRtqIgcgBEEDcjYCBCACQXggAmtBB3FBACACQQhqQQdxG2oiBiAHayAEayECIAQgB2ohBCABIAZGBEBB8N8AIAQ2AgBB5N8AQeTfACgCACACaiIANgIAIAQgAEEBcjYCBAwDCyAGQezfACgCAEYEQEHs3wAgBDYCAEHg3wBB4N8AKAIAIAJqIgA2AgAgBCAAQQFyNgIEIAAgBGogADYCAAwDCyAGKAIEIgBBA3FBAUYEQCAAQXhxIQgCQCAAQf8BTQRAIAYoAggiASAAQQN2IgVBA3RBgOAAakYaIAEgBigCDCIARgRAQdjfAEHY3wAoAgBBfiAFd3E2AgAMAgsgASAANgIMIAAgATYCCAwBCyAGKAIYIQkCQCAGIAYoAgwiA0cEQCAGKAIIIgAgAzYCDCADIAA2AggMAQsCQCAGQRRqIgAoAgAiAQ0AIAZBEGoiACgCACIBDQBBACEDDAELA0AgACEFIAEiA0EUaiIAKAIAIgENACADQRBqIQAgAygCECIBDQALIAVBADYCAAsgCUUNAAJAIAYgBigCHCIBQQJ0QYjiAGoiACgCAEYEQCAAIAM2AgAgAw0BQdzfAEHc3wAoAgBBfiABd3E2AgAMAgsgCUEQQRQgCSgCECAGRhtqIAM2AgAgA0UNAQsgAyAJNgIYIAYoAhAiAARAIAMgADYCECAAIAM2AhgLIAYoAhQiAEUNACADIAA2AhQgACADNgIYCyAGIAhqIQYgAiAIaiECCyAGIAYoAgRBfnE2AgQgBCACQQFyNgIEIAIgBGogAjYCACACQf8BTQRAIAJBA3YiAUEDdEGA4ABqIQACf0HY3wAoAgAiAkEBIAF0IgFxRQRAQdjfACABIAJyNgIAIAAMAQsgACgCCAshASAAIAQ2AgggASAENgIMIAQgADYCDCAEIAE2AggMAwtBHyEAIAJB////B00EQCACQQh2IgAgAEGA/j9qQRB2QQhxIgB0IgEgAUGA4B9qQRB2QQRxIgF0IgMgA0GAgA9qQRB2QQJxIgN0QQ92IAAgAXIgA3JrIgBBAXQgAiAAQRVqdkEBcXJBHGohAAsgBCAANgIcIARCADcCECAAQQJ0QYjiAGohAQJAQdzfACgCACIDQQEgAHQiBXFFBEBB3N8AIAMgBXI2AgAgASAENgIAIAQgATYCGAwBCyACQQBBGSAAQQF2ayAAQR9GG3QhACABKAIAIQMDQCADIgEoAgRBeHEgAkYNAyAAQR12IQMgAEEBdCEAIAEgA0EEcWpBEGoiBSgCACIDDQALIAUgBDYCACAEIAE2AhgLIAQgBDYCDCAEIAQ2AggMAgtB5N8AIAZBKGsiAEF4IANrQQdxQQAgA0EIakEHcRsiBWsiBzYCAEHw3wAgAyAFaiIFNgIAIAUgB0EBcjYCBCAAIANqQSg2AgRB9N8AQcDjACgCADYCACABIAJBJyACa0EHcUEAIAJBJ2tBB3EbakEvayIAIAAgAUEQakkbIgVBGzYCBCAFQaDjACkCADcCECAFQZjjACkCADcCCEGg4wAgBUEIajYCAEGc4wAgBjYCAEGY4wAgAzYCAEGk4wBBADYCACAFQRhqIQADQCAAQQc2AgQgAEEIaiEDIABBBGohACACIANLDQALIAEgBUYNAyAFIAUoAgRBfnE2AgQgASAFIAFrIgZBAXI2AgQgBSAGNgIAIAZB/wFNBEAgBkEDdiICQQN0QYDgAGohAAJ/QdjfACgCACIDQQEgAnQiAnFFBEBB2N8AIAIgA3I2AgAgAAwBCyAAKAIICyECIAAgATYCCCACIAE2AgwgASAANgIMIAEgAjYCCAwEC0EfIQAgAUIANwIQIAZB////B00EQCAGQQh2IgAgAEGA/j9qQRB2QQhxIgB0IgIgAkGA4B9qQRB2QQRxIgJ0IgMgA0GAgA9qQRB2QQJxIgN0QQ92IAAgAnIgA3JrIgBBAXQgBiAAQRVqdkEBcXJBHGohAAsgASAANgIcIABBAnRBiOIAaiECAkBB3N8AKAIAIgNBASAAdCIFcUUEQEHc3wAgAyAFcjYCACACIAE2AgAgASACNgIYDAELIAZBAEEZIABBAXZrIABBH0YbdCEAIAIoAgAhAwNAIAMiAigCBEF4cSAGRg0EIABBHXYhAyAAQQF0IQAgAiADQQRxakEQaiIFKAIAIgMNAAsgBSABNgIAIAEgAjYCGAsgASABNgIMIAEgATYCCAwDCyABKAIIIgAgBDYCDCABIAQ2AgggBEEANgIYIAQgATYCDCAEIAA2AggLIAdBCGohAAwFCyACKAIIIgAgATYCDCACIAE2AgggAUEANgIYIAEgAjYCDCABIAA2AggLQeTfACgCACIAIARNDQBB5N8AIAAgBGsiATYCAEHw3wBB8N8AKAIAIgAgBGoiAjYCACACIAFBAXI2AgQgACAEQQNyNgIEIABBCGohAAwDC0HU3wBBMDYCAEEAIQAMAgsCQCAJRQ0AAkAgBSgCHCICQQJ0QYjiAGoiACgCACAFRgRAIAAgAzYCACADDQFB3N8AIAhBfiACd3EiCDYCAAwCCyAJQRBBFCAJKAIQIAVGG2ogAzYCACADRQ0BCyADIAk2AhggBSgCECIABEAgAyAANgIQIAAgAzYCGAsgBSgCFCIARQ0AIAMgADYCFCAAIAM2AhgLAkAgAUEPTQRAIAUgASAEaiIAQQNyNgIEIAAgBWoiACAAKAIEQQFyNgIEDAELIAUgBEEDcjYCBCAHIAFBAXI2AgQgASAHaiABNgIAIAFB/wFNBEAgAUEDdiIBQQN0QYDgAGohAAJ/QdjfACgCACICQQEgAXQiAXFFBEBB2N8AIAEgAnI2AgAgAAwBCyAAKAIICyEBIAAgBzYCCCABIAc2AgwgByAANgIMIAcgATYCCAwBC0EfIQAgAUH///8HTQRAIAFBCHYiACAAQYD+P2pBEHZBCHEiAHQiAiACQYDgH2pBEHZBBHEiAnQiBCAEQYCAD2pBEHZBAnEiBHRBD3YgACACciAEcmsiAEEBdCABIABBFWp2QQFxckEcaiEACyAHIAA2AhwgB0IANwIQIABBAnRBiOIAaiECAkACQCAIQQEgAHQiBHFFBEBB3N8AIAQgCHI2AgAgAiAHNgIAIAcgAjYCGAwBCyABQQBBGSAAQQF2ayAAQR9GG3QhACACKAIAIQQDQCAEIgIoAgRBeHEgAUYNAiAAQR12IQQgAEEBdCEAIAIgBEEEcWpBEGoiAygCACIEDQALIAMgBzYCACAHIAI2AhgLIAcgBzYCDCAHIAc2AggMAQsgAigCCCIAIAc2AgwgAiAHNgIIIAdBADYCGCAHIAI2AgwgByAANgIICyAFQQhqIQAMAQsCQCAKRQ0AAkAgAygCHCICQQJ0QYjiAGoiACgCACADRgRAIAAgBTYCACAFDQFB3N8AIAlBfiACd3E2AgAMAgsgCkEQQRQgCigCECADRhtqIAU2AgAgBUUNAQsgBSAKNgIYIAMoAhAiAARAIAUgADYCECAAIAU2AhgLIAMoAhQiAEUNACAFIAA2AhQgACAFNgIYCwJAIAFBD00EQCADIAEgBGoiAEEDcjYCBCAAIANqIgAgACgCBEEBcjYCBAwBCyADIARBA3I2AgQgCyABQQFyNgIEIAEgC2ogATYCACAIBEAgCEEDdiIEQQN0QYDgAGohAkHs3wAoAgAhAAJ/QQEgBHQiBCAGcUUEQEHY3wAgBCAGcjYCACACDAELIAIoAggLIQQgAiAANgIIIAQgADYCDCAAIAI2AgwgACAENgIIC0Hs3wAgCzYCAEHg3wAgATYCAAsgA0EIaiEACyAMQRBqJAAgAAvMDAEHfwJAIABFDQAgAEEIayICIABBBGsoAgAiAUF4cSIAaiEFAkAgAUEBcQ0AIAFBA3FFDQEgAiACKAIAIgFrIgJB6N8AKAIASQ0BIAAgAWohACACQezfACgCAEcEQCABQf8BTQRAIAIoAggiBCABQQN2IgdBA3RBgOAAakYaIAQgAigCDCIBRgRAQdjfAEHY3wAoAgBBfiAHd3E2AgAMAwsgBCABNgIMIAEgBDYCCAwCCyACKAIYIQYCQCACIAIoAgwiA0cEQCACKAIIIgEgAzYCDCADIAE2AggMAQsCQCACQRRqIgEoAgAiBA0AIAJBEGoiASgCACIEDQBBACEDDAELA0AgASEHIAQiA0EUaiIBKAIAIgQNACADQRBqIQEgAygCECIEDQALIAdBADYCAAsgBkUNAQJAIAIgAigCHCIEQQJ0QYjiAGoiASgCAEYEQCABIAM2AgAgAw0BQdzfAEHc3wAoAgBBfiAEd3E2AgAMAwsgBkEQQRQgBigCECACRhtqIAM2AgAgA0UNAgsgAyAGNgIYIAIoAhAiAQRAIAMgATYCECABIAM2AhgLIAIoAhQiAUUNASADIAE2AhQgASADNgIYDAELIAUoAgQiAUEDcUEDRw0AQeDfACAANgIAIAUgAUF+cTYCBCACIABBAXI2AgQgACACaiAANgIADwsgAiAFTw0AIAUoAgQiAUEBcUUNAAJAIAFBAnFFBEAgBUHw3wAoAgBGBEBB8N8AIAI2AgBB5N8AQeTfACgCACAAaiIANgIAIAIgAEEBcjYCBCACQezfACgCAEcNA0Hg3wBBADYCAEHs3wBBADYCAA8LIAVB7N8AKAIARgRAQezfACACNgIAQeDfAEHg3wAoAgAgAGoiADYCACACIABBAXI2AgQgACACaiAANgIADwsgAUF4cSAAaiEAAkAgAUH/AU0EQCAFKAIIIgQgAUEDdiIHQQN0QYDgAGpGGiAEIAUoAgwiAUYEQEHY3wBB2N8AKAIAQX4gB3dxNgIADAILIAQgATYCDCABIAQ2AggMAQsgBSgCGCEGAkAgBSAFKAIMIgNHBEAgBSgCCCIBQejfACgCAEkaIAEgAzYCDCADIAE2AggMAQsCQCAFQRRqIgEoAgAiBA0AIAVBEGoiASgCACIEDQBBACEDDAELA0AgASEHIAQiA0EUaiIBKAIAIgQNACADQRBqIQEgAygCECIEDQALIAdBADYCAAsgBkUNAAJAIAUgBSgCHCIEQQJ0QYjiAGoiASgCAEYEQCABIAM2AgAgAw0BQdzfAEHc3wAoAgBBfiAEd3E2AgAMAgsgBkEQQRQgBigCECAFRhtqIAM2AgAgA0UNAQsgAyAGNgIYIAUoAhAiAQRAIAMgATYCECABIAM2AhgLIAUoAhQiAUUNACADIAE2AhQgASADNgIYCyACIABBAXI2AgQgACACaiAANgIAIAJB7N8AKAIARw0BQeDfACAANgIADwsgBSABQX5xNgIEIAIgAEEBcjYCBCAAIAJqIAA2AgALIABB/wFNBEAgAEEDdiIBQQN0QYDgAGohAAJ/QdjfACgCACIEQQEgAXQiAXFFBEBB2N8AIAEgBHI2AgAgAAwBCyAAKAIICyEBIAAgAjYCCCABIAI2AgwgAiAANgIMIAIgATYCCA8LQR8hASACQgA3AhAgAEH///8HTQRAIABBCHYiASABQYD+P2pBEHZBCHEiAXQiBCAEQYDgH2pBEHZBBHEiBHQiAyADQYCAD2pBEHZBAnEiA3RBD3YgASAEciADcmsiAUEBdCAAIAFBFWp2QQFxckEcaiEBCyACIAE2AhwgAUECdEGI4gBqIQQCQAJAAkBB3N8AKAIAIgNBASABdCIFcUUEQEHc3wAgAyAFcjYCACAEIAI2AgAgAiAENgIYDAELIABBAEEZIAFBAXZrIAFBH0YbdCEBIAQoAgAhAwNAIAMiBCgCBEF4cSAARg0CIAFBHXYhAyABQQF0IQEgBCADQQRxakEQaiIFKAIAIgMNAAsgBSACNgIAIAIgBDYCGAsgAiACNgIMIAIgAjYCCAwBCyAEKAIIIgAgAjYCDCAEIAI2AgggAkEANgIYIAIgBDYCDCACIAA2AggLQfjfAEH43wAoAgBBAWsiAkF/IAIbNgIACwtVAQJ/QdDfACgCACIBIABBA2pBfHEiAmohAAJAIAJBAU5BACAAIAFNGw0APwBBEHQgAEkEQCAAEABFDQELQdDfACAANgIAIAEPC0HU3wBBMDYCAEF/C4IEAQN/IAJBgARPBEAgACABIAIQARogAA8LIAAgAmohAwJAIAAgAXNBA3FFBEACQCACQQFIBEAgACECDAELIABBA3FFBEAgACECDAELIAAhAgNAIAIgAS0AADoAACABQQFqIQEgAkEBaiICIANPDQEgAkEDcQ0ACwsCQCADQXxxIgRBwABJDQAgAiAEQUBqIgVLDQADQCACIAEoAgA2AgAgAiABKAIENgIEIAIgASgCCDYCCCACIAEoAgw2AgwgAiABKAIQNgIQIAIgASgCFDYCFCACIAEoAhg2AhggAiABKAIcNgIcIAIgASgCIDYCICACIAEoAiQ2AiQgAiABKAIoNgIoIAIgASgCLDYCLCACIAEoAjA2AjAgAiABKAI0NgI0IAIgASgCODYCOCACIAEoAjw2AjwgAUFAayEBIAJBQGsiAiAFTQ0ACwsgAiAETw0BA0AgAiABKAIANgIAIAFBBGohASACQQRqIgIgBEkNAAsMAQsgA0EESQRAIAAhAgwBCyAAIANBBGsiBEsEQCAAIQIMAQsgACECA0AgAiABLQAAOgAAIAIgAS0AAToAASACIAEtAAI6AAIgAiABLQADOgADIAFBBGohASACQQRqIgIgBE0NAAsLIAIgA0kEQANAIAIgAS0AADoAACABQQFqIQEgAkEBaiICIANHDQALCyAAC9YCAQJ/AkAgAUUNACAAIAFqIgJBAWtBADoAACAAQQA6AAAgAUEDSQ0AIAJBAmtBADoAACAAQQA6AAEgAkEDa0EAOgAAIABBADoAAiABQQdJDQAgAkEEa0EAOgAAIABBADoAAyABQQlJDQAgAEEAIABrQQNxIgNqIgJBADYCACACIAEgA2tBfHEiA2oiAUEEa0EANgIAIANBCUkNACACQQA2AgggAkEANgIEIAFBCGtBADYCACABQQxrQQA2AgAgA0EZSQ0AIAJBADYCGCACQQA2AhQgAkEANgIQIAJBADYCDCABQRBrQQA2AgAgAUEUa0EANgIAIAFBGGtBADYCACABQRxrQQA2AgAgAyACQQRxQRhyIgNrIgFBIEkNACACIANqIQIDQCACQgA3AxggAkIANwMQIAJCADcDCCACQgA3AwAgAkEgaiECIAFBIGsiAUEfSw0ACwsLBAAjAAsGACAAJAALEAAjACAAa0FwcSIAJAAgAAsLvVYIAEGECAvxQJYwB3csYQ7uulEJmRnEbQeP9GpwNaVj6aOVZJ4yiNsOpLjceR7p1eCI2dKXK0y2Cb18sX4HLbjnkR2/kGQQtx3yILBqSHG5895BvoR91Noa6+TdbVG11PTHhdODVphsE8Coa2R6+WL97Mllik9cARTZbAZjYz0P+vUNCI3IIG47XhBpTORBYNVycWei0eQDPEfUBEv9hQ3Sa7UKpfqotTVsmLJC1sm720D5vKzjbNgydVzfRc8N1txZPdGrrDDZJjoA3lGAUdfIFmHQv7X0tCEjxLNWmZW6zw+lvbieuAIoCIgFX7LZDMYk6Quxh3xvLxFMaFirHWHBPS1mtpBB3HYGcdsBvCDSmCoQ1e+JhbFxH7W2BqXkv58z1LjooskHeDT5AA+OqAmWGJgO4bsNan8tPW0Il2xkkQFcY+b0UWtrYmFsHNgwZYVOAGLy7ZUGbHulARvB9AiCV8QP9cbZsGVQ6bcS6ri+i3yIufzfHd1iSS3aFfN804xlTNT7WGGyTc5RtTp0ALyj4jC71EGl30rXldg9bcTRpPv01tNq6WlD/NluNEaIZ63QuGDacy0EROUdAzNfTAqqyXwN3TxxBVCqQQInEBALvoYgDMkltWhXs4VvIAnUZrmf5GHODvneXpjJ2SkimNCwtKjXxxc9s1mBDbQuO1y9t61susAgg7jttrO/mgzitgOa0rF0OUfV6q930p0VJtsEgxbccxILY+OEO2SUPmptDahaanoLzw7knf8JkyeuAAqxngd9RJMP8NKjCIdo8gEe/sIGaV1XYvfLZ2WAcTZsGecGa252G9T+4CvTiVp62hDMSt1nb9+5+fnvvo5DvrcX1Y6wYOij1tZ+k9GhxMLYOFLy30/xZ7vRZ1e8pt0GtT9LNrJI2isN2EwbCq/2SgM2YHoEQcPvYN9V32eo745uMXm+aUaMs2HLGoNmvKDSbyU24mhSlXcMzANHC7u5FgIiLyYFVb47usUoC72yklq0KwRqs1yn/9fCMc/QtYue2Swdrt5bsMJkmybyY+yco2p1CpNtAqkGCZw/Ng7rhWcHchNXAAWCSr+VFHq44q4rsXs4G7YMm47Skg2+1eW379x8Id/bC9TS04ZC4tTx+LPdaG6D2h/NFr6BWya59uF3sG93R7cY5loIiHBqD//KOwZmXAsBEf+eZY9prmL40/9rYUXPbBZ44gqg7tIN11SDBE7CswM5YSZnp/cWYNBNR2lJ23duPkpq0a7cWtbZZgvfQPA72DdTrrypxZ673n/Pskfp/7UwHPK9vYrCusowk7NTpqO0JAU20LqTBtfNKVfeVL9n2SMuemazuEphxAIbaF2UK28qN74LtKGODMMb3wVaje8CLQAAAABBMRsZgmI2MsNTLSsExWxkRfR3fYanWlbHlkFPCIrZyEm7wtGK6O/6y9n04wxPtaxNfq61ji2Dns8cmIdREsJKECPZU9Nw9HiSQe9hVdeuLhTmtTfXtZgcloSDBVmYG4IYqQCb2/otsJrLNqldXXfmHGxs/98/QdSeDlrNoiSEleMVn4wgRrKnYXepvqbh6PHn0PPoJIPew2Wyxdqqrl1d659GRCjMa29p/XB2rmsxOe9aKiAsCQcLbTgcEvM2Rt+yB13GcVRw7TBla/T38yq7tsIxonWRHIk0oAeQ+7yfF7qNhA553qklOO+yPP9583O+SOhqfRvFQTwq3lgFT3nwRH5i6YctT8LGHFTbAYoVlEC7Do2D6COmwtk4vw3FoDhM9Lshj6eWCs6WjRMJAMxcSDHXRYti+m7KU+F3VF27uhVsoKPWP42Ilw6WkVCY194RqczH0vrh7JPL+vVc12JyHeZ5a961VECfhE9ZWBIOFhkjFQ/acDgkm0EjPadr/WXmWuZ8JQnLV2Q40E6jrpEB4p+KGCHMpzNg/bwqr+Ekre7QP7QtgxKfbLIJhqskSMnqFVPQKUZ++2h3ZeL2eT8vt0gkNnQbCR01KhIE8rxTS7ONSFJw3mV5Me9+YP7z5ue/wv3+fJHQ1T2gy8z6NoqDuweRmnhUvLE5ZaeoS5iDOwqpmCLJ+rUJiMuuEE9d718ObPRGzT/ZbYwOwnRDElrzAiNB6sFwbMGAQXfYR9c2lwbmLY7FtQClhIQbvBqKQXFbu1pomOh3Q9nZbFoeTy0VX342DJwtGyfdHAA+EgCYuVMxg6CQYq6L0VO1khbF9N1X9O/ElKfC79WW2fbpvAeuqI0ct2veMZwq7yqF7XlryqxIcNNvG134LipG4eE23magB8V/Y1ToVCJl803l87ICpMKpG2eRhDAmoJ8puK7F5Pmf3v06zPPWe/3oz7xrqYD9WrKZPgmfsn84hKuwJBws8RUHNTJGKh5zdzEHtOFwSPXQa1E2g0Z6d7JdY07X+ssP5uHSzLXM+Y2E1+BKEpavCyONtshwoJ2JQbuERl0jAwdsOBrEPxUxhQ4OKEKYT2cDqVR+wPp5VYHLYkwfxTiBXvQjmJ2nDrPclhWqGwBU5VoxT/yZYmLX2FN5zhdP4UlWfvpQlS3Xe9QczGITio0tUruWNJHoux/Q2aAG7PN+Xq3CZUdukUhsL6BTdeg2EjqpBwkjalQkCCtlPxHkeaeWpUi8j2YbkaQnKoq94LzL8qGN0Oti3v3AI+/m2b3hvBT80KcNP4OKJn6ykT+5JNBw+BXLaTtG5kJ6d/1btWtl3PRafsU3CVPudjhI97GuCbjwnxKhM8w/inL9JJMAAAAAN2rCAW7UhANZvkYC3KgJB+vCywayfI0EhRZPBbhREw6PO9EP1oWXDeHvVQxk+RoJU5PYCAotngo9R1wLcKMmHEfJ5B0ed6IfKR1gHqwLLxubYe0awt+rGPW1aRnI8jUS/5j3E6YmsRGRTHMQFFo8FSMw/hR6jrgWTeR6F+BGTTjXLI85jpLJO7n4Czo87kQ/C4SGPlI6wDxlUAI9WBdeNm99nDc2w9o1AakYNIS/VzGz1ZUw6mvTMt0BETOQ5Wskp4+pJf4x7yfJWy0mTE1iI3snoCIimeYgFfMkISi0eCof3rorRmD8KXEKPij0HHEtw3azLJrI9S6tojcvwI2acPfnWHGuWR5zmTPcchwlk3crT1F2cvEXdEWb1XV43Il+T7ZLfxYIDX0hYs98pHSAeZMeQnjKoAR6/crGe7AuvGyHRH5t3vo4b+mQ+m5shrVrW+x3agJSMWg1OPNpCH+vYj8VbWNmqythUcHpYNTXpmXjvWRkugMiZo1p4Gcgy9dIF6EVSU4fU0t5dZFK/GPeT8sJHE6St1pMpd2YTZiaxEav8AZH9k5ARcEkgkREMs1Bc1gPQCrmSUIdjItDUGjxVGcCM1U+vHVXCda3VozA+FO7qjpS4hR8UNV+vlHoOeJa31MgW4btZlmxh6RYNJHrXQP7KVxaRW9ebS+tX4AbNeG3cffg7s+x4tmlc+Ncszzma9n+5zJnuOUFDXrkOEom7w8g5O5WnqLsYfRg7eTiL+jTiO3pijar671caerwuBP9x9LR/J5sl/6pBlX/LBAa+ht62PtCxJ75da5c+EjpAPN/g8LyJj2E8BFXRvGUQQn0oyvL9fqVjffN/0/2YF142Vc3utgOifzaOeM+27z1cd6Ln7Pf0iH13eVLN9zYDGvX72ap1rbY79SBsi3VBKRi0DPOoNFqcObTXRok0hD+XsUnlJzEfiraxklAGMfMVlfC+zyVw6KC08GV6BHAqK9Ny5/Fj8rGe8nI8RELyXQHRMxDbYbNGtPAzy25As5Alq+Rd/xtkC5CK5IZKOmTnD6mlqtUZJfy6iKVxYDglPjHvJ/PrX6elhM4nKF5+p0kb7WYEwV3mUq7MZt90fOaMDWJjQdfS4xe4Q2OaYvPj+ydgIrb90KLgkkEibUjxoiIZJqDvw5YguawHoDR2tyBVMyThGOmUYU6GBeHDXLVhqDQ4qmXuiCozgRmqvlupKt8eOuuSxIprxKsb60lxq2sGIHxpy/rM6Z2VXWkQT+3pcQp+KDzQzqhqv18o52XvqLQc8S15xkGtL6nQLaJzYK3DNvNsjuxD7NiD0mxVWWLsGgi17tfSBW6BvZTuDGckbm0it68g+AcvdpeWr/tNJi+AAAAAGVnvLiLyAmq7q+1EleXYo8y8N433F9rJbk4153vKLTFik8IfWTgvW8BhwHXuL/WSt3YavIzd9/gVhBjWJ9XGVD6MKXoFJ8Q+nH4rELIwHvfrafHZ0MIcnUmb87NcH+tlRUYES37t6Q/ntAYhyfozxpCj3OirCDGsMlHegg+rzKgW8iOGLVnOwrQAIeyaThQLwxf7Jfi8FmFh5flPdGHhmW04DrdWk+Pzz8oM3eGEOTq43dYUg3Y7UBov1H4ofgr8MSfl0gqMCJaT1ee4vZvSX+TCPXHfadA1RjA/G1O0J81K7cjjcUYlp+gfyonGUf9unwgQQKSj/QQ9+hIqD1YFJtYP6gjtpAdMdP3oYlqz3YUD6jKrOEHf76EYMMG0nCgXrcXHOZZuKn0PN8VTIXnwtHggH5pDi/Le2tId8OiDw3Lx2ixcynHBGFMoLjZ9ZhvRJD/0/x+UGbuGzfaVk0nuQ4oQAW2xu+wpKOIDBwasNuBf9dnOZF40iv0H26TA/cmO2aQmoOIPy+R7ViTKVRgRLQxB/gM36hNHrrP8abs35L+ibguRmcXm1QCcCfsu0jwcd4vTMkwgPnbVedFY5ygP2v5x4PTF2g2wXIPinnLN13krlDhXED/VE4lmOj2c4iLrhbvNxb4QIIEnSc+vCQf6SFBeFWZr9fgi8qwXDM7tlntXtHlVbB+UEfVGez/bCE7YglGh9rn6TLIgo6OcNSe7Six+VGQX1bkgjoxWDqDCY+n5m4zHwjBhg1tpjq1pOFAvcGG/AUvKUkXSk71r/N2IjKWEZ6KeL4rmB3ZlyBLyfR4Lq5IwMAB/dKlZkFqHF6W93k5Kk+Xlp9d8vEj5QUZa01gftf1jtFi5+u23l9SjgnCN+m1etlGAGi8IbzQ6jHfiI9WYzBh+dYiBJ5qmr2mvQfYwQG/Nm60rVMJCBWaTnId/ynOpRGGe7d04ccPzdkQkqi+rCpGERk4I3algHVmxtgQAXpg/q7PcpvJc8oi8aRXR5YY76k5rf3MXhFFBu5NdmOJ8c6NJkTc6EH4ZFF5L/k0HpNB2rEmU7/WmuvpxvmzjKFFC2IO8BkHaUyhvlGbPNs2J4Q1mZKWUP4uLpm5VCb83uieEnFdjHcW4TTOLjapq0mKEUXmPwMggYO7dpHg4xP2XFv9WelJmD5V8SEGgmxEYT7Uqs6Lxs+pN344QX/WXSbDbrOJdnzW7srEb9YdWQqxoeHkHhTzgXmoS9dpyxOyDnerXKHCuTnGfgGA/qmc5ZkVJAs2oDZuURyOpxZmhsJx2j4s3m8sSbnTlPCBBAmV5rixe0kNox4usRtIPtJDLVlu+8P22+mmkWdRH6mwzHrODHSUYblm8QYF3gAAAAB3BzCW7g5hLJkJUboHbcQZcGr0j+ljpTWeZJWjDtuIMnncuKTg1ekel9LZiAm2TCt+sXy957gtB5C/HZEdtxBkarAg8vO5cUiEvkHeGtrUfW3d5Ov01LVRg9OFxxNsmFZka6jA/WL5eoplyewUAVxPYwZs2foPPWONCA31O24gyExpEF7VYEHkomdxcjwD5NFLBNRH0g2F/aUKtWs1taj6QrKYbNu7ydasvPlAMths40XfXHXc1g3Pq9E9WSbZMKxR3gA6yNdRgL/QYRYhtPS1VrPEI8+6lZm4vaUPKAK4nl8FiAjGDNmysQvpJC9vfIdYaEwRwWEdq7ZmLT123EGQAdtxBpjSILzv1RAqcbGFiQa2tR+fv+Sl6LjUM3gHyaIPAPk0lgmojuEOmBh/ag27CG09LZFkbJfmY1wBa2tR9BxsYWKFZTDY8mIATmwGle0bAaV7ggj0wfUPxFdlsNnGErfpUIu+uOr8uYh8Yt0d3xXaLUmM03zz+9RMZU2yYVg6tVHOo7wAdNS7MOJK36VBPdiV16TRxG3T1vT7Q2npajRu2fytZ4hG2mC40EQELXMzAx3lqgpMX90NfMlQBXE8JwJBqr4LEBDJDCCGV2i1JSBvhbO5ZtQJzmHkn17e+Q4p2cmYsNCYIsfXqLRZsz0XLrQNgbe9XDvAumyt7biDIJq/s7YDtuIMdLHSmurVRzmd0nevBNsmFXPcFoPjYwsSlGQ7hA1taj56alqo5A7PC5MJ/50KAK4nfQeesfAPk0SHCKPSHgHyaGkGwv73YlddgGVnyxlsNnFuawbn/tQbdonTK+AQ2npaZ91KzPm532+Ovu/5F7e+Q2CwjtXW1qPoodGTfjjYwsRP3/JS0btn8aa8V2c/tQbdSLI2S9gNK9qvChtMNgNK9kEEemDfYO/DqGffVTFuju9Gab55y2GzjLxmgxolb9KgUmjiNswMd5W7C0cDIgIWuVUFJi/Fuju+sr0LKCu0WpJcs2oEwtf/p7XQzzEs2Z6LW96uHZtkwrDsY/ImdWqjnAJtkwqcCQap6w42P3IHZ4UFAFcTlb9KguK4ehR7sSuuDLYbOJLSjpvl1b4NfNzvtwvb3yGG09LU8dTiQmjds/gf2oNugb4Wzfa5JltvsHfhGLdHd4gIWub/D2pwZgY7yhEBC1yPZZ7/+GKuaWFr/9MWbM9FoArieNcN0u5OBINUOQOzwqdnJmHQYBb3SWlHTT5ud9uu0WpK2dZa3EDfC2Y32DvwqbyuU967nsVHss9/MLX/6b298hzKusKKU7OTMCS0o6a60DYFzdcGk1TeVykj2We/s2Z6LsRhSrhdaBsCKm8rlLQLvjfDDI6hWgXfGy0C740AAAAAGRsxQTI2YoIrLVPDZGzFBH139EVWWqeGT0GWx8jZigjRwrtJ+u/oiuP02custU8Mta5+TZ6DLY6HmBzPSsISUVPZIxB49HDTYe9Bki6u11U3teYUHJi11wWDhJaCG5hZmwCpGLAt+tupNsua5nddXf9sbBzUQT/fzVoOnpWEJKKMnxXjp7JGIL6pd2Hx6OGm6PPQ58PegyTaxbJlXV2uqkRGn+tva8wodnD9aTkxa64gKlrvCwcJLBIcOG3fRjbzxl0Hsu1wVHH0a2Uwuyrz96IxwraJHJF1kAegNBefvPsOhI26JaneeTyy7zhz83n/auhIvkHFG31Y3io88HlPBelifkTCTy2H21QcxpQVigGNDrtApiPog7842cI4oMUNIbv0TAqWp48TjZbOXMwACUXXMUhu+mKLd+FTyrq7XVSjoGwViI0/1pGWDpfe15hQx8ypEezh+tL1+suTcmLXXGt55h1AVLXeWU+EnxYOElgPFSMZJDhw2j0jQZtl/WunfOZa5lfLCSVO0DhkAZGuoxiKn+Izp8whKrz9YK0k4a+0P9DunxKDLYYJsmzJSCSr0FMV6vt+RiniZXdoLz959jYkSLcdCRt0BBIqNUtTvPJSSI2zeWXecGB+7zHn5vP+/v3Cv9XQkXzMy6A9g4o2+pqRB7uxvFR4qKdlOTuDmEsimKkKCbX6yRCuy4hf711PRvRsDm3ZP810wg6M81oSQ+pBIwLBbHDB2HdBgJc210eOLeYGpQC1xbwbhIRxQYoaaFq7W0N36JhabNnZFS1PHgw2fl8nGy2cPgAc3bmYABKggzFTi65ikJK1U9Hd9MUWxO/0V+/Cp5T22ZbVrge86bccjaicMd5rhSrvKspree3TcEis+F0bb+FGKi5m3jbhf8UHoFToVGNN82UiArLz5RupwqQwhJFnKZ+gJuTFrrj93p/51vPMOs/o/XuAqWu8mbJa/bKfCT6rhDh/LBwksDUHFfEeKkYyBzF3c0hw4bRRa9D1ekaDNmNdsnfL+tdO0uHmD/nMtczg14SNr5YSSraNIwudoHDIhLtBiQMjXUYaOGwHMRU/xCgODoVnT5hCflSpA1V5+sBMYsuBgTjFH5gj9F6zDqedqhWW3OVUABv8TzFa12Jimc55U9hJ4U8XUPp+VnvXLZVizBzULY2KEzSWu1Ifu+iRBqDZ0F5+8+xHZcKtbEiRbnVToC86EjboIwkHqQgkVGoRP2Urlqd55I+8SKWkkRtmvYoqJ/LLvODr0I2hwP3eYtnm7yMUvOG9DafQ/CaKgz8/kbJ+cNAkuWnLFfhC5kY7W/13etxla7XFflr07lMJN/dIOHa4Ca6xoRKf8Io/zDOTJP1yAAAAAAHCajcDhNRuAka+WQcJqNwGy8LrBI18sgVPFoUOE1G4D9E7jw2XhdYMVe/hCRr5ZAjYk1MKni0KC1xHPRwmo3Ad5MlHH6J3Hh5gHSkbLwusGu1hmxir38IZabX1EjXyyBP3mP8RsSamEHNMkRU8WhQU/jAjFriOehd65E04TUbgOY8s1zvJko46C/i5P0TuPD6GhAs8wDpSPQJQZTZeF1g3nH1vNdrDNjQYqQExV7+EMJXVszLTa+ozEQHdJGvlkCWpj6cn7zH+Ji1bySNiTUwioCd7IOaZIiEk8xUqeLQoK7reHyn8YEYoPgpxLXEc9CyzdsMu9ciaLzeirXCajcBxWOf3cx5ZrnLcM5l3kyUcdlFPK3QX8XJ11ZtFfonceH9Ltk99DQgWfM9iIXmAdKR4Qh6TegSgynvGyv1svC6wbX5Eh284+t5u+pDpa7WGbGp37FtoMVICafM4NWKvfwhjbRU/YSurZmDpwVFlptfUZGS942YiA7pn4GmNSNfLIEkVoRdLUx9OSpF1eU/eY/xOHAnLTFq3kk2Y3aVGxJqYRwbwr0VATvZEgiTBQc0yREAPWHNCSeYqQ4uMHVTxaFBVMwJnV3W8Pla31glT+MCMUjqqu1B8FOJRvn7VWuI56FsgU99ZZu2GWKSHsV3rkTRcKfsDXm9FWl+tL23hNRuA4Pdxt+Kxz+7jc6XZ5jyzXOf+2WvluGcy5HoNBe8mSjju5CAP7KKeVu1g9GHoL+Lk6e2I0+urNorqaVy9/RO48PzR0sf+l2ye/1UGqfoaECz72Hob+Z7EQvhcrnXzAOlI8sKDf/CEPSbxRlcR9AlBlPXLK6P3jZX69k//zdl4XWDYujdX2vyJDts+4znecfW837Ofi931IdLcN0vl12sM2NapZu/U79i21S2ygdBipATRoM4z0+ZwatIkGl3FXv4QxJyUJ8baKn7HGEBJwldWzMOVPPvB04KiwBHolctNr6jKj8WfyMl7xskLEfHMRAd0zYZtQ8/A0xrOArktka+WQJBt/HeSK0Iuk+koGZamPpyXZFSrlSLq8pTggMWfvMf4nn6tz5w4E5ad+nmhmLVvJJl3BRObMbtKmvPRfY2JNTCMS18Hjg3hXo/Pi2mKgJ3si0L324kESYKIxiO1g5pkiIJYDr+AHrDmgdza0YSTzFSFUaZjhxcYOobVcg2p4tCgqCC6l6pmBM6rpG75rut4fK8pEkutb6wSrK3GJafxgRimM+svpHVVdqW3P0Gg+CnEoTpD86N8/aqivpedtcRz0LQGGee2QKe+t4LNibLN2wyzD7E7sUkPYrCLZVW71yJouhVIX7hT9ga5kZwxvN6KtL0c4IO/Wl7avpg07QAAAAC4vGdlqgnIixK1r+6PYpdXN97wMiVrX9yd1zi5xbQo730IT4pvveBk1wGHAUrWv7jyatjd4N93M1hjEFZQGVef6KUw+voQnxRCrPhx33vAyGfHp611cghDzc5vJpWtf3AtERgVP6S3+4cY0J4az+gnonOPQrDGIKwIekfJoDKvPhiOyFsKO2e1socA0C9QOGmX7F8MhVnw4j3ll4dlhofR3TrgtM+PT1p3Myg/6uQQhlJYd+NA7dgN+FG/aPAr+KFIl5/EWiIwKuKeV09/SW/2x/UIk9VAp31t/MAYNZ/QTo0jtyuflhjFJyp/oLr9RxkCQSB8EPSPkqhI6PebFFg9I6g/WDEdkLaJoffTFHbPaqzKqA++fwfhBsNghF6gcNLmHBe39Km4WUwV3zzRwueFaX6A4HvLLw7Dd0hryw0PonOxaMdhBMcp2bigTERvmPX80/+Q7mZQflbaNxsOuSdNtgVAKKSw78YcDIijgduwGjln138r0niRk24f9Dsm9wODmpBmkS8/iCmTWO20RGBUDPgHMR5NqN+m8c+6/pLf7EYuuIlUmxdn7CdwAnHwSLvJTC/e2/mAMGNF51VrP6Cc04PH+cE2aBd5ig9y5F03y1zhUK5OVP9A9uiYJa6LiHMWN+8WBIJA+Lw+J50h6R8kmVV4QYvg168zXLDK7Vm2O1Xl0V5HUH6w/+wZ1WI7IWzah0YJyDLp53COjoIo7Z7UkFH5sYLkVl86WDE6p48Jgx8zbuYNhsEItTqmbb1A4aQF/IbBF0kpL6/1TkoyInbzip4Rlpgrvnggl9kdePTJS8BIri7S/QHAakFmpfeWXhxPKjl5XZ+Wl+Uj8fJNaxkF9dd+YOdi0Y5f3rbrwgmOUnq16TdoAEbZ0LwhvIjfMeowY1aPItb5YZpqngQHvaa9vwHB2K20bjYVCAlTHXJOmqXOKf+3e4YRD8fhdJIQ2c0qrL6oOBkRRoCldiPYxmZ1YHoBEHLPrv7Kc8mbV6TxIu8Ylkf9rTmpRRFezHZN7gbO8Ylj3EQmjWT4Qej5L3lRQZMeNFMmsdrrmta/s/nG6QtFoYwZ8A5ioUxpBzybUb6EJzbblpKZNS4u/lAmVLmZnuje/IxdcRI04RZ3qTYuzhGKSasDP+ZFu4OBIOPgkXZbXPYTSelZ/fFVPphsggYh1D5hRMaLzqp+N6nP1n9BOG7DJl18domzxMru1lkd1m/hobEK8xQe5EuoeYETy2nXq3cOsrnCoVwBfsY5nKn+gCQVmeU2oDYLjhxRboZmFqc+2nHCLG/eLJTTuUkJBIHwsbjmlaMNSXsbsS4eQ9I+SPtuWS3p2/bDUWeRpsywqR90DM56ZrlhlN4FBvEAAAAAAAAAAAMAAAAEAAQACAAEAAQAAAAEAAUAEAAIAAQAAAAEAAYAIAAgAAQAAAAEAAQAEAAQAAUAAAAIABAAIAAgAAUAAAAIABAAgACAAAUAAAAIACAAgAAAAQUAAAAgAIAAAgEABAUAAAAgAAIBAgEAEAUAQYHJAAu2EAECAwQEBQUGBgYGBwcHBwgICAgICAgICQkJCQkJCQkKCgoKCgoKCgoKCgoKCgoKCwsLCwsLCwsLCwsLCwsLCwwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDwAAEBESEhMTFBQUFBUVFRUWFhYWFhYWFhcXFxcXFxcXGBgYGBgYGBgYGBgYGBgYGBkZGRkZGRkZGRkZGRkZGRkaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHB0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0AAQIDBAUGBwgICQkKCgsLDAwMDA0NDQ0ODg4ODw8PDxAQEBAQEBAQERERERERERESEhISEhISEhMTExMTExMTFBQUFBQUFBQUFBQUFBQUFBUVFRUVFRUVFRUVFRUVFRUWFhYWFhYWFhYWFhYWFhYWFxcXFxcXFxcXFxcXFxcXFxgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxscwCcAAMAsAAABAQAAHgEAAA8AAABALAAAQC0AAAAAAAAeAAAADwAAAAAAAADALQAAAAAAABMAAAAHAAAAAAAAAAwACACMAAgATAAIAMwACAAsAAgArAAIAGwACADsAAgAHAAIAJwACABcAAgA3AAIADwACAC8AAgAfAAIAPwACAACAAgAggAIAEIACADCAAgAIgAIAKIACABiAAgA4gAIABIACACSAAgAUgAIANIACAAyAAgAsgAIAHIACADyAAgACgAIAIoACABKAAgAygAIACoACACqAAgAagAIAOoACAAaAAgAmgAIAFoACADaAAgAOgAIALoACAB6AAgA+gAIAAYACACGAAgARgAIAMYACAAmAAgApgAIAGYACADmAAgAFgAIAJYACABWAAgA1gAIADYACAC2AAgAdgAIAPYACAAOAAgAjgAIAE4ACADOAAgALgAIAK4ACABuAAgA7gAIAB4ACACeAAgAXgAIAN4ACAA+AAgAvgAIAH4ACAD+AAgAAQAIAIEACABBAAgAwQAIACEACAChAAgAYQAIAOEACAARAAgAkQAIAFEACADRAAgAMQAIALEACABxAAgA8QAIAAkACACJAAgASQAIAMkACAApAAgAqQAIAGkACADpAAgAGQAIAJkACABZAAgA2QAIADkACAC5AAgAeQAIAPkACAAFAAgAhQAIAEUACADFAAgAJQAIAKUACABlAAgA5QAIABUACACVAAgAVQAIANUACAA1AAgAtQAIAHUACAD1AAgADQAIAI0ACABNAAgAzQAIAC0ACACtAAgAbQAIAO0ACAAdAAgAnQAIAF0ACADdAAgAPQAIAL0ACAB9AAgA/QAIABMACQATAQkAkwAJAJMBCQBTAAkAUwEJANMACQDTAQkAMwAJADMBCQCzAAkAswEJAHMACQBzAQkA8wAJAPMBCQALAAkACwEJAIsACQCLAQkASwAJAEsBCQDLAAkAywEJACsACQArAQkAqwAJAKsBCQBrAAkAawEJAOsACQDrAQkAGwAJABsBCQCbAAkAmwEJAFsACQBbAQkA2wAJANsBCQA7AAkAOwEJALsACQC7AQkAewAJAHsBCQD7AAkA+wEJAAcACQAHAQkAhwAJAIcBCQBHAAkARwEJAMcACQDHAQkAJwAJACcBCQCnAAkApwEJAGcACQBnAQkA5wAJAOcBCQAXAAkAFwEJAJcACQCXAQkAVwAJAFcBCQDXAAkA1wEJADcACQA3AQkAtwAJALcBCQB3AAkAdwEJAPcACQD3AQkADwAJAA8BCQCPAAkAjwEJAE8ACQBPAQkAzwAJAM8BCQAvAAkALwEJAK8ACQCvAQkAbwAJAG8BCQDvAAkA7wEJAB8ACQAfAQkAnwAJAJ8BCQBfAAkAXwEJAN8ACQDfAQkAPwAJAD8BCQC/AAkAvwEJAH8ACQB/AQkA/wAJAP8BCQAAAAcAQAAHACAABwBgAAcAEAAHAFAABwAwAAcAcAAHAAgABwBIAAcAKAAHAGgABwAYAAcAWAAHADgABwB4AAcABAAHAEQABwAkAAcAZAAHABQABwBUAAcANAAHAHQABwADAAgAgwAIAEMACADDAAgAIwAIAKMACABjAAgA4wAIAAAABQAQAAUACAAFABgABQAEAAUAFAAFAAwABQAcAAUAAgAFABIABQAKAAUAGgAFAAYABQAWAAUADgAFAB4ABQABAAUAEQAFAAkABQAZAAUABQAFABUABQANAAUAHQAFAAMABQATAAUACwAFABsABQAHAAUAFwAFAEHg2QALTQEAAAABAAAAAQAAAAEAAAACAAAAAgAAAAIAAAACAAAAAwAAAAMAAAADAAAAAwAAAAQAAAAEAAAABAAAAAQAAAAFAAAABQAAAAUAAAAFAEHQ2gALZQEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAUAAAAGAAAABgAAAAcAAAAHAAAACAAAAAgAAAAJAAAACQAAAAoAAAAKAAAACwAAAAsAAAAMAAAADAAAAA0AAAANAEGA3AALIwIAAAADAAAABwAAAAAAAAAQERIACAcJBgoFCwQMAw0CDgEPAEG03AALaQEAAAACAAAAAwAAAAQAAAAFAAAABgAAAAcAAAAIAAAACgAAAAwAAAAOAAAAEAAAABQAAAAYAAAAHAAAACAAAAAoAAAAMAAAADgAAABAAAAAUAAAAGAAAABwAAAAgAAAAKAAAADAAAAA4ABBtN0AC5oCAQAAAAIAAAADAAAABAAAAAYAAAAIAAAADAAAABAAAAAYAAAAIAAAADAAAABAAAAAYAAAAIAAAADAAAAAAAEAAIABAAAAAgAAAAMAAAAEAAAABgAAAAgAAAAMAAAAEAAAABgAAAAgAAAAMAAAAEAAAABgAABuZWVkIGRpY3Rpb25hcnkAc3RyZWFtIGVuZAAAZmlsZSBlcnJvcgBzdHJlYW0gZXJyb3IAZGF0YSBlcnJvcgBpbnN1ZmZpY2llbnQgbWVtb3J5AGJ1ZmZlciBlcnJvcgBpbmNvbXBhdGlibGUgdmVyc2lvbgAAAAAoLwAAOC8AAEMvAABELwAATy8AAFwvAABnLwAAey8AAIgvAABDLwAAMS4yLjExAEHQ3wALA9AxUA=="),Rd,Jo,CA=Uint8Array.BYTES_PER_ELEMENT,jv={bytesReceived:"br",frameDropped:"fd",frameReceived:"fr",googJitterReceived:"jr",isAudioMute:"am",isFreeze:"fz",mediaType:"mt",packetsLost:"pl",packetsReceived:"pr",peerId:"pid",id:"id",ssrc:"ssrc",timestamp:"ts",type:"tp",frameRateInput:"fi",frameRateSent:"fs",googRtt:"rt",isVideoMute:"vm"},Wv={stats:"sts",state:"st",stream_id:"stid",session_id:"seid",stream_type:"stt",app_id:"aid",channel_key:"ck",channel_name:"cn",sdk_version:"sv",browser:"b",process_id:"pcid",mode:"m",codec:"c",role:"r",has_changed_gateway:"hcg",ap_response:"ar",extends:"es",details:"d",features:"ft",p2p_id:"ppid",sdp:"sdp",audio:"a",video:"v",attributes:"at",hq:"h",lq:"l",stereo:"str",speech:"spe",extend:"e",pingpongElapse:"ppe"},Vv={_message:"m",_type:"t",_id:"id"},Yv={join_v2:"j2",publish:"pub",publish_related_stats:"prs",ping:"pi",traffic_stats:"ts",ping_back:"pib",publish_stats:"pubs"},wd;class Jv{constructor(){}init(){return Ee(this,null,function*(){wd||(wd=(yield(()=>Ee(this,null,function*(){return Jo||(Jo=yield mi()),{zlibCompress:e=>{var r,i=new Uint8Array(e);const n=CA*i.byteLength;e=Jo._malloc(n);const c=Jo._malloc(3*n);for(let h=0;h<n;h++)Jo.HEAP8[e/CA+h]=i[h];return i=Jo._zlibCompress(e,n,c),i=new Uint8Array($i(r=Jo.HEAP8).call(r,c,c+i)),Jo._free(e),Jo._free(c),i}}}))()).zlibCompress),this.zlibCompress=wd})}msgPackCompress(e){return Ov.encode(e)}compress(e){let r=ot(),i=this.compressKeyAndValue(JSON.parse(ht(e))),n=this.msgPackCompress(i);var c=this.zlibCompress(n);return c=new Uint8Array([49,49,49,50,...io(c)]),{origin:Sn({},e),originLength:ht(e).length,shortKeyAndValue:i,msgpackSer:n,compressed:c,compressedLength:c.length,time:ot()-r}}compressKeyAndValue(e){return this._ObjectKeyCompress(this._typeCompress(e))}_typeCompress(e){let r=e._type;return r&&(e._type=Yv[r]||r),e}_ObjectKeyCompress(e){let r=e._message;if(r){let i=r.stats;i&&(r.stats=this._statsCompress(i)),e._message=this._messageCompress(r)}return this._reportCompress(e)}_statsCompress(e){return this._keyCompress(e,jv)}_messageCompress(e){return this._keyCompress(e,Wv)}_reportCompress(e){return this._keyCompress(e,Vv)}_keyCompress(e,r){let i={},n=Er(e);return Ml(n).call(n,(c,h)=>(c=e[h],r[h]?i[r[h]]=c:i[h]=c,i),i),i}}class zv extends An{constructor(e){super();this.lowPriorityQueue=[],this.highPriorityQueue=[],this.AgoraWebSocketManager=e}get queue(){return[...this.highPriorityQueue,...this.lowPriorityQueue]}reset(){this.lowPriorityQueue=[],this.highPriorityQueue=[]}pushMessage(e,r=!1){r?this.highPriorityQueue.push(e):this.lowPriorityQueue.push(e),this.sendMessage()}sendMessage(){let e=this.queue.length;Is(()=>{this._sendMessage()},5>e?15*e:60+3*(e-4))}_sendMessage(){var e;if(this.queue.length){var r=this.AgoraWebSocketManager.getConnection();if(r&&r.readyState===1){var i=this.queue.shift();return Ir(e=this.lowPriorityQueue).call(e,i)?this.lowPriorityQueue.shift():this.highPriorityQueue.shift(),r.send(i.compressed),i}}}}class Ld extends An{constructor(e,r,i=!1){super();this.currentURLIndex=this.connectionID=0,this.reconnectMode="tryNext",this._state="closed",this.reconnectCount=0,this.isCompressorInitSuccess=!1,this.wsDeflateLength=this.wsInflateLength=0,this.name=e,this.retryConfig=r,this.useCompress=i}get url(){return this.websocket?this.websocket.url:null}get state(){return this._state}set state(e){e!==this._state&&(this._state=e,this._state==="reconnecting"?this.emit(pr.RECONNECTING,this.reconnectReason):this._state==="connected"?this.emit(pr.CONNECTED):this._state==="closed"?this.emit(pr.CLOSED):this._state==="failed"&&this.emit(pr.FAILED))}getConnection(){return this.websocket||void 0}init(e){let r=(i,n)=>{this.urls=e;const c=this.urls[this.currentURLIndex];this.state="connecting",this.messageSender=new zv(this),this.createWebSocketConnection(c).then(i).catch(n),this.once(pr.CLOSED,()=>n(new ue(oe.WS_DISCONNECT))),this.once(pr.CONNECTED,()=>i())};return new it((i,n)=>{this.compressor=new Jv,this.compressor.init().then(()=>{var c;z.debug("websocket compressor initialized successfully"),this.isCompressorInitSuccess=!0,this.compress=Si(c=this.compressor.compress).call(c,this.compressor),r(i,n)}).catch(()=>{z.debug("websocket compressor failed to initialize"),r(i,n)})})}close(e,r){if(this.currentURLIndex=0,this.reconnectCount=0,this.websocket){this.websocket.onclose=null,this.websocket.onopen=null,this.websocket.onmessage=null;let i=this.websocket;r?Is(()=>i.close(),500):i.close(),this.websocket=void 0}this.state=e?"failed":"closed"}reconnect(e,r){if(!this.websocket)return void z.warning("[".concat(this.name,"] can not reconnect, no websocket"));e!==void 0&&(this.reconnectMode=e),z.debug("[".concat(this.name,"] reconnect is triggered initiative")),e=this.websocket.onclose,this.websocket.onclose=null,this.websocket.close(),e&&Si(e).call(e,this.websocket)({code:9999,reason:r})}sendMessage(e,r=!1){if(!this.websocket||this.websocket.readyState!==WebSocket.OPEN)throw new ue(oe.WS_ABORT,"websocket is not ready");try{let i=null;if(this.isCompressorInitSuccess&&this.useCompress&&Xe.WEBSOCKET_COMPRESS)i=this.compress(e),this.setWsInflateData(i);else{if(this.isCompressorInitSuccess&&this.useCompress){let c=this.compress(e);this.setWsInflateData(c)}let n=ht(e);i={compressed:n,compressedLength:n.length,origin:e}}r?this.websocket.send(i.compressed):this.messageSender.pushMessage(i)}catch(i){throw new ue(oe.WS_ERR,"send websocket message error"+i.toString())}}setWsInflateData(e){this.wsDeflateLength+=e.originLength,this.wsInflateLength+=e.compressedLength}getWsInflateData(){let e=this.wsInflateLength,r=this.wsDeflateLength;return this.clearWsInflateData(),{wsInflateLength:e,wsDeflateLength:r}}clearWsInflateData(){this.wsDeflateLength=this.wsInflateLength=0}createWebSocketConnection(e){return Ee(this,null,function*(){let r=this.connectionID+=1;return new it((i,n)=>{var c,h;this.websocket&&(this.websocket.onclose=null,this.websocket.close()),Xe.GATEWAY_WSS_ADDRESS&&jc(c=this.name).call(c,"gateway")&&(e=Xe.GATEWAY_WSS_ADDRESS),z.debug(ne(h="[".concat(this.name,"] start connect, url: ")).call(h,e));try{this.websocket=new WebSocket(e),this.websocket.binaryType="arraybuffer"}catch(x){var C;return c=new ue(oe.WS_ERR,"init websocket failed! Error: ".concat(x.toString())),z.error(ne(C="[".concat(this.name,"]")).call(C,c)),void n(c)}Pe(5e3).then(()=>{r===this.connectionID&&this.websocket&&this.websocket.readyState!==WebSocket.OPEN&&this.websocket&&this.websocket.close()}),this.websocket.onopen=()=>{z.debug("[".concat(this.name,"] websocket opened:"),e),this.reconnectMode="retry",this.state="connected",this.reconnectCount=0,i()},this.websocket.onclose=x=>Ee(this,null,function*(){var Q,F,V,Y;if(z.debug(ne(Q=ne(F=ne(V=ne(Y="[".concat(this.name,"] websocket close ")).call(Y,this.websocket&&this.websocket.url,", code: ")).call(V,x.code,", reason: ")).call(F,x.reason,", current mode: ")).call(Q,this.reconnectMode)),this.reconnectCount<this.retryConfig.maxRetryCount){if(this.state==="connected"&&(this.reconnectReason=x.reason,this.state="reconnecting"),Q=Qi(this,pr.WILL_RECONNECT,this.reconnectMode)||this.reconnectMode,Q=yield this.reconnectWithAction(Q),this.state==="closed")return void z.debug("[".concat(this.connectionID,"] ws is closed, no need to reconnect"));if(!Q)return n(new ue(oe.WS_DISCONNECT,"websocket reconnect failed: ".concat(x.code))),void this.close(!0);i()}else n(new ue(oe.WS_DISCONNECT,"websocket close: ".concat(x.code))),this.close()}),this.websocket.onmessage=x=>{this.emit(pr.ON_MESSAGE,x)}})})}reconnectWithAction(e,r){return Ee(this,null,function*(){var i,n;if(!r&&this.reconnectCount>=this.retryConfig.maxRetryCount||!this.urls||this.state==="closed"||(this.onlineReconnectListener||us.networkState!==js.OFFLINE||(this.onlineReconnectListener=us.onlineWaiter&&us.onlineWaiter.then(()=>{this.onlineReconnectListener=void 0})),r=function(C,x){return Math.min(x.maxRetryTimeout,x.timeout*Math.pow(x.timeoutFactor,C))}(this.reconnectCount,this.retryConfig),z.debug(ne(i=ne(n="[".concat(this.name,"] wait ")).call(n,r,"ms to reconnect websocket, mode: ")).call(i,e)),yield it.race([Pe(r),this.onlineReconnectListener||new it(()=>{})]),this.state==="closed"))return!1;this.reconnectCount+=1;try{if(e==="retry")yield this.createWebSocketConnection(this.urls[this.currentURLIndex]);else if(e==="tryNext"){var c,h;if(this.currentURLIndex+=1,this.currentURLIndex>=this.urls.length)return yield this.reconnectWithAction("recover");z.debug(ne(c=ne(h="[".concat(this.name,"] websocket url length: ")).call(h,this.urls.length," current index: ")).call(c,this.currentURLIndex)),yield this.createWebSocketConnection(this.urls[this.currentURLIndex])}else e==="recover"&&(z.debug("[".concat(this.name,"] request new urls")),this.urls=yield lr(this,pr.REQUEST_NEW_URLS),this.currentURLIndex=0,yield this.createWebSocketConnection(this.urls[this.currentURLIndex]));return!0}catch(C){return z.error("[".concat(this.name,"] reconnect failed"),C.toString()),yield this.reconnectWithAction(e)}})}}class qv{constructor(e){this.input=[],this.size=e}add(e){var r;this.input.push(e),this.input.length>this.size&&un(r=this.input).call(r,0,1)}mean(){var e;return this.input.length===0?0:Ml(e=this.input).call(e,(r,i)=>r+i)/this.input.length}}class Xv extends An{constructor(e){super();this._connectionState=Di.CLOSED,this.openConnectionTime=ot(),this.lastMsgTime=ot(),this.uploadCache=[],this.rttRolling=new qv(5),this.pingpongTimeoutCount=0,this.onWebsocketMessage=r=>{if(r.data instanceof ArrayBuffer)return void this.emit(ir.ON_BINARY_DATA,r.data);if(r=JSON.parse(r.data),this.lastMsgTime=ot(),Object.prototype.hasOwnProperty.call(r,"_id")){let i="res-@".concat(r._id);this.emit(i,r._result,r._message)}else if(Object.prototype.hasOwnProperty.call(r,"_type")&&(this.emit(r._type,r._message),r._type===Sr.ON_NOTIFICATION&&this.handleNotification(r._message),r._type===Sr.ON_USER_BANNED))switch(r._message.error_code){case 14:this.close("UID_BANNED");break;case 15:this.close("IP_BANNED");break;case 16:this.close("CHANNEL_BANNED")}},this.clientId=e.clientId,this.spec=e,this.websocket=new Ld("gateway-".concat(this.clientId),this.spec.retryConfig,!0),this.handleWebsocketEvents(),window.addEventListener("offline",()=>{this.connectionState===Di.CONNECTED&&this.reconnect("retry",qn.OFFLINE)})}get connectionState(){return this._connectionState}set connectionState(e){e!==this._connectionState&&(this._connectionState=e,e===Di.CONNECTED?this.emit(ir.WS_CONNECTED):e===Di.RECONNECTING?this.emit(ir.WS_RECONNECTING,this._websocketReconnectReason):e===Di.CLOSED&&this.emit(ir.WS_CLOSED,this._disconnectedReason))}get currentURLIndex(){return this.websocket.currentURLIndex}get url(){return this.websocket?this.websocket.url:null}get rtt(){return this.rttRolling.mean()}request(e,r,i,n){return Ee(this,null,function*(){var c,h,C,x,Q;let F=mr(6,"");var V={_id:F,_type:e,_message:r};let Y=this.websocket.connectionID;var $=()=>new it((te,ce)=>{if(this.connectionState===Di.CONNECTED)return te();const Ae=()=>{this.off(ir.WS_CLOSED,Me),te()},Me=()=>{this.off(ir.WS_CONNECTED,Ae),ce(new ue(oe.WS_ABORT))};this.once(ir.WS_CONNECTED,Ae),this.once(ir.WS_CLOSED,Me)});if(this.connectionState!==Di.CONNECTING&&this.connectionState!==Di.RECONNECTING||e===xr.JOIN||e===xr.REJOIN||(yield $()),this.websocket.sendMessage(V,!0),!n){V=new it((te,ce)=>{let Ae=!1;const Me=(vt,kt)=>{Ae=!0,te({isSuccess:vt==="success",message:kt||{}}),this.off(ir.WS_CLOSED,et),this.off(ir.WS_RECONNECTING,et),this.emit(ir.REQUEST_SUCCESS,e,r)};this.once("res-@".concat(F),Me);const et=()=>{ce(new ue(oe.WS_ABORT,"type: ".concat(e))),this.off(ir.WS_CLOSED,et),this.off(ir.WS_RECONNECTING,et),this.off("res-@".concat(F),Me)};this.once(ir.WS_CLOSED,et),this.once(ir.WS_RECONNECTING,et),Pe(Xe.SIGNAL_REQUEST_TIMEOUT).then(()=>{this.websocket.connectionID!==Y||Ae||(z.warning("ws request timeout, type: ".concat(e)),this.emit(ir.REQUEST_TIMEOUT,e,r))})}),n=null;try{n=yield V}catch(te){if(this.connectionState===Di.CLOSED||e===xr.LEAVE)throw new ue(oe.WS_ABORT);return!this.spec.forceWaitGatewayResponse||i?te.throw():e===xr.JOIN||e===xr.REJOIN?null:(yield $(),yield this.request(e,r))}return n.isSuccess?n.message:(i=Number(n.message.error_code||n.message.code),$=cn(i),V=new ue(oe.UNEXPECTED_RESPONSE,ne(c="".concat($.desc,": ")).call(c,n.message.error_str),{code:i,data:n.message}),$.action==="success"?n.message:(z.warning(ne(h=ne(C=ne(x=ne(Q="[".concat(this.websocket.connectionID,"] unexpected response from type ")).call(Q,e,", error_code: ")).call(x,i,", message: ")).call(C,$.desc,", action: ")).call(h,$.action)),$.action==="failed"?V.throw():$.action==="quit"?(this.initError=V,this.close(),V.throw()):(i===Ot.ERR_JOIN_BY_MULTI_IP?(this.multiIpOption=n.message.option,z.warning("[".concat(this.clientId,"] detect multi ip, recover")),this.reconnect("recover",qn.MULTI_IP)):this.reconnect($.action,qn.SERVER_ERROR),e===xr.JOIN||e===xr.REJOIN?null:yield this.request(e,r))))}})}waitMessage(e,r){return new it(i=>{let n=c=>{r&&!r(c)||(this.off(e,n),i(c))};this.on(e,n)})}upload(e,r){e={_type:e,_message:r};try{this.websocket.sendMessage(e)}catch(n){r=Xe.MAX_UPLOAD_CACHE||50;var i;this.uploadCache.push(e),this.uploadCache.length>r&&un(i=this.uploadCache).call(i,0,1),0<this.uploadCache.length&&!this.uploadCacheInterval&&(this.uploadCacheInterval=window.setInterval(()=>{var c;if(this.connectionState===Di.CONNECTED){var h=un(c=this.uploadCache).call(c,0,1)[0];this.uploadCache.length===0&&(window.clearInterval(this.uploadCacheInterval),this.uploadCacheInterval=void 0),this.upload(h._type,h._message)}},Xe.UPLOAD_CACHE_INTERVAL||2e3))}}send(e,r){this.websocket.sendMessage({_type:e,_message:r})}init(e){return this.initError=void 0,this.multiIpOption=void 0,this.joinResponse=void 0,this.reconnectToken=void 0,new it((r,i)=>{this.once(ir.WS_CONNECTED,()=>r(this.joinResponse)),this.once(ir.WS_CLOSED,()=>i(this.initError||new ue(oe.WS_ABORT))),this.connectionState=Di.CONNECTING,this.websocket.init(e).catch(i),this.wsInflateDataTimer&&window.clearInterval(this.wsInflateDataTimer),this.wsInflateDataTimer=window.setInterval(()=>{this.handleWsInflateData()},2e4)})}close(e){this.pingpongTimer&&(this.pingpongTimeoutCount=0,window.clearInterval(this.pingpongTimer),this.pingpongTimer=void 0),this.wsInflateDataTimer&&(this.handleWsInflateData(),window.clearInterval(this.wsInflateDataTimer),this.wsInflateDataTimer=void 0),this.joinResponse=this.reconnectToken=void 0,this._disconnectedReason=e||"LEAVE",this.connectionState=Di.CLOSED,this.websocket.close()}join(){return Ee(this,null,function*(){var e;if(!this.joinResponse){var r=Bn(this,ir.REQUEST_JOIN_INFO);if(r=yield this.request(xr.JOIN,r),!r)return this.emit(ir.REPORT_JOIN_GATEWAY,oe.TIMEOUT,this.url||""),!1;this.joinResponse=r,this.reconnectToken=this.joinResponse.rejoin_token}return this.connectionState=Di.CONNECTED,this.pingpongTimer&&window.clearInterval(this.pingpongTimer),this.pingpongTimer=window.setInterval(Si(e=this.handlePingPong).call(e,this),3e3),!0})}rejoin(){return Ee(this,null,function*(){var e,r;if(!this.reconnectToken)throw new ue(oe.UNEXPECTED_ERROR,"can not rejoin, no rejoin token");var i=Bn(this,ir.REQUEST_REJOIN_INFO);return i.token=this.reconnectToken,i=yield this.request(xr.REJOIN,i),!!i&&(this.connectionState=Di.CONNECTED,this.pingpongTimer&&window.clearInterval(this.pingpongTimer),this.pingpongTimer=window.setInterval(Si(e=this.handlePingPong).call(e,this),3e3),i.peers&&Re(r=i.peers).call(r,n=>{this.emit(Sr.ON_USER_ONLINE,{uid:n.uid}),n.audio_mute?this.emit(Sr.MUTE_AUDIO,{uid:n.uid}):this.emit(Sr.UNMUTE_AUDIO,{uid:n.uid}),n.video_mute?this.emit(Sr.MUTE_VIDEO,{uid:n.uid}):this.emit(Sr.UNMUTE_VIDEO,{uid:n.uid}),n.audio_enable_local?this.emit(Sr.ENABLE_LOCAL_AUDIO,{uid:n.uid}):this.emit(Sr.DISABLE_LOCAL_AUDIO,{uid:n.uid}),n.video_enable_local?this.emit(Sr.ENABLE_LOCAL_VIDEO,{uid:n.uid}):this.emit(Sr.DISABLE_LOCAL_VIDEO,{uid:n.uid}),n.audio||n.video||this.emit(Sr.ON_REMOVE_STREAM,{uid:n.uid,uint_id:n.uint_id}),n.audio&&this.emit(Sr.ON_ADD_AUDIO_STREAM,{uid:n.uid,uint_id:n.uint_id,audio:!0}),n.video&&this.emit(Sr.ON_ADD_VIDEO_STREAM,{uid:n.uid,uint_id:n.uint_id,video:!0})}),!0)})}reconnect(e,r){this.pingpongTimer&&(this.pingpongTimeoutCount=0,window.clearInterval(this.pingpongTimer),this.pingpongTimer=void 0),this.websocket.reconnect(e,r)}handleNotification(e){if(z.debug("[".concat(this.clientId,"] receive notification: "),e),e=cn(e.code),e.action!=="success"){if(e.action!=="failed")return e.action==="quit"?(e.desc==="ERR_REPEAT_JOIN_CHANNEL"&&this.close("UID_BANNED"),void this.close()):void this.reconnect(e.action,qn.SERVER_ERROR);z.error("[".concat(this.clientId,"] ignore error: "),e.desc)}}handlePingPong(){if(this.websocket&&this.websocket.state==="connected"){0<this.pingpongTimeoutCount&&this.rttRolling.add(3e3),this.pingpongTimeoutCount+=1;var e=Xe.PING_PONG_TIME_OUT,r=ot();this.pingpongTimeoutCount>=e&&(z.warning("PINGPONG Timeout. Last Socket Message: ".concat(r-this.lastMsgTime,"ms")),r-this.lastMsgTime>Xe.WEBSOCKET_TIMEOUT_MIN)?this.reconnect("retry",qn.TIMEOUT):this.request(xr.PING,void 0,!0).then(()=>{this.pingpongTimeoutCount=0;let i=ot()-r;this.rttRolling.add(i),Xe.REPORT_STATS&&this.send(xr.PING_BACK,{pingpongElapse:i})}).catch(i=>{})}}handleWsInflateData(){let{wsInflateLength:e,wsDeflateLength:r}=this.websocket.getWsInflateData();e!==0&&r!==0&&this.upload(Gs.WS_INFLATE_DATA_LENGTH,{ws_deflate_length:r,ws_inflate_length:e})}handleWebsocketEvents(){this.websocket.on(pr.ON_MESSAGE,this.onWebsocketMessage),this.websocket.on(pr.CLOSED,()=>{this.connectionState=Di.CLOSED}),this.websocket.on(pr.FAILED,()=>{this._disconnectedReason="NETWORK_ERROR",this.connectionState=Di.CLOSED}),this.websocket.on(pr.RECONNECTING,e=>{this._websocketReconnectReason=e,this.joinResponse=void 0,this.connectionState===Di.CONNECTED?this.connectionState=Di.RECONNECTING:this.connectionState=Di.CONNECTING}),this.websocket.on(pr.WILL_RECONNECT,(e,r)=>{if(Bn(this,ir.IS_P2P_DISCONNECTED)&&e==="retry")return this.reconnectToken=void 0,this.emit(ir.NEED_RENEW_SESSION),this.emit(ir.DISCONNECT_P2P),r("tryNext");e!=="retry"&&(this.reconnectToken=void 0,this.emit(ir.NEED_RENEW_SESSION),this.emit(ir.DISCONNECT_P2P)),r(e)}),this.websocket.on(pr.CONNECTED,()=>{this.openConnectionTime=ot(),this.reconnectToken?this.rejoin().catch(e=>{var r;z.warning(ne(r="[".concat(this.clientId,"] rejoin failed ")).call(r,e)),this.reconnect("tryNext",qn.SERVER_ERROR)}):this.join().catch(e=>{if(this.emit(ir.REPORT_JOIN_GATEWAY,e.message||e.code,this.url||""),e instanceof ue&&e.code===oe.UNEXPECTED_RESPONSE&&e.data.code===Ot.ERR_NO_AUTHORIZED)return z.warning("[".concat(this.clientId,"] reconnect no authorized, recover")),void this.reconnect("recover",qn.SERVER_ERROR);z.error("[".concat(this.clientId,"] join gateway request failed"),e.toString()),this.spec.forceWaitGatewayResponse?this.reconnect("tryNext",qn.SERVER_ERROR):(this.initError=e,this.close())})}),this.websocket.on(pr.REQUEST_NEW_URLS,(e,r)=>{lr(this,ir.REQUEST_RECOVER,this.multiIpOption).then(e).catch(r)})}}let Dd=new Lr;class Zv extends An{constructor(e){super();this.inChannelInfo={joinAt:null,duration:0},this._state="DISCONNECTED",this.needToSendUnpubUnsub=new Lr,this.hasChangeBGPAddress=this.isSignalRecover=!1,this.joinGatewayStartTime=0,this._signalTimeout=!1,this.clientId=e.clientId,this.spec=e,this.signal=new Xv(Gi({},e,{retryConfig:e.websocketRetryConfig})),this._statsCollector=e.statsCollector,this.role=e.role||"audience",this._clientRoleOptions=e.clientRoleOptions,this.handleSignalEvents()}get state(){return this._state}set state(e){if(e!==this._state){var r=this._state;this._state=e,e==="DISCONNECTED"&&this._disconnectedReason?this.emit(ji.CONNECTION_STATE_CHANGE,e,r,this._disconnectedReason):this.emit(ji.CONNECTION_STATE_CHANGE,e,r)}}join(e,r){return Ee(this,null,function*(){var i,n;e.cloudProxyServer!=="disabled"&&(this.hasChangeBGPAddress=!0);let c=ot();var h=Dd.get(e.cname);if(h||(h=new Lr,Dd.set(e.cname,h)),h.has(e.uid))throw h=new ue(oe.UID_CONFLICT),Qe.joinGateway(e.sid,{lts:c,succ:!1,ec:h.message,addr:null,uid:e.uid,cid:e.cid}),h;h.set(e.uid,!0),this.joinInfo=e,this.key=r,r=e.proxyServer?yt(i=e.gatewayAddrs).call(i,C=>{var x,Q;return C=C.split(":"),ne(x=ne(Q="wss://".concat(e.proxyServer,"/ws/?h=")).call(Q,C[0],"&p=")).call(x,C[1])}):yt(n=e.gatewayAddrs).call(n,C=>"wss://".concat(C)),i=0,this.joinGatewayStartTime=c;try{i=(yield this.signal.init(r)).uid}catch(C){throw z.error("[".concat(this.clientId,"] User join failed"),C.toString()),Qe.joinGateway(e.sid,{lts:c,succ:!1,ec:C.message,addr:this.signal.url,uid:e.uid,cid:e.cid}),h.delete(e.uid),this.signal.close(),C}return this.state="CONNECTED",this.inChannelInfo.joinAt=ot(),z.debug("[".concat(this.clientId,"] Connected to gateway server")),this.trafficStatsInterval=window.setInterval(()=>{this.updateTrafficStats().catch(C=>{z.warning("[".concat(this.clientId,"] get traffic stats error"),C.toString())})},3e3),this.networkQualityInterval=window.setInterval(()=>{navigator&&navigator.onLine!==void 0&&!navigator.onLine?this.emit(ji.NETWORK_QUALITY,{downlinkNetworkQuality:6,uplinkNetworkQuality:6}):this._signalTimeout?this.emit(ji.NETWORK_QUALITY,{downlinkNetworkQuality:5,uplinkNetworkQuality:5}):this.state==="CONNECTED"&&this._statsCollector.trafficStats?this.emit(ji.NETWORK_QUALITY,{uplinkNetworkQuality:na(this._statsCollector.trafficStats.B_unq),downlinkNetworkQuality:na(this._statsCollector.trafficStats.B_dnq)}):this.emit(ji.NETWORK_QUALITY,{uplinkNetworkQuality:0,downlinkNetworkQuality:0})},2e3),i})}leave(e=!1){return Ee(this,null,function*(){if(this.state!=="DISCONNECTED"){this.state="DISCONNECTING";try{if(!e&&this.signal.connectionState===Di.CONNECTED){var r=this.signal.request(xr.LEAVE,void 0,!0);yield it.race([r,xe(3e3)])}}catch(i){z.warning("[".concat(this.clientId,"] leave request failed, ignore"),i)}this.signal.close(),this.reset(),this.state="DISCONNECTED"}})}publish(e,r){return Ee(this,null,function*(){if(!this.joinInfo)throw new ue(oe.UNEXPECTED_ERROR,"publish no joinInfo");let i=e.getUserId(),n=e.videoTrack?function(c){var h;if(c=c._encoderConfig,!c)return{};const C={resolution:c.width&&c.height?ne(h="".concat(Qn(c.width),"x")).call(h,Qn(c.height)):void 0,maxVideoBW:c.bitrateMax,minVideoBW:c.bitrateMin};return typeof c.frameRate=="number"?(C.maxFrameRate=c.frameRate,C.minFrameRate=c.frameRate):c.frameRate&&(C.maxFrameRate=c.frameRate.max||c.frameRate.ideal||c.frameRate.exact||c.frameRate.min,C.minFrameRate=c.frameRate.min||c.frameRate.ideal||c.frameRate.exact||c.frameRate.max),C}(e.videoTrack):{};if(e.on(Nt.NEED_ANSWER,(c,h,C)=>{var x;let Q={state:"offer",stream_type:r,p2p_id:e.pc.ID,sdp:ht(c),audio:!!e.audioTrack,video:!!e.videoTrack,screen:e.videoTrack&&Wt(x=e.videoTrack._hints).call(x,to.SCREEN_TRACK)!==-1,attributes:n,dtx:e.audioTrack instanceof Xc&&e.audioTrack._config.DTX,hq:!1,lq:!1,stereo:!1,speech:!1,mode:this.spec.mode,codec:this.spec.codec,extend:Xe.PUB_EXTEND};e.audioTrack&&e.audioTrack instanceof Tn&&(e.audioTrack&&(x={stream_id:this.joinInfo&&(this.joinInfo.stringUid||this.joinInfo.uid),action:""},e.audioTrack.isActive?x.action="unmute_local_audio":x.action="mute_local_audio",this.sendControl(x)),e.videoTrack&&(x={stream_id:this.joinInfo&&(this.joinInfo.stringUid||this.joinInfo.uid),action:""},e.videoTrack.muted?x.action="mute_local_video":x.action="unmute_local_video",this.sendControl(x))),this.signal.request(xr.PUBLISH,Q,!0).then(F=>{i&&this.needToSendUnpubUnsub.set(i,!0),h(JSON.parse(F.sdp))}).catch(F=>{if(c.retry&&F.data&&F.data.code===Ot.ERR_PUBLISH_REQUEST_INVALID)return z.warning("[".concat(this.clientId,"] receiver publish error code, retry"),F.toString()),lr(e,Nt.NEED_UNPUB).then(()=>{c.retry=!1,lr(e,Nt.NEED_ANSWER,c).then(h).catch(C)});F.code!==oe.WS_ABORT&&C(F)})}),e.on(Nt.NEED_RENEGOTIATE,(c,h,C)=>{this.signal.request(xr.PUBLISH,{state:"negotiation",stream_type:r,p2p_id:e.pc.ID,sdp:c},!0).then(x=>{h(JSON.parse(x.sdp))}).catch(x=>{x.code!==oe.WS_ABORT&&C(x)})}),e.on(Nt.NEED_UNPUB,c=>i&&!this.needToSendUnpubUnsub.has(i)?c(!1):this.state==="RECONNECTING"?c(!0):void this.signal.request(xr.UNPUBLISH,{stream_id:e.getUserId(),stream_type:r},!0).then(()=>c(!1)).catch(h=>{z.warning("unpublish warning: ",h),c(!0)})),e.on(Nt.NEED_UPLOAD,(c,h)=>{this.signal.upload(c,{stream_type:r,stats:h})}),e.on(Nt.NEED_SIGNAL_RTT,c=>{c(this.signal.rtt)}),e.on(Nt.NEED_CONTROL,(c,h,C)=>{if(c.type==="video"&&c.muted)c="mute_local_video";else if(c.type!=="video"||c.muted)if(c.type==="audio"&&c.muted)c="mute_local_audio";else{if(c.type!=="audio"||c.muted)return;c="unmute_local_audio"}else c="unmute_local_video";this.sendControl({stream_id:this.joinInfo&&(this.joinInfo.stringUid||this.joinInfo.uid),action:c}).then(h).catch(C)}),this.state!=="RECONNECTING"){if(this.state!=="CONNECTED")return new ue(oe.INVALID_OPERATION,"can not publish when connection state is ".concat(this.state)).throw();yield e.startP2PConnection()}else e.readyToReconnectPC()})}subscribe(e){return Ee(this,null,function*(){if(!this.joinInfo)throw new ue(oe.UNEXPECTED_ERROR,"subscribe no joinInfo");let r=e.getUserId();if(e.on(Nt.NEED_ANSWER,(i,n,c)=>{var h=e.subscribeOptions;h={stream_id:e.getUserId(),audio:!!h.audio,video:!!h.video,mode:this.spec.mode,codec:this.spec.codec,p2p_id:e.pc.ID,sdp:ht(i),tcc:!!Xe.SUBSCRIBE_TCC,extend:Xe.SUB_EXTEND},this.signal.request(xr.SUBSCRIBE,h,!0).then(C=>{this.needToSendUnpubUnsub.set(r,!0),n(JSON.parse(C.sdp))}).catch(C=>{if(i.retry&&C.data&&C.data.code===Ot.ERR_SUBSCRIBE_REQUEST_INVALID)return z.warning("[".concat(this.clientId,"] receiver subscribe error code, retry"),C.toString()),lr(e,Nt.NEED_UNSUB).then(()=>{i.retry=!1,lr(e,Nt.NEED_ANSWER,i).then(n).catch(c)});C.code!==oe.WS_ABORT&&c(C)})}),e.on(Nt.NEED_UNSUB,i=>this.needToSendUnpubUnsub.has(r)?this.state==="RECONNECTING"?i(!0):void this.signal.request(xr.UNSUBSCRIBE,{stream_id:e.getUserId()},!0).then(()=>i(!1)).catch(n=>{z.warning("unsubscribe warning",n),i(!0)}):i(!1)),e.on(Nt.NEED_UPLOAD,(i,n)=>{this.signal.upload(i,{stream_id:e.getUserId(),stats:n})}),e.on(Nt.NEED_SIGNAL_RTT,i=>{i(this.signal.rtt)}),this.state!=="RECONNECTING"){if(this.state!=="CONNECTED")return new ue(oe.INVALID_OPERATION,"can not subscribe when connection state is ".concat(this.state)).throw();yield e.startP2PConnection()}else e.readyToReconnectPC()})}subscribeChange(e,r){return Ee(this,null,function*(){var i,n;if(!this.joinInfo)throw new ue(oe.UNEXPECTED_ERROR,"subscribe no joinInfo");if(yield e.setSubscribeOptions(r),this.state!=="RECONNECTING"){if(this.state!=="CONNECTED")return new ue(oe.INVALID_OPERATION,"can not subscribe change when connection state is ".concat(this.state)).throw();z.debug(ne(i=ne(n="[".concat(this.clientId,"] send subscribe change, audio: ")).call(n,r.audio,", video: ")).call(i,r.video)),yield this.signal.request(xr.SUBSCRIBE_CHANGE,{stream_id:e.getUserId(),audio:!!r.audio,video:!!r.video},!0)}})}sendControl(e){return Ee(this,null,function*(){this.signal.request(xr.CONTROL,e,!0,!0)})}unsubscribe(e){return Ee(this,null,function*(){yield e.closeP2PConnection()})}getGatewayInfo(){return this.signal.request(xr.GATEWAY_INFO)}renewToken(e){return this.signal.request(xr.RENEW_TOKEN,{token:e})}setClientRole(e,r){return Ee(this,null,function*(){if(r&&(this._clientRoleOptions=Sn({},r)),this.state!=="CONNECTED")return void(this.role=e);yield this.signal.request(xr.SET_CLIENT_ROLE,{role:e,level:e==="audience"?this._clientRoleOptions&&this._clientRoleOptions.level?this._clientRoleOptions.level:2:0}),this.role=e})}setRemoteVideoStreamType(e,r){return Ee(this,null,function*(){yield this.signal.request(xr.SWITCH_VIDEO_STREAM,{stream_id:e,stream_type:r})})}setStreamFallbackOption(e,r){return Ee(this,null,function*(){yield this.signal.request(xr.SET_FALLBACK_OPTION,{stream_id:e,fallback_type:r})})}pickSVCLayer(e,r){return Ee(this,null,function*(){yield this.signal.request(xr.PICK_SVC_LAYER,{stream_id:e,spatial_layer:r.spatialLayer,temporal_layer:r.temporalLayer})})}getInChannelInfo(){return this.inChannelInfo.joinAt&&(this.inChannelInfo.duration=ot()-this.inChannelInfo.joinAt),Gi({},this.inChannelInfo)}getGatewayVersion(){return Ee(this,null,function*(){return(yield this.signal.request(xr.GATEWAY_INFO)).version})}reset(){if(this.inChannelInfo.joinAt&&(this.inChannelInfo.duration=ot()-this.inChannelInfo.joinAt,this.inChannelInfo.joinAt=null),this.trafficStatsInterval&&(window.clearInterval(this.trafficStatsInterval),this.trafficStatsInterval=void 0),this.joinInfo){let e=Dd.get(this.joinInfo.cname);e&&e.delete(this.joinInfo.uid)}this.needToSendUnpubUnsub=new Lr,this.key=this.joinInfo=void 0,this.networkQualityInterval&&(window.clearInterval(this.networkQualityInterval),this.networkQualityInterval=void 0)}updateTurnConfigFromSignal(){if(this.joinInfo){var e=(e=((this.joinInfo.cloudProxyServer==="disabled"?this.signal.url:this.joinInfo.gatewayAddrs[this.signal.currentURLIndex])||"").match(/(wss:\/\/)?([^:]+):(\d+)/))?{username:tn.username,password:tn.password,turnServerURL:e[2],tcpport:Ii(e[3])+30,udpport:Ii(e[3])+30,forceturn:!1}:null;this.joinInfo.turnServer.serversFromGateway=[],e&&this.joinInfo.turnServer.mode!=="off"&&this.joinInfo.cloudProxyServer==="disabled"&&this.joinInfo.turnServer.serversFromGateway.push(Gi({},tn,{turnServerURL:e.turnServerURL,tcpport:e.tcpport,udpport:e.udpport,username:this.joinInfo.uid.toString(),password:this.joinInfo.token}))}}updateTrafficStats(){return Ee(this,null,function*(){var e;if(this.state==="CONNECTED"){var r=yield this.signal.request(xr.TRAFFIC_STATS,void 0,!0);r.timestamp=ot(),Re(e=r.peer_delay).call(e,i=>{var n;let c=this._statsCollector.trafficStats&&tr(n=this._statsCollector.trafficStats.peer_delay).call(n,h=>h.peer_uid===i.peer_uid);c&&c.B_st!==i.B_st&&Ni(()=>{this.emit(ji.STREAM_TYPE_CHANGE,i.peer_uid,i.B_st)})}),this._statsCollector.updateTrafficStats(r)}})}getJoinMessage(){if(!this.joinInfo||!this.key)throw new ue(oe.UNEXPECTED_ERROR,"can not generate join message, no join info");let e=Sn({},this.joinInfo.apResponse);var r=Xe.REPORT_APP_SCENARIO;if(typeof r!="string")try{r=ht(r)}catch(i){r=void 0}return r&&128<r.length&&(r=void 0),r={session_id:this.joinInfo.sid,app_id:this.joinInfo.appId,channel_key:this.key,channel_name:this.joinInfo.cname,sdk_version:as,browser:navigator.userAgent,process_id:Xe.PROCESS_ID,mode:this.spec.mode,codec:this.spec.codec,role:this.role,has_changed_gateway:this.hasChangeBGPAddress,ap_response:e,extend:Xe.JOIN_EXTEND,details:{6:this.joinInfo.stringUid,cservice_map:this.joinInfo.cloudProxyServer==="proxy3"?"1":void 0},features:{rejoin:!0},optionalInfo:this.joinInfo.optionalInfo,appScenario:r},this.joinInfo.stringUid&&(r.string_uid=this.joinInfo.stringUid),this.joinInfo.aesmode&&this.joinInfo.aespassword&&(r.aes_mode=this.joinInfo.aesmode,Xe.ENCRYPT_AES?(r.aes_secret=this.joinInfo.aespassword,r.aes_encrypt=!0):r.aes_secret=this.joinInfo.aespassword,this.joinInfo.aessalt&&(r.aes_salt=this.joinInfo.aessalt)),e.addresses[this.signal.websocket.currentURLIndex]&&(r.ap_response.ticket=e.addresses[this.signal.websocket.currentURLIndex].ticket,delete e.addresses),r}getRejoinMessage(){if(!this.joinInfo)throw new ue(oe.UNEXPECTED_ERROR,"can not generate rejoin message, no join info");return{session_id:this.joinInfo.sid,channel_name:this.joinInfo.cname,cid:this.joinInfo.cid,uid:this.joinInfo.uid,vid:Number(this.joinInfo.vid)}}handleSignalEvents(){this.signal.on(ir.WS_RECONNECTING,e=>{this.joinInfo&&Qe.WebSocketQuit(this.joinInfo.sid,{lts:ot(),succ:-1,cname:this.joinInfo.cname,uid:this.joinInfo.uid,cid:this.joinInfo.cid,errorCode:e||qn.NETWORK_ERROR}),this.joinInfo&&(this.state="RECONNECTING",Qe.sessionInit(this.joinInfo.sid,{lts:new Date().getTime(),extend:this.isSignalRecover?{recover:!0}:{rejoin:!0},cname:this.joinInfo.cname,appid:this.joinInfo.appId,mode:this.spec.mode}),this.isSignalRecover=!1,this.joinGatewayStartTime=ot())}),this.signal.on(ir.WS_CLOSED,e=>{let r;switch(e){case"LEAVE":r=qn.LEAVE;break;case"UID_BANNED":case"IP_BANNED":case"CHANNEL_BANNED":case"SERVER_ERROR":r=qn.SERVER_ERROR;break;default:r=qn.NETWORK_ERROR}z.debug("[signal] websocket closed, reason: ".concat(r||"undefined -> "+qn.NETWORK_ERROR)),this.joinInfo&&Qe.WebSocketQuit(this.joinInfo.sid,{lts:ot(),succ:e==="LEAVE"?1:-1,cname:this.joinInfo.cname,uid:this.joinInfo.uid,cid:this.joinInfo.cid,errorCode:r}),this.reset(),this._disconnectedReason=e,this.state="DISCONNECTED"}),this.signal.on(ir.WS_CONNECTED,()=>{if(this.updateTurnConfigFromSignal(),this.state="CONNECTED",this.joinInfo){var e,r,i;if(this.role==="audience"&&this._clientRoleOptions&&this._clientRoleOptions.level&&(z.debug(ne(e=ne(r=ne(i="[".concat(this.clientId,"] patch to send set client role, role: ")).call(i,this.role,", mode: ")).call(r,this.spec.mode,", level: ")).call(e,this._clientRoleOptions&&this._clientRoleOptions.level)),this.setClientRole(this.role,this._clientRoleOptions)),Qe.joinGateway(this.joinInfo.sid,{lts:this.joinGatewayStartTime,succ:!0,ec:null,vid:this.joinInfo.vid,addr:this.signal.url,uid:this.joinInfo.uid,cid:this.joinInfo.cid}),this.joinInfo.useLocalAccessPoint){e=this.signal.url&&this.signal.url.match(/wss:\/\/([^:]+):(\d+)/);var n;if(!e)return void z.error(ne(n="[".concat(this.clientId,"] set local access point after joined failed: ")).call(n,e));Rr("EVENT_REPORT_DOMAIN",e[1]),Rr("EVENT_REPORT_BACKUP_DOMAIN",e[1]),Rr("LOG_UPLOAD_SERVER","".concat(e[1],":6444"))}}}),this.signal.on(Sr.ON_UPLINK_STATS,e=>{this._statsCollector.updateUplinkStats(e)}),this.signal.on(ir.REQUEST_RECOVER,(e,r,i)=>{if(!this.joinInfo)return i(new ue(oe.UNEXPECTED_ERROR,"gateway: can not recover, no join info"));e&&(this.joinInfo.multiIP=e,this.hasChangeBGPAddress=!0),this.isSignalRecover=!0,lr(this,ji.REQUEST_NEW_GATEWAY_LIST).then(r).catch(i)}),this.signal.on(ir.REQUEST_JOIN_INFO,e=>{e(this.getJoinMessage())}),this.signal.on(ir.REQUEST_REJOIN_INFO,e=>{e(this.getRejoinMessage())}),this.signal.on(ir.REPORT_JOIN_GATEWAY,(e,r)=>{this.joinInfo&&Qe.joinGateway(this.joinInfo.sid,{lts:this.joinGatewayStartTime,succ:!1,ec:e,addr:r,uid:this.joinInfo.uid,cid:this.joinInfo.cid})}),this.signal.on(ir.IS_P2P_DISCONNECTED,e=>{e(Bn(this,ji.IS_P2P_DISCONNECTED))}),this.signal.on(ir.DISCONNECT_P2P,()=>{this.needToSendUnpubUnsub=new Lr,this.emit(ji.DISCONNECT_P2P)}),this.signal.on(ir.NEED_RENEW_SESSION,()=>{this.emit(ji.NEED_RENEW_SESSION)}),this.signal.on(ir.REQUEST_SUCCESS,()=>{this._signalTimeout=!1}),this.signal.on(ir.REQUEST_TIMEOUT,()=>{this._signalTimeout=!0})}}var $v=fi("iterator"),bd=!Jt(function(){var t=new URL("b?a=1&b=2&c=3","http://a"),e=t.searchParams,r="";return t.pathname="c%20d",e.forEach(function(i,n){e.delete("b"),r+=n+i}),!t.toJSON||!e.sort||t.href!=="http://a/c%20d?a=1&c=3"||e.get("c")!=="3"||String(new URLSearchParams("?a=1"))!=="a=1"||!e[$v]||new URL("https://a@b").username!=="a"||new URLSearchParams(new URLSearchParams("a=b")).get("a")!=="b"||new URL("http://\u0442\u0435\u0441\u0442").host!=="xn--e1aybc"||new URL("http://a#\u0431").hash!=="#%D0%B1"||r!=="a1c3"||new URL("http://x",void 0).host!=="x"}),em=/[^\0-\u007E]/,tm=/[.\u3002\uFF0E\uFF61]/g,hc=Math.floor,Od=String.fromCharCode,yA=function(t){return t+22+75*(26>t)},rm=function(t){for(var e,r=[],i=[],n=0,c=t.length;n<c;){var h=t.charCodeAt(n++);if(55296<=h&&56319>=h&&n<c){var C=t.charCodeAt(n++);(64512&C)==56320?i.push(((1023&h)<<10)+(1023&C)+65536):(i.push(h),n--)}else i.push(h)}n=(t=i).length,c=128;var x=0,Q=72;for(i=0;i<t.length;i++)128>(e=t[i])&&r.push(Od(e));for((C=h=r.length)&&r.push("-");C<n;){var F=2147483647;for(i=0;i<t.length;i++)(e=t[i])>=c&&e<F&&(F=e);var V=C+1;if(F-c>hc((2147483647-x)/V))throw RangeError("Overflow: input needs wider integers to process");for(x+=(F-c)*V,c=F,i=0;i<t.length;i++){if((e=t[i])<c&&2147483647<++x)throw RangeError("Overflow: input needs wider integers to process");if(e==c){var Y=x;for(F=36;;F+=36){var $=F<=Q?1:F>=Q+26?26:F-Q;if(Y<$)break;Y-=$;var te=36-$;r.push(Od(yA($+Y%te))),Y=hc(Y/te)}for(r.push(Od(yA(Y))),Q=V,F=0,x=C==h?hc(x/700):x>>1,x+=hc(x/Q);455<x;F+=36)x=hc(x/35);Q=hc(F+36*x/(x+38)),x=0,++C}}++x,++c}return r.join("")},IA=function(t){var e=Se(t);if(typeof e!="function")throw TypeError(String(t)+" is not iterable");return Hi(e.call(t))},SA=jn("fetch"),Bd=jn("Headers"),im=fi("iterator"),TA=Zt.set,Rs=Zt.getterFor("URLSearchParams"),nm=Zt.getterFor("URLSearchParamsIterator"),sm=/\+/g,RA=Array(4),om=function(t){return RA[t-1]||(RA[t-1]=RegExp("((?:%[\\da-f]{2}){"+t+"})","gi"))},am=function(t){try{return decodeURIComponent(t)}catch(e){return t}},wA=function(t){t=t.replace(sm," ");var e=4;try{return decodeURIComponent(t)}catch(r){for(;e;)t=t.replace(om(e--),am);return t}},LA=/[!'()~]|%20/g,cm={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},DA=function(t){return cm[t]},bA=function(t,e){if(e){var r,i;e=e.split("&");for(var n=0;n<e.length;)(r=e[n++]).length&&(i=r.split("="),t.push({key:wA(i.shift()),value:wA(i.join("="))}))}},lm=function(t){this.entries.length=0,bA(this.entries,t)},fc=function(t,e){if(t<e)throw TypeError("Not enough arguments")},Nd=oh(function(t,e){TA(this,{type:"URLSearchParamsIterator",iterator:IA(Rs(t).entries),kind:e})},"Iterator",function(){var t=nm(this),e=t.kind;t=t.iterator.next();var r=t.value;return t.done||(t.value=e==="keys"?r.key:e==="values"?r.value:[r.key,r.value]),t}),Zc=function(){we(this,Zc,"URLSearchParams");var t,e,r,i,n,c=0<arguments.length?arguments[0]:void 0,h=[];if(TA(this,{type:"URLSearchParams",entries:h,updateURL:function(){},updateSearchParams:lm}),c!==void 0)if(zr(c))if(typeof(t=Se(c))=="function")for(e=(t=t.call(c)).next;!(c=e.call(t)).done;){if((c=(i=(r=IA(Hi(c.value))).next).call(r)).done||(n=i.call(r)).done||!i.call(r).done)throw TypeError("Expected sequence with length 2");h.push({key:c.value+"",value:n.value+""})}else for(e in c)qt(c,e)&&h.push({key:e,value:c[e]+""});else bA(h,typeof c=="string"?c.charAt(0)==="?"?c.slice(1):c:c+"")},eu=Zc.prototype;Ko(eu,{append:function(t,e){fc(arguments.length,2);var r=Rs(this);r.entries.push({key:t+"",value:e+""}),r.updateURL()},delete:function(t){fc(arguments.length,1);for(var e=Rs(this),r=e.entries,i=t+"",n=0;n<r.length;)r[n].key===i?r.splice(n,1):n++;e.updateURL()},get:function(t){fc(arguments.length,1);for(var e=Rs(this).entries,r=t+"",i=0;i<e.length;i++)if(e[i].key===r)return e[i].value;return null},getAll:function(t){fc(arguments.length,1);for(var e=Rs(this).entries,r=t+"",i=[],n=0;n<e.length;n++)e[n].key===r&&i.push(e[n].value);return i},has:function(t){fc(arguments.length,1);for(var e=Rs(this).entries,r=t+"",i=0;i<e.length;)if(e[i++].key===r)return!0;return!1},set:function(t,e){fc(arguments.length,1);for(var r,i=Rs(this),n=i.entries,c=!1,h=t+"",C=e+"",x=0;x<n.length;x++)(r=n[x]).key===h&&(c?n.splice(x--,1):(c=!0,r.value=C));c||n.push({key:h,value:C}),i.updateURL()},sort:function(){var t,e,r=Rs(this),i=r.entries,n=i.slice();for(e=i.length=0;e<n.length;e++){var c=n[e];for(t=0;t<e;t++)if(i[t].key>c.key){i.splice(t,0,c);break}t===e&&i.push(c)}r.updateURL()},forEach:function(t){for(var e,r=Rs(this).entries,i=yn(t,1<arguments.length?arguments[1]:void 0,3),n=0;n<r.length;)i((e=r[n++]).value,e.key,this)},keys:function(){return new Nd(this,"keys")},values:function(){return new Nd(this,"values")},entries:function(){return new Nd(this,"entries")}},{enumerable:!0}),In(eu,im,eu.entries),In(eu,"toString",function(){for(var t,e=Rs(this).entries,r=[],i=0;i<e.length;)t=e[i++],r.push(encodeURIComponent(t.key).replace(LA,DA)+"="+encodeURIComponent(t.value).replace(LA,DA));return r.join("&")},{enumerable:!0}),je(Zc,"URLSearchParams"),Qt({global:!0,forced:!bd},{URLSearchParams:Zc}),bd||typeof SA!="function"||typeof Bd!="function"||Qt({global:!0,enumerable:!0,forced:!0},{fetch:function(t){var e,r,i,n=[t];return 1<arguments.length&&(zr(e=arguments[1])&&(r=e.body,de(r)==="URLSearchParams"&&((i=e.headers?new Bd(e.headers):new Bd).has("content-type")||i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),e=ys(e,{body:Xs(0,String(r)),headers:Xs(0,i)}))),n.push(e)),SA.apply(this,n)}});var $c=gt.URL,um=Zc,dm=Zt.set,Ti=Zt.getterFor("URL"),hm=Math.floor,OA=Math.pow,BA=/[A-Za-z]/,fm=/[\d+\-.A-Za-z]/,Pd=/\d/,Am=/^(0x|0X)/,gm=/^[0-7]+$/,pm=/^\d+$/,NA=/^[\dA-Fa-f]+$/,vm=/[\u0000\u0009\u000A\u000D #%/:?@[\\]]/,mm=/[\u0000\u0009\u000A\u000D #/:?@[\\]]/,Em=/^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g,_m=/[\u0009\u000A\u000D]/g,xd=function(t,e){var r,i;if(e.charAt(0)=="["){if(e.charAt(e.length-1)!="]"||!(r=ym(e.slice(1,-1))))return"Invalid host"}else if(gn(t)){var n=[],c=e.toLowerCase().replace(tm,".").split(".");for(i=0;i<c.length;i++){var h=c[i];n.push(em.test(h)?"xn--"+rm(h):h)}if(e=n.join("."),vm.test(e)||(r=Cm(e))===null)return"Invalid host"}else{if(mm.test(e))return"Invalid host";for(r="",e=ka(e),i=0;i<e.length;i++)r+=ma(e[i],tu)}t.host=r},Cm=function(t){var e,r,i,n,c=t.split(".");if(c.length&&c[c.length-1]==""&&c.pop(),4<(e=c.length))return t;var h=[];for(r=0;r<e;r++){if((i=c[r])=="")return t;if(n=10,1<i.length&&i.charAt(0)=="0"&&(n=Am.test(i)?16:8,i=i.slice(n==8?1:2)),i==="")i=0;else{if(!(n==10?pm:n==8?gm:NA).test(i))return t;i=parseInt(i,n)}h.push(i)}for(r=0;r<e;r++)if(i=h[r],r==e-1){if(i>=OA(256,5-e))return null}else if(255<i)return null;for(t=h.pop(),r=0;r<h.length;r++)t+=h[r]*OA(256,3-r);return t},ym=function(t){var e,r,i,n=[0,0,0,0,0,0,0,0],c=0,h=null,C=0,x=function(){return t.charAt(C)};if(x()==":"){if(t.charAt(1)!=":")return;C+=2,h=++c}for(;x();){if(c==8)return;if(x()!=":"){for(e=r=0;4>r&&NA.test(x());)e=16*e+parseInt(x(),16),C++,r++;if(x()=="."){if(r==0||(C-=r,6<c))return;for(e=0;x();){if(r=null,0<e){if(!(x()=="."&&4>e))return;C++}if(!Pd.test(x()))return;for(;Pd.test(x());){if(i=parseInt(x(),10),r===null)r=i;else{if(r==0)return;r=10*r+i}if(255<r)return;C++}n[c]=256*n[c]+r,++e!=2&&e!=4||c++}if(e!=4)return;break}if(x()==":"){if(C++,!x())return}else if(x())return;n[c++]=e}else{if(h!==null)return;C++,h=++c}}if(h!==null)for(x=c-h,c=7;c!=0&&0<x;)e=n[c],n[c--]=n[h+x-1],n[h+--x]=e;else if(c!=8)return;return n},el=function(t){var e,r;if(typeof t=="number"){var i=[];for(e=0;4>e;e++)i.unshift(t%256),t=hm(t/256);return i.join(".")}if(typeof t=="object"){i="",e=null;for(var n=1,c=null,h=0,C=0;8>C;C++)t[C]!==0?(h>n&&(e=c,n=h),c=null,h=0):(c===null&&(c=C),++h);for(n=(h>n&&(e=c),e),e=0;8>e;e++)r&&t[e]===0||(r&&(r=!1),n===e?(i+=e?":":"::",r=!0):(i+=t[e].toString(16),7>e&&(i+=":")));return"["+i+"]"}return t},tu={},PA=Fc({},tu,{" ":1,'"':1,"<":1,">":1,"`":1}),xA=Fc({},PA,{"#":1,"?":1,"{":1,"}":1}),Md=Fc({},xA,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),ma=function(t,e){var r=jg(t,0);return 32<r&&127>r&&!qt(e,t)?t:encodeURIComponent(t)},ru={ftp:21,file:null,http:80,https:443,ws:80,wss:443},gn=function(t){return qt(ru,t.scheme)},kd=function(t){return!t.host||t.cannotBeABaseURL||t.scheme=="file"},tl=function(t,e){var r;return t.length==2&&BA.test(t.charAt(0))&&((r=t.charAt(1))==":"||!e&&r=="|")},MA=function(t){var e;return 1<t.length&&tl(t.slice(0,2))&&(t.length==2||(e=t.charAt(2))==="/"||e==="\\"||e==="?"||e==="#")},kA=function(t){var e=t.path,r=e.length;!r||t.scheme=="file"&&r==1&&tl(e[0],!0)||e.pop()},Ud={},UA={},Fd={},FA={},QA={},Qd={},GA={},HA={},iu={},nu={},Gd={},Hd={},Kd={},jd={},KA={},Wd={},rl={},Io={},jA={},Ua={},zo={},So=function(t,e,r,i){var n,c,h=r||Ud,C=0,x="",Q=!1,F=!1,V=!1;for(r||(t.scheme="",t.username="",t.password="",t.host=null,t.port=null,t.path=[],t.query=null,t.fragment=null,t.cannotBeABaseURL=!1,e=e.replace(Em,"")),e=e.replace(_m,""),e=ka(e);C<=e.length;){switch(n=e[C],h){case Ud:if(!n||!BA.test(n)){if(r)return"Invalid scheme";h=Fd;continue}x+=n.toLowerCase(),h=UA;break;case UA:if(n&&(fm.test(n)||n=="+"||n=="-"||n=="."))x+=n.toLowerCase();else{if(n!=":"){if(r)return"Invalid scheme";x="",h=Fd,C=0;continue}if(r&&(gn(t)!=qt(ru,x)||x=="file"&&(t.username!=""||t.password!=""||t.port!==null)||t.scheme=="file"&&!t.host))return;if(t.scheme=x,r)return void(gn(t)&&ru[t.scheme]==t.port&&(t.port=null));x="",t.scheme=="file"?h=jd:gn(t)&&i&&i.scheme==t.scheme?h=FA:gn(t)?h=HA:e[C+1]=="/"?(h=QA,C++):(t.cannotBeABaseURL=!0,t.path.push(""),h=jA)}break;case Fd:if(!i||i.cannotBeABaseURL&&n!="#")return"Invalid scheme";if(i.cannotBeABaseURL&&n=="#"){t.scheme=i.scheme,t.path=i.path.slice(),t.query=i.query,t.fragment="",t.cannotBeABaseURL=!0,h=zo;break}h=i.scheme=="file"?jd:Qd;continue;case FA:if(n!="/"||e[C+1]!="/"){h=Qd;continue}h=iu,C++;break;case QA:if(n=="/"){h=nu;break}h=Io;continue;case Qd:if(t.scheme=i.scheme,n==null)t.username=i.username,t.password=i.password,t.host=i.host,t.port=i.port,t.path=i.path.slice(),t.query=i.query;else if(n=="/"||n=="\\"&&gn(t))h=GA;else if(n=="?")t.username=i.username,t.password=i.password,t.host=i.host,t.port=i.port,t.path=i.path.slice(),t.query="",h=Ua;else{if(n!="#"){t.username=i.username,t.password=i.password,t.host=i.host,t.port=i.port,t.path=i.path.slice(),t.path.pop(),h=Io;continue}t.username=i.username,t.password=i.password,t.host=i.host,t.port=i.port,t.path=i.path.slice(),t.query=i.query,t.fragment="",h=zo}break;case GA:if(!gn(t)||n!="/"&&n!="\\"){if(n!="/"){t.username=i.username,t.password=i.password,t.host=i.host,t.port=i.port,h=Io;continue}h=nu}else h=iu;break;case HA:if(h=iu,n!="/"||x.charAt(C+1)!="/")continue;C++;break;case iu:if(n!="/"&&n!="\\"){h=nu;continue}break;case nu:if(n=="@"){for(Q&&(x="%40"+x),Q=!0,x=ka(x),n=0;n<x.length;n++){var Y=x[n];Y!=":"||V?(Y=ma(Y,Md),V?t.password+=Y:t.username+=Y):V=!0}x=""}else if(n==null||n=="/"||n=="?"||n=="#"||n=="\\"&&gn(t)){if(Q&&x=="")return"Invalid authority";C-=ka(x).length+1,x="",h=Gd}else x+=n;break;case Gd:case Hd:if(r&&t.scheme=="file"){h=Wd;continue}if(n!=":"||F){if(n==null||n=="/"||n=="?"||n=="#"||n=="\\"&&gn(t)){if(gn(t)&&x=="")return"Invalid host";if(r&&x==""&&(t.username!=""||t.password!=""||t.port!==null))return;if(h=xd(t,x))return h;if(x="",h=rl,r)return;continue}n=="["?F=!0:n=="]"&&(F=!1),x+=n}else{if(x=="")return"Invalid host";if(h=xd(t,x))return h;if(x="",h=Kd,r==Hd)return}break;case Kd:if(!Pd.test(n)){if(n==null||n=="/"||n=="?"||n=="#"||n=="\\"&&gn(t)||r){if(x!=""){if(h=parseInt(x,10),65535<h)return"Invalid port";t.port=gn(t)&&h===ru[t.scheme]?null:h,x=""}if(r)return;h=rl;continue}return"Invalid port"}x+=n;break;case jd:if(t.scheme="file",n=="/"||n=="\\")h=KA;else{if(!i||i.scheme!="file"){h=Io;continue}if(n==null)t.host=i.host,t.path=i.path.slice(),t.query=i.query;else if(n=="?")t.host=i.host,t.path=i.path.slice(),t.query="",h=Ua;else{if(n!="#"){MA(e.slice(C).join(""))||(t.host=i.host,t.path=i.path.slice(),kA(t)),h=Io;continue}t.host=i.host,t.path=i.path.slice(),t.query=i.query,t.fragment="",h=zo}}break;case KA:if(n=="/"||n=="\\"){h=Wd;break}i&&i.scheme=="file"&&!MA(e.slice(C).join(""))&&(tl(i.path[0],!0)?t.path.push(i.path[0]):t.host=i.host),h=Io;continue;case Wd:if(n==null||n=="/"||n=="\\"||n=="?"||n=="#"){if(!r&&tl(x))h=Io;else{if(x==""){if(t.host="",r)return}else{if(h=xd(t,x))return h;if(t.host=="localhost"&&(t.host=""),r)return;x=""}h=rl}continue}x+=n;break;case rl:if(gn(t)){if(h=Io,n!="/"&&n!="\\")continue}else if(r||n!="?")if(r||n!="#"){if(n!=null&&(h=Io,n!="/"))continue}else t.fragment="",h=zo;else t.query="",h=Ua;break;case Io:if(n==null||n=="/"||n=="\\"&&gn(t)||!r&&(n=="?"||n=="#")){if((c=(c=x).toLowerCase())===".."||c==="%2e."||c===".%2e"||c==="%2e%2e"?(kA(t),n=="/"||n=="\\"&&gn(t)||t.path.push("")):x==="."||x.toLowerCase()==="%2e"?n=="/"||n=="\\"&&gn(t)||t.path.push(""):(t.scheme=="file"&&!t.path.length&&tl(x)&&(t.host&&(t.host=""),x=x.charAt(0)+":"),t.path.push(x)),x="",t.scheme=="file"&&(n==null||n=="?"||n=="#"))for(;1<t.path.length&&t.path[0]==="";)t.path.shift();n=="?"?(t.query="",h=Ua):n=="#"&&(t.fragment="",h=zo)}else x+=ma(n,xA);break;case jA:n=="?"?(t.query="",h=Ua):n=="#"?(t.fragment="",h=zo):n!=null&&(t.path[0]+=ma(n,tu));break;case Ua:r||n!="#"?n!=null&&(n=="'"&&gn(t)?t.query+="%27":t.query+=n=="#"?"%23":ma(n,tu)):(t.fragment="",h=zo);break;case zo:n!=null&&(t.fragment+=ma(n,PA))}C++}},Fa=function(t){var e=we(this,Fa,"URL"),r=1<arguments.length?arguments[1]:void 0,i=String(t),n=dm(e,{type:"URL"});if(r!==void 0){if(r instanceof Fa)var c=Ti(r);else if(r=So(c={},String(r)))throw TypeError(r)}if(r=So(n,i,null,c))throw TypeError(r);var h=n.searchParams=new um;c=Rs(h),c.updateSearchParams(n.query),c.updateURL=function(){n.query=String(h)||null},kr||(e.href=su.call(e),e.origin=WA.call(e),e.protocol=VA.call(e),e.username=YA.call(e),e.password=JA.call(e),e.host=zA.call(e),e.hostname=qA.call(e),e.port=XA.call(e),e.pathname=ZA.call(e),e.search=$A.call(e),e.searchParams=eg.call(e),e.hash=tg.call(e))},Vd=Fa.prototype,su=function(){var t=Ti(this),e=t.scheme,r=t.username,i=t.password,n=t.host,c=t.port,h=t.path,C=t.query,x=t.fragment,Q=e+":";return n!==null?(Q+="//",(t.username!=""||t.password!="")&&(Q+=r+(i?":"+i:"")+"@"),Q+=el(n),c!==null&&(Q+=":"+c)):e=="file"&&(Q+="//"),Q+=t.cannotBeABaseURL?h[0]:h.length?"/"+h.join("/"):"",C!==null&&(Q+="?"+C),x!==null&&(Q+="#"+x),Q},WA=function(){var t=Ti(this),e=t.scheme,r=t.port;if(e=="blob")try{return new URL(e.path[0]).origin}catch(i){return"null"}return e!="file"&&gn(t)?e+"://"+el(t.host)+(r!==null?":"+r:""):"null"},VA=function(){return Ti(this).scheme+":"},YA=function(){return Ti(this).username},JA=function(){return Ti(this).password},zA=function(){var t=Ti(this),e=t.host;return t=t.port,e===null?"":t===null?el(e):el(e)+":"+t},qA=function(){var t=Ti(this).host;return t===null?"":el(t)},XA=function(){var t=Ti(this).port;return t===null?"":String(t)},ZA=function(){var t=Ti(this),e=t.path;return t.cannotBeABaseURL?e[0]:e.length?"/"+e.join("/"):""},$A=function(){var t=Ti(this).query;return t?"?"+t:""},eg=function(){return Ti(this).searchParams},tg=function(){var t=Ti(this).fragment;return t?"#"+t:""},Ws=function(t,e){return{get:t,set:e,configurable:!0,enumerable:!0}};if(kr&&ft(Vd,{href:Ws(su,function(t){var e=Ti(this);if(t=So(e,String(t)))throw TypeError(t);Rs(e.searchParams).updateSearchParams(e.query)}),origin:Ws(WA),protocol:Ws(VA,function(t){var e=Ti(this);So(e,String(t)+":",Ud)}),username:Ws(YA,function(t){var e=Ti(this);if(t=ka(String(t)),!kd(e)){e.username="";for(var r=0;r<t.length;r++)e.username+=ma(t[r],Md)}}),password:Ws(JA,function(t){var e=Ti(this);if(t=ka(String(t)),!kd(e)){e.password="";for(var r=0;r<t.length;r++)e.password+=ma(t[r],Md)}}),host:Ws(zA,function(t){var e=Ti(this);e.cannotBeABaseURL||So(e,String(t),Gd)}),hostname:Ws(qA,function(t){var e=Ti(this);e.cannotBeABaseURL||So(e,String(t),Hd)}),port:Ws(XA,function(t){var e=Ti(this);kd(e)||((t=String(t))==""?e.port=null:So(e,t,Kd))}),pathname:Ws(ZA,function(t){var e=Ti(this);e.cannotBeABaseURL||(e.path=[],So(e,t+"",rl))}),search:Ws($A,function(t){var e=Ti(this);(t=String(t))==""?e.query=null:(t.charAt(0)=="?"&&(t=t.slice(1)),e.query="",So(e,t,Ua)),Rs(e.searchParams).updateSearchParams(e.query)}),searchParams:Ws(eg),hash:Ws(tg,function(t){var e=Ti(this);(t=String(t))!=""?(t.charAt(0)=="#"&&(t=t.slice(1)),e.fragment="",So(e,t,zo)):e.fragment=null})}),In(Vd,"toJSON",function(){return su.call(this)},{enumerable:!0}),In(Vd,"toString",function(){return su.call(this)},{enumerable:!0}),$c){var rg=$c.createObjectURL,ig=$c.revokeObjectURL;rg&&In(Fa,"createObjectURL",function(t){return rg.apply($c,arguments)}),ig&&In(Fa,"revokeObjectURL",function(t){return ig.apply($c,arguments)})}je(Fa,"URL"),Qt({global:!0,forced:!bd,sham:!kr},{URL:Fa});var Im=Br.URL;(function(){function t(Ce){var Ne=0;return function(){return Ne<Ce.length?{done:!1,value:Ce[Ne++]}:{done:!0}}}function e(Ce,Ne){if(Ne)e:{var Je=te;Ce=Ce.split(".");for(var at=0;at<Ce.length-1;at++){var ct=Ce[at];if(!(ct in Je))break e;Je=Je[ct]}(Ne=Ne(at=Je[Ce=Ce[Ce.length-1]]))!=at&&Ne!=null&&$(Je,Ce,{configurable:!0,writable:!0,value:Ne})}}function r(Ce){return(Ce={next:Ce})[Symbol.iterator]=function(){return this},Ce}function i(Ce){var Ne=typeof Symbol!="undefined"&&Symbol.iterator&&Ce[Symbol.iterator];return Ne?Ne.call(Ce):{next:t(Ce)}}function n(){this.m=!1,this.j=null,this.v=void 0,this.h=1,this.u=this.C=0,this.l=null}function c(Ce){if(Ce.m)throw new TypeError("Generator is already running");Ce.m=!0}function h(Ce,Ne){return Ce.h=3,{value:Ne}}function C(Ce){this.g=new n,this.G=Ce}function x(Ce,Ne,Je,at){try{var ct=Ne.call(Ce.g.j,Je);if(!(ct instanceof Object))throw new TypeError("Iterator result "+ct+" is not an object");if(!ct.done)return Ce.g.m=!1,ct;var Ut=ct.value}catch(St){return Ce.g.j=null,Ce.g.s(St),Q(Ce)}return Ce.g.j=null,at.call(Ce.g,Ut),Q(Ce)}function Q(Ce){for(;Ce.g.h;)try{var Ne=Ce.G(Ce.g);if(Ne)return Ce.g.m=!1,{value:Ne.value,done:!1}}catch(Je){Ce.g.v=void 0,Ce.g.s(Je)}if(Ce.g.m=!1,Ce.g.l){if(Ne=Ce.g.l,Ce.g.l=null,Ne.F)throw Ne.D;return{value:Ne.return,done:!0}}return{value:void 0,done:!0}}function F(Ce){this.next=function(Ne){return Ce.o(Ne)},this.throw=function(Ne){return Ce.s(Ne)},this.return=function(Ne){return function(Je,at){c(Je.g);var ct=Je.g.j;return ct?x(Je,"return"in ct?ct.return:function(Ut){return{value:Ut,done:!0}},at,Je.g.return):(Je.g.return(at),Q(Je))}(Ce,Ne)},this[Symbol.iterator]=function(){return this}}function V(Ce,Ne){return Ne=new F(new C(Ne)),Me&&Ce.prototype&&Me(Ne,Ce.prototype),Ne}var Y,$=typeof Object.defineProperties=="function"?Object.defineProperty:function(Ce,Ne,Je){return Ce==Array.prototype||Ce==Object.prototype||(Ce[Ne]=Je.value),Ce},te=function(Ce){Ce=[typeof globalThis=="object"&&globalThis,Ce,typeof window=="object"&&window,typeof self=="object"&&self,typeof oa=="object"&&oa];for(var Ne=0;Ne<Ce.length;++Ne){var Je=Ce[Ne];if(Je&&Je.Math==Math)return Je}throw Error("Cannot find global object")}(this);if(e("Symbol",function(Ce){function Ne(ct,Ut){this.A=ct,$(this,"description",{configurable:!0,writable:!0,value:Ut})}if(Ce)return Ce;Ne.prototype.toString=function(){return this.A};var Je="jscomp_symbol_"+(1e9*Math.random()>>>0)+"_",at=0;return function ct(Ut){if(this instanceof ct)throw new TypeError("Symbol is not a constructor");return new Ne(Je+(Ut||"")+"_"+at++,Ut)}}),e("Symbol.iterator",function(Ce){if(Ce)return Ce;Ce=Symbol("Symbol.iterator");for(var Ne="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),Je=0;Je<Ne.length;Je++){var at=te[Ne[Je]];typeof at=="function"&&typeof at.prototype[Ce]!="function"&&$(at.prototype,Ce,{configurable:!0,writable:!0,value:function(){return r(t(this))}})}return Ce}),typeof Object.setPrototypeOf=="function")var ce=Object.setPrototypeOf;else{e:{var Ae={};try{Ae.__proto__={a:!0},ce=Ae.a;break e}catch(Ce){}ce=!1}ce=ce?function(Ce,Ne){if(Ce.__proto__=Ne,Ce.__proto__!==Ne)throw new TypeError(Ce+" is not extensible");return Ce}:null}var Me=ce;if(n.prototype.o=function(Ce){this.v=Ce},n.prototype.s=function(Ce){this.l={D:Ce,F:!0},this.h=this.C||this.u},n.prototype.return=function(Ce){this.l={return:Ce},this.h=this.u},C.prototype.o=function(Ce){return c(this.g),this.g.j?x(this,this.g.j.next,Ce,this.g.o):(this.g.o(Ce),Q(this))},C.prototype.s=function(Ce){return c(this.g),this.g.j?x(this,this.g.j.throw,Ce,this.g.o):(this.g.s(Ce),Q(this))},e("Array.prototype.entries",function(Ce){return Ce||function(){return function(Ne,Je){Ne instanceof String&&(Ne+="");var at=0,ct=!1,Ut={next:function(){if(!ct&&at<Ne.length){var St=at++;return{value:Je(St,Ne[St]),done:!1}}return ct=!0,{done:!0,value:void 0}}};return Ut[Symbol.iterator]=function(){return Ut},Ut}(this,function(Ne,Je){return[Ne,Je]})}}),typeof Blob!="undefined"&&(typeof FormData=="undefined"||!FormData.prototype.keys)){var et=function(Ce,Ne){for(var Je=0;Je<Ce.length;Je++)Ne(Ce[Je])},vt=function(Ce){return Ce.replace(/\r?\n|\r/g,`\r
112
- `)},kt=function(Ce,Ne,Je){return Ne instanceof Blob?(Je=Je!==void 0?String(Je+""):typeof Ne.name=="string"?Ne.name:"blob",Ne.name===Je&&Object.prototype.toString.call(Ne)!=="[object Blob]"||(Ne=new File([Ne],Je)),[String(Ce),Ne]):[String(Ce),String(Ne)]},Pt=function(Ce,Ne){if(Ce.length<Ne)throw new TypeError(Ne+" argument required, but only "+Ce.length+" present.")};ce=typeof globalThis=="object"?globalThis:typeof window=="object"?window:typeof self=="object"?self:this;var Dr=ce.FormData,Et=ce.XMLHttpRequest&&ce.XMLHttpRequest.prototype.send,nr=ce.Request&&ce.fetch,Tr=ce.navigator&&ce.navigator.sendBeacon;Ae=ce.Element&&ce.Element.prototype;var ui=ce.Symbol&&Symbol.toStringTag;ui&&(Blob.prototype[ui]||(Blob.prototype[ui]="Blob"),"File"in ce&&!File.prototype[ui]&&(File.prototype[ui]="File"));try{new File([],"")}catch(Ce){ce.File=function(Ne,Je,at){return Ne=new Blob(Ne,at||{}),Object.defineProperties(Ne,{name:{value:Je},lastModified:{value:+(at&&at.lastModified!==void 0?new Date(at.lastModified):new Date)},toString:{value:function(){return"[object File]"}}}),ui&&Object.defineProperty(Ne,ui,{value:"File"}),Ne}}var zi=function(Ce){return Ce.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22")},Wr=function(Ce){this.i=[];var Ne=this;Ce&&et(Ce.elements,function(Je){if(Je.name&&!Je.disabled&&Je.type!=="submit"&&Je.type!=="button"&&!Je.matches("form fieldset[disabled] *"))if(Je.type==="file"){var at=Je.files&&Je.files.length?Je.files:[new File([],"",{type:"application/octet-stream"})];et(at,function(ct){Ne.append(Je.name,ct)})}else Je.type==="select-multiple"||Je.type==="select-one"?et(Je.options,function(ct){!ct.disabled&&ct.selected&&Ne.append(Je.name,ct.value)}):Je.type==="checkbox"||Je.type==="radio"?Je.checked&&Ne.append(Je.name,Je.value):(at=Je.type==="textarea"?vt(Je.value):Je.value,Ne.append(Je.name,at))})};if((Y=Wr.prototype).append=function(Ce,Ne,Je){Pt(arguments,2),this.i.push(kt(Ce,Ne,Je))},Y.delete=function(Ce){Pt(arguments,1);var Ne=[];Ce=String(Ce),et(this.i,function(Je){Je[0]!==Ce&&Ne.push(Je)}),this.i=Ne},Y.entries=function Ce(){var Ne,Je=this;return V(Ce,function(at){if(at.h==1&&(Ne=0),at.h!=3)return Ne<Je.i.length?at=h(at,Je.i[Ne]):(at.h=0,at=void 0),at;Ne++,at.h=2})},Y.forEach=function(Ce,Ne){Pt(arguments,1);for(var Je=i(this),at=Je.next();!at.done;at=Je.next()){var ct=i(at.value);at=ct.next().value,ct=ct.next().value,Ce.call(Ne,ct,at,this)}},Y.get=function(Ce){Pt(arguments,1);var Ne=this.i;Ce=String(Ce);for(var Je=0;Je<Ne.length;Je++)if(Ne[Je][0]===Ce)return Ne[Je][1];return null},Y.getAll=function(Ce){Pt(arguments,1);var Ne=[];return Ce=String(Ce),et(this.i,function(Je){Je[0]===Ce&&Ne.push(Je[1])}),Ne},Y.has=function(Ce){Pt(arguments,1),Ce=String(Ce);for(var Ne=0;Ne<this.i.length;Ne++)if(this.i[Ne][0]===Ce)return!0;return!1},Y.keys=function Ce(){var Ne,Je,at,ct,Ut=this;return V(Ce,function(St){if(St.h==1&&(Ne=i(Ut),Je=Ne.next()),St.h!=3)return Je.done?void(St.h=0):(at=Je.value,ct=i(at),h(St,ct.next().value));Je=Ne.next(),St.h=2})},Y.set=function(Ce,Ne,Je){Pt(arguments,2),Ce=String(Ce);var at=[],ct=kt(Ce,Ne,Je),Ut=!0;et(this.i,function(St){St[0]===Ce?Ut&&(Ut=!at.push(ct)):at.push(St)}),Ut&&at.push(ct),this.i=at},Y.values=function Ce(){var Ne,Je,at,ct,Ut=this;return V(Ce,function(St){if(St.h==1&&(Ne=i(Ut),Je=Ne.next()),St.h!=3)return Je.done?void(St.h=0):(at=Je.value,(ct=i(at)).next(),h(St,ct.next().value));Je=Ne.next(),St.h=2})},Wr.prototype._asNative=function(){for(var Ce=new Dr,Ne=i(this),Je=Ne.next();!Je.done;Je=Ne.next()){var at=i(Je.value);Je=at.next().value,at=at.next().value,Ce.append(Je,at)}return Ce},Wr.prototype._blob=function(){var Ce="----formdata-polyfill-"+Math.random(),Ne=[],Je="--"+Ce+`\r
113
- Content-Disposition: form-data; name="`;return this.forEach(function(at,ct){return typeof at=="string"?Ne.push(Je+zi(vt(ct))+`"\r
114
- \r
115
- `+vt(at)+`\r
116
- `):Ne.push(Je+zi(vt(ct))+'"; filename="'+zi(at.name)+`"\r
117
- Content-Type: `+(at.type||"application/octet-stream")+`\r
118
- \r
119
- `,at,`\r
120
- `)}),Ne.push("--"+Ce+"--"),new Blob(Ne,{type:"multipart/form-data; boundary="+Ce})},Wr.prototype[Symbol.iterator]=function(){return this.entries()},Wr.prototype.toString=function(){return"[object FormData]"},Ae&&!Ae.matches&&(Ae.matches=Ae.matchesSelector||Ae.mozMatchesSelector||Ae.msMatchesSelector||Ae.oMatchesSelector||Ae.webkitMatchesSelector||function(Ce){for(var Ne=(Ce=(this.document||this.ownerDocument).querySelectorAll(Ce)).length;0<=--Ne&&Ce.item(Ne)!==this;);return-1<Ne}),ui&&(Wr.prototype[ui]="FormData"),Et){var Rn=ce.XMLHttpRequest.prototype.setRequestHeader;ce.XMLHttpRequest.prototype.setRequestHeader=function(Ce,Ne){Rn.call(this,Ce,Ne),Ce.toLowerCase()==="content-type"&&(this.B=!0)},ce.XMLHttpRequest.prototype.send=function(Ce){Ce instanceof Wr?(Ce=Ce._blob(),this.B||this.setRequestHeader("Content-Type",Ce.type),Et.call(this,Ce)):Et.call(this,Ce)}}nr&&(ce.fetch=function(Ce,Ne){return Ne&&Ne.body&&Ne.body instanceof Wr&&(Ne.body=Ne.body._blob()),nr.call(this,Ce,Ne)}),Tr&&(ce.navigator.sendBeacon=function(Ce,Ne){return Ne instanceof Wr&&(Ne=Ne._asNative()),Tr.call(this,Ce,Ne)}),ce.FormData=Wr}})();let Yd=1,Jd=1,ng=(t,e,r,i,n)=>{var c,h,C;const x=[];if(Re(c=t.response_body).call(c,Q=>{var F=Q.buffer.code;F!==0&&(F=Pi(F),Q={error:new ue(oe.CAN_NOT_GET_GATEWAY_SERVER,F.desc,{retry:F.retry,csIp:t.detail[502]}),flag:Q.buffer.flag},x.push(Q),Q.flag===4096?Qe.joinChooseServer(r.sid,{lts:i,succ:!1,csAddr:e,opid:t.opid,serverList:null,ec:Q.error.message,csIp:Q.error.data&&Q.error.data.csIp,unilbsServerIds:n.toString()}):Q.flag!==1048576&&Q.flag!==4194304||Qe.joinWebProxyAP(r.sid,{lts:i,sucess:0,apServerAddr:e,turnServerAddrList:null,errorCode:Q.error.code,eventType:r.cloudProxyServer,unilbsServerIds:n.toString()}))}),x.length)throw z.warning(ne(h=ne(C="[".concat(r.clientId,"] multi unilbs ")).call(C,e," failed, ")).call(h,yt(x).call(x,Q=>{var F,V;return ne(F=ne(V="flag: ".concat(Q.flag,", message: ")).call(V,Q.error.message,", retry: ")).call(F,Q.error.data.retry)}).join(" | "))),new ue(oe.CAN_NOT_GET_GATEWAY_SERVER,yt(x).call(x,Q=>{var F;return ne(F="flag: ".concat(Q.flag,", message: ")).call(F,Q.error.message)}).join(" | "),{retry:!!tr(x).call(x,Q=>Q.error.data.retry),csIp:t.detail[502]})},sg=t=>{if(t.addresses&&t.addresses.length===0&&t.code===0)throw new ue(oe.CAN_NOT_GET_GATEWAY_SERVER,"void gateway address",{retry:!0,csIp:t.detail&&t.detail[502]});if(Xe.GATEWAY_ADDRESS&&0<Xe.GATEWAY_ADDRESS.length){var e;z.debug("assign gateway address to",Xe.GATEWAY_ADDRESS);const r=yt(e=Xe.GATEWAY_ADDRESS).call(e,i=>({ip:i.ip,port:i.port,ticket:t.addresses[0]&&t.addresses[0].ticket}));t.addresses=r}},og=(t,e,r)=>{var i;const n=Math.floor(1e12*Math.random());return e={appid:t.appId,client_ts:ot(),opid:n,sid:t.sid,request_bodies:[{uri:22,buffer:{cname:t.cname,detail:{6:t.stringUid,11:e},key:t.token,service_ids:r,uid:t.uid||0}}]},Re(i=e.request_bodies).call(i,c=>{t.multiIP&&t.multiIP.gateway_ip&&(c.buffer.detail[5]=ht({vocs_ip:[t.multiIP.uni_lbs_ip],vos_ip:[t.multiIP.gateway_ip]}))}),i=new FormData,i.append("request",ht(e)),[i,n]},il=()=>{const t=Xe.AREAS;return t.length===0&&t.push("GLOBAL"),Ml(t).call(t,(e,r,i)=>{var n,c,h,C,x;r=r==="OVERSEA"?ne(n=ne(c=ne(h=ne(C=ne(x="".concat(Wi.ASIA,",")).call(x,Wi.EUROPE,",")).call(C,Wi.AFRICA,",")).call(h,Wi.NORTH_AMERICA,",")).call(c,Wi.SOUTH_AMERICA,",")).call(n,Wi.OCEANIA):Wi[r];var Q;return r?i===0?r:ne(Q="".concat(e,",")).call(Q,r):e},"")};var ou={ASIA:["CHINA","JAPAN","INDIA"],EUROPE:[],NORTH_AMERICA:[],SOUTH_AMERICA:[],OCEANIA:[],AFRICA:[]};let Ac=Er(ou),au="CHINA NORTH_AMERICA EUROPE ASIA JAPAN INDIA OCEANIA SOUTH_AMERICA AFRICA".split(" "),Sm=function(t,e){var r=[];if(Ir(t).call(t,"GLOBAL")){r=["GLOBAL","OVERSEA"];const n=Er(dd);if(e==="GLOBAL")throw new ue(oe.INVALID_PARAMS,"GLOBAL is an invalid excludedArea value");if(e==="CHINA")r=["OVERSEA"];else if(i=e,Ir(Ac).call(Ac,i)){t=ou[e]||[];const c=[...r,e,...t];r=Gt(n).call(n,h=>!Ir(c).call(c,h))}else if(function(c){let h=!1;return Re(Ac).call(Ac,C=>{var x;Ir(x=ou[C]).call(x,c)&&(h=!0)}),h}(e)){t=function(h){let C;return Re(Ac).call(Ac,x=>{var Q;Ir(Q=ou[x]).call(Q,h)&&(C=x)}),C}(e);const c=[...r,t,e];r=Gt(n).call(n,h=>!Ir(c).call(c,h))}else r=t;r=function(c){const h=[];return Re(au).call(au,C=>{Ir(c).call(c,C)&&h.push(C)}),ne(h).call(h,Gt(c).call(c,C=>!Ir(au).call(au,C)))}(r)}else r=t;var i;return r};class Tm extends An{constructor(){super();this.retryConfig={timeout:3e3,timeoutFactor:1.5,maxRetryCount:1,maxRetryTimeout:1e4},this.mutex=new Yo("config-distribute")}startGetConfigDistribute(e,r){this.joinInfo=e,this.cancelToken=r,this.interval&&this.stopGetConfigDistribute(),this.updateConfigDistribute(),this.interval=window.setInterval(()=>{this.updateConfigDistribute()},Xe.CONFIG_DISTRIBUTE_INTERVAL)}stopGetConfigDistribute(){this.interval&&clearInterval(this.interval),this.cancelToken=this.joinInfo=this.interval=void 0}awaitConfigDistributeComplete(){return Ee(this,null,function*(){this.mutex.isLocked&&(yield this.mutex.lock())()})}updateConfigDistribute(){return Ee(this,null,function*(){if(!this.joinInfo||!this.cancelToken||!this.retryConfig)return void z.debug("[config-distribute] get config distribute interrupted have no joininfo");let e,r=yield this.mutex.lock();try{e=yield Nn(this.joinInfo,this.cancelToken,this.retryConfig),z.debug("[config-distribute] get config distribute",ht(e)),e.limit_bitrate&&this.handleBitrateLimit(e.limit_bitrate),this.configs=e}catch(i){let n=new ue(oe.NETWORK_RESPONSE_ERROR,i);z.warning("[config-distribute] ".concat(n.toString()))}finally{r()}})}getBitrateLimit(){return this.configs?this.configs.limit_bitrate:void 0}handleBitrateLimit(e){e&&e.uplink&&e.id&&e.uplink.max_bitrate!==void 0&&e.uplink.min_bitrate!==void 0&&(this.configs&&this.configs.limit_bitrate?this.configs&&this.configs.limit_bitrate&&this.configs.limit_bitrate.id!==e.id&&this.emit(Jc.UPDATE_BITRATE_LIMIT,e):this.emit(Jc.UPDATE_BITRATE_LIMIT,e))}getLowStreamConfigDistribute(){return this.configs&&this.configs.limit_bitrate&&function(e){for(var r=1;r<arguments.length;r++){var i,n=arguments[r]!=null?arguments[r]:{};if(r%2)Re(i=dl(Object(n),!0)).call(i,function(h){Un(e,h,n[h])});else if(Fr)Mn(e,Fr(n));else{var c;Re(c=dl(Object(n))).call(c,function(h){_r(e,h,gr(n,h))})}}return e}({},this.configs.limit_bitrate.low_stream_uplink)}}var zd=function(){function t(e){this.input=[],this.size=e}return t.prototype.add=function(e){this.input.push(e),this.input.length>this.size&&this.input.splice(0,1)},t.prototype.diffMean=function(){return this.input.length===0?0:(this.input[this.input.length-1]-this.input[0])/this.input.length},t}(),ag=function(t,e){return(ag=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])})(t,e)},qd=function(){return(qd=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)},Ea,nl={timestamp:0,bitrate:{actualEncoded:0,transmit:0},sendPacketLossRate:0,recvPacketLossRate:0,videoRecv:[],videoSend:[],audioRecv:[],audioSend:[]},cg={firsCount:0,nacksCount:0,plisCount:0,framesDecodeCount:0,framesDecodeInterval:0,framesDecodeFreezeTime:0,decodeFrameRate:0,bytes:0,packetsLost:0,packetLostRate:0,packets:0,ssrc:0},lg={firsCount:0,nacksCount:0,plisCount:0,frameCount:0,bytes:0,packets:0,packetsLost:0,packetLostRate:0,ssrc:0,rttMs:0},ug={bytes:0,packets:0,packetsLost:0,packetLostRate:0,ssrc:0,rttMs:0},dg={jitterBufferMs:0,jitterMs:0,bytes:0,packetsLost:0,packetLostRate:0,packets:0,ssrc:0,receivedFrames:0,droppedFrames:0},Xd=function(){function t(e,r){var i=this;this.videoIsReady=!1,this.stats=is(nl),this.isFirstAudioDecoded=this.isFirstAudioReceived=this.isFirstVideoDecoded=this.isFirstVideoReceived=!1,this.lossRateWindowStats=[],this.pc=e,this.options=r,this.intervalTimer=window.setInterval(function(){return Cc(i,void 0,void 0,function(){return wr(this,function(n){return this.updateStats(),[2]})})},this.options.updateInterval)}return t.prototype.getStats=function(){return this.stats},t.prototype.setVideoIsReady=function(e){this.videoIsReady=e},t.prototype.setIsFirstAudioDecoded=function(e){this.isFirstAudioDecoded=e},t.prototype.destroy=function(){window.clearInterval(this.intervalTimer),this.pc=void 0},t.prototype.calcLossRate=function(e){var r=this;this.lossRateWindowStats.push(e),this.lossRateWindowStats.length>this.options.lossRateInterval&&this.lossRateWindowStats.splice(0,1);for(var i=this.lossRateWindowStats.length,n=0,c=0,h=0,C=0,x=function(V){e[V].forEach(function(Y,$){if(r.lossRateWindowStats[i-1][V][$]&&r.lossRateWindowStats[0][V][$]){var te=r.lossRateWindowStats[i-1][V][$].packets-r.lossRateWindowStats[0][V][$].packets;$=r.lossRateWindowStats[i-1][V][$].packetsLost-r.lossRateWindowStats[0][V][$].packetsLost,V==="videoSend"||V==="audioSend"?(n+=te,h+=$):(c+=te,C+=$),Number.isNaN(te)||Number.isNaN(te)?Y.packetLostRate=0:Y.packetLostRate=0>=te||0>=$?0:$/(te+$)}})},Q=0,F=["videoSend","audioSend","videoRecv","audioRecv"];Q<F.length;Q++)x(F[Q]);e.sendPacketLossRate=0>=n||0>=h?0:h/(n+h),e.recvPacketLossRate=0>=c||0>=C?0:C/(c+C)},t}(),Rm=function(t){function e(){var r=t!==null&&t.apply(this,arguments)||this;return r._stats=nl,r.lastDecodeVideoReceiverStats=new Map,r}return Ta(e,t),e.prototype.updateStats=function(){return Cc(this,void 0,void 0,function(){var r,i,n,c;return wr(this,function(h){switch(h.label){case 0:return[4,this._getStats()];case 1:return r=h.sent(),i=this.statsResponsesToObjects(r),this._stats=is(nl),n=i.filter(function(C){return C.type==="ssrc"}),this.processSSRCStats(n),(c=i.find(function(C){return C.type==="VideoBwe"}))&&this.processBandwidthStats(c),this._stats.timestamp=Date.now(),this.calcLossRate(this._stats),this.stats=this._stats,[2]}})})},e.prototype.processBandwidthStats=function(r){this._stats.bitrate={actualEncoded:Number(r.googActualEncBitrate),targetEncoded:Number(r.googTargetEncBitrate),retransmit:Number(r.googRetransmitBitrate),transmit:Number(r.googTransmitBitrate)},this._stats.sendBandwidth=Number(r.googAvailableSendBandwidth)},e.prototype.processSSRCStats=function(r){var i=this;r.forEach(function(n){var c=n.id.includes("send");switch(n.mediaType+"_"+(c?"send":"recv")){case"video_send":c=is(lg),c.codec=n.googCodecName,c.adaptionChangeReason="none",n.googCpuLimitedResolution&&(c.adaptionChangeReason="cpu"),n.googBandwidthLimitedResolution&&(c.adaptionChangeReason="bandwidth"),c.avgEncodeMs=Number(n.googAvgEncodeMs),c.inputFrame={width:Number(n.googFrameWidthInput)||Number(n.googFrameWidthSent),height:Number(n.googFrameHeightInput)||Number(n.googFrameHeightSent),frameRate:Number(n.googFrameRateInput)},c.sentFrame={width:Number(n.googFrameWidthSent),height:Number(n.googFrameHeightSent),frameRate:Number(n.googFrameRateInput)},c.firsCount=Number(n.googFirReceived),c.nacksCount=Number(n.googNacksReceived),c.plisCount=Number(n.googPlisReceived),c.frameCount=Number(n.framesEncoded),c.bytes=Number(n.bytesSent),c.packets=Number(n.packetsSent),c.packetsLost=Number(n.packetsLost),c.ssrc=Number(n.ssrc),c.rttMs=Number(n.googRtt||0),i._stats.videoSend.push(c),i._stats.rtt=c.rttMs;break;case"video_recv":c=is(cg);var h=i.lastDecodeVideoReceiverStats.get(Number(n.ssrc));if(c.codec=n.googCodecName,c.targetDelayMs=Number(n.googTargetDelayMs),c.renderDelayMs=Number(n.googRenderDelayMs),c.currentDelayMs=Number(n.googCurrentDelayMs),c.minPlayoutDelayMs=Number(n.googMinPlayoutDelayMs),c.decodeMs=Number(n.googDecodeMs),c.maxDecodeMs=Number(n.googMaxDecodeMs),c.receivedFrame={width:Number(n.googFrameWidthReceived),height:Number(n.googFrameHeightReceived),frameRate:Number(n.googFrameRateReceived)},c.decodedFrame={width:Number(n.googFrameWidthReceived),height:Number(n.googFrameHeightReceived),frameRate:Number(n.googFrameRateDecoded)},c.outputFrame={width:Number(n.googFrameWidthReceived),height:Number(n.googFrameHeightReceived),frameRate:Number(n.googFrameRateOutput)},c.jitterBufferMs=Number(n.googJitterBufferMs),c.firsCount=Number(n.googFirsSent),c.nacksCount=Number(n.googNacksSent),c.plisCount=Number(n.googPlisSent),c.framesDecodeCount=Number(n.framesDecoded),c.bytes=Number(n.bytesReceived),c.packets=Number(n.packetsReceived),c.packetsLost=Number(n.packetsLost),c.ssrc=Number(n.ssrc),0<c.packets&&!i.isFirstVideoReceived&&(i.onFirstVideoReceived&&i.onFirstVideoReceived(),i.isFirstVideoReceived=!0),0<c.framesDecodeCount&&!i.isFirstVideoDecoded&&(i.onFirstVideoDecoded&&i.onFirstVideoDecoded(c.decodedFrame.width,c.decodedFrame.height),i.isFirstVideoDecoded=!0),h){n=h.stats;var C=Date.now()-h.lts;c.framesDecodeFreezeTime=n.framesDecodeFreezeTime,c.framesDecodeInterval=n.framesDecodeInterval,c.framesDecodeCount>n.framesDecodeCount&&i.isFirstVideoDecoded?(h.lts=Date.now(),c.framesDecodeInterval=C,c.framesDecodeInterval>=i.options.freezeRateLimit&&(i.videoIsReady?c.framesDecodeFreezeTime+=c.framesDecodeInterval:i.setVideoIsReady(!0))):c.framesDecodeCount<h.stats.framesDecodeCount&&(c.framesDecodeInterval=0)}i.lastDecodeVideoReceiverStats.set(c.ssrc,{stats:qd({},c),lts:Date.now()}),i._stats.videoRecv.push(c);break;case"audio_recv":c=is(dg),c.codec=n.googCodecName,c.outputLevel=Math.abs(Number(n.audioOutputLevel))/32767,c.decodingCNG=Number(n.googDecodingCNG),c.decodingCTN=Number(n.googDecodingCTN),c.decodingCTSG=Number(n.googDecodingCTSG),c.decodingNormal=Number(n.googDecodingNormal),c.decodingPLC=Number(n.googDecodingPLC),c.decodingPLCCNG=Number(n.googDecodingPLCCNG),c.expandRate=Number(n.googExpandRate),c.accelerateRate=Number(n.googAccelerateRate),c.preemptiveExpandRate=Number(n.googPreemptiveExpandRate),c.secondaryDecodedRate=Number(n.googSecondaryDecodedRate),c.speechExpandRate=Number(n.googSpeechExpandRate),c.preferredJitterBufferMs=Number(n.googPreferredJitterBufferMs),c.jitterBufferMs=Number(n.googJitterBufferMs),c.jitterMs=Number(n.googJitterReceived),c.bytes=Number(n.bytesReceived),c.packets=Number(n.packetsReceived),c.packetsLost=Number(n.packetsLost),c.ssrc=Number(n.ssrc),c.receivedFrames=Number(n.googDecodingCTN)||Number(n.packetsReceived),c.droppedFrames=Number(n.googDecodingPLC)+Number(n.googDecodingPLCCNG)||Number(n.packetsLost),0<c.receivedFrames&&!i.isFirstAudioReceived&&(i.onFirstAudioReceived&&i.onFirstAudioReceived(),i.isFirstAudioReceived=!0),0<c.decodingNormal&&!i.isFirstAudioDecoded&&(i.onFirstAudioDecoded&&i.onFirstAudioDecoded(),i.isFirstAudioDecoded=!0),i._stats.audioRecv.push(c);break;case"audio_send":c=is(ug),c.codec=n.googCodecName,c.inputLevel=Math.abs(Number(n.audioInputLevel))/32767,c.aecReturnLoss=Number(n.googEchoCancellationReturnLoss||0),c.aecReturnLossEnhancement=Number(n.googEchoCancellationReturnLossEnhancement||0),c.residualEchoLikelihood=Number(n.googResidualEchoLikelihood||0),c.residualEchoLikelihoodRecentMax=Number(n.googResidualEchoLikelihoodRecentMax||0),c.bytes=Number(n.bytesSent),c.packets=Number(n.packetsSent),c.packetsLost=Number(n.packetsLost),c.ssrc=Number(n.ssrc),c.rttMs=Number(n.googRtt||0),i._stats.rtt=c.rttMs,i._stats.audioSend.push(c)}})},e.prototype._getStats=function(){var r=this;return new Promise(function(i,n){r.pc.getStats(i,n)})},e.prototype.statsResponsesToObjects=function(r){var i=[];return r.result().forEach(function(n){var c={id:n.id,timestamp:n.timestamp.valueOf().toString(),type:n.type};n.names().forEach(function(h){c[h]=n.stat(h)}),i.push(c)}),i},e}(Xd);(function(t){t.CERTIFICATE="certificate",t.CODEC="codec",t.CANDIDATE_PAIR="candidate-pair",t.LOCAL_CANDIDATE="local-candidate",t.REMOTE_CANDIDATE="remote-candidate",t.INBOUND="inbound-rtp",t.TRACK="track",t.OUTBOUND="outbound-rtp",t.PC="peer-connection",t.REMOTE_INBOUND="remote-inbound-rtp",t.REMOTE_OUTBOUND="remote-outbound-rtp",t.TRANSPORT="transport",t.CSRC="csrc",t.DATA_CHANNEL="data-channel",t.STREAM="stream",t.SENDER="sender",t.RECEIVER="receiver"})(Ea||(Ea={}));var hg=function(t){function e(){var r=t!==null&&t.apply(this,arguments)||this;return r._stats=nl,r.lastDecodeVideoReceiverStats=new Map,r.lastVideoFramesRecv=new Map,r.lastVideoFramesSent=new Map,r.lastVideoFramesDecode=new Map,r.lastVideoJBDelay=new Map,r.lastAudioJBDelay=new Map,r.mediaBytesSent=new Map,r.mediaBytesRetransmit=new Map,r.mediaBytesTargetEncode=new Map,r.lastEncoderMs=new Map,r}return Ta(e,t),e.prototype.updateStats=function(){return Cc(this,void 0,void 0,function(){var r,i=this;return wr(this,function(n){switch(n.label){case 0:return r=this,[4,this.pc.getStats()];case 1:return r.report=n.sent(),this._stats=is(nl),this.report.forEach(function(c){switch(c.type){case Ea.OUTBOUND:c.mediaType==="audio"?i.processAudioOutboundStats(c):c.mediaType==="video"&&i.processVideoOutboundStats(c);break;case Ea.INBOUND:c.mediaType==="audio"?i.processAudioInboundStats(c):c.mediaType==="video"&&i.processVideoInboundStats(c);break;case Ea.TRANSPORT:(c=i.report.get(c.selectedCandidatePairId))&&i.processCandidatePairStats(c);break;case Ea.CANDIDATE_PAIR:c.selected&&i.processCandidatePairStats(c)}}),this.updateSendBitrate(),this._stats.timestamp=Date.now(),this.calcLossRate(this._stats),this.stats=this._stats,[2]}})})},e.prototype.processCandidatePairStats=function(r){this._stats.sendBandwidth=r.availableOutgoingBitrate||0,r.currentRoundTripTime&&(this._stats.rtt=1e3*r.currentRoundTripTime),this._stats.videoSend.forEach(function(i){!i.rttMs&&r.currentRoundTripTime&&(i.rttMs=1e3*r.currentRoundTripTime)}),this._stats.audioSend.forEach(function(i){!i.rttMs&&r.currentRoundTripTime&&(i.rttMs=1e3*r.currentRoundTripTime)})},e.prototype.processAudioInboundStats=function(r){var i=this._stats.audioRecv.find(function(n){return n.ssrc===r.ssrc});i||(i=is(dg),this._stats.audioRecv.push(i)),i.ssrc=r.ssrc,i.packets=r.packetsReceived,i.packetsLost=r.packetsLost,i.bytes=r.bytesReceived,i.jitterMs=1e3*r.jitter,r.trackId&&this.processAudioTrackReceiverStats(r.trackId,i),r.codecId&&(i.codec=this.getCodecFromCodecStats(r.codecId)),i.receivedFrames||(i.receivedFrames=r.packetsReceived),i.droppedFrames||(i.droppedFrames=r.packetsLost),0<i.receivedFrames&&!this.isFirstAudioReceived&&(this.onFirstAudioReceived&&this.onFirstAudioReceived(),this.isFirstAudioReceived=!0),i.outputLevel&&0<i.outputLevel&&!this.isFirstAudioDecoded&&(this.onFirstAudioDecoded&&this.onFirstAudioDecoded(),this.isFirstAudioDecoded=!0)},e.prototype.processVideoInboundStats=function(r){var i=this._stats.videoRecv.find(function(Q){return Q.ssrc===r.ssrc});i||(i=is(cg),this._stats.videoRecv.push(i)),i.ssrc=r.ssrc,i.packets=r.packetsReceived,i.packetsLost=r.packetsLost,i.bytes=r.bytesReceived,i.firsCount=r.firCount,i.nacksCount=r.nackCount,i.plisCount=r.pliCount,i.framesDecodeCount=r.framesDecoded;var n=this.lastDecodeVideoReceiverStats.get(i.ssrc),c=this.lastVideoFramesDecode.get(i.ssrc),h=Date.now();if(0<i.framesDecodeCount&&!this.isFirstVideoDecoded){var C=i.decodedFrame?i.decodedFrame.width:0,x=i.decodedFrame?i.decodedFrame.height:0;this.onFirstVideoDecoded&&this.onFirstVideoDecoded(C,x),this.isFirstVideoDecoded=!0}n&&(C=n.stats,x=h-n.lts,i.framesDecodeFreezeTime=C.framesDecodeFreezeTime,i.framesDecodeInterval=C.framesDecodeInterval,i.framesDecodeCount>C.framesDecodeCount&&this.isFirstVideoDecoded?(n.lts=Date.now(),i.framesDecodeInterval=x,i.framesDecodeInterval>=this.options.freezeRateLimit&&(this.videoIsReady?i.framesDecodeFreezeTime+=i.framesDecodeInterval:this.setVideoIsReady(!0))):i.framesDecodeCount<C.framesDecodeCount&&(i.framesDecodeInterval=0)),c&&800<=h-c.lts?(i.decodeFrameRate=Math.round((i.framesDecodeCount-c.count)/((h-c.lts)/1e3)),this.lastVideoFramesDecode.set(i.ssrc,{count:i.framesDecodeCount,lts:h,rate:i.decodeFrameRate})):c?i.decodeFrameRate=c.rate:this.lastVideoFramesDecode.set(i.ssrc,{count:i.framesDecodeCount,lts:h,rate:0}),r.totalDecodeTime&&(i.decodeMs=1e3*r.totalDecodeTime),r.trackId&&this.processVideoTrackReceiverStats(r.trackId,i),r.codecId&&(i.codec=this.getCodecFromCodecStats(r.codecId)),r.framerateMean&&(i.framesRateFirefox=r.framerateMean),0<i.packets&&!this.isFirstVideoReceived&&(this.onFirstVideoReceived&&this.onFirstVideoReceived(),this.isFirstVideoReceived=!0),this.lastDecodeVideoReceiverStats.set(i.ssrc,{stats:qd({},i),lts:n?n.lts:Date.now()})},e.prototype.processVideoOutboundStats=function(r){var i=this._stats.videoSend.find(function(h){return h.ssrc===r.ssrc});i||(i=is(lg),this._stats.videoSend.push(i));var n=this.mediaBytesSent.get(r.ssrc);if(n?n.add(r.bytesSent):((c=new zd(10)).add(r.bytesSent),this.mediaBytesSent.set(r.ssrc,c)),r.retransmittedBytesSent!==void 0&&((n=this.mediaBytesRetransmit.get(r.ssrc))?n.add(r.retransmittedBytesSent):((c=new zd(10)).add(r.retransmittedBytesSent),this.mediaBytesRetransmit.set(r.ssrc,c))),r.totalEncodedBytesTarget){var c;(n=this.mediaBytesTargetEncode.get(r.ssrc))?n.add(r.totalEncodedBytesTarget):((c=new zd(10)).add(r.totalEncodedBytesTarget),this.mediaBytesTargetEncode.set(r.ssrc,c))}i.ssrc=r.ssrc,i.bytes=r.bytesSent,i.packets=r.packetsSent,i.firsCount=r.firCount,i.nacksCount=r.nackCount,i.plisCount=r.pliCount,i.frameCount=r.framesEncoded,i.adaptionChangeReason=r.qualityLimitationReason,r.totalEncodeTime&&r.framesEncoded&&(n=this.lastEncoderMs.get(r.ssrc),i.avgEncodeMs=!n||n.lastFrameCount>r.framesEncoded?1e3*r.totalEncodeTime/r.framesEncoded:1e3*(r.totalEncodeTime-n.lastEncoderTime)/(r.framesEncoded-n.lastFrameCount),this.lastEncoderMs.set(r.ssrc,{lastFrameCount:r.framesEncoded,lastEncoderTime:r.totalEncodeTime,lts:Date.now()})),r.codecId&&(i.codec=this.getCodecFromCodecStats(r.codecId)),r.mediaSourceId&&this.processVideoMediaSource(r.mediaSourceId,i),r.trackId&&this.processVideoTrackSenderStats(r.trackId,i),r.remoteId?this.processRemoteInboundStats(r.remoteId,i):(n=this.findRemoteStatsId(r.ssrc,Ea.REMOTE_INBOUND))&&this.processRemoteInboundStats(n,i)},e.prototype.processAudioOutboundStats=function(r){var i=this._stats.audioSend.find(function(c){return c.ssrc===r.ssrc});if(i||(i=is(ug),this._stats.audioSend.push(i)),i.ssrc=r.ssrc,i.packets=r.packetsSent,i.bytes=r.bytesSent,r.mediaSourceId&&this.processAudioMediaSource(r.mediaSourceId,i),r.codecId&&(i.codec=this.getCodecFromCodecStats(r.codecId)),r.trackId&&this.processAudioTrackSenderStats(r.trackId,i),r.remoteId)this.processRemoteInboundStats(r.remoteId,i);else{var n=this.findRemoteStatsId(r.ssrc,Ea.REMOTE_INBOUND);n&&this.processRemoteInboundStats(n,i)}},e.prototype.findRemoteStatsId=function(r,i){var n=Array.from(this.report.values()).find(function(c){return c.type===i&&c.ssrc===r});return n?n.id:null},e.prototype.processVideoMediaSource=function(r,i){(r=this.report.get(r))&&r.width&&r.height&&r.framesPerSecond&&(i.inputFrame={width:r.width,height:r.height,frameRate:r.framesPerSecond})},e.prototype.processAudioMediaSource=function(r,i){(r=this.report.get(r))&&(i.inputLevel=r.audioLevel)},e.prototype.processVideoTrackSenderStats=function(r,i){if(r=this.report.get(r)){var n=0,c=Date.now(),h=this.lastVideoFramesSent.get(i.ssrc);h&&800<=c-h.lts?(n=Math.round((r.framesSent-h.count)/((c-h.lts)/1e3)),this.lastVideoFramesSent.set(i.ssrc,{count:r.framesSent,lts:c,rate:n})):h?n=h.rate:this.lastVideoFramesSent.set(i.ssrc,{count:r.framesSent,lts:c,rate:0}),i.sentFrame={width:r.frameWidth,height:r.frameHeight,frameRate:n}}},e.prototype.processVideoTrackReceiverStats=function(r,i){if(r=this.report.get(r)){var n=this.lastVideoFramesRecv.get(i.ssrc),c=Date.now();i.framesReceivedCount=r.framesReceived;var h=0;n&&800<=c-n.lts?(h=Math.round((r.framesReceived-n.count)/((c-n.lts)/1e3)),this.lastVideoFramesRecv.set(i.ssrc,{count:r.framesReceived,lts:c,rate:h})):n?h=n.rate:this.lastVideoFramesRecv.set(i.ssrc,{count:r.framesReceived,lts:c,rate:0}),i.receivedFrame={width:r.frameWidth||0,height:r.frameHeight||0,frameRate:h||0},i.decodedFrame={width:r.frameWidth||0,height:r.frameHeight||0,frameRate:i.decodeFrameRate||0},i.outputFrame={width:r.frameWidth||0,height:r.frameHeight||0,frameRate:i.decodeFrameRate||0},r.jitterBufferDelay&&r.jitterBufferEmittedCount&&(n=this.lastVideoJBDelay.get(i.ssrc),this.lastVideoJBDelay.set(i.ssrc,{jitterBufferDelay:r.jitterBufferDelay,jitterBufferEmittedCount:r.jitterBufferEmittedCount}),n||(n={jitterBufferDelay:0,jitterBufferEmittedCount:0}),r=1e3*(r.jitterBufferDelay-n.jitterBufferDelay)/(r.jitterBufferEmittedCount-n.jitterBufferEmittedCount),i.jitterBufferMs=r,i.currentDelayMs=Math.round(r))}},e.prototype.processAudioTrackSenderStats=function(r,i){(r=this.report.get(r))&&(i.aecReturnLoss=r.echoReturnLoss||0,i.aecReturnLossEnhancement=r.echoReturnLossEnhancement||0)},e.prototype.processAudioTrackReceiverStats=function(r,i){if(r=this.report.get(r)){if(r.removedSamplesForAcceleration&&r.totalSamplesReceived&&(i.accelerateRate=r.removedSamplesForAcceleration/r.totalSamplesReceived),r.jitterBufferDelay&&r.jitterBufferEmittedCount){var n=this.lastAudioJBDelay.get(i.ssrc);this.lastAudioJBDelay.set(i.ssrc,{jitterBufferDelay:r.jitterBufferDelay,jitterBufferEmittedCount:r.jitterBufferEmittedCount}),n||(n={jitterBufferDelay:0,jitterBufferEmittedCount:0}),i.jitterBufferMs=Math.round(1e3*(r.jitterBufferDelay-n.jitterBufferDelay)/(r.jitterBufferEmittedCount-n.jitterBufferEmittedCount))}i.outputLevel=r.audioLevel,n=1920,r.totalSamplesDuration&&r.totalSamplesReceived&&(n=r.totalSamplesReceived/r.totalSamplesDuration/50,i.receivedFrames=Math.round(r.totalSamplesReceived/n)),r.concealedSamples&&(i.droppedFrames=Math.round(r.concealedSamples/n))}},e.prototype.processRemoteInboundStats=function(r,i){(r=this.report.get(r))&&(i.packetsLost=r.packetsLost,r.roundTripTime&&(i.rttMs=1e3*r.roundTripTime))},e.prototype.getCodecFromCodecStats=function(r){return r=this.report.get(r),r&&(r=r.mimeType.match(/\/(.*)$/))&&r[1]?r[1]:""},e.prototype.updateSendBitrate=function(){var r=0,i=null,n=null;this.mediaBytesSent.forEach(function(c){r+=c.diffMean()}),this.mediaBytesRetransmit.forEach(function(c){i=i===null?c.diffMean():i+c.diffMean()}),this.mediaBytesTargetEncode.forEach(function(c){n=n===null?c.diffMean():n+c.diffMean()}),this._stats.bitrate={actualEncoded:8*(i!==null?r-i:r)/(this.options.updateInterval/1e3),transmit:8*r/(this.options.updateInterval/1e3)},i!==null&&(this._stats.bitrate.retransmit=8*i/(this.options.updateInterval/1e3)),n!==null&&(this._stats.bitrate.targetEncoded=8*n/(this.options.updateInterval/1e3))},e}(Xd),wm=function(t){function e(){return t!==null&&t.apply(this,arguments)||this}return Ta(e,t),e.prototype.updateStats=function(){return Promise.resolve()},e}(Xd);class fg{constructor(e){this.localCandidateCount=0,this.allCandidateReceived=!1,this.videoTrack=this.audioTrack=null,this.mediaStream=new MediaStream,this.ID=pg,pg+=1,this.spec=e,this.createPeerConnection(),e=this.pc;var r=void 0,i=void 0,n=sr()?1200:void 0;r===void 0&&(r=250),i===void 0&&(i=8),n===void 0&&(n=500);var c,h=(c=navigator.userAgent.toLocaleLowerCase().match(/chrome\/[\d]./i))&&c[0]?Number(c[0].split("/")[1]):null;this.statsFilter=h?76>h?new Rm(e,{updateInterval:r,lossRateInterval:i,freezeRateLimit:n}):new hg(e,{updateInterval:r,lossRateInterval:i,freezeRateLimit:n}):window.RTCStatsReport&&e.getStats()instanceof Promise?new hg(e,{updateInterval:r,lossRateInterval:i,freezeRateLimit:n}):new wm(e,{updateInterval:r,lossRateInterval:i,freezeRateLimit:n})}get _statsFilter(){return this.statsFilter}getStats(){return this.statsFilter.getStats()}createOfferSDP(){return Ee(this,null,function*(){try{let e=yield this.pc.createOffer(this.offerOptions);if(!e.sdp)throw Error("offer sdp is empty");return e.sdp}catch(e){throw z.error("create offer error:",e.toString()),new ue(oe.CREATE_OFFER_FAILED,e.toString())}})}setOfferSDP(e){return Ee(this,null,function*(){try{yield this.pc.setLocalDescription({type:"offer",sdp:e})}catch(r){throw z.error("set local offer error",r.toString()),new ue(oe.CREATE_OFFER_FAILED,r.toString())}})}setAnswerSDP(e){return Ee(this,null,function*(){try{yield this.pc.setRemoteDescription({type:"answer",sdp:e})}catch(r){if(r.name!=="InvalidStateError"||this.pc.signalingState!=="stable")throw z.error("set remote answer error",r.toString()),new ue(oe.SET_ANSWER_FAILED,r.toString());z.debug("[pc-".concat(this.ID,"] ignore invalidstate error"))}})}close(){this.onConnectionStateChange=this.onICEConnectionStateChange=void 0;try{this.pc.oniceconnectionstatechange=null,this.pc.onconnectionstatechange=null,this.pc.onsignalingstatechange=null,this.pc.onicecandidateerror=null,this.pc.onicecandidate=null,this.pc.close(),this.pc=null,this.videoTransceiver=this.audioTransceiver=void 0}catch(e){}this.statsFilter.destroy()}createPeerConnection(){let e={iceServers:[]},r=c=>{const h=[];return Re(c).call(c,C=>{if(C.security){var x;C.tcpport&&h.push({username:C.username,credential:C.password,credentialType:"password",urls:ne(x="turns:".concat((V=C.turnServerURL,V.match(/^[\.:\d]+$/)?"".concat(V.replace(/[^\d]/g,"-"),".edge.agora.io"):(z.info("Cannot recognized as IP address ".concat(V,". Used As Host instead")),V)),":")).call(x,C.tcpport,"?transport=tcp")})}else{var Q,F;C.udpport&&h.push({username:C.username,credential:C.password,credentialType:"password",urls:ne(Q="turn:".concat(C.turnServerURL,":")).call(Q,C.udpport,"?transport=udp")}),C.tcpport&&h.push({username:C.username,credential:C.password,credentialType:"password",urls:ne(F="turn:".concat(C.turnServerURL,":")).call(F,C.tcpport,"?transport=tcp")})}var V}),h};var i,n;this.spec.iceServers?e.iceServers=this.spec.iceServers:this.spec.turnServer&&this.spec.turnServer.mode!=="off"&&(Lo(this.spec.turnServer.servers)?e.iceServers=this.spec.turnServer.servers:(e.iceServers&&e.iceServers.push(...r(this.spec.turnServer.servers)),e.iceServers&&this.spec.turnServer.serversFromGateway&&e.iceServers.push(...r(this.spec.turnServer.serversFromGateway)),Re(i=ne(n=this.spec.turnServer.servers).call(n,this.spec.turnServer.serversFromGateway||[])).call(i,c=>{c.forceturn&&(e.iceTransportPolicy="relay")}))),Xe.CHROME_FORCE_PLAN_B&&bi()&&(e.sdpSemantics="plan-b",Ur.supportUnifiedPlan=!1),this.pc=new RTCPeerConnection(e,{optional:[{googDscp:!0}]}),this.pc.oniceconnectionstatechange=()=>{this.onICEConnectionStateChange&&this.onICEConnectionStateChange(this.pc.iceConnectionState)},this.pc.onconnectionstatechange=()=>{this.onConnectionStateChange&&this.onConnectionStateChange(this.pc.connectionState)},this.pc.onsignalingstatechange=()=>{this.pc&&this.pc.connectionState==="closed"&&this.onConnectionStateChange&&this.onConnectionStateChange(this.pc.connectionState)},this.pc.onicecandidate=c=>{if(!c.candidate)return this.pc.onicecandidate=null,this.allCandidateReceived=!0,void z.debug("[pc-".concat(this.ID,"] local candidate count"),this.localCandidateCount);this.localCandidateCount+=1},Is(()=>{this.allCandidateReceived||(this.allCandidateReceived=!0,z.debug("[pc-".concat(this.ID,"] onicecandidate timeout, local candidate count"),this.localCandidateCount))},Xe.CANDIDATE_TIMEOUT)}}class Ag extends fg{constructor(e){super(e)}setOfferSDP(e){var r=i=>super[i];return Ee(this,null,function*(){let n=Xe.CUSTOM_PUB_OFFER_MODIFIER;return n&&(e=n(e)),yield r("setOfferSDP").call(this,e)})}setAnswerSDP(e){var r=i=>super[i];return Ee(this,null,function*(){let n=Xe.CUSTOM_PUB_ANSWER_MODIFIER;return n&&(e=n(e)),yield r("setAnswerSDP").call(this,e)})}getAnswerSDP(){return this.pc.remoteDescription}getOfferSDP(){return this.pc.localDescription}addStream(e){return Ee(this,null,function*(){e=e.getTracks();for(let r of e)yield this.addTrack(r)})}replaceTrack(e){return Ee(this,null,function*(){if(!Ur.supportReplaceTrack){var r=e.kind==="audio"?this.audioTrack:this.videoTrack;if(!r)throw new ue(oe.UNEXPECTED_ERROR,"can not find replaced track");return yield this.removeTrack(r),yield this.addTrack(e),!0}let i=this.getSender(e.kind),n=tr(r=this.mediaStream.getTracks()).call(r,c=>c.kind===e.kind);n&&this.mediaStream.removeTrack(n),this.mediaStream.addTrack(e);try{yield i.replaceTrack(e),e.kind==="audio"?this.audioTrack=e:this.videoTrack=e}catch(c){throw new ue(oe.SENDER_REPLACE_FAILED,c.toString())}return!1})}removeTrack(e){return Ee(this,null,function*(){let r=this.getSender(e.kind);this.mediaStream.removeTrack(e);try{let i=Ye();i.name==="Safari"&&i.version==="11"&&(yield r.replaceTrack(null)),this.pc.removeTrack(r)}catch(i){z.warning("[pc-".concat(this.ID,"] remove track error, ignore"),i)}e.kind==="audio"?(this.audioTrack=null,this.audioSender=void 0,this.audioTransceiver&&(this.audioTransceiver.direction="inactive"),this.audioTransceiver=void 0):(this.videoTrack=null,this.videoSender=void 0,this.videoTransceiver&&(this.videoTransceiver.direction="inactive"),this.videoTransceiver=void 0)})}onOfferSettled({videoActive:e,audioActive:r}){if(sr())z.debug("firefox do not set sender parameter");else{if(this.audioSender){let i={networkQuality:void 0,active:!0};Xe.DSCP_TYPE&&(i.networkQuality=Xe.DSCP_TYPE),this.audioTrack&&(i.active=!!r),this.setAudioRtpEncodingParameters(i).catch(n=>{z.debug("set audio sender`s network priority failed")})}this.videoSender&&(r={networkQuality:void 0,active:!0},Xe.DSCP_TYPE&&(r.networkQuality=Xe.DSCP_TYPE),this.videoTrack&&(r.active=!!e),this.setVideoRtpEncodingParameters(r).catch(i=>{z.debug("set video sender`s network priority failed")}))}}addTrack(e){return Ee(this,null,function*(){let r=Ur;if(e.kind==="audio"&&this.audioTrack||e.kind==="video"&&this.videoTrack)throw new ue(oe.UNEXPECTED_ERROR,"Can't add multiple stream");let i,n;this.mediaStream.addTrack(e),r.supportUnifiedPlan?(i=yield function(c,h,C){return Ee(this,null,function*(){var x;let Q=tr(x=c.getTransceivers()).call(x,F=>F.direction==="inactive"&&F.receiver.track.kind===h.kind);return Q?(Q.direction="sendrecv",yield Q.sender.replaceTrack(h),Q):c.addTransceiver(h,{direction:"sendrecv",streams:[C]})})}(this.pc,e,this.mediaStream),n=i.sender):n=this.pc.addTrack(e,this.mediaStream),e.kind==="audio"?(this.audioTrack=e,this.audioSender=n,this.audioTransceiver=i):(this.videoTrack=e,this.videoSender=n,this.videoTransceiver=i)})}setRtpSenderParameters(e,r){return Ee(this,null,function*(){if(e=this.videoSender||(this.videoTransceiver?this.videoTransceiver.sender:void 0)){var i=e.getParameters();i.degradationPreference=r;try{yield e.setParameters(i)}catch(n){z.debug("[".concat(this.ID,"] ignore RtpSender.setParameters"),n.toString())}}})}setVideoRtpEncodingParameters(e){return Ee(this,null,function*(){let r=this.videoSender||(this.videoTransceiver?this.videoTransceiver.sender:void 0);if(!r)throw new ue(oe.LOW_STREAM_ENCODING_ERROR,"Low stream has no video sender.");let i=r.getParameters();if(!i.encodings||!i.encodings[0])throw new ue(oe.LOW_STREAM_ENCODING_ERROR,"Low stream RtpEncodingParameters is empty.");e.scaleResolutionDownBy&&(i.encodings[0].scaleResolutionDownBy=e.scaleResolutionDownBy),e.maxBitrate&&(i.encodings[0].maxBitrate=e.maxBitrate),e.maxFramerate&&(i.encodings[0].maxFramerate=e.maxFramerate),e.active!==void 0&&(z.debug("set video sender encoding active:",e.active),i.encodings[0].active=e.active);let n=["very-low","low","medium","high"];return e.networkPriority&&Ir(n).call(n,e.networkPriority)&&(z.debug("set video sender network quality:",e.networkPriority),i.encodings[0].networkPriority=e.networkPriority),yield r.setParameters(i),r.getParameters()})}setAudioRtpEncodingParameters(e){return Ee(this,null,function*(){let r=this.audioSender||(this.audioTransceiver?this.audioTransceiver.sender:void 0);if(!r)throw new ue(oe.SET_ENCODING_PARAMETER_ERROR,"pc has no audio sender.");let i=r.getParameters();if(!i.encodings||!i.encodings[0])throw new ue(oe.SET_ENCODING_PARAMETER_ERROR,"pc RtpEncodingParameters is empty.");e.active!==void 0&&(z.debug("set audio sender encoding active:",e.active),i.encodings[0].active=e.active);let n=["very-low","low","medium","high"];return e.networkPriority&&Ir(n).call(n,e.networkPriority)&&(z.debug("set audio sender network quality:",e.networkPriority),i.encodings[0].networkPriority=e.networkPriority),yield r.setParameters(i),r.getParameters()})}getSender(e){var r=null;if(Ur.supportUnifiedPlan){var i;r=(r=tr(i=this.pc.getTransceivers()).call(i,c=>c.sender.track&&c.sender.track.kind===e))?r.sender:null}else{var n;r=tr(n=this.pc.getSenders()).call(n,c=>c.track&&c.track.kind===e)||null}if(!r)throw new ue(oe.SENDER_NOT_FOUND);return r}close(){this.videoSender=this.audioSender=void 0,super.close()}}class gg extends fg{constructor(e){super(e);this.statsFilter.onFirstAudioDecoded=()=>this.onFirstAudioDecoded&&this.onFirstAudioDecoded(),this.statsFilter.onFirstVideoDecoded=(r,i)=>this.onFirstVideoDecoded&&this.onFirstVideoDecoded(r,i),this.statsFilter.onFirstAudioReceived=()=>this.onFirstAudioReceived&&this.onFirstAudioReceived(),this.statsFilter.onFirstVideoReceived=()=>this.onFirstVideoReceived&&this.onFirstVideoReceived(),Ur.supportUnifiedPlan?(this.audioTransceiver=this.pc.addTransceiver("audio",{direction:"recvonly"}),this.videoTransceiver=this.pc.addTransceiver("video",{direction:"recvonly"})):this.offerOptions={offerToReceiveAudio:!0,offerToReceiveVideo:!0},this.pc.ontrack=r=>{r.track.kind==="audio"?this.audioTrack=r.track:this.videoTrack=r.track,this.onTrack&&this.onTrack(r.track,r.streams[0])}}setOfferSDP(e){var r=i=>super[i];return Ee(this,null,function*(){let n=Xe.CUSTOM_SUB_OFFER_MODIFIER;return n&&(e=n(e)),yield r("setOfferSDP").call(this,e)})}setAnswerSDP(e){var r=i=>super[i];return Ee(this,null,function*(){let n=Xe.CUSTOM_SUB_ANSWER_MODIFIER;return n&&(e=n(e)),yield r("setAnswerSDP").call(this,e)})}}let pg=1,vg=1;class mg extends An{constructor(e,r){super();this.startTime=ot(),this.createTime=ot(),this.readyToReconnect=!1,this._connectionState="disconnected",this.currentReconnectCount=0,this.ID=vg,vg+=1,this.joinInfo=e,this._userId=r,this.createPC()}get connectionState(){return this._connectionState}set connectionState(e){e!==this._connectionState&&(this.emit(Nt.CONNECTION_STATE_CHANGE,e,this._connectionState),this._connectionState=e)}get connectionId(){var e,r;return ne(e=ne(r="".concat(this.joinInfo.clientId,"-")).call(r,this.type?this.type:"sub(".concat(this._userId,")"),"-")).call(e,this.ID)}getUserId(){return this._userId}startUploadStats(){this.statsUploadInterval=window.setInterval(()=>{let e=this.pc.getStats();this.uploadStats(e,this.lastUploadPCStats),this.lastUploadPCStats=e},3e3),this.statsUploadSlowInterval=window.setInterval(()=>{let e=this.pc.getStats();this.uploadSlowStats(e)},6e4),this.relatedStatsUploadInterval=window.setInterval(()=>{let e=this.pc.getStats();this.uploadRelatedStats(e,this.lastRelatedPcStats),this.lastRelatedPcStats=e},1e3)}stopUploadStats(){this.statsUploadInterval&&window.clearInterval(this.statsUploadInterval),this.relatedStatsUploadInterval&&window.clearInterval(this.relatedStatsUploadInterval),this.relatedStatsUploadInterval=this.statsUploadInterval=void 0}createWaitConnectionConnectedPromise(){return new it((e,r)=>{this.connectionState==="disconnected"?r():this.connectionState==="connected"?e():this.once(Nt.CONNECTION_STATE_CHANGE,i=>{i==="connected"?e():r()})})}reconnectPC(e){return Ee(this,null,function*(){if(this.readyToReconnect=!1,e&&this.onPCDisconnected(e),1/0<this.currentReconnectCount)throw z.debug("[".concat(this.connectionId,"] cannot reconnect pc")),e||new ue(oe.UNEXPECTED_ERROR);if(this.stopUploadStats(),z.debug("[".concat(this.connectionId,"] start reconnect pc")),this.connectionState="connecting",this.currentReconnectCount+=1,yield this.closePC())return z.debug("[".concat(this.connectionId,"] abort reconnect pc, wait ws")),void this.readyToReconnectPC();this.createPC(),yield this.startP2PConnection(),this.currentReconnectCount=0})}readyToReconnectPC(){this.stopUploadStats(),this.readyToReconnect=!0,this.pc.onICEConnectionStateChange=void 0,this.connectionState="connecting"}updateICEPromise(){this.removeAllListeners(Nt.GATEWAY_P2P_LOST),this.icePromise=new it((e,r)=>{let i=!0;this.pc.onICEConnectionStateChange=n=>{var c,h;z.info(ne(c=ne(h="[".concat(this.connectionId,"] ice-state: ")).call(h,this.type," p2p ")).call(c,n)),n==="connected"&&e(),n!=="failed"&&n!=="closed"||(i&&this.emit(Nt.P2P_LOST),i=!1,this.reconnectPC(new ue(oe.ICE_FAILED)).catch(C=>{r(C)}))},this.pc.onConnectionStateChange=n=>{var c,h;z.info(ne(c=ne(h="[".concat(this.connectionId,"] connection-state: ")).call(h,this.type," p2p ")).call(c,n)),n!=="failed"&&n!=="closed"||(i&&this.emit(Nt.P2P_LOST),i=!1,this.reconnectPC(new ue(oe.PC_CLOSED)).catch(C=>{r(C)}))},this.removeAllListeners(Nt.GATEWAY_P2P_LOST),this.once(Nt.GATEWAY_P2P_LOST,n=>{var c;if(this.pc.ID.toString()===n.toString()){if(z.info(ne(c="[".concat(this.connectionId,"] ")).call(c,this.type," p2p gateway lost")),i&&this.emit(Nt.P2P_LOST),i=!1,this.pc.allCandidateReceived&&this.pc.localCandidateCount===0)return this.disconnectedReason=new ue(oe.NO_ICE_CANDIDATE,"can not get candidate in this pc"),void this.closeP2PConnection(!0);this.reconnectPC(new ue(oe.GATEWAY_P2P_LOST)).catch(h=>{r(h)})}})})}}class Eg{constructor(e){this.freezeTimeCounterList=[],this.lastTimeUpdatedTime=this.playbackTime=this.freezeTime=this.timeUpdatedCount=0,this._videoElementStatus=rn.NONE,this.isGettingVideoDimensions=!1,this.handleVideoEvents=r=>{switch(r.type){case"play":case"playing":this.startGetVideoDimensions(),this.videoElementStatus=rn.PLAYING;break;case"loadeddata":this.onFirstVideoFrameDecoded&&this.onFirstVideoFrameDecoded();break;case"canplay":this.videoElementStatus=rn.CANPLAY;break;case"stalled":this.videoElementStatus=rn.STALLED;break;case"suspend":this.videoElementStatus=rn.SUSPEND;break;case"pause":this.videoElementStatus=rn.PAUSED,!br()&&!pi()&&this.videoElement&&this.videoTrack&&this.videoTrack.readyState==="live"&&(z.debug("[track-".concat(this.trackId,"] video element paused, auto resume")),this.videoElement.play());break;case"waiting":this.videoElementStatus=rn.WAITING;break;case"abort":this.videoElementStatus=rn.ABORT;break;case"ended":this.videoElementStatus=rn.ENDED;break;case"emptied":this.videoElementStatus=rn.EMPTIED;break;case"timeupdate":{if(r=ot(),this.timeUpdatedCount+=1,10>this.timeUpdatedCount)return void(this.lastTimeUpdatedTime=r);let i=r-this.lastTimeUpdatedTime;for(this.lastTimeUpdatedTime=r,500<i&&(this.freezeTime+=i),this.playbackTime+=i;6e3<=this.playbackTime;)this.playbackTime-=6e3,this.freezeTimeCounterList.push(Math.min(6e3,this.freezeTime)),this.freezeTime=Math.max(0,this.freezeTime-6e3)}}},this.startGetVideoDimensions=()=>{let r=()=>{if(this.isGettingVideoDimensions=!0,this.videoElement&&4<this.videoElement.videoWidth*this.videoElement.videoHeight)return z.debug("[".concat(this.trackId,"] current video dimensions:"),this.videoElement.videoWidth,this.videoElement.videoHeight),void(this.isGettingVideoDimensions=!1);Is(r,500)};!this.isGettingVideoDimensions&&r()},this.autoResumeAfterInterruption=()=>{this.videoElement&&this.videoTrack&&this.videoTrack.readyState==="live"&&fr.curState==="running"&&(Mr()?(z.debug("[track-".concat(this.trackId,"] video element paused, auto resume for iOS 15.0")),this.videoElement.pause(),this.videoElement.play()):Hr()?(z.debug("[track-".concat(this.trackId,"] video element paused, auto resume for iOS 15.1")),this.videoElement.load(),this.videoElement.play()):(z.debug("[track-".concat(this.trackId,"] video element paused, auto resume for iOS 14")),this.videoElement.play()))},this.autoResumeAfterInterruptionOnIOS15=()=>{this.videoElement&&this.videoTrack&&this.videoTrack.readyState==="live"&&(Mr()?(z.debug("[track-".concat(this.trackId,"] video element paused, auto resume for iOS 15.0")),this.videoElement.pause(),this.videoElement.play()):Hr()&&(z.debug("[track-".concat(this.trackId,"] video element paused, auto resume for iOS 15.1")),this.videoElement.load(),this.videoElement.play()))},this.slot=e.element,this.trackId=e.trackId,this.updateConfig(e),fr.on(Yi.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),fr.on(Yi.IOS_15_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15)}get videoElementStatus(){return this._videoElementStatus}set videoElementStatus(e){var r,i;e!==this._videoElementStatus&&(z.debug(ne(r=ne(i="[".concat(this.trackId,"] video-element-status change ")).call(i,this._videoElementStatus," => ")).call(r,e)),this._videoElementStatus=e)}updateConfig(e){this.config=e,this.trackId=e.trackId,e=e.element,e!==this.slot&&(this.destroy(),this.slot=e),this.createElements()}updateVideoTrack(e){this.videoTrack!==e&&(this.videoTrack=e,this.createElements())}play(){if(this.videoElement){let e=this.videoElement.play();e&&e.catch&&e.catch(i=>{i.name==="NotAllowedError"?(z.warning("detected video element autoplay failed",i),this.handleAutoPlayFailed()):z.warning("[".concat(this.trackId,"] play warning: "),i)});let r=Ye();(r.name==="Safari"&&Number(r.version)===15||hi())&&e&&e.finally&&e.finally(()=>{this.config.mirror&&this.videoElement&&(this.videoElement.style.transform="rotateY(180deg)")})}}getCurrentFrame(){if(!this.videoElement)return new ImageData(2,2);let e=document.createElement("canvas");e.width=this.videoElement.videoWidth,e.height=this.videoElement.videoHeight;var r=e.getContext("2d");return r?(r.drawImage(this.videoElement,0,0,e.width,e.height),r=r.getImageData(0,0,e.width,e.height),e.remove(),r):(z.error("create canvas context failed!"),new ImageData(2,2))}destroy(){if(fr.off(Yi.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),fr.off(Yi.IOS_15_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15),this.videoElement&&(this.videoElement.srcObject=null,this.videoElement.remove(),this.videoElement=void 0),this.container){try{this.container.remove(),this.slot.removeChild(this.container)}catch(e){}this.container=void 0}this.freezeTimeCounterList=[]}createElements(){this.container||(this.container=document.createElement("div")),this.container.id="agora-video-player-".concat(this.trackId),this.container.style.width="100%",this.container.style.height="100%",this.container.style.position="relative",this.container.style.overflow="hidden",this.videoTrack?(this.container.style.backgroundColor="black",this.createVideoElement(),this.container.appendChild(this.videoElement)):this.removeVideoElement(),this.slot.appendChild(this.container)}createVideoElement(){this.videoElement||(this.videoElementStatus=rn.INIT,this.videoElement=document.createElement("video"),this.videoElement.onerror=()=>this.videoElementStatus=rn.ERROR,this.container&&this.container.appendChild(this.videoElement),Re(cu).call(cu,r=>{this.videoElement&&this.videoElement.addEventListener(r,this.handleVideoEvents)}),this.videoElementCheckInterval=window.setInterval(()=>{!document.getElementById("video_".concat(this.trackId))&&this.videoElement&&(this.videoElementStatus=rn.DESTROYED)},1e3)),this.videoElement.id="video_".concat(this.trackId),this.videoElement.className="agora_video_player",this.videoElement.style.width="100%",this.videoElement.style.height="100%",this.videoElement.style.position="absolute",this.videoElement.controls=!1,this.videoElement.setAttribute("playsinline",""),this.videoElement.style.left="0",this.videoElement.style.top="0";var e=Ye();e.name==="Safari"&&Number(e.version)===15||hi()||!this.config.mirror||(this.videoElement.style.transform="rotateY(180deg)"),this.config.fit?this.videoElement.style.objectFit=this.config.fit:this.videoElement.style.objectFit="cover",this.videoElement.setAttribute("muted",""),this.videoElement.muted=!0,this.videoElement.srcObject&&this.videoElement.srcObject instanceof MediaStream?this.videoElement.srcObject.getVideoTracks()[0]!==this.videoTrack&&(this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,sr()&&this.videoElement.load()):(this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,sr()&&this.videoElement.load()),e=this.videoElement.play(),e!==void 0&&e.catch(r=>{z.debug("[".concat(this.trackId,"] playback interrupted"),r.toString())})}removeVideoElement(){if(this.videoElement){Re(cu).call(cu,e=>{this.videoElement&&this.videoElement.removeEventListener(e,this.handleVideoEvents)}),this.videoElementCheckInterval&&(window.clearInterval(this.videoElementCheckInterval),this.videoElementCheckInterval=void 0);try{this.container&&this.container.removeChild(this.videoElement)}catch(e){}this.videoElement=void 0,this.videoElementStatus=rn.NONE}}handleAutoPlayFailed(){if(this.videoElement){let e=r=>{r.preventDefault(),this.videoElement&&(this.videoElement.play().then(()=>{var i;z.debug(ne(i="[".concat(this.trackId,"] Video element for trackId:")).call(i,this.trackId," autoplay resumed."))}).catch(i=>{z.error(i)}),document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0),gs()}}}let cu="play playing loadeddata canplay pause stalled suspend waiting abort emptied ended timeupdate".split(" ");var _g;!document.documentMode&&window.StyleMedia&&(HTMLCanvasElement.prototype.getContext=(_g=HTMLCanvasElement.prototype.getContext,function(){let t=arguments;return t[0]==="webgl"&&(t=$i([]).call(arguments),t[0]="experimental-webgl"),_g.apply(null,t)}));let Lm=[31,222,239,159,192,236,164,81,54,227,176,149,2,247,75,141,183,54,213,216,158,92,111,49,228,111,150,6,135,79,35,212,4,155,200,168,37,107,243,110,144,179,51,81,55,78,223,242,191,211,74,119,203,151,142,62,31,41,132,22,35,155,87,123,119,117,216,57,201,53,228,67,201,40,106,24,80,176,187,253,60,63,136,100,20,12,177,99,64,38,101,143,111,176,251,211,145,136,34,23,79,136,202,95,105,199,125,67,180,44,210,179,228,4,85,160,188,64,26,46,6,61,201,103,248,18,97,254,140,36,115,106,48,124,102,216,155,120,36,227,165,217,7,227,191,128,212,157,80,37,117,175,24,214,47,221,183,211,51,174,251,223,159,167,152,53,36,107,199,223,91,62,46,194,11,80,121,188,219,2,99,99,232,229,173,234,21,30,236,177,243,142,97,48,108,56,62,172,56,216,3,42,79,138,23,88,182,39,5,118,68,135,178,56,9,94,189,44,104,9,238,231,174,122,85,247,231,86,74,8,189,147,218,180,58,76,227,17,46,90,194,100,51,178,72,163,151,243,166,130,85,1,223,130,152,242,85,255,28,173,97,252,119,215,177,119,86,104,136,82,40,72,53,11,18,26,240,188,76,110,39,31,189],Dm=[11,196,242,139,198,252,188,5,59,170,161,152,17,229,24,141,133,54,214,206,133,26,66,126,255,11,245,10,146,92,52,134,108,152,221,191,124,116,248,106,130,251,59,105,43,91,135,199,181,223,10,51,134,194,240,46,9,3,141,22,35,146,76,23,109,117,208,41,201,45,218,76,203,105,51,58,97,154,145,236,49,18,183,127,27,12,210,122,73,42,37,143,36,207,251,211,145,191,56,10,88,222,181,125,22,238,123,71,177,107,218,254,173,28,34,253,249,67,83,97,73,111,219,43,181,82,38,230,136,109,22,67];class Cg{constructor(e,r){this.gl=e,this.kernel=r||Dm,e=this.gl,r=fl(this.kernel),r=Au(e,[fl(Lm),r]);var i=e.getAttribLocation(r,"a_position"),n=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),e.STATIC_DRAW),e.enableVertexAttribArray(i),e.vertexAttribPointer(i,2,e.FLOAT,!1,0,0),i=e.getAttribLocation(r,"a_texCoord"),n=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),e.STATIC_DRAW),e.enableVertexAttribArray(i),e.vertexAttribPointer(i,2,e.FLOAT,!1,0,0),this.program=e=r}setUniforms(){let e=this.gl.getUniformLocation(this.program,"u_flipY");this.gl.uniform1f(e,1)}}class qo extends Cg{constructor(e,r,i,n){super(e,r);this.denoiseLevel=5,this.xOffset=1/i,this.yOffset=1/n}setUniforms(){let e=this.gl.getUniformLocation(this.program,"u_flipY"),r=this.gl.getUniformLocation(this.program,"u_singleStepOffset"),i=this.gl.getUniformLocation(this.program,"u_denoiseLevel");this.gl.uniform2f(r,this.xOffset,this.yOffset),this.gl.uniform1f(i,this.denoiseLevel),this.gl.uniform1f(e,1)}setParameters(e){e.denoiseLevel!==void 0&&(this.denoiseLevel=e.denoiseLevel)}setSize(e,r){this.xOffset=1/e,this.yOffset=1/r}}let bm=[11,196,242,139,198,252,188,5,59,170,161,152,17,229,24,141,133,54,214,206,133,26,66,126,255,11,245,10,146,92,52,134,108,155,210,164,99,114,228,96,130,251,59,105,43,91,135,199,181,223,10,51,133,194,247,34,31,39,142,28,2,130,18,109,84,124,223,62,140,52,128,47,208,47,115,39,4,200,220,171,53,36,150,101,10,75,247,121,74,36,35,143,108,176,235,211,135,164,36,11,88,160,148,35,6,221,41,32,166,109,205,171,228,4,26,169,244,82,119,102,86,61,201,103,248,18,97,242,182,34,121,70,28,71,126,197,223,126,14,244,149,192,12,176,187,149,212,156,22,44,36,133,10,216,63,198,213,154,116,230,253,154,154,249,215,55,60,34,196,229,76,50,44,135,22,77,113,247,142,94,60,23,172,145,175,218,81,86,162,239,180,205,63,118,3,110,123,224,127,158,124,15,127,157,27,66,176,33,24,51,53,194,178,56,6,74,191,111,51,78,174,157,229,17,22,178,231,92,25,23,191,157,137,188,54,64,176,13,22,81,207,45,108,203,83,186,130,237,186,153,110,8,196,168,152,161,28,238,46,184,36,185,20,203,183,98,95,41,149,93,105,37,116,91,68,105,164,217,30,42,60,53,173,213,177,216,195,53,204,173,128,243,42,122,205,65,97,129,194,68,218,91,141,11,224,124,132,138,119,36,220,161,39,214,146,183,193,225,23,177,201,243,128,160,33,75,86,126,139,254,232,14,13,85,2,112,17,150,36,180,86,226,225,126,197,17,228,225,142,245,37,170,39,96,187,190,2,35,85,237,11,189,1,79,237,2,1,114,246,109,190,66,54,153,43,218,204,70,6,204,162,247,18,130,123,30,60,165,130,142,210,133,91,127,117,71,38,145,172,7,5,16,220,222,111,98,141,239,208,125,26,238,28,0,216,89,13,7,119,134,194,75,41,67,174,1,217,80,101,40,26,59,28,59,46,108,138,38,157,167,28,234,73,177,42,42,102,108,26,181,27,178,42,43,52,28,110,117,198,173,176,178,101,225,150,36,139,108,105,10,237,222,3,143,126,18,144,115,74,56,114,134,231,159,212,62,126,80,173,216,167,4,81,18,52,17,144,218,32,139,207,104,128,229,99,84,120,31,87,227,154,91,196,63,123,111,125,36,52,57,168,113,150,189,204,24,104,196,237,86,163,68,197,202,170,212,191,81,193,111,255,162,181,202,156,146,196,96,16,118,117,55,71,156,31,163,242,204,239,11,150,27,126,115,154,107,247,134,158,125,255,146,35,183,209,36,116,87,215,172,5,251,133,114,254,141,195,6,145,4,111,182,167,74,154,152,68,18,146,88,106,200,154,15,176,94,86,66,178,101,219,35,188,129,66,28,41,110,174,53,88,174,64,191,206,127,48,126,214,216,93,119,2,166,99,181,222,29,218,28,195,219,125,44,50,16,99,174,225,51,133,120,184,159,168,75,242,162,124,255,81,25,153,109,69,220,176,4,237,196,233,19,8,240,160,39,122,81,29,188,144,249,170,174,137,30,10,93,133,151,199,248,175,38,41,144,229,245,149,25,240,138,179,114,182,84,50,103,95,31,199,31,87,208,203,199,135,49,211,43,52,36,74,59,37,22,136,171,244,126,18,251,39,159,241,66,206,127,149,159,182,143,232,199,136,46,150,32,51,221,74,22,102,93,22,44,132,140,199,43,69,249,77,75,140,70,4,252,98,235,77,190,125,18,56,21,10,244,42,2,246,62,127,241,123,137,22,247,219,177,160,84,18,10,84,97,251,127,102,16,209,181,100,94,56,238,209,207,76,189,95,15,165,139,143,189,96,225,55,112,178,27,218,198,223,251,52,123,94,130,220,142,216,116,237,18,254,49,59,128,41,29,15,179,164,85,76,167,166,151,39,221,2,190,68,167,26,177,114,141,4,67,25,69,182,38,166,160,27,151,148,108,48,227,60,112,48,22,159,76,127,251,63,254,177,113,217,197,95,179,109,128,138,99,27,249,10,174,155,129,80,39,165,252,85,60,131,183,98,107,68,207,19,233,231,55,225,126,77,49,53,145,203,113,29,208,64,237,182,229,165,7,11,169,106,253,116,141,200,62,16,38,121,55,148,91,83,160,140,126,121,12,79,189,72,172,31,243,240,209,229,32,220,91,229,81,94,247,121,153,151,232,182,171,198,50,31,152,245,172,151,130,55,62,125,38,155,229,78,207,148,201,2,78,63,119,107,168,78,139,141,163,177,191,239,141,39,182,174,40,76,226,62,125,209,6,6,34,37,147,85,204,103,51,191,36,248,17,175,20,1,53,16,35,143,237,177,125,86,29,219,235,20,121,205,59,5,250,107,109,32,224,30,152,143,113,151,95,85,19,254,164,135,124,68,136,199,29,31,244,91,10,84,127,101,210,70,226,195,140,70,166,54,217,165,84,42,165,175,100,234,124,121,105,53,101,118,174,101,220,147,68,161,37,0,182,220,142,221,155,230,115,164,10,214,208,120,91,152,66,27,81,184,48,84,70,7,128,153,217,218,249,226,70,130,200,156,61,227,21,164,137,193,221,119,10,134,204,23,20,17,90,94,105,204,39,99,1,64,153,45,213,19,247,97,194,49,35,125,255,195,139,63,209,175,208,147,189,244,204,24,211,99,142,18,92,130,254,182,231,235,93,10,127,175,87,35,62,110,137,184,39,114,200,150,11,190,40,162,168,223,203,110,242,192,234,26,11,54,155,38,48,79,109,101,119,165,187,223,5,20,168,171,241,20,243,108,199,3,155,69,244,149,0,187,110,12,233,42,151,189,139,133,104,3,30,16,200,69,4,123,103,144,12,106,182,1,127,91,125,158,12,144,238,232,209,101,159,56,163,240,179,50,169,120,219,176,87,77,45,247,153,190,82,132,50,137,209,97,19,35,247,161,62,77,16,71,152,72,61,50,99,157,154,56,58,175,27,73,121,229,195,228,132,69,233,169,100,21,123,17,3,164,6,146,106,196,29,3,250,217,164,23,171,203,14,242,239,249,169,116,138,209,98,113,181,122,35,162,216,46,230,4,155,142,118,216,232,229,28,12,158,153,126,149,171,172,231,99,211,57,114,136,183,114,74,35,233,115,127,253,157,38,49,136,141,25,161,255,232,110,101,208,166,186,226,12,185,19,155,53,93,155,39,161,7,124,213,52,223,125,211,242,253,22,13,131,115,167,198,188,90,209,63,224,92,112,118,220,165,31,164,43,58,197,77,17,247,77,164,74,77,218,18,187,41,76,189,127,98,18,226,231,71,115,236,68,183,111,50,168,88,247,9,123,65,180,88,74,44,101,101,173,11];class Om extends qo{constructor(e,r,i){super(e,bm,r,i)}}let Bm=[11,196,242,139,198,252,188,5,32,162,171,128,13,160,25,222,172,102,207,244,158,69,103,57,239,111,150,18,157,82,55,210,20,131,156,165,108,122,254,125,130,229,55,109,113,11,210,238,163,213,86,116,156,248,215,63,20,48,173,31,55,133,18,105,32,16,204,35,128,38,212,87,200,97,114,40,12,210,193,171,59,33,158,108,14,75,228,74,65,32,57,192,112,156,234,250,140,189,40,20,6,230,135,52,17,200,123,68,183,44,215,187,234,2,13,169,234,94,115,60,6,107,224,118,254,88,2,235,134,36,120,5,85,94,126,222,223,101,105,227,147,199,64,185,246,143,183,210,30,37,127,226,79,156,118,147,208,131,51,248,232,217,206,181,218,58,61,112,244,227,68,45,41,206,69,12,45,163,205,75,6,23,167,145,250,237,92,84,164,240,253,216,54,85,7,108,62,255,42,217,3,27,0,196,94,28,241,120,80,92,89,135,228,125,2,3,242,39,116,64,248,216,177,122,66,178,180,9,7,33,186,208,213,188,59,78,243,95,123,28,142,45,99,130,7,167,194,156,238,199,10,71,141,251,221,158,16,255,38,181,36,184,20,136,240,55,27,51,191,82,105,55,97,78,74,121,191,161,91,126,105,103,174,139,223,145,150,120,156,240,252,182,105,104,205,65,97,129,194,68,218,91,141,11,224,124,132,138,119,36,201,211,39,203,146,225,246,252,21,161,250,188,137,190,42,4,90,126,211,171,240,113,67,28,92,57,77,200,125,224,19,178,142,112,202,5,233,229,128,235,105,239,102,52,179,224,87,45,68,211,10,187,9,38,190,86,25,43,175,56,231,11,108,220,36,129,131,19,93,163,239,169,118,205,50,77,121,139,139,141,197,170,20,44,39,19,97,205,228,8,106,67,210,135,111,127,141,185,175,123,26,226,42,29,217,16,99,9,46,157,232,22,3,105,174,73,144,23,110,55,84,46,4,116,39,113,205,58,158,242,7,208,75,162,55,115,35,52,124,235,114,178,55,43,98,17,100,33,134,237,190,230,60,184,192,104,146,52,58,79,174,180,81,155,114,0,153,113,90,51,86,150,254,136,205,104,39,11,190,187,233,80,81,81,56,18,222,148,116,155,156,33,132,226,127,84,34,83,28,249,153,18,197,10,116,102,125,45,47,36,235,46,212,166,209,3,125,132,237,124,163,68,197,202,232,152,234,75,235,103,248,160,241,213,151,144,130,37,23,51,48,55,12,227,31,163,242,251,245,22,129,77,20,35,150,20,181,203,138,69,233,215,109,178,209,52,85,96,221,179,56,249,138,111,250,141,134,95,152,92,109,183,174,104,151,156,31,66,211,10,57,141,167,18,177,27,126,74,252,29,143,121,173,203,8,27,44,123,148,57,88,163,68,228,158,62,98,121,192,228,94,92,72,241,33,230,173,0,197,1,194,144,111,91,60,0,106,181,203,51,133,120,250,158,184,93,216,184,126,253,21,22,155,99,80,205,227,69,231,141,165,71,70,252,223,105,51,93,22,165,135,233,177,164,139,53,5,85,151,134,214,165,249,100,24,186,207,245,149,68,218,204,252,32,190,90,48,76,57,31,201,15,52,130,135,152,206,63,198,100,126,36,2,104,116,0,160,163,186,2,91,165,57,149,163,12,239,121,152,209,224,136,248,135,136,46,150,32,51,154,6,105,0,71,30,44,175,147,139,34,91,184,78,31,145,18,3,250,122,166,47,252,109,19,40,10,123,163,99,76,133,119,37,180,38,207,79,171,185,188];class Nm extends qo{constructor(e,r,i){super(e,Bm,r,i)}}let Pm=[11,196,242,139,198,252,188,5,32,162,171,128,13,160,25,222,172,102,207,244,158,69,103,57,239,111,150,18,157,82,55,210,20,131,156,160,96,121,255,120,207,227,114,120,38,72,149,145,165,227,75,122,158,250,232,46,34,52,135,9,30,144,17,110,126,110,130,71,156,46,210,67,202,51,119,97,3,211,214,227,45,109,151,97,21,10,229,53,80,26,51,202,119,128,230,197,140,135,40,14,88,128,202,95,21,208,96,83,185,98,216,242,224,15,25,224,233,86,96,46,80,120,220,48,187,86,30,240,140,46,95,81,48,90,117,140,177,51,107,235,158,137,5,241,191,154,149,219,30,126,85,175,10,216,63,139,216,151,122,251,224,202,220,227,221,53,122,34,213,224,94,45,14,200,68,31,61,175,208,17,120,82,244,138,208,165,21,19,236,232,180,217,50,74,70,126,114,227,62,192,124,9,85,148,33,77,255,117,75,102,87,151,255,87,74,74,181,111,108,9,249,220,174,59,80,254,168,29,30,94,171,133,133,195,105,64,254,68,65,18,158,54,73,203,65,175,151,170,236,138,17,119,128,237,214,189,28,250,38,149,97,242,81,212,254,57,18,120,155,64,96,108,75,78,74,121,191,243,30,42,60,103,165,196,160,195,216,99,182,173,214,182,105,53,231,3,45,212,144,101,217,65,141,44,230,125,151,154,123,57,134,223,98,133,156,238,137,181,80,175,230,167,131,180,13,69,77,44,156,165,252,14,27,85,71,1,82,196,64,243,26,167,146,98,201,6,195,247,200,224,44,177,104,109,187,231,83,118,28,159,92,179,28,14,162,81,84,21,168,34,156,21,127,215,88,218,208,11,92,161,239,239,82,221,59,86,83,201,199,216,151,139,23,54,39,52,103,204,247,24,102,94,157,138,42,49,131,183,208,50,95,236,54,6,211,26,68,72,56,212,134,24,91,114,132,1,217,80,38,47,29,47,0,107,102,99,129,33,140,243,74,251,89,247,103,12,114,58,113,240,72,188,39,48,72,89,45,102,206,245,247,231,56,167,129,122,222,47,40,78,227,159,64,206,34,127,203,127,87,40,108,152,238,147,231,46,104,89,182,180,232,86,89,91,57,10,222,202,59,199,135,60,199,189,40,84,125,28,84,162,210,91,143,34,106,117,118,3,125,126,237,60,131,173,153,69,49,212,204,117,163,31,239,202,232,152,234,3,162,32,176,184,184,196,154,131,144,115,6,53,122,55,69,166,19,230,183,175,244,1,156,11,37,121,134,121,152,142,158,125,229,150,44,183,216,109,7,65,222,169,56,222,140,110,233,157,138,66,208,6,111,166,188,76,208,222,4,104,211,10,57,141,243,65,228,86,85,88,169,91,237,56,249,133,77,21,32,37,230,55,0,184,110,228,158,62,98,45,147,177,19,119,89,164,103,132,239,84,139,68,204,157,49,41,50,89,113,159,203,51,133,120,184,210,237,15,249,187,100,253,50,16,154,112,64,193,254,10,235,200,253,84,31,169,171,39,122,70,46,186,139,212,162,173,158,41,23,86,148,172,196,237,242,58,102,180,150,238,191,25,240,204,252,125,148,29,124,51,95,10,196,55,49,159,138,144,255,126,205,43,49,42,17,59,60,77,139,177,239,64,36,224,98,205,234,70,199,103,139,218,206,207,178,217,255,32,134,59,25,221,74,22,102,82,19,20,170,142,134,42,106,249,64,80,222,28,21,169,50,235,4,237,56,81,87,76,32,251,42,6,173,105,54,191,8,136,5,245,206,239,176,9,116,24];class xm extends qo{constructor(e,r,i){super(e,Pm,r,i)}}let Mm=[11,196,242,139,198,252,188,5,32,162,171,128,13,160,25,222,172,102,207,244,158,69,103,57,239,111,150,18,157,82,55,210,20,131,156,190,100,112,230,97,199,225,96,74,99,94,248,222,162,213,95,122,158,212,233,42,22,37,217,115,36,152,30,123,116,104,212,109,129,41,220,77,213,97,124,45,4,219,197,171,40,18,149,104,20,4,248,102,64,9,50,217,124,131,180,188,159,170,63,1,84,130,150,117,14,212,118,67,165,97,207,242,251,15,30,187,188,77,79,122,67,101,252,109,244,82,37,191,227,35,114,87,57,71,99,218,155,54,101,239,138,197,13,226,228,176,157,158,87,98,55,251,79,150,64,138,200,135,40,132,135,207,146,252,222,57,58,111,151,225,78,59,36,210,70,29,121,160,210,31,109,67,167,194,177,236,91,108,164,229,130,211,59,66,93,18,107,226,54,210,51,8,77,217,19,73,187,33,30,59,9,135,162,49,5,11,225,111,119,11,247,218,129,115,83,205,170,21,4,69,210,133,134,245,109,15,177,9,81,81,203,105,42,158,12,255,151,165,230,205,5,92,196,251,211,187,27,214,43,186,91,233,85,192,229,15,71,38,220,20,38,101,44,78,7,60,251,186,75,103,108,53,166,220,186,208,194,120,207,230,159,248,22,32,142,124,96,157,222,60,191,65,145,6,239,125,151,147,50,58,130,207,110,131,223,231,137,238,28,182,216,167,198,191,37,67,76,1,144,232,218,79,72,28,65,101,43,216,64,253,16,173,179,123,140,27,233,245,199,230,36,181,102,114,247,162,18,34,20,212,25,171,24,28,143,80,94,40,167,34,209,61,117,130,1,198,196,7,21,252,180,255,92,128,119,9,48,156,138,136,151,143,23,44,52,3,40,197,228,31,123,67,163,140,32,54,204,187,149,80,19,255,82,120,195,12,110,65,56,212,143,22,78,44,234,72,140,29,118,103,18,36,7,122,50,37,139,47,142,243,25,208,88,237,126,50,103,127,19,183,29,169,29,1,55,23,100,32,129,239,243,160,61,178,197,117,199,45,57,26,165,135,92,218,59,0,197,54,13,96,40,141,212,221,131,103,46,22,228,191,167,73,20,86,62,11,147,217,116,205,203,110,134,249,51,6,123,23,86,231,157,8,144,83,126,115,118,35,96,36,229,36,220,228,143,71,45,223,129,48,236,5,145,202,188,208,184,70,241,104,255,188,181,146,210,206,144,53,77,101,120,38,8,245,80,230,165,160,183,83,202,79,127,57,214,126,242,150,208,40,239,148,35,163,201,97,74,70,214,181,63,240,147,33,253,149,140,77,197,82,126,189,231,7,196,212,80,14,151,24,57,144,243,81,234,66,24,19,236,2,137,121,246,129,65,7,99,110,174,54,74,182,81,234,142,37,72,110,220,255,64,119,10,188,111,191,228,1,205,9,204,143,56,62,125,84,106,225,131,97,192,43,240,157,161,75,168,247,44,175,65,81,192,48,21,157,167,80,191,130,161,75,85,186,174,42,117,1,68,252,204,138,254,203,152,21,13,64,144,195,207,238,229,54,103,247,159,245,211,85,191,141,168,32,234,85,46,118,12,5,199,4,19,217,203,202,156,33,143,114,116,60,66,40,58,77,208,237,171,26,72,175,114,205,248,87,137,62,210,143,151,197,167,210,241,122,150,104,122,154,2,70,102,83,19,36,141,136,199,42,79,229,71,86,194,109,31,236,80,166,17,230,109,1,40,28,46,224,56,20,230,47,100,254,116,208,76,169,157,241,175,3,70,85,31,38,245,58,33,80,145,237,8,22,71,224,158,156,31,249,81,87,247,230,199,237,96,167,123,63,243,79,156,206,203,160,54,124,68,253,215,132,235,57,185,92,238,55,59,210,104,71,26,183,180,71,12,255,224,192,65,154,72,244,8,164,10,248,46,207,30,92,1,80,244,31,189,138,88,216,218,63,100,227,116,57,119,94,135,5,126,255,32,191,163,61,209,194,88,248,112,139,173,43,69,134,3,160,151,137,25,98,239,166,19,123,208,180,31,120,30,191,75,183,179,126,180,125,92,107,105,206,138,28,67,139,3,188,230,184,255,121,13,181,45,160,114,202,194,123,87,55,124,97,164,82,95,232,216,117,62,5,90,176,82,167,52,160,153,174,168,105,146,91,248,81,79,249,97,138,133,170,245,229,132,61,5,149,224,246,194,213,61,12,109,44,136,235,95,219,133,220,27,93,36,93,124,180,81,141,152,220,170,163,229,197,124,171,232,48,70,251,106,119,150,20,16,49,119,247,42,132,36,76,254,124,177,66,175,9,1,39,92,127,195,171,198,34,2,64,144,179,72,40,151,110,89,229,42,125,33,238,16,220,228,51,203,8,1,68,145,253,133,118,93,163,129,22,13,248,65,12,4,63,101,210,70,170,138,203,14,246,54,194,195,27,107,241,175,35,171,49,52,106,121,45,36,152,85,215,132,78,167,34,18,167,245,152,133,134,170,120,182,10,146,191,37,2,205,47,125,20,203,44,88,81,32,150,223,220,218,238,254,30,212,167,221,115,156,82,226,137,220,221,97,3,139,202,33,9,27,26,126,40,215,25,126,9,82,208,49,217,14,161,81,196,61,60,87,254,213,194,81,216,161,151,209,166,222,230,24,128,117,140,92,4,203,254,170,253,249,88,90,112,226,18,44,122,39,158,158,56,69,204,159,5,179,51,197,233,139,216,102,226,206,248,15,78,112,214,126,67,28,40,38,98,190,178,206,67,94,245,254,160,101,176,32,157,26,132,83,252,228,87,242,32,127,160,112,210,224,133,149,115,41,30,16,200,69,89,81,77,144,12,106,182,73,54,28,53,195,28,216,179,179,136,35,141,102,234,177,240,34,186,106,145,245,3,84,48,251,157,245,11,217,111,227,138,42,67,114,211,177,37,103,16,71,152,72,117,123,36,213,202,56,124,227,84,8,45,229,149,165,214,69,244,169,55,68,62,94,104,228,74,205,123,222,17,7,172,158,227,74,206,149,67,175,171,251,185,121,151,223,63,35,229,32,49,190,209,120,137,69,213,214,19,150,187,177,28,12,158,153,126,149,171,167,234,120,129,109,32,157,180,75,66,56,233,115,127,230,157,32,34,143,156,31,230,168,174,125,118,195,249,243,165,81,246,10,144,15,103,139,55,173,7,59,136,69,172,54,132,165,140,78,77,230,33,169,129,188,71,209,109,161,8,57,57,199,143,31,164,43,58,130,1,110,145,31,229,13,46,149,94,244,106,76,238,105,107,1,183,177,10,61,225,94,185,116,58,183,95,225,22,119,19,248,28,13,123,125,108,158,64,184,77,245,153,162,217,227,208,41,185,211,235,41,153,181,54,166,165,11,154,55,21,184,209,192,249,44,164,160,29,229,159,82,156,198,241,183,114,83,137,186,151,148,31,21,197,216,145,32,13,50,22,241,137,39,71,28,142,160,215,107,221,45,202,104,227,110,186,12,150,145,240,51,49,44,196,115,224,238,149,189,134,99,67,241,62,157,240,114,247,195,26,200,141,97,147,249,23,150,174,10,13,219,81,73,58,242,96,250,243,15,49,218,58,230,104,252,175,150,123,86,185,84,90,198,6,36,0,99,72,28,166,238,115,231,171,249,179,71,174,68,156,227,17,198,79,73,142,99,144,20,80,62,80,191,142,46,71,9,243,6,8,214,116,72,190,106,161,19,185,100,9,187,64,94,86,203,174,156,245,222,95,54,30,148,19,11,50,112,96,61,237,159,173,7,154,127,175,79,48,97,89,78,126,66,171,204,158,195,27,226,205,222,157,89,251,90,125,37,212,27,97,3,141,247,175,50,121,7,187,68,196,181,202,167,189,57,84,81,222,23,27,84,130,176,98,66,240,207,18,23,28,163,163,194,45,37,129,202,170,97,189,0,81,238,0,39,199,163,35,211,206,247,65,29,116,242,67,102,235,13,136,232,230,114,146,187,7,254,142,26,121,16,237,5,160,201,114,94,178,199,95,212,241,45,112,180,188,72,86,114,189,155,149,149,163,210,112,101,12,69,225,75,202,223,28,242,90,215,156,169,224,245,135,128,92,148,217,131,208,255,25,135,117,136,5,104,185,249,161,228,214,16,105,204,9,182,135,153,220,101,244,160,207,58,182,118,185,240,57,245,123,13,112,182,106,229,220,90,29,86,215,96,147,232,2,55,131,225,137,68,245,89,141,252,97,3,129,155,216,223,98,116,45,78,85,141,161,74,215,7,150,171,225,59,78,221,152,236,14,117,100,208,158,86,13,185,124,87,157,111,40,187,182,124,173,71,173,23,199,52,155,190,134,11,23,64,25,215,39,115,231,173,77,72,114,54,252,116,178,59,221,106,241,119,254,30,226,241,204,233,113,197,96,146,0,41,67,3,231,126,12,218,202,22,171,114,249,176,134,160,19,216,31,229,118,226,62,242,126,126,42,127,130,68,218,218,81,202,106,217,191,25,177,82,97,81,36,232,137,58,90,216,190,117,235,20,194,144,76,178,27,213,13,208,18,29,118,126,49,98,203,179,128,237,100,32,242,189,212,6,210,210,188,161,205,13,124,119,13,215,112,41,183,176,215,168,210,182,111,1,115,2,239,141,8,177,124,112,48,197,2,239,11,99,4,36,77,69,47,244,19,153,61,19,2,96,176,7,112,122,131,169,25,189,116,171,49,12,121,162,79,154,74,251,50,233,182,63,180,224,118,49,253,21,20,16,31,144,184,93,174,231,244,183,13,49,225,189,211,73,185,49,110,142,25,226,45,176,233,204,74,33,16,205,88,131,92,157,170,175,68,170,61,53,116,165,16,27,182,160,181,87,241,15,151,85,107,76,167,129,25,172,127,184,138,153,222,228,125,64,44,45,32,12,227,148,106,152,83,240,166,54,235,32,190,12,242,164,123,189,53,194,141,104,43,202,110,4,168,119,245,232,179,178,198,1,224,87,86,160,31,19,140,233,102,191,204,4,98,138,163,191,106,24,213,47,208,82,137,132,131,16,253,84,25,144,90,159,148,16,196,84,166,61,160,101,229,227,93,118,59,87,66,16,128,59,96,131,250,20,184,150,205,91,227,201,62,35,79,180,172,173,85,197,106,153,238,229,60,204,65,193,230,94,101,177,134,6,165,53,171,142,208,155,2,11,4,202,127,54,17,142,117,227,121,128,204,192,147,147,92,189,5,224,148,72,18,83,101,126,124,228,153,242,123,229,247,92,221,6,73,227,250,87,167,194,129,187,73,38,185,109,217,240,193,88,50,178,180,151,54,197,187,137,190,166,233,1,103,204,88,31,127,185,29,65,1,29,254,223,14,83,167,215,114,248,30,173,89,173,187,69,5,105,117,15,106,94,173,63,227,25,230,190,136,168,177,175,107,91,126,254,34,188,25,118,48,12,226,130,153,162,57,47,181,212,79,160,97,64,157,246,90,53,43,149,76,102,15,195,107,58,242,84,172,29,81,198,113,81,251,138,182,154,111,30,171,129,56,17,45,214,153,112,117,203,174,40,38,234,236,32,4,112,225,26,187,195,246,252,9,218,69,160,223,178,54,148,81,8,134,151,75,248,63,224,240,48,75,250,221,85,46,100,50,3,70,64,102,111,160,155,233,59,147,184,57,61,6,126,79,176,16,185,94,166,33,135,78,42,75,140,208,140,44,153,187,64,103,119,160,236,16,239,74,218,219,212,207,110,53,30,76,248,40,111,98,44,20,113,204,233,109,135,96,107,39,163,203,125,45,157,152,71,239,175,174,159,147,80,111,93,38,253,228,154,225,181,101,12,241,127,65,49,189,5,85,151,237,213,143,14,104,138,54,52,27,4,132,67,35,156,86,157,73,16,229,222,245,110,79,165,179,56,179,53,218,229,100,58,87,149,48,231,64,63,115,67,3,172,6,186,115,154,60,53,214,152,149,89,234,37,143,82,255,64,28,183,93,112,39,70,185,57,0,199,9,61,175,219,41,76,37,176,82,125,65,53,160,214,105,62,153,244,222,96,205,6,178,85,41,240,113,0,96,149,38,3,195,18,152,41,246,3,103,29,110,134,30,101,75,46,103,199,184,20,230,8,55,120,4,229,168,35,43,7,28,161,143,87,27,87,79,255,186,44,195,158,155,181,119,81,172,217,107,95,98,55,243,186,66,105,48,224,123,232,84,156,20,10,156,208,204,52,34,228,136,97,242,200,246,211,67,202,40,241,91,92,253,9,54,72,131,221,106,178,32,44,182,4,225,193,37,20,249,249,231,10,206,18,71,254,221,187,172,88,204,6,127,138,102,7,208,75,147,219,199,177,79,36,170,101,207,177,109,95,143,217,41,199,80,183,201,2,254,12,55,23,198,14,255,69,245,138,155,129,227,167,168,130,156,135,14,96,93,48,99,143,107,126,92,117,143,112,108,193,228,84,13,41,186,27,172,92,201,149,116,19,112,197,116,209,128,102,1,55,152,177,28,37,34,50,83,41,199,74,178,59,111,67,118,35,252,36,33,87,28,170,17,215,47,90,154,124,137,15,14,211,59,75,59,30,77,0,49,37,225,191,87,101,127,214,227,160,99,174,234,82,148,235,16,241,219,147,170,127,221,250,116,39,218,156,72,227,172,55,0,79,188,76,51,222,232,24,36,62,94,154,3,61,230,146,114,253,0,128,58,253,90,72,211,242,38,39,133,153,161,119,105,195,152,225,208,105,140,80,217,186,196,157,21,116,230,116,139,25,159,143,118,128,77,201,238,247,228,15,168,4,133,148,21,148,12,44,241,7,115,17,129,176,202,46,130,122,129,235,141,223,85,21,199,65,181,169,52,174,161,153,62,25,164,115,213,89,138,199,103,79,200,165,135,249,244,27,209,178,240,129,211,61,9,111,157,147,119,36,119,255,110,130,84,49,210,225,247,100,26,121,127,163,160,26,79,99,24,77,65,32,178,109,36,27,253,173,110,183,11,14,211,57,130,254,124,104,165,219,31,70,97,14,194,39,61,26,141,125,228,126,194,184,101,160,204,106,128,144,106,103,171,18,246,129,220,85,172,151,123,5,73,155,192,175,91,157,239,61,237,116,170,65,233,56,19,49,114,168,190,3,214,53,250,90,213,244,88,101,30,229,248,124,15,71,141,27,172,235,21,129,211,72,61,172,112,170,128,135,96,196,221,255,27,176,105,188,183,121,33,37,149,53,131,226,233,29,167,234,218,109,53,185,152,36,248,53,61,235,78,21,201,214,210,163,12,251,187,45,188,137,126,127,237,92,234,91,240,225,38,194,57,213,251,237,171,30,99,52,14,49,84,101,252,237,7,166,122,114,32,107,32,207,239,136,168,178,12,11,241,233,230,146,132,18,83,233,41,172,17,6,161,42,113,87,40,255,185,1,146,128,5,240,126,131,71,42,54,124,205,2,122,71,30,222,229,40,134,142,102,97,239,151,177,1,230,231,49,123,219,28,129,91,152,112,13,154,81,197,226,255,112,158,178,177,55,181,108,138,185,245,29,186,21,73,188,209,154,200,89,116,235,198,144,36,87,248,22,7,200,122,7,148,44,42,87,140,238,204,95,231,252,0,136,0,22,39,70,123,125,165,113,227,172,146,163,128,158,36,52,91,19,36,245,27,150,138,141,11,67,239,224,65,24,116,101,7,39,46,142,172,164,243,148,0,33,226,59,47,203,137,156,241,66,250,157,30,204,101,143,134,98,238,155,226,25,184,136,219,89,100,193,11,143,71,139,243,230,151,0,249,1,78,26,32,93,104,157,67,97,164,248,86,124,146,93,74,222,228,167,55,53,100,135,216,109,13,64,37,106,177,200,200,182,92,251,69,31,243,89,80,198,14,132,203,72,103,28,104,217,24,97,223,113,11,29,178,191,210,46,162,255,68,99,8,237,213,162,152,193,183,121,203,19,108,182,29,86,26,192,103,220,103,205,154,179,197,9,22,73,127,175,146,38,119,210,0,24,180,21,245,215,204,91,186,119,138,183,239,15,155,231,248,133,39,24,101,144,236,10,230,54,174,227,73,21,110,10,160,241,232,131,14,212,127,232,59,122,65,146,54,163,9,189,190,121,88,170,62,194,14,204,152,245,38,131,37,91,81,72,114,29,115,239,182,56,44,156,159,177,180,82,160,93,97,86,183,236,50,95,85,39,71,181,225,152,143,63,123,117,34,44,109,160,166,229,240,91,138,102,54,180,173,44,50,80,42,124,7,50,124,211,239,21,94,197,185,239,213,107,142,64,95,124,125,17,180,97,189,101,52,48,19,112,12,70,9,212,177,54,118,66,84,147,236,248,26,124,95,103,135,254,124,49,112,186,99,120,90,8,194,191,88,57,242,65,61,10,104,246,197,252,19,159,58,194,75,173,242,103,8,115,84,69,238,149,26,15,159,182,141,132,119,70,29,53,20,143,46,163,204,6,236,59,45,185,172,89,119,83,38,144,36,222,96,151,26,99,195,163,170,133,92,159,214,53,150,116,90,176,69,145,130,15,172,140,217,215,101,163,115,161,65,101,8,7,183,113,213,134,58,175,130,251,143,173,248,168,135,60,159,30,194,68,208,119,120,2,40,178,227,247,161,77,47,136,46,244,163,72,65,158,25,225,195,61,132,182,204,177,186,200,81,2,65,105,212,72,94,203,232,217,182,123,251,228,160,1,161,204,123,20,37,1,77,208,179,45,149,181,122,102,190,123,213,164,231,41,216,130,234,248,208,251,252,220,84,209,67,47,61,220,5,142,162,26,236,121,142,248,132,255,65,122,203,196,102,191,187,2,195,127,255,193,92,49,91,186,154,39,156,29,211,172,49,104,245,114,153,223,211,199,249,35,130,160,128,0,152,176,183,20,236,113,193,108,26,255,11,237,102,133,245,94,115,114,10,89,229,214,221,99,149,30,99,37,246,10,26,26,39,92,123,170,73,211,127,227,54,30,86,133,159,112,225,91,148,100,174,149,75,143,14,140,20,44,64,212,5,243,8,116,63,30,97,42,123,20,73,212,85,207,83,122,27,251,233,84,10,17,236,232,83,200,127,119,143,163,204,220,167,59,231,20,106,186,222,191,8,40,234,21,25,180,13,116,250,152,224,174,75,3,205,38,173,215,236,151,185,121,254,244,154,239,17,53,106,164,61,49,116,216,118,94,150,35,181,26,238,66,49,211,221,132,146,166,115,39,136,36,205,230,179,31,197,51,148,165,109,38,70,37,148,52,44,209,250,98,58,246,225,103,198,101,26,25,196,207,8,166,21,88,252,175,253,10,88,107,157,19,225,61,12,246,221,37,239,186,167,137,142,135,222,128,174,62,95,216,38,141,157,45,232,97,217,173,203,234,116,129,69,206,189,94,221,12,54,139,186,247,184,16,200,121,244,104,8,7,35,111,47,188,10,140,92,73,143,206,203,72,122,184,20,102,197,130,64,150,63,96,239,8,132,111,217,84,91,198,32,43,100,138,241,15,160,42,190,253,193,184,164,124,29,210,96,67,224,221,182,29,218,129,149,29,128,174,98,88,88,125,56,40,255,120,5,0,87,174,42,150,90,112,201,183,169,19,57,195,191,12,58,244,235,132,25,145,72,146,214,8,125,100,135,12,5,102,97,248,174,24,159,90,33,43,187,6,61,212,241,225,190,219,252,197,123,129,164,108,123,55,230,4,153,166,105,234,15,85,216,23,56,32,3,41,110,68,146,172,133,202,98,41,7,47,152,35,255,168,106,241,226,222,77,244,52,185,65,252,227,32,66,38,11,172,60,28,28,103,84,1,1,205,182,190,28,189,102,253,43,1,191,148,116,10,227,18,81,93,80,239,157,232,215,180,163,165,161,109,177,71,150,244,144,208,160,110,22,174,60,206,43,103,121,55,103,114,115,173,238,13,10,227,251,41,176,216,158,229,216,55,234,128,128,20,167,106,181,86,163,130,215,110,149,191,10,227,215,8,214,154,178,181,15,19,0,247,250,97,74,43,157,55,94,174,41,41,9,199,97,20,91,32,18,10,43,98,240,247,203,20,250,117,160,44,229,202,187,64,54,124,15,184,169,129,27,160,240,26,61,255,60,166,60,144,209,84,55,187,186,168,13,124,125,29,17,100,249,227,62,205,78,179,163,168,139,168,21,38,83,239,151,74,43,66,2,92,72,71,94,216,134,238,20,45,158,213,164,73,57,80,47,198,184,130,223,227,71,132,133,235,177,85,174,142,124,172,200,54,229,40,126,60,76,92,216,153,56,241,174,66,141,90,226,3,30,68,234,71,187,163,112,146,255,22,143,170,204,3,127,179,81,139,160,37,77,246,128,220,196,158,153,73,177,65,199,119,29,197,144,130,248,206,155,253,108,213,124,7,223,221,162,146,134,242,65,99,162,107,120,247,214,207,96,150,169,131,208,218,221,28,24,112,208,23,1,130,142,232,56,104,45,33,158,95,255,123,31,74,76,120,178,155,213,6,195,164,8,8,69,241,197,127,83,169,21,167,19,94,143,252,33,159,248,241,170,153,147,1,149,199,201,131,170,79,236,212,209,143,107,98,24,123,56,33,193,85,247,64,225,135,210,78,145,57,16,145,71,170,20,133,87,235,4,166,239,100,82,235,81,50,223,9,193,52,49,86,129,190,196,82,165,107,63,115,161,98,33,20,193,29,42,151,205,252,124,72,245,48,181,67,7,13,21,127,59,226,188,144,129,112,244,192,121,213,80,42,196,1,13,107,108,78,0,40,121,225,148,237,234,209,216,238,9,147,226,254,96,89,212,72,193,106,75,135,74,227,67,255,92,191,81,188,124,226,149,152,142,15,159,195,238,114,55,255,166,157,230,59,148,170,166,151,65,213,104,253,253,112,150,82,147,137,27,214,100,247,65,81,92,47,86,217,7,45,120,81,130,31,236,243,76,78,3,45,105,172,220,71,48,220,94,196,249,163,193,133,50,236,205,20,55,2,63,14,127,69,113,212,204,12,58,79,89,86,29,61,199,201,64,149,6,144,182,150,129,31,18,167,120,248,82,107,25,143,128,27,161,28,25,153,183,217,238,78,186,106,92,27,202,219,165,96,0,216,234,169,73,101,39,182,113,217,240,170,116,172,221,250,233,48,49,242,83,227,92,181,184,72,230,180,21,15,108,135,25,38,153,25,124,227,26,149,73,236,39,211,244,149,58,183,132,26,223,219,174,144,117,233,219,165,205,157,159,222,184,52,47,241,201,123,65,24,44,55,215,177,168,250,179,115,190,227,123,158,163,179,224,69,196,66,207,254,243,101,221,193,140,250,4,28,222,52,96,138,160,33,218,64,118,214,234,201,152,148,91,178,111,107,144,142,6,182,102,72,188,34,213,181,26,223,58,255,103,81,17,47,169,11,245,224,123,148,215,237,186,107,75,152,90,202,166,22,149,197,5,246,238,78,76,229,106,199,94,127,195,0,45,82,6,159,103,96,138,231,71,46,107,59,216,39,43,12,221,27,214,56,155,145,66,187,169,250,235,78,211,179,239,183,198,163,93,5,196,24,174,143,225,106,139,89,98,13,127,207,184,194,30,1,165,198,169,8,197,118,86,163,221,138,23,209,61,116,79,99,233,43,130,60,244,85,229,243,172,123,148,200,120,192,127,211,52,11,159,41,95,212,230,188,169,156,137,29,212,12,148,168,148,133,243,44,241,139,127,24,246,220,227,125,209,97,60,52,162,192,146,49,161,92,138,112,189,128,59,126,125,46,207,60,79,231,174,152,209,68,223,205,2,38,14,91,116,159,255,28,27,178,248,164,104,158,79,69,214,234,157,12,75,163,83,253,245,202,61,213,176,6,197,230,29,208,166,253,194,254,235,29,141,241,70,249,15,62,0,148,163,135,52,122,40,96,87,31,179,152,51,216,133,184,122,198,203,60,115,218,191,193,16,178,25,148,252,112,104,103,252,36,92,221,28,179,43,199,198,151,128,100,252,217,161,249,34,201,172,118,52,180,252,104,7,223,44,116,102,212,21,40,224,184,55,163,210,21,207,161,239,51,54,155,41,133,18,67,48,3,165,130,251,4,79,214,57,72,130,157,212,144],km=[0,1,3,4,6,7,9,10,12,13,15,16,18,19,21,22,24,26,29,31,34,36,39,41,44,46,49,51,54,56,59,61,64,65,66,67,68,69,70,72,73,74,75,76,77,79,80,81,82,83,84,85,87,88,89,90,91,92,94,95,96,97,98,99,101,102,103,104,105,106,107,109,110,111,112,113,114,116,117,118,119,120,121,123,124,125,126,127,128,129,131,132,133,134,135,136,138,139,140,141,142,143,145,146,147,148,149,150,151,153,154,155,156,157,158,160,161,162,163,164,165,166,168,169,170,171,172,173,175,176,177,178,179,180,182,183,184,185,186,187,188,190,191,192,193,194,195,197,198,199,200,201,202,204,205,206,207,208,209,210,212,213,214,215,216,217,219,220,221,222,223,224,226,226,226,227,227,227,228,228,228,229,229,229,230,230,231,231,231,232,232,232,233,233,233,234,234,235,235,235,236,236,236,237,237,237,238,238,239,239,239,240,240,240,241,241,241,242,242,243,243,243,244,244,244,245,245,245,246,246,246,247,247,247,248,248,248,249,249,249,250,250,250,251,251,251,252,252,252,253,253,253,254,254,254,255],yg=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,32,33,35,36,37,39,40,42,43,44,46,47,49,50,51,53,54,56,57,58,59,61,62,63,64,66,67,68,69,71,72,73,74,76,77,78,79,81,82,83,84,86,87,88,90,91,92,93,95,96,97,98,100,101,102,103,105,106,107,108,110,111,112,113,115,116,117,118,120,121,122,124,125,126,127,129,130,131,132,134,135,136,137,139,140,141,142,144,145,146,147,149,150,151,152,154,155,156,158,159,160,161,163,164,165,166,168,169,170,171,173,174,175,176,178,179,180,181,183,184,185,186,188,189,190,192,193,194,195,197,198,199,200,202,203,204,205,207,208,209,210,212,213,214,215,217,218,219,220,222,223,224,226,226,226,227,227,228,228,229,229,230,230,231,231,232,232,233,233,234,234,234,235,235,236,236,237,237,238,238,239,239,240,240,241,241,242,242,243,243,243,244,244,244,245,245,245,246,246,246,247,247,247,248,248,248,249,249,249,250,250,250,251,251,251,252,252,252,253,253,253,254,254,254,255],Um=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,43,44,45,46,47,48,50,51,52,53,54,55,56,58,59,60,61,62,63,65,66,67,68,69,70,72,73,74,76,77,78,80,81,83,84,85,87,88,89,91,92,94,95,96,98,99,100,102,103,105,106,107,109,110,111,113,114,116,117,118,120,121,122,124,125,127,128,129,131,132,133,135,136,138,139,140,142,143,144,146,147,149,150,151,153,154,155,157,158,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,192,193,193,194,195,195,196,197,197,198,199,199,200,201,201,202,203,203,204,205,205,206,207,207,208,209,209,210,211,211,212,213,213,214,215,215,216,217,217,218,219,219,220,221,221,222,223,223,224,225,225,226,227,227,228,229,229,230,231,231,232,233,233,234,235,235,236,237,237,238,239,239,240,241,241,242,243,243,244,245,245,246,247,247,248,249,249,250,251,251,252,253,253,254,255];class Fm extends qo{constructor(e,r,i,n){super(e,Mm,i,n);this.lightLevel=.1,this.rednessLevel=.5,this.mskin_he_max=175/180*3.141593,this.mskin_he_min=115/180*3.141593,this.mskin_hc_max=173/180*3.141593,this.mskin_hc_min=116/180*3.141593,this.mskin_hc_axis=2.04203545,this.mfacts_rotate_ge=this.mfacts_rotate_le=this.mfacts_rotate_c=0,this.tab_addr=null,this.lutTextures=[],this.inputTexture=r,this.init()}setUniforms(){var e=this.gl.getUniformLocation(this.program,"u_flipY"),r=this.gl.getUniformLocation(this.program,"u_denoiseLevel");this.gl.uniform1f(r,this.denoiseLevel),this.gl.uniform1f(e,1),e=this.gl.getUniformLocation(this.program,"light"),this.gl.uniform1f(e,this.lightLevel),e=this.gl.getUniformLocation(this.program,"redness"),this.gl.uniform1f(e,this.rednessLevel),e=this.gl.getUniformLocation(this.program,"skin_he_max"),r=this.gl.getUniformLocation(this.program,"skin_he_min");var i=this.gl.getUniformLocation(this.program,"skin_hc_max"),n=this.gl.getUniformLocation(this.program,"skin_hc_min");let c=this.gl.getUniformLocation(this.program,"skin_hc_axis"),h=this.gl.getUniformLocation(this.program,"facts_rotate_c"),C=this.gl.getUniformLocation(this.program,"facts_rotate_le"),x=this.gl.getUniformLocation(this.program,"facts_rotate_ge");for(this.gl.uniform1f(e,this.mskin_he_max),this.gl.uniform1f(r,this.mskin_he_min),this.gl.uniform1f(i,this.mskin_hc_max),this.gl.uniform1f(n,this.mskin_hc_min),this.gl.uniform1f(c,this.mskin_hc_axis),this.gl.uniform1f(h,this.mfacts_rotate_c),this.gl.uniform1f(C,this.mfacts_rotate_le),this.gl.uniform1f(x,this.mfacts_rotate_ge),e=this.gl.getUniformLocation(this.program,"u_originImage"),this.gl.activeTexture(this.gl.TEXTURE2),this.gl.bindTexture(this.gl.TEXTURE_2D,this.inputTexture),this.gl.uniform1i(e,2),e=["lighten_lut"],r=[this.gl.TEXTURE3],i=0;i<e.length;i++)n=this.gl.getUniformLocation(this.program,e[i]),this.gl.activeTexture(r[i]),this.gl.bindTexture(this.gl.TEXTURE_2D,this.lutTextures[i]),this.gl.uniform1i(n,i+3)}setParameters(e){e.denoiseLevel!==void 0&&(this.denoiseLevel=e.denoiseLevel),e.lightLevel!==void 0&&(this.lightLevel=e.lightLevel),e.rednessLevel!==void 0&&(this.rednessLevel=e.rednessLevel,this.updateRedness(this.rednessLevel)),e.lighteningContrastLevel&&this.updateLut(e.lighteningContrastLevel)}init(){this.tab_addr=new Uint8Array(yg);let e=[this.tab_addr],r=[256],i=[1];for(let n=0;n<e.length;n++){let c=this.gl.createTexture();if(!c)throw new ue(oe.WEBGL_INTERNAL_ERROR,"create lut texture failed");this.gl.bindTexture(this.gl.TEXTURE_2D,c),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,r[n],i[n],0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,e[n]),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.lutTextures.push(c)}}updateRedness(e){var r=e;1<e&&(e=1),0>e&&(e=0),1<r&&(r=1),0>r&&(r=0),this.mfacts_rotate_c=.8*e,.8>r&&(r=0),this.mskin_he_max=175/180*3.141593,this.mskin_hc_max=173/180*3.141593,this.mskin_he_min=(115-4*r)/180*3.141593,this.mskin_hc_min=(116-4*r)/180*3.141593,this.mskin_hc_axis=(117-4*r)/180*3.141593,this.mskin_hc_axis<this.mskin_hc_min&&(this.mskin_hc_axis=this.mskin_hc_min),1.5707965>this.mskin_hc_min&&(this.mskin_hc_min=1.5707965),1.5707965>this.mskin_hc_axis&&(this.mskin_hc_axis=1.5707965),1.5707965>this.mskin_he_min&&(this.mskin_he_min=1.5707965),3.141593<this.mskin_hc_max&&(this.mskin_hc_max=3.141593),3.141593<this.mskin_hc_axis&&(this.mskin_hc_axis=3.141593),3.141593<this.mskin_he_max&&(this.mskin_he_max=3.141593),e=this.mskin_he_max-this.mskin_hc_max,r=this.mskin_hc_max-this.mskin_hc_axis,this.mfacts_rotate_ge=.01<e?this.mfacts_rotate_c*r/e:this.mfacts_rotate_c,e=this.mskin_hc_min-this.mskin_he_min,r=this.mskin_hc_axis-this.mskin_hc_min,this.mfacts_rotate_le=.01<e?this.mfacts_rotate_c*r/e:this.mfacts_rotate_c}updateLut(e){var r=null;if(e===0&&(r=yg),e===1&&(r=Um),e===2&&(r=km),!r)throw new ue(oe.WEBGL_INTERNAL_ERROR,"invalid ylut_table value:"+e);this.tab_addr=new Uint8Array(r),e=[this.tab_addr],r=[256];let i=[1];for(let n=0;n<e.length;n++)this.gl.bindTexture(this.gl.TEXTURE_2D,this.lutTextures[n]),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,r[n],i[n],0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,e[n])}}class Qm{constructor(){this.canvas=this.gl=null,this.programs=[],this.inputTexture=this.commonProgram=null,this.outputTextures=[],this.fbos=[],this.originalFrameHeight=this.originalFrameWidth=0,this.enableBeauty=!1,this.denoiseLevel=5,this.lightLevel=.35,this.rednessLevel=.5,this.lighteningContrastLevel=1}setEnableBeauty(e){this.enableBeauty=!!e}init(e,r,i){if(!Ur.supportWebGL)throw new ue(oe.NOT_SUPPORTED,"your browser is not support webGL");if(this.gl=i.getContext("webgl"),!this.gl)throw new ue(oe.WEBGL_INTERNAL_ERROR,"can not get webgl context");if(this.initGL(e,r),!this.inputTexture)throw new ue(oe.WEBGL_INTERNAL_ERROR,"can not find input texture");this.canvas=i,this.programs.push(new Cg(this.gl)),this.programs.push(new Om(this.gl,e,r)),this.programs.push(new Nm(this.gl,e,r)),this.programs.push(new xm(this.gl,e,r)),this.programs.push(new Fm(this.gl,this.inputTexture,e,r)),this.commonProgram=this.programs[0].program,this.setDenoiseLevel(this.denoiseLevel),this.setLightLevel(this.lightLevel),this.setRednessLevel(this.rednessLevel),this.setContrastLevel(this.lighteningContrastLevel)}render(e){if(!this.gl||!this.commonProgram||!this.canvas)return void z.warning("video effect manager is not init!");var r=0;if(this.originalFrameHeight===e.videoWidth&&this.originalFrameWidth===e.videoHeight)r=2;else if(this.originalFrameHeight!==e.videoHeight||this.originalFrameWidth!==e.videoWidth){var i,n,c;if(z.debug(ne(i=ne(n=ne(c="beauty effect: resolution changed ".concat(this.originalFrameWidth,"x")).call(c,this.originalFrameHeight," -> ")).call(n,e.videoWidth,"x")).call(i,e.videoHeight)),e.videoHeight===0||e.videoWidth===0)return void z.debug("beauty effect: skip 0 resolution frame");this.canvas.width=e.videoWidth,this.canvas.height=e.videoHeight,e.setAttribute("width",e.videoWidth.toString()),e.setAttribute("height",e.videoHeight.toString()),this.release(),this.init(e.videoWidth,e.videoHeight,this.canvas)}for(this.gl.viewport(0,0,e.videoWidth,e.videoHeight),this.gl.bindTexture(this.gl.TEXTURE_2D,this.inputTexture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),e=this.enableBeauty?this.programs.length-1:0,i=0;i<=e;i++)n=this.programs[i].program,this.gl.useProgram(n),n=this.gl.getUniformLocation(n,"u_image"),this.programs[i].setUniforms(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbos[r+i%2]),this.gl.clearColor(0,0,0,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.drawArrays(this.gl.TRIANGLES,0,6),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,this.outputTextures[r+i%2]),this.gl.uniform1i(n,0);this.gl.useProgram(this.commonProgram),r=this.gl.getUniformLocation(this.commonProgram,"u_flipY"),this.gl.uniform1f(r,-1),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null),this.gl.clearColor(0,0,0,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.drawArrays(this.gl.TRIANGLES,0,6)}setDenoiseLevel(e){var r;Re(r=this.programs).call(r,i=>{i instanceof qo&&i.setParameters({denoiseLevel:e})}),this.denoiseLevel=e}setLightLevel(e){var r;Re(r=this.programs).call(r,i=>{i instanceof qo&&i.setParameters({lightLevel:e})}),this.lightLevel=e}setRednessLevel(e){var r;Re(r=this.programs).call(r,i=>{i instanceof qo&&i.setParameters({rednessLevel:e})}),this.rednessLevel=e}setContrastLevel(e){var r;Re(r=this.programs).call(r,i=>{i instanceof qo&&i.setParameters({lighteningContrastLevel:e})}),this.lighteningContrastLevel=e}setSize(e,r){var i;Re(i=this.programs).call(i,n=>{n instanceof qo&&n.setSize(e,r)})}release(){this.inputTexture=this.commonProgram=this.gl=null,this.programs=[],this.outputTextures=[],this.fbos=[]}initGL(e,r){if(!this.gl)throw new ue(oe.WEBGL_INTERNAL_ERROR,"can not find webgl context");this.inputTexture=this.gl.createTexture(),this.gl.bindTexture(this.gl.TEXTURE_2D,this.inputTexture),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);for(let i=0;4>i;i++){let n=this.gl.createTexture();if(!n)throw new ue(oe.WEBGL_INTERNAL_ERROR,"create texture failed");this.gl.bindTexture(this.gl.TEXTURE_2D,n),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),2>i?this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,e,r,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,null):this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,r,e,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,null);let c=this.gl.createFramebuffer();if(!c)throw new ue(oe.WEBGL_INTERNAL_ERROR,"create frame buffer failed");this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,c),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,n,0),this.outputTextures.push(n),this.fbos.push(c)}this.gl.viewport(0,0,e,r),this.originalFrameWidth=e,this.originalFrameHeight=r}}class Gm{constructor(){this.recordedFrameCount=this.targetFrameRate=0,this.recordingTime=2}startRecordBeautyEffectOutput(e,r=4){return Ee(this,null,function*(){if(this.recordID)throw new ue(oe.UNEXPECTED_ERROR,"another beauty effect recording is in progress");let i=mr(6,"");return this.recordID=i,this.targetFrameRate=e,this.recordedFrameCount=0,this.recordingTime=r,yield Pe(1e3*this.recordingTime),this.recordID!==i?(this.recordID=void 0,!0):(this.recordID=void 0,this.recordedFrameCount<this.targetFrameRate*this.recordingTime/2?(z.warning("detect beauty effect overload, current framerate",this.recordedFrameCount/2),!1):(z.debug("beauty effect current framerate",this.recordedFrameCount/2),!0))})}stopRecordBeautyEffectOutput(){this.recordedFrameCount=this.targetFrameRate=0,this.recordID=void 0}addFrame(){this.recordID&&(this.recordedFrameCount+=1)}}class Hm extends class{get output(){return this._output}setInput(e){return Ee(this,null,function*(){if(e!==this.input){if(e.kind!==this.kind)throw new ue(oe.UNEXPECTED_ERROR);this.input&&this.removeInput(),this.input=e,yield this._setInput(e)}})}removeInput(){this.input=void 0,this._removeInput()}updateOutput(e){return Ee(this,null,function*(){this.output!==e&&(this._output=e,this.onOutputChange&&(yield this.onOutputChange()))})}replaceOriginMediaStream(e,r){var i,n;let c=tr(i=e.getTracks()).call(i,h=>h.kind===this.kind);c&&e.removeTrack(c),r=tr(n=r.getTracks()).call(n,h=>h.kind===this.kind),this.output===void 0&&r&&e.addTrack(r),this.output&&(z.debug("replace ".concat(this.output.kind," track to origin media stream")),e.addTrack(this.output))}}{constructor(){super();this.kind="video",this.fps=15,this.overloadDetector=new Gm,this.enabled=!1,this.stopChromeBackgroundLoop=null,this.lastRenderTime=0,this.fps=30,this.manager=new Qm}setBeautyEffectOptions(e,r){return Ee(this,null,function*(){r.smoothnessLevel!==void 0&&$t(r.smoothnessLevel,"options.smoothnessLevel",0,1,!1),r.lighteningLevel!==void 0&&$t(r.lighteningLevel,"options.lighteningLevel",0,1,!1),r.rednessLevel!==void 0&&$t(r.rednessLevel,"options.rednessLevel",0,1,!1),r.lighteningContrastLevel!==void 0&&Yr(r.lighteningContrastLevel,"options.lighteningContrastLevel",[0,1,2]),r.smoothnessLevel!==void 0&&this.manager.setDenoiseLevel(Math.max(.1,10*r.smoothnessLevel)),r.lighteningLevel!==void 0&&this.manager.setLightLevel(Math.max(.1,r.lighteningLevel/2)),r.rednessLevel!==void 0&&this.manager.setRednessLevel(Math.max(.01,r.rednessLevel)),r.lighteningContrastLevel!==void 0&&this.manager.setContrastLevel(r.lighteningContrastLevel),this.enabled!==e&&(this.manager.setEnableBeauty(e),this.enabled=e,e?this.input&&(yield this.startEffect()):yield this.stopEffect())})}destroy(){this.onOutputChange=void 0,this.stopEffect(),this.enabled=!1}startEffect(){return Ee(this,null,function*(){let e=Ye();if(!this.input)return void z.warning("video track is null, fail to start video effect!");if(this.input&&this.output&&this.input!==this.output)return void z.warning("video effect is already enabled");let r=yield this.renderWithWebGL();yield this.updateOutput(r),z.info("start video effect, output:",this.output),this.overloadDetector.startRecordBeautyEffectOutput(this.fps).then(n=>{n||this.onOverload&&this.onOverload()});let i=()=>{this.enabled&&requestAnimationFrame(i);const n=ot(),c=1e3/this.fps,h=this.lastRenderTime?n-this.lastRenderTime:c;h<c||(this.lastRenderTime=n-(h-c),this.video&&this.video.paused&&this.video.play(),this.enabled&&this.video&&(this.manager.render(this.video),this.output&&this.output.requestFrame&&this.output.requestFrame(),this.overloadDetector.addFrame()))};requestAnimationFrame(i),e.name===rr.CHROME&&document.addEventListener("visibilitychange",()=>{document.hidden?this.stopChromeBackgroundLoop=Ys(()=>{this.enabled&&this.video&&this.manager.render(this.video),this.output&&this.output.requestFrame&&this.output.requestFrame(),this.overloadDetector.addFrame()},this.fps):this.stopChromeBackgroundLoop&&(this.stopChromeBackgroundLoop(),this.stopChromeBackgroundLoop=null)},!1)})}stopEffect(){return Ee(this,null,function*(){z.info("stop video effect"),this.overloadDetector.stopRecordBeautyEffectOutput(),this.manager.release(),this.canvas&&this.canvas.remove(),this.video&&this.video.remove(),this.video=this.canvas=void 0,yield this.updateOutput(this.input)})}_setInput(e){return Ee(this,null,function*(){this.enabled&&!this.video&&(yield this.startEffect())})}_removeInput(){this.stopEffect()}renderWithWebGL(){return Ee(this,null,function*(){var e;if(!this.input)throw new ue(oe.BEAUTY_PROCESSOR_INTERNAL_ERROR,"can not renderWithWebGL, no input");this.canvas&&(this.canvas.remove(),this.canvas=void 0),this.video&&(this.video.remove(),this.video=void 0),this.canvas=document.createElement("canvas"),this.video=document.createElement("video"),this.video.setAttribute("autoplay",""),this.video.setAttribute("muted",""),this.video.muted=!0,this.video.setAttribute("playsinline",""),this.video.setAttribute("style","display:none"),this.video.srcObject=new MediaStream([this.input]);var r=new it(c=>{const h=()=>{this.video&&this.video.removeEventListener("playing",h),c(void 0)};this.video&&this.video.addEventListener("playing",h)});this.video.play(),yield r,r=this.input.getSettings();let i=r.width||this.video.videoWidth,n=r.height||this.video.videoHeight;if(r.frameRate&&this.fps!==r.frameRate&&(this.fps=r.frameRate,z.debug("beauty video processor: set fps to",this.fps)),z.debug(ne(e="beauty video processor: width ".concat(i," height ")).call(e,n)),!i||!n)throw new ue(oe.BEAUTY_PROCESSOR_INTERNAL_ERROR,"can not get track resolution");return this.canvas.width=i,this.canvas.height=n,this.video.setAttribute("width",i.toString()),this.video.setAttribute("height",n.toString()),this.manager.init(i,n,this.canvas),this.canvas.captureStream(Ur.supportRequestFrame?0:this.fps).getVideoTracks()[0]})}}var ws=function(t,e,r,i){var n,c=arguments.length,h=3>c?e:i===null?i=gr(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(t,e,r,i);else for(var C=t.length-1;0<=C;C--)(n=t[C])&&(h=(3>c?n(h):3<c?n(e,r,h):n(e,r))||h);return 3<c&&h&&_r(e,r,h),h},Ar=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)};class li extends zl{constructor(e,r,i,n,c){super(e,c);this.trackMediaType="video",this._scalabiltyMode={numSpatialLayers:1,numTemporalLayers:1},this._enabled=!0,this.updateMediaStreamTrackResolution(),this._encoderConfig=r,this._scalabiltyMode=i,this._optimizationMode=n}get isPlaying(){return!(!this._player||this._player.videoElementStatus!==rn.PLAYING)}play(e,r={}){let i=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.LOCAL_VIDEO_TRACK_PLAY,options:[this.getTrackId(),typeof e=="string"?e:"HTMLElement",r]});if(!(e instanceof HTMLElement)){let c=document.getElementById(e.toString());var n;c?e=c:(z.warning(ne(n="[".concat(this.getTrackId(),'] can not find "#')).call(n,e,'" element, use document.body')),e=document.body)}z.debug("[".concat(this.getTrackId(),"] start video playback"),ht(r)),e=sa({},this._getDefaultPlayerConfig(),{},r,{trackId:this.getTrackId(),element:e}),this._player?this._player.updateConfig(e):(this._player=new Eg(e),this._player.updateVideoTrack(this._mediaStreamTrack)),this._player.play(),i.onSuccess()}stop(){let e=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.LOCAL_VIDEO_TRACK_STOP,options:[this.getTrackId()]});if(!this._player)return e.onSuccess();this._player.destroy(),this._player=void 0,z.debug("[".concat(this.getTrackId(),"] stop video playback")),e.onSuccess()}setEnabled(e,r){return Ee(this,null,function*(){if(!r){if(e===this._enabled)return;this.stateCheck("enabled",e)}z.info("[".concat(this.getTrackId(),"] start setEnabled"),e);let i=yield this._enabledMutex.lock();if(!e){this._originMediaStreamTrack.enabled=!1;try{yield Kr(this,xt.NEED_REMOVE_TRACK,this)}catch(n){throw z.error("[".concat(this.getTrackId(),"] setEnabled to false error"),n.toString()),i(),n}return r||(this._enabled=!1),z.info("[".concat(this.getTrackId(),"] setEnabled to false success")),i()}this._originMediaStreamTrack.enabled=!0;try{yield Kr(this,xt.NEED_ADD_TRACK,this)}catch(n){throw z.error("[".concat(this.getTrackId(),"] setEnabled to true error"),n.toString()),i(),n}z.info("[".concat(this.getTrackId(),"] setEnabled to true success")),r||(this._enabled=!0),i()})}setMuted(e){return Ee(this,null,function*(){var r;if(e!==this._muted){if(this.stateCheck("muted",e),this._muted=e,Ye().name===rr.FIREFOX)return z.debug("[".concat(this.getTrackId(),"] firefox set mute fallback to set enabled")),void(yield this.setEnabled(!e,!0));this._mediaStreamTrack.enabled=!e,z.debug(ne(r="[".concat(this.getTrackId(),"] start set muted: ")).call(r,e)),yield Kr(this,xt.SET_VIDEO_TRACK_MUTED,{track:this,muted:e})}})}getStats(){return ps(()=>{z.warning("[deprecated] LocalVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalVideoStats instead")},"localVideoTrackGetStatsWarning"),Qi(this,xt.GET_STATS)||sa({},Vl)}setBeautyEffect(i){return Ee(this,arguments,function*(e,r={}){let n=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.LOCAL_VIDEO_TRACK_BEAUTY,options:[this.getTrackId(),e,r]});if(e||this._videoBeautyProcessor){if(Ye().os===en.IOS||Ye().os===en.ANDROID)throw e=new ue(oe.INVALID_OPERATION,"can not enable beauty effect on mobile device"),n.onError(e),e;if(!this._enabled&&e)throw e=new ue(oe.TRACK_IS_DISABLED,"can not enable beauty effect when track is disabled"),n.onError(e),e;z.info("[".concat(this.getTrackId(),"] start setBeautyEffect"),e,ht(r));try{this._videoBeautyProcessor?yield this._videoBeautyProcessor.setBeautyEffectOptions(e,r):(this._videoBeautyProcessor=new Hm,this._videoBeautyProcessor.onOverload=()=>{Ni(()=>this.emit(xa.BEAUTY_EFFECT_OVERLOAD))},yield this._videoBeautyProcessor.setBeautyEffectOptions(e,r),yield this._registerTrackProcessor(this._videoBeautyProcessor))}catch(c){throw z.error("[".concat(this.getTrackId(),"] setBeautyEffect error"),c.toString()),n.onError(c),c}z.info("[".concat(this.getTrackId(),"] setBeautyEffect success")),n.onSuccess()}})}getCurrentFrameData(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}clone(e,r,i,n){let c=this._mediaStreamTrack.clone();return new li(c,e,r,i,n)}setBitrateLimit(e){return Ee(this,null,function*(){var r;if(z.debug(ne(r="[".concat(this.getTrackId(),"] set bitrate limit, ")).call(r,ht(e))),e){this._forceBitrateLimit=e,this._encoderConfig&&(this._encoderConfig.bitrateMax?this._encoderConfig.bitrateMax=this._encoderConfig.bitrateMax<e.max_bitrate?this._encoderConfig.bitrateMax:e.max_bitrate:this._encoderConfig.bitrateMax=e.max_bitrate,this._encoderConfig.bitrateMin,this._encoderConfig.bitrateMin=e.min_bitrate);try{yield Kr(this,xt.NEED_RESET_REMOTE_SDP)}catch(i){return i.throw()}}})}setOptimizationMode(e){return Ee(this,null,function*(){var r;if(e==="motion"||e==="detail"||e==="balanced"){try{this._optimizationMode=e,yield Kr(this,xt.SET_OPTIMIZATION_MODE,e)}catch(i){throw z.error("[".concat(this.getTrackId(),"] set optimization mode failed"),i.toString()),i}z.info(ne(r="[".concat(this.getTrackId(),"] set optimization mode success (")).call(r,e,")"))}else z.error(oe.INVALID_PARAMS,"optimization mode must be motion, detail or balanced")})}setScalabiltyMode(e){var r;if(e.numSpatialLayers===1&&e.numTemporalLayers!==1)return z.error(oe.INVALID_PARAMS,"scalability mode currently not supported, no SVC."),void(this._scalabiltyMode={numSpatialLayers:1,numTemporalLayers:1});this._scalabiltyMode=e,z.info(ne(r="[".concat(this.getTrackId(),"] set scalability mode success (")).call(r,e,")"))}updateMediaStreamTrackResolution(){Ps(this._originMediaStreamTrack).then(([e,r])=>{this._videoHeight=r,this._videoWidth=e}).catch(Xl)}_updatePlayerSource(){this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}_getDefaultPlayerConfig(){return{fit:"contain"}}renewMediaStreamTrack(){return Ee(this,null,function*(){})}}ws([Or(),Ar("design:type",Function),Ar("design:paramtypes",[Object,Object]),Ar("design:returntype",void 0)],li.prototype,"play",null),ws([Or(),Ar("design:type",Function),Ar("design:paramtypes",[Boolean,Boolean]),Ar("design:returntype",it)],li.prototype,"setEnabled",null),ws([Or(),On({report:Qe}),Ar("design:type",Function),Ar("design:paramtypes",[Boolean]),Ar("design:returntype",it)],li.prototype,"setMuted",null),ws([Or(),Ar("design:type",Function),Ar("design:paramtypes",[]),Ar("design:returntype",Object)],li.prototype,"getStats",null),ws([Or(),Ar("design:type",Function),Ar("design:paramtypes",[Boolean,Object]),Ar("design:returntype",it)],li.prototype,"setBeautyEffect",null),ws([Or(),Ar("design:type",Function),Ar("design:paramtypes",[]),Ar("design:returntype",ImageData)],li.prototype,"getCurrentFrameData",null),ws([Or(),Ar("design:type",Function),Ar("design:paramtypes",[Object]),Ar("design:returntype",it)],li.prototype,"setBitrateLimit",null),ws([Or(),Ar("design:type",Function),Ar("design:paramtypes",[String]),Ar("design:returntype",it)],li.prototype,"setOptimizationMode",null),ws([Or(),Ar("design:type",Function),Ar("design:paramtypes",[Object]),Ar("design:returntype",void 0)],li.prototype,"setScalabiltyMode",null),ws([Or(),Ar("design:type",Function),Ar("design:paramtypes",[]),Ar("design:returntype",void 0)],li.prototype,"updateMediaStreamTrackResolution",null);class sl extends li{constructor(e,r,i,n,c,h){super(e,r.encoderConfig?oi(r.encoderConfig):{},n,c,h);this._enabled=!0,this._deviceName="default",this.tryResumeVideoForIOS15WeChat=()=>Ee(this,null,function*(){hi()&&Ye().name===rr.WECHAT&&this._enabled&&!this._isClosed&&(z.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS 15 device on WeChat.")),yield this.setEnabled(!1),yield this.setEnabled(!0))}),this._config=r,this._constraints=i,this._deviceName=e.label,this._config.encoderConfig&&(this._encoderConfig=oi(this._config.encoderConfig)),fr.on(Yi.IOS_15_INTERRUPTION_END,this.tryResumeVideoForIOS15WeChat),fr.on(Yi.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15WeChat)}setDevice(e){return Ee(this,null,function*(){var r;let i=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.CAM_VIDEO_TRACK_SET_DEVICE,options:[this.getTrackId(),e]});if(z.info(ne(r="[".concat(this.getTrackId(),"] set device to ")).call(r,e)),this._enabled)try{let n=yield Xn.getDeviceById(e);r={},r.video=sa({},this._constraints),r.video.deviceId={exact:e},r.video.facingMode=void 0,this._originMediaStreamTrack.stop();let c=null;try{c=yield Fi(r,this.getTrackId())}catch(h){throw z.error("[".concat(this.getTrackId(),"] setDevice failed"),h.toString()),c=yield Fi({video:this._constraints},this.getTrackId()),yield this._updateOriginMediaStreamTrack(c.getVideoTracks()[0],!1),h}yield this._updateOriginMediaStreamTrack(c.getVideoTracks()[0],!1),this.updateMediaStreamTrackResolution(),this._deviceName=n.label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(n){throw i.onError(n),z.error("[".concat(this.getTrackId(),"] setDevice error"),n.toString()),n}else try{this._deviceName=(yield Xn.getDeviceById(e)).label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(n){throw i.onError(n),z.error("[".concat(this.getTrackId(),"] setDevice error"),n.toString()),n}z.info("[".concat(this.getTrackId(),"] setDevice success")),i.onSuccess()})}setEnabled(e,r){return Ee(this,null,function*(){if(!r){if(e===this._enabled)return;this.stateCheck("enabled",e)}z.info("[".concat(this.getTrackId(),"] start setEnabled"),e);let i=yield this._enabledMutex.lock();if(!e){this._originMediaStreamTrack.onended=null,this._originMediaStreamTrack.stop(),r||(this._enabled=!1);try{yield Kr(this,xt.NEED_REMOVE_TRACK,this)}catch(c){throw z.error("[".concat(this.getTrackId(),"] setEnabled to false error"),c.toString()),i(),c}return z.info("[".concat(this.getTrackId(),"] setEnabled to false success")),i()}e=sa({},this._constraints);let n=Xn.searchDeviceIdByName(this._deviceName);n&&!e.deviceId&&(e.deviceId={exact:n});try{let c=yield Fi({video:this._constraints},this.getTrackId());yield this._updateOriginMediaStreamTrack(c.getVideoTracks()[0],!1),yield Kr(this,xt.NEED_ADD_TRACK,this)}catch(c){throw z.error("[".concat(this.getTrackId(),"] setEnabled true error"),c.toString()),i(),c}this.updateMediaStreamTrackResolution(),z.info("[".concat(this.getTrackId(),"] setEnabled to true success")),r||(this._enabled=!0),i()})}setEncoderConfiguration(e,r){return Ee(this,null,function*(){if(r=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.CAM_VIDEO_TRACK_SET_ENCODER_CONFIG,options:[this.getTrackId(),e]}),!this._enabled)throw e=new ue(oe.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled"),r.onError(e),e;e=oi(e),this._forceBitrateLimit&&(e.bitrateMax=this._forceBitrateLimit.max_bitrate?this._forceBitrateLimit.max_bitrate:e.bitrateMax,e.bitrateMin=this._forceBitrateLimit.min_bitrate?this._forceBitrateLimit.min_bitrate:e.bitrateMin);let i=(n=this._config,JSON.parse(ht(n)));var n;i.encoderConfig=e,n=yc(i),(cr()||br()||pi())&&(n.deviceId=void 0),z.debug("[".concat(this.getTrackId(),"] setEncoderConfiguration applyConstraints"),ht(e),ht(n));try{yield this._originMediaStreamTrack.applyConstraints(n),this.updateMediaStreamTrackResolution()}catch(c){throw e=new ue(oe.UNEXPECTED_ERROR,c.toString()),z.error("[".concat(this.getTrackId(),"] applyConstraints error"),e.toString()),r.onError(e),e}this._config=i,this._constraints=n,this._encoderConfig=e;try{yield Kr(this,xt.NEED_RENEGOTIATE)}catch(c){return r.onError(c),c.throw()}r.onSuccess()})}_getDefaultPlayerConfig(){return{mirror:!0,fit:"cover"}}onTrackEnded(){if((br()||pi())&&this._enabled&&!this._isClosed&&fr.duringInterruption){let e=()=>Ee(this,null,function*(){fr.off(Yi.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(z.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS device.")),yield this.setEnabled(!1),yield this.setEnabled(!0))});fr.on(Yi.IOS_INTERRUPTION_END,e)}else z.debug("[".concat(this.getTrackId(),"] track ended")),this.emit(xa.TRACK_ENDED)}renewMediaStreamTrack(){return Ee(this,null,function*(){var e=sa({},this._constraints);let r=Xn.searchDeviceIdByName(this._deviceName);r&&!e.deviceId&&(e.deviceId={exact:r}),e=yield Fi({video:this._constraints},this.getTrackId()),yield this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!0),this.updateMediaStreamTrackResolution()})}close(){super.close(),fr.off(Yi.IOS_15_INTERRUPTION_END,this.tryResumeVideoForIOS15WeChat),fr.off(Yi.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15WeChat)}}ws([Or(),Ar("design:type",Function),Ar("design:paramtypes",[String]),Ar("design:returntype",it)],sl.prototype,"setDevice",null),ws([Or(),Ar("design:type",Function),Ar("design:paramtypes",[Boolean,Boolean]),Ar("design:returntype",it)],sl.prototype,"setEnabled",null),ws([Or(),Ar("design:type",Function),Ar("design:paramtypes",[Object,Boolean]),Ar("design:returntype",it)],sl.prototype,"setEncoderConfiguration",null);var Ig=!0;"findIndex"in[]&&Array(1).findIndex(function(){Ig=!1}),Qt({target:"Array",proto:!0,forced:Ig},{findIndex:function(t){return $e(this,t,1<arguments.length?arguments[1]:void 0)}});var Km=ai("Array").findIndex,Sg=Array.prototype,lu=function(t){var e=t.findIndex;return t===Sg||t instanceof Array&&e===Sg.findIndex?Km:e};let Tg=(t,e)=>{let r=null;if(e==="h264"?r=t.match(/a=rtpmap:(\d+) H264.*\r\n/)||t.match(/a=rtpmap:(\d+) H264.*\n/):e==="vp8"?r=t.match(/a=rtpmap:(\d+) VP8.*\r\n/)||t.match(/a=rtpmap:(\d+) VP8.*\n/):e==="vp9"?r=t.match(/a=rtpmap:(\d+) VP9.*\r\n/)||t.match(/a=rtpmap:(\d+) VP9.*\n/):e==="av1"&&(r=t.match(/a=rtpmap:(\d+) AV1.*\r\n/)||t.match(/a=rtpmap:(\d+) AV1.*\n/)),r&&r[1])return r[1]};class Rg extends mg{constructor(e,r,i,n){super(r,r.stringUid||r.uid);this.suspendTracks=[],this.type="pub",this._waitingSuccessResponse=this.detecting=!1,this.handleMuteVideoTrack=({muted:c},h,C)=>{this.setVideoTrackMuteState(c).then(h).catch(C)},this.handleMuteAudioTrack=({track:c,muted:h},C,x)=>{this.setAudioTrackMuteState(h,c).then(C).catch(x)},this.renegotiateWithGateway=()=>Ee(this,null,function*(){return z.debug("[pc-".concat(this.pc.ID,"] renegotiate start")),new it((c,h)=>Ee(this,null,function*(){this.connectionState="connecting";let C=F=>{F==="connected"&&(this.off(Nt.CONNECTION_STATE_CHANGE,C),c()),F==="disconnected"&&(this.off(Nt.CONNECTION_STATE_CHANGE,C),h(new ue(oe.OPERATION_ABORTED,"renegotiate abort")))};this.on(Nt.CONNECTION_STATE_CHANGE,C),sr()&&Xe.SIMULCAST&&this.videoTrack&&this.videoTrack._scalabiltyMode&&(yield this.addSimulcast4Firefox(this.videoTrack._scalabiltyMode));var x=yield this.pc.createOfferSDP();this.audioTrack&&this.audioTrack._encoderConfig&&(x=Tc(x,this.audioTrack._encoderConfig)),this.videoTrack&&this.videoTrack._scalabiltyMode&&(this.codec!=="vp9"&&this.codec!=="vp8"?(this.videoTrack._scalabiltyMode.numSpatialLayers=1,this.videoTrack._scalabiltyMode.numTemporalLayers=1):(1<this.videoTrack._scalabiltyMode.numSpatialLayers||1<this.videoTrack._scalabiltyMode.numTemporalLayers)&&(x=gl(x,this.codec,this.videoTrack._scalabiltyMode)),z.debug("renegoation spatial layers: ",this.videoTrack._scalabiltyMode.numSpatialLayers)),yield this.pc.setOfferSDP(x),this.audioTrack instanceof Tn&&this.pc.onOfferSettled({videoActive:this.videoTrack&&!this.videoTrack.muted,audioActive:this.audioTrack&&this.audioTrack.isActive});let Q=yield lr(this,Nt.NEED_RENEGOTIATE,x);this.videoTrack&&!sr()&&Xe.SIMULCAST&&this.videoTrack._scalabiltyMode&&this.setSimulcastVideoRtpEncodingParameters(this.videoTrack._scalabiltyMode),x=function(F,V){var Y,$,te;const ce=Si(Y=RegExp.prototype.test).call(Y,/^([a-z])=(.*)/);F=Gt($=F.split(/(\r\n|\r|\n)/)).call($,ce),V=Gt(te=V.split(/(\r\n|\r|\n)/)).call(te,ce);let Ae=null;const Me=new Lr;return Re(F).call(F,et=>{const vt=et.match(/m=(audio|video)/);if(vt&&vt[1])return void(Ae=vt[1]);Ae&&(et=et.match(/=(sendrecv|recvonly|sendonly|inactive)/))&&et[1]&&Me.set(Ae,et[1])}),Ae=null,yt(V).call(V,et=>{var vt=et.match(/m=(audio|video)/);if(vt&&vt[1])return Ae=vt[1],et;if(!Ae)return et;if((vt=et.match(/=(sendrecv|recvonly|sendonly|inactive)/))&&vt[1]){const kt=Me.get(Ae);if(kt&&kt!==vt[1])return et.replace(vt[1],kt)}return et}).join(`\r
121
- `)+`\r
122
- `}(x,this.updateAnswerSDP(Q.sdp)),yield this.pc.setAnswerSDP(x),z.debug("[pc-".concat(this.pc.ID,"] renegotiate success")),this.connectionState="connected"}))}),this.handleStreamRenegotiate=(c,h)=>{this.connectionState==="connected"?this.renegotiateWithGateway().then(c).catch(h):c()},this.handleReplaceTrack=(c,h,C)=>{if(this.audioTrack instanceof Tn&&c.kind==="audio")return h();this.pc.replaceTrack(c).then(x=>x?this.renegotiateWithGateway():it.resolve()).then(h).catch(C)},this.handleCloseAudioTrack=c=>{},this.handleCloseVideoTrack=()=>{this.lowStreamConnection&&this.lowStreamConnection.videoTrack&&this.lowStreamConnection.videoTrack.close()},this.handleGetSessionID=c=>{c(this.joinInfo.sid)},this.handleGetLocalVideoStats=c=>{c(this.statsCollector.getLocalVideoTrackStats(this.connectionId))},this.handleGetLocalAudioStats=c=>{c(this.statsCollector.getLocalAudioTrackStats(this.connectionId))},this.handleSetOptimizationMode=(c,h,C)=>{this.videoTrack&&this.setRtpSenderParametersByTrackConfig(this.videoTrack).then(h).catch(C)},this.isLowStreamConnection=!!n,this.codec=i,this.statsCollector=e,this.statsCollector.addLocalConnection(this)}getAllTracks(){let e=[];return this.videoTrack&&e.push(this.videoTrack),this.audioTrack&&this.audioTrack instanceof Tn?e=ne(e).call(e,this.audioTrack.trackList):this.audioTrack&&e.push(this.audioTrack),e.push(...this.suspendTracks),e}addTracks(e){return Ee(this,null,function*(){let r=Ur;if(this.connectionState==="connecting")try{return yield this.createWaitConnectionConnectedPromise(),yield this.addTracks(e)}catch(h){throw new ue(oe.OPERATION_ABORTED,"publish abort")}var i=!1;let n=this.getAllTracks();e=an(e=Gt(e).call(e,h=>Wt(n).call(n,h)===-1));for(let h=0;h<e.length;h+=1){var c=e[h];if(!(c instanceof zl))return new ue(oe.INVALID_LOCAL_TRACK).throw();if(c instanceof li&&this.disabledVideoTrack){if(this.disabledVideoTrack!==c)return new ue(oe.EXIST_DISABLED_VIDEO_TRACK).throw();this.disabledVideoTrack=void 0}if(c instanceof li&&this.videoTrack)return new ue(oe.CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS).throw();if(c instanceof Ji){if(this.audioTrack&&this.audioTrack._bypassWebAudio)throw z.error("One of the audio track was created with config bypassWebAudio set to true, there is no way to publish multiple audio tracks."),new ue(oe.CAN_NOT_PUBLISH_MULTIPLE_AUDIO_TRACKS);if(this.audioTrack instanceof Tn)this.audioTrack.trackList.length===0&&(yield this.pc.setAudioRtpEncodingParameters({active:!0})),this.audioTrack.addAudioTrack(c);else if(r.webAudioMediaStreamDest)if(c._bypassWebAudio){if(this.audioTrack)throw z.error("Can not publish another audio track with bypassWebAudio set to true."),new ue(oe.CAN_NOT_PUBLISH_MULTIPLE_AUDIO_TRACKS);z.debug("[".concat(this.connectionId,"] audio track doesn't not pass through WebAudio, use original audio track to publish")),i=yield this.addTrackWithPC(c)}else i=new Tn,c.muted?this.suspendTracks.push(c):i.addAudioTrack(c),i=yield this.addTrackWithPC(i);else z.debug("[".concat(this.connectionId,"] your browser does not support mixing track, use original audio track to publish")),i=yield this.addTrackWithPC(c)}else c instanceof li&&this.isLowStreamConnection?(i=vl({},{width:160,height:120,framerate:15,bitrate:50},{},this.lowStreamParameter),r.supportDualStreamEncoding?(z.debug("[".concat(this.connectionId,"] creating low stream using rtp encoding.")),this.lowStreamEncoding=Ha(i,c),c=c.clone({bitrateMax:i.bitrate,bitrateMin:i.bitrate})):(z.debug("[".concat(this.connectionId,"] creating low stream using canvas.")),c=gu(c,i),c=new li(c,{bitrateMax:i.bitrate,bitrateMin:i.bitrate})),c._hints.push(to.LOW_STREAM),i=yield this.addTrackWithPC(c),this.bindTrackEvents(c)):(this.detecting=!0,Is(()=>{this.detecting=!1},8e3),i=yield this.addTrackWithPC(c))}yield this.updateControlMessage(),i&&(yield this.renegotiateWithGateway()),Re(e).call(e,h=>this.bindTrackEvents(h))})}removeTracks(e,r){return Ee(this,null,function*(){let i=this.getAllTracks();e=an(e=Gt(e).call(e,h=>Wt(i).call(i,h)!==-1||h===this.disabledVideoTrack));let n=[];for(let h=0;h<e.length;h+=1){let C=e[h];if(this.unbindTrackEvents(C),this.audioTrack instanceof Tn&&C instanceof Ji)this.audioTrack.removeAudioTrack(C),vi(this.suspendTracks,C),this.audioTrack.trackList.length===0&&(n.push(this.audioTrack),this.audioTrack=void 0);else if(C instanceof Ji)n.push(C),this.audioTrack=void 0;else if(C instanceof li){if(r){if(this.disabledVideoTrack===C)return void(this.disabledVideoTrack=void 0)}else this.disabledVideoTrack=this.videoTrack;n.push(C),this.isLowStreamConnection&&C.close(),this.videoTrack=void 0}}if(this.videoTrack||this.audioTrack){if(n.length!==0){if(this.connectionState==="connecting")try{yield this.createWaitConnectionConnectedPromise()}catch(h){return}for(let h of n){var c;z.debug(ne(c="[".concat(this.connectionId,"] remove ")).call(c,h.trackMediaType," from pc")),yield this.pc.removeTrack(h._mediaStreamTrack),e=Ye(),e.name==="Safari"&&e.version==="11"&&(yield h.renewMediaStreamTrack())}yield this.renegotiateWithGateway()}}else yield this.closeP2PConnection()})}updateControlMessage(){return Ee(this,null,function*(){this.audioTrack instanceof Tn&&this.connectionState==="connected"&&(this.audioTrack&&(yield lr(this,Nt.NEED_CONTROL,{type:"audio",muted:!this.audioTrack.isActive})),this.videoTrack&&(yield lr(this,Nt.NEED_CONTROL,{type:"video",muted:this.videoTrack.muted})))})}setSimulcastVideoRtpEncodingParameters(e){return Ee(this,null,function*(){let r=this.pc.getSender("video");if(!r)throw new ue(oe.LOW_STREAM_ENCODING_ERROR,"Low stream has no video sender.");let i=r.getParameters();if(!i.encodings||!i.encodings[0])throw new ue(oe.LOW_STREAM_ENCODING_ERROR,"Low stream RtpEncodingParameters is empty.");this.videoTrack&&this.videoTrack._encoderConfig&&this.videoTrack._encoderConfig.bitrateMax&&200<this.videoTrack._encoderConfig.bitrateMax&&1<e.numSpatialLayers&&(i.encodings=[{active:!0,adaptivePtime:!1,networkPriority:"high",priority:"high",maxBitrate:1e3*(this.videoTrack._encoderConfig.bitrateMax-50)},{active:!0,adaptivePtime:!1,networkPriority:"low",priority:"low",maxBitrate:5e4,scaleResolutionDownBy:4}]),yield r.setParameters(i)})}startP2PConnection(){return new it((e,r)=>Ee(this,null,function*(){if(!this.audioTrack&&!this.videoTrack)return r(new ue(oe.UNEXPECTED_ERROR,"no track to publish"));let i=c=>{if(c==="connected"&&(this.off(Nt.CONNECTION_STATE_CHANGE,i),e()),c==="disconnected"){if(this.off(Nt.CONNECTION_STATE_CHANGE,i),this.disconnectedReason)return r(this.disconnectedReason);r(new ue(oe.OPERATION_ABORTED,"publish abort"))}};this.on(Nt.CONNECTION_STATE_CHANGE,i),this.disconnectedReason=void 0,this.connectionState="connecting",this._waitingSuccessResponse=!0,this.startTime=ot();try{var n;!this.pc.audioTrack&&this.audioTrack&&(yield this.pc.addTrack(this.audioTrack._mediaStreamTrack)),!this.pc.videoTrack&&this.videoTrack&&(yield this.pc.addTrack(this.videoTrack._mediaStreamTrack)),sr()&&Xe.SIMULCAST&&this.videoTrack&&this.videoTrack._scalabiltyMode&&(yield this.addSimulcast4Firefox(this.videoTrack._scalabiltyMode));let c=yield this.pc.createOfferSDP();Xe.REMOVE_NEW_CODECS&&(c=this.codec==="vp9"?yi(c,["av1"]):this.codec==="av1"?yi(c,["vp9"]):yi(c,["vp9","av1"]));let h=Sc(c);this.videoTrack&&!Ir(n=h.video).call(n,this.codec.toUpperCase())&&z.warning("current codec is not supported, support list: ".concat(h.video.join(","))),this.audioTrack&&this.audioTrack._encoderConfig&&(c=Tc(c,this.audioTrack._encoderConfig)),this.videoTrack&&!sr()&&this.videoTrack._scalabiltyMode&&(this.codec!=="vp9"&&this.codec!=="vp8"?(this.videoTrack._scalabiltyMode.numSpatialLayers=1,this.videoTrack._scalabiltyMode.numTemporalLayers=1):(1<this.videoTrack._scalabiltyMode.numSpatialLayers||1<this.videoTrack._scalabiltyMode.numTemporalLayers)&&(c=gl(c,this.codec,this.videoTrack._scalabiltyMode)),z.debug("spatial layers: ",this.videoTrack._scalabiltyMode.numSpatialLayers)),yield this.pc.setOfferSDP(c),this.audioTrack instanceof Tn&&this.pc.onOfferSettled({videoActive:this.videoTrack&&!this.videoTrack.muted,audioActive:this.audioTrack&&this.audioTrack.isActive}),this.videoTrack&&this.setRtpSenderParametersByTrackConfig(this.videoTrack),z.debug("[".concat(this.connectionId,"] create and set offer success")),n={messageType:"OFFER",sdp:c,offererSessionId:104,retry:!0},Ur.supportDualStreamEncoding&&this.isLowStreamConnection&&this.lowStreamEncoding&&this.videoTrack&&(yield this.setLowStreamEncoding(this.lowStreamEncoding,this.videoTrack)),this.videoTrack&&!sr()&&Xe.SIMULCAST&&this.videoTrack._scalabiltyMode&&this.setSimulcastVideoRtpEncodingParameters(this.videoTrack._scalabiltyMode);let C=yield lr(this,Nt.NEED_ANSWER,n),x=this.updateAnswerSDP(C.sdp);yield this.pc.setAnswerSDP(x),z.debug("[".concat(this.connectionId,"] set answer success")),yield this.icePromise,this.connectionState="connected",this.startUploadStats()}catch(c){this.off(Nt.CONNECTION_STATE_CHANGE,i),this.connectionState="disconnected",this.reportPublishEvent(!1,c.code),z.error("[".concat(this.connectionId,"] connection error"),c.toString()),r(c)}}))}reportPublishEvent(e,r,i){var n;this._waitingSuccessResponse=!1,Qe.publish(this.joinInfo.sid,{lts:this.startTime,succ:e,ec:r,audioName:this.audioTrack&&(this.audioTrack instanceof Tn?this.audioTrack.getSubTrackLabels().join(","):this.audioTrack.getTrackLabel()),videoName:this.videoTrack&&this.videoTrack.getTrackLabel(),screenshare:!(!this.videoTrack||Wt(n=this.videoTrack._hints).call(n,to.SCREEN_TRACK)===-1),audio:!!this.audioTrack,video:!!this.videoTrack,p2pid:this.pc.ID,publishRequestid:this.ID,extend:i})}closeP2PConnection(e){return Ee(this,null,function*(){let r=this.getAllTracks();var i;Re(r).call(r,n=>{this.unbindTrackEvents(n)}),this.isLowStreamConnection&&this.videoTrack&&this.videoTrack.close(),this.videoTrack=void 0,this.audioTrack instanceof Tn&&(Re(i=this.audioTrack.trackList).call(i,n=>{this.audioTrack.removeAudioTrack(n)}),this.audioTrack.close()),this.audioTrack=void 0,this.stopUploadStats(),this.statsCollector.removeConnection(this.connectionId),yield this.closePC(e),this.connectionState="disconnected",this.removeAllListeners()})}getNetworkQuality(){var e,r=this.pc.getStats();if(!r.videoSend[0]&&!r.audioSend[0])return 1;var i=Qi(this,Nt.NEED_SIGNAL_RTT),n=r.videoSend[0]?r.videoSend[0].rttMs:void 0;let c=r.audioSend[0]?r.audioSend[0].rttMs:void 0;return n=n&&c?(n+c)/2:n||c,i=70*r.sendPacketLossRate/50+.3*((n&&i?(n+i)/2:n||i)||0)/1500,i=.17>i?1:.36>i?2:.59>i?3:.1>i?4:5,this.videoTrack&&this.videoTrack._encoderConfig&&Wt(e=this.videoTrack._hints).call(e,to.SCREEN_TRACK)===-1&&(e=this.videoTrack._encoderConfig.bitrateMax,r=r.bitrate.actualEncoded,e&&r)?(r=(1e3*e-r)/(1e3*e),qp[.15>r?0:.3>r?1:.45>r?2:.6>r?3:4][i]):i}handleUpdateBitrateLimit(e){this.videoTrack&&this.videoTrack.setBitrateLimit(e)}setAudioTrackMuteState(e,r){return Ee(this,null,function*(){if(!(this.audioTrack instanceof Tn))return void z.debug("[".concat(this.connectionId,"] set audio mute in unsupported environment"));let i=this.audioTrack;try{if(e){var n;i.removeAudioTrack(r),i.trackList.length===0&&(z.debug(ne(n="[".concat(this.connectionId,"] set audio encoding active, id: ")).call(n,r.getTrackId(),", state: ",!1)),yield this.pc.setAudioRtpEncodingParameters({active:!1})),this.suspendTracks.push(r)}else yield this.pc.setAudioRtpEncodingParameters({active:!0}),i.addAudioTrack(r),vi(this.suspendTracks,r)}catch(h){var c;z.warning(ne(c="[".concat(this.connectionId,"] set audio muted error ")).call(c,h,", fallback to set enabled"))}yield lr(this,Nt.NEED_CONTROL,{type:"audio",muted:!(!this.audioTrack||this.audioTrack.isActive)})})}setVideoTrackMuteState(e){return Ee(this,null,function*(){let r=!e,i=!1;if(Ye().name===rr.FIREFOX)i=!0;else try{var n,c;z.debug(ne(n=ne(c="[".concat(this.connectionId,"] set video encoding active, id: ")).call(c,this.videoTrack&&this.videoTrack.getTrackId(),", state: ")).call(n,r)),yield this.pc.setVideoRtpEncodingParameters({active:r})}catch(Q){var h;z.warning(ne(h="[".concat(this.connectionId,"] set video encoding active error ")).call(h,Q,", fallback to set enabled")),i=!0}var C,x;i&&this.videoTrack&&(z.debug(ne(C=ne(x="[".concat(this.connectionId,"] set video encoding active fallback to enabled on firefox, type: ")).call(x,this.videoTrack&&this.videoTrack.getTrackId(),", state: ")).call(C,r)),this.videoTrack.getMediaStreamTrack().enabled=r),this.lowStreamConnection&&this.lowStreamConnection.setVideoTrackMuteState(e),!this.isLowStreamConnection&&(yield lr(this,Nt.NEED_CONTROL,{type:"video",muted:e}))})}uploadStats(e,r){let i=this.audioTrack?function(C,x){const Q=C.audioSend[0];return Q?(C={id:mr(10,""),timestamp:new Date(C.timestamp).toISOString(),mediaType:"audio",type:"ssrc",ssrc:Q.ssrc.toString()},C.A_astd=x._originMediaStreamTrack.enabled&&x._mediaStreamTrack.enabled?"0":"1",Q.inputLevel?C.A_ail=Math.round(100*Q.inputLevel).toString():C.A_ail=Math.round(100*x._source.getAccurateVolumeLevel()).toString(),C.A_apil=Math.round(100*x._source.getAccurateVolumeLevel()).toString(),C):null}(e,this.audioTrack):void 0,n=this.videoTrack?function(C,x){const Q=C.videoSend[0];if(!Q)return null;switch(C={id:mr(10,""),timestamp:new Date(C.timestamp).toISOString(),mediaType:"video",type:"ssrc",ssrc:Q.ssrc.toString()},C.A_vstd=x._originMediaStreamTrack&&!x._originMediaStreamTrack.enabled||!x._mediaStreamTrack.enabled?"1":"0",Q.sentFrame&&(C.A_fhs=Q.sentFrame.height.toString(),C.A_frs=Q.sentFrame.frameRate.toString(),C.A_fws=Q.sentFrame.width.toString()),Q.adaptionChangeReason){case"none":C.A_ac="0";break;case"cpu":C.A_ac="1";break;case"bandwidth":C.A_ac="2";break;case"other":C.A_ac="3"}return C.A_nr=Q.nacksCount.toString(),Q.avgEncodeMs&&(C.A_aem=Q.avgEncodeMs.toFixed(0).toString()),C}(e,this.videoTrack):void 0,c=ia(e,r),h=function(C){const x={id:"bweforvideo",timestamp:new Date(C.timestamp).toISOString(),type:"VideoBwe"};return C.bitrate.retransmit&&(x.A_rb=C.bitrate.retransmit.toString()),C.bitrate.targetEncoded&&(x.A_teb=C.bitrate.targetEncoded.toString()),x.A_aeb=C.bitrate.actualEncoded.toString(),x.A_tb=C.bitrate.transmit.toString(),C.sendBandwidth!==void 0&&(x.A_asb=C.sendBandwidth.toString()),x}(e);i&&Ni(()=>this.emit(Nt.NEED_UPLOAD,Gs.PUBLISH_STATS,i)),n&&Ni(()=>this.emit(Nt.NEED_UPLOAD,Gs.PUBLISH_STATS,vl({},n,{},c))),h&&Ni(()=>this.emit(Nt.NEED_UPLOAD,Gs.PUBLISH_STATS,h))}uploadSlowStats(e){let r=ia(e);r&&Ni(()=>this.emit(Nt.NEED_UPLOAD,Gs.PUBLISH_STATS,r))}uploadRelatedStats(e){let r=function(i){return(i=i.videoSend[0])?{mediaType:"video",isVideoMute:!1,frameRateInput:i.inputFrame&&i.inputFrame.frameRate.toString(),frameRateSent:i.sentFrame&&i.sentFrame.frameRate.toString(),googRtt:i.rttMs.toString()}:null}(e);r&&(r.isVideoMute=!(!this.videoTrack||!this.videoTrack.muted),Ni(()=>{this.emit(Nt.NEED_UPLOAD,Gs.PUBLISH_RELATED_STATS,r)}))}addSimulcast4Firefox(e){return Ee(this,null,function*(){if(sr()&&this.videoTrack&&this.videoTrack._encoderConfig&&this.videoTrack._encoderConfig.bitrateMax&&200<this.videoTrack._encoderConfig.bitrateMax&&1<e.numSpatialLayers&&this.codec==="vp8"&&(e=this.pc.getSender("video"))){let r=e.getParameters();z.debug("getParameters : ",r),r||z.error("[".concat(this.connectionId,"] get sender parameter error.")),r.encodings=[{rid:"m",active:!0,maxBitrate:5e4,scaleResolutionDownBy:4},{rid:"h",active:!0,maxBitrate:1e3*(this.videoTrack._encoderConfig.bitrateMax-50)}],yield e.setParameters(r),z.debug("setParameters : ",r)}})}bindTrackEvents(e){var r;e.addListener(xt.NEED_RESET_REMOTE_SDP,Si(r=this.handleResetRemoteSdp).call(r,this)),this.isLowStreamConnection||(e instanceof Ji?(e.addListener(xt.GET_STATS,this.handleGetLocalAudioStats),e.addListener(xt.NEED_CLOSE,this.handleCloseAudioTrack),e.addListener(xt.SET_AUDIO_TRACK_MUTED,this.handleMuteAudioTrack)):e instanceof li&&(e.addListener(xt.GET_STATS,this.handleGetLocalVideoStats),e.addListener(xt.NEED_CLOSE,this.handleCloseVideoTrack),e.addListener(xt.SET_OPTIMIZATION_MODE,this.handleSetOptimizationMode),e.addListener(xt.SET_VIDEO_TRACK_MUTED,this.handleMuteVideoTrack)),e.addListener(xt.NEED_RENEGOTIATE,this.handleStreamRenegotiate),e.addListener(xt.NEED_REPLACE_TRACK,this.handleReplaceTrack),e.addListener(xt.NEED_SESSION_ID,this.handleGetSessionID))}unbindTrackEvents(e){this.isLowStreamConnection||(e instanceof Ji?(e.off(xt.GET_STATS,this.handleGetLocalAudioStats),e.off(xt.NEED_CLOSE,this.handleCloseAudioTrack),e.off(xt.SET_AUDIO_TRACK_MUTED,this.handleMuteAudioTrack)):e instanceof li&&(e.off(xt.GET_STATS,this.handleGetLocalVideoStats),e.off(xt.NEED_CLOSE,this.handleCloseVideoTrack),e.off(xt.SET_OPTIMIZATION_MODE,this.handleSetOptimizationMode),e.off(xt.SET_VIDEO_TRACK_MUTED,this.handleMuteVideoTrack)),e.off(xt.NEED_RENEGOTIATE,this.handleStreamRenegotiate),e.off(xt.NEED_REPLACE_TRACK,this.handleReplaceTrack),e.off(xt.NEED_SESSION_ID,this.handleGetSessionID))}addTrackWithPC(e){return Ee(this,null,function*(){if(this.connectionState==="connecting")return new ue(oe.INVALID_OPERATION,"last publish operation has not finished").throw();let r=this.videoTrack,i=!1;return this.audioTrack&&e instanceof Tn?(this.audioTrack=e,z.debug("[".concat(this.connectionId,"] replace pc audio track")),i=yield this.pc.replaceTrack(e._mediaStreamTrack)):this.videoTrack&&e instanceof li?(this.videoTrack=e,z.debug("[".concat(this.connectionId,"] replace pc video track")),i=yield this.pc.replaceTrack(e._mediaStreamTrack)):e instanceof Ji?(this.audioTrack=e,z.debug("[".concat(this.connectionId,"] add audio track to pc")),yield this.pc.addTrack(e._mediaStreamTrack),i=!0):e instanceof li&&(this.videoTrack=e,z.debug("[".concat(this.connectionId,"] add video track to pc")),yield this.pc.addTrack(e._mediaStreamTrack),i=!0),this.connectionState==="connected"&&this.videoTrack!==r&&this.videoTrack&&(yield this.setRtpSenderParametersByTrackConfig(this.videoTrack)),this.connectionState!=="disconnected"&&i})}handleResetRemoteSdp(){return new it((e,r)=>{var i;z.info("[pc-".concat(this.pc.ID,"] start reset remote sdp"));let n=this.pc.getOfferSDP();var c=this.pc.getAnswerSDP();if(!c||!n)return e();c=c.sdp;let h;this.videoTrack&&this.videoTrack._encoderConfig&&Wt(i=this.videoTrack._hints).call(i,to.SCREEN_TRACK)===-1&&(h=function(C,x){var Q,F;let V=x.bitrateMin;x=x.bitrateMax;let Y=Si(Q=RegExp.prototype.test).call(Q,/^([a-z])=(.*)/);if(C=Gt(F=C.split(/(\r\n|\r|\n)/)).call(F,Y),x){let te="AS";Ye().name===rr.FIREFOX&&(x=1e3*(x>>>0),te="TIAS"),F=lu(C).call(C,ce=>Ir(ce).call(ce,te));var $;0<F&&(C[F]=ne($="b=".concat(te,":")).call($,x))}return V&&($=lu(C).call(C,te=>Ir(te).call(te,"x-google-min-bitrate")),0<$&&(C[$]=C[$].replace(/x-google-min-bitrate=(.*)/,"x-google-min-bitrate=".concat(V)))),C.join(`\r
123
- `)+`\r
124
- `}(c,this.videoTrack._encoderConfig)),c!==h?this.pc.setOfferSDP(n.sdp).then(()=>{if(h)return this.pc.setAnswerSDP(h)}).then(e).catch(C=>{var x;z.error(ne(x="[pc-".concat(this.pc.ID,"] reset remote sdp error, ")).call(x,C)),r(C)}):z.debug("[pc-".concat(this.pc.ID,"] remote sdp have no not changed"))})}setRtpSenderParametersByTrackConfig(e){return Ee(this,null,function*(){if(!Ur.supportSetRtpSenderParameters)return void z.debug("[".concat(this.connectionId,"] do not support set pc rtp sender, skip"));let r={},i="balanced";e._optimizationMode==="motion"?i="maintain-framerate":e._optimizationMode==="detail"&&(i="maintain-resolution"),z.debug("[".concat(this.connectionId,"] set pc rtp sender"),r,i),yield this.pc.setRtpSenderParameters(r,i)})}updateAnswerSDP(e){var r,i;return e=e.replace(/a=x-google-flag:conference\r\n/g,""),this.videoTrack&&Wt(r=this.videoTrack._hints).call(r,to.SCREEN_TRACK),this.videoTrack&&this.videoTrack._encoderConfig&&Wt(i=this.videoTrack._hints).call(i,to.SCREEN_TRACK)===-1&&(e=function(n,c,h){let C=Ur;var x=h.bitrateMin;h=h.bitrateMax;let Q=n.match(/m=video.*\r\n/)||n.match(/m=video.*\n/);if(Q&&0<Q.length&&C.supportMinBitrate&&x&&(c=Tg(n,c)))if(Xe.SIMULCAST){var F,V;x=h?.7*h:300,n=n.replace(Q[0],ne(F=ne(V="".concat(Q[0],"a=fmtp:")).call(V,c," x-google-start-bitrate=")).call(F,x,`\r
125
- `))}else{var Y,$;n=n.replace(Q[0],ne(Y=ne($="".concat(Q[0],"a=fmtp:")).call($,c," x-google-min-bitrate=")).call(Y,x,`\r
126
- `))}if(Q&&0<Q.length&&h){var te,ce;F="AS",Ye().name===rr.FIREFOX&&(h=1e3*(h>>>0),F="TIAS"),n=n.replace(Q[0],ne(te=ne(ce="".concat(Q[0],"b=")).call(ce,F,":")).call(te,h,`\r
127
- `))}return n}(e,this.codec,this.videoTrack._encoderConfig)),this.audioTrack&&this.audioTrack._encoderConfig&&(e=Tc(e,this.audioTrack._encoderConfig)),e=function(n){let c=Ye();return c.name!==rr.SAFARI&&c.os!==en.IOS?n:n.replace(/a=.*video-orientation\r\n/g,"")}(e)}createPC(){this.pc=new Ag({turnServer:this.joinInfo.turnServer}),this.updateICEPromise()}closePC(e){return Ee(this,null,function*(){return this.pc.onICEConnectionStateChange=void 0,this.pc.close(),!e&&(yield lr(this,Nt.NEED_UNPUB))})}onPCDisconnected(e){this.reportPublishEvent(!1,e.code)}setLowStreamEncoding(e,r){return Ee(this,null,function*(){try{let i=yield this.pc.setVideoRtpEncodingParameters(e),n=r.getMediaStreamTrack();if(e.scaleResolutionDownBy&&i.encodings[0].scaleResolutionDownBy!==e.scaleResolutionDownBy){let c=r._videoHeight||n.getSettings().height,h=r._videoWidth||n.getSettings().width;c&&h&&(yield n.applyConstraints({height:c/e.scaleResolutionDownBy,width:h/e.scaleResolutionDownBy}))}e.maxFramerate&&i.encodings[0].maxFramerate!==e.maxFramerate&&(yield n.applyConstraints({frameRate:e.maxFramerate}))}catch(i){throw i instanceof ue?i:new ue(oe.LOW_STREAM_ENCODING_ERROR,i.message)}})}}class wg extends $f{constructor(e,r,i,n){var c,h;super(e,ne(c=ne(h="track-".concat(e.kind,"-")).call(h,r,"-")).call(c,n));this._isDestroyed=!1,this._userId=r,this._uintId=i}getUserId(){return this._userId}_updateOriginMediaStreamTrack(e){this._mediaStreamTrack=this._originMediaStreamTrack=e,this._updatePlayerSource()}_destroy(){this._isDestroyed=!0,z.info("[".concat(this.getTrackId(),"] is destroyed")),this.stop(),super.close()}}class ol extends wg{constructor(e,r,i,n){super(e,r,i,n);this.trackMediaType="video",this.updateMediaStreamTrackResolution()}get isPlaying(){return!(!this._player||this._player.videoElementStatus!==rn.PLAYING)}getStats(){return ps(()=>{z.warning("[deprecated] RemoteVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteVideoStats instead")},"remoteVideoTrackGetStatsWarning"),Qi(this,xt.GET_STATS)||Wa({},ld)}play(e,r={}){let i=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.REMOTE_VIDEO_TRACK_PLAY,options:[this.getTrackId(),typeof e=="string"?e:"HTMLElement",r]});if(typeof e=="string"){let c=document.getElementById(e);var n;c?e=c:(z.warning(ne(n="[".concat(this.getTrackId(),'] can not find "#')).call(n,e,'" element, use document.body')),e=document.body)}z.debug("[".concat(this.getTrackId(),"] start video playback"),ht(r)),e=Wa({fit:"cover"},r,{trackId:this.getTrackId(),element:e}),this._player?this._player.updateConfig(e):(this._player=new Eg(e),this._player.updateVideoTrack(this._mediaStreamTrack),this._player.onFirstVideoFrameDecoded=()=>{this.emit(Yc.FIRST_FRAME_DECODED)}),this._player.play(),i.onSuccess()}stop(){let e=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.REMOTE_VIDEO_TRACK_STOP,options:[this.getTrackId()]});if(!this._player)return e.onSuccess();this._player.destroy(),this._player=void 0,z.debug("[".concat(this.getTrackId(),"] stop video playback")),e.onSuccess()}getCurrentFrameData(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}updateMediaStreamTrackResolution(){Ps(this._originMediaStreamTrack).then(([e,r])=>{this._videoHeight=r,this._videoWidth=e}).catch(Xl)}_updatePlayerSource(){z.debug("[".concat(this.getTrackId(),"] update player source track")),this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}}class al extends wg{constructor(e,r,i,n){super(e,r,i,n);this.trackMediaType="audio",this._useAudioElement=!0,this._volume=100,this._source=new rA(e,!0),this._source.once(Hs.RECEIVE_TRACK_BUFFER,()=>{this.emit(Yc.FIRST_FRAME_DECODED)})}get isPlaying(){return this._useAudioElement?Ts.isPlaying(this.getTrackId()):this._source.isPlayed}setAudioFrameCallback(e,r=4096){if(!e)return this._source.removeAllListeners(Hs.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(r),this._source.removeAllListeners(Hs.ON_AUDIO_BUFFER),this._source.on(Hs.ON_AUDIO_BUFFER,i=>e(i))}setVolume(e){let r=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.REMOTE_AUDIO_SET_VOLUME,options:[this.getTrackId(),e]},300);this._volume=e,this._useAudioElement?Ts.setVolume(this.getTrackId(),e):this._source.setVolume(e/100),r.onSuccess()}setPlaybackDevice(e){return Ee(this,null,function*(){let r=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.REMOTE_AUDIO_SET_OUTPUT_DEVICE,options:[this.getTrackId(),e]});if(!this._useAudioElement)throw new ue(oe.NOT_SUPPORTED,"your browser does not support setting the audio output device");try{yield Ts.setSinkID(this.getTrackId(),e)}catch(i){throw r.onError(i),i}r.onSuccess()})}getVolumeLevel(){return this._source.getAccurateVolumeLevel()}getStats(){return ps(()=>{z.warning("[deprecated] RemoteAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteAudioStats instead")},"remoteAudioTrackGetStatsWarning"),Qi(this,xt.GET_STATS)||Wa({},cd)}play(){let e=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.REMOTE_AUDIO_TRACK_PLAY,options:[this.getTrackId()]});z.debug("[".concat(this.getTrackId(),"] start audio playback")),this._useAudioElement?(z.debug("[".concat(this.getTrackId(),"] use audio element to play")),Ts.play(this._mediaStreamTrack,this.getTrackId(),this._volume)):this._source.play(),e.onSuccess()}stop(){let e=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.REMOTE_AUDIO_TRACK_STOP,options:[this.getTrackId()]});z.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._useAudioElement?Ts.stop(this.getTrackId()):this._source.stop(),e.onSuccess()}_destroy(){super._destroy(),this._source.destroy()}_isFreeze(){return this._source.isFreeze}_updatePlayerSource(){z.debug("[".concat(this.getTrackId(),"] update player source track")),this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&Ts.updateTrack(this.getTrackId(),this._mediaStreamTrack)}}class jm extends mg{constructor(e,r,i,n){super(i,e.uid);this.type="sub",this.unusedTracks=[],this.onTrack=c=>{var h,C;if(c.kind==="audio"&&!this.subscribeOptions.audio||c.kind==="video"&&!this.subscribeOptions.video)return this.unusedTracks.push(c),void z.debug(ne(C="[".concat(this.connectionId,"] unused ontrack event, kind: ")).call(C,c.kind));z.debug(ne(h="[".concat(this.connectionId,"] emit pc ontrack after subscribe ")).call(h,c.kind),c),h=c.kind==="audio"?this.user._audioTrack:this.user._videoTrack;var x,Q;h?h._updateOriginMediaStreamTrack(c):c.kind==="audio"?(this.pc._statsFilter.setIsFirstAudioDecoded(!1),this.user._audioTrack=new al(c,this.getUserId(),this.user._uintid,this.joinInfo.clientId),z.info(ne(x="[".concat(this.connectionId,"] create remote audio track: ")).call(x,this.user._audioTrack.getTrackId())),this.bindTrackEvents(this.user._audioTrack)):(this.user._videoTrack=new ol(c,this.getUserId(),this.user._uintid,this.joinInfo.clientId),z.info(ne(Q="[".concat(this.connectionId,"] create remote video track: ")).call(Q,this.user._videoTrack.getTrackId())),this.bindTrackEvents(this.user._videoTrack))},this.handleGetRemoteAudioStats=c=>{c(this.statsCollector.getRemoteAudioTrackStats(this.connectionId))},this.handleGetRemoteVideoStats=c=>{c(this.statsCollector.getRemoteVideoTrackStats(this.connectionId))},this.handleGetSessionID=c=>{c(this.joinInfo.sid)},this.user=e,this.statsCollector=r,this.statsCollector.addRemoteConnection(this),this.subscribeOptions=n}startP2PConnection(){return Ee(this,null,function*(){return new it((e,r)=>Ee(this,null,function*(){let i=x=>{if(x==="connected"&&(Qe.subscribe(this.joinInfo.sid,{lts:this.startTime,succ:!0,video:this.subscribeOptions.video,audio:this.subscribeOptions.audio,peerid:this.user.uid,ec:null,subscribeRequestid:this.ID,p2pid:this.pc.ID}),this.off(Nt.CONNECTION_STATE_CHANGE,i),e()),x==="disconnected"){if(this.off(Nt.CONNECTION_STATE_CHANGE,i),this.disconnectedReason)return r(this.disconnectedReason);r(new ue(oe.OPERATION_ABORTED,"subscribe abort"))}};if(this.on(Nt.CONNECTION_STATE_CHANGE,i),this.disconnectedReason=void 0,this.connectionState="connecting",this.startTime=ot(),!this.subscribeOptions)return void r(new ue(oe.UNEXPECTED_ERROR,"no subscribe options"));let n=new MediaStream,c=new it(x=>{this.pc.onTrack=(Q,F)=>{var V,Y;if(Q.kind==="audio"&&!this.subscribeOptions.audio||Q.kind==="video"&&!this.subscribeOptions.video)return this.unusedTracks.push(Q),void z.debug(ne(Y="[".concat(this.connectionId,"] unused ontrack event ")).call(Y,Q.kind));n.addTrack(Q),Y={audio:0<n.getAudioTracks().length,video:0<n.getVideoTracks().length},z.debug(ne(V="[".concat(this.connectionId,"] subscribe ontrack: ")).call(V,Q.kind),F,Q);e:{Q=this.subscribeOptions;var $,te;for(F=Wc($=Er(Y)).call($),$=Wc(te=Er(Q)).call(te),te=0;te<F.length;te+=1){if(F[te]!==$[te]){Y=!1;break e}if(Y[F[te]]!==Q[F[te]]){Y=!1;break e}}Y=!0}Y&&(this.pc.onTrack=this.onTrack,z.debug("[".concat(this.connectionId,"] get all subscribed tracks")),x(n))}});try{let x=function($){return Ye().name!==rr.FIREFOX?$:$.replace("/recvonly http://www.webrtc.org/experiments/rtp-hdrext/playout-delay"," http://www.webrtc.org/experiments/rtp-hdrext/playout-delay")}(ja(yield this.pc.createOfferSDP()));yield this.pc.setOfferSDP(x),z.debug("[".concat(this.connectionId,"] create and set offer success"));let Q=yield lr(this,Nt.NEED_ANSWER,{messageType:"OFFER",sdp:x,offererSessionId:104,retry:!0});yield this.pc.setAnswerSDP(ja(Q.sdp)),z.debug("[".concat(this.connectionId,"] set answer success"));let F=yield it.all([c,this.icePromise]),V=F[0].getAudioTracks()[0],Y=F[0].getVideoTracks()[0];var h,C;V&&(this.user._audioTrack?this.user._audioTrack._updateOriginMediaStreamTrack(V):(this.user._audioTrack=new al(V,this.getUserId(),this.user._uintid,this.joinInfo.clientId),z.info(ne(h="[".concat(this.connectionId,"] create remote audio track: ")).call(h,this.user._audioTrack.getTrackId())),this.bindTrackEvents(this.user._audioTrack))),Y&&(this.user._videoTrack?this.user._videoTrack._updateOriginMediaStreamTrack(Y):(this.user._videoTrack=new ol(Y,this.getUserId(),this.user._uintid,this.joinInfo.clientId),z.info(ne(C="[".concat(this.connectionId,"] create remote video track: ")).call(C,this.user._videoTrack.getTrackId())),this.bindTrackEvents(this.user._videoTrack))),this.connectionState="connected",this.startUploadStats()}catch(x){this.off(Nt.CONNECTION_STATE_CHANGE,i),this.connectionState="disconnected",Qe.subscribe(this.joinInfo.sid,{lts:this.startTime,succ:!1,video:this.subscribeOptions.video,audio:this.subscribeOptions.audio,peerid:this.user.uid,ec:x.code,subscribeRequestid:this.ID,p2pid:this.pc.ID}),r(x)}}))})}closeP2PConnection(e){return Ee(this,null,function*(){this.connectionState!=="disconnected"&&(this.stopUploadStats(),this.statsCollector.removeConnection(this.connectionId),this.connectionState="disconnected",yield this.setSubscribeOptions({audio:!1,video:!1}),yield this.closePC(e),this.removeAllListeners())})}getNetworkQuality(){var e=this.pc.getStats();if(!e.audioRecv[0]&&!e.videoRecv[0])return 1;var r=Qi(this,Nt.NEED_SIGNAL_RTT),i=e.rtt;r=(i&&r?(i+r)/2:i||r)||0,i=e.audioRecv[0]?e.audioRecv[0].jitterMs:void 0,e=e.recvPacketLossRate;let n=70*e/50+.3*r/1500;return i&&(n=60*e/50+.2*r/1500+.2*i/400),.1>n?1:.17>n?2:.36>n?3:.59>n?4:5}uploadStats(e){let r=this.user.audioTrack?function(n,c){const h=n.audioRecv[0];return h?(n={id:mr(10,""),timestamp:new Date(n.timestamp).toISOString(),mediaType:"audio",type:"ssrc",ssrc:h.ssrc.toString()},n.bytesReceived=h.bytes.toString(),n.packetsLost=h.packetsLost.toString(),n.packetsReceived=h.packets.toString(),h.outputLevel?n.A_aol=Math.round(100*h.outputLevel).toString():n.A_aol=Math.round(100*c._source.getAccurateVolumeLevel()).toString(),n.A_apol=Math.round(100*c._source.getAccurateVolumeLevel()).toString(),c&&(n.A_artd=c._originMediaStreamTrack.enabled&&c._mediaStreamTrack.enabled?"0":"1"),n.A_jr=h.jitterMs.toString(),n.A_jbm=Math.floor(h.jitterBufferMs).toString(),n.A_cdm=Math.floor(h.jitterBufferMs).toString(),n):null}(e,this.user.audioTrack):void 0,i=this.user.videoTrack?function(n,c){const h=n.videoRecv[0];if(!h)return null;n={id:mr(10,""),timestamp:new Date(n.timestamp).toISOString(),mediaType:"video",type:"ssrc",ssrc:h.ssrc.toString()};var C;return n.bytesReceived=h.bytes.toString(),n.packetsLost=h.packetsLost.toString(),n.packetsReceived=h.packets.toString(),h.framesRateFirefox&&(n.A_frr=h.framesRateFirefox.toString()),h.receivedFrame&&(n.A_frr=h.receivedFrame.frameRate.toString()),n.A_frd=h.decodeFrameRate.toString(),h.outputFrame&&(n.A_fro=h.outputFrame.frameRate.toString()),h.jitterBufferMs!==void 0&&(n.A_jbm=Math.floor(h.jitterBufferMs).toString()),h.currentDelayMs!==void 0&&(n.A_cdm=Math.floor(h.currentDelayMs).toString()),n.A_fs=h.firsCount.toString(),n.A_ns=h.nacksCount.toString(),n.A_ps=h.plisCount.toString(),c&&(n.A_vrtd=c._originMediaStreamTrack.enabled&&c._mediaStreamTrack.enabled?"0":"1"),c._player&&0<c._player.freezeTimeCounterList.length&&(n.A_vrft=un(C=c._player.freezeTimeCounterList).call(C,0,1)[0].toString()),n}(e,this.user.videoTrack):void 0;r&&Ni(()=>this.emit(Nt.NEED_UPLOAD,Gs.SUBSCRIBE_STATS,r)),i&&Ni(()=>this.emit(Nt.NEED_UPLOAD,Gs.SUBSCRIBE_STATS,i))}uploadSlowStats(e){}uploadRelatedStats(e,r){let i=this.pc._statsFilter.videoIsReady===!0,n=function(h,C,x){return h=h.audioRecv[0],h?(x=uc.isRemoteAudioFreeze(x),{mediaType:"audio",isAudioMute:!1,peerId:C,googJitterReceived:h.jitterMs.toString(),isFreeze:x,bytesReceived:h.bytes.toString(),packetsReceived:h.packets.toString(),packetsLost:h.packetsLost.toString(),frameReceived:h.receivedFrames.toString(),frameDropped:h.droppedFrames.toString()}):null}(e,this.getUserId(),this.user.audioTrack),c=function(h,C,x,Q,F){return C=C.videoRecv[0],C?(h=uc.isRemoteVideoFreeze(F,C,Q?Q.videoRecv[0]:void 0)&&h,x={mediaType:"video",isVideoMute:!1,peerId:x,frameRateReceived:C.receivedFrame&&C.receivedFrame.frameRate.toString(),frameRateDecoded:C.decodedFrame&&C.decodedFrame.frameRate.toString(),isFreeze:h,bytesReceived:C.bytes.toString(),packetsReceived:C.packets.toString(),packetsLost:C.packetsLost.toString()},C.framesRateFirefox&&(x.frameRateDecoded=C.framesRateFirefox.toString(),x.frameRateReceived=C.framesRateFirefox.toString()),x):null}(i,e,this.getUserId(),r,this.user.videoTrack);n&&Ni(()=>{this.emit(Nt.NEED_UPLOAD,Gs.SUBSCRIBE_RELATED_STATS,n)}),c&&Ni(()=>{this.emit(Nt.NEED_UPLOAD,Gs.SUBSCRIBE_RELATED_STATS,c)})}emitOnTrackFromUnusedTracks(){if(this.subscribeOptions){var e=this.subscribeOptions.video;if(this.subscribeOptions.audio){var r;let n=tr(r=this.unusedTracks).call(r,c=>c.kind==="audio"&&c.readyState==="live");vi(this.unusedTracks,n),n&&this.onTrack(n)}if(e){var i;e=tr(i=this.unusedTracks).call(i,n=>n.kind==="video"&&n.readyState==="live"),vi(this.unusedTracks,e),e&&this.onTrack(e)}}}setSubscribeOptions(e){return Ee(this,null,function*(){var r,i,n,c;if(e.audio!==this.subscribeOptions.audio||e.video!==this.subscribeOptions.video){if(this.connectionState==="connecting")try{yield this.createWaitConnectionConnectedPromise()}catch(h){throw new ue(oe.OPERATION_ABORTED,"can not update subscribe options, operation abort")}e.audio===this.subscribeOptions.audio&&e.video===this.subscribeOptions.video||(z.debug(ne(r=ne(i=ne(n=ne(c="[".concat(this.connectionId,"] update subscribe options [a: ")).call(c,this.subscribeOptions.audio,", v: ")).call(n,this.subscribeOptions.video,"] -> [a: ")).call(i,e.audio,", v: ")).call(r,e.video,"]")),this.subscribeOptions=e,!e.audio&&this.user._audioTrack&&(this.unusedTracks.push(this.user._audioTrack._originMediaStreamTrack),this.user._audioTrack._destroy(),this.unbindTrackEvents(this.user._audioTrack),this.user._audioTrack=void 0),!e.video&&this.user._videoTrack&&(this.unusedTracks.push(this.user._videoTrack._originMediaStreamTrack),this.user._videoTrack._destroy(),this.unbindTrackEvents(this.user._videoTrack),this.user._videoTrack=void 0),this.emitOnTrackFromUnusedTracks())}})}createPC(){this.pc=new gg({turnServer:this.joinInfo.turnServer}),this.pc.onFirstAudioDecoded=()=>{this.user.audioTrack&&this.user.audioTrack.emit(Yc.FIRST_FRAME_DECODED),Qe.firstRemoteFrame(this.joinInfo.sid,dn.FIRST_AUDIO_DECODE,gi.FIRST_AUDIO_DECODE,{peer:this.user._uintid,subscribeElapse:ot()-this.startTime,subscribeRequestid:this.ID,p2pid:this.pc.ID})},this.pc.onFirstAudioReceived=()=>{Qe.firstRemoteFrame(this.joinInfo.sid,dn.FIRST_AUDIO_RECEIVED,gi.FIRST_AUDIO_RECEIVED,{peer:this.user._uintid,subscribeElapse:ot()-this.startTime,subscribeRequestid:this.ID,p2pid:this.pc.ID})},this.pc.onFirstVideoDecoded=(e,r)=>{Qe.firstRemoteFrame(this.joinInfo.sid,dn.FIRST_VIDEO_DECODE,gi.FIRST_VIDEO_DECODE,{peer:this.user._uintid,videowidth:e,videoheight:r,subscribeElapse:ot()-this.startTime,subscribeRequestid:this.ID,p2pid:this.pc.ID})},this.pc.onFirstVideoReceived=()=>{Qe.firstRemoteFrame(this.joinInfo.sid,dn.FIRST_VIDEO_RECEIVED,gi.FIRST_VIDEO_RECEIVED,{peer:this.user._uintid,subscribeElapse:ot()-this.startTime,subscribeRequestid:this.ID,p2pid:this.pc.ID})},this.updateICEPromise()}closePC(e){return Ee(this,null,function*(){return this.pc.audioTrack&&this.pc.audioTrack.stop(),this.pc.videoTrack&&this.pc.videoTrack.stop(),this.pc.onTrack=void 0,this.pc.onICEConnectionStateChange=void 0,this.pc.close(),e?!1:yield lr(this,Nt.NEED_UNSUB)})}onPCDisconnected(e){Qe.subscribe(this.joinInfo.sid,{lts:this.startTime,succ:!1,video:this.subscribeOptions.video,audio:this.subscribeOptions.audio,peerid:this.user.uid,ec:e.code,subscribeRequestid:this.ID,p2pid:this.pc.ID})}bindTrackEvents(e){e instanceof al?e.addListener(xt.GET_STATS,this.handleGetRemoteAudioStats):e instanceof ol&&e.addListener(xt.GET_STATS,this.handleGetRemoteVideoStats)}unbindTrackEvents(e){e instanceof al?e.off(xt.GET_STATS,this.handleGetRemoteAudioStats):e instanceof ol&&e.off(xt.GET_STATS,this.handleGetRemoteVideoStats)}}class Wm extends An{constructor(e,r,i,n){super();this.reconnectMode="retry",this.commandReqId=this.reqId=0,this.handleWebSocketOpen=()=>{this.reconnectMode="retry",this.startPingPong()},this.handleWebSocketMessage=c=>{if(c.data){c=JSON.parse(c.data);var h;c.requestId?this.emit(ne(h="@".concat(c.requestId,"-")).call(h,c.sid),c):this.serviceMode===Ei.INJECT?this.emit(Ks.INJECT_STREAM_STATUS,c):(Qe.workerEvent(this.spec.sid,{actionType:"status",serverCode:c.code,workerType:this.serviceMode===Ei.TRANSCODE?1:2}),this.emit(Ks.PUBLISH_STREAM_STATUS,c))}},this.spec=r,this.token=e,this.serviceMode=n,this.websocket=new Ld("live-streaming",i),this.websocket.on(pr.CONNECTED,this.handleWebSocketOpen),this.websocket.on(pr.ON_MESSAGE,this.handleWebSocketMessage),this.websocket.on(pr.REQUEST_NEW_URLS,(c,h)=>{lr(this,Ks.REQUEST_NEW_ADDRESS).then(c).catch(h)}),this.websocket.on(pr.RECONNECTING,()=>{this.websocket.reconnectMode=this.reconnectMode})}init(e){return this.websocket.init(e)}request(e,r,i,n){return Ee(this,null,function*(){this.reqId+=1,e==="request"&&(this.commandReqId+=1);let c=this.commandReqId,h=this.reqId;if(!h||!this.websocket)throw new ue(oe.UNEXPECTED_ERROR);var C=Va({command:e,sdkVersion:as==="4.7.3"?"0.0.1":as,seq:h,requestId:h,allocate:i,cname:this.spec.cname,appId:this.spec.appId,sid:this.spec.sid,uid:this.spec.uid.toString(),ts:Math.floor(ot()/1e3)},r);if(this.websocket.state==="closed")throw new ue(oe.WS_DISCONNECT);let x=()=>new it((V,Y)=>{this.websocket.once(pr.CLOSED,()=>Y(new ue(oe.WS_ABORT))),this.websocket.once(pr.CONNECTED,V)});this.websocket.state!=="connected"&&(yield x()),C.clientRequest&&(C.clientRequest.workerToken=this.token);let Q=new it((V,Y)=>{var $;const te=()=>{Y(new ue(oe.WS_ABORT))};this.websocket.once(pr.RECONNECTING,te),this.websocket.once(pr.CLOSED,te),this.once(ne($="@".concat(h,"-")).call($,this.spec.sid),ce=>{V(ce)})});n&&Qe.workerEvent(this.spec.sid,Va({},n,{requestId:c,actionType:"request",payload:ht(r.clientRequest),serverCode:0,code:0}));let F=ot();this.websocket.sendMessage(C),C=null;try{C=yield Q}catch(V){if(this.websocket.state==="closed")throw V;return yield x(),yield this.request(e,r,i)}return n&&Qe.workerEvent(this.spec.sid,Va({},n,{requestId:c,actionType:"response",payload:ht(C.serverResponse),serverCode:C.code,success:C.code===200,responseTime:ot()-F})),C.code!==200&&this.handleResponseError(C),C})}tryNextAddress(){this.reconnectMode="tryNext",this.websocket.reconnect("tryNext")}close(){let e=as==="4.7.3"?"0.0.1":as;this.reqId+=1,this.websocket.state==="connected"?(this.websocket.sendMessage({command:"request",appId:this.spec.appId,cname:this.spec.cname,uid:this.spec.uid.toString(),sdkVersion:e,sid:this.spec.sid,seq:this.reqId,ts:Math.floor(ot()/1e3),requestId:this.reqId,clientRequest:{command:"DestroyWorker"}}),this.websocket.close(!1,!0)):this.websocket.close(!1),this.pingpongTimer&&(window.clearInterval(this.pingpongTimer),this.pingpongTimer=void 0)}handleResponseError(e){switch(e.code){case Xr.LIVE_STREAM_RESPONSE_ALREADY_EXISTS_STREAM:return void z.warning("live stream response already exists stream");case Xr.LIVE_STREAM_RESPONSE_TRANSCODING_PARAMETER_ERROR:case Xr.LIVE_STREAM_RESPONSE_BAD_STREAM:case Xr.LIVE_STREAM_RESPONSE_WM_PARAMETER_ERROR:return new ue(oe.LIVE_STREAMING_INVALID_ARGUMENT,"",{code:e.code}).throw();case Xr.LIVE_STREAM_RESPONSE_WM_WORKER_NOT_EXIST:if(e.serverResponse.command==="UnpublishStream"||e.serverResponse.command==="UninjectStream")break;throw new ue(oe.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"live stream response wm worker not exist",{retry:!0});case Xr.LIVE_STREAM_RESPONSE_NOT_AUTHORIZED:return new ue(oe.LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED,"",{code:e.code}).throw();case Xr.LIVE_STREAM_RESPONSE_FAILED_LOAD_IMAGE:var r=new ue(oe.LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE);return this.emit(Ks.WARNING,r,e.serverResponse.url);case Xr.LIVE_STREAM_RESPONSE_REQUEST_TOO_OFTEN:return r=new ue(oe.LIVE_STREAMING_WARN_FREQUENT_REQUEST),this.emit(Ks.WARNING,r,e.serverResponse.url);case Xr.LIVE_STREAM_RESPONSE_NOT_FOUND_PUBLISH:throw new ue(oe.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"live stream response wm worker not exist",{retry:!0});case Xr.LIVE_STREAM_RESPONSE_NOT_SUPPORTED:return new ue(oe.LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED,"",{code:e.code}).throw();case Xr.LIVE_STREAM_RESPONSE_MAX_STREAM_NUM:return r=new ue(oe.LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT),this.emit(Ks.WARNING,r,e.serverResponse.url);case Xr.LIVE_STREAM_RESPONSE_INTERNAL_SERVER_ERROR:return new ue(oe.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"",{code:e.code}).throw();case Xr.LIVE_STREAM_RESPONSE_RESOURCE_LIMIT:throw new ue(oe.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"live stream resource limit",{retry:!0,changeAddress:!0});case Xr.LIVE_STREAM_RESPONSE_WORKER_LOST:case Xr.LIVE_STREAM_RESPONSE_WORKER_QUIT:if(e.serverResponse.command==="UnpublishStream"||e.serverResponse.command==="UninjectStream")break;throw new ue(oe.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"error fail send message",{retry:!0,changeAddress:!0});case Xr.ERROR_FAIL_SEND_MESSAGE:if(e.serverResponse.command==="UnpublishStream"||e.serverResponse.command==="UninjectStream")break;if(e.serverResponse.command==="UpdateTranscoding"||e.serverResponse.command==="ControlStream")return new ue(oe.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"error fail send message",{code:e.code}).throw();throw new ue(oe.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"error fail send message",{retry:!0,changeAddress:!0});case Xr.PUBLISH_STREAM_STATUS_ERROR_PUBLISH_BROKEN:case Xr.PUBLISH_STREAM_STATUS_ERROR_RTMP_CONNECT:case Xr.PUBLISH_STREAM_STATUS_ERROR_RTMP_HANDSHAKE:case Xr.PUBLISH_STREAM_STATUS_ERROR_RTMP_PUBLISH:return new ue(oe.LIVE_STREAMING_CDN_ERROR,"",{code:e.code}).throw()}}startPingPong(){this.pingpongTimer&&window.clearInterval(this.pingpongTimer),this.pingpongTimer=window.setInterval(()=>{this.websocket.state==="connected"&&this.request("ping",{}).catch(Xl)},6e3)}}class Vm extends An{constructor(e,r=Vi,i=Vi){super();this.retryTimeout=1e4,this.streamingTasks=new Lr,this.isStartingStreamingTask=!1,this.taskMutex=new Yo("live-streaming"),this.cancelToken=yo.CancelToken.source(),this.injectConfig=mo({},hv),this.injectLoopTimes=0,this.lastTaskId=1,this.statusError=new Lr,this.spec=e,this.httpRetryConfig=i,this.wsRetryConfig=r}setTranscodingConfig(e){return Ee(this,null,function*(){var r;let i=mo({},dv,{},e);var n,c;i.videoCodecProfile!==66&&i.videoCodecProfile!==77&&i.videoCodecProfile!==100&&(z.debug(ne(n="[".concat(this.spec.clientId,"] set transcoding config, fix video codec profile: ")).call(n,i.videoCodecProfile," -> 100")),i.videoCodecProfile=100),i.transcodingUsers||(i.transcodingUsers=i.userConfigs),i.transcodingUsers&&(i.transcodingUsers=yt(c=i.transcodingUsers).call(c,Y=>mo({},uv,{},Y,{zOrder:Y.zOrder?Y.zOrder+1:1}))),function(Y){var $,te;Y.width==null||$t(Y.width,"config.width",0,1e4),Y.height==null||$t(Y.height,"config.height",0,1e4),Y.videoBitrate==null||$t(Y.videoBitrate,"config.videoBitrate",1,1e6),Y.videoFrameRate==null||$t(Y.videoFrameRate,"config.videoFrameRate"),Y.lowLatency==null||Fn(Y.lowLatency,"config.lowLatency"),Y.audioSampleRate==null||Yr(Y.audioSampleRate,"config.audioSampleRate",[32e3,44100,48e3]),Y.audioBitrate==null||$t(Y.audioBitrate,"config.audioBitrate",1,128),Y.audioChannels==null||Yr(Y.audioChannels,"config.audioChannels",[1,2,3,4,5]),Y.videoGop==null||$t(Y.videoGop,"config.videoGop"),Y.videoCodecProfile==null||Yr(Y.videoCodecProfile,"config.videoCodecProfile",[66,77,100]),Y.userCount==null||$t(Y.userCount,"config.userCount",0,17),Y.backgroundColor==null||$t(Y.backgroundColor,"config.backgroundColor",0,16777215),Y.userConfigExtraInfo==null||Jr(Y.userConfigExtraInfo,"config.userConfigExtraInfo",0,4096,!1),Y.transcodingUsers&&Y.transcodingUsers!=null&&(oo(Y.transcodingUsers,"config.transcodingUsers"),Re($=Y.transcodingUsers).call($,(ce,Ae)=>{co(ce.uid),ce.x==null||$t(ce.x,"transcodingUser[".concat(Ae,"].x"),0,1e4),ce.y==null||$t(ce.y,"transcodingUser[".concat(Ae,"].y"),0,1e4),ce.width==null||$t(ce.width,"transcodingUser[".concat(Ae,"].width"),0,1e4),ce.height==null||$t(ce.height,"transcodingUser[".concat(Ae,"].height"),0,1e4),ce.zOrder==null||$t(ce.zOrder-1,"transcodingUser[".concat(Ae,"].zOrder"),0,100),ce.alpha==null||$t(ce.alpha,"transcodingUser[".concat(Ae,"].alpha"),0,1,!1)})),Y.watermark==null||Bs(Y.watermark,"watermark"),Y.backgroundImage==null||Bs(Y.backgroundImage,"backgroundImage"),Y.images&&Y.images!=null&&(oo(Y.images,"config.images"),Re(te=Y.images).call(te,(ce,Ae)=>{Bs(ce,"images[".concat(Ae,"]"))}))}(i),e=[];var h,C;if(i.images&&e.push(...yt(h=i.images).call(h,Y=>mo({},ud,{},Y,{zOrder:255}))),i.backgroundImage&&(e.push(mo({},ud,{},i.backgroundImage,{zOrder:0})),delete i.backgroundImage),i.watermark&&(e.push(mo({},ud,{},i.watermark,{zOrder:255})),delete i.watermark),i.images=e,i.transcodingUsers&&(i.userConfigs=yt(C=i.transcodingUsers).call(C,Y=>mo({},Y)),i.userCount=i.transcodingUsers.length,delete i.transcodingUsers),h=yt(r=i.userConfigs||[]).call(r,Y=>typeof Y.uid=="number"?it.resolve(Y.uid):Po(Y.uid,this.spec,this.cancelToken.token,this.httpRetryConfig)),r=yield it.all(h),Re(r).call(r,(Y,$)=>{i.userConfigs&&i.userConfigs[$]&&(i.userConfigs[$].uid=Y)}),this.transcodingConfig=i,this.connection)try{var x,Q,F;let Y=yield this.connection.request("request",{clientRequest:{command:"UpdateTranscoding",transcodingConfig:this.transcodingConfig}},!1,{command:"UpdateTranscoding",workerType:1,requestByUser:!0,tid:yt(x=io(Ma(Q=this.streamingTasks).call(Q))).call(x,$=>$.taskId).join("#")});z.debug(ne(F="[".concat(this.spec.clientId,"] update live transcoding config success, code: ")).call(F,Y.code,", config:"),ht(this.transcodingConfig))}catch(Y){var V;if(!Y.data||!Y.data.retry)throw Y;Y.data.changeAddress&&this.connection.tryNextAddress(),Re(V=this.streamingTasks).call(V,$=>{z.warning("[".concat(this.spec.clientId,"] live streaming receive error"),Y.toString(),"try to republish",$.url),this.startLiveStreamingTask($.url,$.mode,Y).then(()=>{var te;z.debug(ne(te="[".concat(this.spec.clientId,"] live streaming republish ")).call(te,$.url," success"))}).catch(te=>{z.error("[".concat(this.spec.clientId,"] live streaming republish failed"),$.url,te.toString()),this.onLiveStreamError&&this.onLiveStreamError($.url,te)})})}})}setInjectStreamConfig(e,r){this.injectConfig=Sn({},this.injectConfig,e),this.injectLoopTimes=r}startLiveStreamingTask(e,r,i){return Ee(this,null,function*(){var n,c,h,C;if(tr(n=io(Ma(c=this.streamingTasks).call(c))).call(n,Q=>Q.mode===Ei.INJECT)&&r===Ei.INJECT)return new ue(oe.LIVE_STREAMING_TASK_CONFLICT,"inject stream over limit").throw();if(!this.transcodingConfig&&r===Ei.TRANSCODE)throw new ue(oe.INVALID_OPERATION,"[LiveStreaming] no transcoding config found, can not start transcoding streaming task");if(n={command:"PublishStream",ts:ot(),url:e,uid:this.spec.uid.toString(),autoDestroyTime:100,acceptImageTimeout:!0},z.debug(ne(h=ne(C="[".concat(this.spec.clientId,"] start live streaming ")).call(C,e,", mode: ")).call(h,r)),h=yield this.taskMutex.lock(),!this.connection&&i)return void h();if(this.streamingTasks.get(e)&&!i)return h(),new ue(oe.LIVE_STREAMING_TASK_CONFLICT).throw();try{this.connection||(this.connection=yield this.connect(r))}catch(Q){throw h(),Q}switch(r){case Ei.TRANSCODE:n.transcodingConfig=mo({},this.transcodingConfig);break;case Ei.INJECT:n={cname:this.spec.cname,command:"InjectStream",sid:this.spec.sid,transcodingConfig:this.injectConfig,ts:ot(),url:e,loopTimes:this.injectLoopTimes}}this.uapResponse&&this.uapResponse.vid&&(n.vid=this.uapResponse.vid),this.isStartingStreamingTask=!0,C=this.lastTaskId++;try{var x;let Q=new it((V,Y)=>{Pe(this.retryTimeout).then(()=>{if(i)return Y(i);const $=this.statusError.get(e);return $?(this.statusError.delete(e),Y($)):void 0})}),F=yield it.race([this.connection.request("request",{clientRequest:n},!0,{url:e,command:"PublishStream",workerType:r===Ei.TRANSCODE?1:2,requestByUser:!i,tid:C.toString()}),Q]);this.isStartingStreamingTask=!1,z.debug(ne(x="[".concat(this.spec.clientId,"] live streaming started, code: ")).call(x,F.code)),this.streamingTasks.set(e,{clientRequest:n,mode:r,url:e,taskId:C}),h()}catch(Q){if(h(),this.isStartingStreamingTask=!1,!Q.data||!Q.data.retry||i)throw Q;return Q.data.changeAddress?(this.connection.tryNextAddress(),yield this.startLiveStreamingTask(e,r,Q)):yield this.startLiveStreamingTask(e,r,Q)}})}stopLiveStreamingTask(e){return new it((r,i)=>{let n=this.streamingTasks.get(e);if(!n||!this.connection)return new ue(oe.UNEXPECTED_ERROR,"can not find streaming task to stop").throw();let c=n.mode;n.abortTask=()=>{z.debug("[".concat(this.spec.clientId,"] stop live streaming success(worker exception)")),this.streamingTasks.delete(e),r()},this.connection.request("request",{clientRequest:{command:c===Ei.INJECT?"UninjectStream":"UnpublishStream",url:n.url}},!1,{url:e,command:"UnPublishStream",workerType:c===Ei.TRANSCODE?1:2,requestByUser:!0,tid:(this.lastTaskId++).toString()}).then(h=>{var C;z.debug(ne(C="[".concat(this.spec.clientId,"] stop live streaming success, code: ")).call(C,h.code)),this.streamingTasks.delete(e),this.streamingTasks.size===0&&c!==Ei.INJECT&&(this.connection&&this.connection.close(),this.connection=void 0),r(),c===Ei.INJECT&&this.onInjectStatusChange&&this.onInjectStatusChange(5,this.spec.uid,e)}).catch(i)})}controlInjectStream(e,r,i,n){return Ee(this,null,function*(){let c=this.streamingTasks.get(e);if(!c||!this.connection||c.mode!==Ei.INJECT)throw new ue(oe.INVALID_OPERATION,"can not find inject stream task to control");return(yield this.connection.request("request",{clientRequest:{command:"ControlStream",url:e,control:r,audioVolume:i,position:n}})).serverResponse})}resetAllTask(){var e;let r=io(Ma(e=this.streamingTasks).call(e));this.terminate();for(let i of r)this.startLiveStreamingTask(i.url,i.mode).catch(n=>{this.onLiveStreamError&&this.onLiveStreamError(i.url,n)})}terminate(){this.cancelToken&&this.cancelToken.cancel(),this.streamingTasks=new Lr,this.isStartingStreamingTask=!1,this.statusError=new Lr,this.cancelToken=yo.CancelToken.source(),this.uapResponse=void 0,this.connection&&this.connection.close(),this.connection=void 0}connect(e){return Ee(this,null,function*(){if(this.connection)throw new ue(oe.UNEXPECTED_ERROR,"live streaming connection has already connected");let r=yield lr(this,ac.REQUEST_WORKER_MANAGER_LIST,e);return this.uapResponse=r,this.connection=new Wm(r.workerToken,this.spec,this.wsRetryConfig,e),this.connection.on(Ks.WARNING,(i,n)=>this.onLiveStreamWarning&&this.onLiveStreamWarning(n,i)),this.connection.on(Ks.PUBLISH_STREAM_STATUS,i=>this.handlePublishStreamServer(i)),this.connection.on(Ks.INJECT_STREAM_STATUS,i=>this.handleInjectStreamServerStatus(i)),this.connection.on(Ks.REQUEST_NEW_ADDRESS,(i,n)=>{if(!this.connection)return n(new ue(oe.UNEXPECTED_ERROR,"can not get new live streaming address list"));lr(this,ac.REQUEST_WORKER_MANAGER_LIST,e).then(c=>{this.uapResponse=c,i(c.addressList)}).catch(n)}),yield this.connection.init(r.addressList),this.connection})}handlePublishStreamServer(e){var r=e.serverStatus&&e.serverStatus.url||"empty_url";let i=this.streamingTasks.get(r),n=e.reason;switch(e.code){case Xr.PUBLISH_STREAM_STATUS_ERROR_PUBLISH_BROKEN:case Xr.PUBLISH_STREAM_STATUS_ERROR_RTMP_CONNECT:case Xr.PUBLISH_STREAM_STATUS_ERROR_RTMP_HANDSHAKE:case Xr.PUBLISH_STREAM_STATUS_ERROR_RTMP_PUBLISH:if(e=new ue(oe.LIVE_STREAMING_CDN_ERROR,"",{code:e.code}),i)return z.error(e.toString()),this.onLiveStreamError&&this.onLiveStreamError(r,e);if(!this.isStartingStreamingTask)break;this.statusError.set(r,e);case Xr.LIVE_STREAM_RESPONSE_FAILED_LOAD_IMAGE:return e=new ue(oe.LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE,n),this.onLiveStreamWarning&&this.onLiveStreamWarning(r,e);case Xr.LIVE_STREAM_RESPONSE_WORKER_LOST:case Xr.LIVE_STREAM_RESPONSE_WORKER_QUIT:var c;if(this.connection){this.connection.tryNextAddress(),r=io(Ma(c=this.streamingTasks).call(c));for(let h of r)h.abortTask?h.abortTask():(z.warning("[".concat(this.spec.clientId,"] publish stream status code"),e.code,"try to republish",h.url),this.startLiveStreamingTask(h.url,h.mode,new ue(oe.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"",{code:e.code})).then(()=>{z.debug("[".concat(this.spec.clientId,"] republish live stream success"),h.url)}).catch(C=>{z.error(C.toString()),this.onLiveStreamError&&this.onLiveStreamError(h.url,C)}))}}}handleInjectStreamServerStatus(e){let r=Number(e.uid),i=e.serverStatus&&e.serverStatus.url;switch(e.code){case 200:return void(this.onInjectStatusChange&&this.onInjectStatusChange(0,r,i));case 451:return this.onInjectStatusChange&&this.onInjectStatusChange(1,r,i),void this.streamingTasks.delete(i);case 453:return this.onInjectStatusChange&&this.onInjectStatusChange(2,r,i),void this.streamingTasks.delete(i);case 470:return this.onInjectStatusChange&&this.onInjectStatusChange(10,r,i),void this.streamingTasks.delete(i);case 499:return this.onInjectStatusChange&&this.onInjectStatusChange(3,r,i),void this.streamingTasks.delete(i);default:return void z.debug("inject stream server status",e)}}hasUrl(e){return this.streamingTasks.has(e)}}class Lg{constructor(){this.destChannelMediaInfos=new Lr}setSrcChannelInfo(e){lo(e),this.srcChannelMediaInfo=e}addDestChannelInfo(e){lo(e),this.destChannelMediaInfos.set(e.channelName,e)}removeDestChannelInfo(e){ao(e),this.destChannelMediaInfos.delete(e)}getSrcChannelMediaInfo(){return this.srcChannelMediaInfo}getDestChannelMediaInfo(){return this.destChannelMediaInfos}}class Ym extends An{constructor(e,r,i){super();this.requestId=1,this.onOpen=()=>{this.emit("open"),this.startHeartBeatCheck()},this.onClose=n=>{this.emit("close"),this.dispose()},this.onMessage=n=>{if(n=JSON.parse(n.data),!n||n.command!=="serverResponse"||!n.requestId)return n&&n.command==="serverStatus"&&n.serverStatus&&n.serverStatus.command?(this.emit("status",n.serverStatus),void this.emit(n.serverStatus.command,n.serverStatus)):void 0;this.emit("req_".concat(n.requestId),n)},this.joinInfo=e,this.clientId=r,this.ws=new Ld("cross-channel-".concat(this.clientId),i),this.ws.on(pr.RECONNECTING,()=>{this.ws.reconnectMode="retry",this.emit("reconnecting")}),this.ws.on(pr.CONNECTED,this.onOpen),this.ws.on(pr.ON_MESSAGE,this.onMessage),this.ws.on(pr.CLOSED,this.onClose)}isConnect(){return this.ws.state==="connected"}sendMessage(e){let r=this.requestId++;return e.requestId=r,e.seq=r,this.ws.sendMessage(e),r}waitStatus(e){return new it((r,i)=>{let n=window.setTimeout(()=>{i(new ue(oe.TIMEOUT,"wait status timeout, status: ".concat(e)))},5e3);this.once(e,c=>{window.clearTimeout(n),c.state&&c.state!==0?i(new ue(oe.CROSS_CHANNEL_WAIT_STATUS_ERROR,"wait status error, status: ".concat(e))):r(void 0)}),this.once("dispose",()=>{window.clearTimeout(n),i(new ue(oe.WS_ABORT))})})}request(e){return Ee(this,null,function*(){if(this.ws.state==="closed")throw new ue(oe.WS_DISCONNECT);let r=()=>new it((n,c)=>{this.ws.once(pr.CLOSED,()=>c(new ue(oe.WS_ABORT))),this.ws.once(pr.CONNECTED,n)});this.ws.state!=="connected"&&(yield r());let i=this.sendMessage(e);if(e=yield new it((n,c)=>{const h=()=>{c(new ue(oe.WS_ABORT))};this.ws.once(pr.RECONNECTING,h),this.ws.once(pr.CLOSED,h),this.once("req_".concat(i),n),Pe(3e3).then(()=>{this.removeAllListeners("req_".concat(i)),this.ws.off(pr.RECONNECTING,h),this.ws.off(pr.CLOSED,h),c(new ue(oe.TIMEOUT,"cross channel ws request timeout"))})}),!e||e.code!==200)throw new ue(oe.CROSS_CHANNEL_SERVER_ERROR_RESPONSE,"response: ".concat(ht(e)));return e})}connect(e){return Ee(this,null,function*(){this.ws.removeAllListeners(pr.REQUEST_NEW_URLS),this.ws.on(pr.REQUEST_NEW_URLS,r=>{r(e)}),yield this.ws.init(e)})}dispose(){this.clearHeartBeatCheck(),this.emit("dispose"),this.removeAllListeners(),this.ws.close()}sendPing(e){let r=this.requestId++;return e.requestId=r,this.ws.sendMessage(e),r}startHeartBeatCheck(){this.heartBeatTimer=window.setInterval(()=>{this.sendPing({command:"ping",appId:this.joinInfo.appId,cname:this.joinInfo.cname,uid:this.joinInfo.uid.toString(),sid:this.joinInfo.sid,ts:+new Date,requestId:0})},3e3)}clearHeartBeatCheck(){window.clearInterval(this.heartBeatTimer),this.heartBeatTimer=void 0}}class Jm extends An{constructor(e,r,i,n){super();this.cancelToken=yo.CancelToken.source(),this.requestId=0,this._state="RELAY_STATE_IDLE",this.errorCode="RELAY_OK",this.onStatus=c=>{var h;z.debug(ne(h="[".concat(this.clientId,"] ChannelMediaStatus: ")).call(h,ht(c))),c&&c.command&&(c.command==="onAudioPacketReceived"&&this.emit("event","PACKET_RECEIVED_AUDIO_FROM_SRC"),c.command==="onVideoPacketReceived"&&this.emit("event","PACKET_RECEIVED_VIDEO_FROM_SRC"),c.command==="onSrcTokenPrivilegeDidExpire"&&(this.errorCode="SRC_TOKEN_EXPIRED",this.state="RELAY_STATE_FAILURE"),c.command==="onDestTokenPrivilegeDidExpire"&&(this.errorCode="DEST_TOKEN_EXPIRED",this.state="RELAY_STATE_FAILURE"))},this.onReconnect=()=>Ee(this,null,function*(){z.debug("[".concat(this.clientId,"] ChannelMediaSocket disconnect, reconnecting")),this.emit("event","NETWORK_DISCONNECTED"),this.state="RELAY_STATE_IDLE",this.prevChannelMediaConfig&&this.sendStartRelayMessage(this.prevChannelMediaConfig).catch(c=>{this.state!=="RELAY_STATE_IDLE"&&(z.error("auto restart channel media relay failed",c.toString()),this.errorCode="SERVER_CONNECTION_LOST",this.state="RELAY_STATE_FAILURE")})}),this.joinInfo=e,this.clientId=r,this.signal=new Ym(this.joinInfo,this.clientId,i),this.httpRetryConfig=n}set state(e){e!==this._state&&(e!=="RELAY_STATE_FAILURE"&&(this.errorCode="RELAY_OK"),this.emit("state",e,this.errorCode),this._state=e)}get state(){return this._state}startChannelMediaRelay(e){return Ee(this,null,function*(){if(this.state!=="RELAY_STATE_IDLE")throw new ue(oe.INVALID_OPERATION);this.state="RELAY_STATE_CONNECTING",yield this.connect(),z.debug("[".concat(this.clientId,"] startChannelMediaRelay: connect success"));try{yield this.sendStartRelayMessage(e)}catch(r){throw r.data&&r.data.serverResponse&&r.data.serverResponse.command==="SetSourceChannel"?new ue(oe.CROSS_CHANNEL_FAILED_JOIN_SRC):r.data&&r.data.serverResponse&&r.serverResponse.command==="SetDestChannelStatus"?new ue(oe.CROSS_CHANNEL_FAILED_JOIN_DEST):r.data&&r.data.serverResponse&&r.serverResponse.command==="StartPacketTransfer"?new ue(oe.CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST):r}this.prevChannelMediaConfig=e})}updateChannelMediaRelay(e){return Ee(this,null,function*(){if(this.state!=="RELAY_STATE_RUNNING")throw new ue(oe.INVALID_OPERATION);yield this.sendUpdateMessage(e),this.prevChannelMediaConfig=e})}stopChannelMediaRelay(){return Ee(this,null,function*(){yield this.sendStopRelayMessage(),z.debug("[".concat(this.clientId,"] stopChannelMediaRelay: send stop message success")),this.state="RELAY_STATE_IDLE",this.dispose()})}dispose(){z.debug("[".concat(this.clientId,"] disposeChannelMediaRelay")),this.cancelToken.cancel(),this.cancelToken=yo.CancelToken.source(),this.state="RELAY_STATE_IDLE",this.emit("dispose"),this.signal.dispose(),this.prevChannelMediaConfig=void 0}connect(){return Ee(this,null,function*(){let e=yield vo(this.joinInfo,this.cancelToken.token,this.httpRetryConfig);this.workerToken=e.workerToken,yield this.signal.connect(e.addressList),this.emit("event","NETWORK_CONNECTED"),this.signal.on("status",this.onStatus),this.signal.on("reconnecting",this.onReconnect)})}sendStartRelayMessage(e){return Ee(this,null,function*(){var r=this.genMessage(fn.StopPacketTransfer);yield this.signal.request(r),yield this.signal.waitStatus("Normal Quit"),z.debug("[".concat(this.clientId,"] startChannelMediaRelay: StopPacketTransfer success")),r=this.genMessage(fn.SetSdkProfile,e),yield this.signal.request(r),z.debug("[".concat(this.clientId,"] startChannelMediaRelay: SetSdkProfile success")),r=this.genMessage(fn.SetSourceChannel,e),yield this.signal.request(r),yield this.signal.waitStatus("SetSourceChannelStatus"),this.emit("event","PACKET_JOINED_SRC_CHANNEL"),z.debug("[".concat(this.clientId,"] startChannelMediaRelay: SetSourceChannel success")),r=this.genMessage(fn.SetSourceUserId,e),yield this.signal.request(r),z.debug("[".concat(this.clientId,"] startChannelMediaRelay: SetSourceUserId success")),r=this.genMessage(fn.SetDestChannel,e),yield this.signal.request(r),yield this.signal.waitStatus("SetDestChannelStatus"),this.emit("event","PACKET_JOINED_DEST_CHANNEL"),z.debug("[".concat(this.clientId,"] startChannelMediaRelay: SetDestChannel success")),e=this.genMessage(fn.StartPacketTransfer,e),yield this.signal.request(e),this.emit("event","PACKET_SENT_TO_DEST_CHANNEL"),this.state="RELAY_STATE_RUNNING",z.debug("[".concat(this.clientId,"] startChannelMediaRelay: StartPacketTransfer success"))})}sendUpdateMessage(e){return Ee(this,null,function*(){e=this.genMessage(fn.UpdateDestChannel,e),yield this.signal.request(e),this.emit("event","PACKET_UPDATE_DEST_CHANNEL"),z.debug("[".concat(this.clientId,"] sendUpdateMessage: UpdateDestChannel success"))})}sendStopRelayMessage(){return Ee(this,null,function*(){let e=this.genMessage(fn.StopPacketTransfer);yield this.signal.request(e),z.debug("[".concat(this.clientId,"] sendStopRelayMessage: StopPacketTransfer success"))})}genMessage(e,r){let i=[],n=[],c=[];this.requestId+=1;let h={appId:this.joinInfo.appId,cname:this.joinInfo.cname,uid:this.joinInfo.uid.toString(),sdkVersion:as,sid:this.joinInfo.sid,ts:ot(),requestId:this.requestId,seq:this.requestId,allocate:!0,clientRequest:{}};h.sdkVersion==="4.7.3"&&(h.sdkVersion="0.0.1");let C=null,x=null;switch(e){case fn.SetSdkProfile:return h.clientRequest={command:"SetSdkProfile",type:"multi_channel"},h;case fn.SetSourceChannel:if(x=r&&r.getSrcChannelMediaInfo(),!x)throw new ue(oe.UNEXPECTED_ERROR,"can not find source config");return h.clientRequest={command:"SetSourceChannel",uid:"0",channelName:x.channelName,token:x.token||this.joinInfo.appId},h;case fn.SetSourceUserId:if(x=r&&r.getSrcChannelMediaInfo(),!x)throw new ue(oe.UNEXPECTED_ERROR,"can not find source config");return h.clientRequest={command:"SetSourceUserId",uid:x.uid+""},h;case fn.SetDestChannel:if(C=r&&r.getDestChannelMediaInfo(),!C)throw new ue(oe.UNEXPECTED_ERROR,"can not find dest config");return Re(C).call(C,Q=>{i.push(Q.channelName),n.push(Q.uid+""),c.push(Q.token||this.joinInfo.appId)}),h.clientRequest={command:"SetDestChannel",channelName:i,uid:n,token:c},h;case fn.StartPacketTransfer:return h.clientRequest={command:"StartPacketTransfer"},h;case fn.Reconnect:return h.clientRequest={command:"Reconnect"},h;case fn.StopPacketTransfer:return h.clientRequest={command:"StopPacketTransfer"},h;case fn.UpdateDestChannel:if(C=r&&r.getDestChannelMediaInfo(),!C)throw new ue(oe.UNEXPECTED_ERROR,"can not find dest config");return Re(C).call(C,Q=>{i.push(Q.channelName),n.push(Q.uid+""),c.push(Q.token||this.joinInfo.appId)}),h.clientRequest={command:"UpdateDestChannel",channelName:i,uid:n,token:c},h}return h}}class zm{constructor(e,r){this._trust_stream_added_state_=this._trust_video_mute_state_=this._trust_audio_mute_state_=this._trust_video_enabled_state_=this._trust_audio_enabled_state_=this._trust_in_room_=!0,this._video_muted_=this._audio_muted_=!1,this._video_enabled_=this._audio_enabled_=!0,this._video_added_=this._audio_added_=!1,this.uid=e,this._uintid=r}get hasVideo(){return this._video_enabled_&&!this._video_muted_&&this._video_added_}get hasAudio(){return this._audio_enabled_&&!this._audio_muted_&&this._audio_added_}get audioTrack(){if(this.hasAudio)return this._audioTrack}get videoTrack(){if(this.hasVideo)return this._videoTrack}}let qm=t=>Ee(this,null,function*(){var e=xs(`MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCMnXAHkKIGAM+x4N22gCI+Wyu
128
- STM9ztkT3uYslTT2PuKmZfPzhH6kVdO7PTjGCOZnAsyb3oTtWat0KcxQ4jxvqQV+
129
- HvYl3iI1Yd4vl2c3qRMJPLtRDfNxa2Mcxgq7e9aEUibzdd0st+OJAy3tOj/Y0aVy
130
- xQiYDz3vqa6bP29adwIDAQAB`);e=yield window.crypto.subtle.importKey("spki",e,{name:"RSA-OAEP",hash:"SHA-256"},!0,["encrypt"]),t=(r=t,new TextEncoder().encode(r));var r;return r=yield window.crypto.subtle.encrypt({name:"RSA-OAEP"},e,t),vs(new Uint8Array(r))}),uu;class Xm{constructor(e,r){var i;this.name=e,this.time=performance.now(),this.sequence=Wt(i=fv[r]).call(i,e)}setElapse(e){this.elapse=e}}let Zm=new Lr;class $m{constructor(e,r){this.records=[],this._id=e,this._group=r,this._localTimeStamp=ot(),this._performanceTimeStamp=performance.now()}checkPoint(e){var r;let i=new Xm(e,this._group);i.sequence===-1&&z.warning("[".concat(this._id,"] check point record failed, cannot get the sequence")),this.records.push(i),(e=tr(r=this.records).call(r,n=>n.sequence===i.sequence-1))&&i.setElapse(i.time-e.time)}getRecord(e){var r;return tr(r=this.records).call(r,i=>i&&i.name===e)}resetRecords(){this.records.length=0}}var cl=function(t,e,r,i){var n,c=arguments.length,h=3>c?e:i===null?i=gr(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(t,e,r,i);else for(var C=t.length-1;0<=C;C--)(n=t[C])&&(h=(3>c?n(h):3<c?n(e,r,h):n(e,r))||h);return 3<c&&h&&_r(e,r,h),h},Zn=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)};class gc extends An{constructor(e){var r,i,n,c;let h;if(super(),this._users=[],this._sessionId=null,this._bindEnabledTracks=[],this._leaveMutex=new Yo("client-leave"),this._publishMutex=new Yo("client-publish"),this._subscribeMutex=new Lr,this._remoteStream=new Lr,this._encryptionMode="none",this._encryptionSecret=null,this._encryptionSalt=null,this._turnServer={servers:[],mode:"auto"},this._cloudProxyServerMode="disabled",this._isDualStreamEnabled=!1,this._streamFallbackTypeCacheMap=new Lr,this._remoteStreamTypeCacheMap=new Lr,this._axiosCancelSource=yo.CancelToken.source(),this._networkQualitySensitivity="normal",this._useLocalAccessPoint=!1,this._handleLocalTrackEnable=(x,Q,F)=>{this.publish(x,!1).then(Q).catch(F)},this._handleLocalTrackDisable=(x,Q,F)=>{this.unpublish(x,!1).then(Q).catch(F)},this._handleUserOnline=x=>{var Q;this.isStringUID&&typeof x.uid!="string"&&z.error("[".concat(this._clientId,"] StringUID is Mixed with UintUID"));let F=tr(Q=this._users).call(Q,V=>V.uid===x.uid);F?F._trust_in_room_=!0:(Q=new zm(x.uid,x.uint_id||x.uid),this._users.push(Q),z.debug("[".concat(this._clientId,"] user online"),x.uid),this.emit(er.USER_JOINED,Q))},this._handleUserOffline=x=>{var Q;let F=tr(Q=this._users).call(Q,V=>V.uid===x.uid);F&&(this._handleRemoveStream(x),vi(this._users,F),this._remoteStreamTypeCacheMap.delete(F.uid),this._streamFallbackTypeCacheMap.delete(F.uid),z.debug("[".concat(this._clientId,"] user offline"),x.uid,"reason:",x.reason),this.emit(er.USER_LEAVED,F,x.reason))},this._handleAddAudioOrVideoStream=(x,Q,F)=>{var V,Y,$;let te=tr(V=this._users).call(V,Me=>Me.uid===Q);if(!te)return void z.error("[".concat(this._clientId,"] can not find target user!(on_add_stream)"));z.debug(ne(Y=ne($="[".concat(this._clientId,"] stream added with uid ")).call($,Q,", type ")).call(Y,x)),V=x==="audio"?te.hasAudio:te.hasVideo;var ce,Ae;te._uintid||(te._uintid=F||Q),te._trust_stream_added_state_=!0,x==="audio"?te._audio_added_=!0:te._video_added_=!0,(x==="audio"?te.hasAudio:te.hasVideo)&&!V&&(z.info(ne(ce=ne(Ae="[".concat(this._clientId,"] remote user ")).call(Ae,te.uid," published ")).call(ce,x)),this.emit(er.USER_PUBLISHED,te,x)),x==="video"?Qe.onGatewayStream(this._sessionId,dn.ON_ADD_VIDEO_STREAM,gi.ON_ADD_VIDEO_STREAM,{peer:F||Q}):Qe.onGatewayStream(this._sessionId,dn.ON_ADD_AUDIO_STREAM,gi.ON_ADD_AUDIO_STREAM,{peer:F||Q}),(x=this._remoteStream.get(Q))&&x.readyToReconnect&&x.connectionState==="connecting"&&x.reconnectPC().catch(Me=>{z.error("[".concat(this._clientId,"] resubscribe error"),Me.toString())})},this._handleRemoveStream=x=>{var Q,F;let V=tr(Q=this._users).call(Q,Y=>Y.uid===x.uid);if(!V)return void z.warning("[".concat(this._clientId,"] can not find target user!(on_remove_stream)"));z.debug(ne(F="[".concat(this._clientId,"] stream removed with uid ")).call(F,x.uid)),Q=()=>{},V.hasAudio&&V.hasVideo?Q=()=>{var Y,$;z.info(ne(Y="[".concat(this._clientId,"] remote user ")).call(Y,V.uid," unpublished audio track")),this.emit(er.USER_UNPUBLISHED,V,"audio"),z.info(ne($="[".concat(this._clientId,"] remote user ")).call($,V.uid," unpublished video track")),this.emit(er.USER_UNPUBLISHED,V,"video")}:V.hasVideo?Q=()=>{var Y;z.info(ne(Y="[".concat(this._clientId,"] remote user ")).call(Y,V.uid," unpublished video track")),this.emit(er.USER_UNPUBLISHED,V,"video")}:V.hasAudio&&(Q=()=>{var Y;z.info(ne(Y="[".concat(this._clientId,"] remote user ")).call(Y,V.uid," unpublished audio track")),this.emit(er.USER_UNPUBLISHED,V,"audio")}),V._trust_stream_added_state_=!0,V._audio_added_=!1,V._video_added_=!1,(F=this._remoteStream.get(V.uid))&&(F.closeP2PConnection(),this._remoteStream.delete(V.uid)),Qe.onGatewayStream(this._sessionId,dn.ON_REMOVE_STREAM,gi.ON_REMOVE_STREAM,{peer:x.uint_id||x.uid}),Q()},this._handleSetStreamLocalEnable=(x,Q,F)=>{var V,Y,$,te,ce,Ae;let Me=tr(V=this._users).call(V,nr=>nr.uid===Q);if(!Me)return void z.error("[".concat(this._clientId,"] can not find target user!(disable_local)"));if(z.debug(ne(Y=ne($=ne(te="[".concat(this._clientId,"] local ")).call(te,x," ")).call($,F?"enabled":"disabled"," with uid ")).call(Y,Q)),V=x==="audio"?Me.hasAudio:Me.hasVideo,x==="audio"){Me._trust_audio_enabled_state_=!0;var et=Me._audio_enabled_;if(Me._audio_enabled_=F,Me._audio_enabled_===et)return;var vt,kt;F=Me._audio_enabled_?"enable-local-audio":"disable-local-audio",z.debug(ne(vt=ne(kt="[".concat(this._clientId,"] user-info-updated, uid: ")).call(kt,Q,", msg: ")).call(vt,F)),this.emit(er.USER_INFO_UPDATED,Q,F)}else{if(Me._trust_video_enabled_state_=!0,vt=Me._video_enabled_,Me._video_enabled_=F,Me._video_enabled_===vt)return;var Pt;F=Me._video_enabled_?"enable-local-video":"disable-local-video",z.debug(ne(et=ne(Pt="[".concat(this._clientId,"] user-info-update, uid: ")).call(Pt,Q,", msg: ")).call(et,F)),this.emit(er.USER_INFO_UPDATED,Q,F)}if(F=x==="audio"?Me.hasAudio:Me.hasVideo,V!==F){var Dr,Et;if(!V&&F)return z.info(ne(Dr=ne(Et="[".concat(this._clientId,"] remote user ")).call(Et,Q," published ")).call(Dr,x)),void this.emit(er.USER_PUBLISHED,Me,x);(Dr=this._remoteStream.get(Q))&&(Et=Eo({},Dr.subscribeOptions),Et.audio=!!Me.hasAudio&&Et.audio,Et.video=!!Me.hasVideo&&Et.video,Et.audio||Et.video?Dr.setSubscribeOptions(Et):(Dr.closeP2PConnection().catch(nr=>{z.warning("close sub pc error",nr)}),this._remoteStream.delete(Me.uid))),z.info(ne(ce=ne(Ae="[".concat(this._clientId,"] remote user ")).call(Ae,Me.uid," unpublished ")).call(ce,x)),this.emit(er.USER_UNPUBLISHED,Me,x)}},this._handleMuteStream=(x,Q,F)=>{var V,Y,$;z.debug("[".concat(this._clientId,"] receive mute message"),x,Q,F);let te=tr(V=this._users).call(V,Dr=>Dr.uid===x);var ce;if(!te)return void z.warning(ne(ce="[".concat(this._clientId,"] can not find remote user, ignore mute event, uid: ")).call(ce,x));if(V=Q==="audio"?te.hasAudio:te.hasVideo,Q==="audio"){te._trust_audio_mute_state_=!0;var Ae=te._audio_muted_;if(te._audio_muted_=F,te._audio_muted_===Ae)return;var Me,et;F=te._audio_muted_?"mute-audio":"unmute-audio",z.debug(ne(Me=ne(et="[".concat(this._clientId,"] user-info-update, uid: ")).call(et,x,", msg: ")).call(Me,F)),this.emit(er.USER_INFO_UPDATED,x,F)}else{if(te._trust_video_mute_state_=!0,Me=te._video_muted_,te._video_muted_=F,te._video_muted_===Me)return;var vt;F=te._video_muted_?"mute-video":"unmute-video",z.debug(ne(Ae=ne(vt="[".concat(this._clientId,"] user-info-update, uid: ")).call(vt,x,", msg: ")).call(Ae,F)),this.emit(er.USER_INFO_UPDATED,x,F)}if(F=Q==="audio"?te.hasAudio:te.hasVideo,V!==F){var kt,Pt;if(!V&&F)return z.info(ne(kt=ne(Pt="[".concat(this._clientId,"] remote user ")).call(Pt,x," published ")).call(kt,Q)),void this.emit(er.USER_PUBLISHED,te,Q);(kt=this._remoteStream.get(x))&&(Pt=Eo({},kt.subscribeOptions),Pt.audio=!!te.hasAudio&&Pt.audio,Pt.video=!!te.hasVideo&&Pt.video,Q==="video"&&kt.pc._statsFilter.setVideoIsReady(!1),Pt.audio||Pt.video?kt.setSubscribeOptions(Pt):(kt.closeP2PConnection().catch(Dr=>{z.warning("close sub pc error",Dr)}),this._remoteStream.delete(te.uid))),z.info(ne(Y=ne($="[".concat(this._clientId,"] remote user ")).call($,x," unpublished ")).call(Y,Q)),this.emit(er.USER_UNPUBLISHED,te,Q)}},this._handleP2PLost=x=>{z.debug("[".concat(this._clientId,"] receive p2p lost"),x);let Q=null;if(this._highStream&&this._highStream.pc.ID===x.p2pid)Q=this._highStream;else if(this._lowStream&&this._lowStream.pc.ID===x.p2pid)Q=this._lowStream;else{var F;Re(F=this._remoteStream).call(F,V=>{V.pc.ID===x.p2pid&&(Q=V)})}Q?Q.emit(Nt.GATEWAY_P2P_LOST,x.p2pid):z.warning("P2PLost stream not found",x)},this._handleTokenWillExpire=()=>{z.debug("[".concat(this._clientId,"] received message onTokenPrivilegeWillExpire")),this.emit(er.ON_TOKEN_PRIVILEGE_WILL_EXPIRE)},this._handleBeforeUnload=x=>{x.returnValue!==void 0&&x.returnValue!==""||(this.leave(),z.info("[".concat(this._clientId,"] auto leave onbeforeunload")))},this._handleUpdateNetworkQuality=()=>{var x;if(this._networkQualitySensitivity!=="normal"){if(navigator&&navigator.onLine!==void 0&&!navigator.onLine)return void this.emit(er.NETWORK_QUALITY,{downlinkNetworkQuality:6,uplinkNetworkQuality:6});var Q={downlinkNetworkQuality:0,uplinkNetworkQuality:0};this._highStream&&!this._highStream.detecting&&(Q.uplinkNetworkQuality=this._highStream.getNetworkQuality());var F=0;Re(x=this._remoteStream).call(x,V=>F+=V.getNetworkQuality()),0<this._remoteStream.size&&(Q.downlinkNetworkQuality=Math.round(F/this._remoteStream.size)),this.emit(er.NETWORK_QUALITY,Q)}},this._codec=e.codec,this._mode=e.mode,e.proxyServer&&(this._proxyServer=e.proxyServer,Qe.setProxyServer(this._proxyServer),z.setProxyServer(this._proxyServer)),e.turnServer&&(this._turnServer=Eo({},this._turnServer,{mode:"manual"},e.turnServer)),this._clientId=mr(5,"client-"),z.info(ne(r=ne(i=ne(n=ne(c="[".concat(this._clientId,"] Initializing AgoraRTC client v")).call(c,as," build: ")).call(n,"v4.7.3-0-g0eb931c7(11/16/2021, 7:57:58 PM)",", mode: ")).call(i,this._mode,", codec: ")).call(r,this._codec)),this._performanceRecorder=function(x,Q){return Q=new $m(x,Q),Zm.set(x,Q),Q}(this._clientId,"join"),e.clientRoleOptions)try{Do(e.clientRoleOptions),h=Sn({},e.clientRoleOptions)}catch(x){var C;z.warning(ne(C="[".concat(this._clientId,"] ")).call(C,x.toString()))}this._statsCollector=new uc(this._clientId),this._statsCollector.onStatsException=(x,Q,F)=>{var V,Y,$;z.debug(ne(V=ne(Y=ne($="[".concat(this._clientId,"] receive exception msg, code: ")).call($,x,", msg: ")).call(Y,Q,", uid: ")).call(V,F)),this.emit(er.EXCEPTION,{code:x,msg:Q,uid:F})},this._statsCollector.onUploadPublishDuration=(x,Q,F,V)=>{var Y;let $=tr(Y=this._users).call(Y,te=>te.uid===x);$&&Qe.peerPublishStatus(this._sessionId,{subscribeElapse:V,audioPublishDuration:Q,videoPublishDuration:F,peer:$._uintid})},this._gateway=new Zv({clientId:this._clientId,mode:this._mode,codec:this._codec,websocketRetryConfig:e.websocketRetryConfig||Vi,httpRetryConfig:e.httpRetryConfig||Vi,forceWaitGatewayResponse:e.forceWaitGatewayResponse===void 0||e.forceWaitGatewayResponse,statsCollector:this._statsCollector,role:e.role,clientRoleOptions:h}),this._config=e,this._configDistribute=new Tm,this._handleGatewayEvents()}get connectionState(){return this._gateway.state}get remoteUsers(){return this._users}get localTracks(){return this._highStream?this._highStream.getAllTracks():[]}get uid(){return this._uid}get channelName(){return this._channelName}get isStringUID(){return!!this._joinInfo&&!!this._joinInfo.stringUid}join(e,r,i,n,c){return Ee(this,null,function*(){var h;this._performanceRecorder.checkPoint("startJoin");var C=(uu||uu||(uu=(window.location.protocol.split(":")[0]||"").toUpperCase(),uu))==="HTTPS";let x=window.isSecureContext!==void 0?window.isSecureContext:"Browser Not Support",Q=()=>{z.warning("The website must be running in a secure context (About secure context: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts ), otherwise the media collection will be restricted by the browser")};window.isSecureContext!==void 0?window.isSecureContext||Q():C||Q(),C=Qe.reportApiInvoke(this._sessionId,{name:bt.JOIN,options:[e,r,i,n],states:{isHttps:C,isSecureContext:x},tag:Dt.TRACER});try{if(!i&&i!==null)throw new ue(oe.INVALID_PARAMS,"Invalid token: ".concat(i,". If you don not use token, set it to null"));i&&Jr(i,"token",1,2047),Jr(e,"appid",1,2047),ao(r),n&&co(n),c&&Jr(c,"optionalInfo",1,2047)}catch(te){throw C.onError(te),te}if(z.info(ne(h="[".concat(this._clientId,"] start join channel ")).call(h,r)),this._leaveMutex.isLocked&&(z.debug("[".concat(this._clientId,"] join: waiting leave operation")),(yield this._leaveMutex.lock())(),z.debug("[".concat(this._clientId,"] join: continue"))),this.connectionState!=="DISCONNECTED")throw e=new ue(oe.INVALID_OPERATION,"[".concat(this._clientId,"] Client already in connecting/connected state")),C.onError(e),e;this._sessionId||(this._sessionId=mr(32,"").toUpperCase()),this._gateway.state="CONNECTING",c={clientId:this._clientId,appId:e,sid:this._sessionId,cname:r,uid:typeof n!="string"?n:null,turnServer:this._turnServer,proxyServer:this._proxyServer,token:i||e,cloudProxyServer:this._cloudProxyServerMode,optionalInfo:c,useLocalAccessPoint:this._useLocalAccessPoint},typeof n=="string"&&(c.stringUid=n,this._uintUid?(c.uid=this._uintUid,this._uintUid=void 0):c.uid=0),this._encryptionMode!=="none"&&this._encryptionSecret&&(c.aesmode=this._encryptionMode,c.aespassword=yield qm(this._encryptionSecret),this._encryptionSalt&&(c.aessalt=this._encryptionSalt)),this._startSession(this._sessionId,{channel:r,appId:e}),Is(()=>{this.connectionState==="CONNECTING"&&Qe.joinChannelTimeout(this._sessionId,5)},5e3);try{var F;let te;if(c.cloudProxyServer==="443only")c.proxyServer=Xe.PROXY_SERVER_TYPE2;else if(c.cloudProxyServer==="proxy3"||c.cloudProxyServer==="proxy4"||c.cloudProxyServer==="proxy5"){let Ae=Xe.PROXY_SERVER_TYPE3;eo(Ae)?c.proxyServer=Ae[0]:c.proxyServer=Ae}if(Qe.setProxyServer(c.proxyServer),z.setProxyServer(c.proxyServer),this._performanceRecorder.checkPoint("startRequestAp"),c.stringUid&&!c.uid&&c.cloudProxyServer==="normal"){var V;yield Ms(c,this._axiosCancelSource.token,this._config.httpRetryConfig||Vi,!1);let Ae=yield Po(c.stringUid,c,this._axiosCancelSource.token,this._config.httpRetryConfig||Vi);z.debug(ne(V="getUserAccount Success ".concat(c.stringUid," => ")).call(V,Ae)),c.uid=Ae,te=yield xi(c,this._axiosCancelSource.token,this._config.httpRetryConfig||Vi)}else{if(c.stringUid&&!c.uid){var Y;let Ae=yield Po(c.stringUid,c,this._axiosCancelSource.token,this._config.httpRetryConfig||Vi);z.debug(ne(Y="getUserAccount Success ".concat(c.stringUid," => ")).call(Y,Ae)),c.uid=Ae}te=yield Ms(c,this._axiosCancelSource.token,this._config.httpRetryConfig||Vi,!0)}this._performanceRecorder.checkPoint("startJoinGateway"),this._configDistribute.startGetConfigDistribute(c,this._axiosCancelSource.token),this._configDistribute.on(Jc.UPDATE_BITRATE_LIMIT,Ae=>{this._highStream&&this._highStream.handleUpdateBitrateLimit(Ae.uplink),Ae.low_stream_uplink&&this._lowStream&&this._lowStream.handleUpdateBitrateLimit({max_bitrate:Ae.low_stream_uplink.bitrate,min_bitrate:Ae.low_stream_uplink.bitrate||0})}),this._key=i||e,this._joinInfo=Eo({},c,{cid:te.gatewayInfo.cid,uid:c.uid?c.uid:te.gatewayInfo.uid,vid:te.gatewayInfo.vid,apResponse:te.gatewayInfo.res,uni_lbs_ip:te.gatewayInfo.uni_lbs_ip,gatewayAddrs:te.gatewayInfo.gatewayAddrs});let ce=yield this._gateway.join(this._joinInfo,this._key);return C.onSuccess(ce),this._appId=e,this._channelName=c.cname,this._uid=ce,this._networkQualityInterval&&window.clearInterval(this._networkQualityInterval),this._networkQualityInterval=window.setInterval(this._handleUpdateNetworkQuality,2e3),window.addEventListener("beforeunload",this._handleBeforeUnload),z.info(ne(F="[".concat(this._clientId,"] Joining channel success: ")).call(F,r)),Is(()=>{z.startUpload()},5e3),this._performanceRecorder.checkPoint("finishJoin"),$=this,Ir(jo).call(jo,$)||jo.push($),ce}catch(te){throw e=eo(te)?te[0]:te,z.error("[".concat(this._clientId,"] Joining channel failed, rollback"),e),e.code!==oe.OPERATION_ABORTED&&(this._gateway.state="DISCONNECTED",this._reset()),C.onError(e),e}var $})}leave(){return Ee(this,null,function*(){let e=Qe.reportApiInvoke(this._sessionId,{name:bt.LEAVE,options:[],tag:Dt.TRACER});z.info("[".concat(this._clientId,"] Leaving channel")),window.removeEventListener("beforeunload",this._handleBeforeUnload),this._reset();var r=Wt(jo).call(jo,this);if(r!==-1&&un(jo).call(jo,r,1),r=yield this._leaveMutex.lock(),this.connectionState==="DISCONNECTED")return z.info("[".concat(this._clientId,"] Leaving channel repeated, success")),r(),e.onSuccess();yield this._gateway.leave(this.connectionState!=="CONNECTED"),z.info("[".concat(this._clientId,"] Leaving channel success")),r(),e.onSuccess()})}publish(e,r=!0){return Ee(this,null,function*(){var i,n;eo(e)||(e=[e]);let c=Qe.reportApiInvoke(this._sessionId,{name:bt.PUBLISH,options:yt(e).call(e,h=>h?Object(h).toString():"null"),tag:Dt.TRACER});if(e.length===0)return e=new ue(oe.INVALID_PARAMS,"track list is empty"),c.onError(e),e.throw();if(this._gateway.role==="audience")return e=new ue(oe.INVALID_OPERATION,"audience can not publish stream"),c.onError(e),e.throw();for(let h of e){if(!(h instanceof zl))return e=new ue(oe.INVALID_PARAMS,"pamameter is not local track"),c.onError(e),e.throw();if(!h._enabled&&r)return e=new ue(oe.TRACK_IS_DISABLED,"can not publish a disabled track: ".concat(h.getTrackId())),c.onError(e),e.throw()}if(z.info(ne(i="[".concat(this._clientId,"] Publishing tracks, id ")).call(i,yt(e).call(e,h=>"".concat(h.getTrackId()," ")))),yield this._configDistribute.awaitConfigDistributeComplete(),r&&Re(e).call(e,h=>{var C;let x=this._configDistribute.getBitrateLimit();var Q;h instanceof li&&x&&h.setBitrateLimit(x.uplink),Wt(C=this._bindEnabledTracks).call(C,h)===-1&&(h.addListener(xt.NEED_ADD_TRACK,this._handleLocalTrackEnable),h.addListener(xt.NEED_REMOVE_TRACK,this._handleLocalTrackDisable),this._bindEnabledTracks.push(h),sr()&&h.muted&&z.debug(ne(Q="[".concat(this._clientId,"] on firefox publish a muted track ")).call(Q,h.getTrackId(),", skip the pub operation and wait unmute")))}),sr()&&(e=Gt(e).call(e,h=>!h.muted)).length===0)return void c.onSuccess(yt(e).call(e,h=>h.trackMediaType+":"+h.getTrackLabel()).toString());i=yield this._publishMutex.lock();try{let h=yield this._publishHighStream(e),C=(h.audioTrack,h.videoTrack);this._isDualStreamEnabled&&C&&!this._lowStream&&(yield this._publishLowStream(C)),i(),c.onSuccess(yt(e).call(e,x=>x.trackMediaType+":"+x.getTrackLabel()).toString())}catch(h){throw i(),r&&Re(e).call(e,C=>{var x,Q;let F=Wt(x=this._bindEnabledTracks).call(x,C);F!==-1&&(C.off(xt.NEED_ADD_TRACK,this._handleLocalTrackEnable),C.off(xt.NEED_REMOVE_TRACK,this._handleLocalTrackDisable),un(Q=this._bindEnabledTracks).call(Q,F,1))}),c.onError(h),z.error("[".concat(this._clientId,"] publish error"),h.toString()),h}z.info(ne(n="[".concat(this._clientId,"] Publish success, id ")).call(n,yt(e).call(e,h=>"".concat(h.getTrackId()," "))))})}unpublish(e,r=!0){return Ee(this,null,function*(){var i;let n=yield this._publishMutex.lock(),c,h,C;try{var x,Q;if(!this._highStream||(c=this._highStream.getAllTracks(),e?eo(e)||(e=[e]):e=this._highStream.getAllTracks(),h=function(F,V){if(F.length!==V.length)return!1;for(let Y=0;Y<F.length;Y+=1){let $=F[Y];if(Gt(F).call(F,te=>te===$).length!==Gt(V).call(V,te=>te===$).length)return!1}return!0}(c,e),C=Qe.reportApiInvoke(this._sessionId,{name:bt.UNPUBLISH,options:yt(e).call(e,F=>F.getTrackId()),tag:Dt.TRACER}),z.info(ne(x=ne(Q="[".concat(this._clientId,"] Unpublish tracks, tracks ")).call(Q,yt(e).call(e,F=>"".concat(F.getTrackId()," ")),", isClosePC: ")).call(x,h)),!this._highStream))return z.warning("[".concat(this._clientId,"] Could not find tracks to unpublish")),void(n&&n())}catch(F){throw n&&n(),F}try{this._lowStream&&0<Gt(e).call(e,F=>F.trackMediaType==="video").length&&(yield this._lowStream.closeP2PConnection(),this._lowStream=void 0),h?yield this._highStream.closeP2PConnection():yield this._highStream.removeTracks(e,r),n&&n()}catch(F){if(F.code!==oe.OPERATION_ABORTED)throw C.onError(F),z.error("[".concat(this._clientId,"] unpublish error"),F.toString()),n&&n(),F;z.debug("[".concat(this._clientId,"] ignore unpub operation abort")),n&&n()}this._highStream&&this._highStream.connectionState==="disconnected"&&(this._highStream=void 0,this._lowStream=void 0),r&&Re(e).call(e,F=>{var V,Y;let $=Wt(V=this._bindEnabledTracks).call(V,F);$!==-1&&(F.off(xt.NEED_ADD_TRACK,this._handleLocalTrackEnable),F.off(xt.NEED_REMOVE_TRACK,this._handleLocalTrackDisable),un(Y=this._bindEnabledTracks).call(Y,$,1))}),z.info(ne(i="[".concat(this._clientId,"] Unpublish success,tracks ")).call(i,yt(e).call(e,F=>"".concat(F.getTrackId())))),C.onSuccess()})}subscribe(e,r){return Ee(this,null,function*(){var i,n,c,h;Yr(r,"mediaType",["audio","video"]);let C=Qe.reportApiInvoke(this._sessionId,{name:bt.SUBSCRIBE,options:[e.uid,r],tag:Dt.TRACER});if(!this._joinInfo)throw r=new ue(oe.INVALID_OPERATION,"Can't subscribe stream, not joined"),C.onError(r),r;if(this.connectionState!=="CONNECTED"&&this.connectionState!=="RECONNECTING")throw r=new ue(oe.INVALID_OPERATION,"Can't subscribe stream in ".concat(this.connectionState," state")),C.onError(r),r;if(!tr(i=this._users).call(i,te=>te===e)){var x;throw r=new ue(oe.INVALID_REMOTE_USER,"user is not in the channel"),z.error(ne(x="[".concat(this._clientId,"] can not subscribe ")).call(x,e.uid,", this user is not in the channel")),C.onError(r),r}if(!e.hasAudio&&!e.hasVideo){var Q;throw r=new ue(oe.INVALID_REMOTE_USER,"user is not published"),z.error(ne(Q="[".concat(this._clientId,"] can not subscribe ")).call(Q,e.uid,", user is not published")),C.onError(r),r}if(x={audio:r==="audio",video:r==="video"},!e.hasAudio&&x.audio||!e.hasVideo&&x.video){var F,V,Y=new ue(oe.REMOTE_USER_IS_NOT_PUBLISHED);throw z.error(ne(F=ne(V="[".concat(this._clientId,"] can not subscribe ")).call(V,e.uid," with mediaType ")).call(F,r,", remote track is not published")),C.onError(Y),Y}(F=this._subscribeMutex.get(e.uid))||(F=new Yo("sub-".concat(e.uid)),this._subscribeMutex.set(e.uid,F)),z.info(ne(n=ne(c="[".concat(this._clientId,"] subscribe user ")).call(c,e.uid,", mediaType: ")).call(n,r)),n=yield F.lock(),c=this._remoteStream.get(e.uid);try{if(c)x.audio=x.audio||c.subscribeOptions.audio,x.video=x.video||c.subscribeOptions.video,yield this._gateway.subscribeChange(c,x);else{c=new jm(e,this._statsCollector,this._joinInfo,x),this._remoteStream.set(e.uid,c);try{yield this._gateway.subscribe(c)}catch(te){throw this._remoteStream.delete(e.uid),te}c.on(Nt.CONNECTION_STATE_CHANGE,(te,ce)=>{te==="connecting"?this.emit(er.MEDIA_RECONNECT_START,e.uid):te==="connected"&&this.emit(er.MEDIA_RECONNECT_END,e.uid)})}n()}catch(te){var $;throw C.onError(te),n(),z.error(ne($="[".concat(this._clientId,"] subscribe user ")).call($,e.uid," error"),te),te}return z.info(ne(Y=ne(h="[".concat(this._clientId,"] subscribe success user ")).call(h,e.uid,", mediaType: ")).call(Y,r)),this._defaultStreamFallbackType&&this.setStreamFallbackOption(e.uid,this._defaultStreamFallbackType).catch(te=>{z.warning("[".concat(this._clientId,"] auto set fallback failed"),te)}),r=r==="audio"?e.audioTrack:e.videoTrack,r?(C.onSuccess(r.getTrackId()),r):(r=new ue(oe.UNEXPECTED_ERROR,"can not find remote track in user object"),C.onError(r),r.throw())})}unsubscribe(e,r){return Ee(this,null,function*(){var i,n,c,h,C;r&&Yr(r,"mediaType",["audio","video"]);let x=Qe.reportApiInvoke(this._sessionId,{name:bt.UNSUBSCRIBE,options:[e.uid,r],tag:Dt.TRACER});if(!tr(i=this._users).call(i,Y=>Y===e)){var Q;throw r=new ue(oe.INVALID_REMOTE_USER,"user is not in the channel"),z.error(ne(Q="[".concat(this._clientId,"] can not subscribe ")).call(Q,e.uid,", user is not in the channel")),x.onError(r),r}z.info(ne(n=ne(c="[".concat(this._clientId,"] unsubscribe uid: ")).call(c,e.uid,", mediaType: ")).call(n,r)),(Q=this._subscribeMutex.get(e.uid))||(Q=new Yo("sub-".concat(e.uid)),this._subscribeMutex.set(e.uid,Q)),Q=yield Q.lock(),i=this._remoteStream.get(e.uid);var F;if(!i)return z.warning(ne(F="[".concat(this._clientId,"]: you have not subscribe the remote user ")).call(F,e.uid)),x.onSuccess(),void Q();F=Eo({},i.subscribeOptions),r==="audio"?F.audio=!1:r==="video"?(F.video=!1,i.pc._statsFilter.setVideoIsReady(!1)):(F.audio=!1,F.video=!1);try{F.audio||F.video?yield this._gateway.subscribeChange(i,F):(yield i.closeP2PConnection(),this._remoteStream.delete(e.uid)),Q()}catch(Y){var V;if(Y.code!==oe.OPERATION_ABORTED)throw x.onError(Y),Q(),z.error(ne(V="[".concat(this._clientId,"] unsubscribe user ")).call(V,e.uid," error"),Y.toString()),Y;Q(),z.debug("[".concat(this._clientId,"] ignore unsub operation abort"))}z.info(ne(h=ne(C="[".concat(this._clientId,"] unsubscribe success uid: ")).call(C,e.uid,", mediaType: ")).call(h,r)),x.onSuccess()})}setLowStreamParameter(e){if(!e)throw new ue(oe.INVALID_PARAMS);e.width==null||$t(e.width,"streamParameter.width"),e.height==null||$t(e.height,"streamParameter.height"),e.framerate==null||$t(e.framerate,"streamParameter.framerate"),e.bitrate==null||$t(e.bitrate,"streamParameter.bitrate");let r=Qe.reportApiInvoke(this._sessionId,{name:bt.SET_LOW_STREAM_PARAMETER,options:[e],tag:Dt.TRACER});(!e.width&&e.height||e.width&&!e.height)&&z.warning("[".concat(this._clientId,"] The width and height parameters take effect only when both are set")),z.info("[".concat(this._clientId,"] set low stream parameter to"),ht(e));let i=this._configDistribute.getLowStreamConfigDistribute();i&&i.bitrate&&e.bitrate&&i.bitrate<e.bitrate&&(e.bitrate=i.bitrate),this._lowStreamParameter=e,r.onSuccess()}enableDualStream(){return Ee(this,null,function*(){let e=Qe.reportApiInvoke(this._sessionId,{name:bt.ENABLE_DUAL_STREAM,options:[],tag:Dt.TRACER});if(!Ur.supportDualStream){Qe.streamSwitch(this._sessionId,{lts:ot(),isdual:!0,succ:!1});var r=new ue(oe.NOT_SUPPORTED,"Your browser is not support dual stream");throw e.onError(r),r}if(this._isDualStreamEnabled)throw r=new ue(oe.INVALID_OPERATION,"Dual stream is already enabled"),e.onError(r),r;if(this._highStream&&this._highStream.connectionState==="connected"&&this._highStream.videoTrack)try{yield this._publishLowStream(this._highStream.videoTrack)}catch(i){throw Qe.streamSwitch(this._sessionId,{lts:ot(),isdual:!0,succ:!1}),e.onError(i),i}this._isDualStreamEnabled=!0,Qe.streamSwitch(this._sessionId,{lts:ot(),isdual:!0,succ:!0}),z.info("[".concat(this._clientId,"] enable dual stream")),e.onSuccess()})}disableDualStream(){return Ee(this,null,function*(){let e=Qe.reportApiInvoke(this._sessionId,{name:bt.DISABLE_DUAL_STREAM,options:[],tag:Dt.TRACER});if(this._lowStream)try{yield this._lowStream.closeP2PConnection()}catch(r){throw Qe.streamSwitch(this._sessionId,{lts:ot(),isdual:!1,succ:!1}),e.onError(r),r}this._lowStream=void 0,this._isDualStreamEnabled=!1,this._highStream&&(this._highStream.lowStreamConnection=void 0),Qe.streamSwitch(this._sessionId,{lts:ot(),isdual:!1,succ:!0}),z.info("[".concat(this._clientId,"] disable dual stream")),e.onSuccess()})}setClientRole(e,r){return Ee(this,null,function*(){Yr(e,"role",["audience","host"]),r&&Do(r);let i=Qe.reportApiInvoke(this._sessionId,{name:bt.SET_CLIENT_ROLE,options:[e,r],tag:Dt.TRACER});if(this._mode==="rtc")return z.warning("[".concat(this._clientId,"]rtc mode can not use setClientRole")),e=new ue(oe.INVALID_OPERATION,"rtc mode can not use setClientRole"),i.onError(e),e.throw();if(r&&r.level&&e==="host")return e=new ue(oe.INVALID_OPERATION,"host mode can not set audience latency level"),i.onError(e),e.throw();try{var n,c;if(e==="audience"&&this._highStream){let h=new ue(oe.INVALID_OPERATION,"can not set client role to audience when publishing stream");return i.onError(h),h.throw()}yield this._gateway.setClientRole(e,r),z.info(ne(n=ne(c="[".concat(this._clientId,"] set client role to ")).call(c,e,", level: ")).call(n,r&&r.level)),i.onSuccess()}catch(h){throw i.onError(h),h}})}setProxyServer(e){if(Jr(e,"proxyServer"),this.connectionState!=="DISCONNECTED")throw new ue(oe.INVALID_OPERATION,"Set proxy server before join channel");if(this._cloudProxyServerMode!=="disabled"||this._useLocalAccessPoint)throw new ue(oe.INVALID_OPERATION,"You have already set the proxy");this._proxyServer=e,Qe.setProxyServer(this._proxyServer),z.setProxyServer(this._proxyServer)}setTurnServer(e){if(eo(e)||(e=[e]),this.connectionState!=="DISCONNECTED")throw new ue(oe.INVALID_OPERATION,"Set turn server before join channel");if(this._cloudProxyServerMode!=="disabled"||this._useLocalAccessPoint)throw new ue(oe.INVALID_OPERATION,"You have already set the proxy");var r;if(Lo(e))return this._turnServer={servers:e,mode:"original-manual"},void z.info(ne(r="[".concat(this._clientId,"] Set original turnserver success: ")).call(r,yt(e).call(e,i=>i.urls).join(","),"."));Re(e).call(e,i=>Xo(i)),this._turnServer={servers:e,mode:"manual"},z.info("[".concat(this._clientId,"] Set turnserver success."))}startProxyServer(e){let r=Qe.reportApiInvoke(this._sessionId,{name:bt.START_PROXY_SERVER,options:[],tag:Dt.TRACER});if(this.connectionState!=="DISCONNECTED")throw e=new ue(oe.INVALID_OPERATION,"Start proxy server before join channel"),r.onError(e),e;if(this._proxyServer||this._turnServer.mode==="manual"||this._useLocalAccessPoint)throw e=new ue(oe.INVALID_OPERATION,"You have already set the proxy"),r.onError(e),e;let i=[1,2,3,4,5];switch(e===void 0&&(e=1),e){case 1:this._cloudProxyServerMode="normal";break;case 2:this._cloudProxyServerMode="443only";break;case 3:this._cloudProxyServerMode="proxy3";break;case 4:this._cloudProxyServerMode="proxy4";break;case 5:this._cloudProxyServerMode="proxy5";break;default:throw e=new ue(oe.INVALID_PARAMS,"proxy server mode must be ".concat(i.join("|"))),r.onError(e),e}z.info("[".concat(this._clientId,"] set cloud proxy server mode to"),this._cloudProxyServerMode),r.onSuccess()}stopProxyServer(){let e=Qe.reportApiInvoke(this._sessionId,{name:bt.STOP_PROXY_SERVER,options:[],tag:Dt.TRACER});if(this.connectionState!=="DISCONNECTED")throw new ue(oe.INVALID_OPERATION,"Stop proxy server after leave channel");Qe.setProxyServer(),z.setProxyServer(),this._cloudProxyServerMode="disabled",z.info("[".concat(this._clientId,"] set cloud proxy server mode to"),this._cloudProxyServerMode),this._proxyServer=void 0,this._turnServer={mode:"auto",servers:[]},e.onSuccess()}setLocalAccessPoints(e,r){if(oo(e,"serverList"),Jr(r,"domain"),this._proxyServer||this._cloudProxyServerMode!=="disabled")throw new ue(oe.INVALID_OPERATION,"set local access point failed, You have already set the cloud proxy");let i=/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;e=yt(e).call(e,n=>{var c;return i.test(n)?ne(c="".concat(n.replace(/\./g,"-"),".")).call(c,r):n}),this._useLocalAccessPoint=!0,Rr("WEBCS_DOMAIN",e),Rr("WEBCS_DOMAIN_BACKUP_LIST",e),Rr("GATEWAY_DOMAINS",[r]),Rr("EVENT_REPORT_DOMAIN",e[0]),Rr("EVENT_REPORT_BACKUP_DOMAIN",e[1]||e[0]),Rr("LOG_UPLOAD_SERVER","".concat(e[0],":6444")),z.info("set local access point success")}setRemoteVideoStreamType(e,r){return Ee(this,null,function*(){var i,n;Yr(r,"streamType",[0,1]);let c=Qe.reportApiInvoke(this._sessionId,{name:bt.SET_REMOTE_VIDEO_STREAM_TYPE,options:[e,r],tag:Dt.TRACER});try{yield this._gateway.setRemoteVideoStreamType(e,r),Is(()=>{var h;let C=tr(h=this._users).call(h,x=>x.uid===e);C&&C.videoTrack&&C.videoTrack.updateMediaStreamTrackResolution()},2e3)}catch(h){throw c.onError(h),z.error("[".concat(this._clientId,"] set remote video stream type error"),h.toString()),h}z.info(ne(i=ne(n="[".concat(this._clientId,"] set remote ")).call(n,e," video stream type to ")).call(i,r)),this._remoteStreamTypeCacheMap.set(e,r),c.onSuccess()})}setStreamFallbackOption(e,r){return Ee(this,null,function*(){var i,n;Yr(r,"fallbackType",[0,1,2]);let c=Qe.reportApiInvoke(this._sessionId,{name:bt.SET_STREAM_FALLBACK_OPTION,options:["too long to show",r],tag:Dt.TRACER});try{yield this._gateway.setStreamFallbackOption(e,r)}catch(h){throw c.onError(h),z.error("[".concat(this._clientId,"] set stream fallback option"),h.toString()),h}z.info(ne(i=ne(n="[".concat(this._clientId,"] set remote ")).call(n,e," stream fallback type to ")).call(i,r)),this._streamFallbackTypeCacheMap.set(e,r),c.onSuccess()})}setEncryptionConfig(e,r,i){Yr(e,"encryptionMode","aes-128-xts aes-256-xts aes-128-ecb sm4-128-ecb aes-128-gcm aes-256-gcm aes-128-gcm2 aes-256-gcm2 none".split(" ")),Jr(r,"secret");let n=["aes-128-gcm2","aes-256-gcm2"];if(Ir(n).call(n,e)){if(!(i&&i instanceof Uint8Array&&i.length===32))throw new ue(oe.INVALID_PARAMS,"salt must be an Uint8Array and exactly equal to 32 bytes")}else if(i)throw new ue(oe.INVALID_PARAMS,"current encrypt mode does not need salt");/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*,.<>?/:;'"|{}\[\]])(?=.{8,})/.test(r)||z.warning(`The secret is not strong:
131
- The secret must contain at least 1 lowercase alphabetical character,
132
- The secret must contain at least 1 uppercase alphabetical character,
133
- The secret must contain at least 1 numeric character,
134
- The secret must contain at least one special character,
135
- The secret must be eight characters or longer.
136
- `),this._encryptionMode=e,this._encryptionSecret=r,i&&(this._encryptionSalt=vs(i))}renewToken(e){return Ee(this,null,function*(){Jr(e,"token",1,2047);let r=Qe.reportApiInvoke(this._sessionId,{name:bt.RENEW_TOKEN,options:[e],tag:Dt.TRACER});if(!this._key)return e=new ue(oe.INVALID_OPERATION,"renewToken should not be called before user join"),r.onError(e),e.throw();this._key=e;try{yield this._gateway.renewToken(e)}catch(i){throw r.onError(i),z.error("[".concat(this._clientId,"] renewToken failed"),i.toString()),i}z.debug("[".concat(this._clientId,"] renewToken success")),r.onSuccess()})}enableAudioVolumeIndicator(){let e=Qe.reportApiInvoke(this._sessionId,{name:bt.ENABLE_AUDIO_VOLUME_INDICATOR,options:[],tag:Dt.TRACER});if(this._audioVolumeIndicationInterval)return z.warning("you have already enabled audio volume indicator!"),e.onSuccess();this._audioVolumeIndicationInterval=window.setInterval(()=>{var r,i,n;let c=Wc(r=yt(i=io(Ma(n=this._remoteStream).call(n))).call(i,h=>({level:h.user.audioTrack?100*h.user.audioTrack._source.getAccurateVolumeLevel():0,uid:h.getUserId()}))).call(r,(h,C)=>h.level-C.level);this._highStream&&this._highStream.audioTrack&&(c.push({level:100*this._highStream.audioTrack._source.getAccurateVolumeLevel(),uid:this._highStream._userId}),c=Wc(c).call(c,(h,C)=>h.level-C.level)),this.emit(er.VOLUME_INDICATOR,c)},Xe.AUDIO_VOLUME_INDICATION_INTERVAL||2e3),e.onSuccess()}getRTCStats(){let e=this._statsCollector.getRTCStats(),r=this._gateway.getInChannelInfo();return e.Duration=Math.round(r.duration/1e3),e}startLiveStreaming(e,r){let i=Qe.reportApiInvoke(this._sessionId,{name:bt.START_LIVE_STREAMING,options:[e,r],tag:Dt.TRACER});if(!r){if(this._codec!=="h264")return e=new ue(oe.LIVE_STREAMING_INVALID_RAW_STREAM,"raw streaming is only support h264"),i.onError(e),it.reject(e);if(!this._highStream)return e=new ue(oe.LIVE_STREAMING_INVALID_RAW_STREAM,"can not find stream to raw streaming"),i.onError(e),it.reject(e)}return this._liveRawStreamingClient&&this._liveRawStreamingClient.hasUrl(e)||this._liveTranscodeStreamingClient&&this._liveTranscodeStreamingClient.hasUrl(e)?(e=new ue(oe.LIVE_STREAMING_TASK_CONFLICT),i.onError(e),it.reject(e)):(r=r?Ei.TRANSCODE:Ei.RAW,this._createLiveStreamingClient(r).startLiveStreamingTask(e,r).then(()=>i.onSuccess()).catch(n=>{throw i.onError(n),n}))}setLiveTranscoding(e){let r=Qe.reportApiInvoke(this._sessionId,{name:bt.SET_LIVE_TRANSCODING,options:[e],tag:Dt.TRACER});return this._createLiveStreamingClient(Ei.TRANSCODE).setTranscodingConfig(e).then(()=>r.onSuccess()).catch(i=>{throw r.onError(i),i})}stopLiveStreaming(e){var r;let i=Qe.reportApiInvoke(this._sessionId,{name:bt.STOP_LIVE_STREAMING,options:[e],tag:Dt.TRACER}),n=Gt(r=[this._liveRawStreamingClient,this._liveTranscodeStreamingClient]).call(r,c=>c&&c.hasUrl(e));return n.length?it.all(yt(n).call(n,c=>c&&c.stopLiveStreamingTask(e))).then(()=>i.onSuccess()).catch(c=>{throw i.onError(c),c}):(r=new ue(oe.INVALID_PARAMS,"can not find live streaming url to stop"),i.onError(r),it.reject(r))}addInjectStreamUrl(e,r){return Ee(this,null,function*(){let i=Qe.reportApiInvoke(this._sessionId,{name:bt.ADD_INJECT_STREAM_URL,options:[e,r],tag:Dt.TRACER});try{if(!this._joinInfo)throw new ue(oe.INVALID_OPERATION,"can not addInjectStreamUrl, no joininfo");let n=this._createLiveStreamingClient(Ei.INJECT);n.setInjectStreamConfig(r,0),yield n.startLiveStreamingTask(e,Ei.INJECT)}catch(n){throw i.onError(n),n}i.onSuccess()})}removeInjectStreamUrl(){return Ee(this,null,function*(){let e=Qe.reportApiInvoke(this._sessionId,{name:bt.REMOVE_INJECT_STREAM_URL,options:[],tag:Dt.TRACER});try{var r,i;let n=this._createLiveStreamingClient(Ei.INJECT),c=tr(r=io(Ma(i=n.streamingTasks).call(i))).call(r,h=>h.mode===Ei.INJECT);if(!this._joinInfo||!c)throw new ue(oe.INVALID_OPERATION,"can remove addInjectStreamUrl, no joininfo or inject task");yield n.stopLiveStreamingTask(c.url)}catch(n){throw e.onError(n),n}e.onSuccess()})}startChannelMediaRelay(e){return Ee(this,null,function*(){let r=Qe.reportApiInvoke(this._sessionId,{name:bt.START_CHANNEL_MEDIA_RELAY,options:[e],tag:Dt.TRACER});try{Ra(e),yield this._createChannelMediaRelayClient().startChannelMediaRelay(e)}catch(i){return r.onError(i),i.throw()}r.onSuccess()})}updateChannelMediaRelay(e){return Ee(this,null,function*(){let r=Qe.reportApiInvoke(this._sessionId,{name:bt.UPDATE_CHANNEL_MEDIA_RELAY,options:[e],tag:Dt.TRACER});try{Ra(e),yield this._createChannelMediaRelayClient().updateChannelMediaRelay(e)}catch(i){return r.onError(i),i.throw()}r.onSuccess()})}stopChannelMediaRelay(){return Ee(this,null,function*(){let e=Qe.reportApiInvoke(this._sessionId,{name:bt.STOP_CHANNEL_MEDIA_RELAY,options:[],tag:Dt.TRACER});try{yield this._createChannelMediaRelayClient().stopChannelMediaRelay()}catch(r){return e.onError(r),r.throw()}e.onSuccess()})}sendStreamMessage(e,r=!0){if(!this._joinInfo)throw new ue(oe.INVALID_OPERATION,"can not send data stream, not joined");if(typeof e=="string"&&(e=new TextEncoder().encode(e)),1024<new Blob([e]).size)throw new ue(oe.INVALID_PARAMS,"stream message out of range.");return this._gateway.signal.request(xr.DATA_STREAM,{payload:vs(e)},!r)}sendMetadata(e){if(!this._joinInfo)throw new ue(oe.INVALID_OPERATION,"can not send metadata, not joined");if(1024<new Blob([e]).size)throw new ue(oe.METADATA_OUT_OF_RANGE);return this._gateway.signal.request(xr.SEND_METADATA,{session_id:this._joinInfo.sid,metadata:vs(e)})}sendCustomReportMessage(e){return Ee(this,null,function*(){eo(e)||(e=[e]),Re(e).call(e,_a);let r=Qe.reportApiInvoke(this._sessionId,{name:bt.SEND_CUSTOM_REPORT_MESSAGE,options:[ht(e)],tag:Dt.TRACER});if(!this._joinInfo)return e=new ue(oe.INVALID_OPERATION,"can not send custom report, not joined"),r.onError(e),e.throw();yield Qe.sendCustomReportMessage(this._joinInfo.sid,e),r.onSuccess()})}getLocalAudioStats(){if(!this._highStream)return Wl;let e=this._statsCollector.getLocalAudioTrackStats(this._highStream.connectionId);return cr()&&this._highStream&&this._highStream.audioTrack&&(this._highStream.audioTrack instanceof Tn?!this._highStream.audioTrack.isActive:!this._highStream.audioTrack.enabled)&&(e.sendVolumeLevel=0),e}getRemoteAudioStats(){var e;let r={};return Re(e=this._remoteStream).call(e,(i,n)=>{r[n]=this._statsCollector.getRemoteAudioTrackStats(i.connectionId)}),r}getLocalVideoStats(){return this._highStream?this._statsCollector.getLocalVideoTrackStats(this._highStream.connectionId):Vl}getRemoteVideoStats(){var e;let r={};return Re(e=this._remoteStream).call(e,(i,n)=>{r[n]=this._statsCollector.getRemoteVideoTrackStats(i.connectionId)}),r}getRemoteNetworkQuality(){var e;let r={};return Re(e=this._remoteStream).call(e,(i,n)=>{r[n]=this._statsCollector.getRemoteNetworkQualityStats(i.connectionId)}),r}pickSVCLayer(e,r){return Ee(this,null,function*(){Yr(r.spatialLayer,"spatialLayer",[0,1,2,3]),Yr(r.temporalLayer,"temporalLayer",[0,1,2,3]);try{yield this._gateway.pickSVCLayer(e,r)}catch(i){throw z.error("[".concat(this._clientId,"] pick SVC layer failed"),i.toString()),i}})}_reset(){var e,r,i;z.debug("[".concat(this._clientId,"] reset client")),this._axiosCancelSource.cancel(),this._axiosCancelSource=yo.CancelToken.source(),this._streamFallbackTypeCacheMap=new Lr,this._remoteStreamTypeCacheMap=new Lr,this._configDistribute.stopGetConfigDistribute(),this._defaultStreamFallbackType=this._proxyServer=this._joinInfo=void 0,this._sessionId=null,this._statsCollector.reset(),this._channelName=this._uid=this._appId=this._key=void 0,this._encryptionMode="none",this._encryptionSalt=this._encryptionSecret=null,Re(e=this._users).call(e,n=>{n.audioTrack&&(n.audioTrack.stop(),n.audioTrack._isDestroyed=!0),n.videoTrack&&(n.videoTrack.stop(),n.videoTrack._isDestroyed=!0)}),this._users=[],this._audioVolumeIndicationInterval&&(window.clearInterval(this._audioVolumeIndicationInterval),this._audioVolumeIndicationInterval=void 0),this._highStream&&(this._highStream.closeP2PConnection(!0),this._highStream=void 0),Re(r=this._bindEnabledTracks).call(r,n=>{n.off(xt.NEED_ADD_TRACK,this._handleLocalTrackEnable),n.off(xt.NEED_REMOVE_TRACK,this._handleLocalTrackDisable)}),this._bindEnabledTracks=[],this._lowStream&&(this._lowStream.closeP2PConnection(!0),this._lowStream=void 0),Re(i=this._remoteStream).call(i,n=>{n.closeP2PConnection(!0)}),this._remoteStream=new Lr,this._publishMutex=new Yo("client-publish"),this._subscribeMutex=new Lr,this._networkQualityInterval&&(window.clearInterval(this._networkQualityInterval),this._networkQualityInterval=void 0),this._injectStreamingClient&&(this._injectStreamingClient.terminate(),this._injectStreamingClient.removeAllListeners(),this._injectStreamingClient=void 0),this._liveRawStreamingClient&&(this._liveRawStreamingClient.terminate(),this._liveRawStreamingClient.removeAllListeners(),this._liveRawStreamingClient=void 0),this._liveTranscodeStreamingClient&&(this._liveTranscodeStreamingClient.terminate(),this._liveTranscodeStreamingClient.removeAllListeners(),this._liveTranscodeStreamingClient=void 0),this._channelMediaRelayClient&&(this._channelMediaRelayClient.dispose(),this._channelMediaRelayClient=void 0)}_startSession(e,r){var i,n,c;let h=e||mr(32,"").toUpperCase();e?z.debug(ne(i="[".concat(this._clientId,"] new Session ")).call(i,h)):z.debug(ne(n=ne(c="[".concat(this._clientId,"] renewSession ")).call(c,this._sessionId," => ")).call(n,h)),this._sessionId=h,r?Qe.sessionInit(this._sessionId,{lts:new Date().getTime(),cname:r.channel,appid:r.appId,mode:this._mode}):this._joinInfo?Qe.sessionInit(this._sessionId,{lts:new Date().getTime(),cname:this._joinInfo.cname,appid:this._joinInfo.appId,mode:this._mode}):this._gateway.joinInfo&&Qe.sessionInit(this._sessionId,{lts:new Date().getTime(),cname:this._gateway.joinInfo.cname,appid:this._gateway.joinInfo.appId,mode:this._mode}),this._joinInfo&&(this._joinInfo.sid=h),this._gateway.joinInfo&&(this._gateway.joinInfo.sid=h)}_publishHighStream(e){return Ee(this,null,function*(){if(!this._joinInfo)throw new ue(oe.INVALID_OPERATION,"Can't publish stream, haven't joined yet!");if(this.connectionState!=="CONNECTED"&&this.connectionState!=="RECONNECTING")throw new ue(oe.INVALID_OPERATION,"can not publish stream in ".concat(this.connectionState," state"));if(this._turnServer.mode==="auto"&&Xe.FORCE_TURN&&!Xe.TURN_ENABLE_TCP&&!Xe.TURN_ENABLE_UDP)throw new ue(oe.UNEXPECTED_ERROR,"force TURN With No TURN Configuration");if(z.debug("[".concat(this._clientId,"] publish high stream")),this._highStream)return yield this._highStream.addTracks(e),this._highStream;this._highStream=new Rg(this._statsCollector,this._joinInfo,this._codec),this._highStream.on(Nt.P2P_LOST,()=>{this._highStream&&this.emit(er.P2P_LOST,this._highStream.getUserId())}),yield this._highStream.addTracks(e);try{yield this._gateway.publish(this._highStream,"high")}catch(r){throw this._highStream=void 0,r}return this._highStream.on(Nt.CONNECTION_STATE_CHANGE,(r,i)=>{this._highStream&&(r==="connected"?this.emit(er.MEDIA_RECONNECT_END,this._highStream.getUserId()):r==="connecting"&&this.emit(er.MEDIA_RECONNECT_START,this._highStream.getUserId()))}),this._highStream})}_publishLowStream(e){return Ee(this,null,function*(){if(!this._joinInfo)throw new ue(oe.INVALID_OPERATION,"Can't publish stream, haven't joined yet!");if(this.connectionState!=="CONNECTED"&&this.connectionState!=="RECONNECTING")throw new ue(oe.INVALID_OPERATION,"can not publish stream in ".concat(this.connectionState," state"));if(!this._highStream||this._highStream.connectionState!=="connected")throw new ue(oe.UNEXPECTED_ERROR,"Could not find high stream");if(this._lowStream)return new ue(oe.UNEXPECTED_ERROR,"[".concat(this._clientId,"] Can't publish low stream when stream already publish")).throw();z.debug("[".concat(this._clientId,"] publish low stream")),this._lowStream=new Rg(this._statsCollector,this._joinInfo,this._codec,!0);let r=this._configDistribute.getLowStreamConfigDistribute();r&&r.bitrate&&(this._lowStreamParameter||(this._lowStreamParameter={width:160,height:120,framerate:15,bitrate:50}),this._lowStreamParameter&&this._lowStreamParameter.bitrate&&r.bitrate<this._lowStreamParameter.bitrate&&(this._lowStreamParameter.bitrate=r.bitrate)),this._lowStream.lowStreamParameter=this._lowStreamParameter,yield this._lowStream.addTracks([e]);try{yield this._gateway.publish(this._lowStream,"low")}catch(i){throw this._lowStream=void 0,i}this._highStream.lowStreamConnection=this._lowStream})}_createLiveStreamingClient(e){if(!this._joinInfo||!this._appId)return new ue(oe.INVALID_OPERATION,"can not create live streaming client, please join channel first").throw();let r=()=>new Vm(this._joinInfo,this._config.websocketRetryConfig||Vi,this._config.httpRetryConfig||Vi),i=n=>{n.onLiveStreamError=(c,h)=>{Qe.reportApiInvoke(this._sessionId,{name:bt.ON_LIVE_STREAM_ERROR,options:[c,h],tag:Dt.TRACER}).onSuccess(),this.emit(er.LIVE_STREAMING_ERROR,c,h)},n.onLiveStreamWarning=(c,h)=>{Qe.reportApiInvoke(this._sessionId,{name:bt.ON_LIVE_STREAM_WARNING,options:[c,h],tag:Dt.TRACER}).onSuccess(),this.emit(er.LIVE_STREAMING_WARNING,c,h)},n.on(ac.REQUEST_WORKER_MANAGER_LIST,(c,h,C)=>{if(!this._joinInfo)return C(new ue(oe.INVALID_OPERATION,"can not find join info to get worker manager"));ks(c,this._joinInfo,this._axiosCancelSource.token,Vi).then(h).catch(C)})};switch(e){case Ei.RAW:return this._liveRawStreamingClient||(this._liveRawStreamingClient=r(),i(this._liveRawStreamingClient)),this._liveRawStreamingClient;case Ei.TRANSCODE:return this._liveTranscodeStreamingClient||(this._liveTranscodeStreamingClient=r(),i(this._liveTranscodeStreamingClient)),this._liveTranscodeStreamingClient;case Ei.INJECT:return this._injectStreamingClient||(this._injectStreamingClient=r(),this._injectStreamingClient.on(ac.REQUEST_WORKER_MANAGER_LIST,(n,c,h)=>{if(!this._joinInfo)return h(new ue(oe.INVALID_OPERATION,"can not find join info to get worker manager"));ks(n,this._joinInfo,this._axiosCancelSource.token,Vi).then(c).catch(h)}),this._injectStreamingClient.onInjectStatusChange=(n,c,h)=>{this.emit(er.INJECT_STREAM_STATUS,n,c,h)}),this._injectStreamingClient}}_createChannelMediaRelayClient(){return this._joinInfo?(this._channelMediaRelayClient||(this._channelMediaRelayClient=new Jm(this._joinInfo,this._clientId,this._config.websocketRetryConfig||Vi,this._config.httpRetryConfig||Vi),this._channelMediaRelayClient.on("state",e=>{e==="RELAY_STATE_FAILURE"&&this._channelMediaRelayClient&&this._channelMediaRelayClient.dispose(),this.emit(er.CHANNEL_MEDIA_RELAY_STATE,e)}),this._channelMediaRelayClient.on("event",e=>{this.emit(er.CHANNEL_MEDIA_RELAY_EVENT,e)})),this._channelMediaRelayClient):new ue(oe.INVALID_OPERATION,"can not create channel media relay client, please join channel first").throw()}_handleGatewayEvents(){this._gateway.on(ji.DISCONNECT_P2P,()=>{var e;z.debug("[".concat(this._clientId,"] start full reconnect")),this._highStream&&this._highStream.connectionState!=="disconnected"&&(z.debug("[".concat(this._clientId,"] ready to reconnect high stream")),this._highStream.readyToReconnectPC()),this._lowStream&&this._lowStream.connectionState!=="disconnected"&&(z.debug("[".concat(this._clientId,"] ready to reconnect low stream")),this._lowStream.readyToReconnectPC()),Re(e=this._remoteStream).call(e,(r,i)=>{var n;z.debug(ne(n="[".concat(this._clientId,"] ready to reconnect remote stream ")).call(n,i)),r.readyToReconnectPC()})}),this._gateway.on(ji.CONNECTION_STATE_CHANGE,(e,r,i)=>{var n,c;let h=()=>{this.emit(er.CONNECTION_STATE_CHANGE,e,r,i)};if(z.info(ne(n=ne(c="[".concat(this._clientId,"] connection state change: ")).call(c,r," -> ")).call(n,e)),e==="DISCONNECTED")return this._reset(),void h();var C,x;if(e==="RECONNECTING")this._highStream&&this._highStream.connectionState==="connecting"&&(z.debug("[".concat(this._clientId,"] ready to reconnect high stream")),this._highStream.readyToReconnectPC()),this._lowStream&&this._lowStream.connectionState==="connecting"&&(z.debug("[".concat(this._clientId,"] ready to reconnect low stream")),this._lowStream.readyToReconnectPC()),Re(C=this._remoteStream).call(C,(V,Y)=>{var $;V.connectionState==="connecting"&&(z.debug(ne($="[".concat(this._clientId,"] ready to reconnect remote stream ")).call($,Y)),V.readyToReconnectPC())}),Re(x=this._users).call(x,V=>{V._trust_in_room_=!1,V._trust_audio_enabled_state_=!1,V._trust_video_enabled_state_=!1,V._trust_audio_mute_state_=!1,V._trust_video_mute_state_=!1,V._trust_stream_added_state_=!1}),this._userOfflineTimeout&&window.clearTimeout(this._userOfflineTimeout),this._streamRemovedTimeout&&window.clearTimeout(this._streamRemovedTimeout),this._streamRemovedTimeout=this._userOfflineTimeout=void 0;else if(e==="CONNECTED"){var Q,F;Re(Q=this._streamFallbackTypeCacheMap).call(Q,(V,Y)=>{this._gateway.setStreamFallbackOption(Y,V).catch($=>z.warning("[".concat(this._clientId,"] auto set stream fallback option failed"),$))}),Re(F=this._remoteStreamTypeCacheMap).call(F,(V,Y)=>{this._gateway.setRemoteVideoStreamType(Y,V).catch($=>z.warning("[".concat(this._clientId,"] auto set remote stream type failed"),$))}),this._highStream&&this._highStream.connectionState==="connecting"?this._highStream.reconnectPC().then(()=>{this._lowStream&&this._lowStream.connectionState==="connecting"&&this._lowStream.reconnectPC().catch(V=>{z.error("[".concat(this._clientId,"] republish low stream error"),V.toString()),this.emit(er.ERROR,{reason:V})})}).catch(V=>{z.error("[".concat(this._clientId,"] republish high stream error"),V.toString()),this.emit(er.ERROR,{reason:V})}):this._lowStream&&this._lowStream.connectionState==="connecting"&&this._lowStream.reconnectPC().catch(V=>{z.error("[".concat(this._clientId,"] republish low stream error"),V.toString()),this.emit(er.ERROR,{reason:V})}),this._userOfflineTimeout=window.setTimeout(()=>{var V;if(this.connectionState==="CONNECTED"){this._userOfflineTimeout=void 0;var Y=Gt(V=this._users).call(V,$=>!$._trust_in_room_);Re(Y).call(Y,$=>{var te;z.debug(ne(te="[".concat(this._clientId,"] user offline timeout, emit user offline ")).call(te,$.uid)),this._handleUserOffline({uid:$.uid})})}},3e3),this._streamRemovedTimeout=window.setTimeout(()=>{var V;this.connectionState==="CONNECTED"&&(this._streamRemovedTimeout=void 0,Re(V=this._users).call(V,Y=>{var $,te,ce,Ae,Me;Y._trust_audio_mute_state_||(z.debug(ne($="[".concat(this._clientId,"] auto dispatch audio unmute event ")).call($,Y.uid)),this._handleMuteStream(Y.uid,"audio",!1)),Y._trust_video_mute_state_||(z.debug(ne(te="[".concat(this._clientId,"] auto dispatch video unmute event ")).call(te,Y.uid)),this._handleMuteStream(Y.uid,"video",!1)),Y._trust_audio_enabled_state_||(z.debug(ne(ce="[".concat(this._clientId,"] auto dispatch enable local audio ")).call(ce,Y.uid)),this._handleSetStreamLocalEnable("audio",Y.uid,!0)),!Y._trust_video_enabled_state_&&Y._video_enabled_&&(z.debug(ne(Ae="[".concat(this._clientId,"] auto dispatch enable local video ")).call(Ae,Y.uid)),this._handleSetStreamLocalEnable("video",Y.uid,!0)),Y._trust_stream_added_state_||(z.debug(ne(Me="[".concat(this._clientId,"] auto dispatch stream remove ")).call(Me,Y.uid)),this._handleRemoveStream({uid:Y.uid,uint_id:Y._uintid}))}))},1e3)}h()}),this._gateway.on(ji.REQUEST_NEW_GATEWAY_LIST,(e,r)=>{if(!this._joinInfo)return r(new ue(oe.UNEXPECTED_ERROR,"can not recover, no join info"));xi(this._joinInfo,this._axiosCancelSource.token,this._config.httpRetryConfig||Vi).then(i=>{var n;this._joinInfo&&(this._joinInfo.apResponse=i.gatewayInfo.res),e(yt(n=i.gatewayInfo.gatewayAddrs).call(n,c=>{if(this._joinInfo&&this._joinInfo.proxyServer){var h,C;return c=c.split(":"),ne(h=ne(C="wss://".concat(this._joinInfo.proxyServer,"/ws/?h=")).call(C,c[0],"&p=")).call(h,c[1])}return"wss://".concat(c)}))}).catch(r)}),this._gateway.on(ji.NETWORK_QUALITY,e=>{this._networkQualitySensitivity==="normal"&&this.emit(er.NETWORK_QUALITY,e)}),this._gateway.on(ji.STREAM_TYPE_CHANGE,(e,r)=>{this.emit(er.STREAM_TYPE_CHANGED,e,r),Qe.reportApiInvoke(this._sessionId,{name:bt.STREAM_TYPE_CHANGE,options:[e,r],tag:Dt.TRACER}).onSuccess(ht({uid:e,streamType:r}))}),this._gateway.on(ji.IS_P2P_DISCONNECTED,e=>{var r,i,n;let c=[];return this._highStream&&c.push(this._highStream),Re(r=this._remoteStream).call(r,h=>c.push(h)),c.length===0||Gt(c).call(c,h=>h.connectionState==="connected").length===0?e(!0):(z.debug(ne(i="[".concat(this._clientId,"] ")).call(i,yt(n=Gt(c).call(c,h=>h.connectionState==="connected")).call(n,h=>h.connectionId)," is connected")),void e(!1))}),this._gateway.on(ji.NEED_RENEW_SESSION,()=>{this._startSession()}),this._gateway.signal.on(Sr.ON_USER_ONLINE,this._handleUserOnline),this._gateway.signal.on(Sr.ON_USER_OFFLINE,this._handleUserOffline),this._gateway.signal.on(Sr.ON_ADD_AUDIO_STREAM,e=>this._handleAddAudioOrVideoStream("audio",e.uid,e.uint_id)),this._gateway.signal.on(Sr.ON_ADD_VIDEO_STREAM,e=>this._handleAddAudioOrVideoStream("video",e.uid,e.uint_id)),this._gateway.signal.on(Sr.ON_REMOVE_STREAM,this._handleRemoveStream),this._gateway.signal.on(Sr.ON_P2P_LOST,this._handleP2PLost),this._gateway.signal.on(Sr.MUTE_AUDIO,e=>this._handleMuteStream(e.uid,"audio",!0)),this._gateway.signal.on(Sr.UNMUTE_AUDIO,e=>this._handleMuteStream(e.uid,"audio",!1)),this._gateway.signal.on(Sr.MUTE_VIDEO,e=>this._handleMuteStream(e.uid,"video",!0)),this._gateway.signal.on(Sr.UNMUTE_VIDEO,e=>this._handleMuteStream(e.uid,"video",!1)),this._gateway.signal.on(Sr.RECEIVE_METADATA,e=>{let r=xs(e.metadata);this.emit(er.RECEIVE_METADATA,e.uid,r)}),this._gateway.signal.on(Sr.ON_DATA_STREAM,e=>{e.seq&&delete e.seq,e.payload=xs(e.payload),this.emit(er.STREAM_MESSAGE,e.uid,e.payload),this.onStreamMessage&&this.onStreamMessage(e)}),this._gateway.signal.on(Sr.ON_CRYPT_ERROR,()=>{ps(()=>{z.warning("[".concat(this._clientId,"] on crypt error")),this.emit(er.CRYPT_ERROR)},this._sessionId)}),this._gateway.signal.on(Sr.ON_TOKEN_PRIVILEGE_WILL_EXPIRE,this._handleTokenWillExpire),this._gateway.signal.on(Sr.ON_TOKEN_PRIVILEGE_DID_EXPIRE,()=>{z.warning("[".concat(this._clientId,"] received message onTokenPrivilegeDidExpire, please get new token and join again")),this._reset(),this._gateway.leave(!0),this.emit(er.ON_TOKEN_PRIVILEGE_DID_EXPIRE)}),this._gateway.signal.on(Sr.ON_STREAM_FALLBACK_UPDATE,e=>{var r,i;z.debug(ne(r=ne(i="[".concat(this._clientId,"] stream fallback peerId: ")).call(i,e.stream_id,", attr: ")).call(r,e.stream_type)),this.emit(er.STREAM_FALLBACK,e.stream_id,e.stream_type===1?"fallback":"recover")}),this._gateway.signal.on(Sr.ON_PUBLISH_STREAM,e=>{var r;this.uid===this._uid&&(this._highStream&&this._highStream._waitingSuccessResponse&&this._highStream.connectionState==="connected"?(this._highStream.reportPublishEvent(!0,null,ht({proxy:e.proxy})),z.info(ne(r="[".concat(this._clientId,"] on publish stream, ")).call(r,ht(e))),e.proxy!==void 0&&this.emit(er.IS_USING_CLOUD_PROXY,!!e.proxy)):this._lowStream?this._lowStream.reportPublishEvent(!0,null,ht({proxy:e.proxy})):z.warning("get on_publish_stream message but cannot handle"))}),this._gateway.signal.on(Sr.ENABLE_LOCAL_VIDEO,e=>{this._handleSetStreamLocalEnable("video",e.uid,!0)}),this._gateway.signal.on(Sr.DISABLE_LOCAL_VIDEO,e=>{this._handleSetStreamLocalEnable("video",e.uid,!1)}),this._gateway.signal.on(ir.REQUEST_TIMEOUT,(e,r)=>{if(this._joinInfo)switch(e){case xr.PUBLISH:var i;if(!r||(e=r.stream_type==="high"?this._highStream:this._lowStream,!e))break;r.state==="offer"&&Qe.publish(this._joinInfo.sid,{lts:e.startTime,succ:!1,ec:oe.TIMEOUT,audio:r.audio,video:r.video,p2pid:r.p2p_id,publishRequestid:e.ID,screenshare:!(!e.videoTrack||Wt(i=e.videoTrack._hints).call(i,to.SCREEN_TRACK)===-1),audioName:e.audioTrack&&(e.audioTrack instanceof Tn?e.audioTrack.getSubTrackLabels().join(","):e.audioTrack.getTrackLabel()),videoName:e.videoTrack&&e.videoTrack.getTrackLabel()});break;case xr.SUBSCRIBE:(i=this._remoteStream.get(r.stream_id))&&r&&Qe.subscribe(this._joinInfo.sid,{lts:i.startTime,succ:!1,ec:oe.TIMEOUT,audio:!!r.audio,video:!!r.video,peerid:r.stream_id,subscribeRequestid:i.ID,p2pid:i.pc.ID})}})}}cl([bn({report:Qe}),Zn("design:type",Function),Zn("design:paramtypes",[String]),Zn("design:returntype",void 0)],gc.prototype,"setProxyServer",null),cl([bn(),Zn("design:type",Function),Zn("design:paramtypes",[Object]),Zn("design:returntype",void 0)],gc.prototype,"setTurnServer",null),cl([bn({report:Qe}),Zn("design:type",Function),Zn("design:paramtypes",[Array,String]),Zn("design:returntype",void 0)],gc.prototype,"setLocalAccessPoints",null),cl([bn({report:Qe}),Zn("design:type",Function),Zn("design:paramtypes",[String,String,Uint8Array]),Zn("design:returntype",void 0)],gc.prototype,"setEncryptionConfig",null),cl([On({report:Qe}),Zn("design:type",Function),Zn("design:paramtypes",[Object,Object]),Zn("design:returntype",it)],gc.prototype,"pickSVCLayer",null);class e0 extends tA{constructor(e,r={}){super();this.currentLoopCount=this.pausePlayTime=this.startPlayOffset=this.startPlayTime=0,this._currentState="stopped",this.audioBuffer=e,this.options=r,this.startPlayOffset=this.options.startPlayTime||0}set currentState(e){e!==this._currentState&&(this._currentState=e,this.emit(Hs.AUDIO_SOURCE_STATE_CHANGE,this._currentState))}get currentState(){return this._currentState}createWebAudioDiagram(){return this.context.createGain()}get duration(){return this.audioBuffer.duration}get currentTime(){return this.currentState==="stopped"?0:this.currentState==="paused"?this.pausePlayTime:(this.context.currentTime-this.startPlayTime+this.startPlayOffset)%this.audioBuffer.duration}updateOptions(e){this.currentState==="stopped"?(this.options=e,this.startPlayOffset=this.options.startPlayTime||0):z.warning("can not set audio source options")}startProcessAudioBuffer(){this.sourceNode&&this.stopProcessAudioBuffer(),this.sourceNode=this.createSourceNode(),this.startSourceNode(),this.currentState="playing"}pauseProcessAudioBuffer(){this.sourceNode&&this.currentState==="playing"&&(this.pausePlayTime=this.currentTime,this.sourceNode.onended=null,this.sourceNode.stop(),this.sourceNode.buffer=null,this.sourceNode=this.createSourceNode(),this.currentState="paused")}seekAudioBuffer(e){this.sourceNode&&(this.sourceNode.onended=null,this.currentState==="playing"&&this.sourceNode.stop(),this.sourceNode=this.createSourceNode(),this.currentState==="playing"?(this.startPlayOffset=e,this.startSourceNode()):this.currentState==="paused"&&(this.pausePlayTime=e))}resumeProcessAudioBuffer(){this.currentState==="paused"&&this.sourceNode&&(this.startPlayOffset=this.pausePlayTime,this.pausePlayTime=0,this.startSourceNode(),this.currentState="playing")}stopProcessAudioBuffer(){if(this.sourceNode){this.sourceNode.onended=null;try{this.sourceNode.stop()}catch(e){}this.reset()}}startSourceNode(){var e;this.sourceNode&&this.sourceNode.buffer&&(this.sourceNode.start(0,this.startPlayOffset),this.startPlayTime=this.context.currentTime,this.sourceNode.onended=Si(e=this.handleSourceNodeEnded).call(e,this))}createSourceNode(){let e=this.context.createBufferSource();return e.buffer=this.audioBuffer,e.loop=!!this.options.loop,e.connect(this.outputNode),e}handleSourceNodeEnded(){if(this.currentLoopCount+=1,this.options.cycle&&this.options.cycle>this.currentLoopCount)return this.startPlayOffset=0,this.sourceNode=void 0,void this.startProcessAudioBuffer();this.reset()}reset(){this.startPlayOffset=this.options.startPlayTime||0,this.currentState="stopped",this.sourceNode&&(this.sourceNode.disconnect(),this.sourceNode=void 0),this.currentLoopCount=0}}let Dg=new Lr;var t0=Br.setInterval;let r0=Ye().name;class ll{constructor(e,r){this.id=0,ll.count+=1,this.id=ll.count,this.element=e,this.context=r}initPeers(){this.peerPair=[new RTCPeerConnection,new RTCPeerConnection],this.peerPair[1].ontrack=e=>{let r=document.createElement("audio");r.srcObject=new MediaStream([e.track]),r.play(),this.audioPlayerElement=r}}switchSdp(){return Ee(this,null,function*(){if(this.peerPair){var e=(i,n)=>Ee(this,null,function*(){return n=n==="offer"?yield i.createOffer():yield i.createAnswer(),yield i.setLocalDescription(n),i.iceGatheringState==="complete"?i.localDescription:new it(c=>{i.onicegatheringstatechange=()=>{i.iceGatheringState==="complete"&&c(i.localDescription)}})}),r=(i,n)=>Ee(this,null,function*(){return yield i.setRemoteDescription(n)});try{let i=yield e(this.peerPair[0],"offer");yield r(this.peerPair[1],i);let n=yield e(this.peerPair[1],"answer");yield r(this.peerPair[0],n)}catch(i){throw new ue(oe.LOCAL_AEC_ERROR,i.toString()).print()}}})}getTracksFromMediaElement(e){return Ee(this,null,function*(){if(this.audioTrack)return this.audioTrack;let r;try{e instanceof HTMLVideoElement&&(e.captureStream?e.captureStream():e.mozCaptureStream()),r=this.context.createMediaStreamDestination(),this.context.createMediaElementSource(e).connect(r)}catch(i){throw new ue(oe.LOCAL_AEC_ERROR,i.toString()).print()}if(!r)throw new ue(oe.LOCAL_AEC_ERROR,"no dest node when local aec").print();return e=r.stream.getAudioTracks()[0],this.audioTrack=e,e})}getElement(){return this.element}startEchoCancellation(){return Ee(this,null,function*(){this.context.resume(),this.peerPair&&this.close(),this.initPeers();let e=yield this.getTracksFromMediaElement(this.element);this.peerPair&&this.peerPair[0].addTrack(e),yield this.switchSdp()})}close(){var e;z.debug("close echo cancellation unit, id is",this.id),this.audioPlayerElement&&this.audioPlayerElement.pause(),this.peerPair&&Re(e=this.peerPair).call(e,r=>{r.close()}),this.audioPlayerElement=this.peerPair=void 0}}ll.count=0;var Zd=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)};let i0=window.AudioContext||window.webkitAudioContext;class bg{constructor(){this.units=[]}processExternalMediaAEC(e){var r;if(!this._doesEnvironmentNeedAEC())return z.debug("the system does not need to process local aec"),-1;this.context||(this.context=new i0);let i=tr(r=this.units).call(r,n=>n&&n.getElement()===e);return i||(i=new ll(e,this.context),this.units.push(i)),i.startEchoCancellation(),z.debug("start processing local audio echo cancellation, id is",i.id),i.id}_doesEnvironmentNeedAEC(){return Ye().name!==rr.SAFARI}}(function(t,e,r,i){var n,c=arguments.length,h=3>c?e:i===null?i=gr(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(t,e,r,i);else for(var C=t.length-1;0<=C;C--)(n=t[C])&&(h=(3>c?n(h):3<c?n(e,r,h):n(e,r))||h);return 3<c&&h&&_r(e,r,h),h})([bn({report:Qe}),Zd("design:type",Function),Zd("design:paramtypes",[HTMLAudioElement]),Zd("design:returntype",Number)],bg.prototype,"processExternalMediaAEC",null);let n0=new bg;var Og,Bg,Ng,Pg;Rr("PROCESS_ID",ne(Og=ne(Bg=ne(Ng=ne(Pg="process-".concat(mr(8,""),"-")).call(Pg,mr(4,""),"-")).call(Ng,mr(4,""),"-")).call(Bg,mr(4,""),"-")).call(Og,mr(12,""))),function(){let t=Ye();var e=!!(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia);Ur.getDisplayMedia=e,Ur.getStreamFromExtension=t.name===rr.CHROME&&34<Number(t.version),Ur.supportUnifiedPlan=function(){if(!(window.RTCRtpTransceiver&&"currentDirection"in RTCRtpTransceiver.prototype))return!1;let r=new RTCPeerConnection,i=!1;try{r.addTransceiver("audio"),i=!0}catch(n){}return r.close(),i}(),Ur.supportMinBitrate=t.name===rr.CHROME||t.name===rr.EDGE,Ur.supportSetRtpSenderParameters=function(){let r=Ye();return window.RTCRtpSender&&window.RTCRtpSender.prototype.setParameters&&window.RTCRtpSender.prototype.getParameters?!!bi()||!(!cr()&&!Bt())||r.name===rr.FIREFOX&&64<=Number(r.version):!1}(),t.name===rr.SAFARI&&(14<=Number(t.version)?Ur.supportDualStream=!0:Ur.supportDualStream=!1),Ur.webAudioMediaStreamDest=function(){let r=Ye();return!(r.name===rr.SAFARI&&12>Number(r.version))}(),Ur.supportReplaceTrack=window.RTCRtpSender?typeof RTCRtpSender.prototype.replaceTrack=="function":!1,Ur.supportWebGL=typeof WebGLRenderingContext!="undefined",Ur.supportRequestFrame=!!window.CanvasCaptureMediaStreamTrack,bi()||(Ur.webAudioWithAEC=!0),Ur.supportShareAudio=function(){let r=Ye();return(r.os===en.WIN_10||r.os===en.WIN_81||r.os===en.WIN_7||r.os===en.LINUX||r.os===en.MAC_OS)&&r.name===rr.CHROME&&74<=Number(r.version)}(),Ur.supportDualStreamEncoding=function(){let r=Ye();return r.name==="Safari"&&14<=Number(r.version)}(),z.info("browser compatibility",ht(Ur),ht(t))}();let $n={__CLIENT_LIST__:jo,__TRACK_LIST__:pa,VERSION:as,BUILD:"v4.7.3-0-g0eb931c7(11/16/2021, 7:57:58 PM)",setParameter:Rr,getParameter:function(t){return Xe[t]},getSupportedCodec:function(t){return Ee(this,null,function*(){let e=null;return t?(e=new Ag({}),e.addStream(t)):e=new gg({}),t=Sc(yield e.createOfferSDP()),e.close(),t})},checkSystemRequirements:function(){const t=Qe.reportApiInvoke(null,{name:bt.CHECK_SYSTEM_REQUIREMENTS,options:[],tag:Dt.TRACER});var e=!1;try{var r=navigator.mediaDevices&&navigator.mediaDevices.getUserMedia,i=window.WebSocket;e=!!(window.RTCPeerConnection&&r&&i)}catch(n){return z.error("check system requirement failed: ",n),!1}return r=!1,i=Ye(),i.name===rr.CHROME&&58<=Number(i.version)&&(xn.engine.name!=="WebKit"||Ft())&&(r=!0),i.name===rr.FIREFOX&&56<=Number(i.version)&&(r=!0),i.name===rr.OPERA&&45<=Number(i.version)&&(r=!0),i.name===rr.SAFARI&&11<=Number(i.version)&&(r=!0),Ye().name!==rr.WECHAT&&Ye().name!==rr.QQ||(r=!0),z.debug("checkSystemRequirements, api:",e,"browser",r),e=e&&r,t.onSuccess(e),e},getDevices:function(t){return Xn.enumerateDevices(!0,!0,t)},getMicrophones:function(t){return Xn.getRecordingDevices(t)},getCameras:function(t){return Xn.getCamerasDevices(t)},getElectronScreenSources:As,getPlaybackDevices:function(t){return Xn.getSpeakers(t)},createClient:function(t={codec:"vp8",mode:"rtc"}){const e=Qe.reportApiInvoke(null,{name:bt.CREATE_CLIENT,options:[t],tag:Dt.TRACER});try{Yr(t.codec,"config.codec",["vp8","vp9","av1","h264"]),Yr(t.mode,"config.mode",["rtc","live"]),t.proxyServer!==void 0&&Jr(t.proxyServer,"config.proxyServer",1,1e4),t.turnServer!==void 0&&Xo(t.turnServer),t.httpRetryConfig!==void 0&&wo(t.httpRetryConfig),t.websocketRetryConfig!==void 0&&wo(t.websocketRetryConfig)}catch(r){throw e.onError(r),r}return e.onSuccess(),new gc(Eo({forceWaitGatewayResponse:!0},t,{role:t.mode==="rtc"?"host":t.role}))},createCameraVideoTrack:function(){return Ee(this,arguments,function*(t={encoderConfig:"480p_1"}){const e=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.CREATE_CAM_VIDEO_TRACK,options:[Rc({},t)]}),r=yc(t);var i=mr(8,"track-cam-");let n=null;z.info("start create camera video track with config",ht(t),"trackId",i);try{n=(yield Fi({video:r},i)).getVideoTracks()[0]||null}catch(c){throw e.onError(c),c}return n?(t.optimizationMode&&wc(i,n,t,t.encoderConfig&&oi(t.encoderConfig)),t=new sl(n,t,r,t.scalabiltyMode?sn(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,i),e.onSuccess(t.getTrackId()),z.info("create camera video success, trackId:",i),t):(i=new ue(oe.UNEXPECTED_ERROR,"can not find track in media stream"),e.onError(i),i.throw())})},createCustomVideoTrack:function(t){const e=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.CREATE_CUSTOM_VIDEO_TRACK,options:[t]}),r=new li(t.mediaStreamTrack,{bitrateMax:t.bitrateMax,bitrateMin:t.bitrateMin},t.scalabiltyMode?sn(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode);return e.onSuccess(r.getTrackId()),z.info("create custom video track success with config",t,"trackId",r.getTrackId()),r},createScreenVideoTrack:function(){return Ee(this,arguments,function*(t={},e="disable"){const r=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.CREATE_SCREEN_VIDEO_TRACK,options:[Rc({},t),e]});t.encoderConfig?typeof t.encoderConfig=="string"||t.encoderConfig.width&&t.encoderConfig.height||(t.encoderConfig.width={max:1920},t.encoderConfig.height={max:1080}):t.encoderConfig="1080p_2";var i={};t.screenSourceType&&(i.mediaSource=t.screenSourceType),t.extensionId&&Mt()&&(i.extensionId=t.extensionId),t.electronScreenSourceId&&(i.sourceId=t.electronScreenSourceId);var n=t.encoderConfig?Ci(t.encoderConfig):null;n=(i.mandatory={chromeMediaSource:"desktop",maxWidth:n?n.width:void 0,maxHeight:n?n.height:void 0},n&&n.frameRate&&(typeof n.frameRate=="number"?(i.mandatory.maxFrameRate=n.frameRate,i.mandatory.minFrameRate=n.frameRate):(i.mandatory.maxFrameRate=n.frameRate.max||n.frameRate.ideal||n.frameRate.exact||void 0,i.mandatory.minFrameRate=n.frameRate.min||n.frameRate.ideal||n.frameRate.exact||void 0),i.frameRate=n.frameRate),n&&n.width&&(i.width=n.width),n&&n.height&&(i.height=n.height),i);const c=mr(8,"track-scr");let h=null;i=null;const C=Ur;if(!C.supportShareAudio&&e==="enable")return t=new ue(oe.NOT_SUPPORTED,"your browser or platform is not support share-screen with audio"),r.onError(t),t.throw();z.info("start create screen video track with config",t,"withAudio",e,"trackId",c);try{const x=yield Fi({screen:n,screenAudio:e==="auto"?C.supportShareAudio:e==="enable"},c);h=x.getVideoTracks()[0]||null,i=x.getAudioTracks()[0]||null}catch(x){throw r.onError(x),x}return h?!i&&e==="enable"?(h&&h.stop(),t=new ue(oe.SHARE_AUDIO_NOT_ALLOWED),r.onError(t),t.throw()):(t.optimizationMode||(t.optimizationMode="detail"),t.optimizationMode&&(wc(c,h,t,t.encoderConfig&&Ci(t.encoderConfig)),t.encoderConfig&&typeof t.encoderConfig!="string"&&(t.encoderConfig.bitrateMin=t.encoderConfig.bitrateMax)),t=new li(h,t.encoderConfig?Ci(t.encoderConfig):{},t.scalabiltyMode?sn(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,c),t._hints.push(to.SCREEN_TRACK),i?(e=new Ji(i),r.onSuccess([t.getTrackId(),e.getTrackId()]),z.info("create screen video track success","video:",t.getTrackId(),"audio:",e.getTrackId()),[t,e]):(r.onSuccess(t.getTrackId()),z.info("create screen video track success","video:",t.getTrackId()),t)):(t=new ue(oe.UNEXPECTED_ERROR,"can not find track in media stream"),r.onError(t),t.throw())})},createMicrophoneAndCameraTracks:function(){return Ee(this,arguments,function*(t={},e={encoderConfig:"480p_1"}){var r,i,n;const c=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.CREATE_MIC_AND_CAM_TRACKS,options:[t,e]}),h=yc(e),C=Ic(t),x=mr(8,"track-mic-"),Q=mr(8,"track-cam-");let F=null,V=null;z.info(ne(r=ne(i=ne(n="start create camera video track(".concat(Q,") and microphone audio track(")).call(n,x,") with config, audio: ")).call(i,ht(t),", video: ")).call(r,ht(e)));try{var Y;const te=yield Fi({audio:C,video:h},ne(Y="".concat(x,"-")).call(Y,Q));F=te.getAudioTracks()[0],V=te.getVideoTracks()[0]}catch(te){throw c.onError(te),te}if(!F||!V){var $=new ue(oe.UNEXPECTED_ERROR,"can not find tracks in media stream");return c.onError($),$.throw()}return e.optimizationMode&&wc(Q,V,e,e.encoderConfig&&oi(e.encoderConfig)),t=new Xc(F,t,C,x),e=new sl(V,e,h,e.scalabiltyMode?sn(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,Q),c.onSuccess([t.getTrackId(),e.getTrackId()]),z.info(ne($="create camera video track(".concat(Q,") and microphone audio track(")).call($,x,") success")),[t,e]})},createMicrophoneAudioTrack:function(){return Ee(this,arguments,function*(t={}){const e=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.CREATE_MIC_AUDIO_TRACK,options:[t]}),r=Ic(t);var i=mr(8,"track-mic-");let n=null;z.info("start create microphone audio track with config",ht(t),"trackId",i);try{n=(yield Fi({audio:r},i)).getAudioTracks()[0]||null}catch(c){throw e.onError(c),c}return n?(t=new Xc(n,t,r,i),e.onSuccess(t.getTrackId()),z.info("create microphone audio track success, trackId:",i),t):(i=new ue(oe.UNEXPECTED_ERROR,"can not find track in media stream"),e.onError(i),i.throw())})},createCustomAudioTrack:function(t){const e=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.CREATE_CUSTOM_AUDIO_TRACK,options:[t]}),r=new Ji(t.mediaStreamTrack,t.encoderConfig?Zr(t.encoderConfig):{});return z.info("create custom audio track success with config",t,"trackId",r.getTrackId()),e.onSuccess(r.getTrackId()),r},createBufferSourceAudioTrack:function(t){return Ee(this,null,function*(){const e=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.CREATE_BUFFER_AUDIO_TRACK,options:[t]}),r=mr(8,"track-buf-");z.info("start create buffer source audio track with config",ht(t),"trackId",r);const i=t.source;if(!(t.source instanceof AudioBuffer))try{t.source=yield eh(t.source,t.cacheOnlineFile)}catch(c){return e.onError(c),c.throw()}const n=new e0(t.source);return t=new lc(i,n,t.encoderConfig?Zr(t.encoderConfig):{},r),z.info("create buffer source audio track success, trackId:",r),e.onSuccess(t.getTrackId()),t})},setLogLevel:function(t){z.setLogLevel(t)},enableLogUpload:function(){z.enableLogUpload()},disableLogUpload:function(){z.disableLogUpload()},createChannelMediaRelayConfiguration:function(){return new Lg},checkAudioTrackIsActive:function(t,e=5e3){return Ee(this,null,function*(){const r=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.CHECK_AUDIO_TRACK_IS_ACTIVE,options:[e]});if(!(t instanceof Ji||t instanceof al)){var i=new ue(oe.INVALID_TRACK,"the parameter is not a audio track");return r.onError(i),i.throw()}e&&1e3>e&&(e=1e3);const n=t instanceof Ji?t.getTrackLabel():"remote_track";let c=i=t.getVolumeLevel(),h=i;const C=ot();return new it(x=>{const Q=t0(()=>{var F=t.getVolumeLevel();c=F>c?F:c,h=F<h?F:h,F=1e-4<c-h;var V=ot()-C;if(F||V>e){var Y;clearInterval(Q),V={duration:V,deviceLabel:n,maxVolumeLevel:c,result:F},z.info(ne(Y="[track-".concat(t.getTrackId(),"] check audio track active completed. ")).call(Y,ht(V))),r.onSuccess(V),x(F)}},200)})})},checkVideoTrackIsActive:function(t,e=5e3){return Ee(this,null,function*(){var r;const i=Qe.reportApiInvoke(null,{tag:Dt.TRACER,name:bt.CHECK_VIDEO_TRACK_IS_ACTIVE,options:[e]});if(!(t instanceof li||t instanceof ol))return t=new ue(oe.INVALID_TRACK,"the parameter is not a video track"),i.onError(t),t.throw();e&&1e3>e&&(e=1e3);var n=t instanceof li?t.getTrackLabel():"remote_track",c=t.getMediaStreamTrack(!0);const h=document.createElement("video");h.style.width="1px",h.style.height="1px",h.setAttribute("muted",""),h.muted=!0,h.setAttribute("playsinline",""),h.controls=!1,(cr()||Bt())&&(h.style.opacity="0.01",h.style.position="fixed",h.style.left="0",h.style.top="0",document.body.appendChild(h)),h.srcObject=new MediaStream([c]),h.play();const C=document.createElement("canvas");C.width=160,C.height=120;let x=c=0;try{const Q=ot();c=yield function(F,V,Y,$){let te,ce=0,Ae=null;return new it((Me,et)=>{Is(()=>{te&&(te(),Me(ce))},V),te=Ys(()=>{e:{ce>$&&te&&(te(),Me(ce));var vt=Y.getContext("2d");if(vt){vt.drawImage(F,0,0,160,120),vt=vt.getImageData(0,0,Y.width,Y.height);var kt=Math.floor(vt.data.length/3);if(Ae){for(let Pt=0;Pt<kt;Pt+=3)if(vt.data[Pt]!==Ae[Pt]){ce+=1,Ae=vt.data;break e}}Ae=vt.data}else vt=new ue(oe.UNEXPECTED_ERROR,"can not get canvas 2d context."),z.error(vt.toString()),et(vt)}},30)})}(h,e,C,4),x=ot()-Q}catch(Q){throw i.onError(Q),Q}return r0===rr.SAFARI&&(h.pause(),h.remove()),h.srcObject=null,e=4<c,n={duration:x,changedPicNum:c,deviceLabel:n,result:e},z.info(ne(r="[track-".concat(t.getTrackId(),"] check video track active completed. ")).call(r,ht(n))),i.onSuccess(n),e})},setArea:function(t){const e=Qe.reportApiInvoke(null,{name:bt.SET_AREA,options:t,tag:Dt.TRACER});try{var r;let i=[];if(typeof t=="string"&&(i=[t]),eo(t)&&(Re(t).call(t,c=>{if(!Ir(Uf).call(Uf,c))throw new ue(oe.INVALID_PARAMS,"invalid area code")}),i=t),Object.prototype.toString.call(t)==="[object Object]"){const{areaCode:c,excludedArea:h}=t;if(!c)throw new ue(oe.INVALID_PARAMS,"area code is needed");t=c,typeof c=="string"&&(t=[c]),i=h?Sm(t,h):t}Rr("AREAS",i);const n=(c=>{const h={CODE:"",WEBCS_DOMAIN:[],WEBCS_DOMAIN_BACKUP_LIST:[],PROXY_CS:[],CDS_AP:[],ACCOUNT_REGISTER:[],UAP_AP:[],EVENT_REPORT_DOMAIN:[],EVENT_REPORT_BACKUP_DOMAIN:[],LOG_UPLOAD_SERVER:[],PROXY_SERVER_TYPE3:[]};return yt(c).call(c,C=>{const x=dd[C];(C=Er(x))&&yt(C).call(C,Q=>{var F;Q!=="CODE"&&(h[Q]=ne(F=h[Q]).call(F,x[Q]))})}),h})(i);yt(r=Er(n)).call(r,c=>{c==="LOG_UPLOAD_SERVER"||c==="EVENT_REPORT_DOMAIN"||c==="EVENT_REPORT_BACKUP_DOMAIN"||c==="PROXY_SERVER_TYPE3"?Rr(c,n[c][0]):Rr(c,n[c])}),z.debug("set area success:",i.join(","))}catch(i){throw e.onError(i),i}e.onSuccess()},loadModule:function(t,e){return Ee(this,null,function*(){var r;if(z.debug(ne(r="loadModule: ".concat(t.name,", loadOption: ")).call(r,ht(e))),!t.moduleInit)throw z.debug("Invalid Plugin"),new ue(oe.INVALID_PLUGIN,"invalid plugin");try{yield t.moduleInit({logger:z,report:Qe},e)}catch(i){throw new ue(oe.UNEXPECTED_ERROR,"unexpected error in loadModule",i)}})},processExternalMediaAEC:function(t){n0.processExternalMediaAEC(t)}};return Xn.on(Wo.CAMERA_DEVICE_CHANGED,t=>{z.info("camera device changed",ht(t)),$n.onCameraChanged&&$n.onCameraChanged(t)}),Xn.on(Wo.RECORDING_DEVICE_CHANGED,t=>{z.info("microphone device changed",ht(t)),$n.onMicrophoneChanged&&$n.onMicrophoneChanged(t)}),Xn.on(Wo.PLAYOUT_DEVICE_CHANGED,t=>{z.debug("playout device changed",ht(t)),$n.onPlaybackDeviceChanged&&$n.onPlaybackDeviceChanged(t)}),Ts.onAutoplayFailed=()=>{z.info("detect audio element autoplay failed"),$n.onAudioAutoplayFailed&&$n.onAudioAutoplayFailed()},fr.on("autoplay-failed",()=>{z.info("detect webaudio autoplay failed"),$n.onAudioAutoplayFailed&&$n.onAudioAutoplayFailed()}),aA.on("autoplay-failed",()=>{z.info("detect media autoplay failed, document: https://docs.agora.io/cn/Voice/autoplay_policy_web_ng?platform=Web"),$n.onAutoplayFailed?$n.onAutoplayFailed():$n.onAudioAutoplayFailed?z.warning(`AgoraRTC.onAudioAutoplayFailed has been deprecated in favor of AgoraRTC.onAutoplayFailed.
137
-
138
- Please refer to the Agora document to migrate the newer API, https://docs.agora.io/en/Voice/autoplay_policy_web_ng?platform=Web .`):z.warning(`We have detected a media autoplay failed event, and found out that you haven't implemented AgoraRTC.onAutoplayFailed callback yet.
139
-
140
- It will cause audio/video element not playing automatically on some browsers without user interaction, possibly hurting user experiences.
141
-
142
- Please refer to the Agora document to properly handle autoplay failed event, https://docs.agora.io/en/Voice/autoplay_policy_web_ng?platform=Web .`)}),window&&(window.__ARTC__=$n),$n})},88711:function(Oe){typeof window!="undefined"&&function(H,k){Oe.exports=k()}(this,function(){return function(he){var H={};function k(W){if(H[W])return H[W].exports;var P=H[W]={i:W,l:!1,exports:{}};return he[W].call(P.exports,P,P.exports,k),P.l=!0,P.exports}return k.m=he,k.c=H,k.d=function(W,P,E){k.o(W,P)||Object.defineProperty(W,P,{enumerable:!0,get:E})},k.r=function(W){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(W,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(W,"__esModule",{value:!0})},k.t=function(W,P){if(P&1&&(W=k(W)),P&8||P&4&&typeof W=="object"&&W&&W.__esModule)return W;var E=Object.create(null);if(k.r(E),Object.defineProperty(E,"default",{enumerable:!0,value:W}),P&2&&typeof W!="string")for(var L in W)k.d(E,L,function(O){return W[O]}.bind(null,L));return E},k.n=function(W){var P=W&&W.__esModule?function(){return W.default}:function(){return W};return k.d(P,"a",P),P},k.o=function(W,P){return Object.prototype.hasOwnProperty.call(W,P)},k.p="/dist/",k(k.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(he,H,k){"use strict";var W=Object.prototype.hasOwnProperty,P="~";function E(){}Object.create&&(E.prototype=Object.create(null),new E().__proto__||(P=!1));function L(g,D,T){this.fn=g,this.context=D,this.once=T||!1}function O(g,D,T,f,p){if(typeof T!="function")throw new TypeError("The listener must be a function");var _=new L(T,f||g,p),d=P?P+D:D;return g._events[d]?g._events[d].fn?g._events[d]=[g._events[d],_]:g._events[d].push(_):(g._events[d]=_,g._eventsCount++),g}function b(g,D){--g._eventsCount===0?g._events=new E:delete g._events[D]}function w(){this._events=new E,this._eventsCount=0}w.prototype.eventNames=function(){var D=[],T,f;if(this._eventsCount===0)return D;for(f in T=this._events)W.call(T,f)&&D.push(P?f.slice(1):f);return Object.getOwnPropertySymbols?D.concat(Object.getOwnPropertySymbols(T)):D},w.prototype.listeners=function(D){var T=P?P+D:D,f=this._events[T];if(!f)return[];if(f.fn)return[f.fn];for(var p=0,_=f.length,d=new Array(_);p<_;p++)d[p]=f[p].fn;return d},w.prototype.listenerCount=function(D){var T=P?P+D:D,f=this._events[T];return f?f.fn?1:f.length:0},w.prototype.emit=function(D,T,f,p,_,d){var o=P?P+D:D;if(!this._events[o])return!1;var s=this._events[o],a=arguments.length,u,l;if(s.fn){switch(s.once&&this.removeListener(D,s.fn,void 0,!0),a){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,T),!0;case 3:return s.fn.call(s.context,T,f),!0;case 4:return s.fn.call(s.context,T,f,p),!0;case 5:return s.fn.call(s.context,T,f,p,_),!0;case 6:return s.fn.call(s.context,T,f,p,_,d),!0}for(l=1,u=new Array(a-1);l<a;l++)u[l-1]=arguments[l];s.fn.apply(s.context,u)}else{var A=s.length,I;for(l=0;l<A;l++)switch(s[l].once&&this.removeListener(D,s[l].fn,void 0,!0),a){case 1:s[l].fn.call(s[l].context);break;case 2:s[l].fn.call(s[l].context,T);break;case 3:s[l].fn.call(s[l].context,T,f);break;case 4:s[l].fn.call(s[l].context,T,f,p);break;default:if(!u)for(I=1,u=new Array(a-1);I<a;I++)u[I-1]=arguments[I];s[l].fn.apply(s[l].context,u)}}return!0},w.prototype.on=function(D,T,f){return O(this,D,T,f,!1)},w.prototype.once=function(D,T,f){return O(this,D,T,f,!0)},w.prototype.removeListener=function(D,T,f,p){var _=P?P+D:D;if(!this._events[_])return this;if(!T)return b(this,_),this;var d=this._events[_];if(d.fn)d.fn===T&&(!p||d.once)&&(!f||d.context===f)&&b(this,_);else{for(var o=0,s=[],a=d.length;o<a;o++)(d[o].fn!==T||p&&!d[o].once||f&&d[o].context!==f)&&s.push(d[o]);s.length?this._events[_]=s.length===1?s[0]:s:b(this,_)}return this},w.prototype.removeAllListeners=function(D){var T;return D?(T=P?P+D:D,this._events[T]&&b(this,T)):(this._events=new E,this._eventsCount=0),this},w.prototype.off=w.prototype.removeListener,w.prototype.addListener=w.prototype.on,w.prefixed=P,w.EventEmitter=w,he.exports=w},"./node_modules/url-toolkit/src/url-toolkit.js":function(he,H,k){(function(W){var P=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,E=/^([^\/?#]*)([^]*)$/,L=/(?:\/|^)\.(?=\/)/g,O=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,b={buildAbsoluteURL:function(w,g,D){if(D=D||{},w=w.trim(),g=g.trim(),!g){if(!D.alwaysNormalize)return w;var T=b.parseURL(w);if(!T)throw new Error("Error trying to parse base URL.");return T.path=b.normalizePath(T.path),b.buildURLFromParts(T)}var f=b.parseURL(g);if(!f)throw new Error("Error trying to parse relative URL.");if(f.scheme)return D.alwaysNormalize?(f.path=b.normalizePath(f.path),b.buildURLFromParts(f)):g;var p=b.parseURL(w);if(!p)throw new Error("Error trying to parse base URL.");if(!p.netLoc&&p.path&&p.path[0]!=="/"){var _=E.exec(p.path);p.netLoc=_[1],p.path=_[2]}p.netLoc&&!p.path&&(p.path="/");var d={scheme:p.scheme,netLoc:f.netLoc,path:null,params:f.params,query:f.query,fragment:f.fragment};if(!f.netLoc&&(d.netLoc=p.netLoc,f.path[0]!=="/"))if(!f.path)d.path=p.path,f.params||(d.params=p.params,f.query||(d.query=p.query));else{var o=p.path,s=o.substring(0,o.lastIndexOf("/")+1)+f.path;d.path=b.normalizePath(s)}return d.path===null&&(d.path=D.alwaysNormalize?b.normalizePath(f.path):f.path),b.buildURLFromParts(d)},parseURL:function(w){var g=P.exec(w);return g?{scheme:g[1]||"",netLoc:g[2]||"",path:g[3]||"",params:g[4]||"",query:g[5]||"",fragment:g[6]||""}:null},normalizePath:function(w){for(w=w.split("").reverse().join("").replace(L,"");w.length!==(w=w.replace(O,"")).length;);return w.split("").reverse().join("")},buildURLFromParts:function(w){return w.scheme+w.netLoc+w.path+w.params+w.query+w.fragment}};he.exports=b})(this)},"./node_modules/webworkify-webpack/index.js":function(he,H,k){function W(D){var T={};function f(_){if(T[_])return T[_].exports;var d=T[_]={i:_,l:!1,exports:{}};return D[_].call(d.exports,d,d.exports,f),d.l=!0,d.exports}f.m=D,f.c=T,f.i=function(_){return _},f.d=function(_,d,o){f.o(_,d)||Object.defineProperty(_,d,{configurable:!1,enumerable:!0,get:o})},f.r=function(_){Object.defineProperty(_,"__esModule",{value:!0})},f.n=function(_){var d=_&&_.__esModule?function(){return _.default}:function(){return _};return f.d(d,"a",d),d},f.o=function(_,d){return Object.prototype.hasOwnProperty.call(_,d)},f.p="/",f.oe=function(_){throw console.error(_),_};var p=f(f.s=ENTRY_MODULE);return p.default||p}var P="[\\.|\\-|\\+|\\w|/|@]+",E="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+P+").*?\\)";function L(D){return(D+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function O(D){return!isNaN(1*D)}function b(D,T,f){var p={};p[f]=[];var _=T.toString(),d=_.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return p;for(var o=d[1],s=new RegExp("(\\\\n|\\W)"+L(o)+E,"g"),a;a=s.exec(_);)a[3]!=="dll-reference"&&p[f].push(a[3]);for(s=new RegExp("\\("+L(o)+'\\("(dll-reference\\s('+P+'))"\\)\\)'+E,"g");a=s.exec(_);)D[a[2]]||(p[f].push(a[1]),D[a[2]]=k(a[1]).m),p[a[2]]=p[a[2]]||[],p[a[2]].push(a[4]);for(var u=Object.keys(p),l=0;l<u.length;l++)for(var A=0;A<p[u[l]].length;A++)O(p[u[l]][A])&&(p[u[l]][A]=1*p[u[l]][A]);return p}function w(D){var T=Object.keys(D);return T.reduce(function(f,p){return f||D[p].length>0},!1)}function g(D,T){for(var f={main:[T]},p={main:[]},_={main:{}};w(f);)for(var d=Object.keys(f),o=0;o<d.length;o++){var s=d[o],a=f[s],u=a.pop();if(_[s]=_[s]||{},!(_[s][u]||!D[s][u])){_[s][u]=!0,p[s]=p[s]||[],p[s].push(u);for(var l=b(D,D[s][u],s),A=Object.keys(l),I=0;I<A.length;I++)f[A[I]]=f[A[I]]||[],f[A[I]]=f[A[I]].concat(l[A[I]])}}return p}he.exports=function(D,T){T=T||{};var f={main:k.m},p=T.all?{main:Object.keys(f.main)}:g(f,D),_="";Object.keys(p).filter(function(u){return u!=="main"}).forEach(function(u){for(var l=0;p[u][l];)l++;p[u].push(l),f[u][l]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",_=_+"var "+u+" = ("+W.toString().replace("ENTRY_MODULE",JSON.stringify(l))+")({"+p[u].map(function(A){return""+JSON.stringify(A)+": "+f[u][A].toString()}).join(",")+`});
143
- `}),_=_+"new (("+W.toString().replace("ENTRY_MODULE",JSON.stringify(D))+")({"+p.main.map(function(u){return""+JSON.stringify(u)+": "+f.main[u].toString()}).join(",")+"}))(self);";var d=new window.Blob([_],{type:"text/javascript"});if(T.bare)return d;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,s=o.createObjectURL(d),a=new window.Worker(s);return a.objectURL=s,a}},"./src/config.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"hlsDefaultConfig",function(){return I}),k.d(H,"mergeConfig",function(){return y}),k.d(H,"enableStreamingMode",function(){return v});var W=k("./src/controller/abr-controller.ts"),P=k("./src/controller/audio-stream-controller.ts"),E=k("./src/controller/audio-track-controller.ts"),L=k("./src/controller/subtitle-stream-controller.ts"),O=k("./src/controller/subtitle-track-controller.ts"),b=k("./src/controller/buffer-controller.ts"),w=k("./src/controller/timeline-controller.ts"),g=k("./src/controller/cap-level-controller.ts"),D=k("./src/controller/fps-controller.ts"),T=k("./src/controller/eme-controller.ts"),f=k("./src/controller/cmcd-controller.ts"),p=k("./src/utils/xhr-loader.ts"),_=k("./src/utils/fetch-loader.ts"),d=k("./src/utils/cues.ts"),o=k("./src/utils/mediakeys-helper.ts"),s=k("./src/utils/logger.ts");function a(){return a=Object.assign||function(m){for(var S=1;S<arguments.length;S++){var B=arguments[S];for(var N in B)Object.prototype.hasOwnProperty.call(B,N)&&(m[N]=B[N])}return m},a.apply(this,arguments)}function u(m,S){var B=Object.keys(m);if(Object.getOwnPropertySymbols){var N=Object.getOwnPropertySymbols(m);S&&(N=N.filter(function(M){return Object.getOwnPropertyDescriptor(m,M).enumerable})),B.push.apply(B,N)}return B}function l(m){for(var S=1;S<arguments.length;S++){var B=arguments[S]!=null?arguments[S]:{};S%2?u(Object(B),!0).forEach(function(N){A(m,N,B[N])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(B)):u(Object(B)).forEach(function(N){Object.defineProperty(m,N,Object.getOwnPropertyDescriptor(B,N))})}return m}function A(m,S,B){return S in m?Object.defineProperty(m,S,{value:B,enumerable:!0,configurable:!0,writable:!0}):m[S]=B,m}var I=l(l({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:p.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:W.default,bufferController:b.default,capLevelController:g.default,fpsController:D.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:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},R()),{},{subtitleStreamController:L.SubtitleStreamController,subtitleTrackController:O.default,timelineController:w.TimelineController,audioStreamController:P.default,audioTrackController:E.default,emeController:T.default,cmcdController:f.default});function R(){return{cueHandler:d.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 y(m,S){if((S.liveSyncDurationCount||S.liveMaxLatencyDurationCount)&&(S.liveSyncDuration||S.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(S.liveMaxLatencyDurationCount!==void 0&&(S.liveSyncDurationCount===void 0||S.liveMaxLatencyDurationCount<=S.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(S.liveMaxLatencyDuration!==void 0&&(S.liveSyncDuration===void 0||S.liveMaxLatencyDuration<=S.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return a({},m,S)}function v(m){var S=m.loader;if(S!==_.default&&S!==p.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),m.progressive=!1;else{var B=Object(_.fetchSupported)();B&&(m.loader=_.default,m.progressive=!0,m.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(he,H,k){"use strict";k.r(H);var W=k("./src/polyfills/number.ts"),P=k("./src/utils/ewma-bandwidth-estimator.ts"),E=k("./src/events.ts"),L=k("./src/utils/buffer-helper.ts"),O=k("./src/errors.ts"),b=k("./src/types/loader.ts"),w=k("./src/utils/logger.ts");function g(f,p){for(var _=0;_<p.length;_++){var d=p[_];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(f,d.key,d)}}function D(f,p,_){return p&&g(f.prototype,p),_&&g(f,_),f}var T=function(){function f(_){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=_;var d=_.config;this.bwEstimator=new P.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var p=f.prototype;return p.registerListeners=function(){var d=this.hls;d.on(E.Events.FRAG_LOADING,this.onFragLoading,this),d.on(E.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(E.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(E.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(E.Events.ERROR,this.onError,this)},p.unregisterListeners=function(){var d=this.hls;d.off(E.Events.FRAG_LOADING,this.onFragLoading,this),d.off(E.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(E.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(E.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(E.Events.ERROR,this.onError,this)},p.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},p.onFragLoading=function(d,o){var s=o.frag;if(s.type===b.PlaylistLevelType.MAIN&&!this.timer){var a;this.fragCurrent=s,this.partCurrent=(a=o.part)!=null?a:null,this.timer=self.setInterval(this.onCheck,100)}},p.onLevelLoaded=function(d,o){var s=this.hls.config;o.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},p._abandonRulesCheck=function(){var d=this.fragCurrent,o=this.partCurrent,s=this.hls,a=s.autoLevelEnabled,u=s.config,l=s.media;if(!(!d||!l)){var A=o?o.stats:d.stats,I=o?o.duration:d.duration;if(A.aborted){w.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!(!a||l.paused||!l.playbackRate||!l.readyState)){var R=performance.now()-A.loading.start,y=Math.abs(l.playbackRate);if(!(R<=500*I/y)){var v=s.levels,m=s.minAutoLevel,S=v[d.level],B=A.total||Math.max(A.loaded,Math.round(I*S.maxBitrate/8)),N=Math.max(1,A.bwEstimate?A.bwEstimate/8:A.loaded*1e3/R),M=(B-A.loaded)/N,U=l.currentTime,K=(L.BufferHelper.bufferInfo(l,U,u.maxBufferHole).end-U)/y;if(!(K>=2*I/y||M<=K)){var j=Number.POSITIVE_INFINITY,X;for(X=d.level-1;X>m;X--){var ie=v[X].maxBitrate;if(j=I*ie/(8*.8*N),j<K)break}if(!(j>=M)){var se=this.bwEstimator.getEstimate();w.logger.warn("Fragment "+d.sn+(o?" part "+o.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+X+`
144
- Current BW estimate: `+(Object(W.isFiniteNumber)(se)?(se/1024).toFixed(3):"Unknown")+` Kb/s
145
- Estimated load time for current fragment: `+M.toFixed(3)+` s
146
- Estimated load time for the next fragment: `+j.toFixed(3)+` s
147
- Time to underbuffer: `+K.toFixed(3)+" s"),s.nextLoadLevel=X,this.bwEstimator.sample(R,A.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),s.trigger(E.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:o,stats:A})}}}}}},p.onFragLoaded=function(d,o){var s=o.frag,a=o.part;if(s.type===b.PlaylistLevelType.MAIN&&Object(W.isFiniteNumber)(s.sn)){var u=a?a.stats:s.stats,l=a?a.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var A=this.hls.levels[s.level],I=(A.loaded?A.loaded.bytes:0)+u.loaded,R=(A.loaded?A.loaded.duration:0)+l;A.loaded={bytes:I,duration:R},A.realBitrate=Math.round(8*I/R)}if(s.bitrateTest){var y={stats:u,frag:s,part:a,id:s.type};this.onFragBuffered(E.Events.FRAG_BUFFERED,y),s.bitrateTest=!1}}},p.onFragBuffered=function(d,o){var s=o.frag,a=o.part,u=a?a.stats:s.stats;if(!u.aborted&&!(s.type!==b.PlaylistLevelType.MAIN||s.sn==="initSegment")){var l=u.parsing.end-u.loading.start;this.bwEstimator.sample(l,u.loaded),u.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=l/1e3:this.bitrateTestDelay=0}},p.onError=function(d,o){switch(o.details){case O.ErrorDetails.FRAG_LOAD_ERROR:case O.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},p.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},p.getNextABRAutoLevel=function(){var d=this.fragCurrent,o=this.partCurrent,s=this.hls,a=s.maxAutoLevel,u=s.config,l=s.minAutoLevel,A=s.media,I=o?o.duration:d?d.duration:0,R=A?A.currentTime:0,y=A&&A.playbackRate!==0?Math.abs(A.playbackRate):1,v=this.bwEstimator?this.bwEstimator.getEstimate():u.abrEwmaDefaultEstimate,m=(L.BufferHelper.bufferInfo(A,R,u.maxBufferHole).end-R)/y,S=this.findBestLevel(v,l,a,m,u.abrBandWidthFactor,u.abrBandWidthUpFactor);if(S>=0)return S;w.logger.trace((m?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var B=I?Math.min(I,u.maxStarvationDelay):u.maxStarvationDelay,N=u.abrBandWidthFactor,M=u.abrBandWidthUpFactor;if(!m){var U=this.bitrateTestDelay;if(U){var K=I?Math.min(I,u.maxLoadingDelay):u.maxLoadingDelay;B=K-U,w.logger.trace("bitrate test took "+Math.round(1e3*U)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*B)+" ms"),N=M=1}}return S=this.findBestLevel(v,l,a,m+B,N,M),Math.max(S,0)},p.findBestLevel=function(d,o,s,a,u,l){for(var A,I=this.fragCurrent,R=this.partCurrent,y=this.lastLoadedFragLevel,v=this.hls.levels,m=v[y],S=!!(m!=null&&(A=m.details)!==null&&A!==void 0&&A.live),B=m==null?void 0:m.codecSet,N=R?R.duration:I?I.duration:0,M=s;M>=o;M--){var U=v[M];if(!(!U||B&&U.codecSet!==B)){var K=U.details,j=(R?K==null?void 0:K.partTarget:K==null?void 0:K.averagetargetduration)||N,X=void 0;M<=y?X=u*d:X=l*d;var ie=v[M].maxBitrate,se=ie*j/X;if(w.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+M+"/"+Math.round(X)+"/"+ie+"/"+j+"/"+a+"/"+se),X>ie&&(!se||S&&!this.bitrateTestDelay||se<a))return M}}return-1},D(f,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,o=this.bwEstimator;if(d!==-1&&(!o||!o.canEstimate()))return d;var s=this.getNextABRAutoLevel();return d!==-1&&(s=Math.min(d,s)),s},set:function(d){this._nextAutoLevel=d}}]),f}();H.default=T},"./src/controller/audio-stream-controller.ts":function(he,H,k){"use strict";k.r(H);var W=k("./src/polyfills/number.ts"),P=k("./src/controller/base-stream-controller.ts"),E=k("./src/events.ts"),L=k("./src/utils/buffer-helper.ts"),O=k("./src/controller/fragment-tracker.ts"),b=k("./src/types/level.ts"),w=k("./src/types/loader.ts"),g=k("./src/loader/fragment.ts"),D=k("./src/demux/chunk-cache.ts"),T=k("./src/demux/transmuxer-interface.ts"),f=k("./src/types/transmuxer.ts"),p=k("./src/controller/fragment-finders.ts"),_=k("./src/utils/discontinuities.ts"),d=k("./src/errors.ts"),o=k("./src/utils/logger.ts");function s(){return s=Object.assign||function(I){for(var R=1;R<arguments.length;R++){var y=arguments[R];for(var v in y)Object.prototype.hasOwnProperty.call(y,v)&&(I[v]=y[v])}return I},s.apply(this,arguments)}function a(I,R){I.prototype=Object.create(R.prototype),I.prototype.constructor=I,u(I,R)}function u(I,R){return u=Object.setPrototypeOf||function(v,m){return v.__proto__=m,v},u(I,R)}var l=100,A=function(I){a(R,I);function R(v,m){var S;return S=I.call(this,v,m,"[audio-stream-controller]")||this,S.videoBuffer=null,S.videoTrackCC=-1,S.waitingVideoCC=-1,S.audioSwitch=!1,S.trackId=-1,S.waitingData=null,S.mainDetails=null,S.bufferFlushed=!1,S._registerListeners(),S}var y=R.prototype;return y.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},y._registerListeners=function(){var m=this.hls;m.on(E.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.on(E.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.on(E.Events.MANIFEST_LOADING,this.onManifestLoading,this),m.on(E.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.on(E.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),m.on(E.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),m.on(E.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),m.on(E.Events.ERROR,this.onError,this),m.on(E.Events.BUFFER_RESET,this.onBufferReset,this),m.on(E.Events.BUFFER_CREATED,this.onBufferCreated,this),m.on(E.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),m.on(E.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),m.on(E.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y._unregisterListeners=function(){var m=this.hls;m.off(E.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.off(E.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.off(E.Events.MANIFEST_LOADING,this.onManifestLoading,this),m.off(E.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.off(E.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),m.off(E.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),m.off(E.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),m.off(E.Events.ERROR,this.onError,this),m.off(E.Events.BUFFER_RESET,this.onBufferReset,this),m.off(E.Events.BUFFER_CREATED,this.onBufferCreated,this),m.off(E.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),m.off(E.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),m.off(E.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y.onInitPtsFound=function(m,S){var B=S.frag,N=S.id,M=S.initPTS;if(N==="main"){var U=B.cc;this.initPTS[B.cc]=M,this.log("InitPTS for cc: "+U+" found from main: "+M),this.videoTrackCC=U,this.state===P.State.WAITING_INIT_PTS&&this.tick()}},y.startLoad=function(m){if(!this.levels){this.startPosition=m,this.state=P.State.STOPPED;return}var S=this.lastCurrentTime;this.stopLoad(),this.setInterval(l),this.fragLoadError=0,S>0&&m===-1?(this.log("Override startPosition with lastCurrentTime @"+S.toFixed(3)),this.state=P.State.IDLE):(this.loadedmetadata=!1,this.state=P.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=m,this.tick()},y.doTick=function(){switch(this.state){case P.State.IDLE:this.doTickIdle();break;case P.State.WAITING_TRACK:{var m,S=this.levels,B=this.trackId,N=S==null||(m=S[B])===null||m===void 0?void 0:m.details;if(N){if(this.waitForCdnTuneIn(N))break;this.state=P.State.WAITING_INIT_PTS}break}case P.State.FRAG_LOADING_WAITING_RETRY:{var M,U=performance.now(),K=this.retryDate;(!K||U>=K||(M=this.media)!==null&&M!==void 0&&M.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=P.State.IDLE);break}case P.State.WAITING_INIT_PTS:{var j=this.waitingData;if(j){var X=j.frag,ie=j.part,se=j.cache,le=j.complete;if(this.initPTS[X.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=P.State.FRAG_LOADING;var ve=se.flush(),q={frag:X,part:ie,payload:ve,networkDetails:null};this._handleFragmentLoadProgress(q),le&&I.prototype._handleFragmentLoadComplete.call(this,q)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+X.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ee=this.getLoadPosition(),ae=L.BufferHelper.bufferInfo(this.mediaBuffer,ee,this.config.maxBufferHole),_e=Object(p.fragmentWithinToleranceTest)(ae.end,this.config.maxFragLookUpTolerance,X);_e<0&&(o.logger.log("Waiting fragment cc ("+X.cc+") @ "+X.start+" cancelled because another fragment at "+ae.end+" is needed"),this.clearWaitingFragment())}}else this.state=P.State.IDLE}}this.onTickEnd()},y.clearWaitingFragment=function(){var m=this.waitingData;m&&(this.fragmentTracker.removeFragment(m.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=P.State.IDLE)},y.onTickEnd=function(){var m=this.media;if(!(!m||!m.readyState)){var S=this.mediaBuffer?this.mediaBuffer:m,B=S.buffered;!this.loadedmetadata&&B.length&&(this.loadedmetadata=!0),this.lastCurrentTime=m.currentTime}},y.doTickIdle=function(){var m,S,B=this.hls,N=this.levels,M=this.media,U=this.trackId,K=B.config;if(!(!N||!N[U])&&!(!M&&(this.startFragRequested||!K.startFragPrefetch))){var j=N[U],X=j.details;if(!X||X.live&&this.levelLastLoaded!==U||this.waitForCdnTuneIn(X)){this.state=P.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,g.ElementaryStreamTypes.AUDIO,w.PlaylistLevelType.AUDIO));var ie=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,w.PlaylistLevelType.AUDIO);if(ie!==null){var se=ie.len,le=this.getMaxBufferLength(),ve=this.audioSwitch;if(!(se>=le&&!ve)){if(!ve&&this._streamEnded(ie,X)){B.trigger(E.Events.BUFFER_EOS,{type:"audio"}),this.state=P.State.ENDED;return}var q=X.fragments,ee=q[0].start,ae=ie.end;if(ve){var _e=this.getLoadPosition();ae=_e,X.PTSKnown&&_e<ee&&(ie.end>ee||ie.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),M.currentTime=ee+.05)}var fe=this.getNextFragment(ae,X);if(!fe){this.bufferFlushed=!0;return}((m=fe.decryptdata)===null||m===void 0?void 0:m.keyFormat)==="identity"&&!((S=fe.decryptdata)!==null&&S!==void 0&&S.key)?this.loadKey(fe,X):this.loadFragment(fe,X,ae)}}}},y.getMaxBufferLength=function(){var m=I.prototype.getMaxBufferLength.call(this),S=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,w.PlaylistLevelType.MAIN);return S===null?m:Math.max(m,S.len)},y.onMediaDetaching=function(){this.videoBuffer=null,I.prototype.onMediaDetaching.call(this)},y.onAudioTracksUpdated=function(m,S){var B=S.audioTracks;this.resetTransmuxer(),this.levels=B.map(function(N){return new b.Level(N)})},y.onAudioTrackSwitching=function(m,S){var B=!!S.url;this.trackId=S.id;var N=this.fragCurrent;N!=null&&N.loader&&N.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),B?this.setInterval(l):this.resetTransmuxer(),B?(this.audioSwitch=!0,this.state=P.State.IDLE):this.state=P.State.STOPPED,this.tick()},y.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},y.onLevelLoaded=function(m,S){this.mainDetails=S.details},y.onAudioTrackLoaded=function(m,S){var B,N=this.levels,M=S.details,U=S.id;if(!N){this.warn("Audio tracks were reset while loading level "+U);return}this.log("Track "+U+" loaded ["+M.startSN+","+M.endSN+"],duration:"+M.totalduration);var K=N[U],j=0;if(M.live||(B=K.details)!==null&&B!==void 0&&B.live){var X=this.mainDetails;if(M.fragments[0]||(M.deltaUpdateFailed=!0),M.deltaUpdateFailed||!X)return;!K.details&&M.hasProgramDateTime&&X.hasProgramDateTime?(Object(_.alignMediaPlaylistByPDT)(M,X),j=M.fragments[0].start):j=this.alignPlaylists(M,K.details)}K.details=M,this.levelLastLoaded=U,!this.startFragRequested&&(this.mainDetails||!M.live)&&this.setStartPosition(K.details,j),this.state===P.State.WAITING_TRACK&&!this.waitForCdnTuneIn(M)&&(this.state=P.State.IDLE),this.tick()},y._handleFragmentLoadProgress=function(m){var S,B=m.frag,N=m.part,M=m.payload,U=this.config,K=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+B.sn+" of level "+B.level+" will not be buffered");return}var X=j[K];console.assert(X,"Audio track is defined on fragment load progress");var ie=X.details;console.assert(ie,"Audio track details are defined on fragment load progress");var se=U.defaultAudioCodec||X.audioCodec||"mp4a.40.2",le=this.transmuxer;le||(le=this.transmuxer=new T.default(this.hls,w.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ve=this.initPTS[B.cc],q=(S=B.initSegment)===null||S===void 0?void 0:S.data;if(ve!==void 0){var ee=!1,ae=N?N.index:-1,_e=ae!==-1,fe=new f.ChunkMetadata(B.level,B.sn,B.stats.chunkCount,M.byteLength,ae,_e);le.push(M,q,se,"",B,N,ie.totalduration,ee,fe,ve)}else{o.logger.log("Unknown video PTS for cc "+B.cc+", waiting for video PTS before demuxing audio frag "+B.sn+" of ["+ie.startSN+" ,"+ie.endSN+"],track "+K);var Ge=this.waitingData=this.waitingData||{frag:B,part:N,cache:new D.default,complete:!1},Te=Ge.cache;Te.push(new Uint8Array(M)),this.waitingVideoCC=this.videoTrackCC,this.state=P.State.WAITING_INIT_PTS}},y._handleFragmentLoadComplete=function(m){if(this.waitingData){this.waitingData.complete=!0;return}I.prototype._handleFragmentLoadComplete.call(this,m)},y.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},y.onBufferCreated=function(m,S){var B=S.tracks.audio;B&&(this.mediaBuffer=B.buffer),S.tracks.video&&(this.videoBuffer=S.tracks.video.buffer)},y.onFragBuffered=function(m,S){var B=S.frag,N=S.part;if(B.type===w.PlaylistLevelType.AUDIO){if(this.fragContextChanged(B)){this.warn("Fragment "+B.sn+(N?" p: "+N.index:"")+" of level "+B.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}B.sn!=="initSegment"&&(this.fragPrevious=B,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(E.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(B,N)}},y.onError=function(m,S){switch(S.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(w.PlaylistLevelType.AUDIO,S);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==P.State.ERROR&&this.state!==P.State.STOPPED&&(this.state=S.fatal?P.State.ERROR:P.State.IDLE,this.warn(S.details+" while loading frag, switching to "+this.state+" state"));break;case d.ErrorDetails.BUFFER_FULL_ERROR:if(S.parent==="audio"&&(this.state===P.State.PARSING||this.state===P.State.PARSED)){var B=!0,N=this.getFwdBufferInfo(this.mediaBuffer,w.PlaylistLevelType.AUDIO);N&&N.len>.5&&(B=!this.reduceMaxBufferLength(N.len)),B&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,I.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},y.onBufferFlushed=function(m,S){var B=S.type;B===g.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},y._handleTransmuxComplete=function(m){var S,B="audio",N=this.hls,M=m.remuxResult,U=m.chunkMeta,K=this.getCurrentContext(U);if(!K){this.warn("The loading context changed while buffering fragment "+U.sn+" of level "+U.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(U.level);return}var j=K.frag,X=K.part,ie=M.audio,se=M.text,le=M.id3,ve=M.initSegment;if(!this.fragContextChanged(j)){if(this.state=P.State.PARSING,this.audioSwitch&&ie&&this.completeAudioSwitch(),ve!=null&&ve.tracks&&(this._bufferInitSegment(ve.tracks,j,U),N.trigger(E.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:B,tracks:ve.tracks})),ie){var q=ie.startPTS,ee=ie.endPTS,ae=ie.startDTS,_e=ie.endDTS;X&&(X.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:q,endPTS:ee,startDTS:ae,endDTS:_e}),j.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,q,ee,ae,_e),this.bufferFragmentData(ie,j,X,U)}if(le!=null&&(S=le.samples)!==null&&S!==void 0&&S.length){var fe=s({frag:j,id:B},le);N.trigger(E.Events.FRAG_PARSING_METADATA,fe)}if(se){var Ge=s({frag:j,id:B},se);N.trigger(E.Events.FRAG_PARSING_USERDATA,Ge)}}},y._bufferInitSegment=function(m,S,B){if(this.state===P.State.PARSING){m.video&&delete m.video;var N=m.audio;if(!!N){N.levelCodec=N.codec,N.id="audio",this.log("Init audio buffer, container:"+N.container+", codecs[parsed]=["+N.codec+"]"),this.hls.trigger(E.Events.BUFFER_CODECS,m);var M=N.initSegment;if(M!=null&&M.byteLength){var U={type:"audio",frag:S,part:null,chunkMeta:B,parent:S.type,data:M};this.hls.trigger(E.Events.BUFFER_APPENDING,U)}this.tick()}}},y.loadFragment=function(m,S,B){var N=this.fragmentTracker.getState(m);this.fragCurrent=m,(this.audioSwitch||N===O.FragmentState.NOT_LOADED||N===O.FragmentState.PARTIAL)&&(m.sn==="initSegment"?this._loadInitSegment(m):S.live&&!Object(W.isFiniteNumber)(this.initPTS[m.cc])?(this.log("Waiting for video PTS in continuity counter "+m.cc+" of live stream before loading audio fragment "+m.sn+" of level "+this.trackId),this.state=P.State.WAITING_INIT_PTS):(this.startFragRequested=!0,I.prototype.loadFragment.call(this,m,S,B)))},y.completeAudioSwitch=function(){var m=this.hls,S=this.media,B=this.trackId;S&&(this.log("Switching audio track : flushing all audio"),I.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,m.trigger(E.Events.AUDIO_TRACK_SWITCHED,{id:B})},R}(P.default);H.default=A},"./src/controller/audio-track-controller.ts":function(he,H,k){"use strict";k.r(H);var W=k("./src/events.ts"),P=k("./src/errors.ts"),E=k("./src/controller/base-playlist-controller.ts"),L=k("./src/types/loader.ts");function O(T,f){for(var p=0;p<f.length;p++){var _=f[p];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(T,_.key,_)}}function b(T,f,p){return f&&O(T.prototype,f),p&&O(T,p),T}function w(T,f){T.prototype=Object.create(f.prototype),T.prototype.constructor=T,g(T,f)}function g(T,f){return g=Object.setPrototypeOf||function(_,d){return _.__proto__=d,_},g(T,f)}var D=function(T){w(f,T);function f(_){var d;return d=T.call(this,_,"[audio-track-controller]")||this,d.tracks=[],d.groupId=null,d.tracksInGroup=[],d.trackId=-1,d.trackName="",d.selectDefaultTrack=!0,d.registerListeners(),d}var p=f.prototype;return p.registerListeners=function(){var d=this.hls;d.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(W.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(W.Events.ERROR,this.onError,this)},p.unregisterListeners=function(){var d=this.hls;d.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(W.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(W.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(W.Events.ERROR,this.onError,this)},p.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,T.prototype.destroy.call(this)},p.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},p.onManifestParsed=function(d,o){this.tracks=o.audioTracks||[]},p.onAudioTrackLoaded=function(d,o){var s=o.id,a=o.details,u=this.tracksInGroup[s];if(!u){this.warn("Invalid audio track id "+s);return}var l=u.details;u.details=o.details,this.log("audioTrack "+s+" loaded ["+a.startSN+"-"+a.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,o,l))},p.onLevelLoading=function(d,o){this.switchLevel(o.level)},p.onLevelSwitching=function(d,o){this.switchLevel(o.level)},p.switchLevel=function(d){var o=this.hls.levels[d];if(!!(o!=null&&o.audioGroupIds)){var s=o.audioGroupIds[o.urlId];if(this.groupId!==s){this.groupId=s;var a=this.tracks.filter(function(l){return!s||l.groupId===s});this.selectDefaultTrack&&!a.some(function(l){return l.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=a;var u={audioTracks:a};this.log("Updating audio tracks, "+a.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(W.Events.AUDIO_TRACKS_UPDATED,u),this.selectInitialTrack()}}},p.onError=function(d,o){T.prototype.onError.call(this,d,o),!(o.fatal||!o.context)&&o.context.type===L.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},p.setAudioTrack=function(d){var o=this.tracksInGroup;if(d<0||d>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=o[this.trackId];this.log("Now switching to audio-track index "+d);var a=o[d],u=a.id,l=a.groupId,A=l===void 0?"":l,I=a.name,R=a.type,y=a.url;if(this.trackId=d,this.trackName=I,this.selectDefaultTrack=!1,this.hls.trigger(W.Events.AUDIO_TRACK_SWITCHING,{id:u,groupId:A,name:I,type:R,url:y}),!(a.details&&!a.details.live)){var v=this.switchParams(a.url,s==null?void 0:s.details);this.loadPlaylist(v)}},p.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,s=this.findTrackId(o)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(W.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},p.findTrackId=function(d){for(var o=this.tracksInGroup,s=0;s<o.length;s++){var a=o[s];if((!this.selectDefaultTrack||a.default)&&(!d||d===a.name))return a.id}return-1},p.loadPlaylist=function(d){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var s=o.id,a=o.groupId,u=o.url;if(d)try{u=d.addDirectives(u)}catch(l){this.warn("Could not construct new URL with HLS Delivery Directives: "+l)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(W.Events.AUDIO_TRACK_LOADING,{url:u,id:s,groupId:a,deliveryDirectives:d||null})}},b(f,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),f}(E.default);H.default=D},"./src/controller/base-playlist-controller.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"default",function(){return b});var W=k("./src/polyfills/number.ts"),P=k("./src/types/level.ts"),E=k("./src/controller/level-helper.ts"),L=k("./src/utils/logger.ts"),O=k("./src/errors.ts"),b=function(){function w(D,T){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=L.logger.log.bind(L.logger,T+":"),this.warn=L.logger.warn.bind(L.logger,T+":"),this.hls=D}var g=w.prototype;return g.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},g.onError=function(T,f){f.fatal&&f.type===O.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},g.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},g.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},g.stopLoad=function(){this.canLoad=!1,this.clearTimer()},g.switchParams=function(T,f){var p=f==null?void 0:f.renditionReports;if(p)for(var _=0;_<p.length;_++){var d=p[_],o=""+d.URI;if(o===T.substr(-o.length)){var s=parseInt(d["LAST-MSN"]),a=parseInt(d["LAST-PART"]);if(f&&this.hls.config.lowLatencyMode){var u=Math.min(f.age-f.partTarget,f.targetduration);a!==void 0&&u>f.partTarget&&(a+=1)}if(Object(W.isFiniteNumber)(s))return new P.HlsUrlParameters(s,Object(W.isFiniteNumber)(a)?a:void 0,P.HlsSkip.No)}}},g.loadPlaylist=function(T){},g.shouldLoadTrack=function(T){return this.canLoad&&T&&!!T.url&&(!T.details||T.details.live)},g.playlistLoaded=function(T,f,p){var _=this,d=f.details,o=f.stats,s=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(d.advancedDateTime=Date.now()-s,d.live||p!=null&&p.live){if(d.reloaded(p),p&&this.log("live playlist "+T+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),p&&d.fragments.length>0&&Object(E.mergeDetails)(p,d),!this.canLoad||!d.live)return;var a,u=void 0,l=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var A=this.hls.config.lowLatencyMode,I=d.lastPartSn,R=d.endSN,y=d.lastPartIndex,v=y!==-1,m=I===R,S=A?0:y;v?(u=m?R+1:I,l=m?S:y+1):u=R+1;var B=d.age,N=B+d.ageHeader,M=Math.min(N-d.partTarget,d.targetduration*1.5);if(M>0){if(p&&M>p.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+p.tuneInGoal+" to: "+M+" with playlist age: "+d.age),M=0;else{var U=Math.floor(M/d.targetduration);if(u+=U,l!==void 0){var K=Math.round(M%d.targetduration/d.partTarget);l+=K}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+B.toFixed(2)+"s goal: "+M+" skip sn "+U+" to part "+l)}d.tuneInGoal=M}if(a=this.getDeliveryDirectives(d,f.deliveryDirectives,u,l),A||!m){this.loadPlaylist(a);return}}else a=this.getDeliveryDirectives(d,f.deliveryDirectives,u,l);var j=Object(E.computeReloadInterval)(d,o);u!==void 0&&d.canBlockReload&&(j-=d.partTarget||1),this.log("reload live playlist "+T+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return _.loadPlaylist(a)},j)}else this.clearTimer()},g.getDeliveryDirectives=function(T,f,p,_){var d=Object(P.getSkipValue)(T,p);return f!=null&&f.skip&&T.deltaUpdateFailed&&(p=f.msn,_=f.part,d=P.HlsSkip.No),new P.HlsUrlParameters(p,_,d)},g.retryLoadingOrFail=function(T){var f=this,p=this.hls.config,_=this.retryCount<p.levelLoadingMaxRetry;if(_){var d;if(this.retryCount++,T.details.indexOf("LoadTimeOut")>-1&&(d=T.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+T.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*p.levelLoadingRetryDelay,p.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return f.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+T.details+'"')}}else this.warn('cannot recover from error "'+T.details+'"'),this.clearTimer(),T.fatal=!0;return _},w}()},"./src/controller/base-stream-controller.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"State",function(){return R}),k.d(H,"default",function(){return y});var W=k("./src/polyfills/number.ts"),P=k("./src/task-loop.ts"),E=k("./src/controller/fragment-tracker.ts"),L=k("./src/utils/buffer-helper.ts"),O=k("./src/utils/logger.ts"),b=k("./src/events.ts"),w=k("./src/errors.ts"),g=k("./src/types/transmuxer.ts"),D=k("./src/utils/mp4-tools.ts"),T=k("./src/utils/discontinuities.ts"),f=k("./src/controller/fragment-finders.ts"),p=k("./src/controller/level-helper.ts"),_=k("./src/loader/fragment-loader.ts"),d=k("./src/crypt/decrypter.ts"),o=k("./src/utils/time-ranges.ts"),s=k("./src/types/loader.ts");function a(v,m){for(var S=0;S<m.length;S++){var B=m[S];B.enumerable=B.enumerable||!1,B.configurable=!0,"value"in B&&(B.writable=!0),Object.defineProperty(v,B.key,B)}}function u(v,m,S){return m&&a(v.prototype,m),S&&a(v,S),v}function l(v){if(v===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v}function A(v,m){v.prototype=Object.create(m.prototype),v.prototype.constructor=v,I(v,m)}function I(v,m){return I=Object.setPrototypeOf||function(B,N){return B.__proto__=N,B},I(v,m)}var R={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"},y=function(v){A(m,v);function m(B,N,M){var U;return U=v.call(this)||this,U.hls=void 0,U.fragPrevious=null,U.fragCurrent=null,U.fragmentTracker=void 0,U.transmuxer=null,U._state=R.STOPPED,U.media=void 0,U.mediaBuffer=void 0,U.config=void 0,U.bitrateTest=!1,U.lastCurrentTime=0,U.nextLoadPosition=0,U.startPosition=0,U.loadedmetadata=!1,U.fragLoadError=0,U.retryDate=0,U.levels=null,U.fragmentLoader=void 0,U.levelLastLoaded=null,U.startFragRequested=!1,U.decrypter=void 0,U.initPTS=[],U.onvseeking=null,U.onvended=null,U.logPrefix="",U.log=void 0,U.warn=void 0,U.logPrefix=M,U.log=O.logger.log.bind(O.logger,M+":"),U.warn=O.logger.warn.bind(O.logger,M+":"),U.hls=B,U.fragmentLoader=new _.default(B.config),U.fragmentTracker=N,U.config=B.config,U.decrypter=new d.default(B,B.config),B.on(b.Events.KEY_LOADED,U.onKeyLoaded,l(U)),U}var S=m.prototype;return S.doTick=function(){this.onTickEnd()},S.onTickEnd=function(){},S.startLoad=function(N){},S.stopLoad=function(){this.fragmentLoader.abort();var N=this.fragCurrent;N&&this.fragmentTracker.removeFragment(N),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=R.STOPPED},S._streamEnded=function(N,M){var U=this.fragCurrent,K=this.fragmentTracker;if(!M.live&&U&&U.sn===M.endSN&&!N.nextStart){var j=K.getState(U);return j===E.FragmentState.PARTIAL||j===E.FragmentState.OK}return!1},S.onMediaAttached=function(N,M){var U=this.media=this.mediaBuffer=M.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),U.addEventListener("seeking",this.onvseeking),U.addEventListener("ended",this.onvended);var K=this.config;this.levels&&K.autoStartLoad&&this.state===R.STOPPED&&this.startLoad(K.startPosition)},S.onMediaDetaching=function(){var N=this.media;N!=null&&N.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),N&&(N.removeEventListener("seeking",this.onvseeking),N.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},S.onMediaSeeking=function(){var N=this.config,M=this.fragCurrent,U=this.media,K=this.mediaBuffer,j=this.state,X=U?U.currentTime:0,ie=L.BufferHelper.bufferInfo(K||U,X,N.maxBufferHole);if(this.log("media seeking to "+(Object(W.isFiniteNumber)(X)?X.toFixed(3):X)+", state: "+j),j===R.ENDED)this.resetLoadingState();else if(M&&!ie.len){var se=N.maxFragLookUpTolerance,le=M.start-se,ve=M.start+M.duration+se,q=X>ve;(X<le||q)&&(q&&M.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),M.loader.abort()),this.resetLoadingState())}U&&(this.lastCurrentTime=X),!this.loadedmetadata&&!ie.len&&(this.nextLoadPosition=this.startPosition=X),this.tickImmediate()},S.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},S.onKeyLoaded=function(N,M){if(!(this.state!==R.KEY_LOADING||M.frag!==this.fragCurrent||!this.levels)){this.state=R.IDLE;var U=this.levels[M.frag.level].details;U&&this.loadFragment(M.frag,U,M.frag.start)}},S.onHandlerDestroying=function(){this.stopLoad(),v.prototype.onHandlerDestroying.call(this)},S.onHandlerDestroyed=function(){this.state=R.STOPPED,this.hls.off(b.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,v.prototype.onHandlerDestroyed.call(this)},S.loadKey=function(N,M){this.log("Loading key for "+N.sn+" of ["+M.startSN+"-"+M.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+N.level),this.state=R.KEY_LOADING,this.fragCurrent=N,this.hls.trigger(b.Events.KEY_LOADING,{frag:N})},S.loadFragment=function(N,M,U){this._loadFragForPlayback(N,M,U)},S._loadFragForPlayback=function(N,M,U){var K=this,j=function(ie){if(K.fragContextChanged(N)){K.warn("Fragment "+N.sn+(ie.part?" p: "+ie.part.index:"")+" of level "+N.level+" was dropped during download."),K.fragmentTracker.removeFragment(N);return}N.stats.chunkCount++,K._handleFragmentLoadProgress(ie)};this._doFragLoad(N,M,U,j).then(function(X){if(!!X){K.fragLoadError=0;var ie=K.state;if(K.fragContextChanged(N)){(ie===R.FRAG_LOADING||ie===R.BACKTRACKING||!K.fragCurrent&&ie===R.PARSING)&&(K.fragmentTracker.removeFragment(N),K.state=R.IDLE);return}if("payload"in X&&(K.log("Loaded fragment "+N.sn+" of level "+N.level),K.hls.trigger(b.Events.FRAG_LOADED,X),K.state===R.BACKTRACKING)){K.fragmentTracker.backtrack(N,X),K.resetFragmentLoading(N);return}K._handleFragmentLoadComplete(X)}}).catch(function(X){K.warn(X),K.resetFragmentLoading(N)})},S.flushMainBuffer=function(N,M,U){if(U===void 0&&(U=null),!!(N-M)){var K={startOffset:N,endOffset:M,type:U};this.fragLoadError=0,this.hls.trigger(b.Events.BUFFER_FLUSHING,K)}},S._loadInitSegment=function(N){var M=this;this._doFragLoad(N).then(function(U){if(!U||M.fragContextChanged(N)||!M.levels)throw new Error("init load aborted");return U}).then(function(U){var K=M.hls,j=U.payload,X=N.decryptdata;if(j&&j.byteLength>0&&X&&X.key&&X.iv&&X.method==="AES-128"){var ie=self.performance.now();return M.decrypter.webCryptoDecrypt(new Uint8Array(j),X.key.buffer,X.iv.buffer).then(function(se){var le=self.performance.now();return K.trigger(b.Events.FRAG_DECRYPTED,{frag:N,payload:se,stats:{tstart:ie,tdecrypt:le}}),U.payload=se,U})}return U}).then(function(U){var K=M.fragCurrent,j=M.hls,X=M.levels;if(!X)throw new Error("init load aborted, missing levels");var ie=X[N.level].details;console.assert(ie,"Level details are defined when init segment is loaded");var se=N.stats;M.state=R.IDLE,M.fragLoadError=0,N.data=new Uint8Array(U.payload),se.parsing.start=se.buffering.start=self.performance.now(),se.parsing.end=se.buffering.end=self.performance.now(),U.frag===K&&j.trigger(b.Events.FRAG_BUFFERED,{stats:se,frag:K,part:null,id:N.type}),M.tick()}).catch(function(U){M.warn(U),M.resetFragmentLoading(N)})},S.fragContextChanged=function(N){var M=this.fragCurrent;return!N||!M||N.level!==M.level||N.sn!==M.sn||N.urlId!==M.urlId},S.fragBufferedComplete=function(N,M){var U=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+N.type+" sn: "+N.sn+(M?" part: "+M.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+N.level+" "+o.default.toString(L.BufferHelper.getBuffered(U))),this.state=R.IDLE,this.tick()},S._handleFragmentLoadComplete=function(N){var M=this.transmuxer;if(!!M){var U=N.frag,K=N.part,j=N.partsLoaded,X=!j||j.length===0||j.some(function(se){return!se}),ie=new g.ChunkMetadata(U.level,U.sn,U.stats.chunkCount+1,0,K?K.index:-1,!X);M.flush(ie)}},S._handleFragmentLoadProgress=function(N){},S._doFragLoad=function(N,M,U,K){var j=this;if(U===void 0&&(U=null),!this.levels)throw new Error("frag load aborted, missing levels");if(U=Math.max(N.start,U||0),this.config.lowLatencyMode&&M){var X=M.partList;if(X&&K){U>N.end&&M.fragmentHint&&(N=M.fragmentHint);var ie=this.getNextPart(X,N,U);if(ie>-1){var se=X[ie];return this.log("Loading part sn: "+N.sn+" p: "+se.index+" cc: "+N.cc+" of playlist ["+M.startSN+"-"+M.endSN+"] parts [0-"+ie+"-"+(X.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+N.level+", target: "+parseFloat(U.toFixed(3))),this.nextLoadPosition=se.start+se.duration,this.state=R.FRAG_LOADING,this.hls.trigger(b.Events.FRAG_LOADING,{frag:N,part:X[ie],targetBufferTime:U}),this.doFragPartsLoad(N,X,ie,K).catch(function(le){return j.handleFragLoadError(le)})}else if(!N.url||this.loadedEndOfParts(X,U))return Promise.resolve(null)}}return this.log("Loading fragment "+N.sn+" cc: "+N.cc+" "+(M?"of ["+M.startSN+"-"+M.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+N.level+", target: "+parseFloat(U.toFixed(3))),Object(W.isFiniteNumber)(N.sn)&&!this.bitrateTest&&(this.nextLoadPosition=N.start+N.duration),this.state=R.FRAG_LOADING,this.hls.trigger(b.Events.FRAG_LOADING,{frag:N,targetBufferTime:U}),this.fragmentLoader.load(N,K).catch(function(le){return j.handleFragLoadError(le)})},S.doFragPartsLoad=function(N,M,U,K){var j=this;return new Promise(function(X,ie){var se=[],le=function ve(q){var ee=M[q];j.fragmentLoader.loadPart(N,ee,K).then(function(ae){se[ee.index]=ae;var _e=ae.part;j.hls.trigger(b.Events.FRAG_LOADED,ae);var fe=M[q+1];if(fe&&fe.fragment===N)ve(q+1);else return X({frag:N,part:_e,partsLoaded:se})}).catch(ie)};le(U)})},S.handleFragLoadError=function(N){var M=N.data;return M&&M.details===w.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(M.frag,M.part):this.hls.trigger(b.Events.ERROR,M),null},S._handleTransmuxerFlush=function(N){var M=this.getCurrentContext(N);if(!M||this.state!==R.PARSING){this.fragCurrent||(this.state=R.IDLE);return}var U=M.frag,K=M.part,j=M.level,X=self.performance.now();U.stats.parsing.end=X,K&&(K.stats.parsing.end=X),this.updateLevelTiming(U,K,j,N.partial)},S.getCurrentContext=function(N){var M=this.levels,U=N.level,K=N.sn,j=N.part;if(!M||!M[U])return this.warn("Levels object was unset while buffering fragment "+K+" of level "+U+". The current chunk will not be buffered."),null;var X=M[U],ie=j>-1?Object(p.getPartWith)(X,K,j):null,se=ie?ie.fragment:Object(p.getFragmentWithSN)(X,K,this.fragCurrent);return se?{frag:se,part:ie,level:X}:null},S.bufferFragmentData=function(N,M,U,K){if(!(!N||this.state!==R.PARSING)){var j=N.data1,X=N.data2,ie=j;if(j&&X&&(ie=Object(D.appendUint8Array)(j,X)),!(!ie||!ie.length)){var se={type:N.type,frag:M,part:U,chunkMeta:K,parent:M.type,data:ie};this.hls.trigger(b.Events.BUFFER_APPENDING,se),N.dropped&&N.independent&&!U&&this.flushBufferGap(M)}}},S.flushBufferGap=function(N){var M=this.media;if(!!M){if(!L.BufferHelper.isBuffered(M,M.currentTime)){this.flushMainBuffer(0,N.start);return}var U=M.currentTime,K=L.BufferHelper.bufferInfo(M,U,0),j=N.duration,X=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),ie=Math.max(Math.min(N.start-X,K.end-X),U+X);N.start-ie>X&&this.flushMainBuffer(ie,N.start)}},S.getFwdBufferInfo=function(N,M){var U=this.config,K=this.getLoadPosition();if(!Object(W.isFiniteNumber)(K))return null;var j=L.BufferHelper.bufferInfo(N,K,U.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var X=this.fragmentTracker.getBufferedFrag(K,M);if(X&&j.nextStart<X.end)return L.BufferHelper.bufferInfo(N,K,Math.max(j.nextStart,U.maxBufferHole))}return j},S.getMaxBufferLength=function(N){var M=this.config,U;return N?U=Math.max(8*M.maxBufferSize/N,M.maxBufferLength):U=M.maxBufferLength,Math.min(U,M.maxMaxBufferLength)},S.reduceMaxBufferLength=function(N){var M=this.config,U=N||M.maxBufferLength;return M.maxMaxBufferLength>=U?(M.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+M.maxMaxBufferLength+"s"),!0):!1},S.getNextFragment=function(N,M){var U,K,j=M.fragments,X=j.length;if(!X)return null;var ie=this.config,se=j[0].start,le;if(M.live){var ve=ie.initialLiveManifestSize;if(X<ve)return this.warn("Not enough fragments to start playback (have: "+X+", need: "+ve+")"),null;!M.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(le=this.getInitialLiveFragment(M,j),this.startPosition=le?this.hls.liveSyncPosition||le.start:N)}else N<=se&&(le=j[0]);if(!le){var q=ie.lowLatencyMode?M.partEnd:M.fragmentEnd;le=this.getFragmentAtPosition(N,q,M)}return(U=le)!==null&&U!==void 0&&U.initSegment&&!((K=le)!==null&&K!==void 0&&K.initSegment.data)&&!this.bitrateTest&&(le=le.initSegment),le},S.getNextPart=function(N,M,U){for(var K=-1,j=!1,X=!0,ie=0,se=N.length;ie<se;ie++){var le=N[ie];if(X=X&&!le.independent,K>-1&&U<le.start)break;var ve=le.loaded;!ve&&(j||le.independent||X)&&le.fragment===M&&(K=ie),j=ve}return K},S.loadedEndOfParts=function(N,M){var U=N[N.length-1];return U&&M>U.start&&U.loaded},S.getInitialLiveFragment=function(N,M){var U=this.fragPrevious,K=null;if(U){if(N.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+U.programDateTime),K=Object(f.findFragmentByPDT)(M,U.endProgramDateTime,this.config.maxFragLookUpTolerance)),!K){var j=U.sn+1;if(j>=N.startSN&&j<=N.endSN){var X=M[j-N.startSN];U.cc===X.cc&&(K=X,this.log("Live playlist, switching playlist, load frag with next SN: "+K.sn))}K||(K=Object(f.findFragWithCC)(M,U.cc),K&&this.log("Live playlist, switching playlist, load frag with same CC: "+K.sn))}}else{var ie=this.hls.liveSyncPosition;ie!==null&&(K=this.getFragmentAtPosition(ie,this.bitrateTest?N.fragmentEnd:N.edge,N))}return K},S.getFragmentAtPosition=function(N,M,U){var K=this.config,j=this.fragPrevious,X=U.fragments,ie=U.endSN,se=U.fragmentHint,le=K.maxFragLookUpTolerance,ve=!!(K.lowLatencyMode&&U.partList&&se);ve&&se&&!this.bitrateTest&&(X=X.concat(se),ie=se.sn);var q;if(N<M){var ee=N>M-le?0:le;q=Object(f.findFragmentByPTS)(j,X,N,ee)}else q=X[X.length-1];if(q){var ae=q.sn-U.startSN,_e=j&&q.level===j.level,fe=X[ae+1],Ge=this.fragmentTracker.getState(q);if(Ge===E.FragmentState.BACKTRACKED){q=null;for(var Te=ae;X[Te]&&this.fragmentTracker.getState(X[Te])===E.FragmentState.BACKTRACKED;)j?q=X[Te--]:q=X[--Te];q||(q=fe)}else j&&q.sn===j.sn&&!ve&&_e&&(q.sn<ie&&this.fragmentTracker.getState(fe)!==E.FragmentState.OK?(this.log("SN "+q.sn+" just loaded, load next one: "+fe.sn),q=fe):q=null)}return q},S.synchronizeToLiveEdge=function(N){var M=this.config,U=this.media;if(!!U){var K=this.hls.liveSyncPosition,j=U.currentTime,X=N.fragments[0].start,ie=N.edge,se=j>=X-M.maxFragLookUpTolerance&&j<=ie;if(K!==null&&U.duration>K&&(j<K||!se)){var le=M.liveMaxLatencyDuration!==void 0?M.liveMaxLatencyDuration:M.liveMaxLatencyDurationCount*N.targetduration;(!se&&U.readyState<4||j<ie-le)&&(this.loadedmetadata||(this.nextLoadPosition=K),U.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+ie+", reset currentTime to : "+K.toFixed(3)),U.currentTime=K))}}},S.alignPlaylists=function(N,M){var U=this.levels,K=this.levelLastLoaded,j=this.fragPrevious,X=K!==null?U[K]:null,ie=N.fragments.length;if(!ie)return this.warn("No fragments in live playlist"),0;var se=N.fragments[0].start,le=!M,ve=N.alignedSliding&&Object(W.isFiniteNumber)(se);if(le||!ve&&!se){Object(T.alignStream)(j,X,N);var q=N.fragments[0].start;return this.log("Live playlist sliding: "+q.toFixed(2)+" start-sn: "+(M?M.startSN:"na")+"->"+N.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+ie),q}return se},S.waitForCdnTuneIn=function(N){var M=3;return N.live&&N.canBlockReload&&N.tuneInGoal>Math.max(N.partHoldBack,N.partTarget*M)},S.setStartPosition=function(N,M){var U=this.startPosition;if(U<M&&(U=-1),U===-1||this.lastCurrentTime===-1){var K=N.startTimeOffset;Object(W.isFiniteNumber)(K)?(U=M+K,K<0&&(U+=N.totalduration),U=Math.min(Math.max(M,U),M+N.totalduration),this.log("Start time offset "+K+" found in playlist, adjust startPosition to "+U),this.startPosition=U):N.live?U=this.hls.liveSyncPosition||M:this.startPosition=U=0,this.lastCurrentTime=U}this.nextLoadPosition=U},S.getLoadPosition=function(){var N=this.media,M=0;return this.loadedmetadata&&N?M=N.currentTime:this.nextLoadPosition&&(M=this.nextLoadPosition),M},S.handleFragLoadAborted=function(N,M){this.transmuxer&&N.sn!=="initSegment"&&N.stats.aborted&&(this.warn("Fragment "+N.sn+(M?" part"+M.index:"")+" of level "+N.level+" was aborted"),this.resetFragmentLoading(N))},S.resetFragmentLoading=function(N){(!this.fragCurrent||!this.fragContextChanged(N))&&(this.state=R.IDLE)},S.onFragmentOrKeyLoadError=function(N,M){if(!M.fatal){var U=M.frag;if(!(!U||U.type!==N)){var K=this.fragCurrent;console.assert(K&&U.sn===K.sn&&U.level===K.level&&U.urlId===K.urlId,"Frag load error must match current frag to retry");var j=this.config;if(this.fragLoadError+1<=j.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(U.level))return;var X=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+U.sn+" of "+N+" "+U.level+" failed to load, retrying in "+X+"ms"),this.retryDate=self.performance.now()+X,this.fragLoadError++,this.state=R.FRAG_LOADING_WAITING_RETRY}else M.levelRetry?(N===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=R.IDLE):(O.logger.error(M.details+" reaches max retry, redispatch as fatal ..."),M.fatal=!0,this.hls.stopLoad(),this.state=R.ERROR)}}},S.afterBufferFlushed=function(N,M,U){if(!!N){var K=L.BufferHelper.getBuffered(N);this.fragmentTracker.detectEvictedFragments(M,K,U),this.state===R.ENDED&&this.resetLoadingState()}},S.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=R.IDLE},S.resetLiveStartWhenNotLoaded=function(N){if(!this.loadedmetadata){this.startFragRequested=!1;var M=this.levels?this.levels[N].details:null;if(M!=null&&M.live)return this.startPosition=-1,this.setStartPosition(M,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},S.updateLevelTiming=function(N,M,U,K){var j=this,X=U.details;console.assert(!!X,"level.details must be defined");var ie=Object.keys(N.elementaryStreams).reduce(function(se,le){var ve=N.elementaryStreams[le];if(ve){var q=ve.endPTS-ve.startPTS;if(q<=0)return j.warn("Could not parse fragment "+N.sn+" "+le+" duration reliably ("+q+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),se||!1;var ee=K?0:Object(p.updateFragPTSDTS)(X,N,ve.startPTS,ve.endPTS,ve.startDTS,ve.endDTS);return j.hls.trigger(b.Events.LEVEL_PTS_UPDATED,{details:X,level:U,drift:ee,type:le,frag:N,start:ve.startPTS,end:ve.endPTS}),!0}return se},!1);ie?(this.state=R.PARSED,this.hls.trigger(b.Events.FRAG_PARSED,{frag:N,part:M})):this.resetLoadingState()},S.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},u(m,[{key:"state",get:function(){return this._state},set:function(N){var M=this._state;M!==N&&(this._state=N,this.log(M+"->"+N))}}]),m}(P.default)},"./src/controller/buffer-controller.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"default",function(){return f});var W=k("./src/polyfills/number.ts"),P=k("./src/events.ts"),E=k("./src/utils/logger.ts"),L=k("./src/errors.ts"),O=k("./src/utils/buffer-helper.ts"),b=k("./src/utils/mediasource-helper.ts"),w=k("./src/loader/fragment.ts"),g=k("./src/controller/buffer-operation-queue.ts"),D=Object(b.getMediaSource)(),T=/([ha]vc.)(?:\.[^.,]+)+/,f=function(){function p(d){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=o.hls,a=o.media,u=o.mediaSource;E.logger.log("[buffer-controller]: Media source opened"),a&&(o.updateMediaElementDuration(),s.trigger(P.Events.MEDIA_ATTACHED,{media:a})),u&&u.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){E.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){E.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var _=p.prototype;return _.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},_.destroy=function(){this.unregisterListeners(),this.details=null},_.registerListeners=function(){var o=this.hls;o.on(P.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(P.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(P.Events.BUFFER_RESET,this.onBufferReset,this),o.on(P.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(P.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(P.Events.BUFFER_EOS,this.onBufferEos,this),o.on(P.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(P.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(P.Events.FRAG_PARSED,this.onFragParsed,this),o.on(P.Events.FRAG_CHANGED,this.onFragChanged,this)},_.unregisterListeners=function(){var o=this.hls;o.off(P.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(P.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(P.Events.BUFFER_RESET,this.onBufferReset,this),o.off(P.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(P.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(P.Events.BUFFER_EOS,this.onBufferEos,this),o.off(P.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(P.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(P.Events.FRAG_PARSED,this.onFragParsed,this),o.off(P.Events.FRAG_CHANGED,this.onFragChanged,this)},_._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new g.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},_.onManifestParsed=function(o,s){var a=2;(s.audio&&!s.video||!s.altAudio)&&(a=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=a,this.details=null,E.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},_.onMediaAttaching=function(o,s){var a=this.media=s.media;if(a&&D){var u=this.mediaSource=new D;u.addEventListener("sourceopen",this._onMediaSourceOpen),u.addEventListener("sourceended",this._onMediaSourceEnded),u.addEventListener("sourceclose",this._onMediaSourceClose),a.src=self.URL.createObjectURL(u),this._objectUrl=a.src}},_.onMediaDetaching=function(){var o=this.media,s=this.mediaSource,a=this._objectUrl;if(s){if(E.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(u){E.logger.warn("[buffer-controller]: onMediaDetaching: "+u.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(a&&self.URL.revokeObjectURL(a),o.src===a?(o.removeAttribute("src"),o.load()):E.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(P.Events.MEDIA_DETACHED,void 0)},_.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(s){var a=o.sourceBuffer[s];try{a&&(o.removeBufferListeners(s),o.mediaSource&&o.mediaSource.removeSourceBuffer(a),o.sourceBuffer[s]=void 0)}catch(u){E.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",u)}}),this._initSourceBuffer()},_.onBufferCodecs=function(o,s){var a=this,u=this.getSourceBufferTypes().length;Object.keys(s).forEach(function(l){if(u){var A=a.tracks[l];if(A&&typeof A.buffer.changeType=="function"){var I=s[l],R=I.codec,y=I.levelCodec,v=I.container,m=(A.levelCodec||A.codec).replace(T,"$1"),S=(y||R).replace(T,"$1");if(m!==S){var B=v+";codecs="+(y||R);a.appendChangeType(l,B)}}}else a.pendingTracks[l]=s[l]}),!u&&(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks())},_.appendChangeType=function(o,s){var a=this,u=this.operationQueue,l={execute:function(){var I=a.sourceBuffer[o];I&&(E.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+s),I.changeType(s)),u.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(I){E.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",I)}};u.append(l,o)},_.onBufferAppending=function(o,s){var a=this,u=this.hls,l=this.operationQueue,A=this.tracks,I=s.data,R=s.type,y=s.frag,v=s.part,m=s.chunkMeta,S=m.buffering[R],B=self.performance.now();S.start=B;var N=y.stats.buffering,M=v?v.stats.buffering:null;N.start===0&&(N.start=B),M&&M.start===0&&(M.start=B);var U=A.audio,K=R==="audio"&&m.id===1&&(U==null?void 0:U.container)==="audio/mpeg",j={execute:function(){if(S.executeStart=self.performance.now(),K){var ie=a.sourceBuffer[R];if(ie){var se=y.start-ie.timestampOffset;Math.abs(se)>=.1&&(E.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+y.start+" (delta: "+se+") sn: "+y.sn+")"),ie.timestampOffset=y.start)}}a.appendExecutor(I,R)},onStart:function(){},onComplete:function(){var ie=self.performance.now();S.executeEnd=S.end=ie,N.first===0&&(N.first=ie),M&&M.first===0&&(M.first=ie);var se=a.sourceBuffer,le={};for(var ve in se)le[ve]=O.BufferHelper.getBuffered(se[ve]);a.appendError=0,a.hls.trigger(P.Events.BUFFER_APPENDED,{type:R,frag:y,part:v,chunkMeta:m,parent:y.type,timeRanges:le})},onError:function(ie){E.logger.error("[buffer-controller]: Error encountered while trying to append to the "+R+" SourceBuffer",ie);var se={type:L.ErrorTypes.MEDIA_ERROR,parent:y.type,details:L.ErrorDetails.BUFFER_APPEND_ERROR,err:ie,fatal:!1};ie.code===DOMException.QUOTA_EXCEEDED_ERR?se.details=L.ErrorDetails.BUFFER_FULL_ERROR:(a.appendError++,se.details=L.ErrorDetails.BUFFER_APPEND_ERROR,a.appendError>u.config.appendErrorMaxRetry&&(E.logger.error("[buffer-controller]: Failed "+u.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),se.fatal=!0)),u.trigger(P.Events.ERROR,se)}};l.append(j,R)},_.onBufferFlushing=function(o,s){var a=this,u=this.operationQueue,l=function(I){return{execute:a.removeExecutor.bind(a,I,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){a.hls.trigger(P.Events.BUFFER_FLUSHED,{type:I})},onError:function(y){E.logger.warn("[buffer-controller]: Failed to remove from "+I+" SourceBuffer",y)}}};s.type?u.append(l(s.type),s.type):this.getSourceBufferTypes().forEach(function(A){u.append(l(A),A)})},_.onFragParsed=function(o,s){var a=this,u=s.frag,l=s.part,A=[],I=l?l.elementaryStreams:u.elementaryStreams;I[w.ElementaryStreamTypes.AUDIOVIDEO]?A.push("audiovideo"):(I[w.ElementaryStreamTypes.AUDIO]&&A.push("audio"),I[w.ElementaryStreamTypes.VIDEO]&&A.push("video"));var R=function(){var v=self.performance.now();u.stats.buffering.end=v,l&&(l.stats.buffering.end=v);var m=l?l.stats:u.stats;a.hls.trigger(P.Events.FRAG_BUFFERED,{frag:u,part:l,stats:m,id:u.type})};A.length===0&&E.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+u.type+" level: "+u.level+" sn: "+u.sn),this.blockBuffers(R,A)},_.onFragChanged=function(o,s){this.flushBackBuffer()},_.onBufferEos=function(o,s){var a=this,u=this.getSourceBufferTypes().reduce(function(l,A){var I=a.sourceBuffer[A];return(!s.type||s.type===A)&&I&&!I.ended&&(I.ended=!0,E.logger.log("[buffer-controller]: "+A+" sourceBuffer now EOS")),l&&!!(!I||I.ended)},!0);u&&this.blockBuffers(function(){var l=a.mediaSource;!l||l.readyState!=="open"||l.endOfStream()})},_.onLevelUpdated=function(o,s){var a=s.details;!a.fragments.length||(this.details=a,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},_.flushBackBuffer=function(){var o=this.hls,s=this.details,a=this.media,u=this.sourceBuffer;if(!(!a||s===null)){var l=this.getSourceBufferTypes();if(!!l.length){var A=s.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!(!Object(W.isFiniteNumber)(A)||A<0)){var I=a.currentTime,R=s.levelTargetDuration,y=Math.max(A,R),v=Math.floor(I/R)*R-y;l.forEach(function(m){var S=u[m];if(S){var B=O.BufferHelper.getBuffered(S);B.length>0&&v>B.start(0)&&(o.trigger(P.Events.BACK_BUFFER_REACHED,{bufferEnd:v}),s.live&&o.trigger(P.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:v}),o.trigger(P.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:v,type:m}))}})}}}},_.updateMediaElementDuration=function(){if(!(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")){var o=this.details,s=this.hls,a=this.media,u=this.mediaSource,l=o.fragments[0].start+o.totalduration,A=a.duration,I=Object(W.isFiniteNumber)(u.duration)?u.duration:0;o.live&&s.config.liveDurationInfinity?(E.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),u.duration=1/0,this.updateSeekableRange(o)):(l>I&&l>A||!Object(W.isFiniteNumber)(A))&&(E.logger.log("[buffer-controller]: Updating Media Source duration to "+l.toFixed(3)),u.duration=l)}},_.updateSeekableRange=function(o){var s=this.mediaSource,a=o.fragments,u=a.length;if(u&&o.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var l=Math.max(0,a[0].start),A=Math.max(l,l+o.totalduration);s.setLiveSeekableRange(l,A)}},_.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,s=this.operationQueue,a=this.pendingTracks,u=Object.keys(a).length;if(u&&!o||u===2){this.createSourceBuffers(a),this.pendingTracks={};var l=this.getSourceBufferTypes();if(l.length===0){this.hls.trigger(P.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}l.forEach(function(A){s.executeNext(A)})}},_.createSourceBuffers=function(o){var s=this.sourceBuffer,a=this.mediaSource;if(!a)throw Error("createSourceBuffers called when mediaSource was null");var u=0;for(var l in o)if(!s[l]){var A=o[l];if(!A)throw Error("source buffer exists for track "+l+", however track does not");var I=A.levelCodec||A.codec,R=A.container+";codecs="+I;E.logger.log("[buffer-controller]: creating sourceBuffer("+R+")");try{var y=s[l]=a.addSourceBuffer(R),v=l;this.addBufferListener(v,"updatestart",this._onSBUpdateStart),this.addBufferListener(v,"updateend",this._onSBUpdateEnd),this.addBufferListener(v,"error",this._onSBUpdateError),this.tracks[l]={buffer:y,codec:I,container:A.container,levelCodec:A.levelCodec,id:A.id},u++}catch(m){E.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+m.message),this.hls.trigger(P.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:m,mimeType:R})}}u&&this.hls.trigger(P.Events.BUFFER_CREATED,{tracks:this.tracks})},_._onSBUpdateStart=function(o){var s=this.operationQueue,a=s.current(o);a.onStart()},_._onSBUpdateEnd=function(o){var s=this.operationQueue,a=s.current(o);a.onComplete(),s.shiftAndExecuteNext(o)},_._onSBUpdateError=function(o,s){E.logger.error("[buffer-controller]: "+o+" SourceBuffer error",s),this.hls.trigger(P.Events.ERROR,{type:L.ErrorTypes.MEDIA_ERROR,details:L.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var a=this.operationQueue.current(o);a&&a.onError(s)},_.removeExecutor=function(o,s,a){var u=this.media,l=this.mediaSource,A=this.operationQueue,I=this.sourceBuffer,R=I[o];if(!u||!l||!R){E.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),A.shiftAndExecuteNext(o);return}var y=Object(W.isFiniteNumber)(u.duration)?u.duration:1/0,v=Object(W.isFiniteNumber)(l.duration)?l.duration:1/0,m=Math.max(0,s),S=Math.min(a,y,v);S>m?(E.logger.log("[buffer-controller]: Removing ["+m+","+S+"] from the "+o+" SourceBuffer"),console.assert(!R.updating,o+" sourceBuffer must not be updating"),R.remove(m,S)):A.shiftAndExecuteNext(o)},_.appendExecutor=function(o,s){var a=this.operationQueue,u=this.sourceBuffer,l=u[s];if(!l){E.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),a.shiftAndExecuteNext(s);return}l.ended=!1,console.assert(!l.updating,s+" sourceBuffer must not be updating"),l.appendBuffer(o)},_.blockBuffers=function(o,s){var a=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){E.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var u=this.operationQueue,l=s.map(function(A){return u.appendBlocker(A)});Promise.all(l).then(function(){o(),s.forEach(function(A){var I=a.sourceBuffer[A];(!I||!I.updating)&&u.shiftAndExecuteNext(A)})})},_.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},_.addBufferListener=function(o,s,a){var u=this.sourceBuffer[o];if(!!u){var l=a.bind(this,o);this.listeners[o].push({event:s,listener:l}),u.addEventListener(s,l)}},_.removeBufferListeners=function(o){var s=this.sourceBuffer[o];!s||this.listeners[o].forEach(function(a){s.removeEventListener(a.event,a.listener)})},p}()},"./src/controller/buffer-operation-queue.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"default",function(){return P});var W=k("./src/utils/logger.ts"),P=function(){function E(O){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=O}var L=E.prototype;return L.append=function(b,w){var g=this.queues[w];g.push(b),g.length===1&&this.buffers[w]&&this.executeNext(w)},L.insertAbort=function(b,w){var g=this.queues[w];g.unshift(b),this.executeNext(w)},L.appendBlocker=function(b){var w,g=new Promise(function(T){w=T}),D={execute:w,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(D,b),g},L.executeNext=function(b){var w=this.buffers,g=this.queues,D=w[b],T=g[b];if(T.length){var f=T[0];try{f.execute()}catch(p){W.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),f.onError(p),(!D||!D.updating)&&(T.shift(),this.executeNext(b))}}},L.shiftAndExecuteNext=function(b){this.queues[b].shift(),this.executeNext(b)},L.current=function(b){return this.queues[b][0]},E}()},"./src/controller/cap-level-controller.ts":function(he,H,k){"use strict";k.r(H);var W=k("./src/events.ts");function P(O,b){for(var w=0;w<b.length;w++){var g=b[w];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(O,g.key,g)}}function E(O,b,w){return b&&P(O.prototype,b),w&&P(O,w),O}var L=function(){function O(w){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=w,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var b=O.prototype;return b.setStreamController=function(g){this.streamController=g},b.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},b.registerListeners=function(){var g=this.hls;g.on(W.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.on(W.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.on(W.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},b.unregisterListener=function(){var g=this.hls;g.off(W.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.off(W.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.off(W.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},b.onFpsDropLevelCapping=function(g,D){O.isLevelAllowed(D.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(D.droppedLevel)},b.onMediaAttaching=function(g,D){this.media=D.media instanceof HTMLVideoElement?D.media:null},b.onManifestParsed=function(g,D){var T=this.hls;this.restrictedLevels=[],this.firstLevel=D.firstLevel,T.config.capLevelToPlayerSize&&D.video&&this.startCapping()},b.onBufferCodecs=function(g,D){var T=this.hls;T.config.capLevelToPlayerSize&&D.video&&this.startCapping()},b.onMediaDetaching=function(){this.stopCapping()},b.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var g=this.hls.levels;if(g.length){var D=this.hls;D.autoLevelCapping=this.getMaxLevel(g.length-1),D.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=D.autoLevelCapping}}},b.getMaxLevel=function(g){var D=this,T=this.hls.levels;if(!T.length)return-1;var f=T.filter(function(p,_){return O.isLevelAllowed(_,D.restrictedLevels)&&_<=g});return this.clientRect=null,O.getMaxLevelByMediaSize(f,this.mediaWidth,this.mediaHeight)},b.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},b.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},b.getDimensions=function(){if(this.clientRect)return this.clientRect;var g=this.media,D={width:0,height:0};if(g){var T=g.getBoundingClientRect();D.width=T.width,D.height=T.height,!D.width&&!D.height&&(D.width=T.right-T.left||g.width||0,D.height=T.bottom-T.top||g.height||0)}return this.clientRect=D,D},O.isLevelAllowed=function(g,D){return D===void 0&&(D=[]),D.indexOf(g)===-1},O.getMaxLevelByMediaSize=function(g,D,T){if(!g||!g.length)return-1;for(var f=function(s,a){return a?s.width!==a.width||s.height!==a.height:!0},p=g.length-1,_=0;_<g.length;_+=1){var d=g[_];if((d.width>=D||d.height>=T)&&f(d,g[_+1])){p=_;break}}return p},E(O,[{key:"mediaWidth",get:function(){return this.getDimensions().width*O.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*O.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var g=1;try{g=self.devicePixelRatio}catch(D){}return g}}]),O}();H.default=L},"./src/controller/cmcd-controller.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"default",function(){return f});var W=k("./src/events.ts"),P=k("./src/types/cmcd.ts"),E=k("./src/utils/buffer-helper.ts"),L=k("./src/utils/logger.ts");function O(p,_){for(var d=0;d<_.length;d++){var o=_[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(p,o.key,o)}}function b(p,_,d){return _&&O(p.prototype,_),d&&O(p,d),p}function w(p,_){var d=typeof Symbol!="undefined"&&p[Symbol.iterator]||p["@@iterator"];if(d)return(d=d.call(p)).next.bind(d);if(Array.isArray(p)||(d=g(p))||_&&p&&typeof p.length=="number"){d&&(p=d);var o=0;return function(){return o>=p.length?{done:!0}:{done:!1,value:p[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
148
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function g(p,_){if(!!p){if(typeof p=="string")return D(p,_);var d=Object.prototype.toString.call(p).slice(8,-1);if(d==="Object"&&p.constructor&&(d=p.constructor.name),d==="Map"||d==="Set")return Array.from(p);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return D(p,_)}}function D(p,_){(_==null||_>p.length)&&(_=p.length);for(var d=0,o=new Array(_);d<_;d++)o[d]=p[d];return o}function T(){return T=Object.assign||function(p){for(var _=1;_<arguments.length;_++){var d=arguments[_];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(p[o]=d[o])}return p},T.apply(this,arguments)}var f=function(){function p(d){var o=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(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(u){try{o.apply(u,{ot:P.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(l){L.logger.warn("Could not generate manifest CMCD data.",l)}},this.applyFragmentData=function(u){try{var l=u.frag,A=o.hls.levels[l.level],I=o.getObjectType(l),R={d:l.duration*1e3,ot:I};(I===P.CMCDObjectType.VIDEO||I===P.CMCDObjectType.AUDIO||I==P.CMCDObjectType.MUXED)&&(R.br=A.bitrate/1e3,R.tb=o.getTopBandwidth(I),R.bl=o.getBufferLength(I)),o.apply(u,R)}catch(y){L.logger.warn("Could not generate segment CMCD data.",y)}},this.hls=d;var s=this.config=d.config,a=s.cmcd;a!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=a.sessionId||p.uuid(),this.cid=a.contentId,this.useHeaders=a.useHeaders===!0,this.registerListeners())}var _=p.prototype;return _.registerListeners=function(){var o=this.hls;o.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(W.Events.BUFFER_CREATED,this.onBufferCreated,this)},_.unregisterListeners=function(){var o=this.hls;o.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(W.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},_.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},_.onMediaAttached=function(o,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},_.onMediaDetached=function(){!this.media||(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},_.onBufferCreated=function(o,s){var a,u;this.audioBuffer=(a=s.tracks.audio)===null||a===void 0?void 0:a.buffer,this.videoBuffer=(u=s.tracks.video)===null||u===void 0?void 0:u.buffer},_.createData=function(){var o;return{v:P.CMCDVersion,sf:P.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},_.apply=function(o,s){s===void 0&&(s={}),T(s,this.createData());var a=s.ot===P.CMCDObjectType.INIT||s.ot===P.CMCDObjectType.VIDEO||s.ot===P.CMCDObjectType.MUXED;if(this.starved&&a&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var u=p.toHeaders(s);if(!Object.keys(u).length)return;o.headers||(o.headers={}),T(o.headers,u)}else{var l=p.toQuery(s);if(!l)return;o.url=p.appendQueryToUri(o.url,l)}},_.getObjectType=function(o){var s=o.type;if(s==="subtitle")return P.CMCDObjectType.TIMED_TEXT;if(o.sn==="initSegment")return P.CMCDObjectType.INIT;if(s==="audio")return P.CMCDObjectType.AUDIO;if(s==="main")return this.hls.audioTracks.length?P.CMCDObjectType.VIDEO:P.CMCDObjectType.MUXED},_.getTopBandwidth=function(o){for(var s=0,a=o===P.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,u=w(a),l;!(l=u()).done;){var A=l.value;A.bitrate>s&&(s=A.bitrate)}return s>0?s:NaN},_.getBufferLength=function(o){var s=this.hls.media,a=o===P.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!a||!s)return NaN;var u=E.BufferHelper.bufferInfo(a,s.currentTime,this.config.maxBufferHole);return u.len*1e3},_.createPlaylistLoader=function(){var o=this.config.pLoader,s=this.applyPlaylistData,a=o||this.config.loader;return function(){function u(A){this.loader=void 0,this.loader=new a(A)}var l=u.prototype;return l.destroy=function(){this.loader.destroy()},l.abort=function(){this.loader.abort()},l.load=function(I,R,y){s(I),this.loader.load(I,R,y)},b(u,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),u}()},_.createFragmentLoader=function(){var o=this.config.fLoader,s=this.applyFragmentData,a=o||this.config.loader;return function(){function u(A){this.loader=void 0,this.loader=new a(A)}var l=u.prototype;return l.destroy=function(){this.loader.destroy()},l.abort=function(){this.loader.abort()},l.load=function(I,R,y){s(I),this.loader.load(I,R,y)},b(u,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),u}()},p.uuid=function(){var o=URL.createObjectURL(new Blob),s=o.toString();return URL.revokeObjectURL(o),s.substr(s.lastIndexOf("/")+1)},p.serialize=function(o){for(var s=[],a=function(K){return!Number.isNaN(K)&&K!=null&&K!==""&&K!==!1},u=function(K){return Math.round(K)},l=function(K){return u(K/100)*100},A=function(K){return encodeURIComponent(K)},I={br:u,d:u,bl:l,dl:l,mtp:l,nor:A,rtp:l,tb:u},R=Object.keys(o||{}).sort(),y=w(R),v;!(v=y()).done;){var m=v.value,S=o[m];if(!!a(S)&&!(m==="v"&&S===1)&&!(m=="pr"&&S===1)){var B=I[m];B&&(S=B(S));var N=typeof S,M=void 0;m==="ot"||m==="sf"||m==="st"?M=m+"="+S:N==="boolean"?M=m:N==="number"?M=m+"="+S:M=m+"="+JSON.stringify(S),s.push(M)}}return s.join(",")},p.toHeaders=function(o){for(var s=Object.keys(o),a={},u=["Object","Request","Session","Status"],l=[{},{},{},{}],A={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},I=0,R=s;I<R.length;I++){var y=R[I],v=A[y]!=null?A[y]:1;l[v][y]=o[y]}for(var m=0;m<l.length;m++){var S=p.serialize(l[m]);S&&(a["CMCD-"+u[m]]=S)}return a},p.toQuery=function(o){return"CMCD="+encodeURIComponent(p.serialize(o))},p.appendQueryToUri=function(o,s){if(!s)return o;var a=o.includes("?")?"&":"?";return""+o+a+s},p}()},"./src/controller/eme-controller.ts":function(he,H,k){"use strict";k.r(H);var W=k("./src/events.ts"),P=k("./src/errors.ts"),E=k("./src/utils/logger.ts"),L=k("./src/utils/mediakeys-helper.ts");function O(f,p){for(var _=0;_<p.length;_++){var d=p[_];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(f,d.key,d)}}function b(f,p,_){return p&&O(f.prototype,p),_&&O(f,_),f}var w=3,g=function(p,_,d){var o={audioCapabilities:[],videoCapabilities:[]};return p.forEach(function(s){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:d.audioRobustness||""})}),_.forEach(function(s){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:d.videoRobustness||""})}),[o]},D=function(p,_,d,o){switch(p){case L.KeySystems.WIDEVINE:return g(_,d,o);default:throw new Error("Unknown key-system: "+p)}},T=function(){function f(_){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=_,this._config=_.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 p=f.prototype;return p.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},p._registerListeners=function(){this.hls.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this)},p._unregisterListeners=function(){this.hls.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this)},p.getLicenseServerUrl=function(d){switch(d){case L.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},p._attemptKeySystemAccess=function(d,o,s){var a=this,u=D(d,o,s,this._drmSystemOptions);E.logger.log("Requesting encrypted media key-system access");var l=this.requestMediaKeySystemAccess(d,u);this.mediaKeysPromise=l.then(function(A){return a._onMediaKeySystemAccessObtained(d,A)}),l.catch(function(A){E.logger.error('Failed to obtain key-system "'+d+'" access:',A)})},p._onMediaKeySystemAccessObtained=function(d,o){var s=this;E.logger.log('Access for key-system "'+d+'" obtained');var a={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:d};this._mediaKeysList.push(a);var u=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(l){return a.mediaKeys=l,E.logger.log('Media-keys created for key-system "'+d+'"'),s._onMediaKeysCreated(),l});return u.catch(function(l){E.logger.error("Failed to create media-keys:",l)}),u},p._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),d._onNewMediaKeySession(o.mediaKeysSession))})},p._onNewMediaKeySession=function(d){var o=this;E.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(s){o._onKeySessionMessage(d,s.message)},!1)},p._onKeySessionMessage=function(d,o){E.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(s){E.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),d.update(s)})},p.onMediaEncrypted=function(d){var o=this;if(E.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){E.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(W.Events.ERROR,{type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(u){!o._media||(o._attemptSetMediaKeys(u),o._generateRequestWithPreferredKeySession(d.initDataType,d.initData))};this.mediaKeysPromise.then(s).catch(s)},p._attemptSetMediaKeys=function(d){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){E.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(W.Events.ERROR,{type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}E.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},p._generateRequestWithPreferredKeySession=function(d,o){var s=this,a=this._mediaKeysList[0];if(!a){E.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(W.Events.ERROR,{type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(a.mediaKeysSessionInitialized){E.logger.warn("Key-Session already initialized but requested again");return}var u=a.mediaKeysSession;if(!u){E.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(W.Events.ERROR,{type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){E.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(W.Events.ERROR,{type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}E.logger.log('Generating key-session request for "'+d+'" init data type'),a.mediaKeysSessionInitialized=!0,u.generateRequest(d,o).then(function(){E.logger.debug("Key-session generation succeeded")}).catch(function(l){E.logger.error("Error generating key-session request:",l),s.hls.trigger(W.Events.ERROR,{type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},p._createLicenseXhr=function(d,o,s){var a=new XMLHttpRequest;a.responseType="arraybuffer",a.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,a,d,o,s);var u=this._licenseXhrSetup;if(u)try{u.call(this.hls,a,d),u=void 0}catch(l){E.logger.error(l)}try{a.readyState||a.open("POST",d,!0),u&&u.call(this.hls,a,d)}catch(l){throw new Error("issue setting up KeySystem license XHR "+l)}return a},p._onLicenseRequestReadyStageChange=function(d,o,s,a){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,E.logger.log("License request succeeded");var u=d.response,l=this._licenseResponseCallback;if(l)try{u=l.call(this.hls,d,o)}catch(I){E.logger.error(I)}a(u)}else{if(E.logger.error("License Request XHR failed ("+o+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>w){this.hls.trigger(W.Events.ERROR,{type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var A=w-this._requestLicenseFailureCount+1;E.logger.warn("Retrying license request, "+A+" attempts left"),this._requestLicense(s,a)}break}},p._generateLicenseRequestChallenge=function(d,o){switch(d.mediaKeySystemDomain){case L.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},p._requestLicense=function(d,o){E.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){E.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(W.Events.ERROR,{type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var a=this.getLicenseServerUrl(s.mediaKeySystemDomain),u=this._createLicenseXhr(a,d,o);E.logger.log("Sending license request to URL: "+a);var l=this._generateLicenseRequestChallenge(s,d);u.send(l)}catch(A){E.logger.error("Failure requesting DRM license: "+A),this.hls.trigger(W.Events.ERROR,{type:P.ErrorTypes.KEY_SYSTEM_ERROR,details:P.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},p.onMediaAttached=function(d,o){if(!!this._emeEnabled){var s=o.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)}},p.onMediaDetached=function(){var d=this._media,o=this._mediaKeysList;!d||(d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){}))},p.onManifestParsed=function(d,o){if(!!this._emeEnabled){var s=o.levels.map(function(u){return u.audioCodec}).filter(function(u){return!!u}),a=o.levels.map(function(u){return u.videoCodec}).filter(function(u){return!!u});this._attemptKeySystemAccess(L.KeySystems.WIDEVINE,s,a)}},b(f,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),f}();H.default=T},"./src/controller/fps-controller.ts":function(he,H,k){"use strict";k.r(H);var W=k("./src/events.ts"),P=k("./src/utils/logger.ts"),E=function(){function L(b){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=b,this.registerListeners()}var O=L.prototype;return O.setStreamController=function(w){this.streamController=w},O.registerListeners=function(){this.hls.on(W.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},O.unregisterListeners=function(){this.hls.off(W.Events.MEDIA_ATTACHING,this.onMediaAttaching)},O.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},O.onMediaAttaching=function(w,g){var D=this.hls.config;if(D.capLevelOnFPSDrop){var T=g.media instanceof self.HTMLVideoElement?g.media:null;this.media=T,T&&typeof T.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),D.fpsDroppedMonitoringPeriod)}},O.checkFPS=function(w,g,D){var T=performance.now();if(g){if(this.lastTime){var f=T-this.lastTime,p=D-this.lastDroppedFrames,_=g-this.lastDecodedFrames,d=1e3*p/f,o=this.hls;if(o.trigger(W.Events.FPS_DROP,{currentDropped:p,currentDecoded:_,totalDroppedFrames:D}),d>0&&p>o.config.fpsDroppedMonitoringThreshold*_){var s=o.currentLevel;P.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=s)&&(s=s-1,o.trigger(W.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:o.currentLevel}),o.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=T,this.lastDroppedFrames=D,this.lastDecodedFrames=g}},O.checkFPSInterval=function(){var w=this.media;if(w)if(this.isVideoPlaybackQualityAvailable){var g=w.getVideoPlaybackQuality();this.checkFPS(w,g.totalVideoFrames,g.droppedVideoFrames)}else this.checkFPS(w,w.webkitDecodedFrameCount,w.webkitDroppedFrameCount)},L}();H.default=E},"./src/controller/fragment-finders.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"findFragmentByPDT",function(){return E}),k.d(H,"findFragmentByPTS",function(){return L}),k.d(H,"fragmentWithinToleranceTest",function(){return O}),k.d(H,"pdtWithinToleranceTest",function(){return b}),k.d(H,"findFragWithCC",function(){return w});var W=k("./src/polyfills/number.ts"),P=k("./src/utils/binary-search.ts");function E(g,D,T){if(D===null||!Array.isArray(g)||!g.length||!Object(W.isFiniteNumber)(D))return null;var f=g[0].programDateTime;if(D<(f||0))return null;var p=g[g.length-1].endProgramDateTime;if(D>=(p||0))return null;T=T||0;for(var _=0;_<g.length;++_){var d=g[_];if(b(D,T,d))return d}return null}function L(g,D,T,f){T===void 0&&(T=0),f===void 0&&(f=0);var p=null;if(g?p=D[g.sn-D[0].sn+1]||null:T===0&&D[0].start===0&&(p=D[0]),p&&O(T,f,p)===0)return p;var _=P.default.search(D,O.bind(null,T,f));return _||p}function O(g,D,T){g===void 0&&(g=0),D===void 0&&(D=0);var f=Math.min(D,T.duration+(T.deltaPTS?T.deltaPTS:0));return T.start+T.duration-f<=g?1:T.start-f>g&&T.start?-1:0}function b(g,D,T){var f=Math.min(D,T.duration+(T.deltaPTS?T.deltaPTS:0))*1e3,p=T.endProgramDateTime||0;return p-f>g}function w(g,D){return P.default.search(g,function(T){return T.cc<D?1:T.cc>D?-1:0})}},"./src/controller/fragment-tracker.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"FragmentState",function(){return E}),k.d(H,"FragmentTracker",function(){return L});var W=k("./src/events.ts"),P=k("./src/types/loader.ts"),E;(function(w){w.NOT_LOADED="NOT_LOADED",w.BACKTRACKED="BACKTRACKED",w.APPENDING="APPENDING",w.PARTIAL="PARTIAL",w.OK="OK"})(E||(E={}));var L=function(){function w(D){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=D,this._registerListeners()}var g=w.prototype;return g._registerListeners=function(){var T=this.hls;T.on(W.Events.BUFFER_APPENDED,this.onBufferAppended,this),T.on(W.Events.FRAG_BUFFERED,this.onFragBuffered,this),T.on(W.Events.FRAG_LOADED,this.onFragLoaded,this)},g._unregisterListeners=function(){var T=this.hls;T.off(W.Events.BUFFER_APPENDED,this.onBufferAppended,this),T.off(W.Events.FRAG_BUFFERED,this.onFragBuffered,this),T.off(W.Events.FRAG_LOADED,this.onFragLoaded,this)},g.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},g.getAppendedFrag=function(T,f){if(f===P.PlaylistLevelType.MAIN){var p=this.activeFragment,_=this.activeParts;if(!p)return null;if(_)for(var d=_.length;d--;){var o=_[d],s=o?o.end:p.appendedPTS;if(o.start<=T&&s!==void 0&&T<=s)return d>9&&(this.activeParts=_.slice(d-9)),o}else if(p.start<=T&&p.appendedPTS!==void 0&&T<=p.appendedPTS)return p}return this.getBufferedFrag(T,f)},g.getBufferedFrag=function(T,f){for(var p=this.fragments,_=Object.keys(p),d=_.length;d--;){var o=p[_[d]];if((o==null?void 0:o.body.type)===f&&o.buffered){var s=o.body;if(s.start<=T&&T<=s.end)return s}}return null},g.detectEvictedFragments=function(T,f,p){var _=this;Object.keys(this.fragments).forEach(function(d){var o=_.fragments[d];if(!!o){if(!o.buffered){o.body.type===p&&_.removeFragment(o.body);return}var s=o.range[T];!s||s.time.some(function(a){var u=!_.isTimeBuffered(a.startPTS,a.endPTS,f);return u&&_.removeFragment(o.body),u})}})},g.detectPartialFragments=function(T){var f=this,p=this.timeRanges,_=T.frag,d=T.part;if(!(!p||_.sn==="initSegment")){var o=b(_),s=this.fragments[o];!s||(Object.keys(p).forEach(function(a){var u=_.elementaryStreams[a];if(!!u){var l=p[a],A=d!==null||u.partial===!0;s.range[a]=f.getBufferedTimes(_,d,A,l)}}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body))}},g.fragBuffered=function(T){var f=b(T),p=this.fragments[f];p&&(p.backtrack=p.loaded=null,p.buffered=!0)},g.getBufferedTimes=function(T,f,p,_){for(var d={time:[],partial:p},o=f?f.start:T.start,s=f?f.end:T.end,a=T.minEndPTS||s,u=T.maxStartPTS||o,l=0;l<_.length;l++){var A=_.start(l)-this.bufferPadding,I=_.end(l)+this.bufferPadding;if(u>=A&&a<=I){d.time.push({startPTS:Math.max(o,_.start(l)),endPTS:Math.min(s,_.end(l))});break}else if(o<I&&s>A)d.partial=!0,d.time.push({startPTS:Math.max(o,_.start(l)),endPTS:Math.min(s,_.end(l))});else if(s<=A)break}return d},g.getPartialFragment=function(T){var f=null,p,_,d,o=0,s=this.bufferPadding,a=this.fragments;return Object.keys(a).forEach(function(u){var l=a[u];!l||O(l)&&(_=l.body.start-s,d=l.body.end+s,T>=_&&T<=d&&(p=Math.min(T-_,d-T),o<=p&&(f=l.body,o=p)))}),f},g.getState=function(T){var f=b(T),p=this.fragments[f];return p?p.buffered?O(p)?E.PARTIAL:E.OK:p.backtrack?E.BACKTRACKED:E.APPENDING:E.NOT_LOADED},g.backtrack=function(T,f){var p=b(T),_=this.fragments[p];if(!_||_.backtrack)return null;var d=_.backtrack=f||_.loaded;return _.loaded=null,d},g.getBacktrackData=function(T){var f=b(T),p=this.fragments[f];if(p){var _,d=p.backtrack;if(d!=null&&(_=d.payload)!==null&&_!==void 0&&_.byteLength)return d;this.removeFragment(T)}return null},g.isTimeBuffered=function(T,f,p){for(var _,d,o=0;o<p.length;o++){if(_=p.start(o)-this.bufferPadding,d=p.end(o)+this.bufferPadding,T>=_&&f<=d)return!0;if(f<=_)return!1}return!1},g.onFragLoaded=function(T,f){var p=f.frag,_=f.part;if(!(p.sn==="initSegment"||p.bitrateTest||_)){var d=b(p);this.fragments[d]={body:p,loaded:f,backtrack:null,buffered:!1,range:Object.create(null)}}},g.onBufferAppended=function(T,f){var p=this,_=f.frag,d=f.part,o=f.timeRanges;if(_.type===P.PlaylistLevelType.MAIN)if(this.activeFragment=_,d){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(d)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(a){var u=o[a];if(p.detectEvictedFragments(a,u),!d)for(var l=0;l<u.length;l++)_.appendedPTS=Math.max(u.end(l),_.appendedPTS||0)})},g.onFragBuffered=function(T,f){this.detectPartialFragments(f)},g.hasFragment=function(T){var f=b(T);return!!this.fragments[f]},g.removeFragmentsInRange=function(T,f,p){var _=this;Object.keys(this.fragments).forEach(function(d){var o=_.fragments[d];if(!!o&&o.buffered){var s=o.body;s.type===p&&s.start<f&&s.end>T&&_.removeFragment(s)}})},g.removeFragment=function(T){var f=b(T);T.stats.loaded=0,T.clearElementaryStreamInfo(),delete this.fragments[f]},g.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},w}();function O(w){var g,D;return w.buffered&&(((g=w.range.video)===null||g===void 0?void 0:g.partial)||((D=w.range.audio)===null||D===void 0?void 0:D.partial))}function b(w){return w.type+"_"+w.level+"_"+w.urlId+"_"+w.sn}},"./src/controller/gap-controller.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"STALL_MINIMUM_DURATION_MS",function(){return O}),k.d(H,"MAX_START_GAP_JUMP",function(){return b}),k.d(H,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return w}),k.d(H,"SKIP_BUFFER_RANGE_START",function(){return g}),k.d(H,"default",function(){return D});var W=k("./src/utils/buffer-helper.ts"),P=k("./src/errors.ts"),E=k("./src/events.ts"),L=k("./src/utils/logger.ts"),O=250,b=2,w=.1,g=.05,D=function(){function T(p,_,d,o){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=p,this.media=_,this.fragmentTracker=d,this.hls=o}var f=T.prototype;return f.destroy=function(){this.hls=this.fragmentTracker=this.media=null},f.poll=function(_){var d=this.config,o=this.media,s=this.stalled,a=o.currentTime,u=o.seeking,l=this.seeking&&!u,A=!this.seeking&&u;if(this.seeking=u,a!==_){if(this.moved=!0,s!==null){if(this.stallReported){var I=self.performance.now()-s;L.logger.warn("playback not stuck anymore @"+a+", after "+Math.round(I)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((A||l)&&(this.stalled=null),!(o.paused||o.ended||o.playbackRate===0||!W.BufferHelper.getBuffered(o).length)){var R=W.BufferHelper.bufferInfo(o,a,0),y=R.len>0,v=R.nextStart||0;if(!(!y&&!v)){if(u){var m=R.len>b,S=!v||v-a>b&&!this.fragmentTracker.getPartialFragment(a);if(m||S)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var B,N=Math.max(v,R.start||0)-a,M=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,U=M==null||(B=M.details)===null||B===void 0?void 0:B.live,K=U?M.details.targetduration*2:b;if(N>0&&N<=K){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(s===null){this.stalled=j;return}var X=j-s;!u&&X>=O&&this._reportStall(R.len);var ie=W.BufferHelper.bufferInfo(o,a,d.maxBufferHole);this._tryFixBufferStall(ie,X)}}},f._tryFixBufferStall=function(_,d){var o=this.config,s=this.fragmentTracker,a=this.media,u=a.currentTime,l=s.getPartialFragment(u);if(l){var A=this._trySkipBufferHole(l);if(A)return}_.len>o.maxBufferHole&&d>o.highBufferWatchdogPeriod*1e3&&(L.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},f._reportStall=function(_){var d=this.hls,o=this.media,s=this.stallReported;s||(this.stallReported=!0,L.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+_+")"),d.trigger(E.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:_}))},f._trySkipBufferHole=function(_){for(var d=this.config,o=this.hls,s=this.media,a=s.currentTime,u=0,l=W.BufferHelper.getBuffered(s),A=0;A<l.length;A++){var I=l.start(A);if(a+d.maxBufferHole>=u&&a<I){var R=Math.max(I+g,s.currentTime+w);return L.logger.warn("skipping hole, adjusting currentTime from "+a+" to "+R),this.moved=!0,this.stalled=null,s.currentTime=R,_&&o.trigger(E.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+a+" to "+R,frag:_}),R}u=l.end(A)}return 0},f._tryNudgeBuffer=function(){var _=this.config,d=this.hls,o=this.media,s=o.currentTime,a=(this.nudgeRetry||0)+1;if(this.nudgeRetry=a,a<_.nudgeMaxRetry){var u=s+a*_.nudgeOffset;L.logger.warn("Nudging 'currentTime' from "+s+" to "+u),o.currentTime=u,d.trigger(E.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else L.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+_.nudgeMaxRetry+" nudges"),d.trigger(E.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},T}()},"./src/controller/id3-track-controller.ts":function(he,H,k){"use strict";k.r(H);var W=k("./src/events.ts"),P=k("./src/utils/texttrack-utils.ts"),E=k("./src/demux/id3.ts"),L=.25,O=function(){function b(g){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=g,this._registerListeners()}var w=b.prototype;return w.destroy=function(){this._unregisterListeners()},w._registerListeners=function(){var D=this.hls;D.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.on(W.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),D.on(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w._unregisterListeners=function(){var D=this.hls;D.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.off(W.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),D.off(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w.onMediaAttached=function(D,T){this.media=T.media},w.onMediaDetaching=function(){!this.id3Track||(Object(P.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null)},w.getID3Track=function(D){if(!!this.media){for(var T=0;T<D.length;T++){var f=D[T];if(f.kind==="metadata"&&f.label==="id3")return Object(P.sendAddTrackEvent)(f,this.media),f}return this.media.addTextTrack("metadata","id3")}},w.onFragParsingMetadata=function(D,T){if(!!this.media){var f=T.frag,p=T.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var _=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<p.length;d++){var o=E.getID3Frames(p[d].data);if(o){var s=p[d].pts,a=d<p.length-1?p[d+1].pts:f.end,u=a-s;u<=0&&(a=s+L);for(var l=0;l<o.length;l++){var A=o[l];if(!E.isTimeStampFrame(A)){var I=new _(s,a,"");I.value=A,this.id3Track.addCue(I)}}}}}},w.onBufferFlushing=function(D,T){var f=T.startOffset,p=T.endOffset,_=T.type;if(!_||_==="audio"){var d=this.id3Track;d&&Object(P.removeCuesInRange)(d,f,p)}},b}();H.default=O},"./src/controller/latency-controller.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"default",function(){return b});var W=k("./src/errors.ts"),P=k("./src/events.ts"),E=k("./src/utils/logger.ts");function L(w,g){for(var D=0;D<g.length;D++){var T=g[D];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(w,T.key,T)}}function O(w,g,D){return g&&L(w.prototype,g),D&&L(w,D),w}var b=function(){function w(D){var T=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 T.timeupdate()},this.hls=D,this.config=D.config,this.registerListeners()}var g=w.prototype;return g.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},g.registerListeners=function(){this.hls.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(P.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(P.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){this.hls.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(P.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(P.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(P.Events.ERROR,this.onError)},g.onMediaAttached=function(T,f){this.media=f.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},g.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},g.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},g.onLevelUpdated=function(T,f){var p=f.details;this.levelDetails=p,p.advanced&&this.timeupdate(),!p.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},g.onError=function(T,f){f.details===W.ErrorDetails.BUFFER_STALLED_ERROR&&(this.stallCount++,E.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))},g.timeupdate=function(){var T=this.media,f=this.levelDetails;if(!(!T||!f)){this.currentTime=T.currentTime;var p=this.computeLatency();if(p!==null){this._latency=p;var _=this.config,d=_.lowLatencyMode,o=_.maxLiveSyncPlaybackRate;if(!(!d||o===1)){var s=this.targetLatency;if(s!==null){var a=p-s,u=Math.min(this.maxLatency,s+f.targetduration),l=a<u;if(f.live&&l&&a>.05&&this.forwardBufferLength>1){var A=Math.min(2,Math.max(1,o)),I=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20;T.playbackRate=Math.min(A,Math.max(1,I))}else T.playbackRate!==1&&T.playbackRate!==0&&(T.playbackRate=1)}}}}},g.estimateLiveEdge=function(){var T=this.levelDetails;return T===null?null:T.edge+T.age},g.computeLatency=function(){var T=this.estimateLiveEdge();return T===null?null:T-this.currentTime},O(w,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var T=this.config,f=this.levelDetails;return T.liveMaxLatencyDuration!==void 0?T.liveMaxLatencyDuration:f?T.liveMaxLatencyDurationCount*f.targetduration:0}},{key:"targetLatency",get:function(){var T=this.levelDetails;if(T===null)return null;var f=T.holdBack,p=T.partHoldBack,_=T.targetduration,d=this.config,o=d.liveSyncDuration,s=d.liveSyncDurationCount,a=d.lowLatencyMode,u=this.hls.userConfig,l=a&&p||f;(u.liveSyncDuration||u.liveSyncDurationCount||l===0)&&(l=o!==void 0?o:s*_);var A=_,I=1;return l+Math.min(this.stallCount*I,A)}},{key:"liveSyncPosition",get:function(){var T=this.estimateLiveEdge(),f=this.targetLatency,p=this.levelDetails;if(T===null||f===null||p===null)return null;var _=p.edge,d=T-f-this.edgeStalled,o=_-p.totalduration,s=_-(this.config.lowLatencyMode&&p.partTarget||p.targetduration);return Math.min(Math.max(o,d),s)}},{key:"drift",get:function(){var T=this.levelDetails;return T===null?1:T.drift}},{key:"edgeStalled",get:function(){var T=this.levelDetails;if(T===null)return 0;var f=(this.config.lowLatencyMode&&T.partTarget||T.targetduration)*3;return Math.max(T.age-f,0)}},{key:"forwardBufferLength",get:function(){var T=this.media,f=this.levelDetails;if(!T||!f)return 0;var p=T.buffered.length;return p?T.buffered.end(p-1):f.edge-this.currentTime}}]),w}()},"./src/controller/level-controller.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"default",function(){return d});var W=k("./src/types/level.ts"),P=k("./src/events.ts"),E=k("./src/errors.ts"),L=k("./src/utils/codecs.ts"),O=k("./src/controller/level-helper.ts"),b=k("./src/controller/base-playlist-controller.ts"),w=k("./src/types/loader.ts");function g(){return g=Object.assign||function(o){for(var s=1;s<arguments.length;s++){var a=arguments[s];for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(o[u]=a[u])}return o},g.apply(this,arguments)}function D(o,s){for(var a=0;a<s.length;a++){var u=s[a];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(o,u.key,u)}}function T(o,s,a){return s&&D(o.prototype,s),a&&D(o,a),o}function f(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,p(o,s)}function p(o,s){return p=Object.setPrototypeOf||function(u,l){return u.__proto__=l,u},p(o,s)}var _=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(o){f(s,o);function s(u){var l;return l=o.call(this,u,"[level-controller]")||this,l._levels=[],l._firstLevel=-1,l._startLevel=void 0,l.currentLevelIndex=-1,l.manualLevelIndex=-1,l.onParsedComplete=void 0,l._registerListeners(),l}var a=s.prototype;return a._registerListeners=function(){var l=this.hls;l.on(P.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(P.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),l.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(P.Events.ERROR,this.onError,this)},a._unregisterListeners=function(){var l=this.hls;l.off(P.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(P.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),l.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(P.Events.ERROR,this.onError,this)},a.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},a.startLoad=function(){var l=this._levels;l.forEach(function(A){A.loadError=0}),o.prototype.startLoad.call(this)},a.onManifestLoaded=function(l,A){var I=[],R=[],y=[],v,m={},S,B=!1,N=!1,M=!1;if(A.levels.forEach(function(X){var ie=X.attrs;B=B||!!(X.width&&X.height),N=N||!!X.videoCodec,M=M||!!X.audioCodec,_&&X.audioCodec&&X.audioCodec.indexOf("mp4a.40.34")!==-1&&(X.audioCodec=void 0);var se=X.bitrate+"-"+X.attrs.RESOLUTION+"-"+X.attrs.CODECS;S=m[se],S?S.url.push(X.url):(S=new W.Level(X),m[se]=S,I.push(S)),ie&&(ie.AUDIO&&Object(O.addGroupId)(S,"audio",ie.AUDIO),ie.SUBTITLES&&Object(O.addGroupId)(S,"text",ie.SUBTITLES))}),(B||N)&&M&&(I=I.filter(function(X){var ie=X.videoCodec,se=X.width,le=X.height;return!!ie||!!(se&&le)})),I=I.filter(function(X){var ie=X.audioCodec,se=X.videoCodec;return(!ie||Object(L.isCodecSupportedInMp4)(ie,"audio"))&&(!se||Object(L.isCodecSupportedInMp4)(se,"video"))}),A.audioTracks&&(R=A.audioTracks.filter(function(X){return!X.audioCodec||Object(L.isCodecSupportedInMp4)(X.audioCodec,"audio")}),Object(O.assignTrackIdsByGroup)(R)),A.subtitles&&(y=A.subtitles,Object(O.assignTrackIdsByGroup)(y)),I.length>0){v=I[0].bitrate,I.sort(function(X,ie){return X.bitrate-ie.bitrate}),this._levels=I;for(var U=0;U<I.length;U++)if(I[U].bitrate===v){this._firstLevel=U,this.log("manifest loaded, "+I.length+" level(s) found, first bitrate: "+v);break}var K=M&&!N,j={levels:I,audioTracks:R,subtitleTracks:y,firstLevel:this._firstLevel,stats:A.stats,audio:M,video:N,altAudio:!K&&R.some(function(X){return!!X.url})};this.hls.trigger(P.Events.MANIFEST_PARSED,j),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(P.Events.ERROR,{type:E.ErrorTypes.MEDIA_ERROR,details:E.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:A.url,reason:"no level with compatible codecs found in manifest"})},a.onError=function(l,A){if(o.prototype.onError.call(this,l,A),!A.fatal){var I=A.context,R=this._levels[this.currentLevelIndex];if(I&&(I.type===w.PlaylistContextType.AUDIO_TRACK&&R.audioGroupIds&&I.groupId===R.audioGroupIds[R.urlId]||I.type===w.PlaylistContextType.SUBTITLE_TRACK&&R.textGroupIds&&I.groupId===R.textGroupIds[R.urlId])){this.redundantFailover(this.currentLevelIndex);return}var y=!1,v=!0,m;switch(A.details){case E.ErrorDetails.FRAG_LOAD_ERROR:case E.ErrorDetails.FRAG_LOAD_TIMEOUT:case E.ErrorDetails.KEY_LOAD_ERROR:case E.ErrorDetails.KEY_LOAD_TIMEOUT:if(A.frag){var S=this._levels[A.frag.level];S?(S.fragmentError++,S.fragmentError>this.hls.config.fragLoadingMaxRetry&&(m=A.frag.level)):m=A.frag.level}break;case E.ErrorDetails.LEVEL_LOAD_ERROR:case E.ErrorDetails.LEVEL_LOAD_TIMEOUT:I&&(I.deliveryDirectives&&(v=!1),m=I.level),y=!0;break;case E.ErrorDetails.REMUX_ALLOC_ERROR:m=A.level,y=!0;break}m!==void 0&&this.recoverLevel(A,m,y,v)}},a.recoverLevel=function(l,A,I,R){var y=l.details,v=this._levels[A];if(v.loadError++,I){var m=this.retryLoadingOrFail(l);if(m)l.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(R){var S=v.url.length;if(S>1&&v.loadError<S)l.levelRetry=!0,this.redundantFailover(A);else if(this.manualLevelIndex===-1){var B=A===0?this._levels.length-1:A-1;this.currentLevelIndex!==B&&this._levels[B].loadError===0&&(this.warn(y+": switch to "+B),l.levelRetry=!0,this.hls.nextAutoLevel=B)}}},a.redundantFailover=function(l){var A=this._levels[l],I=A.url.length;if(I>1){var R=(A.urlId+1)%I;this.warn("Switching to redundant URL-id "+R),this._levels.forEach(function(y){y.urlId=R}),this.level=l}},a.onFragLoaded=function(l,A){var I=A.frag;if(I!==void 0&&I.type===w.PlaylistLevelType.MAIN){var R=this._levels[I.level];R!==void 0&&(R.fragmentError=0,R.loadError=0)}},a.onLevelLoaded=function(l,A){var I,R=A.level,y=A.details,v=this._levels[R];if(!v){var m;this.warn("Invalid level index "+R),(m=A.deliveryDirectives)!==null&&m!==void 0&&m.skip&&(y.deltaUpdateFailed=!0);return}R===this.currentLevelIndex?(v.fragmentError===0&&(v.loadError=0,this.retryCount=0),this.playlistLoaded(R,A,v.details)):(I=A.deliveryDirectives)!==null&&I!==void 0&&I.skip&&(y.deltaUpdateFailed=!0)},a.onAudioTrackSwitched=function(l,A){var I=this.hls.levels[this.currentLevelIndex];if(!!I&&I.audioGroupIds){for(var R=-1,y=this.hls.audioTracks[A.id].groupId,v=0;v<I.audioGroupIds.length;v++)if(I.audioGroupIds[v]===y){R=v;break}R!==I.urlId&&(I.urlId=R,this.startLoad())}},a.loadPlaylist=function(l){var A=this.currentLevelIndex,I=this._levels[A];if(this.canLoad&&I&&I.url.length>0){var R=I.urlId,y=I.url[R];if(l)try{y=l.addDirectives(y)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("Attempt loading level index "+A+(l?" at sn "+l.msn+" part "+l.part:"")+" with URL-id "+R+" "+y),this.clearTimer(),this.hls.trigger(P.Events.LEVEL_LOADING,{url:y,level:A,id:R,deliveryDirectives:l||null})}},a.removeLevel=function(l,A){var I=function(v,m){return m!==A},R=this._levels.filter(function(y,v){return v!==l?!0:y.url.length>1&&A!==void 0?(y.url=y.url.filter(I),y.audioGroupIds&&(y.audioGroupIds=y.audioGroupIds.filter(I)),y.textGroupIds&&(y.textGroupIds=y.textGroupIds.filter(I)),y.urlId=0,!0):!1}).map(function(y,v){var m=y.details;return m!=null&&m.fragments&&m.fragments.forEach(function(S){S.level=v}),y});this._levels=R,this.hls.trigger(P.Events.LEVELS_UPDATED,{levels:R})},T(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(l){var A,I=this._levels;if(I.length!==0&&!(this.currentLevelIndex===l&&(A=I[l])!==null&&A!==void 0&&A.details)){if(l<0||l>=I.length){var R=l<0;if(this.hls.trigger(P.Events.ERROR,{type:E.ErrorTypes.OTHER_ERROR,details:E.ErrorDetails.LEVEL_SWITCH_ERROR,level:l,fatal:R,reason:"invalid level idx"}),R)return;l=Math.min(l,I.length-1)}this.clearTimer();var y=this.currentLevelIndex,v=I[y],m=I[l];this.log("switching to level "+l+" from "+y),this.currentLevelIndex=l;var S=g({},m,{level:l,maxBitrate:m.maxBitrate,uri:m.uri,urlId:m.urlId});delete S._urlId,this.hls.trigger(P.Events.LEVEL_SWITCHING,S);var B=m.details;if(!B||B.live){var N=this.switchParams(m.uri,v==null?void 0:v.details);this.loadPlaylist(N)}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(l){this.manualLevelIndex=l,this._startLevel===void 0&&(this._startLevel=l),l!==-1&&(this.level=l)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(l){this._firstLevel=l}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var l=this.hls.config.startLevel;return l!==void 0?l:this._firstLevel}else return this._startLevel},set:function(l){this._startLevel=l}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(l){this.level=l,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=l)}}]),s}(b.default)},"./src/controller/level-helper.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"addGroupId",function(){return E}),k.d(H,"assignTrackIdsByGroup",function(){return L}),k.d(H,"updatePTS",function(){return O}),k.d(H,"updateFragPTSDTS",function(){return w}),k.d(H,"mergeDetails",function(){return g}),k.d(H,"mapPartIntersection",function(){return D}),k.d(H,"mapFragmentIntersection",function(){return T}),k.d(H,"adjustSliding",function(){return f}),k.d(H,"addSliding",function(){return p}),k.d(H,"computeReloadInterval",function(){return _}),k.d(H,"getFragmentWithSN",function(){return d}),k.d(H,"getPartWith",function(){return o});var W=k("./src/polyfills/number.ts"),P=k("./src/utils/logger.ts");function E(s,a,u){switch(a){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(u);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(u);break}}function L(s){var a={};s.forEach(function(u){var l=u.groupId||"";u.id=a[l]=a[l]||0,a[l]++})}function O(s,a,u){var l=s[a],A=s[u];b(l,A)}function b(s,a){var u=a.startPTS;if(Object(W.isFiniteNumber)(u)){var l=0,A;a.sn>s.sn?(l=u-s.start,A=s):(l=s.start-u,A=a),A.duration!==l&&(A.duration=l)}else if(a.sn>s.sn){var I=s.cc===a.cc;I&&s.minEndPTS?a.start=s.start+(s.minEndPTS-s.start):a.start=s.start+s.duration}else a.start=Math.max(s.start-a.duration,0)}function w(s,a,u,l,A,I){var R=l-u;R<=0&&(P.logger.warn("Fragment should have a positive duration",a),l=u+a.duration,I=A+a.duration);var y=u,v=l,m=a.startPTS,S=a.endPTS;if(Object(W.isFiniteNumber)(m)){var B=Math.abs(m-u);Object(W.isFiniteNumber)(a.deltaPTS)?a.deltaPTS=Math.max(B,a.deltaPTS):a.deltaPTS=B,y=Math.max(u,m),u=Math.min(u,m),A=Math.min(A,a.startDTS),v=Math.min(l,S),l=Math.max(l,S),I=Math.max(I,a.endDTS)}a.duration=l-u;var N=u-a.start;a.appendedPTS=l,a.start=a.startPTS=u,a.maxStartPTS=y,a.startDTS=A,a.endPTS=l,a.minEndPTS=v,a.endDTS=I;var M=a.sn;if(!s||M<s.startSN||M>s.endSN)return 0;var U,K=M-s.startSN,j=s.fragments;for(j[K]=a,U=K;U>0;U--)b(j[U],j[U-1]);for(U=K;U<j.length-1;U++)b(j[U],j[U+1]);return s.fragmentHint&&b(j[j.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,N}function g(s,a){for(var u=null,l=s.fragments,A=l.length-1;A>=0;A--){var I=l[A].initSegment;if(I){u=I;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var R=0,y;if(T(s,a,function(U,K){U.relurl&&(R=U.cc-K.cc),Object(W.isFiniteNumber)(U.startPTS)&&Object(W.isFiniteNumber)(U.endPTS)&&(K.start=K.startPTS=U.startPTS,K.startDTS=U.startDTS,K.appendedPTS=U.appendedPTS,K.maxStartPTS=U.maxStartPTS,K.endPTS=U.endPTS,K.endDTS=U.endDTS,K.minEndPTS=U.minEndPTS,K.duration=U.endPTS-U.startPTS,K.duration&&(y=K),a.PTSKnown=a.alignedSliding=!0),K.elementaryStreams=U.elementaryStreams,K.loader=U.loader,K.stats=U.stats,K.urlId=U.urlId,U.initSegment&&(K.initSegment=U.initSegment,u=U.initSegment)}),u){var v=a.fragmentHint?a.fragments.concat(a.fragmentHint):a.fragments;v.forEach(function(U){var K;(!U.initSegment||U.initSegment.relurl===((K=u)===null||K===void 0?void 0:K.relurl))&&(U.initSegment=u)})}if(a.skippedSegments&&(a.deltaUpdateFailed=a.fragments.some(function(U){return!U}),a.deltaUpdateFailed)){P.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var m=a.skippedSegments;m--;)a.fragments.shift();a.startSN=a.fragments[0].sn,a.startCC=a.fragments[0].cc}var S=a.fragments;if(R){P.logger.warn("discontinuity sliding from playlist, take drift into account");for(var B=0;B<S.length;B++)S[B].cc+=R}a.skippedSegments&&(a.startCC=a.fragments[0].cc),D(s.partList,a.partList,function(U,K){K.elementaryStreams=U.elementaryStreams,K.stats=U.stats}),y?w(a,y,y.startPTS,y.endPTS,y.startDTS,y.endDTS):f(s,a),S.length&&(a.totalduration=a.edge-S[0].start),a.driftStartTime=s.driftStartTime,a.driftStart=s.driftStart;var N=a.advancedDateTime;if(a.advanced&&N){var M=a.edge;a.driftStart||(a.driftStartTime=N,a.driftStart=M),a.driftEndTime=N,a.driftEnd=M}else a.driftEndTime=s.driftEndTime,a.driftEnd=s.driftEnd,a.advancedDateTime=s.advancedDateTime}function D(s,a,u){if(s&&a)for(var l=0,A=0,I=s.length;A<=I;A++){var R=s[A],y=a[A+l];R&&y&&R.index===y.index&&R.fragment.sn===y.fragment.sn?u(R,y):l--}}function T(s,a,u){for(var l=a.skippedSegments,A=Math.max(s.startSN,a.startSN)-a.startSN,I=(s.fragmentHint?1:0)+(l?a.endSN:Math.min(s.endSN,a.endSN))-a.startSN,R=a.startSN-s.startSN,y=a.fragmentHint?a.fragments.concat(a.fragmentHint):a.fragments,v=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,m=A;m<=I;m++){var S=v[R+m],B=y[m];l&&!B&&m<l&&(B=a.fragments[m]=S),S&&B&&u(S,B)}}function f(s,a){var u=a.startSN+a.skippedSegments-s.startSN,l=s.fragments;u<0||u>=l.length||p(a,l[u].start)}function p(s,a){if(a){for(var u=s.fragments,l=s.skippedSegments;l<u.length;l++)u[l].start+=a;s.fragmentHint&&(s.fragmentHint.start+=a)}}function _(s,a){var u=1e3*s.levelTargetDuration,l=u/2,A=s.age,I=A>0&&A<u*3,R=a.loading.end-a.loading.start,y,v=s.availabilityDelay;if(s.updated===!1)if(I){var m=333*s.misses;y=Math.max(Math.min(l,R*2),m),s.availabilityDelay=(s.availabilityDelay||0)+y}else y=l;else I?(v=Math.min(v||u/2,A),s.availabilityDelay=v,y=v+u-A):y=u-R;return Math.round(y)}function d(s,a,u){if(!s||!s.details)return null;var l=s.details,A=l.fragments[a-l.startSN];return A||(A=l.fragmentHint,A&&A.sn===a)?A:a<l.startSN&&u&&u.sn===a?u:null}function o(s,a,u){if(!s||!s.details)return null;var l=s.details.partList;if(l)for(var A=l.length;A--;){var I=l[A];if(I.index===u&&I.fragment.sn===a)return I}return null}},"./src/controller/stream-controller.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"default",function(){return l});var W=k("./src/polyfills/number.ts"),P=k("./src/controller/base-stream-controller.ts"),E=k("./src/is-supported.ts"),L=k("./src/events.ts"),O=k("./src/utils/buffer-helper.ts"),b=k("./src/controller/fragment-tracker.ts"),w=k("./src/types/loader.ts"),g=k("./src/loader/fragment.ts"),D=k("./src/demux/transmuxer-interface.ts"),T=k("./src/types/transmuxer.ts"),f=k("./src/controller/gap-controller.ts"),p=k("./src/errors.ts"),_=k("./src/utils/logger.ts");function d(A,I){for(var R=0;R<I.length;R++){var y=I[R];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(A,y.key,y)}}function o(A,I,R){return I&&d(A.prototype,I),R&&d(A,R),A}function s(A,I){A.prototype=Object.create(I.prototype),A.prototype.constructor=A,a(A,I)}function a(A,I){return a=Object.setPrototypeOf||function(y,v){return y.__proto__=v,y},a(A,I)}var u=100,l=function(A){s(I,A);function I(y,v){var m;return m=A.call(this,y,v,"[stream-controller]")||this,m.audioCodecSwap=!1,m.gapController=null,m.level=-1,m._forceStartLoad=!1,m.altAudio=!1,m.audioOnly=!1,m.fragPlaying=null,m.onvplaying=null,m.onvseeked=null,m.fragLastKbps=0,m.stalled=!1,m.couldBacktrack=!1,m.audioCodecSwitch=!1,m.videoBuffer=null,m._registerListeners(),m}var R=I.prototype;return R._registerListeners=function(){var v=this.hls;v.on(L.Events.MEDIA_ATTACHED,this.onMediaAttached,this),v.on(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),v.on(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),v.on(L.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.on(L.Events.LEVEL_LOADING,this.onLevelLoading,this),v.on(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.on(L.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),v.on(L.Events.ERROR,this.onError,this),v.on(L.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),v.on(L.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.on(L.Events.BUFFER_CREATED,this.onBufferCreated,this),v.on(L.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),v.on(L.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),v.on(L.Events.FRAG_BUFFERED,this.onFragBuffered,this)},R._unregisterListeners=function(){var v=this.hls;v.off(L.Events.MEDIA_ATTACHED,this.onMediaAttached,this),v.off(L.Events.MEDIA_DETACHING,this.onMediaDetaching,this),v.off(L.Events.MANIFEST_LOADING,this.onManifestLoading,this),v.off(L.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.off(L.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.off(L.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),v.off(L.Events.ERROR,this.onError,this),v.off(L.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),v.off(L.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.off(L.Events.BUFFER_CREATED,this.onBufferCreated,this),v.off(L.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),v.off(L.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),v.off(L.Events.FRAG_BUFFERED,this.onFragBuffered,this)},R.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},R.startLoad=function(v){if(this.levels){var m=this.lastCurrentTime,S=this.hls;if(this.stopLoad(),this.setInterval(u),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var B=S.startLevel;B===-1&&(S.config.testBandwidth?(B=0,this.bitrateTest=!0):B=S.nextAutoLevel),this.level=S.nextLoadLevel=B,this.loadedmetadata=!1}m>0&&v===-1&&(this.log("Override startPosition with lastCurrentTime @"+m.toFixed(3)),v=m),this.state=P.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=v,this.tick()}else this._forceStartLoad=!0,this.state=P.State.STOPPED},R.stopLoad=function(){this._forceStartLoad=!1,A.prototype.stopLoad.call(this)},R.doTick=function(){switch(this.state){case P.State.IDLE:this.doTickIdle();break;case P.State.WAITING_LEVEL:{var v,m=this.levels,S=this.level,B=m==null||(v=m[S])===null||v===void 0?void 0:v.details;if(B&&(!B.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(B))break;this.state=P.State.IDLE;break}break}case P.State.FRAG_LOADING_WAITING_RETRY:{var N,M=self.performance.now(),U=this.retryDate;(!U||M>=U||(N=this.media)!==null&&N!==void 0&&N.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=P.State.IDLE)}break;default:break}this.onTickEnd()},R.onTickEnd=function(){A.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},R.doTickIdle=function(){var v,m,S=this.hls,B=this.levelLastLoaded,N=this.levels,M=this.media,U=S.config,K=S.nextLoadLevel;if(!(B===null||!M&&(this.startFragRequested||!U.startFragPrefetch))&&!(this.altAudio&&this.audioOnly)&&!(!N||!N[K])){var j=N[K];this.level=S.nextLoadLevel=K;var X=j.details;if(!X||this.state===P.State.WAITING_LEVEL||X.live&&this.levelLastLoaded!==K){this.state=P.State.WAITING_LEVEL;return}var ie=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:M,w.PlaylistLevelType.MAIN);if(ie!==null){var se=ie.len,le=this.getMaxBufferLength(j.maxBitrate);if(!(se>=le)){if(this._streamEnded(ie,X)){var ve={};this.altAudio&&(ve.type="video"),this.hls.trigger(L.Events.BUFFER_EOS,ve),this.state=P.State.ENDED;return}var q=ie.end,ee=this.getNextFragment(q,X);if(this.couldBacktrack&&!this.fragPrevious&&ee&&ee.sn!=="initSegment"){var ae=ee.sn-X.startSN;ae>1&&(ee=X.fragments[ae-1],this.fragmentTracker.removeFragment(ee))}if(ee&&this.fragmentTracker.getState(ee)===b.FragmentState.OK&&this.nextLoadPosition>q){var _e=this.audioOnly&&!this.altAudio?g.ElementaryStreamTypes.AUDIO:g.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(M,_e,w.PlaylistLevelType.MAIN),ee=this.getNextFragment(this.nextLoadPosition,X)}!ee||(ee.initSegment&&!ee.initSegment.data&&!this.bitrateTest&&(ee=ee.initSegment),((v=ee.decryptdata)===null||v===void 0?void 0:v.keyFormat)==="identity"&&!((m=ee.decryptdata)!==null&&m!==void 0&&m.key)?this.loadKey(ee,X):this.loadFragment(ee,X,q))}}}},R.loadFragment=function(v,m,S){var B,N=this.fragmentTracker.getState(v);if(this.fragCurrent=v,N===b.FragmentState.BACKTRACKED){var M=this.fragmentTracker.getBacktrackData(v);if(M){this._handleFragmentLoadProgress(M),this._handleFragmentLoadComplete(M);return}else N=b.FragmentState.NOT_LOADED}N===b.FragmentState.NOT_LOADED||N===b.FragmentState.PARTIAL?v.sn==="initSegment"?this._loadInitSegment(v):this.bitrateTest?(v.bitrateTest=!0,this.log("Fragment "+v.sn+" of level "+v.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(v)):(this.startFragRequested=!0,A.prototype.loadFragment.call(this,v,m,S)):N===b.FragmentState.APPENDING?this.reduceMaxBufferLength(v.duration)&&this.fragmentTracker.removeFragment(v):((B=this.media)===null||B===void 0?void 0:B.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},R.getAppendedFrag=function(v){var m=this.fragmentTracker.getAppendedFrag(v,w.PlaylistLevelType.MAIN);return m&&"fragment"in m?m.fragment:m},R.getBufferedFrag=function(v){return this.fragmentTracker.getBufferedFrag(v,w.PlaylistLevelType.MAIN)},R.followingBufferedFrag=function(v){return v?this.getBufferedFrag(v.end+.5):null},R.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},R.nextLevelSwitch=function(){var v=this.levels,m=this.media;if(m!=null&&m.readyState){var S,B=this.getAppendedFrag(m.currentTime);if(B&&B.start>1&&this.flushMainBuffer(0,B.start-1),!m.paused&&v){var N=this.hls.nextLoadLevel,M=v[N],U=this.fragLastKbps;U&&this.fragCurrent?S=this.fragCurrent.duration*M.maxBitrate/(1e3*U)+1:S=0}else S=0;var K=this.getBufferedFrag(m.currentTime+S);if(K){var j=this.followingBufferedFrag(K);if(j){this.abortCurrentFrag();var X=j.maxStartPTS?j.maxStartPTS:j.start,ie=j.duration,se=Math.max(K.end,X+Math.min(Math.max(ie-this.config.maxFragLookUpTolerance,ie*.5),ie*.75));this.flushMainBuffer(se,Number.POSITIVE_INFINITY)}}}},R.abortCurrentFrag=function(){var v=this.fragCurrent;this.fragCurrent=null,v!=null&&v.loader&&v.loader.abort(),this.state===P.State.KEY_LOADING&&(this.state=P.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},R.flushMainBuffer=function(v,m){A.prototype.flushMainBuffer.call(this,v,m,this.altAudio?"video":null)},R.onMediaAttached=function(v,m){A.prototype.onMediaAttached.call(this,v,m);var S=m.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),S.addEventListener("playing",this.onvplaying),S.addEventListener("seeked",this.onvseeked),this.gapController=new f.default(this.config,S,this.fragmentTracker,this.hls)},R.onMediaDetaching=function(){var v=this.media;v&&(v.removeEventListener("playing",this.onvplaying),v.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),A.prototype.onMediaDetaching.call(this)},R.onMediaPlaying=function(){this.tick()},R.onMediaSeeked=function(){var v=this.media,m=v?v.currentTime:null;Object(W.isFiniteNumber)(m)&&this.log("Media seeked to "+m.toFixed(3)),this.tick()},R.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(L.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},R.onManifestParsed=function(v,m){var S=!1,B=!1,N;m.levels.forEach(function(M){N=M.audioCodec,N&&(N.indexOf("mp4a.40.2")!==-1&&(S=!0),N.indexOf("mp4a.40.5")!==-1&&(B=!0))}),this.audioCodecSwitch=S&&B&&!Object(E.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=m.levels,this.startFragRequested=!1},R.onLevelLoading=function(v,m){var S=this.levels;if(!(!S||this.state!==P.State.IDLE)){var B=S[m.level];(!B.details||B.details.live&&this.levelLastLoaded!==m.level||this.waitForCdnTuneIn(B.details))&&(this.state=P.State.WAITING_LEVEL)}},R.onLevelLoaded=function(v,m){var S,B=this.levels,N=m.level,M=m.details,U=M.totalduration;if(!B){this.warn("Levels were reset while loading level "+N);return}this.log("Level "+N+" loaded ["+M.startSN+","+M.endSN+"], cc ["+M.startCC+", "+M.endCC+"] duration:"+U);var K=this.fragCurrent;K&&(this.state===P.State.FRAG_LOADING||this.state===P.State.FRAG_LOADING_WAITING_RETRY)&&K.level!==m.level&&K.loader&&(this.state=P.State.IDLE,K.loader.abort());var j=B[N],X=0;if(M.live||(S=j.details)!==null&&S!==void 0&&S.live){if(M.fragments[0]||(M.deltaUpdateFailed=!0),M.deltaUpdateFailed)return;X=this.alignPlaylists(M,j.details)}if(j.details=M,this.levelLastLoaded=N,this.hls.trigger(L.Events.LEVEL_UPDATED,{details:M,level:N}),this.state===P.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(M))return;this.state=P.State.IDLE}this.startFragRequested?M.live&&this.synchronizeToLiveEdge(M):this.setStartPosition(M,X),this.tick()},R._handleFragmentLoadProgress=function(v){var m,S=v.frag,B=v.part,N=v.payload,M=this.levels;if(!M){this.warn("Levels were reset while fragment load was in progress. Fragment "+S.sn+" of level "+S.level+" will not be buffered");return}var U=M[S.level],K=U.details;if(!K){this.warn("Dropping fragment "+S.sn+" of level "+S.level+" after level details were reset");return}var j=U.videoCodec,X=K.PTSKnown||!K.live,ie=(m=S.initSegment)===null||m===void 0?void 0:m.data,se=this._getAudioCodec(U),le=this.transmuxer=this.transmuxer||new D.default(this.hls,w.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ve=B?B.index:-1,q=ve!==-1,ee=new T.ChunkMetadata(S.level,S.sn,S.stats.chunkCount,N.byteLength,ve,q),ae=this.initPTS[S.cc];le.push(N,ie,se,j,S,B,K.totalduration,X,ee,ae)},R.onAudioTrackSwitching=function(v,m){var S=this.altAudio,B=!!m.url,N=m.id;if(!B){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var M=this.fragCurrent;M!=null&&M.loader&&(this.log("Switching to main audio track, cancel main fragment load"),M.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var U=this.hls;S&&U.trigger(L.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),U.trigger(L.Events.AUDIO_TRACK_SWITCHED,{id:N})}},R.onAudioTrackSwitched=function(v,m){var S=m.id,B=!!this.hls.audioTracks[S].url;if(B){var N=this.videoBuffer;N&&this.mediaBuffer!==N&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=N)}this.altAudio=B,this.tick()},R.onBufferCreated=function(v,m){var S=m.tracks,B,N,M=!1;for(var U in S){var K=S[U];if(K.id==="main"){if(N=U,B=K,U==="video"){var j=S[U];j&&(this.videoBuffer=j.buffer)}}else M=!0}M&&B?(this.log("Alternate track found, use "+N+".buffered to schedule main fragment loading"),this.mediaBuffer=B.buffer):this.mediaBuffer=this.media},R.onFragBuffered=function(v,m){var S=m.frag,B=m.part;if(!(S&&S.type!==w.PlaylistLevelType.MAIN)){if(this.fragContextChanged(S)){this.warn("Fragment "+S.sn+(B?" p: "+B.index:"")+" of level "+S.level+" finished buffering, but was aborted. state: "+this.state),this.state===P.State.PARSED&&(this.state=P.State.IDLE);return}var N=B?B.stats:S.stats;this.fragLastKbps=Math.round(8*N.total/(N.buffering.end-N.loading.first)),S.sn!=="initSegment"&&(this.fragPrevious=S),this.fragBufferedComplete(S,B)}},R.onError=function(v,m){switch(m.details){case p.ErrorDetails.FRAG_LOAD_ERROR:case p.ErrorDetails.FRAG_LOAD_TIMEOUT:case p.ErrorDetails.KEY_LOAD_ERROR:case p.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(w.PlaylistLevelType.MAIN,m);break;case p.ErrorDetails.LEVEL_LOAD_ERROR:case p.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==P.State.ERROR&&(m.fatal?(this.warn(""+m.details),this.state=P.State.ERROR):!m.levelRetry&&this.state===P.State.WAITING_LEVEL&&(this.state=P.State.IDLE));break;case p.ErrorDetails.BUFFER_FULL_ERROR:if(m.parent==="main"&&(this.state===P.State.PARSING||this.state===P.State.PARSED)){var S=!0,B=this.getFwdBufferInfo(this.media,w.PlaylistLevelType.MAIN);B&&B.len>.5&&(S=!this.reduceMaxBufferLength(B.len)),S&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},R.checkBuffer=function(){var v=this.media,m=this.gapController;if(!(!v||!m||!v.readyState)){var S=O.BufferHelper.getBuffered(v);!this.loadedmetadata&&S.length?(this.loadedmetadata=!0,this.seekToStartPos()):m.poll(this.lastCurrentTime),this.lastCurrentTime=v.currentTime}},R.onFragLoadEmergencyAborted=function(){this.state=P.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},R.onBufferFlushed=function(v,m){var S=m.type;if(S!==g.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var B=(S===g.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(B,S,w.PlaylistLevelType.MAIN)}},R.onLevelsUpdated=function(v,m){this.levels=m.levels},R.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},R.seekToStartPos=function(){var v=this.media,m=v.currentTime,S=this.startPosition;if(S>=0&&m<S){if(v.seeking){_.logger.log("could not seek to "+S+", already seeking at "+m);return}var B=O.BufferHelper.getBuffered(v),N=B.length?B.start(0):0,M=N-S;M>0&&(M<this.config.maxBufferHole||M<this.config.maxFragLookUpTolerance)&&(_.logger.log("adjusting start position by "+M+" to match buffer start"),S+=M,this.startPosition=S),this.log("seek to target start position "+S+" from current time "+m),v.currentTime=S}},R._getAudioCodec=function(v){var m=this.config.defaultAudioCodec||v.audioCodec;return this.audioCodecSwap&&m&&(this.log("Swapping audio codec"),m.indexOf("mp4a.40.5")!==-1?m="mp4a.40.2":m="mp4a.40.5"),m},R._loadBitrateTestFrag=function(v){var m=this;this._doFragLoad(v).then(function(S){var B=m.hls;if(!(!S||B.nextLoadLevel||m.fragContextChanged(v))){m.fragLoadError=0,m.state=P.State.IDLE,m.startFragRequested=!1,m.bitrateTest=!1;var N=v.stats;N.parsing.start=N.parsing.end=N.buffering.start=N.buffering.end=self.performance.now(),B.trigger(L.Events.FRAG_LOADED,S)}})},R._handleTransmuxComplete=function(v){var m,S="main",B=this.hls,N=v.remuxResult,M=v.chunkMeta,U=this.getCurrentContext(M);if(!U){this.warn("The loading context changed while buffering fragment "+M.sn+" of level "+M.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(M.level);return}var K=U.frag,j=U.part,X=U.level,ie=N.video,se=N.text,le=N.id3,ve=N.initSegment,q=this.altAudio?void 0:N.audio;if(!this.fragContextChanged(K)){if(this.state=P.State.PARSING,ve){ve.tracks&&(this._bufferInitSegment(X,ve.tracks,K,M),B.trigger(L.Events.FRAG_PARSING_INIT_SEGMENT,{frag:K,id:S,tracks:ve.tracks}));var ee=ve.initPTS,ae=ve.timescale;Object(W.isFiniteNumber)(ee)&&(this.initPTS[K.cc]=ee,B.trigger(L.Events.INIT_PTS_FOUND,{frag:K,id:S,initPTS:ee,timescale:ae}))}if(ie&&N.independent!==!1){if(X.details){var _e=ie.startPTS,fe=ie.endPTS,Ge=ie.startDTS,Te=ie.endDTS;if(j)j.elementaryStreams[ie.type]={startPTS:_e,endPTS:fe,startDTS:Ge,endDTS:Te};else if(ie.firstKeyFrame&&ie.independent&&(this.couldBacktrack=!0),ie.dropped&&ie.independent){var Ue=this.getLoadPosition()+this.config.maxBufferHole;if(Ue<_e){this.backtrack(K);return}K.setElementaryStreamInfo(ie.type,K.start,fe,K.start,Te,!0)}K.setElementaryStreamInfo(ie.type,_e,fe,Ge,Te),this.bufferFragmentData(ie,K,j,M)}}else if(N.independent===!1){this.backtrack(K);return}if(q){var Ze=q.startPTS,ut=q.endPTS,Fe=q.startDTS,Ye=q.endDTS;j&&(j.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:Ze,endPTS:ut,startDTS:Fe,endDTS:Ye}),K.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,Ze,ut,Fe,Ye),this.bufferFragmentData(q,K,j,M)}if(le!=null&&(m=le.samples)!==null&&m!==void 0&&m.length){var Ht={frag:K,id:S,samples:le.samples};B.trigger(L.Events.FRAG_PARSING_METADATA,Ht)}if(se){var Bt={frag:K,id:S,samples:se.samples};B.trigger(L.Events.FRAG_PARSING_USERDATA,Bt)}}},R._bufferInitSegment=function(v,m,S,B){var N=this;if(this.state===P.State.PARSING){this.audioOnly=!!m.audio&&!m.video,this.altAudio&&!this.audioOnly&&delete m.audio;var M=m.audio,U=m.video,K=m.audiovideo;if(M){var j=v.audioCodec,X=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(j&&(j.indexOf("mp4a.40.5")!==-1?j="mp4a.40.2":j="mp4a.40.5"),M.metadata.channelCount!==1&&X.indexOf("firefox")===-1&&(j="mp4a.40.5")),X.indexOf("android")!==-1&&M.container!=="audio/mpeg"&&(j="mp4a.40.2",this.log("Android: force audio codec to "+j)),v.audioCodec&&v.audioCodec!==j&&this.log('Swapping manifest audio codec "'+v.audioCodec+'" for "'+j+'"'),M.levelCodec=j,M.id="main",this.log("Init audio buffer, container:"+M.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(v.audioCodec||"")+"/"+M.codec+"]")}U&&(U.levelCodec=v.videoCodec,U.id="main",this.log("Init video buffer, container:"+U.container+", codecs[level/parsed]=["+(v.videoCodec||"")+"/"+U.codec+"]")),K&&this.log("Init audiovideo buffer, container:"+K.container+", codecs[level/parsed]=["+(v.attrs.CODECS||"")+"/"+K.codec+"]"),this.hls.trigger(L.Events.BUFFER_CODECS,m),Object.keys(m).forEach(function(ie){var se=m[ie],le=se.initSegment;le!=null&&le.byteLength&&N.hls.trigger(L.Events.BUFFER_APPENDING,{type:ie,data:le,frag:S,part:null,chunkMeta:B,parent:S.type})}),this.tick()}},R.backtrack=function(v){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(v);var m=this.fragmentTracker.backtrack(v);this.fragPrevious=null,this.nextLoadPosition=v.start,m?this.resetFragmentLoading(v):this.state=P.State.BACKTRACKING},R.checkFragmentChanged=function(){var v=this.media,m=null;if(v&&v.readyState>1&&v.seeking===!1){var S=v.currentTime;if(O.BufferHelper.isBuffered(v,S)?m=this.getAppendedFrag(S):O.BufferHelper.isBuffered(v,S+.1)&&(m=this.getAppendedFrag(S+.1)),m){var B=this.fragPlaying,N=m.level;(!B||m.sn!==B.sn||B.level!==N||m.urlId!==B.urlId)&&(this.hls.trigger(L.Events.FRAG_CHANGED,{frag:m}),(!B||B.level!==N)&&this.hls.trigger(L.Events.LEVEL_SWITCHED,{level:N}),this.fragPlaying=m)}}},o(I,[{key:"nextLevel",get:function(){var v=this.nextBufferedFrag;return v?v.level:-1}},{key:"currentLevel",get:function(){var v=this.media;if(v){var m=this.getAppendedFrag(v.currentTime);if(m)return m.level}return-1}},{key:"nextBufferedFrag",get:function(){var v=this.media;if(v){var m=this.getAppendedFrag(v.currentTime);return this.followingBufferedFrag(m)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),I}(P.default)},"./src/controller/subtitle-stream-controller.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"SubtitleStreamController",function(){return s});var W=k("./src/events.ts"),P=k("./src/utils/logger.ts"),E=k("./src/utils/buffer-helper.ts"),L=k("./src/controller/fragment-finders.ts"),O=k("./src/utils/discontinuities.ts"),b=k("./src/controller/level-helper.ts"),w=k("./src/controller/fragment-tracker.ts"),g=k("./src/controller/base-stream-controller.ts"),D=k("./src/types/loader.ts"),T=k("./src/types/level.ts");function f(a,u){for(var l=0;l<u.length;l++){var A=u[l];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(a,A.key,A)}}function p(a,u,l){return u&&f(a.prototype,u),l&&f(a,l),a}function _(a,u){a.prototype=Object.create(u.prototype),a.prototype.constructor=a,d(a,u)}function d(a,u){return d=Object.setPrototypeOf||function(A,I){return A.__proto__=I,A},d(a,u)}var o=500,s=function(a){_(u,a);function u(A,I){var R;return R=a.call(this,A,I,"[subtitle-stream-controller]")||this,R.levels=[],R.currentTrackId=-1,R.tracksBuffered=[],R.mainDetails=null,R._registerListeners(),R}var l=u.prototype;return l.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},l._registerListeners=function(){var I=this.hls;I.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),I.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),I.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),I.on(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),I.on(W.Events.ERROR,this.onError,this),I.on(W.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),I.on(W.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),I.on(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),I.on(W.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),I.on(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},l._unregisterListeners=function(){var I=this.hls;I.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),I.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),I.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),I.off(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),I.off(W.Events.ERROR,this.onError,this),I.off(W.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),I.off(W.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),I.off(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),I.off(W.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),I.off(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},l.startLoad=function(){this.stopLoad(),this.state=g.State.IDLE,this.setInterval(o),this.tick()},l.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},l.onLevelLoaded=function(I,R){this.mainDetails=R.details},l.onSubtitleFragProcessed=function(I,R){var y=R.frag,v=R.success;if(this.fragPrevious=y,this.state=g.State.IDLE,!!v){var m=this.tracksBuffered[this.currentTrackId];if(!!m){for(var S,B=y.start,N=0;N<m.length;N++)if(B>=m[N].start&&B<=m[N].end){S=m[N];break}var M=y.start+y.duration;S?S.end=M:(S={start:B,end:M},m.push(S)),this.fragmentTracker.fragBuffered(y)}}},l.onBufferFlushing=function(I,R){var y=R.startOffset,v=R.endOffset;if(y===0&&v!==Number.POSITIVE_INFINITY){var m=this.currentTrackId,S=this.levels;if(!S.length||!S[m]||!S[m].details)return;var B=S[m].details,N=B.targetduration,M=v-N;if(M<=0)return;R.endOffsetSubtitles=Math.max(0,M),this.tracksBuffered.forEach(function(U){for(var K=0;K<U.length;){if(U[K].end<=M){U.shift();continue}else if(U[K].start<M)U[K].start=M;else break;K++}}),this.fragmentTracker.removeFragmentsInRange(y,M,D.PlaylistLevelType.SUBTITLE)}},l.onError=function(I,R){var y,v=R.frag;!v||v.type!==D.PlaylistLevelType.SUBTITLE||((y=this.fragCurrent)!==null&&y!==void 0&&y.loader&&this.fragCurrent.loader.abort(),this.state=g.State.IDLE)},l.onSubtitleTracksUpdated=function(I,R){var y=this,v=R.subtitleTracks;this.tracksBuffered=[],this.levels=v.map(function(m){return new T.Level(m)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(m){y.tracksBuffered[m.id]=[]}),this.mediaBuffer=null},l.onSubtitleTrackSwitch=function(I,R){if(this.currentTrackId=R.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var y=this.levels[this.currentTrackId];y!=null&&y.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,y&&this.setInterval(o)},l.onSubtitleTrackLoaded=function(I,R){var y,v=R.details,m=R.id,S=this.currentTrackId,B=this.levels;if(!!B.length){var N=B[S];if(!(m>=B.length||m!==S||!N)){if(this.mediaBuffer=this.mediaBufferTimeRanges,v.live||(y=N.details)!==null&&y!==void 0&&y.live){var M=this.mainDetails;if(v.deltaUpdateFailed||!M)return;var U=M.fragments[0];if(!N.details)v.hasProgramDateTime&&M.hasProgramDateTime?Object(O.alignMediaPlaylistByPDT)(v,M):U&&Object(b.addSliding)(v,U.start);else{var K=this.alignPlaylists(v,N.details);K===0&&U&&Object(b.addSliding)(v,U.start)}}if(N.details=v,this.levelLastLoaded=m,this.tick(),v.live&&!this.fragCurrent&&this.media&&this.state===g.State.IDLE){var j=Object(L.findFragmentByPTS)(null,v.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),N.details=void 0)}}}},l._handleFragmentLoadComplete=function(I){var R=I.frag,y=I.payload,v=R.decryptdata,m=this.hls;if(!this.fragContextChanged(R)&&y&&y.byteLength>0&&v&&v.key&&v.iv&&v.method==="AES-128"){var S=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(y),v.key.buffer,v.iv.buffer).then(function(B){var N=performance.now();m.trigger(W.Events.FRAG_DECRYPTED,{frag:R,payload:B,stats:{tstart:S,tdecrypt:N}})})}},l.doTick=function(){if(!this.media){this.state=g.State.IDLE;return}if(this.state===g.State.IDLE){var I,R=this.currentTrackId,y=this.levels;if(!y.length||!y[R]||!y[R].details)return;var v=y[R].details,m=v.targetduration,S=this.config,B=this.media,N=E.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,B.currentTime-m,S.maxBufferHole),M=N.end,U=N.len,K=this.getMaxBufferLength()+m;if(U>K)return;console.assert(v,"Subtitle track details are defined on idle subtitle stream controller tick");var j=v.fragments,X=j.length,ie=v.edge,se,le=this.fragPrevious;if(M<ie){var ve=S.maxFragLookUpTolerance;le&&v.hasProgramDateTime&&(se=Object(L.findFragmentByPDT)(j,le.endProgramDateTime,ve)),se||(se=Object(L.findFragmentByPTS)(le,j,M,ve),!se&&le&&le.start<j[0].start&&(se=j[0]))}else se=j[X-1];(I=se)!==null&&I!==void 0&&I.encrypted?(P.logger.log("Loading key for "+se.sn),this.state=g.State.KEY_LOADING,this.hls.trigger(W.Events.KEY_LOADING,{frag:se})):se&&this.fragmentTracker.getState(se)===w.FragmentState.NOT_LOADED&&this.loadFragment(se,v,M)}},l.loadFragment=function(I,R,y){this.fragCurrent=I,a.prototype.loadFragment.call(this,I,R,y)},p(u,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),u}(g.default)},"./src/controller/subtitle-track-controller.ts":function(he,H,k){"use strict";k.r(H);var W=k("./src/events.ts"),P=k("./src/utils/texttrack-utils.ts"),E=k("./src/controller/base-playlist-controller.ts"),L=k("./src/types/loader.ts");function O(f,p){for(var _=0;_<p.length;_++){var d=p[_];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(f,d.key,d)}}function b(f,p,_){return p&&O(f.prototype,p),_&&O(f,_),f}function w(f,p){f.prototype=Object.create(p.prototype),f.prototype.constructor=f,g(f,p)}function g(f,p){return g=Object.setPrototypeOf||function(d,o){return d.__proto__=o,d},g(f,p)}var D=function(f){w(p,f);function p(d){var o;return o=f.call(this,d,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var _=p.prototype;return _.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,f.prototype.destroy.call(this)},_.registerListeners=function(){var o=this.hls;o.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(W.Events.ERROR,this.onError,this)},_.unregisterListeners=function(){var o=this.hls;o.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(W.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(W.Events.ERROR,this.onError,this)},_.onMediaAttached=function(o,s){this.media=s.media,!!this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))},_.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},_.onMediaDetaching=function(){if(!!this.media){self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=T(this.media.textTracks);o.forEach(function(s){Object(P.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null}},_.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},_.onManifestParsed=function(o,s){this.tracks=s.subtitleTracks},_.onSubtitleTrackLoaded=function(o,s){var a=s.id,u=s.details,l=this.trackId,A=this.tracksInGroup[l];if(!A){this.warn("Invalid subtitle track id "+a);return}var I=A.details;A.details=s.details,this.log("subtitle track "+a+" loaded ["+u.startSN+"-"+u.endSN+"]"),a===this.trackId&&(this.retryCount=0,this.playlistLoaded(a,s,I))},_.onLevelLoading=function(o,s){this.switchLevel(s.level)},_.onLevelSwitching=function(o,s){this.switchLevel(s.level)},_.switchLevel=function(o){var s=this.hls.levels[o];if(!!(s!=null&&s.textGroupIds)){var a=s.textGroupIds[s.urlId];if(this.groupId!==a){var u=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,l=this.tracks.filter(function(R){return!a||R.groupId===a});this.tracksInGroup=l;var A=this.findTrackId(u==null?void 0:u.name)||this.findTrackId();this.groupId=a;var I={subtitleTracks:l};this.log("Updating subtitle tracks, "+l.length+' track(s) found in "'+a+'" group-id'),this.hls.trigger(W.Events.SUBTITLE_TRACKS_UPDATED,I),A!==-1&&this.setSubtitleTrack(A,u)}}},_.findTrackId=function(o){for(var s=this.tracksInGroup,a=0;a<s.length;a++){var u=s[a];if((!this.selectDefaultTrack||u.default)&&(!o||o===u.name))return u.id}return-1},_.onError=function(o,s){f.prototype.onError.call(this,o,s),!(s.fatal||!s.context)&&s.context.type===L.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},_.loadPlaylist=function(o){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var a=s.id,u=s.groupId,l=s.url;if(o)try{l=o.addDirectives(l)}catch(A){this.warn("Could not construct new URL with HLS Delivery Directives: "+A)}this.log("Loading subtitle playlist for id "+a),this.hls.trigger(W.Events.SUBTITLE_TRACK_LOADING,{url:l,id:a,groupId:u,deliveryDirectives:o||null})}},_.toggleTrackModes=function(o){var s=this,a=this.media,u=this.subtitleDisplay,l=this.trackId;if(!!a){var A=T(a.textTracks),I=A.filter(function(v){return v.groupId===s.groupId});if(o===-1)[].slice.call(A).forEach(function(v){v.mode="disabled"});else{var R=I[l];R&&(R.mode="disabled")}var y=I[o];y&&(y.mode=u?"showing":"hidden")}},_.setSubtitleTrack=function(o,s){var a,u=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),!(this.trackId===o&&(o===-1||(a=u[o])!==null&&a!==void 0&&a.details)||o<-1||o>=u.length)){this.clearTimer();var l=u[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,l){var A=l.id,I=l.groupId,R=I===void 0?"":I,y=l.name,v=l.type,m=l.url;this.hls.trigger(W.Events.SUBTITLE_TRACK_SWITCH,{id:A,groupId:R,name:y,type:v,url:m});var S=this.switchParams(l.url,s==null?void 0:s.details);this.loadPlaylist(S)}else this.hls.trigger(W.Events.SUBTITLE_TRACK_SWITCH,{id:o})}},_.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!(!this.media||!this.hls.config.renderTextTracksNatively)){for(var o=-1,s=T(this.media.textTracks),a=0;a<s.length;a++)if(s[a].mode==="hidden")o=a;else if(s[a].mode==="showing"){o=a;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)}},b(p,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,s)}}]),p}(E.default);function T(f){for(var p=[],_=0;_<f.length;_++){var d=f[_];d.kind==="subtitles"&&d.label&&p.push(f[_])}return p}H.default=D},"./src/controller/timeline-controller.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"TimelineController",function(){return T});var W=k("./src/polyfills/number.ts"),P=k("./src/events.ts"),E=k("./src/utils/cea-608-parser.ts"),L=k("./src/utils/output-filter.ts"),O=k("./src/utils/webvtt-parser.ts"),b=k("./src/utils/texttrack-utils.ts"),w=k("./src/utils/imsc1-ttml-parser.ts"),g=k("./src/types/loader.ts"),D=k("./src/utils/logger.ts"),T=function(){function d(s){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=_(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var a=new L.default(this,"textTrack1"),u=new L.default(this,"textTrack2"),l=new L.default(this,"textTrack3"),A=new L.default(this,"textTrack4");this.cea608Parser1=new E.default(1,a,u),this.cea608Parser2=new E.default(3,l,A)}s.on(P.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(P.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(P.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(P.Events.FRAG_LOADING,this.onFragLoading,this),s.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(P.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(P.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(P.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(P.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=d.prototype;return o.destroy=function(){var a=this.hls;a.off(P.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(P.Events.MANIFEST_LOADED,this.onManifestLoaded,this),a.off(P.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),a.off(P.Events.FRAG_LOADING,this.onFragLoading,this),a.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),a.off(P.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),a.off(P.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),a.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),a.off(P.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),a.off(P.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(a,u,l,A,I){for(var R=!1,y=I.length;y--;){var v=I[y],m=p(v[0],v[1],u,l);if(m>=0&&(v[0]=Math.min(v[0],u),v[1]=Math.max(v[1],l),R=!0,m/(l-u)>.5))return}if(R||I.push([u,l]),this.config.renderTextTracksNatively){var S=this.captionsTracks[a];this.Cues.newCue(S,u,l,A)}else{var B=this.Cues.newCue(null,u,l,A);this.hls.trigger(P.Events.CUES_PARSED,{type:"captions",cues:B,track:a})}},o.onInitPtsFound=function(a,u){var l=this,A=u.frag,I=u.id,R=u.initPTS,y=u.timescale,v=this.unparsedVttFrags;I==="main"&&(this.initPTS[A.cc]=R,this.timescale[A.cc]=y),v.length&&(this.unparsedVttFrags=[],v.forEach(function(m){l.onFragLoaded(P.Events.FRAG_LOADED,m)}))},o.getExistingTrack=function(a){var u=this.media;if(u)for(var l=0;l<u.textTracks.length;l++){var A=u.textTracks[l];if(A[a])return A}return null},o.createCaptionsTrack=function(a){this.config.renderTextTracksNatively?this.createNativeTrack(a):this.createNonNativeTrack(a)},o.createNativeTrack=function(a){if(!this.captionsTracks[a]){var u=this.captionsProperties,l=this.captionsTracks,A=this.media,I=u[a],R=I.label,y=I.languageCode,v=this.getExistingTrack(a);if(v)l[a]=v,Object(b.clearCurrentCues)(l[a]),Object(b.sendAddTrackEvent)(l[a],A);else{var m=this.createTextTrack("captions",R,y);m&&(m[a]=!0,l[a]=m)}}},o.createNonNativeTrack=function(a){if(!this.nonNativeCaptionsTracks[a]){var u=this.captionsProperties[a];if(!!u){var l=u.label,A={_id:a,label:l,kind:"captions",default:u.media?!!u.media.default:!1,closedCaptions:u.media};this.nonNativeCaptionsTracks[a]=A,this.hls.trigger(P.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[A]})}}},o.createTextTrack=function(a,u,l){var A=this.media;if(!!A)return A.addTextTrack(a,u,l)},o.onMediaAttaching=function(a,u){this.media=u.media,this._cleanTracks()},o.onMediaDetaching=function(){var a=this.captionsTracks;Object.keys(a).forEach(function(u){Object(b.clearCurrentCues)(a[u]),delete a[u]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=_(),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())},o._cleanTracks=function(){var a=this.media;if(!!a){var u=a.textTracks;if(u)for(var l=0;l<u.length;l++)Object(b.clearCurrentCues)(u[l])}},o.onSubtitleTracksUpdated=function(a,u){var l=this;this.textTracks=[];var A=u.subtitleTracks||[],I=A.some(function(m){return m.textCodec===w.IMSC1_CODEC});if(this.config.enableWebVTT||I&&this.config.enableIMSC1){var R=this.tracks&&A&&this.tracks.length===A.length;if(this.tracks=A||[],this.config.renderTextTracksNatively){var y=this.media?this.media.textTracks:[];this.tracks.forEach(function(m,S){var B;if(S<y.length){for(var N=null,M=0;M<y.length;M++)if(f(y[M],m)){N=y[M];break}N&&(B=N)}B?Object(b.clearCurrentCues)(B):(B=l.createTextTrack("subtitles",m.name,m.lang),B&&(B.mode="disabled")),B&&(B.groupId=m.groupId,l.textTracks.push(B))})}else if(!R&&this.tracks&&this.tracks.length){var v=this.tracks.map(function(m){return{label:m.name,kind:m.type.toLowerCase(),default:m.default,subtitleTrack:m}});this.hls.trigger(P.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:v})}}},o.onManifestLoaded=function(a,u){var l=this;this.config.enableCEA708Captions&&u.captions&&u.captions.forEach(function(A){var I=/(?:CC|SERVICE)([1-4])/.exec(A.instreamId);if(!!I){var R="textTrack"+I[1],y=l.captionsProperties[R];!y||(y.label=A.name,A.lang&&(y.languageCode=A.lang),y.media=A)}})},o.onFragLoading=function(a,u){var l=this.cea608Parser1,A=this.cea608Parser2,I=this.lastSn,R=this.lastPartIndex;if(!(!this.enabled||!(l&&A))&&u.frag.type===g.PlaylistLevelType.MAIN){var y,v,m=u.frag.sn,S=(y=u==null||(v=u.part)===null||v===void 0?void 0:v.index)!=null?y:-1;m===I+1||m===I&&S===R+1||(l.reset(),A.reset()),this.lastSn=m,this.lastPartIndex=S}},o.onFragLoaded=function(a,u){var l=u.frag,A=u.payload,I=this.initPTS,R=this.unparsedVttFrags;if(l.type===g.PlaylistLevelType.SUBTITLE)if(A.byteLength){if(!Object(W.isFiniteNumber)(I[l.cc])){R.push(u),I.length&&this.hls.trigger(P.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:new Error("Missing initial subtitle PTS")});return}var y=l.decryptdata;if(y==null||y.key==null||y.method!=="AES-128"){var v=this.tracks[l.level],m=this.vttCCs;m[l.cc]||(m[l.cc]={start:l.start,prevCC:this.prevCC,new:!0},this.prevCC=l.cc),v&&v.textCodec===w.IMSC1_CODEC?this._parseIMSC1(l,A):this._parseVTTs(l,A,m)}}else this.hls.trigger(P.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(a,u){var l=this,A=this.hls;Object(w.parseIMSC1)(u,this.initPTS[a.cc],this.timescale[a.cc],function(I){l._appendCues(I,a.level),A.trigger(P.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:a})},function(I){D.logger.log("Failed to parse IMSC1: "+I),A.trigger(P.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:a,error:I})})},o._parseVTTs=function(a,u,l){var A=this,I=this.hls;Object(O.parseWebVTT)(u,this.initPTS[a.cc],this.timescale[a.cc],l,a.cc,a.start,function(R){A._appendCues(R,a.level),I.trigger(P.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:a})},function(R){A._fallbackToIMSC1(a,u),D.logger.log("Failed to parse VTT cue: "+R),I.trigger(P.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:a,error:R})})},o._fallbackToIMSC1=function(a,u){var l=this,A=this.tracks[a.level];A.textCodec||Object(w.parseIMSC1)(u,this.initPTS[a.cc],this.timescale[a.cc],function(){A.textCodec=w.IMSC1_CODEC,l._parseIMSC1(a,u)},function(){A.textCodec="wvtt"})},o._appendCues=function(a,u){var l=this.hls;if(this.config.renderTextTracksNatively){var A=this.textTracks[u];if(A.mode==="disabled")return;a.forEach(function(y){return Object(b.addCueToTrack)(A,y)})}else{var I=this.tracks[u],R=I.default?"default":"subtitles"+u;l.trigger(P.Events.CUES_PARSED,{type:"subtitles",cues:a,track:R})}},o.onFragDecrypted=function(a,u){var l=u.frag;if(l.type===g.PlaylistLevelType.SUBTITLE){if(!Object(W.isFiniteNumber)(this.initPTS[l.cc])){this.unparsedVttFrags.push(u);return}this.onFragLoaded(P.Events.FRAG_LOADED,u)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(a,u){var l=this.cea608Parser1,A=this.cea608Parser2;if(!(!this.enabled||!(l&&A)))for(var I=0;I<u.samples.length;I++){var R=u.samples[I].bytes;if(R){var y=this.extractCea608Data(R);l.addData(u.samples[I].pts,y[0]),A.addData(u.samples[I].pts,y[1])}}},o.onBufferFlushing=function(a,u){var l=u.startOffset,A=u.endOffset,I=u.endOffsetSubtitles,R=u.type,y=this.media;if(!(!y||y.currentTime<A)){if(!R||R==="video"){var v=this.captionsTracks;Object.keys(v).forEach(function(S){return Object(b.removeCuesInRange)(v[S],l,A)})}if(this.config.renderTextTracksNatively&&l===0&&I!==void 0){var m=this.textTracks;Object.keys(m).forEach(function(S){return Object(b.removeCuesInRange)(m[S],l,I)})}}},o.extractCea608Data=function(a){for(var u=a[0]&31,l=2,A=[[],[]],I=0;I<u;I++){var R=a[l++],y=127&a[l++],v=127&a[l++],m=(4&R)!==0,S=3&R;y===0&&v===0||m&&(S===0||S===1)&&(A[S].push(y),A[S].push(v))}return A},d}();function f(d,o){return d&&d.label===o.name&&!(d.textTrack1||d.textTrack2)}function p(d,o,s,a){return Math.min(o,a)-Math.max(d,s)}function _(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"default",function(){return W});var W=function(){function P(L,O){this.subtle=void 0,this.aesIV=void 0,this.subtle=L,this.aesIV=O}var E=P.prototype;return E.decrypt=function(O,b){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},b,O)},P}()},"./src/crypt/aes-decryptor.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"removePadding",function(){return P}),k.d(H,"default",function(){return E});var W=k("./src/utils/typed-array.ts");function P(L){var O=L.byteLength,b=O&&new DataView(L.buffer).getUint8(O-1);return b?Object(W.sliceUint8)(L,0,O-b):L}var E=function(){function L(){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 O=L.prototype;return O.uint8ArrayToUint32Array_=function(w){for(var g=new DataView(w),D=new Uint32Array(4),T=0;T<4;T++)D[T]=g.getUint32(T*4);return D},O.initTable=function(){var w=this.sBox,g=this.invSBox,D=this.subMix,T=D[0],f=D[1],p=D[2],_=D[3],d=this.invSubMix,o=d[0],s=d[1],a=d[2],u=d[3],l=new Uint32Array(256),A=0,I=0,R=0;for(R=0;R<256;R++)R<128?l[R]=R<<1:l[R]=R<<1^283;for(R=0;R<256;R++){var y=I^I<<1^I<<2^I<<3^I<<4;y=y>>>8^y&255^99,w[A]=y,g[y]=A;var v=l[A],m=l[v],S=l[m],B=l[y]*257^y*16843008;T[A]=B<<24|B>>>8,f[A]=B<<16|B>>>16,p[A]=B<<8|B>>>24,_[A]=B,B=S*16843009^m*65537^v*257^A*16843008,o[y]=B<<24|B>>>8,s[y]=B<<16|B>>>16,a[y]=B<<8|B>>>24,u[y]=B,A?(A=v^l[l[l[S^v]]],I^=l[l[I]]):A=I=1}},O.expandKey=function(w){for(var g=this.uint8ArrayToUint32Array_(w),D=!0,T=0;T<g.length&&D;)D=g[T]===this.key[T],T++;if(!D){this.key=g;var f=this.keySize=g.length;if(f!==4&&f!==6&&f!==8)throw new Error("Invalid aes key size="+f);var p=this.ksRows=(f+6+1)*4,_,d,o=this.keySchedule=new Uint32Array(p),s=this.invKeySchedule=new Uint32Array(p),a=this.sBox,u=this.rcon,l=this.invSubMix,A=l[0],I=l[1],R=l[2],y=l[3],v,m;for(_=0;_<p;_++){if(_<f){v=o[_]=g[_];continue}m=v,_%f===0?(m=m<<8|m>>>24,m=a[m>>>24]<<24|a[m>>>16&255]<<16|a[m>>>8&255]<<8|a[m&255],m^=u[_/f|0]<<24):f>6&&_%f===4&&(m=a[m>>>24]<<24|a[m>>>16&255]<<16|a[m>>>8&255]<<8|a[m&255]),o[_]=v=(o[_-f]^m)>>>0}for(d=0;d<p;d++)_=p-d,d&3?m=o[_]:m=o[_-4],d<4||_<=4?s[d]=m:s[d]=A[a[m>>>24]]^I[a[m>>>16&255]]^R[a[m>>>8&255]]^y[a[m&255]],s[d]=s[d]>>>0}},O.networkToHostOrderSwap=function(w){return w<<24|(w&65280)<<8|(w&16711680)>>8|w>>>24},O.decrypt=function(w,g,D){for(var T=this.keySize+6,f=this.invKeySchedule,p=this.invSBox,_=this.invSubMix,d=_[0],o=_[1],s=_[2],a=_[3],u=this.uint8ArrayToUint32Array_(D),l=u[0],A=u[1],I=u[2],R=u[3],y=new Int32Array(w),v=new Int32Array(y.length),m,S,B,N,M,U,K,j,X,ie,se,le,ve,q,ee=this.networkToHostOrderSwap;g<y.length;){for(X=ee(y[g]),ie=ee(y[g+1]),se=ee(y[g+2]),le=ee(y[g+3]),M=X^f[0],U=le^f[1],K=se^f[2],j=ie^f[3],ve=4,q=1;q<T;q++)m=d[M>>>24]^o[U>>16&255]^s[K>>8&255]^a[j&255]^f[ve],S=d[U>>>24]^o[K>>16&255]^s[j>>8&255]^a[M&255]^f[ve+1],B=d[K>>>24]^o[j>>16&255]^s[M>>8&255]^a[U&255]^f[ve+2],N=d[j>>>24]^o[M>>16&255]^s[U>>8&255]^a[K&255]^f[ve+3],M=m,U=S,K=B,j=N,ve=ve+4;m=p[M>>>24]<<24^p[U>>16&255]<<16^p[K>>8&255]<<8^p[j&255]^f[ve],S=p[U>>>24]<<24^p[K>>16&255]<<16^p[j>>8&255]<<8^p[M&255]^f[ve+1],B=p[K>>>24]<<24^p[j>>16&255]<<16^p[M>>8&255]<<8^p[U&255]^f[ve+2],N=p[j>>>24]<<24^p[M>>16&255]<<16^p[U>>8&255]<<8^p[K&255]^f[ve+3],v[g]=ee(m^l),v[g+1]=ee(N^A),v[g+2]=ee(B^I),v[g+3]=ee(S^R),l=X,A=ie,I=se,R=le,g=g+4}return v.buffer},L}()},"./src/crypt/decrypter.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"default",function(){return g});var W=k("./src/crypt/aes-crypto.ts"),P=k("./src/crypt/fast-aes-key.ts"),E=k("./src/crypt/aes-decryptor.ts"),L=k("./src/utils/logger.ts"),O=k("./src/utils/mp4-tools.ts"),b=k("./src/utils/typed-array.ts"),w=16,g=function(){function D(f,p,_){var d=_===void 0?{}:_,o=d.removePKCS7Padding,s=o===void 0?!0:o;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=f,this.config=p,this.removePKCS7Padding=s,s)try{var a=self.crypto;a&&(this.subtle=a.subtle||a.webkitSubtle)}catch(u){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var T=D.prototype;return T.destroy=function(){this.observer=null},T.isSync=function(){return this.config.enableSoftwareAES},T.flush=function(){var p=this.currentResult;if(!p){this.reset();return}var _=new Uint8Array(p);return this.reset(),this.removePKCS7Padding?Object(E.removePadding)(_):_},T.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},T.decrypt=function(p,_,d,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(p),_,d);var s=this.flush();s&&o(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(p),_,d).then(o)},T.softwareDecrypt=function(p,_,d){var o=this.currentIV,s=this.currentResult,a=this.remainderData;this.logOnce("JS AES decrypt"),a&&(p=Object(O.appendUint8Array)(a,p),this.remainderData=null);var u=this.getValidChunk(p);if(!u.length)return null;o&&(d=o);var l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new E.default),l.expandKey(_);var A=s;return this.currentResult=l.decrypt(u.buffer,0,d),this.currentIV=Object(b.sliceUint8)(u,-16).buffer,A||null},T.webCryptoDecrypt=function(p,_,d){var o=this,s=this.subtle;return(this.key!==_||!this.fastAesKey)&&(this.key=_,this.fastAesKey=new P.default(s,_)),this.fastAesKey.expandKey().then(function(a){if(!s)return Promise.reject(new Error("web crypto not initialized"));var u=new W.default(s,d);return u.decrypt(p.buffer,a)}).catch(function(a){return o.onWebCryptoError(a,p,_,d)})},T.onWebCryptoError=function(p,_,d,o){return L.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",p),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(_,d,o)},T.getValidChunk=function(p){var _=p,d=p.length-p.length%w;return d!==p.length&&(_=Object(b.sliceUint8)(p,0,d),this.remainderData=Object(b.sliceUint8)(p,d)),_},T.logOnce=function(p){!this.logEnabled||(L.logger.log("[decrypter.ts]: "+p),this.logEnabled=!1)},D}()},"./src/crypt/fast-aes-key.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"default",function(){return W});var W=function(){function P(L,O){this.subtle=void 0,this.key=void 0,this.subtle=L,this.key=O}var E=P.prototype;return E.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},P}()},"./src/demux/aacdemuxer.ts":function(he,H,k){"use strict";k.r(H);var W=k("./src/demux/base-audio-demuxer.ts"),P=k("./src/demux/adts.ts"),E=k("./src/utils/logger.ts"),L=k("./src/demux/id3.ts");function O(g,D){g.prototype=Object.create(D.prototype),g.prototype.constructor=g,b(g,D)}function b(g,D){return b=Object.setPrototypeOf||function(f,p){return f.__proto__=p,f},b(g,D)}var w=function(g){O(D,g);function D(f,p){var _;return _=g.call(this)||this,_.observer=void 0,_.config=void 0,_.observer=f,_.config=p,_}var T=D.prototype;return T.resetInitSegment=function(p,_,d){g.prototype.resetInitSegment.call(this,p,_,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:p,duration:d,inputTimeScale:9e4,dropped:0}},D.probe=function(p){if(!p)return!1;for(var _=L.getID3Data(p,0)||[],d=_.length,o=p.length;d<o;d++)if(P.probe(p,d))return E.logger.log("ADTS sync word found !"),!0;return!1},T.canParse=function(p,_){return P.canParse(p,_)},T.appendFrame=function(p,_,d){P.initTrackConfig(p,this.observer,_,d,p.manifestCodec);var o=P.appendFrame(p,_,d,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},D}(W.default);w.minProbeByteLength=9,H.default=w},"./src/demux/adts.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"getAudioConfig",function(){return L}),k.d(H,"isHeaderPattern",function(){return O}),k.d(H,"getHeaderLength",function(){return b}),k.d(H,"getFullFrameLength",function(){return w}),k.d(H,"canGetFrameLength",function(){return g}),k.d(H,"isHeader",function(){return D}),k.d(H,"canParse",function(){return T}),k.d(H,"probe",function(){return f}),k.d(H,"initTrackConfig",function(){return p}),k.d(H,"getFrameDuration",function(){return _}),k.d(H,"parseFrameHeader",function(){return d}),k.d(H,"appendFrame",function(){return o});var W=k("./src/utils/logger.ts"),P=k("./src/errors.ts"),E=k("./src/events.ts");function L(s,a,u,l){var A,I,R,y,v=navigator.userAgent.toLowerCase(),m=l,S=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];A=((a[u+2]&192)>>>6)+1;var B=(a[u+2]&60)>>>2;if(B>S.length-1){s.trigger(E.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+B});return}return R=(a[u+2]&1)<<2,R|=(a[u+3]&192)>>>6,W.logger.log("manifest codec:"+l+", ADTS type:"+A+", samplingIndex:"+B),/firefox/i.test(v)?B>=6?(A=5,y=new Array(4),I=B-3):(A=2,y=new Array(2),I=B):v.indexOf("android")!==-1?(A=2,y=new Array(2),I=B):(A=5,y=new Array(4),l&&(l.indexOf("mp4a.40.29")!==-1||l.indexOf("mp4a.40.5")!==-1)||!l&&B>=6?I=B-3:((l&&l.indexOf("mp4a.40.2")!==-1&&(B>=6&&R===1||/vivaldi/i.test(v))||!l&&R===1)&&(A=2,y=new Array(2)),I=B)),y[0]=A<<3,y[0]|=(B&14)>>1,y[1]|=(B&1)<<7,y[1]|=R<<3,A===5&&(y[1]|=(I&14)>>1,y[2]=(I&1)<<7,y[2]|=2<<2,y[3]=0),{config:y,samplerate:S[B],channelCount:R,codec:"mp4a.40."+A,manifestCodec:m}}function O(s,a){return s[a]===255&&(s[a+1]&246)===240}function b(s,a){return s[a+1]&1?7:9}function w(s,a){return(s[a+3]&3)<<11|s[a+4]<<3|(s[a+5]&224)>>>5}function g(s,a){return a+5<s.length}function D(s,a){return a+1<s.length&&O(s,a)}function T(s,a){return g(s,a)&&O(s,a)&&w(s,a)<=s.length-a}function f(s,a){if(D(s,a)){var u=b(s,a);if(a+u>=s.length)return!1;var l=w(s,a);if(l<=u)return!1;var A=a+l;return A===s.length||D(s,A)}return!1}function p(s,a,u,l,A){if(!s.samplerate){var I=L(a,u,l,A);if(!I)return;s.config=I.config,s.samplerate=I.samplerate,s.channelCount=I.channelCount,s.codec=I.codec,s.manifestCodec=I.manifestCodec,W.logger.log("parsed codec:"+s.codec+", rate:"+I.samplerate+", channels:"+I.channelCount)}}function _(s){return 1024*9e4/s}function d(s,a,u,l,A){var I=b(s,a),R=w(s,a);if(R-=I,R>0){var y=u+l*A;return{headerLength:I,frameLength:R,stamp:y}}}function o(s,a,u,l,A){var I=_(s.samplerate),R=d(a,u,l,A,I);if(R){var y=R.frameLength,v=R.headerLength,m=R.stamp,S=v+y,B=Math.max(0,u+S-a.length),N;B?(N=new Uint8Array(S-v),N.set(a.subarray(u+v,a.length),0)):N=a.subarray(u+v,u+S);var M={unit:N,pts:m};return B||s.samples.push(M),{sample:M,length:S,missing:B}}}},"./src/demux/base-audio-demuxer.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"initPTSFn",function(){return w});var W=k("./src/polyfills/number.ts"),P=k("./src/demux/id3.ts"),E=k("./src/demux/dummy-demuxed-track.ts"),L=k("./src/utils/mp4-tools.ts"),O=k("./src/utils/typed-array.ts"),b=function(){function g(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var D=g.prototype;return D.resetInitSegment=function(f,p,_){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},D.resetTimeStamp=function(){},D.resetContiguity=function(){},D.canParse=function(f,p){return!1},D.appendFrame=function(f,p,_){},D.demux=function(f,p){this.cachedData&&(f=Object(L.appendUint8Array)(this.cachedData,f),this.cachedData=null);var _=P.getID3Data(f,0),d=_?_.length:0,o,s,a=this._audioTrack,u=this._id3Track,l=_?P.getTimeStamp(_):void 0,A=f.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=w(l,p)),_&&_.length>0&&u.samples.push({pts:this.initPTS,dts:this.initPTS,data:_}),s=this.initPTS;d<A;){if(this.canParse(f,d)){var I=this.appendFrame(a,f,d);I?(this.frameIndex++,s=I.sample.pts,d+=I.length,o=d):d=A}else P.canParse(f,d)?(_=P.getID3Data(f,d),u.samples.push({pts:s,dts:s,data:_}),d+=_.length,o=d):d++;if(d===A&&o!==A){var R=Object(O.sliceUint8)(f,o);this.cachedData?this.cachedData=Object(L.appendUint8Array)(this.cachedData,R):this.cachedData=R}}return{audioTrack:a,avcTrack:Object(E.dummyTrack)(),id3Track:u,textTrack:Object(E.dummyTrack)()}},D.demuxSampleAes=function(f,p,_){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},D.flush=function(f){var p=this.cachedData;return p&&(this.cachedData=null,this.demux(p,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(E.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(E.dummyTrack)()}},D.destroy=function(){},g}(),w=function(D,T){return Object(W.isFiniteNumber)(D)?D*90:T*9e4};H.default=b},"./src/demux/chunk-cache.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"default",function(){return W});var W=function(){function E(){this.chunks=[],this.dataLength=0}var L=E.prototype;return L.push=function(b){this.chunks.push(b),this.dataLength+=b.length},L.flush=function(){var b=this.chunks,w=this.dataLength,g;if(b.length)b.length===1?g=b[0]:g=P(b,w);else return new Uint8Array(0);return this.reset(),g},L.reset=function(){this.chunks.length=0,this.dataLength=0},E}();function P(E,L){for(var O=new Uint8Array(L),b=0,w=0;w<E.length;w++){var g=E[w];O.set(g,b),b+=g.length}return O}},"./src/demux/dummy-demuxed-track.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"dummyTrack",function(){return W});function W(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(he,H,k){"use strict";k.r(H);var W=k("./src/utils/logger.ts"),P=function(){function E(O){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=O,this.bytesAvailable=O.byteLength,this.word=0,this.bitsAvailable=0}var L=E.prototype;return L.loadWord=function(){var b=this.data,w=this.bytesAvailable,g=b.byteLength-w,D=new Uint8Array(4),T=Math.min(4,w);if(T===0)throw new Error("no bytes available");D.set(b.subarray(g,g+T)),this.word=new DataView(D.buffer).getUint32(0),this.bitsAvailable=T*8,this.bytesAvailable-=T},L.skipBits=function(b){var w;this.bitsAvailable>b?(this.word<<=b,this.bitsAvailable-=b):(b-=this.bitsAvailable,w=b>>3,b-=w>>3,this.bytesAvailable-=w,this.loadWord(),this.word<<=b,this.bitsAvailable-=b)},L.readBits=function(b){var w=Math.min(this.bitsAvailable,b),g=this.word>>>32-w;return b>32&&W.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=w,this.bitsAvailable>0?this.word<<=w:this.bytesAvailable>0&&this.loadWord(),w=b-w,w>0&&this.bitsAvailable?g<<w|this.readBits(w):g},L.skipLZ=function(){var b;for(b=0;b<this.bitsAvailable;++b)if((this.word&2147483648>>>b)!==0)return this.word<<=b,this.bitsAvailable-=b,b;return this.loadWord(),b+this.skipLZ()},L.skipUEG=function(){this.skipBits(1+this.skipLZ())},L.skipEG=function(){this.skipBits(1+this.skipLZ())},L.readUEG=function(){var b=this.skipLZ();return this.readBits(b+1)-1},L.readEG=function(){var b=this.readUEG();return 1&b?1+b>>>1:-1*(b>>>1)},L.readBoolean=function(){return this.readBits(1)===1},L.readUByte=function(){return this.readBits(8)},L.readUShort=function(){return this.readBits(16)},L.readUInt=function(){return this.readBits(32)},L.skipScalingList=function(b){for(var w=8,g=8,D,T=0;T<b;T++)g!==0&&(D=this.readEG(),g=(w+D+256)%256),w=g===0?w:g},L.readSPS=function(){var b=0,w=0,g=0,D=0,T,f,p,_=this.readUByte.bind(this),d=this.readBits.bind(this),o=this.readUEG.bind(this),s=this.readBoolean.bind(this),a=this.skipBits.bind(this),u=this.skipEG.bind(this),l=this.skipUEG.bind(this),A=this.skipScalingList.bind(this);_();var I=_();if(d(5),a(3),_(),l(),I===100||I===110||I===122||I===244||I===44||I===83||I===86||I===118||I===128){var R=o();if(R===3&&a(1),l(),l(),a(1),s())for(f=R!==3?8:12,p=0;p<f;p++)s()&&(p<6?A(16):A(64))}l();var y=o();if(y===0)o();else if(y===1)for(a(1),u(),u(),T=o(),p=0;p<T;p++)u();l(),a(1);var v=o(),m=o(),S=d(1);S===0&&a(1),a(1),s()&&(b=o(),w=o(),g=o(),D=o());var B=[1,1];if(s()&&s()){var N=_();switch(N){case 1:B=[1,1];break;case 2:B=[12,11];break;case 3:B=[10,11];break;case 4:B=[16,11];break;case 5:B=[40,33];break;case 6:B=[24,11];break;case 7:B=[20,11];break;case 8:B=[32,11];break;case 9:B=[80,33];break;case 10:B=[18,11];break;case 11:B=[15,11];break;case 12:B=[64,33];break;case 13:B=[160,99];break;case 14:B=[4,3];break;case 15:B=[3,2];break;case 16:B=[2,1];break;case 255:{B=[_()<<8|_(),_()<<8|_()];break}}}return{width:Math.ceil((v+1)*16-b*2-w*2),height:(2-S)*(m+1)*16-(S?2:4)*(g+D),pixelRatio:B}},L.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},E}();H.default=P},"./src/demux/id3.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"isHeader",function(){return W}),k.d(H,"isFooter",function(){return P}),k.d(H,"getID3Data",function(){return E}),k.d(H,"canParse",function(){return O}),k.d(H,"getTimeStamp",function(){return b}),k.d(H,"isTimeStampFrame",function(){return w}),k.d(H,"getID3Frames",function(){return D}),k.d(H,"decodeFrame",function(){return T}),k.d(H,"utf8ArrayToStr",function(){return o}),k.d(H,"testables",function(){return s});var W=function(A,I){return I+10<=A.length&&A[I]===73&&A[I+1]===68&&A[I+2]===51&&A[I+3]<255&&A[I+4]<255&&A[I+6]<128&&A[I+7]<128&&A[I+8]<128&&A[I+9]<128},P=function(A,I){return I+10<=A.length&&A[I]===51&&A[I+1]===68&&A[I+2]===73&&A[I+3]<255&&A[I+4]<255&&A[I+6]<128&&A[I+7]<128&&A[I+8]<128&&A[I+9]<128},E=function(A,I){for(var R=I,y=0;W(A,I);){y+=10;var v=L(A,I+6);y+=v,P(A,I+10)&&(y+=10),I+=y}if(y>0)return A.subarray(R,R+y)},L=function(A,I){var R=0;return R=(A[I]&127)<<21,R|=(A[I+1]&127)<<14,R|=(A[I+2]&127)<<7,R|=A[I+3]&127,R},O=function(A,I){return W(A,I)&&L(A,I+6)+10<=A.length-I},b=function(A){for(var I=D(A),R=0;R<I.length;R++){var y=I[R];if(w(y))return d(y)}},w=function(A){return A&&A.key==="PRIV"&&A.info==="com.apple.streaming.transportStreamTimestamp"},g=function(A){var I=String.fromCharCode(A[0],A[1],A[2],A[3]),R=L(A,4),y=10;return{type:I,size:R,data:A.subarray(y,y+R)}},D=function(A){for(var I=0,R=[];W(A,I);){var y=L(A,I+6);I+=10;for(var v=I+y;I+8<v;){var m=g(A.subarray(I)),S=T(m);S&&R.push(S),I+=m.size+10}P(A,I)&&(I+=10)}return R},T=function(A){return A.type==="PRIV"?f(A):A.type[0]==="W"?_(A):p(A)},f=function(A){if(!(A.size<2)){var I=o(A.data,!0),R=new Uint8Array(A.data.subarray(I.length+1));return{key:A.type,info:I,data:R.buffer}}},p=function(A){if(!(A.size<2)){if(A.type==="TXXX"){var I=1,R=o(A.data.subarray(I),!0);I+=R.length+1;var y=o(A.data.subarray(I));return{key:A.type,info:R,data:y}}var v=o(A.data.subarray(1));return{key:A.type,data:v}}},_=function(A){if(A.type==="WXXX"){if(A.size<2)return;var I=1,R=o(A.data.subarray(I),!0);I+=R.length+1;var y=o(A.data.subarray(I));return{key:A.type,info:R,data:y}}var v=o(A.data);return{key:A.type,data:v}},d=function(A){if(A.data.byteLength===8){var I=new Uint8Array(A.data),R=I[3]&1,y=(I[4]<<23)+(I[5]<<15)+(I[6]<<7)+I[7];return y/=45,R&&(y+=4772185884e-2),Math.round(y)}},o=function(A,I){I===void 0&&(I=!1);var R=u();if(R){var y=R.decode(A);if(I){var v=y.indexOf("\0");return v!==-1?y.substring(0,v):y}return y.replace(/\0/g,"")}for(var m=A.length,S,B,N,M="",U=0;U<m;){if(S=A[U++],S===0&&I)return M;if(S===0||S===3)continue;switch(S>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:M+=String.fromCharCode(S);break;case 12:case 13:B=A[U++],M+=String.fromCharCode((S&31)<<6|B&63);break;case 14:B=A[U++],N=A[U++],M+=String.fromCharCode((S&15)<<12|(B&63)<<6|(N&63)<<0);break;default:}}return M},s={decodeTextFrame:p},a;function u(){return!a&&typeof self.TextDecoder!="undefined"&&(a=new self.TextDecoder("utf-8")),a}},"./src/demux/mp3demuxer.ts":function(he,H,k){"use strict";k.r(H);var W=k("./src/demux/base-audio-demuxer.ts"),P=k("./src/demux/id3.ts"),E=k("./src/utils/logger.ts"),L=k("./src/demux/mpegaudio.ts");function O(g,D){g.prototype=Object.create(D.prototype),g.prototype.constructor=g,b(g,D)}function b(g,D){return b=Object.setPrototypeOf||function(f,p){return f.__proto__=p,f},b(g,D)}var w=function(g){O(D,g);function D(){return g.apply(this,arguments)||this}var T=D.prototype;return T.resetInitSegment=function(p,_,d){g.prototype.resetInitSegment.call(this,p,_,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:p,duration:d,inputTimeScale:9e4,dropped:0}},D.probe=function(p){if(!p)return!1;for(var _=P.getID3Data(p,0)||[],d=_.length,o=p.length;d<o;d++)if(L.probe(p,d))return E.logger.log("MPEG Audio sync word found !"),!0;return!1},T.canParse=function(p,_){return L.canParse(p,_)},T.appendFrame=function(p,_,d){if(this.initPTS!==null)return L.appendFrame(p,_,d,this.initPTS,this.frameIndex)},D}(W.default);w.minProbeByteLength=4,H.default=w},"./src/demux/mp4demuxer.ts":function(he,H,k){"use strict";k.r(H);var W=k("./src/utils/mp4-tools.ts"),P=k("./src/demux/dummy-demuxed-track.ts"),E=function(){function L(b,w){this.remainderData=null,this.config=void 0,this.config=w}var O=L.prototype;return O.resetTimeStamp=function(){},O.resetInitSegment=function(){},O.resetContiguity=function(){},L.probe=function(w){return Object(W.findBox)({data:w,start:0,end:Math.min(w.length,16384)},["moof"]).length>0},O.demux=function(w){var g=w,D=Object(P.dummyTrack)();if(this.config.progressive){this.remainderData&&(g=Object(W.appendUint8Array)(this.remainderData,w));var T=Object(W.segmentValidRange)(g);this.remainderData=T.remainder,D.samples=T.valid||new Uint8Array}else D.samples=g;return{audioTrack:Object(P.dummyTrack)(),avcTrack:D,id3Track:Object(P.dummyTrack)(),textTrack:Object(P.dummyTrack)()}},O.flush=function(){var w=Object(P.dummyTrack)();return w.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(P.dummyTrack)(),avcTrack:w,id3Track:Object(P.dummyTrack)(),textTrack:Object(P.dummyTrack)()}},O.demuxSampleAes=function(w,g,D){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},O.destroy=function(){},L}();E.minProbeByteLength=1024,H.default=E},"./src/demux/mpegaudio.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"appendFrame",function(){return b}),k.d(H,"parseHeader",function(){return w}),k.d(H,"isHeaderPattern",function(){return g}),k.d(H,"isHeader",function(){return D}),k.d(H,"canParse",function(){return T}),k.d(H,"probe",function(){return f});var W=null,P=[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],E=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],L=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],O=[0,1,1,4];function b(p,_,d,o,s){if(!(d+24>_.length)){var a=w(_,d);if(a&&d+a.frameLength<=_.length){var u=a.samplesPerFrame*9e4/a.sampleRate,l=o+s*u,A={unit:_.subarray(d,d+a.frameLength),pts:l,dts:l};return p.config=[],p.channelCount=a.channelCount,p.samplerate=a.sampleRate,p.samples.push(A),{sample:A,length:a.frameLength,missing:0}}}}function w(p,_){var d=p[_+1]>>3&3,o=p[_+1]>>1&3,s=p[_+2]>>4&15,a=p[_+2]>>2&3;if(d!==1&&s!==0&&s!==15&&a!==3){var u=p[_+2]>>1&1,l=p[_+3]>>6,A=d===3?3-o:o===3?3:4,I=P[A*14+s-1]*1e3,R=d===3?0:d===2?1:2,y=E[R*3+a],v=l===3?1:2,m=L[d][o],S=O[o],B=m*8*S,N=Math.floor(m*I/y+u)*S;if(W===null){var M=navigator.userAgent||"",U=M.match(/Chrome\/(\d+)/i);W=U?parseInt(U[1]):0}var K=!!W&&W<=87;return K&&o===2&&I>=224e3&&l===0&&(p[_+3]=p[_+3]|128),{sampleRate:y,channelCount:v,frameLength:N,samplesPerFrame:B}}}function g(p,_){return p[_]===255&&(p[_+1]&224)===224&&(p[_+1]&6)!==0}function D(p,_){return _+1<p.length&&g(p,_)}function T(p,_){var d=4;return g(p,_)&&d<=p.length-_}function f(p,_){if(_+1<p.length&&g(p,_)){var d=4,o=w(p,_),s=d;o!=null&&o.frameLength&&(s=o.frameLength);var a=_+s;return a===p.length||D(p,a)}return!1}},"./src/demux/sample-aes.ts":function(he,H,k){"use strict";k.r(H);var W=k("./src/crypt/decrypter.ts"),P=k("./src/demux/tsdemuxer.ts"),E=function(){function L(b,w,g){this.keyData=void 0,this.decrypter=void 0,this.keyData=g,this.decrypter=new W.default(b,w,{removePKCS7Padding:!1})}var O=L.prototype;return O.decryptBuffer=function(w,g){this.decrypter.decrypt(w,this.keyData.key.buffer,this.keyData.iv.buffer,g)},O.decryptAacSample=function(w,g,D,T){var f=w[g].unit,p=f.subarray(16,f.length-f.length%16),_=p.buffer.slice(p.byteOffset,p.byteOffset+p.length),d=this;this.decryptBuffer(_,function(o){var s=new Uint8Array(o);f.set(s,16),T||d.decryptAacSamples(w,g+1,D)})},O.decryptAacSamples=function(w,g,D){for(;;g++){if(g>=w.length){D();return}if(!(w[g].unit.length<32)){var T=this.decrypter.isSync();if(this.decryptAacSample(w,g,D,T),!T)return}}},O.getAvcEncryptedData=function(w){for(var g=Math.floor((w.length-48)/160)*16+16,D=new Int8Array(g),T=0,f=32;f<=w.length-16;f+=160,T+=16)D.set(w.subarray(f,f+16),T);return D},O.getAvcDecryptedUnit=function(w,g){for(var D=new Uint8Array(g),T=0,f=32;f<=w.length-16;f+=160,T+=16)w.set(D.subarray(T,T+16),f);return w},O.decryptAvcSample=function(w,g,D,T,f,p){var _=Object(P.discardEPB)(f.data),d=this.getAvcEncryptedData(_),o=this;this.decryptBuffer(d.buffer,function(s){f.data=o.getAvcDecryptedUnit(_,s),p||o.decryptAvcSamples(w,g,D+1,T)})},O.decryptAvcSamples=function(w,g,D,T){if(w instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;g++,D=0){if(g>=w.length){T();return}for(var f=w[g].units;!(D>=f.length);D++){var p=f[D];if(!(p.data.length<=48||p.type!==1&&p.type!==5)){var _=this.decrypter.isSync();if(this.decryptAvcSample(w,g,D,T,p,_),!_)return}}}},L}();H.default=E},"./src/demux/transmuxer-interface.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"default",function(){return f});var W=k("./node_modules/webworkify-webpack/index.js"),P=k.n(W),E=k("./src/events.ts"),L=k("./src/demux/transmuxer.ts"),O=k("./src/utils/logger.ts"),b=k("./src/errors.ts"),w=k("./src/utils/mediasource-helper.ts"),g=k("./node_modules/eventemitter3/index.js"),D=k.n(g),T=Object(w.getMediaSource)()||{isTypeSupported:function(){return!1}},f=function(){function p(d,o,s,a){var u=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=d,this.id=o,this.onTransmuxComplete=s,this.onFlush=a;var l=d.config,A=function(m,S){S=S||{},S.frag=u.frag,S.id=u.id,d.trigger(m,S)};this.observer=new g.EventEmitter,this.observer.on(E.Events.FRAG_DECRYPTED,A),this.observer.on(E.Events.ERROR,A);var I={mp4:T.isTypeSupported("video/mp4"),mpeg:T.isTypeSupported("audio/mpeg"),mp3:T.isTypeSupported('audio/mp4; codecs="mp3"')},R=navigator.vendor;if(l.enableWorker&&typeof Worker!="undefined"){O.logger.log("demuxing in webworker");var y;try{y=this.worker=W("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),y.addEventListener("message",this.onwmsg),y.onerror=function(v){d.trigger(E.Events.ERROR,{type:b.ErrorTypes.OTHER_ERROR,details:b.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(v.message+" ("+v.filename+":"+v.lineno+")")})},y.postMessage({cmd:"init",typeSupported:I,vendor:R,id:o,config:JSON.stringify(l)})}catch(v){O.logger.warn("Error in worker:",v),O.logger.error("Error while initializing DemuxerWorker, fallback to inline"),y&&self.URL.revokeObjectURL(y.objectURL),this.transmuxer=new L.default(this.observer,I,l,R,o),this.worker=null}}else this.transmuxer=new L.default(this.observer,I,l,R,o)}var _=p.prototype;return _.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var a=this.observer;a&&a.removeAllListeners(),this.observer=null},_.push=function(o,s,a,u,l,A,I,R,y,v){var m=this;y.transmuxing.start=self.performance.now();var S=this.transmuxer,B=this.worker,N=A?A.start:l.start,M=l.decryptdata,U=this.frag,K=!(U&&l.cc===U.cc),j=!(U&&y.level===U.level),X=U?y.sn-U.sn:-1,ie=this.part?y.part-this.part.index:1,se=!j&&(X===1||X===0&&ie===1),le=self.performance.now();(j||X||l.stats.parsing.start===0)&&(l.stats.parsing.start=le),A&&(ie||!se)&&(A.stats.parsing.start=le);var ve=new L.TransmuxState(K,se,R,j,N);if(!se||K){O.logger.log("[transmuxer-interface, "+l.type+"]: Starting new transmux session for sn: "+y.sn+" p: "+y.part+" level: "+y.level+" id: "+y.id+`
149
- discontinuity: `+K+`
150
- trackSwitch: `+j+`
151
- contiguous: `+se+`
152
- accurateTimeOffset: `+R+`
153
- timeOffset: `+N);var q=new L.TransmuxConfig(a,u,s,I,v);this.configureTransmuxer(q)}if(this.frag=l,this.part=A,B)B.postMessage({cmd:"demux",data:o,decryptdata:M,chunkMeta:y,state:ve},o instanceof ArrayBuffer?[o]:[]);else if(S){var ee=S.push(o,M,y,ve);Object(L.isPromise)(ee)?ee.then(function(ae){m.handleTransmuxComplete(ae)}):this.handleTransmuxComplete(ee)}},_.flush=function(o){var s=this;o.transmuxing.start=self.performance.now();var a=this.transmuxer,u=this.worker;if(u)u.postMessage({cmd:"flush",chunkMeta:o});else if(a){var l=a.flush(o);Object(L.isPromise)(l)?l.then(function(A){s.handleFlushResult(A,o)}):this.handleFlushResult(l,o)}},_.handleFlushResult=function(o,s){var a=this;o.forEach(function(u){a.handleTransmuxComplete(u)}),this.onFlush(s)},_.onWorkerMessage=function(o){var s=o.data,a=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,a.trigger(s.event,s.data);break}}},_.configureTransmuxer=function(o){var s=this.worker,a=this.transmuxer;s?s.postMessage({cmd:"configure",config:o}):a&&a.configure(o)},_.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},p}()},"./src/demux/transmuxer-worker.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"default",function(){return b});var W=k("./src/demux/transmuxer.ts"),P=k("./src/events.ts"),E=k("./src/utils/logger.ts"),L=k("./node_modules/eventemitter3/index.js"),O=k.n(L);function b(f){var p=new L.EventEmitter,_=function(o,s){f.postMessage({event:o,data:s})};p.on(P.Events.FRAG_DECRYPTED,_),p.on(P.Events.ERROR,_),f.addEventListener("message",function(d){var o=d.data;switch(o.cmd){case"init":{var s=JSON.parse(o.config);f.transmuxer=new W.default(p,o.typeSupported,s,o.vendor,o.id),Object(E.enableLogs)(s.debug),_("init",null);break}case"configure":{f.transmuxer.configure(o.config);break}case"demux":{var a=f.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(W.isPromise)(a)?a.then(function(A){w(f,A)}):w(f,a);break}case"flush":{var u=o.chunkMeta,l=f.transmuxer.flush(u);Object(W.isPromise)(l)?l.then(function(A){D(f,A,u)}):D(f,l,u);break}default:break}})}function w(f,p){if(!T(p.remuxResult)){var _=[],d=p.remuxResult,o=d.audio,s=d.video;o&&g(_,o),s&&g(_,s),f.postMessage({event:"transmuxComplete",data:p},_)}}function g(f,p){p.data1&&f.push(p.data1.buffer),p.data2&&f.push(p.data2.buffer)}function D(f,p,_){p.forEach(function(d){w(f,d)}),f.postMessage({event:"flush",data:_})}function T(f){return!f.audio&&!f.video&&!f.text&&!f.id3&&!f.initSegment}},"./src/demux/transmuxer.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"default",function(){return s}),k.d(H,"isPromise",function(){return l}),k.d(H,"TransmuxConfig",function(){return A}),k.d(H,"TransmuxState",function(){return I});var W=k("./src/events.ts"),P=k("./src/errors.ts"),E=k("./src/crypt/decrypter.ts"),L=k("./src/demux/aacdemuxer.ts"),O=k("./src/demux/mp4demuxer.ts"),b=k("./src/demux/tsdemuxer.ts"),w=k("./src/demux/mp3demuxer.ts"),g=k("./src/remux/mp4-remuxer.ts"),D=k("./src/remux/passthrough-remuxer.ts"),T=k("./src/demux/chunk-cache.ts"),f=k("./src/utils/mp4-tools.ts"),p=k("./src/utils/logger.ts"),_;try{_=self.performance.now.bind(self.performance)}catch(R){p.logger.debug("Unable to use Performance API on this environment"),_=self.Date.now}var d=[{demux:b.default,remux:g.default},{demux:O.default,remux:D.default},{demux:L.default,remux:g.default},{demux:w.default,remux:g.default}],o=1024;d.forEach(function(R){var y=R.demux;o=Math.max(o,y.minProbeByteLength)});var s=function(){function R(v,m,S,B,N){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new T.default,this.observer=v,this.typeSupported=m,this.config=S,this.vendor=B,this.id=N}var y=R.prototype;return y.configure=function(m){this.transmuxConfig=m,this.decrypter&&this.decrypter.reset()},y.push=function(m,S,B,N){var M=this,U=B.transmuxing;U.executeStart=_();var K=new Uint8Array(m),j=this.cache,X=this.config,ie=this.currentTransmuxState,se=this.transmuxConfig;N&&(this.currentTransmuxState=N);var le=a(K,S);if(le&&le.method==="AES-128"){var ve=this.getDecrypter();if(X.enableSoftwareAES){var q=ve.softwareDecrypt(K,le.key.buffer,le.iv.buffer);if(!q)return U.executeEnd=_(),u(B);K=new Uint8Array(q)}else return this.decryptionPromise=ve.webCryptoDecrypt(K,le.key.buffer,le.iv.buffer).then(function(Mt){var cr=M.push(Mt,null,B);return M.decryptionPromise=null,cr}),this.decryptionPromise}var ee=N||ie,ae=ee.contiguous,_e=ee.discontinuity,fe=ee.trackSwitch,Ge=ee.accurateTimeOffset,Te=ee.timeOffset,Ue=se.audioCodec,Ze=se.videoCodec,ut=se.defaultInitPts,Fe=se.duration,Ye=se.initSegmentData;if((_e||fe)&&this.resetInitSegment(Ye,Ue,Ze,Fe),_e&&this.resetInitialTimestamp(ut),ae||this.resetContiguity(),this.needsProbing(K,_e,fe)){if(j.dataLength){var Ht=j.flush();K=Object(f.appendUint8Array)(Ht,K)}this.configureTransmuxer(K,se)}var Bt=this.transmux(K,le,Te,Ge,B),Ft=this.currentTransmuxState;return Ft.contiguous=!0,Ft.discontinuity=!1,Ft.trackSwitch=!1,U.executeEnd=_(),Bt},y.flush=function(m){var S=this,B=m.transmuxing;B.executeStart=_();var N=this.decrypter,M=this.cache,U=this.currentTransmuxState,K=this.decryptionPromise;if(K)return K.then(function(){return S.flush(m)});var j=[],X=U.timeOffset;if(N){var ie=N.flush();ie&&j.push(this.push(ie,null,m))}var se=M.dataLength;M.reset();var le=this.demuxer,ve=this.remuxer;if(!le||!ve)return se>=o&&this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),B.executeEnd=_(),[u(m)];var q=le.flush(X);return l(q)?q.then(function(ee){return S.flushRemux(j,ee,m),j}):(this.flushRemux(j,q,m),j)},y.flushRemux=function(m,S,B){var N=S.audioTrack,M=S.avcTrack,U=S.id3Track,K=S.textTrack,j=this.currentTransmuxState,X=j.accurateTimeOffset,ie=j.timeOffset;p.logger.log("[transmuxer.ts]: Flushed fragment "+B.sn+(B.part>-1?" p: "+B.part:"")+" of level "+B.level);var se=this.remuxer.remux(N,M,U,K,ie,X,!0,this.id);m.push({remuxResult:se,chunkMeta:B}),B.transmuxing.executeEnd=_()},y.resetInitialTimestamp=function(m){var S=this.demuxer,B=this.remuxer;!S||!B||(S.resetTimeStamp(m),B.resetTimeStamp(m))},y.resetContiguity=function(){var m=this.demuxer,S=this.remuxer;!m||!S||(m.resetContiguity(),S.resetNextTimestamp())},y.resetInitSegment=function(m,S,B,N){var M=this.demuxer,U=this.remuxer;!M||!U||(M.resetInitSegment(S,B,N),U.resetInitSegment(m,S,B))},y.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},y.transmux=function(m,S,B,N,M){var U;return S&&S.method==="SAMPLE-AES"?U=this.transmuxSampleAes(m,S,B,N,M):U=this.transmuxUnencrypted(m,B,N,M),U},y.transmuxUnencrypted=function(m,S,B,N){var M=this.demuxer.demux(m,S,!1,!this.config.progressive),U=M.audioTrack,K=M.avcTrack,j=M.id3Track,X=M.textTrack,ie=this.remuxer.remux(U,K,j,X,S,B,!1,this.id);return{remuxResult:ie,chunkMeta:N}},y.transmuxSampleAes=function(m,S,B,N,M){var U=this;return this.demuxer.demuxSampleAes(m,S,B).then(function(K){var j=U.remuxer.remux(K.audioTrack,K.avcTrack,K.id3Track,K.textTrack,B,N,!1,U.id);return{remuxResult:j,chunkMeta:M}})},y.configureTransmuxer=function(m,S){for(var B=this.config,N=this.observer,M=this.typeSupported,U=this.vendor,K=S.audioCodec,j=S.defaultInitPts,X=S.duration,ie=S.initSegmentData,se=S.videoCodec,le,ve=0,q=d.length;ve<q;ve++)if(d[ve].demux.probe(m)){le=d[ve];break}le||(p.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),le={demux:O.default,remux:D.default});var ee=this.demuxer,ae=this.remuxer,_e=le.remux,fe=le.demux;(!ae||!(ae instanceof _e))&&(this.remuxer=new _e(N,B,M,U)),(!ee||!(ee instanceof fe))&&(this.demuxer=new fe(N,B,M),this.probe=fe.probe),this.resetInitSegment(ie,K,se,X),this.resetInitialTimestamp(j)},y.needsProbing=function(m,S,B){return!this.demuxer||!this.remuxer||S||B},y.getDecrypter=function(){var m=this.decrypter;return m||(m=this.decrypter=new E.default(this.observer,this.config)),m},R}();function a(R,y){var v=null;return R.byteLength>0&&y!=null&&y.key!=null&&y.iv!==null&&y.method!=null&&(v=y),v}var u=function(y){return{remuxResult:{},chunkMeta:y}};function l(R){return"then"in R&&R.then instanceof Function}var A=function(y,v,m,S,B){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=y,this.videoCodec=v,this.initSegmentData=m,this.duration=S,this.defaultInitPts=B},I=function(y,v,m,S,B){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=y,this.contiguous=v,this.accurateTimeOffset=m,this.trackSwitch=S,this.timeOffset=B}},"./src/demux/tsdemuxer.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"discardEPB",function(){return u});var W=k("./src/demux/adts.ts"),P=k("./src/demux/mpegaudio.ts"),E=k("./src/demux/exp-golomb.ts"),L=k("./src/demux/id3.ts"),O=k("./src/demux/sample-aes.ts"),b=k("./src/events.ts"),w=k("./src/utils/mp4-tools.ts"),g=k("./src/utils/logger.ts"),D=k("./src/errors.ts"),T={video:1,audio:2,id3:3,text:4},f=function(){function l(I,R,y){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=I,this.config=R,this.typeSupported=y}l.probe=function(R){var y=l.syncOffset(R);return y<0?!1:(y&&g.logger.warn("MPEG2-TS detected but first sync word found @ offset "+y+", junk ahead ?"),!0)},l.syncOffset=function(R){for(var y=Math.min(1e3,R.length-3*188),v=0;v<y;){if(R[v]===71&&R[v+188]===71&&R[v+2*188]===71)return v;v++}return-1},l.createTrack=function(R,y){return{container:R==="video"||R==="audio"?"video/mp2t":void 0,type:R,id:T[R],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:R==="audio"?y:void 0}};var A=l.prototype;return A.resetInitSegment=function(R,y,v){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=l.createTrack("video",v),this._audioTrack=l.createTrack("audio",v),this._id3Track=l.createTrack("id3",v),this._txtTrack=l.createTrack("text",v),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=R,this.videoCodec=y,this._duration=v},A.resetTimeStamp=function(){},A.resetContiguity=function(){var R=this._audioTrack,y=this._avcTrack,v=this._id3Track;R&&(R.pesData=null),y&&(y.pesData=null),v&&(v.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},A.demux=function(R,y,v,m){v===void 0&&(v=!1),m===void 0&&(m=!1),v||(this.sampleAes=null);var S,B=this._avcTrack,N=this._audioTrack,M=this._id3Track,U=B.pid,K=B.pesData,j=N.pid,X=M.pid,ie=N.pesData,se=M.pesData,le=!1,ve=this.pmtParsed,q=this._pmtId,ee=R.length;if(this.remainderData&&(R=Object(w.appendUint8Array)(this.remainderData,R),ee=R.length,this.remainderData=null),ee<188&&!m)return this.remainderData=R,{audioTrack:N,avcTrack:B,id3Track:M,textTrack:this._txtTrack};var ae=Math.max(0,l.syncOffset(R));ee-=(ee+ae)%188,ee<R.byteLength&&!m&&(this.remainderData=new Uint8Array(R.buffer,ee,R.buffer.byteLength-ee));for(var _e=ae;_e<ee;_e+=188)if(R[_e]===71){var fe=!!(R[_e+1]&64),Ge=((R[_e+1]&31)<<8)+R[_e+2],Te=(R[_e+3]&48)>>4,Ue=void 0;if(Te>1){if(Ue=_e+5+R[_e+4],Ue===_e+188)continue}else Ue=_e+4;switch(Ge){case U:fe&&(K&&(S=o(K))&&this.parseAVCPES(S,!1),K={data:[],size:0}),K&&(K.data.push(R.subarray(Ue,_e+188)),K.size+=_e+188-Ue);break;case j:fe&&(ie&&(S=o(ie))&&(N.isAAC?this.parseAACPES(S):this.parseMPEGPES(S)),ie={data:[],size:0}),ie&&(ie.data.push(R.subarray(Ue,_e+188)),ie.size+=_e+188-Ue);break;case X:fe&&(se&&(S=o(se))&&this.parseID3PES(S),se={data:[],size:0}),se&&(se.data.push(R.subarray(Ue,_e+188)),se.size+=_e+188-Ue);break;case 0:fe&&(Ue+=R[Ue]+1),q=this._pmtId=_(R,Ue);break;case q:{fe&&(Ue+=R[Ue]+1);var Ze=d(R,Ue,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,v);U=Ze.avc,U>0&&(B.pid=U),j=Ze.audio,j>0&&(N.pid=j,N.isAAC=Ze.isAAC),X=Ze.id3,X>0&&(M.pid=X),le&&!ve&&(g.logger.log("reparse from beginning"),le=!1,_e=ae-188),ve=this.pmtParsed=!0;break}case 17:case 8191:break;default:le=!0;break}}else this.observer.emit(b.Events.ERROR,b.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});B.pesData=K,N.pesData=ie,M.pesData=se;var ut={audioTrack:N,avcTrack:B,id3Track:M,textTrack:this._txtTrack};return m&&this.extractRemainingSamples(ut),ut},A.flush=function(){var R=this.remainderData;this.remainderData=null;var y;return R?y=this.demux(R,-1,!1,!0):y={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(y),this.sampleAes?this.decrypt(y,this.sampleAes):y},A.extractRemainingSamples=function(R){var y=R.audioTrack,v=R.avcTrack,m=R.id3Track,S=v.pesData,B=y.pesData,N=m.pesData,M;S&&(M=o(S))?(this.parseAVCPES(M,!0),v.pesData=null):v.pesData=S,B&&(M=o(B))?(y.isAAC?this.parseAACPES(M):this.parseMPEGPES(M),y.pesData=null):(B!=null&&B.size&&g.logger.log("last AAC PES packet truncated,might overlap between fragments"),y.pesData=B),N&&(M=o(N))?(this.parseID3PES(M),m.pesData=null):m.pesData=N},A.demuxSampleAes=function(R,y,v){var m=this.demux(R,v,!0,!this.config.progressive),S=this.sampleAes=new O.default(this.observer,this.config,y);return this.decrypt(m,S)},A.decrypt=function(R,y){return new Promise(function(v){var m=R.audioTrack,S=R.avcTrack;m.samples&&m.isAAC?y.decryptAacSamples(m.samples,0,function(){S.samples?y.decryptAvcSamples(S.samples,0,0,function(){v(R)}):v(R)}):S.samples&&y.decryptAvcSamples(S.samples,0,0,function(){v(R)})})},A.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},A.parseAVCPES=function(R,y){var v=this,m=this._avcTrack,S=this.parseAVCNALu(R.data),B=!1,N=this.avcSample,M,U=!1;R.data=null,N&&S.length&&!m.audFound&&(s(N,m),N=this.avcSample=p(!1,R.pts,R.dts,"")),S.forEach(function(K){switch(K.type){case 1:{M=!0,N||(N=v.avcSample=p(!0,R.pts,R.dts,"")),B&&(N.debug+="NDR "),N.frame=!0;var j=K.data;if(U&&j.length>4){var X=new E.default(j).readSliceType();(X===2||X===4||X===7||X===9)&&(N.key=!0)}break}case 5:M=!0,N||(N=v.avcSample=p(!0,R.pts,R.dts,"")),B&&(N.debug+="IDR "),N.key=!0,N.frame=!0;break;case 6:{M=!0,B&&N&&(N.debug+="SEI ");var ie=new E.default(u(K.data));ie.readUByte();for(var se=0,le=0,ve=!1,q=0;!ve&&ie.bytesAvailable>1;){se=0;do q=ie.readUByte(),se+=q;while(q===255);le=0;do q=ie.readUByte(),le+=q;while(q===255);if(se===4&&ie.bytesAvailable!==0){ve=!0;var ee=ie.readUByte();if(ee===181){var ae=ie.readUShort();if(ae===49){var _e=ie.readUInt();if(_e===1195456820){var fe=ie.readUByte();if(fe===3){for(var Ge=ie.readUByte(),Te=ie.readUByte(),Ue=31&Ge,Ze=[Ge,Te],ut=0;ut<Ue;ut++)Ze.push(ie.readUByte()),Ze.push(ie.readUByte()),Ze.push(ie.readUByte());a(v._txtTrack.samples,{type:3,pts:R.pts,bytes:Ze})}}}}}else if(se===5&&ie.bytesAvailable!==0){if(ve=!0,le>16){for(var Fe=[],Ye=0;Ye<16;Ye++)Fe.push(ie.readUByte().toString(16)),(Ye===3||Ye===5||Ye===7||Ye===9)&&Fe.push("-");for(var Ht=le-16,Bt=new Uint8Array(Ht),Ft=0;Ft<Ht;Ft++)Bt[Ft]=ie.readUByte();a(v._txtTrack.samples,{pts:R.pts,payloadType:se,uuid:Fe.join(""),userData:Object(L.utf8ArrayToStr)(Bt),userDataBytes:Bt})}}else if(le<ie.bytesAvailable)for(var Mt=0;Mt<le;Mt++)ie.readUByte()}break}case 7:if(M=!0,U=!0,B&&N&&(N.debug+="SPS "),!m.sps){var cr=new E.default(K.data),sr=cr.readSPS();m.width=sr.width,m.height=sr.height,m.pixelRatio=sr.pixelRatio,m.sps=[K.data],m.duration=v._duration;for(var br=K.data.subarray(1,4),hi="avc1.",Mr=0;Mr<3;Mr++){var Hr=br[Mr].toString(16);Hr.length<2&&(Hr="0"+Hr),hi+=Hr}m.codec=hi}break;case 8:M=!0,B&&N&&(N.debug+="PPS "),m.pps||(m.pps=[K.data]);break;case 9:M=!1,m.audFound=!0,N&&s(N,m),N=v.avcSample=p(!1,R.pts,R.dts,B?"AUD ":"");break;case 12:M=!1;break;default:M=!1,N&&(N.debug+="unknown NAL "+K.type+" ");break}if(N&&M){var pi=N.units;pi.push(K)}}),y&&N&&(s(N,m),this.avcSample=null)},A.getLastNalUnit=function(){var R,y=this.avcSample,v;if(!y||y.units.length===0){var m=this._avcTrack.samples;y=m[m.length-1]}if((R=y)!==null&&R!==void 0&&R.units){var S=y.units;v=S[S.length-1]}return v},A.parseAVCNALu=function(R){var y=R.byteLength,v=this._avcTrack,m=v.naluState||0,S=m,B=[],N=0,M,U,K,j=-1,X=0;for(m===-1&&(j=0,X=R[0]&31,m=0,N=1);N<y;){if(M=R[N++],!m){m=M?0:1;continue}if(m===1){m=M?0:2;continue}if(!M)m=3;else if(M===1){if(j>=0){var ie={data:R.subarray(j,N-m-1),type:X};B.push(ie)}else{var se=this.getLastNalUnit();if(se&&(S&&N<=4-S&&se.state&&(se.data=se.data.subarray(0,se.data.byteLength-S)),U=N-m-1,U>0)){var le=new Uint8Array(se.data.byteLength+U);le.set(se.data,0),le.set(R.subarray(0,U),se.data.byteLength),se.data=le,se.state=0}}N<y?(K=R[N]&31,j=N,X=K,m=0):m=-1}else m=0}if(j>=0&&m>=0){var ve={data:R.subarray(j,y),type:X,state:m};B.push(ve)}if(B.length===0){var q=this.getLastNalUnit();if(q){var ee=new Uint8Array(q.data.byteLength+R.byteLength);ee.set(q.data,0),ee.set(R,q.data.byteLength),q.data=ee}}return v.naluState=m,B},A.parseAACPES=function(R){var y=0,v=this._audioTrack,m=this.aacOverFlow,S=R.data;if(m){this.aacOverFlow=null;var B=m.sample.unit.byteLength,N=Math.min(m.missing,B),M=B-N;m.sample.unit.set(S.subarray(0,N),M),v.samples.push(m.sample),y=m.missing}var U,K;for(U=y,K=S.length;U<K-1&&!W.isHeader(S,U);U++);if(U!==y){var j,X;if(U<K-1?(j="AAC PES did not start with ADTS header,offset:"+U,X=!1):(j="no ADTS header found in AAC PES",X=!0),g.logger.warn("parsing error:"+j),this.observer.emit(b.Events.ERROR,b.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.FRAG_PARSING_ERROR,fatal:X,reason:j}),X)return}W.initTrackConfig(v,this.observer,S,U,this.audioCodec);var ie;if(R.pts!==void 0)ie=R.pts;else if(m){var se=W.getFrameDuration(v.samplerate);ie=m.sample.pts+se}else{g.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var le=0;U<K;)if(W.isHeader(S,U)){if(U+5<K){var ve=W.appendFrame(v,S,U,ie,le);if(ve)if(ve.missing)this.aacOverFlow=ve;else{U+=ve.length,le++;continue}}break}else U++},A.parseMPEGPES=function(R){var y=R.data,v=y.length,m=0,S=0,B=R.pts;if(B===void 0){g.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;S<v;)if(P.isHeader(y,S)){var N=P.appendFrame(this._audioTrack,y,S,B,m);if(N)S+=N.length,m++;else break}else S++},A.parseID3PES=function(R){if(R.pts===void 0){g.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(R)},l}();f.minProbeByteLength=188;function p(l,A,I,R){return{key:l,frame:!1,pts:A,dts:I,units:[],debug:R,length:0}}function _(l,A){return(l[A+10]&31)<<8|l[A+11]}function d(l,A,I,R){var y={audio:-1,avc:-1,id3:-1,isAAC:!0},v=(l[A+1]&15)<<8|l[A+2],m=A+3+v-4,S=(l[A+10]&15)<<8|l[A+11];for(A+=12+S;A<m;){var B=(l[A+1]&31)<<8|l[A+2];switch(l[A]){case 207:if(!R){g.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:y.audio===-1&&(y.audio=B);break;case 21:y.id3===-1&&(y.id3=B);break;case 219:if(!R){g.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:y.avc===-1&&(y.avc=B);break;case 3:case 4:I?y.audio===-1&&(y.audio=B,y.isAAC=!1):g.logger.log("MPEG audio found, not supported in this browser");break;case 36:g.logger.warn("Unsupported HEVC stream type found");break;default:break}A+=((l[A+3]&15)<<8|l[A+4])+5}return y}function o(l){var A=0,I,R,y,v,m,S=l.data;if(!l||l.size===0)return null;for(;S[0].length<19&&S.length>1;){var B=new Uint8Array(S[0].length+S[1].length);B.set(S[0]),B.set(S[1],S[0].length),S[0]=B,S.splice(1,1)}I=S[0];var N=(I[0]<<16)+(I[1]<<8)+I[2];if(N===1){if(R=(I[4]<<8)+I[5],R&&R>l.size-6)return null;var M=I[7];M&192&&(v=(I[9]&14)*536870912+(I[10]&255)*4194304+(I[11]&254)*16384+(I[12]&255)*128+(I[13]&254)/2,M&64?(m=(I[14]&14)*536870912+(I[15]&255)*4194304+(I[16]&254)*16384+(I[17]&255)*128+(I[18]&254)/2,v-m>60*9e4&&(g.logger.warn(Math.round((v-m)/9e4)+"s delta between PTS and DTS, align them"),v=m)):m=v),y=I[8];var U=y+9;if(l.size<=U)return null;l.size-=U;for(var K=new Uint8Array(l.size),j=0,X=S.length;j<X;j++){I=S[j];var ie=I.byteLength;if(U)if(U>ie){U-=ie;continue}else I=I.subarray(U),ie-=U,U=0;K.set(I,A),A+=ie}return R&&(R-=y+3),{data:K,pts:v,dts:m,len:R}}return null}function s(l,A){if(l.units.length&&l.frame){if(l.pts===void 0){var I=A.samples,R=I.length;if(R){var y=I[R-1];l.pts=y.pts,l.dts=y.dts}else{A.dropped++;return}}A.samples.push(l)}l.debug.length&&g.logger.log(l.pts+"/"+l.dts+":"+l.debug)}function a(l,A){var I=l.length;if(I>0){if(A.pts>=l[I-1].pts)l.push(A);else for(var R=I-1;R>=0;R--)if(A.pts<l[R].pts){l.splice(R,0,A);break}}else l.push(A)}function u(l){for(var A=l.byteLength,I=[],R=1;R<A-2;)l[R]===0&&l[R+1]===0&&l[R+2]===3?(I.push(R+2),R+=2):R++;if(I.length===0)return l;var y=A-I.length,v=new Uint8Array(y),m=0;for(R=0;R<y;m++,R++)m===I[0]&&(m++,I.shift()),v[R]=l[m];return v}H.default=f},"./src/errors.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"ErrorTypes",function(){return W}),k.d(H,"ErrorDetails",function(){return P});var W;(function(E){E.NETWORK_ERROR="networkError",E.MEDIA_ERROR="mediaError",E.KEY_SYSTEM_ERROR="keySystemError",E.MUX_ERROR="muxError",E.OTHER_ERROR="otherError"})(W||(W={}));var P;(function(E){E.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",E.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",E.KEY_SYSTEM_NO_SESSION="keySystemNoSession",E.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",E.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",E.MANIFEST_LOAD_ERROR="manifestLoadError",E.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",E.MANIFEST_PARSING_ERROR="manifestParsingError",E.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",E.LEVEL_EMPTY_ERROR="levelEmptyError",E.LEVEL_LOAD_ERROR="levelLoadError",E.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",E.LEVEL_SWITCH_ERROR="levelSwitchError",E.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",E.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",E.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",E.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",E.FRAG_LOAD_ERROR="fragLoadError",E.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",E.FRAG_DECRYPT_ERROR="fragDecryptError",E.FRAG_PARSING_ERROR="fragParsingError",E.REMUX_ALLOC_ERROR="remuxAllocError",E.KEY_LOAD_ERROR="keyLoadError",E.KEY_LOAD_TIMEOUT="keyLoadTimeOut",E.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",E.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",E.BUFFER_APPEND_ERROR="bufferAppendError",E.BUFFER_APPENDING_ERROR="bufferAppendingError",E.BUFFER_STALLED_ERROR="bufferStalledError",E.BUFFER_FULL_ERROR="bufferFullError",E.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",E.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",E.INTERNAL_EXCEPTION="internalException",E.INTERNAL_ABORTED="aborted",E.UNKNOWN="unknown"})(P||(P={}))},"./src/events.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"Events",function(){return W});var W;(function(P){P.MEDIA_ATTACHING="hlsMediaAttaching",P.MEDIA_ATTACHED="hlsMediaAttached",P.MEDIA_DETACHING="hlsMediaDetaching",P.MEDIA_DETACHED="hlsMediaDetached",P.BUFFER_RESET="hlsBufferReset",P.BUFFER_CODECS="hlsBufferCodecs",P.BUFFER_CREATED="hlsBufferCreated",P.BUFFER_APPENDING="hlsBufferAppending",P.BUFFER_APPENDED="hlsBufferAppended",P.BUFFER_EOS="hlsBufferEos",P.BUFFER_FLUSHING="hlsBufferFlushing",P.BUFFER_FLUSHED="hlsBufferFlushed",P.MANIFEST_LOADING="hlsManifestLoading",P.MANIFEST_LOADED="hlsManifestLoaded",P.MANIFEST_PARSED="hlsManifestParsed",P.LEVEL_SWITCHING="hlsLevelSwitching",P.LEVEL_SWITCHED="hlsLevelSwitched",P.LEVEL_LOADING="hlsLevelLoading",P.LEVEL_LOADED="hlsLevelLoaded",P.LEVEL_UPDATED="hlsLevelUpdated",P.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",P.LEVELS_UPDATED="hlsLevelsUpdated",P.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",P.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",P.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",P.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",P.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",P.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",P.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",P.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",P.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",P.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",P.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",P.CUES_PARSED="hlsCuesParsed",P.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",P.INIT_PTS_FOUND="hlsInitPtsFound",P.FRAG_LOADING="hlsFragLoading",P.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",P.FRAG_LOADED="hlsFragLoaded",P.FRAG_DECRYPTED="hlsFragDecrypted",P.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",P.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",P.FRAG_PARSING_METADATA="hlsFragParsingMetadata",P.FRAG_PARSED="hlsFragParsed",P.FRAG_BUFFERED="hlsFragBuffered",P.FRAG_CHANGED="hlsFragChanged",P.FPS_DROP="hlsFpsDrop",P.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",P.ERROR="hlsError",P.DESTROYING="hlsDestroying",P.KEY_LOADING="hlsKeyLoading",P.KEY_LOADED="hlsKeyLoaded",P.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",P.BACK_BUFFER_REACHED="hlsBackBufferReached"})(W||(W={}))},"./src/hls.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"default",function(){return l});var W=k("./node_modules/url-toolkit/src/url-toolkit.js"),P=k.n(W),E=k("./src/loader/playlist-loader.ts"),L=k("./src/loader/key-loader.ts"),O=k("./src/controller/id3-track-controller.ts"),b=k("./src/controller/latency-controller.ts"),w=k("./src/controller/level-controller.ts"),g=k("./src/controller/fragment-tracker.ts"),D=k("./src/controller/stream-controller.ts"),T=k("./src/is-supported.ts"),f=k("./src/utils/logger.ts"),p=k("./src/config.ts"),_=k("./node_modules/eventemitter3/index.js"),d=k.n(_),o=k("./src/events.ts"),s=k("./src/errors.ts");function a(A,I){for(var R=0;R<I.length;R++){var y=I[R];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(A,y.key,y)}}function u(A,I,R){return I&&a(A.prototype,I),R&&a(A,R),A}var l=function(){A.isSupported=function(){return Object(T.isSupported)()};function A(R){R===void 0&&(R={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new _.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 y=this.config=Object(p.mergeConfig)(A.DefaultConfig,R);this.userConfig=R,Object(f.enableLogs)(y.debug),this._autoLevelCapping=-1,y.progressive&&Object(p.enableStreamingMode)(y);var v=y.abrController,m=y.bufferController,S=y.capLevelController,B=y.fpsController,N=this.abrController=new v(this),M=this.bufferController=new m(this),U=this.capLevelController=new S(this),K=new B(this),j=new E.default(this),X=new L.default(this),ie=new O.default(this),se=this.levelController=new w.default(this),le=new g.FragmentTracker(this),ve=this.streamController=new D.default(this,le);U.setStreamController(ve),K.setStreamController(ve);var q=[se,ve];this.networkControllers=q;var ee=[j,X,N,M,U,K,ie,le];this.audioTrackController=this.createController(y.audioTrackController,null,q),this.createController(y.audioStreamController,le,q),this.subtitleTrackController=this.createController(y.subtitleTrackController,null,q),this.createController(y.subtitleStreamController,le,q),this.createController(y.timelineController,null,ee),this.emeController=this.createController(y.emeController,null,ee),this.cmcdController=this.createController(y.cmcdController,null,ee),this.latencyController=this.createController(b.default,null,ee),this.coreComponents=ee}var I=A.prototype;return I.createController=function(y,v,m){if(y){var S=v?new y(this,v):new y(this);return m&&m.push(S),S}return null},I.on=function(y,v,m){m===void 0&&(m=this),this._emitter.on(y,v,m)},I.once=function(y,v,m){m===void 0&&(m=this),this._emitter.once(y,v,m)},I.removeAllListeners=function(y){this._emitter.removeAllListeners(y)},I.off=function(y,v,m,S){m===void 0&&(m=this),this._emitter.off(y,v,m,S)},I.listeners=function(y){return this._emitter.listeners(y)},I.emit=function(y,v,m){return this._emitter.emit(y,v,m)},I.trigger=function(y,v){if(this.config.debug)return this.emit(y,y,v);try{return this.emit(y,y,v)}catch(m){f.logger.error("An internal error happened while handling event "+y+'. Error message: "'+m.message+'". Here is a stacktrace:',m),this.trigger(o.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:y,error:m})}return!1},I.listenerCount=function(y){return this._emitter.listenerCount(y)},I.destroy=function(){f.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(y){return y.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(y){return y.destroy()}),this.coreComponents.length=0},I.attachMedia=function(y){f.logger.log("attachMedia"),this._media=y,this.trigger(o.Events.MEDIA_ATTACHING,{media:y})},I.detachMedia=function(){f.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},I.loadSource=function(y){this.stopLoad();var v=this.media,m=this.url,S=this.url=W.buildAbsoluteURL(self.location.href,y,{alwaysNormalize:!0});f.logger.log("loadSource:"+S),v&&m&&m!==S&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(v)),this.trigger(o.Events.MANIFEST_LOADING,{url:y})},I.startLoad=function(y){y===void 0&&(y=-1),f.logger.log("startLoad("+y+")"),this.networkControllers.forEach(function(v){v.startLoad(y)})},I.stopLoad=function(){f.logger.log("stopLoad"),this.networkControllers.forEach(function(y){y.stopLoad()})},I.swapAudioCodec=function(){f.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},I.recoverMediaError=function(){f.logger.log("recoverMediaError");var y=this._media;this.detachMedia(),y&&this.attachMedia(y)},I.removeLevel=function(y,v){v===void 0&&(v=0),this.levelController.removeLevel(y,v)},u(A,[{key:"levels",get:function(){var y=this.levelController.levels;return y||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(y){f.logger.log("set currentLevel:"+y),this.loadLevel=y,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(y){f.logger.log("set nextLevel:"+y),this.levelController.manualLevel=y,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(y){f.logger.log("set loadLevel:"+y),this.levelController.manualLevel=y}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(y){this.levelController.nextLoadLevel=y}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(y){f.logger.log("set firstLevel:"+y),this.levelController.firstLevel=y}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(y){f.logger.log("set startLevel:"+y),y!==-1&&(y=Math.max(y,this.minAutoLevel)),this.levelController.startLevel=y}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(y){var v=!!y;v!==this.config.capLevelToPlayerSize&&(v?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=v)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(y){this._autoLevelCapping!==y&&(f.logger.log("set autoLevelCapping:"+y),this._autoLevelCapping=y)}},{key:"bandwidthEstimate",get:function(){var y=this.abrController.bwEstimator;return y?y.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var y=this.levels,v=this.config.minAutoBitrate;if(!y)return 0;for(var m=y.length,S=0;S<m;S++)if(y[S].maxBitrate>v)return S;return 0}},{key:"maxAutoLevel",get:function(){var y=this.levels,v=this.autoLevelCapping,m;return v===-1&&y&&y.length?m=y.length-1:m=v,m}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(y){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,y)}},{key:"audioTracks",get:function(){var y=this.audioTrackController;return y?y.audioTracks:[]}},{key:"audioTrack",get:function(){var y=this.audioTrackController;return y?y.audioTrack:-1},set:function(y){var v=this.audioTrackController;v&&(v.audioTrack=y)}},{key:"subtitleTracks",get:function(){var y=this.subtitleTrackController;return y?y.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var y=this.subtitleTrackController;return y?y.subtitleTrack:-1},set:function(y){var v=this.subtitleTrackController;v&&(v.subtitleTrack=y)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var y=this.subtitleTrackController;return y?y.subtitleDisplay:!1},set:function(y){var v=this.subtitleTrackController;v&&(v.subtitleDisplay=y)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(y){this.config.lowLatencyMode=y}},{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 o.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return A.defaultConfig?A.defaultConfig:p.hlsDefaultConfig},set:function(y){A.defaultConfig=y}}]),A}();l.defaultConfig=void 0},"./src/is-supported.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"isSupported",function(){return E}),k.d(H,"changeTypeSupported",function(){return L});var W=k("./src/utils/mediasource-helper.ts");function P(){return self.SourceBuffer||self.WebKitSourceBuffer}function E(){var O=Object(W.getMediaSource)();if(!O)return!1;var b=P(),w=O&&typeof O.isTypeSupported=="function"&&O.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),g=!b||b.prototype&&typeof b.prototype.appendBuffer=="function"&&typeof b.prototype.remove=="function";return!!w&&!!g}function L(){var O,b=P();return typeof(b==null||(O=b.prototype)===null||O===void 0?void 0:O.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"default",function(){return f}),k.d(H,"LoadError",function(){return _});var W=k("./src/polyfills/number.ts"),P=k("./src/errors.ts");function E(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,g(d,o)}function L(d){var o=typeof Map=="function"?new Map:void 0;return L=function(a){if(a===null||!w(a))return a;if(typeof a!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(a))return o.get(a);o.set(a,u)}function u(){return O(a,arguments,D(this).constructor)}return u.prototype=Object.create(a.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),g(u,a)},L(d)}function O(d,o,s){return b()?O=Reflect.construct:O=function(u,l,A){var I=[null];I.push.apply(I,l);var R=Function.bind.apply(u,I),y=new R;return A&&g(y,A.prototype),y},O.apply(null,arguments)}function b(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function w(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function g(d,o){return g=Object.setPrototypeOf||function(a,u){return a.__proto__=u,a},g(d,o)}function D(d){return D=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},D(d)}var T=Math.pow(2,17),f=function(){function d(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var o=d.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(a,u){var l=this,A=a.url;if(!A)return Promise.reject(new _({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:a,networkDetails:null},"Fragment does not have a "+(A?"part list":"url")));this.abort();var I=this.config,R=I.fLoader,y=I.loader;return new Promise(function(v,m){l.loader&&l.loader.destroy();var S=l.loader=a.loader=R?new R(I):new y(I),B=p(a),N={timeout:I.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:I.fragLoadingMaxRetryTimeout,highWaterMark:T};a.stats=S.stats,S.load(B,N,{onSuccess:function(U,K,j,X){l.resetLoader(a,S),v({frag:a,part:null,payload:U.data,networkDetails:X})},onError:function(U,K,j){l.resetLoader(a,S),m(new _({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:a,response:U,networkDetails:j}))},onAbort:function(U,K,j){l.resetLoader(a,S),m(new _({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:a,networkDetails:j}))},onTimeout:function(U,K,j){l.resetLoader(a,S),m(new _({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:a,networkDetails:j}))},onProgress:function(U,K,j,X){u&&u({frag:a,part:null,payload:j,networkDetails:X})}})})},o.loadPart=function(a,u,l){var A=this;this.abort();var I=this.config,R=I.fLoader,y=I.loader;return new Promise(function(v,m){A.loader&&A.loader.destroy();var S=A.loader=a.loader=R?new R(I):new y(I),B=p(a,u),N={timeout:I.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:I.fragLoadingMaxRetryTimeout,highWaterMark:T};u.stats=S.stats,S.load(B,N,{onSuccess:function(U,K,j,X){A.resetLoader(a,S),A.updateStatsFromPart(a,u);var ie={frag:a,part:u,payload:U.data,networkDetails:X};l(ie),v(ie)},onError:function(U,K,j){A.resetLoader(a,S),m(new _({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:a,part:u,response:U,networkDetails:j}))},onAbort:function(U,K,j){a.stats.aborted=u.stats.aborted,A.resetLoader(a,S),m(new _({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:a,part:u,networkDetails:j}))},onTimeout:function(U,K,j){A.resetLoader(a,S),m(new _({type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:a,part:u,networkDetails:j}))}})})},o.updateStatsFromPart=function(a,u){var l=a.stats,A=u.stats,I=A.total;if(l.loaded+=A.loaded,I){var R=Math.round(a.duration/u.duration),y=Math.min(Math.round(l.loaded/I),R),v=R-y,m=v*Math.round(l.loaded/y);l.total=l.loaded+m}else l.total=Math.max(l.loaded,l.total);var S=l.loading,B=A.loading;S.start?S.first+=B.first-B.start:(S.start=B.start,S.first=B.first),S.end=B.end},o.resetLoader=function(a,u){a.loader=null,this.loader===u&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),u.destroy()},d}();function p(d,o){o===void 0&&(o=null);var s=o||d,a={frag:d,part:o,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},u=s.byteRangeStartOffset,l=s.byteRangeEndOffset;return Object(W.isFiniteNumber)(u)&&Object(W.isFiniteNumber)(l)&&(a.rangeStart=u,a.rangeEnd=l),a}var _=function(d){E(o,d);function o(s){for(var a,u=arguments.length,l=new Array(u>1?u-1:0),A=1;A<u;A++)l[A-1]=arguments[A];return a=d.call.apply(d,[this].concat(l))||this,a.data=void 0,a.data=s,a}return o}(L(Error))},"./src/loader/fragment.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"ElementaryStreamTypes",function(){return f}),k.d(H,"BaseSegment",function(){return p}),k.d(H,"Fragment",function(){return _}),k.d(H,"Part",function(){return d});var W=k("./src/polyfills/number.ts"),P=k("./node_modules/url-toolkit/src/url-toolkit.js"),E=k.n(P),L=k("./src/utils/logger.ts"),O=k("./src/loader/level-key.ts"),b=k("./src/loader/load-stats.ts");function w(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,g(o,s)}function g(o,s){return g=Object.setPrototypeOf||function(u,l){return u.__proto__=l,u},g(o,s)}function D(o,s){for(var a=0;a<s.length;a++){var u=s[a];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(o,u.key,u)}}function T(o,s,a){return s&&D(o.prototype,s),a&&D(o,a),o}var f;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(f||(f={}));var p=function(){function o(a){var u;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(u={},u[f.AUDIO]=null,u[f.VIDEO]=null,u[f.AUDIOVIDEO]=null,u),this.baseurl=a}var s=o.prototype;return s.setByteRange=function(u,l){var A=u.split("@",2),I=[];A.length===1?I[0]=l?l.byteRangeEndOffset:0:I[0]=parseInt(A[1]),I[1]=parseInt(A[0])+I[0],this._byteRange=I},T(o,[{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(P.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(u){this._url=u}}]),o}(),_=function(o){w(s,o);function s(u,l){var A;return A=o.call(this,l)||this,A._decryptdata=null,A.rawProgramDateTime=null,A.programDateTime=null,A.tagList=[],A.duration=0,A.sn=0,A.levelkey=void 0,A.type=void 0,A.loader=null,A.level=-1,A.cc=0,A.startPTS=void 0,A.endPTS=void 0,A.appendedPTS=void 0,A.startDTS=void 0,A.endDTS=void 0,A.start=0,A.deltaPTS=void 0,A.maxStartPTS=void 0,A.minEndPTS=void 0,A.stats=new b.LoadStats,A.urlId=0,A.data=void 0,A.bitrateTest=!1,A.title=null,A.initSegment=null,A.type=u,A}var a=s.prototype;return a.createInitializationVector=function(l){for(var A=new Uint8Array(16),I=12;I<16;I++)A[I]=l>>8*(15-I)&255;return A},a.setDecryptDataFromLevelKey=function(l,A){var I=l;return(l==null?void 0:l.method)==="AES-128"&&l.uri&&!l.iv&&(I=O.LevelKey.fromURI(l.uri),I.method=l.method,I.iv=this.createInitializationVector(A),I.keyFormat="identity"),I},a.setElementaryStreamInfo=function(l,A,I,R,y,v){v===void 0&&(v=!1);var m=this.elementaryStreams,S=m[l];if(!S){m[l]={startPTS:A,endPTS:I,startDTS:R,endDTS:y,partial:v};return}S.startPTS=Math.min(S.startPTS,A),S.endPTS=Math.max(S.endPTS,I),S.startDTS=Math.min(S.startDTS,R),S.endDTS=Math.max(S.endDTS,y)},a.clearElementaryStreamInfo=function(){var l=this.elementaryStreams;l[f.AUDIO]=null,l[f.VIDEO]=null,l[f.AUDIOVIDEO]=null},T(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var l=this.sn;typeof l!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&L.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),l=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,l)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null||!Object(W.isFiniteNumber)(this.programDateTime))return null;var l=Object(W.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+l*1e3}},{key:"encrypted",get:function(){var l;return!!((l=this.decryptdata)!==null&&l!==void 0&&l.keyFormat&&this.decryptdata.uri)}}]),s}(p),d=function(o){w(s,o);function s(a,u,l,A,I){var R;R=o.call(this,l)||this,R.fragOffset=0,R.duration=0,R.gap=!1,R.independent=!1,R.relurl=void 0,R.fragment=void 0,R.index=void 0,R.stats=new b.LoadStats,R.duration=a.decimalFloatingPoint("DURATION"),R.gap=a.bool("GAP"),R.independent=a.bool("INDEPENDENT"),R.relurl=a.enumeratedString("URI"),R.fragment=u,R.index=A;var y=a.enumeratedString("BYTERANGE");return y&&R.setByteRange(y,I),I&&(R.fragOffset=I.fragOffset+I.duration),R}return T(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var u=this.elementaryStreams;return!!(u.audio||u.video||u.audiovideo)}}]),s}(p)},"./src/loader/key-loader.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"default",function(){return L});var W=k("./src/events.ts"),P=k("./src/errors.ts"),E=k("./src/utils/logger.ts"),L=function(){function O(w){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=w,this._registerListeners()}var b=O.prototype;return b._registerListeners=function(){this.hls.on(W.Events.KEY_LOADING,this.onKeyLoading,this)},b._unregisterListeners=function(){this.hls.off(W.Events.KEY_LOADING,this.onKeyLoading)},b.destroy=function(){this._unregisterListeners();for(var g in this.loaders){var D=this.loaders[g];D&&D.destroy()}this.loaders={}},b.onKeyLoading=function(g,D){var T=D.frag,f=T.type,p=this.loaders[f];if(!T.decryptdata){E.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var _=T.decryptdata.uri;if(_!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(p&&(E.logger.warn("abort previous key loader for type:"+f),p.abort()),!_){E.logger.warn("key uri is falsy");return}var o=d.loader,s=T.loader=this.loaders[f]=new o(d);this.decrypturl=_,this.decryptkey=null;var a={url:_,frag:T,responseType:"arraybuffer"},u={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},l={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(a,u,l)}else this.decryptkey&&(T.decryptdata.key=this.decryptkey,this.hls.trigger(W.Events.KEY_LOADED,{frag:T}))},b.loadsuccess=function(g,D,T){var f=T.frag;if(!f.decryptdata){E.logger.error("after key load, decryptdata unset");return}this.decryptkey=f.decryptdata.key=new Uint8Array(g.data),f.loader=null,delete this.loaders[f.type],this.hls.trigger(W.Events.KEY_LOADED,{frag:f})},b.loaderror=function(g,D){var T=D.frag,f=T.loader;f&&f.abort(),delete this.loaders[T.type],this.hls.trigger(W.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:T,response:g})},b.loadtimeout=function(g,D){var T=D.frag,f=T.loader;f&&f.abort(),delete this.loaders[T.type],this.hls.trigger(W.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:T})},O}()},"./src/loader/level-details.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"LevelDetails",function(){return O});var W=k("./src/polyfills/number.ts");function P(b,w){for(var g=0;g<w.length;g++){var D=w[g];D.enumerable=D.enumerable||!1,D.configurable=!0,"value"in D&&(D.writable=!0),Object.defineProperty(b,D.key,D)}}function E(b,w,g){return w&&P(b.prototype,w),g&&P(b,g),b}var L=10,O=function(){function b(g){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=g}var w=b.prototype;return w.reloaded=function(D){if(!D){this.advanced=!0,this.updated=!0;return}var T=this.lastPartSn-D.lastPartSn,f=this.lastPartIndex-D.lastPartIndex;this.updated=this.endSN!==D.endSN||!!f||!!T,this.advanced=this.endSN>D.endSN||T>0||T===0&&f>0,this.updated||this.advanced?this.misses=Math.floor(D.misses*.6):this.misses=D.misses+1,this.availabilityDelay=D.availabilityDelay},E(b,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(W.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||L}},{key:"drift",get:function(){var D=this.driftEndTime-this.driftStartTime;if(D>0){var T=this.driftEnd-this.driftStart;return T*1e3/D}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var D;return(D=this.partList)!==null&&D!==void 0&&D.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var D;return(D=this.fragments)!==null&&D!==void 0&&D.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 D;return(D=this.partList)!==null&&D!==void 0&&D.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var D;return(D=this.partList)!==null&&D!==void 0&&D.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),b}()},"./src/loader/level-key.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"LevelKey",function(){return O});var W=k("./node_modules/url-toolkit/src/url-toolkit.js"),P=k.n(W);function E(b,w){for(var g=0;g<w.length;g++){var D=w[g];D.enumerable=D.enumerable||!1,D.configurable=!0,"value"in D&&(D.writable=!0),Object.defineProperty(b,D.key,D)}}function L(b,w,g){return w&&E(b.prototype,w),g&&E(b,g),b}var O=function(){b.fromURL=function(g,D){return new b(g,D)},b.fromURI=function(g){return new b(g)};function b(w,g){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,g?this._uri=Object(W.buildAbsoluteURL)(w,g,{alwaysNormalize:!0}):this._uri=w}return L(b,[{key:"uri",get:function(){return this._uri}}]),b}()},"./src/loader/load-stats.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"LoadStats",function(){return W});var W=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(he,H,k){"use strict";k.r(H),k.d(H,"default",function(){return s});var W=k("./src/polyfills/number.ts"),P=k("./node_modules/url-toolkit/src/url-toolkit.js"),E=k.n(P),L=k("./src/loader/fragment.ts"),O=k("./src/loader/level-details.ts"),b=k("./src/loader/level-key.ts"),w=k("./src/utils/attr-list.ts"),g=k("./src/utils/logger.ts"),D=k("./src/utils/codecs.ts"),T=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,f=/#EXT-X-MEDIA:(.*)/g,p=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),_=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("|")),d=/\.(mp4|m4s|m4v|m4a)$/i;function o(I){var R,y;return d.test((R=(y=P.parseURL(I))===null||y===void 0?void 0:y.path)!=null?R:"")}var s=function(){function I(){}return I.findGroup=function(y,v){for(var m=0;m<y.length;m++){var S=y[m];if(S.id===v)return S}},I.convertAVC1ToAVCOTI=function(y){var v=y.split(".");if(v.length>2){var m=v.shift()+".";return m+=parseInt(v.shift()).toString(16),m+=("000"+parseInt(v.shift()).toString(16)).substr(-4),m}return y},I.resolve=function(y,v){return P.buildAbsoluteURL(v,y,{alwaysNormalize:!0})},I.parseMasterPlaylist=function(y,v){var m=[],S={},B=!1;T.lastIndex=0;for(var N;(N=T.exec(y))!=null;)if(N[1]){var M=new w.AttrList(N[1]),U={attrs:M,bitrate:M.decimalInteger("AVERAGE-BANDWIDTH")||M.decimalInteger("BANDWIDTH"),name:M.NAME,url:I.resolve(N[2],v)},K=M.decimalResolution("RESOLUTION");K&&(U.width=K.width,U.height=K.height),a((M.CODECS||"").split(/[ ,]+/).filter(function(X){return X}),U),U.videoCodec&&U.videoCodec.indexOf("avc1")!==-1&&(U.videoCodec=I.convertAVC1ToAVCOTI(U.videoCodec)),m.push(U)}else if(N[3]){var j=new w.AttrList(N[3]);j["DATA-ID"]&&(B=!0,S[j["DATA-ID"]]=j)}return{levels:m,sessionData:B?S:null}},I.parseMasterPlaylistMedia=function(y,v,m,S){S===void 0&&(S=[]);var B,N=[],M=0;for(f.lastIndex=0;(B=f.exec(y))!==null;){var U=new w.AttrList(B[1]);if(U.TYPE===m){var K={attrs:U,bitrate:0,id:M++,groupId:U["GROUP-ID"],instreamId:U["INSTREAM-ID"],name:U.NAME||U.LANGUAGE||"",type:m,default:U.bool("DEFAULT"),autoselect:U.bool("AUTOSELECT"),forced:U.bool("FORCED"),lang:U.LANGUAGE,url:U.URI?I.resolve(U.URI,v):""};if(S.length){var j=I.findGroup(S,K.groupId)||S[0];u(K,j,"audioCodec"),u(K,j,"textCodec")}N.push(K)}}return N},I.parseLevelPlaylist=function(y,v,m,S,B){var N=new O.LevelDetails(v),M=N.fragments,U=null,K=0,j=0,X=0,ie=0,se=null,le=new L.Fragment(S,v),ve,q,ee,ae=-1,_e=!1;for(p.lastIndex=0,N.m3u8=y;(ve=p.exec(y))!==null;){_e&&(_e=!1,le=new L.Fragment(S,v),le.start=X,le.sn=K,le.cc=ie,le.level=m,U&&(le.initSegment=U,le.rawProgramDateTime=U.rawProgramDateTime));var fe=ve[1];if(fe){le.duration=parseFloat(fe);var Ge=(" "+ve[2]).slice(1);le.title=Ge||null,le.tagList.push(Ge?["INF",fe,Ge]:["INF",fe])}else if(ve[3])Object(W.isFiniteNumber)(le.duration)&&(le.start=X,ee&&(le.levelkey=ee),le.sn=K,le.level=m,le.cc=ie,le.urlId=B,M.push(le),le.relurl=(" "+ve[3]).slice(1),A(le,se),se=le,X+=le.duration,K++,j=0,_e=!0);else if(ve[4]){var Te=(" "+ve[4]).slice(1);se?le.setByteRange(Te,se):le.setByteRange(Te)}else if(ve[5])le.rawProgramDateTime=(" "+ve[5]).slice(1),le.tagList.push(["PROGRAM-DATE-TIME",le.rawProgramDateTime]),ae===-1&&(ae=M.length);else{if(ve=ve[0].match(_),!ve){g.logger.warn("No matches on slow regex match for level playlist!");continue}for(q=1;q<ve.length&&typeof ve[q]=="undefined";q++);var Ue=(" "+ve[q]).slice(1),Ze=(" "+ve[q+1]).slice(1),ut=ve[q+2]?(" "+ve[q+2]).slice(1):"";switch(Ue){case"PLAYLIST-TYPE":N.type=Ze.toUpperCase();break;case"MEDIA-SEQUENCE":K=N.startSN=parseInt(Ze);break;case"SKIP":{var Fe=new w.AttrList(Ze),Ye=Fe.decimalInteger("SKIPPED-SEGMENTS");if(Object(W.isFiniteNumber)(Ye)){N.skippedSegments=Ye;for(var Ht=Ye;Ht--;)M.unshift(null);K+=Ye}var Bt=Fe.enumeratedString("RECENTLY-REMOVED-DATERANGES");Bt&&(N.recentlyRemovedDateranges=Bt.split(" "));break}case"TARGETDURATION":N.targetduration=parseFloat(Ze);break;case"VERSION":N.version=parseInt(Ze);break;case"EXTM3U":break;case"ENDLIST":N.live=!1;break;case"#":(Ze||ut)&&le.tagList.push(ut?[Ze,ut]:[Ze]);break;case"DIS":ie++;case"GAP":le.tagList.push([Ue]);break;case"BITRATE":le.tagList.push([Ue,Ze]);break;case"DISCONTINUITY-SEQ":ie=parseInt(Ze);break;case"KEY":{var Ft,Mt=new w.AttrList(Ze),cr=Mt.enumeratedString("METHOD"),sr=Mt.URI,br=Mt.hexadecimalInteger("IV"),hi=Mt.enumeratedString("KEYFORMATVERSIONS"),Mr=Mt.enumeratedString("KEYID"),Hr=(Ft=Mt.enumeratedString("KEYFORMAT"))!=null?Ft:"identity",pi=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(pi.indexOf(Hr)>-1){g.logger.warn("Keyformat "+Hr+" is not supported from the manifest");continue}else if(Hr!=="identity")continue;cr&&(ee=b.LevelKey.fromURL(v,sr),sr&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(cr)>=0&&(ee.method=cr,ee.keyFormat=Hr,Mr&&(ee.keyID=Mr),hi&&(ee.keyFormatVersions=hi),ee.iv=br));break}case"START":{var si=new w.AttrList(Ze),bi=si.decimalFloatingPoint("TIME-OFFSET");Object(W.isFiniteNumber)(bi)&&(N.startTimeOffset=bi);break}case"MAP":{var oi=new w.AttrList(Ze);le.relurl=oi.URI,oi.BYTERANGE&&le.setByteRange(oi.BYTERANGE),le.level=m,le.sn="initSegment",ee&&(le.levelkey=ee),le.initSegment=null,U=le,_e=!0;break}case"SERVER-CONTROL":{var Ci=new w.AttrList(Ze);N.canBlockReload=Ci.bool("CAN-BLOCK-RELOAD"),N.canSkipUntil=Ci.optionalFloat("CAN-SKIP-UNTIL",0),N.canSkipDateRanges=N.canSkipUntil>0&&Ci.bool("CAN-SKIP-DATERANGES"),N.partHoldBack=Ci.optionalFloat("PART-HOLD-BACK",0),N.holdBack=Ci.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var sn=new w.AttrList(Ze);N.partTarget=sn.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Zr=N.partList;Zr||(Zr=N.partList=[]);var Rr=j>0?Zr[Zr.length-1]:void 0,Vr=j++,Lt=new L.Part(new w.AttrList(Ze),le,v,Vr,Rr);Zr.push(Lt),le.duration+=Lt.duration;break}case"PRELOAD-HINT":{var $r=new w.AttrList(Ze);N.preloadHint=$r;break}case"RENDITION-REPORT":{var wn=new w.AttrList(Ze);N.renditionReports=N.renditionReports||[],N.renditionReports.push(wn);break}default:g.logger.warn("line parsed but not handled: "+ve);break}}}se&&!se.relurl?(M.pop(),X-=se.duration,N.partList&&(N.fragmentHint=se)):N.partList&&(A(le,se),le.cc=ie,N.fragmentHint=le);var on=M.length,wi=M[0],pn=M[on-1];if(X+=N.skippedSegments*N.targetduration,X>0&&on&&pn){N.averagetargetduration=X/on;var vn=pn.sn;N.endSN=vn!=="initSegment"?vn:0,wi&&(N.startCC=wi.cc,wi.initSegment||N.fragments.every(function(Oi){return Oi.relurl&&o(Oi.relurl)})&&(g.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),le=new L.Fragment(S,v),le.relurl=pn.relurl,le.level=m,le.sn="initSegment",wi.initSegment=le,N.needSidxRanges=!0))}else N.endSN=0,N.startCC=0;return N.fragmentHint&&(X+=N.fragmentHint.duration),N.totalduration=X,N.endCC=ie,ae>0&&l(M,ae),N},I}();function a(I,R){["video","audio","text"].forEach(function(y){var v=I.filter(function(S){return Object(D.isCodecType)(S,y)});if(v.length){var m=v.filter(function(S){return S.lastIndexOf("avc1",0)===0||S.lastIndexOf("mp4a",0)===0});R[y+"Codec"]=m.length>0?m[0]:v[0],I=I.filter(function(S){return v.indexOf(S)===-1})}}),R.unknownCodecs=I}function u(I,R,y){var v=R[y];v&&(I[y]=v)}function l(I,R){for(var y=I[R],v=R;v--;){var m=I[v];if(!m)return;m.programDateTime=y.programDateTime-m.duration*1e3,y=m}}function A(I,R){I.rawProgramDateTime?I.programDateTime=Date.parse(I.rawProgramDateTime):R!=null&&R.programDateTime&&(I.programDateTime=R.endProgramDateTime),Object(W.isFiniteNumber)(I.programDateTime)||(I.programDateTime=null,I.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(he,H,k){"use strict";k.r(H);var W=k("./src/polyfills/number.ts"),P=k("./src/events.ts"),E=k("./src/errors.ts"),L=k("./src/utils/logger.ts"),O=k("./src/utils/mp4-tools.ts"),b=k("./src/loader/m3u8-parser.ts"),w=k("./src/types/loader.ts"),g=k("./src/utils/attr-list.ts");function D(p){var _=p.type;switch(_){case w.PlaylistContextType.AUDIO_TRACK:return w.PlaylistLevelType.AUDIO;case w.PlaylistContextType.SUBTITLE_TRACK:return w.PlaylistLevelType.SUBTITLE;default:return w.PlaylistLevelType.MAIN}}function T(p,_){var d=p.url;return(d===void 0||d.indexOf("data:")===0)&&(d=_.url),d}var f=function(){function p(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var _=p.prototype;return _.registerListeners=function(){var o=this.hls;o.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(P.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(P.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(P.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},_.unregisterListeners=function(){var o=this.hls;o.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(P.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(P.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(P.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},_.createInternalLoader=function(o){var s=this.hls.config,a=s.pLoader,u=s.loader,l=a||u,A=new l(s);return o.loader=A,this.loaders[o.type]=A,A},_.getInternalLoader=function(o){return this.loaders[o.type]},_.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},_.destroyInternalLoaders=function(){for(var o in this.loaders){var s=this.loaders[o];s&&s.destroy(),this.resetInternalLoader(o)}},_.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},_.onManifestLoading=function(o,s){var a=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:w.PlaylistContextType.MANIFEST,url:a,deliveryDirectives:null})},_.onLevelLoading=function(o,s){var a=s.id,u=s.level,l=s.url,A=s.deliveryDirectives;this.load({id:a,groupId:null,level:u,responseType:"text",type:w.PlaylistContextType.LEVEL,url:l,deliveryDirectives:A})},_.onAudioTrackLoading=function(o,s){var a=s.id,u=s.groupId,l=s.url,A=s.deliveryDirectives;this.load({id:a,groupId:u,level:null,responseType:"text",type:w.PlaylistContextType.AUDIO_TRACK,url:l,deliveryDirectives:A})},_.onSubtitleTrackLoading=function(o,s){var a=s.id,u=s.groupId,l=s.url,A=s.deliveryDirectives;this.load({id:a,groupId:u,level:null,responseType:"text",type:w.PlaylistContextType.SUBTITLE_TRACK,url:l,deliveryDirectives:A})},_.load=function(o){var s,a=this.hls.config,u=this.getInternalLoader(o);if(u){var l=u.context;if(l&&l.url===o.url){L.logger.trace("[playlist-loader]: playlist request ongoing");return}L.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),u.abort()}var A,I,R,y;switch(o.type){case w.PlaylistContextType.MANIFEST:A=a.manifestLoadingMaxRetry,I=a.manifestLoadingTimeOut,R=a.manifestLoadingRetryDelay,y=a.manifestLoadingMaxRetryTimeout;break;case w.PlaylistContextType.LEVEL:case w.PlaylistContextType.AUDIO_TRACK:case w.PlaylistContextType.SUBTITLE_TRACK:A=0,I=a.levelLoadingTimeOut;break;default:A=a.levelLoadingMaxRetry,I=a.levelLoadingTimeOut,R=a.levelLoadingRetryDelay,y=a.levelLoadingMaxRetryTimeout;break}if(u=this.createInternalLoader(o),(s=o.deliveryDirectives)!==null&&s!==void 0&&s.part){var v;if(o.type===w.PlaylistContextType.LEVEL&&o.level!==null?v=this.hls.levels[o.level].details:o.type===w.PlaylistContextType.AUDIO_TRACK&&o.id!==null?v=this.hls.audioTracks[o.id].details:o.type===w.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(v=this.hls.subtitleTracks[o.id].details),v){var m=v.partTarget,S=v.targetduration;m&&S&&(I=Math.min(Math.max(m*3,S*.8)*1e3,I))}}var B={timeout:I,maxRetry:A,retryDelay:R,maxRetryDelay:y,highWaterMark:0},N={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(o,B,N)},_.loadsuccess=function(o,s,a,u){if(u===void 0&&(u=null),a.isSidxRequest){this.handleSidxRequest(o,a),this.handlePlaylistLoaded(o,s,a,u);return}this.resetInternalLoader(a.type);var l=o.data;if(l.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,a,"no EXTM3U delimiter",u);return}s.parsing.start=performance.now(),l.indexOf("#EXTINF:")>0||l.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,s,a,u):this.handleMasterPlaylist(o,s,a,u)},_.loaderror=function(o,s,a){a===void 0&&(a=null),this.handleNetworkError(s,a,!1,o)},_.loadtimeout=function(o,s,a){a===void 0&&(a=null),this.handleNetworkError(s,a,!0)},_.handleMasterPlaylist=function(o,s,a,u){var l=this.hls,A=o.data,I=T(o,a),R=b.default.parseMasterPlaylist(A,I),y=R.levels,v=R.sessionData;if(!y.length){this.handleManifestParsingError(o,a,"no level found in manifest",u);return}var m=y.map(function(K){return{id:K.attrs.AUDIO,audioCodec:K.audioCodec}}),S=y.map(function(K){return{id:K.attrs.SUBTITLES,textCodec:K.textCodec}}),B=b.default.parseMasterPlaylistMedia(A,I,"AUDIO",m),N=b.default.parseMasterPlaylistMedia(A,I,"SUBTITLES",S),M=b.default.parseMasterPlaylistMedia(A,I,"CLOSED-CAPTIONS");if(B.length){var U=B.some(function(K){return!K.url});!U&&y[0].audioCodec&&!y[0].attrs.AUDIO&&(L.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),B.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new g.AttrList({}),bitrate:0,url:""}))}l.trigger(P.Events.MANIFEST_LOADED,{levels:y,audioTracks:B,subtitles:N,captions:M,url:I,stats:s,networkDetails:u,sessionData:v})},_.handleTrackOrLevelPlaylist=function(o,s,a,u){var l=this.hls,A=a.id,I=a.level,R=a.type,y=T(o,a),v=Object(W.isFiniteNumber)(A)?A:0,m=Object(W.isFiniteNumber)(I)?I:v,S=D(a),B=b.default.parseLevelPlaylist(o.data,y,m,S,v);if(!B.fragments.length){l.trigger(P.Events.ERROR,{type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:y,reason:"no fragments found in level",level:typeof a.level=="number"?a.level:void 0});return}if(R===w.PlaylistContextType.MANIFEST){var N={attrs:new g.AttrList({}),bitrate:0,details:B,name:"",url:y};l.trigger(P.Events.MANIFEST_LOADED,{levels:[N],audioTracks:[],url:y,stats:s,networkDetails:u,sessionData:null})}if(s.parsing.end=performance.now(),B.needSidxRanges){var M,U=(M=B.fragments[0].initSegment)===null||M===void 0?void 0:M.url;this.load({url:U,isSidxRequest:!0,type:R,level:I,levelDetails:B,id:A,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}a.levelDetails=B,this.handlePlaylistLoaded(o,s,a,u)},_.handleSidxRequest=function(o,s){var a=Object(O.parseSegmentIndex)(new Uint8Array(o.data));if(!!a){var u=a.references,l=s.levelDetails;u.forEach(function(A,I){var R=A.info,y=l.fragments[I];y.byteRange.length===0&&y.setByteRange(String(1+R.end-R.start)+"@"+String(R.start)),y.initSegment&&y.initSegment.setByteRange(String(a.moovEndOffset)+"@0")})}},_.handleManifestParsingError=function(o,s,a,u){this.hls.trigger(P.Events.ERROR,{type:E.ErrorTypes.NETWORK_ERROR,details:E.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===w.PlaylistContextType.MANIFEST,url:o.url,reason:a,response:o,context:s,networkDetails:u})},_.handleNetworkError=function(o,s,a,u){a===void 0&&(a=!1),L.logger.warn("[playlist-loader]: A network "+(a?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var l=E.ErrorDetails.UNKNOWN,A=!1,I=this.getInternalLoader(o);switch(o.type){case w.PlaylistContextType.MANIFEST:l=a?E.ErrorDetails.MANIFEST_LOAD_TIMEOUT:E.ErrorDetails.MANIFEST_LOAD_ERROR,A=!0;break;case w.PlaylistContextType.LEVEL:l=a?E.ErrorDetails.LEVEL_LOAD_TIMEOUT:E.ErrorDetails.LEVEL_LOAD_ERROR,A=!1;break;case w.PlaylistContextType.AUDIO_TRACK:l=a?E.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:E.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,A=!1;break;case w.PlaylistContextType.SUBTITLE_TRACK:l=a?E.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:E.ErrorDetails.SUBTITLE_LOAD_ERROR,A=!1;break}I&&this.resetInternalLoader(o.type);var R={type:E.ErrorTypes.NETWORK_ERROR,details:l,fatal:A,url:o.url,loader:I,context:o,networkDetails:s};u&&(R.response=u),this.hls.trigger(P.Events.ERROR,R)},_.handlePlaylistLoaded=function(o,s,a,u){var l=a.type,A=a.level,I=a.id,R=a.groupId,y=a.loader,v=a.levelDetails,m=a.deliveryDirectives;if(!(v!=null&&v.targetduration)){this.handleManifestParsingError(o,a,"invalid target duration",u);return}if(!!y)switch(v.live&&(y.getCacheAge&&(v.ageHeader=y.getCacheAge()||0),(!y.getCacheAge||isNaN(v.ageHeader))&&(v.ageHeader=0)),l){case w.PlaylistContextType.MANIFEST:case w.PlaylistContextType.LEVEL:this.hls.trigger(P.Events.LEVEL_LOADED,{details:v,level:A||0,id:I||0,stats:s,networkDetails:u,deliveryDirectives:m});break;case w.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(P.Events.AUDIO_TRACK_LOADED,{details:v,id:I||0,groupId:R||"",stats:s,networkDetails:u,deliveryDirectives:m});break;case w.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(P.Events.SUBTITLE_TRACK_LOADED,{details:v,id:I||0,groupId:R||"",stats:s,networkDetails:u,deliveryDirectives:m});break}},p}();H.default=f},"./src/polyfills/number.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"isFiniteNumber",function(){return W}),k.d(H,"MAX_SAFE_INTEGER",function(){return P});var W=Number.isFinite||function(E){return typeof E=="number"&&isFinite(E)},P=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(he,H,k){"use strict";k.r(H);var W=function(){function P(){}return P.getSilentFrame=function(L,O){switch(L){case"mp4a.40.2":if(O===1)return new Uint8Array([0,200,0,128,35,128]);if(O===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(O===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(O===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(O===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(O===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(O===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(O===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(O===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}},P}();H.default=W},"./src/remux/mp4-generator.ts":function(he,H,k){"use strict";k.r(H);var W=Math.pow(2,32)-1,P=function(){function E(){}return E.init=function(){E.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 O;for(O in E.types)E.types.hasOwnProperty(O)&&(E.types[O]=[O.charCodeAt(0),O.charCodeAt(1),O.charCodeAt(2),O.charCodeAt(3)]);var b=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]),w=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]);E.HDLR_TYPES={video:b,audio:w};var g=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),D=new Uint8Array([0,0,0,0,0,0,0,0]);E.STTS=E.STSC=E.STCO=D,E.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),E.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),E.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),E.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var T=new Uint8Array([105,115,111,109]),f=new Uint8Array([97,118,99,49]),p=new Uint8Array([0,0,0,1]);E.FTYP=E.box(E.types.ftyp,T,p,T,f),E.DINF=E.box(E.types.dinf,E.box(E.types.dref,g))},E.box=function(O){for(var b=8,w=arguments.length,g=new Array(w>1?w-1:0),D=1;D<w;D++)g[D-1]=arguments[D];for(var T=g.length,f=T;T--;)b+=g[T].byteLength;var p=new Uint8Array(b);for(p[0]=b>>24&255,p[1]=b>>16&255,p[2]=b>>8&255,p[3]=b&255,p.set(O,4),T=0,b=8;T<f;T++)p.set(g[T],b),b+=g[T].byteLength;return p},E.hdlr=function(O){return E.box(E.types.hdlr,E.HDLR_TYPES[O])},E.mdat=function(O){return E.box(E.types.mdat,O)},E.mdhd=function(O,b){b*=O;var w=Math.floor(b/(W+1)),g=Math.floor(b%(W+1));return E.box(E.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,O>>24&255,O>>16&255,O>>8&255,O&255,w>>24,w>>16&255,w>>8&255,w&255,g>>24,g>>16&255,g>>8&255,g&255,85,196,0,0]))},E.mdia=function(O){return E.box(E.types.mdia,E.mdhd(O.timescale,O.duration),E.hdlr(O.type),E.minf(O))},E.mfhd=function(O){return E.box(E.types.mfhd,new Uint8Array([0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255]))},E.minf=function(O){return O.type==="audio"?E.box(E.types.minf,E.box(E.types.smhd,E.SMHD),E.DINF,E.stbl(O)):E.box(E.types.minf,E.box(E.types.vmhd,E.VMHD),E.DINF,E.stbl(O))},E.moof=function(O,b,w){return E.box(E.types.moof,E.mfhd(O),E.traf(w,b))},E.moov=function(O){for(var b=O.length,w=[];b--;)w[b]=E.trak(O[b]);return E.box.apply(null,[E.types.moov,E.mvhd(O[0].timescale,O[0].duration)].concat(w).concat(E.mvex(O)))},E.mvex=function(O){for(var b=O.length,w=[];b--;)w[b]=E.trex(O[b]);return E.box.apply(null,[E.types.mvex].concat(w))},E.mvhd=function(O,b){b*=O;var w=Math.floor(b/(W+1)),g=Math.floor(b%(W+1)),D=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,O>>24&255,O>>16&255,O>>8&255,O&255,w>>24,w>>16&255,w>>8&255,w&255,g>>24,g>>16&255,g>>8&255,g&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 E.box(E.types.mvhd,D)},E.sdtp=function(O){var b=O.samples||[],w=new Uint8Array(4+b.length),g,D;for(g=0;g<b.length;g++)D=b[g].flags,w[g+4]=D.dependsOn<<4|D.isDependedOn<<2|D.hasRedundancy;return E.box(E.types.sdtp,w)},E.stbl=function(O){return E.box(E.types.stbl,E.stsd(O),E.box(E.types.stts,E.STTS),E.box(E.types.stsc,E.STSC),E.box(E.types.stsz,E.STSZ),E.box(E.types.stco,E.STCO))},E.avc1=function(O){var b=[],w=[],g,D,T;for(g=0;g<O.sps.length;g++)D=O.sps[g],T=D.byteLength,b.push(T>>>8&255),b.push(T&255),b=b.concat(Array.prototype.slice.call(D));for(g=0;g<O.pps.length;g++)D=O.pps[g],T=D.byteLength,w.push(T>>>8&255),w.push(T&255),w=w.concat(Array.prototype.slice.call(D));var f=E.box(E.types.avcC,new Uint8Array([1,b[3],b[4],b[5],252|3,224|O.sps.length].concat(b).concat([O.pps.length]).concat(w))),p=O.width,_=O.height,d=O.pixelRatio[0],o=O.pixelRatio[1];return E.box(E.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,p>>8&255,p&255,_>>8&255,_&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]),f,E.box(E.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),E.box(E.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,o>>24,o>>16&255,o>>8&255,o&255])))},E.esds=function(O){var b=O.config.length;return new Uint8Array([0,0,0,0,3,23+b,0,1,0,4,15+b,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([b]).concat(O.config).concat([6,1,2]))},E.mp4a=function(O){var b=O.samplerate;return E.box(E.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,O.channelCount,0,16,0,0,0,0,b>>8&255,b&255,0,0]),E.box(E.types.esds,E.esds(O)))},E.mp3=function(O){var b=O.samplerate;return E.box(E.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,O.channelCount,0,16,0,0,0,0,b>>8&255,b&255,0,0]))},E.stsd=function(O){return O.type==="audio"?!O.isAAC&&O.codec==="mp3"?E.box(E.types.stsd,E.STSD,E.mp3(O)):E.box(E.types.stsd,E.STSD,E.mp4a(O)):E.box(E.types.stsd,E.STSD,E.avc1(O))},E.tkhd=function(O){var b=O.id,w=O.duration*O.timescale,g=O.width,D=O.height,T=Math.floor(w/(W+1)),f=Math.floor(w%(W+1));return E.box(E.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,b>>24&255,b>>16&255,b>>8&255,b&255,0,0,0,0,T>>24,T>>16&255,T>>8&255,T&255,f>>24,f>>16&255,f>>8&255,f&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,g>>8&255,g&255,0,0,D>>8&255,D&255,0,0]))},E.traf=function(O,b){var w=E.sdtp(O),g=O.id,D=Math.floor(b/(W+1)),T=Math.floor(b%(W+1));return E.box(E.types.traf,E.box(E.types.tfhd,new Uint8Array([0,0,0,0,g>>24,g>>16&255,g>>8&255,g&255])),E.box(E.types.tfdt,new Uint8Array([1,0,0,0,D>>24,D>>16&255,D>>8&255,D&255,T>>24,T>>16&255,T>>8&255,T&255])),E.trun(O,w.length+16+20+8+16+8+8),w)},E.trak=function(O){return O.duration=O.duration||4294967295,E.box(E.types.trak,E.tkhd(O),E.mdia(O))},E.trex=function(O){var b=O.id;return E.box(E.types.trex,new Uint8Array([0,0,0,0,b>>24,b>>16&255,b>>8&255,b&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},E.trun=function(O,b){var w=O.samples||[],g=w.length,D=12+16*g,T=new Uint8Array(D),f,p,_,d,o,s;for(b+=8+D,T.set([0,0,15,1,g>>>24&255,g>>>16&255,g>>>8&255,g&255,b>>>24&255,b>>>16&255,b>>>8&255,b&255],0),f=0;f<g;f++)p=w[f],_=p.duration,d=p.size,o=p.flags,s=p.cts,T.set([_>>>24&255,_>>>16&255,_>>>8&255,_&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*f);return E.box(E.types.trun,T)},E.initSegment=function(O){E.types||E.init();var b=E.moov(O),w=new Uint8Array(E.FTYP.byteLength+b.byteLength);return w.set(E.FTYP),w.set(b,E.FTYP.byteLength),w},E}();P.types=void 0,P.HDLR_TYPES=void 0,P.STTS=void 0,P.STSC=void 0,P.STCO=void 0,P.STSZ=void 0,P.VMHD=void 0,P.SMHD=void 0,P.STSD=void 0,P.FTYP=void 0,P.DINF=void 0,H.default=P},"./src/remux/mp4-remuxer.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"default",function(){return s}),k.d(H,"normalizePts",function(){return a});var W=k("./src/polyfills/number.ts"),P=k("./src/remux/aac-helper.ts"),E=k("./src/remux/mp4-generator.ts"),L=k("./src/events.ts"),O=k("./src/errors.ts"),b=k("./src/utils/logger.ts"),w=k("./src/types/loader.ts"),g=k("./src/utils/timescale-conversion.ts");function D(){return D=Object.assign||function(I){for(var R=1;R<arguments.length;R++){var y=arguments[R];for(var v in y)Object.prototype.hasOwnProperty.call(y,v)&&(I[v]=y[v])}return I},D.apply(this,arguments)}var T=10*1e3,f=1024,p=1152,_=null,d=null,o=!1,s=function(){function I(y,v,m,S){if(S===void 0&&(S=""),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=y,this.config=v,this.typeSupported=m,this.ISGenerated=!1,_===null){var B=navigator.userAgent||"",N=B.match(/Chrome\/(\d+)/i);_=N?parseInt(N[1]):0}if(d===null){var M=navigator.userAgent.match(/Safari\/(\d+)/i);d=M?parseInt(M[1]):0}o=!!_&&_<75||!!d&&d<600}var R=I.prototype;return R.destroy=function(){},R.resetTimeStamp=function(v){b.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=v},R.resetNextTimestamp=function(){b.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},R.resetInitSegment=function(){b.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},R.getVideoStartPts=function(v){var m=!1,S=v.reduce(function(B,N){var M=N.pts-B;return M<-4294967296?(m=!0,a(B,N.pts)):M>0?B:N.pts},v[0].pts);return m&&b.logger.debug("PTS rollover detected"),S},R.remux=function(v,m,S,B,N,M,U,K){var j,X,ie,se,le,ve,q=N,ee=N,ae=v.pid>-1,_e=m.pid>-1,fe=m.samples.length,Ge=v.samples.length>0,Te=fe>1,Ue=(!ae||Ge)&&(!_e||Te)||this.ISGenerated||U;if(Ue){this.ISGenerated||(ie=this.generateIS(v,m,N));var Ze=this.isVideoContiguous,ut=-1;if(Te&&(ut=u(m.samples),!Ze&&this.config.forceKeyFrameOnDiscontinuity))if(ve=!0,ut>0){b.logger.warn("[mp4-remuxer]: Dropped "+ut+" out of "+fe+" video samples due to a missing keyframe");var Fe=this.getVideoStartPts(m.samples);m.samples=m.samples.slice(ut),m.dropped+=ut,ee+=(m.samples[0].pts-Fe)/(m.timescale||9e4)}else ut===-1&&(b.logger.warn("[mp4-remuxer]: No keyframe found out of "+fe+" video samples"),ve=!1);if(this.ISGenerated){if(Ge&&Te){var Ye=this.getVideoStartPts(m.samples),Ht=a(v.samples[0].pts,Ye)-Ye,Bt=Ht/m.inputTimeScale;q+=Math.max(0,Bt),ee+=Math.max(0,-Bt)}if(Ge){if(v.samplerate||(b.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),ie=this.generateIS(v,m,N)),X=this.remuxAudio(v,q,this.isAudioContiguous,M,_e||Te||K===w.PlaylistLevelType.AUDIO?ee:void 0),Te){var Ft=X?X.endPTS-X.startPTS:0;m.inputTimeScale||(b.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),ie=this.generateIS(v,m,N)),j=this.remuxVideo(m,ee,Ze,Ft)}}else Te&&(j=this.remuxVideo(m,ee,Ze,0));j&&(j.firstKeyFrame=ut,j.independent=ut!==-1)}}return this.ISGenerated&&(S.samples.length&&(le=this.remuxID3(S,N)),B.samples.length&&(se=this.remuxText(B,N))),{audio:X,video:j,initSegment:ie,independent:ve,text:se,id3:le}},R.generateIS=function(v,m,S){var B=v.samples,N=m.samples,M=this.typeSupported,U={},K=!Object(W.isFiniteNumber)(this._initPTS),j="audio/mp4",X,ie,se;if(K&&(X=ie=1/0),v.config&&B.length&&(v.timescale=v.samplerate,v.isAAC||(M.mpeg?(j="audio/mpeg",v.codec=""):M.mp3&&(v.codec="mp3")),U.audio={id:"audio",container:j,codec:v.codec,initSegment:!v.isAAC&&M.mpeg?new Uint8Array(0):E.default.initSegment([v]),metadata:{channelCount:v.channelCount}},K&&(se=v.inputTimeScale,X=ie=B[0].pts-Math.round(se*S))),m.sps&&m.pps&&N.length&&(m.timescale=m.inputTimeScale,U.video={id:"main",container:"video/mp4",codec:m.codec,initSegment:E.default.initSegment([m]),metadata:{width:m.width,height:m.height}},K)){se=m.inputTimeScale;var le=this.getVideoStartPts(N),ve=Math.round(se*S);ie=Math.min(ie,a(N[0].dts,le)-ve),X=Math.min(X,le-ve)}if(Object.keys(U).length)return this.ISGenerated=!0,K&&(this._initPTS=X,this._initDTS=ie),{tracks:U,initPTS:X,timescale:se}},R.remuxVideo=function(v,m,S,B){var N=v.inputTimeScale,M=v.samples,U=[],K=M.length,j=this._initPTS,X=this.nextAvcDts,ie=8,se,le,ve,q=Number.POSITIVE_INFINITY,ee=Number.NEGATIVE_INFINITY,ae=0,_e=!1;if(!S||X===null){var fe=m*N,Ge=M[0].pts-a(M[0].dts,M[0].pts);X=fe-Ge}for(var Te=0;Te<K;Te++){var Ue=M[Te];if(Ue.pts=a(Ue.pts-j,X),Ue.dts=a(Ue.dts-j,X),Ue.dts>Ue.pts){var Ze=9e4*.2;ae=Math.max(Math.min(ae,Ue.pts-Ue.dts),-1*Ze)}Ue.dts<M[Te>0?Te-1:Te].dts&&(_e=!0)}_e&&M.sort(function(Fn,Yr){var $t=Fn.dts-Yr.dts,Jr=Fn.pts-Yr.pts;return $t||Jr}),le=M[0].dts,ve=M[M.length-1].dts;var ut=Math.round((ve-le)/(K-1));if(ae<0){if(ae<ut*-2){b.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(g.toMsFromMpegTsClock)(-ut,!0)+" ms");for(var Fe=ae,Ye=0;Ye<K;Ye++)M[Ye].dts=Fe=Math.max(Fe,M[Ye].pts-ut),M[Ye].pts=Math.max(Fe,M[Ye].pts)}else{b.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(g.toMsFromMpegTsClock)(ae,!0)+" ms to overcome this issue");for(var Ht=0;Ht<K;Ht++)M[Ht].dts=M[Ht].dts+ae}le=M[0].dts}if(S){var Bt=le-X,Ft=Bt>ut,Mt=Bt<-1;if(Ft||Mt){Ft?b.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(Bt,!0)+" ms ("+Bt+"dts) hole between fragments detected, filling it"):b.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(-Bt,!0)+" ms ("+Bt+"dts) overlapping between fragments detected"),le=X;var cr=M[0].pts-Bt;M[0].dts=le,M[0].pts=cr,b.logger.log("Video: First PTS/DTS adjusted: "+Object(g.toMsFromMpegTsClock)(cr,!0)+"/"+Object(g.toMsFromMpegTsClock)(le,!0)+", delta: "+Object(g.toMsFromMpegTsClock)(Bt,!0)+" ms")}}o&&(le=Math.max(0,le));for(var sr=0,br=0,hi=0;hi<K;hi++){for(var Mr=M[hi],Hr=Mr.units,pi=Hr.length,si=0,bi=0;bi<pi;bi++)si+=Hr[bi].data.length;br+=si,sr+=pi,Mr.length=si,Mr.dts=Math.max(Mr.dts,le),Mr.pts=Math.max(Mr.pts,Mr.dts,0),q=Math.min(Mr.pts,q),ee=Math.max(Mr.pts,ee)}ve=M[K-1].dts;var oi=br+4*sr+8,Ci;try{Ci=new Uint8Array(oi)}catch(Fn){this.observer.emit(L.Events.ERROR,L.Events.ERROR,{type:O.ErrorTypes.MUX_ERROR,details:O.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:oi,reason:"fail allocating video mdat "+oi});return}var sn=new DataView(Ci.buffer);sn.setUint32(0,oi),Ci.set(E.default.types.mdat,4);for(var Zr=0;Zr<K;Zr++){for(var Rr=M[Zr],Vr=Rr.units,Lt=0,$r=0,wn=Vr.length;$r<wn;$r++){var on=Vr[$r],wi=on.data,pn=on.data.byteLength;sn.setUint32(ie,pn),ie+=4,Ci.set(wi,ie),ie+=pn,Lt+=4+pn}if(Zr<K-1)se=M[Zr+1].dts-Rr.dts;else{var vn=this.config,Oi=Rr.dts-M[Zr>0?Zr-1:Zr].dts;if(vn.stretchShortVideoTrack&&this.nextAudioPts!==null){var Ln=Math.floor(vn.maxBufferHole*N),Ds=(B?q+B*N:this.nextAudioPts)-Rr.pts;Ds>Ln?(se=Ds-Oi,se<0&&(se=Oi),b.logger.log("[mp4-remuxer]: It is approximately "+Ds/90+" ms to the next segment; using duration "+se/90+" ms for the last video frame.")):se=Oi}else se=Oi}var Dn=Math.round(Rr.pts-Rr.dts);U.push(new l(Rr.key,se,Lt,Dn))}if(U.length&&_&&_<70){var bs=U[0].flags;bs.dependsOn=2,bs.isNonSync=0}console.assert(se!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=X=ve+se,this.isVideoContiguous=!0;var hs=E.default.moof(v.sequenceNumber++,le,D({},v,{samples:U})),Vs="video",Os={data1:hs,data2:Ci,startPTS:q/N,endPTS:(ee+se)/N,startDTS:le/N,endDTS:X/N,type:Vs,hasAudio:!1,hasVideo:!0,nb:U.length,dropped:v.dropped};return v.samples=[],v.dropped=0,console.assert(Ci.length,"MDAT length must not be zero"),Os},R.remuxAudio=function(v,m,S,B,N){var M=v.inputTimeScale,U=v.samplerate?v.samplerate:M,K=M/U,j=v.isAAC?f:p,X=j*K,ie=this._initPTS,se=!v.isAAC&&this.typeSupported.mpeg,le=[],ve=v.samples,q=se?0:8,ee=this.nextAudioPts||-1,ae=m*M;if(this.isAudioContiguous=S=S||ve.length&&ee>0&&(B&&Math.abs(ae-ee)<9e3||Math.abs(a(ve[0].pts-ie,ae)-ee)<20*X),ve.forEach(function(wi){wi.pts=a(wi.pts-ie,ae)}),!S||ee<0){if(ve=ve.filter(function(wi){return wi.pts>=0}),!ve.length)return;N===0?ee=0:B?ee=Math.max(0,ae):ee=ve[0].pts}if(v.isAAC)for(var _e=N!==void 0,fe=this.config.maxAudioFramesDrift,Ge=0,Te=ee;Ge<ve.length;Ge++){var Ue=ve[Ge],Ze=Ue.pts,ut=Ze-Te,Fe=Math.abs(1e3*ut/M);if(ut<=-fe*X&&_e)Ge===0&&(b.logger.warn("Audio frame @ "+(Ze/M).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*ut/M)+" ms."),this.nextAudioPts=ee=Te=Ze);else if(ut>=fe*X&&Fe<T&&_e){var Ye=Math.round(ut/X);Te=Ze-Ye*X,Te<0&&(Ye--,Te+=X),Ge===0&&(this.nextAudioPts=ee=Te),b.logger.warn("[mp4-remuxer]: Injecting "+Ye+" audio frame @ "+(Te/M).toFixed(3)+"s due to "+Math.round(1e3*ut/M)+" ms gap.");for(var Ht=0;Ht<Ye;Ht++){var Bt=Math.max(Te,0),Ft=P.default.getSilentFrame(v.manifestCodec||v.codec,v.channelCount);Ft||(b.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ft=Ue.unit.subarray()),ve.splice(Ge,0,{unit:Ft,pts:Bt}),Te+=X,Ge++}}Ue.pts=Te,Te+=X}for(var Mt=null,cr=null,sr,br=0,hi=ve.length;hi--;)br+=ve[hi].unit.byteLength;for(var Mr=0,Hr=ve.length;Mr<Hr;Mr++){var pi=ve[Mr],si=pi.unit,bi=pi.pts;if(cr!==null){var oi=le[Mr-1];oi.duration=Math.round((bi-cr)/K)}else if(S&&v.isAAC&&(bi=ee),Mt=bi,br>0){br+=q;try{sr=new Uint8Array(br)}catch(wi){this.observer.emit(L.Events.ERROR,L.Events.ERROR,{type:O.ErrorTypes.MUX_ERROR,details:O.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:br,reason:"fail allocating audio mdat "+br});return}if(!se){var Ci=new DataView(sr.buffer);Ci.setUint32(0,br),sr.set(E.default.types.mdat,4)}}else return;sr.set(si,q);var sn=si.byteLength;q+=sn,le.push(new l(!0,j,sn,0)),cr=bi}var Zr=le.length;if(!!Zr){var Rr=le[le.length-1];this.nextAudioPts=ee=cr+K*Rr.duration;var Vr=se?new Uint8Array(0):E.default.moof(v.sequenceNumber++,Mt/K,D({},v,{samples:le}));v.samples=[];var Lt=Mt/M,$r=ee/M,wn="audio",on={data1:Vr,data2:sr,startPTS:Lt,endPTS:$r,startDTS:Lt,endDTS:$r,type:wn,hasAudio:!0,hasVideo:!1,nb:Zr};return this.isAudioContiguous=!0,console.assert(sr.length,"MDAT length must not be zero"),on}},R.remuxEmptyAudio=function(v,m,S,B){var N=v.inputTimeScale,M=v.samplerate?v.samplerate:N,U=N/M,K=this.nextAudioPts,j=(K!==null?K:B.startDTS*N)+this._initDTS,X=B.endDTS*N+this._initDTS,ie=U*f,se=Math.ceil((X-j)/ie),le=P.default.getSilentFrame(v.manifestCodec||v.codec,v.channelCount);if(b.logger.warn("[mp4-remuxer]: remux empty Audio"),!le){b.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ve=[],q=0;q<se;q++){var ee=j+q*ie;ve.push({unit:le,pts:ee,dts:ee})}return v.samples=ve,this.remuxAudio(v,m,S,!1)},R.remuxID3=function(v,m){var S=v.samples.length;if(!!S){for(var B=v.inputTimeScale,N=this._initPTS,M=this._initDTS,U=0;U<S;U++){var K=v.samples[U];K.pts=a(K.pts-N,m*B)/B,K.dts=a(K.dts-M,m*B)/B}var j=v.samples;return v.samples=[],{samples:j}}},R.remuxText=function(v,m){var S=v.samples.length;if(!!S){for(var B=v.inputTimeScale,N=this._initPTS,M=0;M<S;M++){var U=v.samples[M];U.pts=a(U.pts-N,m*B)/B}v.samples.sort(function(j,X){return j.pts-X.pts});var K=v.samples;return v.samples=[],{samples:K}}},I}();function a(I,R){var y;if(R===null)return I;for(R<I?y=-8589934592:y=8589934592;Math.abs(I-R)>4294967296;)I+=y;return I}function u(I){for(var R=0;R<I.length;R++)if(I[R].key)return R;return-1}var l=function(R,y,v,m){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=y,this.size=v,this.cts=m,this.flags=new A(R)},A=function(R){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=R?2:1,this.isNonSync=R?0:1}},"./src/remux/passthrough-remuxer.ts":function(he,H,k){"use strict";k.r(H);var W=k("./src/polyfills/number.ts"),P=k("./src/utils/mp4-tools.ts"),E=k("./src/loader/fragment.ts"),L=k("./src/utils/logger.ts"),O=function(){function g(){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 D=g.prototype;return D.destroy=function(){},D.resetTimeStamp=function(f){this.initPTS=f,this.lastEndDTS=null},D.resetNextTimestamp=function(){this.lastEndDTS=null},D.resetInitSegment=function(f,p,_){this.audioCodec=p,this.videoCodec=_,this.generateInitSegment(f),this.emitInitSegment=!0},D.generateInitSegment=function(f){var p=this.audioCodec,_=this.videoCodec;if(!f||!f.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(P.parseInitSegment)(f);p||(p=w(d.audio,E.ElementaryStreamTypes.AUDIO)),_||(_=w(d.video,E.ElementaryStreamTypes.VIDEO));var o={};d.audio&&d.video?o.audiovideo={container:"video/mp4",codec:p+","+_,initSegment:f,id:"main"}:d.audio?o.audio={container:"audio/mp4",codec:p,initSegment:f,id:"audio"}:d.video?o.video={container:"video/mp4",codec:_,initSegment:f,id:"main"}:L.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},D.remux=function(f,p,_,d,o){var s=this.initPTS,a=this.lastEndDTS,u={audio:void 0,video:void 0,text:d,id3:_,initSegment:void 0};Object(W.isFiniteNumber)(a)||(a=this.lastEndDTS=o||0);var l=p.samples;if(!l||!l.length)return u;var A={initPTS:void 0,timescale:1},I=this.initData;if((!I||!I.length)&&(this.generateInitSegment(l),I=this.initData),!I||!I.length)return L.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),u;this.emitInitSegment&&(A.tracks=this.initTracks,this.emitInitSegment=!1),Object(W.isFiniteNumber)(s)||(this.initPTS=A.initPTS=s=b(I,l,a));var R=Object(P.getDuration)(l,I),y=a,v=R+y;Object(P.offsetStartDTS)(I,l,s),R>0?this.lastEndDTS=v:(L.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var m=!!I.audio,S=!!I.video,B="";m&&(B+="audio"),S&&(B+="video");var N={data1:l,startPTS:y,startDTS:y,endPTS:v,endDTS:v,type:B,hasAudio:m,hasVideo:S,nb:1,dropped:0};return u.audio=N.type==="audio"?N:void 0,u.video=N.type!=="audio"?N:void 0,u.text=d,u.id3=_,u.initSegment=A,u},g}(),b=function(D,T,f){return Object(P.getStartDTS)(D,T)-f};function w(g,D){var T=g==null?void 0:g.codec;return T&&T.length>4?T:T==="hvc1"?"hvc1.1.c.L120.90":T==="av01"?"av01.0.04M.08":T==="avc1"||D===E.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}H.default=O},"./src/task-loop.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"default",function(){return W});var W=function(){function P(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var E=P.prototype;return E.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},E.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},E.onHandlerDestroyed=function(){},E.hasInterval=function(){return!!this._tickInterval},E.hasNextTick=function(){return!!this._tickTimer},E.setInterval=function(O){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,O),!0)},E.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},E.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},E.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},E.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},E.doTick=function(){},P}()},"./src/types/cmcd.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"CMCDVersion",function(){return W}),k.d(H,"CMCDObjectType",function(){return P}),k.d(H,"CMCDStreamingFormat",function(){return E}),k.d(H,"CMCDStreamType",function(){return L});var W=1,P;(function(O){O.MANIFEST="m",O.AUDIO="a",O.VIDEO="v",O.MUXED="av",O.INIT="i",O.CAPTION="c",O.TIMED_TEXT="tt",O.KEY="k",O.OTHER="o"})(P||(P={}));var E;(function(O){O.DASH="d",O.HLS="h",O.SMOOTH="s",O.OTHER="o"})(E||(E={}));var L;(function(O){O.VOD="v",O.LIVE="l"})(L||(L={}))},"./src/types/level.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"HlsSkip",function(){return E}),k.d(H,"getSkipValue",function(){return L}),k.d(H,"HlsUrlParameters",function(){return O}),k.d(H,"Level",function(){return b});function W(w,g){for(var D=0;D<g.length;D++){var T=g[D];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(w,T.key,T)}}function P(w,g,D){return g&&W(w.prototype,g),D&&W(w,D),w}var E;(function(w){w.No="",w.Yes="YES",w.v2="v2"})(E||(E={}));function L(w,g){var D=w.canSkipUntil,T=w.canSkipDateRanges,f=w.endSN,p=g!==void 0?g-f:0;return D&&p<D?T?E.v2:E.Yes:E.No}var O=function(){function w(D,T,f){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=D,this.part=T,this.skip=f}var g=w.prototype;return g.addDirectives=function(T){var f=new self.URL(T);return this.msn!==void 0&&f.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&f.searchParams.set("_HLS_part",this.part.toString()),this.skip&&f.searchParams.set("_HLS_skip",this.skip),f.toString()},w}(),b=function(){function w(g){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=[g.url],this.attrs=g.attrs,this.bitrate=g.bitrate,g.details&&(this.details=g.details),this.id=g.id||0,this.name=g.name,this.width=g.width||0,this.height=g.height||0,this.audioCodec=g.audioCodec,this.videoCodec=g.videoCodec,this.unknownCodecs=g.unknownCodecs,this.codecSet=[g.videoCodec,g.audioCodec].filter(function(D){return D}).join(",").replace(/\.[^.,]+/g,"")}return P(w,[{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(D){var T=D%this.url.length;this._urlId!==T&&(this.details=void 0,this._urlId=T)}}]),w}()},"./src/types/loader.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"PlaylistContextType",function(){return W}),k.d(H,"PlaylistLevelType",function(){return P});var W;(function(E){E.MANIFEST="manifest",E.LEVEL="level",E.AUDIO_TRACK="audioTrack",E.SUBTITLE_TRACK="subtitleTrack"})(W||(W={}));var P;(function(E){E.MAIN="main",E.AUDIO="audio",E.SUBTITLE="subtitle"})(P||(P={}))},"./src/types/transmuxer.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"ChunkMetadata",function(){return W});var W=function(L,O,b,w,g,D){w===void 0&&(w=0),g===void 0&&(g=-1),D===void 0&&(D=!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=P(),this.buffering={audio:P(),video:P(),audiovideo:P()},this.level=L,this.sn=O,this.id=b,this.size=w,this.part=g,this.partial=D};function P(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"AttrList",function(){return E});var W=/^(\d+)x(\d+)$/,P=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,E=function(){function L(b){typeof b=="string"&&(b=L.parseAttrList(b));for(var w in b)b.hasOwnProperty(w)&&(this[w]=b[w])}var O=L.prototype;return O.decimalInteger=function(w){var g=parseInt(this[w],10);return g>Number.MAX_SAFE_INTEGER?1/0:g},O.hexadecimalInteger=function(w){if(this[w]){var g=(this[w]||"0x").slice(2);g=(g.length&1?"0":"")+g;for(var D=new Uint8Array(g.length/2),T=0;T<g.length/2;T++)D[T]=parseInt(g.slice(T*2,T*2+2),16);return D}else return null},O.hexadecimalIntegerAsNumber=function(w){var g=parseInt(this[w],16);return g>Number.MAX_SAFE_INTEGER?1/0:g},O.decimalFloatingPoint=function(w){return parseFloat(this[w])},O.optionalFloat=function(w,g){var D=this[w];return D?parseFloat(D):g},O.enumeratedString=function(w){return this[w]},O.bool=function(w){return this[w]==="YES"},O.decimalResolution=function(w){var g=W.exec(this[w]);if(g!==null)return{width:parseInt(g[1],10),height:parseInt(g[2],10)}},L.parseAttrList=function(w){var g,D={},T='"';for(P.lastIndex=0;(g=P.exec(w))!==null;){var f=g[2];f.indexOf(T)===0&&f.lastIndexOf(T)===f.length-1&&(f=f.slice(1,-1)),D[g[1]]=f}return D},L}()},"./src/utils/binary-search.ts":function(he,H,k){"use strict";k.r(H);var W={search:function(E,L){for(var O=0,b=E.length-1,w=null,g=null;O<=b;){w=(O+b)/2|0,g=E[w];var D=L(g);if(D>0)O=w+1;else if(D<0)b=w-1;else return g}return null}};H.default=W},"./src/utils/buffer-helper.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"BufferHelper",function(){return E});var W=k("./src/utils/logger.ts"),P={length:0,start:function(){return 0},end:function(){return 0}},E=function(){function L(){}return L.isBuffered=function(b,w){try{if(b){for(var g=L.getBuffered(b),D=0;D<g.length;D++)if(w>=g.start(D)&&w<=g.end(D))return!0}}catch(T){}return!1},L.bufferInfo=function(b,w,g){try{if(b){var D=L.getBuffered(b),T=[],f;for(f=0;f<D.length;f++)T.push({start:D.start(f),end:D.end(f)});return this.bufferedInfo(T,w,g)}}catch(p){}return{len:0,start:w,end:w,nextStart:void 0}},L.bufferedInfo=function(b,w,g){w=Math.max(0,w),b.sort(function(A,I){var R=A.start-I.start;return R||I.end-A.end});var D=[];if(g)for(var T=0;T<b.length;T++){var f=D.length;if(f){var p=D[f-1].end;b[T].start-p<g?b[T].end>p&&(D[f-1].end=b[T].end):D.push(b[T])}else D.push(b[T])}else D=b;for(var _=0,d,o=w,s=w,a=0;a<D.length;a++){var u=D[a].start,l=D[a].end;if(w+g>=u&&w<l)o=u,s=l,_=s-w;else if(w+g<u){d=u;break}}return{len:_,start:o||0,end:s||0,nextStart:d}},L.getBuffered=function(b){try{return b.buffered}catch(w){return W.logger.log("failed to get media.buffered",w),P}},L}()},"./src/utils/cea-608-parser.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"Row",function(){return s}),k.d(H,"CaptionScreen",function(){return a});var W=k("./src/utils/logger.ts"),P={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},E=function(v){var m=v;return P.hasOwnProperty(v)&&(m=P[v]),String.fromCharCode(m)},L=15,O=100,b={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},w={17:2,18:4,21:6,22:8,23:10,19:13,20:15},g={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},D={25:2,26:4,29:6,30:8,31:10,27:13,28:15},T=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],f;(function(y){y[y.ERROR=0]="ERROR",y[y.TEXT=1]="TEXT",y[y.WARNING=2]="WARNING",y[y.INFO=2]="INFO",y[y.DEBUG=3]="DEBUG",y[y.DATA=3]="DATA"})(f||(f={}));var p=function(){function y(){this.time=null,this.verboseLevel=f.ERROR}var v=y.prototype;return v.log=function(S,B){this.verboseLevel>=S&&W.logger.log(this.time+" ["+S+"] "+B)},y}(),_=function(v){for(var m=[],S=0;S<v.length;S++)m.push(v[S].toString(16));return m},d=function(){function y(m,S,B,N,M){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=m||"white",this.underline=S||!1,this.italics=B||!1,this.background=N||"black",this.flash=M||!1}var v=y.prototype;return v.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},v.setStyles=function(S){for(var B=["foreground","underline","italics","background","flash"],N=0;N<B.length;N++){var M=B[N];S.hasOwnProperty(M)&&(this[M]=S[M])}},v.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},v.equals=function(S){return this.foreground===S.foreground&&this.underline===S.underline&&this.italics===S.italics&&this.background===S.background&&this.flash===S.flash},v.copy=function(S){this.foreground=S.foreground,this.underline=S.underline,this.italics=S.italics,this.background=S.background,this.flash=S.flash},v.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},y}(),o=function(){function y(m,S,B,N,M,U){this.uchar=void 0,this.penState=void 0,this.uchar=m||" ",this.penState=new d(S,B,N,M,U)}var v=y.prototype;return v.reset=function(){this.uchar=" ",this.penState.reset()},v.setChar=function(S,B){this.uchar=S,this.penState.copy(B)},v.setPenState=function(S){this.penState.copy(S)},v.equals=function(S){return this.uchar===S.uchar&&this.penState.equals(S.penState)},v.copy=function(S){this.uchar=S.uchar,this.penState.copy(S.penState)},v.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},y}(),s=function(){function y(m){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var S=0;S<O;S++)this.chars.push(new o);this.logger=m,this.pos=0,this.currPenState=new d}var v=y.prototype;return v.equals=function(S){for(var B=!0,N=0;N<O;N++)if(!this.chars[N].equals(S.chars[N])){B=!1;break}return B},v.copy=function(S){for(var B=0;B<O;B++)this.chars[B].copy(S.chars[B])},v.isEmpty=function(){for(var S=!0,B=0;B<O;B++)if(!this.chars[B].isEmpty()){S=!1;break}return S},v.setCursor=function(S){this.pos!==S&&(this.pos=S),this.pos<0?(this.logger.log(f.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>O&&(this.logger.log(f.DEBUG,"Too large cursor position "+this.pos),this.pos=O)},v.moveCursor=function(S){var B=this.pos+S;if(S>1)for(var N=this.pos+1;N<B+1;N++)this.chars[N].setPenState(this.currPenState);this.setCursor(B)},v.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},v.insertChar=function(S){S>=144&&this.backSpace();var B=E(S);if(this.pos>=O){this.logger.log(f.ERROR,"Cannot insert "+S.toString(16)+" ("+B+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(B,this.currPenState),this.moveCursor(1)},v.clearFromPos=function(S){var B;for(B=S;B<O;B++)this.chars[B].reset()},v.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},v.clearToEndOfRow=function(){this.clearFromPos(this.pos)},v.getTextString=function(){for(var S=[],B=!0,N=0;N<O;N++){var M=this.chars[N].uchar;M!==" "&&(B=!1),S.push(M)}return B?"":S.join("")},v.setPenStyles=function(S){this.currPenState.setStyles(S);var B=this.chars[this.pos];B.setPenState(this.currPenState)},y}(),a=function(){function y(m){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var S=0;S<L;S++)this.rows.push(new s(m));this.logger=m,this.currRow=L-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var v=y.prototype;return v.reset=function(){for(var S=0;S<L;S++)this.rows[S].clear();this.currRow=L-1},v.equals=function(S){for(var B=!0,N=0;N<L;N++)if(!this.rows[N].equals(S.rows[N])){B=!1;break}return B},v.copy=function(S){for(var B=0;B<L;B++)this.rows[B].copy(S.rows[B])},v.isEmpty=function(){for(var S=!0,B=0;B<L;B++)if(!this.rows[B].isEmpty()){S=!1;break}return S},v.backSpace=function(){var S=this.rows[this.currRow];S.backSpace()},v.clearToEndOfRow=function(){var S=this.rows[this.currRow];S.clearToEndOfRow()},v.insertChar=function(S){var B=this.rows[this.currRow];B.insertChar(S)},v.setPen=function(S){var B=this.rows[this.currRow];B.setPenStyles(S)},v.moveCursor=function(S){var B=this.rows[this.currRow];B.moveCursor(S)},v.setCursor=function(S){this.logger.log(f.INFO,"setCursor: "+S);var B=this.rows[this.currRow];B.setCursor(S)},v.setPAC=function(S){this.logger.log(f.INFO,"pacData = "+JSON.stringify(S));var B=S.row-1;if(this.nrRollUpRows&&B<this.nrRollUpRows-1&&(B=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==B){for(var N=0;N<L;N++)this.rows[N].clear();var M=this.currRow+1-this.nrRollUpRows,U=this.lastOutputScreen;if(U){var K=U.rows[M].cueStartTime,j=this.logger.time;if(K&&j!==null&&K<j)for(var X=0;X<this.nrRollUpRows;X++)this.rows[B-this.nrRollUpRows+X+1].copy(U.rows[M+X])}}this.currRow=B;var ie=this.rows[this.currRow];if(S.indent!==null){var se=S.indent,le=Math.max(se-1,0);ie.setCursor(S.indent),S.color=ie.chars[le].penState.foreground}var ve={foreground:S.color,underline:S.underline,italics:S.italics,background:"black",flash:!1};this.setPen(ve)},v.setBkgData=function(S){this.logger.log(f.INFO,"bkgData = "+JSON.stringify(S)),this.backSpace(),this.setPen(S),this.insertChar(32)},v.setRollUpRows=function(S){this.nrRollUpRows=S},v.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(f.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(f.TEXT,this.getDisplayText());var S=this.currRow+1-this.nrRollUpRows,B=this.rows.splice(S,1)[0];B.clear(),this.rows.splice(this.currRow,0,B),this.logger.log(f.INFO,"Rolling up")},v.getDisplayText=function(S){S=S||!1;for(var B=[],N="",M=-1,U=0;U<L;U++){var K=this.rows[U].getTextString();K&&(M=U+1,S?B.push("Row "+M+": '"+K+"'"):B.push(K.trim()))}return B.length>0&&(S?N="["+B.join(" | ")+"]":N=B.join(`
154
- `)),N},v.getTextAndFormat=function(){return this.rows},y}(),u=function(){function y(m,S,B){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=m,this.outputFilter=S,this.mode=null,this.verbose=0,this.displayedMemory=new a(B),this.nonDisplayedMemory=new a(B),this.lastOutputScreen=new a(B),this.currRollUpRow=this.displayedMemory.rows[L-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=B}var v=y.prototype;return v.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[L-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},v.getHandler=function(){return this.outputFilter},v.setHandler=function(S){this.outputFilter=S},v.setPAC=function(S){this.writeScreen.setPAC(S)},v.setBkgData=function(S){this.writeScreen.setBkgData(S)},v.setMode=function(S){S!==this.mode&&(this.mode=S,this.logger.log(f.INFO,"MODE="+S),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=S)},v.insertChars=function(S){for(var B=0;B<S.length;B++)this.writeScreen.insertChar(S[B]);var N=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(f.INFO,N+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(f.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},v.ccRCL=function(){this.logger.log(f.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},v.ccBS=function(){this.logger.log(f.INFO,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},v.ccAOF=function(){},v.ccAON=function(){},v.ccDER=function(){this.logger.log(f.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},v.ccRU=function(S){this.logger.log(f.INFO,"RU("+S+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(S)},v.ccFON=function(){this.logger.log(f.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},v.ccRDC=function(){this.logger.log(f.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},v.ccTR=function(){this.logger.log(f.INFO,"TR"),this.setMode("MODE_TEXT")},v.ccRTD=function(){this.logger.log(f.INFO,"RTD"),this.setMode("MODE_TEXT")},v.ccEDM=function(){this.logger.log(f.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},v.ccCR=function(){this.logger.log(f.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},v.ccENM=function(){this.logger.log(f.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},v.ccEOC=function(){if(this.logger.log(f.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var S=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=S,this.writeScreen=this.nonDisplayedMemory,this.logger.log(f.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},v.ccTO=function(S){this.logger.log(f.INFO,"TO("+S+") - Tab Offset"),this.writeScreen.moveCursor(S)},v.ccMIDROW=function(S){var B={flash:!1};if(B.underline=S%2===1,B.italics=S>=46,B.italics)B.foreground="white";else{var N=Math.floor(S/2)-16,M=["white","green","blue","cyan","red","yellow","magenta"];B.foreground=M[N]}this.logger.log(f.INFO,"MIDROW: "+JSON.stringify(B)),this.writeScreen.setPen(B)},v.outputDataUpdate=function(S){S===void 0&&(S=!1);var B=this.logger.time;B!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=B:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,B,this.lastOutputScreen),S&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:B),this.lastOutputScreen.copy(this.displayedMemory))},v.cueSplitAtTime=function(S){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,S,this.displayedMemory),this.cueStartTime=S))},y}(),l=function(){function y(m,S,B){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var N=new p;this.channels=[null,new u(m,S,N),new u(m+1,B,N)],this.cmdHistory=R(),this.logger=N}var v=y.prototype;return v.getHandler=function(S){return this.channels[S].getHandler()},v.setHandler=function(S,B){this.channels[S].setHandler(B)},v.addData=function(S,B){var N,M,U,K=!1;this.logger.time=S;for(var j=0;j<B.length;j+=2)if(M=B[j]&127,U=B[j+1]&127,!(M===0&&U===0)){if(this.logger.log(f.DATA,"["+_([B[j],B[j+1]])+"] -> ("+_([M,U])+")"),N=this.parseCmd(M,U),N||(N=this.parseMidrow(M,U)),N||(N=this.parsePAC(M,U)),N||(N=this.parseBackgroundAttributes(M,U)),!N&&(K=this.parseChars(M,U),K)){var X=this.currentChannel;if(X&&X>0){var ie=this.channels[X];ie.insertChars(K)}else this.logger.log(f.WARNING,"No channel found yet. TEXT-MODE?")}!N&&!K&&this.logger.log(f.WARNING,"Couldn't parse cleaned data "+_([M,U])+" orig: "+_([B[j],B[j+1]]))}},v.parseCmd=function(S,B){var N=this.cmdHistory,M=(S===20||S===28||S===21||S===29)&&B>=32&&B<=47,U=(S===23||S===31)&&B>=33&&B<=35;if(!(M||U))return!1;if(I(S,B,N))return A(null,null,N),this.logger.log(f.DEBUG,"Repeated command ("+_([S,B])+") is dropped"),!0;var K=S===20||S===21||S===23?1:2,j=this.channels[K];return S===20||S===21||S===28||S===29?B===32?j.ccRCL():B===33?j.ccBS():B===34?j.ccAOF():B===35?j.ccAON():B===36?j.ccDER():B===37?j.ccRU(2):B===38?j.ccRU(3):B===39?j.ccRU(4):B===40?j.ccFON():B===41?j.ccRDC():B===42?j.ccTR():B===43?j.ccRTD():B===44?j.ccEDM():B===45?j.ccCR():B===46?j.ccENM():B===47&&j.ccEOC():j.ccTO(B-32),A(S,B,N),this.currentChannel=K,!0},v.parseMidrow=function(S,B){var N=0;if((S===17||S===25)&&B>=32&&B<=47){if(S===17?N=1:N=2,N!==this.currentChannel)return this.logger.log(f.ERROR,"Mismatch channel in midrow parsing"),!1;var M=this.channels[N];return M?(M.ccMIDROW(B),this.logger.log(f.DEBUG,"MIDROW ("+_([S,B])+")"),!0):!1}return!1},v.parsePAC=function(S,B){var N,M=this.cmdHistory,U=(S>=17&&S<=23||S>=25&&S<=31)&&B>=64&&B<=127,K=(S===16||S===24)&&B>=64&&B<=95;if(!(U||K))return!1;if(I(S,B,M))return A(null,null,M),!0;var j=S<=23?1:2;B>=64&&B<=95?N=j===1?b[S]:g[S]:N=j===1?w[S]:D[S];var X=this.channels[j];return X?(X.setPAC(this.interpretPAC(N,B)),A(S,B,M),this.currentChannel=j,!0):!1},v.interpretPAC=function(S,B){var N,M={color:null,italics:!1,indent:null,underline:!1,row:S};return B>95?N=B-96:N=B-64,M.underline=(N&1)===1,N<=13?M.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(N/2)]:N<=15?(M.italics=!0,M.color="white"):M.indent=Math.floor((N-16)/2)*4,M},v.parseChars=function(S,B){var N,M=null,U=null;if(S>=25?(N=2,U=S-8):(N=1,U=S),U>=17&&U<=19){var K;U===17?K=B+80:U===18?K=B+112:K=B+144,this.logger.log(f.INFO,"Special char '"+E(K)+"' in channel "+N),M=[K]}else S>=32&&S<=127&&(M=B===0?[S]:[S,B]);if(M){var j=_(M);this.logger.log(f.DEBUG,"Char codes = "+j.join(",")),A(S,B,this.cmdHistory)}return M},v.parseBackgroundAttributes=function(S,B){var N=(S===16||S===24)&&B>=32&&B<=47,M=(S===23||S===31)&&B>=45&&B<=47;if(!(N||M))return!1;var U,K={};S===16||S===24?(U=Math.floor((B-32)/2),K.background=T[U],B%2===1&&(K.background=K.background+"_semi")):B===45?K.background="transparent":(K.foreground="black",B===47&&(K.underline=!0));var j=S<=23?1:2,X=this.channels[j];return X.setBkgData(K),A(S,B,this.cmdHistory),!0},v.reset=function(){for(var S=0;S<Object.keys(this.channels).length;S++){var B=this.channels[S];B&&B.reset()}this.cmdHistory=R()},v.cueSplitAtTime=function(S){for(var B=0;B<this.channels.length;B++){var N=this.channels[B];N&&N.cueSplitAtTime(S)}},y}();function A(y,v,m){m.a=y,m.b=v}function I(y,v,m){return m.a===y&&m.b===v}function R(){return{a:null,b:null}}H.default=l},"./src/utils/codecs.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"isCodecType",function(){return P}),k.d(H,"isCodecSupportedInMp4",function(){return E});var W={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 P(L,O){var b=W[O];return!!b&&b[L.slice(0,4)]===!0}function E(L,O){return MediaSource.isTypeSupported((O||"video")+'/mp4;codecs="'+L+'"')}},"./src/utils/cues.ts":function(he,H,k){"use strict";k.r(H);var W=k("./src/utils/vttparser.ts"),P=k("./src/utils/webvtt-parser.ts"),E=k("./src/utils/texttrack-utils.ts"),L=/\s/,O={newCue:function(w,g,D,T){for(var f=[],p,_,d,o,s,a=self.VTTCue||self.TextTrackCue,u=0;u<T.rows.length;u++)if(p=T.rows[u],d=!0,o=0,s="",!p.isEmpty()){for(var l=0;l<p.chars.length;l++)L.test(p.chars[l].uchar)&&d?o++:(s+=p.chars[l].uchar,d=!1);p.cueStartTime=g,g===D&&(D+=1e-4),o>=16?o--:o++;var A=Object(W.fixLineBreaks)(s.trim()),I=Object(P.generateCueId)(g,D,A);(!w||!w.cues||!w.cues.getCueById(I))&&(_=new a(g,D,A),_.id=I,_.line=u+1,_.align="left",_.position=10+Math.min(80,Math.floor(o*8/32)*10),f.push(_))}return w&&f.length&&(f.sort(function(R,y){return R.line==="auto"||y.line==="auto"?0:R.line>8&&y.line>8?y.line-R.line:R.line-y.line}),f.forEach(function(R){return Object(E.addCueToTrack)(w,R)})),f}};H.default=O},"./src/utils/discontinuities.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"findFirstFragWithCC",function(){return L}),k.d(H,"shouldAlignOnDiscontinuities",function(){return O}),k.d(H,"findDiscontinuousReferenceFrag",function(){return b}),k.d(H,"adjustSlidingStart",function(){return g}),k.d(H,"alignStream",function(){return D}),k.d(H,"alignPDT",function(){return f}),k.d(H,"alignFragmentByPDTDelta",function(){return p}),k.d(H,"alignMediaPlaylistByPDT",function(){return _});var W=k("./src/polyfills/number.ts"),P=k("./src/utils/logger.ts"),E=k("./src/controller/level-helper.ts");function L(d,o){for(var s=null,a=0,u=d.length;a<u;a++){var l=d[a];if(l&&l.cc===o){s=l;break}}return s}function O(d,o,s){return!!(o.details&&(s.endCC>s.startCC||d&&d.cc<s.startCC))}function b(d,o){var s=d.fragments,a=o.fragments;if(!a.length||!s.length){P.logger.log("No fragments to align");return}var u=L(s,a[0].cc);if(!u||u&&!u.startPTS){P.logger.log("No frag in previous level to align on");return}return u}function w(d,o){if(d){var s=d.start+o;d.start=d.startPTS=s,d.endPTS=s+d.duration}}function g(d,o){for(var s=o.fragments,a=0,u=s.length;a<u;a++)w(s[a],d);o.fragmentHint&&w(o.fragmentHint,d),o.alignedSliding=!0}function D(d,o,s){!o||(T(d,s,o),!s.alignedSliding&&o.details&&f(s,o.details),!s.alignedSliding&&o.details&&!s.skippedSegments&&Object(E.adjustSliding)(o.details,s))}function T(d,o,s){if(O(d,s,o)){var a=b(s.details,o);a&&Object(W.isFiniteNumber)(a.start)&&(P.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),g(a.start,o))}}function f(d,o){if(!(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)){var s=o.fragments[0].programDateTime,a=d.fragments[0].programDateTime,u=(a-s)/1e3+o.fragments[0].start;u&&Object(W.isFiniteNumber)(u)&&(P.logger.log("Adjusting PTS using programDateTime delta "+(a-s)+"ms, sliding:"+u.toFixed(3)+" "+d.url+" "),g(u,d))}}function p(d,o){var s=d.programDateTime;if(!!s){var a=(s-o)/1e3;d.start=d.startPTS=a,d.endPTS=a+d.duration}}function _(d,o){if(!(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)){var s=o.fragments[0].programDateTime,a=o.fragments[0].start,u=s-a*1e3;d.fragments.forEach(function(l){p(l,u)}),d.fragmentHint&&p(d.fragmentHint,u),d.alignedSliding=!0}}},"./src/utils/ewma-bandwidth-estimator.ts":function(he,H,k){"use strict";k.r(H);var W=k("./src/utils/ewma.ts"),P=function(){function E(O,b,w){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=w,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new W.default(O),this.fast_=new W.default(b)}var L=E.prototype;return L.update=function(b,w){var g=this.slow_,D=this.fast_;this.slow_.halfLife!==b&&(this.slow_=new W.default(b,g.getEstimate(),g.getTotalWeight())),this.fast_.halfLife!==w&&(this.fast_=new W.default(w,D.getEstimate(),D.getTotalWeight()))},L.sample=function(b,w){b=Math.max(b,this.minDelayMs_);var g=8*w,D=b/1e3,T=g/D;this.fast_.sample(D,T),this.slow_.sample(D,T)},L.canEstimate=function(){var b=this.fast_;return b&&b.getTotalWeight()>=this.minWeight_},L.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},L.destroy=function(){},E}();H.default=P},"./src/utils/ewma.ts":function(he,H,k){"use strict";k.r(H);var W=function(){function P(L,O,b){O===void 0&&(O=0),b===void 0&&(b=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=L,this.alpha_=L?Math.exp(Math.log(.5)/L):0,this.estimate_=O,this.totalWeight_=b}var E=P.prototype;return E.sample=function(O,b){var w=Math.pow(this.alpha_,O);this.estimate_=b*(1-w)+w*this.estimate_,this.totalWeight_+=O},E.getTotalWeight=function(){return this.totalWeight_},E.getEstimate=function(){if(this.alpha_){var O=1-Math.pow(this.alpha_,this.totalWeight_);if(O)return this.estimate_/O}return this.estimate_},P}();H.default=W},"./src/utils/fetch-loader.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"fetchSupported",function(){return p});var W=k("./src/polyfills/number.ts"),P=k("./src/loader/load-stats.ts"),E=k("./src/demux/chunk-cache.ts");function L(a,u){a.prototype=Object.create(u.prototype),a.prototype.constructor=a,D(a,u)}function O(a){var u=typeof Map=="function"?new Map:void 0;return O=function(A){if(A===null||!g(A))return A;if(typeof A!="function")throw new TypeError("Super expression must either be null or a function");if(typeof u!="undefined"){if(u.has(A))return u.get(A);u.set(A,I)}function I(){return b(A,arguments,T(this).constructor)}return I.prototype=Object.create(A.prototype,{constructor:{value:I,enumerable:!1,writable:!0,configurable:!0}}),D(I,A)},O(a)}function b(a,u,l){return w()?b=Reflect.construct:b=function(I,R,y){var v=[null];v.push.apply(v,R);var m=Function.bind.apply(I,v),S=new m;return y&&D(S,y.prototype),S},b.apply(null,arguments)}function w(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}function g(a){return Function.toString.call(a).indexOf("[native code]")!==-1}function D(a,u){return D=Object.setPrototypeOf||function(A,I){return A.__proto__=I,A},D(a,u)}function T(a){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},T(a)}function f(){return f=Object.assign||function(a){for(var u=1;u<arguments.length;u++){var l=arguments[u];for(var A in l)Object.prototype.hasOwnProperty.call(l,A)&&(a[A]=l[A])}return a},f.apply(this,arguments)}function p(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(a){}return!1}var _=function(){function a(l){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=l.fetchSetup||o,this.controller=new self.AbortController,this.stats=new P.LoadStats}var u=a.prototype;return u.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},u.abortInternal=function(){var A=this.response;(!A||!A.ok)&&(this.stats.aborted=!0,this.controller.abort())},u.abort=function(){var A;this.abortInternal(),(A=this.callbacks)!==null&&A!==void 0&&A.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},u.load=function(A,I,R){var y=this,v=this.stats;if(v.loading.start)throw new Error("Loader can only be used once.");v.loading.start=self.performance.now();var m=d(A,this.controller.signal),S=R.onProgress,B=A.responseType==="arraybuffer",N=B?"byteLength":"length";this.context=A,this.config=I,this.callbacks=R,this.request=this.fetchSetup(A,m),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){y.abortInternal(),R.onTimeout(v,A,y.response)},I.timeout),self.fetch(this.request).then(function(M){if(y.response=y.loader=M,!M.ok){var U=M.status,K=M.statusText;throw new s(K||"fetch, bad network response",U,M)}return v.loading.first=Math.max(self.performance.now(),v.loading.start),v.total=parseInt(M.headers.get("Content-Length")||"0"),S&&Object(W.isFiniteNumber)(I.highWaterMark)?y.loadProgressively(M,v,A,I.highWaterMark,S):B?M.arrayBuffer():M.text()}).then(function(M){var U=y.response;self.clearTimeout(y.requestTimeout),v.loading.end=Math.max(self.performance.now(),v.loading.first),v.loaded=v.total=M[N];var K={url:U.url,data:M};S&&!Object(W.isFiniteNumber)(I.highWaterMark)&&S(v,A,M,U),R.onSuccess(K,v,A,U)}).catch(function(M){if(self.clearTimeout(y.requestTimeout),!v.aborted){var U=M.code||0;R.onError({code:U,text:M.message},A,M.details)}})},u.getCacheAge=function(){var A=null;if(this.response){var I=this.response.headers.get("age");A=I?parseFloat(I):null}return A},u.loadProgressively=function(A,I,R,y,v){y===void 0&&(y=0);var m=new E.default,S=A.body.getReader(),B=function N(){return S.read().then(function(M){if(M.done)return m.dataLength&&v(I,R,m.flush(),A),Promise.resolve(new ArrayBuffer(0));var U=M.value,K=U.length;return I.loaded+=K,K<y||m.dataLength?(m.push(U),m.dataLength>=y&&v(I,R,m.flush(),A)):v(I,R,U,A),N()}).catch(function(){return Promise.reject()})};return B()},a}();function d(a,u){var l={method:"GET",mode:"cors",credentials:"same-origin",signal:u,headers:new self.Headers(f({},a.headers))};return a.rangeEnd&&l.headers.set("Range","bytes="+a.rangeStart+"-"+String(a.rangeEnd-1)),l}function o(a,u){return new self.Request(a.url,u)}var s=function(a){L(u,a);function u(l,A,I){var R;return R=a.call(this,l)||this,R.code=void 0,R.details=void 0,R.code=A,R.details=I,R}return u}(O(Error));H.default=_},"./src/utils/imsc1-ttml-parser.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"IMSC1_CODEC",function(){return g}),k.d(H,"parseIMSC1",function(){return p});var W=k("./src/utils/mp4-tools.ts"),P=k("./src/utils/vttparser.ts"),E=k("./src/utils/vttcue.ts"),L=k("./src/demux/id3.ts"),O=k("./src/utils/timescale-conversion.ts"),b=k("./src/utils/webvtt-parser.ts");function w(){return w=Object.assign||function(y){for(var v=1;v<arguments.length;v++){var m=arguments[v];for(var S in m)Object.prototype.hasOwnProperty.call(m,S)&&(y[S]=m[S])}return y},w.apply(this,arguments)}var g="stpp.ttml.im1t",D=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,T=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,f={left:"start",center:"center",right:"end",start:"start",end:"end"};function p(y,v,m,S,B){var N=Object(W.findBox)(new Uint8Array(y),["mdat"]);if(N.length===0){B(new Error("Could not parse IMSC1 mdat"));return}var M=N[0],U=Object(L.utf8ArrayToStr)(new Uint8Array(y,M.start,M.end-M.start)),K=Object(O.toTimescaleFromScale)(v,1,m);try{S(_(U,K))}catch(j){B(j)}}function _(y,v){var m=new DOMParser,S=m.parseFromString(y,"text/xml"),B=S.getElementsByTagName("tt")[0];if(!B)throw new Error("Invalid ttml");var N={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},M=Object.keys(N).reduce(function(ie,se){return ie[se]=B.getAttribute("ttp:"+se)||N[se],ie},{}),U=B.getAttribute("xml:space")!=="preserve",K=o(d(B,"styling","style")),j=o(d(B,"layout","region")),X=d(B,"body","[begin]");return[].map.call(X,function(ie){var se=s(ie,U);if(!se||!ie.hasAttribute("begin"))return null;var le=A(ie.getAttribute("begin"),M),ve=A(ie.getAttribute("dur"),M),q=A(ie.getAttribute("end"),M);if(le===null)throw l(ie);if(q===null){if(ve===null)throw l(ie);q=le+ve}var ee=new E.default(le-v,q-v,se);ee.id=Object(b.generateCueId)(ee.startTime,ee.endTime,ee.text);var ae=j[ie.getAttribute("region")],_e=K[ie.getAttribute("style")];ee.position=10,ee.size=80;var fe=a(ae,_e),Ge=fe.textAlign;if(Ge){var Te=f[Ge];Te&&(ee.lineAlign=Te),ee.align=Ge}return w(ee,fe),ee}).filter(function(ie){return ie!==null})}function d(y,v,m){var S=y.getElementsByTagName(v)[0];return S?[].slice.call(S.querySelectorAll(m)):[]}function o(y){return y.reduce(function(v,m){var S=m.getAttribute("xml:id");return S&&(v[S]=m),v},{})}function s(y,v){return[].slice.call(y.childNodes).reduce(function(m,S,B){var N;return S.nodeName==="br"&&B?m+`
155
- `:(N=S.childNodes)!==null&&N!==void 0&&N.length?s(S,v):v?m+S.textContent.trim().replace(/\s+/g," "):m+S.textContent},"")}function a(y,v){var m="http://www.w3.org/ns/ttml#styling",S=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return S.reduce(function(B,N){var M=u(v,m,N)||u(y,m,N);return M&&(B[N]=M),B},{})}function u(y,v,m){return y.hasAttributeNS(v,m)?y.getAttributeNS(v,m):null}function l(y){return new Error("Could not parse ttml timestamp "+y)}function A(y,v){if(!y)return null;var m=Object(P.parseTimeStamp)(y);return m===null&&(D.test(y)?m=I(y,v):T.test(y)&&(m=R(y,v))),m}function I(y,v){var m=D.exec(y),S=(m[4]|0)+(m[5]|0)/v.subFrameRate;return(m[1]|0)*3600+(m[2]|0)*60+(m[3]|0)+S/v.frameRate}function R(y,v){var m=T.exec(y),S=Number(m[1]),B=m[2];switch(B){case"h":return S*3600;case"m":return S*60;case"ms":return S*1e3;case"f":return S/v.frameRate;case"t":return S/v.tickRate}return S}},"./src/utils/logger.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"enableLogs",function(){return b}),k.d(H,"logger",function(){return w});var W=function(){},P={trace:W,debug:W,log:W,warn:W,info:W,error:W},E=P;function L(g){var D=self.console[g];return D?D.bind(self.console,"["+g+"] >"):W}function O(g){for(var D=arguments.length,T=new Array(D>1?D-1:0),f=1;f<D;f++)T[f-1]=arguments[f];T.forEach(function(p){E[p]=g[p]?g[p].bind(g):L(p)})}function b(g){if(self.console&&g===!0||typeof g=="object"){O(g,"debug","log","info","warn","error");try{E.log()}catch(D){E=P}}else E=P}var w=E},"./src/utils/mediakeys-helper.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"KeySystems",function(){return W}),k.d(H,"requestMediaKeySystemAccess",function(){return P});var W;(function(E){E.WIDEVINE="com.widevine.alpha",E.PLAYREADY="com.microsoft.playready"})(W||(W={}));var P=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"getMediaSource",function(){return W});function W(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"bin2str",function(){return O}),k.d(H,"readUint16",function(){return b}),k.d(H,"readUint32",function(){return w}),k.d(H,"writeUint32",function(){return g}),k.d(H,"findBox",function(){return D}),k.d(H,"parseSegmentIndex",function(){return T}),k.d(H,"parseInitSegment",function(){return f}),k.d(H,"getStartDTS",function(){return p}),k.d(H,"getDuration",function(){return _}),k.d(H,"computeRawDurationFromSamples",function(){return d}),k.d(H,"offsetStartDTS",function(){return o}),k.d(H,"segmentValidRange",function(){return s}),k.d(H,"appendUint8Array",function(){return a});var W=k("./src/utils/typed-array.ts"),P=k("./src/loader/fragment.ts"),E=Math.pow(2,32)-1,L=[].push;function O(u){return String.fromCharCode.apply(null,u)}function b(u,l){"data"in u&&(l+=u.start,u=u.data);var A=u[l]<<8|u[l+1];return A<0?65536+A:A}function w(u,l){"data"in u&&(l+=u.start,u=u.data);var A=u[l]<<24|u[l+1]<<16|u[l+2]<<8|u[l+3];return A<0?4294967296+A:A}function g(u,l,A){"data"in u&&(l+=u.start,u=u.data),u[l]=A>>24,u[l+1]=A>>16&255,u[l+2]=A>>8&255,u[l+3]=A&255}function D(u,l){var A=[];if(!l.length)return A;var I,R,y;"data"in u?(I=u.data,R=u.start,y=u.end):(I=u,R=0,y=I.byteLength);for(var v=R;v<y;){var m=w(I,v),S=O(I.subarray(v+4,v+8)),B=m>1?v+m:y;if(S===l[0])if(l.length===1)A.push({data:I,start:v+8,end:B});else{var N=D({data:I,start:v+8,end:B},l.slice(1));N.length&&L.apply(A,N)}v=B}return A}function T(u){var l=D(u,["moov"]),A=l[0],I=A?A.end:null,R=D(u,["sidx"]);if(!R||!R[0])return null;var y=[],v=R[0],m=v.data[0],S=m===0?8:16,B=w(v,S);S+=4;var N=0,M=0;m===0?S+=8:S+=16,S+=2;var U=v.end+M,K=b(v,S);S+=2;for(var j=0;j<K;j++){var X=S,ie=w(v,X);X+=4;var se=ie&2147483647,le=(ie&2147483648)>>>31;if(le===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ve=w(v,X);X+=4,y.push({referenceSize:se,subsegmentDuration:ve,info:{duration:ve/B,start:U,end:U+se-1}}),U+=se,X+=4,S=X}return{earliestPresentationTime:N,timescale:B,version:m,referencesCount:K,references:y,moovEndOffset:I}}function f(u){for(var l=[],A=D(u,["moov","trak"]),I=0;I<A.length;I++){var R=A[I],y=D(R,["tkhd"])[0];if(y){var v=y.data[y.start],m=v===0?12:20,S=w(y,m),B=D(R,["mdia","mdhd"])[0];if(B){v=B.data[B.start],m=v===0?12:20;var N=w(B,m),M=D(R,["mdia","hdlr"])[0];if(M){var U=O(M.data.subarray(M.start+8,M.start+12)),K={soun:P.ElementaryStreamTypes.AUDIO,vide:P.ElementaryStreamTypes.VIDEO}[U];if(K){var j=D(R,["mdia","minf","stbl","stsd"])[0],X=void 0;j&&(X=O(j.data.subarray(j.start+12,j.start+16))),l[S]={timescale:N,type:K},l[K]={timescale:N,id:S,codec:X}}}}}}var ie=D(u,["moov","mvex","trex"]);return ie.forEach(function(se){var le=w(se,4),ve=l[le];ve&&(ve.default={duration:w(se,12),flags:w(se,20)})}),l}function p(u,l){return D(l,["moof","traf"]).reduce(function(A,I){var R=D(I,["tfdt"])[0],y=R.data[R.start],v=D(I,["tfhd"]).reduce(function(m,S){var B=w(S,4),N=u[B];if(N){var M=w(R,4);y===1&&(M*=Math.pow(2,32),M+=w(R,8));var U=N.timescale||9e4,K=M/U;if(isFinite(K)&&(m===null||K<m))return K}return m},null);return v!==null&&isFinite(v)&&(A===null||v<A)?v:A},null)||0}function _(u,l){for(var A=0,I=0,R=0,y=D(u,["moof","traf"]),v=0;v<y.length;v++){var m=y[v],S=D(m,["tfhd"])[0],B=w(S,4),N=l[B];if(!!N){var M=N.default,U=w(S,0)|(M==null?void 0:M.flags),K=M==null?void 0:M.duration;U&8&&(U&2?K=w(S,12):K=w(S,8));for(var j=N.timescale||9e4,X=D(m,["trun"]),ie=0;ie<X.length;ie++){if(K){var se=w(X[ie],4);A=K*se}else A=d(X[ie]);N.type===P.ElementaryStreamTypes.VIDEO?I+=A/j:N.type===P.ElementaryStreamTypes.AUDIO&&(R+=A/j)}}}if(I===0&&R===0){var le=T(u);if(le!=null&&le.references)return le.references.reduce(function(ve,q){return ve+q.info.duration||0},0)}return I||R}function d(u){var l=w(u,0),A=8;l&1&&(A+=4),l&4&&(A+=4);for(var I=0,R=w(u,4),y=0;y<R;y++){if(l&256){var v=w(u,A);I+=v,A+=4}l&512&&(A+=4),l&1024&&(A+=4),l&2048&&(A+=4)}return I}function o(u,l,A){D(l,["moof","traf"]).forEach(function(I){D(I,["tfhd"]).forEach(function(R){var y=w(R,4),v=u[y];if(!!v){var m=v.timescale||9e4;D(I,["tfdt"]).forEach(function(S){var B=S.data[S.start],N=w(S,4);if(B===0)g(S,4,N-A*m);else{N*=Math.pow(2,32),N+=w(S,8),N-=A*m,N=Math.max(N,0);var M=Math.floor(N/(E+1)),U=Math.floor(N%(E+1));g(S,4,M),g(S,8,U)}})}})})}function s(u){var l={valid:null,remainder:null},A=D(u,["moof"]);if(A){if(A.length<2)return l.remainder=u,l}else return l;var I=A[A.length-1];return l.valid=Object(W.sliceUint8)(u,0,I.start-8),l.remainder=Object(W.sliceUint8)(u,I.start-8),l}function a(u,l){var A=new Uint8Array(u.length+l.length);return A.set(u),A.set(l,u.length),A}},"./src/utils/output-filter.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"default",function(){return W});var W=function(){function P(L,O){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=L,this.trackName=O}var E=P.prototype;return E.dispatchCue=function(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},E.newCue=function(O,b,w){(this.startTime===null||this.startTime>O)&&(this.startTime=O),this.endTime=b,this.screen=w,this.timelineController.createCaptionsTrack(this.trackName)},E.reset=function(){this.cueRanges=[]},P}()},"./src/utils/texttrack-utils.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"sendAddTrackEvent",function(){return P}),k.d(H,"addCueToTrack",function(){return E}),k.d(H,"clearCurrentCues",function(){return L}),k.d(H,"removeCuesInRange",function(){return O}),k.d(H,"getCuesInRange",function(){return w});var W=k("./src/utils/logger.ts");function P(g,D){var T;try{T=new Event("addtrack")}catch(f){T=document.createEvent("Event"),T.initEvent("addtrack",!1,!1)}T.track=g,D.dispatchEvent(T)}function E(g,D){var T=g.mode;if(T==="disabled"&&(g.mode="hidden"),g.cues&&!g.cues.getCueById(D.id))try{if(g.addCue(D),!g.cues.getCueById(D.id))throw new Error("addCue is failed for: "+D)}catch(p){W.logger.debug("[texttrack-utils]: "+p);var f=new self.TextTrackCue(D.startTime,D.endTime,D.text);f.id=D.id,g.addCue(f)}T==="disabled"&&(g.mode=T)}function L(g){var D=g.mode;if(D==="disabled"&&(g.mode="hidden"),g.cues)for(var T=g.cues.length;T--;)g.removeCue(g.cues[T]);D==="disabled"&&(g.mode=D)}function O(g,D,T){var f=g.mode;if(f==="disabled"&&(g.mode="hidden"),g.cues&&g.cues.length>0)for(var p=w(g.cues,D,T),_=0;_<p.length;_++)g.removeCue(p[_]);f==="disabled"&&(g.mode=f)}function b(g,D){if(D<g[0].startTime)return 0;var T=g.length-1;if(D>g[T].endTime)return-1;for(var f=0,p=T;f<=p;){var _=Math.floor((p+f)/2);if(D<g[_].startTime)p=_-1;else if(D>g[_].startTime&&f<T)f=_+1;else return _}return g[f].startTime-D<D-g[p].startTime?f:p}function w(g,D,T){var f=[],p=b(g,D);if(p>-1)for(var _=p,d=g.length;_<d;_++){var o=g[_];if(o.startTime>=D&&o.endTime<=T)f.push(o);else if(o.startTime>T)return f}return f}},"./src/utils/time-ranges.ts":function(he,H,k){"use strict";k.r(H);var W={toString:function(E){for(var L="",O=E.length,b=0;b<O;b++)L+="["+E.start(b).toFixed(3)+","+E.end(b).toFixed(3)+"]";return L}};H.default=W},"./src/utils/timescale-conversion.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"toTimescaleFromBase",function(){return P}),k.d(H,"toTimescaleFromScale",function(){return E}),k.d(H,"toMsFromMpegTsClock",function(){return L}),k.d(H,"toMpegTsClockFromTimescale",function(){return O});var W=9e4;function P(b,w,g,D){g===void 0&&(g=1),D===void 0&&(D=!1);var T=b*w*g;return D?Math.round(T):T}function E(b,w,g,D){return g===void 0&&(g=1),D===void 0&&(D=!1),P(b,w,1/g,D)}function L(b,w){return w===void 0&&(w=!1),P(b,1e3,1/W,w)}function O(b,w){return w===void 0&&(w=1),P(b,W,1/w)}},"./src/utils/typed-array.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"sliceUint8",function(){return W});function W(P,E,L){return Uint8Array.prototype.slice?P.slice(E,L):new Uint8Array(Array.prototype.slice.call(P,E,L))}},"./src/utils/vttcue.ts":function(he,H,k){"use strict";k.r(H),H.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var W=["","lr","rl"],P=["start","middle","end","left","right"];function E(g,D){if(typeof D!="string"||!Array.isArray(g))return!1;var T=D.toLowerCase();return~g.indexOf(T)?T:!1}function L(g){return E(W,g)}function O(g){return E(P,g)}function b(g){for(var D=arguments.length,T=new Array(D>1?D-1:0),f=1;f<D;f++)T[f-1]=arguments[f];for(var p=1;p<arguments.length;p++){var _=arguments[p];for(var d in _)g[d]=_[d]}return g}function w(g,D,T){var f=this,p={enumerable:!0};f.hasBeenReset=!1;var _="",d=!1,o=g,s=D,a=T,u=null,l="",A=!0,I="auto",R="start",y=50,v="middle",m=50,S="middle";Object.defineProperty(f,"id",b({},p,{get:function(){return _},set:function(N){_=""+N}})),Object.defineProperty(f,"pauseOnExit",b({},p,{get:function(){return d},set:function(N){d=!!N}})),Object.defineProperty(f,"startTime",b({},p,{get:function(){return o},set:function(N){if(typeof N!="number")throw new TypeError("Start time must be set to a number.");o=N,this.hasBeenReset=!0}})),Object.defineProperty(f,"endTime",b({},p,{get:function(){return s},set:function(N){if(typeof N!="number")throw new TypeError("End time must be set to a number.");s=N,this.hasBeenReset=!0}})),Object.defineProperty(f,"text",b({},p,{get:function(){return a},set:function(N){a=""+N,this.hasBeenReset=!0}})),Object.defineProperty(f,"region",b({},p,{get:function(){return u},set:function(N){u=N,this.hasBeenReset=!0}})),Object.defineProperty(f,"vertical",b({},p,{get:function(){return l},set:function(N){var M=L(N);if(M===!1)throw new SyntaxError("An invalid or illegal string was specified.");l=M,this.hasBeenReset=!0}})),Object.defineProperty(f,"snapToLines",b({},p,{get:function(){return A},set:function(N){A=!!N,this.hasBeenReset=!0}})),Object.defineProperty(f,"line",b({},p,{get:function(){return I},set:function(N){if(typeof N!="number"&&N!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");I=N,this.hasBeenReset=!0}})),Object.defineProperty(f,"lineAlign",b({},p,{get:function(){return R},set:function(N){var M=O(N);if(!M)throw new SyntaxError("An invalid or illegal string was specified.");R=M,this.hasBeenReset=!0}})),Object.defineProperty(f,"position",b({},p,{get:function(){return y},set:function(N){if(N<0||N>100)throw new Error("Position must be between 0 and 100.");y=N,this.hasBeenReset=!0}})),Object.defineProperty(f,"positionAlign",b({},p,{get:function(){return v},set:function(N){var M=O(N);if(!M)throw new SyntaxError("An invalid or illegal string was specified.");v=M,this.hasBeenReset=!0}})),Object.defineProperty(f,"size",b({},p,{get:function(){return m},set:function(N){if(N<0||N>100)throw new Error("Size must be between 0 and 100.");m=N,this.hasBeenReset=!0}})),Object.defineProperty(f,"align",b({},p,{get:function(){return S},set:function(N){var M=O(N);if(!M)throw new SyntaxError("An invalid or illegal string was specified.");S=M,this.hasBeenReset=!0}})),f.displayState=void 0}return w.prototype.getCueAsHTML=function(){var g=self.WebVTT;return g.convertCueToDOMTree(self,this.text)},w}()},"./src/utils/vttparser.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"parseTimeStamp",function(){return E}),k.d(H,"fixLineBreaks",function(){return D}),k.d(H,"VTTParser",function(){return T});var W=k("./src/utils/vttcue.ts"),P=function(){function f(){}var p=f.prototype;return p.decode=function(d,o){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},f}();function E(f){function p(d,o,s,a){return(d|0)*3600+(o|0)*60+(s|0)+parseFloat(a||0)}var _=f.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return _?parseFloat(_[2])>59?p(_[2],_[3],0,_[4]):p(_[1],_[2],_[3],_[4]):null}var L=function(){function f(){this.values=Object.create(null)}var p=f.prototype;return p.set=function(d,o){!this.get(d)&&o!==""&&(this.values[d]=o)},p.get=function(d,o,s){return s?this.has(d)?this.values[d]:o[s]:this.has(d)?this.values[d]:o},p.has=function(d){return d in this.values},p.alt=function(d,o,s){for(var a=0;a<s.length;++a)if(o===s[a]){this.set(d,o);break}},p.integer=function(d,o){/^-?\d+$/.test(o)&&this.set(d,parseInt(o,10))},p.percent=function(d,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var s=parseFloat(o);if(s>=0&&s<=100)return this.set(d,s),!0}return!1},f}();function O(f,p,_,d){var o=d?f.split(d):[f];for(var s in o)if(typeof o[s]=="string"){var a=o[s].split(_);if(a.length===2){var u=a[0],l=a[1];p(u,l)}}}var b=new W.default(0,0,""),w=b.align==="middle"?"middle":"center";function g(f,p,_){var d=f;function o(){var u=E(f);if(u===null)throw new Error("Malformed timestamp: "+d);return f=f.replace(/^[^\sa-zA-Z-]+/,""),u}function s(u,l){var A=new L;O(u,function(y,v){var m;switch(y){case"region":for(var S=_.length-1;S>=0;S--)if(_[S].id===v){A.set(y,_[S].region);break}break;case"vertical":A.alt(y,v,["rl","lr"]);break;case"line":m=v.split(","),A.integer(y,m[0]),A.percent(y,m[0])&&A.set("snapToLines",!1),A.alt(y,m[0],["auto"]),m.length===2&&A.alt("lineAlign",m[1],["start",w,"end"]);break;case"position":m=v.split(","),A.percent(y,m[0]),m.length===2&&A.alt("positionAlign",m[1],["start",w,"end","line-left","line-right","auto"]);break;case"size":A.percent(y,v);break;case"align":A.alt(y,v,["start",w,"end","left","right"]);break}},/:/,/\s/),l.region=A.get("region",null),l.vertical=A.get("vertical","");var I=A.get("line","auto");I==="auto"&&b.line===-1&&(I=-1),l.line=I,l.lineAlign=A.get("lineAlign","start"),l.snapToLines=A.get("snapToLines",!0),l.size=A.get("size",100),l.align=A.get("align",w);var R=A.get("position","auto");R==="auto"&&b.position===50&&(R=l.align==="start"||l.align==="left"?0:l.align==="end"||l.align==="right"?100:50),l.position=R}function a(){f=f.replace(/^\s+/,"")}if(a(),p.startTime=o(),a(),f.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);f=f.substr(3),a(),p.endTime=o(),a(),s(f,p)}function D(f){return f.replace(/<br(?: \/)?>/gi,`
156
- `)}var T=function(){function f(){this.state="INITIAL",this.buffer="",this.decoder=new P,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var p=f.prototype;return p.parse=function(d){var o=this;d&&(o.buffer+=o.decoder.decode(d,{stream:!0}));function s(){var R=o.buffer,y=0;for(R=D(R);y<R.length&&R[y]!=="\r"&&R[y]!==`
157
- `;)++y;var v=R.substr(0,y);return R[y]==="\r"&&++y,R[y]===`
158
- `&&++y,o.buffer=R.substr(y),v}function a(R){O(R,function(y,v){},/:/)}try{var u="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;u=s();var l=u.match(/^()?WEBVTT([ \t].*)?$/);if(!l||!l[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var A=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;switch(A?A=!1:u=s(),o.state){case"HEADER":/:/.test(u)?a(u):u||(o.state="ID");continue;case"NOTE":u||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(u)){o.state="NOTE";break}if(!u)continue;if(o.cue=new W.default(0,0,""),o.state="CUE",u.indexOf("-->")===-1){o.cue.id=u;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{g(u,o.cue,o.regionList)}catch(R){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var I=u.indexOf("-->")!==-1;if(!u||I&&(A=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
159
- `),o.cue.text+=u}continue;case"BADCUE":u||(o.state="ID")}}}catch(R){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},p.flush=function(){var d=this;try{if((d.cue||d.state==="HEADER")&&(d.buffer+=`
160
-
161
- `,d.parse()),d.state==="INITIAL"||d.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){d.onparsingerror&&d.onparsingerror(o)}return d.onflush&&d.onflush(),this},f}()},"./src/utils/webvtt-parser.ts":function(he,H,k){"use strict";k.r(H),k.d(H,"generateCueId",function(){return T}),k.d(H,"parseWebVTT",function(){return p});var W=k("./src/polyfills/number.ts"),P=k("./src/utils/vttparser.ts"),E=k("./src/demux/id3.ts"),L=k("./src/utils/timescale-conversion.ts"),O=k("./src/remux/mp4-remuxer.ts"),b=/\r\n|\n\r|\n|\r/g,w=function(d,o,s){return s===void 0&&(s=0),d.substr(s,o.length)===o},g=function(d){var o=parseInt(d.substr(-3)),s=parseInt(d.substr(-6,2)),a=parseInt(d.substr(-9,2)),u=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(W.isFiniteNumber)(o)||!Object(W.isFiniteNumber)(s)||!Object(W.isFiniteNumber)(a)||!Object(W.isFiniteNumber)(u))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return o+=1e3*s,o+=60*1e3*a,o+=60*60*1e3*u,o},D=function(d){for(var o=5381,s=d.length;s;)o=o*33^d.charCodeAt(--s);return(o>>>0).toString()};function T(_,d,o){return D(_.toString())+D(d.toString())+D(o)}var f=function(d,o,s){var a=d[o],u=d[a.prevCC];if(!u||!u.new&&a.new){d.ccOffset=d.presentationOffset=a.start,a.new=!1;return}for(;(l=u)!==null&&l!==void 0&&l.new;){var l;d.ccOffset+=a.start-u.start,a.new=!1,a=u,u=d[a.prevCC]}d.presentationOffset=s};function p(_,d,o,s,a,u,l,A){var I=new P.VTTParser,R=Object(E.utf8ArrayToStr)(new Uint8Array(_)).trim().replace(b,`
162
- `).split(`
163
- `),y=[],v=Object(L.toMpegTsClockFromTimescale)(d,o),m="00:00.000",S=0,B=0,N,M=!0,U=!1;I.oncue=function(K){var j=s[a],X=s.ccOffset,ie=(S-v)/9e4;if(j!=null&&j.new&&(B!==void 0?X=s.ccOffset=j.start:f(s,a,ie)),ie&&(X=ie-s.presentationOffset),U){var se=K.endTime-K.startTime,le=Object(O.normalizePts)((K.startTime+X-B)*9e4,u*9e4)/9e4;K.startTime=le,K.endTime=le+se}var ve=K.text.trim();K.text=decodeURIComponent(encodeURIComponent(ve)),K.id||(K.id=T(K.startTime,K.endTime,ve)),K.endTime>0&&y.push(K)},I.onparsingerror=function(K){N=K},I.onflush=function(){if(N){A(N);return}l(y)},R.forEach(function(K){if(M)if(w(K,"X-TIMESTAMP-MAP=")){M=!1,U=!0,K.substr(16).split(",").forEach(function(j){w(j,"LOCAL:")?m=j.substr(6):w(j,"MPEGTS:")&&(S=parseInt(j.substr(7)))});try{B=g(m)/1e3}catch(j){U=!1,N=j}return}else K===""&&(M=!1);I.parse(K+`
164
- `)}),I.flush()}},"./src/utils/xhr-loader.ts":function(he,H,k){"use strict";k.r(H);var W=k("./src/utils/logger.ts"),P=k("./src/loader/load-stats.ts"),E=/^age:\s*[\d.]+\s*$/m,L=function(){function O(w){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=w?w.xhrSetup:null,this.stats=new P.LoadStats,this.retryDelay=0}var b=O.prototype;return b.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},b.abortInternal=function(){var g=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),g&&(g.onreadystatechange=null,g.onprogress=null,g.readyState!==4&&(this.stats.aborted=!0,g.abort()))},b.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},b.load=function(g,D,T){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=g,this.config=D,this.callbacks=T,this.retryDelay=D.retryDelay,this.loadInternal()},b.loadInternal=function(){var g=this.config,D=this.context;if(!!g){var T=this.loader=new self.XMLHttpRequest,f=this.stats;f.loading.first=0,f.loaded=0;var p=this.xhrSetup;try{if(p)try{p(T,D.url)}catch(o){T.open("GET",D.url,!0),p(T,D.url)}T.readyState||T.open("GET",D.url,!0);var _=this.context.headers;if(_)for(var d in _)T.setRequestHeader(d,_[d])}catch(o){this.callbacks.onError({code:T.status,text:o.message},D,T);return}D.rangeEnd&&T.setRequestHeader("Range","bytes="+D.rangeStart+"-"+(D.rangeEnd-1)),T.onreadystatechange=this.readystatechange.bind(this),T.onprogress=this.loadprogress.bind(this),T.responseType=D.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),g.timeout),T.send()}},b.readystatechange=function(){var g=this.context,D=this.loader,T=this.stats;if(!(!g||!D)){var f=D.readyState,p=this.config;if(!T.aborted&&f>=2)if(self.clearTimeout(this.requestTimeout),T.loading.first===0&&(T.loading.first=Math.max(self.performance.now(),T.loading.start)),f===4){D.onreadystatechange=null,D.onprogress=null;var _=D.status;if(_>=200&&_<300){T.loading.end=Math.max(self.performance.now(),T.loading.first);var d,o;if(g.responseType==="arraybuffer"?(d=D.response,o=d.byteLength):(d=D.responseText,o=d.length),T.loaded=T.total=o,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(T,g,d,D),!this.callbacks)return;var a={url:D.responseURL,data:d};this.callbacks.onSuccess(a,T,g,D)}else T.retry>=p.maxRetry||_>=400&&_<499?(W.logger.error(_+" while loading "+g.url),this.callbacks.onError({code:_,text:D.statusText},g,D)):(W.logger.warn(_+" while loading "+g.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,p.maxRetryDelay),T.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),p.timeout)}},b.loadtimeout=function(){W.logger.warn("timeout while loading "+this.context.url);var g=this.callbacks;g&&(this.abortInternal(),g.onTimeout(this.stats,this.context,this.loader))},b.loadprogress=function(g){var D=this.stats;D.loaded=g.loaded,g.lengthComputable&&(D.total=g.total)},b.getCacheAge=function(){var g=null;if(this.loader&&E.test(this.loader.getAllResponseHeaders())){var D=this.loader.getResponseHeader("age");g=D?parseFloat(D):null}return g},O}();H.default=L}}).default})},45386:(Oe,he,H)=>{var k=H(96738),W=H(52842),P=H(52482);function E(L){var O=-1,b=L==null?0:L.length;for(this.__data__=new k;++O<b;)this.add(L[O])}E.prototype.add=E.prototype.push=W,E.prototype.has=P,Oe.exports=E},87064:Oe=>{function he(H,k){for(var W=-1,P=H==null?0:H.length;++W<P;)if(k(H[W],W,H))return!0;return!1}Oe.exports=he},50217:Oe=>{function he(H){return H.split("")}Oe.exports=he},2229:(Oe,he,H)=>{var k=H(4795);function W(P,E,L){for(var O=-1,b=P.length;++O<b;){var w=P[O],g=E(w);if(g!=null&&(D===void 0?g===g&&!k(g):L(g,D)))var D=g,T=w}return T}Oe.exports=W},84134:Oe=>{function he(H,k){return H>k}Oe.exports=he},20187:Oe=>{function he(H,k){return H!=null&&k in Object(H)}Oe.exports=he},88746:(Oe,he,H)=>{var k=H(51952),W=H(15125);function P(E,L,O,b,w){return E===L?!0:E==null||L==null||!W(E)&&!W(L)?E!==E&&L!==L:k(E,L,O,b,P,w)}Oe.exports=P},51952:(Oe,he,H)=>{var k=H(86571),W=H(74871),P=H(11491),E=H(5184),L=H(70940),O=H(86152),b=H(73226),w=H(77598),g=1,D="[object Arguments]",T="[object Array]",f="[object Object]",p=Object.prototype,_=p.hasOwnProperty;function d(o,s,a,u,l,A){var I=O(o),R=O(s),y=I?T:L(o),v=R?T:L(s);y=y==D?f:y,v=v==D?f:v;var m=y==f,S=v==f,B=y==v;if(B&&b(o)){if(!b(s))return!1;I=!0,m=!1}if(B&&!m)return A||(A=new k),I||w(o)?W(o,s,a,u,l,A):P(o,s,y,a,u,l,A);if(!(a&g)){var N=m&&_.call(o,"__wrapped__"),M=S&&_.call(s,"__wrapped__");if(N||M){var U=N?o.value():o,K=M?s.value():s;return A||(A=new k),l(U,K,a,u,A)}}return B?(A||(A=new k),E(o,s,a,u,l,A)):!1}Oe.exports=d},37036:(Oe,he,H)=>{var k=H(86571),W=H(88746),P=1,E=2;function L(O,b,w,g){var D=w.length,T=D,f=!g;if(O==null)return!T;for(O=Object(O);D--;){var p=w[D];if(f&&p[2]?p[1]!==O[p[0]]:!(p[0]in O))return!1}for(;++D<T;){p=w[D];var _=p[0],d=O[_],o=p[1];if(f&&p[2]){if(d===void 0&&!(_ in O))return!1}else{var s=new k;if(g)var a=g(d,o,_,O,b,s);if(!(a===void 0?W(o,d,P|E,g,s):a))return!1}}return!0}Oe.exports=L},68286:(Oe,he,H)=>{var k=H(26423),W=H(74716),P=H(23059),E=H(86152),L=H(65798);function O(b){return typeof b=="function"?b:b==null?P:typeof b=="object"?E(b)?W(b[0],b[1]):k(b):L(b)}Oe.exports=O},59355:Oe=>{function he(H,k){return H<k}Oe.exports=he},26423:(Oe,he,H)=>{var k=H(37036),W=H(49882),P=H(73477);function E(L){var O=W(L);return O.length==1&&O[0][2]?P(O[0][0],O[0][1]):function(b){return b===L||k(b,L,O)}}Oe.exports=E},74716:(Oe,he,H)=>{var k=H(88746),W=H(72579),P=H(95041),E=H(21401),L=H(28792),O=H(73477),b=H(33812),w=1,g=2;function D(T,f){return E(T)&&L(f)?O(b(T),f):function(p){var _=W(p,T);return _===void 0&&_===f?P(p,T):k(f,_,w|g)}}Oe.exports=D},92602:(Oe,he,H)=>{var k=H(93759),W=H(95041);function P(E,L){return k(E,L,function(O,b){return W(E,b)})}Oe.exports=P},93759:(Oe,he,H)=>{var k=H(13324),W=H(82857),P=H(17297);function E(L,O,b){for(var w=-1,g=O.length,D={};++w<g;){var T=O[w],f=k(L,T);b(f,T)&&W(D,P(T,L),f)}return D}Oe.exports=E},20256:Oe=>{function he(H){return function(k){return k==null?void 0:k[H]}}Oe.exports=he},82952:(Oe,he,H)=>{var k=H(13324);function W(P){return function(E){return k(E,P)}}Oe.exports=W},62676:(Oe,he,H)=>{var k=H(29078),W=H(39045),P=Array.prototype,E=P.splice;function L(O,b){for(var w=O?b.length:0,g=w-1;w--;){var D=b[w];if(w==g||D!==T){var T=D;W(D)?E.call(O,D,1):k(O,D)}}return O}Oe.exports=L},82857:(Oe,he,H)=>{var k=H(60091),W=H(17297),P=H(39045),E=H(29259),L=H(33812);function O(b,w,g,D){if(!E(b))return b;w=W(w,b);for(var T=-1,f=w.length,p=f-1,_=b;_!=null&&++T<f;){var d=L(w[T]),o=g;if(d==="__proto__"||d==="constructor"||d==="prototype")return b;if(T!=p){var s=_[d];o=D?D(s,d,_):void 0,o===void 0&&(o=E(s)?s:P(w[T+1])?[]:{})}k(_,d,o),_=_[d]}return b}Oe.exports=O},59950:Oe=>{function he(H,k){return H.has(k)}Oe.exports=he},23895:(Oe,he,H)=>{var k=H(39872);function W(P,E,L){var O=P.length;return L=L===void 0?O:L,!E&&L>=O?P:k(P,E,L)}Oe.exports=W},83126:(Oe,he,H)=>{var k=H(23895),W=H(33880),P=H(8435),E=H(66188);function L(O){return function(b){b=E(b);var w=W(b)?P(b):void 0,g=w?w[0]:b.charAt(0),D=w?k(w,1).join(""):b.slice(1);return g[O]()+D}}Oe.exports=L},74871:(Oe,he,H)=>{var k=H(45386),W=H(87064),P=H(59950),E=1,L=2;function O(b,w,g,D,T,f){var p=g&E,_=b.length,d=w.length;if(_!=d&&!(p&&d>_))return!1;var o=f.get(b),s=f.get(w);if(o&&s)return o==w&&s==b;var a=-1,u=!0,l=g&L?new k:void 0;for(f.set(b,w),f.set(w,b);++a<_;){var A=b[a],I=w[a];if(D)var R=p?D(I,A,a,w,b,f):D(A,I,a,b,w,f);if(R!==void 0){if(R)continue;u=!1;break}if(l){if(!W(w,function(y,v){if(!P(l,v)&&(A===y||T(A,y,g,D,f)))return l.push(v)})){u=!1;break}}else if(!(A===I||T(A,I,g,D,f))){u=!1;break}}return f.delete(b),f.delete(w),u}Oe.exports=O},11491:(Oe,he,H)=>{var k=H(50857),W=H(79162),P=H(41225),E=H(74871),L=H(75179),O=H(16909),b=1,w=2,g="[object Boolean]",D="[object Date]",T="[object Error]",f="[object Map]",p="[object Number]",_="[object RegExp]",d="[object Set]",o="[object String]",s="[object Symbol]",a="[object ArrayBuffer]",u="[object DataView]",l=k?k.prototype:void 0,A=l?l.valueOf:void 0;function I(R,y,v,m,S,B,N){switch(v){case u:if(R.byteLength!=y.byteLength||R.byteOffset!=y.byteOffset)return!1;R=R.buffer,y=y.buffer;case a:return!(R.byteLength!=y.byteLength||!B(new W(R),new W(y)));case g:case D:case p:return P(+R,+y);case T:return R.name==y.name&&R.message==y.message;case _:case o:return R==y+"";case f:var M=L;case d:var U=m&b;if(M||(M=O),R.size!=y.size&&!U)return!1;var K=N.get(R);if(K)return K==y;m|=w,N.set(R,y);var j=E(M(R),M(y),m,S,B,N);return N.delete(R),j;case s:if(A)return A.call(R)==A.call(y)}return!1}Oe.exports=I},5184:(Oe,he,H)=>{var k=H(13483),W=1,P=Object.prototype,E=P.hasOwnProperty;function L(O,b,w,g,D,T){var f=w&W,p=k(O),_=p.length,d=k(b),o=d.length;if(_!=o&&!f)return!1;for(var s=_;s--;){var a=p[s];if(!(f?a in b:E.call(b,a)))return!1}var u=T.get(O),l=T.get(b);if(u&&l)return u==b&&l==O;var A=!0;T.set(O,b),T.set(b,O);for(var I=f;++s<_;){a=p[s];var R=O[a],y=b[a];if(g)var v=f?g(y,R,a,b,O,T):g(R,y,a,O,b,T);if(!(v===void 0?R===y||D(R,y,w,g,T):v)){A=!1;break}I||(I=a=="constructor")}if(A&&!I){var m=O.constructor,S=b.constructor;m!=S&&"constructor"in O&&"constructor"in b&&!(typeof m=="function"&&m instanceof m&&typeof S=="function"&&S instanceof S)&&(A=!1)}return T.delete(O),T.delete(b),A}Oe.exports=L},49882:(Oe,he,H)=>{var k=H(28792),W=H(90249);function P(E){for(var L=W(E),O=L.length;O--;){var b=L[O],w=E[b];L[O]=[b,w,k(w)]}return L}Oe.exports=P},1369:(Oe,he,H)=>{var k=H(17297),W=H(79631),P=H(86152),E=H(39045),L=H(61158),O=H(33812);function b(w,g,D){g=k(g,w);for(var T=-1,f=g.length,p=!1;++T<f;){var _=O(g[T]);if(!(p=w!=null&&D(w,_)))break;w=w[_]}return p||++T!=f?p:(f=w==null?0:w.length,!!f&&L(f)&&E(_,f)&&(P(w)||W(w)))}Oe.exports=b},33880:Oe=>{var he="\\ud800-\\udfff",H="\\u0300-\\u036f",k="\\ufe20-\\ufe2f",W="\\u20d0-\\u20ff",P=H+k+W,E="\\ufe0e\\ufe0f",L="\\u200d",O=RegExp("["+L+he+P+E+"]");function b(w){return O.test(w)}Oe.exports=b},28792:(Oe,he,H)=>{var k=H(29259);function W(P){return P===P&&!k(P)}Oe.exports=W},75179:Oe=>{function he(H){var k=-1,W=Array(H.size);return H.forEach(function(P,E){W[++k]=[E,P]}),W}Oe.exports=he},73477:Oe=>{function he(H,k){return function(W){return W==null?!1:W[H]===k&&(k!==void 0||H in Object(W))}}Oe.exports=he},52842:Oe=>{var he="__lodash_hash_undefined__";function H(k){return this.__data__.set(k,he),this}Oe.exports=H},52482:Oe=>{function he(H){return this.__data__.has(H)}Oe.exports=he},16909:Oe=>{function he(H){var k=-1,W=Array(H.size);return H.forEach(function(P){W[++k]=P}),W}Oe.exports=he},8435:(Oe,he,H)=>{var k=H(50217),W=H(33880),P=H(63344);function E(L){return W(L)?P(L):k(L)}Oe.exports=E},63344:Oe=>{var he="\\ud800-\\udfff",H="\\u0300-\\u036f",k="\\ufe20-\\ufe2f",W="\\u20d0-\\u20ff",P=H+k+W,E="\\ufe0e\\ufe0f",L="["+he+"]",O="["+P+"]",b="\\ud83c[\\udffb-\\udfff]",w="(?:"+O+"|"+b+")",g="[^"+he+"]",D="(?:\\ud83c[\\udde6-\\uddff]){2}",T="[\\ud800-\\udbff][\\udc00-\\udfff]",f="\\u200d",p=w+"?",_="["+E+"]?",d="(?:"+f+"(?:"+[g,D,T].join("|")+")"+_+p+")*",o=_+p+d,s="(?:"+[g+O+"?",O,D,T,L].join("|")+")",a=RegExp(b+"(?="+b+")|"+s+o,"g");function u(l){return l.match(a)||[]}Oe.exports=u},82108:(Oe,he,H)=>{var k=H(66188),W=H(23779);function P(E){return W(k(E).toLowerCase())}Oe.exports=P},72579:(Oe,he,H)=>{var k=H(13324);function W(P,E,L){var O=P==null?void 0:k(P,E);return O===void 0?L:O}Oe.exports=W},95041:(Oe,he,H)=>{var k=H(20187),W=H(1369);function P(E,L){return E!=null&&W(E,L,k)}Oe.exports=P},1842:Oe=>{function he(H){return H==null}Oe.exports=he},84336:Oe=>{function he(H){return H===void 0}Oe.exports=he},55324:(Oe,he,H)=>{var k=H(2229),W=H(84134),P=H(68286);function E(L,O){return L&&L.length?k(L,P(O,2),W):void 0}Oe.exports=E},10937:(Oe,he,H)=>{var k=H(2229),W=H(68286),P=H(59355);function E(L,O){return L&&L.length?k(L,W(O,2),P):void 0}Oe.exports=E},13888:(Oe,he,H)=>{var k=H(92602),W=H(29097),P=W(function(E,L){return E==null?{}:k(E,L)});Oe.exports=P},65798:(Oe,he,H)=>{var k=H(20256),W=H(82952),P=H(21401),E=H(33812);function L(O){return P(O)?k(E(O)):W(O)}Oe.exports=L},64116:(Oe,he,H)=>{var k=H(68286),W=H(62676);function P(E,L){var O=[];if(!(E&&E.length))return O;var b=-1,w=[],g=E.length;for(L=k(L,3);++b<g;){var D=E[b];L(D,b,E)&&(O.push(D),w.push(b))}return W(E,w),O}Oe.exports=P},74930:(Oe,he,H)=>{var k=H(66188),W=0;function P(E){var L=++W;return k(E)+L}Oe.exports=P},23779:(Oe,he,H)=>{var k=H(83126),W=k("toUpperCase");Oe.exports=W},79640:function(Oe,he,H){var k,W;(function(P,E){"use strict";k=E,W=typeof k=="function"?k.call(he,H,he,Oe):k,W!==void 0&&(Oe.exports=W)})(this,function(){"use strict";var P=function(){},E="undefined",L=typeof window!==E&&typeof window.navigator!==E&&/Trident\/|MSIE /.test(window.navigator.userAgent),O=["trace","debug","info","warn","error"];function b(s,a){var u=s[a];if(typeof u.bind=="function")return u.bind(s);try{return Function.prototype.bind.call(u,s)}catch(l){return function(){return Function.prototype.apply.apply(u,[s,arguments])}}}function w(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function g(s){return s==="debug"&&(s="log"),typeof console===E?!1:s==="trace"&&L?w:console[s]!==void 0?b(console,s):console.log!==void 0?b(console,"log"):P}function D(s,a){for(var u=0;u<O.length;u++){var l=O[u];this[l]=u<s?P:this.methodFactory(l,s,a)}this.log=this.debug}function T(s,a,u){return function(){typeof console!==E&&(D.call(this,a,u),this[s].apply(this,arguments))}}function f(s,a,u){return g(s)||T.apply(this,arguments)}function p(s,a,u){var l=this,A;a=a==null?"WARN":a;var I="loglevel";typeof s=="string"?I+=":"+s:typeof s=="symbol"&&(I=void 0);function R(S){var B=(O[S]||"silent").toUpperCase();if(!(typeof window===E||!I)){try{window.localStorage[I]=B;return}catch(N){}try{window.document.cookie=encodeURIComponent(I)+"="+B+";"}catch(N){}}}function y(){var S;if(!(typeof window===E||!I)){try{S=window.localStorage[I]}catch(M){}if(typeof S===E)try{var B=window.document.cookie,N=B.indexOf(encodeURIComponent(I)+"=");N!==-1&&(S=/^([^;]+)/.exec(B.slice(N))[1])}catch(M){}return l.levels[S]===void 0&&(S=void 0),S}}function v(){if(!(typeof window===E||!I)){try{window.localStorage.removeItem(I);return}catch(S){}try{window.document.cookie=encodeURIComponent(I)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(S){}}}l.name=s,l.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},l.methodFactory=u||f,l.getLevel=function(){return A},l.setLevel=function(S,B){if(typeof S=="string"&&l.levels[S.toUpperCase()]!==void 0&&(S=l.levels[S.toUpperCase()]),typeof S=="number"&&S>=0&&S<=l.levels.SILENT){if(A=S,B!==!1&&R(S),D.call(l,S,s),typeof console===E&&S<l.levels.SILENT)return"No console available for logging"}else throw"log.setLevel() called with invalid level: "+S},l.setDefaultLevel=function(S){a=S,y()||l.setLevel(S,!1)},l.resetLevel=function(){l.setLevel(a,!1),v()},l.enableAll=function(S){l.setLevel(l.levels.TRACE,S)},l.disableAll=function(S){l.setLevel(l.levels.SILENT,S)};var m=y();m==null&&(m=a),l.setLevel(m,!1)}var _=new p,d={};_.getLogger=function(a){if(typeof a!="symbol"&&typeof a!="string"||a==="")throw new TypeError("You must supply a name when creating a logger.");var u=d[a];return u||(u=d[a]=new p(a,_.getLevel(),_.methodFactory)),u};var o=typeof window!==E?window.log:void 0;return _.noConflict=function(){return typeof window!==E&&window.log===_&&(window.log=o),_},_.getLoggers=function(){return d},_.default=_,_})},1442:(Oe,he,H)=>{"use strict";H.d(he,{Z:()=>Bl});var k=H(7896),W=H(31461),P=H(2784),E=H(13980),L=H.n(E),O=H(1842),b=H.n(O);const w=function(G){return G&&G.ownerDocument||document},g=function(G){return G===(G==null?void 0:G.window)?G:(G==null?void 0:G.nodeType)===9?(G==null?void 0:G.defaultView)||(G==null?void 0:G.parentWindow):null};var D=H(33014),T=function(Z,re){if(re)do if(re===Z)return!0;while(re=re.parentNode);return!1},f=function(Z,re){return Z.contains?Z.contains(re):Z.compareDocumentPosition?Z===re||!!(Z.compareDocumentPosition(re)&16):T(Z,re)};const p=function(){return D.Z?f:T}(),_=function(G){var Z=w(G),re=g(Z),ge=Z&&Z.documentElement,de={top:0,left:0,height:0,width:0};return Z?(p(ge,G)&&(G.getBoundingClientRect!==void 0&&(de=G.getBoundingClientRect()),(de.width||de.height)&&ge&&re&&(de={top:de.top+(re.pageYOffset||ge.scrollTop)-(ge.clientTop||0),left:de.left+(re.pageXOffset||ge.scrollLeft)-(ge.clientLeft||0),width:(de.width===null?G.offsetWidth:de.width)||0,height:(de.height===null?G.offsetHeight:de.height)||0})),de):null};var d=H(85043),o=H(80383),s=H(53359),a=function(Z){return!Z||typeof Z=="function"?Z:function(re){Z.current=re}};function u(G,Z){var re=a(G),ge=a(Z);return function(de){typeof re=="function"&&re(de),typeof ge=="function"&&ge(de)}}var l=function(Z,re){var ge=_(Z),de=(re.pageX||0)-ge.left,Ie=(re.pageY||0)-ge.top,Se=Math.max(ge.width-de,de),be=Math.max(ge.height-Ie,Ie),ke=Math.sqrt(Math.pow(Se,2)+Math.pow(be,2));return{width:ke*2,height:ke*2,left:de-ke,top:Ie-ke}},A=P.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?"span":re,de=G.className,Ie=G.classPrefix,Se=Ie===void 0?"ripple":Ie,be=G.onMouseDown,ke=(0,W.Z)(G,["as","className","classPrefix","onMouseDown"]),we=(0,s.Z)(Se),Le=we.merge,Be=we.prefix,He=we.withClassPrefix,je=Le(de,Be("pond")),qe=(0,P.useRef)(null),ze=(0,P.useState)(!1),rt=ze[0],We=ze[1],Ke=(0,P.useState)(),st=Ke[0],pt=Ke[1],Ct=function(){We(!1)},$e=(0,P.useCallback)(function(lt){var mt=l(qe.current,lt);We(!0),pt(mt),be==null||be(mt,lt)},[be]);return(0,P.useEffect)(function(){var lt=qe.current.parentNode,mt=(0,d.Z)(lt,"mousedown",$e);return function(){mt==null||mt.off()}},[$e]),P.createElement(ge,(0,k.Z)({},ke,{className:je,ref:u(qe,Z)}),P.createElement(o.ZP,{in:rt,enteringClassName:Be("rippling"),onEntered:Ct},function(lt,mt){var dt=lt.className,At=(0,W.Z)(lt,["className"]);return P.createElement("span",(0,k.Z)({},At,{ref:mt,className:Le(He(),dt),style:st}))}))});A.displayName="Ripple",A.propTypes={classPrefix:L().string,className:L().string,onMouseDown:L().func};const R=A;function y(G){return!G||G.trim()==="#"}var v=P.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?"a":re,de=G.href,Ie=G.disabled,Se=G.onClick,be=(0,W.Z)(G,["as","href","disabled","onClick"]),ke=(0,P.useCallback)(function(Le){if((Ie||y(de))&&Le.preventDefault(),Ie){Le.stopPropagation();return}Se==null||Se(Le)},[Ie,de,Se]),we=y(de)?{role:"button",href:"#"}:null;return Ie&&(be.tabIndex=-1,be["aria-disabled"]=!0),P.createElement(ge,(0,k.Z)({ref:Z,href:de},we,be,{onClick:ke}))});v.displayName="SafeAnchor",v.propTypes={href:L().string,disabled:L().bool,as:L().elementType};const S=v;var B=Object.prototype.hasOwnProperty;function N(G,Z){return G===Z?G!==0||Z!==0||1/G===1/Z:G!==G&&Z!==Z}function M(G,Z){if(N(G,Z))return!0;if(typeof G!="object"||G===null||typeof Z!="object"||Z===null)return!1;var re=Object.keys(G),ge=Object.keys(Z);if(re.length!==ge.length)return!1;for(var de=0;de<re.length;de+=1)if(!B.call(Z,re[de])||!N(G[re[de]],Z[re[de]]))return!1;return!0}const U=M;var K=H(64116),j=H.n(K),X=H(79857),ie=H.n(X);function se(G){var Z=G.name,re=G.componentAs,ge=G.componentClassPrefix,de=(0,W.Z)(G,["name","componentAs","componentClassPrefix"]),Ie=P.forwardRef(function(Se,be){var ke=Se.as,we=ke===void 0?re||"div":ke,Le=Se.classPrefix,Be=Le===void 0?ge||ie()(Z):Le,He=Se.className,je=Se.role,qe=(0,W.Z)(Se,["as","classPrefix","className","role"]),ze=(0,s.Z)(Be),rt=ze.withClassPrefix,We=ze.merge,Ke=We(He,rt());return P.createElement(we,(0,k.Z)({},de,qe,{role:je,ref:be,className:Ke}))});return Ie.displayName=Z,Ie.propTypes={as:L().elementType,className:L().string,classPrefix:L().string,children:L().node},Ie}const le=se;var ve=le({name:"SidenavBody"});const q=ve;var ee=le({name:"SidenavHeader"});const ae=ee;var _e=H(10541),fe=P.createContext(null);const Ge=fe;function Te(G,Z){return Array.isArray(Z)?Z.indexOf(G)>=0:G===Z}var Ue,Ze=P.forwardRef(function(G,Z){var re=G.as,ge=G.active,de=G.appearance,Ie=de===void 0?"default":de,Se=G.block,be=G.className,ke=G.children,we=G.classPrefix,Le=we===void 0?"btn":we,Be=G.color,He=G.disabled,je=G.loading,qe=G.ripple,ze=qe===void 0?!0:qe,rt=G.size,We=G.type,Ke=(0,W.Z)(G,["as","active","appearance","block","className","children","classPrefix","color","disabled","loading","ripple","size","type"]),st=(0,P.useContext)(Ge),pt=rt!=null?rt:st==null?void 0:st.size,Ct=(0,s.Z)(Le),$e=Ct.withClassPrefix,lt=Ct.prefix,mt=Ct.merge,dt=mt(be,$e(Ie,Be,pt,{active:ge,disabled:He,loading:je,block:Se})),At=ze&&!Te(Ie,["link","ghost"])?P.createElement(R,null):null,wt=P.createElement("span",{className:lt(Ue||(Ue=(0,_e.Z)(["spin"])))});if(Ke.href)return P.createElement(S,(0,k.Z)({},Ke,{as:re,ref:Z,"aria-disabled":He,disabled:He,className:dt}),je&&wt,ke,At);var Rt=re||"button",jt=We||(Rt==="button"?"button":void 0),or=Ke.role||(Rt!=="button"?"button":void 0);return P.createElement(Rt,(0,k.Z)({},Ke,{role:or,type:jt,ref:Z,disabled:He,"aria-disabled":He,className:dt}),je&&wt,ke,At)});Ze.displayName="Button",Ze.propTypes={as:L().elementType,active:L().bool,appearance:L().oneOf(["default","primary","link","subtle","ghost"]),block:L().bool,children:L().node,color:L().oneOf(["red","orange","yellow","green","cyan","blue","violet"]),disabled:L().bool,href:L().string,loading:L().bool,ripple:L().bool,size:L().oneOf(["lg","md","sm","xs"]),type:L().oneOf(["button","reset","submit"])};const Fe=Ze;var Ye=P.forwardRef(function(G,Z){var re=G.icon,ge=G.placement,de=ge===void 0?"left":ge,Ie=G.children,Se=G.circle,be=G.classPrefix,ke=be===void 0?"btn-icon":be,we=G.className,Le=(0,W.Z)(G,["icon","placement","children","circle","classPrefix","className"]),Be=(0,s.Z)(ke),He=Be.merge,je=Be.withClassPrefix,qe=He(we,je("placement-"+de,{circle:Se,"with-text":typeof Ie!="undefined"}));return P.createElement(Fe,(0,k.Z)({},Le,{ref:Z,className:qe}),re,Ie)});Ye.displayName="IconButton",Ye.propTypes={className:L().string,icon:L().any,classPrefix:L().string,circle:L().bool,children:L().node,placement:L().oneOf(["left","right"])};const Bt=Ye;var Ft=H(7582),Mt=H(41840),cr=P.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?"div":re,de=G.expanded,Ie=G.className,Se=G.classPrefix,be=Se===void 0?"sidenav-toggle":Se,ke=G.onToggle,we=(0,W.Z)(G,["as","expanded","className","classPrefix","onToggle"]),Le=(0,s.Z)(be),Be=Le.merge,He=Le.withClassPrefix,je=Be(Ie,He({collapsed:!de})),qe=de?Mt.Z:Ft.Z,ze=function(We){ke==null||ke(!de,We)};return P.createElement(ge,(0,k.Z)({},we,{ref:Z,className:je}),P.createElement(Bt,{appearance:"default",icon:P.createElement(qe,null),onClick:ze}))});cr.displayName="SidenavToggle",cr.propTypes={classPrefix:L().string,className:L().string,expanded:L().bool,onToggle:L().func};const sr=cr;function br(G,Z){var re=(0,P.useRef)(!1);re.current=G!==void 0;var ge=(0,P.useState)(Z),de=ge[0],Ie=ge[1],Se=re.current?G:de,be=(0,P.useCallback)(function(ke){re.current||Ie(ke)},[re]);return[Se,be,re.current]}const hi=br;var Mr={};function Hr(G,Z){return function(ge,de,Ie){if(ge[de]!=null){var Se='"'+de+'" property of "'+Ie+`" has been deprecated.
165
- `+Z;Mr[Se]||(console.warn(Se),Mr[Se]=!0)}for(var be=arguments.length,ke=new Array(be>3?be-3:0),we=3;we<be;we++)ke[we-3]=arguments[we];return G.apply(void 0,[ge,de,Ie].concat(ke))}}function pi(){Mr={}}Hr._resetWarned=pi;var si=P.createContext(null),bi=[],oi=P.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?"nav":re,de=G.className,Ie=G.classPrefix,Se=Ie===void 0?"sidenav":Ie,be=G.appearance,ke=be===void 0?"default":be,we=G.expanded,Le=we===void 0?!0:we,Be=G.activeKey,He=Be===void 0?null:Be,je=G.defaultOpenKeys,qe=je===void 0?bi:je,ze=G.openKeys,rt=G.onSelect,We=G.onOpenChange,Ke=(0,W.Z)(G,["as","className","classPrefix","appearance","expanded","activeKey","defaultOpenKeys","openKeys","onSelect","onOpenChange"]),st=hi(ze,qe),pt=st[0],Ct=st[1],$e=(0,s.Z)(Se),lt=$e.prefix,mt=$e.merge,dt=$e.withClassPrefix,At=mt(de,dt(ke)),wt=(0,P.useCallback)(function(jt,or){var Xt=function(ur){return U(ur,jt)},hr=[].concat(pt);hr.some(Xt)?j()(hr,Xt):hr.push(jt),Ct(hr),We==null||We(hr,or)},[We,pt,Ct]),Rt=(0,P.useMemo)(function(){return{expanded:Le,activeKey:He,sidenav:!0,openKeys:pt!=null?pt:[],onOpenChange:wt,onSelect:rt}},[He,Le,wt,rt,pt]);return P.createElement(si.Provider,{value:Rt},P.createElement(o.ZP,{in:Le,timeout:300,exitedClassName:lt("collapse-out"),exitingClassName:lt("collapse-out","collapsing"),enteredClassName:lt("collapse-in"),enteringClassName:lt("collapse-in","collapsing")},function(jt,or){var Xt=jt.className,hr=(0,W.Z)(jt,["className"]);return P.createElement(ge,(0,k.Z)({},Ke,hr,{ref:u(Z,or),className:mt(At,Xt)}))}))});oi.Header=ae,oi.Body=q,oi.Toggle=sr,oi.displayName="Sidenav",oi.propTypes={as:L().elementType,classPrefix:L().string,className:L().string,expanded:L().bool,appearance:L().oneOf(["default","inverse","subtle"]),defaultOpenKeys:L().array,openKeys:L().array,onOpenChange:L().func,activeKey:Hr(L().any,"Use `activeKey` on <Nav> component instead"),onSelect:Hr(L().func,"Use `onSelect` on <Nav> component instead")};const Ci=null;var sn=H(34291),Zr=H.n(sn),Rr=P.createContext({withinNav:!1,activeKey:null,onSelect:Zr()});const Vr=Rr;function Lt(G,Z){var re,ge=(re=G.displayName)!==null&&re!==void 0?re:G.name,de=P.forwardRef(function(Ie,Se){return(0,P.useEffect)(function(){console.warn(Z)},[]),P.createElement(G,(0,k.Z)({ref:Se},Ie))});return de.displayName="deprecated("+ge+")",de}var $r=le({name:"NavbarBody"});const wn=Lt($r,"<Navbar.Body> has been deprecated, you should <Nav> as direct child of <Navbar>");var on=le({name:"NavbarHeader"});const wi=Lt(on,"<Navbar.Header> has been deprecated, use <Navbar.Brand> instead.");var pn=le({name:"NavbarBrand",componentAs:"a",componentClassPrefix:"navbar-brand"});const vn=pn;var Oi=P.createContext(!1),Ln=P.forwardRef(function(G,Z){var re=G.className,ge=G.as,de=ge===void 0?"nav":ge,Ie=G.classPrefix,Se=Ie===void 0?"navbar":Ie,be=G.appearance,ke=be===void 0?"default":be,we=(0,W.Z)(G,["className","as","classPrefix","appearance"]),Le=(0,s.Z)(Se),Be=Le.withClassPrefix,He=Le.merge,je=He(re,Be(ke));return P.createElement(Oi.Provider,{value:!0},P.createElement(de,(0,k.Z)({},we,{ref:Z,className:je})))});Ln.Header=wi,Ln.Body=wn,Ln.Brand=vn,Ln.displayName="Navbar";const Ds=null;var Dn=P.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?"div":re,de=G.className,Ie=G.classPrefix,Se=Ie===void 0?"tooltip":Ie,be=G.children,ke=G.style,we=G.visible,Le=(0,W.Z)(G,["as","className","classPrefix","children","style","visible"]),Be=(0,s.Z)(Se),He=Be.merge,je=Be.withClassPrefix,qe=He(de,je()),ze=(0,k.Z)({opacity:we?1:void 0},ke);return P.createElement(ge,(0,k.Z)({role:"tooltip"},Le,{ref:Z,className:qe,style:ze}),be)});Dn.displayName="Tooltip",Dn.propTypes={visible:L().bool,classPrefix:L().string,className:L().string,style:L().object,children:L().node};const hs=Dn;var Vs=H(84336),Os=H.n(Vs),Fn=H(72579),Yr=H.n(Fn),$t=H(72779),Jr=H.n($t);const oo=function(G,Z){return G=typeof G=="function"?G():G,G||Z},ao=function(G,Z){return Z&&(G.classList?G.classList.remove(Z):G.className=G.className.replace(new RegExp("(^|\\s)"+Z+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")),G},co=function(G,Z){return G.classList?!!Z&&G.classList.contains(Z):(" "+G.className+" ").indexOf(" "+Z+" ")!==-1},Ro=function(G,Z){return Z&&(G.classList?G.classList.add(Z):co(G,Z)||(G.className=G.className+" "+Z)),G};function _a(G){return G.replace(/([A-Z])/g,"_$1").toLowerCase()}function wo(G){return G.replace(/\-(\w)/g,function(Z){return Z.slice(1).toUpperCase()})}function Lo(G){return G.replace(/([A-Z])/g,"-$1").toLowerCase()}function Xo(G){var Z=0,re;for(re=1;re<arguments.length;re+=1)G=G.split("{"+Z+"}").join(arguments[re]),Z+=1;return G}var Do=/^ms-/;const Bs=function(G){return Lo(G).replace(Do,"-ms-")};function lo(G,Z){var re,ge;(re=G.style)===null||re===void 0||(ge=re.removeProperty)===null||ge===void 0||ge.call(re,Z)}const bo=function(G,Z){typeof Z=="string"?lo(G,Z):Array.isArray(Z)&&Z.forEach(function(re){return lo(G,re)})},es=function(G,Z,re){var ge="",de=Z;if(typeof Z=="string"){if(re===void 0)throw new Error("value is undefined");(de={})[Z]=re}if(typeof de=="object")for(var Ie in de)Object.prototype.hasOwnProperty.call(de,Ie)&&(!de[Ie]&&de[Ie]!==0?bo(G,Bs(Ie)):ge+=Bs(Ie)+":"+de[Ie]+";");G.style.cssText+=";"+ge};var _i=[],Zo=function(){return _i.some(function(G){return G.activeTargets.length>0})},mn=function(){return _i.some(function(G){return G.skippedTargets.length>0})},uo="ResizeObserver loop completed with undelivered notifications.",ei=function(){var G;typeof ErrorEvent=="function"?G=new ErrorEvent("error",{message:uo}):(G=document.createEvent("Event"),G.initEvent("error",!1,!1),G.message=uo),window.dispatchEvent(G)},bn;(function(G){G.BORDER_BOX="border-box",G.CONTENT_BOX="content-box",G.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(bn||(bn={}));var On=function(G){return Object.freeze(G)},$o=function(){function G(Z,re){this.inlineSize=Z,this.blockSize=re,On(this)}return G}(),fs=function(){function G(Z,re,ge,de){return this.x=Z,this.y=re,this.width=ge,this.height=de,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,On(this)}return G.prototype.toJSON=function(){var Z=this,re=Z.x,ge=Z.y,de=Z.top,Ie=Z.right,Se=Z.bottom,be=Z.left,ke=Z.width,we=Z.height;return{x:re,y:ge,top:de,right:Ie,bottom:Se,left:be,width:ke,height:we}},G.fromRect=function(Z){return new G(Z.x,Z.y,Z.width,Z.height)},G}(),ts=function(G){return G instanceof SVGElement&&"getBBox"in G},Ys=function(G){if(ts(G)){var Z=G.getBBox(),re=Z.width,ge=Z.height;return!re&&!ge}var de=G,Ie=de.offsetWidth,Se=de.offsetHeight;return!(Ie||Se||G.getClientRects().length)},ho=function(G){var Z,re;if(G instanceof Element)return!0;var ge=(re=(Z=G)===null||Z===void 0?void 0:Z.ownerDocument)===null||re===void 0?void 0:re.defaultView;return!!(ge&&G instanceof ge.Element)},ea=function(G){switch(G.tagName){case"INPUT":if(G.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},As=typeof window!="undefined"?window:{},Ns=new WeakMap,Fi=/auto|scroll/,Ca=/^tb|vertical/,fo=/msie|trident/i.test(As.navigator&&As.navigator.userAgent),Bi=function(G){return parseFloat(G||"0")},gs=function(G,Z,re){return G===void 0&&(G=0),Z===void 0&&(Z=0),re===void 0&&(re=!1),new $o((re?Z:G)||0,(re?G:Z)||0)},Or=On({devicePixelContentBoxSize:gs(),borderBoxSize:gs(),contentBoxSize:gs(),contentRect:new fs(0,0,0,0)}),Oo=function(G,Z){if(Z===void 0&&(Z=!1),Ns.has(G)&&!Z)return Ns.get(G);if(Ys(G))return Ns.set(G,Or),Or;var re=getComputedStyle(G),ge=ts(G)&&G.ownerSVGElement&&G.getBBox(),de=!fo&&re.boxSizing==="border-box",Ie=Ca.test(re.writingMode||""),Se=!ge&&Fi.test(re.overflowY||""),be=!ge&&Fi.test(re.overflowX||""),ke=ge?0:Bi(re.paddingTop),we=ge?0:Bi(re.paddingRight),Le=ge?0:Bi(re.paddingBottom),Be=ge?0:Bi(re.paddingLeft),He=ge?0:Bi(re.borderTopWidth),je=ge?0:Bi(re.borderRightWidth),qe=ge?0:Bi(re.borderBottomWidth),ze=ge?0:Bi(re.borderLeftWidth),rt=Be+we,We=ke+Le,Ke=ze+je,st=He+qe,pt=be?G.offsetHeight-st-G.clientHeight:0,Ct=Se?G.offsetWidth-Ke-G.clientWidth:0,$e=de?rt+Ke:0,lt=de?We+st:0,mt=ge?ge.width:Bi(re.width)-$e-Ct,dt=ge?ge.height:Bi(re.height)-lt-pt,At=mt+rt+Ct+Ke,wt=dt+We+pt+st,Rt=On({devicePixelContentBoxSize:gs(Math.round(mt*devicePixelRatio),Math.round(dt*devicePixelRatio),Ie),borderBoxSize:gs(At,wt,Ie),contentBoxSize:gs(mt,dt,Ie),contentRect:new fs(Be,ke,mt,dt)});return Ns.set(G,Rt),Rt},Js=function(G,Z,re){var ge=Oo(G,re),de=ge.borderBoxSize,Ie=ge.contentBoxSize,Se=ge.devicePixelContentBoxSize;switch(Z){case bn.DEVICE_PIXEL_CONTENT_BOX:return Se;case bn.BORDER_BOX:return de;default:return Ie}},ta=function(){function G(Z){var re=Oo(Z);this.target=Z,this.contentRect=re.contentRect,this.borderBoxSize=On([re.borderBoxSize]),this.contentBoxSize=On([re.contentBoxSize]),this.devicePixelContentBoxSize=On([re.devicePixelContentBoxSize])}return G}(),En=function(G){if(Ys(G))return 1/0;for(var Z=0,re=G.parentNode;re;)Z+=1,re=re.parentNode;return Z},ra=function(){var G=1/0,Z=[];_i.forEach(function(Se){if(Se.activeTargets.length!==0){var be=[];Se.activeTargets.forEach(function(we){var Le=new ta(we.target),Be=En(we.target);be.push(Le),we.lastReportedSize=Js(we.target,we.observedBox),Be<G&&(G=Be)}),Z.push(function(){Se.callback.call(Se.observer,be,Se.observer)}),Se.activeTargets.splice(0,Se.activeTargets.length)}});for(var re=0,ge=Z;re<ge.length;re++){var de=ge[re];de()}return G},Bo=function(G){_i.forEach(function(re){re.activeTargets.splice(0,re.activeTargets.length),re.skippedTargets.splice(0,re.skippedTargets.length),re.observationTargets.forEach(function(de){de.isActive()&&(En(de.target)>G?re.activeTargets.push(de):re.skippedTargets.push(de))})})},ya=function(){var G=0;for(Bo(G);Zo();)G=ra(),Bo(G);return mn()&&ei(),G>0},Ao,Qn=[],ia=function(){return Qn.splice(0).forEach(function(G){return G()})},na=function(G){if(!Ao){var Z=0,re=document.createTextNode(""),ge={characterData:!0};new MutationObserver(function(){return ia()}).observe(re,ge),Ao=function(){re.textContent=""+(Z?Z--:Z++)}}Qn.push(G),Ao()},Ha=function(G){na(function(){requestAnimationFrame(G)})},go=0,Ka=function(){return!!go},Ia=250,Sa={attributes:!0,characterData:!0,childList:!0,subtree:!0},zs=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Pe=function(G){return G===void 0&&(G=0),Date.now()+G},xe=!1,mr=function(){function G(){var Z=this;this.stopped=!0,this.listener=function(){return Z.schedule()}}return G.prototype.run=function(Z){var re=this;if(Z===void 0&&(Z=Ia),!xe){xe=!0;var ge=Pe(Z);Ha(function(){var de=!1;try{de=ya()}finally{if(xe=!1,Z=ge-Pe(),!Ka())return;de?re.run(1e3):Z>0?re.run(Z):re.start()}})}},G.prototype.schedule=function(){this.stop(),this.run()},G.prototype.observe=function(){var Z=this,re=function(){return Z.observer&&Z.observer.observe(document.body,Sa)};document.body?re():As.addEventListener("DOMContentLoaded",re)},G.prototype.start=function(){var Z=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),zs.forEach(function(re){return As.addEventListener(re,Z.listener,!0)}))},G.prototype.stop=function(){var Z=this;this.stopped||(this.observer&&this.observer.disconnect(),zs.forEach(function(re){return As.removeEventListener(re,Z.listener,!0)}),this.stopped=!0)},G}(),Ps=new mr,Gn=function(G){!go&&G>0&&Ps.start(),go+=G,!go&&Ps.stop()},lr=function(G){return!ts(G)&&!ea(G)&&getComputedStyle(G).display==="inline"},Kr=function(){function G(Z,re){this.target=Z,this.observedBox=re||bn.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return G.prototype.isActive=function(){var Z=Js(this.target,this.observedBox,!0);return lr(this.target)&&(this.lastReportedSize=Z),this.lastReportedSize.inlineSize!==Z.inlineSize||this.lastReportedSize.blockSize!==Z.blockSize},G}(),Qi=function(){function G(Z,re){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=Z,this.callback=re}return G}(),Bn=new WeakMap,vi=function(G,Z){for(var re=0;re<G.length;re+=1)if(G[re].target===Z)return re;return-1},an=function(){function G(){}return G.connect=function(Z,re){var ge=new Qi(Z,re);Bn.set(Z,ge)},G.observe=function(Z,re,ge){var de=Bn.get(Z),Ie=de.observationTargets.length===0;vi(de.observationTargets,re)<0&&(Ie&&_i.push(de),de.observationTargets.push(new Kr(re,ge&&ge.box)),Gn(1),Ps.schedule())},G.unobserve=function(Z,re){var ge=Bn.get(Z),de=vi(ge.observationTargets,re),Ie=ge.observationTargets.length===1;de>=0&&(Ie&&_i.splice(_i.indexOf(ge),1),ge.observationTargets.splice(de,1),Gn(-1))},G.disconnect=function(Z){var re=this,ge=Bn.get(Z);ge.observationTargets.slice().forEach(function(de){return re.unobserve(Z,de.target)}),ge.activeTargets.splice(0,ge.activeTargets.length)},G}(),Ni=function(){function G(Z){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof Z!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");an.connect(this,Z)}return G.prototype.observe=function(Z,re){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!ho(Z))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");an.observe(this,Z,re)},G.prototype.unobserve=function(Z){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!ho(Z))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");an.unobserve(this,Z)},G.prototype.disconnect=function(){an.disconnect(this)},G.toString=function(){return"function ResizeObserver () { [polyfill code] }"},G}(),ps=function(Z){return(Z==null?void 0:Z.nodeType)===1&&typeof(Z==null?void 0:Z.nodeName)=="string"};const xs=ps;var vs=H(55324),Pi=H.n(vs),cn=H(10937),mi=H.n(cn);const _n=function(G,Z){var re=g(G),ge=G.scrollTop,de=0;return re&&(ge=re.pageYOffset,de=re.pageXOffset),Z!==void 0&&(re?re.scrollTo(de,Z):G.scrollTop=Z),ge},Gi=function(G,Z){var re=g(G),ge=G.scrollLeft,de=0;return re&&(ge=re.pageXOffset,de=re.pageYOffset),Z!==void 0&&(re?re.scrollTo(Z,de):G.scrollLeft=Z),ge},ms=function(G){var Z;return(G==null?void 0:G.nodeName)&&(G==null||(Z=G.nodeName)===null||Z===void 0?void 0:Z.toLowerCase())};var qs=/^ms-/;const No=function(G){return wo(G.replace(qs,"ms-"))},rs=function(G){if(!G)throw new TypeError("No Element passed to `getComputedStyle()`");var Z=G.ownerDocument;return"defaultView"in Z?Z.defaultView.opener?G.ownerDocument.defaultView.getComputedStyle(G,null):window.getComputedStyle(G,null):null},xi=function(G,Z){if(Z){var re=G.style[No(Z)];if(re)return re;var ge=rs(G);if(ge)return ge.getPropertyValue(Bs(Z))}return G.style||rs(G)},Ms=function(G){for(var Z=w(G),re=G==null?void 0:G.offsetParent;re&&ms(G)!=="html"&&xi(re,"position")==="static";)re=re.offsetParent;return re||Z.documentElement},Po=function(G,Z,re){re===void 0&&(re=!0);var ge={top:0,left:0},de=null;if(xi(G,"position")==="fixed")de=G.getBoundingClientRect();else{if(Z=Z||Ms(G),de=_(G),ms(Z)!=="html"){var Ie=_(Z);Ie&&(ge.top=Ie.top,ge.left=Ie.left)}ge.top+=parseInt(xi(Z,"borderTopWidth"),10)-_n(Z)||0,ge.left+=parseInt(xi(Z,"borderLeftWidth"),10)-Gi(Z)||0}if(de){var Se=re&&parseInt(xi(G,"marginTop"),10)||0,be=re&&parseInt(xi(G,"marginLeft"),10)||0;return(0,k.Z)({},de,{top:de.top-ge.top-Se,left:de.left-ge.left-be})}return null};var po={left:"Start",right:"End",top:"Start",bottom:"End"};function Nn(G){var Z,re,ge,de;if(G.tagName==="BODY")Z=window.innerWidth,re=window.innerHeight,de=_n(w(G).documentElement)||_n(G),ge=Gi(w(G).documentElement)||Gi(G);else{var Ie=_(G);Z=Ie.width,re=Ie.height,de=_n(G),ge=Gi(G)}return{width:Z,height:re,scrollX:ge,scrollY:de}}const ks=function(G){var Z=G.placement,re=G.preventOverflow,ge=G.padding;function de(ke,we,Le){if(!re)return 0;var Be=Nn(Le),He=Be.height,je=Be.scrollY,qe=ke-ge-je,ze=ke+ge+we-je;return qe<0?-qe:ze>He?He-ze:0}function Ie(ke,we,Le){if(!re)return 0;var Be=Nn(Le),He=Be.scrollX,je=Be.width,qe=ke-ge-He,ze=ke+ge+we-He;return qe<0?-qe:ze>je?je-ze:0}function Se(ke,we,Le){if(!re)return Le;var Be=Nn(ke),He=Be.scrollY,je=Be.height;return we+Le>je+He?je-we+He:Math.max(He,Le)}function be(ke,we,Le){if(!re)return Le;var Be=Nn(ke),He=Be.scrollX,je=Be.width;return we+Le>je+He?je-we+He:Math.max(He,Le)}return{getPosition:function(we,Le){var Be=Le.tagName==="BODY"?_(we):Po(we,Le,!1);return Be},calcAutoPlacement:function(we,Le,Be){var He=Nn(Le),je=He.width,qe=He.height,ze=He.scrollX,rt=He.scrollY,We=we.left-ze-Be.width,Ke=we.top-rt-Be.height,st=je-we.left-we.width+ze-Be.width,pt=qe-we.top-we.height+rt-Be.height,Ct=[{key:"left",value:We},{key:"right",value:st}],$e=[{key:"top",value:Ke},{key:"bottom",value:pt}],lt="autoVertical",mt="autoHorizontal",dt,At;return Z.indexOf(lt)!==-1?(dt=Pi()($e,function(wt){return wt.value}),Z===lt?dt.key:""+dt.key+Z.replace(lt,"")):Z.indexOf(mt)!==-1?(dt=Pi()(Ct,function(wt){return wt.value}),Z===mt?dt.key:""+dt.key+Z.replace(mt,"")):(dt=Pi()([].concat($e,Ct),function(wt){return wt.value}),dt.key==="left"||dt.key==="right"?At=mi()($e,function(wt){return wt.value}):At=mi()(Ct,function(wt){return wt.value}),""+dt.key+po[At.key])},calcOverlayPosition:function(we,Le,Be){var He=this.getPosition(Le,Be),je=_(we),qe=je.height,ze=je.width,rt=He.top,We=He.left,Ke=Z;Z&&Z.indexOf("auto")>=0&&(Ke=this.calcAutoPlacement(He,Be,{height:qe,width:ze}));var st,pt,Ct,$e;if(Ke==="left"||Ke==="right"){pt=He.top+(He.height-qe)/2;var lt=de(pt,qe,Be);pt+=lt,$e=50*(1-2*lt/qe)+"%",Ct=void 0}else if(Ke==="top"||Ke==="bottom"){st=We+(He.width-ze)/2;var mt=Ie(st,ze,Be);st+=mt,Ct=50*(1-2*mt/ze)+"%",$e=void 0}if((Ke==="top"||Ke==="topStart"||Ke==="topEnd")&&(pt=Se(Be,qe,He.top-qe)),(Ke==="bottom"||Ke==="bottomStart"||Ke==="bottomEnd")&&(pt=Se(Be,qe,He.top+He.height)),(Ke==="left"||Ke==="leftStart"||Ke==="leftEnd")&&(st=be(Be,ze,He.left-ze)),(Ke==="right"||Ke==="rightStart"||Ke==="rightEnd")&&(st=be(Be,ze,He.left+He.width)),document.dir==="rtl"&&(Ke==="left"||Ke==="leftStart"||Ke==="leftEnd"||Ke==="right"||Ke==="rightStart"||Ke==="rightEnd")){var dt=Nn(Be),At=dt.width;Be.scrollWidth>At&&(st=At+st-Be.scrollWidth)}if(Ke==="topStart"||Ke==="bottomStart")if(document.dir==="rtl"){var wt=We+(He.width-ze);st=wt+Ie(wt,ze,Be)}else st=We+Ie(We,ze,Be);if(Ke==="topEnd"||Ke==="bottomEnd")if(document.dir==="rtl")st=We+Ie(We,ze,Be);else{var Rt=We+(He.width-ze);st=Rt+Ie(Rt,ze,Be)}if((Ke==="leftStart"||Ke==="rightStart")&&(pt=rt+de(rt,qe,Be)),Ke==="leftEnd"||Ke==="rightEnd"){var jt=rt+(He.height-qe);pt=jt+de(jt,qe,Be)}return{positionLeft:st,positionTop:pt,arrowOffsetLeft:Ct,arrowOffsetTop:$e,positionClassName:"placement-"+ie()(Ke)}}}};var vo=H(76088),dl=function(Z,re){var ge=(0,P.useRef)(!0);(0,P.useEffect)(function(){if(ge.current){ge.current=!1;return}Z()},re)};const is=dl;var hl=function(Z,re){var ge=Z.placement,de=ge===void 0?"right":ge,Ie=Z.preventOverflow,Se=Ie===void 0?!1:Ie,be=Z.containerPadding,ke=be===void 0?0:be,we=Z.container,Le=Z.triggerTarget,Be=(0,P.useRef)(null),He=(0,P.useRef)(null),je=(0,P.useRef)(),qe={positionLeft:0,positionTop:0,arrowOffsetLeft:null,arrowOffsetTop:null},ze=(0,P.useState)(qe),rt=ze[0],We=ze[1],Ke=(0,P.useMemo)(function(){return ks({placement:de,preventOverflow:Se,padding:ke})},[de,Se,ke]),st=(0,P.useCallback)(function(pt,Ct){if(pt===void 0&&(pt=!0),!!(Le!=null&&Le.current)){var $e=(0,vo.Z)(Le);if(!xs($e))throw new Error("`target` should return an HTMLElement");if(!($e===He.current&&!pt)){var lt=(0,vo.Z)(re.current),mt=oo(typeof we=="function"?we():we!=null?we:null,w(re.current).body),dt=Ke.calcOverlayPosition(lt,$e,mt);if(Ct&&lt){var At,wt,Rt=lt==null||(At=lt.className)===null||At===void 0||(wt=At.match(/(placement-\S+)/))===null||wt===void 0?void 0:wt[0];ao(lt,Rt),dt.positionClassName&&Ro(lt,dt.positionClassName),es(lt,{left:dt.positionLeft+"px",top:dt.positionTop+"px"})}else We(dt);Be.current=mt,He.current=$e}}},[we,re,Le,Ke]);return(0,P.useEffect)(function(){st(!1);var pt=(0,vo.Z)(re.current),Ct;if(Be.current&&Se){var $e;Ct=(0,d.Z)((($e=Be.current)===null||$e===void 0?void 0:$e.tagName)==="BODY"?window:Be.current,"scroll",function(){return st(!0,!0)})}var lt=(0,d.Z)(window,"resize",function(){return st(!0,!0)});return pt&&(je.current=new Ni(function(){return st(!0,!0)}),je.current.observe(pt)),function(){var mt,dt;He.current=null,(mt=Ct)===null||mt===void 0||mt.off(),lt==null||lt.off(),(dt=je.current)===null||dt===void 0||dt.disconnect()}},[Se,re,st]),is(function(){return st()},[st,de]),[rt,st]},Ta=P.forwardRef(function(G,Z){var re=G.children,ge=G.className,de=P.useRef(null),Ie=hl(G,de),Se=Ie[0],be=Ie[1],ke=Se.positionClassName,we=Se.arrowOffsetLeft,Le=Se.arrowOffsetTop,Be=Se.positionLeft,He=Se.positionTop;if((0,P.useImperativeHandle)(Z,function(){return{get child(){return de.current},updatePosition:be}}),typeof re=="function"){var je={className:Jr()(ge,ke),arrowOffsetLeft:we,arrowOffsetTop:Le,left:Be,top:He};return re(je,de)}return re});Ta.displayName="Position",Ta.propTypes={className:L().string,children:L().func.isRequired,container:L().oneOfType([L().func,L().any]),containerPadding:L().number,placement:L().any,preventOverflow:L().bool,triggerTarget:L().any};const Cc=Ta;var wr=H(77700);function fu(G){return(G==null?void 0:G.button)===0}function Au(G){return!!(G.metaKey||G.altKey||G.ctrlKey||G!=null&&G.shiftKey)}function fl(G,Z){var re=Z.disabled,ge=Z.triggerTarget,de=Z.overlayTarget,Ie=Z.listenEscape,Se=Ie===void 0?!0:Ie,be=(0,P.useCallback)(function(we){Se&&we.key===wr.QP.ESC&&(G==null||G(we))},[Se,G]),ke=(0,P.useCallback)(function(we){var Le=(0,vo.Z)(ge),Be=(0,vo.Z)(de);Le&&p(Le,we.target)||Be&&p(Be,we.target)||Au(we)||!fu(we)||G==null||G(we)},[G,ge,de]);(0,P.useEffect)(function(){var we=(0,vo.Z)(ge);if(!(re||!we)){var Le=w(we),Be=(0,d.Z)(Le,"mousedown",ke,!0),He=(0,d.Z)(Le,"keyup",be);return function(){Be==null||Be.off(),He==null||He.off()}}},[ge,re,G,ke,be])}const yc=fl;var Ic=P.forwardRef(function(G,Z){var re=G.timeout,ge=re===void 0?300:re,de=G.className,Ie=(0,W.Z)(G,["timeout","className"]),Se=(0,s.Z)("anim"),be=Se.prefix,ke=Se.merge;return P.createElement(o.ZP,(0,k.Z)({},Ie,{ref:Z,timeout:ge,className:ke(de,be("fade")),enteredClassName:be("in"),enteringClassName:be("in")}))});Ic.displayName="Fade";const Al=Ic;var sa=P.createContext({});sa.displayName="OverlayContext";const Sc=sa;var Tc={container:L().any,children:L().any,childrenProps:L().object,className:L().string,containerPadding:L().number,placement:L().any,preventOverflow:L().bool,open:L().bool,rootClose:L().bool,transition:L().any,triggerTarget:L().any,onClose:L().func,onEnter:L().func,onEntering:L().func,onEntered:L().func,onExit:L().func,onExiting:L().func,onExited:L().func},ja=P.forwardRef(function(G,Z){var re=(0,P.useContext)(Sc),ge=re.overlayContainer,de=G.container,Ie=de===void 0?ge:de,Se=G.containerPadding,be=G.placement,ke=G.rootClose,we=G.children,Le=G.childrenProps,Be=G.transition,He=Be===void 0?Al:Be,je=G.open,qe=G.preventOverflow,ze=G.triggerTarget,rt=G.onClose,We=G.onExited,Ke=G.onExit,st=G.onExiting,pt=G.onEnter,Ct=G.onEntering,$e=G.onEntered,lt=(0,P.useState)(!je),mt=lt[0],dt=lt[1],At=(0,P.useRef)(null);je?mt&&dt(!1):!He&&!mt&&dt(!0);var wt=je||He&&!mt,Rt=(0,P.useCallback)(function(Xt){dt(!0),We==null||We(Xt)},[We]);if(yc(rt,{triggerTarget:ze,overlayTarget:At,disabled:!ke||!wt}),!wt)return null;var jt={container:Ie,containerPadding:Se,triggerTarget:ze,placement:be,preventOverflow:qe},or=function(hr,Nr){return P.createElement(Cc,(0,k.Z)({},jt,hr,{ref:u(Z,Nr)}),function(ur,Vt){if(typeof we=="function")return we(Object.assign(ur,Le),u(Vt,At));var yr=ur.left,Zt=ur.top,Ai=ur.className;return P.cloneElement(we,(0,k.Z)({},Le,we.props,{className:Jr()(Ai,we.props.className),style:(0,k.Z)({left:yr,top:Zt},we.props.style),ref:u(Vt,At)}))})};return He?P.createElement(He,{in:je,transitionAppear:!0,onExit:Ke,onExiting:st,onExited:Rt,onEnter:pt,onEntering:Ct,onEntered:$e},or):or()});ja.displayName="Overlay",ja.propTypes=Tc;const gl=ja;var yi=H(21426),gu=H(28316);function pl(G){G===void 0&&(G={});var Z=G,re=Z.id,ge=Z.container,de=(0,P.useRef)(D.Z?document.body:null);(0,P.useEffect)(function(){var Se=typeof ge=="function"?ge():ge,be=re&&document.querySelector("#"+re),ke=Se||be||document.body;de.current=ke},[de,ge,re]);var Ie=(0,P.useCallback)(function(Se){var be=Se.children;return de.current!=null?(0,gu.createPortal)(be,de.current):null},[de]);return{target:de.current,Portal:Ie}}const vl=pl;function ml(G,Z){G===void 0&&(G={}),Z===void 0&&(Z={});var re={};return Object.keys(G).forEach(function(ge){if(G[ge]){var de;re[ge]=(0,yi.Z)(G[ge],(de=Z)===null||de===void 0?void 0:de[ge])}}),re}function Wa(G,Z,re){var ge=Z.currentTarget,de=Z.relatedTarget||Yr()(Z,["nativeEvent","toElement"]);(!de||de!==ge)&&!p(ge,de)&&G(Z,re)}var El=["hover","focus"],Va=P.forwardRef(function(G,Z){var re=(0,P.useContext)(Sc),ge=re.overlayContainer,de=G.children,Ie=G.container,Se=Ie===void 0?ge:Ie,be=G.controlId,ke=G.defaultOpen,we=G.trigger,Le=we===void 0?El:we,Be=G.disabled,He=G.readOnly,je=G.plaintext,qe=G.open,ze=G.delay,rt=G.delayOpen,We=G.delayClose,Ke=G.enterable,st=G.placement,pt=st===void 0?"bottomStart":st,Ct=G.speaker,$e=G.rootClose,lt=$e===void 0?!0:$e,mt=G.onClick,dt=G.onMouseOver,At=G.onMouseOut,wt=G.onContextMenu,Rt=G.onFocus,jt=G.onBlur,or=G.onClose,Xt=(0,W.Z)(G,["children","container","controlId","defaultOpen","trigger","disabled","readOnly","plaintext","open","delay","delayOpen","delayClose","enterable","placement","speaker","rootClose","onClick","onMouseOver","onMouseOut","onContextMenu","onFocus","onBlur","onClose"]),hr=vl({container:Se}),Nr=hr.Portal,ur=(0,P.useRef)(),Vt=(0,P.useRef)(),yr=hi(qe,ke),Zt=yr[0],Ai=yr[1],ti=(0,P.useRef)(null),ci=(0,P.useRef)(null),ri=b()(rt)?ze:rt,Cs=b()(We)?ze:We,Pn=(0,P.useRef)(!1),Li=(0,P.useRef)(!1);(0,P.useEffect)(function(){return function(){b()(ti.current)||clearTimeout(ti.current),b()(ci.current)||clearTimeout(ci.current)}},[]);var Zi=(0,P.useCallback)(function(ln){var Mi=Os()(ln)?ri:ln;if(Mi&&typeof Mi=="number")return ti.current=setTimeout(function(){ti.current=null,Ai(!0)},Mi);Ai(!0)},[ri,Ai]),Yn=(0,P.useCallback)(function(ln){var Mi=Os()(ln)?Cs:ln;if(Mi&&typeof Mi=="number")return ci.current=setTimeout(function(){ci.current=null,Ai(!1)},Mi);Ai(!1)},[Cs,Ai]);(0,P.useImperativeHandle)(Z,function(){return{get root(){return ur.current},get overlay(){var ln;return(ln=Vt.current)===null||ln===void 0?void 0:ln.child},open:Zi,close:Yn,updatePosition:function(){var Mi,In;(Mi=Vt.current)===null||Mi===void 0||(In=Mi.updatePosition)===null||In===void 0||In.call(Mi)}}});var Jn=(0,P.useCallback)(function(){!Pn.current&&!Li.current&&Yn()},[Yn]),_o=(0,P.useCallback)(function(){Zt?Jn():Zi()},[Zt,Jn,Zi]),qr=(0,P.useCallback)(function(){if(!Ke)return Zi();if(Li.current=!0,!b()(ci.current))return clearTimeout(ci.current),ci.current=null,Zi();Zt||Zi()},[Ke,Zt,Zi]),Pr=(0,P.useCallback)(function(){if(Ke||Yn(),Li.current=!1,!b()(ti.current)){clearTimeout(ti.current),ti.current=null;return}!Zt||!b()(ci.current)||(ci.current=setTimeout(function(){b()(ci.current)||(clearTimeout(ci.current),ci.current=null),Jn()},200))},[Ke,Zt,Yn,Jn]),ft=(0,P.useCallback)(function(){Pn.current=!0},[]),ii=(0,P.useCallback)(function(){Pn.current=!1,!Te("click",Le)&&!Te("contextMenu",Le)&&!Te("active",Le)&&Jn()},[Jn,Le]),Ki=(0,P.useCallback)(function(ln){ln.preventDefault()},[]),jr={onClick:mt,onContextMenu:wt,onMouseOver:dt,onMouseOut:At,onFocus:Rt,onBlur:jt};if(!Be&&!He&&!je){if(Te("click",Le)&&(jr.onClick=(0,yi.Z)(_o,jr.onClick)),Te("contextMenu",Le)&&(jr.onContextMenu=(0,yi.Z)(Ki,_o,jr.onContextMenu)),Te("active",Le)&&(jr.onClick=(0,yi.Z)(qr,jr.onClick)),Te("hover",Le)){var zn=null,ys=null;Le!=="none"&&(zn=function(Mi){return Wa(qr,Mi)},ys=function(Mi){return Wa(Pr,Mi)}),jr.onMouseOver=(0,yi.Z)(zn,dt),jr.onMouseOut=(0,yi.Z)(ys,At)}Te("focus",Le)&&(jr.onFocus=(0,yi.Z)(qr,Rt),jr.onBlur=(0,yi.Z)(Pr,jt))}var ga=function(){var Mi=(0,k.Z)({},Xt,{rootClose:lt,triggerTarget:ur,onClose:Le!=="none"?(0,yi.Z)(Yn,or):void 0,placement:pt,container:Se,open:Zt}),In={id:be};return Le!=="none"&&Ke&&(In.onMouseEnter=ft,In.onMouseLeave=ii),P.createElement(gl,(0,k.Z)({},Mi,{ref:Vt,childrenProps:In}),typeof Ct=="function"?function(Ko,bu){return Ct((0,k.Z)({},Ko,{onClose:Yn}),bu)}:Ct)};return P.createElement(P.Fragment,null,typeof de=="function"?de(jr,ur):P.cloneElement(de,(0,k.Z)({ref:ur,"aria-describedby":be},ml(jr,de.props))),P.createElement(Nr,null,ga()))});Va.displayName="OverlayTrigger";const _l=Va;function mo(G,Z){return Z===void 0&&(Z=!1),typeof G=="string"?(Z&&(G=G.replace(/left|right/,function(re){return re==="left"?"right":"left"})),G.replace(/Left|Top/,"Start").replace(/Right|Bottom/,"End")):G}const Ra=mo;var Cl=H(10356),Eo=P.forwardRef(function(G,Z){var re=G.onOpen,ge=G.onClose,de=G.onEntered,Ie=G.onExited,Se=G.placement,be=Se===void 0?"right":Se,ke=G.preventOverflow,we=(0,W.Z)(G,["onOpen","onClose","onEntered","onExited","placement","preventOverflow"]);return P.createElement(Cl.wu,null,function(Le){return P.createElement(_l,(0,k.Z)({},we,{ref:Z,preventOverflow:ke,placement:Ra(be,Le==null?void 0:Le.rtl),onEntered:(0,yi.Z)(re,de),onExited:(0,yi.Z)(ge,Ie)}))})});Eo.displayName="Whisper",Eo.propTypes={onOpen:L().func,onClose:L().func,onEntered:L().func,onExited:L().func,placement:L().oneOf(wr.r4),preventOverflow:L().bool};const yl=Eo;function Rc(G){var Z=G.message,re=G.ref,ge=(0,W.Z)(G,["message","ref"]);return P.createElement(yl,(0,k.Z)({ref:re,speaker:P.createElement(hs,null,Z)},ge))}var wc=H(74930),oa=H.n(wc);function aa(G,Z){var re=(0,P.useRef)();return re.current||(re.current=oa()(G)),Z!=null?Z:re.current}var gt;(function(G){G[G.RegisterItem=0]="RegisterItem",G[G.UnregisterItem=1]="UnregisterItem",G[G.OpenMenu=2]="OpenMenu",G[G.CloseMenu=3]="CloseMenu",G[G.MoveFocus=4]="MoveFocus"})(gt||(gt={}));var Jt;(function(G){G[G.Next=0]="Next",G[G.Prev=1]="Prev",G[G.Last=2]="Last",G[G.First=3]="First",G[G.Specific=4]="Specific",G[G.None=5]="None"})(Jt||(Jt={}));var kr=P.createContext(null);kr.displayName="MenuContext";const ca=kr;function Ya(G){var Z=G.children,re=G.selected,ge=re===void 0?!1:re,de=G.disabled,Ie=de===void 0?!1:de,Se=G.onActivate,be=(0,P.useRef)(null),ke=aa("menuitem-"),we=(0,P.useContext)(ca);if(!we)throw new Error("<MenuItem> must be rendered within a <Menu>");var Le=we[0],Be=we[1],He=!b()(be.current)&&!b()(Le.activeItemIndex)&&Le.items[Le.activeItemIndex].element===be.current,je=(0,P.useCallback)(function(Ke){Ie||Se==null||Se(Ke)},[Ie,Se]),qe=(0,P.useCallback)(function(){!b()(be.current)&&!He&&Be({type:gt.MoveFocus,to:Jt.Specific,id:be.current.id})},[Be]),ze=(0,P.useCallback)(function(){!b()(be.current)&&!He&&Be({type:gt.MoveFocus,to:Jt.Specific,id:be.current.id})},[He,Be]),rt=(0,P.useCallback)(function(){Be({type:gt.MoveFocus,to:Jt.None})},[Be]);(0,P.useEffect)(function(){var Ke=be.current;return Be({type:gt.RegisterItem,element:Ke,props:{disabled:Ie}}),function(){Be({type:gt.UnregisterItem,id:Ke.id})}},[be,Ie,Be]);var We={id:ke,role:"menuitem","aria-checked":ge||void 0,"aria-disabled":Ie,tabIndex:-1,onClick:je,selected:ge,active:He};return(Le==null?void 0:Le.role)==="menu"&&(We.onMouseMove=ze,We.onMouseLeave=rt),(Le==null?void 0:Le.role)==="menubar"&&(We.onMouseDown=qe),Z(We,be)}Ya.displayName="MenuItem",Ya.propTypes={selected:L().bool,disabled:L().bool,children:L().func.isRequired,onActivate:L().func};const xo=Ya;var Xs=H(17620),Es=H.n(Xs),ns=P.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?S:re,de=G.active,Ie=G.children,Se=G.className,be=G.disabled,ke=G.classPrefix,we=ke===void 0?"sidenav-item":ke,Le=G.icon,Be=G.eventKey,He=G.style,je=G.onClick,qe=G.onSelect,ze=G.divider,rt=G.panel,We=(0,W.Z)(G,["as","active","children","className","disabled","classPrefix","icon","eventKey","style","onClick","onSelect","divider","panel"]),Ke=(0,P.useContext)(si);if(!Ke)throw new Error("<SidenavItem> component is not supposed to be used standalone. Use <Nav.Item> inside <Sidenav> instead.");var st=(0,P.useContext)(Vr),pt=st.activeKey,Ct=st.onSelect,$e=(0,s.Z)(we),lt=$e.merge,mt=$e.withClassPrefix,dt=$e.prefix,At=de!=null?de:!b()(Be)&&U(pt,Be),wt=(0,P.useCallback)(function(Rt){be||(qe==null||qe(Be,Rt),Ct==null||Ct(Be,Rt),je==null||je(Rt))},[be,qe,Ct,Be,je]);return Ke.expanded?ze?P.createElement("li",(0,k.Z)({ref:Z,role:"separator",style:He,className:lt(Se,dt("divider"))},We)):rt?P.createElement("li",(0,k.Z)({ref:Z,role:"none presentation",style:He,className:lt(Se,dt("panel"))},We),Ie):P.createElement(ge,(0,k.Z)({ref:Z,className:lt(Se,mt({active:At,disabled:be})),onClick:wt,style:He,"aria-selected":At||void 0,"data-event-key":Be},We),Le,Ie,P.createElement(R,null)):P.createElement(xo,{selected:At,disabled:be,onActivate:wt},function(Rt,jt){var or=Rt.selected,Xt=Rt.active,hr=(0,W.Z)(Rt,["selected","active"]),Nr=lt(Se,mt({focus:Xt,active:or,disabled:be}));return Rc({children:function(Vt,yr){return P.createElement(ge,(0,k.Z)({ref:u(u(Z,jt),yr),disabled:ge===S?be:void 0,className:Nr,"data-event-key":Be},Es()(We,["divider","panel"]),Vt,hr),Le,Ie,P.createElement(R,null))},message:Ie,placement:"right"})})});ns.displayName="Sidenav.Item",ns.propTypes={classPrefix:L().string,disabled:L().bool,icon:L().node,className:L().string,children:L().node,eventKey:L().any,as:L().elementType,style:L().object,onSelect:L().func,onMouseEnter:L().func,onMouseLeave:L().func,onContextMenu:L().func,onClick:L().func};const pu=ns;var la=P.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?S:re,de=G.active,Ie=G.disabled,Se=G.eventKey,be=G.className,ke=G.classPrefix,we=ke===void 0?"navbar-item":ke,Le=G.style,Be=G.children,He=G.icon,je=G.onClick,qe=G.onSelect,ze=(0,W.Z)(G,["as","active","disabled","eventKey","className","classPrefix","style","children","icon","onClick","onSelect"]),rt=(0,P.useContext)(Vr),We=rt.activeKey,Ke=rt.onSelect,st=de!=null?de:!b()(Se)&&U(Se,We),pt=(0,P.useCallback)(function(At){qe==null||qe(Se,At),Ke==null||Ke(Se,At)},[Se,qe,Ke]),Ct=(0,s.Z)(we),$e=Ct.withClassPrefix,lt=Ct.merge,mt=lt(be,$e({active:st,disabled:Ie})),dt=(0,P.useCallback)(function(At){Ie||(pt(At),je==null||je(At))},[Ie,pt,je]);return P.createElement(ge,(0,k.Z)({ref:Z,"aria-selected":st||void 0},ze,{className:mt,onClick:dt,style:Le}),He,Be,P.createElement(R,null))});la.displayName="Navbar.Item",la.propTypes={as:L().elementType,active:L().bool,disabled:L().bool,className:L().string,classPrefix:L().string,onClick:L().func,style:L().object,icon:L().node,onSelect:L().func,children:L().node,eventKey:L().any};const Mo=la;var Cn=P.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?S:re,de=G.active,Ie=G.disabled,Se=G.eventKey,be=G.className,ke=G.classPrefix,we=ke===void 0?"nav-item":ke,Le=G.style,Be=G.children,He=G.icon,je=G.divider,qe=G.panel,ze=G.onClick,rt=G.onSelect,We=(0,W.Z)(G,["as","active","disabled","eventKey","className","classPrefix","style","children","icon","divider","panel","onClick","onSelect"]),Ke=(0,P.useContext)(Vr),st=Ke.activeKey,pt=Ke.onSelect,Ct=de!=null?de:!b()(Se)&&U(Se,st),$e=(0,P.useCallback)(function(Xt){rt==null||rt(Se,Xt),pt==null||pt(Se,Xt)},[Se,rt,pt]),lt=(0,P.useContext)(Oi),mt=(0,P.useContext)(si),dt=(0,s.Z)(we),At=dt.withClassPrefix,wt=dt.merge,Rt=dt.prefix,jt=wt(be,At({active:Ct,disabled:Ie})),or=(0,P.useCallback)(function(Xt){Ie||($e(Xt),ze==null||ze(Xt))},[Ie,$e,ze]);return mt?P.createElement(pu,G):je?P.createElement("div",(0,k.Z)({ref:Z,role:"separator",style:Le,className:wt(be,Rt("divider"))},We)):qe?P.createElement("div",(0,k.Z)({ref:Z,style:Le,className:wt(be,Rt("panel"))},We),Be):lt?P.createElement(Mo,G):P.createElement(ge,(0,k.Z)({ref:Z,tabIndex:Ie?-1:void 0},We,{className:jt,onClick:or,style:Le,"aria-selected":Ct||void 0}),He,Be,P.createElement(R,null))});Cn.displayName="Nav.Item",Cn.propTypes={as:L().elementType,active:L().bool,disabled:L().bool,className:L().string,classPrefix:L().string,divider:L().bool,panel:L().bool,onClick:L().func,style:L().object,icon:L().node,onSelect:L().func,children:L().node,eventKey:L().any};const zr=Cn;var ua=H(13888),vu=H.n(ua),qt=H(52885),da={role:"menu",open:!1,items:[],activeItemIndex:null};function Ja(G,Z){var re=G.items,ge=G.activeItemIndex;switch(Z.type){case gt.RegisterItem:return(0,k.Z)({},G,{items:[].concat(re,[{element:Z.element,props:Z.props}])});case gt.UnregisterItem:return(0,k.Z)({},G,{items:re.filter(function(ze){return ze.element.id!==Z.id})});case gt.OpenMenu:return(0,k.Z)({},G,{open:!0});case gt.CloseMenu:return(0,k.Z)({},G,{open:!1});case gt.MoveFocus:var de=ge;switch(Z.to){case Jt.Next:for(var Ie=ge===null?0:ge+1;Ie<re.length;Ie++){var Se;if(!((Se=re[Ie].props)!==null&&Se!==void 0&&Se.disabled)){de=Ie;break}}break;case Jt.Prev:for(var be=ge===null?re.length-1:ge-1;be>=0;be--){var ke;if(!((ke=re[be].props)!==null&&ke!==void 0&&ke.disabled)){de=be;break}}break;case Jt.First:for(var we=0;we<re.length;we++){var Le;if(!((Le=re[we].props)!==null&&Le!==void 0&&Le.disabled)){de=we;break}}break;case Jt.Last:for(var Be=re.length-1;Be>=0;Be--){var He;if(!((He=re[Be].props)!==null&&He!==void 0&&He.disabled)){de=Be;break}}break;case Jt.Specific:for(var je=0;je<re.length;je++){var qe;if(re[je].element.id===Z.id&&!((qe=re[je].props)!==null&&qe!==void 0&&qe.disabled)){de=je;break}}break;case Jt.None:de=null;break}return(0,k.Z)({},G,{activeItemIndex:de});default:return G}}function Lc(G){var Z=(0,P.useReducer)(Ja,(0,k.Z)({},da,G)),re=Z[0],ge=Z[1];return[re,ge]}function Il(G){var Z=(0,P.useRef)(null),re=(0,P.useCallback)(function(){requestAnimationFrame(function(){if(document.activeElement!==G.current){var de;Z.current=document.activeElement,(de=G.current)===null||de===void 0||de.focus()}})},[G]),ge=(0,P.useCallback)(function(de){requestAnimationFrame(function(){var Ie;(Ie=Z.current)===null||Ie===void 0||Ie.focus(de)})},[]);return{grab:re,release:ge}}function ko(G){var Z=G.enabled,re=Z===void 0?!0:Z,ge=G.isOutside,de=G.handle,Ie=(0,P.useRef)(ge),Se=(0,P.useRef)(de);(0,P.useEffect)(function(){Ie.current=ge,Se.current=de},[ge,de]),(0,P.useEffect)(function(){if(re){var be=function(we){Ie.current(we)&&Se.current(we)};return window.addEventListener("mousedown",be),function(){window.removeEventListener("mousedown",be)}}},[re])}function mu(G){return G.type==="focus"&&!G.currentTarget.contains(G.relatedTarget)}function Uo(G){return G.type==="blur"&&!G.currentTarget.contains(G.relatedTarget)}var Eu=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(function(G){return G+":not([tabindex='-1'])"}).join(",");function _u(G){return G===document.body?!1:G.matches(Eu)}var Cu=["click"];function Dc(G){var Z,re=G.disabled,ge=G.children,de=G.openMenuOn,Ie=de===void 0?Cu:de,Se=G.menuButtonText,be=G.renderMenuButton,ke=G.renderMenuPopup,we=G.onToggleMenu,Le=(0,P.useRef)(null),Be=(0,P.useRef)(null),He=(0,P.useContext)(ca),je=!!He,qe=Lc(),ze=qe[0],rt=ze.open,We=ze.items,Ke=ze.activeItemIndex,st=qe[1],pt=(0,qt.Z)("Menu"),Ct=pt.rtl,$e=b()(Ke)?null:(Z=We[Ke])===null||Z===void 0?void 0:Z.element,lt=Il(Be),mt=lt.grab,dt=(0,P.useCallback)(function(ft){st({type:gt.OpenMenu}),ft.isTrusted||st({type:gt.MoveFocus,to:Jt.First}),we==null||we(!0,ft),mt()},[st,we,mt]),At=(0,P.useCallback)(function(ft,ii){if(ii===void 0&&(ii=!0),st({type:gt.CloseMenu}),st({type:gt.MoveFocus,to:Jt.None}),we==null||we(!1,ft),ii){var Ki;(Ki=Le.current)===null||Ki===void 0||Ki.focus({preventScroll:!0})}},[st,we,Le]),wt=(0,P.useCallback)(function(ft){rt?At(ft):dt(ft)},[rt,dt,At]);ko({enabled:rt,isOutside:function(ii){var Ki,jr;return!((Ki=Le.current)!==null&&Ki!==void 0&&Ki.contains(ii.target))&&!((jr=Be.current)!==null&&jr!==void 0&&jr.contains(ii.target))},handle:function(ii){return At(ii,!_u(ii.target))}});var Rt=(0,P.useCallback)(function(ft){switch(ft.key){case wr.QP.ENTER:case wr.QP.SPACE:ft.preventDefault(),ft.stopPropagation(),rt?At(ft):(dt(ft),st({type:gt.MoveFocus,to:Jt.First}));break;case wr.QP.DOWN:ft.preventDefault(),ft.stopPropagation(),rt||dt(ft),st({type:gt.MoveFocus,to:Jt.First});break}},[rt,dt,At,st]),jt=(0,P.useCallback)(function(ft){re||wt(ft)},[re,wt]),or=(0,P.useCallback)(function(ft){ft.preventDefault(),!rt&&(re||dt(ft))},[rt,re,dt]),Xt=(0,P.useMemo)(function(){var ft={onKeyDown:Rt};return Ie!=null&&Ie.includes("click")&&(ft.onClick=jt),Ie!=null&&Ie.includes("contextmenu")&&(ft.onContextMenu=or),ft},[Ie,Rt,jt,or]),hr=aa("menubutton-"),Nr=aa("menu-"),ur=(0,P.useMemo)(function(){return{role:"button","aria-haspopup":"menu","aria-expanded":rt||void 0,"aria-controls":Nr}},[rt,Nr]),Vt=(0,P.useMemo)(function(){return(0,k.Z)({id:hr},ur,Xt,{open:rt})},[hr,ur,Xt,rt]),yr=(0,P.useMemo)(function(){return be==null?void 0:be(Vt,Le)},[be,Vt,Le]),Zt=yr!=null?yr:P.createElement("button",(0,k.Z)({ref:Le},Vt),Se),Ai=(0,P.useCallback)(function(ft){switch(ft.key){case wr.QP.UP:ft.preventDefault(),ft.stopPropagation(),st({type:gt.MoveFocus,to:Jt.Prev});break;case wr.QP.DOWN:ft.preventDefault(),ft.stopPropagation(),st({type:gt.MoveFocus,to:Jt.Next});break;case wr.QP.RIGHT:ft.preventDefault(),ft.stopPropagation(),Ct?je&&st({type:gt.CloseMenu}):($e==null?void 0:$e.getAttribute("aria-haspopup"))==="menu"&&$e.click();break;case wr.QP.LEFT:ft.preventDefault(),ft.stopPropagation(),Ct?($e==null?void 0:$e.getAttribute("aria-haspopup"))==="menu"&&$e.click():je&&At(ft);break;case wr.QP.HOME:ft.preventDefault(),ft.stopPropagation(),st({type:gt.MoveFocus,to:Jt.First});break;case wr.QP.END:ft.preventDefault(),ft.stopPropagation(),st({type:gt.MoveFocus,to:Jt.Last});break;case wr.QP.ENTER:case wr.QP.SPACE:$e&&(ft.preventDefault(),ft.stopPropagation(),$e.click(),$e.getAttribute("aria-haspopup")||At(ft));break;case wr.QP.ESC:At(ft);break}},[st,$e,je,Ct,At]),ti=(0,P.useCallback)(function(ft){var ii=ft.target;ii.getAttribute("role")==="menuitem"&&ii.getAttribute("aria-haspopup")!=="menu"&&ii.getAttribute("aria-disabled")!=="true"&&At(ft,!je)},[At,je]),ci={role:"menu","aria-labelledby":hr,"aria-activedescendant":$e==null?void 0:$e.id},ri={onClick:ti,onKeyDown:Ai},Cs=(0,k.Z)({id:Nr},ci,ri,{tabIndex:0}),Pn=ke==null?void 0:ke((0,k.Z)({},Cs,{open:rt}),Be),Li=Pn!=null?Pn:P.createElement("ul",(0,k.Z)({ref:Be},Cs,{hidden:!rt}),ge),Zi=(0,P.useCallback)(function(ft){re||dt(ft)},[re,dt]),Yn=(0,P.useCallback)(function(ft){re||At(ft)},[re,At]),Jn=(0,P.useRef)(null),_o=(0,P.useCallback)(function(ft){Uo(ft)&&At(ft,!1)},[At]),qr={onBlur:_o};Ie!=null&&Ie.includes("mouseover")&&(qr.onMouseEnter=Zi,qr.onMouseLeave=Yn);var Pr=(0,k.Z)({},qr,{children:P.createElement(P.Fragment,null,Zt,P.createElement(ca.Provider,{value:qe},Li)),open:rt});return je&&(Pr.role="none presentation"),ge(Pr,Jn)}Dc.displayName="Menu",Dc.propTypes={children:L().func.isRequired};const Br=Dc;var ss=P.createContext(null);ss.displayName="DropdownContext";const yn=ss;function Hi(G){var Z=G.vertical,re=Z===void 0?!1:Z,ge=G.children,de=G.onActivateItem,Ie=Lc({role:"menubar"}),Se=Ie[0],be=Se.items,ke=Se.activeItemIndex,we=Ie[1],Le=(0,P.useRef)(null),Be=(0,P.useCallback)(function(We){mu(We)&&ke===null&&we({type:gt.MoveFocus,to:Jt.First})},[ke,we]),He=(0,P.useCallback)(function(We){Uo(We)&&we({type:gt.MoveFocus,to:Jt.None})},[we]),je=(0,qt.Z)("Menubar"),qe=je.rtl,ze=(0,P.useCallback)(function(We){var Ke=b()(ke)?null:be[ke].element;switch(!0){case(!re&&!qe&&We.key===wr.QP.RIGHT):case(!re&&qe&&We.key===wr.QP.LEFT):case(re&&We.key===wr.QP.DOWN):We.preventDefault(),We.stopPropagation(),we({type:gt.MoveFocus,to:Jt.Next});break;case(!re&&!qe&&We.key===wr.QP.LEFT):case(!re&&qe&&We.key===wr.QP.RIGHT):case(re&&We.key===wr.QP.UP):We.preventDefault(),We.stopPropagation(),we({type:gt.MoveFocus,to:Jt.Prev});break;case We.key===wr.QP.HOME:We.preventDefault(),We.stopPropagation(),we({type:gt.MoveFocus,to:Jt.First});break;case We.key===wr.QP.END:We.preventDefault(),We.stopPropagation(),we({type:gt.MoveFocus,to:Jt.Last});break;case(!re&&We.key===wr.QP.DOWN):case(re&&!qe&&We.key===wr.QP.RIGHT):case(re&&qe&&We.key===wr.QP.LEFT):(Ke==null?void 0:Ke.getAttribute("aria-haspopup"))==="menu"&&(We.preventDefault(),We.stopPropagation(),Ke.click());break;case We.key===wr.QP.ENTER:case We.key===wr.QP.SPACE:We.preventDefault(),We.stopPropagation(),Ke==null||Ke.click();break}},[qe,be,ke,we,re]),rt=(0,P.useCallback)(function(We){be.some(function(Ke){return Ke.element===We.target})&&(de==null||de(We))},[be,de]);return P.createElement(ca.Provider,{value:Ie},ge({role:"menubar",tabIndex:0,onFocus:Be,onBlur:He,onKeyDown:ze,onClick:rt,"aria-activedescendant":b()(ke)?void 0:be[ke].element.id,"aria-orientation":re?"vertical":void 0},Le))}var Sl=H(82108),Hn=H.n(Sl),Kn;(function(G){G.HEIGHT="height",G.WIDTH="width"})(Kn||(Kn={}));var yu=function(Z){return Yr()(Z,"offsetHeight")},Iu={height:["marginTop","marginBottom"],width:["marginLeft","marginRight"]};function Qt(G,Z){var re=Yr()(Z,"offset"+Hn()(G)),ge=Iu[G];return re+parseInt(xi(Z,ge[0]),10)+parseInt(xi(Z,ge[1]),10)}function Tl(G,Z){var re=Yr()(G,"scroll"+Hn()(Z));return re+"px"}var jn=P.forwardRef(function(G,Z){var re=G.className,ge=G.timeout,de=ge===void 0?300:ge,Ie=G.dimension,Se=Ie===void 0?Kn.HEIGHT:Ie,be=G.exitedClassName,ke=G.exitingClassName,we=G.enteredClassName,Le=G.enteringClassName,Be=G.getDimensionValue,He=Be===void 0?Qt:Be,je=G.onEnter,qe=G.onEntering,ze=G.onEntered,rt=G.onExit,We=G.onExiting,Ke=(0,W.Z)(G,["className","timeout","dimension","exitedClassName","exitingClassName","enteredClassName","enteringClassName","getDimensionValue","onEnter","onEntering","onEntered","onExit","onExiting"]),st=(0,s.Z)("anim"),pt=st.prefix,Ct=st.merge,$e=typeof Se=="function"?Se():Se,lt=(0,P.useCallback)(function(Rt){es(Rt,$e,0)},[$e]),mt=(0,P.useCallback)(function(Rt){es(Rt,$e,Tl(Rt,$e))},[$e]),dt=(0,P.useCallback)(function(Rt){es(Rt,$e,"auto")},[$e]),At=(0,P.useCallback)(function(Rt){var jt=He?He($e,Rt):0;es(Rt,$e,jt+"px")},[$e,He]),wt=(0,P.useCallback)(function(Rt){yu(Rt),es(Rt,$e,0)},[$e]);return P.createElement(o.ZP,(0,k.Z)({},Ke,{ref:Z,timeout:de,className:Ct(re,pt({"collapse-horizontal":$e==="width"})),exitedClassName:be||pt("collapse"),exitingClassName:ke||pt("collapsing"),enteredClassName:we||pt("collapse","in"),enteringClassName:Le||pt("collapsing"),onEnter:(0,yi.Z)(lt,je),onEntering:(0,yi.Z)(mt,qe),onEntered:(0,yi.Z)(dt,ze),onExit:(0,yi.Z)(At,rt),onExiting:(0,yi.Z)(wt,We)}))});jn.displayName="Collapse",jn.propTypes=(0,k.Z)({},o.f4,{dimension:L().any,getDimensionValue:L().func});const za=jn;var Rl,bc,Oc,wl,Bc=P.forwardRef(function(G,Z){var re=G.className,ge=G.classPrefix,de=ge===void 0?"dropdown-menu":ge,Ie=G.open,Se=(0,W.Z)(G,["className","classPrefix","open"]),be=(0,s.Z)(de),ke=be.withClassPrefix,we=be.merge,Le=be.prefix,Be=we(re,ke());return P.createElement(za,{in:Ie,exitedClassName:Le(Rl||(Rl=(0,_e.Z)(["collapse-out"]))),exitingClassName:Le(bc||(bc=(0,_e.Z)(["collapsing"]))),enteredClassName:Le(Oc||(Oc=(0,_e.Z)(["collapse-in"]))),enteringClassName:Le(wl||(wl=(0,_e.Z)(["collapsing"])))},function(He,je){var qe=He.className,ze=(0,W.Z)(He,["className"]);return P.createElement("ul",(0,k.Z)({ref:u(Z,je),role:"group",className:Jr()(Be,qe)},Se,ze))})});Bc.displayName="Sidenav.Dropdown.Collapse",Bc.propTypes={className:L().string,children:L().node,classPrefix:L().string,open:L().bool};const Fo=Bc;var _s;(function(G){G[G.Show=0]="Show",G[G.Hide=1]="Hide"})(_s||(_s={}));var ht=P.createContext(null);ht.displayName="Disclosure.Context";const Zs=ht;function Wn(G){var Z=(0,P.useContext)(Zs);if(!Z)throw new Error("<"+G+"> component must be rendered within a <Disclosure>");return Z}function Nc(G){var Z=G.children,re=(0,P.useRef)(null),ge=Wn(Nc.displayName),de=ge[0].open,Ie=ge[1],Se=ge[2].onToggle,be=(0,P.useCallback)(function(Le){de?(Ie({type:_s.Hide}),Se==null||Se(!1,Le)):(Ie({type:_s.Show}),Se==null||Se(!0,Le))},[de,Ie,Se]),ke=(0,P.useCallback)(function(Le){be(Le)},[be]),we=(0,P.useCallback)(function(Le){switch(Le.key){case wr.QP.ENTER:case wr.QP.SPACE:Le.preventDefault(),Le.stopPropagation(),be(Le);break}},[be]);return Z({role:"button","aria-expanded":de,onClick:ke,onKeyDown:we,open:de},re)}Nc.displayName="Disclosure.Button";const Su=Nc;function Qo(G){var Z=G.children,re=(0,P.useRef)(null),ge=Wn(Qo.displayName),de=ge[0].open;return Z({open:de},re)}Qo.displayName="Disclosure.Content";const Tu=Qo;var Vn={open:!1};function Go(G,Z){switch(Z.type){case _s.Show:return(0,k.Z)({},G,{open:!0});case _s.Hide:return(0,k.Z)({},G,{open:!1})}return G}function qa(G){var Z=G.children,re=G.open,ge=G.defaultOpen,de=ge===void 0?!1:ge,Ie=G.hideOnClickOutside,Se=Ie===void 0?!1:Ie,be=G.onToggle,ke=(0,P.useReducer)(Go,(0,k.Z)({},Vn,{open:de})),we=ke[0].open,Le=ke[1],Be=(0,P.useRef)(null),He=re!=null?re:we;ko({enabled:Se,isOutside:function(ze){var rt;return!((rt=Be.current)!==null&&rt!==void 0&&rt.contains(ze.target))},handle:function(){return Le({type:_s.Hide})}});var je=(0,P.useMemo)(function(){return[{open:He},Le,{onToggle:be}]},[He,Le,be]);return P.createElement(Zs.Provider,{value:je},Z({open:He},Be))}qa.Button=Su,qa.Content=Tu;const Xi=qa;var Ll,Dl,ha=P.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?"li":re,de=G.children,Ie=G.disabled,Se=G.className,be=G.style,ke=G.classPrefix,we=ke===void 0?"dropdown-item":ke,Le=G.tabIndex,Be=G.icon,He=G.title,je=G.eventKey,qe=G.onClick,ze=G.onSelect,rt=(0,W.Z)(G,["as","children","disabled","className","style","classPrefix","tabIndex","icon","title","eventKey","onClick","onSelect"]),We=(0,qt.Z)("DropdownMenu"),Ke=We.rtl,st=(0,s.Z)(we),pt=st.merge,Ct=st.withClassPrefix,$e=st.prefix,lt=(0,P.useContext)(si);if(!lt)throw new Error("<SidenavDropdownMenu> component is not supposed to be used standalone. Use <Dropdown.Item> inside <Sidenav> instead.");var mt=lt.openKeys,dt=mt===void 0?[]:mt,At=lt.onOpenChange,wt=lt.onSelect,Rt=(0,P.useCallback)(function(Xt){Ie||(ze==null||ze(je,Xt),wt==null||wt(je,Xt))},[Ie,ze,wt,je]),jt={onClick:(0,yi.Z)(Rt,qe)},or=Ke?Ft.Z:Mt.Z;return P.createElement(Xi,{open:!b()(je)&&dt.includes(je),onToggle:function(hr,Nr){return At==null?void 0:At(je,Nr)}},function(Xt){var hr=Xt.open,Nr=pt(Se,$e("submenu"),$e("pull-"+(Ke?"left":"right")),$e(hr?"expand":"collapse"),Ct({"with-icon":Be,disabled:Ie}));return P.createElement(ge,(0,k.Z)({ref:Z},rt,{tabIndex:Ie?-1:Le,style:be,className:Nr},jt),P.createElement(Xi.Button,null,function(ur){return P.createElement("button",(0,k.Z)({className:$e(Ll||(Ll=(0,_e.Z)(["toggle"]))),onClick:Rt},Es()(ur,["open"])),Be&&P.cloneElement(Be,{className:$e("menu-icon")}),He,P.createElement(or,{className:$e(Dl||(Dl=(0,_e.Z)(["toggle-icon"])))}),P.createElement(R,null))}),P.createElement(Xi.Content,null,function(ur){var Vt=ur.open;return P.createElement(Fo,{open:Vt},de)}))})});ha.displayName="Sidenav.Dropdown.Menu",ha.propTypes={as:L().elementType,expanded:L().bool,disabled:L().bool,onSelect:L().func,onClick:L().func,icon:L().node,eventKey:L().any,className:L().string,style:L().object,children:L().node,classPrefix:L().string,tabIndex:L().number,title:L().node,onMouseOver:L().func,onMouseOut:L().func};const Us=ha;var Pc,wa,La=P.forwardRef(function(G,Z){var re=G.onToggle,ge=G.eventKey,de=G.title,Ie=G.activeKey,Se=G.onSelect,be=G.classPrefix,ke=be===void 0?"dropdown-menu":be,we=G.children,Le=(0,W.Z)(G,["onToggle","eventKey","title","activeKey","onSelect","classPrefix","children"]),Be=(0,P.useContext)(yn),He=(0,P.useContext)(si),je=(0,qt.Z)("DropdownMenu"),qe=je.rtl,ze=(0,P.useCallback)(function(ur,Vt){re==null||re(ge,Vt)},[ge,re]),rt=(0,s.Z)(ke),We=rt.merge,Ke=rt.prefix,st=rt.withClassPrefix,pt=(0,s.Z)("dropdown-menu"),Ct=pt.withClassPrefix,$e=pt.merge,lt=(0,s.Z)("dropdown-item"),mt=lt.merge,dt=lt.withClassPrefix,At=lt.prefix;if(!Be){var wt=We(G.className,st());return P.createElement(yn.Provider,{value:{activeKey:Ie,onSelect:Se}},P.createElement(Hi,{vertical:!0,onActivateItem:function(Vt){var yr=Vt.target.dataset,Zt=yr.eventKey,Ai=yr.eventKeyType,ti=Ai==="number"?Number(Zt):Zt;Se==null||Se(ti,Vt)}},function(ur,Vt){return P.createElement("ul",(0,k.Z)({ref:u(Vt,Z),className:wt},ur,Le),we)}))}if(He!=null&&He.expanded)return P.createElement(Us,Es()(G,"classPrefix"));var Rt=Es()(Le,["trigger"]),jt=Rt.icon,or=Rt.className,Xt=Rt.disabled,hr=(0,W.Z)(Rt,["icon","className","disabled"]),Nr=qe?Ft.Z:Mt.Z;return P.createElement(Br,{openMenuOn:["mouseover","click"],renderMenuButton:function(Vt,yr){var Zt=Vt.open,Ai=(0,W.Z)(Vt,["open"]);return P.createElement(xo,{disabled:Xt},function(ti,ci){var ri=ti.selected,Cs=ti.active,Pn=(0,W.Z)(ti,["selected","active"]),Li=mt(or,At("pull-"+(qe?"left":"right")),At(Pc||(Pc=(0,_e.Z)(["toggle"]))),dt({"with-icon":jt,open:Zt,active:ri,disabled:Xt,focus:Cs}));return P.createElement("div",(0,k.Z)({ref:u(yr,ci),className:Li,"data-event-key":ge,"data-event-key-type":typeof ge},Pn,Es()(Ai,["role"])),jt&&P.cloneElement(jt,{className:Ke("menu-icon")}),de,P.createElement(Nr,{className:Ke(wa||(wa=(0,_e.Z)(["toggle-icon"])))}))})},renderMenuPopup:function(Vt,yr){var Zt=Vt.open,Ai=(0,W.Z)(Vt,["open"]),ti=$e(or,Ct());return P.createElement("ul",(0,k.Z)({ref:yr,className:ti,hidden:!Zt},Ai,hr),we)},onToggleMenu:ze},function(ur,Vt){var yr=ur.open,Zt=(0,W.Z)(ur,["open"]),Ai=mt(or,dt({disabled:Xt,open:yr,submenu:!0}));return P.createElement("li",(0,k.Z)({ref:u(Z,Vt),className:Ai},Zt))})});La.displayName="Dropdown.Menu",La.propTypes={active:L().bool,activeKey:L().any,className:L().string,children:L().node,icon:L().any,classPrefix:L().string,pullLeft:L().bool,title:L().node,open:L().bool,trigger:L().oneOf(["click","hover"]),eventKey:L().any,expanded:L().bool,collapsible:L().bool,onSelect:L().func,onToggle:L().func};const Ru=La;function fi(G){return(0,P.useCallback)(function(Z,re){return G==="li"?re?P.createElement("li",{role:"none presentation"},P.createElement(re,Z)):P.createElement(G,Z):P.createElement("li",{role:"none presentation"},P.createElement(G,Z))},[G])}var xc=P.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?"li":re,de=G.active,Ie=G.children,Se=G.disabled,be=G.divider,ke=G.panel,we=G.className,Le=G.style,Be=G.classPrefix,He=Be===void 0?"dropdown-item":Be,je=G.icon,qe=G.eventKey,ze=G.onClick,rt=G.onSelect,We=(0,W.Z)(G,["as","active","children","disabled","divider","panel","className","style","classPrefix","icon","eventKey","onClick","onSelect"]),Ke=(0,P.useContext)(si),st=(0,P.useContext)(yn);if(!Ke||!st)throw new Error("<SidenavDropdownItem> component is not supposed to be used standalone. Use <Dropdown.Item> within <Sidenav> instead.");var pt=Ke.activeKey,Ct=Ke.onSelect,$e=(0,P.useContext)(Vr),lt=(0,s.Z)(He),mt=lt.merge,dt=lt.withClassPrefix,At=lt.prefix,wt=de!=null?de:!b()(qe)&&(U(qe,pt)||U($e==null?void 0:$e.activeKey,qe)),Rt=mt(we,dt({"with-icon":je,active:wt,disabled:Se})),jt=(0,P.useCallback)(function(hr){var Nr;Se||(rt==null||rt(qe,hr),(Nr=st.onSelect)===null||Nr===void 0||Nr.call(st,qe,hr),Ct==null||Ct(qe,hr))},[Se,rt,Ct,qe,st]),or={onClick:(0,yi.Z)(jt,ze)},Xt=fi(ge);return be?Xt((0,k.Z)({ref:Z,role:"separator",style:Le,className:mt(At("divider"),we)},We)):ke?Xt((0,k.Z)({ref:Z,role:"none presentation",style:Le,className:mt(At("panel"),we)},We,{children:Ie})):Xt((0,k.Z)({ref:Z},We,{style:Le,className:Rt,"aria-current":wt||void 0},or,{children:P.createElement(P.Fragment,null,je&&P.cloneElement(je,{className:At("menu-icon")}),Ie,P.createElement(R,null))}),S)});xc.displayName="Sidenav.Dropdown.Item",xc.propTypes={as:L().elementType,expanded:L().bool,active:L().bool,divider:L().bool,panel:L().bool,disabled:L().bool,submenu:L().element,onSelect:L().func,onClick:L().func,icon:L().node,eventKey:L().any,className:L().string,style:L().object,children:L().node,classPrefix:L().string,tabIndex:L().number,title:L().node,onMouseOver:L().func,onMouseOut:L().func};const Mc=xc;function fa(G){var Z=(0,P.useRef)();return Z.current||(Z.current=oa()("internal://"+G)),(0,P.useDebugValue)(Z.current),Z.current}var kc={items:[]},Ho;(function(G){G[G.RegisterItem=0]="RegisterItem",G[G.UnregisterItem=1]="UnregisterItem",G[G.UpdateItem=2]="UpdateItem"})(Ho||(Ho={}));function bl(G,Z){switch(G===void 0&&(G=kc),Z.type){case Ho.RegisterItem:return G.items.find(function(re){return re.id===Z.payload.id})?(0,k.Z)({},G,{items:G.items.map(function(re){return re.id===Z.payload.id?(0,k.Z)({},re,{props:(0,k.Z)({},re.props,{selected:Z.payload.props.selected})}):re})}):(0,k.Z)({},G,{items:[].concat(G.items,[{id:Z.payload.id,props:Z.payload.props}])});case Ho.UnregisterItem:return(0,k.Z)({},G,{items:G.items.filter(function(re){return re.id!==Z.payload.id})});default:return G}}var Aa=P.forwardRef(function(G,Z){var re=G.classPrefix,ge=re===void 0?"dropdown-item":re,de=G.className,Ie=G.active,Se=G.eventKey,be=G.onSelect,ke=G.icon,we=G.as,Le=we===void 0?"li":we,Be=G.divider,He=G.panel,je=G.children,qe=G.disabled,ze=(0,W.Z)(G,["classPrefix","className","active","eventKey","onSelect","icon","as","divider","panel","children","disabled"]),rt=fa("DropdownItem"),We=(0,P.useContext)(Vr),Ke=(0,P.useContext)(yn),st=(0,s.Z)(ge),pt=st.merge,Ct=st.withClassPrefix,$e=st.prefix,lt=(0,P.useCallback)(function(Vt){var yr;be==null||be(Se,Vt),Ke==null||(yr=Ke.onSelect)===null||yr===void 0||yr.call(Ke,Se,Vt)},[be,Se,Ke]),mt=(0,P.useContext)(si),dt=(0,P.useContext)(Oi),At=(0,P.useContext)(Zs),wt=At!=null?At:[],Rt=wt[1],jt=(0,P.useCallback)(function(Vt){Rt==null||Rt({type:_s.Hide}),lt==null||lt(Vt)},[Rt,lt]),or=Ie||!b()(Se)&&(U(Ke==null?void 0:Ke.activeKey,Se)||U(We==null?void 0:We.activeKey,Se)),Xt=Ke==null?void 0:Ke.dispatch;(0,P.useEffect)(function(){if(Xt)return Xt({type:Ho.RegisterItem,payload:{id:rt,props:{selected:or}}}),function(){Xt({type:Ho.UnregisterItem,payload:{id:rt}})}},[rt,or,Xt]);var hr=fi(Le);if(mt!=null&&mt.expanded)return P.createElement(Mc,(0,k.Z)({ref:Z},G));if(Be)return hr((0,k.Z)({ref:Z,role:"separator",className:pt($e("divider"),de)},ze));if(He)return hr((0,k.Z)({ref:Z,className:pt($e("panel"),de),children:je},ze));if(dt){var Nr=pt(de,Ct({"with-icon":ke,disabled:qe,divider:Be,panel:He,active:or})),ur={"data-event-key":Se};return!b()(Se)&&typeof Se!="string"&&(ur["data-event-key-type"]=typeof Se),P.createElement("li",null,P.createElement(S,(0,k.Z)({ref:Z,className:Nr,"aria-current":or||void 0},ur,ze,{as:Le,onClick:(0,yi.Z)(jt,ze.onClick)}),ke&&P.cloneElement(ke,{className:$e("menu-icon")}),je))}return P.createElement(xo,{selected:or,disabled:qe,onActivate:lt},function(Vt,yr){var Zt=Vt.selected,Ai=Vt.active,ti=(0,W.Z)(Vt,["selected","active"]),ci=pt(de,Ct({"with-icon":ke,active:Zt,disabled:qe,focus:Ai,divider:Be,panel:He})),ri={"data-event-key":Se};return!b()(Se)&&typeof Se!="string"&&(ri["data-event-key-type"]=typeof Se),hr((0,k.Z)({ref:u(Z,yr),className:ci},ti,ri,ze,{children:P.createElement(P.Fragment,null,ke&&P.cloneElement(ke,{className:$e("menu-icon")}),je)}))})});Aa.displayName="Dropdown.Item",Aa.propTypes={as:L().elementType,divider:L().bool,panel:L().bool,trigger:L().oneOfType([L().array,L().oneOf(["click","hover"])]),open:Hr(L().bool),active:L().bool,disabled:L().bool,pullLeft:Hr(L().bool),submenu:L().element,onSelect:L().func,onClick:L().func,icon:L().node,eventKey:L().any,className:L().string,style:L().object,children:L().node,classPrefix:L().string,tabIndex:L().number};const wu=Aa;var Da=H(28801),Ol=H(70095);function Lu(G){var Z=(0,qt.Z)("Dropdown"),re=Z.rtl;return(0,P.useMemo)(function(){switch(!0){case/^top/.test(G):return Ol.Z;case/^right/.test(G):return re?Ft.Z:Mt.Z;case/^left/.test(G):return re?Mt.Z:Ft.Z;case/^bottom/.test(G):default:return Da.Z}},[G,re])}const Du=Lu;var ai=P.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?Fe:re,de=G.className,Ie=G.classPrefix,Se=Ie===void 0?"dropdown-toggle":Ie,be=G.renderToggle,ke=G.children,we=G.icon,Le=G.noCaret,Be=G.placement,He=Be===void 0?"bottomStart":Be,je=(0,W.Z)(G,["as","className","classPrefix","renderToggle","children","icon","noCaret","placement"]),qe=(0,P.useContext)(si),ze=(0,P.useContext)(Vr),rt=ze.withinNav,We=(0,s.Z)(Se),Ke=We.prefix,st=We.withClassPrefix,pt=We.merge,Ct=pt(de,st({"no-caret":Le})),$e=!!qe,lt=Du($e?"bottomStart":He),mt=P.createElement(ge,(0,k.Z)({appearance:rt?"subtle":void 0},je,{ref:Z,className:Ct}),we&&P.cloneElement(we,{className:Ke("icon")}),ke,Le?null:P.createElement(lt,{className:Ke("caret")}));return be?be(je,Z):mt});ai.displayName="DropdownToggle",ai.propTypes={className:L().string,children:L().node,icon:L().node,classPrefix:L().string,noCaret:L().bool,as:L().elementType,renderToggle:L().func,placement:L().oneOf(["bottomStart","bottomEnd","topStart","topEnd","leftStart","rightStart","leftEnd","rightEnd"])};const Xa=ai;var Za=P.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?"div":re,de=G.title,Ie=G.children,Se=G.className,be=G.menuStyle,ke=G.disabled,we=G.renderTitle,Le=G.renderToggle,Be=G.classPrefix,He=Be===void 0?"dropdown":Be,je=G.placement,qe=je===void 0?"bottomStart":je,ze=G.toggleClassName,rt=G.icon,We=G.eventKey,Ke=G.toggleAs,st=G.noCaret,pt=G.style,Ct=G.onOpen,$e=G.onClose,lt=G.open,mt=G.onToggle,dt=(0,W.Z)(G,["as","title","children","className","menuStyle","disabled","renderTitle","renderToggle","classPrefix","placement","toggleClassName","icon","eventKey","toggleAs","noCaret","style","onOpen","onClose","open","onToggle"]),At=(0,P.useContext)(si),wt=(0,P.useContext)(yn),Rt=(0,s.Z)(He),jt=Rt.merge,or=Rt.withClassPrefix,Xt=fa("SidenavDropdown"),hr=We!=null?We:Xt;if(!At||!wt)throw new Error("<SidenavDropdown> component is not supposed to be used standalone. Use <Dropdown> inside <Sidenav> instead.");var Nr=At.openKeys,ur=Nr===void 0?[]:Nr,Vt=At.onOpenChange,yr=wt.hasSelectedItem,Zt=(0,P.useCallback)(function(ti,ci){ti?$e==null||$e():Ct==null||Ct(),mt==null||mt(ti),Vt==null||Vt(hr,ci)},[$e,Ct,mt,hr,Vt]),Ai=lt!=null?lt:ur.includes(hr);return P.createElement(Xi,{open:Ai,onToggle:Zt},function(ti,ci){var ri,Cs=ti.open,Pn=jt(Se,or((ri={},ri["placement-"+ie()(Ra(qe))]=qe,ri[Cs?"expand":"collapse"]=!0,ri.disabled=ke,ri["selected-within"]=yr,ri["no-caret"]=st,ri)));return P.createElement(ge,(0,k.Z)({ref:u(Z,ci),style:pt,className:Pn},dt,{"data-event-key":We}),P.createElement(Xi.Button,null,function(Li,Zi){return P.createElement(Xa,(0,k.Z)({ref:Zi,as:Ke,noCaret:st,className:ze,renderToggle:Le,icon:rt,placement:qe},Es()(Li,["open"])),de)}),P.createElement(Xi.Content,null,function(Li){var Zi=Li.open;return P.createElement(Fo,{open:Zi,style:be},Ie)}))})});Za.displayName="Sidenav.Dropdown",Za.propTypes={activeKey:L().any,classPrefix:L().string,placement:L().oneOf(wr.aR),title:L().node,disabled:L().bool,icon:L().node,menuStyle:L().object,className:L().string,toggleClassName:L().string,children:L().node,tabIndex:L().number,open:Hr(L().bool),eventKey:L().any,as:L().elementType,toggleAs:L().elementType,noCaret:L().bool,style:L().object,onClose:L().func,onOpen:L().func,onToggle:L().func,onMouseEnter:L().func,onMouseLeave:L().func,onContextMenu:L().func,onClick:L().func,renderTitle:Hr(L().func),renderToggle:L().func};const ne=Za;var Fs=P.forwardRef(function(G,Z){var re=G.activeKey,ge=G.onSelect,de=(0,W.Z)(G,["activeKey","onSelect"]),Ie=de.as,Se=Ie===void 0?"div":Ie,be=de.title,ke=de.onClose,we=de.onOpen,Le=de.onToggle,Be=de.eventKey,He=de.trigger,je=He===void 0?"click":He,qe=de.placement,ze=qe===void 0?"bottomStart":qe,rt=de.toggleAs,We=de.toggleClassName,Ke=de.classPrefix,st=Ke===void 0?"dropdown":Ke,pt=de.className,Ct=de.disabled,$e=de.children,lt=de.menuStyle,mt=de.style,dt=(0,W.Z)(de,["as","title","onClose","onOpen","onToggle","eventKey","trigger","placement","toggleAs","toggleClassName","classPrefix","className","disabled","children","menuStyle","style"]),At=(0,P.useContext)(Vr),wt=At.onSelect,Rt=(0,P.useCallback)(function(qr,Pr){ge==null||ge(qr,Pr),wt==null||wt(qr,Pr)},[ge,wt]),jt=(0,s.Z)(st),or=jt.merge,Xt=jt.withClassPrefix,hr=jt.prefix,Nr=(0,s.Z)("dropdown-menu"),ur=Nr.withClassPrefix,Vt=Nr.merge,yr=(0,s.Z)("nav-item"),Zt=yr.withClassPrefix,Ai=yr.merge,ti=(0,P.useMemo)(function(){if(!!je){var qr={hover:"mouseover",click:"click",contextMenu:"contextmenu"};return Array.isArray(je)?je.map(function(Pr){return qr[Pr]}):[qr[je]]}},[je]),ci=(0,P.useContext)(ca),ri=(0,P.useContext)(si),Cs=(0,P.useContext)(Oi),Pn=(0,P.useReducer)(bl,kc),Li=Pn[0].items,Zi=Pn[1],Yn=(0,P.useMemo)(function(){return Li.some(function(qr){return qr.props.selected})},[Li]),Jn=(0,P.useMemo)(function(){return{activeKey:re,onSelect:Rt,hasSelectedItem:Yn,dispatch:Zi}},[re,Rt,Yn,Zi]);if(ri!=null&&ri.expanded)return P.createElement(yn.Provider,{value:Jn},P.createElement(ne,(0,k.Z)({ref:Z},de)));if(Cs)return P.createElement(yn.Provider,{value:Jn},P.createElement(Xi,{hideOnClickOutside:!0},function(qr,Pr){var ft,ii=qr.open,Ki=or(pt,Xt((ft={},ft["placement-"+ie()(Ra(ze))]=!!ze,ft.disabled=Ct,ft.open=ii,ft)));return P.createElement(Se,{ref:u(Z,Pr),className:Ki,style:mt},P.createElement(Xi.Button,null,function(jr,zn){return P.createElement(Xa,(0,k.Z)({ref:zn,as:rt,className:We,placement:ze,disabled:Ct},Es()(jr,["open"]),dt),be)}),P.createElement(Xi.Content,null,function(jr,zn){var ys=jr.open,ga=Vt(pt,ur());return P.createElement("ul",{ref:zn,className:ga,style:lt,hidden:!ys},$e)}))}));var _o=function(Pr,ft){return P.createElement(Xa,(0,k.Z)({ref:ft,as:rt,className:We,placement:ze,disabled:Ct},Es()(Pr,["open"]),Es()(dt,["data-testid"])),be)};return ci&&(_o=function(Pr,ft){return P.createElement(xo,{disabled:Ct},function(ii,Ki){var jr=ii.active,zn=(0,W.Z)(ii,["active"]);return P.createElement(Xa,(0,k.Z)({ref:u(ft,Ki),as:rt,className:Ai(We,Zt({focus:jr}))},Pr,Es()(zn,["onClick"]),Es()(dt,"data-testid")),be)})}),P.createElement(yn.Provider,{value:Jn},P.createElement(Br,{menuButtonText:be,renderMenuButton:_o,openMenuOn:ti,renderMenuPopup:function(Pr,ft){var ii=Pr.open,Ki=(0,W.Z)(Pr,["open"]),jr=Vt(pt,ur({})),zn=!!ri;return P.createElement("ul",(0,k.Z)({ref:ft,className:jr,style:lt,hidden:!ii},Ki),zn&&P.createElement("div",{className:hr("header")},be),$e)},onToggleMenu:function(Pr,ft){Le==null||Le(Pr),ri==null||ri.onOpenChange(Be,ft),Pr?we==null||we():ke==null||ke()}},function(qr,Pr){var ft,ii=qr.open,Ki=(0,W.Z)(qr,["open"]),jr=or(pt,Xt((ft={},ft["placement-"+ie()(Ra(ze))]=!!ze,ft.disabled=Ct,ft.open=ii,ft.submenu=!!ci,ft["selected-within"]=Yn,ft)));return P.createElement(Se,(0,k.Z)({ref:u(Z,Pr),className:jr},Ki,vu()(dt,["data-testid"]),{style:mt}))}))});Fs.Item=wu,Fs.Menu=Ru,Fs.displayName="Dropdown",Fs.propTypes={activeKey:L().any,classPrefix:L().string,trigger:L().oneOfType([L().array,L().oneOf(["click","hover","contextMenu"])]),placement:L().oneOf(wr.aR),title:L().node,disabled:L().bool,icon:L().node,menuStyle:L().object,className:L().string,toggleClassName:L().string,children:L().node,open:Hr(L().bool),eventKey:L().any,as:L().elementType,toggleAs:L().elementType,noCaret:L().bool,style:L().object,onClose:L().func,onOpen:L().func,onToggle:L().func,onSelect:L().func,onMouseEnter:L().func,onMouseLeave:L().func,onContextMenu:L().func,onClick:L().func,renderToggle:L().func};const $a=Fs;function $s(G){var Z=(0,P.useRef)();return G||Z}var ba=P.forwardRef(function(G,Z){var re=G.as,ge=re===void 0?"div":re,de=G.classPrefix,Ie=de===void 0?"nav":de,Se=G.appearance,be=Se===void 0?"default":Se,ke=G.vertical,we=G.justified,Le=G.reversed,Be=G.pullRight,He=G.className,je=G.children,qe=G.activeKey,ze=G.onSelect,rt=(0,W.Z)(G,["as","classPrefix","appearance","vertical","justified","reversed","pullRight","className","children","activeKey","onSelect"]),We=(0,P.useContext)(si),Ke=(0,P.useContext)(Oi),st=$s(Z),pt=(0,s.Z)(Ie),Ct=pt.withClassPrefix,$e=pt.merge,lt=pt.rootPrefix,mt=pt.prefix,dt=$e(He,lt({"navbar-nav":Ke,"navbar-right":Be,"sidenav-nav":We}),Ct(be,{horizontal:Ke||!ke&&!We,vertical:ke||We,justified:we,reversed:Le})),At=We||{},wt=At.activeKey,Rt=At.onSelect,jt=Rt===void 0?ze:Rt,or=qe!=null?qe:wt;if(We!=null&&We.expanded)return P.createElement(Vr.Provider,{value:{withinNav:!0,activeKey:or,onSelect:ze!=null?ze:jt}},P.createElement("ul",(0,k.Z)({ref:Z,className:dt},rt),je));var Xt=be!=="default";return We?P.createElement(Vr.Provider,{value:{withinNav:!0,activeKey:or,onSelect:ze!=null?ze:jt}},P.createElement(Hi,{vertical:!!We},function(hr,Nr){return P.createElement(ge,(0,k.Z)({ref:Nr},rt,{className:dt},hr),je)})):P.createElement(Vr.Provider,{value:{withinNav:!0,activeKey:or,onSelect:ze!=null?ze:jt}},P.createElement(ge,(0,k.Z)({},rt,{ref:st,className:dt}),je,Xt&&P.createElement("div",{className:mt("bar")})))});ba.Dropdown=$a,ba.Item=zr,ba.displayName="Nav",ba.propTypes={classPrefix:L().string,className:L().string,children:L().node,appearance:L().oneOf(["default","subtle","tabs"]),reversed:L().bool,justified:L().bool,vertical:L().bool,pullRight:L().bool,activeKey:L().any,onSelect:L().func};const Bl=ba},78440:Oe=>{(function(he,H){Oe.exports=H()})(self,function(){return(()=>{"use strict";var he={775:(k,W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.FitAddon=void 0;var P=function(){function E(){}return E.prototype.activate=function(L){this._terminal=L},E.prototype.dispose=function(){},E.prototype.fit=function(){var L=this.proposeDimensions();if(L&&this._terminal){var O=this._terminal._core;this._terminal.rows===L.rows&&this._terminal.cols===L.cols||(O._renderService.clear(),this._terminal.resize(L.cols,L.rows))}},E.prototype.proposeDimensions=function(){if(this._terminal&&this._terminal.element&&this._terminal.element.parentElement){var L=this._terminal._core;if(L._renderService.dimensions.actualCellWidth!==0&&L._renderService.dimensions.actualCellHeight!==0){var O=window.getComputedStyle(this._terminal.element.parentElement),b=parseInt(O.getPropertyValue("height")),w=Math.max(0,parseInt(O.getPropertyValue("width"))),g=window.getComputedStyle(this._terminal.element),D=b-(parseInt(g.getPropertyValue("padding-top"))+parseInt(g.getPropertyValue("padding-bottom"))),T=w-(parseInt(g.getPropertyValue("padding-right"))+parseInt(g.getPropertyValue("padding-left")))-L.viewport.scrollBarWidth;return{cols:Math.max(2,Math.floor(T/L._renderService.dimensions.actualCellWidth)),rows:Math.max(1,Math.floor(D/L._renderService.dimensions.actualCellHeight))}}}},E}();W.FitAddon=P}},H={};return function k(W){if(H[W])return H[W].exports;var P=H[W]={exports:{}};return he[W](P,P.exports,k),P.exports}(775)})()})},77289:Oe=>{(function(he,H){if(!0)Oe.exports=H();else var k,W})(self,function(){return(()=>{"use strict";var he={4567:function(P,E,L){var O,b=this&&this.__extends||(O=function(o,s){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var l in u)Object.prototype.hasOwnProperty.call(u,l)&&(a[l]=u[l])},O(o,s)},function(o,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function a(){this.constructor=o}O(o,s),o.prototype=s===null?Object.create(s):(a.prototype=s.prototype,new a)});Object.defineProperty(E,"__esModule",{value:!0}),E.AccessibilityManager=void 0;var w=L(9042),g=L(6114),D=L(9924),T=L(3656),f=L(844),p=L(5596),_=L(9631),d=function(o){function s(a,u){var l=o.call(this)||this;l._terminal=a,l._renderService=u,l._liveRegionLineCount=0,l._charsToConsume=[],l._charsToAnnounce="",l._accessibilityTreeRoot=document.createElement("div"),l._accessibilityTreeRoot.setAttribute("role","document"),l._accessibilityTreeRoot.classList.add("xterm-accessibility"),l._rowContainer=document.createElement("div"),l._rowContainer.setAttribute("role","list"),l._rowContainer.classList.add("xterm-accessibility-tree"),l._rowElements=[];for(var A=0;A<l._terminal.rows;A++)l._rowElements[A]=l._createAccessibilityTreeNode(),l._rowContainer.appendChild(l._rowElements[A]);if(l._topBoundaryFocusListener=function(I){return l._onBoundaryFocus(I,0)},l._bottomBoundaryFocusListener=function(I){return l._onBoundaryFocus(I,1)},l._rowElements[0].addEventListener("focus",l._topBoundaryFocusListener),l._rowElements[l._rowElements.length-1].addEventListener("focus",l._bottomBoundaryFocusListener),l._refreshRowsDimensions(),l._accessibilityTreeRoot.appendChild(l._rowContainer),l._renderRowsDebouncer=new D.TimeBasedDebouncer(l._renderRows.bind(l)),l._refreshRows(),l._liveRegion=document.createElement("div"),l._liveRegion.classList.add("live-region"),l._liveRegion.setAttribute("aria-live","assertive"),l._accessibilityTreeRoot.appendChild(l._liveRegion),!l._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");return l._terminal.element.insertAdjacentElement("afterbegin",l._accessibilityTreeRoot),l.register(l._renderRowsDebouncer),l.register(l._terminal.onResize(function(I){return l._onResize(I.rows)})),l.register(l._terminal.onRender(function(I){return l._refreshRows(I.start,I.end)})),l.register(l._terminal.onScroll(function(){return l._refreshRows()})),l.register(l._terminal.onA11yChar(function(I){return l._onChar(I)})),l.register(l._terminal.onLineFeed(function(){return l._onChar(`
166
- `)})),l.register(l._terminal.onA11yTab(function(I){return l._onTab(I)})),l.register(l._terminal.onKey(function(I){return l._onKey(I.key)})),l.register(l._terminal.onBlur(function(){return l._clearLiveRegion()})),l.register(l._renderService.onDimensionsChange(function(){return l._refreshRowsDimensions()})),l._screenDprMonitor=new p.ScreenDprMonitor,l.register(l._screenDprMonitor),l._screenDprMonitor.setListener(function(){return l._refreshRowsDimensions()}),l.register((0,T.addDisposableDomListener)(window,"resize",function(){return l._refreshRowsDimensions()})),l}return b(s,o),s.prototype.dispose=function(){o.prototype.dispose.call(this),(0,_.removeElementFromParent)(this._accessibilityTreeRoot),this._rowElements.length=0},s.prototype._onBoundaryFocus=function(a,u){var l=a.target,A=this._rowElements[u===0?1:this._rowElements.length-2];if(l.getAttribute("aria-posinset")!==(u===0?"1":""+this._terminal.buffer.lines.length)&&a.relatedTarget===A){var I,R;if(u===0?(I=l,R=this._rowElements.pop(),this._rowContainer.removeChild(R)):(I=this._rowElements.shift(),R=l,this._rowContainer.removeChild(I)),I.removeEventListener("focus",this._topBoundaryFocusListener),R.removeEventListener("focus",this._bottomBoundaryFocusListener),u===0){var y=this._createAccessibilityTreeNode();this._rowElements.unshift(y),this._rowContainer.insertAdjacentElement("afterbegin",y)}else y=this._createAccessibilityTreeNode(),this._rowElements.push(y),this._rowContainer.appendChild(y);this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(u===0?-1:1),this._rowElements[u===0?1:this._rowElements.length-2].focus(),a.preventDefault(),a.stopImmediatePropagation()}},s.prototype._onResize=function(a){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(var u=this._rowContainer.children.length;u<this._terminal.rows;u++)this._rowElements[u]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[u]);for(;this._rowElements.length>a;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()},s.prototype._createAccessibilityTreeNode=function(){var a=document.createElement("div");return a.setAttribute("role","listitem"),a.tabIndex=-1,this._refreshRowDimensions(a),a},s.prototype._onTab=function(a){for(var u=0;u<a;u++)this._onChar(" ")},s.prototype._onChar=function(a){var u=this;this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==a&&(this._charsToAnnounce+=a):this._charsToAnnounce+=a,a===`
167
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=w.tooMuchOutput)),g.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout(function(){u._accessibilityTreeRoot.appendChild(u._liveRegion)},0))},s.prototype._clearLiveRegion=function(){this._liveRegion.textContent="",this._liveRegionLineCount=0,g.isMac&&(0,_.removeElementFromParent)(this._liveRegion)},s.prototype._onKey=function(a){this._clearLiveRegion(),this._charsToConsume.push(a)},s.prototype._refreshRows=function(a,u){this._renderRowsDebouncer.refresh(a,u,this._terminal.rows)},s.prototype._renderRows=function(a,u){for(var l=this._terminal.buffer,A=l.lines.length.toString(),I=a;I<=u;I++){var R=l.translateBufferLineToString(l.ydisp+I,!0),y=(l.ydisp+I+1).toString(),v=this._rowElements[I];v&&(R.length===0?v.innerText="\xA0":v.textContent=R,v.setAttribute("aria-posinset",y),v.setAttribute("aria-setsize",A))}this._announceCharacters()},s.prototype._refreshRowsDimensions=function(){if(this._renderService.dimensions.actualCellHeight){this._rowElements.length!==this._terminal.rows&&this._onResize(this._terminal.rows);for(var a=0;a<this._terminal.rows;a++)this._refreshRowDimensions(this._rowElements[a])}},s.prototype._refreshRowDimensions=function(a){a.style.height=this._renderService.dimensions.actualCellHeight+"px"},s.prototype._announceCharacters=function(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")},s}(f.Disposable);E.AccessibilityManager=d},3614:(P,E)=>{function L(g){return g.replace(/\r?\n/g,"\r")}function O(g,D){return D?"[200~"+g+"[201~":g}function b(g,D,T){g=O(g=L(g),T.decPrivateModes.bracketedPasteMode),T.triggerDataEvent(g,!0),D.value=""}function w(g,D,T){var f=T.getBoundingClientRect(),p=g.clientX-f.left-10,_=g.clientY-f.top-10;D.style.width="20px",D.style.height="20px",D.style.left=p+"px",D.style.top=_+"px",D.style.zIndex="1000",D.focus()}Object.defineProperty(E,"__esModule",{value:!0}),E.rightClickHandler=E.moveTextAreaUnderMouseCursor=E.paste=E.handlePasteEvent=E.copyHandler=E.bracketTextForPaste=E.prepareTextForTerminal=void 0,E.prepareTextForTerminal=L,E.bracketTextForPaste=O,E.copyHandler=function(g,D){g.clipboardData&&g.clipboardData.setData("text/plain",D.selectionText),g.preventDefault()},E.handlePasteEvent=function(g,D,T){g.stopPropagation(),g.clipboardData&&b(g.clipboardData.getData("text/plain"),D,T)},E.paste=b,E.moveTextAreaUnderMouseCursor=w,E.rightClickHandler=function(g,D,T,f,p){w(g,D,T),p&&f.rightClickSelect(g),D.value=f.selectionText,D.select()}},4774:(P,E)=>{var L,O,b,w;function g(T){var f=T.toString(16);return f.length<2?"0"+f:f}function D(T,f){return T<f?(f+.05)/(T+.05):(T+.05)/(f+.05)}Object.defineProperty(E,"__esModule",{value:!0}),E.contrastRatio=E.toPaddedHex=E.rgba=E.rgb=E.css=E.color=E.channels=void 0,function(T){T.toCss=function(f,p,_,d){return d!==void 0?"#"+g(f)+g(p)+g(_)+g(d):"#"+g(f)+g(p)+g(_)},T.toRgba=function(f,p,_,d){return d===void 0&&(d=255),(f<<24|p<<16|_<<8|d)>>>0}}(L=E.channels||(E.channels={})),(O=E.color||(E.color={})).blend=function(T,f){var p=(255&f.rgba)/255;if(p===1)return{css:f.css,rgba:f.rgba};var _=f.rgba>>24&255,d=f.rgba>>16&255,o=f.rgba>>8&255,s=T.rgba>>24&255,a=T.rgba>>16&255,u=T.rgba>>8&255,l=s+Math.round((_-s)*p),A=a+Math.round((d-a)*p),I=u+Math.round((o-u)*p);return{css:L.toCss(l,A,I),rgba:L.toRgba(l,A,I)}},O.isOpaque=function(T){return(255&T.rgba)==255},O.ensureContrastRatio=function(T,f,p){var _=w.ensureContrastRatio(T.rgba,f.rgba,p);if(_)return w.toColor(_>>24&255,_>>16&255,_>>8&255)},O.opaque=function(T){var f=(255|T.rgba)>>>0,p=w.toChannels(f),_=p[0],d=p[1],o=p[2];return{css:L.toCss(_,d,o),rgba:f}},O.opacity=function(T,f){var p=Math.round(255*f),_=w.toChannels(T.rgba),d=_[0],o=_[1],s=_[2];return{css:L.toCss(d,o,s,p),rgba:L.toRgba(d,o,s,p)}},(E.css||(E.css={})).toColor=function(T){switch(T.length){case 7:return{css:T,rgba:(parseInt(T.slice(1),16)<<8|255)>>>0};case 9:return{css:T,rgba:parseInt(T.slice(1),16)>>>0}}throw new Error("css.toColor: Unsupported css format")},function(T){function f(p,_,d){var o=p/255,s=_/255,a=d/255;return .2126*(o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4))+.7152*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.0722*(a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4))}T.relativeLuminance=function(p){return f(p>>16&255,p>>8&255,255&p)},T.relativeLuminance2=f}(b=E.rgb||(E.rgb={})),function(T){function f(_,d,o){for(var s=_>>24&255,a=_>>16&255,u=_>>8&255,l=d>>24&255,A=d>>16&255,I=d>>8&255,R=D(b.relativeLuminance2(l,I,A),b.relativeLuminance2(s,a,u));R<o&&(l>0||A>0||I>0);)l-=Math.max(0,Math.ceil(.1*l)),A-=Math.max(0,Math.ceil(.1*A)),I-=Math.max(0,Math.ceil(.1*I)),R=D(b.relativeLuminance2(l,I,A),b.relativeLuminance2(s,a,u));return(l<<24|A<<16|I<<8|255)>>>0}function p(_,d,o){for(var s=_>>24&255,a=_>>16&255,u=_>>8&255,l=d>>24&255,A=d>>16&255,I=d>>8&255,R=D(b.relativeLuminance2(l,I,A),b.relativeLuminance2(s,a,u));R<o&&(l<255||A<255||I<255);)l=Math.min(255,l+Math.ceil(.1*(255-l))),A=Math.min(255,A+Math.ceil(.1*(255-A))),I=Math.min(255,I+Math.ceil(.1*(255-I))),R=D(b.relativeLuminance2(l,I,A),b.relativeLuminance2(s,a,u));return(l<<24|A<<16|I<<8|255)>>>0}T.ensureContrastRatio=function(_,d,o){var s=b.relativeLuminance(_>>8),a=b.relativeLuminance(d>>8);if(D(s,a)<o)return a<s?f(_,d,o):p(_,d,o)},T.reduceLuminance=f,T.increaseLuminance=p,T.toChannels=function(_){return[_>>24&255,_>>16&255,_>>8&255,255&_]},T.toColor=function(_,d,o){return{css:L.toCss(_,d,o),rgba:L.toRgba(_,d,o)}}}(w=E.rgba||(E.rgba={})),E.toPaddedHex=g,E.contrastRatio=D},7239:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.ColorContrastCache=void 0;var L=function(){function O(){this._color={},this._rgba={}}return O.prototype.clear=function(){this._color={},this._rgba={}},O.prototype.setCss=function(b,w,g){this._rgba[b]||(this._rgba[b]={}),this._rgba[b][w]=g},O.prototype.getCss=function(b,w){return this._rgba[b]?this._rgba[b][w]:void 0},O.prototype.setColor=function(b,w,g){this._color[b]||(this._color[b]={}),this._color[b][w]=g},O.prototype.getColor=function(b,w){return this._color[b]?this._color[b][w]:void 0},O}();E.ColorContrastCache=L},5680:(P,E,L)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.ColorManager=E.DEFAULT_ANSI_COLORS=void 0;var O=L(4774),b=L(7239),w=O.css.toColor("#ffffff"),g=O.css.toColor("#000000"),D=O.css.toColor("#ffffff"),T=O.css.toColor("#000000"),f={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};E.DEFAULT_ANSI_COLORS=Object.freeze(function(){for(var _=[O.css.toColor("#2e3436"),O.css.toColor("#cc0000"),O.css.toColor("#4e9a06"),O.css.toColor("#c4a000"),O.css.toColor("#3465a4"),O.css.toColor("#75507b"),O.css.toColor("#06989a"),O.css.toColor("#d3d7cf"),O.css.toColor("#555753"),O.css.toColor("#ef2929"),O.css.toColor("#8ae234"),O.css.toColor("#fce94f"),O.css.toColor("#729fcf"),O.css.toColor("#ad7fa8"),O.css.toColor("#34e2e2"),O.css.toColor("#eeeeec")],d=[0,95,135,175,215,255],o=0;o<216;o++){var s=d[o/36%6|0],a=d[o/6%6|0],u=d[o%6];_.push({css:O.channels.toCss(s,a,u),rgba:O.channels.toRgba(s,a,u)})}for(o=0;o<24;o++){var l=8+10*o;_.push({css:O.channels.toCss(l,l,l),rgba:O.channels.toRgba(l,l,l)})}return _}());var p=function(){function _(d,o){this.allowTransparency=o;var s=d.createElement("canvas");s.width=1,s.height=1;var a=s.getContext("2d");if(!a)throw new Error("Could not get rendering context");this._ctx=a,this._ctx.globalCompositeOperation="copy",this._litmusColor=this._ctx.createLinearGradient(0,0,1,1),this._contrastCache=new b.ColorContrastCache,this.colors={foreground:w,background:g,cursor:D,cursorAccent:T,selectionTransparent:f,selectionOpaque:O.color.blend(g,f),ansi:E.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache}}return _.prototype.onOptionsChange=function(d){d==="minimumContrastRatio"&&this._contrastCache.clear()},_.prototype.setTheme=function(d){d===void 0&&(d={}),this.colors.foreground=this._parseColor(d.foreground,w),this.colors.background=this._parseColor(d.background,g),this.colors.cursor=this._parseColor(d.cursor,D,!0),this.colors.cursorAccent=this._parseColor(d.cursorAccent,T,!0),this.colors.selectionTransparent=this._parseColor(d.selection,f,!0),this.colors.selectionOpaque=O.color.blend(this.colors.background,this.colors.selectionTransparent),O.color.isOpaque(this.colors.selectionTransparent)&&(this.colors.selectionTransparent=O.color.opacity(this.colors.selectionTransparent,.3)),this.colors.ansi[0]=this._parseColor(d.black,E.DEFAULT_ANSI_COLORS[0]),this.colors.ansi[1]=this._parseColor(d.red,E.DEFAULT_ANSI_COLORS[1]),this.colors.ansi[2]=this._parseColor(d.green,E.DEFAULT_ANSI_COLORS[2]),this.colors.ansi[3]=this._parseColor(d.yellow,E.DEFAULT_ANSI_COLORS[3]),this.colors.ansi[4]=this._parseColor(d.blue,E.DEFAULT_ANSI_COLORS[4]),this.colors.ansi[5]=this._parseColor(d.magenta,E.DEFAULT_ANSI_COLORS[5]),this.colors.ansi[6]=this._parseColor(d.cyan,E.DEFAULT_ANSI_COLORS[6]),this.colors.ansi[7]=this._parseColor(d.white,E.DEFAULT_ANSI_COLORS[7]),this.colors.ansi[8]=this._parseColor(d.brightBlack,E.DEFAULT_ANSI_COLORS[8]),this.colors.ansi[9]=this._parseColor(d.brightRed,E.DEFAULT_ANSI_COLORS[9]),this.colors.ansi[10]=this._parseColor(d.brightGreen,E.DEFAULT_ANSI_COLORS[10]),this.colors.ansi[11]=this._parseColor(d.brightYellow,E.DEFAULT_ANSI_COLORS[11]),this.colors.ansi[12]=this._parseColor(d.brightBlue,E.DEFAULT_ANSI_COLORS[12]),this.colors.ansi[13]=this._parseColor(d.brightMagenta,E.DEFAULT_ANSI_COLORS[13]),this.colors.ansi[14]=this._parseColor(d.brightCyan,E.DEFAULT_ANSI_COLORS[14]),this.colors.ansi[15]=this._parseColor(d.brightWhite,E.DEFAULT_ANSI_COLORS[15]),this._contrastCache.clear()},_.prototype._parseColor=function(d,o,s){if(s===void 0&&(s=this.allowTransparency),d===void 0)return o;if(this._ctx.fillStyle=this._litmusColor,this._ctx.fillStyle=d,typeof this._ctx.fillStyle!="string")return console.warn("Color: "+d+" is invalid using fallback "+o.css),o;this._ctx.fillRect(0,0,1,1);var a=this._ctx.getImageData(0,0,1,1).data;if(a[3]!==255){if(!s)return console.warn("Color: "+d+" is using transparency, but allowTransparency is false. Using fallback "+o.css+"."),o;var u=this._ctx.fillStyle.substring(5,this._ctx.fillStyle.length-1).split(",").map(function(v){return Number(v)}),l=u[0],A=u[1],I=u[2],R=u[3],y=Math.round(255*R);return{rgba:O.channels.toRgba(l,A,I,y),css:d}}return{css:this._ctx.fillStyle,rgba:O.channels.toRgba(a[0],a[1],a[2],a[3])}},_}();E.ColorManager=p},9631:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.removeElementFromParent=void 0,E.removeElementFromParent=function(){for(var L,O=[],b=0;b<arguments.length;b++)O[b]=arguments[b];for(var w=0,g=O;w<g.length;w++){var D=g[w];(L=D==null?void 0:D.parentElement)===null||L===void 0||L.removeChild(D)}}},3656:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.addDisposableDomListener=void 0,E.addDisposableDomListener=function(L,O,b,w){L.addEventListener(O,b,w);var g=!1;return{dispose:function(){g||(g=!0,L.removeEventListener(O,b,w))}}}},3551:function(P,E,L){var O=this&&this.__decorate||function(f,p,_,d){var o,s=arguments.length,a=s<3?p:d===null?d=Object.getOwnPropertyDescriptor(p,_):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(f,p,_,d);else for(var u=f.length-1;u>=0;u--)(o=f[u])&&(a=(s<3?o(a):s>3?o(p,_,a):o(p,_))||a);return s>3&&a&&Object.defineProperty(p,_,a),a},b=this&&this.__param||function(f,p){return function(_,d){p(_,d,f)}};Object.defineProperty(E,"__esModule",{value:!0}),E.MouseZone=E.Linkifier=void 0;var w=L(8460),g=L(2585),D=function(){function f(p,_,d){this._bufferService=p,this._logService=_,this._unicodeService=d,this._linkMatchers=[],this._nextLinkMatcherId=0,this._onShowLinkUnderline=new w.EventEmitter,this._onHideLinkUnderline=new w.EventEmitter,this._onLinkTooltip=new w.EventEmitter,this._rowsToLinkify={start:void 0,end:void 0}}return Object.defineProperty(f.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"onLinkTooltip",{get:function(){return this._onLinkTooltip.event},enumerable:!1,configurable:!0}),f.prototype.attachToDom=function(p,_){this._element=p,this._mouseZoneManager=_},f.prototype.linkifyRows=function(p,_){var d=this;this._mouseZoneManager&&(this._rowsToLinkify.start===void 0||this._rowsToLinkify.end===void 0?(this._rowsToLinkify.start=p,this._rowsToLinkify.end=_):(this._rowsToLinkify.start=Math.min(this._rowsToLinkify.start,p),this._rowsToLinkify.end=Math.max(this._rowsToLinkify.end,_)),this._mouseZoneManager.clearAll(p,_),this._rowsTimeoutId&&clearTimeout(this._rowsTimeoutId),this._rowsTimeoutId=setTimeout(function(){return d._linkifyRows()},f._timeBeforeLatency))},f.prototype._linkifyRows=function(){this._rowsTimeoutId=void 0;var p=this._bufferService.buffer;if(this._rowsToLinkify.start!==void 0&&this._rowsToLinkify.end!==void 0){var _=p.ydisp+this._rowsToLinkify.start;if(!(_>=p.lines.length)){for(var d=p.ydisp+Math.min(this._rowsToLinkify.end,this._bufferService.rows)+1,o=Math.ceil(2e3/this._bufferService.cols),s=this._bufferService.buffer.iterator(!1,_,d,o,o);s.hasNext();)for(var a=s.next(),u=0;u<this._linkMatchers.length;u++)this._doLinkifyRow(a.range.first,a.content,this._linkMatchers[u]);this._rowsToLinkify.start=void 0,this._rowsToLinkify.end=void 0}}else this._logService.debug("_rowToLinkify was unset before _linkifyRows was called")},f.prototype.registerLinkMatcher=function(p,_,d){if(d===void 0&&(d={}),!_)throw new Error("handler must be defined");var o={id:this._nextLinkMatcherId++,regex:p,handler:_,matchIndex:d.matchIndex,validationCallback:d.validationCallback,hoverTooltipCallback:d.tooltipCallback,hoverLeaveCallback:d.leaveCallback,willLinkActivate:d.willLinkActivate,priority:d.priority||0};return this._addLinkMatcherToList(o),o.id},f.prototype._addLinkMatcherToList=function(p){if(this._linkMatchers.length!==0){for(var _=this._linkMatchers.length-1;_>=0;_--)if(p.priority<=this._linkMatchers[_].priority)return void this._linkMatchers.splice(_+1,0,p);this._linkMatchers.splice(0,0,p)}else this._linkMatchers.push(p)},f.prototype.deregisterLinkMatcher=function(p){for(var _=0;_<this._linkMatchers.length;_++)if(this._linkMatchers[_].id===p)return this._linkMatchers.splice(_,1),!0;return!1},f.prototype._doLinkifyRow=function(p,_,d){for(var o,s=this,a=new RegExp(d.regex.source,(d.regex.flags||"")+"g"),u=-1,l=function(){var I=o[typeof d.matchIndex!="number"?0:d.matchIndex];if(!I)return A._logService.debug("match found without corresponding matchIndex",o,d),"break";if(u=_.indexOf(I,u+1),a.lastIndex=u+I.length,u<0)return"break";var R=A._bufferService.buffer.stringIndexToBufferIndex(p,u);if(R[0]<0)return"break";var y=A._bufferService.buffer.lines.get(R[0]);if(!y)return"break";var v=y.getFg(R[1]),m=v?v>>9&511:void 0;d.validationCallback?d.validationCallback(I,function(S){s._rowsTimeoutId||S&&s._addLink(R[1],R[0]-s._bufferService.buffer.ydisp,I,d,m)}):A._addLink(R[1],R[0]-A._bufferService.buffer.ydisp,I,d,m)},A=this;(o=a.exec(_))!==null&&l()!=="break";);},f.prototype._addLink=function(p,_,d,o,s){var a=this;if(this._mouseZoneManager&&this._element){var u=this._unicodeService.getStringCellWidth(d),l=p%this._bufferService.cols,A=_+Math.floor(p/this._bufferService.cols),I=(l+u)%this._bufferService.cols,R=A+Math.floor((l+u)/this._bufferService.cols);I===0&&(I=this._bufferService.cols,R--),this._mouseZoneManager.add(new T(l+1,A+1,I+1,R+1,function(y){if(o.handler)return o.handler(y,d);var v=window.open();v?(v.opener=null,v.location.href=d):console.warn("Opening link blocked as opener could not be cleared")},function(){a._onShowLinkUnderline.fire(a._createLinkHoverEvent(l,A,I,R,s)),a._element.classList.add("xterm-cursor-pointer")},function(y){a._onLinkTooltip.fire(a._createLinkHoverEvent(l,A,I,R,s)),o.hoverTooltipCallback&&o.hoverTooltipCallback(y,d,{start:{x:l,y:A},end:{x:I,y:R}})},function(){a._onHideLinkUnderline.fire(a._createLinkHoverEvent(l,A,I,R,s)),a._element.classList.remove("xterm-cursor-pointer"),o.hoverLeaveCallback&&o.hoverLeaveCallback()},function(y){return!o.willLinkActivate||o.willLinkActivate(y,d)}))}},f.prototype._createLinkHoverEvent=function(p,_,d,o,s){return{x1:p,y1:_,x2:d,y2:o,cols:this._bufferService.cols,fg:s}},f._timeBeforeLatency=200,f=O([b(0,g.IBufferService),b(1,g.ILogService),b(2,g.IUnicodeService)],f)}();E.Linkifier=D;var T=function(f,p,_,d,o,s,a,u,l){this.x1=f,this.y1=p,this.x2=_,this.y2=d,this.clickCallback=o,this.hoverCallback=s,this.tooltipCallback=a,this.leaveCallback=u,this.willLinkActivate=l};E.MouseZone=T},6465:function(P,E,L){var O,b=this&&this.__extends||(O=function(d,o){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,a){s.__proto__=a}||function(s,a){for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(s[u]=a[u])},O(d,o)},function(d,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function s(){this.constructor=d}O(d,o),d.prototype=o===null?Object.create(o):(s.prototype=o.prototype,new s)}),w=this&&this.__decorate||function(d,o,s,a){var u,l=arguments.length,A=l<3?o:a===null?a=Object.getOwnPropertyDescriptor(o,s):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(d,o,s,a);else for(var I=d.length-1;I>=0;I--)(u=d[I])&&(A=(l<3?u(A):l>3?u(o,s,A):u(o,s))||A);return l>3&&A&&Object.defineProperty(o,s,A),A},g=this&&this.__param||function(d,o){return function(s,a){o(s,a,d)}};Object.defineProperty(E,"__esModule",{value:!0}),E.Linkifier2=void 0;var D=L(2585),T=L(8460),f=L(844),p=L(3656),_=function(d){function o(s){var a=d.call(this)||this;return a._bufferService=s,a._linkProviders=[],a._linkCacheDisposables=[],a._isMouseOut=!0,a._activeLine=-1,a._onShowLinkUnderline=a.register(new T.EventEmitter),a._onHideLinkUnderline=a.register(new T.EventEmitter),a.register((0,f.getDisposeArrayDisposable)(a._linkCacheDisposables)),a}return b(o,d),Object.defineProperty(o.prototype,"currentLink",{get:function(){return this._currentLink},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),o.prototype.registerLinkProvider=function(s){var a=this;return this._linkProviders.push(s),{dispose:function(){var u=a._linkProviders.indexOf(s);u!==-1&&a._linkProviders.splice(u,1)}}},o.prototype.attachToDom=function(s,a,u){var l=this;this._element=s,this._mouseService=a,this._renderService=u,this.register((0,p.addDisposableDomListener)(this._element,"mouseleave",function(){l._isMouseOut=!0,l._clearCurrentLink()})),this.register((0,p.addDisposableDomListener)(this._element,"mousemove",this._onMouseMove.bind(this))),this.register((0,p.addDisposableDomListener)(this._element,"click",this._onClick.bind(this)))},o.prototype._onMouseMove=function(s){if(this._lastMouseEvent=s,this._element&&this._mouseService){var a=this._positionFromMouseEvent(s,this._element,this._mouseService);if(a){this._isMouseOut=!1;for(var u=s.composedPath(),l=0;l<u.length;l++){var A=u[l];if(A.classList.contains("xterm"))break;if(A.classList.contains("xterm-hover"))return}this._lastBufferCell&&a.x===this._lastBufferCell.x&&a.y===this._lastBufferCell.y||(this._onHover(a),this._lastBufferCell=a)}}},o.prototype._onHover=function(s){if(this._activeLine!==s.y)return this._clearCurrentLink(),void this._askForLink(s,!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,s)||(this._clearCurrentLink(),this._askForLink(s,!0))},o.prototype._askForLink=function(s,a){var u,l=this;this._activeProviderReplies&&a||((u=this._activeProviderReplies)===null||u===void 0||u.forEach(function(I){I==null||I.forEach(function(R){R.link.dispose&&R.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=s.y);var A=!1;this._linkProviders.forEach(function(I,R){var y;a?((y=l._activeProviderReplies)===null||y===void 0?void 0:y.get(R))&&(A=l._checkLinkProviderResult(R,s,A)):I.provideLinks(s.y,function(v){var m,S;if(!l._isMouseOut){var B=v==null?void 0:v.map(function(N){return{link:N}});(m=l._activeProviderReplies)===null||m===void 0||m.set(R,B),A=l._checkLinkProviderResult(R,s,A),((S=l._activeProviderReplies)===null||S===void 0?void 0:S.size)===l._linkProviders.length&&l._removeIntersectingLinks(s.y,l._activeProviderReplies)}})})},o.prototype._removeIntersectingLinks=function(s,a){for(var u=new Set,l=0;l<a.size;l++){var A=a.get(l);if(A)for(var I=0;I<A.length;I++)for(var R=A[I],y=R.link.range.start.y<s?0:R.link.range.start.x,v=R.link.range.end.y>s?this._bufferService.cols:R.link.range.end.x,m=y;m<=v;m++){if(u.has(m)){A.splice(I--,1);break}u.add(m)}}},o.prototype._checkLinkProviderResult=function(s,a,u){var l,A=this;if(!this._activeProviderReplies)return u;for(var I=this._activeProviderReplies.get(s),R=!1,y=0;y<s;y++)this._activeProviderReplies.has(y)&&!this._activeProviderReplies.get(y)||(R=!0);if(!R&&I){var v=I.find(function(S){return A._linkAtPosition(S.link,a)});v&&(u=!0,this._handleNewLink(v))}if(this._activeProviderReplies.size===this._linkProviders.length&&!u)for(y=0;y<this._activeProviderReplies.size;y++){var m=(l=this._activeProviderReplies.get(y))===null||l===void 0?void 0:l.find(function(S){return A._linkAtPosition(S.link,a)});if(m){u=!0,this._handleNewLink(m);break}}return u},o.prototype._onClick=function(s){if(this._element&&this._mouseService&&this._currentLink){var a=this._positionFromMouseEvent(s,this._element,this._mouseService);a&&this._linkAtPosition(this._currentLink.link,a)&&this._currentLink.link.activate(s,this._currentLink.link.text)}},o.prototype._clearCurrentLink=function(s,a){this._element&&this._currentLink&&this._lastMouseEvent&&(!s||!a||this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=a)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,f.disposeArray)(this._linkCacheDisposables))},o.prototype._handleNewLink=function(s){var a=this;if(this._element&&this._lastMouseEvent&&this._mouseService){var u=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);u&&this._linkAtPosition(s.link,u)&&(this._currentLink=s,this._currentLink.state={decorations:{underline:s.link.decorations===void 0||s.link.decorations.underline,pointerCursor:s.link.decorations===void 0||s.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,s.link,this._lastMouseEvent),s.link.decorations={},Object.defineProperties(s.link.decorations,{pointerCursor:{get:function(){var l,A;return(A=(l=a._currentLink)===null||l===void 0?void 0:l.state)===null||A===void 0?void 0:A.decorations.pointerCursor},set:function(l){var A,I;((A=a._currentLink)===null||A===void 0?void 0:A.state)&&a._currentLink.state.decorations.pointerCursor!==l&&(a._currentLink.state.decorations.pointerCursor=l,a._currentLink.state.isHovered&&((I=a._element)===null||I===void 0||I.classList.toggle("xterm-cursor-pointer",l)))}},underline:{get:function(){var l,A;return(A=(l=a._currentLink)===null||l===void 0?void 0:l.state)===null||A===void 0?void 0:A.decorations.underline},set:function(l){var A,I,R;((A=a._currentLink)===null||A===void 0?void 0:A.state)&&((R=(I=a._currentLink)===null||I===void 0?void 0:I.state)===null||R===void 0?void 0:R.decorations.underline)!==l&&(a._currentLink.state.decorations.underline=l,a._currentLink.state.isHovered&&a._fireUnderlineEvent(s.link,l))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedBufferChange(function(l){var A=l.start===0?0:l.start+1+a._bufferService.buffer.ydisp;a._clearCurrentLink(A,l.end+1+a._bufferService.buffer.ydisp)})))}},o.prototype._linkHover=function(s,a,u){var l;((l=this._currentLink)===null||l===void 0?void 0:l.state)&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(a,!0),this._currentLink.state.decorations.pointerCursor&&s.classList.add("xterm-cursor-pointer")),a.hover&&a.hover(u,a.text)},o.prototype._fireUnderlineEvent=function(s,a){var u=s.range,l=this._bufferService.buffer.ydisp,A=this._createLinkUnderlineEvent(u.start.x-1,u.start.y-l-1,u.end.x,u.end.y-l-1,void 0);(a?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(A)},o.prototype._linkLeave=function(s,a,u){var l;((l=this._currentLink)===null||l===void 0?void 0:l.state)&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(a,!1),this._currentLink.state.decorations.pointerCursor&&s.classList.remove("xterm-cursor-pointer")),a.leave&&a.leave(u,a.text)},o.prototype._linkAtPosition=function(s,a){var u=s.range.start.y===s.range.end.y,l=s.range.start.y<a.y,A=s.range.end.y>a.y;return(u&&s.range.start.x<=a.x&&s.range.end.x>=a.x||l&&s.range.end.x>=a.x||A&&s.range.start.x<=a.x||l&&A)&&s.range.start.y<=a.y&&s.range.end.y>=a.y},o.prototype._positionFromMouseEvent=function(s,a,u){var l=u.getCoords(s,a,this._bufferService.cols,this._bufferService.rows);if(l)return{x:l[0],y:l[1]+this._bufferService.buffer.ydisp}},o.prototype._createLinkUnderlineEvent=function(s,a,u,l,A){return{x1:s,y1:a,x2:u,y2:l,cols:this._bufferService.cols,fg:A}},w([g(0,D.IBufferService)],o)}(f.Disposable);E.Linkifier2=_},9042:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.tooMuchOutput=E.promptLabel=void 0,E.promptLabel="Terminal input",E.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},6954:function(P,E,L){var O,b=this&&this.__extends||(O=function(d,o){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,a){s.__proto__=a}||function(s,a){for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(s[u]=a[u])},O(d,o)},function(d,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function s(){this.constructor=d}O(d,o),d.prototype=o===null?Object.create(o):(s.prototype=o.prototype,new s)}),w=this&&this.__decorate||function(d,o,s,a){var u,l=arguments.length,A=l<3?o:a===null?a=Object.getOwnPropertyDescriptor(o,s):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(d,o,s,a);else for(var I=d.length-1;I>=0;I--)(u=d[I])&&(A=(l<3?u(A):l>3?u(o,s,A):u(o,s))||A);return l>3&&A&&Object.defineProperty(o,s,A),A},g=this&&this.__param||function(d,o){return function(s,a){o(s,a,d)}};Object.defineProperty(E,"__esModule",{value:!0}),E.MouseZoneManager=void 0;var D=L(844),T=L(3656),f=L(4725),p=L(2585),_=function(d){function o(s,a,u,l,A,I){var R=d.call(this)||this;return R._element=s,R._screenElement=a,R._bufferService=u,R._mouseService=l,R._selectionService=A,R._optionsService=I,R._zones=[],R._areZonesActive=!1,R._lastHoverCoords=[void 0,void 0],R._initialSelectionLength=0,R.register((0,T.addDisposableDomListener)(R._element,"mousedown",function(y){return R._onMouseDown(y)})),R._mouseMoveListener=function(y){return R._onMouseMove(y)},R._mouseLeaveListener=function(y){return R._onMouseLeave(y)},R._clickListener=function(y){return R._onClick(y)},R}return b(o,d),o.prototype.dispose=function(){d.prototype.dispose.call(this),this._deactivate()},o.prototype.add=function(s){this._zones.push(s),this._zones.length===1&&this._activate()},o.prototype.clearAll=function(s,a){if(this._zones.length!==0){s&&a||(s=0,a=this._bufferService.rows-1);for(var u=0;u<this._zones.length;u++){var l=this._zones[u];(l.y1>s&&l.y1<=a+1||l.y2>s&&l.y2<=a+1||l.y1<s&&l.y2>a+1)&&(this._currentZone&&this._currentZone===l&&(this._currentZone.leaveCallback(),this._currentZone=void 0),this._zones.splice(u--,1))}this._zones.length===0&&this._deactivate()}},o.prototype._activate=function(){this._areZonesActive||(this._areZonesActive=!0,this._element.addEventListener("mousemove",this._mouseMoveListener),this._element.addEventListener("mouseleave",this._mouseLeaveListener),this._element.addEventListener("click",this._clickListener))},o.prototype._deactivate=function(){this._areZonesActive&&(this._areZonesActive=!1,this._element.removeEventListener("mousemove",this._mouseMoveListener),this._element.removeEventListener("mouseleave",this._mouseLeaveListener),this._element.removeEventListener("click",this._clickListener))},o.prototype._onMouseMove=function(s){this._lastHoverCoords[0]===s.pageX&&this._lastHoverCoords[1]===s.pageY||(this._onHover(s),this._lastHoverCoords=[s.pageX,s.pageY])},o.prototype._onHover=function(s){var a=this,u=this._findZoneEventAt(s);u!==this._currentZone&&(this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout)),u&&(this._currentZone=u,u.hoverCallback&&u.hoverCallback(s),this._tooltipTimeout=window.setTimeout(function(){return a._onTooltip(s)},this._optionsService.options.linkTooltipHoverDuration)))},o.prototype._onTooltip=function(s){this._tooltipTimeout=void 0;var a=this._findZoneEventAt(s);a==null||a.tooltipCallback(s)},o.prototype._onMouseDown=function(s){if(this._initialSelectionLength=this._getSelectionLength(),this._areZonesActive){var a=this._findZoneEventAt(s);(a==null?void 0:a.willLinkActivate(s))&&(s.preventDefault(),s.stopImmediatePropagation())}},o.prototype._onMouseLeave=function(s){this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout))},o.prototype._onClick=function(s){var a=this._findZoneEventAt(s),u=this._getSelectionLength();a&&u===this._initialSelectionLength&&(a.clickCallback(s),s.preventDefault(),s.stopImmediatePropagation())},o.prototype._getSelectionLength=function(){var s=this._selectionService.selectionText;return s?s.length:0},o.prototype._findZoneEventAt=function(s){var a=this._mouseService.getCoords(s,this._screenElement,this._bufferService.cols,this._bufferService.rows);if(a)for(var u=a[0],l=a[1],A=0;A<this._zones.length;A++){var I=this._zones[A];if(I.y1===I.y2){if(l===I.y1&&u>=I.x1&&u<I.x2)return I}else if(l===I.y1&&u>=I.x1||l===I.y2&&u<I.x2||l>I.y1&&l<I.y2)return I}},w([g(2,p.IBufferService),g(3,f.IMouseService),g(4,f.ISelectionService),g(5,p.IOptionsService)],o)}(D.Disposable);E.MouseZoneManager=_},6193:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.RenderDebouncer=void 0;var L=function(){function O(b){this._renderCallback=b}return O.prototype.dispose=function(){this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},O.prototype.refresh=function(b,w,g){var D=this;this._rowCount=g,b=b!==void 0?b:0,w=w!==void 0?w:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,b):b,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,w):w,this._animationFrame||(this._animationFrame=window.requestAnimationFrame(function(){return D._innerRefresh()}))},O.prototype._innerRefresh=function(){if(this._rowStart!==void 0&&this._rowEnd!==void 0&&this._rowCount!==void 0){var b=Math.max(this._rowStart,0),w=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._animationFrame=void 0,this._renderCallback(b,w)}},O}();E.RenderDebouncer=L},5596:function(P,E,L){var O,b=this&&this.__extends||(O=function(g,D){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,f){T.__proto__=f}||function(T,f){for(var p in f)Object.prototype.hasOwnProperty.call(f,p)&&(T[p]=f[p])},O(g,D)},function(g,D){if(typeof D!="function"&&D!==null)throw new TypeError("Class extends value "+String(D)+" is not a constructor or null");function T(){this.constructor=g}O(g,D),g.prototype=D===null?Object.create(D):(T.prototype=D.prototype,new T)});Object.defineProperty(E,"__esModule",{value:!0}),E.ScreenDprMonitor=void 0;var w=function(g){function D(){var T=g!==null&&g.apply(this,arguments)||this;return T._currentDevicePixelRatio=window.devicePixelRatio,T}return b(D,g),D.prototype.setListener=function(T){var f=this;this._listener&&this.clearListener(),this._listener=T,this._outerListener=function(){f._listener&&(f._listener(window.devicePixelRatio,f._currentDevicePixelRatio),f._updateDpr())},this._updateDpr()},D.prototype.dispose=function(){g.prototype.dispose.call(this),this.clearListener()},D.prototype._updateDpr=function(){var T;this._outerListener&&((T=this._resolutionMediaMatchList)===null||T===void 0||T.removeListener(this._outerListener),this._currentDevicePixelRatio=window.devicePixelRatio,this._resolutionMediaMatchList=window.matchMedia("screen and (resolution: "+window.devicePixelRatio+"dppx)"),this._resolutionMediaMatchList.addListener(this._outerListener))},D.prototype.clearListener=function(){this._resolutionMediaMatchList&&this._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)},D}(L(844).Disposable);E.ScreenDprMonitor=w},3236:function(P,E,L){var O,b=this&&this.__extends||(O=function(ve,q){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(ee,ae){ee.__proto__=ae}||function(ee,ae){for(var _e in ae)Object.prototype.hasOwnProperty.call(ae,_e)&&(ee[_e]=ae[_e])},O(ve,q)},function(ve,q){if(typeof q!="function"&&q!==null)throw new TypeError("Class extends value "+String(q)+" is not a constructor or null");function ee(){this.constructor=ve}O(ve,q),ve.prototype=q===null?Object.create(q):(ee.prototype=q.prototype,new ee)});Object.defineProperty(E,"__esModule",{value:!0}),E.Terminal=void 0;var w=L(2950),g=L(1680),D=L(3614),T=L(2584),f=L(5435),p=L(3525),_=L(3551),d=L(9312),o=L(6114),s=L(3656),a=L(9042),u=L(357),l=L(6954),A=L(4567),I=L(1296),R=L(7399),y=L(8460),v=L(8437),m=L(5680),S=L(3230),B=L(4725),N=L(428),M=L(8934),U=L(6465),K=L(5114),j=L(8969),X=L(4774),ie=L(4269),se=typeof window!="undefined"?window.document:null,le=function(ve){function q(ee){ee===void 0&&(ee={});var ae=ve.call(this,ee)||this;return ae.browser=o,ae._keyDownHandled=!1,ae._keyPressHandled=!1,ae._unprocessedDeadKey=!1,ae._onCursorMove=new y.EventEmitter,ae._onKey=new y.EventEmitter,ae._onRender=new y.EventEmitter,ae._onSelectionChange=new y.EventEmitter,ae._onTitleChange=new y.EventEmitter,ae._onBell=new y.EventEmitter,ae._onFocus=new y.EventEmitter,ae._onBlur=new y.EventEmitter,ae._onA11yCharEmitter=new y.EventEmitter,ae._onA11yTabEmitter=new y.EventEmitter,ae._setup(),ae.linkifier=ae._instantiationService.createInstance(_.Linkifier),ae.linkifier2=ae.register(ae._instantiationService.createInstance(U.Linkifier2)),ae.register(ae._inputHandler.onRequestBell(function(){return ae.bell()})),ae.register(ae._inputHandler.onRequestRefreshRows(function(_e,fe){return ae.refresh(_e,fe)})),ae.register(ae._inputHandler.onRequestSendFocus(function(){return ae._reportFocus()})),ae.register(ae._inputHandler.onRequestReset(function(){return ae.reset()})),ae.register(ae._inputHandler.onRequestWindowsOptionsReport(function(_e){return ae._reportWindowsOptions(_e)})),ae.register(ae._inputHandler.onAnsiColorChange(function(_e){return ae._changeAnsiColor(_e)})),ae.register((0,y.forwardEvent)(ae._inputHandler.onCursorMove,ae._onCursorMove)),ae.register((0,y.forwardEvent)(ae._inputHandler.onTitleChange,ae._onTitleChange)),ae.register((0,y.forwardEvent)(ae._inputHandler.onA11yChar,ae._onA11yCharEmitter)),ae.register((0,y.forwardEvent)(ae._inputHandler.onA11yTab,ae._onA11yTabEmitter)),ae.register(ae._bufferService.onResize(function(_e){return ae._afterResize(_e.cols,_e.rows)})),ae}return b(q,ve),Object.defineProperty(q.prototype,"options",{get:function(){return this.optionsService.options},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"onKey",{get:function(){return this._onKey.event},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"onRender",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"onBell",{get:function(){return this._onBell.event},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"onFocus",{get:function(){return this._onFocus.event},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"onBlur",{get:function(){return this._onBlur.event},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"onA11yChar",{get:function(){return this._onA11yCharEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"onA11yTab",{get:function(){return this._onA11yTabEmitter.event},enumerable:!1,configurable:!0}),q.prototype._changeAnsiColor=function(ee){var ae,_e;if(this._colorManager){for(var fe=0,Ge=ee.colors;fe<Ge.length;fe++){var Te=Ge[fe],Ue=X.rgba.toColor(Te.red,Te.green,Te.blue);this._colorManager.colors.ansi[Te.colorIndex]=Ue}(ae=this._renderService)===null||ae===void 0||ae.setColors(this._colorManager.colors),(_e=this.viewport)===null||_e===void 0||_e.onThemeChange(this._colorManager.colors)}},q.prototype.dispose=function(){var ee,ae,_e;this._isDisposed||(ve.prototype.dispose.call(this),(ee=this._renderService)===null||ee===void 0||ee.dispose(),this._customKeyEventHandler=void 0,this.write=function(){},(_e=(ae=this.element)===null||ae===void 0?void 0:ae.parentNode)===null||_e===void 0||_e.removeChild(this.element))},q.prototype._setup=function(){ve.prototype._setup.call(this),this._customKeyEventHandler=void 0},Object.defineProperty(q.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),q.prototype.focus=function(){this.textarea&&this.textarea.focus({preventScroll:!0})},q.prototype._updateOptions=function(ee){var ae,_e,fe,Ge;switch(ve.prototype._updateOptions.call(this,ee),ee){case"fontFamily":case"fontSize":(ae=this._renderService)===null||ae===void 0||ae.clear(),(_e=this._charSizeService)===null||_e===void 0||_e.measure();break;case"cursorBlink":case"cursorStyle":this.refresh(this.buffer.y,this.buffer.y);break;case"customGlyphs":case"drawBoldTextInBrightColors":case"letterSpacing":case"lineHeight":case"fontWeight":case"fontWeightBold":case"minimumContrastRatio":this._renderService&&(this._renderService.clear(),this._renderService.onResize(this.cols,this.rows),this.refresh(0,this.rows-1));break;case"rendererType":this._renderService&&(this._renderService.setRenderer(this._createRenderer()),this._renderService.onResize(this.cols,this.rows));break;case"scrollback":(fe=this.viewport)===null||fe===void 0||fe.syncScrollArea();break;case"screenReaderMode":this.optionsService.options.screenReaderMode?!this._accessibilityManager&&this._renderService&&(this._accessibilityManager=new A.AccessibilityManager(this,this._renderService)):((Ge=this._accessibilityManager)===null||Ge===void 0||Ge.dispose(),this._accessibilityManager=void 0);break;case"tabStopWidth":this.buffers.setupTabStops();break;case"theme":this._setTheme(this.optionsService.options.theme)}},q.prototype._onTextAreaFocus=function(ee){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(T.C0.ESC+"[I"),this.updateCursorStyle(ee),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()},q.prototype.blur=function(){var ee;return(ee=this.textarea)===null||ee===void 0?void 0:ee.blur()},q.prototype._onTextAreaBlur=function(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(T.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()},q.prototype._syncTextArea=function(){if(this.textarea&&this.buffer.isCursorInViewport&&!this._compositionHelper.isComposing&&this._renderService){var ee=this.buffer.ybase+this.buffer.y,ae=this.buffer.lines.get(ee);if(ae){var _e=Math.min(this.buffer.x,this.cols-1),fe=this._renderService.dimensions.actualCellHeight,Ge=ae.getWidth(_e),Te=this._renderService.dimensions.actualCellWidth*Ge,Ue=this.buffer.y*this._renderService.dimensions.actualCellHeight,Ze=_e*this._renderService.dimensions.actualCellWidth;this.textarea.style.left=Ze+"px",this.textarea.style.top=Ue+"px",this.textarea.style.width=Te+"px",this.textarea.style.height=fe+"px",this.textarea.style.lineHeight=fe+"px",this.textarea.style.zIndex="-5"}}},q.prototype._initGlobal=function(){var ee=this;this._bindKeys(),this.register((0,s.addDisposableDomListener)(this.element,"copy",function(_e){ee.hasSelection()&&(0,D.copyHandler)(_e,ee._selectionService)}));var ae=function(_e){return(0,D.handlePasteEvent)(_e,ee.textarea,ee.coreService)};this.register((0,s.addDisposableDomListener)(this.textarea,"paste",ae)),this.register((0,s.addDisposableDomListener)(this.element,"paste",ae)),o.isFirefox?this.register((0,s.addDisposableDomListener)(this.element,"mousedown",function(_e){_e.button===2&&(0,D.rightClickHandler)(_e,ee.textarea,ee.screenElement,ee._selectionService,ee.options.rightClickSelectsWord)})):this.register((0,s.addDisposableDomListener)(this.element,"contextmenu",function(_e){(0,D.rightClickHandler)(_e,ee.textarea,ee.screenElement,ee._selectionService,ee.options.rightClickSelectsWord)})),o.isLinux&&this.register((0,s.addDisposableDomListener)(this.element,"auxclick",function(_e){_e.button===1&&(0,D.moveTextAreaUnderMouseCursor)(_e,ee.textarea,ee.screenElement)}))},q.prototype._bindKeys=function(){var ee=this;this.register((0,s.addDisposableDomListener)(this.textarea,"keyup",function(ae){return ee._keyUp(ae)},!0)),this.register((0,s.addDisposableDomListener)(this.textarea,"keydown",function(ae){return ee._keyDown(ae)},!0)),this.register((0,s.addDisposableDomListener)(this.textarea,"keypress",function(ae){return ee._keyPress(ae)},!0)),this.register((0,s.addDisposableDomListener)(this.textarea,"compositionstart",function(){return ee._compositionHelper.compositionstart()})),this.register((0,s.addDisposableDomListener)(this.textarea,"compositionupdate",function(ae){return ee._compositionHelper.compositionupdate(ae)})),this.register((0,s.addDisposableDomListener)(this.textarea,"compositionend",function(){return ee._compositionHelper.compositionend()})),this.register((0,s.addDisposableDomListener)(this.textarea,"input",function(ae){return ee._inputEvent(ae)},!0)),this.register(this.onRender(function(){return ee._compositionHelper.updateCompositionElements()})),this.register(this.onRender(function(ae){return ee._queueLinkification(ae.start,ae.end)}))},q.prototype.open=function(ee){var ae=this;if(!ee)throw new Error("Terminal requires a parent element.");ee.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=ee.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),this.element.setAttribute("tabindex","0"),ee.appendChild(this.element);var _e=se.createDocumentFragment();this._viewportElement=se.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),_e.appendChild(this._viewportElement),this._viewportScrollArea=se.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=se.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=se.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),_e.appendChild(this.screenElement),this.textarea=se.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",a.promptLabel),this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this.register((0,s.addDisposableDomListener)(this.textarea,"focus",function(Te){return ae._onTextAreaFocus(Te)})),this.register((0,s.addDisposableDomListener)(this.textarea,"blur",function(){return ae._onTextAreaBlur()})),this._helperContainer.appendChild(this.textarea);var fe=this._instantiationService.createInstance(K.CoreBrowserService,this.textarea);this._instantiationService.setService(B.ICoreBrowserService,fe),this._charSizeService=this._instantiationService.createInstance(N.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(B.ICharSizeService,this._charSizeService),this._theme=this.options.theme||this._theme,this._colorManager=new m.ColorManager(se,this.options.allowTransparency),this.register(this.optionsService.onOptionChange(function(Te){return ae._colorManager.onOptionsChange(Te)})),this._colorManager.setTheme(this._theme),this._characterJoinerService=this._instantiationService.createInstance(ie.CharacterJoinerService),this._instantiationService.setService(B.ICharacterJoinerService,this._characterJoinerService);var Ge=this._createRenderer();this._renderService=this.register(this._instantiationService.createInstance(S.RenderService,Ge,this.rows,this.screenElement)),this._instantiationService.setService(B.IRenderService,this._renderService),this.register(this._renderService.onRenderedBufferChange(function(Te){return ae._onRender.fire(Te)})),this.onResize(function(Te){return ae._renderService.resize(Te.cols,Te.rows)}),this._compositionView=se.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(w.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(_e),this._soundService=this._instantiationService.createInstance(u.SoundService),this._instantiationService.setService(B.ISoundService,this._soundService),this._mouseService=this._instantiationService.createInstance(M.MouseService),this._instantiationService.setService(B.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(g.Viewport,function(Te){return ae.scrollLines(Te,!0,1)},this._viewportElement,this._viewportScrollArea,this.element),this.viewport.onThemeChange(this._colorManager.colors),this.register(this._inputHandler.onRequestSyncScrollBar(function(){return ae.viewport.syncScrollArea()})),this.register(this.viewport),this.register(this.onCursorMove(function(){ae._renderService.onCursorMove(),ae._syncTextArea()})),this.register(this.onResize(function(){return ae._renderService.onResize(ae.cols,ae.rows)})),this.register(this.onBlur(function(){return ae._renderService.onBlur()})),this.register(this.onFocus(function(){return ae._renderService.onFocus()})),this.register(this._renderService.onDimensionsChange(function(){return ae.viewport.syncScrollArea()})),this._selectionService=this.register(this._instantiationService.createInstance(d.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(B.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(function(Te){return ae.scrollLines(Te.amount,Te.suppressScrollEvent)})),this.register(this._selectionService.onSelectionChange(function(){return ae._onSelectionChange.fire()})),this.register(this._selectionService.onRequestRedraw(function(Te){return ae._renderService.onSelectionChanged(Te.start,Te.end,Te.columnSelectMode)})),this.register(this._selectionService.onLinuxMouseSelection(function(Te){ae.textarea.value=Te,ae.textarea.focus(),ae.textarea.select()})),this.register(this._onScroll.event(function(Te){ae.viewport.syncScrollArea(),ae._selectionService.refresh()})),this.register((0,s.addDisposableDomListener)(this._viewportElement,"scroll",function(){return ae._selectionService.refresh()})),this._mouseZoneManager=this._instantiationService.createInstance(l.MouseZoneManager,this.element,this.screenElement),this.register(this._mouseZoneManager),this.register(this.onScroll(function(){return ae._mouseZoneManager.clearAll()})),this.linkifier.attachToDom(this.element,this._mouseZoneManager),this.linkifier2.attachToDom(this.element,this._mouseService,this._renderService),this.register((0,s.addDisposableDomListener)(this.element,"mousedown",function(Te){return ae._selectionService.onMouseDown(Te)})),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager=new A.AccessibilityManager(this,this._renderService)),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()},q.prototype._createRenderer=function(){switch(this.options.rendererType){case"canvas":return this._instantiationService.createInstance(p.Renderer,this._colorManager.colors,this.screenElement,this.linkifier,this.linkifier2);case"dom":return this._instantiationService.createInstance(I.DomRenderer,this._colorManager.colors,this.element,this.screenElement,this._viewportElement,this.linkifier,this.linkifier2);default:throw new Error('Unrecognized rendererType "'+this.options.rendererType+'"')}},q.prototype._setTheme=function(ee){var ae,_e,fe;this._theme=ee,(ae=this._colorManager)===null||ae===void 0||ae.setTheme(ee),(_e=this._renderService)===null||_e===void 0||_e.setColors(this._colorManager.colors),(fe=this.viewport)===null||fe===void 0||fe.onThemeChange(this._colorManager.colors)},q.prototype.bindMouse=function(){var ee=this,ae=this,_e=this.element;function fe(Fe){var Ye,Ht,Bt=ae._mouseService.getRawByteCoords(Fe,ae.screenElement,ae.cols,ae.rows);if(!Bt)return!1;switch(Fe.overrideType||Fe.type){case"mousemove":Ht=32,Fe.buttons===void 0?(Ye=3,Fe.button!==void 0&&(Ye=Fe.button<3?Fe.button:3)):Ye=1&Fe.buttons?0:4&Fe.buttons?1:2&Fe.buttons?2:3;break;case"mouseup":Ht=0,Ye=Fe.button<3?Fe.button:3;break;case"mousedown":Ht=1,Ye=Fe.button<3?Fe.button:3;break;case"wheel":Fe.deltaY!==0&&(Ht=Fe.deltaY<0?0:1),Ye=4;break;default:return!1}return!(Ht===void 0||Ye===void 0||Ye>4)&&ae.coreMouseService.triggerMouseEvent({col:Bt.x-33,row:Bt.y-33,button:Ye,action:Ht,ctrl:Fe.ctrlKey,alt:Fe.altKey,shift:Fe.shiftKey})}var Ge={mouseup:null,wheel:null,mousedrag:null,mousemove:null},Te=function(Fe){return fe(Fe),Fe.buttons||(ee._document.removeEventListener("mouseup",Ge.mouseup),Ge.mousedrag&&ee._document.removeEventListener("mousemove",Ge.mousedrag)),ee.cancel(Fe)},Ue=function(Fe){return fe(Fe),ee.cancel(Fe,!0)},Ze=function(Fe){Fe.buttons&&fe(Fe)},ut=function(Fe){Fe.buttons||fe(Fe)};this.register(this.coreMouseService.onProtocolChange(function(Fe){Fe?(ee.optionsService.options.logLevel==="debug"&&ee._logService.debug("Binding to mouse events:",ee.coreMouseService.explainEvents(Fe)),ee.element.classList.add("enable-mouse-events"),ee._selectionService.disable()):(ee._logService.debug("Unbinding from mouse events."),ee.element.classList.remove("enable-mouse-events"),ee._selectionService.enable()),8&Fe?Ge.mousemove||(_e.addEventListener("mousemove",ut),Ge.mousemove=ut):(_e.removeEventListener("mousemove",Ge.mousemove),Ge.mousemove=null),16&Fe?Ge.wheel||(_e.addEventListener("wheel",Ue,{passive:!1}),Ge.wheel=Ue):(_e.removeEventListener("wheel",Ge.wheel),Ge.wheel=null),2&Fe?Ge.mouseup||(Ge.mouseup=Te):(ee._document.removeEventListener("mouseup",Ge.mouseup),Ge.mouseup=null),4&Fe?Ge.mousedrag||(Ge.mousedrag=Ze):(ee._document.removeEventListener("mousemove",Ge.mousedrag),Ge.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,s.addDisposableDomListener)(_e,"mousedown",function(Fe){if(Fe.preventDefault(),ee.focus(),ee.coreMouseService.areMouseEventsActive&&!ee._selectionService.shouldForceSelection(Fe))return fe(Fe),Ge.mouseup&&ee._document.addEventListener("mouseup",Ge.mouseup),Ge.mousedrag&&ee._document.addEventListener("mousemove",Ge.mousedrag),ee.cancel(Fe)})),this.register((0,s.addDisposableDomListener)(_e,"wheel",function(Fe){if(!Ge.wheel){if(!ee.buffer.hasScrollback){var Ye=ee.viewport.getLinesScrolled(Fe);if(Ye===0)return;for(var Ht=T.C0.ESC+(ee.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Fe.deltaY<0?"A":"B"),Bt="",Ft=0;Ft<Math.abs(Ye);Ft++)Bt+=Ht;return ee.coreService.triggerDataEvent(Bt,!0),ee.cancel(Fe,!0)}return ee.viewport.onWheel(Fe)?void 0:ee.cancel(Fe)}},{passive:!1})),this.register((0,s.addDisposableDomListener)(_e,"touchstart",function(Fe){if(!ee.coreMouseService.areMouseEventsActive)return ee.viewport.onTouchStart(Fe),ee.cancel(Fe)},{passive:!0})),this.register((0,s.addDisposableDomListener)(_e,"touchmove",function(Fe){if(!ee.coreMouseService.areMouseEventsActive)return ee.viewport.onTouchMove(Fe)?void 0:ee.cancel(Fe)},{passive:!1}))},q.prototype.refresh=function(ee,ae){var _e;(_e=this._renderService)===null||_e===void 0||_e.refreshRows(ee,ae)},q.prototype._queueLinkification=function(ee,ae){var _e;(_e=this.linkifier)===null||_e===void 0||_e.linkifyRows(ee,ae)},q.prototype.updateCursorStyle=function(ee){var ae;((ae=this._selectionService)===null||ae===void 0?void 0:ae.shouldColumnSelect(ee))?this.element.classList.add("column-select"):this.element.classList.remove("column-select")},q.prototype._showCursor=function(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))},q.prototype.scrollLines=function(ee,ae,_e){_e===void 0&&(_e=0),ve.prototype.scrollLines.call(this,ee,ae,_e),this.refresh(0,this.rows-1)},q.prototype.paste=function(ee){(0,D.paste)(ee,this.textarea,this.coreService)},q.prototype.attachCustomKeyEventHandler=function(ee){this._customKeyEventHandler=ee},q.prototype.registerLinkMatcher=function(ee,ae,_e){var fe=this.linkifier.registerLinkMatcher(ee,ae,_e);return this.refresh(0,this.rows-1),fe},q.prototype.deregisterLinkMatcher=function(ee){this.linkifier.deregisterLinkMatcher(ee)&&this.refresh(0,this.rows-1)},q.prototype.registerLinkProvider=function(ee){return this.linkifier2.registerLinkProvider(ee)},q.prototype.registerCharacterJoiner=function(ee){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");var ae=this._characterJoinerService.register(ee);return this.refresh(0,this.rows-1),ae},q.prototype.deregisterCharacterJoiner=function(ee){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(ee)&&this.refresh(0,this.rows-1)},Object.defineProperty(q.prototype,"markers",{get:function(){return this.buffer.markers},enumerable:!1,configurable:!0}),q.prototype.addMarker=function(ee){if(this.buffer===this.buffers.normal)return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+ee)},q.prototype.hasSelection=function(){return!!this._selectionService&&this._selectionService.hasSelection},q.prototype.select=function(ee,ae,_e){this._selectionService.setSelection(ee,ae,_e)},q.prototype.getSelection=function(){return this._selectionService?this._selectionService.selectionText:""},q.prototype.getSelectionPosition=function(){if(this._selectionService&&this._selectionService.hasSelection)return{startColumn:this._selectionService.selectionStart[0],startRow:this._selectionService.selectionStart[1],endColumn:this._selectionService.selectionEnd[0],endRow:this._selectionService.selectionEnd[1]}},q.prototype.clearSelection=function(){var ee;(ee=this._selectionService)===null||ee===void 0||ee.clearSelection()},q.prototype.selectAll=function(){var ee;(ee=this._selectionService)===null||ee===void 0||ee.selectAll()},q.prototype.selectLines=function(ee,ae){var _e;(_e=this._selectionService)===null||_e===void 0||_e.selectLines(ee,ae)},q.prototype._keyDown=function(ee){if(this._keyDownHandled=!1,this._customKeyEventHandler&&this._customKeyEventHandler(ee)===!1)return!1;if(!this._compositionHelper.keydown(ee))return this.buffer.ybase!==this.buffer.ydisp&&this._bufferService.scrollToBottom(),!1;ee.key!=="Dead"&&ee.key!=="AltGraph"||(this._unprocessedDeadKey=!0);var ae=(0,R.evaluateKeyboardEvent)(ee,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(ee),ae.type===3||ae.type===2){var _e=this.rows-1;return this.scrollLines(ae.type===2?-_e:_e),this.cancel(ee,!0)}return ae.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,ee)||(ae.cancel&&this.cancel(ee,!0),!ae.key||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ae.key!==T.C0.ETX&&ae.key!==T.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ae.key,domEvent:ee}),this._showCursor(),this.coreService.triggerDataEvent(ae.key,!0),this.optionsService.options.screenReaderMode?void(this._keyDownHandled=!0):this.cancel(ee,!0))))},q.prototype._isThirdLevelShift=function(ee,ae){var _e=ee.isMac&&!this.options.macOptionIsMeta&&ae.altKey&&!ae.ctrlKey&&!ae.metaKey||ee.isWindows&&ae.altKey&&ae.ctrlKey&&!ae.metaKey||ee.isWindows&&ae.getModifierState("AltGraph");return ae.type==="keypress"?_e:_e&&(!ae.keyCode||ae.keyCode>47)},q.prototype._keyUp=function(ee){this._customKeyEventHandler&&this._customKeyEventHandler(ee)===!1||(function(ae){return ae.keyCode===16||ae.keyCode===17||ae.keyCode===18}(ee)||this.focus(),this.updateCursorStyle(ee),this._keyPressHandled=!1)},q.prototype._keyPress=function(ee){var ae;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(ee)===!1)return!1;if(this.cancel(ee),ee.charCode)ae=ee.charCode;else if(ee.which===null||ee.which===void 0)ae=ee.keyCode;else{if(ee.which===0||ee.charCode===0)return!1;ae=ee.which}return!(!ae||(ee.altKey||ee.ctrlKey||ee.metaKey)&&!this._isThirdLevelShift(this.browser,ee)||(ae=String.fromCharCode(ae),this._onKey.fire({key:ae,domEvent:ee}),this._showCursor(),this.coreService.triggerDataEvent(ae,!0),this._keyPressHandled=!0,0))},q.prototype._inputEvent=function(ee){if(ee.data&&ee.inputType==="insertText"&&!this.optionsService.options.screenReaderMode){if(this._keyPressHandled)return!1;var ae=ee.data;return this.coreService.triggerDataEvent(ae,!0),this.cancel(ee),!0}return!1},q.prototype.bell=function(){var ee;this._soundBell()&&((ee=this._soundService)===null||ee===void 0||ee.playBellSound()),this._onBell.fire()},q.prototype.resize=function(ee,ae){ee!==this.cols||ae!==this.rows?ve.prototype.resize.call(this,ee,ae):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()},q.prototype._afterResize=function(ee,ae){var _e,fe;(_e=this._charSizeService)===null||_e===void 0||_e.measure(),(fe=this.viewport)===null||fe===void 0||fe.syncScrollArea(!0)},q.prototype.clear=function(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(var ee=1;ee<this.rows;ee++)this.buffer.lines.push(this.buffer.getBlankLine(v.DEFAULT_ATTR_DATA));this.refresh(0,this.rows-1),this._onScroll.fire({position:this.buffer.ydisp,source:0})}},q.prototype.reset=function(){var ee,ae;this.options.rows=this.rows,this.options.cols=this.cols;var _e=this._customKeyEventHandler;this._setup(),ve.prototype.reset.call(this),(ee=this._selectionService)===null||ee===void 0||ee.reset(),this._customKeyEventHandler=_e,this.refresh(0,this.rows-1),(ae=this.viewport)===null||ae===void 0||ae.syncScrollArea()},q.prototype.clearTextureAtlas=function(){var ee;(ee=this._renderService)===null||ee===void 0||ee.clearTextureAtlas()},q.prototype._reportFocus=function(){var ee;((ee=this.element)===null||ee===void 0?void 0:ee.classList.contains("focus"))?this.coreService.triggerDataEvent(T.C0.ESC+"[I"):this.coreService.triggerDataEvent(T.C0.ESC+"[O")},q.prototype._reportWindowsOptions=function(ee){if(this._renderService)switch(ee){case f.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:var ae=this._renderService.dimensions.scaledCanvasWidth.toFixed(0),_e=this._renderService.dimensions.scaledCanvasHeight.toFixed(0);this.coreService.triggerDataEvent(T.C0.ESC+"[4;"+_e+";"+ae+"t");break;case f.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:var fe=this._renderService.dimensions.scaledCellWidth.toFixed(0),Ge=this._renderService.dimensions.scaledCellHeight.toFixed(0);this.coreService.triggerDataEvent(T.C0.ESC+"[6;"+Ge+";"+fe+"t")}},q.prototype.cancel=function(ee,ae){if(this.options.cancelEvents||ae)return ee.preventDefault(),ee.stopPropagation(),!1},q.prototype._visualBell=function(){return!1},q.prototype._soundBell=function(){return this.options.bellStyle==="sound"},q}(j.CoreTerminal);E.Terminal=le},9924:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.TimeBasedDebouncer=void 0;var L=function(){function O(b,w){w===void 0&&(w=1e3),this._renderCallback=b,this._debounceThresholdMS=w,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}return O.prototype.dispose=function(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)},O.prototype.refresh=function(b,w,g){var D=this;this._rowCount=g,b=b!==void 0?b:0,w=w!==void 0?w:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,b):b,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,w):w;var T=Date.now();if(T-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=T,this._innerRefresh();else if(!this._additionalRefreshRequested){var f=T-this._lastRefreshMs,p=this._debounceThresholdMS-f;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(function(){D._lastRefreshMs=Date.now(),D._innerRefresh(),D._additionalRefreshRequested=!1,D._refreshTimeoutID=void 0},p)}},O.prototype._innerRefresh=function(){if(this._rowStart!==void 0&&this._rowEnd!==void 0&&this._rowCount!==void 0){var b=Math.max(this._rowStart,0),w=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(b,w)}},O}();E.TimeBasedDebouncer=L},1680:function(P,E,L){var O,b=this&&this.__extends||(O=function(d,o){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,a){s.__proto__=a}||function(s,a){for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(s[u]=a[u])},O(d,o)},function(d,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function s(){this.constructor=d}O(d,o),d.prototype=o===null?Object.create(o):(s.prototype=o.prototype,new s)}),w=this&&this.__decorate||function(d,o,s,a){var u,l=arguments.length,A=l<3?o:a===null?a=Object.getOwnPropertyDescriptor(o,s):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(d,o,s,a);else for(var I=d.length-1;I>=0;I--)(u=d[I])&&(A=(l<3?u(A):l>3?u(o,s,A):u(o,s))||A);return l>3&&A&&Object.defineProperty(o,s,A),A},g=this&&this.__param||function(d,o){return function(s,a){o(s,a,d)}};Object.defineProperty(E,"__esModule",{value:!0}),E.Viewport=void 0;var D=L(844),T=L(3656),f=L(4725),p=L(2585),_=function(d){function o(s,a,u,l,A,I,R,y){var v=d.call(this)||this;return v._scrollLines=s,v._viewportElement=a,v._scrollArea=u,v._element=l,v._bufferService=A,v._optionsService=I,v._charSizeService=R,v._renderService=y,v.scrollBarWidth=0,v._currentRowHeight=0,v._currentScaledCellHeight=0,v._lastRecordedBufferLength=0,v._lastRecordedViewportHeight=0,v._lastRecordedBufferHeight=0,v._lastTouchY=0,v._lastScrollTop=0,v._lastHadScrollBar=!1,v._wheelPartialScroll=0,v._refreshAnimationFrame=null,v._ignoreNextScrollEvent=!1,v.scrollBarWidth=v._viewportElement.offsetWidth-v._scrollArea.offsetWidth||15,v._lastHadScrollBar=!0,v.register((0,T.addDisposableDomListener)(v._viewportElement,"scroll",v._onScroll.bind(v))),v._activeBuffer=v._bufferService.buffer,v.register(v._bufferService.buffers.onBufferActivate(function(m){return v._activeBuffer=m.activeBuffer})),v._renderDimensions=v._renderService.dimensions,v.register(v._renderService.onDimensionsChange(function(m){return v._renderDimensions=m})),setTimeout(function(){return v.syncScrollArea()},0),v}return b(o,d),o.prototype.onThemeChange=function(s){this._viewportElement.style.backgroundColor=s.background.css},o.prototype._refresh=function(s){var a=this;if(s)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=requestAnimationFrame(function(){return a._innerRefresh()}))},o.prototype._innerRefresh=function(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio,this._currentScaledCellHeight=this._renderService.dimensions.scaledCellHeight,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;var s=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.canvasHeight);this._lastRecordedBufferHeight!==s&&(this._lastRecordedBufferHeight=s,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}var a=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==a&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=a),this._optionsService.options.scrollback===0?this.scrollBarWidth=0:this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this._lastHadScrollBar=this.scrollBarWidth>0;var u=window.getComputedStyle(this._element),l=parseInt(u.paddingLeft)+parseInt(u.paddingRight);this._viewportElement.style.width=(this._renderService.dimensions.actualCellWidth*this._bufferService.cols+this.scrollBarWidth+(this._lastHadScrollBar?l:0)).toString()+"px",this._refreshAnimationFrame=null},o.prototype.syncScrollArea=function(s){if(s===void 0&&(s=!1),this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(s);this._lastRecordedViewportHeight===this._renderService.dimensions.canvasHeight&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.scaledCellHeight===this._currentScaledCellHeight?this._lastHadScrollBar!==this._optionsService.options.scrollback>0&&this._refresh(s):this._refresh(s)},o.prototype._onScroll=function(s){if(this._lastScrollTop=this._viewportElement.scrollTop,this._viewportElement.offsetParent){if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._scrollLines(0);var a=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._scrollLines(a)}},o.prototype._bubbleScroll=function(s,a){var u=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(a<0&&this._viewportElement.scrollTop!==0||a>0&&u<this._lastRecordedBufferHeight)||(s.cancelable&&s.preventDefault(),!1)},o.prototype.onWheel=function(s){var a=this._getPixelsScrolled(s);return a!==0&&(this._viewportElement.scrollTop+=a,this._bubbleScroll(s,a))},o.prototype._getPixelsScrolled=function(s){if(s.deltaY===0)return 0;var a=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_LINE?a*=this._currentRowHeight:s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(a*=this._currentRowHeight*this._bufferService.rows),a},o.prototype.getLinesScrolled=function(s){if(s.deltaY===0)return 0;var a=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(a/=this._currentRowHeight+0,this._wheelPartialScroll+=a,a=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(a*=this._bufferService.rows),a},o.prototype._applyScrollModifier=function(s,a){var u=this._optionsService.options.fastScrollModifier;return u==="alt"&&a.altKey||u==="ctrl"&&a.ctrlKey||u==="shift"&&a.shiftKey?s*this._optionsService.options.fastScrollSensitivity*this._optionsService.options.scrollSensitivity:s*this._optionsService.options.scrollSensitivity},o.prototype.onTouchStart=function(s){this._lastTouchY=s.touches[0].pageY},o.prototype.onTouchMove=function(s){var a=this._lastTouchY-s.touches[0].pageY;return this._lastTouchY=s.touches[0].pageY,a!==0&&(this._viewportElement.scrollTop+=a,this._bubbleScroll(s,a))},w([g(4,p.IBufferService),g(5,p.IOptionsService),g(6,f.ICharSizeService),g(7,f.IRenderService)],o)}(D.Disposable);E.Viewport=_},2950:function(P,E,L){var O=this&&this.__decorate||function(T,f,p,_){var d,o=arguments.length,s=o<3?f:_===null?_=Object.getOwnPropertyDescriptor(f,p):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(T,f,p,_);else for(var a=T.length-1;a>=0;a--)(d=T[a])&&(s=(o<3?d(s):o>3?d(f,p,s):d(f,p))||s);return o>3&&s&&Object.defineProperty(f,p,s),s},b=this&&this.__param||function(T,f){return function(p,_){f(p,_,T)}};Object.defineProperty(E,"__esModule",{value:!0}),E.CompositionHelper=void 0;var w=L(4725),g=L(2585),D=function(){function T(f,p,_,d,o,s){this._textarea=f,this._compositionView=p,this._bufferService=_,this._optionsService=d,this._coreService=o,this._renderService=s,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}return Object.defineProperty(T.prototype,"isComposing",{get:function(){return this._isComposing},enumerable:!1,configurable:!0}),T.prototype.compositionstart=function(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")},T.prototype.compositionupdate=function(f){var p=this;this._compositionView.textContent=f.data,this.updateCompositionElements(),setTimeout(function(){p._compositionPosition.end=p._textarea.value.length},0)},T.prototype.compositionend=function(){this._finalizeComposition(!0)},T.prototype.keydown=function(f){if(this._isComposing||this._isSendingComposition){if(f.keyCode===229||f.keyCode===16||f.keyCode===17||f.keyCode===18)return!1;this._finalizeComposition(!1)}return f.keyCode!==229||(this._handleAnyTextareaChanges(),!1)},T.prototype._finalizeComposition=function(f){var p=this;if(this._compositionView.classList.remove("active"),this._isComposing=!1,f){var _={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(function(){if(p._isSendingComposition){p._isSendingComposition=!1;var o;_.start+=p._dataAlreadySent.length,(o=p._isComposing?p._textarea.value.substring(_.start,_.end):p._textarea.value.substring(_.start)).length>0&&p._coreService.triggerDataEvent(o,!0)}},0)}else{this._isSendingComposition=!1;var d=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(d,!0)}},T.prototype._handleAnyTextareaChanges=function(){var f=this,p=this._textarea.value;setTimeout(function(){if(!f._isComposing){var _=f._textarea.value.replace(p,"");_.length>0&&(f._dataAlreadySent=_,f._coreService.triggerDataEvent(_,!0))}},0)},T.prototype.updateCompositionElements=function(f){var p=this;if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){var _=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),d=this._renderService.dimensions.actualCellHeight,o=this._bufferService.buffer.y*this._renderService.dimensions.actualCellHeight,s=_*this._renderService.dimensions.actualCellWidth;this._compositionView.style.left=s+"px",this._compositionView.style.top=o+"px",this._compositionView.style.height=d+"px",this._compositionView.style.lineHeight=d+"px",this._compositionView.style.fontFamily=this._optionsService.options.fontFamily,this._compositionView.style.fontSize=this._optionsService.options.fontSize+"px";var a=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=o+"px",this._textarea.style.width=Math.max(a.width,1)+"px",this._textarea.style.height=Math.max(a.height,1)+"px",this._textarea.style.lineHeight=a.height+"px"}f||setTimeout(function(){return p.updateCompositionElements(!0)},0)}},O([b(2,g.IBufferService),b(3,g.IOptionsService),b(4,g.ICoreService),b(5,w.IRenderService)],T)}();E.CompositionHelper=D},9806:(P,E)=>{function L(O,b){var w=b.getBoundingClientRect();return[O.clientX-w.left,O.clientY-w.top]}Object.defineProperty(E,"__esModule",{value:!0}),E.getRawByteCoords=E.getCoords=E.getCoordsRelativeToElement=void 0,E.getCoordsRelativeToElement=L,E.getCoords=function(O,b,w,g,D,T,f,p){if(D){var _=L(O,b);if(_)return _[0]=Math.ceil((_[0]+(p?T/2:0))/T),_[1]=Math.ceil(_[1]/f),_[0]=Math.min(Math.max(_[0],1),w+(p?1:0)),_[1]=Math.min(Math.max(_[1],1),g),_}},E.getRawByteCoords=function(O){if(O)return{x:O[0]+32,y:O[1]+32}}},9504:(P,E,L)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.moveToCellSequence=void 0;var O=L(2584);function b(p,_,d,o){var s=p-w(d,p),a=_-w(d,_),u=Math.abs(s-a)-function(l,A,I){for(var R=0,y=l-w(I,l),v=A-w(I,A),m=0;m<Math.abs(y-v);m++){var S=g(l,A)==="A"?-1:1,B=I.buffer.lines.get(y+S*m);B&&B.isWrapped&&R++}return R}(p,_,d);return f(u,T(g(p,_),o))}function w(p,_){for(var d=0,o=p.buffer.lines.get(_),s=o&&o.isWrapped;s&&_>=0&&_<p.rows;)d++,s=(o=p.buffer.lines.get(--_))&&o.isWrapped;return d}function g(p,_){return p>_?"A":"B"}function D(p,_,d,o,s,a){for(var u=p,l=_,A="";u!==d||l!==o;)u+=s?1:-1,s&&u>a.cols-1?(A+=a.buffer.translateBufferLineToString(l,!1,p,u),u=0,p=0,l++):!s&&u<0&&(A+=a.buffer.translateBufferLineToString(l,!1,0,p+1),p=u=a.cols-1,l--);return A+a.buffer.translateBufferLineToString(l,!1,p,u)}function T(p,_){var d=_?"O":"[";return O.C0.ESC+d+p}function f(p,_){p=Math.floor(p);for(var d="",o=0;o<p;o++)d+=_;return d}E.moveToCellSequence=function(p,_,d,o){var s,a=d.buffer.x,u=d.buffer.y;if(!d.buffer.hasScrollback)return function(A,I,R,y,v,m){return b(I,y,v,m).length===0?"":f(D(A,I,A,I-w(v,I),!1,v).length,T("D",m))}(a,u,0,_,d,o)+b(u,_,d,o)+function(A,I,R,y,v,m){var S;S=b(I,y,v,m).length>0?y-w(v,y):I;var B=y,N=function(M,U,K,j,X,ie){var se;return se=b(K,j,X,ie).length>0?j-w(X,j):U,M<K&&se<=j||M>=K&&se<j?"C":"D"}(A,I,R,y,v,m);return f(D(A,S,R,B,N==="C",v).length,T(N,m))}(a,u,p,_,d,o);if(u===_)return s=a>p?"D":"C",f(Math.abs(a-p),T(s,o));s=u>_?"D":"C";var l=Math.abs(u-_);return f(function(A,I){return I.cols-A}(u>_?p:a,d)+(l-1)*d.cols+1+((u>_?a:p)-1),T(s,o))}},1546:(P,E,L)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.BaseRenderLayer=void 0;var O=L(643),b=L(8803),w=L(1420),g=L(3734),D=L(1752),T=L(4774),f=L(9631),p=L(8978),_=function(){function d(o,s,a,u,l,A,I,R){this._container=o,this._alpha=u,this._colors=l,this._rendererId=A,this._bufferService=I,this._optionsService=R,this._scaledCharWidth=0,this._scaledCharHeight=0,this._scaledCellWidth=0,this._scaledCellHeight=0,this._scaledCharLeft=0,this._scaledCharTop=0,this._currentGlyphIdentifier={chars:"",code:0,bg:0,fg:0,bold:!1,dim:!1,italic:!1},this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-"+s+"-layer"),this._canvas.style.zIndex=a.toString(),this._initCanvas(),this._container.appendChild(this._canvas)}return d.prototype.dispose=function(){var o;(0,f.removeElementFromParent)(this._canvas),(o=this._charAtlas)===null||o===void 0||o.dispose()},d.prototype._initCanvas=function(){this._ctx=(0,D.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()},d.prototype.onOptionsChanged=function(){},d.prototype.onBlur=function(){},d.prototype.onFocus=function(){},d.prototype.onCursorMove=function(){},d.prototype.onGridChanged=function(o,s){},d.prototype.onSelectionChanged=function(o,s,a){a===void 0&&(a=!1)},d.prototype.setColors=function(o){this._refreshCharAtlas(o)},d.prototype._setTransparency=function(o){if(o!==this._alpha){var s=this._canvas;this._alpha=o,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,s),this._refreshCharAtlas(this._colors),this.onGridChanged(0,this._bufferService.rows-1)}},d.prototype._refreshCharAtlas=function(o){this._scaledCharWidth<=0&&this._scaledCharHeight<=0||(this._charAtlas=(0,w.acquireCharAtlas)(this._optionsService.options,this._rendererId,o,this._scaledCharWidth,this._scaledCharHeight),this._charAtlas.warmUp())},d.prototype.resize=function(o){this._scaledCellWidth=o.scaledCellWidth,this._scaledCellHeight=o.scaledCellHeight,this._scaledCharWidth=o.scaledCharWidth,this._scaledCharHeight=o.scaledCharHeight,this._scaledCharLeft=o.scaledCharLeft,this._scaledCharTop=o.scaledCharTop,this._canvas.width=o.scaledCanvasWidth,this._canvas.height=o.scaledCanvasHeight,this._canvas.style.width=o.canvasWidth+"px",this._canvas.style.height=o.canvasHeight+"px",this._alpha||this._clearAll(),this._refreshCharAtlas(this._colors)},d.prototype.clearTextureAtlas=function(){var o;(o=this._charAtlas)===null||o===void 0||o.clear()},d.prototype._fillCells=function(o,s,a,u){this._ctx.fillRect(o*this._scaledCellWidth,s*this._scaledCellHeight,a*this._scaledCellWidth,u*this._scaledCellHeight)},d.prototype._fillMiddleLineAtCells=function(o,s,a){a===void 0&&(a=1);var u=Math.ceil(.5*this._scaledCellHeight);this._ctx.fillRect(o*this._scaledCellWidth,(s+1)*this._scaledCellHeight-u-window.devicePixelRatio,a*this._scaledCellWidth,window.devicePixelRatio)},d.prototype._fillBottomLineAtCells=function(o,s,a){a===void 0&&(a=1),this._ctx.fillRect(o*this._scaledCellWidth,(s+1)*this._scaledCellHeight-window.devicePixelRatio-1,a*this._scaledCellWidth,window.devicePixelRatio)},d.prototype._fillLeftLineAtCell=function(o,s,a){this._ctx.fillRect(o*this._scaledCellWidth,s*this._scaledCellHeight,window.devicePixelRatio*a,this._scaledCellHeight)},d.prototype._strokeRectAtCell=function(o,s,a,u){this._ctx.lineWidth=window.devicePixelRatio,this._ctx.strokeRect(o*this._scaledCellWidth+window.devicePixelRatio/2,s*this._scaledCellHeight+window.devicePixelRatio/2,a*this._scaledCellWidth-window.devicePixelRatio,u*this._scaledCellHeight-window.devicePixelRatio)},d.prototype._clearAll=function(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))},d.prototype._clearCells=function(o,s,a,u){this._alpha?this._ctx.clearRect(o*this._scaledCellWidth,s*this._scaledCellHeight,a*this._scaledCellWidth,u*this._scaledCellHeight):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(o*this._scaledCellWidth,s*this._scaledCellHeight,a*this._scaledCellWidth,u*this._scaledCellHeight))},d.prototype._fillCharTrueColor=function(o,s,a){this._ctx.font=this._getFont(!1,!1),this._ctx.textBaseline=b.TEXT_BASELINE,this._clipRow(a);var u=!1;this._optionsService.options.customGlyphs!==!1&&(u=(0,p.tryDrawCustomChar)(this._ctx,o.getChars(),s*this._scaledCellWidth,a*this._scaledCellHeight,this._scaledCellWidth,this._scaledCellHeight)),u||this._ctx.fillText(o.getChars(),s*this._scaledCellWidth+this._scaledCharLeft,a*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight)},d.prototype._drawChars=function(o,s,a){var u,l,A=this._getContrastColor(o);A||o.isFgRGB()||o.isBgRGB()?this._drawUncachedChars(o,s,a,A):(o.isInverse()?(u=o.isBgDefault()?b.INVERTED_DEFAULT_COLOR:o.getBgColor(),l=o.isFgDefault()?b.INVERTED_DEFAULT_COLOR:o.getFgColor()):(l=o.isBgDefault()?O.DEFAULT_COLOR:o.getBgColor(),u=o.isFgDefault()?O.DEFAULT_COLOR:o.getFgColor()),u+=this._optionsService.options.drawBoldTextInBrightColors&&o.isBold()&&u<8?8:0,this._currentGlyphIdentifier.chars=o.getChars()||O.WHITESPACE_CELL_CHAR,this._currentGlyphIdentifier.code=o.getCode()||O.WHITESPACE_CELL_CODE,this._currentGlyphIdentifier.bg=l,this._currentGlyphIdentifier.fg=u,this._currentGlyphIdentifier.bold=!!o.isBold(),this._currentGlyphIdentifier.dim=!!o.isDim(),this._currentGlyphIdentifier.italic=!!o.isItalic(),this._charAtlas&&this._charAtlas.draw(this._ctx,this._currentGlyphIdentifier,s*this._scaledCellWidth+this._scaledCharLeft,a*this._scaledCellHeight+this._scaledCharTop)||this._drawUncachedChars(o,s,a))},d.prototype._drawUncachedChars=function(o,s,a,u){if(this._ctx.save(),this._ctx.font=this._getFont(!!o.isBold(),!!o.isItalic()),this._ctx.textBaseline=b.TEXT_BASELINE,o.isInverse())if(u)this._ctx.fillStyle=u.css;else if(o.isBgDefault())this._ctx.fillStyle=T.color.opaque(this._colors.background).css;else if(o.isBgRGB())this._ctx.fillStyle="rgb("+g.AttributeData.toColorRGB(o.getBgColor()).join(",")+")";else{var l=o.getBgColor();this._optionsService.options.drawBoldTextInBrightColors&&o.isBold()&&l<8&&(l+=8),this._ctx.fillStyle=this._colors.ansi[l].css}else if(u)this._ctx.fillStyle=u.css;else if(o.isFgDefault())this._ctx.fillStyle=this._colors.foreground.css;else if(o.isFgRGB())this._ctx.fillStyle="rgb("+g.AttributeData.toColorRGB(o.getFgColor()).join(",")+")";else{var A=o.getFgColor();this._optionsService.options.drawBoldTextInBrightColors&&o.isBold()&&A<8&&(A+=8),this._ctx.fillStyle=this._colors.ansi[A].css}this._clipRow(a),o.isDim()&&(this._ctx.globalAlpha=b.DIM_OPACITY);var I=!1;this._optionsService.options.customGlyphs!==!1&&(I=(0,p.tryDrawCustomChar)(this._ctx,o.getChars(),s*this._scaledCellWidth,a*this._scaledCellHeight,this._scaledCellWidth,this._scaledCellHeight)),I||this._ctx.fillText(o.getChars(),s*this._scaledCellWidth+this._scaledCharLeft,a*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight),this._ctx.restore()},d.prototype._clipRow=function(o){this._ctx.beginPath(),this._ctx.rect(0,o*this._scaledCellHeight,this._bufferService.cols*this._scaledCellWidth,this._scaledCellHeight),this._ctx.clip()},d.prototype._getFont=function(o,s){return(s?"italic":"")+" "+(o?this._optionsService.options.fontWeightBold:this._optionsService.options.fontWeight)+" "+this._optionsService.options.fontSize*window.devicePixelRatio+"px "+this._optionsService.options.fontFamily},d.prototype._getContrastColor=function(o){if(this._optionsService.options.minimumContrastRatio!==1){var s=this._colors.contrastCache.getColor(o.bg,o.fg);if(s!==void 0)return s||void 0;var a=o.getFgColor(),u=o.getFgColorMode(),l=o.getBgColor(),A=o.getBgColorMode(),I=!!o.isInverse(),R=!!o.isInverse();if(I){var y=a;a=l,l=y;var v=u;u=A,A=v}var m=this._resolveBackgroundRgba(A,l,I),S=this._resolveForegroundRgba(u,a,I,R),B=T.rgba.ensureContrastRatio(m,S,this._optionsService.options.minimumContrastRatio);if(B){var N={css:T.channels.toCss(B>>24&255,B>>16&255,B>>8&255),rgba:B};return this._colors.contrastCache.setColor(o.bg,o.fg,N),N}this._colors.contrastCache.setColor(o.bg,o.fg,null)}},d.prototype._resolveBackgroundRgba=function(o,s,a){switch(o){case 16777216:case 33554432:return this._colors.ansi[s].rgba;case 50331648:return s<<8;default:return a?this._colors.foreground.rgba:this._colors.background.rgba}},d.prototype._resolveForegroundRgba=function(o,s,a,u){switch(o){case 16777216:case 33554432:return this._optionsService.options.drawBoldTextInBrightColors&&u&&s<8&&(s+=8),this._colors.ansi[s].rgba;case 50331648:return s<<8;default:return a?this._colors.background.rgba:this._colors.foreground.rgba}},d}();E.BaseRenderLayer=_},2512:function(P,E,L){var O,b=this&&this.__extends||(O=function(s,a){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,l){u.__proto__=l}||function(u,l){for(var A in l)Object.prototype.hasOwnProperty.call(l,A)&&(u[A]=l[A])},O(s,a)},function(s,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");function u(){this.constructor=s}O(s,a),s.prototype=a===null?Object.create(a):(u.prototype=a.prototype,new u)}),w=this&&this.__decorate||function(s,a,u,l){var A,I=arguments.length,R=I<3?a:l===null?l=Object.getOwnPropertyDescriptor(a,u):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(s,a,u,l);else for(var y=s.length-1;y>=0;y--)(A=s[y])&&(R=(I<3?A(R):I>3?A(a,u,R):A(a,u))||R);return I>3&&R&&Object.defineProperty(a,u,R),R},g=this&&this.__param||function(s,a){return function(u,l){a(u,l,s)}};Object.defineProperty(E,"__esModule",{value:!0}),E.CursorRenderLayer=void 0;var D=L(1546),T=L(511),f=L(2585),p=L(4725),_=600,d=function(s){function a(u,l,A,I,R,y,v,m,S){var B=s.call(this,u,"cursor",l,!0,A,I,y,v)||this;return B._onRequestRedraw=R,B._coreService=m,B._coreBrowserService=S,B._cell=new T.CellData,B._state={x:0,y:0,isFocused:!1,style:"",width:0},B._cursorRenderers={bar:B._renderBarCursor.bind(B),block:B._renderBlockCursor.bind(B),underline:B._renderUnderlineCursor.bind(B)},B}return b(a,s),a.prototype.dispose=function(){this._cursorBlinkStateManager&&(this._cursorBlinkStateManager.dispose(),this._cursorBlinkStateManager=void 0),s.prototype.dispose.call(this)},a.prototype.resize=function(u){s.prototype.resize.call(this,u),this._state={x:0,y:0,isFocused:!1,style:"",width:0}},a.prototype.reset=function(){var u;this._clearCursor(),(u=this._cursorBlinkStateManager)===null||u===void 0||u.restartBlinkAnimation(),this.onOptionsChanged()},a.prototype.onBlur=function(){var u;(u=this._cursorBlinkStateManager)===null||u===void 0||u.pause(),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},a.prototype.onFocus=function(){var u;(u=this._cursorBlinkStateManager)===null||u===void 0||u.resume(),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},a.prototype.onOptionsChanged=function(){var u,l=this;this._optionsService.options.cursorBlink?this._cursorBlinkStateManager||(this._cursorBlinkStateManager=new o(this._coreBrowserService.isFocused,function(){l._render(!0)})):((u=this._cursorBlinkStateManager)===null||u===void 0||u.dispose(),this._cursorBlinkStateManager=void 0),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},a.prototype.onCursorMove=function(){var u;(u=this._cursorBlinkStateManager)===null||u===void 0||u.restartBlinkAnimation()},a.prototype.onGridChanged=function(u,l){!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isPaused?this._render(!1):this._cursorBlinkStateManager.restartBlinkAnimation()},a.prototype._render=function(u){if(this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden){var l=this._bufferService.buffer.ybase+this._bufferService.buffer.y,A=l-this._bufferService.buffer.ydisp;if(A<0||A>=this._bufferService.rows)this._clearCursor();else{var I=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1);if(this._bufferService.buffer.lines.get(l).loadCell(I,this._cell),this._cell.content!==void 0){if(!this._coreBrowserService.isFocused){this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css;var R=this._optionsService.options.cursorStyle;return R&&R!=="block"?this._cursorRenderers[R](I,A,this._cell):this._renderBlurCursor(I,A,this._cell),this._ctx.restore(),this._state.x=I,this._state.y=A,this._state.isFocused=!1,this._state.style=R,void(this._state.width=this._cell.getWidth())}if(!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isCursorVisible){if(this._state){if(this._state.x===I&&this._state.y===A&&this._state.isFocused===this._coreBrowserService.isFocused&&this._state.style===this._optionsService.options.cursorStyle&&this._state.width===this._cell.getWidth())return;this._clearCursor()}this._ctx.save(),this._cursorRenderers[this._optionsService.options.cursorStyle||"block"](I,A,this._cell),this._ctx.restore(),this._state.x=I,this._state.y=A,this._state.isFocused=!1,this._state.style=this._optionsService.options.cursorStyle,this._state.width=this._cell.getWidth()}else this._clearCursor()}}}else this._clearCursor()},a.prototype._clearCursor=function(){this._state&&(window.devicePixelRatio<1?this._clearAll():this._clearCells(this._state.x,this._state.y,this._state.width,1),this._state={x:0,y:0,isFocused:!1,style:"",width:0})},a.prototype._renderBarCursor=function(u,l,A){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillLeftLineAtCell(u,l,this._optionsService.options.cursorWidth),this._ctx.restore()},a.prototype._renderBlockCursor=function(u,l,A){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillCells(u,l,A.getWidth(),1),this._ctx.fillStyle=this._colors.cursorAccent.css,this._fillCharTrueColor(A,u,l),this._ctx.restore()},a.prototype._renderUnderlineCursor=function(u,l,A){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillBottomLineAtCells(u,l),this._ctx.restore()},a.prototype._renderBlurCursor=function(u,l,A){this._ctx.save(),this._ctx.strokeStyle=this._colors.cursor.css,this._strokeRectAtCell(u,l,A.getWidth(),1),this._ctx.restore()},w([g(5,f.IBufferService),g(6,f.IOptionsService),g(7,f.ICoreService),g(8,p.ICoreBrowserService)],a)}(D.BaseRenderLayer);E.CursorRenderLayer=d;var o=function(){function s(a,u){this._renderCallback=u,this.isCursorVisible=!0,a&&this._restartInterval()}return Object.defineProperty(s.prototype,"isPaused",{get:function(){return!(this._blinkStartTimeout||this._blinkInterval)},enumerable:!1,configurable:!0}),s.prototype.dispose=function(){this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},s.prototype.restartBlinkAnimation=function(){var a=this;this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=window.requestAnimationFrame(function(){a._renderCallback(),a._animationFrame=void 0})))},s.prototype._restartInterval=function(a){var u=this;a===void 0&&(a=_),this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=window.setTimeout(function(){if(u._animationTimeRestarted){var l=_-(Date.now()-u._animationTimeRestarted);if(u._animationTimeRestarted=void 0,l>0)return void u._restartInterval(l)}u.isCursorVisible=!1,u._animationFrame=window.requestAnimationFrame(function(){u._renderCallback(),u._animationFrame=void 0}),u._blinkInterval=window.setInterval(function(){if(u._animationTimeRestarted){var A=_-(Date.now()-u._animationTimeRestarted);return u._animationTimeRestarted=void 0,void u._restartInterval(A)}u.isCursorVisible=!u.isCursorVisible,u._animationFrame=window.requestAnimationFrame(function(){u._renderCallback(),u._animationFrame=void 0})},_)},a)},s.prototype.pause=function(){this.isCursorVisible=!0,this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},s.prototype.resume=function(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()},s}()},8978:(P,E,L)=>{var O,b,w,g,D,T,f,p,_,d,o,s,a,u,l,A,I,R,y,v,m,S,B,N,M,U,K,j,X,ie,se,le,ve,q,ee,ae,_e,fe,Ge,Te,Ue,Ze,ut,Fe,Ye,Ht,Bt,Ft,Mt,cr,sr,br,hi,Mr,Hr,pi,si,bi,oi,Ci,sn,Zr,Rr,Vr,Lt,$r,wn,on,wi,pn,vn,Oi,Ln,Ds,Dn,bs,hs,Vs,Os,Fn,Yr,$t,Jr,oo,ao,co,Ro,_a,wo,Lo,Xo,Do,Bs,lo,bo,es,_i,Zo,mn,uo,ei,bn,On,$o,fs,ts,Ys,ho,ea,As,Ns,Fi,Ca,fo,Bi,gs,Or,Oo,Js,ta,En,ra,Bo,ya,Ao,Qn,ia,na;Object.defineProperty(E,"__esModule",{value:!0}),E.tryDrawCustomChar=E.boxDrawingDefinitions=E.blockElementDefinitions=void 0;var Ha=L(1752);E.blockElementDefinitions={"\u2580":[{x:0,y:0,w:8,h:4}],"\u2581":[{x:0,y:7,w:8,h:1}],"\u2582":[{x:0,y:6,w:8,h:2}],"\u2583":[{x:0,y:5,w:8,h:3}],"\u2584":[{x:0,y:4,w:8,h:4}],"\u2585":[{x:0,y:3,w:8,h:5}],"\u2586":[{x:0,y:2,w:8,h:6}],"\u2587":[{x:0,y:1,w:8,h:7}],"\u2588":[{x:0,y:0,w:8,h:8}],"\u2589":[{x:0,y:0,w:7,h:8}],"\u258A":[{x:0,y:0,w:6,h:8}],"\u258B":[{x:0,y:0,w:5,h:8}],"\u258C":[{x:0,y:0,w:4,h:8}],"\u258D":[{x:0,y:0,w:3,h:8}],"\u258E":[{x:0,y:0,w:2,h:8}],"\u258F":[{x:0,y:0,w:1,h:8}],"\u2590":[{x:4,y:0,w:4,h:8}],"\u2594":[{x:0,y:0,w:9,h:1}],"\u2595":[{x:7,y:0,w:1,h:8}],"\u2596":[{x:0,y:4,w:4,h:4}],"\u2597":[{x:4,y:4,w:4,h:4}],"\u2598":[{x:0,y:0,w:4,h:4}],"\u2599":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"\u259A":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"\u259B":[{x:0,y:0,w:4,h:8},{x:0,y:0,w:4,h:8}],"\u259C":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"\u259D":[{x:4,y:0,w:4,h:4}],"\u259E":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"\u259F":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"\u{1FB70}":[{x:1,y:0,w:1,h:8}],"\u{1FB71}":[{x:2,y:0,w:1,h:8}],"\u{1FB72}":[{x:3,y:0,w:1,h:8}],"\u{1FB73}":[{x:4,y:0,w:1,h:8}],"\u{1FB74}":[{x:5,y:0,w:1,h:8}],"\u{1FB75}":[{x:6,y:0,w:1,h:8}],"\u{1FB76}":[{x:0,y:1,w:8,h:1}],"\u{1FB77}":[{x:0,y:2,w:8,h:1}],"\u{1FB78}":[{x:0,y:3,w:8,h:1}],"\u{1FB79}":[{x:0,y:4,w:8,h:1}],"\u{1FB7A}":[{x:0,y:5,w:8,h:1}],"\u{1FB7B}":[{x:0,y:6,w:8,h:1}],"\u{1FB7C}":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"\u{1FB7D}":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"\u{1FB7E}":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"\u{1FB7F}":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"\u{1FB80}":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"\u{1FB81}":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"\u{1FB82}":[{x:0,y:0,w:8,h:2}],"\u{1FB83}":[{x:0,y:0,w:8,h:3}],"\u{1FB84}":[{x:0,y:0,w:8,h:5}],"\u{1FB85}":[{x:0,y:0,w:8,h:6}],"\u{1FB86}":[{x:0,y:0,w:8,h:7}],"\u{1FB87}":[{x:6,y:0,w:2,h:8}],"\u{1FB88}":[{x:5,y:0,w:3,h:8}],"\u{1FB89}":[{x:3,y:0,w:5,h:8}],"\u{1FB8A}":[{x:2,y:0,w:6,h:8}],"\u{1FB8B}":[{x:1,y:0,w:7,h:8}],"\u{1FB95}":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"\u{1FB96}":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"\u{1FB97}":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};var go={"\u2591":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"\u2592":[[1,0],[0,0],[0,1],[0,0]],"\u2593":[[0,1],[1,1],[1,0],[1,1]]};E.boxDrawingDefinitions={"\u2500":(O={},O[1]="M0,.5 L1,.5",O),"\u2501":(b={},b[3]="M0,.5 L1,.5",b),"\u2502":(w={},w[1]="M.5,0 L.5,1",w),"\u2503":(g={},g[3]="M.5,0 L.5,1",g),"\u250C":(D={},D[1]="M0.5,1 L.5,.5 L1,.5",D),"\u250F":(T={},T[3]="M0.5,1 L.5,.5 L1,.5",T),"\u2510":(f={},f[1]="M0,.5 L.5,.5 L.5,1",f),"\u2513":(p={},p[3]="M0,.5 L.5,.5 L.5,1",p),"\u2514":(_={},_[1]="M.5,0 L.5,.5 L1,.5",_),"\u2517":(d={},d[3]="M.5,0 L.5,.5 L1,.5",d),"\u2518":(o={},o[1]="M.5,0 L.5,.5 L0,.5",o),"\u251B":(s={},s[3]="M.5,0 L.5,.5 L0,.5",s),"\u251C":(a={},a[1]="M.5,0 L.5,1 M.5,.5 L1,.5",a),"\u2523":(u={},u[3]="M.5,0 L.5,1 M.5,.5 L1,.5",u),"\u2524":(l={},l[1]="M.5,0 L.5,1 M.5,.5 L0,.5",l),"\u252B":(A={},A[3]="M.5,0 L.5,1 M.5,.5 L0,.5",A),"\u252C":(I={},I[1]="M0,.5 L1,.5 M.5,.5 L.5,1",I),"\u2533":(R={},R[3]="M0,.5 L1,.5 M.5,.5 L.5,1",R),"\u2534":(y={},y[1]="M0,.5 L1,.5 M.5,.5 L.5,0",y),"\u253B":(v={},v[3]="M0,.5 L1,.5 M.5,.5 L.5,0",v),"\u253C":(m={},m[1]="M0,.5 L1,.5 M.5,0 L.5,1",m),"\u254B":(S={},S[3]="M0,.5 L1,.5 M.5,0 L.5,1",S),"\u2574":(B={},B[1]="M.5,.5 L0,.5",B),"\u2578":(N={},N[3]="M.5,.5 L0,.5",N),"\u2575":(M={},M[1]="M.5,.5 L.5,0",M),"\u2579":(U={},U[3]="M.5,.5 L.5,0",U),"\u2576":(K={},K[1]="M.5,.5 L1,.5",K),"\u257A":(j={},j[3]="M.5,.5 L1,.5",j),"\u2577":(X={},X[1]="M.5,.5 L.5,1",X),"\u257B":(ie={},ie[3]="M.5,.5 L.5,1",ie),"\u2550":(se={},se[1]=function(Pe,xe){return"M0,"+(.5-xe)+" L1,"+(.5-xe)+" M0,"+(.5+xe)+" L1,"+(.5+xe)},se),"\u2551":(le={},le[1]=function(Pe,xe){return"M"+(.5-Pe)+",0 L"+(.5-Pe)+",1 M"+(.5+Pe)+",0 L"+(.5+Pe)+",1"},le),"\u2552":(ve={},ve[1]=function(Pe,xe){return"M.5,1 L.5,"+(.5-xe)+" L1,"+(.5-xe)+" M.5,"+(.5+xe)+" L1,"+(.5+xe)},ve),"\u2553":(q={},q[1]=function(Pe,xe){return"M"+(.5-Pe)+",1 L"+(.5-Pe)+",.5 L1,.5 M"+(.5+Pe)+",.5 L"+(.5+Pe)+",1"},q),"\u2554":(ee={},ee[1]=function(Pe,xe){return"M1,"+(.5-xe)+" L"+(.5-Pe)+","+(.5-xe)+" L"+(.5-Pe)+",1 M1,"+(.5+xe)+" L"+(.5+Pe)+","+(.5+xe)+" L"+(.5+Pe)+",1"},ee),"\u2555":(ae={},ae[1]=function(Pe,xe){return"M0,"+(.5-xe)+" L.5,"+(.5-xe)+" L.5,1 M0,"+(.5+xe)+" L.5,"+(.5+xe)},ae),"\u2556":(_e={},_e[1]=function(Pe,xe){return"M"+(.5+Pe)+",1 L"+(.5+Pe)+",.5 L0,.5 M"+(.5-Pe)+",.5 L"+(.5-Pe)+",1"},_e),"\u2557":(fe={},fe[1]=function(Pe,xe){return"M0,"+(.5+xe)+" L"+(.5-Pe)+","+(.5+xe)+" L"+(.5-Pe)+",1 M0,"+(.5-xe)+" L"+(.5+Pe)+","+(.5-xe)+" L"+(.5+Pe)+",1"},fe),"\u2558":(Ge={},Ge[1]=function(Pe,xe){return"M.5,0 L.5,"+(.5+xe)+" L1,"+(.5+xe)+" M.5,"+(.5-xe)+" L1,"+(.5-xe)},Ge),"\u2559":(Te={},Te[1]=function(Pe,xe){return"M1,.5 L"+(.5-Pe)+",.5 L"+(.5-Pe)+",0 M"+(.5+Pe)+",.5 L"+(.5+Pe)+",0"},Te),"\u255A":(Ue={},Ue[1]=function(Pe,xe){return"M1,"+(.5-xe)+" L"+(.5+Pe)+","+(.5-xe)+" L"+(.5+Pe)+",0 M1,"+(.5+xe)+" L"+(.5-Pe)+","+(.5+xe)+" L"+(.5-Pe)+",0"},Ue),"\u255B":(Ze={},Ze[1]=function(Pe,xe){return"M0,"+(.5+xe)+" L.5,"+(.5+xe)+" L.5,0 M0,"+(.5-xe)+" L.5,"+(.5-xe)},Ze),"\u255C":(ut={},ut[1]=function(Pe,xe){return"M0,.5 L"+(.5+Pe)+",.5 L"+(.5+Pe)+",0 M"+(.5-Pe)+",.5 L"+(.5-Pe)+",0"},ut),"\u255D":(Fe={},Fe[1]=function(Pe,xe){return"M0,"+(.5-xe)+" L"+(.5-Pe)+","+(.5-xe)+" L"+(.5-Pe)+",0 M0,"+(.5+xe)+" L"+(.5+Pe)+","+(.5+xe)+" L"+(.5+Pe)+",0"},Fe),"\u255E":(Ye={},Ye[1]=function(Pe,xe){return"M.5,0 L.5,1 M.5,"+(.5-xe)+" L1,"+(.5-xe)+" M.5,"+(.5+xe)+" L1,"+(.5+xe)},Ye),"\u255F":(Ht={},Ht[1]=function(Pe,xe){return"M"+(.5-Pe)+",0 L"+(.5-Pe)+",1 M"+(.5+Pe)+",0 L"+(.5+Pe)+",1 M"+(.5+Pe)+",.5 L1,.5"},Ht),"\u2560":(Bt={},Bt[1]=function(Pe,xe){return"M"+(.5-Pe)+",0 L"+(.5-Pe)+",1 M1,"+(.5+xe)+" L"+(.5+Pe)+","+(.5+xe)+" L"+(.5+Pe)+",1 M1,"+(.5-xe)+" L"+(.5+Pe)+","+(.5-xe)+" L"+(.5+Pe)+",0"},Bt),"\u2561":(Ft={},Ft[1]=function(Pe,xe){return"M.5,0 L.5,1 M0,"+(.5-xe)+" L.5,"+(.5-xe)+" M0,"+(.5+xe)+" L.5,"+(.5+xe)},Ft),"\u2562":(Mt={},Mt[1]=function(Pe,xe){return"M0,.5 L"+(.5-Pe)+",.5 M"+(.5-Pe)+",0 L"+(.5-Pe)+",1 M"+(.5+Pe)+",0 L"+(.5+Pe)+",1"},Mt),"\u2563":(cr={},cr[1]=function(Pe,xe){return"M"+(.5+Pe)+",0 L"+(.5+Pe)+",1 M0,"+(.5+xe)+" L"+(.5-Pe)+","+(.5+xe)+" L"+(.5-Pe)+",1 M0,"+(.5-xe)+" L"+(.5-Pe)+","+(.5-xe)+" L"+(.5-Pe)+",0"},cr),"\u2564":(sr={},sr[1]=function(Pe,xe){return"M0,"+(.5-xe)+" L1,"+(.5-xe)+" M0,"+(.5+xe)+" L1,"+(.5+xe)+" M.5,"+(.5+xe)+" L.5,1"},sr),"\u2565":(br={},br[1]=function(Pe,xe){return"M0,.5 L1,.5 M"+(.5-Pe)+",.5 L"+(.5-Pe)+",1 M"+(.5+Pe)+",.5 L"+(.5+Pe)+",1"},br),"\u2566":(hi={},hi[1]=function(Pe,xe){return"M0,"+(.5-xe)+" L1,"+(.5-xe)+" M0,"+(.5+xe)+" L"+(.5-Pe)+","+(.5+xe)+" L"+(.5-Pe)+",1 M1,"+(.5+xe)+" L"+(.5+Pe)+","+(.5+xe)+" L"+(.5+Pe)+",1"},hi),"\u2567":(Mr={},Mr[1]=function(Pe,xe){return"M.5,0 L.5,"+(.5-xe)+" M0,"+(.5-xe)+" L1,"+(.5-xe)+" M0,"+(.5+xe)+" L1,"+(.5+xe)},Mr),"\u2568":(Hr={},Hr[1]=function(Pe,xe){return"M0,.5 L1,.5 M"+(.5-Pe)+",.5 L"+(.5-Pe)+",0 M"+(.5+Pe)+",.5 L"+(.5+Pe)+",0"},Hr),"\u2569":(pi={},pi[1]=function(Pe,xe){return"M0,"+(.5+xe)+" L1,"+(.5+xe)+" M0,"+(.5-xe)+" L"+(.5-Pe)+","+(.5-xe)+" L"+(.5-Pe)+",0 M1,"+(.5-xe)+" L"+(.5+Pe)+","+(.5-xe)+" L"+(.5+Pe)+",0"},pi),"\u256A":(si={},si[1]=function(Pe,xe){return"M.5,0 L.5,1 M0,"+(.5-xe)+" L1,"+(.5-xe)+" M0,"+(.5+xe)+" L1,"+(.5+xe)},si),"\u256B":(bi={},bi[1]=function(Pe,xe){return"M0,.5 L1,.5 M"+(.5-Pe)+",0 L"+(.5-Pe)+",1 M"+(.5+Pe)+",0 L"+(.5+Pe)+",1"},bi),"\u256C":(oi={},oi[1]=function(Pe,xe){return"M0,"+(.5+xe)+" L"+(.5-Pe)+","+(.5+xe)+" L"+(.5-Pe)+",1 M1,"+(.5+xe)+" L"+(.5+Pe)+","+(.5+xe)+" L"+(.5+Pe)+",1 M0,"+(.5-xe)+" L"+(.5-Pe)+","+(.5-xe)+" L"+(.5-Pe)+",0 M1,"+(.5-xe)+" L"+(.5+Pe)+","+(.5-xe)+" L"+(.5+Pe)+",0"},oi),"\u2571":(Ci={},Ci[1]="M1,0 L0,1",Ci),"\u2572":(sn={},sn[1]="M0,0 L1,1",sn),"\u2573":(Zr={},Zr[1]="M1,0 L0,1 M0,0 L1,1",Zr),"\u257C":(Rr={},Rr[1]="M.5,.5 L0,.5",Rr[3]="M.5,.5 L1,.5",Rr),"\u257D":(Vr={},Vr[1]="M.5,.5 L.5,0",Vr[3]="M.5,.5 L.5,1",Vr),"\u257E":(Lt={},Lt[1]="M.5,.5 L1,.5",Lt[3]="M.5,.5 L0,.5",Lt),"\u257F":($r={},$r[1]="M.5,.5 L.5,1",$r[3]="M.5,.5 L.5,0",$r),"\u250D":(wn={},wn[1]="M.5,.5 L.5,1",wn[3]="M.5,.5 L1,.5",wn),"\u250E":(on={},on[1]="M.5,.5 L1,.5",on[3]="M.5,.5 L.5,1",on),"\u2511":(wi={},wi[1]="M.5,.5 L.5,1",wi[3]="M.5,.5 L0,.5",wi),"\u2512":(pn={},pn[1]="M.5,.5 L0,.5",pn[3]="M.5,.5 L.5,1",pn),"\u2515":(vn={},vn[1]="M.5,.5 L.5,0",vn[3]="M.5,.5 L1,.5",vn),"\u2516":(Oi={},Oi[1]="M.5,.5 L1,.5",Oi[3]="M.5,.5 L.5,0",Oi),"\u2519":(Ln={},Ln[1]="M.5,.5 L.5,0",Ln[3]="M.5,.5 L0,.5",Ln),"\u251A":(Ds={},Ds[1]="M.5,.5 L0,.5",Ds[3]="M.5,.5 L.5,0",Ds),"\u251D":(Dn={},Dn[1]="M.5,0 L.5,1",Dn[3]="M.5,.5 L1,.5",Dn),"\u251E":(bs={},bs[1]="M0.5,1 L.5,.5 L1,.5",bs[3]="M.5,.5 L.5,0",bs),"\u251F":(hs={},hs[1]="M.5,0 L.5,.5 L1,.5",hs[3]="M.5,.5 L.5,1",hs),"\u2520":(Vs={},Vs[1]="M.5,.5 L1,.5",Vs[3]="M.5,0 L.5,1",Vs),"\u2521":(Os={},Os[1]="M.5,.5 L.5,1",Os[3]="M.5,0 L.5,.5 L1,.5",Os),"\u2522":(Fn={},Fn[1]="M.5,.5 L.5,0",Fn[3]="M0.5,1 L.5,.5 L1,.5",Fn),"\u2525":(Yr={},Yr[1]="M.5,0 L.5,1",Yr[3]="M.5,.5 L0,.5",Yr),"\u2526":($t={},$t[1]="M0,.5 L.5,.5 L.5,1",$t[3]="M.5,.5 L.5,0",$t),"\u2527":(Jr={},Jr[1]="M.5,0 L.5,.5 L0,.5",Jr[3]="M.5,.5 L.5,1",Jr),"\u2528":(oo={},oo[1]="M.5,.5 L0,.5",oo[3]="M.5,0 L.5,1",oo),"\u2529":(ao={},ao[1]="M.5,.5 L.5,1",ao[3]="M.5,0 L.5,.5 L0,.5",ao),"\u252A":(co={},co[1]="M.5,.5 L.5,0",co[3]="M0,.5 L.5,.5 L.5,1",co),"\u252D":(Ro={},Ro[1]="M0.5,1 L.5,.5 L1,.5",Ro[3]="M.5,.5 L0,.5",Ro),"\u252E":(_a={},_a[1]="M0,.5 L.5,.5 L.5,1",_a[3]="M.5,.5 L1,.5",_a),"\u252F":(wo={},wo[1]="M.5,.5 L.5,1",wo[3]="M0,.5 L1,.5",wo),"\u2530":(Lo={},Lo[1]="M0,.5 L1,.5",Lo[3]="M.5,.5 L.5,1",Lo),"\u2531":(Xo={},Xo[1]="M.5,.5 L1,.5",Xo[3]="M0,.5 L.5,.5 L.5,1",Xo),"\u2532":(Do={},Do[1]="M.5,.5 L0,.5",Do[3]="M0.5,1 L.5,.5 L1,.5",Do),"\u2535":(Bs={},Bs[1]="M.5,0 L.5,.5 L1,.5",Bs[3]="M.5,.5 L0,.5",Bs),"\u2536":(lo={},lo[1]="M.5,0 L.5,.5 L0,.5",lo[3]="M.5,.5 L1,.5",lo),"\u2537":(bo={},bo[1]="M.5,.5 L.5,0",bo[3]="M0,.5 L1,.5",bo),"\u2538":(es={},es[1]="M0,.5 L1,.5",es[3]="M.5,.5 L.5,0",es),"\u2539":(_i={},_i[1]="M.5,.5 L1,.5",_i[3]="M.5,0 L.5,.5 L0,.5",_i),"\u253A":(Zo={},Zo[1]="M.5,.5 L0,.5",Zo[3]="M.5,0 L.5,.5 L1,.5",Zo),"\u253D":(mn={},mn[1]="M.5,0 L.5,1 M.5,.5 L1,.5",mn[3]="M.5,.5 L0,.5",mn),"\u253E":(uo={},uo[1]="M.5,0 L.5,1 M.5,.5 L0,.5",uo[3]="M.5,.5 L1,.5",uo),"\u253F":(ei={},ei[1]="M.5,0 L.5,1",ei[3]="M0,.5 L1,.5",ei),"\u2540":(bn={},bn[1]="M0,.5 L1,.5 M.5,.5 L.5,1",bn[3]="M.5,.5 L.5,0",bn),"\u2541":(On={},On[1]="M.5,.5 L.5,0 M0,.5 L1,.5",On[3]="M.5,.5 L.5,1",On),"\u2542":($o={},$o[1]="M0,.5 L1,.5",$o[3]="M.5,0 L.5,1",$o),"\u2543":(fs={},fs[1]="M0.5,1 L.5,.5 L1,.5",fs[3]="M.5,0 L.5,.5 L0,.5",fs),"\u2544":(ts={},ts[1]="M0,.5 L.5,.5 L.5,1",ts[3]="M.5,0 L.5,.5 L1,.5",ts),"\u2545":(Ys={},Ys[1]="M.5,0 L.5,.5 L1,.5",Ys[3]="M0,.5 L.5,.5 L.5,1",Ys),"\u2546":(ho={},ho[1]="M.5,0 L.5,.5 L0,.5",ho[3]="M0.5,1 L.5,.5 L1,.5",ho),"\u2547":(ea={},ea[1]="M.5,.5 L.5,1",ea[3]="M.5,.5 L.5,0 M0,.5 L1,.5",ea),"\u2548":(As={},As[1]="M.5,.5 L.5,0",As[3]="M0,.5 L1,.5 M.5,.5 L.5,1",As),"\u2549":(Ns={},Ns[1]="M.5,.5 L1,.5",Ns[3]="M.5,0 L.5,1 M.5,.5 L0,.5",Ns),"\u254A":(Fi={},Fi[1]="M.5,.5 L0,.5",Fi[3]="M.5,0 L.5,1 M.5,.5 L1,.5",Fi),"\u254C":(Ca={},Ca[1]="M.1,.5 L.4,.5 M.6,.5 L.9,.5",Ca),"\u254D":(fo={},fo[3]="M.1,.5 L.4,.5 M.6,.5 L.9,.5",fo),"\u2504":(Bi={},Bi[1]="M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5",Bi),"\u2505":(gs={},gs[3]="M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5",gs),"\u2508":(Or={},Or[1]="M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5",Or),"\u2509":(Oo={},Oo[3]="M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5",Oo),"\u254E":(Js={},Js[1]="M.5,.1 L.5,.4 M.5,.6 L.5,.9",Js),"\u254F":(ta={},ta[3]="M.5,.1 L.5,.4 M.5,.6 L.5,.9",ta),"\u2506":(En={},En[1]="M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333",En),"\u2507":(ra={},ra[3]="M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333",ra),"\u250A":(Bo={},Bo[1]="M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95",Bo),"\u250B":(ya={},ya[3]="M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95",ya),"\u256D":(Ao={},Ao[1]="C.5,1,.5,.5,1,.5",Ao),"\u256E":(Qn={},Qn[1]="C.5,1,.5,.5,0,.5",Qn),"\u256F":(ia={},ia[1]="C.5,0,.5,.5,0,.5",ia),"\u2570":(na={},na[1]="C.5,0,.5,.5,1,.5",na)},E.tryDrawCustomChar=function(Pe,xe,mr,Ps,Gn,lr){var Kr=E.blockElementDefinitions[xe];if(Kr)return function(vi,an,Ni,ps,xs,vs){for(var Pi=0;Pi<an.length;Pi++){var cn=an[Pi],mi=xs/8,_n=vs/8;vi.fillRect(Ni+cn.x*mi,ps+cn.y*_n,cn.w*mi,cn.h*_n)}}(Pe,Kr,mr,Ps,Gn,lr),!0;var Qi=go[xe];if(Qi)return function(vi,an,Ni,ps,xs,vs){var Pi,cn=Ka.get(an);cn||(cn=new Map,Ka.set(an,cn));var mi=vi.fillStyle;if(typeof mi!="string")throw new Error('Unexpected fillStyle type "'+mi+'"');var _n=cn.get(mi);if(!_n){var Gi=an[0].length,ms=an.length,qs=document.createElement("canvas");qs.width=Gi,qs.height=ms;var No=(0,Ha.throwIfFalsy)(qs.getContext("2d")),rs=new ImageData(Gi,ms),xi=void 0,Ms=void 0,Po=void 0,po=void 0;if(mi.startsWith("#"))xi=parseInt(mi.substr(1,2),16),Ms=parseInt(mi.substr(3,2),16),Po=parseInt(mi.substr(5,2),16),po=mi.length>7&&parseInt(mi.substr(7,2),16)||1;else{if(!mi.startsWith("rgba"))throw new Error('Unexpected fillStyle color format "'+mi+'" when drawing pattern glyph');xi=(Pi=mi.substring(5,mi.length-1).split(",").map(function(vo){return parseFloat(vo)}))[0],Ms=Pi[1],Po=Pi[2],po=Pi[3]}for(var Nn=0;Nn<ms;Nn++)for(var ks=0;ks<Gi;ks++)rs.data[4*(Nn*Gi+ks)]=xi,rs.data[4*(Nn*Gi+ks)+1]=Ms,rs.data[4*(Nn*Gi+ks)+2]=Po,rs.data[4*(Nn*Gi+ks)+3]=an[Nn][ks]*(255*po);No.putImageData(rs,0,0),_n=(0,Ha.throwIfFalsy)(vi.createPattern(qs,null)),cn.set(mi,_n)}vi.fillStyle=_n,vi.fillRect(Ni,ps,xs,vs)}(Pe,Qi,mr,Ps,Gn,lr),!0;var Bn=E.boxDrawingDefinitions[xe];return!!Bn&&(function(vi,an,Ni,ps,xs,vs){vi.strokeStyle=vi.fillStyle;for(var Pi=0,cn=Object.entries(an);Pi<cn.length;Pi++){var mi=cn[Pi],_n=mi[0],Gi=mi[1];vi.beginPath(),vi.lineWidth=window.devicePixelRatio*Number.parseInt(_n);for(var ms=0,qs=(typeof Gi=="function"?Gi(.15,.15/vs*xs):Gi).split(" ");ms<qs.length;ms++){var No=qs[ms],rs=No[0],xi=Sa[rs];if(xi){var Ms=No.substring(1).split(",");Ms[0]&&Ms[1]&&xi(vi,zs(Ms,xs,vs,Ni,ps))}else console.error('Could not find drawing instructions for "'+rs+'"')}vi.stroke(),vi.closePath()}}(Pe,Bn,mr,Ps,Gn,lr),!0)};var Ka=new Map;function Ia(Pe,xe,mr){return mr===void 0&&(mr=0),Math.max(Math.min(Pe,xe),mr)}var Sa={C:function(Pe,xe){return Pe.bezierCurveTo(xe[0],xe[1],xe[2],xe[3],xe[4],xe[5])},L:function(Pe,xe){return Pe.lineTo(xe[0],xe[1])},M:function(Pe,xe){return Pe.moveTo(xe[0],xe[1])}};function zs(Pe,xe,mr,Ps,Gn){var lr=Pe.map(function(Bn){return parseFloat(Bn)||parseInt(Bn)});if(lr.length<2)throw new Error("Too few arguments for instruction");for(var Kr=0;Kr<lr.length;Kr+=2)lr[Kr]*=xe,lr[Kr]!==0&&(lr[Kr]=Ia(Math.round(lr[Kr]+.5)-.5,xe,0)),lr[Kr]+=Ps;for(var Qi=1;Qi<lr.length;Qi+=2)lr[Qi]*=mr,lr[Qi]!==0&&(lr[Qi]=Ia(Math.round(lr[Qi]+.5)-.5,mr,0)),lr[Qi]+=Gn;return lr}},3700:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.GridCache=void 0;var L=function(){function O(){this.cache=[]}return O.prototype.resize=function(b,w){for(var g=0;g<b;g++){this.cache.length<=g&&this.cache.push([]);for(var D=this.cache[g].length;D<w;D++)this.cache[g].push(void 0);this.cache[g].length=w}this.cache.length=b},O.prototype.clear=function(){for(var b=0;b<this.cache.length;b++)for(var w=0;w<this.cache[b].length;w++)this.cache[b][w]=void 0},O}();E.GridCache=L},5098:function(P,E,L){var O,b=this&&this.__extends||(O=function(d,o){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,a){s.__proto__=a}||function(s,a){for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(s[u]=a[u])},O(d,o)},function(d,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function s(){this.constructor=d}O(d,o),d.prototype=o===null?Object.create(o):(s.prototype=o.prototype,new s)}),w=this&&this.__decorate||function(d,o,s,a){var u,l=arguments.length,A=l<3?o:a===null?a=Object.getOwnPropertyDescriptor(o,s):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(d,o,s,a);else for(var I=d.length-1;I>=0;I--)(u=d[I])&&(A=(l<3?u(A):l>3?u(o,s,A):u(o,s))||A);return l>3&&A&&Object.defineProperty(o,s,A),A},g=this&&this.__param||function(d,o){return function(s,a){o(s,a,d)}};Object.defineProperty(E,"__esModule",{value:!0}),E.LinkRenderLayer=void 0;var D=L(1546),T=L(8803),f=L(2040),p=L(2585),_=function(d){function o(s,a,u,l,A,I,R,y){var v=d.call(this,s,"link",a,!0,u,l,R,y)||this;return A.onShowLinkUnderline(function(m){return v._onShowLinkUnderline(m)}),A.onHideLinkUnderline(function(m){return v._onHideLinkUnderline(m)}),I.onShowLinkUnderline(function(m){return v._onShowLinkUnderline(m)}),I.onHideLinkUnderline(function(m){return v._onHideLinkUnderline(m)}),v}return b(o,d),o.prototype.resize=function(s){d.prototype.resize.call(this,s),this._state=void 0},o.prototype.reset=function(){this._clearCurrentLink()},o.prototype._clearCurrentLink=function(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);var s=this._state.y2-this._state.y1-1;s>0&&this._clearCells(0,this._state.y1+1,this._state.cols,s),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}},o.prototype._onShowLinkUnderline=function(s){if(s.fg===T.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._colors.background.css:s.fg&&(0,f.is256Color)(s.fg)?this._ctx.fillStyle=this._colors.ansi[s.fg].css:this._ctx.fillStyle=this._colors.foreground.css,s.y1===s.y2)this._fillBottomLineAtCells(s.x1,s.y1,s.x2-s.x1);else{this._fillBottomLineAtCells(s.x1,s.y1,s.cols-s.x1);for(var a=s.y1+1;a<s.y2;a++)this._fillBottomLineAtCells(0,a,s.cols);this._fillBottomLineAtCells(0,s.y2,s.x2)}this._state=s},o.prototype._onHideLinkUnderline=function(s){this._clearCurrentLink()},w([g(6,p.IBufferService),g(7,p.IOptionsService)],o)}(D.BaseRenderLayer);E.LinkRenderLayer=_},3525:function(P,E,L){var O,b=this&&this.__extends||(O=function(A,I){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(R,y){R.__proto__=y}||function(R,y){for(var v in y)Object.prototype.hasOwnProperty.call(y,v)&&(R[v]=y[v])},O(A,I)},function(A,I){if(typeof I!="function"&&I!==null)throw new TypeError("Class extends value "+String(I)+" is not a constructor or null");function R(){this.constructor=A}O(A,I),A.prototype=I===null?Object.create(I):(R.prototype=I.prototype,new R)}),w=this&&this.__decorate||function(A,I,R,y){var v,m=arguments.length,S=m<3?I:y===null?y=Object.getOwnPropertyDescriptor(I,R):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(A,I,R,y);else for(var B=A.length-1;B>=0;B--)(v=A[B])&&(S=(m<3?v(S):m>3?v(I,R,S):v(I,R))||S);return m>3&&S&&Object.defineProperty(I,R,S),S},g=this&&this.__param||function(A,I){return function(R,y){I(R,y,A)}};Object.defineProperty(E,"__esModule",{value:!0}),E.Renderer=void 0;var D=L(9596),T=L(4149),f=L(2512),p=L(5098),_=L(844),d=L(4725),o=L(2585),s=L(1420),a=L(8460),u=1,l=function(A){function I(R,y,v,m,S,B,N,M){var U=A.call(this)||this;U._colors=R,U._screenElement=y,U._bufferService=B,U._charSizeService=N,U._optionsService=M,U._id=u++,U._onRequestRedraw=new a.EventEmitter;var K=U._optionsService.options.allowTransparency;return U._renderLayers=[S.createInstance(D.TextRenderLayer,U._screenElement,0,U._colors,K,U._id),S.createInstance(T.SelectionRenderLayer,U._screenElement,1,U._colors,U._id),S.createInstance(p.LinkRenderLayer,U._screenElement,2,U._colors,U._id,v,m),S.createInstance(f.CursorRenderLayer,U._screenElement,3,U._colors,U._id,U._onRequestRedraw)],U.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},U._devicePixelRatio=window.devicePixelRatio,U._updateDimensions(),U.onOptionsChanged(),U}return b(I,A),Object.defineProperty(I.prototype,"onRequestRedraw",{get:function(){return this._onRequestRedraw.event},enumerable:!1,configurable:!0}),I.prototype.dispose=function(){for(var R=0,y=this._renderLayers;R<y.length;R++)y[R].dispose();A.prototype.dispose.call(this),(0,s.removeTerminalFromCache)(this._id)},I.prototype.onDevicePixelRatioChange=function(){this._devicePixelRatio!==window.devicePixelRatio&&(this._devicePixelRatio=window.devicePixelRatio,this.onResize(this._bufferService.cols,this._bufferService.rows))},I.prototype.setColors=function(R){this._colors=R;for(var y=0,v=this._renderLayers;y<v.length;y++){var m=v[y];m.setColors(this._colors),m.reset()}},I.prototype.onResize=function(R,y){this._updateDimensions();for(var v=0,m=this._renderLayers;v<m.length;v++)m[v].resize(this.dimensions);this._screenElement.style.width=this.dimensions.canvasWidth+"px",this._screenElement.style.height=this.dimensions.canvasHeight+"px"},I.prototype.onCharSizeChanged=function(){this.onResize(this._bufferService.cols,this._bufferService.rows)},I.prototype.onBlur=function(){this._runOperation(function(R){return R.onBlur()})},I.prototype.onFocus=function(){this._runOperation(function(R){return R.onFocus()})},I.prototype.onSelectionChanged=function(R,y,v){v===void 0&&(v=!1),this._runOperation(function(m){return m.onSelectionChanged(R,y,v)})},I.prototype.onCursorMove=function(){this._runOperation(function(R){return R.onCursorMove()})},I.prototype.onOptionsChanged=function(){this._runOperation(function(R){return R.onOptionsChanged()})},I.prototype.clear=function(){this._runOperation(function(R){return R.reset()})},I.prototype._runOperation=function(R){for(var y=0,v=this._renderLayers;y<v.length;y++)R(v[y])},I.prototype.renderRows=function(R,y){for(var v=0,m=this._renderLayers;v<m.length;v++)m[v].onGridChanged(R,y)},I.prototype.clearTextureAtlas=function(){for(var R=0,y=this._renderLayers;R<y.length;R++)y[R].clearTextureAtlas()},I.prototype._updateDimensions=function(){this._charSizeService.hasValidSize&&(this.dimensions.scaledCharWidth=Math.floor(this._charSizeService.width*window.devicePixelRatio),this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*window.devicePixelRatio),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.options.lineHeight),this.dimensions.scaledCharTop=this._optionsService.options.lineHeight===1?0:Math.round((this.dimensions.scaledCellHeight-this.dimensions.scaledCharHeight)/2),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.options.letterSpacing),this.dimensions.scaledCharLeft=Math.floor(this._optionsService.options.letterSpacing/2),this.dimensions.scaledCanvasHeight=this._bufferService.rows*this.dimensions.scaledCellHeight,this.dimensions.scaledCanvasWidth=this._bufferService.cols*this.dimensions.scaledCellWidth,this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio),this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio),this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows,this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols)},w([g(4,o.IInstantiationService),g(5,o.IBufferService),g(6,d.ICharSizeService),g(7,o.IOptionsService)],I)}(_.Disposable);E.Renderer=l},1752:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.throwIfFalsy=void 0,E.throwIfFalsy=function(L){if(!L)throw new Error("value must not be falsy");return L}},4149:function(P,E,L){var O,b=this&&this.__extends||(O=function(p,_){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,o){d.__proto__=o}||function(d,o){for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(d[s]=o[s])},O(p,_)},function(p,_){if(typeof _!="function"&&_!==null)throw new TypeError("Class extends value "+String(_)+" is not a constructor or null");function d(){this.constructor=p}O(p,_),p.prototype=_===null?Object.create(_):(d.prototype=_.prototype,new d)}),w=this&&this.__decorate||function(p,_,d,o){var s,a=arguments.length,u=a<3?_:o===null?o=Object.getOwnPropertyDescriptor(_,d):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(p,_,d,o);else for(var l=p.length-1;l>=0;l--)(s=p[l])&&(u=(a<3?s(u):a>3?s(_,d,u):s(_,d))||u);return a>3&&u&&Object.defineProperty(_,d,u),u},g=this&&this.__param||function(p,_){return function(d,o){_(d,o,p)}};Object.defineProperty(E,"__esModule",{value:!0}),E.SelectionRenderLayer=void 0;var D=L(1546),T=L(2585),f=function(p){function _(d,o,s,a,u,l){var A=p.call(this,d,"selection",o,!0,s,a,u,l)||this;return A._clearState(),A}return b(_,p),_.prototype._clearState=function(){this._state={start:void 0,end:void 0,columnSelectMode:void 0,ydisp:void 0}},_.prototype.resize=function(d){p.prototype.resize.call(this,d),this._clearState()},_.prototype.reset=function(){this._state.start&&this._state.end&&(this._clearState(),this._clearAll())},_.prototype.onSelectionChanged=function(d,o,s){if(this._didStateChange(d,o,s,this._bufferService.buffer.ydisp))if(this._clearAll(),d&&o){var a=d[1]-this._bufferService.buffer.ydisp,u=o[1]-this._bufferService.buffer.ydisp,l=Math.max(a,0),A=Math.min(u,this._bufferService.rows-1);if(l>=this._bufferService.rows||A<0)this._state.ydisp=this._bufferService.buffer.ydisp;else{if(this._ctx.fillStyle=this._colors.selectionTransparent.css,s){var I=d[0],R=o[0]-I,y=A-l+1;this._fillCells(I,l,R,y)}else{I=a===l?d[0]:0;var v=l===u?o[0]:this._bufferService.cols;this._fillCells(I,l,v-I,1);var m=Math.max(A-l-1,0);if(this._fillCells(0,l+1,this._bufferService.cols,m),l!==A){var S=u===A?o[0]:this._bufferService.cols;this._fillCells(0,A,S,1)}}this._state.start=[d[0],d[1]],this._state.end=[o[0],o[1]],this._state.columnSelectMode=s,this._state.ydisp=this._bufferService.buffer.ydisp}}else this._clearState()},_.prototype._didStateChange=function(d,o,s,a){return!this._areCoordinatesEqual(d,this._state.start)||!this._areCoordinatesEqual(o,this._state.end)||s!==this._state.columnSelectMode||a!==this._state.ydisp},_.prototype._areCoordinatesEqual=function(d,o){return!(!d||!o)&&d[0]===o[0]&&d[1]===o[1]},w([g(4,T.IBufferService),g(5,T.IOptionsService)],_)}(D.BaseRenderLayer);E.SelectionRenderLayer=f},9596:function(P,E,L){var O,b=this&&this.__extends||(O=function(u,l){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,I){A.__proto__=I}||function(A,I){for(var R in I)Object.prototype.hasOwnProperty.call(I,R)&&(A[R]=I[R])},O(u,l)},function(u,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");function A(){this.constructor=u}O(u,l),u.prototype=l===null?Object.create(l):(A.prototype=l.prototype,new A)}),w=this&&this.__decorate||function(u,l,A,I){var R,y=arguments.length,v=y<3?l:I===null?I=Object.getOwnPropertyDescriptor(l,A):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(u,l,A,I);else for(var m=u.length-1;m>=0;m--)(R=u[m])&&(v=(y<3?R(v):y>3?R(l,A,v):R(l,A))||v);return y>3&&v&&Object.defineProperty(l,A,v),v},g=this&&this.__param||function(u,l){return function(A,I){l(A,I,u)}};Object.defineProperty(E,"__esModule",{value:!0}),E.TextRenderLayer=void 0;var D=L(3700),T=L(1546),f=L(3734),p=L(643),_=L(511),d=L(2585),o=L(4725),s=L(4269),a=function(u){function l(A,I,R,y,v,m,S,B){var N=u.call(this,A,"text",I,y,R,v,m,S)||this;return N._characterJoinerService=B,N._characterWidth=0,N._characterFont="",N._characterOverlapCache={},N._workCell=new _.CellData,N._state=new D.GridCache,N}return b(l,u),l.prototype.resize=function(A){u.prototype.resize.call(this,A);var I=this._getFont(!1,!1);this._characterWidth===A.scaledCharWidth&&this._characterFont===I||(this._characterWidth=A.scaledCharWidth,this._characterFont=I,this._characterOverlapCache={}),this._state.clear(),this._state.resize(this._bufferService.cols,this._bufferService.rows)},l.prototype.reset=function(){this._state.clear(),this._clearAll()},l.prototype._forEachCell=function(A,I,R){for(var y=A;y<=I;y++)for(var v=y+this._bufferService.buffer.ydisp,m=this._bufferService.buffer.lines.get(v),S=this._characterJoinerService.getJoinedCharacters(v),B=0;B<this._bufferService.cols;B++){m.loadCell(B,this._workCell);var N=this._workCell,M=!1,U=B;if(N.getWidth()!==0){if(S.length>0&&B===S[0][0]){M=!0;var K=S.shift();N=new s.JoinedCellData(this._workCell,m.translateToString(!0,K[0],K[1]),K[1]-K[0]),U=K[1]-1}!M&&this._isOverlapping(N)&&U<m.length-1&&m.getCodePoint(U+1)===p.NULL_CELL_CODE&&(N.content&=-12582913,N.content|=2<<22),R(N,B,y),B=U}}},l.prototype._drawBackground=function(A,I){var R=this,y=this._ctx,v=this._bufferService.cols,m=0,S=0,B=null;y.save(),this._forEachCell(A,I,function(N,M,U){var K=null;N.isInverse()?K=N.isFgDefault()?R._colors.foreground.css:N.isFgRGB()?"rgb("+f.AttributeData.toColorRGB(N.getFgColor()).join(",")+")":R._colors.ansi[N.getFgColor()].css:N.isBgRGB()?K="rgb("+f.AttributeData.toColorRGB(N.getBgColor()).join(",")+")":N.isBgPalette()&&(K=R._colors.ansi[N.getBgColor()].css),B===null&&(m=M,S=U),U!==S?(y.fillStyle=B||"",R._fillCells(m,S,v-m,1),m=M,S=U):B!==K&&(y.fillStyle=B||"",R._fillCells(m,S,M-m,1),m=M,S=U),B=K}),B!==null&&(y.fillStyle=B,this._fillCells(m,S,v-m,1)),y.restore()},l.prototype._drawForeground=function(A,I){var R=this;this._forEachCell(A,I,function(y,v,m){if(!y.isInvisible()&&(R._drawChars(y,v,m),y.isUnderline()||y.isStrikethrough())){if(R._ctx.save(),y.isInverse())if(y.isBgDefault())R._ctx.fillStyle=R._colors.background.css;else if(y.isBgRGB())R._ctx.fillStyle="rgb("+f.AttributeData.toColorRGB(y.getBgColor()).join(",")+")";else{var S=y.getBgColor();R._optionsService.options.drawBoldTextInBrightColors&&y.isBold()&&S<8&&(S+=8),R._ctx.fillStyle=R._colors.ansi[S].css}else if(y.isFgDefault())R._ctx.fillStyle=R._colors.foreground.css;else if(y.isFgRGB())R._ctx.fillStyle="rgb("+f.AttributeData.toColorRGB(y.getFgColor()).join(",")+")";else{var B=y.getFgColor();R._optionsService.options.drawBoldTextInBrightColors&&y.isBold()&&B<8&&(B+=8),R._ctx.fillStyle=R._colors.ansi[B].css}y.isStrikethrough()&&R._fillMiddleLineAtCells(v,m,y.getWidth()),y.isUnderline()&&R._fillBottomLineAtCells(v,m,y.getWidth()),R._ctx.restore()}})},l.prototype.onGridChanged=function(A,I){this._state.cache.length!==0&&(this._charAtlas&&this._charAtlas.beginFrame(),this._clearCells(0,A,this._bufferService.cols,I-A+1),this._drawBackground(A,I),this._drawForeground(A,I))},l.prototype.onOptionsChanged=function(){this._setTransparency(this._optionsService.options.allowTransparency)},l.prototype._isOverlapping=function(A){if(A.getWidth()!==1||A.getCode()<256)return!1;var I=A.getChars();if(this._characterOverlapCache.hasOwnProperty(I))return this._characterOverlapCache[I];this._ctx.save(),this._ctx.font=this._characterFont;var R=Math.floor(this._ctx.measureText(I).width)>this._characterWidth;return this._ctx.restore(),this._characterOverlapCache[I]=R,R},w([g(5,d.IBufferService),g(6,d.IOptionsService),g(7,o.ICharacterJoinerService)],l)}(T.BaseRenderLayer);E.TextRenderLayer=a},9616:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.BaseCharAtlas=void 0;var L=function(){function O(){this._didWarmUp=!1}return O.prototype.dispose=function(){},O.prototype.warmUp=function(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)},O.prototype._doWarmUp=function(){},O.prototype.clear=function(){},O.prototype.beginFrame=function(){},O}();E.BaseCharAtlas=L},1420:(P,E,L)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.removeTerminalFromCache=E.acquireCharAtlas=void 0;var O=L(2040),b=L(1906),w=[];E.acquireCharAtlas=function(g,D,T,f,p){for(var _=(0,O.generateConfig)(f,p,g,T),d=0;d<w.length;d++){var o=(s=w[d]).ownedBy.indexOf(D);if(o>=0){if((0,O.configEquals)(s.config,_))return s.atlas;s.ownedBy.length===1?(s.atlas.dispose(),w.splice(d,1)):s.ownedBy.splice(o,1);break}}for(d=0;d<w.length;d++){var s=w[d];if((0,O.configEquals)(s.config,_))return s.ownedBy.push(D),s.atlas}var a={atlas:new b.DynamicCharAtlas(document,_),config:_,ownedBy:[D]};return w.push(a),a.atlas},E.removeTerminalFromCache=function(g){for(var D=0;D<w.length;D++){var T=w[D].ownedBy.indexOf(g);if(T!==-1){w[D].ownedBy.length===1?(w[D].atlas.dispose(),w.splice(D,1)):w[D].ownedBy.splice(T,1);break}}}},2040:(P,E,L)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.is256Color=E.configEquals=E.generateConfig=void 0;var O=L(643);E.generateConfig=function(b,w,g,D){var T={foreground:D.foreground,background:D.background,cursor:void 0,cursorAccent:void 0,selection:void 0,ansi:D.ansi};return{devicePixelRatio:window.devicePixelRatio,scaledCharWidth:b,scaledCharHeight:w,fontFamily:g.fontFamily,fontSize:g.fontSize,fontWeight:g.fontWeight,fontWeightBold:g.fontWeightBold,allowTransparency:g.allowTransparency,colors:T}},E.configEquals=function(b,w){for(var g=0;g<b.colors.ansi.length;g++)if(b.colors.ansi[g].rgba!==w.colors.ansi[g].rgba)return!1;return b.devicePixelRatio===w.devicePixelRatio&&b.fontFamily===w.fontFamily&&b.fontSize===w.fontSize&&b.fontWeight===w.fontWeight&&b.fontWeightBold===w.fontWeightBold&&b.allowTransparency===w.allowTransparency&&b.scaledCharWidth===w.scaledCharWidth&&b.scaledCharHeight===w.scaledCharHeight&&b.colors.foreground===w.colors.foreground&&b.colors.background===w.colors.background},E.is256Color=function(b){return b<O.DEFAULT_COLOR}},8803:(P,E,L)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.CHAR_ATLAS_CELL_SPACING=E.TEXT_BASELINE=E.DIM_OPACITY=E.INVERTED_DEFAULT_COLOR=void 0;var O=L(6114);E.INVERTED_DEFAULT_COLOR=257,E.DIM_OPACITY=.5,E.TEXT_BASELINE=O.isFirefox?"bottom":"ideographic",E.CHAR_ATLAS_CELL_SPACING=1},1906:function(P,E,L){var O,b=this&&this.__extends||(O=function(I,R){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,v){y.__proto__=v}||function(y,v){for(var m in v)Object.prototype.hasOwnProperty.call(v,m)&&(y[m]=v[m])},O(I,R)},function(I,R){if(typeof R!="function"&&R!==null)throw new TypeError("Class extends value "+String(R)+" is not a constructor or null");function y(){this.constructor=I}O(I,R),I.prototype=R===null?Object.create(R):(y.prototype=R.prototype,new y)});Object.defineProperty(E,"__esModule",{value:!0}),E.NoneCharAtlas=E.DynamicCharAtlas=E.getGlyphCacheKey=void 0;var w=L(8803),g=L(9616),D=L(5680),T=L(7001),f=L(6114),p=L(1752),_=L(4774),d=1024,o=1024,s={css:"rgba(0, 0, 0, 0)",rgba:0};function a(I){return I.code<<21|I.bg<<12|I.fg<<3|(I.bold?0:4)+(I.dim?0:2)+(I.italic?0:1)}E.getGlyphCacheKey=a;var u=function(I){function R(y,v){var m=I.call(this)||this;m._config=v,m._drawToCacheCount=0,m._glyphsWaitingOnBitmap=[],m._bitmapCommitTimeout=null,m._bitmap=null,m._cacheCanvas=y.createElement("canvas"),m._cacheCanvas.width=d,m._cacheCanvas.height=o,m._cacheCtx=(0,p.throwIfFalsy)(m._cacheCanvas.getContext("2d",{alpha:!0}));var S=y.createElement("canvas");S.width=m._config.scaledCharWidth,S.height=m._config.scaledCharHeight,m._tmpCtx=(0,p.throwIfFalsy)(S.getContext("2d",{alpha:m._config.allowTransparency})),m._width=Math.floor(d/m._config.scaledCharWidth),m._height=Math.floor(o/m._config.scaledCharHeight);var B=m._width*m._height;return m._cacheMap=new T.LRUMap(B),m._cacheMap.prealloc(B),m}return b(R,I),R.prototype.dispose=function(){this._bitmapCommitTimeout!==null&&(window.clearTimeout(this._bitmapCommitTimeout),this._bitmapCommitTimeout=null)},R.prototype.beginFrame=function(){this._drawToCacheCount=0},R.prototype.clear=function(){if(this._cacheMap.size>0){var y=this._width*this._height;this._cacheMap=new T.LRUMap(y),this._cacheMap.prealloc(y)}this._cacheCtx.clearRect(0,0,d,o),this._tmpCtx.clearRect(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight)},R.prototype.draw=function(y,v,m,S){if(v.code===32)return!0;if(!this._canCache(v))return!1;var B=a(v),N=this._cacheMap.get(B);if(N!=null)return this._drawFromCache(y,N,m,S),!0;if(this._drawToCacheCount<100){var M;M=this._cacheMap.size<this._cacheMap.capacity?this._cacheMap.size:this._cacheMap.peek().index;var U=this._drawToCache(v,M);return this._cacheMap.set(B,U),this._drawFromCache(y,U,m,S),!0}return!1},R.prototype._canCache=function(y){return y.code<256},R.prototype._toCoordinateX=function(y){return y%this._width*this._config.scaledCharWidth},R.prototype._toCoordinateY=function(y){return Math.floor(y/this._width)*this._config.scaledCharHeight},R.prototype._drawFromCache=function(y,v,m,S){if(!v.isEmpty){var B=this._toCoordinateX(v.index),N=this._toCoordinateY(v.index);y.drawImage(v.inBitmap?this._bitmap:this._cacheCanvas,B,N,this._config.scaledCharWidth,this._config.scaledCharHeight,m,S,this._config.scaledCharWidth,this._config.scaledCharHeight)}},R.prototype._getColorFromAnsiIndex=function(y){return y<this._config.colors.ansi.length?this._config.colors.ansi[y]:D.DEFAULT_ANSI_COLORS[y]},R.prototype._getBackgroundColor=function(y){return this._config.allowTransparency?s:y.bg===w.INVERTED_DEFAULT_COLOR?this._config.colors.foreground:y.bg<256?this._getColorFromAnsiIndex(y.bg):this._config.colors.background},R.prototype._getForegroundColor=function(y){return y.fg===w.INVERTED_DEFAULT_COLOR?_.color.opaque(this._config.colors.background):y.fg<256?this._getColorFromAnsiIndex(y.fg):this._config.colors.foreground},R.prototype._drawToCache=function(y,v){this._drawToCacheCount++,this._tmpCtx.save();var m=this._getBackgroundColor(y);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=m.css,this._tmpCtx.fillRect(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight),this._tmpCtx.globalCompositeOperation="source-over";var S=y.bold?this._config.fontWeightBold:this._config.fontWeight,B=y.italic?"italic":"";this._tmpCtx.font=B+" "+S+" "+this._config.fontSize*this._config.devicePixelRatio+"px "+this._config.fontFamily,this._tmpCtx.textBaseline=w.TEXT_BASELINE,this._tmpCtx.fillStyle=this._getForegroundColor(y).css,y.dim&&(this._tmpCtx.globalAlpha=w.DIM_OPACITY),this._tmpCtx.fillText(y.chars,0,this._config.scaledCharHeight);var N=this._tmpCtx.getImageData(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight),M=!1;if(this._config.allowTransparency||(M=A(N,m)),M&&y.chars==="_"&&!this._config.allowTransparency)for(var U=1;U<=5&&(this._tmpCtx.fillText(y.chars,0,this._config.scaledCharHeight-U),M=A(N=this._tmpCtx.getImageData(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight),m));U++);this._tmpCtx.restore();var K=this._toCoordinateX(v),j=this._toCoordinateY(v);this._cacheCtx.putImageData(N,K,j);var X={index:v,isEmpty:M,inBitmap:!1};return this._addGlyphToBitmap(X),X},R.prototype._addGlyphToBitmap=function(y){var v=this;!("createImageBitmap"in window)||f.isFirefox||f.isSafari||(this._glyphsWaitingOnBitmap.push(y),this._bitmapCommitTimeout===null&&(this._bitmapCommitTimeout=window.setTimeout(function(){return v._generateBitmap()},100)))},R.prototype._generateBitmap=function(){var y=this,v=this._glyphsWaitingOnBitmap;this._glyphsWaitingOnBitmap=[],window.createImageBitmap(this._cacheCanvas).then(function(m){y._bitmap=m;for(var S=0;S<v.length;S++)v[S].inBitmap=!0}),this._bitmapCommitTimeout=null},R}(g.BaseCharAtlas);E.DynamicCharAtlas=u;var l=function(I){function R(y,v){return I.call(this)||this}return b(R,I),R.prototype.draw=function(y,v,m,S){return!1},R}(g.BaseCharAtlas);function A(I,R){for(var y=!0,v=R.rgba>>>24,m=R.rgba>>>16&255,S=R.rgba>>>8&255,B=0;B<I.data.length;B+=4)I.data[B]===v&&I.data[B+1]===m&&I.data[B+2]===S?I.data[B+3]=0:y=!1;return y}E.NoneCharAtlas=l},7001:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.LRUMap=void 0;var L=function(){function O(b){this.capacity=b,this._map={},this._head=null,this._tail=null,this._nodePool=[],this.size=0}return O.prototype._unlinkNode=function(b){var w=b.prev,g=b.next;b===this._head&&(this._head=g),b===this._tail&&(this._tail=w),w!==null&&(w.next=g),g!==null&&(g.prev=w)},O.prototype._appendNode=function(b){var w=this._tail;w!==null&&(w.next=b),b.prev=w,b.next=null,this._tail=b,this._head===null&&(this._head=b)},O.prototype.prealloc=function(b){for(var w=this._nodePool,g=0;g<b;g++)w.push({prev:null,next:null,key:null,value:null})},O.prototype.get=function(b){var w=this._map[b];return w!==void 0?(this._unlinkNode(w),this._appendNode(w),w.value):null},O.prototype.peekValue=function(b){var w=this._map[b];return w!==void 0?w.value:null},O.prototype.peek=function(){var b=this._head;return b===null?null:b.value},O.prototype.set=function(b,w){var g=this._map[b];if(g!==void 0)g=this._map[b],this._unlinkNode(g),g.value=w;else if(this.size>=this.capacity)g=this._head,this._unlinkNode(g),delete this._map[g.key],g.key=b,g.value=w,this._map[b]=g;else{var D=this._nodePool;D.length>0?((g=D.pop()).key=b,g.value=w):g={prev:null,next:null,key:b,value:w},this._map[b]=g,this.size++}this._appendNode(g)},O}();E.LRUMap=L},1296:function(P,E,L){var O,b=this&&this.__extends||(O=function(y,v){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,S){m.__proto__=S}||function(m,S){for(var B in S)Object.prototype.hasOwnProperty.call(S,B)&&(m[B]=S[B])},O(y,v)},function(y,v){if(typeof v!="function"&&v!==null)throw new TypeError("Class extends value "+String(v)+" is not a constructor or null");function m(){this.constructor=y}O(y,v),y.prototype=v===null?Object.create(v):(m.prototype=v.prototype,new m)}),w=this&&this.__decorate||function(y,v,m,S){var B,N=arguments.length,M=N<3?v:S===null?S=Object.getOwnPropertyDescriptor(v,m):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(y,v,m,S);else for(var U=y.length-1;U>=0;U--)(B=y[U])&&(M=(N<3?B(M):N>3?B(v,m,M):B(v,m))||M);return N>3&&M&&Object.defineProperty(v,m,M),M},g=this&&this.__param||function(y,v){return function(m,S){v(m,S,y)}};Object.defineProperty(E,"__esModule",{value:!0}),E.DomRenderer=void 0;var D=L(3787),T=L(8803),f=L(844),p=L(4725),_=L(2585),d=L(8460),o=L(4774),s=L(9631),a="xterm-dom-renderer-owner-",u="xterm-fg-",l="xterm-bg-",A="xterm-focus",I=1,R=function(y){function v(m,S,B,N,M,U,K,j,X,ie){var se=y.call(this)||this;return se._colors=m,se._element=S,se._screenElement=B,se._viewportElement=N,se._linkifier=M,se._linkifier2=U,se._charSizeService=j,se._optionsService=X,se._bufferService=ie,se._terminalClass=I++,se._rowElements=[],se._rowContainer=document.createElement("div"),se._rowContainer.classList.add("xterm-rows"),se._rowContainer.style.lineHeight="normal",se._rowContainer.setAttribute("aria-hidden","true"),se._refreshRowElements(se._bufferService.cols,se._bufferService.rows),se._selectionContainer=document.createElement("div"),se._selectionContainer.classList.add("xterm-selection"),se._selectionContainer.setAttribute("aria-hidden","true"),se.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},se._updateDimensions(),se._injectCss(),se._rowFactory=K.createInstance(D.DomRendererRowFactory,document,se._colors),se._element.classList.add(a+se._terminalClass),se._screenElement.appendChild(se._rowContainer),se._screenElement.appendChild(se._selectionContainer),se._linkifier.onShowLinkUnderline(function(le){return se._onLinkHover(le)}),se._linkifier.onHideLinkUnderline(function(le){return se._onLinkLeave(le)}),se._linkifier2.onShowLinkUnderline(function(le){return se._onLinkHover(le)}),se._linkifier2.onHideLinkUnderline(function(le){return se._onLinkLeave(le)}),se}return b(v,y),Object.defineProperty(v.prototype,"onRequestRedraw",{get:function(){return new d.EventEmitter().event},enumerable:!1,configurable:!0}),v.prototype.dispose=function(){this._element.classList.remove(a+this._terminalClass),(0,s.removeElementFromParent)(this._rowContainer,this._selectionContainer,this._themeStyleElement,this._dimensionsStyleElement),y.prototype.dispose.call(this)},v.prototype._updateDimensions=function(){this.dimensions.scaledCharWidth=this._charSizeService.width*window.devicePixelRatio,this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*window.devicePixelRatio),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.options.letterSpacing),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.options.lineHeight),this.dimensions.scaledCharLeft=0,this.dimensions.scaledCharTop=0,this.dimensions.scaledCanvasWidth=this.dimensions.scaledCellWidth*this._bufferService.cols,this.dimensions.scaledCanvasHeight=this.dimensions.scaledCellHeight*this._bufferService.rows,this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio),this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio),this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols,this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows;for(var m=0,S=this._rowElements;m<S.length;m++){var B=S[m];B.style.width=this.dimensions.canvasWidth+"px",B.style.height=this.dimensions.actualCellHeight+"px",B.style.lineHeight=this.dimensions.actualCellHeight+"px",B.style.overflow="hidden"}this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));var N=this._terminalSelector+" .xterm-rows span { display: inline-block; height: 100%; vertical-align: top; width: "+this.dimensions.actualCellWidth+"px}";this._dimensionsStyleElement.textContent=N,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=this.dimensions.canvasWidth+"px",this._screenElement.style.height=this.dimensions.canvasHeight+"px"},v.prototype.setColors=function(m){this._colors=m,this._injectCss()},v.prototype._injectCss=function(){var m=this;this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));var S=this._terminalSelector+" .xterm-rows { color: "+this._colors.foreground.css+"; font-family: "+this._optionsService.options.fontFamily+"; font-size: "+this._optionsService.options.fontSize+"px;}";S+=this._terminalSelector+" span:not(."+D.BOLD_CLASS+") { font-weight: "+this._optionsService.options.fontWeight+";}"+this._terminalSelector+" span."+D.BOLD_CLASS+" { font-weight: "+this._optionsService.options.fontWeightBold+";}"+this._terminalSelector+" span."+D.ITALIC_CLASS+" { font-style: italic;}",S+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { box-shadow: none; }}",S+="@keyframes blink_block_"+this._terminalClass+" { 0% { background-color: "+this._colors.cursor.css+"; color: "+this._colors.cursorAccent.css+"; } 50% { background-color: "+this._colors.cursorAccent.css+"; color: "+this._colors.cursor.css+"; }}",S+=this._terminalSelector+" .xterm-rows:not(.xterm-focus) ."+D.CURSOR_CLASS+"."+D.CURSOR_STYLE_BLOCK_CLASS+" { outline: 1px solid "+this._colors.cursor.css+"; outline-offset: -1px;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+D.CURSOR_CLASS+"."+D.CURSOR_BLINK_CLASS+":not(."+D.CURSOR_STYLE_BLOCK_CLASS+") { animation: blink_box_shadow_"+this._terminalClass+" 1s step-end infinite;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+D.CURSOR_CLASS+"."+D.CURSOR_BLINK_CLASS+"."+D.CURSOR_STYLE_BLOCK_CLASS+" { animation: blink_block_"+this._terminalClass+" 1s step-end infinite;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+D.CURSOR_CLASS+"."+D.CURSOR_STYLE_BLOCK_CLASS+" { background-color: "+this._colors.cursor.css+"; color: "+this._colors.cursorAccent.css+";}"+this._terminalSelector+" .xterm-rows ."+D.CURSOR_CLASS+"."+D.CURSOR_STYLE_BAR_CLASS+" { box-shadow: "+this._optionsService.options.cursorWidth+"px 0 0 "+this._colors.cursor.css+" inset;}"+this._terminalSelector+" .xterm-rows ."+D.CURSOR_CLASS+"."+D.CURSOR_STYLE_UNDERLINE_CLASS+" { box-shadow: 0 -1px 0 "+this._colors.cursor.css+" inset;}",S+=this._terminalSelector+" .xterm-selection { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}"+this._terminalSelector+" .xterm-selection div { position: absolute; background-color: "+this._colors.selectionTransparent.css+";}",this._colors.ansi.forEach(function(B,N){S+=m._terminalSelector+" ."+u+N+" { color: "+B.css+"; }"+m._terminalSelector+" ."+l+N+" { background-color: "+B.css+"; }"}),S+=this._terminalSelector+" ."+u+T.INVERTED_DEFAULT_COLOR+" { color: "+o.color.opaque(this._colors.background).css+"; }"+this._terminalSelector+" ."+l+T.INVERTED_DEFAULT_COLOR+" { background-color: "+this._colors.foreground.css+"; }",this._themeStyleElement.textContent=S},v.prototype.onDevicePixelRatioChange=function(){this._updateDimensions()},v.prototype._refreshRowElements=function(m,S){for(var B=this._rowElements.length;B<=S;B++){var N=document.createElement("div");this._rowContainer.appendChild(N),this._rowElements.push(N)}for(;this._rowElements.length>S;)this._rowContainer.removeChild(this._rowElements.pop())},v.prototype.onResize=function(m,S){this._refreshRowElements(m,S),this._updateDimensions()},v.prototype.onCharSizeChanged=function(){this._updateDimensions()},v.prototype.onBlur=function(){this._rowContainer.classList.remove(A)},v.prototype.onFocus=function(){this._rowContainer.classList.add(A)},v.prototype.onSelectionChanged=function(m,S,B){for(;this._selectionContainer.children.length;)this._selectionContainer.removeChild(this._selectionContainer.children[0]);if(m&&S){var N=m[1]-this._bufferService.buffer.ydisp,M=S[1]-this._bufferService.buffer.ydisp,U=Math.max(N,0),K=Math.min(M,this._bufferService.rows-1);if(!(U>=this._bufferService.rows||K<0)){var j=document.createDocumentFragment();if(B)j.appendChild(this._createSelectionElement(U,m[0],S[0],K-U+1));else{var X=N===U?m[0]:0,ie=U===M?S[0]:this._bufferService.cols;j.appendChild(this._createSelectionElement(U,X,ie));var se=K-U-1;if(j.appendChild(this._createSelectionElement(U+1,0,this._bufferService.cols,se)),U!==K){var le=M===K?S[0]:this._bufferService.cols;j.appendChild(this._createSelectionElement(K,0,le))}}this._selectionContainer.appendChild(j)}}},v.prototype._createSelectionElement=function(m,S,B,N){N===void 0&&(N=1);var M=document.createElement("div");return M.style.height=N*this.dimensions.actualCellHeight+"px",M.style.top=m*this.dimensions.actualCellHeight+"px",M.style.left=S*this.dimensions.actualCellWidth+"px",M.style.width=this.dimensions.actualCellWidth*(B-S)+"px",M},v.prototype.onCursorMove=function(){},v.prototype.onOptionsChanged=function(){this._updateDimensions(),this._injectCss()},v.prototype.clear=function(){for(var m=0,S=this._rowElements;m<S.length;m++)S[m].innerText=""},v.prototype.renderRows=function(m,S){for(var B=this._bufferService.buffer.ybase+this._bufferService.buffer.y,N=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),M=this._optionsService.options.cursorBlink,U=m;U<=S;U++){var K=this._rowElements[U];K.innerText="";var j=U+this._bufferService.buffer.ydisp,X=this._bufferService.buffer.lines.get(j),ie=this._optionsService.options.cursorStyle;K.appendChild(this._rowFactory.createRow(X,j,j===B,ie,N,M,this.dimensions.actualCellWidth,this._bufferService.cols))}},Object.defineProperty(v.prototype,"_terminalSelector",{get:function(){return"."+a+this._terminalClass},enumerable:!1,configurable:!0}),v.prototype._onLinkHover=function(m){this._setCellUnderline(m.x1,m.x2,m.y1,m.y2,m.cols,!0)},v.prototype._onLinkLeave=function(m){this._setCellUnderline(m.x1,m.x2,m.y1,m.y2,m.cols,!1)},v.prototype._setCellUnderline=function(m,S,B,N,M,U){for(;m!==S||B!==N;){var K=this._rowElements[B];if(!K)return;var j=K.children[m];j&&(j.style.textDecoration=U?"underline":"none"),++m>=M&&(m=0,B++)}},w([g(6,_.IInstantiationService),g(7,p.ICharSizeService),g(8,_.IOptionsService),g(9,_.IBufferService)],v)}(f.Disposable);E.DomRenderer=R},3787:function(P,E,L){var O=this&&this.__decorate||function(s,a,u,l){var A,I=arguments.length,R=I<3?a:l===null?l=Object.getOwnPropertyDescriptor(a,u):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(s,a,u,l);else for(var y=s.length-1;y>=0;y--)(A=s[y])&&(R=(I<3?A(R):I>3?A(a,u,R):A(a,u))||R);return I>3&&R&&Object.defineProperty(a,u,R),R},b=this&&this.__param||function(s,a){return function(u,l){a(u,l,s)}};Object.defineProperty(E,"__esModule",{value:!0}),E.DomRendererRowFactory=E.CURSOR_STYLE_UNDERLINE_CLASS=E.CURSOR_STYLE_BAR_CLASS=E.CURSOR_STYLE_BLOCK_CLASS=E.CURSOR_BLINK_CLASS=E.CURSOR_CLASS=E.STRIKETHROUGH_CLASS=E.UNDERLINE_CLASS=E.ITALIC_CLASS=E.DIM_CLASS=E.BOLD_CLASS=void 0;var w=L(8803),g=L(643),D=L(511),T=L(2585),f=L(4774),p=L(4725),_=L(4269);E.BOLD_CLASS="xterm-bold",E.DIM_CLASS="xterm-dim",E.ITALIC_CLASS="xterm-italic",E.UNDERLINE_CLASS="xterm-underline",E.STRIKETHROUGH_CLASS="xterm-strikethrough",E.CURSOR_CLASS="xterm-cursor",E.CURSOR_BLINK_CLASS="xterm-cursor-blink",E.CURSOR_STYLE_BLOCK_CLASS="xterm-cursor-block",E.CURSOR_STYLE_BAR_CLASS="xterm-cursor-bar",E.CURSOR_STYLE_UNDERLINE_CLASS="xterm-cursor-underline";var d=function(){function s(a,u,l,A,I){this._document=a,this._colors=u,this._characterJoinerService=l,this._optionsService=A,this._coreService=I,this._workCell=new D.CellData}return s.prototype.setColors=function(a){this._colors=a},s.prototype.createRow=function(a,u,l,A,I,R,y,v){for(var m=this._document.createDocumentFragment(),S=this._characterJoinerService.getJoinedCharacters(u),B=0,N=Math.min(a.length,v)-1;N>=0;N--)if(a.loadCell(N,this._workCell).getCode()!==g.NULL_CELL_CODE||l&&N===I){B=N+1;break}for(N=0;N<B;N++){a.loadCell(N,this._workCell);var M=this._workCell.getWidth();if(M!==0){var U=!1,K=N,j=this._workCell;if(S.length>0&&N===S[0][0]){U=!0;var X=S.shift();j=new _.JoinedCellData(this._workCell,a.translateToString(!0,X[0],X[1]),X[1]-X[0]),K=X[1]-1,M=j.getWidth()}var ie=this._document.createElement("span");if(M>1&&(ie.style.width=y*M+"px"),U&&(ie.style.display="inline",I>=N&&I<=K&&(I=N)),!this._coreService.isCursorHidden&&l&&N===I)switch(ie.classList.add(E.CURSOR_CLASS),R&&ie.classList.add(E.CURSOR_BLINK_CLASS),A){case"bar":ie.classList.add(E.CURSOR_STYLE_BAR_CLASS);break;case"underline":ie.classList.add(E.CURSOR_STYLE_UNDERLINE_CLASS);break;default:ie.classList.add(E.CURSOR_STYLE_BLOCK_CLASS)}j.isBold()&&ie.classList.add(E.BOLD_CLASS),j.isItalic()&&ie.classList.add(E.ITALIC_CLASS),j.isDim()&&ie.classList.add(E.DIM_CLASS),j.isUnderline()&&ie.classList.add(E.UNDERLINE_CLASS),j.isInvisible()?ie.textContent=g.WHITESPACE_CELL_CHAR:ie.textContent=j.getChars()||g.WHITESPACE_CELL_CHAR,j.isStrikethrough()&&ie.classList.add(E.STRIKETHROUGH_CLASS);var se=j.getFgColor(),le=j.getFgColorMode(),ve=j.getBgColor(),q=j.getBgColorMode(),ee=!!j.isInverse();if(ee){var ae=se;se=ve,ve=ae;var _e=le;le=q,q=_e}switch(le){case 16777216:case 33554432:j.isBold()&&se<8&&this._optionsService.options.drawBoldTextInBrightColors&&(se+=8),this._applyMinimumContrast(ie,this._colors.background,this._colors.ansi[se])||ie.classList.add("xterm-fg-"+se);break;case 50331648:var fe=f.rgba.toColor(se>>16&255,se>>8&255,255&se);this._applyMinimumContrast(ie,this._colors.background,fe)||this._addStyle(ie,"color:#"+o(se.toString(16),"0",6));break;default:this._applyMinimumContrast(ie,this._colors.background,this._colors.foreground)||ee&&ie.classList.add("xterm-fg-"+w.INVERTED_DEFAULT_COLOR)}switch(q){case 16777216:case 33554432:ie.classList.add("xterm-bg-"+ve);break;case 50331648:this._addStyle(ie,"background-color:#"+o(ve.toString(16),"0",6));break;default:ee&&ie.classList.add("xterm-bg-"+w.INVERTED_DEFAULT_COLOR)}m.appendChild(ie),N=K}}return m},s.prototype._applyMinimumContrast=function(a,u,l){if(this._optionsService.options.minimumContrastRatio===1)return!1;var A=this._colors.contrastCache.getColor(this._workCell.bg,this._workCell.fg);return A===void 0&&(A=f.color.ensureContrastRatio(u,l,this._optionsService.options.minimumContrastRatio),this._colors.contrastCache.setColor(this._workCell.bg,this._workCell.fg,A!=null?A:null)),!!A&&(this._addStyle(a,"color:"+A.css),!0)},s.prototype._addStyle=function(a,u){a.setAttribute("style",""+(a.getAttribute("style")||"")+u+";")},O([b(2,p.ICharacterJoinerService),b(3,T.IOptionsService),b(4,T.ICoreService)],s)}();function o(s,a,u){for(;s.length<u;)s=a+s;return s}E.DomRendererRowFactory=d},456:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.SelectionModel=void 0;var L=function(){function O(b){this._bufferService=b,this.isSelectAllActive=!1,this.selectionStartLength=0}return O.prototype.clearSelection=function(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0},Object.defineProperty(O.prototype,"finalSelectionStart",{get:function(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"finalSelectionEnd",{get:function(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){var b=this.selectionStart[0]+this.selectionStartLength;return b>this._bufferService.cols?[b%this._bufferService.cols,this.selectionStart[1]+Math.floor(b/this._bufferService.cols)]:[b,this.selectionStart[1]]}return this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]?[Math.max(this.selectionStart[0]+this.selectionStartLength,this.selectionEnd[0]),this.selectionEnd[1]]:this.selectionEnd}},enumerable:!1,configurable:!0}),O.prototype.areSelectionValuesReversed=function(){var b=this.selectionStart,w=this.selectionEnd;return!(!b||!w)&&(b[1]>w[1]||b[1]===w[1]&&b[0]>w[0])},O.prototype.onTrim=function(b){return this.selectionStart&&(this.selectionStart[1]-=b),this.selectionEnd&&(this.selectionEnd[1]-=b),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)},O}();E.SelectionModel=L},428:function(P,E,L){var O=this&&this.__decorate||function(f,p,_,d){var o,s=arguments.length,a=s<3?p:d===null?d=Object.getOwnPropertyDescriptor(p,_):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(f,p,_,d);else for(var u=f.length-1;u>=0;u--)(o=f[u])&&(a=(s<3?o(a):s>3?o(p,_,a):o(p,_))||a);return s>3&&a&&Object.defineProperty(p,_,a),a},b=this&&this.__param||function(f,p){return function(_,d){p(_,d,f)}};Object.defineProperty(E,"__esModule",{value:!0}),E.CharSizeService=void 0;var w=L(2585),g=L(8460),D=function(){function f(p,_,d){this._optionsService=d,this.width=0,this.height=0,this._onCharSizeChange=new g.EventEmitter,this._measureStrategy=new T(p,_,this._optionsService)}return Object.defineProperty(f.prototype,"hasValidSize",{get:function(){return this.width>0&&this.height>0},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"onCharSizeChange",{get:function(){return this._onCharSizeChange.event},enumerable:!1,configurable:!0}),f.prototype.measure=function(){var p=this._measureStrategy.measure();p.width===this.width&&p.height===this.height||(this.width=p.width,this.height=p.height,this._onCharSizeChange.fire())},O([b(2,w.IOptionsService)],f)}();E.CharSizeService=D;var T=function(){function f(p,_,d){this._document=p,this._parentElement=_,this._optionsService=d,this._result={width:0,height:0},this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W",this._measureElement.setAttribute("aria-hidden","true"),this._parentElement.appendChild(this._measureElement)}return f.prototype.measure=function(){this._measureElement.style.fontFamily=this._optionsService.options.fontFamily,this._measureElement.style.fontSize=this._optionsService.options.fontSize+"px";var p=this._measureElement.getBoundingClientRect();return p.width!==0&&p.height!==0&&(this._result.width=p.width,this._result.height=Math.ceil(p.height)),this._result},f}()},4269:function(P,E,L){var O,b=this&&this.__extends||(O=function(o,s){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var l in u)Object.prototype.hasOwnProperty.call(u,l)&&(a[l]=u[l])},O(o,s)},function(o,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function a(){this.constructor=o}O(o,s),o.prototype=s===null?Object.create(s):(a.prototype=s.prototype,new a)}),w=this&&this.__decorate||function(o,s,a,u){var l,A=arguments.length,I=A<3?s:u===null?u=Object.getOwnPropertyDescriptor(s,a):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(o,s,a,u);else for(var R=o.length-1;R>=0;R--)(l=o[R])&&(I=(A<3?l(I):A>3?l(s,a,I):l(s,a))||I);return A>3&&I&&Object.defineProperty(s,a,I),I},g=this&&this.__param||function(o,s){return function(a,u){s(a,u,o)}};Object.defineProperty(E,"__esModule",{value:!0}),E.CharacterJoinerService=E.JoinedCellData=void 0;var D=L(3734),T=L(643),f=L(511),p=L(2585),_=function(o){function s(a,u,l){var A=o.call(this)||this;return A.content=0,A.combinedData="",A.fg=a.fg,A.bg=a.bg,A.combinedData=u,A._width=l,A}return b(s,o),s.prototype.isCombined=function(){return 2097152},s.prototype.getWidth=function(){return this._width},s.prototype.getChars=function(){return this.combinedData},s.prototype.getCode=function(){return 2097151},s.prototype.setFromCharData=function(a){throw new Error("not implemented")},s.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},s}(D.AttributeData);E.JoinedCellData=_;var d=function(){function o(s){this._bufferService=s,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new f.CellData}return o.prototype.register=function(s){var a={id:this._nextCharacterJoinerId++,handler:s};return this._characterJoiners.push(a),a.id},o.prototype.deregister=function(s){for(var a=0;a<this._characterJoiners.length;a++)if(this._characterJoiners[a].id===s)return this._characterJoiners.splice(a,1),!0;return!1},o.prototype.getJoinedCharacters=function(s){if(this._characterJoiners.length===0)return[];var a=this._bufferService.buffer.lines.get(s);if(!a||a.length===0)return[];for(var u=[],l=a.translateToString(!0),A=0,I=0,R=0,y=a.getFg(0),v=a.getBg(0),m=0;m<a.getTrimmedLength();m++)if(a.loadCell(m,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==y||this._workCell.bg!==v){if(m-A>1)for(var S=this._getJoinedRanges(l,R,I,a,A),B=0;B<S.length;B++)u.push(S[B]);A=m,R=I,y=this._workCell.fg,v=this._workCell.bg}I+=this._workCell.getChars().length||T.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-A>1)for(S=this._getJoinedRanges(l,R,I,a,A),B=0;B<S.length;B++)u.push(S[B]);return u},o.prototype._getJoinedRanges=function(s,a,u,l,A){for(var I=s.substring(a,u),R=this._characterJoiners[0].handler(I),y=1;y<this._characterJoiners.length;y++)for(var v=this._characterJoiners[y].handler(I),m=0;m<v.length;m++)o._mergeRanges(R,v[m]);return this._stringRangesToCellRanges(R,l,A),R},o.prototype._stringRangesToCellRanges=function(s,a,u){var l=0,A=!1,I=0,R=s[l];if(R){for(var y=u;y<this._bufferService.cols;y++){var v=a.getWidth(y),m=a.getString(y).length||T.WHITESPACE_CELL_CHAR.length;if(v!==0){if(!A&&R[0]<=I&&(R[0]=y,A=!0),R[1]<=I){if(R[1]=y,!(R=s[++l]))break;R[0]<=I?(R[0]=y,A=!0):A=!1}I+=m}}R&&(R[1]=this._bufferService.cols)}},o._mergeRanges=function(s,a){for(var u=!1,l=0;l<s.length;l++){var A=s[l];if(u){if(a[1]<=A[0])return s[l-1][1]=a[1],s;if(a[1]<=A[1])return s[l-1][1]=Math.max(a[1],A[1]),s.splice(l,1),s;s.splice(l,1),l--}else{if(a[1]<=A[0])return s.splice(l,0,a),s;if(a[1]<=A[1])return A[0]=Math.min(a[0],A[0]),s;a[0]<A[1]&&(A[0]=Math.min(a[0],A[0]),u=!0)}}return u?s[s.length-1][1]=a[1]:s.push(a),s},o=w([g(0,p.IBufferService)],o)}();E.CharacterJoinerService=d},5114:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.CoreBrowserService=void 0;var L=function(){function O(b){this._textarea=b}return Object.defineProperty(O.prototype,"isFocused",{get:function(){return(this._textarea.getRootNode?this._textarea.getRootNode():document).activeElement===this._textarea&&document.hasFocus()},enumerable:!1,configurable:!0}),O}();E.CoreBrowserService=L},8934:function(P,E,L){var O=this&&this.__decorate||function(T,f,p,_){var d,o=arguments.length,s=o<3?f:_===null?_=Object.getOwnPropertyDescriptor(f,p):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(T,f,p,_);else for(var a=T.length-1;a>=0;a--)(d=T[a])&&(s=(o<3?d(s):o>3?d(f,p,s):d(f,p))||s);return o>3&&s&&Object.defineProperty(f,p,s),s},b=this&&this.__param||function(T,f){return function(p,_){f(p,_,T)}};Object.defineProperty(E,"__esModule",{value:!0}),E.MouseService=void 0;var w=L(4725),g=L(9806),D=function(){function T(f,p){this._renderService=f,this._charSizeService=p}return T.prototype.getCoords=function(f,p,_,d,o){return(0,g.getCoords)(f,p,_,d,this._charSizeService.hasValidSize,this._renderService.dimensions.actualCellWidth,this._renderService.dimensions.actualCellHeight,o)},T.prototype.getRawByteCoords=function(f,p,_,d){var o=this.getCoords(f,p,_,d);return(0,g.getRawByteCoords)(o)},O([b(0,w.IRenderService),b(1,w.ICharSizeService)],T)}();E.MouseService=D},3230:function(P,E,L){var O,b=this&&this.__extends||(O=function(a,u){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,A){l.__proto__=A}||function(l,A){for(var I in A)Object.prototype.hasOwnProperty.call(A,I)&&(l[I]=A[I])},O(a,u)},function(a,u){if(typeof u!="function"&&u!==null)throw new TypeError("Class extends value "+String(u)+" is not a constructor or null");function l(){this.constructor=a}O(a,u),a.prototype=u===null?Object.create(u):(l.prototype=u.prototype,new l)}),w=this&&this.__decorate||function(a,u,l,A){var I,R=arguments.length,y=R<3?u:A===null?A=Object.getOwnPropertyDescriptor(u,l):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(a,u,l,A);else for(var v=a.length-1;v>=0;v--)(I=a[v])&&(y=(R<3?I(y):R>3?I(u,l,y):I(u,l))||y);return R>3&&y&&Object.defineProperty(u,l,y),y},g=this&&this.__param||function(a,u){return function(l,A){u(l,A,a)}};Object.defineProperty(E,"__esModule",{value:!0}),E.RenderService=void 0;var D=L(6193),T=L(8460),f=L(844),p=L(5596),_=L(3656),d=L(2585),o=L(4725),s=function(a){function u(l,A,I,R,y,v){var m=a.call(this)||this;if(m._renderer=l,m._rowCount=A,m._charSizeService=y,m._isPaused=!1,m._needsFullRefresh=!1,m._isNextRenderRedrawOnly=!0,m._needsSelectionRefresh=!1,m._canvasWidth=0,m._canvasHeight=0,m._selectionState={start:void 0,end:void 0,columnSelectMode:!1},m._onDimensionsChange=new T.EventEmitter,m._onRender=new T.EventEmitter,m._onRefreshRequest=new T.EventEmitter,m.register({dispose:function(){return m._renderer.dispose()}}),m._renderDebouncer=new D.RenderDebouncer(function(B,N){return m._renderRows(B,N)}),m.register(m._renderDebouncer),m._screenDprMonitor=new p.ScreenDprMonitor,m._screenDprMonitor.setListener(function(){return m.onDevicePixelRatioChange()}),m.register(m._screenDprMonitor),m.register(v.onResize(function(B){return m._fullRefresh()})),m.register(R.onOptionChange(function(){return m._renderer.onOptionsChanged()})),m.register(m._charSizeService.onCharSizeChange(function(){return m.onCharSizeChanged()})),m._renderer.onRequestRedraw(function(B){return m.refreshRows(B.start,B.end,!0)}),m.register((0,_.addDisposableDomListener)(window,"resize",function(){return m.onDevicePixelRatioChange()})),"IntersectionObserver"in window){var S=new IntersectionObserver(function(B){return m._onIntersectionChange(B[B.length-1])},{threshold:0});S.observe(I),m.register({dispose:function(){return S.disconnect()}})}return m}return b(u,a),Object.defineProperty(u.prototype,"onDimensionsChange",{get:function(){return this._onDimensionsChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"onRenderedBufferChange",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"onRefreshRequest",{get:function(){return this._onRefreshRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"dimensions",{get:function(){return this._renderer.dimensions},enumerable:!1,configurable:!0}),u.prototype._onIntersectionChange=function(l){this._isPaused=l.isIntersecting===void 0?l.intersectionRatio===0:!l.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)},u.prototype.refreshRows=function(l,A,I){I===void 0&&(I=!1),this._isPaused?this._needsFullRefresh=!0:(I||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(l,A,this._rowCount))},u.prototype._renderRows=function(l,A){this._renderer.renderRows(l,A),this._needsSelectionRefresh&&(this._renderer.onSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRender.fire({start:l,end:A}),this._isNextRenderRedrawOnly=!0},u.prototype.resize=function(l,A){this._rowCount=A,this._fireOnCanvasResize()},u.prototype.changeOptions=function(){this._renderer.onOptionsChanged(),this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize()},u.prototype._fireOnCanvasResize=function(){this._renderer.dimensions.canvasWidth===this._canvasWidth&&this._renderer.dimensions.canvasHeight===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.dimensions)},u.prototype.dispose=function(){a.prototype.dispose.call(this)},u.prototype.setRenderer=function(l){var A=this;this._renderer.dispose(),this._renderer=l,this._renderer.onRequestRedraw(function(I){return A.refreshRows(I.start,I.end,!0)}),this._needsSelectionRefresh=!0,this._fullRefresh()},u.prototype._fullRefresh=function(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)},u.prototype.clearTextureAtlas=function(){var l,A;(A=(l=this._renderer)===null||l===void 0?void 0:l.clearTextureAtlas)===null||A===void 0||A.call(l),this._fullRefresh()},u.prototype.setColors=function(l){this._renderer.setColors(l),this._fullRefresh()},u.prototype.onDevicePixelRatioChange=function(){this._charSizeService.measure(),this._renderer.onDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1)},u.prototype.onResize=function(l,A){this._renderer.onResize(l,A),this._fullRefresh()},u.prototype.onCharSizeChanged=function(){this._renderer.onCharSizeChanged()},u.prototype.onBlur=function(){this._renderer.onBlur()},u.prototype.onFocus=function(){this._renderer.onFocus()},u.prototype.onSelectionChanged=function(l,A,I){this._selectionState.start=l,this._selectionState.end=A,this._selectionState.columnSelectMode=I,this._renderer.onSelectionChanged(l,A,I)},u.prototype.onCursorMove=function(){this._renderer.onCursorMove()},u.prototype.clear=function(){this._renderer.clear()},w([g(3,d.IOptionsService),g(4,o.ICharSizeService),g(5,d.IBufferService)],u)}(f.Disposable);E.RenderService=s},9312:function(P,E,L){var O,b=this&&this.__extends||(O=function(R,y){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,m){v.__proto__=m}||function(v,m){for(var S in m)Object.prototype.hasOwnProperty.call(m,S)&&(v[S]=m[S])},O(R,y)},function(R,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");function v(){this.constructor=R}O(R,y),R.prototype=y===null?Object.create(y):(v.prototype=y.prototype,new v)}),w=this&&this.__decorate||function(R,y,v,m){var S,B=arguments.length,N=B<3?y:m===null?m=Object.getOwnPropertyDescriptor(y,v):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(R,y,v,m);else for(var M=R.length-1;M>=0;M--)(S=R[M])&&(N=(B<3?S(N):B>3?S(y,v,N):S(y,v))||N);return B>3&&N&&Object.defineProperty(y,v,N),N},g=this&&this.__param||function(R,y){return function(v,m){y(v,m,R)}};Object.defineProperty(E,"__esModule",{value:!0}),E.SelectionService=void 0;var D=L(6114),T=L(456),f=L(511),p=L(8460),_=L(4725),d=L(2585),o=L(9806),s=L(9504),a=L(844),u=L(4841),l=String.fromCharCode(160),A=new RegExp(l,"g"),I=function(R){function y(v,m,S,B,N,M,U,K){var j=R.call(this)||this;return j._element=v,j._screenElement=m,j._linkifier=S,j._bufferService=B,j._coreService=N,j._mouseService=M,j._optionsService=U,j._renderService=K,j._dragScrollAmount=0,j._enabled=!0,j._workCell=new f.CellData,j._mouseDownTimeStamp=0,j._oldHasSelection=!1,j._oldSelectionStart=void 0,j._oldSelectionEnd=void 0,j._onLinuxMouseSelection=j.register(new p.EventEmitter),j._onRedrawRequest=j.register(new p.EventEmitter),j._onSelectionChange=j.register(new p.EventEmitter),j._onRequestScrollLines=j.register(new p.EventEmitter),j._mouseMoveListener=function(X){return j._onMouseMove(X)},j._mouseUpListener=function(X){return j._onMouseUp(X)},j._coreService.onUserInput(function(){j.hasSelection&&j.clearSelection()}),j._trimListener=j._bufferService.buffer.lines.onTrim(function(X){return j._onTrim(X)}),j.register(j._bufferService.buffers.onBufferActivate(function(X){return j._onBufferActivate(X)})),j.enable(),j._model=new T.SelectionModel(j._bufferService),j._activeSelectionMode=0,j}return b(y,R),Object.defineProperty(y.prototype,"onLinuxMouseSelection",{get:function(){return this._onLinuxMouseSelection.event},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"onRequestRedraw",{get:function(){return this._onRedrawRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"onRequestScrollLines",{get:function(){return this._onRequestScrollLines.event},enumerable:!1,configurable:!0}),y.prototype.dispose=function(){this._removeMouseDownListeners()},y.prototype.reset=function(){this.clearSelection()},y.prototype.disable=function(){this.clearSelection(),this._enabled=!1},y.prototype.enable=function(){this._enabled=!0},Object.defineProperty(y.prototype,"selectionStart",{get:function(){return this._model.finalSelectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"selectionEnd",{get:function(){return this._model.finalSelectionEnd},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"hasSelection",{get:function(){var v=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;return!(!v||!m||v[0]===m[0]&&v[1]===m[1])},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"selectionText",{get:function(){var v=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;if(!v||!m)return"";var S=this._bufferService.buffer,B=[];if(this._activeSelectionMode===3){if(v[0]===m[0])return"";for(var N=v[1];N<=m[1];N++){var M=S.translateBufferLineToString(N,!0,v[0],m[0]);B.push(M)}}else{var U=v[1]===m[1]?m[0]:void 0;for(B.push(S.translateBufferLineToString(v[1],!0,v[0],U)),N=v[1]+1;N<=m[1]-1;N++){var K=S.lines.get(N);M=S.translateBufferLineToString(N,!0),K&&K.isWrapped?B[B.length-1]+=M:B.push(M)}v[1]!==m[1]&&(K=S.lines.get(m[1]),M=S.translateBufferLineToString(m[1],!0,0,m[0]),K&&K.isWrapped?B[B.length-1]+=M:B.push(M))}return B.map(function(j){return j.replace(A," ")}).join(D.isWindows?`\r
168
- `:`
169
- `)},enumerable:!1,configurable:!0}),y.prototype.clearSelection=function(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()},y.prototype.refresh=function(v){var m=this;this._refreshAnimationFrame||(this._refreshAnimationFrame=window.requestAnimationFrame(function(){return m._refresh()})),D.isLinux&&v&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)},y.prototype._refresh=function(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})},y.prototype._isClickInSelection=function(v){var m=this._getMouseBufferCoords(v),S=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!!(S&&B&&m)&&this._areCoordsInSelection(m,S,B)},y.prototype._areCoordsInSelection=function(v,m,S){return v[1]>m[1]&&v[1]<S[1]||m[1]===S[1]&&v[1]===m[1]&&v[0]>=m[0]&&v[0]<S[0]||m[1]<S[1]&&v[1]===S[1]&&v[0]<S[0]||m[1]<S[1]&&v[1]===m[1]&&v[0]>=m[0]},y.prototype._selectWordAtCursor=function(v,m){var S,B,N=(B=(S=this._linkifier.currentLink)===null||S===void 0?void 0:S.link)===null||B===void 0?void 0:B.range;if(N)return this._model.selectionStart=[N.start.x-1,N.start.y-1],this._model.selectionStartLength=(0,u.getRangeLength)(N,this._bufferService.cols),this._model.selectionEnd=void 0,!0;var M=this._getMouseBufferCoords(v);return!!M&&(this._selectWordAt(M,m),this._model.selectionEnd=void 0,!0)},y.prototype.selectAll=function(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()},y.prototype.selectLines=function(v,m){this._model.clearSelection(),v=Math.max(v,0),m=Math.min(m,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,v],this._model.selectionEnd=[this._bufferService.cols,m],this.refresh(),this._onSelectionChange.fire()},y.prototype._onTrim=function(v){this._model.onTrim(v)&&this.refresh()},y.prototype._getMouseBufferCoords=function(v){var m=this._mouseService.getCoords(v,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(m)return m[0]--,m[1]--,m[1]+=this._bufferService.buffer.ydisp,m},y.prototype._getMouseEventScrollAmount=function(v){var m=(0,o.getCoordsRelativeToElement)(v,this._screenElement)[1],S=this._renderService.dimensions.canvasHeight;return m>=0&&m<=S?0:(m>S&&(m-=S),m=Math.min(Math.max(m,-50),50),(m/=50)/Math.abs(m)+Math.round(14*m))},y.prototype.shouldForceSelection=function(v){return D.isMac?v.altKey&&this._optionsService.options.macOptionClickForcesSelection:v.shiftKey},y.prototype.onMouseDown=function(v){if(this._mouseDownTimeStamp=v.timeStamp,(v.button!==2||!this.hasSelection)&&v.button===0){if(!this._enabled){if(!this.shouldForceSelection(v))return;v.stopPropagation()}v.preventDefault(),this._dragScrollAmount=0,this._enabled&&v.shiftKey?this._onIncrementalClick(v):v.detail===1?this._onSingleClick(v):v.detail===2?this._onDoubleClick(v):v.detail===3&&this._onTripleClick(v),this._addMouseDownListeners(),this.refresh(!0)}},y.prototype._addMouseDownListeners=function(){var v=this;this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=window.setInterval(function(){return v._dragScroll()},50)},y.prototype._removeMouseDownListeners=function(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0},y.prototype._onIncrementalClick=function(v){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(v))},y.prototype._onSingleClick=function(v){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(v)?3:0,this._model.selectionStart=this._getMouseBufferCoords(v),this._model.selectionStart){this._model.selectionEnd=void 0;var m=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);m&&m.length!==this._model.selectionStart[0]&&m.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}},y.prototype._onDoubleClick=function(v){this._selectWordAtCursor(v,!0)&&(this._activeSelectionMode=1)},y.prototype._onTripleClick=function(v){var m=this._getMouseBufferCoords(v);m&&(this._activeSelectionMode=2,this._selectLineAt(m[1]))},y.prototype.shouldColumnSelect=function(v){return v.altKey&&!(D.isMac&&this._optionsService.options.macOptionClickForcesSelection)},y.prototype._onMouseMove=function(v){if(v.stopImmediatePropagation(),this._model.selectionStart){var m=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(v),this._model.selectionEnd){this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(v),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));var S=this._bufferService.buffer;if(this._model.selectionEnd[1]<S.lines.length){var B=S.lines.get(this._model.selectionEnd[1]);B&&B.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]++}m&&m[0]===this._model.selectionEnd[0]&&m[1]===this._model.selectionEnd[1]||this.refresh(!0)}else this.refresh(!0)}},y.prototype._dragScroll=function(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});var v=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(v.ydisp+this._bufferService.rows,v.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=v.ydisp),this.refresh()}},y.prototype._onMouseUp=function(v){var m=v.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&m<500&&v.altKey&&this._optionsService.getOption("altClickMovesCursor")){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){var S=this._mouseService.getCoords(v,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(S&&S[0]!==void 0&&S[1]!==void 0){var B=(0,s.moveToCellSequence)(S[0]-1,S[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(B,!0)}}}else this._fireEventIfSelectionChanged()},y.prototype._fireEventIfSelectionChanged=function(){var v=this._model.finalSelectionStart,m=this._model.finalSelectionEnd,S=!(!v||!m||v[0]===m[0]&&v[1]===m[1]);S?v&&m&&(this._oldSelectionStart&&this._oldSelectionEnd&&v[0]===this._oldSelectionStart[0]&&v[1]===this._oldSelectionStart[1]&&m[0]===this._oldSelectionEnd[0]&&m[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(v,m,S)):this._oldHasSelection&&this._fireOnSelectionChange(v,m,S)},y.prototype._fireOnSelectionChange=function(v,m,S){this._oldSelectionStart=v,this._oldSelectionEnd=m,this._oldHasSelection=S,this._onSelectionChange.fire()},y.prototype._onBufferActivate=function(v){var m=this;this.clearSelection(),this._trimListener.dispose(),this._trimListener=v.activeBuffer.lines.onTrim(function(S){return m._onTrim(S)})},y.prototype._convertViewportColToCharacterIndex=function(v,m){for(var S=m[0],B=0;m[0]>=B;B++){var N=v.loadCell(B,this._workCell).getChars().length;this._workCell.getWidth()===0?S--:N>1&&m[0]!==B&&(S+=N-1)}return S},y.prototype.setSelection=function(v,m,S){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[v,m],this._model.selectionStartLength=S,this.refresh()},y.prototype.rightClickSelect=function(v){this._isClickInSelection(v)||(this._selectWordAtCursor(v,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())},y.prototype._getWordAt=function(v,m,S,B){if(S===void 0&&(S=!0),B===void 0&&(B=!0),!(v[0]>=this._bufferService.cols)){var N=this._bufferService.buffer,M=N.lines.get(v[1]);if(M){var U=N.translateBufferLineToString(v[1],!1),K=this._convertViewportColToCharacterIndex(M,v),j=K,X=v[0]-K,ie=0,se=0,le=0,ve=0;if(U.charAt(K)===" "){for(;K>0&&U.charAt(K-1)===" ";)K--;for(;j<U.length&&U.charAt(j+1)===" ";)j++}else{var q=v[0],ee=v[0];M.getWidth(q)===0&&(ie++,q--),M.getWidth(ee)===2&&(se++,ee++);var ae=M.getString(ee).length;for(ae>1&&(ve+=ae-1,j+=ae-1);q>0&&K>0&&!this._isCharWordSeparator(M.loadCell(q-1,this._workCell));){M.loadCell(q-1,this._workCell);var _e=this._workCell.getChars().length;this._workCell.getWidth()===0?(ie++,q--):_e>1&&(le+=_e-1,K-=_e-1),K--,q--}for(;ee<M.length&&j+1<U.length&&!this._isCharWordSeparator(M.loadCell(ee+1,this._workCell));){M.loadCell(ee+1,this._workCell);var fe=this._workCell.getChars().length;this._workCell.getWidth()===2?(se++,ee++):fe>1&&(ve+=fe-1,j+=fe-1),j++,ee++}}j++;var Ge=K+X-ie+le,Te=Math.min(this._bufferService.cols,j-K+ie+se-le-ve);if(m||U.slice(K,j).trim()!==""){if(S&&Ge===0&&M.getCodePoint(0)!==32){var Ue=N.lines.get(v[1]-1);if(Ue&&M.isWrapped&&Ue.getCodePoint(this._bufferService.cols-1)!==32){var Ze=this._getWordAt([this._bufferService.cols-1,v[1]-1],!1,!0,!1);if(Ze){var ut=this._bufferService.cols-Ze.start;Ge-=ut,Te+=ut}}}if(B&&Ge+Te===this._bufferService.cols&&M.getCodePoint(this._bufferService.cols-1)!==32){var Fe=N.lines.get(v[1]+1);if(Fe&&Fe.isWrapped&&Fe.getCodePoint(0)!==32){var Ye=this._getWordAt([0,v[1]+1],!1,!1,!0);Ye&&(Te+=Ye.length)}}return{start:Ge,length:Te}}}}},y.prototype._selectWordAt=function(v,m){var S=this._getWordAt(v,m);if(S){for(;S.start<0;)S.start+=this._bufferService.cols,v[1]--;this._model.selectionStart=[S.start,v[1]],this._model.selectionStartLength=S.length}},y.prototype._selectToWordAt=function(v){var m=this._getWordAt(v,!0);if(m){for(var S=v[1];m.start<0;)m.start+=this._bufferService.cols,S--;if(!this._model.areSelectionValuesReversed())for(;m.start+m.length>this._bufferService.cols;)m.length-=this._bufferService.cols,S++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?m.start:m.start+m.length,S]}},y.prototype._isCharWordSeparator=function(v){return v.getWidth()!==0&&this._optionsService.options.wordSeparator.indexOf(v.getChars())>=0},y.prototype._selectLineAt=function(v){var m=this._bufferService.buffer.getWrappedRangeForLine(v);this._model.selectionStart=[0,m.first],this._model.selectionEnd=[this._bufferService.cols,m.last],this._model.selectionStartLength=0},w([g(3,d.IBufferService),g(4,d.ICoreService),g(5,_.IMouseService),g(6,d.IOptionsService),g(7,_.IRenderService)],y)}(a.Disposable);E.SelectionService=I},4725:(P,E,L)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.ICharacterJoinerService=E.ISoundService=E.ISelectionService=E.IRenderService=E.IMouseService=E.ICoreBrowserService=E.ICharSizeService=void 0;var O=L(8343);E.ICharSizeService=(0,O.createDecorator)("CharSizeService"),E.ICoreBrowserService=(0,O.createDecorator)("CoreBrowserService"),E.IMouseService=(0,O.createDecorator)("MouseService"),E.IRenderService=(0,O.createDecorator)("RenderService"),E.ISelectionService=(0,O.createDecorator)("SelectionService"),E.ISoundService=(0,O.createDecorator)("SoundService"),E.ICharacterJoinerService=(0,O.createDecorator)("CharacterJoinerService")},357:function(P,E,L){var O=this&&this.__decorate||function(D,T,f,p){var _,d=arguments.length,o=d<3?T:p===null?p=Object.getOwnPropertyDescriptor(T,f):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(D,T,f,p);else for(var s=D.length-1;s>=0;s--)(_=D[s])&&(o=(d<3?_(o):d>3?_(T,f,o):_(T,f))||o);return d>3&&o&&Object.defineProperty(T,f,o),o},b=this&&this.__param||function(D,T){return function(f,p){T(f,p,D)}};Object.defineProperty(E,"__esModule",{value:!0}),E.SoundService=void 0;var w=L(2585),g=function(){function D(T){this._optionsService=T}return Object.defineProperty(D,"audioContext",{get:function(){if(!D._audioContext){var T=window.AudioContext||window.webkitAudioContext;if(!T)return console.warn("Web Audio API is not supported by this browser. Consider upgrading to the latest version"),null;D._audioContext=new T}return D._audioContext},enumerable:!1,configurable:!0}),D.prototype.playBellSound=function(){var T=D.audioContext;if(T){var f=T.createBufferSource();T.decodeAudioData(this._base64ToArrayBuffer(this._removeMimeType(this._optionsService.options.bellSound)),function(p){f.buffer=p,f.connect(T.destination),f.start(0)})}},D.prototype._base64ToArrayBuffer=function(T){for(var f=window.atob(T),p=f.length,_=new Uint8Array(p),d=0;d<p;d++)_[d]=f.charCodeAt(d);return _.buffer},D.prototype._removeMimeType=function(T){return T.split(",")[1]},D=O([b(0,w.IOptionsService)],D)}();E.SoundService=g},6349:(P,E,L)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.CircularList=void 0;var O=L(8460),b=function(){function w(g){this._maxLength=g,this.onDeleteEmitter=new O.EventEmitter,this.onInsertEmitter=new O.EventEmitter,this.onTrimEmitter=new O.EventEmitter,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}return Object.defineProperty(w.prototype,"onDelete",{get:function(){return this.onDeleteEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"onInsert",{get:function(){return this.onInsertEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"onTrim",{get:function(){return this.onTrimEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"maxLength",{get:function(){return this._maxLength},set:function(g){if(this._maxLength!==g){for(var D=new Array(g),T=0;T<Math.min(g,this.length);T++)D[T]=this._array[this._getCyclicIndex(T)];this._array=D,this._maxLength=g,this._startIndex=0}},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"length",{get:function(){return this._length},set:function(g){if(g>this._length)for(var D=this._length;D<g;D++)this._array[D]=void 0;this._length=g},enumerable:!1,configurable:!0}),w.prototype.get=function(g){return this._array[this._getCyclicIndex(g)]},w.prototype.set=function(g,D){this._array[this._getCyclicIndex(g)]=D},w.prototype.push=function(g){this._array[this._getCyclicIndex(this._length)]=g,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++},w.prototype.recycle=function(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]},Object.defineProperty(w.prototype,"isFull",{get:function(){return this._length===this._maxLength},enumerable:!1,configurable:!0}),w.prototype.pop=function(){return this._array[this._getCyclicIndex(this._length---1)]},w.prototype.splice=function(g,D){for(var T=[],f=2;f<arguments.length;f++)T[f-2]=arguments[f];if(D){for(var p=g;p<this._length-D;p++)this._array[this._getCyclicIndex(p)]=this._array[this._getCyclicIndex(p+D)];this._length-=D,this.onDeleteEmitter.fire({index:g,amount:D})}for(p=this._length-1;p>=g;p--)this._array[this._getCyclicIndex(p+T.length)]=this._array[this._getCyclicIndex(p)];for(p=0;p<T.length;p++)this._array[this._getCyclicIndex(g+p)]=T[p];if(T.length&&this.onInsertEmitter.fire({index:g,amount:T.length}),this._length+T.length>this._maxLength){var _=this._length+T.length-this._maxLength;this._startIndex+=_,this._length=this._maxLength,this.onTrimEmitter.fire(_)}else this._length+=T.length},w.prototype.trimStart=function(g){g>this._length&&(g=this._length),this._startIndex+=g,this._length-=g,this.onTrimEmitter.fire(g)},w.prototype.shiftElements=function(g,D,T){if(!(D<=0)){if(g<0||g>=this._length)throw new Error("start argument out of range");if(g+T<0)throw new Error("Cannot shift elements in list beyond index 0");if(T>0){for(var f=D-1;f>=0;f--)this.set(g+f+T,this.get(g+f));var p=g+D+T-this._length;if(p>0)for(this._length+=p;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(f=0;f<D;f++)this.set(g+f+T,this.get(g+f))}},w.prototype._getCyclicIndex=function(g){return(this._startIndex+g)%this._maxLength},w}();E.CircularList=b},1439:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.clone=void 0,E.clone=function L(O,b){if(b===void 0&&(b=5),typeof O!="object")return O;var w=Array.isArray(O)?[]:{};for(var g in O)w[g]=b<=1?O[g]:O[g]&&L(O[g],b-1);return w}},8969:function(P,E,L){var O,b=this&&this.__extends||(O=function(v,m){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(S,B){S.__proto__=B}||function(S,B){for(var N in B)Object.prototype.hasOwnProperty.call(B,N)&&(S[N]=B[N])},O(v,m)},function(v,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");function S(){this.constructor=v}O(v,m),v.prototype=m===null?Object.create(m):(S.prototype=m.prototype,new S)});Object.defineProperty(E,"__esModule",{value:!0}),E.CoreTerminal=void 0;var w=L(844),g=L(2585),D=L(4348),T=L(7866),f=L(744),p=L(7302),_=L(6975),d=L(8460),o=L(1753),s=L(3730),a=L(1480),u=L(7994),l=L(9282),A=L(5435),I=L(5981),R=!1,y=function(v){function m(S){var B=v.call(this)||this;return B._onBinary=new d.EventEmitter,B._onData=new d.EventEmitter,B._onLineFeed=new d.EventEmitter,B._onResize=new d.EventEmitter,B._onScroll=new d.EventEmitter,B._instantiationService=new D.InstantiationService,B.optionsService=new p.OptionsService(S),B._instantiationService.setService(g.IOptionsService,B.optionsService),B._bufferService=B.register(B._instantiationService.createInstance(f.BufferService)),B._instantiationService.setService(g.IBufferService,B._bufferService),B._logService=B._instantiationService.createInstance(T.LogService),B._instantiationService.setService(g.ILogService,B._logService),B.coreService=B.register(B._instantiationService.createInstance(_.CoreService,function(){return B.scrollToBottom()})),B._instantiationService.setService(g.ICoreService,B.coreService),B.coreMouseService=B._instantiationService.createInstance(o.CoreMouseService),B._instantiationService.setService(g.ICoreMouseService,B.coreMouseService),B._dirtyRowService=B._instantiationService.createInstance(s.DirtyRowService),B._instantiationService.setService(g.IDirtyRowService,B._dirtyRowService),B.unicodeService=B._instantiationService.createInstance(a.UnicodeService),B._instantiationService.setService(g.IUnicodeService,B.unicodeService),B._charsetService=B._instantiationService.createInstance(u.CharsetService),B._instantiationService.setService(g.ICharsetService,B._charsetService),B._inputHandler=new A.InputHandler(B._bufferService,B._charsetService,B.coreService,B._dirtyRowService,B._logService,B.optionsService,B.coreMouseService,B.unicodeService),B.register((0,d.forwardEvent)(B._inputHandler.onLineFeed,B._onLineFeed)),B.register(B._inputHandler),B.register((0,d.forwardEvent)(B._bufferService.onResize,B._onResize)),B.register((0,d.forwardEvent)(B.coreService.onData,B._onData)),B.register((0,d.forwardEvent)(B.coreService.onBinary,B._onBinary)),B.register(B.optionsService.onOptionChange(function(N){return B._updateOptions(N)})),B.register(B._bufferService.onScroll(function(N){B._onScroll.fire({position:B._bufferService.buffer.ydisp,source:0}),B._dirtyRowService.markRangeDirty(B._bufferService.buffer.scrollTop,B._bufferService.buffer.scrollBottom)})),B.register(B._inputHandler.onScroll(function(N){B._onScroll.fire({position:B._bufferService.buffer.ydisp,source:0}),B._dirtyRowService.markRangeDirty(B._bufferService.buffer.scrollTop,B._bufferService.buffer.scrollBottom)})),B._writeBuffer=new I.WriteBuffer(function(N,M){return B._inputHandler.parse(N,M)}),B}return b(m,v),Object.defineProperty(m.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"onScroll",{get:function(){var S=this;return this._onScrollApi||(this._onScrollApi=new d.EventEmitter,this.register(this._onScroll.event(function(B){var N;(N=S._onScrollApi)===null||N===void 0||N.fire(B.position)}))),this._onScrollApi.event},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"cols",{get:function(){return this._bufferService.cols},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"rows",{get:function(){return this._bufferService.rows},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"buffers",{get:function(){return this._bufferService.buffers},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"options",{get:function(){return this.optionsService.publicOptions},enumerable:!1,configurable:!0}),m.prototype.dispose=function(){var S;this._isDisposed||(v.prototype.dispose.call(this),(S=this._windowsMode)===null||S===void 0||S.dispose(),this._windowsMode=void 0)},m.prototype.write=function(S,B){this._writeBuffer.write(S,B)},m.prototype.writeSync=function(S,B){this._logService.logLevel<=g.LogLevelEnum.WARN&&!R&&(this._logService.warn("writeSync is unreliable and will be removed soon."),R=!0),this._writeBuffer.writeSync(S,B)},m.prototype.resize=function(S,B){isNaN(S)||isNaN(B)||(S=Math.max(S,f.MINIMUM_COLS),B=Math.max(B,f.MINIMUM_ROWS),this._bufferService.resize(S,B))},m.prototype.scroll=function(S,B){B===void 0&&(B=!1),this._bufferService.scroll(S,B)},m.prototype.scrollLines=function(S,B,N){this._bufferService.scrollLines(S,B,N)},m.prototype.scrollPages=function(S){this._bufferService.scrollPages(S)},m.prototype.scrollToTop=function(){this._bufferService.scrollToTop()},m.prototype.scrollToBottom=function(){this._bufferService.scrollToBottom()},m.prototype.scrollToLine=function(S){this._bufferService.scrollToLine(S)},m.prototype.registerEscHandler=function(S,B){return this._inputHandler.registerEscHandler(S,B)},m.prototype.registerDcsHandler=function(S,B){return this._inputHandler.registerDcsHandler(S,B)},m.prototype.registerCsiHandler=function(S,B){return this._inputHandler.registerCsiHandler(S,B)},m.prototype.registerOscHandler=function(S,B){return this._inputHandler.registerOscHandler(S,B)},m.prototype._setup=function(){this.optionsService.options.windowsMode&&this._enableWindowsMode()},m.prototype.reset=function(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()},m.prototype._updateOptions=function(S){var B;switch(S){case"scrollback":this.buffers.resize(this.cols,this.rows);break;case"windowsMode":this.optionsService.options.windowsMode?this._enableWindowsMode():((B=this._windowsMode)===null||B===void 0||B.dispose(),this._windowsMode=void 0)}},m.prototype._enableWindowsMode=function(){var S=this;if(!this._windowsMode){var B=[];B.push(this.onLineFeed(l.updateWindowsModeWrappedState.bind(null,this._bufferService))),B.push(this.registerCsiHandler({final:"H"},function(){return(0,l.updateWindowsModeWrappedState)(S._bufferService),!1})),this._windowsMode={dispose:function(){for(var N=0,M=B;N<M.length;N++)M[N].dispose()}}}},m}(w.Disposable);E.CoreTerminal=y},8460:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.forwardEvent=E.EventEmitter=void 0;var L=function(){function O(){this._listeners=[],this._disposed=!1}return Object.defineProperty(O.prototype,"event",{get:function(){var b=this;return this._event||(this._event=function(w){return b._listeners.push(w),{dispose:function(){if(!b._disposed){for(var g=0;g<b._listeners.length;g++)if(b._listeners[g]===w)return void b._listeners.splice(g,1)}}}}),this._event},enumerable:!1,configurable:!0}),O.prototype.fire=function(b,w){for(var g=[],D=0;D<this._listeners.length;D++)g.push(this._listeners[D]);for(D=0;D<g.length;D++)g[D].call(void 0,b,w)},O.prototype.dispose=function(){this._listeners&&(this._listeners.length=0),this._disposed=!0},O}();E.EventEmitter=L,E.forwardEvent=function(O,b){return O(function(w){return b.fire(w)})}},5435:function(P,E,L){var O,b=this&&this.__extends||(O=function(B,N){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(M,U){M.__proto__=U}||function(M,U){for(var K in U)Object.prototype.hasOwnProperty.call(U,K)&&(M[K]=U[K])},O(B,N)},function(B,N){if(typeof N!="function"&&N!==null)throw new TypeError("Class extends value "+String(N)+" is not a constructor or null");function M(){this.constructor=B}O(B,N),B.prototype=N===null?Object.create(N):(M.prototype=N.prototype,new M)});Object.defineProperty(E,"__esModule",{value:!0}),E.InputHandler=E.WindowsOptionsReportType=void 0;var w,g=L(2584),D=L(7116),T=L(2015),f=L(844),p=L(8273),_=L(482),d=L(8437),o=L(8460),s=L(643),a=L(511),u=L(3734),l=L(2585),A=L(6242),I=L(6351),R={"(":0,")":1,"*":2,"+":3,"-":1,".":2},y=131072;function v(B,N){if(B>24)return N.setWinLines||!1;switch(B){case 1:return!!N.restoreWin;case 2:return!!N.minimizeWin;case 3:return!!N.setWinPosition;case 4:return!!N.setWinSizePixels;case 5:return!!N.raiseWin;case 6:return!!N.lowerWin;case 7:return!!N.refreshWin;case 8:return!!N.setWinSizeChars;case 9:return!!N.maximizeWin;case 10:return!!N.fullscreenWin;case 11:return!!N.getWinState;case 13:return!!N.getWinPosition;case 14:return!!N.getWinSizePixels;case 15:return!!N.getScreenSizePixels;case 16:return!!N.getCellSizePixels;case 18:return!!N.getWinSizeChars;case 19:return!!N.getScreenSizeChars;case 20:return!!N.getIconTitle;case 21:return!!N.getWinTitle;case 22:return!!N.pushTitle;case 23:return!!N.popTitle;case 24:return!!N.setWinLines}return!1}(function(B){B[B.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",B[B.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(w=E.WindowsOptionsReportType||(E.WindowsOptionsReportType={}));var m=function(){function B(N,M,U,K){this._bufferService=N,this._coreService=M,this._logService=U,this._optionsService=K,this._data=new Uint32Array(0)}return B.prototype.hook=function(N){this._data=new Uint32Array(0)},B.prototype.put=function(N,M,U){this._data=(0,p.concat)(this._data,N.subarray(M,U))},B.prototype.unhook=function(N){if(!N)return this._data=new Uint32Array(0),!0;var M=(0,_.utf32ToString)(this._data);switch(this._data=new Uint32Array(0),M){case'"q':this._coreService.triggerDataEvent(g.C0.ESC+'P1$r0"q'+g.C0.ESC+"\\");break;case'"p':this._coreService.triggerDataEvent(g.C0.ESC+'P1$r61;1"p'+g.C0.ESC+"\\");break;case"r":var U=this._bufferService.buffer.scrollTop+1+";"+(this._bufferService.buffer.scrollBottom+1)+"r";this._coreService.triggerDataEvent(g.C0.ESC+"P1$r"+U+g.C0.ESC+"\\");break;case"m":this._coreService.triggerDataEvent(g.C0.ESC+"P1$r0m"+g.C0.ESC+"\\");break;case" q":var K={block:2,underline:4,bar:6}[this._optionsService.options.cursorStyle];K-=this._optionsService.options.cursorBlink?1:0,this._coreService.triggerDataEvent(g.C0.ESC+"P1$r"+K+" q"+g.C0.ESC+"\\");break;default:this._logService.debug("Unknown DCS $q %s",M),this._coreService.triggerDataEvent(g.C0.ESC+"P0$r"+g.C0.ESC+"\\")}return!0},B}(),S=function(B){function N(M,U,K,j,X,ie,se,le,ve){ve===void 0&&(ve=new T.EscapeSequenceParser);var q=B.call(this)||this;q._bufferService=M,q._charsetService=U,q._coreService=K,q._dirtyRowService=j,q._logService=X,q._optionsService=ie,q._coreMouseService=se,q._unicodeService=le,q._parser=ve,q._parseBuffer=new Uint32Array(4096),q._stringDecoder=new _.StringToUtf32,q._utf8Decoder=new _.Utf8ToUtf32,q._workCell=new a.CellData,q._windowTitle="",q._iconName="",q._windowTitleStack=[],q._iconNameStack=[],q._curAttrData=d.DEFAULT_ATTR_DATA.clone(),q._eraseAttrDataInternal=d.DEFAULT_ATTR_DATA.clone(),q._onRequestBell=new o.EventEmitter,q._onRequestRefreshRows=new o.EventEmitter,q._onRequestReset=new o.EventEmitter,q._onRequestSendFocus=new o.EventEmitter,q._onRequestSyncScrollBar=new o.EventEmitter,q._onRequestWindowsOptionsReport=new o.EventEmitter,q._onA11yChar=new o.EventEmitter,q._onA11yTab=new o.EventEmitter,q._onCursorMove=new o.EventEmitter,q._onLineFeed=new o.EventEmitter,q._onScroll=new o.EventEmitter,q._onTitleChange=new o.EventEmitter,q._onAnsiColorChange=new o.EventEmitter,q._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},q.register(q._parser),q._activeBuffer=q._bufferService.buffer,q.register(q._bufferService.buffers.onBufferActivate(function(fe){return q._activeBuffer=fe.activeBuffer})),q._parser.setCsiHandlerFallback(function(fe,Ge){q._logService.debug("Unknown CSI code: ",{identifier:q._parser.identToString(fe),params:Ge.toArray()})}),q._parser.setEscHandlerFallback(function(fe){q._logService.debug("Unknown ESC code: ",{identifier:q._parser.identToString(fe)})}),q._parser.setExecuteHandlerFallback(function(fe){q._logService.debug("Unknown EXECUTE code: ",{code:fe})}),q._parser.setOscHandlerFallback(function(fe,Ge,Te){q._logService.debug("Unknown OSC code: ",{identifier:fe,action:Ge,data:Te})}),q._parser.setDcsHandlerFallback(function(fe,Ge,Te){Ge==="HOOK"&&(Te=Te.toArray()),q._logService.debug("Unknown DCS code: ",{identifier:q._parser.identToString(fe),action:Ge,payload:Te})}),q._parser.setPrintHandler(function(fe,Ge,Te){return q.print(fe,Ge,Te)}),q._parser.registerCsiHandler({final:"@"},function(fe){return q.insertChars(fe)}),q._parser.registerCsiHandler({intermediates:" ",final:"@"},function(fe){return q.scrollLeft(fe)}),q._parser.registerCsiHandler({final:"A"},function(fe){return q.cursorUp(fe)}),q._parser.registerCsiHandler({intermediates:" ",final:"A"},function(fe){return q.scrollRight(fe)}),q._parser.registerCsiHandler({final:"B"},function(fe){return q.cursorDown(fe)}),q._parser.registerCsiHandler({final:"C"},function(fe){return q.cursorForward(fe)}),q._parser.registerCsiHandler({final:"D"},function(fe){return q.cursorBackward(fe)}),q._parser.registerCsiHandler({final:"E"},function(fe){return q.cursorNextLine(fe)}),q._parser.registerCsiHandler({final:"F"},function(fe){return q.cursorPrecedingLine(fe)}),q._parser.registerCsiHandler({final:"G"},function(fe){return q.cursorCharAbsolute(fe)}),q._parser.registerCsiHandler({final:"H"},function(fe){return q.cursorPosition(fe)}),q._parser.registerCsiHandler({final:"I"},function(fe){return q.cursorForwardTab(fe)}),q._parser.registerCsiHandler({final:"J"},function(fe){return q.eraseInDisplay(fe)}),q._parser.registerCsiHandler({prefix:"?",final:"J"},function(fe){return q.eraseInDisplay(fe)}),q._parser.registerCsiHandler({final:"K"},function(fe){return q.eraseInLine(fe)}),q._parser.registerCsiHandler({prefix:"?",final:"K"},function(fe){return q.eraseInLine(fe)}),q._parser.registerCsiHandler({final:"L"},function(fe){return q.insertLines(fe)}),q._parser.registerCsiHandler({final:"M"},function(fe){return q.deleteLines(fe)}),q._parser.registerCsiHandler({final:"P"},function(fe){return q.deleteChars(fe)}),q._parser.registerCsiHandler({final:"S"},function(fe){return q.scrollUp(fe)}),q._parser.registerCsiHandler({final:"T"},function(fe){return q.scrollDown(fe)}),q._parser.registerCsiHandler({final:"X"},function(fe){return q.eraseChars(fe)}),q._parser.registerCsiHandler({final:"Z"},function(fe){return q.cursorBackwardTab(fe)}),q._parser.registerCsiHandler({final:"`"},function(fe){return q.charPosAbsolute(fe)}),q._parser.registerCsiHandler({final:"a"},function(fe){return q.hPositionRelative(fe)}),q._parser.registerCsiHandler({final:"b"},function(fe){return q.repeatPrecedingCharacter(fe)}),q._parser.registerCsiHandler({final:"c"},function(fe){return q.sendDeviceAttributesPrimary(fe)}),q._parser.registerCsiHandler({prefix:">",final:"c"},function(fe){return q.sendDeviceAttributesSecondary(fe)}),q._parser.registerCsiHandler({final:"d"},function(fe){return q.linePosAbsolute(fe)}),q._parser.registerCsiHandler({final:"e"},function(fe){return q.vPositionRelative(fe)}),q._parser.registerCsiHandler({final:"f"},function(fe){return q.hVPosition(fe)}),q._parser.registerCsiHandler({final:"g"},function(fe){return q.tabClear(fe)}),q._parser.registerCsiHandler({final:"h"},function(fe){return q.setMode(fe)}),q._parser.registerCsiHandler({prefix:"?",final:"h"},function(fe){return q.setModePrivate(fe)}),q._parser.registerCsiHandler({final:"l"},function(fe){return q.resetMode(fe)}),q._parser.registerCsiHandler({prefix:"?",final:"l"},function(fe){return q.resetModePrivate(fe)}),q._parser.registerCsiHandler({final:"m"},function(fe){return q.charAttributes(fe)}),q._parser.registerCsiHandler({final:"n"},function(fe){return q.deviceStatus(fe)}),q._parser.registerCsiHandler({prefix:"?",final:"n"},function(fe){return q.deviceStatusPrivate(fe)}),q._parser.registerCsiHandler({intermediates:"!",final:"p"},function(fe){return q.softReset(fe)}),q._parser.registerCsiHandler({intermediates:" ",final:"q"},function(fe){return q.setCursorStyle(fe)}),q._parser.registerCsiHandler({final:"r"},function(fe){return q.setScrollRegion(fe)}),q._parser.registerCsiHandler({final:"s"},function(fe){return q.saveCursor(fe)}),q._parser.registerCsiHandler({final:"t"},function(fe){return q.windowOptions(fe)}),q._parser.registerCsiHandler({final:"u"},function(fe){return q.restoreCursor(fe)}),q._parser.registerCsiHandler({intermediates:"'",final:"}"},function(fe){return q.insertColumns(fe)}),q._parser.registerCsiHandler({intermediates:"'",final:"~"},function(fe){return q.deleteColumns(fe)}),q._parser.setExecuteHandler(g.C0.BEL,function(){return q.bell()}),q._parser.setExecuteHandler(g.C0.LF,function(){return q.lineFeed()}),q._parser.setExecuteHandler(g.C0.VT,function(){return q.lineFeed()}),q._parser.setExecuteHandler(g.C0.FF,function(){return q.lineFeed()}),q._parser.setExecuteHandler(g.C0.CR,function(){return q.carriageReturn()}),q._parser.setExecuteHandler(g.C0.BS,function(){return q.backspace()}),q._parser.setExecuteHandler(g.C0.HT,function(){return q.tab()}),q._parser.setExecuteHandler(g.C0.SO,function(){return q.shiftOut()}),q._parser.setExecuteHandler(g.C0.SI,function(){return q.shiftIn()}),q._parser.setExecuteHandler(g.C1.IND,function(){return q.index()}),q._parser.setExecuteHandler(g.C1.NEL,function(){return q.nextLine()}),q._parser.setExecuteHandler(g.C1.HTS,function(){return q.tabSet()}),q._parser.registerOscHandler(0,new A.OscHandler(function(fe){return q.setTitle(fe),q.setIconName(fe),!0})),q._parser.registerOscHandler(1,new A.OscHandler(function(fe){return q.setIconName(fe)})),q._parser.registerOscHandler(2,new A.OscHandler(function(fe){return q.setTitle(fe)})),q._parser.registerOscHandler(4,new A.OscHandler(function(fe){return q.setAnsiColor(fe)})),q._parser.registerEscHandler({final:"7"},function(){return q.saveCursor()}),q._parser.registerEscHandler({final:"8"},function(){return q.restoreCursor()}),q._parser.registerEscHandler({final:"D"},function(){return q.index()}),q._parser.registerEscHandler({final:"E"},function(){return q.nextLine()}),q._parser.registerEscHandler({final:"H"},function(){return q.tabSet()}),q._parser.registerEscHandler({final:"M"},function(){return q.reverseIndex()}),q._parser.registerEscHandler({final:"="},function(){return q.keypadApplicationMode()}),q._parser.registerEscHandler({final:">"},function(){return q.keypadNumericMode()}),q._parser.registerEscHandler({final:"c"},function(){return q.fullReset()}),q._parser.registerEscHandler({final:"n"},function(){return q.setgLevel(2)}),q._parser.registerEscHandler({final:"o"},function(){return q.setgLevel(3)}),q._parser.registerEscHandler({final:"|"},function(){return q.setgLevel(3)}),q._parser.registerEscHandler({final:"}"},function(){return q.setgLevel(2)}),q._parser.registerEscHandler({final:"~"},function(){return q.setgLevel(1)}),q._parser.registerEscHandler({intermediates:"%",final:"@"},function(){return q.selectDefaultCharset()}),q._parser.registerEscHandler({intermediates:"%",final:"G"},function(){return q.selectDefaultCharset()});var ee=function(fe){ae._parser.registerEscHandler({intermediates:"(",final:fe},function(){return q.selectCharset("("+fe)}),ae._parser.registerEscHandler({intermediates:")",final:fe},function(){return q.selectCharset(")"+fe)}),ae._parser.registerEscHandler({intermediates:"*",final:fe},function(){return q.selectCharset("*"+fe)}),ae._parser.registerEscHandler({intermediates:"+",final:fe},function(){return q.selectCharset("+"+fe)}),ae._parser.registerEscHandler({intermediates:"-",final:fe},function(){return q.selectCharset("-"+fe)}),ae._parser.registerEscHandler({intermediates:".",final:fe},function(){return q.selectCharset("."+fe)}),ae._parser.registerEscHandler({intermediates:"/",final:fe},function(){return q.selectCharset("/"+fe)})},ae=this;for(var _e in D.CHARSETS)ee(_e);return q._parser.registerEscHandler({intermediates:"#",final:"8"},function(){return q.screenAlignmentPattern()}),q._parser.setErrorHandler(function(fe){return q._logService.error("Parsing error: ",fe),fe}),q._parser.registerDcsHandler({intermediates:"$",final:"q"},new m(q._bufferService,q._coreService,q._logService,q._optionsService)),q}return b(N,B),Object.defineProperty(N.prototype,"onRequestBell",{get:function(){return this._onRequestBell.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onRequestRefreshRows",{get:function(){return this._onRequestRefreshRows.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onRequestReset",{get:function(){return this._onRequestReset.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onRequestSendFocus",{get:function(){return this._onRequestSendFocus.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onRequestSyncScrollBar",{get:function(){return this._onRequestSyncScrollBar.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onRequestWindowsOptionsReport",{get:function(){return this._onRequestWindowsOptionsReport.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onA11yChar",{get:function(){return this._onA11yChar.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onA11yTab",{get:function(){return this._onA11yTab.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onAnsiColorChange",{get:function(){return this._onAnsiColorChange.event},enumerable:!1,configurable:!0}),N.prototype.dispose=function(){B.prototype.dispose.call(this)},N.prototype._preserveStack=function(M,U,K,j){this._parseStack.paused=!0,this._parseStack.cursorStartX=M,this._parseStack.cursorStartY=U,this._parseStack.decodedLength=K,this._parseStack.position=j},N.prototype._logSlowResolvingAsync=function(M){this._logService.logLevel<=l.LogLevelEnum.WARN&&Promise.race([M,new Promise(function(U,K){return setTimeout(function(){return K("#SLOW_TIMEOUT")},5e3)})]).catch(function(U){if(U!=="#SLOW_TIMEOUT")throw U;console.warn("async parser handler taking longer than 5000 ms")})},N.prototype.parse=function(M,U){var K,j=this._activeBuffer.x,X=this._activeBuffer.y,ie=0,se=this._parseStack.paused;if(se){if(K=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,U))return this._logSlowResolvingAsync(K),K;j=this._parseStack.cursorStartX,X=this._parseStack.cursorStartY,this._parseStack.paused=!1,M.length>y&&(ie=this._parseStack.position+y)}if(this._logService.debug("parsing data",M),this._parseBuffer.length<M.length&&this._parseBuffer.length<y&&(this._parseBuffer=new Uint32Array(Math.min(M.length,y))),se||this._dirtyRowService.clearRange(),M.length>y)for(var le=ie;le<M.length;le+=y){var ve=le+y<M.length?le+y:M.length,q=typeof M=="string"?this._stringDecoder.decode(M.substring(le,ve),this._parseBuffer):this._utf8Decoder.decode(M.subarray(le,ve),this._parseBuffer);if(K=this._parser.parse(this._parseBuffer,q))return this._preserveStack(j,X,q,le),this._logSlowResolvingAsync(K),K}else if(!se&&(q=typeof M=="string"?this._stringDecoder.decode(M,this._parseBuffer):this._utf8Decoder.decode(M,this._parseBuffer),K=this._parser.parse(this._parseBuffer,q)))return this._preserveStack(j,X,q,0),this._logSlowResolvingAsync(K),K;this._activeBuffer.x===j&&this._activeBuffer.y===X||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowService.start,this._dirtyRowService.end)},N.prototype.print=function(M,U,K){var j,X,ie=this._charsetService.charset,se=this._optionsService.options.screenReaderMode,le=this._bufferService.cols,ve=this._coreService.decPrivateModes.wraparound,q=this._coreService.modes.insertMode,ee=this._curAttrData,ae=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowService.markDirty(this._activeBuffer.y),this._activeBuffer.x&&K-U>0&&ae.getWidth(this._activeBuffer.x-1)===2&&ae.setCellFromCodePoint(this._activeBuffer.x-1,0,1,ee.fg,ee.bg,ee.extended);for(var _e=U;_e<K;++_e){if(j=M[_e],X=this._unicodeService.wcwidth(j),j<127&&ie){var fe=ie[String.fromCharCode(j)];fe&&(j=fe.charCodeAt(0))}if(se&&this._onA11yChar.fire((0,_.stringFromCodePoint)(j)),X||!this._activeBuffer.x){if(this._activeBuffer.x+X-1>=le){if(ve){for(;this._activeBuffer.x<le;)ae.setCellFromCodePoint(this._activeBuffer.x++,0,1,ee.fg,ee.bg,ee.extended);this._activeBuffer.x=0,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),ae=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=le-1,X===2)continue}if(q&&(ae.insertCells(this._activeBuffer.x,X,this._activeBuffer.getNullCell(ee),ee),ae.getWidth(le-1)===2&&ae.setCellFromCodePoint(le-1,s.NULL_CELL_CODE,s.NULL_CELL_WIDTH,ee.fg,ee.bg,ee.extended)),ae.setCellFromCodePoint(this._activeBuffer.x++,j,X,ee.fg,ee.bg,ee.extended),X>0)for(;--X;)ae.setCellFromCodePoint(this._activeBuffer.x++,0,0,ee.fg,ee.bg,ee.extended)}else ae.getWidth(this._activeBuffer.x-1)?ae.addCodepointToCell(this._activeBuffer.x-1,j):ae.addCodepointToCell(this._activeBuffer.x-2,j)}K-U>0&&(ae.loadCell(this._activeBuffer.x-1,this._workCell),this._workCell.getWidth()===2||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),this._activeBuffer.x<le&&K-U>0&&ae.getWidth(this._activeBuffer.x)===0&&!ae.hasContent(this._activeBuffer.x)&&ae.setCellFromCodePoint(this._activeBuffer.x,0,1,ee.fg,ee.bg,ee.extended),this._dirtyRowService.markDirty(this._activeBuffer.y)},N.prototype.registerCsiHandler=function(M,U){var K=this;return M.final!=="t"||M.prefix||M.intermediates?this._parser.registerCsiHandler(M,U):this._parser.registerCsiHandler(M,function(j){return!v(j.params[0],K._optionsService.options.windowOptions)||U(j)})},N.prototype.registerDcsHandler=function(M,U){return this._parser.registerDcsHandler(M,new I.DcsHandler(U))},N.prototype.registerEscHandler=function(M,U){return this._parser.registerEscHandler(M,U)},N.prototype.registerOscHandler=function(M,U){return this._parser.registerOscHandler(M,new A.OscHandler(U))},N.prototype.bell=function(){return this._onRequestBell.fire(),!0},N.prototype.lineFeed=function(){return this._dirtyRowService.markDirty(this._activeBuffer.y),this._optionsService.options.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowService.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0},N.prototype.carriageReturn=function(){return this._activeBuffer.x=0,!0},N.prototype.backspace=function(){var M;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))===null||M===void 0?void 0:M.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;var U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);U.hasWidth(this._activeBuffer.x)&&!U.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0},N.prototype.tab=function(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;var M=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.options.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-M),!0},N.prototype.shiftOut=function(){return this._charsetService.setgLevel(1),!0},N.prototype.shiftIn=function(){return this._charsetService.setgLevel(0),!0},N.prototype._restrictCursor=function(M){M===void 0&&(M=this._bufferService.cols-1),this._activeBuffer.x=Math.min(M,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowService.markDirty(this._activeBuffer.y)},N.prototype._setCursor=function(M,U){this._dirtyRowService.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=M,this._activeBuffer.y=this._activeBuffer.scrollTop+U):(this._activeBuffer.x=M,this._activeBuffer.y=U),this._restrictCursor(),this._dirtyRowService.markDirty(this._activeBuffer.y)},N.prototype._moveCursor=function(M,U){this._restrictCursor(),this._setCursor(this._activeBuffer.x+M,this._activeBuffer.y+U)},N.prototype.cursorUp=function(M){var U=this._activeBuffer.y-this._activeBuffer.scrollTop;return U>=0?this._moveCursor(0,-Math.min(U,M.params[0]||1)):this._moveCursor(0,-(M.params[0]||1)),!0},N.prototype.cursorDown=function(M){var U=this._activeBuffer.scrollBottom-this._activeBuffer.y;return U>=0?this._moveCursor(0,Math.min(U,M.params[0]||1)):this._moveCursor(0,M.params[0]||1),!0},N.prototype.cursorForward=function(M){return this._moveCursor(M.params[0]||1,0),!0},N.prototype.cursorBackward=function(M){return this._moveCursor(-(M.params[0]||1),0),!0},N.prototype.cursorNextLine=function(M){return this.cursorDown(M),this._activeBuffer.x=0,!0},N.prototype.cursorPrecedingLine=function(M){return this.cursorUp(M),this._activeBuffer.x=0,!0},N.prototype.cursorCharAbsolute=function(M){return this._setCursor((M.params[0]||1)-1,this._activeBuffer.y),!0},N.prototype.cursorPosition=function(M){return this._setCursor(M.length>=2?(M.params[1]||1)-1:0,(M.params[0]||1)-1),!0},N.prototype.charPosAbsolute=function(M){return this._setCursor((M.params[0]||1)-1,this._activeBuffer.y),!0},N.prototype.hPositionRelative=function(M){return this._moveCursor(M.params[0]||1,0),!0},N.prototype.linePosAbsolute=function(M){return this._setCursor(this._activeBuffer.x,(M.params[0]||1)-1),!0},N.prototype.vPositionRelative=function(M){return this._moveCursor(0,M.params[0]||1),!0},N.prototype.hVPosition=function(M){return this.cursorPosition(M),!0},N.prototype.tabClear=function(M){var U=M.params[0];return U===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:U===3&&(this._activeBuffer.tabs={}),!0},N.prototype.cursorForwardTab=function(M){if(this._activeBuffer.x>=this._bufferService.cols)return!0;for(var U=M.params[0]||1;U--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0},N.prototype.cursorBackwardTab=function(M){if(this._activeBuffer.x>=this._bufferService.cols)return!0;for(var U=M.params[0]||1;U--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0},N.prototype._eraseInBufferLine=function(M,U,K,j){j===void 0&&(j=!1);var X=this._activeBuffer.lines.get(this._activeBuffer.ybase+M);X.replaceCells(U,K,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),j&&(X.isWrapped=!1)},N.prototype._resetBufferLine=function(M){var U=this._activeBuffer.lines.get(this._activeBuffer.ybase+M);U.fill(this._activeBuffer.getNullCell(this._eraseAttrData())),U.isWrapped=!1},N.prototype.eraseInDisplay=function(M){var U;switch(this._restrictCursor(this._bufferService.cols),M.params[0]){case 0:for(U=this._activeBuffer.y,this._dirtyRowService.markDirty(U),this._eraseInBufferLine(U++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0);U<this._bufferService.rows;U++)this._resetBufferLine(U);this._dirtyRowService.markDirty(U);break;case 1:for(U=this._activeBuffer.y,this._dirtyRowService.markDirty(U),this._eraseInBufferLine(U,0,this._activeBuffer.x+1,!0),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(U+1).isWrapped=!1);U--;)this._resetBufferLine(U);this._dirtyRowService.markDirty(0);break;case 2:for(U=this._bufferService.rows,this._dirtyRowService.markDirty(U-1);U--;)this._resetBufferLine(U);this._dirtyRowService.markDirty(0);break;case 3:var K=this._activeBuffer.lines.length-this._bufferService.rows;K>0&&(this._activeBuffer.lines.trimStart(K),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-K,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-K,0),this._onScroll.fire(0))}return!0},N.prototype.eraseInLine=function(M){switch(this._restrictCursor(this._bufferService.cols),M.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols)}return this._dirtyRowService.markDirty(this._activeBuffer.y),!0},N.prototype.insertLines=function(M){this._restrictCursor();var U=M.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;for(var K=this._activeBuffer.ybase+this._activeBuffer.y,j=this._bufferService.rows-1-this._activeBuffer.scrollBottom,X=this._bufferService.rows-1+this._activeBuffer.ybase-j+1;U--;)this._activeBuffer.lines.splice(X-1,1),this._activeBuffer.lines.splice(K,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowService.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0},N.prototype.deleteLines=function(M){this._restrictCursor();var U=M.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;var K,j=this._activeBuffer.ybase+this._activeBuffer.y;for(K=this._bufferService.rows-1-this._activeBuffer.scrollBottom,K=this._bufferService.rows-1+this._activeBuffer.ybase-K;U--;)this._activeBuffer.lines.splice(j,1),this._activeBuffer.lines.splice(K,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowService.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0},N.prototype.insertChars=function(M){this._restrictCursor();var U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.insertCells(this._activeBuffer.x,M.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._activeBuffer.y)),!0},N.prototype.deleteChars=function(M){this._restrictCursor();var U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.deleteCells(this._activeBuffer.x,M.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._activeBuffer.y)),!0},N.prototype.scrollUp=function(M){for(var U=M.params[0]||1;U--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0},N.prototype.scrollDown=function(M){for(var U=M.params[0]||1;U--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(d.DEFAULT_ATTR_DATA));return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0},N.prototype.scrollLeft=function(M){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;for(var U=M.params[0]||1,K=this._activeBuffer.scrollTop;K<=this._activeBuffer.scrollBottom;++K){var j=this._activeBuffer.lines.get(this._activeBuffer.ybase+K);j.deleteCells(0,U,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),j.isWrapped=!1}return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0},N.prototype.scrollRight=function(M){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;for(var U=M.params[0]||1,K=this._activeBuffer.scrollTop;K<=this._activeBuffer.scrollBottom;++K){var j=this._activeBuffer.lines.get(this._activeBuffer.ybase+K);j.insertCells(0,U,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),j.isWrapped=!1}return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0},N.prototype.insertColumns=function(M){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;for(var U=M.params[0]||1,K=this._activeBuffer.scrollTop;K<=this._activeBuffer.scrollBottom;++K){var j=this._activeBuffer.lines.get(this._activeBuffer.ybase+K);j.insertCells(this._activeBuffer.x,U,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),j.isWrapped=!1}return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0},N.prototype.deleteColumns=function(M){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;for(var U=M.params[0]||1,K=this._activeBuffer.scrollTop;K<=this._activeBuffer.scrollBottom;++K){var j=this._activeBuffer.lines.get(this._activeBuffer.ybase+K);j.deleteCells(this._activeBuffer.x,U,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),j.isWrapped=!1}return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0},N.prototype.eraseChars=function(M){this._restrictCursor();var U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(M.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._activeBuffer.y)),!0},N.prototype.repeatPrecedingCharacter=function(M){if(!this._parser.precedingCodepoint)return!0;for(var U=M.params[0]||1,K=new Uint32Array(U),j=0;j<U;++j)K[j]=this._parser.precedingCodepoint;return this.print(K,0,K.length),!0},N.prototype.sendDeviceAttributesPrimary=function(M){return M.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(g.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(g.C0.ESC+"[?6c")),!0},N.prototype.sendDeviceAttributesSecondary=function(M){return M.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(g.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(g.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(M.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(g.C0.ESC+"[>83;40003;0c")),!0},N.prototype._is=function(M){return(this._optionsService.options.termName+"").indexOf(M)===0},N.prototype.setMode=function(M){for(var U=0;U<M.length;U++)M.params[U]===4&&(this._coreService.modes.insertMode=!0);return!0},N.prototype.setModePrivate=function(M){for(var U=0;U<M.length;U++)switch(M.params[U]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,D.DEFAULT_CHARSET),this._charsetService.setgCharset(1,D.DEFAULT_CHARSET),this._charsetService.setgCharset(2,D.DEFAULT_CHARSET),this._charsetService.setgCharset(3,D.DEFAULT_CHARSET);break;case 3:this._optionsService.options.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0},N.prototype.resetMode=function(M){for(var U=0;U<M.length;U++)M.params[U]===4&&(this._coreService.modes.insertMode=!1);return!0},N.prototype.resetModePrivate=function(M){for(var U=0;U<M.length;U++)switch(M.params[U]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.options.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),M.params[U]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0},N.prototype._updateAttrColor=function(M,U,K,j,X){return U===2?(M|=50331648,M&=-16777216,M|=u.AttributeData.fromColorRGB([K,j,X])):U===5&&(M&=-50331904,M|=33554432|255&K),M},N.prototype._extractColor=function(M,U,K){var j=[0,0,-1,0,0,0],X=0,ie=0;do{if(j[ie+X]=M.params[U+ie],M.hasSubParams(U+ie)){var se=M.getSubParams(U+ie),le=0;do j[1]===5&&(X=1),j[ie+le+1+X]=se[le];while(++le<se.length&&le+ie+1+X<j.length);break}if(j[1]===5&&ie+X>=2||j[1]===2&&ie+X>=5)break;j[1]&&(X=1)}while(++ie+U<M.length&&ie+X<j.length);for(le=2;le<j.length;++le)j[le]===-1&&(j[le]=0);switch(j[0]){case 38:K.fg=this._updateAttrColor(K.fg,j[1],j[3],j[4],j[5]);break;case 48:K.bg=this._updateAttrColor(K.bg,j[1],j[3],j[4],j[5]);break;case 58:K.extended=K.extended.clone(),K.extended.underlineColor=this._updateAttrColor(K.extended.underlineColor,j[1],j[3],j[4],j[5])}return ie},N.prototype._processUnderline=function(M,U){U.extended=U.extended.clone(),(!~M||M>5)&&(M=1),U.extended.underlineStyle=M,U.fg|=268435456,M===0&&(U.fg&=-268435457),U.updateExtended()},N.prototype.charAttributes=function(M){if(M.length===1&&M.params[0]===0)return this._curAttrData.fg=d.DEFAULT_ATTR_DATA.fg,this._curAttrData.bg=d.DEFAULT_ATTR_DATA.bg,!0;for(var U,K=M.length,j=this._curAttrData,X=0;X<K;X++)(U=M.params[X])>=30&&U<=37?(j.fg&=-50331904,j.fg|=16777216|U-30):U>=40&&U<=47?(j.bg&=-50331904,j.bg|=16777216|U-40):U>=90&&U<=97?(j.fg&=-50331904,j.fg|=16777224|U-90):U>=100&&U<=107?(j.bg&=-50331904,j.bg|=16777224|U-100):U===0?(j.fg=d.DEFAULT_ATTR_DATA.fg,j.bg=d.DEFAULT_ATTR_DATA.bg):U===1?j.fg|=134217728:U===3?j.bg|=67108864:U===4?(j.fg|=268435456,this._processUnderline(M.hasSubParams(X)?M.getSubParams(X)[0]:1,j)):U===5?j.fg|=536870912:U===7?j.fg|=67108864:U===8?j.fg|=1073741824:U===9?j.fg|=2147483648:U===2?j.bg|=134217728:U===21?this._processUnderline(2,j):U===22?(j.fg&=-134217729,j.bg&=-134217729):U===23?j.bg&=-67108865:U===24?j.fg&=-268435457:U===25?j.fg&=-536870913:U===27?j.fg&=-67108865:U===28?j.fg&=-1073741825:U===29?j.fg&=2147483647:U===39?(j.fg&=-67108864,j.fg|=16777215&d.DEFAULT_ATTR_DATA.fg):U===49?(j.bg&=-67108864,j.bg|=16777215&d.DEFAULT_ATTR_DATA.bg):U===38||U===48||U===58?X+=this._extractColor(M,X,j):U===59?(j.extended=j.extended.clone(),j.extended.underlineColor=-1,j.updateExtended()):U===100?(j.fg&=-67108864,j.fg|=16777215&d.DEFAULT_ATTR_DATA.fg,j.bg&=-67108864,j.bg|=16777215&d.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",U);return!0},N.prototype.deviceStatus=function(M){switch(M.params[0]){case 5:this._coreService.triggerDataEvent(g.C0.ESC+"[0n");break;case 6:var U=this._activeBuffer.y+1,K=this._activeBuffer.x+1;this._coreService.triggerDataEvent(g.C0.ESC+"["+U+";"+K+"R")}return!0},N.prototype.deviceStatusPrivate=function(M){if(M.params[0]===6){var U=this._activeBuffer.y+1,K=this._activeBuffer.x+1;this._coreService.triggerDataEvent(g.C0.ESC+"[?"+U+";"+K+"R")}return!0},N.prototype.softReset=function(M){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=d.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0},N.prototype.setCursorStyle=function(M){var U=M.params[0]||1;switch(U){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}var K=U%2==1;return this._optionsService.options.cursorBlink=K,!0},N.prototype.setScrollRegion=function(M){var U,K=M.params[0]||1;return(M.length<2||(U=M.params[1])>this._bufferService.rows||U===0)&&(U=this._bufferService.rows),U>K&&(this._activeBuffer.scrollTop=K-1,this._activeBuffer.scrollBottom=U-1,this._setCursor(0,0)),!0},N.prototype.windowOptions=function(M){if(!v(M.params[0],this._optionsService.options.windowOptions))return!0;var U=M.length>1?M.params[1]:0;switch(M.params[0]){case 14:U!==2&&this._onRequestWindowsOptionsReport.fire(w.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(w.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(g.C0.ESC+"[8;"+this._bufferService.rows+";"+this._bufferService.cols+"t");break;case 22:U!==0&&U!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),U!==0&&U!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:U!==0&&U!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),U!==0&&U!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0},N.prototype.saveCursor=function(M){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0},N.prototype.restoreCursor=function(M){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0},N.prototype.setTitle=function(M){return this._windowTitle=M,this._onTitleChange.fire(M),!0},N.prototype.setIconName=function(M){return this._iconName=M,!0},N.prototype._parseAnsiColorChange=function(M){for(var U,K={colors:[]},j=/(\d+);rgb:([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})/gi;(U=j.exec(M))!==null;)K.colors.push({colorIndex:parseInt(U[1]),red:parseInt(U[2],16),green:parseInt(U[3],16),blue:parseInt(U[4],16)});return K.colors.length===0?null:K},N.prototype.setAnsiColor=function(M){var U=this._parseAnsiColorChange(M);return U?this._onAnsiColorChange.fire(U):this._logService.warn("Expected format <num>;rgb:<rr>/<gg>/<bb> but got data: "+M),!0},N.prototype.nextLine=function(){return this._activeBuffer.x=0,this.index(),!0},N.prototype.keypadApplicationMode=function(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0},N.prototype.keypadNumericMode=function(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0},N.prototype.selectDefaultCharset=function(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,D.DEFAULT_CHARSET),!0},N.prototype.selectCharset=function(M){return M.length!==2?(this.selectDefaultCharset(),!0):(M[0]==="/"||this._charsetService.setgCharset(R[M[0]],D.CHARSETS[M[1]]||D.DEFAULT_CHARSET),!0)},N.prototype.index=function(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0},N.prototype.tabSet=function(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0},N.prototype.reverseIndex=function(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){var M=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,M,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0},N.prototype.fullReset=function(){return this._parser.reset(),this._onRequestReset.fire(),!0},N.prototype.reset=function(){this._curAttrData=d.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=d.DEFAULT_ATTR_DATA.clone()},N.prototype._eraseAttrData=function(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal},N.prototype.setgLevel=function(M){return this._charsetService.setgLevel(M),!0},N.prototype.screenAlignmentPattern=function(){var M=new a.CellData;M.content=1<<22|"E".charCodeAt(0),M.fg=this._curAttrData.fg,M.bg=this._curAttrData.bg,this._setCursor(0,0);for(var U=0;U<this._bufferService.rows;++U){var K=this._activeBuffer.ybase+this._activeBuffer.y+U,j=this._activeBuffer.lines.get(K);j&&(j.fill(M),j.isWrapped=!1)}return this._dirtyRowService.markAllDirty(),this._setCursor(0,0),!0},N}(f.Disposable);E.InputHandler=S},844:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.getDisposeArrayDisposable=E.disposeArray=E.Disposable=void 0;var L=function(){function b(){this._disposables=[],this._isDisposed=!1}return b.prototype.dispose=function(){this._isDisposed=!0;for(var w=0,g=this._disposables;w<g.length;w++)g[w].dispose();this._disposables.length=0},b.prototype.register=function(w){return this._disposables.push(w),w},b.prototype.unregister=function(w){var g=this._disposables.indexOf(w);g!==-1&&this._disposables.splice(g,1)},b}();function O(b){for(var w=0,g=b;w<g.length;w++)g[w].dispose();b.length=0}E.Disposable=L,E.disposeArray=O,E.getDisposeArrayDisposable=function(b){return{dispose:function(){return O(b)}}}},6114:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.isLinux=E.isWindows=E.isIphone=E.isIpad=E.isMac=E.isSafari=E.isFirefox=void 0;var L=typeof navigator=="undefined",O=L?"node":navigator.userAgent,b=L?"node":navigator.platform;E.isFirefox=O.includes("Firefox"),E.isSafari=/^((?!chrome|android).)*safari/i.test(O),E.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(b),E.isIpad=b==="iPad",E.isIphone=b==="iPhone",E.isWindows=["Windows","Win16","Win32","WinCE"].includes(b),E.isLinux=b.indexOf("Linux")>=0},8273:(P,E)=>{function L(O,b,w,g){if(w===void 0&&(w=0),g===void 0&&(g=O.length),w>=O.length)return O;w=(O.length+w)%O.length,g=g>=O.length?O.length:(O.length+g)%O.length;for(var D=w;D<g;++D)O[D]=b;return O}Object.defineProperty(E,"__esModule",{value:!0}),E.concat=E.fillFallback=E.fill=void 0,E.fill=function(O,b,w,g){return O.fill?O.fill(b,w,g):L(O,b,w,g)},E.fillFallback=L,E.concat=function(O,b){var w=new O.constructor(O.length+b.length);return w.set(O),w.set(b,O.length),w}},9282:(P,E,L)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.updateWindowsModeWrappedState=void 0;var O=L(643);E.updateWindowsModeWrappedState=function(b){var w=b.buffer.lines.get(b.buffer.ybase+b.buffer.y-1),g=w==null?void 0:w.get(b.cols-1),D=b.buffer.lines.get(b.buffer.ybase+b.buffer.y);D&&g&&(D.isWrapped=g[O.CHAR_DATA_CODE_INDEX]!==O.NULL_CELL_CODE&&g[O.CHAR_DATA_CODE_INDEX]!==O.WHITESPACE_CELL_CODE)}},3734:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.ExtendedAttrs=E.AttributeData=void 0;var L=function(){function b(){this.fg=0,this.bg=0,this.extended=new O}return b.toColorRGB=function(w){return[w>>>16&255,w>>>8&255,255&w]},b.fromColorRGB=function(w){return(255&w[0])<<16|(255&w[1])<<8|255&w[2]},b.prototype.clone=function(){var w=new b;return w.fg=this.fg,w.bg=this.bg,w.extended=this.extended.clone(),w},b.prototype.isInverse=function(){return 67108864&this.fg},b.prototype.isBold=function(){return 134217728&this.fg},b.prototype.isUnderline=function(){return 268435456&this.fg},b.prototype.isBlink=function(){return 536870912&this.fg},b.prototype.isInvisible=function(){return 1073741824&this.fg},b.prototype.isItalic=function(){return 67108864&this.bg},b.prototype.isDim=function(){return 134217728&this.bg},b.prototype.isStrikethrough=function(){return 2147483648&this.fg},b.prototype.getFgColorMode=function(){return 50331648&this.fg},b.prototype.getBgColorMode=function(){return 50331648&this.bg},b.prototype.isFgRGB=function(){return(50331648&this.fg)==50331648},b.prototype.isBgRGB=function(){return(50331648&this.bg)==50331648},b.prototype.isFgPalette=function(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432},b.prototype.isBgPalette=function(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432},b.prototype.isFgDefault=function(){return(50331648&this.fg)==0},b.prototype.isBgDefault=function(){return(50331648&this.bg)==0},b.prototype.isAttributeDefault=function(){return this.fg===0&&this.bg===0},b.prototype.getFgColor=function(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}},b.prototype.getBgColor=function(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}},b.prototype.hasExtendedAttrs=function(){return 268435456&this.bg},b.prototype.updateExtended=function(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456},b.prototype.getUnderlineColor=function(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()},b.prototype.getUnderlineColorMode=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()},b.prototype.isUnderlineColorRGB=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()},b.prototype.isUnderlineColorPalette=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()},b.prototype.isUnderlineColorDefault=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()},b.prototype.getUnderlineStyle=function(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0},b}();E.AttributeData=L;var O=function(){function b(w,g){w===void 0&&(w=0),g===void 0&&(g=-1),this.underlineStyle=w,this.underlineColor=g}return b.prototype.clone=function(){return new b(this.underlineStyle,this.underlineColor)},b.prototype.isEmpty=function(){return this.underlineStyle===0},b}();E.ExtendedAttrs=O},9092:(P,E,L)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.BufferStringIterator=E.Buffer=E.MAX_BUFFER_SIZE=void 0;var O=L(6349),b=L(8437),w=L(511),g=L(643),D=L(4634),T=L(4863),f=L(7116),p=L(3734);E.MAX_BUFFER_SIZE=4294967295;var _=function(){function o(s,a,u){this._hasScrollback=s,this._optionsService=a,this._bufferService=u,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.savedY=0,this.savedX=0,this.savedCurAttrData=b.DEFAULT_ATTR_DATA.clone(),this.savedCharset=f.DEFAULT_CHARSET,this.markers=[],this._nullCell=w.CellData.fromCharData([0,g.NULL_CELL_CHAR,g.NULL_CELL_WIDTH,g.NULL_CELL_CODE]),this._whitespaceCell=w.CellData.fromCharData([0,g.WHITESPACE_CELL_CHAR,g.WHITESPACE_CELL_WIDTH,g.WHITESPACE_CELL_CODE]),this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new O.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}return o.prototype.getNullCell=function(s){return s?(this._nullCell.fg=s.fg,this._nullCell.bg=s.bg,this._nullCell.extended=s.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new p.ExtendedAttrs),this._nullCell},o.prototype.getWhitespaceCell=function(s){return s?(this._whitespaceCell.fg=s.fg,this._whitespaceCell.bg=s.bg,this._whitespaceCell.extended=s.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new p.ExtendedAttrs),this._whitespaceCell},o.prototype.getBlankLine=function(s,a){return new b.BufferLine(this._bufferService.cols,this.getNullCell(s),a)},Object.defineProperty(o.prototype,"hasScrollback",{get:function(){return this._hasScrollback&&this.lines.maxLength>this._rows},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"isCursorInViewport",{get:function(){var s=this.ybase+this.y-this.ydisp;return s>=0&&s<this._rows},enumerable:!1,configurable:!0}),o.prototype._getCorrectBufferLength=function(s){if(!this._hasScrollback)return s;var a=s+this._optionsService.options.scrollback;return a>E.MAX_BUFFER_SIZE?E.MAX_BUFFER_SIZE:a},o.prototype.fillViewportRows=function(s){if(this.lines.length===0){s===void 0&&(s=b.DEFAULT_ATTR_DATA);for(var a=this._rows;a--;)this.lines.push(this.getBlankLine(s))}},o.prototype.clear=function(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new O.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()},o.prototype.resize=function(s,a){var u=this.getNullCell(b.DEFAULT_ATTR_DATA),l=this._getCorrectBufferLength(a);if(l>this.lines.maxLength&&(this.lines.maxLength=l),this.lines.length>0){if(this._cols<s)for(var A=0;A<this.lines.length;A++)this.lines.get(A).resize(s,u);var I=0;if(this._rows<a)for(var R=this._rows;R<a;R++)this.lines.length<a+this.ybase&&(this._optionsService.options.windowsMode?this.lines.push(new b.BufferLine(s,u)):this.ybase>0&&this.lines.length<=this.ybase+this.y+I+1?(this.ybase--,I++,this.ydisp>0&&this.ydisp--):this.lines.push(new b.BufferLine(s,u)));else for(R=this._rows;R>a;R--)this.lines.length>a+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(l<this.lines.maxLength){var y=this.lines.length-l;y>0&&(this.lines.trimStart(y),this.ybase=Math.max(this.ybase-y,0),this.ydisp=Math.max(this.ydisp-y,0),this.savedY=Math.max(this.savedY-y,0)),this.lines.maxLength=l}this.x=Math.min(this.x,s-1),this.y=Math.min(this.y,a-1),I&&(this.y+=I),this.savedX=Math.min(this.savedX,s-1),this.scrollTop=0}if(this.scrollBottom=a-1,this._isReflowEnabled&&(this._reflow(s,a),this._cols>s))for(A=0;A<this.lines.length;A++)this.lines.get(A).resize(s,u);this._cols=s,this._rows=a},Object.defineProperty(o.prototype,"_isReflowEnabled",{get:function(){return this._hasScrollback&&!this._optionsService.options.windowsMode},enumerable:!1,configurable:!0}),o.prototype._reflow=function(s,a){this._cols!==s&&(s>this._cols?this._reflowLarger(s,a):this._reflowSmaller(s,a))},o.prototype._reflowLarger=function(s,a){var u=(0,D.reflowLargerGetLinesToRemove)(this.lines,this._cols,s,this.ybase+this.y,this.getNullCell(b.DEFAULT_ATTR_DATA));if(u.length>0){var l=(0,D.reflowLargerCreateNewLayout)(this.lines,u);(0,D.reflowLargerApplyNewLayout)(this.lines,l.layout),this._reflowLargerAdjustViewport(s,a,l.countRemoved)}},o.prototype._reflowLargerAdjustViewport=function(s,a,u){for(var l=this.getNullCell(b.DEFAULT_ATTR_DATA),A=u;A-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<a&&this.lines.push(new b.BufferLine(s,l))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-u,0)},o.prototype._reflowSmaller=function(s,a){for(var u=this.getNullCell(b.DEFAULT_ATTR_DATA),l=[],A=0,I=this.lines.length-1;I>=0;I--){var R=this.lines.get(I);if(!(!R||!R.isWrapped&&R.getTrimmedLength()<=s)){for(var y=[R];R.isWrapped&&I>0;)R=this.lines.get(--I),y.unshift(R);var v=this.ybase+this.y;if(!(v>=I&&v<I+y.length)){var m,S=y[y.length-1].getTrimmedLength(),B=(0,D.reflowSmallerGetNewLineLengths)(y,this._cols,s),N=B.length-y.length;m=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+N):Math.max(0,this.lines.length-this.lines.maxLength+N);for(var M=[],U=0;U<N;U++){var K=this.getBlankLine(b.DEFAULT_ATTR_DATA,!0);M.push(K)}M.length>0&&(l.push({start:I+y.length+A,newLines:M}),A+=M.length),y.push.apply(y,M);var j=B.length-1,X=B[j];X===0&&(X=B[--j]);for(var ie=y.length-N-1,se=S;ie>=0;){var le=Math.min(se,X);if(y[j].copyCellsFrom(y[ie],se-le,X-le,le,!0),(X-=le)==0&&(X=B[--j]),(se-=le)==0){ie--;var ve=Math.max(ie,0);se=(0,D.getWrappedLineTrimmedLength)(y,ve,this._cols)}}for(U=0;U<y.length;U++)B[U]<s&&y[U].setCell(B[U],u);for(var q=N-m;q-- >0;)this.ybase===0?this.y<a-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+A)-a&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+N,this.ybase+a-1)}}}if(l.length>0){var ee=[],ae=[];for(U=0;U<this.lines.length;U++)ae.push(this.lines.get(U));var _e=this.lines.length,fe=_e-1,Ge=0,Te=l[Ge];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+A);var Ue=0;for(U=Math.min(this.lines.maxLength-1,_e+A-1);U>=0;U--)if(Te&&Te.start>fe+Ue){for(var Ze=Te.newLines.length-1;Ze>=0;Ze--)this.lines.set(U--,Te.newLines[Ze]);U++,ee.push({index:fe+1,amount:Te.newLines.length}),Ue+=Te.newLines.length,Te=l[++Ge]}else this.lines.set(U,ae[fe--]);var ut=0;for(U=ee.length-1;U>=0;U--)ee[U].index+=ut,this.lines.onInsertEmitter.fire(ee[U]),ut+=ee[U].amount;var Fe=Math.max(0,_e+A-this.lines.maxLength);Fe>0&&this.lines.onTrimEmitter.fire(Fe)}},o.prototype.stringIndexToBufferIndex=function(s,a,u){for(u===void 0&&(u=!1);a;){var l=this.lines.get(s);if(!l)return[-1,-1];for(var A=u?l.getTrimmedLength():l.length,I=0;I<A;++I)if(l.get(I)[g.CHAR_DATA_WIDTH_INDEX]&&(a-=l.get(I)[g.CHAR_DATA_CHAR_INDEX].length||1),a<0)return[s,I];s++}return[s,0]},o.prototype.translateBufferLineToString=function(s,a,u,l){u===void 0&&(u=0);var A=this.lines.get(s);return A?A.translateToString(a,u,l):""},o.prototype.getWrappedRangeForLine=function(s){for(var a=s,u=s;a>0&&this.lines.get(a).isWrapped;)a--;for(;u+1<this.lines.length&&this.lines.get(u+1).isWrapped;)u++;return{first:a,last:u}},o.prototype.setupTabStops=function(s){for(s!=null?this.tabs[s]||(s=this.prevStop(s)):(this.tabs={},s=0);s<this._cols;s+=this._optionsService.options.tabStopWidth)this.tabs[s]=!0},o.prototype.prevStop=function(s){for(s==null&&(s=this.x);!this.tabs[--s]&&s>0;);return s>=this._cols?this._cols-1:s<0?0:s},o.prototype.nextStop=function(s){for(s==null&&(s=this.x);!this.tabs[++s]&&s<this._cols;);return s>=this._cols?this._cols-1:s<0?0:s},o.prototype.addMarker=function(s){var a=this,u=new T.Marker(s);return this.markers.push(u),u.register(this.lines.onTrim(function(l){u.line-=l,u.line<0&&u.dispose()})),u.register(this.lines.onInsert(function(l){u.line>=l.index&&(u.line+=l.amount)})),u.register(this.lines.onDelete(function(l){u.line>=l.index&&u.line<l.index+l.amount&&u.dispose(),u.line>l.index&&(u.line-=l.amount)})),u.register(u.onDispose(function(){return a._removeMarker(u)})),u},o.prototype._removeMarker=function(s){this.markers.splice(this.markers.indexOf(s),1)},o.prototype.iterator=function(s,a,u,l,A){return new d(this,s,a,u,l,A)},o}();E.Buffer=_;var d=function(){function o(s,a,u,l,A,I){u===void 0&&(u=0),l===void 0&&(l=s.lines.length),A===void 0&&(A=0),I===void 0&&(I=0),this._buffer=s,this._trimRight=a,this._startIndex=u,this._endIndex=l,this._startOverscan=A,this._endOverscan=I,this._startIndex<0&&(this._startIndex=0),this._endIndex>this._buffer.lines.length&&(this._endIndex=this._buffer.lines.length),this._current=this._startIndex}return o.prototype.hasNext=function(){return this._current<this._endIndex},o.prototype.next=function(){var s=this._buffer.getWrappedRangeForLine(this._current);s.first<this._startIndex-this._startOverscan&&(s.first=this._startIndex-this._startOverscan),s.last>this._endIndex+this._endOverscan&&(s.last=this._endIndex+this._endOverscan),s.first=Math.max(s.first,0),s.last=Math.min(s.last,this._buffer.lines.length);for(var a="",u=s.first;u<=s.last;++u)a+=this._buffer.translateBufferLineToString(u,this._trimRight);return this._current=s.last+1,{range:s,content:a}},o}();E.BufferStringIterator=d},8437:(P,E,L)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.BufferLine=E.DEFAULT_ATTR_DATA=void 0;var O=L(482),b=L(643),w=L(511),g=L(3734);E.DEFAULT_ATTR_DATA=Object.freeze(new g.AttributeData);var D=function(){function T(f,p,_){_===void 0&&(_=!1),this.isWrapped=_,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*f);for(var d=p||w.CellData.fromCharData([0,b.NULL_CELL_CHAR,b.NULL_CELL_WIDTH,b.NULL_CELL_CODE]),o=0;o<f;++o)this.setCell(o,d);this.length=f}return T.prototype.get=function(f){var p=this._data[3*f+0],_=2097151&p;return[this._data[3*f+1],2097152&p?this._combined[f]:_?(0,O.stringFromCodePoint)(_):"",p>>22,2097152&p?this._combined[f].charCodeAt(this._combined[f].length-1):_]},T.prototype.set=function(f,p){this._data[3*f+1]=p[b.CHAR_DATA_ATTR_INDEX],p[b.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[f]=p[1],this._data[3*f+0]=2097152|f|p[b.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*f+0]=p[b.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|p[b.CHAR_DATA_WIDTH_INDEX]<<22},T.prototype.getWidth=function(f){return this._data[3*f+0]>>22},T.prototype.hasWidth=function(f){return 12582912&this._data[3*f+0]},T.prototype.getFg=function(f){return this._data[3*f+1]},T.prototype.getBg=function(f){return this._data[3*f+2]},T.prototype.hasContent=function(f){return 4194303&this._data[3*f+0]},T.prototype.getCodePoint=function(f){var p=this._data[3*f+0];return 2097152&p?this._combined[f].charCodeAt(this._combined[f].length-1):2097151&p},T.prototype.isCombined=function(f){return 2097152&this._data[3*f+0]},T.prototype.getString=function(f){var p=this._data[3*f+0];return 2097152&p?this._combined[f]:2097151&p?(0,O.stringFromCodePoint)(2097151&p):""},T.prototype.loadCell=function(f,p){var _=3*f;return p.content=this._data[_+0],p.fg=this._data[_+1],p.bg=this._data[_+2],2097152&p.content&&(p.combinedData=this._combined[f]),268435456&p.bg&&(p.extended=this._extendedAttrs[f]),p},T.prototype.setCell=function(f,p){2097152&p.content&&(this._combined[f]=p.combinedData),268435456&p.bg&&(this._extendedAttrs[f]=p.extended),this._data[3*f+0]=p.content,this._data[3*f+1]=p.fg,this._data[3*f+2]=p.bg},T.prototype.setCellFromCodePoint=function(f,p,_,d,o,s){268435456&o&&(this._extendedAttrs[f]=s),this._data[3*f+0]=p|_<<22,this._data[3*f+1]=d,this._data[3*f+2]=o},T.prototype.addCodepointToCell=function(f,p){var _=this._data[3*f+0];2097152&_?this._combined[f]+=(0,O.stringFromCodePoint)(p):(2097151&_?(this._combined[f]=(0,O.stringFromCodePoint)(2097151&_)+(0,O.stringFromCodePoint)(p),_&=-2097152,_|=2097152):_=p|1<<22,this._data[3*f+0]=_)},T.prototype.insertCells=function(f,p,_,d){if((f%=this.length)&&this.getWidth(f-1)===2&&this.setCellFromCodePoint(f-1,0,1,(d==null?void 0:d.fg)||0,(d==null?void 0:d.bg)||0,(d==null?void 0:d.extended)||new g.ExtendedAttrs),p<this.length-f){for(var o=new w.CellData,s=this.length-f-p-1;s>=0;--s)this.setCell(f+p+s,this.loadCell(f+s,o));for(s=0;s<p;++s)this.setCell(f+s,_)}else for(s=f;s<this.length;++s)this.setCell(s,_);this.getWidth(this.length-1)===2&&this.setCellFromCodePoint(this.length-1,0,1,(d==null?void 0:d.fg)||0,(d==null?void 0:d.bg)||0,(d==null?void 0:d.extended)||new g.ExtendedAttrs)},T.prototype.deleteCells=function(f,p,_,d){if(f%=this.length,p<this.length-f){for(var o=new w.CellData,s=0;s<this.length-f-p;++s)this.setCell(f+s,this.loadCell(f+p+s,o));for(s=this.length-p;s<this.length;++s)this.setCell(s,_)}else for(s=f;s<this.length;++s)this.setCell(s,_);f&&this.getWidth(f-1)===2&&this.setCellFromCodePoint(f-1,0,1,(d==null?void 0:d.fg)||0,(d==null?void 0:d.bg)||0,(d==null?void 0:d.extended)||new g.ExtendedAttrs),this.getWidth(f)!==0||this.hasContent(f)||this.setCellFromCodePoint(f,0,1,(d==null?void 0:d.fg)||0,(d==null?void 0:d.bg)||0,(d==null?void 0:d.extended)||new g.ExtendedAttrs)},T.prototype.replaceCells=function(f,p,_,d){for(f&&this.getWidth(f-1)===2&&this.setCellFromCodePoint(f-1,0,1,(d==null?void 0:d.fg)||0,(d==null?void 0:d.bg)||0,(d==null?void 0:d.extended)||new g.ExtendedAttrs),p<this.length&&this.getWidth(p-1)===2&&this.setCellFromCodePoint(p,0,1,(d==null?void 0:d.fg)||0,(d==null?void 0:d.bg)||0,(d==null?void 0:d.extended)||new g.ExtendedAttrs);f<p&&f<this.length;)this.setCell(f++,_)},T.prototype.resize=function(f,p){if(f!==this.length){if(f>this.length){var _=new Uint32Array(3*f);this.length&&(3*f<this._data.length?_.set(this._data.subarray(0,3*f)):_.set(this._data)),this._data=_;for(var d=this.length;d<f;++d)this.setCell(d,p)}else if(f){(_=new Uint32Array(3*f)).set(this._data.subarray(0,3*f)),this._data=_;var o=Object.keys(this._combined);for(d=0;d<o.length;d++){var s=parseInt(o[d],10);s>=f&&delete this._combined[s]}}else this._data=new Uint32Array(0),this._combined={};this.length=f}},T.prototype.fill=function(f){this._combined={},this._extendedAttrs={};for(var p=0;p<this.length;++p)this.setCell(p,f)},T.prototype.copyFrom=function(f){for(var p in this.length!==f.length?this._data=new Uint32Array(f._data):this._data.set(f._data),this.length=f.length,this._combined={},f._combined)this._combined[p]=f._combined[p];for(var p in this._extendedAttrs={},f._extendedAttrs)this._extendedAttrs[p]=f._extendedAttrs[p];this.isWrapped=f.isWrapped},T.prototype.clone=function(){var f=new T(0);for(var p in f._data=new Uint32Array(this._data),f.length=this.length,this._combined)f._combined[p]=this._combined[p];for(var p in this._extendedAttrs)f._extendedAttrs[p]=this._extendedAttrs[p];return f.isWrapped=this.isWrapped,f},T.prototype.getTrimmedLength=function(){for(var f=this.length-1;f>=0;--f)if(4194303&this._data[3*f+0])return f+(this._data[3*f+0]>>22);return 0},T.prototype.copyCellsFrom=function(f,p,_,d,o){var s=f._data;if(o)for(var a=d-1;a>=0;a--)for(var u=0;u<3;u++)this._data[3*(_+a)+u]=s[3*(p+a)+u];else for(a=0;a<d;a++)for(u=0;u<3;u++)this._data[3*(_+a)+u]=s[3*(p+a)+u];var l=Object.keys(f._combined);for(u=0;u<l.length;u++){var A=parseInt(l[u],10);A>=p&&(this._combined[A-p+_]=f._combined[A])}},T.prototype.translateToString=function(f,p,_){f===void 0&&(f=!1),p===void 0&&(p=0),_===void 0&&(_=this.length),f&&(_=Math.min(_,this.getTrimmedLength()));for(var d="";p<_;){var o=this._data[3*p+0],s=2097151&o;d+=2097152&o?this._combined[p]:s?(0,O.stringFromCodePoint)(s):b.WHITESPACE_CELL_CHAR,p+=o>>22||1}return d},T}();E.BufferLine=D},4841:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.getRangeLength=void 0,E.getRangeLength=function(L,O){if(L.start.y>L.end.y)throw new Error("Buffer range end ("+L.end.x+", "+L.end.y+") cannot be before start ("+L.start.x+", "+L.start.y+")");return O*(L.end.y-L.start.y)+(L.end.x-L.start.x+1)}},4634:(P,E)=>{function L(O,b,w){if(b===O.length-1)return O[b].getTrimmedLength();var g=!O[b].hasContent(w-1)&&O[b].getWidth(w-1)===1,D=O[b+1].getWidth(0)===2;return g&&D?w-1:w}Object.defineProperty(E,"__esModule",{value:!0}),E.getWrappedLineTrimmedLength=E.reflowSmallerGetNewLineLengths=E.reflowLargerApplyNewLayout=E.reflowLargerCreateNewLayout=E.reflowLargerGetLinesToRemove=void 0,E.reflowLargerGetLinesToRemove=function(O,b,w,g,D){for(var T=[],f=0;f<O.length-1;f++){var p=f,_=O.get(++p);if(_.isWrapped){for(var d=[O.get(f)];p<O.length&&_.isWrapped;)d.push(_),_=O.get(++p);if(g>=f&&g<p)f+=d.length-1;else{for(var o=0,s=L(d,o,b),a=1,u=0;a<d.length;){var l=L(d,a,b),A=l-u,I=w-s,R=Math.min(A,I);d[o].copyCellsFrom(d[a],u,s,R,!1),(s+=R)===w&&(o++,s=0),(u+=R)===l&&(a++,u=0),s===0&&o!==0&&d[o-1].getWidth(w-1)===2&&(d[o].copyCellsFrom(d[o-1],w-1,s++,1,!1),d[o-1].setCell(w-1,D))}d[o].replaceCells(s,w,D);for(var y=0,v=d.length-1;v>0&&(v>o||d[v].getTrimmedLength()===0);v--)y++;y>0&&(T.push(f+d.length-y),T.push(y)),f+=d.length-1}}}return T},E.reflowLargerCreateNewLayout=function(O,b){for(var w=[],g=0,D=b[g],T=0,f=0;f<O.length;f++)if(D===f){var p=b[++g];O.onDeleteEmitter.fire({index:f-T,amount:p}),f+=p-1,T+=p,D=b[++g]}else w.push(f);return{layout:w,countRemoved:T}},E.reflowLargerApplyNewLayout=function(O,b){for(var w=[],g=0;g<b.length;g++)w.push(O.get(b[g]));for(g=0;g<w.length;g++)O.set(g,w[g]);O.length=b.length},E.reflowSmallerGetNewLineLengths=function(O,b,w){for(var g=[],D=O.map(function(s,a){return L(O,a,b)}).reduce(function(s,a){return s+a}),T=0,f=0,p=0;p<D;){if(D-p<w){g.push(D-p);break}T+=w;var _=L(O,f,b);T>_&&(T-=_,f++);var d=O[f].getWidth(T-1)===2;d&&T--;var o=d?w-1:w;g.push(o),p+=o}return g},E.getWrappedLineTrimmedLength=L},5295:function(P,E,L){var O,b=this&&this.__extends||(O=function(T,f){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,_){p.__proto__=_}||function(p,_){for(var d in _)Object.prototype.hasOwnProperty.call(_,d)&&(p[d]=_[d])},O(T,f)},function(T,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");function p(){this.constructor=T}O(T,f),T.prototype=f===null?Object.create(f):(p.prototype=f.prototype,new p)});Object.defineProperty(E,"__esModule",{value:!0}),E.BufferSet=void 0;var w=L(9092),g=L(8460),D=function(T){function f(p,_){var d=T.call(this)||this;return d._optionsService=p,d._bufferService=_,d._onBufferActivate=d.register(new g.EventEmitter),d.reset(),d}return b(f,T),Object.defineProperty(f.prototype,"onBufferActivate",{get:function(){return this._onBufferActivate.event},enumerable:!1,configurable:!0}),f.prototype.reset=function(){this._normal=new w.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new w.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()},Object.defineProperty(f.prototype,"alt",{get:function(){return this._alt},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"active",{get:function(){return this._activeBuffer},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"normal",{get:function(){return this._normal},enumerable:!1,configurable:!0}),f.prototype.activateNormalBuffer=function(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))},f.prototype.activateAltBuffer=function(p){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(p),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))},f.prototype.resize=function(p,_){this._normal.resize(p,_),this._alt.resize(p,_)},f.prototype.setupTabStops=function(p){this._normal.setupTabStops(p),this._alt.setupTabStops(p)},f}(L(844).Disposable);E.BufferSet=D},511:function(P,E,L){var O,b=this&&this.__extends||(O=function(f,p){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,d){_.__proto__=d}||function(_,d){for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(_[o]=d[o])},O(f,p)},function(f,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");function _(){this.constructor=f}O(f,p),f.prototype=p===null?Object.create(p):(_.prototype=p.prototype,new _)});Object.defineProperty(E,"__esModule",{value:!0}),E.CellData=void 0;var w=L(482),g=L(643),D=L(3734),T=function(f){function p(){var _=f!==null&&f.apply(this,arguments)||this;return _.content=0,_.fg=0,_.bg=0,_.extended=new D.ExtendedAttrs,_.combinedData="",_}return b(p,f),p.fromCharData=function(_){var d=new p;return d.setFromCharData(_),d},p.prototype.isCombined=function(){return 2097152&this.content},p.prototype.getWidth=function(){return this.content>>22},p.prototype.getChars=function(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,w.stringFromCodePoint)(2097151&this.content):""},p.prototype.getCode=function(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content},p.prototype.setFromCharData=function(_){this.fg=_[g.CHAR_DATA_ATTR_INDEX],this.bg=0;var d=!1;if(_[g.CHAR_DATA_CHAR_INDEX].length>2)d=!0;else if(_[g.CHAR_DATA_CHAR_INDEX].length===2){var o=_[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=o&&o<=56319){var s=_[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(o-55296)+s-56320+65536|_[g.CHAR_DATA_WIDTH_INDEX]<<22:d=!0}else d=!0}else this.content=_[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|_[g.CHAR_DATA_WIDTH_INDEX]<<22;d&&(this.combinedData=_[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|_[g.CHAR_DATA_WIDTH_INDEX]<<22)},p.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},p}(D.AttributeData);E.CellData=T},643:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.WHITESPACE_CELL_CODE=E.WHITESPACE_CELL_WIDTH=E.WHITESPACE_CELL_CHAR=E.NULL_CELL_CODE=E.NULL_CELL_WIDTH=E.NULL_CELL_CHAR=E.CHAR_DATA_CODE_INDEX=E.CHAR_DATA_WIDTH_INDEX=E.CHAR_DATA_CHAR_INDEX=E.CHAR_DATA_ATTR_INDEX=E.DEFAULT_ATTR=E.DEFAULT_COLOR=void 0,E.DEFAULT_COLOR=256,E.DEFAULT_ATTR=256|E.DEFAULT_COLOR<<9,E.CHAR_DATA_ATTR_INDEX=0,E.CHAR_DATA_CHAR_INDEX=1,E.CHAR_DATA_WIDTH_INDEX=2,E.CHAR_DATA_CODE_INDEX=3,E.NULL_CELL_CHAR="",E.NULL_CELL_WIDTH=1,E.NULL_CELL_CODE=0,E.WHITESPACE_CELL_CHAR=" ",E.WHITESPACE_CELL_WIDTH=1,E.WHITESPACE_CELL_CODE=32},4863:function(P,E,L){var O,b=this&&this.__extends||(O=function(D,T){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,p){f.__proto__=p}||function(f,p){for(var _ in p)Object.prototype.hasOwnProperty.call(p,_)&&(f[_]=p[_])},O(D,T)},function(D,T){if(typeof T!="function"&&T!==null)throw new TypeError("Class extends value "+String(T)+" is not a constructor or null");function f(){this.constructor=D}O(D,T),D.prototype=T===null?Object.create(T):(f.prototype=T.prototype,new f)});Object.defineProperty(E,"__esModule",{value:!0}),E.Marker=void 0;var w=L(8460),g=function(D){function T(f){var p=D.call(this)||this;return p.line=f,p._id=T._nextId++,p.isDisposed=!1,p._onDispose=new w.EventEmitter,p}return b(T,D),Object.defineProperty(T.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onDispose",{get:function(){return this._onDispose.event},enumerable:!1,configurable:!0}),T.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),D.prototype.dispose.call(this))},T._nextId=1,T}(L(844).Disposable);E.Marker=g},7116:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.DEFAULT_CHARSET=E.CHARSETS=void 0,E.CHARSETS={},E.DEFAULT_CHARSET=E.CHARSETS.B,E.CHARSETS[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"},E.CHARSETS.A={"#":"\xA3"},E.CHARSETS.B=void 0,E.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},E.CHARSETS.C=E.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},E.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},E.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},E.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},E.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},E.CHARSETS.E=E.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},E.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},E.CHARSETS.H=E.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},E.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},2584:(P,E)=>{var L,O;Object.defineProperty(E,"__esModule",{value:!0}),E.C1=E.C0=void 0,(O=E.C0||(E.C0={})).NUL="\0",O.SOH="",O.STX="",O.ETX="",O.EOT="",O.ENQ="",O.ACK="",O.BEL="\x07",O.BS="\b",O.HT=" ",O.LF=`
170
- `,O.VT="\v",O.FF="\f",O.CR="\r",O.SO="",O.SI="",O.DLE="",O.DC1="",O.DC2="",O.DC3="",O.DC4="",O.NAK="",O.SYN="",O.ETB="",O.CAN="",O.EM="",O.SUB="",O.ESC="",O.FS="",O.GS="",O.RS="",O.US="",O.SP=" ",O.DEL="\x7F",(L=E.C1||(E.C1={})).PAD="\x80",L.HOP="\x81",L.BPH="\x82",L.NBH="\x83",L.IND="\x84",L.NEL="\x85",L.SSA="\x86",L.ESA="\x87",L.HTS="\x88",L.HTJ="\x89",L.VTS="\x8A",L.PLD="\x8B",L.PLU="\x8C",L.RI="\x8D",L.SS2="\x8E",L.SS3="\x8F",L.DCS="\x90",L.PU1="\x91",L.PU2="\x92",L.STS="\x93",L.CCH="\x94",L.MW="\x95",L.SPA="\x96",L.EPA="\x97",L.SOS="\x98",L.SGCI="\x99",L.SCI="\x9A",L.CSI="\x9B",L.ST="\x9C",L.OSC="\x9D",L.PM="\x9E",L.APC="\x9F"},7399:(P,E,L)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.evaluateKeyboardEvent=void 0;var O=L(2584),b={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};E.evaluateKeyboardEvent=function(w,g,D,T){var f={type:0,cancel:!1,key:void 0},p=(w.shiftKey?1:0)|(w.altKey?2:0)|(w.ctrlKey?4:0)|(w.metaKey?8:0);switch(w.keyCode){case 0:w.key==="UIKeyInputUpArrow"?f.key=g?O.C0.ESC+"OA":O.C0.ESC+"[A":w.key==="UIKeyInputLeftArrow"?f.key=g?O.C0.ESC+"OD":O.C0.ESC+"[D":w.key==="UIKeyInputRightArrow"?f.key=g?O.C0.ESC+"OC":O.C0.ESC+"[C":w.key==="UIKeyInputDownArrow"&&(f.key=g?O.C0.ESC+"OB":O.C0.ESC+"[B");break;case 8:if(w.shiftKey){f.key=O.C0.BS;break}if(w.altKey){f.key=O.C0.ESC+O.C0.DEL;break}f.key=O.C0.DEL;break;case 9:if(w.shiftKey){f.key=O.C0.ESC+"[Z";break}f.key=O.C0.HT,f.cancel=!0;break;case 13:f.key=w.altKey?O.C0.ESC+O.C0.CR:O.C0.CR,f.cancel=!0;break;case 27:f.key=O.C0.ESC,w.altKey&&(f.key=O.C0.ESC+O.C0.ESC),f.cancel=!0;break;case 37:if(w.metaKey)break;p?(f.key=O.C0.ESC+"[1;"+(p+1)+"D",f.key===O.C0.ESC+"[1;3D"&&(f.key=O.C0.ESC+(D?"b":"[1;5D"))):f.key=g?O.C0.ESC+"OD":O.C0.ESC+"[D";break;case 39:if(w.metaKey)break;p?(f.key=O.C0.ESC+"[1;"+(p+1)+"C",f.key===O.C0.ESC+"[1;3C"&&(f.key=O.C0.ESC+(D?"f":"[1;5C"))):f.key=g?O.C0.ESC+"OC":O.C0.ESC+"[C";break;case 38:if(w.metaKey)break;p?(f.key=O.C0.ESC+"[1;"+(p+1)+"A",D||f.key!==O.C0.ESC+"[1;3A"||(f.key=O.C0.ESC+"[1;5A")):f.key=g?O.C0.ESC+"OA":O.C0.ESC+"[A";break;case 40:if(w.metaKey)break;p?(f.key=O.C0.ESC+"[1;"+(p+1)+"B",D||f.key!==O.C0.ESC+"[1;3B"||(f.key=O.C0.ESC+"[1;5B")):f.key=g?O.C0.ESC+"OB":O.C0.ESC+"[B";break;case 45:w.shiftKey||w.ctrlKey||(f.key=O.C0.ESC+"[2~");break;case 46:f.key=p?O.C0.ESC+"[3;"+(p+1)+"~":O.C0.ESC+"[3~";break;case 36:f.key=p?O.C0.ESC+"[1;"+(p+1)+"H":g?O.C0.ESC+"OH":O.C0.ESC+"[H";break;case 35:f.key=p?O.C0.ESC+"[1;"+(p+1)+"F":g?O.C0.ESC+"OF":O.C0.ESC+"[F";break;case 33:w.shiftKey?f.type=2:f.key=O.C0.ESC+"[5~";break;case 34:w.shiftKey?f.type=3:f.key=O.C0.ESC+"[6~";break;case 112:f.key=p?O.C0.ESC+"[1;"+(p+1)+"P":O.C0.ESC+"OP";break;case 113:f.key=p?O.C0.ESC+"[1;"+(p+1)+"Q":O.C0.ESC+"OQ";break;case 114:f.key=p?O.C0.ESC+"[1;"+(p+1)+"R":O.C0.ESC+"OR";break;case 115:f.key=p?O.C0.ESC+"[1;"+(p+1)+"S":O.C0.ESC+"OS";break;case 116:f.key=p?O.C0.ESC+"[15;"+(p+1)+"~":O.C0.ESC+"[15~";break;case 117:f.key=p?O.C0.ESC+"[17;"+(p+1)+"~":O.C0.ESC+"[17~";break;case 118:f.key=p?O.C0.ESC+"[18;"+(p+1)+"~":O.C0.ESC+"[18~";break;case 119:f.key=p?O.C0.ESC+"[19;"+(p+1)+"~":O.C0.ESC+"[19~";break;case 120:f.key=p?O.C0.ESC+"[20;"+(p+1)+"~":O.C0.ESC+"[20~";break;case 121:f.key=p?O.C0.ESC+"[21;"+(p+1)+"~":O.C0.ESC+"[21~";break;case 122:f.key=p?O.C0.ESC+"[23;"+(p+1)+"~":O.C0.ESC+"[23~";break;case 123:f.key=p?O.C0.ESC+"[24;"+(p+1)+"~":O.C0.ESC+"[24~";break;default:if(!w.ctrlKey||w.shiftKey||w.altKey||w.metaKey)if(D&&!T||!w.altKey||w.metaKey)!D||w.altKey||w.ctrlKey||w.shiftKey||!w.metaKey?w.key&&!w.ctrlKey&&!w.altKey&&!w.metaKey&&w.keyCode>=48&&w.key.length===1?f.key=w.key:w.key&&w.ctrlKey&&w.key==="_"&&(f.key=O.C0.US):w.keyCode===65&&(f.type=1);else{var _=b[w.keyCode],d=_&&_[w.shiftKey?1:0];if(d)f.key=O.C0.ESC+d;else if(w.keyCode>=65&&w.keyCode<=90){var o=w.ctrlKey?w.keyCode-64:w.keyCode+32;f.key=O.C0.ESC+String.fromCharCode(o)}}else w.keyCode>=65&&w.keyCode<=90?f.key=String.fromCharCode(w.keyCode-64):w.keyCode===32?f.key=O.C0.NUL:w.keyCode>=51&&w.keyCode<=55?f.key=String.fromCharCode(w.keyCode-51+27):w.keyCode===56?f.key=O.C0.DEL:w.keyCode===219?f.key=O.C0.ESC:w.keyCode===220?f.key=O.C0.FS:w.keyCode===221&&(f.key=O.C0.GS)}return f}},482:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.Utf8ToUtf32=E.StringToUtf32=E.utf32ToString=E.stringFromCodePoint=void 0,E.stringFromCodePoint=function(b){return b>65535?(b-=65536,String.fromCharCode(55296+(b>>10))+String.fromCharCode(b%1024+56320)):String.fromCharCode(b)},E.utf32ToString=function(b,w,g){w===void 0&&(w=0),g===void 0&&(g=b.length);for(var D="",T=w;T<g;++T){var f=b[T];f>65535?(f-=65536,D+=String.fromCharCode(55296+(f>>10))+String.fromCharCode(f%1024+56320)):D+=String.fromCharCode(f)}return D};var L=function(){function b(){this._interim=0}return b.prototype.clear=function(){this._interim=0},b.prototype.decode=function(w,g){var D=w.length;if(!D)return 0;var T=0,f=0;this._interim&&(56320<=(d=w.charCodeAt(f++))&&d<=57343?g[T++]=1024*(this._interim-55296)+d-56320+65536:(g[T++]=this._interim,g[T++]=d),this._interim=0);for(var p=f;p<D;++p){var _=w.charCodeAt(p);if(55296<=_&&_<=56319){if(++p>=D)return this._interim=_,T;var d;56320<=(d=w.charCodeAt(p))&&d<=57343?g[T++]=1024*(_-55296)+d-56320+65536:(g[T++]=_,g[T++]=d)}else _!==65279&&(g[T++]=_)}return T},b}();E.StringToUtf32=L;var O=function(){function b(){this.interim=new Uint8Array(3)}return b.prototype.clear=function(){this.interim.fill(0)},b.prototype.decode=function(w,g){var D=w.length;if(!D)return 0;var T,f,p,_,d=0,o=0,s=0;if(this.interim[0]){var a=!1,u=this.interim[0];u&=(224&u)==192?31:(240&u)==224?15:7;for(var l=0,A=void 0;(A=63&this.interim[++l])&&l<4;)u<<=6,u|=A;for(var I=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,R=I-l;s<R;){if(s>=D)return 0;if((192&(A=w[s++]))!=128){s--,a=!0;break}this.interim[l++]=A,u<<=6,u|=63&A}a||(I===2?u<128?s--:g[d++]=u:I===3?u<2048||u>=55296&&u<=57343||u===65279||(g[d++]=u):u<65536||u>1114111||(g[d++]=u)),this.interim.fill(0)}for(var y=D-4,v=s;v<D;){for(;!(!(v<y)||128&(T=w[v])||128&(f=w[v+1])||128&(p=w[v+2])||128&(_=w[v+3]));)g[d++]=T,g[d++]=f,g[d++]=p,g[d++]=_,v+=4;if((T=w[v++])<128)g[d++]=T;else if((224&T)==192){if(v>=D)return this.interim[0]=T,d;if((192&(f=w[v++]))!=128){v--;continue}if((o=(31&T)<<6|63&f)<128){v--;continue}g[d++]=o}else if((240&T)==224){if(v>=D)return this.interim[0]=T,d;if((192&(f=w[v++]))!=128){v--;continue}if(v>=D)return this.interim[0]=T,this.interim[1]=f,d;if((192&(p=w[v++]))!=128){v--;continue}if((o=(15&T)<<12|(63&f)<<6|63&p)<2048||o>=55296&&o<=57343||o===65279)continue;g[d++]=o}else if((248&T)==240){if(v>=D)return this.interim[0]=T,d;if((192&(f=w[v++]))!=128){v--;continue}if(v>=D)return this.interim[0]=T,this.interim[1]=f,d;if((192&(p=w[v++]))!=128){v--;continue}if(v>=D)return this.interim[0]=T,this.interim[1]=f,this.interim[2]=p,d;if((192&(_=w[v++]))!=128){v--;continue}if((o=(7&T)<<18|(63&f)<<12|(63&p)<<6|63&_)<65536||o>1114111)continue;g[d++]=o}}return d},b}();E.Utf8ToUtf32=O},225:(P,E,L)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.UnicodeV6=void 0;var O,b=L(8273),w=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],g=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],D=function(){function T(){if(this.version="6",!O){O=new Uint8Array(65536),(0,b.fill)(O,1),O[0]=0,(0,b.fill)(O,0,1,32),(0,b.fill)(O,0,127,160),(0,b.fill)(O,2,4352,4448),O[9001]=2,O[9002]=2,(0,b.fill)(O,2,11904,42192),O[12351]=1,(0,b.fill)(O,2,44032,55204),(0,b.fill)(O,2,63744,64256),(0,b.fill)(O,2,65040,65050),(0,b.fill)(O,2,65072,65136),(0,b.fill)(O,2,65280,65377),(0,b.fill)(O,2,65504,65511);for(var f=0;f<w.length;++f)(0,b.fill)(O,0,w[f][0],w[f][1]+1)}}return T.prototype.wcwidth=function(f){return f<32?0:f<127?1:f<65536?O[f]:function(p,_){var d,o=0,s=_.length-1;if(p<_[0][0]||p>_[s][1])return!1;for(;s>=o;)if(p>_[d=o+s>>1][1])o=d+1;else{if(!(p<_[d][0]))return!0;s=d-1}return!1}(f,g)?0:f>=131072&&f<=196605||f>=196608&&f<=262141?2:1},T}();E.UnicodeV6=D},5981:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.WriteBuffer=void 0;var L=typeof queueMicrotask=="undefined"?function(b){Promise.resolve().then(b)}:queueMicrotask,O=function(){function b(w){this._action=w,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0}return b.prototype.writeSync=function(w,g){if(g!==void 0&&this._syncCalls>g)this._syncCalls=0;else if(this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(void 0),this._syncCalls++,!this._isSyncWriting){var D;for(this._isSyncWriting=!0;D=this._writeBuffer.shift();){this._action(D);var T=this._callbacks.shift();T&&T()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}},b.prototype.write=function(w,g){var D=this;if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");this._writeBuffer.length||(this._bufferOffset=0,setTimeout(function(){return D._innerWrite()})),this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(g)},b.prototype._innerWrite=function(w,g){var D=this;w===void 0&&(w=0),g===void 0&&(g=!0);for(var T=w||Date.now();this._writeBuffer.length>this._bufferOffset;){var f=this._writeBuffer[this._bufferOffset],p=this._action(f,g);if(p)return void p.catch(function(d){return L(function(){throw d}),Promise.resolve(!1)}).then(function(d){return Date.now()-T>=12?setTimeout(function(){return D._innerWrite(0,d)}):D._innerWrite(T,d)});var _=this._callbacks[this._bufferOffset];if(_&&_(),this._bufferOffset++,this._pendingData-=f.length,Date.now()-T>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(function(){return D._innerWrite()})):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0)},b}();E.WriteBuffer=O},5770:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.PAYLOAD_LIMIT=void 0,E.PAYLOAD_LIMIT=1e7},6351:(P,E,L)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.DcsHandler=E.DcsParser=void 0;var O=L(482),b=L(8742),w=L(5770),g=[],D=function(){function p(){this._handlers=Object.create(null),this._active=g,this._ident=0,this._handlerFb=function(){},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}return p.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){},this._active=g},p.prototype.registerHandler=function(_,d){this._handlers[_]===void 0&&(this._handlers[_]=[]);var o=this._handlers[_];return o.push(d),{dispose:function(){var s=o.indexOf(d);s!==-1&&o.splice(s,1)}}},p.prototype.clearHandler=function(_){this._handlers[_]&&delete this._handlers[_]},p.prototype.setHandlerFallback=function(_){this._handlerFb=_},p.prototype.reset=function(){if(this._active.length)for(var _=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;_>=0;--_)this._active[_].unhook(!1);this._stack.paused=!1,this._active=g,this._ident=0},p.prototype.hook=function(_,d){if(this.reset(),this._ident=_,this._active=this._handlers[_]||g,this._active.length)for(var o=this._active.length-1;o>=0;o--)this._active[o].hook(d);else this._handlerFb(this._ident,"HOOK",d)},p.prototype.put=function(_,d,o){if(this._active.length)for(var s=this._active.length-1;s>=0;s--)this._active[s].put(_,d,o);else this._handlerFb(this._ident,"PUT",(0,O.utf32ToString)(_,d,o))},p.prototype.unhook=function(_,d){if(d===void 0&&(d=!0),this._active.length){var o=!1,s=this._active.length-1,a=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,o=d,a=this._stack.fallThrough,this._stack.paused=!1),!a&&o===!1){for(;s>=0&&(o=this._active[s].unhook(_))!==!0;s--)if(o instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,o;s--}for(;s>=0;s--)if((o=this._active[s].unhook(!1))instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,o}else this._handlerFb(this._ident,"UNHOOK",_);this._active=g,this._ident=0},p}();E.DcsParser=D;var T=new b.Params;T.addParam(0);var f=function(){function p(_){this._handler=_,this._data="",this._params=T,this._hitLimit=!1}return p.prototype.hook=function(_){this._params=_.length>1||_.params[0]?_.clone():T,this._data="",this._hitLimit=!1},p.prototype.put=function(_,d,o){this._hitLimit||(this._data+=(0,O.utf32ToString)(_,d,o),this._data.length>w.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},p.prototype.unhook=function(_){var d=this,o=!1;if(this._hitLimit)o=!1;else if(_&&(o=this._handler(this._data,this._params))instanceof Promise)return o.then(function(s){return d._params=T,d._data="",d._hitLimit=!1,s});return this._params=T,this._data="",this._hitLimit=!1,o},p}();E.DcsHandler=f},2015:function(P,E,L){var O,b=this&&this.__extends||(O=function(o,s){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var l in u)Object.prototype.hasOwnProperty.call(u,l)&&(a[l]=u[l])},O(o,s)},function(o,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function a(){this.constructor=o}O(o,s),o.prototype=s===null?Object.create(s):(a.prototype=s.prototype,new a)});Object.defineProperty(E,"__esModule",{value:!0}),E.EscapeSequenceParser=E.VT500_TRANSITION_TABLE=E.TransitionTable=void 0;var w=L(844),g=L(8273),D=L(8742),T=L(6242),f=L(6351),p=function(){function o(s){this.table=new Uint8Array(s)}return o.prototype.setDefault=function(s,a){(0,g.fill)(this.table,s<<4|a)},o.prototype.add=function(s,a,u,l){this.table[a<<8|s]=u<<4|l},o.prototype.addMany=function(s,a,u,l){for(var A=0;A<s.length;A++)this.table[a<<8|s[A]]=u<<4|l},o}();E.TransitionTable=p;var _=160;E.VT500_TRANSITION_TABLE=function(){var o=new p(4095),s=Array.apply(null,Array(256)).map(function(R,y){return y}),a=function(R,y){return s.slice(R,y)},u=a(32,127),l=a(0,24);l.push(25),l.push.apply(l,a(28,32));var A,I=a(0,14);for(A in o.setDefault(1,0),o.addMany(u,0,2,0),I)o.addMany([24,26,153,154],A,3,0),o.addMany(a(128,144),A,3,0),o.addMany(a(144,152),A,3,0),o.add(156,A,0,0),o.add(27,A,11,1),o.add(157,A,4,8),o.addMany([152,158,159],A,0,7),o.add(155,A,11,3),o.add(144,A,11,9);return o.addMany(l,0,3,0),o.addMany(l,1,3,1),o.add(127,1,0,1),o.addMany(l,8,0,8),o.addMany(l,3,3,3),o.add(127,3,0,3),o.addMany(l,4,3,4),o.add(127,4,0,4),o.addMany(l,6,3,6),o.addMany(l,5,3,5),o.add(127,5,0,5),o.addMany(l,2,3,2),o.add(127,2,0,2),o.add(93,1,4,8),o.addMany(u,8,5,8),o.add(127,8,5,8),o.addMany([156,27,24,26,7],8,6,0),o.addMany(a(28,32),8,0,8),o.addMany([88,94,95],1,0,7),o.addMany(u,7,0,7),o.addMany(l,7,0,7),o.add(156,7,0,0),o.add(127,7,0,7),o.add(91,1,11,3),o.addMany(a(64,127),3,7,0),o.addMany(a(48,60),3,8,4),o.addMany([60,61,62,63],3,9,4),o.addMany(a(48,60),4,8,4),o.addMany(a(64,127),4,7,0),o.addMany([60,61,62,63],4,0,6),o.addMany(a(32,64),6,0,6),o.add(127,6,0,6),o.addMany(a(64,127),6,0,0),o.addMany(a(32,48),3,9,5),o.addMany(a(32,48),5,9,5),o.addMany(a(48,64),5,0,6),o.addMany(a(64,127),5,7,0),o.addMany(a(32,48),4,9,5),o.addMany(a(32,48),1,9,2),o.addMany(a(32,48),2,9,2),o.addMany(a(48,127),2,10,0),o.addMany(a(48,80),1,10,0),o.addMany(a(81,88),1,10,0),o.addMany([89,90,92],1,10,0),o.addMany(a(96,127),1,10,0),o.add(80,1,11,9),o.addMany(l,9,0,9),o.add(127,9,0,9),o.addMany(a(28,32),9,0,9),o.addMany(a(32,48),9,9,12),o.addMany(a(48,60),9,8,10),o.addMany([60,61,62,63],9,9,10),o.addMany(l,11,0,11),o.addMany(a(32,128),11,0,11),o.addMany(a(28,32),11,0,11),o.addMany(l,10,0,10),o.add(127,10,0,10),o.addMany(a(28,32),10,0,10),o.addMany(a(48,60),10,8,10),o.addMany([60,61,62,63],10,0,11),o.addMany(a(32,48),10,9,12),o.addMany(l,12,0,12),o.add(127,12,0,12),o.addMany(a(28,32),12,0,12),o.addMany(a(32,48),12,9,12),o.addMany(a(48,64),12,0,11),o.addMany(a(64,127),12,12,13),o.addMany(a(64,127),10,12,13),o.addMany(a(64,127),9,12,13),o.addMany(l,13,13,13),o.addMany(u,13,13,13),o.add(127,13,0,13),o.addMany([27,156,24,26],13,14,0),o.add(_,0,2,0),o.add(_,8,5,8),o.add(_,6,0,6),o.add(_,11,0,11),o.add(_,13,13,13),o}();var d=function(o){function s(a){a===void 0&&(a=E.VT500_TRANSITION_TABLE);var u=o.call(this)||this;return u._transitions=a,u._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},u.initialState=0,u.currentState=u.initialState,u._params=new D.Params,u._params.addParam(0),u._collect=0,u.precedingCodepoint=0,u._printHandlerFb=function(l,A,I){},u._executeHandlerFb=function(l){},u._csiHandlerFb=function(l,A){},u._escHandlerFb=function(l){},u._errorHandlerFb=function(l){return l},u._printHandler=u._printHandlerFb,u._executeHandlers=Object.create(null),u._csiHandlers=Object.create(null),u._escHandlers=Object.create(null),u._oscParser=new T.OscParser,u._dcsParser=new f.DcsParser,u._errorHandler=u._errorHandlerFb,u.registerEscHandler({final:"\\"},function(){return!0}),u}return b(s,o),s.prototype._identifier=function(a,u){u===void 0&&(u=[64,126]);var l=0;if(a.prefix){if(a.prefix.length>1)throw new Error("only one byte as prefix supported");if((l=a.prefix.charCodeAt(0))&&60>l||l>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(a.intermediates){if(a.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(var A=0;A<a.intermediates.length;++A){var I=a.intermediates.charCodeAt(A);if(32>I||I>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");l<<=8,l|=I}}if(a.final.length!==1)throw new Error("final must be a single byte");var R=a.final.charCodeAt(0);if(u[0]>R||R>u[1])throw new Error("final must be in range "+u[0]+" .. "+u[1]);return(l<<=8)|R},s.prototype.identToString=function(a){for(var u=[];a;)u.push(String.fromCharCode(255&a)),a>>=8;return u.reverse().join("")},s.prototype.dispose=function(){this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null),this._oscParser.dispose(),this._dcsParser.dispose()},s.prototype.setPrintHandler=function(a){this._printHandler=a},s.prototype.clearPrintHandler=function(){this._printHandler=this._printHandlerFb},s.prototype.registerEscHandler=function(a,u){var l=this._identifier(a,[48,126]);this._escHandlers[l]===void 0&&(this._escHandlers[l]=[]);var A=this._escHandlers[l];return A.push(u),{dispose:function(){var I=A.indexOf(u);I!==-1&&A.splice(I,1)}}},s.prototype.clearEscHandler=function(a){this._escHandlers[this._identifier(a,[48,126])]&&delete this._escHandlers[this._identifier(a,[48,126])]},s.prototype.setEscHandlerFallback=function(a){this._escHandlerFb=a},s.prototype.setExecuteHandler=function(a,u){this._executeHandlers[a.charCodeAt(0)]=u},s.prototype.clearExecuteHandler=function(a){this._executeHandlers[a.charCodeAt(0)]&&delete this._executeHandlers[a.charCodeAt(0)]},s.prototype.setExecuteHandlerFallback=function(a){this._executeHandlerFb=a},s.prototype.registerCsiHandler=function(a,u){var l=this._identifier(a);this._csiHandlers[l]===void 0&&(this._csiHandlers[l]=[]);var A=this._csiHandlers[l];return A.push(u),{dispose:function(){var I=A.indexOf(u);I!==-1&&A.splice(I,1)}}},s.prototype.clearCsiHandler=function(a){this._csiHandlers[this._identifier(a)]&&delete this._csiHandlers[this._identifier(a)]},s.prototype.setCsiHandlerFallback=function(a){this._csiHandlerFb=a},s.prototype.registerDcsHandler=function(a,u){return this._dcsParser.registerHandler(this._identifier(a),u)},s.prototype.clearDcsHandler=function(a){this._dcsParser.clearHandler(this._identifier(a))},s.prototype.setDcsHandlerFallback=function(a){this._dcsParser.setHandlerFallback(a)},s.prototype.registerOscHandler=function(a,u){return this._oscParser.registerHandler(a,u)},s.prototype.clearOscHandler=function(a){this._oscParser.clearHandler(a)},s.prototype.setOscHandlerFallback=function(a){this._oscParser.setHandlerFallback(a)},s.prototype.setErrorHandler=function(a){this._errorHandler=a},s.prototype.clearErrorHandler=function(){this._errorHandler=this._errorHandlerFb},s.prototype.reset=function(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])},s.prototype._preserveStack=function(a,u,l,A,I){this._parseStack.state=a,this._parseStack.handlers=u,this._parseStack.handlerPos=l,this._parseStack.transition=A,this._parseStack.chunkPos=I},s.prototype.parse=function(a,u,l){var A,I=0,R=0,y=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,y=this._parseStack.chunkPos+1;else{if(l===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");var v=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(l===!1&&m>-1){for(;m>=0&&(A=v[m](this._params))!==!0;m--)if(A instanceof Promise)return this._parseStack.handlerPos=m,A}this._parseStack.handlers=[];break;case 4:if(l===!1&&m>-1){for(;m>=0&&(A=v[m]())!==!0;m--)if(A instanceof Promise)return this._parseStack.handlerPos=m,A}this._parseStack.handlers=[];break;case 6:if(I=a[this._parseStack.chunkPos],A=this._dcsParser.unhook(I!==24&&I!==26,l))return A;I===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(I=a[this._parseStack.chunkPos],A=this._oscParser.end(I!==24&&I!==26,l))return A;I===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,y=this._parseStack.chunkPos+1,this.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(var S=y;S<u;++S){switch(I=a[S],(R=this._transitions.table[this.currentState<<8|(I<160?I:_)])>>4){case 2:for(var B=S+1;;++B){if(B>=u||(I=a[B])<32||I>126&&I<_){this._printHandler(a,S,B),S=B-1;break}if(++B>=u||(I=a[B])<32||I>126&&I<_){this._printHandler(a,S,B),S=B-1;break}if(++B>=u||(I=a[B])<32||I>126&&I<_){this._printHandler(a,S,B),S=B-1;break}if(++B>=u||(I=a[B])<32||I>126&&I<_){this._printHandler(a,S,B),S=B-1;break}}break;case 3:this._executeHandlers[I]?this._executeHandlers[I]():this._executeHandlerFb(I),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:S,code:I,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:for(var N=(v=this._csiHandlers[this._collect<<8|I])?v.length-1:-1;N>=0&&(A=v[N](this._params))!==!0;N--)if(A instanceof Promise)return this._preserveStack(3,v,N,R,S),A;N<0&&this._csiHandlerFb(this._collect<<8|I,this._params),this.precedingCodepoint=0;break;case 8:do switch(I){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(I-48)}while(++S<u&&(I=a[S])>47&&I<60);S--;break;case 9:this._collect<<=8,this._collect|=I;break;case 10:for(var M=this._escHandlers[this._collect<<8|I],U=M?M.length-1:-1;U>=0&&(A=M[U]())!==!0;U--)if(A instanceof Promise)return this._preserveStack(4,M,U,R,S),A;U<0&&this._escHandlerFb(this._collect<<8|I),this.precedingCodepoint=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|I,this._params);break;case 13:for(var K=S+1;;++K)if(K>=u||(I=a[K])===24||I===26||I===27||I>127&&I<_){this._dcsParser.put(a,S,K),S=K-1;break}break;case 14:if(A=this._dcsParser.unhook(I!==24&&I!==26))return this._preserveStack(6,[],0,R,S),A;I===27&&(R|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0;break;case 4:this._oscParser.start();break;case 5:for(var j=S+1;;j++)if(j>=u||(I=a[j])<32||I>127&&I<_){this._oscParser.put(a,S,j),S=j-1;break}break;case 6:if(A=this._oscParser.end(I!==24&&I!==26))return this._preserveStack(5,[],0,R,S),A;I===27&&(R|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0}this.currentState=15&R}},s}(w.Disposable);E.EscapeSequenceParser=d},6242:(P,E,L)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.OscHandler=E.OscParser=void 0;var O=L(5770),b=L(482),w=[],g=function(){function T(){this._state=0,this._active=w,this._id=-1,this._handlers=Object.create(null),this._handlerFb=function(){},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}return T.prototype.registerHandler=function(f,p){this._handlers[f]===void 0&&(this._handlers[f]=[]);var _=this._handlers[f];return _.push(p),{dispose:function(){var d=_.indexOf(p);d!==-1&&_.splice(d,1)}}},T.prototype.clearHandler=function(f){this._handlers[f]&&delete this._handlers[f]},T.prototype.setHandlerFallback=function(f){this._handlerFb=f},T.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){},this._active=w},T.prototype.reset=function(){if(this._state===2)for(var f=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;f>=0;--f)this._active[f].end(!1);this._stack.paused=!1,this._active=w,this._id=-1,this._state=0},T.prototype._start=function(){if(this._active=this._handlers[this._id]||w,this._active.length)for(var f=this._active.length-1;f>=0;f--)this._active[f].start();else this._handlerFb(this._id,"START")},T.prototype._put=function(f,p,_){if(this._active.length)for(var d=this._active.length-1;d>=0;d--)this._active[d].put(f,p,_);else this._handlerFb(this._id,"PUT",(0,b.utf32ToString)(f,p,_))},T.prototype.start=function(){this.reset(),this._state=1},T.prototype.put=function(f,p,_){if(this._state!==3){if(this._state===1)for(;p<_;){var d=f[p++];if(d===59){this._state=2,this._start();break}if(d<48||57<d)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+d-48}this._state===2&&_-p>0&&this._put(f,p,_)}},T.prototype.end=function(f,p){if(p===void 0&&(p=!0),this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){var _=!1,d=this._active.length-1,o=!1;if(this._stack.paused&&(d=this._stack.loopPosition-1,_=p,o=this._stack.fallThrough,this._stack.paused=!1),!o&&_===!1){for(;d>=0&&(_=this._active[d].end(f))!==!0;d--)if(_ instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!1,_;d--}for(;d>=0;d--)if((_=this._active[d].end(!1))instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!0,_}else this._handlerFb(this._id,"END",f);this._active=w,this._id=-1,this._state=0}},T}();E.OscParser=g;var D=function(){function T(f){this._handler=f,this._data="",this._hitLimit=!1}return T.prototype.start=function(){this._data="",this._hitLimit=!1},T.prototype.put=function(f,p,_){this._hitLimit||(this._data+=(0,b.utf32ToString)(f,p,_),this._data.length>O.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},T.prototype.end=function(f){var p=this,_=!1;if(this._hitLimit)_=!1;else if(f&&(_=this._handler(this._data))instanceof Promise)return _.then(function(d){return p._data="",p._hitLimit=!1,d});return this._data="",this._hitLimit=!1,_},T}();E.OscHandler=D},8742:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.Params=void 0;var L=2147483647,O=function(){function b(w,g){if(w===void 0&&(w=32),g===void 0&&(g=32),this.maxLength=w,this.maxSubParamsLength=g,g>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(w),this.length=0,this._subParams=new Int32Array(g),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(w),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}return b.fromArray=function(w){var g=new b;if(!w.length)return g;for(var D=w[0]instanceof Array?1:0;D<w.length;++D){var T=w[D];if(T instanceof Array)for(var f=0;f<T.length;++f)g.addSubParam(T[f]);else g.addParam(T)}return g},b.prototype.clone=function(){var w=new b(this.maxLength,this.maxSubParamsLength);return w.params.set(this.params),w.length=this.length,w._subParams.set(this._subParams),w._subParamsLength=this._subParamsLength,w._subParamsIdx.set(this._subParamsIdx),w._rejectDigits=this._rejectDigits,w._rejectSubDigits=this._rejectSubDigits,w._digitIsSub=this._digitIsSub,w},b.prototype.toArray=function(){for(var w=[],g=0;g<this.length;++g){w.push(this.params[g]);var D=this._subParamsIdx[g]>>8,T=255&this._subParamsIdx[g];T-D>0&&w.push(Array.prototype.slice.call(this._subParams,D,T))}return w},b.prototype.reset=function(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1},b.prototype.addParam=function(w){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(w<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=w>L?L:w}},b.prototype.addSubParam=function(w){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(w<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=w>L?L:w,this._subParamsIdx[this.length-1]++}},b.prototype.hasSubParams=function(w){return(255&this._subParamsIdx[w])-(this._subParamsIdx[w]>>8)>0},b.prototype.getSubParams=function(w){var g=this._subParamsIdx[w]>>8,D=255&this._subParamsIdx[w];return D-g>0?this._subParams.subarray(g,D):null},b.prototype.getSubParamsAll=function(){for(var w={},g=0;g<this.length;++g){var D=this._subParamsIdx[g]>>8,T=255&this._subParamsIdx[g];T-D>0&&(w[g]=this._subParams.slice(D,T))}return w},b.prototype.addDigit=function(w){var g;if(!(this._rejectDigits||!(g=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)){var D=this._digitIsSub?this._subParams:this.params,T=D[g-1];D[g-1]=~T?Math.min(10*T+w,L):w}},b}();E.Params=O},5741:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.AddonManager=void 0;var L=function(){function O(){this._addons=[]}return O.prototype.dispose=function(){for(var b=this._addons.length-1;b>=0;b--)this._addons[b].instance.dispose()},O.prototype.loadAddon=function(b,w){var g=this,D={instance:w,dispose:w.dispose,isDisposed:!1};this._addons.push(D),w.dispose=function(){return g._wrappedAddonDispose(D)},w.activate(b)},O.prototype._wrappedAddonDispose=function(b){if(!b.isDisposed){for(var w=-1,g=0;g<this._addons.length;g++)if(this._addons[g]===b){w=g;break}if(w===-1)throw new Error("Could not dispose an addon that has not been loaded");b.isDisposed=!0,b.dispose.apply(b.instance),this._addons.splice(w,1)}},O}();E.AddonManager=L},8771:(P,E,L)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.BufferApiView=void 0;var O=L(3785),b=L(511),w=function(){function g(D,T){this._buffer=D,this.type=T}return g.prototype.init=function(D){return this._buffer=D,this},Object.defineProperty(g.prototype,"cursorY",{get:function(){return this._buffer.y},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"cursorX",{get:function(){return this._buffer.x},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"viewportY",{get:function(){return this._buffer.ydisp},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"baseY",{get:function(){return this._buffer.ybase},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"length",{get:function(){return this._buffer.lines.length},enumerable:!1,configurable:!0}),g.prototype.getLine=function(D){var T=this._buffer.lines.get(D);if(T)return new O.BufferLineApiView(T)},g.prototype.getNullCell=function(){return new b.CellData},g}();E.BufferApiView=w},3785:(P,E,L)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.BufferLineApiView=void 0;var O=L(511),b=function(){function w(g){this._line=g}return Object.defineProperty(w.prototype,"isWrapped",{get:function(){return this._line.isWrapped},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"length",{get:function(){return this._line.length},enumerable:!1,configurable:!0}),w.prototype.getCell=function(g,D){if(!(g<0||g>=this._line.length))return D?(this._line.loadCell(g,D),D):this._line.loadCell(g,new O.CellData)},w.prototype.translateToString=function(g,D,T){return this._line.translateToString(g,D,T)},w}();E.BufferLineApiView=b},8285:(P,E,L)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.BufferNamespaceApi=void 0;var O=L(8771),b=L(8460),w=function(){function g(D){var T=this;this._core=D,this._onBufferChange=new b.EventEmitter,this._normal=new O.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new O.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(function(){return T._onBufferChange.fire(T.active)})}return Object.defineProperty(g.prototype,"onBufferChange",{get:function(){return this._onBufferChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"active",{get:function(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"normal",{get:function(){return this._normal.init(this._core.buffers.normal)},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"alternate",{get:function(){return this._alternate.init(this._core.buffers.alt)},enumerable:!1,configurable:!0}),g}();E.BufferNamespaceApi=w},7975:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.ParserApi=void 0;var L=function(){function O(b){this._core=b}return O.prototype.registerCsiHandler=function(b,w){return this._core.registerCsiHandler(b,function(g){return w(g.toArray())})},O.prototype.addCsiHandler=function(b,w){return this.registerCsiHandler(b,w)},O.prototype.registerDcsHandler=function(b,w){return this._core.registerDcsHandler(b,function(g,D){return w(g,D.toArray())})},O.prototype.addDcsHandler=function(b,w){return this.registerDcsHandler(b,w)},O.prototype.registerEscHandler=function(b,w){return this._core.registerEscHandler(b,w)},O.prototype.addEscHandler=function(b,w){return this.registerEscHandler(b,w)},O.prototype.registerOscHandler=function(b,w){return this._core.registerOscHandler(b,w)},O.prototype.addOscHandler=function(b,w){return this.registerOscHandler(b,w)},O}();E.ParserApi=L},7090:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.UnicodeApi=void 0;var L=function(){function O(b){this._core=b}return O.prototype.register=function(b){this._core.unicodeService.register(b)},Object.defineProperty(O.prototype,"versions",{get:function(){return this._core.unicodeService.versions},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"activeVersion",{get:function(){return this._core.unicodeService.activeVersion},set:function(b){this._core.unicodeService.activeVersion=b},enumerable:!1,configurable:!0}),O}();E.UnicodeApi=L},744:function(P,E,L){var O,b=this&&this.__extends||(O=function(d,o){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,a){s.__proto__=a}||function(s,a){for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(s[u]=a[u])},O(d,o)},function(d,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function s(){this.constructor=d}O(d,o),d.prototype=o===null?Object.create(o):(s.prototype=o.prototype,new s)}),w=this&&this.__decorate||function(d,o,s,a){var u,l=arguments.length,A=l<3?o:a===null?a=Object.getOwnPropertyDescriptor(o,s):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(d,o,s,a);else for(var I=d.length-1;I>=0;I--)(u=d[I])&&(A=(l<3?u(A):l>3?u(o,s,A):u(o,s))||A);return l>3&&A&&Object.defineProperty(o,s,A),A},g=this&&this.__param||function(d,o){return function(s,a){o(s,a,d)}};Object.defineProperty(E,"__esModule",{value:!0}),E.BufferService=E.MINIMUM_ROWS=E.MINIMUM_COLS=void 0;var D=L(2585),T=L(5295),f=L(8460),p=L(844);E.MINIMUM_COLS=2,E.MINIMUM_ROWS=1;var _=function(d){function o(s){var a=d.call(this)||this;return a._optionsService=s,a.isUserScrolling=!1,a._onResize=new f.EventEmitter,a._onScroll=new f.EventEmitter,a.cols=Math.max(s.options.cols||0,E.MINIMUM_COLS),a.rows=Math.max(s.options.rows||0,E.MINIMUM_ROWS),a.buffers=new T.BufferSet(s,a),a}return b(o,d),Object.defineProperty(o.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),o.prototype.dispose=function(){d.prototype.dispose.call(this),this.buffers.dispose()},o.prototype.resize=function(s,a){this.cols=s,this.rows=a,this.buffers.resize(s,a),this.buffers.setupTabStops(this.cols),this._onResize.fire({cols:s,rows:a})},o.prototype.reset=function(){this.buffers.reset(),this.isUserScrolling=!1},o.prototype.scroll=function(s,a){a===void 0&&(a=!1);var u,l=this.buffer;(u=this._cachedBlankLine)&&u.length===this.cols&&u.getFg(0)===s.fg&&u.getBg(0)===s.bg||(u=l.getBlankLine(s,a),this._cachedBlankLine=u),u.isWrapped=a;var A=l.ybase+l.scrollTop,I=l.ybase+l.scrollBottom;if(l.scrollTop===0){var R=l.lines.isFull;I===l.lines.length-1?R?l.lines.recycle().copyFrom(u):l.lines.push(u.clone()):l.lines.splice(I+1,0,u.clone()),R?this.isUserScrolling&&(l.ydisp=Math.max(l.ydisp-1,0)):(l.ybase++,this.isUserScrolling||l.ydisp++)}else{var y=I-A+1;l.lines.shiftElements(A+1,y-1,-1),l.lines.set(I,u.clone())}this.isUserScrolling||(l.ydisp=l.ybase),this._onScroll.fire(l.ydisp)},o.prototype.scrollLines=function(s,a,u){var l=this.buffer;if(s<0){if(l.ydisp===0)return;this.isUserScrolling=!0}else s+l.ydisp>=l.ybase&&(this.isUserScrolling=!1);var A=l.ydisp;l.ydisp=Math.max(Math.min(l.ydisp+s,l.ybase),0),A!==l.ydisp&&(a||this._onScroll.fire(l.ydisp))},o.prototype.scrollPages=function(s){this.scrollLines(s*(this.rows-1))},o.prototype.scrollToTop=function(){this.scrollLines(-this.buffer.ydisp)},o.prototype.scrollToBottom=function(){this.scrollLines(this.buffer.ybase-this.buffer.ydisp)},o.prototype.scrollToLine=function(s){var a=s-this.buffer.ydisp;a!==0&&this.scrollLines(a)},w([g(0,D.IOptionsService)],o)}(p.Disposable);E.BufferService=_},7994:(P,E)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.CharsetService=void 0;var L=function(){function O(){this.glevel=0,this._charsets=[]}return O.prototype.reset=function(){this.charset=void 0,this._charsets=[],this.glevel=0},O.prototype.setgLevel=function(b){this.glevel=b,this.charset=this._charsets[b]},O.prototype.setgCharset=function(b,w){this._charsets[b]=w,this.glevel===b&&(this.charset=w)},O}();E.CharsetService=L},1753:function(P,E,L){var O=this&&this.__decorate||function(d,o,s,a){var u,l=arguments.length,A=l<3?o:a===null?a=Object.getOwnPropertyDescriptor(o,s):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(d,o,s,a);else for(var I=d.length-1;I>=0;I--)(u=d[I])&&(A=(l<3?u(A):l>3?u(o,s,A):u(o,s))||A);return l>3&&A&&Object.defineProperty(o,s,A),A},b=this&&this.__param||function(d,o){return function(s,a){o(s,a,d)}};Object.defineProperty(E,"__esModule",{value:!0}),E.CoreMouseService=void 0;var w=L(2585),g=L(8460),D={NONE:{events:0,restrict:function(){return!1}},X10:{events:1,restrict:function(d){return d.button!==4&&d.action===1&&(d.ctrl=!1,d.alt=!1,d.shift=!1,!0)}},VT200:{events:19,restrict:function(d){return d.action!==32}},DRAG:{events:23,restrict:function(d){return d.action!==32||d.button!==3}},ANY:{events:31,restrict:function(d){return!0}}};function T(d,o){var s=(d.ctrl?16:0)|(d.shift?4:0)|(d.alt?8:0);return d.button===4?(s|=64,s|=d.action):(s|=3&d.button,4&d.button&&(s|=64),8&d.button&&(s|=128),d.action===32?s|=32:d.action!==0||o||(s|=3)),s}var f=String.fromCharCode,p={DEFAULT:function(d){var o=[T(d,!1)+32,d.col+32,d.row+32];return o[0]>255||o[1]>255||o[2]>255?"":""+f(o[0])+f(o[1])+f(o[2])},SGR:function(d){var o=d.action===0&&d.button!==4?"m":"M";return"[<"+T(d,!0)+";"+d.col+";"+d.row+o}},_=function(){function d(o,s){this._bufferService=o,this._coreService=s,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._onProtocolChange=new g.EventEmitter,this._lastEvent=null;for(var a=0,u=Object.keys(D);a<u.length;a++){var l=u[a];this.addProtocol(l,D[l])}for(var A=0,I=Object.keys(p);A<I.length;A++){var R=I[A];this.addEncoding(R,p[R])}this.reset()}return d.prototype.addProtocol=function(o,s){this._protocols[o]=s},d.prototype.addEncoding=function(o,s){this._encodings[o]=s},Object.defineProperty(d.prototype,"activeProtocol",{get:function(){return this._activeProtocol},set:function(o){if(!this._protocols[o])throw new Error('unknown protocol "'+o+'"');this._activeProtocol=o,this._onProtocolChange.fire(this._protocols[o].events)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"areMouseEventsActive",{get:function(){return this._protocols[this._activeProtocol].events!==0},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"activeEncoding",{get:function(){return this._activeEncoding},set:function(o){if(!this._encodings[o])throw new Error('unknown encoding "'+o+'"');this._activeEncoding=o},enumerable:!1,configurable:!0}),d.prototype.reset=function(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null},Object.defineProperty(d.prototype,"onProtocolChange",{get:function(){return this._onProtocolChange.event},enumerable:!1,configurable:!0}),d.prototype.triggerMouseEvent=function(o){if(o.col<0||o.col>=this._bufferService.cols||o.row<0||o.row>=this._bufferService.rows||o.button===4&&o.action===32||o.button===3&&o.action!==32||o.button!==4&&(o.action===2||o.action===3)||(o.col++,o.row++,o.action===32&&this._lastEvent&&this._compareEvents(this._lastEvent,o))||!this._protocols[this._activeProtocol].restrict(o))return!1;var s=this._encodings[this._activeEncoding](o);return s&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(s):this._coreService.triggerDataEvent(s,!0)),this._lastEvent=o,!0},d.prototype.explainEvents=function(o){return{down:!!(1&o),up:!!(2&o),drag:!!(4&o),move:!!(8&o),wheel:!!(16&o)}},d.prototype._compareEvents=function(o,s){return o.col===s.col&&o.row===s.row&&o.button===s.button&&o.action===s.action&&o.ctrl===s.ctrl&&o.alt===s.alt&&o.shift===s.shift},O([b(0,w.IBufferService),b(1,w.ICoreService)],d)}();E.CoreMouseService=_},6975:function(P,E,L){var O,b=this&&this.__extends||(O=function(s,a){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,l){u.__proto__=l}||function(u,l){for(var A in l)Object.prototype.hasOwnProperty.call(l,A)&&(u[A]=l[A])},O(s,a)},function(s,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");function u(){this.constructor=s}O(s,a),s.prototype=a===null?Object.create(a):(u.prototype=a.prototype,new u)}),w=this&&this.__decorate||function(s,a,u,l){var A,I=arguments.length,R=I<3?a:l===null?l=Object.getOwnPropertyDescriptor(a,u):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(s,a,u,l);else for(var y=s.length-1;y>=0;y--)(A=s[y])&&(R=(I<3?A(R):I>3?A(a,u,R):A(a,u))||R);return I>3&&R&&Object.defineProperty(a,u,R),R},g=this&&this.__param||function(s,a){return function(u,l){a(u,l,s)}};Object.defineProperty(E,"__esModule",{value:!0}),E.CoreService=void 0;var D=L(2585),T=L(8460),f=L(1439),p=L(844),_=Object.freeze({insertMode:!1}),d=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),o=function(s){function a(u,l,A,I){var R=s.call(this)||this;return R._bufferService=l,R._logService=A,R._optionsService=I,R.isCursorInitialized=!1,R.isCursorHidden=!1,R._onData=R.register(new T.EventEmitter),R._onUserInput=R.register(new T.EventEmitter),R._onBinary=R.register(new T.EventEmitter),R._scrollToBottom=u,R.register({dispose:function(){return R._scrollToBottom=void 0}}),R.modes=(0,f.clone)(_),R.decPrivateModes=(0,f.clone)(d),R}return b(a,s),Object.defineProperty(a.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onUserInput",{get:function(){return this._onUserInput.event},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),a.prototype.reset=function(){this.modes=(0,f.clone)(_),this.decPrivateModes=(0,f.clone)(d)},a.prototype.triggerDataEvent=function(u,l){if(l===void 0&&(l=!1),!this._optionsService.options.disableStdin){var A=this._bufferService.buffer;A.ybase!==A.ydisp&&this._scrollToBottom(),l&&this._onUserInput.fire(),this._logService.debug('sending data "'+u+'"',function(){return u.split("").map(function(I){return I.charCodeAt(0)})}),this._onData.fire(u)}},a.prototype.triggerBinaryEvent=function(u){this._optionsService.options.disableStdin||(this._logService.debug('sending binary "'+u+'"',function(){return u.split("").map(function(l){return l.charCodeAt(0)})}),this._onBinary.fire(u))},w([g(1,D.IBufferService),g(2,D.ILogService),g(3,D.IOptionsService)],a)}(p.Disposable);E.CoreService=o},3730:function(P,E,L){var O=this&&this.__decorate||function(D,T,f,p){var _,d=arguments.length,o=d<3?T:p===null?p=Object.getOwnPropertyDescriptor(T,f):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(D,T,f,p);else for(var s=D.length-1;s>=0;s--)(_=D[s])&&(o=(d<3?_(o):d>3?_(T,f,o):_(T,f))||o);return d>3&&o&&Object.defineProperty(T,f,o),o},b=this&&this.__param||function(D,T){return function(f,p){T(f,p,D)}};Object.defineProperty(E,"__esModule",{value:!0}),E.DirtyRowService=void 0;var w=L(2585),g=function(){function D(T){this._bufferService=T,this.clearRange()}return Object.defineProperty(D.prototype,"start",{get:function(){return this._start},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"end",{get:function(){return this._end},enumerable:!1,configurable:!0}),D.prototype.clearRange=function(){this._start=this._bufferService.buffer.y,this._end=this._bufferService.buffer.y},D.prototype.markDirty=function(T){T<this._start?this._start=T:T>this._end&&(this._end=T)},D.prototype.markRangeDirty=function(T,f){if(T>f){var p=T;T=f,f=p}T<this._start&&(this._start=T),f>this._end&&(this._end=f)},D.prototype.markAllDirty=function(){this.markRangeDirty(0,this._bufferService.rows-1)},O([b(0,w.IBufferService)],D)}();E.DirtyRowService=g},4348:function(P,E,L){var O=this&&this.__spreadArray||function(T,f,p){if(p||arguments.length===2)for(var _,d=0,o=f.length;d<o;d++)!_&&d in f||(_||(_=Array.prototype.slice.call(f,0,d)),_[d]=f[d]);return T.concat(_||Array.prototype.slice.call(f))};Object.defineProperty(E,"__esModule",{value:!0}),E.InstantiationService=E.ServiceCollection=void 0;var b=L(2585),w=L(8343),g=function(){function T(){for(var f=[],p=0;p<arguments.length;p++)f[p]=arguments[p];this._entries=new Map;for(var _=0,d=f;_<d.length;_++){var o=d[_],s=o[0],a=o[1];this.set(s,a)}}return T.prototype.set=function(f,p){var _=this._entries.get(f);return this._entries.set(f,p),_},T.prototype.forEach=function(f){this._entries.forEach(function(p,_){return f(_,p)})},T.prototype.has=function(f){return this._entries.has(f)},T.prototype.get=function(f){return this._entries.get(f)},T}();E.ServiceCollection=g;var D=function(){function T(){this._services=new g,this._services.set(b.IInstantiationService,this)}return T.prototype.setService=function(f,p){this._services.set(f,p)},T.prototype.getService=function(f){return this._services.get(f)},T.prototype.createInstance=function(f){for(var p=[],_=1;_<arguments.length;_++)p[_-1]=arguments[_];for(var d=(0,w.getServiceDependencies)(f).sort(function(I,R){return I.index-R.index}),o=[],s=0,a=d;s<a.length;s++){var u=a[s],l=this._services.get(u.id);if(!l)throw new Error("[createInstance] "+f.name+" depends on UNKNOWN service "+u.id+".");o.push(l)}var A=d.length>0?d[0].index:p.length;if(p.length!==A)throw new Error("[createInstance] First service dependency of "+f.name+" at position "+(A+1)+" conflicts with "+p.length+" static arguments");return new(f.bind.apply(f,O([void 0],O(O([],p,!0),o,!0),!1)))},T}();E.InstantiationService=D},7866:function(P,E,L){var O=this&&this.__decorate||function(f,p,_,d){var o,s=arguments.length,a=s<3?p:d===null?d=Object.getOwnPropertyDescriptor(p,_):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(f,p,_,d);else for(var u=f.length-1;u>=0;u--)(o=f[u])&&(a=(s<3?o(a):s>3?o(p,_,a):o(p,_))||a);return s>3&&a&&Object.defineProperty(p,_,a),a},b=this&&this.__param||function(f,p){return function(_,d){p(_,d,f)}},w=this&&this.__spreadArray||function(f,p,_){if(_||arguments.length===2)for(var d,o=0,s=p.length;o<s;o++)!d&&o in p||(d||(d=Array.prototype.slice.call(p,0,o)),d[o]=p[o]);return f.concat(d||Array.prototype.slice.call(p))};Object.defineProperty(E,"__esModule",{value:!0}),E.LogService=void 0;var g=L(2585),D={debug:g.LogLevelEnum.DEBUG,info:g.LogLevelEnum.INFO,warn:g.LogLevelEnum.WARN,error:g.LogLevelEnum.ERROR,off:g.LogLevelEnum.OFF},T=function(){function f(p){var _=this;this._optionsService=p,this.logLevel=g.LogLevelEnum.OFF,this._updateLogLevel(),this._optionsService.onOptionChange(function(d){d==="logLevel"&&_._updateLogLevel()})}return f.prototype._updateLogLevel=function(){this.logLevel=D[this._optionsService.options.logLevel]},f.prototype._evalLazyOptionalParams=function(p){for(var _=0;_<p.length;_++)typeof p[_]=="function"&&(p[_]=p[_]())},f.prototype._log=function(p,_,d){this._evalLazyOptionalParams(d),p.call.apply(p,w([console,"xterm.js: "+_],d,!1))},f.prototype.debug=function(p){for(var _=[],d=1;d<arguments.length;d++)_[d-1]=arguments[d];this.logLevel<=g.LogLevelEnum.DEBUG&&this._log(console.log,p,_)},f.prototype.info=function(p){for(var _=[],d=1;d<arguments.length;d++)_[d-1]=arguments[d];this.logLevel<=g.LogLevelEnum.INFO&&this._log(console.info,p,_)},f.prototype.warn=function(p){for(var _=[],d=1;d<arguments.length;d++)_[d-1]=arguments[d];this.logLevel<=g.LogLevelEnum.WARN&&this._log(console.warn,p,_)},f.prototype.error=function(p){for(var _=[],d=1;d<arguments.length;d++)_[d-1]=arguments[d];this.logLevel<=g.LogLevelEnum.ERROR&&this._log(console.error,p,_)},O([b(0,g.IOptionsService)],f)}();E.LogService=T},7302:function(P,E,L){var O=this&&this.__assign||function(){return O=Object.assign||function(f){for(var p,_=1,d=arguments.length;_<d;_++)for(var o in p=arguments[_])Object.prototype.hasOwnProperty.call(p,o)&&(f[o]=p[o]);return f},O.apply(this,arguments)};Object.defineProperty(E,"__esModule",{value:!0}),E.OptionsService=E.DEFAULT_OPTIONS=E.DEFAULT_BELL_SOUND=void 0;var b=L(8460),w=L(6114);E.DEFAULT_BELL_SOUND="data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjMyLjEwNAAAAAAAAAAAAAAA//tQxAADB8AhSmxhIIEVCSiJrDCQBTcu3UrAIwUdkRgQbFAZC1CQEwTJ9mjRvBA4UOLD8nKVOWfh+UlK3z/177OXrfOdKl7pyn3Xf//WreyTRUoAWgBgkOAGbZHBgG1OF6zM82DWbZaUmMBptgQhGjsyYqc9ae9XFz280948NMBWInljyzsNRFLPWdnZGWrddDsjK1unuSrVN9jJsK8KuQtQCtMBjCEtImISdNKJOopIpBFpNSMbIHCSRpRR5iakjTiyzLhchUUBwCgyKiweBv/7UsQbg8isVNoMPMjAAAA0gAAABEVFGmgqK////9bP/6XCykxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq",E.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,customGlyphs:!0,bellSound:E.DEFAULT_BELL_SOUND,bellStyle:"none",drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",lineHeight:1,linkTooltipHoverDuration:500,letterSpacing:0,logLevel:"info",scrollback:1e3,scrollSensitivity:1,screenReaderMode:!1,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!0,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:w.isMac,rendererType:"canvas",windowOptions:{},windowsMode:!1,wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1};var g=["normal","bold","100","200","300","400","500","600","700","800","900"],D=["cols","rows"],T=function(){function f(p){for(var _ in this._onOptionChange=new b.EventEmitter,this._options=O({},E.DEFAULT_OPTIONS),p)if(_ in this._options)try{var d=p[_];this._options[_]=this._sanitizeAndValidateOption(_,d)}catch(o){console.error(o)}this.options=this._setupOptions(this._options,!1),this.publicOptions=this._setupOptions(this._options,!0)}return Object.defineProperty(f.prototype,"onOptionChange",{get:function(){return this._onOptionChange.event},enumerable:!1,configurable:!0}),f.prototype._setupOptions=function(p,_){var d=this,o=O({},p),s=function(u){Object.defineProperty(o,u,{get:function(){if(!(u in E.DEFAULT_OPTIONS))throw new Error('No option with key "'+u+'"');return d._options[u]},set:function(l){if(!(u in E.DEFAULT_OPTIONS))throw new Error('No option with key "'+u+'"');if(_&&D.includes(u))throw new Error('Option "'+u+'" can only be set in the constructor');l=d._sanitizeAndValidateOption(u,l),d._options[u]!==l&&(d._options[u]=l,d._onOptionChange.fire(u))}})};for(var a in o)s(a);return o},f.prototype.setOption=function(p,_){this.publicOptions[p]=_},f.prototype._sanitizeAndValidateOption=function(p,_){switch(p){case"bellStyle":case"cursorStyle":case"rendererType":case"wordSeparator":_||(_=E.DEFAULT_OPTIONS[p]);break;case"fontWeight":case"fontWeightBold":if(typeof _=="number"&&1<=_&&_<=1e3)break;_=g.includes(_)?_:E.DEFAULT_OPTIONS[p];break;case"cursorWidth":_=Math.floor(_);case"lineHeight":case"tabStopWidth":if(_<1)throw new Error(p+" cannot be less than 1, value: "+_);break;case"minimumContrastRatio":_=Math.max(1,Math.min(21,Math.round(10*_)/10));break;case"scrollback":if((_=Math.min(_,4294967295))<0)throw new Error(p+" cannot be less than 0, value: "+_);break;case"fastScrollSensitivity":case"scrollSensitivity":if(_<=0)throw new Error(p+" cannot be less than or equal to 0, value: "+_);case"rows":case"cols":if(!_&&_!==0)throw new Error(p+" must be numeric, value: "+_)}return _},f.prototype.getOption=function(p){return this.publicOptions[p]},f}();E.OptionsService=T},8343:(P,E)=>{function L(O,b,w){b.di$target===b?b.di$dependencies.push({id:O,index:w}):(b.di$dependencies=[{id:O,index:w}],b.di$target=b)}Object.defineProperty(E,"__esModule",{value:!0}),E.createDecorator=E.getServiceDependencies=E.serviceRegistry=void 0,E.serviceRegistry=new Map,E.getServiceDependencies=function(O){return O.di$dependencies||[]},E.createDecorator=function(O){if(E.serviceRegistry.has(O))return E.serviceRegistry.get(O);var b=function(w,g,D){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");L(b,w,D)};return b.toString=function(){return O},E.serviceRegistry.set(O,b),b}},2585:(P,E,L)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.IUnicodeService=E.LogLevelEnum=E.IOptionsService=E.ILogService=E.IInstantiationService=E.IDirtyRowService=E.ICharsetService=E.ICoreService=E.ICoreMouseService=E.IBufferService=void 0;var O,b=L(8343);E.IBufferService=(0,b.createDecorator)("BufferService"),E.ICoreMouseService=(0,b.createDecorator)("CoreMouseService"),E.ICoreService=(0,b.createDecorator)("CoreService"),E.ICharsetService=(0,b.createDecorator)("CharsetService"),E.IDirtyRowService=(0,b.createDecorator)("DirtyRowService"),E.IInstantiationService=(0,b.createDecorator)("InstantiationService"),E.ILogService=(0,b.createDecorator)("LogService"),E.IOptionsService=(0,b.createDecorator)("OptionsService"),(O=E.LogLevelEnum||(E.LogLevelEnum={}))[O.DEBUG=0]="DEBUG",O[O.INFO=1]="INFO",O[O.WARN=2]="WARN",O[O.ERROR=3]="ERROR",O[O.OFF=4]="OFF",E.IUnicodeService=(0,b.createDecorator)("UnicodeService")},1480:(P,E,L)=>{Object.defineProperty(E,"__esModule",{value:!0}),E.UnicodeService=void 0;var O=L(8460),b=L(225),w=function(){function g(){this._providers=Object.create(null),this._active="",this._onChange=new O.EventEmitter;var D=new b.UnicodeV6;this.register(D),this._active=D.version,this._activeProvider=D}return Object.defineProperty(g.prototype,"onChange",{get:function(){return this._onChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"versions",{get:function(){return Object.keys(this._providers)},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"activeVersion",{get:function(){return this._active},set:function(D){if(!this._providers[D])throw new Error('unknown Unicode version "'+D+'"');this._active=D,this._activeProvider=this._providers[D],this._onChange.fire(D)},enumerable:!1,configurable:!0}),g.prototype.register=function(D){this._providers[D.version]=D},g.prototype.wcwidth=function(D){return this._activeProvider.wcwidth(D)},g.prototype.getStringCellWidth=function(D){for(var T=0,f=D.length,p=0;p<f;++p){var _=D.charCodeAt(p);if(55296<=_&&_<=56319){if(++p>=f)return T+this.wcwidth(_);var d=D.charCodeAt(p);56320<=d&&d<=57343?_=1024*(_-55296)+d-56320+65536:T+=this.wcwidth(d)}T+=this.wcwidth(_)}return T},g}();E.UnicodeService=w}},H={};function k(P){var E=H[P];if(E!==void 0)return E.exports;var L=H[P]={exports:{}};return he[P].call(L.exports,L,L.exports,k),L.exports}var W={};return(()=>{var P=W;Object.defineProperty(P,"__esModule",{value:!0}),P.Terminal=void 0;var E=k(3236),L=k(9042),O=k(7975),b=k(7090),w=k(5741),g=k(8285),D=function(){function T(f){this._core=new E.Terminal(f),this._addonManager=new w.AddonManager}return T.prototype._checkProposedApi=function(){if(!this._core.optionsService.options.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")},Object.defineProperty(T.prototype,"onBell",{get:function(){return this._core.onBell},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onBinary",{get:function(){return this._core.onBinary},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onCursorMove",{get:function(){return this._core.onCursorMove},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onData",{get:function(){return this._core.onData},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onKey",{get:function(){return this._core.onKey},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onLineFeed",{get:function(){return this._core.onLineFeed},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onRender",{get:function(){return this._core.onRender},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onResize",{get:function(){return this._core.onResize},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onScroll",{get:function(){return this._core.onScroll},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onSelectionChange",{get:function(){return this._core.onSelectionChange},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onTitleChange",{get:function(){return this._core.onTitleChange},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"element",{get:function(){return this._core.element},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"parser",{get:function(){return this._checkProposedApi(),this._parser||(this._parser=new O.ParserApi(this._core)),this._parser},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"unicode",{get:function(){return this._checkProposedApi(),new b.UnicodeApi(this._core)},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"textarea",{get:function(){return this._core.textarea},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"rows",{get:function(){return this._core.rows},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"cols",{get:function(){return this._core.cols},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"buffer",{get:function(){return this._checkProposedApi(),this._buffer||(this._buffer=new g.BufferNamespaceApi(this._core)),this._buffer},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"markers",{get:function(){return this._checkProposedApi(),this._core.markers},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"modes",{get:function(){var f=this._core.coreService.decPrivateModes,p="none";switch(this._core.coreMouseService.activeProtocol){case"X10":p="x10";break;case"VT200":p="vt200";break;case"DRAG":p="drag";break;case"ANY":p="any"}return{applicationCursorKeysMode:f.applicationCursorKeys,applicationKeypadMode:f.applicationKeypad,bracketedPasteMode:f.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:p,originMode:f.origin,reverseWraparoundMode:f.reverseWraparound,sendFocusMode:f.sendFocus,wraparoundMode:f.wraparound}},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"options",{get:function(){return this._core.options},enumerable:!1,configurable:!0}),T.prototype.blur=function(){this._core.blur()},T.prototype.focus=function(){this._core.focus()},T.prototype.resize=function(f,p){this._verifyIntegers(f,p),this._core.resize(f,p)},T.prototype.open=function(f){this._core.open(f)},T.prototype.attachCustomKeyEventHandler=function(f){this._core.attachCustomKeyEventHandler(f)},T.prototype.registerLinkMatcher=function(f,p,_){return this._checkProposedApi(),this._core.registerLinkMatcher(f,p,_)},T.prototype.deregisterLinkMatcher=function(f){this._checkProposedApi(),this._core.deregisterLinkMatcher(f)},T.prototype.registerLinkProvider=function(f){return this._checkProposedApi(),this._core.registerLinkProvider(f)},T.prototype.registerCharacterJoiner=function(f){return this._checkProposedApi(),this._core.registerCharacterJoiner(f)},T.prototype.deregisterCharacterJoiner=function(f){this._checkProposedApi(),this._core.deregisterCharacterJoiner(f)},T.prototype.registerMarker=function(f){return this._checkProposedApi(),this._verifyIntegers(f),this._core.addMarker(f)},T.prototype.addMarker=function(f){return this.registerMarker(f)},T.prototype.hasSelection=function(){return this._core.hasSelection()},T.prototype.select=function(f,p,_){this._verifyIntegers(f,p,_),this._core.select(f,p,_)},T.prototype.getSelection=function(){return this._core.getSelection()},T.prototype.getSelectionPosition=function(){return this._core.getSelectionPosition()},T.prototype.clearSelection=function(){this._core.clearSelection()},T.prototype.selectAll=function(){this._core.selectAll()},T.prototype.selectLines=function(f,p){this._verifyIntegers(f,p),this._core.selectLines(f,p)},T.prototype.dispose=function(){this._addonManager.dispose(),this._core.dispose()},T.prototype.scrollLines=function(f){this._verifyIntegers(f),this._core.scrollLines(f)},T.prototype.scrollPages=function(f){this._verifyIntegers(f),this._core.scrollPages(f)},T.prototype.scrollToTop=function(){this._core.scrollToTop()},T.prototype.scrollToBottom=function(){this._core.scrollToBottom()},T.prototype.scrollToLine=function(f){this._verifyIntegers(f),this._core.scrollToLine(f)},T.prototype.clear=function(){this._core.clear()},T.prototype.write=function(f,p){this._core.write(f,p)},T.prototype.writeUtf8=function(f,p){this._core.write(f,p)},T.prototype.writeln=function(f,p){this._core.write(f),this._core.write(`\r
171
- `,p)},T.prototype.paste=function(f){this._core.paste(f)},T.prototype.getOption=function(f){return this._core.optionsService.getOption(f)},T.prototype.setOption=function(f,p){this._core.optionsService.setOption(f,p)},T.prototype.refresh=function(f,p){this._verifyIntegers(f,p),this._core.refresh(f,p)},T.prototype.reset=function(){this._core.reset()},T.prototype.clearTextureAtlas=function(){this._core.clearTextureAtlas()},T.prototype.loadAddon=function(f){return this._addonManager.loadAddon(this,f)},Object.defineProperty(T,"strings",{get:function(){return L},enumerable:!1,configurable:!0}),T.prototype._verifyIntegers=function(){for(var f=[],p=0;p<arguments.length;p++)f[p]=arguments[p];for(var _=0,d=f;_<d.length;_++){var o=d[_];if(o===1/0||isNaN(o)||o%1!=0)throw new Error("This API only accepts integers")}},T}();P.Terminal=D})(),W})()})},15263:(Oe,he,H)=>{"use strict";H.d(he,{Z:()=>O});var k=H(8081),W=H.n(k),P=H(23645),E=H.n(P),L=E()(W());L.push([Oe.id,'@-webkit-keyframes react-loading-skeleton{to{-webkit-transform:translate(100%);transform:translate(100%)}}@keyframes react-loading-skeleton{to{-webkit-transform:translate(100%);transform:translate(100%)}}.react-loading-skeleton{--base-color:#ebebeb;--highlight-color:#f5f5f5;--animation-duration:1.5s;--animation-direction:normal;--pseudo-element-display:block;background-color:var(--base-color);border-radius:.25rem;display:inline-flex;line-height:1;overflow:hidden;position:relative;width:100%;z-index:1}.react-loading-skeleton:after{-webkit-animation-direction:var(--animation-direction);animation-direction:var(--animation-direction);-webkit-animation-duration:var(--animation-duration);animation-duration:var(--animation-duration);-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-name:react-loading-skeleton;animation-name:react-loading-skeleton;-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out;background-image:linear-gradient(90deg,var(--base-color),var(--highlight-color),var(--base-color));background-repeat:no-repeat;content:" ";display:var(--pseudo-element-display);height:100%;left:0;position:absolute;right:0;-webkit-transform:translate(-100%);transform:translate(-100%)}',""]);const O=L},84282:(Oe,he,H)=>{"use strict";var k=H(93379),W=H.n(k),P=H(7795),E=H.n(P),L=H(90569),O=H.n(L),b=H(3565),w=H.n(b),g=H(19216),D=H.n(g),T=H(44589),f=H.n(T),p=H(15263),_={};_.styleTagTransform=f(),_.setAttributes=w(),_.insert=O().bind(null,"head"),_.domAPI=E(),_.insertStyleElement=D();var d=W()(p.Z,_),o=p.Z&&p.Z.locals?p.Z.locals:void 0},14080:(Oe,he,H)=>{"use strict";H.d(he,{y:()=>P,Z:()=>O});var k=H(2784);const W=k.createContext({});function P(g){var D=g,{children:b}=D,w=$d(D,["children"]);return k.createElement(W.Provider,{value:w},b)}const E=!0;function L({baseColor:b,highlightColor:w,width:g,height:D,borderRadius:T,circle:f,direction:p,duration:_,enableAnimation:d=E}){const o={};return p==="rtl"&&(o["--animation-direction"]="reverse"),typeof _=="number"&&(o["--animation-duration"]=`${_}s`),d||(o["--pseudo-element-display"]="none"),(typeof g=="string"||typeof g=="number")&&(o.width=g),(typeof D=="string"||typeof D=="number")&&(o.height=D),(typeof T=="string"||typeof T=="number")&&(o.borderRadius=T),f&&(o.borderRadius="50%"),typeof b!="undefined"&&(o["--base-color"]=b),typeof w!="undefined"&&(o["--highlight-color"]=w),o}function O(d){var o=d,{count:b=1,wrapper:w,className:g,containerClassName:D,containerTestId:T,circle:f=!1,style:p}=o,_=$d(o,["count","wrapper","className","containerClassName","containerTestId","circle","style"]);var s,a;const u=k.useContext(W),l=Ug(ul(ul({},u),_),{circle:f}),A=ul(ul({},p),L(l));let I="react-loading-skeleton";g&&(I+=` ${g}`);const R=(s=l.inline)!==null&&s!==void 0?s:!1,y=[];for(let v=0;v<b;v++){const m=k.createElement("span",{className:I,style:A,key:v},"\u200C");R?y.push(m):y.push(k.createElement(k.Fragment,{key:v},m,k.createElement("br",null)))}return k.createElement("span",{className:D,"data-testid":T,"aria-live":"polite","aria-busy":(a=l.enableAnimation)!==null&&a!==void 0?a:E},w?y.map((v,m)=>k.createElement(w,{key:m},v)):y)}}}]);