49 lines
316 KiB
JavaScript
49 lines
316 KiB
JavaScript
(()=>{var eG=Object.create;var{getPrototypeOf:JK,defineProperty:KY,getOwnPropertyNames:F8,getOwnPropertyDescriptor:YK}=Object,R8=Object.prototype.hasOwnProperty;var IZ=(J,Y,G)=>{G=J!=null?eG(JK(J)):{};let W=Y||!J||!J.__esModule?KY(G,"default",{value:J,enumerable:!0}):G;for(let O of F8(J))if(!R8.call(W,O))KY(W,O,{get:()=>J[O],enumerable:!0});return W},q8=new WeakMap,ZK=(J)=>{var Y=q8.get(J),G;if(Y)return Y;if(Y=KY({},"__esModule",{value:!0}),J&&typeof J==="object"||typeof J==="function")F8(J).map((W)=>!R8.call(Y,W)&&KY(Y,W,{get:()=>J[W],enumerable:!(G=YK(J,W))||G.enumerable}));return q8.set(J,Y),Y},$0=(J,Y)=>()=>(Y||J((Y={exports:{}}).exports,Y),Y.exports);var GK=(J,Y)=>{for(var G in Y)KY(J,G,{get:Y[G],enumerable:!0,configurable:!0,set:(W)=>Y[G]=()=>W})};var A8=$0((N8,kY)=>{/*!
|
|
* jQuery JavaScript Library v3.7.1
|
|
* https://jquery.com/
|
|
*
|
|
* Copyright OpenJS Foundation and other contributors
|
|
* Released under the MIT license
|
|
* https://jquery.org/license
|
|
*
|
|
* Date: 2023-08-28T13:37Z
|
|
*/(function(J,Y){if(typeof kY==="object"&&typeof kY.exports==="object")kY.exports=J.document?Y(J,!0):function(G){if(!G.document)throw Error("jQuery requires a window with a document");return Y(G)};else Y(J)})(typeof window<"u"?window:N8,function(J,Y){var G=[],W=Object.getPrototypeOf,O=G.slice,A=G.flat?function(Z){return G.flat.call(Z)}:function(Z){return G.concat.apply([],Z)},Q=G.push,S=G.indexOf,E={},k=E.toString,X=E.hasOwnProperty,$=X.toString,R=$.call(Object),H={},P=function(K){return typeof K==="function"&&typeof K.nodeType!=="number"&&typeof K.item!=="function"},I=function(K){return K!=null&&K===K.window},D=J.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function n(Z,K,z){z=z||D;var U,B,q=z.createElement("script");if(q.text=Z,K){for(U in c)if(B=K[U]||K.getAttribute&&K.getAttribute(U),B)q.setAttribute(U,B)}z.head.appendChild(q).parentNode.removeChild(q)}function K0(Z){if(Z==null)return Z+"";return typeof Z==="object"||typeof Z==="function"?E[k.call(Z)]||"object":typeof Z}var S0="3.7.1",p0=/HTML$/i,V=function(Z,K){return new V.fn.init(Z,K)};if(V.fn=V.prototype={jquery:S0,constructor:V,length:0,toArray:function(){return O.call(this)},get:function(Z){if(Z==null)return O.call(this);return Z<0?this[Z+this.length]:this[Z]},pushStack:function(Z){var K=V.merge(this.constructor(),Z);return K.prevObject=this,K},each:function(Z){return V.each(this,Z)},map:function(Z){return this.pushStack(V.map(this,function(K,z){return Z.call(K,z,K)}))},slice:function(){return this.pushStack(O.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(V.grep(this,function(Z,K){return(K+1)%2}))},odd:function(){return this.pushStack(V.grep(this,function(Z,K){return K%2}))},eq:function(Z){var K=this.length,z=+Z+(Z<0?K:0);return this.pushStack(z>=0&&z<K?[this[z]]:[])},end:function(){return this.prevObject||this.constructor()},push:Q,sort:G.sort,splice:G.splice},V.extend=V.fn.extend=function(){var Z,K,z,U,B,q,N=arguments[0]||{},C=1,_=arguments.length,T=!1;if(typeof N==="boolean")T=N,N=arguments[C]||{},C++;if(typeof N!=="object"&&!P(N))N={};if(C===_)N=this,C--;for(;C<_;C++)if((Z=arguments[C])!=null)for(K in Z){if(U=Z[K],K==="__proto__"||N===U)continue;if(T&&U&&(V.isPlainObject(U)||(B=Array.isArray(U)))){if(z=N[K],B&&!Array.isArray(z))q=[];else if(!B&&!V.isPlainObject(z))q={};else q=z;B=!1,N[K]=V.extend(T,q,U)}else if(U!==void 0)N[K]=U}return N},V.extend({expando:"jQuery"+(S0+Math.random()).replace(/\D/g,""),isReady:!0,error:function(Z){throw Error(Z)},noop:function(){},isPlainObject:function(Z){var K,z;if(!Z||k.call(Z)!=="[object Object]")return!1;if(K=W(Z),!K)return!0;return z=X.call(K,"constructor")&&K.constructor,typeof z==="function"&&$.call(z)===R},isEmptyObject:function(Z){var K;for(K in Z)return!1;return!0},globalEval:function(Z,K,z){n(Z,{nonce:K&&K.nonce},z)},each:function(Z,K){var z,U=0;if(s0(Z)){z=Z.length;for(;U<z;U++)if(K.call(Z[U],U,Z[U])===!1)break}else for(U in Z)if(K.call(Z[U],U,Z[U])===!1)break;return Z},text:function(Z){var K,z="",U=0,B=Z.nodeType;if(!B)while(K=Z[U++])z+=V.text(K);if(B===1||B===11)return Z.textContent;if(B===9)return Z.documentElement.textContent;if(B===3||B===4)return Z.nodeValue;return z},makeArray:function(Z,K){var z=K||[];if(Z!=null)if(s0(Object(Z)))V.merge(z,typeof Z==="string"?[Z]:Z);else Q.call(z,Z);return z},inArray:function(Z,K,z){return K==null?-1:S.call(K,Z,z)},isXMLDoc:function(Z){var K=Z&&Z.namespaceURI,z=Z&&(Z.ownerDocument||Z).documentElement;return!p0.test(K||z&&z.nodeName||"HTML")},merge:function(Z,K){var z=+K.length,U=0,B=Z.length;for(;U<z;U++)Z[B++]=K[U];return Z.length=B,Z},grep:function(Z,K,z){var U,B=[],q=0,N=Z.length,C=!z;for(;q<N;q++)if(U=!K(Z[q],q),U!==C)B.push(Z[q]);return B},map:function(Z,K,z){var U,B,q=0,N=[];if(s0(Z)){U=Z.length;for(;q<U;q++)if(B=K(Z[q],q,z),B!=null)N.push(B)}else for(q in Z)if(B=K(Z[q],q,z),B!=null)N.push(B);return A(N)},guid:1,support:H}),typeof Symbol==="function")V.fn[Symbol.iterator]=G[Symbol.iterator];V.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(Z,K){E["[object "+K+"]"]=K.toLowerCase()});function s0(Z){var K=!!Z&&"length"in Z&&Z.length,z=K0(Z);if(P(Z)||I(Z))return!1;return z==="array"||K===0||typeof K==="number"&&K>0&&K-1 in Z}function a(Z,K){return Z.nodeName&&Z.nodeName.toLowerCase()===K.toLowerCase()}var{pop:N1,sort:t1,splice:m1}=G,Z0="[\\x20\\t\\r\\n\\f]",y=new RegExp("^"+Z0+"+|((?:^|[^\\\\])(?:\\\\.)*)"+Z0+"+$","g");V.contains=function(Z,K){var z=K&&K.parentNode;return Z===z||!!(z&&z.nodeType===1&&(Z.contains?Z.contains(z):Z.compareDocumentPosition&&Z.compareDocumentPosition(z)&16))};var U0=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;function L0(Z,K){if(K){if(Z==="\x00")return"�";return Z.slice(0,-1)+"\\"+Z.charCodeAt(Z.length-1).toString(16)+" "}return"\\"+Z}V.escapeSelector=function(Z){return(Z+"").replace(U0,L0)};var W1=D,_J=Q;(function(){var Z,K,z,U,B,q=_J,N,C,_,T,b,h=V.expando,j=0,f=0,J0=TY(),V0=TY(),G0=TY(),j0=TY(),T0=function(M,L){if(M===L)B=!0;return 0},M1="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",E1="(?:\\\\[\\da-fA-F]{1,6}"+Z0+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\x00-\\x7f])+",z0="\\["+Z0+"*("+E1+")(?:"+Z0+"*([*^$|!~]?=)"+Z0+`*(?:'((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)"|(`+E1+"))|)"+Z0+"*\\]",ZJ=":("+E1+`)(?:\\((('((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)")|((?:\\\\.|[^\\\\()[\\]]|`+z0+")*)|.*)\\)|)",B0=new RegExp(Z0+"+","g"),Q0=new RegExp("^"+Z0+"*,"+Z0+"*"),YY=new RegExp("^"+Z0+"*([>+~]|"+Z0+")"+Z0+"*"),SZ=new RegExp(Z0+"|>"),_1=new RegExp(ZJ),ZY=new RegExp("^"+E1+"$"),S1={ID:new RegExp("^#("+E1+")"),CLASS:new RegExp("^\\.("+E1+")"),TAG:new RegExp("^("+E1+"|[*])"),ATTR:new RegExp("^"+z0),PSEUDO:new RegExp("^"+ZJ),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+Z0+"*(even|odd|(([+-]|)(\\d*)n|)"+Z0+"*(?:([+-]|)"+Z0+"*(\\d+)|))"+Z0+"*\\)|)","i"),bool:new RegExp("^(?:"+M1+")$","i"),needsContext:new RegExp("^"+Z0+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+Z0+"*((?:-\\d)?\\d*)"+Z0+"*\\)|)(?=[^-]|$)","i")},p1=/^(?:input|select|textarea|button)$/i,u1=/^h\d$/i,J1=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,PZ=/[+~]/,x1=new RegExp("\\\\[\\da-fA-F]{1,6}"+Z0+"?|\\\\([^\\r\\n\\f])","g"),b1=function(M,L){var w="0x"+M.slice(1)-65536;if(L)return L;return w<0?String.fromCharCode(w+65536):String.fromCharCode(w>>10|55296,w&1023|56320)},lG=function(){c1()},nG=wY(function(M){return M.disabled===!0&&a(M,"fieldset")},{dir:"parentNode",next:"legend"});function sG(){try{return N.activeElement}catch(M){}}try{q.apply(G=O.call(W1.childNodes),W1.childNodes),G[W1.childNodes.length].nodeType}catch(M){q={apply:function(L,w){_J.apply(L,O.call(w))},call:function(L){_J.apply(L,O.call(arguments,1))}}}function R0(M,L,w,x){var v,p,d,s,i,W0,e,Y0=L&&L.ownerDocument,X0=L?L.nodeType:9;if(w=w||[],typeof M!=="string"||!M||X0!==1&&X0!==9&&X0!==11)return w;if(!x){if(c1(L),L=L||N,_){if(X0!==11&&(i=J1.exec(M))){if(v=i[1]){if(X0===9)if(d=L.getElementById(v)){if(d.id===v)return q.call(w,d),w}else return w;else if(Y0&&(d=Y0.getElementById(v))&&R0.contains(L,d)&&d.id===v)return q.call(w,d),w}else if(i[2])return q.apply(w,L.getElementsByTagName(M)),w;else if((v=i[3])&&L.getElementsByClassName)return q.apply(w,L.getElementsByClassName(v)),w}if(!j0[M+" "]&&(!T||!T.test(M))){if(e=M,Y0=L,X0===1&&(SZ.test(M)||YY.test(M))){if(Y0=PZ.test(M)&&CZ(L.parentNode)||L,Y0!=L||!H.scope)if(s=L.getAttribute("id"))s=V.escapeSelector(s);else L.setAttribute("id",s=h);W0=GY(M),p=W0.length;while(p--)W0[p]=(s?"#"+s:":scope")+" "+IY(W0[p]);e=W0.join(",")}try{return q.apply(w,Y0.querySelectorAll(e)),w}catch(o){j0(M,!0)}finally{if(s===h)L.removeAttribute("id")}}}}return B8(M.replace(y,"$1"),L,w,x)}function TY(){var M=[];function L(w,x){if(M.push(w+" ")>K.cacheLength)delete L[M.shift()];return L[w+" "]=x}return L}function $1(M){return M[h]=!0,M}function IJ(M){var L=N.createElement("fieldset");try{return!!M(L)}catch(w){return!1}finally{if(L.parentNode)L.parentNode.removeChild(L);L=null}}function aG(M){return function(L){return a(L,"input")&&L.type===M}}function rG(M){return function(L){return(a(L,"input")||a(L,"button"))&&L.type===M}}function V8(M){return function(L){if("form"in L){if(L.parentNode&&L.disabled===!1){if("label"in L)if("label"in L.parentNode)return L.parentNode.disabled===M;else return L.disabled===M;return L.isDisabled===M||L.isDisabled!==!M&&nG(L)===M}return L.disabled===M}else if("label"in L)return L.disabled===M;return!1}}function GJ(M){return $1(function(L){return L=+L,$1(function(w,x){var v,p=M([],w.length,L),d=p.length;while(d--)if(w[v=p[d]])w[v]=!(x[v]=w[v])})})}function CZ(M){return M&&typeof M.getElementsByTagName<"u"&&M}function c1(M){var L,w=M?M.ownerDocument||M:W1;if(w==N||w.nodeType!==9||!w.documentElement)return N;if(N=w,C=N.documentElement,_=!V.isXMLDoc(N),b=C.matches||C.webkitMatchesSelector||C.msMatchesSelector,C.msMatchesSelector&&W1!=N&&(L=N.defaultView)&&L.top!==L)L.addEventListener("unload",lG);if(H.getById=IJ(function(x){return C.appendChild(x).id=V.expando,!N.getElementsByName||!N.getElementsByName(V.expando).length}),H.disconnectedMatch=IJ(function(x){return b.call(x,"*")}),H.scope=IJ(function(){return N.querySelectorAll(":scope")}),H.cssHas=IJ(function(){try{return N.querySelector(":has(*,:jqfake)"),!1}catch(x){return!0}}),H.getById)K.filter.ID=function(x){var v=x.replace(x1,b1);return function(p){return p.getAttribute("id")===v}},K.find.ID=function(x,v){if(typeof v.getElementById<"u"&&_){var p=v.getElementById(x);return p?[p]:[]}};else K.filter.ID=function(x){var v=x.replace(x1,b1);return function(p){var d=typeof p.getAttributeNode<"u"&&p.getAttributeNode("id");return d&&d.value===v}},K.find.ID=function(x,v){if(typeof v.getElementById<"u"&&_){var p,d,s,i=v.getElementById(x);if(i){if(p=i.getAttributeNode("id"),p&&p.value===x)return[i];s=v.getElementsByName(x),d=0;while(i=s[d++])if(p=i.getAttributeNode("id"),p&&p.value===x)return[i]}return[]}};if(K.find.TAG=function(x,v){if(typeof v.getElementsByTagName<"u")return v.getElementsByTagName(x);else return v.querySelectorAll(x)},K.find.CLASS=function(x,v){if(typeof v.getElementsByClassName<"u"&&_)return v.getElementsByClassName(x)},T=[],IJ(function(x){var v;if(C.appendChild(x).innerHTML="<a id='"+h+"' href='' disabled='disabled'></a><select id='"+h+"-\r\\' disabled='disabled'><option selected=''></option></select>",!x.querySelectorAll("[selected]").length)T.push("\\["+Z0+"*(?:value|"+M1+")");if(!x.querySelectorAll("[id~="+h+"-]").length)T.push("~=");if(!x.querySelectorAll("a#"+h+"+*").length)T.push(".#.+[+~]");if(!x.querySelectorAll(":checked").length)T.push(":checked");if(v=N.createElement("input"),v.setAttribute("type","hidden"),x.appendChild(v).setAttribute("name","D"),C.appendChild(x).disabled=!0,x.querySelectorAll(":disabled").length!==2)T.push(":enabled",":disabled");if(v=N.createElement("input"),v.setAttribute("name",""),x.appendChild(v),!x.querySelectorAll("[name='']").length)T.push("\\["+Z0+"*name"+Z0+"*="+Z0+`*(?:''|"")`)}),!H.cssHas)T.push(":has");return T=T.length&&new RegExp(T.join("|")),T0=function(x,v){if(x===v)return B=!0,0;var p=!x.compareDocumentPosition-!v.compareDocumentPosition;if(p)return p;if(p=(x.ownerDocument||x)==(v.ownerDocument||v)?x.compareDocumentPosition(v):1,p&1||!H.sortDetached&&v.compareDocumentPosition(x)===p){if(x===N||x.ownerDocument==W1&&R0.contains(W1,x))return-1;if(v===N||v.ownerDocument==W1&&R0.contains(W1,v))return 1;return U?S.call(U,x)-S.call(U,v):0}return p&4?-1:1},N}R0.matches=function(M,L){return R0(M,null,null,L)},R0.matchesSelector=function(M,L){if(c1(M),_&&!j0[L+" "]&&(!T||!T.test(L)))try{var w=b.call(M,L);if(w||H.disconnectedMatch||M.document&&M.document.nodeType!==11)return w}catch(x){j0(L,!0)}return R0(L,N,null,[M]).length>0},R0.contains=function(M,L){if((M.ownerDocument||M)!=N)c1(M);return V.contains(M,L)},R0.attr=function(M,L){if((M.ownerDocument||M)!=N)c1(M);var w=K.attrHandle[L.toLowerCase()],x=w&&X.call(K.attrHandle,L.toLowerCase())?w(M,L,!_):void 0;if(x!==void 0)return x;return M.getAttribute(L)},R0.error=function(M){throw Error("Syntax error, unrecognized expression: "+M)},V.uniqueSort=function(M){var L,w=[],x=0,v=0;if(B=!H.sortStable,U=!H.sortStable&&O.call(M,0),t1.call(M,T0),B){while(L=M[v++])if(L===M[v])x=w.push(v);while(x--)m1.call(M,w[x],1)}return U=null,M},V.fn.uniqueSort=function(){return this.pushStack(V.uniqueSort(O.apply(this)))},K=V.expr={cacheLength:50,createPseudo:$1,match:S1,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(M){if(M[1]=M[1].replace(x1,b1),M[3]=(M[3]||M[4]||M[5]||"").replace(x1,b1),M[2]==="~=")M[3]=" "+M[3]+" ";return M.slice(0,4)},CHILD:function(M){if(M[1]=M[1].toLowerCase(),M[1].slice(0,3)==="nth"){if(!M[3])R0.error(M[0]);M[4]=+(M[4]?M[5]+(M[6]||1):2*(M[3]==="even"||M[3]==="odd")),M[5]=+(M[7]+M[8]||M[3]==="odd")}else if(M[3])R0.error(M[0]);return M},PSEUDO:function(M){var L,w=!M[6]&&M[2];if(S1.CHILD.test(M[0]))return null;if(M[3])M[2]=M[4]||M[5]||"";else if(w&&_1.test(w)&&(L=GY(w,!0))&&(L=w.indexOf(")",w.length-L)-w.length))M[0]=M[0].slice(0,L),M[2]=w.slice(0,L);return M.slice(0,3)}},filter:{TAG:function(M){var L=M.replace(x1,b1).toLowerCase();return M==="*"?function(){return!0}:function(w){return a(w,L)}},CLASS:function(M){var L=J0[M+" "];return L||(L=new RegExp("(^|"+Z0+")"+M+"("+Z0+"|$)"))&&J0(M,function(w){return L.test(typeof w.className==="string"&&w.className||typeof w.getAttribute<"u"&&w.getAttribute("class")||"")})},ATTR:function(M,L,w){return function(x){var v=R0.attr(x,M);if(v==null)return L==="!=";if(!L)return!0;if(v+="",L==="=")return v===w;if(L==="!=")return v!==w;if(L==="^=")return w&&v.indexOf(w)===0;if(L==="*=")return w&&v.indexOf(w)>-1;if(L==="$=")return w&&v.slice(-w.length)===w;if(L==="~=")return(" "+v.replace(B0," ")+" ").indexOf(w)>-1;if(L==="|=")return v===w||v.slice(0,w.length+1)===w+"-";return!1}},CHILD:function(M,L,w,x,v){var p=M.slice(0,3)!=="nth",d=M.slice(-4)!=="last",s=L==="of-type";return x===1&&v===0?function(i){return!!i.parentNode}:function(i,W0,e){var Y0,X0,o,M0,i0,h0=p!==d?"nextSibling":"previousSibling",Y1=i.parentNode,P1=s&&i.nodeName.toLowerCase(),wJ=!e&&!s,f0=!1;if(Y1){if(p){while(h0){o=i;while(o=o[h0])if(s?a(o,P1):o.nodeType===1)return!1;i0=h0=M==="only"&&!i0&&"nextSibling"}return!0}if(i0=[d?Y1.firstChild:Y1.lastChild],d&&wJ){X0=Y1[h]||(Y1[h]={}),Y0=X0[M]||[],M0=Y0[0]===j&&Y0[1],f0=M0&&Y0[2],o=M0&&Y1.childNodes[M0];while(o=++M0&&o&&o[h0]||(f0=M0=0)||i0.pop())if(o.nodeType===1&&++f0&&o===i){X0[M]=[j,M0,f0];break}}else{if(wJ)X0=i[h]||(i[h]={}),Y0=X0[M]||[],M0=Y0[0]===j&&Y0[1],f0=M0;if(f0===!1){while(o=++M0&&o&&o[h0]||(f0=M0=0)||i0.pop())if((s?a(o,P1):o.nodeType===1)&&++f0){if(wJ)X0=o[h]||(o[h]={}),X0[M]=[j,f0];if(o===i)break}}}return f0-=v,f0===x||f0%x===0&&f0/x>=0}}},PSEUDO:function(M,L){var w,x=K.pseudos[M]||K.setFilters[M.toLowerCase()]||R0.error("unsupported pseudo: "+M);if(x[h])return x(L);if(x.length>1)return w=[M,M,"",L],K.setFilters.hasOwnProperty(M.toLowerCase())?$1(function(v,p){var d,s=x(v,L),i=s.length;while(i--)d=S.call(v,s[i]),v[d]=!(p[d]=s[i])}):function(v){return x(v,0,w)};return x}},pseudos:{not:$1(function(M){var L=[],w=[],x=TZ(M.replace(y,"$1"));return x[h]?$1(function(v,p,d,s){var i,W0=x(v,null,s,[]),e=v.length;while(e--)if(i=W0[e])v[e]=!(p[e]=i)}):function(v,p,d){return L[0]=v,x(L,null,d,w),L[0]=null,!w.pop()}}),has:$1(function(M){return function(L){return R0(M,L).length>0}}),contains:$1(function(M){return M=M.replace(x1,b1),function(L){return(L.textContent||V.text(L)).indexOf(M)>-1}}),lang:$1(function(M){if(!ZY.test(M||""))R0.error("unsupported lang: "+M);return M=M.replace(x1,b1).toLowerCase(),function(L){var w;do if(w=_?L.lang:L.getAttribute("xml:lang")||L.getAttribute("lang"))return w=w.toLowerCase(),w===M||w.indexOf(M+"-")===0;while((L=L.parentNode)&&L.nodeType===1);return!1}}),target:function(M){var L=J.location&&J.location.hash;return L&&L.slice(1)===M.id},root:function(M){return M===C},focus:function(M){return M===sG()&&N.hasFocus()&&!!(M.type||M.href||~M.tabIndex)},enabled:V8(!1),disabled:V8(!0),checked:function(M){return a(M,"input")&&!!M.checked||a(M,"option")&&!!M.selected},selected:function(M){if(M.parentNode)M.parentNode.selectedIndex;return M.selected===!0},empty:function(M){for(M=M.firstChild;M;M=M.nextSibling)if(M.nodeType<6)return!1;return!0},parent:function(M){return!K.pseudos.empty(M)},header:function(M){return u1.test(M.nodeName)},input:function(M){return p1.test(M.nodeName)},button:function(M){return a(M,"input")&&M.type==="button"||a(M,"button")},text:function(M){var L;return a(M,"input")&&M.type==="text"&&((L=M.getAttribute("type"))==null||L.toLowerCase()==="text")},first:GJ(function(){return[0]}),last:GJ(function(M,L){return[L-1]}),eq:GJ(function(M,L,w){return[w<0?w+L:w]}),even:GJ(function(M,L){var w=0;for(;w<L;w+=2)M.push(w);return M}),odd:GJ(function(M,L){var w=1;for(;w<L;w+=2)M.push(w);return M}),lt:GJ(function(M,L,w){var x;if(w<0)x=w+L;else if(w>L)x=L;else x=w;for(;--x>=0;)M.push(x);return M}),gt:GJ(function(M,L,w){var x=w<0?w+L:w;for(;++x<L;)M.push(x);return M})}},K.pseudos.nth=K.pseudos.eq;for(Z in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})K.pseudos[Z]=aG(Z);for(Z in{submit:!0,reset:!0})K.pseudos[Z]=rG(Z);function O8(){}O8.prototype=K.filters=K.pseudos,K.setFilters=new O8;function GY(M,L){var w,x,v,p,d,s,i,W0=V0[M+" "];if(W0)return L?0:W0.slice(0);d=M,s=[],i=K.preFilter;while(d){if(!w||(x=Q0.exec(d))){if(x)d=d.slice(x[0].length)||d;s.push(v=[])}if(w=!1,x=YY.exec(d))w=x.shift(),v.push({value:w,type:x[0].replace(y," ")}),d=d.slice(w.length);for(p in K.filter)if((x=S1[p].exec(d))&&(!i[p]||(x=i[p](x))))w=x.shift(),v.push({value:w,type:p,matches:x}),d=d.slice(w.length);if(!w)break}if(L)return d.length;return d?R0.error(M):V0(M,s).slice(0)}function IY(M){var L=0,w=M.length,x="";for(;L<w;L++)x+=M[L].value;return x}function wY(M,L,w){var{dir:x,next:v}=L,p=v||x,d=w&&p==="parentNode",s=f++;return L.first?function(i,W0,e){while(i=i[x])if(i.nodeType===1||d)return M(i,W0,e);return!1}:function(i,W0,e){var Y0,X0,o=[j,s];if(e){while(i=i[x])if(i.nodeType===1||d){if(M(i,W0,e))return!0}}else while(i=i[x])if(i.nodeType===1||d){if(X0=i[h]||(i[h]={}),v&&a(i,v))i=i[x]||i;else if((Y0=X0[p])&&Y0[0]===j&&Y0[1]===s)return o[2]=Y0[2];else if(X0[p]=o,o[2]=M(i,W0,e))return!0}return!1}}function QZ(M){return M.length>1?function(L,w,x){var v=M.length;while(v--)if(!M[v](L,w,x))return!1;return!0}:M[0]}function oG(M,L,w){var x=0,v=L.length;for(;x<v;x++)R0(M,L[x],w);return w}function jY(M,L,w,x,v){var p,d=[],s=0,i=M.length,W0=L!=null;for(;s<i;s++)if(p=M[s]){if(!w||w(p,x,v)){if(d.push(p),W0)L.push(s)}}return d}function DZ(M,L,w,x,v,p){if(x&&!x[h])x=DZ(x);if(v&&!v[h])v=DZ(v,p);return $1(function(d,s,i,W0){var e,Y0,X0,o,M0=[],i0=[],h0=s.length,Y1=d||oG(L||"*",i.nodeType?[i]:i,[]),P1=M&&(d||!L)?jY(Y1,M0,M,i,W0):Y1;if(w)o=v||(d?M:h0||x)?[]:s,w(P1,o,i,W0);else o=P1;if(x){e=jY(o,i0),x(e,[],i,W0),Y0=e.length;while(Y0--)if(X0=e[Y0])o[i0[Y0]]=!(P1[i0[Y0]]=X0)}if(d){if(v||M){if(v){e=[],Y0=o.length;while(Y0--)if(X0=o[Y0])e.push(P1[Y0]=X0);v(null,o=[],e,W0)}Y0=o.length;while(Y0--)if((X0=o[Y0])&&(e=v?S.call(d,X0):M0[Y0])>-1)d[e]=!(s[e]=X0)}}else if(o=jY(o===s?o.splice(h0,o.length):o),v)v(null,s,o,W0);else q.apply(s,o)})}function LZ(M){var L,w,x,v=M.length,p=K.relative[M[0].type],d=p||K.relative[" "],s=p?1:0,i=wY(function(Y0){return Y0===L},d,!0),W0=wY(function(Y0){return S.call(L,Y0)>-1},d,!0),e=[function(Y0,X0,o){var M0=!p&&(o||X0!=z)||((L=X0).nodeType?i(Y0,X0,o):W0(Y0,X0,o));return L=null,M0}];for(;s<v;s++)if(w=K.relative[M[s].type])e=[wY(QZ(e),w)];else{if(w=K.filter[M[s].type].apply(null,M[s].matches),w[h]){x=++s;for(;x<v;x++)if(K.relative[M[x].type])break;return DZ(s>1&&QZ(e),s>1&&IY(M.slice(0,s-1).concat({value:M[s-2].type===" "?"*":""})).replace(y,"$1"),w,s<x&&LZ(M.slice(s,x)),x<v&&LZ(M=M.slice(x)),x<v&&IY(M))}e.push(w)}return QZ(e)}function tG(M,L){var w=L.length>0,x=M.length>0,v=function(p,d,s,i,W0){var e,Y0,X0,o=0,M0="0",i0=p&&[],h0=[],Y1=z,P1=p||x&&K.find.TAG("*",W0),wJ=j+=Y1==null?1:Math.random()||0.1,f0=P1.length;if(W0)z=d==N||d||W0;for(;M0!==f0&&(e=P1[M0])!=null;M0++){if(x&&e){if(Y0=0,!d&&e.ownerDocument!=N)c1(e),s=!_;while(X0=M[Y0++])if(X0(e,d||N,s)){q.call(i,e);break}if(W0)j=wJ}if(w){if(e=!X0&&e)o--;if(p)i0.push(e)}}if(o+=M0,w&&M0!==o){Y0=0;while(X0=L[Y0++])X0(i0,h0,d,s);if(p){if(o>0){while(M0--)if(!(i0[M0]||h0[M0]))h0[M0]=N1.call(i)}h0=jY(h0)}if(q.apply(i,h0),W0&&!p&&h0.length>0&&o+L.length>1)V.uniqueSort(i)}if(W0)j=wJ,z=Y1;return i0};return w?$1(v):v}function TZ(M,L){var w,x=[],v=[],p=G0[M+" "];if(!p){if(!L)L=GY(M);w=L.length;while(w--)if(p=LZ(L[w]),p[h])x.push(p);else v.push(p);p=G0(M,tG(v,x)),p.selector=M}return p}function B8(M,L,w,x){var v,p,d,s,i,W0=typeof M==="function"&&M,e=!x&&GY(M=W0.selector||M);if(w=w||[],e.length===1){if(p=e[0]=e[0].slice(0),p.length>2&&(d=p[0]).type==="ID"&&L.nodeType===9&&_&&K.relative[p[1].type]){if(L=(K.find.ID(d.matches[0].replace(x1,b1),L)||[])[0],!L)return w;else if(W0)L=L.parentNode;M=M.slice(p.shift().value.length)}v=S1.needsContext.test(M)?0:p.length;while(v--){if(d=p[v],K.relative[s=d.type])break;if(i=K.find[s]){if(x=i(d.matches[0].replace(x1,b1),PZ.test(p[0].type)&&CZ(L.parentNode)||L)){if(p.splice(v,1),M=x.length&&IY(p),!M)return q.apply(w,x),w;break}}}}return(W0||TZ(M,e))(x,L,!_,w,!L||PZ.test(M)&&CZ(L.parentNode)||L),w}H.sortStable=h.split("").sort(T0).join("")===h,c1(),H.sortDetached=IJ(function(M){return M.compareDocumentPosition(N.createElement("fieldset"))&1}),V.find=R0,V.expr[":"]=V.expr.pseudos,V.unique=V.uniqueSort,R0.compile=TZ,R0.select=B8,R0.setDocument=c1,R0.tokenize=GY,R0.escape=V.escapeSelector,R0.getText=V.text,R0.isXML=V.isXMLDoc,R0.selectors=V.expr,R0.support=V.support,R0.uniqueSort=V.uniqueSort})();var t0=function(Z,K,z){var U=[],B=z!==void 0;while((Z=Z[K])&&Z.nodeType!==9)if(Z.nodeType===1){if(B&&V(Z).is(z))break;U.push(Z)}return U},X1=function(Z,K){var z=[];for(;Z;Z=Z.nextSibling)if(Z.nodeType===1&&Z!==K)z.push(Z);return z},T6=V.expr.match.needsContext,I6=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function XZ(Z,K,z){if(P(K))return V.grep(Z,function(U,B){return!!K.call(U,B,U)!==z});if(K.nodeType)return V.grep(Z,function(U){return U===K!==z});if(typeof K!=="string")return V.grep(Z,function(U){return S.call(K,U)>-1!==z});return V.filter(K,Z,z)}V.filter=function(Z,K,z){var U=K[0];if(z)Z=":not("+Z+")";if(K.length===1&&U.nodeType===1)return V.find.matchesSelector(U,Z)?[U]:[];return V.find.matches(Z,V.grep(K,function(B){return B.nodeType===1}))},V.fn.extend({find:function(Z){var K,z,U=this.length,B=this;if(typeof Z!=="string")return this.pushStack(V(Z).filter(function(){for(K=0;K<U;K++)if(V.contains(B[K],this))return!0}));z=this.pushStack([]);for(K=0;K<U;K++)V.find(Z,B[K],z);return U>1?V.uniqueSort(z):z},filter:function(Z){return this.pushStack(XZ(this,Z||[],!1))},not:function(Z){return this.pushStack(XZ(this,Z||[],!0))},is:function(Z){return!!XZ(this,typeof Z==="string"&&T6.test(Z)?V(Z):Z||[],!1).length}});var w6,t9=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,e9=V.fn.init=function(Z,K,z){var U,B;if(!Z)return this;if(z=z||w6,typeof Z==="string"){if(Z[0]==="<"&&Z[Z.length-1]===">"&&Z.length>=3)U=[null,Z,null];else U=t9.exec(Z);if(U&&(U[1]||!K))if(U[1]){if(K=K instanceof V?K[0]:K,V.merge(this,V.parseHTML(U[1],K&&K.nodeType?K.ownerDocument||K:D,!0)),I6.test(U[1])&&V.isPlainObject(K))for(U in K)if(P(this[U]))this[U](K[U]);else this.attr(U,K[U]);return this}else{if(B=D.getElementById(U[2]),B)this[0]=B,this.length=1;return this}else if(!K||K.jquery)return(K||z).find(Z);else return this.constructor(K).find(Z)}else if(Z.nodeType)return this[0]=Z,this.length=1,this;else if(P(Z))return z.ready!==void 0?z.ready(Z):Z(V);return V.makeArray(Z,this)};e9.prototype=V.fn,w6=V(D);var JG=/^(?:parents|prev(?:Until|All))/,YG={children:!0,contents:!0,next:!0,prev:!0};V.fn.extend({has:function(Z){var K=V(Z,this),z=K.length;return this.filter(function(){var U=0;for(;U<z;U++)if(V.contains(this,K[U]))return!0})},closest:function(Z,K){var z,U=0,B=this.length,q=[],N=typeof Z!=="string"&&V(Z);if(!T6.test(Z)){for(;U<B;U++)for(z=this[U];z&&z!==K;z=z.parentNode)if(z.nodeType<11&&(N?N.index(z)>-1:z.nodeType===1&&V.find.matchesSelector(z,Z))){q.push(z);break}}return this.pushStack(q.length>1?V.uniqueSort(q):q)},index:function(Z){if(!Z)return this[0]&&this[0].parentNode?this.first().prevAll().length:-1;if(typeof Z==="string")return S.call(V(Z),this[0]);return S.call(this,Z.jquery?Z[0]:Z)},add:function(Z,K){return this.pushStack(V.uniqueSort(V.merge(this.get(),V(Z,K))))},addBack:function(Z){return this.add(Z==null?this.prevObject:this.prevObject.filter(Z))}});function j6(Z,K){while((Z=Z[K])&&Z.nodeType!==1);return Z}V.each({parent:function(Z){var K=Z.parentNode;return K&&K.nodeType!==11?K:null},parents:function(Z){return t0(Z,"parentNode")},parentsUntil:function(Z,K,z){return t0(Z,"parentNode",z)},next:function(Z){return j6(Z,"nextSibling")},prev:function(Z){return j6(Z,"previousSibling")},nextAll:function(Z){return t0(Z,"nextSibling")},prevAll:function(Z){return t0(Z,"previousSibling")},nextUntil:function(Z,K,z){return t0(Z,"nextSibling",z)},prevUntil:function(Z,K,z){return t0(Z,"previousSibling",z)},siblings:function(Z){return X1((Z.parentNode||{}).firstChild,Z)},children:function(Z){return X1(Z.firstChild)},contents:function(Z){if(Z.contentDocument!=null&&W(Z.contentDocument))return Z.contentDocument;if(a(Z,"template"))Z=Z.content||Z;return V.merge([],Z.childNodes)}},function(Z,K){V.fn[Z]=function(z,U){var B=V.map(this,K,z);if(Z.slice(-5)!=="Until")U=z;if(U&&typeof U==="string")B=V.filter(U,B);if(this.length>1){if(!YG[Z])V.uniqueSort(B);if(JG.test(Z))B.reverse()}return this.pushStack(B)}});var A1=/[^\x20\t\r\n\f]+/g;function ZG(Z){var K={};return V.each(Z.match(A1)||[],function(z,U){K[U]=!0}),K}V.Callbacks=function(Z){Z=typeof Z==="string"?ZG(Z):V.extend({},Z);var K,z,U,B,q=[],N=[],C=-1,_=function(){B=B||Z.once,U=K=!0;for(;N.length;C=-1){z=N.shift();while(++C<q.length)if(q[C].apply(z[0],z[1])===!1&&Z.stopOnFalse)C=q.length,z=!1}if(!Z.memory)z=!1;if(K=!1,B)if(z)q=[];else q=""},T={add:function(){if(q){if(z&&!K)C=q.length-1,N.push(z);if(function b(h){V.each(h,function(j,f){if(P(f)){if(!Z.unique||!T.has(f))q.push(f)}else if(f&&f.length&&K0(f)!=="string")b(f)})}(arguments),z&&!K)_()}return this},remove:function(){return V.each(arguments,function(b,h){var j;while((j=V.inArray(h,q,j))>-1)if(q.splice(j,1),j<=C)C--}),this},has:function(b){return b?V.inArray(b,q)>-1:q.length>0},empty:function(){if(q)q=[];return this},disable:function(){return B=N=[],q=z="",this},disabled:function(){return!q},lock:function(){if(B=N=[],!z&&!K)q=z="";return this},locked:function(){return!!B},fireWith:function(b,h){if(!B){if(h=h||[],h=[b,h.slice?h.slice():h],N.push(h),!K)_()}return this},fire:function(){return T.fireWith(this,arguments),this},fired:function(){return!!U}};return T};function SJ(Z){return Z}function _Y(Z){throw Z}function k6(Z,K,z,U){var B;try{if(Z&&P(B=Z.promise))B.call(Z).done(K).fail(z);else if(Z&&P(B=Z.then))B.call(Z,K,z);else K.apply(void 0,[Z].slice(U))}catch(q){z.apply(void 0,[q])}}V.extend({Deferred:function(Z){var K=[["notify","progress",V.Callbacks("memory"),V.Callbacks("memory"),2],["resolve","done",V.Callbacks("once memory"),V.Callbacks("once memory"),0,"resolved"],["reject","fail",V.Callbacks("once memory"),V.Callbacks("once memory"),1,"rejected"]],z="pending",U={state:function(){return z},always:function(){return B.done(arguments).fail(arguments),this},catch:function(q){return U.then(null,q)},pipe:function(){var q=arguments;return V.Deferred(function(N){V.each(K,function(C,_){var T=P(q[_[4]])&&q[_[4]];B[_[1]](function(){var b=T&&T.apply(this,arguments);if(b&&P(b.promise))b.promise().progress(N.notify).done(N.resolve).fail(N.reject);else N[_[0]+"With"](this,T?[b]:arguments)})}),q=null}).promise()},then:function(q,N,C){var _=0;function T(b,h,j,f){return function(){var J0=this,V0=arguments,G0=function(){var T0,M1;if(b<_)return;if(T0=j.apply(J0,V0),T0===h.promise())throw TypeError("Thenable self-resolution");if(M1=T0&&(typeof T0==="object"||typeof T0==="function")&&T0.then,P(M1))if(f)M1.call(T0,T(_,h,SJ,f),T(_,h,_Y,f));else _++,M1.call(T0,T(_,h,SJ,f),T(_,h,_Y,f),T(_,h,SJ,h.notifyWith));else{if(j!==SJ)J0=void 0,V0=[T0];(f||h.resolveWith)(J0,V0)}},j0=f?G0:function(){try{G0()}catch(T0){if(V.Deferred.exceptionHook)V.Deferred.exceptionHook(T0,j0.error);if(b+1>=_){if(j!==_Y)J0=void 0,V0=[T0];h.rejectWith(J0,V0)}}};if(b)j0();else{if(V.Deferred.getErrorHook)j0.error=V.Deferred.getErrorHook();else if(V.Deferred.getStackHook)j0.error=V.Deferred.getStackHook();J.setTimeout(j0)}}}return V.Deferred(function(b){K[0][3].add(T(0,b,P(C)?C:SJ,b.notifyWith)),K[1][3].add(T(0,b,P(q)?q:SJ)),K[2][3].add(T(0,b,P(N)?N:_Y))}).promise()},promise:function(q){return q!=null?V.extend(q,U):U}},B={};if(V.each(K,function(q,N){var C=N[2],_=N[5];if(U[N[1]]=C.add,_)C.add(function(){z=_},K[3-q][2].disable,K[3-q][3].disable,K[0][2].lock,K[0][3].lock);C.add(N[3].fire),B[N[0]]=function(){return B[N[0]+"With"](this===B?void 0:this,arguments),this},B[N[0]+"With"]=C.fireWith}),U.promise(B),Z)Z.call(B,B);return B},when:function(Z){var K=arguments.length,z=K,U=Array(z),B=O.call(arguments),q=V.Deferred(),N=function(C){return function(_){if(U[C]=this,B[C]=arguments.length>1?O.call(arguments):_,!--K)q.resolveWith(U,B)}};if(K<=1){if(k6(Z,q.done(N(z)).resolve,q.reject,!K),q.state()==="pending"||P(B[z]&&B[z].then))return q.then()}while(z--)k6(B[z],N(z),q.reject);return q.promise()}});var GG=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;V.Deferred.exceptionHook=function(Z,K){if(J.console&&J.console.warn&&Z&&GG.test(Z.name))J.console.warn("jQuery.Deferred exception: "+Z.message,Z.stack,K)},V.readyException=function(Z){J.setTimeout(function(){throw Z})};var zZ=V.Deferred();V.fn.ready=function(Z){return zZ.then(Z).catch(function(K){V.readyException(K)}),this},V.extend({isReady:!1,readyWait:1,ready:function(Z){if(Z===!0?--V.readyWait:V.isReady)return;if(V.isReady=!0,Z!==!0&&--V.readyWait>0)return;zZ.resolveWith(D,[V])}}),V.ready.then=zZ.then;function SY(){D.removeEventListener("DOMContentLoaded",SY),J.removeEventListener("load",SY),V.ready()}if(D.readyState==="complete"||D.readyState!=="loading"&&!D.documentElement.doScroll)J.setTimeout(V.ready);else D.addEventListener("DOMContentLoaded",SY),J.addEventListener("load",SY);var j1=function(Z,K,z,U,B,q,N){var C=0,_=Z.length,T=z==null;if(K0(z)==="object"){B=!0;for(C in z)j1(Z,K,C,z[C],!0,q,N)}else if(U!==void 0){if(B=!0,!P(U))N=!0;if(T)if(N)K.call(Z,U),K=null;else T=K,K=function(b,h,j){return T.call(V(b),j)};if(K)for(;C<_;C++)K(Z[C],z,N?U:U.call(Z[C],C,K(Z[C],z)))}if(B)return Z;if(T)return K.call(Z);return _?K(Z[0],z):q},KG=/^-ms-/,WG=/-([a-z])/g;function XG(Z,K){return K.toUpperCase()}function H1(Z){return Z.replace(KG,"ms-").replace(WG,XG)}var nJ=function(Z){return Z.nodeType===1||Z.nodeType===9||!+Z.nodeType};function sJ(){this.expando=V.expando+sJ.uid++}sJ.uid=1,sJ.prototype={cache:function(Z){var K=Z[this.expando];if(!K){if(K={},nJ(Z))if(Z.nodeType)Z[this.expando]=K;else Object.defineProperty(Z,this.expando,{value:K,configurable:!0})}return K},set:function(Z,K,z){var U,B=this.cache(Z);if(typeof K==="string")B[H1(K)]=z;else for(U in K)B[H1(U)]=K[U];return B},get:function(Z,K){return K===void 0?this.cache(Z):Z[this.expando]&&Z[this.expando][H1(K)]},access:function(Z,K,z){if(K===void 0||K&&typeof K==="string"&&z===void 0)return this.get(Z,K);return this.set(Z,K,z),z!==void 0?z:K},remove:function(Z,K){var z,U=Z[this.expando];if(U===void 0)return;if(K!==void 0){if(Array.isArray(K))K=K.map(H1);else K=H1(K),K=K in U?[K]:K.match(A1)||[];z=K.length;while(z--)delete U[K[z]]}if(K===void 0||V.isEmptyObject(U))if(Z.nodeType)Z[this.expando]=void 0;else delete Z[this.expando]},hasData:function(Z){var K=Z[this.expando];return K!==void 0&&!V.isEmptyObject(K)}};var r=new sJ,u0=new sJ,zG=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,$G=/[A-Z]/g;function UG(Z){if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return null;if(Z===+Z+"")return+Z;if(zG.test(Z))return JSON.parse(Z);return Z}function x6(Z,K,z){var U;if(z===void 0&&Z.nodeType===1)if(U="data-"+K.replace($G,"-$&").toLowerCase(),z=Z.getAttribute(U),typeof z==="string"){try{z=UG(z)}catch(B){}u0.set(Z,K,z)}else z=void 0;return z}V.extend({hasData:function(Z){return u0.hasData(Z)||r.hasData(Z)},data:function(Z,K,z){return u0.access(Z,K,z)},removeData:function(Z,K){u0.remove(Z,K)},_data:function(Z,K,z){return r.access(Z,K,z)},_removeData:function(Z,K){r.remove(Z,K)}}),V.fn.extend({data:function(Z,K){var z,U,B,q=this[0],N=q&&q.attributes;if(Z===void 0){if(this.length){if(B=u0.get(q),q.nodeType===1&&!r.get(q,"hasDataAttrs")){z=N.length;while(z--)if(N[z]){if(U=N[z].name,U.indexOf("data-")===0)U=H1(U.slice(5)),x6(q,U,B[U])}r.set(q,"hasDataAttrs",!0)}}return B}if(typeof Z==="object")return this.each(function(){u0.set(this,Z)});return j1(this,function(C){var _;if(q&&C===void 0){if(_=u0.get(q,Z),_!==void 0)return _;if(_=x6(q,Z),_!==void 0)return _;return}this.each(function(){u0.set(this,Z,C)})},null,K,arguments.length>1,null,!0)},removeData:function(Z){return this.each(function(){u0.remove(this,Z)})}}),V.extend({queue:function(Z,K,z){var U;if(Z){if(K=(K||"fx")+"queue",U=r.get(Z,K),z)if(!U||Array.isArray(z))U=r.access(Z,K,V.makeArray(z));else U.push(z);return U||[]}},dequeue:function(Z,K){K=K||"fx";var z=V.queue(Z,K),U=z.length,B=z.shift(),q=V._queueHooks(Z,K),N=function(){V.dequeue(Z,K)};if(B==="inprogress")B=z.shift(),U--;if(B){if(K==="fx")z.unshift("inprogress");delete q.stop,B.call(Z,N,q)}if(!U&&q)q.empty.fire()},_queueHooks:function(Z,K){var z=K+"queueHooks";return r.get(Z,z)||r.access(Z,z,{empty:V.Callbacks("once memory").add(function(){r.remove(Z,[K+"queue",z])})})}}),V.fn.extend({queue:function(Z,K){var z=2;if(typeof Z!=="string")K=Z,Z="fx",z--;if(arguments.length<z)return V.queue(this[0],Z);return K===void 0?this:this.each(function(){var U=V.queue(this,Z,K);if(V._queueHooks(this,Z),Z==="fx"&&U[0]!=="inprogress")V.dequeue(this,Z)})},dequeue:function(Z){return this.each(function(){V.dequeue(this,Z)})},clearQueue:function(Z){return this.queue(Z||"fx",[])},promise:function(Z,K){var z,U=1,B=V.Deferred(),q=this,N=this.length,C=function(){if(!--U)B.resolveWith(q,[q])};if(typeof Z!=="string")K=Z,Z=void 0;Z=Z||"fx";while(N--)if(z=r.get(q[N],Z+"queueHooks"),z&&z.empty)U++,z.empty.add(C);return C(),B.promise(K)}});var b6=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,aJ=new RegExp("^(?:([+-])=|)("+b6+")([a-z%]*)$","i"),k1=["Top","Right","Bottom","Left"],e1=D.documentElement,PJ=function(Z){return V.contains(Z.ownerDocument,Z)},VG={composed:!0};if(e1.getRootNode)PJ=function(Z){return V.contains(Z.ownerDocument,Z)||Z.getRootNode(VG)===Z.ownerDocument};var PY=function(Z,K){return Z=K||Z,Z.style.display==="none"||Z.style.display===""&&PJ(Z)&&V.css(Z,"display")==="none"};function v6(Z,K,z,U){var B,q,N=20,C=U?function(){return U.cur()}:function(){return V.css(Z,K,"")},_=C(),T=z&&z[3]||(V.cssNumber[K]?"":"px"),b=Z.nodeType&&(V.cssNumber[K]||T!=="px"&&+_)&&aJ.exec(V.css(Z,K));if(b&&b[3]!==T){_=_/2,T=T||b[3],b=+_||1;while(N--){if(V.style(Z,K,b+T),(1-q)*(1-(q=C()/_||0.5))<=0)N=0;b=b/q}b=b*2,V.style(Z,K,b+T),z=z||[]}if(z){if(b=+b||+_||0,B=z[1]?b+(z[1]+1)*z[2]:+z[2],U)U.unit=T,U.start=b,U.end=B}return B}var h6={};function OG(Z){var K,z=Z.ownerDocument,U=Z.nodeName,B=h6[U];if(B)return B;if(K=z.body.appendChild(z.createElement(U)),B=V.css(K,"display"),K.parentNode.removeChild(K),B==="none")B="block";return h6[U]=B,B}function CJ(Z,K){var z,U,B=[],q=0,N=Z.length;for(;q<N;q++){if(U=Z[q],!U.style)continue;if(z=U.style.display,K){if(z==="none"){if(B[q]=r.get(U,"display")||null,!B[q])U.style.display=""}if(U.style.display===""&&PY(U))B[q]=OG(U)}else if(z!=="none")B[q]="none",r.set(U,"display",z)}for(q=0;q<N;q++)if(B[q]!=null)Z[q].style.display=B[q];return Z}V.fn.extend({show:function(){return CJ(this,!0)},hide:function(){return CJ(this)},toggle:function(Z){if(typeof Z==="boolean")return Z?this.show():this.hide();return this.each(function(){if(PY(this))V(this).show();else V(this).hide()})}});var rJ=/^(?:checkbox|radio)$/i,y6=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,f6=/^$|^module$|\/(?:java|ecma)script/i;(function(){var Z=D.createDocumentFragment(),K=Z.appendChild(D.createElement("div")),z=D.createElement("input");z.setAttribute("type","radio"),z.setAttribute("checked","checked"),z.setAttribute("name","t"),K.appendChild(z),H.checkClone=K.cloneNode(!0).cloneNode(!0).lastChild.checked,K.innerHTML="<textarea>x</textarea>",H.noCloneChecked=!!K.cloneNode(!0).lastChild.defaultValue,K.innerHTML="<option></option>",H.option=!!K.lastChild})();var e0={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};if(e0.tbody=e0.tfoot=e0.colgroup=e0.caption=e0.thead,e0.th=e0.td,!H.option)e0.optgroup=e0.option=[1,"<select multiple='multiple'>","</select>"];function c0(Z,K){var z;if(typeof Z.getElementsByTagName<"u")z=Z.getElementsByTagName(K||"*");else if(typeof Z.querySelectorAll<"u")z=Z.querySelectorAll(K||"*");else z=[];if(K===void 0||K&&a(Z,K))return V.merge([Z],z);return z}function $Z(Z,K){var z=0,U=Z.length;for(;z<U;z++)r.set(Z[z],"globalEval",!K||r.get(K[z],"globalEval"))}var BG=/<|&#?\w+;/;function g6(Z,K,z,U,B){var q,N,C,_,T,b,h=K.createDocumentFragment(),j=[],f=0,J0=Z.length;for(;f<J0;f++)if(q=Z[f],q||q===0)if(K0(q)==="object")V.merge(j,q.nodeType?[q]:q);else if(!BG.test(q))j.push(K.createTextNode(q));else{N=N||h.appendChild(K.createElement("div")),C=(y6.exec(q)||["",""])[1].toLowerCase(),_=e0[C]||e0._default,N.innerHTML=_[1]+V.htmlPrefilter(q)+_[2],b=_[0];while(b--)N=N.lastChild;V.merge(j,N.childNodes),N=h.firstChild,N.textContent=""}h.textContent="",f=0;while(q=j[f++]){if(U&&V.inArray(q,U)>-1){if(B)B.push(q);continue}if(T=PJ(q),N=c0(h.appendChild(q),"script"),T)$Z(N);if(z){b=0;while(q=N[b++])if(f6.test(q.type||""))z.push(q)}}return h}var m6=/^([^.]*)(?:\.(.+)|)/;function QJ(){return!0}function DJ(){return!1}function UZ(Z,K,z,U,B,q){var N,C;if(typeof K==="object"){if(typeof z!=="string")U=U||z,z=void 0;for(C in K)UZ(Z,C,z,U,K[C],q);return Z}if(U==null&&B==null)B=z,U=z=void 0;else if(B==null)if(typeof z==="string")B=U,U=void 0;else B=U,U=z,z=void 0;if(B===!1)B=DJ;else if(!B)return Z;if(q===1)N=B,B=function(_){return V().off(_),N.apply(this,arguments)},B.guid=N.guid||(N.guid=V.guid++);return Z.each(function(){V.event.add(this,K,B,U,z)})}V.event={global:{},add:function(Z,K,z,U,B){var q,N,C,_,T,b,h,j,f,J0,V0,G0=r.get(Z);if(!nJ(Z))return;if(z.handler)q=z,z=q.handler,B=q.selector;if(B)V.find.matchesSelector(e1,B);if(!z.guid)z.guid=V.guid++;if(!(_=G0.events))_=G0.events=Object.create(null);if(!(N=G0.handle))N=G0.handle=function(j0){return typeof V<"u"&&V.event.triggered!==j0.type?V.event.dispatch.apply(Z,arguments):void 0};K=(K||"").match(A1)||[""],T=K.length;while(T--){if(C=m6.exec(K[T])||[],f=V0=C[1],J0=(C[2]||"").split(".").sort(),!f)continue;if(h=V.event.special[f]||{},f=(B?h.delegateType:h.bindType)||f,h=V.event.special[f]||{},b=V.extend({type:f,origType:V0,data:U,handler:z,guid:z.guid,selector:B,needsContext:B&&V.expr.match.needsContext.test(B),namespace:J0.join(".")},q),!(j=_[f])){if(j=_[f]=[],j.delegateCount=0,!h.setup||h.setup.call(Z,U,J0,N)===!1){if(Z.addEventListener)Z.addEventListener(f,N)}}if(h.add){if(h.add.call(Z,b),!b.handler.guid)b.handler.guid=z.guid}if(B)j.splice(j.delegateCount++,0,b);else j.push(b);V.event.global[f]=!0}},remove:function(Z,K,z,U,B){var q,N,C,_,T,b,h,j,f,J0,V0,G0=r.hasData(Z)&&r.get(Z);if(!G0||!(_=G0.events))return;K=(K||"").match(A1)||[""],T=K.length;while(T--){if(C=m6.exec(K[T])||[],f=V0=C[1],J0=(C[2]||"").split(".").sort(),!f){for(f in _)V.event.remove(Z,f+K[T],z,U,!0);continue}h=V.event.special[f]||{},f=(U?h.delegateType:h.bindType)||f,j=_[f]||[],C=C[2]&&new RegExp("(^|\\.)"+J0.join("\\.(?:.*\\.|)")+"(\\.|$)"),N=q=j.length;while(q--)if(b=j[q],(B||V0===b.origType)&&(!z||z.guid===b.guid)&&(!C||C.test(b.namespace))&&(!U||U===b.selector||U==="**"&&b.selector)){if(j.splice(q,1),b.selector)j.delegateCount--;if(h.remove)h.remove.call(Z,b)}if(N&&!j.length){if(!h.teardown||h.teardown.call(Z,J0,G0.handle)===!1)V.removeEvent(Z,f,G0.handle);delete _[f]}}if(V.isEmptyObject(_))r.remove(Z,"handle events")},dispatch:function(Z){var K,z,U,B,q,N,C=Array(arguments.length),_=V.event.fix(Z),T=(r.get(this,"events")||Object.create(null))[_.type]||[],b=V.event.special[_.type]||{};C[0]=_;for(K=1;K<arguments.length;K++)C[K]=arguments[K];if(_.delegateTarget=this,b.preDispatch&&b.preDispatch.call(this,_)===!1)return;N=V.event.handlers.call(this,_,T),K=0;while((B=N[K++])&&!_.isPropagationStopped()){_.currentTarget=B.elem,z=0;while((q=B.handlers[z++])&&!_.isImmediatePropagationStopped())if(!_.rnamespace||q.namespace===!1||_.rnamespace.test(q.namespace)){if(_.handleObj=q,_.data=q.data,U=((V.event.special[q.origType]||{}).handle||q.handler).apply(B.elem,C),U!==void 0){if((_.result=U)===!1)_.preventDefault(),_.stopPropagation()}}}if(b.postDispatch)b.postDispatch.call(this,_);return _.result},handlers:function(Z,K){var z,U,B,q,N,C=[],_=K.delegateCount,T=Z.target;if(_&&T.nodeType&&!(Z.type==="click"&&Z.button>=1)){for(;T!==this;T=T.parentNode||this)if(T.nodeType===1&&!(Z.type==="click"&&T.disabled===!0)){q=[],N={};for(z=0;z<_;z++){if(U=K[z],B=U.selector+" ",N[B]===void 0)N[B]=U.needsContext?V(B,this).index(T)>-1:V.find(B,this,null,[T]).length;if(N[B])q.push(U)}if(q.length)C.push({elem:T,handlers:q})}}if(T=this,_<K.length)C.push({elem:T,handlers:K.slice(_)});return C},addProp:function(Z,K){Object.defineProperty(V.Event.prototype,Z,{enumerable:!0,configurable:!0,get:P(K)?function(){if(this.originalEvent)return K(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[Z]},set:function(z){Object.defineProperty(this,Z,{enumerable:!0,configurable:!0,writable:!0,value:z})}})},fix:function(Z){return Z[V.expando]?Z:new V.Event(Z)},special:{load:{noBubble:!0},click:{setup:function(Z){var K=this||Z;if(rJ.test(K.type)&&K.click&&a(K,"input"))CY(K,"click",!0);return!1},trigger:function(Z){var K=this||Z;if(rJ.test(K.type)&&K.click&&a(K,"input"))CY(K,"click");return!0},_default:function(Z){var K=Z.target;return rJ.test(K.type)&&K.click&&a(K,"input")&&r.get(K,"click")||a(K,"a")}},beforeunload:{postDispatch:function(Z){if(Z.result!==void 0&&Z.originalEvent)Z.originalEvent.returnValue=Z.result}}}};function CY(Z,K,z){if(!z){if(r.get(Z,K)===void 0)V.event.add(Z,K,QJ);return}r.set(Z,K,!1),V.event.add(Z,K,{namespace:!1,handler:function(U){var B,q=r.get(this,K);if(U.isTrigger&1&&this[K]){if(!q){if(q=O.call(arguments),r.set(this,K,q),this[K](),B=r.get(this,K),r.set(this,K,!1),q!==B)return U.stopImmediatePropagation(),U.preventDefault(),B}else if((V.event.special[K]||{}).delegateType)U.stopPropagation()}else if(q)r.set(this,K,V.event.trigger(q[0],q.slice(1),this)),U.stopPropagation(),U.isImmediatePropagationStopped=QJ}})}V.removeEvent=function(Z,K,z){if(Z.removeEventListener)Z.removeEventListener(K,z)},V.Event=function(Z,K){if(!(this instanceof V.Event))return new V.Event(Z,K);if(Z&&Z.type)this.originalEvent=Z,this.type=Z.type,this.isDefaultPrevented=Z.defaultPrevented||Z.defaultPrevented===void 0&&Z.returnValue===!1?QJ:DJ,this.target=Z.target&&Z.target.nodeType===3?Z.target.parentNode:Z.target,this.currentTarget=Z.currentTarget,this.relatedTarget=Z.relatedTarget;else this.type=Z;if(K)V.extend(this,K);this.timeStamp=Z&&Z.timeStamp||Date.now(),this[V.expando]=!0},V.Event.prototype={constructor:V.Event,isDefaultPrevented:DJ,isPropagationStopped:DJ,isImmediatePropagationStopped:DJ,isSimulated:!1,preventDefault:function(){var Z=this.originalEvent;if(this.isDefaultPrevented=QJ,Z&&!this.isSimulated)Z.preventDefault()},stopPropagation:function(){var Z=this.originalEvent;if(this.isPropagationStopped=QJ,Z&&!this.isSimulated)Z.stopPropagation()},stopImmediatePropagation:function(){var Z=this.originalEvent;if(this.isImmediatePropagationStopped=QJ,Z&&!this.isSimulated)Z.stopImmediatePropagation();this.stopPropagation()}},V.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,char:!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:!0},V.event.addProp),V.each({focus:"focusin",blur:"focusout"},function(Z,K){function z(U){if(D.documentMode){var B=r.get(this,"handle"),q=V.event.fix(U);if(q.type=U.type==="focusin"?"focus":"blur",q.isSimulated=!0,B(U),q.target===q.currentTarget)B(q)}else V.event.simulate(K,U.target,V.event.fix(U))}V.event.special[Z]={setup:function(){var U;if(CY(this,Z,!0),D.documentMode){if(U=r.get(this,K),!U)this.addEventListener(K,z);r.set(this,K,(U||0)+1)}else return!1},trigger:function(){return CY(this,Z),!0},teardown:function(){var U;if(D.documentMode)if(U=r.get(this,K)-1,!U)this.removeEventListener(K,z),r.remove(this,K);else r.set(this,K,U);else return!1},_default:function(U){return r.get(U.target,Z)},delegateType:K},V.event.special[K]={setup:function(){var U=this.ownerDocument||this.document||this,B=D.documentMode?this:U,q=r.get(B,K);if(!q)if(D.documentMode)this.addEventListener(K,z);else U.addEventListener(Z,z,!0);r.set(B,K,(q||0)+1)},teardown:function(){var U=this.ownerDocument||this.document||this,B=D.documentMode?this:U,q=r.get(B,K)-1;if(!q){if(D.documentMode)this.removeEventListener(K,z);else U.removeEventListener(Z,z,!0);r.remove(B,K)}else r.set(B,K,q)}}}),V.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(Z,K){V.event.special[Z]={delegateType:K,bindType:K,handle:function(z){var U,B=this,q=z.relatedTarget,N=z.handleObj;if(!q||q!==B&&!V.contains(B,q))z.type=N.origType,U=N.handler.apply(this,arguments),z.type=K;return U}}}),V.fn.extend({on:function(Z,K,z,U){return UZ(this,Z,K,z,U)},one:function(Z,K,z,U){return UZ(this,Z,K,z,U,1)},off:function(Z,K,z){var U,B;if(Z&&Z.preventDefault&&Z.handleObj)return U=Z.handleObj,V(Z.delegateTarget).off(U.namespace?U.origType+"."+U.namespace:U.origType,U.selector,U.handler),this;if(typeof Z==="object"){for(B in Z)this.off(B,K,Z[B]);return this}if(K===!1||typeof K==="function")z=K,K=void 0;if(z===!1)z=DJ;return this.each(function(){V.event.remove(this,Z,z,K)})}});var qG=/<script|<style|<link/i,FG=/checked\s*(?:[^=]|=\s*.checked.)/i,RG=/^\s*<!\[CDATA\[|\]\]>\s*$/g;function p6(Z,K){if(a(Z,"table")&&a(K.nodeType!==11?K:K.firstChild,"tr"))return V(Z).children("tbody")[0]||Z;return Z}function NG(Z){return Z.type=(Z.getAttribute("type")!==null)+"/"+Z.type,Z}function AG(Z){if((Z.type||"").slice(0,5)==="true/")Z.type=Z.type.slice(5);else Z.removeAttribute("type");return Z}function u6(Z,K){var z,U,B,q,N,C,_;if(K.nodeType!==1)return;if(r.hasData(Z)){if(q=r.get(Z),_=q.events,_){r.remove(K,"handle events");for(B in _)for(z=0,U=_[B].length;z<U;z++)V.event.add(K,B,_[B][z])}}if(u0.hasData(Z))N=u0.access(Z),C=V.extend({},N),u0.set(K,C)}function HG(Z,K){var z=K.nodeName.toLowerCase();if(z==="input"&&rJ.test(Z.type))K.checked=Z.checked;else if(z==="input"||z==="textarea")K.defaultValue=Z.defaultValue}function LJ(Z,K,z,U){K=A(K);var B,q,N,C,_,T,b=0,h=Z.length,j=h-1,f=K[0],J0=P(f);if(J0||h>1&&typeof f==="string"&&!H.checkClone&&FG.test(f))return Z.each(function(V0){var G0=Z.eq(V0);if(J0)K[0]=f.call(this,V0,G0.html());LJ(G0,K,z,U)});if(h){if(B=g6(K,Z[0].ownerDocument,!1,Z,U),q=B.firstChild,B.childNodes.length===1)B=q;if(q||U){N=V.map(c0(B,"script"),NG),C=N.length;for(;b<h;b++){if(_=B,b!==j){if(_=V.clone(_,!0,!0),C)V.merge(N,c0(_,"script"))}z.call(Z[b],_,b)}if(C){T=N[N.length-1].ownerDocument,V.map(N,AG);for(b=0;b<C;b++)if(_=N[b],f6.test(_.type||"")&&!r.access(_,"globalEval")&&V.contains(T,_))if(_.src&&(_.type||"").toLowerCase()!=="module"){if(V._evalUrl&&!_.noModule)V._evalUrl(_.src,{nonce:_.nonce||_.getAttribute("nonce")},T)}else n(_.textContent.replace(RG,""),_,T)}}}return Z}function c6(Z,K,z){var U,B=K?V.filter(K,Z):Z,q=0;for(;(U=B[q])!=null;q++){if(!z&&U.nodeType===1)V.cleanData(c0(U));if(U.parentNode){if(z&&PJ(U))$Z(c0(U,"script"));U.parentNode.removeChild(U)}}return Z}V.extend({htmlPrefilter:function(Z){return Z},clone:function(Z,K,z){var U,B,q,N,C=Z.cloneNode(!0),_=PJ(Z);if(!H.noCloneChecked&&(Z.nodeType===1||Z.nodeType===11)&&!V.isXMLDoc(Z)){N=c0(C),q=c0(Z);for(U=0,B=q.length;U<B;U++)HG(q[U],N[U])}if(K)if(z){q=q||c0(Z),N=N||c0(C);for(U=0,B=q.length;U<B;U++)u6(q[U],N[U])}else u6(Z,C);if(N=c0(C,"script"),N.length>0)$Z(N,!_&&c0(Z,"script"));return C},cleanData:function(Z){var K,z,U,B=V.event.special,q=0;for(;(z=Z[q])!==void 0;q++)if(nJ(z)){if(K=z[r.expando]){if(K.events)for(U in K.events)if(B[U])V.event.remove(z,U);else V.removeEvent(z,U,K.handle);z[r.expando]=void 0}if(z[u0.expando])z[u0.expando]=void 0}}}),V.fn.extend({detach:function(Z){return c6(this,Z,!0)},remove:function(Z){return c6(this,Z)},text:function(Z){return j1(this,function(K){return K===void 0?V.text(this):this.empty().each(function(){if(this.nodeType===1||this.nodeType===11||this.nodeType===9)this.textContent=K})},null,Z,arguments.length)},append:function(){return LJ(this,arguments,function(Z){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var K=p6(this,Z);K.appendChild(Z)}})},prepend:function(){return LJ(this,arguments,function(Z){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var K=p6(this,Z);K.insertBefore(Z,K.firstChild)}})},before:function(){return LJ(this,arguments,function(Z){if(this.parentNode)this.parentNode.insertBefore(Z,this)})},after:function(){return LJ(this,arguments,function(Z){if(this.parentNode)this.parentNode.insertBefore(Z,this.nextSibling)})},empty:function(){var Z,K=0;for(;(Z=this[K])!=null;K++)if(Z.nodeType===1)V.cleanData(c0(Z,!1)),Z.textContent="";return this},clone:function(Z,K){return Z=Z==null?!1:Z,K=K==null?Z:K,this.map(function(){return V.clone(this,Z,K)})},html:function(Z){return j1(this,function(K){var z=this[0]||{},U=0,B=this.length;if(K===void 0&&z.nodeType===1)return z.innerHTML;if(typeof K==="string"&&!qG.test(K)&&!e0[(y6.exec(K)||["",""])[1].toLowerCase()]){K=V.htmlPrefilter(K);try{for(;U<B;U++)if(z=this[U]||{},z.nodeType===1)V.cleanData(c0(z,!1)),z.innerHTML=K;z=0}catch(q){}}if(z)this.empty().append(K)},null,Z,arguments.length)},replaceWith:function(){var Z=[];return LJ(this,arguments,function(K){var z=this.parentNode;if(V.inArray(this,Z)<0){if(V.cleanData(c0(this)),z)z.replaceChild(K,this)}},Z)}}),V.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(Z,K){V.fn[Z]=function(z){var U,B=[],q=V(z),N=q.length-1,C=0;for(;C<=N;C++)U=C===N?this:this.clone(!0),V(q[C])[K](U),Q.apply(B,U.get());return this.pushStack(B)}});var VZ=new RegExp("^("+b6+")(?!px)[a-z%]+$","i"),OZ=/^--/,QY=function(Z){var K=Z.ownerDocument.defaultView;if(!K||!K.opener)K=J;return K.getComputedStyle(Z)},d6=function(Z,K,z){var U,B,q={};for(B in K)q[B]=Z.style[B],Z.style[B]=K[B];U=z.call(Z);for(B in K)Z.style[B]=q[B];return U},MG=new RegExp(k1.join("|"),"i");(function(){function Z(){if(!T)return;_.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",T.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",e1.appendChild(_).appendChild(T);var b=J.getComputedStyle(T);z=b.top!=="1%",C=K(b.marginLeft)===12,T.style.right="60%",q=K(b.right)===36,U=K(b.width)===36,T.style.position="absolute",B=K(T.offsetWidth/3)===12,e1.removeChild(_),T=null}function K(b){return Math.round(parseFloat(b))}var z,U,B,q,N,C,_=D.createElement("div"),T=D.createElement("div");if(!T.style)return;T.style.backgroundClip="content-box",T.cloneNode(!0).style.backgroundClip="",H.clearCloneStyle=T.style.backgroundClip==="content-box",V.extend(H,{boxSizingReliable:function(){return Z(),U},pixelBoxStyles:function(){return Z(),q},pixelPosition:function(){return Z(),z},reliableMarginLeft:function(){return Z(),C},scrollboxSize:function(){return Z(),B},reliableTrDimensions:function(){var b,h,j,f;if(N==null)b=D.createElement("table"),h=D.createElement("tr"),j=D.createElement("div"),b.style.cssText="position:absolute;left:-11111px;border-collapse:separate",h.style.cssText="box-sizing:content-box;border:1px solid",h.style.height="1px",j.style.height="9px",j.style.display="block",e1.appendChild(b).appendChild(h).appendChild(j),f=J.getComputedStyle(h),N=parseInt(f.height,10)+parseInt(f.borderTopWidth,10)+parseInt(f.borderBottomWidth,10)===h.offsetHeight,e1.removeChild(b);return N}})})();function oJ(Z,K,z){var U,B,q,N,C=OZ.test(K),_=Z.style;if(z=z||QY(Z),z){if(N=z.getPropertyValue(K)||z[K],C&&N)N=N.replace(y,"$1")||void 0;if(N===""&&!PJ(Z))N=V.style(Z,K);if(!H.pixelBoxStyles()&&VZ.test(N)&&MG.test(K))U=_.width,B=_.minWidth,q=_.maxWidth,_.minWidth=_.maxWidth=_.width=N,N=z.width,_.width=U,_.minWidth=B,_.maxWidth=q}return N!==void 0?N+"":N}function i6(Z,K){return{get:function(){if(Z()){delete this.get;return}return(this.get=K).apply(this,arguments)}}}var l6=["Webkit","Moz","ms"],n6=D.createElement("div").style,s6={};function EG(Z){var K=Z[0].toUpperCase()+Z.slice(1),z=l6.length;while(z--)if(Z=l6[z]+K,Z in n6)return Z}function BZ(Z){var K=V.cssProps[Z]||s6[Z];if(K)return K;if(Z in n6)return Z;return s6[Z]=EG(Z)||Z}var _G=/^(none|table(?!-c[ea]).+)/,SG={position:"absolute",visibility:"hidden",display:"block"},a6={letterSpacing:"0",fontWeight:"400"};function r6(Z,K,z){var U=aJ.exec(K);return U?Math.max(0,U[2]-(z||0))+(U[3]||"px"):K}function qZ(Z,K,z,U,B,q){var N=K==="width"?1:0,C=0,_=0,T=0;if(z===(U?"border":"content"))return 0;for(;N<4;N+=2){if(z==="margin")T+=V.css(Z,z+k1[N],!0,B);if(!U)if(_+=V.css(Z,"padding"+k1[N],!0,B),z!=="padding")_+=V.css(Z,"border"+k1[N]+"Width",!0,B);else C+=V.css(Z,"border"+k1[N]+"Width",!0,B);else{if(z==="content")_-=V.css(Z,"padding"+k1[N],!0,B);if(z!=="margin")_-=V.css(Z,"border"+k1[N]+"Width",!0,B)}}if(!U&&q>=0)_+=Math.max(0,Math.ceil(Z["offset"+K[0].toUpperCase()+K.slice(1)]-q-_-C-0.5))||0;return _+T}function o6(Z,K,z){var U=QY(Z),B=!H.boxSizingReliable()||z,q=B&&V.css(Z,"boxSizing",!1,U)==="border-box",N=q,C=oJ(Z,K,U),_="offset"+K[0].toUpperCase()+K.slice(1);if(VZ.test(C)){if(!z)return C;C="auto"}if((!H.boxSizingReliable()&&q||!H.reliableTrDimensions()&&a(Z,"tr")||C==="auto"||!parseFloat(C)&&V.css(Z,"display",!1,U)==="inline")&&Z.getClientRects().length){if(q=V.css(Z,"boxSizing",!1,U)==="border-box",N=_ in Z,N)C=Z[_]}return C=parseFloat(C)||0,C+qZ(Z,K,z||(q?"border":"content"),N,U,C)+"px"}V.extend({cssHooks:{opacity:{get:function(Z,K){if(K){var z=oJ(Z,"opacity");return z===""?"1":z}}}},cssNumber:{animationIterationCount:!0,aspectRatio:!0,borderImageSlice:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,scale:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeMiterlimit:!0,strokeOpacity:!0},cssProps:{},style:function(Z,K,z,U){if(!Z||Z.nodeType===3||Z.nodeType===8||!Z.style)return;var B,q,N,C=H1(K),_=OZ.test(K),T=Z.style;if(!_)K=BZ(C);if(N=V.cssHooks[K]||V.cssHooks[C],z!==void 0){if(q=typeof z,q==="string"&&(B=aJ.exec(z))&&B[1])z=v6(Z,K,B),q="number";if(z==null||z!==z)return;if(q==="number"&&!_)z+=B&&B[3]||(V.cssNumber[C]?"":"px");if(!H.clearCloneStyle&&z===""&&K.indexOf("background")===0)T[K]="inherit";if(!N||!("set"in N)||(z=N.set(Z,z,U))!==void 0)if(_)T.setProperty(K,z);else T[K]=z}else{if(N&&"get"in N&&(B=N.get(Z,!1,U))!==void 0)return B;return T[K]}},css:function(Z,K,z,U){var B,q,N,C=H1(K),_=OZ.test(K);if(!_)K=BZ(C);if(N=V.cssHooks[K]||V.cssHooks[C],N&&"get"in N)B=N.get(Z,!0,z);if(B===void 0)B=oJ(Z,K,U);if(B==="normal"&&K in a6)B=a6[K];if(z===""||z)return q=parseFloat(B),z===!0||isFinite(q)?q||0:B;return B}}),V.each(["height","width"],function(Z,K){V.cssHooks[K]={get:function(z,U,B){if(U)return _G.test(V.css(z,"display"))&&(!z.getClientRects().length||!z.getBoundingClientRect().width)?d6(z,SG,function(){return o6(z,K,B)}):o6(z,K,B)},set:function(z,U,B){var q,N=QY(z),C=!H.scrollboxSize()&&N.position==="absolute",_=C||B,T=_&&V.css(z,"boxSizing",!1,N)==="border-box",b=B?qZ(z,K,B,T,N):0;if(T&&C)b-=Math.ceil(z["offset"+K[0].toUpperCase()+K.slice(1)]-parseFloat(N[K])-qZ(z,K,"border",!1,N)-0.5);if(b&&(q=aJ.exec(U))&&(q[3]||"px")!=="px")z.style[K]=U,U=V.css(z,K);return r6(z,U,b)}}}),V.cssHooks.marginLeft=i6(H.reliableMarginLeft,function(Z,K){if(K)return(parseFloat(oJ(Z,"marginLeft"))||Z.getBoundingClientRect().left-d6(Z,{marginLeft:0},function(){return Z.getBoundingClientRect().left}))+"px"}),V.each({margin:"",padding:"",border:"Width"},function(Z,K){if(V.cssHooks[Z+K]={expand:function(z){var U=0,B={},q=typeof z==="string"?z.split(" "):[z];for(;U<4;U++)B[Z+k1[U]+K]=q[U]||q[U-2]||q[0];return B}},Z!=="margin")V.cssHooks[Z+K].set=r6}),V.fn.extend({css:function(Z,K){return j1(this,function(z,U,B){var q,N,C={},_=0;if(Array.isArray(U)){q=QY(z),N=U.length;for(;_<N;_++)C[U[_]]=V.css(z,U[_],!1,q);return C}return B!==void 0?V.style(z,U,B):V.css(z,U)},Z,K,arguments.length>1)}});function d0(Z,K,z,U,B){return new d0.prototype.init(Z,K,z,U,B)}V.Tween=d0,d0.prototype={constructor:d0,init:function(Z,K,z,U,B,q){this.elem=Z,this.prop=z,this.easing=B||V.easing._default,this.options=K,this.start=this.now=this.cur(),this.end=U,this.unit=q||(V.cssNumber[z]?"":"px")},cur:function(){var Z=d0.propHooks[this.prop];return Z&&Z.get?Z.get(this):d0.propHooks._default.get(this)},run:function(Z){var K,z=d0.propHooks[this.prop];if(this.options.duration)this.pos=K=V.easing[this.easing](Z,this.options.duration*Z,0,1,this.options.duration);else this.pos=K=Z;if(this.now=(this.end-this.start)*K+this.start,this.options.step)this.options.step.call(this.elem,this.now,this);if(z&&z.set)z.set(this);else d0.propHooks._default.set(this);return this}},d0.prototype.init.prototype=d0.prototype,d0.propHooks={_default:{get:function(Z){var K;if(Z.elem.nodeType!==1||Z.elem[Z.prop]!=null&&Z.elem.style[Z.prop]==null)return Z.elem[Z.prop];return K=V.css(Z.elem,Z.prop,""),!K||K==="auto"?0:K},set:function(Z){if(V.fx.step[Z.prop])V.fx.step[Z.prop](Z);else if(Z.elem.nodeType===1&&(V.cssHooks[Z.prop]||Z.elem.style[BZ(Z.prop)]!=null))V.style(Z.elem,Z.prop,Z.now+Z.unit);else Z.elem[Z.prop]=Z.now}}},d0.propHooks.scrollTop=d0.propHooks.scrollLeft={set:function(Z){if(Z.elem.nodeType&&Z.elem.parentNode)Z.elem[Z.prop]=Z.now}},V.easing={linear:function(Z){return Z},swing:function(Z){return 0.5-Math.cos(Z*Math.PI)/2},_default:"swing"},V.fx=d0.prototype.init,V.fx.step={};var TJ,DY,PG=/^(?:toggle|show|hide)$/,CG=/queueHooks$/;function FZ(){if(DY){if(D.hidden===!1&&J.requestAnimationFrame)J.requestAnimationFrame(FZ);else J.setTimeout(FZ,V.fx.interval);V.fx.tick()}}function t6(){return J.setTimeout(function(){TJ=void 0}),TJ=Date.now()}function LY(Z,K){var z,U=0,B={height:Z};K=K?1:0;for(;U<4;U+=2-K)z=k1[U],B["margin"+z]=B["padding"+z]=Z;if(K)B.opacity=B.width=Z;return B}function e6(Z,K,z){var U,B=(z1.tweeners[K]||[]).concat(z1.tweeners["*"]),q=0,N=B.length;for(;q<N;q++)if(U=B[q].call(z,K,Z))return U}function QG(Z,K,z){var U,B,q,N,C,_,T,b,h="width"in K||"height"in K,j=this,f={},J0=Z.style,V0=Z.nodeType&&PY(Z),G0=r.get(Z,"fxshow");if(!z.queue){if(N=V._queueHooks(Z,"fx"),N.unqueued==null)N.unqueued=0,C=N.empty.fire,N.empty.fire=function(){if(!N.unqueued)C()};N.unqueued++,j.always(function(){j.always(function(){if(N.unqueued--,!V.queue(Z,"fx").length)N.empty.fire()})})}for(U in K)if(B=K[U],PG.test(B)){if(delete K[U],q=q||B==="toggle",B===(V0?"hide":"show"))if(B==="show"&&G0&&G0[U]!==void 0)V0=!0;else continue;f[U]=G0&&G0[U]||V.style(Z,U)}if(_=!V.isEmptyObject(K),!_&&V.isEmptyObject(f))return;if(h&&Z.nodeType===1){if(z.overflow=[J0.overflow,J0.overflowX,J0.overflowY],T=G0&&G0.display,T==null)T=r.get(Z,"display");if(b=V.css(Z,"display"),b==="none")if(T)b=T;else CJ([Z],!0),T=Z.style.display||T,b=V.css(Z,"display"),CJ([Z]);if(b==="inline"||b==="inline-block"&&T!=null){if(V.css(Z,"float")==="none"){if(!_){if(j.done(function(){J0.display=T}),T==null)b=J0.display,T=b==="none"?"":b}J0.display="inline-block"}}}if(z.overflow)J0.overflow="hidden",j.always(function(){J0.overflow=z.overflow[0],J0.overflowX=z.overflow[1],J0.overflowY=z.overflow[2]});_=!1;for(U in f){if(!_){if(G0){if("hidden"in G0)V0=G0.hidden}else G0=r.access(Z,"fxshow",{display:T});if(q)G0.hidden=!V0;if(V0)CJ([Z],!0);j.done(function(){if(!V0)CJ([Z]);r.remove(Z,"fxshow");for(U in f)V.style(Z,U,f[U])})}if(_=e6(V0?G0[U]:0,U,j),!(U in G0)){if(G0[U]=_.start,V0)_.end=_.start,_.start=0}}}function DG(Z,K){var z,U,B,q,N;for(z in Z){if(U=H1(z),B=K[U],q=Z[z],Array.isArray(q))B=q[1],q=Z[z]=q[0];if(z!==U)Z[U]=q,delete Z[z];if(N=V.cssHooks[U],N&&"expand"in N){q=N.expand(q),delete Z[U];for(z in q)if(!(z in Z))Z[z]=q[z],K[z]=B}else K[U]=B}}function z1(Z,K,z){var U,B,q=0,N=z1.prefilters.length,C=V.Deferred().always(function(){delete _.elem}),_=function(){if(B)return!1;var h=TJ||t6(),j=Math.max(0,T.startTime+T.duration-h),f=j/T.duration||0,J0=1-f,V0=0,G0=T.tweens.length;for(;V0<G0;V0++)T.tweens[V0].run(J0);if(C.notifyWith(Z,[T,J0,j]),J0<1&&G0)return j;if(!G0)C.notifyWith(Z,[T,1,0]);return C.resolveWith(Z,[T]),!1},T=C.promise({elem:Z,props:V.extend({},K),opts:V.extend(!0,{specialEasing:{},easing:V.easing._default},z),originalProperties:K,originalOptions:z,startTime:TJ||t6(),duration:z.duration,tweens:[],createTween:function(h,j){var f=V.Tween(Z,T.opts,h,j,T.opts.specialEasing[h]||T.opts.easing);return T.tweens.push(f),f},stop:function(h){var j=0,f=h?T.tweens.length:0;if(B)return this;B=!0;for(;j<f;j++)T.tweens[j].run(1);if(h)C.notifyWith(Z,[T,1,0]),C.resolveWith(Z,[T,h]);else C.rejectWith(Z,[T,h]);return this}}),b=T.props;DG(b,T.opts.specialEasing);for(;q<N;q++)if(U=z1.prefilters[q].call(T,Z,b,T.opts),U){if(P(U.stop))V._queueHooks(T.elem,T.opts.queue).stop=U.stop.bind(U);return U}if(V.map(b,e6,T),P(T.opts.start))T.opts.start.call(Z,T);return T.progress(T.opts.progress).done(T.opts.done,T.opts.complete).fail(T.opts.fail).always(T.opts.always),V.fx.timer(V.extend(_,{elem:Z,anim:T,queue:T.opts.queue})),T}V.Animation=V.extend(z1,{tweeners:{"*":[function(Z,K){var z=this.createTween(Z,K);return v6(z.elem,Z,aJ.exec(K),z),z}]},tweener:function(Z,K){if(P(Z))K=Z,Z=["*"];else Z=Z.match(A1);var z,U=0,B=Z.length;for(;U<B;U++)z=Z[U],z1.tweeners[z]=z1.tweeners[z]||[],z1.tweeners[z].unshift(K)},prefilters:[QG],prefilter:function(Z,K){if(K)z1.prefilters.unshift(Z);else z1.prefilters.push(Z)}}),V.speed=function(Z,K,z){var U=Z&&typeof Z==="object"?V.extend({},Z):{complete:z||!z&&K||P(Z)&&Z,duration:Z,easing:z&&K||K&&!P(K)&&K};if(V.fx.off)U.duration=0;else if(typeof U.duration!=="number")if(U.duration in V.fx.speeds)U.duration=V.fx.speeds[U.duration];else U.duration=V.fx.speeds._default;if(U.queue==null||U.queue===!0)U.queue="fx";return U.old=U.complete,U.complete=function(){if(P(U.old))U.old.call(this);if(U.queue)V.dequeue(this,U.queue)},U},V.fn.extend({fadeTo:function(Z,K,z,U){return this.filter(PY).css("opacity",0).show().end().animate({opacity:K},Z,z,U)},animate:function(Z,K,z,U){var B=V.isEmptyObject(Z),q=V.speed(K,z,U),N=function(){var C=z1(this,V.extend({},Z),q);if(B||r.get(this,"finish"))C.stop(!0)};return N.finish=N,B||q.queue===!1?this.each(N):this.queue(q.queue,N)},stop:function(Z,K,z){var U=function(B){var q=B.stop;delete B.stop,q(z)};if(typeof Z!=="string")z=K,K=Z,Z=void 0;if(K)this.queue(Z||"fx",[]);return this.each(function(){var B=!0,q=Z!=null&&Z+"queueHooks",N=V.timers,C=r.get(this);if(q){if(C[q]&&C[q].stop)U(C[q])}else for(q in C)if(C[q]&&C[q].stop&&CG.test(q))U(C[q]);for(q=N.length;q--;)if(N[q].elem===this&&(Z==null||N[q].queue===Z))N[q].anim.stop(z),B=!1,N.splice(q,1);if(B||!z)V.dequeue(this,Z)})},finish:function(Z){if(Z!==!1)Z=Z||"fx";return this.each(function(){var K,z=r.get(this),U=z[Z+"queue"],B=z[Z+"queueHooks"],q=V.timers,N=U?U.length:0;if(z.finish=!0,V.queue(this,Z,[]),B&&B.stop)B.stop.call(this,!0);for(K=q.length;K--;)if(q[K].elem===this&&q[K].queue===Z)q[K].anim.stop(!0),q.splice(K,1);for(K=0;K<N;K++)if(U[K]&&U[K].finish)U[K].finish.call(this);delete z.finish})}}),V.each(["toggle","show","hide"],function(Z,K){var z=V.fn[K];V.fn[K]=function(U,B,q){return U==null||typeof U==="boolean"?z.apply(this,arguments):this.animate(LY(K,!0),U,B,q)}}),V.each({slideDown:LY("show"),slideUp:LY("hide"),slideToggle:LY("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(Z,K){V.fn[Z]=function(z,U,B){return this.animate(K,z,U,B)}}),V.timers=[],V.fx.tick=function(){var Z,K=0,z=V.timers;TJ=Date.now();for(;K<z.length;K++)if(Z=z[K],!Z()&&z[K]===Z)z.splice(K--,1);if(!z.length)V.fx.stop();TJ=void 0},V.fx.timer=function(Z){V.timers.push(Z),V.fx.start()},V.fx.interval=13,V.fx.start=function(){if(DY)return;DY=!0,FZ()},V.fx.stop=function(){DY=null},V.fx.speeds={slow:600,fast:200,_default:400},V.fn.delay=function(Z,K){return Z=V.fx?V.fx.speeds[Z]||Z:Z,K=K||"fx",this.queue(K,function(z,U){var B=J.setTimeout(z,Z);U.stop=function(){J.clearTimeout(B)}})},function(){var Z=D.createElement("input"),K=D.createElement("select"),z=K.appendChild(D.createElement("option"));Z.type="checkbox",H.checkOn=Z.value!=="",H.optSelected=z.selected,Z=D.createElement("input"),Z.value="t",Z.type="radio",H.radioValue=Z.value==="t"}();var J8,tJ=V.expr.attrHandle;V.fn.extend({attr:function(Z,K){return j1(this,V.attr,Z,K,arguments.length>1)},removeAttr:function(Z){return this.each(function(){V.removeAttr(this,Z)})}}),V.extend({attr:function(Z,K,z){var U,B,q=Z.nodeType;if(q===3||q===8||q===2)return;if(typeof Z.getAttribute>"u")return V.prop(Z,K,z);if(q!==1||!V.isXMLDoc(Z))B=V.attrHooks[K.toLowerCase()]||(V.expr.match.bool.test(K)?J8:void 0);if(z!==void 0){if(z===null){V.removeAttr(Z,K);return}if(B&&"set"in B&&(U=B.set(Z,z,K))!==void 0)return U;return Z.setAttribute(K,z+""),z}if(B&&"get"in B&&(U=B.get(Z,K))!==null)return U;return U=V.find.attr(Z,K),U==null?void 0:U},attrHooks:{type:{set:function(Z,K){if(!H.radioValue&&K==="radio"&&a(Z,"input")){var z=Z.value;if(Z.setAttribute("type",K),z)Z.value=z;return K}}}},removeAttr:function(Z,K){var z,U=0,B=K&&K.match(A1);if(B&&Z.nodeType===1)while(z=B[U++])Z.removeAttribute(z)}}),J8={set:function(Z,K,z){if(K===!1)V.removeAttr(Z,z);else Z.setAttribute(z,z);return z}},V.each(V.expr.match.bool.source.match(/\w+/g),function(Z,K){var z=tJ[K]||V.find.attr;tJ[K]=function(U,B,q){var N,C,_=B.toLowerCase();if(!q)C=tJ[_],tJ[_]=N,N=z(U,B,q)!=null?_:null,tJ[_]=C;return N}});var LG=/^(?:input|select|textarea|button)$/i,TG=/^(?:a|area)$/i;if(V.fn.extend({prop:function(Z,K){return j1(this,V.prop,Z,K,arguments.length>1)},removeProp:function(Z){return this.each(function(){delete this[V.propFix[Z]||Z]})}}),V.extend({prop:function(Z,K,z){var U,B,q=Z.nodeType;if(q===3||q===8||q===2)return;if(q!==1||!V.isXMLDoc(Z))K=V.propFix[K]||K,B=V.propHooks[K];if(z!==void 0){if(B&&"set"in B&&(U=B.set(Z,z,K))!==void 0)return U;return Z[K]=z}if(B&&"get"in B&&(U=B.get(Z,K))!==null)return U;return Z[K]},propHooks:{tabIndex:{get:function(Z){var K=V.find.attr(Z,"tabindex");if(K)return parseInt(K,10);if(LG.test(Z.nodeName)||TG.test(Z.nodeName)&&Z.href)return 0;return-1}}},propFix:{for:"htmlFor",class:"className"}}),!H.optSelected)V.propHooks.selected={get:function(Z){var K=Z.parentNode;if(K&&K.parentNode)K.parentNode.selectedIndex;return null},set:function(Z){var K=Z.parentNode;if(K){if(K.selectedIndex,K.parentNode)K.parentNode.selectedIndex}}};V.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){V.propFix[this.toLowerCase()]=this});function JJ(Z){var K=Z.match(A1)||[];return K.join(" ")}function YJ(Z){return Z.getAttribute&&Z.getAttribute("class")||""}function RZ(Z){if(Array.isArray(Z))return Z;if(typeof Z==="string")return Z.match(A1)||[];return[]}V.fn.extend({addClass:function(Z){var K,z,U,B,q,N;if(P(Z))return this.each(function(C){V(this).addClass(Z.call(this,C,YJ(this)))});if(K=RZ(Z),K.length)return this.each(function(){if(U=YJ(this),z=this.nodeType===1&&" "+JJ(U)+" ",z){for(q=0;q<K.length;q++)if(B=K[q],z.indexOf(" "+B+" ")<0)z+=B+" ";if(N=JJ(z),U!==N)this.setAttribute("class",N)}});return this},removeClass:function(Z){var K,z,U,B,q,N;if(P(Z))return this.each(function(C){V(this).removeClass(Z.call(this,C,YJ(this)))});if(!arguments.length)return this.attr("class","");if(K=RZ(Z),K.length)return this.each(function(){if(U=YJ(this),z=this.nodeType===1&&" "+JJ(U)+" ",z){for(q=0;q<K.length;q++){B=K[q];while(z.indexOf(" "+B+" ")>-1)z=z.replace(" "+B+" "," ")}if(N=JJ(z),U!==N)this.setAttribute("class",N)}});return this},toggleClass:function(Z,K){var z,U,B,q,N=typeof Z,C=N==="string"||Array.isArray(Z);if(P(Z))return this.each(function(_){V(this).toggleClass(Z.call(this,_,YJ(this),K),K)});if(typeof K==="boolean"&&C)return K?this.addClass(Z):this.removeClass(Z);return z=RZ(Z),this.each(function(){if(C){q=V(this);for(B=0;B<z.length;B++)if(U=z[B],q.hasClass(U))q.removeClass(U);else q.addClass(U)}else if(Z===void 0||N==="boolean"){if(U=YJ(this),U)r.set(this,"__className__",U);if(this.setAttribute)this.setAttribute("class",U||Z===!1?"":r.get(this,"__className__")||"")}})},hasClass:function(Z){var K,z,U=0;K=" "+Z+" ";while(z=this[U++])if(z.nodeType===1&&(" "+JJ(YJ(z))+" ").indexOf(K)>-1)return!0;return!1}});var IG=/\r/g;V.fn.extend({val:function(Z){var K,z,U,B=this[0];if(!arguments.length){if(B){if(K=V.valHooks[B.type]||V.valHooks[B.nodeName.toLowerCase()],K&&"get"in K&&(z=K.get(B,"value"))!==void 0)return z;if(z=B.value,typeof z==="string")return z.replace(IG,"");return z==null?"":z}return}return U=P(Z),this.each(function(q){var N;if(this.nodeType!==1)return;if(U)N=Z.call(this,q,V(this).val());else N=Z;if(N==null)N="";else if(typeof N==="number")N+="";else if(Array.isArray(N))N=V.map(N,function(C){return C==null?"":C+""});if(K=V.valHooks[this.type]||V.valHooks[this.nodeName.toLowerCase()],!K||!("set"in K)||K.set(this,N,"value")===void 0)this.value=N})}}),V.extend({valHooks:{option:{get:function(Z){var K=V.find.attr(Z,"value");return K!=null?K:JJ(V.text(Z))}},select:{get:function(Z){var K,z,U,B=Z.options,q=Z.selectedIndex,N=Z.type==="select-one",C=N?null:[],_=N?q+1:B.length;if(q<0)U=_;else U=N?q:0;for(;U<_;U++)if(z=B[U],(z.selected||U===q)&&!z.disabled&&(!z.parentNode.disabled||!a(z.parentNode,"optgroup"))){if(K=V(z).val(),N)return K;C.push(K)}return C},set:function(Z,K){var z,U,B=Z.options,q=V.makeArray(K),N=B.length;while(N--)if(U=B[N],U.selected=V.inArray(V.valHooks.option.get(U),q)>-1)z=!0;if(!z)Z.selectedIndex=-1;return q}}}}),V.each(["radio","checkbox"],function(){if(V.valHooks[this]={set:function(Z,K){if(Array.isArray(K))return Z.checked=V.inArray(V(Z).val(),K)>-1}},!H.checkOn)V.valHooks[this].get=function(Z){return Z.getAttribute("value")===null?"on":Z.value}});var eJ=J.location,Y8={guid:Date.now()},NZ=/\?/;V.parseXML=function(Z){var K,z;if(!Z||typeof Z!=="string")return null;try{K=new J.DOMParser().parseFromString(Z,"text/xml")}catch(U){}if(z=K&&K.getElementsByTagName("parsererror")[0],!K||z)V.error("Invalid XML: "+(z?V.map(z.childNodes,function(U){return U.textContent}).join(`
|
|
`):Z));return K};var Z8=/^(?:focusinfocus|focusoutblur)$/,G8=function(Z){Z.stopPropagation()};V.extend(V.event,{trigger:function(Z,K,z,U){var B,q,N,C,_,T,b,h,j=[z||D],f=X.call(Z,"type")?Z.type:Z,J0=X.call(Z,"namespace")?Z.namespace.split("."):[];if(q=h=N=z=z||D,z.nodeType===3||z.nodeType===8)return;if(Z8.test(f+V.event.triggered))return;if(f.indexOf(".")>-1)J0=f.split("."),f=J0.shift(),J0.sort();if(_=f.indexOf(":")<0&&"on"+f,Z=Z[V.expando]?Z:new V.Event(f,typeof Z==="object"&&Z),Z.isTrigger=U?2:3,Z.namespace=J0.join("."),Z.rnamespace=Z.namespace?new RegExp("(^|\\.)"+J0.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,Z.result=void 0,!Z.target)Z.target=z;if(K=K==null?[Z]:V.makeArray(K,[Z]),b=V.event.special[f]||{},!U&&b.trigger&&b.trigger.apply(z,K)===!1)return;if(!U&&!b.noBubble&&!I(z)){if(C=b.delegateType||f,!Z8.test(C+f))q=q.parentNode;for(;q;q=q.parentNode)j.push(q),N=q;if(N===(z.ownerDocument||D))j.push(N.defaultView||N.parentWindow||J)}B=0;while((q=j[B++])&&!Z.isPropagationStopped()){if(h=q,Z.type=B>1?C:b.bindType||f,T=(r.get(q,"events")||Object.create(null))[Z.type]&&r.get(q,"handle"),T)T.apply(q,K);if(T=_&&q[_],T&&T.apply&&nJ(q)){if(Z.result=T.apply(q,K),Z.result===!1)Z.preventDefault()}}if(Z.type=f,!U&&!Z.isDefaultPrevented()){if((!b._default||b._default.apply(j.pop(),K)===!1)&&nJ(z)){if(_&&P(z[f])&&!I(z)){if(N=z[_],N)z[_]=null;if(V.event.triggered=f,Z.isPropagationStopped())h.addEventListener(f,G8);if(z[f](),Z.isPropagationStopped())h.removeEventListener(f,G8);if(V.event.triggered=void 0,N)z[_]=N}}}return Z.result},simulate:function(Z,K,z){var U=V.extend(new V.Event,z,{type:Z,isSimulated:!0});V.event.trigger(U,null,K)}}),V.fn.extend({trigger:function(Z,K){return this.each(function(){V.event.trigger(Z,K,this)})},triggerHandler:function(Z,K){var z=this[0];if(z)return V.event.trigger(Z,K,z,!0)}});var wG=/\[\]$/,K8=/\r?\n/g,jG=/^(?:submit|button|image|reset|file)$/i,kG=/^(?:input|select|textarea|keygen)/i;function AZ(Z,K,z,U){var B;if(Array.isArray(K))V.each(K,function(q,N){if(z||wG.test(Z))U(Z,N);else AZ(Z+"["+(typeof N==="object"&&N!=null?q:"")+"]",N,z,U)});else if(!z&&K0(K)==="object")for(B in K)AZ(Z+"["+B+"]",K[B],z,U);else U(Z,K)}V.param=function(Z,K){var z,U=[],B=function(q,N){var C=P(N)?N():N;U[U.length]=encodeURIComponent(q)+"="+encodeURIComponent(C==null?"":C)};if(Z==null)return"";if(Array.isArray(Z)||Z.jquery&&!V.isPlainObject(Z))V.each(Z,function(){B(this.name,this.value)});else for(z in Z)AZ(z,Z[z],K,B);return U.join("&")},V.fn.extend({serialize:function(){return V.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var Z=V.prop(this,"elements");return Z?V.makeArray(Z):this}).filter(function(){var Z=this.type;return this.name&&!V(this).is(":disabled")&&kG.test(this.nodeName)&&!jG.test(Z)&&(this.checked||!rJ.test(Z))}).map(function(Z,K){var z=V(this).val();if(z==null)return null;if(Array.isArray(z))return V.map(z,function(U){return{name:K.name,value:U.replace(K8,`\r
|
|
`)}});return{name:K.name,value:z.replace(K8,`\r
|
|
`)}}).get()}});var xG=/%20/g,bG=/#.*$/,vG=/([?&])_=[^&]*/,hG=/^(.*?):[ \t]*([^\r\n]*)$/mg,yG=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,fG=/^(?:GET|HEAD)$/,gG=/^\/\//,W8={},HZ={},X8="*/".concat("*"),MZ=D.createElement("a");MZ.href=eJ.href;function z8(Z){return function(K,z){if(typeof K!=="string")z=K,K="*";var U,B=0,q=K.toLowerCase().match(A1)||[];if(P(z))while(U=q[B++])if(U[0]==="+")U=U.slice(1)||"*",(Z[U]=Z[U]||[]).unshift(z);else(Z[U]=Z[U]||[]).push(z)}}function $8(Z,K,z,U){var B={},q=Z===HZ;function N(C){var _;return B[C]=!0,V.each(Z[C]||[],function(T,b){var h=b(K,z,U);if(typeof h==="string"&&!q&&!B[h])return K.dataTypes.unshift(h),N(h),!1;else if(q)return!(_=h)}),_}return N(K.dataTypes[0])||!B["*"]&&N("*")}function EZ(Z,K){var z,U,B=V.ajaxSettings.flatOptions||{};for(z in K)if(K[z]!==void 0)(B[z]?Z:U||(U={}))[z]=K[z];if(U)V.extend(!0,Z,U);return Z}function mG(Z,K,z){var U,B,q,N,C=Z.contents,_=Z.dataTypes;while(_[0]==="*")if(_.shift(),U===void 0)U=Z.mimeType||K.getResponseHeader("Content-Type");if(U){for(B in C)if(C[B]&&C[B].test(U)){_.unshift(B);break}}if(_[0]in z)q=_[0];else{for(B in z){if(!_[0]||Z.converters[B+" "+_[0]]){q=B;break}if(!N)N=B}q=q||N}if(q){if(q!==_[0])_.unshift(q);return z[q]}}function pG(Z,K,z,U){var B,q,N,C,_,T={},b=Z.dataTypes.slice();if(b[1])for(N in Z.converters)T[N.toLowerCase()]=Z.converters[N];q=b.shift();while(q){if(Z.responseFields[q])z[Z.responseFields[q]]=K;if(!_&&U&&Z.dataFilter)K=Z.dataFilter(K,Z.dataType);if(_=q,q=b.shift(),q){if(q==="*")q=_;else if(_!=="*"&&_!==q){if(N=T[_+" "+q]||T["* "+q],!N){for(B in T)if(C=B.split(" "),C[1]===q){if(N=T[_+" "+C[0]]||T["* "+C[0]],N){if(N===!0)N=T[B];else if(T[B]!==!0)q=C[0],b.unshift(C[1]);break}}}if(N!==!0)if(N&&Z.throws)K=N(K);else try{K=N(K)}catch(h){return{state:"parsererror",error:N?h:"No conversion from "+_+" to "+q}}}}}return{state:"success",data:K}}V.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:eJ.href,type:"GET",isLocal:yG.test(eJ.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":X8,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":V.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(Z,K){return K?EZ(EZ(Z,V.ajaxSettings),K):EZ(V.ajaxSettings,Z)},ajaxPrefilter:z8(W8),ajaxTransport:z8(HZ),ajax:function(Z,K){if(typeof Z==="object")K=Z,Z=void 0;K=K||{};var z,U,B,q,N,C,_,T,b,h,j=V.ajaxSetup({},K),f=j.context||j,J0=j.context&&(f.nodeType||f.jquery)?V(f):V.event,V0=V.Deferred(),G0=V.Callbacks("once memory"),j0=j.statusCode||{},T0={},M1={},E1="canceled",z0={readyState:0,getResponseHeader:function(B0){var Q0;if(_){if(!q){q={};while(Q0=hG.exec(B))q[Q0[1].toLowerCase()+" "]=(q[Q0[1].toLowerCase()+" "]||[]).concat(Q0[2])}Q0=q[B0.toLowerCase()+" "]}return Q0==null?null:Q0.join(", ")},getAllResponseHeaders:function(){return _?B:null},setRequestHeader:function(B0,Q0){if(_==null)B0=M1[B0.toLowerCase()]=M1[B0.toLowerCase()]||B0,T0[B0]=Q0;return this},overrideMimeType:function(B0){if(_==null)j.mimeType=B0;return this},statusCode:function(B0){var Q0;if(B0)if(_)z0.always(B0[z0.status]);else for(Q0 in B0)j0[Q0]=[j0[Q0],B0[Q0]];return this},abort:function(B0){var Q0=B0||E1;if(z)z.abort(Q0);return ZJ(0,Q0),this}};if(V0.promise(z0),j.url=((Z||j.url||eJ.href)+"").replace(gG,eJ.protocol+"//"),j.type=K.method||K.type||j.method||j.type,j.dataTypes=(j.dataType||"*").toLowerCase().match(A1)||[""],j.crossDomain==null){C=D.createElement("a");try{C.href=j.url,C.href=C.href,j.crossDomain=MZ.protocol+"//"+MZ.host!==C.protocol+"//"+C.host}catch(B0){j.crossDomain=!0}}if(j.data&&j.processData&&typeof j.data!=="string")j.data=V.param(j.data,j.traditional);if($8(W8,j,K,z0),_)return z0;if(T=V.event&&j.global,T&&V.active++===0)V.event.trigger("ajaxStart");if(j.type=j.type.toUpperCase(),j.hasContent=!fG.test(j.type),U=j.url.replace(bG,""),!j.hasContent){if(h=j.url.slice(U.length),j.data&&(j.processData||typeof j.data==="string"))U+=(NZ.test(U)?"&":"?")+j.data,delete j.data;if(j.cache===!1)U=U.replace(vG,"$1"),h=(NZ.test(U)?"&":"?")+"_="+Y8.guid+++h;j.url=U+h}else if(j.data&&j.processData&&(j.contentType||"").indexOf("application/x-www-form-urlencoded")===0)j.data=j.data.replace(xG,"+");if(j.ifModified){if(V.lastModified[U])z0.setRequestHeader("If-Modified-Since",V.lastModified[U]);if(V.etag[U])z0.setRequestHeader("If-None-Match",V.etag[U])}if(j.data&&j.hasContent&&j.contentType!==!1||K.contentType)z0.setRequestHeader("Content-Type",j.contentType);z0.setRequestHeader("Accept",j.dataTypes[0]&&j.accepts[j.dataTypes[0]]?j.accepts[j.dataTypes[0]]+(j.dataTypes[0]!=="*"?", "+X8+"; q=0.01":""):j.accepts["*"]);for(b in j.headers)z0.setRequestHeader(b,j.headers[b]);if(j.beforeSend&&(j.beforeSend.call(f,z0,j)===!1||_))return z0.abort();if(E1="abort",G0.add(j.complete),z0.done(j.success),z0.fail(j.error),z=$8(HZ,j,K,z0),!z)ZJ(-1,"No Transport");else{if(z0.readyState=1,T)J0.trigger("ajaxSend",[z0,j]);if(_)return z0;if(j.async&&j.timeout>0)N=J.setTimeout(function(){z0.abort("timeout")},j.timeout);try{_=!1,z.send(T0,ZJ)}catch(B0){if(_)throw B0;ZJ(-1,B0)}}function ZJ(B0,Q0,YY,SZ){var _1,ZY,S1,p1,u1,J1=Q0;if(_)return;if(_=!0,N)J.clearTimeout(N);if(z=void 0,B=SZ||"",z0.readyState=B0>0?4:0,_1=B0>=200&&B0<300||B0===304,YY)p1=mG(j,z0,YY);if(!_1&&V.inArray("script",j.dataTypes)>-1&&V.inArray("json",j.dataTypes)<0)j.converters["text script"]=function(){};if(p1=pG(j,p1,z0,_1),_1){if(j.ifModified){if(u1=z0.getResponseHeader("Last-Modified"),u1)V.lastModified[U]=u1;if(u1=z0.getResponseHeader("etag"),u1)V.etag[U]=u1}if(B0===204||j.type==="HEAD")J1="nocontent";else if(B0===304)J1="notmodified";else J1=p1.state,ZY=p1.data,S1=p1.error,_1=!S1}else if(S1=J1,B0||!J1){if(J1="error",B0<0)B0=0}if(z0.status=B0,z0.statusText=(Q0||J1)+"",_1)V0.resolveWith(f,[ZY,J1,z0]);else V0.rejectWith(f,[z0,J1,S1]);if(z0.statusCode(j0),j0=void 0,T)J0.trigger(_1?"ajaxSuccess":"ajaxError",[z0,j,_1?ZY:S1]);if(G0.fireWith(f,[z0,J1]),T){if(J0.trigger("ajaxComplete",[z0,j]),!--V.active)V.event.trigger("ajaxStop")}}return z0},getJSON:function(Z,K,z){return V.get(Z,K,z,"json")},getScript:function(Z,K){return V.get(Z,void 0,K,"script")}}),V.each(["get","post"],function(Z,K){V[K]=function(z,U,B,q){if(P(U))q=q||B,B=U,U=void 0;return V.ajax(V.extend({url:z,type:K,dataType:q,data:U,success:B},V.isPlainObject(z)&&z))}}),V.ajaxPrefilter(function(Z){var K;for(K in Z.headers)if(K.toLowerCase()==="content-type")Z.contentType=Z.headers[K]||""}),V._evalUrl=function(Z,K,z){return V.ajax({url:Z,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(U){V.globalEval(U,K,z)}})},V.fn.extend({wrapAll:function(Z){var K;if(this[0]){if(P(Z))Z=Z.call(this[0]);if(K=V(Z,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode)K.insertBefore(this[0]);K.map(function(){var z=this;while(z.firstElementChild)z=z.firstElementChild;return z}).append(this)}return this},wrapInner:function(Z){if(P(Z))return this.each(function(K){V(this).wrapInner(Z.call(this,K))});return this.each(function(){var K=V(this),z=K.contents();if(z.length)z.wrapAll(Z);else K.append(Z)})},wrap:function(Z){var K=P(Z);return this.each(function(z){V(this).wrapAll(K?Z.call(this,z):Z)})},unwrap:function(Z){return this.parent(Z).not("body").each(function(){V(this).replaceWith(this.childNodes)}),this}}),V.expr.pseudos.hidden=function(Z){return!V.expr.pseudos.visible(Z)},V.expr.pseudos.visible=function(Z){return!!(Z.offsetWidth||Z.offsetHeight||Z.getClientRects().length)},V.ajaxSettings.xhr=function(){try{return new J.XMLHttpRequest}catch(Z){}};var uG={0:200,1223:204},JY=V.ajaxSettings.xhr();H.cors=!!JY&&"withCredentials"in JY,H.ajax=JY=!!JY,V.ajaxTransport(function(Z){var K,z;if(H.cors||JY&&!Z.crossDomain)return{send:function(U,B){var q,N=Z.xhr();if(N.open(Z.type,Z.url,Z.async,Z.username,Z.password),Z.xhrFields)for(q in Z.xhrFields)N[q]=Z.xhrFields[q];if(Z.mimeType&&N.overrideMimeType)N.overrideMimeType(Z.mimeType);if(!Z.crossDomain&&!U["X-Requested-With"])U["X-Requested-With"]="XMLHttpRequest";for(q in U)N.setRequestHeader(q,U[q]);if(K=function(C){return function(){if(K)if(K=z=N.onload=N.onerror=N.onabort=N.ontimeout=N.onreadystatechange=null,C==="abort")N.abort();else if(C==="error")if(typeof N.status!=="number")B(0,"error");else B(N.status,N.statusText);else B(uG[N.status]||N.status,N.statusText,(N.responseType||"text")!=="text"||typeof N.responseText!=="string"?{binary:N.response}:{text:N.responseText},N.getAllResponseHeaders())}},N.onload=K(),z=N.onerror=N.ontimeout=K("error"),N.onabort!==void 0)N.onabort=z;else N.onreadystatechange=function(){if(N.readyState===4)J.setTimeout(function(){if(K)z()})};K=K("abort");try{N.send(Z.hasContent&&Z.data||null)}catch(C){if(K)throw C}},abort:function(){if(K)K()}}}),V.ajaxPrefilter(function(Z){if(Z.crossDomain)Z.contents.script=!1}),V.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(Z){return V.globalEval(Z),Z}}}),V.ajaxPrefilter("script",function(Z){if(Z.cache===void 0)Z.cache=!1;if(Z.crossDomain)Z.type="GET"}),V.ajaxTransport("script",function(Z){if(Z.crossDomain||Z.scriptAttrs){var K,z;return{send:function(U,B){K=V("<script>").attr(Z.scriptAttrs||{}).prop({charset:Z.scriptCharset,src:Z.url}).on("load error",z=function(q){if(K.remove(),z=null,q)B(q.type==="error"?404:200,q.type)}),D.head.appendChild(K[0])},abort:function(){if(z)z()}}}});var U8=[],_Z=/(=)\?(?=&|$)|\?\?/;V.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var Z=U8.pop()||V.expando+"_"+Y8.guid++;return this[Z]=!0,Z}}),V.ajaxPrefilter("json jsonp",function(Z,K,z){var U,B,q,N=Z.jsonp!==!1&&(_Z.test(Z.url)?"url":typeof Z.data==="string"&&(Z.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&_Z.test(Z.data)&&"data");if(N||Z.dataTypes[0]==="jsonp"){if(U=Z.jsonpCallback=P(Z.jsonpCallback)?Z.jsonpCallback():Z.jsonpCallback,N)Z[N]=Z[N].replace(_Z,"$1"+U);else if(Z.jsonp!==!1)Z.url+=(NZ.test(Z.url)?"&":"?")+Z.jsonp+"="+U;return Z.converters["script json"]=function(){if(!q)V.error(U+" was not called");return q[0]},Z.dataTypes[0]="json",B=J[U],J[U]=function(){q=arguments},z.always(function(){if(B===void 0)V(J).removeProp(U);else J[U]=B;if(Z[U])Z.jsonpCallback=K.jsonpCallback,U8.push(U);if(q&&P(B))B(q[0]);q=B=void 0}),"script"}}),H.createHTMLDocument=function(){var Z=D.implementation.createHTMLDocument("").body;return Z.innerHTML="<form></form><form></form>",Z.childNodes.length===2}(),V.parseHTML=function(Z,K,z){if(typeof Z!=="string")return[];if(typeof K==="boolean")z=K,K=!1;var U,B,q;if(!K)if(H.createHTMLDocument)K=D.implementation.createHTMLDocument(""),U=K.createElement("base"),U.href=D.location.href,K.head.appendChild(U);else K=D;if(B=I6.exec(Z),q=!z&&[],B)return[K.createElement(B[1])];if(B=g6([Z],K,q),q&&q.length)V(q).remove();return V.merge([],B.childNodes)},V.fn.load=function(Z,K,z){var U,B,q,N=this,C=Z.indexOf(" ");if(C>-1)U=JJ(Z.slice(C)),Z=Z.slice(0,C);if(P(K))z=K,K=void 0;else if(K&&typeof K==="object")B="POST";if(N.length>0)V.ajax({url:Z,type:B||"GET",dataType:"html",data:K}).done(function(_){q=arguments,N.html(U?V("<div>").append(V.parseHTML(_)).find(U):_)}).always(z&&function(_,T){N.each(function(){z.apply(this,q||[_.responseText,T,_])})});return this},V.expr.pseudos.animated=function(Z){return V.grep(V.timers,function(K){return Z===K.elem}).length},V.offset={setOffset:function(Z,K,z){var U,B,q,N,C,_,T,b=V.css(Z,"position"),h=V(Z),j={};if(b==="static")Z.style.position="relative";if(C=h.offset(),q=V.css(Z,"top"),_=V.css(Z,"left"),T=(b==="absolute"||b==="fixed")&&(q+_).indexOf("auto")>-1,T)U=h.position(),N=U.top,B=U.left;else N=parseFloat(q)||0,B=parseFloat(_)||0;if(P(K))K=K.call(Z,z,V.extend({},C));if(K.top!=null)j.top=K.top-C.top+N;if(K.left!=null)j.left=K.left-C.left+B;if("using"in K)K.using.call(Z,j);else h.css(j)}},V.fn.extend({offset:function(Z){if(arguments.length)return Z===void 0?this:this.each(function(B){V.offset.setOffset(this,Z,B)});var K,z,U=this[0];if(!U)return;if(!U.getClientRects().length)return{top:0,left:0};return K=U.getBoundingClientRect(),z=U.ownerDocument.defaultView,{top:K.top+z.pageYOffset,left:K.left+z.pageXOffset}},position:function(){if(!this[0])return;var Z,K,z,U=this[0],B={top:0,left:0};if(V.css(U,"position")==="fixed")K=U.getBoundingClientRect();else{K=this.offset(),z=U.ownerDocument,Z=U.offsetParent||z.documentElement;while(Z&&(Z===z.body||Z===z.documentElement)&&V.css(Z,"position")==="static")Z=Z.parentNode;if(Z&&Z!==U&&Z.nodeType===1)B=V(Z).offset(),B.top+=V.css(Z,"borderTopWidth",!0),B.left+=V.css(Z,"borderLeftWidth",!0)}return{top:K.top-B.top-V.css(U,"marginTop",!0),left:K.left-B.left-V.css(U,"marginLeft",!0)}},offsetParent:function(){return this.map(function(){var Z=this.offsetParent;while(Z&&V.css(Z,"position")==="static")Z=Z.offsetParent;return Z||e1})}}),V.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(Z,K){var z=K==="pageYOffset";V.fn[Z]=function(U){return j1(this,function(B,q,N){var C;if(I(B))C=B;else if(B.nodeType===9)C=B.defaultView;if(N===void 0)return C?C[K]:B[q];if(C)C.scrollTo(!z?N:C.pageXOffset,z?N:C.pageYOffset);else B[q]=N},Z,U,arguments.length)}}),V.each(["top","left"],function(Z,K){V.cssHooks[K]=i6(H.pixelPosition,function(z,U){if(U)return U=oJ(z,K),VZ.test(U)?V(z).position()[K]+"px":U})}),V.each({Height:"height",Width:"width"},function(Z,K){V.each({padding:"inner"+Z,content:K,"":"outer"+Z},function(z,U){V.fn[U]=function(B,q){var N=arguments.length&&(z||typeof B!=="boolean"),C=z||(B===!0||q===!0?"margin":"border");return j1(this,function(_,T,b){var h;if(I(_))return U.indexOf("outer")===0?_["inner"+Z]:_.document.documentElement["client"+Z];if(_.nodeType===9)return h=_.documentElement,Math.max(_.body["scroll"+Z],h["scroll"+Z],_.body["offset"+Z],h["offset"+Z],h["client"+Z]);return b===void 0?V.css(_,T,C):V.style(_,T,b,C)},K,N?B:void 0,N)}})}),V.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(Z,K){V.fn[K]=function(z){return this.on(K,z)}}),V.fn.extend({bind:function(Z,K,z){return this.on(Z,null,K,z)},unbind:function(Z,K){return this.off(Z,null,K)},delegate:function(Z,K,z,U){return this.on(K,Z,z,U)},undelegate:function(Z,K,z){return arguments.length===1?this.off(Z,"**"):this.off(K,Z||"**",z)},hover:function(Z,K){return this.on("mouseenter",Z).on("mouseleave",K||Z)}}),V.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(Z,K){V.fn[K]=function(z,U){return arguments.length>0?this.on(K,null,z,U):this.trigger(K)}});var cG=/^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;if(V.proxy=function(Z,K){var z,U,B;if(typeof K==="string")z=Z[K],K=Z,Z=z;if(!P(Z))return;return U=O.call(arguments,2),B=function(){return Z.apply(K||this,U.concat(O.call(arguments)))},B.guid=Z.guid=Z.guid||V.guid++,B},V.holdReady=function(Z){if(Z)V.readyWait++;else V.ready(!0)},V.isArray=Array.isArray,V.parseJSON=JSON.parse,V.nodeName=a,V.isFunction=P,V.isWindow=I,V.camelCase=H1,V.type=K0,V.now=Date.now,V.isNumeric=function(Z){var K=V.type(Z);return(K==="number"||K==="string")&&!isNaN(Z-parseFloat(Z))},V.trim=function(Z){return Z==null?"":(Z+"").replace(cG,"$1")},typeof define==="function"&&define.amd)define("jquery",[],function(){return V});var{jQuery:dG,$:iG}=J;if(V.noConflict=function(Z){if(J.$===V)J.$=iG;if(Z&&J.jQuery===V)J.jQuery=dG;return V},typeof Y>"u")J.jQuery=J.$=V;return V})});var gZ=$0((vY)=>{/*!
|
|
* howler.js v2.2.4
|
|
* howlerjs.com
|
|
*
|
|
* (c) 2013-2020, James Simpson of GoldFire Studios
|
|
* goldfirestudios.com
|
|
*
|
|
* MIT License
|
|
*/(function(){var J=function(){this.init()};J.prototype={init:function(){var X=this||Y;return X._counter=1000,X._html5AudioPool=[],X.html5PoolSize=10,X._codecs={},X._howls=[],X._muted=!1,X._volume=1,X._canPlayEvent="canplaythrough",X._navigator=typeof window<"u"&&window.navigator?window.navigator:null,X.masterGain=null,X.noAudio=!1,X.usingWebAudio=!0,X.autoSuspend=!0,X.ctx=null,X.autoUnlock=!0,X._setup(),X},volume:function(X){var $=this||Y;if(X=parseFloat(X),!$.ctx)k();if(typeof X<"u"&&X>=0&&X<=1){if($._volume=X,$._muted)return $;if($.usingWebAudio)$.masterGain.gain.setValueAtTime(X,Y.ctx.currentTime);for(var R=0;R<$._howls.length;R++)if(!$._howls[R]._webAudio){var H=$._howls[R]._getSoundIds();for(var P=0;P<H.length;P++){var I=$._howls[R]._soundById(H[P]);if(I&&I._node)I._node.volume=I._volume*X}}return $}return $._volume},mute:function(X){var $=this||Y;if(!$.ctx)k();if($._muted=X,$.usingWebAudio)$.masterGain.gain.setValueAtTime(X?0:$._volume,Y.ctx.currentTime);for(var R=0;R<$._howls.length;R++)if(!$._howls[R]._webAudio){var H=$._howls[R]._getSoundIds();for(var P=0;P<H.length;P++){var I=$._howls[R]._soundById(H[P]);if(I&&I._node)I._node.muted=X?!0:I._muted}}return $},stop:function(){var X=this||Y;for(var $=0;$<X._howls.length;$++)X._howls[$].stop();return X},unload:function(){var X=this||Y;for(var $=X._howls.length-1;$>=0;$--)X._howls[$].unload();if(X.usingWebAudio&&X.ctx&&typeof X.ctx.close<"u")X.ctx.close(),X.ctx=null,k();return X},codecs:function(X){return(this||Y)._codecs[X.replace(/^x-/,"")]},_setup:function(){var X=this||Y;if(X.state=X.ctx?X.ctx.state||"suspended":"suspended",X._autoSuspend(),!X.usingWebAudio)if(typeof Audio<"u")try{var $=new Audio;if(typeof $.oncanplaythrough>"u")X._canPlayEvent="canplay"}catch(R){X.noAudio=!0}else X.noAudio=!0;try{var $=new Audio;if($.muted)X.noAudio=!0}catch(R){}if(!X.noAudio)X._setupCodecs();return X},_setupCodecs:function(){var X=this||Y,$=null;try{$=typeof Audio<"u"?new Audio:null}catch(K0){return X}if(!$||typeof $.canPlayType!=="function")return X;var R=$.canPlayType("audio/mpeg;").replace(/^no$/,""),H=X._navigator?X._navigator.userAgent:"",P=H.match(/OPR\/(\d+)/g),I=P&&parseInt(P[0].split("/")[1],10)<33,D=H.indexOf("Safari")!==-1&&H.indexOf("Chrome")===-1,c=H.match(/Version\/(.*?) /),n=D&&c&&parseInt(c[1],10)<15;return X._codecs={mp3:!!(!I&&(R||$.canPlayType("audio/mp3;").replace(/^no$/,""))),mpeg:!!R,opus:!!$.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!$.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!$.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!($.canPlayType('audio/wav; codecs="1"')||$.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!$.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!$.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!($.canPlayType("audio/x-m4a;")||$.canPlayType("audio/m4a;")||$.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!($.canPlayType("audio/x-m4b;")||$.canPlayType("audio/m4b;")||$.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!($.canPlayType("audio/x-mp4;")||$.canPlayType("audio/mp4;")||$.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!(!n&&$.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!!(!n&&$.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!$.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!($.canPlayType("audio/x-flac;")||$.canPlayType("audio/flac;")).replace(/^no$/,"")},X},_unlockAudio:function(){var X=this||Y;if(X._audioUnlocked||!X.ctx)return;if(X._audioUnlocked=!1,X.autoUnlock=!1,!X._mobileUnloaded&&X.ctx.sampleRate!==44100)X._mobileUnloaded=!0,X.unload();X._scratchBuffer=X.ctx.createBuffer(1,1,22050);var $=function(R){while(X._html5AudioPool.length<X.html5PoolSize)try{var H=new Audio;H._unlocked=!0,X._releaseHtml5Audio(H)}catch(K0){X.noAudio=!0;break}for(var P=0;P<X._howls.length;P++)if(!X._howls[P]._webAudio){var I=X._howls[P]._getSoundIds();for(var D=0;D<I.length;D++){var c=X._howls[P]._soundById(I[D]);if(c&&c._node&&!c._node._unlocked)c._node._unlocked=!0,c._node.load()}}X._autoResume();var n=X.ctx.createBufferSource();if(n.buffer=X._scratchBuffer,n.connect(X.ctx.destination),typeof n.start>"u")n.noteOn(0);else n.start(0);if(typeof X.ctx.resume==="function")X.ctx.resume();n.onended=function(){n.disconnect(0),X._audioUnlocked=!0,document.removeEventListener("touchstart",$,!0),document.removeEventListener("touchend",$,!0),document.removeEventListener("click",$,!0),document.removeEventListener("keydown",$,!0);for(var K0=0;K0<X._howls.length;K0++)X._howls[K0]._emit("unlock")}};return document.addEventListener("touchstart",$,!0),document.addEventListener("touchend",$,!0),document.addEventListener("click",$,!0),document.addEventListener("keydown",$,!0),X},_obtainHtml5Audio:function(){var X=this||Y;if(X._html5AudioPool.length)return X._html5AudioPool.pop();var $=new Audio().play();if($&&typeof Promise<"u"&&($ instanceof Promise||typeof $.then==="function"))$.catch(function(){console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.")});return new Audio},_releaseHtml5Audio:function(X){var $=this||Y;if(X._unlocked)$._html5AudioPool.push(X);return $},_autoSuspend:function(){var X=this;if(!X.autoSuspend||!X.ctx||typeof X.ctx.suspend>"u"||!Y.usingWebAudio)return;for(var $=0;$<X._howls.length;$++)if(X._howls[$]._webAudio){for(var R=0;R<X._howls[$]._sounds.length;R++)if(!X._howls[$]._sounds[R]._paused)return X}if(X._suspendTimer)clearTimeout(X._suspendTimer);return X._suspendTimer=setTimeout(function(){if(!X.autoSuspend)return;X._suspendTimer=null,X.state="suspending";var H=function(){if(X.state="suspended",X._resumeAfterSuspend)delete X._resumeAfterSuspend,X._autoResume()};X.ctx.suspend().then(H,H)},30000),X},_autoResume:function(){var X=this;if(!X.ctx||typeof X.ctx.resume>"u"||!Y.usingWebAudio)return;if(X.state==="running"&&X.ctx.state!=="interrupted"&&X._suspendTimer)clearTimeout(X._suspendTimer),X._suspendTimer=null;else if(X.state==="suspended"||X.state==="running"&&X.ctx.state==="interrupted"){if(X.ctx.resume().then(function(){X.state="running";for(var $=0;$<X._howls.length;$++)X._howls[$]._emit("resume")}),X._suspendTimer)clearTimeout(X._suspendTimer),X._suspendTimer=null}else if(X.state==="suspending")X._resumeAfterSuspend=!0;return X}};var Y=new J,G=function(X){var $=this;if(!X.src||X.src.length===0){console.error("An array of source files must be passed with any new Howl.");return}$.init(X)};G.prototype={init:function(X){var $=this;if(!Y.ctx)k();if($._autoplay=X.autoplay||!1,$._format=typeof X.format!=="string"?X.format:[X.format],$._html5=X.html5||!1,$._muted=X.mute||!1,$._loop=X.loop||!1,$._pool=X.pool||5,$._preload=typeof X.preload==="boolean"||X.preload==="metadata"?X.preload:!0,$._rate=X.rate||1,$._sprite=X.sprite||{},$._src=typeof X.src!=="string"?X.src:[X.src],$._volume=X.volume!==void 0?X.volume:1,$._xhr={method:X.xhr&&X.xhr.method?X.xhr.method:"GET",headers:X.xhr&&X.xhr.headers?X.xhr.headers:null,withCredentials:X.xhr&&X.xhr.withCredentials?X.xhr.withCredentials:!1},$._duration=0,$._state="unloaded",$._sounds=[],$._endTimers={},$._queue=[],$._playLock=!1,$._onend=X.onend?[{fn:X.onend}]:[],$._onfade=X.onfade?[{fn:X.onfade}]:[],$._onload=X.onload?[{fn:X.onload}]:[],$._onloaderror=X.onloaderror?[{fn:X.onloaderror}]:[],$._onplayerror=X.onplayerror?[{fn:X.onplayerror}]:[],$._onpause=X.onpause?[{fn:X.onpause}]:[],$._onplay=X.onplay?[{fn:X.onplay}]:[],$._onstop=X.onstop?[{fn:X.onstop}]:[],$._onmute=X.onmute?[{fn:X.onmute}]:[],$._onvolume=X.onvolume?[{fn:X.onvolume}]:[],$._onrate=X.onrate?[{fn:X.onrate}]:[],$._onseek=X.onseek?[{fn:X.onseek}]:[],$._onunlock=X.onunlock?[{fn:X.onunlock}]:[],$._onresume=[],$._webAudio=Y.usingWebAudio&&!$._html5,typeof Y.ctx<"u"&&Y.ctx&&Y.autoUnlock)Y._unlockAudio();if(Y._howls.push($),$._autoplay)$._queue.push({event:"play",action:function(){$.play()}});if($._preload&&$._preload!=="none")$.load();return $},load:function(){var X=this,$=null;if(Y.noAudio){X._emit("loaderror",null,"No audio support.");return}if(typeof X._src==="string")X._src=[X._src];for(var R=0;R<X._src.length;R++){var H,P;if(X._format&&X._format[R])H=X._format[R];else{if(P=X._src[R],typeof P!=="string"){X._emit("loaderror",null,"Non-string found in selected audio sources - ignoring.");continue}if(H=/^data:audio\/([^;,]+);/i.exec(P),!H)H=/\.([^.]+)$/.exec(P.split("?",1)[0]);if(H)H=H[1].toLowerCase()}if(!H)console.warn('No file extension was found. Consider using the "format" property or specify an extension.');if(H&&Y.codecs(H)){$=X._src[R];break}}if(!$){X._emit("loaderror",null,"No codec support for selected audio sources.");return}if(X._src=$,X._state="loading",window.location.protocol==="https:"&&$.slice(0,5)==="http:")X._html5=!0,X._webAudio=!1;if(new W(X),X._webAudio)A(X);return X},play:function(X,$){var R=this,H=null;if(typeof X==="number")H=X,X=null;else if(typeof X==="string"&&R._state==="loaded"&&!R._sprite[X])return null;else if(typeof X>"u"){if(X="__default",!R._playLock){var P=0;for(var I=0;I<R._sounds.length;I++)if(R._sounds[I]._paused&&!R._sounds[I]._ended)P++,H=R._sounds[I]._id;if(P===1)X=null;else H=null}}var D=H?R._soundById(H):R._inactiveSound();if(!D)return null;if(H&&!X)X=D._sprite||"__default";if(R._state!=="loaded"){D._sprite=X,D._ended=!1;var c=D._id;return R._queue.push({event:"play",action:function(){R.play(c)}}),c}if(H&&!D._paused){if(!$)R._loadQueue("play");return D._id}if(R._webAudio)Y._autoResume();var n=Math.max(0,D._seek>0?D._seek:R._sprite[X][0]/1000),K0=Math.max(0,(R._sprite[X][0]+R._sprite[X][1])/1000-n),S0=K0*1000/Math.abs(D._rate),p0=R._sprite[X][0]/1000,V=(R._sprite[X][0]+R._sprite[X][1])/1000;D._sprite=X,D._ended=!1;var s0=function(){D._paused=!1,D._seek=n,D._start=p0,D._stop=V,D._loop=!!(D._loop||R._sprite[X][2])};if(n>=V){R._ended(D);return}var a=D._node;if(R._webAudio){var N1=function(){R._playLock=!1,s0(),R._refreshBuffer(D);var y=D._muted||R._muted?0:D._volume;if(a.gain.setValueAtTime(y,Y.ctx.currentTime),D._playStart=Y.ctx.currentTime,typeof a.bufferSource.start>"u")D._loop?a.bufferSource.noteGrainOn(0,n,86400):a.bufferSource.noteGrainOn(0,n,K0);else D._loop?a.bufferSource.start(0,n,86400):a.bufferSource.start(0,n,K0);if(S0!==1/0)R._endTimers[D._id]=setTimeout(R._ended.bind(R,D),S0);if(!$)setTimeout(function(){R._emit("play",D._id),R._loadQueue()},0)};if(Y.state==="running"&&Y.ctx.state!=="interrupted")N1();else R._playLock=!0,R.once("resume",N1),R._clearTimer(D._id)}else{var t1=function(){a.currentTime=n,a.muted=D._muted||R._muted||Y._muted||a.muted,a.volume=D._volume*Y.volume(),a.playbackRate=D._rate;try{var y=a.play();if(y&&typeof Promise<"u"&&(y instanceof Promise||typeof y.then==="function"))R._playLock=!0,s0(),y.then(function(){if(R._playLock=!1,a._unlocked=!0,!$)R._emit("play",D._id);else R._loadQueue()}).catch(function(){R._playLock=!1,R._emit("playerror",D._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),D._ended=!0,D._paused=!0});else if(!$)R._playLock=!1,s0(),R._emit("play",D._id);if(a.playbackRate=D._rate,a.paused){R._emit("playerror",D._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");return}if(X!=="__default"||D._loop)R._endTimers[D._id]=setTimeout(R._ended.bind(R,D),S0);else R._endTimers[D._id]=function(){R._ended(D),a.removeEventListener("ended",R._endTimers[D._id],!1)},a.addEventListener("ended",R._endTimers[D._id],!1)}catch(U0){R._emit("playerror",D._id,U0)}};if(a.src==="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")a.src=R._src,a.load();var m1=window&&window.ejecta||!a.readyState&&Y._navigator.isCocoonJS;if(a.readyState>=3||m1)t1();else{R._playLock=!0,R._state="loading";var Z0=function(){R._state="loaded",t1(),a.removeEventListener(Y._canPlayEvent,Z0,!1)};a.addEventListener(Y._canPlayEvent,Z0,!1),R._clearTimer(D._id)}}return D._id},pause:function(X){var $=this;if($._state!=="loaded"||$._playLock)return $._queue.push({event:"pause",action:function(){$.pause(X)}}),$;var R=$._getSoundIds(X);for(var H=0;H<R.length;H++){$._clearTimer(R[H]);var P=$._soundById(R[H]);if(P&&!P._paused){if(P._seek=$.seek(R[H]),P._rateSeek=0,P._paused=!0,$._stopFade(R[H]),P._node){if($._webAudio){if(!P._node.bufferSource)continue;if(typeof P._node.bufferSource.stop>"u")P._node.bufferSource.noteOff(0);else P._node.bufferSource.stop(0);$._cleanBuffer(P._node)}else if(!isNaN(P._node.duration)||P._node.duration===1/0)P._node.pause()}}if(!arguments[1])$._emit("pause",P?P._id:null)}return $},stop:function(X,$){var R=this;if(R._state!=="loaded"||R._playLock)return R._queue.push({event:"stop",action:function(){R.stop(X)}}),R;var H=R._getSoundIds(X);for(var P=0;P<H.length;P++){R._clearTimer(H[P]);var I=R._soundById(H[P]);if(I){if(I._seek=I._start||0,I._rateSeek=0,I._paused=!0,I._ended=!0,R._stopFade(H[P]),I._node){if(R._webAudio){if(I._node.bufferSource){if(typeof I._node.bufferSource.stop>"u")I._node.bufferSource.noteOff(0);else I._node.bufferSource.stop(0);R._cleanBuffer(I._node)}}else if(!isNaN(I._node.duration)||I._node.duration===1/0){if(I._node.currentTime=I._start||0,I._node.pause(),I._node.duration===1/0)R._clearSound(I._node)}}if(!$)R._emit("stop",I._id)}}return R},mute:function(X,$){var R=this;if(R._state!=="loaded"||R._playLock)return R._queue.push({event:"mute",action:function(){R.mute(X,$)}}),R;if(typeof $>"u")if(typeof X==="boolean")R._muted=X;else return R._muted;var H=R._getSoundIds($);for(var P=0;P<H.length;P++){var I=R._soundById(H[P]);if(I){if(I._muted=X,I._interval)R._stopFade(I._id);if(R._webAudio&&I._node)I._node.gain.setValueAtTime(X?0:I._volume,Y.ctx.currentTime);else if(I._node)I._node.muted=Y._muted?!0:X;R._emit("mute",I._id)}}return R},volume:function(){var X=this,$=arguments,R,H;if($.length===0)return X._volume;else if($.length===1||$.length===2&&typeof $[1]>"u"){var P=X._getSoundIds(),I=P.indexOf($[0]);if(I>=0)H=parseInt($[0],10);else R=parseFloat($[0])}else if($.length>=2)R=parseFloat($[0]),H=parseInt($[1],10);var D;if(typeof R<"u"&&R>=0&&R<=1){if(X._state!=="loaded"||X._playLock)return X._queue.push({event:"volume",action:function(){X.volume.apply(X,$)}}),X;if(typeof H>"u")X._volume=R;H=X._getSoundIds(H);for(var c=0;c<H.length;c++)if(D=X._soundById(H[c]),D){if(D._volume=R,!$[2])X._stopFade(H[c]);if(X._webAudio&&D._node&&!D._muted)D._node.gain.setValueAtTime(R,Y.ctx.currentTime);else if(D._node&&!D._muted)D._node.volume=R*Y.volume();X._emit("volume",D._id)}}else return D=H?X._soundById(H):X._sounds[0],D?D._volume:0;return X},fade:function(X,$,R,H){var P=this;if(P._state!=="loaded"||P._playLock)return P._queue.push({event:"fade",action:function(){P.fade(X,$,R,H)}}),P;X=Math.min(Math.max(0,parseFloat(X)),1),$=Math.min(Math.max(0,parseFloat($)),1),R=parseFloat(R),P.volume(X,H);var I=P._getSoundIds(H);for(var D=0;D<I.length;D++){var c=P._soundById(I[D]);if(c){if(!H)P._stopFade(I[D]);if(P._webAudio&&!c._muted){var n=Y.ctx.currentTime,K0=n+R/1000;c._volume=X,c._node.gain.setValueAtTime(X,n),c._node.gain.linearRampToValueAtTime($,K0)}P._startFadeInterval(c,X,$,R,I[D],typeof H>"u")}}return P},_startFadeInterval:function(X,$,R,H,P,I){var D=this,c=$,n=R-$,K0=Math.abs(n/0.01),S0=Math.max(4,K0>0?H/K0:H),p0=Date.now();X._fadeTo=R,X._interval=setInterval(function(){var V=(Date.now()-p0)/H;if(p0=Date.now(),c+=n*V,c=Math.round(c*100)/100,n<0)c=Math.max(R,c);else c=Math.min(R,c);if(D._webAudio)X._volume=c;else D.volume(c,X._id,!0);if(I)D._volume=c;if(R<$&&c<=R||R>$&&c>=R)clearInterval(X._interval),X._interval=null,X._fadeTo=null,D.volume(R,X._id),D._emit("fade",X._id)},S0)},_stopFade:function(X){var $=this,R=$._soundById(X);if(R&&R._interval){if($._webAudio)R._node.gain.cancelScheduledValues(Y.ctx.currentTime);clearInterval(R._interval),R._interval=null,$.volume(R._fadeTo,X),R._fadeTo=null,$._emit("fade",X)}return $},loop:function(){var X=this,$=arguments,R,H,P;if($.length===0)return X._loop;else if($.length===1)if(typeof $[0]==="boolean")R=$[0],X._loop=R;else return P=X._soundById(parseInt($[0],10)),P?P._loop:!1;else if($.length===2)R=$[0],H=parseInt($[1],10);var I=X._getSoundIds(H);for(var D=0;D<I.length;D++)if(P=X._soundById(I[D]),P){if(P._loop=R,X._webAudio&&P._node&&P._node.bufferSource){if(P._node.bufferSource.loop=R,R){if(P._node.bufferSource.loopStart=P._start||0,P._node.bufferSource.loopEnd=P._stop,X.playing(I[D]))X.pause(I[D],!0),X.play(I[D],!0)}}}return X},rate:function(){var X=this,$=arguments,R,H;if($.length===0)H=X._sounds[0]._id;else if($.length===1){var P=X._getSoundIds(),I=P.indexOf($[0]);if(I>=0)H=parseInt($[0],10);else R=parseFloat($[0])}else if($.length===2)R=parseFloat($[0]),H=parseInt($[1],10);var D;if(typeof R==="number"){if(X._state!=="loaded"||X._playLock)return X._queue.push({event:"rate",action:function(){X.rate.apply(X,$)}}),X;if(typeof H>"u")X._rate=R;H=X._getSoundIds(H);for(var c=0;c<H.length;c++)if(D=X._soundById(H[c]),D){if(X.playing(H[c]))D._rateSeek=X.seek(H[c]),D._playStart=X._webAudio?Y.ctx.currentTime:D._playStart;if(D._rate=R,X._webAudio&&D._node&&D._node.bufferSource)D._node.bufferSource.playbackRate.setValueAtTime(R,Y.ctx.currentTime);else if(D._node)D._node.playbackRate=R;var n=X.seek(H[c]),K0=(X._sprite[D._sprite][0]+X._sprite[D._sprite][1])/1000-n,S0=K0*1000/Math.abs(D._rate);if(X._endTimers[H[c]]||!D._paused)X._clearTimer(H[c]),X._endTimers[H[c]]=setTimeout(X._ended.bind(X,D),S0);X._emit("rate",D._id)}}else return D=X._soundById(H),D?D._rate:X._rate;return X},seek:function(){var X=this,$=arguments,R,H;if($.length===0){if(X._sounds.length)H=X._sounds[0]._id}else if($.length===1){var P=X._getSoundIds(),I=P.indexOf($[0]);if(I>=0)H=parseInt($[0],10);else if(X._sounds.length)H=X._sounds[0]._id,R=parseFloat($[0])}else if($.length===2)R=parseFloat($[0]),H=parseInt($[1],10);if(typeof H>"u")return 0;if(typeof R==="number"&&(X._state!=="loaded"||X._playLock))return X._queue.push({event:"seek",action:function(){X.seek.apply(X,$)}}),X;var D=X._soundById(H);if(D)if(typeof R==="number"&&R>=0){var c=X.playing(H);if(c)X.pause(H,!0);if(D._seek=R,D._ended=!1,X._clearTimer(H),!X._webAudio&&D._node&&!isNaN(D._node.duration))D._node.currentTime=R;var n=function(){if(c)X.play(H,!0);X._emit("seek",H)};if(c&&!X._webAudio){var K0=function(){if(!X._playLock)n();else setTimeout(K0,0)};setTimeout(K0,0)}else n()}else if(X._webAudio){var S0=X.playing(H)?Y.ctx.currentTime-D._playStart:0,p0=D._rateSeek?D._rateSeek-D._seek:0;return D._seek+(p0+S0*Math.abs(D._rate))}else return D._node.currentTime;return X},playing:function(X){var $=this;if(typeof X==="number"){var R=$._soundById(X);return R?!R._paused:!1}for(var H=0;H<$._sounds.length;H++)if(!$._sounds[H]._paused)return!0;return!1},duration:function(X){var $=this,R=$._duration,H=$._soundById(X);if(H)R=$._sprite[H._sprite][1]/1000;return R},state:function(){return this._state},unload:function(){var X=this,$=X._sounds;for(var R=0;R<$.length;R++){if(!$[R]._paused)X.stop($[R]._id);if(!X._webAudio)X._clearSound($[R]._node),$[R]._node.removeEventListener("error",$[R]._errorFn,!1),$[R]._node.removeEventListener(Y._canPlayEvent,$[R]._loadFn,!1),$[R]._node.removeEventListener("ended",$[R]._endFn,!1),Y._releaseHtml5Audio($[R]._node);delete $[R]._node,X._clearTimer($[R]._id)}var H=Y._howls.indexOf(X);if(H>=0)Y._howls.splice(H,1);var P=!0;for(R=0;R<Y._howls.length;R++)if(Y._howls[R]._src===X._src||X._src.indexOf(Y._howls[R]._src)>=0){P=!1;break}if(O&&P)delete O[X._src];return Y.noAudio=!1,X._state="unloaded",X._sounds=[],X=null,null},on:function(X,$,R,H){var P=this,I=P["_on"+X];if(typeof $==="function")I.push(H?{id:R,fn:$,once:H}:{id:R,fn:$});return P},off:function(X,$,R){var H=this,P=H["_on"+X],I=0;if(typeof $==="number")R=$,$=null;if($||R)for(I=0;I<P.length;I++){var D=R===P[I].id;if($===P[I].fn&&D||!$&&D){P.splice(I,1);break}}else if(X)H["_on"+X]=[];else{var c=Object.keys(H);for(I=0;I<c.length;I++)if(c[I].indexOf("_on")===0&&Array.isArray(H[c[I]]))H[c[I]]=[]}return H},once:function(X,$,R){var H=this;return H.on(X,$,R,1),H},_emit:function(X,$,R){var H=this,P=H["_on"+X];for(var I=P.length-1;I>=0;I--)if(!P[I].id||P[I].id===$||X==="load"){if(setTimeout(function(D){D.call(this,$,R)}.bind(H,P[I].fn),0),P[I].once)H.off(X,P[I].fn,P[I].id)}return H._loadQueue(X),H},_loadQueue:function(X){var $=this;if($._queue.length>0){var R=$._queue[0];if(R.event===X)$._queue.shift(),$._loadQueue();if(!X)R.action()}return $},_ended:function(X){var $=this,R=X._sprite;if(!$._webAudio&&X._node&&!X._node.paused&&!X._node.ended&&X._node.currentTime<X._stop)return setTimeout($._ended.bind($,X),100),$;var H=!!(X._loop||$._sprite[R][2]);if($._emit("end",X._id),!$._webAudio&&H)$.stop(X._id,!0).play(X._id);if($._webAudio&&H){$._emit("play",X._id),X._seek=X._start||0,X._rateSeek=0,X._playStart=Y.ctx.currentTime;var P=(X._stop-X._start)*1000/Math.abs(X._rate);$._endTimers[X._id]=setTimeout($._ended.bind($,X),P)}if($._webAudio&&!H)X._paused=!0,X._ended=!0,X._seek=X._start||0,X._rateSeek=0,$._clearTimer(X._id),$._cleanBuffer(X._node),Y._autoSuspend();if(!$._webAudio&&!H)$.stop(X._id,!0);return $},_clearTimer:function(X){var $=this;if($._endTimers[X]){if(typeof $._endTimers[X]!=="function")clearTimeout($._endTimers[X]);else{var R=$._soundById(X);if(R&&R._node)R._node.removeEventListener("ended",$._endTimers[X],!1)}delete $._endTimers[X]}return $},_soundById:function(X){var $=this;for(var R=0;R<$._sounds.length;R++)if(X===$._sounds[R]._id)return $._sounds[R];return null},_inactiveSound:function(){var X=this;X._drain();for(var $=0;$<X._sounds.length;$++)if(X._sounds[$]._ended)return X._sounds[$].reset();return new W(X)},_drain:function(){var X=this,$=X._pool,R=0,H=0;if(X._sounds.length<$)return;for(H=0;H<X._sounds.length;H++)if(X._sounds[H]._ended)R++;for(H=X._sounds.length-1;H>=0;H--){if(R<=$)return;if(X._sounds[H]._ended){if(X._webAudio&&X._sounds[H]._node)X._sounds[H]._node.disconnect(0);X._sounds.splice(H,1),R--}}},_getSoundIds:function(X){var $=this;if(typeof X>"u"){var R=[];for(var H=0;H<$._sounds.length;H++)R.push($._sounds[H]._id);return R}else return[X]},_refreshBuffer:function(X){var $=this;if(X._node.bufferSource=Y.ctx.createBufferSource(),X._node.bufferSource.buffer=O[$._src],X._panner)X._node.bufferSource.connect(X._panner);else X._node.bufferSource.connect(X._node);if(X._node.bufferSource.loop=X._loop,X._loop)X._node.bufferSource.loopStart=X._start||0,X._node.bufferSource.loopEnd=X._stop||0;return X._node.bufferSource.playbackRate.setValueAtTime(X._rate,Y.ctx.currentTime),$},_cleanBuffer:function(X){var $=this,R=Y._navigator&&Y._navigator.vendor.indexOf("Apple")>=0;if(!X.bufferSource)return $;if(Y._scratchBuffer&&X.bufferSource){if(X.bufferSource.onended=null,X.bufferSource.disconnect(0),R)try{X.bufferSource.buffer=Y._scratchBuffer}catch(H){}}return X.bufferSource=null,$},_clearSound:function(X){var $=/MSIE |Trident\//.test(Y._navigator&&Y._navigator.userAgent);if(!$)X.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"}};var W=function(X){this._parent=X,this.init()};W.prototype={init:function(){var X=this,$=X._parent;return X._muted=$._muted,X._loop=$._loop,X._volume=$._volume,X._rate=$._rate,X._seek=0,X._paused=!0,X._ended=!0,X._sprite="__default",X._id=++Y._counter,$._sounds.push(X),X.create(),X},create:function(){var X=this,$=X._parent,R=Y._muted||X._muted||X._parent._muted?0:X._volume;if($._webAudio)X._node=typeof Y.ctx.createGain>"u"?Y.ctx.createGainNode():Y.ctx.createGain(),X._node.gain.setValueAtTime(R,Y.ctx.currentTime),X._node.paused=!0,X._node.connect(Y.masterGain);else if(!Y.noAudio)X._node=Y._obtainHtml5Audio(),X._errorFn=X._errorListener.bind(X),X._node.addEventListener("error",X._errorFn,!1),X._loadFn=X._loadListener.bind(X),X._node.addEventListener(Y._canPlayEvent,X._loadFn,!1),X._endFn=X._endListener.bind(X),X._node.addEventListener("ended",X._endFn,!1),X._node.src=$._src,X._node.preload=$._preload===!0?"auto":$._preload,X._node.volume=R*Y.volume(),X._node.load();return X},reset:function(){var X=this,$=X._parent;return X._muted=$._muted,X._loop=$._loop,X._volume=$._volume,X._rate=$._rate,X._seek=0,X._rateSeek=0,X._paused=!0,X._ended=!0,X._sprite="__default",X._id=++Y._counter,X},_errorListener:function(){var X=this;X._parent._emit("loaderror",X._id,X._node.error?X._node.error.code:0),X._node.removeEventListener("error",X._errorFn,!1)},_loadListener:function(){var X=this,$=X._parent;if($._duration=Math.ceil(X._node.duration*10)/10,Object.keys($._sprite).length===0)$._sprite={__default:[0,$._duration*1000]};if($._state!=="loaded")$._state="loaded",$._emit("load"),$._loadQueue();X._node.removeEventListener(Y._canPlayEvent,X._loadFn,!1)},_endListener:function(){var X=this,$=X._parent;if($._duration===1/0){if($._duration=Math.ceil(X._node.duration*10)/10,$._sprite.__default[1]===1/0)$._sprite.__default[1]=$._duration*1000;$._ended(X)}X._node.removeEventListener("ended",X._endFn,!1)}};var O={},A=function(X){var $=X._src;if(O[$]){X._duration=O[$].duration,E(X);return}if(/^data:[^;]+;base64,/.test($)){var R=atob($.split(",")[1]),H=new Uint8Array(R.length);for(var P=0;P<R.length;++P)H[P]=R.charCodeAt(P);S(H.buffer,X)}else{var I=new XMLHttpRequest;if(I.open(X._xhr.method,$,!0),I.withCredentials=X._xhr.withCredentials,I.responseType="arraybuffer",X._xhr.headers)Object.keys(X._xhr.headers).forEach(function(D){I.setRequestHeader(D,X._xhr.headers[D])});I.onload=function(){var D=(I.status+"")[0];if(D!=="0"&&D!=="2"&&D!=="3"){X._emit("loaderror",null,"Failed loading audio file with status: "+I.status+".");return}S(I.response,X)},I.onerror=function(){if(X._webAudio)X._html5=!0,X._webAudio=!1,X._sounds=[],delete O[$],X.load()},Q(I)}},Q=function(X){try{X.send()}catch($){X.onerror()}},S=function(X,$){var R=function(){$._emit("loaderror",null,"Decoding audio data failed.")},H=function(P){if(P&&$._sounds.length>0)O[$._src]=P,E($,P);else R()};if(typeof Promise<"u"&&Y.ctx.decodeAudioData.length===1)Y.ctx.decodeAudioData(X).then(H).catch(R);else Y.ctx.decodeAudioData(X,H,R)},E=function(X,$){if($&&!X._duration)X._duration=$.duration;if(Object.keys(X._sprite).length===0)X._sprite={__default:[0,X._duration*1000]};if(X._state!=="loaded")X._state="loaded",X._emit("load"),X._loadQueue()},k=function(){if(!Y.usingWebAudio)return;try{if(typeof AudioContext<"u")Y.ctx=new AudioContext;else if(typeof webkitAudioContext<"u")Y.ctx=new webkitAudioContext;else Y.usingWebAudio=!1}catch(P){Y.usingWebAudio=!1}if(!Y.ctx)Y.usingWebAudio=!1;var X=/iP(hone|od|ad)/.test(Y._navigator&&Y._navigator.platform),$=Y._navigator&&Y._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),R=$?parseInt($[1],10):null;if(X&&R&&R<9){var H=/safari/.test(Y._navigator&&Y._navigator.userAgent.toLowerCase());if(Y._navigator&&!H)Y.usingWebAudio=!1}if(Y.usingWebAudio)Y.masterGain=typeof Y.ctx.createGain>"u"?Y.ctx.createGainNode():Y.ctx.createGain(),Y.masterGain.gain.setValueAtTime(Y._muted?0:Y._volume,Y.ctx.currentTime),Y.masterGain.connect(Y.ctx.destination);Y._setup()};if(typeof define==="function"&&define.amd)define([],function(){return{Howler:Y,Howl:G}});if(typeof vY<"u")vY.Howler=Y,vY.Howl=G;if(typeof global<"u")global.HowlerGlobal=J,global.Howler=Y,global.Howl=G,global.Sound=W;else if(typeof window<"u")window.HowlerGlobal=J,window.Howler=Y,window.Howl=G,window.Sound=W})();/*!
|
|
* Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
|
|
*
|
|
* howler.js v2.2.4
|
|
* howlerjs.com
|
|
*
|
|
* (c) 2013-2020, James Simpson of GoldFire Studios
|
|
* goldfirestudios.com
|
|
*
|
|
* MIT License
|
|
*/(function(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(Y){var G=this;if(!G.ctx||!G.ctx.listener)return G;for(var W=G._howls.length-1;W>=0;W--)G._howls[W].stereo(Y);return G},HowlerGlobal.prototype.pos=function(Y,G,W){var O=this;if(!O.ctx||!O.ctx.listener)return O;if(G=typeof G!=="number"?O._pos[1]:G,W=typeof W!=="number"?O._pos[2]:W,typeof Y==="number")if(O._pos=[Y,G,W],typeof O.ctx.listener.positionX<"u")O.ctx.listener.positionX.setTargetAtTime(O._pos[0],Howler.ctx.currentTime,0.1),O.ctx.listener.positionY.setTargetAtTime(O._pos[1],Howler.ctx.currentTime,0.1),O.ctx.listener.positionZ.setTargetAtTime(O._pos[2],Howler.ctx.currentTime,0.1);else O.ctx.listener.setPosition(O._pos[0],O._pos[1],O._pos[2]);else return O._pos;return O},HowlerGlobal.prototype.orientation=function(Y,G,W,O,A,Q){var S=this;if(!S.ctx||!S.ctx.listener)return S;var E=S._orientation;if(G=typeof G!=="number"?E[1]:G,W=typeof W!=="number"?E[2]:W,O=typeof O!=="number"?E[3]:O,A=typeof A!=="number"?E[4]:A,Q=typeof Q!=="number"?E[5]:Q,typeof Y==="number")if(S._orientation=[Y,G,W,O,A,Q],typeof S.ctx.listener.forwardX<"u")S.ctx.listener.forwardX.setTargetAtTime(Y,Howler.ctx.currentTime,0.1),S.ctx.listener.forwardY.setTargetAtTime(G,Howler.ctx.currentTime,0.1),S.ctx.listener.forwardZ.setTargetAtTime(W,Howler.ctx.currentTime,0.1),S.ctx.listener.upX.setTargetAtTime(O,Howler.ctx.currentTime,0.1),S.ctx.listener.upY.setTargetAtTime(A,Howler.ctx.currentTime,0.1),S.ctx.listener.upZ.setTargetAtTime(Q,Howler.ctx.currentTime,0.1);else S.ctx.listener.setOrientation(Y,G,W,O,A,Q);else return E;return S},Howl.prototype.init=function(Y){return function(G){var W=this;return W._orientation=G.orientation||[1,0,0],W._stereo=G.stereo||null,W._pos=G.pos||null,W._pannerAttr={coneInnerAngle:typeof G.coneInnerAngle<"u"?G.coneInnerAngle:360,coneOuterAngle:typeof G.coneOuterAngle<"u"?G.coneOuterAngle:360,coneOuterGain:typeof G.coneOuterGain<"u"?G.coneOuterGain:0,distanceModel:typeof G.distanceModel<"u"?G.distanceModel:"inverse",maxDistance:typeof G.maxDistance<"u"?G.maxDistance:1e4,panningModel:typeof G.panningModel<"u"?G.panningModel:"HRTF",refDistance:typeof G.refDistance<"u"?G.refDistance:1,rolloffFactor:typeof G.rolloffFactor<"u"?G.rolloffFactor:1},W._onstereo=G.onstereo?[{fn:G.onstereo}]:[],W._onpos=G.onpos?[{fn:G.onpos}]:[],W._onorientation=G.onorientation?[{fn:G.onorientation}]:[],Y.call(this,G)}}(Howl.prototype.init),Howl.prototype.stereo=function(Y,G){var W=this;if(!W._webAudio)return W;if(W._state!=="loaded")return W._queue.push({event:"stereo",action:function(){W.stereo(Y,G)}}),W;var O=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof G>"u")if(typeof Y==="number")W._stereo=Y,W._pos=[Y,0,0];else return W._stereo;var A=W._getSoundIds(G);for(var Q=0;Q<A.length;Q++){var S=W._soundById(A[Q]);if(S)if(typeof Y==="number"){if(S._stereo=Y,S._pos=[Y,0,0],S._node){if(S._pannerAttr.panningModel="equalpower",!S._panner||!S._panner.pan)J(S,O);if(O==="spatial")if(typeof S._panner.positionX<"u")S._panner.positionX.setValueAtTime(Y,Howler.ctx.currentTime),S._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),S._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime);else S._panner.setPosition(Y,0,0);else S._panner.pan.setValueAtTime(Y,Howler.ctx.currentTime)}W._emit("stereo",S._id)}else return S._stereo}return W},Howl.prototype.pos=function(Y,G,W,O){var A=this;if(!A._webAudio)return A;if(A._state!=="loaded")return A._queue.push({event:"pos",action:function(){A.pos(Y,G,W,O)}}),A;if(G=typeof G!=="number"?0:G,W=typeof W!=="number"?-0.5:W,typeof O>"u")if(typeof Y==="number")A._pos=[Y,G,W];else return A._pos;var Q=A._getSoundIds(O);for(var S=0;S<Q.length;S++){var E=A._soundById(Q[S]);if(E)if(typeof Y==="number"){if(E._pos=[Y,G,W],E._node){if(!E._panner||E._panner.pan)J(E,"spatial");if(typeof E._panner.positionX<"u")E._panner.positionX.setValueAtTime(Y,Howler.ctx.currentTime),E._panner.positionY.setValueAtTime(G,Howler.ctx.currentTime),E._panner.positionZ.setValueAtTime(W,Howler.ctx.currentTime);else E._panner.setPosition(Y,G,W)}A._emit("pos",E._id)}else return E._pos}return A},Howl.prototype.orientation=function(Y,G,W,O){var A=this;if(!A._webAudio)return A;if(A._state!=="loaded")return A._queue.push({event:"orientation",action:function(){A.orientation(Y,G,W,O)}}),A;if(G=typeof G!=="number"?A._orientation[1]:G,W=typeof W!=="number"?A._orientation[2]:W,typeof O>"u")if(typeof Y==="number")A._orientation=[Y,G,W];else return A._orientation;var Q=A._getSoundIds(O);for(var S=0;S<Q.length;S++){var E=A._soundById(Q[S]);if(E)if(typeof Y==="number"){if(E._orientation=[Y,G,W],E._node){if(!E._panner){if(!E._pos)E._pos=A._pos||[0,0,-0.5];J(E,"spatial")}if(typeof E._panner.orientationX<"u")E._panner.orientationX.setValueAtTime(Y,Howler.ctx.currentTime),E._panner.orientationY.setValueAtTime(G,Howler.ctx.currentTime),E._panner.orientationZ.setValueAtTime(W,Howler.ctx.currentTime);else E._panner.setOrientation(Y,G,W)}A._emit("orientation",E._id)}else return E._orientation}return A},Howl.prototype.pannerAttr=function(){var Y=this,G=arguments,W,O,A;if(!Y._webAudio)return Y;if(G.length===0)return Y._pannerAttr;else if(G.length===1)if(typeof G[0]==="object"){if(W=G[0],typeof O>"u"){if(!W.pannerAttr)W.pannerAttr={coneInnerAngle:W.coneInnerAngle,coneOuterAngle:W.coneOuterAngle,coneOuterGain:W.coneOuterGain,distanceModel:W.distanceModel,maxDistance:W.maxDistance,refDistance:W.refDistance,rolloffFactor:W.rolloffFactor,panningModel:W.panningModel};Y._pannerAttr={coneInnerAngle:typeof W.pannerAttr.coneInnerAngle<"u"?W.pannerAttr.coneInnerAngle:Y._coneInnerAngle,coneOuterAngle:typeof W.pannerAttr.coneOuterAngle<"u"?W.pannerAttr.coneOuterAngle:Y._coneOuterAngle,coneOuterGain:typeof W.pannerAttr.coneOuterGain<"u"?W.pannerAttr.coneOuterGain:Y._coneOuterGain,distanceModel:typeof W.pannerAttr.distanceModel<"u"?W.pannerAttr.distanceModel:Y._distanceModel,maxDistance:typeof W.pannerAttr.maxDistance<"u"?W.pannerAttr.maxDistance:Y._maxDistance,refDistance:typeof W.pannerAttr.refDistance<"u"?W.pannerAttr.refDistance:Y._refDistance,rolloffFactor:typeof W.pannerAttr.rolloffFactor<"u"?W.pannerAttr.rolloffFactor:Y._rolloffFactor,panningModel:typeof W.pannerAttr.panningModel<"u"?W.pannerAttr.panningModel:Y._panningModel}}}else return A=Y._soundById(parseInt(G[0],10)),A?A._pannerAttr:Y._pannerAttr;else if(G.length===2)W=G[0],O=parseInt(G[1],10);var Q=Y._getSoundIds(O);for(var S=0;S<Q.length;S++)if(A=Y._soundById(Q[S]),A){var E=A._pannerAttr;E={coneInnerAngle:typeof W.coneInnerAngle<"u"?W.coneInnerAngle:E.coneInnerAngle,coneOuterAngle:typeof W.coneOuterAngle<"u"?W.coneOuterAngle:E.coneOuterAngle,coneOuterGain:typeof W.coneOuterGain<"u"?W.coneOuterGain:E.coneOuterGain,distanceModel:typeof W.distanceModel<"u"?W.distanceModel:E.distanceModel,maxDistance:typeof W.maxDistance<"u"?W.maxDistance:E.maxDistance,refDistance:typeof W.refDistance<"u"?W.refDistance:E.refDistance,rolloffFactor:typeof W.rolloffFactor<"u"?W.rolloffFactor:E.rolloffFactor,panningModel:typeof W.panningModel<"u"?W.panningModel:E.panningModel};var k=A._panner;if(!k){if(!A._pos)A._pos=Y._pos||[0,0,-0.5];J(A,"spatial"),k=A._panner}k.coneInnerAngle=E.coneInnerAngle,k.coneOuterAngle=E.coneOuterAngle,k.coneOuterGain=E.coneOuterGain,k.distanceModel=E.distanceModel,k.maxDistance=E.maxDistance,k.refDistance=E.refDistance,k.rolloffFactor=E.rolloffFactor,k.panningModel=E.panningModel}return Y},Sound.prototype.init=function(Y){return function(){var G=this,W=G._parent;if(G._orientation=W._orientation,G._stereo=W._stereo,G._pos=W._pos,G._pannerAttr=W._pannerAttr,Y.call(this),G._stereo)W.stereo(G._stereo);else if(G._pos)W.pos(G._pos[0],G._pos[1],G._pos[2],G._id)}}(Sound.prototype.init),Sound.prototype.reset=function(Y){return function(){var G=this,W=G._parent;if(G._orientation=W._orientation,G._stereo=W._stereo,G._pos=W._pos,G._pannerAttr=W._pannerAttr,G._stereo)W.stereo(G._stereo);else if(G._pos)W.pos(G._pos[0],G._pos[1],G._pos[2],G._id);else if(G._panner)G._panner.disconnect(0),G._panner=void 0,W._refreshBuffer(G);return Y.call(this)}}(Sound.prototype.reset);var J=function(Y,G){if(G=G||"spatial",G==="spatial"){if(Y._panner=Howler.ctx.createPanner(),Y._panner.coneInnerAngle=Y._pannerAttr.coneInnerAngle,Y._panner.coneOuterAngle=Y._pannerAttr.coneOuterAngle,Y._panner.coneOuterGain=Y._pannerAttr.coneOuterGain,Y._panner.distanceModel=Y._pannerAttr.distanceModel,Y._panner.maxDistance=Y._pannerAttr.maxDistance,Y._panner.refDistance=Y._pannerAttr.refDistance,Y._panner.rolloffFactor=Y._pannerAttr.rolloffFactor,Y._panner.panningModel=Y._pannerAttr.panningModel,typeof Y._panner.positionX<"u")Y._panner.positionX.setValueAtTime(Y._pos[0],Howler.ctx.currentTime),Y._panner.positionY.setValueAtTime(Y._pos[1],Howler.ctx.currentTime),Y._panner.positionZ.setValueAtTime(Y._pos[2],Howler.ctx.currentTime);else Y._panner.setPosition(Y._pos[0],Y._pos[1],Y._pos[2]);if(typeof Y._panner.orientationX<"u")Y._panner.orientationX.setValueAtTime(Y._orientation[0],Howler.ctx.currentTime),Y._panner.orientationY.setValueAtTime(Y._orientation[1],Howler.ctx.currentTime),Y._panner.orientationZ.setValueAtTime(Y._orientation[2],Howler.ctx.currentTime);else Y._panner.setOrientation(Y._orientation[0],Y._orientation[1],Y._orientation[2])}else Y._panner=Howler.ctx.createStereoPanner(),Y._panner.pan.setValueAtTime(Y._stereo,Howler.ctx.currentTime);if(Y._panner.connect(Y._node),!Y._paused)Y._parent.pause(Y._id,!0).play(Y._id,!0)}})()});var hY=$0((d1)=>{Object.defineProperty(d1,"__esModule",{value:!0});d1.ERROR_PACKET=d1.PACKET_TYPES_REVERSE=d1.PACKET_TYPES=void 0;var Q1=Object.create(null);d1.PACKET_TYPES=Q1;Q1.open="0";Q1.close="1";Q1.ping="2";Q1.pong="3";Q1.message="4";Q1.upgrade="5";Q1.noop="6";var w8=Object.create(null);d1.PACKET_TYPES_REVERSE=w8;Object.keys(Q1).forEach((J)=>{w8[Q1[J]]=J});var AK={type:"error",data:"parser error"};d1.ERROR_PACKET=AK});var y8=$0(($Y)=>{Object.defineProperty($Y,"__esModule",{value:!0});$Y.encodePacket=void 0;$Y.encodePacketToBinary=MK;var HK=hY(),x8=typeof Blob==="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",b8=typeof ArrayBuffer==="function",v8=(J)=>{return typeof ArrayBuffer.isView==="function"?ArrayBuffer.isView(J):J&&J.buffer instanceof ArrayBuffer},h8=({type:J,data:Y},G,W)=>{if(x8&&Y instanceof Blob)if(G)return W(Y);else return j8(Y,W);else if(b8&&(Y instanceof ArrayBuffer||v8(Y)))if(G)return W(Y);else return j8(new Blob([Y]),W);return W(HK.PACKET_TYPES[J]+(Y||""))};$Y.encodePacket=h8;var j8=(J,Y)=>{let G=new FileReader;return G.onload=function(){let W=G.result.split(",")[1];Y("b"+(W||""))},G.readAsDataURL(J)};function k8(J){if(J instanceof Uint8Array)return J;else if(J instanceof ArrayBuffer)return new Uint8Array(J);else return new Uint8Array(J.buffer,J.byteOffset,J.byteLength)}var pZ;function MK(J,Y){if(x8&&J.data instanceof Blob)return J.data.arrayBuffer().then(k8).then(Y);else if(b8&&(J.data instanceof ArrayBuffer||v8(J.data)))return Y(k8(J.data));h8(J,!1,(G)=>{if(!pZ)pZ=new TextEncoder;Y(pZ.encode(G))})}});var f8=$0((bJ)=>{Object.defineProperty(bJ,"__esModule",{value:!0});bJ.decode=bJ.encode=void 0;var xJ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",UY=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let J=0;J<xJ.length;J++)UY[xJ.charCodeAt(J)]=J;var EK=(J)=>{let Y=new Uint8Array(J),G,W=Y.length,O="";for(G=0;G<W;G+=3)O+=xJ[Y[G]>>2],O+=xJ[(Y[G]&3)<<4|Y[G+1]>>4],O+=xJ[(Y[G+1]&15)<<2|Y[G+2]>>6],O+=xJ[Y[G+2]&63];if(W%3===2)O=O.substring(0,O.length-1)+"=";else if(W%3===1)O=O.substring(0,O.length-2)+"==";return O};bJ.encode=EK;var _K=(J)=>{let Y=J.length*0.75,G=J.length,W,O=0,A,Q,S,E;if(J[J.length-1]==="="){if(Y--,J[J.length-2]==="=")Y--}let k=new ArrayBuffer(Y),X=new Uint8Array(k);for(W=0;W<G;W+=4)A=UY[J.charCodeAt(W)],Q=UY[J.charCodeAt(W+1)],S=UY[J.charCodeAt(W+2)],E=UY[J.charCodeAt(W+3)],X[O++]=A<<2|Q>>4,X[O++]=(Q&15)<<4|S>>2,X[O++]=(S&3)<<6|E&63;return k};bJ.decode=_K});var m8=$0((fY)=>{Object.defineProperty(fY,"__esModule",{value:!0});fY.decodePacket=void 0;var yY=hY(),SK=f8(),PK=typeof ArrayBuffer==="function",CK=(J,Y)=>{if(typeof J!=="string")return{type:"message",data:g8(J,Y)};let G=J.charAt(0);if(G==="b")return{type:"message",data:QK(J.substring(1),Y)};if(!yY.PACKET_TYPES_REVERSE[G])return yY.ERROR_PACKET;return J.length>1?{type:yY.PACKET_TYPES_REVERSE[G],data:J.substring(1)}:{type:yY.PACKET_TYPES_REVERSE[G]}};fY.decodePacket=CK;var QK=(J,Y)=>{if(PK){let G=(0,SK.decode)(J);return g8(G,Y)}else return{base64:!0,data:J}},g8=(J,Y)=>{switch(Y){case"blob":if(J instanceof Blob)return J;else return new Blob([J]);case"arraybuffer":default:if(J instanceof ArrayBuffer)return J;else return J.buffer}}});var vJ=$0((l0)=>{Object.defineProperty(l0,"__esModule",{value:!0});l0.decodePayload=l0.decodePacket=l0.encodePayload=l0.encodePacket=l0.protocol=void 0;l0.createPacketEncoderStream=TK;l0.createPacketDecoderStream=IK;var cZ=y8();Object.defineProperty(l0,"encodePacket",{enumerable:!0,get:function(){return cZ.encodePacket}});var dZ=m8();Object.defineProperty(l0,"decodePacket",{enumerable:!0,get:function(){return dZ.decodePacket}});var p8=hY(),u8=String.fromCharCode(30),DK=(J,Y)=>{let G=J.length,W=Array(G),O=0;J.forEach((A,Q)=>{(0,cZ.encodePacket)(A,!1,(S)=>{if(W[Q]=S,++O===G)Y(W.join(u8))})})};l0.encodePayload=DK;var LK=(J,Y)=>{let G=J.split(u8),W=[];for(let O=0;O<G.length;O++){let A=(0,dZ.decodePacket)(G[O],Y);if(W.push(A),A.type==="error")break}return W};l0.decodePayload=LK;function TK(){return new TransformStream({transform(J,Y){(0,cZ.encodePacketToBinary)(J,(G)=>{let W=G.length,O;if(W<126)O=new Uint8Array(1),new DataView(O.buffer).setUint8(0,W);else if(W<65536){O=new Uint8Array(3);let A=new DataView(O.buffer);A.setUint8(0,126),A.setUint16(1,W)}else{O=new Uint8Array(9);let A=new DataView(O.buffer);A.setUint8(0,127),A.setBigUint64(1,BigInt(W))}if(J.data&&typeof J.data!=="string")O[0]|=128;Y.enqueue(O),Y.enqueue(G)})}})}var uZ;function gY(J){return J.reduce((Y,G)=>Y+G.length,0)}function mY(J,Y){if(J[0].length===Y)return J.shift();let G=new Uint8Array(Y),W=0;for(let O=0;O<Y;O++)if(G[O]=J[0][W++],W===J[0].length)J.shift(),W=0;if(J.length&&W<J[0].length)J[0]=J[0].slice(W);return G}function IK(J,Y){if(!uZ)uZ=new TextDecoder;let G=[],W=0,O=-1,A=!1;return new TransformStream({transform(Q,S){G.push(Q);while(!0){if(W===0){if(gY(G)<1)break;let E=mY(G,1);if(A=(E[0]&128)===128,O=E[0]&127,O<126)W=3;else if(O===126)W=1;else W=2}else if(W===1){if(gY(G)<2)break;let E=mY(G,2);O=new DataView(E.buffer,E.byteOffset,E.length).getUint16(0),W=3}else if(W===2){if(gY(G)<8)break;let E=mY(G,8),k=new DataView(E.buffer,E.byteOffset,E.length),X=k.getUint32(0);if(X>Math.pow(2,21)-1){S.enqueue(p8.ERROR_PACKET);break}O=X*Math.pow(2,32)+k.getUint32(4),W=3}else{if(gY(G)<O)break;let E=mY(G,O);S.enqueue((0,dZ.decodePacket)(A?E:uZ.decode(E),Y)),W=0}if(O===0||O>J){S.enqueue(p8.ERROR_PACKET);break}}}})}l0.protocol=4});var UJ=$0((c8)=>{c8.Emitter=g0;function g0(J){if(J)return wK(J)}function wK(J){for(var Y in g0.prototype)J[Y]=g0.prototype[Y];return J}g0.prototype.on=g0.prototype.addEventListener=function(J,Y){return this._callbacks=this._callbacks||{},(this._callbacks["$"+J]=this._callbacks["$"+J]||[]).push(Y),this};g0.prototype.once=function(J,Y){function G(){this.off(J,G),Y.apply(this,arguments)}return G.fn=Y,this.on(J,G),this};g0.prototype.off=g0.prototype.removeListener=g0.prototype.removeAllListeners=g0.prototype.removeEventListener=function(J,Y){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var G=this._callbacks["$"+J];if(!G)return this;if(arguments.length==1)return delete this._callbacks["$"+J],this;var W;for(var O=0;O<G.length;O++)if(W=G[O],W===Y||W.fn===Y){G.splice(O,1);break}if(G.length===0)delete this._callbacks["$"+J];return this};g0.prototype.emit=function(J){this._callbacks=this._callbacks||{};var Y=Array(arguments.length-1),G=this._callbacks["$"+J];for(var W=1;W<arguments.length;W++)Y[W-1]=arguments[W];if(G){G=G.slice(0);for(var W=0,O=G.length;W<O;++W)G[W].apply(this,Y)}return this};g0.prototype.emitReserved=g0.prototype.emit;g0.prototype.listeners=function(J){return this._callbacks=this._callbacks||{},this._callbacks["$"+J]||[]};g0.prototype.hasListeners=function(J){return!!this.listeners(J).length}});var VJ=$0((h1)=>{Object.defineProperty(h1,"__esModule",{value:!0});h1.defaultBinaryType=h1.globalThisShim=h1.nextTick=void 0;h1.createCookieJar=jK;h1.nextTick=(()=>{if(typeof Promise==="function"&&typeof Promise.resolve==="function")return(Y)=>Promise.resolve().then(Y);else return(Y,G)=>G(Y,0)})();h1.globalThisShim=(()=>{if(typeof self<"u")return self;else if(typeof window<"u")return window;else return Function("return this")()})();h1.defaultBinaryType="arraybuffer";function jK(){}});var OJ=$0((hJ)=>{Object.defineProperty(hJ,"__esModule",{value:!0});hJ.pick=kK;hJ.installTimerFunctions=vK;hJ.byteLength=yK;hJ.randomString=gK;var i1=VJ();function kK(J,...Y){return Y.reduce((G,W)=>{if(J.hasOwnProperty(W))G[W]=J[W];return G},{})}var xK=i1.globalThisShim.setTimeout,bK=i1.globalThisShim.clearTimeout;function vK(J,Y){if(Y.useNativeTimers)J.setTimeoutFn=xK.bind(i1.globalThisShim),J.clearTimeoutFn=bK.bind(i1.globalThisShim);else J.setTimeoutFn=i1.globalThisShim.setTimeout.bind(i1.globalThisShim),J.clearTimeoutFn=i1.globalThisShim.clearTimeout.bind(i1.globalThisShim)}var hK=1.33;function yK(J){if(typeof J==="string")return fK(J);return Math.ceil((J.byteLength||J.size)*hK)}function fK(J){let Y=0,G=0;for(let W=0,O=J.length;W<O;W++)if(Y=J.charCodeAt(W),Y<128)G+=1;else if(Y<2048)G+=2;else if(Y<55296||Y>=57344)G+=3;else W++,G+=4;return G}function gK(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}});var iZ=$0((pY)=>{Object.defineProperty(pY,"__esModule",{value:!0});pY.encode=mK;pY.decode=pK;function mK(J){let Y="";for(let G in J)if(J.hasOwnProperty(G)){if(Y.length)Y+="&";Y+=encodeURIComponent(G)+"="+encodeURIComponent(J[G])}return Y}function pK(J){let Y={},G=J.split("&");for(let W=0,O=G.length;W<O;W++){let A=G[W].split("=");Y[decodeURIComponent(A[0])]=decodeURIComponent(A[1])}return Y}});var i8=$0((B7,d8)=>{var yJ=1000,fJ=yJ*60,gJ=fJ*60,BJ=gJ*24,uK=BJ*7,cK=BJ*365.25;d8.exports=function(J,Y){Y=Y||{};var G=typeof J;if(G==="string"&&J.length>0)return dK(J);else if(G==="number"&&isFinite(J))return Y.long?lK(J):iK(J);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(J))};function dK(J){if(J=String(J),J.length>100)return;var Y=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(J);if(!Y)return;var G=parseFloat(Y[1]),W=(Y[2]||"ms").toLowerCase();switch(W){case"years":case"year":case"yrs":case"yr":case"y":return G*cK;case"weeks":case"week":case"w":return G*uK;case"days":case"day":case"d":return G*BJ;case"hours":case"hour":case"hrs":case"hr":case"h":return G*gJ;case"minutes":case"minute":case"mins":case"min":case"m":return G*fJ;case"seconds":case"second":case"secs":case"sec":case"s":return G*yJ;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return G;default:return}}function iK(J){var Y=Math.abs(J);if(Y>=BJ)return Math.round(J/BJ)+"d";if(Y>=gJ)return Math.round(J/gJ)+"h";if(Y>=fJ)return Math.round(J/fJ)+"m";if(Y>=yJ)return Math.round(J/yJ)+"s";return J+"ms"}function lK(J){var Y=Math.abs(J);if(Y>=BJ)return uY(J,Y,BJ,"day");if(Y>=gJ)return uY(J,Y,gJ,"hour");if(Y>=fJ)return uY(J,Y,fJ,"minute");if(Y>=yJ)return uY(J,Y,yJ,"second");return J+" ms"}function uY(J,Y,G,W){var O=Y>=G*1.5;return Math.round(J/G)+" "+W+(O?"s":"")}});var n8=$0((q7,l8)=>{function nK(J){G.debug=G,G.default=G,G.coerce=E,G.disable=A,G.enable=O,G.enabled=Q,G.humanize=i8(),G.destroy=k,Object.keys(J).forEach((X)=>{G[X]=J[X]}),G.names=[],G.skips=[],G.formatters={};function Y(X){let $=0;for(let R=0;R<X.length;R++)$=($<<5)-$+X.charCodeAt(R),$|=0;return G.colors[Math.abs($)%G.colors.length]}G.selectColor=Y;function G(X){let $,R=null,H,P;function I(...D){if(!I.enabled)return;let c=I,n=Number(new Date),K0=n-($||n);if(c.diff=K0,c.prev=$,c.curr=n,$=n,D[0]=G.coerce(D[0]),typeof D[0]!=="string")D.unshift("%O");let S0=0;D[0]=D[0].replace(/%([a-zA-Z%])/g,(V,s0)=>{if(V==="%%")return"%";S0++;let a=G.formatters[s0];if(typeof a==="function"){let N1=D[S0];V=a.call(c,N1),D.splice(S0,1),S0--}return V}),G.formatArgs.call(c,D),(c.log||G.log).apply(c,D)}if(I.namespace=X,I.useColors=G.useColors(),I.color=G.selectColor(X),I.extend=W,I.destroy=G.destroy,Object.defineProperty(I,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(R!==null)return R;if(H!==G.namespaces)H=G.namespaces,P=G.enabled(X);return P},set:(D)=>{R=D}}),typeof G.init==="function")G.init(I);return I}function W(X,$){let R=G(this.namespace+(typeof $>"u"?":":$)+X);return R.log=this.log,R}function O(X){G.save(X),G.namespaces=X,G.names=[],G.skips=[];let $,R=(typeof X==="string"?X:"").split(/[\s,]+/),H=R.length;for($=0;$<H;$++){if(!R[$])continue;if(X=R[$].replace(/\*/g,".*?"),X[0]==="-")G.skips.push(new RegExp("^"+X.slice(1)+"$"));else G.names.push(new RegExp("^"+X+"$"))}}function A(){let X=[...G.names.map(S),...G.skips.map(S).map(($)=>"-"+$)].join(",");return G.enable(""),X}function Q(X){if(X[X.length-1]==="*")return!0;let $,R;for($=0,R=G.skips.length;$<R;$++)if(G.skips[$].test(X))return!1;for($=0,R=G.names.length;$<R;$++)if(G.names[$].test(X))return!0;return!1}function S(X){return X.toString().substring(2,X.toString().length-2).replace(/\.\*\?$/,"*")}function E(X){if(X instanceof Error)return X.stack||X.message;return X}function k(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return G.enable(G.load()),G}l8.exports=nK});var Z1=$0((a0,cY)=>{a0.formatArgs=aK;a0.save=rK;a0.load=oK;a0.useColors=sK;a0.storage=tK();a0.destroy=(()=>{let J=!1;return()=>{if(!J)J=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();a0.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function sK(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let J;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(J=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(J[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function aK(J){if(J[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+J[0]+(this.useColors?"%c ":" ")+"+"+cY.exports.humanize(this.diff),!this.useColors)return;let Y="color: "+this.color;J.splice(1,0,Y,"color: inherit");let G=0,W=0;J[0].replace(/%[a-zA-Z%]/g,(O)=>{if(O==="%%")return;if(G++,O==="%c")W=G}),J.splice(W,0,Y)}a0.log=console.debug||console.log||(()=>{});function rK(J){try{if(J)a0.storage.setItem("debug",J);else a0.storage.removeItem("debug")}catch(Y){}}function oK(){let J;try{J=a0.storage.getItem("debug")}catch(Y){}if(!J&&typeof process<"u"&&"env"in process)J=process.env.DEBUG;return J}function tK(){try{return localStorage}catch(J){}}cY.exports=n8()(a0);var{formatters:eK}=cY.exports;eK.j=function(J){try{return JSON.stringify(J)}catch(Y){return"[UnexpectedJSONParseError]: "+Y.message}}});var VY=$0((l1)=>{var J3=l1&&l1.__importDefault||function(J){return J&&J.__esModule?J:{default:J}};Object.defineProperty(l1,"__esModule",{value:!0});l1.Transport=l1.TransportError=void 0;var Y3=vJ(),Z3=UJ(),G3=OJ(),K3=iZ(),W3=J3(Z1()),X3=(0,W3.default)("engine.io-client:transport");class lZ extends Error{constructor(J,Y,G){super(J);this.description=Y,this.context=G,this.type="TransportError"}}l1.TransportError=lZ;class s8 extends Z3.Emitter{constructor(J){super();this.writable=!1,(0,G3.installTimerFunctions)(this,J),this.opts=J,this.query=J.query,this.socket=J.socket,this.supportsBinary=!J.forceBase64}onError(J,Y,G){return super.emitReserved("error",new lZ(J,Y,G)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){if(this.readyState==="opening"||this.readyState==="open")this.doClose(),this.onClose();return this}send(J){if(this.readyState==="open")this.write(J);else X3("transport is not open, discarding packets")}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(J){let Y=(0,Y3.decodePacket)(J,this.socket.binaryType);this.onPacket(Y)}onPacket(J){super.emitReserved("packet",J)}onClose(J){this.readyState="closed",super.emitReserved("close",J)}pause(J){}createUri(J,Y={}){return J+"://"+this._hostname()+this._port()+this.opts.path+this._query(Y)}_hostname(){let J=this.opts.hostname;return J.indexOf(":")===-1?J:"["+J+"]"}_port(){if(this.opts.port&&(this.opts.secure&&Number(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80))return":"+this.opts.port;else return""}_query(J){let Y=(0,K3.encode)(J);return Y.length?"?"+Y:""}}l1.Transport=s8});var nZ=$0((mJ)=>{var z3=mJ&&mJ.__importDefault||function(J){return J&&J.__esModule?J:{default:J}};Object.defineProperty(mJ,"__esModule",{value:!0});mJ.Polling=void 0;var $3=VY(),U3=OJ(),a8=vJ(),V3=z3(Z1()),V1=(0,V3.default)("engine.io-client:polling");class r8 extends $3.Transport{constructor(){super(...arguments);this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(J){this.readyState="pausing";let Y=()=>{V1("paused"),this.readyState="paused",J()};if(this._polling||!this.writable){let G=0;if(this._polling)V1("we are currently polling - waiting to pause"),G++,this.once("pollComplete",function(){V1("pre-pause polling complete"),--G||Y()});if(!this.writable)V1("we are currently writing - waiting to pause"),G++,this.once("drain",function(){V1("pre-pause writing complete"),--G||Y()})}else Y()}_poll(){V1("polling"),this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(J){V1("polling got data %s",J);let Y=(G)=>{if(this.readyState==="opening"&&G.type==="open")this.onOpen();if(G.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(G)};if((0,a8.decodePayload)(J,this.socket.binaryType).forEach(Y),this.readyState!=="closed")if(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open")this._poll();else V1('ignoring poll - transport state "%s"',this.readyState)}doClose(){let J=()=>{V1("writing close packet"),this.write([{type:"close"}])};if(this.readyState==="open")V1("transport open - closing"),J();else V1("transport not open - deferring close"),this.once("open",J)}write(J){this.writable=!1,(0,a8.encodePayload)(J,(Y)=>{this.doWrite(Y,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let J=this.opts.secure?"https":"http",Y=this.query||{};if(this.opts.timestampRequests!==!1)Y[this.opts.timestampParam]=(0,U3.randomString)();if(!this.supportsBinary&&!Y.sid)Y.b64=1;return this.createUri(J,Y)}}mJ.Polling=r8});var t8=$0((dY)=>{Object.defineProperty(dY,"__esModule",{value:!0});dY.hasCORS=void 0;var o8=!1;try{o8=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch(J){}dY.hasCORS=o8});var iY=$0((D1)=>{var O3=D1&&D1.__importDefault||function(J){return J&&J.__esModule?J:{default:J}};Object.defineProperty(D1,"__esModule",{value:!0});D1.XHR=D1.Request=D1.BaseXHR=void 0;var B3=nZ(),q3=UJ(),e8=OJ(),Y9=VJ(),F3=t8(),R3=O3(Z1()),sZ=(0,R3.default)("engine.io-client:polling");function N3(){}class aZ extends B3.Polling{constructor(J){super(J);if(typeof location<"u"){let Y=location.protocol==="https:",G=location.port;if(!G)G=Y?"443":"80";this.xd=typeof location<"u"&&J.hostname!==location.hostname||G!==J.port}}doWrite(J,Y){let G=this.request({method:"POST",data:J});G.on("success",Y),G.on("error",(W,O)=>{this.onError("xhr post error",W,O)})}doPoll(){sZ("xhr poll");let J=this.request();J.on("data",this.onData.bind(this)),J.on("error",(Y,G)=>{this.onError("xhr poll error",Y,G)}),this.pollXhr=J}}D1.BaseXHR=aZ;class O1 extends q3.Emitter{constructor(J,Y,G){super();this.createRequest=J,(0,e8.installTimerFunctions)(this,G),this._opts=G,this._method=G.method||"GET",this._uri=Y,this._data=G.data!==void 0?G.data:null,this._create()}_create(){var J;let Y=(0,e8.pick)(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");Y.xdomain=!!this._opts.xd;let G=this._xhr=this.createRequest(Y);try{sZ("xhr open %s: %s",this._method,this._uri),G.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){G.setDisableHeaderCheck&&G.setDisableHeaderCheck(!0);for(let W in this._opts.extraHeaders)if(this._opts.extraHeaders.hasOwnProperty(W))G.setRequestHeader(W,this._opts.extraHeaders[W])}}catch(W){}if(this._method==="POST")try{G.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(W){}try{G.setRequestHeader("Accept","*/*")}catch(W){}if((J=this._opts.cookieJar)===null||J===void 0||J.addCookies(G),"withCredentials"in G)G.withCredentials=this._opts.withCredentials;if(this._opts.requestTimeout)G.timeout=this._opts.requestTimeout;G.onreadystatechange=()=>{var W;if(G.readyState===3)(W=this._opts.cookieJar)===null||W===void 0||W.parseCookies(G.getResponseHeader("set-cookie"));if(G.readyState!==4)return;if(G.status===200||G.status===1223)this._onLoad();else this.setTimeoutFn(()=>{this._onError(typeof G.status==="number"?G.status:0)},0)},sZ("xhr data %s",this._data),G.send(this._data)}catch(W){this.setTimeoutFn(()=>{this._onError(W)},0);return}if(typeof document<"u")this._index=O1.requestsCount++,O1.requests[this._index]=this}_onError(J){this.emitReserved("error",J,this._xhr),this._cleanup(!0)}_cleanup(J){if(typeof this._xhr>"u"||this._xhr===null)return;if(this._xhr.onreadystatechange=N3,J)try{this._xhr.abort()}catch(Y){}if(typeof document<"u")delete O1.requests[this._index];this._xhr=null}_onLoad(){let J=this._xhr.responseText;if(J!==null)this.emitReserved("data",J),this.emitReserved("success"),this._cleanup()}abort(){this._cleanup()}}D1.Request=O1;O1.requestsCount=0;O1.requests={};if(typeof document<"u"){if(typeof attachEvent==="function")attachEvent("onunload",J9);else if(typeof addEventListener==="function"){let J="onpagehide"in Y9.globalThisShim?"pagehide":"unload";addEventListener(J,J9,!1)}}function J9(){for(let J in O1.requests)if(O1.requests.hasOwnProperty(J))O1.requests[J].abort()}var A3=function(){let J=G9({xdomain:!1});return J&&J.responseType!==null}();class Z9 extends aZ{constructor(J){super(J);let Y=J&&J.forceBase64;this.supportsBinary=A3&&!Y}request(J={}){return Object.assign(J,{xd:this.xd},this.opts),new O1(G9,this.uri(),J)}}D1.XHR=Z9;function G9(J){let Y=J.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!Y||F3.hasCORS))return new XMLHttpRequest}catch(G){}if(!Y)try{return new Y9.globalThisShim[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(G){}}});var lY=$0((n1)=>{var H3=n1&&n1.__importDefault||function(J){return J&&J.__esModule?J:{default:J}};Object.defineProperty(n1,"__esModule",{value:!0});n1.WS=n1.BaseWS=void 0;var M3=VY(),K9=OJ(),E3=vJ(),oZ=VJ(),_3=H3(Z1()),S3=(0,_3.default)("engine.io-client:websocket"),W9=typeof navigator<"u"&&typeof navigator.product==="string"&&navigator.product.toLowerCase()==="reactnative";class tZ extends M3.Transport{get name(){return"websocket"}doOpen(){let J=this.uri(),Y=this.opts.protocols,G=W9?{}:(0,K9.pick)(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");if(this.opts.extraHeaders)G.headers=this.opts.extraHeaders;try{this.ws=this.createSocket(J,Y,G)}catch(W){return this.emitReserved("error",W)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{if(this.opts.autoUnref)this.ws._socket.unref();this.onOpen()},this.ws.onclose=(J)=>this.onClose({description:"websocket connection closed",context:J}),this.ws.onmessage=(J)=>this.onData(J.data),this.ws.onerror=(J)=>this.onError("websocket error",J)}write(J){this.writable=!1;for(let Y=0;Y<J.length;Y++){let G=J[Y],W=Y===J.length-1;(0,E3.encodePacket)(G,this.supportsBinary,(O)=>{try{this.doWrite(G,O)}catch(A){S3("websocket closed before onclose event")}if(W)(0,oZ.nextTick)(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){if(typeof this.ws<"u")this.ws.onerror=()=>{},this.ws.close(),this.ws=null}uri(){let J=this.opts.secure?"wss":"ws",Y=this.query||{};if(this.opts.timestampRequests)Y[this.opts.timestampParam]=(0,K9.randomString)();if(!this.supportsBinary)Y.b64=1;return this.createUri(J,Y)}}n1.BaseWS=tZ;var rZ=oZ.globalThisShim.WebSocket||oZ.globalThisShim.MozWebSocket;class X9 extends tZ{createSocket(J,Y,G){return!W9?Y?new rZ(J,Y):new rZ(J):new rZ(J,Y,G)}doWrite(J,Y){this.ws.send(Y)}}n1.WS=X9});var eZ=$0((pJ)=>{var P3=pJ&&pJ.__importDefault||function(J){return J&&J.__esModule?J:{default:J}};Object.defineProperty(pJ,"__esModule",{value:!0});pJ.WT=void 0;var C3=VY(),Q3=VJ(),z9=vJ(),D3=P3(Z1()),OY=(0,D3.default)("engine.io-client:webtransport");class $9 extends C3.Transport{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(J){return this.emitReserved("error",J)}this._transport.closed.then(()=>{OY("transport closed gracefully"),this.onClose()}).catch((J)=>{OY("transport closed due to %s",J),this.onError("webtransport error",J)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then((J)=>{let Y=(0,z9.createPacketDecoderStream)(Number.MAX_SAFE_INTEGER,this.socket.binaryType),G=J.readable.pipeThrough(Y).getReader(),W=(0,z9.createPacketEncoderStream)();W.readable.pipeTo(J.writable),this._writer=W.writable.getWriter();let O=()=>{G.read().then(({done:Q,value:S})=>{if(Q){OY("session is closed");return}OY("received chunk: %o",S),this.onPacket(S),O()}).catch((Q)=>{OY("an error occurred while reading: %s",Q)})};O();let A={type:"open"};if(this.query.sid)A.data=`{"sid":"${this.query.sid}"}`;this._writer.write(A).then(()=>this.onOpen())})})}write(J){this.writable=!1;for(let Y=0;Y<J.length;Y++){let G=J[Y],W=Y===J.length-1;this._writer.write(G).then(()=>{if(W)(0,Q3.nextTick)(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var J;(J=this._transport)===null||J===void 0||J.close()}}pJ.WT=$9});var J6=$0((nY)=>{Object.defineProperty(nY,"__esModule",{value:!0});nY.transports=void 0;var L3=iY(),T3=lY(),I3=eZ();nY.transports={websocket:T3.WS,webtransport:I3.WT,polling:L3.XHR}});var Z6=$0((Y6)=>{Object.defineProperty(Y6,"__esModule",{value:!0});Y6.parse=k3;var w3=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,j3=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function k3(J){if(J.length>8000)throw"URI too long";let Y=J,G=J.indexOf("["),W=J.indexOf("]");if(G!=-1&&W!=-1)J=J.substring(0,G)+J.substring(G,W).replace(/:/g,";")+J.substring(W,J.length);let O=w3.exec(J||""),A={},Q=14;while(Q--)A[j3[Q]]=O[Q]||"";if(G!=-1&&W!=-1)A.source=Y,A.host=A.host.substring(1,A.host.length-1).replace(/;/g,":"),A.authority=A.authority.replace("[","").replace("]","").replace(/;/g,":"),A.ipv6uri=!0;return A.pathNames=x3(A,A.path),A.queryKey=b3(A,A.query),A}function x3(J,Y){let G=/\/{2,9}/g,W=Y.replace(G,"/").split("/");if(Y.slice(0,1)=="/"||Y.length===0)W.splice(0,1);if(Y.slice(-1)=="/")W.splice(W.length-1,1);return W}function b3(J,Y){let G={};return Y.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(W,O,A){if(O)G[O]=A}),G}});var X6=$0((L1)=>{var v3=L1&&L1.__importDefault||function(J){return J&&J.__esModule?J:{default:J}};Object.defineProperty(L1,"__esModule",{value:!0});L1.Socket=L1.SocketWithUpgrade=L1.SocketWithoutUpgrade=void 0;var h3=J6(),U9=OJ(),y3=iZ(),V9=Z6(),f3=UJ(),O9=vJ(),G6=VJ(),g3=v3(Z1()),H0=(0,g3.default)("engine.io-client:socket"),K6=typeof addEventListener==="function"&&typeof removeEventListener==="function",BY=[];if(K6)addEventListener("offline",()=>{H0("closing %d connection(s) because the network was lost",BY.length),BY.forEach((J)=>J())},!1);class y1 extends f3.Emitter{constructor(J,Y){super();if(this.binaryType=G6.defaultBinaryType,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,J&&typeof J==="object")Y=J,J=null;if(J){let G=(0,V9.parse)(J);if(Y.hostname=G.host,Y.secure=G.protocol==="https"||G.protocol==="wss",Y.port=G.port,G.query)Y.query=G.query}else if(Y.host)Y.hostname=(0,V9.parse)(Y.host).host;if((0,U9.installTimerFunctions)(this,Y),this.secure=Y.secure!=null?Y.secure:typeof location<"u"&&location.protocol==="https:",Y.hostname&&!Y.port)Y.port=this.secure?"443":"80";if(this.hostname=Y.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=Y.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},Y.transports.forEach((G)=>{let W=G.prototype.name;this.transports.push(W),this._transportsByName[W]=G}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},Y),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query==="string")this.opts.query=(0,y3.decode)(this.opts.query);if(K6){if(this.opts.closeOnBeforeunload)this._beforeunloadEventListener=()=>{if(this.transport)this.transport.removeAllListeners(),this.transport.close()},addEventListener("beforeunload",this._beforeunloadEventListener,!1);if(this.hostname!=="localhost")H0("adding listener for the 'offline' event"),this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},BY.push(this._offlineEventListener)}if(this.opts.withCredentials)this._cookieJar=(0,G6.createCookieJar)();this._open()}createTransport(J){H0('creating transport "%s"',J);let Y=Object.assign({},this.opts.query);if(Y.EIO=O9.protocol,Y.transport=J,this.id)Y.sid=this.id;let G=Object.assign({},this.opts,{query:Y,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[J]);return H0("options: %j",G),new this._transportsByName[J](G)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let J=this.opts.rememberUpgrade&&y1.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let Y=this.createTransport(J);Y.open(),this.setTransport(Y)}setTransport(J){if(H0("setting transport %s",J.name),this.transport)H0("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners();this.transport=J,J.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",(Y)=>this._onClose("transport close",Y))}onOpen(){H0("socket open"),this.readyState="open",y1.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(J){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(H0('socket receive: type "%s", data "%s"',J.type,J.data),this.emitReserved("packet",J),this.emitReserved("heartbeat"),J.type){case"open":this.onHandshake(JSON.parse(J.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let Y=Error("server error");Y.code=J.data,this._onError(Y);break;case"message":this.emitReserved("data",J.data),this.emitReserved("message",J.data);break}else H0('packet received with socket readyState "%s"',this.readyState)}onHandshake(J){if(this.emitReserved("handshake",J),this.id=J.sid,this.transport.query.sid=J.sid,this._pingInterval=J.pingInterval,this._pingTimeout=J.pingTimeout,this._maxPayload=J.maxPayload,this.onOpen(),this.readyState==="closed")return;this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let J=this._pingInterval+this._pingTimeout;if(this._pingTimeoutTime=Date.now()+J,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},J),this.opts.autoUnref)this._pingTimeoutTimer.unref()}_onDrain(){if(this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0)this.emitReserved("drain");else this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let J=this._getWritablePackets();H0("flushing %d packets in socket",J.length),this.transport.send(J),this._prevBufferLen=J.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let Y=1;for(let G=0;G<this.writeBuffer.length;G++){let W=this.writeBuffer[G].data;if(W)Y+=(0,U9.byteLength)(W);if(G>0&&Y>this._maxPayload)return H0("only send %d out of %d packets",G,this.writeBuffer.length),this.writeBuffer.slice(0,G);Y+=2}return H0("payload size is %d (max: %d)",Y,this._maxPayload),this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let J=Date.now()>this._pingTimeoutTime;if(J)H0("throttled timer detected, scheduling connection close"),this._pingTimeoutTime=0,(0,G6.nextTick)(()=>{this._onClose("ping timeout")},this.setTimeoutFn);return J}write(J,Y,G){return this._sendPacket("message",J,Y,G),this}send(J,Y,G){return this._sendPacket("message",J,Y,G),this}_sendPacket(J,Y,G,W){if(typeof Y==="function")W=Y,Y=void 0;if(typeof G==="function")W=G,G=null;if(this.readyState==="closing"||this.readyState==="closed")return;G=G||{},G.compress=G.compress!==!1;let O={type:J,data:Y,options:G};if(this.emitReserved("packetCreate",O),this.writeBuffer.push(O),W)this.once("flush",W);this.flush()}close(){let J=()=>{this._onClose("forced close"),H0("socket closing - telling transport to close"),this.transport.close()},Y=()=>{this.off("upgrade",Y),this.off("upgradeError",Y),J()},G=()=>{this.once("upgrade",Y),this.once("upgradeError",Y)};if(this.readyState==="opening"||this.readyState==="open")if(this.readyState="closing",this.writeBuffer.length)this.once("drain",()=>{if(this.upgrading)G();else J()});else if(this.upgrading)G();else J();return this}_onError(J){if(H0("socket error %j",J),y1.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return H0("trying next transport"),this.transports.shift(),this._open();this.emitReserved("error",J),this._onClose("transport error",J)}_onClose(J,Y){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(H0('socket close with reason: "%s"',J),this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),K6){if(this._beforeunloadEventListener)removeEventListener("beforeunload",this._beforeunloadEventListener,!1);if(this._offlineEventListener){let G=BY.indexOf(this._offlineEventListener);if(G!==-1)H0("removing listener for the 'offline' event"),BY.splice(G,1)}}this.readyState="closed",this.id=null,this.emitReserved("close",J,Y),this.writeBuffer=[],this._prevBufferLen=0}}}L1.SocketWithoutUpgrade=y1;y1.protocol=O9.protocol;class W6 extends y1{constructor(){super(...arguments);this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade){H0("starting upgrade probes");for(let J=0;J<this._upgrades.length;J++)this._probe(this._upgrades[J])}}_probe(J){H0('probing transport "%s"',J);let Y=this.createTransport(J),G=!1;y1.priorWebsocketSuccess=!1;let W=()=>{if(G)return;H0('probe transport "%s" opened',J),Y.send([{type:"ping",data:"probe"}]),Y.once("packet",(X)=>{if(G)return;if(X.type==="pong"&&X.data==="probe"){if(H0('probe transport "%s" pong',J),this.upgrading=!0,this.emitReserved("upgrading",Y),!Y)return;y1.priorWebsocketSuccess=Y.name==="websocket",H0('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{if(G)return;if(this.readyState==="closed")return;H0("changing transport and sending upgrade packet"),k(),this.setTransport(Y),Y.send([{type:"upgrade"}]),this.emitReserved("upgrade",Y),Y=null,this.upgrading=!1,this.flush()})}else{H0('probe transport "%s" failed',J);let $=Error("probe error");$.transport=Y.name,this.emitReserved("upgradeError",$)}})};function O(){if(G)return;G=!0,k(),Y.close(),Y=null}let A=(X)=>{let $=Error("probe error: "+X);$.transport=Y.name,O(),H0('probe transport "%s" failed because of error: %s',J,X),this.emitReserved("upgradeError",$)};function Q(){A("transport closed")}function S(){A("socket closed")}function E(X){if(Y&&X.name!==Y.name)H0('"%s" works - aborting "%s"',X.name,Y.name),O()}let k=()=>{Y.removeListener("open",W),Y.removeListener("error",A),Y.removeListener("close",Q),this.off("close",S),this.off("upgrading",E)};if(Y.once("open",W),Y.once("error",A),Y.once("close",Q),this.once("close",S),this.once("upgrading",E),this._upgrades.indexOf("webtransport")!==-1&&J!=="webtransport")this.setTimeoutFn(()=>{if(!G)Y.open()},200);else Y.open()}onHandshake(J){this._upgrades=this._filterUpgrades(J.upgrades),super.onHandshake(J)}_filterUpgrades(J){let Y=[];for(let G=0;G<J.length;G++)if(~this.transports.indexOf(J[G]))Y.push(J[G]);return Y}}L1.SocketWithUpgrade=W6;class B9 extends W6{constructor(J,Y={}){let G=typeof J==="object"?J:Y;if(!G.transports||G.transports&&typeof G.transports[0]==="string")G.transports=(G.transports||["polling","websocket","webtransport"]).map((W)=>h3.transports[W]).filter((W)=>!!W);super(J,G)}}L1.Socket=B9});var F9=$0((sY)=>{Object.defineProperty(sY,"__esModule",{value:!0});sY.Fetch=void 0;var m3=nZ();class q9 extends m3.Polling{doPoll(){this._fetch().then((J)=>{if(!J.ok)return this.onError("fetch read error",J.status,J);J.text().then((Y)=>this.onData(Y))}).catch((J)=>{this.onError("fetch read error",J)})}doWrite(J,Y){this._fetch(J).then((G)=>{if(!G.ok)return this.onError("fetch write error",G.status,G);Y()}).catch((G)=>{this.onError("fetch write error",G)})}_fetch(J){var Y;let G=J!==void 0,W=new Headers(this.opts.extraHeaders);if(G)W.set("content-type","text/plain;charset=UTF-8");return(Y=this.socket._cookieJar)===null||Y===void 0||Y.appendCookies(W),fetch(this.uri(),{method:G?"POST":"GET",body:G?J:null,headers:W,credentials:this.opts.withCredentials?"include":"omit"}).then((O)=>{var A;return(A=this.socket._cookieJar)===null||A===void 0||A.parseCookies(O.headers.getSetCookie()),O})}}sY.Fetch=q9});var aY=$0((O0)=>{Object.defineProperty(O0,"__esModule",{value:!0});O0.WebTransport=O0.WebSocket=O0.NodeWebSocket=O0.XHR=O0.NodeXHR=O0.Fetch=O0.nextTick=O0.parse=O0.installTimerFunctions=O0.transports=O0.TransportError=O0.Transport=O0.protocol=O0.SocketWithUpgrade=O0.SocketWithoutUpgrade=O0.Socket=void 0;var R9=X6();Object.defineProperty(O0,"Socket",{enumerable:!0,get:function(){return R9.Socket}});var N9=X6();Object.defineProperty(O0,"SocketWithoutUpgrade",{enumerable:!0,get:function(){return N9.SocketWithoutUpgrade}});Object.defineProperty(O0,"SocketWithUpgrade",{enumerable:!0,get:function(){return N9.SocketWithUpgrade}});O0.protocol=R9.Socket.protocol;var A9=VY();Object.defineProperty(O0,"Transport",{enumerable:!0,get:function(){return A9.Transport}});Object.defineProperty(O0,"TransportError",{enumerable:!0,get:function(){return A9.TransportError}});var p3=J6();Object.defineProperty(O0,"transports",{enumerable:!0,get:function(){return p3.transports}});var u3=OJ();Object.defineProperty(O0,"installTimerFunctions",{enumerable:!0,get:function(){return u3.installTimerFunctions}});var c3=Z6();Object.defineProperty(O0,"parse",{enumerable:!0,get:function(){return c3.parse}});var d3=VJ();Object.defineProperty(O0,"nextTick",{enumerable:!0,get:function(){return d3.nextTick}});var i3=F9();Object.defineProperty(O0,"Fetch",{enumerable:!0,get:function(){return i3.Fetch}});var l3=iY();Object.defineProperty(O0,"NodeXHR",{enumerable:!0,get:function(){return l3.XHR}});var n3=iY();Object.defineProperty(O0,"XHR",{enumerable:!0,get:function(){return n3.XHR}});var s3=lY();Object.defineProperty(O0,"NodeWebSocket",{enumerable:!0,get:function(){return s3.WS}});var a3=lY();Object.defineProperty(O0,"WebSocket",{enumerable:!0,get:function(){return a3.WS}});var r3=eZ();Object.defineProperty(O0,"WebTransport",{enumerable:!0,get:function(){return r3.WT}})});var M9=$0((qY)=>{var o3=qY&&qY.__importDefault||function(J){return J&&J.__esModule?J:{default:J}};Object.defineProperty(qY,"__esModule",{value:!0});qY.url=JW;var t3=aY(),e3=o3(Z1()),H9=(0,e3.default)("socket.io-client:url");function JW(J,Y="",G){let W=J;if(G=G||typeof location<"u"&&location,J==null)J=G.protocol+"//"+G.host;if(typeof J==="string"){if(J.charAt(0)==="/")if(J.charAt(1)==="/")J=G.protocol+J;else J=G.host+J;if(!/^(https?|wss?):\/\//.test(J))if(H9("protocol-less url %s",J),typeof G<"u")J=G.protocol+"//"+J;else J="https://"+J;H9("parse %s",J),W=(0,t3.parse)(J)}if(!W.port){if(/^(http|ws)$/.test(W.protocol))W.port="80";else if(/^(http|ws)s$/.test(W.protocol))W.port="443"}W.path=W.path||"/";let A=W.host.indexOf(":")!==-1?"["+W.host+"]":W.host;return W.id=W.protocol+"://"+A+":"+W.port+Y,W.href=W.protocol+"://"+A+(G&&G.port===W.port?"":":"+W.port),W}});var z6=$0((uJ)=>{Object.defineProperty(uJ,"__esModule",{value:!0});uJ.hasBinary=uJ.isBinary=void 0;var YW=typeof ArrayBuffer==="function",ZW=(J)=>{return typeof ArrayBuffer.isView==="function"?ArrayBuffer.isView(J):J.buffer instanceof ArrayBuffer},E9=Object.prototype.toString,GW=typeof Blob==="function"||typeof Blob<"u"&&E9.call(Blob)==="[object BlobConstructor]",KW=typeof File==="function"||typeof File<"u"&&E9.call(File)==="[object FileConstructor]";function _9(J){return YW&&(J instanceof ArrayBuffer||ZW(J))||GW&&J instanceof Blob||KW&&J instanceof File}uJ.isBinary=_9;function rY(J,Y){if(!J||typeof J!=="object")return!1;if(Array.isArray(J)){for(let G=0,W=J.length;G<W;G++)if(rY(J[G]))return!0;return!1}if(_9(J))return!0;if(J.toJSON&&typeof J.toJSON==="function"&&arguments.length===1)return rY(J.toJSON(),!0);for(let G in J)if(Object.prototype.hasOwnProperty.call(J,G)&&rY(J[G]))return!0;return!1}uJ.hasBinary=rY});var S9=$0((cJ)=>{Object.defineProperty(cJ,"__esModule",{value:!0});cJ.reconstructPacket=cJ.deconstructPacket=void 0;var WW=z6();function XW(J){let Y=[],G=J.data,W=J;return W.data=$6(G,Y),W.attachments=Y.length,{packet:W,buffers:Y}}cJ.deconstructPacket=XW;function $6(J,Y){if(!J)return J;if((0,WW.isBinary)(J)){let G={_placeholder:!0,num:Y.length};return Y.push(J),G}else if(Array.isArray(J)){let G=Array(J.length);for(let W=0;W<J.length;W++)G[W]=$6(J[W],Y);return G}else if(typeof J==="object"&&!(J instanceof Date)){let G={};for(let W in J)if(Object.prototype.hasOwnProperty.call(J,W))G[W]=$6(J[W],Y);return G}return J}function zW(J,Y){return J.data=U6(J.data,Y),delete J.attachments,J}cJ.reconstructPacket=zW;function U6(J,Y){if(!J)return J;if(J&&J._placeholder===!0)if(typeof J.num==="number"&&J.num>=0&&J.num<Y.length)return Y[J.num];else throw Error("illegal attachments");else if(Array.isArray(J))for(let G=0;G<J.length;G++)J[G]=U6(J[G],Y);else if(typeof J==="object"){for(let G in J)if(Object.prototype.hasOwnProperty.call(J,G))J[G]=U6(J[G],Y)}return J}});var oY=$0((B1)=>{Object.defineProperty(B1,"__esModule",{value:!0});B1.Decoder=B1.Encoder=B1.PacketType=B1.protocol=void 0;var $W=UJ(),C9=S9(),Q9=z6(),UW=Z1(),V6=(0,UW.default)("socket.io-parser"),VW=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];B1.protocol=5;var D0;(function(J){J[J.CONNECT=0]="CONNECT",J[J.DISCONNECT=1]="DISCONNECT",J[J.EVENT=2]="EVENT",J[J.ACK=3]="ACK",J[J.CONNECT_ERROR=4]="CONNECT_ERROR",J[J.BINARY_EVENT=5]="BINARY_EVENT",J[J.BINARY_ACK=6]="BINARY_ACK"})(D0=B1.PacketType||(B1.PacketType={}));class D9{constructor(J){this.replacer=J}encode(J){if(V6("encoding packet %j",J),J.type===D0.EVENT||J.type===D0.ACK){if((0,Q9.hasBinary)(J))return this.encodeAsBinary({type:J.type===D0.EVENT?D0.BINARY_EVENT:D0.BINARY_ACK,nsp:J.nsp,data:J.data,id:J.id})}return[this.encodeAsString(J)]}encodeAsString(J){let Y=""+J.type;if(J.type===D0.BINARY_EVENT||J.type===D0.BINARY_ACK)Y+=J.attachments+"-";if(J.nsp&&J.nsp!=="/")Y+=J.nsp+",";if(J.id!=null)Y+=J.id;if(J.data!=null)Y+=JSON.stringify(J.data,this.replacer);return V6("encoded %j as %s",J,Y),Y}encodeAsBinary(J){let Y=(0,C9.deconstructPacket)(J),G=this.encodeAsString(Y.packet),W=Y.buffers;return W.unshift(G),W}}B1.Encoder=D9;function P9(J){return Object.prototype.toString.call(J)==="[object Object]"}class O6 extends $W.Emitter{constructor(J){super();this.reviver=J}add(J){let Y;if(typeof J==="string"){if(this.reconstructor)throw Error("got plaintext data when reconstructing a packet");Y=this.decodeString(J);let G=Y.type===D0.BINARY_EVENT;if(G||Y.type===D0.BINARY_ACK){if(Y.type=G?D0.EVENT:D0.ACK,this.reconstructor=new L9(Y),Y.attachments===0)super.emitReserved("decoded",Y)}else super.emitReserved("decoded",Y)}else if((0,Q9.isBinary)(J)||J.base64){if(!this.reconstructor)throw Error("got binary data when not reconstructing a packet");else if(Y=this.reconstructor.takeBinaryData(J),Y)this.reconstructor=null,super.emitReserved("decoded",Y)}else throw Error("Unknown type: "+J)}decodeString(J){let Y=0,G={type:Number(J.charAt(0))};if(D0[G.type]===void 0)throw Error("unknown packet type "+G.type);if(G.type===D0.BINARY_EVENT||G.type===D0.BINARY_ACK){let O=Y+1;while(J.charAt(++Y)!=="-"&&Y!=J.length);let A=J.substring(O,Y);if(A!=Number(A)||J.charAt(Y)!=="-")throw Error("Illegal attachments");G.attachments=Number(A)}if(J.charAt(Y+1)==="/"){let O=Y+1;while(++Y){if(J.charAt(Y)===",")break;if(Y===J.length)break}G.nsp=J.substring(O,Y)}else G.nsp="/";let W=J.charAt(Y+1);if(W!==""&&Number(W)==W){let O=Y+1;while(++Y){let A=J.charAt(Y);if(A==null||Number(A)!=A){--Y;break}if(Y===J.length)break}G.id=Number(J.substring(O,Y+1))}if(J.charAt(++Y)){let O=this.tryParse(J.substr(Y));if(O6.isPayloadValid(G.type,O))G.data=O;else throw Error("invalid payload")}return V6("decoded %s as %j",J,G),G}tryParse(J){try{return JSON.parse(J,this.reviver)}catch(Y){return!1}}static isPayloadValid(J,Y){switch(J){case D0.CONNECT:return P9(Y);case D0.DISCONNECT:return Y===void 0;case D0.CONNECT_ERROR:return typeof Y==="string"||P9(Y);case D0.EVENT:case D0.BINARY_EVENT:return Array.isArray(Y)&&(typeof Y[0]==="number"||typeof Y[0]==="string"&&VW.indexOf(Y[0])===-1);case D0.ACK:case D0.BINARY_ACK:return Array.isArray(Y)}}destroy(){if(this.reconstructor)this.reconstructor.finishedReconstruction(),this.reconstructor=null}}B1.Decoder=O6;class L9{constructor(J){this.packet=J,this.buffers=[],this.reconPack=J}takeBinaryData(J){if(this.buffers.push(J),this.buffers.length===this.reconPack.attachments){let Y=(0,C9.reconstructPacket)(this.reconPack,this.buffers);return this.finishedReconstruction(),Y}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}});var q6=$0((B6)=>{Object.defineProperty(B6,"__esModule",{value:!0});B6.on=OW;function OW(J,Y,G){return J.on(Y,G),function(){J.off(Y,G)}}});var F6=$0((dJ)=>{var BW=dJ&&dJ.__importDefault||function(J){return J&&J.__esModule?J:{default:J}};Object.defineProperty(dJ,"__esModule",{value:!0});dJ.Socket=void 0;var q1=oY(),tY=q6(),qW=UJ(),FW=BW(Z1()),I0=(0,FW.default)("socket.io-client:socket"),RW=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class T9 extends qW.Emitter{constructor(J,Y,G){super();if(this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=J,this.nsp=Y,G&&G.auth)this.auth=G.auth;if(this._opts=Object.assign({},G),this.io._autoConnect)this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let J=this.io;this.subs=[(0,tY.on)(J,"open",this.onopen.bind(this)),(0,tY.on)(J,"packet",this.onpacket.bind(this)),(0,tY.on)(J,"error",this.onerror.bind(this)),(0,tY.on)(J,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){if(this.connected)return this;if(this.subEvents(),!this.io._reconnecting)this.io.open();if(this.io._readyState==="open")this.onopen();return this}open(){return this.connect()}send(...J){return J.unshift("message"),this.emit.apply(this,J),this}emit(J,...Y){var G,W,O;if(RW.hasOwnProperty(J))throw Error('"'+J.toString()+'" is a reserved event name');if(Y.unshift(J),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(Y),this;let A={type:q1.PacketType.EVENT,data:Y};if(A.options={},A.options.compress=this.flags.compress!==!1,typeof Y[Y.length-1]==="function"){let k=this.ids++;I0("emitting packet with ack id %d",k);let X=Y.pop();this._registerAckCallback(k,X),A.id=k}let Q=(W=(G=this.io.engine)===null||G===void 0?void 0:G.transport)===null||W===void 0?void 0:W.writable,S=this.connected&&!((O=this.io.engine)===null||O===void 0?void 0:O._hasPingExpired());if(this.flags.volatile&&!Q)I0("discard packet as the transport is not currently writable");else if(S)this.notifyOutgoingListeners(A),this.packet(A);else this.sendBuffer.push(A);return this.flags={},this}_registerAckCallback(J,Y){var G;let W=(G=this.flags.timeout)!==null&&G!==void 0?G:this._opts.ackTimeout;if(W===void 0){this.acks[J]=Y;return}let O=this.io.setTimeoutFn(()=>{delete this.acks[J];for(let Q=0;Q<this.sendBuffer.length;Q++)if(this.sendBuffer[Q].id===J)I0("removing packet with ack id %d from the buffer",J),this.sendBuffer.splice(Q,1);I0("event with ack id %d has timed out after %d ms",J,W),Y.call(this,Error("operation has timed out"))},W),A=(...Q)=>{this.io.clearTimeoutFn(O),Y.apply(this,Q)};A.withError=!0,this.acks[J]=A}emitWithAck(J,...Y){return new Promise((G,W)=>{let O=(A,Q)=>{return A?W(A):G(Q)};O.withError=!0,Y.push(O),this.emit(J,...Y)})}_addToQueue(J){let Y;if(typeof J[J.length-1]==="function")Y=J.pop();let G={id:this._queueSeq++,tryCount:0,pending:!1,args:J,flags:Object.assign({fromQueue:!0},this.flags)};J.push((W,...O)=>{if(G!==this._queue[0])return;if(W!==null){if(G.tryCount>this._opts.retries){if(I0("packet [%d] is discarded after %d tries",G.id,G.tryCount),this._queue.shift(),Y)Y(W)}}else if(I0("packet [%d] was successfully sent",G.id),this._queue.shift(),Y)Y(null,...O);return G.pending=!1,this._drainQueue()}),this._queue.push(G),this._drainQueue()}_drainQueue(J=!1){if(I0("draining queue"),!this.connected||this._queue.length===0)return;let Y=this._queue[0];if(Y.pending&&!J){I0("packet [%d] has already been sent and is waiting for an ack",Y.id);return}Y.pending=!0,Y.tryCount++,I0("sending packet [%d] (try n°%d)",Y.id,Y.tryCount),this.flags=Y.flags,this.emit.apply(this,Y.args)}packet(J){J.nsp=this.nsp,this.io._packet(J)}onopen(){if(I0("transport is open - connecting"),typeof this.auth=="function")this.auth((J)=>{this._sendConnectPacket(J)});else this._sendConnectPacket(this.auth)}_sendConnectPacket(J){this.packet({type:q1.PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},J):J})}onerror(J){if(!this.connected)this.emitReserved("connect_error",J)}onclose(J,Y){I0("close (%s)",J),this.connected=!1,delete this.id,this.emitReserved("disconnect",J,Y),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach((J)=>{if(!this.sendBuffer.some((G)=>String(G.id)===J)){let G=this.acks[J];if(delete this.acks[J],G.withError)G.call(this,Error("socket has been disconnected"))}})}onpacket(J){if(J.nsp!==this.nsp)return;switch(J.type){case q1.PacketType.CONNECT:if(J.data&&J.data.sid)this.onconnect(J.data.sid,J.data.pid);else this.emitReserved("connect_error",Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case q1.PacketType.EVENT:case q1.PacketType.BINARY_EVENT:this.onevent(J);break;case q1.PacketType.ACK:case q1.PacketType.BINARY_ACK:this.onack(J);break;case q1.PacketType.DISCONNECT:this.ondisconnect();break;case q1.PacketType.CONNECT_ERROR:this.destroy();let G=Error(J.data.message);G.data=J.data.data,this.emitReserved("connect_error",G);break}}onevent(J){let Y=J.data||[];if(I0("emitting event %j",Y),J.id!=null)I0("attaching ack callback to event"),Y.push(this.ack(J.id));if(this.connected)this.emitEvent(Y);else this.receiveBuffer.push(Object.freeze(Y))}emitEvent(J){if(this._anyListeners&&this._anyListeners.length){let Y=this._anyListeners.slice();for(let G of Y)G.apply(this,J)}if(super.emit.apply(this,J),this._pid&&J.length&&typeof J[J.length-1]==="string")this._lastOffset=J[J.length-1]}ack(J){let Y=this,G=!1;return function(...W){if(G)return;G=!0,I0("sending ack %j",W),Y.packet({type:q1.PacketType.ACK,id:J,data:W})}}onack(J){let Y=this.acks[J.id];if(typeof Y!=="function"){I0("bad ack %s",J.id);return}if(delete this.acks[J.id],I0("calling ack %s with %j",J.id,J.data),Y.withError)J.data.unshift(null);Y.apply(this,J.data)}onconnect(J,Y){I0("socket connected with id %s",J),this.id=J,this.recovered=Y&&this._pid===Y,this._pid=Y,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((J)=>this.emitEvent(J)),this.receiveBuffer=[],this.sendBuffer.forEach((J)=>{this.notifyOutgoingListeners(J),this.packet(J)}),this.sendBuffer=[]}ondisconnect(){I0("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")}destroy(){if(this.subs)this.subs.forEach((J)=>J()),this.subs=void 0;this.io._destroy(this)}disconnect(){if(this.connected)I0("performing disconnect (%s)",this.nsp),this.packet({type:q1.PacketType.DISCONNECT});if(this.destroy(),this.connected)this.onclose("io client disconnect");return this}close(){return this.disconnect()}compress(J){return this.flags.compress=J,this}get volatile(){return this.flags.volatile=!0,this}timeout(J){return this.flags.timeout=J,this}onAny(J){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(J),this}prependAny(J){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(J),this}offAny(J){if(!this._anyListeners)return this;if(J){let Y=this._anyListeners;for(let G=0;G<Y.length;G++)if(J===Y[G])return Y.splice(G,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(J){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(J),this}prependAnyOutgoing(J){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(J),this}offAnyOutgoing(J){if(!this._anyOutgoingListeners)return this;if(J){let Y=this._anyOutgoingListeners;for(let G=0;G<Y.length;G++)if(J===Y[G])return Y.splice(G,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(J){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let Y=this._anyOutgoingListeners.slice();for(let G of Y)G.apply(this,J.data)}}}dJ.Socket=T9});var I9=$0((R6)=>{Object.defineProperty(R6,"__esModule",{value:!0});R6.Backoff=iJ;function iJ(J){J=J||{},this.ms=J.min||100,this.max=J.max||1e4,this.factor=J.factor||2,this.jitter=J.jitter>0&&J.jitter<=1?J.jitter:0,this.attempts=0}iJ.prototype.duration=function(){var J=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var Y=Math.random(),G=Math.floor(Y*this.jitter*J);J=(Math.floor(Y*10)&1)==0?J-G:J+G}return Math.min(J,this.max)|0};iJ.prototype.reset=function(){this.attempts=0};iJ.prototype.setMin=function(J){this.ms=J};iJ.prototype.setMax=function(J){this.max=J};iJ.prototype.setJitter=function(J){this.jitter=J}});var j9=$0((G1)=>{var NW=G1&&G1.__createBinding||(Object.create?function(J,Y,G,W){if(W===void 0)W=G;var O=Object.getOwnPropertyDescriptor(Y,G);if(!O||("get"in O?!Y.__esModule:O.writable||O.configurable))O={enumerable:!0,get:function(){return Y[G]}};Object.defineProperty(J,W,O)}:function(J,Y,G,W){if(W===void 0)W=G;J[W]=Y[G]}),AW=G1&&G1.__setModuleDefault||(Object.create?function(J,Y){Object.defineProperty(J,"default",{enumerable:!0,value:Y})}:function(J,Y){J.default=Y}),HW=G1&&G1.__importStar||function(J){if(J&&J.__esModule)return J;var Y={};if(J!=null){for(var G in J)if(G!=="default"&&Object.prototype.hasOwnProperty.call(J,G))NW(Y,J,G)}return AW(Y,J),Y},MW=G1&&G1.__importDefault||function(J){return J&&J.__esModule?J:{default:J}};Object.defineProperty(G1,"__esModule",{value:!0});G1.Manager=void 0;var N6=aY(),EW=F6(),_W=HW(oY()),qJ=q6(),SW=I9(),PW=UJ(),CW=MW(Z1()),x0=(0,CW.default)("socket.io-client:manager");class w9 extends PW.Emitter{constructor(J,Y){var G;super();if(this.nsps={},this.subs=[],J&&typeof J==="object")Y=J,J=void 0;Y=Y||{},Y.path=Y.path||"/socket.io",this.opts=Y,(0,N6.installTimerFunctions)(this,Y),this.reconnection(Y.reconnection!==!1),this.reconnectionAttempts(Y.reconnectionAttempts||1/0),this.reconnectionDelay(Y.reconnectionDelay||1000),this.reconnectionDelayMax(Y.reconnectionDelayMax||5000),this.randomizationFactor((G=Y.randomizationFactor)!==null&&G!==void 0?G:0.5),this.backoff=new SW.Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(Y.timeout==null?20000:Y.timeout),this._readyState="closed",this.uri=J;let W=Y.parser||_W;if(this.encoder=new W.Encoder,this.decoder=new W.Decoder,this._autoConnect=Y.autoConnect!==!1,this._autoConnect)this.open()}reconnection(J){if(!arguments.length)return this._reconnection;if(this._reconnection=!!J,!J)this.skipReconnect=!0;return this}reconnectionAttempts(J){if(J===void 0)return this._reconnectionAttempts;return this._reconnectionAttempts=J,this}reconnectionDelay(J){var Y;if(J===void 0)return this._reconnectionDelay;return this._reconnectionDelay=J,(Y=this.backoff)===null||Y===void 0||Y.setMin(J),this}randomizationFactor(J){var Y;if(J===void 0)return this._randomizationFactor;return this._randomizationFactor=J,(Y=this.backoff)===null||Y===void 0||Y.setJitter(J),this}reconnectionDelayMax(J){var Y;if(J===void 0)return this._reconnectionDelayMax;return this._reconnectionDelayMax=J,(Y=this.backoff)===null||Y===void 0||Y.setMax(J),this}timeout(J){if(!arguments.length)return this._timeout;return this._timeout=J,this}maybeReconnectOnOpen(){if(!this._reconnecting&&this._reconnection&&this.backoff.attempts===0)this.reconnect()}open(J){if(x0("readyState %s",this._readyState),~this._readyState.indexOf("open"))return this;x0("opening %s",this.uri),this.engine=new N6.Socket(this.uri,this.opts);let Y=this.engine,G=this;this._readyState="opening",this.skipReconnect=!1;let W=(0,qJ.on)(Y,"open",function(){G.onopen(),J&&J()}),O=(Q)=>{if(x0("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",Q),J)J(Q);else this.maybeReconnectOnOpen()},A=(0,qJ.on)(Y,"error",O);if(this._timeout!==!1){let Q=this._timeout;x0("connect attempt will timeout after %d",Q);let S=this.setTimeoutFn(()=>{x0("connect attempt timed out after %d",Q),W(),O(Error("timeout")),Y.close()},Q);if(this.opts.autoUnref)S.unref();this.subs.push(()=>{this.clearTimeoutFn(S)})}return this.subs.push(W),this.subs.push(A),this}connect(J){return this.open(J)}onopen(){x0("open"),this.cleanup(),this._readyState="open",this.emitReserved("open");let J=this.engine;this.subs.push((0,qJ.on)(J,"ping",this.onping.bind(this)),(0,qJ.on)(J,"data",this.ondata.bind(this)),(0,qJ.on)(J,"error",this.onerror.bind(this)),(0,qJ.on)(J,"close",this.onclose.bind(this)),(0,qJ.on)(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(J){try{this.decoder.add(J)}catch(Y){this.onclose("parse error",Y)}}ondecoded(J){(0,N6.nextTick)(()=>{this.emitReserved("packet",J)},this.setTimeoutFn)}onerror(J){x0("error",J),this.emitReserved("error",J)}socket(J,Y){let G=this.nsps[J];if(!G)G=new EW.Socket(this,J,Y),this.nsps[J]=G;else if(this._autoConnect&&!G.active)G.connect();return G}_destroy(J){let Y=Object.keys(this.nsps);for(let G of Y)if(this.nsps[G].active){x0("socket %s is still active, skipping close",G);return}this._close()}_packet(J){x0("writing packet %j",J);let Y=this.encoder.encode(J);for(let G=0;G<Y.length;G++)this.engine.write(Y[G],J.options)}cleanup(){x0("cleanup"),this.subs.forEach((J)=>J()),this.subs.length=0,this.decoder.destroy()}_close(){x0("disconnect"),this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(J,Y){var G;if(x0("closed due to %s",J),this.cleanup(),(G=this.engine)===null||G===void 0||G.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",J,Y),this._reconnection&&!this.skipReconnect)this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let J=this;if(this.backoff.attempts>=this._reconnectionAttempts)x0("reconnect failed"),this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let Y=this.backoff.duration();x0("will wait %dms before reconnect attempt",Y),this._reconnecting=!0;let G=this.setTimeoutFn(()=>{if(J.skipReconnect)return;if(x0("attempting reconnect"),this.emitReserved("reconnect_attempt",J.backoff.attempts),J.skipReconnect)return;J.open((W)=>{if(W)x0("reconnect attempt error"),J._reconnecting=!1,J.reconnect(),this.emitReserved("reconnect_error",W);else x0("reconnect success"),J.onreconnect()})},Y);if(this.opts.autoUnref)G.unref();this.subs.push(()=>{this.clearTimeoutFn(G)})}}onreconnect(){let J=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",J)}}G1.Manager=w9});var v9=$0((_0,b9)=>{var QW=_0&&_0.__importDefault||function(J){return J&&J.__esModule?J:{default:J}};Object.defineProperty(_0,"__esModule",{value:!0});_0.WebTransport=_0.WebSocket=_0.NodeWebSocket=_0.XHR=_0.NodeXHR=_0.Fetch=_0.Socket=_0.Manager=_0.protocol=void 0;_0.io=FJ;_0.connect=FJ;_0.default=FJ;var DW=M9(),eY=j9();Object.defineProperty(_0,"Manager",{enumerable:!0,get:function(){return eY.Manager}});var x9=F6();Object.defineProperty(_0,"Socket",{enumerable:!0,get:function(){return x9.Socket}});var LW=QW(Z1()),k9=(0,LW.default)("socket.io-client"),FY={};function FJ(J,Y){if(typeof J==="object")Y=J,J=void 0;Y=Y||{};let G=(0,DW.url)(J,Y.path||"/socket.io"),W=G.source,O=G.id,A=G.path,Q=FY[O]&&A in FY[O].nsps,S=Y.forceNew||Y["force new connection"]||Y.multiplex===!1||Q,E;if(S)k9("ignoring socket cache for %s",W),E=new eY.Manager(W,Y);else{if(!FY[O])k9("new io instance for %s",W),FY[O]=new eY.Manager(W,Y);E=FY[O]}if(G.query&&!Y.query)Y.query=G.queryKey;return E.socket(G.path,Y)}Object.assign(FJ,{Manager:eY.Manager,Socket:x9.Socket,io:FJ,connect:FJ});var TW=oY();Object.defineProperty(_0,"protocol",{enumerable:!0,get:function(){return TW.protocol}});var lJ=aY();Object.defineProperty(_0,"Fetch",{enumerable:!0,get:function(){return lJ.Fetch}});Object.defineProperty(_0,"NodeXHR",{enumerable:!0,get:function(){return lJ.NodeXHR}});Object.defineProperty(_0,"XHR",{enumerable:!0,get:function(){return lJ.XHR}});Object.defineProperty(_0,"NodeWebSocket",{enumerable:!0,get:function(){return lJ.NodeWebSocket}});Object.defineProperty(_0,"WebSocket",{enumerable:!0,get:function(){return lJ.WebSocket}});Object.defineProperty(_0,"WebTransport",{enumerable:!0,get:function(){return lJ.WebTransport}});b9.exports=FJ});var y9=$0((RY)=>{var n0={silent:Number.NEGATIVE_INFINITY,fatal:0,error:0,warn:1,log:2,info:3,success:3,fail:3,ready:3,start:3,box:3,debug:4,trace:5,verbose:Number.POSITIVE_INFINITY},E6={silent:{level:-1},fatal:{level:n0.fatal},error:{level:n0.error},warn:{level:n0.warn},log:{level:n0.log},info:{level:n0.info},success:{level:n0.success},fail:{level:n0.fail},ready:{level:n0.info},start:{level:n0.info},box:{level:n0.info},debug:{level:n0.debug},trace:{level:n0.trace},verbose:{level:n0.verbose}};function A6(J){if(J===null||typeof J!=="object")return!1;let Y=Object.getPrototypeOf(J);if(Y!==null&&Y!==Object.prototype&&Object.getPrototypeOf(Y)!==null)return!1;if(Symbol.iterator in J)return!1;if(Symbol.toStringTag in J)return Object.prototype.toString.call(J)==="[object Module]";return!0}function _6(J,Y,G=".",W){if(!A6(Y))return _6(J,{},G,W);let O=Object.assign({},Y);for(let A in J){if(A==="__proto__"||A==="constructor")continue;let Q=J[A];if(Q===null||Q===void 0)continue;if(W&&W(O,A,Q,G))continue;if(Array.isArray(Q)&&Array.isArray(O[A]))O[A]=[...Q,...O[A]];else if(A6(Q)&&A6(O[A]))O[A]=_6(Q,O[A],(G?`${G}.`:"")+A.toString(),W);else O[A]=Q}return O}function IW(J){return(...Y)=>Y.reduce((G,W)=>_6(G,W,"",J),{})}var wW=IW();function jW(J){return Object.prototype.toString.call(J)==="[object Object]"}function kW(J){if(!jW(J))return!1;if(!J.message&&!J.args)return!1;if(J.stack)return!1;return!0}var H6=!1,h9=[];class w0{options;_lastLog;_mockFn;constructor(J={}){let Y=J.types||E6;this.options=wW({...J,defaults:{...J.defaults},level:M6(J.level,Y),reporters:[...J.reporters||[]]},{types:E6,throttle:1000,throttleMin:5,formatOptions:{date:!0,colors:!1,compact:!0}});for(let G in Y){let W={type:G,...this.options.defaults,...Y[G]};this[G]=this._wrapLogFn(W),this[G].raw=this._wrapLogFn(W,!0)}if(this.options.mockFn)this.mockTypes();this._lastLog={}}get level(){return this.options.level}set level(J){this.options.level=M6(J,this.options.types,this.options.level)}prompt(J,Y){if(!this.options.prompt)throw Error("prompt is not supported!");return this.options.prompt(J,Y)}create(J){let Y=new w0({...this.options,...J});if(this._mockFn)Y.mockTypes(this._mockFn);return Y}withDefaults(J){return this.create({...this.options,defaults:{...this.options.defaults,...J}})}withTag(J){return this.withDefaults({tag:this.options.defaults.tag?this.options.defaults.tag+":"+J:J})}addReporter(J){return this.options.reporters.push(J),this}removeReporter(J){if(J){let Y=this.options.reporters.indexOf(J);if(Y!==-1)return this.options.reporters.splice(Y,1)}else this.options.reporters.splice(0);return this}setReporters(J){return this.options.reporters=Array.isArray(J)?J:[J],this}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}wrapConsole(){for(let J in this.options.types){if(!console["__"+J])console["__"+J]=console[J];console[J]=this[J].raw}}restoreConsole(){for(let J in this.options.types)if(console["__"+J])console[J]=console["__"+J],delete console["__"+J]}wrapStd(){this._wrapStream(this.options.stdout,"log"),this._wrapStream(this.options.stderr,"log")}_wrapStream(J,Y){if(!J)return;if(!J.__write)J.__write=J.write;J.write=(G)=>{this[Y].raw(String(G).trim())}}restoreStd(){this._restoreStream(this.options.stdout),this._restoreStream(this.options.stderr)}_restoreStream(J){if(!J)return;if(J.__write)J.write=J.__write,delete J.__write}pauseLogs(){H6=!0}resumeLogs(){H6=!1;let J=h9.splice(0);for(let Y of J)Y[0]._logFn(Y[1],Y[2])}mockTypes(J){let Y=J||this.options.mockFn;if(this._mockFn=Y,typeof Y!=="function")return;for(let G in this.options.types)this[G]=Y(G,this.options.types[G])||this[G],this[G].raw=this[G]}_wrapLogFn(J,Y){return(...G)=>{if(H6){h9.push([this,J,G,Y]);return}return this._logFn(J,G,Y)}}_logFn(J,Y,G){if((J.level||0)>this.level)return!1;let W={date:new Date,args:[],...J,level:M6(J.level,this.options.types)};if(!G&&Y.length===1&&kW(Y[0]))Object.assign(W,Y[0]);else W.args=[...Y];if(W.message)W.args.unshift(W.message),delete W.message;if(W.additional){if(!Array.isArray(W.additional))W.additional=W.additional.split(`
|
|
`);W.args.push(`
|
|
`+W.additional.join(`
|
|
`)),delete W.additional}W.type=typeof W.type==="string"?W.type.toLowerCase():"log",W.tag=typeof W.tag==="string"?W.tag:"";let O=(Q=!1)=>{let S=(this._lastLog.count||0)-this.options.throttleMin;if(this._lastLog.object&&S>0){let E=[...this._lastLog.object.args];if(S>1)E.push(`(repeated ${S} times)`);this._log({...this._lastLog.object,args:E}),this._lastLog.count=1}if(Q)this._lastLog.object=W,this._log(W)};clearTimeout(this._lastLog.timeout);let A=this._lastLog.time&&W.date?W.date.getTime()-this._lastLog.time.getTime():0;if(this._lastLog.time=W.date,A<this.options.throttle)try{let Q=JSON.stringify([W.type,W.tag,W.args]),S=this._lastLog.serialized===Q;if(this._lastLog.serialized=Q,S){if(this._lastLog.count=(this._lastLog.count||0)+1,this._lastLog.count>this.options.throttleMin){this._lastLog.timeout=setTimeout(O,this.options.throttle);return}}}catch{}O(!0)}_log(J){for(let Y of this.options.reporters)Y.log(J,{options:this.options})}}function M6(J,Y={},G=3){if(J===void 0)return G;if(typeof J==="number")return J;if(Y[J]&&Y[J].level!==void 0)return Y[J].level;return G}w0.prototype.add=w0.prototype.addReporter;w0.prototype.remove=w0.prototype.removeReporter;w0.prototype.clear=w0.prototype.removeReporter;w0.prototype.withScope=w0.prototype.withTag;w0.prototype.mock=w0.prototype.mockTypes;w0.prototype.pause=w0.prototype.pauseLogs;w0.prototype.resume=w0.prototype.resumeLogs;function xW(J={}){return new w0(J)}RY.Consola=w0;RY.LogLevels=n0;RY.LogTypes=E6;RY.createConsola=xW});var p9=$0((s1)=>{Object.defineProperty(s1,"__esModule",{value:!0});var JZ=y9();class f9{options;defaultColor;levelColorMap;typeColorMap;constructor(J){this.options={...J},this.defaultColor="#7f8c8d",this.levelColorMap={0:"#c0392b",1:"#f39c12",3:"#00BCD4"},this.typeColorMap={success:"#2ecc71"}}_getLogFn(J){if(J<1)return console.__error||console.error;if(J===1)return console.__warn||console.warn;return console.__log||console.log}log(J){let Y=this._getLogFn(J.level),G=J.type==="log"?"":J.type,W=J.tag||"",A=`
|
|
background: ${this.typeColorMap[J.type]||this.levelColorMap[J.level]||this.defaultColor};
|
|
border-radius: 0.5em;
|
|
color: white;
|
|
font-weight: bold;
|
|
padding: 2px 0.5em;
|
|
`,Q=`%c${[W,G].filter(Boolean).join(":")}`;if(typeof J.args[0]==="string")Y(`${Q}%c ${J.args[0]}`,A,"",...J.args.slice(1));else Y(Q,A,...J.args)}}function g9(J={}){return JZ.createConsola({reporters:J.reporters||[new f9({})],prompt(G,W={}){if(W.type==="confirm")return Promise.resolve(confirm(G));return Promise.resolve(prompt(G))},...J})}var m9=g9();s1.Consola=JZ.Consola;s1.LogLevels=JZ.LogLevels;s1.LogTypes=JZ.LogTypes;s1.consola=m9;s1.createConsola=g9;s1.default=m9});var lW={};GK(lW,{clientLogger:()=>F,audioManager:()=>m});var l=IZ(A8(),1);var KK=function(J){if(J){var Y=function(y){return[].slice.call(y)},G=0,W=1,O=2,A=3,Q=[],S=null,E="requestAnimationFrame"in J?function(){var y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{sync:!1};J.cancelAnimationFrame(S);var U0=function(){return X(Q.filter(function(L0){return L0.dirty&&L0.active}))};if(y.sync)return U0();S=J.requestAnimationFrame(U0)}:function(){},k=function(y){return function(U0){Q.forEach(function(L0){return L0.dirty=y}),E(U0)}},X=function(y){y.filter(function(L0){return!L0.styleComputed}).forEach(function(L0){L0.styleComputed=P(L0)}),y.filter(I).forEach(D);var U0=y.filter(H);U0.forEach(R),U0.forEach(function(L0){D(L0),$(L0)}),U0.forEach(c)},$=function(y){return y.dirty=G},R=function(y){y.availableWidth=y.element.parentNode.clientWidth,y.currentWidth=y.element.scrollWidth,y.previousFontSize=y.currentFontSize,y.currentFontSize=Math.min(Math.max(y.minSize,y.availableWidth/y.currentWidth*y.previousFontSize),y.maxSize),y.whiteSpace=y.multiLine&&y.currentFontSize===y.minSize?"normal":"nowrap"},H=function(y){return y.dirty!==O||y.dirty===O&&y.element.parentNode.clientWidth!==y.availableWidth},P=function(y){var U0=J.getComputedStyle(y.element,null);return y.currentFontSize=parseFloat(U0.getPropertyValue("font-size")),y.display=U0.getPropertyValue("display"),y.whiteSpace=U0.getPropertyValue("white-space"),!0},I=function(y){var U0=!1;return!y.preStyleTestCompleted&&(/inline-/.test(y.display)||(U0=!0,y.display="inline-block"),y.whiteSpace!=="nowrap"&&(U0=!0,y.whiteSpace="nowrap"),y.preStyleTestCompleted=!0,U0)},D=function(y){y.element.style.whiteSpace=y.whiteSpace,y.element.style.display=y.display,y.element.style.fontSize=y.currentFontSize+"px"},c=function(y){y.element.dispatchEvent(new CustomEvent("fit",{detail:{oldValue:y.previousFontSize,newValue:y.currentFontSize,scaleFactor:y.currentFontSize/y.previousFontSize}}))},n=function(y,U0){return function(L0){y.dirty=U0,y.active&&E(L0)}},K0=function(y){return function(){Q=Q.filter(function(U0){return U0.element!==y.element}),y.observeMutations&&y.observer.disconnect(),y.element.style.whiteSpace=y.originalStyle.whiteSpace,y.element.style.display=y.originalStyle.display,y.element.style.fontSize=y.originalStyle.fontSize}},S0=function(y){return function(){y.active||(y.active=!0,E())}},p0=function(y){return function(){return y.active=!1}},V=function(y){y.observeMutations&&(y.observer=new MutationObserver(n(y,W)),y.observer.observe(y.element,y.observeMutations))},s0={minSize:16,maxSize:512,multiLine:!0,observeMutations:"MutationObserver"in J&&{subtree:!0,childList:!0,characterData:!0}},a=null,N1=function(){J.clearTimeout(a),a=J.setTimeout(k(O),Z0.observeWindowDelay)},t1=["resize","orientationchange"];return Object.defineProperty(Z0,"observeWindow",{set:function(y){var U0="".concat(y?"add":"remove","EventListener");t1.forEach(function(L0){J[U0](L0,N1)})}}),Z0.observeWindow=!0,Z0.observeWindowDelay=100,Z0.fitAll=k(A),Z0}function m1(y,U0){var L0=Object.assign({},s0,U0),W1=y.map(function(_J){var t0=Object.assign({},L0,{element:_J,active:!0});return function(X1){X1.originalStyle={whiteSpace:X1.element.style.whiteSpace,display:X1.element.style.display,fontSize:X1.element.style.fontSize},V(X1),X1.newbie=!0,X1.dirty=!0,Q.push(X1)}(t0),{element:_J,fit:n(t0,A),unfreeze:S0(t0),freeze:p0(t0),unsubscribe:K0(t0)}});return E(),W1}function Z0(y){var U0=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return typeof y=="string"?m1(Y(document.querySelectorAll(y)),U0):m1([y],U0)[0]}}(typeof window>"u"?null:window),wZ=KK;var u,P0=!1,WK,$J="ATX-8000",F0={btn01:"",btn02:"",btn03:"",btn04:"",btn05:"",ln01:"",ln02:"",time:"",battery:"hidden",signal:"hidden",gps:!1,scan:!1,trunk:!1,warn:!1,leds:{}},WY=!1,S8="radio",XK={},xY;var jZ,jJ=[],xZ={},zK=2000,P8=1000,kZ=0,KJ=null,XY=!1,kJ=!1,H8,M8,E8,_8,C1=1,WJ=50,XJ=0,k0="Dark",zJ={light:null,dark:null,model:null},zY={minSize:1,maxSize:100,multiLine:!1,observeMutations:{subtree:!0,childList:!0,characterData:!0}};async function hZ(J){F.debug(`Preloading radio images for model: ${J}`);let Y=`/client/radios/${J}/radio.png`,G=`/client/radios/${J}/radio-dark.png`,W=new Image,O=new Image,A=new Promise((k)=>{W.onload=()=>k(!0),W.onerror=()=>k(!1),W.src=Y}),Q=new Promise((k)=>{O.onload=()=>k(!0),O.onerror=()=>k(!1),O.src=G}),[S,E]=await Promise.all([A,Q]);return zJ.model=J,zJ.light=S?Y:null,zJ.dark=E?G:null,F.debug(`Image preloading complete for ${J}:`,{light:S,dark:E}),{lightPath:S?Y:null,darkPath:E?G:null}}async function yZ(J,Y){if(zJ.model!==J||!zJ.light&&!zJ.dark)await hZ(J);let G=`/client/radios/${J}/radio-dark.png`,W=`/client/radios/${J}/radio.png`;if(Y==="Dark")if(zJ.dark)return F.debug(`Using preloaded dark image for ${J}`),{imagePath:G,actualTheme:"Dark"};else return{imagePath:W,actualTheme:"Light"};return F.debug(`Using preloaded light image for ${J}`),{imagePath:W,actualTheme:"Light"}}function v1(J,Y,G){if(!J)return null;if((G||Y)==="Dark"){if(J.darkColor)return J.darkColor}return J.color||null}function C8(J,Y,G){if((G||Y)==="Dark"){if(J?J.darkInv!==!1:!0)return"invert(100%) hue-rotate(180deg)"}return"none"}function bZ(J,Y){for(let G in Y)if(Y[G]&&typeof Y[G]==="object")if(Array.isArray(Y[G])){if(!J[G])J[G]=[];Y[G].forEach((W,O)=>{if(typeof W==="object"){if(!J[G][O])J[G][O]={};bZ(J[G][O],W)}else J[G][O]=W})}else{if(!J[G])J[G]={};bZ(J[G],Y[G])}else J[G]=Y[G];return J.buttons=Y.buttons||[],J.leds=Y.leds||[],J.radioWidth=Y.radioWidth||300,J.radioHeight=Y.radioHeight||406,J.defaultBottomPadding=Y.defaultBottomPadding||0,J}async function vZ(J,Y=""){let G=`/client/radios/${$J}/icons/${J}${Y}.png`,W=`/client/radios/default/icons/${J}${Y}.png`;try{if((await fetch(G)).ok)return G}catch(O){}try{if((await fetch(W)).ok)return W}catch(O){return F.warn(`No icon found for ${J}${Y}`),null}}function $K(J){return new Promise((Y,G)=>{let W={display:{...F0},iconStates:{},ledStates:{}};l.default(".led").each(function(){let O=l.default(this);W.ledStates[O.attr("id")]={display:O.css("display"),isActive:O.hasClass("active")}}),l.default(".icon").each(function(){let O=l.default(this);W.iconStates[O.attr("id")]={src:O.attr("src"),display:O.css("display")}}),l.default(".led").each(function(){let O=l.default(this);W.ledStates[O.attr("id")]={display:O.css("display")}}),$J=J,hZ(J).then(()=>{return yZ(J,k0)}).then((O)=>{if(l.default("#radio").css({background:`url('${O.imagePath}')`,backgroundRepeat:"no-repeat",backgroundSize:"contain"}),window.radioActualTheme=O.actualTheme,u)Q8(O.actualTheme),y0({_forceRedraw:!0})}),Promise.all([l.default.ajax({url:"/client/radios/default/config.json",method:"GET",dataType:"json"}),l.default.ajax({url:`/client/radios/${J}/config.json`,method:"GET",dataType:"json"}),m.loadRadioTones(J)]).then(([O,A,Q])=>{u=bZ(O,A),F.log(`Loaded tones for radio model: ${J}`,Q);let S=`/client/radios/${J}/fonts/${u.font}`,E=`/client/radios/default/fonts/${u.font}`;return new FontFace("RadioFont",`url('${S}')`,{weight:u.fontWeight||"normal"}).load().catch(()=>new FontFace("RadioFont",`url('${E}')`,{weight:u.fontWeight||"normal"}).load()).then((k)=>{return document.fonts.add(k),document.fonts.ready}).then(()=>{UK(),y0({...W.display,_forceRedraw:!0}),Object.entries(W.iconStates).forEach(([k,X])=>{let $=l.default(`#${k}`);if($.length)$.attr("src",X.src).css("display",X.display)}),Object.entries(W.ledStates).forEach(([k,X])=>{if(F0.leds&&F0.leds[k]!==void 0)fZ(k,F0.leds[k])}),Y()})}).catch(G)})}function UK(){if(hZ($J).then(()=>{return yZ($J,k0)}).then((J)=>{l.default("#radio").css({width:u.radioWidth||300,height:u.radioHeight||406,paddingBottom:u.defaultBottomPadding||0,background:`url('${J.imagePath}')`,backgroundRepeat:"no-repeat",backgroundSize:"contain"}),window.radioActualTheme=J.actualTheme}),u.texts.forEach((J)=>{let Y=l.default(`#${J.key}`),G=Y.find(".display-text");if(!G.text())G.text(J.text||"");Y.css({color:v1(J,k0,window.radioActualTheme)||"#FFFFFF",position:"absolute",left:J.x,top:J.y,width:J.width,height:J.height,transform:"translate(-50%, -50%)",fontFamily:"RadioFont",fontWeight:u.fontWeight||"normal"}).toggleClass("debug",P0)}),u.time&&u.time.enabled){let J=l.default("#time"),Y=J.find(".display-text");if(J.css({position:"absolute",left:u.time.x,top:u.time.y,width:u.time.width,height:u.time.height,transform:"translate(-50%, -50%)",fontFamily:"RadioFont",fontWeight:u.fontWeight||"normal",color:v1(u.time,k0,window.radioActualTheme)||"#FFFFFF"}).toggleClass("debug",P0),u.time.size===0)J.hide()}if(u.buttons.forEach((J)=>{let Y=l.default(`#${J.key}_btn`);if(!Y.length)Y=l.default("<button>").addClass("button").attr("id",`${J.key}_btn`).click(()=>OK(J.key)).appendTo("#radio");Y.css({left:J.x-J.width/2,top:J.y-J.height/2,width:J.width,height:J.height}).toggleClass("debug",P0)}),u.icons.forEach((J)=>{let Y=l.default(`#${J.key}`);if(!Y.length)Y=l.default("<img>").addClass("icon").attr("id",J.key).appendTo("#radio"),vZ(J.key).then((G)=>{if(G)Y.attr("src",G)}),XK[J.key]={model:`/client/radios/${$J}/icons/${J.key}`,default:`/client/radios/default/icons/${J.key}`};if(Y.css({left:J.x-J.width/2,top:J.y-J.height/2,width:J.width,height:J.height,filter:C8(J,k0,window.radioActualTheme)}),Y.css("display")==="")Y.css("display",P0?"block":"none")}),u.leds)l.default(".led").remove(),u.leds.forEach((J)=>{let Y=l.default("<div>").addClass("led").addClass(J.color||"red").addClass(J.roundness==="50%"?"circular":"rectangular").attr("id",J.key).appendTo("#radio");if(xZ[J.key]={active:!1,lastActivated:0},Y.css({left:J.x-J.width/2,top:J.y-J.height/2,width:J.width,height:J.height,display:"block",zIndex:P8}),F0.leds&&F0.leds[J.key]!==void 0)fZ(J.key,F0.leds[J.key])});if(l.default("#alert").css({position:"absolute",left:u.alert.x-u.alert.width/2,top:u.alert.y-u.alert.height/2,width:u.alert.width,height:u.alert.height,color:v1(u.alert,k0,window.radioActualTheme)||u.alert.color,display:"none",fontFamily:"RadioFont",fontWeight:u.fontWeight||"normal"}),WY=!0,P0)VK()}function bY(J){return`https://${S8}/${J}`}function VK(){l.default(".display-container").toggleClass("debug",P0),l.default(".button").toggleClass("debug",P0),l.default(".icon").toggleClass("debug",P0),l.default(".icon").css("display",P0?"block":"none"),l.default(".led").css("display",P0?"block":"none")}function OK(J){l.default.post(bY("btnPress"),JSON.stringify({btnID:J}))}window.addEventListener("message",function(J){let Y=J.data;switch(Y.action){case"open":if(l.default("body").show(),document.activeElement&&document.activeElement.blur&&document.activeElement.blur(),WY&&F0)y0(F0);break;case"setRadioConfig":let G={...F0};WY=!1,$K(Y.model).then(()=>{if(Y.display)y0({...G,...Y.display,_forceRedraw:!0});else y0({...G,_forceRedraw:!0})});break;case"dispUpdate":if(WY)y0(Y.display);break;case"setBatt":y0({battery:Y.status});break;case"setConnectionInfo":if(!Y.resourceName)return;S8=Y.resourceName;break;case"setSignal":y0({signal:Y.status});break;case"setGPS":y0({gps:Y.status});break;case"setTrunk":y0({trunk:Y.status});break;case"setWarn":y0({warn:Y.status});break;case"setScan":y0({scan:Y.status});break;case"setTime":y0({time:Y.time});break;case"alert":FK(Y.message,Y.mode,Y.textColor);break;case"close":l.default("body").hide(),document.activeElement&&document.activeElement.blur&&document.activeElement.blur();break;case"setMoveMode":if(kJ=Y.state,kJ)l.default("#radio").css("cursor","move");else l.default("#radio").css("cursor","default");break;case"increaseRadioSize":break;case"decreaseRadioSize":break;case"setRadioPosition":if(Y.pos)BK(Y.pos);break;case"setLED":let W={leds:{...F0.leds,[Y.key]:Y.mode}};y0(W);break;case"setTheme":if(Y.theme){if(k0=Y.theme,$J&&u)yZ($J,k0).then((O)=>{if(l.default("#radio").css({background:`url('${O.imagePath}')`,backgroundRepeat:"no-repeat",backgroundSize:"contain"}),window.radioActualTheme=O.actualTheme,Q8(O.actualTheme),F0)y0({...F0,_forceRedraw:!0})})}break;case"focus":l.default("body").show(),setTimeout(()=>{if(WY&&F0)y0(F0)},50);break}});function BK(J){if(!J)return;let Y=l.default("#radio");if(J.x!==void 0)WJ=J.x;if(J.y!==void 0)XJ=J.y;if(J.s!==void 0&&J.s!==0)C1=J.s,Y.css("transform",`scale(${C1})`);if(J.s==0)C1=1,Y.css("transform",`scale(${C1})`);Y.css({position:"absolute",right:WJ+"px",bottom:XJ+"px"})}function qK(){let J=l.default("#radio");J.on("mousedown",function(Y){if(!kJ)return;XY=!0,H8=Y.clientX,M8=Y.clientY,E8=parseInt(J.css("right")),_8=parseInt(J.css("bottom")),Y.preventDefault()}),l.default(document).on("mousemove",function(Y){if(!XY)return;let G=Y.clientX-H8,W=Y.clientY-M8;WJ=E8-G,XJ=_8-W,J.css({right:WJ+"px",bottom:XJ+"px"})}),l.default(document).on("mouseup",function(){if(XY)XY=!1,l.default.post(bY("savePosition"),JSON.stringify({x:WJ,y:XJ,scale:C1}))}),J.on("wheel",function(Y){if(!kJ)return;Y.preventDefault();let W=Y.originalEvent.deltaY>0?-0.05:0.05;C1=Math.max(0.5,Math.min(1.5,C1+W)),J.css("transform",`scale(${C1})`),l.default.post(bY("savePosition"),JSON.stringify({x:WJ,y:XJ,scale:C1}))})}function y0(J){let Y=J._forceRedraw;delete J._forceRedraw;let G={};if(Object.keys(J).forEach((O)=>{if(O==="leds"){if(JSON.stringify(F0.leds)!==JSON.stringify(J.leds))G.leds=J.leds}else if(F0[O]!==J[O])G[O]=J[O]}),Object.keys(G).length===0&&!Y)return;if(Y)jJ.forEach((O)=>O.unsubscribe()),jJ=[];if(J.leds)F0.leds={...F0.leds,...J.leds};if(Object.keys(J).forEach((O)=>{if(O!=="leds")F0[O]=J[O]}),Object.entries({btn1:"btn01",btn2:"btn02",btn3:"btn03",btn4:"btn04",btn5:"btn05",line1:"ln01",line2:"ln02",time:"time"}).forEach(([O,A])=>{if(Y||G[A]!==void 0){let Q=l.default(`#${O} .display-text`),S=Q.parent(),E=O==="time"?u.time:u.texts.find((R)=>R.key===O);if(E&&E.size===0){S.hide();return}let k=jJ.findIndex((R)=>R.element===Q[0]);if(k!==-1)jJ[k].unsubscribe(),jJ.splice(k,1);Q.text(F0[A]||""),S.show(),Q.css({fontSize:"",whiteSpace:"nowrap",height:"100%",width:"100%"}),Q.parent().css({color:v1(E,k0,window.radioActualTheme)||"#FFFFFF"});let X={...zY,maxSize:E?.size||zY.maxSize},$=wZ(Q[0],X);jJ.push($)}}),Y||G.battery!==void 0){let O=l.default("#batt");if(F0.battery==="hidden")O.hide();else{if(F0.battery==="hidden"){O.hide();return}vZ("batt",`_${F0.battery}`).then((A)=>{if(F0.battery==="hidden"){O.hide();return}if(A)O.attr("src",A).css("display",P0?"block":"block");else O.hide()})}}if(Y||G.signal!==void 0){let O=l.default("#sig");if(jZ)clearTimeout(jZ);if(F0.signal==="hidden")O.hide();else jZ=setTimeout(()=>{vZ("sig",`_${F0.signal}`).then((A)=>{if(A)O.attr("src",A).show();else O.hide()})},50)}if(Y||G.trunk!==void 0)l.default("#trunk").css("display",F0.trunk||P0?"block":"none");if(Y||G.warn!==void 0)l.default("#warn").css("display",F0.warn||P0?"block":"none");if(Y||G.gps!==void 0)l.default("#gps").css("display",F0.gps||P0?"block":"none");if(Y||G.scan!==void 0)l.default("#scan").css("display",F0.scan||P0?"block":"none");if(Y||G.leds)Object.entries(F0.leds||{}).forEach(([O,A])=>{fZ(O,A)})}function fZ(J,Y){let G=l.default(`#${J}`);if(!G.length)return;if(xZ[J]?.active!==Y){kZ++,xZ[J]={active:Y,lastActivated:Date.now()};let W=Y?zK+kZ:P8+kZ;G.css({"z-index":W,display:"block"}).toggleClass("active",Y||P0)}}function FK(J,Y,G){let W=l.default("#alert"),O=W.find(".display-text");if(xY)clearTimeout(xY),xY=null;if(KJ)KJ.unsubscribe(),KJ=null;W.stop(!0,!0);let A=u?window.radioActualTheme==="Dark"&&u.radioBGDarkColor?u.radioBGDarkColor:u.radioBGColor||"transparent":"transparent";W.css({backgroundColor:A,display:"none"});let Q=window.radioActualTheme||k0,S;if(u&&u.alert)S=v1(u.alert,k0,Q);if(!S)S=Q==="Dark"?"#FFFFFF":"#000000";if(O.text(J),W.css({backgroundColor:Y||A,display:"flex",left:u&&u.alert?u.alert.x-u.alert.width/2:0,top:u&&u.alert?u.alert.y-u.alert.height/2:0,width:u&&u.alert?u.alert.width:200,height:u&&u.alert?u.alert.height:50,position:"absolute"}),Y&&Y.startsWith&&Y.startsWith("#"))O[0].style.setProperty("color","#FFFFFF","important");else O[0].style.removeProperty("color"),O.css("color",S);W.show();let k={...zY,maxSize:u&&u.alert?u.alert.size||zY.maxSize:zY.maxSize,multiLine:!0};KJ=wZ(O[0],k),xY=setTimeout(()=>{W.hide(),W.css("backgroundColor",A);let X=window.radioActualTheme||k0,$;if(u&&u.alert)$=v1(u.alert,k0,X);if(!$)$=X==="Dark"?"#FFFFFF":"#000000";if(O[0].style.removeProperty("color"),O.css("color",$),KJ)KJ.unsubscribe(),KJ=null},3000)}function RK(){if(P0=!P0,P0)l.default("#radio").on("click.debug",function(J){let Y=l.default(this).offset(),G=Math.round(J.pageX-Y.left),W=Math.round(J.pageY-Y.top);F.debug(`Debug click at ${G}, ${W}`),l.default("<div>").css({position:"absolute",left:G-2,top:W-2,width:"4px",height:"4px",backgroundColor:"red",borderRadius:"50%",zIndex:9999}).appendTo("#radio").fadeOut(1000,function(){l.default(this).remove()})});else l.default("#radio").off("click.debug"),clearInterval(WK);l.default(".display-container").toggleClass("debug",P0),l.default(".button").toggleClass("debug",P0),l.default(".icon").toggleClass("debug",P0),l.default(".icon").css("display",P0?"block":"none"),l.default(".led").css("display",P0?"block":"none")}document.addEventListener("keyup",function(J){if(J.keyCode===27){if(kJ)kJ=!1,l.default("#radio").css("cursor","default"),XY=!1;l.default.post(bY("releaseFocus"),JSON.stringify({x:WJ,y:XJ,s:C1}))}});function Q8(J){if(!u)return;if(u.icons)u.icons.forEach((Y)=>{let G=l.default(`#${Y.key}`);if(G.length)G.css("filter",C8(Y,k0,J))});if(u.time)l.default("#time").css("color",v1(u.time,k0,J)||"#FFFFFF");if(u.alert){let Y=J==="Dark"&&u.radioBGDarkColor?u.radioBGDarkColor:u.radioBGColor||"transparent",G;if(u.alert)G=v1(u.alert,k0,J);if(!G)G=J==="Dark"?"#FFFFFF":"#000000";l.default("#alert").css({color:G,backgroundColor:Y})}if(u.texts)u.texts.forEach((Y)=>{let G=l.default(`#${Y.key}`);if(G.length)G.parent().css({color:v1(Y,k0,J)||"#FFFFFF"})})}l.default(document).ready(()=>{qK(),l.default("#debugToggle").click(RK)});var N0=IZ(gZ(),1);class D8{constructor(){this.active3DAudio=new Map,this.disablePositionUpdates=!1,this.listenerPosition={x:0,y:0,z:0},this.targetPosition={x:0,y:0,z:0},this.listenerOrientation={x:0,y:0,z:-1},this.targetOrientation={x:0,y:0,z:-1},this.smoothingFactor=0.6,this.fastSmoothingFactor=0.9,this.veryFastSmoothingFactor=1,this.listenerSpeed=0,this.maxDistance=1000,this.toneVolume=0.5,this.voiceVolume=0.5,this.sourceTargetPositions=new Map,this.interpolationRunning=!1,this.interpolationFrameId=null,this.volume3D=0.5,this.init3DSettings(),this.startInterpolationLoop(),F.info(`3D Audio Manager initialized with 3D volume: ${this.volume3D*100}%`)}init3DSettings(){if(N0.Howler.ctx){if(N0.Howler.orientation(0,0,-1,0,0,1),N0.Howler.ctx.listener)F.info("[3D AUDIO] Web Audio API AudioListener initialized and will be updated with position/orientation")}else setTimeout(()=>this.init3DSettings(),100)}updateListenerPosition(J,Y,G=0){if(!J||!Y){F.warn(`[3D LISTENER] updateListenerPosition called but coords or camera is missing: coords=${!!J}, camera=${!!Y}`);return}if(!this.listenerInitialized)this.listenerPosition={x:J.x,y:J.y,z:J.z},this.listenerInitialized=!0;this.listenerSpeed=G,this.targetPosition={x:J.x,y:J.y,z:J.z};let W=Y.x*Math.PI/180,O=Y.z*Math.PI/180,A=-Math.sin(O)*Math.cos(W),Q=Math.cos(O)*Math.cos(W),S=Math.sin(W);this.targetOrientation={x:A,y:Q,z:S}}startInterpolationLoop(){this.interpolationRunning=!0;let J=()=>{if(!this.interpolationRunning){F.debug("3D interpolation loop stopped");return}try{let Y=this.smoothingFactor;if(this.listenerSpeed>20)Y=this.veryFastSmoothingFactor;else if(this.listenerSpeed>10)Y=this.fastSmoothingFactor;if(this.listenerPosition.x=this.lerp(this.listenerPosition.x,this.targetPosition.x,Y),this.listenerPosition.y=this.lerp(this.listenerPosition.y,this.targetPosition.y,Y),this.listenerPosition.z=this.lerp(this.listenerPosition.z,this.targetPosition.z,Y),this.listenerOrientation.x=this.lerp(this.listenerOrientation.x,this.targetOrientation.x,Y),this.listenerOrientation.y=this.lerp(this.listenerOrientation.y,this.targetOrientation.y,Y),this.listenerOrientation.z=this.lerp(this.listenerOrientation.z,this.targetOrientation.z,Y),N0.Howler.pos(this.listenerPosition.x,this.listenerPosition.y,this.listenerPosition.z),N0.Howler.orientation(this.listenerOrientation.x,this.listenerOrientation.y,this.listenerOrientation.z,0,0,1),N0.Howler.ctx&&N0.Howler.ctx.listener){let G=N0.Howler.ctx.listener;if(G.positionX)G.positionX.setValueAtTime(this.listenerPosition.x,N0.Howler.ctx.currentTime),G.positionY.setValueAtTime(this.listenerPosition.y,N0.Howler.ctx.currentTime),G.positionZ.setValueAtTime(this.listenerPosition.z,N0.Howler.ctx.currentTime);else G.setPosition(this.listenerPosition.x,this.listenerPosition.y,this.listenerPosition.z);if(G.forwardX)G.forwardX.setValueAtTime(this.listenerOrientation.x,N0.Howler.ctx.currentTime),G.forwardY.setValueAtTime(this.listenerOrientation.y,N0.Howler.ctx.currentTime),G.forwardZ.setValueAtTime(this.listenerOrientation.z,N0.Howler.ctx.currentTime),G.upX.setValueAtTime(0,N0.Howler.ctx.currentTime),G.upY.setValueAtTime(0,N0.Howler.ctx.currentTime),G.upZ.setValueAtTime(1,N0.Howler.ctx.currentTime);else G.setOrientation(this.listenerOrientation.x,this.listenerOrientation.y,this.listenerOrientation.z,0,0,1)}this.updateVolumeCappping();for(let[G,W]of this.active3DAudio){let O=W.sourceId,A=this.sourceTargetPositions.get(O);if(A&&!W.isPlaceholder&&(W.howl&&W.soundId!==null||W.type==="voice")){let Q=this.smoothingFactor;if(A.instantUpdate)Q=1;else if(A.speed>20)Q=this.veryFastSmoothingFactor;else if(A.speed>10)Q=this.fastSmoothingFactor;if(!W.position||typeof W.position!=="object"||typeof W.position.x!=="number"){W.position={x:A.x,y:A.y,z:A.z},F.warn(`[3D INTERPOLATION] Fixed corrupted position for ${G}, reinitializing to target position`);continue}if(A.instantUpdate)W.position.x=A.x,W.position.y=A.y,W.position.z=A.z,A.instantUpdate=!1;else W.position.x=this.lerp(W.position.x,A.x,Q),W.position.y=this.lerp(W.position.y,A.y,Q),W.position.z=this.lerp(W.position.z,A.z,Q);try{if(W.type==="voice"){let S=this.audio3DBuffers?.get(O);if(S&&S.pannerNode)S.pannerNode.positionX.setValueAtTime(W.position.x,S.audioContext.currentTime),S.pannerNode.positionY.setValueAtTime(W.position.y,S.audioContext.currentTime),S.pannerNode.positionZ.setValueAtTime(W.position.z,S.audioContext.currentTime)}else if(W.howl&&W.soundId!==null){if(W.howl.playing&&W.howl.playing(W.soundId))W.howl.pos(W.position.x,W.position.y,W.position.z,W.soundId)}}catch(S){this.active3DAudio.delete(G),this.sourceTargetPositions.delete(O)}}}if(this.interpolationRunning)this.interpolationFrameId=requestAnimationFrame(J)}catch(Y){if(!this.lastInterpolationError||this.lastInterpolationError!==Y.message)F.error(`Error in 3D interpolation loop: ${Y.message}`),this.lastInterpolationError=Y.message,setTimeout(()=>{this.lastInterpolationError=null},1e4);if(this.interpolationRunning)this.interpolationFrameId=requestAnimationFrame(J)}};this.interpolationFrameId=requestAnimationFrame(J)}lerp(J,Y,G){return J+(Y-J)*G}applyCloseRangeVolumeCap(J,Y,G,W,O=null){let A=this.calculateDistance(this.listenerPosition,G),Q=3,E=O&&O>=1e5?0.6:0.3,k=W*this.toneVolume*this.volume3D,X=k*E;if(A<3){let $=Math.max(X,k*(A/3));J.volume($,Y)}}updateVolumeCappping(){for(let[J,Y]of this.active3DAudio)if(Y.howl&&Y.soundId!==null&&!Y.isPlaceholder){let G=this.calculateDistance(this.listenerPosition,Y.position),W=3,A=Y.sourceId>=1e5?0.6:0.3,Q=Y.baseVolume*this.toneVolume*this.volume3D,S=Q*A;if(G<3){let E=Math.max(S,Q*(G/3));try{Y.howl.volume(E,Y.soundId)}catch(k){this.active3DAudio.delete(J)}}}}calculateDistance(J,Y){let G=J.x-Y.x,W=J.y-Y.y,O=J.z-Y.z;return Math.sqrt(G*G+W*W+O*O)}set3DVolume(J){this.volume3D=Math.max(0,Math.min(1,J/100*0.6));for(let[Y,G]of this.active3DAudio)if(G.howl&&!G.isPlaceholder){let W;if(G.type==="voice")W=G.baseVolume*this.voiceVolume*this.volume3D;else W=G.baseVolume*this.toneVolume*this.volume3D;G.howl.volume(W)}try{localStorage.setItem("radio_3d_volume",J)}catch(Y){console.warn("Could not save 3D volume to localStorage:",Y)}F.log(`3D audio volume set to ${this.volume3D*100}%`)}get3DVolume(){return this.volume3D*100}setToneVolume(J){this.toneVolume=Math.max(0,Math.min(1,J/100*0.6));for(let[Y,G]of this.active3DAudio)if(G.howl&&!G.isPlaceholder){if(G.type==="tone"||G.type==="siren"||G.type==="heli"||G.type==="transmission"||G.type==="transmission_end"||G.type==="gunshot"){let O=G.baseVolume*this.toneVolume*this.volume3D;G.howl.volume(O)}}F.log(`3D tone volume set to ${this.toneVolume*100}%`)}setVoiceVolume(J){this.voiceVolume=Math.max(0,Math.min(1,J/100*0.6));for(let[Y,G]of this.active3DAudio)if(G.howl&&!G.isPlaceholder&&G.type==="voice"){let W=G.baseVolume*this.voiceVolume*this.volume3D;G.howl.volume(W)}F.log(`3D voice volume set to ${this.voiceVolume*100}%`)}calculate3DVolume(J,Y=1){return Y}async play3DTone(J,Y,G,W){let O=`tone_${J}_${Y}`;this.stop3DAudio(O);try{let A=m.getToneConfig(Y.toUpperCase());if(!A){F.error(`[3D TONE DEBUG] Tone "${Y}" not found`);return}let Q=0;for(let S=0;S<A.length;S++){let E=A[S];if(setTimeout(async()=>{let k=await this.createToneHowlAudio(E.freq,E.duration),X=new Blob([k],{type:"audio/wav"}),$=URL.createObjectURL(X),R=J>=1e5?0.25:0.25,H=G/100*R,P=new N0.Howl({src:[$],format:["wav"],html5:!1,loop:!1,volume:H*this.toneVolume*this.volume3D,onend:()=>{URL.revokeObjectURL($)}}),I=P.play(),D=J>=1e5;P.pannerAttr({panningModel:"HRTF",rolloffFactor:D?1.5:1.6,distanceModel:"exponential",refDistance:D?1.5:1.3},I),P.pos(W.x,W.y,W.z,I),this.applyCloseRangeVolumeCap(P,I,W,H,J)},Q),S<A.length-1)Q+=A[S+1].delay||0}if(this.active3DAudio.set(O,{position:W,type:"tone",sourceId:J,baseVolume:G/100*(J>=1e5?0.5:0.5)}),F.debug(`Playing 3D tone ${Y} from source ${J}`),!this.interpolationRunning)this.startInterpolationLoop()}catch(A){F.error(`Failed to play 3D tone ${Y}: ${A.message}`)}}async createToneHowlAudio(J,Y){let W=Math.floor(44100*(Y/1000)),O=new OfflineAudioContext(1,W,44100),A=O.createOscillator(),Q=O.createGain();A.type="sine",A.frequency.value=J;let S=0.3;Q.gain.setValueAtTime(0,0),Q.gain.linearRampToValueAtTime(S,0.001),Q.gain.setValueAtTime(S,Y/1000-0.001),Q.gain.linearRampToValueAtTime(0,Y/1000),A.connect(Q),Q.connect(O.destination),A.start(),A.stop(Y/1000);let E=await O.startRendering();return this.audioBufferToWav(E)}audioBufferToWav(J){let G=J.sampleRate,W=1,O=16,A=2,Q=2,S=new ArrayBuffer(44+J.length*2),E=new DataView(S),k=(R,H,P)=>{for(let I=0;I<P.length;I++)R.setUint8(H+I,P.charCodeAt(I))};k(E,0,"RIFF"),E.setUint32(4,36+J.length*2,!0),k(E,8,"WAVE"),k(E,12,"fmt "),E.setUint32(16,16,!0),E.setUint16(20,1,!0),E.setUint16(22,1,!0),E.setUint32(24,G,!0),E.setUint32(28,G*2,!0),E.setUint16(32,2,!0),E.setUint16(34,16,!0),k(E,36,"data"),E.setUint32(40,J.length*2,!0);let X=new Float32Array(J.getChannelData(0)),$=44;for(let R=0;R<X.length;R++){let H=Math.max(-1,Math.min(1,X[R]));E.setInt16($,H<0?H*32768:H*32767,!0),$+=2}return S}start3DVoice(J,Y,G,W){let O=`voice_${J}`;this.stop3DAudio(O);let Q=J>=1e5?0.64:0.425,S=W&&typeof W==="object"&&typeof W.x==="number"&&typeof W.y==="number"&&typeof W.z==="number"?{x:W.x,y:W.y,z:W.z}:{x:0,y:0,z:0};if(S.x===0&&S.y===0&&S.z===0)F.warn(`[3D VOICE] Invalid position provided for source ${J}, using fallback (0,0,0). Position type: ${typeof W}, value: ${JSON.stringify(W)?.substring(0,100)}`);if(this.active3DAudio.set(O,{howl:null,soundId:null,position:S,type:"voice",sourceId:J,frequency:Y,baseVolume:Q,isPlaceholder:!1}),!this.interpolationRunning)F.warn(`[3D VOICE] Interpolation loop was stopped, restarting for voice source ${J}`),this.startInterpolationLoop()}stop3DVoice(J){let Y=`voice_${J}`;if(this.stop3DAudio(Y),this.audio3DBuffers&&this.audio3DBuffers.has(J)){let G=this.audio3DBuffers.get(J);try{if(G.gainNode)G.gainNode.disconnect();if(G.pannerNode)G.pannerNode.disconnect()}catch(W){if(window.RadioLogger)window.RadioLogger.audioLog(`Error disconnecting 3D voice nodes for source ${J}: ${W}`,1)}G.isPlaying=!1,G.chunks=[],this.audio3DBuffers.delete(J),F.debug(`Cleaned up 3D voice buffer for source ${J}`)}F.debug(`Stopped 3D voice transmission from source ${J}`)}has3DVoiceSource(J){let Y=`voice_${J}`,G=this.active3DAudio.has(Y);F.info(`Checking 3D voice for source ${J}: audioKey=${Y}, hasVoice=${G}`);let W=Array.from(this.active3DAudio.keys());return F.info(`All active 3D audio keys: ${JSON.stringify(W)}`),G}async play3DVoiceAudio(J,Y){let G=`voice_${J}`,W=this.active3DAudio.get(G);if(!W){F.debug(`No 3D voice source found for ${J}`);return}if(!Y||typeof Y!=="string"||Y.startsWith("http")||Y.startsWith("/")||Y.startsWith("./")||Y.startsWith("radios/")){F.error(`Invalid audio data for 3D voice: type=${typeof Y}, length=${Y?.length}, starts with: ${Y?.substring(0,20)}`);return}if(Y.length===0){F.debug(`3D voice audio data is empty for source ${J}`);return}if(!/^[A-Za-z0-9+/]*={0,2}$/.test(Y)){F.debug(`3D audio data does not match base64 pattern for source ${J}`);return}if(Y.length%4!==0){F.debug(`3D audio data length (${Y.length}) is not a multiple of 4 for source ${J}`);return}try{if(!this.audio3DBuffers)this.audio3DBuffers=new Map;if(!this.audio3DBuffers.has(J))this.audio3DBuffers.set(J,{chunks:[],isPlaying:!1,audioContext:N0.Howler.ctx,startTime:null,sourceData:W});else{let E=this.audio3DBuffers.get(J);E.chunks=[],E.isPlaying=!1,E.startTime=null,E.sourceData=W}let A=this.audio3DBuffers.get(J),Q;try{Q=this.base64ToArrayBuffer(Y)}catch(E){throw F.error(`Base64 decode failed for 3D source ${J}: ${E.message}`),Error(`Invalid 3D audio data for source ${J}: ${E.message}`)}let S;try{S=await A.audioContext.decodeAudioData(Q)}catch(E){if(!this.decodeErrorLogged)this.decodeErrorLogged=new Set;if(!this.decodeErrorLogged.has(J))F.warn(`Audio decode failed for 3D source ${J}: ${E.message} (ArrayBuffer size: ${Q.byteLength} bytes)`),this.decodeErrorLogged.add(J),setTimeout(()=>{this.decodeErrorLogged.delete(J)},30000);return}if(A.chunks.push(S),A.audioManager=this,!A.isPlaying)A.isPlaying=!0,setTimeout(()=>this.play3DBufferedAudio(J),50)}catch(A){F.debug(`Error processing 3D voice audio for source ${J}: ${A.message}`)}}base64ToArrayBuffer(J){try{if(!J||typeof J!=="string")throw Error("Invalid base64 input: not a string");if(!/^[A-Za-z0-9+/]*={0,2}$/.test(J))throw Error("Invalid base64 format: contains invalid characters");if(J.length%4!==0)throw Error("Invalid base64 format: length must be multiple of 4");let G=atob(J);return Uint8Array.from(G,(W)=>W.charCodeAt(0)).buffer}catch(Y){throw F.error(`Base64 conversion failed: ${Y.message}`),Error(`Base64 conversion error: ${Y.message}`)}}async play3DBufferedAudio(J){let Y=this.audio3DBuffers.get(J);if(!Y?.isPlaying)return;await Y.audioContext.resume();let G,W;if(!Y.pannerNode||!Y.gainNode){G=Y.audioContext.createPanner(),W=Y.audioContext.createGain();let $=Y.audioContext.listener;if($.positionX)$.positionX.setValueAtTime(this.listenerPosition.x,Y.audioContext.currentTime),$.positionY.setValueAtTime(this.listenerPosition.y,Y.audioContext.currentTime),$.positionZ.setValueAtTime(this.listenerPosition.z,Y.audioContext.currentTime);else $.setPosition(this.listenerPosition.x,this.listenerPosition.y,this.listenerPosition.z);if($.forwardX)$.forwardX.setValueAtTime(this.listenerOrientation.x,Y.audioContext.currentTime),$.forwardY.setValueAtTime(this.listenerOrientation.y,Y.audioContext.currentTime),$.forwardZ.setValueAtTime(this.listenerOrientation.z,Y.audioContext.currentTime),$.upX.setValueAtTime(0,Y.audioContext.currentTime),$.upY.setValueAtTime(0,Y.audioContext.currentTime),$.upZ.setValueAtTime(1,Y.audioContext.currentTime);else $.setOrientation(this.listenerOrientation.x,this.listenerOrientation.y,this.listenerOrientation.z,0,0,1),$.upZ.setValueAtTime(1,Y.audioContext.currentTime);let R=Y.sourceData.sourceId>=1e5;G.panningModel="HRTF",G.distanceModel="exponential",G.refDistance=R?1.5:1.4,G.rolloffFactor=R?2.5:2.6,G.coneInnerAngle=360,G.coneOuterAngle=360,G.coneOuterGain=1;let H=Y.sourceData.position;if(!H||typeof H!=="object"||typeof H.x!=="number"){F.error(`[3D PLAYBACK] Invalid position object for source ${J}: ${JSON.stringify(H)}`);let P={x:0,y:0,z:0};G.positionX.setValueAtTime(P.x,Y.audioContext.currentTime),G.positionY.setValueAtTime(P.y,Y.audioContext.currentTime),G.positionZ.setValueAtTime(P.z,Y.audioContext.currentTime)}else G.positionX.setValueAtTime(H.x,Y.audioContext.currentTime),G.positionY.setValueAtTime(H.y,Y.audioContext.currentTime),G.positionZ.setValueAtTime(H.z,Y.audioContext.currentTime);if(W.connect(G),m&&m.radioFXInput)G.connect(m.radioFXInput);else G.connect(Y.audioContext.destination);Y.gainNode=W,Y.pannerNode=G}else G=Y.pannerNode,W=Y.gainNode;let O=`voice_${J}`,A=this.active3DAudio.get(O);if(A&&A.position&&Y.pannerNode){if(typeof A.position.x==="number"&&typeof A.position.y==="number"&&typeof A.position.z==="number")Y.pannerNode.positionX.setValueAtTime(A.position.x,Y.audioContext.currentTime),Y.pannerNode.positionY.setValueAtTime(A.position.y,Y.audioContext.currentTime),Y.pannerNode.positionZ.setValueAtTime(A.position.z,Y.audioContext.currentTime)}let Q=A?.position||Y.sourceData.position,S=this.calculateDistance(this.listenerPosition,Q),k=(A?.baseVolume||Y.sourceData.baseVolume||1)*this.voiceVolume*this.volume3D;W.gain.value=k;let X=()=>{if(Y.chunks.length>0){let $=Y.chunks.shift(),R=Y.audioContext.createBufferSource();R.buffer=$;let H=0.015;if(W.gain.setValueAtTime(0,Y.audioContext.currentTime),W.gain.linearRampToValueAtTime(k,Y.audioContext.currentTime+H),R.connect(W),!Y.startTime)Y.startTime=Y.audioContext.currentTime;R.start(0),R.onended=X}else setTimeout(()=>{if(Y.chunks.length>0)X();else Y.isPlaying=!1,Y.startTime=null},20)};X()}start3DSiren(J,Y){let G=`siren_${J}`;this.stop3DAudio(G);let O=J>=1e5?0.05:0.1,A=new N0.Howl({src:["radios/default/sounds/bgSiren.wav"],format:["wav"],html5:!1,loop:!0,volume:O*this.toneVolume*this.volume3D}),Q=A.play();if(A.pannerAttr({panningModel:"HRTF",rolloffFactor:J>=1e5?1.6:3,distanceModel:"exponential",refDistance:J>=1e5?1.5:0.75},Q),A.pos(Y.x,Y.y,Y.z,Q),this.applyCloseRangeVolumeCap(A,Q,Y,O),this.active3DAudio.set(G,{howl:A,soundId:Q,position:Y,type:"siren",sourceId:J,baseVolume:O}),F.debug(`Started 3D siren from source ${J}`),!this.interpolationRunning)F.warn(`[3D SIREN] Interpolation loop was stopped, restarting for siren source ${J}`),this.startInterpolationLoop()}has3DVoiceSource(J){let Y=`voice_${J}`;return this.active3DAudio.has(Y)}stop3DSiren(J){let Y=`siren_${J}`;this.stop3DAudio(Y),F.debug(`Stopped 3D siren from source ${J}`)}start3DHeli(J,Y){let G=`heli_${J}`;this.stop3DAudio(G);let O=J>=1e5?0.04:0.08,A=new N0.Howl({src:["radios/default/sounds/bgHeli.wav"],format:["wav"],html5:!1,loop:!0,volume:O*this.toneVolume*this.volume3D}),Q=A.play();if(A.pannerAttr({panningModel:"HRTF",rolloffFactor:J>=1e5?1.6:3,distanceModel:"exponential",refDistance:J>=1e5?2:0.75},Q),A.pos(Y.x,Y.y,Y.z,Q),this.applyCloseRangeVolumeCap(A,Q,Y,O),this.active3DAudio.set(G,{howl:A,soundId:Q,position:Y,type:"heli",sourceId:J,baseVolume:O}),F.debug(`Started 3D helicopter from source ${J}`),!this.interpolationRunning)F.warn(`[3D HELI] Interpolation loop was stopped, restarting for heli source ${J}`),this.startInterpolationLoop()}stop3DHeli(J){let Y=`heli_${J}`;this.stop3DAudio(Y),F.debug(`Stopped 3D helicopter from source ${J}`)}start3DTransmission(J,Y){let G=`transmission_${J}`;this.stop3DAudio(G);let O=J>=1e5?2.5:0.4,A=new N0.Howl({src:["radios/default/sounds/transStart.wav"],format:["wav"],html5:!1,loop:!1,volume:O*this.toneVolume*this.volume3D,onend:()=>{let S=new N0.Howl({src:["radios/default/sounds/transMid.wav"],format:["wav"],html5:!1,loop:!0,volume:O*0.8*this.toneVolume*this.volume3D}),E=S.play();if(S.pannerAttr({panningModel:"HRTF",rolloffFactor:J>=1e5?2.5:2.5,distanceModel:"exponential",refDistance:J>=1e5?1.5:1.4},E),S.pos(Y.x,Y.y,Y.z,E),this.applyCloseRangeVolumeCap(S,E,Y,O*0.9,J),this.active3DAudio.get(G))this.active3DAudio.set(G,{howl:S,soundId:E,position:Y,type:"transmission",sourceId:J,baseVolume:O*0.8})}}),Q=A.play();if(A.pannerAttr({panningModel:"HRTF",rolloffFactor:J>=1e5?1.5:2.5,distanceModel:"exponential",refDistance:J>=1e5?1.8:1},Q),A.pos(Y.x,Y.y,Y.z,Q),this.applyCloseRangeVolumeCap(A,Q,Y,O),this.active3DAudio.set(G,{howl:A,soundId:Q,position:Y,type:"transmission",sourceId:J,baseVolume:O}),F.debug(`Started 3D transmission from source ${J}`),!this.interpolationRunning)F.warn(`[3D TRANSMISSION] Interpolation loop was stopped, restarting for transmission source ${J}`),this.startInterpolationLoop()}stop3DTransmission(J,Y=!1,G=null){let W=`transmission_${J}`,O=G||{x:0,y:0,z:0};if(G)F.debug(`[3D TRANS END] Using coords from Lua for ${J}: ${JSON.stringify(G)}`);else if(this.active3DAudio.has(W)){let A=this.active3DAudio.get(W);if(A&&A.position)O=A.position,F.debug(`[3D TRANS END] Using position from active3DAudio for ${J}: ${JSON.stringify(O)}`)}else F.debug(`[3D TRANS END] No position available for ${J}, using origin (0,0,0)`);if(this.forceStop3DTransmission(J),!Y){let A=["radios/default/sounds/transEnd.wav","radios/default/sounds/transEnd1.wav","radios/default/sounds/transEnd2.wav"],Q=Math.floor(Math.random()*A.length),S=A[Q],k=J>=1e5?2.5:0.4,X=this.calculateDistance(this.listenerPosition,O),$=new N0.Howl({src:[S],format:["wav"],html5:!1,loop:!1,volume:k*this.toneVolume*this.volume3D,onload:()=>{let R=$.play(),H={panningModel:"HRTF",rolloffFactor:J>=1e5?1.5:2.5,distanceModel:"exponential",refDistance:J>=1e5?1.8:1,maxDistance:1e4};$.pannerAttr(H,R);let P=$.pannerAttr(R);$.pos(O.x,O.y,O.z,R);let I=$.pos(R);this.applyCloseRangeVolumeCap($,R,O,k,J);let D=`transmission_end_${J}`;this.active3DAudio.set(D,{howl:$,soundId:R,position:O,type:"transmission_end",sourceId:J,baseVolume:k,startTime:Date.now()})},onloaderror:(R,H)=>{},onend:()=>{let R=`transmission_end_${J}`;this.active3DAudio.delete(R)}});F.debug(`Stopped 3D transmission from source ${J} and playing end sound`)}else F.debug(`Stopped 3D transmission from source ${J} (end sound suppressed)`)}forceStop3DTransmission(J){let Y=`transmission_${J}`,G=`transmission_mid_${J}`;F.debug(`\uD83D\uDD0A [3D FORCE STOP] Force stopping transmission for source ${J}`),[Y,G].forEach((W)=>{if(this.active3DAudio.has(W)){let O=this.active3DAudio.get(W);try{if(O.howl)O.howl.stop(),O.howl.loop(!1),O.howl.volume(0),O.howl.unload()}catch(A){F.debug(`Error force stopping 3D audio ${W}: ${A}`)}this.active3DAudio.delete(W)}}),this.stop3DAudio(Y),this.stop3DAudio(G)}play3DGunshot(J,Y,G){let W=`gunshot_${J}_${Date.now()}`,O=J>=1e5?0.8:1,A=Y/100,Q=O*A,S=Q*this.toneVolume*this.volume3D,E=new N0.Howl({src:["radios/default/sounds/bgShot.wav"],format:["wav"],html5:!1,loop:!1,volume:S,onload:()=>{},onloaderror:($,R)=>{F.debug(`[3D GUNSHOT] Howl load error for ${W}:`,R)},onplayerror:($,R)=>{F.debug(`[3D GUNSHOT] Howl play error for ${W}:`,R)},onend:()=>{this.active3DAudio.delete(W)}}),k=E.play();E.pannerAttr({panningModel:"HRTF",rolloffFactor:J>=1e5?1.6:3,distanceModel:"exponential",refDistance:J>=1e5?1.5:0.75},k),E.pos(G.x,G.y,G.z,k);let X=this.calculateDistance(this.listenerPosition,G);if(this.applyCloseRangeVolumeCap(E,k,G,Q,J),this.active3DAudio.set(W,{howl:E,soundId:k,position:G,type:"gunshot",sourceId:J,baseVolume:Q}),F.debug(`Playing 3D gunshot from source ${J}`),!this.interpolationRunning)F.warn(`[3D GUNSHOT] Interpolation loop was stopped, restarting for gunshot source ${J}`),this.startInterpolationLoop()}update3DPosition(J,Y,G=null,W=0){if(this.disablePositionUpdates)return;if(!Y||typeof Y!=="object"||typeof Y.x!=="number"||typeof Y.y!=="number"||typeof Y.z!=="number"){F.warn(`[3D POSITION] Invalid position for source ${J}: ${JSON.stringify(Y)?.substring(0,100)}`);return}let O=this.sourceTargetPositions.get(J),A=!1;if(O){if(this.calculateDistance(O,Y)>10||W>25)A=!0}this.sourceTargetPositions.set(J,{x:Y.x,y:Y.y,z:Y.z,speed:W||0,instantUpdate:A}),(G?[`${G}_${J}`]:Array.from(this.active3DAudio.keys()).filter((S)=>S.includes(`_${J}`))).forEach((S)=>{let E=this.active3DAudio.get(S);if(E){if(!E.position||typeof E.position!=="object"||typeof E.position.x!=="number")E.position={x:Y.x,y:Y.y,z:Y.z}}})}stop3DAudio(J){let Y=this.active3DAudio.get(J);if(Y&&Y.howl){try{if(Y.soundId!==null)Y.howl.stop(Y.soundId);Y.howl.unload()}catch(G){F.debug(`3D Audio: Sound ${J} was already unloaded`)}if(Y.sourceId)this.sourceTargetPositions.delete(Y.sourceId);this.active3DAudio.delete(J)}}stopAll3DFromSource(J){let Y=Array.from(this.active3DAudio.keys()).filter((G)=>{let W=this.active3DAudio.get(G);return W&&(W.type==="voice"||W.type==="siren"||W.type==="heli")&&W.sourceId===J});if(Y.forEach((G)=>{this.stop3DAudio(G)}),this.audio3DBuffers&&this.audio3DBuffers.has(J)){let G=this.audio3DBuffers.get(J);try{if(G.gainNode)G.gainNode.disconnect();if(G.pannerNode)G.pannerNode.disconnect();G.isPlaying=!1,G.chunks=[]}catch(W){if(window.RadioLogger)window.RadioLogger.audioLog(`Error disconnecting 3D buffer nodes for source ${J}: ${W}`,1)}this.audio3DBuffers.delete(J)}if(this.sourceTargetPositions.delete(J),this.audio3DBuffers?.has(J))this.audio3DBuffers.delete(J);if(Y.length>0)F.log(`Stopped ${Y.length} 3D audio sources from ${J}`)}stopAll3DAudio(){if(this.interpolationRunning=!1,this.interpolationFrameId)cancelAnimationFrame(this.interpolationFrameId),this.interpolationFrameId=null,F.debug("3D interpolation loop cancelled during stopAll3DAudio");let J=this.active3DAudio.size;if(this.active3DAudio.forEach((Y,G)=>{if(Y&&Y.howl)try{if(Y.soundId!==null)Y.howl.stop(Y.soundId);Y.howl.unload()}catch(W){if(window.RadioLogger)window.RadioLogger.audioLog(`Error stopping 3D audio ${G}: ${W}`,1)}}),this.active3DAudio.clear(),this.audio3DBuffers)this.audio3DBuffers.forEach((Y,G)=>{try{if(Y.gainNode)Y.gainNode.disconnect();if(Y.pannerNode)Y.pannerNode.disconnect();Y.isPlaying=!1,Y.chunks=[]}catch(W){if(window.RadioLogger)window.RadioLogger.audioLog(`Error cleaning up 3D buffer ${G}: ${W}`,1)}}),this.audio3DBuffers.clear();if(this.sourceTargetPositions.clear(),window.RadioLogger&&J>0)window.RadioLogger.audioLog(`Stopped all ${J} 3D audio sources and cleaned up buffers`,2)}getActive3DAudioCount(){return this.active3DAudio.size}getActuallyPlayingCount(){let J=0;return this.active3DAudio.forEach((Y)=>{if(Y.type==="voice"){let G=this.audio3DBuffers?.get(Y.sourceId);if(G&&G.isPlaying)J++}else if(Y.howl&&Y.howl.playing&&Y.howl.playing(Y.soundId))J++}),J}getActive3DAudioInfo(){let J={};return this.active3DAudio.forEach((Y,G)=>{J[G]={type:Y.type,sourceId:Y.sourceId,position:Y.position,playing:Y.howl?Y.howl.playing(Y.soundId):!1}}),J}getAudioBreakdown(){let J={total:this.active3DAudio.size,actuallyPlaying:0,voicePlaceholders:0,voiceActuallyPlaying:0,byType:{}};return this.active3DAudio.forEach((Y)=>{let G=Y.type;if(!J.byType[G])J.byType[G]={total:0,playing:0,placeholders:0};if(J.byType[G].total++,G==="voice"){let W=this.audio3DBuffers?.get(Y.sourceId);if(W&&W.isPlaying)J.actuallyPlaying++,J.voiceActuallyPlaying++,J.byType[G].playing++;else J.voicePlaceholders++,J.byType[G].placeholders++}else if(Y.howl&&Y.howl.playing&&Y.howl.playing(Y.soundId))J.actuallyPlaying++,J.byType[G].playing++;else J.byType[G].placeholders++}),J}cleanup3DTransmissionSources(J){let Y=[];for(let[G,W]of this.active3DAudio)if(W.type==="transmission"&&W.sourceId){if(!J.has(W.sourceId))Y.push(G),F.debug(`Found orphaned 3D transmission from ${W.sourceId}`)}if(Y.forEach((G)=>{this.stop3DAudio(G)}),Y.length>0)F.debug(`Cleaned up ${Y.length} orphaned 3D transmission sources`)}getActive3DAudioInfo(){return new Map(this.active3DAudio)}cleanup(){if(this.interpolationRunning=!1,this.interpolationFrameId)cancelAnimationFrame(this.interpolationFrameId),this.interpolationFrameId=null,F.debug("3D interpolation loop cancelled during cleanup");if(this.stopAll3DAudio(),window.RadioLogger)window.RadioLogger.audioLog("3D Audio Manager cleaned up",1)}}var L8=D8;var A0=IZ(gZ(),1);class I8{constructor(){this.loadedTones={},this.currentRadioModel=null}async loadTones(J){if(this.currentRadioModel===J&&this.loadedTones[J])return this.loadedTones[J];try{let Y=await this.fetchTones("/client/radios/default/tones.json"),G={};if(J&&J!=="default")try{G=await this.fetchTones(`/client/radios/${J}/tones.json`)}catch(O){console.log(`No tones.json found for radio ${J}, using default tones`)}let W={...Y,...G};return this.loadedTones[J]=W,this.currentRadioModel=J,W}catch(Y){return console.error("Failed to load tones:",Y),{}}}async fetchTones(J){let Y=await fetch(J);if(!Y.ok)throw Error(`Failed to fetch tones from ${J}: ${Y.status}`);return await Y.json()}getTone(J,Y=null){let G=Y||this.currentRadioModel||"default",W=this.loadedTones[G];if(!W)return console.warn(`No tones loaded for radio model: ${G}`),null;let O=J?.toUpperCase()||"";return W[O]||null}areTonesLoaded(J){return this.loadedTones[J]!==void 0}clearTones(J=null){if(J)delete this.loadedTones[J];else this.loadedTones={},this.currentRadioModel=null}}var T8=new I8;class U1{static getToneStyle(){return U1.toneStyle}static setToneStyle(J){U1.toneStyle=J}static setRadioModel(J){U1.radioModel=J}static getRadioModel(){return U1.radioModel||"default"}}U1.toneStyle="default";U1.radioModel="default";var NK=16000;class mZ{constructor(J,Y,G,W){this.audioBuffers=new Map,this.BUFFER_DELAY=100,this.howls=new Map,this.blockedUsers=new Set,this.backgroundPlayers=new Map;let O=new A0.Howl({src:["data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"]});setTimeout(()=>{this.audioContext=A0.Howler.ctx,A0.Howler.volume(1),this.applyRadioFX()},200),this.toneAudioContext=new(window.AudioContext||window.webkitAudioContext),this.onAudioAvailable=J,this.onMicrophonesAvailable=Y,this.onRequestSelectedMicrophone=G,this.onMicrophoneError=W,this.mediaRecorder=null,this.isRecording=!1,this.currentVolume=0.8,this.toneVolume=0.08,this.rawVoiceVolume=100,this.rawToneVolume=25,this.mute2DMultiplier=1,this.voiceVolumeNode=null,this.radioFXInput=null,this.priorities={PTT:3,ALERT:2,BEEP_BOOP:1,OTHER:0},window.addEventListener("unload",()=>{this.stopAllAudio(),this.cleanup()}),window.checkSirenStatus=()=>{F.debug("=== SIREN DIAGNOSTICS ==="),F.debug(`Global cleanup functions: ${window.globalSirenCleanupFunctions?.size||0}`);let A=0,Q=0;for(let[S,E]of this.howls)if(S.includes("siren"))A++,F.debug(`AudioManager siren ${S} - Playing: ${E.playing()}, Loop: ${E.loop()}, Volume: ${E.volume()}, State: ${E.state()}, AnimFrame: ${E._sirenIntervalId}`);else if(S.includes("heli"))Q++,F.debug(`AudioManager heli ${S} - Playing: ${E.playing()}, Loop: ${E.loop()}, Volume: ${E.volume()}, State: ${E.state()}, AnimFrame: ${E._sirenIntervalId}`);if(F.debug(`AudioManager siren count: ${A}`),F.debug(`AudioManager heli count: ${Q}`),typeof A0.Howler<"u"&&A0.Howler._howls){let S=A0.Howler._howls.filter((k)=>{if(!k._src)return!1;return(Array.isArray(k._src)?k._src:[k._src]).some(($)=>typeof $==="string"&&$.includes("bgSiren"))}),E=A0.Howler._howls.filter((k)=>{if(!k._src)return!1;return(Array.isArray(k._src)?k._src:[k._src]).some(($)=>typeof $==="string"&&$.includes("bgHeli"))});F.debug(`Howler global siren count: ${S.length}`),F.debug(`Howler global heli count: ${E.length}`),S.forEach((k,X)=>{F.debug(`Global siren ${X}: playing=${k.playing?.()}, loop=${k.loop?.()}`)}),E.forEach((k,X)=>{F.debug(`Global heli ${X}: playing=${k.playing?.()}, loop=${k.loop?.()}`)})}if(typeof audio3DManager<"u"&&audio3DManager){let S=audio3DManager.getActive3DAudioCount();if(F.debug(`3D Audio Manager: ${S} active instances`),F.debug(`3D Interpolation running: ${audio3DManager.interpolationRunning}`),S>0)audio3DManager.getActive3DAudioInfo().forEach((k,X)=>{F.debug(`3D Audio ${X}: type=${k.type}, source=${k.sourceId}, playing=${k.howl?.playing?.()}`)})}F.debug("=== END DIAGNOSTICS ===")}}applyRadioFX(){if(!A0.Howler.ctx||!A0.Howler.masterGain){setTimeout(()=>this.applyRadioFX(),100);return}try{let J=A0.Howler.ctx;A0.Howler.masterGain.disconnect();let Y={inputGain:J.createGain(),highpass:J.createBiquadFilter(),lowpass:J.createBiquadFilter(),softener1:J.createBiquadFilter(),softener2:J.createBiquadFilter(),compressor:J.createDynamicsCompressor(),limiter:J.createDynamicsCompressor(),tubeSaturation:J.createWaveShaper(),midEQ:J.createBiquadFilter(),voiceVolume:J.createGain(),output:J.createGain()};Y.inputGain.gain.setValueAtTime(1.8,J.currentTime),this.radioFXInput=Y.inputGain,Y.highpass.type="highpass",Y.highpass.frequency.setValueAtTime(500,J.currentTime),Y.highpass.Q.setValueAtTime(4,J.currentTime),Y.lowpass.type="lowpass",Y.lowpass.frequency.setValueAtTime(1800,J.currentTime),Y.lowpass.Q.setValueAtTime(6,J.currentTime),Y.compressor.threshold.setValueAtTime(-20,J.currentTime),Y.compressor.knee.setValueAtTime(0,J.currentTime),Y.compressor.ratio.setValueAtTime(12,J.currentTime),Y.compressor.attack.setValueAtTime(0.0005,J.currentTime),Y.compressor.release.setValueAtTime(0.03,J.currentTime),Y.limiter.threshold.setValueAtTime(-8,J.currentTime),Y.limiter.knee.setValueAtTime(0,J.currentTime),Y.limiter.ratio.setValueAtTime(30,J.currentTime),Y.limiter.attack.setValueAtTime(0.0005,J.currentTime),Y.limiter.release.setValueAtTime(0.005,J.currentTime),Y.tubeSaturation.curve=this.makeTubeSaturationCurve(),Y.tubeSaturation.oversample="2x",Y.softener1.type="lowpass",Y.softener1.frequency.setValueAtTime(2200,J.currentTime),Y.softener1.Q.setValueAtTime(0.7,J.currentTime),Y.softener2.type="highshelf",Y.softener2.frequency.setValueAtTime(1500,J.currentTime),Y.softener2.Q.setValueAtTime(0.7,J.currentTime),Y.softener2.gain.setValueAtTime(-4,J.currentTime),Y.midEQ.type="peaking",Y.midEQ.frequency.setValueAtTime(800,J.currentTime),Y.midEQ.Q.setValueAtTime(1.5,J.currentTime),Y.midEQ.gain.setValueAtTime(3,J.currentTime),this.voiceVolumeNode=Y.voiceVolume,Y.voiceVolume.gain.setValueAtTime(this.currentVolume,J.currentTime),Y.output.gain.setValueAtTime(1,J.currentTime),A0.Howler.masterGain.connect(Y.inputGain).connect(Y.highpass).connect(Y.lowpass).connect(Y.softener1).connect(Y.softener2).connect(Y.compressor).connect(Y.limiter).connect(Y.tubeSaturation).connect(Y.midEQ).connect(Y.voiceVolume).connect(Y.output).connect(J.destination),F.log("Classic narrow-band radio FX applied successfully")}catch(J){F.error("Error applying radio FX:",J)}}makeTubeSaturationCurve(){let Y=new Float32Array(44100);for(let G=0;G<44100;G++){let W=G*2/44100-1;if(Math.abs(W)<0.3)Y[G]=W*(1+0.35*W*W);else Y[G]=Math.sign(W)*(0.3+0.4*Math.tanh(5*(Math.abs(W)-0.3)))}return Y}async playAudio({serverId:J,src:Y,position:G=null,volume:W=1,onEnd:O=null,loop:A=!1,randomStart:Q=!1,dynamicVolume:S=!1}){if(await this.resumeAudioContext(),this.blockedUsers.has(J))return F.log(`Audio blocked for user ${J} due to interference`),null;try{if(typeof Y==="string")if(Y.startsWith("http")||Y.startsWith("/")||Y.startsWith("./")||Y.startsWith("radios/")){if(this.mute2DMultiplier===0)return{stop:()=>{},setPosition:()=>{},setVolume:()=>{},getDuration:()=>0,getCurrentTime:()=>0};let E=new A0.Howl({src:[Y],html5:!1,loop:A});return F.debug(`Created Howl for ${J} with loop: ${A}, actual loop: ${E.loop()}`),E.once("load",()=>{if(F.debug(`Audio loaded for ${J}, ensuring radio FX are applied, loop: ${E.loop()}`),this.mute2DMultiplier===0)return;E.on("end",()=>{F.debug(`Siren audio ended - loop=${E.loop()}, will restart if looping`)}),E.on("play",()=>{F.debug(`Siren audio play event - playing=${E.playing()}, loop=${E.loop()}`)}),setTimeout(()=>{if(!this.voiceVolumeNode&&A0.Howler.ctx)this.applyRadioFX()},100);let k=E.play();if(Q&&G===null){let H=E.duration();if(H>0){let P=Math.random()*H;E.seek(P,k)}}else if(G!==null)E.seek(G,k);if(!E.loop())E.on("end",()=>{if(O)O();this.howls.delete(J),E.unload()});let $=J.includes("siren"),R=J.includes("heli");if(S&&($||R)){let H=this.toneVolume*0.5;F.debug(`About to setup background effects for ${J} with volume ${H}`),setTimeout(()=>{F.debug(`Calling setupBackgroundEffects for ${J}`),this.setupBackgroundEffects(E,k,H,$,R)},100)}}),this.setupHowlPlayback(E,J,G,W,O,Q,S)}else{if(!this.audioBuffers.has(J))this.audioBuffers.set(J,{chunks:[],isPlaying:!1,audioContext:this.audioContext,startTime:null});else{let $=this.audioBuffers.get(J);$.chunks=[],$.isPlaying=!1,$.startTime=null}let E=this.audioBuffers.get(J),k;try{k=this.base64ToArrayBuffer(Y)}catch($){throw F.error(`Base64 decode failed for user ${J}: ${$.message}`),Error(`Invalid audio data for user ${J}: ${$.message}`)}let X;try{X=await E.audioContext.decodeAudioData(k)}catch($){if(!this.decodeErrorLogged)this.decodeErrorLogged=new Set;if(!this.decodeErrorLogged.has(J))F.debug(`Audio decode failed for user ${J}: ${$.message} (ArrayBuffer size: ${k.byteLength})`),this.decodeErrorLogged.add(J),setTimeout(()=>{this.decodeErrorLogged.delete(J)},30000);if(J<0)return null;throw Error(`Audio decoding failed for user ${J}: ${$.message}`)}if(E.chunks.push(X),E.audioManager=this,!E.isPlaying)E.isPlaying=!0,setTimeout(()=>this.playBufferedAudio(J),this.BUFFER_DELAY);return{stop:()=>this.stopAudio(J),setPosition:()=>{},setVolume:($)=>{let R=this.audioBuffers.get(J);if(R?.gainNode){let P=J<0?0:0.4;R.gainNode.gain.value=$*this.currentVolume*P}},getDuration:()=>X.duration,getCurrentTime:()=>{let $=this.audioBuffers.get(J);return $?$.audioContext.currentTime-($.startTime||0):0}}}else if(Y instanceof ArrayBuffer){if(J<0)F.debug(`\uD83D\uDD0A DISPATCH DEBUG: Taking ARRAYBUFFER path, buffer size: ${Y.byteLength}`);let E=new A0.Howl({src:[URL.createObjectURL(new Blob([Y]))],format:["webm"],html5:!0});return this.setupHowlPlayback(E,J,G,W,O)}throw Error("Invalid audio source")}catch(E){if(J<0)return F.debug("Error playing dispatch audio:",E.message),null;throw F.error("Error playing audio:",E),E}}setupHowlPlayback(J,Y,G=null,W,O,A=!1,Q=!1){if(this.mute2DMultiplier===0)return{stop:()=>{},setPosition:()=>{},setVolume:()=>{},getDuration:()=>0,getCurrentTime:()=>0};let S=String(Y).includes("siren"),E;if(S)E=0;else E=W*this.currentVolume*0.25*this.mute2DMultiplier;return J.volume(E),this.howls.set(Y,J),J.on("loaderror",()=>{if(O)O();this.howls.delete(Y),J.unload()}),{stop:()=>{if(O)O();this.stopAudio(Y)},setPosition:(k)=>this.setAudioPosition(Y,k),setVolume:(k)=>this.setAudioVolume(Y,k),getDuration:()=>J.duration(),getCurrentTime:()=>J.seek()}}setupBackgroundEffects(J,Y,G,W=!1,O=!1){F.debug(`ENTERING setupBackgroundEffects with base volume: ${G}, howlId: ${Y}, isSiren: ${W}, isHeli: ${O}`);let A=null;{let Q=null,S=null,E=null;if(A0.Howler.ctx)try{let n=J._sounds[0];if(n&&n._node){if(S=A0.Howler.ctx.createBiquadFilter(),S.type="lowpass",W)S.frequency.setValueAtTime(800,A0.Howler.ctx.currentTime),S.Q.setValueAtTime(1,A0.Howler.ctx.currentTime);else if(O)S.frequency.setValueAtTime(600,A0.Howler.ctx.currentTime),S.Q.setValueAtTime(1.2,A0.Howler.ctx.currentTime);E=n._node.destination||A0.Howler.masterGain,n._node.disconnect(),n._node.connect(S),S.connect(E)}}catch(n){F.info(`Failed to create background audio filter: ${n}`),S=null}let k=Date.now(),X=k,$=0,R=null,H=!0,P=Math.random()*Math.PI*2,I=Math.random()*Math.PI*2,D=Math.random()*Math.PI*2,c=()=>{if(!H)return;$++;let n=Date.now(),K0=(n-k)/1000,S0=n-X;X=n;let p0=J.playing();if($%300===0)F.debug(`Background audio frame ${$} - playing: ${p0}, deltaTime: ${S0.toFixed(1)}ms, elapsed: ${K0.toFixed(1)}s`);if(p0){let V=Math.sin(K0*2*Math.PI+P)*0.3,s0=Math.sin(K0*0.8*Math.PI+I)*0.4,a=Math.sin(K0*0.3*Math.PI+D)*0.3,N1=(Math.random()-0.5)*0.2,m1=(V+s0+a+N1)*0.5+0.5-0.3,Z0=Math.max(0,m1),y;if(O)y=this.toneVolume*0.9;else y=this.toneVolume*0.5;let U0=Z0*y;if(J.volume(U0),$%180===0)F.debug(`Background volume update frame ${$}: volume=${U0.toFixed(3)}, biased=${Z0.toFixed(3)}, multiplier=${y.toFixed(3)}, type=${O?"helicopter":"siren"}, elapsed=${K0.toFixed(1)}s`)}if(H)R=requestAnimationFrame(c)};if(R=requestAnimationFrame(c),A=R,J._backgroundCleanup=()=>{if(F.debug("Cleaning up background effects - stopping animation loop"),H=!1,A=null,window.globalSirenCleanupFunctions)window.globalSirenCleanupFunctions.delete(J._backgroundCleanup);if(S)try{let n=J._sounds[0];if(n&&n._node&&E)n._node.disconnect(),n._node.connect(E);S.disconnect(),S=null,F.debug("Background audio filter removed, individual audio path restored")}catch(n){F.info(`Error cleaning up background audio filter: ${n}`)}},J.on("stop",J._backgroundCleanup),J._sirenIntervalId=A,window.globalSirenCleanupFunctions)window.globalSirenCleanupFunctions.add(J._backgroundCleanup);F.debug(`Siren effects setup complete - interval ID: ${A}, loop: ${J.loop()}`)}}async playBufferedAudio(J){let Y=this.audioBuffers.get(J);if(!Y?.isPlaying)return;if(this.mute2DMultiplier===0)return;await Y.audioContext.resume();let G=Y.audioContext.createGain(),W=this.currentVolume*this.mute2DMultiplier;G.gain.value=W,G.connect(A0.Howler.masterGain),Y.gainNode=G;let O=()=>{if(Y.chunks.length>0){let A=Y.chunks.shift(),Q=Y.audioContext.createBufferSource();Q.buffer=A;let S=0.015;if(G.gain.setValueAtTime(0,Y.audioContext.currentTime),G.gain.linearRampToValueAtTime(1,Y.audioContext.currentTime+S),Q.connect(G),!Y.startTime)Y.startTime=Y.audioContext.currentTime;Q.start(0),Q.onended=O}else setTimeout(()=>{if(Y.chunks.length>0)O();else Y.isPlaying=!1,Y.startTime=null,G.disconnect()},20)};O()}base64ToArrayBuffer(J){try{if(!J||typeof J!=="string")throw Error("Invalid base64 input: not a string");if(!/^[A-Za-z0-9+/]*={0,2}$/.test(J))throw Error("Invalid base64 format: contains invalid characters");if(J.length%4!==0)throw Error("Invalid base64 format: length must be multiple of 4");let G=atob(J);return Uint8Array.from(G,(W)=>W.charCodeAt(0)).buffer}catch(Y){throw F.error(`Base64 conversion failed: ${Y.message}`),Error(`Base64 conversion error: ${Y.message}`)}}setAudioPosition(J,Y){let G=this.howls.get(J);if(G)G.seek(Y)}setAudioVolume(J,Y){let G=this.howls.get(J);if(G)G.volume(Math.max(0,Math.min(1,Y*this.currentVolume)))}getPlayingAudio(){return Array.from(this.howls.keys())}setAudio3DManager(J){this.audio3DManager=J,this.sync3DVolumes(),F.info("3D Audio Manager reference set in AudioManager with volumes synced")}sync3DVolumes(){if(this.audio3DManager)this.audio3DManager.setVoiceVolume(this.rawVoiceVolume),this.audio3DManager.setToneVolume(this.rawToneVolume),F.debug("Synced volumes to 3D Audio Manager - Voice: "+this.rawVoiceVolume+"%, Tone: "+this.rawToneVolume+"%")}setVolume(J){if(this.rawVoiceVolume=J,this.currentVolume=Math.max(0,Math.min(1,J/100*0.6)),F.log(`Voice volume set to: ${this.currentVolume} (from ${J}%)`),this.voiceVolumeNode)this.voiceVolumeNode.gain.setValueAtTime(this.currentVolume,this.audioContext.currentTime);for(let[Y,G]of this.backgroundPlayers)if(G&&G.volume!==void 0)G.volume(this.currentVolume);if(this.audio3DManager)this.audio3DManager.setVoiceVolume(J)}stopAudio(J){let Y=this.howls.get(J);if(Y){if(Y.fade&&Y.volume()>0)Y.fade(Y.volume(),0,30),setTimeout(()=>{Y.stop(),Y.unload()},35);else Y.stop(),Y.unload();this.howls.delete(J)}let G=this.audioBuffers.get(J);if(G){if(G.isPlaying=!1,G.gainNode&&G.audioContext)try{let W=G.audioContext.currentTime,O=G.gainNode.gain.value;G.gainNode.gain.cancelScheduledValues(W),G.gainNode.gain.setValueAtTime(O,W),G.gainNode.gain.linearRampToValueAtTime(0,W+0.03),setTimeout(()=>{try{G.gainNode.disconnect()}catch(A){}},35)}catch(W){try{G.gainNode.disconnect()}catch(O){}}this.audioBuffers.delete(J)}}setToneVolume(J){if(this.rawToneVolume=J,this.toneVolume=Math.max(0,Math.min(1,J/100*0.4)),F.log(`Tone volume set to: ${this.toneVolume} (from ${J}%)`),this.audio3DManager)this.audio3DManager.setToneVolume(J)}getToneVolume(){return this.toneVolume}getToneStyle(){return U1.getToneStyle()}setToneStyle(J){U1.setToneStyle(J)}setRadioModel(J){U1.setRadioModel(J)}getRadioModel(){return U1.getRadioModel()}async loadRadioTones(J){return this.setRadioModel(J),await T8.loadTones(J)}async createToneAudioData(J,Y){return""}audioBufferToWav(J){let G=J.sampleRate,W=1,O=16,A=2,Q=2,S=new ArrayBuffer(44+J.length*2),E=new DataView(S),k=(R,H,P)=>{for(let I=0;I<P.length;I++)R.setUint8(H+I,P.charCodeAt(I))};k(E,0,"RIFF"),E.setUint32(4,36+J.length*2,!0),k(E,8,"WAVE"),k(E,12,"fmt "),E.setUint32(16,16,!0),E.setUint16(20,1,!0),E.setUint16(22,1,!0),E.setUint32(24,G,!0),E.setUint32(28,G*2,!0),E.setUint16(32,2,!0),E.setUint16(34,16,!0),k(E,36,"data"),E.setUint32(40,J.length*2,!0);let X=new Float32Array(J.getChannelData(0)),$=44;for(let R=0;R<X.length;R++){let H=Math.max(-1,Math.min(1,X[R]));E.setInt16($,H<0?H*32768:H*32767,!0),$+=2}return S}audioBufferToBase64(J){let Y=this.audioBufferToWav(J),G=new Uint8Array(Y),W=G.byteLength,O="",A=16384;for(let Q=0;Q<W;Q+=A){let S=G.slice(Q,Math.min(Q+A,W));O+=String.fromCharCode.apply(null,S)}return btoa(O)}async playToneManual(J,Y,G=null,W=0){await this.resumeAudioContext();let O=this.toneAudioContext.createOscillator(),A=this.toneAudioContext.createGain();if(O.type="sine",O.frequency.value=J,this.toneAudioContext.state==="suspended")await this.toneAudioContext.resume();let Q=this.toneVolume*this.mute2DMultiplier;F.info(`[TONE DEBUG] playToneManual - toneVolume: ${this.toneVolume}, mute2DMultiplier: ${this.mute2DMultiplier}, maxGain: ${Q}`);let S=this.toneAudioContext.currentTime;return A.gain.setValueAtTime(0,S),A.gain.linearRampToValueAtTime(Q,S+0.001),A.gain.setValueAtTime(Q,S+Y/1000-0.001),A.gain.linearRampToValueAtTime(0,S+Y/1000),O.connect(A),A.connect(this.toneAudioContext.destination),O.start(S),O.stop(S+Y/1000),new Promise((E)=>{setTimeout(E,Y)})}async playToneSequence(J,Y=0,G=null,W=0){if(this.toneAudioContext.state==="suspended")await this.toneAudioContext.resume();if(Y>0)await new Promise((Q)=>setTimeout(Q,Y));let O=this.toneAudioContext.currentTime;J.forEach((Q,S)=>{let E=0;for(let R=0;R<S;R++)E+=J[R].delay||0;let k=this.toneAudioContext.createOscillator(),X=this.toneAudioContext.createGain();k.type="sine",k.frequency.value=Q.freq;let $=this.toneVolume*this.mute2DMultiplier;F.debug(`Playing tone with volume: ${$}`),X.gain.setValueAtTime(0,O+E/1000),X.gain.linearRampToValueAtTime($,O+(E+1)/1000),X.gain.setValueAtTime($,O+(E+Q.duration-1)/1000),X.gain.linearRampToValueAtTime(0,O+(E+Q.duration)/1000),k.connect(X),X.connect(this.toneAudioContext.destination),k.start(O+E/1000),k.stop(O+(E+Q.duration)/1000)});let A=J.reduce((Q,S,E)=>{if(E===J.length-1)return Q+(S.delay||0)+S.duration;return Q+(S.delay||0)},0);return new Promise((Q)=>setTimeout(Q,A))}async playTone(J,Y=null){let G=this.getToneConfig(J);if(!G){F.error(`Tone "${J}" not found`);return}return this.playToneSequence(G,0,Y,this.getPriorityForTone(J))}getPriorityForTone(J){return{PTT:1,PTT_END:1,BEEP:1,BONK:1}[J]||0}getToneConfig(J){let Y=this.getRadioModel(),G=T8.getTone(J,Y);if(!G)return console.warn(`Tone "${J}" not found for radio model: ${Y}`),null;return G}clearTones(){for(let[J,Y]of this.howls)if(J.startsWith("tone-"))Y.stop(),Y.unload(),this.howls.delete(J);for(let[J,Y]of this.audioBuffers)if(J.startsWith("tone-"))Y.isPlaying=!1,Y.chunks=[],Y.startTime=null,this.audioBuffers.delete(J)}async setupMicrophone(J=0,Y=3){try{if(this.isRecording)this.stopRecording();if(this.mediaRecorder&&this.mediaRecorder.stream)this.mediaRecorder.stream.getTracks().forEach((H)=>H.stop());if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices){if(F.error("MediaDevices API not available in this browser"),this.onMicrophoneError)this.onMicrophoneError({error:"MediaDevices API not available",message:"Microphone access is not available. Please check your microphone settings in FiveM.",fullError:"MediaDevices API not available in this browser"});throw Error("MediaDevices API not available in this browser")}let G;try{if(navigator.permissions){if(G=(await navigator.permissions.query({name:"microphone"})).state,F.debug(`[MIC DEBUG] Permission state: ${G}`),G==="denied"){if(F.error("[MIC DEBUG] Permission permanently denied"),this.onMicrophoneError)this.onMicrophoneError({error:"Microphone permission denied",message:"Microphone access is permanently denied. Please enable microphone permissions in FiveM settings.",fullError:"Permission state: denied"});throw Error("Microphone permission denied by user")}}else F.debug("[MIC DEBUG] Permissions API not available")}catch(H){F.debug("[MIC DEBUG] Could not check microphone permissions:",H)}let W,O;for(let H=0;H<=Y;H++)try{F.debug(`[MIC DEBUG] Enumeration attempt ${H+1}/${Y+1}`),W=await navigator.mediaDevices.enumerateDevices(),F.debug(`[MIC DEBUG] Enumeration returned ${W.length} total devices`),W.forEach((I,D)=>{F.debug(`[MIC DEBUG] Device ${D}: kind=${I.kind}, label='${I.label}', deviceId='${I.deviceId}'`)});let P=W.filter((I)=>I.kind==="audioinput");if(F.debug(`[MIC DEBUG] Found ${P.length} audio input devices`),P.length===0&&H<Y){F.warn(`[MIC DEBUG] No audio inputs found on attempt ${H+1}, retrying...`),await new Promise((I)=>setTimeout(I,1000*(H+1)));continue}O=null;break}catch(P){if(O=P,F.error(`[MIC DEBUG] Enumeration attempt ${H+1} failed:`,P),H<Y){let I=1000*Math.pow(2,H);F.debug(`[MIC DEBUG] Waiting ${I}ms before retry...`),await new Promise((D)=>setTimeout(D,I))}}if(O){if(F.error("Failed to enumerate devices after all retries:",O),this.onMicrophoneError)this.onMicrophoneError({error:"Failed to enumerate audio devices",message:"There was an error accessing your audio devices. Please ensure microphone permissions are granted and try again.",fullError:O.toString()});throw Error(`Device enumeration failed after ${Y+1} attempts: ${O}`)}let A=W.filter((H)=>H.kind==="audioinput");if(A.length===0){if(F.error("[MIC DEBUG] No audio input devices found"),this.onMicrophonesAvailable)F.debug("[MIC DEBUG] Sending empty microphone list to Lua"),this.onMicrophonesAvailable([]);if(J===0&&G!=="granted"){F.debug("[MIC DEBUG] No microphones found, requesting permission and retrying...");try{return(await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!1,noiseSuppression:!1,autoGainControl:!1}})).getTracks().forEach((I)=>I.stop()),F.debug("[MIC DEBUG] Permission granted via getUserMedia, retrying enumeration"),await this.setupMicrophone(J+1,Y)}catch(P){if(F.error(`[MIC DEBUG] Permission request failed: ${P.name} - ${P.message}`),this.onMicrophoneError)this.onMicrophoneError({error:"No microphones available",message:"No microphone devices were found. Please check that your microphone is connected and enabled.",fullError:`No audio input devices found. Permission request failed: ${P.message}`});throw Error(`No audio input devices found and permission request failed: ${P}`)}}else{if(F.error(`[MIC DEBUG] Final attempt or permission already granted (retryAttempt=${J}, permissionState=${G})`),this.onMicrophoneError)this.onMicrophoneError({error:"No microphones available",message:"No microphone devices were found. Please check that your microphone is connected and enabled.",fullError:"No audio input devices found"});throw Error("No audio input devices found")}}let Q=new Map;A.forEach((H,P)=>{let I=H.label||`Microphone ${P+1}`,D=I,c=D.match(/Microphone \(([^)]+)\)/);if(c)D=c[1];else D=D.replace(/^- Microphone /,"").replace(/^Microphone /,"");let n=(S0)=>{if(S0==="default")return 3;if(S0==="communications")return 2;return 1},K0=Q.get(D);if(!K0||n(H.deviceId)>n(K0.deviceId))Q.set(D,{deviceId:H.deviceId,label:I})});let S=Array.from(Q.values());if(F.debug(`[MIC DEBUG] Found ${S.length} unique microphones:`,S.map((H)=>`'${H.label}' (${H.deviceId})`)),this.onMicrophonesAvailable)F.debug("[MIC DEBUG] Sending microphone list to Lua"),this.onMicrophonesAvailable(S);else F.warn("[MIC DEBUG] onMicrophonesAvailable callback not available");let E={deviceId:"default",label:"Default Microphone"};if(this.onRequestSelectedMicrophone)try{F.debug("[MIC DEBUG] Requesting selected microphone from Lua"),E=await this.onRequestSelectedMicrophone(),F.debug(`[MIC DEBUG] Received selected microphone: '${E.label}' (${E.deviceId})`)}catch(H){F.warn("[MIC DEBUG] Failed to get selected microphone from Lua, using default:",H)}else F.warn("[MIC DEBUG] onRequestSelectedMicrophone callback not available");let k={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:1};if(E.deviceId&&E.deviceId!=="default")k.deviceId={exact:E.deviceId};let X;try{X=await navigator.mediaDevices.getUserMedia({audio:k})}catch(H){if(F.error("Failed to get microphone access:",H),H.name==="NotAllowedError"||H.name==="PermissionDeniedError"||H.message.includes("Permission denied")||H.message.includes("permission denied")){if(this.onMicrophoneError)this.onMicrophoneError({error:"Microphone access denied",message:"Microphone access was denied. Please enable microphone permissions in FiveM settings.",fullError:H.toString()})}else if(H.name==="NotFoundError"||H.message.includes("not found")||H.message.includes("Could not start")){if(this.onMicrophoneError)this.onMicrophoneError({error:"Microphone device not available",message:"The selected microphone device is not available. Please check your microphone connection and try selecting a different microphone in radio settings.",fullError:H.toString()})}else if(this.onMicrophoneError)this.onMicrophoneError({error:"Failed to access microphone",message:"There was an error accessing your microphone. Please check your microphone settings in FiveM.",fullError:H.toString()});throw Error(`Microphone access failed: ${H}`)}F.debug("Microphone setup successful with device:",E.label);let $;try{$=new MediaRecorder(X,{mimeType:"audio/webm; codecs=opus",audioBitsPerSecond:NK})}catch(H){if(F.error("Failed to create MediaRecorder:",H),X.getTracks().forEach((P)=>P.stop()),this.onMicrophoneError)this.onMicrophoneError({error:"Failed to create MediaRecorder",message:"There was an error creating the media recorder. Please check your microphone settings.",fullError:H.toString()});throw Error(`MediaRecorder creation failed: ${H}`)}let R=[];$.ondataavailable=(H)=>{if(H.data.size>0)R.push(H.data)},$.onstop=async()=>{if(R.length>0){let H=await this.processAudioChunks(R);if(R=[],this.onAudioAvailable)this.onAudioAvailable(H)}},$.onstart=()=>{R=[]},this.mediaRecorder=$,F.debug(`[MIC DEBUG] Microphone setup completed successfully with ${S.length} available devices using '${E.label}'`)}catch(G){if(typeof stream<"u"&&stream)stream.getTracks().forEach((W)=>W.stop());throw F.error("Microphone setup failed:",G),Error(`Microphone setup failed: ${G.message}`)}}async processAudioChunks(J){let Y=new Blob(J,{type:"audio/webm; codecs=opus"});return await this.blobToBase64(Y)}async blobToBase64(J){return new Promise((Y,G)=>{let W=new FileReader;W.onloadend=()=>{let O=W.result.split(",")[1];Y(O)},W.onerror=G,W.readAsDataURL(J)})}async decodeAudio(J,Y){try{if(!this.audioBuffers.has(Y))this.audioBuffers.set(Y,{chunks:[],isPlaying:!1,audioContext:new(window.AudioContext||window.webkitAudioContext),startTime:null});let G=this.audioBuffers.get(Y),W;try{W=this.base64ToArrayBuffer(J)}catch(A){throw F.error(`Base64 decode failed in decodeAudio for user ${Y}: ${A.message}`),Error(`Invalid audio data in decodeAudio for user ${Y}: ${A.message}`)}let O;try{O=await G.audioContext.decodeAudioData(W)}catch(A){throw F.error(`Audio decode failed in decodeAudio for user ${Y}: ${A.message}`),Error(`Audio decoding failed in decodeAudio for user ${Y}: ${A.message}`)}return{buffer:O,context:G.audioContext,play:()=>this.playDecodedAudio(O,Y)}}catch(G){throw Error(`Audio decode error: ${G.message}`)}}base64ToArrayBuffer(J){try{if(!J||typeof J!=="string")throw Error("Invalid base64 input: not a string");if(!/^[A-Za-z0-9+/]*={0,2}$/.test(J))throw Error("Invalid base64 format: contains invalid characters");if(J.length%4!==0)throw Error("Invalid base64 format: length must be multiple of 4");let G=atob(J);return Uint8Array.from(G,(W)=>W.charCodeAt(0)).buffer}catch(Y){throw F.error(`Base64 conversion failed: ${Y.message}`),Error(`Base64 conversion error: ${Y.message}`)}}async playDecodedAudio(J,Y){let G=this.audioBuffers.get(Y);if(!G)return;if(G.chunks.push(J),!G.isPlaying)return G.isPlaying=!0,new Promise((W)=>{setTimeout(()=>{this.playBufferedAudio(Y),W()},this.BUFFER_DELAY)})}createAudioContext(){return A0.Howler.ctx}async resumeAudioContext(){if(this.audioContext.state==="suspended")await this.audioContext.resume(),F.info("Audio context resumed");else if(this.audioContext.state==="closed")this.audioContext=A0.Howler.ctx||new(window.AudioContext||window.webkitAudioContext),this.applyRadioFX(),F.info("Audio context recreated (was closed)");if(this.toneAudioContext.state==="suspended")await this.toneAudioContext.resume(),F.debug("Tone audio context resumed");else if(this.toneAudioContext.state==="closed")this.toneAudioContext=new(window.AudioContext||window.webkitAudioContext),F.debug("Tone audio context recreated (was closed)")}stopAudio(J){F.debug(`\uD83D\uDD0A [AUDIO MANAGER] Stopping audio for ${J}`);let Y=this.howls.get(J);if(Y)try{if(Y._backgroundCleanup)Y._backgroundCleanup();if(J.includes("transmission_")){if(Y.stop(),Y.loop(!1),Y.volume(0),Y._sounds&&Y._sounds.length>0)Y._sounds.forEach((W)=>{if(W._node)try{W._node.stop()}catch(O){F.debug(`Error stopping sound node: ${O}`)}})}else Y.stop();Y.unload(),this.howls.delete(J),F.debug(`✅ Successfully stopped Howler audio for ${J}`)}catch(W){F.warn(`Error stopping Howler audio for ${J}: ${W}`),this.howls.delete(J)}let G=this.audioBuffers.get(J);if(G)try{if(G.isPlaying=!1,G.chunks=[],G.startTime=null,G.sourceNode)G.sourceNode.stop(),G.sourceNode=null;F.debug(`✅ Successfully stopped WebAudio buffer for ${J}`)}catch(W){F.warn(`Error stopping WebAudio buffer for ${J}: ${W}`),G.isPlaying=!1,G.chunks=[],G.startTime=null}}stopAllAudio(){F.debug(`\uD83D\uDD0A [AUDIO MANAGER] Stopping all audio (${this.howls.size} Howler + ${this.audioBuffers.size} WebAudio)`);for(let[J,Y]of this.howls)try{if(Y._backgroundCleanup)Y._backgroundCleanup();if(Y.stop(),Y.loop(!1),Y.volume(0),Y._sounds&&Y._sounds.length>0)Y._sounds.forEach((G)=>{if(G._node)try{G._node.stop()}catch(W){F.debug(`Error stopping sound node for ${J}: ${W}`)}});Y.unload()}catch(G){F.warn(`Error stopping Howler audio for ${J}: ${G}`)}this.howls.clear();for(let[J,Y]of this.audioBuffers)try{if(Y.audioContext){if(Y.isPlaying=!1,Y.chunks=[],Y.startTime=null,Y.sourceNode)Y.sourceNode.stop(),Y.sourceNode=null}}catch(G){F.warn(`Error stopping WebAudio buffer for ${J}: ${G}`)}this.audioBuffers.clear(),F.debug("✅ All audio stopped and cleared")}startRecording(){if(this.mediaRecorder&&this.mediaRecorder.state==="inactive"&&!this.isRecording)this.isRecording=!0,this.recordCycle()}stopRecording(){if(this.mediaRecorder&&this.mediaRecorder.state==="recording")this.isRecording=!1,this.mediaRecorder.stop()}cleanup(){if(this.mediaRecorder&&this.mediaRecorder.stream)this.mediaRecorder.stream.getTracks().forEach((J)=>J.stop())}recordCycle(){if(this.isRecording&&this.mediaRecorder.state==="inactive")try{this.mediaRecorder.start(),setTimeout(()=>{if(this.mediaRecorder.state==="recording"){if(this.mediaRecorder.stop(),this.isRecording)this.recordCycle()}},300)}catch(J){if(F.error("Failed to start media recorder:",J),this.isRecording=!1,this.onMicrophoneError)this.onMicrophoneError({error:"Failed to execute start on media recorder",message:"There was an error starting the media recorder",fullError:J.toString()})}}blockUser(J){F.info(`Blocking audio from user ${J} due to interference`),this.blockedUsers.add(J),this.stopAudio(J)}unblockUser(J){F.info(`Unblocking audio from user ${J} after interference`),this.blockedUsers.delete(J)}isUserBlocked(J){return this.blockedUsers.has(J)}clearBlockedUsers(){F.info(`Clearing all blocked users (${this.blockedUsers.size} users)`),this.blockedUsers.clear()}mute2DAudio(){this.mute2DMultiplier=0,F.debug("Muted 2D audio (voice and tones) for rtest3d mode")}unmute2DAudio(){this.mute2DMultiplier=1,F.debug("Unmuted 2D audio (voice and tones) after rtest3d mode")}}var{io:bW}=v9(),{createConsola:vW}=p9(),HY=vW({level:3,reporters:[{log:(J)=>{if(J.level>HY.level)return;HY.restoreAll();let G={0:"^1",1:"^3",2:"^0",3:"^5",4:"^6",5:"^8"}[J.level]||"^0",W=J.type?J.type.toUpperCase():"LOG",O=J.args?J.args.join(" "):"",A=J.tag||"";console.log(`${G}[${A}] [${W}]^0 ${O}`),HY.wrapAll()}}]});HY.wrapAll();var F=HY.withTag("Radio-Client");F.log("Starting radio client initialization...");F.log("Imports loaded successfully");var g,ZZ,MY="radio",I1=3;F.level=I1;var K1=null,v0=new Map,w1=null,NY=null,AY=null,GZ=null,E0=new Map,a1=!1;F.debug("Variables initialized");var C0=new Map;function l9(J){if(typeof J==="string")J=parseFloat(J);if(typeof J!=="number"||isNaN(J))return F.error(`Invalid frequency: ${J}. Frequency must be a valid number.`),J;return Math.round(J*1e4)/1e4}if(!window.globalTransmissionAudio)window.globalTransmissionAudio={start:null,mid:null,end:null,isPlaying:!1};if(!window.globalSirenCleanupFunctions)window.globalSirenCleanupFunctions=new Set;var g1=!1,o1=!1,r0=0,RJ=5,KZ=0,Q6=3,o0=null,T1=null,NJ=null,R1=null,HJ=new Set,MJ=new Set,EY=!1,m0=null,YZ=null,S6=null,b0=new Map,F1=new Set;window.addEventListener("message",function(J){let Y=J.data;switch(Y.type){case"setLogLevel":if(I1=Y.level,F.level=I1,I1>=4)F.debug(`Log level set to: ${I1}`);break;case"clientLog":let{level:G,message:W,tag:O}=Y,A=O?F.withTag(O):F;switch(G){case 0:A.error(W);break;case 1:A.warn(W);break;case 2:A.log(W);break;case 3:A.info(W);break;case 4:A.debug(W);break;case 5:A.trace(W);break;default:A.log(W);break}break}});var m=new mZ((J)=>{if(g&&K1)g.emit("voice",{channelName:K1,serverId:w1,data:J})},(J)=>{F.log(`Sending ${J.length} microphones to Lua`),q0("setAvailableMicrophones",{microphones:J})},async()=>{let J=D6();try{F.log("Requesting selected microphone from Lua...");let G=await(await fetch(`https://${J}/requestSelectedMicrophone`,{method:"POST",headers:{"Content-Type":"application/json; charset=UTF-8"},body:JSON.stringify({})})).json();return F.log(`Received selected microphone from Lua: ${G.label} (${G.deviceId})`),G}catch(Y){return F.warn(`Failed to get selected microphone from Lua: ${Y}`),{deviceId:"default",label:"Default Microphone"}}},(J)=>{F.debug(`Microphone error: ${J.error} - ${J.message}`),q0("microphoneError",J)}),t=new L8;m.setAudio3DManager(t);F.debug("3D Audio Manager initialized");function C6(J,Y){let G=J.message||"",W=J.type||"",O="Unknown connection issue",A="Check server status and network connection";if(W==="TransportError"&&G.includes("xhr poll error"))if(Y>30000)O="Connection timeout - server likely down or unreachable",A="Verify server is running and check firewall settings";else O="Transport failure - network connectivity issue",A="Check internet connection and proxy settings";else if(G.includes("timeout"))O="Connection timeout",A="Server may be overloaded or network is slow";else if(G.includes("refused")||G.includes("ECONNREFUSED"))O="Connection refused - server not listening on specified port",A="Check server configuration and port settings";else if(G.includes("auth")||G.includes("unauthorized"))O="Authentication failure",A="Check auth token configuration";return{diagnosis:O,troubleshooting:A}}function D6(){return GetParentResourceName()}function q0(J,Y){try{let G=D6();fetch(`https://${G}/${J}`,{method:"POST",headers:{"Content-Type":"application/json; charset=UTF-8"},body:JSON.stringify(Y)})}catch(G){F.debug(`Error sending event to client: ${J}`)}}async function f1(){if(!g||!g.connected){if(a1){F.debug("Connection attempt already in progress, waiting...");while(a1)await new Promise((J)=>setTimeout(J,100));if(g&&g.connected)return Promise.resolve(!0)}return new Promise((J,Y)=>{if(a1=!0,!GZ){let G=Error("Cannot create connection: connection info not received");G.errorType="no_connection_info",F.error("Connection failed: No connection info available - setConnectionInfo may not have been called"),a1=!1,Y(G);return}if(g)g.removeAllListeners(),g.disconnect(),g=null;F.log("Creating new socket connection");try{g=bW(GZ,{auth:{authToken:MY,serverId:w1},reconnection:!1,reconnectionAttempts:Q6,reconnectionDelay:1000,reconnectionDelayMax:3000,timeout:5000,forceNew:!0}),g._connectTimeStart=Date.now(),pW()}catch(G){F.error(`Failed to create socket: ${G.message}`),a1=!1,Y(Error(`Socket creation failed: ${G.message}`));return}g.once("connect",()=>{F.log("Socket connected successfully"),g1=!0,a1=!1,J(!0)}),g.once("connect_error",(G)=>{let W=Date.now(),O=G.message||G.toString()||"Unknown connection error",A=G.type||"connection_error",Q="Unable to serialize error";try{if(typeof G==="object"&&G!==null){let $={};for(let R in G)$[R]=G[R];Object.getOwnPropertyNames(G).forEach((R)=>{$[R]=G[R]}),Q=JSON.stringify($,null,2)}else Q=G.toString()}catch($){Q=`Error serialization failed: ${$.message}. Raw error: ${G.toString()}`}F.warn(`Socket connection error: ${O} (${A})`),F.warn(`Full error details: ${Q}`),F.warn(`Connection context - Has auth token: ${!!MY}, Server ID: ${w1}, Resource: ${ZZ}`);let S=W-(g._connectTimeStart||W);F.warn(`Connection timing - Attempt failed after ${S}ms`);let{diagnosis:E,troubleshooting:k}=C6(G,S);F.warn(`Diagnosis: ${E}`),F.warn(`Troubleshooting: ${k}`),g1=!1;let X=Error(`Connection failed: ${O}`);X.originalError=G,X.errorType=A,X.connectionContext={hasAuthToken:!!MY,serverId:w1,resourceName:ZZ,attemptDuration:W-(g._connectTimeStart||W)},a1=!1,Y(X)}),setTimeout(()=>{if(!g1){let G=Error("Connection timeout after 5 seconds");G.errorType="timeout",a1=!1,Y(G)}},5000)})}return Promise.resolve(!0)}function n9(){if(K1)R1=K1;F.warn(`Saving channel state: speaker=${R1}, listening=${Array.from(HJ).join(", ")}, users=${Array.from(MJ).join(", ")}`)}function s9(){if(!g||!g.connected){F.error("Cannot restore channel state - socket not connected");return}if(F.warn(`Restoring channel state: speaker=${R1}, listening=${Array.from(HJ).join(", ")}, users=${Array.from(MJ).join(", ")}`),R1)g.emit("setSpeakerChannel",R1),K1=R1,F.warn(`Restored speaker channel: ${R1}`);for(let J of HJ)g.emit("addListeningChannel",J),F.warn(`Restored listening channel: ${J}`);for(let J of MJ)g.emit("listenToUser",J),F.warn(`Restored listening to user: ${J}`)}function hW(){if(EY)return;EY=!0,KZ++,F.warn(`Silent reconnection attempt ${KZ} of ${Q6}`),n9()}function WZ(){if(r0>=RJ){F.error("Max reconnection attempts reached. Powering off radio."),q0("radioPowerOff",{reason:"Connection could not be restored"});return}if(o0)return;if(g)g.removeAllListeners(),g.disconnect(),g=null;r0++,F.warn(`Starting manual reconnection (attempt ${r0+1}/${RJ})`),o0=setInterval(async()=>{try{if(F.log(`Manual reconnection attempt ${r0}`),await f1(),F.log("Successfully reconnected to radio server!"),setTimeout(()=>{s9()},500),m0&&Date.now()-m0>5000)q0("radioReconnected",{});if(o0)clearInterval(o0),o0=null}catch(J){let Y=J.message||"Unknown error",G=J.errorType||"unknown",W=`Reconnection attempt ${r0} failed: ${Y}`;if(G==="timeout")W+=" (Connection timed out - server may be down or unreachable)";else if(G==="connection_error"&&J.originalError)W+=` (${J.originalError.type||"Network error"})`;if(F.error(W),r0>=RJ){clearInterval(o0),o0=null;let O="Connection lost and could not be restored",A=`Last error: ${Y}`;if(G==="timeout")A+=" (Server appears to be down or unreachable)";else if(G==="connection_error")A+=" (Network or server connection issue)";q0("radioError",{error:O,details:A,errorType:G,troubleshooting:"Check server status and network connection"}),q0("radioPowerOff",{reason:"Connection could not be restored",details:A})}else{r0++;let O=m0?Date.now()-m0:0,A=r0>=RJ;if(O>5000||A)q0("radioReconnecting",{attempt:r0,maxAttempts:RJ,lastError:Y,errorType:G})}}},3000)}function L6(){if(!g||!g.connected)return{healthy:!1,reason:"Socket not connected or disconnected",details:"Socket instance is null or not in connected state"};if(NJ){let J=Date.now()-NJ;if(J>15000)return F.warn("Connection appears stale - no heartbeat response in 15 seconds"),{healthy:!1,reason:"Heartbeat timeout",details:`Last heartbeat response was ${Math.round(J/1000)} seconds ago`}}return{healthy:!0}}function yW(){setInterval(()=>{if(o1&&!L6()){if(F.warn("Connection health check failed - attempting reconnection"),q0("radioError",{error:"Connection appears unstable. Attempting to reconnect..."}),g)g.disconnect();hW()}},30000)}yW();var a9=!1,r1=null,fW=2000,u9=15,P6=!1;function c9(){try{let J=D6();F.debug("Requesting connection info from Lua"),fetch(`https://${J}/requestConnectionInfo`,{method:"POST",headers:{"Content-Type":"application/json; charset=UTF-8"},body:JSON.stringify({})}).catch((Y)=>{F.warn("Failed to request connection info:",Y)})}catch(J){F.error("Error requesting connection info from Lua:",J)}}function gW(){let J=0;c9(),J++,r1=setInterval(()=>{if(a9)clearInterval(r1),r1=null,F.log("Connection info received, stopping requests");else if(J>=u9)clearInterval(r1),r1=null,F.error("Failed to get connection info after maximum attempts");else J++,F.debug(`Requesting connection info (attempt ${J}/${u9})`),c9()},fW)}gW();window.addEventListener("message",async(J)=>{let Y=J.data;switch(Y.action){case"setNuiFocusState":window.radioHasNuiFocus=Y.focused===!0,F.debug(`NUI focus state updated: ${window.radioHasNuiFocus}`);break;case"setConnectionInfo":if(P6){F.debug("Already processing setConnectionInfo, ignoring duplicate");break}if(P6=!0,a9=!0,r1)clearInterval(r1),r1=null,F.log("Received setConnectionInfo, stopped request interval");if(ZZ=Y.resourceName,w1=Y.serverId,Y.logLevel!==void 0&&Y.logLevel!==I1){if(I1=Y.logLevel,F.level=I1,I1>=4)F.debug(`Log level updated from connection info: ${I1}`)}if(MY=Y.auth,Y.ip.startsWith("http://")||Y.ip.startsWith("https://"))GZ=Y.ip;else GZ=Y.port?`http://${Y.ip}:${Y.port}`:`http://${Y.ip}`;try{await f1()}catch($){let R=$.message||"Unknown connection error",H=$.errorType||"unknown";F.debug(`Failed to establish initial connection: ${R} (${H})`),q0("radioError",{error:"Failed to connect to radio server",details:R,errorType:H,troubleshooting:H==="timeout"?"Server may be down or unreachable":"Check network connection and server status"})}finally{P6=!1}break;case"setupMicrophone":try{await m.setupMicrophone(),F.log("Microphone re-setup completed"),q0("microphoneSetupComplete",{success:!0})}catch($){F.warn(`Failed to re-setup microphone: ${$}`),q0("microphoneSetupComplete",{success:!1,error:$.message})}break;case"connect":try{await f1()}catch($){let R=$.message||"Unknown connection error",H=$.errorType||"unknown";F.debug(`Failed to connect: ${R} (${H})`),q0("radioError",{error:"Failed to connect to radio server",details:R,errorType:H,troubleshooting:H==="timeout"?"Server may be down or unreachable":"Check network connection and server status"})}break;case"setChannel":if(g){await f1();let $=Y.frequency;if($)g.emit("setSpeakerChannel",$),K1=$,R1=$,F.debug(`Setting speaker channel to ${$}`);else g.emit("setSpeakerChannel",null),K1=null,R1=null,F.debug("Leaving speaker channel.");let R=["play3DTone","start3DVoice","stop3DVoice","start3DSiren","stop3DSiren","start3DHeli","stop3DHeli","start3DTransmission","stop3DTransmission","play3DGunshot","update3DPosition","updateListenerPosition"];if(Y.action&&R.includes(Y.action))try{r9(Y)}catch(H){F.error("Error handling 3D audio message:",H)}}else F.debug("Socket not initialized");break;case"setUserPosition":break;case"addListeningChannel":if(g)try{await f1(),g.emit("addListeningChannel",Y.frequency),HJ.add(Y.frequency),F.log(`Added listening channel ${Y.frequency} to saved state`)}catch($){let R=$.message||"Unknown error adding channel",H=$.errorType||"channel_error";F.debug(`Failed to add listening channel ${Y.frequency}: ${R}`,{errorType:H,frequency:Y.frequency,socket:!!g,connected:g?.connected});let P="Check connection and try again";if(R.includes("timeout"))P="Server response timeout - may be overloaded";else if(R.includes("auth"))P="Authentication failed - check radio configuration";q0("radioError",{error:"Failed to add listening channel",details:`Channel ${Y.frequency}: ${R}`,errorType:H,troubleshooting:P})}break;case"removeListeningChannel":if(g)try{await f1(),g.emit("removeListeningChannel",Y.frequency),HJ.delete(Y.frequency),F.log(`Removed listening channel ${Y.frequency} from saved state`)}catch($){let R=$.message||"Unknown error removing channel",H=$.errorType||"channel_error";F.debug(`Failed to remove listening channel ${Y.frequency}: ${R}`,{errorType:H,frequency:Y.frequency,socket:!!g,connected:g?.connected});let P="Check connection and try again";if(R.includes("timeout"))P="Server response timeout - may be overloaded";q0("radioError",{error:"Failed to remove listening channel",details:`Channel ${Y.frequency}: ${R}`,errorType:H,troubleshooting:P})}break;case"listenToUser":if(g)try{await f1(),g.emit("listenToUser",Y.serverId),MJ.add(Y.serverId),F.log(`Added listening to user ${Y.serverId} to saved state`)}catch($){let R=$.message||"Unknown error listening to user",H=$.errorType||"user_listen_error";F.debug(`Failed to listen to user ${Y.serverId}: ${R}`,{errorType:H,serverId:Y.serverId,socket:!!g,connected:g?.connected});let P="Check connection and user permissions";if(R.includes("timeout"))P="Server response timeout - may be overloaded";else if(R.includes("permission"))P="No permission to listen to this user";q0("radioError",{error:"Failed to listen to user",details:`User ${Y.serverId}: ${R}`,errorType:H,troubleshooting:P})}break;case"stopListeningToUser":if(g)try{await f1(),g.emit("stopListeningToUser",Y.serverId),MJ.delete(Y.serverId),F.log(`Removed listening to user ${Y.serverId} from saved state`)}catch($){let R=$.message||"Unknown error stopping user listen",H=$.errorType||"user_listen_error";F.debug(`Failed to stop listening to user ${Y.serverId}: ${R}`,{errorType:H,serverId:Y.serverId,socket:!!g,connected:g?.connected});let P="Check connection and try again";if(R.includes("timeout"))P="Server response timeout - may be overloaded";q0("radioError",{error:"Failed to stop listening to user",details:`User ${Y.serverId}: ${R}`,errorType:H,troubleshooting:P})}break;case"disconnect":if(g)g.disconnect(),g=null,K1=null,v0.clear(),m.stopRecording(),R1=null,HJ.clear(),MJ.clear(),m0=null,m.clearBlockedUsers(),F.debug(`Stopping all ${E0.size} active sirens, ${C0.size} helicopters, and transmission sounds before disconnect`),E0.forEach(($,R)=>{if($&&$.stop)$.stop()}),E0.clear(),C0.forEach(($,R)=>{if($&&$.stop)$.stop()}),C0.clear(),EJ();break;case"setTalking":let G=L6();if(!g||!g.connected||!G.healthy){let $="Cannot talk: not connected to radio server or connection unhealthy",R="Unknown connection issue";if(!g)R="Socket not initialized";else if(!g.connected)R="Socket disconnected from server";else if(!G.healthy)R=`${G.reason}: ${G.details}`;let H=`${$} (${R})`;if(F.error(H),q0("radioError",{error:"Radio connection lost. Attempting to reconnect...",details:R,troubleshooting:"Connection will automatically retry, or check radio settings if issue persists"}),m.stopRecording(),o1)WZ();break}if(g&&K1&&Y.talking!==void 0)try{if(await f1(),Y.talking)v0.set(w1,{frequency:K1}),m.startRecording(),g.emit("setTalking",!0);else v0.delete(w1),m.stopRecording(),g.emit("setTalking",!1);F.debug(`Set talking state to ${Y.talking}`)}catch($){let R=$.message||"Unknown transmission error",H=$.errorType||"transmission_error";F.debug(`Failed to set talking state: ${R}`,{errorType:H,socket:!!g,connected:g?.connected,currentChannel:K1}),m.stopRecording();let P="Check connection and try again";if(R.includes("timeout"))P="Server response timeout - may be overloaded";else if(R.includes("disconnect"))P="Connection lost during transmission";if(q0("radioError",{error:"Failed to transmit. Connection lost.",details:R,errorType:H,troubleshooting:P}),EJ(),o1)WZ()}else F.debug("Socket not initialized or no channel joined"),q0("radioError",{error:"No channel selected or radio not ready"});break;case"setVolume":m.setVolume(Y.volume);break;case"setToneVolume":m.setToneVolume(Y.volume);break;case"set3DVolume":t.set3DVolume(Y.volume),F.log(`3D audio volume set to ${Y.volume}% via command`);break;case"playTone":if(g)m.playTone(Y.tone);break;case"blockUser":if(Y.serverId&&typeof Y.block==="boolean")if(Y.block)F.log(`Blocking audio from user ${Y.serverId} due to interference`),m.blockUser(Y.serverId);else F.log(`Unblocking audio from user ${Y.serverId} after interference`),m.unblockUser(Y.serverId);break;case"showDispatchAlert":q0("showDispatchAlert",{type:Y.type||"General Alert",message:Y.message,frequency:Y.frequency,duration:Y.duration||1e4});break;case"startSiren":if(F.debug(`Received startSiren request for player ${Y.serverId}`),Y.serverId&&!E0.has(Y.serverId)){let $=`siren_${Y.serverId}`;if(m.howls.has($))F.warn(`Siren already exists in audio manager for ${Y.serverId}, stopping existing first`),m.stopAudio($);if(typeof Howler<"u"&&Howler._howls){let R=Howler._howls.find((H)=>{if(!H._src||!H.playing||!H.playing())return!1;return(Array.isArray(H._src)?H._src:[H._src]).some((I)=>typeof I==="string"&&I.includes("bgSiren"))});if(R){F.warn("Found orphaned siren, stopping it before starting new one");try{R.stop()}catch(H){F.debug(`Error stopping orphaned siren: ${H}`)}}}F.debug(`Starting background siren for player ${Y.serverId}`),m.playAudio({serverId:`siren_${Y.serverId}`,src:"radios/default/sounds/bgSiren.wav",volume:1,loop:!0,randomStart:!0,dynamicVolume:!0}).then((R)=>{if(R&&typeof R.stop==="function")E0.set(Y.serverId,R),F.debug(`Successfully started background siren for player ${Y.serverId}`);else F.warn(`Invalid siren player object for ${Y.serverId}`)}).catch((R)=>{F.debug(`Failed to start siren for player ${Y.serverId}: ${R}`),E0.delete(Y.serverId);let H=`siren_${Y.serverId}`;if(m.howls.has(H))try{m.stopAudio(H)}catch(P){F.debug(`Error during cleanup: ${P}`)}})}else if(E0.has(Y.serverId))F.log(`Siren already playing for player ${Y.serverId}`);else F.warn(`Invalid serverId provided for startSiren: ${Y.serverId}`);break;case"stopSiren":F.debug(`Received stopSiren request for player ${Y.serverId}`);let W=!1;if(Y.serverId&&E0.has(Y.serverId)){let $=E0.get(Y.serverId);if($&&typeof $.stop==="function")try{$.stop(),W=!0,F.debug(`Successfully stopped background siren for player ${Y.serverId}`)}catch(R){F.debug(`Error stopping siren for player ${Y.serverId}: ${R}`)}else F.warn(`Invalid siren player reference for ${Y.serverId}`);E0.delete(Y.serverId)}let O=`siren_${Y.serverId}`;if(m.howls.has(O))try{m.stopAudio(O),W=!0}catch($){F.debug(`Error stopping siren via audio manager: ${$}`)}if(!W)F.debug(`No active siren found for player ${Y.serverId} in either tracking system`);break;case"startHeli":if(F.info(`Received startHeli request for player ${Y.serverId}`),Y.serverId&&!C0.has(Y.serverId)){let $=`heli_${Y.serverId}`;if(m.howls.has($))F.warn(`Helicopter already exists in audio manager for ${Y.serverId}, stopping existing first`),m.stopAudio($);if(typeof Howler<"u"&&Howler._howls){let R=Howler._howls.find((H)=>{if(!H._src||!H.playing||!H.playing())return!1;return(Array.isArray(H._src)?H._src:[H._src]).some((I)=>typeof I==="string"&&I.includes("bgHeli"))});if(R){F.warn("Found orphaned helicopter, stopping it before starting new one");try{R.stop()}catch(H){F.debug(`Error stopping orphaned helicopter: ${H}`)}}}F.info(`Starting background helicopter for player ${Y.serverId}`),m.playAudio({serverId:`heli_${Y.serverId}`,src:"radios/default/sounds/bgHeli.wav",volume:0.8,loop:!0,randomStart:!0,dynamicVolume:!0}).then((R)=>{if(R&&typeof R.stop==="function")C0.set(Y.serverId,R),F.debug(`Successfully started background helicopter for player ${Y.serverId}`);else F.warn(`Invalid heli player object for ${Y.serverId}`)}).catch((R)=>{F.debug(`Failed to start helicopter for player ${Y.serverId}: ${R}`),C0.delete(Y.serverId);let H=`heli_${Y.serverId}`;if(m.howls.has(H))try{m.stopAudio(H)}catch(P){F.debug(`Error during cleanup: ${P}`)}})}else if(C0.has(Y.serverId))F.info(`Helicopter already playing for player ${Y.serverId}`);else F.warn(`Invalid serverId provided for startHeli: ${Y.serverId}`);break;case"stopHeli":F.log(`Received stopHeli request for player ${Y.serverId}`);let A=!1;if(Y.serverId&&C0.has(Y.serverId)){let $=C0.get(Y.serverId);if($&&typeof $.stop==="function")try{$.stop(),A=!0,F.debug(`Successfully stopped background helicopter for player ${Y.serverId}`)}catch(R){F.debug(`Error stopping helicopter for player ${Y.serverId}: ${R}`)}C0.delete(Y.serverId)}let Q=`heli_${Y.serverId}`;if(m.howls.has(Q))try{m.stopAudio(Q),A=!0}catch($){F.debug(`Error stopping helicopter via audio manager: ${$}`)}if(!A)F.info(`No active helicopter found for player ${Y.serverId} in either tracking system`);break;case"stopAllTransmissions":F.debug("Stopping all background SFX"),EJ();break;case"startTransmission":if(F.debug("Received startTransmission request"),m.mute2DMultiplier===0)break;if(window.globalTransmissionAudio.isPlaying){F.debug("\uD83D\uDD0A [TRANSMISSION] Transmission already playing globally, skipping");break}if(window.globalTransmissionAudio.isPlaying=!0,AJ(),m.playAudio({serverId:"transmission_start",src:"radios/default/sounds/transStart.wav",volume:1*m.getToneVolume(),loop:!1,onEnd:()=>{F.debug("Transmission start sound ended")}}).then(($)=>{if($&&typeof $.stop==="function")window.globalTransmissionAudio.start=$,F.debug("Successfully started transmission start sound");else F.warn("Invalid transmission start player object"),window.globalTransmissionAudio.start=null}).catch(($)=>{F.debug(`Failed to start transmission start sound: ${$}`),window.globalTransmissionAudio.start=null,window.globalTransmissionAudio.isPlaying=!1}),m.playAudio({serverId:"transmission_mid",src:"radios/default/sounds/transMid.wav",volume:1*m.getToneVolume(),loop:!0}).then(($)=>{if($&&typeof $.stop==="function")window.globalTransmissionAudio.mid=$,F.debug("Successfully started transmission mid sound");else F.warn("Invalid transmission mid player object"),window.globalTransmissionAudio.mid=null}).catch(($)=>{if(F.error(`Failed to start transmission mid sound: ${$}`),window.globalTransmissionAudio.mid=null,!window.globalTransmissionAudio.start&&!window.globalTransmissionAudio.end)window.globalTransmissionAudio.isPlaying=!1}),window.globalTransmissionCleanupTimer)clearTimeout(window.globalTransmissionCleanupTimer);window.globalTransmissionCleanupTimer=setTimeout(()=>{F.warn("\uD83D\uDD0A [SAFETY] Force stopping global transmission sounds after 30 seconds"),AJ()},30000);break;case"stopTransmission":if(F.debug("Received stopTransmission request"),window.globalTransmissionAudio)window.globalTransmissionAudio.isPlaying=!1;if(window.globalTransmissionCleanupTimer)clearTimeout(window.globalTransmissionCleanupTimer),window.globalTransmissionCleanupTimer=null;if(window.globalTransmissionAudio.mid&&window.globalTransmissionAudio.mid.stop)try{window.globalTransmissionAudio.mid.stop(),window.globalTransmissionAudio.mid=null}catch($){F.debug(`Error stopping transmission mid sound: ${$}`),window.globalTransmissionAudio.mid=null}if(m.mute2DMultiplier===0)break;let S=["radios/default/sounds/transEnd.wav","radios/default/sounds/transEnd1.wav","radios/default/sounds/transEnd2.wav"],E=Math.floor(Math.random()*S.length),k=S[E];F.debug(`\uD83D\uDD0A [CLIENT] Selected random transEnd: ${k} (index ${E}/${S.length})`),m.playAudio({serverId:"transmission_end",src:k,volume:1*m.getToneVolume(),loop:!1,onEnd:()=>{F.debug(`\uD83D\uDD0A [CLIENT] Transmission end sound ended: ${k}`),window.globalTransmissionAudio.end=null}}).then(($)=>{if($&&typeof $.stop==="function")window.globalTransmissionAudio.end=$,F.debug(`\uD83D\uDD0A [CLIENT] Successfully started transmission end sound: ${k}`);else F.warn("Invalid transmission end player object"),window.globalTransmissionAudio.end=null}).catch(($)=>{F.error(`\uD83D\uDD0A [CLIENT] Failed to start transmission end sound: ${$}`),window.globalTransmissionAudio.end=null});break;case"forceStopAllTransmissions":F.debug("Force stopping all transmission sounds"),AJ();break;case"forceStopTransmissions":F.debug("Force stopping transmission sounds (legacy call)"),AJ();break;case"stopAllSirens":F.debug(`Stopping all ${E0.size} active sirens`),E0.forEach(($,R)=>{if($&&$.stop)$.stop();F.debug(`Stopped siren for player ${R}`)}),E0.clear();break;case"stopAllHelis":F.info(`Stopping all ${C0.size} active helicopters`),C0.forEach(($,R)=>{if($&&$.stop)$.stop();F.debug(`Stopped helicopter for player ${R}`)}),C0.clear();break;case"playGunshotSound":if(F.debug(`Received playGunshotSound request for player ${Y.serverId} with volume ${Y.volume} (distance: ${Y.distance})`),m.mute2DMultiplier===0)break;if(Y.serverId){let $=Y.volume||0.3;if(F.debug(`Playing background gunshot for player ${Y.serverId} at volume ${$}`),AY)try{let R=$*m.getToneVolume();AY.volume(R),AY.seek(0),AY.play(),F.debug(`Successfully played gunshot at volume ${R} (distance: ${$}, SFX: ${m.getToneVolume()})`)}catch(R){F.debug(`Failed to play gunshot: ${R}`)}else F.debug("Gunshot audio not ready")}else F.debug(`Invalid serverId for playGunshotSound: ${Y.serverId}`);break;case"testRandomTransEnd":F.info("\uD83D\uDD27 Testing random transEnd selection:");for(let $=0;$<10;$++){let R=["radios/default/sounds/transEnd.wav","radios/default/sounds/transEnd1.wav","radios/default/sounds/transEnd2.wav"],H=Math.floor(Math.random()*R.length),P=R[H];F.info(`Test ${$+1}: ${P} (index ${H})`)}break;case"getConnectionDiagnostics":let X=o9();F.info("Connection Diagnostics:",X),q0("connectionDiagnostics",X);break}});function mW(){F.info("Initializing gunshot audio..."),AY=new Howl({src:["radios/default/sounds/bgShot.wav"],html5:!1,loop:!1,volume:1}),F.info("Gunshot audio initialized")}function pW(){g.on("connect",async()=>{try{mW();let J=!1,Y=null;try{await m.setupMicrophone(),J=!0,F.debug("Microphone setup completed on connection")}catch(G){Y=G,F.warn(`Initial microphone setup failed: ${G.message}`),q0("radioError",{error:"Microphone setup failed during connection. You can retry in radio settings.",details:G.message})}if(g1=!0,o1=!0,EJ(),EY||r0>0||m0){if(F.info("Reconnected to radio server!"),setTimeout(()=>{s9()},500),EY=!1,m0&&Date.now()-m0>5000)q0("radioReconnected",{});if(!J&&Y)setTimeout(async()=>{try{await m.setupMicrophone(),F.debug("Microphone setup completed after reconnection retry"),q0("microphoneSetupComplete",{success:!0})}catch(G){F.warn(`Microphone setup retry failed: ${G.message}`)}},2000)}else F.info("Connected to radio server!"),q0("radioConnected",{});if(r0=0,KZ=0,m0=null,o0)clearInterval(o0),o0=null;if(YZ)clearTimeout(YZ),YZ=null;if(S6)clearTimeout(S6),S6=null;NY=setInterval(()=>{if(g&&g.connected){let G=Date.now();if(g.emit("heartbeat",G),T1)clearTimeout(T1);T1=setTimeout(()=>{if(F.warn("Heartbeat timeout - connection may be stale"),g&&g.connected)g.disconnect()},1e4)}},5000)}catch(J){F.error(`Critical error during connection setup: ${J}`),q0("radioError",{error:"Failed to setup radio connection",details:J.message})}}),g.on("heartbeat_response",(J)=>{if(NJ=Date.now(),T1)clearTimeout(T1),T1=null;F.debug("Heartbeat response received")}),g.on("ping",()=>{F.debug("Ping event received")}),g.on("pong",(J)=>{if(F.debug(`Pong received - latency: ${J}ms`),J>5000)F.warn("High latency detected - connection may be unstable")}),g.on("connect_error",(J)=>{let Y=J.message||J.toString()||"Unknown connection error",G=J.type||"connection_error",W="Unable to serialize error";try{if(typeof J==="object"&&J!==null){let Q={};for(let S in J)Q[S]=J[S];Object.getOwnPropertyNames(J).forEach((S)=>{Q[S]=J[S]}),W=JSON.stringify(Q,null,2)}else W=J.toString()}catch(Q){W=`Error serialization failed: ${Q.message}. Raw error: ${J.toString()}`}F.warn(`Connection error: ${Y} (${G})`),F.warn(`Full error details: ${W}`),F.warn(`Error occurred during ${o1?"reconnection":"initial connection"} - Reconnection attempts: ${r0}/${RJ}`);let{diagnosis:O,troubleshooting:A}=C6(J,0);if(F.warn(`Diagnosis: ${O}`),F.warn(`Troubleshooting: ${A}`),g1=!1,EJ(),q0("radioError",{error:"Radio connection error occurred",details:`${Y} (${G})`,errorType:"connection_error",troubleshooting:"Server may be down or network connectivity issues"}),o1&&!o0)F.warn("Connection error detected, starting manual reconnection"),WZ()}),g.on("disconnect",(J)=>{let Y={reason:J,timestamp:new Date().toISOString(),wasExpected:J==="client namespace disconnect"};if(F.error(`Disconnected from server: ${J}`),g1=!1,n9(),!m0)m0=Date.now();if(EJ(),NY)clearInterval(NY),NY=null;if(T1)clearTimeout(T1),T1=null;if(m.stopRecording(),J!=="client namespace disconnect"&&o1){if(F.warn("Disconnection detected, starting automatic reconnection..."),YZ=setTimeout(()=>{if(!g1){let G="Connection lost. Attempting to reconnect...",W="Connection will automatically retry";if(J.includes("transport close"))W="Network connection interrupted - check your internet connection";else if(J.includes("ping timeout"))W="Server not responding - may be overloaded or down";else if(J.includes("transport error"))W="Network transport error - check firewall and network settings";q0("radioError",{error:G,details:`Disconnect reason: ${J}`,troubleshooting:W})}},5000),!o0)WZ()}else q0("radioDisconnected",{reason:J,details:Y})}),g.on("reconnect",(J)=>{F.error(`Reconnected after ${J} attempts`),g1=!0}),g.on("reconnect_failed",()=>{F.warn("Socket.io reconnection failed")}),g.on("reconnect_error",(J)=>{let Y=J.message||J.toString()||"Unknown reconnection error",G=J.type||"reconnection_error",W="Unable to serialize error";try{if(typeof J==="object"&&J!==null){let Q={};for(let S in J)Q[S]=J[S];Object.getOwnPropertyNames(J).forEach((S)=>{Q[S]=J[S]}),W=JSON.stringify(Q,null,2)}else W=J.toString()}catch(Q){W=`Error serialization failed: ${Q.message}. Raw error: ${J.toString()}`}F.warn(`Reconnection error: ${Y} (${G})`),F.warn(`Full error details: ${W}`);let{diagnosis:O,troubleshooting:A}=C6(J,0);F.warn(`Diagnosis: ${O}`),F.warn(`Troubleshooting: ${A}`),q0("radioError",{error:"Reconnection failed",details:`${Y} (${G})`,errorType:"reconnection_error",troubleshooting:"Check server status and network connection"})}),g.on("voice",async(J)=>{try{let Y=J.serverId;if(!J.data){F.log("No audio data received");return}let G=l9(J.frequency),W=G&&b0.has(G);if(W){let Q=b0.get(G)}let O=!1,A=!1;if(Y!=w1)if(J.receiveType==="3DAudio");else try{O=!!await m.playAudio({serverId:Y,src:J.data,volume:1})}catch(Q){if(F.error(`Failed to start 2D audio for user ${Y}: ${Q}`),O=!1,Y<0)F.debug(`Dispatch audio corruption detected for user ${Y} - this may occur during repeated transmissions`)}else if(!W)return;else F.debug(`Processing own voice data for 3D audio on frequency ${G}`);if(W){let Q=b0.get(G);for(let S of Q)if(t)if(t.has3DVoiceSource(S))try{await t.play3DVoiceAudio(S,J.data)}catch(k){F.error(`[3D AUDIO] Error playing 3D audio: ${k.message}`),F.error(`[3D AUDIO] Error stack: ${k.stack}`)}else F.error(`No voice sourceId found in temp3DListeningChannels for ${J.frequency}`);else F.error(`No voice sourceId found in temp3DListeningChannels for ${J.frequency}`)}else{if(J.receiveType==="3DAudio")F.warn(`[3D AUDIO] Received 3DAudio voice but no 3D voice sources active for frequency ${G}! This may indicate timing issue or missing start3DVoice event.`);F.log(`No 3D voice sources found for frequency ${G}`)}if(O&&A)F.debug(`Voice coordination: Both 2D and 3D audio started for user ${Y}`);else if(O&&!A)F.debug(`Voice coordination: Only 2D audio started for user ${Y}`);else if(!O&&A)F.debug(`Voice coordination: Only 3D audio started for user ${Y} - normal for 3D-only scenarios`)}catch(Y){F.error(`Error handling voice data: ${Y}`)}}),g.on("talkingState",(J)=>{if(F.debug(`TalkingState event: User ${J.serverId} ${J.state?"started":"stopped"} talking on frequency ${J.frequency}`),J.state)v0.set(J.serverId,{frequency:J.frequency}),F.debug(`Added user ${J.serverId} to currentlyTalking (${v0.size} total)`);else{let Y=v0.has(J.serverId);if(v0.delete(J.serverId),F.debug(`Removed user ${J.serverId} from currentlyTalking (${v0.size} remaining). Was tracked: ${Y}`),E0.has(J.serverId)){let G=E0.get(J.serverId);try{if(G&&typeof G.stop==="function")G.stop()}catch(W){F.debug(`Error stopping siren for stopped talker ${J.serverId}: ${W}`)}finally{E0.delete(J.serverId);let W=`siren_${J.serverId}`;try{if(m.howls.has(W))m.stopAudio(W)}catch(O){F.debug(`Error cleaning up from audio manager: ${O}`)}F.debug(`Cleaned up siren audio for stopped talker ${J.serverId}`)}}if(C0.has(J.serverId)){let G=C0.get(J.serverId);try{if(G&&typeof G.stop==="function")G.stop()}catch(W){F.debug(`Error stopping helicopter for stopped talker ${J.serverId}: ${W}`)}finally{C0.delete(J.serverId);let W=`heli_${J.serverId}`;try{if(m.howls.has(W))m.stopAudio(W)}catch(O){F.debug(`Error cleaning up helicopter from audio manager: ${O}`)}F.debug(`Cleaned up helicopter audio for stopped talker ${J.serverId}`)}}}q0("talkingState",{serverId:J.serverId,frequency:J.frequency,talking:J.state})})}document.addEventListener("DOMContentLoaded",function(){let J=document.getElementById("dispatch-close");if(J)J.addEventListener("click",function(){let Y=document.getElementById("dispatch-panel"),G=document.getElementById("dispatch-iframe");if(Y.style.setProperty("display","none","important"),G.src="",window.originalBodyStyle!==void 0)document.body.style.cssText=window.originalBodyStyle,window.originalBodyStyle=void 0;q0("closeDispatch",{}),F.info("Dispatch panel closed via close button")})});window.radioHasNuiFocus=!1;function uW(){if(window.audioHealthCheckInterval)clearInterval(window.audioHealthCheckInterval);window.audioHealthCheckInterval=setInterval(iW,5000),F.debug("Audio health monitoring initialized (5s interval)")}uW();document.addEventListener("visibilitychange",()=>{if(document.hidden)F.info("Document became hidden (alt-tab away)");else if(F.info("Document became visible (alt-tab back)"),window.radioHasNuiFocus)q0("documentVisibilityRestored",{})});function r9(J){try{if(!t){F.debug("3D Audio Manager not initialized");return}switch(J.action){case"play3DTone":if(t)t.play3DTone(J.sourceId,J.tone,J.volume,J.coords);break;case"start3DVoice":let Y=l9(J.frequency);if(!b0.has(Y))b0.set(Y,new Set);if(b0.get(Y).add(J.sourceId),!F1.has(Y))if(F1.add(Y),g&&g.connected)g.emit("add3DListening",Y);else F.warn("[3D AUDIO] Cannot emit add3DListening - socket not connected!");t.start3DVoice(J.sourceId,Y,J.volume,J.coords);break;case"stop3DVoice":for(let[G,W]of b0)if(W.has(J.sourceId)){if(W.delete(J.sourceId),W.size===0){if(b0.delete(G),F1.has(G)){if(F1.delete(G),g&&g.connected)g.emit("remove3DListening",G)}}}t.stop3DVoice(J.sourceId);break;case"stopAll3DFromSource":F.debug(`Stopping all 3D audio from player ${J.sourceId}`);for(let[G,W]of b0)if(W.has(J.sourceId)){if(W.delete(J.sourceId),F.debug(`Removed voice sourceId ${J.sourceId} from frequency ${G}`),W.size===0)b0.delete(G),F.debug(`No more 3D voice sources on frequency ${G}`)}t.stopAll3DFromSource(J.sourceId);break;case"start3DSiren":F.debug(`Starting 3D siren from player ${J.sourceId}`),t.start3DSiren(J.sourceId,J.coords);break;case"stop3DSiren":F.debug(`Stopping 3D siren from player ${J.sourceId}`),t.stop3DSiren(J.sourceId);break;case"start3DHeli":F.debug(`Starting 3D helicopter from player ${J.sourceId}`),t.start3DHeli(J.sourceId,J.coords);break;case"stop3DHeli":F.debug(`Stopping 3D helicopter from player ${J.sourceId}`),t.stop3DHeli(J.sourceId);break;case"play3DGunshot":F.debug(`Playing 3D gunshot from player ${J.sourceId} with volume ${J.volume}`),t.play3DGunshot(J.sourceId,J.volume,J.coords);break;case"start3DTransmission":F.debug(`Starting 3D transmission from player ${J.sourceId}`),t.start3DTransmission(J.sourceId,J.coords);break;case"stop3DTransmission":F.debug(`Stopping 3D transmission from player ${J.sourceId}`),t.stop3DTransmission(J.sourceId,J.suppressTransEnd||!1,J.coords);break;case"updateListenerPosition":if(t&&t.updateListenerPosition)t.updateListenerPosition(J.coords,J.camera,J.speed);break;case"update3DPosition":t.update3DPosition(J.sourceId,J.coords,null,J.speed);break;case"stopAll3DAudio":if(F.debug("Stopping all 3D audio and clearing voice frequency tracking"),t)t.stopAll3DAudio();b0.clear();for(let G of F1)if(g&&g.connected)g.emit("remove3DListening",G);F1.clear(),F.debug("Cleared all 3D voice frequency tracking and temporary listening");break;case"mute2DAudio":if(F.debug("[RTEST3D] Muting 2D audio"),m)m.mute2DAudio();break;case"unmute2DAudio":if(F.debug("[RTEST3D] Unmuting 2D audio"),m)m.unmute2DAudio();break;default:F.debug(`Unknown 3D audio action: ${J.action}`);break}}catch(Y){F.error(`Error in handle3DAudioMessage: ${Y}`)}}function EJ(){if(F.debug("\uD83D\uDD0A [FORCE STOP ALL] Cleaning up all background SFX"),cW(),AJ(),E0.forEach((J,Y)=>{if(J&&typeof J.stop==="function")try{J.stop()}catch(G){F.debug(`Error stopping siren for ${Y}: ${G}`)}else if(J)F.warn(`Invalid siren reference for ${Y}, removing from tracking`)}),E0.clear(),C0.forEach((J,Y)=>{if(J&&typeof J.stop==="function")try{J.stop()}catch(G){F.debug(`Error stopping helicopter for ${Y}: ${G}`)}else if(J)F.warn(`Invalid heli reference for ${Y}, removing from tracking`)}),C0.clear(),v0.clear(),t)t.stopAll3DAudio();b0.clear();for(let J of F1)if(g&&g.connected)g.emit("remove3DListening",J);if(F1.clear(),F.debug("\uD83D\uDD0A [FORCE STOP ALL] Cleared 3D voice frequency tracking and temporary listening"),m&&m.stopAllAudio)m.stopAllAudio();F.debug("\uD83D\uDD0A [FORCE STOP ALL] All background SFX cleanup completed")}function cW(){F.debug("☢️ [NUCLEAR] Emergency stop of all audio");try{if(document.querySelectorAll("audio").forEach((Y,G)=>{try{Y.pause(),Y.currentTime=0,F.debug(`☢️ Stopped HTML audio element ${G}`)}catch(W){F.debug(`Error stopping HTML audio ${G}: ${W}`)}}),typeof Howler<"u"&&Howler._howls)Howler._howls.forEach((Y,G)=>{try{if(Y&&Y.stop&&Y.playing&&Y.playing())Y.stop(),F.debug(`☢️ Stopped playing Howl instance ${G}`)}catch(W){F.debug(`Error stopping Howl ${G}: ${W}`)}});if(t)try{t.stopAll3DAudio(),F.debug("☢️ [NUCLEAR] Stopped all 3D audio")}catch(Y){F.debug(`☢️ [NUCLEAR] Error stopping 3D audio: ${Y}`)}if(window.globalSirenCleanupFunctions)window.globalSirenCleanupFunctions.forEach((Y)=>{try{Y()}catch(G){F.debug(`Error executing siren cleanup function: ${G}`)}}),window.globalSirenCleanupFunctions.clear(),F.debug("☢️ [NUCLEAR] Executed all tracked cleanup functions");F.debug("☢️ [NUCLEAR] Emergency audio stop completed")}catch(J){F.error(`☢️ [NUCLEAR] Error during nuclear stop: ${J}`)}}function dW(){F.warn("\uD83D\uDD0D [DIAGNOSTICS] Running audio diagnostics...");let J=0,Y=0;try{if(document.querySelectorAll("audio").forEach((O,A)=>{if(!O.paused)J++,F.warn(`\uD83D\uDD0D Active HTML audio ${A}: src=${O.src}, currentTime=${O.currentTime}`)}),typeof Howler<"u"&&Howler._howls){Y=Howler._howls.length,F.warn(`\uD83D\uDD0D Total Howler instances: ${Y}`);let O=0;Howler._howls.forEach((A,Q)=>{if(A&&A.playing&&A.playing())O++,F.warn(`\uD83D\uDD0D Playing Howl ${Q}: ${A._src}`)}),F.warn(`\uD83D\uDD0D Playing Howler instances: ${O}`)}F.warn(`\uD83D\uDD0D Tracked sirens: ${E0.size}`),F.warn(`\uD83D\uDD0D Tracked helis: ${C0.size}`),F.warn(`\uD83D\uDD0D Currently talking: ${v0.size}`);let W=window.globalTransmissionAudio&&(window.globalTransmissionAudio.start||window.globalTransmissionAudio.mid||window.globalTransmissionAudio.end);if(F.warn(`\uD83D\uDD0D Global transmission active: ${W}`),m){let O=m.howls?m.howls.size:0,A=m.audioBuffers?m.audioBuffers.size:0;F.warn(`\uD83D\uDD0D AudioManager - Howls: ${O}, Buffers: ${A}`)}if(t&&t.active3DAudio)F.warn(`\uD83D\uDD0D 3D Audio active: ${t.active3DAudio.size}`);if(F.warn(`\uD83D\uDD0D [DIAGNOSTICS] Summary: HTML Audio: ${J}, Howler Total: ${Y}`),J===0&&Y===0)F.info("✅ [DIAGNOSTICS] No active audio detected - cleanup appears successful");else F.error("❌ [DIAGNOSTICS] Active audio detected - may need cleanup")}catch(G){F.error(`\uD83D\uDD0D [DIAGNOSTICS] Error during diagnostics: ${G}`)}}if(typeof window<"u")window.audioDiagnostics=dW;function AJ(){if(F.debug("\uD83D\uDD0A [GLOBAL FORCE STOP] Stopping singleton transmission sounds"),window.globalTransmissionCleanupTimer)clearTimeout(window.globalTransmissionCleanupTimer),window.globalTransmissionCleanupTimer=null;["start","mid","end"].forEach((J)=>{if(window.globalTransmissionAudio[J])try{if(typeof window.globalTransmissionAudio[J].stop==="function")window.globalTransmissionAudio[J].stop();else F.warn(`Invalid transmission ${J} reference, clearing`)}catch(Y){F.debug(`Error stopping global transmission ${J}: ${Y}`)}finally{window.globalTransmissionAudio[J]=null}}),window.globalTransmissionAudio.isPlaying=!1,["transmission_start","transmission_mid","transmission_end"].forEach((J)=>{try{if(m&&m.stopAudio)m.stopAudio(J)}catch(Y){F.debug(`Error stopping ${J} through audioManager: ${Y}`)}}),F.debug("\uD83D\uDD0A [GLOBAL FORCE STOP] Singleton cleanup completed")}function o9(){let J={timestamp:new Date().toISOString(),connection:{socket:!!g,connected:g?.connected||!1,authToken:MY?"Present":"Missing",serverId:w1,resourceName:ZZ},health:{isConnected:g1,wasRadioConnected:o1,lastHeartbeatResponse:NJ?new Date(NJ).toISOString():null,timeSinceLastHeartbeat:NJ?Date.now()-NJ:null,heartbeatTimeout:!!T1,heartbeatInterval:!!NY},reconnection:{isSilentReconnecting:EY,reconnectionAttempts:r0,maxReconnectionAttempts:RJ,silentReconnectionAttempts:KZ,maxSilentReconnectionAttempts:Q6,reconnectionInterval:!!o0,disconnectionStartTime:m0?new Date(m0).toISOString():null,timeSinceDisconnection:m0?Date.now()-m0:null},channels:{currentChannel:K1,savedSpeakerChannel:R1,savedListeningChannels:Array.from(HJ),savedListeningToUsers:Array.from(MJ),currentlyTalking:Array.from(v0.keys())},audio:{audioManagerExists:!!m,audio3DManagerExists:!!t,activeSirenPlayers:E0.size,activeHeliPlayers:C0.size,active3DVoiceFrequencies:Array.from(b0.keys())}},Y=L6();return J.health.healthCheck=Y,J}function d9(J){for(let[Y,G]of b0)if(G.has(J))return!0;return!1}function i9(){let J=new Set;for(let[Y,G]of b0)for(let W of G)J.add(W);return J.size}window.radioConnectionDiagnostics=o9;function iW(){try{if(!(v0.size>0&&![...v0.keys()].includes(w1))){if(window.globalTransmissionAudio&&window.globalTransmissionAudio.isPlaying)F.warn("\uD83D\uDD0A [HEALTH CHECK] No one is talking but transmission sounds are playing - force stopping"),AJ();if(m&&m.getPlayingAudio){let W=m.getPlayingAudio();if(W&&W.size>0)W.forEach((O,A)=>{if(A.includes("transmission_")&&O.playing&&O.playing())F.warn(`\uD83D\uDD0A [HEALTH CHECK] No one talking but found transmission audio for ${A} - stopping`),m.stopAudio(A)})}}else{if(window.globalTransmissionAudio.mid&&window.globalTransmissionAudio.mid.playing&&window.globalTransmissionAudio.mid.playing()){let W=Date.now();if(!window.globalTransmissionAudio.mid._healthCheckStart)window.globalTransmissionAudio.mid._healthCheckStart=W;else if(W-window.globalTransmissionAudio.mid._healthCheckStart>30000)F.warn("\uD83D\uDD0A [HEALTH CHECK] Found global transmission mid sound running for > 30s, force stopping"),AJ()}else if(window.globalTransmissionAudio.mid&&window.globalTransmissionAudio.mid._healthCheckStart)delete window.globalTransmissionAudio.mid._healthCheckStart;if(m&&m.getPlayingAudio){let W=m.getPlayingAudio();if(W&&W.size>0)W.forEach((O,A)=>{if(A.includes("transmission_")&&O.playing&&O.playing()){if(!O._healthCheckStart)O._healthCheckStart=Date.now();else if(Date.now()-O._healthCheckStart>30000)F.warn(`\uD83D\uDD0A [HEALTH CHECK] Found stuck audio for ${A}, stopping`),m.stopAudio(A)}})}}E0.forEach((W,O)=>{try{if(!W||typeof W.stop!=="function"){F.debug(`\uD83D\uDD0A [HEALTH CHECK] Cleaning up invalid siren reference for ${O}`),E0.delete(O);return}if(W.state&&W.state()==="stopped")F.debug(`\uD83D\uDD0A [HEALTH CHECK] Cleaning up stopped siren audio for ${O}`),E0.delete(O);else if(!v0.has(O)&&!d9(O)){F.debug(`\uD83D\uDD0A [HEALTH CHECK] Siren playing for ${O} but they're not talking (2D or 3D) - stopping`);try{if(typeof W.stop==="function")W.stop();else F.warn(`Invalid orphaned siren reference for ${O}`)}catch(A){F.debug(`Error stopping orphaned siren for ${O}: ${A}`)}E0.delete(O)}}catch(A){F.debug(`\uD83D\uDD0A [HEALTH CHECK] Error checking siren ${O}, removing: ${A}`),E0.delete(O)}});let Y=window.globalSirenCleanupFunctions?.size||0,G=E0.size;if(Y>G){if(F.debug(`\uD83D\uDD0A [HEALTH] Cleanup function leak detected: ${Y} functions vs ${G} sirens`),Y>G*2)F.debug("\uD83D\uDD0A [HEALTH] Performing emergency cleanup function execution"),window.globalSirenCleanupFunctions?.forEach((W)=>{try{W()}catch(O){}}),window.globalSirenCleanupFunctions?.clear()}if(C0.forEach((W,O)=>{if(W&&W.state&&W.state()==="stopped")F.debug(`\uD83D\uDD0A [HEALTH CHECK] Cleaning up stopped heli audio for ${O}`),C0.delete(O);else if(W&&!v0.has(O)&&!d9(O)){F.warn(`\uD83D\uDD0A [HEALTH CHECK] Heli playing for ${O} but they're not talking (2D or 3D) - stopping`);try{if(typeof W.stop==="function")W.stop();else F.warn(`Invalid orphaned heli reference for ${O}`)}catch(A){F.debug(`Error stopping orphaned heli for ${O}: ${A}`)}C0.delete(O)}}),t){let W=t.getActive3DAudioCount(),O=v0.size,A=i9();if(audioBreakdown.total>audioBreakdown.actuallyPlaying)F.debug(`\uD83D\uDD0A [HEALTH DEBUG] Audio breakdown: ${audioBreakdown.actuallyPlaying}/${audioBreakdown.total} playing (${audioBreakdown.voicePlaceholders} voice placeholders, ${audioBreakdown.voiceActuallyPlaying} voice playing), ${A} 3D voice active, ${O} 2D talking`);if(audioBreakdown.actuallyPlaying>O*4){if(F.warn(`\uD83D\uDD25 [NEW HEALTH] Potential 3D audio leak: ${audioBreakdown.actuallyPlaying} playing vs ${O} talking (${audioBreakdown.total} total tracked, ${audioBreakdown.voicePlaceholders} voice placeholders)`),audioBreakdown.actuallyPlaying>50)F.warn("\uD83D\uDD0A [HEALTH] Performing emergency 3D audio cleanup"),t.stopAll3DAudio()}if(O+i9()===0){let S=t.getActive3DAudioInfo(),E=0,k=0;for(let[X,$]of S){let R=$.howl&&$.howl.playing&&$.howl.playing($.soundId);if($.type==="siren"&&R)E++,F.warn(`\uD83D\uDD0A [HEALTH] Found stuck 3D siren: ${X} from source ${$.sourceId}`),t.stop3DAudio(X);else if($.type==="heli"&&R)k++,F.warn(`\uD83D\uDD0A [HEALTH] Found stuck 3D heli: ${X} from source ${$.sourceId}`),t.stop3DAudio(X)}if(E>0||k>0)F.warn(`\uD83D\uDD0A [HEALTH] Cleaned up ${E} stuck 3D sirens and ${k} stuck 3D helis`)}if(audioBreakdown.total>0&&!t.interpolationRunning)F.warn(`\uD83D\uDD0A [HEALTH] 3D interpolation loop stopped but ${audioBreakdown.total} audio entries tracked (${audioBreakdown.actuallyPlaying} playing, ${audioBreakdown.voicePlaceholders} voice placeholders), restarting`),t.startInterpolationLoop();if(t.cleanup3DTransmissionSources){let S=new Set([...v0.keys()]);t.cleanup3DTransmissionSources(S)}}}catch(J){F.debug(`Error in audio health check: ${J}`)}}window.addEventListener("beforeunload",()=>{if(window.globalTransmissionCleanupTimer)clearTimeout(window.globalTransmissionCleanupTimer),window.globalTransmissionCleanupTimer=null;if(EJ(),t)t.cleanup();if(m&&m.stopAllAudio)m.stopAllAudio()});window.addEventListener("message",(J)=>{let Y=J.data,G=["play3DTone","start3DVoice","stop3DVoice","start3DSiren","stop3DSiren","start3DHeli","stop3DHeli","start3DTransmission","stop3DTransmission","play3DGunshot","update3DPosition","updateListenerPosition","mute2DAudio","unmute2DAudio"];if(Y.action&&G.includes(Y.action))try{r9(Y)}catch(W){F.error("Error handling 3D audio NUI message:",W)}});window.debug3DAudio=()=>{if(console.log("=== 3D AUDIO DEBUG INFO ==="),!t){console.log("❌ audio3DManager not initialized");return}let J=t.getActive3DAudioInfo();console.log(`Total active 3D audio sources: ${J.size}`),J.forEach((G,W)=>{console.log(`
|
|
\uD83D\uDCCD ${W}:`),console.log(` Type: ${G.type}`),console.log(` Source ID: ${G.sourceId}`),console.log(" Position:",G.position),console.log(` Base Volume: ${G.baseVolume}`)});let Y=t.getAudioBreakdown();if(console.log(`
|
|
=== AUDIO BREAKDOWN ===`),console.log(`Total tracked: ${Y.total}`),console.log(`Actually playing: ${Y.actuallyPlaying}`),console.log(`Voice placeholders: ${Y.voicePlaceholders}`),console.log(`Voice actually playing: ${Y.voiceActuallyPlaying}`),console.log("By type:",Y.byType),console.log(`
|
|
=== ACTIVE 3D VOICE FREQUENCIES ===`),console.log(`Active frequencies: ${b0.size}`),b0.forEach((G,W)=>{console.log(` ${W}: ${Array.from(G).join(", ")}`)}),console.log(`
|
|
=== TEMP 3D LISTENING CHANNELS ===`),console.log(`Temp listening channels: ${F1.size}`),console.log(`Channels: ${Array.from(F1).join(", ")}`),console.log(`
|
|
=== 2D AUDIO STATUS ===`),m)console.log(`2D Mute Multiplier: ${m.mute2DMultiplier}`),console.log(`2D audio ${m.mute2DMultiplier===0?"MUTED":"UNMUTED"}`);if(console.log(`
|
|
=== LISTENER POSITION ===`),t.listenerPosition)console.log("Position:",t.listenerPosition);console.log(`
|
|
\uD83D\uDCA1 TIP: Run this while receiving a transmission to see active 3D sources`)};window.check3D=()=>{if(!t){console.log("❌ 3D audio manager not initialized");return}let J=t.getActive3DAudioInfo(),Y=t.getAudioBreakdown();if(console.log(`\uD83D\uDD0A 3D Audio: ${J.size} tracked, ${Y.actuallyPlaying} playing`),console.log(`\uD83D\uDCFB 2D Audio: ${m?.mute2DMultiplier===0?"MUTED":"UNMUTED"}`),console.log(`\uD83D\uDCE1 Listening to ${F1.size} 3D frequencies`),J.size>0)console.log(`
|
|
Active sources:`),J.forEach((G,W)=>{console.log(` - ${W}: ${G.type} from source ${G.sourceId}`)});else console.log("⚠️ No active 3D audio sources")};console.log("\uD83D\uDCA1 Debug commands available:");console.log(" - window.debug3DAudio() - Full 3D audio status");console.log(" - window.check3D() - Quick status check");})();
|