/*! For license information please see main.adedafda.js.LICENSE.txt */ !function(){var e={854:function(e,t,n){e.exports=n(672)},1989:function(e,t,n){"use strict";var r=n(6267),o=n(3229),i=n(7903),a=n(6735),l=n(7638),s=n(3101),u=n(705),c=n(938);e.exports=function(e){return new Promise((function(t,n){var f=e.data,d=e.headers;r.isFormData(f)&&delete d["Content-Type"];var h=new XMLHttpRequest;if(e.auth){var p=e.auth.username||"",m=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";d.Authorization="Basic "+btoa(p+":"+m)}var g=l(e.baseURL,e.url);if(h.open(e.method.toUpperCase(),a(g,e.params,e.paramsSerializer),!0),h.timeout=e.timeout,h.onreadystatechange=function(){if(h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in h?s(h.getAllResponseHeaders()):null,i={data:e.responseType&&"text"!==e.responseType?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:r,config:e,request:h};o(t,n,i),h=null}},h.onabort=function(){h&&(n(c("Request aborted",e,"ECONNABORTED",h)),h=null)},h.onerror=function(){n(c("Network Error",e,null,h)),h=null},h.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(c(t,e,"ECONNABORTED",h)),h=null},r.isStandardBrowserEnv()){var v=(e.withCredentials||u(g))&&e.xsrfCookieName?i.read(e.xsrfCookieName):void 0;v&&(d[e.xsrfHeaderName]=v)}if("setRequestHeader"in h&&r.forEach(d,(function(e,t){"undefined"===typeof f&&"content-type"===t.toLowerCase()?delete d[t]:h.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(h.withCredentials=!!e.withCredentials),e.responseType)try{h.responseType=e.responseType}catch(_){if("json"!==e.responseType)throw _}"function"===typeof e.onDownloadProgress&&h.addEventListener("progress",e.onDownloadProgress),"function"===typeof e.onUploadProgress&&h.upload&&h.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){h&&(h.abort(),n(e),h=null)})),f||(f=null),h.send(f)}))}},672:function(e,t,n){"use strict";var r=n(6267),o=n(6973),i=n(8938),a=n(6438);function l(e){var t=new i(e),n=o(i.prototype.request,t);return r.extend(n,i.prototype,t),r.extend(n,t),n}var s=l(n(1550));s.Axios=i,s.create=function(e){return l(a(s.defaults,e))},s.Cancel=n(5299),s.CancelToken=n(7690),s.isCancel=n(7767),s.all=function(e){return Promise.all(e)},s.spread=n(8125),s.isAxiosError=n(8738),e.exports=s,e.exports.default=s},5299:function(e){"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},7690:function(e,t,n){"use strict";var r=n(5299);function o(e){if("function"!==typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.source=function(){var e;return{token:new o((function(t){e=t})),cancel:e}},e.exports=o},7767:function(e){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},8938:function(e,t,n){"use strict";var r=n(6267),o=n(6735),i=n(6664),a=n(4395),l=n(6438);function s(e){this.defaults=e,this.interceptors={request:new i,response:new i}}s.prototype.request=function(e){"string"===typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=l(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[a,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},s.prototype.getUri=function(e){return e=l(this.defaults,e),o(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function(e){s.prototype[e]=function(t,n){return this.request(l(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(e){s.prototype[e]=function(t,n,r){return this.request(l(r||{},{method:e,url:t,data:n}))}})),e.exports=s},6664:function(e,t,n){"use strict";var r=n(6267);function o(){this.handlers=[]}o.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},o.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},o.prototype.forEach=function(e){r.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=o},7638:function(e,t,n){"use strict";var r=n(2762),o=n(1523);e.exports=function(e,t){return e&&!r(t)?o(e,t):t}},938:function(e,t,n){"use strict";var r=n(9478);e.exports=function(e,t,n,o,i){var a=new Error(e);return r(a,t,n,o,i)}},4395:function(e,t,n){"use strict";var r=n(6267),o=n(3024),i=n(7767),a=n(1550);function l(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return l(e),e.headers=e.headers||{},e.data=o(e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||a.adapter)(e).then((function(t){return l(e),t.data=o(t.data,t.headers,e.transformResponse),t}),(function(t){return i(t)||(l(e),t&&t.response&&(t.response.data=o(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},9478:function(e){"use strict";e.exports=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},6438:function(e,t,n){"use strict";var r=n(6267);e.exports=function(e,t){t=t||{};var n={},o=["url","method","data"],i=["headers","auth","proxy","params"],a=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],l=["validateStatus"];function s(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function u(o){r.isUndefined(t[o])?r.isUndefined(e[o])||(n[o]=s(void 0,e[o])):n[o]=s(e[o],t[o])}r.forEach(o,(function(e){r.isUndefined(t[e])||(n[e]=s(void 0,t[e]))})),r.forEach(i,u),r.forEach(a,(function(o){r.isUndefined(t[o])?r.isUndefined(e[o])||(n[o]=s(void 0,e[o])):n[o]=s(void 0,t[o])})),r.forEach(l,(function(r){r in t?n[r]=s(e[r],t[r]):r in e&&(n[r]=s(void 0,e[r]))}));var c=o.concat(i).concat(a).concat(l),f=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===c.indexOf(e)}));return r.forEach(f,u),n}},3229:function(e,t,n){"use strict";var r=n(938);e.exports=function(e,t,n){var o=n.config.validateStatus;n.status&&o&&!o(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},3024:function(e,t,n){"use strict";var r=n(6267);e.exports=function(e,t,n){return r.forEach(n,(function(n){e=n(e,t)})),e}},1550:function(e,t,n){"use strict";var r=n(6267),o=n(2121),i={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var l={adapter:function(){var e;return("undefined"!==typeof XMLHttpRequest||"undefined"!==typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(e=n(1989)),e}(),transformRequest:[function(e,t){return o(t,"Accept"),o(t,"Content-Type"),r.isFormData(e)||r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e)?e:r.isArrayBufferView(e)?e.buffer:r.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):r.isObject(e)?(a(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"===typeof e)try{e=JSON.parse(e)}catch(t){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function(e){l.headers[e]={}})),r.forEach(["post","put","patch"],(function(e){l.headers[e]=r.merge(i)})),e.exports=l},6973:function(e){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r=0)return;a[t]="set-cookie"===t?(a[t]?a[t]:[]).concat([n]):a[t]?a[t]+", "+n:n}})),a):a}},8125:function(e){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},6267:function(e,t,n){"use strict";var r=n(6973),o=Object.prototype.toString;function i(e){return"[object Array]"===o.call(e)}function a(e){return"undefined"===typeof e}function l(e){return null!==e&&"object"===typeof e}function s(e){if("[object Object]"!==o.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function u(e){return"[object Function]"===o.call(e)}function c(e,t){if(null!==e&&"undefined"!==typeof e)if("object"!==typeof e&&(e=[e]),i(e))for(var n=0,r=e.length;n=31||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=function(){var e=!1;return function(){e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||function(){},e.exports=n(5237)(t),e.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}},5237:function(e,t,n){var r=n(1132).default,o=n(883).default;e.exports=function(e){function t(e){var n,r,o,a=null;function l(){for(var e=arguments.length,r=new Array(e),o=0;o0&&a.length>o&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,u=c,console&&console.warn&&console.warn(u)}return e}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=c.bind(r);return o.listener=n,r.wrapFn=o,o}function d(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"===typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(a=t[0]),a instanceof Error)throw a;var l=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw l.context=a,l}var s=i[e];if(void 0===s)return!1;if("function"===typeof s)r(s,this,t);else{var u=s.length,c=p(s,u);for(n=0;n=0;i--)if(n[i]===t||n[i].listener===t){a=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},i.prototype.listeners=function(e){return d(this,e,!0)},i.prototype.rawListeners=function(e){return d(this,e,!1)},i.listenerCount=function(e,t){return"function"===typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},i.prototype.listenerCount=h,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},219:function(e,t,n){"use strict";var r=n(3763),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},i={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},l={};function s(e){return r.isMemo(e)?a:l[e.$$typeof]||o}l[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},l[r.Memo]=a;var u=Object.defineProperty,c=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,h=Object.getPrototypeOf,p=Object.prototype;e.exports=function e(t,n,r){if("string"!==typeof n){if(p){var o=h(n);o&&o!==p&&e(t,o,r)}var a=c(n);f&&(a=a.concat(f(n)));for(var l=s(t),m=s(n),g=0;g=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,l=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return l=e.done,e},e:function(e){s=!0,a=e},f:function(){try{l||null==n.return||n.return()}finally{if(s)throw a}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0)return t}},connection_recovery_min_interval:function(e){if(i.isDecimal(e)){var t=Number(e);if(t>0)return t}},contact_uri:function(e){if("string"===typeof e){var t=l.parse(e,"SIP_URI");if(-1!==t)return t}},display_name:function(e){return e},instance_id:function(e){return/^uuid:/i.test(e)&&(e=e.substr(5)),-1===l.parse(e,"uuid")?void 0:e},no_answer_timeout:function(e){if(i.isDecimal(e)){var t=Number(e);if(t>0)return t}},session_timers:function(e){if("boolean"===typeof e)return e},session_timers_refresh_method:function(e){if("string"===typeof e&&((e=e.toUpperCase())===a.INVITE||e===a.UPDATE))return e},session_timers_force_refresher:function(e){if("boolean"===typeof e)return e},password:function(e){return String(e)},realm:function(e){return String(e)},ha1:function(e){return String(e)},register:function(e){if("boolean"===typeof e)return e},register_expires:function(e){if(i.isDecimal(e)){var t=Number(e);if(t>0)return t}},registrar_server:function(e){/^sip:/i.test(e)||(e="".concat(a.SIP,":").concat(e));var t=s.parse(e);return t?t.user?void 0:t:void 0},use_preloaded_route:function(e){if("boolean"===typeof e)return e},extra_headers:function(e){var t=[];if(Array.isArray(e)&&e.length){var n,o=r(e);try{for(o.s();!(n=o.n()).done;){var i=n.value;"string"===typeof i&&t.push(i)}}catch(a){o.e(a)}finally{o.f()}return t}}}};t.load=function(e,t){for(var n in f.mandatory){if(!t.hasOwnProperty(n))throw new c.ConfigurationError(n);var r=t[n],o=f.mandatory[n](r);if(void 0===o)throw new c.ConfigurationError(n,r);e[n]=o}for(var a in f.optional)if(t.hasOwnProperty(a)){var l=t[a];if(i.isEmpty(l))continue;var s=f.optional[a](l);if(void 0===s)throw new c.ConfigurationError(a,l);e[a]=s}}},82:function(e,t,n){"use strict";var r=n(633);e.exports={USER_AGENT:"".concat(r.title," ").concat(r.version),SIP:"sip",SIPS:"sips",causes:{CONNECTION_ERROR:"Connection Error",REQUEST_TIMEOUT:"Request Timeout",SIP_FAILURE_CODE:"SIP Failure Code",INTERNAL_ERROR:"Internal Error",BUSY:"Busy",REJECTED:"Rejected",REDIRECTED:"Redirected",UNAVAILABLE:"Unavailable",NOT_FOUND:"Not Found",ADDRESS_INCOMPLETE:"Address Incomplete",INCOMPATIBLE_SDP:"Incompatible SDP",MISSING_SDP:"Missing SDP",AUTHENTICATION_ERROR:"Authentication Error",BYE:"Terminated",WEBRTC_ERROR:"WebRTC Error",CANCELED:"Canceled",NO_ANSWER:"No Answer",EXPIRES:"Expires",NO_ACK:"No ACK",DIALOG_ERROR:"Dialog Error",USER_DENIED_MEDIA_ACCESS:"User Denied Media Access",BAD_MEDIA_DESCRIPTION:"Bad Media Description",RTP_TIMEOUT:"RTP Timeout"},SIP_ERROR_CAUSES:{REDIRECTED:[300,301,302,305,380],BUSY:[486,600],REJECTED:[403,603],NOT_FOUND:[404,604],UNAVAILABLE:[480,410,408,430],ADDRESS_INCOMPLETE:[484,424],INCOMPATIBLE_SDP:[488,606],AUTHENTICATION_ERROR:[401,407]},ACK:"ACK",BYE:"BYE",CANCEL:"CANCEL",INFO:"INFO",INVITE:"INVITE",MESSAGE:"MESSAGE",NOTIFY:"NOTIFY",OPTIONS:"OPTIONS",REGISTER:"REGISTER",REFER:"REFER",UPDATE:"UPDATE",SUBSCRIBE:"SUBSCRIBE",DTMF_TRANSPORT:{INFO:"INFO",RFC2833:"RFC2833"},REASON_PHRASE:{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",424:"Bad Location Information",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:"JsSIP Internal 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"},ALLOWED_METHODS:"INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO,NOTIFY",ACCEPTED_BODY_TYPES:"application/sdp, application/dtmf-relay",MAX_FORWARDS:69,SESSION_EXPIRES:90,MIN_SESSION_EXPIRES:60,CONNECTION_RECOVERY_MAX_INTERVAL:30,CONNECTION_RECOVERY_MIN_INTERVAL:2}},43:function(e,t,n){"use strict";function r(e,t){for(var n=0;n3&&void 0!==arguments[3]?arguments[3]:d.STATUS_CONFIRMED;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._owner=t,this._ua=t._ua,this._uac_pending_reply=!1,this._uas_pending_reply=!1,!n.hasHeader("contact"))return{error:"unable to create a Dialog without Contact header field"};n instanceof a.IncomingResponse&&(o=n.status_code<200?d.STATUS_EARLY:d.STATUS_CONFIRMED);var i=n.parseHeader("contact");"UAS"===r?(this._id={call_id:n.call_id,local_tag:n.to_tag,remote_tag:n.from_tag,toString:function(){return this.call_id+this.local_tag+this.remote_tag}},this._state=o,this._remote_seqnum=n.cseq,this._local_uri=n.parseHeader("to").uri,this._remote_uri=n.parseHeader("from").uri,this._remote_target=i.uri,this._route_set=n.getHeaders("record-route"),this._ack_seqnum=this._remote_seqnum):"UAC"===r&&(this._id={call_id:n.call_id,local_tag:n.from_tag,remote_tag:n.to_tag,toString:function(){return this.call_id+this.local_tag+this.remote_tag}},this._state=o,this._local_seqnum=n.cseq,this._local_uri=n.parseHeader("from").uri,this._remote_uri=n.parseHeader("to").uri,this._remote_target=i.uri,this._route_set=n.getHeaders("record-route").reverse(),this._ack_seqnum=null),this._ua.newDialog(this),f.debug("new ".concat(r," dialog created with status ").concat(this._state===d.STATUS_EARLY?"EARLY":"CONFIRMED"))}return o(e,null,[{key:"C",get:function(){return d}}]),o(e,[{key:"isTerminated",value:function(){return this._status===d.STATUS_TERMINATED}},{key:"update",value:function(e,t){this._state=d.STATUS_CONFIRMED,f.debug("dialog ".concat(this._id.toString()," changed to CONFIRMED state")),"UAC"===t&&(this._route_set=e.getHeaders("record-route").reverse())}},{key:"terminate",value:function(){f.debug("dialog ".concat(this._id.toString()," deleted")),this._ua.destroyDialog(this),this._state=d.STATUS_TERMINATED}},{key:"sendRequest",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=c.cloneArray(n.extraHeaders),o=c.cloneObject(n.eventHandlers),i=n.body||null,a=this._createRequest(e,r,i);return o.onAuthenticated=function(){t._local_seqnum+=1},new u(this,a,o).send(),a}},{key:"receiveRequest",value:function(e){this._checkInDialogRequest(e)&&(e.method===l.ACK&&null!==this._ack_seqnum?this._ack_seqnum=null:e.method===l.INVITE&&(this._ack_seqnum=e.cseq),this._owner.receiveRequest(e))}},{key:"_createRequest",value:function(e,t,n){t=c.cloneArray(t),this._local_seqnum||(this._local_seqnum=Math.floor(1e4*Math.random()));var r=e===l.CANCEL||e===l.ACK?this._local_seqnum:this._local_seqnum+=1;return new a.OutgoingRequest(e,this._remote_target,this._ua,{cseq:r,call_id:this._id.call_id,from_uri:this._local_uri,from_tag:this._id.local_tag,to_uri:this._remote_uri,to_tag:this._id.remote_tag,route_set:this._route_set},t,n)}},{key:"_checkInDialogRequest",value:function(e){var t=this;if(this._remote_seqnum)if(e.cseqthis._remote_seqnum&&(this._remote_seqnum=e.cseq);else this._remote_seqnum=e.cseq;if(e.method===l.INVITE||e.method===l.UPDATE&&e.body){if(!0===this._uac_pending_reply)e.reply(491);else{if(!0===this._uas_pending_reply){var n=1+(10*Math.random()|0);return e.reply(500,null,["Retry-After:".concat(n)]),!1}this._uas_pending_reply=!0;e.server_transaction.on("stateChanged",(function n(){e.server_transaction.state!==s.C.STATUS_ACCEPTED&&e.server_transaction.state!==s.C.STATUS_COMPLETED&&e.server_transaction.state!==s.C.STATUS_TERMINATED||(e.server_transaction.removeListener("stateChanged",n),t._uas_pending_reply=!1)}))}e.hasHeader("contact")&&e.server_transaction.on("stateChanged",(function(){e.server_transaction.state===s.C.STATUS_ACCEPTED&&(t._remote_target=e.parseHeader("contact").uri)}))}else e.method===l.NOTIFY&&e.hasHeader("contact")&&e.server_transaction.on("stateChanged",(function(){e.server_transaction.state===s.C.STATUS_COMPLETED&&(t._remote_target=e.parseHeader("contact").uri)}));return!0}},{key:"id",get:function(){return this._id}},{key:"local_seqnum",get:function(){return this._local_seqnum},set:function(e){this._local_seqnum=e}},{key:"owner",get:function(){return this._owner}},{key:"uac_pending_reply",get:function(){return this._uac_pending_reply},set:function(e){this._uac_pending_reply=e}},{key:"uas_pending_reply",get:function(){return this._uas_pending_reply}}]),e}()},6680:function(e,t,n){"use strict";function r(e,t){for(var n=0;n=200&&e.status_code<300?this._eventHandlers.onSuccessResponse(e):e.status_code>=300&&this._eventHandlers.onErrorResponse(e):(this._request.cseq=this._dialog.local_seqnum+=1,this._reattemptTimer=setTimeout((function(){t._dialog.isTerminated()||(t._reattempt=!0,t.send())}),1e3)):e.status_code>=200&&e.status_code<300?this._eventHandlers.onSuccessResponse(e):e.status_code>=300&&this._eventHandlers.onErrorResponse(e)}},{key:"request",get:function(){return this._request}}])&&r(t.prototype,n),s&&r(t,s),e}()},5087:function(e,t,n){"use strict";function r(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:null;if(this._algorithm=t.algorithm,this._realm=t.realm,this._nonce=t.nonce,this._opaque=t.opaque,this._stale=t.stale,this._algorithm){if("MD5"!==this._algorithm)return a.warn('authenticate() | challenge with Digest algorithm different than "MD5", authentication aborted'),!1}else this._algorithm="MD5";if(!this._nonce)return a.warn("authenticate() | challenge without Digest nonce, authentication aborted"),!1;if(!this._realm)return a.warn("authenticate() | challenge without Digest realm, authentication aborted"),!1;if(!this._credentials.password){if(!this._credentials.ha1)return a.warn("authenticate() | no plain SIP password nor ha1 provided, authentication aborted"),!1;if(this._credentials.realm!==this._realm)return a.warn('authenticate() | no plain SIP password, and stored `realm` does not match the given `realm`, cannot authenticate [stored:"%s", given:"%s"]',this._credentials.realm,this._realm),!1}if(t.qop)if(t.qop.indexOf("auth-int")>-1)this._qop="auth-int";else{if(!(t.qop.indexOf("auth")>-1))return a.warn('authenticate() | challenge without Digest qop different than "auth" or "auth-int", authentication aborted'),!1;this._qop="auth"}else this._qop=null;this._method=n,this._uri=r,this._cnonce=l||i.createRandomToken(12),this._nc+=1;var s,u,c=Number(this._nc).toString(16);return this._ncHex="00000000".substr(0,8-c.length)+c,4294967296===this._nc&&(this._nc=1,this._ncHex="00000001"),this._credentials.password?this._ha1=i.calculateMD5("".concat(this._credentials.username,":").concat(this._realm,":").concat(this._credentials.password)):this._ha1=this._credentials.ha1,"auth"===this._qop?(s="".concat(this._method,":").concat(this._uri),u=i.calculateMD5(s),a.debug('authenticate() | using qop=auth [a2:"%s"]',s),this._response=i.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(this._ncHex,":").concat(this._cnonce,":auth:").concat(u))):"auth-int"===this._qop?(s="".concat(this._method,":").concat(this._uri,":").concat(i.calculateMD5(o||"")),u=i.calculateMD5(s),a.debug('authenticate() | using qop=auth-int [a2:"%s"]',s),this._response=i.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(this._ncHex,":").concat(this._cnonce,":auth-int:").concat(u))):null===this._qop&&(s="".concat(this._method,":").concat(this._uri),u=i.calculateMD5(s),a.debug('authenticate() | using qop=null [a2:"%s"]',s),this._response=i.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(u))),a.debug("authenticate() | response generated"),!0}},{key:"toString",value:function(){var e=[];if(!this._response)throw new Error("response field does not exist, cannot generate Authorization header");return e.push("algorithm=".concat(this._algorithm)),e.push('username="'.concat(this._credentials.username,'"')),e.push('realm="'.concat(this._realm,'"')),e.push('nonce="'.concat(this._nonce,'"')),e.push('uri="'.concat(this._uri,'"')),e.push('response="'.concat(this._response,'"')),this._opaque&&e.push('opaque="'.concat(this._opaque,'"')),this._qop&&(e.push("qop=".concat(this._qop)),e.push('cnonce="'.concat(this._cnonce,'"')),e.push("nc=".concat(this._ncHex))),"Digest ".concat(e.join(", "))}}],n&&r(t.prototype,n),o&&r(t,o),e}()},429:function(e){"use strict";function t(e){return t="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}function o(e){var n=l();return function(){var r,o=u(e);if(n){var i=u(this).constructor;r=Reflect.construct(o,arguments,i)}else r=o.apply(this,arguments);return function(e,n){if(n&&("object"===t(n)||"function"===typeof n))return n;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function i(e){var t="function"===typeof Map?new Map:void 0;return i=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!==typeof e)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return a(e,arguments,u(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),s(r,e)},i(e)}function a(e,t,n){return a=l()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&s(o,n.prototype),o},a.apply(null,arguments)}function l(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}var c=function(e){r(i,e);var t=o(i);function i(e,r){var o;return n(this,i),(o=t.call(this)).code=1,o.name="CONFIGURATION_ERROR",o.parameter=e,o.value=r,o.message=o.value?"Invalid value ".concat(JSON.stringify(o.value),' for parameter "').concat(o.parameter,'"'):"Missing parameter: ".concat(o.parameter),o}return i}(i(Error)),f=function(e){r(i,e);var t=o(i);function i(e){var r;return n(this,i),(r=t.call(this)).code=2,r.name="INVALID_STATE_ERROR",r.status=e,r.message="Invalid status: ".concat(e),r}return i}(i(Error)),d=function(e){r(i,e);var t=o(i);function i(e){var r;return n(this,i),(r=t.call(this)).code=3,r.name="NOT_SUPPORTED_ERROR",r.message=e,r}return i}(i(Error)),h=function(e){r(i,e);var t=o(i);function i(e){var r;return n(this,i),(r=t.call(this)).code=4,r.name="NOT_READY_ERROR",r.message=e,r}return i}(i(Error));e.exports={ConfigurationError:c,InvalidStateError:f,NotSupportedError:d,NotReadyError:h}},5294:function(e,t,n){"use strict";e.exports=function(){function e(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g,escape)+'"'}var t={parse:function(t,r){var o={CRLF:c,DIGIT:f,ALPHA:d,HEXDIG:h,WSP:p,OCTET:m,DQUOTE:g,SP:v,HTAB:_,alphanum:y,reserved:b,unreserved:S,mark:w,escaped:T,LWS:C,SWS:E,HCOLON:A,TEXT_UTF8_TRIM:k,TEXT_UTF8char:R,UTF8_NONASCII:O,UTF8_CONT:x,LHEX:function(){var e;null===(e=f())&&(/^[a-f]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,0===a&&u("[a-f]")));return e},token:I,token_nodot:N,separators:function(){var e;40===t.charCodeAt(i)?(e="(",i++):(e=null,0===a&&u('"("'));null===e&&(41===t.charCodeAt(i)?(e=")",i++):(e=null,0===a&&u('")"')),null===e&&(60===t.charCodeAt(i)?(e="<",i++):(e=null,0===a&&u('"<"')),null===e&&(62===t.charCodeAt(i)?(e=">",i++):(e=null,0===a&&u('">"')),null===e&&(64===t.charCodeAt(i)?(e="@",i++):(e=null,0===a&&u('"@"')),null===e&&(44===t.charCodeAt(i)?(e=",",i++):(e=null,0===a&&u('","')),null===e&&(59===t.charCodeAt(i)?(e=";",i++):(e=null,0===a&&u('";"')),null===e&&(58===t.charCodeAt(i)?(e=":",i++):(e=null,0===a&&u('":"')),null===e&&(92===t.charCodeAt(i)?(e="\\",i++):(e=null,0===a&&u('"\\\\"')),null===e&&null===(e=g())&&(47===t.charCodeAt(i)?(e="/",i++):(e=null,0===a&&u('"/"')),null===e&&(91===t.charCodeAt(i)?(e="[",i++):(e=null,0===a&&u('"["')),null===e&&(93===t.charCodeAt(i)?(e="]",i++):(e=null,0===a&&u('"]"')),null===e&&(63===t.charCodeAt(i)?(e="?",i++):(e=null,0===a&&u('"?"')),null===e&&(61===t.charCodeAt(i)?(e="=",i++):(e=null,0===a&&u('"="')),null===e&&(123===t.charCodeAt(i)?(e="{",i++):(e=null,0===a&&u('"{"')),null===e&&(125===t.charCodeAt(i)?(e="}",i++):(e=null,0===a&&u('"}"')),null===e&&null===(e=v())&&(e=_()))))))))))))))));return e},word:P,STAR:D,SLASH:L,EQUAL:U,LPAREN:M,RPAREN:j,RAQUOT:F,LAQUOT:H,COMMA:q,SEMI:z,COLON:B,LDQUOT:W,RDQUOT:V,comment:function e(){var t,n,r,o;if(o=i,null!==(t=M())){for(n=[],null===(r=$())&&null===(r=Q())&&(r=e());null!==r;)n.push(r),null===(r=$())&&null===(r=Q())&&(r=e());null!==n&&null!==(r=j())?t=[t,n,r]:(t=null,i=o)}else t=null,i=o;return t},ctext:$,quoted_string:K,quoted_string_clean:G,qdtext:Y,quoted_pair:Q,SIP_URI_noparams:X,SIP_URI:J,uri_scheme:Z,uri_scheme_sips:ee,uri_scheme_sip:te,userinfo:ne,user:re,user_unreserved:oe,password:ie,hostport:ae,host:le,hostname:se,domainlabel:ue,toplabel:ce,IPv6reference:fe,IPv6address:de,h16:he,ls32:pe,IPv4address:me,dec_octet:ge,port:ve,uri_parameters:_e,uri_parameter:ye,transport_param:be,user_param:Se,method_param:we,ttl_param:Te,maddr_param:Ce,lr_param:Ee,other_param:Ae,pname:ke,pvalue:Re,paramchar:Oe,param_unreserved:xe,headers:Ie,header:Ne,hname:Pe,hvalue:De,hnv_unreserved:Le,Request_Response:function(){var e;null===(e=ft())&&(e=Ue());return e},Request_Line:Ue,Request_URI:Me,absoluteURI:je,hier_part:Fe,net_path:He,abs_path:qe,opaque_part:ze,uric:Be,uric_no_slash:We,path_segments:Ve,segment:$e,param:Ke,pchar:Ge,scheme:Ye,authority:Qe,srvr:Xe,reg_name:Je,query:Ze,SIP_Version:et,INVITEm:tt,ACKm:nt,OPTIONSm:rt,BYEm:ot,CANCELm:it,REGISTERm:at,SUBSCRIBEm:lt,NOTIFYm:st,REFERm:ut,Method:ct,Status_Line:ft,Status_Code:dt,extension_code:ht,Reason_Phrase:pt,Allow_Events:function(){var e,t,n,r,o,a;if(o=i,null!==(e=jt())){for(t=[],a=i,null!==(n=q())&&null!==(r=jt())?n=[n,r]:(n=null,i=a);null!==n;)t.push(n),a=i,null!==(n=q())&&null!==(r=jt())?n=[n,r]:(n=null,i=a);null!==t?e=[e,t]:(e=null,i=o)}else e=null,i=o;return e},Call_ID:function(){var e,n,r,o,l,s;o=i,l=i,null!==(e=P())?(s=i,64===t.charCodeAt(i)?(n="@",i++):(n=null,0===a&&u('"@"')),null!==n&&null!==(r=P())?n=[n,r]:(n=null,i=s),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=l)):(e=null,i=l);null!==e&&(e=function(e){qn=t.substring(i,e)}(o));null===e&&(i=o);return e},Contact:function(){var e,t,n,r,o,a,l;if(o=i,null===(e=D()))if(a=i,null!==(e=mt())){for(t=[],l=i,null!==(n=q())&&null!==(r=mt())?n=[n,r]:(n=null,i=l);null!==n;)t.push(n),l=i,null!==(n=q())&&null!==(r=mt())?n=[n,r]:(n=null,i=l);null!==t?e=[e,t]:(e=null,i=a)}else e=null,i=a;null!==e&&(e=function(){var e,t;for(t=qn.multi_header.length,e=0;el&&(l=i,s=[]),s.push(e))}function c(){var e;return"\r\n"===t.substr(i,2)?(e="\r\n",i+=2):(e=null,0===a&&u('"\\r\\n"')),e}function f(){var e;return/^[0-9]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,0===a&&u("[0-9]")),e}function d(){var e;return/^[a-zA-Z]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,0===a&&u("[a-zA-Z]")),e}function h(){var e;return/^[0-9a-fA-F]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,0===a&&u("[0-9a-fA-F]")),e}function p(){var e;return null===(e=v())&&(e=_()),e}function m(){var e;return/^[\0-\xFF]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,0===a&&u("[\\0-\\xFF]")),e}function g(){var e;return/^["]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,0===a&&u('["]')),e}function v(){var e;return 32===t.charCodeAt(i)?(e=" ",i++):(e=null,0===a&&u('" "')),e}function _(){var e;return 9===t.charCodeAt(i)?(e="\t",i++):(e=null,0===a&&u('"\\t"')),e}function y(){var e;return/^[a-zA-Z0-9]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,0===a&&u("[a-zA-Z0-9]")),e}function b(){var e;return 59===t.charCodeAt(i)?(e=";",i++):(e=null,0===a&&u('";"')),null===e&&(47===t.charCodeAt(i)?(e="/",i++):(e=null,0===a&&u('"/"')),null===e&&(63===t.charCodeAt(i)?(e="?",i++):(e=null,0===a&&u('"?"')),null===e&&(58===t.charCodeAt(i)?(e=":",i++):(e=null,0===a&&u('":"')),null===e&&(64===t.charCodeAt(i)?(e="@",i++):(e=null,0===a&&u('"@"')),null===e&&(38===t.charCodeAt(i)?(e="&",i++):(e=null,0===a&&u('"&"')),null===e&&(61===t.charCodeAt(i)?(e="=",i++):(e=null,0===a&&u('"="')),null===e&&(43===t.charCodeAt(i)?(e="+",i++):(e=null,0===a&&u('"+"')),null===e&&(36===t.charCodeAt(i)?(e="$",i++):(e=null,0===a&&u('"$"')),null===e&&(44===t.charCodeAt(i)?(e=",",i++):(e=null,0===a&&u('","'))))))))))),e}function S(){var e;return null===(e=y())&&(e=w()),e}function w(){var e;return 45===t.charCodeAt(i)?(e="-",i++):(e=null,0===a&&u('"-"')),null===e&&(95===t.charCodeAt(i)?(e="_",i++):(e=null,0===a&&u('"_"')),null===e&&(46===t.charCodeAt(i)?(e=".",i++):(e=null,0===a&&u('"."')),null===e&&(33===t.charCodeAt(i)?(e="!",i++):(e=null,0===a&&u('"!"')),null===e&&(126===t.charCodeAt(i)?(e="~",i++):(e=null,0===a&&u('"~"')),null===e&&(42===t.charCodeAt(i)?(e="*",i++):(e=null,0===a&&u('"*"')),null===e&&(39===t.charCodeAt(i)?(e="'",i++):(e=null,0===a&&u('"\'"')),null===e&&(40===t.charCodeAt(i)?(e="(",i++):(e=null,0===a&&u('"("')),null===e&&(41===t.charCodeAt(i)?(e=")",i++):(e=null,0===a&&u('")"')))))))))),e}function T(){var e,n,r,o,l;return o=i,l=i,37===t.charCodeAt(i)?(e="%",i++):(e=null,0===a&&u('"%"')),null!==e&&null!==(n=h())&&null!==(r=h())?e=[e,n,r]:(e=null,i=l),null!==e&&(e=e.join("")),null===e&&(i=o),e}function C(){var e,t,n,r,o,a;for(r=i,o=i,a=i,e=[],t=p();null!==t;)e.push(t),t=p();if(null!==e&&null!==(t=c())?e=[e,t]:(e=null,i=a),null!==(e=null!==e?e:"")){if(null!==(n=p()))for(t=[];null!==n;)t.push(n),n=p();else t=null;null!==t?e=[e,t]:(e=null,i=o)}else e=null,i=o;return null!==e&&(e=" "),null===e&&(i=r),e}function E(){var e;return e=null!==(e=C())?e:""}function A(){var e,n,r,o,l;for(o=i,l=i,e=[],null===(n=v())&&(n=_());null!==n;)e.push(n),null===(n=v())&&(n=_());return null!==e?(58===t.charCodeAt(i)?(n=":",i++):(n=null,0===a&&u('":"')),null!==n&&null!==(r=E())?e=[e,n,r]:(e=null,i=l)):(e=null,i=l),null!==e&&(e=":"),null===e&&(i=o),e}function k(){var e,n,r,o,a,l,s;if(a=i,l=i,null!==(n=R()))for(e=[];null!==n;)e.push(n),n=R();else e=null;if(null!==e){for(n=[],s=i,r=[],o=C();null!==o;)r.push(o),o=C();for(null!==r&&null!==(o=R())?r=[r,o]:(r=null,i=s);null!==r;){for(n.push(r),s=i,r=[],o=C();null!==o;)r.push(o),o=C();null!==r&&null!==(o=R())?r=[r,o]:(r=null,i=s)}null!==n?e=[e,n]:(e=null,i=l)}else e=null,i=l;return null!==e&&(e=function(e){return t.substring(i,e)}(a)),null===e&&(i=a),e}function R(){var e;return/^[!-~]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,0===a&&u("[!-~]")),null===e&&(e=O()),e}function O(){var e;return/^[\x80-\uFFFF]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,0===a&&u("[\\x80-\\uFFFF]")),e}function x(){var e;return/^[\x80-\xBF]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,0===a&&u("[\\x80-\\xBF]")),e}function I(){var e,n,r;if(r=i,null===(n=y())&&(45===t.charCodeAt(i)?(n="-",i++):(n=null,0===a&&u('"-"')),null===n&&(46===t.charCodeAt(i)?(n=".",i++):(n=null,0===a&&u('"."')),null===n&&(33===t.charCodeAt(i)?(n="!",i++):(n=null,0===a&&u('"!"')),null===n&&(37===t.charCodeAt(i)?(n="%",i++):(n=null,0===a&&u('"%"')),null===n&&(42===t.charCodeAt(i)?(n="*",i++):(n=null,0===a&&u('"*"')),null===n&&(95===t.charCodeAt(i)?(n="_",i++):(n=null,0===a&&u('"_"')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,0===a&&u('"+"')),null===n&&(96===t.charCodeAt(i)?(n="`",i++):(n=null,0===a&&u('"`"')),null===n&&(39===t.charCodeAt(i)?(n="'",i++):(n=null,0===a&&u('"\'"')),null===n&&(126===t.charCodeAt(i)?(n="~",i++):(n=null,0===a&&u('"~"')))))))))))),null!==n)for(e=[];null!==n;)e.push(n),null===(n=y())&&(45===t.charCodeAt(i)?(n="-",i++):(n=null,0===a&&u('"-"')),null===n&&(46===t.charCodeAt(i)?(n=".",i++):(n=null,0===a&&u('"."')),null===n&&(33===t.charCodeAt(i)?(n="!",i++):(n=null,0===a&&u('"!"')),null===n&&(37===t.charCodeAt(i)?(n="%",i++):(n=null,0===a&&u('"%"')),null===n&&(42===t.charCodeAt(i)?(n="*",i++):(n=null,0===a&&u('"*"')),null===n&&(95===t.charCodeAt(i)?(n="_",i++):(n=null,0===a&&u('"_"')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,0===a&&u('"+"')),null===n&&(96===t.charCodeAt(i)?(n="`",i++):(n=null,0===a&&u('"`"')),null===n&&(39===t.charCodeAt(i)?(n="'",i++):(n=null,0===a&&u('"\'"')),null===n&&(126===t.charCodeAt(i)?(n="~",i++):(n=null,0===a&&u('"~"'))))))))))));else e=null;return null!==e&&(e=function(e){return t.substring(i,e)}(r)),null===e&&(i=r),e}function N(){var e,n,r;if(r=i,null===(n=y())&&(45===t.charCodeAt(i)?(n="-",i++):(n=null,0===a&&u('"-"')),null===n&&(33===t.charCodeAt(i)?(n="!",i++):(n=null,0===a&&u('"!"')),null===n&&(37===t.charCodeAt(i)?(n="%",i++):(n=null,0===a&&u('"%"')),null===n&&(42===t.charCodeAt(i)?(n="*",i++):(n=null,0===a&&u('"*"')),null===n&&(95===t.charCodeAt(i)?(n="_",i++):(n=null,0===a&&u('"_"')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,0===a&&u('"+"')),null===n&&(96===t.charCodeAt(i)?(n="`",i++):(n=null,0===a&&u('"`"')),null===n&&(39===t.charCodeAt(i)?(n="'",i++):(n=null,0===a&&u('"\'"')),null===n&&(126===t.charCodeAt(i)?(n="~",i++):(n=null,0===a&&u('"~"'))))))))))),null!==n)for(e=[];null!==n;)e.push(n),null===(n=y())&&(45===t.charCodeAt(i)?(n="-",i++):(n=null,0===a&&u('"-"')),null===n&&(33===t.charCodeAt(i)?(n="!",i++):(n=null,0===a&&u('"!"')),null===n&&(37===t.charCodeAt(i)?(n="%",i++):(n=null,0===a&&u('"%"')),null===n&&(42===t.charCodeAt(i)?(n="*",i++):(n=null,0===a&&u('"*"')),null===n&&(95===t.charCodeAt(i)?(n="_",i++):(n=null,0===a&&u('"_"')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,0===a&&u('"+"')),null===n&&(96===t.charCodeAt(i)?(n="`",i++):(n=null,0===a&&u('"`"')),null===n&&(39===t.charCodeAt(i)?(n="'",i++):(n=null,0===a&&u('"\'"')),null===n&&(126===t.charCodeAt(i)?(n="~",i++):(n=null,0===a&&u('"~"')))))))))));else e=null;return null!==e&&(e=function(e){return t.substring(i,e)}(r)),null===e&&(i=r),e}function P(){var e,n,r;if(r=i,null===(n=y())&&(45===t.charCodeAt(i)?(n="-",i++):(n=null,0===a&&u('"-"')),null===n&&(46===t.charCodeAt(i)?(n=".",i++):(n=null,0===a&&u('"."')),null===n&&(33===t.charCodeAt(i)?(n="!",i++):(n=null,0===a&&u('"!"')),null===n&&(37===t.charCodeAt(i)?(n="%",i++):(n=null,0===a&&u('"%"')),null===n&&(42===t.charCodeAt(i)?(n="*",i++):(n=null,0===a&&u('"*"')),null===n&&(95===t.charCodeAt(i)?(n="_",i++):(n=null,0===a&&u('"_"')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,0===a&&u('"+"')),null===n&&(96===t.charCodeAt(i)?(n="`",i++):(n=null,0===a&&u('"`"')),null===n&&(39===t.charCodeAt(i)?(n="'",i++):(n=null,0===a&&u('"\'"')),null===n&&(126===t.charCodeAt(i)?(n="~",i++):(n=null,0===a&&u('"~"')),null===n&&(40===t.charCodeAt(i)?(n="(",i++):(n=null,0===a&&u('"("')),null===n&&(41===t.charCodeAt(i)?(n=")",i++):(n=null,0===a&&u('")"')),null===n&&(60===t.charCodeAt(i)?(n="<",i++):(n=null,0===a&&u('"<"')),null===n&&(62===t.charCodeAt(i)?(n=">",i++):(n=null,0===a&&u('">"')),null===n&&(58===t.charCodeAt(i)?(n=":",i++):(n=null,0===a&&u('":"')),null===n&&(92===t.charCodeAt(i)?(n="\\",i++):(n=null,0===a&&u('"\\\\"')),null===n&&null===(n=g())&&(47===t.charCodeAt(i)?(n="/",i++):(n=null,0===a&&u('"/"')),null===n&&(91===t.charCodeAt(i)?(n="[",i++):(n=null,0===a&&u('"["')),null===n&&(93===t.charCodeAt(i)?(n="]",i++):(n=null,0===a&&u('"]"')),null===n&&(63===t.charCodeAt(i)?(n="?",i++):(n=null,0===a&&u('"?"')),null===n&&(123===t.charCodeAt(i)?(n="{",i++):(n=null,0===a&&u('"{"')),null===n&&(125===t.charCodeAt(i)?(n="}",i++):(n=null,0===a&&u('"}"')))))))))))))))))))))))),null!==n)for(e=[];null!==n;)e.push(n),null===(n=y())&&(45===t.charCodeAt(i)?(n="-",i++):(n=null,0===a&&u('"-"')),null===n&&(46===t.charCodeAt(i)?(n=".",i++):(n=null,0===a&&u('"."')),null===n&&(33===t.charCodeAt(i)?(n="!",i++):(n=null,0===a&&u('"!"')),null===n&&(37===t.charCodeAt(i)?(n="%",i++):(n=null,0===a&&u('"%"')),null===n&&(42===t.charCodeAt(i)?(n="*",i++):(n=null,0===a&&u('"*"')),null===n&&(95===t.charCodeAt(i)?(n="_",i++):(n=null,0===a&&u('"_"')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,0===a&&u('"+"')),null===n&&(96===t.charCodeAt(i)?(n="`",i++):(n=null,0===a&&u('"`"')),null===n&&(39===t.charCodeAt(i)?(n="'",i++):(n=null,0===a&&u('"\'"')),null===n&&(126===t.charCodeAt(i)?(n="~",i++):(n=null,0===a&&u('"~"')),null===n&&(40===t.charCodeAt(i)?(n="(",i++):(n=null,0===a&&u('"("')),null===n&&(41===t.charCodeAt(i)?(n=")",i++):(n=null,0===a&&u('")"')),null===n&&(60===t.charCodeAt(i)?(n="<",i++):(n=null,0===a&&u('"<"')),null===n&&(62===t.charCodeAt(i)?(n=">",i++):(n=null,0===a&&u('">"')),null===n&&(58===t.charCodeAt(i)?(n=":",i++):(n=null,0===a&&u('":"')),null===n&&(92===t.charCodeAt(i)?(n="\\",i++):(n=null,0===a&&u('"\\\\"')),null===n&&null===(n=g())&&(47===t.charCodeAt(i)?(n="/",i++):(n=null,0===a&&u('"/"')),null===n&&(91===t.charCodeAt(i)?(n="[",i++):(n=null,0===a&&u('"["')),null===n&&(93===t.charCodeAt(i)?(n="]",i++):(n=null,0===a&&u('"]"')),null===n&&(63===t.charCodeAt(i)?(n="?",i++):(n=null,0===a&&u('"?"')),null===n&&(123===t.charCodeAt(i)?(n="{",i++):(n=null,0===a&&u('"{"')),null===n&&(125===t.charCodeAt(i)?(n="}",i++):(n=null,0===a&&u('"}"'))))))))))))))))))))))));else e=null;return null!==e&&(e=function(e){return t.substring(i,e)}(r)),null===e&&(i=r),e}function D(){var e,n,r,o,l;return o=i,l=i,null!==(e=E())?(42===t.charCodeAt(i)?(n="*",i++):(n=null,0===a&&u('"*"')),null!==n&&null!==(r=E())?e=[e,n,r]:(e=null,i=l)):(e=null,i=l),null!==e&&(e="*"),null===e&&(i=o),e}function L(){var e,n,r,o,l;return o=i,l=i,null!==(e=E())?(47===t.charCodeAt(i)?(n="/",i++):(n=null,0===a&&u('"/"')),null!==n&&null!==(r=E())?e=[e,n,r]:(e=null,i=l)):(e=null,i=l),null!==e&&(e="/"),null===e&&(i=o),e}function U(){var e,n,r,o,l;return o=i,l=i,null!==(e=E())?(61===t.charCodeAt(i)?(n="=",i++):(n=null,0===a&&u('"="')),null!==n&&null!==(r=E())?e=[e,n,r]:(e=null,i=l)):(e=null,i=l),null!==e&&(e="="),null===e&&(i=o),e}function M(){var e,n,r,o,l;return o=i,l=i,null!==(e=E())?(40===t.charCodeAt(i)?(n="(",i++):(n=null,0===a&&u('"("')),null!==n&&null!==(r=E())?e=[e,n,r]:(e=null,i=l)):(e=null,i=l),null!==e&&(e="("),null===e&&(i=o),e}function j(){var e,n,r,o,l;return o=i,l=i,null!==(e=E())?(41===t.charCodeAt(i)?(n=")",i++):(n=null,0===a&&u('")"')),null!==n&&null!==(r=E())?e=[e,n,r]:(e=null,i=l)):(e=null,i=l),null!==e&&(e=")"),null===e&&(i=o),e}function F(){var e,n,r,o;return r=i,o=i,62===t.charCodeAt(i)?(e=">",i++):(e=null,0===a&&u('">"')),null!==e&&null!==(n=E())?e=[e,n]:(e=null,i=o),null!==e&&(e=">"),null===e&&(i=r),e}function H(){var e,n,r,o;return r=i,o=i,null!==(e=E())?(60===t.charCodeAt(i)?(n="<",i++):(n=null,0===a&&u('"<"')),null!==n?e=[e,n]:(e=null,i=o)):(e=null,i=o),null!==e&&(e="<"),null===e&&(i=r),e}function q(){var e,n,r,o,l;return o=i,l=i,null!==(e=E())?(44===t.charCodeAt(i)?(n=",",i++):(n=null,0===a&&u('","')),null!==n&&null!==(r=E())?e=[e,n,r]:(e=null,i=l)):(e=null,i=l),null!==e&&(e=","),null===e&&(i=o),e}function z(){var e,n,r,o,l;return o=i,l=i,null!==(e=E())?(59===t.charCodeAt(i)?(n=";",i++):(n=null,0===a&&u('";"')),null!==n&&null!==(r=E())?e=[e,n,r]:(e=null,i=l)):(e=null,i=l),null!==e&&(e=";"),null===e&&(i=o),e}function B(){var e,n,r,o,l;return o=i,l=i,null!==(e=E())?(58===t.charCodeAt(i)?(n=":",i++):(n=null,0===a&&u('":"')),null!==n&&null!==(r=E())?e=[e,n,r]:(e=null,i=l)):(e=null,i=l),null!==e&&(e=":"),null===e&&(i=o),e}function W(){var e,t,n,r;return n=i,r=i,null!==(e=E())&&null!==(t=g())?e=[e,t]:(e=null,i=r),null!==e&&(e='"'),null===e&&(i=n),e}function V(){var e,t,n,r;return n=i,r=i,null!==(e=g())&&null!==(t=E())?e=[e,t]:(e=null,i=r),null!==e&&(e='"'),null===e&&(i=n),e}function $(){var e;return/^[!-']/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,0===a&&u("[!-']")),null===e&&(/^[*-[]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,0===a&&u("[*-[]")),null===e&&(/^[\]-~]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,0===a&&u("[\\]-~]")),null===e&&null===(e=O())&&(e=C()))),e}function K(){var e,n,r,o,a,l;if(a=i,l=i,null!==(e=E()))if(null!==(n=g())){for(r=[],null===(o=Y())&&(o=Q());null!==o;)r.push(o),null===(o=Y())&&(o=Q());null!==r&&null!==(o=g())?e=[e,n,r,o]:(e=null,i=l)}else e=null,i=l;else e=null,i=l;return null!==e&&(e=function(e){return t.substring(i,e)}(a)),null===e&&(i=a),e}function G(){var e,n,r,o,a,l;if(a=i,l=i,null!==(e=E()))if(null!==(n=g())){for(r=[],null===(o=Y())&&(o=Q());null!==o;)r.push(o),null===(o=Y())&&(o=Q());null!==r&&null!==(o=g())?e=[e,n,r,o]:(e=null,i=l)}else e=null,i=l;else e=null,i=l;return null!==e&&(e=function(e){var n=t.substring(i,e).trim();return n.substring(1,n.length-1).replace(/\\([\x00-\x09\x0b-\x0c\x0e-\x7f])/g,"$1")}(a)),null===e&&(i=a),e}function Y(){var e;return null===(e=C())&&(33===t.charCodeAt(i)?(e="!",i++):(e=null,0===a&&u('"!"')),null===e&&(/^[#-[]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,0===a&&u("[#-[]")),null===e&&(/^[\]-~]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,0===a&&u("[\\]-~]")),null===e&&(e=O())))),e}function Q(){var e,n,r;return r=i,92===t.charCodeAt(i)?(e="\\",i++):(e=null,0===a&&u('"\\\\"')),null!==e?(/^[\0-\t]/.test(t.charAt(i))?(n=t.charAt(i),i++):(n=null,0===a&&u("[\\0-\\t]")),null===n&&(/^[\x0B-\f]/.test(t.charAt(i))?(n=t.charAt(i),i++):(n=null,0===a&&u("[\\x0B-\\f]")),null===n&&(/^[\x0E-\x7f]/.test(t.charAt(i))?(n=t.charAt(i),i++):(n=null,0===a&&u("[\\x0E-\x7f]")))),null!==n?e=[e,n]:(e=null,i=r)):(e=null,i=r),e}function X(){var e,n,r,o,l,s;return l=i,s=i,null!==(e=Z())?(58===t.charCodeAt(i)?(n=":",i++):(n=null,0===a&&u('":"')),null!==n&&null!==(r=null!==(r=ne())?r:"")&&null!==(o=ae())?e=[e,n,r,o]:(e=null,i=s)):(e=null,i=s),null!==e&&(e=function(){try{qn.uri=new Fn(qn.scheme,qn.user,qn.host,qn.port),delete qn.scheme,delete qn.user,delete qn.host,delete qn.host_type,delete qn.port}catch(e){qn=-1}}()),null===e&&(i=l),e}function J(){var e,n,o,l,s,c,f,d;return f=i,d=i,null!==(e=Z())?(58===t.charCodeAt(i)?(n=":",i++):(n=null,0===a&&u('":"')),null!==n&&null!==(o=null!==(o=ne())?o:"")&&null!==(l=ae())&&null!==(s=_e())&&null!==(c=null!==(c=Ie())?c:"")?e=[e,n,o,l,s,c]:(e=null,i=d)):(e=null,i=d),null!==e&&(e=function(){try{qn.uri=new Fn(qn.scheme,qn.user,qn.host,qn.port,qn.uri_params,qn.uri_headers),delete qn.scheme,delete qn.user,delete qn.host,delete qn.host_type,delete qn.port,delete qn.uri_params,"SIP_URI"===r&&(qn=qn.uri)}catch(e){qn=-1}}()),null===e&&(i=f),e}function Z(){var e;return null===(e=ee())&&(e=te()),e}function ee(){var e,n,r;return n=i,"sips"===t.substr(i,4).toLowerCase()?(e=t.substr(i,4),i+=4):(e=null,0===a&&u('"sips"')),null!==e&&(r=e,e=void(qn.scheme=r.toLowerCase())),null===e&&(i=n),e}function te(){var e,n,r;return n=i,"sip"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,0===a&&u('"sip"')),null!==e&&(r=e,e=void(qn.scheme=r.toLowerCase())),null===e&&(i=n),e}function ne(){var e,n,r,o,l,s;return o=i,l=i,null!==(e=re())?(s=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,0===a&&u('":"')),null!==n&&null!==(r=ie())?n=[n,r]:(n=null,i=s),null!==(n=null!==n?n:"")?(64===t.charCodeAt(i)?(r="@",i++):(r=null,0===a&&u('"@"')),null!==r?e=[e,n,r]:(e=null,i=l)):(e=null,i=l)):(e=null,i=l),null!==e&&(e=function(e){qn.user=decodeURIComponent(t.substring(i-1,e))}(o)),null===e&&(i=o),e}function re(){var e,t;if(null===(t=S())&&null===(t=T())&&(t=oe()),null!==t)for(e=[];null!==t;)e.push(t),null===(t=S())&&null===(t=T())&&(t=oe());else e=null;return e}function oe(){var e;return 38===t.charCodeAt(i)?(e="&",i++):(e=null,0===a&&u('"&"')),null===e&&(61===t.charCodeAt(i)?(e="=",i++):(e=null,0===a&&u('"="')),null===e&&(43===t.charCodeAt(i)?(e="+",i++):(e=null,0===a&&u('"+"')),null===e&&(36===t.charCodeAt(i)?(e="$",i++):(e=null,0===a&&u('"$"')),null===e&&(44===t.charCodeAt(i)?(e=",",i++):(e=null,0===a&&u('","')),null===e&&(59===t.charCodeAt(i)?(e=";",i++):(e=null,0===a&&u('";"')),null===e&&(63===t.charCodeAt(i)?(e="?",i++):(e=null,0===a&&u('"?"')),null===e&&(47===t.charCodeAt(i)?(e="/",i++):(e=null,0===a&&u('"/"'))))))))),e}function ie(){var e,n,r;for(r=i,e=[],null===(n=S())&&null===(n=T())&&(38===t.charCodeAt(i)?(n="&",i++):(n=null,0===a&&u('"&"')),null===n&&(61===t.charCodeAt(i)?(n="=",i++):(n=null,0===a&&u('"="')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,0===a&&u('"+"')),null===n&&(36===t.charCodeAt(i)?(n="$",i++):(n=null,0===a&&u('"$"')),null===n&&(44===t.charCodeAt(i)?(n=",",i++):(n=null,0===a&&u('","')))))));null!==n;)e.push(n),null===(n=S())&&null===(n=T())&&(38===t.charCodeAt(i)?(n="&",i++):(n=null,0===a&&u('"&"')),null===n&&(61===t.charCodeAt(i)?(n="=",i++):(n=null,0===a&&u('"="')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,0===a&&u('"+"')),null===n&&(36===t.charCodeAt(i)?(n="$",i++):(n=null,0===a&&u('"$"')),null===n&&(44===t.charCodeAt(i)?(n=",",i++):(n=null,0===a&&u('","')))))));return null!==e&&(e=function(e){qn.password=t.substring(i,e)}(r)),null===e&&(i=r),e}function ae(){var e,n,r,o,l;return o=i,null!==(e=le())?(l=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,0===a&&u('":"')),null!==n&&null!==(r=ve())?n=[n,r]:(n=null,i=l),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=o)):(e=null,i=o),e}function le(){var e,n;return n=i,null===(e=se())&&null===(e=me())&&(e=fe()),null!==e&&(e=function(e){return qn.host=t.substring(i,e).toLowerCase(),qn.host}(n)),null===e&&(i=n),e}function se(){var e,n,r,o,l,s;for(o=i,l=i,e=[],s=i,null!==(n=ue())?(46===t.charCodeAt(i)?(r=".",i++):(r=null,0===a&&u('"."')),null!==r?n=[n,r]:(n=null,i=s)):(n=null,i=s);null!==n;)e.push(n),s=i,null!==(n=ue())?(46===t.charCodeAt(i)?(r=".",i++):(r=null,0===a&&u('"."')),null!==r?n=[n,r]:(n=null,i=s)):(n=null,i=s);return null!==e&&null!==(n=ce())?(46===t.charCodeAt(i)?(r=".",i++):(r=null,0===a&&u('"."')),null!==(r=null!==r?r:"")?e=[e,n,r]:(e=null,i=l)):(e=null,i=l),null!==e&&(e=function(e){return qn.host_type="domain",t.substring(i,e)}(o)),null===e&&(i=o),e}function ue(){var e,n,r,o;if(o=i,null!==(e=y())){for(n=[],null===(r=y())&&(45===t.charCodeAt(i)?(r="-",i++):(r=null,0===a&&u('"-"')),null===r&&(95===t.charCodeAt(i)?(r="_",i++):(r=null,0===a&&u('"_"'))));null!==r;)n.push(r),null===(r=y())&&(45===t.charCodeAt(i)?(r="-",i++):(r=null,0===a&&u('"-"')),null===r&&(95===t.charCodeAt(i)?(r="_",i++):(r=null,0===a&&u('"_"'))));null!==n?e=[e,n]:(e=null,i=o)}else e=null,i=o;return e}function ce(){var e,n,r,o;if(o=i,null!==(e=d())){for(n=[],null===(r=y())&&(45===t.charCodeAt(i)?(r="-",i++):(r=null,0===a&&u('"-"')),null===r&&(95===t.charCodeAt(i)?(r="_",i++):(r=null,0===a&&u('"_"'))));null!==r;)n.push(r),null===(r=y())&&(45===t.charCodeAt(i)?(r="-",i++):(r=null,0===a&&u('"-"')),null===r&&(95===t.charCodeAt(i)?(r="_",i++):(r=null,0===a&&u('"_"'))));null!==n?e=[e,n]:(e=null,i=o)}else e=null,i=o;return e}function fe(){var e,n,r,o,l;return o=i,l=i,91===t.charCodeAt(i)?(e="[",i++):(e=null,0===a&&u('"["')),null!==e&&null!==(n=de())?(93===t.charCodeAt(i)?(r="]",i++):(r=null,0===a&&u('"]"')),null!==r?e=[e,n,r]:(e=null,i=l)):(e=null,i=l),null!==e&&(e=function(e){return qn.host_type="IPv6",t.substring(i,e)}(o)),null===e&&(i=o),e}function de(){var e,n,r,o,l,s,c,f,d,h,p,m,g,v,_,y;return v=i,_=i,null!==(e=he())?(58===t.charCodeAt(i)?(n=":",i++):(n=null,0===a&&u('":"')),null!==n&&null!==(r=he())?(58===t.charCodeAt(i)?(o=":",i++):(o=null,0===a&&u('":"')),null!==o&&null!==(l=he())?(58===t.charCodeAt(i)?(s=":",i++):(s=null,0===a&&u('":"')),null!==s&&null!==(c=he())?(58===t.charCodeAt(i)?(f=":",i++):(f=null,0===a&&u('":"')),null!==f&&null!==(d=he())?(58===t.charCodeAt(i)?(h=":",i++):(h=null,0===a&&u('":"')),null!==h&&null!==(p=he())?(58===t.charCodeAt(i)?(m=":",i++):(m=null,0===a&&u('":"')),null!==m&&null!==(g=pe())?e=[e,n,r,o,l,s,c,f,d,h,p,m,g]:(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_),null===e&&(_=i,"::"===t.substr(i,2)?(e="::",i+=2):(e=null,0===a&&u('"::"')),null!==e&&null!==(n=he())?(58===t.charCodeAt(i)?(r=":",i++):(r=null,0===a&&u('":"')),null!==r&&null!==(o=he())?(58===t.charCodeAt(i)?(l=":",i++):(l=null,0===a&&u('":"')),null!==l&&null!==(s=he())?(58===t.charCodeAt(i)?(c=":",i++):(c=null,0===a&&u('":"')),null!==c&&null!==(f=he())?(58===t.charCodeAt(i)?(d=":",i++):(d=null,0===a&&u('":"')),null!==d&&null!==(h=he())?(58===t.charCodeAt(i)?(p=":",i++):(p=null,0===a&&u('":"')),null!==p&&null!==(m=pe())?e=[e,n,r,o,l,s,c,f,d,h,p,m]:(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_),null===e&&(_=i,"::"===t.substr(i,2)?(e="::",i+=2):(e=null,0===a&&u('"::"')),null!==e&&null!==(n=he())?(58===t.charCodeAt(i)?(r=":",i++):(r=null,0===a&&u('":"')),null!==r&&null!==(o=he())?(58===t.charCodeAt(i)?(l=":",i++):(l=null,0===a&&u('":"')),null!==l&&null!==(s=he())?(58===t.charCodeAt(i)?(c=":",i++):(c=null,0===a&&u('":"')),null!==c&&null!==(f=he())?(58===t.charCodeAt(i)?(d=":",i++):(d=null,0===a&&u('":"')),null!==d&&null!==(h=pe())?e=[e,n,r,o,l,s,c,f,d,h]:(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_),null===e&&(_=i,"::"===t.substr(i,2)?(e="::",i+=2):(e=null,0===a&&u('"::"')),null!==e&&null!==(n=he())?(58===t.charCodeAt(i)?(r=":",i++):(r=null,0===a&&u('":"')),null!==r&&null!==(o=he())?(58===t.charCodeAt(i)?(l=":",i++):(l=null,0===a&&u('":"')),null!==l&&null!==(s=he())?(58===t.charCodeAt(i)?(c=":",i++):(c=null,0===a&&u('":"')),null!==c&&null!==(f=pe())?e=[e,n,r,o,l,s,c,f]:(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_),null===e&&(_=i,"::"===t.substr(i,2)?(e="::",i+=2):(e=null,0===a&&u('"::"')),null!==e&&null!==(n=he())?(58===t.charCodeAt(i)?(r=":",i++):(r=null,0===a&&u('":"')),null!==r&&null!==(o=he())?(58===t.charCodeAt(i)?(l=":",i++):(l=null,0===a&&u('":"')),null!==l&&null!==(s=pe())?e=[e,n,r,o,l,s]:(e=null,i=_)):(e=null,i=_)):(e=null,i=_),null===e&&(_=i,"::"===t.substr(i,2)?(e="::",i+=2):(e=null,0===a&&u('"::"')),null!==e&&null!==(n=he())?(58===t.charCodeAt(i)?(r=":",i++):(r=null,0===a&&u('":"')),null!==r&&null!==(o=pe())?e=[e,n,r,o]:(e=null,i=_)):(e=null,i=_),null===e&&(_=i,"::"===t.substr(i,2)?(e="::",i+=2):(e=null,0===a&&u('"::"')),null!==e&&null!==(n=pe())?e=[e,n]:(e=null,i=_),null===e&&(_=i,"::"===t.substr(i,2)?(e="::",i+=2):(e=null,0===a&&u('"::"')),null!==e&&null!==(n=he())?e=[e,n]:(e=null,i=_),null===e&&(_=i,null!==(e=he())?("::"===t.substr(i,2)?(n="::",i+=2):(n=null,0===a&&u('"::"')),null!==n&&null!==(r=he())?(58===t.charCodeAt(i)?(o=":",i++):(o=null,0===a&&u('":"')),null!==o&&null!==(l=he())?(58===t.charCodeAt(i)?(s=":",i++):(s=null,0===a&&u('":"')),null!==s&&null!==(c=he())?(58===t.charCodeAt(i)?(f=":",i++):(f=null,0===a&&u('":"')),null!==f&&null!==(d=he())?(58===t.charCodeAt(i)?(h=":",i++):(h=null,0===a&&u('":"')),null!==h&&null!==(p=pe())?e=[e,n,r,o,l,s,c,f,d,h,p]:(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_),null===e&&(_=i,null!==(e=he())?(y=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,0===a&&u('":"')),null!==n&&null!==(r=he())?n=[n,r]:(n=null,i=y),null!==(n=null!==n?n:"")?("::"===t.substr(i,2)?(r="::",i+=2):(r=null,0===a&&u('"::"')),null!==r&&null!==(o=he())?(58===t.charCodeAt(i)?(l=":",i++):(l=null,0===a&&u('":"')),null!==l&&null!==(s=he())?(58===t.charCodeAt(i)?(c=":",i++):(c=null,0===a&&u('":"')),null!==c&&null!==(f=he())?(58===t.charCodeAt(i)?(d=":",i++):(d=null,0===a&&u('":"')),null!==d&&null!==(h=pe())?e=[e,n,r,o,l,s,c,f,d,h]:(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_),null===e&&(_=i,null!==(e=he())?(y=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,0===a&&u('":"')),null!==n&&null!==(r=he())?n=[n,r]:(n=null,i=y),null!==(n=null!==n?n:"")?(y=i,58===t.charCodeAt(i)?(r=":",i++):(r=null,0===a&&u('":"')),null!==r&&null!==(o=he())?r=[r,o]:(r=null,i=y),null!==(r=null!==r?r:"")?("::"===t.substr(i,2)?(o="::",i+=2):(o=null,0===a&&u('"::"')),null!==o&&null!==(l=he())?(58===t.charCodeAt(i)?(s=":",i++):(s=null,0===a&&u('":"')),null!==s&&null!==(c=he())?(58===t.charCodeAt(i)?(f=":",i++):(f=null,0===a&&u('":"')),null!==f&&null!==(d=pe())?e=[e,n,r,o,l,s,c,f,d]:(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_),null===e&&(_=i,null!==(e=he())?(y=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,0===a&&u('":"')),null!==n&&null!==(r=he())?n=[n,r]:(n=null,i=y),null!==(n=null!==n?n:"")?(y=i,58===t.charCodeAt(i)?(r=":",i++):(r=null,0===a&&u('":"')),null!==r&&null!==(o=he())?r=[r,o]:(r=null,i=y),null!==(r=null!==r?r:"")?(y=i,58===t.charCodeAt(i)?(o=":",i++):(o=null,0===a&&u('":"')),null!==o&&null!==(l=he())?o=[o,l]:(o=null,i=y),null!==(o=null!==o?o:"")?("::"===t.substr(i,2)?(l="::",i+=2):(l=null,0===a&&u('"::"')),null!==l&&null!==(s=he())?(58===t.charCodeAt(i)?(c=":",i++):(c=null,0===a&&u('":"')),null!==c&&null!==(f=pe())?e=[e,n,r,o,l,s,c,f]:(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_),null===e&&(_=i,null!==(e=he())?(y=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,0===a&&u('":"')),null!==n&&null!==(r=he())?n=[n,r]:(n=null,i=y),null!==(n=null!==n?n:"")?(y=i,58===t.charCodeAt(i)?(r=":",i++):(r=null,0===a&&u('":"')),null!==r&&null!==(o=he())?r=[r,o]:(r=null,i=y),null!==(r=null!==r?r:"")?(y=i,58===t.charCodeAt(i)?(o=":",i++):(o=null,0===a&&u('":"')),null!==o&&null!==(l=he())?o=[o,l]:(o=null,i=y),null!==(o=null!==o?o:"")?(y=i,58===t.charCodeAt(i)?(l=":",i++):(l=null,0===a&&u('":"')),null!==l&&null!==(s=he())?l=[l,s]:(l=null,i=y),null!==(l=null!==l?l:"")?("::"===t.substr(i,2)?(s="::",i+=2):(s=null,0===a&&u('"::"')),null!==s&&null!==(c=pe())?e=[e,n,r,o,l,s,c]:(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_),null===e&&(_=i,null!==(e=he())?(y=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,0===a&&u('":"')),null!==n&&null!==(r=he())?n=[n,r]:(n=null,i=y),null!==(n=null!==n?n:"")?(y=i,58===t.charCodeAt(i)?(r=":",i++):(r=null,0===a&&u('":"')),null!==r&&null!==(o=he())?r=[r,o]:(r=null,i=y),null!==(r=null!==r?r:"")?(y=i,58===t.charCodeAt(i)?(o=":",i++):(o=null,0===a&&u('":"')),null!==o&&null!==(l=he())?o=[o,l]:(o=null,i=y),null!==(o=null!==o?o:"")?(y=i,58===t.charCodeAt(i)?(l=":",i++):(l=null,0===a&&u('":"')),null!==l&&null!==(s=he())?l=[l,s]:(l=null,i=y),null!==(l=null!==l?l:"")?(y=i,58===t.charCodeAt(i)?(s=":",i++):(s=null,0===a&&u('":"')),null!==s&&null!==(c=he())?s=[s,c]:(s=null,i=y),null!==(s=null!==s?s:"")?("::"===t.substr(i,2)?(c="::",i+=2):(c=null,0===a&&u('"::"')),null!==c&&null!==(f=he())?e=[e,n,r,o,l,s,c,f]:(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_),null===e&&(_=i,null!==(e=he())?(y=i,58===t.charCodeAt(i)?(n=":",i++):(n=null,0===a&&u('":"')),null!==n&&null!==(r=he())?n=[n,r]:(n=null,i=y),null!==(n=null!==n?n:"")?(y=i,58===t.charCodeAt(i)?(r=":",i++):(r=null,0===a&&u('":"')),null!==r&&null!==(o=he())?r=[r,o]:(r=null,i=y),null!==(r=null!==r?r:"")?(y=i,58===t.charCodeAt(i)?(o=":",i++):(o=null,0===a&&u('":"')),null!==o&&null!==(l=he())?o=[o,l]:(o=null,i=y),null!==(o=null!==o?o:"")?(y=i,58===t.charCodeAt(i)?(l=":",i++):(l=null,0===a&&u('":"')),null!==l&&null!==(s=he())?l=[l,s]:(l=null,i=y),null!==(l=null!==l?l:"")?(y=i,58===t.charCodeAt(i)?(s=":",i++):(s=null,0===a&&u('":"')),null!==s&&null!==(c=he())?s=[s,c]:(s=null,i=y),null!==(s=null!==s?s:"")?(y=i,58===t.charCodeAt(i)?(c=":",i++):(c=null,0===a&&u('":"')),null!==c&&null!==(f=he())?c=[c,f]:(c=null,i=y),null!==(c=null!==c?c:"")?("::"===t.substr(i,2)?(f="::",i+=2):(f=null,0===a&&u('"::"')),null!==f?e=[e,n,r,o,l,s,c,f]:(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_)):(e=null,i=_))))))))))))))),null!==e&&(e=function(e){return qn.host_type="IPv6",t.substring(i,e)}(v)),null===e&&(i=v),e}function he(){var e,t,n,r,o;return o=i,null!==(e=h())&&null!==(t=null!==(t=h())?t:"")&&null!==(n=null!==(n=h())?n:"")&&null!==(r=null!==(r=h())?r:"")?e=[e,t,n,r]:(e=null,i=o),e}function pe(){var e,n,r,o;return o=i,null!==(e=he())?(58===t.charCodeAt(i)?(n=":",i++):(n=null,0===a&&u('":"')),null!==n&&null!==(r=he())?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null===e&&(e=me()),e}function me(){var e,n,r,o,l,s,c,f,d;return f=i,d=i,null!==(e=ge())?(46===t.charCodeAt(i)?(n=".",i++):(n=null,0===a&&u('"."')),null!==n&&null!==(r=ge())?(46===t.charCodeAt(i)?(o=".",i++):(o=null,0===a&&u('"."')),null!==o&&null!==(l=ge())?(46===t.charCodeAt(i)?(s=".",i++):(s=null,0===a&&u('"."')),null!==s&&null!==(c=ge())?e=[e,n,r,o,l,s,c]:(e=null,i=d)):(e=null,i=d)):(e=null,i=d)):(e=null,i=d),null!==e&&(e=function(e){return qn.host_type="IPv4",t.substring(i,e)}(f)),null===e&&(i=f),e}function ge(){var e,n,r,o;return o=i,"25"===t.substr(i,2)?(e="25",i+=2):(e=null,0===a&&u('"25"')),null!==e?(/^[0-5]/.test(t.charAt(i))?(n=t.charAt(i),i++):(n=null,0===a&&u("[0-5]")),null!==n?e=[e,n]:(e=null,i=o)):(e=null,i=o),null===e&&(o=i,50===t.charCodeAt(i)?(e="2",i++):(e=null,0===a&&u('"2"')),null!==e?(/^[0-4]/.test(t.charAt(i))?(n=t.charAt(i),i++):(n=null,0===a&&u("[0-4]")),null!==n&&null!==(r=f())?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),null===e&&(o=i,49===t.charCodeAt(i)?(e="1",i++):(e=null,0===a&&u('"1"')),null!==e&&null!==(n=f())&&null!==(r=f())?e=[e,n,r]:(e=null,i=o),null===e&&(o=i,/^[1-9]/.test(t.charAt(i))?(e=t.charAt(i),i++):(e=null,0===a&&u("[1-9]")),null!==e&&null!==(n=f())?e=[e,n]:(e=null,i=o),null===e&&(e=f())))),e}function ve(){var e,t,n,r,o,a,l,s;return a=i,l=i,null!==(e=null!==(e=f())?e:"")&&null!==(t=null!==(t=f())?t:"")&&null!==(n=null!==(n=f())?n:"")&&null!==(r=null!==(r=f())?r:"")&&null!==(o=null!==(o=f())?o:"")?e=[e,t,n,r,o]:(e=null,i=l),null!==e&&(s=e,s=parseInt(s.join("")),qn.port=s,e=s),null===e&&(i=a),e}function _e(){var e,n,r,o;for(e=[],o=i,59===t.charCodeAt(i)?(n=";",i++):(n=null,0===a&&u('";"')),null!==n&&null!==(r=ye())?n=[n,r]:(n=null,i=o);null!==n;)e.push(n),o=i,59===t.charCodeAt(i)?(n=";",i++):(n=null,0===a&&u('";"')),null!==n&&null!==(r=ye())?n=[n,r]:(n=null,i=o);return e}function ye(){var e;return null===(e=be())&&null===(e=Se())&&null===(e=we())&&null===(e=Te())&&null===(e=Ce())&&null===(e=Ee())&&(e=Ae()),e}function be(){var e,n,r,o,l;return r=i,o=i,"transport="===t.substr(i,10).toLowerCase()?(e=t.substr(i,10),i+=10):(e=null,0===a&&u('"transport="')),null!==e?("udp"===t.substr(i,3).toLowerCase()?(n=t.substr(i,3),i+=3):(n=null,0===a&&u('"udp"')),null===n&&("tcp"===t.substr(i,3).toLowerCase()?(n=t.substr(i,3),i+=3):(n=null,0===a&&u('"tcp"')),null===n&&("sctp"===t.substr(i,4).toLowerCase()?(n=t.substr(i,4),i+=4):(n=null,0===a&&u('"sctp"')),null===n&&("tls"===t.substr(i,3).toLowerCase()?(n=t.substr(i,3),i+=3):(n=null,0===a&&u('"tls"')),null===n&&(n=I())))),null!==n?e=[e,n]:(e=null,i=o)):(e=null,i=o),null!==e&&(l=e[1],qn.uri_params||(qn.uri_params={}),e=void(qn.uri_params.transport=l.toLowerCase())),null===e&&(i=r),e}function Se(){var e,n,r,o,l;return r=i,o=i,"user="===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,0===a&&u('"user="')),null!==e?("phone"===t.substr(i,5).toLowerCase()?(n=t.substr(i,5),i+=5):(n=null,0===a&&u('"phone"')),null===n&&("ip"===t.substr(i,2).toLowerCase()?(n=t.substr(i,2),i+=2):(n=null,0===a&&u('"ip"')),null===n&&(n=I())),null!==n?e=[e,n]:(e=null,i=o)):(e=null,i=o),null!==e&&(l=e[1],qn.uri_params||(qn.uri_params={}),e=void(qn.uri_params.user=l.toLowerCase())),null===e&&(i=r),e}function we(){var e,n,r,o,l;return r=i,o=i,"method="===t.substr(i,7).toLowerCase()?(e=t.substr(i,7),i+=7):(e=null,0===a&&u('"method="')),null!==e&&null!==(n=ct())?e=[e,n]:(e=null,i=o),null!==e&&(l=e[1],qn.uri_params||(qn.uri_params={}),e=void(qn.uri_params.method=l)),null===e&&(i=r),e}function Te(){var e,n,r,o,l;return r=i,o=i,"ttl="===t.substr(i,4).toLowerCase()?(e=t.substr(i,4),i+=4):(e=null,0===a&&u('"ttl="')),null!==e&&null!==(n=En())?e=[e,n]:(e=null,i=o),null!==e&&(l=e[1],qn.params||(qn.params={}),e=void(qn.params.ttl=l)),null===e&&(i=r),e}function Ce(){var e,n,r,o,l;return r=i,o=i,"maddr="===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,0===a&&u('"maddr="')),null!==e&&null!==(n=le())?e=[e,n]:(e=null,i=o),null!==e&&(l=e[1],qn.uri_params||(qn.uri_params={}),e=void(qn.uri_params.maddr=l)),null===e&&(i=r),e}function Ee(){var e,n,r,o,l,s;return o=i,l=i,"lr"===t.substr(i,2).toLowerCase()?(e=t.substr(i,2),i+=2):(e=null,0===a&&u('"lr"')),null!==e?(s=i,61===t.charCodeAt(i)?(n="=",i++):(n=null,0===a&&u('"="')),null!==n&&null!==(r=I())?n=[n,r]:(n=null,i=s),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=l)):(e=null,i=l),null!==e&&(qn.uri_params||(qn.uri_params={}),e=void(qn.uri_params.lr=void 0)),null===e&&(i=o),e}function Ae(){var e,n,r,o,l,s,c,f;return o=i,l=i,null!==(e=ke())?(s=i,61===t.charCodeAt(i)?(n="=",i++):(n=null,0===a&&u('"="')),null!==n&&null!==(r=Re())?n=[n,r]:(n=null,i=s),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=l)):(e=null,i=l),null!==e&&(c=e[0],f=e[1],qn.uri_params||(qn.uri_params={}),f="undefined"===typeof f?void 0:f[1],e=void(qn.uri_params[c.toLowerCase()]=f)),null===e&&(i=o),e}function ke(){var e,t,n;if(n=i,null!==(t=Oe()))for(e=[];null!==t;)e.push(t),t=Oe();else e=null;return null!==e&&(e=e.join("")),null===e&&(i=n),e}function Re(){var e,t,n;if(n=i,null!==(t=Oe()))for(e=[];null!==t;)e.push(t),t=Oe();else e=null;return null!==e&&(e=e.join("")),null===e&&(i=n),e}function Oe(){var e;return null===(e=xe())&&null===(e=S())&&(e=T()),e}function xe(){var e;return 91===t.charCodeAt(i)?(e="[",i++):(e=null,0===a&&u('"["')),null===e&&(93===t.charCodeAt(i)?(e="]",i++):(e=null,0===a&&u('"]"')),null===e&&(47===t.charCodeAt(i)?(e="/",i++):(e=null,0===a&&u('"/"')),null===e&&(58===t.charCodeAt(i)?(e=":",i++):(e=null,0===a&&u('":"')),null===e&&(38===t.charCodeAt(i)?(e="&",i++):(e=null,0===a&&u('"&"')),null===e&&(43===t.charCodeAt(i)?(e="+",i++):(e=null,0===a&&u('"+"')),null===e&&(36===t.charCodeAt(i)?(e="$",i++):(e=null,0===a&&u('"$"')))))))),e}function Ie(){var e,n,r,o,l,s,c;if(s=i,63===t.charCodeAt(i)?(e="?",i++):(e=null,0===a&&u('"?"')),null!==e)if(null!==(n=Ne())){for(r=[],c=i,38===t.charCodeAt(i)?(o="&",i++):(o=null,0===a&&u('"&"')),null!==o&&null!==(l=Ne())?o=[o,l]:(o=null,i=c);null!==o;)r.push(o),c=i,38===t.charCodeAt(i)?(o="&",i++):(o=null,0===a&&u('"&"')),null!==o&&null!==(l=Ne())?o=[o,l]:(o=null,i=c);null!==r?e=[e,n,r]:(e=null,i=s)}else e=null,i=s;else e=null,i=s;return e}function Ne(){var e,n,r,o,l,s,c;return o=i,l=i,null!==(e=Pe())?(61===t.charCodeAt(i)?(n="=",i++):(n=null,0===a&&u('"="')),null!==n&&null!==(r=De())?e=[e,n,r]:(e=null,i=l)):(e=null,i=l),null!==e&&(s=e[0],c=e[2],s=s.join("").toLowerCase(),c=c.join(""),qn.uri_headers||(qn.uri_headers={}),e=void(qn.uri_headers[s]?qn.uri_headers[s].push(c):qn.uri_headers[s]=[c])),null===e&&(i=o),e}function Pe(){var e,t;if(null===(t=Le())&&null===(t=S())&&(t=T()),null!==t)for(e=[];null!==t;)e.push(t),null===(t=Le())&&null===(t=S())&&(t=T());else e=null;return e}function De(){var e,t;for(e=[],null===(t=Le())&&null===(t=S())&&(t=T());null!==t;)e.push(t),null===(t=Le())&&null===(t=S())&&(t=T());return e}function Le(){var e;return 91===t.charCodeAt(i)?(e="[",i++):(e=null,0===a&&u('"["')),null===e&&(93===t.charCodeAt(i)?(e="]",i++):(e=null,0===a&&u('"]"')),null===e&&(47===t.charCodeAt(i)?(e="/",i++):(e=null,0===a&&u('"/"')),null===e&&(63===t.charCodeAt(i)?(e="?",i++):(e=null,0===a&&u('"?"')),null===e&&(58===t.charCodeAt(i)?(e=":",i++):(e=null,0===a&&u('":"')),null===e&&(43===t.charCodeAt(i)?(e="+",i++):(e=null,0===a&&u('"+"')),null===e&&(36===t.charCodeAt(i)?(e="$",i++):(e=null,0===a&&u('"$"')))))))),e}function Ue(){var e,t,n,r,o,a;return a=i,null!==(e=ct())&&null!==(t=v())&&null!==(n=Me())&&null!==(r=v())&&null!==(o=et())?e=[e,t,n,r,o]:(e=null,i=a),e}function Me(){var e;return null===(e=J())&&(e=je()),e}function je(){var e,n,r,o;return o=i,null!==(e=Ye())?(58===t.charCodeAt(i)?(n=":",i++):(n=null,0===a&&u('":"')),null!==n?(null===(r=Fe())&&(r=ze()),null!==r?e=[e,n,r]:(e=null,i=o)):(e=null,i=o)):(e=null,i=o),e}function Fe(){var e,n,r,o,l;return o=i,null===(e=He())&&(e=qe()),null!==e?(l=i,63===t.charCodeAt(i)?(n="?",i++):(n=null,0===a&&u('"?"')),null!==n&&null!==(r=Ze())?n=[n,r]:(n=null,i=l),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=o)):(e=null,i=o),e}function He(){var e,n,r,o;return o=i,"//"===t.substr(i,2)?(e="//",i+=2):(e=null,0===a&&u('"//"')),null!==e&&null!==(n=Qe())&&null!==(r=null!==(r=qe())?r:"")?e=[e,n,r]:(e=null,i=o),e}function qe(){var e,n,r;return r=i,47===t.charCodeAt(i)?(e="/",i++):(e=null,0===a&&u('"/"')),null!==e&&null!==(n=Ve())?e=[e,n]:(e=null,i=r),e}function ze(){var e,t,n,r;if(r=i,null!==(e=We())){for(t=[],n=Be();null!==n;)t.push(n),n=Be();null!==t?e=[e,t]:(e=null,i=r)}else e=null,i=r;return e}function Be(){var e;return null===(e=b())&&null===(e=S())&&(e=T()),e}function We(){var e;return null===(e=S())&&null===(e=T())&&(59===t.charCodeAt(i)?(e=";",i++):(e=null,0===a&&u('";"')),null===e&&(63===t.charCodeAt(i)?(e="?",i++):(e=null,0===a&&u('"?"')),null===e&&(58===t.charCodeAt(i)?(e=":",i++):(e=null,0===a&&u('":"')),null===e&&(64===t.charCodeAt(i)?(e="@",i++):(e=null,0===a&&u('"@"')),null===e&&(38===t.charCodeAt(i)?(e="&",i++):(e=null,0===a&&u('"&"')),null===e&&(61===t.charCodeAt(i)?(e="=",i++):(e=null,0===a&&u('"="')),null===e&&(43===t.charCodeAt(i)?(e="+",i++):(e=null,0===a&&u('"+"')),null===e&&(36===t.charCodeAt(i)?(e="$",i++):(e=null,0===a&&u('"$"')),null===e&&(44===t.charCodeAt(i)?(e=",",i++):(e=null,0===a&&u('","'))))))))))),e}function Ve(){var e,n,r,o,l,s;if(l=i,null!==(e=$e())){for(n=[],s=i,47===t.charCodeAt(i)?(r="/",i++):(r=null,0===a&&u('"/"')),null!==r&&null!==(o=$e())?r=[r,o]:(r=null,i=s);null!==r;)n.push(r),s=i,47===t.charCodeAt(i)?(r="/",i++):(r=null,0===a&&u('"/"')),null!==r&&null!==(o=$e())?r=[r,o]:(r=null,i=s);null!==n?e=[e,n]:(e=null,i=l)}else e=null,i=l;return e}function $e(){var e,n,r,o,l,s;for(l=i,e=[],n=Ge();null!==n;)e.push(n),n=Ge();if(null!==e){for(n=[],s=i,59===t.charCodeAt(i)?(r=";",i++):(r=null,0===a&&u('";"')),null!==r&&null!==(o=Ke())?r=[r,o]:(r=null,i=s);null!==r;)n.push(r),s=i,59===t.charCodeAt(i)?(r=";",i++):(r=null,0===a&&u('";"')),null!==r&&null!==(o=Ke())?r=[r,o]:(r=null,i=s);null!==n?e=[e,n]:(e=null,i=l)}else e=null,i=l;return e}function Ke(){var e,t;for(e=[],t=Ge();null!==t;)e.push(t),t=Ge();return e}function Ge(){var e;return null===(e=S())&&null===(e=T())&&(58===t.charCodeAt(i)?(e=":",i++):(e=null,0===a&&u('":"')),null===e&&(64===t.charCodeAt(i)?(e="@",i++):(e=null,0===a&&u('"@"')),null===e&&(38===t.charCodeAt(i)?(e="&",i++):(e=null,0===a&&u('"&"')),null===e&&(61===t.charCodeAt(i)?(e="=",i++):(e=null,0===a&&u('"="')),null===e&&(43===t.charCodeAt(i)?(e="+",i++):(e=null,0===a&&u('"+"')),null===e&&(36===t.charCodeAt(i)?(e="$",i++):(e=null,0===a&&u('"$"')),null===e&&(44===t.charCodeAt(i)?(e=",",i++):(e=null,0===a&&u('","'))))))))),e}function Ye(){var e,n,r,o,l;if(o=i,l=i,null!==(e=d())){for(n=[],null===(r=d())&&null===(r=f())&&(43===t.charCodeAt(i)?(r="+",i++):(r=null,0===a&&u('"+"')),null===r&&(45===t.charCodeAt(i)?(r="-",i++):(r=null,0===a&&u('"-"')),null===r&&(46===t.charCodeAt(i)?(r=".",i++):(r=null,0===a&&u('"."')))));null!==r;)n.push(r),null===(r=d())&&null===(r=f())&&(43===t.charCodeAt(i)?(r="+",i++):(r=null,0===a&&u('"+"')),null===r&&(45===t.charCodeAt(i)?(r="-",i++):(r=null,0===a&&u('"-"')),null===r&&(46===t.charCodeAt(i)?(r=".",i++):(r=null,0===a&&u('"."')))));null!==n?e=[e,n]:(e=null,i=l)}else e=null,i=l;return null!==e&&(e=function(e){qn.scheme=t.substring(i,e)}(o)),null===e&&(i=o),e}function Qe(){var e;return null===(e=Xe())&&(e=Je()),e}function Xe(){var e,n,r,o;return r=i,o=i,null!==(e=ne())?(64===t.charCodeAt(i)?(n="@",i++):(n=null,0===a&&u('"@"')),null!==n?e=[e,n]:(e=null,i=o)):(e=null,i=o),null!==(e=null!==e?e:"")&&null!==(n=ae())?e=[e,n]:(e=null,i=r),e=null!==e?e:""}function Je(){var e,n;if(null===(n=S())&&null===(n=T())&&(36===t.charCodeAt(i)?(n="$",i++):(n=null,0===a&&u('"$"')),null===n&&(44===t.charCodeAt(i)?(n=",",i++):(n=null,0===a&&u('","')),null===n&&(59===t.charCodeAt(i)?(n=";",i++):(n=null,0===a&&u('";"')),null===n&&(58===t.charCodeAt(i)?(n=":",i++):(n=null,0===a&&u('":"')),null===n&&(64===t.charCodeAt(i)?(n="@",i++):(n=null,0===a&&u('"@"')),null===n&&(38===t.charCodeAt(i)?(n="&",i++):(n=null,0===a&&u('"&"')),null===n&&(61===t.charCodeAt(i)?(n="=",i++):(n=null,0===a&&u('"="')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,0===a&&u('"+"')))))))))),null!==n)for(e=[];null!==n;)e.push(n),null===(n=S())&&null===(n=T())&&(36===t.charCodeAt(i)?(n="$",i++):(n=null,0===a&&u('"$"')),null===n&&(44===t.charCodeAt(i)?(n=",",i++):(n=null,0===a&&u('","')),null===n&&(59===t.charCodeAt(i)?(n=";",i++):(n=null,0===a&&u('";"')),null===n&&(58===t.charCodeAt(i)?(n=":",i++):(n=null,0===a&&u('":"')),null===n&&(64===t.charCodeAt(i)?(n="@",i++):(n=null,0===a&&u('"@"')),null===n&&(38===t.charCodeAt(i)?(n="&",i++):(n=null,0===a&&u('"&"')),null===n&&(61===t.charCodeAt(i)?(n="=",i++):(n=null,0===a&&u('"="')),null===n&&(43===t.charCodeAt(i)?(n="+",i++):(n=null,0===a&&u('"+"'))))))))));else e=null;return e}function Ze(){var e,t;for(e=[],t=Be();null!==t;)e.push(t),t=Be();return e}function et(){var e,n,r,o,l,s,c,d;if(c=i,d=i,"sip"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,0===a&&u('"SIP"')),null!==e)if(47===t.charCodeAt(i)?(n="/",i++):(n=null,0===a&&u('"/"')),null!==n){if(null!==(o=f()))for(r=[];null!==o;)r.push(o),o=f();else r=null;if(null!==r)if(46===t.charCodeAt(i)?(o=".",i++):(o=null,0===a&&u('"."')),null!==o){if(null!==(s=f()))for(l=[];null!==s;)l.push(s),s=f();else l=null;null!==l?e=[e,n,r,o,l]:(e=null,i=d)}else e=null,i=d;else e=null,i=d}else e=null,i=d;else e=null,i=d;return null!==e&&(e=function(e){qn.sip_version=t.substring(i,e)}(c)),null===e&&(i=c),e}function tt(){var e;return"INVITE"===t.substr(i,6)?(e="INVITE",i+=6):(e=null,0===a&&u('"INVITE"')),e}function nt(){var e;return"ACK"===t.substr(i,3)?(e="ACK",i+=3):(e=null,0===a&&u('"ACK"')),e}function rt(){var e;return"OPTIONS"===t.substr(i,7)?(e="OPTIONS",i+=7):(e=null,0===a&&u('"OPTIONS"')),e}function ot(){var e;return"BYE"===t.substr(i,3)?(e="BYE",i+=3):(e=null,0===a&&u('"BYE"')),e}function it(){var e;return"CANCEL"===t.substr(i,6)?(e="CANCEL",i+=6):(e=null,0===a&&u('"CANCEL"')),e}function at(){var e;return"REGISTER"===t.substr(i,8)?(e="REGISTER",i+=8):(e=null,0===a&&u('"REGISTER"')),e}function lt(){var e;return"SUBSCRIBE"===t.substr(i,9)?(e="SUBSCRIBE",i+=9):(e=null,0===a&&u('"SUBSCRIBE"')),e}function st(){var e;return"NOTIFY"===t.substr(i,6)?(e="NOTIFY",i+=6):(e=null,0===a&&u('"NOTIFY"')),e}function ut(){var e;return"REFER"===t.substr(i,5)?(e="REFER",i+=5):(e=null,0===a&&u('"REFER"')),e}function ct(){var e,n;return n=i,null===(e=tt())&&null===(e=nt())&&null===(e=rt())&&null===(e=ot())&&null===(e=it())&&null===(e=at())&&null===(e=lt())&&null===(e=st())&&null===(e=ut())&&(e=I()),null!==e&&(e=function(e){return qn.method=t.substring(i,e),qn.method}(n)),null===e&&(i=n),e}function ft(){var e,t,n,r,o,a;return a=i,null!==(e=et())&&null!==(t=v())&&null!==(n=dt())&&null!==(r=v())&&null!==(o=pt())?e=[e,t,n,r,o]:(e=null,i=a),e}function dt(){var e,t,n;return t=i,null!==(e=ht())&&(n=e,e=void(qn.status_code=parseInt(n.join("")))),null===e&&(i=t),e}function ht(){var e,t,n,r;return r=i,null!==(e=f())&&null!==(t=f())&&null!==(n=f())?e=[e,t,n]:(e=null,i=r),e}function pt(){var e,n,r;for(r=i,e=[],null===(n=b())&&null===(n=S())&&null===(n=T())&&null===(n=O())&&null===(n=x())&&null===(n=v())&&(n=_());null!==n;)e.push(n),null===(n=b())&&null===(n=S())&&null===(n=T())&&null===(n=O())&&null===(n=x())&&null===(n=v())&&(n=_());return null!==e&&(e=function(e){qn.reason_phrase=t.substring(i,e)}(r)),null===e&&(i=r),e}function mt(){var e,t,n,r,o,a,l;if(o=i,a=i,null===(e=X())&&(e=gt()),null!==e){for(t=[],l=i,null!==(n=z())&&null!==(r=_t())?n=[n,r]:(n=null,i=l);null!==n;)t.push(n),l=i,null!==(n=z())&&null!==(r=_t())?n=[n,r]:(n=null,i=l);null!==t?e=[e,t]:(e=null,i=a)}else e=null,i=a;return null!==e&&(e=function(e){var t;qn.multi_header||(qn.multi_header=[]);try{t=new Hn(qn.uri,qn.display_name,qn.params),delete qn.uri,delete qn.display_name,delete qn.params}catch(n){t=null}qn.multi_header.push({possition:i,offset:e,parsed:t})}(o)),null===e&&(i=o),e}function gt(){var e,t,n,r,o;return o=i,null!==(e=null!==(e=vt())?e:"")&&null!==(t=H())&&null!==(n=J())&&null!==(r=F())?e=[e,t,n,r]:(e=null,i=o),e}function vt(){var e,t,n,r,o,a,l,s;if(o=i,a=i,null!==(e=I())){for(t=[],l=i,null!==(n=C())&&null!==(r=I())?n=[n,r]:(n=null,i=l);null!==n;)t.push(n),l=i,null!==(n=C())&&null!==(r=I())?n=[n,r]:(n=null,i=l);null!==t?e=[e,t]:(e=null,i=a)}else e=null,i=a;return null===e&&(e=G()),null!==e&&(s=e,e=void(qn.display_name="string"===typeof s?s:s[1].reduce((function(e,t){return e+t[0]+t[1]}),s[0]))),null===e&&(i=o),e}function _t(){var e;return null===(e=yt())&&null===(e=bt())&&(e=Tt()),e}function yt(){var e,n,r,o,l,s;return o=i,l=i,"q"===t.substr(i,1).toLowerCase()?(e=t.substr(i,1),i++):(e=null,0===a&&u('"q"')),null!==e&&null!==(n=U())&&null!==(r=wt())?e=[e,n,r]:(e=null,i=l),null!==e&&(s=e[2],qn.params||(qn.params={}),e=void(qn.params.q=s)),null===e&&(i=o),e}function bt(){var e,n,r,o,l,s;return o=i,l=i,"expires"===t.substr(i,7).toLowerCase()?(e=t.substr(i,7),i+=7):(e=null,0===a&&u('"expires"')),null!==e&&null!==(n=U())&&null!==(r=St())?e=[e,n,r]:(e=null,i=l),null!==e&&(s=e[2],qn.params||(qn.params={}),e=void(qn.params.expires=s)),null===e&&(i=o),e}function St(){var e,t,n;if(n=i,null!==(t=f()))for(e=[];null!==t;)e.push(t),t=f();else e=null;return null!==e&&(e=parseInt(e.join(""))),null===e&&(i=n),e}function wt(){var e,n,r,o,l,s,c,d;return s=i,c=i,48===t.charCodeAt(i)?(e="0",i++):(e=null,0===a&&u('"0"')),null!==e?(d=i,46===t.charCodeAt(i)?(n=".",i++):(n=null,0===a&&u('"."')),null!==n&&null!==(r=null!==(r=f())?r:"")&&null!==(o=null!==(o=f())?o:"")&&null!==(l=null!==(l=f())?l:"")?n=[n,r,o,l]:(n=null,i=d),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=c)):(e=null,i=c),null!==e&&(e=function(e){return parseFloat(t.substring(i,e))}(s)),null===e&&(i=s),e}function Tt(){var e,t,n,r,o,a,l,s;return r=i,o=i,null!==(e=I())?(a=i,null!==(t=U())&&null!==(n=Ct())?t=[t,n]:(t=null,i=a),null!==(t=null!==t?t:"")?e=[e,t]:(e=null,i=o)):(e=null,i=o),null!==e&&(l=e[0],s=e[1],qn.params||(qn.params={}),s="undefined"===typeof s?void 0:s[1],e=void(qn.params[l.toLowerCase()]=s)),null===e&&(i=r),e}function Ct(){var e;return null===(e=I())&&null===(e=le())&&(e=K()),e}function Et(){var e;return"render"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,0===a&&u('"render"')),null===e&&("session"===t.substr(i,7).toLowerCase()?(e=t.substr(i,7),i+=7):(e=null,0===a&&u('"session"')),null===e&&("icon"===t.substr(i,4).toLowerCase()?(e=t.substr(i,4),i+=4):(e=null,0===a&&u('"icon"')),null===e&&("alert"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,0===a&&u('"alert"')),null===e&&(e=I())))),e}function At(){var e;return null===(e=kt())&&(e=Tt()),e}function kt(){var e,n,r,o;return o=i,"handling"===t.substr(i,8).toLowerCase()?(e=t.substr(i,8),i+=8):(e=null,0===a&&u('"handling"')),null!==e&&null!==(n=U())?("optional"===t.substr(i,8).toLowerCase()?(r=t.substr(i,8),i+=8):(r=null,0===a&&u('"optional"')),null===r&&("required"===t.substr(i,8).toLowerCase()?(r=t.substr(i,8),i+=8):(r=null,0===a&&u('"required"')),null===r&&(r=I())),null!==r?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),e}function Rt(){var e,t,n,r,o,a,l,s;if(l=i,null!==(e=Ot()))if(null!==(t=L()))if(null!==(n=Dt())){for(r=[],s=i,null!==(o=z())&&null!==(a=Lt())?o=[o,a]:(o=null,i=s);null!==o;)r.push(o),s=i,null!==(o=z())&&null!==(a=Lt())?o=[o,a]:(o=null,i=s);null!==r?e=[e,t,n,r]:(e=null,i=l)}else e=null,i=l;else e=null,i=l;else e=null,i=l;return e}function Ot(){var e;return null===(e=xt())&&(e=It()),e}function xt(){var e;return"text"===t.substr(i,4).toLowerCase()?(e=t.substr(i,4),i+=4):(e=null,0===a&&u('"text"')),null===e&&("image"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,0===a&&u('"image"')),null===e&&("audio"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,0===a&&u('"audio"')),null===e&&("video"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,0===a&&u('"video"')),null===e&&("application"===t.substr(i,11).toLowerCase()?(e=t.substr(i,11),i+=11):(e=null,0===a&&u('"application"')),null===e&&(e=Nt()))))),e}function It(){var e;return"message"===t.substr(i,7).toLowerCase()?(e=t.substr(i,7),i+=7):(e=null,0===a&&u('"message"')),null===e&&("multipart"===t.substr(i,9).toLowerCase()?(e=t.substr(i,9),i+=9):(e=null,0===a&&u('"multipart"')),null===e&&(e=Nt())),e}function Nt(){var e;return null===(e=I())&&(e=Pt()),e}function Pt(){var e,n,r;return r=i,"x-"===t.substr(i,2).toLowerCase()?(e=t.substr(i,2),i+=2):(e=null,0===a&&u('"x-"')),null!==e&&null!==(n=I())?e=[e,n]:(e=null,i=r),e}function Dt(){var e;return null===(e=Nt())&&(e=I()),e}function Lt(){var e,t,n,r;return r=i,null!==(e=I())&&null!==(t=U())&&null!==(n=Ut())?e=[e,t,n]:(e=null,i=r),e}function Ut(){var e;return null===(e=I())&&(e=K()),e}function Mt(){var e,t,n,r;if(n=i,null!==(t=f()))for(e=[];null!==t;)e.push(t),t=f();else e=null;return null!==e&&(r=e,e=void(qn.value=parseInt(r.join("")))),null===e&&(i=n),e}function jt(){var e,n,r,o,l,s;if(l=i,null!==(e=N())){for(n=[],s=i,46===t.charCodeAt(i)?(r=".",i++):(r=null,0===a&&u('"."')),null!==r&&null!==(o=N())?r=[r,o]:(r=null,i=s);null!==r;)n.push(r),s=i,46===t.charCodeAt(i)?(r=".",i++):(r=null,0===a&&u('"."')),null!==r&&null!==(o=N())?r=[r,o]:(r=null,i=s);null!==n?e=[e,n]:(e=null,i=l)}else e=null,i=l;return e}function Ft(){var e;return null===(e=Ht())&&(e=Tt()),e}function Ht(){var e,n,r,o,l,s;return o=i,l=i,"tag"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,0===a&&u('"tag"')),null!==e&&null!==(n=U())&&null!==(r=I())?e=[e,n,r]:(e=null,i=l),null!==e&&(s=e[2],e=void(qn.tag=s)),null===e&&(i=o),e}function qt(){var e,n,r,o,l,s,c,f;if(c=i,"digest"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,0===a&&u('"Digest"')),null!==e)if(null!==(n=C()))if(null!==(r=Wt())){for(o=[],f=i,null!==(l=q())&&null!==(s=Wt())?l=[l,s]:(l=null,i=f);null!==l;)o.push(l),f=i,null!==(l=q())&&null!==(s=Wt())?l=[l,s]:(l=null,i=f);null!==o?e=[e,n,r,o]:(e=null,i=c)}else e=null,i=c;else e=null,i=c;else e=null,i=c;return null===e&&(e=zt()),e}function zt(){var e,t,n,r,o,a,l,s;if(l=i,null!==(e=I()))if(null!==(t=C()))if(null!==(n=Bt())){for(r=[],s=i,null!==(o=q())&&null!==(a=Bt())?o=[o,a]:(o=null,i=s);null!==o;)r.push(o),s=i,null!==(o=q())&&null!==(a=Bt())?o=[o,a]:(o=null,i=s);null!==r?e=[e,t,n,r]:(e=null,i=l)}else e=null,i=l;else e=null,i=l;else e=null,i=l;return e}function Bt(){var e,t,n,r;return r=i,null!==(e=I())&&null!==(t=U())?(null===(n=I())&&(n=K()),null!==n?e=[e,t,n]:(e=null,i=r)):(e=null,i=r),e}function Wt(){var e;return null===(e=Vt())&&null===(e=Kt())&&null===(e=Yt())&&null===(e=Xt())&&null===(e=Jt())&&null===(e=Zt())&&null===(e=en())&&(e=Bt()),e}function Vt(){var e,n,r,o;return o=i,"realm"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,0===a&&u('"realm"')),null!==e&&null!==(n=U())&&null!==(r=$t())?e=[e,n,r]:(e=null,i=o),e}function $t(){var e,t,n;return t=i,null!==(e=G())&&(n=e,e=void(qn.realm=n)),null===e&&(i=t),e}function Kt(){var e,n,r,o,l,s,c,f,d;if(f=i,"domain"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,0===a&&u('"domain"')),null!==e)if(null!==(n=U()))if(null!==(r=W()))if(null!==(o=Gt())){if(l=[],d=i,null!==(c=v()))for(s=[];null!==c;)s.push(c),c=v();else s=null;for(null!==s&&null!==(c=Gt())?s=[s,c]:(s=null,i=d);null!==s;){if(l.push(s),d=i,null!==(c=v()))for(s=[];null!==c;)s.push(c),c=v();else s=null;null!==s&&null!==(c=Gt())?s=[s,c]:(s=null,i=d)}null!==l&&null!==(s=V())?e=[e,n,r,o,l,s]:(e=null,i=f)}else e=null,i=f;else e=null,i=f;else e=null,i=f;else e=null,i=f;return e}function Gt(){var e;return null===(e=je())&&(e=qe()),e}function Yt(){var e,n,r,o;return o=i,"nonce"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,0===a&&u('"nonce"')),null!==e&&null!==(n=U())&&null!==(r=Qt())?e=[e,n,r]:(e=null,i=o),e}function Qt(){var e,t,n;return t=i,null!==(e=G())&&(n=e,e=void(qn.nonce=n)),null===e&&(i=t),e}function Xt(){var e,n,r,o,l,s;return o=i,l=i,"opaque"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,0===a&&u('"opaque"')),null!==e&&null!==(n=U())&&null!==(r=G())?e=[e,n,r]:(e=null,i=l),null!==e&&(s=e[2],e=void(qn.opaque=s)),null===e&&(i=o),e}function Jt(){var e,n,r,o,l;return o=i,"stale"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,0===a&&u('"stale"')),null!==e&&null!==(n=U())?(l=i,"true"===t.substr(i,4).toLowerCase()?(r=t.substr(i,4),i+=4):(r=null,0===a&&u('"true"')),null!==r&&(r=void(qn.stale=!0)),null===r&&(i=l),null===r&&(l=i,"false"===t.substr(i,5).toLowerCase()?(r=t.substr(i,5),i+=5):(r=null,0===a&&u('"false"')),null!==r&&(r=void(qn.stale=!1)),null===r&&(i=l)),null!==r?e=[e,n,r]:(e=null,i=o)):(e=null,i=o),e}function Zt(){var e,n,r,o,l,s;return o=i,l=i,"algorithm"===t.substr(i,9).toLowerCase()?(e=t.substr(i,9),i+=9):(e=null,0===a&&u('"algorithm"')),null!==e&&null!==(n=U())?("md5"===t.substr(i,3).toLowerCase()?(r=t.substr(i,3),i+=3):(r=null,0===a&&u('"MD5"')),null===r&&("md5-sess"===t.substr(i,8).toLowerCase()?(r=t.substr(i,8),i+=8):(r=null,0===a&&u('"MD5-sess"')),null===r&&(r=I())),null!==r?e=[e,n,r]:(e=null,i=l)):(e=null,i=l),null!==e&&(s=e[2],e=void(qn.algorithm=s.toUpperCase())),null===e&&(i=o),e}function en(){var e,n,r,o,l,s,c,f,d,h;if(f=i,"qop"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,0===a&&u('"qop"')),null!==e)if(null!==(n=U()))if(null!==(r=W())){if(d=i,null!==(o=tn())){for(l=[],h=i,44===t.charCodeAt(i)?(s=",",i++):(s=null,0===a&&u('","')),null!==s&&null!==(c=tn())?s=[s,c]:(s=null,i=h);null!==s;)l.push(s),h=i,44===t.charCodeAt(i)?(s=",",i++):(s=null,0===a&&u('","')),null!==s&&null!==(c=tn())?s=[s,c]:(s=null,i=h);null!==l?o=[o,l]:(o=null,i=d)}else o=null,i=d;null!==o&&null!==(l=V())?e=[e,n,r,o,l]:(e=null,i=f)}else e=null,i=f;else e=null,i=f;else e=null,i=f;return e}function tn(){var e,n,r;return n=i,"auth-int"===t.substr(i,8).toLowerCase()?(e=t.substr(i,8),i+=8):(e=null,0===a&&u('"auth-int"')),null===e&&("auth"===t.substr(i,4).toLowerCase()?(e=t.substr(i,4),i+=4):(e=null,0===a&&u('"auth"')),null===e&&(e=I())),null!==e&&(r=e,qn.qop||(qn.qop=[]),e=void qn.qop.push(r.toLowerCase())),null===e&&(i=n),e}function nn(){var e,t,n,r,o,a,l;if(o=i,a=i,null!==(e=gt())){for(t=[],l=i,null!==(n=z())&&null!==(r=Tt())?n=[n,r]:(n=null,i=l);null!==n;)t.push(n),l=i,null!==(n=z())&&null!==(r=Tt())?n=[n,r]:(n=null,i=l);null!==t?e=[e,t]:(e=null,i=a)}else e=null,i=a;return null!==e&&(e=function(e){var t;qn.multi_header||(qn.multi_header=[]);try{t=new Hn(qn.uri,qn.display_name,qn.params),delete qn.uri,delete qn.display_name,delete qn.params}catch(n){t=null}qn.multi_header.push({possition:i,offset:e,parsed:t})}(o)),null===e&&(i=o),e}function rn(){var e;return null===(e=on())&&(e=Tt()),e}function on(){var e,n,r,o,l,s,c;if(l=i,s=i,"cause"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,0===a&&u('"cause"')),null!==e)if(null!==(n=U())){if(null!==(o=f()))for(r=[];null!==o;)r.push(o),o=f();else r=null;null!==r?e=[e,n,r]:(e=null,i=s)}else e=null,i=s;else e=null,i=s;return null!==e&&(c=e[2],e=void(qn.cause=parseInt(c.join("")))),null===e&&(i=l),e}function an(){var e,t,n,r,o,a;if(o=i,null!==(e=gt())){for(t=[],a=i,null!==(n=z())&&null!==(r=Tt())?n=[n,r]:(n=null,i=a);null!==n;)t.push(n),a=i,null!==(n=z())&&null!==(r=Tt())?n=[n,r]:(n=null,i=a);null!==t?e=[e,t]:(e=null,i=o)}else e=null,i=o;return e}function ln(){var e,n;return n=i,"active"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,0===a&&u('"active"')),null===e&&("pending"===t.substr(i,7).toLowerCase()?(e=t.substr(i,7),i+=7):(e=null,0===a&&u('"pending"')),null===e&&("terminated"===t.substr(i,10).toLowerCase()?(e=t.substr(i,10),i+=10):(e=null,0===a&&u('"terminated"')),null===e&&(e=I()))),null!==e&&(e=function(e){qn.state=t.substring(i,e)}(n)),null===e&&(i=n),e}function sn(){var e,n,r,o,l,s,c,f;return o=i,l=i,"reason"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,0===a&&u('"reason"')),null!==e&&null!==(n=U())&&null!==(r=un())?e=[e,n,r]:(e=null,i=l),null!==e&&(e=void("undefined"!==typeof(s=e[2])&&(qn.reason=s))),null===e&&(i=o),null===e&&(o=i,l=i,"expires"===t.substr(i,7).toLowerCase()?(e=t.substr(i,7),i+=7):(e=null,0===a&&u('"expires"')),null!==e&&null!==(n=U())&&null!==(r=St())?e=[e,n,r]:(e=null,i=l),null!==e&&(e=void("undefined"!==typeof(f=e[2])&&(qn.expires=f))),null===e&&(i=o),null===e&&(o=i,l=i,"retry_after"===t.substr(i,11).toLowerCase()?(e=t.substr(i,11),i+=11):(e=null,0===a&&u('"retry_after"')),null!==e&&null!==(n=U())&&null!==(r=St())?e=[e,n,r]:(e=null,i=l),null!==e&&(e=void("undefined"!==typeof(c=e[2])&&(qn.retry_after=c))),null===e&&(i=o),null===e&&(e=Tt()))),e}function un(){var e;return"deactivated"===t.substr(i,11).toLowerCase()?(e=t.substr(i,11),i+=11):(e=null,0===a&&u('"deactivated"')),null===e&&("probation"===t.substr(i,9).toLowerCase()?(e=t.substr(i,9),i+=9):(e=null,0===a&&u('"probation"')),null===e&&("rejected"===t.substr(i,8).toLowerCase()?(e=t.substr(i,8),i+=8):(e=null,0===a&&u('"rejected"')),null===e&&("timeout"===t.substr(i,7).toLowerCase()?(e=t.substr(i,7),i+=7):(e=null,0===a&&u('"timeout"')),null===e&&("giveup"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,0===a&&u('"giveup"')),null===e&&("noresource"===t.substr(i,10).toLowerCase()?(e=t.substr(i,10),i+=10):(e=null,0===a&&u('"noresource"')),null===e&&("invariant"===t.substr(i,9).toLowerCase()?(e=t.substr(i,9),i+=9):(e=null,0===a&&u('"invariant"')),null===e&&(e=I()))))))),e}function cn(){var e;return null===(e=Ht())&&(e=Tt()),e}function fn(){var e,t,n,r,o,a,l,s;if(l=i,null!==(e=yn()))if(null!==(t=C()))if(null!==(n=wn())){for(r=[],s=i,null!==(o=z())&&null!==(a=dn())?o=[o,a]:(o=null,i=s);null!==o;)r.push(o),s=i,null!==(o=z())&&null!==(a=dn())?o=[o,a]:(o=null,i=s);null!==r?e=[e,t,n,r]:(e=null,i=l)}else e=null,i=l;else e=null,i=l;else e=null,i=l;return e}function dn(){var e;return null===(e=hn())&&null===(e=pn())&&null===(e=mn())&&null===(e=gn())&&null===(e=vn())&&(e=Tt()),e}function hn(){var e,n,r,o,l,s;return o=i,l=i,"ttl"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,0===a&&u('"ttl"')),null!==e&&null!==(n=U())&&null!==(r=En())?e=[e,n,r]:(e=null,i=l),null!==e&&(s=e[2],e=void(qn.ttl=s)),null===e&&(i=o),e}function pn(){var e,n,r,o,l,s;return o=i,l=i,"maddr"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,0===a&&u('"maddr"')),null!==e&&null!==(n=U())&&null!==(r=le())?e=[e,n,r]:(e=null,i=l),null!==e&&(s=e[2],e=void(qn.maddr=s)),null===e&&(i=o),e}function mn(){var e,n,r,o,l,s;return o=i,l=i,"received"===t.substr(i,8).toLowerCase()?(e=t.substr(i,8),i+=8):(e=null,0===a&&u('"received"')),null!==e&&null!==(n=U())?(null===(r=me())&&(r=de()),null!==r?e=[e,n,r]:(e=null,i=l)):(e=null,i=l),null!==e&&(s=e[2],e=void(qn.received=s)),null===e&&(i=o),e}function gn(){var e,n,r,o,l,s;return o=i,l=i,"branch"===t.substr(i,6).toLowerCase()?(e=t.substr(i,6),i+=6):(e=null,0===a&&u('"branch"')),null!==e&&null!==(n=U())&&null!==(r=I())?e=[e,n,r]:(e=null,i=l),null!==e&&(s=e[2],e=void(qn.branch=s)),null===e&&(i=o),e}function vn(){var e,n,r,o,l;return o=i,"rport"===t.substr(i,5).toLowerCase()?(e=t.substr(i,5),i+=5):(e=null,0===a&&u('"rport"')),null!==e?(l=i,null!==(n=U())&&null!==(r=_n())?n=[n,r]:(n=null,i=l),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=o)):(e=null,i=o),e}function _n(){var e,t,n,r,o,a,l,s;return a=i,l=i,null!==(e=null!==(e=f())?e:"")&&null!==(t=null!==(t=f())?t:"")&&null!==(n=null!==(n=f())?n:"")&&null!==(r=null!==(r=f())?r:"")&&null!==(o=null!==(o=f())?o:"")?e=[e,t,n,r,o]:(e=null,i=l),null!==e&&(s=e,e=void(qn.rport=parseInt(s.join("")))),null===e&&(i=a),e}function yn(){var e,t,n,r,o,a;return a=i,null!==(e=bn())&&null!==(t=L())&&null!==(n=I())&&null!==(r=L())&&null!==(o=Sn())?e=[e,t,n,r,o]:(e=null,i=a),e}function bn(){var e,n,r;return n=i,"sip"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,0===a&&u('"SIP"')),null===e&&(e=I()),null!==e&&(r=e,e=void(qn.protocol=r)),null===e&&(i=n),e}function Sn(){var e,n,r;return n=i,"udp"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,0===a&&u('"UDP"')),null===e&&("tcp"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,0===a&&u('"TCP"')),null===e&&("tls"===t.substr(i,3).toLowerCase()?(e=t.substr(i,3),i+=3):(e=null,0===a&&u('"TLS"')),null===e&&("sctp"===t.substr(i,4).toLowerCase()?(e=t.substr(i,4),i+=4):(e=null,0===a&&u('"SCTP"')),null===e&&(e=I())))),null!==e&&(r=e,e=void(qn.transport=r)),null===e&&(i=n),e}function wn(){var e,t,n,r,o;return r=i,null!==(e=Tn())?(o=i,null!==(t=B())&&null!==(n=Cn())?t=[t,n]:(t=null,i=o),null!==(t=null!==t?t:"")?e=[e,t]:(e=null,i=r)):(e=null,i=r),e}function Tn(){var e,n;return n=i,null===(e=me())&&null===(e=fe())&&(e=se()),null!==e&&(e=function(e){qn.host=t.substring(i,e)}(n)),null===e&&(i=n),e}function Cn(){var e,t,n,r,o,a,l,s;return a=i,l=i,null!==(e=null!==(e=f())?e:"")&&null!==(t=null!==(t=f())?t:"")&&null!==(n=null!==(n=f())?n:"")&&null!==(r=null!==(r=f())?r:"")&&null!==(o=null!==(o=f())?o:"")?e=[e,t,n,r,o]:(e=null,i=l),null!==e&&(s=e,e=void(qn.port=parseInt(s.join("")))),null===e&&(i=a),e}function En(){var e,t,n,r,o;return r=i,o=i,null!==(e=f())&&null!==(t=null!==(t=f())?t:"")&&null!==(n=null!==(n=f())?n:"")?e=[e,t,n]:(e=null,i=o),null!==e&&(e=parseInt(e.join(""))),null===e&&(i=r),e}function An(){var e,t,n;return t=i,null!==(e=St())&&(n=e,e=void(qn.expires=n)),null===e&&(i=t),e}function kn(){var e;return null===(e=Rn())&&(e=Tt()),e}function Rn(){var e,n,r,o,l,s;return o=i,l=i,"refresher"===t.substr(i,9).toLowerCase()?(e=t.substr(i,9),i+=9):(e=null,0===a&&u('"refresher"')),null!==e&&null!==(n=U())?("uac"===t.substr(i,3).toLowerCase()?(r=t.substr(i,3),i+=3):(r=null,0===a&&u('"uac"')),null===r&&("uas"===t.substr(i,3).toLowerCase()?(r=t.substr(i,3),i+=3):(r=null,0===a&&u('"uas"'))),null!==r?e=[e,n,r]:(e=null,i=l)):(e=null,i=l),null!==e&&(s=e[2],e=void(qn.refresher=s.toLowerCase())),null===e&&(i=o),e}function On(){var e,t;for(e=[],null===(t=R())&&null===(t=x())&&(t=C());null!==t;)e.push(t),null===(t=R())&&null===(t=x())&&(t=C());return e}function xn(){var e,n,r,o,l,s,c,f,d,h,p;return h=i,p=i,null!==(e=Nn())?(45===t.charCodeAt(i)?(n="-",i++):(n=null,0===a&&u('"-"')),null!==n&&null!==(r=In())?(45===t.charCodeAt(i)?(o="-",i++):(o=null,0===a&&u('"-"')),null!==o&&null!==(l=In())?(45===t.charCodeAt(i)?(s="-",i++):(s=null,0===a&&u('"-"')),null!==s&&null!==(c=In())?(45===t.charCodeAt(i)?(f="-",i++):(f=null,0===a&&u('"-"')),null!==f&&null!==(d=Pn())?e=[e,n,r,o,l,s,c,f,d]:(e=null,i=p)):(e=null,i=p)):(e=null,i=p)):(e=null,i=p)):(e=null,i=p),null!==e&&(e=function(e){qn=t.substring(i+5,e)}(h,e[0])),null===e&&(i=h),e}function In(){var e,t,n,r,o;return o=i,null!==(e=h())&&null!==(t=h())&&null!==(n=h())&&null!==(r=h())?e=[e,t,n,r]:(e=null,i=o),e}function Nn(){var e,t,n;return n=i,null!==(e=In())&&null!==(t=In())?e=[e,t]:(e=null,i=n),e}function Pn(){var e,t,n,r;return r=i,null!==(e=In())&&null!==(t=In())&&null!==(n=In())?e=[e,t,n]:(e=null,i=r),e}function Dn(){var e,n,r,o,l,s;return o=i,l=i,null!==(e=P())?(s=i,64===t.charCodeAt(i)?(n="@",i++):(n=null,0===a&&u('"@"')),null!==n&&null!==(r=P())?n=[n,r]:(n=null,i=s),null!==(n=null!==n?n:"")?e=[e,n]:(e=null,i=l)):(e=null,i=l),null!==e&&(e=function(e){qn.call_id=t.substring(i,e)}(o)),null===e&&(i=o),e}function Ln(){var e;return null===(e=Un())&&null===(e=Mn())&&null===(e=jn())&&(e=Tt()),e}function Un(){var e,n,r,o,l,s;return o=i,l=i,"to-tag"===t.substr(i,6)?(e="to-tag",i+=6):(e=null,0===a&&u('"to-tag"')),null!==e&&null!==(n=U())&&null!==(r=I())?e=[e,n,r]:(e=null,i=l),null!==e&&(s=e[2],e=void(qn.to_tag=s)),null===e&&(i=o),e}function Mn(){var e,n,r,o,l,s;return o=i,l=i,"from-tag"===t.substr(i,8)?(e="from-tag",i+=8):(e=null,0===a&&u('"from-tag"')),null!==e&&null!==(n=U())&&null!==(r=I())?e=[e,n,r]:(e=null,i=l),null!==e&&(s=e[2],e=void(qn.from_tag=s)),null===e&&(i=o),e}function jn(){var e,n;return n=i,"early-only"===t.substr(i,10)?(e="early-only",i+=10):(e=null,0===a&&u('"early-only"')),null!==e&&(e=void(qn.early_only=!0)),null===e&&(i=n),e}var Fn=n(6041),Hn=n(9390),qn={};if(null===o[r]()||i!==t.length){var zn=Math.max(i,l),Bn=zn2&&void 0!==arguments[2]?arguments[2]:{},o=e;if(void 0===e||void 0===t)throw new TypeError("Not enough arguments");if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(o));var i=d.cloneArray(r.extraHeaders),a=d.cloneObject(r.eventHandlers),l=r.contentType||"text/plain",s={};for(var u in r.fromUserName&&(s.from_uri=new m("sip",r.fromUserName,this._ua.configuration.uri.host),i.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString()))),r.fromDisplayName&&(s.from_display_name=r.fromDisplayName),a)Object.prototype.hasOwnProperty.call(a,u)&&this.on(u,a[u]);i.push("Content-Type: ".concat(l)),this._request=new f.OutgoingRequest(c.MESSAGE,e,this._ua,s,i),t&&(this._request.body=t);var p=new h(this._ua,this._request,{onRequestTimeout:function(){n._onRequestTimeout()},onTransportError:function(){n._onTransportError()},onReceiveResponse:function(e){n._receiveResponse(e)}});this._newMessage("local",this._request),p.send()}},{key:"init_incoming",value:function(e){this._request=e,this._newMessage("remote",e),this._is_replied||(this._is_replied=!0,e.reply(200)),this._close()}},{key:"accept",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=d.cloneArray(e.extraHeaders),n=e.body;if("incoming"!==this._direction)throw new p.NotSupportedError('"accept" not supported for outgoing Message');if(this._is_replied)throw new Error("incoming Message already replied");this._is_replied=!0,this._request.reply(200,null,t,n)}},{key:"reject",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.status_code||480,n=e.reason_phrase,r=d.cloneArray(e.extraHeaders),o=e.body;if("incoming"!==this._direction)throw new p.NotSupportedError('"reject" not supported for outgoing Message');if(this._is_replied)throw new Error("incoming Message already replied");if(t<300||t>=700)throw new TypeError("Invalid status_code: ".concat(t));this._is_replied=!0,this._request.reply(t,n,r,o)}},{key:"_receiveResponse",value:function(e){if(!this._closed)switch(!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):this._succeeded("remote",e);break;default:var t=d.sipErrorCause(e.status_code);this._failed("remote",e,t)}}},{key:"_onRequestTimeout",value:function(){this._closed||this._failed("system",null,c.causes.REQUEST_TIMEOUT)}},{key:"_onTransportError",value:function(){this._closed||this._failed("system",null,c.causes.CONNECTION_ERROR)}},{key:"_close",value:function(){this._closed=!0,this._ua.destroyMessage(this)}},{key:"_newMessage",value:function(e,t){"remote"===e?(this._direction="incoming",this._local_identity=t.to,this._remote_identity=t.from):"local"===e&&(this._direction="outgoing",this._local_identity=t.from,this._remote_identity=t.to),this._ua.newMessage(this,{originator:e,message:this,request:t})}},{key:"_failed",value:function(e,t,n){g.debug("MESSAGE failed"),this._close(),g.debug('emit "failed"'),this.emit("failed",{originator:e,response:t||null,cause:n})}},{key:"_succeeded",value:function(e,t){g.debug("MESSAGE succeeded"),this._close(),g.debug('emit "succeeded"'),this.emit("succeeded",{originator:e,response:t})}},{key:"direction",get:function(){return this._direction}},{key:"local_identity",get:function(){return this._local_identity}},{key:"remote_identity",get:function(){return this._remote_identity}}],n&&o(t.prototype,n),r&&o(t,r),s}(s)},9390:function(e,t,n){"use strict";function r(e,t){for(var n=0;n"),this._parameters)Object.prototype.hasOwnProperty.call(this._parameters,t)&&(e+=";".concat(t),null!==this._parameters[t]&&(e+="=".concat(this._parameters[t])));return e}},{key:"uri",get:function(){return this._uri}},{key:"display_name",get:function(){return this._display_name},set:function(e){this._display_name=0===e?"0":e}}]),e}()},5253:function(e,t,n){"use strict";function r(e){return r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{},o=e;if(void 0===e)throw new TypeError("A target is required for OPTIONS");if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(o));var i=d.cloneArray(r.extraHeaders),a=d.cloneObject(r.eventHandlers),l=r.contentType||"application/sdp";for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&this.on(s,a[s]);i.push("Content-Type: ".concat(l)),this._request=new f.OutgoingRequest(c.OPTIONS,e,this._ua,null,i),t&&(this._request.body=t);var u=new h(this._ua,this._request,{onRequestTimeout:function(){n._onRequestTimeout()},onTransportError:function(){n._onTransportError()},onReceiveResponse:function(e){n._receiveResponse(e)}});this._newOptions("local",this._request),u.send()}},{key:"init_incoming",value:function(e){this._request=e,this._newOptions("remote",e),this._is_replied||(this._is_replied=!0,e.reply(200)),this._close()}},{key:"accept",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=d.cloneArray(e.extraHeaders),n=e.body;if("incoming"!==this._direction)throw new p.NotSupportedError('"accept" not supported for outgoing Options');if(this._is_replied)throw new Error("incoming Options already replied");this._is_replied=!0,this._request.reply(200,null,t,n)}},{key:"reject",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.status_code||480,n=e.reason_phrase,r=d.cloneArray(e.extraHeaders),o=e.body;if("incoming"!==this._direction)throw new p.NotSupportedError('"reject" not supported for outgoing Options');if(this._is_replied)throw new Error("incoming Options already replied");if(t<300||t>=700)throw new TypeError("Invalid status_code: ".concat(t));this._is_replied=!0,this._request.reply(t,n,r,o)}},{key:"_receiveResponse",value:function(e){if(!this._closed)switch(!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):this._succeeded("remote",e);break;default:var t=d.sipErrorCause(e.status_code);this._failed("remote",e,t)}}},{key:"_onRequestTimeout",value:function(){this._closed||this._failed("system",null,c.causes.REQUEST_TIMEOUT)}},{key:"_onTransportError",value:function(){this._closed||this._failed("system",null,c.causes.CONNECTION_ERROR)}},{key:"_close",value:function(){this._closed=!0,this._ua.destroyMessage(this)}},{key:"_newOptions",value:function(e,t){"remote"===e?(this._direction="incoming",this._local_identity=t.to,this._remote_identity=t.from):"local"===e&&(this._direction="outgoing",this._local_identity=t.from,this._remote_identity=t.to),this._ua.newOptions(this,{originator:e,message:this,request:t})}},{key:"_failed",value:function(e,t,n){m.debug("OPTIONS failed"),this._close(),m.debug('emit "failed"'),this.emit("failed",{originator:e,response:t||null,cause:n})}},{key:"_succeeded",value:function(e,t){m.debug("OPTIONS succeeded"),this._close(),m.debug('emit "succeeded"'),this.emit("succeeded",{originator:e,response:t})}},{key:"direction",get:function(){return this._direction}},{key:"local_identity",get:function(){return this._local_identity}},{key:"remote_identity",get:function(){return this._remote_identity}}],n&&o(t.prototype,n),r&&o(t,r),s}(s)},4880:function(e,t,n){"use strict";function r(e,t){var n;if("undefined"===typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"===typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(e,t)}(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,l=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return l=e.done,e},e:function(e){s=!0,a=e},f:function(){try{l||null==n.return||n.return()}finally{if(s)throw a}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,l=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return l=e.done,e},e:function(e){s=!0,a=e},f:function(){try{l||null==n.return||n.return()}finally{if(s)throw a}}}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;k.debug("connect()");var r=e,o=v.cloneObject(t.eventHandlers),i=v.cloneArray(t.extraHeaders),a=v.cloneObject(t.mediaConstraints,{audio:!0,video:!0}),l=t.mediaStream||null,s=v.cloneObject(t.pcConfig,{iceServers:[]}),u=t.rtcConstraints||null,c=t.rtcOfferConstraints||null;if(this._rtcOfferConstraints=c,this._rtcAnswerConstraints=t.rtcAnswerConstraints||null,this._data=t.data||this._data,void 0===e)throw new TypeError("Not enough arguments");if(this._status!==R.STATUS_NULL)throw new m.InvalidStateError(this._status);if(!window.RTCPeerConnection)throw new m.NotSupportedError("WebRTC not supported");if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(r));for(var f in this._sessionTimers.enabled&&v.isDecimal(t.sessionTimersExpires)&&(t.sessionTimersExpires>=p.MIN_SESSION_EXPIRES?this._sessionTimers.defaultExpires=t.sessionTimersExpires:this._sessionTimers.defaultExpires=p.SESSION_EXPIRES),o)Object.prototype.hasOwnProperty.call(o,f)&&this.on(f,o[f]);this._from_tag=v.newTag();var d=t.anonymous||!1,h={from_tag:this._from_tag};this._contact=this._ua.contact.toString({anonymous:d,outbound:!0}),d?(h.from_display_name="Anonymous",h.from_uri=new A("sip","anonymous","anonymous.invalid"),i.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString())),i.push("Privacy: id")):t.fromUserName&&(h.from_uri=new A("sip",t.fromUserName,this._ua.configuration.uri.host),i.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString()))),t.fromDisplayName&&(h.from_display_name=t.fromDisplayName),i.push("Contact: ".concat(this._contact)),i.push("Content-Type: application/sdp"),this._sessionTimers.enabled&&i.push("Session-Expires: ".concat(this._sessionTimers.defaultExpires).concat(this._ua.configuration.session_timers_force_refresher?";refresher=uac":"")),this._request=new y.InitialOutgoingInviteRequest(e,this._ua,h,i),this._id=this._request.call_id+this._from_tag,this._createRTCConnection(s,u),this._direction="outgoing",this._local_identity=this._request.from,this._remote_identity=this._request.to,n&&n(this),this._newRTCSession("local",this._request),this._sendInitialRequest(a,c,l)}},{key:"init_incoming",value:function(e,t){var n,r=this;k.debug("init_incoming()");var o=e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0;e.body&&"application/sdp"!==o?e.reply(415):(this._status=R.STATUS_INVITE_RECEIVED,this._from_tag=e.from_tag,this._id=e.call_id+this._from_tag,this._request=e,this._contact=this._ua.contact.toString(),e.hasHeader("expires")&&(n=1e3*e.getHeader("expires")),e.to_tag=v.newTag(),this._createDialog(e,"UAS",!0)?(e.body?this._late_sdp=!1:this._late_sdp=!0,this._status=R.STATUS_WAITING_FOR_ANSWER,this._timers.userNoAnswerTimer=setTimeout((function(){e.reply(408),r._failed("local",null,p.causes.NO_ANSWER)}),this._ua.configuration.no_answer_timeout),n&&(this._timers.expiresTimer=setTimeout((function(){r._status===R.STATUS_WAITING_FOR_ANSWER&&(e.reply(487),r._failed("system",null,p.causes.EXPIRES))}),n)),this._direction="incoming",this._local_identity=e.to,this._remote_identity=e.from,t&&t(this),this._newRTCSession("remote",e),this._status!==R.STATUS_TERMINATED&&(e.reply(180,null,["Contact: ".concat(this._contact)]),this._progress("local",null))):e.reply(500,"Missing Contact header field"))}},{key:"answer",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};k.debug("answer()");var n=this._request,r=v.cloneArray(t.extraHeaders),i=v.cloneObject(t.mediaConstraints),a=t.mediaStream||null,l=v.cloneObject(t.pcConfig,{iceServers:[]}),s=t.rtcConstraints||null,u=t.rtcAnswerConstraints||null,c=v.cloneObject(t.rtcOfferConstraints),f=!1,d=!1,h=!1,g=!1;if(this._rtcAnswerConstraints=u,this._rtcOfferConstraints=t.rtcOfferConstraints||null,this._data=t.data||this._data,"incoming"!==this._direction)throw new m.NotSupportedError('"answer" not supported for outgoing RTCSession');if(this._status!==R.STATUS_WAITING_FOR_ANSWER)throw new m.InvalidStateError(this._status);if(this._sessionTimers.enabled&&v.isDecimal(t.sessionTimersExpires)&&(t.sessionTimersExpires>=p.MIN_SESSION_EXPIRES?this._sessionTimers.defaultExpires=t.sessionTimersExpires:this._sessionTimers.defaultExpires=p.SESSION_EXPIRES),this._status=R.STATUS_ANSWERED,this._createDialog(n,"UAS")){clearTimeout(this._timers.userNoAnswerTimer),r.unshift("Contact: ".concat(this._contact));var _=n.parseSDP();Array.isArray(_.media)||(_.media=[_.media]);var y,b=o(_.media);try{for(b.s();!(y=b.n()).done;){var S=y.value;"audio"===S.type&&(f=!0,S.direction&&"sendrecv"!==S.direction||(h=!0)),"video"===S.type&&(d=!0,S.direction&&"sendrecv"!==S.direction||(g=!0))}}catch(x){b.e(x)}finally{b.f()}if(a&&!1===i.audio){var w,T=o(a.getAudioTracks());try{for(T.s();!(w=T.n()).done;){var C=w.value;a.removeTrack(C)}}catch(x){T.e(x)}finally{T.f()}}if(a&&!1===i.video){var E,A=o(a.getVideoTracks());try{for(A.s();!(E=A.n()).done;){var O=E.value;a.removeTrack(O)}}catch(x){A.e(x)}finally{A.f()}}a||void 0!==i.audio||(i.audio=h),a||void 0!==i.video||(i.video=g),a||f||c.offerToReceiveAudio||(i.audio=!1),a||d||c.offerToReceiveVideo||(i.video=!1),this._createRTCConnection(l,s),Promise.resolve().then((function(){return a||(i.audio||i.video?(e._localMediaStreamLocallyGenerated=!0,navigator.mediaDevices.getUserMedia(i).catch((function(t){if(e._status===R.STATUS_TERMINATED)throw new Error("terminated");throw n.reply(480),e._failed("local",null,p.causes.USER_DENIED_MEDIA_ACCESS),k.warn('emit "getusermediafailed" [error:%o]',t),e.emit("getusermediafailed",t),new Error("getUserMedia() failed")}))):void 0)})).then((function(t){if(e._status===R.STATUS_TERMINATED)throw new Error("terminated");e._localMediaStream=t,t&&t.getTracks().forEach((function(n){e._connection.addTrack(n,t)}))})).then((function(){if(!e._late_sdp){var t={originator:"remote",type:"offer",sdp:n.body};k.debug('emit "sdp"'),e.emit("sdp",t);var r=new RTCSessionDescription({type:"offer",sdp:t.sdp});return e._connectionPromiseQueue=e._connectionPromiseQueue.then((function(){return e._connection.setRemoteDescription(r)})).catch((function(t){throw n.reply(488),e._failed("system",null,p.causes.WEBRTC_ERROR),k.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',t),e.emit("peerconnection:setremotedescriptionfailed",t),new Error("peerconnection.setRemoteDescription() failed")})),e._connectionPromiseQueue}})).then((function(){if(e._status===R.STATUS_TERMINATED)throw new Error("terminated");return e._connecting(n),e._late_sdp?e._createLocalDescription("offer",e._rtcOfferConstraints).catch((function(){throw n.reply(500),new Error("_createLocalDescription() failed")})):e._createLocalDescription("answer",u).catch((function(){throw n.reply(500),new Error("_createLocalDescription() failed")}))})).then((function(t){if(e._status===R.STATUS_TERMINATED)throw new Error("terminated");e._handleSessionTimersInIncomingRequest(n,r),n.reply(200,null,r,t,(function(){e._status=R.STATUS_WAITING_FOR_ACK,e._setInvite2xxTimer(n,t),e._setACKTimer(),e._accepted("local")}),(function(){e._failed("system",null,p.causes.CONNECTION_ERROR)}))})).catch((function(t){e._status!==R.STATUS_TERMINATED&&k.warn(t)}))}else n.reply(500,"Error creating dialog")}},{key:"terminate",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};k.debug("terminate()");var n,r=t.cause||p.causes.BYE,o=v.cloneArray(t.extraHeaders),i=t.body,a=t.status_code,l=t.reason_phrase;if(this._status===R.STATUS_TERMINATED)throw new m.InvalidStateError(this._status);switch(this._status){case R.STATUS_NULL:case R.STATUS_INVITE_SENT:case R.STATUS_1XX_RECEIVED:if(k.debug("canceling session"),a&&(a<200||a>=700))throw new TypeError("Invalid status_code: ".concat(a));a&&(l=l||p.REASON_PHRASE[a]||"",n="SIP ;cause=".concat(a,' ;text="').concat(l,'"')),this._status===R.STATUS_NULL||this._status===R.STATUS_INVITE_SENT?(this._is_canceled=!0,this._cancel_reason=n):this._status===R.STATUS_1XX_RECEIVED&&this._request.cancel(n),this._status=R.STATUS_CANCELED,this._failed("local",null,p.causes.CANCELED);break;case R.STATUS_WAITING_FOR_ANSWER:case R.STATUS_ANSWERED:if(k.debug("rejecting session"),(a=a||480)<300||a>=700)throw new TypeError("Invalid status_code: ".concat(a));this._request.reply(a,l,o,i),this._failed("local",null,p.causes.REJECTED);break;case R.STATUS_WAITING_FOR_ACK:case R.STATUS_CONFIRMED:if(k.debug("terminating session"),l=t.reason_phrase||p.REASON_PHRASE[a]||"",a&&(a<200||a>=700))throw new TypeError("Invalid status_code: ".concat(a));if(a&&o.push("Reason: SIP ;cause=".concat(a,'; text="').concat(l,'"')),this._status===R.STATUS_WAITING_FOR_ACK&&"incoming"===this._direction&&this._request.server_transaction.state!==g.C.STATUS_TERMINATED){var s=this._dialog;this.receiveRequest=function(t){t.method===p.ACK&&(e.sendRequest(p.BYE,{extraHeaders:o,body:i}),s.terminate())},this._request.server_transaction.on("stateChanged",(function(){e._request.server_transaction.state===g.C.STATUS_TERMINATED&&(e.sendRequest(p.BYE,{extraHeaders:o,body:i}),s.terminate())})),this._ended("local",null,r),this._dialog=s,this._ua.newDialog(s)}else this.sendRequest(p.BYE,{extraHeaders:o,body:i}),this._ended("local",null,r)}}},{key:"sendDTMF",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};k.debug("sendDTMF() | tones: %s",e);var n=0,r=t.duration||null,o=t.interToneGap||null,i=t.transportType||p.DTMF_TRANSPORT.INFO;if(void 0===e)throw new TypeError("Not enough arguments");if(this._status!==R.STATUS_CONFIRMED&&this._status!==R.STATUS_WAITING_FOR_ACK&&this._status!==R.STATUS_1XX_RECEIVED)throw new m.InvalidStateError(this._status);if(i!==p.DTMF_TRANSPORT.INFO&&i!==p.DTMF_TRANSPORT.RFC2833)throw new TypeError("invalid transportType: ".concat(i));if("number"===typeof e&&(e=e.toString()),!e||"string"!==typeof e||!e.match(/^[0-9A-DR#*,]+$/i))throw new TypeError("Invalid tones: ".concat(e));if(r&&!v.isDecimal(r))throw new TypeError("Invalid tone duration: ".concat(r));if(r?rw.C.MAX_DURATION?(k.debug('"duration" value is greater than the maximum allowed, setting it to '.concat(w.C.MAX_DURATION," milliseconds")),r=w.C.MAX_DURATION):r=Math.abs(r):r=w.C.DEFAULT_DURATION,t.duration=r,o&&!v.isDecimal(o))throw new TypeError("Invalid interToneGap: ".concat(o));if(o?o=this._tones.length)return void(this._tones=null);var l=this._tones[n];if(n+=1,","===l)i=2e3;else{var s=new w(this);t.eventHandlers={onFailed:function(){a._tones=null}},s.send(l,t),i=r+o}setTimeout(e.bind(this),i)}.call(this));else{var a=this._getDTMFRTPSender();a&&(e=a.toneBuffer+e,a.insertDTMF(e,r,o))}}},{key:"sendInfo",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(k.debug("sendInfo()"),this._status!==R.STATUS_CONFIRMED&&this._status!==R.STATUS_WAITING_FOR_ACK&&this._status!==R.STATUS_1XX_RECEIVED)throw new m.InvalidStateError(this._status);new T(this).send(e,t,n)}},{key:"mute",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{audio:!0,video:!1};k.debug("mute()");var t=!1,n=!1;!1===this._audioMuted&&e.audio&&(t=!0,this._audioMuted=!0,this._toggleMuteAudio(!0)),!1===this._videoMuted&&e.video&&(n=!0,this._videoMuted=!0,this._toggleMuteVideo(!0)),!0!==t&&!0!==n||this._onmute({audio:t,video:n})}},{key:"unmute",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{audio:!0,video:!0};k.debug("unmute()");var t=!1,n=!1;!0===this._audioMuted&&e.audio&&(t=!0,this._audioMuted=!1,!1===this._localHold&&this._toggleMuteAudio(!1)),!0===this._videoMuted&&e.video&&(n=!0,this._videoMuted=!1,!1===this._localHold&&this._toggleMuteVideo(!1)),!0!==t&&!0!==n||this._onunmute({audio:t,video:n})}},{key:"hold",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(k.debug("hold()"),this._status!==R.STATUS_WAITING_FOR_ACK&&this._status!==R.STATUS_CONFIRMED)return!1;if(!0===this._localHold)return!1;if(!this._isReadyToReOffer())return!1;this._localHold=!0,this._onhold("local");var r={succeeded:function(){n&&n()},failed:function(){e.terminate({cause:p.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Hold Failed"})}};return t.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:r,extraHeaders:t.extraHeaders}):this._sendReinvite({eventHandlers:r,extraHeaders:t.extraHeaders}),!0}},{key:"unhold",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(k.debug("unhold()"),this._status!==R.STATUS_WAITING_FOR_ACK&&this._status!==R.STATUS_CONFIRMED)return!1;if(!1===this._localHold)return!1;if(!this._isReadyToReOffer())return!1;this._localHold=!1,this._onunhold("local");var r={succeeded:function(){n&&n()},failed:function(){e.terminate({cause:p.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Unhold Failed"})}};return t.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:r,extraHeaders:t.extraHeaders}):this._sendReinvite({eventHandlers:r,extraHeaders:t.extraHeaders}),!0}},{key:"renegotiate",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;k.debug("renegotiate()");var r=t.rtcOfferConstraints||null;if(this._status!==R.STATUS_WAITING_FOR_ACK&&this._status!==R.STATUS_CONFIRMED)return!1;if(!this._isReadyToReOffer())return!1;var o={succeeded:function(){n&&n()},failed:function(){e.terminate({cause:p.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Media Renegotiation Failed"})}};return this._setLocalMediaStatus(),t.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:o,rtcOfferConstraints:r,extraHeaders:t.extraHeaders}):this._sendReinvite({eventHandlers:o,rtcOfferConstraints:r,extraHeaders:t.extraHeaders}),!0}},{key:"refer",value:function(e,t){var n=this;k.debug("refer()");var r=e;if(this._status!==R.STATUS_WAITING_FOR_ACK&&this._status!==R.STATUS_CONFIRMED)return!1;if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(r));var o=new E(this);o.sendRefer(e,t);var i=o.id;return this._referSubscribers[i]=o,o.on("requestFailed",(function(){delete n._referSubscribers[i]})),o.on("accepted",(function(){delete n._referSubscribers[i]})),o.on("failed",(function(){delete n._referSubscribers[i]})),o}},{key:"sendRequest",value:function(e,t){return k.debug("sendRequest()"),this._dialog.sendRequest(e,t)}},{key:"receiveRequest",value:function(e){var t=this;if(k.debug("receiveRequest()"),e.method===p.CANCEL)this._status!==R.STATUS_WAITING_FOR_ANSWER&&this._status!==R.STATUS_ANSWERED||(this._status=R.STATUS_CANCELED,this._request.reply(487),this._failed("remote",e,p.causes.CANCELED));else switch(e.method){case p.ACK:if(this._status!==R.STATUS_WAITING_FOR_ACK)return;if(this._status=R.STATUS_CONFIRMED,clearTimeout(this._timers.ackTimer),clearTimeout(this._timers.invite2xxTimer),this._late_sdp){if(!e.body){this.terminate({cause:p.causes.MISSING_SDP,status_code:400});break}var n={originator:"remote",type:"answer",sdp:e.body};k.debug('emit "sdp"'),this.emit("sdp",n);var r=new RTCSessionDescription({type:"answer",sdp:n.sdp});this._connectionPromiseQueue=this._connectionPromiseQueue.then((function(){return t._connection.setRemoteDescription(r)})).then((function(){t._is_confirmed||t._confirmed("remote",e)})).catch((function(e){t.terminate({cause:p.causes.BAD_MEDIA_DESCRIPTION,status_code:488}),k.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),t.emit("peerconnection:setremotedescriptionfailed",e)}))}else this._is_confirmed||this._confirmed("remote",e);break;case p.BYE:this._status===R.STATUS_CONFIRMED||this._status===R.STATUS_WAITING_FOR_ACK?(e.reply(200),this._ended("remote",e,p.causes.BYE)):this._status===R.STATUS_INVITE_RECEIVED||this._status===R.STATUS_WAITING_FOR_ANSWER?(e.reply(200),this._request.reply(487,"BYE Received"),this._ended("remote",e,p.causes.BYE)):e.reply(403,"Wrong Status");break;case p.INVITE:this._status===R.STATUS_CONFIRMED?e.hasHeader("replaces")?this._receiveReplaces(e):this._receiveReinvite(e):e.reply(403,"Wrong Status");break;case p.INFO:if(this._status===R.STATUS_1XX_RECEIVED||this._status===R.STATUS_WAITING_FOR_ANSWER||this._status===R.STATUS_ANSWERED||this._status===R.STATUS_WAITING_FOR_ACK||this._status===R.STATUS_CONFIRMED){var o=e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0;o&&o.match(/^application\/dtmf-relay/i)?new w(this).init_incoming(e):void 0!==o?new T(this).init_incoming(e):e.reply(415)}else e.reply(403,"Wrong Status");break;case p.UPDATE:this._status===R.STATUS_CONFIRMED?this._receiveUpdate(e):e.reply(403,"Wrong Status");break;case p.REFER:this._status===R.STATUS_CONFIRMED?this._receiveRefer(e):e.reply(403,"Wrong Status");break;case p.NOTIFY:this._status===R.STATUS_CONFIRMED?this._receiveNotify(e):e.reply(403,"Wrong Status");break;default:e.reply(501)}}},{key:"onTransportError",value:function(){k.warn("onTransportError()"),this._status!==R.STATUS_TERMINATED&&this.terminate({status_code:500,reason_phrase:p.causes.CONNECTION_ERROR,cause:p.causes.CONNECTION_ERROR})}},{key:"onRequestTimeout",value:function(){k.warn("onRequestTimeout()"),this._status!==R.STATUS_TERMINATED&&this.terminate({status_code:408,reason_phrase:p.causes.REQUEST_TIMEOUT,cause:p.causes.REQUEST_TIMEOUT})}},{key:"onDialogError",value:function(){k.warn("onDialogError()"),this._status!==R.STATUS_TERMINATED&&this.terminate({status_code:500,reason_phrase:p.causes.DIALOG_ERROR,cause:p.causes.DIALOG_ERROR})}},{key:"newDTMF",value:function(e){k.debug("newDTMF()"),this.emit("newDTMF",e)}},{key:"newInfo",value:function(e){k.debug("newInfo()"),this.emit("newInfo",e)}},{key:"_isReadyToReOffer",value:function(){return this._rtcReady?this._dialog?!0!==this._dialog.uac_pending_reply&&!0!==this._dialog.uas_pending_reply||(k.debug("_isReadyToReOffer() | there is another INVITE/UPDATE transaction in progress"),!1):(k.debug("_isReadyToReOffer() | session not established yet"),!1):(k.debug("_isReadyToReOffer() | internal WebRTC status not ready"),!1)}},{key:"_close",value:function(){if(k.debug("close()"),this._localMediaStream&&this._localMediaStreamLocallyGenerated&&(k.debug("close() | closing local MediaStream"),v.closeMediaStream(this._localMediaStream)),this._status!==R.STATUS_TERMINATED){if(this._status=R.STATUS_TERMINATED,this._connection)try{this._connection.close()}catch(r){k.warn("close() | error closing the RTCPeerConnection: %o",r)}for(var e in this._timers)Object.prototype.hasOwnProperty.call(this._timers,e)&&clearTimeout(this._timers[e]);for(var t in clearTimeout(this._sessionTimers.timer),this._dialog&&(this._dialog.terminate(),delete this._dialog),this._earlyDialogs)Object.prototype.hasOwnProperty.call(this._earlyDialogs,t)&&(this._earlyDialogs[t].terminate(),delete this._earlyDialogs[t]);for(var n in this._referSubscribers)Object.prototype.hasOwnProperty.call(this._referSubscribers,n)&&delete this._referSubscribers[n];this._ua.destroyRTCSession(this)}}},{key:"_setInvite2xxTimer",value:function(e,t){var n=_.T1;this._timers.invite2xxTimer=setTimeout(function r(){this._status===R.STATUS_WAITING_FOR_ACK&&(e.reply(200,null,["Contact: ".concat(this._contact)],t),n<_.T2&&(n*=2)>_.T2&&(n=_.T2),this._timers.invite2xxTimer=setTimeout(r.bind(this),n))}.bind(this),n)}},{key:"_setACKTimer",value:function(){var e=this;this._timers.ackTimer=setTimeout((function(){e._status===R.STATUS_WAITING_FOR_ACK&&(k.debug("no ACK received, terminating the session"),clearTimeout(e._timers.invite2xxTimer),e.sendRequest(p.BYE),e._ended("remote",null,p.causes.NO_ACK))}),_.TIMER_H)}},{key:"_createRTCConnection",value:function(e,t){var n=this;this._connection=new RTCPeerConnection(e,t),this._connection.addEventListener("iceconnectionstatechange",(function(){"failed"===n._connection.iceConnectionState&&n.terminate({cause:p.causes.RTP_TIMEOUT,status_code:408,reason_phrase:p.causes.RTP_TIMEOUT})})),k.debug('emit "peerconnection"'),this.emit("peerconnection",{peerconnection:this._connection})}},{key:"_createLocalDescription",value:function(e,t){var n=this;if(k.debug("createLocalDescription()"),"offer"!==e&&"answer"!==e)throw new Error('createLocalDescription() | invalid type "'.concat(e,'"'));var r=this._connection;return this._rtcReady=!1,Promise.resolve().then((function(){return"offer"===e?r.createOffer(t).catch((function(e){return k.warn('emit "peerconnection:createofferfailed" [error:%o]',e),n.emit("peerconnection:createofferfailed",e),Promise.reject(e)})):r.createAnswer(t).catch((function(e){return k.warn('emit "peerconnection:createanswerfailed" [error:%o]',e),n.emit("peerconnection:createanswerfailed",e),Promise.reject(e)}))})).then((function(e){return r.setLocalDescription(e).catch((function(e){return n._rtcReady=!0,k.warn('emit "peerconnection:setlocaldescriptionfailed" [error:%o]',e),n.emit("peerconnection:setlocaldescriptionfailed",e),Promise.reject(e)}))})).then((function(){var o=t&&t.iceRestart;if("complete"===r.iceGatheringState&&!o||"gathering"===r.iceGatheringState&&n._iceReady){n._rtcReady=!0;var i={originator:"local",type:e,sdp:r.localDescription.sdp};return k.debug('emit "sdp"'),n.emit("sdp",i),Promise.resolve(i.sdp)}return new Promise((function(t){var o,i,a=!1;n._iceReady=!1;var l=function(){if(!a){r.removeEventListener("icecandidate",o),r.removeEventListener("icegatheringstatechange",i),a=!0,n._rtcReady=!0,n._iceReady=!0;var l={originator:"local",type:e,sdp:r.localDescription.sdp};k.debug('emit "sdp"'),n.emit("sdp",l),t(l.sdp)}};r.addEventListener("icecandidate",o=function(e){var t=e.candidate;t?n.emit("icecandidate",{candidate:t,ready:l}):l()}),r.addEventListener("icegatheringstatechange",i=function(){"complete"===r.iceGatheringState&&l()})}))}))}},{key:"_createDialog",value:function(e,t,n){var r="UAS"===t?e.to_tag:e.from_tag,o="UAS"===t?e.from_tag:e.to_tag,i=e.call_id+r+o,a=this._earlyDialogs[i];if(n)return!!a||((a=new b(this,e,t,b.C.STATUS_EARLY)).error?(k.debug(a.error),this._failed("remote",e,p.causes.INTERNAL_ERROR),!1):(this._earlyDialogs[i]=a,!0));if(this._from_tag=e.from_tag,this._to_tag=e.to_tag,a)return a.update(e,t),this._dialog=a,delete this._earlyDialogs[i],!0;var l=new b(this,e,t);return l.error?(k.debug(l.error),this._failed("remote",e,p.causes.INTERNAL_ERROR),!1):(this._dialog=l,!0)}},{key:"_receiveReinvite",value:function(e){var t=this;k.debug("receiveReinvite()");var n=e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0,r={request:e,callback:void 0,reject:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o=!0;var n=t.status_code||403,r=t.reason_phrase||"",i=v.cloneArray(t.extraHeaders);if(this._status!==R.STATUS_CONFIRMED)return!1;if(n<300||n>=700)throw new TypeError("Invalid status_code: ".concat(n));e.reply(n,r,i)}.bind(this)},o=!1;if(this.emit("reinvite",r),!o){if(this._late_sdp=!1,!e.body)return this._late_sdp=!0,this._remoteHold&&(this._remoteHold=!1,this._onunhold("remote")),void(this._connectionPromiseQueue=this._connectionPromiseQueue.then((function(){return t._createLocalDescription("offer",t._rtcOfferConstraints)})).then((function(e){i.call(t,e)})).catch((function(){e.reply(500)})));if("application/sdp"!==n)return k.debug("invalid Content-Type"),void e.reply(415);this._processInDialogSdpOffer(e).then((function(e){t._status!==R.STATUS_TERMINATED&&i.call(t,e)})).catch((function(e){k.warn(e)}))}function i(t){var n=this,o=["Contact: ".concat(this._contact)];this._handleSessionTimersInIncomingRequest(e,o),this._late_sdp&&(t=this._mangleOffer(t)),e.reply(200,null,o,t,(function(){n._status=R.STATUS_WAITING_FOR_ACK,n._setInvite2xxTimer(e,t),n._setACKTimer()})),"function"===typeof r.callback&&r.callback()}}},{key:"_receiveUpdate",value:function(e){var t=this;k.debug("receiveUpdate()");var n=e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0,r={request:e,callback:void 0,reject:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o=!0;var n=t.status_code||403,r=t.reason_phrase||"",i=v.cloneArray(t.extraHeaders);if(this._status!==R.STATUS_CONFIRMED)return!1;if(n<300||n>=700)throw new TypeError("Invalid status_code: ".concat(n));e.reply(n,r,i)}.bind(this)},o=!1;if(this.emit("update",r),!o)if(e.body){if("application/sdp"!==n)return k.debug("invalid Content-Type"),void e.reply(415);this._processInDialogSdpOffer(e).then((function(e){t._status!==R.STATUS_TERMINATED&&i.call(t,e)})).catch((function(e){k.warn(e)}))}else i.call(this,null);function i(t){var n=["Contact: ".concat(this._contact)];this._handleSessionTimersInIncomingRequest(e,n),e.reply(200,null,n,t),"function"===typeof r.callback&&r.callback()}}},{key:"_processInDialogSdpOffer",value:function(e){var t=this;k.debug("_processInDialogSdpOffer()");var n,r=e.parseSDP(),i=!1,a=o(r.media);try{for(a.s();!(n=a.n()).done;){var l=n.value;if(-1!==O.indexOf(l.type)){var s=l.direction||r.direction||"sendrecv";if("sendonly"!==s&&"inactive"!==s){i=!1;break}i=!0}}}catch(f){a.e(f)}finally{a.f()}var u={originator:"remote",type:"offer",sdp:e.body};k.debug('emit "sdp"'),this.emit("sdp",u);var c=new RTCSessionDescription({type:"offer",sdp:u.sdp});return this._connectionPromiseQueue=this._connectionPromiseQueue.then((function(){if(t._status===R.STATUS_TERMINATED)throw new Error("terminated");return t._connection.setRemoteDescription(c).catch((function(n){throw e.reply(488),k.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',n),t.emit("peerconnection:setremotedescriptionfailed",n),n}))})).then((function(){if(t._status===R.STATUS_TERMINATED)throw new Error("terminated");!0===t._remoteHold&&!1===i?(t._remoteHold=!1,t._onunhold("remote")):!1===t._remoteHold&&!0===i&&(t._remoteHold=!0,t._onhold("remote"))})).then((function(){if(t._status===R.STATUS_TERMINATED)throw new Error("terminated");return t._createLocalDescription("answer",t._rtcAnswerConstraints).catch((function(t){throw e.reply(500),k.warn('emit "peerconnection:createtelocaldescriptionfailed" [error:%o]',t),t}))})).catch((function(e){k.warn("_processInDialogSdpOffer() failed [error: %o]",e)})),this._connectionPromiseQueue}},{key:"_receiveRefer",value:function(e){var t=this;if(k.debug("receiveRefer()"),!e.refer_to)return k.debug("no Refer-To header field present in REFER"),void e.reply(400);if(e.refer_to.uri.scheme!==p.SIP)return k.debug("Refer-To header field points to a non-SIP URI scheme"),void e.reply(416);e.reply(202);var r=new C(this,e.cseq);function o(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t="function"===typeof t?t:null,this._status!==R.STATUS_WAITING_FOR_ACK&&this._status!==R.STATUS_CONFIRMED)return!1;var i=new n(this._ua);if(i.on("progress",(function(e){var t=e.response;r.notify(t.status_code,t.reason_phrase)})),i.on("accepted",(function(e){var t=e.response;r.notify(t.status_code,t.reason_phrase)})),i.on("_failed",(function(e){var t=e.message,n=e.cause;t?r.notify(t.status_code,t.reason_phrase):r.notify(487,n)})),e.refer_to.uri.hasHeader("replaces")){var a=decodeURIComponent(e.refer_to.uri.getHeader("replaces"));o.extraHeaders=v.cloneArray(o.extraHeaders),o.extraHeaders.push("Replaces: ".concat(a))}i.connect(e.refer_to.uri.toAor(),o,t)}function i(){r.notify(603)}k.debug('emit "refer"'),this.emit("refer",{request:e,accept:function(e,n){o.call(t,e,n)},reject:function(){i.call(t)}})}},{key:"_receiveNotify",value:function(e){if(k.debug("receiveNotify()"),e.event||e.reply(400),"refer"===e.event.event){var t,n;if(e.event.params&&e.event.params.id)t=e.event.params.id,n=this._referSubscribers[t];else{if(1!==Object.keys(this._referSubscribers).length)return void e.reply(400,"Missing event id parameter");n=this._referSubscribers[Object.keys(this._referSubscribers)[0]]}if(!n)return void e.reply(481,"Subscription does not exist");n.receiveNotify(e),e.reply(200)}else e.reply(489)}},{key:"_receiveReplaces",value:function(e){var t=this;function r(t){var r=this;if(this._status!==R.STATUS_WAITING_FOR_ACK&&this._status!==R.STATUS_CONFIRMED)return!1;var o=new n(this._ua);o.on("confirmed",(function(){r.terminate()})),o.init_incoming(e,t)}function o(){k.debug("Replaced INVITE rejected by the user"),e.reply(486)}k.debug("receiveReplaces()"),this.emit("replaces",{request:e,accept:function(e){r.call(t,e)},reject:function(){o.call(t)}})}},{key:"_sendInitialRequest",value:function(e,t,n){var r=this,o=new S(this._ua,this._request,{onRequestTimeout:function(){r.onRequestTimeout()},onTransportError:function(){r.onTransportError()},onAuthenticated:function(e){r._request=e},onReceiveResponse:function(e){r._receiveInviteResponse(e)}});Promise.resolve().then((function(){return n||(e.audio||e.video?(r._localMediaStreamLocallyGenerated=!0,navigator.mediaDevices.getUserMedia(e).catch((function(e){if(r._status===R.STATUS_TERMINATED)throw new Error("terminated");throw r._failed("local",null,p.causes.USER_DENIED_MEDIA_ACCESS),k.warn('emit "getusermediafailed" [error:%o]',e),r.emit("getusermediafailed",e),e}))):void 0)})).then((function(e){if(r._status===R.STATUS_TERMINATED)throw new Error("terminated");return r._localMediaStream=e,e&&e.getTracks().forEach((function(t){r._connection.addTrack(t,e)})),r._connecting(r._request),r._createLocalDescription("offer",t).catch((function(e){throw r._failed("local",null,p.causes.WEBRTC_ERROR),e}))})).then((function(e){if(r._is_canceled||r._status===R.STATUS_TERMINATED)throw new Error("terminated");r._request.body=e,r._status=R.STATUS_INVITE_SENT,k.debug('emit "sending" [request:%o]',r._request),r.emit("sending",{request:r._request}),o.send()})).catch((function(e){r._status!==R.STATUS_TERMINATED&&k.warn(e)}))}},{key:"_getDTMFRTPSender",value:function(){var e=this._connection.getSenders().find((function(e){return e.track&&"audio"===e.track.kind}));if(e&&e.dtmf)return e.dtmf;k.warn("sendDTMF() | no local audio track to send DTMF with")}},{key:"_receiveInviteResponse",value:function(e){var t=this;if(k.debug("receiveInviteResponse()"),this._dialog&&e.status_code>=200&&e.status_code<=299){if(this._dialog.id.call_id===e.call_id&&this._dialog.id.local_tag===e.from_tag&&this._dialog.id.remote_tag===e.to_tag)return void this.sendRequest(p.ACK);var n=new b(this,e,"UAC");return void 0!==n.error?void k.debug(n.error):(this.sendRequest(p.ACK),void this.sendRequest(p.BYE))}if(this._is_canceled)e.status_code>=100&&e.status_code<200?this._request.cancel(this._cancel_reason):e.status_code>=200&&e.status_code<299&&this._acceptAndTerminate(e);else if(this._status===R.STATUS_INVITE_SENT||this._status===R.STATUS_1XX_RECEIVED)switch(!0){case/^100$/.test(e.status_code):this._status=R.STATUS_1XX_RECEIVED;break;case/^1[0-9]{2}$/.test(e.status_code):if(!e.to_tag){k.debug("1xx response received without to tag");break}if(e.hasHeader("contact")&&!this._createDialog(e,"UAC",!0))break;if(this._status=R.STATUS_1XX_RECEIVED,!e.body){this._progress("remote",e);break}var r={originator:"remote",type:"answer",sdp:e.body};k.debug('emit "sdp"'),this.emit("sdp",r);var o=new RTCSessionDescription({type:"answer",sdp:r.sdp});this._connectionPromiseQueue=this._connectionPromiseQueue.then((function(){return t._connection.setRemoteDescription(o)})).then((function(){return t._progress("remote",e)})).catch((function(e){k.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),t.emit("peerconnection:setremotedescriptionfailed",e)}));break;case/^2[0-9]{2}$/.test(e.status_code):if(this._status=R.STATUS_CONFIRMED,!e.body){this._acceptAndTerminate(e,400,p.causes.MISSING_SDP),this._failed("remote",e,p.causes.BAD_MEDIA_DESCRIPTION);break}if(!this._createDialog(e,"UAC"))break;var i={originator:"remote",type:"answer",sdp:e.body};k.debug('emit "sdp"'),this.emit("sdp",i);var a=new RTCSessionDescription({type:"answer",sdp:i.sdp});this._connectionPromiseQueue=this._connectionPromiseQueue.then((function(){if("stable"===t._connection.signalingState)return t._connection.createOffer(t._rtcOfferConstraints).then((function(e){return t._connection.setLocalDescription(e)})).catch((function(n){t._acceptAndTerminate(e,500,n.toString()),t._failed("local",e,p.causes.WEBRTC_ERROR)}))})).then((function(){t._connection.setRemoteDescription(a).then((function(){t._handleSessionTimersInIncomingResponse(e),t._accepted("remote",e),t.sendRequest(p.ACK),t._confirmed("local",null)})).catch((function(n){t._acceptAndTerminate(e,488,"Not Acceptable Here"),t._failed("remote",e,p.causes.BAD_MEDIA_DESCRIPTION),k.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',n),t.emit("peerconnection:setremotedescriptionfailed",n)}))}));break;default:var l=v.sipErrorCause(e.status_code);this._failed("remote",e,l)}}},{key:"_sendReinvite",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};k.debug("sendReinvite()");var n=v.cloneArray(t.extraHeaders),r=v.cloneObject(t.eventHandlers),o=t.rtcOfferConstraints||this._rtcOfferConstraints||null,i=!1;function a(e){var t=this;if(this._status!==R.STATUS_TERMINATED&&(this.sendRequest(p.ACK),!i))if(this._handleSessionTimersInIncomingResponse(e),e.body)if(e.hasHeader("Content-Type")&&"application/sdp"===e.getHeader("Content-Type").toLowerCase()){var n={originator:"remote",type:"answer",sdp:e.body};k.debug('emit "sdp"'),this.emit("sdp",n);var o=new RTCSessionDescription({type:"answer",sdp:n.sdp});this._connectionPromiseQueue=this._connectionPromiseQueue.then((function(){return t._connection.setRemoteDescription(o)})).then((function(){r.succeeded&&r.succeeded(e)})).catch((function(e){l.call(t),k.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),t.emit("peerconnection:setremotedescriptionfailed",e)}))}else l.call(this);else l.call(this)}function l(e){r.failed&&r.failed(e)}n.push("Contact: ".concat(this._contact)),n.push("Content-Type: application/sdp"),this._sessionTimers.running&&n.push("Session-Expires: ".concat(this._sessionTimers.currentExpires,";refresher=").concat(this._sessionTimers.refresher?"uac":"uas")),this._connectionPromiseQueue=this._connectionPromiseQueue.then((function(){return e._createLocalDescription("offer",o)})).then((function(t){var r={originator:"local",type:"offer",sdp:t=e._mangleOffer(t)};k.debug('emit "sdp"'),e.emit("sdp",r),e.sendRequest(p.INVITE,{extraHeaders:n,body:t,eventHandlers:{onSuccessResponse:function(t){a.call(e,t),i=!0},onErrorResponse:function(t){l.call(e,t)},onTransportError:function(){e.onTransportError()},onRequestTimeout:function(){e.onRequestTimeout()},onDialogError:function(){e.onDialogError()}}})})).catch((function(){l()}))}},{key:"_sendUpdate",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};k.debug("sendUpdate()");var n=v.cloneArray(t.extraHeaders),r=v.cloneObject(t.eventHandlers),o=t.rtcOfferConstraints||this._rtcOfferConstraints||null,i=t.sdpOffer||!1,a=!1;function l(e){var t=this;if(this._status!==R.STATUS_TERMINATED&&!a)if(this._handleSessionTimersInIncomingResponse(e),i){if(!e.body)return void s.call(this);if(!e.hasHeader("Content-Type")||"application/sdp"!==e.getHeader("Content-Type").toLowerCase())return void s.call(this);var n={originator:"remote",type:"answer",sdp:e.body};k.debug('emit "sdp"'),this.emit("sdp",n);var o=new RTCSessionDescription({type:"answer",sdp:n.sdp});this._connectionPromiseQueue=this._connectionPromiseQueue.then((function(){return t._connection.setRemoteDescription(o)})).then((function(){r.succeeded&&r.succeeded(e)})).catch((function(e){s.call(t),k.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),t.emit("peerconnection:setremotedescriptionfailed",e)}))}else r.succeeded&&r.succeeded(e)}function s(e){r.failed&&r.failed(e)}n.push("Contact: ".concat(this._contact)),this._sessionTimers.running&&n.push("Session-Expires: ".concat(this._sessionTimers.currentExpires,";refresher=").concat(this._sessionTimers.refresher?"uac":"uas")),i?(n.push("Content-Type: application/sdp"),this._connectionPromiseQueue=this._connectionPromiseQueue.then((function(){return e._createLocalDescription("offer",o)})).then((function(t){var r={originator:"local",type:"offer",sdp:t=e._mangleOffer(t)};k.debug('emit "sdp"'),e.emit("sdp",r),e.sendRequest(p.UPDATE,{extraHeaders:n,body:t,eventHandlers:{onSuccessResponse:function(t){l.call(e,t),a=!0},onErrorResponse:function(t){s.call(e,t)},onTransportError:function(){e.onTransportError()},onRequestTimeout:function(){e.onRequestTimeout()},onDialogError:function(){e.onDialogError()}}})})).catch((function(){s.call(e)}))):this.sendRequest(p.UPDATE,{extraHeaders:n,eventHandlers:{onSuccessResponse:function(t){l.call(e,t)},onErrorResponse:function(t){s.call(e,t)},onTransportError:function(){e.onTransportError()},onRequestTimeout:function(){e.onRequestTimeout()},onDialogError:function(){e.onDialogError()}}})}},{key:"_acceptAndTerminate",value:function(e,t,n){k.debug("acceptAndTerminate()");var r=[];t&&(n=n||p.REASON_PHRASE[t]||"",r.push("Reason: SIP ;cause=".concat(t,'; text="').concat(n,'"'))),(this._dialog||this._createDialog(e,"UAC"))&&(this.sendRequest(p.ACK),this.sendRequest(p.BYE,{extraHeaders:r})),this._status=R.STATUS_TERMINATED}},{key:"_mangleOffer",value:function(e){if(!this._localHold&&!this._remoteHold)return e;if(e=d.parse(e),this._localHold&&!this._remoteHold){k.debug("mangleOffer() | me on hold, mangling offer");var t,n=o(e.media);try{for(n.s();!(t=n.n()).done;){var r=t.value;-1!==O.indexOf(r.type)&&(r.direction?"sendrecv"===r.direction?r.direction="sendonly":"recvonly"===r.direction&&(r.direction="inactive"):r.direction="sendonly")}}catch(f){n.e(f)}finally{n.f()}}else if(this._localHold&&this._remoteHold){k.debug("mangleOffer() | both on hold, mangling offer");var i,a=o(e.media);try{for(a.s();!(i=a.n()).done;){var l=i.value;-1!==O.indexOf(l.type)&&(l.direction="inactive")}}catch(f){a.e(f)}finally{a.f()}}else if(this._remoteHold){k.debug("mangleOffer() | remote on hold, mangling offer");var s,u=o(e.media);try{for(u.s();!(s=u.n()).done;){var c=s.value;-1!==O.indexOf(c.type)&&(c.direction?"sendrecv"===c.direction?c.direction="recvonly":"recvonly"===c.direction&&(c.direction="inactive"):c.direction="recvonly")}}catch(f){u.e(f)}finally{u.f()}}return d.write(e)}},{key:"_setLocalMediaStatus",value:function(){var e=!0,t=!0;(this._localHold||this._remoteHold)&&(e=!1,t=!1),this._audioMuted&&(e=!1),this._videoMuted&&(t=!1),this._toggleMuteAudio(!e),this._toggleMuteVideo(!t)}},{key:"_handleSessionTimersInIncomingRequest",value:function(e,t){var n;this._sessionTimers.enabled&&(e.session_expires&&e.session_expires>=p.MIN_SESSION_EXPIRES?(this._sessionTimers.currentExpires=e.session_expires,n=e.session_expires_refresher||"uas"):(this._sessionTimers.currentExpires=this._sessionTimers.defaultExpires,n="uas"),t.push("Session-Expires: ".concat(this._sessionTimers.currentExpires,";refresher=").concat(n)),this._sessionTimers.refresher="uas"===n,this._runSessionTimer())}},{key:"_handleSessionTimersInIncomingResponse",value:function(e){var t;this._sessionTimers.enabled&&(e.session_expires&&e.session_expires>=p.MIN_SESSION_EXPIRES?(this._sessionTimers.currentExpires=e.session_expires,t=e.session_expires_refresher||"uac"):(this._sessionTimers.currentExpires=this._sessionTimers.defaultExpires,t="uac"),this._sessionTimers.refresher="uac"===t,this._runSessionTimer())}},{key:"_runSessionTimer",value:function(){var e=this,t=this._sessionTimers.currentExpires;this._sessionTimers.running=!0,clearTimeout(this._sessionTimers.timer),this._sessionTimers.refresher?this._sessionTimers.timer=setTimeout((function(){e._status!==R.STATUS_TERMINATED&&e._isReadyToReOffer()&&(k.debug("runSessionTimer() | sending session refresh request"),e._sessionTimers.refreshMethod===p.UPDATE?e._sendUpdate():e._sendReinvite())}),500*t):this._sessionTimers.timer=setTimeout((function(){e._status!==R.STATUS_TERMINATED&&(k.warn("runSessionTimer() | timer expired, terminating the session"),e.terminate({cause:p.causes.REQUEST_TIMEOUT,status_code:408,reason_phrase:"Session Timer Expired"}))}),1100*t)}},{key:"_toggleMuteAudio",value:function(e){var t,n=this._connection.getSenders().filter((function(e){return e.track&&"audio"===e.track.kind})),r=o(n);try{for(r.s();!(t=r.n()).done;){t.value.track.enabled=!e}}catch(i){r.e(i)}finally{r.f()}}},{key:"_toggleMuteVideo",value:function(e){var t,n=this._connection.getSenders().filter((function(e){return e.track&&"video"===e.track.kind})),r=o(n);try{for(r.s();!(t=r.n()).done;){t.value.track.enabled=!e}}catch(i){r.e(i)}finally{r.f()}}},{key:"_newRTCSession",value:function(e,t){k.debug("newRTCSession()"),this._ua.newRTCSession(this,{originator:e,session:this,request:t})}},{key:"_connecting",value:function(e){k.debug("session connecting"),k.debug('emit "connecting"'),this.emit("connecting",{request:e})}},{key:"_progress",value:function(e,t){k.debug("session progress"),k.debug('emit "progress"'),this.emit("progress",{originator:e,response:t||null})}},{key:"_accepted",value:function(e,t){k.debug("session accepted"),this._start_time=new Date,k.debug('emit "accepted"'),this.emit("accepted",{originator:e,response:t||null})}},{key:"_confirmed",value:function(e,t){k.debug("session confirmed"),this._is_confirmed=!0,k.debug('emit "confirmed"'),this.emit("confirmed",{originator:e,ack:t||null})}},{key:"_ended",value:function(e,t,n){k.debug("session ended"),this._end_time=new Date,this._close(),k.debug('emit "ended"'),this.emit("ended",{originator:e,message:t||null,cause:n})}},{key:"_failed",value:function(e,t,n){k.debug("session failed"),k.debug('emit "_failed"'),this.emit("_failed",{originator:e,message:t||null,cause:n}),this._close(),k.debug('emit "failed"'),this.emit("failed",{originator:e,message:t||null,cause:n})}},{key:"_onhold",value:function(e){k.debug("session onhold"),this._setLocalMediaStatus(),k.debug('emit "hold"'),this.emit("hold",{originator:e})}},{key:"_onunhold",value:function(e){k.debug("session onunhold"),this._setLocalMediaStatus(),k.debug('emit "unhold"'),this.emit("unhold",{originator:e})}},{key:"_onmute",value:function(e){var t=e.audio,n=e.video;k.debug("session onmute"),this._setLocalMediaStatus(),k.debug('emit "muted"'),this.emit("muted",{audio:t,video:n})}},{key:"_onunmute",value:function(e){var t=e.audio,n=e.video;k.debug("session onunmute"),this._setLocalMediaStatus(),k.debug('emit "unmuted"'),this.emit("unmuted",{audio:t,video:n})}},{key:"C",get:function(){return R}},{key:"causes",get:function(){return p.causes}},{key:"id",get:function(){return this._id}},{key:"connection",get:function(){return this._connection}},{key:"contact",get:function(){return this._contact}},{key:"direction",get:function(){return this._direction}},{key:"local_identity",get:function(){return this._local_identity}},{key:"remote_identity",get:function(){return this._remote_identity}},{key:"start_time",get:function(){return this._start_time}},{key:"end_time",get:function(){return this._end_time}},{key:"data",get:function(){return this._data},set:function(e){this._data=e}},{key:"status",get:function(){return this._status}}]),n}(f)},4902:function(e,t,n){"use strict";function r(e){return r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{};if(void 0===e)throw new TypeError("Not enough arguments");if(this._direction="outgoing",this._session.status!==this._session.C.STATUS_CONFIRMED&&this._session.status!==this._session.C.STATUS_WAITING_FOR_ACK)throw new f.InvalidStateError(this._session.status);var r=d.cloneArray(n.extraHeaders);if(this.eventHandlers=d.cloneObject(n.eventHandlers),"string"===typeof e)e=e.toUpperCase();else{if("number"!==typeof e)throw new TypeError("Invalid tone: ".concat(e));e=e.toString()}if(!e.match(/^[0-9A-DR#*]$/))throw new TypeError("Invalid tone: ".concat(e));this._tone=e,this._duration=n.duration,r.push("Content-Type: application/dtmf-relay");var o="Signal=".concat(this._tone,"\r\n");o+="Duration=".concat(this._duration),this._session.newDTMF({originator:"local",dtmf:this,request:this._request}),this._session.sendRequest(c.INFO,{extraHeaders:r,eventHandlers:{onSuccessResponse:function(e){t.emit("succeeded",{originator:"remote",response:e})},onErrorResponse:function(e){t.eventHandlers.onFailed&&t.eventHandlers.onFailed(),t.emit("failed",{originator:"remote",response:e})},onRequestTimeout:function(){t._session.onRequestTimeout()},onTransportError:function(){t._session.onTransportError()},onDialogError:function(){t._session.onDialogError()}},body:o})}},{key:"init_incoming",value:function(e){var t=/^(Signal\s*?=\s*?)([0-9A-D#*]{1})(\s)?.*/,n=/^(Duration\s?=\s?)([0-9]{1,4})(\s)?.*/;if(this._direction="incoming",this._request=e,e.reply(200),e.body){var r=e.body.split("\n");r.length>=1&&t.test(r[0])&&(this._tone=r[0].replace(t,"$2")),r.length>=2&&n.test(r[1])&&(this._duration=parseInt(r[1].replace(n,"$2"),10))}this._duration||(this._duration=p.DEFAULT_DURATION),this._tone?this._session.newDTMF({originator:"remote",dtmf:this,request:e}):h.debug("invalid INFO DTMF received, discarded")}},{key:"tone",get:function(){return this._tone}},{key:"duration",get:function(){return this._duration}}],n&&o(t.prototype,n),r&&o(t,r),s}(s),e.exports.C=p},9161:function(e,t,n){"use strict";function r(e){return r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{};if(this._direction="outgoing",void 0===e)throw new TypeError("Not enough arguments");if(this._session.status!==this._session.C.STATUS_CONFIRMED&&this._session.status!==this._session.C.STATUS_WAITING_FOR_ACK)throw new c.InvalidStateError(this._session.status);this._contentType=e,this._body=t;var o=f.cloneArray(r.extraHeaders);o.push("Content-Type: ".concat(e)),this._session.newInfo({originator:"local",info:this,request:this.request}),this._session.sendRequest(u.INFO,{extraHeaders:o,eventHandlers:{onSuccessResponse:function(e){n.emit("succeeded",{originator:"remote",response:e})},onErrorResponse:function(e){n.emit("failed",{originator:"remote",response:e})},onTransportError:function(){n._session.onTransportError()},onRequestTimeout:function(){n._session.onRequestTimeout()},onDialogError:function(){n._session.onDialogError()}},body:t})}},{key:"init_incoming",value:function(e){this._direction="incoming",this.request=e,e.reply(200),this._contentType=e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0,this._body=e.body,this._session.newInfo({originator:"remote",info:this,request:e})}},{key:"contentType",get:function(){return this._contentType}},{key:"body",get:function(){return this._body}}],n&&o(t.prototype,n),r&&o(t,r),s}(s)},8857:function(e,t,n){"use strict";function r(e,t){for(var n=0;n=200?"terminated;reason=noresource":"active;expires=".concat(this._expires),this._session.sendRequest(i.NOTIFY,{extraHeaders:["Event: ".concat(l,";id=").concat(this._id),"Subscription-State: ".concat(n),"Content-Type: ".concat(s)],body:"SIP/2.0 ".concat(e," ").concat(t),eventHandlers:{onErrorResponse:function(){this._active=!1}}}))}}])&&r(t.prototype,n),o&&r(t,o),e}()},7101:function(e,t,n){"use strict";function r(e){return r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{};h.debug("sendRefer()");var r=d.cloneArray(n.extraHeaders),o=d.cloneObject(n.eventHandlers);for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&this.on(i,o[i]);var a=null;n.replaces&&(a=n.replaces._request.call_id,a+=";to-tag=".concat(n.replaces._to_tag),a+=";from-tag=".concat(n.replaces._from_tag),a=encodeURIComponent(a));var l="Refer-To: <".concat(e).concat(a?"?Replaces=".concat(a):"",">");if(r.push(l),!r.some((function(e){return e.toLowerCase().startsWith("referred-by:")}))){var s="Referred-By: <".concat(this._session._ua._configuration.uri._scheme,":").concat(this._session._ua._configuration.uri._user,"@").concat(this._session._ua._configuration.uri._host,">");r.push(s)}r.push("Contact: ".concat(this._session.contact));var u=this._session.sendRequest(c.REFER,{extraHeaders:r,eventHandlers:{onSuccessResponse:function(e){t._requestSucceeded(e)},onErrorResponse:function(e){t._requestFailed(e,c.causes.REJECTED)},onTransportError:function(){t._requestFailed(null,c.causes.CONNECTION_ERROR)},onRequestTimeout:function(){t._requestFailed(null,c.causes.REQUEST_TIMEOUT)},onDialogError:function(){t._requestFailed(null,c.causes.DIALOG_ERROR)}}});this._id=u.cseq}},{key:"receiveNotify",value:function(e){if(h.debug("receiveNotify()"),e.body){var t=f.parse(e.body.trim().split("\r\n",1)[0],"Status_Line");if(-1!==t)switch(!0){case/^100$/.test(t.status_code):this.emit("trying",{request:e,status_line:t});break;case/^1[0-9]{2}$/.test(t.status_code):this.emit("progress",{request:e,status_line:t});break;case/^2[0-9]{2}$/.test(t.status_code):this.emit("accepted",{request:e,status_line:t});break;default:this.emit("failed",{request:e,status_line:t})}else h.debug('receiveNotify() | error parsing NOTIFY body: "'.concat(e.body,'"'))}}},{key:"_requestSucceeded",value:function(e){h.debug("REFER succeeded"),h.debug('emit "requestSucceeded"'),this.emit("requestSucceeded",{response:e})}},{key:"_requestFailed",value:function(e,t){h.debug("REFER failed"),h.debug('emit "requestFailed"'),this.emit("requestFailed",{response:e||null,cause:t})}},{key:"id",get:function(){return this._id}}],n&&o(t.prototype,n),r&&o(t,r),s}(s)},3827:function(e,t,n){"use strict";function r(e,t){for(var n=0;n"'),this._contact+=";reg-id=".concat(this._reg_id),this._contact+=";+sip.instance=".concat(this._sipInstance)}var t,n,o;return t=e,n=[{key:"setExtraHeaders",value:function(e){Array.isArray(e)||(e=[]),this._extraHeaders=e.slice()}},{key:"setExtraContactParams",value:function(e){for(var t in e instanceof Object||(e={}),this._extraContactParams="",e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];this._extraContactParams+=";".concat(t),n&&(this._extraContactParams+="=".concat(n))}}},{key:"register",value:function(){var e=this;if(this._registering)u.debug("Register request in progress...");else{var t=this._extraHeaders.slice();t.push("Contact: ".concat(this._contact,";expires=").concat(this._expires).concat(this._extraContactParams)),t.push("Expires: ".concat(this._expires));var n=new l.OutgoingRequest(a.REGISTER,this._registrar,this._ua,{to_uri:this._to_uri,call_id:this._call_id,cseq:this._cseq+=1},t),r=new s(this._ua,n,{onRequestTimeout:function(){e._registrationFailure(null,a.causes.REQUEST_TIMEOUT)},onTransportError:function(){e._registrationFailure(null,a.causes.CONNECTION_ERROR)},onAuthenticated:function(){e._cseq+=1},onReceiveResponse:function(t){if(t.cseq===e._cseq)switch(null!==e._registrationTimer&&(clearTimeout(e._registrationTimer),e._registrationTimer=null),!0){case/^1[0-9]{2}$/.test(t.status_code):break;case/^2[0-9]{2}$/.test(t.status_code):if(e._registering=!1,!t.hasHeader("Contact")){u.debug("no Contact header in response to REGISTER, response ignored");break}var n=t.headers.Contact.reduce((function(e,t){return e.concat(t.parsed)}),[]),r=n.find((function(t){return e._sipInstance===t.getParam("+sip.instance")&&e._reg_id===parseInt(t.getParam("reg-id"))}));if(r||(r=n.find((function(t){return t.uri.user===e._ua.contact.uri.user}))),!r){u.debug("no Contact header pointing to us, response ignored");break}var o=r.getParam("expires");!o&&t.hasHeader("expires")&&(o=t.getHeader("expires")),o||(o=e._expires),(o=Number(o))<10&&(o=10);var l=o>64?1e3*o/2+Math.floor(1e3*(o/2-32)*Math.random()):1e3*o-5e3;e._registrationTimer=setTimeout((function(){e._registrationTimer=null,0===e._ua.listeners("registrationExpiring").length?e.register():e._ua.emit("registrationExpiring")}),l),r.hasParam("temp-gruu")&&(e._ua.contact.temp_gruu=r.getParam("temp-gruu").replace(/"/g,"")),r.hasParam("pub-gruu")&&(e._ua.contact.pub_gruu=r.getParam("pub-gruu").replace(/"/g,"")),e._registered||(e._registered=!0,e._ua.registered({response:t}));break;case/^423$/.test(t.status_code):t.hasHeader("min-expires")?(e._expires=Number(t.getHeader("min-expires")),e._expires<10&&(e._expires=10),e.register()):(u.debug("423 response received for REGISTER without Min-Expires"),e._registrationFailure(t,a.causes.SIP_FAILURE_CODE));break;default:var s=i.sipErrorCause(t.status_code);e._registrationFailure(t,s)}}});this._registering=!0,r.send()}}},{key:"unregister",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._registered){this._registered=!1,null!==this._registrationTimer&&(clearTimeout(this._registrationTimer),this._registrationTimer=null);var n=this._extraHeaders.slice();t.all?n.push("Contact: *".concat(this._extraContactParams)):n.push("Contact: ".concat(this._contact,";expires=0").concat(this._extraContactParams)),n.push("Expires: 0");var r=new l.OutgoingRequest(a.REGISTER,this._registrar,this._ua,{to_uri:this._to_uri,call_id:this._call_id,cseq:this._cseq+=1},n);new s(this._ua,r,{onRequestTimeout:function(){e._unregistered(null,a.causes.REQUEST_TIMEOUT)},onTransportError:function(){e._unregistered(null,a.causes.CONNECTION_ERROR)},onAuthenticated:function(){e._cseq+=1},onReceiveResponse:function(t){switch(!0){case/^1[0-9]{2}$/.test(t.status_code):break;case/^2[0-9]{2}$/.test(t.status_code):e._unregistered(t);break;default:var n=i.sipErrorCause(t.status_code);e._unregistered(t,n)}}}).send()}else u.debug("already unregistered")}},{key:"close",value:function(){this._registered&&this.unregister()}},{key:"onTransportClosed",value:function(){this._registering=!1,null!==this._registrationTimer&&(clearTimeout(this._registrationTimer),this._registrationTimer=null),this._registered&&(this._registered=!1,this._ua.unregistered({}))}},{key:"_registrationFailure",value:function(e,t){this._registering=!1,this._ua.registrationFailed({response:e||null,cause:t}),this._registered&&(this._registered=!1,this._ua.unregistered({response:e||null,cause:t}))}},{key:"_unregistered",value:function(e,t){this._registering=!1,this._registered=!1,this._ua.unregistered({response:e||null,cause:t||null})}},{key:"registered",get:function(){return this._registered}}],n&&r(t.prototype,n),o&&r(t,o),e}()},8043:function(e,t,n){"use strict";function r(e,t){for(var n=0;n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n")),this.setHeader("via",""),this.setHeader("max-forwards",m.MAX_FORWARDS);var l=o.to_uri||n,s=o.to_tag?{tag:o.to_tag}:null,u="undefined"!==typeof o.to_display_name?o.to_display_name:null;this.to=new v(l,u,s),this.setHeader("to",this.to.toString());var f,d=o.from_uri||r.configuration.uri,h={tag:o.from_tag||g.newTag()};f="undefined"!==typeof o.from_display_name?o.from_display_name:r.configuration.display_name?r.configuration.display_name:null,this.from=new v(d,f,h),this.setHeader("from",this.from.toString());var p=o.call_id||r.configuration.jssip_id+g.createRandomToken(15);this.call_id=p,this.setHeader("call-id",p);var _=o.cseq||Math.floor(1e4*Math.random());this.cseq=_,this.setHeader("cseq","".concat(_," ").concat(t))}return d(e,[{key:"setHeader",value:function(e,t){for(var n=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),r=0;r1&&void 0!==arguments[1]?arguments[1]:0;if(e=g.headerize(e),this.headers[e]){if(!(t>=this.headers[e].length)){var n=this.headers[e][t],r=n.raw;if(n.parsed)return n.parsed;var o=_.parse(r,e.replace(/-/g,"_"));return-1===o?(this.headers[e].splice(t,1),void y.debug('error parsing "'.concat(e,'" header field with value "').concat(r,'"'))):(n.parsed=o,o)}y.debug('not so many "'.concat(e,'" headers present'))}else y.debug('header "'.concat(e,'" not present'))}},{key:"s",value:function(e,t){return this.parseHeader(e,t)}},{key:"setHeader",value:function(e,t){var n={raw:t};this.headers[g.headerize(e)]=[n]}},{key:"parseSDP",value:function(e){return!e&&this.sdp||(this.sdp=h.parse(this.body||"")),this.sdp}},{key:"toString",value:function(){return this.data}}]),e}(),T=function(e){o(n,e);var t=a(n);function n(e){var r;return c(this,n),(r=t.call(this)).ua=e,r.headers={},r.ruri=null,r.transport=null,r.server_transaction=null,r}return d(n,[{key:"reply",value:function(e,t,n,r,o,i){var a=[],l=this.getHeader("To");if(t=t||null,!(e=e||null)||e<100||e>699)throw new TypeError("Invalid status_code: ".concat(e));if(t&&"string"!==typeof t&&!(t instanceof String))throw new TypeError("Invalid reason_phrase: ".concat(t));t=t||m.REASON_PHRASE[e]||"",n=g.cloneArray(n),this.ua.configuration.extra_headers&&(n=n.concat(this.ua.configuration.extra_headers));var u="SIP/2.0 ".concat(e," ").concat(t,"\r\n");if(this.method===m.INVITE&&e>100&&e<=200){var c,f=s(this.getHeaders("record-route"));try{for(f.s();!(c=f.n()).done;){var d=c.value;u+="Record-Route: ".concat(d,"\r\n")}}catch(w){f.e(w)}finally{f.f()}}var h,p=s(this.getHeaders("via"));try{for(p.s();!(h=p.n()).done;){var v=h.value;u+="Via: ".concat(v,"\r\n")}}catch(w){p.e(w)}finally{p.f()}!this.to_tag&&e>100?l+=";tag=".concat(g.newTag()):this.to_tag&&!this.s("to").hasParam("tag")&&(l+=";tag=".concat(this.to_tag)),u+="To: ".concat(l,"\r\n"),u+="From: ".concat(this.getHeader("From"),"\r\n"),u+="Call-ID: ".concat(this.call_id,"\r\n"),u+="CSeq: ".concat(this.cseq," ").concat(this.method,"\r\n");var _,y=s(n);try{for(y.s();!(_=y.n()).done;){var b=_.value;u+="".concat(b.trim(),"\r\n")}}catch(w){y.e(w)}finally{y.f()}switch(this.method){case m.INVITE:this.ua.configuration.session_timers&&a.push("timer"),(this.ua.contact.pub_gruu||this.ua.contact.temp_gruu)&&a.push("gruu"),a.push("ice","replaces");break;case m.UPDATE:this.ua.configuration.session_timers&&a.push("timer"),r&&a.push("ice"),a.push("replaces")}if(a.push("outbound"),this.method===m.OPTIONS?(u+="Allow: ".concat(m.ALLOWED_METHODS,"\r\n"),u+="Accept: ".concat(m.ACCEPTED_BODY_TYPES,"\r\n")):405===e?u+="Allow: ".concat(m.ALLOWED_METHODS,"\r\n"):415===e&&(u+="Accept: ".concat(m.ACCEPTED_BODY_TYPES,"\r\n")),u+="Supported: ".concat(a,"\r\n"),r){var S=g.str_utf8_length(r);u+="Content-Type: application/sdp\r\n",u+="Content-Length: ".concat(S,"\r\n\r\n"),u+=r}else u+="Content-Length: ".concat(0,"\r\n\r\n");this.server_transaction.receiveResponse(e,u,o,i)}},{key:"reply_sl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=this.getHeaders("via");if(!e||e<100||e>699)throw new TypeError("Invalid status_code: ".concat(e));if(t&&"string"!==typeof t&&!(t instanceof String))throw new TypeError("Invalid reason_phrase: ".concat(t));t=t||m.REASON_PHRASE[e]||"";var r,o="SIP/2.0 ".concat(e," ").concat(t,"\r\n"),i=s(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;o+="Via: ".concat(a,"\r\n")}}catch(d){i.e(d)}finally{i.f()}var l=this.getHeader("To");if(!this.to_tag&&e>100?l+=";tag=".concat(g.newTag()):this.to_tag&&!this.s("to").hasParam("tag")&&(l+=";tag=".concat(this.to_tag)),o+="To: ".concat(l,"\r\n"),o+="From: ".concat(this.getHeader("From"),"\r\n"),o+="Call-ID: ".concat(this.call_id,"\r\n"),o+="CSeq: ".concat(this.cseq," ").concat(this.method,"\r\n"),this.ua.configuration.extra_headers){var u,c=s(this.ua.configuration.extra_headers);try{for(c.s();!(u=c.n()).done;){var f=u.value;o+="".concat(f.trim(),"\r\n")}}catch(d){c.e(d)}finally{c.f()}}o+="Content-Length: ".concat(0,"\r\n\r\n"),this.transport.send(o)}}]),n}(w),C=function(e){o(n,e);var t=a(n);function n(){var e;return c(this,n),(e=t.call(this)).headers={},e.status_code=null,e.reason_phrase=null,e}return n}(w);e.exports={OutgoingRequest:b,InitialOutgoingInviteRequest:S,IncomingRequest:T,IncomingResponse:C}},5998:function(e,t,n){"use strict";var r=n(2727),o=n(8202),i=n(5294),a=new r("Socket");t.isSocket=function(e){if(Array.isArray(e))return!1;if("undefined"===typeof e)return a.warn("undefined JsSIP.Socket instance"),!1;try{if(!o.isString(e.url))throw a.warn("missing or invalid JsSIP.Socket url property"),new Error("Missing or invalid JsSIP.Socket url property");if(!o.isString(e.via_transport))throw a.warn("missing or invalid JsSIP.Socket via_transport property"),new Error("Missing or invalid JsSIP.Socket via_transport property");if(-1===i.parse(e.sip_uri,"SIP_URI"))throw a.warn("missing or invalid JsSIP.Socket sip_uri property"),new Error("missing or invalid JsSIP.Socket sip_uri property")}catch(t){return!1}try{["connect","disconnect","send"].forEach((function(t){if(!o.isFunction(e[t]))throw a.warn("missing or invalid JsSIP.Socket method: ".concat(t)),new Error("Missing or invalid JsSIP.Socket method: ".concat(t))}))}catch(t){return!1}return!0}},9373:function(e){"use strict";var t=500;e.exports={T1:t,T2:4e3,T4:5e3,TIMER_B:32e3,TIMER_D:0,TIMER_F:32e3,TIMER_H:32e3,TIMER_I:0,TIMER_J:0,TIMER_K:0,TIMER_L:32e3,TIMER_M:32e3,PROVISIONAL_RESPONSE_INTERVAL:6e4}},198:function(e,t,n){"use strict";function r(e){return r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n=100&&n<=199)switch(this.state){case w.STATUS_CALLING:this.stateChanged(w.STATUS_PROCEEDING),this.eventHandlers.onReceiveResponse(e);break;case w.STATUS_PROCEEDING:this.eventHandlers.onReceiveResponse(e)}else if(n>=200&&n<=299)switch(this.state){case w.STATUS_CALLING:case w.STATUS_PROCEEDING:this.stateChanged(w.STATUS_ACCEPTED),this.M=setTimeout((function(){t.timer_M()}),g.TIMER_M),this.eventHandlers.onReceiveResponse(e);break;case w.STATUS_ACCEPTED:this.eventHandlers.onReceiveResponse(e)}else if(n>=300&&n<=699)switch(this.state){case w.STATUS_CALLING:case w.STATUS_PROCEEDING:this.stateChanged(w.STATUS_COMPLETED),this.sendACK(e),this.eventHandlers.onReceiveResponse(e);break;case w.STATUS_COMPLETED:this.sendACK(e)}}},{key:"C",get:function(){return w}}]),n}(d),E=function(e){l(n,e);var t=u(n);function n(e,r,i,a){var l;o(this,n),(l=t.call(this)).id="z9hG4bK".concat(Math.floor(1e7*Math.random())),l.transport=r,l.request=i,l.eventHandlers=a;var s="SIP/2.0/".concat(r.via_transport);return s+=" ".concat(e.configuration.via_host,";branch=").concat(l.id),l.request.setHeader("via",s),l}return a(n,[{key:"send",value:function(){this.transport.send(this.request)||this.onTransportError()}},{key:"onTransportError",value:function(){y.debug("transport error occurred for transaction ".concat(this.id)),this.eventHandlers.onTransportError()}},{key:"C",get:function(){return w}}]),n}(d),A=function(e){l(n,e);var t=u(n);function n(e,r,i){var a;return o(this,n),(a=t.call(this)).type=w.NON_INVITE_SERVER,a.id=i.via_branch,a.ua=e,a.transport=r,a.request=i,a.last_response="",i.server_transaction=c(a),a.state=w.STATUS_TRYING,e.newTransaction(c(a)),a}return a(n,[{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"timer_J",value:function(){b.debug("Timer J expired for transaction ".concat(this.id)),this.stateChanged(w.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"onTransportError",value:function(){this.transportError||(this.transportError=!0,b.debug("transport error occurred, deleting transaction ".concat(this.id)),clearTimeout(this.J),this.stateChanged(w.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"receiveResponse",value:function(e,t,n,r){var o=this;if(100===e)switch(this.state){case w.STATUS_TRYING:this.stateChanged(w.STATUS_PROCEEDING),this.transport.send(t)||this.onTransportError();break;case w.STATUS_PROCEEDING:this.last_response=t,this.transport.send(t)?n&&n():(this.onTransportError(),r&&r())}else if(e>=200&&e<=699)switch(this.state){case w.STATUS_TRYING:case w.STATUS_PROCEEDING:this.stateChanged(w.STATUS_COMPLETED),this.last_response=t,this.J=setTimeout((function(){o.timer_J()}),g.TIMER_J),this.transport.send(t)?n&&n():(this.onTransportError(),r&&r())}}},{key:"C",get:function(){return w}}]),n}(d),k=function(e){l(n,e);var t=u(n);function n(e,r,i){var a;return o(this,n),(a=t.call(this)).type=w.INVITE_SERVER,a.id=i.via_branch,a.ua=e,a.transport=r,a.request=i,a.last_response="",i.server_transaction=c(a),a.state=w.STATUS_PROCEEDING,e.newTransaction(c(a)),a.resendProvisionalTimer=null,i.reply(100),a}return a(n,[{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"timer_H",value:function(){S.debug("Timer H expired for transaction ".concat(this.id)),this.state===w.STATUS_COMPLETED&&S.debug("ACK not received, dialog will be terminated"),this.stateChanged(w.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"timer_I",value:function(){this.stateChanged(w.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"timer_L",value:function(){S.debug("Timer L expired for transaction ".concat(this.id)),this.state===w.STATUS_ACCEPTED&&(this.stateChanged(w.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"onTransportError",value:function(){this.transportError||(this.transportError=!0,S.debug("transport error occurred, deleting transaction ".concat(this.id)),null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null),clearTimeout(this.L),clearTimeout(this.H),clearTimeout(this.I),this.stateChanged(w.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"resend_provisional",value:function(){this.transport.send(this.last_response)||this.onTransportError()}},{key:"receiveResponse",value:function(e,t,n,r){var o=this;if(e>=100&&e<=199&&this.state===w.STATUS_PROCEEDING)this.transport.send(t)||this.onTransportError(),this.last_response=t;if(e>100&&e<=199&&this.state===w.STATUS_PROCEEDING)null===this.resendProvisionalTimer&&(this.resendProvisionalTimer=setInterval((function(){o.resend_provisional()}),g.PROVISIONAL_RESPONSE_INTERVAL));else if(e>=200&&e<=299)switch(this.state){case w.STATUS_PROCEEDING:this.stateChanged(w.STATUS_ACCEPTED),this.last_response=t,this.L=setTimeout((function(){o.timer_L()}),g.TIMER_L),null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null);case w.STATUS_ACCEPTED:this.transport.send(t)?n&&n():(this.onTransportError(),r&&r())}else if(e>=300&&e<=699&&this.state===w.STATUS_PROCEEDING)null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null),this.transport.send(t)?(this.stateChanged(w.STATUS_COMPLETED),this.H=setTimeout((function(){o.timer_H()}),g.TIMER_H),n&&n()):(this.onTransportError(),r&&r())}},{key:"C",get:function(){return w}}]),n}(d);e.exports={C:w,NonInviteClientTransaction:T,InviteClientTransaction:C,AckClientTransaction:E,NonInviteServerTransaction:A,InviteServerTransaction:k,checkTransaction:function(e,t){var n,r=e._transactions;switch(t.method){case p.INVITE:if(n=r.ist[t.via_branch]){if(n.state===w.STATUS_PROCEEDING)n.transport.send(n.last_response);return!0}break;case p.ACK:if(!(n=r.ist[t.via_branch]))return!1;if(n.state===w.STATUS_ACCEPTED)return!1;if(n.state===w.STATUS_COMPLETED)return n.state=w.STATUS_CONFIRMED,n.I=setTimeout((function(){n.timer_I()}),g.TIMER_I),!0;break;case p.CANCEL:return(n=r.ist[t.via_branch])?(t.reply_sl(200),n.state!==w.STATUS_PROCEEDING):(t.reply_sl(481),!0);default:if(n=r.nist[t.via_branch]){switch(n.state){case w.STATUS_TRYING:break;case w.STATUS_PROCEEDING:case w.STATUS_COMPLETED:n.transport.send(n.last_response)}return!0}}}}},6498:function(e,t,n){"use strict";function r(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:s.recovery_options;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),l.debug("new()"),this.status=s.STATUS_DISCONNECTED,this.socket=null,this.sockets=[],this.recovery_options=n,this.recover_attempts=0,this.recovery_timer=null,this.close_requested=!1;try{this.textDecoder=new TextDecoder("utf8")}catch(r){l.warn("cannot use TextDecoder: ".concat(r))}if("undefined"===typeof t)throw new TypeError("Invalid argument. undefined 'sockets' argument");t instanceof Array||(t=[t]),t.forEach((function(e){if(!i.isSocket(e.socket))throw new TypeError("Invalid argument. invalid 'JsSIP.Socket' instance");if(e.weight&&!Number(e.weight))throw new TypeError("Invalid argument. 'weight' attribute is not a number");this.sockets.push({socket:e.socket,weight:e.weight||0,status:s.SOCKET_STATUS_READY})}),this),this._getSocket()}var t,n,o;return t=e,(n=[{key:"connect",value:function(){l.debug("connect()"),this.isConnected()?l.debug("Transport is already connected"):this.isConnecting()?l.debug("Transport is connecting"):(this.close_requested=!1,this.status=s.STATUS_CONNECTING,this.onconnecting({socket:this.socket,attempts:this.recover_attempts}),this.close_requested||(this.socket.onconnect=this._onConnect.bind(this),this.socket.ondisconnect=this._onDisconnect.bind(this),this.socket.ondata=this._onData.bind(this),this.socket.connect()))}},{key:"disconnect",value:function(){l.debug("close()"),this.close_requested=!0,this.recover_attempts=0,this.status=s.STATUS_DISCONNECTED,null!==this.recovery_timer&&(clearTimeout(this.recovery_timer),this.recovery_timer=null),this.socket.onconnect=function(){},this.socket.ondisconnect=function(){},this.socket.ondata=function(){},this.socket.disconnect(),this.ondisconnect({socket:this.socket,error:!1})}},{key:"send",value:function(e){if(l.debug("send()"),!this.isConnected())return l.warn("unable to send message, transport is not connected"),!1;var t=e.toString();return l.debug("sending message:\n\n".concat(t,"\n")),this.socket.send(t)}},{key:"isConnected",value:function(){return this.status===s.STATUS_CONNECTED}},{key:"isConnecting",value:function(){return this.status===s.STATUS_CONNECTING}},{key:"_reconnect",value:function(){var e=this;this.recover_attempts+=1;var t=Math.floor(Math.random()*Math.pow(2,this.recover_attempts)+1);tthis.recovery_options.max_interval&&(t=this.recovery_options.max_interval),l.debug("reconnection attempt: ".concat(this.recover_attempts,". next connection attempt in ").concat(t," seconds")),this.recovery_timer=setTimeout((function(){e.close_requested||e.isConnected()||e.isConnecting()||(e._getSocket(),e.connect())}),1e3*t)}},{key:"_getSocket",value:function(){var e=[];if(this.sockets.forEach((function(t){t.status!==s.SOCKET_STATUS_ERROR&&(0===e.length?e.push(t):t.weight>e[0].weight?e=[t]:t.weight===e[0].weight&&e.push(t))})),0===e.length)return this.sockets.forEach((function(e){e.status=s.SOCKET_STATUS_READY})),void this._getSocket();var t=Math.floor(Math.random()*e.length);this.socket=e[t].socket}},{key:"_onConnect",value:function(){this.recover_attempts=0,this.status=s.STATUS_CONNECTED,null!==this.recovery_timer&&(clearTimeout(this.recovery_timer),this.recovery_timer=null),this.onconnect({socket:this})}},{key:"_onDisconnect",value:function(e,t,n){this.status=s.STATUS_DISCONNECTED,this.ondisconnect({socket:this.socket,error:e,code:t,reason:n}),this.close_requested||(this.sockets.forEach((function(e){this.socket===e.socket&&(e.status=s.SOCKET_STATUS_ERROR)}),this),this._reconnect(e))}},{key:"_onData",value:function(e){if("\r\n\r\n"!==e)if("\r\n"!==e){if("string"!==typeof e){try{e=this.textDecoder?this.textDecoder.decode(e):String.fromCharCode.apply(null,new Uint8Array(e))}catch(t){return void l.debug("received binary message failed to be converted into string, message discarded")}l.debug("received binary message:\n\n".concat(e,"\n"))}else l.debug("received text message:\n\n".concat(e,"\n"));this.ondata({transport:this,message:e})}else l.debug("received message with CRLF Keep Alive response");else{l.debug("received message with double-CRLF Keep Alive request");try{this.socket.send("\r\n")}catch(n){l.warn("error sending Keep Alive response: ".concat(n))}}}},{key:"via_transport",get:function(){return this.socket.via_transport}},{key:"url",get:function(){return this.socket.url}},{key:"sip_uri",get:function(){return this.socket.sip_uri}}])&&r(t.prototype,n),o&&r(t,o),e}()},9273:function(e,t,n){"use strict";function r(e){return r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=e.anonymous||null,n=e.outbound||null,r="<";return r+=t?this.temp_gruu||"sip:anonymous@anonymous.invalid;transport=ws":this.pub_gruu||this.uri.toString(),!n||(t?this.temp_gruu:this.pub_gruu)||(r+=";ob"),r+=">"}};var r=["authorization_user","password","realm","ha1","authorization_jwt","display_name","register","extra_headers"];for(var o in this._configuration)Object.prototype.hasOwnProperty.call(this._configuration,o)&&(-1!==r.indexOf(o)?Object.defineProperty(this._configuration,o,{writable:!0,configurable:!1}):Object.defineProperty(this._configuration,o,{writable:!1,configurable:!1}));for(var i in A.debug("configuration parameters after validation:"),this._configuration)if(Object.prototype.hasOwnProperty.call(E.settings,i))switch(i){case"uri":case"registrar_server":A.debug("- ".concat(i,": ").concat(this._configuration[i]));break;case"password":case"ha1":case"authorization_jwt":A.debug("- ".concat(i,": NOT SHOWN"));break;default:A.debug("- ".concat(i,": ").concat(JSON.stringify(this._configuration[i])))}}},{key:"C",get:function(){return k}},{key:"status",get:function(){return this._status}},{key:"contact",get:function(){return this._contact}},{key:"configuration",get:function(){return this._configuration}},{key:"transport",get:function(){return this._transport}}]),n}(c)},6041:function(e,t,n){"use strict";function r(e,t){var n;if("undefined"===typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"===typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(e,t)}(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,l=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return l=e.done,e},e:function(e){s=!0,a=e},f:function(){try{l||null==n.return||n.return()}finally{if(s)throw a}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n4&&void 0!==arguments[4]?arguments[4]:{},a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!r)throw new TypeError('missing or invalid "host" parameter');for(var s in this._parameters={},this._headers={},this._scheme=t||l.SIP,this._user=n,this._host=r,this._port=o,i)Object.prototype.hasOwnProperty.call(i,s)&&this.setParam(s,i[s]);for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&this.setHeader(u,a[u])}return a(e,null,[{key:"parse",value:function(e){return-1!==(e=u.parse(e,"SIP_URI"))?e:void 0}}]),a(e,[{key:"setParam",value:function(e,t){e&&(this._parameters[e.toLowerCase()]="undefined"===typeof t||null===t?null:t.toString())}},{key:"getParam",value:function(e){if(e)return this._parameters[e.toLowerCase()]}},{key:"hasParam",value:function(e){if(e)return!!this._parameters.hasOwnProperty(e.toLowerCase())}},{key:"deleteParam",value:function(e){if(e=e.toLowerCase(),this._parameters.hasOwnProperty(e)){var t=this._parameters[e];return delete this._parameters[e],t}}},{key:"clearParams",value:function(){this._parameters={}}},{key:"setHeader",value:function(e,t){this._headers[s.headerize(e)]=Array.isArray(t)?t:[t]}},{key:"getHeader",value:function(e){if(e)return this._headers[s.headerize(e)]}},{key:"hasHeader",value:function(e){if(e)return!!this._headers.hasOwnProperty(s.headerize(e))}},{key:"deleteHeader",value:function(e){if(e=s.headerize(e),this._headers.hasOwnProperty(e)){var t=this._headers[e];return delete this._headers[e],t}}},{key:"clearHeaders",value:function(){this._headers={}}},{key:"clone",value:function(){return new e(this._scheme,this._user,this._host,this._port,JSON.parse(JSON.stringify(this._parameters)),JSON.parse(JSON.stringify(this._headers)))}},{key:"toString",value:function(){var e=[],t="".concat(this._scheme,":");for(var n in this._user&&(t+="".concat(s.escapeUser(this._user),"@")),t+=this._host,(this._port||0===this._port)&&(t+=":".concat(this._port)),this._parameters)Object.prototype.hasOwnProperty.call(this._parameters,n)&&(t+=";".concat(n),null!==this._parameters[n]&&(t+="=".concat(this._parameters[n])));for(var o in this._headers)if(Object.prototype.hasOwnProperty.call(this._headers,o)){var i,a=r(this._headers[o]);try{for(a.s();!(i=a.n()).done;){var l=i.value;e.push("".concat(o,"=").concat(l))}}catch(u){a.e(u)}finally{a.f()}}return e.length>0&&(t+="?".concat(e.join("&"))),t}},{key:"toAor",value:function(e){var t="".concat(this._scheme,":");return this._user&&(t+="".concat(s.escapeUser(this._user),"@")),t+=this._host,e&&(this._port||0===this._port)&&(t+=":".concat(this._port)),t}},{key:"scheme",get:function(){return this._scheme},set:function(e){this._scheme=e.toLowerCase()}},{key:"user",get:function(){return this._user},set:function(e){this._user=e}},{key:"host",get:function(){return this._host},set:function(e){this._host=e.toLowerCase()}},{key:"port",get:function(){return this._port},set:function(e){this._port=0===e?e:parseInt(e,10)||null}}]),e}()},8202:function(e,t,n){"use strict";function r(e){return r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t){var n;if("undefined"===typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"===typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,l=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return l=e.done,e},e:function(e){s=!0,a=e},f:function(){try{l||null==n.return||n.return()}finally{if(s)throw a}}}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:32,r="";for(t=0;t>>32-t}function n(e,t){var n=2147483648&e,r=2147483648&t,o=1073741824&e,i=1073741824&t,a=(1073741823&e)+(1073741823&t);return o&i?2147483648^a^n^r:o|i?1073741824&a?3221225472^a^n^r:1073741824^a^n^r:a^n^r}function r(e,r,o,i,a,l,s){return e=n(e,n(n(function(e,t,n){return e&t|~e&n}(r,o,i),a),s)),n(t(e,l),r)}function o(e,r,o,i,a,l,s){return e=n(e,n(n(function(e,t,n){return e&n|t&~n}(r,o,i),a),s)),n(t(e,l),r)}function i(e,r,o,i,a,l,s){return e=n(e,n(n(function(e,t,n){return e^t^n}(r,o,i),a),s)),n(t(e,l),r)}function a(e,r,o,i,a,l,s){return e=n(e,n(n(function(e,t,n){return t^(e|~n)}(r,o,i),a),s)),n(t(e,l),r)}function l(e){var t,n="",r="";for(t=0;t<=3;t++)n+=(r="0".concat((e>>>8*t&255).toString(16))).substr(r.length-2,2);return n}var s,u,c,f,d,h,p,m,g,v;for(s=function(e){for(var t,n=e.length,r=n+8,o=16*((r-r%64)/64+1),i=new Array(o-1),a=0,l=0;l>>29,i}(e=function(e){for(var t="",n=0;n127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t}(e)),p=1732584193,m=4023233417,g=2562383102,v=271733878,u=0;u1&&void 0!==arguments[1]?arguments[1]:{};return e&&Object.assign({},e)||t}},7421:function(e,t,n){"use strict";function r(e,t){for(var n=0;n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,l=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return l=e.done,e},e:function(e){s=!0,a=e},f:function(){try{l||null==n.return||n.return()}finally{if(s)throw a}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1)return d.debug("more than one Via header field present in the response, dropping the response"),!1},function(){var e=f.str_utf8_length(i.body),t=i.getHeader("content-length");if(e=1.5*n;return Math.round(e/n)+" "+r+(o?"s":"")}e.exports=function(e,s){s=s||{};var u=typeof e;if("string"===u&&e.length>0)return function(e){if((e=String(e)).length>100)return;var l=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!l)return;var s=parseFloat(l[1]);switch((l[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return s*a;case"weeks":case"week":case"w":return s*i;case"days":case"day":case"d":return s*o;case"hours":case"hour":case"hrs":case"hr":case"h":return s*r;case"minutes":case"minute":case"mins":case"min":case"m":return s*n;case"seconds":case"second":case"secs":case"sec":case"s":return s*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}(e);if("number"===u&&isFinite(e))return s.long?function(e){var i=Math.abs(e);if(i>=o)return l(e,i,o,"day");if(i>=r)return l(e,i,r,"hour");if(i>=n)return l(e,i,n,"minute");if(i>=t)return l(e,i,t,"second");return e+" ms"}(e):function(e){var i=Math.abs(e);if(i>=o)return Math.round(e/o)+"d";if(i>=r)return Math.round(e/r)+"h";if(i>=n)return Math.round(e/n)+"m";if(i>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},2123:function(e){"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(o){return!1}}()?Object.assign:function(e,o){for(var i,a,l=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),s=1;s