voxnix 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -28
- package/dist/voxnix.js +790 -766
- package/dist/voxnix.umd.cjs +18 -18
- package/package.json +1 -1
package/dist/voxnix.umd.cjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var
|
|
10
|
+
*/var yn;function Ao(){if(yn)return Fr;yn=1;var s=$e,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n={key:!0,ref:!0,__self:!0,__source:!0};function a(o,l,c){var d,g={},u=null,y=null;c!==void 0&&(u=""+c),l.key!==void 0&&(u=""+l.key),l.ref!==void 0&&(y=l.ref);for(d in l)r.call(l,d)&&!n.hasOwnProperty(d)&&(g[d]=l[d]);if(o&&o.defaultProps)for(d in l=o.defaultProps,l)g[d]===void 0&&(g[d]=l[d]);return{$$typeof:e,type:o,key:u,ref:y,props:g,_owner:i.current}}return Fr.Fragment=t,Fr.jsx=a,Fr.jsxs=a,Fr}var Br={};/**
|
|
11
11
|
* @license React
|
|
12
12
|
* react-jsx-runtime.development.js
|
|
13
13
|
*
|
|
@@ -15,27 +15,27 @@
|
|
|
15
15
|
*
|
|
16
16
|
* This source code is licensed under the MIT license found in the
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var wn;function To(){return wn||(wn=1,process.env.NODE_ENV!=="production"&&function(){var s=$e,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),n=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),u=Symbol.for("react.lazy"),
|
|
18
|
+
*/var wn;function To(){return wn||(wn=1,process.env.NODE_ENV!=="production"&&function(){var s=$e,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),n=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),u=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen"),E=Symbol.iterator,v="@@iterator";function _(b){if(b===null||typeof b!="object")return null;var P=E&&b[E]||b[v];return typeof P=="function"?P:null}var x=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function p(b){{for(var P=arguments.length,Y=new Array(P>1?P-1:0),Z=1;Z<P;Z++)Y[Z-1]=arguments[Z];w("error",b,Y)}}function w(b,P,Y){{var Z=x.ReactDebugCurrentFrame,ge=Z.getStackAddendum();ge!==""&&(P+="%s",Y=Y.concat([ge]));var pe=Y.map(function(ae){return String(ae)});pe.unshift("Warning: "+P),Function.prototype.apply.call(console[b],console,pe)}}var D=!1,S=!1,T=!1,F=!1,h=!1,M;M=Symbol.for("react.module.reference");function A(b){return!!(typeof b=="string"||typeof b=="function"||b===r||b===n||h||b===i||b===c||b===d||F||b===y||D||S||T||typeof b=="object"&&b!==null&&(b.$$typeof===u||b.$$typeof===g||b.$$typeof===a||b.$$typeof===o||b.$$typeof===l||b.$$typeof===M||b.getModuleId!==void 0))}function f(b,P,Y){var Z=b.displayName;if(Z)return Z;var ge=P.displayName||P.name||"";return ge!==""?Y+"("+ge+")":Y}function C(b){return b.displayName||"Context"}function m(b){if(b==null)return null;if(typeof b.tag=="number"&&p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof b=="function")return b.displayName||b.name||null;if(typeof b=="string")return b;switch(b){case r:return"Fragment";case t:return"Portal";case n:return"Profiler";case i:return"StrictMode";case c:return"Suspense";case d:return"SuspenseList"}if(typeof b=="object")switch(b.$$typeof){case o:var P=b;return C(P)+".Consumer";case a:var Y=b;return C(Y._context)+".Provider";case l:return f(b,b.render,"ForwardRef");case g:var Z=b.displayName||null;return Z!==null?Z:m(b.type)||"Memo";case u:{var ge=b,pe=ge._payload,ae=ge._init;try{return m(ae(pe))}catch{return null}}}return null}var q=Object.assign,N=0,z,G,ie,he,ue,k,$;function H(){}H.__reactDisabledLog=!0;function I(){{if(N===0){z=console.log,G=console.info,ie=console.warn,he=console.error,ue=console.group,k=console.groupCollapsed,$=console.groupEnd;var b={configurable:!0,enumerable:!0,value:H,writable:!0};Object.defineProperties(console,{info:b,log:b,warn:b,error:b,group:b,groupCollapsed:b,groupEnd:b})}N++}}function me(){{if(N--,N===0){var b={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:q({},b,{value:z}),info:q({},b,{value:G}),warn:q({},b,{value:ie}),error:q({},b,{value:he}),group:q({},b,{value:ue}),groupCollapsed:q({},b,{value:k}),groupEnd:q({},b,{value:$})})}N<0&&p("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var fe=x.ReactCurrentDispatcher,ke;function X(b,P,Y){{if(ke===void 0)try{throw Error()}catch(ge){var Z=ge.stack.trim().match(/\n( *(at )?)/);ke=Z&&Z[1]||""}return`
|
|
19
19
|
`+ke+b}}var kt=!1,ct;{var zr=typeof WeakMap=="function"?WeakMap:Map;ct=new zr}function Gt(b,P){if(!b||kt)return"";{var Y=ct.get(b);if(Y!==void 0)return Y}var Z;kt=!0;var ge=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var pe;pe=fe.current,fe.current=null,I();try{if(P){var ae=function(){throw Error()};if(Object.defineProperty(ae.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ae,[])}catch(We){Z=We}Reflect.construct(b,[],ae)}else{try{ae.call()}catch(We){Z=We}b.call(ae.prototype)}}else{try{throw Error()}catch(We){Z=We}b()}}catch(We){if(We&&Z&&typeof We.stack=="string"){for(var re=We.stack.split(`
|
|
20
20
|
`),Ue=Z.stack.split(`
|
|
21
21
|
`),De=re.length-1,Ae=Ue.length-1;De>=1&&Ae>=0&&re[De]!==Ue[Ae];)Ae--;for(;De>=1&&Ae>=0;De--,Ae--)if(re[De]!==Ue[Ae]){if(De!==1||Ae!==1)do if(De--,Ae--,Ae<0||re[De]!==Ue[Ae]){var tt=`
|
|
22
|
-
`+re[De].replace(" at new "," at ");return b.displayName&&tt.includes("<anonymous>")&&(tt=tt.replace("<anonymous>",b.displayName)),typeof b=="function"&&ct.set(b,tt),tt}while(De>=1&&Ae>=0);break}}}finally{kt=!1,fe.current=pe,me(),Error.prepareStackTrace=ge}var Rr=b?b.displayName||b.name:"",ur=Rr?X(Rr):"";return typeof b=="function"&&ct.set(b,ur),ur}function Ke(b,P,Y){return Gt(b,!1)}function qe(b){var P=b.prototype;return!!(P&&P.isReactComponent)}function It(b,P,Y){if(b==null)return"";if(typeof b=="function")return Gt(b,qe(b));if(typeof b=="string")return X(b);switch(b){case c:return X("Suspense");case d:return X("SuspenseList")}if(typeof b=="object")switch(b.$$typeof){case l:return Ke(b.render);case g:return It(b.type,P,Y);case u:{var Z=b,ge=Z._payload,pe=Z._init;try{return It(pe(ge),P,Y)}catch{}}}return""}var dt=Object.prototype.hasOwnProperty,dr={},Vt=x.ReactDebugCurrentFrame;function zt(b){if(b){var P=b._owner,Y=It(b.type,b._source,P?P.type:null);Vt.setExtraStackFrame(Y)}else Vt.setExtraStackFrame(null)}function lr(b,P,Y,Z,ge){{var pe=Function.call.bind(dt);for(var ae in b)if(pe(b,ae)){var re=void 0;try{if(typeof b[ae]!="function"){var Ue=Error((Z||"React class")+": "+Y+" type `"+ae+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof b[ae]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Ue.name="Invariant Violation",Ue}re=b[ae](P,ae,Z,Y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(De){re=De}re&&!(re instanceof Error)&&(zt(ge),p("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",Z||"React class",Y,ae,typeof re),zt(null)),re instanceof Error&&!(re.message in dr)&&(dr[re.message]=!0,zt(ge),p("Failed %s type: %s",Y,re.message),zt(null))}}}var Ze=Array.isArray;function Oe(b){return Ze(b)}function
|
|
22
|
+
`+re[De].replace(" at new "," at ");return b.displayName&&tt.includes("<anonymous>")&&(tt=tt.replace("<anonymous>",b.displayName)),typeof b=="function"&&ct.set(b,tt),tt}while(De>=1&&Ae>=0);break}}}finally{kt=!1,fe.current=pe,me(),Error.prepareStackTrace=ge}var Rr=b?b.displayName||b.name:"",ur=Rr?X(Rr):"";return typeof b=="function"&&ct.set(b,ur),ur}function Ke(b,P,Y){return Gt(b,!1)}function qe(b){var P=b.prototype;return!!(P&&P.isReactComponent)}function It(b,P,Y){if(b==null)return"";if(typeof b=="function")return Gt(b,qe(b));if(typeof b=="string")return X(b);switch(b){case c:return X("Suspense");case d:return X("SuspenseList")}if(typeof b=="object")switch(b.$$typeof){case l:return Ke(b.render);case g:return It(b.type,P,Y);case u:{var Z=b,ge=Z._payload,pe=Z._init;try{return It(pe(ge),P,Y)}catch{}}}return""}var dt=Object.prototype.hasOwnProperty,dr={},Vt=x.ReactDebugCurrentFrame;function zt(b){if(b){var P=b._owner,Y=It(b.type,b._source,P?P.type:null);Vt.setExtraStackFrame(Y)}else Vt.setExtraStackFrame(null)}function lr(b,P,Y,Z,ge){{var pe=Function.call.bind(dt);for(var ae in b)if(pe(b,ae)){var re=void 0;try{if(typeof b[ae]!="function"){var Ue=Error((Z||"React class")+": "+Y+" type `"+ae+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof b[ae]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Ue.name="Invariant Violation",Ue}re=b[ae](P,ae,Z,Y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(De){re=De}re&&!(re instanceof Error)&&(zt(ge),p("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",Z||"React class",Y,ae,typeof re),zt(null)),re instanceof Error&&!(re.message in dr)&&(dr[re.message]=!0,zt(ge),p("Failed %s type: %s",Y,re.message),zt(null))}}}var Ze=Array.isArray;function Oe(b){return Ze(b)}function Et(b){{var P=typeof Symbol=="function"&&Symbol.toStringTag,Y=P&&b[Symbol.toStringTag]||b.constructor.name||"Object";return Y}}function Ar(b){try{return Kr(b),!1}catch{return!0}}function Kr(b){return""+b}function $t(b){if(Ar(b))return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Et(b)),Kr(b)}var Kt=x.ReactCurrentOwner,un={key:!0,ref:!0,__self:!0,__source:!0},Zr,Jr;function Zt(b){if(dt.call(b,"ref")){var P=Object.getOwnPropertyDescriptor(b,"ref").get;if(P&&P.isReactWarning)return!1}return b.ref!==void 0}function hr(b){if(dt.call(b,"key")){var P=Object.getOwnPropertyDescriptor(b,"key").get;if(P&&P.isReactWarning)return!1}return b.key!==void 0}function fn(b,P){typeof b.ref=="string"&&Kt.current}function Bs(b,P){{var Y=function(){Zr||(Zr=!0,p("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",P))};Y.isReactWarning=!0,Object.defineProperty(b,"key",{get:Y,configurable:!0})}}function ks(b,P){{var Y=function(){Jr||(Jr=!0,p("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",P))};Y.isReactWarning=!0,Object.defineProperty(b,"ref",{get:Y,configurable:!0})}}var gn=function(b,P,Y,Z,ge,pe,ae){var re={$$typeof:e,type:b,key:P,ref:Y,props:ae,_owner:pe};return re._store={},Object.defineProperty(re._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(re,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Z}),Object.defineProperty(re,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ge}),Object.freeze&&(Object.freeze(re.props),Object.freeze(re)),re};function xn(b,P,Y,Z,ge){{var pe,ae={},re=null,Ue=null;Y!==void 0&&($t(Y),re=""+Y),hr(P)&&($t(P.key),re=""+P.key),Zt(P)&&(Ue=P.ref,fn(P,ge));for(pe in P)dt.call(P,pe)&&!un.hasOwnProperty(pe)&&(ae[pe]=P[pe]);if(b&&b.defaultProps){var De=b.defaultProps;for(pe in De)ae[pe]===void 0&&(ae[pe]=De[pe])}if(re||Ue){var Ae=typeof b=="function"?b.displayName||b.name||"Unknown":b;re&&Bs(ae,Ae),Ue&&ks(ae,Ae)}return gn(b,re,Ue,ge,Z,Kt.current,ae)}}var Tr=x.ReactCurrentOwner,Is=x.ReactDebugCurrentFrame;function Ht(b){if(b){var P=b._owner,Y=It(b.type,b._source,P?P.type:null);Is.setExtraStackFrame(Y)}else Is.setExtraStackFrame(null)}var Xr;Xr=!1;function Sr(b){return typeof b=="object"&&b!==null&&b.$$typeof===e}function $s(){{if(Tr.current){var b=m(Tr.current.type);if(b)return`
|
|
23
23
|
|
|
24
24
|
Check the render method of \``+b+"`."}return""}}function pn(b){return""}var Hs={};function Ps(b){{var P=$s();if(!P){var Y=typeof b=="string"?b:b.displayName||b.name;Y&&(P=`
|
|
25
25
|
|
|
26
|
-
Check the top-level render call using <`+Y+">.")}return P}}function Os(b,P){{if(!b._store||b._store.validated||b.key!=null)return;b._store.validated=!0;var Y=Ps(P);if(Hs[Y])return;Hs[Y]=!0;var Z="";b&&b._owner&&b._owner!==Tr.current&&(Z=" It was passed a child from "+m(b._owner.type)+"."),Ht(b),p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Y,Z),Ht(null)}}function Ms(b,P){{if(typeof b!="object")return;if(Oe(b))for(var Y=0;Y<b.length;Y++){var Z=b[Y];Sr(Z)&&Os(Z,P)}else if(Sr(b))b._store&&(b._store.validated=!0);else if(b){var ge=_(b);if(typeof ge=="function"&&ge!==b.entries)for(var pe=ge.call(b),ae;!(ae=pe.next()).done;)Sr(ae.value)&&Os(ae.value,P)}}}function Ns(b){{var P=b.type;if(P==null||typeof P=="string")return;var Y;if(typeof P=="function")Y=P.propTypes;else if(typeof P=="object"&&(P.$$typeof===l||P.$$typeof===g))Y=P.propTypes;else return;if(Y){var Z=m(P);lr(Y,b.props,"prop",Z,b)}else if(P.PropTypes!==void 0&&!Xr){Xr=!0;var ge=m(P);p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ge||"Unknown")}typeof P.getDefaultProps=="function"&&!P.getDefaultProps.isReactClassApproved&&p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function mn(b){{for(var P=Object.keys(b.props),Y=0;Y<P.length;Y++){var Z=P[Y];if(Z!=="children"&&Z!=="key"){Ht(b),p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Z),Ht(null);break}}b.ref!==null&&(Ht(b),p("Invalid attribute `ref` supplied to `React.Fragment`."),Ht(null))}}var Qr={};function Me(b,P,Y,Z,ge,pe){{var ae=A(b);if(!ae){var re="";(b===void 0||typeof b=="object"&&b!==null&&Object.keys(b).length===0)&&(re+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Ue=pn();Ue?re+=Ue:re+=$s();var De;b===null?De="null":Oe(b)?De="array":b!==void 0&&b.$$typeof===e?(De="<"+(m(b.type)||"Unknown")+" />",re=" Did you accidentally export a JSX literal instead of a component?"):De=typeof b,p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",De,re)}var Ae=xn(b,P,Y,ge,pe);if(Ae==null)return Ae;if(ae){var tt=P.children;if(tt!==void 0)if(Z)if(Oe(tt)){for(var Rr=0;Rr<tt.length;Rr++)Ms(tt[Rr],b);Object.freeze&&Object.freeze(tt)}else p("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ms(tt,b)}if(dt.call(P,"key")){var ur=m(b),We=Object.keys(P).filter(function(
|
|
26
|
+
Check the top-level render call using <`+Y+">.")}return P}}function Os(b,P){{if(!b._store||b._store.validated||b.key!=null)return;b._store.validated=!0;var Y=Ps(P);if(Hs[Y])return;Hs[Y]=!0;var Z="";b&&b._owner&&b._owner!==Tr.current&&(Z=" It was passed a child from "+m(b._owner.type)+"."),Ht(b),p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Y,Z),Ht(null)}}function Ms(b,P){{if(typeof b!="object")return;if(Oe(b))for(var Y=0;Y<b.length;Y++){var Z=b[Y];Sr(Z)&&Os(Z,P)}else if(Sr(b))b._store&&(b._store.validated=!0);else if(b){var ge=_(b);if(typeof ge=="function"&&ge!==b.entries)for(var pe=ge.call(b),ae;!(ae=pe.next()).done;)Sr(ae.value)&&Os(ae.value,P)}}}function Ns(b){{var P=b.type;if(P==null||typeof P=="string")return;var Y;if(typeof P=="function")Y=P.propTypes;else if(typeof P=="object"&&(P.$$typeof===l||P.$$typeof===g))Y=P.propTypes;else return;if(Y){var Z=m(P);lr(Y,b.props,"prop",Z,b)}else if(P.PropTypes!==void 0&&!Xr){Xr=!0;var ge=m(P);p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ge||"Unknown")}typeof P.getDefaultProps=="function"&&!P.getDefaultProps.isReactClassApproved&&p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function mn(b){{for(var P=Object.keys(b.props),Y=0;Y<P.length;Y++){var Z=P[Y];if(Z!=="children"&&Z!=="key"){Ht(b),p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Z),Ht(null);break}}b.ref!==null&&(Ht(b),p("Invalid attribute `ref` supplied to `React.Fragment`."),Ht(null))}}var Qr={};function Me(b,P,Y,Z,ge,pe){{var ae=A(b);if(!ae){var re="";(b===void 0||typeof b=="object"&&b!==null&&Object.keys(b).length===0)&&(re+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Ue=pn();Ue?re+=Ue:re+=$s();var De;b===null?De="null":Oe(b)?De="array":b!==void 0&&b.$$typeof===e?(De="<"+(m(b.type)||"Unknown")+" />",re=" Did you accidentally export a JSX literal instead of a component?"):De=typeof b,p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",De,re)}var Ae=xn(b,P,Y,ge,pe);if(Ae==null)return Ae;if(ae){var tt=P.children;if(tt!==void 0)if(Z)if(Oe(tt)){for(var Rr=0;Rr<tt.length;Rr++)Ms(tt[Rr],b);Object.freeze&&Object.freeze(tt)}else p("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ms(tt,b)}if(dt.call(P,"key")){var ur=m(b),We=Object.keys(P).filter(function(zh){return zh!=="key"}),En=We.length>0?"{key: someKey, "+We.join(": ..., ")+": ...}":"{key: someKey}";if(!Qr[ur+En]){var Vh=We.length>0?"{"+We.join(": ..., ")+": ...}":"{}";p(`A props object containing a "key" prop is being spread into JSX:
|
|
27
27
|
let props = %s;
|
|
28
28
|
<%s {...props} />
|
|
29
29
|
React keys must be passed directly to JSX without using spread:
|
|
30
30
|
let props = %s;
|
|
31
|
-
<%s key={someKey} {...props} />`,
|
|
31
|
+
<%s key={someKey} {...props} />`,En,ur,Vh,ur),Qr[ur+En]=!0}}return b===r?mn(Ae):Ns(Ae),Ae}}function yt(b,P,Y){return Me(b,P,Y,!0)}function qs(b,P,Y){return Me(b,P,Y,!1)}var vn=qs,Gh=yt;Br.Fragment=r,Br.jsx=vn,Br.jsxs=Gh}()),Br}process.env.NODE_ENV==="production"?Us.exports=Ao():Us.exports=To();var Ne=Us.exports;const So="0.21.1";class Xt extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}class Ls extends Xt{constructor(e){super(e||"Unsupported content type.")}}class js extends Xt{constructor(e){super(e||"Request pending.")}}class Ro extends Xt{constructor(e){super(e||"Unspecified session description handler error.")}}class Ys extends Xt{constructor(){super("The session has terminated.")}}class kr extends Xt{constructor(e){super(e||"An error occurred during state transition.")}}class Fo{constructor(e){this.incomingAckRequest=e}get request(){return this.incomingAckRequest.message}}class Bo{constructor(e){this.incomingByeRequest=e}get request(){return this.incomingByeRequest.message}accept(e){return this.incomingByeRequest.accept(e),Promise.resolve()}reject(e){return this.incomingByeRequest.reject(e),Promise.resolve()}}class ko{constructor(e){this.incomingCancelRequest=e}get request(){return this.incomingCancelRequest}}class Ir{constructor(){this.listeners=new Array}addListener(e,t){const r=i=>{this.removeListener(r),e(i)};(t==null?void 0:t.once)===!0?this.listeners.push(r):this.listeners.push(e)}emit(e){this.listeners.slice().forEach(t=>t(e))}removeAllListeners(){this.listeners=[]}removeListener(e){this.listeners=this.listeners.filter(t=>t!==e)}on(e){return this.addListener(e)}off(e){return this.removeListener(e)}once(e){return this.addListener(e,{once:!0})}}class Io{constructor(e){this.incomingInfoRequest=e}get request(){return this.incomingInfoRequest.message}accept(e){return this.incomingInfoRequest.accept(e),Promise.resolve()}reject(e){return this.incomingInfoRequest.reject(e),Promise.resolve()}}class Cn{constructor(e){this.parameters={};for(const t in e)e.hasOwnProperty(t)&&this.setParam(t,e[t])}setParam(e,t){e&&(this.parameters[e.toLowerCase()]=typeof t>"u"||t===null?null:t.toString())}getParam(e){if(e)return this.parameters[e.toLowerCase()]}hasParam(e){return!!(e&&this.parameters[e.toLowerCase()]!==void 0)}deleteParam(e){if(e=e.toLowerCase(),this.hasParam(e)){const t=this.parameters[e];return delete this.parameters[e],t}}clearParams(){this.parameters={}}}class Le extends Cn{constructor(e,t,r){super(r),this.uri=e,this._displayName=t}get friendlyName(){return this.displayName||this.uri.aor}get displayName(){return this._displayName}set displayName(e){this._displayName=e}clone(){return new Le(this.uri.clone(),this._displayName,JSON.parse(JSON.stringify(this.parameters)))}toString(){let e=this.displayName||this.displayName==="0"?'"'+this.displayName+'" ':"";e+="<"+this.uri.toString()+">";for(const t in this.parameters)this.parameters.hasOwnProperty(t)&&(e+=";"+t,this.parameters[t]!==null&&(e+="="+this.parameters[t]));return e}}class lt extends Cn{constructor(e="sip",t,r,i,n,a){if(super(n||{}),this.headers={},!r)throw new TypeError('missing or invalid "host" parameter');for(const o in a)a.hasOwnProperty(o)&&this.setHeader(o,a[o]);this.raw={scheme:e,user:t,host:r,port:i},this.normal={scheme:e.toLowerCase(),user:t,host:r.toLowerCase(),port:i}}get scheme(){return this.normal.scheme}set scheme(e){this.raw.scheme=e,this.normal.scheme=e.toLowerCase()}get user(){return this.normal.user}set user(e){this.normal.user=this.raw.user=e}get host(){return this.normal.host}set host(e){this.raw.host=e,this.normal.host=e.toLowerCase()}get aor(){return this.normal.user+"@"+this.normal.host}get port(){return this.normal.port}set port(e){this.normal.port=this.raw.port=e}setHeader(e,t){this.headers[this.headerize(e)]=t instanceof Array?t:[t]}getHeader(e){if(e)return this.headers[this.headerize(e)]}hasHeader(e){return!!e&&!!this.headers.hasOwnProperty(this.headerize(e))}deleteHeader(e){if(e=this.headerize(e),this.headers.hasOwnProperty(e)){const t=this.headers[e];return delete this.headers[e],t}}clearHeaders(){this.headers={}}clone(){return new lt(this._raw.scheme,this._raw.user||"",this._raw.host,this._raw.port,JSON.parse(JSON.stringify(this.parameters)),JSON.parse(JSON.stringify(this.headers)))}toRaw(){return this._toString(this._raw)}toString(){return this._toString(this._normal)}get _normal(){return this.normal}get _raw(){return this.raw}_toString(e){let t=e.scheme+":";e.scheme.toLowerCase().match("^sips?$")||(t+="//"),e.user&&(t+=this.escapeUser(e.user)+"@"),t+=e.host,(e.port||e.port===0)&&(t+=":"+e.port);for(const i in this.parameters)this.parameters.hasOwnProperty(i)&&(t+=";"+i,this.parameters[i]!==null&&(t+="="+this.parameters[i]));const r=[];for(const i in this.headers)if(this.headers.hasOwnProperty(i))for(const n in this.headers[i])this.headers[i].hasOwnProperty(n)&&r.push(i+"="+this.headers[i][n]);return r.length>0&&(t+="?"+r.join("&")),t}escapeUser(e){let t;try{t=decodeURIComponent(e)}catch(r){throw r}return encodeURIComponent(t).replace(/%3A/ig,":").replace(/%2B/ig,"+").replace(/%3F/ig,"?").replace(/%2F/ig,"/")}headerize(e){const t={"Call-Id":"Call-ID",Cseq:"CSeq","Min-Se":"Min-SE",Rack:"RAck",Rseq:"RSeq","Www-Authenticate":"WWW-Authenticate"},r=e.toLowerCase().replace(/_/g,"-").split("-"),i=r.length;let n="";for(let a=0;a<i;a++)a!==0&&(n+="-"),n+=r[a].charAt(0).toUpperCase()+r[a].substring(1);return t[n]&&(n=t[n]),n}}function _n(s,e){if(s.scheme!==e.scheme||s.user!==e.user||s.host!==e.host||s.port!==e.port)return!1;function t(n,a){const o=Object.keys(n.parameters),l=Object.keys(a.parameters);return!(!o.filter(d=>l.includes(d)).every(d=>n.parameters[d]===a.parameters[d])||!["user","ttl","method","transport"].every(d=>n.hasParam(d)&&a.hasParam(d)||!n.hasParam(d)&&!a.hasParam(d))||!["maddr"].every(d=>n.hasParam(d)&&a.hasParam(d)||!n.hasParam(d)&&!a.hasParam(d)))}if(!t(s,e))return!1;const r=Object.keys(s.headers),i=Object.keys(e.headers);if(r.length!==0||i.length!==0){if(r.length!==i.length)return!1;const n=r.filter(a=>i.includes(a));if(n.length!==i.length||!n.every(a=>s.headers[a].length&&e.headers[a].length&&s.headers[a][0]===e.headers[a][0]))return!1}return!0}function Ws(s,e,t){return t=t||" ",s.length>e?s:(e-=s.length,t+=t.repeat(e),s+t.slice(0,e))}class fr extends Error{constructor(e,t,r,i){super(),this.message=e,this.expected=t,this.found=r,this.location=i,this.name="SyntaxError",typeof Object.setPrototypeOf=="function"?Object.setPrototypeOf(this,fr.prototype):this.__proto__=fr.prototype,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,fr)}static buildMessage(e,t){function r(c){return c.charCodeAt(0).toString(16).toUpperCase()}function i(c){return c.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,d=>"\\x0"+r(d)).replace(/[\x10-\x1F\x7F-\x9F]/g,d=>"\\x"+r(d))}function n(c){return c.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,d=>"\\x0"+r(d)).replace(/[\x10-\x1F\x7F-\x9F]/g,d=>"\\x"+r(d))}function a(c){switch(c.type){case"literal":return'"'+i(c.text)+'"';case"class":const d=c.parts.map(g=>Array.isArray(g)?n(g[0])+"-"+n(g[1]):n(g));return"["+(c.inverted?"^":"")+d+"]";case"any":return"any character";case"end":return"end of input";case"other":return c.description}}function o(c){const d=c.map(a);let g,u;if(d.sort(),d.length>0){for(g=1,u=1;g<d.length;g++)d[g-1]!==d[g]&&(d[u]=d[g],u++);d.length=u}switch(d.length){case 1:return d[0];case 2:return d[0]+" or "+d[1];default:return d.slice(0,-1).join(", ")+", or "+d[d.length-1]}}function l(c){return c?'"'+i(c)+'"':"end of input"}return"Expected "+o(e)+" but "+l(t)+" found."}format(e){let t="Error: "+this.message;if(this.location){let r=null,i;for(i=0;i<e.length;i++)if(e[i].source===this.location.source){r=e[i].text.split(/\r\n|\n|\r/g);break}let n=this.location.start,a=this.location.source+":"+n.line+":"+n.column;if(r){let o=this.location.end,l=Ws("",n.line.toString().length," "),c=r[n.line-1],d=n.line===o.line?o.column:c.length+1;t+=`
|
|
32
32
|
--> `+a+`
|
|
33
33
|
`+l+` |
|
|
34
34
|
`+n.line+" | "+c+`
|
|
35
35
|
`+l+" | "+Ws("",n.column-1," ")+Ws("",d-n.column,"^")}else t+=`
|
|
36
36
|
at `+a}return t}}function $o(s,e){e=e!==void 0?e:{};const t={},r=e.grammarSource,i={Contact:119,Name_Addr_Header:156,Record_Route:176,Request_Response:81,SIP_URI:45,Subscription_State:186,Supported:191,Require:182,Via:194,absoluteURI:84,Call_ID:118,Content_Disposition:130,Content_Length:135,Content_Type:136,CSeq:146,displayName:122,Event:149,From:151,host:52,Max_Forwards:154,Min_SE:213,Proxy_Authenticate:157,quoted_string:40,Refer_To:178,Replaces:179,Session_Expires:210,stun_URI:217,To:192,turn_URI:223,uuid:226,WWW_Authenticate:209,challenge:158,sipfrag:230,Referred_By:231};let n=119;const a=[`\r
|
|
37
37
|
`,x(`\r
|
|
38
|
-
`,!1),/^[0-9]/,p([["0","9"]],!1,!1),/^[a-zA-Z]/,p([["a","z"],["A","Z"]],!1,!1),/^[0-9a-fA-F]/,p([["0","9"],["a","f"],["A","F"]],!1,!1),/^[\0-\xFF]/,p([["\0","ÿ"]],!1,!1),/^["]/,p(['"'],!1,!1)," ",x(" ",!1)," ",x(" ",!1),/^[a-zA-Z0-9]/,p([["a","z"],["A","Z"],["0","9"]],!1,!1),";",x(";",!1),"/",x("/",!1),"?",x("?",!1),":",x(":",!1),"@",x("@",!1),"&",x("&",!1),"=",x("=",!1),"+",x("+",!1),"$",x("$",!1),",",x(",",!1),"-",x("-",!1),"_",x("_",!1),".",x(".",!1),"!",x("!",!1),"~",x("~",!1),"*",x("*",!1),"'",x("'",!1),"(",x("(",!1),")",x(")",!1),"%",x("%",!1),function(){return" "},function(){return":"},/^[!-~]/,p([["!","~"]],!1,!1),/^[\x80-\uFFFF]/,p([["",""]],!1,!1),/^[\x80-\xBF]/,p([["","¿"]],!1,!1),/^[a-f]/,p([["a","f"]],!1,!1),"`",x("`",!1),"<",x("<",!1),">",x(">",!1),"\\",x("\\",!1),"[",x("[",!1),"]",x("]",!1),"{",x("{",!1),"}",x("}",!1),function(){return"*"},function(){return"/"},function(){return"="},function(){return"("},function(){return")"},function(){return">"},function(){return"<"},function(){return","},function(){return";"},function(){return":"},function(){return'"'},/^[!-']/,p([["!","'"]],!1,!1),/^[*-[]/,p([["*","["]],!1,!1),/^[\]-~]/,p([["]","~"]],!1,!1),function(f){return f},/^[#-[]/,p([["#","["]],!1,!1),/^[\0-\t]/,p([["\0"," "]],!1,!1),/^[\v-\f]/,p([["\v","\f"]],!1,!1),/^[\x0E-\x7F]/,p([["",""]],!1,!1),function(){e=e||{data:{}},e.data.uri=new lt(e.data.scheme,e.data.user,e.data.host,e.data.port),delete e.data.scheme,delete e.data.user,delete e.data.host,delete e.data.host_type,delete e.data.port},function(){e=e||{data:{}},e.data.uri=new lt(e.data.scheme,e.data.user,e.data.host,e.data.port,e.data.uri_params,e.data.uri_headers),delete e.data.scheme,delete e.data.user,delete e.data.host,delete e.data.host_type,delete e.data.port,delete e.data.uri_params,e.startRule==="SIP_URI"&&(e.data=e.data.uri)},"sips",x("sips",!0),"sip",x("sip",!0),function(f){e=e||{data:{}},e.data.scheme=f},function(){e=e||{data:{}},e.data.user=decodeURIComponent(v().slice(0,-1))},function(){e=e||{data:{}},e.data.password=v()},function(){return e=e||{data:{}},e.data.host=v(),e.data.host},function(){return e=e||{data:{}},e.data.host_type="domain",v()},/^[a-zA-Z0-9_\-]/,p([["a","z"],["A","Z"],["0","9"],"_","-"],!1,!1),/^[a-zA-Z0-9\-]/,p([["a","z"],["A","Z"],["0","9"],"-"],!1,!1),function(){return e=e||{data:{}},e.data.host_type="IPv6",v()},"::",x("::",!1),function(){return e=e||{data:{}},e.data.host_type="IPv6",v()},function(){return e=e||{data:{}},e.data.host_type="IPv4",v()},"25",x("25",!1),/^[0-5]/,p([["0","5"]],!1,!1),"2",x("2",!1),/^[0-4]/,p([["0","4"]],!1,!1),"1",x("1",!1),/^[1-9]/,p([["1","9"]],!1,!1),function(f){return e=e||{data:{}},f=parseInt(f.join("")),e.data.port=f,f},"transport=",x("transport=",!0),"udp",x("udp",!0),"tcp",x("tcp",!0),"sctp",x("sctp",!0),"tls",x("tls",!0),function(f){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.transport=f.toLowerCase()},"user=",x("user=",!0),"phone",x("phone",!0),"ip",x("ip",!0),function(f){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.user=f.toLowerCase()},"method=",x("method=",!0),function(f){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.method=f},"ttl=",x("ttl=",!0),function(f){e=e||{data:{}},e.data.params||(e.data.params={}),e.data.params.ttl=f},"maddr=",x("maddr=",!0),function(f){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.maddr=f},"lr",x("lr",!0),function(){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.lr=void 0},function(f,C){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),C===null?C=void 0:C=C[1],e.data.uri_params[f.toLowerCase()]=C},function(f,C){f=f.join("").toLowerCase(),C=C.join(""),e=e||{data:{}},e.data.uri_headers||(e.data.uri_headers={}),e.data.uri_headers[f]?e.data.uri_headers[f].push(C):e.data.uri_headers[f]=[C]},function(){e=e||{data:{}},e.startRule==="Refer_To"&&(e.data.uri=new lt(e.data.scheme,e.data.user,e.data.host,e.data.port,e.data.uri_params,e.data.uri_headers),delete e.data.scheme,delete e.data.user,delete e.data.host,delete e.data.host_type,delete e.data.port,delete e.data.uri_params)},"//",x("//",!1),function(){e=e||{data:{}},e.data.scheme=v()},x("SIP",!0),function(){e=e||{data:{}},e.data.sip_version=v()},"INVITE",x("INVITE",!1),"ACK",x("ACK",!1),"VXACH",x("VXACH",!1),"OPTIONS",x("OPTIONS",!1),"BYE",x("BYE",!1),"CANCEL",x("CANCEL",!1),"REGISTER",x("REGISTER",!1),"SUBSCRIBE",x("SUBSCRIBE",!1),"NOTIFY",x("NOTIFY",!1),"REFER",x("REFER",!1),"PUBLISH",x("PUBLISH",!1),function(){return e=e||{data:{}},e.data.method=v(),e.data.method},function(f){e=e||{data:{}},e.data.status_code=parseInt(f.join(""))},function(){e=e||{data:{}},e.data.reason_phrase=v()},function(){e=e||{data:{}},e.data=v()},function(){var f,C;for(e=e||{data:{}},C=e.data.multi_header.length,f=0;f<C;f++)if(e.data.multi_header[f].parsed===null){e.data=null;break}e.data!==null?e.data=e.data.multi_header:e.data=-1},function(){var f;e=e||{data:{}},e.data.multi_header||(e.data.multi_header=[]);try{f=new Le(e.data.uri,e.data.displayName,e.data.params),delete e.data.uri,delete e.data.displayName,delete e.data.params}catch{f=null}e.data.multi_header.push({position:l,offset:_().start.offset,parsed:f})},function(f){f=v().trim(),f[0]==='"'&&(f=f.substring(1,f.length-1)),e=e||{data:{}},e.data.displayName=f},"q",x("q",!0),function(f){e=e||{data:{}},e.data.params||(e.data.params={}),e.data.params.q=f},"expires",x("expires",!0),function(f){e=e||{data:{}},e.data.params||(e.data.params={}),e.data.params.expires=f},function(f){return parseInt(f.join(""))},"0",x("0",!1),function(){return parseFloat(v())},function(f,C){e=e||{data:{}},e.data.params||(e.data.params={}),C===null?C=void 0:C=C[1],e.data.params[f.toLowerCase()]=C},"render",x("render",!0),"session",x("session",!0),"icon",x("icon",!0),"alert",x("alert",!0),function(){e=e||{data:{}},e.startRule==="Content_Disposition"&&(e.data.type=v().toLowerCase())},"handling",x("handling",!0),"optional",x("optional",!0),"required",x("required",!0),function(f){e=e||{data:{}},e.data=parseInt(f.join(""))},function(){e=e||{data:{}},e.data=v()},"text",x("text",!0),"image",x("image",!0),"audio",x("audio",!0),"video",x("video",!0),"application",x("application",!0),"message",x("message",!0),"multipart",x("multipart",!0),"x-",x("x-",!0),function(f){e=e||{data:{}},e.data.value=parseInt(f.join(""))},function(f){e=e||{data:{}},e.data=f},function(f){e=e||{data:{}},e.data.event=f.toLowerCase()},function(){e=e||{data:{}};var f=e.data.tag;e.data=new Le(e.data.uri,e.data.displayName,e.data.params),f&&e.data.setParam("tag",f)},"tag",x("tag",!0),function(f){e=e||{data:{}},e.data.tag=f},function(f){e=e||{data:{}},e.data=parseInt(f.join(""))},function(f){e=e||{data:{}},e.data=f},function(){e=e||{data:{}},e.data=new Le(e.data.uri,e.data.displayName,e.data.params)},"digest",x("Digest",!0),"realm",x("realm",!0),function(f){e=e||{data:{}},e.data.realm=f},"domain",x("domain",!0),"nonce",x("nonce",!0),function(f){e=e||{data:{}},e.data.nonce=f},"opaque",x("opaque",!0),function(f){e=e||{data:{}},e.data.opaque=f},"stale",x("stale",!0),"true",x("true",!0),function(){e=e||{data:{}},e.data.stale=!0},"false",x("false",!0),function(){e=e||{data:{}},e.data.stale=!1},"algorithm",x("algorithm",!0),"md5",x("MD5",!0),"md5-sess",x("MD5-sess",!0),function(f){e=e||{data:{}},e.data.algorithm=f.toUpperCase()},"qop",x("qop",!0),"auth-int",x("auth-int",!0),"auth",x("auth",!0),function(f){e=e||{data:{}},e.data.qop||(e.data.qop=[]),e.data.qop.push(f.toLowerCase())},function(f){e=e||{data:{}},e.data.value=parseInt(f.join(""))},function(){var f,C;for(e=e||{data:{}},C=e.data.multi_header.length,f=0;f<C;f++)if(e.data.multi_header[f].parsed===null){e.data=null;break}e.data!==null?e.data=e.data.multi_header:e.data=-1},function(){var f;e=e||{data:{}},e.data.multi_header||(e.data.multi_header=[]);try{f=new Le(e.data.uri,e.data.displayName,e.data.params),delete e.data.uri,delete e.data.displayName,delete e.data.params}catch{f=null}e.data.multi_header.push({position:l,offset:_().start.offset,parsed:f})},function(){e=e||{data:{}},e.data=new Le(e.data.uri,e.data.displayName,e.data.params)},function(){e=e||{data:{}},e.data.replaces_from_tag&&e.data.replaces_to_tag||(e.data=-1)},function(){e=e||{data:{}},e.data={call_id:e.data}},"from-tag",x("from-tag",!0),function(f){e=e||{data:{}},e.data.replaces_from_tag=f},"to-tag",x("to-tag",!0),function(f){e=e||{data:{}},e.data.replaces_to_tag=f},"early-only",x("early-only",!0),function(){e=e||{data:{}},e.data.early_only=!0},function(f,C){return C},function(f,C){return A(f,C)},function(f){e=e||{data:{}},e.startRule==="Require"&&(e.data=f||[])},function(f){e=e||{data:{}},e.data.value=parseInt(f.join(""))},"active",x("active",!0),"pending",x("pending",!0),"terminated",x("terminated",!0),function(){e=e||{data:{}},e.data.state=v()},"reason",x("reason",!0),function(f){e=e||{data:{}},typeof f<"u"&&(e.data.reason=f)},function(f){e=e||{data:{}},typeof f<"u"&&(e.data.expires=f)},"retry_after",x("retry_after",!0),function(f){e=e||{data:{}},typeof f<"u"&&(e.data.retry_after=f)},"deactivated",x("deactivated",!0),"probation",x("probation",!0),"rejected",x("rejected",!0),"timeout",x("timeout",!0),"giveup",x("giveup",!0),"noresource",x("noresource",!0),"invariant",x("invariant",!0),function(f){e=e||{data:{}},e.startRule==="Supported"&&(e.data=f||[])},function(){e=e||{data:{}};var f=e.data.tag;e.data=new Le(e.data.uri,e.data.displayName,e.data.params),f&&e.data.setParam("tag",f)},"ttl",x("ttl",!0),function(f){e=e||{data:{}},e.data.ttl=f},"maddr",x("maddr",!0),function(f){e=e||{data:{}},e.data.maddr=f},"received",x("received",!0),function(f){e=e||{data:{}},e.data.received=f},"branch",x("branch",!0),function(f){e=e||{data:{}},e.data.branch=f},"rport",x("rport",!0),function(f){e=e||{data:{}},typeof f<"u"&&(e.data.rport=f.join(""))},function(f){e=e||{data:{}},e.data.protocol=f},x("UDP",!0),x("TCP",!0),x("TLS",!0),x("SCTP",!0),function(f){e=e||{data:{}},e.data.transport=f},function(){e=e||{data:{}},e.data.host=v()},function(f){e=e||{data:{}},e.data.port=parseInt(f.join(""))},function(f){return parseInt(f.join(""))},function(f){e=e||{data:{}},e.startRule==="Session_Expires"&&(e.data.deltaSeconds=f)},"refresher",x("refresher",!1),"uas",x("uas",!1),"uac",x("uac",!1),function(f){e=e||{data:{}},e.startRule==="Session_Expires"&&(e.data.refresher=f)},function(f){e=e||{data:{}},e.startRule==="Min_SE"&&(e.data=f)},"stuns",x("stuns",!0),"stun",x("stun",!0),function(f){e=e||{data:{}},e.data.scheme=f},function(f){e=e||{data:{}},e.data.host=f},"?transport=",x("?transport=",!1),"turns",x("turns",!0),"turn",x("turn",!0),function(f){e=e||{data:{}},e.data.transport=f},function(){e=e||{data:{}},e.data=v()},"Referred-By",x("Referred-By",!1),"b",x("b",!1),"cid",x("cid",!1)],o=[h('2 ""6 7!'),h('4"""5!7#'),h('4$""5!7%'),h(`4&""5!7'`),h(";'.# &;("),h('4(""5!7)'),h('4*""5!7+'),h('2,""6,7-'),h('2.""6.7/'),h('40""5!71'),h('22""6273. &24""6475.} &26""6677.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),h(";).# &;,"),h('2F""6F7G.} &2H""6H7I.q &2J""6J7K.e &2L""6L7M.Y &2N""6N7O.M &2P""6P7Q.A &2R""6R7S.5 &2T""6T7U.) &2V""6V7W'),h(`%%2X""6X7Y/5#;#/,$;#/#$+#)(#'#("'#&'#/"!&,)`),h(`%%$;$0#*;$&/,#; /#$+")("'#&'#." &"/=#$;$/�#*;$&&&#/'$8":Z" )("'#&'#`),h(';.." &"'),h(`%$;'.# &;(0)*;'.# &;(&/?#28""6879/0$;//'$8#:[# )(#'#("'#&'#`),h(`%%$;2/�#*;2&&&#/g#$%$;.0#*;.&/,#;2/#$+")("'#&'#0=*%$;.0#*;.&/,#;2/#$+")("'#&'#&/#$+")("'#&'#/"!&,)`),h('4\\""5!7].# &;3'),h('4^""5!7_'),h('4`""5!7a'),h(';!.) &4b""5!7c'),h('%$;). &2F""6F7G. &2J""6J7K.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O/#0*;). &2F""6F7G. &2J""6J7K.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O&&&#/"!&,)'),h('%$;). &2F""6F7G.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O/#0*;). &2F""6F7G.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O&&&#/"!&,)'),h(`2T""6T7U.ã &2V""6V7W.× &2f""6f7g.Ë &2h""6h7i.¿ &2:""6:7;.³ &2D""6D7E.§ &22""6273. &28""6879. &2j""6j7k. &;&.} &24""6475.q &2l""6l7m.e &2n""6n7o.Y &26""6677.M &2>""6>7?.A &2p""6p7q.5 &2r""6r7s.) &;'.# &;(`),h('%$;).ī &2F""6F7G.ğ &2J""6J7K.ē &2L""6L7M.ć &2X""6X7Y.û &2P""6P7Q.ï &2H""6H7I.ã &2@""6@7A.× &2d""6d7e.Ë &2R""6R7S.¿ &2N""6N7O.³ &2T""6T7U.§ &2V""6V7W. &2f""6f7g. &2h""6h7i. &28""6879.w &2j""6j7k.k &;&.e &24""6475.Y &2l""6l7m.M &2n""6n7o.A &26""6677.5 &2p""6p7q.) &2r""6r7s/Ĵ#0ı*;).ī &2F""6F7G.ğ &2J""6J7K.ē &2L""6L7M.ć &2X""6X7Y.û &2P""6P7Q.ï &2H""6H7I.ã &2@""6@7A.× &2d""6d7e.Ë &2R""6R7S.¿ &2N""6N7O.³ &2T""6T7U.§ &2V""6V7W. &2f""6f7g. &2h""6h7i. &28""6879.w &2j""6j7k.k &;&.e &24""6475.Y &2l""6l7m.M &2n""6n7o.A &26""6677.5 &2p""6p7q.) &2r""6r7s&&&#/"!&,)'),h(`%;//?#2P""6P7Q/0$;//'$8#:t# )(#'#("'#&'#`),h(`%;//?#24""6475/0$;//'$8#:u# )(#'#("'#&'#`),h(`%;//?#2>""6>7?/0$;//'$8#:v# )(#'#("'#&'#`),h(`%;//?#2T""6T7U/0$;//'$8#:w# )(#'#("'#&'#`),h(`%;//?#2V""6V7W/0$;//'$8#:x# )(#'#("'#&'#`),h(`%2h""6h7i/0#;//'$8":y" )("'#&'#`),h(`%;//6#2f""6f7g/'$8":z" )("'#&'#`),h(`%;//?#2D""6D7E/0$;//'$8#:{# )(#'#("'#&'#`),h(`%;//?#22""6273/0$;//'$8#:|# )(#'#("'#&'#`),h(`%;//?#28""6879/0$;//'$8#:}# )(#'#("'#&'#`),h(`%;//0#;&/'$8":~" )("'#&'#`),h(`%;&/0#;//'$8":~" )("'#&'#`),h(`%;=/T#$;G.) &;K.# &;F0/*;G.) &;K.# &;F&/,$;>/#$+#)(#'#("'#&'#`),h('4""5!7.A &4""5!7.5 &4""5!7.) &;3.# &;.'),h(`%%;//Q#;&/H$$;J.# &;K0)*;J.# &;K&/,$;&/#$+$)($'#(#'#("'#&'#/"!&,)`),h(`%;//]#;&/T$%$;J.# &;K0)*;J.# &;K&/"!&,)/1$;&/($8$:
$!!)($'#(#'#("'#&'#`),h(';..G &2L""6L7M.; &4""5!7./ &4""5!7.# &;3'),h(`%2j""6j7k/J#4""5!7.5 &4""5!7.) &4""5!7/#$+")("'#&'#`),h(`%;N/M#28""6879/>$;O." &"/0$;S/'$8$:$ )($'#(#'#("'#&'#`),h(`%;N/d#28""6879/U$;O." &"/G$;S/>$;_/5$;l." &"/'$8&:& )(&'#(%'#($'#(#'#("'#&'#`),h(`%3""5$7.) &3""5#7/' 8!:!! )`),h(`%;P/]#%28""6879/,#;R/#$+")("'#&'#." &"/6$2:""6:7;/'$8#:# )(#'#("'#&'#`),h("$;+.) &;-.# &;Q/2#0/*;+.) &;-.# &;Q&&&#"),h('2<""6<7=.q &2>""6>7?.e &2@""6@7A.Y &2B""6B7C.M &2D""6D7E.A &22""6273.5 &26""6677.) &24""6475'),h('%$;+._ &;-.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E0e*;+._ &;-.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E&/& 8!:! )'),h(`%;T/J#%28""6879/,#;^/#$+")("'#&'#." &"/#$+")("'#&'#`),h("%;U.) &;\\.# &;X/& 8!:! )"),h(`%$%;V/2#2J""6J7K/#$+")("'#&'#0<*%;V/2#2J""6J7K/#$+")("'#&'#&/D#;W/;$2J""6J7K." &"/'$8#:# )(#'#("'#&'#`),h('$4""5!7/,#0)*4""5!7&&&#'),h(`%4$""5!7%/?#$4""5!70)*4""5!7&/#$+")("'#&'#`),h(`%2l""6l7m/?#;Y/6$2n""6n7o/'$8#:# )(#'#("'#&'#`),h(`%%;Z/³#28""6879/¤$;Z/$28""6879/$;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+-)(-'#(,'#(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.ސ &%2""67/¤#;Z/$28""6879/$;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+,)(,'#(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.۹ &%2""67/#;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+*)(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.ٺ &%2""67/t#;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.ؓ &%2""67/\\#;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+&)(&'#(%'#($'#(#'#("'#&'#.ׄ &%2""67/D#;Z/;$28""6879/,$;[/#$+$)($'#(#'#("'#&'#.֍ &%2""67/,#;[/#$+")("'#&'#.ծ &%2""67/,#;Z/#$+")("'#&'#.Տ &%;Z/#2""67/$;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$++)(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ӈ &%;Z/ª#%28""6879/,#;Z/#$+")("'#&'#." &"/$2""67/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+*)(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.а &%;Z/¹#%28""6879/,#;Z/#$+")("'#&'#." &"/$%28""6879/,#;Z/#$+")("'#&'#." &"/k$2""67/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+))()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ί &%;Z/È#%28""6879/,#;Z/#$+")("'#&'#." &"/¡$%28""6879/,#;Z/#$+")("'#&'#." &"/z$%28""6879/,#;Z/#$+")("'#&'#." &"/S$2""67/D$;Z/;$28""6879/,$;[/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.˕ &%;Z/×#%28""6879/,#;Z/#$+")("'#&'#." &"/°$%28""6879/,#;Z/#$+")("'#&'#." &"/$%28""6879/,#;Z/#$+")("'#&'#." &"/b$%28""6879/,#;Z/#$+")("'#&'#." &"/;$2""67/,$;[/#$+')(''#(&'#(%'#($'#(#'#("'#&'#.ȑ &%;Z/þ#%28""6879/,#;Z/#$+")("'#&'#." &"/×$%28""6879/,#;Z/#$+")("'#&'#." &"/°$%28""6879/,#;Z/#$+")("'#&'#." &"/$%28""6879/,#;Z/#$+")("'#&'#." &"/b$%28""6879/,#;Z/#$+")("'#&'#." &"/;$2""67/,$;Z/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ħ &%;Z/Ĝ#%28""6879/,#;Z/#$+")("'#&'#." &"/õ$%28""6879/,#;Z/#$+")("'#&'#." &"/Î$%28""6879/,#;Z/#$+")("'#&'#." &"/§$%28""6879/,#;Z/#$+")("'#&'#." &"/$%28""6879/,#;Z/#$+")("'#&'#." &"/Y$%28""6879/,#;Z/#$+")("'#&'#." &"/2$2""67/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#/& 8!: ! )`),h(`%;#/M#;#." &"/?$;#." &"/1$;#." &"/#$+$)($'#(#'#("'#&'#`),h(`%;Z/;#28""6879/,$;Z/#$+#)(#'#("'#&'#.# &;\\`),h(`%;]/o#2J""6J7K/\`$;]/W$2J""6J7K/H$;]/?$2J""6J7K/0$;]/'$8':¡' )(''#(&'#(%'#($'#(#'#("'#&'#`),h(`%2¢""6¢7£/2#4¤""5!7¥/#$+")("'#&'#. &%2¦""6¦7§/;#4¨""5!7©/,$;!/#$+#)(#'#("'#&'#.j &%2ª""6ª7«/5#;!/,$;!/#$+#)(#'#("'#&'#.B &%4¬""5!7/,#;!/#$+")("'#&'#.# &;!`),h(`%%;!." &"/[#;!." &"/M$;!." &"/?$;!." &"/1$;!." &"/#$+%)(%'#($'#(#'#("'#&'#/' 8!:®!! )`),h(`$%22""6273/,#;\`/#$+")("'#&'#0<*%22""6273/,#;\`/#$+")("'#&'#&`),h(";a.A &;b.; &;c.5 &;d./ &;e.) &;f.# &;g"),h(`%3¯""5*7°/a#3±""5#7².G &3³""5#7´.; &3µ""5$7¶./ &3·""5#7¸.# &;6/($8":¹"! )("'#&'#`),h(`%3º""5%7»/I#3¼""5%7½./ &3¾""5"7¿.# &;6/($8":À"! )("'#&'#`),h(`%3Á""5'7Â/1#;/($8":Ã"! )("'#&'#`),h(`%3Ä""5$7Å/1#;ð/($8":Æ"! )("'#&'#`),h(`%3Ç""5&7È/1#;T/($8":É"! )("'#&'#`),h(`%3Ê""5"7Ë/N#%2>""6>7?/,#;6/#$+")("'#&'#." &"/'$8":Ì" )("'#&'#`),h(`%;h/P#%2>""6>7?/,#;i/#$+")("'#&'#." &"/)$8":Í""! )("'#&'#`),h('%$;j/�#*;j&&&#/"!&,)'),h('%$;j/�#*;j&&&#/"!&,)'),h(";k.) &;+.# &;-"),h('2l""6l7m.e &2n""6n7o.Y &24""6475.M &28""6879.A &2<""6<7=.5 &2@""6@7A.) &2B""6B7C'),h(`%26""6677/n#;m/e$$%2<""6<7=/,#;m/#$+")("'#&'#0<*%2<""6<7=/,#;m/#$+")("'#&'#&/#$+#)(#'#("'#&'#`),h(`%;n/A#2>""6>7?/2$;o/)$8#:Î#"" )(#'#("'#&'#`),h("$;p.) &;+.# &;-/2#0/*;p.) &;+.# &;-&&&#"),h("$;p.) &;+.# &;-0/*;p.) &;+.# &;-&"),h('2l""6l7m.e &2n""6n7o.Y &24""6475.M &26""6677.A &28""6879.5 &2@""6@7A.) &2B""6B7C'),h(";.# &;r"),h(`%;/G#;'/>$;s/5$;'/,$;/#$+%)(%'#($'#(#'#("'#&'#`),h(";M.# &;t"),h(`%;/E#28""6879/6$;u.# &;x/'$8#:Ï# )(#'#("'#&'#`),h(`%;v.# &;w/J#%26""6677/,#;/#$+")("'#&'#." &"/#$+")("'#&'#`),h(`%2Ð""6Ð7Ñ/:#;/1$;w." &"/#$+#)(#'#("'#&'#`),h(`%24""6475/,#;{/#$+")("'#&'#`),h(`%;z/3#$;y0#*;y&/#$+")("'#&'#`),h(";*.) &;+.# &;-"),h(';+. &;-. &22""6273.} &26""6677.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),h(`%;|/e#$%24""6475/,#;|/#$+")("'#&'#0<*%24""6475/,#;|/#$+")("'#&'#&/#$+")("'#&'#`),h(`%$;~0#*;~&/e#$%22""6273/,#;}/#$+")("'#&'#0<*%22""6273/,#;}/#$+")("'#&'#&/#$+")("'#&'#`),h("$;~0#*;~&"),h(';+.w &;-.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),h(`%%;"/#$;".G &;!.A &2@""6@7A.5 &2F""6F7G.) &2J""6J7K0M*;".G &;!.A &2@""6@7A.5 &2F""6F7G.) &2J""6J7K&/#$+")("'#&'#/& 8!:Ò! )`),h(";.# &;"),h(`%%;O/2#2:""6:7;/#$+")("'#&'#." &"/,#;S/#$+")("'#&'#." &"`),h('$;+. &;-.} &2B""6B7C.q &2D""6D7E.e &22""6273.Y &28""6879.M &2:""6:7;.A &2<""6<7=.5 &2>""6>7?.) &2@""6@7A/#0*;+. &;-.} &2B""6B7C.q &2D""6D7E.e &22""6273.Y &28""6879.M &2:""6:7;.A &2<""6<7=.5 &2>""6>7?.) &2@""6@7A&&&#'),h("$;y0#*;y&"),h(`%3""5#7Ó/q#24""6475/b$$;!/�#*;!&&&#/L$2J""6J7K/=$$;!/�#*;!&&&#/'$8%:Ô% )(%'#($'#(#'#("'#&'#`),h('2Õ""6Õ7Ö'),h('2×""6×7Ø'),h('2Ù""6Ù7Ú'),h('2Û""6Û7Ü'),h('2Ý""6Ý7Þ'),h('2ß""6ß7à'),h('2á""6á7â'),h('2ã""6ã7ä'),h('2å""6å7æ'),h('2ç""6ç7è'),h('2é""6é7ê'),h("%;
.Y &;.S &;.M &;.G &;.A &;.; &;.5 &;./ &;.) &;.# &;6/& 8!:ë! )"),h(`%;/G#;'/>$;/5$;'/,$;/#$+%)(%'#($'#(#'#("'#&'#`),h("%;/' 8!:ì!! )"),h(`%;!/5#;!/,$;!/#$+#)(#'#("'#&'#`),h("%$;*.A &;+.; &;-.5 &;3./ &;4.) &;'.# &;(0G*;*.A &;+.; &;-.5 &;3./ &;4.) &;'.# &;(&/& 8!:í! )"),h(`%;¶/Y#$%;A/,#;¶/#$+")("'#&'#06*%;A/,#;¶/#$+")("'#&'#&/#$+")("'#&'#`),h(`%;9/N#%2:""6:7;/,#;9/#$+")("'#&'#." &"/'$8":î" )("'#&'#`),h(`%;:.c &%;/Y#$%;A/,#;/#$+")("'#&'#06*%;A/,#;/#$+")("'#&'#&/#$+")("'#&'#/& 8!:ï! )`),h(`%;L.# &;/]#$%;B/,#;/#$+")("'#&'#06*%;B/,#;/#$+")("'#&'#&/'$8":ð" )("'#&'#`),h(`%;." &"/>#;@/5$;M/,$;?/#$+$)($'#(#'#("'#&'#`),h(`%%;6/Y#$%;./,#;6/#$+")("'#&'#06*%;./,#;6/#$+")("'#&'#&/#$+")("'#&'#.# &;H/' 8!:ñ!! )`),h(";.) &;.# &; "),h(`%3ò""5!7ó/:#;</1$;/($8#:ô#! )(#'#("'#&'#`),h(`%3õ""5'7ö/:#;</1$;/($8#:÷#! )(#'#("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:ø!! )"),h(`%2ù""6ù7ú/o#%2J""6J7K/M#;!." &"/?$;!." &"/1$;!." &"/#$+$)($'#(#'#("'#&'#." &"/'$8":û" )("'#&'#`),h(`%;6/J#%;</,#;¡/#$+")("'#&'#." &"/)$8":ü""! )("'#&'#`),h(";6.) &;T.# &;H"),h(`%;£/Y#$%;B/,#;¤/#$+")("'#&'#06*%;B/,#;¤/#$+")("'#&'#&/#$+")("'#&'#`),h(`%3ý""5&7þ.G &3ÿ""5'7Ā.; &3ā""5$7Ă./ &3ă""5%7Ą.# &;6/& 8!:ą! )`),h(";¥.# &; "),h(`%3Ć""5(7ć/M#;</D$3Ĉ""5(7ĉ./ &3Ċ""5(7ċ.# &;6/#$+#)(#'#("'#&'#`),h(`%;6/Y#$%;A/,#;6/#$+")("'#&'#06*%;A/,#;6/#$+")("'#&'#&/#$+")("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:Č!! )"),h("%;©/& 8!:č! )"),h(`%;ª/k#;;/b$;¯/Y$$%;B/,#;°/#$+")("'#&'#06*%;B/,#;°/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),h(";«.# &;¬"),h('3Ď""5$7ď.S &3Đ""5%7đ.G &3Ē""5%7ē.; &3Ĕ""5%7ĕ./ &3Ė""5+7ė.# &;'),h(`3Ę""5'7ę./ &3Ě""5)7ě.# &;`),h(";6.# &;®"),h(`%3Ĝ""5"7ĝ/,#;6/#$+")("'#&'#`),h(";.# &;6"),h(`%;6/5#;</,$;±/#$+#)(#'#("'#&'#`),h(";6.# &;H"),h(`%;³/5#;./,$;/#$+#)(#'#("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:Ğ!! )"),h("%;/' 8!:ğ!! )"),h(`%;¶/^#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/($8":Ġ"!!)("'#&'#`),h(`%%;7/e#$%2J""6J7K/,#;7/#$+")("'#&'#0<*%2J""6J7K/,#;7/#$+")("'#&'#&/#$+")("'#&'#/"!&,)`),h(`%;L.# &;/]#$%;B/,#;¸/#$+")("'#&'#06*%;B/,#;¸/#$+")("'#&'#&/'$8":ġ" )("'#&'#`),h(";¹.# &; "),h(`%3Ģ""5#7ģ/:#;</1$;6/($8#:Ĥ#! )(#'#("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:ĥ!! )"),h("%;/' 8!:Ħ!! )"),h(`%$;0#*;&/x#;@/o$;M/f$;?/]$$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/'$8%:ħ% )(%'#($'#(#'#("'#&'#`),h(";¾"),h(`%3Ĩ""5&7ĩ/k#;./b$;Á/Y$$%;A/,#;Á/#$+")("'#&'#06*%;A/,#;Á/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#.# &;¿`),h(`%;6/k#;./b$;À/Y$$%;A/,#;À/#$+")("'#&'#06*%;A/,#;À/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),h(`%;6/;#;</2$;6.# &;H/#$+#)(#'#("'#&'#`),h(";Â.G &;Ä.A &;Æ.; &;È.5 &;É./ &;Ê.) &;Ë.# &;À"),h(`%3Ī""5%7ī/5#;</,$;Ã/#$+#)(#'#("'#&'#`),h("%;I/' 8!:Ĭ!! )"),h(`%3ĭ""5&7Į/#;</$;D/
$;Å/|$$%$;'/�#*;'&&&#/,#;Å/#$+")("'#&'#0C*%$;'/�#*;'&&&#/,#;Å/#$+")("'#&'#&/,$;E/#$+&)(&'#(%'#($'#(#'#("'#&'#`),h(";t.# &;w"),h(`%3į""5%7İ/5#;</,$;Ç/#$+#)(#'#("'#&'#`),h("%;I/' 8!:ı!! )"),h(`%3IJ""5&7ij/:#;</1$;I/($8#:Ĵ#! )(#'#("'#&'#`),h(`%3ĵ""5%7Ķ/]#;</T$%3ķ""5$7ĸ/& 8!:Ĺ! ).4 &%3ĺ""5%7Ļ/& 8!:ļ! )/#$+#)(#'#("'#&'#`),h(`%3Ľ""5)7ľ/R#;</I$3Ŀ""5#7ŀ./ &3Ł""5(7ł.# &;6/($8#:Ń#! )(#'#("'#&'#`),h(`%3ń""5#7Ņ/#;</$;D/$%;Ì/e#$%2D""6D7E/,#;Ì/#$+")("'#&'#0<*%2D""6D7E/,#;Ì/#$+")("'#&'#&/#$+")("'#&'#/,$;E/#$+%)(%'#($'#(#'#("'#&'#`),h(`%3ņ""5(7Ň./ &3ň""5$7ʼn.# &;6/' 8!:Ŋ!! )`),h(`%;6/Y#$%;A/,#;6/#$+")("'#&'#06*%;A/,#;6/#$+")("'#&'#&/#$+")("'#&'#`),h(`%;Ï/G#;./>$;Ï/5$;./,$;/#$+%)(%'#($'#(#'#("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:ŋ!! )"),h(`%;Ñ/]#$%;A/,#;Ñ/#$+")("'#&'#06*%;A/,#;Ñ/#$+")("'#&'#&/'$8":Ō" )("'#&'#`),h(`%;/]#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/'$8":ō" )("'#&'#`),h(`%;L.O &;.I &%;@." &"/:#;t/1$;?." &"/#$+#)(#'#("'#&'#/]#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/'$8":Ŏ" )("'#&'#`),h(`%;Ô/]#$%;B/,#;Õ/#$+")("'#&'#06*%;B/,#;Õ/#$+")("'#&'#&/'$8":ŏ" )("'#&'#`),h("%;/& 8!:Ő! )"),h(`%3ő""5(7Œ/:#;</1$;6/($8#:œ#! )(#'#("'#&'#.g &%3Ŕ""5&7ŕ/:#;</1$;6/($8#:Ŗ#! )(#'#("'#&'#.: &%3ŗ""5*7Ř/& 8!:ř! ).# &; `),h(`%%;6/k#$%;A/2#;6/)$8":Ś""$ )("'#&'#0<*%;A/2#;6/)$8":Ś""$ )("'#&'#&/)$8":ś""! )("'#&'#." &"/' 8!:Ŝ!! )`),h(`%;Ø/Y#$%;A/,#;Ø/#$+")("'#&'#06*%;A/,#;Ø/#$+")("'#&'#&/#$+")("'#&'#`),h(`%;/Y#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/#$+")("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:ŝ!! )"),h(`%;Û/Y#$%;B/,#;Ü/#$+")("'#&'#06*%;B/,#;Ü/#$+")("'#&'#&/#$+")("'#&'#`),h(`%3Ş""5&7ş.; &3Š""5'7š./ &3Ţ""5*7ţ.# &;6/& 8!:Ť! )`),h(`%3ť""5&7Ŧ/:#;</1$;Ý/($8#:ŧ#! )(#'#("'#&'#.} &%3õ""5'7ö/:#;</1$;/($8#:Ũ#! )(#'#("'#&'#.P &%3ũ""5+7Ū/:#;</1$;/($8#:ū#! )(#'#("'#&'#.# &; `),h(`3Ŭ""5+7ŭ.k &3Ů""5)7ů._ &3Ű""5(7ű.S &3Ų""5'7ų.G &3Ŵ""5&7ŵ.; &3Ŷ""5*7ŷ./ &3Ÿ""5)7Ź.# &;6`),h(';1." &"'),h(`%%;6/k#$%;A/2#;6/)$8":Ś""$ )("'#&'#0<*%;A/2#;6/)$8":Ś""$ )("'#&'#&/)$8":ś""! )("'#&'#." &"/' 8!:ź!! )`),h(`%;L.# &;/]#$%;B/,#;á/#$+")("'#&'#06*%;B/,#;á/#$+")("'#&'#&/'$8":Ż" )("'#&'#`),h(";¹.# &; "),h(`%;ã/Y#$%;A/,#;ã/#$+")("'#&'#06*%;A/,#;ã/#$+")("'#&'#&/#$+")("'#&'#`),h(`%;ê/k#;./b$;í/Y$$%;B/,#;ä/#$+")("'#&'#06*%;B/,#;ä/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),h(";å.; &;æ.5 &;ç./ &;è.) &;é.# &; "),h(`%3ż""5#7Ž/:#;</1$;ð/($8#:ž#! )(#'#("'#&'#`),h(`%3ſ""5%7ƀ/:#;</1$;T/($8#:Ɓ#! )(#'#("'#&'#`),h(`%3Ƃ""5(7ƃ/F#;</=$;\\.) &;Y.# &;X/($8#:Ƅ#! )(#'#("'#&'#`),h(`%3ƅ""5&7Ɔ/:#;</1$;6/($8#:Ƈ#! )(#'#("'#&'#`),h(`%3ƈ""5%7Ɖ/A#;</8$$;!0#*;!&/($8#:Ɗ#! )(#'#("'#&'#`),h(`%;ë/G#;;/>$;6/5$;;/,$;ì/#$+%)(%'#($'#(#'#("'#&'#`),h(`%3""5#7Ó.# &;6/' 8!:Ƌ!! )`),h(`%3±""5#7ƌ.G &3³""5#7ƍ.; &3·""5#7Ǝ./ &3µ""5$7Ə.# &;6/' 8!:Ɛ!! )`),h(`%;î/D#%;C/,#;ï/#$+")("'#&'#." &"/#$+")("'#&'#`),h("%;U.) &;\\.# &;X/& 8!:Ƒ! )"),h(`%%;!." &"/[#;!." &"/M$;!." &"/?$;!." &"/1$;!." &"/#$+%)(%'#($'#(#'#("'#&'#/' 8!:ƒ!! )`),h(`%%;!/?#;!." &"/1$;!." &"/#$+#)(#'#("'#&'#/' 8!:Ɠ!! )`),h(";¾"),h(`%;/^#$%;B/,#;ó/#$+")("'#&'#06*%;B/,#;ó/#$+")("'#&'#&/($8":Ɣ"!!)("'#&'#`),h(";ô.# &; "),h(`%2ƕ""6ƕ7Ɩ/L#;</C$2Ɨ""6Ɨ7Ƙ.) &2ƙ""6ƙ7ƚ/($8#:ƛ#! )(#'#("'#&'#`),h(`%;/^#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/($8":Ɯ"!!)("'#&'#`),h(`%;6/5#;0/,$;÷/#$+#)(#'#("'#&'#`),h("$;2.) &;4.# &;.0/*;2.) &;4.# &;.&"),h("$;%0#*;%&"),h(`%;ú/;#28""6879/,$;û/#$+#)(#'#("'#&'#`),h(`%3Ɲ""5%7ƞ.) &3Ɵ""5$7Ơ/' 8!:ơ!! )`),h(`%;ü/J#%28""6879/,#;^/#$+")("'#&'#." &"/#$+")("'#&'#`),h("%;\\.) &;X.# &;/' 8!:Ƣ!! )"),h(';".S &;!.M &2F""6F7G.A &2J""6J7K.5 &2H""6H7I.) &2N""6N7O'),h('2L""6L7M. &2B""6B7C. &2<""6<7=.} &2R""6R7S.q &2T""6T7U.e &2V""6V7W.Y &2P""6P7Q.M &2@""6@7A.A &2D""6D7E.5 &22""6273.) &2>""6>7?'),h(`%;Ā/b#28""6879/S$;û/J$%2ƣ""6ƣ7Ƥ/,#;ì/#$+")("'#&'#." &"/#$+$)($'#(#'#("'#&'#`),h(`%3ƥ""5%7Ʀ.) &3Ƨ""5$7ƨ/' 8!:ơ!! )`),h(`%3±""5#7².6 &3³""5#7´.* &$;+0#*;+&/' 8!:Ʃ!! )`),h(`%;Ą/#2F""6F7G/x$;ă/o$2F""6F7G/\`$;ă/W$2F""6F7G/H$;ă/?$2F""6F7G/0$;ą/'$8):ƪ) )()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#`),h(`%;#/>#;#/5$;#/,$;#/#$+$)($'#(#'#("'#&'#`),h(`%;ă/,#;ă/#$+")("'#&'#`),h(`%;ă/5#;ă/,$;ă/#$+#)(#'#("'#&'#`),h(`%;q/T#$;m0#*;m&/D$%; /,#;ø/#$+")("'#&'#." &"/#$+#)(#'#("'#&'#`),h(`%2ƫ""6ƫ7Ƭ.) &2ƭ""6ƭ7Ʈ/w#;0/n$;Ĉ/e$$%;B/2#;ĉ.# &; /#$+")("'#&'#0<*%;B/2#;ĉ.# &; /#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),h(";.# &;L"),h(`%2Ư""6Ư7ư/5#;</,$;Ċ/#$+#)(#'#("'#&'#`),h(`%;D/S#;,/J$2:""6:7;/;$;,.# &;T/,$;E/#$+%)(%'#($'#(#'#("'#&'#`)];let l=0,c=0;const d=[{line:1,column:1}];let g=0,u=[],E=0,y;if(e.startRule!==void 0){if(!(e.startRule in i))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');n=i[e.startRule]}function v(){return s.substring(c,l)}function _(){return S(c,l)}function x(f,C){return{type:"literal",text:f,ignoreCase:C}}function p(f,C,m){return{type:"class",parts:f,inverted:C,ignoreCase:m}}function w(){return{type:"end"}}function D(f){let C=d[f],m;if(C)return C;for(m=f-1;!d[m];)m--;for(C=d[m],C={line:C.line,column:C.column};m<f;)s.charCodeAt(m)===10?(C.line++,C.column=1):C.column++,m++;return d[f]=C,C}function S(f,C){const m=D(f),q=D(C);return{source:r,start:{offset:f,line:m.line,column:m.column},end:{offset:C,line:q.line,column:q.column}}}function T(f){l<g||(l>g&&(g=l,u=[]),u.push(f))}function F(f,C,m){return new fr(fr.buildMessage(f,C),f,C,m)}function h(f){return f.split("").map(C=>C.charCodeAt(0)-32)}function M(f){const C=o[f];let m=0;const q=[];let N=C.length;const z=[],G=[];let ie;for(;;){for(;m<N;)switch(C[m]){case 0:G.push(a[C[m+1]]),m+=2;break;case 1:G.push(void 0),m++;break;case 2:G.push(null),m++;break;case 3:G.push(t),m++;break;case 4:G.push([]),m++;break;case 5:G.push(l),m++;break;case 6:G.pop(),m++;break;case 7:l=G.pop(),m++;break;case 8:G.length-=C[m+1],m+=2;break;case 9:G.splice(-2,1),m++;break;case 10:G[G.length-2].push(G.pop()),m++;break;case 11:G.push(G.splice(G.length-C[m+1],C[m+1])),m+=2;break;case 12:G.push(s.substring(G.pop(),l)),m++;break;case 13:z.push(N),q.push(m+3+C[m+1]+C[m+2]),G[G.length-1]?(N=m+3+C[m+1],m+=3):(N=m+3+C[m+1]+C[m+2],m+=3+C[m+1]);break;case 14:z.push(N),q.push(m+3+C[m+1]+C[m+2]),G[G.length-1]===t?(N=m+3+C[m+1],m+=3):(N=m+3+C[m+1]+C[m+2],m+=3+C[m+1]);break;case 15:z.push(N),q.push(m+3+C[m+1]+C[m+2]),G[G.length-1]!==t?(N=m+3+C[m+1],m+=3):(N=m+3+C[m+1]+C[m+2],m+=3+C[m+1]);break;case 16:G[G.length-1]!==t?(z.push(N),q.push(m),N=m+2+C[m+1],m+=2):m+=2+C[m+1];break;case 17:z.push(N),q.push(m+3+C[m+1]+C[m+2]),s.length>l?(N=m+3+C[m+1],m+=3):(N=m+3+C[m+1]+C[m+2],m+=3+C[m+1]);break;case 18:z.push(N),q.push(m+4+C[m+2]+C[m+3]),s.substr(l,a[C[m+1]].length)===a[C[m+1]]?(N=m+4+C[m+2],m+=4):(N=m+4+C[m+2]+C[m+3],m+=4+C[m+2]);break;case 19:z.push(N),q.push(m+4+C[m+2]+C[m+3]),s.substr(l,a[C[m+1]].length).toLowerCase()===a[C[m+1]]?(N=m+4+C[m+2],m+=4):(N=m+4+C[m+2]+C[m+3],m+=4+C[m+2]);break;case 20:z.push(N),q.push(m+4+C[m+2]+C[m+3]),a[C[m+1]].test(s.charAt(l))?(N=m+4+C[m+2],m+=4):(N=m+4+C[m+2]+C[m+3],m+=4+C[m+2]);break;case 21:G.push(s.substr(l,C[m+1])),l+=C[m+1],m+=2;break;case 22:G.push(a[C[m+1]]),l+=a[C[m+1]].length,m+=2;break;case 23:G.push(t),E===0&&T(a[C[m+1]]),m+=2;break;case 24:c=G[G.length-1-C[m+1]],m+=2;break;case 25:c=l,m++;break;case 26:ie=C.slice(m+4,m+4+C[m+3]).map(function(he){return G[G.length-1-he]}),G.splice(G.length-C[m+2],C[m+2],a[C[m+1]].apply(null,ie)),m+=4+C[m+3];break;case 27:G.push(M(C[m+1])),m+=2;break;case 28:E++,m++;break;case 29:E--,m++;break;default:throw new Error("Invalid opcode: "+C[m]+".")}if(z.length>0)N=z.pop(),m=q.pop();else break}return G[0]}e.data={};function A(f,C){return[f].concat(C)}if(y=M(n),y!==t&&l===s.length)return y;throw y!==t&&l<s.length&&T(w()),F(u,g<s.length?s.charAt(g):null,g<s.length?S(g,g+1):S(g,g))}const Ho=$o;var Te;(function(s){function e(i,n){const a={startRule:n};try{Ho(i,a)}catch{a.data=-1}return a.data}s.parse=e;function t(i){const n=s.parse(i,"Name_Addr_Header");return n!==-1?n:void 0}s.nameAddrHeaderParse=t;function r(i){const n=s.parse(i,"SIP_URI");return n!==-1?n:void 0}s.URIParse=r})(Te=Te||(Te={}));const Po={100:"Trying",180:"Ringing",181:"Call Is Being Forwarded",182:"Queued",183:"Session Progress",199:"Early Dialog Terminated",200:"OK",202:"Accepted",204:"No Notification",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",305:"Use Proxy",380:"Alternative Service",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",410:"Gone",412:"Conditional Request Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Unsupported URI Scheme",417:"Unknown Resource-Priority",420:"Bad Extension",421:"Extension Required",422:"Session Interval Too Small",423:"Interval Too Brief",428:"Use Identity Header",429:"Provide Referrer Identity",430:"Flow Failed",433:"Anonymity Disallowed",436:"Bad Identity-Info",437:"Unsupported Certificate",438:"Invalid Identity Header",439:"First Hop Lacks Outbound Support",440:"Max-Breadth Exceeded",469:"Bad Info Package",470:"Consent Needed",478:"Unresolvable Destination",480:"Temporarily Unavailable",481:"Call/Transaction Does Not Exist",482:"Loop Detected",483:"Too Many Hops",484:"Address Incomplete",485:"Ambiguous",486:"Busy Here",487:"Request Terminated",488:"Not Acceptable Here",489:"Bad Event",491:"Request Pending",493:"Undecipherable",494:"Security Agreement Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Server Time-out",505:"Version Not Supported",513:"Message Too Large",580:"Precondition Failure",600:"Busy Everywhere",603:"Decline",604:"Does Not Exist Anywhere",606:"Not Acceptable"};function Qt(s,e=32){let t="";for(let r=0;r<s;r++){const i=Math.floor(Math.random()*e);t+=i.toString(e)}return t}function es(s){return Po[s]||""}function ts(){return Qt(10)}function ht(s){const e={"Call-Id":"Call-ID",Cseq:"CSeq","Min-Se":"Min-SE",Rack:"RAck",Rseq:"RSeq","Www-Authenticate":"WWW-Authenticate"},t=s.toLowerCase().replace(/_/g,"-").split("-"),r=t.length;let i="";for(let n=0;n<r;n++)n!==0&&(i+="-"),i+=t[n].charAt(0).toUpperCase()+t[n].substring(1);return e[i]&&(i=e[i]),i}function $r(s){return encodeURIComponent(s).replace(/%[A-F\d]{2}/g,"U").length}class Dn{constructor(){this.headers={}}addHeader(e,t){const r={raw:t};e=ht(e),this.headers[e]?this.headers[e].push(r):this.headers[e]=[r]}getHeader(e){const t=this.headers[ht(e)];if(t){if(t[0])return t[0].raw}else return}getHeaders(e){const t=this.headers[ht(e)],r=[];if(!t)return[];for(const i of t)r.push(i.raw);return r}hasHeader(e){return!!this.headers[ht(e)]}parseHeader(e,t=0){if(e=ht(e),this.headers[e]){if(t>=this.headers[e].length)return}else return;const r=this.headers[e][t],i=r.raw;if(r.parsed)return r.parsed;const n=Te.parse(i,e.replace(/-/g,"_"));if(n===-1){this.headers[e].splice(t,1);return}else return r.parsed=n,n}s(e,t=0){return this.parseHeader(e,t)}setHeader(e,t){this.headers[ht(e)]=[{raw:t}]}toString(){return this.data}}class gr extends Dn{constructor(){super()}}class Pt extends Dn{constructor(){super()}}class er{constructor(e,t,r,i,n,a,o){this.headers={},this.extraHeaders=[],this.options=er.getDefaultOptions(),n&&(this.options=Object.assign(Object.assign({},this.options),n),this.options.optionTags&&this.options.optionTags.length&&(this.options.optionTags=this.options.optionTags.slice()),this.options.routeSet&&this.options.routeSet.length&&(this.options.routeSet=this.options.routeSet.slice())),a&&a.length&&(this.extraHeaders=a.slice()),o&&(this.body={body:o.content,contentType:o.contentType}),this.method=e,this.ruri=t.clone(),this.fromURI=r.clone(),this.fromTag=this.options.fromTag?this.options.fromTag:ts(),this.from=er.makeNameAddrHeader(this.fromURI,this.options.fromDisplayName,this.fromTag),this.toURI=i.clone(),this.toTag=this.options.toTag,this.to=er.makeNameAddrHeader(this.toURI,this.options.toDisplayName,this.toTag),this.callId=this.options.callId?this.options.callId:this.options.callIdPrefix+Qt(15),this.cseq=this.options.cseq,this.setHeader("route",this.options.routeSet),this.setHeader("via",""),this.setHeader("to",this.to.toString()),this.setHeader("from",this.from.toString()),this.setHeader("cseq",this.cseq+" "+this.method),this.setHeader("call-id",this.callId),this.setHeader("max-forwards","70")}static getDefaultOptions(){return{callId:"",callIdPrefix:"",cseq:1,toDisplayName:"",toTag:"",fromDisplayName:"",fromTag:"",forceRport:!1,hackViaTcp:!1,optionTags:["outbound"],routeSet:[],userAgentString:"sip.js",viaHost:""}}static makeNameAddrHeader(e,t,r){const i={};return r&&(i.tag=r),new Le(e,t,i)}getHeader(e){const t=this.headers[ht(e)];if(t){if(t[0])return t[0]}else{const r=new RegExp("^\\s*"+e+"\\s*:","i");for(const i of this.extraHeaders)if(r.test(i))return i.substring(i.indexOf(":")+1).trim()}}getHeaders(e){const t=[],r=this.headers[ht(e)];if(r)for(const i of r)t.push(i);else{const i=new RegExp("^\\s*"+e+"\\s*:","i");for(const n of this.extraHeaders)i.test(n)&&t.push(n.substring(n.indexOf(":")+1).trim())}return t}hasHeader(e){if(this.headers[ht(e)])return!0;{const t=new RegExp("^\\s*"+e+"\\s*:","i");for(const r of this.extraHeaders)if(t.test(r))return!0}return!1}setHeader(e,t){this.headers[ht(e)]=t instanceof Array?t:[t]}setViaHeader(e,t){this.options.hackViaTcp&&(t="TCP");let r="SIP/2.0/"+t;r+=" "+this.options.viaHost+";branch="+e,this.options.forceRport&&(r+=";rport"),this.setHeader("via",r),this.branch=e}toString(){let e="";e+=this.method+" "+this.ruri.toRaw()+` SIP/2.0\r
|
|
38
|
+
`,!1),/^[0-9]/,p([["0","9"]],!1,!1),/^[a-zA-Z]/,p([["a","z"],["A","Z"]],!1,!1),/^[0-9a-fA-F]/,p([["0","9"],["a","f"],["A","F"]],!1,!1),/^[\0-\xFF]/,p([["\0","ÿ"]],!1,!1),/^["]/,p(['"'],!1,!1)," ",x(" ",!1)," ",x(" ",!1),/^[a-zA-Z0-9]/,p([["a","z"],["A","Z"],["0","9"]],!1,!1),";",x(";",!1),"/",x("/",!1),"?",x("?",!1),":",x(":",!1),"@",x("@",!1),"&",x("&",!1),"=",x("=",!1),"+",x("+",!1),"$",x("$",!1),",",x(",",!1),"-",x("-",!1),"_",x("_",!1),".",x(".",!1),"!",x("!",!1),"~",x("~",!1),"*",x("*",!1),"'",x("'",!1),"(",x("(",!1),")",x(")",!1),"%",x("%",!1),function(){return" "},function(){return":"},/^[!-~]/,p([["!","~"]],!1,!1),/^[\x80-\uFFFF]/,p([["",""]],!1,!1),/^[\x80-\xBF]/,p([["","¿"]],!1,!1),/^[a-f]/,p([["a","f"]],!1,!1),"`",x("`",!1),"<",x("<",!1),">",x(">",!1),"\\",x("\\",!1),"[",x("[",!1),"]",x("]",!1),"{",x("{",!1),"}",x("}",!1),function(){return"*"},function(){return"/"},function(){return"="},function(){return"("},function(){return")"},function(){return">"},function(){return"<"},function(){return","},function(){return";"},function(){return":"},function(){return'"'},/^[!-']/,p([["!","'"]],!1,!1),/^[*-[]/,p([["*","["]],!1,!1),/^[\]-~]/,p([["]","~"]],!1,!1),function(f){return f},/^[#-[]/,p([["#","["]],!1,!1),/^[\0-\t]/,p([["\0"," "]],!1,!1),/^[\v-\f]/,p([["\v","\f"]],!1,!1),/^[\x0E-\x7F]/,p([["",""]],!1,!1),function(){e=e||{data:{}},e.data.uri=new lt(e.data.scheme,e.data.user,e.data.host,e.data.port),delete e.data.scheme,delete e.data.user,delete e.data.host,delete e.data.host_type,delete e.data.port},function(){e=e||{data:{}},e.data.uri=new lt(e.data.scheme,e.data.user,e.data.host,e.data.port,e.data.uri_params,e.data.uri_headers),delete e.data.scheme,delete e.data.user,delete e.data.host,delete e.data.host_type,delete e.data.port,delete e.data.uri_params,e.startRule==="SIP_URI"&&(e.data=e.data.uri)},"sips",x("sips",!0),"sip",x("sip",!0),function(f){e=e||{data:{}},e.data.scheme=f},function(){e=e||{data:{}},e.data.user=decodeURIComponent(v().slice(0,-1))},function(){e=e||{data:{}},e.data.password=v()},function(){return e=e||{data:{}},e.data.host=v(),e.data.host},function(){return e=e||{data:{}},e.data.host_type="domain",v()},/^[a-zA-Z0-9_\-]/,p([["a","z"],["A","Z"],["0","9"],"_","-"],!1,!1),/^[a-zA-Z0-9\-]/,p([["a","z"],["A","Z"],["0","9"],"-"],!1,!1),function(){return e=e||{data:{}},e.data.host_type="IPv6",v()},"::",x("::",!1),function(){return e=e||{data:{}},e.data.host_type="IPv6",v()},function(){return e=e||{data:{}},e.data.host_type="IPv4",v()},"25",x("25",!1),/^[0-5]/,p([["0","5"]],!1,!1),"2",x("2",!1),/^[0-4]/,p([["0","4"]],!1,!1),"1",x("1",!1),/^[1-9]/,p([["1","9"]],!1,!1),function(f){return e=e||{data:{}},f=parseInt(f.join("")),e.data.port=f,f},"transport=",x("transport=",!0),"udp",x("udp",!0),"tcp",x("tcp",!0),"sctp",x("sctp",!0),"tls",x("tls",!0),function(f){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.transport=f.toLowerCase()},"user=",x("user=",!0),"phone",x("phone",!0),"ip",x("ip",!0),function(f){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.user=f.toLowerCase()},"method=",x("method=",!0),function(f){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.method=f},"ttl=",x("ttl=",!0),function(f){e=e||{data:{}},e.data.params||(e.data.params={}),e.data.params.ttl=f},"maddr=",x("maddr=",!0),function(f){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.maddr=f},"lr",x("lr",!0),function(){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),e.data.uri_params.lr=void 0},function(f,C){e=e||{data:{}},e.data.uri_params||(e.data.uri_params={}),C===null?C=void 0:C=C[1],e.data.uri_params[f.toLowerCase()]=C},function(f,C){f=f.join("").toLowerCase(),C=C.join(""),e=e||{data:{}},e.data.uri_headers||(e.data.uri_headers={}),e.data.uri_headers[f]?e.data.uri_headers[f].push(C):e.data.uri_headers[f]=[C]},function(){e=e||{data:{}},e.startRule==="Refer_To"&&(e.data.uri=new lt(e.data.scheme,e.data.user,e.data.host,e.data.port,e.data.uri_params,e.data.uri_headers),delete e.data.scheme,delete e.data.user,delete e.data.host,delete e.data.host_type,delete e.data.port,delete e.data.uri_params)},"//",x("//",!1),function(){e=e||{data:{}},e.data.scheme=v()},x("SIP",!0),function(){e=e||{data:{}},e.data.sip_version=v()},"INVITE",x("INVITE",!1),"ACK",x("ACK",!1),"VXACH",x("VXACH",!1),"OPTIONS",x("OPTIONS",!1),"BYE",x("BYE",!1),"CANCEL",x("CANCEL",!1),"REGISTER",x("REGISTER",!1),"SUBSCRIBE",x("SUBSCRIBE",!1),"NOTIFY",x("NOTIFY",!1),"REFER",x("REFER",!1),"PUBLISH",x("PUBLISH",!1),function(){return e=e||{data:{}},e.data.method=v(),e.data.method},function(f){e=e||{data:{}},e.data.status_code=parseInt(f.join(""))},function(){e=e||{data:{}},e.data.reason_phrase=v()},function(){e=e||{data:{}},e.data=v()},function(){var f,C;for(e=e||{data:{}},C=e.data.multi_header.length,f=0;f<C;f++)if(e.data.multi_header[f].parsed===null){e.data=null;break}e.data!==null?e.data=e.data.multi_header:e.data=-1},function(){var f;e=e||{data:{}},e.data.multi_header||(e.data.multi_header=[]);try{f=new Le(e.data.uri,e.data.displayName,e.data.params),delete e.data.uri,delete e.data.displayName,delete e.data.params}catch{f=null}e.data.multi_header.push({position:l,offset:_().start.offset,parsed:f})},function(f){f=v().trim(),f[0]==='"'&&(f=f.substring(1,f.length-1)),e=e||{data:{}},e.data.displayName=f},"q",x("q",!0),function(f){e=e||{data:{}},e.data.params||(e.data.params={}),e.data.params.q=f},"expires",x("expires",!0),function(f){e=e||{data:{}},e.data.params||(e.data.params={}),e.data.params.expires=f},function(f){return parseInt(f.join(""))},"0",x("0",!1),function(){return parseFloat(v())},function(f,C){e=e||{data:{}},e.data.params||(e.data.params={}),C===null?C=void 0:C=C[1],e.data.params[f.toLowerCase()]=C},"render",x("render",!0),"session",x("session",!0),"icon",x("icon",!0),"alert",x("alert",!0),function(){e=e||{data:{}},e.startRule==="Content_Disposition"&&(e.data.type=v().toLowerCase())},"handling",x("handling",!0),"optional",x("optional",!0),"required",x("required",!0),function(f){e=e||{data:{}},e.data=parseInt(f.join(""))},function(){e=e||{data:{}},e.data=v()},"text",x("text",!0),"image",x("image",!0),"audio",x("audio",!0),"video",x("video",!0),"application",x("application",!0),"message",x("message",!0),"multipart",x("multipart",!0),"x-",x("x-",!0),function(f){e=e||{data:{}},e.data.value=parseInt(f.join(""))},function(f){e=e||{data:{}},e.data=f},function(f){e=e||{data:{}},e.data.event=f.toLowerCase()},function(){e=e||{data:{}};var f=e.data.tag;e.data=new Le(e.data.uri,e.data.displayName,e.data.params),f&&e.data.setParam("tag",f)},"tag",x("tag",!0),function(f){e=e||{data:{}},e.data.tag=f},function(f){e=e||{data:{}},e.data=parseInt(f.join(""))},function(f){e=e||{data:{}},e.data=f},function(){e=e||{data:{}},e.data=new Le(e.data.uri,e.data.displayName,e.data.params)},"digest",x("Digest",!0),"realm",x("realm",!0),function(f){e=e||{data:{}},e.data.realm=f},"domain",x("domain",!0),"nonce",x("nonce",!0),function(f){e=e||{data:{}},e.data.nonce=f},"opaque",x("opaque",!0),function(f){e=e||{data:{}},e.data.opaque=f},"stale",x("stale",!0),"true",x("true",!0),function(){e=e||{data:{}},e.data.stale=!0},"false",x("false",!0),function(){e=e||{data:{}},e.data.stale=!1},"algorithm",x("algorithm",!0),"md5",x("MD5",!0),"md5-sess",x("MD5-sess",!0),function(f){e=e||{data:{}},e.data.algorithm=f.toUpperCase()},"qop",x("qop",!0),"auth-int",x("auth-int",!0),"auth",x("auth",!0),function(f){e=e||{data:{}},e.data.qop||(e.data.qop=[]),e.data.qop.push(f.toLowerCase())},function(f){e=e||{data:{}},e.data.value=parseInt(f.join(""))},function(){var f,C;for(e=e||{data:{}},C=e.data.multi_header.length,f=0;f<C;f++)if(e.data.multi_header[f].parsed===null){e.data=null;break}e.data!==null?e.data=e.data.multi_header:e.data=-1},function(){var f;e=e||{data:{}},e.data.multi_header||(e.data.multi_header=[]);try{f=new Le(e.data.uri,e.data.displayName,e.data.params),delete e.data.uri,delete e.data.displayName,delete e.data.params}catch{f=null}e.data.multi_header.push({position:l,offset:_().start.offset,parsed:f})},function(){e=e||{data:{}},e.data=new Le(e.data.uri,e.data.displayName,e.data.params)},function(){e=e||{data:{}},e.data.replaces_from_tag&&e.data.replaces_to_tag||(e.data=-1)},function(){e=e||{data:{}},e.data={call_id:e.data}},"from-tag",x("from-tag",!0),function(f){e=e||{data:{}},e.data.replaces_from_tag=f},"to-tag",x("to-tag",!0),function(f){e=e||{data:{}},e.data.replaces_to_tag=f},"early-only",x("early-only",!0),function(){e=e||{data:{}},e.data.early_only=!0},function(f,C){return C},function(f,C){return A(f,C)},function(f){e=e||{data:{}},e.startRule==="Require"&&(e.data=f||[])},function(f){e=e||{data:{}},e.data.value=parseInt(f.join(""))},"active",x("active",!0),"pending",x("pending",!0),"terminated",x("terminated",!0),function(){e=e||{data:{}},e.data.state=v()},"reason",x("reason",!0),function(f){e=e||{data:{}},typeof f<"u"&&(e.data.reason=f)},function(f){e=e||{data:{}},typeof f<"u"&&(e.data.expires=f)},"retry_after",x("retry_after",!0),function(f){e=e||{data:{}},typeof f<"u"&&(e.data.retry_after=f)},"deactivated",x("deactivated",!0),"probation",x("probation",!0),"rejected",x("rejected",!0),"timeout",x("timeout",!0),"giveup",x("giveup",!0),"noresource",x("noresource",!0),"invariant",x("invariant",!0),function(f){e=e||{data:{}},e.startRule==="Supported"&&(e.data=f||[])},function(){e=e||{data:{}};var f=e.data.tag;e.data=new Le(e.data.uri,e.data.displayName,e.data.params),f&&e.data.setParam("tag",f)},"ttl",x("ttl",!0),function(f){e=e||{data:{}},e.data.ttl=f},"maddr",x("maddr",!0),function(f){e=e||{data:{}},e.data.maddr=f},"received",x("received",!0),function(f){e=e||{data:{}},e.data.received=f},"branch",x("branch",!0),function(f){e=e||{data:{}},e.data.branch=f},"rport",x("rport",!0),function(f){e=e||{data:{}},typeof f<"u"&&(e.data.rport=f.join(""))},function(f){e=e||{data:{}},e.data.protocol=f},x("UDP",!0),x("TCP",!0),x("TLS",!0),x("SCTP",!0),function(f){e=e||{data:{}},e.data.transport=f},function(){e=e||{data:{}},e.data.host=v()},function(f){e=e||{data:{}},e.data.port=parseInt(f.join(""))},function(f){return parseInt(f.join(""))},function(f){e=e||{data:{}},e.startRule==="Session_Expires"&&(e.data.deltaSeconds=f)},"refresher",x("refresher",!1),"uas",x("uas",!1),"uac",x("uac",!1),function(f){e=e||{data:{}},e.startRule==="Session_Expires"&&(e.data.refresher=f)},function(f){e=e||{data:{}},e.startRule==="Min_SE"&&(e.data=f)},"stuns",x("stuns",!0),"stun",x("stun",!0),function(f){e=e||{data:{}},e.data.scheme=f},function(f){e=e||{data:{}},e.data.host=f},"?transport=",x("?transport=",!1),"turns",x("turns",!0),"turn",x("turn",!0),function(f){e=e||{data:{}},e.data.transport=f},function(){e=e||{data:{}},e.data=v()},"Referred-By",x("Referred-By",!1),"b",x("b",!1),"cid",x("cid",!1)],o=[h('2 ""6 7!'),h('4"""5!7#'),h('4$""5!7%'),h(`4&""5!7'`),h(";'.# &;("),h('4(""5!7)'),h('4*""5!7+'),h('2,""6,7-'),h('2.""6.7/'),h('40""5!71'),h('22""6273. &24""6475.} &26""6677.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),h(";).# &;,"),h('2F""6F7G.} &2H""6H7I.q &2J""6J7K.e &2L""6L7M.Y &2N""6N7O.M &2P""6P7Q.A &2R""6R7S.5 &2T""6T7U.) &2V""6V7W'),h(`%%2X""6X7Y/5#;#/,$;#/#$+#)(#'#("'#&'#/"!&,)`),h(`%%$;$0#*;$&/,#; /#$+")("'#&'#." &"/=#$;$/�#*;$&&&#/'$8":Z" )("'#&'#`),h(';.." &"'),h(`%$;'.# &;(0)*;'.# &;(&/?#28""6879/0$;//'$8#:[# )(#'#("'#&'#`),h(`%%$;2/�#*;2&&&#/g#$%$;.0#*;.&/,#;2/#$+")("'#&'#0=*%$;.0#*;.&/,#;2/#$+")("'#&'#&/#$+")("'#&'#/"!&,)`),h('4\\""5!7].# &;3'),h('4^""5!7_'),h('4`""5!7a'),h(';!.) &4b""5!7c'),h('%$;). &2F""6F7G. &2J""6J7K.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O/#0*;). &2F""6F7G. &2J""6J7K.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O&&&#/"!&,)'),h('%$;). &2F""6F7G.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O/#0*;). &2F""6F7G.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O&&&#/"!&,)'),h(`2T""6T7U.ã &2V""6V7W.× &2f""6f7g.Ë &2h""6h7i.¿ &2:""6:7;.³ &2D""6D7E.§ &22""6273. &28""6879. &2j""6j7k. &;&.} &24""6475.q &2l""6l7m.e &2n""6n7o.Y &26""6677.M &2>""6>7?.A &2p""6p7q.5 &2r""6r7s.) &;'.# &;(`),h('%$;).ī &2F""6F7G.ğ &2J""6J7K.ē &2L""6L7M.ć &2X""6X7Y.û &2P""6P7Q.ï &2H""6H7I.ã &2@""6@7A.× &2d""6d7e.Ë &2R""6R7S.¿ &2N""6N7O.³ &2T""6T7U.§ &2V""6V7W. &2f""6f7g. &2h""6h7i. &28""6879.w &2j""6j7k.k &;&.e &24""6475.Y &2l""6l7m.M &2n""6n7o.A &26""6677.5 &2p""6p7q.) &2r""6r7s/Ĵ#0ı*;).ī &2F""6F7G.ğ &2J""6J7K.ē &2L""6L7M.ć &2X""6X7Y.û &2P""6P7Q.ï &2H""6H7I.ã &2@""6@7A.× &2d""6d7e.Ë &2R""6R7S.¿ &2N""6N7O.³ &2T""6T7U.§ &2V""6V7W. &2f""6f7g. &2h""6h7i. &28""6879.w &2j""6j7k.k &;&.e &24""6475.Y &2l""6l7m.M &2n""6n7o.A &26""6677.5 &2p""6p7q.) &2r""6r7s&&&#/"!&,)'),h(`%;//?#2P""6P7Q/0$;//'$8#:t# )(#'#("'#&'#`),h(`%;//?#24""6475/0$;//'$8#:u# )(#'#("'#&'#`),h(`%;//?#2>""6>7?/0$;//'$8#:v# )(#'#("'#&'#`),h(`%;//?#2T""6T7U/0$;//'$8#:w# )(#'#("'#&'#`),h(`%;//?#2V""6V7W/0$;//'$8#:x# )(#'#("'#&'#`),h(`%2h""6h7i/0#;//'$8":y" )("'#&'#`),h(`%;//6#2f""6f7g/'$8":z" )("'#&'#`),h(`%;//?#2D""6D7E/0$;//'$8#:{# )(#'#("'#&'#`),h(`%;//?#22""6273/0$;//'$8#:|# )(#'#("'#&'#`),h(`%;//?#28""6879/0$;//'$8#:}# )(#'#("'#&'#`),h(`%;//0#;&/'$8":~" )("'#&'#`),h(`%;&/0#;//'$8":~" )("'#&'#`),h(`%;=/T#$;G.) &;K.# &;F0/*;G.) &;K.# &;F&/,$;>/#$+#)(#'#("'#&'#`),h('4""5!7.A &4""5!7.5 &4""5!7.) &;3.# &;.'),h(`%%;//Q#;&/H$$;J.# &;K0)*;J.# &;K&/,$;&/#$+$)($'#(#'#("'#&'#/"!&,)`),h(`%;//]#;&/T$%$;J.# &;K0)*;J.# &;K&/"!&,)/1$;&/($8$:
$!!)($'#(#'#("'#&'#`),h(';..G &2L""6L7M.; &4""5!7./ &4""5!7.# &;3'),h(`%2j""6j7k/J#4""5!7.5 &4""5!7.) &4""5!7/#$+")("'#&'#`),h(`%;N/M#28""6879/>$;O." &"/0$;S/'$8$:$ )($'#(#'#("'#&'#`),h(`%;N/d#28""6879/U$;O." &"/G$;S/>$;_/5$;l." &"/'$8&:& )(&'#(%'#($'#(#'#("'#&'#`),h(`%3""5$7.) &3""5#7/' 8!:!! )`),h(`%;P/]#%28""6879/,#;R/#$+")("'#&'#." &"/6$2:""6:7;/'$8#:# )(#'#("'#&'#`),h("$;+.) &;-.# &;Q/2#0/*;+.) &;-.# &;Q&&&#"),h('2<""6<7=.q &2>""6>7?.e &2@""6@7A.Y &2B""6B7C.M &2D""6D7E.A &22""6273.5 &26""6677.) &24""6475'),h('%$;+._ &;-.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E0e*;+._ &;-.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E&/& 8!:! )'),h(`%;T/J#%28""6879/,#;^/#$+")("'#&'#." &"/#$+")("'#&'#`),h("%;U.) &;\\.# &;X/& 8!:! )"),h(`%$%;V/2#2J""6J7K/#$+")("'#&'#0<*%;V/2#2J""6J7K/#$+")("'#&'#&/D#;W/;$2J""6J7K." &"/'$8#:# )(#'#("'#&'#`),h('$4""5!7/,#0)*4""5!7&&&#'),h(`%4$""5!7%/?#$4""5!70)*4""5!7&/#$+")("'#&'#`),h(`%2l""6l7m/?#;Y/6$2n""6n7o/'$8#:# )(#'#("'#&'#`),h(`%%;Z/³#28""6879/¤$;Z/$28""6879/$;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+-)(-'#(,'#(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.ސ &%2""67/¤#;Z/$28""6879/$;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+,)(,'#(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.۹ &%2""67/#;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+*)(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.ٺ &%2""67/t#;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.ؓ &%2""67/\\#;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+&)(&'#(%'#($'#(#'#("'#&'#.ׄ &%2""67/D#;Z/;$28""6879/,$;[/#$+$)($'#(#'#("'#&'#.֍ &%2""67/,#;[/#$+")("'#&'#.ծ &%2""67/,#;Z/#$+")("'#&'#.Տ &%;Z/#2""67/$;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$++)(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ӈ &%;Z/ª#%28""6879/,#;Z/#$+")("'#&'#." &"/$2""67/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+*)(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.а &%;Z/¹#%28""6879/,#;Z/#$+")("'#&'#." &"/$%28""6879/,#;Z/#$+")("'#&'#." &"/k$2""67/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+))()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ί &%;Z/È#%28""6879/,#;Z/#$+")("'#&'#." &"/¡$%28""6879/,#;Z/#$+")("'#&'#." &"/z$%28""6879/,#;Z/#$+")("'#&'#." &"/S$2""67/D$;Z/;$28""6879/,$;[/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.˕ &%;Z/×#%28""6879/,#;Z/#$+")("'#&'#." &"/°$%28""6879/,#;Z/#$+")("'#&'#." &"/$%28""6879/,#;Z/#$+")("'#&'#." &"/b$%28""6879/,#;Z/#$+")("'#&'#." &"/;$2""67/,$;[/#$+')(''#(&'#(%'#($'#(#'#("'#&'#.ȑ &%;Z/þ#%28""6879/,#;Z/#$+")("'#&'#." &"/×$%28""6879/,#;Z/#$+")("'#&'#." &"/°$%28""6879/,#;Z/#$+")("'#&'#." &"/$%28""6879/,#;Z/#$+")("'#&'#." &"/b$%28""6879/,#;Z/#$+")("'#&'#." &"/;$2""67/,$;Z/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ħ &%;Z/Ĝ#%28""6879/,#;Z/#$+")("'#&'#." &"/õ$%28""6879/,#;Z/#$+")("'#&'#." &"/Î$%28""6879/,#;Z/#$+")("'#&'#." &"/§$%28""6879/,#;Z/#$+")("'#&'#." &"/$%28""6879/,#;Z/#$+")("'#&'#." &"/Y$%28""6879/,#;Z/#$+")("'#&'#." &"/2$2""67/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#/& 8!: ! )`),h(`%;#/M#;#." &"/?$;#." &"/1$;#." &"/#$+$)($'#(#'#("'#&'#`),h(`%;Z/;#28""6879/,$;Z/#$+#)(#'#("'#&'#.# &;\\`),h(`%;]/o#2J""6J7K/\`$;]/W$2J""6J7K/H$;]/?$2J""6J7K/0$;]/'$8':¡' )(''#(&'#(%'#($'#(#'#("'#&'#`),h(`%2¢""6¢7£/2#4¤""5!7¥/#$+")("'#&'#. &%2¦""6¦7§/;#4¨""5!7©/,$;!/#$+#)(#'#("'#&'#.j &%2ª""6ª7«/5#;!/,$;!/#$+#)(#'#("'#&'#.B &%4¬""5!7/,#;!/#$+")("'#&'#.# &;!`),h(`%%;!." &"/[#;!." &"/M$;!." &"/?$;!." &"/1$;!." &"/#$+%)(%'#($'#(#'#("'#&'#/' 8!:®!! )`),h(`$%22""6273/,#;\`/#$+")("'#&'#0<*%22""6273/,#;\`/#$+")("'#&'#&`),h(";a.A &;b.; &;c.5 &;d./ &;e.) &;f.# &;g"),h(`%3¯""5*7°/a#3±""5#7².G &3³""5#7´.; &3µ""5$7¶./ &3·""5#7¸.# &;6/($8":¹"! )("'#&'#`),h(`%3º""5%7»/I#3¼""5%7½./ &3¾""5"7¿.# &;6/($8":À"! )("'#&'#`),h(`%3Á""5'7Â/1#;/($8":Ã"! )("'#&'#`),h(`%3Ä""5$7Å/1#;ð/($8":Æ"! )("'#&'#`),h(`%3Ç""5&7È/1#;T/($8":É"! )("'#&'#`),h(`%3Ê""5"7Ë/N#%2>""6>7?/,#;6/#$+")("'#&'#." &"/'$8":Ì" )("'#&'#`),h(`%;h/P#%2>""6>7?/,#;i/#$+")("'#&'#." &"/)$8":Í""! )("'#&'#`),h('%$;j/�#*;j&&&#/"!&,)'),h('%$;j/�#*;j&&&#/"!&,)'),h(";k.) &;+.# &;-"),h('2l""6l7m.e &2n""6n7o.Y &24""6475.M &28""6879.A &2<""6<7=.5 &2@""6@7A.) &2B""6B7C'),h(`%26""6677/n#;m/e$$%2<""6<7=/,#;m/#$+")("'#&'#0<*%2<""6<7=/,#;m/#$+")("'#&'#&/#$+#)(#'#("'#&'#`),h(`%;n/A#2>""6>7?/2$;o/)$8#:Î#"" )(#'#("'#&'#`),h("$;p.) &;+.# &;-/2#0/*;p.) &;+.# &;-&&&#"),h("$;p.) &;+.# &;-0/*;p.) &;+.# &;-&"),h('2l""6l7m.e &2n""6n7o.Y &24""6475.M &26""6677.A &28""6879.5 &2@""6@7A.) &2B""6B7C'),h(";.# &;r"),h(`%;/G#;'/>$;s/5$;'/,$;/#$+%)(%'#($'#(#'#("'#&'#`),h(";M.# &;t"),h(`%;/E#28""6879/6$;u.# &;x/'$8#:Ï# )(#'#("'#&'#`),h(`%;v.# &;w/J#%26""6677/,#;/#$+")("'#&'#." &"/#$+")("'#&'#`),h(`%2Ð""6Ð7Ñ/:#;/1$;w." &"/#$+#)(#'#("'#&'#`),h(`%24""6475/,#;{/#$+")("'#&'#`),h(`%;z/3#$;y0#*;y&/#$+")("'#&'#`),h(";*.) &;+.# &;-"),h(';+. &;-. &22""6273.} &26""6677.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),h(`%;|/e#$%24""6475/,#;|/#$+")("'#&'#0<*%24""6475/,#;|/#$+")("'#&'#&/#$+")("'#&'#`),h(`%$;~0#*;~&/e#$%22""6273/,#;}/#$+")("'#&'#0<*%22""6273/,#;}/#$+")("'#&'#&/#$+")("'#&'#`),h("$;~0#*;~&"),h(';+.w &;-.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),h(`%%;"/#$;".G &;!.A &2@""6@7A.5 &2F""6F7G.) &2J""6J7K0M*;".G &;!.A &2@""6@7A.5 &2F""6F7G.) &2J""6J7K&/#$+")("'#&'#/& 8!:Ò! )`),h(";.# &;"),h(`%%;O/2#2:""6:7;/#$+")("'#&'#." &"/,#;S/#$+")("'#&'#." &"`),h('$;+. &;-.} &2B""6B7C.q &2D""6D7E.e &22""6273.Y &28""6879.M &2:""6:7;.A &2<""6<7=.5 &2>""6>7?.) &2@""6@7A/#0*;+. &;-.} &2B""6B7C.q &2D""6D7E.e &22""6273.Y &28""6879.M &2:""6:7;.A &2<""6<7=.5 &2>""6>7?.) &2@""6@7A&&&#'),h("$;y0#*;y&"),h(`%3""5#7Ó/q#24""6475/b$$;!/�#*;!&&&#/L$2J""6J7K/=$$;!/�#*;!&&&#/'$8%:Ô% )(%'#($'#(#'#("'#&'#`),h('2Õ""6Õ7Ö'),h('2×""6×7Ø'),h('2Ù""6Ù7Ú'),h('2Û""6Û7Ü'),h('2Ý""6Ý7Þ'),h('2ß""6ß7à'),h('2á""6á7â'),h('2ã""6ã7ä'),h('2å""6å7æ'),h('2ç""6ç7è'),h('2é""6é7ê'),h("%;
.Y &;.S &;.M &;.G &;.A &;.; &;.5 &;./ &;.) &;.# &;6/& 8!:ë! )"),h(`%;/G#;'/>$;/5$;'/,$;/#$+%)(%'#($'#(#'#("'#&'#`),h("%;/' 8!:ì!! )"),h(`%;!/5#;!/,$;!/#$+#)(#'#("'#&'#`),h("%$;*.A &;+.; &;-.5 &;3./ &;4.) &;'.# &;(0G*;*.A &;+.; &;-.5 &;3./ &;4.) &;'.# &;(&/& 8!:í! )"),h(`%;¶/Y#$%;A/,#;¶/#$+")("'#&'#06*%;A/,#;¶/#$+")("'#&'#&/#$+")("'#&'#`),h(`%;9/N#%2:""6:7;/,#;9/#$+")("'#&'#." &"/'$8":î" )("'#&'#`),h(`%;:.c &%;/Y#$%;A/,#;/#$+")("'#&'#06*%;A/,#;/#$+")("'#&'#&/#$+")("'#&'#/& 8!:ï! )`),h(`%;L.# &;/]#$%;B/,#;/#$+")("'#&'#06*%;B/,#;/#$+")("'#&'#&/'$8":ð" )("'#&'#`),h(`%;." &"/>#;@/5$;M/,$;?/#$+$)($'#(#'#("'#&'#`),h(`%%;6/Y#$%;./,#;6/#$+")("'#&'#06*%;./,#;6/#$+")("'#&'#&/#$+")("'#&'#.# &;H/' 8!:ñ!! )`),h(";.) &;.# &; "),h(`%3ò""5!7ó/:#;</1$;/($8#:ô#! )(#'#("'#&'#`),h(`%3õ""5'7ö/:#;</1$;/($8#:÷#! )(#'#("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:ø!! )"),h(`%2ù""6ù7ú/o#%2J""6J7K/M#;!." &"/?$;!." &"/1$;!." &"/#$+$)($'#(#'#("'#&'#." &"/'$8":û" )("'#&'#`),h(`%;6/J#%;</,#;¡/#$+")("'#&'#." &"/)$8":ü""! )("'#&'#`),h(";6.) &;T.# &;H"),h(`%;£/Y#$%;B/,#;¤/#$+")("'#&'#06*%;B/,#;¤/#$+")("'#&'#&/#$+")("'#&'#`),h(`%3ý""5&7þ.G &3ÿ""5'7Ā.; &3ā""5$7Ă./ &3ă""5%7Ą.# &;6/& 8!:ą! )`),h(";¥.# &; "),h(`%3Ć""5(7ć/M#;</D$3Ĉ""5(7ĉ./ &3Ċ""5(7ċ.# &;6/#$+#)(#'#("'#&'#`),h(`%;6/Y#$%;A/,#;6/#$+")("'#&'#06*%;A/,#;6/#$+")("'#&'#&/#$+")("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:Č!! )"),h("%;©/& 8!:č! )"),h(`%;ª/k#;;/b$;¯/Y$$%;B/,#;°/#$+")("'#&'#06*%;B/,#;°/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),h(";«.# &;¬"),h('3Ď""5$7ď.S &3Đ""5%7đ.G &3Ē""5%7ē.; &3Ĕ""5%7ĕ./ &3Ė""5+7ė.# &;'),h(`3Ę""5'7ę./ &3Ě""5)7ě.# &;`),h(";6.# &;®"),h(`%3Ĝ""5"7ĝ/,#;6/#$+")("'#&'#`),h(";.# &;6"),h(`%;6/5#;</,$;±/#$+#)(#'#("'#&'#`),h(";6.# &;H"),h(`%;³/5#;./,$;/#$+#)(#'#("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:Ğ!! )"),h("%;/' 8!:ğ!! )"),h(`%;¶/^#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/($8":Ġ"!!)("'#&'#`),h(`%%;7/e#$%2J""6J7K/,#;7/#$+")("'#&'#0<*%2J""6J7K/,#;7/#$+")("'#&'#&/#$+")("'#&'#/"!&,)`),h(`%;L.# &;/]#$%;B/,#;¸/#$+")("'#&'#06*%;B/,#;¸/#$+")("'#&'#&/'$8":ġ" )("'#&'#`),h(";¹.# &; "),h(`%3Ģ""5#7ģ/:#;</1$;6/($8#:Ĥ#! )(#'#("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:ĥ!! )"),h("%;/' 8!:Ħ!! )"),h(`%$;0#*;&/x#;@/o$;M/f$;?/]$$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/'$8%:ħ% )(%'#($'#(#'#("'#&'#`),h(";¾"),h(`%3Ĩ""5&7ĩ/k#;./b$;Á/Y$$%;A/,#;Á/#$+")("'#&'#06*%;A/,#;Á/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#.# &;¿`),h(`%;6/k#;./b$;À/Y$$%;A/,#;À/#$+")("'#&'#06*%;A/,#;À/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),h(`%;6/;#;</2$;6.# &;H/#$+#)(#'#("'#&'#`),h(";Â.G &;Ä.A &;Æ.; &;È.5 &;É./ &;Ê.) &;Ë.# &;À"),h(`%3Ī""5%7ī/5#;</,$;Ã/#$+#)(#'#("'#&'#`),h("%;I/' 8!:Ĭ!! )"),h(`%3ĭ""5&7Į/#;</$;D/
$;Å/|$$%$;'/�#*;'&&&#/,#;Å/#$+")("'#&'#0C*%$;'/�#*;'&&&#/,#;Å/#$+")("'#&'#&/,$;E/#$+&)(&'#(%'#($'#(#'#("'#&'#`),h(";t.# &;w"),h(`%3į""5%7İ/5#;</,$;Ç/#$+#)(#'#("'#&'#`),h("%;I/' 8!:ı!! )"),h(`%3IJ""5&7ij/:#;</1$;I/($8#:Ĵ#! )(#'#("'#&'#`),h(`%3ĵ""5%7Ķ/]#;</T$%3ķ""5$7ĸ/& 8!:Ĺ! ).4 &%3ĺ""5%7Ļ/& 8!:ļ! )/#$+#)(#'#("'#&'#`),h(`%3Ľ""5)7ľ/R#;</I$3Ŀ""5#7ŀ./ &3Ł""5(7ł.# &;6/($8#:Ń#! )(#'#("'#&'#`),h(`%3ń""5#7Ņ/#;</$;D/$%;Ì/e#$%2D""6D7E/,#;Ì/#$+")("'#&'#0<*%2D""6D7E/,#;Ì/#$+")("'#&'#&/#$+")("'#&'#/,$;E/#$+%)(%'#($'#(#'#("'#&'#`),h(`%3ņ""5(7Ň./ &3ň""5$7ʼn.# &;6/' 8!:Ŋ!! )`),h(`%;6/Y#$%;A/,#;6/#$+")("'#&'#06*%;A/,#;6/#$+")("'#&'#&/#$+")("'#&'#`),h(`%;Ï/G#;./>$;Ï/5$;./,$;/#$+%)(%'#($'#(#'#("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:ŋ!! )"),h(`%;Ñ/]#$%;A/,#;Ñ/#$+")("'#&'#06*%;A/,#;Ñ/#$+")("'#&'#&/'$8":Ō" )("'#&'#`),h(`%;/]#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/'$8":ō" )("'#&'#`),h(`%;L.O &;.I &%;@." &"/:#;t/1$;?." &"/#$+#)(#'#("'#&'#/]#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/'$8":Ŏ" )("'#&'#`),h(`%;Ô/]#$%;B/,#;Õ/#$+")("'#&'#06*%;B/,#;Õ/#$+")("'#&'#&/'$8":ŏ" )("'#&'#`),h("%;/& 8!:Ő! )"),h(`%3ő""5(7Œ/:#;</1$;6/($8#:œ#! )(#'#("'#&'#.g &%3Ŕ""5&7ŕ/:#;</1$;6/($8#:Ŗ#! )(#'#("'#&'#.: &%3ŗ""5*7Ř/& 8!:ř! ).# &; `),h(`%%;6/k#$%;A/2#;6/)$8":Ś""$ )("'#&'#0<*%;A/2#;6/)$8":Ś""$ )("'#&'#&/)$8":ś""! )("'#&'#." &"/' 8!:Ŝ!! )`),h(`%;Ø/Y#$%;A/,#;Ø/#$+")("'#&'#06*%;A/,#;Ø/#$+")("'#&'#&/#$+")("'#&'#`),h(`%;/Y#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/#$+")("'#&'#`),h("%$;!/�#*;!&&&#/' 8!:ŝ!! )"),h(`%;Û/Y#$%;B/,#;Ü/#$+")("'#&'#06*%;B/,#;Ü/#$+")("'#&'#&/#$+")("'#&'#`),h(`%3Ş""5&7ş.; &3Š""5'7š./ &3Ţ""5*7ţ.# &;6/& 8!:Ť! )`),h(`%3ť""5&7Ŧ/:#;</1$;Ý/($8#:ŧ#! )(#'#("'#&'#.} &%3õ""5'7ö/:#;</1$;/($8#:Ũ#! )(#'#("'#&'#.P &%3ũ""5+7Ū/:#;</1$;/($8#:ū#! )(#'#("'#&'#.# &; `),h(`3Ŭ""5+7ŭ.k &3Ů""5)7ů._ &3Ű""5(7ű.S &3Ų""5'7ų.G &3Ŵ""5&7ŵ.; &3Ŷ""5*7ŷ./ &3Ÿ""5)7Ź.# &;6`),h(';1." &"'),h(`%%;6/k#$%;A/2#;6/)$8":Ś""$ )("'#&'#0<*%;A/2#;6/)$8":Ś""$ )("'#&'#&/)$8":ś""! )("'#&'#." &"/' 8!:ź!! )`),h(`%;L.# &;/]#$%;B/,#;á/#$+")("'#&'#06*%;B/,#;á/#$+")("'#&'#&/'$8":Ż" )("'#&'#`),h(";¹.# &; "),h(`%;ã/Y#$%;A/,#;ã/#$+")("'#&'#06*%;A/,#;ã/#$+")("'#&'#&/#$+")("'#&'#`),h(`%;ê/k#;./b$;í/Y$$%;B/,#;ä/#$+")("'#&'#06*%;B/,#;ä/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),h(";å.; &;æ.5 &;ç./ &;è.) &;é.# &; "),h(`%3ż""5#7Ž/:#;</1$;ð/($8#:ž#! )(#'#("'#&'#`),h(`%3ſ""5%7ƀ/:#;</1$;T/($8#:Ɓ#! )(#'#("'#&'#`),h(`%3Ƃ""5(7ƃ/F#;</=$;\\.) &;Y.# &;X/($8#:Ƅ#! )(#'#("'#&'#`),h(`%3ƅ""5&7Ɔ/:#;</1$;6/($8#:Ƈ#! )(#'#("'#&'#`),h(`%3ƈ""5%7Ɖ/A#;</8$$;!0#*;!&/($8#:Ɗ#! )(#'#("'#&'#`),h(`%;ë/G#;;/>$;6/5$;;/,$;ì/#$+%)(%'#($'#(#'#("'#&'#`),h(`%3""5#7Ó.# &;6/' 8!:Ƌ!! )`),h(`%3±""5#7ƌ.G &3³""5#7ƍ.; &3·""5#7Ǝ./ &3µ""5$7Ə.# &;6/' 8!:Ɛ!! )`),h(`%;î/D#%;C/,#;ï/#$+")("'#&'#." &"/#$+")("'#&'#`),h("%;U.) &;\\.# &;X/& 8!:Ƒ! )"),h(`%%;!." &"/[#;!." &"/M$;!." &"/?$;!." &"/1$;!." &"/#$+%)(%'#($'#(#'#("'#&'#/' 8!:ƒ!! )`),h(`%%;!/?#;!." &"/1$;!." &"/#$+#)(#'#("'#&'#/' 8!:Ɠ!! )`),h(";¾"),h(`%;/^#$%;B/,#;ó/#$+")("'#&'#06*%;B/,#;ó/#$+")("'#&'#&/($8":Ɣ"!!)("'#&'#`),h(";ô.# &; "),h(`%2ƕ""6ƕ7Ɩ/L#;</C$2Ɨ""6Ɨ7Ƙ.) &2ƙ""6ƙ7ƚ/($8#:ƛ#! )(#'#("'#&'#`),h(`%;/^#$%;B/,#; /#$+")("'#&'#06*%;B/,#; /#$+")("'#&'#&/($8":Ɯ"!!)("'#&'#`),h(`%;6/5#;0/,$;÷/#$+#)(#'#("'#&'#`),h("$;2.) &;4.# &;.0/*;2.) &;4.# &;.&"),h("$;%0#*;%&"),h(`%;ú/;#28""6879/,$;û/#$+#)(#'#("'#&'#`),h(`%3Ɲ""5%7ƞ.) &3Ɵ""5$7Ơ/' 8!:ơ!! )`),h(`%;ü/J#%28""6879/,#;^/#$+")("'#&'#." &"/#$+")("'#&'#`),h("%;\\.) &;X.# &;/' 8!:Ƣ!! )"),h(';".S &;!.M &2F""6F7G.A &2J""6J7K.5 &2H""6H7I.) &2N""6N7O'),h('2L""6L7M. &2B""6B7C. &2<""6<7=.} &2R""6R7S.q &2T""6T7U.e &2V""6V7W.Y &2P""6P7Q.M &2@""6@7A.A &2D""6D7E.5 &22""6273.) &2>""6>7?'),h(`%;Ā/b#28""6879/S$;û/J$%2ƣ""6ƣ7Ƥ/,#;ì/#$+")("'#&'#." &"/#$+$)($'#(#'#("'#&'#`),h(`%3ƥ""5%7Ʀ.) &3Ƨ""5$7ƨ/' 8!:ơ!! )`),h(`%3±""5#7².6 &3³""5#7´.* &$;+0#*;+&/' 8!:Ʃ!! )`),h(`%;Ą/#2F""6F7G/x$;ă/o$2F""6F7G/\`$;ă/W$2F""6F7G/H$;ă/?$2F""6F7G/0$;ą/'$8):ƪ) )()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#`),h(`%;#/>#;#/5$;#/,$;#/#$+$)($'#(#'#("'#&'#`),h(`%;ă/,#;ă/#$+")("'#&'#`),h(`%;ă/5#;ă/,$;ă/#$+#)(#'#("'#&'#`),h(`%;q/T#$;m0#*;m&/D$%; /,#;ø/#$+")("'#&'#." &"/#$+#)(#'#("'#&'#`),h(`%2ƫ""6ƫ7Ƭ.) &2ƭ""6ƭ7Ʈ/w#;0/n$;Ĉ/e$$%;B/2#;ĉ.# &; /#$+")("'#&'#0<*%;B/2#;ĉ.# &; /#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),h(";.# &;L"),h(`%2Ư""6Ư7ư/5#;</,$;Ċ/#$+#)(#'#("'#&'#`),h(`%;D/S#;,/J$2:""6:7;/;$;,.# &;T/,$;E/#$+%)(%'#($'#(#'#("'#&'#`)];let l=0,c=0;const d=[{line:1,column:1}];let g=0,u=[],y=0,E;if(e.startRule!==void 0){if(!(e.startRule in i))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');n=i[e.startRule]}function v(){return s.substring(c,l)}function _(){return S(c,l)}function x(f,C){return{type:"literal",text:f,ignoreCase:C}}function p(f,C,m){return{type:"class",parts:f,inverted:C,ignoreCase:m}}function w(){return{type:"end"}}function D(f){let C=d[f],m;if(C)return C;for(m=f-1;!d[m];)m--;for(C=d[m],C={line:C.line,column:C.column};m<f;)s.charCodeAt(m)===10?(C.line++,C.column=1):C.column++,m++;return d[f]=C,C}function S(f,C){const m=D(f),q=D(C);return{source:r,start:{offset:f,line:m.line,column:m.column},end:{offset:C,line:q.line,column:q.column}}}function T(f){l<g||(l>g&&(g=l,u=[]),u.push(f))}function F(f,C,m){return new fr(fr.buildMessage(f,C),f,C,m)}function h(f){return f.split("").map(C=>C.charCodeAt(0)-32)}function M(f){const C=o[f];let m=0;const q=[];let N=C.length;const z=[],G=[];let ie;for(;;){for(;m<N;)switch(C[m]){case 0:G.push(a[C[m+1]]),m+=2;break;case 1:G.push(void 0),m++;break;case 2:G.push(null),m++;break;case 3:G.push(t),m++;break;case 4:G.push([]),m++;break;case 5:G.push(l),m++;break;case 6:G.pop(),m++;break;case 7:l=G.pop(),m++;break;case 8:G.length-=C[m+1],m+=2;break;case 9:G.splice(-2,1),m++;break;case 10:G[G.length-2].push(G.pop()),m++;break;case 11:G.push(G.splice(G.length-C[m+1],C[m+1])),m+=2;break;case 12:G.push(s.substring(G.pop(),l)),m++;break;case 13:z.push(N),q.push(m+3+C[m+1]+C[m+2]),G[G.length-1]?(N=m+3+C[m+1],m+=3):(N=m+3+C[m+1]+C[m+2],m+=3+C[m+1]);break;case 14:z.push(N),q.push(m+3+C[m+1]+C[m+2]),G[G.length-1]===t?(N=m+3+C[m+1],m+=3):(N=m+3+C[m+1]+C[m+2],m+=3+C[m+1]);break;case 15:z.push(N),q.push(m+3+C[m+1]+C[m+2]),G[G.length-1]!==t?(N=m+3+C[m+1],m+=3):(N=m+3+C[m+1]+C[m+2],m+=3+C[m+1]);break;case 16:G[G.length-1]!==t?(z.push(N),q.push(m),N=m+2+C[m+1],m+=2):m+=2+C[m+1];break;case 17:z.push(N),q.push(m+3+C[m+1]+C[m+2]),s.length>l?(N=m+3+C[m+1],m+=3):(N=m+3+C[m+1]+C[m+2],m+=3+C[m+1]);break;case 18:z.push(N),q.push(m+4+C[m+2]+C[m+3]),s.substr(l,a[C[m+1]].length)===a[C[m+1]]?(N=m+4+C[m+2],m+=4):(N=m+4+C[m+2]+C[m+3],m+=4+C[m+2]);break;case 19:z.push(N),q.push(m+4+C[m+2]+C[m+3]),s.substr(l,a[C[m+1]].length).toLowerCase()===a[C[m+1]]?(N=m+4+C[m+2],m+=4):(N=m+4+C[m+2]+C[m+3],m+=4+C[m+2]);break;case 20:z.push(N),q.push(m+4+C[m+2]+C[m+3]),a[C[m+1]].test(s.charAt(l))?(N=m+4+C[m+2],m+=4):(N=m+4+C[m+2]+C[m+3],m+=4+C[m+2]);break;case 21:G.push(s.substr(l,C[m+1])),l+=C[m+1],m+=2;break;case 22:G.push(a[C[m+1]]),l+=a[C[m+1]].length,m+=2;break;case 23:G.push(t),y===0&&T(a[C[m+1]]),m+=2;break;case 24:c=G[G.length-1-C[m+1]],m+=2;break;case 25:c=l,m++;break;case 26:ie=C.slice(m+4,m+4+C[m+3]).map(function(he){return G[G.length-1-he]}),G.splice(G.length-C[m+2],C[m+2],a[C[m+1]].apply(null,ie)),m+=4+C[m+3];break;case 27:G.push(M(C[m+1])),m+=2;break;case 28:y++,m++;break;case 29:y--,m++;break;default:throw new Error("Invalid opcode: "+C[m]+".")}if(z.length>0)N=z.pop(),m=q.pop();else break}return G[0]}e.data={};function A(f,C){return[f].concat(C)}if(E=M(n),E!==t&&l===s.length)return E;throw E!==t&&l<s.length&&T(w()),F(u,g<s.length?s.charAt(g):null,g<s.length?S(g,g+1):S(g,g))}const Ho=$o;var Te;(function(s){function e(i,n){const a={startRule:n};try{Ho(i,a)}catch{a.data=-1}return a.data}s.parse=e;function t(i){const n=s.parse(i,"Name_Addr_Header");return n!==-1?n:void 0}s.nameAddrHeaderParse=t;function r(i){const n=s.parse(i,"SIP_URI");return n!==-1?n:void 0}s.URIParse=r})(Te=Te||(Te={}));const Po={100:"Trying",180:"Ringing",181:"Call Is Being Forwarded",182:"Queued",183:"Session Progress",199:"Early Dialog Terminated",200:"OK",202:"Accepted",204:"No Notification",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",305:"Use Proxy",380:"Alternative Service",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",410:"Gone",412:"Conditional Request Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Unsupported URI Scheme",417:"Unknown Resource-Priority",420:"Bad Extension",421:"Extension Required",422:"Session Interval Too Small",423:"Interval Too Brief",428:"Use Identity Header",429:"Provide Referrer Identity",430:"Flow Failed",433:"Anonymity Disallowed",436:"Bad Identity-Info",437:"Unsupported Certificate",438:"Invalid Identity Header",439:"First Hop Lacks Outbound Support",440:"Max-Breadth Exceeded",469:"Bad Info Package",470:"Consent Needed",478:"Unresolvable Destination",480:"Temporarily Unavailable",481:"Call/Transaction Does Not Exist",482:"Loop Detected",483:"Too Many Hops",484:"Address Incomplete",485:"Ambiguous",486:"Busy Here",487:"Request Terminated",488:"Not Acceptable Here",489:"Bad Event",491:"Request Pending",493:"Undecipherable",494:"Security Agreement Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Server Time-out",505:"Version Not Supported",513:"Message Too Large",580:"Precondition Failure",600:"Busy Everywhere",603:"Decline",604:"Does Not Exist Anywhere",606:"Not Acceptable"};function Qt(s,e=32){let t="";for(let r=0;r<s;r++){const i=Math.floor(Math.random()*e);t+=i.toString(e)}return t}function es(s){return Po[s]||""}function ts(){return Qt(10)}function ht(s){const e={"Call-Id":"Call-ID",Cseq:"CSeq","Min-Se":"Min-SE",Rack:"RAck",Rseq:"RSeq","Www-Authenticate":"WWW-Authenticate"},t=s.toLowerCase().replace(/_/g,"-").split("-"),r=t.length;let i="";for(let n=0;n<r;n++)n!==0&&(i+="-"),i+=t[n].charAt(0).toUpperCase()+t[n].substring(1);return e[i]&&(i=e[i]),i}function $r(s){return encodeURIComponent(s).replace(/%[A-F\d]{2}/g,"U").length}class Dn{constructor(){this.headers={}}addHeader(e,t){const r={raw:t};e=ht(e),this.headers[e]?this.headers[e].push(r):this.headers[e]=[r]}getHeader(e){const t=this.headers[ht(e)];if(t){if(t[0])return t[0].raw}else return}getHeaders(e){const t=this.headers[ht(e)],r=[];if(!t)return[];for(const i of t)r.push(i.raw);return r}hasHeader(e){return!!this.headers[ht(e)]}parseHeader(e,t=0){if(e=ht(e),this.headers[e]){if(t>=this.headers[e].length)return}else return;const r=this.headers[e][t],i=r.raw;if(r.parsed)return r.parsed;const n=Te.parse(i,e.replace(/-/g,"_"));if(n===-1){this.headers[e].splice(t,1);return}else return r.parsed=n,n}s(e,t=0){return this.parseHeader(e,t)}setHeader(e,t){this.headers[ht(e)]=[{raw:t}]}toString(){return this.data}}class gr extends Dn{constructor(){super()}}class Pt extends Dn{constructor(){super()}}class er{constructor(e,t,r,i,n,a,o){this.headers={},this.extraHeaders=[],this.options=er.getDefaultOptions(),n&&(this.options=Object.assign(Object.assign({},this.options),n),this.options.optionTags&&this.options.optionTags.length&&(this.options.optionTags=this.options.optionTags.slice()),this.options.routeSet&&this.options.routeSet.length&&(this.options.routeSet=this.options.routeSet.slice())),a&&a.length&&(this.extraHeaders=a.slice()),o&&(this.body={body:o.content,contentType:o.contentType}),this.method=e,this.ruri=t.clone(),this.fromURI=r.clone(),this.fromTag=this.options.fromTag?this.options.fromTag:ts(),this.from=er.makeNameAddrHeader(this.fromURI,this.options.fromDisplayName,this.fromTag),this.toURI=i.clone(),this.toTag=this.options.toTag,this.to=er.makeNameAddrHeader(this.toURI,this.options.toDisplayName,this.toTag),this.callId=this.options.callId?this.options.callId:this.options.callIdPrefix+Qt(15),this.cseq=this.options.cseq,this.setHeader("route",this.options.routeSet),this.setHeader("via",""),this.setHeader("to",this.to.toString()),this.setHeader("from",this.from.toString()),this.setHeader("cseq",this.cseq+" "+this.method),this.setHeader("call-id",this.callId),this.setHeader("max-forwards","70")}static getDefaultOptions(){return{callId:"",callIdPrefix:"",cseq:1,toDisplayName:"",toTag:"",fromDisplayName:"",fromTag:"",forceRport:!1,hackViaTcp:!1,optionTags:["outbound"],routeSet:[],userAgentString:"sip.js",viaHost:""}}static makeNameAddrHeader(e,t,r){const i={};return r&&(i.tag=r),new Le(e,t,i)}getHeader(e){const t=this.headers[ht(e)];if(t){if(t[0])return t[0]}else{const r=new RegExp("^\\s*"+e+"\\s*:","i");for(const i of this.extraHeaders)if(r.test(i))return i.substring(i.indexOf(":")+1).trim()}}getHeaders(e){const t=[],r=this.headers[ht(e)];if(r)for(const i of r)t.push(i);else{const i=new RegExp("^\\s*"+e+"\\s*:","i");for(const n of this.extraHeaders)i.test(n)&&t.push(n.substring(n.indexOf(":")+1).trim())}return t}hasHeader(e){if(this.headers[ht(e)])return!0;{const t=new RegExp("^\\s*"+e+"\\s*:","i");for(const r of this.extraHeaders)if(t.test(r))return!0}return!1}setHeader(e,t){this.headers[ht(e)]=t instanceof Array?t:[t]}setViaHeader(e,t){this.options.hackViaTcp&&(t="TCP");let r="SIP/2.0/"+t;r+=" "+this.options.viaHost+";branch="+e,this.options.forceRport&&(r+=";rport"),this.setHeader("via",r),this.branch=e}toString(){let e="";e+=this.method+" "+this.ruri.toRaw()+` SIP/2.0\r
|
|
39
39
|
`;for(const t in this.headers)if(this.headers[t])for(const r of this.headers[t])e+=t+": "+r+`\r
|
|
40
40
|
`;for(const t of this.extraHeaders)e+=t.trim()+`\r
|
|
41
41
|
`;return e+="Supported: "+this.options.optionTags.join(", ")+`\r
|
|
@@ -49,10 +49,10 @@ React keys must be passed directly to JSX without using spread:
|
|
|
49
49
|
\r
|
|
50
50
|
`:e+=`Content-Length: 0\r
|
|
51
51
|
\r
|
|
52
|
-
`,e}}function bn(s){return s==="application/sdp"?"session":"render"}function rs(s){const e=typeof s=="string"?s:s.body,t=typeof s=="string"?"application/sdp":s.contentType;return{contentDisposition:bn(t),contentType:t,content:e}}function An(s){return s&&typeof s.content=="string"&&typeof s.contentType=="string"&&s.contentDisposition===void 0?!0:typeof s.contentDisposition=="string"}function Hr(s){let e,t,r;if(s instanceof gr&&s.body){const i=s.parseHeader("Content-Disposition");e=i?i.type:void 0,t=s.parseHeader("Content-Type"),r=s.body}if(s instanceof Pt&&s.body){const i=s.parseHeader("Content-Disposition");e=i?i.type:void 0,t=s.parseHeader("Content-Type"),r=s.body}if(s instanceof er&&s.body)if(e=s.getHeader("Content-Disposition"),t=s.getHeader("Content-Type"),typeof s.body=="string"){if(!t)throw new Error("Header content type header does not equal body content type.");r=s.body}else{if(t&&t!==s.body.contentType)throw new Error("Header content type header does not equal body content type.");t=s.body.contentType,r=s.body.body}if(An(s)&&(e=s.contentDisposition,t=s.contentType,r=s.content),!!r){if(t&&!e&&(e=bn(t)),!e)throw new Error("Content disposition undefined.");if(!t)throw new Error("Content type undefined.");return{contentDisposition:e,contentType:t,content:r}}}var Je;(function(s){s.Initial="Initial",s.Early="Early",s.AckWait="AckWait",s.Confirmed="Confirmed",s.Terminated="Terminated"})(Je=Je||(Je={}));var U;(function(s){s.Initial="Initial",s.HaveLocalOffer="HaveLocalOffer",s.HaveRemoteOffer="HaveRemoteOffer",s.Stable="Stable",s.Closed="Closed"})(U=U||(U={}));const wt=500,Oo=4e3,Tn=5e3,Re={T1:wt,T2:Oo,TIMER_B:64*wt,TIMER_D:0*wt,TIMER_F:64*wt,TIMER_H:64*wt,TIMER_I:0*Tn,TIMER_J:0*wt,TIMER_K:0*Tn,TIMER_L:64*wt,TIMER_M:64*wt,TIMER_N:64*wt,PROVISIONAL_RESPONSE_INTERVAL:6e4};class Ot extends Xt{constructor(e){super(e||"Transaction state error.")}}var j;(function(s){s.ACK="ACK",s.BYE="BYE",s.CANCEL="CANCEL",s.INFO="INFO",s.INVITE="INVITE",s.MESSAGE="MESSAGE",s.NOTIFY="NOTIFY",s.OPTIONS="OPTIONS",s.REGISTER="REGISTER",s.UPDATE="UPDATE",s.SUBSCRIBE="SUBSCRIBE",s.PUBLISH="PUBLISH",s.REFER="REFER",s.PRACK="PRACK"})(j=j||(j={}));const Mt=[j.ACK,j.BYE,j.CANCEL,j.INFO,j.INVITE,j.MESSAGE,j.NOTIFY,j.OPTIONS,j.PRACK,j.REFER,j.REGISTER,j.SUBSCRIBE];class Sn{constructor(e){this.incomingMessageRequest=e}get request(){return this.incomingMessageRequest.message}accept(e){return this.incomingMessageRequest.accept(e),Promise.resolve()}reject(e){return this.incomingMessageRequest.reject(e),Promise.resolve()}}class Gs{constructor(e){this.incomingNotifyRequest=e}get request(){return this.incomingNotifyRequest.message}accept(e){return this.incomingNotifyRequest.accept(e),Promise.resolve()}reject(e){return this.incomingNotifyRequest.reject(e),Promise.resolve()}}class Mo{constructor(e,t){this.incomingReferRequest=e,this.session=t}get referTo(){const e=this.incomingReferRequest.message.parseHeader("refer-to");if(!(e instanceof Le))throw new Error("Failed to parse Refer-To header.");return e}get referredBy(){return this.incomingReferRequest.message.getHeader("referred-by")}get replaces(){const e=this.referTo.uri.getHeader("replaces");return e instanceof Array?e[0]:e}get request(){return this.incomingReferRequest.message}accept(e={statusCode:202}){return this.incomingReferRequest.accept(e),Promise.resolve()}reject(e){return this.incomingReferRequest.reject(e),Promise.resolve()}makeInviter(e){if(this.inviter)return this.inviter;const t=this.referTo.uri.clone();t.clearHeaders(),e=e||{};const r=(e.extraHeaders||[]).slice(),i=this.replaces;i&&r.push("Replaces: "+decodeURIComponent(i));const n=this.referredBy;return n&&r.push("Referred-By: "+n),e.extraHeaders=r,this.inviter=this.session.userAgent._makeInviter(t,e),this.inviter._referred=this.session,this.session._referral=this.inviter,this.inviter}}var B;(function(s){s.Initial="Initial",s.Establishing="Establishing",s.Established="Established",s.Terminating="Terminating",s.Terminated="Terminated"})(B=B||(B={}));class Pr{constructor(e,t={}){this.pendingReinvite=!1,this.pendingReinviteAck=!1,this._state=B.Initial,this.delegate=t.delegate,this._stateEventEmitter=new Ir,this._userAgent=e}dispose(){switch(this.logger.log(`Session ${this.id} in state ${this._state} is being disposed`),delete this.userAgent._sessions[this.id],this._sessionDescriptionHandler&&this._sessionDescriptionHandler.close(),this.state){case B.Initial:break;case B.Establishing:break;case B.Established:return new Promise(e=>{this._bye({onAccept:()=>e(),onRedirect:()=>e(),onReject:()=>e()})});case B.Terminating:break;case B.Terminated:break;default:throw new Error("Unknown state.")}return Promise.resolve()}get assertedIdentity(){return this._assertedIdentity}get dialog(){return this._dialog}get id(){return this._id}get replacee(){return this._replacee}get sessionDescriptionHandler(){return this._sessionDescriptionHandler}get sessionDescriptionHandlerFactory(){return this.userAgent.configuration.sessionDescriptionHandlerFactory}get sessionDescriptionHandlerModifiers(){return this._sessionDescriptionHandlerModifiers||[]}set sessionDescriptionHandlerModifiers(e){this._sessionDescriptionHandlerModifiers=e.slice()}get sessionDescriptionHandlerOptions(){return this._sessionDescriptionHandlerOptions||{}}set sessionDescriptionHandlerOptions(e){this._sessionDescriptionHandlerOptions=Object.assign({},e)}get sessionDescriptionHandlerModifiersReInvite(){return this._sessionDescriptionHandlerModifiersReInvite||[]}set sessionDescriptionHandlerModifiersReInvite(e){this._sessionDescriptionHandlerModifiersReInvite=e.slice()}get sessionDescriptionHandlerOptionsReInvite(){return this._sessionDescriptionHandlerOptionsReInvite||{}}set sessionDescriptionHandlerOptionsReInvite(e){this._sessionDescriptionHandlerOptionsReInvite=Object.assign({},e)}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get userAgent(){return this._userAgent}bye(e={}){let t="Session.bye() may only be called if established session.";switch(this.state){case B.Initial:typeof this.cancel=="function"?(t+=" However Inviter.invite() has not yet been called.",t+=" Perhaps you should have called Inviter.cancel()?"):typeof this.reject=="function"&&(t+=" However Invitation.accept() has not yet been called.",t+=" Perhaps you should have called Invitation.reject()?");break;case B.Establishing:typeof this.cancel=="function"?(t+=" However a dialog does not yet exist.",t+=" Perhaps you should have called Inviter.cancel()?"):typeof this.reject=="function"&&(t+=" However Invitation.accept() has not yet been called (or not yet resolved).",t+=" Perhaps you should have called Invitation.reject()?");break;case B.Established:{const r=e.requestDelegate,i=this.copyRequestOptions(e.requestOptions);return this._bye(r,i)}case B.Terminating:t+=" However this session is already terminating.",typeof this.cancel=="function"?t+=" Perhaps you have already called Inviter.cancel()?":typeof this.reject=="function"&&(t+=" Perhaps you have already called Session.bye()?");break;case B.Terminated:t+=" However this session is already terminated.";break;default:throw new Error("Unknown state")}return this.logger.error(t),Promise.reject(new Error(`Invalid session state ${this.state}`))}info(e={}){if(this.state!==B.Established)return this.logger.error("Session.info() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));const t=e.requestDelegate,r=this.copyRequestOptions(e.requestOptions);return this._info(t,r)}invite(e={}){if(this.logger.log("Session.invite"),this.state!==B.Established)return Promise.reject(new Error(`Invalid session state ${this.state}`));if(this.pendingReinvite)return Promise.reject(new js("Reinvite in progress. Please wait until complete, then try again."));this.pendingReinvite=!0,e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiersReInvite=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptionsReInvite=e.sessionDescriptionHandlerOptions);const t={onAccept:n=>{const a=Hr(n.message);if(!a){this.logger.error("Received 2xx response to re-INVITE without a session description"),this.ackAndBye(n,400,"Missing session description"),this.stateTransition(B.Terminated),this.pendingReinvite=!1;return}if(e.withoutSdp){const o={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setOfferAndGetAnswer(a,o).then(l=>{n.ack({body:l})}).catch(l=>{this.logger.error("Failed to handle offer in 2xx response to re-INVITE"),this.logger.error(l.message),this.state===B.Terminated?n.ack():(this.ackAndBye(n,488,"Bad Media Description"),this.stateTransition(B.Terminated))}).then(()=>{this.pendingReinvite=!1,e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(n)})}else{const o={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setAnswer(a,o).then(()=>{n.ack()}).catch(l=>{this.logger.error("Failed to handle answer in 2xx response to re-INVITE"),this.logger.error(l.message),this.state!==B.Terminated?(this.ackAndBye(n,488,"Bad Media Description"),this.stateTransition(B.Terminated)):n.ack()}).then(()=>{this.pendingReinvite=!1,e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(n)})}},onProgress:n=>{},onRedirect:n=>{},onReject:n=>{this.logger.warn("Received a non-2xx response to re-INVITE"),this.pendingReinvite=!1,e.withoutSdp?e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(n):this.rollbackOffer().catch(a=>{if(this.logger.error("Failed to rollback offer on non-2xx response to re-INVITE"),this.logger.error(a.message),this.state!==B.Terminated){if(!this.dialog)throw new Error("Dialog undefined.");const o=[];o.push("Reason: "+this.getReasonHeaderValue(500,"Internal Server Error")),this.dialog.bye(void 0,{extraHeaders:o}),this.stateTransition(B.Terminated)}}).then(()=>{e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(n)})},onTrying:n=>{}},r=e.requestOptions||{};if(r.extraHeaders=(r.extraHeaders||[]).slice(),r.extraHeaders.push("Allow: "+Mt.toString()),r.extraHeaders.push("Contact: "+this._contact),e.withoutSdp){if(!this.dialog)throw this.pendingReinvite=!1,new Error("Dialog undefined.");return Promise.resolve(this.dialog.invite(t,r))}const i={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};return this.getOffer(i).then(n=>{if(!this.dialog)throw this.pendingReinvite=!1,new Error("Dialog undefined.");return r.body=n,this.dialog.invite(t,r)}).catch(n=>{throw this.logger.error(n.message),this.logger.error("Failed to send re-INVITE"),this.pendingReinvite=!1,n})}message(e={}){if(this.state!==B.Established)return this.logger.error("Session.message() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));const t=e.requestDelegate,r=this.copyRequestOptions(e.requestOptions);return this._message(t,r)}refer(e,t={}){if(this.state!==B.Established)return this.logger.error("Session.refer() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));if(e instanceof Pr&&!e.dialog)return this.logger.error("Session.refer() may only be called with session which is established. You are perhaps attempting to attended transfer to a target for which there is not dialog yet established. Perhaps you are attempting a 'semi-attended' tansfer? Regardless, this is not supported. The recommended approached is to check to see if the target Session is in the Established state before calling refer(); if the state is not Established you may proceed by falling back using a URI as the target (blind transfer)."),Promise.reject(new Error(`Invalid session state ${this.state}`));const r=t.requestDelegate,i=this.copyRequestOptions(t.requestOptions);return i.extraHeaders=i.extraHeaders?i.extraHeaders.concat(this.referExtraHeaders(this.referToString(e))):this.referExtraHeaders(this.referToString(e)),this._refer(t.onNotify,r,i)}_bye(e,t){if(!this.dialog)return Promise.reject(new Error("Session dialog undefined."));const r=this.dialog;switch(r.sessionState){case Je.Initial:throw new Error(`Invalid dialog state ${r.sessionState}`);case Je.Early:throw new Error(`Invalid dialog state ${r.sessionState}`);case Je.AckWait:return this.stateTransition(B.Terminating),new Promise(i=>{r.delegate={onAck:()=>{const n=r.bye(e,t);return this.stateTransition(B.Terminated),i(n),Promise.resolve()},onAckTimeout:()=>{const n=r.bye(e,t);this.stateTransition(B.Terminated),i(n)}}});case Je.Confirmed:{const i=r.bye(e,t);return this.stateTransition(B.Terminated),Promise.resolve(i)}case Je.Terminated:throw new Error(`Invalid dialog state ${r.sessionState}`);default:throw new Error("Unrecognized state.")}}_info(e,t){return this.dialog?Promise.resolve(this.dialog.info(e,t)):Promise.reject(new Error("Session dialog undefined."))}_message(e,t){return this.dialog?Promise.resolve(this.dialog.message(e,t)):Promise.reject(new Error("Session dialog undefined."))}_refer(e,t,r){return this.dialog?(this.onNotify=e,Promise.resolve(this.dialog.refer(t,r))):Promise.reject(new Error("Session dialog undefined."))}ackAndBye(e,t,r){e.ack();const i=[];t&&i.push("Reason: "+this.getReasonHeaderValue(t,r)),e.session.bye(void 0,{extraHeaders:i})}onAckRequest(e){if(this.logger.log("Session.onAckRequest"),this.state!==B.Established&&this.state!==B.Terminating)return this.logger.error(`ACK received while in state ${this.state}, dropping request`),Promise.resolve();const t=this.dialog;if(!t)throw new Error("Dialog undefined.");const r={sessionDescriptionHandlerOptions:this.pendingReinviteAck?this.sessionDescriptionHandlerOptionsReInvite:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.pendingReinviteAck?this._sessionDescriptionHandlerModifiersReInvite:this._sessionDescriptionHandlerModifiers};if(this.delegate&&this.delegate.onAck){const i=new Fo(e);this.delegate.onAck(i)}switch(this.pendingReinviteAck=!1,t.signalingState){case U.Initial:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);const i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return t.bye(void 0,{extraHeaders:i}),this.stateTransition(B.Terminated),Promise.resolve()}case U.Stable:{const i=Hr(e.message);return i?i.contentDisposition==="render"?(this._renderbody=i.content,this._rendertype=i.contentType,Promise.resolve()):i.contentDisposition!=="session"?Promise.resolve():this.setAnswer(i,r).catch(n=>{this.logger.error(n.message);const a=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];t.bye(void 0,{extraHeaders:a}),this.stateTransition(B.Terminated)}):Promise.resolve()}case U.HaveLocalOffer:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);const i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return t.bye(void 0,{extraHeaders:i}),this.stateTransition(B.Terminated),Promise.resolve()}case U.HaveRemoteOffer:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);const i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return t.bye(void 0,{extraHeaders:i}),this.stateTransition(B.Terminated),Promise.resolve()}case U.Closed:throw new Error(`Invalid signaling state ${t.signalingState}.`);default:throw new Error(`Invalid signaling state ${t.signalingState}.`)}}onByeRequest(e){if(this.logger.log("Session.onByeRequest"),this.state!==B.Established){this.logger.error(`BYE received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onBye){const t=new Bo(e);this.delegate.onBye(t)}else e.accept();this.stateTransition(B.Terminated)}onInfoRequest(e){if(this.logger.log("Session.onInfoRequest"),this.state!==B.Established){this.logger.error(`INFO received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onInfo){const t=new Io(e);this.delegate.onInfo(t)}else e.accept()}onInviteRequest(e){if(this.logger.log("Session.onInviteRequest"),this.state!==B.Established){this.logger.error(`INVITE received while in state ${this.state}, dropping request`);return}this.pendingReinviteAck=!0;const t=["Contact: "+this._contact];if(e.message.hasHeader("P-Asserted-Identity")){const i=e.message.getHeader("P-Asserted-Identity");if(!i)throw new Error("Header undefined.");this._assertedIdentity=Te.nameAddrHeaderParse(i)}const r={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.generateResponseOfferAnswerInDialog(r).then(i=>{const n=e.accept({statusCode:200,extraHeaders:t,body:i});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,n.message,200)}).catch(i=>{if(this.logger.error(i.message),this.logger.error("Failed to handle to re-INVITE request"),!this.dialog)throw new Error("Dialog undefined.");if(this.logger.error(this.dialog.signalingState),this.dialog.signalingState===U.Stable){const n=e.reject({statusCode:488});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,n.message,488);return}this.rollbackOffer().then(()=>{const n=e.reject({statusCode:488});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,n.message,488)}).catch(n=>{this.logger.error(n.message),this.logger.error("Failed to rollback offer on re-INVITE request");const a=e.reject({statusCode:488});if(this.state!==B.Terminated){if(!this.dialog)throw new Error("Dialog undefined.");const o=[];o.push("Reason: "+this.getReasonHeaderValue(500,"Internal Server Error")),this.dialog.bye(void 0,{extraHeaders:o}),this.stateTransition(B.Terminated)}this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,a.message,488)})})}onMessageRequest(e){if(this.logger.log("Session.onMessageRequest"),this.state!==B.Established){this.logger.error(`MESSAGE received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onMessage){const t=new Sn(e);this.delegate.onMessage(t)}else e.accept()}onNotifyRequest(e){if(this.logger.log("Session.onNotifyRequest"),this.state!==B.Established){this.logger.error(`NOTIFY received while in state ${this.state}, dropping request`);return}if(this.onNotify){const t=new Gs(e);this.onNotify(t);return}if(this.delegate&&this.delegate.onNotify){const t=new Gs(e);this.delegate.onNotify(t)}else e.accept()}onPrackRequest(e){if(this.logger.log("Session.onPrackRequest"),this.state!==B.Established){this.logger.error(`PRACK received while in state ${this.state}, dropping request`);return}throw new Error("Unimplemented.")}onReferRequest(e){if(this.logger.log("Session.onReferRequest"),this.state!==B.Established){this.logger.error(`REFER received while in state ${this.state}, dropping request`);return}if(!e.message.hasHeader("refer-to")){this.logger.warn("Invalid REFER packet. A refer-to header is required. Rejecting."),e.reject();return}const t=new Mo(e,this);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(t):(this.logger.log("No delegate available to handle REFER, automatically accepting and following."),t.accept().then(()=>t.makeInviter(this._referralInviterOptions).invite()).catch(r=>{this.logger.error(r.message)}))}generateResponseOfferAnswer(e,t){if(this.dialog)return this.generateResponseOfferAnswerInDialog(t);const r=Hr(e.message);return!r||r.contentDisposition!=="session"?this.getOffer(t):this.setOfferAndGetAnswer(r,t)}generateResponseOfferAnswerInDialog(e){if(!this.dialog)throw new Error("Dialog undefined.");switch(this.dialog.signalingState){case U.Initial:return this.getOffer(e);case U.HaveLocalOffer:return Promise.resolve(void 0);case U.HaveRemoteOffer:if(!this.dialog.offer)throw new Error(`Session offer undefined in signaling state ${this.dialog.signalingState}.`);return this.setOfferAndGetAnswer(this.dialog.offer,e);case U.Stable:return this.state!==B.Established?Promise.resolve(void 0):this.getOffer(e);case U.Closed:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);default:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}getOffer(e){const t=this.setupSessionDescriptionHandler(),r=e.sessionDescriptionHandlerOptions,i=e.sessionDescriptionHandlerModifiers;try{return t.getDescription(r,i).then(n=>rs(n)).catch(n=>{this.logger.error("Session.getOffer: SDH getDescription rejected...");const a=n instanceof Error?n:new Error("Session.getOffer unknown error.");throw this.logger.error(a.message),a})}catch(n){this.logger.error("Session.getOffer: SDH getDescription threw...");const a=n instanceof Error?n:new Error(n);return this.logger.error(a.message),Promise.reject(a)}}rollbackOffer(){const e=this.setupSessionDescriptionHandler();if(e.rollbackDescription===void 0)return Promise.resolve();try{return e.rollbackDescription().catch(t=>{this.logger.error("Session.rollbackOffer: SDH rollbackDescription rejected...");const r=t instanceof Error?t:new Error("Session.rollbackOffer unknown error.");throw this.logger.error(r.message),r})}catch(t){this.logger.error("Session.rollbackOffer: SDH rollbackDescription threw...");const r=t instanceof Error?t:new Error(t);return this.logger.error(r.message),Promise.reject(r)}}setAnswer(e,t){const r=this.setupSessionDescriptionHandler(),i=t.sessionDescriptionHandlerOptions,n=t.sessionDescriptionHandlerModifiers;try{if(!r.hasDescription(e.contentType))return Promise.reject(new Ls)}catch(a){this.logger.error("Session.setAnswer: SDH hasDescription threw...");const o=a instanceof Error?a:new Error(a);return this.logger.error(o.message),Promise.reject(o)}try{return r.setDescription(e.content,i,n).catch(a=>{this.logger.error("Session.setAnswer: SDH setDescription rejected...");const o=a instanceof Error?a:new Error("Session.setAnswer unknown error.");throw this.logger.error(o.message),o})}catch(a){this.logger.error("Session.setAnswer: SDH setDescription threw...");const o=a instanceof Error?a:new Error(a);return this.logger.error(o.message),Promise.reject(o)}}setOfferAndGetAnswer(e,t){const r=this.setupSessionDescriptionHandler(),i=t.sessionDescriptionHandlerOptions,n=t.sessionDescriptionHandlerModifiers;try{if(!r.hasDescription(e.contentType))return Promise.reject(new Ls)}catch(a){this.logger.error("Session.setOfferAndGetAnswer: SDH hasDescription threw...");const o=a instanceof Error?a:new Error(a);return this.logger.error(o.message),Promise.reject(o)}try{return r.setDescription(e.content,i,n).then(()=>r.getDescription(i,n)).then(a=>rs(a)).catch(a=>{this.logger.error("Session.setOfferAndGetAnswer: SDH setDescription or getDescription rejected...");const o=a instanceof Error?a:new Error("Session.setOfferAndGetAnswer unknown error.");throw this.logger.error(o.message),o})}catch(a){this.logger.error("Session.setOfferAndGetAnswer: SDH setDescription or getDescription threw...");const o=a instanceof Error?a:new Error(a);return this.logger.error(o.message),Promise.reject(o)}}setSessionDescriptionHandler(e){if(this._sessionDescriptionHandler)throw new Error("Session description handler defined.");this._sessionDescriptionHandler=e}setupSessionDescriptionHandler(){var e;return this._sessionDescriptionHandler?this._sessionDescriptionHandler:(this._sessionDescriptionHandler=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions),!((e=this.delegate)===null||e===void 0)&&e.onSessionDescriptionHandler&&this.delegate.onSessionDescriptionHandler(this._sessionDescriptionHandler,!1),this._sessionDescriptionHandler)}stateTransition(e){const t=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case B.Initial:e!==B.Establishing&&e!==B.Established&&e!==B.Terminating&&e!==B.Terminated&&t();break;case B.Establishing:e!==B.Established&&e!==B.Terminating&&e!==B.Terminated&&t();break;case B.Established:e!==B.Terminating&&e!==B.Terminated&&t();break;case B.Terminating:e!==B.Terminated&&t();break;case B.Terminated:t();break;default:throw new Error("Unrecognized state.")}this._state=e,this.logger.log(`Session ${this.id} transitioned to state ${this._state}`),this._stateEventEmitter.emit(this._state),e===B.Terminated&&this.dispose()}copyRequestOptions(e={}){const t=e.extraHeaders?e.extraHeaders.slice():void 0,r=e.body?{contentDisposition:e.body.contentDisposition||"render",contentType:e.body.contentType||"text/plain",content:e.body.content||""}:void 0;return{extraHeaders:t,body:r}}getReasonHeaderValue(e,t){const r=e;let i=es(e);return!i&&t&&(i=t),"SIP;cause="+r+';text="'+i+'"'}referExtraHeaders(e){const t=[];return t.push("Referred-By: <"+this.userAgent.configuration.uri+">"),t.push("Contact: "+this._contact),t.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),t.push("Refer-To: "+e),t}referToString(e){let t;if(e instanceof lt)t=e.toString();else{if(!e.dialog)throw new Error("Dialog undefined.");const r=e.remoteIdentity.friendlyName,i=e.dialog.remoteTarget.toString(),n=e.dialog.callId,a=e.dialog.remoteTag,o=e.dialog.localTag,l=encodeURIComponent(`${n};to-tag=${a};from-tag=${o}`);t=`"${r}" <${i}?Replaces=${l}>`}return t}}var rt;(function(s){s.Required="Required",s.Supported="Supported",s.Unsupported="Unsupported"})(rt=rt||(rt={}));const No={"100rel":!0,199:!0,answermode:!0,"early-session":!0,eventlist:!0,explicitsub:!0,"from-change":!0,"geolocation-http":!0,"geolocation-sip":!0,gin:!0,gruu:!0,histinfo:!0,ice:!0,join:!0,"multiple-refer":!0,norefersub:!0,nosub:!0,outbound:!0,path:!0,policy:!0,precondition:!0,pref:!0,privacy:!0,"recipient-list-invite":!0,"recipient-list-message":!0,"recipient-list-subscribe":!0,replaces:!0,"resource-priority":!0,"sdp-anat":!0,"sec-agree":!0,tdialog:!0,timer:!0,uui:!0};class qo extends Pr{constructor(e,t){super(e),this.incomingInviteRequest=t,this.disposed=!1,this.expiresTimer=void 0,this.isCanceled=!1,this.rel100="none",this.rseq=Math.floor(Math.random()*1e4),this.userNoAnswerTimer=void 0,this.waitingForPrack=!1,this.logger=e.getLogger("sip.Invitation");const r=this.incomingInviteRequest.message,i=r.getHeader("require");i&&i.toLowerCase().includes("100rel")&&(this.rel100="required");const n=r.getHeader("supported");if(n&&n.toLowerCase().includes("100rel")&&(this.rel100="supported"),r.toTag=t.toTag,typeof r.toTag!="string")throw new TypeError("toTag should have been a string.");if(this.userNoAnswerTimer=setTimeout(()=>{t.reject({statusCode:480}),this.stateTransition(B.Terminated)},this.userAgent.configuration.noAnswerTimeout?this.userAgent.configuration.noAnswerTimeout*1e3:6e4),r.hasHeader("expires")){const l=Number(r.getHeader("expires")||0)*1e3;this.expiresTimer=setTimeout(()=>{this.state===B.Initial&&(t.reject({statusCode:487}),this.stateTransition(B.Terminated))},l)}const a=this.request.getHeader("P-Asserted-Identity");a&&(this._assertedIdentity=Te.nameAddrHeaderParse(a)),this._contact=this.userAgent.contact.toString();const o=r.parseHeader("Content-Disposition");o&&o.type==="render"&&(this._renderbody=r.body,this._rendertype=r.getHeader("Content-Type")),this._id=r.callId+r.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.expiresTimer&&(clearTimeout(this.expiresTimer),this.expiresTimer=void 0),this.userNoAnswerTimer&&(clearTimeout(this.userNoAnswerTimer),this.userNoAnswerTimer=void 0),this.prackNeverArrived(),this.state){case B.Initial:return this.reject().then(()=>super.dispose());case B.Establishing:return this.reject().then(()=>super.dispose());case B.Established:return super.dispose();case B.Terminating:return super.dispose();case B.Terminated:return super.dispose();default:throw new Error("Unknown state.")}}get autoSendAnInitialProvisionalResponse(){return this.rel100!=="required"&&this.userAgent.configuration.sendInitialProvisionalResponse}get body(){return this.incomingInviteRequest.message.body}get localIdentity(){return this.request.to}get remoteIdentity(){return this.request.from}get request(){return this.incomingInviteRequest.message}accept(e={}){if(this.logger.log("Invitation.accept"),this.state!==B.Initial){const t=new Error(`Invalid session state ${this.state}`);return this.logger.error(t.message),Promise.reject(t)}return e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),this.stateTransition(B.Establishing),this.sendAccept(e).then(({message:t,session:r})=>{r.delegate={onAck:i=>this.onAckRequest(i),onAckTimeout:()=>this.onAckTimeout(),onBye:i=>this.onByeRequest(i),onInfo:i=>this.onInfoRequest(i),onInvite:i=>this.onInviteRequest(i),onMessage:i=>this.onMessageRequest(i),onNotify:i=>this.onNotifyRequest(i),onPrack:i=>this.onPrackRequest(i),onRefer:i=>this.onReferRequest(i)},this._dialog=r,this.stateTransition(B.Established),this._replacee&&this._replacee._bye()}).catch(t=>this.handleResponseError(t))}progress(e={}){if(this.logger.log("Invitation.progress"),this.state!==B.Initial){const r=new Error(`Invalid session state ${this.state}`);return this.logger.error(r.message),Promise.reject(r)}const t=e.statusCode||180;if(t<100||t>199)throw new TypeError("Invalid statusCode: "+t);return e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),this.waitingForPrack?(this.logger.warn("Unexpected call for progress while waiting for prack, ignoring"),Promise.resolve()):e.statusCode===100?this.sendProgressTrying().then(()=>{}).catch(r=>this.handleResponseError(r)):this.rel100!=="required"&&!(this.rel100==="supported"&&e.rel100)&&!(this.rel100==="supported"&&this.userAgent.configuration.sipExtension100rel===rt.Required)?this.sendProgress(e).then(()=>{}).catch(r=>this.handleResponseError(r)):this.sendProgressReliableWaitForPrack(e).then(()=>{}).catch(r=>this.handleResponseError(r))}reject(e={}){if(this.logger.log("Invitation.reject"),this.state!==B.Initial&&this.state!==B.Establishing){const a=new Error(`Invalid session state ${this.state}`);return this.logger.error(a.message),Promise.reject(a)}const t=e.statusCode||480,r=e.reasonPhrase?e.reasonPhrase:es(t),i=e.extraHeaders||[];if(t<300||t>699)throw new TypeError("Invalid statusCode: "+t);const n=e.body?rs(e.body):void 0;return t<400?this.incomingInviteRequest.redirect([],{statusCode:t,reasonPhrase:r,extraHeaders:i,body:n}):this.incomingInviteRequest.reject({statusCode:t,reasonPhrase:r,extraHeaders:i,body:n}),this.stateTransition(B.Terminated),Promise.resolve()}_onCancel(e){if(this.logger.log("Invitation._onCancel"),this.state!==B.Initial&&this.state!==B.Establishing){this.logger.error(`CANCEL received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onCancel){const t=new ko(e);this.delegate.onCancel(t)}this.isCanceled=!0,this.incomingInviteRequest.reject({statusCode:487}),this.stateTransition(B.Terminated)}handlePrackOfferAnswer(e){if(!this.dialog)throw new Error("Dialog undefined.");const t=Hr(e.message);if(!t||t.contentDisposition!=="session")return Promise.resolve(void 0);const r={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers};switch(this.dialog.signalingState){case U.Initial:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);case U.Stable:return this.setAnswer(t,r).then(()=>{});case U.HaveLocalOffer:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);case U.HaveRemoteOffer:return this.setOfferAndGetAnswer(t,r);case U.Closed:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);default:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}handleResponseError(e){let t=480;if(e instanceof Error?this.logger.error(e.message):this.logger.error(e),e instanceof Ls?(this.logger.error("A session description handler occurred while sending response (content type unsupported"),t=415):e instanceof Ro?this.logger.error("A session description handler occurred while sending response"):e instanceof Ys?this.logger.error("Session ended before response could be formulated and sent (while waiting for PRACK)"):e instanceof Ot&&this.logger.error("Session changed state before response could be formulated and sent"),this.state===B.Initial||this.state===B.Establishing)try{this.incomingInviteRequest.reject({statusCode:t}),this.stateTransition(B.Terminated)}catch(r){throw this.logger.error("An error occurred attempting to reject the request while handling another error"),r}if(this.isCanceled){this.logger.warn("An error occurred while attempting to formulate and send a response to an incoming INVITE. However a CANCEL was received and processed while doing so which can (and often does) result in errors occurring as the session terminates in the meantime. Said error is being ignored.");return}throw e}onAckTimeout(){if(this.logger.log("Invitation.onAckTimeout"),!this.dialog)throw new Error("Dialog undefined.");this.logger.log("No ACK received for an extended period of time, terminating session"),this.dialog.bye(),this.stateTransition(B.Terminated)}sendAccept(e={}){const t={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},r=e.extraHeaders||[];return this.waitingForPrack?this.waitForArrivalOfPrack().then(()=>clearTimeout(this.userNoAnswerTimer)).then(()=>this.generateResponseOfferAnswer(this.incomingInviteRequest,t)).then(i=>this.incomingInviteRequest.accept({statusCode:200,body:i,extraHeaders:r})):(clearTimeout(this.userNoAnswerTimer),this.generateResponseOfferAnswer(this.incomingInviteRequest,t).then(i=>this.incomingInviteRequest.accept({statusCode:200,body:i,extraHeaders:r})))}sendProgress(e={}){const t=e.statusCode||180,r=e.reasonPhrase,i=(e.extraHeaders||[]).slice(),n=e.body?rs(e.body):void 0;if(t===183&&!n)return this.sendProgressWithSDP(e);try{const a=this.incomingInviteRequest.progress({statusCode:t,reasonPhrase:r,extraHeaders:i,body:n});return this._dialog=a.session,Promise.resolve(a)}catch(a){return Promise.reject(a)}}sendProgressWithSDP(e={}){const t={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},r=e.statusCode||183,i=e.reasonPhrase,n=(e.extraHeaders||[]).slice();return this.generateResponseOfferAnswer(this.incomingInviteRequest,t).then(a=>this.incomingInviteRequest.progress({statusCode:r,reasonPhrase:i,extraHeaders:n,body:a})).then(a=>(this._dialog=a.session,a))}sendProgressReliable(e={}){return e.extraHeaders=(e.extraHeaders||[]).slice(),e.extraHeaders.push("Require: 100rel"),e.extraHeaders.push("RSeq: "+Math.floor(Math.random()*1e4)),this.sendProgressWithSDP(e)}sendProgressReliableWaitForPrack(e={}){const t={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},r=e.statusCode||183,i=e.reasonPhrase,n=(e.extraHeaders||[]).slice();n.push("Require: 100rel"),n.push("RSeq: "+this.rseq++);let a;return new Promise((o,l)=>{this.waitingForPrack=!0,this.generateResponseOfferAnswer(this.incomingInviteRequest,t).then(c=>(a=c,this.incomingInviteRequest.progress({statusCode:r,reasonPhrase:i,extraHeaders:n,body:a}))).then(c=>{this._dialog=c.session;let d,g;c.session.delegate={onPrack:x=>{d=x,clearTimeout(E),clearTimeout(_),this.waitingForPrack&&(this.waitingForPrack=!1,this.handlePrackOfferAnswer(d).then(p=>{try{g=d.accept({statusCode:200,body:p}),this.prackArrived(),o({prackRequest:d,prackResponse:g,progressResponse:c})}catch(w){l(w)}}).catch(p=>l(p)))}};const E=setTimeout(()=>{this.waitingForPrack&&(this.waitingForPrack=!1,this.logger.warn("No PRACK received, rejecting INVITE."),clearTimeout(_),this.reject({statusCode:504}).then(()=>l(new Ys)).catch(x=>l(x)))},Re.T1*64),y=()=>{try{this.incomingInviteRequest.progress({statusCode:r,reasonPhrase:i,extraHeaders:n,body:a})}catch(x){this.waitingForPrack=!1,l(x);return}_=setTimeout(y,v*=2)};let v=Re.T1,_=setTimeout(y,v)}).catch(c=>{this.waitingForPrack=!1,l(c)})})}sendProgressTrying(){try{const e=this.incomingInviteRequest.trying();return Promise.resolve(e)}catch(e){return Promise.reject(e)}}waitForArrivalOfPrack(){if(this.waitingForPrackPromise)throw new Error("Already waiting for PRACK");return this.waitingForPrackPromise=new Promise((e,t)=>{this.waitingForPrackResolve=e,this.waitingForPrackReject=t}),this.waitingForPrackPromise}prackArrived(){this.waitingForPrackResolve&&this.waitingForPrackResolve(),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}prackNeverArrived(){this.waitingForPrackReject&&this.waitingForPrackReject(new Ys),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}}class Rn extends Pr{constructor(e,t,r={}){super(e,r),this.disposed=!1,this.earlyMedia=!1,this.earlyMediaSessionDescriptionHandlers=new Map,this.isCanceled=!1,this.inviteWithoutSdp=!1,this.logger=e.getLogger("sip.Inviter"),this.earlyMedia=r.earlyMedia!==void 0?r.earlyMedia:this.earlyMedia,this.fromTag=ts(),this.inviteWithoutSdp=r.inviteWithoutSdp!==void 0?r.inviteWithoutSdp:this.inviteWithoutSdp;const i=Object.assign({},r);i.params=Object.assign({},r.params);const n=r.anonymous||!1,a=e.contact.toString({anonymous:n,outbound:n?!e.contact.tempGruu:!e.contact.pubGruu});n&&e.configuration.uri&&(i.params.fromDisplayName="Anonymous",i.params.fromUri="sip:anonymous@anonymous.invalid");let o=e.userAgentCore.configuration.aor;if(i.params.fromUri&&(o=typeof i.params.fromUri=="string"?Te.URIParse(i.params.fromUri):i.params.fromUri),!o)throw new TypeError("Invalid from URI: "+i.params.fromUri);let l=t;if(i.params.toUri&&(l=typeof i.params.toUri=="string"?Te.URIParse(i.params.toUri):i.params.toUri),!l)throw new TypeError("Invalid to URI: "+i.params.toUri);const c=Object.assign({},i.params);c.fromTag=this.fromTag;const d=(i.extraHeaders||[]).slice();n&&e.configuration.uri&&(d.push("P-Preferred-Identity: "+e.configuration.uri.toString()),d.push("Privacy: id")),d.push("Contact: "+a),d.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),e.configuration.sipExtension100rel===rt.Required&&d.push("Require: 100rel"),e.configuration.sipExtensionReplaces===rt.Required&&d.push("Require: replaces"),i.extraHeaders=d;const g=void 0;this.outgoingRequestMessage=e.userAgentCore.makeOutgoingRequestMessage(j.INVITE,t,o,l,c,d,g),this._contact=a,this._referralInviterOptions=i,this._renderbody=r.renderbody,this._rendertype=r.rendertype,r.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=r.sessionDescriptionHandlerModifiers),r.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=r.sessionDescriptionHandlerOptions),r.sessionDescriptionHandlerModifiersReInvite&&(this.sessionDescriptionHandlerModifiersReInvite=r.sessionDescriptionHandlerModifiersReInvite),r.sessionDescriptionHandlerOptionsReInvite&&(this.sessionDescriptionHandlerOptionsReInvite=r.sessionDescriptionHandlerOptionsReInvite),this._id=this.outgoingRequestMessage.callId+this.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.disposeEarlyMedia(),this.state){case B.Initial:return this.cancel().then(()=>super.dispose());case B.Establishing:return this.cancel().then(()=>super.dispose());case B.Established:return super.dispose();case B.Terminating:return super.dispose();case B.Terminated:return super.dispose();default:throw new Error("Unknown state.")}}get body(){return this.outgoingRequestMessage.body}get localIdentity(){return this.outgoingRequestMessage.from}get remoteIdentity(){return this.outgoingRequestMessage.to}get request(){return this.outgoingRequestMessage}cancel(e={}){if(this.logger.log("Inviter.cancel"),this.state!==B.Initial&&this.state!==B.Establishing){const r=new Error(`Invalid session state ${this.state}`);return this.logger.error(r.message),Promise.reject(r)}this.isCanceled=!0,this.stateTransition(B.Terminating);function t(r,i){if(r&&r<200||r>699)throw new TypeError("Invalid statusCode: "+r);if(r){const n=r,a=es(r)||i;return"SIP;cause="+n+';text="'+a+'"'}}if(this.outgoingInviteRequest){let r;e.statusCode&&e.reasonPhrase&&(r=t(e.statusCode,e.reasonPhrase)),this.outgoingInviteRequest.cancel(r,e)}else this.logger.warn("Canceled session before INVITE was sent"),this.stateTransition(B.Terminated);return Promise.resolve()}invite(e={}){if(this.logger.log("Inviter.invite"),this.state!==B.Initial)return super.invite(e);if(e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),e.withoutSdp||this.inviteWithoutSdp)return this._renderbody&&this._rendertype&&(this.outgoingRequestMessage.body={contentType:this._rendertype,body:this._renderbody}),this.stateTransition(B.Establishing),Promise.resolve(this.sendInvite(e));const t={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.getOffer(t).then(r=>(this.outgoingRequestMessage.body={body:r.content,contentType:r.contentType},this.stateTransition(B.Establishing),this.sendInvite(e))).catch(r=>{throw this.logger.log(r.message),this.state!==B.Terminated&&this.stateTransition(B.Terminated),r})}sendInvite(e={}){return this.outgoingInviteRequest=this.userAgent.userAgentCore.invite(this.outgoingRequestMessage,{onAccept:t=>{if(this.dialog){this.logger.log("Additional confirmed dialog, sending ACK and BYE"),this.ackAndBye(t);return}if(this.isCanceled){this.logger.log("Canceled session accepted, sending ACK and BYE"),this.ackAndBye(t),this.stateTransition(B.Terminated);return}this.notifyReferer(t),this.onAccept(t).then(()=>{this.disposeEarlyMedia()}).catch(()=>{this.disposeEarlyMedia()}).then(()=>{e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(t)})},onProgress:t=>{this.isCanceled||(this.notifyReferer(t),this.onProgress(t).catch(()=>{this.disposeEarlyMedia()}).then(()=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(t)}))},onRedirect:t=>{this.notifyReferer(t),this.onRedirect(t),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(t)},onReject:t=>{this.notifyReferer(t),this.onReject(t),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(t)},onTrying:t=>{this.notifyReferer(t),this.onTrying(t),e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(t)}}),this.outgoingInviteRequest}disposeEarlyMedia(){this.earlyMediaSessionDescriptionHandlers.forEach(e=>{e.close()}),this.earlyMediaSessionDescriptionHandlers.clear()}notifyReferer(e){if(!this._referred)return;if(!(this._referred instanceof Pr))throw new Error("Referred session not instance of session");if(!this._referred.dialog)return;if(!e.message.statusCode)throw new Error("Status code undefined.");if(!e.message.reasonPhrase)throw new Error("Reason phrase undefined.");const t=e.message.statusCode,r=e.message.reasonPhrase,i=`SIP/2.0 ${t} ${r}`.trim(),n=this._referred.dialog.notify(void 0,{extraHeaders:["Event: refer","Subscription-State: terminated"],body:{contentDisposition:"render",contentType:"message/sipfrag",content:i}});n.delegate={onReject:()=>{this._referred=void 0}}}onAccept(e){if(this.logger.log("Inviter.onAccept"),this.state!==B.Establishing)return this.logger.error(`Accept received while in state ${this.state}, dropping response`),Promise.reject(new Error(`Invalid session state ${this.state}`));const t=e.message,r=e.session;switch(t.hasHeader("P-Asserted-Identity")&&(this._assertedIdentity=Te.nameAddrHeaderParse(t.getHeader("P-Asserted-Identity"))),r.delegate={onAck:i=>this.onAckRequest(i),onBye:i=>this.onByeRequest(i),onInfo:i=>this.onInfoRequest(i),onInvite:i=>this.onInviteRequest(i),onMessage:i=>this.onMessageRequest(i),onNotify:i=>this.onNotifyRequest(i),onPrack:i=>this.onPrackRequest(i),onRefer:i=>this.onReferRequest(i)},this._dialog=r,r.signalingState){case U.Initial:return this.logger.error("Received 2xx response to INVITE without a session description"),this.ackAndBye(e,400,"Missing session description"),this.stateTransition(B.Terminated),Promise.reject(new Error("Bad Media Description"));case U.HaveLocalOffer:return this.logger.error("Received 2xx response to INVITE without a session description"),this.ackAndBye(e,400,"Missing session description"),this.stateTransition(B.Terminated),Promise.reject(new Error("Bad Media Description"));case U.HaveRemoteOffer:{if(!this._dialog.offer)throw new Error(`Session offer undefined in signaling state ${this._dialog.signalingState}.`);const i={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setOfferAndGetAnswer(this._dialog.offer,i).then(n=>{e.ack({body:n}),this.stateTransition(B.Established)}).catch(n=>{throw this.ackAndBye(e,488,"Invalid session description"),this.stateTransition(B.Terminated),n})}case U.Stable:{if(this.earlyMediaSessionDescriptionHandlers.size>0){const a=this.earlyMediaSessionDescriptionHandlers.get(r.id);if(!a)throw new Error("Session description handler undefined.");return this.setSessionDescriptionHandler(a),this.earlyMediaSessionDescriptionHandlers.delete(r.id),e.ack(),this.stateTransition(B.Established),Promise.resolve()}if(this.earlyMediaDialog){if(this.earlyMediaDialog!==r){this.earlyMedia&&this.logger.error("You have set the 'earlyMedia' option to 'true' which requires that your INVITE requests do not fork and yet this INVITE request did in fact fork. Consequentially and not surprisingly the end point which accepted the INVITE (confirmed dialog) does not match the end point with which early media has been setup (early dialog) and thus this session is unable to proceed. In accordance with the SIP specifications, the SIP servers your end point is connected to determine if an INVITE forks and the forking behavior of those servers cannot be controlled by this library. If you wish to use early media with this library you must configure those servers accordingly. Alternatively you may set the 'earlyMedia' to 'false' which will allow this library to function with any INVITE requests which do fork.");const a=new Error("Early media dialog does not equal confirmed dialog, terminating session");return this.logger.error(a.message),this.ackAndBye(e,488,"Not Acceptable Here"),this.stateTransition(B.Terminated),Promise.reject(a)}return e.ack(),this.stateTransition(B.Established),Promise.resolve()}const i=r.answer;if(!i)throw new Error("Answer is undefined.");const n={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(i,n).then(()=>{let a;this._renderbody&&this._rendertype&&(a={body:{contentDisposition:"render",contentType:this._rendertype,content:this._renderbody}}),e.ack(a),this.stateTransition(B.Established)}).catch(a=>{throw this.logger.error(a.message),this.ackAndBye(e,488,"Not Acceptable Here"),this.stateTransition(B.Terminated),a})}case U.Closed:return Promise.reject(new Error("Terminated."));default:throw new Error("Unknown session signaling state.")}}onProgress(e){var t;if(this.logger.log("Inviter.onProgress"),this.state!==B.Establishing)return this.logger.error(`Progress received while in state ${this.state}, dropping response`),Promise.reject(new Error(`Invalid session state ${this.state}`));if(!this.outgoingInviteRequest)throw new Error("Outgoing INVITE request undefined.");const r=e.message,i=e.session;r.hasHeader("P-Asserted-Identity")&&(this._assertedIdentity=Te.nameAddrHeaderParse(r.getHeader("P-Asserted-Identity")));const n=r.getHeader("require"),a=r.getHeader("rseq"),l=!!(n&&n.includes("100rel")&&a?Number(a):void 0),c=[];switch(l&&c.push("RAck: "+r.getHeader("rseq")+" "+r.getHeader("cseq")),i.signalingState){case U.Initial:return l&&(this.logger.warn("First reliable provisional response received MUST contain an offer when INVITE does not contain an offer."),e.prack({extraHeaders:c})),Promise.resolve();case U.HaveLocalOffer:return l&&e.prack({extraHeaders:c}),Promise.resolve();case U.HaveRemoteOffer:if(!l)return this.logger.warn("Non-reliable provisional response MUST NOT contain an initial offer, discarding response."),Promise.resolve();{const d=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions||{});return!((t=this.delegate)===null||t===void 0)&&t.onSessionDescriptionHandler&&this.delegate.onSessionDescriptionHandler(d,!0),this.earlyMediaSessionDescriptionHandlers.set(i.id,d),d.setDescription(r.body,this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers).then(()=>d.getDescription(this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers)).then(g=>{const u={contentDisposition:"session",contentType:g.contentType,content:g.body};e.prack({extraHeaders:c,body:u})}).catch(g=>{throw this.stateTransition(B.Terminated),g})}case U.Stable:if(l&&e.prack({extraHeaders:c}),this.earlyMedia&&!this.earlyMediaDialog){this.earlyMediaDialog=i;const d=i.answer;if(!d)throw new Error("Answer is undefined.");const g={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(d,g).catch(u=>{throw this.stateTransition(B.Terminated),u})}return Promise.resolve();case U.Closed:return Promise.reject(new Error("Terminated."));default:throw new Error("Unknown session signaling state.")}}onRedirect(e){if(this.logger.log("Inviter.onRedirect"),this.state!==B.Establishing&&this.state!==B.Terminating){this.logger.error(`Redirect received while in state ${this.state}, dropping response`);return}this.stateTransition(B.Terminated)}onReject(e){if(this.logger.log("Inviter.onReject"),this.state!==B.Establishing&&this.state!==B.Terminating){this.logger.error(`Reject received while in state ${this.state}, dropping response`);return}this.stateTransition(B.Terminated)}onTrying(e){if(this.logger.log("Inviter.onTrying"),this.state!==B.Establishing){this.logger.error(`Trying received while in state ${this.state}, dropping response`);return}}}var le;(function(s){s.Initial="Initial",s.Registered="Registered",s.Unregistered="Unregistered",s.Terminated="Terminated"})(le=le||(le={}));class ut{constructor(e,t={}){this.disposed=!1,this._contacts=[],this._retryAfter=void 0,this._state=le.Initial,this._waiting=!1,this._stateEventEmitter=new Ir,this._waitingEventEmitter=new Ir,this.userAgent=e;const r=e.configuration.uri.clone();if(r.user=void 0,this.options=Object.assign(Object.assign(Object.assign({},ut.defaultOptions()),{registrar:r}),ut.stripUndefinedProperties(t)),this.options.extraContactHeaderParams=(this.options.extraContactHeaderParams||[]).slice(),this.options.extraHeaders=(this.options.extraHeaders||[]).slice(),!this.options.registrar)throw new Error("Registrar undefined.");if(this.options.registrar=this.options.registrar.clone(),this.options.regId&&!this.options.instanceId?this.options.instanceId=this.userAgent.instanceId:!this.options.regId&&this.options.instanceId&&(this.options.regId=1),this.options.instanceId&&Te.parse(this.options.instanceId,"uuid")===-1)throw new Error("Invalid instanceId.");if(this.options.regId&&this.options.regId<0)throw new Error("Invalid regId.");const i=this.options.registrar,n=this.options.params&&this.options.params.fromUri||e.userAgentCore.configuration.aor,a=this.options.params&&this.options.params.toUri||e.configuration.uri,o=this.options.params||{},l=(t.extraHeaders||[]).slice();if(this.request=e.userAgentCore.makeOutgoingRequestMessage(j.REGISTER,i,n,a,o,l,void 0),this.expires=this.options.expires||ut.defaultExpires,this.expires<0)throw new Error("Invalid expires.");if(this.refreshFrequency=this.options.refreshFrequency||ut.defaultRefreshFrequency,this.refreshFrequency<50||this.refreshFrequency>99)throw new Error("Invalid refresh frequency. The value represents a percentage of the expiration time and should be between 50 and 99.");this.logger=e.getLogger("sip.Registerer"),this.options.logConfiguration&&(this.logger.log("Configuration:"),Object.keys(this.options).forEach(c=>{const d=this.options[c];switch(c){case"registrar":this.logger.log("· "+c+": "+d);break;default:this.logger.log("· "+c+": "+JSON.stringify(d))}})),this.id=this.request.callId+this.request.from.parameters.tag,this.userAgent._registerers[this.id]=this}static defaultOptions(){return{expires:ut.defaultExpires,extraContactHeaderParams:[],extraHeaders:[],logConfiguration:!0,instanceId:"",params:{},regId:0,registrar:new lt("sip","anonymous","anonymous.invalid"),refreshFrequency:ut.defaultRefreshFrequency}}static stripUndefinedProperties(e){return Object.keys(e).reduce((t,r)=>(e[r]!==void 0&&(t[r]=e[r]),t),{})}get contacts(){return this._contacts.slice()}get retryAfter(){return this._retryAfter}get state(){return this._state}get stateChange(){return this._stateEventEmitter}dispose(){return this.disposed?Promise.resolve():(this.disposed=!0,this.logger.log(`Registerer ${this.id} in state ${this.state} is being disposed`),delete this.userAgent._registerers[this.id],new Promise(e=>{const t=()=>{if(!this.waiting&&this._state===le.Registered){this.stateChange.addListener(()=>{this.terminated(),e()},{once:!0}),this.unregister();return}this.terminated(),e()};this.waiting?this.waitingChange.addListener(()=>{t()},{once:!0}):t()}))}register(e={}){if(this.state===le.Terminated)throw this.stateError(),new Error("Registerer terminated. Unable to register.");if(this.disposed)throw this.stateError(),new Error("Registerer disposed. Unable to register.");if(this.waiting){this.waitingWarning();const i=new js("REGISTER request already in progress, waiting for final response");return Promise.reject(i)}e.requestOptions&&(this.options=Object.assign(Object.assign({},this.options),e.requestOptions));const t=(this.options.extraHeaders||[]).slice();t.push("Contact: "+this.generateContactHeader(this.expires)),t.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),this.request.cseq++,this.request.setHeader("cseq",this.request.cseq+" REGISTER"),this.request.extraHeaders=t,this.waitingToggle(!0);const r=this.userAgent.userAgentCore.register(this.request,{onAccept:i=>{let n;i.message.hasHeader("expires")&&(n=Number(i.message.getHeader("expires"))),this._contacts=i.message.getHeaders("contact");let a=this._contacts.length;if(!a){this.logger.error("No Contact header in response to REGISTER, dropping response."),this.unregistered();return}let o;for(;a--;){if(o=i.message.parseHeader("contact",a),!o)throw new Error("Contact undefined");if(this.userAgent.contact.pubGruu&&_n(o.uri,this.userAgent.contact.pubGruu)){n=Number(o.getParam("expires"));break}if(this.userAgent.configuration.contactName===""){if(o.uri.user===this.userAgent.contact.uri.user){n=Number(o.getParam("expires"));break}}else if(_n(o.uri,this.userAgent.contact.uri)){n=Number(o.getParam("expires"));break}o=void 0}if(o===void 0){this.logger.error("No Contact header pointing to us, dropping response"),this.unregistered(),this.waitingToggle(!1);return}if(n===void 0){this.logger.error("Contact pointing to us is missing expires parameter, dropping response"),this.unregistered(),this.waitingToggle(!1);return}if(o.hasParam("temp-gruu")){const l=o.getParam("temp-gruu");l&&(this.userAgent.contact.tempGruu=Te.URIParse(l.replace(/"/g,"")))}if(o.hasParam("pub-gruu")){const l=o.getParam("pub-gruu");l&&(this.userAgent.contact.pubGruu=Te.URIParse(l.replace(/"/g,"")))}this.registered(n),e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(i),this.waitingToggle(!1)},onProgress:i=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(i)},onRedirect:i=>{this.logger.error("Redirect received. Not supported."),this.unregistered(),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(i),this.waitingToggle(!1)},onReject:i=>{if(i.message.statusCode===423){if(!i.message.hasHeader("min-expires")){this.logger.error("423 response received for REGISTER without Min-Expires, dropping response"),this.unregistered(),this.waitingToggle(!1);return}this.expires=Number(i.message.getHeader("min-expires")),this.waitingToggle(!1),this.register();return}this.logger.warn(`Failed to register, status code ${i.message.statusCode}`);let n=NaN;if(i.message.statusCode===500||i.message.statusCode===503){const a=i.message.getHeader("retry-after");a&&(n=Number.parseInt(a,void 0))}this._retryAfter=isNaN(n)?void 0:n,this.unregistered(),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(i),this._retryAfter=void 0,this.waitingToggle(!1)},onTrying:i=>{e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(i)}});return Promise.resolve(r)}unregister(e={}){if(this.state===le.Terminated)throw this.stateError(),new Error("Registerer terminated. Unable to register.");if(this.disposed&&this.state!==le.Registered)throw this.stateError(),new Error("Registerer disposed. Unable to register.");if(this.waiting){this.waitingWarning();const i=new js("REGISTER request already in progress, waiting for final response");return Promise.reject(i)}this._state!==le.Registered&&!e.all&&this.logger.warn("Not currently registered, but sending an unregister anyway.");const t=(e.requestOptions&&e.requestOptions.extraHeaders||[]).slice();this.request.extraHeaders=t,e.all?(t.push("Contact: *"),t.push("Expires: 0")):t.push("Contact: "+this.generateContactHeader(0)),this.request.cseq++,this.request.setHeader("cseq",this.request.cseq+" REGISTER"),this.registrationTimer!==void 0&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.waitingToggle(!0);const r=this.userAgent.userAgentCore.register(this.request,{onAccept:i=>{this._contacts=i.message.getHeaders("contact"),this.unregistered(),e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(i),this.waitingToggle(!1)},onProgress:i=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(i)},onRedirect:i=>{this.logger.error("Unregister redirected. Not currently supported."),this.unregistered(),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(i),this.waitingToggle(!1)},onReject:i=>{this.logger.error(`Unregister rejected with status code ${i.message.statusCode}`),this.unregistered(),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(i),this.waitingToggle(!1)},onTrying:i=>{e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(i)}});return Promise.resolve(r)}clearTimers(){this.registrationTimer!==void 0&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.registrationExpiredTimer!==void 0&&(clearTimeout(this.registrationExpiredTimer),this.registrationExpiredTimer=void 0)}generateContactHeader(e){let t=this.userAgent.contact.toString({register:!0});return this.options.regId&&this.options.instanceId&&(t+=";reg-id="+this.options.regId,t+=';+sip.instance="<urn:uuid:'+this.options.instanceId+'>"'),this.options.extraContactHeaderParams&&this.options.extraContactHeaderParams.forEach(r=>{t+=";"+r}),t+=";expires="+e,t}registered(e){this.clearTimers(),this.registrationTimer=setTimeout(()=>{this.registrationTimer=void 0,this.register()},this.refreshFrequency/100*e*1e3),this.registrationExpiredTimer=setTimeout(()=>{this.logger.warn("Registration expired"),this.unregistered()},e*1e3),this._state!==le.Registered&&this.stateTransition(le.Registered)}unregistered(){this.clearTimers(),this._state!==le.Unregistered&&this.stateTransition(le.Unregistered)}terminated(){this.clearTimers(),this._state!==le.Terminated&&this.stateTransition(le.Terminated)}stateTransition(e){const t=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case le.Initial:e!==le.Registered&&e!==le.Unregistered&&e!==le.Terminated&&t();break;case le.Registered:e!==le.Unregistered&&e!==le.Terminated&&t();break;case le.Unregistered:e!==le.Registered&&e!==le.Terminated&&t();break;case le.Terminated:t();break;default:throw new Error("Unrecognized state.")}this._state=e,this.logger.log(`Registration transitioned to state ${this._state}`),this._stateEventEmitter.emit(this._state),e===le.Terminated&&this.dispose()}get waiting(){return this._waiting}get waitingChange(){return this._waitingEventEmitter}waitingToggle(e){if(this._waiting===e)throw new Error(`Invalid waiting transition from ${this._waiting} to ${e}`);this._waiting=e,this.logger.log(`Waiting toggled to ${this._waiting}`),this._waitingEventEmitter.emit(this._waiting)}waitingWarning(){let e="An attempt was made to send a REGISTER request while a prior one was still in progress.";e+=" RFC 3261 requires UAs MUST NOT send a new registration until they have received a final response",e+=" from the registrar for the previous one or the previous REGISTER request has timed out.",e+=" Note that if the transport disconnects, you still must wait for the prior request to time out before",e+=" sending a new REGISTER request or alternatively dispose of the current Registerer and create a new Registerer.",this.logger.warn(e)}stateError(){let t=`An attempt was made to send a REGISTER request when the Registerer ${this.state===le.Terminated?"is in 'Terminated' state":"has been disposed"}.`;t+=" The Registerer transitions to 'Terminated' when Registerer.dispose() is called.",t+=" Perhaps you called UserAgent.stop() which dipsoses of all Registerers?",this.logger.error(t)}}ut.defaultExpires=600,ut.defaultRefreshFrequency=99;var oe;(function(s){s.Initial="Initial",s.NotifyWait="NotifyWait",s.Pending="Pending",s.Active="Active",s.Terminated="Terminated"})(oe=oe||(oe={}));var K;(function(s){s.Connecting="Connecting",s.Connected="Connected",s.Disconnecting="Disconnecting",s.Disconnected="Disconnected"})(K=K||(K={}));var Ie;(function(s){s.Started="Started",s.Stopped="Stopped"})(Ie=Ie||(Ie={}));class be{constructor(){this._dataLength=0,this._bufferLength=0,this._state=new Int32Array(4),this._buffer=new ArrayBuffer(68),this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashStr(e,t=!1){return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(e){const t=be.hexChars,r=be.hexOut;let i,n,a,o;for(o=0;o<4;o+=1)for(n=o*8,i=e[o],a=0;a<8;a+=2)r[n+1+a]=t.charAt(i&15),i>>>=4,r[n+0+a]=t.charAt(i&15),i>>>=4;return r.join("")}static _md5cycle(e,t){let r=e[0],i=e[1],n=e[2],a=e[3];r+=(i&n|~i&a)+t[0]-680876936|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&n)+t[1]-389564586|0,a=(a<<12|a>>>20)+r|0,n+=(a&r|~a&i)+t[2]+606105819|0,n=(n<<17|n>>>15)+a|0,i+=(n&a|~n&r)+t[3]-1044525330|0,i=(i<<22|i>>>10)+n|0,r+=(i&n|~i&a)+t[4]-176418897|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&n)+t[5]+1200080426|0,a=(a<<12|a>>>20)+r|0,n+=(a&r|~a&i)+t[6]-1473231341|0,n=(n<<17|n>>>15)+a|0,i+=(n&a|~n&r)+t[7]-45705983|0,i=(i<<22|i>>>10)+n|0,r+=(i&n|~i&a)+t[8]+1770035416|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&n)+t[9]-1958414417|0,a=(a<<12|a>>>20)+r|0,n+=(a&r|~a&i)+t[10]-42063|0,n=(n<<17|n>>>15)+a|0,i+=(n&a|~n&r)+t[11]-1990404162|0,i=(i<<22|i>>>10)+n|0,r+=(i&n|~i&a)+t[12]+1804603682|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&n)+t[13]-40341101|0,a=(a<<12|a>>>20)+r|0,n+=(a&r|~a&i)+t[14]-1502002290|0,n=(n<<17|n>>>15)+a|0,i+=(n&a|~n&r)+t[15]+1236535329|0,i=(i<<22|i>>>10)+n|0,r+=(i&a|n&~a)+t[1]-165796510|0,r=(r<<5|r>>>27)+i|0,a+=(r&n|i&~n)+t[6]-1069501632|0,a=(a<<9|a>>>23)+r|0,n+=(a&i|r&~i)+t[11]+643717713|0,n=(n<<14|n>>>18)+a|0,i+=(n&r|a&~r)+t[0]-373897302|0,i=(i<<20|i>>>12)+n|0,r+=(i&a|n&~a)+t[5]-701558691|0,r=(r<<5|r>>>27)+i|0,a+=(r&n|i&~n)+t[10]+38016083|0,a=(a<<9|a>>>23)+r|0,n+=(a&i|r&~i)+t[15]-660478335|0,n=(n<<14|n>>>18)+a|0,i+=(n&r|a&~r)+t[4]-405537848|0,i=(i<<20|i>>>12)+n|0,r+=(i&a|n&~a)+t[9]+568446438|0,r=(r<<5|r>>>27)+i|0,a+=(r&n|i&~n)+t[14]-1019803690|0,a=(a<<9|a>>>23)+r|0,n+=(a&i|r&~i)+t[3]-187363961|0,n=(n<<14|n>>>18)+a|0,i+=(n&r|a&~r)+t[8]+1163531501|0,i=(i<<20|i>>>12)+n|0,r+=(i&a|n&~a)+t[13]-1444681467|0,r=(r<<5|r>>>27)+i|0,a+=(r&n|i&~n)+t[2]-51403784|0,a=(a<<9|a>>>23)+r|0,n+=(a&i|r&~i)+t[7]+1735328473|0,n=(n<<14|n>>>18)+a|0,i+=(n&r|a&~r)+t[12]-1926607734|0,i=(i<<20|i>>>12)+n|0,r+=(i^n^a)+t[5]-378558|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^n)+t[8]-2022574463|0,a=(a<<11|a>>>21)+r|0,n+=(a^r^i)+t[11]+1839030562|0,n=(n<<16|n>>>16)+a|0,i+=(n^a^r)+t[14]-35309556|0,i=(i<<23|i>>>9)+n|0,r+=(i^n^a)+t[1]-1530992060|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^n)+t[4]+1272893353|0,a=(a<<11|a>>>21)+r|0,n+=(a^r^i)+t[7]-155497632|0,n=(n<<16|n>>>16)+a|0,i+=(n^a^r)+t[10]-1094730640|0,i=(i<<23|i>>>9)+n|0,r+=(i^n^a)+t[13]+681279174|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^n)+t[0]-358537222|0,a=(a<<11|a>>>21)+r|0,n+=(a^r^i)+t[3]-722521979|0,n=(n<<16|n>>>16)+a|0,i+=(n^a^r)+t[6]+76029189|0,i=(i<<23|i>>>9)+n|0,r+=(i^n^a)+t[9]-640364487|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^n)+t[12]-421815835|0,a=(a<<11|a>>>21)+r|0,n+=(a^r^i)+t[15]+530742520|0,n=(n<<16|n>>>16)+a|0,i+=(n^a^r)+t[2]-995338651|0,i=(i<<23|i>>>9)+n|0,r+=(n^(i|~a))+t[0]-198630844|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~n))+t[7]+1126891415|0,a=(a<<10|a>>>22)+r|0,n+=(r^(a|~i))+t[14]-1416354905|0,n=(n<<15|n>>>17)+a|0,i+=(a^(n|~r))+t[5]-57434055|0,i=(i<<21|i>>>11)+n|0,r+=(n^(i|~a))+t[12]+1700485571|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~n))+t[3]-1894986606|0,a=(a<<10|a>>>22)+r|0,n+=(r^(a|~i))+t[10]-1051523|0,n=(n<<15|n>>>17)+a|0,i+=(a^(n|~r))+t[1]-2054922799|0,i=(i<<21|i>>>11)+n|0,r+=(n^(i|~a))+t[8]+1873313359|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~n))+t[15]-30611744|0,a=(a<<10|a>>>22)+r|0,n+=(r^(a|~i))+t[6]-1560198380|0,n=(n<<15|n>>>17)+a|0,i+=(a^(n|~r))+t[13]+1309151649|0,i=(i<<21|i>>>11)+n|0,r+=(n^(i|~a))+t[4]-145523070|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~n))+t[11]-1120210379|0,a=(a<<10|a>>>22)+r|0,n+=(r^(a|~i))+t[2]+718787259|0,n=(n<<15|n>>>17)+a|0,i+=(a^(n|~r))+t[9]-343485551|0,i=(i<<21|i>>>11)+n|0,e[0]=r+e[0]|0,e[1]=i+e[1]|0,e[2]=n+e[2]|0,e[3]=a+e[3]|0}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(be.stateIdentity),this}appendStr(e){const t=this._buffer8,r=this._buffer32;let i=this._bufferLength,n,a;for(a=0;a<e.length;a+=1){if(n=e.charCodeAt(a),n<128)t[i++]=n;else if(n<2048)t[i++]=(n>>>6)+192,t[i++]=n&63|128;else if(n<55296||n>56319)t[i++]=(n>>>12)+224,t[i++]=n>>>6&63|128,t[i++]=n&63|128;else{if(n=(n-55296)*1024+(e.charCodeAt(++a)-56320)+65536,n>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");t[i++]=(n>>>18)+240,t[i++]=n>>>12&63|128,t[i++]=n>>>6&63|128,t[i++]=n&63|128}i>=64&&(this._dataLength+=64,be._md5cycle(this._state,r),i-=64,r[0]=r[16])}return this._bufferLength=i,this}appendAsciiStr(e){const t=this._buffer8,r=this._buffer32;let i=this._bufferLength,n,a=0;for(;;){for(n=Math.min(e.length-a,64-i);n--;)t[i++]=e.charCodeAt(a++);if(i<64)break;this._dataLength+=64,be._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}appendByteArray(e){const t=this._buffer8,r=this._buffer32;let i=this._bufferLength,n,a=0;for(;;){for(n=Math.min(e.length-a,64-i);n--;)t[i++]=e[a++];if(i<64)break;this._dataLength+=64,be._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}getState(){const e=this,t=e._state;return{buffer:String.fromCharCode.apply(null,e._buffer8),buflen:e._bufferLength,length:e._dataLength,state:[t[0],t[1],t[2],t[3]]}}setState(e){const t=e.buffer,r=e.state,i=this._state;let n;for(this._dataLength=e.length,this._bufferLength=e.buflen,i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],n=0;n<t.length;n+=1)this._buffer8[n]=t.charCodeAt(n)}end(e=!1){const t=this._bufferLength,r=this._buffer8,i=this._buffer32,n=(t>>2)+1;let a;if(this._dataLength+=t,r[t]=128,r[t+1]=r[t+2]=r[t+3]=0,i.set(be.buffer32Identity.subarray(n),n),t>55&&(be._md5cycle(this._state,i),i.set(be.buffer32Identity)),a=this._dataLength*8,a<=4294967295)i[14]=a;else{const o=a.toString(16).match(/(.*?)(.{0,8})$/);if(o===null)return;const l=parseInt(o[2],16),c=parseInt(o[1],16)||0;i[14]=l,i[15]=c}return be._md5cycle(this._state,i),e?this._state:be._hex(this._state)}}be.stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]),be.buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),be.hexChars="0123456789abcdef",be.hexOut=[],be.onePassHasher=new be,be.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592"&&console.error("Md5 self test failed.");function Nt(s){return be.hashStr(s)}class Uo{constructor(e,t,r,i){this.logger=e.getLogger("sipjs.digestauthentication"),this.username=r,this.password=i,this.ha1=t,this.nc=0,this.ncHex="00000000"}authenticate(e,t,r){if(this.algorithm=t.algorithm,this.realm=t.realm,this.nonce=t.nonce,this.opaque=t.opaque,this.stale=t.stale,this.algorithm){if(this.algorithm!=="MD5")return this.logger.warn("challenge with Digest algorithm different than 'MD5', authentication aborted"),!1}else this.algorithm="MD5";if(!this.realm)return this.logger.warn("challenge without Digest realm, authentication aborted"),!1;if(!this.nonce)return this.logger.warn("challenge without Digest nonce, authentication aborted"),!1;if(t.qop)if(t.qop.indexOf("auth")>-1)this.qop="auth";else if(t.qop.indexOf("auth-int")>-1)this.qop="auth-int";else return this.logger.warn("challenge without Digest qop different than 'auth' or 'auth-int', authentication aborted"),!1;else this.qop=void 0;return this.method=e.method,this.uri=e.ruri,this.cnonce=Qt(12),this.nc+=1,this.updateNcHex(),this.nc===4294967296&&(this.nc=1,this.ncHex="00000001"),this.calculateResponse(r),!0}toString(){const e=[];if(!this.response)throw new Error("response field does not exist, cannot generate Authorization header");return e.push("algorithm="+this.algorithm),e.push('username="'+this.username+'"'),e.push('realm="'+this.realm+'"'),e.push('nonce="'+this.nonce+'"'),e.push('uri="'+this.uri+'"'),e.push('response="'+this.response+'"'),this.opaque&&e.push('opaque="'+this.opaque+'"'),this.qop&&(e.push("qop="+this.qop),e.push('cnonce="'+this.cnonce+'"'),e.push("nc="+this.ncHex)),"Digest "+e.join(", ")}updateNcHex(){const e=Number(this.nc).toString(16);this.ncHex="00000000".substr(0,8-e.length)+e}calculateResponse(e){let t,r;t=this.ha1,(t===""||t===void 0)&&(t=Nt(this.username+":"+this.realm+":"+this.password)),this.qop==="auth"?(r=Nt(this.method+":"+this.uri),this.response=Nt(t+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth:"+r)):this.qop==="auth-int"?(r=Nt(this.method+":"+this.uri+":"+Nt(e||"")),this.response=Nt(t+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth-int:"+r)):this.qop===void 0&&(r=Nt(this.method+":"+this.uri),this.response=Nt(t+":"+this.nonce+":"+r))}}var Fe;(function(s){s[s.error=0]="error",s[s.warn=1]="warn",s[s.log=2]="log",s[s.debug=3]="debug"})(Fe=Fe||(Fe={}));class Fn{constructor(e,t,r){this.logger=e,this.category=t,this.label=r}error(e){this.genericLog(Fe.error,e)}warn(e){this.genericLog(Fe.warn,e)}log(e){this.genericLog(Fe.log,e)}debug(e){this.genericLog(Fe.debug,e)}genericLog(e,t){this.logger.genericLog(e,this.category,this.label,t)}get level(){return this.logger.level}set level(e){this.logger.level=e}}class Lo{constructor(){this.builtinEnabled=!0,this._level=Fe.log,this.loggers={},this.logger=this.getLogger("sip:loggerfactory")}get level(){return this._level}set level(e){e>=0&&e<=3?this._level=e:e>3?this._level=3:Fe.hasOwnProperty(e)?this._level=e:this.logger.error("invalid 'level' parameter value: "+JSON.stringify(e))}get connector(){return this._connector}set connector(e){e?typeof e=="function"?this._connector=e:this.logger.error("invalid 'connector' parameter value: "+JSON.stringify(e)):this._connector=void 0}getLogger(e,t){if(t&&this.level===3)return new Fn(this,e,t);if(this.loggers[e])return this.loggers[e];{const r=new Fn(this,e);return this.loggers[e]=r,r}}genericLog(e,t,r,i){this.level>=e&&this.builtinEnabled&&this.print(e,t,r,i),this.connector&&this.connector(Fe[e],t,r,i)}print(e,t,r,i){if(typeof i=="string"){const n=[new Date,t];r&&n.push(r),i=n.concat(i).join(" | ")}switch(e){case Fe.error:console.error(i);break;case Fe.warn:console.warn(i);break;case Fe.log:console.log(i);break;case Fe.debug:console.debug(i);break}}}var ss;(function(s){function e(i,n){let a=n,o=0,l=0;if(i.substring(a,a+2).match(/(^\r\n)/))return-2;for(;o===0;){if(l=i.indexOf(`\r
|
|
52
|
+
`,e}}function bn(s){return s==="application/sdp"?"session":"render"}function rs(s){const e=typeof s=="string"?s:s.body,t=typeof s=="string"?"application/sdp":s.contentType;return{contentDisposition:bn(t),contentType:t,content:e}}function An(s){return s&&typeof s.content=="string"&&typeof s.contentType=="string"&&s.contentDisposition===void 0?!0:typeof s.contentDisposition=="string"}function Hr(s){let e,t,r;if(s instanceof gr&&s.body){const i=s.parseHeader("Content-Disposition");e=i?i.type:void 0,t=s.parseHeader("Content-Type"),r=s.body}if(s instanceof Pt&&s.body){const i=s.parseHeader("Content-Disposition");e=i?i.type:void 0,t=s.parseHeader("Content-Type"),r=s.body}if(s instanceof er&&s.body)if(e=s.getHeader("Content-Disposition"),t=s.getHeader("Content-Type"),typeof s.body=="string"){if(!t)throw new Error("Header content type header does not equal body content type.");r=s.body}else{if(t&&t!==s.body.contentType)throw new Error("Header content type header does not equal body content type.");t=s.body.contentType,r=s.body.body}if(An(s)&&(e=s.contentDisposition,t=s.contentType,r=s.content),!!r){if(t&&!e&&(e=bn(t)),!e)throw new Error("Content disposition undefined.");if(!t)throw new Error("Content type undefined.");return{contentDisposition:e,contentType:t,content:r}}}var Je;(function(s){s.Initial="Initial",s.Early="Early",s.AckWait="AckWait",s.Confirmed="Confirmed",s.Terminated="Terminated"})(Je=Je||(Je={}));var U;(function(s){s.Initial="Initial",s.HaveLocalOffer="HaveLocalOffer",s.HaveRemoteOffer="HaveRemoteOffer",s.Stable="Stable",s.Closed="Closed"})(U=U||(U={}));const wt=500,Oo=4e3,Tn=5e3,Re={T1:wt,T2:Oo,TIMER_B:64*wt,TIMER_D:0*wt,TIMER_F:64*wt,TIMER_H:64*wt,TIMER_I:0*Tn,TIMER_J:0*wt,TIMER_K:0*Tn,TIMER_L:64*wt,TIMER_M:64*wt,TIMER_N:64*wt,PROVISIONAL_RESPONSE_INTERVAL:6e4};class Ot extends Xt{constructor(e){super(e||"Transaction state error.")}}var j;(function(s){s.ACK="ACK",s.BYE="BYE",s.CANCEL="CANCEL",s.INFO="INFO",s.INVITE="INVITE",s.MESSAGE="MESSAGE",s.NOTIFY="NOTIFY",s.OPTIONS="OPTIONS",s.REGISTER="REGISTER",s.UPDATE="UPDATE",s.SUBSCRIBE="SUBSCRIBE",s.PUBLISH="PUBLISH",s.REFER="REFER",s.PRACK="PRACK"})(j=j||(j={}));const Mt=[j.ACK,j.BYE,j.CANCEL,j.INFO,j.INVITE,j.MESSAGE,j.NOTIFY,j.OPTIONS,j.PRACK,j.REFER,j.REGISTER,j.SUBSCRIBE];class Sn{constructor(e){this.incomingMessageRequest=e}get request(){return this.incomingMessageRequest.message}accept(e){return this.incomingMessageRequest.accept(e),Promise.resolve()}reject(e){return this.incomingMessageRequest.reject(e),Promise.resolve()}}class Gs{constructor(e){this.incomingNotifyRequest=e}get request(){return this.incomingNotifyRequest.message}accept(e){return this.incomingNotifyRequest.accept(e),Promise.resolve()}reject(e){return this.incomingNotifyRequest.reject(e),Promise.resolve()}}class Mo{constructor(e,t){this.incomingReferRequest=e,this.session=t}get referTo(){const e=this.incomingReferRequest.message.parseHeader("refer-to");if(!(e instanceof Le))throw new Error("Failed to parse Refer-To header.");return e}get referredBy(){return this.incomingReferRequest.message.getHeader("referred-by")}get replaces(){const e=this.referTo.uri.getHeader("replaces");return e instanceof Array?e[0]:e}get request(){return this.incomingReferRequest.message}accept(e={statusCode:202}){return this.incomingReferRequest.accept(e),Promise.resolve()}reject(e){return this.incomingReferRequest.reject(e),Promise.resolve()}makeInviter(e){if(this.inviter)return this.inviter;const t=this.referTo.uri.clone();t.clearHeaders(),e=e||{};const r=(e.extraHeaders||[]).slice(),i=this.replaces;i&&r.push("Replaces: "+decodeURIComponent(i));const n=this.referredBy;return n&&r.push("Referred-By: "+n),e.extraHeaders=r,this.inviter=this.session.userAgent._makeInviter(t,e),this.inviter._referred=this.session,this.session._referral=this.inviter,this.inviter}}var B;(function(s){s.Initial="Initial",s.Establishing="Establishing",s.Established="Established",s.Terminating="Terminating",s.Terminated="Terminated"})(B=B||(B={}));class Pr{constructor(e,t={}){this.pendingReinvite=!1,this.pendingReinviteAck=!1,this._state=B.Initial,this.delegate=t.delegate,this._stateEventEmitter=new Ir,this._userAgent=e}dispose(){switch(this.logger.log(`Session ${this.id} in state ${this._state} is being disposed`),delete this.userAgent._sessions[this.id],this._sessionDescriptionHandler&&this._sessionDescriptionHandler.close(),this.state){case B.Initial:break;case B.Establishing:break;case B.Established:return new Promise(e=>{this._bye({onAccept:()=>e(),onRedirect:()=>e(),onReject:()=>e()})});case B.Terminating:break;case B.Terminated:break;default:throw new Error("Unknown state.")}return Promise.resolve()}get assertedIdentity(){return this._assertedIdentity}get dialog(){return this._dialog}get id(){return this._id}get replacee(){return this._replacee}get sessionDescriptionHandler(){return this._sessionDescriptionHandler}get sessionDescriptionHandlerFactory(){return this.userAgent.configuration.sessionDescriptionHandlerFactory}get sessionDescriptionHandlerModifiers(){return this._sessionDescriptionHandlerModifiers||[]}set sessionDescriptionHandlerModifiers(e){this._sessionDescriptionHandlerModifiers=e.slice()}get sessionDescriptionHandlerOptions(){return this._sessionDescriptionHandlerOptions||{}}set sessionDescriptionHandlerOptions(e){this._sessionDescriptionHandlerOptions=Object.assign({},e)}get sessionDescriptionHandlerModifiersReInvite(){return this._sessionDescriptionHandlerModifiersReInvite||[]}set sessionDescriptionHandlerModifiersReInvite(e){this._sessionDescriptionHandlerModifiersReInvite=e.slice()}get sessionDescriptionHandlerOptionsReInvite(){return this._sessionDescriptionHandlerOptionsReInvite||{}}set sessionDescriptionHandlerOptionsReInvite(e){this._sessionDescriptionHandlerOptionsReInvite=Object.assign({},e)}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get userAgent(){return this._userAgent}bye(e={}){let t="Session.bye() may only be called if established session.";switch(this.state){case B.Initial:typeof this.cancel=="function"?(t+=" However Inviter.invite() has not yet been called.",t+=" Perhaps you should have called Inviter.cancel()?"):typeof this.reject=="function"&&(t+=" However Invitation.accept() has not yet been called.",t+=" Perhaps you should have called Invitation.reject()?");break;case B.Establishing:typeof this.cancel=="function"?(t+=" However a dialog does not yet exist.",t+=" Perhaps you should have called Inviter.cancel()?"):typeof this.reject=="function"&&(t+=" However Invitation.accept() has not yet been called (or not yet resolved).",t+=" Perhaps you should have called Invitation.reject()?");break;case B.Established:{const r=e.requestDelegate,i=this.copyRequestOptions(e.requestOptions);return this._bye(r,i)}case B.Terminating:t+=" However this session is already terminating.",typeof this.cancel=="function"?t+=" Perhaps you have already called Inviter.cancel()?":typeof this.reject=="function"&&(t+=" Perhaps you have already called Session.bye()?");break;case B.Terminated:t+=" However this session is already terminated.";break;default:throw new Error("Unknown state")}return this.logger.error(t),Promise.reject(new Error(`Invalid session state ${this.state}`))}info(e={}){if(this.state!==B.Established)return this.logger.error("Session.info() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));const t=e.requestDelegate,r=this.copyRequestOptions(e.requestOptions);return this._info(t,r)}invite(e={}){if(this.logger.log("Session.invite"),this.state!==B.Established)return Promise.reject(new Error(`Invalid session state ${this.state}`));if(this.pendingReinvite)return Promise.reject(new js("Reinvite in progress. Please wait until complete, then try again."));this.pendingReinvite=!0,e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiersReInvite=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptionsReInvite=e.sessionDescriptionHandlerOptions);const t={onAccept:n=>{const a=Hr(n.message);if(!a){this.logger.error("Received 2xx response to re-INVITE without a session description"),this.ackAndBye(n,400,"Missing session description"),this.stateTransition(B.Terminated),this.pendingReinvite=!1;return}if(e.withoutSdp){const o={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setOfferAndGetAnswer(a,o).then(l=>{n.ack({body:l})}).catch(l=>{this.logger.error("Failed to handle offer in 2xx response to re-INVITE"),this.logger.error(l.message),this.state===B.Terminated?n.ack():(this.ackAndBye(n,488,"Bad Media Description"),this.stateTransition(B.Terminated))}).then(()=>{this.pendingReinvite=!1,e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(n)})}else{const o={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setAnswer(a,o).then(()=>{n.ack()}).catch(l=>{this.logger.error("Failed to handle answer in 2xx response to re-INVITE"),this.logger.error(l.message),this.state!==B.Terminated?(this.ackAndBye(n,488,"Bad Media Description"),this.stateTransition(B.Terminated)):n.ack()}).then(()=>{this.pendingReinvite=!1,e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(n)})}},onProgress:n=>{},onRedirect:n=>{},onReject:n=>{this.logger.warn("Received a non-2xx response to re-INVITE"),this.pendingReinvite=!1,e.withoutSdp?e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(n):this.rollbackOffer().catch(a=>{if(this.logger.error("Failed to rollback offer on non-2xx response to re-INVITE"),this.logger.error(a.message),this.state!==B.Terminated){if(!this.dialog)throw new Error("Dialog undefined.");const o=[];o.push("Reason: "+this.getReasonHeaderValue(500,"Internal Server Error")),this.dialog.bye(void 0,{extraHeaders:o}),this.stateTransition(B.Terminated)}}).then(()=>{e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(n)})},onTrying:n=>{}},r=e.requestOptions||{};if(r.extraHeaders=(r.extraHeaders||[]).slice(),r.extraHeaders.push("Allow: "+Mt.toString()),r.extraHeaders.push("Contact: "+this._contact),e.withoutSdp){if(!this.dialog)throw this.pendingReinvite=!1,new Error("Dialog undefined.");return Promise.resolve(this.dialog.invite(t,r))}const i={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};return this.getOffer(i).then(n=>{if(!this.dialog)throw this.pendingReinvite=!1,new Error("Dialog undefined.");return r.body=n,this.dialog.invite(t,r)}).catch(n=>{throw this.logger.error(n.message),this.logger.error("Failed to send re-INVITE"),this.pendingReinvite=!1,n})}message(e={}){if(this.state!==B.Established)return this.logger.error("Session.message() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));const t=e.requestDelegate,r=this.copyRequestOptions(e.requestOptions);return this._message(t,r)}refer(e,t={}){if(this.state!==B.Established)return this.logger.error("Session.refer() may only be called if established session."),Promise.reject(new Error(`Invalid session state ${this.state}`));if(e instanceof Pr&&!e.dialog)return this.logger.error("Session.refer() may only be called with session which is established. You are perhaps attempting to attended transfer to a target for which there is not dialog yet established. Perhaps you are attempting a 'semi-attended' tansfer? Regardless, this is not supported. The recommended approached is to check to see if the target Session is in the Established state before calling refer(); if the state is not Established you may proceed by falling back using a URI as the target (blind transfer)."),Promise.reject(new Error(`Invalid session state ${this.state}`));const r=t.requestDelegate,i=this.copyRequestOptions(t.requestOptions);return i.extraHeaders=i.extraHeaders?i.extraHeaders.concat(this.referExtraHeaders(this.referToString(e))):this.referExtraHeaders(this.referToString(e)),this._refer(t.onNotify,r,i)}_bye(e,t){if(!this.dialog)return Promise.reject(new Error("Session dialog undefined."));const r=this.dialog;switch(r.sessionState){case Je.Initial:throw new Error(`Invalid dialog state ${r.sessionState}`);case Je.Early:throw new Error(`Invalid dialog state ${r.sessionState}`);case Je.AckWait:return this.stateTransition(B.Terminating),new Promise(i=>{r.delegate={onAck:()=>{const n=r.bye(e,t);return this.stateTransition(B.Terminated),i(n),Promise.resolve()},onAckTimeout:()=>{const n=r.bye(e,t);this.stateTransition(B.Terminated),i(n)}}});case Je.Confirmed:{const i=r.bye(e,t);return this.stateTransition(B.Terminated),Promise.resolve(i)}case Je.Terminated:throw new Error(`Invalid dialog state ${r.sessionState}`);default:throw new Error("Unrecognized state.")}}_info(e,t){return this.dialog?Promise.resolve(this.dialog.info(e,t)):Promise.reject(new Error("Session dialog undefined."))}_message(e,t){return this.dialog?Promise.resolve(this.dialog.message(e,t)):Promise.reject(new Error("Session dialog undefined."))}_refer(e,t,r){return this.dialog?(this.onNotify=e,Promise.resolve(this.dialog.refer(t,r))):Promise.reject(new Error("Session dialog undefined."))}ackAndBye(e,t,r){e.ack();const i=[];t&&i.push("Reason: "+this.getReasonHeaderValue(t,r)),e.session.bye(void 0,{extraHeaders:i})}onAckRequest(e){if(this.logger.log("Session.onAckRequest"),this.state!==B.Established&&this.state!==B.Terminating)return this.logger.error(`ACK received while in state ${this.state}, dropping request`),Promise.resolve();const t=this.dialog;if(!t)throw new Error("Dialog undefined.");const r={sessionDescriptionHandlerOptions:this.pendingReinviteAck?this.sessionDescriptionHandlerOptionsReInvite:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.pendingReinviteAck?this._sessionDescriptionHandlerModifiersReInvite:this._sessionDescriptionHandlerModifiers};if(this.delegate&&this.delegate.onAck){const i=new Fo(e);this.delegate.onAck(i)}switch(this.pendingReinviteAck=!1,t.signalingState){case U.Initial:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);const i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return t.bye(void 0,{extraHeaders:i}),this.stateTransition(B.Terminated),Promise.resolve()}case U.Stable:{const i=Hr(e.message);return i?i.contentDisposition==="render"?(this._renderbody=i.content,this._rendertype=i.contentType,Promise.resolve()):i.contentDisposition!=="session"?Promise.resolve():this.setAnswer(i,r).catch(n=>{this.logger.error(n.message);const a=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];t.bye(void 0,{extraHeaders:a}),this.stateTransition(B.Terminated)}):Promise.resolve()}case U.HaveLocalOffer:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);const i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return t.bye(void 0,{extraHeaders:i}),this.stateTransition(B.Terminated),Promise.resolve()}case U.HaveRemoteOffer:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);const i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return t.bye(void 0,{extraHeaders:i}),this.stateTransition(B.Terminated),Promise.resolve()}case U.Closed:throw new Error(`Invalid signaling state ${t.signalingState}.`);default:throw new Error(`Invalid signaling state ${t.signalingState}.`)}}onByeRequest(e){if(this.logger.log("Session.onByeRequest"),this.state!==B.Established){this.logger.error(`BYE received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onBye){const t=new Bo(e);this.delegate.onBye(t)}else e.accept();this.stateTransition(B.Terminated)}onInfoRequest(e){if(this.logger.log("Session.onInfoRequest"),this.state!==B.Established){this.logger.error(`INFO received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onInfo){const t=new Io(e);this.delegate.onInfo(t)}else e.accept()}onInviteRequest(e){if(this.logger.log("Session.onInviteRequest"),this.state!==B.Established){this.logger.error(`INVITE received while in state ${this.state}, dropping request`);return}this.pendingReinviteAck=!0;const t=["Contact: "+this._contact];if(e.message.hasHeader("P-Asserted-Identity")){const i=e.message.getHeader("P-Asserted-Identity");if(!i)throw new Error("Header undefined.");this._assertedIdentity=Te.nameAddrHeaderParse(i)}const r={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.generateResponseOfferAnswerInDialog(r).then(i=>{const n=e.accept({statusCode:200,extraHeaders:t,body:i});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,n.message,200)}).catch(i=>{if(this.logger.error(i.message),this.logger.error("Failed to handle to re-INVITE request"),!this.dialog)throw new Error("Dialog undefined.");if(this.logger.error(this.dialog.signalingState),this.dialog.signalingState===U.Stable){const n=e.reject({statusCode:488});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,n.message,488);return}this.rollbackOffer().then(()=>{const n=e.reject({statusCode:488});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,n.message,488)}).catch(n=>{this.logger.error(n.message),this.logger.error("Failed to rollback offer on re-INVITE request");const a=e.reject({statusCode:488});if(this.state!==B.Terminated){if(!this.dialog)throw new Error("Dialog undefined.");const o=[];o.push("Reason: "+this.getReasonHeaderValue(500,"Internal Server Error")),this.dialog.bye(void 0,{extraHeaders:o}),this.stateTransition(B.Terminated)}this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,a.message,488)})})}onMessageRequest(e){if(this.logger.log("Session.onMessageRequest"),this.state!==B.Established){this.logger.error(`MESSAGE received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onMessage){const t=new Sn(e);this.delegate.onMessage(t)}else e.accept()}onNotifyRequest(e){if(this.logger.log("Session.onNotifyRequest"),this.state!==B.Established){this.logger.error(`NOTIFY received while in state ${this.state}, dropping request`);return}if(this.onNotify){const t=new Gs(e);this.onNotify(t);return}if(this.delegate&&this.delegate.onNotify){const t=new Gs(e);this.delegate.onNotify(t)}else e.accept()}onPrackRequest(e){if(this.logger.log("Session.onPrackRequest"),this.state!==B.Established){this.logger.error(`PRACK received while in state ${this.state}, dropping request`);return}throw new Error("Unimplemented.")}onReferRequest(e){if(this.logger.log("Session.onReferRequest"),this.state!==B.Established){this.logger.error(`REFER received while in state ${this.state}, dropping request`);return}if(!e.message.hasHeader("refer-to")){this.logger.warn("Invalid REFER packet. A refer-to header is required. Rejecting."),e.reject();return}const t=new Mo(e,this);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(t):(this.logger.log("No delegate available to handle REFER, automatically accepting and following."),t.accept().then(()=>t.makeInviter(this._referralInviterOptions).invite()).catch(r=>{this.logger.error(r.message)}))}generateResponseOfferAnswer(e,t){if(this.dialog)return this.generateResponseOfferAnswerInDialog(t);const r=Hr(e.message);return!r||r.contentDisposition!=="session"?this.getOffer(t):this.setOfferAndGetAnswer(r,t)}generateResponseOfferAnswerInDialog(e){if(!this.dialog)throw new Error("Dialog undefined.");switch(this.dialog.signalingState){case U.Initial:return this.getOffer(e);case U.HaveLocalOffer:return Promise.resolve(void 0);case U.HaveRemoteOffer:if(!this.dialog.offer)throw new Error(`Session offer undefined in signaling state ${this.dialog.signalingState}.`);return this.setOfferAndGetAnswer(this.dialog.offer,e);case U.Stable:return this.state!==B.Established?Promise.resolve(void 0):this.getOffer(e);case U.Closed:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);default:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}getOffer(e){const t=this.setupSessionDescriptionHandler(),r=e.sessionDescriptionHandlerOptions,i=e.sessionDescriptionHandlerModifiers;try{return t.getDescription(r,i).then(n=>rs(n)).catch(n=>{this.logger.error("Session.getOffer: SDH getDescription rejected...");const a=n instanceof Error?n:new Error("Session.getOffer unknown error.");throw this.logger.error(a.message),a})}catch(n){this.logger.error("Session.getOffer: SDH getDescription threw...");const a=n instanceof Error?n:new Error(n);return this.logger.error(a.message),Promise.reject(a)}}rollbackOffer(){const e=this.setupSessionDescriptionHandler();if(e.rollbackDescription===void 0)return Promise.resolve();try{return e.rollbackDescription().catch(t=>{this.logger.error("Session.rollbackOffer: SDH rollbackDescription rejected...");const r=t instanceof Error?t:new Error("Session.rollbackOffer unknown error.");throw this.logger.error(r.message),r})}catch(t){this.logger.error("Session.rollbackOffer: SDH rollbackDescription threw...");const r=t instanceof Error?t:new Error(t);return this.logger.error(r.message),Promise.reject(r)}}setAnswer(e,t){const r=this.setupSessionDescriptionHandler(),i=t.sessionDescriptionHandlerOptions,n=t.sessionDescriptionHandlerModifiers;try{if(!r.hasDescription(e.contentType))return Promise.reject(new Ls)}catch(a){this.logger.error("Session.setAnswer: SDH hasDescription threw...");const o=a instanceof Error?a:new Error(a);return this.logger.error(o.message),Promise.reject(o)}try{return r.setDescription(e.content,i,n).catch(a=>{this.logger.error("Session.setAnswer: SDH setDescription rejected...");const o=a instanceof Error?a:new Error("Session.setAnswer unknown error.");throw this.logger.error(o.message),o})}catch(a){this.logger.error("Session.setAnswer: SDH setDescription threw...");const o=a instanceof Error?a:new Error(a);return this.logger.error(o.message),Promise.reject(o)}}setOfferAndGetAnswer(e,t){const r=this.setupSessionDescriptionHandler(),i=t.sessionDescriptionHandlerOptions,n=t.sessionDescriptionHandlerModifiers;try{if(!r.hasDescription(e.contentType))return Promise.reject(new Ls)}catch(a){this.logger.error("Session.setOfferAndGetAnswer: SDH hasDescription threw...");const o=a instanceof Error?a:new Error(a);return this.logger.error(o.message),Promise.reject(o)}try{return r.setDescription(e.content,i,n).then(()=>r.getDescription(i,n)).then(a=>rs(a)).catch(a=>{this.logger.error("Session.setOfferAndGetAnswer: SDH setDescription or getDescription rejected...");const o=a instanceof Error?a:new Error("Session.setOfferAndGetAnswer unknown error.");throw this.logger.error(o.message),o})}catch(a){this.logger.error("Session.setOfferAndGetAnswer: SDH setDescription or getDescription threw...");const o=a instanceof Error?a:new Error(a);return this.logger.error(o.message),Promise.reject(o)}}setSessionDescriptionHandler(e){if(this._sessionDescriptionHandler)throw new Error("Session description handler defined.");this._sessionDescriptionHandler=e}setupSessionDescriptionHandler(){var e;return this._sessionDescriptionHandler?this._sessionDescriptionHandler:(this._sessionDescriptionHandler=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions),!((e=this.delegate)===null||e===void 0)&&e.onSessionDescriptionHandler&&this.delegate.onSessionDescriptionHandler(this._sessionDescriptionHandler,!1),this._sessionDescriptionHandler)}stateTransition(e){const t=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case B.Initial:e!==B.Establishing&&e!==B.Established&&e!==B.Terminating&&e!==B.Terminated&&t();break;case B.Establishing:e!==B.Established&&e!==B.Terminating&&e!==B.Terminated&&t();break;case B.Established:e!==B.Terminating&&e!==B.Terminated&&t();break;case B.Terminating:e!==B.Terminated&&t();break;case B.Terminated:t();break;default:throw new Error("Unrecognized state.")}this._state=e,this.logger.log(`Session ${this.id} transitioned to state ${this._state}`),this._stateEventEmitter.emit(this._state),e===B.Terminated&&this.dispose()}copyRequestOptions(e={}){const t=e.extraHeaders?e.extraHeaders.slice():void 0,r=e.body?{contentDisposition:e.body.contentDisposition||"render",contentType:e.body.contentType||"text/plain",content:e.body.content||""}:void 0;return{extraHeaders:t,body:r}}getReasonHeaderValue(e,t){const r=e;let i=es(e);return!i&&t&&(i=t),"SIP;cause="+r+';text="'+i+'"'}referExtraHeaders(e){const t=[];return t.push("Referred-By: <"+this.userAgent.configuration.uri+">"),t.push("Contact: "+this._contact),t.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),t.push("Refer-To: "+e),t}referToString(e){let t;if(e instanceof lt)t=e.toString();else{if(!e.dialog)throw new Error("Dialog undefined.");const r=e.remoteIdentity.friendlyName,i=e.dialog.remoteTarget.toString(),n=e.dialog.callId,a=e.dialog.remoteTag,o=e.dialog.localTag,l=encodeURIComponent(`${n};to-tag=${a};from-tag=${o}`);t=`"${r}" <${i}?Replaces=${l}>`}return t}}var rt;(function(s){s.Required="Required",s.Supported="Supported",s.Unsupported="Unsupported"})(rt=rt||(rt={}));const No={"100rel":!0,199:!0,answermode:!0,"early-session":!0,eventlist:!0,explicitsub:!0,"from-change":!0,"geolocation-http":!0,"geolocation-sip":!0,gin:!0,gruu:!0,histinfo:!0,ice:!0,join:!0,"multiple-refer":!0,norefersub:!0,nosub:!0,outbound:!0,path:!0,policy:!0,precondition:!0,pref:!0,privacy:!0,"recipient-list-invite":!0,"recipient-list-message":!0,"recipient-list-subscribe":!0,replaces:!0,"resource-priority":!0,"sdp-anat":!0,"sec-agree":!0,tdialog:!0,timer:!0,uui:!0};class qo extends Pr{constructor(e,t){super(e),this.incomingInviteRequest=t,this.disposed=!1,this.expiresTimer=void 0,this.isCanceled=!1,this.rel100="none",this.rseq=Math.floor(Math.random()*1e4),this.userNoAnswerTimer=void 0,this.waitingForPrack=!1,this.logger=e.getLogger("sip.Invitation");const r=this.incomingInviteRequest.message,i=r.getHeader("require");i&&i.toLowerCase().includes("100rel")&&(this.rel100="required");const n=r.getHeader("supported");if(n&&n.toLowerCase().includes("100rel")&&(this.rel100="supported"),r.toTag=t.toTag,typeof r.toTag!="string")throw new TypeError("toTag should have been a string.");if(this.userNoAnswerTimer=setTimeout(()=>{t.reject({statusCode:480}),this.stateTransition(B.Terminated)},this.userAgent.configuration.noAnswerTimeout?this.userAgent.configuration.noAnswerTimeout*1e3:6e4),r.hasHeader("expires")){const l=Number(r.getHeader("expires")||0)*1e3;this.expiresTimer=setTimeout(()=>{this.state===B.Initial&&(t.reject({statusCode:487}),this.stateTransition(B.Terminated))},l)}const a=this.request.getHeader("P-Asserted-Identity");a&&(this._assertedIdentity=Te.nameAddrHeaderParse(a)),this._contact=this.userAgent.contact.toString();const o=r.parseHeader("Content-Disposition");o&&o.type==="render"&&(this._renderbody=r.body,this._rendertype=r.getHeader("Content-Type")),this._id=r.callId+r.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.expiresTimer&&(clearTimeout(this.expiresTimer),this.expiresTimer=void 0),this.userNoAnswerTimer&&(clearTimeout(this.userNoAnswerTimer),this.userNoAnswerTimer=void 0),this.prackNeverArrived(),this.state){case B.Initial:return this.reject().then(()=>super.dispose());case B.Establishing:return this.reject().then(()=>super.dispose());case B.Established:return super.dispose();case B.Terminating:return super.dispose();case B.Terminated:return super.dispose();default:throw new Error("Unknown state.")}}get autoSendAnInitialProvisionalResponse(){return this.rel100!=="required"&&this.userAgent.configuration.sendInitialProvisionalResponse}get body(){return this.incomingInviteRequest.message.body}get localIdentity(){return this.request.to}get remoteIdentity(){return this.request.from}get request(){return this.incomingInviteRequest.message}accept(e={}){if(this.logger.log("Invitation.accept"),this.state!==B.Initial){const t=new Error(`Invalid session state ${this.state}`);return this.logger.error(t.message),Promise.reject(t)}return e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),this.stateTransition(B.Establishing),this.sendAccept(e).then(({message:t,session:r})=>{r.delegate={onAck:i=>this.onAckRequest(i),onAckTimeout:()=>this.onAckTimeout(),onBye:i=>this.onByeRequest(i),onInfo:i=>this.onInfoRequest(i),onInvite:i=>this.onInviteRequest(i),onMessage:i=>this.onMessageRequest(i),onNotify:i=>this.onNotifyRequest(i),onPrack:i=>this.onPrackRequest(i),onRefer:i=>this.onReferRequest(i)},this._dialog=r,this.stateTransition(B.Established),this._replacee&&this._replacee._bye()}).catch(t=>this.handleResponseError(t))}progress(e={}){if(this.logger.log("Invitation.progress"),this.state!==B.Initial){const r=new Error(`Invalid session state ${this.state}`);return this.logger.error(r.message),Promise.reject(r)}const t=e.statusCode||180;if(t<100||t>199)throw new TypeError("Invalid statusCode: "+t);return e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),this.waitingForPrack?(this.logger.warn("Unexpected call for progress while waiting for prack, ignoring"),Promise.resolve()):e.statusCode===100?this.sendProgressTrying().then(()=>{}).catch(r=>this.handleResponseError(r)):this.rel100!=="required"&&!(this.rel100==="supported"&&e.rel100)&&!(this.rel100==="supported"&&this.userAgent.configuration.sipExtension100rel===rt.Required)?this.sendProgress(e).then(()=>{}).catch(r=>this.handleResponseError(r)):this.sendProgressReliableWaitForPrack(e).then(()=>{}).catch(r=>this.handleResponseError(r))}reject(e={}){if(this.logger.log("Invitation.reject"),this.state!==B.Initial&&this.state!==B.Establishing){const a=new Error(`Invalid session state ${this.state}`);return this.logger.error(a.message),Promise.reject(a)}const t=e.statusCode||480,r=e.reasonPhrase?e.reasonPhrase:es(t),i=e.extraHeaders||[];if(t<300||t>699)throw new TypeError("Invalid statusCode: "+t);const n=e.body?rs(e.body):void 0;return t<400?this.incomingInviteRequest.redirect([],{statusCode:t,reasonPhrase:r,extraHeaders:i,body:n}):this.incomingInviteRequest.reject({statusCode:t,reasonPhrase:r,extraHeaders:i,body:n}),this.stateTransition(B.Terminated),Promise.resolve()}_onCancel(e){if(this.logger.log("Invitation._onCancel"),this.state!==B.Initial&&this.state!==B.Establishing){this.logger.error(`CANCEL received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onCancel){const t=new ko(e);this.delegate.onCancel(t)}this.isCanceled=!0,this.incomingInviteRequest.reject({statusCode:487}),this.stateTransition(B.Terminated)}handlePrackOfferAnswer(e){if(!this.dialog)throw new Error("Dialog undefined.");const t=Hr(e.message);if(!t||t.contentDisposition!=="session")return Promise.resolve(void 0);const r={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers};switch(this.dialog.signalingState){case U.Initial:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);case U.Stable:return this.setAnswer(t,r).then(()=>{});case U.HaveLocalOffer:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);case U.HaveRemoteOffer:return this.setOfferAndGetAnswer(t,r);case U.Closed:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`);default:throw new Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}handleResponseError(e){let t=480;if(e instanceof Error?this.logger.error(e.message):this.logger.error(e),e instanceof Ls?(this.logger.error("A session description handler occurred while sending response (content type unsupported"),t=415):e instanceof Ro?this.logger.error("A session description handler occurred while sending response"):e instanceof Ys?this.logger.error("Session ended before response could be formulated and sent (while waiting for PRACK)"):e instanceof Ot&&this.logger.error("Session changed state before response could be formulated and sent"),this.state===B.Initial||this.state===B.Establishing)try{this.incomingInviteRequest.reject({statusCode:t}),this.stateTransition(B.Terminated)}catch(r){throw this.logger.error("An error occurred attempting to reject the request while handling another error"),r}if(this.isCanceled){this.logger.warn("An error occurred while attempting to formulate and send a response to an incoming INVITE. However a CANCEL was received and processed while doing so which can (and often does) result in errors occurring as the session terminates in the meantime. Said error is being ignored.");return}throw e}onAckTimeout(){if(this.logger.log("Invitation.onAckTimeout"),!this.dialog)throw new Error("Dialog undefined.");this.logger.log("No ACK received for an extended period of time, terminating session"),this.dialog.bye(),this.stateTransition(B.Terminated)}sendAccept(e={}){const t={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},r=e.extraHeaders||[];return this.waitingForPrack?this.waitForArrivalOfPrack().then(()=>clearTimeout(this.userNoAnswerTimer)).then(()=>this.generateResponseOfferAnswer(this.incomingInviteRequest,t)).then(i=>this.incomingInviteRequest.accept({statusCode:200,body:i,extraHeaders:r})):(clearTimeout(this.userNoAnswerTimer),this.generateResponseOfferAnswer(this.incomingInviteRequest,t).then(i=>this.incomingInviteRequest.accept({statusCode:200,body:i,extraHeaders:r})))}sendProgress(e={}){const t=e.statusCode||180,r=e.reasonPhrase,i=(e.extraHeaders||[]).slice(),n=e.body?rs(e.body):void 0;if(t===183&&!n)return this.sendProgressWithSDP(e);try{const a=this.incomingInviteRequest.progress({statusCode:t,reasonPhrase:r,extraHeaders:i,body:n});return this._dialog=a.session,Promise.resolve(a)}catch(a){return Promise.reject(a)}}sendProgressWithSDP(e={}){const t={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},r=e.statusCode||183,i=e.reasonPhrase,n=(e.extraHeaders||[]).slice();return this.generateResponseOfferAnswer(this.incomingInviteRequest,t).then(a=>this.incomingInviteRequest.progress({statusCode:r,reasonPhrase:i,extraHeaders:n,body:a})).then(a=>(this._dialog=a.session,a))}sendProgressReliable(e={}){return e.extraHeaders=(e.extraHeaders||[]).slice(),e.extraHeaders.push("Require: 100rel"),e.extraHeaders.push("RSeq: "+Math.floor(Math.random()*1e4)),this.sendProgressWithSDP(e)}sendProgressReliableWaitForPrack(e={}){const t={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},r=e.statusCode||183,i=e.reasonPhrase,n=(e.extraHeaders||[]).slice();n.push("Require: 100rel"),n.push("RSeq: "+this.rseq++);let a;return new Promise((o,l)=>{this.waitingForPrack=!0,this.generateResponseOfferAnswer(this.incomingInviteRequest,t).then(c=>(a=c,this.incomingInviteRequest.progress({statusCode:r,reasonPhrase:i,extraHeaders:n,body:a}))).then(c=>{this._dialog=c.session;let d,g;c.session.delegate={onPrack:x=>{d=x,clearTimeout(y),clearTimeout(_),this.waitingForPrack&&(this.waitingForPrack=!1,this.handlePrackOfferAnswer(d).then(p=>{try{g=d.accept({statusCode:200,body:p}),this.prackArrived(),o({prackRequest:d,prackResponse:g,progressResponse:c})}catch(w){l(w)}}).catch(p=>l(p)))}};const y=setTimeout(()=>{this.waitingForPrack&&(this.waitingForPrack=!1,this.logger.warn("No PRACK received, rejecting INVITE."),clearTimeout(_),this.reject({statusCode:504}).then(()=>l(new Ys)).catch(x=>l(x)))},Re.T1*64),E=()=>{try{this.incomingInviteRequest.progress({statusCode:r,reasonPhrase:i,extraHeaders:n,body:a})}catch(x){this.waitingForPrack=!1,l(x);return}_=setTimeout(E,v*=2)};let v=Re.T1,_=setTimeout(E,v)}).catch(c=>{this.waitingForPrack=!1,l(c)})})}sendProgressTrying(){try{const e=this.incomingInviteRequest.trying();return Promise.resolve(e)}catch(e){return Promise.reject(e)}}waitForArrivalOfPrack(){if(this.waitingForPrackPromise)throw new Error("Already waiting for PRACK");return this.waitingForPrackPromise=new Promise((e,t)=>{this.waitingForPrackResolve=e,this.waitingForPrackReject=t}),this.waitingForPrackPromise}prackArrived(){this.waitingForPrackResolve&&this.waitingForPrackResolve(),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}prackNeverArrived(){this.waitingForPrackReject&&this.waitingForPrackReject(new Ys),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}}class Rn extends Pr{constructor(e,t,r={}){super(e,r),this.disposed=!1,this.earlyMedia=!1,this.earlyMediaSessionDescriptionHandlers=new Map,this.isCanceled=!1,this.inviteWithoutSdp=!1,this.logger=e.getLogger("sip.Inviter"),this.earlyMedia=r.earlyMedia!==void 0?r.earlyMedia:this.earlyMedia,this.fromTag=ts(),this.inviteWithoutSdp=r.inviteWithoutSdp!==void 0?r.inviteWithoutSdp:this.inviteWithoutSdp;const i=Object.assign({},r);i.params=Object.assign({},r.params);const n=r.anonymous||!1,a=e.contact.toString({anonymous:n,outbound:n?!e.contact.tempGruu:!e.contact.pubGruu});n&&e.configuration.uri&&(i.params.fromDisplayName="Anonymous",i.params.fromUri="sip:anonymous@anonymous.invalid");let o=e.userAgentCore.configuration.aor;if(i.params.fromUri&&(o=typeof i.params.fromUri=="string"?Te.URIParse(i.params.fromUri):i.params.fromUri),!o)throw new TypeError("Invalid from URI: "+i.params.fromUri);let l=t;if(i.params.toUri&&(l=typeof i.params.toUri=="string"?Te.URIParse(i.params.toUri):i.params.toUri),!l)throw new TypeError("Invalid to URI: "+i.params.toUri);const c=Object.assign({},i.params);c.fromTag=this.fromTag;const d=(i.extraHeaders||[]).slice();n&&e.configuration.uri&&(d.push("P-Preferred-Identity: "+e.configuration.uri.toString()),d.push("Privacy: id")),d.push("Contact: "+a),d.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),e.configuration.sipExtension100rel===rt.Required&&d.push("Require: 100rel"),e.configuration.sipExtensionReplaces===rt.Required&&d.push("Require: replaces"),i.extraHeaders=d;const g=void 0;this.outgoingRequestMessage=e.userAgentCore.makeOutgoingRequestMessage(j.INVITE,t,o,l,c,d,g),this._contact=a,this._referralInviterOptions=i,this._renderbody=r.renderbody,this._rendertype=r.rendertype,r.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=r.sessionDescriptionHandlerModifiers),r.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=r.sessionDescriptionHandlerOptions),r.sessionDescriptionHandlerModifiersReInvite&&(this.sessionDescriptionHandlerModifiersReInvite=r.sessionDescriptionHandlerModifiersReInvite),r.sessionDescriptionHandlerOptionsReInvite&&(this.sessionDescriptionHandlerOptionsReInvite=r.sessionDescriptionHandlerOptionsReInvite),this._id=this.outgoingRequestMessage.callId+this.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.disposeEarlyMedia(),this.state){case B.Initial:return this.cancel().then(()=>super.dispose());case B.Establishing:return this.cancel().then(()=>super.dispose());case B.Established:return super.dispose();case B.Terminating:return super.dispose();case B.Terminated:return super.dispose();default:throw new Error("Unknown state.")}}get body(){return this.outgoingRequestMessage.body}get localIdentity(){return this.outgoingRequestMessage.from}get remoteIdentity(){return this.outgoingRequestMessage.to}get request(){return this.outgoingRequestMessage}cancel(e={}){if(this.logger.log("Inviter.cancel"),this.state!==B.Initial&&this.state!==B.Establishing){const r=new Error(`Invalid session state ${this.state}`);return this.logger.error(r.message),Promise.reject(r)}this.isCanceled=!0,this.stateTransition(B.Terminating);function t(r,i){if(r&&r<200||r>699)throw new TypeError("Invalid statusCode: "+r);if(r){const n=r,a=es(r)||i;return"SIP;cause="+n+';text="'+a+'"'}}if(this.outgoingInviteRequest){let r;e.statusCode&&e.reasonPhrase&&(r=t(e.statusCode,e.reasonPhrase)),this.outgoingInviteRequest.cancel(r,e)}else this.logger.warn("Canceled session before INVITE was sent"),this.stateTransition(B.Terminated);return Promise.resolve()}invite(e={}){if(this.logger.log("Inviter.invite"),this.state!==B.Initial)return super.invite(e);if(e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),e.withoutSdp||this.inviteWithoutSdp)return this._renderbody&&this._rendertype&&(this.outgoingRequestMessage.body={contentType:this._rendertype,body:this._renderbody}),this.stateTransition(B.Establishing),Promise.resolve(this.sendInvite(e));const t={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.getOffer(t).then(r=>(this.outgoingRequestMessage.body={body:r.content,contentType:r.contentType},this.stateTransition(B.Establishing),this.sendInvite(e))).catch(r=>{throw this.logger.log(r.message),this.state!==B.Terminated&&this.stateTransition(B.Terminated),r})}sendInvite(e={}){return this.outgoingInviteRequest=this.userAgent.userAgentCore.invite(this.outgoingRequestMessage,{onAccept:t=>{if(this.dialog){this.logger.log("Additional confirmed dialog, sending ACK and BYE"),this.ackAndBye(t);return}if(this.isCanceled){this.logger.log("Canceled session accepted, sending ACK and BYE"),this.ackAndBye(t),this.stateTransition(B.Terminated);return}this.notifyReferer(t),this.onAccept(t).then(()=>{this.disposeEarlyMedia()}).catch(()=>{this.disposeEarlyMedia()}).then(()=>{e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(t)})},onProgress:t=>{this.isCanceled||(this.notifyReferer(t),this.onProgress(t).catch(()=>{this.disposeEarlyMedia()}).then(()=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(t)}))},onRedirect:t=>{this.notifyReferer(t),this.onRedirect(t),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(t)},onReject:t=>{this.notifyReferer(t),this.onReject(t),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(t)},onTrying:t=>{this.notifyReferer(t),this.onTrying(t),e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(t)}}),this.outgoingInviteRequest}disposeEarlyMedia(){this.earlyMediaSessionDescriptionHandlers.forEach(e=>{e.close()}),this.earlyMediaSessionDescriptionHandlers.clear()}notifyReferer(e){if(!this._referred)return;if(!(this._referred instanceof Pr))throw new Error("Referred session not instance of session");if(!this._referred.dialog)return;if(!e.message.statusCode)throw new Error("Status code undefined.");if(!e.message.reasonPhrase)throw new Error("Reason phrase undefined.");const t=e.message.statusCode,r=e.message.reasonPhrase,i=`SIP/2.0 ${t} ${r}`.trim(),n=this._referred.dialog.notify(void 0,{extraHeaders:["Event: refer","Subscription-State: terminated"],body:{contentDisposition:"render",contentType:"message/sipfrag",content:i}});n.delegate={onReject:()=>{this._referred=void 0}}}onAccept(e){if(this.logger.log("Inviter.onAccept"),this.state!==B.Establishing)return this.logger.error(`Accept received while in state ${this.state}, dropping response`),Promise.reject(new Error(`Invalid session state ${this.state}`));const t=e.message,r=e.session;switch(t.hasHeader("P-Asserted-Identity")&&(this._assertedIdentity=Te.nameAddrHeaderParse(t.getHeader("P-Asserted-Identity"))),r.delegate={onAck:i=>this.onAckRequest(i),onBye:i=>this.onByeRequest(i),onInfo:i=>this.onInfoRequest(i),onInvite:i=>this.onInviteRequest(i),onMessage:i=>this.onMessageRequest(i),onNotify:i=>this.onNotifyRequest(i),onPrack:i=>this.onPrackRequest(i),onRefer:i=>this.onReferRequest(i)},this._dialog=r,r.signalingState){case U.Initial:return this.logger.error("Received 2xx response to INVITE without a session description"),this.ackAndBye(e,400,"Missing session description"),this.stateTransition(B.Terminated),Promise.reject(new Error("Bad Media Description"));case U.HaveLocalOffer:return this.logger.error("Received 2xx response to INVITE without a session description"),this.ackAndBye(e,400,"Missing session description"),this.stateTransition(B.Terminated),Promise.reject(new Error("Bad Media Description"));case U.HaveRemoteOffer:{if(!this._dialog.offer)throw new Error(`Session offer undefined in signaling state ${this._dialog.signalingState}.`);const i={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setOfferAndGetAnswer(this._dialog.offer,i).then(n=>{e.ack({body:n}),this.stateTransition(B.Established)}).catch(n=>{throw this.ackAndBye(e,488,"Invalid session description"),this.stateTransition(B.Terminated),n})}case U.Stable:{if(this.earlyMediaSessionDescriptionHandlers.size>0){const a=this.earlyMediaSessionDescriptionHandlers.get(r.id);if(!a)throw new Error("Session description handler undefined.");return this.setSessionDescriptionHandler(a),this.earlyMediaSessionDescriptionHandlers.delete(r.id),e.ack(),this.stateTransition(B.Established),Promise.resolve()}if(this.earlyMediaDialog){if(this.earlyMediaDialog!==r){this.earlyMedia&&this.logger.error("You have set the 'earlyMedia' option to 'true' which requires that your INVITE requests do not fork and yet this INVITE request did in fact fork. Consequentially and not surprisingly the end point which accepted the INVITE (confirmed dialog) does not match the end point with which early media has been setup (early dialog) and thus this session is unable to proceed. In accordance with the SIP specifications, the SIP servers your end point is connected to determine if an INVITE forks and the forking behavior of those servers cannot be controlled by this library. If you wish to use early media with this library you must configure those servers accordingly. Alternatively you may set the 'earlyMedia' to 'false' which will allow this library to function with any INVITE requests which do fork.");const a=new Error("Early media dialog does not equal confirmed dialog, terminating session");return this.logger.error(a.message),this.ackAndBye(e,488,"Not Acceptable Here"),this.stateTransition(B.Terminated),Promise.reject(a)}return e.ack(),this.stateTransition(B.Established),Promise.resolve()}const i=r.answer;if(!i)throw new Error("Answer is undefined.");const n={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(i,n).then(()=>{let a;this._renderbody&&this._rendertype&&(a={body:{contentDisposition:"render",contentType:this._rendertype,content:this._renderbody}}),e.ack(a),this.stateTransition(B.Established)}).catch(a=>{throw this.logger.error(a.message),this.ackAndBye(e,488,"Not Acceptable Here"),this.stateTransition(B.Terminated),a})}case U.Closed:return Promise.reject(new Error("Terminated."));default:throw new Error("Unknown session signaling state.")}}onProgress(e){var t;if(this.logger.log("Inviter.onProgress"),this.state!==B.Establishing)return this.logger.error(`Progress received while in state ${this.state}, dropping response`),Promise.reject(new Error(`Invalid session state ${this.state}`));if(!this.outgoingInviteRequest)throw new Error("Outgoing INVITE request undefined.");const r=e.message,i=e.session;r.hasHeader("P-Asserted-Identity")&&(this._assertedIdentity=Te.nameAddrHeaderParse(r.getHeader("P-Asserted-Identity")));const n=r.getHeader("require"),a=r.getHeader("rseq"),l=!!(n&&n.includes("100rel")&&a?Number(a):void 0),c=[];switch(l&&c.push("RAck: "+r.getHeader("rseq")+" "+r.getHeader("cseq")),i.signalingState){case U.Initial:return l&&(this.logger.warn("First reliable provisional response received MUST contain an offer when INVITE does not contain an offer."),e.prack({extraHeaders:c})),Promise.resolve();case U.HaveLocalOffer:return l&&e.prack({extraHeaders:c}),Promise.resolve();case U.HaveRemoteOffer:if(!l)return this.logger.warn("Non-reliable provisional response MUST NOT contain an initial offer, discarding response."),Promise.resolve();{const d=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions||{});return!((t=this.delegate)===null||t===void 0)&&t.onSessionDescriptionHandler&&this.delegate.onSessionDescriptionHandler(d,!0),this.earlyMediaSessionDescriptionHandlers.set(i.id,d),d.setDescription(r.body,this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers).then(()=>d.getDescription(this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers)).then(g=>{const u={contentDisposition:"session",contentType:g.contentType,content:g.body};e.prack({extraHeaders:c,body:u})}).catch(g=>{throw this.stateTransition(B.Terminated),g})}case U.Stable:if(l&&e.prack({extraHeaders:c}),this.earlyMedia&&!this.earlyMediaDialog){this.earlyMediaDialog=i;const d=i.answer;if(!d)throw new Error("Answer is undefined.");const g={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(d,g).catch(u=>{throw this.stateTransition(B.Terminated),u})}return Promise.resolve();case U.Closed:return Promise.reject(new Error("Terminated."));default:throw new Error("Unknown session signaling state.")}}onRedirect(e){if(this.logger.log("Inviter.onRedirect"),this.state!==B.Establishing&&this.state!==B.Terminating){this.logger.error(`Redirect received while in state ${this.state}, dropping response`);return}this.stateTransition(B.Terminated)}onReject(e){if(this.logger.log("Inviter.onReject"),this.state!==B.Establishing&&this.state!==B.Terminating){this.logger.error(`Reject received while in state ${this.state}, dropping response`);return}this.stateTransition(B.Terminated)}onTrying(e){if(this.logger.log("Inviter.onTrying"),this.state!==B.Establishing){this.logger.error(`Trying received while in state ${this.state}, dropping response`);return}}}var le;(function(s){s.Initial="Initial",s.Registered="Registered",s.Unregistered="Unregistered",s.Terminated="Terminated"})(le=le||(le={}));class ut{constructor(e,t={}){this.disposed=!1,this._contacts=[],this._retryAfter=void 0,this._state=le.Initial,this._waiting=!1,this._stateEventEmitter=new Ir,this._waitingEventEmitter=new Ir,this.userAgent=e;const r=e.configuration.uri.clone();if(r.user=void 0,this.options=Object.assign(Object.assign(Object.assign({},ut.defaultOptions()),{registrar:r}),ut.stripUndefinedProperties(t)),this.options.extraContactHeaderParams=(this.options.extraContactHeaderParams||[]).slice(),this.options.extraHeaders=(this.options.extraHeaders||[]).slice(),!this.options.registrar)throw new Error("Registrar undefined.");if(this.options.registrar=this.options.registrar.clone(),this.options.regId&&!this.options.instanceId?this.options.instanceId=this.userAgent.instanceId:!this.options.regId&&this.options.instanceId&&(this.options.regId=1),this.options.instanceId&&Te.parse(this.options.instanceId,"uuid")===-1)throw new Error("Invalid instanceId.");if(this.options.regId&&this.options.regId<0)throw new Error("Invalid regId.");const i=this.options.registrar,n=this.options.params&&this.options.params.fromUri||e.userAgentCore.configuration.aor,a=this.options.params&&this.options.params.toUri||e.configuration.uri,o=this.options.params||{},l=(t.extraHeaders||[]).slice();if(this.request=e.userAgentCore.makeOutgoingRequestMessage(j.REGISTER,i,n,a,o,l,void 0),this.expires=this.options.expires||ut.defaultExpires,this.expires<0)throw new Error("Invalid expires.");if(this.refreshFrequency=this.options.refreshFrequency||ut.defaultRefreshFrequency,this.refreshFrequency<50||this.refreshFrequency>99)throw new Error("Invalid refresh frequency. The value represents a percentage of the expiration time and should be between 50 and 99.");this.logger=e.getLogger("sip.Registerer"),this.options.logConfiguration&&(this.logger.log("Configuration:"),Object.keys(this.options).forEach(c=>{const d=this.options[c];switch(c){case"registrar":this.logger.log("· "+c+": "+d);break;default:this.logger.log("· "+c+": "+JSON.stringify(d))}})),this.id=this.request.callId+this.request.from.parameters.tag,this.userAgent._registerers[this.id]=this}static defaultOptions(){return{expires:ut.defaultExpires,extraContactHeaderParams:[],extraHeaders:[],logConfiguration:!0,instanceId:"",params:{},regId:0,registrar:new lt("sip","anonymous","anonymous.invalid"),refreshFrequency:ut.defaultRefreshFrequency}}static stripUndefinedProperties(e){return Object.keys(e).reduce((t,r)=>(e[r]!==void 0&&(t[r]=e[r]),t),{})}get contacts(){return this._contacts.slice()}get retryAfter(){return this._retryAfter}get state(){return this._state}get stateChange(){return this._stateEventEmitter}dispose(){return this.disposed?Promise.resolve():(this.disposed=!0,this.logger.log(`Registerer ${this.id} in state ${this.state} is being disposed`),delete this.userAgent._registerers[this.id],new Promise(e=>{const t=()=>{if(!this.waiting&&this._state===le.Registered){this.stateChange.addListener(()=>{this.terminated(),e()},{once:!0}),this.unregister();return}this.terminated(),e()};this.waiting?this.waitingChange.addListener(()=>{t()},{once:!0}):t()}))}register(e={}){if(this.state===le.Terminated)throw this.stateError(),new Error("Registerer terminated. Unable to register.");if(this.disposed)throw this.stateError(),new Error("Registerer disposed. Unable to register.");if(this.waiting){this.waitingWarning();const i=new js("REGISTER request already in progress, waiting for final response");return Promise.reject(i)}e.requestOptions&&(this.options=Object.assign(Object.assign({},this.options),e.requestOptions));const t=(this.options.extraHeaders||[]).slice();t.push("Contact: "+this.generateContactHeader(this.expires)),t.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),this.request.cseq++,this.request.setHeader("cseq",this.request.cseq+" REGISTER"),this.request.extraHeaders=t,this.waitingToggle(!0);const r=this.userAgent.userAgentCore.register(this.request,{onAccept:i=>{let n;i.message.hasHeader("expires")&&(n=Number(i.message.getHeader("expires"))),this._contacts=i.message.getHeaders("contact");let a=this._contacts.length;if(!a){this.logger.error("No Contact header in response to REGISTER, dropping response."),this.unregistered();return}let o;for(;a--;){if(o=i.message.parseHeader("contact",a),!o)throw new Error("Contact undefined");if(this.userAgent.contact.pubGruu&&_n(o.uri,this.userAgent.contact.pubGruu)){n=Number(o.getParam("expires"));break}if(this.userAgent.configuration.contactName===""){if(o.uri.user===this.userAgent.contact.uri.user){n=Number(o.getParam("expires"));break}}else if(_n(o.uri,this.userAgent.contact.uri)){n=Number(o.getParam("expires"));break}o=void 0}if(o===void 0){this.logger.error("No Contact header pointing to us, dropping response"),this.unregistered(),this.waitingToggle(!1);return}if(n===void 0){this.logger.error("Contact pointing to us is missing expires parameter, dropping response"),this.unregistered(),this.waitingToggle(!1);return}if(o.hasParam("temp-gruu")){const l=o.getParam("temp-gruu");l&&(this.userAgent.contact.tempGruu=Te.URIParse(l.replace(/"/g,"")))}if(o.hasParam("pub-gruu")){const l=o.getParam("pub-gruu");l&&(this.userAgent.contact.pubGruu=Te.URIParse(l.replace(/"/g,"")))}this.registered(n),e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(i),this.waitingToggle(!1)},onProgress:i=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(i)},onRedirect:i=>{this.logger.error("Redirect received. Not supported."),this.unregistered(),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(i),this.waitingToggle(!1)},onReject:i=>{if(i.message.statusCode===423){if(!i.message.hasHeader("min-expires")){this.logger.error("423 response received for REGISTER without Min-Expires, dropping response"),this.unregistered(),this.waitingToggle(!1);return}this.expires=Number(i.message.getHeader("min-expires")),this.waitingToggle(!1),this.register();return}this.logger.warn(`Failed to register, status code ${i.message.statusCode}`);let n=NaN;if(i.message.statusCode===500||i.message.statusCode===503){const a=i.message.getHeader("retry-after");a&&(n=Number.parseInt(a,void 0))}this._retryAfter=isNaN(n)?void 0:n,this.unregistered(),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(i),this._retryAfter=void 0,this.waitingToggle(!1)},onTrying:i=>{e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(i)}});return Promise.resolve(r)}unregister(e={}){if(this.state===le.Terminated)throw this.stateError(),new Error("Registerer terminated. Unable to register.");if(this.disposed&&this.state!==le.Registered)throw this.stateError(),new Error("Registerer disposed. Unable to register.");if(this.waiting){this.waitingWarning();const i=new js("REGISTER request already in progress, waiting for final response");return Promise.reject(i)}this._state!==le.Registered&&!e.all&&this.logger.warn("Not currently registered, but sending an unregister anyway.");const t=(e.requestOptions&&e.requestOptions.extraHeaders||[]).slice();this.request.extraHeaders=t,e.all?(t.push("Contact: *"),t.push("Expires: 0")):t.push("Contact: "+this.generateContactHeader(0)),this.request.cseq++,this.request.setHeader("cseq",this.request.cseq+" REGISTER"),this.registrationTimer!==void 0&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.waitingToggle(!0);const r=this.userAgent.userAgentCore.register(this.request,{onAccept:i=>{this._contacts=i.message.getHeaders("contact"),this.unregistered(),e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(i),this.waitingToggle(!1)},onProgress:i=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(i)},onRedirect:i=>{this.logger.error("Unregister redirected. Not currently supported."),this.unregistered(),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(i),this.waitingToggle(!1)},onReject:i=>{this.logger.error(`Unregister rejected with status code ${i.message.statusCode}`),this.unregistered(),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(i),this.waitingToggle(!1)},onTrying:i=>{e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(i)}});return Promise.resolve(r)}clearTimers(){this.registrationTimer!==void 0&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.registrationExpiredTimer!==void 0&&(clearTimeout(this.registrationExpiredTimer),this.registrationExpiredTimer=void 0)}generateContactHeader(e){let t=this.userAgent.contact.toString({register:!0});return this.options.regId&&this.options.instanceId&&(t+=";reg-id="+this.options.regId,t+=';+sip.instance="<urn:uuid:'+this.options.instanceId+'>"'),this.options.extraContactHeaderParams&&this.options.extraContactHeaderParams.forEach(r=>{t+=";"+r}),t+=";expires="+e,t}registered(e){this.clearTimers(),this.registrationTimer=setTimeout(()=>{this.registrationTimer=void 0,this.register()},this.refreshFrequency/100*e*1e3),this.registrationExpiredTimer=setTimeout(()=>{this.logger.warn("Registration expired"),this.unregistered()},e*1e3),this._state!==le.Registered&&this.stateTransition(le.Registered)}unregistered(){this.clearTimers(),this._state!==le.Unregistered&&this.stateTransition(le.Unregistered)}terminated(){this.clearTimers(),this._state!==le.Terminated&&this.stateTransition(le.Terminated)}stateTransition(e){const t=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case le.Initial:e!==le.Registered&&e!==le.Unregistered&&e!==le.Terminated&&t();break;case le.Registered:e!==le.Unregistered&&e!==le.Terminated&&t();break;case le.Unregistered:e!==le.Registered&&e!==le.Terminated&&t();break;case le.Terminated:t();break;default:throw new Error("Unrecognized state.")}this._state=e,this.logger.log(`Registration transitioned to state ${this._state}`),this._stateEventEmitter.emit(this._state),e===le.Terminated&&this.dispose()}get waiting(){return this._waiting}get waitingChange(){return this._waitingEventEmitter}waitingToggle(e){if(this._waiting===e)throw new Error(`Invalid waiting transition from ${this._waiting} to ${e}`);this._waiting=e,this.logger.log(`Waiting toggled to ${this._waiting}`),this._waitingEventEmitter.emit(this._waiting)}waitingWarning(){let e="An attempt was made to send a REGISTER request while a prior one was still in progress.";e+=" RFC 3261 requires UAs MUST NOT send a new registration until they have received a final response",e+=" from the registrar for the previous one or the previous REGISTER request has timed out.",e+=" Note that if the transport disconnects, you still must wait for the prior request to time out before",e+=" sending a new REGISTER request or alternatively dispose of the current Registerer and create a new Registerer.",this.logger.warn(e)}stateError(){let t=`An attempt was made to send a REGISTER request when the Registerer ${this.state===le.Terminated?"is in 'Terminated' state":"has been disposed"}.`;t+=" The Registerer transitions to 'Terminated' when Registerer.dispose() is called.",t+=" Perhaps you called UserAgent.stop() which dipsoses of all Registerers?",this.logger.error(t)}}ut.defaultExpires=600,ut.defaultRefreshFrequency=99;var oe;(function(s){s.Initial="Initial",s.NotifyWait="NotifyWait",s.Pending="Pending",s.Active="Active",s.Terminated="Terminated"})(oe=oe||(oe={}));var K;(function(s){s.Connecting="Connecting",s.Connected="Connected",s.Disconnecting="Disconnecting",s.Disconnected="Disconnected"})(K=K||(K={}));var Ie;(function(s){s.Started="Started",s.Stopped="Stopped"})(Ie=Ie||(Ie={}));class be{constructor(){this._dataLength=0,this._bufferLength=0,this._state=new Int32Array(4),this._buffer=new ArrayBuffer(68),this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashStr(e,t=!1){return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(e){const t=be.hexChars,r=be.hexOut;let i,n,a,o;for(o=0;o<4;o+=1)for(n=o*8,i=e[o],a=0;a<8;a+=2)r[n+1+a]=t.charAt(i&15),i>>>=4,r[n+0+a]=t.charAt(i&15),i>>>=4;return r.join("")}static _md5cycle(e,t){let r=e[0],i=e[1],n=e[2],a=e[3];r+=(i&n|~i&a)+t[0]-680876936|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&n)+t[1]-389564586|0,a=(a<<12|a>>>20)+r|0,n+=(a&r|~a&i)+t[2]+606105819|0,n=(n<<17|n>>>15)+a|0,i+=(n&a|~n&r)+t[3]-1044525330|0,i=(i<<22|i>>>10)+n|0,r+=(i&n|~i&a)+t[4]-176418897|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&n)+t[5]+1200080426|0,a=(a<<12|a>>>20)+r|0,n+=(a&r|~a&i)+t[6]-1473231341|0,n=(n<<17|n>>>15)+a|0,i+=(n&a|~n&r)+t[7]-45705983|0,i=(i<<22|i>>>10)+n|0,r+=(i&n|~i&a)+t[8]+1770035416|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&n)+t[9]-1958414417|0,a=(a<<12|a>>>20)+r|0,n+=(a&r|~a&i)+t[10]-42063|0,n=(n<<17|n>>>15)+a|0,i+=(n&a|~n&r)+t[11]-1990404162|0,i=(i<<22|i>>>10)+n|0,r+=(i&n|~i&a)+t[12]+1804603682|0,r=(r<<7|r>>>25)+i|0,a+=(r&i|~r&n)+t[13]-40341101|0,a=(a<<12|a>>>20)+r|0,n+=(a&r|~a&i)+t[14]-1502002290|0,n=(n<<17|n>>>15)+a|0,i+=(n&a|~n&r)+t[15]+1236535329|0,i=(i<<22|i>>>10)+n|0,r+=(i&a|n&~a)+t[1]-165796510|0,r=(r<<5|r>>>27)+i|0,a+=(r&n|i&~n)+t[6]-1069501632|0,a=(a<<9|a>>>23)+r|0,n+=(a&i|r&~i)+t[11]+643717713|0,n=(n<<14|n>>>18)+a|0,i+=(n&r|a&~r)+t[0]-373897302|0,i=(i<<20|i>>>12)+n|0,r+=(i&a|n&~a)+t[5]-701558691|0,r=(r<<5|r>>>27)+i|0,a+=(r&n|i&~n)+t[10]+38016083|0,a=(a<<9|a>>>23)+r|0,n+=(a&i|r&~i)+t[15]-660478335|0,n=(n<<14|n>>>18)+a|0,i+=(n&r|a&~r)+t[4]-405537848|0,i=(i<<20|i>>>12)+n|0,r+=(i&a|n&~a)+t[9]+568446438|0,r=(r<<5|r>>>27)+i|0,a+=(r&n|i&~n)+t[14]-1019803690|0,a=(a<<9|a>>>23)+r|0,n+=(a&i|r&~i)+t[3]-187363961|0,n=(n<<14|n>>>18)+a|0,i+=(n&r|a&~r)+t[8]+1163531501|0,i=(i<<20|i>>>12)+n|0,r+=(i&a|n&~a)+t[13]-1444681467|0,r=(r<<5|r>>>27)+i|0,a+=(r&n|i&~n)+t[2]-51403784|0,a=(a<<9|a>>>23)+r|0,n+=(a&i|r&~i)+t[7]+1735328473|0,n=(n<<14|n>>>18)+a|0,i+=(n&r|a&~r)+t[12]-1926607734|0,i=(i<<20|i>>>12)+n|0,r+=(i^n^a)+t[5]-378558|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^n)+t[8]-2022574463|0,a=(a<<11|a>>>21)+r|0,n+=(a^r^i)+t[11]+1839030562|0,n=(n<<16|n>>>16)+a|0,i+=(n^a^r)+t[14]-35309556|0,i=(i<<23|i>>>9)+n|0,r+=(i^n^a)+t[1]-1530992060|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^n)+t[4]+1272893353|0,a=(a<<11|a>>>21)+r|0,n+=(a^r^i)+t[7]-155497632|0,n=(n<<16|n>>>16)+a|0,i+=(n^a^r)+t[10]-1094730640|0,i=(i<<23|i>>>9)+n|0,r+=(i^n^a)+t[13]+681279174|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^n)+t[0]-358537222|0,a=(a<<11|a>>>21)+r|0,n+=(a^r^i)+t[3]-722521979|0,n=(n<<16|n>>>16)+a|0,i+=(n^a^r)+t[6]+76029189|0,i=(i<<23|i>>>9)+n|0,r+=(i^n^a)+t[9]-640364487|0,r=(r<<4|r>>>28)+i|0,a+=(r^i^n)+t[12]-421815835|0,a=(a<<11|a>>>21)+r|0,n+=(a^r^i)+t[15]+530742520|0,n=(n<<16|n>>>16)+a|0,i+=(n^a^r)+t[2]-995338651|0,i=(i<<23|i>>>9)+n|0,r+=(n^(i|~a))+t[0]-198630844|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~n))+t[7]+1126891415|0,a=(a<<10|a>>>22)+r|0,n+=(r^(a|~i))+t[14]-1416354905|0,n=(n<<15|n>>>17)+a|0,i+=(a^(n|~r))+t[5]-57434055|0,i=(i<<21|i>>>11)+n|0,r+=(n^(i|~a))+t[12]+1700485571|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~n))+t[3]-1894986606|0,a=(a<<10|a>>>22)+r|0,n+=(r^(a|~i))+t[10]-1051523|0,n=(n<<15|n>>>17)+a|0,i+=(a^(n|~r))+t[1]-2054922799|0,i=(i<<21|i>>>11)+n|0,r+=(n^(i|~a))+t[8]+1873313359|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~n))+t[15]-30611744|0,a=(a<<10|a>>>22)+r|0,n+=(r^(a|~i))+t[6]-1560198380|0,n=(n<<15|n>>>17)+a|0,i+=(a^(n|~r))+t[13]+1309151649|0,i=(i<<21|i>>>11)+n|0,r+=(n^(i|~a))+t[4]-145523070|0,r=(r<<6|r>>>26)+i|0,a+=(i^(r|~n))+t[11]-1120210379|0,a=(a<<10|a>>>22)+r|0,n+=(r^(a|~i))+t[2]+718787259|0,n=(n<<15|n>>>17)+a|0,i+=(a^(n|~r))+t[9]-343485551|0,i=(i<<21|i>>>11)+n|0,e[0]=r+e[0]|0,e[1]=i+e[1]|0,e[2]=n+e[2]|0,e[3]=a+e[3]|0}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(be.stateIdentity),this}appendStr(e){const t=this._buffer8,r=this._buffer32;let i=this._bufferLength,n,a;for(a=0;a<e.length;a+=1){if(n=e.charCodeAt(a),n<128)t[i++]=n;else if(n<2048)t[i++]=(n>>>6)+192,t[i++]=n&63|128;else if(n<55296||n>56319)t[i++]=(n>>>12)+224,t[i++]=n>>>6&63|128,t[i++]=n&63|128;else{if(n=(n-55296)*1024+(e.charCodeAt(++a)-56320)+65536,n>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");t[i++]=(n>>>18)+240,t[i++]=n>>>12&63|128,t[i++]=n>>>6&63|128,t[i++]=n&63|128}i>=64&&(this._dataLength+=64,be._md5cycle(this._state,r),i-=64,r[0]=r[16])}return this._bufferLength=i,this}appendAsciiStr(e){const t=this._buffer8,r=this._buffer32;let i=this._bufferLength,n,a=0;for(;;){for(n=Math.min(e.length-a,64-i);n--;)t[i++]=e.charCodeAt(a++);if(i<64)break;this._dataLength+=64,be._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}appendByteArray(e){const t=this._buffer8,r=this._buffer32;let i=this._bufferLength,n,a=0;for(;;){for(n=Math.min(e.length-a,64-i);n--;)t[i++]=e[a++];if(i<64)break;this._dataLength+=64,be._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}getState(){const e=this,t=e._state;return{buffer:String.fromCharCode.apply(null,e._buffer8),buflen:e._bufferLength,length:e._dataLength,state:[t[0],t[1],t[2],t[3]]}}setState(e){const t=e.buffer,r=e.state,i=this._state;let n;for(this._dataLength=e.length,this._bufferLength=e.buflen,i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],n=0;n<t.length;n+=1)this._buffer8[n]=t.charCodeAt(n)}end(e=!1){const t=this._bufferLength,r=this._buffer8,i=this._buffer32,n=(t>>2)+1;let a;if(this._dataLength+=t,r[t]=128,r[t+1]=r[t+2]=r[t+3]=0,i.set(be.buffer32Identity.subarray(n),n),t>55&&(be._md5cycle(this._state,i),i.set(be.buffer32Identity)),a=this._dataLength*8,a<=4294967295)i[14]=a;else{const o=a.toString(16).match(/(.*?)(.{0,8})$/);if(o===null)return;const l=parseInt(o[2],16),c=parseInt(o[1],16)||0;i[14]=l,i[15]=c}return be._md5cycle(this._state,i),e?this._state:be._hex(this._state)}}be.stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]),be.buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),be.hexChars="0123456789abcdef",be.hexOut=[],be.onePassHasher=new be,be.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592"&&console.error("Md5 self test failed.");function Nt(s){return be.hashStr(s)}class Uo{constructor(e,t,r,i){this.logger=e.getLogger("sipjs.digestauthentication"),this.username=r,this.password=i,this.ha1=t,this.nc=0,this.ncHex="00000000"}authenticate(e,t,r){if(this.algorithm=t.algorithm,this.realm=t.realm,this.nonce=t.nonce,this.opaque=t.opaque,this.stale=t.stale,this.algorithm){if(this.algorithm!=="MD5")return this.logger.warn("challenge with Digest algorithm different than 'MD5', authentication aborted"),!1}else this.algorithm="MD5";if(!this.realm)return this.logger.warn("challenge without Digest realm, authentication aborted"),!1;if(!this.nonce)return this.logger.warn("challenge without Digest nonce, authentication aborted"),!1;if(t.qop)if(t.qop.indexOf("auth")>-1)this.qop="auth";else if(t.qop.indexOf("auth-int")>-1)this.qop="auth-int";else return this.logger.warn("challenge without Digest qop different than 'auth' or 'auth-int', authentication aborted"),!1;else this.qop=void 0;return this.method=e.method,this.uri=e.ruri,this.cnonce=Qt(12),this.nc+=1,this.updateNcHex(),this.nc===4294967296&&(this.nc=1,this.ncHex="00000001"),this.calculateResponse(r),!0}toString(){const e=[];if(!this.response)throw new Error("response field does not exist, cannot generate Authorization header");return e.push("algorithm="+this.algorithm),e.push('username="'+this.username+'"'),e.push('realm="'+this.realm+'"'),e.push('nonce="'+this.nonce+'"'),e.push('uri="'+this.uri+'"'),e.push('response="'+this.response+'"'),this.opaque&&e.push('opaque="'+this.opaque+'"'),this.qop&&(e.push("qop="+this.qop),e.push('cnonce="'+this.cnonce+'"'),e.push("nc="+this.ncHex)),"Digest "+e.join(", ")}updateNcHex(){const e=Number(this.nc).toString(16);this.ncHex="00000000".substr(0,8-e.length)+e}calculateResponse(e){let t,r;t=this.ha1,(t===""||t===void 0)&&(t=Nt(this.username+":"+this.realm+":"+this.password)),this.qop==="auth"?(r=Nt(this.method+":"+this.uri),this.response=Nt(t+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth:"+r)):this.qop==="auth-int"?(r=Nt(this.method+":"+this.uri+":"+Nt(e||"")),this.response=Nt(t+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth-int:"+r)):this.qop===void 0&&(r=Nt(this.method+":"+this.uri),this.response=Nt(t+":"+this.nonce+":"+r))}}var Fe;(function(s){s[s.error=0]="error",s[s.warn=1]="warn",s[s.log=2]="log",s[s.debug=3]="debug"})(Fe=Fe||(Fe={}));class Fn{constructor(e,t,r){this.logger=e,this.category=t,this.label=r}error(e){this.genericLog(Fe.error,e)}warn(e){this.genericLog(Fe.warn,e)}log(e){this.genericLog(Fe.log,e)}debug(e){this.genericLog(Fe.debug,e)}genericLog(e,t){this.logger.genericLog(e,this.category,this.label,t)}get level(){return this.logger.level}set level(e){this.logger.level=e}}class Lo{constructor(){this.builtinEnabled=!0,this._level=Fe.log,this.loggers={},this.logger=this.getLogger("sip:loggerfactory")}get level(){return this._level}set level(e){e>=0&&e<=3?this._level=e:e>3?this._level=3:Fe.hasOwnProperty(e)?this._level=e:this.logger.error("invalid 'level' parameter value: "+JSON.stringify(e))}get connector(){return this._connector}set connector(e){e?typeof e=="function"?this._connector=e:this.logger.error("invalid 'connector' parameter value: "+JSON.stringify(e)):this._connector=void 0}getLogger(e,t){if(t&&this.level===3)return new Fn(this,e,t);if(this.loggers[e])return this.loggers[e];{const r=new Fn(this,e);return this.loggers[e]=r,r}}genericLog(e,t,r,i){this.level>=e&&this.builtinEnabled&&this.print(e,t,r,i),this.connector&&this.connector(Fe[e],t,r,i)}print(e,t,r,i){if(typeof i=="string"){const n=[new Date,t];r&&n.push(r),i=n.concat(i).join(" | ")}switch(e){case Fe.error:console.error(i);break;case Fe.warn:console.warn(i);break;case Fe.log:console.log(i);break;case Fe.debug:console.debug(i);break}}}var ss;(function(s){function e(i,n){let a=n,o=0,l=0;if(i.substring(a,a+2).match(/(^\r\n)/))return-2;for(;o===0;){if(l=i.indexOf(`\r
|
|
53
53
|
`,a),l===-1)return l;!i.substring(l+2,l+4).match(/(^\r\n)/)&&i.charAt(l+2).match(/(^\s+)/)?a=l+2:o=l}return o}s.getHeader=e;function t(i,n,a,o){const l=n.indexOf(":",a),c=n.substring(a,l).trim(),d=n.substring(l+1,o).trim();let g;switch(c.toLowerCase()){case"via":case"v":i.addHeader("via",d),i.getHeaders("via").length===1?(g=i.parseHeader("Via"),g&&(i.via=g,i.viaBranch=g.branch)):g=0;break;case"from":case"f":i.setHeader("from",d),g=i.parseHeader("from"),g&&(i.from=g,i.fromTag=g.getParam("tag"));break;case"to":case"t":i.setHeader("to",d),g=i.parseHeader("to"),g&&(i.to=g,i.toTag=g.getParam("tag"));break;case"record-route":if(g=Te.parse(d,"Record_Route"),g===-1){g=void 0;break}if(!(g instanceof Array)){g=void 0;break}g.forEach(u=>{i.addHeader("record-route",d.substring(u.position,u.offset)),i.headers["Record-Route"][i.getHeaders("record-route").length-1].parsed=u.parsed});break;case"call-id":case"i":i.setHeader("call-id",d),g=i.parseHeader("call-id"),g&&(i.callId=d);break;case"contact":case"m":if(g=Te.parse(d,"Contact"),g===-1){g=void 0;break}if(!(g instanceof Array)){g=void 0;break}g.forEach(u=>{i.addHeader("contact",d.substring(u.position,u.offset)),i.headers.Contact[i.getHeaders("contact").length-1].parsed=u.parsed});break;case"content-length":case"l":i.setHeader("content-length",d),g=i.parseHeader("content-length");break;case"content-type":case"c":i.setHeader("content-type",d),g=i.parseHeader("content-type");break;case"cseq":i.setHeader("cseq",d),g=i.parseHeader("cseq"),g&&(i.cseq=g.value),i instanceof Pt&&(i.method=g.method);break;case"max-forwards":i.setHeader("max-forwards",d),g=i.parseHeader("max-forwards");break;case"www-authenticate":i.setHeader("www-authenticate",d),g=i.parseHeader("www-authenticate");break;case"proxy-authenticate":i.setHeader("proxy-authenticate",d),g=i.parseHeader("proxy-authenticate");break;case"refer-to":case"r":i.setHeader("refer-to",d),g=i.parseHeader("refer-to"),g&&(i.referTo=g);break;default:i.addHeader(c.toLowerCase(),d),g=0}return g===void 0?{error:"error parsing header '"+c+"'"}:!0}s.parseHeader=t;function r(i,n){let a=0,o=i.indexOf(`\r
|
|
54
54
|
`);if(o===-1){n.warn("no CRLF found, not a SIP message, discarded");return}const l=i.substring(0,o),c=Te.parse(l,"Request_Response");let d;if(c===-1){n.warn('error parsing first line of SIP message: "'+l+'"');return}else c.status_code?(d=new Pt,d.statusCode=c.status_code,d.reasonPhrase=c.reason_phrase):(d=new gr,d.method=c.method,d.ruri=c.uri);d.data=i,a=o+2;let g;for(;;){if(o=e(i,a),o===-2){g=a+2;break}else if(o===-1){n.error("malformed message");return}const u=t(d,i,a,o);if(u&&u!==!0){n.error(u.error);return}a=o+2}return d.hasHeader("content-length")?d.body=i.substr(g,Number(d.getHeader("content-length"))):d.body=i.substring(g),d}s.parseMessage=r})(ss=ss||(ss={}));function Bn(s,e){const t=`\r
|
|
55
|
-
`;if(e.statusCode<100||e.statusCode>699)throw new TypeError("Invalid statusCode: "+e.statusCode);const r=e.reasonPhrase?e.reasonPhrase:es(e.statusCode);let i="SIP/2.0 "+e.statusCode+" "+r+t;e.statusCode>=100&&e.statusCode<200,e.statusCode;const n="From: "+s.getHeader("From")+t,a="Call-ID: "+s.callId+t,o="CSeq: "+s.cseq+" "+s.method+t,l=s.getHeaders("via").reduce((E,y)=>E+"Via: "+y+t,"");let c="To: "+s.getHeader("to");if(e.statusCode>100&&!s.parseHeader("to").hasParam("tag")){let E=e.toTag;E||(E=ts()),c+=";tag="+E}c+=t;let d="";e.supported&&(d="Supported: "+e.supported.join(", ")+t);let g="";e.userAgent&&(g="User-Agent: "+e.userAgent+t);let u="";return e.extraHeaders&&(u=e.extraHeaders.reduce((E,y)=>E+y.trim()+t,"")),i+=l,i+=n,i+=c,i+=o,i+=a,i+=d,i+=g,i+=u,e.body?(i+="Content-Type: "+e.body.contentType+t,i+="Content-Length: "+$r(e.body.content)+t+t,i+=e.body.content):i+="Content-Length: 0"+t+t,{message:i}}class Vs extends Xt{constructor(e){super(e||"Unspecified transport error.")}}class kn{constructor(e,t,r,i,n){this._transport=e,this._user=t,this._id=r,this._state=i,this.listeners=new Array,this.logger=t.loggerFactory.getLogger(n,r),this.logger.debug(`Constructing ${this.typeToString()} with id ${this.id}.`)}dispose(){this.logger.debug(`Destroyed ${this.typeToString()} with id ${this.id}.`)}get id(){return this._id}get kind(){throw new Error("Invalid kind.")}get state(){return this._state}get transport(){return this._transport}addStateChangeListener(e,t){const r=()=>{this.removeStateChangeListener(r),e()};(t==null?void 0:t.once)===!0?this.listeners.push(r):this.listeners.push(e)}notifyStateChangeListeners(){this.listeners.slice().forEach(e=>e())}removeStateChangeListener(e){this.listeners=this.listeners.filter(t=>t!==e)}logTransportError(e,t){this.logger.error(e.message),this.logger.error(`Transport error occurred in ${this.typeToString()} with id ${this.id}.`),this.logger.error(t)}send(e){return this.transport.send(e).catch(t=>{if(t instanceof Vs)throw this.onTransportError(t),t;let r;throw t&&typeof t.message=="string"?r=new Vs(t.message):r=new Vs,this.onTransportError(r),r})}setState(e){this.logger.debug(`State change to "${e}" on ${this.typeToString()} with id ${this.id}.`),this._state=e,this._user.onStateChange&&this._user.onStateChange(e),this.notifyStateChangeListeners()}typeToString(){return"UnknownType"}}class In extends kn{constructor(e,t,r,i,n){super(t,r,e.viaBranch,i,n),this._request=e,this.user=r}get request(){return this._request}}var R;(function(s){s.Accepted="Accepted",s.Calling="Calling",s.Completed="Completed",s.Confirmed="Confirmed",s.Proceeding="Proceeding",s.Terminated="Terminated",s.Trying="Trying"})(R=R||(R={}));class je extends In{constructor(e,t,r){super(e,t,r,R.Proceeding,"sip.transaction.ist")}dispose(){this.stopProgressExtensionTimer(),this.H&&(clearTimeout(this.H),this.H=void 0),this.I&&(clearTimeout(this.I),this.I=void 0),this.L&&(clearTimeout(this.L),this.L=void 0),super.dispose()}get kind(){return"ist"}receiveRequest(e){switch(this.state){case R.Proceeding:if(e.method===j.INVITE){this.lastProvisionalResponse&&this.send(this.lastProvisionalResponse).catch(r=>{this.logTransportError(r,"Failed to send retransmission of provisional response.")});return}break;case R.Accepted:if(e.method===j.INVITE)return;break;case R.Completed:if(e.method===j.INVITE){if(!this.lastFinalResponse)throw new Error("Last final response undefined.");this.send(this.lastFinalResponse).catch(r=>{this.logTransportError(r,"Failed to send retransmission of final response.")});return}if(e.method===j.ACK){this.stateTransition(R.Confirmed);return}break;case R.Confirmed:if(e.method===j.INVITE||e.method===j.ACK)return;break;case R.Terminated:if(e.method===j.INVITE||e.method===j.ACK)return;break;default:throw new Error(`Invalid state ${this.state}`)}const t=`INVITE server transaction received unexpected ${e.method} request while in state ${this.state}.`;this.logger.warn(t)}receiveResponse(e,t){if(e<100||e>699)throw new Error(`Invalid status code ${e}`);switch(this.state){case R.Proceeding:if(e>=100&&e<=199){this.lastProvisionalResponse=t,e>100&&this.startProgressExtensionTimer(),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send 1xx response.")});return}if(e>=200&&e<=299){this.lastFinalResponse=t,this.stateTransition(R.Accepted),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send 2xx response.")});return}if(e>=300&&e<=699){this.lastFinalResponse=t,this.stateTransition(R.Completed),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send non-2xx final response.")});return}break;case R.Accepted:if(e>=200&&e<=299){this.send(t).catch(i=>{this.logTransportError(i,"Failed to send 2xx response.")});return}break;case R.Completed:break;case R.Confirmed:break;case R.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const r=`INVITE server transaction received unexpected ${e} response from TU while in state ${this.state}.`;throw this.logger.error(r),new Error(r)}retransmitAcceptedResponse(){this.state===R.Accepted&&this.lastFinalResponse&&this.send(this.lastFinalResponse).catch(e=>{this.logTransportError(e,"Failed to send 2xx response.")})}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e)}typeToString(){return"INVITE server transaction"}stateTransition(e){const t=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case R.Proceeding:t();break;case R.Accepted:case R.Completed:this.state!==R.Proceeding&&t();break;case R.Confirmed:this.state!==R.Completed&&t();break;case R.Terminated:this.state!==R.Accepted&&this.state!==R.Completed&&this.state!==R.Confirmed&&t();break;default:t()}this.stopProgressExtensionTimer(),e===R.Accepted&&(this.L=setTimeout(()=>this.timerL(),Re.TIMER_L)),e===R.Completed&&(this.H=setTimeout(()=>this.timerH(),Re.TIMER_H)),e===R.Confirmed&&(this.I=setTimeout(()=>this.timerI(),Re.TIMER_I)),e===R.Terminated&&this.dispose(),this.setState(e)}startProgressExtensionTimer(){this.progressExtensionTimer===void 0&&(this.progressExtensionTimer=setInterval(()=>{if(this.logger.debug(`Progress extension timer expired for INVITE server transaction ${this.id}.`),!this.lastProvisionalResponse)throw new Error("Last provisional response undefined.");this.send(this.lastProvisionalResponse).catch(e=>{this.logTransportError(e,"Failed to send retransmission of provisional response.")})},Re.PROVISIONAL_RESPONSE_INTERVAL))}stopProgressExtensionTimer(){this.progressExtensionTimer!==void 0&&(clearInterval(this.progressExtensionTimer),this.progressExtensionTimer=void 0)}timerG(){}timerH(){this.logger.debug(`Timer H expired for INVITE server transaction ${this.id}.`),this.state===R.Completed&&(this.logger.warn("ACK to negative final response was never received, terminating transaction."),this.stateTransition(R.Terminated))}timerI(){this.logger.debug(`Timer I expired for INVITE server transaction ${this.id}.`),this.stateTransition(R.Terminated)}timerL(){this.logger.debug(`Timer L expired for INVITE server transaction ${this.id}.`),this.state===R.Accepted&&this.stateTransition(R.Terminated)}}class is extends kn{constructor(e,t,r,i,n){super(t,r,is.makeId(e),i,n),this._request=e,this.user=r,e.setViaHeader(this.id,t.protocol)}static makeId(e){if(e.method==="CANCEL"){if(!e.branch)throw new Error("Outgoing CANCEL request without a branch.");return e.branch}else return"z9hG4bK"+Math.floor(Math.random()*1e7)}get request(){return this._request}onRequestTimeout(){this.user.onRequestTimeout&&this.user.onRequestTimeout()}}class Ge extends is{constructor(e,t,r){super(e,t,r,R.Trying,"sip.transaction.nict"),this.F=setTimeout(()=>this.timerF(),Re.TIMER_F),this.send(e.toString()).catch(i=>{this.logTransportError(i,"Failed to send initial outgoing request.")})}dispose(){this.F&&(clearTimeout(this.F),this.F=void 0),this.K&&(clearTimeout(this.K),this.K=void 0),super.dispose()}get kind(){return"nict"}receiveResponse(e){const t=e.statusCode;if(!t||t<100||t>699)throw new Error(`Invalid status code ${t}`);switch(this.state){case R.Trying:if(t>=100&&t<=199){this.stateTransition(R.Proceeding),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=200&&t<=699){if(this.stateTransition(R.Completed),t===408){this.onRequestTimeout();return}this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case R.Proceeding:if(t>=100&&t<=199&&this.user.receiveResponse)return this.user.receiveResponse(e);if(t>=200&&t<=699){if(this.stateTransition(R.Completed),t===408){this.onRequestTimeout();return}this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case R.Completed:return;case R.Terminated:return;default:throw new Error(`Invalid state ${this.state}`)}const r=`Non-INVITE client transaction received unexpected ${t} response while in state ${this.state}.`;this.logger.warn(r)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(R.Terminated,!0)}typeToString(){return"non-INVITE client transaction"}stateTransition(e,t=!1){const r=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case R.Trying:r();break;case R.Proceeding:this.state!==R.Trying&&r();break;case R.Completed:this.state!==R.Trying&&this.state!==R.Proceeding&&r();break;case R.Terminated:this.state!==R.Trying&&this.state!==R.Proceeding&&this.state!==R.Completed&&(t||r());break;default:r()}e===R.Completed&&(this.F&&(clearTimeout(this.F),this.F=void 0),this.K=setTimeout(()=>this.timerK(),Re.TIMER_K)),e===R.Terminated&&this.dispose(),this.setState(e)}timerF(){this.logger.debug(`Timer F expired for non-INVITE client transaction ${this.id}.`),(this.state===R.Trying||this.state===R.Proceeding)&&(this.onRequestTimeout(),this.stateTransition(R.Terminated))}timerK(){this.state===R.Completed&&this.stateTransition(R.Terminated)}}class xr{constructor(e,t){this.core=e,this.dialogState=t,this.core.dialogs.set(this.id,this)}static initialDialogStateForUserAgentClient(e,t){const i=t.getHeaders("record-route").reverse(),n=t.parseHeader("contact");if(!n)throw new Error("Contact undefined.");if(!(n instanceof Le))throw new Error("Contact not instance of NameAddrHeader.");const a=n.uri,o=e.cseq,l=void 0,c=e.callId,d=e.fromTag,g=t.toTag;if(!c)throw new Error("Call id undefined.");if(!d)throw new Error("From tag undefined.");if(!g)throw new Error("To tag undefined.");if(!e.from)throw new Error("From undefined.");if(!e.to)throw new Error("To undefined.");const u=e.from.uri,E=e.to.uri;if(!t.statusCode)throw new Error("Incoming response status code undefined.");const y=t.statusCode<200;return{id:c+d+g,early:y,callId:c,localTag:d,remoteTag:g,localSequenceNumber:o,remoteSequenceNumber:l,localURI:u,remoteURI:E,remoteTarget:a,routeSet:i,secure:!1}}static initialDialogStateForUserAgentServer(e,t,r=!1){const n=e.getHeaders("record-route"),a=e.parseHeader("contact");if(!a)throw new Error("Contact undefined.");if(!(a instanceof Le))throw new Error("Contact not instance of NameAddrHeader.");const o=a.uri,l=e.cseq,c=void 0,d=e.callId,g=t,u=e.fromTag,E=e.from.uri,y=e.to.uri;return{id:d+g+u,early:r,callId:d,localTag:g,remoteTag:u,localSequenceNumber:c,remoteSequenceNumber:l,localURI:y,remoteURI:E,remoteTarget:o,routeSet:n,secure:!1}}dispose(){this.core.dialogs.delete(this.id)}get id(){return this.dialogState.id}get early(){return this.dialogState.early}get callId(){return this.dialogState.callId}get localTag(){return this.dialogState.localTag}get remoteTag(){return this.dialogState.remoteTag}get localSequenceNumber(){return this.dialogState.localSequenceNumber}get remoteSequenceNumber(){return this.dialogState.remoteSequenceNumber}get localURI(){return this.dialogState.localURI}get remoteURI(){return this.dialogState.remoteURI}get remoteTarget(){return this.dialogState.remoteTarget}get routeSet(){return this.dialogState.routeSet}get secure(){return this.dialogState.secure}get userAgentCore(){return this.core}confirm(){this.dialogState.early=!1}receiveRequest(e){if(e.method!==j.ACK){if(this.remoteSequenceNumber){if(e.cseq<=this.remoteSequenceNumber)throw new Error("Out of sequence in dialog request. Did you forget to call sequenceGuard()?");this.dialogState.remoteSequenceNumber=e.cseq}this.remoteSequenceNumber||(this.dialogState.remoteSequenceNumber=e.cseq)}}recomputeRouteSet(e){this.dialogState.routeSet=e.getHeaders("record-route").reverse()}createOutgoingRequestMessage(e,t){const r=this.remoteURI,i=this.remoteTag,n=this.localURI,a=this.localTag,o=this.callId;let l;t&&t.cseq?l=t.cseq:this.dialogState.localSequenceNumber?l=this.dialogState.localSequenceNumber+=1:l=this.dialogState.localSequenceNumber=1;const c=this.remoteTarget,d=this.routeSet,g=t&&t.extraHeaders,u=t&&t.body;return this.userAgentCore.makeOutgoingRequestMessage(e,c,n,r,{callId:o,cseq:l,fromTag:a,toTag:i,routeSet:d},g,u)}incrementLocalSequenceNumber(){if(!this.dialogState.localSequenceNumber)throw new Error("Local sequence number undefined.");this.dialogState.localSequenceNumber+=1}sequenceGuard(e){return e.method===j.ACK?!0:this.remoteSequenceNumber&&e.cseq<=this.remoteSequenceNumber?(this.core.replyStateless(e,{statusCode:500}),!1):!0}}class qt extends is{constructor(e,t,r){super(e,t,r,R.Calling,"sip.transaction.ict"),this.ackRetransmissionCache=new Map,this.B=setTimeout(()=>this.timerB(),Re.TIMER_B),this.send(e.toString()).catch(i=>{this.logTransportError(i,"Failed to send initial outgoing request.")})}dispose(){this.B&&(clearTimeout(this.B),this.B=void 0),this.D&&(clearTimeout(this.D),this.D=void 0),this.M&&(clearTimeout(this.M),this.M=void 0),super.dispose()}get kind(){return"ict"}ackResponse(e){const t=e.toTag;if(!t)throw new Error("To tag undefined.");const r="z9hG4bK"+Math.floor(Math.random()*1e7);e.setViaHeader(r,this.transport.protocol),this.ackRetransmissionCache.set(t,e),this.send(e.toString()).catch(i=>{this.logTransportError(i,"Failed to send ACK to 2xx response.")})}receiveResponse(e){const t=e.statusCode;if(!t||t<100||t>699)throw new Error(`Invalid status code ${t}`);switch(this.state){case R.Calling:if(t>=100&&t<=199){this.stateTransition(R.Proceeding),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=200&&t<=299){this.ackRetransmissionCache.set(e.toTag,void 0),this.stateTransition(R.Accepted),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=300&&t<=699){this.stateTransition(R.Completed),this.ack(e),this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case R.Proceeding:if(t>=100&&t<=199){this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=200&&t<=299){this.ackRetransmissionCache.set(e.toTag,void 0),this.stateTransition(R.Accepted),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=300&&t<=699){this.stateTransition(R.Completed),this.ack(e),this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case R.Accepted:if(t>=200&&t<=299){if(!this.ackRetransmissionCache.has(e.toTag)){this.ackRetransmissionCache.set(e.toTag,void 0),this.user.receiveResponse&&this.user.receiveResponse(e);return}const i=this.ackRetransmissionCache.get(e.toTag);if(i){this.send(i.toString()).catch(n=>{this.logTransportError(n,"Failed to send retransmission of ACK to 2xx response.")});return}return}break;case R.Completed:if(t>=300&&t<=699){this.ack(e);return}break;case R.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const r=`Received unexpected ${t} response while in state ${this.state}.`;this.logger.warn(r)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(R.Terminated,!0)}typeToString(){return"INVITE client transaction"}ack(e){const t=this.request.ruri,r=this.request.callId,i=this.request.cseq,n=this.request.getHeader("from"),a=e.getHeader("to"),o=this.request.getHeader("via"),l=this.request.getHeader("route");if(!n)throw new Error("From undefined.");if(!a)throw new Error("To undefined.");if(!o)throw new Error("Via undefined.");let c=`ACK ${t} SIP/2.0\r
|
|
55
|
+
`;if(e.statusCode<100||e.statusCode>699)throw new TypeError("Invalid statusCode: "+e.statusCode);const r=e.reasonPhrase?e.reasonPhrase:es(e.statusCode);let i="SIP/2.0 "+e.statusCode+" "+r+t;e.statusCode>=100&&e.statusCode<200,e.statusCode;const n="From: "+s.getHeader("From")+t,a="Call-ID: "+s.callId+t,o="CSeq: "+s.cseq+" "+s.method+t,l=s.getHeaders("via").reduce((y,E)=>y+"Via: "+E+t,"");let c="To: "+s.getHeader("to");if(e.statusCode>100&&!s.parseHeader("to").hasParam("tag")){let y=e.toTag;y||(y=ts()),c+=";tag="+y}c+=t;let d="";e.supported&&(d="Supported: "+e.supported.join(", ")+t);let g="";e.userAgent&&(g="User-Agent: "+e.userAgent+t);let u="";return e.extraHeaders&&(u=e.extraHeaders.reduce((y,E)=>y+E.trim()+t,"")),i+=l,i+=n,i+=c,i+=o,i+=a,i+=d,i+=g,i+=u,e.body?(i+="Content-Type: "+e.body.contentType+t,i+="Content-Length: "+$r(e.body.content)+t+t,i+=e.body.content):i+="Content-Length: 0"+t+t,{message:i}}class Vs extends Xt{constructor(e){super(e||"Unspecified transport error.")}}class kn{constructor(e,t,r,i,n){this._transport=e,this._user=t,this._id=r,this._state=i,this.listeners=new Array,this.logger=t.loggerFactory.getLogger(n,r),this.logger.debug(`Constructing ${this.typeToString()} with id ${this.id}.`)}dispose(){this.logger.debug(`Destroyed ${this.typeToString()} with id ${this.id}.`)}get id(){return this._id}get kind(){throw new Error("Invalid kind.")}get state(){return this._state}get transport(){return this._transport}addStateChangeListener(e,t){const r=()=>{this.removeStateChangeListener(r),e()};(t==null?void 0:t.once)===!0?this.listeners.push(r):this.listeners.push(e)}notifyStateChangeListeners(){this.listeners.slice().forEach(e=>e())}removeStateChangeListener(e){this.listeners=this.listeners.filter(t=>t!==e)}logTransportError(e,t){this.logger.error(e.message),this.logger.error(`Transport error occurred in ${this.typeToString()} with id ${this.id}.`),this.logger.error(t)}send(e){return this.transport.send(e).catch(t=>{if(t instanceof Vs)throw this.onTransportError(t),t;let r;throw t&&typeof t.message=="string"?r=new Vs(t.message):r=new Vs,this.onTransportError(r),r})}setState(e){this.logger.debug(`State change to "${e}" on ${this.typeToString()} with id ${this.id}.`),this._state=e,this._user.onStateChange&&this._user.onStateChange(e),this.notifyStateChangeListeners()}typeToString(){return"UnknownType"}}class In extends kn{constructor(e,t,r,i,n){super(t,r,e.viaBranch,i,n),this._request=e,this.user=r}get request(){return this._request}}var R;(function(s){s.Accepted="Accepted",s.Calling="Calling",s.Completed="Completed",s.Confirmed="Confirmed",s.Proceeding="Proceeding",s.Terminated="Terminated",s.Trying="Trying"})(R=R||(R={}));class je extends In{constructor(e,t,r){super(e,t,r,R.Proceeding,"sip.transaction.ist")}dispose(){this.stopProgressExtensionTimer(),this.H&&(clearTimeout(this.H),this.H=void 0),this.I&&(clearTimeout(this.I),this.I=void 0),this.L&&(clearTimeout(this.L),this.L=void 0),super.dispose()}get kind(){return"ist"}receiveRequest(e){switch(this.state){case R.Proceeding:if(e.method===j.INVITE){this.lastProvisionalResponse&&this.send(this.lastProvisionalResponse).catch(r=>{this.logTransportError(r,"Failed to send retransmission of provisional response.")});return}break;case R.Accepted:if(e.method===j.INVITE)return;break;case R.Completed:if(e.method===j.INVITE){if(!this.lastFinalResponse)throw new Error("Last final response undefined.");this.send(this.lastFinalResponse).catch(r=>{this.logTransportError(r,"Failed to send retransmission of final response.")});return}if(e.method===j.ACK){this.stateTransition(R.Confirmed);return}break;case R.Confirmed:if(e.method===j.INVITE||e.method===j.ACK)return;break;case R.Terminated:if(e.method===j.INVITE||e.method===j.ACK)return;break;default:throw new Error(`Invalid state ${this.state}`)}const t=`INVITE server transaction received unexpected ${e.method} request while in state ${this.state}.`;this.logger.warn(t)}receiveResponse(e,t){if(e<100||e>699)throw new Error(`Invalid status code ${e}`);switch(this.state){case R.Proceeding:if(e>=100&&e<=199){this.lastProvisionalResponse=t,e>100&&this.startProgressExtensionTimer(),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send 1xx response.")});return}if(e>=200&&e<=299){this.lastFinalResponse=t,this.stateTransition(R.Accepted),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send 2xx response.")});return}if(e>=300&&e<=699){this.lastFinalResponse=t,this.stateTransition(R.Completed),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send non-2xx final response.")});return}break;case R.Accepted:if(e>=200&&e<=299){this.send(t).catch(i=>{this.logTransportError(i,"Failed to send 2xx response.")});return}break;case R.Completed:break;case R.Confirmed:break;case R.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const r=`INVITE server transaction received unexpected ${e} response from TU while in state ${this.state}.`;throw this.logger.error(r),new Error(r)}retransmitAcceptedResponse(){this.state===R.Accepted&&this.lastFinalResponse&&this.send(this.lastFinalResponse).catch(e=>{this.logTransportError(e,"Failed to send 2xx response.")})}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e)}typeToString(){return"INVITE server transaction"}stateTransition(e){const t=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case R.Proceeding:t();break;case R.Accepted:case R.Completed:this.state!==R.Proceeding&&t();break;case R.Confirmed:this.state!==R.Completed&&t();break;case R.Terminated:this.state!==R.Accepted&&this.state!==R.Completed&&this.state!==R.Confirmed&&t();break;default:t()}this.stopProgressExtensionTimer(),e===R.Accepted&&(this.L=setTimeout(()=>this.timerL(),Re.TIMER_L)),e===R.Completed&&(this.H=setTimeout(()=>this.timerH(),Re.TIMER_H)),e===R.Confirmed&&(this.I=setTimeout(()=>this.timerI(),Re.TIMER_I)),e===R.Terminated&&this.dispose(),this.setState(e)}startProgressExtensionTimer(){this.progressExtensionTimer===void 0&&(this.progressExtensionTimer=setInterval(()=>{if(this.logger.debug(`Progress extension timer expired for INVITE server transaction ${this.id}.`),!this.lastProvisionalResponse)throw new Error("Last provisional response undefined.");this.send(this.lastProvisionalResponse).catch(e=>{this.logTransportError(e,"Failed to send retransmission of provisional response.")})},Re.PROVISIONAL_RESPONSE_INTERVAL))}stopProgressExtensionTimer(){this.progressExtensionTimer!==void 0&&(clearInterval(this.progressExtensionTimer),this.progressExtensionTimer=void 0)}timerG(){}timerH(){this.logger.debug(`Timer H expired for INVITE server transaction ${this.id}.`),this.state===R.Completed&&(this.logger.warn("ACK to negative final response was never received, terminating transaction."),this.stateTransition(R.Terminated))}timerI(){this.logger.debug(`Timer I expired for INVITE server transaction ${this.id}.`),this.stateTransition(R.Terminated)}timerL(){this.logger.debug(`Timer L expired for INVITE server transaction ${this.id}.`),this.state===R.Accepted&&this.stateTransition(R.Terminated)}}class is extends kn{constructor(e,t,r,i,n){super(t,r,is.makeId(e),i,n),this._request=e,this.user=r,e.setViaHeader(this.id,t.protocol)}static makeId(e){if(e.method==="CANCEL"){if(!e.branch)throw new Error("Outgoing CANCEL request without a branch.");return e.branch}else return"z9hG4bK"+Math.floor(Math.random()*1e7)}get request(){return this._request}onRequestTimeout(){this.user.onRequestTimeout&&this.user.onRequestTimeout()}}class Ge extends is{constructor(e,t,r){super(e,t,r,R.Trying,"sip.transaction.nict"),this.F=setTimeout(()=>this.timerF(),Re.TIMER_F),this.send(e.toString()).catch(i=>{this.logTransportError(i,"Failed to send initial outgoing request.")})}dispose(){this.F&&(clearTimeout(this.F),this.F=void 0),this.K&&(clearTimeout(this.K),this.K=void 0),super.dispose()}get kind(){return"nict"}receiveResponse(e){const t=e.statusCode;if(!t||t<100||t>699)throw new Error(`Invalid status code ${t}`);switch(this.state){case R.Trying:if(t>=100&&t<=199){this.stateTransition(R.Proceeding),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=200&&t<=699){if(this.stateTransition(R.Completed),t===408){this.onRequestTimeout();return}this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case R.Proceeding:if(t>=100&&t<=199&&this.user.receiveResponse)return this.user.receiveResponse(e);if(t>=200&&t<=699){if(this.stateTransition(R.Completed),t===408){this.onRequestTimeout();return}this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case R.Completed:return;case R.Terminated:return;default:throw new Error(`Invalid state ${this.state}`)}const r=`Non-INVITE client transaction received unexpected ${t} response while in state ${this.state}.`;this.logger.warn(r)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(R.Terminated,!0)}typeToString(){return"non-INVITE client transaction"}stateTransition(e,t=!1){const r=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case R.Trying:r();break;case R.Proceeding:this.state!==R.Trying&&r();break;case R.Completed:this.state!==R.Trying&&this.state!==R.Proceeding&&r();break;case R.Terminated:this.state!==R.Trying&&this.state!==R.Proceeding&&this.state!==R.Completed&&(t||r());break;default:r()}e===R.Completed&&(this.F&&(clearTimeout(this.F),this.F=void 0),this.K=setTimeout(()=>this.timerK(),Re.TIMER_K)),e===R.Terminated&&this.dispose(),this.setState(e)}timerF(){this.logger.debug(`Timer F expired for non-INVITE client transaction ${this.id}.`),(this.state===R.Trying||this.state===R.Proceeding)&&(this.onRequestTimeout(),this.stateTransition(R.Terminated))}timerK(){this.state===R.Completed&&this.stateTransition(R.Terminated)}}class xr{constructor(e,t){this.core=e,this.dialogState=t,this.core.dialogs.set(this.id,this)}static initialDialogStateForUserAgentClient(e,t){const i=t.getHeaders("record-route").reverse(),n=t.parseHeader("contact");if(!n)throw new Error("Contact undefined.");if(!(n instanceof Le))throw new Error("Contact not instance of NameAddrHeader.");const a=n.uri,o=e.cseq,l=void 0,c=e.callId,d=e.fromTag,g=t.toTag;if(!c)throw new Error("Call id undefined.");if(!d)throw new Error("From tag undefined.");if(!g)throw new Error("To tag undefined.");if(!e.from)throw new Error("From undefined.");if(!e.to)throw new Error("To undefined.");const u=e.from.uri,y=e.to.uri;if(!t.statusCode)throw new Error("Incoming response status code undefined.");const E=t.statusCode<200;return{id:c+d+g,early:E,callId:c,localTag:d,remoteTag:g,localSequenceNumber:o,remoteSequenceNumber:l,localURI:u,remoteURI:y,remoteTarget:a,routeSet:i,secure:!1}}static initialDialogStateForUserAgentServer(e,t,r=!1){const n=e.getHeaders("record-route"),a=e.parseHeader("contact");if(!a)throw new Error("Contact undefined.");if(!(a instanceof Le))throw new Error("Contact not instance of NameAddrHeader.");const o=a.uri,l=e.cseq,c=void 0,d=e.callId,g=t,u=e.fromTag,y=e.from.uri,E=e.to.uri;return{id:d+g+u,early:r,callId:d,localTag:g,remoteTag:u,localSequenceNumber:c,remoteSequenceNumber:l,localURI:E,remoteURI:y,remoteTarget:o,routeSet:n,secure:!1}}dispose(){this.core.dialogs.delete(this.id)}get id(){return this.dialogState.id}get early(){return this.dialogState.early}get callId(){return this.dialogState.callId}get localTag(){return this.dialogState.localTag}get remoteTag(){return this.dialogState.remoteTag}get localSequenceNumber(){return this.dialogState.localSequenceNumber}get remoteSequenceNumber(){return this.dialogState.remoteSequenceNumber}get localURI(){return this.dialogState.localURI}get remoteURI(){return this.dialogState.remoteURI}get remoteTarget(){return this.dialogState.remoteTarget}get routeSet(){return this.dialogState.routeSet}get secure(){return this.dialogState.secure}get userAgentCore(){return this.core}confirm(){this.dialogState.early=!1}receiveRequest(e){if(e.method!==j.ACK){if(this.remoteSequenceNumber){if(e.cseq<=this.remoteSequenceNumber)throw new Error("Out of sequence in dialog request. Did you forget to call sequenceGuard()?");this.dialogState.remoteSequenceNumber=e.cseq}this.remoteSequenceNumber||(this.dialogState.remoteSequenceNumber=e.cseq)}}recomputeRouteSet(e){this.dialogState.routeSet=e.getHeaders("record-route").reverse()}createOutgoingRequestMessage(e,t){const r=this.remoteURI,i=this.remoteTag,n=this.localURI,a=this.localTag,o=this.callId;let l;t&&t.cseq?l=t.cseq:this.dialogState.localSequenceNumber?l=this.dialogState.localSequenceNumber+=1:l=this.dialogState.localSequenceNumber=1;const c=this.remoteTarget,d=this.routeSet,g=t&&t.extraHeaders,u=t&&t.body;return this.userAgentCore.makeOutgoingRequestMessage(e,c,n,r,{callId:o,cseq:l,fromTag:a,toTag:i,routeSet:d},g,u)}incrementLocalSequenceNumber(){if(!this.dialogState.localSequenceNumber)throw new Error("Local sequence number undefined.");this.dialogState.localSequenceNumber+=1}sequenceGuard(e){return e.method===j.ACK?!0:this.remoteSequenceNumber&&e.cseq<=this.remoteSequenceNumber?(this.core.replyStateless(e,{statusCode:500}),!1):!0}}class qt extends is{constructor(e,t,r){super(e,t,r,R.Calling,"sip.transaction.ict"),this.ackRetransmissionCache=new Map,this.B=setTimeout(()=>this.timerB(),Re.TIMER_B),this.send(e.toString()).catch(i=>{this.logTransportError(i,"Failed to send initial outgoing request.")})}dispose(){this.B&&(clearTimeout(this.B),this.B=void 0),this.D&&(clearTimeout(this.D),this.D=void 0),this.M&&(clearTimeout(this.M),this.M=void 0),super.dispose()}get kind(){return"ict"}ackResponse(e){const t=e.toTag;if(!t)throw new Error("To tag undefined.");const r="z9hG4bK"+Math.floor(Math.random()*1e7);e.setViaHeader(r,this.transport.protocol),this.ackRetransmissionCache.set(t,e),this.send(e.toString()).catch(i=>{this.logTransportError(i,"Failed to send ACK to 2xx response.")})}receiveResponse(e){const t=e.statusCode;if(!t||t<100||t>699)throw new Error(`Invalid status code ${t}`);switch(this.state){case R.Calling:if(t>=100&&t<=199){this.stateTransition(R.Proceeding),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=200&&t<=299){this.ackRetransmissionCache.set(e.toTag,void 0),this.stateTransition(R.Accepted),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=300&&t<=699){this.stateTransition(R.Completed),this.ack(e),this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case R.Proceeding:if(t>=100&&t<=199){this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=200&&t<=299){this.ackRetransmissionCache.set(e.toTag,void 0),this.stateTransition(R.Accepted),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=300&&t<=699){this.stateTransition(R.Completed),this.ack(e),this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case R.Accepted:if(t>=200&&t<=299){if(!this.ackRetransmissionCache.has(e.toTag)){this.ackRetransmissionCache.set(e.toTag,void 0),this.user.receiveResponse&&this.user.receiveResponse(e);return}const i=this.ackRetransmissionCache.get(e.toTag);if(i){this.send(i.toString()).catch(n=>{this.logTransportError(n,"Failed to send retransmission of ACK to 2xx response.")});return}return}break;case R.Completed:if(t>=300&&t<=699){this.ack(e);return}break;case R.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const r=`Received unexpected ${t} response while in state ${this.state}.`;this.logger.warn(r)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(R.Terminated,!0)}typeToString(){return"INVITE client transaction"}ack(e){const t=this.request.ruri,r=this.request.callId,i=this.request.cseq,n=this.request.getHeader("from"),a=e.getHeader("to"),o=this.request.getHeader("via"),l=this.request.getHeader("route");if(!n)throw new Error("From undefined.");if(!a)throw new Error("To undefined.");if(!o)throw new Error("Via undefined.");let c=`ACK ${t} SIP/2.0\r
|
|
56
56
|
`;l&&(c+=`Route: ${l}\r
|
|
57
57
|
`),c+=`Via: ${o}\r
|
|
58
58
|
`,c+=`To: ${a}\r
|
|
@@ -62,7 +62,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
62
62
|
`,c+=`Max-Forwards: 70\r
|
|
63
63
|
`,c+=`Content-Length: 0\r
|
|
64
64
|
\r
|
|
65
|
-
`,this.send(c).catch(d=>{this.logTransportError(d,"Failed to send ACK to non-2xx response.")})}stateTransition(e,t=!1){const r=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case R.Calling:r();break;case R.Proceeding:this.state!==R.Calling&&r();break;case R.Accepted:case R.Completed:this.state!==R.Calling&&this.state!==R.Proceeding&&r();break;case R.Terminated:this.state!==R.Calling&&this.state!==R.Accepted&&this.state!==R.Completed&&(t||r());break;default:r()}this.B&&(clearTimeout(this.B),this.B=void 0),R.Proceeding,e===R.Completed&&(this.D=setTimeout(()=>this.timerD(),Re.TIMER_D)),e===R.Accepted&&(this.M=setTimeout(()=>this.timerM(),Re.TIMER_M)),e===R.Terminated&&this.dispose(),this.setState(e)}timerA(){}timerB(){this.logger.debug(`Timer B expired for INVITE client transaction ${this.id}.`),this.state===R.Calling&&(this.onRequestTimeout(),this.stateTransition(R.Terminated))}timerD(){this.logger.debug(`Timer D expired for INVITE client transaction ${this.id}.`),this.state===R.Completed&&this.stateTransition(R.Terminated)}timerM(){this.logger.debug(`Timer M expired for INVITE client transaction ${this.id}.`),this.state===R.Accepted&&this.stateTransition(R.Terminated)}}class He{constructor(e,t,r,i){this.transactionConstructor=e,this.core=t,this.message=r,this.delegate=i,this.challenged=!1,this.stale=!1,this.logger=this.loggerFactory.getLogger("sip.user-agent-client"),this.init()}dispose(){this.transaction.dispose()}get loggerFactory(){return this.core.loggerFactory}get transaction(){if(!this._transaction)throw new Error("Transaction undefined.");return this._transaction}cancel(e,t={}){if(!this.transaction)throw new Error("Transaction undefined.");if(!this.message.to)throw new Error("To undefined.");if(!this.message.from)throw new Error("From undefined.");const r=this.core.makeOutgoingRequestMessage(j.CANCEL,this.message.ruri,this.message.from.uri,this.message.to.uri,{toTag:this.message.toTag,fromTag:this.message.fromTag,callId:this.message.callId,cseq:this.message.cseq},t.extraHeaders);return r.branch=this.message.branch,this.message.headers.Route&&(r.headers.Route=this.message.headers.Route),e&&r.setHeader("Reason",e),this.transaction.state===R.Proceeding?new He(Ge,this.core,r):this.transaction.addStateChangeListener(()=>{this.transaction&&this.transaction.state===R.Proceeding&&new He(Ge,this.core,r)},{once:!0}),r}authenticationGuard(e,t){const r=e.statusCode;if(!r)throw new Error("Response status code undefined.");if(r!==401&&r!==407)return!0;let i,n;if(r===401?(i=e.parseHeader("www-authenticate"),n="authorization"):(i=e.parseHeader("proxy-authenticate"),n="proxy-authorization"),!i)return this.logger.warn(r+" with wrong or missing challenge, cannot authenticate"),!0;if(this.challenged&&(this.stale||i.stale!==!0))return this.logger.warn(r+" apparently in authentication loop, cannot authenticate"),!0;if(!this.credentials&&(this.credentials=this.core.configuration.authenticationFactory(),!this.credentials))return this.logger.warn("Unable to obtain credentials, cannot authenticate"),!0;if(!this.credentials.authenticate(this.message,i))return!0;this.challenged=!0,i.stale&&(this.stale=!0);let a=this.message.cseq+=1;return t&&t.localSequenceNumber&&(t.incrementLocalSequenceNumber(),a=this.message.cseq=t.localSequenceNumber),this.message.setHeader("cseq",a+" "+this.message.method),this.message.setHeader(n,this.credentials.toString()),this.init(),!1}onRequestTimeout(){this.logger.warn("User agent client request timed out. Generating internal 408 Request Timeout.");const e=new Pt;e.statusCode=408,e.reasonPhrase="Request Timeout",this.receiveResponse(e)}onTransportError(e){this.logger.error(e.message),this.logger.error("User agent client request transport error. Generating internal 503 Service Unavailable.");const t=new Pt;t.statusCode=503,t.reasonPhrase="Service Unavailable",this.receiveResponse(t)}receiveResponse(e){if(!this.authenticationGuard(e))return;const t=e.statusCode?e.statusCode.toString():"";if(!t)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(t):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:e});break;case/^1[0-9]{2}$/.test(t):this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:e});break;case/^2[0-9]{2}$/.test(t):this.delegate&&this.delegate.onAccept&&this.delegate.onAccept({message:e});break;case/^3[0-9]{2}$/.test(t):this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:e});break;case/^[4-6][0-9]{2}$/.test(t):this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e});break;default:throw new Error(`Invalid status code ${t}`)}}init(){const e={loggerFactory:this.loggerFactory,onRequestTimeout:()=>this.onRequestTimeout(),onStateChange:i=>{i===R.Terminated&&(this.core.userAgentClients.delete(r),t===this._transaction&&this.dispose())},onTransportError:i=>this.onTransportError(i),receiveResponse:i=>this.receiveResponse(i)},t=new this.transactionConstructor(this.message,this.core.transport,e);this._transaction=t;const r=t.id+t.request.method;this.core.userAgentClients.set(r,this)}}class jo extends He{constructor(e,t,r){const i=e.createOutgoingRequestMessage(j.BYE,r);super(Ge,e.userAgentCore,i,t),e.dispose()}}class Ve extends In{constructor(e,t,r){super(e,t,r,R.Trying,"sip.transaction.nist")}dispose(){this.J&&(clearTimeout(this.J),this.J=void 0),super.dispose()}get kind(){return"nist"}receiveRequest(e){switch(this.state){case R.Trying:break;case R.Proceeding:if(!this.lastResponse)throw new Error("Last response undefined.");this.send(this.lastResponse).catch(t=>{this.logTransportError(t,"Failed to send retransmission of provisional response.")});break;case R.Completed:if(!this.lastResponse)throw new Error("Last response undefined.");this.send(this.lastResponse).catch(t=>{this.logTransportError(t,"Failed to send retransmission of final response.")});break;case R.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}}receiveResponse(e,t){if(e<100||e>699)throw new Error(`Invalid status code ${e}`);if(e>100&&e<=199)throw new Error("Provisional response other than 100 not allowed.");switch(this.state){case R.Trying:if(this.lastResponse=t,e>=100&&e<200){this.stateTransition(R.Proceeding),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send provisional response.")});return}if(e>=200&&e<=699){this.stateTransition(R.Completed),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send final response.")});return}break;case R.Proceeding:if(this.lastResponse=t,e>=200&&e<=699){this.stateTransition(R.Completed),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send final response.")});return}break;case R.Completed:return;case R.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const r=`Non-INVITE server transaction received unexpected ${e} response from TU while in state ${this.state}.`;throw this.logger.error(r),new Error(r)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(R.Terminated,!0)}typeToString(){return"non-INVITE server transaction"}stateTransition(e,t=!1){const r=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case R.Trying:r();break;case R.Proceeding:this.state!==R.Trying&&r();break;case R.Completed:this.state!==R.Trying&&this.state!==R.Proceeding&&r();break;case R.Terminated:this.state!==R.Proceeding&&this.state!==R.Completed&&(t||r());break;default:r()}e===R.Completed&&(this.J=setTimeout(()=>this.timerJ(),Re.TIMER_J)),e===R.Terminated&&this.dispose(),this.setState(e)}timerJ(){this.logger.debug(`Timer J expired for NON-INVITE server transaction ${this.id}.`),this.state===R.Completed&&this.stateTransition(R.Terminated)}}class ft{constructor(e,t,r,i){this.transactionConstructor=e,this.core=t,this.message=r,this.delegate=i,this.logger=this.loggerFactory.getLogger("sip.user-agent-server"),this.toTag=r.toTag?r.toTag:ts(),this.init()}dispose(){this.transaction.dispose()}get loggerFactory(){return this.core.loggerFactory}get transaction(){if(!this._transaction)throw new Error("Transaction undefined.");return this._transaction}accept(e={statusCode:200}){if(!this.acceptable)throw new Ot(`${this.message.method} not acceptable in state ${this.transaction.state}.`);const t=e.statusCode;if(t<200||t>299)throw new TypeError(`Invalid statusCode: ${t}`);return this.reply(e)}progress(e={statusCode:180}){if(!this.progressable)throw new Ot(`${this.message.method} not progressable in state ${this.transaction.state}.`);const t=e.statusCode;if(t<101||t>199)throw new TypeError(`Invalid statusCode: ${t}`);return this.reply(e)}redirect(e,t={statusCode:302}){if(!this.redirectable)throw new Ot(`${this.message.method} not redirectable in state ${this.transaction.state}.`);const r=t.statusCode;if(r<300||r>399)throw new TypeError(`Invalid statusCode: ${r}`);const i=new Array;return e.forEach(a=>i.push(`Contact: ${a.toString()}`)),t.extraHeaders=(t.extraHeaders||[]).concat(i),this.reply(t)}reject(e={statusCode:480}){if(!this.rejectable)throw new Ot(`${this.message.method} not rejectable in state ${this.transaction.state}.`);const t=e.statusCode;if(t<400||t>699)throw new TypeError(`Invalid statusCode: ${t}`);return this.reply(e)}trying(e){if(!this.tryingable)throw new Ot(`${this.message.method} not tryingable in state ${this.transaction.state}.`);return this.reply({statusCode:100})}receiveCancel(e){this.delegate&&this.delegate.onCancel&&this.delegate.onCancel(e)}get acceptable(){if(this.transaction instanceof je)return this.transaction.state===R.Proceeding||this.transaction.state===R.Accepted;if(this.transaction instanceof Ve)return this.transaction.state===R.Trying||this.transaction.state===R.Proceeding;throw new Error("Unknown transaction type.")}get progressable(){if(this.transaction instanceof je)return this.transaction.state===R.Proceeding;if(this.transaction instanceof Ve)return!1;throw new Error("Unknown transaction type.")}get redirectable(){if(this.transaction instanceof je)return this.transaction.state===R.Proceeding;if(this.transaction instanceof Ve)return this.transaction.state===R.Trying||this.transaction.state===R.Proceeding;throw new Error("Unknown transaction type.")}get rejectable(){if(this.transaction instanceof je)return this.transaction.state===R.Proceeding;if(this.transaction instanceof Ve)return this.transaction.state===R.Trying||this.transaction.state===R.Proceeding;throw new Error("Unknown transaction type.")}get tryingable(){if(this.transaction instanceof je)return this.transaction.state===R.Proceeding;if(this.transaction instanceof Ve)return this.transaction.state===R.Trying;throw new Error("Unknown transaction type.")}reply(e){!e.toTag&&e.statusCode!==100&&(e.toTag=this.toTag),e.userAgent=e.userAgent||this.core.configuration.userAgentHeaderFieldValue,e.supported=e.supported||this.core.configuration.supportedOptionTagsResponse;const t=Bn(this.message,e);return this.transaction.receiveResponse(e.statusCode,t.message),t}init(){const e={loggerFactory:this.loggerFactory,onStateChange:i=>{i===R.Terminated&&(this.core.userAgentServers.delete(r),this.dispose())},onTransportError:i=>{this.logger.error(i.message),this.delegate&&this.delegate.onTransportError?this.delegate.onTransportError(i):this.logger.error("User agent server response transport error.")}},t=new this.transactionConstructor(this.message,this.core.transport,e);this._transaction=t;const r=t.id;this.core.userAgentServers.set(t.id,this)}}class Yo extends ft{constructor(e,t,r){super(Ve,e.userAgentCore,t,r)}}class Wo extends He{constructor(e,t,r){const i=e.createOutgoingRequestMessage(j.INFO,r);super(Ge,e.userAgentCore,i,t)}}class Go extends ft{constructor(e,t,r){super(Ve,e.userAgentCore,t,r)}}class $n extends He{constructor(e,t,r){super(Ge,e,t,r)}}class Hn extends ft{constructor(e,t,r){super(Ve,e,t,r)}}class Vo extends He{constructor(e,t,r){const i=e.createOutgoingRequestMessage(j.NOTIFY,r);super(Ge,e.userAgentCore,i,t)}}function zo(s){return s.userAgentCore!==void 0}class ns extends ft{constructor(e,t,r){const i=zo(e)?e.userAgentCore:e;super(Ve,i,t,r)}}class Ko extends He{constructor(e,t,r){const i=e.createOutgoingRequestMessage(j.PRACK,r);super(Ge,e.userAgentCore,i,t),e.signalingStateTransition(i)}}class Zo extends ft{constructor(e,t,r){super(Ve,e.userAgentCore,t,r),e.signalingStateTransition(t),this.dialog=e}accept(e={statusCode:200}){return e.body&&this.dialog.signalingStateTransition(e.body),super.accept(e)}}class Jo extends He{constructor(e,t,r){const i=e.createOutgoingRequestMessage(j.INVITE,r);super(qt,e.userAgentCore,i,t),this.delegate=t,e.signalingStateTransition(i),e.reinviteUserAgentClient=this,this.dialog=e}receiveResponse(e){if(!this.authenticationGuard(e,this.dialog))return;const t=e.statusCode?e.statusCode.toString():"";if(!t)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(t):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:e});break;case/^1[0-9]{2}$/.test(t):this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:e,session:this.dialog,prack:r=>{throw new Error("Unimplemented.")}});break;case/^2[0-9]{2}$/.test(t):this.dialog.signalingStateTransition(e),this.delegate&&this.delegate.onAccept&&this.delegate.onAccept({message:e,session:this.dialog,ack:r=>this.dialog.ack(r)});break;case/^3[0-9]{2}$/.test(t):this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentClient=void 0,this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:e});break;case/^[4-6][0-9]{2}$/.test(t):this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentClient=void 0,this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e});break;default:throw new Error(`Invalid status code ${t}`)}}}class Xo extends ft{constructor(e,t,r){super(je,e.userAgentCore,t,r),e.reinviteUserAgentServer=this,this.dialog=e}accept(e={statusCode:200}){e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(this.dialog.routeSet.map(n=>`Record-Route: ${n}`));const t=super.accept(e),r=this.dialog,i=Object.assign(Object.assign({},t),{session:r});return e.body&&this.dialog.signalingStateTransition(e.body),this.dialog.reConfirm(),i}progress(e={statusCode:180}){const t=super.progress(e),r=this.dialog,i=Object.assign(Object.assign({},t),{session:r});return e.body&&this.dialog.signalingStateTransition(e.body),i}redirect(e,t={statusCode:302}){throw this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentServer=void 0,new Error("Unimplemented.")}reject(e={statusCode:488}){return this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentServer=void 0,super.reject(e)}}class Qo extends He{constructor(e,t,r){const i=e.createOutgoingRequestMessage(j.REFER,r);super(Ge,e.userAgentCore,i,t)}}function e0(s){return s.userAgentCore!==void 0}class Pn extends ft{constructor(e,t,r){const i=e0(e)?e.userAgentCore:e;super(Ve,i,t,r)}}class as extends xr{constructor(e,t,r,i){super(t,r),this.initialTransaction=e,this._signalingState=U.Initial,this.ackWait=!1,this.ackProcessing=!1,this.delegate=i,e instanceof je&&(this.ackWait=!0),this.early||this.start2xxRetransmissionTimer(),this.signalingStateTransition(e.request),this.logger=t.loggerFactory.getLogger("sip.invite-dialog"),this.logger.log(`INVITE dialog ${this.id} constructed`)}dispose(){super.dispose(),this._signalingState=U.Closed,this._offer=void 0,this._answer=void 0,this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.logger.log(`INVITE dialog ${this.id} destroyed`)}get sessionState(){return this.early?Je.Early:this.ackWait?Je.AckWait:this._signalingState===U.Closed?Je.Terminated:Je.Confirmed}get signalingState(){return this._signalingState}get offer(){return this._offer}get answer(){return this._answer}confirm(){this.early&&this.start2xxRetransmissionTimer(),super.confirm()}reConfirm(){this.reinviteUserAgentServer&&this.startReInvite2xxRetransmissionTimer()}ack(e={}){this.logger.log(`INVITE dialog ${this.id} sending ACK request`);let t;if(this.reinviteUserAgentClient){if(!(this.reinviteUserAgentClient.transaction instanceof qt))throw new Error("Transaction not instance of InviteClientTransaction.");t=this.reinviteUserAgentClient.transaction,this.reinviteUserAgentClient=void 0}else{if(!(this.initialTransaction instanceof qt))throw new Error("Initial transaction not instance of InviteClientTransaction.");t=this.initialTransaction}const r=this.createOutgoingRequestMessage(j.ACK,{cseq:t.request.cseq,extraHeaders:e.extraHeaders,body:e.body});return t.ackResponse(r),this.signalingStateTransition(r),{message:r}}bye(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending BYE request`),this.initialTransaction instanceof je){if(this.early)throw new Error("UAS MUST NOT send a BYE on early dialogs.");if(this.ackWait&&this.initialTransaction.state!==R.Terminated)throw new Error("UAS MUST NOT send a BYE on a confirmed dialog until it has received an ACK for its 2xx response or until the server transaction times out.")}return new jo(this,e,t)}info(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending INFO request`),this.early)throw new Error("Dialog not confirmed.");return new Wo(this,e,t)}invite(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending INVITE request`),this.early)throw new Error("Dialog not confirmed.");if(this.reinviteUserAgentClient)throw new Error("There is an ongoing re-INVITE client transaction.");if(this.reinviteUserAgentServer)throw new Error("There is an ongoing re-INVITE server transaction.");return new Jo(this,e,t)}message(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending MESSAGE request`),this.early)throw new Error("Dialog not confirmed.");const r=this.createOutgoingRequestMessage(j.MESSAGE,t);return new $n(this.core,r,e)}notify(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending NOTIFY request`),this.early)throw new Error("Dialog not confirmed.");return new Vo(this,e,t)}prack(e,t){return this.logger.log(`INVITE dialog ${this.id} sending PRACK request`),new Ko(this,e,t)}refer(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending REFER request`),this.early)throw new Error("Dialog not confirmed.");return new Qo(this,e,t)}receiveRequest(e){if(this.logger.log(`INVITE dialog ${this.id} received ${e.method} request`),e.method===j.ACK){if(this.ackWait){if(this.initialTransaction instanceof qt){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}if(this.initialTransaction.request.cseq!==e.cseq){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}this.ackWait=!1}else{if(!this.reinviteUserAgentServer){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}if(this.reinviteUserAgentServer.transaction.request.cseq!==e.cseq){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}this.reinviteUserAgentServer=void 0}if(this.signalingStateTransition(e),this.delegate&&this.delegate.onAck){const t=this.delegate.onAck({message:e});t instanceof Promise&&(this.ackProcessing=!0,t.then(()=>this.ackProcessing=!1).catch(()=>this.ackProcessing=!1))}return}if(!this.sequenceGuard(e)){this.logger.log(`INVITE dialog ${this.id} rejected out of order ${e.method} request.`);return}if(super.receiveRequest(e),e.method===j.INVITE){const t=()=>{const n=this.ackWait?"waiting for initial ACK":"processing initial ACK";this.logger.warn(`INVITE dialog ${this.id} received re-INVITE while ${n}`);let a="RFC 5407 suggests the following to avoid this race condition... ";a+=" Note: Implementation issues are outside the scope of this document,",a+=" but the following tip is provided for avoiding race conditions of",a+=" this type. The caller can delay sending re-INVITE F6 for some period",a+=" of time (2 seconds, perhaps), after which the caller can reasonably",a+=" assume that its ACK has been received. Implementors can decouple the",a+=" actions of the user (e.g., pressing the hold button) from the actions",a+=" of the protocol (the sending of re-INVITE F6), so that the UA can",a+=" behave like this. In this case, it is the implementor's choice as to",a+=" how long to wait. In most cases, such an implementation may be",a+=" useful to prevent the type of race condition shown in this section.",a+=" This document expresses no preference about whether or not they",a+=" should wait for an ACK to be delivered. After considering the impact",a+=" on user experience, implementors should decide whether or not to wait",a+=" for a while, because the user experience depends on the",a+=" implementation and has no direct bearing on protocol behavior.",this.logger.warn(a)},i=[`Retry-After: ${Math.floor(Math.random()*10)+1}`];if(this.ackProcessing){this.core.replyStateless(e,{statusCode:500,extraHeaders:i}),t();return}if(this.ackWait&&this.signalingState!==U.Stable){this.core.replyStateless(e,{statusCode:500,extraHeaders:i}),t();return}if(this.reinviteUserAgentServer){this.core.replyStateless(e,{statusCode:500,extraHeaders:i});return}if(this.reinviteUserAgentClient){this.core.replyStateless(e,{statusCode:491});return}}if(e.method===j.INVITE){const t=e.parseHeader("contact");if(!t)throw new Error("Contact undefined.");if(!(t instanceof Le))throw new Error("Contact not instance of NameAddrHeader.");this.dialogState.remoteTarget=t.uri}switch(e.method){case j.BYE:{const t=new Yo(this,e);this.delegate&&this.delegate.onBye?this.delegate.onBye(t):t.accept(),this.dispose()}break;case j.INFO:{const t=new Go(this,e);this.delegate&&this.delegate.onInfo?this.delegate.onInfo(t):t.reject({statusCode:469,extraHeaders:["Recv-Info:"]})}break;case j.INVITE:{const t=new Xo(this,e);this.signalingStateTransition(e),this.delegate&&this.delegate.onInvite?this.delegate.onInvite(t):t.reject({statusCode:488})}break;case j.MESSAGE:{const t=new Hn(this.core,e);this.delegate&&this.delegate.onMessage?this.delegate.onMessage(t):t.accept()}break;case j.NOTIFY:{const t=new ns(this,e);this.delegate&&this.delegate.onNotify?this.delegate.onNotify(t):t.accept()}break;case j.PRACK:{const t=new Zo(this,e);this.delegate&&this.delegate.onPrack?this.delegate.onPrack(t):t.accept()}break;case j.REFER:{const t=new Pn(this,e);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(t):t.reject()}break;default:this.logger.log(`INVITE dialog ${this.id} received unimplemented ${e.method} request`),this.core.replyStateless(e,{statusCode:501});break}}reliableSequenceGuard(e){const t=e.statusCode;if(!t)throw new Error("Status code undefined");if(t>100&&t<200){const r=e.getHeader("require"),i=e.getHeader("rseq"),n=r&&r.includes("100rel")&&i?Number(i):void 0;if(n){if(this.rseq&&this.rseq+1!==n)return!1;this.rseq=this.rseq?this.rseq+1:n}}return!0}signalingStateRollback(){(this._signalingState===U.HaveLocalOffer||this.signalingState===U.HaveRemoteOffer)&&this._rollbackOffer&&this._rollbackAnswer&&(this._signalingState=U.Stable,this._offer=this._rollbackOffer,this._answer=this._rollbackAnswer)}signalingStateTransition(e){const t=Hr(e);if(!(!t||t.contentDisposition!=="session")){if(this._signalingState===U.Stable&&(this._rollbackOffer=this._offer,this._rollbackAnswer=this._answer),e instanceof gr)switch(this._signalingState){case U.Initial:case U.Stable:this._signalingState=U.HaveRemoteOffer,this._offer=t,this._answer=void 0;break;case U.HaveLocalOffer:this._signalingState=U.Stable,this._answer=t;break;case U.HaveRemoteOffer:break;case U.Closed:break;default:throw new Error("Unexpected signaling state.")}if(e instanceof Pt)switch(this._signalingState){case U.Initial:case U.Stable:this._signalingState=U.HaveRemoteOffer,this._offer=t,this._answer=void 0;break;case U.HaveLocalOffer:this._signalingState=U.Stable,this._answer=t;break;case U.HaveRemoteOffer:break;case U.Closed:break;default:throw new Error("Unexpected signaling state.")}if(e instanceof er)switch(this._signalingState){case U.Initial:case U.Stable:this._signalingState=U.HaveLocalOffer,this._offer=t,this._answer=void 0;break;case U.HaveLocalOffer:break;case U.HaveRemoteOffer:this._signalingState=U.Stable,this._answer=t;break;case U.Closed:break;default:throw new Error("Unexpected signaling state.")}if(An(e))switch(this._signalingState){case U.Initial:case U.Stable:this._signalingState=U.HaveLocalOffer,this._offer=t,this._answer=void 0;break;case U.HaveLocalOffer:break;case U.HaveRemoteOffer:this._signalingState=U.Stable,this._answer=t;break;case U.Closed:break;default:throw new Error("Unexpected signaling state.")}}}start2xxRetransmissionTimer(){if(this.initialTransaction instanceof je){const e=this.initialTransaction;let t=Re.T1;const r=()=>{if(!this.ackWait){this.invite2xxTimer=void 0;return}this.logger.log("No ACK for 2xx response received, attempting retransmission"),e.retransmitAcceptedResponse(),t=Math.min(t*2,Re.T2),this.invite2xxTimer=setTimeout(r,t)};this.invite2xxTimer=setTimeout(r,t);const i=()=>{e.state===R.Terminated&&(e.removeStateChangeListener(i),this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.ackWait&&(this.delegate&&this.delegate.onAckTimeout?this.delegate.onAckTimeout():this.bye()))};e.addStateChangeListener(i)}}startReInvite2xxRetransmissionTimer(){if(this.reinviteUserAgentServer&&this.reinviteUserAgentServer.transaction instanceof je){const e=this.reinviteUserAgentServer.transaction;let t=Re.T1;const r=()=>{if(!this.reinviteUserAgentServer){this.invite2xxTimer=void 0;return}this.logger.log("No ACK for 2xx response received, attempting retransmission"),e.retransmitAcceptedResponse(),t=Math.min(t*2,Re.T2),this.invite2xxTimer=setTimeout(r,t)};this.invite2xxTimer=setTimeout(r,t);const i=()=>{e.state===R.Terminated&&(e.removeStateChangeListener(i),this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.reinviteUserAgentServer)};e.addStateChangeListener(i)}}}class t0 extends He{constructor(e,t,r){super(qt,e,t,r),this.confirmedDialogAcks=new Map,this.confirmedDialogs=new Map,this.earlyDialogs=new Map,this.delegate=r}dispose(){this.earlyDialogs.forEach(e=>e.dispose()),this.earlyDialogs.clear(),super.dispose()}onTransportError(e){if(this.transaction.state===R.Calling)return super.onTransportError(e);this.logger.error(e.message),this.logger.error("User agent client request transport error while sending ACK.")}receiveResponse(e){if(!this.authenticationGuard(e))return;const t=e.statusCode?e.statusCode.toString():"";if(!t)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(t):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:e});return;case/^1[0-9]{2}$/.test(t):{if(!e.toTag){this.logger.warn("Non-100 1xx INVITE response received without a to tag, dropping.");return}if(!e.parseHeader("contact")){this.logger.error("Non-100 1xx INVITE response received without a Contact header field, dropping.");return}const i=xr.initialDialogStateForUserAgentClient(this.message,e);let n=this.earlyDialogs.get(i.id);if(!n){const o=this.transaction;if(!(o instanceof qt))throw new Error("Transaction not instance of InviteClientTransaction.");n=new as(o,this.core,i),this.earlyDialogs.set(n.id,n)}if(!n.reliableSequenceGuard(e)){this.logger.warn("1xx INVITE reliable response received out of order or is a retransmission, dropping.");return}(n.signalingState===U.Initial||n.signalingState===U.HaveLocalOffer)&&n.signalingStateTransition(e);const a=n;this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:e,session:a,prack:o=>a.prack(void 0,o)})}return;case/^2[0-9]{2}$/.test(t):{if(!e.toTag){this.logger.error("2xx INVITE response received without a to tag, dropping.");return}if(!e.parseHeader("contact")){this.logger.error("2xx INVITE response received without a Contact header field, dropping.");return}const i=xr.initialDialogStateForUserAgentClient(this.message,e);let n=this.confirmedDialogs.get(i.id);if(n){const o=this.confirmedDialogAcks.get(i.id);if(o){const l=this.transaction;if(!(l instanceof qt))throw new Error("Client transaction not instance of InviteClientTransaction.");l.ackResponse(o.message)}return}if(n=this.earlyDialogs.get(i.id),n)n.confirm(),n.recomputeRouteSet(e),this.earlyDialogs.delete(n.id),this.confirmedDialogs.set(n.id,n);else{const o=this.transaction;if(!(o instanceof qt))throw new Error("Transaction not instance of InviteClientTransaction.");n=new as(o,this.core,i),this.confirmedDialogs.set(n.id,n)}(n.signalingState===U.Initial||n.signalingState===U.HaveLocalOffer)&&n.signalingStateTransition(e);const a=n;if(this.delegate&&this.delegate.onAccept)this.delegate.onAccept({message:e,session:a,ack:o=>{const l=a.ack(o);return this.confirmedDialogAcks.set(a.id,l),l}});else{const o=a.ack();this.confirmedDialogAcks.set(a.id,o)}}return;case/^3[0-9]{2}$/.test(t):this.earlyDialogs.forEach(r=>r.dispose()),this.earlyDialogs.clear(),this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:e});return;case/^[4-6][0-9]{2}$/.test(t):this.earlyDialogs.forEach(r=>r.dispose()),this.earlyDialogs.clear(),this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e});return;default:throw new Error(`Invalid status code ${t}`)}}}class zs extends ft{constructor(e,t,r){super(je,e,t,r),this.core=e}dispose(){this.earlyDialog&&this.earlyDialog.dispose(),super.dispose()}accept(e={statusCode:200}){if(!this.acceptable)throw new Ot(`${this.message.method} not acceptable in state ${this.transaction.state}.`);if(!this.confirmedDialog)if(this.earlyDialog)this.earlyDialog.confirm(),this.confirmedDialog=this.earlyDialog,this.earlyDialog=void 0;else{const l=this.transaction;if(!(l instanceof je))throw new Error("Transaction not instance of InviteClientTransaction.");const c=xr.initialDialogStateForUserAgentServer(this.message,this.toTag);this.confirmedDialog=new as(l,this.core,c)}const t=this.message.getHeaders("record-route").map(l=>`Record-Route: ${l}`),r=`Contact: ${this.core.configuration.contact.toString()}`,i="Allow: "+Mt.toString();if(!e.body){if(this.confirmedDialog.signalingState===U.Stable)e.body=this.confirmedDialog.answer;else if(this.confirmedDialog.signalingState===U.Initial||this.confirmedDialog.signalingState===U.HaveRemoteOffer)throw new Error("Response must have a body.")}e.statusCode=e.statusCode||200,e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(t),e.extraHeaders.push(i),e.extraHeaders.push(r);const n=super.accept(e),a=this.confirmedDialog,o=Object.assign(Object.assign({},n),{session:a});return e.body&&this.confirmedDialog.signalingState!==U.Stable&&this.confirmedDialog.signalingStateTransition(e.body),o}progress(e={statusCode:180}){if(!this.progressable)throw new Ot(`${this.message.method} not progressable in state ${this.transaction.state}.`);if(!this.earlyDialog){const o=this.transaction;if(!(o instanceof je))throw new Error("Transaction not instance of InviteClientTransaction.");const l=xr.initialDialogStateForUserAgentServer(this.message,this.toTag,!0);this.earlyDialog=new as(o,this.core,l)}const t=this.message.getHeaders("record-route").map(o=>`Record-Route: ${o}`),r=`Contact: ${this.core.configuration.contact}`;e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(t),e.extraHeaders.push(r);const i=super.progress(e),n=this.earlyDialog,a=Object.assign(Object.assign({},i),{session:n});return e.body&&this.earlyDialog.signalingState!==U.Stable&&this.earlyDialog.signalingStateTransition(e.body),a}redirect(e,t={statusCode:302}){return super.redirect(e,t)}reject(e={statusCode:486}){return super.reject(e)}}class r0 extends He{constructor(e,t,r){super(Ge,e,t,r)}}class s0 extends He{constructor(e,t,r){super(Ge,e,t,r)}}class i0 extends ft{constructor(e,t,r){super(Ve,e,t,r),this.core=e}}class n0 extends He{constructor(e,t,r){const i=e.createOutgoingRequestMessage(j.SUBSCRIBE,r);super(Ge,e.userAgentCore,i,t),this.dialog=e}waitNotifyStop(){}receiveResponse(e){if(e.statusCode&&e.statusCode>=200&&e.statusCode<300){const t=e.getHeader("Expires");if(!t)this.logger.warn("Expires header missing in a 200-class response to SUBSCRIBE");else{const r=Number(t);this.dialog.subscriptionExpires>r&&(this.dialog.subscriptionExpires=r)}}e.statusCode&&e.statusCode>=400&&e.statusCode<700&&[404,405,410,416,480,481,482,483,484,485,489,501,604].includes(e.statusCode)&&this.dialog.terminate(),super.receiveResponse(e)}}class On extends xr{constructor(e,t,r,i,n,a){super(i,n),this.delegate=a,this._autoRefresh=!1,this._subscriptionEvent=e,this._subscriptionExpires=t,this._subscriptionExpiresInitial=t,this._subscriptionExpiresLastSet=Math.floor(Date.now()/1e3),this._subscriptionRefresh=void 0,this._subscriptionRefreshLastSet=void 0,this._subscriptionState=r,this.logger=i.loggerFactory.getLogger("sip.subscribe-dialog"),this.logger.log(`SUBSCRIBE dialog ${this.id} constructed`)}static initialDialogStateForSubscription(e,t){const i=t.getHeaders("record-route"),n=t.parseHeader("contact");if(!n)throw new Error("Contact undefined.");if(!(n instanceof Le))throw new Error("Contact not instance of NameAddrHeader.");const a=n.uri,o=e.cseq,l=void 0,c=e.callId,d=e.fromTag,g=t.fromTag;if(!c)throw new Error("Call id undefined.");if(!d)throw new Error("From tag undefined.");if(!g)throw new Error("To tag undefined.");if(!e.from)throw new Error("From undefined.");if(!e.to)throw new Error("To undefined.");const u=e.from.uri,E=e.to.uri;return{id:c+d+g,early:!1,callId:c,localTag:d,remoteTag:g,localSequenceNumber:o,remoteSequenceNumber:l,localURI:u,remoteURI:E,remoteTarget:a,routeSet:i,secure:!1}}dispose(){super.dispose(),this.N&&(clearTimeout(this.N),this.N=void 0),this.refreshTimerClear(),this.logger.log(`SUBSCRIBE dialog ${this.id} destroyed`)}get autoRefresh(){return this._autoRefresh}set autoRefresh(e){this._autoRefresh=!0,this.refreshTimerSet()}get subscriptionEvent(){return this._subscriptionEvent}get subscriptionExpires(){const e=Math.floor(Date.now()/1e3)-this._subscriptionExpiresLastSet,t=this._subscriptionExpires-e;return Math.max(t,0)}set subscriptionExpires(e){if(e<0)throw new Error("Expires must be greater than or equal to zero.");if(this._subscriptionExpires=e,this._subscriptionExpiresLastSet=Math.floor(Date.now()/1e3),this.autoRefresh){const t=this.subscriptionRefresh;(t===void 0||t>=e)&&this.refreshTimerSet()}}get subscriptionExpiresInitial(){return this._subscriptionExpiresInitial}get subscriptionRefresh(){if(this._subscriptionRefresh===void 0||this._subscriptionRefreshLastSet===void 0)return;const e=Math.floor(Date.now()/1e3)-this._subscriptionRefreshLastSet,t=this._subscriptionRefresh-e;return Math.max(t,0)}get subscriptionState(){return this._subscriptionState}receiveRequest(e){if(this.logger.log(`SUBSCRIBE dialog ${this.id} received ${e.method} request`),!this.sequenceGuard(e)){this.logger.log(`SUBSCRIBE dialog ${this.id} rejected out of order ${e.method} request.`);return}switch(super.receiveRequest(e),e.method){case j.NOTIFY:this.onNotify(e);break;default:this.logger.log(`SUBSCRIBE dialog ${this.id} received unimplemented ${e.method} request`),this.core.replyStateless(e,{statusCode:501});break}}refresh(){const e="Allow: "+Mt.toString(),t={};return t.extraHeaders=(t.extraHeaders||[]).slice(),t.extraHeaders.push(e),t.extraHeaders.push("Event: "+this.subscriptionEvent),t.extraHeaders.push("Expires: "+this.subscriptionExpiresInitial),t.extraHeaders.push("Contact: "+this.core.configuration.contact.toString()),this.subscribe(void 0,t)}subscribe(e,t={}){var r;if(this.subscriptionState!==oe.Pending&&this.subscriptionState!==oe.Active)throw new Error(`Invalid state ${this.subscriptionState}. May only re-subscribe while in state "pending" or "active".`);this.logger.log(`SUBSCRIBE dialog ${this.id} sending SUBSCRIBE request`);const i=new n0(this,e,t);return this.N&&(clearTimeout(this.N),this.N=void 0),!((r=t.extraHeaders)===null||r===void 0)&&r.includes("Expires: 0")||(this.N=setTimeout(()=>this.timerN(),Re.TIMER_N)),i}terminate(){this.stateTransition(oe.Terminated),this.onTerminated()}unsubscribe(){const e="Allow: "+Mt.toString(),t={};return t.extraHeaders=(t.extraHeaders||[]).slice(),t.extraHeaders.push(e),t.extraHeaders.push("Event: "+this.subscriptionEvent),t.extraHeaders.push("Expires: 0"),t.extraHeaders.push("Contact: "+this.core.configuration.contact.toString()),this.subscribe(void 0,t)}onNotify(e){const t=e.parseHeader("Event").event;if(!t||t!==this.subscriptionEvent){this.core.replyStateless(e,{statusCode:489});return}this.N&&(clearTimeout(this.N),this.N=void 0);const r=e.parseHeader("Subscription-State");if(!r||!r.state){this.core.replyStateless(e,{statusCode:489});return}const i=r.state,n=r.expires?Math.max(r.expires,0):void 0;switch(i){case"pending":this.stateTransition(oe.Pending,n);break;case"active":this.stateTransition(oe.Active,n);break;case"terminated":this.stateTransition(oe.Terminated,n);break;default:this.logger.warn("Unrecognized subscription state.");break}const a=new ns(this,e);this.delegate&&this.delegate.onNotify?this.delegate.onNotify(a):a.accept()}onRefresh(e){this.delegate&&this.delegate.onRefresh&&this.delegate.onRefresh(e)}onTerminated(){this.delegate&&this.delegate.onTerminated&&this.delegate.onTerminated()}refreshTimerClear(){this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=void 0)}refreshTimerSet(){if(this.refreshTimerClear(),this.autoRefresh&&this.subscriptionExpires>0){const e=this.subscriptionExpires*900;this._subscriptionRefresh=Math.floor(e/1e3),this._subscriptionRefreshLastSet=Math.floor(Date.now()/1e3),this.refreshTimer=setTimeout(()=>{this.refreshTimer=void 0,this._subscriptionRefresh=void 0,this._subscriptionRefreshLastSet=void 0,this.onRefresh(this.refresh())},e)}}stateTransition(e,t){const r=()=>{this.logger.warn(`Invalid subscription state transition from ${this.subscriptionState} to ${e}`)};switch(e){case oe.Initial:r();return;case oe.NotifyWait:r();return;case oe.Pending:if(this.subscriptionState!==oe.NotifyWait&&this.subscriptionState!==oe.Pending){r();return}break;case oe.Active:if(this.subscriptionState!==oe.NotifyWait&&this.subscriptionState!==oe.Pending&&this.subscriptionState!==oe.Active){r();return}break;case oe.Terminated:if(this.subscriptionState!==oe.NotifyWait&&this.subscriptionState!==oe.Pending&&this.subscriptionState!==oe.Active){r();return}break;default:r();return}e===oe.Pending&&t&&(this.subscriptionExpires=t),e===oe.Active&&t&&(this.subscriptionExpires=t),e===oe.Terminated&&this.dispose(),this._subscriptionState=e}timerN(){this.logger.warn("Timer N expired for SUBSCRIBE dialog. Timed out waiting for NOTIFY."),this.subscriptionState!==oe.Terminated&&(this.stateTransition(oe.Terminated),this.onTerminated())}}class a0 extends He{constructor(e,t,r){const i=t.getHeader("Event");if(!i)throw new Error("Event undefined");const n=t.getHeader("Expires");if(!n)throw new Error("Expires undefined");super(Ge,e,t,r),this.delegate=r,this.subscriberId=t.callId+t.fromTag+i,this.subscriptionExpiresRequested=this.subscriptionExpires=Number(n),this.subscriptionEvent=i,this.subscriptionState=oe.NotifyWait,this.waitNotifyStart()}dispose(){super.dispose()}onNotify(e){const t=e.message.parseHeader("Event").event;if(!t||t!==this.subscriptionEvent){this.logger.warn("Failed to parse event."),e.reject({statusCode:489});return}const r=e.message.parseHeader("Subscription-State");if(!r||!r.state){this.logger.warn("Failed to parse subscription state."),e.reject({statusCode:489});return}const i=r.state;switch(i){case"pending":break;case"active":break;case"terminated":break;default:this.logger.warn(`Invalid subscription state ${i}`),e.reject({statusCode:489});return}if(i!=="terminated"&&!e.message.parseHeader("contact")){this.logger.warn("Failed to parse contact."),e.reject({statusCode:489});return}if(this.dialog)throw new Error("Dialog already created. This implementation only supports install of single subscriptions.");switch(this.waitNotifyStop(),this.subscriptionExpires=r.expires?Math.min(this.subscriptionExpires,Math.max(r.expires,0)):this.subscriptionExpires,i){case"pending":this.subscriptionState=oe.Pending;break;case"active":this.subscriptionState=oe.Active;break;case"terminated":this.subscriptionState=oe.Terminated;break;default:throw new Error(`Unrecognized state ${i}.`)}if(this.subscriptionState!==oe.Terminated){const n=On.initialDialogStateForSubscription(this.message,e.message);this.dialog=new On(this.subscriptionEvent,this.subscriptionExpires,this.subscriptionState,this.core,n)}if(this.delegate&&this.delegate.onNotify){const n=e,a=this.dialog;this.delegate.onNotify({request:n,subscription:a})}else e.accept()}waitNotifyStart(){this.N||(this.core.subscribers.set(this.subscriberId,this),this.N=setTimeout(()=>this.timerN(),Re.TIMER_N))}waitNotifyStop(){this.N&&(this.core.subscribers.delete(this.subscriberId),clearTimeout(this.N),this.N=void 0)}receiveResponse(e){if(this.authenticationGuard(e)){if(e.statusCode&&e.statusCode>=200&&e.statusCode<300){const t=e.getHeader("Expires");if(!t)this.logger.warn("Expires header missing in a 200-class response to SUBSCRIBE");else{const r=Number(t);r>this.subscriptionExpiresRequested&&this.logger.warn("Expires header in a 200-class response to SUBSCRIBE with a higher value than the one in the request"),r<this.subscriptionExpires&&(this.subscriptionExpires=r)}this.dialog&&this.dialog.subscriptionExpires>this.subscriptionExpires&&(this.dialog.subscriptionExpires=this.subscriptionExpires)}e.statusCode&&e.statusCode>=300&&e.statusCode<700&&this.waitNotifyStop(),super.receiveResponse(e)}}timerN(){this.logger.warn("Timer N expired for SUBSCRIBE user agent client. Timed out waiting for NOTIFY."),this.waitNotifyStop(),this.delegate&&this.delegate.onNotifyTimeout&&this.delegate.onNotifyTimeout()}}class o0 extends ft{constructor(e,t,r){super(Ve,e,t,r),this.core=e}}const Mn=["application/sdp","application/dtmf-relay"];class c0{constructor(e,t={}){this.userAgentClients=new Map,this.userAgentServers=new Map,this.configuration=e,this.delegate=t,this.dialogs=new Map,this.subscribers=new Map,this.logger=e.loggerFactory.getLogger("sip.user-agent-core")}dispose(){this.reset()}reset(){this.dialogs.forEach(e=>e.dispose()),this.dialogs.clear(),this.subscribers.forEach(e=>e.dispose()),this.subscribers.clear(),this.userAgentClients.forEach(e=>e.dispose()),this.userAgentClients.clear(),this.userAgentServers.forEach(e=>e.dispose()),this.userAgentServers.clear()}get loggerFactory(){return this.configuration.loggerFactory}get transport(){const e=this.configuration.transportAccessor();if(!e)throw new Error("Transport undefined.");return e}invite(e,t){return new t0(this,e,t)}message(e,t){return new $n(this,e,t)}publish(e,t){return new r0(this,e,t)}register(e,t){return new s0(this,e,t)}subscribe(e,t){return new a0(this,e,t)}request(e,t){return new He(Ge,this,e,t)}makeOutgoingRequestMessage(e,t,r,i,n,a,o){const l=this.configuration.sipjsId,c=this.configuration.displayName,d=this.configuration.viaForceRport,g=this.configuration.hackViaTcp,u=this.configuration.supportedOptionTags.slice();e===j.REGISTER&&u.push("path","gruu"),e===j.INVITE&&(this.configuration.contact.pubGruu||this.configuration.contact.tempGruu)&&u.push("gruu");const E=this.configuration.routeSet,y=this.configuration.userAgentHeaderFieldValue,v=this.configuration.viaHost,x=Object.assign(Object.assign({},{callIdPrefix:l,forceRport:d,fromDisplayName:c,hackViaTcp:g,optionTags:u,routeSet:E,userAgentString:y,viaHost:v}),n);return new er(e,t,r,i,x,a,o)}receiveIncomingRequestFromTransport(e){this.receiveRequestFromTransport(e)}receiveIncomingResponseFromTransport(e){this.receiveResponseFromTransport(e)}replyStateless(e,t){const r=this.configuration.userAgentHeaderFieldValue,i=this.configuration.supportedOptionTagsResponse;t=Object.assign(Object.assign({},t),{userAgent:r,supported:i});const n=Bn(e,t);return this.transport.send(n.message).catch(a=>{a instanceof Error&&this.logger.error(a.message),this.logger.error(`Transport error occurred sending stateless reply to ${e.method} request.`)}),n}receiveRequestFromTransport(e){const t=e.viaBranch,r=this.userAgentServers.get(t);if(e.method===j.ACK&&r&&r.transaction.state===R.Accepted&&r instanceof zs){this.logger.warn(`Discarding out of dialog ACK after 2xx response sent on transaction ${t}.`);return}if(e.method===j.CANCEL){r?(this.replyStateless(e,{statusCode:200}),r.transaction instanceof je&&r.transaction.state===R.Proceeding&&r instanceof zs&&r.receiveCancel(e)):this.replyStateless(e,{statusCode:481});return}if(r){r.transaction.receiveRequest(e);return}this.receiveRequest(e)}receiveRequest(e){if(!Mt.includes(e.method)){const i="Allow: "+Mt.toString();this.replyStateless(e,{statusCode:405,extraHeaders:[i]});return}if(!e.ruri)throw new Error("Request-URI undefined.");if(e.ruri.scheme!=="sip"){this.replyStateless(e,{statusCode:416});return}const t=e.ruri,r=i=>!!i&&i.user===t.user;if(!r(this.configuration.aor)&&!(r(this.configuration.contact.uri)||r(this.configuration.contact.pubGruu)||r(this.configuration.contact.tempGruu))){this.logger.warn("Request-URI does not point to us."),e.method!==j.ACK&&this.replyStateless(e,{statusCode:404});return}if(e.method===j.INVITE&&!e.hasHeader("Contact")){this.replyStateless(e,{statusCode:400,reasonPhrase:"Missing Contact Header"});return}if(!e.toTag){const i=e.viaBranch;if(!this.userAgentServers.has(i)&&Array.from(this.userAgentServers.values()).some(a=>a.transaction.request.fromTag===e.fromTag&&a.transaction.request.callId===e.callId&&a.transaction.request.cseq===e.cseq)){this.replyStateless(e,{statusCode:482});return}}e.toTag?this.receiveInsideDialogRequest(e):this.receiveOutsideDialogRequest(e)}receiveInsideDialogRequest(e){if(e.method===j.NOTIFY){const i=e.parseHeader("Event");if(!i||!i.event){this.replyStateless(e,{statusCode:489});return}const n=e.callId+e.toTag+i.event,a=this.subscribers.get(n);if(a){const o=new ns(this,e);a.onNotify(o);return}}const t=e.callId+e.toTag+e.fromTag,r=this.dialogs.get(t);if(r){if(e.method===j.OPTIONS){const i="Allow: "+Mt.toString(),n="Accept: "+Mn.toString();this.replyStateless(e,{statusCode:200,extraHeaders:[i,n]});return}r.receiveRequest(e);return}e.method!==j.ACK&&this.replyStateless(e,{statusCode:481})}receiveOutsideDialogRequest(e){switch(e.method){case j.ACK:break;case j.BYE:this.replyStateless(e,{statusCode:481});break;case j.CANCEL:throw new Error(`Unexpected out of dialog request method ${e.method}.`);case j.INFO:this.replyStateless(e,{statusCode:405});break;case j.INVITE:{const t=new zs(this,e);this.delegate.onInvite?this.delegate.onInvite(t):t.reject()}break;case j.MESSAGE:{const t=new Hn(this,e);this.delegate.onMessage?this.delegate.onMessage(t):t.accept()}break;case j.NOTIFY:{const t=new ns(this,e);this.delegate.onNotify?this.delegate.onNotify(t):t.reject({statusCode:405})}break;case j.OPTIONS:{const t="Allow: "+Mt.toString(),r="Accept: "+Mn.toString();this.replyStateless(e,{statusCode:200,extraHeaders:[t,r]})}break;case j.REFER:{const t=new Pn(this,e);this.delegate.onRefer?this.delegate.onRefer(t):t.reject({statusCode:405})}break;case j.REGISTER:{const t=new i0(this,e);this.delegate.onRegister?this.delegate.onRegister(t):t.reject({statusCode:405})}break;case j.SUBSCRIBE:{const t=new o0(this,e);this.delegate.onSubscribe?this.delegate.onSubscribe(t):t.reject({statusCode:480})}break;default:throw new Error(`Unexpected out of dialog request method ${e.method}.`)}}receiveResponseFromTransport(e){if(e.getHeaders("via").length>1){this.logger.warn("More than one Via header field present in the response, dropping");return}const t=e.viaBranch+e.method,r=this.userAgentClients.get(t);r?r.transaction.receiveResponse(e):this.logger.warn(`Discarding unmatched ${e.statusCode} response to ${e.method} ${t}.`)}}function d0(){return s=>!s.audio&&!s.video?Promise.resolve(new MediaStream):navigator.mediaDevices===void 0?Promise.reject(new Error("Media devices not available in insecure contexts.")):navigator.mediaDevices.getUserMedia.call(navigator.mediaDevices,s)}function l0(){return{bundlePolicy:"balanced",certificates:void 0,iceCandidatePoolSize:0,iceServers:[{urls:"stun:stun.l.google.com:19302"}],iceTransportPolicy:"all",rtcpMuxPolicy:"require"}}class Ct{constructor(e,t,r){e.debug("SessionDescriptionHandler.constructor"),this.logger=e,this.mediaStreamFactory=t,this.sessionDescriptionHandlerConfiguration=r,this._localMediaStream=new MediaStream,this._remoteMediaStream=new MediaStream,this._peerConnection=new RTCPeerConnection(r==null?void 0:r.peerConnectionConfiguration),this.initPeerConnectionEventHandlers()}get localMediaStream(){return this._localMediaStream}get remoteMediaStream(){return this._remoteMediaStream}get dataChannel(){return this._dataChannel}get peerConnection(){return this._peerConnection}get peerConnectionDelegate(){return this._peerConnectionDelegate}set peerConnectionDelegate(e){this._peerConnectionDelegate=e}static dispatchAddTrackEvent(e,t){e.dispatchEvent(new MediaStreamTrackEvent("addtrack",{track:t}))}static dispatchRemoveTrackEvent(e,t){e.dispatchEvent(new MediaStreamTrackEvent("removetrack",{track:t}))}close(){this.logger.debug("SessionDescriptionHandler.close"),this._peerConnection!==void 0&&(this._peerConnection.getReceivers().forEach(e=>{e.track&&e.track.stop()}),this._peerConnection.getSenders().forEach(e=>{e.track&&e.track.stop()}),this._dataChannel&&this._dataChannel.close(),this._peerConnection.close(),this._peerConnection=void 0)}enableReceiverTracks(e){const t=this.peerConnection;if(!t)throw new Error("Peer connection closed.");t.getReceivers().forEach(r=>{r.track&&(r.track.enabled=e)})}enableSenderTracks(e){const t=this.peerConnection;if(!t)throw new Error("Peer connection closed.");t.getSenders().forEach(r=>{r.track&&(r.track.enabled=e)})}getDescription(e,t){var r,i;if(this.logger.debug("SessionDescriptionHandler.getDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));this.onDataChannel=e==null?void 0:e.onDataChannel;const n=(r=e==null?void 0:e.offerOptions)===null||r===void 0?void 0:r.iceRestart,a=(e==null?void 0:e.iceGatheringTimeout)===void 0?(i=this.sessionDescriptionHandlerConfiguration)===null||i===void 0?void 0:i.iceGatheringTimeout:e==null?void 0:e.iceGatheringTimeout;return this.getLocalMediaStream(e).then(()=>this.updateDirection(e)).then(()=>this.createDataChannel(e)).then(()=>this.createLocalOfferOrAnswer(e)).then(o=>this.applyModifiers(o,t)).then(o=>this.setLocalSessionDescription(o)).then(()=>this.waitForIceGatheringComplete(n,a)).then(()=>this.getLocalSessionDescription()).then(o=>({body:o.sdp,contentType:"application/sdp"})).catch(o=>{throw this.logger.error("SessionDescriptionHandler.getDescription failed - "+o),o})}hasDescription(e){return this.logger.debug("SessionDescriptionHandler.hasDescription"),e==="application/sdp"}iceGatheringComplete(){this.logger.debug("SessionDescriptionHandler.iceGatheringComplete"),this.iceGatheringCompleteTimeoutId!==void 0&&(this.logger.debug("SessionDescriptionHandler.iceGatheringComplete - clearing timeout"),clearTimeout(this.iceGatheringCompleteTimeoutId),this.iceGatheringCompleteTimeoutId=void 0),this.iceGatheringCompletePromise!==void 0&&(this.logger.debug("SessionDescriptionHandler.iceGatheringComplete - resolving promise"),this.iceGatheringCompleteResolve&&this.iceGatheringCompleteResolve(),this.iceGatheringCompletePromise=void 0,this.iceGatheringCompleteResolve=void 0,this.iceGatheringCompleteReject=void 0)}sendDtmf(e,t){if(this.logger.debug("SessionDescriptionHandler.sendDtmf"),this._peerConnection===void 0)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - peer connection closed"),!1;const r=this._peerConnection.getSenders();if(r.length===0)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - no senders"),!1;const i=r[0].dtmf;if(!i)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - no DTMF sender"),!1;const n=t==null?void 0:t.duration,a=t==null?void 0:t.interToneGap;try{i.insertDTMF(e,n,a)}catch(o){return this.logger.error(o.toString()),!1}return this.logger.log("SessionDescriptionHandler.sendDtmf sent via RTP: "+e.toString()),!0}setDescription(e,t,r){if(this.logger.debug("SessionDescriptionHandler.setDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));this.onDataChannel=t==null?void 0:t.onDataChannel;const i=this._peerConnection.signalingState==="have-local-offer"?"answer":"offer";return this.getLocalMediaStream(t).then(()=>this.applyModifiers({sdp:e,type:i},r)).then(n=>this.setRemoteSessionDescription(n)).catch(n=>{throw this.logger.error("SessionDescriptionHandler.setDescription failed - "+n),n})}applyModifiers(e,t){return this.logger.debug("SessionDescriptionHandler.applyModifiers"),!t||t.length===0?Promise.resolve(e):t.reduce((r,i)=>r.then(i),Promise.resolve(e)).then(r=>{if(this.logger.debug("SessionDescriptionHandler.applyModifiers - modified sdp"),!r.sdp||!r.type)throw new Error("Invalid SDP.");return{sdp:r.sdp,type:r.type}})}createDataChannel(e){if(this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));if((e==null?void 0:e.dataChannel)!==!0||this._dataChannel)return Promise.resolve();switch(this._peerConnection.signalingState){case"stable":this.logger.debug("SessionDescriptionHandler.createDataChannel - creating data channel");try{return this._dataChannel=this._peerConnection.createDataChannel((e==null?void 0:e.dataChannelLabel)||"",e==null?void 0:e.dataChannelOptions),this.onDataChannel&&this.onDataChannel(this._dataChannel),Promise.resolve()}catch(t){return Promise.reject(t)}case"have-remote-offer":return Promise.resolve();case"have-local-offer":case"have-local-pranswer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}}createLocalOfferOrAnswer(e){if(this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));switch(this._peerConnection.signalingState){case"stable":return this.logger.debug("SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP offer"),this._peerConnection.createOffer(e==null?void 0:e.offerOptions);case"have-remote-offer":return this.logger.debug("SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP answer"),this._peerConnection.createAnswer(e==null?void 0:e.answerOptions);case"have-local-offer":case"have-local-pranswer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}}getLocalMediaStream(e){if(this.logger.debug("SessionDescriptionHandler.getLocalMediaStream"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));let t=Object.assign({},e==null?void 0:e.constraints);if(this.localMediaStreamConstraints){if(t.audio=t.audio||this.localMediaStreamConstraints.audio,t.video=t.video||this.localMediaStreamConstraints.video,JSON.stringify(this.localMediaStreamConstraints.audio)===JSON.stringify(t.audio)&&JSON.stringify(this.localMediaStreamConstraints.video)===JSON.stringify(t.video))return Promise.resolve()}else t.audio===void 0&&t.video===void 0&&(t={audio:!0});return this.localMediaStreamConstraints=t,this.mediaStreamFactory(t,this,e).then(r=>this.setLocalMediaStream(r))}setLocalMediaStream(e){if(this.logger.debug("SessionDescriptionHandler.setLocalMediaStream"),!this._peerConnection)throw new Error("Peer connection undefined.");const t=this._peerConnection,r=this._localMediaStream,i=[],n=l=>{const c=l.kind;if(c!=="audio"&&c!=="video")throw new Error(`Unknown new track kind ${c}.`);const d=t.getSenders().find(g=>g.track&&g.track.kind===c);d?i.push(new Promise(g=>{this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - replacing sender ${c} track`),g()}).then(()=>d.replaceTrack(l).then(()=>{const g=r.getTracks().find(u=>u.kind===c);g&&(g.stop(),r.removeTrack(g),Ct.dispatchRemoveTrackEvent(r,g)),r.addTrack(l),Ct.dispatchAddTrackEvent(r,l)}).catch(g=>{throw this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to replace sender ${c} track`),g}))):i.push(new Promise(g=>{this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - adding sender ${c} track`),g()}).then(()=>{try{t.addTrack(l,r)}catch(g){throw this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to add sender ${c} track`),g}r.addTrack(l),Ct.dispatchAddTrackEvent(r,l)}))},a=e.getAudioTracks();a.length&&n(a[0]);const o=e.getVideoTracks();return o.length&&n(o[0]),i.reduce((l,c)=>l.then(()=>c),Promise.resolve())}getLocalSessionDescription(){if(this.logger.debug("SessionDescriptionHandler.getLocalSessionDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));const e=this._peerConnection.localDescription;return e?Promise.resolve(e):Promise.reject(new Error("Failed to get local session description"))}setLocalSessionDescription(e){return this.logger.debug("SessionDescriptionHandler.setLocalSessionDescription"),this._peerConnection===void 0?Promise.reject(new Error("Peer connection closed.")):this._peerConnection.setLocalDescription(e)}setRemoteSessionDescription(e){if(this.logger.debug("SessionDescriptionHandler.setRemoteSessionDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));const t=e.sdp;let r;switch(this._peerConnection.signalingState){case"stable":r="offer";break;case"have-local-offer":r="answer";break;case"have-local-pranswer":case"have-remote-offer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}return t?this._peerConnection.setRemoteDescription({sdp:t,type:r}):(this.logger.error("SessionDescriptionHandler.setRemoteSessionDescription failed - cannot set null sdp"),Promise.reject(new Error("SDP is undefined")))}setRemoteTrack(e){this.logger.debug("SessionDescriptionHandler.setRemoteTrack");const t=this._remoteMediaStream;t.getTrackById(e.id)?this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - have remote ${e.kind} track`):e.kind==="audio"?(this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - adding remote ${e.kind} track`),t.getAudioTracks().forEach(r=>{r.stop(),t.removeTrack(r),Ct.dispatchRemoveTrackEvent(t,r)}),t.addTrack(e),Ct.dispatchAddTrackEvent(t,e)):e.kind==="video"&&(this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - adding remote ${e.kind} track`),t.getVideoTracks().forEach(r=>{r.stop(),t.removeTrack(r),Ct.dispatchRemoveTrackEvent(t,r)}),t.addTrack(e),Ct.dispatchAddTrackEvent(t,e))}updateDirection(e){if(this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));switch(this._peerConnection.signalingState){case"stable":this.logger.debug("SessionDescriptionHandler.updateDirection - setting offer direction");{const t=r=>{switch(r){case"inactive":return e!=null&&e.hold?"inactive":"recvonly";case"recvonly":return e!=null&&e.hold?"inactive":"recvonly";case"sendonly":return e!=null&&e.hold?"sendonly":"sendrecv";case"sendrecv":return e!=null&&e.hold?"sendonly":"sendrecv";case"stopped":return"stopped";default:throw new Error("Should never happen")}};this._peerConnection.getTransceivers().forEach(r=>{if(r.direction){const i=t(r.direction);r.direction!==i&&(r.direction=i)}})}break;case"have-remote-offer":this.logger.debug("SessionDescriptionHandler.updateDirection - setting answer direction");{const t=(()=>{const i=this._peerConnection.remoteDescription;if(!i)throw new Error("Failed to read remote offer");const n=/a=sendrecv\r\n|a=sendonly\r\n|a=recvonly\r\n|a=inactive\r\n/.exec(i.sdp);if(n)switch(n[0]){case`a=inactive\r
|
|
65
|
+
`,this.send(c).catch(d=>{this.logTransportError(d,"Failed to send ACK to non-2xx response.")})}stateTransition(e,t=!1){const r=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case R.Calling:r();break;case R.Proceeding:this.state!==R.Calling&&r();break;case R.Accepted:case R.Completed:this.state!==R.Calling&&this.state!==R.Proceeding&&r();break;case R.Terminated:this.state!==R.Calling&&this.state!==R.Accepted&&this.state!==R.Completed&&(t||r());break;default:r()}this.B&&(clearTimeout(this.B),this.B=void 0),R.Proceeding,e===R.Completed&&(this.D=setTimeout(()=>this.timerD(),Re.TIMER_D)),e===R.Accepted&&(this.M=setTimeout(()=>this.timerM(),Re.TIMER_M)),e===R.Terminated&&this.dispose(),this.setState(e)}timerA(){}timerB(){this.logger.debug(`Timer B expired for INVITE client transaction ${this.id}.`),this.state===R.Calling&&(this.onRequestTimeout(),this.stateTransition(R.Terminated))}timerD(){this.logger.debug(`Timer D expired for INVITE client transaction ${this.id}.`),this.state===R.Completed&&this.stateTransition(R.Terminated)}timerM(){this.logger.debug(`Timer M expired for INVITE client transaction ${this.id}.`),this.state===R.Accepted&&this.stateTransition(R.Terminated)}}class He{constructor(e,t,r,i){this.transactionConstructor=e,this.core=t,this.message=r,this.delegate=i,this.challenged=!1,this.stale=!1,this.logger=this.loggerFactory.getLogger("sip.user-agent-client"),this.init()}dispose(){this.transaction.dispose()}get loggerFactory(){return this.core.loggerFactory}get transaction(){if(!this._transaction)throw new Error("Transaction undefined.");return this._transaction}cancel(e,t={}){if(!this.transaction)throw new Error("Transaction undefined.");if(!this.message.to)throw new Error("To undefined.");if(!this.message.from)throw new Error("From undefined.");const r=this.core.makeOutgoingRequestMessage(j.CANCEL,this.message.ruri,this.message.from.uri,this.message.to.uri,{toTag:this.message.toTag,fromTag:this.message.fromTag,callId:this.message.callId,cseq:this.message.cseq},t.extraHeaders);return r.branch=this.message.branch,this.message.headers.Route&&(r.headers.Route=this.message.headers.Route),e&&r.setHeader("Reason",e),this.transaction.state===R.Proceeding?new He(Ge,this.core,r):this.transaction.addStateChangeListener(()=>{this.transaction&&this.transaction.state===R.Proceeding&&new He(Ge,this.core,r)},{once:!0}),r}authenticationGuard(e,t){const r=e.statusCode;if(!r)throw new Error("Response status code undefined.");if(r!==401&&r!==407)return!0;let i,n;if(r===401?(i=e.parseHeader("www-authenticate"),n="authorization"):(i=e.parseHeader("proxy-authenticate"),n="proxy-authorization"),!i)return this.logger.warn(r+" with wrong or missing challenge, cannot authenticate"),!0;if(this.challenged&&(this.stale||i.stale!==!0))return this.logger.warn(r+" apparently in authentication loop, cannot authenticate"),!0;if(!this.credentials&&(this.credentials=this.core.configuration.authenticationFactory(),!this.credentials))return this.logger.warn("Unable to obtain credentials, cannot authenticate"),!0;if(!this.credentials.authenticate(this.message,i))return!0;this.challenged=!0,i.stale&&(this.stale=!0);let a=this.message.cseq+=1;return t&&t.localSequenceNumber&&(t.incrementLocalSequenceNumber(),a=this.message.cseq=t.localSequenceNumber),this.message.setHeader("cseq",a+" "+this.message.method),this.message.setHeader(n,this.credentials.toString()),this.init(),!1}onRequestTimeout(){this.logger.warn("User agent client request timed out. Generating internal 408 Request Timeout.");const e=new Pt;e.statusCode=408,e.reasonPhrase="Request Timeout",this.receiveResponse(e)}onTransportError(e){this.logger.error(e.message),this.logger.error("User agent client request transport error. Generating internal 503 Service Unavailable.");const t=new Pt;t.statusCode=503,t.reasonPhrase="Service Unavailable",this.receiveResponse(t)}receiveResponse(e){if(!this.authenticationGuard(e))return;const t=e.statusCode?e.statusCode.toString():"";if(!t)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(t):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:e});break;case/^1[0-9]{2}$/.test(t):this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:e});break;case/^2[0-9]{2}$/.test(t):this.delegate&&this.delegate.onAccept&&this.delegate.onAccept({message:e});break;case/^3[0-9]{2}$/.test(t):this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:e});break;case/^[4-6][0-9]{2}$/.test(t):this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e});break;default:throw new Error(`Invalid status code ${t}`)}}init(){const e={loggerFactory:this.loggerFactory,onRequestTimeout:()=>this.onRequestTimeout(),onStateChange:i=>{i===R.Terminated&&(this.core.userAgentClients.delete(r),t===this._transaction&&this.dispose())},onTransportError:i=>this.onTransportError(i),receiveResponse:i=>this.receiveResponse(i)},t=new this.transactionConstructor(this.message,this.core.transport,e);this._transaction=t;const r=t.id+t.request.method;this.core.userAgentClients.set(r,this)}}class jo extends He{constructor(e,t,r){const i=e.createOutgoingRequestMessage(j.BYE,r);super(Ge,e.userAgentCore,i,t),e.dispose()}}class Ve extends In{constructor(e,t,r){super(e,t,r,R.Trying,"sip.transaction.nist")}dispose(){this.J&&(clearTimeout(this.J),this.J=void 0),super.dispose()}get kind(){return"nist"}receiveRequest(e){switch(this.state){case R.Trying:break;case R.Proceeding:if(!this.lastResponse)throw new Error("Last response undefined.");this.send(this.lastResponse).catch(t=>{this.logTransportError(t,"Failed to send retransmission of provisional response.")});break;case R.Completed:if(!this.lastResponse)throw new Error("Last response undefined.");this.send(this.lastResponse).catch(t=>{this.logTransportError(t,"Failed to send retransmission of final response.")});break;case R.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}}receiveResponse(e,t){if(e<100||e>699)throw new Error(`Invalid status code ${e}`);if(e>100&&e<=199)throw new Error("Provisional response other than 100 not allowed.");switch(this.state){case R.Trying:if(this.lastResponse=t,e>=100&&e<200){this.stateTransition(R.Proceeding),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send provisional response.")});return}if(e>=200&&e<=699){this.stateTransition(R.Completed),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send final response.")});return}break;case R.Proceeding:if(this.lastResponse=t,e>=200&&e<=699){this.stateTransition(R.Completed),this.send(t).catch(i=>{this.logTransportError(i,"Failed to send final response.")});return}break;case R.Completed:return;case R.Terminated:break;default:throw new Error(`Invalid state ${this.state}`)}const r=`Non-INVITE server transaction received unexpected ${e} response from TU while in state ${this.state}.`;throw this.logger.error(r),new Error(r)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(R.Terminated,!0)}typeToString(){return"non-INVITE server transaction"}stateTransition(e,t=!1){const r=()=>{throw new Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case R.Trying:r();break;case R.Proceeding:this.state!==R.Trying&&r();break;case R.Completed:this.state!==R.Trying&&this.state!==R.Proceeding&&r();break;case R.Terminated:this.state!==R.Proceeding&&this.state!==R.Completed&&(t||r());break;default:r()}e===R.Completed&&(this.J=setTimeout(()=>this.timerJ(),Re.TIMER_J)),e===R.Terminated&&this.dispose(),this.setState(e)}timerJ(){this.logger.debug(`Timer J expired for NON-INVITE server transaction ${this.id}.`),this.state===R.Completed&&this.stateTransition(R.Terminated)}}class ft{constructor(e,t,r,i){this.transactionConstructor=e,this.core=t,this.message=r,this.delegate=i,this.logger=this.loggerFactory.getLogger("sip.user-agent-server"),this.toTag=r.toTag?r.toTag:ts(),this.init()}dispose(){this.transaction.dispose()}get loggerFactory(){return this.core.loggerFactory}get transaction(){if(!this._transaction)throw new Error("Transaction undefined.");return this._transaction}accept(e={statusCode:200}){if(!this.acceptable)throw new Ot(`${this.message.method} not acceptable in state ${this.transaction.state}.`);const t=e.statusCode;if(t<200||t>299)throw new TypeError(`Invalid statusCode: ${t}`);return this.reply(e)}progress(e={statusCode:180}){if(!this.progressable)throw new Ot(`${this.message.method} not progressable in state ${this.transaction.state}.`);const t=e.statusCode;if(t<101||t>199)throw new TypeError(`Invalid statusCode: ${t}`);return this.reply(e)}redirect(e,t={statusCode:302}){if(!this.redirectable)throw new Ot(`${this.message.method} not redirectable in state ${this.transaction.state}.`);const r=t.statusCode;if(r<300||r>399)throw new TypeError(`Invalid statusCode: ${r}`);const i=new Array;return e.forEach(a=>i.push(`Contact: ${a.toString()}`)),t.extraHeaders=(t.extraHeaders||[]).concat(i),this.reply(t)}reject(e={statusCode:480}){if(!this.rejectable)throw new Ot(`${this.message.method} not rejectable in state ${this.transaction.state}.`);const t=e.statusCode;if(t<400||t>699)throw new TypeError(`Invalid statusCode: ${t}`);return this.reply(e)}trying(e){if(!this.tryingable)throw new Ot(`${this.message.method} not tryingable in state ${this.transaction.state}.`);return this.reply({statusCode:100})}receiveCancel(e){this.delegate&&this.delegate.onCancel&&this.delegate.onCancel(e)}get acceptable(){if(this.transaction instanceof je)return this.transaction.state===R.Proceeding||this.transaction.state===R.Accepted;if(this.transaction instanceof Ve)return this.transaction.state===R.Trying||this.transaction.state===R.Proceeding;throw new Error("Unknown transaction type.")}get progressable(){if(this.transaction instanceof je)return this.transaction.state===R.Proceeding;if(this.transaction instanceof Ve)return!1;throw new Error("Unknown transaction type.")}get redirectable(){if(this.transaction instanceof je)return this.transaction.state===R.Proceeding;if(this.transaction instanceof Ve)return this.transaction.state===R.Trying||this.transaction.state===R.Proceeding;throw new Error("Unknown transaction type.")}get rejectable(){if(this.transaction instanceof je)return this.transaction.state===R.Proceeding;if(this.transaction instanceof Ve)return this.transaction.state===R.Trying||this.transaction.state===R.Proceeding;throw new Error("Unknown transaction type.")}get tryingable(){if(this.transaction instanceof je)return this.transaction.state===R.Proceeding;if(this.transaction instanceof Ve)return this.transaction.state===R.Trying;throw new Error("Unknown transaction type.")}reply(e){!e.toTag&&e.statusCode!==100&&(e.toTag=this.toTag),e.userAgent=e.userAgent||this.core.configuration.userAgentHeaderFieldValue,e.supported=e.supported||this.core.configuration.supportedOptionTagsResponse;const t=Bn(this.message,e);return this.transaction.receiveResponse(e.statusCode,t.message),t}init(){const e={loggerFactory:this.loggerFactory,onStateChange:i=>{i===R.Terminated&&(this.core.userAgentServers.delete(r),this.dispose())},onTransportError:i=>{this.logger.error(i.message),this.delegate&&this.delegate.onTransportError?this.delegate.onTransportError(i):this.logger.error("User agent server response transport error.")}},t=new this.transactionConstructor(this.message,this.core.transport,e);this._transaction=t;const r=t.id;this.core.userAgentServers.set(t.id,this)}}class Yo extends ft{constructor(e,t,r){super(Ve,e.userAgentCore,t,r)}}class Wo extends He{constructor(e,t,r){const i=e.createOutgoingRequestMessage(j.INFO,r);super(Ge,e.userAgentCore,i,t)}}class Go extends ft{constructor(e,t,r){super(Ve,e.userAgentCore,t,r)}}class $n extends He{constructor(e,t,r){super(Ge,e,t,r)}}class Hn extends ft{constructor(e,t,r){super(Ve,e,t,r)}}class Vo extends He{constructor(e,t,r){const i=e.createOutgoingRequestMessage(j.NOTIFY,r);super(Ge,e.userAgentCore,i,t)}}function zo(s){return s.userAgentCore!==void 0}class ns extends ft{constructor(e,t,r){const i=zo(e)?e.userAgentCore:e;super(Ve,i,t,r)}}class Ko extends He{constructor(e,t,r){const i=e.createOutgoingRequestMessage(j.PRACK,r);super(Ge,e.userAgentCore,i,t),e.signalingStateTransition(i)}}class Zo extends ft{constructor(e,t,r){super(Ve,e.userAgentCore,t,r),e.signalingStateTransition(t),this.dialog=e}accept(e={statusCode:200}){return e.body&&this.dialog.signalingStateTransition(e.body),super.accept(e)}}class Jo extends He{constructor(e,t,r){const i=e.createOutgoingRequestMessage(j.INVITE,r);super(qt,e.userAgentCore,i,t),this.delegate=t,e.signalingStateTransition(i),e.reinviteUserAgentClient=this,this.dialog=e}receiveResponse(e){if(!this.authenticationGuard(e,this.dialog))return;const t=e.statusCode?e.statusCode.toString():"";if(!t)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(t):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:e});break;case/^1[0-9]{2}$/.test(t):this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:e,session:this.dialog,prack:r=>{throw new Error("Unimplemented.")}});break;case/^2[0-9]{2}$/.test(t):this.dialog.signalingStateTransition(e),this.delegate&&this.delegate.onAccept&&this.delegate.onAccept({message:e,session:this.dialog,ack:r=>this.dialog.ack(r)});break;case/^3[0-9]{2}$/.test(t):this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentClient=void 0,this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:e});break;case/^[4-6][0-9]{2}$/.test(t):this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentClient=void 0,this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e});break;default:throw new Error(`Invalid status code ${t}`)}}}class Xo extends ft{constructor(e,t,r){super(je,e.userAgentCore,t,r),e.reinviteUserAgentServer=this,this.dialog=e}accept(e={statusCode:200}){e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(this.dialog.routeSet.map(n=>`Record-Route: ${n}`));const t=super.accept(e),r=this.dialog,i=Object.assign(Object.assign({},t),{session:r});return e.body&&this.dialog.signalingStateTransition(e.body),this.dialog.reConfirm(),i}progress(e={statusCode:180}){const t=super.progress(e),r=this.dialog,i=Object.assign(Object.assign({},t),{session:r});return e.body&&this.dialog.signalingStateTransition(e.body),i}redirect(e,t={statusCode:302}){throw this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentServer=void 0,new Error("Unimplemented.")}reject(e={statusCode:488}){return this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentServer=void 0,super.reject(e)}}class Qo extends He{constructor(e,t,r){const i=e.createOutgoingRequestMessage(j.REFER,r);super(Ge,e.userAgentCore,i,t)}}function e0(s){return s.userAgentCore!==void 0}class Pn extends ft{constructor(e,t,r){const i=e0(e)?e.userAgentCore:e;super(Ve,i,t,r)}}class as extends xr{constructor(e,t,r,i){super(t,r),this.initialTransaction=e,this._signalingState=U.Initial,this.ackWait=!1,this.ackProcessing=!1,this.delegate=i,e instanceof je&&(this.ackWait=!0),this.early||this.start2xxRetransmissionTimer(),this.signalingStateTransition(e.request),this.logger=t.loggerFactory.getLogger("sip.invite-dialog"),this.logger.log(`INVITE dialog ${this.id} constructed`)}dispose(){super.dispose(),this._signalingState=U.Closed,this._offer=void 0,this._answer=void 0,this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.logger.log(`INVITE dialog ${this.id} destroyed`)}get sessionState(){return this.early?Je.Early:this.ackWait?Je.AckWait:this._signalingState===U.Closed?Je.Terminated:Je.Confirmed}get signalingState(){return this._signalingState}get offer(){return this._offer}get answer(){return this._answer}confirm(){this.early&&this.start2xxRetransmissionTimer(),super.confirm()}reConfirm(){this.reinviteUserAgentServer&&this.startReInvite2xxRetransmissionTimer()}ack(e={}){this.logger.log(`INVITE dialog ${this.id} sending ACK request`);let t;if(this.reinviteUserAgentClient){if(!(this.reinviteUserAgentClient.transaction instanceof qt))throw new Error("Transaction not instance of InviteClientTransaction.");t=this.reinviteUserAgentClient.transaction,this.reinviteUserAgentClient=void 0}else{if(!(this.initialTransaction instanceof qt))throw new Error("Initial transaction not instance of InviteClientTransaction.");t=this.initialTransaction}const r=this.createOutgoingRequestMessage(j.ACK,{cseq:t.request.cseq,extraHeaders:e.extraHeaders,body:e.body});return t.ackResponse(r),this.signalingStateTransition(r),{message:r}}bye(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending BYE request`),this.initialTransaction instanceof je){if(this.early)throw new Error("UAS MUST NOT send a BYE on early dialogs.");if(this.ackWait&&this.initialTransaction.state!==R.Terminated)throw new Error("UAS MUST NOT send a BYE on a confirmed dialog until it has received an ACK for its 2xx response or until the server transaction times out.")}return new jo(this,e,t)}info(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending INFO request`),this.early)throw new Error("Dialog not confirmed.");return new Wo(this,e,t)}invite(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending INVITE request`),this.early)throw new Error("Dialog not confirmed.");if(this.reinviteUserAgentClient)throw new Error("There is an ongoing re-INVITE client transaction.");if(this.reinviteUserAgentServer)throw new Error("There is an ongoing re-INVITE server transaction.");return new Jo(this,e,t)}message(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending MESSAGE request`),this.early)throw new Error("Dialog not confirmed.");const r=this.createOutgoingRequestMessage(j.MESSAGE,t);return new $n(this.core,r,e)}notify(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending NOTIFY request`),this.early)throw new Error("Dialog not confirmed.");return new Vo(this,e,t)}prack(e,t){return this.logger.log(`INVITE dialog ${this.id} sending PRACK request`),new Ko(this,e,t)}refer(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending REFER request`),this.early)throw new Error("Dialog not confirmed.");return new Qo(this,e,t)}receiveRequest(e){if(this.logger.log(`INVITE dialog ${this.id} received ${e.method} request`),e.method===j.ACK){if(this.ackWait){if(this.initialTransaction instanceof qt){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}if(this.initialTransaction.request.cseq!==e.cseq){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}this.ackWait=!1}else{if(!this.reinviteUserAgentServer){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}if(this.reinviteUserAgentServer.transaction.request.cseq!==e.cseq){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}this.reinviteUserAgentServer=void 0}if(this.signalingStateTransition(e),this.delegate&&this.delegate.onAck){const t=this.delegate.onAck({message:e});t instanceof Promise&&(this.ackProcessing=!0,t.then(()=>this.ackProcessing=!1).catch(()=>this.ackProcessing=!1))}return}if(!this.sequenceGuard(e)){this.logger.log(`INVITE dialog ${this.id} rejected out of order ${e.method} request.`);return}if(super.receiveRequest(e),e.method===j.INVITE){const t=()=>{const n=this.ackWait?"waiting for initial ACK":"processing initial ACK";this.logger.warn(`INVITE dialog ${this.id} received re-INVITE while ${n}`);let a="RFC 5407 suggests the following to avoid this race condition... ";a+=" Note: Implementation issues are outside the scope of this document,",a+=" but the following tip is provided for avoiding race conditions of",a+=" this type. The caller can delay sending re-INVITE F6 for some period",a+=" of time (2 seconds, perhaps), after which the caller can reasonably",a+=" assume that its ACK has been received. Implementors can decouple the",a+=" actions of the user (e.g., pressing the hold button) from the actions",a+=" of the protocol (the sending of re-INVITE F6), so that the UA can",a+=" behave like this. In this case, it is the implementor's choice as to",a+=" how long to wait. In most cases, such an implementation may be",a+=" useful to prevent the type of race condition shown in this section.",a+=" This document expresses no preference about whether or not they",a+=" should wait for an ACK to be delivered. After considering the impact",a+=" on user experience, implementors should decide whether or not to wait",a+=" for a while, because the user experience depends on the",a+=" implementation and has no direct bearing on protocol behavior.",this.logger.warn(a)},i=[`Retry-After: ${Math.floor(Math.random()*10)+1}`];if(this.ackProcessing){this.core.replyStateless(e,{statusCode:500,extraHeaders:i}),t();return}if(this.ackWait&&this.signalingState!==U.Stable){this.core.replyStateless(e,{statusCode:500,extraHeaders:i}),t();return}if(this.reinviteUserAgentServer){this.core.replyStateless(e,{statusCode:500,extraHeaders:i});return}if(this.reinviteUserAgentClient){this.core.replyStateless(e,{statusCode:491});return}}if(e.method===j.INVITE){const t=e.parseHeader("contact");if(!t)throw new Error("Contact undefined.");if(!(t instanceof Le))throw new Error("Contact not instance of NameAddrHeader.");this.dialogState.remoteTarget=t.uri}switch(e.method){case j.BYE:{const t=new Yo(this,e);this.delegate&&this.delegate.onBye?this.delegate.onBye(t):t.accept(),this.dispose()}break;case j.INFO:{const t=new Go(this,e);this.delegate&&this.delegate.onInfo?this.delegate.onInfo(t):t.reject({statusCode:469,extraHeaders:["Recv-Info:"]})}break;case j.INVITE:{const t=new Xo(this,e);this.signalingStateTransition(e),this.delegate&&this.delegate.onInvite?this.delegate.onInvite(t):t.reject({statusCode:488})}break;case j.MESSAGE:{const t=new Hn(this.core,e);this.delegate&&this.delegate.onMessage?this.delegate.onMessage(t):t.accept()}break;case j.NOTIFY:{const t=new ns(this,e);this.delegate&&this.delegate.onNotify?this.delegate.onNotify(t):t.accept()}break;case j.PRACK:{const t=new Zo(this,e);this.delegate&&this.delegate.onPrack?this.delegate.onPrack(t):t.accept()}break;case j.REFER:{const t=new Pn(this,e);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(t):t.reject()}break;default:this.logger.log(`INVITE dialog ${this.id} received unimplemented ${e.method} request`),this.core.replyStateless(e,{statusCode:501});break}}reliableSequenceGuard(e){const t=e.statusCode;if(!t)throw new Error("Status code undefined");if(t>100&&t<200){const r=e.getHeader("require"),i=e.getHeader("rseq"),n=r&&r.includes("100rel")&&i?Number(i):void 0;if(n){if(this.rseq&&this.rseq+1!==n)return!1;this.rseq=this.rseq?this.rseq+1:n}}return!0}signalingStateRollback(){(this._signalingState===U.HaveLocalOffer||this.signalingState===U.HaveRemoteOffer)&&this._rollbackOffer&&this._rollbackAnswer&&(this._signalingState=U.Stable,this._offer=this._rollbackOffer,this._answer=this._rollbackAnswer)}signalingStateTransition(e){const t=Hr(e);if(!(!t||t.contentDisposition!=="session")){if(this._signalingState===U.Stable&&(this._rollbackOffer=this._offer,this._rollbackAnswer=this._answer),e instanceof gr)switch(this._signalingState){case U.Initial:case U.Stable:this._signalingState=U.HaveRemoteOffer,this._offer=t,this._answer=void 0;break;case U.HaveLocalOffer:this._signalingState=U.Stable,this._answer=t;break;case U.HaveRemoteOffer:break;case U.Closed:break;default:throw new Error("Unexpected signaling state.")}if(e instanceof Pt)switch(this._signalingState){case U.Initial:case U.Stable:this._signalingState=U.HaveRemoteOffer,this._offer=t,this._answer=void 0;break;case U.HaveLocalOffer:this._signalingState=U.Stable,this._answer=t;break;case U.HaveRemoteOffer:break;case U.Closed:break;default:throw new Error("Unexpected signaling state.")}if(e instanceof er)switch(this._signalingState){case U.Initial:case U.Stable:this._signalingState=U.HaveLocalOffer,this._offer=t,this._answer=void 0;break;case U.HaveLocalOffer:break;case U.HaveRemoteOffer:this._signalingState=U.Stable,this._answer=t;break;case U.Closed:break;default:throw new Error("Unexpected signaling state.")}if(An(e))switch(this._signalingState){case U.Initial:case U.Stable:this._signalingState=U.HaveLocalOffer,this._offer=t,this._answer=void 0;break;case U.HaveLocalOffer:break;case U.HaveRemoteOffer:this._signalingState=U.Stable,this._answer=t;break;case U.Closed:break;default:throw new Error("Unexpected signaling state.")}}}start2xxRetransmissionTimer(){if(this.initialTransaction instanceof je){const e=this.initialTransaction;let t=Re.T1;const r=()=>{if(!this.ackWait){this.invite2xxTimer=void 0;return}this.logger.log("No ACK for 2xx response received, attempting retransmission"),e.retransmitAcceptedResponse(),t=Math.min(t*2,Re.T2),this.invite2xxTimer=setTimeout(r,t)};this.invite2xxTimer=setTimeout(r,t);const i=()=>{e.state===R.Terminated&&(e.removeStateChangeListener(i),this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.ackWait&&(this.delegate&&this.delegate.onAckTimeout?this.delegate.onAckTimeout():this.bye()))};e.addStateChangeListener(i)}}startReInvite2xxRetransmissionTimer(){if(this.reinviteUserAgentServer&&this.reinviteUserAgentServer.transaction instanceof je){const e=this.reinviteUserAgentServer.transaction;let t=Re.T1;const r=()=>{if(!this.reinviteUserAgentServer){this.invite2xxTimer=void 0;return}this.logger.log("No ACK for 2xx response received, attempting retransmission"),e.retransmitAcceptedResponse(),t=Math.min(t*2,Re.T2),this.invite2xxTimer=setTimeout(r,t)};this.invite2xxTimer=setTimeout(r,t);const i=()=>{e.state===R.Terminated&&(e.removeStateChangeListener(i),this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.reinviteUserAgentServer)};e.addStateChangeListener(i)}}}class t0 extends He{constructor(e,t,r){super(qt,e,t,r),this.confirmedDialogAcks=new Map,this.confirmedDialogs=new Map,this.earlyDialogs=new Map,this.delegate=r}dispose(){this.earlyDialogs.forEach(e=>e.dispose()),this.earlyDialogs.clear(),super.dispose()}onTransportError(e){if(this.transaction.state===R.Calling)return super.onTransportError(e);this.logger.error(e.message),this.logger.error("User agent client request transport error while sending ACK.")}receiveResponse(e){if(!this.authenticationGuard(e))return;const t=e.statusCode?e.statusCode.toString():"";if(!t)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(t):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:e});return;case/^1[0-9]{2}$/.test(t):{if(!e.toTag){this.logger.warn("Non-100 1xx INVITE response received without a to tag, dropping.");return}if(!e.parseHeader("contact")){this.logger.error("Non-100 1xx INVITE response received without a Contact header field, dropping.");return}const i=xr.initialDialogStateForUserAgentClient(this.message,e);let n=this.earlyDialogs.get(i.id);if(!n){const o=this.transaction;if(!(o instanceof qt))throw new Error("Transaction not instance of InviteClientTransaction.");n=new as(o,this.core,i),this.earlyDialogs.set(n.id,n)}if(!n.reliableSequenceGuard(e)){this.logger.warn("1xx INVITE reliable response received out of order or is a retransmission, dropping.");return}(n.signalingState===U.Initial||n.signalingState===U.HaveLocalOffer)&&n.signalingStateTransition(e);const a=n;this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:e,session:a,prack:o=>a.prack(void 0,o)})}return;case/^2[0-9]{2}$/.test(t):{if(!e.toTag){this.logger.error("2xx INVITE response received without a to tag, dropping.");return}if(!e.parseHeader("contact")){this.logger.error("2xx INVITE response received without a Contact header field, dropping.");return}const i=xr.initialDialogStateForUserAgentClient(this.message,e);let n=this.confirmedDialogs.get(i.id);if(n){const o=this.confirmedDialogAcks.get(i.id);if(o){const l=this.transaction;if(!(l instanceof qt))throw new Error("Client transaction not instance of InviteClientTransaction.");l.ackResponse(o.message)}return}if(n=this.earlyDialogs.get(i.id),n)n.confirm(),n.recomputeRouteSet(e),this.earlyDialogs.delete(n.id),this.confirmedDialogs.set(n.id,n);else{const o=this.transaction;if(!(o instanceof qt))throw new Error("Transaction not instance of InviteClientTransaction.");n=new as(o,this.core,i),this.confirmedDialogs.set(n.id,n)}(n.signalingState===U.Initial||n.signalingState===U.HaveLocalOffer)&&n.signalingStateTransition(e);const a=n;if(this.delegate&&this.delegate.onAccept)this.delegate.onAccept({message:e,session:a,ack:o=>{const l=a.ack(o);return this.confirmedDialogAcks.set(a.id,l),l}});else{const o=a.ack();this.confirmedDialogAcks.set(a.id,o)}}return;case/^3[0-9]{2}$/.test(t):this.earlyDialogs.forEach(r=>r.dispose()),this.earlyDialogs.clear(),this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:e});return;case/^[4-6][0-9]{2}$/.test(t):this.earlyDialogs.forEach(r=>r.dispose()),this.earlyDialogs.clear(),this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e});return;default:throw new Error(`Invalid status code ${t}`)}}}class zs extends ft{constructor(e,t,r){super(je,e,t,r),this.core=e}dispose(){this.earlyDialog&&this.earlyDialog.dispose(),super.dispose()}accept(e={statusCode:200}){if(!this.acceptable)throw new Ot(`${this.message.method} not acceptable in state ${this.transaction.state}.`);if(!this.confirmedDialog)if(this.earlyDialog)this.earlyDialog.confirm(),this.confirmedDialog=this.earlyDialog,this.earlyDialog=void 0;else{const l=this.transaction;if(!(l instanceof je))throw new Error("Transaction not instance of InviteClientTransaction.");const c=xr.initialDialogStateForUserAgentServer(this.message,this.toTag);this.confirmedDialog=new as(l,this.core,c)}const t=this.message.getHeaders("record-route").map(l=>`Record-Route: ${l}`),r=`Contact: ${this.core.configuration.contact.toString()}`,i="Allow: "+Mt.toString();if(!e.body){if(this.confirmedDialog.signalingState===U.Stable)e.body=this.confirmedDialog.answer;else if(this.confirmedDialog.signalingState===U.Initial||this.confirmedDialog.signalingState===U.HaveRemoteOffer)throw new Error("Response must have a body.")}e.statusCode=e.statusCode||200,e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(t),e.extraHeaders.push(i),e.extraHeaders.push(r);const n=super.accept(e),a=this.confirmedDialog,o=Object.assign(Object.assign({},n),{session:a});return e.body&&this.confirmedDialog.signalingState!==U.Stable&&this.confirmedDialog.signalingStateTransition(e.body),o}progress(e={statusCode:180}){if(!this.progressable)throw new Ot(`${this.message.method} not progressable in state ${this.transaction.state}.`);if(!this.earlyDialog){const o=this.transaction;if(!(o instanceof je))throw new Error("Transaction not instance of InviteClientTransaction.");const l=xr.initialDialogStateForUserAgentServer(this.message,this.toTag,!0);this.earlyDialog=new as(o,this.core,l)}const t=this.message.getHeaders("record-route").map(o=>`Record-Route: ${o}`),r=`Contact: ${this.core.configuration.contact}`;e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(t),e.extraHeaders.push(r);const i=super.progress(e),n=this.earlyDialog,a=Object.assign(Object.assign({},i),{session:n});return e.body&&this.earlyDialog.signalingState!==U.Stable&&this.earlyDialog.signalingStateTransition(e.body),a}redirect(e,t={statusCode:302}){return super.redirect(e,t)}reject(e={statusCode:486}){return super.reject(e)}}class r0 extends He{constructor(e,t,r){super(Ge,e,t,r)}}class s0 extends He{constructor(e,t,r){super(Ge,e,t,r)}}class i0 extends ft{constructor(e,t,r){super(Ve,e,t,r),this.core=e}}class n0 extends He{constructor(e,t,r){const i=e.createOutgoingRequestMessage(j.SUBSCRIBE,r);super(Ge,e.userAgentCore,i,t),this.dialog=e}waitNotifyStop(){}receiveResponse(e){if(e.statusCode&&e.statusCode>=200&&e.statusCode<300){const t=e.getHeader("Expires");if(!t)this.logger.warn("Expires header missing in a 200-class response to SUBSCRIBE");else{const r=Number(t);this.dialog.subscriptionExpires>r&&(this.dialog.subscriptionExpires=r)}}e.statusCode&&e.statusCode>=400&&e.statusCode<700&&[404,405,410,416,480,481,482,483,484,485,489,501,604].includes(e.statusCode)&&this.dialog.terminate(),super.receiveResponse(e)}}class On extends xr{constructor(e,t,r,i,n,a){super(i,n),this.delegate=a,this._autoRefresh=!1,this._subscriptionEvent=e,this._subscriptionExpires=t,this._subscriptionExpiresInitial=t,this._subscriptionExpiresLastSet=Math.floor(Date.now()/1e3),this._subscriptionRefresh=void 0,this._subscriptionRefreshLastSet=void 0,this._subscriptionState=r,this.logger=i.loggerFactory.getLogger("sip.subscribe-dialog"),this.logger.log(`SUBSCRIBE dialog ${this.id} constructed`)}static initialDialogStateForSubscription(e,t){const i=t.getHeaders("record-route"),n=t.parseHeader("contact");if(!n)throw new Error("Contact undefined.");if(!(n instanceof Le))throw new Error("Contact not instance of NameAddrHeader.");const a=n.uri,o=e.cseq,l=void 0,c=e.callId,d=e.fromTag,g=t.fromTag;if(!c)throw new Error("Call id undefined.");if(!d)throw new Error("From tag undefined.");if(!g)throw new Error("To tag undefined.");if(!e.from)throw new Error("From undefined.");if(!e.to)throw new Error("To undefined.");const u=e.from.uri,y=e.to.uri;return{id:c+d+g,early:!1,callId:c,localTag:d,remoteTag:g,localSequenceNumber:o,remoteSequenceNumber:l,localURI:u,remoteURI:y,remoteTarget:a,routeSet:i,secure:!1}}dispose(){super.dispose(),this.N&&(clearTimeout(this.N),this.N=void 0),this.refreshTimerClear(),this.logger.log(`SUBSCRIBE dialog ${this.id} destroyed`)}get autoRefresh(){return this._autoRefresh}set autoRefresh(e){this._autoRefresh=!0,this.refreshTimerSet()}get subscriptionEvent(){return this._subscriptionEvent}get subscriptionExpires(){const e=Math.floor(Date.now()/1e3)-this._subscriptionExpiresLastSet,t=this._subscriptionExpires-e;return Math.max(t,0)}set subscriptionExpires(e){if(e<0)throw new Error("Expires must be greater than or equal to zero.");if(this._subscriptionExpires=e,this._subscriptionExpiresLastSet=Math.floor(Date.now()/1e3),this.autoRefresh){const t=this.subscriptionRefresh;(t===void 0||t>=e)&&this.refreshTimerSet()}}get subscriptionExpiresInitial(){return this._subscriptionExpiresInitial}get subscriptionRefresh(){if(this._subscriptionRefresh===void 0||this._subscriptionRefreshLastSet===void 0)return;const e=Math.floor(Date.now()/1e3)-this._subscriptionRefreshLastSet,t=this._subscriptionRefresh-e;return Math.max(t,0)}get subscriptionState(){return this._subscriptionState}receiveRequest(e){if(this.logger.log(`SUBSCRIBE dialog ${this.id} received ${e.method} request`),!this.sequenceGuard(e)){this.logger.log(`SUBSCRIBE dialog ${this.id} rejected out of order ${e.method} request.`);return}switch(super.receiveRequest(e),e.method){case j.NOTIFY:this.onNotify(e);break;default:this.logger.log(`SUBSCRIBE dialog ${this.id} received unimplemented ${e.method} request`),this.core.replyStateless(e,{statusCode:501});break}}refresh(){const e="Allow: "+Mt.toString(),t={};return t.extraHeaders=(t.extraHeaders||[]).slice(),t.extraHeaders.push(e),t.extraHeaders.push("Event: "+this.subscriptionEvent),t.extraHeaders.push("Expires: "+this.subscriptionExpiresInitial),t.extraHeaders.push("Contact: "+this.core.configuration.contact.toString()),this.subscribe(void 0,t)}subscribe(e,t={}){var r;if(this.subscriptionState!==oe.Pending&&this.subscriptionState!==oe.Active)throw new Error(`Invalid state ${this.subscriptionState}. May only re-subscribe while in state "pending" or "active".`);this.logger.log(`SUBSCRIBE dialog ${this.id} sending SUBSCRIBE request`);const i=new n0(this,e,t);return this.N&&(clearTimeout(this.N),this.N=void 0),!((r=t.extraHeaders)===null||r===void 0)&&r.includes("Expires: 0")||(this.N=setTimeout(()=>this.timerN(),Re.TIMER_N)),i}terminate(){this.stateTransition(oe.Terminated),this.onTerminated()}unsubscribe(){const e="Allow: "+Mt.toString(),t={};return t.extraHeaders=(t.extraHeaders||[]).slice(),t.extraHeaders.push(e),t.extraHeaders.push("Event: "+this.subscriptionEvent),t.extraHeaders.push("Expires: 0"),t.extraHeaders.push("Contact: "+this.core.configuration.contact.toString()),this.subscribe(void 0,t)}onNotify(e){const t=e.parseHeader("Event").event;if(!t||t!==this.subscriptionEvent){this.core.replyStateless(e,{statusCode:489});return}this.N&&(clearTimeout(this.N),this.N=void 0);const r=e.parseHeader("Subscription-State");if(!r||!r.state){this.core.replyStateless(e,{statusCode:489});return}const i=r.state,n=r.expires?Math.max(r.expires,0):void 0;switch(i){case"pending":this.stateTransition(oe.Pending,n);break;case"active":this.stateTransition(oe.Active,n);break;case"terminated":this.stateTransition(oe.Terminated,n);break;default:this.logger.warn("Unrecognized subscription state.");break}const a=new ns(this,e);this.delegate&&this.delegate.onNotify?this.delegate.onNotify(a):a.accept()}onRefresh(e){this.delegate&&this.delegate.onRefresh&&this.delegate.onRefresh(e)}onTerminated(){this.delegate&&this.delegate.onTerminated&&this.delegate.onTerminated()}refreshTimerClear(){this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=void 0)}refreshTimerSet(){if(this.refreshTimerClear(),this.autoRefresh&&this.subscriptionExpires>0){const e=this.subscriptionExpires*900;this._subscriptionRefresh=Math.floor(e/1e3),this._subscriptionRefreshLastSet=Math.floor(Date.now()/1e3),this.refreshTimer=setTimeout(()=>{this.refreshTimer=void 0,this._subscriptionRefresh=void 0,this._subscriptionRefreshLastSet=void 0,this.onRefresh(this.refresh())},e)}}stateTransition(e,t){const r=()=>{this.logger.warn(`Invalid subscription state transition from ${this.subscriptionState} to ${e}`)};switch(e){case oe.Initial:r();return;case oe.NotifyWait:r();return;case oe.Pending:if(this.subscriptionState!==oe.NotifyWait&&this.subscriptionState!==oe.Pending){r();return}break;case oe.Active:if(this.subscriptionState!==oe.NotifyWait&&this.subscriptionState!==oe.Pending&&this.subscriptionState!==oe.Active){r();return}break;case oe.Terminated:if(this.subscriptionState!==oe.NotifyWait&&this.subscriptionState!==oe.Pending&&this.subscriptionState!==oe.Active){r();return}break;default:r();return}e===oe.Pending&&t&&(this.subscriptionExpires=t),e===oe.Active&&t&&(this.subscriptionExpires=t),e===oe.Terminated&&this.dispose(),this._subscriptionState=e}timerN(){this.logger.warn("Timer N expired for SUBSCRIBE dialog. Timed out waiting for NOTIFY."),this.subscriptionState!==oe.Terminated&&(this.stateTransition(oe.Terminated),this.onTerminated())}}class a0 extends He{constructor(e,t,r){const i=t.getHeader("Event");if(!i)throw new Error("Event undefined");const n=t.getHeader("Expires");if(!n)throw new Error("Expires undefined");super(Ge,e,t,r),this.delegate=r,this.subscriberId=t.callId+t.fromTag+i,this.subscriptionExpiresRequested=this.subscriptionExpires=Number(n),this.subscriptionEvent=i,this.subscriptionState=oe.NotifyWait,this.waitNotifyStart()}dispose(){super.dispose()}onNotify(e){const t=e.message.parseHeader("Event").event;if(!t||t!==this.subscriptionEvent){this.logger.warn("Failed to parse event."),e.reject({statusCode:489});return}const r=e.message.parseHeader("Subscription-State");if(!r||!r.state){this.logger.warn("Failed to parse subscription state."),e.reject({statusCode:489});return}const i=r.state;switch(i){case"pending":break;case"active":break;case"terminated":break;default:this.logger.warn(`Invalid subscription state ${i}`),e.reject({statusCode:489});return}if(i!=="terminated"&&!e.message.parseHeader("contact")){this.logger.warn("Failed to parse contact."),e.reject({statusCode:489});return}if(this.dialog)throw new Error("Dialog already created. This implementation only supports install of single subscriptions.");switch(this.waitNotifyStop(),this.subscriptionExpires=r.expires?Math.min(this.subscriptionExpires,Math.max(r.expires,0)):this.subscriptionExpires,i){case"pending":this.subscriptionState=oe.Pending;break;case"active":this.subscriptionState=oe.Active;break;case"terminated":this.subscriptionState=oe.Terminated;break;default:throw new Error(`Unrecognized state ${i}.`)}if(this.subscriptionState!==oe.Terminated){const n=On.initialDialogStateForSubscription(this.message,e.message);this.dialog=new On(this.subscriptionEvent,this.subscriptionExpires,this.subscriptionState,this.core,n)}if(this.delegate&&this.delegate.onNotify){const n=e,a=this.dialog;this.delegate.onNotify({request:n,subscription:a})}else e.accept()}waitNotifyStart(){this.N||(this.core.subscribers.set(this.subscriberId,this),this.N=setTimeout(()=>this.timerN(),Re.TIMER_N))}waitNotifyStop(){this.N&&(this.core.subscribers.delete(this.subscriberId),clearTimeout(this.N),this.N=void 0)}receiveResponse(e){if(this.authenticationGuard(e)){if(e.statusCode&&e.statusCode>=200&&e.statusCode<300){const t=e.getHeader("Expires");if(!t)this.logger.warn("Expires header missing in a 200-class response to SUBSCRIBE");else{const r=Number(t);r>this.subscriptionExpiresRequested&&this.logger.warn("Expires header in a 200-class response to SUBSCRIBE with a higher value than the one in the request"),r<this.subscriptionExpires&&(this.subscriptionExpires=r)}this.dialog&&this.dialog.subscriptionExpires>this.subscriptionExpires&&(this.dialog.subscriptionExpires=this.subscriptionExpires)}e.statusCode&&e.statusCode>=300&&e.statusCode<700&&this.waitNotifyStop(),super.receiveResponse(e)}}timerN(){this.logger.warn("Timer N expired for SUBSCRIBE user agent client. Timed out waiting for NOTIFY."),this.waitNotifyStop(),this.delegate&&this.delegate.onNotifyTimeout&&this.delegate.onNotifyTimeout()}}class o0 extends ft{constructor(e,t,r){super(Ve,e,t,r),this.core=e}}const Mn=["application/sdp","application/dtmf-relay"];class c0{constructor(e,t={}){this.userAgentClients=new Map,this.userAgentServers=new Map,this.configuration=e,this.delegate=t,this.dialogs=new Map,this.subscribers=new Map,this.logger=e.loggerFactory.getLogger("sip.user-agent-core")}dispose(){this.reset()}reset(){this.dialogs.forEach(e=>e.dispose()),this.dialogs.clear(),this.subscribers.forEach(e=>e.dispose()),this.subscribers.clear(),this.userAgentClients.forEach(e=>e.dispose()),this.userAgentClients.clear(),this.userAgentServers.forEach(e=>e.dispose()),this.userAgentServers.clear()}get loggerFactory(){return this.configuration.loggerFactory}get transport(){const e=this.configuration.transportAccessor();if(!e)throw new Error("Transport undefined.");return e}invite(e,t){return new t0(this,e,t)}message(e,t){return new $n(this,e,t)}publish(e,t){return new r0(this,e,t)}register(e,t){return new s0(this,e,t)}subscribe(e,t){return new a0(this,e,t)}request(e,t){return new He(Ge,this,e,t)}makeOutgoingRequestMessage(e,t,r,i,n,a,o){const l=this.configuration.sipjsId,c=this.configuration.displayName,d=this.configuration.viaForceRport,g=this.configuration.hackViaTcp,u=this.configuration.supportedOptionTags.slice();e===j.REGISTER&&u.push("path","gruu"),e===j.INVITE&&(this.configuration.contact.pubGruu||this.configuration.contact.tempGruu)&&u.push("gruu");const y=this.configuration.routeSet,E=this.configuration.userAgentHeaderFieldValue,v=this.configuration.viaHost,x=Object.assign(Object.assign({},{callIdPrefix:l,forceRport:d,fromDisplayName:c,hackViaTcp:g,optionTags:u,routeSet:y,userAgentString:E,viaHost:v}),n);return new er(e,t,r,i,x,a,o)}receiveIncomingRequestFromTransport(e){this.receiveRequestFromTransport(e)}receiveIncomingResponseFromTransport(e){this.receiveResponseFromTransport(e)}replyStateless(e,t){const r=this.configuration.userAgentHeaderFieldValue,i=this.configuration.supportedOptionTagsResponse;t=Object.assign(Object.assign({},t),{userAgent:r,supported:i});const n=Bn(e,t);return this.transport.send(n.message).catch(a=>{a instanceof Error&&this.logger.error(a.message),this.logger.error(`Transport error occurred sending stateless reply to ${e.method} request.`)}),n}receiveRequestFromTransport(e){const t=e.viaBranch,r=this.userAgentServers.get(t);if(e.method===j.ACK&&r&&r.transaction.state===R.Accepted&&r instanceof zs){this.logger.warn(`Discarding out of dialog ACK after 2xx response sent on transaction ${t}.`);return}if(e.method===j.CANCEL){r?(this.replyStateless(e,{statusCode:200}),r.transaction instanceof je&&r.transaction.state===R.Proceeding&&r instanceof zs&&r.receiveCancel(e)):this.replyStateless(e,{statusCode:481});return}if(r){r.transaction.receiveRequest(e);return}this.receiveRequest(e)}receiveRequest(e){if(!Mt.includes(e.method)){const i="Allow: "+Mt.toString();this.replyStateless(e,{statusCode:405,extraHeaders:[i]});return}if(!e.ruri)throw new Error("Request-URI undefined.");if(e.ruri.scheme!=="sip"){this.replyStateless(e,{statusCode:416});return}const t=e.ruri,r=i=>!!i&&i.user===t.user;if(!r(this.configuration.aor)&&!(r(this.configuration.contact.uri)||r(this.configuration.contact.pubGruu)||r(this.configuration.contact.tempGruu))){this.logger.warn("Request-URI does not point to us."),e.method!==j.ACK&&this.replyStateless(e,{statusCode:404});return}if(e.method===j.INVITE&&!e.hasHeader("Contact")){this.replyStateless(e,{statusCode:400,reasonPhrase:"Missing Contact Header"});return}if(!e.toTag){const i=e.viaBranch;if(!this.userAgentServers.has(i)&&Array.from(this.userAgentServers.values()).some(a=>a.transaction.request.fromTag===e.fromTag&&a.transaction.request.callId===e.callId&&a.transaction.request.cseq===e.cseq)){this.replyStateless(e,{statusCode:482});return}}e.toTag?this.receiveInsideDialogRequest(e):this.receiveOutsideDialogRequest(e)}receiveInsideDialogRequest(e){if(e.method===j.NOTIFY){const i=e.parseHeader("Event");if(!i||!i.event){this.replyStateless(e,{statusCode:489});return}const n=e.callId+e.toTag+i.event,a=this.subscribers.get(n);if(a){const o=new ns(this,e);a.onNotify(o);return}}const t=e.callId+e.toTag+e.fromTag,r=this.dialogs.get(t);if(r){if(e.method===j.OPTIONS){const i="Allow: "+Mt.toString(),n="Accept: "+Mn.toString();this.replyStateless(e,{statusCode:200,extraHeaders:[i,n]});return}r.receiveRequest(e);return}e.method!==j.ACK&&this.replyStateless(e,{statusCode:481})}receiveOutsideDialogRequest(e){switch(e.method){case j.ACK:break;case j.BYE:this.replyStateless(e,{statusCode:481});break;case j.CANCEL:throw new Error(`Unexpected out of dialog request method ${e.method}.`);case j.INFO:this.replyStateless(e,{statusCode:405});break;case j.INVITE:{const t=new zs(this,e);this.delegate.onInvite?this.delegate.onInvite(t):t.reject()}break;case j.MESSAGE:{const t=new Hn(this,e);this.delegate.onMessage?this.delegate.onMessage(t):t.accept()}break;case j.NOTIFY:{const t=new ns(this,e);this.delegate.onNotify?this.delegate.onNotify(t):t.reject({statusCode:405})}break;case j.OPTIONS:{const t="Allow: "+Mt.toString(),r="Accept: "+Mn.toString();this.replyStateless(e,{statusCode:200,extraHeaders:[t,r]})}break;case j.REFER:{const t=new Pn(this,e);this.delegate.onRefer?this.delegate.onRefer(t):t.reject({statusCode:405})}break;case j.REGISTER:{const t=new i0(this,e);this.delegate.onRegister?this.delegate.onRegister(t):t.reject({statusCode:405})}break;case j.SUBSCRIBE:{const t=new o0(this,e);this.delegate.onSubscribe?this.delegate.onSubscribe(t):t.reject({statusCode:480})}break;default:throw new Error(`Unexpected out of dialog request method ${e.method}.`)}}receiveResponseFromTransport(e){if(e.getHeaders("via").length>1){this.logger.warn("More than one Via header field present in the response, dropping");return}const t=e.viaBranch+e.method,r=this.userAgentClients.get(t);r?r.transaction.receiveResponse(e):this.logger.warn(`Discarding unmatched ${e.statusCode} response to ${e.method} ${t}.`)}}function d0(){return s=>!s.audio&&!s.video?Promise.resolve(new MediaStream):navigator.mediaDevices===void 0?Promise.reject(new Error("Media devices not available in insecure contexts.")):navigator.mediaDevices.getUserMedia.call(navigator.mediaDevices,s)}function l0(){return{bundlePolicy:"balanced",certificates:void 0,iceCandidatePoolSize:0,iceServers:[{urls:"stun:stun.l.google.com:19302"}],iceTransportPolicy:"all",rtcpMuxPolicy:"require"}}class Ct{constructor(e,t,r){e.debug("SessionDescriptionHandler.constructor"),this.logger=e,this.mediaStreamFactory=t,this.sessionDescriptionHandlerConfiguration=r,this._localMediaStream=new MediaStream,this._remoteMediaStream=new MediaStream,this._peerConnection=new RTCPeerConnection(r==null?void 0:r.peerConnectionConfiguration),this.initPeerConnectionEventHandlers()}get localMediaStream(){return this._localMediaStream}get remoteMediaStream(){return this._remoteMediaStream}get dataChannel(){return this._dataChannel}get peerConnection(){return this._peerConnection}get peerConnectionDelegate(){return this._peerConnectionDelegate}set peerConnectionDelegate(e){this._peerConnectionDelegate=e}static dispatchAddTrackEvent(e,t){e.dispatchEvent(new MediaStreamTrackEvent("addtrack",{track:t}))}static dispatchRemoveTrackEvent(e,t){e.dispatchEvent(new MediaStreamTrackEvent("removetrack",{track:t}))}close(){this.logger.debug("SessionDescriptionHandler.close"),this._peerConnection!==void 0&&(this._peerConnection.getReceivers().forEach(e=>{e.track&&e.track.stop()}),this._peerConnection.getSenders().forEach(e=>{e.track&&e.track.stop()}),this._dataChannel&&this._dataChannel.close(),this._peerConnection.close(),this._peerConnection=void 0)}enableReceiverTracks(e){const t=this.peerConnection;if(!t)throw new Error("Peer connection closed.");t.getReceivers().forEach(r=>{r.track&&(r.track.enabled=e)})}enableSenderTracks(e){const t=this.peerConnection;if(!t)throw new Error("Peer connection closed.");t.getSenders().forEach(r=>{r.track&&(r.track.enabled=e)})}getDescription(e,t){var r,i;if(this.logger.debug("SessionDescriptionHandler.getDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));this.onDataChannel=e==null?void 0:e.onDataChannel;const n=(r=e==null?void 0:e.offerOptions)===null||r===void 0?void 0:r.iceRestart,a=(e==null?void 0:e.iceGatheringTimeout)===void 0?(i=this.sessionDescriptionHandlerConfiguration)===null||i===void 0?void 0:i.iceGatheringTimeout:e==null?void 0:e.iceGatheringTimeout;return this.getLocalMediaStream(e).then(()=>this.updateDirection(e)).then(()=>this.createDataChannel(e)).then(()=>this.createLocalOfferOrAnswer(e)).then(o=>this.applyModifiers(o,t)).then(o=>this.setLocalSessionDescription(o)).then(()=>this.waitForIceGatheringComplete(n,a)).then(()=>this.getLocalSessionDescription()).then(o=>({body:o.sdp,contentType:"application/sdp"})).catch(o=>{throw this.logger.error("SessionDescriptionHandler.getDescription failed - "+o),o})}hasDescription(e){return this.logger.debug("SessionDescriptionHandler.hasDescription"),e==="application/sdp"}iceGatheringComplete(){this.logger.debug("SessionDescriptionHandler.iceGatheringComplete"),this.iceGatheringCompleteTimeoutId!==void 0&&(this.logger.debug("SessionDescriptionHandler.iceGatheringComplete - clearing timeout"),clearTimeout(this.iceGatheringCompleteTimeoutId),this.iceGatheringCompleteTimeoutId=void 0),this.iceGatheringCompletePromise!==void 0&&(this.logger.debug("SessionDescriptionHandler.iceGatheringComplete - resolving promise"),this.iceGatheringCompleteResolve&&this.iceGatheringCompleteResolve(),this.iceGatheringCompletePromise=void 0,this.iceGatheringCompleteResolve=void 0,this.iceGatheringCompleteReject=void 0)}sendDtmf(e,t){if(this.logger.debug("SessionDescriptionHandler.sendDtmf"),this._peerConnection===void 0)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - peer connection closed"),!1;const r=this._peerConnection.getSenders();if(r.length===0)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - no senders"),!1;const i=r[0].dtmf;if(!i)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - no DTMF sender"),!1;const n=t==null?void 0:t.duration,a=t==null?void 0:t.interToneGap;try{i.insertDTMF(e,n,a)}catch(o){return this.logger.error(o.toString()),!1}return this.logger.log("SessionDescriptionHandler.sendDtmf sent via RTP: "+e.toString()),!0}setDescription(e,t,r){if(this.logger.debug("SessionDescriptionHandler.setDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));this.onDataChannel=t==null?void 0:t.onDataChannel;const i=this._peerConnection.signalingState==="have-local-offer"?"answer":"offer";return this.getLocalMediaStream(t).then(()=>this.applyModifiers({sdp:e,type:i},r)).then(n=>this.setRemoteSessionDescription(n)).catch(n=>{throw this.logger.error("SessionDescriptionHandler.setDescription failed - "+n),n})}applyModifiers(e,t){return this.logger.debug("SessionDescriptionHandler.applyModifiers"),!t||t.length===0?Promise.resolve(e):t.reduce((r,i)=>r.then(i),Promise.resolve(e)).then(r=>{if(this.logger.debug("SessionDescriptionHandler.applyModifiers - modified sdp"),!r.sdp||!r.type)throw new Error("Invalid SDP.");return{sdp:r.sdp,type:r.type}})}createDataChannel(e){if(this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));if((e==null?void 0:e.dataChannel)!==!0||this._dataChannel)return Promise.resolve();switch(this._peerConnection.signalingState){case"stable":this.logger.debug("SessionDescriptionHandler.createDataChannel - creating data channel");try{return this._dataChannel=this._peerConnection.createDataChannel((e==null?void 0:e.dataChannelLabel)||"",e==null?void 0:e.dataChannelOptions),this.onDataChannel&&this.onDataChannel(this._dataChannel),Promise.resolve()}catch(t){return Promise.reject(t)}case"have-remote-offer":return Promise.resolve();case"have-local-offer":case"have-local-pranswer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}}createLocalOfferOrAnswer(e){if(this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));switch(this._peerConnection.signalingState){case"stable":return this.logger.debug("SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP offer"),this._peerConnection.createOffer(e==null?void 0:e.offerOptions);case"have-remote-offer":return this.logger.debug("SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP answer"),this._peerConnection.createAnswer(e==null?void 0:e.answerOptions);case"have-local-offer":case"have-local-pranswer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}}getLocalMediaStream(e){if(this.logger.debug("SessionDescriptionHandler.getLocalMediaStream"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));let t=Object.assign({},e==null?void 0:e.constraints);if(this.localMediaStreamConstraints){if(t.audio=t.audio||this.localMediaStreamConstraints.audio,t.video=t.video||this.localMediaStreamConstraints.video,JSON.stringify(this.localMediaStreamConstraints.audio)===JSON.stringify(t.audio)&&JSON.stringify(this.localMediaStreamConstraints.video)===JSON.stringify(t.video))return Promise.resolve()}else t.audio===void 0&&t.video===void 0&&(t={audio:!0});return this.localMediaStreamConstraints=t,this.mediaStreamFactory(t,this,e).then(r=>this.setLocalMediaStream(r))}setLocalMediaStream(e){if(this.logger.debug("SessionDescriptionHandler.setLocalMediaStream"),!this._peerConnection)throw new Error("Peer connection undefined.");const t=this._peerConnection,r=this._localMediaStream,i=[],n=l=>{const c=l.kind;if(c!=="audio"&&c!=="video")throw new Error(`Unknown new track kind ${c}.`);const d=t.getSenders().find(g=>g.track&&g.track.kind===c);d?i.push(new Promise(g=>{this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - replacing sender ${c} track`),g()}).then(()=>d.replaceTrack(l).then(()=>{const g=r.getTracks().find(u=>u.kind===c);g&&(g.stop(),r.removeTrack(g),Ct.dispatchRemoveTrackEvent(r,g)),r.addTrack(l),Ct.dispatchAddTrackEvent(r,l)}).catch(g=>{throw this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to replace sender ${c} track`),g}))):i.push(new Promise(g=>{this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - adding sender ${c} track`),g()}).then(()=>{try{t.addTrack(l,r)}catch(g){throw this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to add sender ${c} track`),g}r.addTrack(l),Ct.dispatchAddTrackEvent(r,l)}))},a=e.getAudioTracks();a.length&&n(a[0]);const o=e.getVideoTracks();return o.length&&n(o[0]),i.reduce((l,c)=>l.then(()=>c),Promise.resolve())}getLocalSessionDescription(){if(this.logger.debug("SessionDescriptionHandler.getLocalSessionDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));const e=this._peerConnection.localDescription;return e?Promise.resolve(e):Promise.reject(new Error("Failed to get local session description"))}setLocalSessionDescription(e){return this.logger.debug("SessionDescriptionHandler.setLocalSessionDescription"),this._peerConnection===void 0?Promise.reject(new Error("Peer connection closed.")):this._peerConnection.setLocalDescription(e)}setRemoteSessionDescription(e){if(this.logger.debug("SessionDescriptionHandler.setRemoteSessionDescription"),this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));const t=e.sdp;let r;switch(this._peerConnection.signalingState){case"stable":r="offer";break;case"have-local-offer":r="answer";break;case"have-local-pranswer":case"have-remote-offer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}return t?this._peerConnection.setRemoteDescription({sdp:t,type:r}):(this.logger.error("SessionDescriptionHandler.setRemoteSessionDescription failed - cannot set null sdp"),Promise.reject(new Error("SDP is undefined")))}setRemoteTrack(e){this.logger.debug("SessionDescriptionHandler.setRemoteTrack");const t=this._remoteMediaStream;t.getTrackById(e.id)?this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - have remote ${e.kind} track`):e.kind==="audio"?(this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - adding remote ${e.kind} track`),t.getAudioTracks().forEach(r=>{r.stop(),t.removeTrack(r),Ct.dispatchRemoveTrackEvent(t,r)}),t.addTrack(e),Ct.dispatchAddTrackEvent(t,e)):e.kind==="video"&&(this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - adding remote ${e.kind} track`),t.getVideoTracks().forEach(r=>{r.stop(),t.removeTrack(r),Ct.dispatchRemoveTrackEvent(t,r)}),t.addTrack(e),Ct.dispatchAddTrackEvent(t,e))}updateDirection(e){if(this._peerConnection===void 0)return Promise.reject(new Error("Peer connection closed."));switch(this._peerConnection.signalingState){case"stable":this.logger.debug("SessionDescriptionHandler.updateDirection - setting offer direction");{const t=r=>{switch(r){case"inactive":return e!=null&&e.hold?"inactive":"recvonly";case"recvonly":return e!=null&&e.hold?"inactive":"recvonly";case"sendonly":return e!=null&&e.hold?"sendonly":"sendrecv";case"sendrecv":return e!=null&&e.hold?"sendonly":"sendrecv";case"stopped":return"stopped";default:throw new Error("Should never happen")}};this._peerConnection.getTransceivers().forEach(r=>{if(r.direction){const i=t(r.direction);r.direction!==i&&(r.direction=i)}})}break;case"have-remote-offer":this.logger.debug("SessionDescriptionHandler.updateDirection - setting answer direction");{const t=(()=>{const i=this._peerConnection.remoteDescription;if(!i)throw new Error("Failed to read remote offer");const n=/a=sendrecv\r\n|a=sendonly\r\n|a=recvonly\r\n|a=inactive\r\n/.exec(i.sdp);if(n)switch(n[0]){case`a=inactive\r
|
|
66
66
|
`:return"inactive";case`a=recvonly\r
|
|
67
67
|
`:return"recvonly";case`a=sendonly\r
|
|
68
68
|
`:return"sendonly";case`a=sendrecv\r
|
|
@@ -77,10 +77,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
77
77
|
`+i+`
|
|
78
78
|
`);if(this.state!==K.Connected){this.logger.warn("Received message while not connected, discarding...");return}if(this.onMessage)try{this.onMessage(i)}catch(n){throw this.logger.error(n.toString()),this.logger.error("Exception thrown by onMessage callback"),n}}onWebSocketOpen(e,t){t===this._ws&&this._state===K.Connecting&&(this.logger.log(`WebSocket opened ${this.server}`),this.transitionState(K.Connected))}transitionLoopDetectedError(e){let t="A state transition loop has been detected.";return t+=` An attempt to transition from ${this._state} to ${e} before the prior transition completed.`,t+=" Perhaps you are synchronously calling connect() or disconnect() from a callback or state change handler?",this.logger.error(t),new kr("Loop detected.")}transitionState(e,t){const r=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};if(this.transitioningState)throw this.transitionLoopDetectedError(e);switch(this.transitioningState=!0,this._state){case K.Connecting:e!==K.Connected&&e!==K.Disconnecting&&e!==K.Disconnected&&r();break;case K.Connected:e!==K.Disconnecting&&e!==K.Disconnected&&r();break;case K.Disconnecting:e!==K.Connecting&&e!==K.Disconnected&&r();break;case K.Disconnected:e!==K.Connecting&&r();break;default:throw new Error("Unknown state.")}const i=this._state;this._state=e;const n=this.connectResolve,a=this.connectReject;i===K.Connecting&&(this.connectPromise=void 0,this.connectResolve=void 0,this.connectReject=void 0);const o=this.disconnectResolve,l=this.disconnectReject;if(i===K.Disconnecting&&(this.disconnectPromise=void 0,this.disconnectResolve=void 0,this.disconnectReject=void 0),this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=void 0),this.logger.log(`Transitioned from ${i} to ${this._state}`),this._stateEventEmitter.emit(this._state),e===K.Connected&&(this.startSendingKeepAlives(),this.onConnect))try{this.onConnect()}catch(c){throw this.logger.error(c.toString()),this.logger.error("Exception thrown by onConnect callback"),c}if(i===K.Connected&&(this.stopSendingKeepAlives(),this.onDisconnect))try{t?this.onDisconnect(t):this.onDisconnect()}catch(c){throw this.logger.error(c.toString()),this.logger.error("Exception thrown by onDisconnect callback"),c}if(i===K.Connecting){if(!n)throw new Error("Connect resolve undefined.");if(!a)throw new Error("Connect reject undefined.");e===K.Connected?n():a(t||new Error("Connect aborted."))}if(i===K.Disconnecting){if(!o)throw new Error("Disconnect resolve undefined.");if(!l)throw new Error("Disconnect reject undefined.");e===K.Disconnected?o():l(t||new Error("Disconnect aborted."))}this.transitioningState=!1}clearKeepAliveTimeout(){this.keepAliveDebounceTimeout&&clearTimeout(this.keepAliveDebounceTimeout),this.keepAliveDebounceTimeout=void 0}sendKeepAlive(){return this.keepAliveDebounceTimeout?Promise.resolve():(this.keepAliveDebounceTimeout=setTimeout(()=>{this.clearKeepAliveTimeout()},this.configuration.keepAliveDebounce*1e3),this.send(`\r
|
|
79
79
|
\r
|
|
80
|
-
`))}startSendingKeepAlives(){const e=t=>{const r=t*.8;return 1e3*(Math.random()*(t-r)+r)};this.configuration.keepAliveInterval&&!this.keepAliveInterval&&(this.keepAliveInterval=setInterval(()=>{this.sendKeepAlive(),this.startSendingKeepAlives()},e(this.configuration.keepAliveInterval)))}stopSendingKeepAlives(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval),this.keepAliveDebounceTimeout&&clearTimeout(this.keepAliveDebounceTimeout),this.keepAliveInterval=void 0,this.keepAliveDebounceTimeout=void 0}}os.defaultOptions={server:"",connectionTimeout:5,keepAliveInterval:0,keepAliveDebounce:10,traceSip:!0};class tr{constructor(e={}){if(this._publishers={},this._registerers={},this._sessions={},this._subscriptions={},this._state=Ie.Stopped,this._stateEventEmitter=new Ir,this.delegate=e.delegate,this.options=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},tr.defaultOptions()),{sipjsId:Qt(5)}),{uri:new lt("sip","anonymous."+Qt(6),"anonymous.invalid")}),{viaHost:Qt(12)+".invalid"}),tr.stripUndefinedProperties(e)),this.options.hackIpInContact)if(typeof this.options.hackIpInContact=="boolean"&&this.options.hackIpInContact){const i=Math.floor(Math.random()*254+1);this.options.viaHost="192.0.2."+i}else this.options.hackIpInContact&&(this.options.viaHost=this.options.hackIpInContact);switch(this.loggerFactory=new Lo,this.logger=this.loggerFactory.getLogger("sip.UserAgent"),this.loggerFactory.builtinEnabled=this.options.logBuiltinEnabled,this.loggerFactory.connector=this.options.logConnector,this.options.logLevel){case"error":this.loggerFactory.level=Fe.error;break;case"warn":this.loggerFactory.level=Fe.warn;break;case"log":this.loggerFactory.level=Fe.log;break;case"debug":this.loggerFactory.level=Fe.debug;break}if(this.options.logConfiguration&&(this.logger.log("Configuration:"),Object.keys(this.options).forEach(t=>{const r=this.options[t];switch(t){case"uri":case"sessionDescriptionHandlerFactory":this.logger.log("· "+t+": "+r);break;case"authorizationPassword":this.logger.log("· "+t+": NOT SHOWN");break;case"transportConstructor":this.logger.log("· "+t+": "+r.name);break;default:this.logger.log("· "+t+": "+JSON.stringify(r))}})),this.options.transportOptions){const t=this.options.transportOptions,r=t.maxReconnectionAttempts,i=t.reconnectionTimeout;r!==void 0&&this.logger.warn('The transport option "maxReconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),i!==void 0&&this.logger.warn('The transport option "reconnectionTimeout" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),e.reconnectionDelay===void 0&&i!==void 0&&(this.options.reconnectionDelay=i),e.reconnectionAttempts===void 0&&r!==void 0&&(this.options.reconnectionAttempts=r)}if(e.reconnectionDelay!==void 0&&this.logger.warn('The user agent option "reconnectionDelay" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),e.reconnectionAttempts!==void 0&&this.logger.warn('The user agent option "reconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),this._transport=new this.options.transportConstructor(this.getLogger("sip.Transport"),this.options.transportOptions),this.initTransportCallbacks(),this._contact=this.initContact(),this._instanceId=this.options.instanceId?this.options.instanceId:tr.newUUID(),Te.parse(this._instanceId,"uuid")===-1)throw new Error("Invalid instanceId.");this._userAgentCore=this.initCore()}static makeURI(e){return Te.URIParse(e)}static defaultOptions(){return{allowLegacyNotifications:!1,authorizationHa1:"",authorizationPassword:"",authorizationUsername:"",delegate:{},contactName:"",contactParams:{transport:"ws"},displayName:"",forceRport:!1,gracefulShutdown:!0,hackAllowUnregisteredOptionTags:!1,hackIpInContact:!1,hackViaTcp:!1,instanceId:"",instanceIdAlwaysAdded:!1,logBuiltinEnabled:!0,logConfiguration:!0,logConnector:()=>{},logLevel:"log",noAnswerTimeout:60,preloadedRouteSet:[],reconnectionAttempts:0,reconnectionDelay:4,sendInitialProvisionalResponse:!0,sessionDescriptionHandlerFactory:h0(),sessionDescriptionHandlerFactoryOptions:{},sipExtension100rel:rt.Unsupported,sipExtensionReplaces:rt.Unsupported,sipExtensionExtraSupported:[],sipjsId:"",transportConstructor:os,transportOptions:{},uri:new lt("sip","anonymous","anonymous.invalid"),userAgentString:"SIP.js/"+So,viaHost:""}}static newUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const r=Math.floor(Math.random()*16);return(t==="x"?r:r%4+8).toString(16)})}static stripUndefinedProperties(e){return Object.keys(e).reduce((t,r)=>(e[r]!==void 0&&(t[r]=e[r]),t),{})}get configuration(){return this.options}get contact(){return this._contact}get instanceId(){return this._instanceId}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get transport(){return this._transport}get userAgentCore(){return this._userAgentCore}getLogger(e,t){return this.loggerFactory.getLogger(e,t)}getLoggerFactory(){return this.loggerFactory}isConnected(){return this.transport.isConnected()}reconnect(){return this.state===Ie.Stopped?Promise.reject(new Error("User agent stopped.")):Promise.resolve().then(()=>this.transport.connect())}start(){return this.state===Ie.Started?(this.logger.warn("User agent already started"),Promise.resolve()):(this.logger.log(`Starting ${this.configuration.uri}`),this.transitionState(Ie.Started),this.transport.connect())}async stop(){if(this.state===Ie.Stopped)return this.logger.warn("User agent already stopped"),Promise.resolve();if(this.logger.log(`Stopping ${this.configuration.uri}`),!this.options.gracefulShutdown)return this.logger.log("Dispose of transport"),this.transport.dispose().catch(o=>{throw this.logger.error(o.message),o}),this.logger.log("Dispose of core"),this.userAgentCore.dispose(),this._publishers={},this._registerers={},this._sessions={},this._subscriptions={},this.transitionState(Ie.Stopped),Promise.resolve();const e=Object.assign({},this._publishers),t=Object.assign({},this._registerers),r=Object.assign({},this._sessions),i=Object.assign({},this._subscriptions),n=this.transport,a=this.userAgentCore;this.logger.log("Dispose of registerers");for(const o in t)t[o]&&await t[o].dispose().catch(l=>{throw this.logger.error(l.message),delete this._registerers[o],l});this.logger.log("Dispose of sessions");for(const o in r)r[o]&&await r[o].dispose().catch(l=>{throw this.logger.error(l.message),delete this._sessions[o],l});this.logger.log("Dispose of subscriptions");for(const o in i)i[o]&&await i[o].dispose().catch(l=>{throw this.logger.error(l.message),delete this._subscriptions[o],l});this.logger.log("Dispose of publishers");for(const o in e)e[o]&&await e[o].dispose().catch(l=>{throw this.logger.error(l.message),delete this._publishers[o],l});this.logger.log("Dispose of transport"),await n.dispose().catch(o=>{throw this.logger.error(o.message),o}),this.logger.log("Dispose of core"),a.dispose(),this.transitionState(Ie.Stopped)}_makeInviter(e,t){return new Rn(this,e,t)}attemptReconnection(e=1){const t=this.options.reconnectionAttempts,r=this.options.reconnectionDelay;if(e>t){this.logger.log("Maximum reconnection attempts reached");return}this.logger.log(`Reconnection attempt ${e} of ${t} - trying`),setTimeout(()=>{this.reconnect().then(()=>{this.logger.log(`Reconnection attempt ${e} of ${t} - succeeded`)}).catch(i=>{this.logger.error(i.message),this.logger.log(`Reconnection attempt ${e} of ${t} - failed`),this.attemptReconnection(++e)})},e===1?0:r*1e3)}initContact(){const e=this.options.contactName!==""?this.options.contactName:Qt(8),t=this.options.contactParams;return{pubGruu:void 0,tempGruu:void 0,uri:new lt("sip",e,this.options.viaHost,void 0,t),toString:(i={})=>{const n=i.anonymous||!1,a=i.outbound||!1,o=i.register||!1;let l="<";return n?l+=this.contact.tempGruu||`sip:anonymous@anonymous.invalid;transport=${t.transport?t.transport:"ws"}`:o?l+=this.contact.uri:l+=this.contact.pubGruu||this.contact.uri,a&&(l+=";ob"),l+=">",this.options.instanceIdAlwaysAdded&&(l+=';+sip.instance="<urn:uuid:'+this._instanceId+'>"'),l}}}initCore(){let e=[];e.push("outbound"),this.options.sipExtension100rel===rt.Supported&&e.push("100rel"),this.options.sipExtensionReplaces===rt.Supported&&e.push("replaces"),this.options.sipExtensionExtraSupported&&e.push(...this.options.sipExtensionExtraSupported),this.options.hackAllowUnregisteredOptionTags||(e=e.filter(n=>No[n])),e=Array.from(new Set(e));const t=e.slice();(this.contact.pubGruu||this.contact.tempGruu)&&t.push("gruu");const r={aor:this.options.uri,contact:this.contact,displayName:this.options.displayName,loggerFactory:this.loggerFactory,hackViaTcp:this.options.hackViaTcp,routeSet:this.options.preloadedRouteSet,supportedOptionTags:e,supportedOptionTagsResponse:t,sipjsId:this.options.sipjsId,userAgentHeaderFieldValue:this.options.userAgentString,viaForceRport:this.options.forceRport,viaHost:this.options.viaHost,authenticationFactory:()=>{const n=this.options.authorizationUsername?this.options.authorizationUsername:this.options.uri.user,a=this.options.authorizationPassword?this.options.authorizationPassword:void 0,o=this.options.authorizationHa1?this.options.authorizationHa1:void 0;return new Uo(this.getLoggerFactory(),o,n,a)},transportAccessor:()=>this.transport},i={onInvite:n=>{var a;const o=new qo(this,n);if(n.delegate={onCancel:l=>{o._onCancel(l)},onTransportError:l=>{this.logger.error("A transport error has occurred while handling an incoming INVITE request.")}},n.trying(),this.options.sipExtensionReplaces!==rt.Unsupported){const c=n.message.parseHeader("replaces");if(c){const d=c.call_id;if(typeof d!="string")throw new Error("Type of call id is not string");const g=c.replaces_to_tag;if(typeof g!="string")throw new Error("Type of to tag is not string");const u=c.replaces_from_tag;if(typeof u!="string")throw new Error("type of from tag is not string");const E=d+g+u,y=this.userAgentCore.dialogs.get(E);if(!y){o.reject({statusCode:481});return}if(!y.early&&c.early_only===!0){o.reject({statusCode:486});return}const v=this._sessions[d+u]||this._sessions[d+g]||void 0;if(!v)throw new Error("Session does not exist.");o._replacee=v}}if(!((a=this.delegate)===null||a===void 0)&&a.onInvite){if(o.autoSendAnInitialProvisionalResponse){o.progress().then(()=>{var l;if(((l=this.delegate)===null||l===void 0?void 0:l.onInvite)===void 0)throw new Error("onInvite undefined.");this.delegate.onInvite(o)});return}this.delegate.onInvite(o);return}o.reject({statusCode:486})},onMessage:n=>{if(this.delegate&&this.delegate.onMessage){const a=new Sn(n);this.delegate.onMessage(a)}else n.accept()},onNotify:n=>{if(this.delegate&&this.delegate.onNotify){const a=new Gs(n);this.delegate.onNotify(a)}else this.options.allowLegacyNotifications?n.accept():n.reject({statusCode:481})},onRefer:n=>{this.logger.warn("Received an out of dialog REFER request"),this.delegate&&this.delegate.onReferRequest?this.delegate.onReferRequest(n):n.reject({statusCode:405})},onRegister:n=>{this.logger.warn("Received an out of dialog REGISTER request"),this.delegate&&this.delegate.onRegisterRequest?this.delegate.onRegisterRequest(n):n.reject({statusCode:405})},onSubscribe:n=>{this.logger.warn("Received an out of dialog SUBSCRIBE request"),this.delegate&&this.delegate.onSubscribeRequest?this.delegate.onSubscribeRequest(n):n.reject({statusCode:405})}};return new c0(r,i)}initTransportCallbacks(){this.transport.onConnect=()=>this.onTransportConnect(),this.transport.onDisconnect=e=>this.onTransportDisconnect(e),this.transport.onMessage=e=>this.onTransportMessage(e)}onTransportConnect(){this.state!==Ie.Stopped&&this.delegate&&this.delegate.onConnect&&this.delegate.onConnect()}onTransportDisconnect(e){this.state!==Ie.Stopped&&(this.delegate&&this.delegate.onDisconnect&&this.delegate.onDisconnect(e),e&&this.options.reconnectionAttempts>0&&this.attemptReconnection())}onTransportMessage(e){const t=ss.parseMessage(e,this.getLogger("sip.Parser"));if(!t){this.logger.warn("Failed to parse incoming message. Dropping.");return}if(this.state===Ie.Stopped&&t instanceof gr){this.logger.warn(`Received ${t.method} request while stopped. Dropping.`);return}const r=()=>{const i=["from","to","call_id","cseq","via"];for(const n of i)if(!t.hasHeader(n))return this.logger.warn(`Missing mandatory header field : ${n}.`),!1;return!0};if(t instanceof gr){if(!r()){this.logger.warn("Request missing mandatory header field. Dropping.");return}if(!t.toTag&&t.callId.substr(0,5)===this.options.sipjsId){this.userAgentCore.replyStateless(t,{statusCode:482});return}const i=$r(t.body),n=t.getHeader("content-length");if(n&&i<Number(n)){this.userAgentCore.replyStateless(t,{statusCode:400});return}}if(t instanceof Pt){if(!r()){this.logger.warn("Response missing mandatory header field. Dropping.");return}if(t.getHeaders("via").length>1){this.logger.warn("More than one Via header field present in the response. Dropping.");return}if(t.via.host!==this.options.viaHost||t.via.port!==void 0){this.logger.warn("Via sent-by in the response does not match UA Via host value. Dropping.");return}const i=$r(t.body),n=t.getHeader("content-length");if(n&&i<Number(n)){this.logger.warn("Message body length is lower than the value in Content-Length header field. Dropping.");return}}if(t instanceof gr){this.userAgentCore.receiveIncomingRequestFromTransport(t);return}if(t instanceof Pt){this.userAgentCore.receiveIncomingResponseFromTransport(t);return}throw new Error("Invalid message type.")}transitionState(e,t){const r=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case Ie.Started:e!==Ie.Stopped&&r();break;case Ie.Stopped:e!==Ie.Started&&r();break;default:throw new Error("Unknown state.")}this.logger.log(`Transitioned from ${this._state} to ${e}`),this._state=e,this._stateEventEmitter.emit(this._state)}}function u0(s){if(!s.sdp||!s.type)throw new Error("Invalid SDP");let e=s.sdp;const t=s.type;return e&&(/a=(sendrecv|sendonly|recvonly|inactive)/.test(e)?(e=e.replace(/a=sendrecv\r\n/g,`a=sendonly\r
|
|
81
|
-
`),e=e.replace(/a=recvonly\r\n/g,`a=inactive\r
|
|
82
|
-
`)):e=e.replace(/(m=[^\r]*\r\n)/g,`$1a=sendonly\r
|
|
83
|
-
`)),Promise.resolve({sdp:e,type:t})}var Nn={exports:{}};function f0(s){throw new Error('Could not dynamically require "'+s+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ks={exports:{}};const g0=bo(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var qn;function se(){return qn||(qn=1,function(s,e){(function(t,r){s.exports=r()})(ee,function(){var t=t||function(r,i){var n;if(typeof window<"u"&&window.crypto&&(n=window.crypto),typeof self<"u"&&self.crypto&&(n=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(n=globalThis.crypto),!n&&typeof window<"u"&&window.msCrypto&&(n=window.msCrypto),!n&&typeof ee<"u"&&ee.crypto&&(n=ee.crypto),!n&&typeof f0=="function")try{n=g0}catch{}var a=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function p(){}return function(w){var D;return p.prototype=w,D=new p,p.prototype=null,D}}(),l={},c=l.lib={},d=c.Base=function(){return{extend:function(p){var w=o(this);return p&&w.mixIn(p),(!w.hasOwnProperty("init")||this.init===w.init)&&(w.init=function(){w.$super.init.apply(this,arguments)}),w.init.prototype=w,w.$super=this,w},create:function(){var p=this.extend();return p.init.apply(p,arguments),p},init:function(){},mixIn:function(p){for(var w in p)p.hasOwnProperty(w)&&(this[w]=p[w]);p.hasOwnProperty("toString")&&(this.toString=p.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),g=c.WordArray=d.extend({init:function(p,w){p=this.words=p||[],w!=i?this.sigBytes=w:this.sigBytes=p.length*4},toString:function(p){return(p||E).stringify(this)},concat:function(p){var w=this.words,D=p.words,S=this.sigBytes,T=p.sigBytes;if(this.clamp(),S%4)for(var F=0;F<T;F++){var h=D[F>>>2]>>>24-F%4*8&255;w[S+F>>>2]|=h<<24-(S+F)%4*8}else for(var M=0;M<T;M+=4)w[S+M>>>2]=D[M>>>2];return this.sigBytes+=T,this},clamp:function(){var p=this.words,w=this.sigBytes;p[w>>>2]&=4294967295<<32-w%4*8,p.length=r.ceil(w/4)},clone:function(){var p=d.clone.call(this);return p.words=this.words.slice(0),p},random:function(p){for(var w=[],D=0;D<p;D+=4)w.push(a());return new g.init(w,p)}}),u=l.enc={},E=u.Hex={stringify:function(p){for(var w=p.words,D=p.sigBytes,S=[],T=0;T<D;T++){var F=w[T>>>2]>>>24-T%4*8&255;S.push((F>>>4).toString(16)),S.push((F&15).toString(16))}return S.join("")},parse:function(p){for(var w=p.length,D=[],S=0;S<w;S+=2)D[S>>>3]|=parseInt(p.substr(S,2),16)<<24-S%8*4;return new g.init(D,w/2)}},y=u.Latin1={stringify:function(p){for(var w=p.words,D=p.sigBytes,S=[],T=0;T<D;T++){var F=w[T>>>2]>>>24-T%4*8&255;S.push(String.fromCharCode(F))}return S.join("")},parse:function(p){for(var w=p.length,D=[],S=0;S<w;S++)D[S>>>2]|=(p.charCodeAt(S)&255)<<24-S%4*8;return new g.init(D,w)}},v=u.Utf8={stringify:function(p){try{return decodeURIComponent(escape(y.stringify(p)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(p){return y.parse(unescape(encodeURIComponent(p)))}},_=c.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new g.init,this._nDataBytes=0},_append:function(p){typeof p=="string"&&(p=v.parse(p)),this._data.concat(p),this._nDataBytes+=p.sigBytes},_process:function(p){var w,D=this._data,S=D.words,T=D.sigBytes,F=this.blockSize,h=F*4,M=T/h;p?M=r.ceil(M):M=r.max((M|0)-this._minBufferSize,0);var A=M*F,f=r.min(A*4,T);if(A){for(var C=0;C<A;C+=F)this._doProcessBlock(S,C);w=S.splice(0,A),D.sigBytes-=f}return new g.init(w,f)},clone:function(){var p=d.clone.call(this);return p._data=this._data.clone(),p},_minBufferSize:0});c.Hasher=_.extend({cfg:d.extend(),init:function(p){this.cfg=this.cfg.extend(p),this.reset()},reset:function(){_.reset.call(this),this._doReset()},update:function(p){return this._append(p),this._process(),this},finalize:function(p){p&&this._append(p);var w=this._doFinalize();return w},blockSize:16,_createHelper:function(p){return function(w,D){return new p.init(D).finalize(w)}},_createHmacHelper:function(p){return function(w,D){return new x.HMAC.init(p,D).finalize(w)}}});var x=l.algo={};return l}(Math);return t})}(Ks)),Ks.exports}var Zs={exports:{}},Un;function cs(){return Un||(Un=1,function(s,e){(function(t,r){s.exports=r(se())})(ee,function(t){return function(r){var i=t,n=i.lib,a=n.Base,o=n.WordArray,l=i.x64={};l.Word=a.extend({init:function(c,d){this.high=c,this.low=d}}),l.WordArray=a.extend({init:function(c,d){c=this.words=c||[],d!=r?this.sigBytes=d:this.sigBytes=c.length*8},toX32:function(){for(var c=this.words,d=c.length,g=[],u=0;u<d;u++){var E=c[u];g.push(E.high),g.push(E.low)}return o.create(g,this.sigBytes)},clone:function(){for(var c=a.clone.call(this),d=c.words=this.words.slice(0),g=d.length,u=0;u<g;u++)d[u]=d[u].clone();return c}})}(),t})}(Zs)),Zs.exports}var Js={exports:{}},Ln;function x0(){return Ln||(Ln=1,function(s,e){(function(t,r){s.exports=r(se())})(ee,function(t){return function(){if(typeof ArrayBuffer=="function"){var r=t,i=r.lib,n=i.WordArray,a=n.init,o=n.init=function(l){if(l instanceof ArrayBuffer&&(l=new Uint8Array(l)),(l instanceof Int8Array||typeof Uint8ClampedArray<"u"&&l instanceof Uint8ClampedArray||l instanceof Int16Array||l instanceof Uint16Array||l instanceof Int32Array||l instanceof Uint32Array||l instanceof Float32Array||l instanceof Float64Array)&&(l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength)),l instanceof Uint8Array){for(var c=l.byteLength,d=[],g=0;g<c;g++)d[g>>>2]|=l[g]<<24-g%4*8;a.call(this,d,c)}else a.apply(this,arguments)};o.prototype=n}}(),t.lib.WordArray})}(Js)),Js.exports}var Xs={exports:{}},jn;function p0(){return jn||(jn=1,function(s,e){(function(t,r){s.exports=r(se())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.WordArray,a=r.enc;a.Utf16=a.Utf16BE={stringify:function(l){for(var c=l.words,d=l.sigBytes,g=[],u=0;u<d;u+=2){var E=c[u>>>2]>>>16-u%4*8&65535;g.push(String.fromCharCode(E))}return g.join("")},parse:function(l){for(var c=l.length,d=[],g=0;g<c;g++)d[g>>>1]|=l.charCodeAt(g)<<16-g%2*16;return n.create(d,c*2)}},a.Utf16LE={stringify:function(l){for(var c=l.words,d=l.sigBytes,g=[],u=0;u<d;u+=2){var E=o(c[u>>>2]>>>16-u%4*8&65535);g.push(String.fromCharCode(E))}return g.join("")},parse:function(l){for(var c=l.length,d=[],g=0;g<c;g++)d[g>>>1]|=o(l.charCodeAt(g)<<16-g%2*16);return n.create(d,c*2)}};function o(l){return l<<8&4278255360|l>>>8&16711935}}(),t.enc.Utf16})}(Xs)),Xs.exports}var Qs={exports:{}},Yn;function rr(){return Yn||(Yn=1,function(s,e){(function(t,r){s.exports=r(se())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.WordArray,a=r.enc;a.Base64={stringify:function(l){var c=l.words,d=l.sigBytes,g=this._map;l.clamp();for(var u=[],E=0;E<d;E+=3)for(var y=c[E>>>2]>>>24-E%4*8&255,v=c[E+1>>>2]>>>24-(E+1)%4*8&255,_=c[E+2>>>2]>>>24-(E+2)%4*8&255,x=y<<16|v<<8|_,p=0;p<4&&E+p*.75<d;p++)u.push(g.charAt(x>>>6*(3-p)&63));var w=g.charAt(64);if(w)for(;u.length%4;)u.push(w);return u.join("")},parse:function(l){var c=l.length,d=this._map,g=this._reverseMap;if(!g){g=this._reverseMap=[];for(var u=0;u<d.length;u++)g[d.charCodeAt(u)]=u}var E=d.charAt(64);if(E){var y=l.indexOf(E);y!==-1&&(c=y)}return o(l,c,g)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function o(l,c,d){for(var g=[],u=0,E=0;E<c;E++)if(E%4){var y=d[l.charCodeAt(E-1)]<<E%4*2,v=d[l.charCodeAt(E)]>>>6-E%4*2,_=y|v;g[u>>>2]|=_<<24-u%4*8,u++}return n.create(g,u)}}(),t.enc.Base64})}(Qs)),Qs.exports}var ei={exports:{}},Wn;function m0(){return Wn||(Wn=1,function(s,e){(function(t,r){s.exports=r(se())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.WordArray,a=r.enc;a.Base64url={stringify:function(l,c){c===void 0&&(c=!0);var d=l.words,g=l.sigBytes,u=c?this._safe_map:this._map;l.clamp();for(var E=[],y=0;y<g;y+=3)for(var v=d[y>>>2]>>>24-y%4*8&255,_=d[y+1>>>2]>>>24-(y+1)%4*8&255,x=d[y+2>>>2]>>>24-(y+2)%4*8&255,p=v<<16|_<<8|x,w=0;w<4&&y+w*.75<g;w++)E.push(u.charAt(p>>>6*(3-w)&63));var D=u.charAt(64);if(D)for(;E.length%4;)E.push(D);return E.join("")},parse:function(l,c){c===void 0&&(c=!0);var d=l.length,g=c?this._safe_map:this._map,u=this._reverseMap;if(!u){u=this._reverseMap=[];for(var E=0;E<g.length;E++)u[g.charCodeAt(E)]=E}var y=g.charAt(64);if(y){var v=l.indexOf(y);v!==-1&&(d=v)}return o(l,d,u)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function o(l,c,d){for(var g=[],u=0,E=0;E<c;E++)if(E%4){var y=d[l.charCodeAt(E-1)]<<E%4*2,v=d[l.charCodeAt(E)]>>>6-E%4*2,_=y|v;g[u>>>2]|=_<<24-u%4*8,u++}return n.create(g,u)}}(),t.enc.Base64url})}(ei)),ei.exports}var ti={exports:{}},Gn;function sr(){return Gn||(Gn=1,function(s,e){(function(t,r){s.exports=r(se())})(ee,function(t){return function(r){var i=t,n=i.lib,a=n.WordArray,o=n.Hasher,l=i.algo,c=[];(function(){for(var v=0;v<64;v++)c[v]=r.abs(r.sin(v+1))*4294967296|0})();var d=l.MD5=o.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(v,_){for(var x=0;x<16;x++){var p=_+x,w=v[p];v[p]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360}var D=this._hash.words,S=v[_+0],T=v[_+1],F=v[_+2],h=v[_+3],M=v[_+4],A=v[_+5],f=v[_+6],C=v[_+7],m=v[_+8],q=v[_+9],N=v[_+10],z=v[_+11],G=v[_+12],ie=v[_+13],he=v[_+14],ue=v[_+15],k=D[0],$=D[1],H=D[2],I=D[3];k=g(k,$,H,I,S,7,c[0]),I=g(I,k,$,H,T,12,c[1]),H=g(H,I,k,$,F,17,c[2]),$=g($,H,I,k,h,22,c[3]),k=g(k,$,H,I,M,7,c[4]),I=g(I,k,$,H,A,12,c[5]),H=g(H,I,k,$,f,17,c[6]),$=g($,H,I,k,C,22,c[7]),k=g(k,$,H,I,m,7,c[8]),I=g(I,k,$,H,q,12,c[9]),H=g(H,I,k,$,N,17,c[10]),$=g($,H,I,k,z,22,c[11]),k=g(k,$,H,I,G,7,c[12]),I=g(I,k,$,H,ie,12,c[13]),H=g(H,I,k,$,he,17,c[14]),$=g($,H,I,k,ue,22,c[15]),k=u(k,$,H,I,T,5,c[16]),I=u(I,k,$,H,f,9,c[17]),H=u(H,I,k,$,z,14,c[18]),$=u($,H,I,k,S,20,c[19]),k=u(k,$,H,I,A,5,c[20]),I=u(I,k,$,H,N,9,c[21]),H=u(H,I,k,$,ue,14,c[22]),$=u($,H,I,k,M,20,c[23]),k=u(k,$,H,I,q,5,c[24]),I=u(I,k,$,H,he,9,c[25]),H=u(H,I,k,$,h,14,c[26]),$=u($,H,I,k,m,20,c[27]),k=u(k,$,H,I,ie,5,c[28]),I=u(I,k,$,H,F,9,c[29]),H=u(H,I,k,$,C,14,c[30]),$=u($,H,I,k,G,20,c[31]),k=E(k,$,H,I,A,4,c[32]),I=E(I,k,$,H,m,11,c[33]),H=E(H,I,k,$,z,16,c[34]),$=E($,H,I,k,he,23,c[35]),k=E(k,$,H,I,T,4,c[36]),I=E(I,k,$,H,M,11,c[37]),H=E(H,I,k,$,C,16,c[38]),$=E($,H,I,k,N,23,c[39]),k=E(k,$,H,I,ie,4,c[40]),I=E(I,k,$,H,S,11,c[41]),H=E(H,I,k,$,h,16,c[42]),$=E($,H,I,k,f,23,c[43]),k=E(k,$,H,I,q,4,c[44]),I=E(I,k,$,H,G,11,c[45]),H=E(H,I,k,$,ue,16,c[46]),$=E($,H,I,k,F,23,c[47]),k=y(k,$,H,I,S,6,c[48]),I=y(I,k,$,H,C,10,c[49]),H=y(H,I,k,$,he,15,c[50]),$=y($,H,I,k,A,21,c[51]),k=y(k,$,H,I,G,6,c[52]),I=y(I,k,$,H,h,10,c[53]),H=y(H,I,k,$,N,15,c[54]),$=y($,H,I,k,T,21,c[55]),k=y(k,$,H,I,m,6,c[56]),I=y(I,k,$,H,ue,10,c[57]),H=y(H,I,k,$,f,15,c[58]),$=y($,H,I,k,ie,21,c[59]),k=y(k,$,H,I,M,6,c[60]),I=y(I,k,$,H,z,10,c[61]),H=y(H,I,k,$,F,15,c[62]),$=y($,H,I,k,q,21,c[63]),D[0]=D[0]+k|0,D[1]=D[1]+$|0,D[2]=D[2]+H|0,D[3]=D[3]+I|0},_doFinalize:function(){var v=this._data,_=v.words,x=this._nDataBytes*8,p=v.sigBytes*8;_[p>>>5]|=128<<24-p%32;var w=r.floor(x/4294967296),D=x;_[(p+64>>>9<<4)+15]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,_[(p+64>>>9<<4)+14]=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,v.sigBytes=(_.length+1)*4,this._process();for(var S=this._hash,T=S.words,F=0;F<4;F++){var h=T[F];T[F]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360}return S},clone:function(){var v=o.clone.call(this);return v._hash=this._hash.clone(),v}});function g(v,_,x,p,w,D,S){var T=v+(_&x|~_&p)+w+S;return(T<<D|T>>>32-D)+_}function u(v,_,x,p,w,D,S){var T=v+(_&p|x&~p)+w+S;return(T<<D|T>>>32-D)+_}function E(v,_,x,p,w,D,S){var T=v+(_^x^p)+w+S;return(T<<D|T>>>32-D)+_}function y(v,_,x,p,w,D,S){var T=v+(x^(_|~p))+w+S;return(T<<D|T>>>32-D)+_}i.MD5=o._createHelper(d),i.HmacMD5=o._createHmacHelper(d)}(Math),t.MD5})}(ti)),ti.exports}var ri={exports:{}},Vn;function zn(){return Vn||(Vn=1,function(s,e){(function(t,r){s.exports=r(se())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.WordArray,a=i.Hasher,o=r.algo,l=[],c=o.SHA1=a.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(d,g){for(var u=this._hash.words,E=u[0],y=u[1],v=u[2],_=u[3],x=u[4],p=0;p<80;p++){if(p<16)l[p]=d[g+p]|0;else{var w=l[p-3]^l[p-8]^l[p-14]^l[p-16];l[p]=w<<1|w>>>31}var D=(E<<5|E>>>27)+x+l[p];p<20?D+=(y&v|~y&_)+1518500249:p<40?D+=(y^v^_)+1859775393:p<60?D+=(y&v|y&_|v&_)-1894007588:D+=(y^v^_)-899497514,x=_,_=v,v=y<<30|y>>>2,y=E,E=D}u[0]=u[0]+E|0,u[1]=u[1]+y|0,u[2]=u[2]+v|0,u[3]=u[3]+_|0,u[4]=u[4]+x|0},_doFinalize:function(){var d=this._data,g=d.words,u=this._nDataBytes*8,E=d.sigBytes*8;return g[E>>>5]|=128<<24-E%32,g[(E+64>>>9<<4)+14]=Math.floor(u/4294967296),g[(E+64>>>9<<4)+15]=u,d.sigBytes=g.length*4,this._process(),this._hash},clone:function(){var d=a.clone.call(this);return d._hash=this._hash.clone(),d}});r.SHA1=a._createHelper(c),r.HmacSHA1=a._createHmacHelper(c)}(),t.SHA1})}(ri)),ri.exports}var si={exports:{}},Kn;function ii(){return Kn||(Kn=1,function(s,e){(function(t,r){s.exports=r(se())})(ee,function(t){return function(r){var i=t,n=i.lib,a=n.WordArray,o=n.Hasher,l=i.algo,c=[],d=[];(function(){function E(x){for(var p=r.sqrt(x),w=2;w<=p;w++)if(!(x%w))return!1;return!0}function y(x){return(x-(x|0))*4294967296|0}for(var v=2,_=0;_<64;)E(v)&&(_<8&&(c[_]=y(r.pow(v,1/2))),d[_]=y(r.pow(v,1/3)),_++),v++})();var g=[],u=l.SHA256=o.extend({_doReset:function(){this._hash=new a.init(c.slice(0))},_doProcessBlock:function(E,y){for(var v=this._hash.words,_=v[0],x=v[1],p=v[2],w=v[3],D=v[4],S=v[5],T=v[6],F=v[7],h=0;h<64;h++){if(h<16)g[h]=E[y+h]|0;else{var M=g[h-15],A=(M<<25|M>>>7)^(M<<14|M>>>18)^M>>>3,f=g[h-2],C=(f<<15|f>>>17)^(f<<13|f>>>19)^f>>>10;g[h]=A+g[h-7]+C+g[h-16]}var m=D&S^~D&T,q=_&x^_&p^x&p,N=(_<<30|_>>>2)^(_<<19|_>>>13)^(_<<10|_>>>22),z=(D<<26|D>>>6)^(D<<21|D>>>11)^(D<<7|D>>>25),G=F+z+m+d[h]+g[h],ie=N+q;F=T,T=S,S=D,D=w+G|0,w=p,p=x,x=_,_=G+ie|0}v[0]=v[0]+_|0,v[1]=v[1]+x|0,v[2]=v[2]+p|0,v[3]=v[3]+w|0,v[4]=v[4]+D|0,v[5]=v[5]+S|0,v[6]=v[6]+T|0,v[7]=v[7]+F|0},_doFinalize:function(){var E=this._data,y=E.words,v=this._nDataBytes*8,_=E.sigBytes*8;return y[_>>>5]|=128<<24-_%32,y[(_+64>>>9<<4)+14]=r.floor(v/4294967296),y[(_+64>>>9<<4)+15]=v,E.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var E=o.clone.call(this);return E._hash=this._hash.clone(),E}});i.SHA256=o._createHelper(u),i.HmacSHA256=o._createHmacHelper(u)}(Math),t.SHA256})}(si)),si.exports}var ni={exports:{}},Zn;function v0(){return Zn||(Zn=1,function(s,e){(function(t,r,i){s.exports=r(se(),ii())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.WordArray,a=r.algo,o=a.SHA256,l=a.SHA224=o.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var c=o._doFinalize.call(this);return c.sigBytes-=4,c}});r.SHA224=o._createHelper(l),r.HmacSHA224=o._createHmacHelper(l)}(),t.SHA224})}(ni)),ni.exports}var ai={exports:{}},Jn;function Xn(){return Jn||(Jn=1,function(s,e){(function(t,r,i){s.exports=r(se(),cs())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.Hasher,a=r.x64,o=a.Word,l=a.WordArray,c=r.algo;function d(){return o.create.apply(o,arguments)}var g=[d(1116352408,3609767458),d(1899447441,602891725),d(3049323471,3964484399),d(3921009573,2173295548),d(961987163,4081628472),d(1508970993,3053834265),d(2453635748,2937671579),d(2870763221,3664609560),d(3624381080,2734883394),d(310598401,1164996542),d(607225278,1323610764),d(1426881987,3590304994),d(1925078388,4068182383),d(2162078206,991336113),d(2614888103,633803317),d(3248222580,3479774868),d(3835390401,2666613458),d(4022224774,944711139),d(264347078,2341262773),d(604807628,2007800933),d(770255983,1495990901),d(1249150122,1856431235),d(1555081692,3175218132),d(1996064986,2198950837),d(2554220882,3999719339),d(2821834349,766784016),d(2952996808,2566594879),d(3210313671,3203337956),d(3336571891,1034457026),d(3584528711,2466948901),d(113926993,3758326383),d(338241895,168717936),d(666307205,1188179964),d(773529912,1546045734),d(1294757372,1522805485),d(1396182291,2643833823),d(1695183700,2343527390),d(1986661051,1014477480),d(2177026350,1206759142),d(2456956037,344077627),d(2730485921,1290863460),d(2820302411,3158454273),d(3259730800,3505952657),d(3345764771,106217008),d(3516065817,3606008344),d(3600352804,1432725776),d(4094571909,1467031594),d(275423344,851169720),d(430227734,3100823752),d(506948616,1363258195),d(659060556,3750685593),d(883997877,3785050280),d(958139571,3318307427),d(1322822218,3812723403),d(1537002063,2003034995),d(1747873779,3602036899),d(1955562222,1575990012),d(2024104815,1125592928),d(2227730452,2716904306),d(2361852424,442776044),d(2428436474,593698344),d(2756734187,3733110249),d(3204031479,2999351573),d(3329325298,3815920427),d(3391569614,3928383900),d(3515267271,566280711),d(3940187606,3454069534),d(4118630271,4000239992),d(116418474,1914138554),d(174292421,2731055270),d(289380356,3203993006),d(460393269,320620315),d(685471733,587496836),d(852142971,1086792851),d(1017036298,365543100),d(1126000580,2618297676),d(1288033470,3409855158),d(1501505948,4234509866),d(1607167915,987167468),d(1816402316,1246189591)],u=[];(function(){for(var y=0;y<80;y++)u[y]=d()})();var E=c.SHA512=n.extend({_doReset:function(){this._hash=new l.init([new o.init(1779033703,4089235720),new o.init(3144134277,2227873595),new o.init(1013904242,4271175723),new o.init(2773480762,1595750129),new o.init(1359893119,2917565137),new o.init(2600822924,725511199),new o.init(528734635,4215389547),new o.init(1541459225,327033209)])},_doProcessBlock:function(y,v){for(var _=this._hash.words,x=_[0],p=_[1],w=_[2],D=_[3],S=_[4],T=_[5],F=_[6],h=_[7],M=x.high,A=x.low,f=p.high,C=p.low,m=w.high,q=w.low,N=D.high,z=D.low,G=S.high,ie=S.low,he=T.high,ue=T.low,k=F.high,$=F.low,H=h.high,I=h.low,me=M,fe=A,ke=f,X=C,kt=m,ct=q,zr=N,Gt=z,Ke=G,qe=ie,It=he,dt=ue,dr=k,Vt=$,zt=H,lr=I,Ze=0;Ze<80;Ze++){var Oe,yt,Ar=u[Ze];if(Ze<16)yt=Ar.high=y[v+Ze*2]|0,Oe=Ar.low=y[v+Ze*2+1]|0;else{var Kr=u[Ze-15],$t=Kr.high,Kt=Kr.low,un=($t>>>1|Kt<<31)^($t>>>8|Kt<<24)^$t>>>7,Zr=(Kt>>>1|$t<<31)^(Kt>>>8|$t<<24)^(Kt>>>7|$t<<25),Jr=u[Ze-2],Zt=Jr.high,hr=Jr.low,fn=(Zt>>>19|hr<<13)^(Zt<<3|hr>>>29)^Zt>>>6,Bs=(hr>>>19|Zt<<13)^(hr<<3|Zt>>>29)^(hr>>>6|Zt<<26),ks=u[Ze-7],gn=ks.high,xn=ks.low,Tr=u[Ze-16],Is=Tr.high,Ht=Tr.low;Oe=Zr+xn,yt=un+gn+(Oe>>>0<Zr>>>0?1:0),Oe=Oe+Bs,yt=yt+fn+(Oe>>>0<Bs>>>0?1:0),Oe=Oe+Ht,yt=yt+Is+(Oe>>>0<Ht>>>0?1:0),Ar.high=yt,Ar.low=Oe}var Xr=Ke&It^~Ke&dr,Sr=qe&dt^~qe&Vt,$s=me&ke^me&kt^ke&kt,pn=fe&X^fe&ct^X&ct,Hs=(me>>>28|fe<<4)^(me<<30|fe>>>2)^(me<<25|fe>>>7),Ps=(fe>>>28|me<<4)^(fe<<30|me>>>2)^(fe<<25|me>>>7),Os=(Ke>>>14|qe<<18)^(Ke>>>18|qe<<14)^(Ke<<23|qe>>>9),Ms=(qe>>>14|Ke<<18)^(qe>>>18|Ke<<14)^(qe<<23|Ke>>>9),Ns=g[Ze],mn=Ns.high,Qr=Ns.low,Me=lr+Ms,Et=zt+Os+(Me>>>0<lr>>>0?1:0),Me=Me+Sr,Et=Et+Xr+(Me>>>0<Sr>>>0?1:0),Me=Me+Qr,Et=Et+mn+(Me>>>0<Qr>>>0?1:0),Me=Me+Oe,Et=Et+yt+(Me>>>0<Oe>>>0?1:0),qs=Ps+pn,vn=Hs+$s+(qs>>>0<Ps>>>0?1:0);zt=dr,lr=Vt,dr=It,Vt=dt,It=Ke,dt=qe,qe=Gt+Me|0,Ke=zr+Et+(qe>>>0<Gt>>>0?1:0)|0,zr=kt,Gt=ct,kt=ke,ct=X,ke=me,X=fe,fe=Me+qs|0,me=Et+vn+(fe>>>0<Me>>>0?1:0)|0}A=x.low=A+fe,x.high=M+me+(A>>>0<fe>>>0?1:0),C=p.low=C+X,p.high=f+ke+(C>>>0<X>>>0?1:0),q=w.low=q+ct,w.high=m+kt+(q>>>0<ct>>>0?1:0),z=D.low=z+Gt,D.high=N+zr+(z>>>0<Gt>>>0?1:0),ie=S.low=ie+qe,S.high=G+Ke+(ie>>>0<qe>>>0?1:0),ue=T.low=ue+dt,T.high=he+It+(ue>>>0<dt>>>0?1:0),$=F.low=$+Vt,F.high=k+dr+($>>>0<Vt>>>0?1:0),I=h.low=I+lr,h.high=H+zt+(I>>>0<lr>>>0?1:0)},_doFinalize:function(){var y=this._data,v=y.words,_=this._nDataBytes*8,x=y.sigBytes*8;v[x>>>5]|=128<<24-x%32,v[(x+128>>>10<<5)+30]=Math.floor(_/4294967296),v[(x+128>>>10<<5)+31]=_,y.sigBytes=v.length*4,this._process();var p=this._hash.toX32();return p},clone:function(){var y=n.clone.call(this);return y._hash=this._hash.clone(),y},blockSize:1024/32});r.SHA512=n._createHelper(E),r.HmacSHA512=n._createHmacHelper(E)}(),t.SHA512})}(ai)),ai.exports}var oi={exports:{}},Qn;function y0(){return Qn||(Qn=1,function(s,e){(function(t,r,i){s.exports=r(se(),cs(),Xn())})(ee,function(t){return function(){var r=t,i=r.x64,n=i.Word,a=i.WordArray,o=r.algo,l=o.SHA512,c=o.SHA384=l.extend({_doReset:function(){this._hash=new a.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var d=l._doFinalize.call(this);return d.sigBytes-=16,d}});r.SHA384=l._createHelper(c),r.HmacSHA384=l._createHmacHelper(c)}(),t.SHA384})}(oi)),oi.exports}var ci={exports:{}},ea;function E0(){return ea||(ea=1,function(s,e){(function(t,r,i){s.exports=r(se(),cs())})(ee,function(t){return function(r){var i=t,n=i.lib,a=n.WordArray,o=n.Hasher,l=i.x64,c=l.Word,d=i.algo,g=[],u=[],E=[];(function(){for(var _=1,x=0,p=0;p<24;p++){g[_+5*x]=(p+1)*(p+2)/2%64;var w=x%5,D=(2*_+3*x)%5;_=w,x=D}for(var _=0;_<5;_++)for(var x=0;x<5;x++)u[_+5*x]=x+(2*_+3*x)%5*5;for(var S=1,T=0;T<24;T++){for(var F=0,h=0,M=0;M<7;M++){if(S&1){var A=(1<<M)-1;A<32?h^=1<<A:F^=1<<A-32}S&128?S=S<<1^113:S<<=1}E[T]=c.create(F,h)}})();var y=[];(function(){for(var _=0;_<25;_++)y[_]=c.create()})();var v=d.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){for(var _=this._state=[],x=0;x<25;x++)_[x]=new c.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(_,x){for(var p=this._state,w=this.blockSize/2,D=0;D<w;D++){var S=_[x+2*D],T=_[x+2*D+1];S=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360,T=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360;var F=p[D];F.high^=T,F.low^=S}for(var h=0;h<24;h++){for(var M=0;M<5;M++){for(var A=0,f=0,C=0;C<5;C++){var F=p[M+5*C];A^=F.high,f^=F.low}var m=y[M];m.high=A,m.low=f}for(var M=0;M<5;M++)for(var q=y[(M+4)%5],N=y[(M+1)%5],z=N.high,G=N.low,A=q.high^(z<<1|G>>>31),f=q.low^(G<<1|z>>>31),C=0;C<5;C++){var F=p[M+5*C];F.high^=A,F.low^=f}for(var ie=1;ie<25;ie++){var A,f,F=p[ie],he=F.high,ue=F.low,k=g[ie];k<32?(A=he<<k|ue>>>32-k,f=ue<<k|he>>>32-k):(A=ue<<k-32|he>>>64-k,f=he<<k-32|ue>>>64-k);var $=y[u[ie]];$.high=A,$.low=f}var H=y[0],I=p[0];H.high=I.high,H.low=I.low;for(var M=0;M<5;M++)for(var C=0;C<5;C++){var ie=M+5*C,F=p[ie],me=y[ie],fe=y[(M+1)%5+5*C],ke=y[(M+2)%5+5*C];F.high=me.high^~fe.high&ke.high,F.low=me.low^~fe.low&ke.low}var F=p[0],X=E[h];F.high^=X.high,F.low^=X.low}},_doFinalize:function(){var _=this._data,x=_.words;this._nDataBytes*8;var p=_.sigBytes*8,w=this.blockSize*32;x[p>>>5]|=1<<24-p%32,x[(r.ceil((p+1)/w)*w>>>5)-1]|=128,_.sigBytes=x.length*4,this._process();for(var D=this._state,S=this.cfg.outputLength/8,T=S/8,F=[],h=0;h<T;h++){var M=D[h],A=M.high,f=M.low;A=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360,f=(f<<8|f>>>24)&16711935|(f<<24|f>>>8)&4278255360,F.push(f),F.push(A)}return new a.init(F,S)},clone:function(){for(var _=o.clone.call(this),x=_._state=this._state.slice(0),p=0;p<25;p++)x[p]=x[p].clone();return _}});i.SHA3=o._createHelper(v),i.HmacSHA3=o._createHmacHelper(v)}(Math),t.SHA3})}(ci)),ci.exports}var di={exports:{}},ta;function w0(){return ta||(ta=1,function(s,e){(function(t,r){s.exports=r(se())})(ee,function(t){/** @preserve
|
|
80
|
+
`))}startSendingKeepAlives(){const e=t=>{const r=t*.8;return 1e3*(Math.random()*(t-r)+r)};this.configuration.keepAliveInterval&&!this.keepAliveInterval&&(this.keepAliveInterval=setInterval(()=>{this.sendKeepAlive(),this.startSendingKeepAlives()},e(this.configuration.keepAliveInterval)))}stopSendingKeepAlives(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval),this.keepAliveDebounceTimeout&&clearTimeout(this.keepAliveDebounceTimeout),this.keepAliveInterval=void 0,this.keepAliveDebounceTimeout=void 0}}os.defaultOptions={server:"",connectionTimeout:5,keepAliveInterval:0,keepAliveDebounce:10,traceSip:!0};class tr{constructor(e={}){if(this._publishers={},this._registerers={},this._sessions={},this._subscriptions={},this._state=Ie.Stopped,this._stateEventEmitter=new Ir,this.delegate=e.delegate,this.options=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},tr.defaultOptions()),{sipjsId:Qt(5)}),{uri:new lt("sip","anonymous."+Qt(6),"anonymous.invalid")}),{viaHost:Qt(12)+".invalid"}),tr.stripUndefinedProperties(e)),this.options.hackIpInContact)if(typeof this.options.hackIpInContact=="boolean"&&this.options.hackIpInContact){const i=Math.floor(Math.random()*254+1);this.options.viaHost="192.0.2."+i}else this.options.hackIpInContact&&(this.options.viaHost=this.options.hackIpInContact);switch(this.loggerFactory=new Lo,this.logger=this.loggerFactory.getLogger("sip.UserAgent"),this.loggerFactory.builtinEnabled=this.options.logBuiltinEnabled,this.loggerFactory.connector=this.options.logConnector,this.options.logLevel){case"error":this.loggerFactory.level=Fe.error;break;case"warn":this.loggerFactory.level=Fe.warn;break;case"log":this.loggerFactory.level=Fe.log;break;case"debug":this.loggerFactory.level=Fe.debug;break}if(this.options.logConfiguration&&(this.logger.log("Configuration:"),Object.keys(this.options).forEach(t=>{const r=this.options[t];switch(t){case"uri":case"sessionDescriptionHandlerFactory":this.logger.log("· "+t+": "+r);break;case"authorizationPassword":this.logger.log("· "+t+": NOT SHOWN");break;case"transportConstructor":this.logger.log("· "+t+": "+r.name);break;default:this.logger.log("· "+t+": "+JSON.stringify(r))}})),this.options.transportOptions){const t=this.options.transportOptions,r=t.maxReconnectionAttempts,i=t.reconnectionTimeout;r!==void 0&&this.logger.warn('The transport option "maxReconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),i!==void 0&&this.logger.warn('The transport option "reconnectionTimeout" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),e.reconnectionDelay===void 0&&i!==void 0&&(this.options.reconnectionDelay=i),e.reconnectionAttempts===void 0&&r!==void 0&&(this.options.reconnectionAttempts=r)}if(e.reconnectionDelay!==void 0&&this.logger.warn('The user agent option "reconnectionDelay" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),e.reconnectionAttempts!==void 0&&this.logger.warn('The user agent option "reconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.'),this._transport=new this.options.transportConstructor(this.getLogger("sip.Transport"),this.options.transportOptions),this.initTransportCallbacks(),this._contact=this.initContact(),this._instanceId=this.options.instanceId?this.options.instanceId:tr.newUUID(),Te.parse(this._instanceId,"uuid")===-1)throw new Error("Invalid instanceId.");this._userAgentCore=this.initCore()}static makeURI(e){return Te.URIParse(e)}static defaultOptions(){return{allowLegacyNotifications:!1,authorizationHa1:"",authorizationPassword:"",authorizationUsername:"",delegate:{},contactName:"",contactParams:{transport:"ws"},displayName:"",forceRport:!1,gracefulShutdown:!0,hackAllowUnregisteredOptionTags:!1,hackIpInContact:!1,hackViaTcp:!1,instanceId:"",instanceIdAlwaysAdded:!1,logBuiltinEnabled:!0,logConfiguration:!0,logConnector:()=>{},logLevel:"log",noAnswerTimeout:60,preloadedRouteSet:[],reconnectionAttempts:0,reconnectionDelay:4,sendInitialProvisionalResponse:!0,sessionDescriptionHandlerFactory:h0(),sessionDescriptionHandlerFactoryOptions:{},sipExtension100rel:rt.Unsupported,sipExtensionReplaces:rt.Unsupported,sipExtensionExtraSupported:[],sipjsId:"",transportConstructor:os,transportOptions:{},uri:new lt("sip","anonymous","anonymous.invalid"),userAgentString:"SIP.js/"+So,viaHost:""}}static newUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const r=Math.floor(Math.random()*16);return(t==="x"?r:r%4+8).toString(16)})}static stripUndefinedProperties(e){return Object.keys(e).reduce((t,r)=>(e[r]!==void 0&&(t[r]=e[r]),t),{})}get configuration(){return this.options}get contact(){return this._contact}get instanceId(){return this._instanceId}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get transport(){return this._transport}get userAgentCore(){return this._userAgentCore}getLogger(e,t){return this.loggerFactory.getLogger(e,t)}getLoggerFactory(){return this.loggerFactory}isConnected(){return this.transport.isConnected()}reconnect(){return this.state===Ie.Stopped?Promise.reject(new Error("User agent stopped.")):Promise.resolve().then(()=>this.transport.connect())}start(){return this.state===Ie.Started?(this.logger.warn("User agent already started"),Promise.resolve()):(this.logger.log(`Starting ${this.configuration.uri}`),this.transitionState(Ie.Started),this.transport.connect())}async stop(){if(this.state===Ie.Stopped)return this.logger.warn("User agent already stopped"),Promise.resolve();if(this.logger.log(`Stopping ${this.configuration.uri}`),!this.options.gracefulShutdown)return this.logger.log("Dispose of transport"),this.transport.dispose().catch(o=>{throw this.logger.error(o.message),o}),this.logger.log("Dispose of core"),this.userAgentCore.dispose(),this._publishers={},this._registerers={},this._sessions={},this._subscriptions={},this.transitionState(Ie.Stopped),Promise.resolve();const e=Object.assign({},this._publishers),t=Object.assign({},this._registerers),r=Object.assign({},this._sessions),i=Object.assign({},this._subscriptions),n=this.transport,a=this.userAgentCore;this.logger.log("Dispose of registerers");for(const o in t)t[o]&&await t[o].dispose().catch(l=>{throw this.logger.error(l.message),delete this._registerers[o],l});this.logger.log("Dispose of sessions");for(const o in r)r[o]&&await r[o].dispose().catch(l=>{throw this.logger.error(l.message),delete this._sessions[o],l});this.logger.log("Dispose of subscriptions");for(const o in i)i[o]&&await i[o].dispose().catch(l=>{throw this.logger.error(l.message),delete this._subscriptions[o],l});this.logger.log("Dispose of publishers");for(const o in e)e[o]&&await e[o].dispose().catch(l=>{throw this.logger.error(l.message),delete this._publishers[o],l});this.logger.log("Dispose of transport"),await n.dispose().catch(o=>{throw this.logger.error(o.message),o}),this.logger.log("Dispose of core"),a.dispose(),this.transitionState(Ie.Stopped)}_makeInviter(e,t){return new Rn(this,e,t)}attemptReconnection(e=1){const t=this.options.reconnectionAttempts,r=this.options.reconnectionDelay;if(e>t){this.logger.log("Maximum reconnection attempts reached");return}this.logger.log(`Reconnection attempt ${e} of ${t} - trying`),setTimeout(()=>{this.reconnect().then(()=>{this.logger.log(`Reconnection attempt ${e} of ${t} - succeeded`)}).catch(i=>{this.logger.error(i.message),this.logger.log(`Reconnection attempt ${e} of ${t} - failed`),this.attemptReconnection(++e)})},e===1?0:r*1e3)}initContact(){const e=this.options.contactName!==""?this.options.contactName:Qt(8),t=this.options.contactParams;return{pubGruu:void 0,tempGruu:void 0,uri:new lt("sip",e,this.options.viaHost,void 0,t),toString:(i={})=>{const n=i.anonymous||!1,a=i.outbound||!1,o=i.register||!1;let l="<";return n?l+=this.contact.tempGruu||`sip:anonymous@anonymous.invalid;transport=${t.transport?t.transport:"ws"}`:o?l+=this.contact.uri:l+=this.contact.pubGruu||this.contact.uri,a&&(l+=";ob"),l+=">",this.options.instanceIdAlwaysAdded&&(l+=';+sip.instance="<urn:uuid:'+this._instanceId+'>"'),l}}}initCore(){let e=[];e.push("outbound"),this.options.sipExtension100rel===rt.Supported&&e.push("100rel"),this.options.sipExtensionReplaces===rt.Supported&&e.push("replaces"),this.options.sipExtensionExtraSupported&&e.push(...this.options.sipExtensionExtraSupported),this.options.hackAllowUnregisteredOptionTags||(e=e.filter(n=>No[n])),e=Array.from(new Set(e));const t=e.slice();(this.contact.pubGruu||this.contact.tempGruu)&&t.push("gruu");const r={aor:this.options.uri,contact:this.contact,displayName:this.options.displayName,loggerFactory:this.loggerFactory,hackViaTcp:this.options.hackViaTcp,routeSet:this.options.preloadedRouteSet,supportedOptionTags:e,supportedOptionTagsResponse:t,sipjsId:this.options.sipjsId,userAgentHeaderFieldValue:this.options.userAgentString,viaForceRport:this.options.forceRport,viaHost:this.options.viaHost,authenticationFactory:()=>{const n=this.options.authorizationUsername?this.options.authorizationUsername:this.options.uri.user,a=this.options.authorizationPassword?this.options.authorizationPassword:void 0,o=this.options.authorizationHa1?this.options.authorizationHa1:void 0;return new Uo(this.getLoggerFactory(),o,n,a)},transportAccessor:()=>this.transport},i={onInvite:n=>{var a;const o=new qo(this,n);if(n.delegate={onCancel:l=>{o._onCancel(l)},onTransportError:l=>{this.logger.error("A transport error has occurred while handling an incoming INVITE request.")}},n.trying(),this.options.sipExtensionReplaces!==rt.Unsupported){const c=n.message.parseHeader("replaces");if(c){const d=c.call_id;if(typeof d!="string")throw new Error("Type of call id is not string");const g=c.replaces_to_tag;if(typeof g!="string")throw new Error("Type of to tag is not string");const u=c.replaces_from_tag;if(typeof u!="string")throw new Error("type of from tag is not string");const y=d+g+u,E=this.userAgentCore.dialogs.get(y);if(!E){o.reject({statusCode:481});return}if(!E.early&&c.early_only===!0){o.reject({statusCode:486});return}const v=this._sessions[d+u]||this._sessions[d+g]||void 0;if(!v)throw new Error("Session does not exist.");o._replacee=v}}if(!((a=this.delegate)===null||a===void 0)&&a.onInvite){if(o.autoSendAnInitialProvisionalResponse){o.progress().then(()=>{var l;if(((l=this.delegate)===null||l===void 0?void 0:l.onInvite)===void 0)throw new Error("onInvite undefined.");this.delegate.onInvite(o)});return}this.delegate.onInvite(o);return}o.reject({statusCode:486})},onMessage:n=>{if(this.delegate&&this.delegate.onMessage){const a=new Sn(n);this.delegate.onMessage(a)}else n.accept()},onNotify:n=>{if(this.delegate&&this.delegate.onNotify){const a=new Gs(n);this.delegate.onNotify(a)}else this.options.allowLegacyNotifications?n.accept():n.reject({statusCode:481})},onRefer:n=>{this.logger.warn("Received an out of dialog REFER request"),this.delegate&&this.delegate.onReferRequest?this.delegate.onReferRequest(n):n.reject({statusCode:405})},onRegister:n=>{this.logger.warn("Received an out of dialog REGISTER request"),this.delegate&&this.delegate.onRegisterRequest?this.delegate.onRegisterRequest(n):n.reject({statusCode:405})},onSubscribe:n=>{this.logger.warn("Received an out of dialog SUBSCRIBE request"),this.delegate&&this.delegate.onSubscribeRequest?this.delegate.onSubscribeRequest(n):n.reject({statusCode:405})}};return new c0(r,i)}initTransportCallbacks(){this.transport.onConnect=()=>this.onTransportConnect(),this.transport.onDisconnect=e=>this.onTransportDisconnect(e),this.transport.onMessage=e=>this.onTransportMessage(e)}onTransportConnect(){this.state!==Ie.Stopped&&this.delegate&&this.delegate.onConnect&&this.delegate.onConnect()}onTransportDisconnect(e){this.state!==Ie.Stopped&&(this.delegate&&this.delegate.onDisconnect&&this.delegate.onDisconnect(e),e&&this.options.reconnectionAttempts>0&&this.attemptReconnection())}onTransportMessage(e){const t=ss.parseMessage(e,this.getLogger("sip.Parser"));if(!t){this.logger.warn("Failed to parse incoming message. Dropping.");return}if(this.state===Ie.Stopped&&t instanceof gr){this.logger.warn(`Received ${t.method} request while stopped. Dropping.`);return}const r=()=>{const i=["from","to","call_id","cseq","via"];for(const n of i)if(!t.hasHeader(n))return this.logger.warn(`Missing mandatory header field : ${n}.`),!1;return!0};if(t instanceof gr){if(!r()){this.logger.warn("Request missing mandatory header field. Dropping.");return}if(!t.toTag&&t.callId.substr(0,5)===this.options.sipjsId){this.userAgentCore.replyStateless(t,{statusCode:482});return}const i=$r(t.body),n=t.getHeader("content-length");if(n&&i<Number(n)){this.userAgentCore.replyStateless(t,{statusCode:400});return}}if(t instanceof Pt){if(!r()){this.logger.warn("Response missing mandatory header field. Dropping.");return}if(t.getHeaders("via").length>1){this.logger.warn("More than one Via header field present in the response. Dropping.");return}if(t.via.host!==this.options.viaHost||t.via.port!==void 0){this.logger.warn("Via sent-by in the response does not match UA Via host value. Dropping.");return}const i=$r(t.body),n=t.getHeader("content-length");if(n&&i<Number(n)){this.logger.warn("Message body length is lower than the value in Content-Length header field. Dropping.");return}}if(t instanceof gr){this.userAgentCore.receiveIncomingRequestFromTransport(t);return}if(t instanceof Pt){this.userAgentCore.receiveIncomingResponseFromTransport(t);return}throw new Error("Invalid message type.")}transitionState(e,t){const r=()=>{throw new Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case Ie.Started:e!==Ie.Stopped&&r();break;case Ie.Stopped:e!==Ie.Started&&r();break;default:throw new Error("Unknown state.")}this.logger.log(`Transitioned from ${this._state} to ${e}`),this._state=e,this._stateEventEmitter.emit(this._state)}}var Nn={exports:{}};function u0(s){throw new Error('Could not dynamically require "'+s+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ks={exports:{}};const f0=bo(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var qn;function se(){return qn||(qn=1,function(s,e){(function(t,r){s.exports=r()})(ee,function(){var t=t||function(r,i){var n;if(typeof window<"u"&&window.crypto&&(n=window.crypto),typeof self<"u"&&self.crypto&&(n=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(n=globalThis.crypto),!n&&typeof window<"u"&&window.msCrypto&&(n=window.msCrypto),!n&&typeof ee<"u"&&ee.crypto&&(n=ee.crypto),!n&&typeof u0=="function")try{n=f0}catch{}var a=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function p(){}return function(w){var D;return p.prototype=w,D=new p,p.prototype=null,D}}(),l={},c=l.lib={},d=c.Base=function(){return{extend:function(p){var w=o(this);return p&&w.mixIn(p),(!w.hasOwnProperty("init")||this.init===w.init)&&(w.init=function(){w.$super.init.apply(this,arguments)}),w.init.prototype=w,w.$super=this,w},create:function(){var p=this.extend();return p.init.apply(p,arguments),p},init:function(){},mixIn:function(p){for(var w in p)p.hasOwnProperty(w)&&(this[w]=p[w]);p.hasOwnProperty("toString")&&(this.toString=p.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),g=c.WordArray=d.extend({init:function(p,w){p=this.words=p||[],w!=i?this.sigBytes=w:this.sigBytes=p.length*4},toString:function(p){return(p||y).stringify(this)},concat:function(p){var w=this.words,D=p.words,S=this.sigBytes,T=p.sigBytes;if(this.clamp(),S%4)for(var F=0;F<T;F++){var h=D[F>>>2]>>>24-F%4*8&255;w[S+F>>>2]|=h<<24-(S+F)%4*8}else for(var M=0;M<T;M+=4)w[S+M>>>2]=D[M>>>2];return this.sigBytes+=T,this},clamp:function(){var p=this.words,w=this.sigBytes;p[w>>>2]&=4294967295<<32-w%4*8,p.length=r.ceil(w/4)},clone:function(){var p=d.clone.call(this);return p.words=this.words.slice(0),p},random:function(p){for(var w=[],D=0;D<p;D+=4)w.push(a());return new g.init(w,p)}}),u=l.enc={},y=u.Hex={stringify:function(p){for(var w=p.words,D=p.sigBytes,S=[],T=0;T<D;T++){var F=w[T>>>2]>>>24-T%4*8&255;S.push((F>>>4).toString(16)),S.push((F&15).toString(16))}return S.join("")},parse:function(p){for(var w=p.length,D=[],S=0;S<w;S+=2)D[S>>>3]|=parseInt(p.substr(S,2),16)<<24-S%8*4;return new g.init(D,w/2)}},E=u.Latin1={stringify:function(p){for(var w=p.words,D=p.sigBytes,S=[],T=0;T<D;T++){var F=w[T>>>2]>>>24-T%4*8&255;S.push(String.fromCharCode(F))}return S.join("")},parse:function(p){for(var w=p.length,D=[],S=0;S<w;S++)D[S>>>2]|=(p.charCodeAt(S)&255)<<24-S%4*8;return new g.init(D,w)}},v=u.Utf8={stringify:function(p){try{return decodeURIComponent(escape(E.stringify(p)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(p){return E.parse(unescape(encodeURIComponent(p)))}},_=c.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new g.init,this._nDataBytes=0},_append:function(p){typeof p=="string"&&(p=v.parse(p)),this._data.concat(p),this._nDataBytes+=p.sigBytes},_process:function(p){var w,D=this._data,S=D.words,T=D.sigBytes,F=this.blockSize,h=F*4,M=T/h;p?M=r.ceil(M):M=r.max((M|0)-this._minBufferSize,0);var A=M*F,f=r.min(A*4,T);if(A){for(var C=0;C<A;C+=F)this._doProcessBlock(S,C);w=S.splice(0,A),D.sigBytes-=f}return new g.init(w,f)},clone:function(){var p=d.clone.call(this);return p._data=this._data.clone(),p},_minBufferSize:0});c.Hasher=_.extend({cfg:d.extend(),init:function(p){this.cfg=this.cfg.extend(p),this.reset()},reset:function(){_.reset.call(this),this._doReset()},update:function(p){return this._append(p),this._process(),this},finalize:function(p){p&&this._append(p);var w=this._doFinalize();return w},blockSize:16,_createHelper:function(p){return function(w,D){return new p.init(D).finalize(w)}},_createHmacHelper:function(p){return function(w,D){return new x.HMAC.init(p,D).finalize(w)}}});var x=l.algo={};return l}(Math);return t})}(Ks)),Ks.exports}var Zs={exports:{}},Un;function cs(){return Un||(Un=1,function(s,e){(function(t,r){s.exports=r(se())})(ee,function(t){return function(r){var i=t,n=i.lib,a=n.Base,o=n.WordArray,l=i.x64={};l.Word=a.extend({init:function(c,d){this.high=c,this.low=d}}),l.WordArray=a.extend({init:function(c,d){c=this.words=c||[],d!=r?this.sigBytes=d:this.sigBytes=c.length*8},toX32:function(){for(var c=this.words,d=c.length,g=[],u=0;u<d;u++){var y=c[u];g.push(y.high),g.push(y.low)}return o.create(g,this.sigBytes)},clone:function(){for(var c=a.clone.call(this),d=c.words=this.words.slice(0),g=d.length,u=0;u<g;u++)d[u]=d[u].clone();return c}})}(),t})}(Zs)),Zs.exports}var Js={exports:{}},Ln;function g0(){return Ln||(Ln=1,function(s,e){(function(t,r){s.exports=r(se())})(ee,function(t){return function(){if(typeof ArrayBuffer=="function"){var r=t,i=r.lib,n=i.WordArray,a=n.init,o=n.init=function(l){if(l instanceof ArrayBuffer&&(l=new Uint8Array(l)),(l instanceof Int8Array||typeof Uint8ClampedArray<"u"&&l instanceof Uint8ClampedArray||l instanceof Int16Array||l instanceof Uint16Array||l instanceof Int32Array||l instanceof Uint32Array||l instanceof Float32Array||l instanceof Float64Array)&&(l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength)),l instanceof Uint8Array){for(var c=l.byteLength,d=[],g=0;g<c;g++)d[g>>>2]|=l[g]<<24-g%4*8;a.call(this,d,c)}else a.apply(this,arguments)};o.prototype=n}}(),t.lib.WordArray})}(Js)),Js.exports}var Xs={exports:{}},jn;function x0(){return jn||(jn=1,function(s,e){(function(t,r){s.exports=r(se())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.WordArray,a=r.enc;a.Utf16=a.Utf16BE={stringify:function(l){for(var c=l.words,d=l.sigBytes,g=[],u=0;u<d;u+=2){var y=c[u>>>2]>>>16-u%4*8&65535;g.push(String.fromCharCode(y))}return g.join("")},parse:function(l){for(var c=l.length,d=[],g=0;g<c;g++)d[g>>>1]|=l.charCodeAt(g)<<16-g%2*16;return n.create(d,c*2)}},a.Utf16LE={stringify:function(l){for(var c=l.words,d=l.sigBytes,g=[],u=0;u<d;u+=2){var y=o(c[u>>>2]>>>16-u%4*8&65535);g.push(String.fromCharCode(y))}return g.join("")},parse:function(l){for(var c=l.length,d=[],g=0;g<c;g++)d[g>>>1]|=o(l.charCodeAt(g)<<16-g%2*16);return n.create(d,c*2)}};function o(l){return l<<8&4278255360|l>>>8&16711935}}(),t.enc.Utf16})}(Xs)),Xs.exports}var Qs={exports:{}},Yn;function rr(){return Yn||(Yn=1,function(s,e){(function(t,r){s.exports=r(se())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.WordArray,a=r.enc;a.Base64={stringify:function(l){var c=l.words,d=l.sigBytes,g=this._map;l.clamp();for(var u=[],y=0;y<d;y+=3)for(var E=c[y>>>2]>>>24-y%4*8&255,v=c[y+1>>>2]>>>24-(y+1)%4*8&255,_=c[y+2>>>2]>>>24-(y+2)%4*8&255,x=E<<16|v<<8|_,p=0;p<4&&y+p*.75<d;p++)u.push(g.charAt(x>>>6*(3-p)&63));var w=g.charAt(64);if(w)for(;u.length%4;)u.push(w);return u.join("")},parse:function(l){var c=l.length,d=this._map,g=this._reverseMap;if(!g){g=this._reverseMap=[];for(var u=0;u<d.length;u++)g[d.charCodeAt(u)]=u}var y=d.charAt(64);if(y){var E=l.indexOf(y);E!==-1&&(c=E)}return o(l,c,g)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function o(l,c,d){for(var g=[],u=0,y=0;y<c;y++)if(y%4){var E=d[l.charCodeAt(y-1)]<<y%4*2,v=d[l.charCodeAt(y)]>>>6-y%4*2,_=E|v;g[u>>>2]|=_<<24-u%4*8,u++}return n.create(g,u)}}(),t.enc.Base64})}(Qs)),Qs.exports}var ei={exports:{}},Wn;function p0(){return Wn||(Wn=1,function(s,e){(function(t,r){s.exports=r(se())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.WordArray,a=r.enc;a.Base64url={stringify:function(l,c){c===void 0&&(c=!0);var d=l.words,g=l.sigBytes,u=c?this._safe_map:this._map;l.clamp();for(var y=[],E=0;E<g;E+=3)for(var v=d[E>>>2]>>>24-E%4*8&255,_=d[E+1>>>2]>>>24-(E+1)%4*8&255,x=d[E+2>>>2]>>>24-(E+2)%4*8&255,p=v<<16|_<<8|x,w=0;w<4&&E+w*.75<g;w++)y.push(u.charAt(p>>>6*(3-w)&63));var D=u.charAt(64);if(D)for(;y.length%4;)y.push(D);return y.join("")},parse:function(l,c){c===void 0&&(c=!0);var d=l.length,g=c?this._safe_map:this._map,u=this._reverseMap;if(!u){u=this._reverseMap=[];for(var y=0;y<g.length;y++)u[g.charCodeAt(y)]=y}var E=g.charAt(64);if(E){var v=l.indexOf(E);v!==-1&&(d=v)}return o(l,d,u)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function o(l,c,d){for(var g=[],u=0,y=0;y<c;y++)if(y%4){var E=d[l.charCodeAt(y-1)]<<y%4*2,v=d[l.charCodeAt(y)]>>>6-y%4*2,_=E|v;g[u>>>2]|=_<<24-u%4*8,u++}return n.create(g,u)}}(),t.enc.Base64url})}(ei)),ei.exports}var ti={exports:{}},Gn;function sr(){return Gn||(Gn=1,function(s,e){(function(t,r){s.exports=r(se())})(ee,function(t){return function(r){var i=t,n=i.lib,a=n.WordArray,o=n.Hasher,l=i.algo,c=[];(function(){for(var v=0;v<64;v++)c[v]=r.abs(r.sin(v+1))*4294967296|0})();var d=l.MD5=o.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(v,_){for(var x=0;x<16;x++){var p=_+x,w=v[p];v[p]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360}var D=this._hash.words,S=v[_+0],T=v[_+1],F=v[_+2],h=v[_+3],M=v[_+4],A=v[_+5],f=v[_+6],C=v[_+7],m=v[_+8],q=v[_+9],N=v[_+10],z=v[_+11],G=v[_+12],ie=v[_+13],he=v[_+14],ue=v[_+15],k=D[0],$=D[1],H=D[2],I=D[3];k=g(k,$,H,I,S,7,c[0]),I=g(I,k,$,H,T,12,c[1]),H=g(H,I,k,$,F,17,c[2]),$=g($,H,I,k,h,22,c[3]),k=g(k,$,H,I,M,7,c[4]),I=g(I,k,$,H,A,12,c[5]),H=g(H,I,k,$,f,17,c[6]),$=g($,H,I,k,C,22,c[7]),k=g(k,$,H,I,m,7,c[8]),I=g(I,k,$,H,q,12,c[9]),H=g(H,I,k,$,N,17,c[10]),$=g($,H,I,k,z,22,c[11]),k=g(k,$,H,I,G,7,c[12]),I=g(I,k,$,H,ie,12,c[13]),H=g(H,I,k,$,he,17,c[14]),$=g($,H,I,k,ue,22,c[15]),k=u(k,$,H,I,T,5,c[16]),I=u(I,k,$,H,f,9,c[17]),H=u(H,I,k,$,z,14,c[18]),$=u($,H,I,k,S,20,c[19]),k=u(k,$,H,I,A,5,c[20]),I=u(I,k,$,H,N,9,c[21]),H=u(H,I,k,$,ue,14,c[22]),$=u($,H,I,k,M,20,c[23]),k=u(k,$,H,I,q,5,c[24]),I=u(I,k,$,H,he,9,c[25]),H=u(H,I,k,$,h,14,c[26]),$=u($,H,I,k,m,20,c[27]),k=u(k,$,H,I,ie,5,c[28]),I=u(I,k,$,H,F,9,c[29]),H=u(H,I,k,$,C,14,c[30]),$=u($,H,I,k,G,20,c[31]),k=y(k,$,H,I,A,4,c[32]),I=y(I,k,$,H,m,11,c[33]),H=y(H,I,k,$,z,16,c[34]),$=y($,H,I,k,he,23,c[35]),k=y(k,$,H,I,T,4,c[36]),I=y(I,k,$,H,M,11,c[37]),H=y(H,I,k,$,C,16,c[38]),$=y($,H,I,k,N,23,c[39]),k=y(k,$,H,I,ie,4,c[40]),I=y(I,k,$,H,S,11,c[41]),H=y(H,I,k,$,h,16,c[42]),$=y($,H,I,k,f,23,c[43]),k=y(k,$,H,I,q,4,c[44]),I=y(I,k,$,H,G,11,c[45]),H=y(H,I,k,$,ue,16,c[46]),$=y($,H,I,k,F,23,c[47]),k=E(k,$,H,I,S,6,c[48]),I=E(I,k,$,H,C,10,c[49]),H=E(H,I,k,$,he,15,c[50]),$=E($,H,I,k,A,21,c[51]),k=E(k,$,H,I,G,6,c[52]),I=E(I,k,$,H,h,10,c[53]),H=E(H,I,k,$,N,15,c[54]),$=E($,H,I,k,T,21,c[55]),k=E(k,$,H,I,m,6,c[56]),I=E(I,k,$,H,ue,10,c[57]),H=E(H,I,k,$,f,15,c[58]),$=E($,H,I,k,ie,21,c[59]),k=E(k,$,H,I,M,6,c[60]),I=E(I,k,$,H,z,10,c[61]),H=E(H,I,k,$,F,15,c[62]),$=E($,H,I,k,q,21,c[63]),D[0]=D[0]+k|0,D[1]=D[1]+$|0,D[2]=D[2]+H|0,D[3]=D[3]+I|0},_doFinalize:function(){var v=this._data,_=v.words,x=this._nDataBytes*8,p=v.sigBytes*8;_[p>>>5]|=128<<24-p%32;var w=r.floor(x/4294967296),D=x;_[(p+64>>>9<<4)+15]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,_[(p+64>>>9<<4)+14]=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,v.sigBytes=(_.length+1)*4,this._process();for(var S=this._hash,T=S.words,F=0;F<4;F++){var h=T[F];T[F]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360}return S},clone:function(){var v=o.clone.call(this);return v._hash=this._hash.clone(),v}});function g(v,_,x,p,w,D,S){var T=v+(_&x|~_&p)+w+S;return(T<<D|T>>>32-D)+_}function u(v,_,x,p,w,D,S){var T=v+(_&p|x&~p)+w+S;return(T<<D|T>>>32-D)+_}function y(v,_,x,p,w,D,S){var T=v+(_^x^p)+w+S;return(T<<D|T>>>32-D)+_}function E(v,_,x,p,w,D,S){var T=v+(x^(_|~p))+w+S;return(T<<D|T>>>32-D)+_}i.MD5=o._createHelper(d),i.HmacMD5=o._createHmacHelper(d)}(Math),t.MD5})}(ti)),ti.exports}var ri={exports:{}},Vn;function zn(){return Vn||(Vn=1,function(s,e){(function(t,r){s.exports=r(se())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.WordArray,a=i.Hasher,o=r.algo,l=[],c=o.SHA1=a.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(d,g){for(var u=this._hash.words,y=u[0],E=u[1],v=u[2],_=u[3],x=u[4],p=0;p<80;p++){if(p<16)l[p]=d[g+p]|0;else{var w=l[p-3]^l[p-8]^l[p-14]^l[p-16];l[p]=w<<1|w>>>31}var D=(y<<5|y>>>27)+x+l[p];p<20?D+=(E&v|~E&_)+1518500249:p<40?D+=(E^v^_)+1859775393:p<60?D+=(E&v|E&_|v&_)-1894007588:D+=(E^v^_)-899497514,x=_,_=v,v=E<<30|E>>>2,E=y,y=D}u[0]=u[0]+y|0,u[1]=u[1]+E|0,u[2]=u[2]+v|0,u[3]=u[3]+_|0,u[4]=u[4]+x|0},_doFinalize:function(){var d=this._data,g=d.words,u=this._nDataBytes*8,y=d.sigBytes*8;return g[y>>>5]|=128<<24-y%32,g[(y+64>>>9<<4)+14]=Math.floor(u/4294967296),g[(y+64>>>9<<4)+15]=u,d.sigBytes=g.length*4,this._process(),this._hash},clone:function(){var d=a.clone.call(this);return d._hash=this._hash.clone(),d}});r.SHA1=a._createHelper(c),r.HmacSHA1=a._createHmacHelper(c)}(),t.SHA1})}(ri)),ri.exports}var si={exports:{}},Kn;function ii(){return Kn||(Kn=1,function(s,e){(function(t,r){s.exports=r(se())})(ee,function(t){return function(r){var i=t,n=i.lib,a=n.WordArray,o=n.Hasher,l=i.algo,c=[],d=[];(function(){function y(x){for(var p=r.sqrt(x),w=2;w<=p;w++)if(!(x%w))return!1;return!0}function E(x){return(x-(x|0))*4294967296|0}for(var v=2,_=0;_<64;)y(v)&&(_<8&&(c[_]=E(r.pow(v,1/2))),d[_]=E(r.pow(v,1/3)),_++),v++})();var g=[],u=l.SHA256=o.extend({_doReset:function(){this._hash=new a.init(c.slice(0))},_doProcessBlock:function(y,E){for(var v=this._hash.words,_=v[0],x=v[1],p=v[2],w=v[3],D=v[4],S=v[5],T=v[6],F=v[7],h=0;h<64;h++){if(h<16)g[h]=y[E+h]|0;else{var M=g[h-15],A=(M<<25|M>>>7)^(M<<14|M>>>18)^M>>>3,f=g[h-2],C=(f<<15|f>>>17)^(f<<13|f>>>19)^f>>>10;g[h]=A+g[h-7]+C+g[h-16]}var m=D&S^~D&T,q=_&x^_&p^x&p,N=(_<<30|_>>>2)^(_<<19|_>>>13)^(_<<10|_>>>22),z=(D<<26|D>>>6)^(D<<21|D>>>11)^(D<<7|D>>>25),G=F+z+m+d[h]+g[h],ie=N+q;F=T,T=S,S=D,D=w+G|0,w=p,p=x,x=_,_=G+ie|0}v[0]=v[0]+_|0,v[1]=v[1]+x|0,v[2]=v[2]+p|0,v[3]=v[3]+w|0,v[4]=v[4]+D|0,v[5]=v[5]+S|0,v[6]=v[6]+T|0,v[7]=v[7]+F|0},_doFinalize:function(){var y=this._data,E=y.words,v=this._nDataBytes*8,_=y.sigBytes*8;return E[_>>>5]|=128<<24-_%32,E[(_+64>>>9<<4)+14]=r.floor(v/4294967296),E[(_+64>>>9<<4)+15]=v,y.sigBytes=E.length*4,this._process(),this._hash},clone:function(){var y=o.clone.call(this);return y._hash=this._hash.clone(),y}});i.SHA256=o._createHelper(u),i.HmacSHA256=o._createHmacHelper(u)}(Math),t.SHA256})}(si)),si.exports}var ni={exports:{}},Zn;function m0(){return Zn||(Zn=1,function(s,e){(function(t,r,i){s.exports=r(se(),ii())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.WordArray,a=r.algo,o=a.SHA256,l=a.SHA224=o.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var c=o._doFinalize.call(this);return c.sigBytes-=4,c}});r.SHA224=o._createHelper(l),r.HmacSHA224=o._createHmacHelper(l)}(),t.SHA224})}(ni)),ni.exports}var ai={exports:{}},Jn;function Xn(){return Jn||(Jn=1,function(s,e){(function(t,r,i){s.exports=r(se(),cs())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.Hasher,a=r.x64,o=a.Word,l=a.WordArray,c=r.algo;function d(){return o.create.apply(o,arguments)}var g=[d(1116352408,3609767458),d(1899447441,602891725),d(3049323471,3964484399),d(3921009573,2173295548),d(961987163,4081628472),d(1508970993,3053834265),d(2453635748,2937671579),d(2870763221,3664609560),d(3624381080,2734883394),d(310598401,1164996542),d(607225278,1323610764),d(1426881987,3590304994),d(1925078388,4068182383),d(2162078206,991336113),d(2614888103,633803317),d(3248222580,3479774868),d(3835390401,2666613458),d(4022224774,944711139),d(264347078,2341262773),d(604807628,2007800933),d(770255983,1495990901),d(1249150122,1856431235),d(1555081692,3175218132),d(1996064986,2198950837),d(2554220882,3999719339),d(2821834349,766784016),d(2952996808,2566594879),d(3210313671,3203337956),d(3336571891,1034457026),d(3584528711,2466948901),d(113926993,3758326383),d(338241895,168717936),d(666307205,1188179964),d(773529912,1546045734),d(1294757372,1522805485),d(1396182291,2643833823),d(1695183700,2343527390),d(1986661051,1014477480),d(2177026350,1206759142),d(2456956037,344077627),d(2730485921,1290863460),d(2820302411,3158454273),d(3259730800,3505952657),d(3345764771,106217008),d(3516065817,3606008344),d(3600352804,1432725776),d(4094571909,1467031594),d(275423344,851169720),d(430227734,3100823752),d(506948616,1363258195),d(659060556,3750685593),d(883997877,3785050280),d(958139571,3318307427),d(1322822218,3812723403),d(1537002063,2003034995),d(1747873779,3602036899),d(1955562222,1575990012),d(2024104815,1125592928),d(2227730452,2716904306),d(2361852424,442776044),d(2428436474,593698344),d(2756734187,3733110249),d(3204031479,2999351573),d(3329325298,3815920427),d(3391569614,3928383900),d(3515267271,566280711),d(3940187606,3454069534),d(4118630271,4000239992),d(116418474,1914138554),d(174292421,2731055270),d(289380356,3203993006),d(460393269,320620315),d(685471733,587496836),d(852142971,1086792851),d(1017036298,365543100),d(1126000580,2618297676),d(1288033470,3409855158),d(1501505948,4234509866),d(1607167915,987167468),d(1816402316,1246189591)],u=[];(function(){for(var E=0;E<80;E++)u[E]=d()})();var y=c.SHA512=n.extend({_doReset:function(){this._hash=new l.init([new o.init(1779033703,4089235720),new o.init(3144134277,2227873595),new o.init(1013904242,4271175723),new o.init(2773480762,1595750129),new o.init(1359893119,2917565137),new o.init(2600822924,725511199),new o.init(528734635,4215389547),new o.init(1541459225,327033209)])},_doProcessBlock:function(E,v){for(var _=this._hash.words,x=_[0],p=_[1],w=_[2],D=_[3],S=_[4],T=_[5],F=_[6],h=_[7],M=x.high,A=x.low,f=p.high,C=p.low,m=w.high,q=w.low,N=D.high,z=D.low,G=S.high,ie=S.low,he=T.high,ue=T.low,k=F.high,$=F.low,H=h.high,I=h.low,me=M,fe=A,ke=f,X=C,kt=m,ct=q,zr=N,Gt=z,Ke=G,qe=ie,It=he,dt=ue,dr=k,Vt=$,zt=H,lr=I,Ze=0;Ze<80;Ze++){var Oe,Et,Ar=u[Ze];if(Ze<16)Et=Ar.high=E[v+Ze*2]|0,Oe=Ar.low=E[v+Ze*2+1]|0;else{var Kr=u[Ze-15],$t=Kr.high,Kt=Kr.low,un=($t>>>1|Kt<<31)^($t>>>8|Kt<<24)^$t>>>7,Zr=(Kt>>>1|$t<<31)^(Kt>>>8|$t<<24)^(Kt>>>7|$t<<25),Jr=u[Ze-2],Zt=Jr.high,hr=Jr.low,fn=(Zt>>>19|hr<<13)^(Zt<<3|hr>>>29)^Zt>>>6,Bs=(hr>>>19|Zt<<13)^(hr<<3|Zt>>>29)^(hr>>>6|Zt<<26),ks=u[Ze-7],gn=ks.high,xn=ks.low,Tr=u[Ze-16],Is=Tr.high,Ht=Tr.low;Oe=Zr+xn,Et=un+gn+(Oe>>>0<Zr>>>0?1:0),Oe=Oe+Bs,Et=Et+fn+(Oe>>>0<Bs>>>0?1:0),Oe=Oe+Ht,Et=Et+Is+(Oe>>>0<Ht>>>0?1:0),Ar.high=Et,Ar.low=Oe}var Xr=Ke&It^~Ke&dr,Sr=qe&dt^~qe&Vt,$s=me&ke^me&kt^ke&kt,pn=fe&X^fe&ct^X&ct,Hs=(me>>>28|fe<<4)^(me<<30|fe>>>2)^(me<<25|fe>>>7),Ps=(fe>>>28|me<<4)^(fe<<30|me>>>2)^(fe<<25|me>>>7),Os=(Ke>>>14|qe<<18)^(Ke>>>18|qe<<14)^(Ke<<23|qe>>>9),Ms=(qe>>>14|Ke<<18)^(qe>>>18|Ke<<14)^(qe<<23|Ke>>>9),Ns=g[Ze],mn=Ns.high,Qr=Ns.low,Me=lr+Ms,yt=zt+Os+(Me>>>0<lr>>>0?1:0),Me=Me+Sr,yt=yt+Xr+(Me>>>0<Sr>>>0?1:0),Me=Me+Qr,yt=yt+mn+(Me>>>0<Qr>>>0?1:0),Me=Me+Oe,yt=yt+Et+(Me>>>0<Oe>>>0?1:0),qs=Ps+pn,vn=Hs+$s+(qs>>>0<Ps>>>0?1:0);zt=dr,lr=Vt,dr=It,Vt=dt,It=Ke,dt=qe,qe=Gt+Me|0,Ke=zr+yt+(qe>>>0<Gt>>>0?1:0)|0,zr=kt,Gt=ct,kt=ke,ct=X,ke=me,X=fe,fe=Me+qs|0,me=yt+vn+(fe>>>0<Me>>>0?1:0)|0}A=x.low=A+fe,x.high=M+me+(A>>>0<fe>>>0?1:0),C=p.low=C+X,p.high=f+ke+(C>>>0<X>>>0?1:0),q=w.low=q+ct,w.high=m+kt+(q>>>0<ct>>>0?1:0),z=D.low=z+Gt,D.high=N+zr+(z>>>0<Gt>>>0?1:0),ie=S.low=ie+qe,S.high=G+Ke+(ie>>>0<qe>>>0?1:0),ue=T.low=ue+dt,T.high=he+It+(ue>>>0<dt>>>0?1:0),$=F.low=$+Vt,F.high=k+dr+($>>>0<Vt>>>0?1:0),I=h.low=I+lr,h.high=H+zt+(I>>>0<lr>>>0?1:0)},_doFinalize:function(){var E=this._data,v=E.words,_=this._nDataBytes*8,x=E.sigBytes*8;v[x>>>5]|=128<<24-x%32,v[(x+128>>>10<<5)+30]=Math.floor(_/4294967296),v[(x+128>>>10<<5)+31]=_,E.sigBytes=v.length*4,this._process();var p=this._hash.toX32();return p},clone:function(){var E=n.clone.call(this);return E._hash=this._hash.clone(),E},blockSize:1024/32});r.SHA512=n._createHelper(y),r.HmacSHA512=n._createHmacHelper(y)}(),t.SHA512})}(ai)),ai.exports}var oi={exports:{}},Qn;function v0(){return Qn||(Qn=1,function(s,e){(function(t,r,i){s.exports=r(se(),cs(),Xn())})(ee,function(t){return function(){var r=t,i=r.x64,n=i.Word,a=i.WordArray,o=r.algo,l=o.SHA512,c=o.SHA384=l.extend({_doReset:function(){this._hash=new a.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var d=l._doFinalize.call(this);return d.sigBytes-=16,d}});r.SHA384=l._createHelper(c),r.HmacSHA384=l._createHmacHelper(c)}(),t.SHA384})}(oi)),oi.exports}var ci={exports:{}},ea;function E0(){return ea||(ea=1,function(s,e){(function(t,r,i){s.exports=r(se(),cs())})(ee,function(t){return function(r){var i=t,n=i.lib,a=n.WordArray,o=n.Hasher,l=i.x64,c=l.Word,d=i.algo,g=[],u=[],y=[];(function(){for(var _=1,x=0,p=0;p<24;p++){g[_+5*x]=(p+1)*(p+2)/2%64;var w=x%5,D=(2*_+3*x)%5;_=w,x=D}for(var _=0;_<5;_++)for(var x=0;x<5;x++)u[_+5*x]=x+(2*_+3*x)%5*5;for(var S=1,T=0;T<24;T++){for(var F=0,h=0,M=0;M<7;M++){if(S&1){var A=(1<<M)-1;A<32?h^=1<<A:F^=1<<A-32}S&128?S=S<<1^113:S<<=1}y[T]=c.create(F,h)}})();var E=[];(function(){for(var _=0;_<25;_++)E[_]=c.create()})();var v=d.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){for(var _=this._state=[],x=0;x<25;x++)_[x]=new c.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(_,x){for(var p=this._state,w=this.blockSize/2,D=0;D<w;D++){var S=_[x+2*D],T=_[x+2*D+1];S=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360,T=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360;var F=p[D];F.high^=T,F.low^=S}for(var h=0;h<24;h++){for(var M=0;M<5;M++){for(var A=0,f=0,C=0;C<5;C++){var F=p[M+5*C];A^=F.high,f^=F.low}var m=E[M];m.high=A,m.low=f}for(var M=0;M<5;M++)for(var q=E[(M+4)%5],N=E[(M+1)%5],z=N.high,G=N.low,A=q.high^(z<<1|G>>>31),f=q.low^(G<<1|z>>>31),C=0;C<5;C++){var F=p[M+5*C];F.high^=A,F.low^=f}for(var ie=1;ie<25;ie++){var A,f,F=p[ie],he=F.high,ue=F.low,k=g[ie];k<32?(A=he<<k|ue>>>32-k,f=ue<<k|he>>>32-k):(A=ue<<k-32|he>>>64-k,f=he<<k-32|ue>>>64-k);var $=E[u[ie]];$.high=A,$.low=f}var H=E[0],I=p[0];H.high=I.high,H.low=I.low;for(var M=0;M<5;M++)for(var C=0;C<5;C++){var ie=M+5*C,F=p[ie],me=E[ie],fe=E[(M+1)%5+5*C],ke=E[(M+2)%5+5*C];F.high=me.high^~fe.high&ke.high,F.low=me.low^~fe.low&ke.low}var F=p[0],X=y[h];F.high^=X.high,F.low^=X.low}},_doFinalize:function(){var _=this._data,x=_.words;this._nDataBytes*8;var p=_.sigBytes*8,w=this.blockSize*32;x[p>>>5]|=1<<24-p%32,x[(r.ceil((p+1)/w)*w>>>5)-1]|=128,_.sigBytes=x.length*4,this._process();for(var D=this._state,S=this.cfg.outputLength/8,T=S/8,F=[],h=0;h<T;h++){var M=D[h],A=M.high,f=M.low;A=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360,f=(f<<8|f>>>24)&16711935|(f<<24|f>>>8)&4278255360,F.push(f),F.push(A)}return new a.init(F,S)},clone:function(){for(var _=o.clone.call(this),x=_._state=this._state.slice(0),p=0;p<25;p++)x[p]=x[p].clone();return _}});i.SHA3=o._createHelper(v),i.HmacSHA3=o._createHmacHelper(v)}(Math),t.SHA3})}(ci)),ci.exports}var di={exports:{}},ta;function y0(){return ta||(ta=1,function(s,e){(function(t,r){s.exports=r(se())})(ee,function(t){/** @preserve
|
|
84
81
|
(c) 2012 by Cédric Mesnil. All rights reserved.
|
|
85
82
|
|
|
86
83
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
@@ -89,17 +86,20 @@ React keys must be passed directly to JSX without using spread:
|
|
|
89
86
|
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
90
87
|
|
|
91
88
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
92
|
-
*/return function(r){var i=t,n=i.lib,a=n.WordArray,o=n.Hasher,l=i.algo,c=a.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),d=a.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),g=a.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),u=a.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),E=a.create([0,1518500249,1859775393,2400959708,2840853838]),y=a.create([1352829926,1548603684,1836072691,2053994217,0]),v=l.RIPEMD160=o.extend({_doReset:function(){this._hash=a.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(T,F){for(var h=0;h<16;h++){var M=F+h,A=T[M];T[M]=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360}var f=this._hash.words,C=E.words,m=y.words,q=c.words,N=d.words,z=g.words,G=u.words,ie,he,ue,k,$,H,I,me,fe,ke;H=ie=f[0],I=he=f[1],me=ue=f[2],fe=k=f[3],ke=$=f[4];for(var X,h=0;h<80;h+=1)X=ie+T[F+q[h]]|0,h<16?X+=_(he,ue,k)+C[0]:h<32?X+=x(he,ue,k)+C[1]:h<48?X+=p(he,ue,k)+C[2]:h<64?X+=w(he,ue,k)+C[3]:X+=D(he,ue,k)+C[4],X=X|0,X=S(X,z[h]),X=X+$|0,ie=$,$=k,k=S(ue,10),ue=he,he=X,X=H+T[F+N[h]]|0,h<16?X+=D(I,me,fe)+m[0]:h<32?X+=w(I,me,fe)+m[1]:h<48?X+=p(I,me,fe)+m[2]:h<64?X+=x(I,me,fe)+m[3]:X+=_(I,me,fe)+m[4],X=X|0,X=S(X,G[h]),X=X+ke|0,H=ke,ke=fe,fe=S(me,10),me=I,I=X;X=f[1]+ue+fe|0,f[1]=f[2]+k+ke|0,f[2]=f[3]+$+H|0,f[3]=f[4]+ie+I|0,f[4]=f[0]+he+me|0,f[0]=X},_doFinalize:function(){var T=this._data,F=T.words,h=this._nDataBytes*8,M=T.sigBytes*8;F[M>>>5]|=128<<24-M%32,F[(M+64>>>9<<4)+14]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360,T.sigBytes=(F.length+1)*4,this._process();for(var A=this._hash,f=A.words,C=0;C<5;C++){var m=f[C];f[C]=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360}return A},clone:function(){var T=o.clone.call(this);return T._hash=this._hash.clone(),T}});function _(T,F,h){return T^F^h}function x(T,F,h){return T&F|~T&h}function p(T,F,h){return(T|~F)^h}function w(T,F,h){return T&h|F&~h}function D(T,F,h){return T^(F|~h)}function S(T,F){return T<<F|T>>>32-F}i.RIPEMD160=o._createHelper(v),i.HmacRIPEMD160=o._createHmacHelper(v)}(),t.RIPEMD160})}(di)),di.exports}var li={exports:{}},ra;function hi(){return ra||(ra=1,function(s,e){(function(t,r){s.exports=r(se())})(ee,function(t){(function(){var r=t,i=r.lib,n=i.Base,a=r.enc,o=a.Utf8,l=r.algo;l.HMAC=n.extend({init:function(c,d){c=this._hasher=new c.init,typeof d=="string"&&(d=o.parse(d));var g=c.blockSize,u=g*4;d.sigBytes>u&&(d=c.finalize(d)),d.clamp();for(var E=this._oKey=d.clone(),y=this._iKey=d.clone(),v=E.words,_=y.words,x=0;x<g;x++)v[x]^=1549556828,_[x]^=909522486;E.sigBytes=y.sigBytes=u,this.reset()},reset:function(){var c=this._hasher;c.reset(),c.update(this._iKey)},update:function(c){return this._hasher.update(c),this},finalize:function(c){var d=this._hasher,g=d.finalize(c);d.reset();var u=d.finalize(this._oKey.clone().concat(g));return u}})})()})}(li)),li.exports}var ui={exports:{}},sa;function C0(){return sa||(sa=1,function(s,e){(function(t,r,i){s.exports=r(se(),ii(),hi())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.Base,a=i.WordArray,o=r.algo,l=o.SHA256,c=o.HMAC,d=o.PBKDF2=n.extend({cfg:n.extend({keySize:128/32,hasher:l,iterations:25e4}),init:function(g){this.cfg=this.cfg.extend(g)},compute:function(g,u){for(var E=this.cfg,y=c.create(E.hasher,g),v=a.create(),_=a.create([1]),x=v.words,p=_.words,w=E.keySize,D=E.iterations;x.length<w;){var S=y.update(u).finalize(_);y.reset();for(var T=S.words,F=T.length,h=S,M=1;M<D;M++){h=y.finalize(h),y.reset();for(var A=h.words,f=0;f<F;f++)T[f]^=A[f]}v.concat(S),p[0]++}return v.sigBytes=w*4,v}});r.PBKDF2=function(g,u,E){return d.create(E).compute(g,u)}}(),t.PBKDF2})}(ui)),ui.exports}var fi={exports:{}},ia;function Ut(){return ia||(ia=1,function(s,e){(function(t,r,i){s.exports=r(se(),zn(),hi())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.Base,a=i.WordArray,o=r.algo,l=o.MD5,c=o.EvpKDF=n.extend({cfg:n.extend({keySize:128/32,hasher:l,iterations:1}),init:function(d){this.cfg=this.cfg.extend(d)},compute:function(d,g){for(var u,E=this.cfg,y=E.hasher.create(),v=a.create(),_=v.words,x=E.keySize,p=E.iterations;_.length<x;){u&&y.update(u),u=y.update(d).finalize(g),y.reset();for(var w=1;w<p;w++)u=y.finalize(u),y.reset();v.concat(u)}return v.sigBytes=x*4,v}});r.EvpKDF=function(d,g,u){return c.create(u).compute(d,g)}}(),t.EvpKDF})}(fi)),fi.exports}var gi={exports:{}},na;function Be(){return na||(na=1,function(s,e){(function(t,r,i){s.exports=r(se(),Ut())})(ee,function(t){t.lib.Cipher||function(r){var i=t,n=i.lib,a=n.Base,o=n.WordArray,l=n.BufferedBlockAlgorithm,c=i.enc;c.Utf8;var d=c.Base64,g=i.algo,u=g.EvpKDF,E=n.Cipher=l.extend({cfg:a.extend(),createEncryptor:function(A,f){return this.create(this._ENC_XFORM_MODE,A,f)},createDecryptor:function(A,f){return this.create(this._DEC_XFORM_MODE,A,f)},init:function(A,f,C){this.cfg=this.cfg.extend(C),this._xformMode=A,this._key=f,this.reset()},reset:function(){l.reset.call(this),this._doReset()},process:function(A){return this._append(A),this._process()},finalize:function(A){A&&this._append(A);var f=this._doFinalize();return f},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function A(f){return typeof f=="string"?M:T}return function(f){return{encrypt:function(C,m,q){return A(m).encrypt(f,C,m,q)},decrypt:function(C,m,q){return A(m).decrypt(f,C,m,q)}}}}()});n.StreamCipher=E.extend({_doFinalize:function(){var A=this._process(!0);return A},blockSize:1});var y=i.mode={},v=n.BlockCipherMode=a.extend({createEncryptor:function(A,f){return this.Encryptor.create(A,f)},createDecryptor:function(A,f){return this.Decryptor.create(A,f)},init:function(A,f){this._cipher=A,this._iv=f}}),_=y.CBC=function(){var A=v.extend();A.Encryptor=A.extend({processBlock:function(C,m){var q=this._cipher,N=q.blockSize;f.call(this,C,m,N),q.encryptBlock(C,m),this._prevBlock=C.slice(m,m+N)}}),A.Decryptor=A.extend({processBlock:function(C,m){var q=this._cipher,N=q.blockSize,z=C.slice(m,m+N);q.decryptBlock(C,m),f.call(this,C,m,N),this._prevBlock=z}});function f(C,m,q){var N,z=this._iv;z?(N=z,this._iv=r):N=this._prevBlock;for(var G=0;G<q;G++)C[m+G]^=N[G]}return A}(),x=i.pad={},p=x.Pkcs7={pad:function(A,f){for(var C=f*4,m=C-A.sigBytes%C,q=m<<24|m<<16|m<<8|m,N=[],z=0;z<m;z+=4)N.push(q);var G=o.create(N,m);A.concat(G)},unpad:function(A){var f=A.words[A.sigBytes-1>>>2]&255;A.sigBytes-=f}};n.BlockCipher=E.extend({cfg:E.cfg.extend({mode:_,padding:p}),reset:function(){var A;E.reset.call(this);var f=this.cfg,C=f.iv,m=f.mode;this._xformMode==this._ENC_XFORM_MODE?A=m.createEncryptor:(A=m.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==A?this._mode.init(this,C&&C.words):(this._mode=A.call(m,this,C&&C.words),this._mode.__creator=A)},_doProcessBlock:function(A,f){this._mode.processBlock(A,f)},_doFinalize:function(){var A,f=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(f.pad(this._data,this.blockSize),A=this._process(!0)):(A=this._process(!0),f.unpad(A)),A},blockSize:128/32});var w=n.CipherParams=a.extend({init:function(A){this.mixIn(A)},toString:function(A){return(A||this.formatter).stringify(this)}}),D=i.format={},S=D.OpenSSL={stringify:function(A){var f,C=A.ciphertext,m=A.salt;return m?f=o.create([1398893684,1701076831]).concat(m).concat(C):f=C,f.toString(d)},parse:function(A){var f,C=d.parse(A),m=C.words;return m[0]==1398893684&&m[1]==1701076831&&(f=o.create(m.slice(2,4)),m.splice(0,4),C.sigBytes-=16),w.create({ciphertext:C,salt:f})}},T=n.SerializableCipher=a.extend({cfg:a.extend({format:S}),encrypt:function(A,f,C,m){m=this.cfg.extend(m);var q=A.createEncryptor(C,m),N=q.finalize(f),z=q.cfg;return w.create({ciphertext:N,key:C,iv:z.iv,algorithm:A,mode:z.mode,padding:z.padding,blockSize:A.blockSize,formatter:m.format})},decrypt:function(A,f,C,m){m=this.cfg.extend(m),f=this._parse(f,m.format);var q=A.createDecryptor(C,m).finalize(f.ciphertext);return q},_parse:function(A,f){return typeof A=="string"?f.parse(A,this):A}}),F=i.kdf={},h=F.OpenSSL={execute:function(A,f,C,m,q){if(m||(m=o.random(64/8)),q)var N=u.create({keySize:f+C,hasher:q}).compute(A,m);else var N=u.create({keySize:f+C}).compute(A,m);var z=o.create(N.words.slice(f),C*4);return N.sigBytes=f*4,w.create({key:N,iv:z,salt:m})}},M=n.PasswordBasedCipher=T.extend({cfg:T.cfg.extend({kdf:h}),encrypt:function(A,f,C,m){m=this.cfg.extend(m);var q=m.kdf.execute(C,A.keySize,A.ivSize,m.salt,m.hasher);m.iv=q.iv;var N=T.encrypt.call(this,A,f,q.key,m);return N.mixIn(q),N},decrypt:function(A,f,C,m){m=this.cfg.extend(m),f=this._parse(f,m.format);var q=m.kdf.execute(C,A.keySize,A.ivSize,f.salt,m.hasher);m.iv=q.iv;var N=T.decrypt.call(this,A,f,q.key,m);return N}})}()})}(gi)),gi.exports}var xi={exports:{}},aa;function _0(){return aa||(aa=1,function(s,e){(function(t,r,i){s.exports=r(se(),Be())})(ee,function(t){return t.mode.CFB=function(){var r=t.lib.BlockCipherMode.extend();r.Encryptor=r.extend({processBlock:function(n,a){var o=this._cipher,l=o.blockSize;i.call(this,n,a,l,o),this._prevBlock=n.slice(a,a+l)}}),r.Decryptor=r.extend({processBlock:function(n,a){var o=this._cipher,l=o.blockSize,c=n.slice(a,a+l);i.call(this,n,a,l,o),this._prevBlock=c}});function i(n,a,o,l){var c,d=this._iv;d?(c=d.slice(0),this._iv=void 0):c=this._prevBlock,l.encryptBlock(c,0);for(var g=0;g<o;g++)n[a+g]^=c[g]}return r}(),t.mode.CFB})}(xi)),xi.exports}var pi={exports:{}},oa;function D0(){return oa||(oa=1,function(s,e){(function(t,r,i){s.exports=r(se(),Be())})(ee,function(t){return t.mode.CTR=function(){var r=t.lib.BlockCipherMode.extend(),i=r.Encryptor=r.extend({processBlock:function(n,a){var o=this._cipher,l=o.blockSize,c=this._iv,d=this._counter;c&&(d=this._counter=c.slice(0),this._iv=void 0);var g=d.slice(0);o.encryptBlock(g,0),d[l-1]=d[l-1]+1|0;for(var u=0;u<l;u++)n[a+u]^=g[u]}});return r.Decryptor=i,r}(),t.mode.CTR})}(pi)),pi.exports}var mi={exports:{}},ca;function b0(){return ca||(ca=1,function(s,e){(function(t,r,i){s.exports=r(se(),Be())})(ee,function(t){/** @preserve
|
|
89
|
+
*/return function(r){var i=t,n=i.lib,a=n.WordArray,o=n.Hasher,l=i.algo,c=a.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),d=a.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),g=a.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),u=a.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),y=a.create([0,1518500249,1859775393,2400959708,2840853838]),E=a.create([1352829926,1548603684,1836072691,2053994217,0]),v=l.RIPEMD160=o.extend({_doReset:function(){this._hash=a.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(T,F){for(var h=0;h<16;h++){var M=F+h,A=T[M];T[M]=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360}var f=this._hash.words,C=y.words,m=E.words,q=c.words,N=d.words,z=g.words,G=u.words,ie,he,ue,k,$,H,I,me,fe,ke;H=ie=f[0],I=he=f[1],me=ue=f[2],fe=k=f[3],ke=$=f[4];for(var X,h=0;h<80;h+=1)X=ie+T[F+q[h]]|0,h<16?X+=_(he,ue,k)+C[0]:h<32?X+=x(he,ue,k)+C[1]:h<48?X+=p(he,ue,k)+C[2]:h<64?X+=w(he,ue,k)+C[3]:X+=D(he,ue,k)+C[4],X=X|0,X=S(X,z[h]),X=X+$|0,ie=$,$=k,k=S(ue,10),ue=he,he=X,X=H+T[F+N[h]]|0,h<16?X+=D(I,me,fe)+m[0]:h<32?X+=w(I,me,fe)+m[1]:h<48?X+=p(I,me,fe)+m[2]:h<64?X+=x(I,me,fe)+m[3]:X+=_(I,me,fe)+m[4],X=X|0,X=S(X,G[h]),X=X+ke|0,H=ke,ke=fe,fe=S(me,10),me=I,I=X;X=f[1]+ue+fe|0,f[1]=f[2]+k+ke|0,f[2]=f[3]+$+H|0,f[3]=f[4]+ie+I|0,f[4]=f[0]+he+me|0,f[0]=X},_doFinalize:function(){var T=this._data,F=T.words,h=this._nDataBytes*8,M=T.sigBytes*8;F[M>>>5]|=128<<24-M%32,F[(M+64>>>9<<4)+14]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360,T.sigBytes=(F.length+1)*4,this._process();for(var A=this._hash,f=A.words,C=0;C<5;C++){var m=f[C];f[C]=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360}return A},clone:function(){var T=o.clone.call(this);return T._hash=this._hash.clone(),T}});function _(T,F,h){return T^F^h}function x(T,F,h){return T&F|~T&h}function p(T,F,h){return(T|~F)^h}function w(T,F,h){return T&h|F&~h}function D(T,F,h){return T^(F|~h)}function S(T,F){return T<<F|T>>>32-F}i.RIPEMD160=o._createHelper(v),i.HmacRIPEMD160=o._createHmacHelper(v)}(),t.RIPEMD160})}(di)),di.exports}var li={exports:{}},ra;function hi(){return ra||(ra=1,function(s,e){(function(t,r){s.exports=r(se())})(ee,function(t){(function(){var r=t,i=r.lib,n=i.Base,a=r.enc,o=a.Utf8,l=r.algo;l.HMAC=n.extend({init:function(c,d){c=this._hasher=new c.init,typeof d=="string"&&(d=o.parse(d));var g=c.blockSize,u=g*4;d.sigBytes>u&&(d=c.finalize(d)),d.clamp();for(var y=this._oKey=d.clone(),E=this._iKey=d.clone(),v=y.words,_=E.words,x=0;x<g;x++)v[x]^=1549556828,_[x]^=909522486;y.sigBytes=E.sigBytes=u,this.reset()},reset:function(){var c=this._hasher;c.reset(),c.update(this._iKey)},update:function(c){return this._hasher.update(c),this},finalize:function(c){var d=this._hasher,g=d.finalize(c);d.reset();var u=d.finalize(this._oKey.clone().concat(g));return u}})})()})}(li)),li.exports}var ui={exports:{}},sa;function w0(){return sa||(sa=1,function(s,e){(function(t,r,i){s.exports=r(se(),ii(),hi())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.Base,a=i.WordArray,o=r.algo,l=o.SHA256,c=o.HMAC,d=o.PBKDF2=n.extend({cfg:n.extend({keySize:128/32,hasher:l,iterations:25e4}),init:function(g){this.cfg=this.cfg.extend(g)},compute:function(g,u){for(var y=this.cfg,E=c.create(y.hasher,g),v=a.create(),_=a.create([1]),x=v.words,p=_.words,w=y.keySize,D=y.iterations;x.length<w;){var S=E.update(u).finalize(_);E.reset();for(var T=S.words,F=T.length,h=S,M=1;M<D;M++){h=E.finalize(h),E.reset();for(var A=h.words,f=0;f<F;f++)T[f]^=A[f]}v.concat(S),p[0]++}return v.sigBytes=w*4,v}});r.PBKDF2=function(g,u,y){return d.create(y).compute(g,u)}}(),t.PBKDF2})}(ui)),ui.exports}var fi={exports:{}},ia;function Ut(){return ia||(ia=1,function(s,e){(function(t,r,i){s.exports=r(se(),zn(),hi())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.Base,a=i.WordArray,o=r.algo,l=o.MD5,c=o.EvpKDF=n.extend({cfg:n.extend({keySize:128/32,hasher:l,iterations:1}),init:function(d){this.cfg=this.cfg.extend(d)},compute:function(d,g){for(var u,y=this.cfg,E=y.hasher.create(),v=a.create(),_=v.words,x=y.keySize,p=y.iterations;_.length<x;){u&&E.update(u),u=E.update(d).finalize(g),E.reset();for(var w=1;w<p;w++)u=E.finalize(u),E.reset();v.concat(u)}return v.sigBytes=x*4,v}});r.EvpKDF=function(d,g,u){return c.create(u).compute(d,g)}}(),t.EvpKDF})}(fi)),fi.exports}var gi={exports:{}},na;function Be(){return na||(na=1,function(s,e){(function(t,r,i){s.exports=r(se(),Ut())})(ee,function(t){t.lib.Cipher||function(r){var i=t,n=i.lib,a=n.Base,o=n.WordArray,l=n.BufferedBlockAlgorithm,c=i.enc;c.Utf8;var d=c.Base64,g=i.algo,u=g.EvpKDF,y=n.Cipher=l.extend({cfg:a.extend(),createEncryptor:function(A,f){return this.create(this._ENC_XFORM_MODE,A,f)},createDecryptor:function(A,f){return this.create(this._DEC_XFORM_MODE,A,f)},init:function(A,f,C){this.cfg=this.cfg.extend(C),this._xformMode=A,this._key=f,this.reset()},reset:function(){l.reset.call(this),this._doReset()},process:function(A){return this._append(A),this._process()},finalize:function(A){A&&this._append(A);var f=this._doFinalize();return f},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function A(f){return typeof f=="string"?M:T}return function(f){return{encrypt:function(C,m,q){return A(m).encrypt(f,C,m,q)},decrypt:function(C,m,q){return A(m).decrypt(f,C,m,q)}}}}()});n.StreamCipher=y.extend({_doFinalize:function(){var A=this._process(!0);return A},blockSize:1});var E=i.mode={},v=n.BlockCipherMode=a.extend({createEncryptor:function(A,f){return this.Encryptor.create(A,f)},createDecryptor:function(A,f){return this.Decryptor.create(A,f)},init:function(A,f){this._cipher=A,this._iv=f}}),_=E.CBC=function(){var A=v.extend();A.Encryptor=A.extend({processBlock:function(C,m){var q=this._cipher,N=q.blockSize;f.call(this,C,m,N),q.encryptBlock(C,m),this._prevBlock=C.slice(m,m+N)}}),A.Decryptor=A.extend({processBlock:function(C,m){var q=this._cipher,N=q.blockSize,z=C.slice(m,m+N);q.decryptBlock(C,m),f.call(this,C,m,N),this._prevBlock=z}});function f(C,m,q){var N,z=this._iv;z?(N=z,this._iv=r):N=this._prevBlock;for(var G=0;G<q;G++)C[m+G]^=N[G]}return A}(),x=i.pad={},p=x.Pkcs7={pad:function(A,f){for(var C=f*4,m=C-A.sigBytes%C,q=m<<24|m<<16|m<<8|m,N=[],z=0;z<m;z+=4)N.push(q);var G=o.create(N,m);A.concat(G)},unpad:function(A){var f=A.words[A.sigBytes-1>>>2]&255;A.sigBytes-=f}};n.BlockCipher=y.extend({cfg:y.cfg.extend({mode:_,padding:p}),reset:function(){var A;y.reset.call(this);var f=this.cfg,C=f.iv,m=f.mode;this._xformMode==this._ENC_XFORM_MODE?A=m.createEncryptor:(A=m.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==A?this._mode.init(this,C&&C.words):(this._mode=A.call(m,this,C&&C.words),this._mode.__creator=A)},_doProcessBlock:function(A,f){this._mode.processBlock(A,f)},_doFinalize:function(){var A,f=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(f.pad(this._data,this.blockSize),A=this._process(!0)):(A=this._process(!0),f.unpad(A)),A},blockSize:128/32});var w=n.CipherParams=a.extend({init:function(A){this.mixIn(A)},toString:function(A){return(A||this.formatter).stringify(this)}}),D=i.format={},S=D.OpenSSL={stringify:function(A){var f,C=A.ciphertext,m=A.salt;return m?f=o.create([1398893684,1701076831]).concat(m).concat(C):f=C,f.toString(d)},parse:function(A){var f,C=d.parse(A),m=C.words;return m[0]==1398893684&&m[1]==1701076831&&(f=o.create(m.slice(2,4)),m.splice(0,4),C.sigBytes-=16),w.create({ciphertext:C,salt:f})}},T=n.SerializableCipher=a.extend({cfg:a.extend({format:S}),encrypt:function(A,f,C,m){m=this.cfg.extend(m);var q=A.createEncryptor(C,m),N=q.finalize(f),z=q.cfg;return w.create({ciphertext:N,key:C,iv:z.iv,algorithm:A,mode:z.mode,padding:z.padding,blockSize:A.blockSize,formatter:m.format})},decrypt:function(A,f,C,m){m=this.cfg.extend(m),f=this._parse(f,m.format);var q=A.createDecryptor(C,m).finalize(f.ciphertext);return q},_parse:function(A,f){return typeof A=="string"?f.parse(A,this):A}}),F=i.kdf={},h=F.OpenSSL={execute:function(A,f,C,m,q){if(m||(m=o.random(64/8)),q)var N=u.create({keySize:f+C,hasher:q}).compute(A,m);else var N=u.create({keySize:f+C}).compute(A,m);var z=o.create(N.words.slice(f),C*4);return N.sigBytes=f*4,w.create({key:N,iv:z,salt:m})}},M=n.PasswordBasedCipher=T.extend({cfg:T.cfg.extend({kdf:h}),encrypt:function(A,f,C,m){m=this.cfg.extend(m);var q=m.kdf.execute(C,A.keySize,A.ivSize,m.salt,m.hasher);m.iv=q.iv;var N=T.encrypt.call(this,A,f,q.key,m);return N.mixIn(q),N},decrypt:function(A,f,C,m){m=this.cfg.extend(m),f=this._parse(f,m.format);var q=m.kdf.execute(C,A.keySize,A.ivSize,f.salt,m.hasher);m.iv=q.iv;var N=T.decrypt.call(this,A,f,q.key,m);return N}})}()})}(gi)),gi.exports}var xi={exports:{}},aa;function C0(){return aa||(aa=1,function(s,e){(function(t,r,i){s.exports=r(se(),Be())})(ee,function(t){return t.mode.CFB=function(){var r=t.lib.BlockCipherMode.extend();r.Encryptor=r.extend({processBlock:function(n,a){var o=this._cipher,l=o.blockSize;i.call(this,n,a,l,o),this._prevBlock=n.slice(a,a+l)}}),r.Decryptor=r.extend({processBlock:function(n,a){var o=this._cipher,l=o.blockSize,c=n.slice(a,a+l);i.call(this,n,a,l,o),this._prevBlock=c}});function i(n,a,o,l){var c,d=this._iv;d?(c=d.slice(0),this._iv=void 0):c=this._prevBlock,l.encryptBlock(c,0);for(var g=0;g<o;g++)n[a+g]^=c[g]}return r}(),t.mode.CFB})}(xi)),xi.exports}var pi={exports:{}},oa;function _0(){return oa||(oa=1,function(s,e){(function(t,r,i){s.exports=r(se(),Be())})(ee,function(t){return t.mode.CTR=function(){var r=t.lib.BlockCipherMode.extend(),i=r.Encryptor=r.extend({processBlock:function(n,a){var o=this._cipher,l=o.blockSize,c=this._iv,d=this._counter;c&&(d=this._counter=c.slice(0),this._iv=void 0);var g=d.slice(0);o.encryptBlock(g,0),d[l-1]=d[l-1]+1|0;for(var u=0;u<l;u++)n[a+u]^=g[u]}});return r.Decryptor=i,r}(),t.mode.CTR})}(pi)),pi.exports}var mi={exports:{}},ca;function D0(){return ca||(ca=1,function(s,e){(function(t,r,i){s.exports=r(se(),Be())})(ee,function(t){/** @preserve
|
|
93
90
|
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
|
94
91
|
* derived from CryptoJS.mode.CTR
|
|
95
92
|
* Jan Hruby jhruby.web@gmail.com
|
|
96
|
-
*/return t.mode.CTRGladman=function(){var r=t.lib.BlockCipherMode.extend();function i(o){if((o>>24&255)===255){var l=o>>16&255,c=o>>8&255,d=o&255;l===255?(l=0,c===255?(c=0,d===255?d=0:++d):++c):++l,o=0,o+=l<<16,o+=c<<8,o+=d}else o+=1<<24;return o}function n(o){return(o[0]=i(o[0]))===0&&(o[1]=i(o[1])),o}var a=r.Encryptor=r.extend({processBlock:function(o,l){var c=this._cipher,d=c.blockSize,g=this._iv,u=this._counter;g&&(u=this._counter=g.slice(0),this._iv=void 0),n(u);var E=u.slice(0);c.encryptBlock(E,0);for(var y=0;y<d;y++)o[l+y]^=E[y]}});return r.Decryptor=a,r}(),t.mode.CTRGladman})}(mi)),mi.exports}var vi={exports:{}},da;function A0(){return da||(da=1,function(s,e){(function(t,r,i){s.exports=r(se(),Be())})(ee,function(t){return t.mode.OFB=function(){var r=t.lib.BlockCipherMode.extend(),i=r.Encryptor=r.extend({processBlock:function(n,a){var o=this._cipher,l=o.blockSize,c=this._iv,d=this._keystream;c&&(d=this._keystream=c.slice(0),this._iv=void 0),o.encryptBlock(d,0);for(var g=0;g<l;g++)n[a+g]^=d[g]}});return r.Decryptor=i,r}(),t.mode.OFB})}(vi)),vi.exports}var yi={exports:{}},la;function T0(){return la||(la=1,function(s,e){(function(t,r,i){s.exports=r(se(),Be())})(ee,function(t){return t.mode.ECB=function(){var r=t.lib.BlockCipherMode.extend();return r.Encryptor=r.extend({processBlock:function(i,n){this._cipher.encryptBlock(i,n)}}),r.Decryptor=r.extend({processBlock:function(i,n){this._cipher.decryptBlock(i,n)}}),r}(),t.mode.ECB})}(yi)),yi.exports}var Ei={exports:{}},ha;function S0(){return ha||(ha=1,function(s,e){(function(t,r,i){s.exports=r(se(),Be())})(ee,function(t){return t.pad.AnsiX923={pad:function(r,i){var n=r.sigBytes,a=i*4,o=a-n%a,l=n+o-1;r.clamp(),r.words[l>>>2]|=o<<24-l%4*8,r.sigBytes+=o},unpad:function(r){var i=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=i}},t.pad.Ansix923})}(Ei)),Ei.exports}var wi={exports:{}},ua;function R0(){return ua||(ua=1,function(s,e){(function(t,r,i){s.exports=r(se(),Be())})(ee,function(t){return t.pad.Iso10126={pad:function(r,i){var n=i*4,a=n-r.sigBytes%n;r.concat(t.lib.WordArray.random(a-1)).concat(t.lib.WordArray.create([a<<24],1))},unpad:function(r){var i=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=i}},t.pad.Iso10126})}(wi)),wi.exports}var Ci={exports:{}},fa;function F0(){return fa||(fa=1,function(s,e){(function(t,r,i){s.exports=r(se(),Be())})(ee,function(t){return t.pad.Iso97971={pad:function(r,i){r.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(r,i)},unpad:function(r){t.pad.ZeroPadding.unpad(r),r.sigBytes--}},t.pad.Iso97971})}(Ci)),Ci.exports}var _i={exports:{}},ga;function B0(){return ga||(ga=1,function(s,e){(function(t,r,i){s.exports=r(se(),Be())})(ee,function(t){return t.pad.ZeroPadding={pad:function(r,i){var n=i*4;r.clamp(),r.sigBytes+=n-(r.sigBytes%n||n)},unpad:function(r){for(var i=r.words,n=r.sigBytes-1,n=r.sigBytes-1;n>=0;n--)if(i[n>>>2]>>>24-n%4*8&255){r.sigBytes=n+1;break}}},t.pad.ZeroPadding})}(_i)),_i.exports}var Di={exports:{}},xa;function k0(){return xa||(xa=1,function(s,e){(function(t,r,i){s.exports=r(se(),Be())})(ee,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})}(Di)),Di.exports}var bi={exports:{}},pa;function I0(){return pa||(pa=1,function(s,e){(function(t,r,i){s.exports=r(se(),Be())})(ee,function(t){return function(r){var i=t,n=i.lib,a=n.CipherParams,o=i.enc,l=o.Hex,c=i.format;c.Hex={stringify:function(d){return d.ciphertext.toString(l)},parse:function(d){var g=l.parse(d);return a.create({ciphertext:g})}}}(),t.format.Hex})}(bi)),bi.exports}var Ai={exports:{}},ma;function $0(){return ma||(ma=1,function(s,e){(function(t,r,i){s.exports=r(se(),rr(),sr(),Ut(),Be())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.BlockCipher,a=r.algo,o=[],l=[],c=[],d=[],g=[],u=[],E=[],y=[],v=[],_=[];(function(){for(var w=[],D=0;D<256;D++)D<128?w[D]=D<<1:w[D]=D<<1^283;for(var S=0,T=0,D=0;D<256;D++){var F=T^T<<1^T<<2^T<<3^T<<4;F=F>>>8^F&255^99,o[S]=F,l[F]=S;var h=w[S],M=w[h],A=w[M],f=w[F]*257^F*16843008;c[S]=f<<24|f>>>8,d[S]=f<<16|f>>>16,g[S]=f<<8|f>>>24,u[S]=f;var f=A*16843009^M*65537^h*257^S*16843008;E[F]=f<<24|f>>>8,y[F]=f<<16|f>>>16,v[F]=f<<8|f>>>24,_[F]=f,S?(S=h^w[w[w[A^h]]],T^=w[w[T]]):S=T=1}})();var x=[0,1,2,4,8,16,32,64,128,27,54],p=a.AES=n.extend({_doReset:function(){var w;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var D=this._keyPriorReset=this._key,S=D.words,T=D.sigBytes/4,F=this._nRounds=T+6,h=(F+1)*4,M=this._keySchedule=[],A=0;A<h;A++)A<T?M[A]=S[A]:(w=M[A-1],A%T?T>6&&A%T==4&&(w=o[w>>>24]<<24|o[w>>>16&255]<<16|o[w>>>8&255]<<8|o[w&255]):(w=w<<8|w>>>24,w=o[w>>>24]<<24|o[w>>>16&255]<<16|o[w>>>8&255]<<8|o[w&255],w^=x[A/T|0]<<24),M[A]=M[A-T]^w);for(var f=this._invKeySchedule=[],C=0;C<h;C++){var A=h-C;if(C%4)var w=M[A];else var w=M[A-4];C<4||A<=4?f[C]=w:f[C]=E[o[w>>>24]]^y[o[w>>>16&255]]^v[o[w>>>8&255]]^_[o[w&255]]}}},encryptBlock:function(w,D){this._doCryptBlock(w,D,this._keySchedule,c,d,g,u,o)},decryptBlock:function(w,D){var S=w[D+1];w[D+1]=w[D+3],w[D+3]=S,this._doCryptBlock(w,D,this._invKeySchedule,E,y,v,_,l);var S=w[D+1];w[D+1]=w[D+3],w[D+3]=S},_doCryptBlock:function(w,D,S,T,F,h,M,A){for(var f=this._nRounds,C=w[D]^S[0],m=w[D+1]^S[1],q=w[D+2]^S[2],N=w[D+3]^S[3],z=4,G=1;G<f;G++){var ie=T[C>>>24]^F[m>>>16&255]^h[q>>>8&255]^M[N&255]^S[z++],he=T[m>>>24]^F[q>>>16&255]^h[N>>>8&255]^M[C&255]^S[z++],ue=T[q>>>24]^F[N>>>16&255]^h[C>>>8&255]^M[m&255]^S[z++],k=T[N>>>24]^F[C>>>16&255]^h[m>>>8&255]^M[q&255]^S[z++];C=ie,m=he,q=ue,N=k}var ie=(A[C>>>24]<<24|A[m>>>16&255]<<16|A[q>>>8&255]<<8|A[N&255])^S[z++],he=(A[m>>>24]<<24|A[q>>>16&255]<<16|A[N>>>8&255]<<8|A[C&255])^S[z++],ue=(A[q>>>24]<<24|A[N>>>16&255]<<16|A[C>>>8&255]<<8|A[m&255])^S[z++],k=(A[N>>>24]<<24|A[C>>>16&255]<<16|A[m>>>8&255]<<8|A[q&255])^S[z++];w[D]=ie,w[D+1]=he,w[D+2]=ue,w[D+3]=k},keySize:256/32});r.AES=n._createHelper(p)}(),t.AES})}(Ai)),Ai.exports}var Ti={exports:{}},va;function H0(){return va||(va=1,function(s,e){(function(t,r,i){s.exports=r(se(),rr(),sr(),Ut(),Be())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.WordArray,a=i.BlockCipher,o=r.algo,l=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],c=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],d=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],g=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],u=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],E=o.DES=a.extend({_doReset:function(){for(var x=this._key,p=x.words,w=[],D=0;D<56;D++){var S=l[D]-1;w[D]=p[S>>>5]>>>31-S%32&1}for(var T=this._subKeys=[],F=0;F<16;F++){for(var h=T[F]=[],M=d[F],D=0;D<24;D++)h[D/6|0]|=w[(c[D]-1+M)%28]<<31-D%6,h[4+(D/6|0)]|=w[28+(c[D+24]-1+M)%28]<<31-D%6;h[0]=h[0]<<1|h[0]>>>31;for(var D=1;D<7;D++)h[D]=h[D]>>>(D-1)*4+3;h[7]=h[7]<<5|h[7]>>>27}for(var A=this._invSubKeys=[],D=0;D<16;D++)A[D]=T[15-D]},encryptBlock:function(x,p){this._doCryptBlock(x,p,this._subKeys)},decryptBlock:function(x,p){this._doCryptBlock(x,p,this._invSubKeys)},_doCryptBlock:function(x,p,w){this._lBlock=x[p],this._rBlock=x[p+1],y.call(this,4,252645135),y.call(this,16,65535),v.call(this,2,858993459),v.call(this,8,16711935),y.call(this,1,1431655765);for(var D=0;D<16;D++){for(var S=w[D],T=this._lBlock,F=this._rBlock,h=0,M=0;M<8;M++)h|=g[M][((F^S[M])&u[M])>>>0];this._lBlock=F,this._rBlock=T^h}var A=this._lBlock;this._lBlock=this._rBlock,this._rBlock=A,y.call(this,1,1431655765),v.call(this,8,16711935),v.call(this,2,858993459),y.call(this,16,65535),y.call(this,4,252645135),x[p]=this._lBlock,x[p+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function y(x,p){var w=(this._lBlock>>>x^this._rBlock)&p;this._rBlock^=w,this._lBlock^=w<<x}function v(x,p){var w=(this._rBlock>>>x^this._lBlock)&p;this._lBlock^=w,this._rBlock^=w<<x}r.DES=a._createHelper(E);var _=o.TripleDES=a.extend({_doReset:function(){var x=this._key,p=x.words;if(p.length!==2&&p.length!==4&&p.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var w=p.slice(0,2),D=p.length<4?p.slice(0,2):p.slice(2,4),S=p.length<6?p.slice(0,2):p.slice(4,6);this._des1=E.createEncryptor(n.create(w)),this._des2=E.createEncryptor(n.create(D)),this._des3=E.createEncryptor(n.create(S))},encryptBlock:function(x,p){this._des1.encryptBlock(x,p),this._des2.decryptBlock(x,p),this._des3.encryptBlock(x,p)},decryptBlock:function(x,p){this._des3.decryptBlock(x,p),this._des2.encryptBlock(x,p),this._des1.decryptBlock(x,p)},keySize:192/32,ivSize:64/32,blockSize:64/32});r.TripleDES=a._createHelper(_)}(),t.TripleDES})}(Ti)),Ti.exports}var Si={exports:{}},ya;function P0(){return ya||(ya=1,function(s,e){(function(t,r,i){s.exports=r(se(),rr(),sr(),Ut(),Be())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.StreamCipher,a=r.algo,o=a.RC4=n.extend({_doReset:function(){for(var d=this._key,g=d.words,u=d.sigBytes,E=this._S=[],y=0;y<256;y++)E[y]=y;for(var y=0,v=0;y<256;y++){var _=y%u,x=g[_>>>2]>>>24-_%4*8&255;v=(v+E[y]+x)%256;var p=E[y];E[y]=E[v],E[v]=p}this._i=this._j=0},_doProcessBlock:function(d,g){d[g]^=l.call(this)},keySize:256/32,ivSize:0});function l(){for(var d=this._S,g=this._i,u=this._j,E=0,y=0;y<4;y++){g=(g+1)%256,u=(u+d[g])%256;var v=d[g];d[g]=d[u],d[u]=v,E|=d[(d[g]+d[u])%256]<<24-y*8}return this._i=g,this._j=u,E}r.RC4=n._createHelper(o);var c=a.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var d=this.cfg.drop;d>0;d--)l.call(this)}});r.RC4Drop=n._createHelper(c)}(),t.RC4})}(Si)),Si.exports}var Ri={exports:{}},Ea;function O0(){return Ea||(Ea=1,function(s,e){(function(t,r,i){s.exports=r(se(),rr(),sr(),Ut(),Be())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.StreamCipher,a=r.algo,o=[],l=[],c=[],d=a.Rabbit=n.extend({_doReset:function(){for(var u=this._key.words,E=this.cfg.iv,y=0;y<4;y++)u[y]=(u[y]<<8|u[y]>>>24)&16711935|(u[y]<<24|u[y]>>>8)&4278255360;var v=this._X=[u[0],u[3]<<16|u[2]>>>16,u[1],u[0]<<16|u[3]>>>16,u[2],u[1]<<16|u[0]>>>16,u[3],u[2]<<16|u[1]>>>16],_=this._C=[u[2]<<16|u[2]>>>16,u[0]&4294901760|u[1]&65535,u[3]<<16|u[3]>>>16,u[1]&4294901760|u[2]&65535,u[0]<<16|u[0]>>>16,u[2]&4294901760|u[3]&65535,u[1]<<16|u[1]>>>16,u[3]&4294901760|u[0]&65535];this._b=0;for(var y=0;y<4;y++)g.call(this);for(var y=0;y<8;y++)_[y]^=v[y+4&7];if(E){var x=E.words,p=x[0],w=x[1],D=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360,S=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,T=D>>>16|S&4294901760,F=S<<16|D&65535;_[0]^=D,_[1]^=T,_[2]^=S,_[3]^=F,_[4]^=D,_[5]^=T,_[6]^=S,_[7]^=F;for(var y=0;y<4;y++)g.call(this)}},_doProcessBlock:function(u,E){var y=this._X;g.call(this),o[0]=y[0]^y[5]>>>16^y[3]<<16,o[1]=y[2]^y[7]>>>16^y[5]<<16,o[2]=y[4]^y[1]>>>16^y[7]<<16,o[3]=y[6]^y[3]>>>16^y[1]<<16;for(var v=0;v<4;v++)o[v]=(o[v]<<8|o[v]>>>24)&16711935|(o[v]<<24|o[v]>>>8)&4278255360,u[E+v]^=o[v]},blockSize:128/32,ivSize:64/32});function g(){for(var u=this._X,E=this._C,y=0;y<8;y++)l[y]=E[y];E[0]=E[0]+1295307597+this._b|0,E[1]=E[1]+3545052371+(E[0]>>>0<l[0]>>>0?1:0)|0,E[2]=E[2]+886263092+(E[1]>>>0<l[1]>>>0?1:0)|0,E[3]=E[3]+1295307597+(E[2]>>>0<l[2]>>>0?1:0)|0,E[4]=E[4]+3545052371+(E[3]>>>0<l[3]>>>0?1:0)|0,E[5]=E[5]+886263092+(E[4]>>>0<l[4]>>>0?1:0)|0,E[6]=E[6]+1295307597+(E[5]>>>0<l[5]>>>0?1:0)|0,E[7]=E[7]+3545052371+(E[6]>>>0<l[6]>>>0?1:0)|0,this._b=E[7]>>>0<l[7]>>>0?1:0;for(var y=0;y<8;y++){var v=u[y]+E[y],_=v&65535,x=v>>>16,p=((_*_>>>17)+_*x>>>15)+x*x,w=((v&4294901760)*v|0)+((v&65535)*v|0);c[y]=p^w}u[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,u[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,u[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,u[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,u[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,u[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,u[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,u[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}r.Rabbit=n._createHelper(d)}(),t.Rabbit})}(Ri)),Ri.exports}var Fi={exports:{}},wa;function M0(){return wa||(wa=1,function(s,e){(function(t,r,i){s.exports=r(se(),rr(),sr(),Ut(),Be())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.StreamCipher,a=r.algo,o=[],l=[],c=[],d=a.RabbitLegacy=n.extend({_doReset:function(){var u=this._key.words,E=this.cfg.iv,y=this._X=[u[0],u[3]<<16|u[2]>>>16,u[1],u[0]<<16|u[3]>>>16,u[2],u[1]<<16|u[0]>>>16,u[3],u[2]<<16|u[1]>>>16],v=this._C=[u[2]<<16|u[2]>>>16,u[0]&4294901760|u[1]&65535,u[3]<<16|u[3]>>>16,u[1]&4294901760|u[2]&65535,u[0]<<16|u[0]>>>16,u[2]&4294901760|u[3]&65535,u[1]<<16|u[1]>>>16,u[3]&4294901760|u[0]&65535];this._b=0;for(var _=0;_<4;_++)g.call(this);for(var _=0;_<8;_++)v[_]^=y[_+4&7];if(E){var x=E.words,p=x[0],w=x[1],D=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360,S=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,T=D>>>16|S&4294901760,F=S<<16|D&65535;v[0]^=D,v[1]^=T,v[2]^=S,v[3]^=F,v[4]^=D,v[5]^=T,v[6]^=S,v[7]^=F;for(var _=0;_<4;_++)g.call(this)}},_doProcessBlock:function(u,E){var y=this._X;g.call(this),o[0]=y[0]^y[5]>>>16^y[3]<<16,o[1]=y[2]^y[7]>>>16^y[5]<<16,o[2]=y[4]^y[1]>>>16^y[7]<<16,o[3]=y[6]^y[3]>>>16^y[1]<<16;for(var v=0;v<4;v++)o[v]=(o[v]<<8|o[v]>>>24)&16711935|(o[v]<<24|o[v]>>>8)&4278255360,u[E+v]^=o[v]},blockSize:128/32,ivSize:64/32});function g(){for(var u=this._X,E=this._C,y=0;y<8;y++)l[y]=E[y];E[0]=E[0]+1295307597+this._b|0,E[1]=E[1]+3545052371+(E[0]>>>0<l[0]>>>0?1:0)|0,E[2]=E[2]+886263092+(E[1]>>>0<l[1]>>>0?1:0)|0,E[3]=E[3]+1295307597+(E[2]>>>0<l[2]>>>0?1:0)|0,E[4]=E[4]+3545052371+(E[3]>>>0<l[3]>>>0?1:0)|0,E[5]=E[5]+886263092+(E[4]>>>0<l[4]>>>0?1:0)|0,E[6]=E[6]+1295307597+(E[5]>>>0<l[5]>>>0?1:0)|0,E[7]=E[7]+3545052371+(E[6]>>>0<l[6]>>>0?1:0)|0,this._b=E[7]>>>0<l[7]>>>0?1:0;for(var y=0;y<8;y++){var v=u[y]+E[y],_=v&65535,x=v>>>16,p=((_*_>>>17)+_*x>>>15)+x*x,w=((v&4294901760)*v|0)+((v&65535)*v|0);c[y]=p^w}u[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,u[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,u[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,u[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,u[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,u[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,u[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,u[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}r.RabbitLegacy=n._createHelper(d)}(),t.RabbitLegacy})}(Fi)),Fi.exports}var Bi={exports:{}},Ca;function N0(){return Ca||(Ca=1,function(s,e){(function(t,r,i){s.exports=r(se(),rr(),sr(),Ut(),Be())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.BlockCipher,a=r.algo;const o=16,l=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],c=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var d={pbox:[],sbox:[]};function g(_,x){let p=x>>24&255,w=x>>16&255,D=x>>8&255,S=x&255,T=_.sbox[0][p]+_.sbox[1][w];return T=T^_.sbox[2][D],T=T+_.sbox[3][S],T}function u(_,x,p){let w=x,D=p,S;for(let T=0;T<o;++T)w=w^_.pbox[T],D=g(_,w)^D,S=w,w=D,D=S;return S=w,w=D,D=S,D=D^_.pbox[o],w=w^_.pbox[o+1],{left:w,right:D}}function E(_,x,p){let w=x,D=p,S;for(let T=o+1;T>1;--T)w=w^_.pbox[T],D=g(_,w)^D,S=w,w=D,D=S;return S=w,w=D,D=S,D=D^_.pbox[1],w=w^_.pbox[0],{left:w,right:D}}function y(_,x,p){for(let F=0;F<4;F++){_.sbox[F]=[];for(let h=0;h<256;h++)_.sbox[F][h]=c[F][h]}let w=0;for(let F=0;F<o+2;F++)_.pbox[F]=l[F]^x[w],w++,w>=p&&(w=0);let D=0,S=0,T=0;for(let F=0;F<o+2;F+=2)T=u(_,D,S),D=T.left,S=T.right,_.pbox[F]=D,_.pbox[F+1]=S;for(let F=0;F<4;F++)for(let h=0;h<256;h+=2)T=u(_,D,S),D=T.left,S=T.right,_.sbox[F][h]=D,_.sbox[F][h+1]=S;return!0}var v=a.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var _=this._keyPriorReset=this._key,x=_.words,p=_.sigBytes/4;y(d,x,p)}},encryptBlock:function(_,x){var p=u(d,_[x],_[x+1]);_[x]=p.left,_[x+1]=p.right},decryptBlock:function(_,x){var p=E(d,_[x],_[x+1]);_[x]=p.left,_[x+1]=p.right},blockSize:64/32,keySize:128/32,ivSize:64/32});r.Blowfish=n._createHelper(v)}(),t.Blowfish})}(Bi)),Bi.exports}(function(s,e){(function(t,r,i){s.exports=r(se(),cs(),x0(),p0(),rr(),m0(),sr(),zn(),ii(),v0(),Xn(),y0(),E0(),w0(),hi(),C0(),Ut(),Be(),_0(),D0(),b0(),A0(),T0(),S0(),R0(),F0(),B0(),k0(),I0(),$0(),H0(),P0(),O0(),M0(),N0())})(ee,function(t){return t})})(Nn);var q0=Nn.exports;const ir=Do(q0);class U0{constructor(){this.listeners={}}on(e,t){return this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t),()=>this.off(e,t)}off(e,t){this.listeners[e]&&(this.listeners[e]=this.listeners[e].filter(r=>r!==t))}emitLocal(e,t){this.listeners[e]&&this.listeners[e].forEach(r=>{try{r(t)}catch(i){console.error(`Error in event listener for ${e}:`,i)}})}emitToParent(e,t){this.emitLocal(e,t)}}const J=new U0;let st=null,Ce=null,pr=null;const Lt={setConfig(s){st=s},getConfig(){return st},decrypt(s,e=null,t=null){var r,i;try{const n=e||((r=st==null?void 0:st.env)==null?void 0:r.DECODE_IV)||"default_iv_1234",a=t||((i=st==null?void 0:st.env)==null?void 0:i.DECODE_KEY)||"default_key_1234",o=ir.enc.Base64.parse(s),l=ir.enc.Utf8.parse(a),c=ir.enc.Utf8.parse(n);return ir.AES.decrypt({ciphertext:o},l,{iv:c,mode:ir.mode.CTR,padding:ir.pad.NoPadding}).toString(ir.enc.Utf8)}catch(n){return console.log("ERROR ===> failed decrypt:",n),!1}},pushSound(){try{pr&&clearInterval(pr);const s=()=>{try{(!Ce||Ce.state==="closed")&&(Ce=new(window.AudioContext||window.webkitAudioContext)),Ce.state==="suspended"&&Ce.resume();const e=Ce.createOscillator(),t=Ce.createOscillator(),r=Ce.createGain();e.type="sine",t.type="sine",e.frequency.setValueAtTime(400,Ce.currentTime),t.frequency.setValueAtTime(450,Ce.currentTime);const i=Ce.createOscillator(),n=Ce.createGain();i.frequency.value=25,n.gain.value=15,i.connect(n),n.connect(e.frequency),n.connect(t.frequency),e.connect(r),t.connect(r),r.connect(Ce.destination),r.gain.setValueAtTime(0,Ce.currentTime),r.gain.linearRampToValueAtTime(.08,Ce.currentTime+.05),r.gain.setValueAtTime(.08,Ce.currentTime+1.2),r.gain.linearRampToValueAtTime(0,Ce.currentTime+1.3),i.start(),e.start(),t.start(),i.stop(Ce.currentTime+1.4),e.stop(Ce.currentTime+1.4),t.stop(Ce.currentTime+1.4)}catch(e){console.warn("Failed to play synthesized tone:",e)}};s(),pr=setInterval(s,3e3)}catch(s){console.warn("AudioContext initialization failed:",s)}},stopSound(){pr&&(clearInterval(pr),pr=null),Ce&&(Ce.close().catch(()=>{}),Ce=null)},pushNotification(s){J.emitToParent("show_notification",{message:s})},toHHMMSS(s){const e=parseInt(s,10),t=Math.floor(e/3600),r=Math.floor(e/60)%60,i=e%60;return[t,r,i].map(n=>n<10?"0"+n:n).filter((n,a)=>n!=="00"||a>0).join(":")},mute(s,e,t,r){s?e?s.unmute():s.mute():r&&(e?r.unmuteAudio():r.muteAudio()),t(!e)},hold(s,e,t,r){s?e?s.unhold():s.hold():r&&(e?r.unhold():r.hold()),t(!e)},async hangup(s,e,t,r,i,n,a,o){r&&await r(!1),i&&i(!1),n&&n(0),s&&s.current&&clearInterval(s.current),e?(await(e==null?void 0:e.terminate("hangup")),a&&a(!1),J.emitLocal("yeastarSession",!1)):t&&(await(t==null?void 0:t.hangup()),o&&o(!1),J.emitLocal("flashphonerCall",!1))},attachRemoteAudio(s){if(!s)return;let e=document.getElementById("ys-remote-audio");e||(e=document.createElement("audio"),e.id="ys-remote-audio",e.autoplay=!0,e.playsInline=!0,e.hidden=!0,document.body.appendChild(e)),e.srcObject=s,e.play().catch(()=>{console.warn("User gesture needed to play audio"),J.emitLocal("needUserGestureToPlay",!0)})},getContactName(s){return s&&((st==null?void 0:st.contacts)||{1001:"John Doe",1002:"Jane Smith","08123456789":"Alice Johnson",123:"Customer Support"})[s]||null}};//! moment.js
|
|
93
|
+
*/return t.mode.CTRGladman=function(){var r=t.lib.BlockCipherMode.extend();function i(o){if((o>>24&255)===255){var l=o>>16&255,c=o>>8&255,d=o&255;l===255?(l=0,c===255?(c=0,d===255?d=0:++d):++c):++l,o=0,o+=l<<16,o+=c<<8,o+=d}else o+=1<<24;return o}function n(o){return(o[0]=i(o[0]))===0&&(o[1]=i(o[1])),o}var a=r.Encryptor=r.extend({processBlock:function(o,l){var c=this._cipher,d=c.blockSize,g=this._iv,u=this._counter;g&&(u=this._counter=g.slice(0),this._iv=void 0),n(u);var y=u.slice(0);c.encryptBlock(y,0);for(var E=0;E<d;E++)o[l+E]^=y[E]}});return r.Decryptor=a,r}(),t.mode.CTRGladman})}(mi)),mi.exports}var vi={exports:{}},da;function b0(){return da||(da=1,function(s,e){(function(t,r,i){s.exports=r(se(),Be())})(ee,function(t){return t.mode.OFB=function(){var r=t.lib.BlockCipherMode.extend(),i=r.Encryptor=r.extend({processBlock:function(n,a){var o=this._cipher,l=o.blockSize,c=this._iv,d=this._keystream;c&&(d=this._keystream=c.slice(0),this._iv=void 0),o.encryptBlock(d,0);for(var g=0;g<l;g++)n[a+g]^=d[g]}});return r.Decryptor=i,r}(),t.mode.OFB})}(vi)),vi.exports}var Ei={exports:{}},la;function A0(){return la||(la=1,function(s,e){(function(t,r,i){s.exports=r(se(),Be())})(ee,function(t){return t.mode.ECB=function(){var r=t.lib.BlockCipherMode.extend();return r.Encryptor=r.extend({processBlock:function(i,n){this._cipher.encryptBlock(i,n)}}),r.Decryptor=r.extend({processBlock:function(i,n){this._cipher.decryptBlock(i,n)}}),r}(),t.mode.ECB})}(Ei)),Ei.exports}var yi={exports:{}},ha;function T0(){return ha||(ha=1,function(s,e){(function(t,r,i){s.exports=r(se(),Be())})(ee,function(t){return t.pad.AnsiX923={pad:function(r,i){var n=r.sigBytes,a=i*4,o=a-n%a,l=n+o-1;r.clamp(),r.words[l>>>2]|=o<<24-l%4*8,r.sigBytes+=o},unpad:function(r){var i=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=i}},t.pad.Ansix923})}(yi)),yi.exports}var wi={exports:{}},ua;function S0(){return ua||(ua=1,function(s,e){(function(t,r,i){s.exports=r(se(),Be())})(ee,function(t){return t.pad.Iso10126={pad:function(r,i){var n=i*4,a=n-r.sigBytes%n;r.concat(t.lib.WordArray.random(a-1)).concat(t.lib.WordArray.create([a<<24],1))},unpad:function(r){var i=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=i}},t.pad.Iso10126})}(wi)),wi.exports}var Ci={exports:{}},fa;function R0(){return fa||(fa=1,function(s,e){(function(t,r,i){s.exports=r(se(),Be())})(ee,function(t){return t.pad.Iso97971={pad:function(r,i){r.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(r,i)},unpad:function(r){t.pad.ZeroPadding.unpad(r),r.sigBytes--}},t.pad.Iso97971})}(Ci)),Ci.exports}var _i={exports:{}},ga;function F0(){return ga||(ga=1,function(s,e){(function(t,r,i){s.exports=r(se(),Be())})(ee,function(t){return t.pad.ZeroPadding={pad:function(r,i){var n=i*4;r.clamp(),r.sigBytes+=n-(r.sigBytes%n||n)},unpad:function(r){for(var i=r.words,n=r.sigBytes-1,n=r.sigBytes-1;n>=0;n--)if(i[n>>>2]>>>24-n%4*8&255){r.sigBytes=n+1;break}}},t.pad.ZeroPadding})}(_i)),_i.exports}var Di={exports:{}},xa;function B0(){return xa||(xa=1,function(s,e){(function(t,r,i){s.exports=r(se(),Be())})(ee,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})}(Di)),Di.exports}var bi={exports:{}},pa;function k0(){return pa||(pa=1,function(s,e){(function(t,r,i){s.exports=r(se(),Be())})(ee,function(t){return function(r){var i=t,n=i.lib,a=n.CipherParams,o=i.enc,l=o.Hex,c=i.format;c.Hex={stringify:function(d){return d.ciphertext.toString(l)},parse:function(d){var g=l.parse(d);return a.create({ciphertext:g})}}}(),t.format.Hex})}(bi)),bi.exports}var Ai={exports:{}},ma;function I0(){return ma||(ma=1,function(s,e){(function(t,r,i){s.exports=r(se(),rr(),sr(),Ut(),Be())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.BlockCipher,a=r.algo,o=[],l=[],c=[],d=[],g=[],u=[],y=[],E=[],v=[],_=[];(function(){for(var w=[],D=0;D<256;D++)D<128?w[D]=D<<1:w[D]=D<<1^283;for(var S=0,T=0,D=0;D<256;D++){var F=T^T<<1^T<<2^T<<3^T<<4;F=F>>>8^F&255^99,o[S]=F,l[F]=S;var h=w[S],M=w[h],A=w[M],f=w[F]*257^F*16843008;c[S]=f<<24|f>>>8,d[S]=f<<16|f>>>16,g[S]=f<<8|f>>>24,u[S]=f;var f=A*16843009^M*65537^h*257^S*16843008;y[F]=f<<24|f>>>8,E[F]=f<<16|f>>>16,v[F]=f<<8|f>>>24,_[F]=f,S?(S=h^w[w[w[A^h]]],T^=w[w[T]]):S=T=1}})();var x=[0,1,2,4,8,16,32,64,128,27,54],p=a.AES=n.extend({_doReset:function(){var w;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var D=this._keyPriorReset=this._key,S=D.words,T=D.sigBytes/4,F=this._nRounds=T+6,h=(F+1)*4,M=this._keySchedule=[],A=0;A<h;A++)A<T?M[A]=S[A]:(w=M[A-1],A%T?T>6&&A%T==4&&(w=o[w>>>24]<<24|o[w>>>16&255]<<16|o[w>>>8&255]<<8|o[w&255]):(w=w<<8|w>>>24,w=o[w>>>24]<<24|o[w>>>16&255]<<16|o[w>>>8&255]<<8|o[w&255],w^=x[A/T|0]<<24),M[A]=M[A-T]^w);for(var f=this._invKeySchedule=[],C=0;C<h;C++){var A=h-C;if(C%4)var w=M[A];else var w=M[A-4];C<4||A<=4?f[C]=w:f[C]=y[o[w>>>24]]^E[o[w>>>16&255]]^v[o[w>>>8&255]]^_[o[w&255]]}}},encryptBlock:function(w,D){this._doCryptBlock(w,D,this._keySchedule,c,d,g,u,o)},decryptBlock:function(w,D){var S=w[D+1];w[D+1]=w[D+3],w[D+3]=S,this._doCryptBlock(w,D,this._invKeySchedule,y,E,v,_,l);var S=w[D+1];w[D+1]=w[D+3],w[D+3]=S},_doCryptBlock:function(w,D,S,T,F,h,M,A){for(var f=this._nRounds,C=w[D]^S[0],m=w[D+1]^S[1],q=w[D+2]^S[2],N=w[D+3]^S[3],z=4,G=1;G<f;G++){var ie=T[C>>>24]^F[m>>>16&255]^h[q>>>8&255]^M[N&255]^S[z++],he=T[m>>>24]^F[q>>>16&255]^h[N>>>8&255]^M[C&255]^S[z++],ue=T[q>>>24]^F[N>>>16&255]^h[C>>>8&255]^M[m&255]^S[z++],k=T[N>>>24]^F[C>>>16&255]^h[m>>>8&255]^M[q&255]^S[z++];C=ie,m=he,q=ue,N=k}var ie=(A[C>>>24]<<24|A[m>>>16&255]<<16|A[q>>>8&255]<<8|A[N&255])^S[z++],he=(A[m>>>24]<<24|A[q>>>16&255]<<16|A[N>>>8&255]<<8|A[C&255])^S[z++],ue=(A[q>>>24]<<24|A[N>>>16&255]<<16|A[C>>>8&255]<<8|A[m&255])^S[z++],k=(A[N>>>24]<<24|A[C>>>16&255]<<16|A[m>>>8&255]<<8|A[q&255])^S[z++];w[D]=ie,w[D+1]=he,w[D+2]=ue,w[D+3]=k},keySize:256/32});r.AES=n._createHelper(p)}(),t.AES})}(Ai)),Ai.exports}var Ti={exports:{}},va;function $0(){return va||(va=1,function(s,e){(function(t,r,i){s.exports=r(se(),rr(),sr(),Ut(),Be())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.WordArray,a=i.BlockCipher,o=r.algo,l=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],c=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],d=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],g=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],u=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],y=o.DES=a.extend({_doReset:function(){for(var x=this._key,p=x.words,w=[],D=0;D<56;D++){var S=l[D]-1;w[D]=p[S>>>5]>>>31-S%32&1}for(var T=this._subKeys=[],F=0;F<16;F++){for(var h=T[F]=[],M=d[F],D=0;D<24;D++)h[D/6|0]|=w[(c[D]-1+M)%28]<<31-D%6,h[4+(D/6|0)]|=w[28+(c[D+24]-1+M)%28]<<31-D%6;h[0]=h[0]<<1|h[0]>>>31;for(var D=1;D<7;D++)h[D]=h[D]>>>(D-1)*4+3;h[7]=h[7]<<5|h[7]>>>27}for(var A=this._invSubKeys=[],D=0;D<16;D++)A[D]=T[15-D]},encryptBlock:function(x,p){this._doCryptBlock(x,p,this._subKeys)},decryptBlock:function(x,p){this._doCryptBlock(x,p,this._invSubKeys)},_doCryptBlock:function(x,p,w){this._lBlock=x[p],this._rBlock=x[p+1],E.call(this,4,252645135),E.call(this,16,65535),v.call(this,2,858993459),v.call(this,8,16711935),E.call(this,1,1431655765);for(var D=0;D<16;D++){for(var S=w[D],T=this._lBlock,F=this._rBlock,h=0,M=0;M<8;M++)h|=g[M][((F^S[M])&u[M])>>>0];this._lBlock=F,this._rBlock=T^h}var A=this._lBlock;this._lBlock=this._rBlock,this._rBlock=A,E.call(this,1,1431655765),v.call(this,8,16711935),v.call(this,2,858993459),E.call(this,16,65535),E.call(this,4,252645135),x[p]=this._lBlock,x[p+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function E(x,p){var w=(this._lBlock>>>x^this._rBlock)&p;this._rBlock^=w,this._lBlock^=w<<x}function v(x,p){var w=(this._rBlock>>>x^this._lBlock)&p;this._lBlock^=w,this._rBlock^=w<<x}r.DES=a._createHelper(y);var _=o.TripleDES=a.extend({_doReset:function(){var x=this._key,p=x.words;if(p.length!==2&&p.length!==4&&p.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var w=p.slice(0,2),D=p.length<4?p.slice(0,2):p.slice(2,4),S=p.length<6?p.slice(0,2):p.slice(4,6);this._des1=y.createEncryptor(n.create(w)),this._des2=y.createEncryptor(n.create(D)),this._des3=y.createEncryptor(n.create(S))},encryptBlock:function(x,p){this._des1.encryptBlock(x,p),this._des2.decryptBlock(x,p),this._des3.encryptBlock(x,p)},decryptBlock:function(x,p){this._des3.decryptBlock(x,p),this._des2.encryptBlock(x,p),this._des1.decryptBlock(x,p)},keySize:192/32,ivSize:64/32,blockSize:64/32});r.TripleDES=a._createHelper(_)}(),t.TripleDES})}(Ti)),Ti.exports}var Si={exports:{}},Ea;function H0(){return Ea||(Ea=1,function(s,e){(function(t,r,i){s.exports=r(se(),rr(),sr(),Ut(),Be())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.StreamCipher,a=r.algo,o=a.RC4=n.extend({_doReset:function(){for(var d=this._key,g=d.words,u=d.sigBytes,y=this._S=[],E=0;E<256;E++)y[E]=E;for(var E=0,v=0;E<256;E++){var _=E%u,x=g[_>>>2]>>>24-_%4*8&255;v=(v+y[E]+x)%256;var p=y[E];y[E]=y[v],y[v]=p}this._i=this._j=0},_doProcessBlock:function(d,g){d[g]^=l.call(this)},keySize:256/32,ivSize:0});function l(){for(var d=this._S,g=this._i,u=this._j,y=0,E=0;E<4;E++){g=(g+1)%256,u=(u+d[g])%256;var v=d[g];d[g]=d[u],d[u]=v,y|=d[(d[g]+d[u])%256]<<24-E*8}return this._i=g,this._j=u,y}r.RC4=n._createHelper(o);var c=a.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var d=this.cfg.drop;d>0;d--)l.call(this)}});r.RC4Drop=n._createHelper(c)}(),t.RC4})}(Si)),Si.exports}var Ri={exports:{}},ya;function P0(){return ya||(ya=1,function(s,e){(function(t,r,i){s.exports=r(se(),rr(),sr(),Ut(),Be())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.StreamCipher,a=r.algo,o=[],l=[],c=[],d=a.Rabbit=n.extend({_doReset:function(){for(var u=this._key.words,y=this.cfg.iv,E=0;E<4;E++)u[E]=(u[E]<<8|u[E]>>>24)&16711935|(u[E]<<24|u[E]>>>8)&4278255360;var v=this._X=[u[0],u[3]<<16|u[2]>>>16,u[1],u[0]<<16|u[3]>>>16,u[2],u[1]<<16|u[0]>>>16,u[3],u[2]<<16|u[1]>>>16],_=this._C=[u[2]<<16|u[2]>>>16,u[0]&4294901760|u[1]&65535,u[3]<<16|u[3]>>>16,u[1]&4294901760|u[2]&65535,u[0]<<16|u[0]>>>16,u[2]&4294901760|u[3]&65535,u[1]<<16|u[1]>>>16,u[3]&4294901760|u[0]&65535];this._b=0;for(var E=0;E<4;E++)g.call(this);for(var E=0;E<8;E++)_[E]^=v[E+4&7];if(y){var x=y.words,p=x[0],w=x[1],D=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360,S=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,T=D>>>16|S&4294901760,F=S<<16|D&65535;_[0]^=D,_[1]^=T,_[2]^=S,_[3]^=F,_[4]^=D,_[5]^=T,_[6]^=S,_[7]^=F;for(var E=0;E<4;E++)g.call(this)}},_doProcessBlock:function(u,y){var E=this._X;g.call(this),o[0]=E[0]^E[5]>>>16^E[3]<<16,o[1]=E[2]^E[7]>>>16^E[5]<<16,o[2]=E[4]^E[1]>>>16^E[7]<<16,o[3]=E[6]^E[3]>>>16^E[1]<<16;for(var v=0;v<4;v++)o[v]=(o[v]<<8|o[v]>>>24)&16711935|(o[v]<<24|o[v]>>>8)&4278255360,u[y+v]^=o[v]},blockSize:128/32,ivSize:64/32});function g(){for(var u=this._X,y=this._C,E=0;E<8;E++)l[E]=y[E];y[0]=y[0]+1295307597+this._b|0,y[1]=y[1]+3545052371+(y[0]>>>0<l[0]>>>0?1:0)|0,y[2]=y[2]+886263092+(y[1]>>>0<l[1]>>>0?1:0)|0,y[3]=y[3]+1295307597+(y[2]>>>0<l[2]>>>0?1:0)|0,y[4]=y[4]+3545052371+(y[3]>>>0<l[3]>>>0?1:0)|0,y[5]=y[5]+886263092+(y[4]>>>0<l[4]>>>0?1:0)|0,y[6]=y[6]+1295307597+(y[5]>>>0<l[5]>>>0?1:0)|0,y[7]=y[7]+3545052371+(y[6]>>>0<l[6]>>>0?1:0)|0,this._b=y[7]>>>0<l[7]>>>0?1:0;for(var E=0;E<8;E++){var v=u[E]+y[E],_=v&65535,x=v>>>16,p=((_*_>>>17)+_*x>>>15)+x*x,w=((v&4294901760)*v|0)+((v&65535)*v|0);c[E]=p^w}u[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,u[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,u[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,u[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,u[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,u[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,u[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,u[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}r.Rabbit=n._createHelper(d)}(),t.Rabbit})}(Ri)),Ri.exports}var Fi={exports:{}},wa;function O0(){return wa||(wa=1,function(s,e){(function(t,r,i){s.exports=r(se(),rr(),sr(),Ut(),Be())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.StreamCipher,a=r.algo,o=[],l=[],c=[],d=a.RabbitLegacy=n.extend({_doReset:function(){var u=this._key.words,y=this.cfg.iv,E=this._X=[u[0],u[3]<<16|u[2]>>>16,u[1],u[0]<<16|u[3]>>>16,u[2],u[1]<<16|u[0]>>>16,u[3],u[2]<<16|u[1]>>>16],v=this._C=[u[2]<<16|u[2]>>>16,u[0]&4294901760|u[1]&65535,u[3]<<16|u[3]>>>16,u[1]&4294901760|u[2]&65535,u[0]<<16|u[0]>>>16,u[2]&4294901760|u[3]&65535,u[1]<<16|u[1]>>>16,u[3]&4294901760|u[0]&65535];this._b=0;for(var _=0;_<4;_++)g.call(this);for(var _=0;_<8;_++)v[_]^=E[_+4&7];if(y){var x=y.words,p=x[0],w=x[1],D=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360,S=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,T=D>>>16|S&4294901760,F=S<<16|D&65535;v[0]^=D,v[1]^=T,v[2]^=S,v[3]^=F,v[4]^=D,v[5]^=T,v[6]^=S,v[7]^=F;for(var _=0;_<4;_++)g.call(this)}},_doProcessBlock:function(u,y){var E=this._X;g.call(this),o[0]=E[0]^E[5]>>>16^E[3]<<16,o[1]=E[2]^E[7]>>>16^E[5]<<16,o[2]=E[4]^E[1]>>>16^E[7]<<16,o[3]=E[6]^E[3]>>>16^E[1]<<16;for(var v=0;v<4;v++)o[v]=(o[v]<<8|o[v]>>>24)&16711935|(o[v]<<24|o[v]>>>8)&4278255360,u[y+v]^=o[v]},blockSize:128/32,ivSize:64/32});function g(){for(var u=this._X,y=this._C,E=0;E<8;E++)l[E]=y[E];y[0]=y[0]+1295307597+this._b|0,y[1]=y[1]+3545052371+(y[0]>>>0<l[0]>>>0?1:0)|0,y[2]=y[2]+886263092+(y[1]>>>0<l[1]>>>0?1:0)|0,y[3]=y[3]+1295307597+(y[2]>>>0<l[2]>>>0?1:0)|0,y[4]=y[4]+3545052371+(y[3]>>>0<l[3]>>>0?1:0)|0,y[5]=y[5]+886263092+(y[4]>>>0<l[4]>>>0?1:0)|0,y[6]=y[6]+1295307597+(y[5]>>>0<l[5]>>>0?1:0)|0,y[7]=y[7]+3545052371+(y[6]>>>0<l[6]>>>0?1:0)|0,this._b=y[7]>>>0<l[7]>>>0?1:0;for(var E=0;E<8;E++){var v=u[E]+y[E],_=v&65535,x=v>>>16,p=((_*_>>>17)+_*x>>>15)+x*x,w=((v&4294901760)*v|0)+((v&65535)*v|0);c[E]=p^w}u[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,u[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,u[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,u[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,u[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,u[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,u[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,u[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}r.RabbitLegacy=n._createHelper(d)}(),t.RabbitLegacy})}(Fi)),Fi.exports}var Bi={exports:{}},Ca;function M0(){return Ca||(Ca=1,function(s,e){(function(t,r,i){s.exports=r(se(),rr(),sr(),Ut(),Be())})(ee,function(t){return function(){var r=t,i=r.lib,n=i.BlockCipher,a=r.algo;const o=16,l=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],c=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var d={pbox:[],sbox:[]};function g(_,x){let p=x>>24&255,w=x>>16&255,D=x>>8&255,S=x&255,T=_.sbox[0][p]+_.sbox[1][w];return T=T^_.sbox[2][D],T=T+_.sbox[3][S],T}function u(_,x,p){let w=x,D=p,S;for(let T=0;T<o;++T)w=w^_.pbox[T],D=g(_,w)^D,S=w,w=D,D=S;return S=w,w=D,D=S,D=D^_.pbox[o],w=w^_.pbox[o+1],{left:w,right:D}}function y(_,x,p){let w=x,D=p,S;for(let T=o+1;T>1;--T)w=w^_.pbox[T],D=g(_,w)^D,S=w,w=D,D=S;return S=w,w=D,D=S,D=D^_.pbox[1],w=w^_.pbox[0],{left:w,right:D}}function E(_,x,p){for(let F=0;F<4;F++){_.sbox[F]=[];for(let h=0;h<256;h++)_.sbox[F][h]=c[F][h]}let w=0;for(let F=0;F<o+2;F++)_.pbox[F]=l[F]^x[w],w++,w>=p&&(w=0);let D=0,S=0,T=0;for(let F=0;F<o+2;F+=2)T=u(_,D,S),D=T.left,S=T.right,_.pbox[F]=D,_.pbox[F+1]=S;for(let F=0;F<4;F++)for(let h=0;h<256;h+=2)T=u(_,D,S),D=T.left,S=T.right,_.sbox[F][h]=D,_.sbox[F][h+1]=S;return!0}var v=a.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var _=this._keyPriorReset=this._key,x=_.words,p=_.sigBytes/4;E(d,x,p)}},encryptBlock:function(_,x){var p=u(d,_[x],_[x+1]);_[x]=p.left,_[x+1]=p.right},decryptBlock:function(_,x){var p=y(d,_[x],_[x+1]);_[x]=p.left,_[x+1]=p.right},blockSize:64/32,keySize:128/32,ivSize:64/32});r.Blowfish=n._createHelper(v)}(),t.Blowfish})}(Bi)),Bi.exports}(function(s,e){(function(t,r,i){s.exports=r(se(),cs(),g0(),x0(),rr(),p0(),sr(),zn(),ii(),m0(),Xn(),v0(),E0(),y0(),hi(),w0(),Ut(),Be(),C0(),_0(),D0(),b0(),A0(),T0(),S0(),R0(),F0(),B0(),k0(),I0(),$0(),H0(),P0(),O0(),M0())})(ee,function(t){return t})})(Nn);var N0=Nn.exports;const ir=Do(N0);class q0{constructor(){this.listeners={}}on(e,t){return this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t),()=>this.off(e,t)}off(e,t){this.listeners[e]&&(this.listeners[e]=this.listeners[e].filter(r=>r!==t))}emitLocal(e,t){this.listeners[e]&&this.listeners[e].forEach(r=>{try{r(t)}catch(i){console.error(`Error in event listener for ${e}:`,i)}})}emitToParent(e,t){this.emitLocal(e,t)}}const J=new q0;let st=null,we=null,pr=null;const Lt={setConfig(s){st=s},getConfig(){return st},decrypt(s,e=null,t=null){var r,i;try{const n=e||((r=st==null?void 0:st.env)==null?void 0:r.DECODE_IV)||"default_iv_1234",a=t||((i=st==null?void 0:st.env)==null?void 0:i.DECODE_KEY)||"default_key_1234",o=ir.enc.Base64.parse(s),l=ir.enc.Utf8.parse(a),c=ir.enc.Utf8.parse(n);return ir.AES.decrypt({ciphertext:o},l,{iv:c,mode:ir.mode.CTR,padding:ir.pad.NoPadding}).toString(ir.enc.Utf8)}catch(n){return console.log("ERROR ===> failed decrypt:",n),!1}},pushSound(){try{pr&&clearInterval(pr);const s=()=>{try{(!we||we.state==="closed")&&(we=new(window.AudioContext||window.webkitAudioContext)),we.state==="suspended"&&we.resume();const e=we.createOscillator(),t=we.createOscillator(),r=we.createGain();e.type="sine",t.type="sine",e.frequency.setValueAtTime(400,we.currentTime),t.frequency.setValueAtTime(450,we.currentTime);const i=we.createOscillator(),n=we.createGain();i.frequency.value=25,n.gain.value=15,i.connect(n),n.connect(e.frequency),n.connect(t.frequency),e.connect(r),t.connect(r),r.connect(we.destination),r.gain.setValueAtTime(0,we.currentTime),r.gain.linearRampToValueAtTime(.08,we.currentTime+.05),r.gain.setValueAtTime(.08,we.currentTime+1.2),r.gain.linearRampToValueAtTime(0,we.currentTime+1.3),i.start(),e.start(),t.start(),i.stop(we.currentTime+1.4),e.stop(we.currentTime+1.4),t.stop(we.currentTime+1.4)}catch(e){console.warn("Failed to play synthesized tone:",e)}};s(),pr=setInterval(s,3e3)}catch(s){console.warn("AudioContext initialization failed:",s)}},stopSound(){pr&&(clearInterval(pr),pr=null),we&&(we.close().catch(()=>{}),we=null)},pushNotification(s){J.emitToParent("show_notification",{message:s})},toHHMMSS(s){const e=parseInt(s,10),t=Math.floor(e/3600),r=Math.floor(e/60)%60,i=e%60;return[t,r,i].map(n=>n<10?"0"+n:n).filter((n,a)=>n!=="00"||a>0).join(":")},mute(s,e,t,r){s?e?s.unmute():s.mute():r&&(e?r.unmuteAudio():r.muteAudio()),t(!e)},hold(s,e,t,r){s?e?s.unhold():s.hold():r&&(e?r.unhold():r.hold()),t(!e)},async hangup(s,e,t,r,i,n,a,o){r&&await r(!1),i&&i(!1),n&&n(0),s&&s.current&&clearInterval(s.current),e?(await(e==null?void 0:e.terminate("hangup")),a&&a(!1),J.emitLocal("yeastarSession",!1)):t&&(await(t==null?void 0:t.hangup()),o&&o(!1),J.emitLocal("flashphonerCall",!1))},attachRemoteAudio(s){if(!s)return;let e=document.getElementById("ys-remote-audio");e||(e=document.createElement("audio"),e.id="ys-remote-audio",e.autoplay=!0,e.playsInline=!0,e.hidden=!0,document.body.appendChild(e)),e.srcObject=s,e.play().catch(()=>{console.warn("User gesture needed to play audio"),J.emitLocal("needUserGestureToPlay",!0)})},getContactName(s){return s&&((st==null?void 0:st.contacts)||{1001:"John Doe",1002:"Jane Smith","08123456789":"Alice Johnson",123:"Customer Support"})[s]||null}};//! moment.js
|
|
97
94
|
//! version : 2.30.1
|
|
98
95
|
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
|
|
99
96
|
//! license : MIT
|
|
100
97
|
//! momentjs.com
|
|
101
|
-
var _a;function L(){return _a.apply(null,arguments)}function
|
|
98
|
+
var _a;function L(){return _a.apply(null,arguments)}function U0(s){_a=s}function it(s){return s instanceof Array||Object.prototype.toString.call(s)==="[object Array]"}function nr(s){return s!=null&&Object.prototype.toString.call(s)==="[object Object]"}function ce(s,e){return Object.prototype.hasOwnProperty.call(s,e)}function ki(s){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(s).length===0;var e;for(e in s)if(ce(s,e))return!1;return!0}function Ye(s){return s===void 0}function _t(s){return typeof s=="number"||Object.prototype.toString.call(s)==="[object Number]"}function Or(s){return s instanceof Date||Object.prototype.toString.call(s)==="[object Date]"}function Da(s,e){var t=[],r,i=s.length;for(r=0;r<i;++r)t.push(e(s[r],r));return t}function jt(s,e){for(var t in e)ce(e,t)&&(s[t]=e[t]);return ce(e,"toString")&&(s.toString=e.toString),ce(e,"valueOf")&&(s.valueOf=e.valueOf),s}function gt(s,e,t,r){return Ja(s,e,t,r,!0).utc()}function L0(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function Q(s){return s._pf==null&&(s._pf=L0()),s._pf}var Ii;Array.prototype.some?Ii=Array.prototype.some:Ii=function(s){var e=Object(this),t=e.length>>>0,r;for(r=0;r<t;r++)if(r in e&&s.call(this,e[r],r,e))return!0;return!1};function $i(s){var e=null,t=!1,r=s._d&&!isNaN(s._d.getTime());if(r&&(e=Q(s),t=Ii.call(e.parsedDateParts,function(i){return i!=null}),r=e.overflow<0&&!e.empty&&!e.invalidEra&&!e.invalidMonth&&!e.invalidWeekday&&!e.weekdayMismatch&&!e.nullInput&&!e.invalidFormat&&!e.userInvalidated&&(!e.meridiem||e.meridiem&&t),s._strict&&(r=r&&e.charsLeftOver===0&&e.unusedTokens.length===0&&e.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(s))s._isValid=r;else return r;return s._isValid}function ds(s){var e=gt(NaN);return s!=null?jt(Q(e),s):Q(e).userInvalidated=!0,e}var ba=L.momentProperties=[],Hi=!1;function Pi(s,e){var t,r,i,n=ba.length;if(Ye(e._isAMomentObject)||(s._isAMomentObject=e._isAMomentObject),Ye(e._i)||(s._i=e._i),Ye(e._f)||(s._f=e._f),Ye(e._l)||(s._l=e._l),Ye(e._strict)||(s._strict=e._strict),Ye(e._tzm)||(s._tzm=e._tzm),Ye(e._isUTC)||(s._isUTC=e._isUTC),Ye(e._offset)||(s._offset=e._offset),Ye(e._pf)||(s._pf=Q(e)),Ye(e._locale)||(s._locale=e._locale),n>0)for(t=0;t<n;t++)r=ba[t],i=e[r],Ye(i)||(s[r]=i);return s}function Mr(s){Pi(this,s),this._d=new Date(s._d!=null?s._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),Hi===!1&&(Hi=!0,L.updateOffset(this),Hi=!1)}function nt(s){return s instanceof Mr||s!=null&&s._isAMomentObject!=null}function Aa(s){L.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+s)}function Xe(s,e){var t=!0;return jt(function(){if(L.deprecationHandler!=null&&L.deprecationHandler(null,s),t){var r=[],i,n,a,o=arguments.length;for(n=0;n<o;n++){if(i="",typeof arguments[n]=="object"){i+=`
|
|
102
99
|
[`+n+"] ";for(a in arguments[0])ce(arguments[0],a)&&(i+=a+": "+arguments[0][a]+", ");i=i.slice(0,-2)}else i=arguments[n];r.push(i)}Aa(s+`
|
|
103
100
|
Arguments: `+Array.prototype.slice.call(r).join("")+`
|
|
104
|
-
`+new Error().stack),t=!1}return e.apply(this,arguments)},e)}var Ta={};function Sa(s,e){L.deprecationHandler!=null&&L.deprecationHandler(s,e),Ta[s]||(Aa(e),Ta[s]=!0)}L.suppressDeprecationWarnings=!1,L.deprecationHandler=null;function xt(s){return typeof Function<"u"&&s instanceof Function||Object.prototype.toString.call(s)==="[object Function]"}function Y0(s){var e,t;for(t in s)ce(s,t)&&(e=s[t],xt(e)?this[t]=e:this["_"+t]=e);this._config=s,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function Oi(s,e){var t=jt({},s),r;for(r in e)ce(e,r)&&(nr(s[r])&&nr(e[r])?(t[r]={},jt(t[r],s[r]),jt(t[r],e[r])):e[r]!=null?t[r]=e[r]:delete t[r]);for(r in s)ce(s,r)&&!ce(e,r)&&nr(s[r])&&(t[r]=jt({},t[r]));return t}function Mi(s){s!=null&&this.set(s)}var Ni;Object.keys?Ni=Object.keys:Ni=function(s){var e,t=[];for(e in s)ce(s,e)&&t.push(e);return t};var W0={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function G0(s,e,t){var r=this._calendar[s]||this._calendar.sameElse;return xt(r)?r.call(e,t):r}function pt(s,e,t){var r=""+Math.abs(s),i=e-r.length,n=s>=0;return(n?t?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+r}var qi=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,ls=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Ui={},mr={};function V(s,e,t,r){var i=r;typeof r=="string"&&(i=function(){return this[r]()}),s&&(mr[s]=i),e&&(mr[e[0]]=function(){return pt(i.apply(this,arguments),e[1],e[2])}),t&&(mr[t]=function(){return this.localeData().ordinal(i.apply(this,arguments),s)})}function V0(s){return s.match(/\[[\s\S]/)?s.replace(/^\[|\]$/g,""):s.replace(/\\/g,"")}function z0(s){var e=s.match(qi),t,r;for(t=0,r=e.length;t<r;t++)mr[e[t]]?e[t]=mr[e[t]]:e[t]=V0(e[t]);return function(i){var n="",a;for(a=0;a<r;a++)n+=xt(e[a])?e[a].call(i,s):e[a];return n}}function hs(s,e){return s.isValid()?(e=Ra(e,s.localeData()),Ui[e]=Ui[e]||z0(e),Ui[e](s)):s.localeData().invalidDate()}function Ra(s,e){var t=5;function r(i){return e.longDateFormat(i)||i}for(ls.lastIndex=0;t>=0&&ls.test(s);)s=s.replace(ls,r),ls.lastIndex=0,t-=1;return s}var K0={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function Z0(s){var e=this._longDateFormat[s],t=this._longDateFormat[s.toUpperCase()];return e||!t?e:(this._longDateFormat[s]=t.match(qi).map(function(r){return r==="MMMM"||r==="MM"||r==="DD"||r==="dddd"?r.slice(1):r}).join(""),this._longDateFormat[s])}var J0="Invalid date";function X0(){return this._invalidDate}var Q0="%d",ec=/\d{1,2}/;function tc(s){return this._ordinal.replace("%d",s)}var rc={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function sc(s,e,t,r){var i=this._relativeTime[t];return xt(i)?i(s,e,t,r):i.replace(/%d/i,s)}function ic(s,e){var t=this._relativeTime[s>0?"future":"past"];return xt(t)?t(e):t.replace(/%s/i,e)}var Fa={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function Qe(s){return typeof s=="string"?Fa[s]||Fa[s.toLowerCase()]:void 0}function Li(s){var e={},t,r;for(r in s)ce(s,r)&&(t=Qe(r),t&&(e[t]=s[r]));return e}var nc={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function ac(s){var e=[],t;for(t in s)ce(s,t)&&e.push({unit:t,priority:nc[t]});return e.sort(function(r,i){return r.priority-i.priority}),e}var Ba=/\d/,ze=/\d\d/,ka=/\d{3}/,ji=/\d{4}/,us=/[+-]?\d{6}/,ve=/\d\d?/,Ia=/\d\d\d\d?/,$a=/\d\d\d\d\d\d?/,fs=/\d{1,3}/,Yi=/\d{1,4}/,gs=/[+-]?\d{1,6}/,vr=/\d+/,xs=/[+-]?\d+/,oc=/Z|[+-]\d\d:?\d\d/gi,ps=/Z|[+-]\d\d(?::?\d\d)?/gi,cc=/[+-]?\d+(\.\d{1,3})?/,Nr=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,yr=/^[1-9]\d?/,Wi=/^([1-9]\d|\d)/,ms;ms={};function W(s,e,t){ms[s]=xt(e)?e:function(r,i){return r&&t?t:e}}function dc(s,e){return ce(ms,s)?ms[s](e._strict,e._locale):new RegExp(lc(s))}function lc(s){return Dt(s.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,r,i,n){return t||r||i||n}))}function Dt(s){return s.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function et(s){return s<0?Math.ceil(s)||0:Math.floor(s)}function te(s){var e=+s,t=0;return e!==0&&isFinite(e)&&(t=et(e)),t}var Gi={};function xe(s,e){var t,r=e,i;for(typeof s=="string"&&(s=[s]),_t(e)&&(r=function(n,a){a[e]=te(n)}),i=s.length,t=0;t<i;t++)Gi[s[t]]=r}function qr(s,e){xe(s,function(t,r,i,n){i._w=i._w||{},e(t,i._w,i,n)})}function hc(s,e,t){e!=null&&ce(Gi,s)&&Gi[s](e,t._a,t,s)}function vs(s){return s%4===0&&s%100!==0||s%400===0}var Pe=0,bt=1,mt=2,Se=3,at=4,At=5,ar=6,uc=7,fc=8;V("Y",0,0,function(){var s=this.year();return s<=9999?pt(s,4):"+"+s}),V(0,["YY",2],0,function(){return this.year()%100}),V(0,["YYYY",4],0,"year"),V(0,["YYYYY",5],0,"year"),V(0,["YYYYYY",6,!0],0,"year"),W("Y",xs),W("YY",ve,ze),W("YYYY",Yi,ji),W("YYYYY",gs,us),W("YYYYYY",gs,us),xe(["YYYYY","YYYYYY"],Pe),xe("YYYY",function(s,e){e[Pe]=s.length===2?L.parseTwoDigitYear(s):te(s)}),xe("YY",function(s,e){e[Pe]=L.parseTwoDigitYear(s)}),xe("Y",function(s,e){e[Pe]=parseInt(s,10)});function Ur(s){return vs(s)?366:365}L.parseTwoDigitYear=function(s){return te(s)+(te(s)>68?1900:2e3)};var Ha=Er("FullYear",!0);function gc(){return vs(this.year())}function Er(s,e){return function(t){return t!=null?(Pa(this,s,t),L.updateOffset(this,e),this):Lr(this,s)}}function Lr(s,e){if(!s.isValid())return NaN;var t=s._d,r=s._isUTC;switch(e){case"Milliseconds":return r?t.getUTCMilliseconds():t.getMilliseconds();case"Seconds":return r?t.getUTCSeconds():t.getSeconds();case"Minutes":return r?t.getUTCMinutes():t.getMinutes();case"Hours":return r?t.getUTCHours():t.getHours();case"Date":return r?t.getUTCDate():t.getDate();case"Day":return r?t.getUTCDay():t.getDay();case"Month":return r?t.getUTCMonth():t.getMonth();case"FullYear":return r?t.getUTCFullYear():t.getFullYear();default:return NaN}}function Pa(s,e,t){var r,i,n,a,o;if(!(!s.isValid()||isNaN(t))){switch(r=s._d,i=s._isUTC,e){case"Milliseconds":return void(i?r.setUTCMilliseconds(t):r.setMilliseconds(t));case"Seconds":return void(i?r.setUTCSeconds(t):r.setSeconds(t));case"Minutes":return void(i?r.setUTCMinutes(t):r.setMinutes(t));case"Hours":return void(i?r.setUTCHours(t):r.setHours(t));case"Date":return void(i?r.setUTCDate(t):r.setDate(t));case"FullYear":break;default:return}n=t,a=s.month(),o=s.date(),o=o===29&&a===1&&!vs(n)?28:o,i?r.setUTCFullYear(n,a,o):r.setFullYear(n,a,o)}}function xc(s){return s=Qe(s),xt(this[s])?this[s]():this}function pc(s,e){if(typeof s=="object"){s=Li(s);var t=ac(s),r,i=t.length;for(r=0;r<i;r++)this[t[r].unit](s[t[r].unit])}else if(s=Qe(s),xt(this[s]))return this[s](e);return this}function mc(s,e){return(s%e+e)%e}var _e;Array.prototype.indexOf?_e=Array.prototype.indexOf:_e=function(s){var e;for(e=0;e<this.length;++e)if(this[e]===s)return e;return-1};function Vi(s,e){if(isNaN(s)||isNaN(e))return NaN;var t=mc(e,12);return s+=(e-t)/12,t===1?vs(s)?29:28:31-t%7%2}V("M",["MM",2],"Mo",function(){return this.month()+1}),V("MMM",0,0,function(s){return this.localeData().monthsShort(this,s)}),V("MMMM",0,0,function(s){return this.localeData().months(this,s)}),W("M",ve,yr),W("MM",ve,ze),W("MMM",function(s,e){return e.monthsShortRegex(s)}),W("MMMM",function(s,e){return e.monthsRegex(s)}),xe(["M","MM"],function(s,e){e[bt]=te(s)-1}),xe(["MMM","MMMM"],function(s,e,t,r){var i=t._locale.monthsParse(s,r,t._strict);i!=null?e[bt]=i:Q(t).invalidMonth=s});var vc="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Oa="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Ma=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,yc=Nr,Ec=Nr;function wc(s,e){return s?it(this._months)?this._months[s.month()]:this._months[(this._months.isFormat||Ma).test(e)?"format":"standalone"][s.month()]:it(this._months)?this._months:this._months.standalone}function Cc(s,e){return s?it(this._monthsShort)?this._monthsShort[s.month()]:this._monthsShort[Ma.test(e)?"format":"standalone"][s.month()]:it(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function _c(s,e,t){var r,i,n,a=s.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],r=0;r<12;++r)n=gt([2e3,r]),this._shortMonthsParse[r]=this.monthsShort(n,"").toLocaleLowerCase(),this._longMonthsParse[r]=this.months(n,"").toLocaleLowerCase();return t?e==="MMM"?(i=_e.call(this._shortMonthsParse,a),i!==-1?i:null):(i=_e.call(this._longMonthsParse,a),i!==-1?i:null):e==="MMM"?(i=_e.call(this._shortMonthsParse,a),i!==-1?i:(i=_e.call(this._longMonthsParse,a),i!==-1?i:null)):(i=_e.call(this._longMonthsParse,a),i!==-1?i:(i=_e.call(this._shortMonthsParse,a),i!==-1?i:null))}function Dc(s,e,t){var r,i,n;if(this._monthsParseExact)return _c.call(this,s,e,t);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),r=0;r<12;r++){if(i=gt([2e3,r]),t&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[r]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),!t&&!this._monthsParse[r]&&(n="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[r]=new RegExp(n.replace(".",""),"i")),t&&e==="MMMM"&&this._longMonthsParse[r].test(s))return r;if(t&&e==="MMM"&&this._shortMonthsParse[r].test(s))return r;if(!t&&this._monthsParse[r].test(s))return r}}function Na(s,e){if(!s.isValid())return s;if(typeof e=="string"){if(/^\d+$/.test(e))e=te(e);else if(e=s.localeData().monthsParse(e),!_t(e))return s}var t=e,r=s.date();return r=r<29?r:Math.min(r,Vi(s.year(),t)),s._isUTC?s._d.setUTCMonth(t,r):s._d.setMonth(t,r),s}function qa(s){return s!=null?(Na(this,s),L.updateOffset(this,!0),this):Lr(this,"Month")}function bc(){return Vi(this.year(),this.month())}function Ac(s){return this._monthsParseExact?(ce(this,"_monthsRegex")||Ua.call(this),s?this._monthsShortStrictRegex:this._monthsShortRegex):(ce(this,"_monthsShortRegex")||(this._monthsShortRegex=yc),this._monthsShortStrictRegex&&s?this._monthsShortStrictRegex:this._monthsShortRegex)}function Tc(s){return this._monthsParseExact?(ce(this,"_monthsRegex")||Ua.call(this),s?this._monthsStrictRegex:this._monthsRegex):(ce(this,"_monthsRegex")||(this._monthsRegex=Ec),this._monthsStrictRegex&&s?this._monthsStrictRegex:this._monthsRegex)}function Ua(){function s(l,c){return c.length-l.length}var e=[],t=[],r=[],i,n,a,o;for(i=0;i<12;i++)n=gt([2e3,i]),a=Dt(this.monthsShort(n,"")),o=Dt(this.months(n,"")),e.push(a),t.push(o),r.push(o),r.push(a);e.sort(s),t.sort(s),r.sort(s),this._monthsRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+t.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+e.join("|")+")","i")}function Sc(s,e,t,r,i,n,a){var o;return s<100&&s>=0?(o=new Date(s+400,e,t,r,i,n,a),isFinite(o.getFullYear())&&o.setFullYear(s)):o=new Date(s,e,t,r,i,n,a),o}function jr(s){var e,t;return s<100&&s>=0?(t=Array.prototype.slice.call(arguments),t[0]=s+400,e=new Date(Date.UTC.apply(null,t)),isFinite(e.getUTCFullYear())&&e.setUTCFullYear(s)):e=new Date(Date.UTC.apply(null,arguments)),e}function ys(s,e,t){var r=7+e-t,i=(7+jr(s,0,r).getUTCDay()-e)%7;return-i+r-1}function La(s,e,t,r,i){var n=(7+t-r)%7,a=ys(s,r,i),o=1+7*(e-1)+n+a,l,c;return o<=0?(l=s-1,c=Ur(l)+o):o>Ur(s)?(l=s+1,c=o-Ur(s)):(l=s,c=o),{year:l,dayOfYear:c}}function Yr(s,e,t){var r=ys(s.year(),e,t),i=Math.floor((s.dayOfYear()-r-1)/7)+1,n,a;return i<1?(a=s.year()-1,n=i+Tt(a,e,t)):i>Tt(s.year(),e,t)?(n=i-Tt(s.year(),e,t),a=s.year()+1):(a=s.year(),n=i),{week:n,year:a}}function Tt(s,e,t){var r=ys(s,e,t),i=ys(s+1,e,t);return(Ur(s)-r+i)/7}V("w",["ww",2],"wo","week"),V("W",["WW",2],"Wo","isoWeek"),W("w",ve,yr),W("ww",ve,ze),W("W",ve,yr),W("WW",ve,ze),qr(["w","ww","W","WW"],function(s,e,t,r){e[r.substr(0,1)]=te(s)});function Rc(s){return Yr(s,this._week.dow,this._week.doy).week}var Fc={dow:0,doy:6};function Bc(){return this._week.dow}function kc(){return this._week.doy}function Ic(s){var e=this.localeData().week(this);return s==null?e:this.add((s-e)*7,"d")}function $c(s){var e=Yr(this,1,4).week;return s==null?e:this.add((s-e)*7,"d")}V("d",0,"do","day"),V("dd",0,0,function(s){return this.localeData().weekdaysMin(this,s)}),V("ddd",0,0,function(s){return this.localeData().weekdaysShort(this,s)}),V("dddd",0,0,function(s){return this.localeData().weekdays(this,s)}),V("e",0,0,"weekday"),V("E",0,0,"isoWeekday"),W("d",ve),W("e",ve),W("E",ve),W("dd",function(s,e){return e.weekdaysMinRegex(s)}),W("ddd",function(s,e){return e.weekdaysShortRegex(s)}),W("dddd",function(s,e){return e.weekdaysRegex(s)}),qr(["dd","ddd","dddd"],function(s,e,t,r){var i=t._locale.weekdaysParse(s,r,t._strict);i!=null?e.d=i:Q(t).invalidWeekday=s}),qr(["d","e","E"],function(s,e,t,r){e[r]=te(s)});function Hc(s,e){return typeof s!="string"?s:isNaN(s)?(s=e.weekdaysParse(s),typeof s=="number"?s:null):parseInt(s,10)}function Pc(s,e){return typeof s=="string"?e.weekdaysParse(s)%7||7:isNaN(s)?null:s}function zi(s,e){return s.slice(e,7).concat(s.slice(0,e))}var Oc="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),ja="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Mc="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Nc=Nr,qc=Nr,Uc=Nr;function Lc(s,e){var t=it(this._weekdays)?this._weekdays:this._weekdays[s&&s!==!0&&this._weekdays.isFormat.test(e)?"format":"standalone"];return s===!0?zi(t,this._week.dow):s?t[s.day()]:t}function jc(s){return s===!0?zi(this._weekdaysShort,this._week.dow):s?this._weekdaysShort[s.day()]:this._weekdaysShort}function Yc(s){return s===!0?zi(this._weekdaysMin,this._week.dow):s?this._weekdaysMin[s.day()]:this._weekdaysMin}function Wc(s,e,t){var r,i,n,a=s.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],r=0;r<7;++r)n=gt([2e3,1]).day(r),this._minWeekdaysParse[r]=this.weekdaysMin(n,"").toLocaleLowerCase(),this._shortWeekdaysParse[r]=this.weekdaysShort(n,"").toLocaleLowerCase(),this._weekdaysParse[r]=this.weekdays(n,"").toLocaleLowerCase();return t?e==="dddd"?(i=_e.call(this._weekdaysParse,a),i!==-1?i:null):e==="ddd"?(i=_e.call(this._shortWeekdaysParse,a),i!==-1?i:null):(i=_e.call(this._minWeekdaysParse,a),i!==-1?i:null):e==="dddd"?(i=_e.call(this._weekdaysParse,a),i!==-1||(i=_e.call(this._shortWeekdaysParse,a),i!==-1)?i:(i=_e.call(this._minWeekdaysParse,a),i!==-1?i:null)):e==="ddd"?(i=_e.call(this._shortWeekdaysParse,a),i!==-1||(i=_e.call(this._weekdaysParse,a),i!==-1)?i:(i=_e.call(this._minWeekdaysParse,a),i!==-1?i:null)):(i=_e.call(this._minWeekdaysParse,a),i!==-1||(i=_e.call(this._weekdaysParse,a),i!==-1)?i:(i=_e.call(this._shortWeekdaysParse,a),i!==-1?i:null))}function Gc(s,e,t){var r,i,n;if(this._weekdaysParseExact)return Wc.call(this,s,e,t);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;r<7;r++){if(i=gt([2e3,1]).day(r),t&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[r]||(n="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[r]=new RegExp(n.replace(".",""),"i")),t&&e==="dddd"&&this._fullWeekdaysParse[r].test(s))return r;if(t&&e==="ddd"&&this._shortWeekdaysParse[r].test(s))return r;if(t&&e==="dd"&&this._minWeekdaysParse[r].test(s))return r;if(!t&&this._weekdaysParse[r].test(s))return r}}function Vc(s){if(!this.isValid())return s!=null?this:NaN;var e=Lr(this,"Day");return s!=null?(s=Hc(s,this.localeData()),this.add(s-e,"d")):e}function zc(s){if(!this.isValid())return s!=null?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return s==null?e:this.add(s-e,"d")}function Kc(s){if(!this.isValid())return s!=null?this:NaN;if(s!=null){var e=Pc(s,this.localeData());return this.day(this.day()%7?e:e-7)}else return this.day()||7}function Zc(s){return this._weekdaysParseExact?(ce(this,"_weekdaysRegex")||Ki.call(this),s?this._weekdaysStrictRegex:this._weekdaysRegex):(ce(this,"_weekdaysRegex")||(this._weekdaysRegex=Nc),this._weekdaysStrictRegex&&s?this._weekdaysStrictRegex:this._weekdaysRegex)}function Jc(s){return this._weekdaysParseExact?(ce(this,"_weekdaysRegex")||Ki.call(this),s?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(ce(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=qc),this._weekdaysShortStrictRegex&&s?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Xc(s){return this._weekdaysParseExact?(ce(this,"_weekdaysRegex")||Ki.call(this),s?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(ce(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Uc),this._weekdaysMinStrictRegex&&s?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Ki(){function s(d,g){return g.length-d.length}var e=[],t=[],r=[],i=[],n,a,o,l,c;for(n=0;n<7;n++)a=gt([2e3,1]).day(n),o=Dt(this.weekdaysMin(a,"")),l=Dt(this.weekdaysShort(a,"")),c=Dt(this.weekdays(a,"")),e.push(o),t.push(l),r.push(c),i.push(o),i.push(l),i.push(c);e.sort(s),t.sort(s),r.sort(s),i.sort(s),this._weekdaysRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+t.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+e.join("|")+")","i")}function Zi(){return this.hours()%12||12}function Qc(){return this.hours()||24}V("H",["HH",2],0,"hour"),V("h",["hh",2],0,Zi),V("k",["kk",2],0,Qc),V("hmm",0,0,function(){return""+Zi.apply(this)+pt(this.minutes(),2)}),V("hmmss",0,0,function(){return""+Zi.apply(this)+pt(this.minutes(),2)+pt(this.seconds(),2)}),V("Hmm",0,0,function(){return""+this.hours()+pt(this.minutes(),2)}),V("Hmmss",0,0,function(){return""+this.hours()+pt(this.minutes(),2)+pt(this.seconds(),2)});function Ya(s,e){V(s,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}Ya("a",!0),Ya("A",!1);function Wa(s,e){return e._meridiemParse}W("a",Wa),W("A",Wa),W("H",ve,Wi),W("h",ve,yr),W("k",ve,yr),W("HH",ve,ze),W("hh",ve,ze),W("kk",ve,ze),W("hmm",Ia),W("hmmss",$a),W("Hmm",Ia),W("Hmmss",$a),xe(["H","HH"],Se),xe(["k","kk"],function(s,e,t){var r=te(s);e[Se]=r===24?0:r}),xe(["a","A"],function(s,e,t){t._isPm=t._locale.isPM(s),t._meridiem=s}),xe(["h","hh"],function(s,e,t){e[Se]=te(s),Q(t).bigHour=!0}),xe("hmm",function(s,e,t){var r=s.length-2;e[Se]=te(s.substr(0,r)),e[at]=te(s.substr(r)),Q(t).bigHour=!0}),xe("hmmss",function(s,e,t){var r=s.length-4,i=s.length-2;e[Se]=te(s.substr(0,r)),e[at]=te(s.substr(r,2)),e[At]=te(s.substr(i)),Q(t).bigHour=!0}),xe("Hmm",function(s,e,t){var r=s.length-2;e[Se]=te(s.substr(0,r)),e[at]=te(s.substr(r))}),xe("Hmmss",function(s,e,t){var r=s.length-4,i=s.length-2;e[Se]=te(s.substr(0,r)),e[at]=te(s.substr(r,2)),e[At]=te(s.substr(i))});function ed(s){return(s+"").toLowerCase().charAt(0)==="p"}var td=/[ap]\.?m?\.?/i,rd=Er("Hours",!0);function sd(s,e,t){return s>11?t?"pm":"PM":t?"am":"AM"}var Ga={calendar:W0,longDateFormat:K0,invalidDate:J0,ordinal:Q0,dayOfMonthOrdinalParse:ec,relativeTime:rc,months:vc,monthsShort:Oa,week:Fc,weekdays:Oc,weekdaysMin:Mc,weekdaysShort:ja,meridiemParse:td},Ee={},Wr={},Gr;function id(s,e){var t,r=Math.min(s.length,e.length);for(t=0;t<r;t+=1)if(s[t]!==e[t])return t;return r}function Va(s){return s&&s.toLowerCase().replace("_","-")}function nd(s){for(var e=0,t,r,i,n;e<s.length;){for(n=Va(s[e]).split("-"),t=n.length,r=Va(s[e+1]),r=r?r.split("-"):null;t>0;){if(i=Es(n.slice(0,t).join("-")),i)return i;if(r&&r.length>=t&&id(n,r)>=t-1)break;t--}e++}return Gr}function ad(s){return!!(s&&s.match("^[^/\\\\]*$"))}function Es(s){var e=null,t;if(Ee[s]===void 0&&typeof module<"u"&&module&&module.exports&&ad(s))try{e=Gr._abbr,t=require,t("./locale/"+s),Yt(e)}catch{Ee[s]=null}return Ee[s]}function Yt(s,e){var t;return s&&(Ye(e)?t=St(s):t=Ji(s,e),t?Gr=t:typeof console<"u"&&console.warn&&console.warn("Locale "+s+" not found. Did you forget to load it?")),Gr._abbr}function Ji(s,e){if(e!==null){var t,r=Ga;if(e.abbr=s,Ee[s]!=null)Sa("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),r=Ee[s]._config;else if(e.parentLocale!=null)if(Ee[e.parentLocale]!=null)r=Ee[e.parentLocale]._config;else if(t=Es(e.parentLocale),t!=null)r=t._config;else return Wr[e.parentLocale]||(Wr[e.parentLocale]=[]),Wr[e.parentLocale].push({name:s,config:e}),null;return Ee[s]=new Mi(Oi(r,e)),Wr[s]&&Wr[s].forEach(function(i){Ji(i.name,i.config)}),Yt(s),Ee[s]}else return delete Ee[s],null}function od(s,e){if(e!=null){var t,r,i=Ga;Ee[s]!=null&&Ee[s].parentLocale!=null?Ee[s].set(Oi(Ee[s]._config,e)):(r=Es(s),r!=null&&(i=r._config),e=Oi(i,e),r==null&&(e.abbr=s),t=new Mi(e),t.parentLocale=Ee[s],Ee[s]=t),Yt(s)}else Ee[s]!=null&&(Ee[s].parentLocale!=null?(Ee[s]=Ee[s].parentLocale,s===Yt()&&Yt(s)):Ee[s]!=null&&delete Ee[s]);return Ee[s]}function St(s){var e;if(s&&s._locale&&s._locale._abbr&&(s=s._locale._abbr),!s)return Gr;if(!it(s)){if(e=Es(s),e)return e;s=[s]}return nd(s)}function cd(){return Ni(Ee)}function Xi(s){var e,t=s._a;return t&&Q(s).overflow===-2&&(e=t[bt]<0||t[bt]>11?bt:t[mt]<1||t[mt]>Vi(t[Pe],t[bt])?mt:t[Se]<0||t[Se]>24||t[Se]===24&&(t[at]!==0||t[At]!==0||t[ar]!==0)?Se:t[at]<0||t[at]>59?at:t[At]<0||t[At]>59?At:t[ar]<0||t[ar]>999?ar:-1,Q(s)._overflowDayOfYear&&(e<Pe||e>mt)&&(e=mt),Q(s)._overflowWeeks&&e===-1&&(e=uc),Q(s)._overflowWeekday&&e===-1&&(e=fc),Q(s).overflow=e),s}var dd=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ld=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,hd=/Z|[+-]\d\d(?::?\d\d)?/,ws=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Qi=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],ud=/^\/?Date\((-?\d+)/i,fd=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,gd={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function za(s){var e,t,r=s._i,i=dd.exec(r)||ld.exec(r),n,a,o,l,c=ws.length,d=Qi.length;if(i){for(Q(s).iso=!0,e=0,t=c;e<t;e++)if(ws[e][1].exec(i[1])){a=ws[e][0],n=ws[e][2]!==!1;break}if(a==null){s._isValid=!1;return}if(i[3]){for(e=0,t=d;e<t;e++)if(Qi[e][1].exec(i[3])){o=(i[2]||" ")+Qi[e][0];break}if(o==null){s._isValid=!1;return}}if(!n&&o!=null){s._isValid=!1;return}if(i[4])if(hd.exec(i[4]))l="Z";else{s._isValid=!1;return}s._f=a+(o||"")+(l||""),tn(s)}else s._isValid=!1}function xd(s,e,t,r,i,n){var a=[pd(s),Oa.indexOf(e),parseInt(t,10),parseInt(r,10),parseInt(i,10)];return n&&a.push(parseInt(n,10)),a}function pd(s){var e=parseInt(s,10);return e<=49?2e3+e:e<=999?1900+e:e}function md(s){return s.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function vd(s,e,t){if(s){var r=ja.indexOf(s),i=new Date(e[0],e[1],e[2]).getDay();if(r!==i)return Q(t).weekdayMismatch=!0,t._isValid=!1,!1}return!0}function yd(s,e,t){if(s)return gd[s];if(e)return 0;var r=parseInt(t,10),i=r%100,n=(r-i)/100;return n*60+i}function Ka(s){var e=fd.exec(md(s._i)),t;if(e){if(t=xd(e[4],e[3],e[2],e[5],e[6],e[7]),!vd(e[1],t,s))return;s._a=t,s._tzm=yd(e[8],e[9],e[10]),s._d=jr.apply(null,s._a),s._d.setUTCMinutes(s._d.getUTCMinutes()-s._tzm),Q(s).rfc2822=!0}else s._isValid=!1}function Ed(s){var e=ud.exec(s._i);if(e!==null){s._d=new Date(+e[1]);return}if(za(s),s._isValid===!1)delete s._isValid;else return;if(Ka(s),s._isValid===!1)delete s._isValid;else return;s._strict?s._isValid=!1:L.createFromInputFallback(s)}L.createFromInputFallback=Xe("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(s){s._d=new Date(s._i+(s._useUTC?" UTC":""))});function wr(s,e,t){return s??e??t}function wd(s){var e=new Date(L.now());return s._useUTC?[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()]:[e.getFullYear(),e.getMonth(),e.getDate()]}function en(s){var e,t,r=[],i,n,a;if(!s._d){for(i=wd(s),s._w&&s._a[mt]==null&&s._a[bt]==null&&Cd(s),s._dayOfYear!=null&&(a=wr(s._a[Pe],i[Pe]),(s._dayOfYear>Ur(a)||s._dayOfYear===0)&&(Q(s)._overflowDayOfYear=!0),t=jr(a,0,s._dayOfYear),s._a[bt]=t.getUTCMonth(),s._a[mt]=t.getUTCDate()),e=0;e<3&&s._a[e]==null;++e)s._a[e]=r[e]=i[e];for(;e<7;e++)s._a[e]=r[e]=s._a[e]==null?e===2?1:0:s._a[e];s._a[Se]===24&&s._a[at]===0&&s._a[At]===0&&s._a[ar]===0&&(s._nextDay=!0,s._a[Se]=0),s._d=(s._useUTC?jr:Sc).apply(null,r),n=s._useUTC?s._d.getUTCDay():s._d.getDay(),s._tzm!=null&&s._d.setUTCMinutes(s._d.getUTCMinutes()-s._tzm),s._nextDay&&(s._a[Se]=24),s._w&&typeof s._w.d<"u"&&s._w.d!==n&&(Q(s).weekdayMismatch=!0)}}function Cd(s){var e,t,r,i,n,a,o,l,c;e=s._w,e.GG!=null||e.W!=null||e.E!=null?(n=1,a=4,t=wr(e.GG,s._a[Pe],Yr(ye(),1,4).year),r=wr(e.W,1),i=wr(e.E,1),(i<1||i>7)&&(l=!0)):(n=s._locale._week.dow,a=s._locale._week.doy,c=Yr(ye(),n,a),t=wr(e.gg,s._a[Pe],c.year),r=wr(e.w,c.week),e.d!=null?(i=e.d,(i<0||i>6)&&(l=!0)):e.e!=null?(i=e.e+n,(e.e<0||e.e>6)&&(l=!0)):i=n),r<1||r>Tt(t,n,a)?Q(s)._overflowWeeks=!0:l!=null?Q(s)._overflowWeekday=!0:(o=La(t,r,i,n,a),s._a[Pe]=o.year,s._dayOfYear=o.dayOfYear)}L.ISO_8601=function(){},L.RFC_2822=function(){};function tn(s){if(s._f===L.ISO_8601){za(s);return}if(s._f===L.RFC_2822){Ka(s);return}s._a=[],Q(s).empty=!0;var e=""+s._i,t,r,i,n,a,o=e.length,l=0,c,d;for(i=Ra(s._f,s._locale).match(qi)||[],d=i.length,t=0;t<d;t++)n=i[t],r=(e.match(dc(n,s))||[])[0],r&&(a=e.substr(0,e.indexOf(r)),a.length>0&&Q(s).unusedInput.push(a),e=e.slice(e.indexOf(r)+r.length),l+=r.length),mr[n]?(r?Q(s).empty=!1:Q(s).unusedTokens.push(n),hc(n,r,s)):s._strict&&!r&&Q(s).unusedTokens.push(n);Q(s).charsLeftOver=o-l,e.length>0&&Q(s).unusedInput.push(e),s._a[Se]<=12&&Q(s).bigHour===!0&&s._a[Se]>0&&(Q(s).bigHour=void 0),Q(s).parsedDateParts=s._a.slice(0),Q(s).meridiem=s._meridiem,s._a[Se]=_d(s._locale,s._a[Se],s._meridiem),c=Q(s).era,c!==null&&(s._a[Pe]=s._locale.erasConvertYear(c,s._a[Pe])),en(s),Xi(s)}function _d(s,e,t){var r;return t==null?e:s.meridiemHour!=null?s.meridiemHour(e,t):(s.isPM!=null&&(r=s.isPM(t),r&&e<12&&(e+=12),!r&&e===12&&(e=0)),e)}function Dd(s){var e,t,r,i,n,a,o=!1,l=s._f.length;if(l===0){Q(s).invalidFormat=!0,s._d=new Date(NaN);return}for(i=0;i<l;i++)n=0,a=!1,e=Pi({},s),s._useUTC!=null&&(e._useUTC=s._useUTC),e._f=s._f[i],tn(e),$i(e)&&(a=!0),n+=Q(e).charsLeftOver,n+=Q(e).unusedTokens.length*10,Q(e).score=n,o?n<r&&(r=n,t=e):(r==null||n<r||a)&&(r=n,t=e,a&&(o=!0));jt(s,t||e)}function bd(s){if(!s._d){var e=Li(s._i),t=e.day===void 0?e.date:e.day;s._a=Da([e.year,e.month,t,e.hour,e.minute,e.second,e.millisecond],function(r){return r&&parseInt(r,10)}),en(s)}}function Ad(s){var e=new Mr(Xi(Za(s)));return e._nextDay&&(e.add(1,"d"),e._nextDay=void 0),e}function Za(s){var e=s._i,t=s._f;return s._locale=s._locale||St(s._l),e===null||t===void 0&&e===""?ds({nullInput:!0}):(typeof e=="string"&&(s._i=e=s._locale.preparse(e)),nt(e)?new Mr(Xi(e)):(Or(e)?s._d=e:it(t)?Dd(s):t?tn(s):Td(s),$i(s)||(s._d=null),s))}function Td(s){var e=s._i;Ye(e)?s._d=new Date(L.now()):Or(e)?s._d=new Date(e.valueOf()):typeof e=="string"?Ed(s):it(e)?(s._a=Da(e.slice(0),function(t){return parseInt(t,10)}),en(s)):nr(e)?bd(s):_t(e)?s._d=new Date(e):L.createFromInputFallback(s)}function Ja(s,e,t,r,i){var n={};return(e===!0||e===!1)&&(r=e,e=void 0),(t===!0||t===!1)&&(r=t,t=void 0),(nr(s)&&ki(s)||it(s)&&s.length===0)&&(s=void 0),n._isAMomentObject=!0,n._useUTC=n._isUTC=i,n._l=t,n._i=s,n._f=e,n._strict=r,Ad(n)}function ye(s,e,t,r){return Ja(s,e,t,r,!1)}var Sd=Xe("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var s=ye.apply(null,arguments);return this.isValid()&&s.isValid()?s<this?this:s:ds()}),Rd=Xe("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var s=ye.apply(null,arguments);return this.isValid()&&s.isValid()?s>this?this:s:ds()});function Xa(s,e){var t,r;if(e.length===1&&it(e[0])&&(e=e[0]),!e.length)return ye();for(t=e[0],r=1;r<e.length;++r)(!e[r].isValid()||e[r][s](t))&&(t=e[r]);return t}function Fd(){var s=[].slice.call(arguments,0);return Xa("isBefore",s)}function Bd(){var s=[].slice.call(arguments,0);return Xa("isAfter",s)}var kd=function(){return Date.now?Date.now():+new Date},Vr=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Id(s){var e,t=!1,r,i=Vr.length;for(e in s)if(ce(s,e)&&!(_e.call(Vr,e)!==-1&&(s[e]==null||!isNaN(s[e]))))return!1;for(r=0;r<i;++r)if(s[Vr[r]]){if(t)return!1;parseFloat(s[Vr[r]])!==te(s[Vr[r]])&&(t=!0)}return!0}function $d(){return this._isValid}function Hd(){return ot(NaN)}function Cs(s){var e=Li(s),t=e.year||0,r=e.quarter||0,i=e.month||0,n=e.week||e.isoWeek||0,a=e.day||0,o=e.hour||0,l=e.minute||0,c=e.second||0,d=e.millisecond||0;this._isValid=Id(e),this._milliseconds=+d+c*1e3+l*6e4+o*1e3*60*60,this._days=+a+n*7,this._months=+i+r*3+t*12,this._data={},this._locale=St(),this._bubble()}function _s(s){return s instanceof Cs}function rn(s){return s<0?Math.round(-1*s)*-1:Math.round(s)}function Pd(s,e,t){var r=Math.min(s.length,e.length),i=Math.abs(s.length-e.length),n=0,a;for(a=0;a<r;a++)te(s[a])!==te(e[a])&&n++;return n+i}function Qa(s,e){V(s,0,0,function(){var t=this.utcOffset(),r="+";return t<0&&(t=-t,r="-"),r+pt(~~(t/60),2)+e+pt(~~t%60,2)})}Qa("Z",":"),Qa("ZZ",""),W("Z",ps),W("ZZ",ps),xe(["Z","ZZ"],function(s,e,t){t._useUTC=!0,t._tzm=sn(ps,s)});var Od=/([\+\-]|\d\d)/gi;function sn(s,e){var t=(e||"").match(s),r,i,n;return t===null?null:(r=t[t.length-1]||[],i=(r+"").match(Od)||["-",0,0],n=+(i[1]*60)+te(i[2]),n===0?0:i[0]==="+"?n:-n)}function nn(s,e){var t,r;return e._isUTC?(t=e.clone(),r=(nt(s)||Or(s)?s.valueOf():ye(s).valueOf())-t.valueOf(),t._d.setTime(t._d.valueOf()+r),L.updateOffset(t,!1),t):ye(s).local()}function an(s){return-Math.round(s._d.getTimezoneOffset())}L.updateOffset=function(){};function Md(s,e,t){var r=this._offset||0,i;if(!this.isValid())return s!=null?this:NaN;if(s!=null){if(typeof s=="string"){if(s=sn(ps,s),s===null)return this}else Math.abs(s)<16&&!t&&(s=s*60);return!this._isUTC&&e&&(i=an(this)),this._offset=s,this._isUTC=!0,i!=null&&this.add(i,"m"),r!==s&&(!e||this._changeInProgress?so(this,ot(s-r,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,L.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?r:an(this)}function Nd(s,e){return s!=null?(typeof s!="string"&&(s=-s),this.utcOffset(s,e),this):-this.utcOffset()}function qd(s){return this.utcOffset(0,s)}function Ud(s){return this._isUTC&&(this.utcOffset(0,s),this._isUTC=!1,s&&this.subtract(an(this),"m")),this}function Ld(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var s=sn(oc,this._i);s!=null?this.utcOffset(s):this.utcOffset(0,!0)}return this}function jd(s){return this.isValid()?(s=s?ye(s).utcOffset():0,(this.utcOffset()-s)%60===0):!1}function Yd(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Wd(){if(!Ye(this._isDSTShifted))return this._isDSTShifted;var s={},e;return Pi(s,this),s=Za(s),s._a?(e=s._isUTC?gt(s._a):ye(s._a),this._isDSTShifted=this.isValid()&&Pd(s._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Gd(){return this.isValid()?!this._isUTC:!1}function Vd(){return this.isValid()?this._isUTC:!1}function eo(){return this.isValid()?this._isUTC&&this._offset===0:!1}var zd=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Kd=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function ot(s,e){var t=s,r=null,i,n,a;return _s(s)?t={ms:s._milliseconds,d:s._days,M:s._months}:_t(s)||!isNaN(+s)?(t={},e?t[e]=+s:t.milliseconds=+s):(r=zd.exec(s))?(i=r[1]==="-"?-1:1,t={y:0,d:te(r[mt])*i,h:te(r[Se])*i,m:te(r[at])*i,s:te(r[At])*i,ms:te(rn(r[ar]*1e3))*i}):(r=Kd.exec(s))?(i=r[1]==="-"?-1:1,t={y:or(r[2],i),M:or(r[3],i),w:or(r[4],i),d:or(r[5],i),h:or(r[6],i),m:or(r[7],i),s:or(r[8],i)}):t==null?t={}:typeof t=="object"&&("from"in t||"to"in t)&&(a=Zd(ye(t.from),ye(t.to)),t={},t.ms=a.milliseconds,t.M=a.months),n=new Cs(t),_s(s)&&ce(s,"_locale")&&(n._locale=s._locale),_s(s)&&ce(s,"_isValid")&&(n._isValid=s._isValid),n}ot.fn=Cs.prototype,ot.invalid=Hd;function or(s,e){var t=s&&parseFloat(s.replace(",","."));return(isNaN(t)?0:t)*e}function to(s,e){var t={};return t.months=e.month()-s.month()+(e.year()-s.year())*12,s.clone().add(t.months,"M").isAfter(e)&&--t.months,t.milliseconds=+e-+s.clone().add(t.months,"M"),t}function Zd(s,e){var t;return s.isValid()&&e.isValid()?(e=nn(e,s),s.isBefore(e)?t=to(s,e):(t=to(e,s),t.milliseconds=-t.milliseconds,t.months=-t.months),t):{milliseconds:0,months:0}}function ro(s,e){return function(t,r){var i,n;return r!==null&&!isNaN(+r)&&(Sa(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=t,t=r,r=n),i=ot(t,r),so(this,i,s),this}}function so(s,e,t,r){var i=e._milliseconds,n=rn(e._days),a=rn(e._months);s.isValid()&&(r=r??!0,a&&Na(s,Lr(s,"Month")+a*t),n&&Pa(s,"Date",Lr(s,"Date")+n*t),i&&s._d.setTime(s._d.valueOf()+i*t),r&&L.updateOffset(s,n||a))}var Jd=ro(1,"add"),Xd=ro(-1,"subtract");function io(s){return typeof s=="string"||s instanceof String}function Qd(s){return nt(s)||Or(s)||io(s)||_t(s)||tl(s)||el(s)||s===null||s===void 0}function el(s){var e=nr(s)&&!ki(s),t=!1,r=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],i,n,a=r.length;for(i=0;i<a;i+=1)n=r[i],t=t||ce(s,n);return e&&t}function tl(s){var e=it(s),t=!1;return e&&(t=s.filter(function(r){return!_t(r)&&io(s)}).length===0),e&&t}function rl(s){var e=nr(s)&&!ki(s),t=!1,r=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],i,n;for(i=0;i<r.length;i+=1)n=r[i],t=t||ce(s,n);return e&&t}function sl(s,e){var t=s.diff(e,"days",!0);return t<-6?"sameElse":t<-1?"lastWeek":t<0?"lastDay":t<1?"sameDay":t<2?"nextDay":t<7?"nextWeek":"sameElse"}function il(s,e){arguments.length===1&&(arguments[0]?Qd(arguments[0])?(s=arguments[0],e=void 0):rl(arguments[0])&&(e=arguments[0],s=void 0):(s=void 0,e=void 0));var t=s||ye(),r=nn(t,this).startOf("day"),i=L.calendarFormat(this,r)||"sameElse",n=e&&(xt(e[i])?e[i].call(this,t):e[i]);return this.format(n||this.localeData().calendar(i,this,ye(t)))}function nl(){return new Mr(this)}function al(s,e){var t=nt(s)?s:ye(s);return this.isValid()&&t.isValid()?(e=Qe(e)||"millisecond",e==="millisecond"?this.valueOf()>t.valueOf():t.valueOf()<this.clone().startOf(e).valueOf()):!1}function ol(s,e){var t=nt(s)?s:ye(s);return this.isValid()&&t.isValid()?(e=Qe(e)||"millisecond",e==="millisecond"?this.valueOf()<t.valueOf():this.clone().endOf(e).valueOf()<t.valueOf()):!1}function cl(s,e,t,r){var i=nt(s)?s:ye(s),n=nt(e)?e:ye(e);return this.isValid()&&i.isValid()&&n.isValid()?(r=r||"()",(r[0]==="("?this.isAfter(i,t):!this.isBefore(i,t))&&(r[1]===")"?this.isBefore(n,t):!this.isAfter(n,t))):!1}function dl(s,e){var t=nt(s)?s:ye(s),r;return this.isValid()&&t.isValid()?(e=Qe(e)||"millisecond",e==="millisecond"?this.valueOf()===t.valueOf():(r=t.valueOf(),this.clone().startOf(e).valueOf()<=r&&r<=this.clone().endOf(e).valueOf())):!1}function ll(s,e){return this.isSame(s,e)||this.isAfter(s,e)}function hl(s,e){return this.isSame(s,e)||this.isBefore(s,e)}function ul(s,e,t){var r,i,n;if(!this.isValid())return NaN;if(r=nn(s,this),!r.isValid())return NaN;switch(i=(r.utcOffset()-this.utcOffset())*6e4,e=Qe(e),e){case"year":n=Ds(this,r)/12;break;case"month":n=Ds(this,r);break;case"quarter":n=Ds(this,r)/3;break;case"second":n=(this-r)/1e3;break;case"minute":n=(this-r)/6e4;break;case"hour":n=(this-r)/36e5;break;case"day":n=(this-r-i)/864e5;break;case"week":n=(this-r-i)/6048e5;break;default:n=this-r}return t?n:et(n)}function Ds(s,e){if(s.date()<e.date())return-Ds(e,s);var t=(e.year()-s.year())*12+(e.month()-s.month()),r=s.clone().add(t,"months"),i,n;return e-r<0?(i=s.clone().add(t-1,"months"),n=(e-r)/(r-i)):(i=s.clone().add(t+1,"months"),n=(e-r)/(i-r)),-(t+n)||0}L.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",L.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function fl(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function gl(s){if(!this.isValid())return null;var e=s!==!0,t=e?this.clone().utc():this;return t.year()<0||t.year()>9999?hs(t,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):xt(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",hs(t,"Z")):hs(t,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function xl(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var s="moment",e="",t,r,i,n;return this.isLocal()||(s=this.utcOffset()===0?"moment.utc":"moment.parseZone",e="Z"),t="["+s+'("]',r=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i="-MM-DD[T]HH:mm:ss.SSS",n=e+'[")]',this.format(t+r+i+n)}function pl(s){s||(s=this.isUtc()?L.defaultFormatUtc:L.defaultFormat);var e=hs(this,s);return this.localeData().postformat(e)}function ml(s,e){return this.isValid()&&(nt(s)&&s.isValid()||ye(s).isValid())?ot({to:this,from:s}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function vl(s){return this.from(ye(),s)}function yl(s,e){return this.isValid()&&(nt(s)&&s.isValid()||ye(s).isValid())?ot({from:this,to:s}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function El(s){return this.to(ye(),s)}function no(s){var e;return s===void 0?this._locale._abbr:(e=St(s),e!=null&&(this._locale=e),this)}var ao=Xe("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(s){return s===void 0?this.localeData():this.locale(s)});function oo(){return this._locale}var bs=1e3,Cr=60*bs,As=60*Cr,co=(365*400+97)*24*As;function _r(s,e){return(s%e+e)%e}function lo(s,e,t){return s<100&&s>=0?new Date(s+400,e,t)-co:new Date(s,e,t).valueOf()}function ho(s,e,t){return s<100&&s>=0?Date.UTC(s+400,e,t)-co:Date.UTC(s,e,t)}function wl(s){var e,t;if(s=Qe(s),s===void 0||s==="millisecond"||!this.isValid())return this;switch(t=this._isUTC?ho:lo,s){case"year":e=t(this.year(),0,1);break;case"quarter":e=t(this.year(),this.month()-this.month()%3,1);break;case"month":e=t(this.year(),this.month(),1);break;case"week":e=t(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":e=t(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":e=t(this.year(),this.month(),this.date());break;case"hour":e=this._d.valueOf(),e-=_r(e+(this._isUTC?0:this.utcOffset()*Cr),As);break;case"minute":e=this._d.valueOf(),e-=_r(e,Cr);break;case"second":e=this._d.valueOf(),e-=_r(e,bs);break}return this._d.setTime(e),L.updateOffset(this,!0),this}function Cl(s){var e,t;if(s=Qe(s),s===void 0||s==="millisecond"||!this.isValid())return this;switch(t=this._isUTC?ho:lo,s){case"year":e=t(this.year()+1,0,1)-1;break;case"quarter":e=t(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":e=t(this.year(),this.month()+1,1)-1;break;case"week":e=t(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":e=t(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":e=t(this.year(),this.month(),this.date()+1)-1;break;case"hour":e=this._d.valueOf(),e+=As-_r(e+(this._isUTC?0:this.utcOffset()*Cr),As)-1;break;case"minute":e=this._d.valueOf(),e+=Cr-_r(e,Cr)-1;break;case"second":e=this._d.valueOf(),e+=bs-_r(e,bs)-1;break}return this._d.setTime(e),L.updateOffset(this,!0),this}function _l(){return this._d.valueOf()-(this._offset||0)*6e4}function Dl(){return Math.floor(this.valueOf()/1e3)}function bl(){return new Date(this.valueOf())}function Al(){var s=this;return[s.year(),s.month(),s.date(),s.hour(),s.minute(),s.second(),s.millisecond()]}function Tl(){var s=this;return{years:s.year(),months:s.month(),date:s.date(),hours:s.hours(),minutes:s.minutes(),seconds:s.seconds(),milliseconds:s.milliseconds()}}function Sl(){return this.isValid()?this.toISOString():null}function Rl(){return $i(this)}function Fl(){return jt({},Q(this))}function Bl(){return Q(this).overflow}function kl(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}V("N",0,0,"eraAbbr"),V("NN",0,0,"eraAbbr"),V("NNN",0,0,"eraAbbr"),V("NNNN",0,0,"eraName"),V("NNNNN",0,0,"eraNarrow"),V("y",["y",1],"yo","eraYear"),V("y",["yy",2],0,"eraYear"),V("y",["yyy",3],0,"eraYear"),V("y",["yyyy",4],0,"eraYear"),W("N",on),W("NN",on),W("NNN",on),W("NNNN",jl),W("NNNNN",Yl),xe(["N","NN","NNN","NNNN","NNNNN"],function(s,e,t,r){var i=t._locale.erasParse(s,r,t._strict);i?Q(t).era=i:Q(t).invalidEra=s}),W("y",vr),W("yy",vr),W("yyy",vr),W("yyyy",vr),W("yo",Wl),xe(["y","yy","yyy","yyyy"],Pe),xe(["yo"],function(s,e,t,r){var i;t._locale._eraYearOrdinalRegex&&(i=s.match(t._locale._eraYearOrdinalRegex)),t._locale.eraYearOrdinalParse?e[Pe]=t._locale.eraYearOrdinalParse(s,i):e[Pe]=parseInt(s,10)});function Il(s,e){var t,r,i,n=this._eras||St("en")._eras;for(t=0,r=n.length;t<r;++t){switch(typeof n[t].since){case"string":i=L(n[t].since).startOf("day"),n[t].since=i.valueOf();break}switch(typeof n[t].until){case"undefined":n[t].until=1/0;break;case"string":i=L(n[t].until).startOf("day").valueOf(),n[t].until=i.valueOf();break}}return n}function $l(s,e,t){var r,i,n=this.eras(),a,o,l;for(s=s.toUpperCase(),r=0,i=n.length;r<i;++r)if(a=n[r].name.toUpperCase(),o=n[r].abbr.toUpperCase(),l=n[r].narrow.toUpperCase(),t)switch(e){case"N":case"NN":case"NNN":if(o===s)return n[r];break;case"NNNN":if(a===s)return n[r];break;case"NNNNN":if(l===s)return n[r];break}else if([a,o,l].indexOf(s)>=0)return n[r]}function Hl(s,e){var t=s.since<=s.until?1:-1;return e===void 0?L(s.since).year():L(s.since).year()+(e-s.offset)*t}function Pl(){var s,e,t,r=this.localeData().eras();for(s=0,e=r.length;s<e;++s)if(t=this.clone().startOf("day").valueOf(),r[s].since<=t&&t<=r[s].until||r[s].until<=t&&t<=r[s].since)return r[s].name;return""}function Ol(){var s,e,t,r=this.localeData().eras();for(s=0,e=r.length;s<e;++s)if(t=this.clone().startOf("day").valueOf(),r[s].since<=t&&t<=r[s].until||r[s].until<=t&&t<=r[s].since)return r[s].narrow;return""}function Ml(){var s,e,t,r=this.localeData().eras();for(s=0,e=r.length;s<e;++s)if(t=this.clone().startOf("day").valueOf(),r[s].since<=t&&t<=r[s].until||r[s].until<=t&&t<=r[s].since)return r[s].abbr;return""}function Nl(){var s,e,t,r,i=this.localeData().eras();for(s=0,e=i.length;s<e;++s)if(t=i[s].since<=i[s].until?1:-1,r=this.clone().startOf("day").valueOf(),i[s].since<=r&&r<=i[s].until||i[s].until<=r&&r<=i[s].since)return(this.year()-L(i[s].since).year())*t+i[s].offset;return this.year()}function ql(s){return ce(this,"_erasNameRegex")||cn.call(this),s?this._erasNameRegex:this._erasRegex}function Ul(s){return ce(this,"_erasAbbrRegex")||cn.call(this),s?this._erasAbbrRegex:this._erasRegex}function Ll(s){return ce(this,"_erasNarrowRegex")||cn.call(this),s?this._erasNarrowRegex:this._erasRegex}function on(s,e){return e.erasAbbrRegex(s)}function jl(s,e){return e.erasNameRegex(s)}function Yl(s,e){return e.erasNarrowRegex(s)}function Wl(s,e){return e._eraYearOrdinalRegex||vr}function cn(){var s=[],e=[],t=[],r=[],i,n,a,o,l,c=this.eras();for(i=0,n=c.length;i<n;++i)a=Dt(c[i].name),o=Dt(c[i].abbr),l=Dt(c[i].narrow),e.push(a),s.push(o),t.push(l),r.push(a),r.push(o),r.push(l);this._erasRegex=new RegExp("^("+r.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+e.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+s.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+t.join("|")+")","i")}V(0,["gg",2],0,function(){return this.weekYear()%100}),V(0,["GG",2],0,function(){return this.isoWeekYear()%100});function Ts(s,e){V(0,[s,s.length],0,e)}Ts("gggg","weekYear"),Ts("ggggg","weekYear"),Ts("GGGG","isoWeekYear"),Ts("GGGGG","isoWeekYear"),W("G",xs),W("g",xs),W("GG",ve,ze),W("gg",ve,ze),W("GGGG",Yi,ji),W("gggg",Yi,ji),W("GGGGG",gs,us),W("ggggg",gs,us),qr(["gggg","ggggg","GGGG","GGGGG"],function(s,e,t,r){e[r.substr(0,2)]=te(s)}),qr(["gg","GG"],function(s,e,t,r){e[r]=L.parseTwoDigitYear(s)});function Gl(s){return uo.call(this,s,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function Vl(s){return uo.call(this,s,this.isoWeek(),this.isoWeekday(),1,4)}function zl(){return Tt(this.year(),1,4)}function Kl(){return Tt(this.isoWeekYear(),1,4)}function Zl(){var s=this.localeData()._week;return Tt(this.year(),s.dow,s.doy)}function Jl(){var s=this.localeData()._week;return Tt(this.weekYear(),s.dow,s.doy)}function uo(s,e,t,r,i){var n;return s==null?Yr(this,r,i).year:(n=Tt(s,r,i),e>n&&(e=n),Xl.call(this,s,e,t,r,i))}function Xl(s,e,t,r,i){var n=La(s,e,t,r,i),a=jr(n.year,0,n.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}V("Q",0,"Qo","quarter"),W("Q",Ba),xe("Q",function(s,e){e[bt]=(te(s)-1)*3});function Ql(s){return s==null?Math.ceil((this.month()+1)/3):this.month((s-1)*3+this.month()%3)}V("D",["DD",2],"Do","date"),W("D",ve,yr),W("DD",ve,ze),W("Do",function(s,e){return s?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient}),xe(["D","DD"],mt),xe("Do",function(s,e){e[mt]=te(s.match(ve)[0])});var fo=Er("Date",!0);V("DDD",["DDDD",3],"DDDo","dayOfYear"),W("DDD",fs),W("DDDD",ka),xe(["DDD","DDDD"],function(s,e,t){t._dayOfYear=te(s)});function eh(s){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return s==null?e:this.add(s-e,"d")}V("m",["mm",2],0,"minute"),W("m",ve,Wi),W("mm",ve,ze),xe(["m","mm"],at);var th=Er("Minutes",!1);V("s",["ss",2],0,"second"),W("s",ve,Wi),W("ss",ve,ze),xe(["s","ss"],At);var rh=Er("Seconds",!1);V("S",0,0,function(){return~~(this.millisecond()/100)}),V(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),V(0,["SSS",3],0,"millisecond"),V(0,["SSSS",4],0,function(){return this.millisecond()*10}),V(0,["SSSSS",5],0,function(){return this.millisecond()*100}),V(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),V(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),V(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),V(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),W("S",fs,Ba),W("SS",fs,ze),W("SSS",fs,ka);var Wt,go;for(Wt="SSSS";Wt.length<=9;Wt+="S")W(Wt,vr);function sh(s,e){e[ar]=te(("0."+s)*1e3)}for(Wt="S";Wt.length<=9;Wt+="S")xe(Wt,sh);go=Er("Milliseconds",!1),V("z",0,0,"zoneAbbr"),V("zz",0,0,"zoneName");function ih(){return this._isUTC?"UTC":""}function nh(){return this._isUTC?"Coordinated Universal Time":""}var O=Mr.prototype;O.add=Jd,O.calendar=il,O.clone=nl,O.diff=ul,O.endOf=Cl,O.format=pl,O.from=ml,O.fromNow=vl,O.to=yl,O.toNow=El,O.get=xc,O.invalidAt=Bl,O.isAfter=al,O.isBefore=ol,O.isBetween=cl,O.isSame=dl,O.isSameOrAfter=ll,O.isSameOrBefore=hl,O.isValid=Rl,O.lang=ao,O.locale=no,O.localeData=oo,O.max=Rd,O.min=Sd,O.parsingFlags=Fl,O.set=pc,O.startOf=wl,O.subtract=Xd,O.toArray=Al,O.toObject=Tl,O.toDate=bl,O.toISOString=gl,O.inspect=xl,typeof Symbol<"u"&&Symbol.for!=null&&(O[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),O.toJSON=Sl,O.toString=fl,O.unix=Dl,O.valueOf=_l,O.creationData=kl,O.eraName=Pl,O.eraNarrow=Ol,O.eraAbbr=Ml,O.eraYear=Nl,O.year=Ha,O.isLeapYear=gc,O.weekYear=Gl,O.isoWeekYear=Vl,O.quarter=O.quarters=Ql,O.month=qa,O.daysInMonth=bc,O.week=O.weeks=Ic,O.isoWeek=O.isoWeeks=$c,O.weeksInYear=Zl,O.weeksInWeekYear=Jl,O.isoWeeksInYear=zl,O.isoWeeksInISOWeekYear=Kl,O.date=fo,O.day=O.days=Vc,O.weekday=zc,O.isoWeekday=Kc,O.dayOfYear=eh,O.hour=O.hours=rd,O.minute=O.minutes=th,O.second=O.seconds=rh,O.millisecond=O.milliseconds=go,O.utcOffset=Md,O.utc=qd,O.local=Ud,O.parseZone=Ld,O.hasAlignedHourOffset=jd,O.isDST=Yd,O.isLocal=Gd,O.isUtcOffset=Vd,O.isUtc=eo,O.isUTC=eo,O.zoneAbbr=ih,O.zoneName=nh,O.dates=Xe("dates accessor is deprecated. Use date instead.",fo),O.months=Xe("months accessor is deprecated. Use month instead",qa),O.years=Xe("years accessor is deprecated. Use year instead",Ha),O.zone=Xe("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Nd),O.isDSTShifted=Xe("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Wd);function ah(s){return ye(s*1e3)}function oh(){return ye.apply(null,arguments).parseZone()}function xo(s){return s}var de=Mi.prototype;de.calendar=G0,de.longDateFormat=Z0,de.invalidDate=X0,de.ordinal=tc,de.preparse=xo,de.postformat=xo,de.relativeTime=sc,de.pastFuture=ic,de.set=Y0,de.eras=Il,de.erasParse=$l,de.erasConvertYear=Hl,de.erasAbbrRegex=Ul,de.erasNameRegex=ql,de.erasNarrowRegex=Ll,de.months=wc,de.monthsShort=Cc,de.monthsParse=Dc,de.monthsRegex=Tc,de.monthsShortRegex=Ac,de.week=Rc,de.firstDayOfYear=kc,de.firstDayOfWeek=Bc,de.weekdays=Lc,de.weekdaysMin=Yc,de.weekdaysShort=jc,de.weekdaysParse=Gc,de.weekdaysRegex=Zc,de.weekdaysShortRegex=Jc,de.weekdaysMinRegex=Xc,de.isPM=ed,de.meridiem=sd;function Ss(s,e,t,r){var i=St(),n=gt().set(r,e);return i[t](n,s)}function po(s,e,t){if(_t(s)&&(e=s,s=void 0),s=s||"",e!=null)return Ss(s,e,t,"month");var r,i=[];for(r=0;r<12;r++)i[r]=Ss(s,r,t,"month");return i}function dn(s,e,t,r){typeof s=="boolean"?(_t(e)&&(t=e,e=void 0),e=e||""):(e=s,t=e,s=!1,_t(e)&&(t=e,e=void 0),e=e||"");var i=St(),n=s?i._week.dow:0,a,o=[];if(t!=null)return Ss(e,(t+n)%7,r,"day");for(a=0;a<7;a++)o[a]=Ss(e,(a+n)%7,r,"day");return o}function ch(s,e){return po(s,e,"months")}function dh(s,e){return po(s,e,"monthsShort")}function lh(s,e,t){return dn(s,e,t,"weekdays")}function hh(s,e,t){return dn(s,e,t,"weekdaysShort")}function uh(s,e,t){return dn(s,e,t,"weekdaysMin")}Yt("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(s){var e=s%10,t=te(s%100/10)===1?"th":e===1?"st":e===2?"nd":e===3?"rd":"th";return s+t}}),L.lang=Xe("moment.lang is deprecated. Use moment.locale instead.",Yt),L.langData=Xe("moment.langData is deprecated. Use moment.localeData instead.",St);var Rt=Math.abs;function fh(){var s=this._data;return this._milliseconds=Rt(this._milliseconds),this._days=Rt(this._days),this._months=Rt(this._months),s.milliseconds=Rt(s.milliseconds),s.seconds=Rt(s.seconds),s.minutes=Rt(s.minutes),s.hours=Rt(s.hours),s.months=Rt(s.months),s.years=Rt(s.years),this}function mo(s,e,t,r){var i=ot(e,t);return s._milliseconds+=r*i._milliseconds,s._days+=r*i._days,s._months+=r*i._months,s._bubble()}function gh(s,e){return mo(this,s,e,1)}function xh(s,e){return mo(this,s,e,-1)}function vo(s){return s<0?Math.floor(s):Math.ceil(s)}function ph(){var s=this._milliseconds,e=this._days,t=this._months,r=this._data,i,n,a,o,l;return s>=0&&e>=0&&t>=0||s<=0&&e<=0&&t<=0||(s+=vo(ln(t)+e)*864e5,e=0,t=0),r.milliseconds=s%1e3,i=et(s/1e3),r.seconds=i%60,n=et(i/60),r.minutes=n%60,a=et(n/60),r.hours=a%24,e+=et(a/24),l=et(yo(e)),t+=l,e-=vo(ln(l)),o=et(t/12),t%=12,r.days=e,r.months=t,r.years=o,this}function yo(s){return s*4800/146097}function ln(s){return s*146097/4800}function mh(s){if(!this.isValid())return NaN;var e,t,r=this._milliseconds;if(s=Qe(s),s==="month"||s==="quarter"||s==="year")switch(e=this._days+r/864e5,t=this._months+yo(e),s){case"month":return t;case"quarter":return t/3;case"year":return t/12}else switch(e=this._days+Math.round(ln(this._months)),s){case"week":return e/7+r/6048e5;case"day":return e+r/864e5;case"hour":return e*24+r/36e5;case"minute":return e*1440+r/6e4;case"second":return e*86400+r/1e3;case"millisecond":return Math.floor(e*864e5)+r;default:throw new Error("Unknown unit "+s)}}function Ft(s){return function(){return this.as(s)}}var Eo=Ft("ms"),vh=Ft("s"),yh=Ft("m"),Eh=Ft("h"),wh=Ft("d"),Ch=Ft("w"),_h=Ft("M"),Dh=Ft("Q"),bh=Ft("y"),Ah=Eo;function Th(){return ot(this)}function Sh(s){return s=Qe(s),this.isValid()?this[s+"s"]():NaN}function cr(s){return function(){return this.isValid()?this._data[s]:NaN}}var Rh=cr("milliseconds"),Fh=cr("seconds"),Bh=cr("minutes"),kh=cr("hours"),Ih=cr("days"),$h=cr("months"),Hh=cr("years");function Ph(){return et(this.days()/7)}var Bt=Math.round,Dr={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function Oh(s,e,t,r,i){return i.relativeTime(e||1,!!t,s,r)}function Mh(s,e,t,r){var i=ot(s).abs(),n=Bt(i.as("s")),a=Bt(i.as("m")),o=Bt(i.as("h")),l=Bt(i.as("d")),c=Bt(i.as("M")),d=Bt(i.as("w")),g=Bt(i.as("y")),u=n<=t.ss&&["s",n]||n<t.s&&["ss",n]||a<=1&&["m"]||a<t.m&&["mm",a]||o<=1&&["h"]||o<t.h&&["hh",o]||l<=1&&["d"]||l<t.d&&["dd",l];return t.w!=null&&(u=u||d<=1&&["w"]||d<t.w&&["ww",d]),u=u||c<=1&&["M"]||c<t.M&&["MM",c]||g<=1&&["y"]||["yy",g],u[2]=e,u[3]=+s>0,u[4]=r,Oh.apply(null,u)}function Nh(s){return s===void 0?Bt:typeof s=="function"?(Bt=s,!0):!1}function qh(s,e){return Dr[s]===void 0?!1:e===void 0?Dr[s]:(Dr[s]=e,s==="s"&&(Dr.ss=e-1),!0)}function Uh(s,e){if(!this.isValid())return this.localeData().invalidDate();var t=!1,r=Dr,i,n;return typeof s=="object"&&(e=s,s=!1),typeof s=="boolean"&&(t=s),typeof e=="object"&&(r=Object.assign({},Dr,e),e.s!=null&&e.ss==null&&(r.ss=e.s-1)),i=this.localeData(),n=Mh(this,!t,r,i),t&&(n=i.pastFuture(+this,n)),i.postformat(n)}var hn=Math.abs;function br(s){return(s>0)-(s<0)||+s}function Rs(){if(!this.isValid())return this.localeData().invalidDate();var s=hn(this._milliseconds)/1e3,e=hn(this._days),t=hn(this._months),r,i,n,a,o=this.asSeconds(),l,c,d,g;return o?(r=et(s/60),i=et(r/60),s%=60,r%=60,n=et(t/12),t%=12,a=s?s.toFixed(3).replace(/\.?0+$/,""):"",l=o<0?"-":"",c=br(this._months)!==br(o)?"-":"",d=br(this._days)!==br(o)?"-":"",g=br(this._milliseconds)!==br(o)?"-":"",l+"P"+(n?c+n+"Y":"")+(t?c+t+"M":"")+(e?d+e+"D":"")+(i||r||s?"T":"")+(i?g+i+"H":"")+(r?g+r+"M":"")+(s?g+a+"S":"")):"P0D"}var ne=Cs.prototype;ne.isValid=$d,ne.abs=fh,ne.add=gh,ne.subtract=xh,ne.as=mh,ne.asMilliseconds=Eo,ne.asSeconds=vh,ne.asMinutes=yh,ne.asHours=Eh,ne.asDays=wh,ne.asWeeks=Ch,ne.asMonths=_h,ne.asQuarters=Dh,ne.asYears=bh,ne.valueOf=Ah,ne._bubble=ph,ne.clone=Th,ne.get=Sh,ne.milliseconds=Rh,ne.seconds=Fh,ne.minutes=Bh,ne.hours=kh,ne.days=Ih,ne.weeks=Ph,ne.months=$h,ne.years=Hh,ne.humanize=Uh,ne.toISOString=Rs,ne.toString=Rs,ne.toJSON=Rs,ne.locale=no,ne.localeData=oo,ne.toIsoString=Xe("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Rs),ne.lang=ao,V("X",0,0,"unix"),V("x",0,0,"valueOf"),W("x",xs),W("X",cc),xe("X",function(s,e,t){t._d=new Date(parseFloat(s)*1e3)}),xe("x",function(s,e,t){t._d=new Date(te(s))});//! moment.js
|
|
105
|
-
L.version="2.30.1",
|
|
101
|
+
`+new Error().stack),t=!1}return e.apply(this,arguments)},e)}var Ta={};function Sa(s,e){L.deprecationHandler!=null&&L.deprecationHandler(s,e),Ta[s]||(Aa(e),Ta[s]=!0)}L.suppressDeprecationWarnings=!1,L.deprecationHandler=null;function xt(s){return typeof Function<"u"&&s instanceof Function||Object.prototype.toString.call(s)==="[object Function]"}function j0(s){var e,t;for(t in s)ce(s,t)&&(e=s[t],xt(e)?this[t]=e:this["_"+t]=e);this._config=s,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function Oi(s,e){var t=jt({},s),r;for(r in e)ce(e,r)&&(nr(s[r])&&nr(e[r])?(t[r]={},jt(t[r],s[r]),jt(t[r],e[r])):e[r]!=null?t[r]=e[r]:delete t[r]);for(r in s)ce(s,r)&&!ce(e,r)&&nr(s[r])&&(t[r]=jt({},t[r]));return t}function Mi(s){s!=null&&this.set(s)}var Ni;Object.keys?Ni=Object.keys:Ni=function(s){var e,t=[];for(e in s)ce(s,e)&&t.push(e);return t};var Y0={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function W0(s,e,t){var r=this._calendar[s]||this._calendar.sameElse;return xt(r)?r.call(e,t):r}function pt(s,e,t){var r=""+Math.abs(s),i=e-r.length,n=s>=0;return(n?t?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+r}var qi=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,ls=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Ui={},mr={};function V(s,e,t,r){var i=r;typeof r=="string"&&(i=function(){return this[r]()}),s&&(mr[s]=i),e&&(mr[e[0]]=function(){return pt(i.apply(this,arguments),e[1],e[2])}),t&&(mr[t]=function(){return this.localeData().ordinal(i.apply(this,arguments),s)})}function G0(s){return s.match(/\[[\s\S]/)?s.replace(/^\[|\]$/g,""):s.replace(/\\/g,"")}function V0(s){var e=s.match(qi),t,r;for(t=0,r=e.length;t<r;t++)mr[e[t]]?e[t]=mr[e[t]]:e[t]=G0(e[t]);return function(i){var n="",a;for(a=0;a<r;a++)n+=xt(e[a])?e[a].call(i,s):e[a];return n}}function hs(s,e){return s.isValid()?(e=Ra(e,s.localeData()),Ui[e]=Ui[e]||V0(e),Ui[e](s)):s.localeData().invalidDate()}function Ra(s,e){var t=5;function r(i){return e.longDateFormat(i)||i}for(ls.lastIndex=0;t>=0&&ls.test(s);)s=s.replace(ls,r),ls.lastIndex=0,t-=1;return s}var z0={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function K0(s){var e=this._longDateFormat[s],t=this._longDateFormat[s.toUpperCase()];return e||!t?e:(this._longDateFormat[s]=t.match(qi).map(function(r){return r==="MMMM"||r==="MM"||r==="DD"||r==="dddd"?r.slice(1):r}).join(""),this._longDateFormat[s])}var Z0="Invalid date";function J0(){return this._invalidDate}var X0="%d",Q0=/\d{1,2}/;function ec(s){return this._ordinal.replace("%d",s)}var tc={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function rc(s,e,t,r){var i=this._relativeTime[t];return xt(i)?i(s,e,t,r):i.replace(/%d/i,s)}function sc(s,e){var t=this._relativeTime[s>0?"future":"past"];return xt(t)?t(e):t.replace(/%s/i,e)}var Fa={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function Qe(s){return typeof s=="string"?Fa[s]||Fa[s.toLowerCase()]:void 0}function Li(s){var e={},t,r;for(r in s)ce(s,r)&&(t=Qe(r),t&&(e[t]=s[r]));return e}var ic={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function nc(s){var e=[],t;for(t in s)ce(s,t)&&e.push({unit:t,priority:ic[t]});return e.sort(function(r,i){return r.priority-i.priority}),e}var Ba=/\d/,ze=/\d\d/,ka=/\d{3}/,ji=/\d{4}/,us=/[+-]?\d{6}/,ve=/\d\d?/,Ia=/\d\d\d\d?/,$a=/\d\d\d\d\d\d?/,fs=/\d{1,3}/,Yi=/\d{1,4}/,gs=/[+-]?\d{1,6}/,vr=/\d+/,xs=/[+-]?\d+/,ac=/Z|[+-]\d\d:?\d\d/gi,ps=/Z|[+-]\d\d(?::?\d\d)?/gi,oc=/[+-]?\d+(\.\d{1,3})?/,Nr=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,Er=/^[1-9]\d?/,Wi=/^([1-9]\d|\d)/,ms;ms={};function W(s,e,t){ms[s]=xt(e)?e:function(r,i){return r&&t?t:e}}function cc(s,e){return ce(ms,s)?ms[s](e._strict,e._locale):new RegExp(dc(s))}function dc(s){return Dt(s.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,r,i,n){return t||r||i||n}))}function Dt(s){return s.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function et(s){return s<0?Math.ceil(s)||0:Math.floor(s)}function te(s){var e=+s,t=0;return e!==0&&isFinite(e)&&(t=et(e)),t}var Gi={};function xe(s,e){var t,r=e,i;for(typeof s=="string"&&(s=[s]),_t(e)&&(r=function(n,a){a[e]=te(n)}),i=s.length,t=0;t<i;t++)Gi[s[t]]=r}function qr(s,e){xe(s,function(t,r,i,n){i._w=i._w||{},e(t,i._w,i,n)})}function lc(s,e,t){e!=null&&ce(Gi,s)&&Gi[s](e,t._a,t,s)}function vs(s){return s%4===0&&s%100!==0||s%400===0}var Pe=0,bt=1,mt=2,Se=3,at=4,At=5,ar=6,hc=7,uc=8;V("Y",0,0,function(){var s=this.year();return s<=9999?pt(s,4):"+"+s}),V(0,["YY",2],0,function(){return this.year()%100}),V(0,["YYYY",4],0,"year"),V(0,["YYYYY",5],0,"year"),V(0,["YYYYYY",6,!0],0,"year"),W("Y",xs),W("YY",ve,ze),W("YYYY",Yi,ji),W("YYYYY",gs,us),W("YYYYYY",gs,us),xe(["YYYYY","YYYYYY"],Pe),xe("YYYY",function(s,e){e[Pe]=s.length===2?L.parseTwoDigitYear(s):te(s)}),xe("YY",function(s,e){e[Pe]=L.parseTwoDigitYear(s)}),xe("Y",function(s,e){e[Pe]=parseInt(s,10)});function Ur(s){return vs(s)?366:365}L.parseTwoDigitYear=function(s){return te(s)+(te(s)>68?1900:2e3)};var Ha=yr("FullYear",!0);function fc(){return vs(this.year())}function yr(s,e){return function(t){return t!=null?(Pa(this,s,t),L.updateOffset(this,e),this):Lr(this,s)}}function Lr(s,e){if(!s.isValid())return NaN;var t=s._d,r=s._isUTC;switch(e){case"Milliseconds":return r?t.getUTCMilliseconds():t.getMilliseconds();case"Seconds":return r?t.getUTCSeconds():t.getSeconds();case"Minutes":return r?t.getUTCMinutes():t.getMinutes();case"Hours":return r?t.getUTCHours():t.getHours();case"Date":return r?t.getUTCDate():t.getDate();case"Day":return r?t.getUTCDay():t.getDay();case"Month":return r?t.getUTCMonth():t.getMonth();case"FullYear":return r?t.getUTCFullYear():t.getFullYear();default:return NaN}}function Pa(s,e,t){var r,i,n,a,o;if(!(!s.isValid()||isNaN(t))){switch(r=s._d,i=s._isUTC,e){case"Milliseconds":return void(i?r.setUTCMilliseconds(t):r.setMilliseconds(t));case"Seconds":return void(i?r.setUTCSeconds(t):r.setSeconds(t));case"Minutes":return void(i?r.setUTCMinutes(t):r.setMinutes(t));case"Hours":return void(i?r.setUTCHours(t):r.setHours(t));case"Date":return void(i?r.setUTCDate(t):r.setDate(t));case"FullYear":break;default:return}n=t,a=s.month(),o=s.date(),o=o===29&&a===1&&!vs(n)?28:o,i?r.setUTCFullYear(n,a,o):r.setFullYear(n,a,o)}}function gc(s){return s=Qe(s),xt(this[s])?this[s]():this}function xc(s,e){if(typeof s=="object"){s=Li(s);var t=nc(s),r,i=t.length;for(r=0;r<i;r++)this[t[r].unit](s[t[r].unit])}else if(s=Qe(s),xt(this[s]))return this[s](e);return this}function pc(s,e){return(s%e+e)%e}var _e;Array.prototype.indexOf?_e=Array.prototype.indexOf:_e=function(s){var e;for(e=0;e<this.length;++e)if(this[e]===s)return e;return-1};function Vi(s,e){if(isNaN(s)||isNaN(e))return NaN;var t=pc(e,12);return s+=(e-t)/12,t===1?vs(s)?29:28:31-t%7%2}V("M",["MM",2],"Mo",function(){return this.month()+1}),V("MMM",0,0,function(s){return this.localeData().monthsShort(this,s)}),V("MMMM",0,0,function(s){return this.localeData().months(this,s)}),W("M",ve,Er),W("MM",ve,ze),W("MMM",function(s,e){return e.monthsShortRegex(s)}),W("MMMM",function(s,e){return e.monthsRegex(s)}),xe(["M","MM"],function(s,e){e[bt]=te(s)-1}),xe(["MMM","MMMM"],function(s,e,t,r){var i=t._locale.monthsParse(s,r,t._strict);i!=null?e[bt]=i:Q(t).invalidMonth=s});var mc="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Oa="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Ma=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,vc=Nr,Ec=Nr;function yc(s,e){return s?it(this._months)?this._months[s.month()]:this._months[(this._months.isFormat||Ma).test(e)?"format":"standalone"][s.month()]:it(this._months)?this._months:this._months.standalone}function wc(s,e){return s?it(this._monthsShort)?this._monthsShort[s.month()]:this._monthsShort[Ma.test(e)?"format":"standalone"][s.month()]:it(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function Cc(s,e,t){var r,i,n,a=s.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],r=0;r<12;++r)n=gt([2e3,r]),this._shortMonthsParse[r]=this.monthsShort(n,"").toLocaleLowerCase(),this._longMonthsParse[r]=this.months(n,"").toLocaleLowerCase();return t?e==="MMM"?(i=_e.call(this._shortMonthsParse,a),i!==-1?i:null):(i=_e.call(this._longMonthsParse,a),i!==-1?i:null):e==="MMM"?(i=_e.call(this._shortMonthsParse,a),i!==-1?i:(i=_e.call(this._longMonthsParse,a),i!==-1?i:null)):(i=_e.call(this._longMonthsParse,a),i!==-1?i:(i=_e.call(this._shortMonthsParse,a),i!==-1?i:null))}function _c(s,e,t){var r,i,n;if(this._monthsParseExact)return Cc.call(this,s,e,t);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),r=0;r<12;r++){if(i=gt([2e3,r]),t&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[r]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),!t&&!this._monthsParse[r]&&(n="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[r]=new RegExp(n.replace(".",""),"i")),t&&e==="MMMM"&&this._longMonthsParse[r].test(s))return r;if(t&&e==="MMM"&&this._shortMonthsParse[r].test(s))return r;if(!t&&this._monthsParse[r].test(s))return r}}function Na(s,e){if(!s.isValid())return s;if(typeof e=="string"){if(/^\d+$/.test(e))e=te(e);else if(e=s.localeData().monthsParse(e),!_t(e))return s}var t=e,r=s.date();return r=r<29?r:Math.min(r,Vi(s.year(),t)),s._isUTC?s._d.setUTCMonth(t,r):s._d.setMonth(t,r),s}function qa(s){return s!=null?(Na(this,s),L.updateOffset(this,!0),this):Lr(this,"Month")}function Dc(){return Vi(this.year(),this.month())}function bc(s){return this._monthsParseExact?(ce(this,"_monthsRegex")||Ua.call(this),s?this._monthsShortStrictRegex:this._monthsShortRegex):(ce(this,"_monthsShortRegex")||(this._monthsShortRegex=vc),this._monthsShortStrictRegex&&s?this._monthsShortStrictRegex:this._monthsShortRegex)}function Ac(s){return this._monthsParseExact?(ce(this,"_monthsRegex")||Ua.call(this),s?this._monthsStrictRegex:this._monthsRegex):(ce(this,"_monthsRegex")||(this._monthsRegex=Ec),this._monthsStrictRegex&&s?this._monthsStrictRegex:this._monthsRegex)}function Ua(){function s(l,c){return c.length-l.length}var e=[],t=[],r=[],i,n,a,o;for(i=0;i<12;i++)n=gt([2e3,i]),a=Dt(this.monthsShort(n,"")),o=Dt(this.months(n,"")),e.push(a),t.push(o),r.push(o),r.push(a);e.sort(s),t.sort(s),r.sort(s),this._monthsRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+t.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+e.join("|")+")","i")}function Tc(s,e,t,r,i,n,a){var o;return s<100&&s>=0?(o=new Date(s+400,e,t,r,i,n,a),isFinite(o.getFullYear())&&o.setFullYear(s)):o=new Date(s,e,t,r,i,n,a),o}function jr(s){var e,t;return s<100&&s>=0?(t=Array.prototype.slice.call(arguments),t[0]=s+400,e=new Date(Date.UTC.apply(null,t)),isFinite(e.getUTCFullYear())&&e.setUTCFullYear(s)):e=new Date(Date.UTC.apply(null,arguments)),e}function Es(s,e,t){var r=7+e-t,i=(7+jr(s,0,r).getUTCDay()-e)%7;return-i+r-1}function La(s,e,t,r,i){var n=(7+t-r)%7,a=Es(s,r,i),o=1+7*(e-1)+n+a,l,c;return o<=0?(l=s-1,c=Ur(l)+o):o>Ur(s)?(l=s+1,c=o-Ur(s)):(l=s,c=o),{year:l,dayOfYear:c}}function Yr(s,e,t){var r=Es(s.year(),e,t),i=Math.floor((s.dayOfYear()-r-1)/7)+1,n,a;return i<1?(a=s.year()-1,n=i+Tt(a,e,t)):i>Tt(s.year(),e,t)?(n=i-Tt(s.year(),e,t),a=s.year()+1):(a=s.year(),n=i),{week:n,year:a}}function Tt(s,e,t){var r=Es(s,e,t),i=Es(s+1,e,t);return(Ur(s)-r+i)/7}V("w",["ww",2],"wo","week"),V("W",["WW",2],"Wo","isoWeek"),W("w",ve,Er),W("ww",ve,ze),W("W",ve,Er),W("WW",ve,ze),qr(["w","ww","W","WW"],function(s,e,t,r){e[r.substr(0,1)]=te(s)});function Sc(s){return Yr(s,this._week.dow,this._week.doy).week}var Rc={dow:0,doy:6};function Fc(){return this._week.dow}function Bc(){return this._week.doy}function kc(s){var e=this.localeData().week(this);return s==null?e:this.add((s-e)*7,"d")}function Ic(s){var e=Yr(this,1,4).week;return s==null?e:this.add((s-e)*7,"d")}V("d",0,"do","day"),V("dd",0,0,function(s){return this.localeData().weekdaysMin(this,s)}),V("ddd",0,0,function(s){return this.localeData().weekdaysShort(this,s)}),V("dddd",0,0,function(s){return this.localeData().weekdays(this,s)}),V("e",0,0,"weekday"),V("E",0,0,"isoWeekday"),W("d",ve),W("e",ve),W("E",ve),W("dd",function(s,e){return e.weekdaysMinRegex(s)}),W("ddd",function(s,e){return e.weekdaysShortRegex(s)}),W("dddd",function(s,e){return e.weekdaysRegex(s)}),qr(["dd","ddd","dddd"],function(s,e,t,r){var i=t._locale.weekdaysParse(s,r,t._strict);i!=null?e.d=i:Q(t).invalidWeekday=s}),qr(["d","e","E"],function(s,e,t,r){e[r]=te(s)});function $c(s,e){return typeof s!="string"?s:isNaN(s)?(s=e.weekdaysParse(s),typeof s=="number"?s:null):parseInt(s,10)}function Hc(s,e){return typeof s=="string"?e.weekdaysParse(s)%7||7:isNaN(s)?null:s}function zi(s,e){return s.slice(e,7).concat(s.slice(0,e))}var Pc="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),ja="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Oc="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Mc=Nr,Nc=Nr,qc=Nr;function Uc(s,e){var t=it(this._weekdays)?this._weekdays:this._weekdays[s&&s!==!0&&this._weekdays.isFormat.test(e)?"format":"standalone"];return s===!0?zi(t,this._week.dow):s?t[s.day()]:t}function Lc(s){return s===!0?zi(this._weekdaysShort,this._week.dow):s?this._weekdaysShort[s.day()]:this._weekdaysShort}function jc(s){return s===!0?zi(this._weekdaysMin,this._week.dow):s?this._weekdaysMin[s.day()]:this._weekdaysMin}function Yc(s,e,t){var r,i,n,a=s.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],r=0;r<7;++r)n=gt([2e3,1]).day(r),this._minWeekdaysParse[r]=this.weekdaysMin(n,"").toLocaleLowerCase(),this._shortWeekdaysParse[r]=this.weekdaysShort(n,"").toLocaleLowerCase(),this._weekdaysParse[r]=this.weekdays(n,"").toLocaleLowerCase();return t?e==="dddd"?(i=_e.call(this._weekdaysParse,a),i!==-1?i:null):e==="ddd"?(i=_e.call(this._shortWeekdaysParse,a),i!==-1?i:null):(i=_e.call(this._minWeekdaysParse,a),i!==-1?i:null):e==="dddd"?(i=_e.call(this._weekdaysParse,a),i!==-1||(i=_e.call(this._shortWeekdaysParse,a),i!==-1)?i:(i=_e.call(this._minWeekdaysParse,a),i!==-1?i:null)):e==="ddd"?(i=_e.call(this._shortWeekdaysParse,a),i!==-1||(i=_e.call(this._weekdaysParse,a),i!==-1)?i:(i=_e.call(this._minWeekdaysParse,a),i!==-1?i:null)):(i=_e.call(this._minWeekdaysParse,a),i!==-1||(i=_e.call(this._weekdaysParse,a),i!==-1)?i:(i=_e.call(this._shortWeekdaysParse,a),i!==-1?i:null))}function Wc(s,e,t){var r,i,n;if(this._weekdaysParseExact)return Yc.call(this,s,e,t);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;r<7;r++){if(i=gt([2e3,1]).day(r),t&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[r]||(n="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[r]=new RegExp(n.replace(".",""),"i")),t&&e==="dddd"&&this._fullWeekdaysParse[r].test(s))return r;if(t&&e==="ddd"&&this._shortWeekdaysParse[r].test(s))return r;if(t&&e==="dd"&&this._minWeekdaysParse[r].test(s))return r;if(!t&&this._weekdaysParse[r].test(s))return r}}function Gc(s){if(!this.isValid())return s!=null?this:NaN;var e=Lr(this,"Day");return s!=null?(s=$c(s,this.localeData()),this.add(s-e,"d")):e}function Vc(s){if(!this.isValid())return s!=null?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return s==null?e:this.add(s-e,"d")}function zc(s){if(!this.isValid())return s!=null?this:NaN;if(s!=null){var e=Hc(s,this.localeData());return this.day(this.day()%7?e:e-7)}else return this.day()||7}function Kc(s){return this._weekdaysParseExact?(ce(this,"_weekdaysRegex")||Ki.call(this),s?this._weekdaysStrictRegex:this._weekdaysRegex):(ce(this,"_weekdaysRegex")||(this._weekdaysRegex=Mc),this._weekdaysStrictRegex&&s?this._weekdaysStrictRegex:this._weekdaysRegex)}function Zc(s){return this._weekdaysParseExact?(ce(this,"_weekdaysRegex")||Ki.call(this),s?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(ce(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Nc),this._weekdaysShortStrictRegex&&s?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Jc(s){return this._weekdaysParseExact?(ce(this,"_weekdaysRegex")||Ki.call(this),s?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(ce(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=qc),this._weekdaysMinStrictRegex&&s?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Ki(){function s(d,g){return g.length-d.length}var e=[],t=[],r=[],i=[],n,a,o,l,c;for(n=0;n<7;n++)a=gt([2e3,1]).day(n),o=Dt(this.weekdaysMin(a,"")),l=Dt(this.weekdaysShort(a,"")),c=Dt(this.weekdays(a,"")),e.push(o),t.push(l),r.push(c),i.push(o),i.push(l),i.push(c);e.sort(s),t.sort(s),r.sort(s),i.sort(s),this._weekdaysRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+t.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+e.join("|")+")","i")}function Zi(){return this.hours()%12||12}function Xc(){return this.hours()||24}V("H",["HH",2],0,"hour"),V("h",["hh",2],0,Zi),V("k",["kk",2],0,Xc),V("hmm",0,0,function(){return""+Zi.apply(this)+pt(this.minutes(),2)}),V("hmmss",0,0,function(){return""+Zi.apply(this)+pt(this.minutes(),2)+pt(this.seconds(),2)}),V("Hmm",0,0,function(){return""+this.hours()+pt(this.minutes(),2)}),V("Hmmss",0,0,function(){return""+this.hours()+pt(this.minutes(),2)+pt(this.seconds(),2)});function Ya(s,e){V(s,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}Ya("a",!0),Ya("A",!1);function Wa(s,e){return e._meridiemParse}W("a",Wa),W("A",Wa),W("H",ve,Wi),W("h",ve,Er),W("k",ve,Er),W("HH",ve,ze),W("hh",ve,ze),W("kk",ve,ze),W("hmm",Ia),W("hmmss",$a),W("Hmm",Ia),W("Hmmss",$a),xe(["H","HH"],Se),xe(["k","kk"],function(s,e,t){var r=te(s);e[Se]=r===24?0:r}),xe(["a","A"],function(s,e,t){t._isPm=t._locale.isPM(s),t._meridiem=s}),xe(["h","hh"],function(s,e,t){e[Se]=te(s),Q(t).bigHour=!0}),xe("hmm",function(s,e,t){var r=s.length-2;e[Se]=te(s.substr(0,r)),e[at]=te(s.substr(r)),Q(t).bigHour=!0}),xe("hmmss",function(s,e,t){var r=s.length-4,i=s.length-2;e[Se]=te(s.substr(0,r)),e[at]=te(s.substr(r,2)),e[At]=te(s.substr(i)),Q(t).bigHour=!0}),xe("Hmm",function(s,e,t){var r=s.length-2;e[Se]=te(s.substr(0,r)),e[at]=te(s.substr(r))}),xe("Hmmss",function(s,e,t){var r=s.length-4,i=s.length-2;e[Se]=te(s.substr(0,r)),e[at]=te(s.substr(r,2)),e[At]=te(s.substr(i))});function Qc(s){return(s+"").toLowerCase().charAt(0)==="p"}var ed=/[ap]\.?m?\.?/i,td=yr("Hours",!0);function rd(s,e,t){return s>11?t?"pm":"PM":t?"am":"AM"}var Ga={calendar:Y0,longDateFormat:z0,invalidDate:Z0,ordinal:X0,dayOfMonthOrdinalParse:Q0,relativeTime:tc,months:mc,monthsShort:Oa,week:Rc,weekdays:Pc,weekdaysMin:Oc,weekdaysShort:ja,meridiemParse:ed},ye={},Wr={},Gr;function sd(s,e){var t,r=Math.min(s.length,e.length);for(t=0;t<r;t+=1)if(s[t]!==e[t])return t;return r}function Va(s){return s&&s.toLowerCase().replace("_","-")}function id(s){for(var e=0,t,r,i,n;e<s.length;){for(n=Va(s[e]).split("-"),t=n.length,r=Va(s[e+1]),r=r?r.split("-"):null;t>0;){if(i=ys(n.slice(0,t).join("-")),i)return i;if(r&&r.length>=t&&sd(n,r)>=t-1)break;t--}e++}return Gr}function nd(s){return!!(s&&s.match("^[^/\\\\]*$"))}function ys(s){var e=null,t;if(ye[s]===void 0&&typeof module<"u"&&module&&module.exports&&nd(s))try{e=Gr._abbr,t=require,t("./locale/"+s),Yt(e)}catch{ye[s]=null}return ye[s]}function Yt(s,e){var t;return s&&(Ye(e)?t=St(s):t=Ji(s,e),t?Gr=t:typeof console<"u"&&console.warn&&console.warn("Locale "+s+" not found. Did you forget to load it?")),Gr._abbr}function Ji(s,e){if(e!==null){var t,r=Ga;if(e.abbr=s,ye[s]!=null)Sa("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),r=ye[s]._config;else if(e.parentLocale!=null)if(ye[e.parentLocale]!=null)r=ye[e.parentLocale]._config;else if(t=ys(e.parentLocale),t!=null)r=t._config;else return Wr[e.parentLocale]||(Wr[e.parentLocale]=[]),Wr[e.parentLocale].push({name:s,config:e}),null;return ye[s]=new Mi(Oi(r,e)),Wr[s]&&Wr[s].forEach(function(i){Ji(i.name,i.config)}),Yt(s),ye[s]}else return delete ye[s],null}function ad(s,e){if(e!=null){var t,r,i=Ga;ye[s]!=null&&ye[s].parentLocale!=null?ye[s].set(Oi(ye[s]._config,e)):(r=ys(s),r!=null&&(i=r._config),e=Oi(i,e),r==null&&(e.abbr=s),t=new Mi(e),t.parentLocale=ye[s],ye[s]=t),Yt(s)}else ye[s]!=null&&(ye[s].parentLocale!=null?(ye[s]=ye[s].parentLocale,s===Yt()&&Yt(s)):ye[s]!=null&&delete ye[s]);return ye[s]}function St(s){var e;if(s&&s._locale&&s._locale._abbr&&(s=s._locale._abbr),!s)return Gr;if(!it(s)){if(e=ys(s),e)return e;s=[s]}return id(s)}function od(){return Ni(ye)}function Xi(s){var e,t=s._a;return t&&Q(s).overflow===-2&&(e=t[bt]<0||t[bt]>11?bt:t[mt]<1||t[mt]>Vi(t[Pe],t[bt])?mt:t[Se]<0||t[Se]>24||t[Se]===24&&(t[at]!==0||t[At]!==0||t[ar]!==0)?Se:t[at]<0||t[at]>59?at:t[At]<0||t[At]>59?At:t[ar]<0||t[ar]>999?ar:-1,Q(s)._overflowDayOfYear&&(e<Pe||e>mt)&&(e=mt),Q(s)._overflowWeeks&&e===-1&&(e=hc),Q(s)._overflowWeekday&&e===-1&&(e=uc),Q(s).overflow=e),s}var cd=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,dd=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ld=/Z|[+-]\d\d(?::?\d\d)?/,ws=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Qi=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],hd=/^\/?Date\((-?\d+)/i,ud=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,fd={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function za(s){var e,t,r=s._i,i=cd.exec(r)||dd.exec(r),n,a,o,l,c=ws.length,d=Qi.length;if(i){for(Q(s).iso=!0,e=0,t=c;e<t;e++)if(ws[e][1].exec(i[1])){a=ws[e][0],n=ws[e][2]!==!1;break}if(a==null){s._isValid=!1;return}if(i[3]){for(e=0,t=d;e<t;e++)if(Qi[e][1].exec(i[3])){o=(i[2]||" ")+Qi[e][0];break}if(o==null){s._isValid=!1;return}}if(!n&&o!=null){s._isValid=!1;return}if(i[4])if(ld.exec(i[4]))l="Z";else{s._isValid=!1;return}s._f=a+(o||"")+(l||""),tn(s)}else s._isValid=!1}function gd(s,e,t,r,i,n){var a=[xd(s),Oa.indexOf(e),parseInt(t,10),parseInt(r,10),parseInt(i,10)];return n&&a.push(parseInt(n,10)),a}function xd(s){var e=parseInt(s,10);return e<=49?2e3+e:e<=999?1900+e:e}function pd(s){return s.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function md(s,e,t){if(s){var r=ja.indexOf(s),i=new Date(e[0],e[1],e[2]).getDay();if(r!==i)return Q(t).weekdayMismatch=!0,t._isValid=!1,!1}return!0}function vd(s,e,t){if(s)return fd[s];if(e)return 0;var r=parseInt(t,10),i=r%100,n=(r-i)/100;return n*60+i}function Ka(s){var e=ud.exec(pd(s._i)),t;if(e){if(t=gd(e[4],e[3],e[2],e[5],e[6],e[7]),!md(e[1],t,s))return;s._a=t,s._tzm=vd(e[8],e[9],e[10]),s._d=jr.apply(null,s._a),s._d.setUTCMinutes(s._d.getUTCMinutes()-s._tzm),Q(s).rfc2822=!0}else s._isValid=!1}function Ed(s){var e=hd.exec(s._i);if(e!==null){s._d=new Date(+e[1]);return}if(za(s),s._isValid===!1)delete s._isValid;else return;if(Ka(s),s._isValid===!1)delete s._isValid;else return;s._strict?s._isValid=!1:L.createFromInputFallback(s)}L.createFromInputFallback=Xe("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(s){s._d=new Date(s._i+(s._useUTC?" UTC":""))});function wr(s,e,t){return s??e??t}function yd(s){var e=new Date(L.now());return s._useUTC?[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()]:[e.getFullYear(),e.getMonth(),e.getDate()]}function en(s){var e,t,r=[],i,n,a;if(!s._d){for(i=yd(s),s._w&&s._a[mt]==null&&s._a[bt]==null&&wd(s),s._dayOfYear!=null&&(a=wr(s._a[Pe],i[Pe]),(s._dayOfYear>Ur(a)||s._dayOfYear===0)&&(Q(s)._overflowDayOfYear=!0),t=jr(a,0,s._dayOfYear),s._a[bt]=t.getUTCMonth(),s._a[mt]=t.getUTCDate()),e=0;e<3&&s._a[e]==null;++e)s._a[e]=r[e]=i[e];for(;e<7;e++)s._a[e]=r[e]=s._a[e]==null?e===2?1:0:s._a[e];s._a[Se]===24&&s._a[at]===0&&s._a[At]===0&&s._a[ar]===0&&(s._nextDay=!0,s._a[Se]=0),s._d=(s._useUTC?jr:Tc).apply(null,r),n=s._useUTC?s._d.getUTCDay():s._d.getDay(),s._tzm!=null&&s._d.setUTCMinutes(s._d.getUTCMinutes()-s._tzm),s._nextDay&&(s._a[Se]=24),s._w&&typeof s._w.d<"u"&&s._w.d!==n&&(Q(s).weekdayMismatch=!0)}}function wd(s){var e,t,r,i,n,a,o,l,c;e=s._w,e.GG!=null||e.W!=null||e.E!=null?(n=1,a=4,t=wr(e.GG,s._a[Pe],Yr(Ee(),1,4).year),r=wr(e.W,1),i=wr(e.E,1),(i<1||i>7)&&(l=!0)):(n=s._locale._week.dow,a=s._locale._week.doy,c=Yr(Ee(),n,a),t=wr(e.gg,s._a[Pe],c.year),r=wr(e.w,c.week),e.d!=null?(i=e.d,(i<0||i>6)&&(l=!0)):e.e!=null?(i=e.e+n,(e.e<0||e.e>6)&&(l=!0)):i=n),r<1||r>Tt(t,n,a)?Q(s)._overflowWeeks=!0:l!=null?Q(s)._overflowWeekday=!0:(o=La(t,r,i,n,a),s._a[Pe]=o.year,s._dayOfYear=o.dayOfYear)}L.ISO_8601=function(){},L.RFC_2822=function(){};function tn(s){if(s._f===L.ISO_8601){za(s);return}if(s._f===L.RFC_2822){Ka(s);return}s._a=[],Q(s).empty=!0;var e=""+s._i,t,r,i,n,a,o=e.length,l=0,c,d;for(i=Ra(s._f,s._locale).match(qi)||[],d=i.length,t=0;t<d;t++)n=i[t],r=(e.match(cc(n,s))||[])[0],r&&(a=e.substr(0,e.indexOf(r)),a.length>0&&Q(s).unusedInput.push(a),e=e.slice(e.indexOf(r)+r.length),l+=r.length),mr[n]?(r?Q(s).empty=!1:Q(s).unusedTokens.push(n),lc(n,r,s)):s._strict&&!r&&Q(s).unusedTokens.push(n);Q(s).charsLeftOver=o-l,e.length>0&&Q(s).unusedInput.push(e),s._a[Se]<=12&&Q(s).bigHour===!0&&s._a[Se]>0&&(Q(s).bigHour=void 0),Q(s).parsedDateParts=s._a.slice(0),Q(s).meridiem=s._meridiem,s._a[Se]=Cd(s._locale,s._a[Se],s._meridiem),c=Q(s).era,c!==null&&(s._a[Pe]=s._locale.erasConvertYear(c,s._a[Pe])),en(s),Xi(s)}function Cd(s,e,t){var r;return t==null?e:s.meridiemHour!=null?s.meridiemHour(e,t):(s.isPM!=null&&(r=s.isPM(t),r&&e<12&&(e+=12),!r&&e===12&&(e=0)),e)}function _d(s){var e,t,r,i,n,a,o=!1,l=s._f.length;if(l===0){Q(s).invalidFormat=!0,s._d=new Date(NaN);return}for(i=0;i<l;i++)n=0,a=!1,e=Pi({},s),s._useUTC!=null&&(e._useUTC=s._useUTC),e._f=s._f[i],tn(e),$i(e)&&(a=!0),n+=Q(e).charsLeftOver,n+=Q(e).unusedTokens.length*10,Q(e).score=n,o?n<r&&(r=n,t=e):(r==null||n<r||a)&&(r=n,t=e,a&&(o=!0));jt(s,t||e)}function Dd(s){if(!s._d){var e=Li(s._i),t=e.day===void 0?e.date:e.day;s._a=Da([e.year,e.month,t,e.hour,e.minute,e.second,e.millisecond],function(r){return r&&parseInt(r,10)}),en(s)}}function bd(s){var e=new Mr(Xi(Za(s)));return e._nextDay&&(e.add(1,"d"),e._nextDay=void 0),e}function Za(s){var e=s._i,t=s._f;return s._locale=s._locale||St(s._l),e===null||t===void 0&&e===""?ds({nullInput:!0}):(typeof e=="string"&&(s._i=e=s._locale.preparse(e)),nt(e)?new Mr(Xi(e)):(Or(e)?s._d=e:it(t)?_d(s):t?tn(s):Ad(s),$i(s)||(s._d=null),s))}function Ad(s){var e=s._i;Ye(e)?s._d=new Date(L.now()):Or(e)?s._d=new Date(e.valueOf()):typeof e=="string"?Ed(s):it(e)?(s._a=Da(e.slice(0),function(t){return parseInt(t,10)}),en(s)):nr(e)?Dd(s):_t(e)?s._d=new Date(e):L.createFromInputFallback(s)}function Ja(s,e,t,r,i){var n={};return(e===!0||e===!1)&&(r=e,e=void 0),(t===!0||t===!1)&&(r=t,t=void 0),(nr(s)&&ki(s)||it(s)&&s.length===0)&&(s=void 0),n._isAMomentObject=!0,n._useUTC=n._isUTC=i,n._l=t,n._i=s,n._f=e,n._strict=r,bd(n)}function Ee(s,e,t,r){return Ja(s,e,t,r,!1)}var Td=Xe("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var s=Ee.apply(null,arguments);return this.isValid()&&s.isValid()?s<this?this:s:ds()}),Sd=Xe("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var s=Ee.apply(null,arguments);return this.isValid()&&s.isValid()?s>this?this:s:ds()});function Xa(s,e){var t,r;if(e.length===1&&it(e[0])&&(e=e[0]),!e.length)return Ee();for(t=e[0],r=1;r<e.length;++r)(!e[r].isValid()||e[r][s](t))&&(t=e[r]);return t}function Rd(){var s=[].slice.call(arguments,0);return Xa("isBefore",s)}function Fd(){var s=[].slice.call(arguments,0);return Xa("isAfter",s)}var Bd=function(){return Date.now?Date.now():+new Date},Vr=["year","quarter","month","week","day","hour","minute","second","millisecond"];function kd(s){var e,t=!1,r,i=Vr.length;for(e in s)if(ce(s,e)&&!(_e.call(Vr,e)!==-1&&(s[e]==null||!isNaN(s[e]))))return!1;for(r=0;r<i;++r)if(s[Vr[r]]){if(t)return!1;parseFloat(s[Vr[r]])!==te(s[Vr[r]])&&(t=!0)}return!0}function Id(){return this._isValid}function $d(){return ot(NaN)}function Cs(s){var e=Li(s),t=e.year||0,r=e.quarter||0,i=e.month||0,n=e.week||e.isoWeek||0,a=e.day||0,o=e.hour||0,l=e.minute||0,c=e.second||0,d=e.millisecond||0;this._isValid=kd(e),this._milliseconds=+d+c*1e3+l*6e4+o*1e3*60*60,this._days=+a+n*7,this._months=+i+r*3+t*12,this._data={},this._locale=St(),this._bubble()}function _s(s){return s instanceof Cs}function rn(s){return s<0?Math.round(-1*s)*-1:Math.round(s)}function Hd(s,e,t){var r=Math.min(s.length,e.length),i=Math.abs(s.length-e.length),n=0,a;for(a=0;a<r;a++)te(s[a])!==te(e[a])&&n++;return n+i}function Qa(s,e){V(s,0,0,function(){var t=this.utcOffset(),r="+";return t<0&&(t=-t,r="-"),r+pt(~~(t/60),2)+e+pt(~~t%60,2)})}Qa("Z",":"),Qa("ZZ",""),W("Z",ps),W("ZZ",ps),xe(["Z","ZZ"],function(s,e,t){t._useUTC=!0,t._tzm=sn(ps,s)});var Pd=/([\+\-]|\d\d)/gi;function sn(s,e){var t=(e||"").match(s),r,i,n;return t===null?null:(r=t[t.length-1]||[],i=(r+"").match(Pd)||["-",0,0],n=+(i[1]*60)+te(i[2]),n===0?0:i[0]==="+"?n:-n)}function nn(s,e){var t,r;return e._isUTC?(t=e.clone(),r=(nt(s)||Or(s)?s.valueOf():Ee(s).valueOf())-t.valueOf(),t._d.setTime(t._d.valueOf()+r),L.updateOffset(t,!1),t):Ee(s).local()}function an(s){return-Math.round(s._d.getTimezoneOffset())}L.updateOffset=function(){};function Od(s,e,t){var r=this._offset||0,i;if(!this.isValid())return s!=null?this:NaN;if(s!=null){if(typeof s=="string"){if(s=sn(ps,s),s===null)return this}else Math.abs(s)<16&&!t&&(s=s*60);return!this._isUTC&&e&&(i=an(this)),this._offset=s,this._isUTC=!0,i!=null&&this.add(i,"m"),r!==s&&(!e||this._changeInProgress?so(this,ot(s-r,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,L.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?r:an(this)}function Md(s,e){return s!=null?(typeof s!="string"&&(s=-s),this.utcOffset(s,e),this):-this.utcOffset()}function Nd(s){return this.utcOffset(0,s)}function qd(s){return this._isUTC&&(this.utcOffset(0,s),this._isUTC=!1,s&&this.subtract(an(this),"m")),this}function Ud(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var s=sn(ac,this._i);s!=null?this.utcOffset(s):this.utcOffset(0,!0)}return this}function Ld(s){return this.isValid()?(s=s?Ee(s).utcOffset():0,(this.utcOffset()-s)%60===0):!1}function jd(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Yd(){if(!Ye(this._isDSTShifted))return this._isDSTShifted;var s={},e;return Pi(s,this),s=Za(s),s._a?(e=s._isUTC?gt(s._a):Ee(s._a),this._isDSTShifted=this.isValid()&&Hd(s._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Wd(){return this.isValid()?!this._isUTC:!1}function Gd(){return this.isValid()?this._isUTC:!1}function eo(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Vd=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,zd=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function ot(s,e){var t=s,r=null,i,n,a;return _s(s)?t={ms:s._milliseconds,d:s._days,M:s._months}:_t(s)||!isNaN(+s)?(t={},e?t[e]=+s:t.milliseconds=+s):(r=Vd.exec(s))?(i=r[1]==="-"?-1:1,t={y:0,d:te(r[mt])*i,h:te(r[Se])*i,m:te(r[at])*i,s:te(r[At])*i,ms:te(rn(r[ar]*1e3))*i}):(r=zd.exec(s))?(i=r[1]==="-"?-1:1,t={y:or(r[2],i),M:or(r[3],i),w:or(r[4],i),d:or(r[5],i),h:or(r[6],i),m:or(r[7],i),s:or(r[8],i)}):t==null?t={}:typeof t=="object"&&("from"in t||"to"in t)&&(a=Kd(Ee(t.from),Ee(t.to)),t={},t.ms=a.milliseconds,t.M=a.months),n=new Cs(t),_s(s)&&ce(s,"_locale")&&(n._locale=s._locale),_s(s)&&ce(s,"_isValid")&&(n._isValid=s._isValid),n}ot.fn=Cs.prototype,ot.invalid=$d;function or(s,e){var t=s&&parseFloat(s.replace(",","."));return(isNaN(t)?0:t)*e}function to(s,e){var t={};return t.months=e.month()-s.month()+(e.year()-s.year())*12,s.clone().add(t.months,"M").isAfter(e)&&--t.months,t.milliseconds=+e-+s.clone().add(t.months,"M"),t}function Kd(s,e){var t;return s.isValid()&&e.isValid()?(e=nn(e,s),s.isBefore(e)?t=to(s,e):(t=to(e,s),t.milliseconds=-t.milliseconds,t.months=-t.months),t):{milliseconds:0,months:0}}function ro(s,e){return function(t,r){var i,n;return r!==null&&!isNaN(+r)&&(Sa(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=t,t=r,r=n),i=ot(t,r),so(this,i,s),this}}function so(s,e,t,r){var i=e._milliseconds,n=rn(e._days),a=rn(e._months);s.isValid()&&(r=r??!0,a&&Na(s,Lr(s,"Month")+a*t),n&&Pa(s,"Date",Lr(s,"Date")+n*t),i&&s._d.setTime(s._d.valueOf()+i*t),r&&L.updateOffset(s,n||a))}var Zd=ro(1,"add"),Jd=ro(-1,"subtract");function io(s){return typeof s=="string"||s instanceof String}function Xd(s){return nt(s)||Or(s)||io(s)||_t(s)||el(s)||Qd(s)||s===null||s===void 0}function Qd(s){var e=nr(s)&&!ki(s),t=!1,r=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],i,n,a=r.length;for(i=0;i<a;i+=1)n=r[i],t=t||ce(s,n);return e&&t}function el(s){var e=it(s),t=!1;return e&&(t=s.filter(function(r){return!_t(r)&&io(s)}).length===0),e&&t}function tl(s){var e=nr(s)&&!ki(s),t=!1,r=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],i,n;for(i=0;i<r.length;i+=1)n=r[i],t=t||ce(s,n);return e&&t}function rl(s,e){var t=s.diff(e,"days",!0);return t<-6?"sameElse":t<-1?"lastWeek":t<0?"lastDay":t<1?"sameDay":t<2?"nextDay":t<7?"nextWeek":"sameElse"}function sl(s,e){arguments.length===1&&(arguments[0]?Xd(arguments[0])?(s=arguments[0],e=void 0):tl(arguments[0])&&(e=arguments[0],s=void 0):(s=void 0,e=void 0));var t=s||Ee(),r=nn(t,this).startOf("day"),i=L.calendarFormat(this,r)||"sameElse",n=e&&(xt(e[i])?e[i].call(this,t):e[i]);return this.format(n||this.localeData().calendar(i,this,Ee(t)))}function il(){return new Mr(this)}function nl(s,e){var t=nt(s)?s:Ee(s);return this.isValid()&&t.isValid()?(e=Qe(e)||"millisecond",e==="millisecond"?this.valueOf()>t.valueOf():t.valueOf()<this.clone().startOf(e).valueOf()):!1}function al(s,e){var t=nt(s)?s:Ee(s);return this.isValid()&&t.isValid()?(e=Qe(e)||"millisecond",e==="millisecond"?this.valueOf()<t.valueOf():this.clone().endOf(e).valueOf()<t.valueOf()):!1}function ol(s,e,t,r){var i=nt(s)?s:Ee(s),n=nt(e)?e:Ee(e);return this.isValid()&&i.isValid()&&n.isValid()?(r=r||"()",(r[0]==="("?this.isAfter(i,t):!this.isBefore(i,t))&&(r[1]===")"?this.isBefore(n,t):!this.isAfter(n,t))):!1}function cl(s,e){var t=nt(s)?s:Ee(s),r;return this.isValid()&&t.isValid()?(e=Qe(e)||"millisecond",e==="millisecond"?this.valueOf()===t.valueOf():(r=t.valueOf(),this.clone().startOf(e).valueOf()<=r&&r<=this.clone().endOf(e).valueOf())):!1}function dl(s,e){return this.isSame(s,e)||this.isAfter(s,e)}function ll(s,e){return this.isSame(s,e)||this.isBefore(s,e)}function hl(s,e,t){var r,i,n;if(!this.isValid())return NaN;if(r=nn(s,this),!r.isValid())return NaN;switch(i=(r.utcOffset()-this.utcOffset())*6e4,e=Qe(e),e){case"year":n=Ds(this,r)/12;break;case"month":n=Ds(this,r);break;case"quarter":n=Ds(this,r)/3;break;case"second":n=(this-r)/1e3;break;case"minute":n=(this-r)/6e4;break;case"hour":n=(this-r)/36e5;break;case"day":n=(this-r-i)/864e5;break;case"week":n=(this-r-i)/6048e5;break;default:n=this-r}return t?n:et(n)}function Ds(s,e){if(s.date()<e.date())return-Ds(e,s);var t=(e.year()-s.year())*12+(e.month()-s.month()),r=s.clone().add(t,"months"),i,n;return e-r<0?(i=s.clone().add(t-1,"months"),n=(e-r)/(r-i)):(i=s.clone().add(t+1,"months"),n=(e-r)/(i-r)),-(t+n)||0}L.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",L.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function ul(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function fl(s){if(!this.isValid())return null;var e=s!==!0,t=e?this.clone().utc():this;return t.year()<0||t.year()>9999?hs(t,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):xt(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",hs(t,"Z")):hs(t,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function gl(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var s="moment",e="",t,r,i,n;return this.isLocal()||(s=this.utcOffset()===0?"moment.utc":"moment.parseZone",e="Z"),t="["+s+'("]',r=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i="-MM-DD[T]HH:mm:ss.SSS",n=e+'[")]',this.format(t+r+i+n)}function xl(s){s||(s=this.isUtc()?L.defaultFormatUtc:L.defaultFormat);var e=hs(this,s);return this.localeData().postformat(e)}function pl(s,e){return this.isValid()&&(nt(s)&&s.isValid()||Ee(s).isValid())?ot({to:this,from:s}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function ml(s){return this.from(Ee(),s)}function vl(s,e){return this.isValid()&&(nt(s)&&s.isValid()||Ee(s).isValid())?ot({from:this,to:s}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function El(s){return this.to(Ee(),s)}function no(s){var e;return s===void 0?this._locale._abbr:(e=St(s),e!=null&&(this._locale=e),this)}var ao=Xe("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(s){return s===void 0?this.localeData():this.locale(s)});function oo(){return this._locale}var bs=1e3,Cr=60*bs,As=60*Cr,co=(365*400+97)*24*As;function _r(s,e){return(s%e+e)%e}function lo(s,e,t){return s<100&&s>=0?new Date(s+400,e,t)-co:new Date(s,e,t).valueOf()}function ho(s,e,t){return s<100&&s>=0?Date.UTC(s+400,e,t)-co:Date.UTC(s,e,t)}function yl(s){var e,t;if(s=Qe(s),s===void 0||s==="millisecond"||!this.isValid())return this;switch(t=this._isUTC?ho:lo,s){case"year":e=t(this.year(),0,1);break;case"quarter":e=t(this.year(),this.month()-this.month()%3,1);break;case"month":e=t(this.year(),this.month(),1);break;case"week":e=t(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":e=t(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":e=t(this.year(),this.month(),this.date());break;case"hour":e=this._d.valueOf(),e-=_r(e+(this._isUTC?0:this.utcOffset()*Cr),As);break;case"minute":e=this._d.valueOf(),e-=_r(e,Cr);break;case"second":e=this._d.valueOf(),e-=_r(e,bs);break}return this._d.setTime(e),L.updateOffset(this,!0),this}function wl(s){var e,t;if(s=Qe(s),s===void 0||s==="millisecond"||!this.isValid())return this;switch(t=this._isUTC?ho:lo,s){case"year":e=t(this.year()+1,0,1)-1;break;case"quarter":e=t(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":e=t(this.year(),this.month()+1,1)-1;break;case"week":e=t(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":e=t(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":e=t(this.year(),this.month(),this.date()+1)-1;break;case"hour":e=this._d.valueOf(),e+=As-_r(e+(this._isUTC?0:this.utcOffset()*Cr),As)-1;break;case"minute":e=this._d.valueOf(),e+=Cr-_r(e,Cr)-1;break;case"second":e=this._d.valueOf(),e+=bs-_r(e,bs)-1;break}return this._d.setTime(e),L.updateOffset(this,!0),this}function Cl(){return this._d.valueOf()-(this._offset||0)*6e4}function _l(){return Math.floor(this.valueOf()/1e3)}function Dl(){return new Date(this.valueOf())}function bl(){var s=this;return[s.year(),s.month(),s.date(),s.hour(),s.minute(),s.second(),s.millisecond()]}function Al(){var s=this;return{years:s.year(),months:s.month(),date:s.date(),hours:s.hours(),minutes:s.minutes(),seconds:s.seconds(),milliseconds:s.milliseconds()}}function Tl(){return this.isValid()?this.toISOString():null}function Sl(){return $i(this)}function Rl(){return jt({},Q(this))}function Fl(){return Q(this).overflow}function Bl(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}V("N",0,0,"eraAbbr"),V("NN",0,0,"eraAbbr"),V("NNN",0,0,"eraAbbr"),V("NNNN",0,0,"eraName"),V("NNNNN",0,0,"eraNarrow"),V("y",["y",1],"yo","eraYear"),V("y",["yy",2],0,"eraYear"),V("y",["yyy",3],0,"eraYear"),V("y",["yyyy",4],0,"eraYear"),W("N",on),W("NN",on),W("NNN",on),W("NNNN",Ll),W("NNNNN",jl),xe(["N","NN","NNN","NNNN","NNNNN"],function(s,e,t,r){var i=t._locale.erasParse(s,r,t._strict);i?Q(t).era=i:Q(t).invalidEra=s}),W("y",vr),W("yy",vr),W("yyy",vr),W("yyyy",vr),W("yo",Yl),xe(["y","yy","yyy","yyyy"],Pe),xe(["yo"],function(s,e,t,r){var i;t._locale._eraYearOrdinalRegex&&(i=s.match(t._locale._eraYearOrdinalRegex)),t._locale.eraYearOrdinalParse?e[Pe]=t._locale.eraYearOrdinalParse(s,i):e[Pe]=parseInt(s,10)});function kl(s,e){var t,r,i,n=this._eras||St("en")._eras;for(t=0,r=n.length;t<r;++t){switch(typeof n[t].since){case"string":i=L(n[t].since).startOf("day"),n[t].since=i.valueOf();break}switch(typeof n[t].until){case"undefined":n[t].until=1/0;break;case"string":i=L(n[t].until).startOf("day").valueOf(),n[t].until=i.valueOf();break}}return n}function Il(s,e,t){var r,i,n=this.eras(),a,o,l;for(s=s.toUpperCase(),r=0,i=n.length;r<i;++r)if(a=n[r].name.toUpperCase(),o=n[r].abbr.toUpperCase(),l=n[r].narrow.toUpperCase(),t)switch(e){case"N":case"NN":case"NNN":if(o===s)return n[r];break;case"NNNN":if(a===s)return n[r];break;case"NNNNN":if(l===s)return n[r];break}else if([a,o,l].indexOf(s)>=0)return n[r]}function $l(s,e){var t=s.since<=s.until?1:-1;return e===void 0?L(s.since).year():L(s.since).year()+(e-s.offset)*t}function Hl(){var s,e,t,r=this.localeData().eras();for(s=0,e=r.length;s<e;++s)if(t=this.clone().startOf("day").valueOf(),r[s].since<=t&&t<=r[s].until||r[s].until<=t&&t<=r[s].since)return r[s].name;return""}function Pl(){var s,e,t,r=this.localeData().eras();for(s=0,e=r.length;s<e;++s)if(t=this.clone().startOf("day").valueOf(),r[s].since<=t&&t<=r[s].until||r[s].until<=t&&t<=r[s].since)return r[s].narrow;return""}function Ol(){var s,e,t,r=this.localeData().eras();for(s=0,e=r.length;s<e;++s)if(t=this.clone().startOf("day").valueOf(),r[s].since<=t&&t<=r[s].until||r[s].until<=t&&t<=r[s].since)return r[s].abbr;return""}function Ml(){var s,e,t,r,i=this.localeData().eras();for(s=0,e=i.length;s<e;++s)if(t=i[s].since<=i[s].until?1:-1,r=this.clone().startOf("day").valueOf(),i[s].since<=r&&r<=i[s].until||i[s].until<=r&&r<=i[s].since)return(this.year()-L(i[s].since).year())*t+i[s].offset;return this.year()}function Nl(s){return ce(this,"_erasNameRegex")||cn.call(this),s?this._erasNameRegex:this._erasRegex}function ql(s){return ce(this,"_erasAbbrRegex")||cn.call(this),s?this._erasAbbrRegex:this._erasRegex}function Ul(s){return ce(this,"_erasNarrowRegex")||cn.call(this),s?this._erasNarrowRegex:this._erasRegex}function on(s,e){return e.erasAbbrRegex(s)}function Ll(s,e){return e.erasNameRegex(s)}function jl(s,e){return e.erasNarrowRegex(s)}function Yl(s,e){return e._eraYearOrdinalRegex||vr}function cn(){var s=[],e=[],t=[],r=[],i,n,a,o,l,c=this.eras();for(i=0,n=c.length;i<n;++i)a=Dt(c[i].name),o=Dt(c[i].abbr),l=Dt(c[i].narrow),e.push(a),s.push(o),t.push(l),r.push(a),r.push(o),r.push(l);this._erasRegex=new RegExp("^("+r.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+e.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+s.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+t.join("|")+")","i")}V(0,["gg",2],0,function(){return this.weekYear()%100}),V(0,["GG",2],0,function(){return this.isoWeekYear()%100});function Ts(s,e){V(0,[s,s.length],0,e)}Ts("gggg","weekYear"),Ts("ggggg","weekYear"),Ts("GGGG","isoWeekYear"),Ts("GGGGG","isoWeekYear"),W("G",xs),W("g",xs),W("GG",ve,ze),W("gg",ve,ze),W("GGGG",Yi,ji),W("gggg",Yi,ji),W("GGGGG",gs,us),W("ggggg",gs,us),qr(["gggg","ggggg","GGGG","GGGGG"],function(s,e,t,r){e[r.substr(0,2)]=te(s)}),qr(["gg","GG"],function(s,e,t,r){e[r]=L.parseTwoDigitYear(s)});function Wl(s){return uo.call(this,s,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function Gl(s){return uo.call(this,s,this.isoWeek(),this.isoWeekday(),1,4)}function Vl(){return Tt(this.year(),1,4)}function zl(){return Tt(this.isoWeekYear(),1,4)}function Kl(){var s=this.localeData()._week;return Tt(this.year(),s.dow,s.doy)}function Zl(){var s=this.localeData()._week;return Tt(this.weekYear(),s.dow,s.doy)}function uo(s,e,t,r,i){var n;return s==null?Yr(this,r,i).year:(n=Tt(s,r,i),e>n&&(e=n),Jl.call(this,s,e,t,r,i))}function Jl(s,e,t,r,i){var n=La(s,e,t,r,i),a=jr(n.year,0,n.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}V("Q",0,"Qo","quarter"),W("Q",Ba),xe("Q",function(s,e){e[bt]=(te(s)-1)*3});function Xl(s){return s==null?Math.ceil((this.month()+1)/3):this.month((s-1)*3+this.month()%3)}V("D",["DD",2],"Do","date"),W("D",ve,Er),W("DD",ve,ze),W("Do",function(s,e){return s?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient}),xe(["D","DD"],mt),xe("Do",function(s,e){e[mt]=te(s.match(ve)[0])});var fo=yr("Date",!0);V("DDD",["DDDD",3],"DDDo","dayOfYear"),W("DDD",fs),W("DDDD",ka),xe(["DDD","DDDD"],function(s,e,t){t._dayOfYear=te(s)});function Ql(s){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return s==null?e:this.add(s-e,"d")}V("m",["mm",2],0,"minute"),W("m",ve,Wi),W("mm",ve,ze),xe(["m","mm"],at);var eh=yr("Minutes",!1);V("s",["ss",2],0,"second"),W("s",ve,Wi),W("ss",ve,ze),xe(["s","ss"],At);var th=yr("Seconds",!1);V("S",0,0,function(){return~~(this.millisecond()/100)}),V(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),V(0,["SSS",3],0,"millisecond"),V(0,["SSSS",4],0,function(){return this.millisecond()*10}),V(0,["SSSSS",5],0,function(){return this.millisecond()*100}),V(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),V(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),V(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),V(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),W("S",fs,Ba),W("SS",fs,ze),W("SSS",fs,ka);var Wt,go;for(Wt="SSSS";Wt.length<=9;Wt+="S")W(Wt,vr);function rh(s,e){e[ar]=te(("0."+s)*1e3)}for(Wt="S";Wt.length<=9;Wt+="S")xe(Wt,rh);go=yr("Milliseconds",!1),V("z",0,0,"zoneAbbr"),V("zz",0,0,"zoneName");function sh(){return this._isUTC?"UTC":""}function ih(){return this._isUTC?"Coordinated Universal Time":""}var O=Mr.prototype;O.add=Zd,O.calendar=sl,O.clone=il,O.diff=hl,O.endOf=wl,O.format=xl,O.from=pl,O.fromNow=ml,O.to=vl,O.toNow=El,O.get=gc,O.invalidAt=Fl,O.isAfter=nl,O.isBefore=al,O.isBetween=ol,O.isSame=cl,O.isSameOrAfter=dl,O.isSameOrBefore=ll,O.isValid=Sl,O.lang=ao,O.locale=no,O.localeData=oo,O.max=Sd,O.min=Td,O.parsingFlags=Rl,O.set=xc,O.startOf=yl,O.subtract=Jd,O.toArray=bl,O.toObject=Al,O.toDate=Dl,O.toISOString=fl,O.inspect=gl,typeof Symbol<"u"&&Symbol.for!=null&&(O[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),O.toJSON=Tl,O.toString=ul,O.unix=_l,O.valueOf=Cl,O.creationData=Bl,O.eraName=Hl,O.eraNarrow=Pl,O.eraAbbr=Ol,O.eraYear=Ml,O.year=Ha,O.isLeapYear=fc,O.weekYear=Wl,O.isoWeekYear=Gl,O.quarter=O.quarters=Xl,O.month=qa,O.daysInMonth=Dc,O.week=O.weeks=kc,O.isoWeek=O.isoWeeks=Ic,O.weeksInYear=Kl,O.weeksInWeekYear=Zl,O.isoWeeksInYear=Vl,O.isoWeeksInISOWeekYear=zl,O.date=fo,O.day=O.days=Gc,O.weekday=Vc,O.isoWeekday=zc,O.dayOfYear=Ql,O.hour=O.hours=td,O.minute=O.minutes=eh,O.second=O.seconds=th,O.millisecond=O.milliseconds=go,O.utcOffset=Od,O.utc=Nd,O.local=qd,O.parseZone=Ud,O.hasAlignedHourOffset=Ld,O.isDST=jd,O.isLocal=Wd,O.isUtcOffset=Gd,O.isUtc=eo,O.isUTC=eo,O.zoneAbbr=sh,O.zoneName=ih,O.dates=Xe("dates accessor is deprecated. Use date instead.",fo),O.months=Xe("months accessor is deprecated. Use month instead",qa),O.years=Xe("years accessor is deprecated. Use year instead",Ha),O.zone=Xe("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Md),O.isDSTShifted=Xe("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Yd);function nh(s){return Ee(s*1e3)}function ah(){return Ee.apply(null,arguments).parseZone()}function xo(s){return s}var de=Mi.prototype;de.calendar=W0,de.longDateFormat=K0,de.invalidDate=J0,de.ordinal=ec,de.preparse=xo,de.postformat=xo,de.relativeTime=rc,de.pastFuture=sc,de.set=j0,de.eras=kl,de.erasParse=Il,de.erasConvertYear=$l,de.erasAbbrRegex=ql,de.erasNameRegex=Nl,de.erasNarrowRegex=Ul,de.months=yc,de.monthsShort=wc,de.monthsParse=_c,de.monthsRegex=Ac,de.monthsShortRegex=bc,de.week=Sc,de.firstDayOfYear=Bc,de.firstDayOfWeek=Fc,de.weekdays=Uc,de.weekdaysMin=jc,de.weekdaysShort=Lc,de.weekdaysParse=Wc,de.weekdaysRegex=Kc,de.weekdaysShortRegex=Zc,de.weekdaysMinRegex=Jc,de.isPM=Qc,de.meridiem=rd;function Ss(s,e,t,r){var i=St(),n=gt().set(r,e);return i[t](n,s)}function po(s,e,t){if(_t(s)&&(e=s,s=void 0),s=s||"",e!=null)return Ss(s,e,t,"month");var r,i=[];for(r=0;r<12;r++)i[r]=Ss(s,r,t,"month");return i}function dn(s,e,t,r){typeof s=="boolean"?(_t(e)&&(t=e,e=void 0),e=e||""):(e=s,t=e,s=!1,_t(e)&&(t=e,e=void 0),e=e||"");var i=St(),n=s?i._week.dow:0,a,o=[];if(t!=null)return Ss(e,(t+n)%7,r,"day");for(a=0;a<7;a++)o[a]=Ss(e,(a+n)%7,r,"day");return o}function oh(s,e){return po(s,e,"months")}function ch(s,e){return po(s,e,"monthsShort")}function dh(s,e,t){return dn(s,e,t,"weekdays")}function lh(s,e,t){return dn(s,e,t,"weekdaysShort")}function hh(s,e,t){return dn(s,e,t,"weekdaysMin")}Yt("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(s){var e=s%10,t=te(s%100/10)===1?"th":e===1?"st":e===2?"nd":e===3?"rd":"th";return s+t}}),L.lang=Xe("moment.lang is deprecated. Use moment.locale instead.",Yt),L.langData=Xe("moment.langData is deprecated. Use moment.localeData instead.",St);var Rt=Math.abs;function uh(){var s=this._data;return this._milliseconds=Rt(this._milliseconds),this._days=Rt(this._days),this._months=Rt(this._months),s.milliseconds=Rt(s.milliseconds),s.seconds=Rt(s.seconds),s.minutes=Rt(s.minutes),s.hours=Rt(s.hours),s.months=Rt(s.months),s.years=Rt(s.years),this}function mo(s,e,t,r){var i=ot(e,t);return s._milliseconds+=r*i._milliseconds,s._days+=r*i._days,s._months+=r*i._months,s._bubble()}function fh(s,e){return mo(this,s,e,1)}function gh(s,e){return mo(this,s,e,-1)}function vo(s){return s<0?Math.floor(s):Math.ceil(s)}function xh(){var s=this._milliseconds,e=this._days,t=this._months,r=this._data,i,n,a,o,l;return s>=0&&e>=0&&t>=0||s<=0&&e<=0&&t<=0||(s+=vo(ln(t)+e)*864e5,e=0,t=0),r.milliseconds=s%1e3,i=et(s/1e3),r.seconds=i%60,n=et(i/60),r.minutes=n%60,a=et(n/60),r.hours=a%24,e+=et(a/24),l=et(Eo(e)),t+=l,e-=vo(ln(l)),o=et(t/12),t%=12,r.days=e,r.months=t,r.years=o,this}function Eo(s){return s*4800/146097}function ln(s){return s*146097/4800}function ph(s){if(!this.isValid())return NaN;var e,t,r=this._milliseconds;if(s=Qe(s),s==="month"||s==="quarter"||s==="year")switch(e=this._days+r/864e5,t=this._months+Eo(e),s){case"month":return t;case"quarter":return t/3;case"year":return t/12}else switch(e=this._days+Math.round(ln(this._months)),s){case"week":return e/7+r/6048e5;case"day":return e+r/864e5;case"hour":return e*24+r/36e5;case"minute":return e*1440+r/6e4;case"second":return e*86400+r/1e3;case"millisecond":return Math.floor(e*864e5)+r;default:throw new Error("Unknown unit "+s)}}function Ft(s){return function(){return this.as(s)}}var yo=Ft("ms"),mh=Ft("s"),vh=Ft("m"),Eh=Ft("h"),yh=Ft("d"),wh=Ft("w"),Ch=Ft("M"),_h=Ft("Q"),Dh=Ft("y"),bh=yo;function Ah(){return ot(this)}function Th(s){return s=Qe(s),this.isValid()?this[s+"s"]():NaN}function cr(s){return function(){return this.isValid()?this._data[s]:NaN}}var Sh=cr("milliseconds"),Rh=cr("seconds"),Fh=cr("minutes"),Bh=cr("hours"),kh=cr("days"),Ih=cr("months"),$h=cr("years");function Hh(){return et(this.days()/7)}var Bt=Math.round,Dr={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function Ph(s,e,t,r,i){return i.relativeTime(e||1,!!t,s,r)}function Oh(s,e,t,r){var i=ot(s).abs(),n=Bt(i.as("s")),a=Bt(i.as("m")),o=Bt(i.as("h")),l=Bt(i.as("d")),c=Bt(i.as("M")),d=Bt(i.as("w")),g=Bt(i.as("y")),u=n<=t.ss&&["s",n]||n<t.s&&["ss",n]||a<=1&&["m"]||a<t.m&&["mm",a]||o<=1&&["h"]||o<t.h&&["hh",o]||l<=1&&["d"]||l<t.d&&["dd",l];return t.w!=null&&(u=u||d<=1&&["w"]||d<t.w&&["ww",d]),u=u||c<=1&&["M"]||c<t.M&&["MM",c]||g<=1&&["y"]||["yy",g],u[2]=e,u[3]=+s>0,u[4]=r,Ph.apply(null,u)}function Mh(s){return s===void 0?Bt:typeof s=="function"?(Bt=s,!0):!1}function Nh(s,e){return Dr[s]===void 0?!1:e===void 0?Dr[s]:(Dr[s]=e,s==="s"&&(Dr.ss=e-1),!0)}function qh(s,e){if(!this.isValid())return this.localeData().invalidDate();var t=!1,r=Dr,i,n;return typeof s=="object"&&(e=s,s=!1),typeof s=="boolean"&&(t=s),typeof e=="object"&&(r=Object.assign({},Dr,e),e.s!=null&&e.ss==null&&(r.ss=e.s-1)),i=this.localeData(),n=Oh(this,!t,r,i),t&&(n=i.pastFuture(+this,n)),i.postformat(n)}var hn=Math.abs;function br(s){return(s>0)-(s<0)||+s}function Rs(){if(!this.isValid())return this.localeData().invalidDate();var s=hn(this._milliseconds)/1e3,e=hn(this._days),t=hn(this._months),r,i,n,a,o=this.asSeconds(),l,c,d,g;return o?(r=et(s/60),i=et(r/60),s%=60,r%=60,n=et(t/12),t%=12,a=s?s.toFixed(3).replace(/\.?0+$/,""):"",l=o<0?"-":"",c=br(this._months)!==br(o)?"-":"",d=br(this._days)!==br(o)?"-":"",g=br(this._milliseconds)!==br(o)?"-":"",l+"P"+(n?c+n+"Y":"")+(t?c+t+"M":"")+(e?d+e+"D":"")+(i||r||s?"T":"")+(i?g+i+"H":"")+(r?g+r+"M":"")+(s?g+a+"S":"")):"P0D"}var ne=Cs.prototype;ne.isValid=Id,ne.abs=uh,ne.add=fh,ne.subtract=gh,ne.as=ph,ne.asMilliseconds=yo,ne.asSeconds=mh,ne.asMinutes=vh,ne.asHours=Eh,ne.asDays=yh,ne.asWeeks=wh,ne.asMonths=Ch,ne.asQuarters=_h,ne.asYears=Dh,ne.valueOf=bh,ne._bubble=xh,ne.clone=Ah,ne.get=Th,ne.milliseconds=Sh,ne.seconds=Rh,ne.minutes=Fh,ne.hours=Bh,ne.days=kh,ne.weeks=Hh,ne.months=Ih,ne.years=$h,ne.humanize=qh,ne.toISOString=Rs,ne.toString=Rs,ne.toJSON=Rs,ne.locale=no,ne.localeData=oo,ne.toIsoString=Xe("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Rs),ne.lang=ao,V("X",0,0,"unix"),V("x",0,0,"valueOf"),W("x",xs),W("X",oc),xe("X",function(s,e,t){t._d=new Date(parseFloat(s)*1e3)}),xe("x",function(s,e,t){t._d=new Date(te(s))});//! moment.js
|
|
102
|
+
L.version="2.30.1",U0(Ee),L.fn=O,L.min=Rd,L.max=Fd,L.now=Bd,L.utc=gt,L.unix=nh,L.months=oh,L.isDate=Or,L.locale=Yt,L.invalid=ds,L.duration=ot,L.isMoment=nt,L.weekdays=dh,L.parseZone=ah,L.localeData=St,L.isDuration=_s,L.monthsShort=ch,L.weekdaysMin=hh,L.defineLocale=Ji,L.updateLocale=ad,L.locales=od,L.weekdaysShort=lh,L.normalizeUnits=Qe,L.relativeTimeRounding=Mh,L.relativeTimeThreshold=Nh,L.calendarFormat=rl,L.prototype=O,L.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};let Fs=null,Ce=null,wo=null,vt=null;function Uh(s,e){if(!s||!s.sessionDescriptionHandler)return;const t=s.sessionDescriptionHandler.peerConnection;t&&t.getSenders().forEach(r=>{r.track&&r.track.kind==="audio"&&(r.track.enabled=e)})}function Co(s){vt||(vt=document.createElement("audio"),vt.id="voxnix-remote-audio",vt.autoplay=!0,document.body.appendChild(vt));const e=new MediaStream;if(s.sessionDescriptionHandler&&s.sessionDescriptionHandler.peerConnection){s.sessionDescriptionHandler.peerConnection.getReceivers().forEach(r=>{r.track&&e.addTrack(r.track)});const t=s.sessionDescriptionHandler.peerConnection;if(!t._isSetRemoteDescPatched){const r=t.setRemoteDescription.bind(t);t.setRemoteDescription=function(i){if(i&&i.sdp&&i.type==="answer"){const a=(((t.localDescription||{}).sdp||"").match(/^m=/gm)||[]).length,o=(i.sdp.match(/^m=/gm)||[]).length;if(console.log("[RTC Patch] local offer m-lines:",a,"| remote answer m-lines:",o),a>0&&o>a){const l=i.sdp.split(/\r?\n/);let c=0,d=!1;const g=[];for(const y of l)y.startsWith("m=")&&(c++,d=c>a),d||g.push(y);let u=g.join(`\r
|
|
103
|
+
`);u.endsWith(`\r
|
|
104
|
+
`)||(u+=`\r
|
|
105
|
+
`),console.log("[RTC Patch] filtered to",(u.match(/^m=/gm)||[]).length,"m-lines. Applying to Chrome."),i={type:"answer",sdp:u}}}return r(i)},t._isSetRemoteDescPatched=!0}}vt.srcObject=e,vt.play().catch(t=>console.error("Error playing media:",t))}function _o(){vt&&(vt.srcObject=null,vt.pause())}const Lh=()=>{J.on("incoming_call",()=>{Lt.pushSound()}),J.on("local_dial",({number:s})=>{if(Fs){const e=tr.makeURI(`sip:${s}@${Fs.configuration.uri.domain}`),t=new Rn(Fs,e);t.stateChange.addListener(r=>{r===B.Establishing?J.emitLocal("call_status","Calling..."):r===B.Established?(Co(t),Ce=t,J.emitLocal("call_status","InCall")):r===B.Terminated&&(_o(),J.emitLocal("call_status","Idle"),Ce=null)}),t.invite()}}),J.on("local_hangup",()=>{Lt.stopSound(),Ce&&(Ce.state===B.Established?Ce.bye():typeof Ce.reject=="function"?Ce.reject():Ce.cancel()),J.emitLocal("call_status","Idle"),J.emitLocal("call_duration","00:00"),J.emitToParent("sync_call_ended")}),J.on("local_reject",()=>{Lt.stopSound(),Ce&&(typeof Ce.reject=="function"?Ce.reject():Ce.cancel()),J.emitLocal("call_status","Idle"),J.emitLocal("call_duration","00:00"),J.emitToParent("sync_call_ended")}),J.on("local_answer",()=>{Lt.stopSound();const s={sessionDescriptionHandlerOptions:{constraints:{audio:!0,video:!1}}};Ce&&Ce.accept(s)}),J.on("local_toggle_mute",({muted:s})=>{Ce&&Uh(Ce,!s)}),J.on("local_toggle_hold",({isOnHold:s,setIsOnHold:e})=>{if(Ce)try{const t=!s,r={sessionDescriptionHandlerOptions:{hold:t}};Ce.invite(r).then(()=>{e(t),console.log(t?"Call successfully put on hold":"Call successfully resumed")}).catch(i=>{console.error("Hold/Unhold failed",i)})}catch(t){console.error("Gagal mengubah status hold:",t)}}),J.on("local_dtmf",({key:s})=>{Ce&&Ce.sessionDescriptionHandler&&Ce.sessionDescriptionHandler.sendDtmf(s)})},jh=async s=>{var a,o;window.__sipjsEventsBound||(Lh(),window.__sipjsEventsBound=!0);const{auth:e}=s;if(!e)return;const t=e.user_pbx||e.username,r=e.pwd_pbx||e.secret,i=((o=(a=e.pabx_host)==null?void 0:a.replace("http://",""))==null?void 0:o.replace("https://",""))||e.pbxurl,n=e.port||8089;if(!(!t||!i))try{const l=tr.makeURI(`sip:${t}@${i}`);if(!l)throw new Error("Failed to create SIP URI");console.log("init...");const c=`wss://${i}:${n}`,d=new tr({uri:l,transportOptions:{server:c},authorizationUsername:t,authorizationPassword:r,sessionDescriptionHandlerFactoryOptions:{peerConnectionConfiguration:{iceServers:[]},constraints:{audio:!0,video:!1}},logLevel:"warn"});console.log(d),Fs=d;const g=new ut(d);g.stateChange.addListener(u=>{u===le.Registered?J.emitLocal("register_status","REGISTERED"):(u===le.Unregistered||u===le.Terminated)&&J.emitLocal("register_status",{status:"FAILED",reason:"SIP Unregistered or Terminated"})}),d.delegate={onInvite(u){let y=!1;Ce=u,J.emitLocal("sipjsSession",u),Lt.pushSound(),Lt.pushNotification(`New incoming call from ${u.remoteIdentity.uri.user}`),J.emitLocal("incoming_call",u),J.emitToParent("sync_incoming_call",u),u.stateChange.addListener(E=>{if(E===B.Established){Co(u),y=!0,J.emitLocal("call_status","InCall"),J.emitToParent("sync_call_answered");const v=L();wo=setInterval(()=>{const _=L.duration(L().diff(v));J.emitLocal("call_duration",Lt.toHHMMSS(_.asSeconds()))},1e3)}else E===B.Terminated&&(_o(),clearInterval(wo),Lt.stopSound(),J.emitLocal("call_duration","00:00"),J.emitLocal("call_status","Idle"),y?J.emitToParent("sync_call_ended"):J.emitToParent("sync_call_unanswered"),Ce=null)})}},await d.start(),await g.register()}catch(l){console.error("SipJS init error:",l),J.emitLocal("register_status",{status:"FAILED",reason:l.message||"Failed to connect to SIP server"})}},Yh=({onSubmit:s})=>{const[e,t]=$e.useState(""),[r,i]=$e.useState(""),[n,a]=$e.useState(""),o=l=>{l.preventDefault(),e&&r&&n&&s({username:e,password:r,host:n})};return Ne.jsxs("div",{className:"w-full max-w-sm mx-auto p-6 bg-white/90 backdrop-blur-md rounded-2xl shadow-xl border border-gray-100",children:[Ne.jsx("h2",{className:"text-2xl font-bold text-center text-primary mb-6",children:"Voice Login"}),Ne.jsxs("form",{onSubmit:o,className:"space-y-4",children:[Ne.jsxs("div",{children:[Ne.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"SIP Username"}),Ne.jsx("input",{type:"text",required:!0,className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-all",placeholder:"e.g. 1001",value:e,onChange:l=>t(l.target.value)})]}),Ne.jsxs("div",{children:[Ne.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"SIP Password"}),Ne.jsx("input",{type:"password",required:!0,className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-all",placeholder:"••••••••",value:r,onChange:l=>i(l.target.value)})]}),Ne.jsxs("div",{children:[Ne.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"SIP Domain / Host"}),Ne.jsx("input",{type:"text",required:!0,className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-all",placeholder:"e.g. sip.example.com",value:n,onChange:l=>a(l.target.value)})]}),Ne.jsx("button",{type:"submit",className:"w-full py-2.5 px-4 bg-primary hover:bg-primary-hover text-white font-semibold rounded-lg shadow-md transition-colors active:scale-95 mt-4",children:"Connect"})]})]})},Wh=$e.forwardRef(({config:s,onIncomingCall:e,onCallAnswered:t,onCallEnded:r,onCallUnanswered:i,onRegisterStatus:n},a)=>{var E;const[o,l]=$e.useState(!1),[c,d]=$e.useState(s);$e.useImperativeHandle(a,()=>({answer:()=>{J.emitLocal("local_answer")},hangup:()=>{J.emitLocal("local_hangup")},reject:()=>{J.emitLocal("local_reject")},mute:v=>{J.emitLocal("local_toggle_mute",{muted:v})},hold:(v,_)=>{J.emitLocal("local_toggle_hold",{isOnHold:v,setIsOnHold:_})}})),$e.useEffect(()=>{d(s)},[s]),$e.useEffect(()=>{var _;const v=(c==null?void 0:c.auth)||((_=c==null?void 0:c.pabxConfig)==null?void 0:_.auth)||{};!o&&(v.username||v.user_pbx)&&(v.pwd_pbx||v.secret)&&(v.pabx_host||v.host)&&(jh({auth:v}),l(!0))},[c,o]);const g=v=>{const _={...c,auth:{...c==null?void 0:c.auth,username:v.username,user_pbx:v.username,pwd_pbx:v.password,secret:v.password,pabx_host:v.host}};d(_)};$e.useEffect(()=>{const v=J.on("sync_incoming_call",D=>e&&e(D)),_=J.on("sync_call_answered",D=>{t&&t(D)}),x=J.on("sync_call_ended",D=>{r&&r(D)}),p=J.on("sync_call_unanswered",D=>{i&&i(D)}),w=J.on("register_status",D=>{D==="REGISTERED"?n&&n("REGISTERED"):(D==null?void 0:D.status)==="FAILED"&&n&&n("FAILED")});return()=>{v(),_(),x(),p(),w()}},[e,t,r,i,n]);const u=(c==null?void 0:c.auth)||((E=c==null?void 0:c.pabxConfig)==null?void 0:E.auth)||{};return!!((u.username||u.user_pbx)&&(u.pwd_pbx||u.secret))||c!=null&&c.accessToken?null:Ne.jsx("div",{className:"fixed inset-0 z-[9999] bg-black/50 backdrop-blur-sm flex items-center justify-center p-4",children:Ne.jsx(Yh,{onSubmit:g})})});Jt.Voxnix=Wh,Object.defineProperty(Jt,Symbol.toStringTag,{value:"Module"})});
|